Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
authorLinus Torvalds <torvalds@linux-foundation.org>
Sat, 25 Apr 2020 02:17:30 +0000 (19:17 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 25 Apr 2020 02:17:30 +0000 (19:17 -0700)
Pull networking fixes from David Miller:

 1) Fix memory leak in netfilter flowtable, from Roi Dayan.

 2) Ref-count leaks in netrom and tipc, from Xiyu Yang.

 3) Fix warning when mptcp socket is never accepted before close, from
    Florian Westphal.

 4) Missed locking in ovs_ct_exit(), from Tonghao Zhang.

 5) Fix large delays during PTP synchornization in cxgb4, from Rahul
    Lakkireddy.

 6) team_mode_get() can hang, from Taehee Yoo.

 7) Need to use kvzalloc() when allocating fw tracer in mlx5 driver,
    from Niklas Schnelle.

 8) Fix handling of bpf XADD on BTF memory, from Jann Horn.

 9) Fix BPF_STX/BPF_B encoding in x86 bpf jit, from Luke Nelson.

10) Missing queue memory release in iwlwifi pcie code, from Johannes
    Berg.

11) Fix NULL deref in macvlan device event, from Taehee Yoo.

12) Initialize lan87xx phy correctly, from Yuiko Oshino.

13) Fix looping between VRF and XFRM lookups, from David Ahern.

14) etf packet scheduler assumes all sockets are full sockets, which is
    not necessarily true. From Eric Dumazet.

15) Fix mptcp data_fin handling in RX path, from Paolo Abeni.

16) fib_select_default() needs to handle nexthop objects, from David
    Ahern.

17) Use GFP_ATOMIC under spinlock in mac80211_hwsim, from Wei Yongjun.

18) vxlan and geneve use wrong nlattr array, from Sabrina Dubroca.

19) Correct rx/tx stats in bcmgenet driver, from Doug Berger.

20) BPF_LDX zero-extension is encoded improperly in x86_32 bpf jit, fix
    from Luke Nelson.

* git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (100 commits)
  selftests/bpf: Fix a couple of broken test_btf cases
  tools/runqslower: Ensure own vmlinux.h is picked up first
  bpf: Make bpf_link_fops static
  bpftool: Respect the -d option in struct_ops cmd
  selftests/bpf: Add test for freplace program with expected_attach_type
  bpf: Propagate expected_attach_type when verifying freplace programs
  bpf: Fix leak in LINK_UPDATE and enforce empty old_prog_fd
  bpf, x86_32: Fix logic error in BPF_LDX zero-extension
  bpf, x86_32: Fix clobbering of dst for BPF_JSET
  bpf, x86_32: Fix incorrect encoding in BPF_LDX zero-extension
  bpf: Fix reStructuredText markup
  net: systemport: suppress warnings on failed Rx SKB allocations
  net: bcmgenet: suppress warnings on failed Rx SKB allocations
  macsec: avoid to set wrong mtu
  mac80211: sta_info: Add lockdep condition for RCU list usage
  mac80211: populate debugfs only after cfg80211 init
  net: bcmgenet: correct per TX/RX ring statistics
  net: meth: remove spurious copyright text
  net: phy: bcm84881: clear settings on link down
  chcr: Fix CPU hard lockup
  ...

430 files changed:
.clang-format
Documentation/admin-guide/sysctl/kernel.rst
Documentation/arm64/amu.rst
Documentation/core-api/timekeeping.rst
Documentation/devicetree/bindings/arm/sunxi/allwinner,sun4i-a10-mbus.yaml
Documentation/devicetree/bindings/clock/arm,syscon-icst.yaml
Documentation/devicetree/bindings/display/bridge/adi,adv7123.txt
Documentation/devicetree/bindings/display/bridge/adi,adv7511.txt
Documentation/devicetree/bindings/display/panel/leadtek,ltk500hd1829.yaml
Documentation/devicetree/bindings/display/panel/lvds.yaml
Documentation/devicetree/bindings/display/panel/xinpeng,xpp055c272.yaml
Documentation/devicetree/bindings/dma/adi,axi-dmac.txt
Documentation/devicetree/bindings/hwmon/adi,axi-fan-control.yaml
Documentation/devicetree/bindings/hwmon/adt7475.yaml
Documentation/devicetree/bindings/iio/dac/ad5755.txt
Documentation/devicetree/bindings/iio/dac/adi,ad5770r.yaml
Documentation/devicetree/bindings/input/touchscreen/edt-ft5x06.yaml
Documentation/devicetree/bindings/interrupt-controller/loongson,liointc.yaml
Documentation/devicetree/bindings/memory-controllers/nvidia,tegra186-mc.yaml
Documentation/devicetree/bindings/mfd/rohm,bd71837-pmic.yaml
Documentation/devicetree/bindings/mfd/rohm,bd71847-pmic.yaml
Documentation/devicetree/bindings/mfd/st,stpmic1.yaml
Documentation/devicetree/bindings/net/qcom,ipq8064-mdio.yaml
Documentation/devicetree/bindings/net/qualcomm-bluetooth.txt
Documentation/devicetree/bindings/phy/ti,phy-j721e-wiz.yaml
Documentation/devicetree/bindings/pwm/google,cros-ec-pwm.yaml
Documentation/devicetree/bindings/rng/brcm,bcm2835.yaml
Documentation/devicetree/bindings/sound/rockchip-i2s.yaml
Documentation/devicetree/bindings/sound/rockchip-spdif.txt [deleted file]
Documentation/devicetree/bindings/sound/rockchip-spdif.yaml [new file with mode: 0644]
Documentation/devicetree/bindings/spi/qcom,spi-qcom-qspi.yaml
Documentation/devicetree/bindings/usb/ingenic,musb.yaml
Documentation/devicetree/bindings/usb/qcom,dwc3.txt
Documentation/devicetree/bindings/usb/rockchip,dwc3.txt
Documentation/hwmon/isl68137.rst
Documentation/kbuild/makefiles.rst
MAINTAINERS
Makefile
arch/arc/include/asm/module.h
arch/arc/include/asm/vermagic.h [new file with mode: 0644]
arch/arm/boot/dts/bcm2835-rpi.dtsi
arch/arm/boot/dts/bcm283x.dtsi
arch/arm/boot/dts/omap3-n950-n9.dtsi
arch/arm/include/asm/module.h
arch/arm/include/asm/vermagic.h [new file with mode: 0644]
arch/arm/mach-imx/Makefile
arch/arm/xen/enlighten.c
arch/arm64/include/asm/module.h
arch/arm64/include/asm/pointer_auth.h
arch/arm64/include/asm/sysreg.h
arch/arm64/include/asm/vermagic.h [new file with mode: 0644]
arch/arm64/kernel/vdso.c
arch/h8300/kernel/.gitignore [new file with mode: 0644]
arch/hexagon/include/asm/module.h [deleted file]
arch/hexagon/include/asm/vermagic.h [new file with mode: 0644]
arch/ia64/include/asm/module.h
arch/ia64/include/asm/vermagic.h [new file with mode: 0644]
arch/mips/include/asm/module.h
arch/mips/include/asm/vermagic.h [new file with mode: 0644]
arch/nds32/include/asm/module.h [deleted file]
arch/nds32/include/asm/vermagic.h [new file with mode: 0644]
arch/powerpc/include/asm/module.h
arch/powerpc/include/asm/vermagic.h [new file with mode: 0644]
arch/powerpc/kvm/book3s_64_mmu_hv.c
arch/powerpc/kvm/book3s_64_mmu_radix.c
arch/riscv/include/asm/module.h
arch/riscv/include/asm/vermagic.h [new file with mode: 0644]
arch/s390/kvm/interrupt.c
arch/s390/kvm/kvm-s390.c
arch/sh/include/asm/module.h
arch/sh/include/asm/vermagic.h [new file with mode: 0644]
arch/sh/mm/init.c
arch/um/Makefile
arch/x86/Kconfig
arch/x86/include/asm/microcode_amd.h
arch/x86/include/asm/module.h
arch/x86/include/asm/nospec-branch.h
arch/x86/include/asm/vermagic.h [new file with mode: 0644]
arch/x86/kernel/cpu/intel.c
arch/x86/kernel/cpu/resctrl/core.c
arch/x86/kernel/cpu/resctrl/internal.h
arch/x86/kernel/cpu/resctrl/rdtgroup.c
arch/x86/kernel/umip.c
arch/x86/kvm/Makefile
arch/x86/kvm/svm/sev.c
arch/x86/kvm/svm/svm.c
arch/x86/kvm/svm/vmenter.S
arch/x86/kvm/vmx/nested.c
arch/x86/kvm/vmx/vmx.c
arch/x86/kvm/x86.c
arch/xtensa/include/asm/module.h [deleted file]
arch/xtensa/include/asm/vermagic.h [new file with mode: 0644]
block/blk-iocost.c
block/blk-mq.c
block/blk-wbt.c
drivers/acpi/button.c
drivers/acpi/pci_link.c
drivers/ata/ahci.c
drivers/ata/sata_inic162x.c
drivers/base/power/main.c
drivers/block/null_blk.h
drivers/block/null_blk_main.c
drivers/block/null_blk_zoned.c
drivers/block/virtio_blk.c
drivers/char/hw_random/virtio-rng.c
drivers/char/tpm/tpm-interface.c
drivers/char/tpm/tpm2-cmd.c
drivers/char/tpm/tpm_ibmvtpm.c
drivers/char/tpm/tpm_tis_core.c
drivers/clk/clk-asm9260.c
drivers/clk/mmp/clk-pll.c
drivers/clk/mmp/clk.c
drivers/clk/mmp/clk.h
drivers/clk/sprd/sc9863a-clk.c
drivers/firmware/xilinx/zynqmp-debug.c
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
drivers/gpu/drm/amd/amdgpu/cik.c
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c
drivers/gpu/drm/amd/amdgpu/nv.c
drivers/gpu/drm/amd/amdgpu/soc15.c
drivers/gpu/drm/amd/amdgpu/vi.c
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.h
drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.c
drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c
drivers/gpu/drm/amd/powerplay/renoir_ppt.c
drivers/gpu/drm/amd/powerplay/smu_v11_0.c
drivers/gpu/drm/bridge/analogix/analogix-anx6345.c
drivers/gpu/drm/drm_dp_mst_topology.c
drivers/gpu/drm/i915/display/intel_ddi.c
drivers/gpu/drm/i915/display/intel_display_power.c
drivers/gpu/drm/i915/display/intel_dp.c
drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c
drivers/gpu/drm/i915/display/intel_hdmi.c
drivers/gpu/drm/i915/display/intel_sprite.c
drivers/gpu/drm/i915/gt/intel_rps.c
drivers/gpu/drm/i915/gvt/kvmgt.c
drivers/gpu/drm/i915/i915_drv.h
drivers/gpu/drm/i915/i915_perf.c
drivers/gpu/drm/i915/i915_reg.h
drivers/gpu/drm/meson/meson_dw_hdmi.c
drivers/gpu/drm/nouveau/nvkm/engine/sec2/gp108.c
drivers/gpu/drm/nouveau/nvkm/engine/sec2/tu102.c
drivers/gpu/drm/scheduler/sched_main.c
drivers/gpu/drm/tidss/tidss_crtc.c
drivers/gpu/drm/tidss/tidss_encoder.c
drivers/gpu/drm/tidss/tidss_plane.c
drivers/gpu/drm/virtio/virtgpu_ioctl.c
drivers/gpu/drm/virtio/virtgpu_kms.c
drivers/hwmon/Kconfig
drivers/hwmon/drivetemp.c
drivers/hwmon/jc42.c
drivers/hwmon/k10temp.c
drivers/hwmon/pmbus/isl68137.c
drivers/i2c/busses/i2c-altera.c
drivers/i2c/busses/i2c-designware-platdrv.c
drivers/i2c/busses/i2c-tegra.c
drivers/i2c/i2c-core-base.c
drivers/irqchip/irq-bcm7038-l1.c
drivers/irqchip/irq-gic-v3-its.c
drivers/irqchip/irq-gic-v3.c
drivers/irqchip/irq-mbigen.c
drivers/irqchip/irq-meson-gpio.c
drivers/irqchip/irq-mvebu-icu.c
drivers/irqchip/irq-sifive-plic.c
drivers/irqchip/irq-ti-sci-inta.c
drivers/misc/mic/Kconfig
drivers/mtd/spi-nor/Makefile
drivers/net/caif/Kconfig
drivers/of/overlay.c
drivers/of/unittest-data/overlay_bad_add_dup_prop.dts
drivers/of/unittest.c
drivers/opp/core.c
drivers/pci/quirks.c
drivers/remoteproc/mtk_common.h
drivers/remoteproc/mtk_scp.c
drivers/remoteproc/qcom_q6v5_mss.c
drivers/remoteproc/remoteproc_sysfs.c
drivers/remoteproc/stm32_rproc.c
drivers/rpmsg/mtk_rpmsg.c
drivers/s390/block/Kconfig
drivers/scsi/Kconfig
drivers/scsi/hisi_sas/Kconfig
drivers/scsi/qla2xxx/qla_dbg.c
drivers/scsi/qla2xxx/qla_init.c
drivers/scsi/qla2xxx/qla_isr.c
drivers/scsi/qla2xxx/qla_mbx.c
drivers/scsi/sg.c
drivers/soc/fsl/dpio/dpio-service.c
drivers/soc/fsl/dpio/qbman-portal.c
drivers/soc/imx/Kconfig
drivers/soc/xilinx/Kconfig
drivers/staging/gasket/apex_driver.c
drivers/target/target_core_fabric_lib.c
drivers/target/target_core_user.c
drivers/vdpa/Kconfig
drivers/vdpa/ifcvf/ifcvf_base.c
drivers/vdpa/ifcvf/ifcvf_main.c
drivers/vdpa/vdpa.c
drivers/vdpa/vdpa_sim/vdpa_sim.c
drivers/vhost/Kconfig
drivers/vhost/net.c
drivers/vhost/scsi.c
drivers/vhost/test.c
drivers/vhost/vdpa.c
drivers/vhost/vhost.h
drivers/vhost/vringh.c
drivers/vhost/vsock.c
drivers/virtio/Kconfig
drivers/virtio/virtio_balloon.c
drivers/virtio/virtio_input.c
drivers/watchdog/sp805_wdt.c
drivers/xen/xenbus/xenbus_client.c
fs/afs/cmservice.c
fs/afs/fs_probe.c
fs/afs/internal.h
fs/afs/rotate.c
fs/afs/server.c
fs/afs/vl_rotate.c
fs/afs/volume.c
fs/block_dev.c
fs/btrfs/relocation.c
fs/buffer.c
fs/cifs/cifssmb.c
fs/cifs/inode.c
fs/cifs/smb2pdu.c
fs/cifs/smb2transport.c
fs/coredump.c
fs/exfat/balloc.c
fs/exfat/exfat_fs.h
fs/exfat/file.c
fs/exfat/misc.c
fs/exfat/namei.c
fs/exfat/super.c
fs/ext4/balloc.c
fs/ext4/ext4_jbd2.c
fs/ext4/extents.c
fs/ext4/ialloc.c
fs/ext4/inode.c
fs/ext4/mballoc.c
fs/ext4/super.c
fs/io_uring.c
fs/nfs/pnfs.c
fs/nfsd/nfs4callback.c
fs/nfsd/nfs4state.c
fs/proc/base.c
fs/proc/root.c
fs/proc/vmcore.c
fs/xfs/xfs_icache.c
fs/xfs/xfs_ioctl.c
fs/xfs/xfs_mount.h
fs/xfs/xfs_reflink.c
fs/xfs/xfs_super.c
include/asm-generic/Kbuild
include/asm-generic/vermagic.h [new file with mode: 0644]
include/linux/backing-dev-defs.h
include/linux/bio.h
include/linux/blk-mq.h
include/linux/blk_types.h
include/linux/buffer_head.h
include/linux/can/dev/peak_canfd.h
include/linux/cpu_rmap.h
include/linux/digsig.h
include/linux/dirent.h
include/linux/enclosure.h
include/linux/energy_model.h
include/linux/ethtool.h
include/linux/genalloc.h
include/linux/i2c.h
include/linux/igmp.h
include/linux/ihex.h
include/linux/irq.h
include/linux/irqchip/arm-gic-v3.h
include/linux/kvm_host.h
include/linux/list_lru.h
include/linux/memcontrol.h
include/linux/platform_data/wilco-ec.h
include/linux/pnp.h
include/linux/posix_acl.h
include/linux/rio.h
include/linux/rslib.h
include/linux/sched/topology.h
include/linux/skbuff.h
include/linux/sunrpc/svc_rdma.h
include/linux/swap.h
include/linux/ti_wilink_st.h
include/linux/tpm_eventlog.h
include/linux/tracepoint.h
include/linux/vdpa.h
include/linux/vermagic.h
include/linux/virtio.h
include/linux/vmalloc.h
include/linux/vringh.h
include/linux/xattr.h
include/soc/tegra/pmc.h
include/sound/hda_codec.h
include/sound/soc-dai.h
include/sound/soc.h
include/trace/events/iocost.h
include/trace/events/rpcrdma.h
include/trace/events/wbt.h
include/trace/events/writeback.h
include/uapi/linux/dlm_device.h
include/uapi/linux/fiemap.h
include/uapi/linux/virtio_balloon.h
kernel/audit.c
kernel/fork.c
kernel/irq/manage.c
kernel/rcu/tree.c
kernel/sched/cputime.c
kernel/sched/isolation.c
kernel/signal.c
kernel/time/namespace.c
kernel/trace/ftrace.c
kernel/trace/trace_events_hist.c
kernel/trace/tracing_map.c
mm/gup.c
mm/hugetlb.c
mm/ksm.c
mm/madvise.c
mm/mremap.c
mm/shmem.c
mm/slub.c
mm/vmalloc.c
net/sunrpc/cache.c
net/sunrpc/svc_xprt.c
net/sunrpc/svcsock.c
net/sunrpc/xprtrdma/svc_rdma_backchannel.c
net/sunrpc/xprtrdma/svc_rdma_recvfrom.c
net/sunrpc/xprtrdma/svc_rdma_rw.c
net/sunrpc/xprtrdma/svc_rdma_sendto.c
net/sunrpc/xprtrdma/svc_rdma_transport.c
net/sunrpc/xprtsock.c
samples/vfio-mdev/mdpy.c
scripts/Makefile.lib
scripts/checkpatch.pl
scripts/config
scripts/documentation-file-ref-check
scripts/dtc/Makefile
scripts/kernel-doc
sound/hda/Kconfig
sound/pci/ctxfi/cthw20k1.c
sound/pci/hda/hda_codec.c
sound/pci/hda/hda_intel.c
sound/pci/hda/hda_intel.h
sound/pci/hda/patch_hdmi.c
sound/pci/hda/patch_realtek.c
sound/soc/amd/acp3x-rt5682-max9836.c
sound/soc/codecs/Kconfig
sound/soc/codecs/hdac_hdmi.c
sound/soc/codecs/madera.c
sound/soc/codecs/sgtl5000.c
sound/soc/codecs/sgtl5000.h
sound/soc/codecs/tas571x.c
sound/soc/codecs/wm8960.c
sound/soc/codecs/wsa881x.c
sound/soc/intel/common/soc-acpi-intel-cml-match.c
sound/soc/intel/common/soc-acpi-intel-icl-match.c
sound/soc/meson/axg-card.c
sound/soc/meson/gx-card.c
sound/soc/qcom/apq8096.c
sound/soc/qcom/qdsp6/q6afe-dai.c
sound/soc/qcom/sdm845.c
sound/soc/samsung/s3c-i2s-v2.c
sound/soc/samsung/s3c2412-i2s.c
sound/soc/sh/rcar/ssi.c
sound/soc/sh/rcar/ssiu.c
sound/soc/soc-dai.c
sound/soc/soc-dapm.c
sound/soc/soc-pcm.c
sound/soc/soc-topology.c
sound/soc/sof/intel/bdw.c
sound/soc/sof/intel/byt.c
sound/soc/stm/stm32_sai_sub.c
sound/usb/format.c
sound/usb/mixer.c
sound/usb/mixer.h
sound/usb/mixer_maps.c
sound/usb/mixer_quirks.c
sound/usb/quirks-table.h
sound/usb/quirks.c
sound/usb/usx2y/usbusx2yaudio.c
tools/arch/x86/include/asm/cpufeatures.h
tools/arch/x86/include/asm/msr-index.h
tools/build/feature/test-sync-compare-and-swap.c
tools/include/linux/bits.h
tools/include/linux/build_bug.h [new file with mode: 0644]
tools/include/linux/compiler.h
tools/include/linux/const.h
tools/include/linux/kernel.h
tools/include/uapi/drm/drm.h
tools/include/uapi/drm/i915_drm.h
tools/include/uapi/linux/fscrypt.h
tools/include/uapi/linux/kvm.h
tools/include/uapi/linux/mman.h
tools/include/uapi/linux/sched.h
tools/include/uapi/linux/vhost.h
tools/include/vdso/bits.h [new file with mode: 0644]
tools/include/vdso/const.h [new file with mode: 0644]
tools/objtool/check.c
tools/objtool/orc_dump.c
tools/objtool/orc_gen.c
tools/perf/arch/x86/entry/syscalls/syscall_64.tbl
tools/perf/check-headers.sh
tools/perf/trace/beauty/clone.c
tools/perf/trace/beauty/mmap.c
tools/perf/util/setup.py
tools/perf/util/stat-shadow.c
tools/power/pm-graph/Makefile
tools/power/pm-graph/README
tools/power/pm-graph/bootgraph.py
tools/power/pm-graph/sleepgraph.8
tools/power/pm-graph/sleepgraph.py
tools/testing/selftests/ftrace/config
tools/testing/selftests/ipc/msgque.c
tools/testing/selftests/kselftest/runner.sh
tools/testing/selftests/kselftest_harness.h
tools/testing/selftests/memfd/Makefile
tools/testing/selftests/seccomp/seccomp_bpf.c
tools/testing/selftests/tpm2/test_smoke.sh
tools/testing/selftests/tpm2/test_space.sh
tools/testing/selftests/vm/Makefile
tools/testing/selftests/vm/run_vmtests
tools/virtio/Makefile
tools/virtio/asm/barrier.h
tools/virtio/generated/autoconf.h [new file with mode: 0644]
tools/virtio/linux/compiler.h
tools/vm/Makefile

index 6ec5558..e92e6dd 100644 (file)
@@ -142,10 +142,13 @@ ForEachMacros:
   - 'for_each_card_auxs'
   - 'for_each_card_auxs_safe'
   - 'for_each_card_components'
+  - 'for_each_card_dapms'
   - 'for_each_card_pre_auxs'
   - 'for_each_card_prelinks'
   - 'for_each_card_rtds'
   - 'for_each_card_rtds_safe'
+  - 'for_each_card_widgets'
+  - 'for_each_card_widgets_safe'
   - 'for_each_cgroup_storage_type'
   - 'for_each_child_of_node'
   - 'for_each_clear_bit'
@@ -160,6 +163,7 @@ ForEachMacros:
   - 'for_each_cpu_and'
   - 'for_each_cpu_not'
   - 'for_each_cpu_wrap'
+  - 'for_each_dapm_widgets'
   - 'for_each_dev_addr'
   - 'for_each_dev_scope'
   - 'for_each_displayid_db'
@@ -170,7 +174,6 @@ ForEachMacros:
   - 'for_each_dpcm_fe'
   - 'for_each_drhd_unit'
   - 'for_each_dss_dev'
-  - 'for_each_efi_handle'
   - 'for_each_efi_memory_desc'
   - 'for_each_efi_memory_desc_in_map'
   - 'for_each_element'
@@ -191,6 +194,7 @@ ForEachMacros:
   - 'for_each_ip_tunnel_rcu'
   - 'for_each_irq_nr'
   - 'for_each_link_codecs'
+  - 'for_each_link_cpus'
   - 'for_each_link_platforms'
   - 'for_each_lru'
   - 'for_each_matching_node'
@@ -250,6 +254,7 @@ ForEachMacros:
   - 'for_each_pci_bridge'
   - 'for_each_pci_dev'
   - 'for_each_pci_msi_entry'
+  - 'for_each_pcm_streams'
   - 'for_each_populated_zone'
   - 'for_each_possible_cpu'
   - 'for_each_present_cpu'
@@ -260,9 +265,12 @@ ForEachMacros:
   - 'for_each_property_of_node'
   - 'for_each_registered_fb'
   - 'for_each_reserved_mem_region'
-  - 'for_each_rtd_codec_dai'
-  - 'for_each_rtd_codec_dai_rollback'
+  - 'for_each_rtd_codec_dais'
+  - 'for_each_rtd_codec_dais_rollback'
   - 'for_each_rtd_components'
+  - 'for_each_rtd_cpu_dais'
+  - 'for_each_rtd_cpu_dais_rollback'
+  - 'for_each_rtd_dais'
   - 'for_each_set_bit'
   - 'for_each_set_bit_from'
   - 'for_each_set_clump8'
@@ -334,6 +342,7 @@ ForEachMacros:
   - 'klp_for_each_object'
   - 'klp_for_each_object_safe'
   - 'klp_for_each_object_static'
+  - 'kunit_suite_for_each_test_case'
   - 'kvm_for_each_memslot'
   - 'kvm_for_each_vcpu'
   - 'list_for_each'
@@ -387,6 +396,7 @@ ForEachMacros:
   - 'of_property_for_each_string'
   - 'of_property_for_each_u32'
   - 'pci_bus_for_each_resource'
+  - 'pcm_for_each_format'
   - 'ping_portaddr_for_each_entry'
   - 'plist_for_each'
   - 'plist_for_each_continue'
@@ -482,7 +492,7 @@ KeepEmptyLinesAtTheStartOfBlocks: false
 MacroBlockBegin: ''
 MacroBlockEnd: ''
 MaxEmptyLinesToKeep: 1
-NamespaceIndentation: Inner
+NamespaceIndentation: None
 #ObjCBinPackProtocolList: Auto # Unknown to clang-format-5.0
 ObjCBlockIndentWidth: 8
 ObjCSpaceAfterProperty: true
index 39c95c0..0d427fd 100644 (file)
@@ -390,9 +390,17 @@ When ``kptr_restrict`` is set to 2, kernel pointers printed using
 modprobe
 ========
 
-This gives the full path of the modprobe command which the kernel will
-use to load modules. This can be used to debug module loading
-requests::
+The full path to the usermode helper for autoloading kernel modules,
+by default "/sbin/modprobe".  This binary is executed when the kernel
+requests a module.  For example, if userspace passes an unknown
+filesystem type to mount(), then the kernel will automatically request
+the corresponding filesystem module by executing this usermode helper.
+This usermode helper should insert the needed module into the kernel.
+
+This sysctl only affects module autoloading.  It has no effect on the
+ability to explicitly insert modules.
+
+This sysctl can be used to debug module loading requests::
 
     echo '#! /bin/sh' > /tmp/modprobe
     echo 'echo "$@" >> /tmp/modprobe.log' >> /tmp/modprobe
@@ -400,10 +408,15 @@ requests::
     chmod a+x /tmp/modprobe
     echo /tmp/modprobe > /proc/sys/kernel/modprobe
 
-This only applies when the *kernel* is requesting that the module be
-loaded; it won't have any effect if the module is being loaded
-explicitly using ``modprobe`` from userspace.
+Alternatively, if this sysctl is set to the empty string, then module
+autoloading is completely disabled.  The kernel will not try to
+execute a usermode helper at all, nor will it call the
+kernel_module_request LSM hook.
 
+If CONFIG_STATIC_USERMODEHELPER=y is set in the kernel configuration,
+then the configured static usermode helper overrides this sysctl,
+except that the empty string is still accepted to completely disable
+module autoloading as described above.
 
 modules_disabled
 ================
@@ -446,28 +459,6 @@ Notes:
      successful IPC object allocation. If an IPC object allocation syscall
      fails, it is undefined if the value remains unmodified or is reset to -1.
 
-modprobe:
-=========
-
-The path to the usermode helper for autoloading kernel modules, by
-default "/sbin/modprobe".  This binary is executed when the kernel
-requests a module.  For example, if userspace passes an unknown
-filesystem type to mount(), then the kernel will automatically request
-the corresponding filesystem module by executing this usermode helper.
-This usermode helper should insert the needed module into the kernel.
-
-This sysctl only affects module autoloading.  It has no effect on the
-ability to explicitly insert modules.
-
-If this sysctl is set to the empty string, then module autoloading is
-completely disabled.  The kernel will not try to execute a usermode
-helper at all, nor will it call the kernel_module_request LSM hook.
-
-If CONFIG_STATIC_USERMODEHELPER=y is set in the kernel configuration,
-then the configured static usermode helper overrides this sysctl,
-except that the empty string is still accepted to completely disable
-module autoloading as described above.
-
 nmi_watchdog
 ============
 
index 5057b11..036783e 100644 (file)
@@ -23,13 +23,14 @@ optional external memory-mapped interface.
 
 Version 1 of the Activity Monitors architecture implements a counter group
 of four fixed and architecturally defined 64-bit event counters.
-  - CPU cycle counter: increments at the frequency of the CPU.
-  - Constant counter: increments at the fixed frequency of the system
-    clock.
-  - Instructions retired: increments with every architecturally executed
-    instruction.
-  - Memory stall cycles: counts instruction dispatch stall cycles caused by
-    misses in the last level cache within the clock domain.
+
+- CPU cycle counter: increments at the frequency of the CPU.
+- Constant counter: increments at the fixed frequency of the system
+  clock.
+- Instructions retired: increments with every architecturally executed
+  instruction.
+- Memory stall cycles: counts instruction dispatch stall cycles caused by
+  misses in the last level cache within the clock domain.
 
 When in WFI or WFE these counters do not increment.
 
@@ -57,11 +58,12 @@ counters, only the presence of the extension.
 
 Firmware (code running at higher exception levels, e.g. arm-tf) support is
 needed to:
- - Enable access for lower exception levels (EL2 and EL1) to the AMU
-   registers.
- - Enable the counters. If not enabled these will read as 0.
- - Save/restore the counters before/after the CPU is being put/brought up
-   from the 'off' power state.
+
+- Enable access for lower exception levels (EL2 and EL1) to the AMU
+  registers.
+- Enable the counters. If not enabled these will read as 0.
+- Save/restore the counters before/after the CPU is being put/brought up
+  from the 'off' power state.
 
 When using kernels that have this feature enabled but boot with broken
 firmware the user may experience panics or lockups when accessing the
@@ -78,10 +80,11 @@ are not trapped in EL2/EL3.
 
 The fixed counters of AMUv1 are accessible though the following system
 register definitions:
- - SYS_AMEVCNTR0_CORE_EL0
- - SYS_AMEVCNTR0_CONST_EL0
- - SYS_AMEVCNTR0_INST_RET_EL0
- - SYS_AMEVCNTR0_MEM_STALL_EL0
+
+- SYS_AMEVCNTR0_CORE_EL0
+- SYS_AMEVCNTR0_CONST_EL0
+- SYS_AMEVCNTR0_INST_RET_EL0
+- SYS_AMEVCNTR0_MEM_STALL_EL0
 
 Auxiliary platform specific counters can be accessed using
 SYS_AMEVCNTR1_EL0(n), where n is a value between 0 and 15.
@@ -93,9 +96,10 @@ Userspace access
 ----------------
 
 Currently, access from userspace to the AMU registers is disabled due to:
- - Security reasons: they might expose information about code executed in
-   secure mode.
- - Purpose: AMU counters are intended for system management use.
+
+- Security reasons: they might expose information about code executed in
+  secure mode.
+- Purpose: AMU counters are intended for system management use.
 
 Also, the presence of the feature is not visible to userspace.
 
@@ -105,8 +109,9 @@ Virtualization
 
 Currently, access from userspace (EL0) and kernelspace (EL1) on the KVM
 guest side is disabled due to:
- - Security reasons: they might expose information about code executed
-   by other guests or the host.
+
+- Security reasons: they might expose information about code executed
+  by other guests or the host.
 
 Any attempt to access the AMU registers will result in an UNDEFINED
 exception being injected into the guest.
index c0ffa30..729e248 100644 (file)
@@ -154,9 +154,9 @@ architectures. These are the recommended replacements:
 
        Use ktime_get() or ktime_get_ts64() instead.
 
-.. c:function:: struct timeval do_gettimeofday( void )
-               struct timespec getnstimeofday( void )
-               struct timespec64 getnstimeofday64( void )
+.. c:function:: void do_gettimeofday( struct timeval * )
+               void getnstimeofday( struct timespec * )
+               void getnstimeofday64( struct timespec64 * )
                void ktime_get_real_ts( struct timespec * )
 
        ktime_get_real_ts64() is a direct replacement, but consider using
index aa0738b..e713a6f 100644 (file)
@@ -42,6 +42,10 @@ properties:
     description:
       See section 2.3.9 of the DeviceTree Specification.
 
+  '#address-cells': true
+
+  '#size-cells': true
+
 required:
   - "#interconnect-cells"
   - compatible
@@ -59,6 +63,8 @@ examples:
         compatible = "allwinner,sun5i-a13-mbus";
         reg = <0x01c01000 0x1000>;
         clocks = <&ccu CLK_MBUS>;
+        #address-cells = <1>;
+        #size-cells = <1>;
         dma-ranges = <0x00000000 0x40000000 0x20000000>;
         #interconnect-cells = <1>;
     };
index de9a465..444aeea 100644 (file)
@@ -91,7 +91,7 @@ required:
 
 examples:
   - |
-    vco1: clock@00 {
+    vco1: clock {
       compatible = "arm,impd1-vco1";
       #clock-cells = <0>;
       lock-offset = <0x08>;
index a6b2b2b..d3c2a49 100644 (file)
@@ -1,5 +1,5 @@
-Analog Device ADV7123 Video DAC
--------------------------------
+Analog Devices ADV7123 Video DAC
+--------------------------------
 
 The ADV7123 is a digital-to-analog converter that outputs VGA signals from a
 parallel video input.
index e8ddec5..659523f 100644 (file)
@@ -1,5 +1,5 @@
-Analog Device ADV7511(W)/13/33/35 HDMI Encoders
------------------------------------------
+Analog Devices ADV7511(W)/13/33/35 HDMI Encoders
+------------------------------------------------
 
 The ADV7511, ADV7511W, ADV7513, ADV7533 and ADV7535 are HDMI audio and video
 transmitters compatible with HDMI 1.4 and DVI 1.0. They support color space
index fd931b2..b900973 100644 (file)
@@ -37,7 +37,6 @@ examples:
     dsi {
         #address-cells = <1>;
         #size-cells = <0>;
-        reg = <0xff450000 0x1000>;
 
         panel@0 {
             compatible = "leadtek,ltk500hd1829";
index d008330..946dd35 100644 (file)
@@ -96,12 +96,20 @@ properties:
       If set, reverse the bit order described in the data mappings below on all
       data lanes, transmitting bits for slots 6 to 0 instead of 0 to 6.
 
+  port: true
+  ports: true
+
 required:
   - compatible
   - data-mapping
   - width-mm
   - height-mm
   - panel-timing
-  - port
+
+oneOf:
+  - required:
+      - port
+  - required:
+      - ports
 
 ...
index d9fdb58..6913923 100644 (file)
@@ -37,7 +37,6 @@ examples:
     dsi {
         #address-cells = <1>;
         #size-cells = <0>;
-        reg = <0xff450000 0x1000>;
 
         panel@0 {
             compatible = "xinpeng,xpp055c272";
index b38ee73..cd17684 100644 (file)
@@ -1,4 +1,4 @@
-Analog Device AXI-DMAC DMA controller
+Analog Devices AXI-DMAC DMA controller
 
 Required properties:
  - compatible: Must be "adi,axi-dmac-1.00.a".
index 57a240d..7db7876 100644 (file)
@@ -2,7 +2,7 @@
 # Copyright 2019 Analog Devices Inc.
 %YAML 1.2
 ---
-$id: http://devicetree.org/schemas/bindings/hwmon/adi,axi-fan-control.yaml#
+$id: http://devicetree.org/schemas/hwmon/adi,axi-fan-control.yaml#
 $schema: http://devicetree.org/meta-schemas/core.yaml#
 
 title: Analog Devices AXI FAN Control Device Tree Bindings
@@ -47,7 +47,7 @@ required:
 
 examples:
   - |
-    fpga_axi: fpga-axi@0 {
+    fpga_axi: fpga-axi {
             #address-cells = <0x2>;
             #size-cells = <0x1>;
 
index 7698503..46c4415 100644 (file)
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
 %YAML 1.2
 ---
-$id: http://devicetree.org/schemas/adt7475.yaml#
+$id: http://devicetree.org/schemas/hwmon/adt7475.yaml#
 $schema: http://devicetree.org/meta-schemas/core.yaml#
 
 title: ADT7475 hwmon sensor
index f0bbd7e..502e1e5 100644 (file)
@@ -1,4 +1,4 @@
-* Analog Device AD5755 IIO Multi-Channel DAC Linux Driver
+* Analog Devices AD5755 IIO Multi-Channel DAC Linux Driver
 
 Required properties:
  - compatible: Has to contain one of the following:
index d9c25cf..58d81ca 100644 (file)
@@ -2,7 +2,7 @@
 # Copyright 2020 Analog Devices Inc.
 %YAML 1.2
 ---
-$id: http://devicetree.org/schemas/bindings/iio/dac/adi,ad5770r.yaml#
+$id: http://devicetree.org/schemas/iio/dac/adi,ad5770r.yaml#
 $schema: http://devicetree.org/meta-schemas/core.yaml#
 
 title: Analog Devices AD5770R DAC device driver
@@ -49,93 +49,86 @@ properties:
       asserted during driver probe.
     maxItems: 1
 
-  channel0:
+  channel@0:
     description: Represents an external channel which are
       connected to the DAC. Channel 0 can act both as a current
       source and sink.
     type: object
 
     properties:
-      num:
+      reg:
         description: This represents the channel number.
-        items:
-          const: 0
+        const: 0
 
       adi,range-microamp:
           description: Output range of the channel.
           oneOf:
-            - $ref: /schemas/types.yaml#/definitions/int32-array
             - items:
-                - enum: [0 300000]
-                - enum: [-60000 0]
-                - enum: [-60000 300000]
+                - const: 0
+                - const: 300000
+            - items:
+                - const: -60000
+                - const: 0
+            - items:
+                - const: -60000
+                - const: 300000
 
-  channel1:
+  channel@1:
     description: Represents an external channel which are
       connected to the DAC.
     type: object
 
     properties:
-      num:
+      reg:
         description: This represents the channel number.
-        items:
-          const: 1
+        const: 1
 
       adi,range-microamp:
           description: Output range of the channel.
-          oneOf:
-            - $ref: /schemas/types.yaml#/definitions/uint32-array
-            - items:
-                - enum: [0 140000]
-                - enum: [0 250000]
+          items:
+            - const: 0
+            - enum: [ 140000, 250000 ]
 
-  channel2:
+  channel@2:
     description: Represents an external channel which are
       connected to the DAC.
     type: object
 
     properties:
-      num:
+      reg:
         description: This represents the channel number.
-        items:
-          const: 2
+        const: 2
 
       adi,range-microamp:
           description: Output range of the channel.
-          oneOf:
-            - $ref: /schemas/types.yaml#/definitions/uint32-array
-            - items:
-                - enum: [0 140000]
-                - enum: [0 250000]
+          items:
+            - const: 0
+            - enum: [ 55000, 150000 ]
 
 patternProperties:
   "^channel@([3-5])$":
     type: object
     description: Represents the external channels which are connected to the DAC.
     properties:
-      num:
+      reg:
         description: This represents the channel number.
-        items:
-          minimum: 3
-          maximum: 5
+        minimum: 3
+        maximum: 5
 
       adi,range-microamp:
           description: Output range of the channel.
-          oneOf:
-            - $ref: /schemas/types.yaml#/definitions/uint32-array
-            - items:
-                - enum: [0 45000]
-                - enum: [0 100000]
+          items:
+            - const: 0
+            - enum: [ 45000, 100000 ]
 
 required:
 - reg
-- diff-channels
-- channel0
-- channel1
-- channel2
-- channel3
-- channel4
-- channel5
+- channel@0
+- channel@1
+- channel@2
+- channel@3
+- channel@4
+- channel@5
 
 examples:
   - |
@@ -144,40 +137,42 @@ examples:
                 #size-cells = <0>;
 
                 ad5770r@0 {
-                        compatible = "ad5770r";
+                        compatible = "adi,ad5770r";
                         reg = <0>;
                         spi-max-frequency = <1000000>;
                         vref-supply = <&vref>;
                         adi,external-resistor;
                         reset-gpios = <&gpio 22 0>;
+                        #address-cells = <1>;
+                        #size-cells = <0>;
 
                         channel@0 {
-                                num = <0>;
-                                adi,range-microamp = <(-60000) 300000>;
+                                reg = <0>;
+                                adi,range-microamp = <0 300000>;
                         };
 
                         channel@1 {
-                                num = <1>;
+                                reg = <1>;
                                 adi,range-microamp = <0 140000>;
                         };
 
                         channel@2 {
-                                num = <2>;
+                                reg = <2>;
                                 adi,range-microamp = <0 55000>;
                         };
 
                         channel@3 {
-                                num = <3>;
+                                reg = <3>;
                                 adi,range-microamp = <0 45000>;
                         };
 
                         channel@4 {
-                                num = <4>;
+                                reg = <4>;
                                 adi,range-microamp = <0 45000>;
                         };
 
                         channel@5 {
-                                num = <5>;
+                                reg = <5>;
                                 adi,range-microamp = <0 45000>;
                         };
                 };
index 8d58709..383d64a 100644 (file)
@@ -109,7 +109,7 @@ examples:
   - |
     #include <dt-bindings/gpio/gpio.h>
     #include <dt-bindings/interrupt-controller/arm-gic.h>
-    i2c@00000000 {
+    i2c {
       #address-cells = <1>;
       #size-cells = <0>;
       edt-ft5x06@38 {
index 9c6b91f..26f1fcf 100644 (file)
@@ -56,9 +56,8 @@ properties:
       cell with zero.
     allOf:
       - $ref: /schemas/types.yaml#/definitions/uint32-array
-      - items:
-          minItems: 4
-          maxItems: 4
+      - minItems: 4
+        maxItems: 4
 
 
 required:
index 12516bd..611bda3 100644 (file)
@@ -97,30 +97,35 @@ examples:
     #include <dt-bindings/clock/tegra186-clock.h>
     #include <dt-bindings/interrupt-controller/arm-gic.h>
 
-    memory-controller@2c00000 {
-        compatible = "nvidia,tegra186-mc";
-        reg = <0x0 0x02c00000 0x0 0xb0000>;
-        interrupts = <GIC_SPI 223 IRQ_TYPE_LEVEL_HIGH>;
-
+    bus {
         #address-cells = <2>;
         #size-cells = <2>;
 
-        ranges = <0x0 0x02c00000 0x02c00000 0x0 0xb0000>;
+        memory-controller@2c00000 {
+            compatible = "nvidia,tegra186-mc";
+            reg = <0x0 0x02c00000 0x0 0xb0000>;
+            interrupts = <GIC_SPI 223 IRQ_TYPE_LEVEL_HIGH>;
+
+            #address-cells = <2>;
+            #size-cells = <2>;
+
+            ranges = <0x0 0x02c00000 0x0 0x02c00000 0x0 0xb0000>;
 
-        /*
-         * Memory clients have access to all 40 bits that the memory
-         * controller can address.
-         */
-        dma-ranges = <0x0 0x0 0x0 0x0 0x100 0x0>;
+            /*
+             * Memory clients have access to all 40 bits that the memory
+             * controller can address.
+             */
+            dma-ranges = <0x0 0x0 0x0 0x0 0x100 0x0>;
 
-        external-memory-controller@2c60000 {
-            compatible = "nvidia,tegra186-emc";
-            reg = <0x0 0x02c60000 0x0 0x50000>;
-            interrupts = <GIC_SPI 224 IRQ_TYPE_LEVEL_HIGH>;
-            clocks = <&bpmp TEGRA186_CLK_EMC>;
-            clock-names = "emc";
+            external-memory-controller@2c60000 {
+                compatible = "nvidia,tegra186-emc";
+                reg = <0x0 0x02c60000 0x0 0x50000>;
+                interrupts = <GIC_SPI 224 IRQ_TYPE_LEVEL_HIGH>;
+                clocks = <&bpmp TEGRA186_CLK_EMC>;
+                clock-names = "emc";
 
-            nvidia,bpmp = <&bpmp>;
+                nvidia,bpmp = <&bpmp>;
+            };
         };
     };
 
index aa922c5..65018a0 100644 (file)
@@ -123,7 +123,9 @@ examples:
     #include <dt-bindings/leds/common.h>
 
     i2c {
-      pmic: pmic@4b {
+        #address-cells = <1>;
+        #size-cells = <0>;
+        pmic: pmic@4b {
             compatible = "rohm,bd71837";
             reg = <0x4b>;
             interrupt-parent = <&gpio1>;
index 402e40d..77bcca2 100644 (file)
@@ -128,7 +128,9 @@ examples:
     #include <dt-bindings/leds/common.h>
 
     i2c {
-      pmic: pmic@4b {
+        #address-cells = <1>;
+        #size-cells = <0>;
+        pmic: pmic@4b {
             compatible = "rohm,bd71847";
             reg = <0x4b>;
             interrupt-parent = <&gpio1>;
index d9ad926..f88d13d 100644 (file)
@@ -274,7 +274,7 @@ examples:
   - |
     #include <dt-bindings/mfd/st,stpmic1.h>
     #include <dt-bindings/interrupt-controller/arm-gic.h>
-    i2c@0 {
+    i2c {
       #address-cells = <1>;
       #size-cells = <0>;
       pmic@33 {
index b9f9008..67df3fe 100644 (file)
@@ -48,6 +48,7 @@ examples:
 
         switch@10 {
             compatible = "qca,qca8337";
+            reg = <0x10>;
             /* ... */
         };
     };
index beca646..d220279 100644 (file)
@@ -29,7 +29,7 @@ Required properties for compatible string qcom,wcn399x-bt:
 
 Optional properties for compatible string qcom,wcn399x-bt:
 
- - max-speed: see Documentation/devicetree/bindings/serial/slave-device.txt
+ - max-speed: see Documentation/devicetree/bindings/serial/serial.yaml
  - firmware-name: specify the name of nvm firmware to load
  - clocks: clock provided to the controller
 
index fd1982c..3f913d6 100644 (file)
@@ -146,7 +146,7 @@ patternProperties:
       bindings specified in
       Documentation/devicetree/bindings/phy/phy-cadence-sierra.txt
       Torrent SERDES should follow the bindings specified in
-      Documentation/devicetree/bindings/phy/phy-cadence-dp.txt
+      Documentation/devicetree/bindings/phy/phy-cadence-torrent.yaml
 
 required:
   - compatible
index 24c217b..41ece1d 100644 (file)
@@ -31,10 +31,17 @@ additionalProperties: false
 
 examples:
   - |
-    cros-ec@0 {
-        compatible = "google,cros-ec-spi";
-        cros_ec_pwm: ec-pwm {
-            compatible = "google,cros-ec-pwm";
-            #pwm-cells = <1>;
+    spi {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        cros-ec@0 {
+            compatible = "google,cros-ec-spi";
+            reg = <0>;
+
+            cros_ec_pwm: ec-pwm {
+                compatible = "google,cros-ec-pwm";
+                #pwm-cells = <1>;
+            };
         };
     };
index 89ab67f..c147900 100644 (file)
@@ -39,7 +39,7 @@ additionalProperties: false
 
 examples:
   - |
-    rng {
+    rng@7e104000 {
         compatible = "brcm,bcm2835-rng";
         reg = <0x7e104000 0x10>;
         interrupts = <2 29>;
index 7cd0e27..a3ba218 100644 (file)
@@ -56,6 +56,9 @@ properties:
       - const: tx
       - const: rx
 
+  power-domains:
+    maxItems: 1
+
   rockchip,capture-channels:
     allOf:
       - $ref: /schemas/types.yaml#/definitions/uint32
diff --git a/Documentation/devicetree/bindings/sound/rockchip-spdif.txt b/Documentation/devicetree/bindings/sound/rockchip-spdif.txt
deleted file mode 100644 (file)
index ec20c12..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-* Rockchip SPDIF transceiver
-
-The S/PDIF audio block is a stereo transceiver that allows the
-processor to receive and transmit digital audio via an coaxial cable or
-a fibre cable.
-
-Required properties:
-
-- compatible: should be one of the following:
-   - "rockchip,rk3066-spdif"
-   - "rockchip,rk3188-spdif"
-   - "rockchip,rk3228-spdif"
-   - "rockchip,rk3288-spdif"
-   - "rockchip,rk3328-spdif"
-   - "rockchip,rk3366-spdif"
-   - "rockchip,rk3368-spdif"
-   - "rockchip,rk3399-spdif"
-- reg: physical base address of the controller and length of memory mapped
-  region.
-- interrupts: should contain the SPDIF interrupt.
-- dmas: DMA specifiers for tx dma. See the DMA client binding,
-  Documentation/devicetree/bindings/dma/dma.txt
-- dma-names: should be "tx"
-- clocks: a list of phandle + clock-specifier pairs, one for each entry
-  in clock-names.
-- clock-names: should contain following:
-   - "hclk": clock for SPDIF controller
-   - "mclk" : clock for SPDIF bus
-
-Required properties on RK3288:
-  - rockchip,grf: the phandle of the syscon node for the general register
-                   file (GRF)
-
-Example for the rk3188 SPDIF controller:
-
-spdif: spdif@1011e000 {
-       compatible = "rockchip,rk3188-spdif", "rockchip,rk3066-spdif";
-       reg = <0x1011e000 0x2000>;
-       interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>;
-       dmas = <&dmac1_s 8>;
-       dma-names = "tx";
-       clock-names = "hclk", "mclk";
-       clocks = <&cru HCLK_SPDIF>, <&cru SCLK_SPDIF>;
-       #sound-dai-cells = <0>;
-};
diff --git a/Documentation/devicetree/bindings/sound/rockchip-spdif.yaml b/Documentation/devicetree/bindings/sound/rockchip-spdif.yaml
new file mode 100644 (file)
index 0000000..c467152
--- /dev/null
@@ -0,0 +1,101 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/sound/rockchip-spdif.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Rockchip SPDIF transceiver
+
+description:
+  The S/PDIF audio block is a stereo transceiver that allows the
+  processor to receive and transmit digital audio via a coaxial or
+  fibre cable.
+
+maintainers:
+  - Heiko Stuebner <heiko@sntech.de>
+
+properties:
+  compatible:
+    oneOf:
+      - const: rockchip,rk3066-spdif
+      - const: rockchip,rk3228-spdif
+      - const: rockchip,rk3328-spdif
+      - const: rockchip,rk3366-spdif
+      - const: rockchip,rk3368-spdif
+      - const: rockchip,rk3399-spdif
+      - items:
+          - enum:
+            - rockchip,rk3188-spdif
+            - rockchip,rk3288-spdif
+          - const: rockchip,rk3066-spdif
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
+    items:
+      - description: clock for SPDIF bus
+      - description: clock for SPDIF controller
+
+  clock-names:
+    items:
+      - const: mclk
+      - const: hclk
+
+  dmas:
+    maxItems: 1
+
+  dma-names:
+    const: tx
+
+  power-domains:
+    maxItems: 1
+
+  rockchip,grf:
+    $ref: /schemas/types.yaml#/definitions/phandle
+    description:
+      The phandle of the syscon node for the GRF register.
+      Required property on RK3288.
+
+  "#sound-dai-cells":
+    const: 0
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - clocks
+  - clock-names
+  - dmas
+  - dma-names
+  - "#sound-dai-cells"
+
+if:
+  properties:
+    compatible:
+      contains:
+        const: rockchip,rk3288-spdif
+
+then:
+  required:
+    - rockchip,grf
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/rk3188-cru.h>
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    spdif: spdif@1011e000 {
+      compatible = "rockchip,rk3188-spdif", "rockchip,rk3066-spdif";
+      reg = <0x1011e000 0x2000>;
+      interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>;
+      clocks = <&cru SCLK_SPDIF>, <&cru HCLK_SPDIF>;
+      clock-names = "mclk", "hclk";
+      dmas = <&dmac1_s 8>;
+      dma-names = "tx";
+      #sound-dai-cells = <0>;
+    };
index 0cf470e..5c16cf5 100644 (file)
@@ -61,7 +61,7 @@ examples:
     #include <dt-bindings/clock/qcom,gcc-sdm845.h>
     #include <dt-bindings/interrupt-controller/arm-gic.h>
 
-    soc: soc@0 {
+    soc: soc {
         #address-cells = <2>;
         #size-cells = <2>;
 
index 1d68778..c2d2ee4 100644 (file)
@@ -56,7 +56,7 @@ additionalProperties: false
 examples:
   - |
     #include <dt-bindings/clock/jz4740-cgu.h>
-    usb_phy: usb-phy@0 {
+    usb_phy: usb-phy {
       compatible = "usb-nop-xceiv";
       #phy-cells = <0>;
     };
index cb695aa..fbdd017 100644 (file)
@@ -52,8 +52,8 @@ A child node must exist to represent the core DWC3 IP block. The name of
 the node is not important. The content of the node is defined in dwc3.txt.
 
 Phy documentation is provided in the following places:
-Documentation/devicetree/bindings/phy/qcom-qmp-phy.txt   - USB3 QMP PHY
-Documentation/devicetree/bindings/phy/qcom-qusb2-phy.txt - USB2 QUSB2 PHY
+Documentation/devicetree/bindings/phy/qcom-qmp-phy.txt    - USB3 QMP PHY
+Documentation/devicetree/bindings/phy/qcom,qusb2-phy.yaml - USB2 QUSB2 PHY
 
 Example device nodes:
 
index c8c4b00..9452049 100644 (file)
@@ -16,7 +16,7 @@ A child node must exist to represent the core DWC3 IP block. The name of
 the node is not important. The content of the node is defined in dwc3.txt.
 
 Phy documentation is provided in the following places:
-Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.txt - USB2.0 PHY
+Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.yaml - USB2.0 PHY
 Documentation/devicetree/bindings/phy/phy-rockchip-typec.txt     - Type-C PHY
 
 Example device nodes:
index cc4b614..0e71b22 100644 (file)
@@ -16,7 +16,7 @@ Supported chips:
 
   * Renesas ISL68220
 
-    Prefix: 'raa_dmpvr2_2rail'
+    Prefix: 'isl68220'
 
     Addresses scanned: -
 
@@ -26,7 +26,7 @@ Supported chips:
 
   * Renesas ISL68221
 
-    Prefix: 'raa_dmpvr2_3rail'
+    Prefix: 'isl68221'
 
     Addresses scanned: -
 
@@ -36,7 +36,7 @@ Supported chips:
 
   * Renesas ISL68222
 
-    Prefix: 'raa_dmpvr2_2rail'
+    Prefix: 'isl68222'
 
     Addresses scanned: -
 
@@ -46,7 +46,7 @@ Supported chips:
 
   * Renesas ISL68223
 
-    Prefix: 'raa_dmpvr2_2rail'
+    Prefix: 'isl68223'
 
     Addresses scanned: -
 
@@ -56,7 +56,7 @@ Supported chips:
 
   * Renesas ISL68224
 
-    Prefix: 'raa_dmpvr2_3rail'
+    Prefix: 'isl68224'
 
     Addresses scanned: -
 
@@ -66,7 +66,7 @@ Supported chips:
 
   * Renesas ISL68225
 
-    Prefix: 'raa_dmpvr2_2rail'
+    Prefix: 'isl68225'
 
     Addresses scanned: -
 
@@ -76,7 +76,7 @@ Supported chips:
 
   * Renesas ISL68226
 
-    Prefix: 'raa_dmpvr2_3rail'
+    Prefix: 'isl68226'
 
     Addresses scanned: -
 
@@ -86,7 +86,7 @@ Supported chips:
 
   * Renesas ISL68227
 
-    Prefix: 'raa_dmpvr2_1rail'
+    Prefix: 'isl68227'
 
     Addresses scanned: -
 
@@ -96,7 +96,7 @@ Supported chips:
 
   * Renesas ISL68229
 
-    Prefix: 'raa_dmpvr2_3rail'
+    Prefix: 'isl68229'
 
     Addresses scanned: -
 
@@ -106,7 +106,7 @@ Supported chips:
 
   * Renesas ISL68233
 
-    Prefix: 'raa_dmpvr2_2rail'
+    Prefix: 'isl68233'
 
     Addresses scanned: -
 
@@ -116,7 +116,7 @@ Supported chips:
 
   * Renesas ISL68239
 
-    Prefix: 'raa_dmpvr2_3rail'
+    Prefix: 'isl68239'
 
     Addresses scanned: -
 
@@ -126,7 +126,7 @@ Supported chips:
 
   * Renesas ISL69222
 
-    Prefix: 'raa_dmpvr2_2rail'
+    Prefix: 'isl69222'
 
     Addresses scanned: -
 
@@ -136,7 +136,7 @@ Supported chips:
 
   * Renesas ISL69223
 
-    Prefix: 'raa_dmpvr2_3rail'
+    Prefix: 'isl69223'
 
     Addresses scanned: -
 
@@ -146,7 +146,7 @@ Supported chips:
 
   * Renesas ISL69224
 
-    Prefix: 'raa_dmpvr2_2rail'
+    Prefix: 'isl69224'
 
     Addresses scanned: -
 
@@ -156,7 +156,7 @@ Supported chips:
 
   * Renesas ISL69225
 
-    Prefix: 'raa_dmpvr2_2rail'
+    Prefix: 'isl69225'
 
     Addresses scanned: -
 
@@ -166,7 +166,7 @@ Supported chips:
 
   * Renesas ISL69227
 
-    Prefix: 'raa_dmpvr2_3rail'
+    Prefix: 'isl69227'
 
     Addresses scanned: -
 
@@ -176,7 +176,7 @@ Supported chips:
 
   * Renesas ISL69228
 
-    Prefix: 'raa_dmpvr2_3rail'
+    Prefix: 'isl69228'
 
     Addresses scanned: -
 
@@ -186,7 +186,7 @@ Supported chips:
 
   * Renesas ISL69234
 
-    Prefix: 'raa_dmpvr2_2rail'
+    Prefix: 'isl69234'
 
     Addresses scanned: -
 
@@ -196,7 +196,7 @@ Supported chips:
 
   * Renesas ISL69236
 
-    Prefix: 'raa_dmpvr2_2rail'
+    Prefix: 'isl69236'
 
     Addresses scanned: -
 
@@ -206,7 +206,7 @@ Supported chips:
 
   * Renesas ISL69239
 
-    Prefix: 'raa_dmpvr2_3rail'
+    Prefix: 'isl69239'
 
     Addresses scanned: -
 
@@ -216,7 +216,7 @@ Supported chips:
 
   * Renesas ISL69242
 
-    Prefix: 'raa_dmpvr2_2rail'
+    Prefix: 'isl69242'
 
     Addresses scanned: -
 
@@ -226,7 +226,7 @@ Supported chips:
 
   * Renesas ISL69243
 
-    Prefix: 'raa_dmpvr2_1rail'
+    Prefix: 'isl69243'
 
     Addresses scanned: -
 
@@ -236,7 +236,7 @@ Supported chips:
 
   * Renesas ISL69247
 
-    Prefix: 'raa_dmpvr2_2rail'
+    Prefix: 'isl69247'
 
     Addresses scanned: -
 
@@ -246,7 +246,7 @@ Supported chips:
 
   * Renesas ISL69248
 
-    Prefix: 'raa_dmpvr2_2rail'
+    Prefix: 'isl69248'
 
     Addresses scanned: -
 
@@ -256,7 +256,7 @@ Supported chips:
 
   * Renesas ISL69254
 
-    Prefix: 'raa_dmpvr2_2rail'
+    Prefix: 'isl69254'
 
     Addresses scanned: -
 
@@ -266,7 +266,7 @@ Supported chips:
 
   * Renesas ISL69255
 
-    Prefix: 'raa_dmpvr2_2rail'
+    Prefix: 'isl69255'
 
     Addresses scanned: -
 
@@ -276,7 +276,7 @@ Supported chips:
 
   * Renesas ISL69256
 
-    Prefix: 'raa_dmpvr2_2rail'
+    Prefix: 'isl69256'
 
     Addresses scanned: -
 
@@ -286,7 +286,7 @@ Supported chips:
 
   * Renesas ISL69259
 
-    Prefix: 'raa_dmpvr2_2rail'
+    Prefix: 'isl69259'
 
     Addresses scanned: -
 
@@ -296,7 +296,7 @@ Supported chips:
 
   * Renesas ISL69260
 
-    Prefix: 'raa_dmpvr2_2rail'
+    Prefix: 'isl69260'
 
     Addresses scanned: -
 
@@ -306,7 +306,7 @@ Supported chips:
 
   * Renesas ISL69268
 
-    Prefix: 'raa_dmpvr2_2rail'
+    Prefix: 'isl69268'
 
     Addresses scanned: -
 
@@ -316,7 +316,7 @@ Supported chips:
 
   * Renesas ISL69269
 
-    Prefix: 'raa_dmpvr2_3rail'
+    Prefix: 'isl69269'
 
     Addresses scanned: -
 
@@ -326,7 +326,7 @@ Supported chips:
 
   * Renesas ISL69298
 
-    Prefix: 'raa_dmpvr2_2rail'
+    Prefix: 'isl69298'
 
     Addresses scanned: -
 
@@ -336,7 +336,7 @@ Supported chips:
 
   * Renesas RAA228000
 
-    Prefix: 'raa_dmpvr2_hv'
+    Prefix: 'raa228000'
 
     Addresses scanned: -
 
@@ -346,7 +346,7 @@ Supported chips:
 
   * Renesas RAA228004
 
-    Prefix: 'raa_dmpvr2_hv'
+    Prefix: 'raa228004'
 
     Addresses scanned: -
 
@@ -356,7 +356,7 @@ Supported chips:
 
   * Renesas RAA228006
 
-    Prefix: 'raa_dmpvr2_hv'
+    Prefix: 'raa228006'
 
     Addresses scanned: -
 
@@ -366,7 +366,7 @@ Supported chips:
 
   * Renesas RAA228228
 
-    Prefix: 'raa_dmpvr2_2rail'
+    Prefix: 'raa228228'
 
     Addresses scanned: -
 
@@ -376,7 +376,7 @@ Supported chips:
 
   * Renesas RAA229001
 
-    Prefix: 'raa_dmpvr2_2rail'
+    Prefix: 'raa229001'
 
     Addresses scanned: -
 
@@ -386,7 +386,7 @@ Supported chips:
 
   * Renesas RAA229004
 
-    Prefix: 'raa_dmpvr2_2rail'
+    Prefix: 'raa229004'
 
     Addresses scanned: -
 
index 04d5c01..b80257a 100644 (file)
@@ -1241,7 +1241,8 @@ When kbuild executes, the following steps are followed (roughly):
        will be displayed with "make KBUILD_VERBOSE=0".
 
 
---- 6.9 Preprocessing linker scripts
+6.9 Preprocessing linker scripts
+--------------------------------
 
        When the vmlinux image is built, the linker script
        arch/$(ARCH)/kernel/vmlinux.lds is used.
index a48768b..453fe07 100644 (file)
@@ -1323,7 +1323,10 @@ ARM INTEGRATOR, VERSATILE AND REALVIEW SUPPORT
 M:     Linus Walleij <linus.walleij@linaro.org>
 L:     linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
 S:     Maintained
-F:     Documentation/devicetree/bindings/arm/arm-boards
+F:     Documentation/devicetree/bindings/arm/arm,integrator.yaml
+F:     Documentation/devicetree/bindings/arm/arm,realview.yaml
+F:     Documentation/devicetree/bindings/arm/arm,versatile.yaml
+F:     Documentation/devicetree/bindings/arm/arm,vexpress-juno.yaml
 F:     Documentation/devicetree/bindings/auxdisplay/arm-charlcd.txt
 F:     Documentation/devicetree/bindings/clock/arm,syscon-icst.yaml
 F:     Documentation/devicetree/bindings/i2c/i2c-versatile.txt
@@ -5553,7 +5556,7 @@ M:        Chen-Yu Tsai <wens@csie.org>
 L:     dri-devel@lists.freedesktop.org
 S:     Supported
 T:     git git://anongit.freedesktop.org/drm/drm-misc
-F:     Documentation/devicetree/bindings/display/sunxi/sun4i-drm.txt
+F:     Documentation/devicetree/bindings/display/allwinner*
 F:     drivers/gpu/drm/sun4i/
 
 DRM DRIVERS FOR AMLOGIC SOCS
@@ -9327,6 +9330,7 @@ M:        Christian Borntraeger <borntraeger@de.ibm.com>
 M:     Janosch Frank <frankja@linux.ibm.com>
 R:     David Hildenbrand <david@redhat.com>
 R:     Cornelia Huck <cohuck@redhat.com>
+R:     Claudio Imbrenda <imbrenda@linux.ibm.com>
 L:     kvm@vger.kernel.org
 S:     Supported
 W:     http://www.ibm.com/developerworks/linux/linux390/
@@ -9414,6 +9418,13 @@ F:       include/linux/keyctl.h
 F:     include/uapi/linux/keyctl.h
 F:     security/keys/
 
+KFIFO
+M:     Stefani Seibold <stefani@seibold.net>
+S:     Maintained
+F:     include/linux/kfifo.h
+F:     lib/kfifo.c
+F:     samples/kfifo/
+
 KGDB / KDB /debug_core
 M:     Jason Wessel <jason.wessel@windriver.com>
 M:     Daniel Thompson <daniel.thompson@linaro.org>
@@ -13039,7 +13050,7 @@ F:      drivers/pci/controller/pci-xgene-msi.c
 
 PCI NATIVE HOST BRIDGE AND ENDPOINT DRIVERS
 M:     Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
-R:     Andrew Murray <amurray@thegoodpenguin.co.uk>
+R:     Rob Herring <robh@kernel.org>
 L:     linux-pci@vger.kernel.org
 S:     Supported
 Q:     http://patchwork.ozlabs.org/project/linux-pci/list/
@@ -13854,7 +13865,8 @@ S:      Maintained
 F:     drivers/scsi/qla1280.[ch]
 
 QLOGIC QLA2XXX FC-SCSI DRIVER
-M:     hmadhani@marvell.com
+M:     Nilesh Javali <njavali@marvell.com>
+M:     GR-QLogic-Storage-Upstream@marvell.com
 L:     linux-scsi@vger.kernel.org
 S:     Supported
 F:     Documentation/scsi/LICENSE.qla2xxx
index 70def49..49b2709 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,7 @@
 VERSION = 5
 PATCHLEVEL = 7
 SUBLEVEL = 0
-EXTRAVERSION = -rc1
+EXTRAVERSION = -rc2
 NAME = Kleptomaniac Octopus
 
 # *DOCUMENTATION*
index 48f13a4..f534a1f 100644 (file)
@@ -3,7 +3,6 @@
  * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
  *
  * Amit Bhor, Sameer Dhavale: Codito Technologies 2004
-
  */
 
 #ifndef _ASM_ARC_MODULE_H
@@ -19,8 +18,4 @@ struct mod_arch_specific {
        const char *secstr;
 };
 
-#define MODULE_PROC_FAMILY "ARC700"
-
-#define MODULE_ARCH_VERMAGIC MODULE_PROC_FAMILY
-
 #endif /* _ASM_ARC_MODULE_H */
diff --git a/arch/arc/include/asm/vermagic.h b/arch/arc/include/asm/vermagic.h
new file mode 100644 (file)
index 0000000..a10257d
--- /dev/null
@@ -0,0 +1,8 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#ifndef _ASM_VERMAGIC_H
+#define _ASM_VERMAGIC_H
+
+#define MODULE_ARCH_VERMAGIC "ARC700"
+
+#endif /* _ASM_VERMAGIC_H */
index fd2c766..f7ae5a4 100644 (file)
@@ -14,6 +14,9 @@
        soc {
                firmware: firmware {
                        compatible = "raspberrypi,bcm2835-firmware", "simple-bus";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+
                        mboxes = <&mailbox>;
                        dma-ranges;
                };
index e1abe8c..b83a864 100644 (file)
                                             "dsi0_ddr2",
                                             "dsi0_ddr";
 
+                       status = "disabled";
                };
 
                aux: aux@7e215000 {
index a075b63..11d41e8 100644 (file)
        status = "disabled";
 };
 
+/* RNG not directly accessible on N950/N9. */
+&rng_target {
+       status = "disabled";
+};
+
 &usb_otg_hs {
        interface-type = <0>;
        usb-phy = <&usb2_phy>;
index 182163b..4b0df09 100644 (file)
@@ -37,30 +37,6 @@ struct mod_arch_specific {
 struct module;
 u32 get_module_plt(struct module *mod, unsigned long loc, Elf32_Addr val);
 
-/*
- * Add the ARM architecture version to the version magic string
- */
-#define MODULE_ARCH_VERMAGIC_ARMVSN "ARMv" __stringify(__LINUX_ARM_ARCH__) " "
-
-/* Add __virt_to_phys patching state as well */
-#ifdef CONFIG_ARM_PATCH_PHYS_VIRT
-#define MODULE_ARCH_VERMAGIC_P2V "p2v8 "
-#else
-#define MODULE_ARCH_VERMAGIC_P2V ""
-#endif
-
-/* Add instruction set architecture tag to distinguish ARM/Thumb kernels */
-#ifdef CONFIG_THUMB2_KERNEL
-#define MODULE_ARCH_VERMAGIC_ARMTHUMB "thumb2 "
-#else
-#define MODULE_ARCH_VERMAGIC_ARMTHUMB ""
-#endif
-
-#define MODULE_ARCH_VERMAGIC \
-       MODULE_ARCH_VERMAGIC_ARMVSN \
-       MODULE_ARCH_VERMAGIC_ARMTHUMB \
-       MODULE_ARCH_VERMAGIC_P2V
-
 #ifdef CONFIG_THUMB2_KERNEL
 #define HAVE_ARCH_KALLSYMS_SYMBOL_VALUE
 static inline unsigned long kallsyms_symbol_value(const Elf_Sym *sym)
diff --git a/arch/arm/include/asm/vermagic.h b/arch/arm/include/asm/vermagic.h
new file mode 100644 (file)
index 0000000..62ce94e
--- /dev/null
@@ -0,0 +1,31 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _ASM_VERMAGIC_H
+#define _ASM_VERMAGIC_H
+
+#include <linux/stringify.h>
+
+/*
+ * Add the ARM architecture version to the version magic string
+ */
+#define MODULE_ARCH_VERMAGIC_ARMVSN "ARMv" __stringify(__LINUX_ARM_ARCH__) " "
+
+/* Add __virt_to_phys patching state as well */
+#ifdef CONFIG_ARM_PATCH_PHYS_VIRT
+#define MODULE_ARCH_VERMAGIC_P2V "p2v8 "
+#else
+#define MODULE_ARCH_VERMAGIC_P2V ""
+#endif
+
+/* Add instruction set architecture tag to distinguish ARM/Thumb kernels */
+#ifdef CONFIG_THUMB2_KERNEL
+#define MODULE_ARCH_VERMAGIC_ARMTHUMB "thumb2 "
+#else
+#define MODULE_ARCH_VERMAGIC_ARMTHUMB ""
+#endif
+
+#define MODULE_ARCH_VERMAGIC \
+       MODULE_ARCH_VERMAGIC_ARMVSN \
+       MODULE_ARCH_VERMAGIC_ARMTHUMB \
+       MODULE_ARCH_VERMAGIC_P2V
+
+#endif /* _ASM_VERMAGIC_H */
index 03506ce..e7364e6 100644 (file)
@@ -91,8 +91,10 @@ AFLAGS_suspend-imx6.o :=-Wa,-march=armv7-a
 obj-$(CONFIG_SOC_IMX6) += suspend-imx6.o
 obj-$(CONFIG_SOC_IMX53) += suspend-imx53.o
 endif
+ifeq ($(CONFIG_ARM_CPU_SUSPEND),y)
 AFLAGS_resume-imx6.o :=-Wa,-march=armv7-a
 obj-$(CONFIG_SOC_IMX6) += resume-imx6.o
+endif
 obj-$(CONFIG_SOC_IMX6) += pm-imx6.o
 
 obj-$(CONFIG_SOC_IMX1) += mach-imx1.o
index dd6804a..fd4e1ce 100644 (file)
@@ -36,7 +36,7 @@
 
 #include <linux/mm.h>
 
-struct start_info _xen_start_info;
+static struct start_info _xen_start_info;
 struct start_info *xen_start_info = &_xen_start_info;
 EXPORT_SYMBOL(xen_start_info);
 
index 1e93de6..4e7fa26 100644 (file)
@@ -7,8 +7,6 @@
 
 #include <asm-generic/module.h>
 
-#define MODULE_ARCH_VERMAGIC   "aarch64"
-
 #ifdef CONFIG_ARM64_MODULE_PLTS
 struct mod_plt_sec {
        int                     plt_shndx;
index 70c4715..c6b4f06 100644 (file)
@@ -47,7 +47,7 @@ static inline void ptrauth_keys_init_user(struct ptrauth_keys_user *keys)
                get_random_bytes(&keys->apga, sizeof(keys->apga));
 }
 
-#define __ptrauth_key_install(k, v)                            \
+#define __ptrauth_key_install_nosync(k, v)                     \
 do {                                                           \
        struct ptrauth_key __pki_v = (v);                       \
        write_sysreg_s(__pki_v.lo, SYS_ ## k ## KEYLO_EL1);     \
@@ -62,8 +62,11 @@ static __always_inline void ptrauth_keys_init_kernel(struct ptrauth_keys_kernel
 
 static __always_inline void ptrauth_keys_switch_kernel(struct ptrauth_keys_kernel *keys)
 {
-       if (system_supports_address_auth())
-               __ptrauth_key_install(APIA, keys->apia);
+       if (!system_supports_address_auth())
+               return;
+
+       __ptrauth_key_install_nosync(APIA, keys->apia);
+       isb();
 }
 
 extern int ptrauth_prctl_reset_keys(struct task_struct *tsk, unsigned long arg);
index ebc6224..c4ac0ac 100644 (file)
@@ -49,7 +49,9 @@
 #ifndef CONFIG_BROKEN_GAS_INST
 
 #ifdef __ASSEMBLY__
-#define __emit_inst(x)                 .inst (x)
+// The space separator is omitted so that __emit_inst(x) can be parsed as
+// either an assembler directive or an assembler macro argument.
+#define __emit_inst(x)                 .inst(x)
 #else
 #define __emit_inst(x)                 ".inst " __stringify((x)) "\n\t"
 #endif
diff --git a/arch/arm64/include/asm/vermagic.h b/arch/arm64/include/asm/vermagic.h
new file mode 100644 (file)
index 0000000..a1eec6a
--- /dev/null
@@ -0,0 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (C) 2012 ARM Ltd.
+ */
+#ifndef _ASM_VERMAGIC_H
+#define _ASM_VERMAGIC_H
+
+#define MODULE_ARCH_VERMAGIC   "aarch64"
+
+#endif /* _ASM_VERMAGIC_H */
index 354b11e..033a48f 100644 (file)
@@ -260,18 +260,7 @@ static int __aarch32_alloc_vdso_pages(void)
        if (ret)
                return ret;
 
-       ret = aarch32_alloc_kuser_vdso_page();
-       if (ret) {
-               unsigned long c_vvar =
-                       (unsigned long)page_to_virt(aarch32_vdso_pages[C_VVAR]);
-               unsigned long c_vdso =
-                       (unsigned long)page_to_virt(aarch32_vdso_pages[C_VDSO]);
-
-               free_page(c_vvar);
-               free_page(c_vdso);
-       }
-
-       return ret;
+       return aarch32_alloc_kuser_vdso_page();
 }
 #else
 static int __aarch32_alloc_vdso_pages(void)
diff --git a/arch/h8300/kernel/.gitignore b/arch/h8300/kernel/.gitignore
new file mode 100644 (file)
index 0000000..bbb90f9
--- /dev/null
@@ -0,0 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
+vmlinux.lds
diff --git a/arch/hexagon/include/asm/module.h b/arch/hexagon/include/asm/module.h
deleted file mode 100644 (file)
index e8de4fe..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
- * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
- */
-
-#ifndef _ASM_MODULE_H
-#define _ASM_MODULE_H
-
-#include <asm-generic/module.h>
-
-#define MODULE_ARCH_VERMAGIC __stringify(PROCESSOR_MODEL_NAME) " "
-
-#endif
diff --git a/arch/hexagon/include/asm/vermagic.h b/arch/hexagon/include/asm/vermagic.h
new file mode 100644 (file)
index 0000000..0e8dedc
--- /dev/null
@@ -0,0 +1,13 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
+ */
+
+#ifndef _ASM_VERMAGIC_H
+#define _ASM_VERMAGIC_H
+
+#include <linux/stringify.h>
+
+#define MODULE_ARCH_VERMAGIC __stringify(PROCESSOR_MODEL_NAME) " "
+
+#endif /* _ASM_VERMAGIC_H */
index f319144..5a29652 100644 (file)
@@ -26,10 +26,6 @@ struct mod_arch_specific {
        unsigned int next_got_entry;    /* index of next available got entry */
 };
 
-#define MODULE_PROC_FAMILY     "ia64"
-#define MODULE_ARCH_VERMAGIC   MODULE_PROC_FAMILY \
-       "gcc-" __stringify(__GNUC__) "." __stringify(__GNUC_MINOR__)
-
 #define ARCH_SHF_SMALL SHF_IA_64_SHORT
 
 #endif /* _ASM_IA64_MODULE_H */
diff --git a/arch/ia64/include/asm/vermagic.h b/arch/ia64/include/asm/vermagic.h
new file mode 100644 (file)
index 0000000..29c7424
--- /dev/null
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (C) 2003 Hewlett-Packard Co
+ *     David Mosberger-Tang <davidm@hpl.hp.com>
+ */
+
+#ifndef _ASM_VERMAGIC_H
+#define _ASM_VERMAGIC_H
+
+#include <linux/stringify.h>
+
+#define MODULE_ARCH_VERMAGIC   "ia64" \
+       "gcc-" __stringify(__GNUC__) "." __stringify(__GNUC_MINOR__)
+
+#endif /* _ASM_VERMAGIC_H */
index 9846047..724a088 100644 (file)
@@ -83,65 +83,4 @@ search_module_dbetables(unsigned long addr)
 }
 #endif
 
-#ifdef CONFIG_CPU_BMIPS
-#define MODULE_PROC_FAMILY "BMIPS "
-#elif defined CONFIG_CPU_MIPS32_R1
-#define MODULE_PROC_FAMILY "MIPS32_R1 "
-#elif defined CONFIG_CPU_MIPS32_R2
-#define MODULE_PROC_FAMILY "MIPS32_R2 "
-#elif defined CONFIG_CPU_MIPS32_R6
-#define MODULE_PROC_FAMILY "MIPS32_R6 "
-#elif defined CONFIG_CPU_MIPS64_R1
-#define MODULE_PROC_FAMILY "MIPS64_R1 "
-#elif defined CONFIG_CPU_MIPS64_R2
-#define MODULE_PROC_FAMILY "MIPS64_R2 "
-#elif defined CONFIG_CPU_MIPS64_R6
-#define MODULE_PROC_FAMILY "MIPS64_R6 "
-#elif defined CONFIG_CPU_R3000
-#define MODULE_PROC_FAMILY "R3000 "
-#elif defined CONFIG_CPU_TX39XX
-#define MODULE_PROC_FAMILY "TX39XX "
-#elif defined CONFIG_CPU_VR41XX
-#define MODULE_PROC_FAMILY "VR41XX "
-#elif defined CONFIG_CPU_R4X00
-#define MODULE_PROC_FAMILY "R4X00 "
-#elif defined CONFIG_CPU_TX49XX
-#define MODULE_PROC_FAMILY "TX49XX "
-#elif defined CONFIG_CPU_R5000
-#define MODULE_PROC_FAMILY "R5000 "
-#elif defined CONFIG_CPU_R5500
-#define MODULE_PROC_FAMILY "R5500 "
-#elif defined CONFIG_CPU_NEVADA
-#define MODULE_PROC_FAMILY "NEVADA "
-#elif defined CONFIG_CPU_R10000
-#define MODULE_PROC_FAMILY "R10000 "
-#elif defined CONFIG_CPU_RM7000
-#define MODULE_PROC_FAMILY "RM7000 "
-#elif defined CONFIG_CPU_SB1
-#define MODULE_PROC_FAMILY "SB1 "
-#elif defined CONFIG_CPU_LOONGSON32
-#define MODULE_PROC_FAMILY "LOONGSON32 "
-#elif defined CONFIG_CPU_LOONGSON2EF
-#define MODULE_PROC_FAMILY "LOONGSON2EF "
-#elif defined CONFIG_CPU_LOONGSON64
-#define MODULE_PROC_FAMILY "LOONGSON64 "
-#elif defined CONFIG_CPU_CAVIUM_OCTEON
-#define MODULE_PROC_FAMILY "OCTEON "
-#elif defined CONFIG_CPU_XLR
-#define MODULE_PROC_FAMILY "XLR "
-#elif defined CONFIG_CPU_XLP
-#define MODULE_PROC_FAMILY "XLP "
-#else
-#error MODULE_PROC_FAMILY undefined for your processor configuration
-#endif
-
-#ifdef CONFIG_32BIT
-#define MODULE_KERNEL_TYPE "32BIT "
-#elif defined CONFIG_64BIT
-#define MODULE_KERNEL_TYPE "64BIT "
-#endif
-
-#define MODULE_ARCH_VERMAGIC \
-       MODULE_PROC_FAMILY MODULE_KERNEL_TYPE
-
 #endif /* _ASM_MODULE_H */
diff --git a/arch/mips/include/asm/vermagic.h b/arch/mips/include/asm/vermagic.h
new file mode 100644 (file)
index 0000000..24dc3d3
--- /dev/null
@@ -0,0 +1,66 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _ASM_VERMAGIC_H
+#define _ASM_VERMAGIC_H
+
+#ifdef CONFIG_CPU_BMIPS
+#define MODULE_PROC_FAMILY "BMIPS "
+#elif defined CONFIG_CPU_MIPS32_R1
+#define MODULE_PROC_FAMILY "MIPS32_R1 "
+#elif defined CONFIG_CPU_MIPS32_R2
+#define MODULE_PROC_FAMILY "MIPS32_R2 "
+#elif defined CONFIG_CPU_MIPS32_R6
+#define MODULE_PROC_FAMILY "MIPS32_R6 "
+#elif defined CONFIG_CPU_MIPS64_R1
+#define MODULE_PROC_FAMILY "MIPS64_R1 "
+#elif defined CONFIG_CPU_MIPS64_R2
+#define MODULE_PROC_FAMILY "MIPS64_R2 "
+#elif defined CONFIG_CPU_MIPS64_R6
+#define MODULE_PROC_FAMILY "MIPS64_R6 "
+#elif defined CONFIG_CPU_R3000
+#define MODULE_PROC_FAMILY "R3000 "
+#elif defined CONFIG_CPU_TX39XX
+#define MODULE_PROC_FAMILY "TX39XX "
+#elif defined CONFIG_CPU_VR41XX
+#define MODULE_PROC_FAMILY "VR41XX "
+#elif defined CONFIG_CPU_R4X00
+#define MODULE_PROC_FAMILY "R4X00 "
+#elif defined CONFIG_CPU_TX49XX
+#define MODULE_PROC_FAMILY "TX49XX "
+#elif defined CONFIG_CPU_R5000
+#define MODULE_PROC_FAMILY "R5000 "
+#elif defined CONFIG_CPU_R5500
+#define MODULE_PROC_FAMILY "R5500 "
+#elif defined CONFIG_CPU_NEVADA
+#define MODULE_PROC_FAMILY "NEVADA "
+#elif defined CONFIG_CPU_R10000
+#define MODULE_PROC_FAMILY "R10000 "
+#elif defined CONFIG_CPU_RM7000
+#define MODULE_PROC_FAMILY "RM7000 "
+#elif defined CONFIG_CPU_SB1
+#define MODULE_PROC_FAMILY "SB1 "
+#elif defined CONFIG_CPU_LOONGSON32
+#define MODULE_PROC_FAMILY "LOONGSON32 "
+#elif defined CONFIG_CPU_LOONGSON2EF
+#define MODULE_PROC_FAMILY "LOONGSON2EF "
+#elif defined CONFIG_CPU_LOONGSON64
+#define MODULE_PROC_FAMILY "LOONGSON64 "
+#elif defined CONFIG_CPU_CAVIUM_OCTEON
+#define MODULE_PROC_FAMILY "OCTEON "
+#elif defined CONFIG_CPU_XLR
+#define MODULE_PROC_FAMILY "XLR "
+#elif defined CONFIG_CPU_XLP
+#define MODULE_PROC_FAMILY "XLP "
+#else
+#error MODULE_PROC_FAMILY undefined for your processor configuration
+#endif
+
+#ifdef CONFIG_32BIT
+#define MODULE_KERNEL_TYPE "32BIT "
+#elif defined CONFIG_64BIT
+#define MODULE_KERNEL_TYPE "64BIT "
+#endif
+
+#define MODULE_ARCH_VERMAGIC \
+       MODULE_PROC_FAMILY MODULE_KERNEL_TYPE
+
+#endif /* _ASM_VERMAGIC_H */
diff --git a/arch/nds32/include/asm/module.h b/arch/nds32/include/asm/module.h
deleted file mode 100644 (file)
index a3a08e9..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-// Copyright (C) 2005-2017 Andes Technology Corporation
-
-#ifndef _ASM_NDS32_MODULE_H
-#define _ASM_NDS32_MODULE_H
-
-#include <asm-generic/module.h>
-
-#define MODULE_ARCH_VERMAGIC   "NDS32v3"
-
-#endif /* _ASM_NDS32_MODULE_H */
diff --git a/arch/nds32/include/asm/vermagic.h b/arch/nds32/include/asm/vermagic.h
new file mode 100644 (file)
index 0000000..f772e7b
--- /dev/null
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+// Copyright (C) 2005-2017 Andes Technology Corporation
+
+#ifndef _ASM_VERMAGIC_H
+#define _ASM_VERMAGIC_H
+
+#define MODULE_ARCH_VERMAGIC   "NDS32v3"
+
+#endif /* _ASM_VERMAGIC_H */
index 3566587..5398bfc 100644 (file)
@@ -3,28 +3,10 @@
 #define _ASM_POWERPC_MODULE_H
 #ifdef __KERNEL__
 
-/*
- */
-
 #include <linux/list.h>
 #include <asm/bug.h>
 #include <asm-generic/module.h>
 
-
-#ifdef CONFIG_MPROFILE_KERNEL
-#define MODULE_ARCH_VERMAGIC_FTRACE    "mprofile-kernel "
-#else
-#define MODULE_ARCH_VERMAGIC_FTRACE    ""
-#endif
-
-#ifdef CONFIG_RELOCATABLE
-#define MODULE_ARCH_VERMAGIC_RELOCATABLE       "relocatable "
-#else
-#define MODULE_ARCH_VERMAGIC_RELOCATABLE       ""
-#endif
-
-#define MODULE_ARCH_VERMAGIC MODULE_ARCH_VERMAGIC_FTRACE MODULE_ARCH_VERMAGIC_RELOCATABLE
-
 #ifndef __powerpc64__
 /*
  * Thanks to Paul M for explaining this.
diff --git a/arch/powerpc/include/asm/vermagic.h b/arch/powerpc/include/asm/vermagic.h
new file mode 100644 (file)
index 0000000..b054a85
--- /dev/null
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _ASM_VERMAGIC_H
+#define _ASM_VERMAGIC_H
+
+#ifdef CONFIG_MPROFILE_KERNEL
+#define MODULE_ARCH_VERMAGIC_FTRACE    "mprofile-kernel "
+#else
+#define MODULE_ARCH_VERMAGIC_FTRACE    ""
+#endif
+
+#ifdef CONFIG_RELOCATABLE
+#define MODULE_ARCH_VERMAGIC_RELOCATABLE       "relocatable "
+#else
+#define MODULE_ARCH_VERMAGIC_RELOCATABLE       ""
+#endif
+
+#define MODULE_ARCH_VERMAGIC \
+               MODULE_ARCH_VERMAGIC_FTRACE MODULE_ARCH_VERMAGIC_RELOCATABLE
+
+#endif /* _ASM_VERMAGIC_H */
index 6404df6..2b35f9b 100644 (file)
@@ -604,18 +604,19 @@ int kvmppc_book3s_hv_page_fault(struct kvm_run *run, struct kvm_vcpu *vcpu,
         */
        local_irq_disable();
        ptep = __find_linux_pte(vcpu->arch.pgdir, hva, NULL, &shift);
+       pte = __pte(0);
+       if (ptep)
+               pte = *ptep;
+       local_irq_enable();
        /*
         * If the PTE disappeared temporarily due to a THP
         * collapse, just return and let the guest try again.
         */
-       if (!ptep) {
-               local_irq_enable();
+       if (!pte_present(pte)) {
                if (page)
                        put_page(page);
                return RESUME_GUEST;
        }
-       pte = *ptep;
-       local_irq_enable();
        hpa = pte_pfn(pte) << PAGE_SHIFT;
        pte_size = PAGE_SIZE;
        if (shift)
index 9f05006..aa12cd4 100644 (file)
@@ -815,18 +815,19 @@ int kvmppc_book3s_instantiate_page(struct kvm_vcpu *vcpu,
         */
        local_irq_disable();
        ptep = __find_linux_pte(vcpu->arch.pgdir, hva, NULL, &shift);
+       pte = __pte(0);
+       if (ptep)
+               pte = *ptep;
+       local_irq_enable();
        /*
         * If the PTE disappeared temporarily due to a THP
         * collapse, just return and let the guest try again.
         */
-       if (!ptep) {
-               local_irq_enable();
+       if (!pte_present(pte)) {
                if (page)
                        put_page(page);
                return RESUME_GUEST;
        }
-       pte = *ptep;
-       local_irq_enable();
 
        /* If we're logging dirty pages, always map single pages */
        large_enable = !(memslot->flags & KVM_MEM_LOG_DIRTY_PAGES);
index 46202da..76aa96a 100644 (file)
@@ -6,8 +6,6 @@
 
 #include <asm-generic/module.h>
 
-#define MODULE_ARCH_VERMAGIC    "riscv"
-
 struct module;
 unsigned long module_emit_got_entry(struct module *mod, unsigned long val);
 unsigned long module_emit_plt_entry(struct module *mod, unsigned long val);
diff --git a/arch/riscv/include/asm/vermagic.h b/arch/riscv/include/asm/vermagic.h
new file mode 100644 (file)
index 0000000..7b9441a
--- /dev/null
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/* Copyright (C) 2017 Andes Technology Corporation */
+
+#ifndef _ASM_VERMAGIC_H
+#define _ASM_VERMAGIC_H
+
+#define MODULE_ARCH_VERMAGIC    "riscv"
+
+#endif /* _ASM_VERMAGIC_H */
index 8191106..bfb4811 100644 (file)
@@ -393,7 +393,7 @@ static unsigned long deliverable_irqs(struct kvm_vcpu *vcpu)
        if (psw_mchk_disabled(vcpu))
                active_mask &= ~IRQ_PEND_MCHK_MASK;
        /* PV guest cpus can have a single interruption injected at a time. */
-       if (kvm_s390_pv_cpu_is_protected(vcpu) &&
+       if (kvm_s390_pv_cpu_get_handle(vcpu) &&
            vcpu->arch.sie_block->iictl != IICTL_CODE_NONE)
                active_mask &= ~(IRQ_PEND_EXT_II_MASK |
                                 IRQ_PEND_IO_MASK |
index 19a8102..5dcf9ff 100644 (file)
@@ -1939,6 +1939,9 @@ static int gfn_to_memslot_approx(struct kvm_memslots *slots, gfn_t gfn)
                        start = slot + 1;
        }
 
+       if (start >= slots->used_slots)
+               return slots->used_slots - 1;
+
        if (gfn >= memslots[start].base_gfn &&
            gfn < memslots[start].base_gfn + memslots[start].npages) {
                atomic_set(&slots->lru_slot, start);
index 9f38fb3..337663a 100644 (file)
@@ -11,32 +11,4 @@ struct mod_arch_specific {
 };
 #endif
 
-#ifdef CONFIG_CPU_LITTLE_ENDIAN
-# ifdef CONFIG_CPU_SH2
-#  define MODULE_PROC_FAMILY "SH2LE "
-# elif defined  CONFIG_CPU_SH3
-#  define MODULE_PROC_FAMILY "SH3LE "
-# elif defined  CONFIG_CPU_SH4
-#  define MODULE_PROC_FAMILY "SH4LE "
-# elif defined  CONFIG_CPU_SH5
-#  define MODULE_PROC_FAMILY "SH5LE "
-# else
-#  error unknown processor family
-# endif
-#else
-# ifdef CONFIG_CPU_SH2
-#  define MODULE_PROC_FAMILY "SH2BE "
-# elif defined  CONFIG_CPU_SH3
-#  define MODULE_PROC_FAMILY "SH3BE "
-# elif defined  CONFIG_CPU_SH4
-#  define MODULE_PROC_FAMILY "SH4BE "
-# elif defined  CONFIG_CPU_SH5
-#  define MODULE_PROC_FAMILY "SH5BE "
-# else
-#  error unknown processor family
-# endif
-#endif
-
-#define MODULE_ARCH_VERMAGIC MODULE_PROC_FAMILY
-
 #endif /* _ASM_SH_MODULE_H */
diff --git a/arch/sh/include/asm/vermagic.h b/arch/sh/include/asm/vermagic.h
new file mode 100644 (file)
index 0000000..13d8eaa
--- /dev/null
@@ -0,0 +1,34 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#ifndef _ASM_VERMAGIC_H
+#define _ASM_VERMAGIC_H
+
+#ifdef CONFIG_CPU_LITTLE_ENDIAN
+# ifdef CONFIG_CPU_SH2
+#  define MODULE_PROC_FAMILY "SH2LE "
+# elif defined  CONFIG_CPU_SH3
+#  define MODULE_PROC_FAMILY "SH3LE "
+# elif defined  CONFIG_CPU_SH4
+#  define MODULE_PROC_FAMILY "SH4LE "
+# elif defined  CONFIG_CPU_SH5
+#  define MODULE_PROC_FAMILY "SH5LE "
+# else
+#  error unknown processor family
+# endif
+#else
+# ifdef CONFIG_CPU_SH2
+#  define MODULE_PROC_FAMILY "SH2BE "
+# elif defined  CONFIG_CPU_SH3
+#  define MODULE_PROC_FAMILY "SH3BE "
+# elif defined  CONFIG_CPU_SH4
+#  define MODULE_PROC_FAMILY "SH4BE "
+# elif defined  CONFIG_CPU_SH5
+#  define MODULE_PROC_FAMILY "SH5BE "
+# else
+#  error unknown processor family
+# endif
+#endif
+
+#define MODULE_ARCH_VERMAGIC MODULE_PROC_FAMILY
+
+#endif /* _ASM_VERMAGIC_H */
index b9de2d4..8d2a68a 100644 (file)
@@ -412,7 +412,7 @@ int arch_add_memory(int nid, u64 start, u64 size,
        unsigned long nr_pages = size >> PAGE_SHIFT;
        int ret;
 
-       if (WARN_ON_ONCE(params->pgprot.pgprot != PAGE_KERNEL.pgprot)
+       if (WARN_ON_ONCE(params->pgprot.pgprot != PAGE_KERNEL.pgprot))
                return -EINVAL;
 
        /* We only have ZONE_NORMAL, so this is easy.. */
index d2daa20..275f5ff 100644 (file)
@@ -140,6 +140,7 @@ export CFLAGS_vmlinux := $(LINK-y) $(LINK_WRAPS) $(LD_FLAGS_CMDLINE)
 # When cleaning we don't include .config, so we don't include
 # TT or skas makefiles and don't clean skas_ptregs.h.
 CLEAN_FILES += linux x.i gmon.out
+MRPROPER_DIRS += arch/$(SUBARCH)/include/generated
 
 archclean:
        @find . \( -name '*.bb' -o -name '*.bbg' -o -name '*.da' \
index 1d6104e..1197b55 100644 (file)
@@ -149,7 +149,7 @@ config X86
        select HAVE_ARCH_TRACEHOOK
        select HAVE_ARCH_TRANSPARENT_HUGEPAGE
        select HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD if X86_64
-       select HAVE_ARCH_USERFAULTFD_WP         if USERFAULTFD
+       select HAVE_ARCH_USERFAULTFD_WP         if X86_64 && USERFAULTFD
        select HAVE_ARCH_VMAP_STACK             if X86_64
        select HAVE_ARCH_WITHIN_STACK_FRAMES
        select HAVE_ASM_MODVERSIONS
index 6685e12..7063b5a 100644 (file)
@@ -41,7 +41,7 @@ struct microcode_amd {
        unsigned int                    mpb[0];
 };
 
-#define PATCH_MAX_SIZE PAGE_SIZE
+#define PATCH_MAX_SIZE (3 * PAGE_SIZE)
 
 #ifdef CONFIG_MICROCODE_AMD
 extern void __init load_ucode_amd_bsp(unsigned int family);
index c215d27..e988bac 100644 (file)
@@ -13,64 +13,4 @@ struct mod_arch_specific {
 #endif
 };
 
-#ifdef CONFIG_X86_64
-/* X86_64 does not define MODULE_PROC_FAMILY */
-#elif defined CONFIG_M486SX
-#define MODULE_PROC_FAMILY "486SX "
-#elif defined CONFIG_M486
-#define MODULE_PROC_FAMILY "486 "
-#elif defined CONFIG_M586
-#define MODULE_PROC_FAMILY "586 "
-#elif defined CONFIG_M586TSC
-#define MODULE_PROC_FAMILY "586TSC "
-#elif defined CONFIG_M586MMX
-#define MODULE_PROC_FAMILY "586MMX "
-#elif defined CONFIG_MCORE2
-#define MODULE_PROC_FAMILY "CORE2 "
-#elif defined CONFIG_MATOM
-#define MODULE_PROC_FAMILY "ATOM "
-#elif defined CONFIG_M686
-#define MODULE_PROC_FAMILY "686 "
-#elif defined CONFIG_MPENTIUMII
-#define MODULE_PROC_FAMILY "PENTIUMII "
-#elif defined CONFIG_MPENTIUMIII
-#define MODULE_PROC_FAMILY "PENTIUMIII "
-#elif defined CONFIG_MPENTIUMM
-#define MODULE_PROC_FAMILY "PENTIUMM "
-#elif defined CONFIG_MPENTIUM4
-#define MODULE_PROC_FAMILY "PENTIUM4 "
-#elif defined CONFIG_MK6
-#define MODULE_PROC_FAMILY "K6 "
-#elif defined CONFIG_MK7
-#define MODULE_PROC_FAMILY "K7 "
-#elif defined CONFIG_MK8
-#define MODULE_PROC_FAMILY "K8 "
-#elif defined CONFIG_MELAN
-#define MODULE_PROC_FAMILY "ELAN "
-#elif defined CONFIG_MCRUSOE
-#define MODULE_PROC_FAMILY "CRUSOE "
-#elif defined CONFIG_MEFFICEON
-#define MODULE_PROC_FAMILY "EFFICEON "
-#elif defined CONFIG_MWINCHIPC6
-#define MODULE_PROC_FAMILY "WINCHIPC6 "
-#elif defined CONFIG_MWINCHIP3D
-#define MODULE_PROC_FAMILY "WINCHIP3D "
-#elif defined CONFIG_MCYRIXIII
-#define MODULE_PROC_FAMILY "CYRIXIII "
-#elif defined CONFIG_MVIAC3_2
-#define MODULE_PROC_FAMILY "VIAC3-2 "
-#elif defined CONFIG_MVIAC7
-#define MODULE_PROC_FAMILY "VIAC7 "
-#elif defined CONFIG_MGEODEGX1
-#define MODULE_PROC_FAMILY "GEODEGX1 "
-#elif defined CONFIG_MGEODE_LX
-#define MODULE_PROC_FAMILY "GEODE "
-#else
-#error unknown processor family
-#endif
-
-#ifdef CONFIG_X86_32
-# define MODULE_ARCH_VERMAGIC MODULE_PROC_FAMILY
-#endif
-
 #endif /* _ASM_X86_MODULE_H */
index 07e95dc..7e9a281 100644 (file)
@@ -237,27 +237,6 @@ enum ssb_mitigation {
 extern char __indirect_thunk_start[];
 extern char __indirect_thunk_end[];
 
-/*
- * On VMEXIT we must ensure that no RSB predictions learned in the guest
- * can be followed in the host, by overwriting the RSB completely. Both
- * retpoline and IBRS mitigations for Spectre v2 need this; only on future
- * CPUs with IBRS_ALL *might* it be avoided.
- */
-static inline void vmexit_fill_RSB(void)
-{
-#ifdef CONFIG_RETPOLINE
-       unsigned long loops;
-
-       asm volatile (ANNOTATE_NOSPEC_ALTERNATIVE
-                     ALTERNATIVE("jmp 910f",
-                                 __stringify(__FILL_RETURN_BUFFER(%0, RSB_CLEAR_LOOPS, %1)),
-                                 X86_FEATURE_RETPOLINE)
-                     "910:"
-                     : "=r" (loops), ASM_CALL_CONSTRAINT
-                     : : "memory" );
-#endif
-}
-
 static __always_inline
 void alternative_msr_write(unsigned int msr, u64 val, unsigned int feature)
 {
diff --git a/arch/x86/include/asm/vermagic.h b/arch/x86/include/asm/vermagic.h
new file mode 100644 (file)
index 0000000..75884d2
--- /dev/null
@@ -0,0 +1,68 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
+#ifndef _ASM_VERMAGIC_H
+#define _ASM_VERMAGIC_H
+
+#ifdef CONFIG_X86_64
+/* X86_64 does not define MODULE_PROC_FAMILY */
+#elif defined CONFIG_M486SX
+#define MODULE_PROC_FAMILY "486SX "
+#elif defined CONFIG_M486
+#define MODULE_PROC_FAMILY "486 "
+#elif defined CONFIG_M586
+#define MODULE_PROC_FAMILY "586 "
+#elif defined CONFIG_M586TSC
+#define MODULE_PROC_FAMILY "586TSC "
+#elif defined CONFIG_M586MMX
+#define MODULE_PROC_FAMILY "586MMX "
+#elif defined CONFIG_MCORE2
+#define MODULE_PROC_FAMILY "CORE2 "
+#elif defined CONFIG_MATOM
+#define MODULE_PROC_FAMILY "ATOM "
+#elif defined CONFIG_M686
+#define MODULE_PROC_FAMILY "686 "
+#elif defined CONFIG_MPENTIUMII
+#define MODULE_PROC_FAMILY "PENTIUMII "
+#elif defined CONFIG_MPENTIUMIII
+#define MODULE_PROC_FAMILY "PENTIUMIII "
+#elif defined CONFIG_MPENTIUMM
+#define MODULE_PROC_FAMILY "PENTIUMM "
+#elif defined CONFIG_MPENTIUM4
+#define MODULE_PROC_FAMILY "PENTIUM4 "
+#elif defined CONFIG_MK6
+#define MODULE_PROC_FAMILY "K6 "
+#elif defined CONFIG_MK7
+#define MODULE_PROC_FAMILY "K7 "
+#elif defined CONFIG_MK8
+#define MODULE_PROC_FAMILY "K8 "
+#elif defined CONFIG_MELAN
+#define MODULE_PROC_FAMILY "ELAN "
+#elif defined CONFIG_MCRUSOE
+#define MODULE_PROC_FAMILY "CRUSOE "
+#elif defined CONFIG_MEFFICEON
+#define MODULE_PROC_FAMILY "EFFICEON "
+#elif defined CONFIG_MWINCHIPC6
+#define MODULE_PROC_FAMILY "WINCHIPC6 "
+#elif defined CONFIG_MWINCHIP3D
+#define MODULE_PROC_FAMILY "WINCHIP3D "
+#elif defined CONFIG_MCYRIXIII
+#define MODULE_PROC_FAMILY "CYRIXIII "
+#elif defined CONFIG_MVIAC3_2
+#define MODULE_PROC_FAMILY "VIAC3-2 "
+#elif defined CONFIG_MVIAC7
+#define MODULE_PROC_FAMILY "VIAC7 "
+#elif defined CONFIG_MGEODEGX1
+#define MODULE_PROC_FAMILY "GEODEGX1 "
+#elif defined CONFIG_MGEODE_LX
+#define MODULE_PROC_FAMILY "GEODE "
+#else
+#error unknown processor family
+#endif
+
+#ifdef CONFIG_X86_32
+# define MODULE_ARCH_VERMAGIC MODULE_PROC_FAMILY
+#else
+# define MODULE_ARCH_VERMAGIC ""
+#endif
+
+#endif /* _ASM_VERMAGIC_H */
index bf08d45..a19a680 100644 (file)
@@ -1119,35 +1119,53 @@ void switch_to_sld(unsigned long tifn)
        sld_update_msr(!(tifn & _TIF_SLD));
 }
 
-#define SPLIT_LOCK_CPU(model) {X86_VENDOR_INTEL, 6, model, X86_FEATURE_ANY}
-
 /*
- * The following processors have the split lock detection feature. But
- * since they don't have the IA32_CORE_CAPABILITIES MSR, the feature cannot
- * be enumerated. Enable it by family and model matching on these
- * processors.
+ * Bits in the IA32_CORE_CAPABILITIES are not architectural, so they should
+ * only be trusted if it is confirmed that a CPU model implements a
+ * specific feature at a particular bit position.
+ *
+ * The possible driver data field values:
+ *
+ * - 0: CPU models that are known to have the per-core split-lock detection
+ *     feature even though they do not enumerate IA32_CORE_CAPABILITIES.
+ *
+ * - 1: CPU models which may enumerate IA32_CORE_CAPABILITIES and if so use
+ *      bit 5 to enumerate the per-core split-lock detection feature.
  */
 static const struct x86_cpu_id split_lock_cpu_ids[] __initconst = {
-       SPLIT_LOCK_CPU(INTEL_FAM6_ICELAKE_X),
-       SPLIT_LOCK_CPU(INTEL_FAM6_ICELAKE_L),
+       X86_MATCH_INTEL_FAM6_MODEL(ICELAKE_X,           0),
+       X86_MATCH_INTEL_FAM6_MODEL(ICELAKE_L,           0),
+       X86_MATCH_INTEL_FAM6_MODEL(ATOM_TREMONT,        1),
+       X86_MATCH_INTEL_FAM6_MODEL(ATOM_TREMONT_D,      1),
+       X86_MATCH_INTEL_FAM6_MODEL(ATOM_TREMONT_L,      1),
        {}
 };
 
 void __init cpu_set_core_cap_bits(struct cpuinfo_x86 *c)
 {
-       u64 ia32_core_caps = 0;
+       const struct x86_cpu_id *m;
+       u64 ia32_core_caps;
+
+       if (boot_cpu_has(X86_FEATURE_HYPERVISOR))
+               return;
 
-       if (c->x86_vendor != X86_VENDOR_INTEL)
+       m = x86_match_cpu(split_lock_cpu_ids);
+       if (!m)
                return;
-       if (cpu_has(c, X86_FEATURE_CORE_CAPABILITIES)) {
-               /* Enumerate features reported in IA32_CORE_CAPABILITIES MSR. */
+
+       switch (m->driver_data) {
+       case 0:
+               break;
+       case 1:
+               if (!cpu_has(c, X86_FEATURE_CORE_CAPABILITIES))
+                       return;
                rdmsrl(MSR_IA32_CORE_CAPS, ia32_core_caps);
-       } else if (!boot_cpu_has(X86_FEATURE_HYPERVISOR)) {
-               /* Enumerate split lock detection by family and model. */
-               if (x86_match_cpu(split_lock_cpu_ids))
-                       ia32_core_caps |= MSR_IA32_CORE_CAPS_SPLIT_LOCK_DETECT;
+               if (!(ia32_core_caps & MSR_IA32_CORE_CAPS_SPLIT_LOCK_DETECT))
+                       return;
+               break;
+       default:
+               return;
        }
 
-       if (ia32_core_caps & MSR_IA32_CORE_CAPS_SPLIT_LOCK_DETECT)
-               split_lock_setup();
+       split_lock_setup();
 }
index 89049b3..d8cc522 100644 (file)
@@ -578,6 +578,8 @@ static void domain_add_cpu(int cpu, struct rdt_resource *r)
        d->id = id;
        cpumask_set_cpu(cpu, &d->cpu_mask);
 
+       rdt_domain_reconfigure_cdp(r);
+
        if (r->alloc_capable && domain_setup_ctrlval(r, d)) {
                kfree(d);
                return;
index 181c992..3dd13f3 100644 (file)
@@ -601,5 +601,6 @@ bool has_busy_rmid(struct rdt_resource *r, struct rdt_domain *d);
 void __check_limbo(struct rdt_domain *d, bool force_free);
 bool cbm_validate_intel(char *buf, u32 *data, struct rdt_resource *r);
 bool cbm_validate_amd(char *buf, u32 *data, struct rdt_resource *r);
+void rdt_domain_reconfigure_cdp(struct rdt_resource *r);
 
 #endif /* _ASM_X86_RESCTRL_INTERNAL_H */
index 064e9ef..5a359d9 100644 (file)
@@ -1859,6 +1859,19 @@ static int set_cache_qos_cfg(int level, bool enable)
        return 0;
 }
 
+/* Restore the qos cfg state when a domain comes online */
+void rdt_domain_reconfigure_cdp(struct rdt_resource *r)
+{
+       if (!r->alloc_capable)
+               return;
+
+       if (r == &rdt_resources_all[RDT_RESOURCE_L2DATA])
+               l2_qos_cfg_update(&r->alloc_enabled);
+
+       if (r == &rdt_resources_all[RDT_RESOURCE_L3DATA])
+               l3_qos_cfg_update(&r->alloc_enabled);
+}
+
 /*
  * Enable or disable the MBA software controller
  * which helps user specify bandwidth in MBps.
@@ -3072,7 +3085,8 @@ static int rdtgroup_rmdir(struct kernfs_node *kn)
         * If the rdtgroup is a mon group and parent directory
         * is a valid "mon_groups" directory, remove the mon group.
         */
-       if (rdtgrp->type == RDTCTRL_GROUP && parent_kn == rdtgroup_default.kn) {
+       if (rdtgrp->type == RDTCTRL_GROUP && parent_kn == rdtgroup_default.kn &&
+           rdtgrp != &rdtgroup_default) {
                if (rdtgrp->mode == RDT_MODE_PSEUDO_LOCKSETUP ||
                    rdtgrp->mode == RDT_MODE_PSEUDO_LOCKED) {
                        ret = rdtgroup_ctrl_remove(kn, rdtgrp);
index 4d732a4..8d5cbe1 100644 (file)
@@ -81,7 +81,7 @@
 #define        UMIP_INST_SLDT  3       /* 0F 00 /0 */
 #define        UMIP_INST_STR   4       /* 0F 00 /1 */
 
-const char * const umip_insns[5] = {
+static const char * const umip_insns[5] = {
        [UMIP_INST_SGDT] = "SGDT",
        [UMIP_INST_SIDT] = "SIDT",
        [UMIP_INST_SMSW] = "SMSW",
index a789759..4a3081e 100644 (file)
@@ -3,6 +3,10 @@
 ccflags-y += -Iarch/x86/kvm
 ccflags-$(CONFIG_KVM_WERROR) += -Werror
 
+ifeq ($(CONFIG_FRAME_POINTER),y)
+OBJECT_FILES_NON_STANDARD_vmenter.o := y
+endif
+
 KVM := ../../../virt/kvm
 
 kvm-y                  += $(KVM)/kvm_main.o $(KVM)/coalesced_mmio.o \
index 0e3fc31..cf912b4 100644 (file)
@@ -12,6 +12,7 @@
 #include <linux/kernel.h>
 #include <linux/highmem.h>
 #include <linux/psp-sev.h>
+#include <linux/pagemap.h>
 #include <linux/swap.h>
 
 #include "x86.h"
@@ -1117,7 +1118,7 @@ int __init sev_hardware_setup(void)
        /* Maximum number of encrypted guests supported simultaneously */
        max_sev_asid = cpuid_ecx(0x8000001F);
 
-       if (!max_sev_asid)
+       if (!svm_sev_enabled())
                return 1;
 
        /* Minimum ASID value that should be used for SEV guest */
@@ -1156,6 +1157,9 @@ err:
 
 void sev_hardware_teardown(void)
 {
+       if (!svm_sev_enabled())
+               return;
+
        bitmap_free(sev_asid_bitmap);
        bitmap_free(sev_reclaim_asid_bitmap);
 
index 2be5bba..2f379ba 100644 (file)
@@ -3276,7 +3276,7 @@ static void svm_cancel_injection(struct kvm_vcpu *vcpu)
        svm_complete_interrupts(svm);
 }
 
-bool __svm_vcpu_run(unsigned long vmcb_pa, unsigned long *regs);
+void __svm_vcpu_run(unsigned long vmcb_pa, unsigned long *regs);
 
 static void svm_vcpu_run(struct kvm_vcpu *vcpu)
 {
@@ -3330,13 +3330,8 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu)
         */
        x86_spec_ctrl_set_guest(svm->spec_ctrl, svm->virt_spec_ctrl);
 
-       local_irq_enable();
-
        __svm_vcpu_run(svm->vmcb_pa, (unsigned long *)&svm->vcpu.arch.regs);
 
-       /* Eliminate branch target predictions from guest mode */
-       vmexit_fill_RSB();
-
 #ifdef CONFIG_X86_64
        wrmsrl(MSR_GS_BASE, svm->host.gs_base);
 #else
@@ -3366,8 +3361,6 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu)
 
        reload_tss(vcpu);
 
-       local_irq_disable();
-
        x86_spec_ctrl_restore_host(svm->spec_ctrl, svm->virt_spec_ctrl);
 
        vcpu->arch.cr2 = svm->vmcb->save.cr2;
@@ -3411,7 +3404,6 @@ static void svm_vcpu_run(struct kvm_vcpu *vcpu)
 
        mark_all_clean(svm->vmcb);
 }
-STACK_FRAME_NON_STANDARD(svm_vcpu_run);
 
 static void svm_load_mmu_pgd(struct kvm_vcpu *vcpu, unsigned long root)
 {
index fa1af90..bf94433 100644 (file)
@@ -3,6 +3,7 @@
 #include <asm/asm.h>
 #include <asm/bitsperlong.h>
 #include <asm/kvm_vcpu_regs.h>
+#include <asm/nospec-branch.h>
 
 #define WORD_SIZE (BITS_PER_LONG / 8)
 
@@ -35,7 +36,6 @@
  */
 SYM_FUNC_START(__svm_vcpu_run)
        push %_ASM_BP
-       mov  %_ASM_SP, %_ASM_BP
 #ifdef CONFIG_X86_64
        push %r15
        push %r14
@@ -78,6 +78,7 @@ SYM_FUNC_START(__svm_vcpu_run)
        pop %_ASM_AX
 
        /* Enter guest mode */
+       sti
 1:     vmload %_ASM_AX
        jmp 3f
 2:     cmpb $0, kvm_rebooting
@@ -99,6 +100,13 @@ SYM_FUNC_START(__svm_vcpu_run)
        ud2
        _ASM_EXTABLE(5b, 6b)
 7:
+       cli
+
+#ifdef CONFIG_RETPOLINE
+       /* IMPORTANT: Stuff the RSB immediately after VM-Exit, before RET! */
+       FILL_RETURN_BUFFER %_ASM_AX, RSB_CLEAR_LOOPS, X86_FEATURE_RETPOLINE
+#endif
+
        /* "POP" @regs to RAX. */
        pop %_ASM_AX
 
index cbc9ea2..fd78ffb 100644 (file)
@@ -5533,8 +5533,25 @@ static bool nested_vmx_exit_handled_vmcs_access(struct kvm_vcpu *vcpu,
        return 1 & (b >> (field & 7));
 }
 
+static bool nested_vmx_exit_handled_mtf(struct vmcs12 *vmcs12)
+{
+       u32 entry_intr_info = vmcs12->vm_entry_intr_info_field;
+
+       if (nested_cpu_has_mtf(vmcs12))
+               return true;
+
+       /*
+        * An MTF VM-exit may be injected into the guest by setting the
+        * interruption-type to 7 (other event) and the vector field to 0. Such
+        * is the case regardless of the 'monitor trap flag' VM-execution
+        * control.
+        */
+       return entry_intr_info == (INTR_INFO_VALID_MASK
+                                  | INTR_TYPE_OTHER_EVENT);
+}
+
 /*
- * Return 1 if we should exit from L2 to L1 to handle an exit, or 0 if we
+ * Return true if we should exit from L2 to L1 to handle an exit, or false if we
  * should handle it ourselves in L0 (and then continue L2). Only call this
  * when in is_guest_mode (L2).
  */
@@ -5633,7 +5650,7 @@ bool nested_vmx_exit_reflected(struct kvm_vcpu *vcpu, u32 exit_reason)
        case EXIT_REASON_MWAIT_INSTRUCTION:
                return nested_cpu_has(vmcs12, CPU_BASED_MWAIT_EXITING);
        case EXIT_REASON_MONITOR_TRAP_FLAG:
-               return nested_cpu_has_mtf(vmcs12);
+               return nested_vmx_exit_handled_mtf(vmcs12);
        case EXIT_REASON_MONITOR_INSTRUCTION:
                return nested_cpu_has(vmcs12, CPU_BASED_MONITOR_EXITING);
        case EXIT_REASON_PAUSE_INSTRUCTION:
index 8305097..c2c6335 100644 (file)
@@ -4572,7 +4572,7 @@ static int handle_rmode_exception(struct kvm_vcpu *vcpu,
  */
 static void kvm_machine_check(void)
 {
-#if defined(CONFIG_X86_MCE) && defined(CONFIG_X86_64)
+#if defined(CONFIG_X86_MCE)
        struct pt_regs regs = {
                .cs = 3, /* Fake ring 3 no matter what the guest ran on */
                .flags = X86_EFLAGS_IF,
index 3bf2eca..c5835f9 100644 (file)
@@ -3060,6 +3060,17 @@ int kvm_get_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
        case MSR_IA32_PERF_CTL:
        case MSR_AMD64_DC_CFG:
        case MSR_F15H_EX_CFG:
+       /*
+        * Intel Sandy Bridge CPUs must support the RAPL (running average power
+        * limit) MSRs. Just return 0, as we do not want to expose the host
+        * data here. Do not conditionalize this on CPUID, as KVM does not do
+        * so for existing CPU-specific MSRs.
+        */
+       case MSR_RAPL_POWER_UNIT:
+       case MSR_PP0_ENERGY_STATUS:     /* Power plane 0 (core) */
+       case MSR_PP1_ENERGY_STATUS:     /* Power plane 1 (graphics uncore) */
+       case MSR_PKG_ENERGY_STATUS:     /* Total package */
+       case MSR_DRAM_ENERGY_STATUS:    /* DRAM controller */
                msr_info->data = 0;
                break;
        case MSR_F15H_PERF_CTL0 ... MSR_F15H_PERF_CTR5:
@@ -5049,10 +5060,13 @@ set_identity_unlock:
                r = -EFAULT;
                if (copy_from_user(&u.ps, argp, sizeof(u.ps)))
                        goto out;
+               mutex_lock(&kvm->lock);
                r = -ENXIO;
                if (!kvm->arch.vpit)
-                       goto out;
+                       goto set_pit_out;
                r = kvm_vm_ioctl_set_pit(kvm, &u.ps);
+set_pit_out:
+               mutex_unlock(&kvm->lock);
                break;
        }
        case KVM_GET_PIT2: {
@@ -5072,10 +5086,13 @@ set_identity_unlock:
                r = -EFAULT;
                if (copy_from_user(&u.ps2, argp, sizeof(u.ps2)))
                        goto out;
+               mutex_lock(&kvm->lock);
                r = -ENXIO;
                if (!kvm->arch.vpit)
-                       goto out;
+                       goto set_pit2_out;
                r = kvm_vm_ioctl_set_pit2(kvm, &u.ps2);
+set_pit2_out:
+               mutex_unlock(&kvm->lock);
                break;
        }
        case KVM_REINJECT_CONTROL: {
diff --git a/arch/xtensa/include/asm/module.h b/arch/xtensa/include/asm/module.h
deleted file mode 100644 (file)
index 488b40c..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * include/asm-xtensa/module.h
- *
- * This file contains the module code specific to the Xtensa architecture.
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * Copyright (C) 2001 - 2005 Tensilica Inc.
- */
-
-#ifndef _XTENSA_MODULE_H
-#define _XTENSA_MODULE_H
-
-#define MODULE_ARCH_VERMAGIC "xtensa-" __stringify(XCHAL_CORE_ID) " "
-
-#include <asm-generic/module.h>
-
-#endif /* _XTENSA_MODULE_H */
diff --git a/arch/xtensa/include/asm/vermagic.h b/arch/xtensa/include/asm/vermagic.h
new file mode 100644 (file)
index 0000000..6d9c670
--- /dev/null
@@ -0,0 +1,17 @@
+/*
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2001 - 2005 Tensilica Inc.
+ */
+
+#ifndef _ASM_VERMAGIC_H
+#define _ASM_VERMAGIC_H
+
+#include <linux/stringify.h>
+#include <variant/core.h>
+
+#define MODULE_ARCH_VERMAGIC "xtensa-" __stringify(XCHAL_CORE_ID) " "
+
+#endif /* _ASM_VERMAGIC_H */
index db35ee6..3ab0c1c 100644 (file)
@@ -1591,7 +1591,7 @@ skip_surplus_transfers:
                                      vrate_min, vrate_max);
                }
 
-               trace_iocost_ioc_vrate_adj(ioc, vrate, &missed_ppm, rq_wait_pct,
+               trace_iocost_ioc_vrate_adj(ioc, vrate, missed_ppm, rq_wait_pct,
                                           nr_lagging, nr_shortages,
                                           nr_surpluses);
 
@@ -1600,7 +1600,7 @@ skip_surplus_transfers:
                        ioc->period_us * vrate * INUSE_MARGIN_PCT, 100);
        } else if (ioc->busy_level != prev_busy_level || nr_lagging) {
                trace_iocost_ioc_vrate_adj(ioc, atomic64_read(&ioc->vtime_rate),
-                                          &missed_ppm, rq_wait_pct, nr_lagging,
+                                          missed_ppm, rq_wait_pct, nr_lagging,
                                           nr_shortages, nr_surpluses);
        }
 
index 8e56884..a7785df 100644 (file)
@@ -1222,8 +1222,10 @@ bool blk_mq_dispatch_rq_list(struct request_queue *q, struct list_head *list,
                rq = list_first_entry(list, struct request, queuelist);
 
                hctx = rq->mq_hctx;
-               if (!got_budget && !blk_mq_get_dispatch_budget(hctx))
+               if (!got_budget && !blk_mq_get_dispatch_budget(hctx)) {
+                       blk_mq_put_driver_tag(rq);
                        break;
+               }
 
                if (!blk_mq_get_driver_tag(rq)) {
                        /*
index 8641ba9..9cb082f 100644 (file)
@@ -313,7 +313,7 @@ static void scale_up(struct rq_wb *rwb)
        calc_wb_limits(rwb);
        rwb->unknown_cnt = 0;
        rwb_wake_all(rwb);
-       rwb_trace_step(rwb, "scale up");
+       rwb_trace_step(rwb, tracepoint_string("scale up"));
 }
 
 static void scale_down(struct rq_wb *rwb, bool hard_throttle)
@@ -322,7 +322,7 @@ static void scale_down(struct rq_wb *rwb, bool hard_throttle)
                return;
        calc_wb_limits(rwb);
        rwb->unknown_cnt = 0;
-       rwb_trace_step(rwb, "scale down");
+       rwb_trace_step(rwb, tracepoint_string("scale down"));
 }
 
 static void rwb_arm_timer(struct rq_wb *rwb)
index 00112cf..78cfc70 100644 (file)
@@ -87,18 +87,6 @@ static const struct dmi_system_id dmi_lid_quirks[] = {
                },
                .driver_data = (void *)(long)ACPI_BUTTON_LID_INIT_DISABLED,
        },
-       {
-               /*
-                * Asus T200TA, _LID keeps reporting closed after every second
-                * openening of the lid. Causing immediate re-suspend after
-                * opening every other open. Using LID_INIT_OPEN fixes this.
-                */
-               .matches = {
-                       DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
-                       DMI_MATCH(DMI_PRODUCT_NAME, "T200TA"),
-               },
-               .driver_data = (void *)(long)ACPI_BUTTON_LID_INIT_OPEN,
-       },
        {
                /* GP-electronic T701, _LID method points to a floating GPIO */
                .matches = {
index 00a6da2..ed3d218 100644 (file)
@@ -322,10 +322,10 @@ static int acpi_pci_link_set(struct acpi_pci_link *link, int irq)
                resource->res.data.extended_irq.polarity =
                    link->irq.polarity;
                if (link->irq.triggering == ACPI_EDGE_SENSITIVE)
-                       resource->res.data.irq.shareable =
+                       resource->res.data.extended_irq.shareable =
                            ACPI_EXCLUSIVE;
                else
-                       resource->res.data.irq.shareable = ACPI_SHARED;
+                       resource->res.data.extended_irq.shareable = ACPI_SHARED;
                resource->res.data.extended_irq.interrupt_count = 1;
                resource->res.data.extended_irq.interrupts[0] = irq;
                /* ignore resource_source, it's optional */
index 0101b65..0c0a736 100644 (file)
@@ -410,6 +410,7 @@ static const struct pci_device_id ahci_pci_tbl[] = {
        { PCI_VDEVICE(INTEL, 0x22a3), board_ahci_mobile }, /* Cherry Tr. AHCI */
        { PCI_VDEVICE(INTEL, 0x5ae3), board_ahci_mobile }, /* ApolloLake AHCI */
        { PCI_VDEVICE(INTEL, 0x34d3), board_ahci_mobile }, /* Ice Lake LP AHCI */
+       { PCI_VDEVICE(INTEL, 0x02d3), board_ahci_mobile }, /* Comet Lake PCH-U AHCI */
        { PCI_VDEVICE(INTEL, 0x02d7), board_ahci_mobile }, /* Comet Lake PCH RAID */
 
        /* JMicron 360/1/3/5/6, match class to avoid IDE function */
index a6b76cc..e517bd8 100644 (file)
@@ -145,7 +145,7 @@ enum {
 
        /* PORT_IDMA_CTL bits */
        IDMA_CTL_RST_ATA        = (1 << 2),  /* hardreset ATA bus */
-       IDMA_CTL_RST_IDMA       = (1 << 5),  /* reset IDMA machinary */
+       IDMA_CTL_RST_IDMA       = (1 << 5),  /* reset IDMA machinery */
        IDMA_CTL_GO             = (1 << 7),  /* IDMA mode go */
        IDMA_CTL_ATA_NIEN       = (1 << 8),  /* ATA IRQ disable */
 
index fdd508a..0e07e17 100644 (file)
@@ -730,7 +730,7 @@ static bool dpm_async_fn(struct device *dev, async_func_t func)
 
        if (is_async(dev)) {
                get_device(dev);
-               async_schedule(func, dev);
+               async_schedule_dev(func, dev);
                return true;
        }
 
index 62b6608..81b311c 100644 (file)
@@ -85,26 +85,35 @@ struct nullb {
        char disk_name[DISK_NAME_LEN];
 };
 
+blk_status_t null_process_cmd(struct nullb_cmd *cmd,
+                             enum req_opf op, sector_t sector,
+                             unsigned int nr_sectors);
+
 #ifdef CONFIG_BLK_DEV_ZONED
-int null_zone_init(struct nullb_device *dev);
-void null_zone_exit(struct nullb_device *dev);
+int null_init_zoned_dev(struct nullb_device *dev, struct request_queue *q);
+int null_register_zoned_dev(struct nullb *nullb);
+void null_free_zoned_dev(struct nullb_device *dev);
 int null_report_zones(struct gendisk *disk, sector_t sector,
                      unsigned int nr_zones, report_zones_cb cb, void *data);
-blk_status_t null_handle_zoned(struct nullb_cmd *cmd,
-                               enum req_opf op, sector_t sector,
-                               sector_t nr_sectors);
+blk_status_t null_process_zoned_cmd(struct nullb_cmd *cmd,
+                                   enum req_opf op, sector_t sector,
+                                   sector_t nr_sectors);
 size_t null_zone_valid_read_len(struct nullb *nullb,
                                sector_t sector, unsigned int len);
 #else
-static inline int null_zone_init(struct nullb_device *dev)
+static inline int null_init_zoned_dev(struct nullb_device *dev,
+                                     struct request_queue *q)
 {
        pr_err("CONFIG_BLK_DEV_ZONED not enabled\n");
        return -EINVAL;
 }
-static inline void null_zone_exit(struct nullb_device *dev) {}
-static inline blk_status_t null_handle_zoned(struct nullb_cmd *cmd,
-                                            enum req_opf op, sector_t sector,
-                                            sector_t nr_sectors)
+static inline int null_register_zoned_dev(struct nullb *nullb)
+{
+       return -ENODEV;
+}
+static inline void null_free_zoned_dev(struct nullb_device *dev) {}
+static inline blk_status_t null_process_zoned_cmd(struct nullb_cmd *cmd,
+                       enum req_opf op, sector_t sector, sector_t nr_sectors)
 {
        return BLK_STS_NOTSUPP;
 }
index 4e1c071..8efd877 100644 (file)
@@ -580,7 +580,7 @@ static void null_free_dev(struct nullb_device *dev)
        if (!dev)
                return;
 
-       null_zone_exit(dev);
+       null_free_zoned_dev(dev);
        badblocks_exit(&dev->badblocks);
        kfree(dev);
 }
@@ -1276,6 +1276,25 @@ static inline void nullb_complete_cmd(struct nullb_cmd *cmd)
        }
 }
 
+blk_status_t null_process_cmd(struct nullb_cmd *cmd,
+                             enum req_opf op, sector_t sector,
+                             unsigned int nr_sectors)
+{
+       struct nullb_device *dev = cmd->nq->dev;
+       blk_status_t ret;
+
+       if (dev->badblocks.shift != -1) {
+               ret = null_handle_badblocks(cmd, sector, nr_sectors);
+               if (ret != BLK_STS_OK)
+                       return ret;
+       }
+
+       if (dev->memory_backed)
+               return null_handle_memory_backed(cmd, op);
+
+       return BLK_STS_OK;
+}
+
 static blk_status_t null_handle_cmd(struct nullb_cmd *cmd, sector_t sector,
                                    sector_t nr_sectors, enum req_opf op)
 {
@@ -1294,17 +1313,11 @@ static blk_status_t null_handle_cmd(struct nullb_cmd *cmd, sector_t sector,
                goto out;
        }
 
-       if (nullb->dev->badblocks.shift != -1) {
-               cmd->error = null_handle_badblocks(cmd, sector, nr_sectors);
-               if (cmd->error != BLK_STS_OK)
-                       goto out;
-       }
-
-       if (dev->memory_backed)
-               cmd->error = null_handle_memory_backed(cmd, op);
-
-       if (!cmd->error && dev->zoned)
-               cmd->error = null_handle_zoned(cmd, op, sector, nr_sectors);
+       if (dev->zoned)
+               cmd->error = null_process_zoned_cmd(cmd, op,
+                                                   sector, nr_sectors);
+       else
+               cmd->error = null_process_cmd(cmd, op, sector, nr_sectors);
 
 out:
        nullb_complete_cmd(cmd);
@@ -1605,19 +1618,12 @@ static int null_gendisk_register(struct nullb *nullb)
        disk->queue             = nullb->q;
        strncpy(disk->disk_name, nullb->disk_name, DISK_NAME_LEN);
 
-#ifdef CONFIG_BLK_DEV_ZONED
        if (nullb->dev->zoned) {
-               if (queue_is_mq(nullb->q)) {
-                       int ret = blk_revalidate_disk_zones(disk);
-                       if (ret)
-                               return ret;
-               } else {
-                       blk_queue_chunk_sectors(nullb->q,
-                                       nullb->dev->zone_size_sects);
-                       nullb->q->nr_zones = blkdev_nr_zones(disk);
-               }
+               int ret = null_register_zoned_dev(nullb);
+
+               if (ret)
+                       return ret;
        }
-#endif
 
        add_disk(disk);
        return 0;
@@ -1773,14 +1779,9 @@ static int null_add_dev(struct nullb_device *dev)
        }
 
        if (dev->zoned) {
-               rv = null_zone_init(dev);
+               rv = null_init_zoned_dev(dev, nullb->q);
                if (rv)
                        goto out_cleanup_blk_queue;
-
-               nullb->q->limits.zoned = BLK_ZONED_HM;
-               blk_queue_flag_set(QUEUE_FLAG_ZONE_RESETALL, nullb->q);
-               blk_queue_required_elevator_features(nullb->q,
-                                               ELEVATOR_F_ZBD_SEQ_WRITE);
        }
 
        nullb->q->queuedata = nullb;
@@ -1809,8 +1810,7 @@ static int null_add_dev(struct nullb_device *dev)
 
        return 0;
 out_cleanup_zone:
-       if (dev->zoned)
-               null_zone_exit(dev);
+       null_free_zoned_dev(dev);
 out_cleanup_blk_queue:
        blk_cleanup_queue(nullb->q);
 out_cleanup_tags:
index 673618d..9e4bcda 100644 (file)
@@ -13,7 +13,7 @@ static inline unsigned int null_zone_no(struct nullb_device *dev, sector_t sect)
        return sect >> ilog2(dev->zone_size_sects);
 }
 
-int null_zone_init(struct nullb_device *dev)
+int null_init_zoned_dev(struct nullb_device *dev, struct request_queue *q)
 {
        sector_t dev_size = (sector_t)dev->size * 1024 * 1024;
        sector_t sector = 0;
@@ -61,10 +61,27 @@ int null_zone_init(struct nullb_device *dev)
                sector += dev->zone_size_sects;
        }
 
+       q->limits.zoned = BLK_ZONED_HM;
+       blk_queue_flag_set(QUEUE_FLAG_ZONE_RESETALL, q);
+       blk_queue_required_elevator_features(q, ELEVATOR_F_ZBD_SEQ_WRITE);
+
+       return 0;
+}
+
+int null_register_zoned_dev(struct nullb *nullb)
+{
+       struct request_queue *q = nullb->q;
+
+       if (queue_is_mq(q))
+               return blk_revalidate_disk_zones(nullb->disk);
+
+       blk_queue_chunk_sectors(q, nullb->dev->zone_size_sects);
+       q->nr_zones = blkdev_nr_zones(nullb->disk);
+
        return 0;
 }
 
-void null_zone_exit(struct nullb_device *dev)
+void null_free_zoned_dev(struct nullb_device *dev)
 {
        kvfree(dev->zones);
 }
@@ -126,11 +143,16 @@ static blk_status_t null_zone_write(struct nullb_cmd *cmd, sector_t sector,
        struct nullb_device *dev = cmd->nq->dev;
        unsigned int zno = null_zone_no(dev, sector);
        struct blk_zone *zone = &dev->zones[zno];
+       blk_status_t ret;
+
+       trace_nullb_zone_op(cmd, zno, zone->cond);
+
+       if (zone->type == BLK_ZONE_TYPE_CONVENTIONAL)
+               return null_process_cmd(cmd, REQ_OP_WRITE, sector, nr_sectors);
 
        switch (zone->cond) {
        case BLK_ZONE_COND_FULL:
                /* Cannot write to a full zone */
-               cmd->error = BLK_STS_IOERR;
                return BLK_STS_IOERR;
        case BLK_ZONE_COND_EMPTY:
        case BLK_ZONE_COND_IMP_OPEN:
@@ -143,19 +165,18 @@ static blk_status_t null_zone_write(struct nullb_cmd *cmd, sector_t sector,
                if (zone->cond != BLK_ZONE_COND_EXP_OPEN)
                        zone->cond = BLK_ZONE_COND_IMP_OPEN;
 
+               ret = null_process_cmd(cmd, REQ_OP_WRITE, sector, nr_sectors);
+               if (ret != BLK_STS_OK)
+                       return ret;
+
                zone->wp += nr_sectors;
                if (zone->wp == zone->start + zone->len)
                        zone->cond = BLK_ZONE_COND_FULL;
-               break;
-       case BLK_ZONE_COND_NOT_WP:
-               break;
+               return BLK_STS_OK;
        default:
                /* Invalid zone condition */
                return BLK_STS_IOERR;
        }
-
-       trace_nullb_zone_op(cmd, zno, zone->cond);
-       return BLK_STS_OK;
 }
 
 static blk_status_t null_zone_mgmt(struct nullb_cmd *cmd, enum req_opf op,
@@ -216,8 +237,8 @@ static blk_status_t null_zone_mgmt(struct nullb_cmd *cmd, enum req_opf op,
        return BLK_STS_OK;
 }
 
-blk_status_t null_handle_zoned(struct nullb_cmd *cmd, enum req_opf op,
-                              sector_t sector, sector_t nr_sectors)
+blk_status_t null_process_zoned_cmd(struct nullb_cmd *cmd, enum req_opf op,
+                                   sector_t sector, sector_t nr_sectors)
 {
        switch (op) {
        case REQ_OP_WRITE:
@@ -229,6 +250,6 @@ blk_status_t null_handle_zoned(struct nullb_cmd *cmd, enum req_opf op,
        case REQ_OP_ZONE_FINISH:
                return null_zone_mgmt(cmd, op, sector);
        default:
-               return BLK_STS_OK;
+               return null_process_cmd(cmd, op, sector, nr_sectors);
        }
 }
index f9b1e70..93468b7 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/blk-mq.h>
 #include <linux/blk-mq-virtio.h>
 #include <linux/numa.h>
+#include <uapi/linux/virtio_ring.h>
 
 #define PART_BITS 4
 #define VQ_NAME_LEN 16
index 718d8c0..79a6e47 100644 (file)
@@ -11,6 +11,7 @@
 #include <linux/virtio.h>
 #include <linux/virtio_rng.h>
 #include <linux/module.h>
+#include <linux/slab.h>
 
 static DEFINE_IDA(rng_index_ida);
 
index a438b12..1621ce8 100644 (file)
@@ -323,7 +323,7 @@ int tpm_pcr_extend(struct tpm_chip *chip, u32 pcr_idx,
 
        for (i = 0; i < chip->nr_allocated_banks; i++) {
                if (digests[i].alg_id != chip->allocated_banks[i].alg_id) {
-                       rc = EINVAL;
+                       rc = -EINVAL;
                        goto out;
                }
        }
index 76f67b1..eff1f12 100644 (file)
@@ -681,6 +681,7 @@ out:
                rc = -ENODEV;
        return rc;
 }
+EXPORT_SYMBOL_GPL(tpm2_get_cc_attrs_tbl);
 
 /**
  * tpm2_startup - turn on the TPM
index 1a49db9..09fe452 100644 (file)
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
- * Copyright (C) 2012 IBM Corporation
+ * Copyright (C) 2012-2020 IBM Corporation
  *
  * Author: Ashley Lai <ashleydlai@gmail.com>
  *
@@ -134,6 +134,64 @@ static int tpm_ibmvtpm_recv(struct tpm_chip *chip, u8 *buf, size_t count)
        return len;
 }
 
+/**
+ * ibmvtpm_crq_send_init - Send a CRQ initialize message
+ * @ibmvtpm:   vtpm device struct
+ *
+ * Return:
+ *     0 on success.
+ *     Non-zero on failure.
+ */
+static int ibmvtpm_crq_send_init(struct ibmvtpm_dev *ibmvtpm)
+{
+       int rc;
+
+       rc = ibmvtpm_send_crq_word(ibmvtpm->vdev, INIT_CRQ_CMD);
+       if (rc != H_SUCCESS)
+               dev_err(ibmvtpm->dev,
+                       "%s failed rc=%d\n", __func__, rc);
+
+       return rc;
+}
+
+/**
+ * tpm_ibmvtpm_resume - Resume from suspend
+ *
+ * @dev:       device struct
+ *
+ * Return: Always 0.
+ */
+static int tpm_ibmvtpm_resume(struct device *dev)
+{
+       struct tpm_chip *chip = dev_get_drvdata(dev);
+       struct ibmvtpm_dev *ibmvtpm = dev_get_drvdata(&chip->dev);
+       int rc = 0;
+
+       do {
+               if (rc)
+                       msleep(100);
+               rc = plpar_hcall_norets(H_ENABLE_CRQ,
+                                       ibmvtpm->vdev->unit_address);
+       } while (rc == H_IN_PROGRESS || rc == H_BUSY || H_IS_LONG_BUSY(rc));
+
+       if (rc) {
+               dev_err(dev, "Error enabling ibmvtpm rc=%d\n", rc);
+               return rc;
+       }
+
+       rc = vio_enable_interrupts(ibmvtpm->vdev);
+       if (rc) {
+               dev_err(dev, "Error vio_enable_interrupts rc=%d\n", rc);
+               return rc;
+       }
+
+       rc = ibmvtpm_crq_send_init(ibmvtpm);
+       if (rc)
+               dev_err(dev, "Error send_init rc=%d\n", rc);
+
+       return rc;
+}
+
 /**
  * tpm_ibmvtpm_send() - Send a TPM command
  * @chip:      tpm chip struct
@@ -147,6 +205,7 @@ static int tpm_ibmvtpm_recv(struct tpm_chip *chip, u8 *buf, size_t count)
 static int tpm_ibmvtpm_send(struct tpm_chip *chip, u8 *buf, size_t count)
 {
        struct ibmvtpm_dev *ibmvtpm = dev_get_drvdata(&chip->dev);
+       bool retry = true;
        int rc, sig;
 
        if (!ibmvtpm->rtce_buf) {
@@ -180,18 +239,27 @@ static int tpm_ibmvtpm_send(struct tpm_chip *chip, u8 *buf, size_t count)
         */
        ibmvtpm->tpm_processing_cmd = true;
 
+again:
        rc = ibmvtpm_send_crq(ibmvtpm->vdev,
                        IBMVTPM_VALID_CMD, VTPM_TPM_COMMAND,
                        count, ibmvtpm->rtce_dma_handle);
        if (rc != H_SUCCESS) {
+               /*
+                * H_CLOSED can be returned after LPM resume.  Call
+                * tpm_ibmvtpm_resume() to re-enable the CRQ then retry
+                * ibmvtpm_send_crq() once before failing.
+                */
+               if (rc == H_CLOSED && retry) {
+                       tpm_ibmvtpm_resume(ibmvtpm->dev);
+                       retry = false;
+                       goto again;
+               }
                dev_err(ibmvtpm->dev, "tpm_ibmvtpm_send failed rc=%d\n", rc);
-               rc = 0;
                ibmvtpm->tpm_processing_cmd = false;
-       } else
-               rc = 0;
+       }
 
        spin_unlock(&ibmvtpm->rtce_lock);
-       return rc;
+       return 0;
 }
 
 static void tpm_ibmvtpm_cancel(struct tpm_chip *chip)
@@ -269,26 +337,6 @@ static int ibmvtpm_crq_send_init_complete(struct ibmvtpm_dev *ibmvtpm)
        return rc;
 }
 
-/**
- * ibmvtpm_crq_send_init - Send a CRQ initialize message
- * @ibmvtpm:   vtpm device struct
- *
- * Return:
- *     0 on success.
- *     Non-zero on failure.
- */
-static int ibmvtpm_crq_send_init(struct ibmvtpm_dev *ibmvtpm)
-{
-       int rc;
-
-       rc = ibmvtpm_send_crq_word(ibmvtpm->vdev, INIT_CRQ_CMD);
-       if (rc != H_SUCCESS)
-               dev_err(ibmvtpm->dev,
-                       "ibmvtpm_crq_send_init failed rc=%d\n", rc);
-
-       return rc;
-}
-
 /**
  * tpm_ibmvtpm_remove - ibm vtpm remove entry point
  * @vdev:      vio device struct
@@ -401,44 +449,6 @@ static int ibmvtpm_reset_crq(struct ibmvtpm_dev *ibmvtpm)
                                  ibmvtpm->crq_dma_handle, CRQ_RES_BUF_SIZE);
 }
 
-/**
- * tpm_ibmvtpm_resume - Resume from suspend
- *
- * @dev:       device struct
- *
- * Return: Always 0.
- */
-static int tpm_ibmvtpm_resume(struct device *dev)
-{
-       struct tpm_chip *chip = dev_get_drvdata(dev);
-       struct ibmvtpm_dev *ibmvtpm = dev_get_drvdata(&chip->dev);
-       int rc = 0;
-
-       do {
-               if (rc)
-                       msleep(100);
-               rc = plpar_hcall_norets(H_ENABLE_CRQ,
-                                       ibmvtpm->vdev->unit_address);
-       } while (rc == H_IN_PROGRESS || rc == H_BUSY || H_IS_LONG_BUSY(rc));
-
-       if (rc) {
-               dev_err(dev, "Error enabling ibmvtpm rc=%d\n", rc);
-               return rc;
-       }
-
-       rc = vio_enable_interrupts(ibmvtpm->vdev);
-       if (rc) {
-               dev_err(dev, "Error vio_enable_interrupts rc=%d\n", rc);
-               return rc;
-       }
-
-       rc = ibmvtpm_crq_send_init(ibmvtpm);
-       if (rc)
-               dev_err(dev, "Error send_init rc=%d\n", rc);
-
-       return rc;
-}
-
 static bool tpm_ibmvtpm_req_canceled(struct tpm_chip *chip, u8 status)
 {
        return (status == 0);
index 27c6ca0..2435216 100644 (file)
@@ -433,6 +433,9 @@ static void disable_interrupts(struct tpm_chip *chip)
        u32 intmask;
        int rc;
 
+       if (priv->irq == 0)
+               return;
+
        rc = tpm_tis_read32(priv, TPM_INT_ENABLE(priv->locality), &intmask);
        if (rc < 0)
                intmask = 0;
@@ -1062,9 +1065,12 @@ int tpm_tis_core_init(struct device *dev, struct tpm_tis_data *priv, int irq,
                if (irq) {
                        tpm_tis_probe_irq_single(chip, intmask, IRQF_SHARED,
                                                 irq);
-                       if (!(chip->flags & TPM_CHIP_FLAG_IRQ))
+                       if (!(chip->flags & TPM_CHIP_FLAG_IRQ)) {
                                dev_err(&chip->dev, FW_BUG
                                        "TPM interrupt not working, polling instead\n");
+
+                               disable_interrupts(chip);
+                       }
                } else {
                        tpm_tis_probe_irq(chip, intmask);
                }
index 536b59a..bacebd4 100644 (file)
@@ -276,7 +276,7 @@ static void __init asm9260_acc_init(struct device_node *np)
 
        /* TODO: Convert to DT parent scheme */
        ref_clk = of_clk_get_parent_name(np, 0);
-       hw = __clk_hw_register_fixed_rate_with_accuracy(NULL, NULL, pll_clk,
+       hw = __clk_hw_register_fixed_rate(NULL, NULL, pll_clk,
                        ref_clk, NULL, NULL, 0, rate, 0,
                        CLK_FIXED_RATE_PARENT_ACCURACY);
 
index 7077be2..962014c 100644 (file)
@@ -97,7 +97,7 @@ static const struct clk_ops mmp_clk_pll_ops = {
        .recalc_rate = mmp_clk_pll_recalc_rate,
 };
 
-struct clk *mmp_clk_register_pll(char *name,
+static struct clk *mmp_clk_register_pll(char *name,
                        unsigned long default_rate,
                        void __iomem *enable_reg, u32 enable,
                        void __iomem *reg, u8 shift,
@@ -137,3 +137,34 @@ struct clk *mmp_clk_register_pll(char *name,
 
        return clk;
 }
+
+void mmp_register_pll_clks(struct mmp_clk_unit *unit,
+                       struct mmp_param_pll_clk *clks,
+                       void __iomem *base, int size)
+{
+       struct clk *clk;
+       int i;
+
+       for (i = 0; i < size; i++) {
+               void __iomem *reg = NULL;
+
+               if (clks[i].offset)
+                       reg = base + clks[i].offset;
+
+               clk = mmp_clk_register_pll(clks[i].name,
+                                       clks[i].default_rate,
+                                       base + clks[i].enable_offset,
+                                       clks[i].enable,
+                                       reg, clks[i].shift,
+                                       clks[i].input_rate,
+                                       base + clks[i].postdiv_offset,
+                                       clks[i].postdiv_shift);
+               if (IS_ERR(clk)) {
+                       pr_err("%s: failed to register clock %s\n",
+                              __func__, clks[i].name);
+                       continue;
+               }
+               if (clks[i].id)
+                       unit->clk_table[clks[i].id] = clk;
+       }
+}
index 3171236..ca7d37e 100644 (file)
@@ -176,37 +176,6 @@ void mmp_register_div_clks(struct mmp_clk_unit *unit,
        }
 }
 
-void mmp_register_pll_clks(struct mmp_clk_unit *unit,
-                       struct mmp_param_pll_clk *clks,
-                       void __iomem *base, int size)
-{
-       struct clk *clk;
-       int i;
-
-       for (i = 0; i < size; i++) {
-               void __iomem *reg = NULL;
-
-               if (clks[i].offset)
-                       reg = base + clks[i].offset;
-
-               clk = mmp_clk_register_pll(clks[i].name,
-                                       clks[i].default_rate,
-                                       base + clks[i].enable_offset,
-                                       clks[i].enable,
-                                       reg, clks[i].shift,
-                                       clks[i].input_rate,
-                                       base + clks[i].postdiv_offset,
-                                       clks[i].postdiv_shift);
-               if (IS_ERR(clk)) {
-                       pr_err("%s: failed to register clock %s\n",
-                              __func__, clks[i].name);
-                       continue;
-               }
-               if (clks[i].id)
-                       unit->clk_table[clks[i].id] = clk;
-       }
-}
-
 void mmp_clk_add(struct mmp_clk_unit *unit, unsigned int id,
                        struct clk *clk)
 {
index 971b4d6..20dc1e5 100644 (file)
@@ -238,13 +238,6 @@ void mmp_register_pll_clks(struct mmp_clk_unit *unit,
                        struct mmp_param_pll_clk *clks,
                        void __iomem *base, int size);
 
-extern struct clk *mmp_clk_register_pll(char *name,
-                       unsigned long default_rate,
-                       void __iomem *enable_reg, u32 enable,
-                       void __iomem *reg, u8 shift,
-                       unsigned long input_rate,
-                       void __iomem *postdiv_reg, u8 postdiv_shift);
-
 #define DEFINE_MIX_REG_INFO(w_d, s_d, w_m, s_m, fc)    \
 {                                                      \
        .width_div = (w_d),                             \
index a0631f7..2e2dfb2 100644 (file)
@@ -1641,8 +1641,9 @@ static SPRD_SC_GATE_CLK_FW_NAME(i2c4_eb,  "i2c4-eb",      "ext-26m", 0x0,
                                0x1000, BIT(12), 0, 0);
 static SPRD_SC_GATE_CLK_FW_NAME(uart0_eb,      "uart0-eb",     "ext-26m", 0x0,
                                0x1000, BIT(13), 0, 0);
+/* uart1_eb is for console, don't gate even if unused */
 static SPRD_SC_GATE_CLK_FW_NAME(uart1_eb,      "uart1-eb",     "ext-26m", 0x0,
-                               0x1000, BIT(14), 0, 0);
+                               0x1000, BIT(14), CLK_IGNORE_UNUSED, 0);
 static SPRD_SC_GATE_CLK_FW_NAME(uart2_eb,      "uart2-eb",     "ext-26m", 0x0,
                                0x1000, BIT(15), 0, 0);
 static SPRD_SC_GATE_CLK_FW_NAME(uart3_eb,      "uart3-eb",     "ext-26m", 0x0,
index c6d0724..43bc6cf 100644 (file)
@@ -35,7 +35,7 @@ static struct pm_api_info pm_api_list[] = {
        PM_API(PM_QUERY_DATA),
 };
 
-struct dentry *firmware_debugfs_root;
+static struct dentry *firmware_debugfs_root;
 
 /**
  * zynqmp_pm_argument_value() - Extract argument value from a PM-API request
index 559dc24..f84f9e3 100644 (file)
@@ -2008,8 +2008,24 @@ static void amdgpu_device_fill_reset_magic(struct amdgpu_device *adev)
  */
 static bool amdgpu_device_check_vram_lost(struct amdgpu_device *adev)
 {
-       return !!memcmp(adev->gart.ptr, adev->reset_magic,
-                       AMDGPU_RESET_MAGIC_NUM);
+       if (memcmp(adev->gart.ptr, adev->reset_magic,
+                       AMDGPU_RESET_MAGIC_NUM))
+               return true;
+
+       if (!adev->in_gpu_reset)
+               return false;
+
+       /*
+        * For all ASICs with baco/mode1 reset, the VRAM is
+        * always assumed to be lost.
+        */
+       switch (amdgpu_asic_reset_method(adev)) {
+       case AMD_RESET_METHOD_BACO:
+       case AMD_RESET_METHOD_MODE1:
+               return true;
+       default:
+               return false;
+       }
 }
 
 /**
@@ -2340,6 +2356,8 @@ static int amdgpu_device_ip_suspend_phase1(struct amdgpu_device *adev)
 {
        int i, r;
 
+       amdgpu_device_set_pg_state(adev, AMD_PG_STATE_UNGATE);
+       amdgpu_device_set_cg_state(adev, AMD_CG_STATE_UNGATE);
 
        for (i = adev->num_ip_blocks - 1; i >= 0; i--) {
                if (!adev->ip_blocks[i].status.valid)
index 006f21e..62635e5 100644 (file)
@@ -1358,8 +1358,6 @@ static int cik_asic_reset(struct amdgpu_device *adev)
        int r;
 
        if (cik_asic_reset_method(adev) == AMD_RESET_METHOD_BACO) {
-               if (!adev->in_suspend)
-                       amdgpu_inc_vram_lost(adev);
                r = amdgpu_dpm_baco_reset(adev);
        } else {
                r = cik_asic_pci_config_reset(adev);
index d78059f..f92c158 100644 (file)
@@ -279,7 +279,7 @@ static const struct soc15_reg_golden golden_settings_gc_10_1_2_nv12[] =
 
 #define DEFAULT_SH_MEM_CONFIG \
        ((SH_MEM_ADDRESS_MODE_64 << SH_MEM_CONFIG__ADDRESS_MODE__SHIFT) | \
-        (SH_MEM_ALIGNMENT_MODE_DWORD << SH_MEM_CONFIG__ALIGNMENT_MODE__SHIFT) | \
+        (SH_MEM_ALIGNMENT_MODE_UNALIGNED << SH_MEM_CONFIG__ALIGNMENT_MODE__SHIFT) | \
         (SH_MEM_RETRY_MODE_ALL << SH_MEM_CONFIG__RETRY_MODE__SHIFT) | \
         (3 << SH_MEM_CONFIG__INITIAL_INST_PREFETCH__SHIFT))
 
index e6b113e..0c39048 100644 (file)
@@ -1234,6 +1234,8 @@ struct amdgpu_gfxoff_quirk {
 static const struct amdgpu_gfxoff_quirk amdgpu_gfxoff_quirk_list[] = {
        /* https://bugzilla.kernel.org/show_bug.cgi?id=204689 */
        { 0x1002, 0x15dd, 0x1002, 0x15dd, 0xc8 },
+       /* https://bugzilla.kernel.org/show_bug.cgi?id=207171 */
+       { 0x1002, 0x15dd, 0x103c, 0x83e7, 0xd3 },
        { 0, 0, 0, 0, 0 },
 };
 
index 033cbbc..52318b0 100644 (file)
@@ -351,8 +351,6 @@ static int nv_asic_reset(struct amdgpu_device *adev)
        struct smu_context *smu = &adev->smu;
 
        if (nv_asic_reset_method(adev) == AMD_RESET_METHOD_BACO) {
-               if (!adev->in_suspend)
-                       amdgpu_inc_vram_lost(adev);
                ret = smu_baco_enter(smu);
                if (ret)
                        return ret;
@@ -360,8 +358,6 @@ static int nv_asic_reset(struct amdgpu_device *adev)
                if (ret)
                        return ret;
        } else {
-               if (!adev->in_suspend)
-                       amdgpu_inc_vram_lost(adev);
                ret = nv_asic_mode1_reset(adev);
        }
 
index a40499d..d42a8d8 100644 (file)
@@ -569,14 +569,10 @@ static int soc15_asic_reset(struct amdgpu_device *adev)
 
        switch (soc15_asic_reset_method(adev)) {
                case AMD_RESET_METHOD_BACO:
-                       if (!adev->in_suspend)
-                               amdgpu_inc_vram_lost(adev);
                        return soc15_asic_baco_reset(adev);
                case AMD_RESET_METHOD_MODE2:
                        return amdgpu_dpm_mode2_reset(adev);
                default:
-                       if (!adev->in_suspend)
-                               amdgpu_inc_vram_lost(adev);
                        return soc15_asic_mode1_reset(adev);
        }
 }
index 78b3590..3ce10e0 100644 (file)
@@ -765,8 +765,6 @@ static int vi_asic_reset(struct amdgpu_device *adev)
        int r;
 
        if (vi_asic_reset_method(adev) == AMD_RESET_METHOD_BACO) {
-               if (!adev->in_suspend)
-                       amdgpu_inc_vram_lost(adev);
                r = amdgpu_dpm_baco_reset(adev);
        } else {
                r = vi_asic_pci_config_reset(adev);
index f7c5cdc..c5ba5d4 100644 (file)
@@ -4664,6 +4664,7 @@ static void amdgpu_dm_connector_destroy(struct drm_connector *connector)
                i2c_del_adapter(&aconnector->i2c->base);
                kfree(aconnector->i2c);
        }
+       kfree(aconnector->dm_dp_aux.aux.name);
 
        kfree(connector);
 }
@@ -4723,10 +4724,19 @@ amdgpu_dm_connector_atomic_duplicate_state(struct drm_connector *connector)
 static int
 amdgpu_dm_connector_late_register(struct drm_connector *connector)
 {
-#if defined(CONFIG_DEBUG_FS)
        struct amdgpu_dm_connector *amdgpu_dm_connector =
                to_amdgpu_dm_connector(connector);
+       int r;
 
+       if ((connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort) ||
+           (connector->connector_type == DRM_MODE_CONNECTOR_eDP)) {
+               amdgpu_dm_connector->dm_dp_aux.aux.dev = connector->kdev;
+               r = drm_dp_aux_register(&amdgpu_dm_connector->dm_dp_aux.aux);
+               if (r)
+                       return r;
+       }
+
+#if defined(CONFIG_DEBUG_FS)
        connector_debugfs_init(amdgpu_dm_connector);
 #endif
 
@@ -6092,7 +6102,7 @@ static int amdgpu_dm_connector_init(struct amdgpu_display_manager *dm,
 
        if (connector_type == DRM_MODE_CONNECTOR_DisplayPort
                || connector_type == DRM_MODE_CONNECTOR_eDP)
-               amdgpu_dm_initialize_dp_connector(dm, aconnector);
+               amdgpu_dm_initialize_dp_connector(dm, aconnector, link->link_index);
 
 out_free:
        if (res) {
index fabbe78..d291775 100644 (file)
@@ -156,16 +156,16 @@ amdgpu_dm_mst_connector_late_register(struct drm_connector *connector)
                to_amdgpu_dm_connector(connector);
        int r;
 
-       amdgpu_dm_connector->dm_dp_aux.aux.dev = connector->kdev;
-       r = drm_dp_aux_register(&amdgpu_dm_connector->dm_dp_aux.aux);
-       if (r)
+       r = drm_dp_mst_connector_late_register(connector,
+                                              amdgpu_dm_connector->port);
+       if (r < 0)
                return r;
 
 #if defined(CONFIG_DEBUG_FS)
        connector_debugfs_init(amdgpu_dm_connector);
 #endif
 
-       return r;
+       return 0;
 }
 
 static void
@@ -472,9 +472,12 @@ static const struct drm_dp_mst_topology_cbs dm_mst_cbs = {
 };
 
 void amdgpu_dm_initialize_dp_connector(struct amdgpu_display_manager *dm,
-                                      struct amdgpu_dm_connector *aconnector)
+                                      struct amdgpu_dm_connector *aconnector,
+                                      int link_index)
 {
-       aconnector->dm_dp_aux.aux.name = "dmdc";
+       aconnector->dm_dp_aux.aux.name =
+               kasprintf(GFP_KERNEL, "AMDGPU DM aux hw bus %d",
+                         link_index);
        aconnector->dm_dp_aux.aux.transfer = dm_dp_aux_transfer;
        aconnector->dm_dp_aux.ddc_service = aconnector->dc_link->ddc;
 
index d6813ce..d2c5657 100644 (file)
@@ -32,7 +32,8 @@ struct amdgpu_dm_connector;
 int dm_mst_get_pbn_divider(struct dc_link *link);
 
 void amdgpu_dm_initialize_dp_connector(struct amdgpu_display_manager *dm,
-                                      struct amdgpu_dm_connector *aconnector);
+                                      struct amdgpu_dm_connector *aconnector,
+                                      int link_index);
 
 #if defined(CONFIG_DRM_AMD_DC_DCN)
 bool compute_mst_dsc_configs_for_state(struct drm_atomic_state *state,
index 77c1467..719597c 100644 (file)
@@ -984,6 +984,32 @@ static int init_thermal_controller(
                        struct pp_hwmgr *hwmgr,
                        const ATOM_PPLIB_POWERPLAYTABLE *powerplay_table)
 {
+       hwmgr->thermal_controller.ucType =
+                       powerplay_table->sThermalController.ucType;
+       hwmgr->thermal_controller.ucI2cLine =
+                       powerplay_table->sThermalController.ucI2cLine;
+       hwmgr->thermal_controller.ucI2cAddress =
+                       powerplay_table->sThermalController.ucI2cAddress;
+
+       hwmgr->thermal_controller.fanInfo.bNoFan =
+               (0 != (powerplay_table->sThermalController.ucFanParameters &
+                       ATOM_PP_FANPARAMETERS_NOFAN));
+
+       hwmgr->thermal_controller.fanInfo.ucTachometerPulsesPerRevolution =
+               powerplay_table->sThermalController.ucFanParameters &
+               ATOM_PP_FANPARAMETERS_TACHOMETER_PULSES_PER_REVOLUTION_MASK;
+
+       hwmgr->thermal_controller.fanInfo.ulMinRPM
+               = powerplay_table->sThermalController.ucFanMinRPM * 100UL;
+       hwmgr->thermal_controller.fanInfo.ulMaxRPM
+               = powerplay_table->sThermalController.ucFanMaxRPM * 100UL;
+
+       set_hw_cap(hwmgr,
+                  ATOM_PP_THERMALCONTROLLER_NONE != hwmgr->thermal_controller.ucType,
+                  PHM_PlatformCaps_ThermalController);
+
+       hwmgr->thermal_controller.use_hw_fan_control = 1;
+
        return 0;
 }
 
index 7740488..4795eb6 100644 (file)
@@ -3804,9 +3804,12 @@ static int smu7_trim_single_dpm_states(struct pp_hwmgr *hwmgr,
 {
        uint32_t i;
 
+       /* force the trim if mclk_switching is disabled to prevent flicker */
+       bool force_trim = (low_limit == high_limit);
        for (i = 0; i < dpm_table->count; i++) {
        /*skip the trim if od is enabled*/
-               if (!hwmgr->od_enabled && (dpm_table->dpm_levels[i].value < low_limit
+               if ((!hwmgr->od_enabled || force_trim)
+                       && (dpm_table->dpm_levels[i].value < low_limit
                        || dpm_table->dpm_levels[i].value > high_limit))
                        dpm_table->dpm_levels[i].enabled = false;
                else
index ff73a73..b0ed1b3 100644 (file)
@@ -895,12 +895,17 @@ static int renoir_read_sensor(struct smu_context *smu,
 
 static bool renoir_is_dpm_running(struct smu_context *smu)
 {
+       struct amdgpu_device *adev = smu->adev;
+
        /*
         * Util now, the pmfw hasn't exported the interface of SMU
         * feature mask to APU SKU so just force on all the feature
         * at early initial stage.
         */
-       return true;
+       if (adev->in_suspend)
+               return false;
+       else
+               return true;
 
 }
 
index 541c932..655ba4f 100644 (file)
@@ -1718,6 +1718,12 @@ int smu_v11_0_baco_set_state(struct smu_context *smu, enum smu_baco_state state)
                if (ret)
                        goto out;
 
+               if (ras && ras->supported) {
+                       ret = smu_send_smc_msg(smu, SMU_MSG_PrepareMp1ForUnload, NULL);
+                       if (ret)
+                               goto out;
+               }
+
                /* clear vbios scratch 6 and 7 for coming asic reinit */
                WREG32(adev->bios_scratch_reg_offset + 6, 0);
                WREG32(adev->bios_scratch_reg_offset + 7, 0);
index 2bc6e4f..9af39ec 100644 (file)
@@ -485,6 +485,9 @@ static int anx6345_get_modes(struct drm_connector *connector)
 
        num_modes += drm_add_edid_modes(connector, anx6345->edid);
 
+       /* Driver currently supports only 6bpc */
+       connector->display_info.bpc = 6;
+
 unlock:
        if (power_off)
                anx6345_poweroff(anx6345);
index 70c4b7a..283615e 100644 (file)
@@ -4295,6 +4295,7 @@ int drm_dp_atomic_release_vcpi_slots(struct drm_atomic_state *state,
        if (pos->vcpi) {
                drm_dp_mst_put_port_malloc(port);
                pos->vcpi = 0;
+               pos->pbn = 0;
        }
 
        return 0;
index 2c617c9..52db785 100644 (file)
@@ -3141,9 +3141,6 @@ static void hsw_ddi_pre_enable_dp(struct intel_encoder *encoder,
        intel_dp_set_link_params(intel_dp, crtc_state->port_clock,
                                 crtc_state->lane_count, is_mst);
 
-       intel_dp->regs.dp_tp_ctl = DP_TP_CTL(port);
-       intel_dp->regs.dp_tp_status = DP_TP_STATUS(port);
-
        intel_edp_panel_on(intel_dp);
 
        intel_ddi_clk_select(encoder, crtc_state);
@@ -3848,12 +3845,18 @@ void intel_ddi_get_config(struct intel_encoder *encoder,
        struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
        struct intel_crtc *intel_crtc = to_intel_crtc(pipe_config->uapi.crtc);
        enum transcoder cpu_transcoder = pipe_config->cpu_transcoder;
+       struct intel_dp *intel_dp = enc_to_intel_dp(encoder);
        u32 temp, flags = 0;
 
        /* XXX: DSI transcoder paranoia */
        if (drm_WARN_ON(&dev_priv->drm, transcoder_is_dsi(cpu_transcoder)))
                return;
 
+       if (INTEL_GEN(dev_priv) >= 12) {
+               intel_dp->regs.dp_tp_ctl = TGL_DP_TP_CTL(cpu_transcoder);
+               intel_dp->regs.dp_tp_status = TGL_DP_TP_STATUS(cpu_transcoder);
+       }
+
        intel_dsc_get_config(encoder, pipe_config);
 
        temp = intel_de_read(dev_priv, TRANS_DDI_FUNC_CTL(cpu_transcoder));
@@ -4173,6 +4176,7 @@ static const struct drm_encoder_funcs intel_ddi_funcs = {
 static struct intel_connector *
 intel_ddi_init_dp_connector(struct intel_digital_port *intel_dig_port)
 {
+       struct drm_i915_private *dev_priv = to_i915(intel_dig_port->base.base.dev);
        struct intel_connector *connector;
        enum port port = intel_dig_port->base.port;
 
@@ -4183,6 +4187,10 @@ intel_ddi_init_dp_connector(struct intel_digital_port *intel_dig_port)
        intel_dig_port->dp.output_reg = DDI_BUF_CTL(port);
        intel_dig_port->dp.prepare_link_retrain =
                intel_ddi_prepare_link_retrain;
+       if (INTEL_GEN(dev_priv) < 12) {
+               intel_dig_port->dp.regs.dp_tp_ctl = DP_TP_CTL(port);
+               intel_dig_port->dp.regs.dp_tp_status = DP_TP_STATUS(port);
+       }
 
        if (!intel_dp_init_connector(intel_dig_port, connector)) {
                kfree(connector);
index 246e406..84ecf8e 100644 (file)
@@ -4140,7 +4140,7 @@ static const struct i915_power_well_desc tgl_power_wells[] = {
        {
                .name = "AUX D TBT1",
                .domains = TGL_AUX_D_TBT1_IO_POWER_DOMAINS,
-               .ops = &hsw_power_well_ops,
+               .ops = &icl_tc_phy_aux_power_well_ops,
                .id = DISP_PW_ID_NONE,
                {
                        .hsw.regs = &icl_aux_power_well_regs,
@@ -4151,7 +4151,7 @@ static const struct i915_power_well_desc tgl_power_wells[] = {
        {
                .name = "AUX E TBT2",
                .domains = TGL_AUX_E_TBT2_IO_POWER_DOMAINS,
-               .ops = &hsw_power_well_ops,
+               .ops = &icl_tc_phy_aux_power_well_ops,
                .id = DISP_PW_ID_NONE,
                {
                        .hsw.regs = &icl_aux_power_well_regs,
@@ -4162,7 +4162,7 @@ static const struct i915_power_well_desc tgl_power_wells[] = {
        {
                .name = "AUX F TBT3",
                .domains = TGL_AUX_F_TBT3_IO_POWER_DOMAINS,
-               .ops = &hsw_power_well_ops,
+               .ops = &icl_tc_phy_aux_power_well_ops,
                .id = DISP_PW_ID_NONE,
                {
                        .hsw.regs = &icl_aux_power_well_regs,
@@ -4173,7 +4173,7 @@ static const struct i915_power_well_desc tgl_power_wells[] = {
        {
                .name = "AUX G TBT4",
                .domains = TGL_AUX_G_TBT4_IO_POWER_DOMAINS,
-               .ops = &hsw_power_well_ops,
+               .ops = &icl_tc_phy_aux_power_well_ops,
                .id = DISP_PW_ID_NONE,
                {
                        .hsw.regs = &icl_aux_power_well_regs,
@@ -4184,7 +4184,7 @@ static const struct i915_power_well_desc tgl_power_wells[] = {
        {
                .name = "AUX H TBT5",
                .domains = TGL_AUX_H_TBT5_IO_POWER_DOMAINS,
-               .ops = &hsw_power_well_ops,
+               .ops = &icl_tc_phy_aux_power_well_ops,
                .id = DISP_PW_ID_NONE,
                {
                        .hsw.regs = &icl_aux_power_well_regs,
@@ -4195,7 +4195,7 @@ static const struct i915_power_well_desc tgl_power_wells[] = {
        {
                .name = "AUX I TBT6",
                .domains = TGL_AUX_I_TBT6_IO_POWER_DOMAINS,
-               .ops = &hsw_power_well_ops,
+               .ops = &icl_tc_phy_aux_power_well_ops,
                .id = DISP_PW_ID_NONE,
                {
                        .hsw.regs = &icl_aux_power_well_regs,
index 804b1d9..a2fafd4 100644 (file)
@@ -2517,9 +2517,6 @@ static void intel_dp_prepare(struct intel_encoder *encoder,
                                 intel_crtc_has_type(pipe_config,
                                                     INTEL_OUTPUT_DP_MST));
 
-       intel_dp->regs.dp_tp_ctl = DP_TP_CTL(port);
-       intel_dp->regs.dp_tp_status = DP_TP_STATUS(port);
-
        /*
         * There are four kinds of DP registers:
         *
@@ -7836,6 +7833,8 @@ bool intel_dp_init(struct drm_i915_private *dev_priv,
 
        intel_dig_port->dp.output_reg = output_reg;
        intel_dig_port->max_lanes = 4;
+       intel_dig_port->dp.regs.dp_tp_ctl = DP_TP_CTL(port);
+       intel_dig_port->dp.regs.dp_tp_status = DP_TP_STATUS(port);
 
        intel_encoder->type = INTEL_OUTPUT_DP;
        intel_encoder->power_domain = intel_port_to_power_domain(port);
index 3e706bb..dbfa689 100644 (file)
@@ -342,6 +342,7 @@ int intel_dp_aux_init_backlight_funcs(struct intel_connector *intel_connector)
         */
        if (dev_priv->vbt.backlight.type !=
            INTEL_BACKLIGHT_VESA_EDP_AUX_INTERFACE &&
+           i915_modparams.enable_dpcd_backlight != 1 &&
            !drm_dp_has_quirk(&intel_dp->desc, intel_dp->edid_quirks,
                              DP_QUIRK_FORCE_DPCD_BACKLIGHT)) {
                DRM_DEV_INFO(dev->dev,
index 3993023..821411b 100644 (file)
@@ -1536,7 +1536,8 @@ bool intel_hdmi_hdcp_check_link(struct intel_digital_port *intel_dig_port)
        intel_de_write(i915, HDCP_RPRIME(i915, cpu_transcoder, port), ri.reg);
 
        /* Wait for Ri prime match */
-       if (wait_for(intel_de_read(i915, HDCP_STATUS(i915, cpu_transcoder, port)) &
+       if (wait_for((intel_de_read(i915, HDCP_STATUS(i915, cpu_transcoder, port)) &
+                     (HDCP_STATUS_RI_MATCH | HDCP_STATUS_ENC)) ==
                     (HDCP_STATUS_RI_MATCH | HDCP_STATUS_ENC), 1)) {
                DRM_ERROR("Ri' mismatch detected, link check failed (%x)\n",
                          intel_de_read(i915, HDCP_STATUS(i915, cpu_transcoder, port)));
index deda351..33d8861 100644 (file)
@@ -2817,19 +2817,25 @@ static bool skl_plane_format_mod_supported(struct drm_plane *_plane,
        }
 }
 
-static bool gen12_plane_supports_mc_ccs(enum plane_id plane_id)
+static bool gen12_plane_supports_mc_ccs(struct drm_i915_private *dev_priv,
+                                       enum plane_id plane_id)
 {
+       /* Wa_14010477008:tgl[a0..c0] */
+       if (IS_TGL_REVID(dev_priv, TGL_REVID_A0, TGL_REVID_C0))
+               return false;
+
        return plane_id < PLANE_SPRITE4;
 }
 
 static bool gen12_plane_format_mod_supported(struct drm_plane *_plane,
                                             u32 format, u64 modifier)
 {
+       struct drm_i915_private *dev_priv = to_i915(_plane->dev);
        struct intel_plane *plane = to_intel_plane(_plane);
 
        switch (modifier) {
        case I915_FORMAT_MOD_Y_TILED_GEN12_MC_CCS:
-               if (!gen12_plane_supports_mc_ccs(plane->id))
+               if (!gen12_plane_supports_mc_ccs(dev_priv, plane->id))
                        return false;
                /* fall through */
        case DRM_FORMAT_MOD_LINEAR:
@@ -2998,9 +3004,10 @@ static const u32 *icl_get_plane_formats(struct drm_i915_private *dev_priv,
        }
 }
 
-static const u64 *gen12_get_plane_modifiers(enum plane_id plane_id)
+static const u64 *gen12_get_plane_modifiers(struct drm_i915_private *dev_priv,
+                                           enum plane_id plane_id)
 {
-       if (gen12_plane_supports_mc_ccs(plane_id))
+       if (gen12_plane_supports_mc_ccs(dev_priv, plane_id))
                return gen12_plane_format_modifiers_mc_ccs;
        else
                return gen12_plane_format_modifiers_rc_ccs;
@@ -3070,7 +3077,7 @@ skl_universal_plane_create(struct drm_i915_private *dev_priv,
 
        plane->has_ccs = skl_plane_has_ccs(dev_priv, pipe, plane_id);
        if (INTEL_GEN(dev_priv) >= 12) {
-               modifiers = gen12_get_plane_modifiers(plane_id);
+               modifiers = gen12_get_plane_modifiers(dev_priv, plane_id);
                plane_funcs = &gen12_plane_funcs;
        } else {
                if (plane->has_ccs)
index cfaf141..19542fd 100644 (file)
@@ -81,13 +81,14 @@ static void rps_enable_interrupts(struct intel_rps *rps)
                events = (GEN6_PM_RP_UP_THRESHOLD |
                          GEN6_PM_RP_DOWN_THRESHOLD |
                          GEN6_PM_RP_DOWN_TIMEOUT);
-
        WRITE_ONCE(rps->pm_events, events);
+
        spin_lock_irq(&gt->irq_lock);
        gen6_gt_pm_enable_irq(gt, rps->pm_events);
        spin_unlock_irq(&gt->irq_lock);
 
-       set(gt->uncore, GEN6_PMINTRMSK, rps_pm_mask(rps, rps->cur_freq));
+       intel_uncore_write(gt->uncore,
+                          GEN6_PMINTRMSK, rps_pm_mask(rps, rps->last_freq));
 }
 
 static void gen6_rps_reset_interrupts(struct intel_rps *rps)
@@ -120,7 +121,9 @@ static void rps_disable_interrupts(struct intel_rps *rps)
        struct intel_gt *gt = rps_to_gt(rps);
 
        WRITE_ONCE(rps->pm_events, 0);
-       set(gt->uncore, GEN6_PMINTRMSK, rps_pm_sanitize_mask(rps, ~0u));
+
+       intel_uncore_write(gt->uncore,
+                          GEN6_PMINTRMSK, rps_pm_sanitize_mask(rps, ~0u));
 
        spin_lock_irq(&gt->irq_lock);
        gen6_gt_pm_disable_irq(gt, GEN6_PM_RPS_EVENTS);
index 074c4ef..eee5304 100644 (file)
@@ -131,6 +131,7 @@ struct kvmgt_vdev {
        struct work_struct release_work;
        atomic_t released;
        struct vfio_device *vfio_device;
+       struct vfio_group *vfio_group;
 };
 
 static inline struct kvmgt_vdev *kvmgt_vdev(struct intel_vgpu *vgpu)
@@ -151,6 +152,7 @@ static void gvt_unpin_guest_page(struct intel_vgpu *vgpu, unsigned long gfn,
                unsigned long size)
 {
        struct drm_i915_private *i915 = vgpu->gvt->gt->i915;
+       struct kvmgt_vdev *vdev = kvmgt_vdev(vgpu);
        int total_pages;
        int npage;
        int ret;
@@ -160,7 +162,7 @@ static void gvt_unpin_guest_page(struct intel_vgpu *vgpu, unsigned long gfn,
        for (npage = 0; npage < total_pages; npage++) {
                unsigned long cur_gfn = gfn + npage;
 
-               ret = vfio_unpin_pages(mdev_dev(kvmgt_vdev(vgpu)->mdev), &cur_gfn, 1);
+               ret = vfio_group_unpin_pages(vdev->vfio_group, &cur_gfn, 1);
                drm_WARN_ON(&i915->drm, ret != 1);
        }
 }
@@ -169,6 +171,7 @@ static void gvt_unpin_guest_page(struct intel_vgpu *vgpu, unsigned long gfn,
 static int gvt_pin_guest_page(struct intel_vgpu *vgpu, unsigned long gfn,
                unsigned long size, struct page **page)
 {
+       struct kvmgt_vdev *vdev = kvmgt_vdev(vgpu);
        unsigned long base_pfn = 0;
        int total_pages;
        int npage;
@@ -183,8 +186,8 @@ static int gvt_pin_guest_page(struct intel_vgpu *vgpu, unsigned long gfn,
                unsigned long cur_gfn = gfn + npage;
                unsigned long pfn;
 
-               ret = vfio_pin_pages(mdev_dev(kvmgt_vdev(vgpu)->mdev), &cur_gfn, 1,
-                                    IOMMU_READ | IOMMU_WRITE, &pfn);
+               ret = vfio_group_pin_pages(vdev->vfio_group, &cur_gfn, 1,
+                                          IOMMU_READ | IOMMU_WRITE, &pfn);
                if (ret != 1) {
                        gvt_vgpu_err("vfio_pin_pages failed for gfn 0x%lx, ret %d\n",
                                     cur_gfn, ret);
@@ -792,6 +795,7 @@ static int intel_vgpu_open(struct mdev_device *mdev)
        struct kvmgt_vdev *vdev = kvmgt_vdev(vgpu);
        unsigned long events;
        int ret;
+       struct vfio_group *vfio_group;
 
        vdev->iommu_notifier.notifier_call = intel_vgpu_iommu_notifier;
        vdev->group_notifier.notifier_call = intel_vgpu_group_notifier;
@@ -814,6 +818,14 @@ static int intel_vgpu_open(struct mdev_device *mdev)
                goto undo_iommu;
        }
 
+       vfio_group = vfio_group_get_external_user_from_dev(mdev_dev(mdev));
+       if (IS_ERR_OR_NULL(vfio_group)) {
+               ret = !vfio_group ? -EFAULT : PTR_ERR(vfio_group);
+               gvt_vgpu_err("vfio_group_get_external_user_from_dev failed\n");
+               goto undo_register;
+       }
+       vdev->vfio_group = vfio_group;
+
        /* Take a module reference as mdev core doesn't take
         * a reference for vendor driver.
         */
@@ -830,6 +842,10 @@ static int intel_vgpu_open(struct mdev_device *mdev)
        return ret;
 
 undo_group:
+       vfio_group_put_external_user(vdev->vfio_group);
+       vdev->vfio_group = NULL;
+
+undo_register:
        vfio_unregister_notifier(mdev_dev(mdev), VFIO_GROUP_NOTIFY,
                                        &vdev->group_notifier);
 
@@ -884,6 +900,7 @@ static void __intel_vgpu_release(struct intel_vgpu *vgpu)
        kvmgt_guest_exit(info);
 
        intel_vgpu_release_msi_eventfd_ctx(vgpu);
+       vfio_group_put_external_user(vdev->vfio_group);
 
        vdev->kvm = NULL;
        vgpu->handle = 0;
@@ -2035,33 +2052,14 @@ static int kvmgt_rw_gpa(unsigned long handle, unsigned long gpa,
                        void *buf, unsigned long len, bool write)
 {
        struct kvmgt_guest_info *info;
-       struct kvm *kvm;
-       int idx, ret;
-       bool kthread = current->mm == NULL;
 
        if (!handle_valid(handle))
                return -ESRCH;
 
        info = (struct kvmgt_guest_info *)handle;
-       kvm = info->kvm;
-
-       if (kthread) {
-               if (!mmget_not_zero(kvm->mm))
-                       return -EFAULT;
-               use_mm(kvm->mm);
-       }
-
-       idx = srcu_read_lock(&kvm->srcu);
-       ret = write ? kvm_write_guest(kvm, gpa, buf, len) :
-                     kvm_read_guest(kvm, gpa, buf, len);
-       srcu_read_unlock(&kvm->srcu, idx);
-
-       if (kthread) {
-               unuse_mm(kvm->mm);
-               mmput(kvm->mm);
-       }
 
-       return ret;
+       return vfio_dma_rw(kvmgt_vdev(info->vgpu)->vfio_group,
+                          gpa, buf, len, write);
 }
 
 static int kvmgt_read_gpa(unsigned long handle, unsigned long gpa,
index 1f5b9a5..62b901f 100644 (file)
@@ -1507,6 +1507,8 @@ IS_SUBPLATFORM(const struct drm_i915_private *i915,
        (IS_ICELAKE(p) && IS_REVID(p, since, until))
 
 #define TGL_REVID_A0           0x0
+#define TGL_REVID_B0           0x1
+#define TGL_REVID_C0           0x2
 
 #define IS_TGL_REVID(p, since, until) \
        (IS_TIGERLAKE(p) && IS_REVID(p, since, until))
index 551be58..66a46e4 100644 (file)
@@ -2940,49 +2940,6 @@ void i915_oa_init_reg_state(const struct intel_context *ce,
                gen8_update_reg_state_unlocked(ce, stream);
 }
 
-/**
- * i915_perf_read_locked - &i915_perf_stream_ops->read with error normalisation
- * @stream: An i915 perf stream
- * @file: An i915 perf stream file
- * @buf: destination buffer given by userspace
- * @count: the number of bytes userspace wants to read
- * @ppos: (inout) file seek position (unused)
- *
- * Besides wrapping &i915_perf_stream_ops->read this provides a common place to
- * ensure that if we've successfully copied any data then reporting that takes
- * precedence over any internal error status, so the data isn't lost.
- *
- * For example ret will be -ENOSPC whenever there is more buffered data than
- * can be copied to userspace, but that's only interesting if we weren't able
- * to copy some data because it implies the userspace buffer is too small to
- * receive a single record (and we never split records).
- *
- * Another case with ret == -EFAULT is more of a grey area since it would seem
- * like bad form for userspace to ask us to overrun its buffer, but the user
- * knows best:
- *
- *   http://yarchive.net/comp/linux/partial_reads_writes.html
- *
- * Returns: The number of bytes copied or a negative error code on failure.
- */
-static ssize_t i915_perf_read_locked(struct i915_perf_stream *stream,
-                                    struct file *file,
-                                    char __user *buf,
-                                    size_t count,
-                                    loff_t *ppos)
-{
-       /* Note we keep the offset (aka bytes read) separate from any
-        * error status so that the final check for whether we return
-        * the bytes read with a higher precedence than any error (see
-        * comment below) doesn't need to be handled/duplicated in
-        * stream->ops->read() implementations.
-        */
-       size_t offset = 0;
-       int ret = stream->ops->read(stream, buf, count, &offset);
-
-       return offset ?: (ret ?: -EAGAIN);
-}
-
 /**
  * i915_perf_read - handles read() FOP for i915 perf stream FDs
  * @file: An i915 perf stream file
@@ -3008,7 +2965,8 @@ static ssize_t i915_perf_read(struct file *file,
 {
        struct i915_perf_stream *stream = file->private_data;
        struct i915_perf *perf = stream->perf;
-       ssize_t ret;
+       size_t offset = 0;
+       int ret;
 
        /* To ensure it's handled consistently we simply treat all reads of a
         * disabled stream as an error. In particular it might otherwise lead
@@ -3031,13 +2989,12 @@ static ssize_t i915_perf_read(struct file *file,
                                return ret;
 
                        mutex_lock(&perf->lock);
-                       ret = i915_perf_read_locked(stream, file,
-                                                   buf, count, ppos);
+                       ret = stream->ops->read(stream, buf, count, &offset);
                        mutex_unlock(&perf->lock);
-               } while (ret == -EAGAIN);
+               } while (!offset && !ret);
        } else {
                mutex_lock(&perf->lock);
-               ret = i915_perf_read_locked(stream, file, buf, count, ppos);
+               ret = stream->ops->read(stream, buf, count, &offset);
                mutex_unlock(&perf->lock);
        }
 
@@ -3048,15 +3005,15 @@ static ssize_t i915_perf_read(struct file *file,
         * and read() returning -EAGAIN. Clearing the oa.pollin state here
         * effectively ensures we back off until the next hrtimer callback
         * before reporting another EPOLLIN event.
+        * The exception to this is if ops->read() returned -ENOSPC which means
+        * that more OA data is available than could fit in the user provided
+        * buffer. In this case we want the next poll() call to not block.
         */
-       if (ret >= 0 || ret == -EAGAIN) {
-               /* Maybe make ->pollin per-stream state if we support multiple
-                * concurrent streams in the future.
-                */
+       if (ret != -ENOSPC)
                stream->pollin = false;
-       }
 
-       return ret;
+       /* Possible values for ret are 0, -EFAULT, -ENOSPC, -EIO, ... */
+       return offset ?: (ret ?: -EAGAIN);
 }
 
 static enum hrtimer_restart oa_poll_check_timer_cb(struct hrtimer *hrtimer)
index 59e64ac..e0c6021 100644 (file)
@@ -34,8 +34,8 @@
  * Follow the style described here for new macros, and while changing existing
  * macros. Do **not** mass change existing definitions just to update the style.
  *
- * Layout
- * ~~~~~~
+ * File Layout
+ * ~~~~~~~~~~~
  *
  * Keep helper macros near the top. For example, _PIPE() and friends.
  *
index e8c9491..64cb6ba 100644 (file)
@@ -1034,10 +1034,8 @@ static int meson_dw_hdmi_bind(struct device *dev, struct device *master,
                return PTR_ERR(dw_plat_data->regm);
 
        irq = platform_get_irq(pdev, 0);
-       if (irq < 0) {
-               dev_err(dev, "Failed to get hdmi top irq\n");
+       if (irq < 0)
                return irq;
-       }
 
        ret = devm_request_threaded_irq(dev, irq, dw_hdmi_top_irq,
                                        dw_hdmi_top_thread_irq, IRQF_SHARED,
index 232a9d7..e770c94 100644 (file)
@@ -25,6 +25,9 @@
 MODULE_FIRMWARE("nvidia/gp108/sec2/desc.bin");
 MODULE_FIRMWARE("nvidia/gp108/sec2/image.bin");
 MODULE_FIRMWARE("nvidia/gp108/sec2/sig.bin");
+MODULE_FIRMWARE("nvidia/gv100/sec2/desc.bin");
+MODULE_FIRMWARE("nvidia/gv100/sec2/image.bin");
+MODULE_FIRMWARE("nvidia/gv100/sec2/sig.bin");
 
 static const struct nvkm_sec2_fwif
 gp108_sec2_fwif[] = {
index b6ebd95..a829565 100644 (file)
@@ -56,6 +56,22 @@ tu102_sec2_nofw(struct nvkm_sec2 *sec2, int ver,
        return 0;
 }
 
+MODULE_FIRMWARE("nvidia/tu102/sec2/desc.bin");
+MODULE_FIRMWARE("nvidia/tu102/sec2/image.bin");
+MODULE_FIRMWARE("nvidia/tu102/sec2/sig.bin");
+MODULE_FIRMWARE("nvidia/tu104/sec2/desc.bin");
+MODULE_FIRMWARE("nvidia/tu104/sec2/image.bin");
+MODULE_FIRMWARE("nvidia/tu104/sec2/sig.bin");
+MODULE_FIRMWARE("nvidia/tu106/sec2/desc.bin");
+MODULE_FIRMWARE("nvidia/tu106/sec2/image.bin");
+MODULE_FIRMWARE("nvidia/tu106/sec2/sig.bin");
+MODULE_FIRMWARE("nvidia/tu116/sec2/desc.bin");
+MODULE_FIRMWARE("nvidia/tu116/sec2/image.bin");
+MODULE_FIRMWARE("nvidia/tu116/sec2/sig.bin");
+MODULE_FIRMWARE("nvidia/tu117/sec2/desc.bin");
+MODULE_FIRMWARE("nvidia/tu117/sec2/image.bin");
+MODULE_FIRMWARE("nvidia/tu117/sec2/sig.bin");
+
 static const struct nvkm_sec2_fwif
 tu102_sec2_fwif[] = {
        {  0, gp102_sec2_load, &tu102_sec2, &gp102_sec2_acr_1 },
index 8e731ed..2f31910 100644 (file)
@@ -676,7 +676,7 @@ drm_sched_get_cleanup_job(struct drm_gpu_scheduler *sched)
         */
        if ((sched->timeout != MAX_SCHEDULE_TIMEOUT &&
            !cancel_delayed_work(&sched->work_tdr)) ||
-           __kthread_should_park(sched->thread))
+           kthread_should_park())
                return NULL;
 
        spin_lock(&sched->job_list_lock);
index d4ce9ba..3221a70 100644 (file)
@@ -379,9 +379,17 @@ static struct drm_crtc_state *tidss_crtc_duplicate_state(struct drm_crtc *crtc)
        return &state->base;
 }
 
+static void tidss_crtc_destroy(struct drm_crtc *crtc)
+{
+       struct tidss_crtc *tcrtc = to_tidss_crtc(crtc);
+
+       drm_crtc_cleanup(crtc);
+       kfree(tcrtc);
+}
+
 static const struct drm_crtc_funcs tidss_crtc_funcs = {
        .reset = tidss_crtc_reset,
-       .destroy = drm_crtc_cleanup,
+       .destroy = tidss_crtc_destroy,
        .set_config = drm_atomic_helper_set_config,
        .page_flip = drm_atomic_helper_page_flip,
        .atomic_duplicate_state = tidss_crtc_duplicate_state,
@@ -400,7 +408,7 @@ struct tidss_crtc *tidss_crtc_create(struct tidss_device *tidss,
        bool has_ctm = tidss->feat->vp_feat.color.has_ctm;
        int ret;
 
-       tcrtc = devm_kzalloc(tidss->dev, sizeof(*tcrtc), GFP_KERNEL);
+       tcrtc = kzalloc(sizeof(*tcrtc), GFP_KERNEL);
        if (!tcrtc)
                return ERR_PTR(-ENOMEM);
 
@@ -411,8 +419,10 @@ struct tidss_crtc *tidss_crtc_create(struct tidss_device *tidss,
 
        ret = drm_crtc_init_with_planes(&tidss->ddev, crtc, primary,
                                        NULL, &tidss_crtc_funcs, NULL);
-       if (ret < 0)
+       if (ret < 0) {
+               kfree(tcrtc);
                return ERR_PTR(ret);
+       }
 
        drm_crtc_helper_add(crtc, &tidss_crtc_helper_funcs);
 
index 83785b0..30bf2a6 100644 (file)
@@ -55,12 +55,18 @@ static int tidss_encoder_atomic_check(struct drm_encoder *encoder,
        return 0;
 }
 
+static void tidss_encoder_destroy(struct drm_encoder *encoder)
+{
+       drm_encoder_cleanup(encoder);
+       kfree(encoder);
+}
+
 static const struct drm_encoder_helper_funcs encoder_helper_funcs = {
        .atomic_check = tidss_encoder_atomic_check,
 };
 
 static const struct drm_encoder_funcs encoder_funcs = {
-       .destroy = drm_encoder_cleanup,
+       .destroy = tidss_encoder_destroy,
 };
 
 struct drm_encoder *tidss_encoder_create(struct tidss_device *tidss,
@@ -69,7 +75,7 @@ struct drm_encoder *tidss_encoder_create(struct tidss_device *tidss,
        struct drm_encoder *enc;
        int ret;
 
-       enc = devm_kzalloc(tidss->dev, sizeof(*enc), GFP_KERNEL);
+       enc = kzalloc(sizeof(*enc), GFP_KERNEL);
        if (!enc)
                return ERR_PTR(-ENOMEM);
 
@@ -77,8 +83,10 @@ struct drm_encoder *tidss_encoder_create(struct tidss_device *tidss,
 
        ret = drm_encoder_init(&tidss->ddev, enc, &encoder_funcs,
                               encoder_type, NULL);
-       if (ret < 0)
+       if (ret < 0) {
+               kfree(enc);
                return ERR_PTR(ret);
+       }
 
        drm_encoder_helper_add(enc, &encoder_helper_funcs);
 
index ff99b2d..7984889 100644 (file)
@@ -141,6 +141,14 @@ static void tidss_plane_atomic_disable(struct drm_plane *plane,
        dispc_plane_enable(tidss->dispc, tplane->hw_plane_id, false);
 }
 
+static void drm_plane_destroy(struct drm_plane *plane)
+{
+       struct tidss_plane *tplane = to_tidss_plane(plane);
+
+       drm_plane_cleanup(plane);
+       kfree(tplane);
+}
+
 static const struct drm_plane_helper_funcs tidss_plane_helper_funcs = {
        .atomic_check = tidss_plane_atomic_check,
        .atomic_update = tidss_plane_atomic_update,
@@ -151,7 +159,7 @@ static const struct drm_plane_funcs tidss_plane_funcs = {
        .update_plane = drm_atomic_helper_update_plane,
        .disable_plane = drm_atomic_helper_disable_plane,
        .reset = drm_atomic_helper_plane_reset,
-       .destroy = drm_plane_cleanup,
+       .destroy = drm_plane_destroy,
        .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
        .atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
 };
@@ -175,7 +183,7 @@ struct tidss_plane *tidss_plane_create(struct tidss_device *tidss,
                           BIT(DRM_MODE_BLEND_COVERAGE));
        int ret;
 
-       tplane = devm_kzalloc(tidss->dev, sizeof(*tplane), GFP_KERNEL);
+       tplane = kzalloc(sizeof(*tplane), GFP_KERNEL);
        if (!tplane)
                return ERR_PTR(-ENOMEM);
 
@@ -190,7 +198,7 @@ struct tidss_plane *tidss_plane_create(struct tidss_device *tidss,
                                       formats, num_formats,
                                       NULL, type, NULL);
        if (ret < 0)
-               return ERR_PTR(ret);
+               goto err;
 
        drm_plane_helper_add(&tplane->plane, &tidss_plane_helper_funcs);
 
@@ -203,15 +211,19 @@ struct tidss_plane *tidss_plane_create(struct tidss_device *tidss,
                                                default_encoding,
                                                default_range);
        if (ret)
-               return ERR_PTR(ret);
+               goto err;
 
        ret = drm_plane_create_alpha_property(&tplane->plane);
        if (ret)
-               return ERR_PTR(ret);
+               goto err;
 
        ret = drm_plane_create_blend_mode_property(&tplane->plane, blend_modes);
        if (ret)
-               return ERR_PTR(ret);
+               goto err;
 
        return tplane;
+
+err:
+       kfree(tplane);
+       return ERR_PTR(ret);
 }
index 336cc91..3f60bf2 100644 (file)
@@ -27,6 +27,7 @@
 
 #include <linux/file.h>
 #include <linux/sync_file.h>
+#include <linux/uaccess.h>
 
 #include <drm/drm_file.h>
 #include <drm/virtgpu_drm.h>
index 023a030..f4ea4ce 100644 (file)
@@ -25,6 +25,7 @@
 
 #include <linux/virtio.h>
 #include <linux/virtio_config.h>
+#include <linux/virtio_ring.h>
 
 #include <drm/drm_file.h>
 
index 05a3083..4c62f90 100644 (file)
@@ -412,7 +412,7 @@ config SENSORS_DRIVETEMP
          hard disk drives.
 
          This driver can also be built as a module. If so, the module
-         will be called satatemp.
+         will be called drivetemp.
 
 config SENSORS_DS620
        tristate "Dallas Semiconductor DS620"
index 370d0c7..9179460 100644 (file)
@@ -264,12 +264,18 @@ static int drivetemp_get_scttemp(struct drivetemp_data *st, u32 attr, long *val)
                return err;
        switch (attr) {
        case hwmon_temp_input:
+               if (!temp_is_valid(buf[SCT_STATUS_TEMP]))
+                       return -ENODATA;
                *val = temp_from_sct(buf[SCT_STATUS_TEMP]);
                break;
        case hwmon_temp_lowest:
+               if (!temp_is_valid(buf[SCT_STATUS_TEMP_LOWEST]))
+                       return -ENODATA;
                *val = temp_from_sct(buf[SCT_STATUS_TEMP_LOWEST]);
                break;
        case hwmon_temp_highest:
+               if (!temp_is_valid(buf[SCT_STATUS_TEMP_HIGHEST]))
+                       return -ENODATA;
                *val = temp_from_sct(buf[SCT_STATUS_TEMP_HIGHEST]);
                break;
        default:
index f2d81b0..e3f1ebe 100644 (file)
@@ -506,7 +506,7 @@ static int jc42_probe(struct i2c_client *client, const struct i2c_device_id *id)
        }
        data->config = config;
 
-       hwmon_dev = devm_hwmon_device_register_with_info(dev, client->name,
+       hwmon_dev = devm_hwmon_device_register_with_info(dev, "jc42",
                                                         data, &jc42_chip_info,
                                                         NULL);
        return PTR_ERR_OR_ZERO(hwmon_dev);
index 3f37d5d..9915578 100644 (file)
@@ -186,7 +186,7 @@ static long get_raw_temp(struct k10temp_data *data)
        return temp;
 }
 
-const char *k10temp_temp_label[] = {
+static const char *k10temp_temp_label[] = {
        "Tctl",
        "Tdie",
        "Tccd1",
@@ -199,12 +199,12 @@ const char *k10temp_temp_label[] = {
        "Tccd8",
 };
 
-const char *k10temp_in_label[] = {
+static const char *k10temp_in_label[] = {
        "Vcore",
        "Vsoc",
 };
 
-const char *k10temp_curr_label[] = {
+static const char *k10temp_curr_label[] = {
        "Icore",
        "Isoc",
 };
index 4d23152..0c62271 100644 (file)
 #define ISL68137_VOUT_AVS      0x30
 #define RAA_DMPVR2_READ_VMON   0xc8
 
-enum versions {
+enum chips {
        isl68137,
+       isl68220,
+       isl68221,
+       isl68222,
+       isl68223,
+       isl68224,
+       isl68225,
+       isl68226,
+       isl68227,
+       isl68229,
+       isl68233,
+       isl68239,
+       isl69222,
+       isl69223,
+       isl69224,
+       isl69225,
+       isl69227,
+       isl69228,
+       isl69234,
+       isl69236,
+       isl69239,
+       isl69242,
+       isl69243,
+       isl69247,
+       isl69248,
+       isl69254,
+       isl69255,
+       isl69256,
+       isl69259,
+       isl69260,
+       isl69268,
+       isl69269,
+       isl69298,
+       raa228000,
+       raa228004,
+       raa228006,
+       raa228228,
+       raa229001,
+       raa229004,
+};
+
+enum variants {
+       raa_dmpvr1_2rail,
        raa_dmpvr2_1rail,
        raa_dmpvr2_2rail,
        raa_dmpvr2_3rail,
@@ -186,7 +228,7 @@ static int isl68137_probe(struct i2c_client *client,
        memcpy(info, &raa_dmpvr_info, sizeof(*info));
 
        switch (id->driver_data) {
-       case isl68137:
+       case raa_dmpvr1_2rail:
                info->pages = 2;
                info->R[PSC_VOLTAGE_IN] = 3;
                info->func[0] &= ~PMBUS_HAVE_VMON;
@@ -224,11 +266,47 @@ static int isl68137_probe(struct i2c_client *client,
 }
 
 static const struct i2c_device_id raa_dmpvr_id[] = {
-       {"isl68137", isl68137},
-       {"raa_dmpvr2_1rail", raa_dmpvr2_1rail},
-       {"raa_dmpvr2_2rail", raa_dmpvr2_2rail},
-       {"raa_dmpvr2_3rail", raa_dmpvr2_3rail},
-       {"raa_dmpvr2_hv", raa_dmpvr2_hv},
+       {"isl68137", raa_dmpvr1_2rail},
+       {"isl68220", raa_dmpvr2_2rail},
+       {"isl68221", raa_dmpvr2_3rail},
+       {"isl68222", raa_dmpvr2_2rail},
+       {"isl68223", raa_dmpvr2_2rail},
+       {"isl68224", raa_dmpvr2_3rail},
+       {"isl68225", raa_dmpvr2_2rail},
+       {"isl68226", raa_dmpvr2_3rail},
+       {"isl68227", raa_dmpvr2_1rail},
+       {"isl68229", raa_dmpvr2_3rail},
+       {"isl68233", raa_dmpvr2_2rail},
+       {"isl68239", raa_dmpvr2_3rail},
+
+       {"isl69222", raa_dmpvr2_2rail},
+       {"isl69223", raa_dmpvr2_3rail},
+       {"isl69224", raa_dmpvr2_2rail},
+       {"isl69225", raa_dmpvr2_2rail},
+       {"isl69227", raa_dmpvr2_3rail},
+       {"isl69228", raa_dmpvr2_3rail},
+       {"isl69234", raa_dmpvr2_2rail},
+       {"isl69236", raa_dmpvr2_2rail},
+       {"isl69239", raa_dmpvr2_3rail},
+       {"isl69242", raa_dmpvr2_2rail},
+       {"isl69243", raa_dmpvr2_1rail},
+       {"isl69247", raa_dmpvr2_2rail},
+       {"isl69248", raa_dmpvr2_2rail},
+       {"isl69254", raa_dmpvr2_2rail},
+       {"isl69255", raa_dmpvr2_2rail},
+       {"isl69256", raa_dmpvr2_2rail},
+       {"isl69259", raa_dmpvr2_2rail},
+       {"isl69260", raa_dmpvr2_2rail},
+       {"isl69268", raa_dmpvr2_2rail},
+       {"isl69269", raa_dmpvr2_3rail},
+       {"isl69298", raa_dmpvr2_2rail},
+
+       {"raa228000", raa_dmpvr2_hv},
+       {"raa228004", raa_dmpvr2_hv},
+       {"raa228006", raa_dmpvr2_hv},
+       {"raa228228", raa_dmpvr2_2rail},
+       {"raa229001", raa_dmpvr2_2rail},
+       {"raa229004", raa_dmpvr2_2rail},
        {}
 };
 
index 20ef638..f5c00f9 100644 (file)
@@ -384,7 +384,6 @@ static int altr_i2c_probe(struct platform_device *pdev)
        struct altr_i2c_dev *idev = NULL;
        struct resource *res;
        int irq, ret;
-       u32 val;
 
        idev = devm_kzalloc(&pdev->dev, sizeof(*idev), GFP_KERNEL);
        if (!idev)
@@ -411,17 +410,17 @@ static int altr_i2c_probe(struct platform_device *pdev)
        init_completion(&idev->msg_complete);
        spin_lock_init(&idev->lock);
 
-       val = device_property_read_u32(idev->dev, "fifo-size",
+       ret = device_property_read_u32(idev->dev, "fifo-size",
                                       &idev->fifo_size);
-       if (val) {
+       if (ret) {
                dev_err(&pdev->dev, "FIFO size set to default of %d\n",
                        ALTR_I2C_DFLT_FIFO_SZ);
                idev->fifo_size = ALTR_I2C_DFLT_FIFO_SZ;
        }
 
-       val = device_property_read_u32(idev->dev, "clock-frequency",
+       ret = device_property_read_u32(idev->dev, "clock-frequency",
                                       &idev->bus_clk_rate);
-       if (val) {
+       if (ret) {
                dev_err(&pdev->dev, "Default to 100kHz\n");
                idev->bus_clk_rate = I2C_MAX_STANDARD_MODE_FREQ;        /* default clock rate */
        }
index c98befe..5536673 100644 (file)
@@ -354,10 +354,16 @@ static int dw_i2c_plat_probe(struct platform_device *pdev)
        adap->dev.of_node = pdev->dev.of_node;
        adap->nr = -1;
 
-       dev_pm_set_driver_flags(&pdev->dev,
-                               DPM_FLAG_SMART_PREPARE |
-                               DPM_FLAG_SMART_SUSPEND |
-                               DPM_FLAG_LEAVE_SUSPENDED);
+       if (dev->flags & ACCESS_NO_IRQ_SUSPEND) {
+               dev_pm_set_driver_flags(&pdev->dev,
+                                       DPM_FLAG_SMART_PREPARE |
+                                       DPM_FLAG_LEAVE_SUSPENDED);
+       } else {
+               dev_pm_set_driver_flags(&pdev->dev,
+                                       DPM_FLAG_SMART_PREPARE |
+                                       DPM_FLAG_SMART_SUSPEND |
+                                       DPM_FLAG_LEAVE_SUSPENDED);
+       }
 
        /* The code below assumes runtime PM to be disabled. */
        WARN_ON(pm_runtime_enabled(&pdev->dev));
index 4c4d17d..8280ac7 100644 (file)
@@ -996,14 +996,13 @@ tegra_i2c_poll_completion_timeout(struct tegra_i2c_dev *i2c_dev,
        do {
                u32 status = i2c_readl(i2c_dev, I2C_INT_STATUS);
 
-               if (status) {
+               if (status)
                        tegra_i2c_isr(i2c_dev->irq, i2c_dev);
 
-                       if (completion_done(complete)) {
-                               s64 delta = ktime_ms_delta(ktimeout, ktime);
+               if (completion_done(complete)) {
+                       s64 delta = ktime_ms_delta(ktimeout, ktime);
 
-                               return msecs_to_jiffies(delta) ?: 1;
-                       }
+                       return msecs_to_jiffies(delta) ?: 1;
                }
 
                ktime = ktime_get();
@@ -1030,14 +1029,18 @@ tegra_i2c_wait_completion_timeout(struct tegra_i2c_dev *i2c_dev,
                disable_irq(i2c_dev->irq);
 
                /*
-                * There is a chance that completion may happen after IRQ
-                * synchronization, which is done by disable_irq().
+                * Under some rare circumstances (like running KASAN +
+                * NFS root) CPU, which handles interrupt, may stuck in
+                * uninterruptible state for a significant time.  In this
+                * case we will get timeout if I2C transfer is running on
+                * a sibling CPU, despite of IRQ being raised.
+                *
+                * In order to handle this rare condition, the IRQ status
+                * needs to be checked after timeout.
                 */
-               if (ret == 0 && completion_done(complete)) {
-                       dev_warn(i2c_dev->dev,
-                                "completion done after timeout\n");
-                       ret = 1;
-               }
+               if (ret == 0)
+                       ret = tegra_i2c_poll_completion_timeout(i2c_dev,
+                                                               complete, 0);
        }
 
        return ret;
@@ -1216,6 +1219,15 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev,
                time_left = tegra_i2c_wait_completion_timeout(
                                i2c_dev, &i2c_dev->dma_complete, xfer_time);
 
+               /*
+                * Synchronize DMA first, since dmaengine_terminate_sync()
+                * performs synchronization after the transfer's termination
+                * and we want to get a completion if transfer succeeded.
+                */
+               dmaengine_synchronize(i2c_dev->msg_read ?
+                                     i2c_dev->rx_dma_chan :
+                                     i2c_dev->tx_dma_chan);
+
                dmaengine_terminate_sync(i2c_dev->msg_read ?
                                         i2c_dev->rx_dma_chan :
                                         i2c_dev->tx_dma_chan);
index 5cc0b0e..a669127 100644 (file)
@@ -2273,19 +2273,6 @@ i2c_new_scanned_device(struct i2c_adapter *adap,
 }
 EXPORT_SYMBOL_GPL(i2c_new_scanned_device);
 
-struct i2c_client *
-i2c_new_probed_device(struct i2c_adapter *adap,
-                     struct i2c_board_info *info,
-                     unsigned short const *addr_list,
-                     int (*probe)(struct i2c_adapter *adap, unsigned short addr))
-{
-       struct i2c_client *client;
-
-       client = i2c_new_scanned_device(adap, info, addr_list, probe);
-       return IS_ERR(client) ? NULL : client;
-}
-EXPORT_SYMBOL_GPL(i2c_new_probed_device);
-
 struct i2c_adapter *i2c_get_adapter(int nr)
 {
        struct i2c_adapter *adapter;
index eb9bce9..fd7c537 100644 (file)
@@ -416,7 +416,7 @@ static const struct irq_domain_ops bcm7038_l1_domain_ops = {
        .map                    = bcm7038_l1_map,
 };
 
-int __init bcm7038_l1_of_init(struct device_node *dn,
+static int __init bcm7038_l1_of_init(struct device_node *dn,
                              struct device_node *parent)
 {
        struct bcm7038_l1_chip *intc;
index 54d142c..124251b 100644 (file)
@@ -14,6 +14,7 @@
 #include <linux/dma-iommu.h>
 #include <linux/efi.h>
 #include <linux/interrupt.h>
+#include <linux/iopoll.h>
 #include <linux/irqdomain.h>
 #include <linux/list.h>
 #include <linux/log2.h>
@@ -3672,6 +3673,20 @@ out:
        return IRQ_SET_MASK_OK_DONE;
 }
 
+static void its_wait_vpt_parse_complete(void)
+{
+       void __iomem *vlpi_base = gic_data_rdist_vlpi_base();
+       u64 val;
+
+       if (!gic_rdists->has_vpend_valid_dirty)
+               return;
+
+       WARN_ON_ONCE(readq_relaxed_poll_timeout(vlpi_base + GICR_VPENDBASER,
+                                               val,
+                                               !(val & GICR_VPENDBASER_Dirty),
+                                               10, 500));
+}
+
 static void its_vpe_schedule(struct its_vpe *vpe)
 {
        void __iomem *vlpi_base = gic_data_rdist_vlpi_base();
@@ -3702,6 +3717,8 @@ static void its_vpe_schedule(struct its_vpe *vpe)
        val |= vpe->idai ? GICR_VPENDBASER_IDAI : 0;
        val |= GICR_VPENDBASER_Valid;
        gicr_write_vpendbaser(val, vlpi_base + GICR_VPENDBASER);
+
+       its_wait_vpt_parse_complete();
 }
 
 static void its_vpe_deschedule(struct its_vpe *vpe)
@@ -3910,6 +3927,8 @@ static void its_vpe_4_1_schedule(struct its_vpe *vpe,
        val |= FIELD_PREP(GICR_VPENDBASER_4_1_VPEID, vpe->vpe_id);
 
        gicr_write_vpendbaser(val, vlpi_base + GICR_VPENDBASER);
+
+       its_wait_vpt_parse_complete();
 }
 
 static void its_vpe_4_1_deschedule(struct its_vpe *vpe,
@@ -4035,6 +4054,7 @@ static int its_sgi_set_affinity(struct irq_data *d,
         * not on the host (since they can only be targetting a vPE).
         * Tell the kernel we've done whatever it asked for.
         */
+       irq_data_update_effective_affinity(d, mask_val);
        return IRQ_SET_MASK_OK;
 }
 
index 9dbc81b..d7006ef 100644 (file)
@@ -873,6 +873,7 @@ static int __gic_update_rdist_properties(struct redist_region *region,
        gic_data.rdists.has_rvpeid &= !!(typer & GICR_TYPER_RVPEID);
        gic_data.rdists.has_direct_lpi &= (!!(typer & GICR_TYPER_DirectLPIS) |
                                           gic_data.rdists.has_rvpeid);
+       gic_data.rdists.has_vpend_valid_dirty &= !!(typer & GICR_TYPER_DIRTY);
 
        /* Detect non-sensical configurations */
        if (WARN_ON_ONCE(gic_data.rdists.has_rvpeid && !gic_data.rdists.has_vlpis)) {
@@ -893,10 +894,11 @@ static void gic_update_rdist_properties(void)
        if (WARN_ON(gic_data.ppi_nr == UINT_MAX))
                gic_data.ppi_nr = 0;
        pr_info("%d PPIs implemented\n", gic_data.ppi_nr);
-       pr_info("%sVLPI support, %sdirect LPI support, %sRVPEID support\n",
-               !gic_data.rdists.has_vlpis ? "no " : "",
-               !gic_data.rdists.has_direct_lpi ? "no " : "",
-               !gic_data.rdists.has_rvpeid ? "no " : "");
+       if (gic_data.rdists.has_vlpis)
+               pr_info("GICv4 features: %s%s%s\n",
+                       gic_data.rdists.has_direct_lpi ? "DirectLPI " : "",
+                       gic_data.rdists.has_rvpeid ? "RVPEID " : "",
+                       gic_data.rdists.has_vpend_valid_dirty ? "Valid+Dirty " : "");
 }
 
 /* Check whether it's single security state view */
@@ -1620,6 +1622,7 @@ static int __init gic_init_bases(void __iomem *dist_base,
        gic_data.rdists.has_rvpeid = true;
        gic_data.rdists.has_vlpis = true;
        gic_data.rdists.has_direct_lpi = true;
+       gic_data.rdists.has_vpend_valid_dirty = true;
 
        if (WARN_ON(!gic_data.domain) || WARN_ON(!gic_data.rdists.rdist)) {
                err = -ENOMEM;
index 6b566bb..ff7627b 100644 (file)
@@ -220,10 +220,16 @@ static int mbigen_irq_domain_alloc(struct irq_domain *domain,
        return 0;
 }
 
+static void mbigen_irq_domain_free(struct irq_domain *domain, unsigned int virq,
+                                  unsigned int nr_irqs)
+{
+       platform_msi_domain_free(domain, virq, nr_irqs);
+}
+
 static const struct irq_domain_ops mbigen_domain_ops = {
        .translate      = mbigen_domain_translate,
        .alloc          = mbigen_irq_domain_alloc,
-       .free           = irq_domain_free_irqs_common,
+       .free           = mbigen_irq_domain_free,
 };
 
 static int mbigen_of_create_domain(struct platform_device *pdev,
index ccc7f82..bc7aebc 100644 (file)
@@ -144,12 +144,17 @@ struct meson_gpio_irq_controller {
 static void meson_gpio_irq_update_bits(struct meson_gpio_irq_controller *ctl,
                                       unsigned int reg, u32 mask, u32 val)
 {
+       unsigned long flags;
        u32 tmp;
 
+       spin_lock_irqsave(&ctl->lock, flags);
+
        tmp = readl_relaxed(ctl->base + reg);
        tmp &= ~mask;
        tmp |= val;
        writel_relaxed(tmp, ctl->base + reg);
+
+       spin_unlock_irqrestore(&ctl->lock, flags);
 }
 
 static void meson_gpio_irq_init_dummy(struct meson_gpio_irq_controller *ctl)
@@ -196,14 +201,15 @@ meson_gpio_irq_request_channel(struct meson_gpio_irq_controller *ctl,
                               unsigned long  hwirq,
                               u32 **channel_hwirq)
 {
+       unsigned long flags;
        unsigned int idx;
 
-       spin_lock(&ctl->lock);
+       spin_lock_irqsave(&ctl->lock, flags);
 
        /* Find a free channel */
        idx = find_first_zero_bit(ctl->channel_map, NUM_CHANNEL);
        if (idx >= NUM_CHANNEL) {
-               spin_unlock(&ctl->lock);
+               spin_unlock_irqrestore(&ctl->lock, flags);
                pr_err("No channel available\n");
                return -ENOSPC;
        }
@@ -211,6 +217,8 @@ meson_gpio_irq_request_channel(struct meson_gpio_irq_controller *ctl,
        /* Mark the channel as used */
        set_bit(idx, ctl->channel_map);
 
+       spin_unlock_irqrestore(&ctl->lock, flags);
+
        /*
         * Setup the mux of the channel to route the signal of the pad
         * to the appropriate input of the GIC
@@ -225,8 +233,6 @@ meson_gpio_irq_request_channel(struct meson_gpio_irq_controller *ctl,
         */
        *channel_hwirq = &(ctl->channel_irqs[idx]);
 
-       spin_unlock(&ctl->lock);
-
        pr_debug("hwirq %lu assigned to channel %d - irq %u\n",
                 hwirq, idx, **channel_hwirq);
 
@@ -287,13 +293,9 @@ static int meson_gpio_irq_type_setup(struct meson_gpio_irq_controller *ctl,
                        val |= REG_EDGE_POL_LOW(params, idx);
        }
 
-       spin_lock(&ctl->lock);
-
        meson_gpio_irq_update_bits(ctl, REG_EDGE_POL,
                                   REG_EDGE_POL_MASK(params, idx), val);
 
-       spin_unlock(&ctl->lock);
-
        return 0;
 }
 
index 547045d..91adf77 100644 (file)
@@ -66,7 +66,7 @@ struct mvebu_icu_irq_data {
        unsigned int type;
 };
 
-DEFINE_STATIC_KEY_FALSE(legacy_bindings);
+static DEFINE_STATIC_KEY_FALSE(legacy_bindings);
 
 static void mvebu_icu_init(struct mvebu_icu *icu,
                           struct mvebu_icu_msi_data *msi_data,
index c34fb3a..d0a71fe 100644 (file)
@@ -56,7 +56,7 @@
 #define     CONTEXT_THRESHOLD          0x00
 #define     CONTEXT_CLAIM              0x04
 
-#define        PLIC_DISABLE_THRESHOLD          0xf
+#define        PLIC_DISABLE_THRESHOLD          0x7
 #define        PLIC_ENABLE_THRESHOLD           0
 
 struct plic_priv {
index 8f6e6b0..7e3ebf6 100644 (file)
@@ -37,6 +37,7 @@
 #define VINT_ENABLE_SET_OFFSET 0x0
 #define VINT_ENABLE_CLR_OFFSET 0x8
 #define VINT_STATUS_OFFSET     0x18
+#define VINT_STATUS_MASKED_OFFSET      0x20
 
 /**
  * struct ti_sci_inta_event_desc - Description of an event coming to
@@ -116,7 +117,7 @@ static void ti_sci_inta_irq_handler(struct irq_desc *desc)
        chained_irq_enter(irq_desc_get_chip(desc), desc);
 
        val = readq_relaxed(inta->base + vint_desc->vint_id * 0x1000 +
-                           VINT_STATUS_OFFSET);
+                           VINT_STATUS_MASKED_OFFSET);
 
        for_each_set_bit(bit, &val, MAX_EVENTS_PER_VINT) {
                virq = irq_find_mapping(domain, vint_desc->events[bit].hwirq);
index 8f201d0..3bfe72c 100644 (file)
@@ -116,7 +116,7 @@ config MIC_COSM
 
 config VOP
        tristate "VOP Driver"
-       depends on VOP_BUS
+       depends on VOP_BUS && VHOST_DPN
        select VHOST_RING
        select VIRTIO
        help
index 7ddb742..6539238 100644 (file)
@@ -18,3 +18,5 @@ spi-nor-objs                  += winbond.o
 spi-nor-objs                   += xilinx.o
 spi-nor-objs                   += xmc.o
 obj-$(CONFIG_MTD_SPI_NOR)      += spi-nor.o
+
+obj-$(CONFIG_MTD_SPI_NOR)      += controllers/
index 9db0570..661c25e 100644 (file)
@@ -50,7 +50,7 @@ config CAIF_HSI
 
 config CAIF_VIRTIO
        tristate "CAIF virtio transport driver"
-       depends on CAIF && HAS_DMA
+       depends on CAIF && HAS_DMA && VHOST_DPN
        select VHOST_RING
        select VIRTIO
        select GENERIC_ALLOCATOR
index c9219fd..50bbe0e 100644 (file)
@@ -261,6 +261,8 @@ static struct property *dup_and_fixup_symbol_prop(
 
        of_property_set_flag(new_prop, OF_DYNAMIC);
 
+       kfree(target_path);
+
        return new_prop;
 
 err_free_new_prop:
index c190da5..6327d1f 100644 (file)
@@ -3,22 +3,37 @@
 /plugin/;
 
 /*
- * &electric_1/motor-1 and &spin_ctrl_1 are the same node:
- *   /testcase-data-2/substation@100/motor-1
+ * &electric_1/motor-1/electric and &spin_ctrl_1/electric are the same node:
+ *   /testcase-data-2/substation@100/motor-1/electric
  *
  * Thus the property "rpm_avail" in each fragment will
  * result in an attempt to update the same property twice.
  * This will result in an error and the overlay apply
  * will fail.
+ *
+ * The previous version of this test did not include the extra
+ * level of node 'electric'.  That resulted in the 'rpm_avail'
+ * property being located in the pre-existing node 'motor-1'.
+ * Modifying a property results in a WARNING that a memory leak
+ * will occur if the overlay is removed.  Since the overlay apply
+ * fails, the memory leak does actually occur, and kmemleak will
+ * further report the memory leak if CONFIG_DEBUG_KMEMLEAK is
+ * enabled.  Adding the overlay node 'electric' avoids the
+ * memory leak and thus people who use kmemleak will not
+ * have to debug this non-problem again.
  */
 
 &electric_1 {
 
        motor-1 {
-               rpm_avail = < 100 >;
+               electric {
+                       rpm_avail = < 100 >;
+               };
        };
 };
 
 &spin_ctrl_1 {
-               rpm_avail = < 100 200 >;
+               electric {
+                       rpm_avail = < 100 200 >;
+               };
 };
index 7e27670..398de04 100644 (file)
@@ -861,6 +861,10 @@ static void __init of_unittest_changeset(void)
        unittest(!of_changeset_revert(&chgset), "revert failed\n");
 
        of_changeset_destroy(&chgset);
+
+       of_node_put(n1);
+       of_node_put(n2);
+       of_node_put(n21);
 #endif
 }
 
@@ -1243,10 +1247,13 @@ static void __init of_unittest_platform_populate(void)
 
        of_platform_populate(np, match, NULL, &test_bus->dev);
        for_each_child_of_node(np, child) {
-               for_each_child_of_node(child, grandchild)
-                       unittest(of_find_device_by_node(grandchild),
+               for_each_child_of_node(child, grandchild) {
+                       pdev = of_find_device_by_node(grandchild);
+                       unittest(pdev,
                                 "Could not create device for node '%pOFn'\n",
                                 grandchild);
+                       of_dev_put(pdev);
+               }
        }
 
        of_platform_depopulate(&test_bus->dev);
@@ -3087,8 +3094,11 @@ static __init void of_unittest_overlay_high_level(void)
                                goto err_unlock;
                        }
                        if (__of_add_property(of_symbols, new_prop)) {
+                               kfree(new_prop->name);
+                               kfree(new_prop->value);
+                               kfree(new_prop);
                                /* "name" auto-generated by unflatten */
-                               if (!strcmp(new_prop->name, "name"))
+                               if (!strcmp(prop->name, "name"))
                                        continue;
                                unittest(0, "duplicate property '%s' in overlay_base node __symbols__",
                                         prop->name);
@@ -3171,21 +3181,21 @@ static __init void of_unittest_overlay_high_level(void)
                   "OF: overlay: ERROR: multiple fragments add and/or delete node /testcase-data-2/substation@100/motor-1/controller");
 
        EXPECT_BEGIN(KERN_ERR,
-                    "OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/substation@100/motor-1/rpm_avail");
+                    "OF: overlay: ERROR: multiple fragments add and/or delete node /testcase-data-2/substation@100/motor-1/electric");
        EXPECT_BEGIN(KERN_ERR,
-                    "OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/substation@100/motor-1/rpm_avail");
+                    "OF: overlay: ERROR: multiple fragments add, update, and/or delete property /testcase-data-2/substation@100/motor-1/electric/rpm_avail");
        EXPECT_BEGIN(KERN_ERR,
-                    "OF: overlay: ERROR: multiple fragments add, update, and/or delete property /testcase-data-2/substation@100/motor-1/rpm_avail");
+                    "OF: overlay: ERROR: multiple fragments add, update, and/or delete property /testcase-data-2/substation@100/motor-1/electric/name");
 
        unittest(overlay_data_apply("overlay_bad_add_dup_prop", NULL),
                 "Adding overlay 'overlay_bad_add_dup_prop' failed\n");
 
        EXPECT_END(KERN_ERR,
-                  "OF: overlay: ERROR: multiple fragments add, update, and/or delete property /testcase-data-2/substation@100/motor-1/rpm_avail");
+                    "OF: overlay: ERROR: multiple fragments add, update, and/or delete property /testcase-data-2/substation@100/motor-1/electric/name");
        EXPECT_END(KERN_ERR,
-                  "OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/substation@100/motor-1/rpm_avail");
+                    "OF: overlay: ERROR: multiple fragments add, update, and/or delete property /testcase-data-2/substation@100/motor-1/electric/rpm_avail");
        EXPECT_END(KERN_ERR,
-                  "OF: overlay: WARNING: memory leak will occur if overlay removed, property: /testcase-data-2/substation@100/motor-1/rpm_avail");
+                    "OF: overlay: ERROR: multiple fragments add and/or delete node /testcase-data-2/substation@100/motor-1/electric");
 
        unittest(overlay_data_apply("overlay_bad_phandle", NULL),
                 "Adding overlay 'overlay_bad_phandle' failed\n");
index ba43e6a..e4f01e7 100644 (file)
@@ -819,6 +819,8 @@ int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq)
        if (unlikely(!target_freq)) {
                if (opp_table->required_opp_tables) {
                        ret = _set_required_opps(dev, opp_table, NULL);
+               } else if (!_get_opp_count(opp_table)) {
+                       return 0;
                } else {
                        dev_err(dev, "target frequency can't be 0\n");
                        ret = -EINVAL;
@@ -849,6 +851,18 @@ int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq)
                goto put_opp_table;
        }
 
+       /*
+        * For IO devices which require an OPP on some platforms/SoCs
+        * while just needing to scale the clock on some others
+        * we look for empty OPP tables with just a clock handle and
+        * scale only the clk. This makes dev_pm_opp_set_rate()
+        * equivalent to a clk_set_rate()
+        */
+       if (!_get_opp_count(opp_table)) {
+               ret = _generic_set_opp_clk_only(dev, clk, freq);
+               goto put_opp_table;
+       }
+
        temp_freq = old_freq;
        old_opp = _find_freq_ceil(opp_table, &temp_freq);
        if (IS_ERR(old_opp)) {
index 28c9a24..ca9ed57 100644 (file)
@@ -5567,3 +5567,10 @@ static void pci_fixup_no_d0_pme(struct pci_dev *dev)
        dev->pme_support &= ~(PCI_PM_CAP_PME_D0 >> PCI_PM_CAP_PME_SHIFT);
 }
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ASMEDIA, 0x2142, pci_fixup_no_d0_pme);
+
+static void apex_pci_fixup_class(struct pci_dev *pdev)
+{
+       pdev->class = (PCI_CLASS_SYSTEM_OTHER << 8) | pdev->class;
+}
+DECLARE_PCI_FIXUP_CLASS_HEADER(0x1ac1, 0x089a,
+                              PCI_CLASS_NOT_DEFINED, 8, apex_pci_fixup_class);
index deb2009..0066c83 100644 (file)
@@ -68,7 +68,7 @@ struct mtk_scp {
        wait_queue_head_t ack_wq;
 
        void __iomem *cpu_addr;
-       phys_addr_t phys_addr;
+       dma_addr_t dma_addr;
        size_t dram_size;
 
        struct rproc_subdev *rpmsg_subdev;
index ea3743e..2bead57 100644 (file)
@@ -330,7 +330,7 @@ static void *scp_da_to_va(struct rproc *rproc, u64 da, size_t len)
                if (offset >= 0 && (offset + len) < scp->sram_size)
                        return (void __force *)scp->sram_base + offset;
        } else {
-               offset = da - scp->phys_addr;
+               offset = da - scp->dma_addr;
                if (offset >= 0 && (offset + len) < scp->dram_size)
                        return (void __force *)scp->cpu_addr + offset;
        }
@@ -451,7 +451,7 @@ static int scp_map_memory_region(struct mtk_scp *scp)
        /* Reserved SCP code size */
        scp->dram_size = MAX_CODE_SIZE;
        scp->cpu_addr = dma_alloc_coherent(scp->dev, scp->dram_size,
-                                          &scp->phys_addr, GFP_KERNEL);
+                                          &scp->dma_addr, GFP_KERNEL);
        if (!scp->cpu_addr)
                return -ENOMEM;
 
@@ -461,7 +461,7 @@ static int scp_map_memory_region(struct mtk_scp *scp)
 static void scp_unmap_memory_region(struct mtk_scp *scp)
 {
        dma_free_coherent(scp->dev, scp->dram_size, scp->cpu_addr,
-                         scp->phys_addr);
+                         scp->dma_addr);
        of_reserved_mem_device_release(scp->dev);
 }
 
index ce49c32..5475d4f 100644 (file)
@@ -367,7 +367,7 @@ unroll_pd_votes:
        }
 
        return ret;
-};
+}
 
 static void q6v5_pds_disable(struct q6v5 *qproc, struct device **pds,
                             size_t pd_count)
@@ -1527,7 +1527,7 @@ unroll_attach:
                dev_pm_domain_detach(devs[i], false);
 
        return ret;
-};
+}
 
 static void q6v5_pds_detach(struct q6v5 *qproc, struct device **pds,
                            size_t pd_count)
@@ -1675,7 +1675,7 @@ static int q6v5_probe(struct platform_device *pdev)
        ret = of_property_read_string_index(pdev->dev.of_node, "firmware-name",
                                            1, &qproc->hexagon_mdt_image);
        if (ret < 0 && ret != -EINVAL)
-               return ret;
+               goto free_rproc;
 
        platform_set_drvdata(pdev, qproc);
 
@@ -1766,17 +1766,23 @@ static int q6v5_probe(struct platform_device *pdev)
        qproc->sysmon = qcom_add_sysmon_subdev(rproc, "modem", 0x12);
        if (IS_ERR(qproc->sysmon)) {
                ret = PTR_ERR(qproc->sysmon);
-               goto detach_proxy_pds;
+               goto remove_subdevs;
        }
 
        ret = rproc_add(rproc);
        if (ret)
-               goto detach_proxy_pds;
+               goto remove_sysmon_subdev;
 
        return 0;
 
-detach_proxy_pds:
+remove_sysmon_subdev:
+       qcom_remove_sysmon_subdev(qproc->sysmon);
+remove_subdevs:
        qcom_remove_ipa_notify_subdev(qproc->rproc, &qproc->ipa_notify_subdev);
+       qcom_remove_ssr_subdev(rproc, &qproc->ssr_subdev);
+       qcom_remove_smd_subdev(rproc, &qproc->smd_subdev);
+       qcom_remove_glink_subdev(rproc, &qproc->glink_subdev);
+detach_proxy_pds:
        q6v5_pds_detach(qproc, qproc->proxy_pds, qproc->proxy_pd_count);
 detach_active_pds:
        q6v5_pds_detach(qproc, qproc->active_pds, qproc->active_pd_count);
@@ -1789,19 +1795,20 @@ free_rproc:
 static int q6v5_remove(struct platform_device *pdev)
 {
        struct q6v5 *qproc = platform_get_drvdata(pdev);
+       struct rproc *rproc = qproc->rproc;
 
-       rproc_del(qproc->rproc);
+       rproc_del(rproc);
 
        qcom_remove_sysmon_subdev(qproc->sysmon);
-       qcom_remove_ipa_notify_subdev(qproc->rproc, &qproc->ipa_notify_subdev);
-       qcom_remove_glink_subdev(qproc->rproc, &qproc->glink_subdev);
-       qcom_remove_smd_subdev(qproc->rproc, &qproc->smd_subdev);
-       qcom_remove_ssr_subdev(qproc->rproc, &qproc->ssr_subdev);
+       qcom_remove_ipa_notify_subdev(rproc, &qproc->ipa_notify_subdev);
+       qcom_remove_ssr_subdev(rproc, &qproc->ssr_subdev);
+       qcom_remove_smd_subdev(rproc, &qproc->smd_subdev);
+       qcom_remove_glink_subdev(rproc, &qproc->glink_subdev);
 
-       q6v5_pds_detach(qproc, qproc->active_pds, qproc->active_pd_count);
        q6v5_pds_detach(qproc, qproc->proxy_pds, qproc->proxy_pd_count);
+       q6v5_pds_detach(qproc, qproc->active_pds, qproc->active_pd_count);
 
-       rproc_free(qproc->rproc);
+       rproc_free(rproc);
 
        return 0;
 }
index 7f8536b..52b8713 100644 (file)
@@ -4,6 +4,7 @@
  */
 
 #include <linux/remoteproc.h>
+#include <linux/slab.h>
 
 #include "remoteproc_internal.h"
 
index 6a66dbf..0bdd56f 100644 (file)
@@ -19,6 +19,7 @@
 #include <linux/regmap.h>
 #include <linux/remoteproc.h>
 #include <linux/reset.h>
+#include <linux/slab.h>
 #include <linux/workqueue.h>
 
 #include "remoteproc_internal.h"
index 232aa4e..83f2b88 100644 (file)
@@ -8,6 +8,7 @@
 #include <linux/platform_device.h>
 #include <linux/remoteproc.h>
 #include <linux/rpmsg/mtk_rpmsg.h>
+#include <linux/slab.h>
 #include <linux/workqueue.h>
 
 #include "rpmsg_internal.h"
index a8682f6..376f1ef 100644 (file)
@@ -26,7 +26,6 @@ config DASD
        def_tristate y
        prompt "Support for DASD devices"
        depends on CCW && BLOCK
-       select IOSCHED_DEADLINE
        help
          Enable this option if you want to access DASDs directly utilizing
          S/390s channel subsystem commands. This is necessary for running
index 17feff1..2017c43 100644 (file)
@@ -127,7 +127,7 @@ config CHR_DEV_SG
 
          For scanners, look at SANE (<http://www.sane-project.org/>). For CD
          writer software look at Cdrtools
-         (<http://cdrecord.berlios.de/private/cdrecord.html>)
+         (<http://cdrtools.sourceforge.net/>)
          and for burning a "disk at once": CDRDAO
          (<http://cdrdao.sourceforge.net/>). Cdparanoia is a high
          quality digital reader of audio CDs (<http://www.xiph.org/paranoia/>).
index 90a1745..13ed907 100644 (file)
@@ -6,6 +6,7 @@ config SCSI_HISI_SAS
        select SCSI_SAS_LIBSAS
        select BLK_DEV_INTEGRITY
        depends on ATA
+       select SATA_HOST
        help
                This driver supports HiSilicon's SAS HBA, including support based
                on platform device
index f301a80..bf1e98f 100644 (file)
@@ -2539,7 +2539,6 @@ ql_dbg(uint level, scsi_qla_host_t *vha, uint id, const char *fmt, ...)
 {
        va_list va;
        struct va_format vaf;
-       char pbuf[64];
 
        va_start(va, fmt);
 
@@ -2547,6 +2546,8 @@ ql_dbg(uint level, scsi_qla_host_t *vha, uint id, const char *fmt, ...)
        vaf.va = &va;
 
        if (!ql_mask_match(level)) {
+               char pbuf[64];
+
                if (vha != NULL) {
                        const struct pci_dev *pdev = vha->hw->pdev;
                        /* <module-name> <msg-id>:<host> Message */
index 5b2deaa..caa6b84 100644 (file)
@@ -3611,8 +3611,6 @@ qla24xx_detect_sfp(scsi_qla_host_t *vha)
                        ha->lr_distance = LR_DISTANCE_5K;
        }
 
-       if (!vha->flags.init_done)
-               rc = QLA_SUCCESS;
 out:
        ql_dbg(ql_dbg_async, vha, 0x507b,
            "SFP detect: %s-Range SFP %s (nvr=%x ll=%x lr=%x lrd=%x).\n",
index 8d7a905..8a78d39 100644 (file)
@@ -87,7 +87,6 @@ qla24xx_process_abts(struct scsi_qla_host *vha, void *pkt)
        }
 
        /* terminate exchange */
-       memset(rsp_els, 0, sizeof(*rsp_els));
        rsp_els->entry_type = ELS_IOCB_TYPE;
        rsp_els->entry_count = 1;
        rsp_els->nport_handle = ~0;
index 9fd83d1..4ed9043 100644 (file)
@@ -4894,8 +4894,6 @@ qla25xx_set_els_cmds_supported(scsi_qla_host_t *vha)
                return QLA_MEMORY_ALLOC_FAILED;
        }
 
-       memset(els_cmd_map, 0, ELS_CMD_MAP_SIZE);
-
        els_cmd_map[index] |= 1 << bit;
 
        mcp->mb[0] = MBC_SET_RNID_PARAMS;
index 4e6af59..20472aa 100644 (file)
@@ -685,8 +685,10 @@ sg_write(struct file *filp, const char __user *buf, size_t count, loff_t * ppos)
        hp->flags = input_size; /* structure abuse ... */
        hp->pack_id = old_hdr.pack_id;
        hp->usr_ptr = NULL;
-       if (copy_from_user(cmnd, buf, cmd_size))
+       if (copy_from_user(cmnd, buf, cmd_size)) {
+               sg_remove_request(sfp, srp);
                return -EFAULT;
+       }
        /*
         * SG_DXFER_TO_FROM_DEV is functionally equivalent to SG_DXFER_FROM_DEV,
         * but is is possible that the app intended SG_DXFER_TO_DEV, because there
@@ -793,8 +795,10 @@ sg_common_write(Sg_fd * sfp, Sg_request * srp,
                        "sg_common_write:  scsi opcode=0x%02x, cmd_size=%d\n",
                        (int) cmnd[0], (int) hp->cmd_len));
 
-       if (hp->dxfer_len >= SZ_256M)
+       if (hp->dxfer_len >= SZ_256M) {
+               sg_remove_request(sfp, srp);
                return -EINVAL;
+       }
 
        k = sg_start_req(srp, cmnd);
        if (k) {
index cd4f641..bcdcd3e 100644 (file)
@@ -478,12 +478,18 @@ int dpaa2_io_service_enqueue_multiple_desc_fq(struct dpaa2_io *d,
                                const struct dpaa2_fd *fd,
                                int nb)
 {
-       int i;
-       struct qbman_eq_desc ed[32];
+       struct qbman_eq_desc *ed;
+       int i, ret;
+
+       ed = kcalloc(sizeof(struct qbman_eq_desc), 32, GFP_KERNEL);
+       if (!ed)
+               return -ENOMEM;
 
        d = service_select(d);
-       if (!d)
-               return -ENODEV;
+       if (!d) {
+               ret = -ENODEV;
+               goto out;
+       }
 
        for (i = 0; i < nb; i++) {
                qbman_eq_desc_clear(&ed[i]);
@@ -491,7 +497,10 @@ int dpaa2_io_service_enqueue_multiple_desc_fq(struct dpaa2_io *d,
                qbman_eq_desc_set_fq(&ed[i], fqid[i]);
        }
 
-       return qbman_swp_enqueue_multiple_desc(d->swp, &ed[0], fd, nb);
+       ret = qbman_swp_enqueue_multiple_desc(d->swp, &ed[0], fd, nb);
+out:
+       kfree(ed);
+       return ret;
 }
 EXPORT_SYMBOL(dpaa2_io_service_enqueue_multiple_desc_fq);
 
index d1f49ca..804b8ba 100644 (file)
@@ -753,7 +753,7 @@ int qbman_swp_enqueue_multiple_mem_back(struct qbman_swp *s,
        if (!s->eqcr.available) {
                eqcr_ci = s->eqcr.ci;
                p = s->addr_cena + QBMAN_CENA_SWP_EQCR_CI_MEMBACK;
-               s->eqcr.ci = __raw_readl(p) & full_mask;
+               s->eqcr.ci = *p & full_mask;
                s->eqcr.available = qm_cyc_diff(s->eqcr.pi_ring_size,
                                        eqcr_ci, s->eqcr.ci);
                if (!s->eqcr.available) {
@@ -823,7 +823,6 @@ int qbman_swp_enqueue_multiple_desc_direct(struct qbman_swp *s,
        const uint32_t *cl;
        uint32_t eqcr_ci, eqcr_pi, half_mask, full_mask;
        int i, num_enqueued = 0;
-       uint64_t addr_cena;
 
        half_mask = (s->eqcr.pi_ci_mask>>1);
        full_mask = s->eqcr.pi_ci_mask;
@@ -867,7 +866,6 @@ int qbman_swp_enqueue_multiple_desc_direct(struct qbman_swp *s,
 
        /* Flush all the cacheline without load/store in between */
        eqcr_pi = s->eqcr.pi;
-       addr_cena = (uint64_t)s->addr_cena;
        for (i = 0; i < num_enqueued; i++)
                eqcr_pi++;
        s->eqcr.pi = eqcr_pi & full_mask;
@@ -901,7 +899,7 @@ int qbman_swp_enqueue_multiple_desc_mem_back(struct qbman_swp *s,
        if (!s->eqcr.available) {
                eqcr_ci = s->eqcr.ci;
                p = s->addr_cena + QBMAN_CENA_SWP_EQCR_CI_MEMBACK;
-               s->eqcr.ci = __raw_readl(p) & full_mask;
+               s->eqcr.ci = *p & full_mask;
                s->eqcr.available = qm_cyc_diff(s->eqcr.pi_ring_size,
                                        eqcr_ci, s->eqcr.ci);
                if (!s->eqcr.available)
index 67aa94b..d515d2c 100644 (file)
@@ -21,6 +21,7 @@ config SOC_IMX8M
        bool "i.MX8M SoC family support"
        depends on ARCH_MXC || COMPILE_TEST
        default ARCH_MXC && ARM64
+       select SOC_BUS
        help
          If you say yes here you get support for the NXP i.MX8M family
          support, it will provide the SoC info like SoC family,
index 223f1f9..646512d 100644 (file)
@@ -19,7 +19,7 @@ config XILINX_VCU
 
 config ZYNQMP_POWER
        bool "Enable Xilinx Zynq MPSoC Power Management driver"
-       depends on PM && ARCH_ZYNQMP
+       depends on PM && ZYNQMP_FIRMWARE
        default y
        select MAILBOX
        select ZYNQMP_IPI_MBOX
@@ -35,7 +35,7 @@ config ZYNQMP_POWER
 config ZYNQMP_PM_DOMAINS
        bool "Enable Zynq MPSoC generic PM domains"
        default y
-       depends on PM && ARCH_ZYNQMP && ZYNQMP_FIRMWARE
+       depends on PM && ZYNQMP_FIRMWARE
        select PM_GENERIC_DOMAINS
        help
          Say yes to enable device power management through PM domains
index 46199c8..f12f81c 100644 (file)
@@ -570,13 +570,6 @@ static const struct pci_device_id apex_pci_ids[] = {
        { PCI_DEVICE(APEX_PCI_VENDOR_ID, APEX_PCI_DEVICE_ID) }, { 0 }
 };
 
-static void apex_pci_fixup_class(struct pci_dev *pdev)
-{
-       pdev->class = (PCI_CLASS_SYSTEM_OTHER << 8) | pdev->class;
-}
-DECLARE_PCI_FIXUP_CLASS_HEADER(APEX_PCI_VENDOR_ID, APEX_PCI_DEVICE_ID,
-                              PCI_CLASS_NOT_DEFINED, 8, apex_pci_fixup_class);
-
 static int apex_pci_probe(struct pci_dev *pci_dev,
                          const struct pci_device_id *id)
 {
index 6b4b354..1e031d8 100644 (file)
@@ -63,7 +63,7 @@ static int fc_get_pr_transport_id(
         * encoded TransportID.
         */
        ptr = &se_nacl->initiatorname[0];
-       for (i = 0; i < 24; ) {
+       for (i = 0; i < 23; ) {
                if (!strncmp(&ptr[i], ":", 1)) {
                        i++;
                        continue;
@@ -341,7 +341,8 @@ static char *iscsi_parse_pr_out_transport_id(
                        *p = tolower(*p);
                        p++;
                }
-       }
+       } else
+               *port_nexus_ptr = NULL;
 
        return &buf[4];
 }
index 0b9dfa6..f769bb1 100644 (file)
@@ -2073,6 +2073,7 @@ static void tcmu_reset_ring(struct tcmu_dev *udev, u8 err_level)
        mb->cmd_tail = 0;
        mb->cmd_head = 0;
        tcmu_flush_dcache_range(mb, sizeof(*mb));
+       clear_bit(TCMU_DEV_BIT_BROKEN, &udev->flags);
 
        del_timer(&udev->cmd_timer);
 
index 7db1460..e814006 100644 (file)
@@ -1,21 +1,16 @@
 # SPDX-License-Identifier: GPL-2.0-only
-config VDPA
-       tristate
+menuconfig VDPA
+       tristate "vDPA drivers"
        help
          Enable this module to support vDPA device that uses a
          datapath which complies with virtio specifications with
          vendor specific control path.
 
-menuconfig VDPA_MENU
-       bool "VDPA drivers"
-       default n
-
-if VDPA_MENU
+if VDPA
 
 config VDPA_SIM
        tristate "vDPA device simulator"
-       depends on RUNTIME_TESTING_MENU
-       select VDPA
+       depends on RUNTIME_TESTING_MENU && HAS_DMA && VHOST_DPN
        select VHOST_RING
        default n
        help
@@ -24,9 +19,8 @@ config VDPA_SIM
          development of vDPA.
 
 config IFCVF
-       tristate "Intel IFC VF VDPA driver"
+       tristate "Intel IFC VF vDPA driver"
        depends on PCI_MSI
-       select VDPA
        default n
        help
          This kernel module can drive Intel IFC VF NIC to offload
@@ -34,4 +28,4 @@ config IFCVF
          To compile this driver as a module, choose M here: the module will
          be called ifcvf.
 
-endif # VDPA_MENU
+endif # VDPA
index b61b06e..e24371d 100644 (file)
@@ -301,12 +301,10 @@ int ifcvf_set_vq_state(struct ifcvf_hw *hw, u16 qid, u64 num)
 
 static int ifcvf_hw_enable(struct ifcvf_hw *hw)
 {
-       struct ifcvf_lm_cfg __iomem *ifcvf_lm;
        struct virtio_pci_common_cfg __iomem *cfg;
        struct ifcvf_adapter *ifcvf;
        u32 i;
 
-       ifcvf_lm = (struct ifcvf_lm_cfg __iomem *)hw->lm_cfg;
        ifcvf = vf_to_adapter(hw);
        cfg = hw->common_cfg;
        ifc_iowrite16(IFCVF_MSI_CONFIG_OFF, &cfg->msix_config);
index 8d54dc5..abf6a06 100644 (file)
@@ -31,11 +31,9 @@ static irqreturn_t ifcvf_intr_handler(int irq, void *arg)
 static int ifcvf_start_datapath(void *private)
 {
        struct ifcvf_hw *vf = ifcvf_private_to_vf(private);
-       struct ifcvf_adapter *ifcvf;
        u8 status;
        int ret;
 
-       ifcvf = vf_to_adapter(vf);
        vf->nr_vring = IFCVF_MAX_QUEUE_PAIRS * 2;
        ret = ifcvf_start_hw(vf);
        if (ret < 0) {
@@ -228,7 +226,7 @@ static u32 ifcvf_vdpa_get_vendor_id(struct vdpa_device *vdpa_dev)
        return IFCVF_SUBSYS_VENDOR_ID;
 }
 
-static u16 ifcvf_vdpa_get_vq_align(struct vdpa_device *vdpa_dev)
+static u32 ifcvf_vdpa_get_vq_align(struct vdpa_device *vdpa_dev)
 {
        return IFCVF_QUEUE_ALIGNMENT;
 }
index e9ed6a2..ff6562f 100644 (file)
@@ -116,7 +116,7 @@ EXPORT_SYMBOL_GPL(__vdpa_alloc_device);
 
 /**
  * vdpa_register_device - register a vDPA device
- * Callers must have a succeed call of vdpa_init_device() before.
+ * Callers must have a succeed call of vdpa_alloc_device() before.
  * @vdev: the vdpa device to be registered to vDPA bus
  *
  * Returns an error when fail to add to vDPA bus
index 6e8a0cf..7957d2d 100644 (file)
@@ -435,7 +435,7 @@ static u64 vdpasim_get_vq_state(struct vdpa_device *vdpa, u16 idx)
        return vrh->last_avail_idx;
 }
 
-static u16 vdpasim_get_vq_align(struct vdpa_device *vdpa)
+static u32 vdpasim_get_vq_align(struct vdpa_device *vdpa)
 {
        return VDPASIM_QUEUE_ALIGN;
 }
@@ -488,7 +488,7 @@ static u8 vdpasim_get_status(struct vdpa_device *vdpa)
        status = vdpasim->status;
        spin_unlock(&vdpasim->lock);
 
-       return vdpasim->status;
+       return status;
 }
 
 static void vdpasim_set_status(struct vdpa_device *vdpa, u8 status)
index 362b832..c4f2737 100644 (file)
@@ -3,6 +3,8 @@ config VHOST_IOTLB
        tristate
        help
          Generic IOTLB implementation for vhost and vringh.
+         This option is selected by any driver which needs to support
+         an IOMMU in software.
 
 config VHOST_RING
        tristate
@@ -11,6 +13,15 @@ config VHOST_RING
          This option is selected by any driver which needs to access
          the host side of a virtio ring.
 
+config VHOST_DPN
+       bool
+       depends on !ARM || AEABI
+       default y
+       help
+         Anything selecting VHOST or VHOST_RING must depend on VHOST_DPN.
+         This excludes the deprecated ARM ABI since that forces a 4 byte
+         alignment on all structs - incompatible with virtio spec requirements.
+
 config VHOST
        tristate
        select VHOST_IOTLB
@@ -26,7 +37,7 @@ if VHOST_MENU
 
 config VHOST_NET
        tristate "Host kernel accelerator for virtio net"
-       depends on NET && EVENTFD && (TUN || !TUN) && (TAP || !TAP)
+       depends on NET && EVENTFD && (TUN || !TUN) && (TAP || !TAP) && VHOST_DPN
        select VHOST
        ---help---
          This kernel module can be loaded in host kernel to accelerate
@@ -38,7 +49,7 @@ config VHOST_NET
 
 config VHOST_SCSI
        tristate "VHOST_SCSI TCM fabric driver"
-       depends on TARGET_CORE && EVENTFD
+       depends on TARGET_CORE && EVENTFD && VHOST_DPN
        select VHOST
        default n
        ---help---
@@ -47,7 +58,7 @@ config VHOST_SCSI
 
 config VHOST_VSOCK
        tristate "vhost virtio-vsock driver"
-       depends on VSOCKETS && EVENTFD
+       depends on VSOCKETS && EVENTFD && VHOST_DPN
        select VHOST
        select VIRTIO_VSOCKETS_COMMON
        default n
@@ -61,9 +72,9 @@ config VHOST_VSOCK
 
 config VHOST_VDPA
        tristate "Vhost driver for vDPA-based backend"
-       depends on EVENTFD
+       depends on EVENTFD && VHOST_DPN
        select VHOST
-       select VDPA
+       depends on VDPA
        help
          This kernel module can be loaded in host kernel to accelerate
          guest virtio devices with the vDPA-based backends.
index 87469d6..2927f02 100644 (file)
@@ -424,7 +424,7 @@ static void vhost_net_disable_vq(struct vhost_net *n,
        struct vhost_net_virtqueue *nvq =
                container_of(vq, struct vhost_net_virtqueue, vq);
        struct vhost_poll *poll = n->poll + (nvq - n->vqs);
-       if (!vq->private_data)
+       if (!vhost_vq_get_backend(vq))
                return;
        vhost_poll_stop(poll);
 }
@@ -437,7 +437,7 @@ static int vhost_net_enable_vq(struct vhost_net *n,
        struct vhost_poll *poll = n->poll + (nvq - n->vqs);
        struct socket *sock;
 
-       sock = vq->private_data;
+       sock = vhost_vq_get_backend(vq);
        if (!sock)
                return 0;
 
@@ -524,7 +524,7 @@ static void vhost_net_busy_poll(struct vhost_net *net,
                return;
 
        vhost_disable_notify(&net->dev, vq);
-       sock = rvq->private_data;
+       sock = vhost_vq_get_backend(rvq);
 
        busyloop_timeout = poll_rx ? rvq->busyloop_timeout:
                                     tvq->busyloop_timeout;
@@ -570,8 +570,10 @@ static int vhost_net_tx_get_vq_desc(struct vhost_net *net,
 
        if (r == tvq->num && tvq->busyloop_timeout) {
                /* Flush batched packets first */
-               if (!vhost_sock_zcopy(tvq->private_data))
-                       vhost_tx_batch(net, tnvq, tvq->private_data, msghdr);
+               if (!vhost_sock_zcopy(vhost_vq_get_backend(tvq)))
+                       vhost_tx_batch(net, tnvq,
+                                      vhost_vq_get_backend(tvq),
+                                      msghdr);
 
                vhost_net_busy_poll(net, rvq, tvq, busyloop_intr, false);
 
@@ -685,7 +687,7 @@ static int vhost_net_build_xdp(struct vhost_net_virtqueue *nvq,
        struct vhost_virtqueue *vq = &nvq->vq;
        struct vhost_net *net = container_of(vq->dev, struct vhost_net,
                                             dev);
-       struct socket *sock = vq->private_data;
+       struct socket *sock = vhost_vq_get_backend(vq);
        struct page_frag *alloc_frag = &net->page_frag;
        struct virtio_net_hdr *gso;
        struct xdp_buff *xdp = &nvq->xdp[nvq->batched_xdp];
@@ -952,7 +954,7 @@ static void handle_tx(struct vhost_net *net)
        struct socket *sock;
 
        mutex_lock_nested(&vq->mutex, VHOST_NET_VQ_TX);
-       sock = vq->private_data;
+       sock = vhost_vq_get_backend(vq);
        if (!sock)
                goto out;
 
@@ -1121,7 +1123,7 @@ static void handle_rx(struct vhost_net *net)
        int recv_pkts = 0;
 
        mutex_lock_nested(&vq->mutex, VHOST_NET_VQ_RX);
-       sock = vq->private_data;
+       sock = vhost_vq_get_backend(vq);
        if (!sock)
                goto out;
 
@@ -1345,9 +1347,9 @@ static struct socket *vhost_net_stop_vq(struct vhost_net *n,
                container_of(vq, struct vhost_net_virtqueue, vq);
 
        mutex_lock(&vq->mutex);
-       sock = vq->private_data;
+       sock = vhost_vq_get_backend(vq);
        vhost_net_disable_vq(n, vq);
-       vq->private_data = NULL;
+       vhost_vq_set_backend(vq, NULL);
        vhost_net_buf_unproduce(nvq);
        nvq->rx_ring = NULL;
        mutex_unlock(&vq->mutex);
@@ -1521,7 +1523,7 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd)
        }
 
        /* start polling new socket */
-       oldsock = vq->private_data;
+       oldsock = vhost_vq_get_backend(vq);
        if (sock != oldsock) {
                ubufs = vhost_net_ubuf_alloc(vq,
                                             sock && vhost_sock_zcopy(sock));
@@ -1531,7 +1533,7 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd)
                }
 
                vhost_net_disable_vq(n, vq);
-               vq->private_data = sock;
+               vhost_vq_set_backend(vq, sock);
                vhost_net_buf_unproduce(nvq);
                r = vhost_vq_init_access(vq);
                if (r)
@@ -1568,7 +1570,7 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd)
        return 0;
 
 err_used:
-       vq->private_data = oldsock;
+       vhost_vq_set_backend(vq, oldsock);
        vhost_net_enable_vq(n, vq);
        if (ubufs)
                vhost_net_ubuf_put_wait_and_free(ubufs);
index 7653667..c399522 100644 (file)
@@ -452,7 +452,7 @@ vhost_scsi_do_evt_work(struct vhost_scsi *vs, struct vhost_scsi_evt *evt)
        unsigned out, in;
        int head, ret;
 
-       if (!vq->private_data) {
+       if (!vhost_vq_get_backend(vq)) {
                vs->vs_events_missed = true;
                return;
        }
@@ -892,7 +892,7 @@ vhost_scsi_get_req(struct vhost_virtqueue *vq, struct vhost_scsi_ctx *vc,
        } else {
                struct vhost_scsi_tpg **vs_tpg, *tpg;
 
-               vs_tpg = vq->private_data;      /* validated at handler entry */
+               vs_tpg = vhost_vq_get_backend(vq);      /* validated at handler entry */
 
                tpg = READ_ONCE(vs_tpg[*vc->target]);
                if (unlikely(!tpg)) {
@@ -929,7 +929,7 @@ vhost_scsi_handle_vq(struct vhost_scsi *vs, struct vhost_virtqueue *vq)
         * We can handle the vq only after the endpoint is setup by calling the
         * VHOST_SCSI_SET_ENDPOINT ioctl.
         */
-       vs_tpg = vq->private_data;
+       vs_tpg = vhost_vq_get_backend(vq);
        if (!vs_tpg)
                goto out;
 
@@ -1184,7 +1184,7 @@ vhost_scsi_ctl_handle_vq(struct vhost_scsi *vs, struct vhost_virtqueue *vq)
         * We can handle the vq only after the endpoint is setup by calling the
         * VHOST_SCSI_SET_ENDPOINT ioctl.
         */
-       if (!vq->private_data)
+       if (!vhost_vq_get_backend(vq))
                goto out;
 
        memset(&vc, 0, sizeof(vc));
@@ -1322,7 +1322,7 @@ static void vhost_scsi_evt_handle_kick(struct vhost_work *work)
        struct vhost_scsi *vs = container_of(vq->dev, struct vhost_scsi, dev);
 
        mutex_lock(&vq->mutex);
-       if (!vq->private_data)
+       if (!vhost_vq_get_backend(vq))
                goto out;
 
        if (vs->vs_events_missed)
@@ -1460,7 +1460,7 @@ vhost_scsi_set_endpoint(struct vhost_scsi *vs,
                for (i = 0; i < VHOST_SCSI_MAX_VQ; i++) {
                        vq = &vs->vqs[i].vq;
                        mutex_lock(&vq->mutex);
-                       vq->private_data = vs_tpg;
+                       vhost_vq_set_backend(vq, vs_tpg);
                        vhost_vq_init_access(vq);
                        mutex_unlock(&vq->mutex);
                }
@@ -1547,7 +1547,7 @@ vhost_scsi_clear_endpoint(struct vhost_scsi *vs,
                for (i = 0; i < VHOST_SCSI_MAX_VQ; i++) {
                        vq = &vs->vqs[i].vq;
                        mutex_lock(&vq->mutex);
-                       vq->private_data = NULL;
+                       vhost_vq_set_backend(vq, NULL);
                        mutex_unlock(&vq->mutex);
                }
        }
index e37c92d..9a3a090 100644 (file)
@@ -49,7 +49,7 @@ static void handle_vq(struct vhost_test *n)
        void *private;
 
        mutex_lock(&vq->mutex);
-       private = vq->private_data;
+       private = vhost_vq_get_backend(vq);
        if (!private) {
                mutex_unlock(&vq->mutex);
                return;
@@ -120,7 +120,7 @@ static int vhost_test_open(struct inode *inode, struct file *f)
        vqs[VHOST_TEST_VQ] = &n->vqs[VHOST_TEST_VQ];
        n->vqs[VHOST_TEST_VQ].handle_kick = handle_vq_kick;
        vhost_dev_init(dev, vqs, VHOST_TEST_VQ_MAX, UIO_MAXIOV,
-                      VHOST_TEST_PKT_WEIGHT, VHOST_TEST_WEIGHT);
+                      VHOST_TEST_PKT_WEIGHT, VHOST_TEST_WEIGHT, NULL);
 
        f->private_data = n;
 
@@ -133,8 +133,8 @@ static void *vhost_test_stop_vq(struct vhost_test *n,
        void *private;
 
        mutex_lock(&vq->mutex);
-       private = vq->private_data;
-       vq->private_data = NULL;
+       private = vhost_vq_get_backend(vq);
+       vhost_vq_set_backend(vq, NULL);
        mutex_unlock(&vq->mutex);
        return private;
 }
@@ -198,8 +198,8 @@ static long vhost_test_run(struct vhost_test *n, int test)
                priv = test ? n : NULL;
 
                /* start polling new socket */
-               oldpriv = vq->private_data;
-               vq->private_data = priv;
+               oldpriv = vhost_vq_get_backend(vq);
+               vhost_vq_set_backend(vq, priv);
 
                r = vhost_vq_init_access(&n->vqs[index]);
 
@@ -225,7 +225,7 @@ static long vhost_test_reset_owner(struct vhost_test *n)
 {
        void *priv = NULL;
        long err;
-       struct vhost_umem *umem;
+       struct vhost_iotlb *umem;
 
        mutex_lock(&n->dev.mutex);
        err = vhost_dev_check_owner(&n->dev);
index 421f02a..0968361 100644 (file)
@@ -296,7 +296,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;
-       u8 status;
        u32 idx;
        long r;
 
@@ -310,8 +309,6 @@ static long vhost_vdpa_vring_ioctl(struct vhost_vdpa *v, unsigned int cmd,
        idx = array_index_nospec(idx, v->nvqs);
        vq = &v->vqs[idx];
 
-       status = ops->get_status(vdpa);
-
        if (cmd == VHOST_VDPA_SET_VRING_ENABLE) {
                if (copy_from_user(&s, argp, sizeof(s)))
                        return -EFAULT;
@@ -678,8 +675,6 @@ static int vhost_vdpa_open(struct inode *inode, struct file *filep)
        int nvqs, i, r, opened;
 
        v = container_of(inode->i_cdev, struct vhost_vdpa, cdev);
-       if (!v)
-               return -ENODEV;
 
        opened = atomic_cmpxchg(&v->opened, 0, 1);
        if (opened)
index 1813821..f8403bd 100644 (file)
@@ -231,6 +231,33 @@ enum {
                         (1ULL << VIRTIO_F_VERSION_1)
 };
 
+/**
+ * vhost_vq_set_backend - Set backend.
+ *
+ * @vq            Virtqueue.
+ * @private_data  The private data.
+ *
+ * Context: Need to call with vq->mutex acquired.
+ */
+static inline void vhost_vq_set_backend(struct vhost_virtqueue *vq,
+                                       void *private_data)
+{
+       vq->private_data = private_data;
+}
+
+/**
+ * vhost_vq_get_backend - Get backend.
+ *
+ * @vq            Virtqueue.
+ *
+ * Context: Need to call with vq->mutex acquired.
+ * Return: Private data previously set with vhost_vq_set_backend.
+ */
+static inline void *vhost_vq_get_backend(struct vhost_virtqueue *vq)
+{
+       return vq->private_data;
+}
+
 static inline bool vhost_has_feature(struct vhost_virtqueue *vq, int bit)
 {
        return vq->acked_features & (1ULL << bit);
index ee0491f..ba8e0d6 100644 (file)
 #include <linux/uaccess.h>
 #include <linux/slab.h>
 #include <linux/export.h>
+#if IS_REACHABLE(CONFIG_VHOST_IOTLB)
 #include <linux/bvec.h>
 #include <linux/highmem.h>
 #include <linux/vhost_iotlb.h>
+#endif
 #include <uapi/linux/virtio_config.h>
 
 static __printf(1,2) __cold void vringh_bad(const char *fmt, ...)
@@ -1059,6 +1061,8 @@ int vringh_need_notify_kern(struct vringh *vrh)
 }
 EXPORT_SYMBOL(vringh_need_notify_kern);
 
+#if IS_REACHABLE(CONFIG_VHOST_IOTLB)
+
 static int iotlb_translate(const struct vringh *vrh,
                           u64 addr, u64 len, struct bio_vec iov[],
                           int iov_size, u32 perm)
@@ -1416,5 +1420,6 @@ int vringh_need_notify_iotlb(struct vringh *vrh)
 }
 EXPORT_SYMBOL(vringh_need_notify_iotlb);
 
+#endif
 
 MODULE_LICENSE("GPL");
index 9766948..e36aaf9 100644 (file)
@@ -91,7 +91,7 @@ vhost_transport_do_send_pkt(struct vhost_vsock *vsock,
 
        mutex_lock(&vq->mutex);
 
-       if (!vq->private_data)
+       if (!vhost_vq_get_backend(vq))
                goto out;
 
        /* Avoid further vmexits, we're already processing the virtqueue */
@@ -440,7 +440,7 @@ static void vhost_vsock_handle_tx_kick(struct vhost_work *work)
 
        mutex_lock(&vq->mutex);
 
-       if (!vq->private_data)
+       if (!vhost_vq_get_backend(vq))
                goto out;
 
        vhost_disable_notify(&vsock->dev, vq);
@@ -533,8 +533,8 @@ static int vhost_vsock_start(struct vhost_vsock *vsock)
                        goto err_vq;
                }
 
-               if (!vq->private_data) {
-                       vq->private_data = vsock;
+               if (!vhost_vq_get_backend(vq)) {
+                       vhost_vq_set_backend(vq, vsock);
                        ret = vhost_vq_init_access(vq);
                        if (ret)
                                goto err_vq;
@@ -547,14 +547,14 @@ static int vhost_vsock_start(struct vhost_vsock *vsock)
        return 0;
 
 err_vq:
-       vq->private_data = NULL;
+       vhost_vq_set_backend(vq, NULL);
        mutex_unlock(&vq->mutex);
 
        for (i = 0; i < ARRAY_SIZE(vsock->vqs); i++) {
                vq = &vsock->vqs[i];
 
                mutex_lock(&vq->mutex);
-               vq->private_data = NULL;
+               vhost_vq_set_backend(vq, NULL);
                mutex_unlock(&vq->mutex);
        }
 err:
@@ -577,7 +577,7 @@ static int vhost_vsock_stop(struct vhost_vsock *vsock)
                struct vhost_virtqueue *vq = &vsock->vqs[i];
 
                mutex_lock(&vq->mutex);
-               vq->private_data = NULL;
+               vhost_vq_set_backend(vq, NULL);
                mutex_unlock(&vq->mutex);
        }
 
index 2bbf94b..69a32df 100644 (file)
@@ -45,7 +45,7 @@ config VIRTIO_PCI_LEGACY
 
 config VIRTIO_VDPA
        tristate "vDPA driver for virtio devices"
-       select VDPA
+       depends on VDPA
        select VIRTIO
        help
          This driver provides support for virtio based paravirtual
index 0ef1656..51086a5 100644 (file)
@@ -165,7 +165,7 @@ static void tell_host(struct virtio_balloon *vb, struct virtqueue *vq)
 
 }
 
-int virtballoon_free_page_report(struct page_reporting_dev_info *pr_dev_info,
+static int virtballoon_free_page_report(struct page_reporting_dev_info *pr_dev_info,
                                   struct scatterlist *sg, unsigned int nents)
 {
        struct virtio_balloon *vb =
@@ -580,7 +580,7 @@ static u32 virtio_balloon_cmd_id_received(struct virtio_balloon *vb)
        if (test_and_clear_bit(VIRTIO_BALLOON_CONFIG_READ_CMD_ID,
                               &vb->config_read_bitmap))
                virtio_cread(vb->vdev, struct virtio_balloon_config,
-                            free_page_report_cmd_id,
+                            free_page_hint_cmd_id,
                             &vb->cmd_id_received_cache);
 
        return vb->cmd_id_received_cache;
index 5ae5296..efaf65b 100644 (file)
@@ -3,6 +3,7 @@
 #include <linux/virtio.h>
 #include <linux/virtio_config.h>
 #include <linux/input.h>
+#include <linux/slab.h>
 
 #include <uapi/linux/virtio_ids.h>
 #include <uapi/linux/virtio_input.h>
index 53e0492..190d26e 100644 (file)
@@ -137,10 +137,14 @@ wdt_restart(struct watchdog_device *wdd, unsigned long mode, void *cmd)
 {
        struct sp805_wdt *wdt = watchdog_get_drvdata(wdd);
 
+       writel_relaxed(UNLOCK, wdt->base + WDTLOCK);
        writel_relaxed(0, wdt->base + WDTCONTROL);
        writel_relaxed(0, wdt->base + WDTLOAD);
        writel_relaxed(INT_ENABLE | RESET_ENABLE, wdt->base + WDTCONTROL);
 
+       /* Flush posted writes. */
+       readl_relaxed(wdt->base + WDTLOCK);
+
        return 0;
 }
 
index 3858432..040d2a4 100644 (file)
@@ -448,7 +448,14 @@ EXPORT_SYMBOL_GPL(xenbus_free_evtchn);
 int xenbus_map_ring_valloc(struct xenbus_device *dev, grant_ref_t *gnt_refs,
                           unsigned int nr_grefs, void **vaddr)
 {
-       return ring_ops->map(dev, gnt_refs, nr_grefs, vaddr);
+       int err;
+
+       err = ring_ops->map(dev, gnt_refs, nr_grefs, vaddr);
+       /* Some hypervisors are buggy and can return 1. */
+       if (err > 0)
+               err = GNTST_general_error;
+
+       return err;
 }
 EXPORT_SYMBOL_GPL(xenbus_map_ring_valloc);
 
index 6765949..380ad5a 100644 (file)
@@ -169,7 +169,7 @@ static int afs_record_cm_probe(struct afs_call *call, struct afs_server *server)
 
        spin_lock(&server->probe_lock);
 
-       if (!test_bit(AFS_SERVER_FL_HAVE_EPOCH, &server->flags)) {
+       if (!test_and_set_bit(AFS_SERVER_FL_HAVE_EPOCH, &server->flags)) {
                server->cm_epoch = call->epoch;
                server->probe.cm_epoch = call->epoch;
                goto out;
index e1b9ed6..a587767 100644 (file)
@@ -117,11 +117,8 @@ out:
               (unsigned int)rtt, ret);
 
        have_result |= afs_fs_probe_done(server);
-       if (have_result) {
-               server->probe.have_result = true;
-               wake_up_var(&server->probe.have_result);
+       if (have_result)
                wake_up_all(&server->probe_wq);
-       }
 }
 
 /*
index ef732dd..8025551 100644 (file)
@@ -533,12 +533,10 @@ struct afs_server {
                u32             abort_code;
                u32             cm_epoch;
                short           error;
-               bool            have_result;
                bool            responded:1;
                bool            is_yfs:1;
                bool            not_yfs:1;
                bool            local_failure:1;
-               bool            no_epoch:1;
                bool            cm_probed:1;
                bool            said_rebooted:1;
                bool            said_inconsistent:1;
@@ -1335,7 +1333,7 @@ extern struct afs_volume *afs_create_volume(struct afs_fs_context *);
 extern void afs_activate_volume(struct afs_volume *);
 extern void afs_deactivate_volume(struct afs_volume *);
 extern void afs_put_volume(struct afs_cell *, struct afs_volume *);
-extern int afs_check_volume_status(struct afs_volume *, struct key *);
+extern int afs_check_volume_status(struct afs_volume *, struct afs_fs_cursor *);
 
 /*
  * write.c
index 172ba56..2a3305e 100644 (file)
@@ -192,7 +192,7 @@ bool afs_select_fileserver(struct afs_fs_cursor *fc)
                        write_unlock(&vnode->volume->servers_lock);
 
                        set_bit(AFS_VOLUME_NEEDS_UPDATE, &vnode->volume->flags);
-                       error = afs_check_volume_status(vnode->volume, fc->key);
+                       error = afs_check_volume_status(vnode->volume, fc);
                        if (error < 0)
                                goto failed_set_error;
 
@@ -281,7 +281,7 @@ bool afs_select_fileserver(struct afs_fs_cursor *fc)
 
                        set_bit(AFS_VOLUME_WAIT, &vnode->volume->flags);
                        set_bit(AFS_VOLUME_NEEDS_UPDATE, &vnode->volume->flags);
-                       error = afs_check_volume_status(vnode->volume, fc->key);
+                       error = afs_check_volume_status(vnode->volume, fc);
                        if (error < 0)
                                goto failed_set_error;
 
@@ -341,7 +341,7 @@ start:
        /* See if we need to do an update of the volume record.  Note that the
         * volume may have moved or even have been deleted.
         */
-       error = afs_check_volume_status(vnode->volume, fc->key);
+       error = afs_check_volume_status(vnode->volume, fc);
        if (error < 0)
                goto failed_set_error;
 
index b7f3cb2..11b90ac 100644 (file)
@@ -594,12 +594,9 @@ retry:
        }
 
        ret = wait_on_bit(&server->flags, AFS_SERVER_FL_UPDATING,
-                         TASK_INTERRUPTIBLE);
+                         (fc->flags & AFS_FS_CURSOR_INTR) ?
+                         TASK_INTERRUPTIBLE : TASK_UNINTERRUPTIBLE);
        if (ret == -ERESTARTSYS) {
-               if (!(fc->flags & AFS_FS_CURSOR_INTR) && server->addresses) {
-                       _leave(" = t [intr]");
-                       return true;
-               }
                fc->error = ret;
                _leave(" = f [intr]");
                return false;
index 9a5ce96..72eacc1 100644 (file)
@@ -302,8 +302,8 @@ static void afs_vl_dump_edestaddrreq(const struct afs_vl_cursor *vc)
                                pr_notice("VC:  - nr=%u/%u/%u pf=%u\n",
                                          a->nr_ipv4, a->nr_addrs, a->max_addrs,
                                          a->preferred);
-                               pr_notice("VC:  - pr=%lx R=%lx F=%lx\n",
-                                         a->probed, a->responded, a->failed);
+                               pr_notice("VC:  - R=%lx F=%lx\n",
+                                         a->responded, a->failed);
                                if (a == vc->ac.alist)
                                        pr_notice("VC:  - current\n");
                        }
index 92ca5e2..4310336 100644 (file)
@@ -281,7 +281,7 @@ error:
 /*
  * Make sure the volume record is up to date.
  */
-int afs_check_volume_status(struct afs_volume *volume, struct key *key)
+int afs_check_volume_status(struct afs_volume *volume, struct afs_fs_cursor *fc)
 {
        time64_t now = ktime_get_real_seconds();
        int ret, retries = 0;
@@ -299,7 +299,7 @@ retry:
        }
 
        if (!test_and_set_bit_lock(AFS_VOLUME_UPDATING, &volume->flags)) {
-               ret = afs_update_volume_status(volume, key);
+               ret = afs_update_volume_status(volume, fc->key);
                clear_bit_unlock(AFS_VOLUME_WAIT, &volume->flags);
                clear_bit_unlock(AFS_VOLUME_UPDATING, &volume->flags);
                wake_up_bit(&volume->flags, AFS_VOLUME_WAIT);
@@ -312,7 +312,9 @@ retry:
                return 0;
        }
 
-       ret = wait_on_bit(&volume->flags, AFS_VOLUME_WAIT, TASK_INTERRUPTIBLE);
+       ret = wait_on_bit(&volume->flags, AFS_VOLUME_WAIT,
+                         (fc->flags & AFS_FS_CURSOR_INTR) ?
+                         TASK_INTERRUPTIBLE : TASK_UNINTERRUPTIBLE);
        if (ret == -ERESTARTSYS) {
                _leave(" = %d", ret);
                return ret;
index 52b6f64..93672c3 100644 (file)
@@ -19,7 +19,6 @@
 #include <linux/module.h>
 #include <linux/blkpg.h>
 #include <linux/magic.h>
-#include <linux/dax.h>
 #include <linux/buffer_head.h>
 #include <linux/swap.h>
 #include <linux/pagevec.h>
@@ -1893,6 +1892,16 @@ static void __blkdev_put(struct block_device *bdev, fmode_t mode, int for_part)
        struct gendisk *disk = bdev->bd_disk;
        struct block_device *victim = NULL;
 
+       /*
+        * Sync early if it looks like we're the last one.  If someone else
+        * opens the block device between now and the decrement of bd_openers
+        * then we did a sync that we didn't need to, but that's not the end
+        * of the world and we want to avoid long (could be several minute)
+        * syncs while holding the mutex.
+        */
+       if (bdev->bd_openers == 1)
+               sync_blockdev(bdev);
+
        mutex_lock_nested(&bdev->bd_mutex, for_part);
        if (for_part)
                bdev->bd_part_count--;
index 7e362a6..d35936c 100644 (file)
@@ -1527,8 +1527,7 @@ int btrfs_init_reloc_root(struct btrfs_trans_handle *trans,
        int clear_rsv = 0;
        int ret;
 
-       if (!rc || !rc->create_reloc_tree ||
-           root->root_key.objectid == BTRFS_TREE_RELOC_OBJECTID)
+       if (!rc)
                return 0;
 
        /*
@@ -1538,12 +1537,28 @@ int btrfs_init_reloc_root(struct btrfs_trans_handle *trans,
        if (reloc_root_is_dead(root))
                return 0;
 
+       /*
+        * This is subtle but important.  We do not do
+        * record_root_in_transaction for reloc roots, instead we record their
+        * corresponding fs root, and then here we update the last trans for the
+        * reloc root.  This means that we have to do this for the entire life
+        * of the reloc root, regardless of which stage of the relocation we are
+        * in.
+        */
        if (root->reloc_root) {
                reloc_root = root->reloc_root;
                reloc_root->last_trans = trans->transid;
                return 0;
        }
 
+       /*
+        * We are merging reloc roots, we do not need new reloc trees.  Also
+        * reloc trees never need their own reloc tree.
+        */
+       if (!rc->create_reloc_tree ||
+           root->root_key.objectid == BTRFS_TREE_RELOC_OBJECTID)
+               return 0;
+
        if (!trans->reloc_reserved) {
                rsv = trans->block_rsv;
                trans->block_rsv = rc->block_rsv;
index f73276d..a60f603 100644 (file)
@@ -967,7 +967,7 @@ grow_dev_page(struct block_device *bdev, sector_t block,
        struct page *page;
        struct buffer_head *bh;
        sector_t end_block;
-       int ret = 0;            /* Will call free_more_memory() */
+       int ret = 0;
        gfp_t gfp_mask;
 
        gfp_mask = mapping_gfp_constraint(inode->i_mapping, ~__GFP_FS) | gfp;
@@ -1371,6 +1371,17 @@ void __breadahead(struct block_device *bdev, sector_t block, unsigned size)
 }
 EXPORT_SYMBOL(__breadahead);
 
+void __breadahead_gfp(struct block_device *bdev, sector_t block, unsigned size,
+                     gfp_t gfp)
+{
+       struct buffer_head *bh = __getblk_gfp(bdev, block, size, gfp);
+       if (likely(bh)) {
+               ll_rw_block(REQ_OP_READ, REQ_RAHEAD, 1, &bh);
+               brelse(bh);
+       }
+}
+EXPORT_SYMBOL(__breadahead_gfp);
+
 /**
  *  __bread_gfp() - reads a specified block and returns the bh
  *  @bdev: the block_device to read from
index 140efc1..182b864 100644 (file)
@@ -594,6 +594,8 @@ decode_lanman_negprot_rsp(struct TCP_Server_Info *server, NEGOTIATE_RSP *pSMBr)
                               cifs_max_pending);
        set_credits(server, server->maxReq);
        server->maxBuf = le16_to_cpu(rsp->MaxBufSize);
+       /* set up max_read for readpages check */
+       server->max_read = server->maxBuf;
        /* even though we do not use raw we might as well set this
        accurately, in case we ever find a need for it */
        if ((le16_to_cpu(rsp->RawMode) & RAW_ENABLE) == RAW_ENABLE) {
@@ -755,6 +757,8 @@ CIFSSMBNegotiate(const unsigned int xid, struct cifs_ses *ses)
        set_credits(server, server->maxReq);
        /* probably no need to store and check maxvcs */
        server->maxBuf = le32_to_cpu(pSMBr->MaxBufferSize);
+       /* set up max_read for readpages check */
+       server->max_read = server->maxBuf;
        server->max_rw = le32_to_cpu(pSMBr->MaxRawSize);
        cifs_dbg(NOISY, "Max buf = %d\n", ses->server->maxBuf);
        server->capabilities = le32_to_cpu(pSMBr->Capabilities);
index 8fbbdcd..390d2b1 100644 (file)
@@ -61,7 +61,7 @@ static void cifs_set_ops(struct inode *inode)
                }
 
                /* check if server can support readpages */
-               if (cifs_sb_master_tcon(cifs_sb)->ses->server->maxBuf <
+               if (cifs_sb_master_tcon(cifs_sb)->ses->server->max_read <
                                PAGE_SIZE + MAX_CIFS_HDR_SIZE)
                        inode->i_data.a_ops = &cifs_addr_ops_smallbuf;
                else
index 47d3e38..b30aa3c 100644 (file)
@@ -1552,6 +1552,21 @@ SMB2_sess_auth_rawntlmssp_authenticate(struct SMB2_sess_data *sess_data)
        }
 
        rc = SMB2_sess_establish_session(sess_data);
+#ifdef CONFIG_CIFS_DEBUG_DUMP_KEYS
+       if (ses->server->dialect < SMB30_PROT_ID) {
+               cifs_dbg(VFS, "%s: dumping generated SMB2 session keys\n", __func__);
+               /*
+                * The session id is opaque in terms of endianness, so we can't
+                * print it as a long long. we dump it as we got it on the wire
+                */
+               cifs_dbg(VFS, "Session Id    %*ph\n", (int)sizeof(ses->Suid),
+                        &ses->Suid);
+               cifs_dbg(VFS, "Session Key   %*ph\n",
+                        SMB2_NTLMV2_SESSKEY_SIZE, ses->auth_key.response);
+               cifs_dbg(VFS, "Signing Key   %*ph\n",
+                        SMB3_SIGN_KEY_SIZE, ses->auth_key.response);
+       }
+#endif
 out:
        kfree(ntlmssp_blob);
        SMB2_sess_free_buffer(sess_data);
index 1a6c227..c0348e3 100644 (file)
@@ -660,8 +660,8 @@ smb2_verify_signature(struct smb_rqst *rqst, struct TCP_Server_Info *server)
                return rc;
 
        if (memcmp(server_response_sig, shdr->Signature, SMB2_SIGNATURE_SIZE)) {
-               dump_stack();
-               cifs_dbg(VFS, "sign fail cmd 0x%x message id 0x%llx\n", shdr->Command, shdr->MessageId);
+               cifs_dbg(VFS, "sign fail cmd 0x%x message id 0x%llx\n",
+                       shdr->Command, shdr->MessageId);
                return -EACCES;
        } else
                return 0;
index f8296a8..408418e 100644 (file)
@@ -211,6 +211,8 @@ static int format_corename(struct core_name *cn, struct coredump_params *cprm,
                        return -ENOMEM;
                (*argv)[(*argc)++] = 0;
                ++pat_ptr;
+               if (!(*pat_ptr))
+                       return -ENOMEM;
        }
 
        /* Repeat as long as we have more pattern to process and more output
index 6a04cc0..6774a5a 100644 (file)
@@ -91,7 +91,6 @@ static int exfat_allocate_bitmap(struct super_block *sb,
                }
        }
 
-       sbi->pbr_bh = NULL;
        return 0;
 }
 
@@ -137,8 +136,6 @@ void exfat_free_bitmap(struct exfat_sb_info *sbi)
 {
        int i;
 
-       brelse(sbi->pbr_bh);
-
        for (i = 0; i < sbi->map_sectors; i++)
                __brelse(sbi->vol_amap[i]);
 
index 67d4e46..d67fb8a 100644 (file)
@@ -507,6 +507,7 @@ void exfat_msg(struct super_block *sb, const char *lv, const char *fmt, ...)
                __printf(3, 4) __cold;
 void exfat_get_entry_time(struct exfat_sb_info *sbi, struct timespec64 *ts,
                u8 tz, __le16 time, __le16 date, u8 time_ms);
+void exfat_truncate_atime(struct timespec64 *ts);
 void exfat_set_entry_time(struct exfat_sb_info *sbi, struct timespec64 *ts,
                u8 *tz, __le16 *time, __le16 *date, u8 *time_ms);
 unsigned short exfat_calc_chksum_2byte(void *data, int len,
index 483f683..4f76764 100644 (file)
@@ -273,6 +273,7 @@ int exfat_getattr(const struct path *path, struct kstat *stat,
        struct exfat_inode_info *ei = EXFAT_I(inode);
 
        generic_fillattr(inode, stat);
+       exfat_truncate_atime(&stat->atime);
        stat->result_mask |= STATX_BTIME;
        stat->btime.tv_sec = ei->i_crtime.tv_sec;
        stat->btime.tv_nsec = ei->i_crtime.tv_nsec;
@@ -339,6 +340,7 @@ int exfat_setattr(struct dentry *dentry, struct iattr *attr)
        }
 
        setattr_copy(inode, attr);
+       exfat_truncate_atime(&inode->i_atime);
        mark_inode_dirty(inode);
 
 out:
index 14a3300..ebd2cbe 100644 (file)
@@ -88,7 +88,8 @@ void exfat_get_entry_time(struct exfat_sb_info *sbi, struct timespec64 *ts,
        if (time_ms) {
                ts->tv_sec += time_ms / 100;
                ts->tv_nsec = (time_ms % 100) * 10 * NSEC_PER_MSEC;
-       }
+       } else
+               ts->tv_nsec = 0;
 
        if (tz & EXFAT_TZ_VALID)
                /* Adjust timezone to UTC0. */
@@ -124,6 +125,17 @@ void exfat_set_entry_time(struct exfat_sb_info *sbi, struct timespec64 *ts,
        *tz = EXFAT_TZ_VALID;
 }
 
+/*
+ * The timestamp for access_time has double seconds granularity.
+ * (There is no 10msIncrement field for access_time unlike create/modify_time)
+ * atime also has only a 2-second resolution.
+ */
+void exfat_truncate_atime(struct timespec64 *ts)
+{
+       ts->tv_sec = round_down(ts->tv_sec, 2);
+       ts->tv_nsec = 0;
+}
+
 unsigned short exfat_calc_chksum_2byte(void *data, int len,
                unsigned short chksum, int type)
 {
index a8681d9..b72d782 100644 (file)
@@ -595,6 +595,7 @@ static int exfat_create(struct inode *dir, struct dentry *dentry, umode_t mode,
        inode_inc_iversion(inode);
        inode->i_mtime = inode->i_atime = inode->i_ctime =
                EXFAT_I(inode)->i_crtime = current_time(inode);
+       exfat_truncate_atime(&inode->i_atime);
        /* timestamp is already written, so mark_inode_dirty() is unneeded. */
 
        d_instantiate(dentry, inode);
@@ -854,6 +855,7 @@ static int exfat_unlink(struct inode *dir, struct dentry *dentry)
 
        inode_inc_iversion(dir);
        dir->i_mtime = dir->i_atime = current_time(dir);
+       exfat_truncate_atime(&dir->i_atime);
        if (IS_DIRSYNC(dir))
                exfat_sync_inode(dir);
        else
@@ -861,6 +863,7 @@ static int exfat_unlink(struct inode *dir, struct dentry *dentry)
 
        clear_nlink(inode);
        inode->i_mtime = inode->i_atime = current_time(inode);
+       exfat_truncate_atime(&inode->i_atime);
        exfat_unhash_inode(inode);
        exfat_d_version_set(dentry, inode_query_iversion(dir));
 unlock:
@@ -903,6 +906,7 @@ static int exfat_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
        inode_inc_iversion(inode);
        inode->i_mtime = inode->i_atime = inode->i_ctime =
                EXFAT_I(inode)->i_crtime = current_time(inode);
+       exfat_truncate_atime(&inode->i_atime);
        /* timestamp is already written, so mark_inode_dirty() is unneeded. */
 
        d_instantiate(dentry, inode);
@@ -1019,6 +1023,7 @@ static int exfat_rmdir(struct inode *dir, struct dentry *dentry)
 
        inode_inc_iversion(dir);
        dir->i_mtime = dir->i_atime = current_time(dir);
+       exfat_truncate_atime(&dir->i_atime);
        if (IS_DIRSYNC(dir))
                exfat_sync_inode(dir);
        else
@@ -1027,6 +1032,7 @@ static int exfat_rmdir(struct inode *dir, struct dentry *dentry)
 
        clear_nlink(inode);
        inode->i_mtime = inode->i_atime = current_time(inode);
+       exfat_truncate_atime(&inode->i_atime);
        exfat_unhash_inode(inode);
        exfat_d_version_set(dentry, inode_query_iversion(dir));
 unlock:
@@ -1387,6 +1393,7 @@ static int exfat_rename(struct inode *old_dir, struct dentry *old_dentry,
        inode_inc_iversion(new_dir);
        new_dir->i_ctime = new_dir->i_mtime = new_dir->i_atime =
                EXFAT_I(new_dir)->i_crtime = current_time(new_dir);
+       exfat_truncate_atime(&new_dir->i_atime);
        if (IS_DIRSYNC(new_dir))
                exfat_sync_inode(new_dir);
        else
index 16ed202..0565d55 100644 (file)
@@ -49,6 +49,7 @@ static void exfat_put_super(struct super_block *sb)
                sync_blockdev(sb->s_bdev);
        exfat_set_vol_flags(sb, VOL_CLEAN);
        exfat_free_bitmap(sbi);
+       brelse(sbi->pbr_bh);
        mutex_unlock(&sbi->s_lock);
 
        call_rcu(&sbi->rcu, exfat_delayed_free);
@@ -100,7 +101,7 @@ static int exfat_statfs(struct dentry *dentry, struct kstatfs *buf)
 int exfat_set_vol_flags(struct super_block *sb, unsigned short new_flag)
 {
        struct exfat_sb_info *sbi = EXFAT_SB(sb);
-       struct pbr64 *bpb;
+       struct pbr64 *bpb = (struct pbr64 *)sbi->pbr_bh->b_data;
        bool sync = 0;
 
        /* flags are not changed */
@@ -115,15 +116,6 @@ int exfat_set_vol_flags(struct super_block *sb, unsigned short new_flag)
        if (sb_rdonly(sb))
                return 0;
 
-       if (!sbi->pbr_bh) {
-               sbi->pbr_bh = sb_bread(sb, 0);
-               if (!sbi->pbr_bh) {
-                       exfat_msg(sb, KERN_ERR, "failed to read boot sector");
-                       return -ENOMEM;
-               }
-       }
-
-       bpb = (struct pbr64 *)sbi->pbr_bh->b_data;
        bpb->bsx.vol_flags = cpu_to_le16(new_flag);
 
        if (new_flag == VOL_DIRTY && !buffer_dirty(sbi->pbr_bh))
@@ -159,7 +151,6 @@ static int exfat_show_options(struct seq_file *m, struct dentry *root)
                seq_puts(m, ",iocharset=utf8");
        else if (sbi->nls_io)
                seq_printf(m, ",iocharset=%s", sbi->nls_io->charset);
-       seq_printf(m, ",bps=%ld", sb->s_blocksize);
        if (opts->errors == EXFAT_ERRORS_CONT)
                seq_puts(m, ",errors=continue");
        else if (opts->errors == EXFAT_ERRORS_PANIC)
@@ -351,14 +342,15 @@ static int exfat_read_root(struct inode *inode)
        exfat_save_attr(inode, ATTR_SUBDIR);
        inode->i_mtime = inode->i_atime = inode->i_ctime = ei->i_crtime =
                current_time(inode);
+       exfat_truncate_atime(&inode->i_atime);
        exfat_cache_init_inode(inode);
        return 0;
 }
 
-static struct pbr *exfat_read_pbr_with_logical_sector(struct super_block *sb,
-               struct buffer_head **prev_bh)
+static struct pbr *exfat_read_pbr_with_logical_sector(struct super_block *sb)
 {
-       struct pbr *p_pbr = (struct pbr *) (*prev_bh)->b_data;
+       struct exfat_sb_info *sbi = EXFAT_SB(sb);
+       struct pbr *p_pbr = (struct pbr *) (sbi->pbr_bh)->b_data;
        unsigned short logical_sect = 0;
 
        logical_sect = 1 << p_pbr->bsx.f64.sect_size_bits;
@@ -378,26 +370,23 @@ static struct pbr *exfat_read_pbr_with_logical_sector(struct super_block *sb,
        }
 
        if (logical_sect > sb->s_blocksize) {
-               struct buffer_head *bh = NULL;
-
-               __brelse(*prev_bh);
-               *prev_bh = NULL;
+               brelse(sbi->pbr_bh);
+               sbi->pbr_bh = NULL;
 
                if (!sb_set_blocksize(sb, logical_sect)) {
                        exfat_msg(sb, KERN_ERR,
                                "unable to set blocksize %u", logical_sect);
                        return NULL;
                }
-               bh = sb_bread(sb, 0);
-               if (!bh) {
+               sbi->pbr_bh = sb_bread(sb, 0);
+               if (!sbi->pbr_bh) {
                        exfat_msg(sb, KERN_ERR,
                                "unable to read boot sector (logical sector size = %lu)",
                                sb->s_blocksize);
                        return NULL;
                }
 
-               *prev_bh = bh;
-               p_pbr = (struct pbr *) bh->b_data;
+               p_pbr = (struct pbr *)sbi->pbr_bh->b_data;
        }
        return p_pbr;
 }
@@ -408,21 +397,20 @@ static int __exfat_fill_super(struct super_block *sb)
        int ret;
        struct pbr *p_pbr;
        struct pbr64 *p_bpb;
-       struct buffer_head *bh;
        struct exfat_sb_info *sbi = EXFAT_SB(sb);
 
        /* set block size to read super block */
        sb_min_blocksize(sb, 512);
 
        /* read boot sector */
-       bh = sb_bread(sb, 0);
-       if (!bh) {
+       sbi->pbr_bh = sb_bread(sb, 0);
+       if (!sbi->pbr_bh) {
                exfat_msg(sb, KERN_ERR, "unable to read boot sector");
                return -EIO;
        }
 
        /* PRB is read */
-       p_pbr = (struct pbr *)bh->b_data;
+       p_pbr = (struct pbr *)sbi->pbr_bh->b_data;
 
        /* check the validity of PBR */
        if (le16_to_cpu((p_pbr->signature)) != PBR_SIGNATURE) {
@@ -433,7 +421,7 @@ static int __exfat_fill_super(struct super_block *sb)
 
 
        /* check logical sector size */
-       p_pbr = exfat_read_pbr_with_logical_sector(sb, &bh);
+       p_pbr = exfat_read_pbr_with_logical_sector(sb);
        if (!p_pbr) {
                ret = -EIO;
                goto free_bh;
@@ -514,7 +502,7 @@ free_alloc_bitmap:
 free_upcase_table:
        exfat_free_upcase_table(sbi);
 free_bh:
-       brelse(bh);
+       brelse(sbi->pbr_bh);
        return ret;
 }
 
@@ -531,17 +519,18 @@ static int exfat_fill_super(struct super_block *sb, struct fs_context *fc)
        if (opts->discard) {
                struct request_queue *q = bdev_get_queue(sb->s_bdev);
 
-               if (!blk_queue_discard(q))
+               if (!blk_queue_discard(q)) {
                        exfat_msg(sb, KERN_WARNING,
                                "mounting with \"discard\" option, but the device does not support discard");
-               opts->discard = 0;
+                       opts->discard = 0;
+               }
        }
 
        sb->s_flags |= SB_NODIRATIME;
        sb->s_magic = EXFAT_SUPER_MAGIC;
        sb->s_op = &exfat_sops;
 
-       sb->s_time_gran = 1;
+       sb->s_time_gran = 10 * NSEC_PER_MSEC;
        sb->s_time_min = EXFAT_MIN_TIMESTAMP_SECS;
        sb->s_time_max = EXFAT_MAX_TIMESTAMP_SECS;
 
@@ -605,6 +594,7 @@ put_inode:
 free_table:
        exfat_free_upcase_table(sbi);
        exfat_free_bitmap(sbi);
+       brelse(sbi->pbr_bh);
 
 check_nls_io:
        unload_nls(sbi->nls_io);
@@ -717,6 +707,7 @@ static void __exit exit_exfat_fs(void)
 module_init(init_exfat_fs);
 module_exit(exit_exfat_fs);
 
+MODULE_ALIAS_FS("exfat");
 MODULE_LICENSE("GPL");
 MODULE_DESCRIPTION("exFAT filesystem support");
 MODULE_AUTHOR("Samsung Electronics Co., Ltd.");
index 0e0a4d6..a32e5f7 100644 (file)
@@ -410,7 +410,7 @@ verified:
  * Read the bitmap for a given block_group,and validate the
  * bits for block/inode/inode tables are set in the bitmaps
  *
- * Return buffer_head on success or NULL in case of failure.
+ * Return buffer_head on success or an ERR_PTR in case of failure.
  */
 struct buffer_head *
 ext4_read_block_bitmap_nowait(struct super_block *sb, ext4_group_t block_group)
@@ -502,7 +502,7 @@ out:
        return ERR_PTR(err);
 }
 
-/* Returns 0 on success, 1 on error */
+/* Returns 0 on success, -errno on error */
 int ext4_wait_block_bitmap(struct super_block *sb, ext4_group_t block_group,
                           struct buffer_head *bh)
 {
index 7f16e1a..0c76cdd 100644 (file)
@@ -338,9 +338,6 @@ int __ext4_handle_dirty_metadata(const char *where, unsigned int line,
                if (inode && inode_needs_sync(inode)) {
                        sync_dirty_buffer(bh);
                        if (buffer_req(bh) && !buffer_uptodate(bh)) {
-                               struct ext4_super_block *es;
-
-                               es = EXT4_SB(inode->i_sb)->s_es;
                                ext4_error_inode_err(inode, where, line,
                                                     bh->b_blocknr, EIO,
                                        "IO error syncing itable block");
index 031752c..f2b577b 100644 (file)
@@ -3374,8 +3374,8 @@ static int ext4_ext_convert_to_initialized(handle_t *handle,
                (unsigned long long)map->m_lblk, map_len);
 
        sbi = EXT4_SB(inode->i_sb);
-       eof_block = (inode->i_size + inode->i_sb->s_blocksize - 1) >>
-               inode->i_sb->s_blocksize_bits;
+       eof_block = (EXT4_I(inode)->i_disksize + inode->i_sb->s_blocksize - 1)
+                       >> inode->i_sb->s_blocksize_bits;
        if (eof_block < map->m_lblk + map_len)
                eof_block = map->m_lblk + map_len;
 
@@ -3627,8 +3627,8 @@ static int ext4_split_convert_extents(handle_t *handle,
                  __func__, inode->i_ino,
                  (unsigned long long)map->m_lblk, map->m_len);
 
-       eof_block = (inode->i_size + inode->i_sb->s_blocksize - 1) >>
-               inode->i_sb->s_blocksize_bits;
+       eof_block = (EXT4_I(inode)->i_disksize + inode->i_sb->s_blocksize - 1)
+                       >> inode->i_sb->s_blocksize_bits;
        if (eof_block < map->m_lblk + map->m_len)
                eof_block = map->m_lblk + map->m_len;
        /*
index b420c9d..4b8c9a9 100644 (file)
@@ -113,7 +113,7 @@ verified:
  * Read the inode allocation bitmap for a given block_group, reading
  * into the specified slot in the superblock's bitmap cache.
  *
- * Return buffer_head of bitmap on success or NULL.
+ * Return buffer_head of bitmap on success, or an ERR_PTR on error.
  */
 static struct buffer_head *
 ext4_read_inode_bitmap(struct super_block *sb, ext4_group_t block_group)
@@ -662,7 +662,7 @@ static int find_group_other(struct super_block *sb, struct inode *parent,
  * block has been written back to disk.  (Yes, these values are
  * somewhat arbitrary...)
  */
-#define RECENTCY_MIN   5
+#define RECENTCY_MIN   60
 #define RECENTCY_DIRTY 300
 
 static int recently_deleted(struct super_block *sb, ext4_group_t group, int ino)
index e416096..2a4aae6 100644 (file)
@@ -1973,7 +1973,7 @@ static int ext4_writepage(struct page *page,
        bool keep_towrite = false;
 
        if (unlikely(ext4_forced_shutdown(EXT4_SB(inode->i_sb)))) {
-               ext4_invalidatepage(page, 0, PAGE_SIZE);
+               inode->i_mapping->a_ops->invalidatepage(page, 0, PAGE_SIZE);
                unlock_page(page);
                return -EIO;
        }
@@ -4364,7 +4364,7 @@ make_io:
                        if (end > table)
                                end = table;
                        while (b <= end)
-                               sb_breadahead(sb, b++);
+                               sb_breadahead_unmovable(sb, b++);
                }
 
                /*
index 87c85be..30d5d97 100644 (file)
@@ -1943,7 +1943,8 @@ void ext4_mb_complex_scan_group(struct ext4_allocation_context *ac,
        int free;
 
        free = e4b->bd_info->bb_free;
-       BUG_ON(free <= 0);
+       if (WARN_ON(free <= 0))
+               return;
 
        i = e4b->bd_info->bb_first_free;
 
@@ -1966,7 +1967,8 @@ void ext4_mb_complex_scan_group(struct ext4_allocation_context *ac,
                }
 
                mb_find_extent(e4b, i, ac->ac_g_ex.fe_len, &ex);
-               BUG_ON(ex.fe_len <= 0);
+               if (WARN_ON(ex.fe_len <= 0))
+                       break;
                if (free < ex.fe_len) {
                        ext4_grp_locked_error(sb, e4b->bd_group, 0, 0,
                                        "%d free clusters as per "
index 9728e7b..bf5fcb4 100644 (file)
@@ -596,7 +596,6 @@ void __ext4_error_file(struct file *file, const char *function,
 {
        va_list args;
        struct va_format vaf;
-       struct ext4_super_block *es;
        struct inode *inode = file_inode(file);
        char pathname[80], *path;
 
@@ -604,7 +603,6 @@ void __ext4_error_file(struct file *file, const char *function,
                return;
 
        trace_ext4_error(inode->i_sb, function, line);
-       es = EXT4_SB(inode->i_sb)->s_es;
        if (ext4_error_ratelimit(inode->i_sb)) {
                path = file_path(file, pathname, sizeof(pathname));
                if (IS_ERR(path))
@@ -4340,7 +4338,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
        /* Pre-read the descriptors into the buffer cache */
        for (i = 0; i < db_count; i++) {
                block = descriptor_loc(sb, logical_sb_block, i);
-               sb_breadahead(sb, block);
+               sb_breadahead_unmovable(sb, block);
        }
 
        for (i = 0; i < db_count; i++) {
index 5190bfb..c687f57 100644 (file)
@@ -357,7 +357,6 @@ struct io_timeout_data {
        struct hrtimer                  timer;
        struct timespec64               ts;
        enum hrtimer_mode               mode;
-       u32                             seq_offset;
 };
 
 struct io_accept {
@@ -385,7 +384,7 @@ struct io_timeout {
        struct file                     *file;
        u64                             addr;
        int                             flags;
-       unsigned                        count;
+       u32                             count;
 };
 
 struct io_rw {
@@ -508,6 +507,7 @@ enum {
        REQ_F_FORCE_ASYNC_BIT   = IOSQE_ASYNC_BIT,
        REQ_F_BUFFER_SELECT_BIT = IOSQE_BUFFER_SELECT_BIT,
 
+       REQ_F_LINK_HEAD_BIT,
        REQ_F_LINK_NEXT_BIT,
        REQ_F_FAIL_LINK_BIT,
        REQ_F_INFLIGHT_BIT,
@@ -543,6 +543,8 @@ enum {
        /* IOSQE_BUFFER_SELECT */
        REQ_F_BUFFER_SELECT     = BIT(REQ_F_BUFFER_SELECT_BIT),
 
+       /* head of a link */
+       REQ_F_LINK_HEAD         = BIT(REQ_F_LINK_HEAD_BIT),
        /* already grabbed next link */
        REQ_F_LINK_NEXT         = BIT(REQ_F_LINK_NEXT_BIT),
        /* fail rest of links */
@@ -955,8 +957,8 @@ static inline bool __req_need_defer(struct io_kiocb *req)
 {
        struct io_ring_ctx *ctx = req->ctx;
 
-       return req->sequence != ctx->cached_cq_tail + ctx->cached_sq_dropped
-                                       + atomic_read(&ctx->cached_cq_overflow);
+       return req->sequence != ctx->cached_cq_tail
+                               + atomic_read(&ctx->cached_cq_overflow);
 }
 
 static inline bool req_need_defer(struct io_kiocb *req)
@@ -1437,7 +1439,7 @@ static bool io_link_cancel_timeout(struct io_kiocb *req)
        if (ret != -1) {
                io_cqring_fill_event(req, -ECANCELED);
                io_commit_cqring(ctx);
-               req->flags &= ~REQ_F_LINK;
+               req->flags &= ~REQ_F_LINK_HEAD;
                io_put_req(req);
                return true;
        }
@@ -1473,7 +1475,7 @@ static void io_req_link_next(struct io_kiocb *req, struct io_kiocb **nxtptr)
 
                list_del_init(&req->link_list);
                if (!list_empty(&nxt->link_list))
-                       nxt->flags |= REQ_F_LINK;
+                       nxt->flags |= REQ_F_LINK_HEAD;
                *nxtptr = nxt;
                break;
        }
@@ -1484,7 +1486,7 @@ static void io_req_link_next(struct io_kiocb *req, struct io_kiocb **nxtptr)
 }
 
 /*
- * Called if REQ_F_LINK is set, and we fail the head request
+ * Called if REQ_F_LINK_HEAD is set, and we fail the head request
  */
 static void io_fail_links(struct io_kiocb *req)
 {
@@ -1517,7 +1519,7 @@ static void io_fail_links(struct io_kiocb *req)
 
 static void io_req_find_next(struct io_kiocb *req, struct io_kiocb **nxt)
 {
-       if (likely(!(req->flags & REQ_F_LINK)))
+       if (likely(!(req->flags & REQ_F_LINK_HEAD)))
                return;
 
        /*
@@ -1669,7 +1671,7 @@ static inline unsigned int io_sqring_entries(struct io_ring_ctx *ctx)
 
 static inline bool io_req_multi_free(struct req_batch *rb, struct io_kiocb *req)
 {
-       if ((req->flags & REQ_F_LINK) || io_is_fallback_req(req))
+       if ((req->flags & REQ_F_LINK_HEAD) || io_is_fallback_req(req))
                return false;
 
        if (!(req->flags & REQ_F_FIXED_FILE) || req->io)
@@ -2562,7 +2564,7 @@ static int io_read(struct io_kiocb *req, bool force_nonblock)
 
        req->result = 0;
        io_size = ret;
-       if (req->flags & REQ_F_LINK)
+       if (req->flags & REQ_F_LINK_HEAD)
                req->result = io_size;
 
        /*
@@ -2653,7 +2655,7 @@ static int io_write(struct io_kiocb *req, bool force_nonblock)
 
        req->result = 0;
        io_size = ret;
-       if (req->flags & REQ_F_LINK)
+       if (req->flags & REQ_F_LINK_HEAD)
                req->result = io_size;
 
        /*
@@ -2760,7 +2762,7 @@ static bool io_splice_punt(struct file *file)
                return false;
        if (!io_file_supports_async(file))
                return true;
-       return !(file->f_mode & O_NONBLOCK);
+       return !(file->f_flags & O_NONBLOCK);
 }
 
 static int io_splice(struct io_kiocb *req, bool force_nonblock)
@@ -4153,25 +4155,62 @@ static int __io_async_wake(struct io_kiocb *req, struct io_poll_iocb *poll,
        return 1;
 }
 
+static bool io_poll_rewait(struct io_kiocb *req, struct io_poll_iocb *poll)
+       __acquires(&req->ctx->completion_lock)
+{
+       struct io_ring_ctx *ctx = req->ctx;
+
+       if (!req->result && !READ_ONCE(poll->canceled)) {
+               struct poll_table_struct pt = { ._key = poll->events };
+
+               req->result = vfs_poll(req->file, &pt) & poll->events;
+       }
+
+       spin_lock_irq(&ctx->completion_lock);
+       if (!req->result && !READ_ONCE(poll->canceled)) {
+               add_wait_queue(poll->head, &poll->wait);
+               return true;
+       }
+
+       return false;
+}
+
 static void io_async_task_func(struct callback_head *cb)
 {
        struct io_kiocb *req = container_of(cb, struct io_kiocb, task_work);
        struct async_poll *apoll = req->apoll;
        struct io_ring_ctx *ctx = req->ctx;
+       bool canceled;
 
        trace_io_uring_task_run(req->ctx, req->opcode, req->user_data);
 
-       WARN_ON_ONCE(!list_empty(&req->apoll->poll.wait.entry));
+       if (io_poll_rewait(req, &apoll->poll)) {
+               spin_unlock_irq(&ctx->completion_lock);
+               return;
+       }
 
-       if (hash_hashed(&req->hash_node)) {
-               spin_lock_irq(&ctx->completion_lock);
+       if (hash_hashed(&req->hash_node))
                hash_del(&req->hash_node);
-               spin_unlock_irq(&ctx->completion_lock);
+
+       canceled = READ_ONCE(apoll->poll.canceled);
+       if (canceled) {
+               io_cqring_fill_event(req, -ECANCELED);
+               io_commit_cqring(ctx);
        }
 
+       spin_unlock_irq(&ctx->completion_lock);
+
        /* restore ->work in case we need to retry again */
        memcpy(&req->work, &apoll->work, sizeof(req->work));
 
+       if (canceled) {
+               kfree(apoll);
+               io_cqring_ev_posted(ctx);
+               req_set_fail_links(req);
+               io_double_put_req(req);
+               return;
+       }
+
        __set_current_state(TASK_RUNNING);
        mutex_lock(&ctx->uring_lock);
        __io_queue_sqe(req, NULL);
@@ -4315,11 +4354,13 @@ static bool __io_poll_remove_one(struct io_kiocb *req,
 
 static bool io_poll_remove_one(struct io_kiocb *req)
 {
+       struct async_poll *apoll = NULL;
        bool do_complete;
 
        if (req->opcode == IORING_OP_POLL_ADD) {
                do_complete = __io_poll_remove_one(req, &req->poll);
        } else {
+               apoll = req->apoll;
                /* non-poll requests have submit ref still */
                do_complete = __io_poll_remove_one(req, &req->apoll->poll);
                if (do_complete)
@@ -4328,6 +4369,14 @@ static bool io_poll_remove_one(struct io_kiocb *req)
 
        hash_del(&req->hash_node);
 
+       if (do_complete && apoll) {
+               /*
+                * restore ->work because we need to call io_req_work_drop_env.
+                */
+               memcpy(&req->work, &apoll->work, sizeof(req->work));
+               kfree(apoll);
+       }
+
        if (do_complete) {
                io_cqring_fill_event(req, -ECANCELED);
                io_commit_cqring(req->ctx);
@@ -4342,7 +4391,7 @@ static void io_poll_remove_all(struct io_ring_ctx *ctx)
 {
        struct hlist_node *tmp;
        struct io_kiocb *req;
-       int i;
+       int posted = 0, i;
 
        spin_lock_irq(&ctx->completion_lock);
        for (i = 0; i < (1U << ctx->cancel_hash_bits); i++) {
@@ -4350,11 +4399,12 @@ static void io_poll_remove_all(struct io_ring_ctx *ctx)
 
                list = &ctx->cancel_hash[i];
                hlist_for_each_entry_safe(req, tmp, list, hash_node)
-                       io_poll_remove_one(req);
+                       posted += io_poll_remove_one(req);
        }
        spin_unlock_irq(&ctx->completion_lock);
 
-       io_cqring_ev_posted(ctx);
+       if (posted)
+               io_cqring_ev_posted(ctx);
 }
 
 static int io_poll_cancel(struct io_ring_ctx *ctx, __u64 sqe_addr)
@@ -4423,18 +4473,11 @@ static void io_poll_task_handler(struct io_kiocb *req, struct io_kiocb **nxt)
        struct io_ring_ctx *ctx = req->ctx;
        struct io_poll_iocb *poll = &req->poll;
 
-       if (!req->result && !READ_ONCE(poll->canceled)) {
-               struct poll_table_struct pt = { ._key = poll->events };
-
-               req->result = vfs_poll(req->file, &pt) & poll->events;
-       }
-
-       spin_lock_irq(&ctx->completion_lock);
-       if (!req->result && !READ_ONCE(poll->canceled)) {
-               add_wait_queue(poll->head, &poll->wait);
+       if (io_poll_rewait(req, poll)) {
                spin_unlock_irq(&ctx->completion_lock);
                return;
        }
+
        hash_del(&req->hash_node);
        io_poll_complete(req, req->result, 0);
        req->flags |= REQ_F_COMP_LOCKED;
@@ -4665,11 +4708,12 @@ static int io_timeout_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe,
 
 static int io_timeout(struct io_kiocb *req)
 {
-       unsigned count;
        struct io_ring_ctx *ctx = req->ctx;
        struct io_timeout_data *data;
        struct list_head *entry;
        unsigned span = 0;
+       u32 count = req->timeout.count;
+       u32 seq = req->sequence;
 
        data = &req->io->timeout;
 
@@ -4678,7 +4722,6 @@ static int io_timeout(struct io_kiocb *req)
         * timeout event to be satisfied. If it isn't set, then this is
         * a pure timeout request, sequence isn't used.
         */
-       count = req->timeout.count;
        if (!count) {
                req->flags |= REQ_F_TIMEOUT_NOSEQ;
                spin_lock_irq(&ctx->completion_lock);
@@ -4686,8 +4729,7 @@ static int io_timeout(struct io_kiocb *req)
                goto add;
        }
 
-       req->sequence = ctx->cached_sq_head + count - 1;
-       data->seq_offset = count;
+       req->sequence = seq + count;
 
        /*
         * Insertion sort, ensuring the first entry in the list is always
@@ -4696,26 +4738,26 @@ static int io_timeout(struct io_kiocb *req)
        spin_lock_irq(&ctx->completion_lock);
        list_for_each_prev(entry, &ctx->timeout_list) {
                struct io_kiocb *nxt = list_entry(entry, struct io_kiocb, list);
-               unsigned nxt_sq_head;
+               unsigned nxt_seq;
                long long tmp, tmp_nxt;
-               u32 nxt_offset = nxt->io->timeout.seq_offset;
+               u32 nxt_offset = nxt->timeout.count;
 
                if (nxt->flags & REQ_F_TIMEOUT_NOSEQ)
                        continue;
 
                /*
-                * Since cached_sq_head + count - 1 can overflow, use type long
+                * Since seq + count can overflow, use type long
                 * long to store it.
                 */
-               tmp = (long long)ctx->cached_sq_head + count - 1;
-               nxt_sq_head = nxt->sequence - nxt_offset + 1;
-               tmp_nxt = (long long)nxt_sq_head + nxt_offset - 1;
+               tmp = (long long)seq + count;
+               nxt_seq = nxt->sequence - nxt_offset;
+               tmp_nxt = (long long)nxt_seq + nxt_offset;
 
                /*
                 * cached_sq_head may overflow, and it will never overflow twice
                 * once there is some timeout req still be valid.
                 */
-               if (ctx->cached_sq_head < nxt_sq_head)
+               if (seq < nxt_seq)
                        tmp += UINT_MAX;
 
                if (tmp > tmp_nxt)
@@ -5476,7 +5518,7 @@ static struct io_kiocb *io_prep_linked_timeout(struct io_kiocb *req)
 {
        struct io_kiocb *nxt;
 
-       if (!(req->flags & REQ_F_LINK))
+       if (!(req->flags & REQ_F_LINK_HEAD))
                return NULL;
        /* for polled retry, if flag is set, we already went through here */
        if (req->flags & REQ_F_POLLED)
@@ -5604,54 +5646,11 @@ static inline void io_queue_link_head(struct io_kiocb *req)
                io_queue_sqe(req, NULL);
 }
 
-#define SQE_VALID_FLAGS        (IOSQE_FIXED_FILE|IOSQE_IO_DRAIN|IOSQE_IO_LINK| \
-                               IOSQE_IO_HARDLINK | IOSQE_ASYNC | \
-                               IOSQE_BUFFER_SELECT)
-
-static bool io_submit_sqe(struct io_kiocb *req, const struct io_uring_sqe *sqe,
+static int io_submit_sqe(struct io_kiocb *req, const struct io_uring_sqe *sqe,
                          struct io_submit_state *state, struct io_kiocb **link)
 {
        struct io_ring_ctx *ctx = req->ctx;
-       unsigned int sqe_flags;
-       int ret, id, fd;
-
-       sqe_flags = READ_ONCE(sqe->flags);
-
-       /* enforce forwards compatibility on users */
-       if (unlikely(sqe_flags & ~SQE_VALID_FLAGS)) {
-               ret = -EINVAL;
-               goto err_req;
-       }
-
-       if ((sqe_flags & IOSQE_BUFFER_SELECT) &&
-           !io_op_defs[req->opcode].buffer_select) {
-               ret = -EOPNOTSUPP;
-               goto err_req;
-       }
-
-       id = READ_ONCE(sqe->personality);
-       if (id) {
-               req->work.creds = idr_find(&ctx->personality_idr, id);
-               if (unlikely(!req->work.creds)) {
-                       ret = -EINVAL;
-                       goto err_req;
-               }
-               get_cred(req->work.creds);
-       }
-
-       /* same numerical values with corresponding REQ_F_*, safe to copy */
-       req->flags |= sqe_flags & (IOSQE_IO_DRAIN | IOSQE_IO_HARDLINK |
-                                       IOSQE_ASYNC | IOSQE_FIXED_FILE |
-                                       IOSQE_BUFFER_SELECT);
-
-       fd = READ_ONCE(sqe->fd);
-       ret = io_req_set_file(state, req, fd, sqe_flags);
-       if (unlikely(ret)) {
-err_req:
-               io_cqring_add_event(req, ret);
-               io_double_put_req(req);
-               return false;
-       }
+       int ret;
 
        /*
         * If we already have a head request, queue this one for async
@@ -5670,42 +5669,39 @@ err_req:
                 * next after the link request. The last one is done via
                 * drain_next flag to persist the effect across calls.
                 */
-               if (sqe_flags & IOSQE_IO_DRAIN) {
+               if (req->flags & REQ_F_IO_DRAIN) {
                        head->flags |= REQ_F_IO_DRAIN;
                        ctx->drain_next = 1;
                }
-               if (io_alloc_async_ctx(req)) {
-                       ret = -EAGAIN;
-                       goto err_req;
-               }
+               if (io_alloc_async_ctx(req))
+                       return -EAGAIN;
 
                ret = io_req_defer_prep(req, sqe);
                if (ret) {
                        /* fail even hard links since we don't submit */
                        head->flags |= REQ_F_FAIL_LINK;
-                       goto err_req;
+                       return ret;
                }
                trace_io_uring_link(ctx, req, head);
                list_add_tail(&req->link_list, &head->link_list);
 
                /* last request of a link, enqueue the link */
-               if (!(sqe_flags & (IOSQE_IO_LINK|IOSQE_IO_HARDLINK))) {
+               if (!(req->flags & (REQ_F_LINK | REQ_F_HARDLINK))) {
                        io_queue_link_head(head);
                        *link = NULL;
                }
        } else {
                if (unlikely(ctx->drain_next)) {
                        req->flags |= REQ_F_IO_DRAIN;
-                       req->ctx->drain_next = 0;
+                       ctx->drain_next = 0;
                }
-               if (sqe_flags & (IOSQE_IO_LINK|IOSQE_IO_HARDLINK)) {
-                       req->flags |= REQ_F_LINK;
+               if (req->flags & (REQ_F_LINK | REQ_F_HARDLINK)) {
+                       req->flags |= REQ_F_LINK_HEAD;
                        INIT_LIST_HEAD(&req->link_list);
 
-                       if (io_alloc_async_ctx(req)) {
-                               ret = -EAGAIN;
-                               goto err_req;
-                       }
+                       if (io_alloc_async_ctx(req))
+                               return -EAGAIN;
+
                        ret = io_req_defer_prep(req, sqe);
                        if (ret)
                                req->flags |= REQ_F_FAIL_LINK;
@@ -5715,7 +5711,7 @@ err_req:
                }
        }
 
-       return true;
+       return 0;
 }
 
 /*
@@ -5789,15 +5785,23 @@ static inline void io_consume_sqe(struct io_ring_ctx *ctx)
        ctx->cached_sq_head++;
 }
 
-static void io_init_req(struct io_ring_ctx *ctx, struct io_kiocb *req,
-                       const struct io_uring_sqe *sqe)
+#define SQE_VALID_FLAGS        (IOSQE_FIXED_FILE|IOSQE_IO_DRAIN|IOSQE_IO_LINK| \
+                               IOSQE_IO_HARDLINK | IOSQE_ASYNC | \
+                               IOSQE_BUFFER_SELECT)
+
+static int io_init_req(struct io_ring_ctx *ctx, struct io_kiocb *req,
+                      const struct io_uring_sqe *sqe,
+                      struct io_submit_state *state, bool async)
 {
+       unsigned int sqe_flags;
+       int id, fd;
+
        /*
         * All io need record the previous position, if LINK vs DARIN,
         * it can be used to mark the position of the first IO in the
         * link list.
         */
-       req->sequence = ctx->cached_sq_head;
+       req->sequence = ctx->cached_sq_head - ctx->cached_sq_dropped;
        req->opcode = READ_ONCE(sqe->opcode);
        req->user_data = READ_ONCE(sqe->user_data);
        req->io = NULL;
@@ -5808,17 +5812,50 @@ static void io_init_req(struct io_ring_ctx *ctx, struct io_kiocb *req,
        refcount_set(&req->refs, 2);
        req->task = NULL;
        req->result = 0;
+       req->needs_fixed_file = async;
        INIT_IO_WORK(&req->work, io_wq_submit_work);
+
+       if (unlikely(req->opcode >= IORING_OP_LAST))
+               return -EINVAL;
+
+       if (io_op_defs[req->opcode].needs_mm && !current->mm) {
+               if (unlikely(!mmget_not_zero(ctx->sqo_mm)))
+                       return -EFAULT;
+               use_mm(ctx->sqo_mm);
+       }
+
+       sqe_flags = READ_ONCE(sqe->flags);
+       /* enforce forwards compatibility on users */
+       if (unlikely(sqe_flags & ~SQE_VALID_FLAGS))
+               return -EINVAL;
+
+       if ((sqe_flags & IOSQE_BUFFER_SELECT) &&
+           !io_op_defs[req->opcode].buffer_select)
+               return -EOPNOTSUPP;
+
+       id = READ_ONCE(sqe->personality);
+       if (id) {
+               req->work.creds = idr_find(&ctx->personality_idr, id);
+               if (unlikely(!req->work.creds))
+                       return -EINVAL;
+               get_cred(req->work.creds);
+       }
+
+       /* same numerical values with corresponding REQ_F_*, safe to copy */
+       req->flags |= sqe_flags & (IOSQE_IO_DRAIN | IOSQE_IO_HARDLINK |
+                                       IOSQE_ASYNC | IOSQE_FIXED_FILE |
+                                       IOSQE_BUFFER_SELECT | IOSQE_IO_LINK);
+
+       fd = READ_ONCE(sqe->fd);
+       return io_req_set_file(state, req, fd, sqe_flags);
 }
 
 static int io_submit_sqes(struct io_ring_ctx *ctx, unsigned int nr,
-                         struct file *ring_file, int ring_fd,
-                         struct mm_struct **mm, bool async)
+                         struct file *ring_file, int ring_fd, bool async)
 {
        struct io_submit_state state, *statep = NULL;
        struct io_kiocb *link = NULL;
        int i, submitted = 0;
-       bool mm_fault = false;
 
        /* if we have a backlog and couldn't flush it all, return BUSY */
        if (test_bit(0, &ctx->sq_check_overflow)) {
@@ -5858,34 +5895,23 @@ static int io_submit_sqes(struct io_ring_ctx *ctx, unsigned int nr,
                        break;
                }
 
-               io_init_req(ctx, req, sqe);
+               err = io_init_req(ctx, req, sqe, statep, async);
                io_consume_sqe(ctx);
                /* will complete beyond this point, count as submitted */
                submitted++;
 
-               if (unlikely(req->opcode >= IORING_OP_LAST)) {
-                       err = -EINVAL;
+               if (unlikely(err)) {
 fail_req:
                        io_cqring_add_event(req, err);
                        io_double_put_req(req);
                        break;
                }
 
-               if (io_op_defs[req->opcode].needs_mm && !*mm) {
-                       mm_fault = mm_fault || !mmget_not_zero(ctx->sqo_mm);
-                       if (unlikely(mm_fault)) {
-                               err = -EFAULT;
-                               goto fail_req;
-                       }
-                       use_mm(ctx->sqo_mm);
-                       *mm = ctx->sqo_mm;
-               }
-
-               req->needs_fixed_file = async;
                trace_io_uring_submit_sqe(ctx, req->opcode, req->user_data,
                                                true, async);
-               if (!io_submit_sqe(req, sqe, statep, &link))
-                       break;
+               err = io_submit_sqe(req, sqe, statep, &link);
+               if (err)
+                       goto fail_req;
        }
 
        if (unlikely(submitted != nr)) {
@@ -5904,10 +5930,19 @@ fail_req:
        return submitted;
 }
 
+static inline void io_sq_thread_drop_mm(struct io_ring_ctx *ctx)
+{
+       struct mm_struct *mm = current->mm;
+
+       if (mm) {
+               unuse_mm(mm);
+               mmput(mm);
+       }
+}
+
 static int io_sq_thread(void *data)
 {
        struct io_ring_ctx *ctx = data;
-       struct mm_struct *cur_mm = NULL;
        const struct cred *old_cred;
        mm_segment_t old_fs;
        DEFINE_WAIT(wait);
@@ -5948,11 +5983,7 @@ static int io_sq_thread(void *data)
                         * adding ourselves to the waitqueue, as the unuse/drop
                         * may sleep.
                         */
-                       if (cur_mm) {
-                               unuse_mm(cur_mm);
-                               mmput(cur_mm);
-                               cur_mm = NULL;
-                       }
+                       io_sq_thread_drop_mm(ctx);
 
                        /*
                         * We're polling. If we're within the defined idle
@@ -6016,7 +6047,7 @@ static int io_sq_thread(void *data)
                }
 
                mutex_lock(&ctx->uring_lock);
-               ret = io_submit_sqes(ctx, to_submit, NULL, -1, &cur_mm, true);
+               ret = io_submit_sqes(ctx, to_submit, NULL, -1, true);
                mutex_unlock(&ctx->uring_lock);
                timeout = jiffies + ctx->sq_thread_idle;
        }
@@ -6025,10 +6056,7 @@ static int io_sq_thread(void *data)
                task_work_run();
 
        set_fs(old_fs);
-       if (cur_mm) {
-               unuse_mm(cur_mm);
-               mmput(cur_mm);
-       }
+       io_sq_thread_drop_mm(ctx);
        revert_creds(old_cred);
 
        kthread_parkme();
@@ -7509,13 +7537,8 @@ SYSCALL_DEFINE6(io_uring_enter, unsigned int, fd, u32, to_submit,
                        wake_up(&ctx->sqo_wait);
                submitted = to_submit;
        } else if (to_submit) {
-               struct mm_struct *cur_mm;
-
                mutex_lock(&ctx->uring_lock);
-               /* already have mm, so io_submit_sqes() won't try to grab it */
-               cur_mm = ctx->sqo_mm;
-               submitted = io_submit_sqes(ctx, to_submit, f.file, fd,
-                                          &cur_mm, false);
+               submitted = io_submit_sqes(ctx, to_submit, f.file, fd, false);
                mutex_unlock(&ctx->uring_lock);
 
                if (submitted != to_submit)
index f2dc35c..b8d78f3 100644 (file)
@@ -2023,6 +2023,7 @@ lookup_again:
                        goto lookup_again;
                }
 
+               spin_unlock(&ino->i_lock);
                first = true;
                status = nfs4_select_rw_stateid(ctx->state,
                                        iomode == IOMODE_RW ? FMODE_WRITE : FMODE_READ,
@@ -2032,12 +2033,12 @@ lookup_again:
                        trace_pnfs_update_layout(ino, pos, count,
                                        iomode, lo, lseg,
                                        PNFS_UPDATE_LAYOUT_INVALID_OPEN);
-                       spin_unlock(&ino->i_lock);
                        nfs4_schedule_stateid_recovery(server, ctx->state);
                        pnfs_clear_first_layoutget(lo);
                        pnfs_put_layout_hdr(lo);
                        goto lookup_again;
                }
+               spin_lock(&ino->i_lock);
        } else {
                nfs4_stateid_copy(&stateid, &lo->plh_stateid);
        }
index c3b11a7..5cf9132 100644 (file)
@@ -1312,6 +1312,7 @@ nfsd4_run_cb_work(struct work_struct *work)
                container_of(work, struct nfsd4_callback, cb_work);
        struct nfs4_client *clp = cb->cb_clp;
        struct rpc_clnt *clnt;
+       int flags;
 
        if (cb->cb_need_restart) {
                cb->cb_need_restart = false;
@@ -1340,7 +1341,8 @@ nfsd4_run_cb_work(struct work_struct *work)
        }
 
        cb->cb_msg.rpc_cred = clp->cl_cb_cred;
-       rpc_call_async(clnt, &cb->cb_msg, RPC_TASK_SOFT | RPC_TASK_SOFTCONN,
+       flags = clp->cl_minorversion ? RPC_TASK_NOCONNECT : RPC_TASK_SOFTCONN;
+       rpc_call_async(clnt, &cb->cb_msg, RPC_TASK_SOFT | flags,
                        cb->cb_ops ? &nfsd4_cb_ops : &nfsd4_cb_probe_ops, cb);
 }
 
index e32eced..c107caa 100644 (file)
@@ -267,6 +267,8 @@ find_or_allocate_block(struct nfs4_lockowner *lo, struct knfsd_fh *fh,
        if (!nbl) {
                nbl= kmalloc(sizeof(*nbl), GFP_KERNEL);
                if (nbl) {
+                       INIT_LIST_HEAD(&nbl->nbl_list);
+                       INIT_LIST_HEAD(&nbl->nbl_lru);
                        fh_copy_shallow(&nbl->nbl_fh, fh);
                        locks_init_lock(&nbl->nbl_lock);
                        nfsd4_init_cb(&nbl->nbl_cb, lo->lo_owner.so_client,
index 6042b64..572898d 100644 (file)
@@ -1573,6 +1573,7 @@ static ssize_t timens_offsets_write(struct file *file, const char __user *buf,
        noffsets = 0;
        for (pos = kbuf; pos; pos = next_line) {
                struct proc_timens_offset *off = &offsets[noffsets];
+               char clock[10];
                int err;
 
                /* Find the end of line and ensure we don't look past it */
@@ -1584,10 +1585,21 @@ static ssize_t timens_offsets_write(struct file *file, const char __user *buf,
                                next_line = NULL;
                }
 
-               err = sscanf(pos, "%u %lld %lu", &off->clockid,
+               err = sscanf(pos, "%9s %lld %lu", clock,
                                &off->val.tv_sec, &off->val.tv_nsec);
                if (err != 3 || off->val.tv_nsec >= NSEC_PER_SEC)
                        goto out;
+
+               clock[sizeof(clock) - 1] = 0;
+               if (strcmp(clock, "monotonic") == 0 ||
+                   strcmp(clock, __stringify(CLOCK_MONOTONIC)) == 0)
+                       off->clockid = CLOCK_MONOTONIC;
+               else if (strcmp(clock, "boottime") == 0 ||
+                        strcmp(clock, __stringify(CLOCK_BOOTTIME)) == 0)
+                       off->clockid = CLOCK_BOOTTIME;
+               else
+                       goto out;
+
                noffsets++;
                if (noffsets == ARRAY_SIZE(offsets)) {
                        if (next_line)
index 2633f10..cdbe929 100644 (file)
@@ -196,6 +196,13 @@ static void proc_kill_sb(struct super_block *sb)
        if (ns->proc_thread_self)
                dput(ns->proc_thread_self);
        kill_anon_super(sb);
+
+       /* Make the pid namespace safe for the next mount of proc */
+       ns->proc_self = NULL;
+       ns->proc_thread_self = NULL;
+       ns->pid_gid = GLOBAL_ROOT_GID;
+       ns->hide_pid = 0;
+
        put_pid_ns(ns);
 }
 
index 7dc800c..c663202 100644 (file)
@@ -266,7 +266,8 @@ static int vmcoredd_mmap_dumps(struct vm_area_struct *vma, unsigned long dst,
                if (start < offset + dump->size) {
                        tsz = min(offset + (u64)dump->size - start, (u64)size);
                        buf = dump->buf + start - offset;
-                       if (remap_vmalloc_range_partial(vma, dst, buf, tsz)) {
+                       if (remap_vmalloc_range_partial(vma, dst, buf, 0,
+                                                       tsz)) {
                                ret = -EFAULT;
                                goto out_unlock;
                        }
@@ -624,7 +625,7 @@ static int mmap_vmcore(struct file *file, struct vm_area_struct *vma)
                tsz = min(elfcorebuf_sz + elfnotes_sz - (size_t)start, size);
                kaddr = elfnotes_buf + start - elfcorebuf_sz - vmcoredd_orig_sz;
                if (remap_vmalloc_range_partial(vma, vma->vm_start + len,
-                                               kaddr, tsz))
+                                               kaddr, 0, tsz))
                        goto fail;
 
                size -= tsz;
index a7be7a9..8bf1d15 100644 (file)
@@ -911,7 +911,12 @@ xfs_eofblocks_worker(
 {
        struct xfs_mount *mp = container_of(to_delayed_work(work),
                                struct xfs_mount, m_eofblocks_work);
+
+       if (!sb_start_write_trylock(mp->m_super))
+               return;
        xfs_icache_free_eofblocks(mp, NULL);
+       sb_end_write(mp->m_super);
+
        xfs_queue_eofblocks(mp);
 }
 
@@ -938,7 +943,12 @@ xfs_cowblocks_worker(
 {
        struct xfs_mount *mp = container_of(to_delayed_work(work),
                                struct xfs_mount, m_cowblocks_work);
+
+       if (!sb_start_write_trylock(mp->m_super))
+               return;
        xfs_icache_free_cowblocks(mp, NULL);
+       sb_end_write(mp->m_super);
+
        xfs_queue_cowblocks(mp);
 }
 
index cdfb3cd..3099581 100644 (file)
@@ -2363,7 +2363,10 @@ xfs_file_ioctl(
                if (error)
                        return error;
 
-               return xfs_icache_free_eofblocks(mp, &keofb);
+               sb_start_write(mp->m_super);
+               error = xfs_icache_free_eofblocks(mp, &keofb);
+               sb_end_write(mp->m_super);
+               return error;
        }
 
        default:
index 50c4342..b2e4598 100644 (file)
@@ -167,8 +167,12 @@ typedef struct xfs_mount {
        struct xfs_kobj         m_error_meta_kobj;
        struct xfs_error_cfg    m_error_cfg[XFS_ERR_CLASS_MAX][XFS_ERR_ERRNO_MAX];
        struct xstats           m_stats;        /* per-fs stats */
-       struct ratelimit_state  m_flush_inodes_ratelimit;
 
+       /*
+        * Workqueue item so that we can coalesce multiple inode flush attempts
+        * into a single flush.
+        */
+       struct work_struct      m_flush_inodes_work;
        struct workqueue_struct *m_buf_workqueue;
        struct workqueue_struct *m_unwritten_workqueue;
        struct workqueue_struct *m_cil_workqueue;
index b0ce04f..107bf2a 100644 (file)
@@ -1051,6 +1051,7 @@ xfs_reflink_remap_extent(
                uirec.br_startblock = irec->br_startblock + rlen;
                uirec.br_startoff = irec->br_startoff + rlen;
                uirec.br_blockcount = unmap_len - rlen;
+               uirec.br_state = irec->br_state;
                unmap_len = rlen;
 
                /* If this isn't a real mapping, we're done. */
index abf06bf..424bb9a 100644 (file)
@@ -516,6 +516,20 @@ xfs_destroy_mount_workqueues(
        destroy_workqueue(mp->m_buf_workqueue);
 }
 
+static void
+xfs_flush_inodes_worker(
+       struct work_struct      *work)
+{
+       struct xfs_mount        *mp = container_of(work, struct xfs_mount,
+                                                  m_flush_inodes_work);
+       struct super_block      *sb = mp->m_super;
+
+       if (down_read_trylock(&sb->s_umount)) {
+               sync_inodes_sb(sb);
+               up_read(&sb->s_umount);
+       }
+}
+
 /*
  * Flush all dirty data to disk. Must not be called while holding an XFS_ILOCK
  * or a page lock. We use sync_inodes_sb() here to ensure we block while waiting
@@ -526,15 +540,15 @@ void
 xfs_flush_inodes(
        struct xfs_mount        *mp)
 {
-       struct super_block      *sb = mp->m_super;
-
-       if (!__ratelimit(&mp->m_flush_inodes_ratelimit))
+       /*
+        * If flush_work() returns true then that means we waited for a flush
+        * which was already in progress.  Don't bother running another scan.
+        */
+       if (flush_work(&mp->m_flush_inodes_work))
                return;
 
-       if (down_read_trylock(&sb->s_umount)) {
-               sync_inodes_sb(sb);
-               up_read(&sb->s_umount);
-       }
+       queue_work(mp->m_sync_workqueue, &mp->m_flush_inodes_work);
+       flush_work(&mp->m_flush_inodes_work);
 }
 
 /* Catch misguided souls that try to use this interface on XFS */
@@ -1369,17 +1383,6 @@ xfs_fc_fill_super(
        if (error)
                goto out_free_names;
 
-       /*
-        * Cap the number of invocations of xfs_flush_inodes to 16 for every
-        * quarter of a second.  The magic numbers here were determined by
-        * observation neither to cause stalls in writeback when there are a
-        * lot of IO threads and the fs is near ENOSPC, nor cause any fstest
-        * regressions.  YMMV.
-        */
-       ratelimit_state_init(&mp->m_flush_inodes_ratelimit, HZ / 4, 16);
-       ratelimit_set_flags(&mp->m_flush_inodes_ratelimit,
-                       RATELIMIT_MSG_ON_RELEASE);
-
        error = xfs_init_mount_workqueues(mp);
        if (error)
                goto out_close_devices;
@@ -1752,6 +1755,7 @@ static int xfs_init_fs_context(
        spin_lock_init(&mp->m_perag_lock);
        mutex_init(&mp->m_growlock);
        atomic_set(&mp->m_active_trans, 0);
+       INIT_WORK(&mp->m_flush_inodes_work, xfs_flush_inodes_worker);
        INIT_DELAYED_WORK(&mp->m_reclaim_work, xfs_reclaim_worker);
        INIT_DELAYED_WORK(&mp->m_eofblocks_work, xfs_eofblocks_worker);
        INIT_DELAYED_WORK(&mp->m_cowblocks_work, xfs_cowblocks_worker);
index 36341df..44ec80e 100644 (file)
@@ -56,6 +56,7 @@ mandatory-y += topology.h
 mandatory-y += trace_clock.h
 mandatory-y += uaccess.h
 mandatory-y += unaligned.h
+mandatory-y += vermagic.h
 mandatory-y += vga.h
 mandatory-y += word-at-a-time.h
 mandatory-y += xor.h
diff --git a/include/asm-generic/vermagic.h b/include/asm-generic/vermagic.h
new file mode 100644 (file)
index 0000000..084274a
--- /dev/null
@@ -0,0 +1,7 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+#ifndef _ASM_GENERIC_VERMAGIC_H
+#define _ASM_GENERIC_VERMAGIC_H
+
+#define MODULE_ARCH_VERMAGIC ""
+
+#endif /* _ASM_GENERIC_VERMAGIC_H */
index 4fc87de..ee577a8 100644 (file)
@@ -54,7 +54,6 @@ enum wb_reason {
        WB_REASON_SYNC,
        WB_REASON_PERIODIC,
        WB_REASON_LAPTOP_TIMER,
-       WB_REASON_FREE_MORE_MEM,
        WB_REASON_FS_FREE_SPACE,
        /*
         * There is no bdi forker thread any more and works are done
index c1c0f9e..a0ee494 100644 (file)
@@ -319,7 +319,7 @@ struct bio_integrity_payload {
        struct work_struct      bip_work;       /* I/O completion */
 
        struct bio_vec          *bip_vec;
-       struct bio_vec          bip_inline_vecs[0];/* embedded bvec array */
+       struct bio_vec          bip_inline_vecs[];/* embedded bvec array */
 };
 
 #if defined(CONFIG_BLK_DEV_INTEGRITY)
index f389d7c..b45148b 100644 (file)
@@ -173,7 +173,7 @@ struct blk_mq_hw_ctx {
         * blocking (BLK_MQ_F_BLOCKING). Must be the last member - see also
         * blk_mq_hw_ctx_size().
         */
-       struct srcu_struct      srcu[0];
+       struct srcu_struct      srcu[];
 };
 
 /**
index 70254ae..31eb928 100644 (file)
@@ -198,7 +198,7 @@ struct bio {
         * double allocations for a small number of bio_vecs. This member
         * MUST obviously be kept at the very end of the bio.
         */
-       struct bio_vec          bi_inline_vecs[0];
+       struct bio_vec          bi_inline_vecs[];
 };
 
 #define BIO_RESET_BYTES                offsetof(struct bio, bi_max_vecs)
index e0b020e..15b765a 100644 (file)
@@ -189,6 +189,8 @@ struct buffer_head *__getblk_gfp(struct block_device *bdev, sector_t block,
 void __brelse(struct buffer_head *);
 void __bforget(struct buffer_head *);
 void __breadahead(struct block_device *, sector_t block, unsigned int size);
+void __breadahead_gfp(struct block_device *, sector_t block, unsigned int size,
+                 gfp_t gfp);
 struct buffer_head *__bread_gfp(struct block_device *,
                                sector_t block, unsigned size, gfp_t gfp);
 void invalidate_bh_lrus(void);
@@ -319,6 +321,12 @@ sb_breadahead(struct super_block *sb, sector_t block)
        __breadahead(sb->s_bdev, block, sb->s_blocksize);
 }
 
+static inline void
+sb_breadahead_unmovable(struct super_block *sb, sector_t block)
+{
+       __breadahead_gfp(sb->s_bdev, block, sb->s_blocksize, 0);
+}
+
 static inline struct buffer_head *
 sb_getblk(struct super_block *sb, sector_t block)
 {
index 511a373..5fd627e 100644 (file)
@@ -189,7 +189,7 @@ struct __packed pucan_rx_msg {
        u8      client;
        __le16  flags;
        __le32  can_id;
-       u8      d[0];
+       u8      d[];
 };
 
 /* uCAN error types */
@@ -266,7 +266,7 @@ struct __packed pucan_tx_msg {
        u8      client;
        __le16  flags;
        __le32  can_id;
-       u8      d[0];
+       u8      d[];
 };
 
 /* build the cmd opcode_channel field with respect to the correct endianness */
index 02edeaf..be8aea0 100644 (file)
@@ -28,7 +28,7 @@ struct cpu_rmap {
        struct {
                u16     index;
                u16     dist;
-       }               near[0];
+       }               near[];
 };
 #define CPU_RMAP_DIST_INF 0xffff
 
index 594fc66..2ace69e 100644 (file)
@@ -29,7 +29,7 @@ struct pubkey_hdr {
        uint32_t        timestamp;      /* key made, always 0 for now */
        uint8_t         algo;
        uint8_t         nmpi;
-       char            mpi[0];
+       char            mpi[];
 } __packed;
 
 struct signature_hdr {
@@ -39,7 +39,7 @@ struct signature_hdr {
        uint8_t         hash;
        uint8_t         keyid[8];
        uint8_t         nmpi;
-       char            mpi[0];
+       char            mpi[];
 } __packed;
 
 #if defined(CONFIG_SIGNATURE) || defined(CONFIG_SIGNATURE_MODULE)
index fc61f3c..9900222 100644 (file)
@@ -7,7 +7,7 @@ struct linux_dirent64 {
        s64             d_off;
        unsigned short  d_reclen;
        unsigned char   d_type;
-       char            d_name[0];
+       char            d_name[];
 };
 
 #endif
index 564e96f..1c630e2 100644 (file)
@@ -101,7 +101,7 @@ struct enclosure_device {
        struct device edev;
        struct enclosure_component_callbacks *cb;
        int components;
-       struct enclosure_component component[0];
+       struct enclosure_component component[];
 };
 
 static inline struct enclosure_device *
index d249b88..ade6486 100644 (file)
@@ -36,7 +36,7 @@ struct em_cap_state {
 struct em_perf_domain {
        struct em_cap_state *table;
        int nr_cap_states;
-       unsigned long cpus[0];
+       unsigned long cpus[];
 };
 
 #ifdef CONFIG_ENERGY_MODEL
index c1d379b..a23b26e 100644 (file)
@@ -35,7 +35,7 @@ struct compat_ethtool_rxnfc {
        compat_u64                      data;
        struct compat_ethtool_rx_flow_spec fs;
        u32                             rule_cnt;
-       u32                             rule_locs[0];
+       u32                             rule_locs[];
 };
 
 #endif /* CONFIG_COMPAT */
@@ -462,7 +462,7 @@ int ethtool_check_ops(const struct ethtool_ops *ops);
 
 struct ethtool_rx_flow_rule {
        struct flow_rule        *rule;
-       unsigned long           priv[0];
+       unsigned long           priv[];
 };
 
 struct ethtool_rx_flow_spec_input {
index 5b14a0f..0bd5810 100644 (file)
@@ -76,7 +76,7 @@ struct gen_pool_chunk {
        void *owner;                    /* private data to retrieve at alloc time */
        unsigned long start_addr;       /* start address of memory chunk */
        unsigned long end_addr;         /* end address of memory chunk (inclusive) */
-       unsigned long bits[0];          /* bitmap for allocating memory chunk */
+       unsigned long bits[];           /* bitmap for allocating memory chunk */
 };
 
 /*
index 456fc17..45d36ba 100644 (file)
@@ -461,12 +461,6 @@ i2c_new_scanned_device(struct i2c_adapter *adap,
                       unsigned short const *addr_list,
                       int (*probe)(struct i2c_adapter *adap, unsigned short addr));
 
-struct i2c_client *
-i2c_new_probed_device(struct i2c_adapter *adap,
-                      struct i2c_board_info *info,
-                      unsigned short const *addr_list,
-                      int (*probe)(struct i2c_adapter *adap, unsigned short addr));
-
 /* Common custom probe functions */
 int i2c_probe_func_quick_read(struct i2c_adapter *adap, unsigned short addr);
 
index 463047d..faa6586 100644 (file)
@@ -38,7 +38,7 @@ struct ip_sf_socklist {
        unsigned int            sl_max;
        unsigned int            sl_count;
        struct rcu_head         rcu;
-       __be32                  sl_addr[0];
+       __be32                  sl_addr[];
 };
 
 #define IP_SFLSIZE(count)      (sizeof(struct ip_sf_socklist) + \
index 98cb5ce..b824877 100644 (file)
@@ -18,7 +18,7 @@
 struct ihex_binrec {
        __be32 addr;
        __be16 len;
-       uint8_t data[0];
+       uint8_t data[];
 } __attribute__((packed));
 
 static inline uint16_t ihex_binrec_size(const struct ihex_binrec *p)
index 9315fbb..8d5bc2c 100644 (file)
@@ -573,8 +573,6 @@ enum {
 #define IRQ_DEFAULT_INIT_FLAGS ARCH_IRQ_INIT_FLAGS
 
 struct irqaction;
-extern int setup_irq(unsigned int irq, struct irqaction *new);
-extern void remove_irq(unsigned int irq, struct irqaction *act);
 extern int setup_percpu_irq(unsigned int irq, struct irqaction *new);
 extern void remove_percpu_irq(unsigned int irq, struct irqaction *act);
 
@@ -1043,7 +1041,7 @@ struct irq_chip_generic {
        unsigned long           unused;
        struct irq_domain       *domain;
        struct list_head        list;
-       struct irq_chip_type    chip_types[0];
+       struct irq_chip_type    chip_types[];
 };
 
 /**
@@ -1079,7 +1077,7 @@ struct irq_domain_chip_generic {
        unsigned int            irq_flags_to_clear;
        unsigned int            irq_flags_to_set;
        enum irq_gc_flags       gc_flags;
-       struct irq_chip_generic *gc[0];
+       struct irq_chip_generic *gc[];
 };
 
 /* Generic chip callback functions */
index 765d9b7..6c36b6c 100644 (file)
 
 #define GICR_TYPER_PLPIS               (1U << 0)
 #define GICR_TYPER_VLPIS               (1U << 1)
+#define GICR_TYPER_DIRTY               (1U << 2)
 #define GICR_TYPER_DirectLPIS          (1U << 3)
 #define GICR_TYPER_LAST                        (1U << 4)
 #define GICR_TYPER_RVPEID              (1U << 7)
@@ -686,6 +687,7 @@ struct rdists {
        bool                    has_vlpis;
        bool                    has_rvpeid;
        bool                    has_direct_lpi;
+       bool                    has_vpend_valid_dirty;
 };
 
 struct irq_domain;
index 6d58beb..01276e3 100644 (file)
@@ -1048,7 +1048,7 @@ search_memslots(struct kvm_memslots *slots, gfn_t gfn)
                        start = slot + 1;
        }
 
-       if (gfn >= memslots[start].base_gfn &&
+       if (start < slots->used_slots && gfn >= memslots[start].base_gfn &&
            gfn < memslots[start].base_gfn + memslots[start].npages) {
                atomic_set(&slots->lru_slot, start);
                return &memslots[start];
index d5ceb28..9dcaa3e 100644 (file)
@@ -34,7 +34,7 @@ struct list_lru_one {
 struct list_lru_memcg {
        struct rcu_head         rcu;
        /* array of per cgroup lists, indexed by memcg_cache_id */
-       struct list_lru_one     *lru[0];
+       struct list_lru_one     *lru[];
 };
 
 struct list_lru_node {
index 1b4150f..d275c72 100644 (file)
@@ -106,7 +106,7 @@ struct lruvec_stat {
  */
 struct memcg_shrinker_map {
        struct rcu_head rcu;
-       unsigned long map[0];
+       unsigned long map[];
 };
 
 /*
@@ -148,7 +148,7 @@ struct mem_cgroup_threshold_ary {
        /* Size of entries[] */
        unsigned int size;
        /* Array of thresholds */
-       struct mem_cgroup_threshold entries[0];
+       struct mem_cgroup_threshold entries[];
 };
 
 struct mem_cgroup_thresholds {
index 25f46a9..3e268e6 100644 (file)
@@ -83,7 +83,7 @@ struct wilco_ec_response {
        u16 result;
        u16 data_size;
        u8 reserved[2];
-       u8 data[0];
+       u8 data[];
 } __packed;
 
 /**
index b18dca6..c2a7cfb 100644 (file)
@@ -220,10 +220,8 @@ struct pnp_card {
 #define global_to_pnp_card(n) list_entry(n, struct pnp_card, global_list)
 #define protocol_to_pnp_card(n) list_entry(n, struct pnp_card, protocol_list)
 #define to_pnp_card(n) container_of(n, struct pnp_card, dev)
-#define pnp_for_each_card(card) \
-       for((card) = global_to_pnp_card(pnp_cards.next); \
-       (card) != global_to_pnp_card(&pnp_cards); \
-       (card) = global_to_pnp_card((card)->global_list.next))
+#define pnp_for_each_card(card)        \
+       list_for_each_entry(card, &pnp_cards, global_list)
 
 struct pnp_card_link {
        struct pnp_card *card;
@@ -276,14 +274,9 @@ struct pnp_dev {
 #define card_to_pnp_dev(n) list_entry(n, struct pnp_dev, card_list)
 #define protocol_to_pnp_dev(n) list_entry(n, struct pnp_dev, protocol_list)
 #define        to_pnp_dev(n) container_of(n, struct pnp_dev, dev)
-#define pnp_for_each_dev(dev) \
-       for((dev) = global_to_pnp_dev(pnp_global.next); \
-       (dev) != global_to_pnp_dev(&pnp_global); \
-       (dev) = global_to_pnp_dev((dev)->global_list.next))
-#define card_for_each_dev(card,dev) \
-       for((dev) = card_to_pnp_dev((card)->devices.next); \
-       (dev) != card_to_pnp_dev(&(card)->devices); \
-       (dev) = card_to_pnp_dev((dev)->card_list.next))
+#define pnp_for_each_dev(dev) list_for_each_entry(dev, &pnp_global, global_list)
+#define card_for_each_dev(card, dev)   \
+       list_for_each_entry(dev, &(card)->devices, card_list)
 #define pnp_dev_name(dev) (dev)->name
 
 static inline void *pnp_get_drvdata(struct pnp_dev *pdev)
@@ -437,14 +430,10 @@ struct pnp_protocol {
 };
 
 #define to_pnp_protocol(n) list_entry(n, struct pnp_protocol, protocol_list)
-#define protocol_for_each_card(protocol,card) \
-       for((card) = protocol_to_pnp_card((protocol)->cards.next); \
-       (card) != protocol_to_pnp_card(&(protocol)->cards); \
-       (card) = protocol_to_pnp_card((card)->protocol_list.next))
-#define protocol_for_each_dev(protocol,dev) \
-       for((dev) = protocol_to_pnp_dev((protocol)->devices.next); \
-       (dev) != protocol_to_pnp_dev(&(protocol)->devices); \
-       (dev) = protocol_to_pnp_dev((dev)->protocol_list.next))
+#define protocol_for_each_card(protocol, card) \
+       list_for_each_entry(card, &(protocol)->cards, protocol_list)
+#define protocol_for_each_dev(protocol, dev)   \
+       list_for_each_entry(dev, &(protocol)->devices, protocol_list)
 
 extern struct bus_type pnp_bus_type;
 
index 540595a..90797f1 100644 (file)
@@ -28,7 +28,7 @@ struct posix_acl {
        refcount_t              a_refcount;
        struct rcu_head         a_rcu;
        unsigned int            a_count;
-       struct posix_acl_entry  a_entries[0];
+       struct posix_acl_entry  a_entries[];
 };
 
 #define FOREACH_ACL_ENTRY(pa, acl, pe) \
index 317bace..2cd6372 100644 (file)
@@ -100,7 +100,7 @@ struct rio_switch {
        u32 port_ok;
        struct rio_switch_ops *ops;
        spinlock_t lock;
-       struct rio_dev *nextdev[0];
+       struct rio_dev *nextdev[];
 };
 
 /**
@@ -201,7 +201,7 @@ struct rio_dev {
        u8 hopcount;
        struct rio_dev *prev;
        atomic_t state;
-       struct rio_switch rswitch[0];   /* RIO switch info */
+       struct rio_switch rswitch[];    /* RIO switch info */
 };
 
 #define rio_dev_g(n) list_entry(n, struct rio_dev, global_list)
index 5974ced..238bb85 100644 (file)
@@ -54,7 +54,7 @@ struct rs_codec {
  */
 struct rs_control {
        struct rs_codec *codec;
-       uint16_t        buffers[0];
+       uint16_t        buffers[];
 };
 
 /* General purpose RS codec, 8-bit data width, symbol width 1-15 bit  */
index af9319e..95253ad 100644 (file)
@@ -142,7 +142,7 @@ struct sched_domain {
         * by attaching extra space to the end of the structure,
         * depending on how many CPUs the kernel has booted up with)
         */
-       unsigned long span[0];
+       unsigned long span[];
 };
 
 static inline struct cpumask *sched_domain_span(struct sched_domain *sd)
index 3a2ac70..3000c52 100644 (file)
@@ -4162,7 +4162,7 @@ struct skb_ext {
        refcount_t refcnt;
        u8 offset[SKB_EXT_NUM]; /* in chunks of 8 bytes */
        u8 chunks;              /* same */
-       char data[0] __aligned(8);
+       char data[] __aligned(8);
 };
 
 struct skb_ext *__skb_ext_alloc(void);
index 78fe2ac..cbcfbd0 100644 (file)
@@ -170,6 +170,7 @@ extern bool svc_rdma_post_recvs(struct svcxprt_rdma *rdma);
 extern void svc_rdma_recv_ctxt_put(struct svcxprt_rdma *rdma,
                                   struct svc_rdma_recv_ctxt *ctxt);
 extern void svc_rdma_flush_recv_queues(struct svcxprt_rdma *rdma);
+extern void svc_rdma_release_rqst(struct svc_rqst *rqstp);
 extern int svc_rdma_recvfrom(struct svc_rqst *);
 
 /* svc_rdma_rw.c */
index b835d8d..e1bbf7a 100644 (file)
@@ -275,7 +275,7 @@ struct swap_info_struct {
                                         */
        struct work_struct discard_work; /* discard worker */
        struct swap_cluster_list discard_clusters; /* discard clusters list */
-       struct plist_node avail_lists[0]; /*
+       struct plist_node avail_lists[]; /*
                                           * entries in swap_avail_heads, one
                                           * entry per node.
                                           * Must be last as the number of the
index eb6cbdf..44a7f91 100644 (file)
@@ -295,7 +295,7 @@ struct bts_header {
        u32 magic;
        u32 version;
        u8 future[24];
-       u8 actions[0];
+       u8 actions[];
 } __attribute__ ((packed));
 
 /**
@@ -305,7 +305,7 @@ struct bts_header {
 struct bts_action {
        u16 type;
        u16 size;
-       u8 data[0];
+       u8 data[];
 } __attribute__ ((packed));
 
 struct bts_action_send {
@@ -315,7 +315,7 @@ struct bts_action_send {
 struct bts_action_wait {
        u32 msec;
        u32 size;
-       u8 data[0];
+       u8 data[];
 } __attribute__ ((packed));
 
 struct bts_action_delay {
index 131ea1b..c253461 100644 (file)
@@ -28,7 +28,7 @@ struct tcpa_event {
        u32 event_type;
        u8 pcr_value[20];       /* SHA1 */
        u32 event_size;
-       u8 event_data[0];
+       u8 event_data[];
 };
 
 enum tcpa_event_types {
@@ -55,7 +55,7 @@ enum tcpa_event_types {
 struct tcpa_pc_event {
        u32 event_id;
        u32 event_size;
-       u8 event_data[0];
+       u8 event_data[];
 };
 
 enum tcpa_pc_event_ids {
@@ -102,7 +102,7 @@ struct tcg_pcr_event {
 
 struct tcg_event_field {
        u32 event_size;
-       u8 event[0];
+       u8 event[];
 } __packed;
 
 struct tcg_pcr_event2_head {
index 1fb11da..a1fecf3 100644 (file)
@@ -156,8 +156,7 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p)
  * Note, the proto and args passed in includes "__data" as the first parameter.
  * The reason for this is to handle the "void" prototype. If a tracepoint
  * has a "void" prototype, then it is invalid to declare a function
- * as "(void *, void)". The DECLARE_TRACE_NOARGS() will pass in just
- * "void *data", where as the DECLARE_TRACE() will pass in "void *data, proto".
+ * as "(void *, void)".
  */
 #define __DO_TRACE(tp, proto, args, cond, rcuidle)                     \
        do {                                                            \
@@ -373,25 +372,6 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p)
 # define __tracepoint_string
 #endif
 
-/*
- * The need for the DECLARE_TRACE_NOARGS() is to handle the prototype
- * (void). "void" is a special value in a function prototype and can
- * not be combined with other arguments. Since the DECLARE_TRACE()
- * macro adds a data element at the beginning of the prototype,
- * we need a way to differentiate "(void *data, proto)" from
- * "(void *data, void)". The second prototype is invalid.
- *
- * DECLARE_TRACE_NOARGS() passes "void" as the tracepoint prototype
- * and "void *__data" as the callback prototype.
- *
- * DECLARE_TRACE() passes "proto" as the tracepoint protoype and
- * "void *__data, proto" as the callback prototype.
- */
-#define DECLARE_TRACE_NOARGS(name)                                     \
-       __DECLARE_TRACE(name, void, ,                                   \
-                       cpu_online(raw_smp_processor_id()),             \
-                       void *__data, __data)
-
 #define DECLARE_TRACE(name, proto, args)                               \
        __DECLARE_TRACE(name, PARAMS(proto), PARAMS(args),              \
                        cpu_online(raw_smp_processor_id()),             \
index 733acfb..5453af8 100644 (file)
@@ -164,7 +164,7 @@ struct vdpa_config_ops {
        u64 (*get_vq_state)(struct vdpa_device *vdev, u16 idx);
 
        /* Device ops */
-       u16 (*get_vq_align)(struct vdpa_device *vdev);
+       u32 (*get_vq_align)(struct vdpa_device *vdev);
        u64 (*get_features)(struct vdpa_device *vdev);
        int (*set_features)(struct vdpa_device *vdev, u64 features);
        void (*set_config_cb)(struct vdpa_device *vdev,
index 9aced11..dc23657 100644 (file)
@@ -1,5 +1,9 @@
 /* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _LINUX_VERMAGIC_H
+#define _LINUX_VERMAGIC_H
+
 #include <generated/utsrelease.h>
+#include <asm/vermagic.h>
 
 /* Simply sanity version stamp for modules. */
 #ifdef CONFIG_SMP
@@ -24,9 +28,6 @@
 #else
 #define MODULE_VERMAGIC_MODVERSIONS ""
 #endif
-#ifndef MODULE_ARCH_VERMAGIC
-#define MODULE_ARCH_VERMAGIC ""
-#endif
 #ifdef RANDSTRUCT_PLUGIN
 #include <generated/randomize_layout_hash.h>
 #define MODULE_RANDSTRUCT_PLUGIN "RANDSTRUCT_PLUGIN_" RANDSTRUCT_HASHED_SEED
@@ -41,3 +42,4 @@
        MODULE_ARCH_VERMAGIC                                            \
        MODULE_RANDSTRUCT_PLUGIN
 
+#endif /* _LINUX_VERMAGIC_H */
index 15f906e..a493eac 100644 (file)
@@ -9,7 +9,6 @@
 #include <linux/device.h>
 #include <linux/mod_devicetable.h>
 #include <linux/gfp.h>
-#include <linux/vringh.h>
 
 /**
  * virtqueue - a queue to register buffers for sending or receiving.
index 0507a16..a95d3cc 100644 (file)
@@ -137,7 +137,7 @@ extern void vunmap(const void *addr);
 
 extern int remap_vmalloc_range_partial(struct vm_area_struct *vma,
                                       unsigned long uaddr, void *kaddr,
-                                      unsigned long size);
+                                      unsigned long pgoff, unsigned long size);
 
 extern int remap_vmalloc_range(struct vm_area_struct *vma, void *addr,
                                                        unsigned long pgoff);
index bd0503c..9e2763d 100644 (file)
 #include <linux/virtio_byteorder.h>
 #include <linux/uio.h>
 #include <linux/slab.h>
+#if IS_REACHABLE(CONFIG_VHOST_IOTLB)
 #include <linux/dma-direction.h>
 #include <linux/vhost_iotlb.h>
+#endif
 #include <asm/barrier.h>
 
 /* virtio_ring with information needed for host access. */
@@ -254,6 +256,8 @@ static inline __virtio64 cpu_to_vringh64(const struct vringh *vrh, u64 val)
        return __cpu_to_virtio64(vringh_is_little_endian(vrh), val);
 }
 
+#if IS_REACHABLE(CONFIG_VHOST_IOTLB)
+
 void vringh_set_iotlb(struct vringh *vrh, struct vhost_iotlb *iotlb);
 
 int vringh_init_iotlb(struct vringh *vrh, u64 features,
@@ -284,4 +288,6 @@ void vringh_notify_disable_iotlb(struct vringh *vrh);
 
 int vringh_need_notify_iotlb(struct vringh *vrh);
 
+#endif /* CONFIG_VHOST_IOTLB */
+
 #endif /* _LINUX_VRINGH_H */
index 4cf6e11..47eaa34 100644 (file)
@@ -73,7 +73,7 @@ struct simple_xattr {
        struct list_head list;
        char *name;
        size_t size;
-       char value[0];
+       char value[];
 };
 
 /*
index 0dd52b0..361cb64 100644 (file)
@@ -168,7 +168,6 @@ int tegra_io_pad_power_disable(enum tegra_io_pad id);
 int tegra_io_rail_power_on(unsigned int id);
 int tegra_io_rail_power_off(unsigned int id);
 
-enum tegra_suspend_mode tegra_pmc_get_suspend_mode(void);
 void tegra_pmc_set_suspend_mode(enum tegra_suspend_mode mode);
 void tegra_pmc_enter_suspend_mode(enum tegra_suspend_mode mode);
 
@@ -220,11 +219,6 @@ static inline int tegra_io_rail_power_off(unsigned int id)
        return -ENOSYS;
 }
 
-static inline enum tegra_suspend_mode tegra_pmc_get_suspend_mode(void)
-{
-       return TEGRA_SUSPEND_NONE;
-}
-
 static inline void tegra_pmc_set_suspend_mode(enum tegra_suspend_mode mode)
 {
 }
@@ -235,4 +229,13 @@ static inline void tegra_pmc_enter_suspend_mode(enum tegra_suspend_mode mode)
 
 #endif /* CONFIG_SOC_TEGRA_PMC */
 
+#if defined(CONFIG_SOC_TEGRA_PMC) && defined(CONFIG_PM_SLEEP)
+enum tegra_suspend_mode tegra_pmc_get_suspend_mode(void);
+#else
+static inline enum tegra_suspend_mode tegra_pmc_get_suspend_mode(void)
+{
+       return TEGRA_SUSPEND_NONE;
+}
+#endif
+
 #endif /* __SOC_TEGRA_PMC_H__ */
index 3ee8036..225154a 100644 (file)
@@ -494,6 +494,11 @@ void snd_hda_update_power_acct(struct hda_codec *codec);
 static inline void snd_hda_set_power_save(struct hda_bus *bus, int delay) {}
 #endif
 
+static inline bool hda_codec_need_resume(struct hda_codec *codec)
+{
+       return !codec->relaxed_resume && codec->jacktbl.used;
+}
+
 #ifdef CONFIG_SND_HDA_PATCH_LOADER
 /*
  * patch firmware
index d4825b8..b33abe9 100644 (file)
@@ -351,7 +351,6 @@ struct snd_soc_dai {
 
        /* bit field */
        unsigned int probed:1;
-       unsigned int started[SNDRV_PCM_STREAM_LAST + 1];
 };
 
 static inline struct snd_soc_pcm_stream *
index 13458e4..946f88a 100644 (file)
@@ -790,6 +790,9 @@ struct snd_soc_dai_link {
        const struct snd_soc_pcm_stream *params;
        unsigned int num_params;
 
+       struct snd_soc_dapm_widget *playback_widget;
+       struct snd_soc_dapm_widget *capture_widget;
+
        unsigned int dai_fmt;           /* format to set on init */
 
        enum snd_soc_dpcm_trigger trigger[2]; /* trigger type for DPCM */
index 7ecaa65..c2f580f 100644 (file)
@@ -130,7 +130,7 @@ DEFINE_EVENT(iocg_inuse_update, iocost_inuse_reset,
 
 TRACE_EVENT(iocost_ioc_vrate_adj,
 
-       TP_PROTO(struct ioc *ioc, u64 new_vrate, u32 (*missed_ppm)[2],
+       TP_PROTO(struct ioc *ioc, u64 new_vrate, u32 *missed_ppm,
                u32 rq_wait_pct, int nr_lagging, int nr_shortages,
                int nr_surpluses),
 
@@ -155,8 +155,8 @@ TRACE_EVENT(iocost_ioc_vrate_adj,
                __entry->old_vrate = atomic64_read(&ioc->vtime_rate);;
                __entry->new_vrate = new_vrate;
                __entry->busy_level = ioc->busy_level;
-               __entry->read_missed_ppm = (*missed_ppm)[READ];
-               __entry->write_missed_ppm = (*missed_ppm)[WRITE];
+               __entry->read_missed_ppm = missed_ppm[READ];
+               __entry->write_missed_ppm = missed_ppm[WRITE];
                __entry->rq_wait_pct = rq_wait_pct;
                __entry->nr_lagging = nr_lagging;
                __entry->nr_shortages = nr_shortages;
index 051f26f..596e0a8 100644 (file)
@@ -1695,17 +1695,15 @@ DECLARE_EVENT_CLASS(svcrdma_sendcomp_event,
 
 TRACE_EVENT(svcrdma_post_send,
        TP_PROTO(
-               const struct ib_send_wr *wr,
-               int status
+               const struct ib_send_wr *wr
        ),
 
-       TP_ARGS(wr, status),
+       TP_ARGS(wr),
 
        TP_STRUCT__entry(
                __field(const void *, cqe)
                __field(unsigned int, num_sge)
                __field(u32, inv_rkey)
-               __field(int, status)
        ),
 
        TP_fast_assign(
@@ -1713,12 +1711,11 @@ TRACE_EVENT(svcrdma_post_send,
                __entry->num_sge = wr->num_sge;
                __entry->inv_rkey = (wr->opcode == IB_WR_SEND_WITH_INV) ?
                                        wr->ex.invalidate_rkey : 0;
-               __entry->status = status;
        ),
 
-       TP_printk("cqe=%p num_sge=%u inv_rkey=0x%08x status=%d",
+       TP_printk("cqe=%p num_sge=%u inv_rkey=0x%08x",
                __entry->cqe, __entry->num_sge,
-               __entry->inv_rkey, __entry->status
+               __entry->inv_rkey
        )
 );
 
@@ -1783,26 +1780,23 @@ TRACE_EVENT(svcrdma_wc_receive,
 TRACE_EVENT(svcrdma_post_rw,
        TP_PROTO(
                const void *cqe,
-               int sqecount,
-               int status
+               int sqecount
        ),
 
-       TP_ARGS(cqe, sqecount, status),
+       TP_ARGS(cqe, sqecount),
 
        TP_STRUCT__entry(
                __field(const void *, cqe)
                __field(int, sqecount)
-               __field(int, status)
        ),
 
        TP_fast_assign(
                __entry->cqe = cqe;
                __entry->sqecount = sqecount;
-               __entry->status = status;
        ),
 
-       TP_printk("cqe=%p sqecount=%d status=%d",
-               __entry->cqe, __entry->sqecount, __entry->status
+       TP_printk("cqe=%p sqecount=%d",
+               __entry->cqe, __entry->sqecount
        )
 );
 
@@ -1870,6 +1864,34 @@ DECLARE_EVENT_CLASS(svcrdma_sendqueue_event,
 DEFINE_SQ_EVENT(full);
 DEFINE_SQ_EVENT(retry);
 
+TRACE_EVENT(svcrdma_sq_post_err,
+       TP_PROTO(
+               const struct svcxprt_rdma *rdma,
+               int status
+       ),
+
+       TP_ARGS(rdma, status),
+
+       TP_STRUCT__entry(
+               __field(int, avail)
+               __field(int, depth)
+               __field(int, status)
+               __string(addr, rdma->sc_xprt.xpt_remotebuf)
+       ),
+
+       TP_fast_assign(
+               __entry->avail = atomic_read(&rdma->sc_sq_avail);
+               __entry->depth = rdma->sc_sq_depth;
+               __entry->status = status;
+               __assign_str(addr, rdma->sc_xprt.xpt_remotebuf);
+       ),
+
+       TP_printk("addr=%s sc_sq_avail=%d/%d status=%d",
+               __get_str(addr), __entry->avail, __entry->depth,
+               __entry->status
+       )
+);
+
 #endif /* _TRACE_RPCRDMA_H */
 
 #include <trace/define_trace.h>
index 37342a1..7848141 100644 (file)
@@ -46,7 +46,7 @@ TRACE_EVENT(wbt_stat,
        ),
 
        TP_printk("%s: rmean=%llu, rmin=%llu, rmax=%llu, rsamples=%llu, "
-                 "wmean=%llu, wmin=%llu, wmax=%llu, wsamples=%llu\n",
+                 "wmean=%llu, wmin=%llu, wmax=%llu, wsamples=%llu",
                  __entry->name, __entry->rmean, __entry->rmin, __entry->rmax,
                  __entry->rnr_samples, __entry->wmean, __entry->wmin,
                  __entry->wmax, __entry->wnr_samples)
@@ -73,7 +73,7 @@ TRACE_EVENT(wbt_lat,
                __entry->lat = div_u64(lat, 1000);
        ),
 
-       TP_printk("%s: latency %lluus\n", __entry->name,
+       TP_printk("%s: latency %lluus", __entry->name,
                        (unsigned long long) __entry->lat)
 );
 
@@ -115,7 +115,7 @@ TRACE_EVENT(wbt_step,
                __entry->max    = max;
        ),
 
-       TP_printk("%s: %s: step=%d, window=%luus, background=%u, normal=%u, max=%u\n",
+       TP_printk("%s: %s: step=%d, window=%luus, background=%u, normal=%u, max=%u",
                  __entry->name, __entry->msg, __entry->step, __entry->window,
                  __entry->bg, __entry->normal, __entry->max)
 );
@@ -148,7 +148,7 @@ TRACE_EVENT(wbt_timer,
                __entry->inflight       = inflight;
        ),
 
-       TP_printk("%s: status=%u, step=%d, inflight=%u\n", __entry->name,
+       TP_printk("%s: status=%u, step=%d, inflight=%u", __entry->name,
                  __entry->status, __entry->step, __entry->inflight)
 );
 
index d94def2..85a33be 100644 (file)
@@ -36,7 +36,6 @@
        EM( WB_REASON_SYNC,                     "sync")                 \
        EM( WB_REASON_PERIODIC,                 "periodic")             \
        EM( WB_REASON_LAPTOP_TIMER,             "laptop_timer")         \
-       EM( WB_REASON_FREE_MORE_MEM,            "free_more_memory")     \
        EM( WB_REASON_FS_FREE_SPACE,            "fs_free_space")        \
        EMe(WB_REASON_FORKER_THREAD,            "forker_thread")
 
index f880d28..e83954c 100644 (file)
@@ -45,13 +45,13 @@ struct dlm_lock_params {
        void __user *bastaddr;
        struct dlm_lksb __user *lksb;
        char lvb[DLM_USER_LVB_LEN];
-       char name[0];
+       char name[];
 };
 
 struct dlm_lspace_params {
        __u32 flags;
        __u32 minor;
-       char name[0];
+       char name[];
 };
 
 struct dlm_purge_params {
index 8c0bc24..7a900b2 100644 (file)
@@ -34,7 +34,7 @@ struct fiemap {
        __u32 fm_mapped_extents;/* number of extents that were mapped (out) */
        __u32 fm_extent_count;  /* size of fm_extents array (in) */
        __u32 fm_reserved;
-       struct fiemap_extent fm_extents[0]; /* array of mapped extents (out) */
+       struct fiemap_extent fm_extents[]; /* array of mapped extents (out) */
 };
 
 #define FIEMAP_MAX_OFFSET      (~0ULL)
index 1997439..dc3e656 100644 (file)
@@ -48,8 +48,15 @@ struct virtio_balloon_config {
        __u32 num_pages;
        /* Number of pages we've actually got in balloon. */
        __u32 actual;
-       /* Free page report command id, readonly by guest */
-       __u32 free_page_report_cmd_id;
+       /*
+        * Free page hint command id, readonly by guest.
+        * Was previously named free_page_report_cmd_id so we
+        * need to carry that name for legacy support.
+        */
+       union {
+               __u32 free_page_hint_cmd_id;
+               __u32 free_page_report_cmd_id;  /* deprecated */
+       };
        /* Stores PAGE_POISON if page poisoning is in use */
        __u32 poison_val;
 };
index b69c8b4..87f31bf 100644 (file)
@@ -1326,6 +1326,9 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
        case AUDIT_FIRST_USER_MSG2 ... AUDIT_LAST_USER_MSG2:
                if (!audit_enabled && msg_type != AUDIT_USER_AVC)
                        return 0;
+               /* exit early if there isn't at least one character to print */
+               if (data_len < 2)
+                       return -EINVAL;
 
                err = audit_filter(msg_type, AUDIT_FILTER_USER);
                if (err == 1) { /* match or error */
index 4385f3d..8c700f8 100644 (file)
@@ -2605,6 +2605,14 @@ noinline static int copy_clone_args_from_user(struct kernel_clone_args *kargs,
        struct clone_args args;
        pid_t *kset_tid = kargs->set_tid;
 
+       BUILD_BUG_ON(offsetofend(struct clone_args, tls) !=
+                    CLONE_ARGS_SIZE_VER0);
+       BUILD_BUG_ON(offsetofend(struct clone_args, set_tid_size) !=
+                    CLONE_ARGS_SIZE_VER1);
+       BUILD_BUG_ON(offsetofend(struct clone_args, cgroup) !=
+                    CLONE_ARGS_SIZE_VER2);
+       BUILD_BUG_ON(sizeof(struct clone_args) != CLONE_ARGS_SIZE_VER2);
+
        if (unlikely(usize > PAGE_SIZE))
                return -E2BIG;
        if (unlikely(usize < CLONE_ARGS_SIZE_VER0))
@@ -2631,7 +2639,8 @@ noinline static int copy_clone_args_from_user(struct kernel_clone_args *kargs,
                     !valid_signal(args.exit_signal)))
                return -EINVAL;
 
-       if ((args.flags & CLONE_INTO_CGROUP) && args.cgroup < 0)
+       if ((args.flags & CLONE_INTO_CGROUP) &&
+           (args.cgroup > INT_MAX || usize < CLONE_ARGS_SIZE_VER2))
                return -EINVAL;
 
        *kargs = (struct kernel_clone_args){
index fe40c65..453a8a0 100644 (file)
@@ -1690,34 +1690,6 @@ out_mput:
        return ret;
 }
 
-/**
- *     setup_irq - setup an interrupt
- *     @irq: Interrupt line to setup
- *     @act: irqaction for the interrupt
- *
- * Used to statically setup interrupts in the early boot process.
- */
-int setup_irq(unsigned int irq, struct irqaction *act)
-{
-       int retval;
-       struct irq_desc *desc = irq_to_desc(irq);
-
-       if (!desc || WARN_ON(irq_settings_is_per_cpu_devid(desc)))
-               return -EINVAL;
-
-       retval = irq_chip_pm_get(&desc->irq_data);
-       if (retval < 0)
-               return retval;
-
-       retval = __setup_irq(irq, desc, act);
-
-       if (retval)
-               irq_chip_pm_put(&desc->irq_data);
-
-       return retval;
-}
-EXPORT_SYMBOL_GPL(setup_irq);
-
 /*
  * Internal function to unregister an irqaction - used to free
  * regular and special interrupts that are part of the architecture.
@@ -1858,22 +1830,6 @@ static struct irqaction *__free_irq(struct irq_desc *desc, void *dev_id)
        return action;
 }
 
-/**
- *     remove_irq - free an interrupt
- *     @irq: Interrupt line to free
- *     @act: irqaction for the interrupt
- *
- * Used to remove interrupts statically setup by the early boot process.
- */
-void remove_irq(unsigned int irq, struct irqaction *act)
-{
-       struct irq_desc *desc = irq_to_desc(irq);
-
-       if (desc && !WARN_ON(irq_settings_is_per_cpu_devid(desc)))
-               __free_irq(desc, act->dev_id);
-}
-EXPORT_SYMBOL_GPL(remove_irq);
-
 /**
  *     free_irq - free an interrupt allocated with request_irq
  *     @irq: Interrupt line to free
index 06548e2..d9a49cd 100644 (file)
@@ -825,7 +825,7 @@ static __always_inline void rcu_nmi_enter_common(bool irq)
                        rcu_cleanup_after_idle();
 
                incby = 1;
-       } else if (tick_nohz_full_cpu(rdp->cpu) &&
+       } else if (irq && tick_nohz_full_cpu(rdp->cpu) &&
                   rdp->dynticks_nmi_nesting == DYNTICK_IRQ_NONIDLE &&
                   READ_ONCE(rdp->rcu_urgent_qs) &&
                   !READ_ONCE(rdp->rcu_forced_tick)) {
index dac9104..ff9435d 100644 (file)
@@ -1003,12 +1003,12 @@ u64 kcpustat_field(struct kernel_cpustat *kcpustat,
                   enum cpu_usage_stat usage, int cpu)
 {
        u64 *cpustat = kcpustat->cpustat;
+       u64 val = cpustat[usage];
        struct rq *rq;
-       u64 val;
        int err;
 
        if (!vtime_accounting_enabled_cpu(cpu))
-               return cpustat[usage];
+               return val;
 
        rq = cpu_rq(cpu);
 
index 008d6ac..808244f 100644 (file)
@@ -149,6 +149,9 @@ __setup("nohz_full=", housekeeping_nohz_full_setup);
 static int __init housekeeping_isolcpus_setup(char *str)
 {
        unsigned int flags = 0;
+       bool illegal = false;
+       char *par;
+       int len;
 
        while (isalpha(*str)) {
                if (!strncmp(str, "nohz,", 5)) {
@@ -169,8 +172,22 @@ static int __init housekeeping_isolcpus_setup(char *str)
                        continue;
                }
 
-               pr_warn("isolcpus: Error, unknown flag\n");
-               return 0;
+               /*
+                * Skip unknown sub-parameter and validate that it is not
+                * containing an invalid character.
+                */
+               for (par = str, len = 0; *str && *str != ','; str++, len++) {
+                       if (!isalpha(*str) && *str != '_')
+                               illegal = true;
+               }
+
+               if (illegal) {
+                       pr_warn("isolcpus: Invalid flag %.*s\n", len, par);
+                       return 0;
+               }
+
+               pr_info("isolcpus: Skipped unknown flag %.*s\n", len, par);
+               str++;
        }
 
        /* Default behaviour for isolcpus without flags */
index e58a6c6..284fc16 100644 (file)
@@ -1510,15 +1510,15 @@ int kill_pid_usb_asyncio(int sig, int errno, sigval_t addr,
        unsigned long flags;
        int ret = -EINVAL;
 
+       if (!valid_signal(sig))
+               return ret;
+
        clear_siginfo(&info);
        info.si_signo = sig;
        info.si_errno = errno;
        info.si_code = SI_ASYNCIO;
        *((sigval_t *)&info.si_pid) = addr;
 
-       if (!valid_signal(sig))
-               return ret;
-
        rcu_read_lock();
        p = pid_task(pid, PIDTYPE_PID);
        if (!p) {
@@ -1557,12 +1557,8 @@ static int kill_something_info(int sig, struct kernel_siginfo *info, pid_t pid)
 {
        int ret;
 
-       if (pid > 0) {
-               rcu_read_lock();
-               ret = kill_pid_info(sig, info, find_vpid(pid));
-               rcu_read_unlock();
-               return ret;
-       }
+       if (pid > 0)
+               return kill_proc_info(sig, info, pid);
 
        /* -INT_MIN is undefined.  Exclude this case to avoid a UBSAN warning */
        if (pid == INT_MIN)
@@ -1993,8 +1989,12 @@ bool do_notify_parent(struct task_struct *tsk, int sig)
                if (psig->action[SIGCHLD-1].sa.sa_handler == SIG_IGN)
                        sig = 0;
        }
+       /*
+        * Send with __send_signal as si_pid and si_uid are in the
+        * parent's namespaces.
+        */
        if (valid_signal(sig) && sig)
-               __group_send_sig_info(sig, &info, tsk->parent);
+               __send_signal(sig, &info, tsk->parent, PIDTYPE_TGID, false);
        __wake_up_parent(tsk, tsk->parent);
        spin_unlock_irqrestore(&psig->siglock, flags);
 
index 3b30288..53bce34 100644 (file)
@@ -338,7 +338,20 @@ static struct user_namespace *timens_owner(struct ns_common *ns)
 
 static void show_offset(struct seq_file *m, int clockid, struct timespec64 *ts)
 {
-       seq_printf(m, "%d %lld %ld\n", clockid, ts->tv_sec, ts->tv_nsec);
+       char *clock;
+
+       switch (clockid) {
+       case CLOCK_BOOTTIME:
+               clock = "boottime";
+               break;
+       case CLOCK_MONOTONIC:
+               clock = "monotonic";
+               break;
+       default:
+               clock = "unknown";
+               break;
+       }
+       seq_printf(m, "%-10s %10lld %9ld\n", clock, ts->tv_sec, ts->tv_nsec);
 }
 
 void proc_timens_show_offsets(struct task_struct *p, struct seq_file *m)
index 041694a..bd030b1 100644 (file)
@@ -5165,6 +5165,7 @@ int unregister_ftrace_direct(unsigned long ip, unsigned long addr)
                        list_del_rcu(&direct->next);
                        synchronize_rcu_tasks();
                        kfree(direct);
+                       kfree(entry);
                        ftrace_direct_func_count--;
                }
        }
index 5f6834a..fcab11c 100644 (file)
@@ -3320,6 +3320,9 @@ static void __destroy_hist_field(struct hist_field *hist_field)
        kfree(hist_field->name);
        kfree(hist_field->type);
 
+       kfree(hist_field->system);
+       kfree(hist_field->event_name);
+
        kfree(hist_field);
 }
 
@@ -4382,6 +4385,7 @@ static struct hist_field *create_var(struct hist_trigger_data *hist_data,
                goto out;
        }
 
+       var->ref = 1;
        var->flags = HIST_FIELD_FL_VAR;
        var->var.idx = idx;
        var->var.hist_data = var->hist_data = hist_data;
@@ -5011,6 +5015,9 @@ static void destroy_field_vars(struct hist_trigger_data *hist_data)
 
        for (i = 0; i < hist_data->n_field_vars; i++)
                destroy_field_var(hist_data->field_vars[i]);
+
+       for (i = 0; i < hist_data->n_save_vars; i++)
+               destroy_field_var(hist_data->save_vars[i]);
 }
 
 static void save_field_var(struct hist_trigger_data *hist_data,
index 9e31bfc..74738c9 100644 (file)
@@ -283,7 +283,7 @@ int tracing_map_add_key_field(struct tracing_map *map,
        return idx;
 }
 
-void tracing_map_array_clear(struct tracing_map_array *a)
+static void tracing_map_array_clear(struct tracing_map_array *a)
 {
        unsigned int i;
 
@@ -294,7 +294,7 @@ void tracing_map_array_clear(struct tracing_map_array *a)
                memset(a->pages[i], 0, PAGE_SIZE);
 }
 
-void tracing_map_array_free(struct tracing_map_array *a)
+static void tracing_map_array_free(struct tracing_map_array *a)
 {
        unsigned int i;
 
@@ -316,7 +316,7 @@ void tracing_map_array_free(struct tracing_map_array *a)
        kfree(a);
 }
 
-struct tracing_map_array *tracing_map_array_alloc(unsigned int n_elts,
+static struct tracing_map_array *tracing_map_array_alloc(unsigned int n_elts,
                                                  unsigned int entry_size)
 {
        struct tracing_map_array *a;
index 6076df8..50681f0 100644 (file)
--- a/mm/gup.c
+++ b/mm/gup.c
@@ -1088,7 +1088,7 @@ retry:
                 * potentially allocating memory.
                 */
                if (fatal_signal_pending(current)) {
-                       ret = -ERESTARTSYS;
+                       ret = -EINTR;
                        goto out;
                }
                cond_resched();
index cd45915..bcabbe0 100644 (file)
@@ -5365,8 +5365,8 @@ pte_t *huge_pte_offset(struct mm_struct *mm,
 {
        pgd_t *pgd;
        p4d_t *p4d;
-       pud_t *pud;
-       pmd_t *pmd;
+       pud_t *pud, pud_entry;
+       pmd_t *pmd, pmd_entry;
 
        pgd = pgd_offset(mm, addr);
        if (!pgd_present(*pgd))
@@ -5376,17 +5376,19 @@ pte_t *huge_pte_offset(struct mm_struct *mm,
                return NULL;
 
        pud = pud_offset(p4d, addr);
-       if (sz != PUD_SIZE && pud_none(*pud))
+       pud_entry = READ_ONCE(*pud);
+       if (sz != PUD_SIZE && pud_none(pud_entry))
                return NULL;
        /* hugepage or swap? */
-       if (pud_huge(*pud) || !pud_present(*pud))
+       if (pud_huge(pud_entry) || !pud_present(pud_entry))
                return (pte_t *)pud;
 
        pmd = pmd_offset(pud, addr);
-       if (sz != PMD_SIZE && pmd_none(*pmd))
+       pmd_entry = READ_ONCE(*pmd);
+       if (sz != PMD_SIZE && pmd_none(pmd_entry))
                return NULL;
        /* hugepage or swap? */
-       if (pmd_huge(*pmd) || !pmd_present(*pmd))
+       if (pmd_huge(pmd_entry) || !pmd_present(pmd_entry))
                return (pte_t *)pmd;
 
        return NULL;
index a558da9..281c001 100644 (file)
--- a/mm/ksm.c
+++ b/mm/ksm.c
@@ -2112,8 +2112,16 @@ static void cmp_and_merge_page(struct page *page, struct rmap_item *rmap_item)
 
                down_read(&mm->mmap_sem);
                vma = find_mergeable_vma(mm, rmap_item->address);
-               err = try_to_merge_one_page(vma, page,
-                                           ZERO_PAGE(rmap_item->address));
+               if (vma) {
+                       err = try_to_merge_one_page(vma, page,
+                                       ZERO_PAGE(rmap_item->address));
+               } else {
+                       /*
+                        * If the vma is out of date, we do not need to
+                        * continue.
+                        */
+                       err = 0;
+               }
                up_read(&mm->mmap_sem);
                /*
                 * In case of failure, the page was not really empty, so we
index 4bb30ed..8cbd8c1 100644 (file)
@@ -27,6 +27,7 @@
 #include <linux/swapops.h>
 #include <linux/shmem_fs.h>
 #include <linux/mmu_notifier.h>
+#include <linux/sched/mm.h>
 
 #include <asm/tlb.h>
 
@@ -1090,6 +1091,23 @@ int do_madvise(unsigned long start, size_t len_in, int behavior)
        if (write) {
                if (down_write_killable(&current->mm->mmap_sem))
                        return -EINTR;
+
+               /*
+                * We may have stolen the mm from another process
+                * that is undergoing core dumping.
+                *
+                * Right now that's io_ring, in the future it may
+                * be remote process management and not "current"
+                * at all.
+                *
+                * We need to fix core dumping to not do this,
+                * but for now we have the mmget_still_valid()
+                * model.
+                */
+               if (!mmget_still_valid(current->mm)) {
+                       up_write(&current->mm->mmap_sem);
+                       return -EINTR;
+               }
        } else {
                down_read(&current->mm->mmap_sem);
        }
index a7e282e..c881abe 100644 (file)
@@ -413,9 +413,20 @@ static unsigned long move_vma(struct vm_area_struct *vma,
                        /* Always put back VM_ACCOUNT since we won't unmap */
                        vma->vm_flags |= VM_ACCOUNT;
 
-                       vm_acct_memory(vma_pages(new_vma));
+                       vm_acct_memory(new_len >> PAGE_SHIFT);
                }
 
+               /*
+                * VMAs can actually be merged back together in copy_vma
+                * calling merge_vma. This can happen with anonymous vmas
+                * which have not yet been faulted, so if we were to consider
+                * this VMA split we'll end up adding VM_ACCOUNT on the
+                * next VMA, which is completely unrelated if this VMA
+                * was re-merged.
+                */
+               if (split && new_vma == vma)
+                       split = 0;
+
                /* We always clear VM_LOCKED[ONFAULT] on the old vma */
                vma->vm_flags &= VM_LOCKED_CLEAR_MASK;
 
index d722eb8..bd88400 100644 (file)
@@ -952,7 +952,7 @@ static void shmem_undo_range(struct inode *inode, loff_t lstart, loff_t lend,
                                VM_BUG_ON_PAGE(PageWriteback(page), page);
                                if (shmem_punch_compound(page, start, end))
                                        truncate_inode_page(mapping, page);
-                               else {
+                               else if (IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE)) {
                                        /* Wipe the page and don't get stuck */
                                        clear_highpage(page);
                                        flush_dcache_page(page);
@@ -2179,7 +2179,11 @@ int shmem_lock(struct file *file, int lock, struct user_struct *user)
        struct shmem_inode_info *info = SHMEM_I(inode);
        int retval = -ENOMEM;
 
-       spin_lock_irq(&info->lock);
+       /*
+        * What serializes the accesses to info->flags?
+        * ipc_lock_object() when called from shmctl_do_lock(),
+        * no serialization needed when called from shm_destroy().
+        */
        if (lock && !(info->flags & VM_LOCKED)) {
                if (!user_shm_lock(inode->i_size, user))
                        goto out_nomem;
@@ -2194,7 +2198,6 @@ int shmem_lock(struct file *file, int lock, struct user_struct *user)
        retval = 0;
 
 out_nomem:
-       spin_unlock_irq(&info->lock);
        return retval;
 }
 
@@ -2399,11 +2402,11 @@ static int shmem_mfill_atomic_pte(struct mm_struct *dst_mm,
 
        lru_cache_add_anon(page);
 
-       spin_lock(&info->lock);
+       spin_lock_irq(&info->lock);
        info->alloced++;
        inode->i_blocks += BLOCKS_PER_PAGE;
        shmem_recalc_inode(inode);
-       spin_unlock(&info->lock);
+       spin_unlock_irq(&info->lock);
 
        inc_mm_counter(dst_mm, mm_counter_file(page));
        page_add_file_rmap(page, false);
index 332d4b4..9bf4495 100644 (file)
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -3533,6 +3533,7 @@ static int calculate_sizes(struct kmem_cache *s, int forced_order)
 {
        slab_flags_t flags = s->flags;
        unsigned int size = s->object_size;
+       unsigned int freepointer_area;
        unsigned int order;
 
        /*
@@ -3541,6 +3542,13 @@ static int calculate_sizes(struct kmem_cache *s, int forced_order)
         * the possible location of the free pointer.
         */
        size = ALIGN(size, sizeof(void *));
+       /*
+        * This is the area of the object where a freepointer can be
+        * safely written. If redzoning adds more to the inuse size, we
+        * can't use that portion for writing the freepointer, so
+        * s->offset must be limited within this for the general case.
+        */
+       freepointer_area = size;
 
 #ifdef CONFIG_SLUB_DEBUG
        /*
@@ -3582,13 +3590,13 @@ static int calculate_sizes(struct kmem_cache *s, int forced_order)
                 */
                s->offset = size;
                size += sizeof(void *);
-       } else if (size > sizeof(void *)) {
+       } else if (freepointer_area > sizeof(void *)) {
                /*
                 * Store freelist pointer near middle of object to keep
                 * it away from the edges of the object to avoid small
                 * sized over/underflows from neighboring allocations.
                 */
-               s->offset = ALIGN(size / 2, sizeof(void *));
+               s->offset = ALIGN(freepointer_area / 2, sizeof(void *));
        }
 
 #ifdef CONFIG_SLUB_DEBUG
index 399f219..9a8227a 100644 (file)
@@ -34,6 +34,7 @@
 #include <linux/llist.h>
 #include <linux/bitops.h>
 #include <linux/rbtree_augmented.h>
+#include <linux/overflow.h>
 
 #include <linux/uaccess.h>
 #include <asm/tlbflush.h>
@@ -3054,6 +3055,7 @@ finished:
  * @vma:               vma to cover
  * @uaddr:             target user address to start at
  * @kaddr:             virtual address of vmalloc kernel memory
+ * @pgoff:             offset from @kaddr to start at
  * @size:              size of map area
  *
  * Returns:    0 for success, -Exxx on failure
@@ -3066,9 +3068,15 @@ finished:
  * Similar to remap_pfn_range() (see mm/memory.c)
  */
 int remap_vmalloc_range_partial(struct vm_area_struct *vma, unsigned long uaddr,
-                               void *kaddr, unsigned long size)
+                               void *kaddr, unsigned long pgoff,
+                               unsigned long size)
 {
        struct vm_struct *area;
+       unsigned long off;
+       unsigned long end_index;
+
+       if (check_shl_overflow(pgoff, PAGE_SHIFT, &off))
+               return -EINVAL;
 
        size = PAGE_ALIGN(size);
 
@@ -3082,8 +3090,10 @@ int remap_vmalloc_range_partial(struct vm_area_struct *vma, unsigned long uaddr,
        if (!(area->flags & (VM_USERMAP | VM_DMA_COHERENT)))
                return -EINVAL;
 
-       if (kaddr + size > area->addr + get_vm_area_size(area))
+       if (check_add_overflow(size, off, &end_index) ||
+           end_index > get_vm_area_size(area))
                return -EINVAL;
+       kaddr += off;
 
        do {
                struct page *page = vmalloc_to_page(kaddr);
@@ -3122,7 +3132,7 @@ int remap_vmalloc_range(struct vm_area_struct *vma, void *addr,
                                                unsigned long pgoff)
 {
        return remap_vmalloc_range_partial(vma, vma->vm_start,
-                                          addr + (pgoff << PAGE_SHIFT),
+                                          addr, pgoff,
                                           vma->vm_end - vma->vm_start);
 }
 EXPORT_SYMBOL(remap_vmalloc_range);
index af0ddd2..baef5ee 100644 (file)
@@ -529,7 +529,6 @@ void cache_purge(struct cache_detail *detail)
 {
        struct cache_head *ch = NULL;
        struct hlist_head *head = NULL;
-       struct hlist_node *tmp = NULL;
        int i = 0;
 
        spin_lock(&detail->hash_lock);
@@ -541,7 +540,9 @@ void cache_purge(struct cache_detail *detail)
        dprintk("RPC: %d entries in %s cache\n", detail->entries, detail->name);
        for (i = 0; i < detail->hash_size; i++) {
                head = &detail->hash_table[i];
-               hlist_for_each_entry_safe(ch, tmp, head, cache_list) {
+               while (!hlist_empty(head)) {
+                       ch = hlist_entry(head->first, struct cache_head,
+                                        cache_list);
                        sunrpc_begin_cache_remove_entry(ch, detail);
                        spin_unlock(&detail->hash_lock);
                        sunrpc_end_cache_remove_entry(ch, detail);
index e27e353..2284ff0 100644 (file)
@@ -908,9 +908,6 @@ int svc_send(struct svc_rqst *rqstp)
        if (!xprt)
                goto out;
 
-       /* release the receive skb before sending the reply */
-       xprt->xpt_ops->xpo_release_rqst(rqstp);
-
        /* calculate over-all length */
        xb = &rqstp->rq_res;
        xb->len = xb->head[0].iov_len +
@@ -1040,6 +1037,8 @@ static void svc_delete_xprt(struct svc_xprt *xprt)
 
        dprintk("svc: svc_delete_xprt(%p)\n", xprt);
        xprt->xpt_ops->xpo_detach(xprt);
+       if (xprt->xpt_bc_xprt)
+               xprt->xpt_bc_xprt->ops->close(xprt->xpt_bc_xprt);
 
        spin_lock_bh(&serv->sv_lock);
        list_del_init(&xprt->xpt_list);
index 519cf9c..023514e 100644 (file)
@@ -527,6 +527,8 @@ static int svc_udp_sendto(struct svc_rqst *rqstp)
        unsigned int uninitialized_var(sent);
        int err;
 
+       svc_release_udp_skb(rqstp);
+
        svc_set_cmsg_data(rqstp, cmh);
 
        err = xprt_sock_sendmsg(svsk->sk_sock, &msg, xdr, 0, 0, &sent);
@@ -1076,6 +1078,8 @@ static int svc_tcp_sendto(struct svc_rqst *rqstp)
        unsigned int uninitialized_var(sent);
        int err;
 
+       svc_release_skb(rqstp);
+
        err = xprt_sock_sendmsg(svsk->sk_sock, &msg, xdr, 0, marker, &sent);
        xdr_free_bvec(xdr);
        if (err < 0 || sent != (xdr->len + sizeof(marker)))
index d510a3a..af7eb8d 100644 (file)
@@ -244,6 +244,8 @@ static void
 xprt_rdma_bc_close(struct rpc_xprt *xprt)
 {
        dprintk("svcrdma: %s: xprt %p\n", __func__, xprt);
+
+       xprt_disconnect_done(xprt);
        xprt->cwnd = RPC_CWNDSHIFT;
 }
 
index 54469b7..efa5fcb 100644 (file)
@@ -223,6 +223,26 @@ void svc_rdma_recv_ctxt_put(struct svcxprt_rdma *rdma,
                svc_rdma_recv_ctxt_destroy(rdma, ctxt);
 }
 
+/**
+ * svc_rdma_release_rqst - Release transport-specific per-rqst resources
+ * @rqstp: svc_rqst being released
+ *
+ * Ensure that the recv_ctxt is released whether or not a Reply
+ * was sent. For example, the client could close the connection,
+ * or svc_process could drop an RPC, before the Reply is sent.
+ */
+void svc_rdma_release_rqst(struct svc_rqst *rqstp)
+{
+       struct svc_rdma_recv_ctxt *ctxt = rqstp->rq_xprt_ctxt;
+       struct svc_xprt *xprt = rqstp->rq_xprt;
+       struct svcxprt_rdma *rdma =
+               container_of(xprt, struct svcxprt_rdma, sc_xprt);
+
+       rqstp->rq_xprt_ctxt = NULL;
+       if (ctxt)
+               svc_rdma_recv_ctxt_put(rdma, ctxt);
+}
+
 static int __svc_rdma_post_recv(struct svcxprt_rdma *rdma,
                                struct svc_rdma_recv_ctxt *ctxt)
 {
@@ -820,6 +840,8 @@ int svc_rdma_recvfrom(struct svc_rqst *rqstp)
        __be32 *p;
        int ret;
 
+       rqstp->rq_xprt_ctxt = NULL;
+
        spin_lock(&rdma_xprt->sc_rq_dto_lock);
        ctxt = svc_rdma_next_recv_ctxt(&rdma_xprt->sc_read_complete_q);
        if (ctxt) {
index bd7c195..23c2d3c 100644 (file)
@@ -323,8 +323,6 @@ static int svc_rdma_post_chunk_ctxt(struct svc_rdma_chunk_ctxt *cc)
                if (atomic_sub_return(cc->cc_sqecount,
                                      &rdma->sc_sq_avail) > 0) {
                        ret = ib_post_send(rdma->sc_qp, first_wr, &bad_wr);
-                       trace_svcrdma_post_rw(&cc->cc_cqe,
-                                             cc->cc_sqecount, ret);
                        if (ret)
                                break;
                        return 0;
@@ -337,6 +335,7 @@ static int svc_rdma_post_chunk_ctxt(struct svc_rdma_chunk_ctxt *cc)
                trace_svcrdma_sq_retry(rdma);
        } while (1);
 
+       trace_svcrdma_sq_post_err(rdma, ret);
        set_bit(XPT_CLOSE, &xprt->xpt_flags);
 
        /* If even one was posted, there will be a completion. */
index 90cba30..b6c8643 100644 (file)
@@ -322,15 +322,17 @@ int svc_rdma_send(struct svcxprt_rdma *rdma, struct ib_send_wr *wr)
                }
 
                svc_xprt_get(&rdma->sc_xprt);
+               trace_svcrdma_post_send(wr);
                ret = ib_post_send(rdma->sc_qp, wr, NULL);
-               trace_svcrdma_post_send(wr, ret);
-               if (ret) {
-                       set_bit(XPT_CLOSE, &rdma->sc_xprt.xpt_flags);
-                       svc_xprt_put(&rdma->sc_xprt);
-                       wake_up(&rdma->sc_send_wait);
-               }
-               break;
+               if (ret)
+                       break;
+               return 0;
        }
+
+       trace_svcrdma_sq_post_err(rdma, ret);
+       set_bit(XPT_CLOSE, &rdma->sc_xprt.xpt_flags);
+       svc_xprt_put(&rdma->sc_xprt);
+       wake_up(&rdma->sc_send_wait);
        return ret;
 }
 
@@ -924,12 +926,7 @@ int svc_rdma_sendto(struct svc_rqst *rqstp)
        ret = svc_rdma_send_reply_msg(rdma, sctxt, rctxt, rqstp);
        if (ret < 0)
                goto err1;
-       ret = 0;
-
-out:
-       rqstp->rq_xprt_ctxt = NULL;
-       svc_rdma_recv_ctxt_put(rdma, rctxt);
-       return ret;
+       return 0;
 
  err2:
        if (ret != -E2BIG && ret != -EINVAL)
@@ -938,16 +935,14 @@ out:
        ret = svc_rdma_send_error_msg(rdma, sctxt, rqstp);
        if (ret < 0)
                goto err1;
-       ret = 0;
-       goto out;
+       return 0;
 
  err1:
        svc_rdma_send_ctxt_put(rdma, sctxt);
  err0:
        trace_svcrdma_send_failed(rqstp, ret);
        set_bit(XPT_CLOSE, &xprt->xpt_flags);
-       ret = -ENOTCONN;
-       goto out;
+       return -ENOTCONN;
 }
 
 /**
index 8bb9998..ea54785 100644 (file)
@@ -71,7 +71,6 @@ static struct svc_xprt *svc_rdma_create(struct svc_serv *serv,
                                        struct sockaddr *sa, int salen,
                                        int flags);
 static struct svc_xprt *svc_rdma_accept(struct svc_xprt *xprt);
-static void svc_rdma_release_rqst(struct svc_rqst *);
 static void svc_rdma_detach(struct svc_xprt *xprt);
 static void svc_rdma_free(struct svc_xprt *xprt);
 static int svc_rdma_has_wspace(struct svc_xprt *xprt);
@@ -552,10 +551,6 @@ static struct svc_xprt *svc_rdma_accept(struct svc_xprt *xprt)
        return NULL;
 }
 
-static void svc_rdma_release_rqst(struct svc_rqst *rqstp)
-{
-}
-
 /*
  * When connected, an svc_xprt has at least two references:
  *
index 0bda8a7..845d0be 100644 (file)
@@ -2584,6 +2584,7 @@ static int bc_send_request(struct rpc_rqst *req)
 
 static void bc_close(struct rpc_xprt *xprt)
 {
+       xprt_disconnect_done(xprt);
 }
 
 /*
index cc86bf6..9894693 100644 (file)
@@ -418,7 +418,7 @@ static int mdpy_mmap(struct mdev_device *mdev, struct vm_area_struct *vma)
                return -EINVAL;
 
        return remap_vmalloc_range_partial(vma, vma->vm_start,
-                                          mdev_state->memblk,
+                                          mdev_state->memblk, 0,
                                           vma->vm_end - vma->vm_start);
 }
 
index 9754710..4b79973 100644 (file)
@@ -309,7 +309,7 @@ define rule_dtc
 endef
 
 $(obj)/%.dt.yaml: $(src)/%.dts $(DTC) $(DT_TMP_SCHEMA) FORCE
-       $(call if_changed_rule,dtc)
+       $(call if_changed_rule,dtc,yaml)
 
 dtc-tmp = $(subst $(comma),_,$(dot-target).dts.tmp)
 
index d64c67b..eac40f0 100755 (executable)
@@ -479,7 +479,7 @@ our $allocFunctions = qr{(?x:
                (?:kv|k|v)[czm]alloc(?:_node|_array)? |
                kstrdup(?:_const)? |
                kmemdup(?:_nul)?) |
-       (?:\w+)?alloc_skb(?:ip_align)? |
+       (?:\w+)?alloc_skb(?:_ip_align)? |
                                # dev_alloc_skb/netdev_alloc_skb, et al
        dma_alloc_coherent
 )};
index e0e3982..eee5b7f 100755 (executable)
@@ -7,6 +7,9 @@ myname=${0##*/}
 # If no prefix forced, use the default CONFIG_
 CONFIG_="${CONFIG_-CONFIG_}"
 
+# We use an uncommon delimiter for sed substitutions
+SED_DELIM=$(echo -en "\001")
+
 usage() {
        cat >&2 <<EOL
 Manipulate options in a .config file from the command line.
@@ -83,7 +86,7 @@ txt_subst() {
        local infile="$3"
        local tmpfile="$infile.swp"
 
-       sed -e "s:$before:$after:" "$infile" >"$tmpfile"
+       sed -e "s$SED_DELIM$before$SED_DELIM$after$SED_DELIM" "$infile" >"$tmpfile"
        # replace original file with the edited one
        mv "$tmpfile" "$infile"
 }
index 9a8cc10..c71832b 100755 (executable)
@@ -25,7 +25,7 @@ my $fix = 0;
 my $warn = 0;
 
 if (! -d ".git") {
-       printf "Warning: can't check if file exists, as this is not a git tree";
+       printf "Warning: can't check if file exists, as this is not a git tree\n";
        exit 0;
 }
 
index 2f3c3a7..ef85f8b 100644 (file)
@@ -13,7 +13,7 @@ dtc-objs      += dtc-lexer.lex.o dtc-parser.tab.o
 HOST_EXTRACFLAGS := -I $(srctree)/$(src)/libfdt
 
 ifeq ($(shell pkg-config --exists yaml-0.1 2>/dev/null && echo yes),)
-ifneq ($(CHECK_DTBS),)
+ifneq ($(CHECK_DT_BINDING)$(CHECK_DTBS),)
 $(error dtc needs libyaml for DT schema validation support. \
        Install the necessary libyaml development package.)
 endif
index f2d73f0..f746ca8 100755 (executable)
@@ -853,7 +853,7 @@ sub output_function_rst(%) {
 
        if ($type =~ m/([^\(]*\(\*)\s*\)\s*\(([^\)]*)\)/) {
            # pointer-to-function
-           print $1 . $parameter . ") (" . $2;
+           print $1 . $parameter . ") (" . $2 . ")";
        } else {
            print $type . " " . $parameter;
        }
index 4ca6b09..3bc9224 100644 (file)
@@ -21,16 +21,17 @@ config SND_HDA_EXT_CORE
        select SND_HDA_CORE
 
 config SND_HDA_PREALLOC_SIZE
-       int "Pre-allocated buffer size for HD-audio driver" if !SND_DMA_SGBUF
+       int "Pre-allocated buffer size for HD-audio driver"
        range 0 32768
-       default 0 if SND_DMA_SGBUF
+       default 2048 if SND_DMA_SGBUF
        default 64 if !SND_DMA_SGBUF
        help
          Specifies the default pre-allocated buffer-size in kB for the
          HD-audio driver.  A larger buffer (e.g. 2048) is preferred
          for systems using PulseAudio.  The default 64 is chosen just
          for compatibility reasons.
-         On x86 systems, the default is zero as we need no preallocation.
+         On x86 systems, the default is 2048 as a reasonable value for
+         most of modern systems.
 
          Note that the pre-allocation size can be changed dynamically
          via a proc file (/proc/asound/card*/pcm*/sub*/prealloc), too.
index 6e3177b..015c0d6 100644 (file)
@@ -168,7 +168,7 @@ static int src_get_rsc_ctrl_blk(void **rblk)
 
 static int src_put_rsc_ctrl_blk(void *blk)
 {
-       kfree((struct src_rsc_ctrl_blk *)blk);
+       kfree(blk);
 
        return 0;
 }
@@ -494,7 +494,7 @@ static int src_mgr_get_ctrl_blk(void **rblk)
 
 static int src_mgr_put_ctrl_blk(void *blk)
 {
-       kfree((struct src_mgr_ctrl_blk *)blk);
+       kfree(blk);
 
        return 0;
 }
@@ -515,7 +515,7 @@ static int srcimp_mgr_get_ctrl_blk(void **rblk)
 
 static int srcimp_mgr_put_ctrl_blk(void *blk)
 {
-       kfree((struct srcimp_mgr_ctrl_blk *)blk);
+       kfree(blk);
 
        return 0;
 }
@@ -702,7 +702,7 @@ static int amixer_rsc_get_ctrl_blk(void **rblk)
 
 static int amixer_rsc_put_ctrl_blk(void *blk)
 {
-       kfree((struct amixer_rsc_ctrl_blk *)blk);
+       kfree(blk);
 
        return 0;
 }
@@ -909,7 +909,7 @@ static int dai_get_ctrl_blk(void **rblk)
 
 static int dai_put_ctrl_blk(void *blk)
 {
-       kfree((struct dai_ctrl_blk *)blk);
+       kfree(blk);
 
        return 0;
 }
@@ -958,7 +958,7 @@ static int dao_get_ctrl_blk(void **rblk)
 
 static int dao_put_ctrl_blk(void *blk)
 {
-       kfree((struct dao_ctrl_blk *)blk);
+       kfree(blk);
 
        return 0;
 }
@@ -1156,7 +1156,7 @@ static int daio_mgr_get_ctrl_blk(struct hw *hw, void **rblk)
 
 static int daio_mgr_put_ctrl_blk(void *blk)
 {
-       kfree((struct daio_mgr_ctrl_blk *)blk);
+       kfree(blk);
 
        return 0;
 }
index a34a2c9..7e3ae45 100644 (file)
@@ -641,8 +641,18 @@ static void hda_jackpoll_work(struct work_struct *work)
        struct hda_codec *codec =
                container_of(work, struct hda_codec, jackpoll_work.work);
 
-       snd_hda_jack_set_dirty_all(codec);
-       snd_hda_jack_poll_all(codec);
+       /* for non-polling trigger: we need nothing if already powered on */
+       if (!codec->jackpoll_interval && snd_hdac_is_power_on(&codec->core))
+               return;
+
+       /* the power-up/down sequence triggers the runtime resume */
+       snd_hda_power_up_pm(codec);
+       /* update jacks manually if polling is required, too */
+       if (codec->jackpoll_interval) {
+               snd_hda_jack_set_dirty_all(codec);
+               snd_hda_jack_poll_all(codec);
+       }
+       snd_hda_power_down_pm(codec);
 
        if (!codec->jackpoll_interval)
                return;
@@ -2951,18 +2961,14 @@ static int hda_codec_runtime_resume(struct device *dev)
 static int hda_codec_force_resume(struct device *dev)
 {
        struct hda_codec *codec = dev_to_hda_codec(dev);
-       bool forced_resume = !codec->relaxed_resume && codec->jacktbl.used;
        int ret;
 
-       /* The get/put pair below enforces the runtime resume even if the
-        * device hasn't been used at suspend time.  This trick is needed to
-        * update the jack state change during the sleep.
-        */
-       if (forced_resume)
-               pm_runtime_get_noresume(dev);
        ret = pm_runtime_force_resume(dev);
-       if (forced_resume)
-               pm_runtime_put(dev);
+       /* schedule jackpoll work for jack detection update */
+       if (codec->jackpoll_interval ||
+           (pm_runtime_suspended(dev) && hda_codec_need_resume(codec)))
+               schedule_delayed_work(&codec->jackpoll_work,
+                                     codec->jackpoll_interval);
        return ret;
 }
 
index bd09359..457a2c0 100644 (file)
@@ -1004,7 +1004,8 @@ static void __azx_runtime_resume(struct azx *chip, bool from_rt)
 
        if (status && from_rt) {
                list_for_each_codec(codec, &chip->bus)
-                       if (status & (1 << codec->addr))
+                       if (!codec->relaxed_resume &&
+                           (status & (1 << codec->addr)))
                                schedule_delayed_work(&codec->jackpoll_work,
                                                      codec->jackpoll_interval);
        }
@@ -1027,7 +1028,7 @@ static int azx_suspend(struct device *dev)
        chip = card->private_data;
        bus = azx_bus(chip);
        snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
-       __azx_runtime_suspend(chip);
+       pm_runtime_force_suspend(dev);
        if (bus->irq >= 0) {
                free_irq(bus->irq, chip);
                bus->irq = -1;
@@ -1055,7 +1056,8 @@ static int azx_resume(struct device *dev)
                        chip->msi = 0;
        if (azx_acquire_irq(chip, 1) < 0)
                return -EIO;
-       __azx_runtime_resume(chip, false);
+
+       pm_runtime_force_resume(dev);
        snd_power_change_state(card, SNDRV_CTL_POWER_D0);
 
        trace_azx_resume(chip);
@@ -1071,6 +1073,8 @@ static int azx_freeze_noirq(struct device *dev)
        struct azx *chip = card->private_data;
        struct pci_dev *pci = to_pci_dev(dev);
 
+       if (!azx_is_pm_ready(card))
+               return 0;
        if (chip->driver_type == AZX_DRIVER_SKL)
                pci_set_power_state(pci, PCI_D3hot);
 
@@ -1083,6 +1087,8 @@ static int azx_thaw_noirq(struct device *dev)
        struct azx *chip = card->private_data;
        struct pci_dev *pci = to_pci_dev(dev);
 
+       if (!azx_is_pm_ready(card))
+               return 0;
        if (chip->driver_type == AZX_DRIVER_SKL)
                pci_set_power_state(pci, PCI_D0);
 
@@ -1098,12 +1104,12 @@ static int azx_runtime_suspend(struct device *dev)
        if (!azx_is_pm_ready(card))
                return 0;
        chip = card->private_data;
-       if (!azx_has_pm_runtime(chip))
-               return 0;
 
        /* enable controller wake up event */
-       azx_writew(chip, WAKEEN, azx_readw(chip, WAKEEN) |
-                 STATESTS_INT_MASK);
+       if (snd_power_get_state(card) == SNDRV_CTL_POWER_D0) {
+               azx_writew(chip, WAKEEN, azx_readw(chip, WAKEEN) |
+                          STATESTS_INT_MASK);
+       }
 
        __azx_runtime_suspend(chip);
        trace_azx_runtime_suspend(chip);
@@ -1114,17 +1120,18 @@ static int azx_runtime_resume(struct device *dev)
 {
        struct snd_card *card = dev_get_drvdata(dev);
        struct azx *chip;
+       bool from_rt = snd_power_get_state(card) == SNDRV_CTL_POWER_D0;
 
        if (!azx_is_pm_ready(card))
                return 0;
        chip = card->private_data;
-       if (!azx_has_pm_runtime(chip))
-               return 0;
-       __azx_runtime_resume(chip, true);
+       __azx_runtime_resume(chip, from_rt);
 
        /* disable controller Wake Up event*/
-       azx_writew(chip, WAKEEN, azx_readw(chip, WAKEEN) &
-                       ~STATESTS_INT_MASK);
+       if (from_rt) {
+               azx_writew(chip, WAKEEN, azx_readw(chip, WAKEEN) &
+                          ~STATESTS_INT_MASK);
+       }
 
        trace_azx_runtime_resume(chip);
        return 0;
@@ -1199,10 +1206,8 @@ static void azx_vs_set_state(struct pci_dev *pci,
                if (!disabled) {
                        dev_info(chip->card->dev,
                                 "Start delayed initialization\n");
-                       if (azx_probe_continue(chip) < 0) {
+                       if (azx_probe_continue(chip) < 0)
                                dev_err(chip->card->dev, "initialization error\n");
-                               hda->init_failed = true;
-                       }
                }
        } else {
                dev_info(chip->card->dev, "%s via vga_switcheroo\n",
@@ -1335,12 +1340,15 @@ static int register_vga_switcheroo(struct azx *chip)
 /*
  * destructor
  */
-static int azx_free(struct azx *chip)
+static void azx_free(struct azx *chip)
 {
        struct pci_dev *pci = chip->pci;
        struct hda_intel *hda = container_of(chip, struct hda_intel, chip);
        struct hdac_bus *bus = azx_bus(chip);
 
+       if (hda->freed)
+               return;
+
        if (azx_has_pm_runtime(chip) && chip->running)
                pm_runtime_get_noresume(&pci->dev);
        chip->running = 0;
@@ -1384,9 +1392,8 @@ static int azx_free(struct azx *chip)
 
        if (chip->driver_caps & AZX_DCAPS_I915_COMPONENT)
                snd_hdac_i915_exit(bus);
-       kfree(hda);
 
-       return 0;
+       hda->freed = 1;
 }
 
 static int azx_dev_disconnect(struct snd_device *device)
@@ -1402,7 +1409,8 @@ static int azx_dev_disconnect(struct snd_device *device)
 
 static int azx_dev_free(struct snd_device *device)
 {
-       return azx_free(device->device_data);
+       azx_free(device->device_data);
+       return 0;
 }
 
 #ifdef SUPPORT_VGA_SWITCHEROO
@@ -1769,7 +1777,7 @@ static int azx_create(struct snd_card *card, struct pci_dev *pci,
        if (err < 0)
                return err;
 
-       hda = kzalloc(sizeof(*hda), GFP_KERNEL);
+       hda = devm_kzalloc(&pci->dev, sizeof(*hda), GFP_KERNEL);
        if (!hda) {
                pci_disable_device(pci);
                return -ENOMEM;
@@ -1810,7 +1818,6 @@ static int azx_create(struct snd_card *card, struct pci_dev *pci,
 
        err = azx_bus_init(chip, model[dev]);
        if (err < 0) {
-               kfree(hda);
                pci_disable_device(pci);
                return err;
        }
@@ -2005,7 +2012,7 @@ static int azx_first_init(struct azx *chip)
        /* codec detection */
        if (!azx_bus(chip)->codec_mask) {
                dev_err(card->dev, "no codecs found!\n");
-               return -ENODEV;
+               /* keep running the rest for the runtime PM */
        }
 
        if (azx_acquire_irq(chip, 0) < 0)
@@ -2027,24 +2034,15 @@ static void azx_firmware_cb(const struct firmware *fw, void *context)
 {
        struct snd_card *card = context;
        struct azx *chip = card->private_data;
-       struct pci_dev *pci = chip->pci;
-
-       if (!fw) {
-               dev_err(card->dev, "Cannot load firmware, aborting\n");
-               goto error;
-       }
 
-       chip->fw = fw;
+       if (fw)
+               chip->fw = fw;
+       else
+               dev_err(card->dev, "Cannot load firmware, continue without patching\n");
        if (!chip->disabled) {
                /* continue probing */
-               if (azx_probe_continue(chip))
-                       goto error;
+               azx_probe_continue(chip);
        }
-       return; /* OK */
-
- error:
-       snd_card_free(card);
-       pci_set_drvdata(pci, NULL);
 }
 #endif
 
@@ -2081,7 +2079,6 @@ static void pcm_mmap_prepare(struct snd_pcm_substream *substream,
  * should be ignored from the beginning.
  */
 static const struct snd_pci_quirk driver_blacklist[] = {
-       SND_PCI_QUIRK(0x1043, 0x874f, "ASUS ROG Zenith II / Strix", 0),
        SND_PCI_QUIRK(0x1462, 0xcb59, "MSI TRX40 Creator", 0),
        SND_PCI_QUIRK(0x1462, 0xcb60, "MSI TRX40", 0),
        {}
@@ -2308,9 +2305,11 @@ static int azx_probe_continue(struct azx *chip)
 #endif
 
        /* create codec instances */
-       err = azx_probe_codecs(chip, azx_max_codecs[chip->driver_type]);
-       if (err < 0)
-               goto out_free;
+       if (bus->codec_mask) {
+               err = azx_probe_codecs(chip, azx_max_codecs[chip->driver_type]);
+               if (err < 0)
+                       goto out_free;
+       }
 
 #ifdef CONFIG_SND_HDA_PATCH_LOADER
        if (chip->fw) {
@@ -2324,7 +2323,7 @@ static int azx_probe_continue(struct azx *chip)
 #endif
        }
 #endif
-       if ((probe_only[dev] & 1) == 0) {
+       if (bus->codec_mask && !(probe_only[dev] & 1)) {
                err = azx_codec_configure(chip);
                if (err < 0)
                        goto out_free;
@@ -2341,17 +2340,23 @@ static int azx_probe_continue(struct azx *chip)
 
        set_default_power_save(chip);
 
-       if (azx_has_pm_runtime(chip))
+       if (azx_has_pm_runtime(chip)) {
+               pm_runtime_use_autosuspend(&pci->dev);
+               pm_runtime_allow(&pci->dev);
                pm_runtime_put_autosuspend(&pci->dev);
+       }
 
 out_free:
-       if (err < 0 || !hda->need_i915_power)
+       if (err < 0) {
+               azx_free(chip);
+               return err;
+       }
+
+       if (!hda->need_i915_power)
                display_power(chip, false);
-       if (err < 0)
-               hda->init_failed = 1;
        complete_all(&hda->probe_wait);
        to_hda_bus(bus)->bus_probing = 0;
-       return err;
+       return 0;
 }
 
 static void azx_remove(struct pci_dev *pci)
index 2acfff3..3fb119f 100644 (file)
@@ -27,6 +27,7 @@ struct hda_intel {
        unsigned int use_vga_switcheroo:1;
        unsigned int vga_switcheroo_registered:1;
        unsigned int init_failed:1; /* delayed init failed */
+       unsigned int freed:1; /* resources already released */
 
        bool need_i915_power:1; /* the hda controller needs i915 power */
 };
index bb287a9..4eff160 100644 (file)
@@ -38,6 +38,10 @@ static bool static_hdmi_pcm;
 module_param(static_hdmi_pcm, bool, 0644);
 MODULE_PARM_DESC(static_hdmi_pcm, "Don't restrict PCM parameters per ELD info");
 
+static bool enable_acomp = true;
+module_param(enable_acomp, bool, 0444);
+MODULE_PARM_DESC(enable_acomp, "Enable audio component binding (default=yes)");
+
 struct hdmi_spec_per_cvt {
        hda_nid_t cvt_nid;
        int assigned;
@@ -2505,6 +2509,11 @@ static void generic_acomp_init(struct hda_codec *codec,
 {
        struct hdmi_spec *spec = codec->spec;
 
+       if (!enable_acomp) {
+               codec_info(codec, "audio component disabled by module option\n");
+               return;
+       }
+
        spec->port2pin = port2pin;
        setup_drm_audio_ops(codec, ops);
        if (!snd_hdac_acomp_init(&codec->bus->core, &spec->drm_audio_ops,
index de2826f..c1a85c8 100644 (file)
@@ -377,6 +377,7 @@ static void alc_fill_eapd_coef(struct hda_codec *codec)
        case 0x10ec0233:
        case 0x10ec0235:
        case 0x10ec0236:
+       case 0x10ec0245:
        case 0x10ec0255:
        case 0x10ec0256:
        case 0x10ec0257:
@@ -797,9 +798,11 @@ static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports)
 {
        if (!alc_subsystem_id(codec, ports)) {
                struct alc_spec *spec = codec->spec;
-               codec_dbg(codec,
-                         "realtek: Enable default setup for auto mode as fallback\n");
-               spec->init_amp = ALC_INIT_DEFAULT;
+               if (spec->init_amp == ALC_INIT_UNDEFINED) {
+                       codec_dbg(codec,
+                                 "realtek: Enable default setup for auto mode as fallback\n");
+                       spec->init_amp = ALC_INIT_DEFAULT;
+               }
        }
 }
 
@@ -7378,6 +7381,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
        SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
        SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK),
        SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC),
+       SND_PCI_QUIRK(0x1043, 0x18f1, "Asus FX505DT", ALC256_FIXUP_ASUS_HEADSET_MIC),
        SND_PCI_QUIRK(0x1043, 0x19ce, "ASUS B9450FA", ALC294_FIXUP_ASUS_HPE),
        SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
        SND_PCI_QUIRK(0x1043, 0x1a30, "ASUS X705UD", ALC256_FIXUP_ASUS_MIC),
@@ -8195,6 +8199,7 @@ static int patch_alc269(struct hda_codec *codec)
                spec->gen.mixer_nid = 0;
                break;
        case 0x10ec0215:
+       case 0x10ec0245:
        case 0x10ec0285:
        case 0x10ec0289:
                spec->codec_variant = ALC269_TYPE_ALC215;
@@ -9456,6 +9461,7 @@ static const struct hda_device_id snd_hda_id_realtek[] = {
        HDA_CODEC_ENTRY(0x10ec0234, "ALC234", patch_alc269),
        HDA_CODEC_ENTRY(0x10ec0235, "ALC233", patch_alc269),
        HDA_CODEC_ENTRY(0x10ec0236, "ALC236", patch_alc269),
+       HDA_CODEC_ENTRY(0x10ec0245, "ALC245", patch_alc269),
        HDA_CODEC_ENTRY(0x10ec0255, "ALC255", patch_alc269),
        HDA_CODEC_ENTRY(0x10ec0256, "ALC256", patch_alc269),
        HDA_CODEC_ENTRY(0x10ec0257, "ALC257", patch_alc269),
index 024a7ee..e499c00 100644 (file)
@@ -89,9 +89,9 @@ static int acp3x_5682_init(struct snd_soc_pcm_runtime *rtd)
        }
 
        snd_jack_set_key(pco_jack.jack, SND_JACK_BTN_0, KEY_PLAYPAUSE);
-       snd_jack_set_key(pco_jack.jack, SND_JACK_BTN_1, KEY_VOLUMEUP);
-       snd_jack_set_key(pco_jack.jack, SND_JACK_BTN_2, KEY_VOLUMEDOWN);
-       snd_jack_set_key(pco_jack.jack, SND_JACK_BTN_3, KEY_VOICECOMMAND);
+       snd_jack_set_key(pco_jack.jack, SND_JACK_BTN_1, KEY_VOICECOMMAND);
+       snd_jack_set_key(pco_jack.jack, SND_JACK_BTN_2, KEY_VOLUMEUP);
+       snd_jack_set_key(pco_jack.jack, SND_JACK_BTN_3, KEY_VOLUMEDOWN);
 
        ret = snd_soc_component_set_jack(component, &pco_jack, NULL);
        if (ret) {
index e6a0c5d..e60e0b6 100644 (file)
@@ -1525,6 +1525,7 @@ config SND_SOC_WM8804_SPI
 
 config SND_SOC_WM8900
        tristate
+       depends on SND_SOC_I2C_AND_SPI
 
 config SND_SOC_WM8903
        tristate "Wolfson Microelectronics WM8903 CODEC"
@@ -1576,6 +1577,7 @@ config SND_SOC_WM8985
 
 config SND_SOC_WM8988
        tristate
+       depends on SND_SOC_I2C_AND_SPI
 
 config SND_SOC_WM8990
        tristate
@@ -1594,6 +1596,7 @@ config SND_SOC_WM8994
 
 config SND_SOC_WM8995
        tristate
+       depends on SND_SOC_I2C_AND_SPI
 
 config SND_SOC_WM8996
        tristate
index fba9b74..f26b77f 100644 (file)
@@ -142,14 +142,14 @@ static struct hdac_hdmi_pcm *
 hdac_hdmi_get_pcm_from_cvt(struct hdac_hdmi_priv *hdmi,
                           struct hdac_hdmi_cvt *cvt)
 {
-       struct hdac_hdmi_pcm *pcm = NULL;
+       struct hdac_hdmi_pcm *pcm;
 
        list_for_each_entry(pcm, &hdmi->pcm_list, head) {
                if (pcm->cvt == cvt)
-                       break;
+                       return pcm;
        }
 
-       return pcm;
+       return NULL;
 }
 
 static void hdac_hdmi_jack_report(struct hdac_hdmi_pcm *pcm,
index 40de9d7..a448d2a 100644 (file)
@@ -1903,7 +1903,6 @@ const struct soc_enum madera_isrc_fsh[] = {
                              MADERA_ISRC4_FSH_SHIFT, 0xf,
                              MADERA_RATE_ENUM_SIZE,
                              madera_rate_text, madera_rate_val),
-
 };
 EXPORT_SYMBOL_GPL(madera_isrc_fsh);
 
@@ -1924,7 +1923,6 @@ const struct soc_enum madera_isrc_fsl[] = {
                              MADERA_ISRC4_FSL_SHIFT, 0xf,
                              MADERA_RATE_ENUM_SIZE,
                              madera_rate_text, madera_rate_val),
-
 };
 EXPORT_SYMBOL_GPL(madera_isrc_fsl);
 
@@ -1938,7 +1936,6 @@ const struct soc_enum madera_asrc1_rate[] = {
                              MADERA_ASYNC_RATE_ENUM_SIZE,
                              madera_rate_text + MADERA_SYNC_RATE_ENUM_SIZE,
                              madera_rate_val + MADERA_SYNC_RATE_ENUM_SIZE),
-
 };
 EXPORT_SYMBOL_GPL(madera_asrc1_rate);
 
@@ -1964,7 +1961,6 @@ const struct soc_enum madera_asrc2_rate[] = {
                              MADERA_ASYNC_RATE_ENUM_SIZE,
                              madera_rate_text + MADERA_SYNC_RATE_ENUM_SIZE,
                              madera_rate_val + MADERA_SYNC_RATE_ENUM_SIZE),
-
 };
 EXPORT_SYMBOL_GPL(madera_asrc2_rate);
 
index d513019..e8a8bf7 100644 (file)
@@ -1653,6 +1653,40 @@ static int sgtl5000_i2c_probe(struct i2c_client *client,
                dev_err(&client->dev,
                        "Error %d initializing CHIP_CLK_CTRL\n", ret);
 
+       /* Mute everything to avoid pop from the following power-up */
+       ret = regmap_write(sgtl5000->regmap, SGTL5000_CHIP_ANA_CTRL,
+                          SGTL5000_CHIP_ANA_CTRL_DEFAULT);
+       if (ret) {
+               dev_err(&client->dev,
+                       "Error %d muting outputs via CHIP_ANA_CTRL\n", ret);
+               goto disable_clk;
+       }
+
+       /*
+        * If VAG is powered-on (e.g. from previous boot), it would be disabled
+        * by the write to ANA_POWER in later steps of the probe code. This
+        * may create a loud pop even with all outputs muted. The proper way
+        * to circumvent this is disabling the bit first and waiting the proper
+        * cool-down time.
+        */
+       ret = regmap_read(sgtl5000->regmap, SGTL5000_CHIP_ANA_POWER, &value);
+       if (ret) {
+               dev_err(&client->dev, "Failed to read ANA_POWER: %d\n", ret);
+               goto disable_clk;
+       }
+       if (value & SGTL5000_VAG_POWERUP) {
+               ret = regmap_update_bits(sgtl5000->regmap,
+                                        SGTL5000_CHIP_ANA_POWER,
+                                        SGTL5000_VAG_POWERUP,
+                                        0);
+               if (ret) {
+                       dev_err(&client->dev, "Error %d disabling VAG\n", ret);
+                       goto disable_clk;
+               }
+
+               msleep(SGTL5000_VAG_POWERDOWN_DELAY);
+       }
+
        /* Follow section 2.2.1.1 of AN3663 */
        ana_pwr = SGTL5000_ANA_POWER_DEFAULT;
        if (sgtl5000->num_supplies <= VDDD) {
index a4bf4bc..56ec586 100644 (file)
 /*
  * SGTL5000_CHIP_ANA_CTRL
  */
+#define SGTL5000_CHIP_ANA_CTRL_DEFAULT         0x0133
 #define SGTL5000_LINE_OUT_MUTE                 0x0100
 #define SGTL5000_HP_SEL_MASK                   0x0040
 #define SGTL5000_HP_SEL_SHIFT                  6
index 1554631..5b7f9fc 100644 (file)
@@ -820,8 +820,10 @@ static int tas571x_i2c_probe(struct i2c_client *client,
 
        priv->regmap = devm_regmap_init(dev, NULL, client,
                                        priv->chip->regmap_config);
-       if (IS_ERR(priv->regmap))
-               return PTR_ERR(priv->regmap);
+       if (IS_ERR(priv->regmap)) {
+               ret = PTR_ERR(priv->regmap);
+               goto disable_regs;
+       }
 
        priv->pdn_gpio = devm_gpiod_get_optional(dev, "pdn", GPIOD_OUT_LOW);
        if (IS_ERR(priv->pdn_gpio)) {
@@ -845,7 +847,7 @@ static int tas571x_i2c_probe(struct i2c_client *client,
 
        ret = regmap_write(priv->regmap, TAS571X_OSC_TRIM_REG, 0);
        if (ret)
-               return ret;
+               goto disable_regs;
 
        usleep_range(50000, 60000);
 
@@ -861,12 +863,20 @@ static int tas571x_i2c_probe(struct i2c_client *client,
                 */
                ret = regmap_update_bits(priv->regmap, TAS571X_MVOL_REG, 1, 0);
                if (ret)
-                       return ret;
+                       goto disable_regs;
        }
 
-       return devm_snd_soc_register_component(&client->dev,
+       ret = devm_snd_soc_register_component(&client->dev,
                                      &priv->component_driver,
                                      &tas571x_dai, 1);
+       if (ret)
+               goto disable_regs;
+
+       return ret;
+
+disable_regs:
+       regulator_bulk_disable(priv->chip->num_supply_names, priv->supplies);
+       return ret;
 }
 
 static int tas571x_i2c_remove(struct i2c_client *client)
index 55112c1..6cf0f66 100644 (file)
@@ -860,8 +860,7 @@ static int wm8960_hw_params(struct snd_pcm_substream *substream,
 
        wm8960->is_stream_in_use[tx] = true;
 
-       if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_ON &&
-           !wm8960->is_stream_in_use[!tx])
+       if (!wm8960->is_stream_in_use[!tx])
                return wm8960_configure_clocking(component);
 
        return 0;
index f2d6f2f..d39d479 100644 (file)
@@ -394,6 +394,7 @@ static struct sdw_dpn_prop wsa_sink_dpn_prop[WSA881X_MAX_SWR_PORTS] = {
                .min_ch = 1,
                .max_ch = 1,
                .simple_ch_prep_sm = true,
+               .read_only_wordlength = true,
        }, {
                /* COMP */
                .num = 2,
@@ -401,6 +402,7 @@ static struct sdw_dpn_prop wsa_sink_dpn_prop[WSA881X_MAX_SWR_PORTS] = {
                .min_ch = 1,
                .max_ch = 1,
                .simple_ch_prep_sm = true,
+               .read_only_wordlength = true,
        }, {
                /* BOOST */
                .num = 3,
@@ -408,6 +410,7 @@ static struct sdw_dpn_prop wsa_sink_dpn_prop[WSA881X_MAX_SWR_PORTS] = {
                .min_ch = 1,
                .max_ch = 1,
                .simple_ch_prep_sm = true,
+               .read_only_wordlength = true,
        }, {
                /* VISENSE */
                .num = 4,
@@ -415,6 +418,7 @@ static struct sdw_dpn_prop wsa_sink_dpn_prop[WSA881X_MAX_SWR_PORTS] = {
                .min_ch = 1,
                .max_ch = 1,
                .simple_ch_prep_sm = true,
+               .read_only_wordlength = true,
        }
 };
 
index bcedec6..7d85bd5 100644 (file)
@@ -113,14 +113,6 @@ static const struct snd_soc_acpi_adr_device rt1308_1_adr[] = {
        }
 };
 
-static const struct snd_soc_acpi_adr_device rt1308_2_adr[] = {
-       {
-               .adr = 0x000210025D130800,
-               .num_endpoints = 1,
-               .endpoints = &single_endpoint,
-       }
-};
-
 static const struct snd_soc_acpi_adr_device rt1308_1_group1_adr[] = {
        {
                .adr = 0x000110025D130800,
index ef85003..16ec9f3 100644 (file)
@@ -87,14 +87,6 @@ static const struct snd_soc_acpi_adr_device rt1308_1_adr[] = {
        }
 };
 
-static const struct snd_soc_acpi_adr_device rt1308_2_adr[] = {
-       {
-               .adr = 0x000210025D130800,
-               .num_endpoints = 1,
-               .endpoints = &single_endpoint,
-       }
-};
-
 static const struct snd_soc_acpi_adr_device rt1308_1_group1_adr[] = {
        {
                .adr = 0x000110025D130800,
index af46845..89f7f64 100644 (file)
@@ -338,8 +338,10 @@ static int axg_card_add_link(struct snd_soc_card *card, struct device_node *np,
 
        if (axg_card_cpu_is_tdm_iface(dai_link->cpus->of_node))
                ret = axg_card_parse_tdm(card, np, index);
-       else if (axg_card_cpu_is_codec(dai_link->cpus->of_node))
+       else if (axg_card_cpu_is_codec(dai_link->cpus->of_node)) {
                dai_link->params = &codec_params;
+               dai_link->no_pcm = 0; /* link is not a DPCM BE */
+       }
 
        return ret;
 }
index 7b01dcb..4abf7ef 100644 (file)
@@ -108,8 +108,10 @@ static int gx_card_add_link(struct snd_soc_card *card, struct device_node *np,
                ret = gx_card_parse_i2s(card, np, index);
 
        /* Or apply codec to codec params if necessary */
-       else if (gx_card_cpu_identify(dai_link->cpus, "CODEC CTRL"))
+       else if (gx_card_cpu_identify(dai_link->cpus, "CODEC CTRL")) {
                dai_link->params = &codec_params;
+               dai_link->no_pcm = 0; /* link is not a DPCM BE */
+       }
 
        return ret;
 }
index d55e3ad..287ad2a 100644 (file)
@@ -116,10 +116,8 @@ static int apq8096_platform_probe(struct platform_device *pdev)
        card->dev = dev;
        dev_set_drvdata(dev, card);
        ret = qcom_snd_parse_of(card);
-       if (ret) {
-               dev_err(dev, "Error parsing OF data\n");
+       if (ret)
                goto err;
-       }
 
        apq8096_add_be_ops(card);
        ret = snd_soc_register_card(card);
index c1a7624..2a5302f 100644 (file)
@@ -902,6 +902,8 @@ static struct snd_soc_dai_driver q6afe_dais[] = {
                                 SNDRV_PCM_RATE_16000,
                        .formats = SNDRV_PCM_FMTBIT_S16_LE |
                                   SNDRV_PCM_FMTBIT_S24_LE,
+                       .channels_min = 1,
+                       .channels_max = 8,
                        .rate_min =     8000,
                        .rate_max =     48000,
                },
@@ -917,6 +919,8 @@ static struct snd_soc_dai_driver q6afe_dais[] = {
                                 SNDRV_PCM_RATE_16000,
                        .formats = SNDRV_PCM_FMTBIT_S16_LE |
                                   SNDRV_PCM_FMTBIT_S24_LE,
+                       .channels_min = 1,
+                       .channels_max = 8,
                        .rate_min =     8000,
                        .rate_max =     48000,
                },
@@ -931,6 +935,8 @@ static struct snd_soc_dai_driver q6afe_dais[] = {
                        .rates = SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_8000 |
                                 SNDRV_PCM_RATE_16000,
                        .formats = SNDRV_PCM_FMTBIT_S16_LE,
+                       .channels_min = 1,
+                       .channels_max = 8,
                        .rate_min =     8000,
                        .rate_max =     48000,
                },
@@ -946,6 +952,8 @@ static struct snd_soc_dai_driver q6afe_dais[] = {
                                 SNDRV_PCM_RATE_16000,
                        .formats = SNDRV_PCM_FMTBIT_S16_LE |
                                   SNDRV_PCM_FMTBIT_S24_LE,
+                       .channels_min = 1,
+                       .channels_max = 8,
                        .rate_min =     8000,
                        .rate_max =     48000,
                },
@@ -960,6 +968,8 @@ static struct snd_soc_dai_driver q6afe_dais[] = {
                        .rates = SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_8000 |
                                 SNDRV_PCM_RATE_16000,
                        .formats = SNDRV_PCM_FMTBIT_S16_LE,
+                       .channels_min = 1,
+                       .channels_max = 8,
                        .rate_min =     8000,
                        .rate_max =     48000,
                },
@@ -975,6 +985,8 @@ static struct snd_soc_dai_driver q6afe_dais[] = {
                                 SNDRV_PCM_RATE_16000,
                        .formats = SNDRV_PCM_FMTBIT_S16_LE |
                                   SNDRV_PCM_FMTBIT_S24_LE,
+                       .channels_min = 1,
+                       .channels_max = 8,
                        .rate_min =     8000,
                        .rate_max =     48000,
                },
@@ -989,6 +1001,8 @@ static struct snd_soc_dai_driver q6afe_dais[] = {
                        .rates = SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_8000 |
                                 SNDRV_PCM_RATE_16000,
                        .formats = SNDRV_PCM_FMTBIT_S16_LE,
+                       .channels_min = 1,
+                       .channels_max = 8,
                        .rate_min =     8000,
                        .rate_max =     48000,
                },
@@ -1004,6 +1018,8 @@ static struct snd_soc_dai_driver q6afe_dais[] = {
                                 SNDRV_PCM_RATE_16000,
                        .formats = SNDRV_PCM_FMTBIT_S16_LE |
                                   SNDRV_PCM_FMTBIT_S24_LE,
+                       .channels_min = 1,
+                       .channels_max = 8,
                        .rate_min =     8000,
                        .rate_max =     48000,
                },
index b2de65c..68e9388 100644 (file)
@@ -559,10 +559,8 @@ static int sdm845_snd_platform_probe(struct platform_device *pdev)
        card->dev = dev;
        dev_set_drvdata(dev, card);
        ret = qcom_snd_parse_of(card);
-       if (ret) {
-               dev_err(dev, "Error parsing OF data\n");
+       if (ret)
                goto parse_dt_fail;
-       }
 
        data->card = card;
        snd_soc_card_set_drvdata(card, data);
index 3588878..5e95c30 100644 (file)
@@ -656,60 +656,6 @@ void s3c_i2sv2_cleanup(struct snd_soc_dai *dai,
 }
 EXPORT_SYMBOL_GPL(s3c_i2sv2_cleanup);
 
-#ifdef CONFIG_PM
-static int s3c2412_i2s_suspend(struct snd_soc_dai *dai)
-{
-       struct s3c_i2sv2_info *i2s = to_info(dai);
-       u32 iismod;
-
-       if (dai->active) {
-               i2s->suspend_iismod = readl(i2s->regs + S3C2412_IISMOD);
-               i2s->suspend_iiscon = readl(i2s->regs + S3C2412_IISCON);
-               i2s->suspend_iispsr = readl(i2s->regs + S3C2412_IISPSR);
-
-               /* some basic suspend checks */
-
-               iismod = readl(i2s->regs + S3C2412_IISMOD);
-
-               if (iismod & S3C2412_IISCON_RXDMA_ACTIVE)
-                       pr_warn("%s: RXDMA active?\n", __func__);
-
-               if (iismod & S3C2412_IISCON_TXDMA_ACTIVE)
-                       pr_warn("%s: TXDMA active?\n", __func__);
-
-               if (iismod & S3C2412_IISCON_IIS_ACTIVE)
-                       pr_warn("%s: IIS active\n", __func__);
-       }
-
-       return 0;
-}
-
-static int s3c2412_i2s_resume(struct snd_soc_dai *dai)
-{
-       struct s3c_i2sv2_info *i2s = to_info(dai);
-
-       pr_info("dai_active %d, IISMOD %08x, IISCON %08x\n",
-               dai->active, i2s->suspend_iismod, i2s->suspend_iiscon);
-
-       if (dai->active) {
-               writel(i2s->suspend_iiscon, i2s->regs + S3C2412_IISCON);
-               writel(i2s->suspend_iismod, i2s->regs + S3C2412_IISMOD);
-               writel(i2s->suspend_iispsr, i2s->regs + S3C2412_IISPSR);
-
-               writel(S3C2412_IISFIC_RXFLUSH | S3C2412_IISFIC_TXFLUSH,
-                      i2s->regs + S3C2412_IISFIC);
-
-               ndelay(250);
-               writel(0x0, i2s->regs + S3C2412_IISFIC);
-       }
-
-       return 0;
-}
-#else
-#define s3c2412_i2s_suspend NULL
-#define s3c2412_i2s_resume  NULL
-#endif
-
 int s3c_i2sv2_register_component(struct device *dev, int id,
                           const struct snd_soc_component_driver *cmp_drv,
                           struct snd_soc_dai_driver *dai_drv)
@@ -727,9 +673,6 @@ int s3c_i2sv2_register_component(struct device *dev, int id,
        if (!ops->delay)
                ops->delay = s3c2412_i2s_delay;
 
-       dai_drv->suspend = s3c2412_i2s_suspend;
-       dai_drv->resume = s3c2412_i2s_resume;
-
        return devm_snd_soc_register_component(dev, cmp_drv, dai_drv, 1);
 }
 EXPORT_SYMBOL_GPL(s3c_i2sv2_register_component);
index 787a3f6..b35d828 100644 (file)
@@ -117,6 +117,60 @@ static int s3c2412_i2s_hw_params(struct snd_pcm_substream *substream,
        return 0;
 }
 
+#ifdef CONFIG_PM
+static int s3c2412_i2s_suspend(struct snd_soc_component *component)
+{
+       struct s3c_i2sv2_info *i2s = snd_soc_component_get_drvdata(component);
+       u32 iismod;
+
+       if (component->active) {
+               i2s->suspend_iismod = readl(i2s->regs + S3C2412_IISMOD);
+               i2s->suspend_iiscon = readl(i2s->regs + S3C2412_IISCON);
+               i2s->suspend_iispsr = readl(i2s->regs + S3C2412_IISPSR);
+
+               /* some basic suspend checks */
+
+               iismod = readl(i2s->regs + S3C2412_IISMOD);
+
+               if (iismod & S3C2412_IISCON_RXDMA_ACTIVE)
+                       pr_warn("%s: RXDMA active?\n", __func__);
+
+               if (iismod & S3C2412_IISCON_TXDMA_ACTIVE)
+                       pr_warn("%s: TXDMA active?\n", __func__);
+
+               if (iismod & S3C2412_IISCON_IIS_ACTIVE)
+                       pr_warn("%s: IIS active\n", __func__);
+       }
+
+       return 0;
+}
+
+static int s3c2412_i2s_resume(struct snd_soc_component *component)
+{
+       struct s3c_i2sv2_info *i2s = snd_soc_component_get_drvdata(component);
+
+       pr_info("component_active %d, IISMOD %08x, IISCON %08x\n",
+               component->active, i2s->suspend_iismod, i2s->suspend_iiscon);
+
+       if (component->active) {
+               writel(i2s->suspend_iiscon, i2s->regs + S3C2412_IISCON);
+               writel(i2s->suspend_iismod, i2s->regs + S3C2412_IISMOD);
+               writel(i2s->suspend_iispsr, i2s->regs + S3C2412_IISPSR);
+
+               writel(S3C2412_IISFIC_RXFLUSH | S3C2412_IISFIC_TXFLUSH,
+                      i2s->regs + S3C2412_IISFIC);
+
+               ndelay(250);
+               writel(0x0, i2s->regs + S3C2412_IISFIC);
+       }
+
+       return 0;
+}
+#else
+#define s3c2412_i2s_suspend NULL
+#define s3c2412_i2s_resume  NULL
+#endif
+
 #define S3C2412_I2S_RATES \
        (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 | SNDRV_PCM_RATE_16000 | \
        SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | \
@@ -146,6 +200,8 @@ static struct snd_soc_dai_driver s3c2412_i2s_dai = {
 
 static const struct snd_soc_component_driver s3c2412_i2s_component = {
        .name           = "s3c2412-i2s",
+       .suspend        = s3c2412_i2s_suspend,
+       .resume         = s3c2412_i2s_resume,
 };
 
 static int s3c2412_iis_dev_probe(struct platform_device *pdev)
index fc5d089..4a7d341 100644 (file)
@@ -594,10 +594,16 @@ static int rsnd_ssi_stop(struct rsnd_mod *mod,
         * Capture:  It might not receave data. Do nothing
         */
        if (rsnd_io_is_play(io)) {
-               rsnd_mod_write(mod, SSICR, cr | EN);
+               rsnd_mod_write(mod, SSICR, cr | ssi->cr_en);
                rsnd_ssi_status_check(mod, DIRQ);
        }
 
+       /* In multi-SSI mode, stop is performed by setting ssi0129 in
+        * SSI_CONTROL to 0 (in rsnd_ssio_stop_gen2). Do nothing here.
+        */
+       if (rsnd_ssi_multi_slaves_runtime(io))
+               return 0;
+
        /*
         * disable SSI,
         * and, wait idle state
@@ -737,6 +743,9 @@ static void rsnd_ssi_parent_attach(struct rsnd_mod *mod,
        if (!rsnd_rdai_is_clk_master(rdai))
                return;
 
+       if (rsnd_ssi_is_multi_slave(mod, io))
+               return;
+
        switch (rsnd_mod_id(mod)) {
        case 1:
        case 2:
index f35d882..9c7c3e7 100644 (file)
@@ -221,7 +221,7 @@ static int rsnd_ssiu_init_gen2(struct rsnd_mod *mod,
                        i;
 
                for_each_rsnd_mod_array(i, pos, io, rsnd_ssi_array) {
-                       shift   = (i * 4) + 16;
+                       shift   = (i * 4) + 20;
                        val     = (val & ~(0xF << shift)) |
                                rsnd_mod_id(pos) << shift;
                }
index 8f3cad8..31c4155 100644 (file)
@@ -295,24 +295,17 @@ int snd_soc_dai_startup(struct snd_soc_dai *dai,
 {
        int ret = 0;
 
-       if (!dai->started[substream->stream] &&
-           dai->driver->ops->startup)
+       if (dai->driver->ops->startup)
                ret = dai->driver->ops->startup(substream, dai);
 
-       if (ret == 0)
-               dai->started[substream->stream] = 1;
-
        return ret;
 }
 
 void snd_soc_dai_shutdown(struct snd_soc_dai *dai,
                         struct snd_pcm_substream *substream)
 {
-       if (dai->started[substream->stream] &&
-           dai->driver->ops->shutdown)
+       if (dai->driver->ops->shutdown)
                dai->driver->ops->shutdown(substream, dai);
-
-       dai->started[substream->stream] = 0;
 }
 
 int snd_soc_dai_prepare(struct snd_soc_dai *dai,
index 679ed60..e263284 100644 (file)
@@ -423,7 +423,7 @@ static int dapm_kcontrol_data_alloc(struct snd_soc_dapm_widget *widget,
 
                        memset(&template, 0, sizeof(template));
                        template.reg = e->reg;
-                       template.mask = e->mask << e->shift_l;
+                       template.mask = e->mask;
                        template.shift = e->shift_l;
                        template.off_val = snd_soc_enum_item_to_val(e, 0);
                        template.on_val = template.off_val;
@@ -546,8 +546,22 @@ static bool dapm_kcontrol_set_value(const struct snd_kcontrol *kcontrol,
        if (data->value == value)
                return false;
 
-       if (data->widget)
-               data->widget->on_val = value;
+       if (data->widget) {
+               switch (dapm_kcontrol_get_wlist(kcontrol)->widgets[0]->id) {
+               case snd_soc_dapm_switch:
+               case snd_soc_dapm_mixer:
+               case snd_soc_dapm_mixer_named_ctl:
+                       data->widget->on_val = value & data->widget->mask;
+                       break;
+               case snd_soc_dapm_demux:
+               case snd_soc_dapm_mux:
+                       data->widget->on_val = value >> data->widget->shift;
+                       break;
+               default:
+                       data->widget->on_val = value;
+                       break;
+               }
+       }
 
        data->value = value;
 
@@ -4165,6 +4179,8 @@ snd_soc_dapm_new_dai(struct snd_soc_card *card,
        w = snd_soc_dapm_new_control_unlocked(&card->dapm, &template);
        if (IS_ERR(w)) {
                ret = PTR_ERR(w);
+               dev_err(rtd->dev, "ASoC: Failed to create %s widget: %d\n",
+                       link_name, ret);
                goto outfree_kcontrol_news;
        }
 
@@ -4283,52 +4299,58 @@ int snd_soc_dapm_link_dai_widgets(struct snd_soc_card *card)
        return 0;
 }
 
-static void dapm_add_valid_dai_widget(struct snd_soc_card *card,
-                                     struct snd_soc_pcm_runtime *rtd,
-                                     struct snd_soc_dai *codec_dai,
-                                     struct snd_soc_dai *cpu_dai)
+static void dapm_connect_dai_routes(struct snd_soc_dapm_context *dapm,
+                                   struct snd_soc_dai *src_dai,
+                                   struct snd_soc_dapm_widget *src,
+                                   struct snd_soc_dapm_widget *dai,
+                                   struct snd_soc_dai *sink_dai,
+                                   struct snd_soc_dapm_widget *sink)
 {
-       struct snd_soc_dapm_widget *playback = NULL, *capture = NULL;
-       struct snd_soc_dapm_widget *codec, *playback_cpu, *capture_cpu;
+       dev_dbg(dapm->dev, "connected DAI link %s:%s -> %s:%s\n",
+               src_dai->component->name, src->name,
+               sink_dai->component->name, sink->name);
+
+       if (dai) {
+               snd_soc_dapm_add_path(dapm, src, dai, NULL, NULL);
+               src = dai;
+       }
+
+       snd_soc_dapm_add_path(dapm, src, sink, NULL, NULL);
+}
+
+static void dapm_connect_dai_pair(struct snd_soc_card *card,
+                                 struct snd_soc_pcm_runtime *rtd,
+                                 struct snd_soc_dai *codec_dai,
+                                 struct snd_soc_dai *cpu_dai)
+{
+       struct snd_soc_dai_link *dai_link = rtd->dai_link;
+       struct snd_soc_dapm_widget *dai, *codec, *playback_cpu, *capture_cpu;
        struct snd_pcm_substream *substream;
        struct snd_pcm_str *streams = rtd->pcm->streams;
 
-       if (rtd->dai_link->params) {
+       if (dai_link->params) {
                playback_cpu = cpu_dai->capture_widget;
                capture_cpu = cpu_dai->playback_widget;
        } else {
-               playback = cpu_dai->playback_widget;
-               capture = cpu_dai->capture_widget;
-               playback_cpu = playback;
-               capture_cpu = capture;
+               playback_cpu = cpu_dai->playback_widget;
+               capture_cpu = cpu_dai->capture_widget;
        }
 
        /* connect BE DAI playback if widgets are valid */
        codec = codec_dai->playback_widget;
 
        if (playback_cpu && codec) {
-               if (!playback) {
+               if (dai_link->params && !dai_link->playback_widget) {
                        substream = streams[SNDRV_PCM_STREAM_PLAYBACK].substream;
-                       playback = snd_soc_dapm_new_dai(card, substream,
-                                                       "playback");
-                       if (IS_ERR(playback)) {
-                               dev_err(rtd->dev,
-                                       "ASoC: Failed to create DAI %s: %ld\n",
-                                       codec_dai->name,
-                                       PTR_ERR(playback));
+                       dai = snd_soc_dapm_new_dai(card, substream, "playback");
+                       if (IS_ERR(dai))
                                goto capture;
-                       }
-
-                       snd_soc_dapm_add_path(&card->dapm, playback_cpu,
-                                             playback, NULL, NULL);
+                       dai_link->playback_widget = dai;
                }
 
-               dev_dbg(rtd->dev, "connected DAI link %s:%s -> %s:%s\n",
-                       cpu_dai->component->name, playback_cpu->name,
-                       codec_dai->component->name, codec->name);
-
-               snd_soc_dapm_add_path(&card->dapm, playback, codec,
-                                     NULL, NULL);
+               dapm_connect_dai_routes(&card->dapm, cpu_dai, playback_cpu,
+                                       dai_link->playback_widget,
+                                       codec_dai, codec);
        }
 
 capture:
@@ -4336,50 +4358,18 @@ capture:
        codec = codec_dai->capture_widget;
 
        if (codec && capture_cpu) {
-               if (!capture) {
+               if (dai_link->params && !dai_link->capture_widget) {
                        substream = streams[SNDRV_PCM_STREAM_CAPTURE].substream;
-                       capture = snd_soc_dapm_new_dai(card, substream,
-                                                      "capture");
-                       if (IS_ERR(capture)) {
-                               dev_err(rtd->dev,
-                                       "ASoC: Failed to create DAI %s: %ld\n",
-                                       codec_dai->name,
-                                       PTR_ERR(capture));
+                       dai = snd_soc_dapm_new_dai(card, substream, "capture");
+                       if (IS_ERR(dai))
                                return;
-                       }
-
-                       snd_soc_dapm_add_path(&card->dapm, capture,
-                                             capture_cpu, NULL, NULL);
+                       dai_link->capture_widget = dai;
                }
 
-               dev_dbg(rtd->dev, "connected DAI link %s:%s -> %s:%s\n",
-                       codec_dai->component->name, codec->name,
-                       cpu_dai->component->name, capture_cpu->name);
-
-               snd_soc_dapm_add_path(&card->dapm, codec, capture,
-                                     NULL, NULL);
-       }
-}
-
-static void dapm_connect_dai_link_widgets(struct snd_soc_card *card,
-                                         struct snd_soc_pcm_runtime *rtd)
-{
-       struct snd_soc_dai *codec_dai;
-       int i;
-
-       if (rtd->num_cpus == 1) {
-               for_each_rtd_codec_dais(rtd, i, codec_dai)
-                       dapm_add_valid_dai_widget(card, rtd, codec_dai,
-                                                 rtd->cpu_dais[0]);
-       } else if (rtd->num_codecs == rtd->num_cpus) {
-               for_each_rtd_codec_dais(rtd, i, codec_dai)
-                       dapm_add_valid_dai_widget(card, rtd, codec_dai,
-                                                 rtd->cpu_dais[i]);
-       } else {
-               dev_err(card->dev,
-                       "N cpus to M codecs link is not supported yet\n");
+               dapm_connect_dai_routes(&card->dapm, codec_dai, codec,
+                                       dai_link->capture_widget,
+                                       cpu_dai, capture_cpu);
        }
-
 }
 
 static void soc_dapm_dai_stream_event(struct snd_soc_dai *dai, int stream,
@@ -4422,6 +4412,8 @@ static void soc_dapm_dai_stream_event(struct snd_soc_dai *dai, int stream,
 void snd_soc_dapm_connect_dai_link_widgets(struct snd_soc_card *card)
 {
        struct snd_soc_pcm_runtime *rtd;
+       struct snd_soc_dai *codec_dai;
+       int i;
 
        /* for each BE DAI link... */
        for_each_card_rtds(card, rtd)  {
@@ -4432,7 +4424,18 @@ void snd_soc_dapm_connect_dai_link_widgets(struct snd_soc_card *card)
                if (rtd->dai_link->dynamic)
                        continue;
 
-               dapm_connect_dai_link_widgets(card, rtd);
+               if (rtd->num_cpus == 1) {
+                       for_each_rtd_codec_dais(rtd, i, codec_dai)
+                               dapm_connect_dai_pair(card, rtd, codec_dai,
+                                                     rtd->cpu_dais[0]);
+               } else if (rtd->num_codecs == rtd->num_cpus) {
+                       for_each_rtd_codec_dais(rtd, i, codec_dai)
+                               dapm_connect_dai_pair(card, rtd, codec_dai,
+                                                     rtd->cpu_dais[i]);
+               } else {
+                       dev_err(card->dev,
+                               "N cpus to M codecs link is not supported yet\n");
+               }
        }
 }
 
index 289aebc..1f302de 100644 (file)
@@ -2911,8 +2911,17 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num)
        int i;
 
        if (rtd->dai_link->dynamic || rtd->dai_link->no_pcm) {
-               playback = rtd->dai_link->dpcm_playback;
-               capture = rtd->dai_link->dpcm_capture;
+               cpu_dai = asoc_rtd_to_cpu(rtd, 0);
+               if (rtd->num_cpus > 1) {
+                       dev_err(rtd->dev,
+                               "DPCM doesn't support Multi CPU yet\n");
+                       return -EINVAL;
+               }
+
+               playback = rtd->dai_link->dpcm_playback &&
+                          snd_soc_dai_stream_valid(cpu_dai, SNDRV_PCM_STREAM_PLAYBACK);
+               capture = rtd->dai_link->dpcm_capture &&
+                         snd_soc_dai_stream_valid(cpu_dai, SNDRV_PCM_STREAM_CAPTURE);
        } else {
                /* Adapt stream for codec2codec links */
                int cpu_capture = rtd->dai_link->params ?
index 87f75ed..6df3b0d 100644 (file)
@@ -894,7 +894,13 @@ static int soc_tplg_dmixer_create(struct soc_tplg *tplg, unsigned int count,
                }
 
                /* create any TLV data */
-               soc_tplg_create_tlv(tplg, &kc, &mc->hdr);
+               err = soc_tplg_create_tlv(tplg, &kc, &mc->hdr);
+               if (err < 0) {
+                       dev_err(tplg->dev, "ASoC: failed to create TLV %s\n",
+                               mc->hdr.name);
+                       kfree(sm);
+                       continue;
+               }
 
                /* pass control to driver for optional further init */
                err = soc_tplg_init_kcontrol(tplg, &kc,
@@ -1118,6 +1124,7 @@ static int soc_tplg_kcontrol_elems_load(struct soc_tplg *tplg,
        struct snd_soc_tplg_hdr *hdr)
 {
        struct snd_soc_tplg_ctl_hdr *control_hdr;
+       int ret;
        int i;
 
        if (tplg->pass != SOC_TPLG_PASS_MIXER) {
@@ -1146,25 +1153,30 @@ static int soc_tplg_kcontrol_elems_load(struct soc_tplg *tplg,
                case SND_SOC_TPLG_CTL_RANGE:
                case SND_SOC_TPLG_DAPM_CTL_VOLSW:
                case SND_SOC_TPLG_DAPM_CTL_PIN:
-                       soc_tplg_dmixer_create(tplg, 1,
-                                              le32_to_cpu(hdr->payload_size));
+                       ret = soc_tplg_dmixer_create(tplg, 1,
+                                       le32_to_cpu(hdr->payload_size));
                        break;
                case SND_SOC_TPLG_CTL_ENUM:
                case SND_SOC_TPLG_CTL_ENUM_VALUE:
                case SND_SOC_TPLG_DAPM_CTL_ENUM_DOUBLE:
                case SND_SOC_TPLG_DAPM_CTL_ENUM_VIRT:
                case SND_SOC_TPLG_DAPM_CTL_ENUM_VALUE:
-                       soc_tplg_denum_create(tplg, 1,
-                                             le32_to_cpu(hdr->payload_size));
+                       ret = soc_tplg_denum_create(tplg, 1,
+                                       le32_to_cpu(hdr->payload_size));
                        break;
                case SND_SOC_TPLG_CTL_BYTES:
-                       soc_tplg_dbytes_create(tplg, 1,
-                                              le32_to_cpu(hdr->payload_size));
+                       ret = soc_tplg_dbytes_create(tplg, 1,
+                                       le32_to_cpu(hdr->payload_size));
                        break;
                default:
                        soc_bind_err(tplg, control_hdr, i);
                        return -EINVAL;
                }
+               if (ret < 0) {
+                       dev_err(tplg->dev, "ASoC: invalid control\n");
+                       return ret;
+               }
+
        }
 
        return 0;
@@ -1272,7 +1284,9 @@ static int soc_tplg_dapm_graph_elems_load(struct soc_tplg *tplg,
                routes[i]->dobj.index = tplg->index;
                list_add(&routes[i]->dobj.list, &tplg->comp->dobj_list);
 
-               soc_tplg_add_route(tplg, routes[i]);
+               ret = soc_tplg_add_route(tplg, routes[i]);
+               if (ret < 0)
+                       break;
 
                /* add route, but keep going if some fail */
                snd_soc_dapm_add_routes(dapm, routes[i], 1);
@@ -1355,7 +1369,13 @@ static struct snd_kcontrol_new *soc_tplg_dapm_widget_dmixer_create(
                }
 
                /* create any TLV data */
-               soc_tplg_create_tlv(tplg, &kc[i], &mc->hdr);
+               err = soc_tplg_create_tlv(tplg, &kc[i], &mc->hdr);
+               if (err < 0) {
+                       dev_err(tplg->dev, "ASoC: failed to create TLV %s\n",
+                               mc->hdr.name);
+                       kfree(sm);
+                       continue;
+               }
 
                /* pass control to driver for optional further init */
                err = soc_tplg_init_kcontrol(tplg, &kc[i],
@@ -1766,10 +1786,13 @@ static int soc_tplg_dapm_complete(struct soc_tplg *tplg)
        return 0;
 }
 
-static void set_stream_info(struct snd_soc_pcm_stream *stream,
+static int set_stream_info(struct snd_soc_pcm_stream *stream,
        struct snd_soc_tplg_stream_caps *caps)
 {
        stream->stream_name = kstrdup(caps->name, GFP_KERNEL);
+       if (!stream->stream_name)
+               return -ENOMEM;
+
        stream->channels_min = le32_to_cpu(caps->channels_min);
        stream->channels_max = le32_to_cpu(caps->channels_max);
        stream->rates = le32_to_cpu(caps->rates);
@@ -1777,6 +1800,8 @@ static void set_stream_info(struct snd_soc_pcm_stream *stream,
        stream->rate_max = le32_to_cpu(caps->rate_max);
        stream->formats = le64_to_cpu(caps->formats);
        stream->sig_bits = le32_to_cpu(caps->sig_bits);
+
+       return 0;
 }
 
 static void set_dai_flags(struct snd_soc_dai_driver *dai_drv,
@@ -1812,20 +1837,29 @@ static int soc_tplg_dai_create(struct soc_tplg *tplg,
        if (dai_drv == NULL)
                return -ENOMEM;
 
-       if (strlen(pcm->dai_name))
+       if (strlen(pcm->dai_name)) {
                dai_drv->name = kstrdup(pcm->dai_name, GFP_KERNEL);
+               if (!dai_drv->name) {
+                       ret = -ENOMEM;
+                       goto err;
+               }
+       }
        dai_drv->id = le32_to_cpu(pcm->dai_id);
 
        if (pcm->playback) {
                stream = &dai_drv->playback;
                caps = &pcm->caps[SND_SOC_TPLG_STREAM_PLAYBACK];
-               set_stream_info(stream, caps);
+               ret = set_stream_info(stream, caps);
+               if (ret < 0)
+                       goto err;
        }
 
        if (pcm->capture) {
                stream = &dai_drv->capture;
                caps = &pcm->caps[SND_SOC_TPLG_STREAM_CAPTURE];
-               set_stream_info(stream, caps);
+               ret = set_stream_info(stream, caps);
+               if (ret < 0)
+                       goto err;
        }
 
        if (pcm->compress)
@@ -1835,11 +1869,7 @@ static int soc_tplg_dai_create(struct soc_tplg *tplg,
        ret = soc_tplg_dai_load(tplg, dai_drv, pcm, NULL);
        if (ret < 0) {
                dev_err(tplg->comp->dev, "ASoC: DAI loading failed\n");
-               kfree(dai_drv->playback.stream_name);
-               kfree(dai_drv->capture.stream_name);
-               kfree(dai_drv->name);
-               kfree(dai_drv);
-               return ret;
+               goto err;
        }
 
        dai_drv->dobj.index = tplg->index;
@@ -1860,6 +1890,14 @@ static int soc_tplg_dai_create(struct soc_tplg *tplg,
                return ret;
        }
 
+       return 0;
+
+err:
+       kfree(dai_drv->playback.stream_name);
+       kfree(dai_drv->capture.stream_name);
+       kfree(dai_drv->name);
+       kfree(dai_drv);
+
        return ret;
 }
 
@@ -1916,11 +1954,20 @@ static int soc_tplg_fe_link_create(struct soc_tplg *tplg,
        if (strlen(pcm->pcm_name)) {
                link->name = kstrdup(pcm->pcm_name, GFP_KERNEL);
                link->stream_name = kstrdup(pcm->pcm_name, GFP_KERNEL);
+               if (!link->name || !link->stream_name) {
+                       ret = -ENOMEM;
+                       goto err;
+               }
        }
        link->id = le32_to_cpu(pcm->pcm_id);
 
-       if (strlen(pcm->dai_name))
+       if (strlen(pcm->dai_name)) {
                link->cpus->dai_name = kstrdup(pcm->dai_name, GFP_KERNEL);
+               if (!link->cpus->dai_name) {
+                       ret = -ENOMEM;
+                       goto err;
+               }
+       }
 
        link->codecs->name = "snd-soc-dummy";
        link->codecs->dai_name = "snd-soc-dummy-dai";
@@ -2088,7 +2135,9 @@ static int soc_tplg_pcm_elems_load(struct soc_tplg *tplg,
                        _pcm = pcm;
                } else {
                        abi_match = false;
-                       pcm_new_ver(tplg, pcm, &_pcm);
+                       ret = pcm_new_ver(tplg, pcm, &_pcm);
+                       if (ret < 0)
+                               return ret;
                }
 
                /* create the FE DAIs and DAI links */
@@ -2436,13 +2485,17 @@ static int soc_tplg_dai_config(struct soc_tplg *tplg,
        if (d->playback) {
                stream = &dai_drv->playback;
                caps = &d->caps[SND_SOC_TPLG_STREAM_PLAYBACK];
-               set_stream_info(stream, caps);
+               ret = set_stream_info(stream, caps);
+               if (ret < 0)
+                       goto err;
        }
 
        if (d->capture) {
                stream = &dai_drv->capture;
                caps = &d->caps[SND_SOC_TPLG_STREAM_CAPTURE];
-               set_stream_info(stream, caps);
+               ret = set_stream_info(stream, caps);
+               if (ret < 0)
+                       goto err;
        }
 
        if (d->flag_mask)
@@ -2454,10 +2507,15 @@ static int soc_tplg_dai_config(struct soc_tplg *tplg,
        ret = soc_tplg_dai_load(tplg, dai_drv, NULL, dai);
        if (ret < 0) {
                dev_err(tplg->comp->dev, "ASoC: DAI loading failed\n");
-               return ret;
+               goto err;
        }
 
        return 0;
+
+err:
+       kfree(dai_drv->playback.stream_name);
+       kfree(dai_drv->capture.stream_name);
+       return ret;
 }
 
 /* load physical DAI elements */
@@ -2466,7 +2524,7 @@ static int soc_tplg_dai_elems_load(struct soc_tplg *tplg,
 {
        struct snd_soc_tplg_dai *dai;
        int count;
-       int i;
+       int i, ret;
 
        count = le32_to_cpu(hdr->count);
 
@@ -2481,7 +2539,12 @@ static int soc_tplg_dai_elems_load(struct soc_tplg *tplg,
                        return -EINVAL;
                }
 
-               soc_tplg_dai_config(tplg, dai);
+               ret = soc_tplg_dai_config(tplg, dai);
+               if (ret < 0) {
+                       dev_err(tplg->dev, "ASoC: failed to configure DAI\n");
+                       return ret;
+               }
+
                tplg->pos += (sizeof(*dai) + le32_to_cpu(dai->priv.size));
        }
 
@@ -2589,7 +2652,7 @@ static int soc_valid_header(struct soc_tplg *tplg,
        }
 
        /* big endian firmware objects not supported atm */
-       if (hdr->magic == SOC_TPLG_MAGIC_BIG_ENDIAN) {
+       if (le32_to_cpu(hdr->magic) == SOC_TPLG_MAGIC_BIG_ENDIAN) {
                dev_err(tplg->dev,
                        "ASoC: pass %d big endian not supported header got %x at offset 0x%lx size 0x%zx.\n",
                        tplg->pass, hdr->magic,
index 6c23c57..a32a3ef 100644 (file)
@@ -567,9 +567,25 @@ static void bdw_set_mach_params(const struct snd_soc_acpi_mach *mach,
 static struct snd_soc_dai_driver bdw_dai[] = {
 {
        .name = "ssp0-port",
+       .playback = {
+               .channels_min = 1,
+               .channels_max = 8,
+       },
+       .capture = {
+               .channels_min = 1,
+               .channels_max = 8,
+       },
 },
 {
        .name = "ssp1-port",
+       .playback = {
+               .channels_min = 1,
+               .channels_max = 8,
+       },
+       .capture = {
+               .channels_min = 1,
+               .channels_max = 8,
+       },
 },
 };
 
index f843912..29fd1d8 100644 (file)
@@ -459,21 +459,69 @@ static void byt_set_mach_params(const struct snd_soc_acpi_mach *mach,
 static struct snd_soc_dai_driver byt_dai[] = {
 {
        .name = "ssp0-port",
+       .playback = {
+               .channels_min = 1,
+               .channels_max = 8,
+       },
+       .capture = {
+               .channels_min = 1,
+               .channels_max = 8,
+       },
 },
 {
        .name = "ssp1-port",
+       .playback = {
+               .channels_min = 1,
+               .channels_max = 8,
+       },
+       .capture = {
+               .channels_min = 1,
+               .channels_max = 8,
+       },
 },
 {
        .name = "ssp2-port",
+       .playback = {
+               .channels_min = 1,
+               .channels_max = 8,
+       },
+       .capture = {
+               .channels_min = 1,
+               .channels_max = 8,
+       }
 },
 {
        .name = "ssp3-port",
+       .playback = {
+               .channels_min = 1,
+               .channels_max = 8,
+       },
+       .capture = {
+               .channels_min = 1,
+               .channels_max = 8,
+       },
 },
 {
        .name = "ssp4-port",
+       .playback = {
+               .channels_min = 1,
+               .channels_max = 8,
+       },
+       .capture = {
+               .channels_min = 1,
+               .channels_max = 8,
+       },
 },
 {
        .name = "ssp5-port",
+       .playback = {
+               .channels_min = 1,
+               .channels_max = 8,
+       },
+       .capture = {
+               .channels_min = 1,
+               .channels_max = 8,
+       },
 },
 };
 
index 0d0c9af..41f01c3 100644 (file)
@@ -837,7 +837,7 @@ static int stm32_sai_set_config(struct snd_soc_dai *cpu_dai,
                cr1 = SAI_XCR1_DS_SET(SAI_DATASIZE_32);
                break;
        default:
-               dev_err(cpu_dai->dev, "Data format not supported");
+               dev_err(cpu_dai->dev, "Data format not supported\n");
                return -EINVAL;
        }
 
@@ -1547,6 +1547,9 @@ static int stm32_sai_sub_probe(struct platform_device *pdev)
                return ret;
        }
 
+       if (STM_SAI_PROTOCOL_IS_SPDIF(sai))
+               conf = &stm32_sai_pcm_config_spdif;
+
        ret = snd_dmaengine_pcm_register(&pdev->dev, conf, 0);
        if (ret) {
                if (ret != -EPROBE_DEFER)
@@ -1556,15 +1559,10 @@ static int stm32_sai_sub_probe(struct platform_device *pdev)
 
        ret = snd_soc_register_component(&pdev->dev, &stm32_component,
                                         &sai->cpu_dai_drv, 1);
-       if (ret) {
+       if (ret)
                snd_dmaengine_pcm_unregister(&pdev->dev);
-               return ret;
-       }
-
-       if (STM_SAI_PROTOCOL_IS_SPDIF(sai))
-               conf = &stm32_sai_pcm_config_spdif;
 
-       return 0;
+       return ret;
 }
 
 static int stm32_sai_sub_remove(struct platform_device *pdev)
index 50e1874..5ffb457 100644 (file)
@@ -277,6 +277,52 @@ static bool s1810c_valid_sample_rate(struct audioformat *fp,
        return false;
 }
 
+/*
+ * Many Focusrite devices supports a limited set of sampling rates per
+ * altsetting. Maximum rate is exposed in the last 4 bytes of Format Type
+ * descriptor which has a non-standard bLength = 10.
+ */
+static bool focusrite_valid_sample_rate(struct snd_usb_audio *chip,
+                                       struct audioformat *fp,
+                                       unsigned int rate)
+{
+       struct usb_interface *iface;
+       struct usb_host_interface *alts;
+       unsigned char *fmt;
+       unsigned int max_rate;
+
+       iface = usb_ifnum_to_if(chip->dev, fp->iface);
+       if (!iface)
+               return true;
+
+       alts = &iface->altsetting[fp->altset_idx];
+       fmt = snd_usb_find_csint_desc(alts->extra, alts->extralen,
+                                     NULL, UAC_FORMAT_TYPE);
+       if (!fmt)
+               return true;
+
+       if (fmt[0] == 10) { /* bLength */
+               max_rate = combine_quad(&fmt[6]);
+
+               /* Validate max rate */
+               if (max_rate != 48000 &&
+                   max_rate != 96000 &&
+                   max_rate != 192000 &&
+                   max_rate != 384000) {
+
+                       usb_audio_info(chip,
+                               "%u:%d : unexpected max rate: %u\n",
+                               fp->iface, fp->altsetting, max_rate);
+
+                       return true;
+               }
+
+               return rate <= max_rate;
+       }
+
+       return true;
+}
+
 /*
  * Helper function to walk the array of sample rate triplets reported by
  * the device. The problem is that we need to parse whole array first to
@@ -319,6 +365,11 @@ static int parse_uac2_sample_rate_range(struct snd_usb_audio *chip,
                            !s1810c_valid_sample_rate(fp, rate))
                                goto skip_rate;
 
+                       /* Filter out invalid rates on Focusrite devices */
+                       if (USB_ID_VENDOR(chip->usb_id) == 0x1235 &&
+                           !focusrite_valid_sample_rate(chip, fp, rate))
+                               goto skip_rate;
+
                        if (fp->rate_table)
                                fp->rate_table[nr_rates] = rate;
                        if (!fp->rate_min || rate < fp->rate_min)
index 721d121..a88d785 100644 (file)
@@ -1457,7 +1457,7 @@ error:
                usb_audio_err(chip,
                        "cannot get connectors status: req = %#x, wValue = %#x, wIndex = %#x, type = %d\n",
                        UAC_GET_CUR, validx, idx, cval->val_type);
-               return ret;
+               return filter_error(cval, ret);
        }
 
        ucontrol->value.integer.value[0] = val;
@@ -1771,10 +1771,16 @@ static void get_connector_control_name(struct usb_mixer_interface *mixer,
 
 /* Build a mixer control for a UAC connector control (jack-detect) */
 static void build_connector_control(struct usb_mixer_interface *mixer,
+                                   const struct usbmix_name_map *imap,
                                    struct usb_audio_term *term, bool is_input)
 {
        struct snd_kcontrol *kctl;
        struct usb_mixer_elem_info *cval;
+       const struct usbmix_name_map *map;
+
+       map = find_map(imap, term->id, 0);
+       if (check_ignored_ctl(map))
+               return;
 
        cval = kzalloc(sizeof(*cval), GFP_KERNEL);
        if (!cval)
@@ -1805,8 +1811,12 @@ static void build_connector_control(struct usb_mixer_interface *mixer,
                usb_mixer_elem_info_free(cval);
                return;
        }
-       get_connector_control_name(mixer, term, is_input, kctl->id.name,
-                                  sizeof(kctl->id.name));
+
+       if (check_mapped_name(map, kctl->id.name, sizeof(kctl->id.name)))
+               strlcat(kctl->id.name, " Jack", sizeof(kctl->id.name));
+       else
+               get_connector_control_name(mixer, term, is_input, kctl->id.name,
+                                          sizeof(kctl->id.name));
        kctl->private_free = snd_usb_mixer_elem_free;
        snd_usb_mixer_add_control(&cval->head, kctl);
 }
@@ -2109,8 +2119,9 @@ static int parse_audio_input_terminal(struct mixer_build *state, int unitid,
        check_input_term(state, term_id, &iterm);
 
        /* Check for jack detection. */
-       if (uac_v2v3_control_is_readable(bmctls, control))
-               build_connector_control(state->mixer, &iterm, true);
+       if ((iterm.type & 0xff00) != 0x0100 &&
+           uac_v2v3_control_is_readable(bmctls, control))
+               build_connector_control(state->mixer, state->map, &iterm, true);
 
        return 0;
 }
@@ -3071,13 +3082,13 @@ static int snd_usb_mixer_controls_badd(struct usb_mixer_interface *mixer,
                memset(&iterm, 0, sizeof(iterm));
                iterm.id = UAC3_BADD_IT_ID4;
                iterm.type = UAC_BIDIR_TERMINAL_HEADSET;
-               build_connector_control(mixer, &iterm, true);
+               build_connector_control(mixer, map->map, &iterm, true);
 
                /* Output Term - Insertion control */
                memset(&oterm, 0, sizeof(oterm));
                oterm.id = UAC3_BADD_OT_ID3;
                oterm.type = UAC_BIDIR_TERMINAL_HEADSET;
-               build_connector_control(mixer, &oterm, false);
+               build_connector_control(mixer, map->map, &oterm, false);
        }
 
        return 0;
@@ -3106,7 +3117,8 @@ static int snd_usb_mixer_controls(struct usb_mixer_interface *mixer)
                if (map->id == state.chip->usb_id) {
                        state.map = map->map;
                        state.selector_map = map->selector_map;
-                       mixer->ignore_ctl_error = map->ignore_ctl_error;
+                       mixer->connector_map = map->connector_map;
+                       mixer->ignore_ctl_error |= map->ignore_ctl_error;
                        break;
                }
        }
@@ -3149,10 +3161,11 @@ static int snd_usb_mixer_controls(struct usb_mixer_interface *mixer)
                        if (err < 0 && err != -EINVAL)
                                return err;
 
-                       if (uac_v2v3_control_is_readable(le16_to_cpu(desc->bmControls),
+                       if ((state.oterm.type & 0xff00) != 0x0100 &&
+                           uac_v2v3_control_is_readable(le16_to_cpu(desc->bmControls),
                                                         UAC2_TE_CONNECTOR)) {
-                               build_connector_control(state.mixer, &state.oterm,
-                                                       false);
+                               build_connector_control(state.mixer, state.map,
+                                                       &state.oterm, false);
                        }
                } else {  /* UAC_VERSION_3 */
                        struct uac3_output_terminal_descriptor *desc = p;
@@ -3174,10 +3187,11 @@ static int snd_usb_mixer_controls(struct usb_mixer_interface *mixer)
                        if (err < 0 && err != -EINVAL)
                                return err;
 
-                       if (uac_v2v3_control_is_readable(le32_to_cpu(desc->bmControls),
+                       if ((state.oterm.type & 0xff00) != 0x0100 &&
+                           uac_v2v3_control_is_readable(le32_to_cpu(desc->bmControls),
                                                         UAC3_TE_INSERTION)) {
-                               build_connector_control(state.mixer, &state.oterm,
-                                                       false);
+                               build_connector_control(state.mixer, state.map,
+                                                       &state.oterm, false);
                        }
                }
        }
@@ -3185,10 +3199,32 @@ static int snd_usb_mixer_controls(struct usb_mixer_interface *mixer)
        return 0;
 }
 
+static int delegate_notify(struct usb_mixer_interface *mixer, int unitid,
+                          u8 *control, u8 *channel)
+{
+       const struct usbmix_connector_map *map = mixer->connector_map;
+
+       if (!map)
+               return unitid;
+
+       for (; map->id; map++) {
+               if (map->id == unitid) {
+                       if (control && map->control)
+                               *control = map->control;
+                       if (channel && map->channel)
+                               *channel = map->channel;
+                       return map->delegated_id;
+               }
+       }
+       return unitid;
+}
+
 void snd_usb_mixer_notify_id(struct usb_mixer_interface *mixer, int unitid)
 {
        struct usb_mixer_elem_list *list;
 
+       unitid = delegate_notify(mixer, unitid, NULL, NULL);
+
        for_each_mixer_elem(list, mixer, unitid) {
                struct usb_mixer_elem_info *info =
                        mixer_elem_list_to_info(list);
@@ -3258,6 +3294,8 @@ static void snd_usb_mixer_interrupt_v2(struct usb_mixer_interface *mixer,
                return;
        }
 
+       unitid = delegate_notify(mixer, unitid, &control, &channel);
+
        for_each_mixer_elem(list, mixer, unitid)
                count++;
 
index 65d6d08..41ec9dc 100644 (file)
@@ -6,6 +6,13 @@
 
 struct media_mixer_ctl;
 
+struct usbmix_connector_map {
+       u8 id;
+       u8 delegated_id;
+       u8 control;
+       u8 channel;
+};
+
 struct usb_mixer_interface {
        struct snd_usb_audio *chip;
        struct usb_host_interface *hostif;
@@ -18,6 +25,9 @@ struct usb_mixer_interface {
        /* the usb audio specification version this interface complies to */
        int protocol;
 
+       /* optional connector delegation map */
+       const struct usbmix_connector_map *connector_map;
+
        /* Sound Blaster remote control stuff */
        const struct rc_config *rc_cfg;
        u32 rc_code;
index 72b575c..0260c75 100644 (file)
@@ -27,6 +27,7 @@ struct usbmix_ctl_map {
        u32 id;
        const struct usbmix_name_map *map;
        const struct usbmix_selector_map *selector_map;
+       const struct usbmix_connector_map *connector_map;
        int ignore_ctl_error;
 };
 
@@ -360,13 +361,42 @@ static const struct usbmix_name_map corsair_virtuoso_map[] = {
 };
 
 /* Some mobos shipped with a dummy HD-audio show the invalid GET_MIN/GET_MAX
- * response for Input Gain Pad (id=19, control=12).  Skip it.
+ * response for Input Gain Pad (id=19, control=12) and the connector status
+ * for SPDIF terminal (id=18).  Skip them.
  */
 static const struct usbmix_name_map asus_rog_map[] = {
+       { 18, NULL }, /* OT, connector control */
        { 19, NULL, 12 }, /* FU, Input Gain Pad */
        {}
 };
 
+/* TRX40 mobos with Realtek ALC1220-VB */
+static const struct usbmix_name_map trx40_mobo_map[] = {
+       { 18, NULL }, /* OT, IEC958 - broken response, disabled */
+       { 19, NULL, 12 }, /* FU, Input Gain Pad - broken response, disabled */
+       { 16, "Speaker" },              /* OT */
+       { 22, "Speaker Playback" },     /* FU */
+       { 7, "Line" },                  /* IT */
+       { 19, "Line Capture" },         /* FU */
+       { 17, "Front Headphone" },      /* OT */
+       { 23, "Front Headphone Playback" },     /* FU */
+       { 8, "Mic" },                   /* IT */
+       { 20, "Mic Capture" },          /* FU */
+       { 9, "Front Mic" },             /* IT */
+       { 21, "Front Mic Capture" },    /* FU */
+       { 24, "IEC958 Playback" },      /* FU */
+       {}
+};
+
+static const struct usbmix_connector_map trx40_mobo_connector_map[] = {
+       { 10, 16 },     /* (Back) Speaker */
+       { 11, 17 },     /* Front Headphone */
+       { 13, 7 },      /* Line */
+       { 14, 8 },      /* Mic */
+       { 15, 9 },      /* Front Mic */
+       {}
+};
+
 /*
  * Control map entries
  */
@@ -498,7 +528,8 @@ static const struct usbmix_ctl_map usbmix_ctl_maps[] = {
        },
        {       /* Gigabyte TRX40 Aorus Pro WiFi */
                .id = USB_ID(0x0414, 0xa002),
-               .map = asus_rog_map,
+               .map = trx40_mobo_map,
+               .connector_map = trx40_mobo_connector_map,
        },
        {       /* ASUS ROG Zenith II */
                .id = USB_ID(0x0b05, 0x1916),
@@ -510,11 +541,13 @@ static const struct usbmix_ctl_map usbmix_ctl_maps[] = {
        },
        {       /* MSI TRX40 Creator */
                .id = USB_ID(0x0db0, 0x0d64),
-               .map = asus_rog_map,
+               .map = trx40_mobo_map,
+               .connector_map = trx40_mobo_connector_map,
        },
        {       /* MSI TRX40 */
                .id = USB_ID(0x0db0, 0x543d),
-               .map = asus_rog_map,
+               .map = trx40_mobo_map,
+               .connector_map = trx40_mobo_connector_map,
        },
        { 0 } /* terminator */
 };
index 02b036b..a5f65a9 100644 (file)
@@ -1509,11 +1509,15 @@ static int snd_microii_spdif_default_get(struct snd_kcontrol *kcontrol,
 
        /* use known values for that card: interface#1 altsetting#1 */
        iface = usb_ifnum_to_if(chip->dev, 1);
-       if (!iface || iface->num_altsetting < 2)
-               return -EINVAL;
+       if (!iface || iface->num_altsetting < 2) {
+               err = -EINVAL;
+               goto end;
+       }
        alts = &iface->altsetting[1];
-       if (get_iface_desc(alts)->bNumEndpoints < 1)
-               return -EINVAL;
+       if (get_iface_desc(alts)->bNumEndpoints < 1) {
+               err = -EINVAL;
+               goto end;
+       }
        ep = get_endpoint(alts, 0)->bEndpointAddress;
 
        err = snd_usb_ctl_msg(chip->dev,
index e009d58..a1df4c5 100644 (file)
@@ -2756,90 +2756,6 @@ YAMAHA_DEVICE(0x7010, "UB99"),
                .type = QUIRK_MIDI_NOVATION
        }
 },
-{
-       /*
-        * Focusrite Scarlett Solo 2nd generation
-        * Reports that playback should use Synch: Synchronous
-        * while still providing a feedback endpoint. Synchronous causes
-        * snapping on some sample rates.
-        * Force it to use Synch: Asynchronous.
-        */
-       USB_DEVICE(0x1235, 0x8205),
-       .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
-               .ifnum = QUIRK_ANY_INTERFACE,
-               .type = QUIRK_COMPOSITE,
-               .data = (const struct snd_usb_audio_quirk[]) {
-                       {
-                               .ifnum = 1,
-                               .type = QUIRK_AUDIO_FIXED_ENDPOINT,
-                               .data = & (const struct audioformat) {
-                                       .formats = SNDRV_PCM_FMTBIT_S32_LE,
-                                       .channels = 2,
-                                       .iface = 1,
-                                       .altsetting = 1,
-                                       .altset_idx = 1,
-                                       .attributes = 0,
-                                       .endpoint = 0x01,
-                                       .ep_attr = USB_ENDPOINT_XFER_ISOC |
-                                                  USB_ENDPOINT_SYNC_ASYNC,
-                                       .protocol = UAC_VERSION_2,
-                                       .rates = SNDRV_PCM_RATE_44100 |
-                                                SNDRV_PCM_RATE_48000 |
-                                                SNDRV_PCM_RATE_88200 |
-                                                SNDRV_PCM_RATE_96000 |
-                                                SNDRV_PCM_RATE_176400 |
-                                                SNDRV_PCM_RATE_192000,
-                                       .rate_min = 44100,
-                                       .rate_max = 192000,
-                                       .nr_rates = 6,
-                                       .rate_table = (unsigned int[]) {
-                                               44100, 48000, 88200,
-                                               96000, 176400, 192000
-                                       },
-                                       .clock = 41
-                               }
-                       },
-                       {
-                               .ifnum = 2,
-                               .type = QUIRK_AUDIO_FIXED_ENDPOINT,
-                               .data = & (const struct audioformat) {
-                                       .formats = SNDRV_PCM_FMTBIT_S32_LE,
-                                       .channels = 2,
-                                       .iface = 2,
-                                       .altsetting = 1,
-                                       .altset_idx = 1,
-                                       .attributes = 0,
-                                       .endpoint = 0x82,
-                                       .ep_attr = USB_ENDPOINT_XFER_ISOC |
-                                                  USB_ENDPOINT_SYNC_ASYNC |
-                                                  USB_ENDPOINT_USAGE_IMPLICIT_FB,
-                                       .protocol = UAC_VERSION_2,
-                                       .rates = SNDRV_PCM_RATE_44100 |
-                                                SNDRV_PCM_RATE_48000 |
-                                                SNDRV_PCM_RATE_88200 |
-                                                SNDRV_PCM_RATE_96000 |
-                                                SNDRV_PCM_RATE_176400 |
-                                                SNDRV_PCM_RATE_192000,
-                                       .rate_min = 44100,
-                                       .rate_max = 192000,
-                                       .nr_rates = 6,
-                                       .rate_table = (unsigned int[]) {
-                                               44100, 48000, 88200,
-                                               96000, 176400, 192000
-                                       },
-                                       .clock = 41
-                               }
-                       },
-                       {
-                               .ifnum = 3,
-                               .type = QUIRK_IGNORE_INTERFACE
-                       },
-                       {
-                               .ifnum = -1
-                       }
-               }
-       }
-},
 
 /* Access Music devices */
 {
@@ -3635,4 +3551,18 @@ AU0828_DEVICE(0x2040, 0x7270, "Hauppauge", "HVR-950Q"),
        }
 },
 
+#define ALC1220_VB_DESKTOP(vend, prod) { \
+       USB_DEVICE(vend, prod), \
+       .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { \
+               .vendor_name = "Realtek", \
+               .product_name = "ALC1220-VB-DT", \
+               .profile_name = "Realtek-ALC1220-VB-Desktop", \
+               .ifnum = QUIRK_NO_INTERFACE \
+       } \
+}
+ALC1220_VB_DESKTOP(0x0414, 0xa002), /* Gigabyte TRX40 Aorus Pro WiFi */
+ALC1220_VB_DESKTOP(0x0db0, 0x0d64), /* MSI TRX40 Creator */
+ALC1220_VB_DESKTOP(0x0db0, 0x543d), /* MSI TRX40 */
+#undef ALC1220_VB_DESKTOP
+
 #undef USB_DEVICE_VENDOR_SPEC
index a8ece17..351ba21 100644 (file)
@@ -1806,6 +1806,20 @@ void snd_usb_audioformat_attributes_quirk(struct snd_usb_audio *chip,
                 */
                fp->attributes &= ~UAC_EP_CS_ATTR_FILL_MAX;
                break;
+       case USB_ID(0x1235, 0x8200):  /* Focusrite Scarlett 2i4 2nd gen */
+       case USB_ID(0x1235, 0x8202):  /* Focusrite Scarlett 2i2 2nd gen */
+       case USB_ID(0x1235, 0x8205):  /* Focusrite Scarlett Solo 2nd gen */
+               /*
+                * Reports that playback should use Synch: Synchronous
+                * while still providing a feedback endpoint.
+                * Synchronous causes snapping on some sample rates.
+                * Force it to use Synch: Asynchronous.
+                */
+               if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
+                       fp->ep_attr &= ~USB_ENDPOINT_SYNCTYPE;
+                       fp->ep_attr |= USB_ENDPOINT_SYNC_ASYNC;
+               }
+               break;
        }
 }
 
index 37d290f..ecaf412 100644 (file)
@@ -681,6 +681,8 @@ static int usX2Y_rate_set(struct usX2Ydev *usX2Y, int rate)
                        us->submitted = 2*NOOF_SETRATE_URBS;
                        for (i = 0; i < NOOF_SETRATE_URBS; ++i) {
                                struct urb *urb = us->urb[i];
+                               if (!urb)
+                                       continue;
                                if (urb->status) {
                                        if (!err)
                                                err = -ENODEV;
index f3327cb..db18994 100644 (file)
 #define X86_FEATURE_IBRS               ( 7*32+25) /* Indirect Branch Restricted Speculation */
 #define X86_FEATURE_IBPB               ( 7*32+26) /* Indirect Branch Prediction Barrier */
 #define X86_FEATURE_STIBP              ( 7*32+27) /* Single Thread Indirect Branch Predictors */
-#define X86_FEATURE_ZEN                        ( 7*32+28) /* "" CPU is AMD family 0x17 (Zen) */
+#define X86_FEATURE_ZEN                        ( 7*32+28) /* "" CPU is AMD family 0x17 or above (Zen) */
 #define X86_FEATURE_L1TF_PTEINV                ( 7*32+29) /* "" L1TF workaround PTE inversion */
 #define X86_FEATURE_IBRS_ENHANCED      ( 7*32+30) /* Enhanced IBRS */
 #define X86_FEATURE_MSR_IA32_FEAT_CTL  ( 7*32+31) /* "" MSR IA32_FEAT_CTL configured */
 #define X86_FEATURE_CQM_MBM_LOCAL      (11*32+ 3) /* LLC Local MBM monitoring */
 #define X86_FEATURE_FENCE_SWAPGS_USER  (11*32+ 4) /* "" LFENCE in user entry SWAPGS path */
 #define X86_FEATURE_FENCE_SWAPGS_KERNEL        (11*32+ 5) /* "" LFENCE in kernel entry SWAPGS path */
+#define X86_FEATURE_SPLIT_LOCK_DETECT  (11*32+ 6) /* #AC for split lock */
 
 /* Intel-defined CPU features, CPUID level 0x00000007:1 (EAX), word 12 */
 #define X86_FEATURE_AVX512_BF16                (12*32+ 5) /* AVX512 BFLOAT16 instructions */
 #define X86_FEATURE_AMD_IBRS           (13*32+14) /* "" Indirect Branch Restricted Speculation */
 #define X86_FEATURE_AMD_STIBP          (13*32+15) /* "" Single Thread Indirect Branch Predictors */
 #define X86_FEATURE_AMD_STIBP_ALWAYS_ON        (13*32+17) /* "" Single Thread Indirect Branch Predictors always-on preferred */
+#define X86_FEATURE_AMD_PPIN           (13*32+23) /* Protected Processor Inventory Number */
 #define X86_FEATURE_AMD_SSBD           (13*32+24) /* "" Speculative Store Bypass Disable */
 #define X86_FEATURE_VIRT_SSBD          (13*32+25) /* Virtualized Speculative Store Bypass Disable */
 #define X86_FEATURE_AMD_SSB_NO         (13*32+26) /* "" Speculative Store Bypass is fixed in hardware. */
 #define X86_FEATURE_INTEL_STIBP                (18*32+27) /* "" Single Thread Indirect Branch Predictors */
 #define X86_FEATURE_FLUSH_L1D          (18*32+28) /* Flush L1D cache */
 #define X86_FEATURE_ARCH_CAPABILITIES  (18*32+29) /* IA32_ARCH_CAPABILITIES MSR (Intel) */
+#define X86_FEATURE_CORE_CAPABILITIES  (18*32+30) /* "" IA32_CORE_CAPABILITIES MSR */
 #define X86_FEATURE_SPEC_CTRL_SSBD     (18*32+31) /* "" Speculative Store Bypass Disable */
 
 /*
index d5e517d..12c9684 100644 (file)
 
 /* Intel MSRs. Some also available on other CPUs */
 
+#define MSR_TEST_CTRL                          0x00000033
+#define MSR_TEST_CTRL_SPLIT_LOCK_DETECT_BIT    29
+#define MSR_TEST_CTRL_SPLIT_LOCK_DETECT                BIT(MSR_TEST_CTRL_SPLIT_LOCK_DETECT_BIT)
+
 #define MSR_IA32_SPEC_CTRL             0x00000048 /* Speculation Control */
 #define SPEC_CTRL_IBRS                 BIT(0)     /* Indirect Branch Restricted Speculation */
 #define SPEC_CTRL_STIBP_SHIFT          1          /* Single Thread Indirect Branch Predictor (STIBP) bit */
  */
 #define MSR_IA32_UMWAIT_CONTROL_TIME_MASK      (~0x03U)
 
+/* Abbreviated from Intel SDM name IA32_CORE_CAPABILITIES */
+#define MSR_IA32_CORE_CAPS                       0x000000cf
+#define MSR_IA32_CORE_CAPS_SPLIT_LOCK_DETECT_BIT  5
+#define MSR_IA32_CORE_CAPS_SPLIT_LOCK_DETECT     BIT(MSR_IA32_CORE_CAPS_SPLIT_LOCK_DETECT_BIT)
+
 #define MSR_PKG_CST_CONFIG_CONTROL     0x000000e2
 #define NHM_C3_AUTO_DEMOTE             (1UL << 25)
 #define NHM_C1_AUTO_DEMOTE             (1UL << 26)
index 1e38d19..3bc6b07 100644 (file)
@@ -7,7 +7,7 @@ int main(int argc, char *argv[])
 {
        uint64_t old, new = argc;
 
-       argv = argv;
+       (void)argv;
        do {
                old = __sync_val_compare_and_swap(&x, 0, 0);
        } while (!__sync_bool_compare_and_swap(&x, old, new));
index 669d694..4671fbf 100644 (file)
@@ -3,9 +3,9 @@
 #define __LINUX_BITS_H
 
 #include <linux/const.h>
+#include <vdso/bits.h>
 #include <asm/bitsperlong.h>
 
-#define BIT(nr)                        (UL(1) << (nr))
 #define BIT_ULL(nr)            (ULL(1) << (nr))
 #define BIT_MASK(nr)           (UL(1) << ((nr) % BITS_PER_LONG))
 #define BIT_WORD(nr)           ((nr) / BITS_PER_LONG)
  * position @h. For example
  * GENMASK_ULL(39, 21) gives us the 64bit vector 0x000000ffffe00000.
  */
-#define GENMASK(h, l) \
+#if !defined(__ASSEMBLY__) && \
+       (!defined(CONFIG_CC_IS_GCC) || CONFIG_GCC_VERSION >= 49000)
+#include <linux/build_bug.h>
+#define GENMASK_INPUT_CHECK(h, l) \
+       (BUILD_BUG_ON_ZERO(__builtin_choose_expr( \
+               __builtin_constant_p((l) > (h)), (l) > (h), 0)))
+#else
+/*
+ * BUILD_BUG_ON_ZERO is not available in h files included from asm files,
+ * disable the input check if that is the case.
+ */
+#define GENMASK_INPUT_CHECK(h, l) 0
+#endif
+
+#define __GENMASK(h, l) \
        (((~UL(0)) - (UL(1) << (l)) + 1) & \
         (~UL(0) >> (BITS_PER_LONG - 1 - (h))))
+#define GENMASK(h, l) \
+       (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
 
-#define GENMASK_ULL(h, l) \
+#define __GENMASK_ULL(h, l) \
        (((~ULL(0)) - (ULL(1) << (l)) + 1) & \
         (~ULL(0) >> (BITS_PER_LONG_LONG - 1 - (h))))
+#define GENMASK_ULL(h, l) \
+       (GENMASK_INPUT_CHECK(h, l) + __GENMASK_ULL(h, l))
 
 #endif /* __LINUX_BITS_H */
diff --git a/tools/include/linux/build_bug.h b/tools/include/linux/build_bug.h
new file mode 100644 (file)
index 0000000..cc7070c
--- /dev/null
@@ -0,0 +1,82 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _LINUX_BUILD_BUG_H
+#define _LINUX_BUILD_BUG_H
+
+#include <linux/compiler.h>
+
+#ifdef __CHECKER__
+#define BUILD_BUG_ON_ZERO(e) (0)
+#else /* __CHECKER__ */
+/*
+ * Force a compilation error if condition is true, but also produce a
+ * result (of value 0 and type int), so the expression can be used
+ * e.g. in a structure initializer (or where-ever else comma expressions
+ * aren't permitted).
+ */
+#define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
+#endif /* __CHECKER__ */
+
+/* Force a compilation error if a constant expression is not a power of 2 */
+#define __BUILD_BUG_ON_NOT_POWER_OF_2(n)       \
+       BUILD_BUG_ON(((n) & ((n) - 1)) != 0)
+#define BUILD_BUG_ON_NOT_POWER_OF_2(n)                 \
+       BUILD_BUG_ON((n) == 0 || (((n) & ((n) - 1)) != 0))
+
+/*
+ * BUILD_BUG_ON_INVALID() permits the compiler to check the validity of the
+ * expression but avoids the generation of any code, even if that expression
+ * has side-effects.
+ */
+#define BUILD_BUG_ON_INVALID(e) ((void)(sizeof((__force long)(e))))
+
+/**
+ * BUILD_BUG_ON_MSG - break compile if a condition is true & emit supplied
+ *                   error message.
+ * @condition: the condition which the compiler should know is false.
+ *
+ * See BUILD_BUG_ON for description.
+ */
+#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
+
+/**
+ * BUILD_BUG_ON - break compile if a condition is true.
+ * @condition: the condition which the compiler should know is false.
+ *
+ * If you have some code which relies on certain constants being equal, or
+ * some other compile-time-evaluated condition, you should use BUILD_BUG_ON to
+ * detect if someone changes it.
+ */
+#define BUILD_BUG_ON(condition) \
+       BUILD_BUG_ON_MSG(condition, "BUILD_BUG_ON failed: " #condition)
+
+/**
+ * BUILD_BUG - break compile if used.
+ *
+ * If you have some code that you expect the compiler to eliminate at
+ * build time, you should use BUILD_BUG to detect if it is
+ * unexpectedly used.
+ */
+#define BUILD_BUG() BUILD_BUG_ON_MSG(1, "BUILD_BUG failed")
+
+/**
+ * static_assert - check integer constant expression at build time
+ *
+ * static_assert() is a wrapper for the C11 _Static_assert, with a
+ * little macro magic to make the message optional (defaulting to the
+ * stringification of the tested expression).
+ *
+ * Contrary to BUILD_BUG_ON(), static_assert() can be used at global
+ * scope, but requires the expression to be an integer constant
+ * expression (i.e., it is not enough that __builtin_constant_p() is
+ * true for expr).
+ *
+ * Also note that BUILD_BUG_ON() fails the build if the condition is
+ * true, while static_assert() fails the build if the expression is
+ * false.
+ */
+#ifndef static_assert
+#define static_assert(expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr)
+#define __static_assert(expr, msg, ...) _Static_assert(expr, msg)
+#endif // static_assert
+
+#endif /* _LINUX_BUILD_BUG_H */
index 1827c2f..180f771 100644 (file)
 # define __compiletime_error(message)
 #endif
 
+#ifdef __OPTIMIZE__
+# define __compiletime_assert(condition, msg, prefix, suffix)          \
+       do {                                                            \
+               extern void prefix ## suffix(void) __compiletime_error(msg); \
+               if (!(condition))                                       \
+                       prefix ## suffix();                             \
+       } while (0)
+#else
+# define __compiletime_assert(condition, msg, prefix, suffix) do { } while (0)
+#endif
+
+#define _compiletime_assert(condition, msg, prefix, suffix) \
+       __compiletime_assert(condition, msg, prefix, suffix)
+
+/**
+ * compiletime_assert - break build and emit msg if condition is false
+ * @condition: a compile-time constant condition to check
+ * @msg:       a message to emit if condition is false
+ *
+ * In tradition of POSIX assert, this macro will break the build if the
+ * supplied condition is *false*, emitting the supplied error message if the
+ * compiler has support to do so.
+ */
+#define compiletime_assert(condition, msg) \
+       _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
+
 /* Optimization barrier */
 /* The "volatile" is due to gcc bugs */
 #define barrier() __asm__ __volatile__("": : :"memory")
index 7b55a55..81b8aae 100644 (file)
@@ -1,9 +1,6 @@
 #ifndef _LINUX_CONST_H
 #define _LINUX_CONST_H
 
-#include <uapi/linux/const.h>
-
-#define UL(x)          (_UL(x))
-#define ULL(x)         (_ULL(x))
+#include <vdso/const.h>
 
 #endif /* _LINUX_CONST_H */
index cba2269..a7e54a0 100644 (file)
@@ -5,6 +5,7 @@
 #include <stdarg.h>
 #include <stddef.h>
 #include <assert.h>
+#include <linux/build_bug.h>
 #include <linux/compiler.h>
 #include <endian.h>
 #include <byteswap.h>
@@ -35,9 +36,6 @@
        (type *)((char *)__mptr - offsetof(type, member)); })
 #endif
 
-#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
-#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
-
 #ifndef max
 #define max(x, y) ({                           \
        typeof(x) _max1 = (x);                  \
index 868bf79..808b48a 100644 (file)
@@ -948,6 +948,8 @@ extern "C" {
 #define DRM_IOCTL_SYNCOBJ_TRANSFER     DRM_IOWR(0xCC, struct drm_syncobj_transfer)
 #define DRM_IOCTL_SYNCOBJ_TIMELINE_SIGNAL      DRM_IOWR(0xCD, struct drm_syncobj_timeline_array)
 
+#define DRM_IOCTL_MODE_GETFB2          DRM_IOWR(0xCE, struct drm_mode_fb_cmd2)
+
 /**
  * Device specific ioctls should only be in their respective headers
  * The device specific ioctl range is from 0x40 to 0x9f.
index 829c0a4..2813e57 100644 (file)
@@ -1619,6 +1619,27 @@ struct drm_i915_gem_context_param {
  * By default, new contexts allow persistence.
  */
 #define I915_CONTEXT_PARAM_PERSISTENCE 0xb
+
+/*
+ * I915_CONTEXT_PARAM_RINGSIZE:
+ *
+ * Sets the size of the CS ringbuffer to use for logical ring contexts. This
+ * applies a limit of how many batches can be queued to HW before the caller
+ * is blocked due to lack of space for more commands.
+ *
+ * Only reliably possible to be set prior to first use, i.e. during
+ * construction. At any later point, the current execution must be flushed as
+ * the ring can only be changed while the context is idle. Note, the ringsize
+ * can be specified as a constructor property, see
+ * I915_CONTEXT_CREATE_EXT_SETPARAM, but can also be set later if required.
+ *
+ * Only applies to the current set of engine and lost when those engines
+ * are replaced by a new mapping (see I915_CONTEXT_PARAM_ENGINES).
+ *
+ * Must be between 4 - 512 KiB, in intervals of page size [4 KiB].
+ * Default is 16 KiB.
+ */
+#define I915_CONTEXT_PARAM_RINGSIZE    0xc
 /* Must be kept compact -- no holes and well documented */
 
        __u64 value;
index 0d8a6f4..a10e3cd 100644 (file)
@@ -163,6 +163,7 @@ struct fscrypt_get_key_status_arg {
 #define FS_IOC_REMOVE_ENCRYPTION_KEY           _IOWR('f', 24, struct fscrypt_remove_key_arg)
 #define FS_IOC_REMOVE_ENCRYPTION_KEY_ALL_USERS _IOWR('f', 25, struct fscrypt_remove_key_arg)
 #define FS_IOC_GET_ENCRYPTION_KEY_STATUS       _IOWR('f', 26, struct fscrypt_get_key_status_arg)
+#define FS_IOC_GET_ENCRYPTION_NONCE            _IOR('f', 27, __u8[16])
 
 /**********************************************************************/
 
index 4b95f9a..428c7dd 100644 (file)
@@ -474,12 +474,17 @@ struct kvm_s390_mem_op {
        __u32 size;             /* amount of bytes */
        __u32 op;               /* type of operation */
        __u64 buf;              /* buffer in userspace */
-       __u8 ar;                /* the access register number */
-       __u8 reserved[31];      /* should be set to 0 */
+       union {
+               __u8 ar;        /* the access register number */
+               __u32 sida_offset; /* offset into the sida */
+               __u8 reserved[32]; /* should be set to 0 */
+       };
 };
 /* types for kvm_s390_mem_op->op */
 #define KVM_S390_MEMOP_LOGICAL_READ    0
 #define KVM_S390_MEMOP_LOGICAL_WRITE   1
+#define KVM_S390_MEMOP_SIDA_READ       2
+#define KVM_S390_MEMOP_SIDA_WRITE      3
 /* flags for kvm_s390_mem_op->flags */
 #define KVM_S390_MEMOP_F_CHECK_ONLY            (1ULL << 0)
 #define KVM_S390_MEMOP_F_INJECT_EXCEPTION      (1ULL << 1)
@@ -1010,6 +1015,8 @@ struct kvm_ppc_resize_hpt {
 #define KVM_CAP_ARM_NISV_TO_USER 177
 #define KVM_CAP_ARM_INJECT_EXT_DABT 178
 #define KVM_CAP_S390_VCPU_RESETS 179
+#define KVM_CAP_S390_PROTECTED 180
+#define KVM_CAP_PPC_SECURE_GUEST 181
 
 #ifdef KVM_CAP_IRQ_ROUTING
 
@@ -1478,6 +1485,39 @@ struct kvm_enc_region {
 #define KVM_S390_NORMAL_RESET  _IO(KVMIO,   0xc3)
 #define KVM_S390_CLEAR_RESET   _IO(KVMIO,   0xc4)
 
+struct kvm_s390_pv_sec_parm {
+       __u64 origin;
+       __u64 length;
+};
+
+struct kvm_s390_pv_unp {
+       __u64 addr;
+       __u64 size;
+       __u64 tweak;
+};
+
+enum pv_cmd_id {
+       KVM_PV_ENABLE,
+       KVM_PV_DISABLE,
+       KVM_PV_SET_SEC_PARMS,
+       KVM_PV_UNPACK,
+       KVM_PV_VERIFY,
+       KVM_PV_PREP_RESET,
+       KVM_PV_UNSHARE_ALL,
+};
+
+struct kvm_pv_cmd {
+       __u32 cmd;      /* Command to be executed */
+       __u16 rc;       /* Ultravisor return code */
+       __u16 rrc;      /* Ultravisor return reason code */
+       __u64 data;     /* Data or address */
+       __u32 flags;    /* flags for future extensions. Must be 0 for now */
+       __u32 reserved[3];
+};
+
+/* Available with KVM_CAP_S390_PROTECTED */
+#define KVM_S390_PV_COMMAND            _IOWR(KVMIO, 0xc5, struct kvm_pv_cmd)
+
 /* Secure Encrypted Virtualization command */
 enum sev_cmd_id {
        /* Guest initialization commands */
@@ -1628,4 +1668,7 @@ struct kvm_hyperv_eventfd {
 #define KVM_HYPERV_CONN_ID_MASK                0x00ffffff
 #define KVM_HYPERV_EVENTFD_DEASSIGN    (1 << 0)
 
+#define KVM_DIRTY_LOG_MANUAL_PROTECT_ENABLE    (1 << 0)
+#define KVM_DIRTY_LOG_INITIALLY_SET            (1 << 1)
+
 #endif /* __LINUX_KVM_H */
index fc1a64c..923cc16 100644 (file)
@@ -5,8 +5,9 @@
 #include <asm/mman.h>
 #include <asm-generic/hugetlb_encode.h>
 
-#define MREMAP_MAYMOVE 1
-#define MREMAP_FIXED   2
+#define MREMAP_MAYMOVE         1
+#define MREMAP_FIXED           2
+#define MREMAP_DONTUNMAP       4
 
 #define OVERCOMMIT_GUESS               0
 #define OVERCOMMIT_ALWAYS              1
index 2e3bc22..3bac0a8 100644 (file)
@@ -35,6 +35,7 @@
 
 /* Flags for the clone3() syscall. */
 #define CLONE_CLEAR_SIGHAND 0x100000000ULL /* Clear any signal handler and reset to SIG_DFL. */
+#define CLONE_INTO_CGROUP 0x200000000ULL /* Clone into a specific cgroup given the right permissions. */
 
 /*
  * cloning flags intersect with CSIGNAL so can be used with unshare and clone3
@@ -81,6 +82,8 @@
  * @set_tid_size: This defines the size of the array referenced
  *                in @set_tid. This cannot be larger than the
  *                kernel's limit of nested PID namespaces.
+ * @cgroup:       If CLONE_INTO_CGROUP is specified set this to
+ *                a file descriptor for the cgroup.
  *
  * The structure is versioned by size and thus extensible.
  * New struct members must go at the end of the struct and
@@ -97,11 +100,13 @@ struct clone_args {
        __aligned_u64 tls;
        __aligned_u64 set_tid;
        __aligned_u64 set_tid_size;
+       __aligned_u64 cgroup;
 };
 #endif
 
 #define CLONE_ARGS_SIZE_VER0 64 /* sizeof first published struct */
 #define CLONE_ARGS_SIZE_VER1 80 /* sizeof second published struct */
+#define CLONE_ARGS_SIZE_VER2 88 /* sizeof third published struct */
 
 /*
  * Scheduling policies
index 40d028e..9fe72e4 100644 (file)
 #define VHOST_VSOCK_SET_GUEST_CID      _IOW(VHOST_VIRTIO, 0x60, __u64)
 #define VHOST_VSOCK_SET_RUNNING                _IOW(VHOST_VIRTIO, 0x61, int)
 
+/* VHOST_VDPA specific defines */
+
+/* Get the device id. The device ids follow the same definition of
+ * the device id defined in virtio-spec.
+ */
+#define VHOST_VDPA_GET_DEVICE_ID       _IOR(VHOST_VIRTIO, 0x70, __u32)
+/* Get and set the status. The status bits follow the same definition
+ * of the device status defined in virtio-spec.
+ */
+#define VHOST_VDPA_GET_STATUS          _IOR(VHOST_VIRTIO, 0x71, __u8)
+#define VHOST_VDPA_SET_STATUS          _IOW(VHOST_VIRTIO, 0x72, __u8)
+/* Get and set the device config. The device config follows the same
+ * definition of the device config defined in virtio-spec.
+ */
+#define VHOST_VDPA_GET_CONFIG          _IOR(VHOST_VIRTIO, 0x73, \
+                                            struct vhost_vdpa_config)
+#define VHOST_VDPA_SET_CONFIG          _IOW(VHOST_VIRTIO, 0x74, \
+                                            struct vhost_vdpa_config)
+/* Enable/disable the ring. */
+#define VHOST_VDPA_SET_VRING_ENABLE    _IOW(VHOST_VIRTIO, 0x75, \
+                                            struct vhost_vring_state)
+/* Get the max ring size. */
+#define VHOST_VDPA_GET_VRING_NUM       _IOR(VHOST_VIRTIO, 0x76, __u16)
+
 #endif
diff --git a/tools/include/vdso/bits.h b/tools/include/vdso/bits.h
new file mode 100644 (file)
index 0000000..6d005a1
--- /dev/null
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef __VDSO_BITS_H
+#define __VDSO_BITS_H
+
+#include <vdso/const.h>
+
+#define BIT(nr)                        (UL(1) << (nr))
+
+#endif /* __VDSO_BITS_H */
diff --git a/tools/include/vdso/const.h b/tools/include/vdso/const.h
new file mode 100644 (file)
index 0000000..94b385a
--- /dev/null
@@ -0,0 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef __VDSO_CONST_H
+#define __VDSO_CONST_H
+
+#include <uapi/linux/const.h>
+
+#define UL(x)          (_UL(x))
+#define ULL(x)         (_ULL(x))
+
+#endif /* __VDSO_CONST_H */
index 8dd01f9..4b170fd 100644 (file)
@@ -1050,10 +1050,7 @@ static struct rela *find_jump_table(struct objtool_file *file,
         * it.
         */
        for (;
-            &insn->list != &file->insn_list &&
-            insn->sec == func->sec &&
-            insn->offset >= func->offset;
-
+            &insn->list != &file->insn_list && insn->func && insn->func->pfunc == func;
             insn = insn->first_jump_src ?: list_prev_entry(insn, list)) {
 
                if (insn != orig_insn && insn->type == INSN_JUMP_DYNAMIC)
@@ -2008,8 +2005,8 @@ static int validate_return(struct symbol *func, struct instruction *insn, struct
        }
 
        if (state->bp_scratch) {
-               WARN("%s uses BP as a scratch register",
-                    func->name);
+               WARN_FUNC("BP used as a scratch register",
+                         insn->sec, insn->offset);
                return 1;
        }
 
@@ -2364,14 +2361,27 @@ static bool ignore_unreachable_insn(struct instruction *insn)
            !strcmp(insn->sec->name, ".altinstr_aux"))
                return true;
 
+       if (!insn->func)
+               return false;
+
+       /*
+        * CONFIG_UBSAN_TRAP inserts a UD2 when it sees
+        * __builtin_unreachable().  The BUG() macro has an unreachable() after
+        * the UD2, which causes GCC's undefined trap logic to emit another UD2
+        * (or occasionally a JMP to UD2).
+        */
+       if (list_prev_entry(insn, list)->dead_end &&
+           (insn->type == INSN_BUG ||
+            (insn->type == INSN_JUMP_UNCONDITIONAL &&
+             insn->jump_dest && insn->jump_dest->type == INSN_BUG)))
+               return true;
+
        /*
         * Check if this (or a subsequent) instruction is related to
         * CONFIG_UBSAN or CONFIG_KASAN.
         *
         * End the search at 5 instructions to avoid going into the weeds.
         */
-       if (!insn->func)
-               return false;
        for (i = 0; i < 5; i++) {
 
                if (is_kasan_insn(insn) || is_ubsan_insn(insn))
index 13ccf77..ba4cbb1 100644 (file)
@@ -66,7 +66,7 @@ int orc_dump(const char *_objname)
        char *name;
        size_t nr_sections;
        Elf64_Addr orc_ip_addr = 0;
-       size_t shstrtab_idx;
+       size_t shstrtab_idx, strtab_idx = 0;
        Elf *elf;
        Elf_Scn *scn;
        GElf_Shdr sh;
@@ -127,6 +127,8 @@ int orc_dump(const char *_objname)
 
                if (!strcmp(name, ".symtab")) {
                        symtab = data;
+               } else if (!strcmp(name, ".strtab")) {
+                       strtab_idx = i;
                } else if (!strcmp(name, ".orc_unwind")) {
                        orc = data->d_buf;
                        orc_size = sh.sh_size;
@@ -138,7 +140,7 @@ int orc_dump(const char *_objname)
                }
        }
 
-       if (!symtab || !orc || !orc_ip)
+       if (!symtab || !strtab_idx || !orc || !orc_ip)
                return 0;
 
        if (orc_size % sizeof(*orc) != 0) {
@@ -159,21 +161,29 @@ int orc_dump(const char *_objname)
                                return -1;
                        }
 
-                       scn = elf_getscn(elf, sym.st_shndx);
-                       if (!scn) {
-                               WARN_ELF("elf_getscn");
-                               return -1;
-                       }
-
-                       if (!gelf_getshdr(scn, &sh)) {
-                               WARN_ELF("gelf_getshdr");
-                               return -1;
-                       }
-
-                       name = elf_strptr(elf, shstrtab_idx, sh.sh_name);
-                       if (!name || !*name) {
-                               WARN_ELF("elf_strptr");
-                               return -1;
+                       if (GELF_ST_TYPE(sym.st_info) == STT_SECTION) {
+                               scn = elf_getscn(elf, sym.st_shndx);
+                               if (!scn) {
+                                       WARN_ELF("elf_getscn");
+                                       return -1;
+                               }
+
+                               if (!gelf_getshdr(scn, &sh)) {
+                                       WARN_ELF("gelf_getshdr");
+                                       return -1;
+                               }
+
+                               name = elf_strptr(elf, shstrtab_idx, sh.sh_name);
+                               if (!name) {
+                                       WARN_ELF("elf_strptr");
+                                       return -1;
+                               }
+                       } else {
+                               name = elf_strptr(elf, strtab_idx, sym.st_name);
+                               if (!name) {
+                                       WARN_ELF("elf_strptr");
+                                       return -1;
+                               }
                        }
 
                        printf("%s+%llx:", name, (unsigned long long)rela.r_addend);
index 41e4a27..4c0dabd 100644 (file)
@@ -88,11 +88,6 @@ static int create_orc_entry(struct elf *elf, struct section *u_sec, struct secti
        struct orc_entry *orc;
        struct rela *rela;
 
-       if (!insn_sec->sym) {
-               WARN("missing symbol for section %s", insn_sec->name);
-               return -1;
-       }
-
        /* populate ORC data */
        orc = (struct orc_entry *)u_sec->data->d_buf + idx;
        memcpy(orc, o, sizeof(*orc));
@@ -105,8 +100,32 @@ static int create_orc_entry(struct elf *elf, struct section *u_sec, struct secti
        }
        memset(rela, 0, sizeof(*rela));
 
-       rela->sym = insn_sec->sym;
-       rela->addend = insn_off;
+       if (insn_sec->sym) {
+               rela->sym = insn_sec->sym;
+               rela->addend = insn_off;
+       } else {
+               /*
+                * The Clang assembler doesn't produce section symbols, so we
+                * have to reference the function symbol instead:
+                */
+               rela->sym = find_symbol_containing(insn_sec, insn_off);
+               if (!rela->sym) {
+                       /*
+                        * Hack alert.  This happens when we need to reference
+                        * the NOP pad insn immediately after the function.
+                        */
+                       rela->sym = find_symbol_containing(insn_sec,
+                                                          insn_off - 1);
+               }
+               if (!rela->sym) {
+                       WARN("missing symbol for insn at offset 0x%lx\n",
+                            insn_off);
+                       return -1;
+               }
+
+               rela->addend = insn_off - rela->sym->offset;
+       }
+
        rela->type = R_X86_64_PC32;
        rela->offset = idx * sizeof(int);
        rela->sec = ip_relasec;
index 44d510b..37b844f 100644 (file)
 #
 # The abi is "common", "64" or "x32" for this file.
 #
-0      common  read                    __x64_sys_read
-1      common  write                   __x64_sys_write
-2      common  open                    __x64_sys_open
-3      common  close                   __x64_sys_close
-4      common  stat                    __x64_sys_newstat
-5      common  fstat                   __x64_sys_newfstat
-6      common  lstat                   __x64_sys_newlstat
-7      common  poll                    __x64_sys_poll
-8      common  lseek                   __x64_sys_lseek
-9      common  mmap                    __x64_sys_mmap
-10     common  mprotect                __x64_sys_mprotect
-11     common  munmap                  __x64_sys_munmap
-12     common  brk                     __x64_sys_brk
-13     64      rt_sigaction            __x64_sys_rt_sigaction
-14     common  rt_sigprocmask          __x64_sys_rt_sigprocmask
-15     64      rt_sigreturn            __x64_sys_rt_sigreturn/ptregs
-16     64      ioctl                   __x64_sys_ioctl
-17     common  pread64                 __x64_sys_pread64
-18     common  pwrite64                __x64_sys_pwrite64
-19     64      readv                   __x64_sys_readv
-20     64      writev                  __x64_sys_writev
-21     common  access                  __x64_sys_access
-22     common  pipe                    __x64_sys_pipe
-23     common  select                  __x64_sys_select
-24     common  sched_yield             __x64_sys_sched_yield
-25     common  mremap                  __x64_sys_mremap
-26     common  msync                   __x64_sys_msync
-27     common  mincore                 __x64_sys_mincore
-28     common  madvise                 __x64_sys_madvise
-29     common  shmget                  __x64_sys_shmget
-30     common  shmat                   __x64_sys_shmat
-31     common  shmctl                  __x64_sys_shmctl
-32     common  dup                     __x64_sys_dup
-33     common  dup2                    __x64_sys_dup2
-34     common  pause                   __x64_sys_pause
-35     common  nanosleep               __x64_sys_nanosleep
-36     common  getitimer               __x64_sys_getitimer
-37     common  alarm                   __x64_sys_alarm
-38     common  setitimer               __x64_sys_setitimer
-39     common  getpid                  __x64_sys_getpid
-40     common  sendfile                __x64_sys_sendfile64
-41     common  socket                  __x64_sys_socket
-42     common  connect                 __x64_sys_connect
-43     common  accept                  __x64_sys_accept
-44     common  sendto                  __x64_sys_sendto
-45     64      recvfrom                __x64_sys_recvfrom
-46     64      sendmsg                 __x64_sys_sendmsg
-47     64      recvmsg                 __x64_sys_recvmsg
-48     common  shutdown                __x64_sys_shutdown
-49     common  bind                    __x64_sys_bind
-50     common  listen                  __x64_sys_listen
-51     common  getsockname             __x64_sys_getsockname
-52     common  getpeername             __x64_sys_getpeername
-53     common  socketpair              __x64_sys_socketpair
-54     64      setsockopt              __x64_sys_setsockopt
-55     64      getsockopt              __x64_sys_getsockopt
-56     common  clone                   __x64_sys_clone/ptregs
-57     common  fork                    __x64_sys_fork/ptregs
-58     common  vfork                   __x64_sys_vfork/ptregs
-59     64      execve                  __x64_sys_execve/ptregs
-60     common  exit                    __x64_sys_exit
-61     common  wait4                   __x64_sys_wait4
-62     common  kill                    __x64_sys_kill
-63     common  uname                   __x64_sys_newuname
-64     common  semget                  __x64_sys_semget
-65     common  semop                   __x64_sys_semop
-66     common  semctl                  __x64_sys_semctl
-67     common  shmdt                   __x64_sys_shmdt
-68     common  msgget                  __x64_sys_msgget
-69     common  msgsnd                  __x64_sys_msgsnd
-70     common  msgrcv                  __x64_sys_msgrcv
-71     common  msgctl                  __x64_sys_msgctl
-72     common  fcntl                   __x64_sys_fcntl
-73     common  flock                   __x64_sys_flock
-74     common  fsync                   __x64_sys_fsync
-75     common  fdatasync               __x64_sys_fdatasync
-76     common  truncate                __x64_sys_truncate
-77     common  ftruncate               __x64_sys_ftruncate
-78     common  getdents                __x64_sys_getdents
-79     common  getcwd                  __x64_sys_getcwd
-80     common  chdir                   __x64_sys_chdir
-81     common  fchdir                  __x64_sys_fchdir
-82     common  rename                  __x64_sys_rename
-83     common  mkdir                   __x64_sys_mkdir
-84     common  rmdir                   __x64_sys_rmdir
-85     common  creat                   __x64_sys_creat
-86     common  link                    __x64_sys_link
-87     common  unlink                  __x64_sys_unlink
-88     common  symlink                 __x64_sys_symlink
-89     common  readlink                __x64_sys_readlink
-90     common  chmod                   __x64_sys_chmod
-91     common  fchmod                  __x64_sys_fchmod
-92     common  chown                   __x64_sys_chown
-93     common  fchown                  __x64_sys_fchown
-94     common  lchown                  __x64_sys_lchown
-95     common  umask                   __x64_sys_umask
-96     common  gettimeofday            __x64_sys_gettimeofday
-97     common  getrlimit               __x64_sys_getrlimit
-98     common  getrusage               __x64_sys_getrusage
-99     common  sysinfo                 __x64_sys_sysinfo
-100    common  times                   __x64_sys_times
-101    64      ptrace                  __x64_sys_ptrace
-102    common  getuid                  __x64_sys_getuid
-103    common  syslog                  __x64_sys_syslog
-104    common  getgid                  __x64_sys_getgid
-105    common  setuid                  __x64_sys_setuid
-106    common  setgid                  __x64_sys_setgid
-107    common  geteuid                 __x64_sys_geteuid
-108    common  getegid                 __x64_sys_getegid
-109    common  setpgid                 __x64_sys_setpgid
-110    common  getppid                 __x64_sys_getppid
-111    common  getpgrp                 __x64_sys_getpgrp
-112    common  setsid                  __x64_sys_setsid
-113    common  setreuid                __x64_sys_setreuid
-114    common  setregid                __x64_sys_setregid
-115    common  getgroups               __x64_sys_getgroups
-116    common  setgroups               __x64_sys_setgroups
-117    common  setresuid               __x64_sys_setresuid
-118    common  getresuid               __x64_sys_getresuid
-119    common  setresgid               __x64_sys_setresgid
-120    common  getresgid               __x64_sys_getresgid
-121    common  getpgid                 __x64_sys_getpgid
-122    common  setfsuid                __x64_sys_setfsuid
-123    common  setfsgid                __x64_sys_setfsgid
-124    common  getsid                  __x64_sys_getsid
-125    common  capget                  __x64_sys_capget
-126    common  capset                  __x64_sys_capset
-127    64      rt_sigpending           __x64_sys_rt_sigpending
-128    64      rt_sigtimedwait         __x64_sys_rt_sigtimedwait
-129    64      rt_sigqueueinfo         __x64_sys_rt_sigqueueinfo
-130    common  rt_sigsuspend           __x64_sys_rt_sigsuspend
-131    64      sigaltstack             __x64_sys_sigaltstack
-132    common  utime                   __x64_sys_utime
-133    common  mknod                   __x64_sys_mknod
+0      common  read                    sys_read
+1      common  write                   sys_write
+2      common  open                    sys_open
+3      common  close                   sys_close
+4      common  stat                    sys_newstat
+5      common  fstat                   sys_newfstat
+6      common  lstat                   sys_newlstat
+7      common  poll                    sys_poll
+8      common  lseek                   sys_lseek
+9      common  mmap                    sys_mmap
+10     common  mprotect                sys_mprotect
+11     common  munmap                  sys_munmap
+12     common  brk                     sys_brk
+13     64      rt_sigaction            sys_rt_sigaction
+14     common  rt_sigprocmask          sys_rt_sigprocmask
+15     64      rt_sigreturn            sys_rt_sigreturn
+16     64      ioctl                   sys_ioctl
+17     common  pread64                 sys_pread64
+18     common  pwrite64                sys_pwrite64
+19     64      readv                   sys_readv
+20     64      writev                  sys_writev
+21     common  access                  sys_access
+22     common  pipe                    sys_pipe
+23     common  select                  sys_select
+24     common  sched_yield             sys_sched_yield
+25     common  mremap                  sys_mremap
+26     common  msync                   sys_msync
+27     common  mincore                 sys_mincore
+28     common  madvise                 sys_madvise
+29     common  shmget                  sys_shmget
+30     common  shmat                   sys_shmat
+31     common  shmctl                  sys_shmctl
+32     common  dup                     sys_dup
+33     common  dup2                    sys_dup2
+34     common  pause                   sys_pause
+35     common  nanosleep               sys_nanosleep
+36     common  getitimer               sys_getitimer
+37     common  alarm                   sys_alarm
+38     common  setitimer               sys_setitimer
+39     common  getpid                  sys_getpid
+40     common  sendfile                sys_sendfile64
+41     common  socket                  sys_socket
+42     common  connect                 sys_connect
+43     common  accept                  sys_accept
+44     common  sendto                  sys_sendto
+45     64      recvfrom                sys_recvfrom
+46     64      sendmsg                 sys_sendmsg
+47     64      recvmsg                 sys_recvmsg
+48     common  shutdown                sys_shutdown
+49     common  bind                    sys_bind
+50     common  listen                  sys_listen
+51     common  getsockname             sys_getsockname
+52     common  getpeername             sys_getpeername
+53     common  socketpair              sys_socketpair
+54     64      setsockopt              sys_setsockopt
+55     64      getsockopt              sys_getsockopt
+56     common  clone                   sys_clone
+57     common  fork                    sys_fork
+58     common  vfork                   sys_vfork
+59     64      execve                  sys_execve
+60     common  exit                    sys_exit
+61     common  wait4                   sys_wait4
+62     common  kill                    sys_kill
+63     common  uname                   sys_newuname
+64     common  semget                  sys_semget
+65     common  semop                   sys_semop
+66     common  semctl                  sys_semctl
+67     common  shmdt                   sys_shmdt
+68     common  msgget                  sys_msgget
+69     common  msgsnd                  sys_msgsnd
+70     common  msgrcv                  sys_msgrcv
+71     common  msgctl                  sys_msgctl
+72     common  fcntl                   sys_fcntl
+73     common  flock                   sys_flock
+74     common  fsync                   sys_fsync
+75     common  fdatasync               sys_fdatasync
+76     common  truncate                sys_truncate
+77     common  ftruncate               sys_ftruncate
+78     common  getdents                sys_getdents
+79     common  getcwd                  sys_getcwd
+80     common  chdir                   sys_chdir
+81     common  fchdir                  sys_fchdir
+82     common  rename                  sys_rename
+83     common  mkdir                   sys_mkdir
+84     common  rmdir                   sys_rmdir
+85     common  creat                   sys_creat
+86     common  link                    sys_link
+87     common  unlink                  sys_unlink
+88     common  symlink                 sys_symlink
+89     common  readlink                sys_readlink
+90     common  chmod                   sys_chmod
+91     common  fchmod                  sys_fchmod
+92     common  chown                   sys_chown
+93     common  fchown                  sys_fchown
+94     common  lchown                  sys_lchown
+95     common  umask                   sys_umask
+96     common  gettimeofday            sys_gettimeofday
+97     common  getrlimit               sys_getrlimit
+98     common  getrusage               sys_getrusage
+99     common  sysinfo                 sys_sysinfo
+100    common  times                   sys_times
+101    64      ptrace                  sys_ptrace
+102    common  getuid                  sys_getuid
+103    common  syslog                  sys_syslog
+104    common  getgid                  sys_getgid
+105    common  setuid                  sys_setuid
+106    common  setgid                  sys_setgid
+107    common  geteuid                 sys_geteuid
+108    common  getegid                 sys_getegid
+109    common  setpgid                 sys_setpgid
+110    common  getppid                 sys_getppid
+111    common  getpgrp                 sys_getpgrp
+112    common  setsid                  sys_setsid
+113    common  setreuid                sys_setreuid
+114    common  setregid                sys_setregid
+115    common  getgroups               sys_getgroups
+116    common  setgroups               sys_setgroups
+117    common  setresuid               sys_setresuid
+118    common  getresuid               sys_getresuid
+119    common  setresgid               sys_setresgid
+120    common  getresgid               sys_getresgid
+121    common  getpgid                 sys_getpgid
+122    common  setfsuid                sys_setfsuid
+123    common  setfsgid                sys_setfsgid
+124    common  getsid                  sys_getsid
+125    common  capget                  sys_capget
+126    common  capset                  sys_capset
+127    64      rt_sigpending           sys_rt_sigpending
+128    64      rt_sigtimedwait         sys_rt_sigtimedwait
+129    64      rt_sigqueueinfo         sys_rt_sigqueueinfo
+130    common  rt_sigsuspend           sys_rt_sigsuspend
+131    64      sigaltstack             sys_sigaltstack
+132    common  utime                   sys_utime
+133    common  mknod                   sys_mknod
 134    64      uselib
-135    common  personality             __x64_sys_personality
-136    common  ustat                   __x64_sys_ustat
-137    common  statfs                  __x64_sys_statfs
-138    common  fstatfs                 __x64_sys_fstatfs
-139    common  sysfs                   __x64_sys_sysfs
-140    common  getpriority             __x64_sys_getpriority
-141    common  setpriority             __x64_sys_setpriority
-142    common  sched_setparam          __x64_sys_sched_setparam
-143    common  sched_getparam          __x64_sys_sched_getparam
-144    common  sched_setscheduler      __x64_sys_sched_setscheduler
-145    common  sched_getscheduler      __x64_sys_sched_getscheduler
-146    common  sched_get_priority_max  __x64_sys_sched_get_priority_max
-147    common  sched_get_priority_min  __x64_sys_sched_get_priority_min
-148    common  sched_rr_get_interval   __x64_sys_sched_rr_get_interval
-149    common  mlock                   __x64_sys_mlock
-150    common  munlock                 __x64_sys_munlock
-151    common  mlockall                __x64_sys_mlockall
-152    common  munlockall              __x64_sys_munlockall
-153    common  vhangup                 __x64_sys_vhangup
-154    common  modify_ldt              __x64_sys_modify_ldt
-155    common  pivot_root              __x64_sys_pivot_root
-156    64      _sysctl                 __x64_sys_sysctl
-157    common  prctl                   __x64_sys_prctl
-158    common  arch_prctl              __x64_sys_arch_prctl
-159    common  adjtimex                __x64_sys_adjtimex
-160    common  setrlimit               __x64_sys_setrlimit
-161    common  chroot                  __x64_sys_chroot
-162    common  sync                    __x64_sys_sync
-163    common  acct                    __x64_sys_acct
-164    common  settimeofday            __x64_sys_settimeofday
-165    common  mount                   __x64_sys_mount
-166    common  umount2                 __x64_sys_umount
-167    common  swapon                  __x64_sys_swapon
-168    common  swapoff                 __x64_sys_swapoff
-169    common  reboot                  __x64_sys_reboot
-170    common  sethostname             __x64_sys_sethostname
-171    common  setdomainname           __x64_sys_setdomainname
-172    common  iopl                    __x64_sys_iopl/ptregs
-173    common  ioperm                  __x64_sys_ioperm
+135    common  personality             sys_personality
+136    common  ustat                   sys_ustat
+137    common  statfs                  sys_statfs
+138    common  fstatfs                 sys_fstatfs
+139    common  sysfs                   sys_sysfs
+140    common  getpriority             sys_getpriority
+141    common  setpriority             sys_setpriority
+142    common  sched_setparam          sys_sched_setparam
+143    common  sched_getparam          sys_sched_getparam
+144    common  sched_setscheduler      sys_sched_setscheduler
+145    common  sched_getscheduler      sys_sched_getscheduler
+146    common  sched_get_priority_max  sys_sched_get_priority_max
+147    common  sched_get_priority_min  sys_sched_get_priority_min
+148    common  sched_rr_get_interval   sys_sched_rr_get_interval
+149    common  mlock                   sys_mlock
+150    common  munlock                 sys_munlock
+151    common  mlockall                sys_mlockall
+152    common  munlockall              sys_munlockall
+153    common  vhangup                 sys_vhangup
+154    common  modify_ldt              sys_modify_ldt
+155    common  pivot_root              sys_pivot_root
+156    64      _sysctl                 sys_sysctl
+157    common  prctl                   sys_prctl
+158    common  arch_prctl              sys_arch_prctl
+159    common  adjtimex                sys_adjtimex
+160    common  setrlimit               sys_setrlimit
+161    common  chroot                  sys_chroot
+162    common  sync                    sys_sync
+163    common  acct                    sys_acct
+164    common  settimeofday            sys_settimeofday
+165    common  mount                   sys_mount
+166    common  umount2                 sys_umount
+167    common  swapon                  sys_swapon
+168    common  swapoff                 sys_swapoff
+169    common  reboot                  sys_reboot
+170    common  sethostname             sys_sethostname
+171    common  setdomainname           sys_setdomainname
+172    common  iopl                    sys_iopl
+173    common  ioperm                  sys_ioperm
 174    64      create_module
-175    common  init_module             __x64_sys_init_module
-176    common  delete_module           __x64_sys_delete_module
+175    common  init_module             sys_init_module
+176    common  delete_module           sys_delete_module
 177    64      get_kernel_syms
 178    64      query_module
-179    common  quotactl                __x64_sys_quotactl
+179    common  quotactl                sys_quotactl
 180    64      nfsservctl
 181    common  getpmsg
 182    common  putpmsg
 183    common  afs_syscall
 184    common  tuxcall
 185    common  security
-186    common  gettid                  __x64_sys_gettid
-187    common  readahead               __x64_sys_readahead
-188    common  setxattr                __x64_sys_setxattr
-189    common  lsetxattr               __x64_sys_lsetxattr
-190    common  fsetxattr               __x64_sys_fsetxattr
-191    common  getxattr                __x64_sys_getxattr
-192    common  lgetxattr               __x64_sys_lgetxattr
-193    common  fgetxattr               __x64_sys_fgetxattr
-194    common  listxattr               __x64_sys_listxattr
-195    common  llistxattr              __x64_sys_llistxattr
-196    common  flistxattr              __x64_sys_flistxattr
-197    common  removexattr             __x64_sys_removexattr
-198    common  lremovexattr            __x64_sys_lremovexattr
-199    common  fremovexattr            __x64_sys_fremovexattr
-200    common  tkill                   __x64_sys_tkill
-201    common  time                    __x64_sys_time
-202    common  futex                   __x64_sys_futex
-203    common  sched_setaffinity       __x64_sys_sched_setaffinity
-204    common  sched_getaffinity       __x64_sys_sched_getaffinity
+186    common  gettid                  sys_gettid
+187    common  readahead               sys_readahead
+188    common  setxattr                sys_setxattr
+189    common  lsetxattr               sys_lsetxattr
+190    common  fsetxattr               sys_fsetxattr
+191    common  getxattr                sys_getxattr
+192    common  lgetxattr               sys_lgetxattr
+193    common  fgetxattr               sys_fgetxattr
+194    common  listxattr               sys_listxattr
+195    common  llistxattr              sys_llistxattr
+196    common  flistxattr              sys_flistxattr
+197    common  removexattr             sys_removexattr
+198    common  lremovexattr            sys_lremovexattr
+199    common  fremovexattr            sys_fremovexattr
+200    common  tkill                   sys_tkill
+201    common  time                    sys_time
+202    common  futex                   sys_futex
+203    common  sched_setaffinity       sys_sched_setaffinity
+204    common  sched_getaffinity       sys_sched_getaffinity
 205    64      set_thread_area
-206    64      io_setup                __x64_sys_io_setup
-207    common  io_destroy              __x64_sys_io_destroy
-208    common  io_getevents            __x64_sys_io_getevents
-209    64      io_submit               __x64_sys_io_submit
-210    common  io_cancel               __x64_sys_io_cancel
+206    64      io_setup                sys_io_setup
+207    common  io_destroy              sys_io_destroy
+208    common  io_getevents            sys_io_getevents
+209    64      io_submit               sys_io_submit
+210    common  io_cancel               sys_io_cancel
 211    64      get_thread_area
-212    common  lookup_dcookie          __x64_sys_lookup_dcookie
-213    common  epoll_create            __x64_sys_epoll_create
+212    common  lookup_dcookie          sys_lookup_dcookie
+213    common  epoll_create            sys_epoll_create
 214    64      epoll_ctl_old
 215    64      epoll_wait_old
-216    common  remap_file_pages        __x64_sys_remap_file_pages
-217    common  getdents64              __x64_sys_getdents64
-218    common  set_tid_address         __x64_sys_set_tid_address
-219    common  restart_syscall         __x64_sys_restart_syscall
-220    common  semtimedop              __x64_sys_semtimedop
-221    common  fadvise64               __x64_sys_fadvise64
-222    64      timer_create            __x64_sys_timer_create
-223    common  timer_settime           __x64_sys_timer_settime
-224    common  timer_gettime           __x64_sys_timer_gettime
-225    common  timer_getoverrun        __x64_sys_timer_getoverrun
-226    common  timer_delete            __x64_sys_timer_delete
-227    common  clock_settime           __x64_sys_clock_settime
-228    common  clock_gettime           __x64_sys_clock_gettime
-229    common  clock_getres            __x64_sys_clock_getres
-230    common  clock_nanosleep         __x64_sys_clock_nanosleep
-231    common  exit_group              __x64_sys_exit_group
-232    common  epoll_wait              __x64_sys_epoll_wait
-233    common  epoll_ctl               __x64_sys_epoll_ctl
-234    common  tgkill                  __x64_sys_tgkill
-235    common  utimes                  __x64_sys_utimes
+216    common  remap_file_pages        sys_remap_file_pages
+217    common  getdents64              sys_getdents64
+218    common  set_tid_address         sys_set_tid_address
+219    common  restart_syscall         sys_restart_syscall
+220    common  semtimedop              sys_semtimedop
+221    common  fadvise64               sys_fadvise64
+222    64      timer_create            sys_timer_create
+223    common  timer_settime           sys_timer_settime
+224    common  timer_gettime           sys_timer_gettime
+225    common  timer_getoverrun        sys_timer_getoverrun
+226    common  timer_delete            sys_timer_delete
+227    common  clock_settime           sys_clock_settime
+228    common  clock_gettime           sys_clock_gettime
+229    common  clock_getres            sys_clock_getres
+230    common  clock_nanosleep         sys_clock_nanosleep
+231    common  exit_group              sys_exit_group
+232    common  epoll_wait              sys_epoll_wait
+233    common  epoll_ctl               sys_epoll_ctl
+234    common  tgkill                  sys_tgkill
+235    common  utimes                  sys_utimes
 236    64      vserver
-237    common  mbind                   __x64_sys_mbind
-238    common  set_mempolicy           __x64_sys_set_mempolicy
-239    common  get_mempolicy           __x64_sys_get_mempolicy
-240    common  mq_open                 __x64_sys_mq_open
-241    common  mq_unlink               __x64_sys_mq_unlink
-242    common  mq_timedsend            __x64_sys_mq_timedsend
-243    common  mq_timedreceive         __x64_sys_mq_timedreceive
-244    64      mq_notify               __x64_sys_mq_notify
-245    common  mq_getsetattr           __x64_sys_mq_getsetattr
-246    64      kexec_load              __x64_sys_kexec_load
-247    64      waitid                  __x64_sys_waitid
-248    common  add_key                 __x64_sys_add_key
-249    common  request_key             __x64_sys_request_key
-250    common  keyctl                  __x64_sys_keyctl
-251    common  ioprio_set              __x64_sys_ioprio_set
-252    common  ioprio_get              __x64_sys_ioprio_get
-253    common  inotify_init            __x64_sys_inotify_init
-254    common  inotify_add_watch       __x64_sys_inotify_add_watch
-255    common  inotify_rm_watch        __x64_sys_inotify_rm_watch
-256    common  migrate_pages           __x64_sys_migrate_pages
-257    common  openat                  __x64_sys_openat
-258    common  mkdirat                 __x64_sys_mkdirat
-259    common  mknodat                 __x64_sys_mknodat
-260    common  fchownat                __x64_sys_fchownat
-261    common  futimesat               __x64_sys_futimesat
-262    common  newfstatat              __x64_sys_newfstatat
-263    common  unlinkat                __x64_sys_unlinkat
-264    common  renameat                __x64_sys_renameat
-265    common  linkat                  __x64_sys_linkat
-266    common  symlinkat               __x64_sys_symlinkat
-267    common  readlinkat              __x64_sys_readlinkat
-268    common  fchmodat                __x64_sys_fchmodat
-269    common  faccessat               __x64_sys_faccessat
-270    common  pselect6                __x64_sys_pselect6
-271    common  ppoll                   __x64_sys_ppoll
-272    common  unshare                 __x64_sys_unshare
-273    64      set_robust_list         __x64_sys_set_robust_list
-274    64      get_robust_list         __x64_sys_get_robust_list
-275    common  splice                  __x64_sys_splice
-276    common  tee                     __x64_sys_tee
-277    common  sync_file_range         __x64_sys_sync_file_range
-278    64      vmsplice                __x64_sys_vmsplice
-279    64      move_pages              __x64_sys_move_pages
-280    common  utimensat               __x64_sys_utimensat
-281    common  epoll_pwait             __x64_sys_epoll_pwait
-282    common  signalfd                __x64_sys_signalfd
-283    common  timerfd_create          __x64_sys_timerfd_create
-284    common  eventfd                 __x64_sys_eventfd
-285    common  fallocate               __x64_sys_fallocate
-286    common  timerfd_settime         __x64_sys_timerfd_settime
-287    common  timerfd_gettime         __x64_sys_timerfd_gettime
-288    common  accept4                 __x64_sys_accept4
-289    common  signalfd4               __x64_sys_signalfd4
-290    common  eventfd2                __x64_sys_eventfd2
-291    common  epoll_create1           __x64_sys_epoll_create1
-292    common  dup3                    __x64_sys_dup3
-293    common  pipe2                   __x64_sys_pipe2
-294    common  inotify_init1           __x64_sys_inotify_init1
-295    64      preadv                  __x64_sys_preadv
-296    64      pwritev                 __x64_sys_pwritev
-297    64      rt_tgsigqueueinfo       __x64_sys_rt_tgsigqueueinfo
-298    common  perf_event_open         __x64_sys_perf_event_open
-299    64      recvmmsg                __x64_sys_recvmmsg
-300    common  fanotify_init           __x64_sys_fanotify_init
-301    common  fanotify_mark           __x64_sys_fanotify_mark
-302    common  prlimit64               __x64_sys_prlimit64
-303    common  name_to_handle_at       __x64_sys_name_to_handle_at
-304    common  open_by_handle_at       __x64_sys_open_by_handle_at
-305    common  clock_adjtime           __x64_sys_clock_adjtime
-306    common  syncfs                  __x64_sys_syncfs
-307    64      sendmmsg                __x64_sys_sendmmsg
-308    common  setns                   __x64_sys_setns
-309    common  getcpu                  __x64_sys_getcpu
-310    64      process_vm_readv        __x64_sys_process_vm_readv
-311    64      process_vm_writev       __x64_sys_process_vm_writev
-312    common  kcmp                    __x64_sys_kcmp
-313    common  finit_module            __x64_sys_finit_module
-314    common  sched_setattr           __x64_sys_sched_setattr
-315    common  sched_getattr           __x64_sys_sched_getattr
-316    common  renameat2               __x64_sys_renameat2
-317    common  seccomp                 __x64_sys_seccomp
-318    common  getrandom               __x64_sys_getrandom
-319    common  memfd_create            __x64_sys_memfd_create
-320    common  kexec_file_load         __x64_sys_kexec_file_load
-321    common  bpf                     __x64_sys_bpf
-322    64      execveat                __x64_sys_execveat/ptregs
-323    common  userfaultfd             __x64_sys_userfaultfd
-324    common  membarrier              __x64_sys_membarrier
-325    common  mlock2                  __x64_sys_mlock2
-326    common  copy_file_range         __x64_sys_copy_file_range
-327    64      preadv2                 __x64_sys_preadv2
-328    64      pwritev2                __x64_sys_pwritev2
-329    common  pkey_mprotect           __x64_sys_pkey_mprotect
-330    common  pkey_alloc              __x64_sys_pkey_alloc
-331    common  pkey_free               __x64_sys_pkey_free
-332    common  statx                   __x64_sys_statx
-333    common  io_pgetevents           __x64_sys_io_pgetevents
-334    common  rseq                    __x64_sys_rseq
+237    common  mbind                   sys_mbind
+238    common  set_mempolicy           sys_set_mempolicy
+239    common  get_mempolicy           sys_get_mempolicy
+240    common  mq_open                 sys_mq_open
+241    common  mq_unlink               sys_mq_unlink
+242    common  mq_timedsend            sys_mq_timedsend
+243    common  mq_timedreceive         sys_mq_timedreceive
+244    64      mq_notify               sys_mq_notify
+245    common  mq_getsetattr           sys_mq_getsetattr
+246    64      kexec_load              sys_kexec_load
+247    64      waitid                  sys_waitid
+248    common  add_key                 sys_add_key
+249    common  request_key             sys_request_key
+250    common  keyctl                  sys_keyctl
+251    common  ioprio_set              sys_ioprio_set
+252    common  ioprio_get              sys_ioprio_get
+253    common  inotify_init            sys_inotify_init
+254    common  inotify_add_watch       sys_inotify_add_watch
+255    common  inotify_rm_watch        sys_inotify_rm_watch
+256    common  migrate_pages           sys_migrate_pages
+257    common  openat                  sys_openat
+258    common  mkdirat                 sys_mkdirat
+259    common  mknodat                 sys_mknodat
+260    common  fchownat                sys_fchownat
+261    common  futimesat               sys_futimesat
+262    common  newfstatat              sys_newfstatat
+263    common  unlinkat                sys_unlinkat
+264    common  renameat                sys_renameat
+265    common  linkat                  sys_linkat
+266    common  symlinkat               sys_symlinkat
+267    common  readlinkat              sys_readlinkat
+268    common  fchmodat                sys_fchmodat
+269    common  faccessat               sys_faccessat
+270    common  pselect6                sys_pselect6
+271    common  ppoll                   sys_ppoll
+272    common  unshare                 sys_unshare
+273    64      set_robust_list         sys_set_robust_list
+274    64      get_robust_list         sys_get_robust_list
+275    common  splice                  sys_splice
+276    common  tee                     sys_tee
+277    common  sync_file_range         sys_sync_file_range
+278    64      vmsplice                sys_vmsplice
+279    64      move_pages              sys_move_pages
+280    common  utimensat               sys_utimensat
+281    common  epoll_pwait             sys_epoll_pwait
+282    common  signalfd                sys_signalfd
+283    common  timerfd_create          sys_timerfd_create
+284    common  eventfd                 sys_eventfd
+285    common  fallocate               sys_fallocate
+286    common  timerfd_settime         sys_timerfd_settime
+287    common  timerfd_gettime         sys_timerfd_gettime
+288    common  accept4                 sys_accept4
+289    common  signalfd4               sys_signalfd4
+290    common  eventfd2                sys_eventfd2
+291    common  epoll_create1           sys_epoll_create1
+292    common  dup3                    sys_dup3
+293    common  pipe2                   sys_pipe2
+294    common  inotify_init1           sys_inotify_init1
+295    64      preadv                  sys_preadv
+296    64      pwritev                 sys_pwritev
+297    64      rt_tgsigqueueinfo       sys_rt_tgsigqueueinfo
+298    common  perf_event_open         sys_perf_event_open
+299    64      recvmmsg                sys_recvmmsg
+300    common  fanotify_init           sys_fanotify_init
+301    common  fanotify_mark           sys_fanotify_mark
+302    common  prlimit64               sys_prlimit64
+303    common  name_to_handle_at       sys_name_to_handle_at
+304    common  open_by_handle_at       sys_open_by_handle_at
+305    common  clock_adjtime           sys_clock_adjtime
+306    common  syncfs                  sys_syncfs
+307    64      sendmmsg                sys_sendmmsg
+308    common  setns                   sys_setns
+309    common  getcpu                  sys_getcpu
+310    64      process_vm_readv        sys_process_vm_readv
+311    64      process_vm_writev       sys_process_vm_writev
+312    common  kcmp                    sys_kcmp
+313    common  finit_module            sys_finit_module
+314    common  sched_setattr           sys_sched_setattr
+315    common  sched_getattr           sys_sched_getattr
+316    common  renameat2               sys_renameat2
+317    common  seccomp                 sys_seccomp
+318    common  getrandom               sys_getrandom
+319    common  memfd_create            sys_memfd_create
+320    common  kexec_file_load         sys_kexec_file_load
+321    common  bpf                     sys_bpf
+322    64      execveat                sys_execveat
+323    common  userfaultfd             sys_userfaultfd
+324    common  membarrier              sys_membarrier
+325    common  mlock2                  sys_mlock2
+326    common  copy_file_range         sys_copy_file_range
+327    64      preadv2                 sys_preadv2
+328    64      pwritev2                sys_pwritev2
+329    common  pkey_mprotect           sys_pkey_mprotect
+330    common  pkey_alloc              sys_pkey_alloc
+331    common  pkey_free               sys_pkey_free
+332    common  statx                   sys_statx
+333    common  io_pgetevents           sys_io_pgetevents
+334    common  rseq                    sys_rseq
 # don't use numbers 387 through 423, add new calls after the last
 # 'common' entry
-424    common  pidfd_send_signal       __x64_sys_pidfd_send_signal
-425    common  io_uring_setup          __x64_sys_io_uring_setup
-426    common  io_uring_enter          __x64_sys_io_uring_enter
-427    common  io_uring_register       __x64_sys_io_uring_register
-428    common  open_tree               __x64_sys_open_tree
-429    common  move_mount              __x64_sys_move_mount
-430    common  fsopen                  __x64_sys_fsopen
-431    common  fsconfig                __x64_sys_fsconfig
-432    common  fsmount                 __x64_sys_fsmount
-433    common  fspick                  __x64_sys_fspick
-434    common  pidfd_open              __x64_sys_pidfd_open
-435    common  clone3                  __x64_sys_clone3/ptregs
-437    common  openat2                 __x64_sys_openat2
-438    common  pidfd_getfd             __x64_sys_pidfd_getfd
+424    common  pidfd_send_signal       sys_pidfd_send_signal
+425    common  io_uring_setup          sys_io_uring_setup
+426    common  io_uring_enter          sys_io_uring_enter
+427    common  io_uring_register       sys_io_uring_register
+428    common  open_tree               sys_open_tree
+429    common  move_mount              sys_move_mount
+430    common  fsopen                  sys_fsopen
+431    common  fsconfig                sys_fsconfig
+432    common  fsmount                 sys_fsmount
+433    common  fspick                  sys_fspick
+434    common  pidfd_open              sys_pidfd_open
+435    common  clone3                  sys_clone3
+437    common  openat2                 sys_openat2
+438    common  pidfd_getfd             sys_pidfd_getfd
 
 #
 # x32-specific system call numbers start at 512 to avoid cache impact
 # on-the-fly for compat_sys_*() compatibility system calls if X86_X32
 # is defined.
 #
-512    x32     rt_sigaction            __x32_compat_sys_rt_sigaction
-513    x32     rt_sigreturn            sys32_x32_rt_sigreturn
-514    x32     ioctl                   __x32_compat_sys_ioctl
-515    x32     readv                   __x32_compat_sys_readv
-516    x32     writev                  __x32_compat_sys_writev
-517    x32     recvfrom                __x32_compat_sys_recvfrom
-518    x32     sendmsg                 __x32_compat_sys_sendmsg
-519    x32     recvmsg                 __x32_compat_sys_recvmsg
-520    x32     execve                  __x32_compat_sys_execve/ptregs
-521    x32     ptrace                  __x32_compat_sys_ptrace
-522    x32     rt_sigpending           __x32_compat_sys_rt_sigpending
-523    x32     rt_sigtimedwait         __x32_compat_sys_rt_sigtimedwait_time64
-524    x32     rt_sigqueueinfo         __x32_compat_sys_rt_sigqueueinfo
-525    x32     sigaltstack             __x32_compat_sys_sigaltstack
-526    x32     timer_create            __x32_compat_sys_timer_create
-527    x32     mq_notify               __x32_compat_sys_mq_notify
-528    x32     kexec_load              __x32_compat_sys_kexec_load
-529    x32     waitid                  __x32_compat_sys_waitid
-530    x32     set_robust_list         __x32_compat_sys_set_robust_list
-531    x32     get_robust_list         __x32_compat_sys_get_robust_list
-532    x32     vmsplice                __x32_compat_sys_vmsplice
-533    x32     move_pages              __x32_compat_sys_move_pages
-534    x32     preadv                  __x32_compat_sys_preadv64
-535    x32     pwritev                 __x32_compat_sys_pwritev64
-536    x32     rt_tgsigqueueinfo       __x32_compat_sys_rt_tgsigqueueinfo
-537    x32     recvmmsg                __x32_compat_sys_recvmmsg_time64
-538    x32     sendmmsg                __x32_compat_sys_sendmmsg
-539    x32     process_vm_readv        __x32_compat_sys_process_vm_readv
-540    x32     process_vm_writev       __x32_compat_sys_process_vm_writev
-541    x32     setsockopt              __x32_compat_sys_setsockopt
-542    x32     getsockopt              __x32_compat_sys_getsockopt
-543    x32     io_setup                __x32_compat_sys_io_setup
-544    x32     io_submit               __x32_compat_sys_io_submit
-545    x32     execveat                __x32_compat_sys_execveat/ptregs
-546    x32     preadv2                 __x32_compat_sys_preadv64v2
-547    x32     pwritev2                __x32_compat_sys_pwritev64v2
+512    x32     rt_sigaction            compat_sys_rt_sigaction
+513    x32     rt_sigreturn            compat_sys_x32_rt_sigreturn
+514    x32     ioctl                   compat_sys_ioctl
+515    x32     readv                   compat_sys_readv
+516    x32     writev                  compat_sys_writev
+517    x32     recvfrom                compat_sys_recvfrom
+518    x32     sendmsg                 compat_sys_sendmsg
+519    x32     recvmsg                 compat_sys_recvmsg
+520    x32     execve                  compat_sys_execve
+521    x32     ptrace                  compat_sys_ptrace
+522    x32     rt_sigpending           compat_sys_rt_sigpending
+523    x32     rt_sigtimedwait         compat_sys_rt_sigtimedwait_time64
+524    x32     rt_sigqueueinfo         compat_sys_rt_sigqueueinfo
+525    x32     sigaltstack             compat_sys_sigaltstack
+526    x32     timer_create            compat_sys_timer_create
+527    x32     mq_notify               compat_sys_mq_notify
+528    x32     kexec_load              compat_sys_kexec_load
+529    x32     waitid                  compat_sys_waitid
+530    x32     set_robust_list         compat_sys_set_robust_list
+531    x32     get_robust_list         compat_sys_get_robust_list
+532    x32     vmsplice                compat_sys_vmsplice
+533    x32     move_pages              compat_sys_move_pages
+534    x32     preadv                  compat_sys_preadv64
+535    x32     pwritev                 compat_sys_pwritev64
+536    x32     rt_tgsigqueueinfo       compat_sys_rt_tgsigqueueinfo
+537    x32     recvmmsg                compat_sys_recvmmsg_time64
+538    x32     sendmmsg                compat_sys_sendmmsg
+539    x32     process_vm_readv        compat_sys_process_vm_readv
+540    x32     process_vm_writev       compat_sys_process_vm_writev
+541    x32     setsockopt              compat_sys_setsockopt
+542    x32     getsockopt              compat_sys_getsockopt
+543    x32     io_setup                compat_sys_io_setup
+544    x32     io_submit               compat_sys_io_submit
+545    x32     execveat                compat_sys_execveat
+546    x32     preadv2                 compat_sys_preadv64v2
+547    x32     pwritev2                compat_sys_pwritev64v2
index bfb21d0..cf147db 100755 (executable)
@@ -22,7 +22,9 @@ include/uapi/linux/usbdevice_fs.h
 include/uapi/linux/vhost.h
 include/uapi/sound/asound.h
 include/linux/bits.h
+include/vdso/bits.h
 include/linux/const.h
+include/vdso/const.h
 include/linux/hash.h
 include/uapi/linux/hw_breakpoint.h
 arch/x86/include/asm/disabled-features.h
@@ -115,6 +117,7 @@ check arch/x86/lib/memcpy_64.S        '-I "^EXPORT_SYMBOL" -I "^#include <asm/ex
 check arch/x86/lib/memset_64.S        '-I "^EXPORT_SYMBOL" -I "^#include <asm/export.h>" -I"^SYM_FUNC_START\(_LOCAL\)*(memset_\(erms\|orig\))"'
 check include/uapi/asm-generic/mman.h '-I "^#include <\(uapi/\)*asm-generic/mman-common\(-tools\)*.h>"'
 check include/uapi/linux/mman.h       '-I "^#include <\(uapi/\)*asm/mman.h>"'
+check include/linux/build_bug.h       '-I "^#\(ifndef\|endif\)\( \/\/\)* static_assert$"'
 check include/linux/ctype.h          '-I "isdigit("'
 check lib/ctype.c                    '-I "^EXPORT_SYMBOL" -I "^#include <linux/export.h>" -B'
 check arch/x86/include/asm/inat.h     '-I "^#include [\"<]\(asm/\)*inat_types.h[\">]"'
index 062ca84..f4db894 100644 (file)
@@ -46,6 +46,7 @@ static size_t clone__scnprintf_flags(unsigned long flags, char *bf, size_t size,
        P_FLAG(NEWNET);
        P_FLAG(IO);
        P_FLAG(CLEAR_SIGHAND);
+       P_FLAG(INTO_CGROUP);
 #undef P_FLAG
 
        if (flags)
index 9fa771a..862c833 100644 (file)
@@ -69,6 +69,7 @@ static size_t syscall_arg__scnprintf_mremap_flags(char *bf, size_t size,
 
        P_MREMAP_FLAG(MAYMOVE);
        P_MREMAP_FLAG(FIXED);
+       P_MREMAP_FLAG(DONTUNMAP);
 #undef P_MREMAP_FLAG
 
        if (flags)
index 347b2c0..c5e3e9a 100644 (file)
@@ -21,6 +21,8 @@ if cc_is_clang:
             vars[var] = sub("-fstack-clash-protection", "", vars[var])
         if not clang_has_option("-fstack-protector-strong"):
             vars[var] = sub("-fstack-protector-strong", "", vars[var])
+        if not clang_has_option("-fno-semantic-interposition"):
+            vars[var] = sub("-fno-semantic-interposition", "", vars[var])
 
 from distutils.core import setup, Extension
 
index 0fd713d..03ecb8c 100644 (file)
@@ -803,8 +803,11 @@ static void generic_metric(struct perf_stat_config *config,
                                     out->force_header ?
                                     (metric_name ? metric_name : name) : "", 0);
                }
-       } else
-               print_metric(config, ctxp, NULL, NULL, "", 0);
+       } else {
+               print_metric(config, ctxp, NULL, NULL,
+                            out->force_header ?
+                            (metric_name ? metric_name : name) : "", 0);
+       }
 
        for (i = 1; i < pctx.num_ids; i++)
                zfree(&pctx.ids[i].name);
index 8455415..b531083 100644 (file)
@@ -41,6 +41,10 @@ uninstall :
        if [ -d $(DESTDIR)$(PREFIX)/lib/pm-graph/config ] ; then \
                rmdir $(DESTDIR)$(PREFIX)/lib/pm-graph/config; \
        fi;
+       rm -f $(DESTDIR)$(PREFIX)/lib/pm-graph/__pycache__/*
+       if [ -d $(DESTDIR)$(PREFIX)/lib/pm-graph/__pycache__ ] ; then \
+               rmdir $(DESTDIR)$(PREFIX)/lib/pm-graph/__pycache__; \
+       fi;
        rm -f $(DESTDIR)$(PREFIX)/lib/pm-graph/*
        if [ -d $(DESTDIR)$(PREFIX)/lib/pm-graph ] ; then \
                rmdir $(DESTDIR)$(PREFIX)/lib/pm-graph; \
index 96259f6..afe6beb 100644 (file)
@@ -1,7 +1,12 @@
-                     p m - g r a p h
+                                                _
+    _ __  _ __ ___         __ _ _ __ __ _ _ __ | |__
+   | '_ \| '_ ` _ \ _____ / _` | '__/ _` | '_ \| '_ \
+   | |_) | | | | | |_____| (_| | | | (_| | |_) | | | |
+   | .__/|_| |_| |_|      \__, |_|  \__,_| .__/|_| |_|
+   |_|                    |___/          |_|
 
    pm-graph: suspend/resume/boot timing analysis tools
-    Version: 5.5
+    Version: 5.6
      Author: Todd Brandt <todd.e.brandt@intel.com>
   Home Page: https://01.org/pm-graph
 
        - upstream version in git:
          https://github.com/intel/pm-graph/
 
- Requirements:
-       - runs with python2 or python3, choice is made by /usr/bin/python link
-       - python2 now requires python-configparser be installed
-
  Table of Contents
        - Overview
        - Setup
@@ -29,6 +30,8 @@
                - Basic Usage
                - Dev Mode Usage
                - Proc Mode Usage
+       - Endurance Testing
+               - Usage Examples
        - Configuration Files
                - Usage Examples
                - Config File Options
 |                            SETUP                               |
 ------------------------------------------------------------------
 
-    These packages are required to execute the scripts
+    Package Requirements
+       - runs with python2 or python3, choice is made by /usr/bin/python link
        - python
-       - python-requests
+       - python-configparser (for python2 sleepgraph)
+       - python-requests (for googlesheet.py)
+       - linux-tools-common (for turbostat usage in sleepgraph)
 
        Ubuntu:
-          sudo apt-get install python python-requests
+          sudo apt-get install python python-configparser python-requests linux-tools-common
 
        Fedora:
-          sudo dnf install python python-requests
+          sudo dnf install python python-configparser python-requests linux-tools-common
 
     The tools can most easily be installed via git clone and make install
 
@@ -190,6 +196,104 @@ _______________
 
  %> sudo ./sleepgraph.py -config config/suspend-proc.cfg
 
+------------------------------------------------------------------
+|                     ENDURANCE TESTING                          |
+------------------------------------------------------------------
+
+ The best way to gauge the health of a system is to run a series of
+ suspend/resumes over an extended period and analyze the behavior. This can be
+ accomplished with sleepgraph's -multi argument. You specify two numbers: the
+ number of tests to run OR the duration in days, hours, or minutes, and the
+ delay in seconds between them. For instance, -multi 20 5: execute 20 tests with
+ a 5 second delay between each, or -multi 24h 0: execute tests over a 24 hour
+ period with no delay between tests. You can include any other options you like
+ to generate the data you want. It's most useful to collect dev mode timelines
+ as the kprobes don't alter the performance much and you get more insight.
+
+ On completion, the output folder contains a series of folders for the
+ individual test data and a set of summary pages in the root. The summary.html
+ file is a tabular list of the tests with relevant info and links. The
+ summary-issue.html and summary-devices.html files include data taken from
+ all tests on kernel issues and device performance. The folder looks like this:
+
+  suspend-xN-{date}-{time}:
+       summary.html
+       summary-issues.html
+       summary-devices.html
+       suspend-{date}-{time} (1)
+       suspend-{date}-{time} (2)
+       ...
+
+ These are the relevant arguments to use for testing:
+
+  -m mode
+       Mode to initiate for suspend e.g. mem, freeze, standby (default: mem).
+
+  -rtcwake t
+       Use rtcwake to autoresume after t seconds (default: 15).
+
+  -gzip (optional)
+       Gzip the trace and dmesg logs to save space. The tool can also read in
+       gzipped logs for processing. This reduces the multitest folder size.
+
+  -dev (optional)
+       Add kernel source calls and threads to the timeline (default: disabled).
+
+  -multi n d
+       Execute n consecutive tests at d seconds intervals. The outputs will be
+       created in a new subdirectory: suspend-xN-{date}-{time}. When the multitest
+       run is done, the -summary command is called automatically to create summary
+       html files for all the data (unless you use -skiphtml). -skiphtml will
+       speed up the testing by not creating timelines or summary html files. You
+       can then run the tool again at a later time with -summary and -genhtml to
+       create the timelines.
+
+  -skiphtml (optional)
+       Run the test and capture the trace logs, but skip the timeline and summary
+       html generation. This can greatly speed up overall testing. You can then
+       copy the data to a faster host machine and run -summary -genhtml to
+       generate the timelines and summary.
+
+ These are the relevant commands to use after testing is complete:
+
+  -summary indir
+       Generate or regenerate the summary for a -multi test run. Creates three
+       files: summary.html, summary-issues.html, and summary-devices.html in the
+       current folder. summary.html is a table of tests with relevant info sorted
+       by kernel/host/mode, and links to the test html files. summary-issues.html
+       is a list of kernel issues found in dmesg from all the tests.
+       summary-devices.html is a list of devices and times from all the tests.
+
+  -genhtml
+       Used  with -summary to regenerate any missing html timelines from their
+       dmesg and ftrace logs. This will require a significant amount of time if
+       there are thousands of tests.
+
+Usage Examples
+_______________
+
+ A multitest is initiated like this:
+
+  %> sudo ./sleepgraph.py -m mem -rtcwake 10 -dev -gzip -multi 2000 0
+
+       or you can skip timeline generation in order to speed things up
+
+  %> sudo ./sleepgraph.py -m mem -rtcwake 10 -dev -gzip -multi 2000 0 -skiphtml
+
+ The tool will produce an output folder with all the test subfolders inside.
+ Each test subfolder contains the dmesg/ftrace logs and/or the html timeline
+ depending on whether you used the -skiphtml option. The root folder contains
+ the summary.html files.
+
+ The summary for an existing multitest is generated like this:
+
+  %> cd suspend-x2000-{date}-{time}
+  %> sleepgraph.py -summary .
+
+       or if you need to generate the html timelines you can use -genhtml
+
+  %> cd suspend-xN-{date}-{time}
+  %> sleepgraph.py -summary . -genhtml
 
 ------------------------------------------------------------------
 |                    CONFIGURATION FILES                         |
index d3b99a1..2823cd3 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python3
 # SPDX-License-Identifier: GPL-2.0-only
 #
 # Tool for analyzing boot timing
index 43aee64..5126271 100644 (file)
@@ -74,8 +74,10 @@ after the test is complete.
 Switch the display to the requested mode for the test using the xset command.
 This helps maintain the consistency of test data for better comparison.
 .TP
-\fB-skiphtml\fR
-Run the test and capture the trace logs, but skip the timeline generation.
+\fB-wifi\fR
+If a wifi connection is available, check that it reconnects after resume. Include
+the reconnect time in the total resume time calculation and treat wifi timeouts
+as resume failures.
 
 .SS "advanced"
 .TP
@@ -117,8 +119,24 @@ Include \fIt\fR ms delay before 1st suspend (default: 0 ms).
 Include \fIt\fR ms delay after last resume (default: 0 ms).
 .TP
 \fB-multi \fIn d\fR
-Execute \fIn\fR consecutive tests at \fId\fR seconds intervals. The outputs will
-be created in a new subdirectory with a summary page: suspend-xN-{date}-{time}.
+Used for endurance testing. If \fIn\fR is entirely numeric, it's treated as a count:
+Execute \fIn\fR consecutive tests at \fId\fR second intervals.
+If \fIn\fR is an integer followed by a "d", "h", or "m", it's treated as a duration:
+Execute tests continuously over \fIn\fR days, hours, or minutes at \fId\fR second intervals.
+The outputs will be created in a new subdirectory, for count: suspend-{date}-{time}-xN,
+for duration: suspend-{date}-{time}-Nm. When the multitest run is done, the \fI-summary\fR
+command is called automatically to create summary html files for all the data (unless you
+use \fI-skiphtml\fR). \fI-skiphtml\fR will speed up the testing by not creating timelines
+or summary html files. You can then run the tool again at a later time with \fI-summary\fR
+and \fI-genhtml\fR to create the timelines.
+.TP
+\fB-maxfail \fIn\fR
+Abort a -multi run after \fIn\fR consecutive fails. 0 means never abort (default = 0).
+.TP
+\fB-skiphtml\fR
+Run the test and capture the trace logs, but skip the timeline generation.
+You can generate the html timelines later with \fI-dmesg\fR & \fI-ftrace\fR, or
+by running \fI-summary\fR and \fI-genhtml\fR.
 
 .SS "ftrace debug"
 .TP
@@ -173,11 +191,20 @@ Set trace buffer size to N kilo-bytes (default: all of free memory up to 3GB)
 .SH COMMANDS
 .TP
 \fB-summary \fIindir\fR
-Create a summary page of all tests in \fIindir\fR. Creates summary.html
-in the current folder. The output page is a table of tests with
-suspend and resume values sorted by suspend mode, host, and kernel.
-Includes test averages by mode and links to the test html files.
-Use -genhtml to include tests with missing html.
+Create a set of summary pages for all tests in \fIindir\fR recursively.
+Creates summary.html, summary-issues.html, and summary-devices.html in the current folder.
+summary.html is a table of tests with relevant info sorted by kernel/host/mode,
+and links to the test html files. It identifies the minimum, maximum, and median
+suspend and resume times for you with highlights and links in the header.
+summary-issues.html is a list of kernel issues found in dmesg from all the tests.
+summary-devices.html is a list of devices and times from all the tests.
+
+Use \fI-genhtml\fR to regenerate any tests with missing html.
+.TP
+\fB-genhtml\fR
+Used with \fI-summary\fR to regenerate any missing html timelines from their
+dmesg and ftrace logs. This will require a significant amount of time if there
+are thousands of tests.
 .TP
 \fB-modes\fR
 List available suspend modes.
@@ -189,10 +216,7 @@ with any options you intend to use to see if they will work.
 \fB-fpdt\fR
 Print out the contents of the ACPI Firmware Performance Data Table.
 .TP
-\fB-battery\fR
-Print out battery status and current charge.
-.TP
-\fB-wifi\fR
+\fB-wificheck\fR
 Print out wifi status and connection details.
 .TP
 \fB-xon/-xoff/-xstandby/-xsuspend\fR
@@ -208,6 +232,9 @@ Print out system info extracted from BIOS. Reads /dev/mem directly instead of go
 \fB-devinfo\fR
 Print out the pm settings of all devices which support runtime suspend.
 .TP
+\fB-cmdinfo\fR
+Print out all the platform data collected from the system that makes it into the logs.
+.TP
 \fB-flist\fR
 Print the list of ftrace functions currently being captured. Functions
 that are not available as symbols in the current kernel are shown in red.
@@ -272,14 +299,20 @@ Run two suspends back to back, include a 500ms delay before, after, and in betwe
 .IP
 \f(CW$ sudo sleepgraph -m mem -rtcwake 15 -x2 -predelay 500 -x2delay 500 -postdelay 500\fR
 .PP
+Execute a suspend using a custom command.
+.IP
+\f(CW$ sudo sleepgraph -cmd "echo mem > /sys/power/state" -rtcwake 15\fR
+.PP
+
+.SS "endurance testing using -multi"
+.PP
 Do a batch run of 10 freezes with 30 seconds delay between runs.
 .IP
 \f(CW$ sudo sleepgraph -m freeze -rtcwake 15 -multi 10 30\fR
 .PP
-Execute a suspend using a custom command.
+Do a batch run of freezes for 24 hours.
 .IP
-\f(CW$ sudo sleepgraph -cmd "echo mem > /sys/power/state" -rtcwake 15\fR
-.PP
+\f(CW$ sudo sleepgraph -m freeze -rtcwake 15 -multi 24h 0\fR
 
 .SS "adding callgraph data"
 Add device callgraphs. Limit the trace depth and only show callgraphs 10ms or larger.
index f7d1c1f..9b0404d 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python3
 # SPDX-License-Identifier: GPL-2.0-only
 #
 # Tool for analyzing suspend/resume timing
@@ -58,7 +58,7 @@ import re
 import platform
 import signal
 import codecs
-from datetime import datetime
+from datetime import datetime, timedelta
 import struct
 import configparser
 import gzip
@@ -81,12 +81,13 @@ def ascii(text):
 #       store system values and test parameters
 class SystemValues:
        title = 'SleepGraph'
-       version = '5.5'
+       version = '5.6'
        ansi = False
        rs = 0
        display = ''
        gzip = False
        sync = False
+       wifi = False
        verbose = False
        testlog = True
        dmesglog = True
@@ -97,7 +98,8 @@ class SystemValues:
        cgphase = ''
        cgtest = -1
        cgskip = ''
-       multitest = {'run': False, 'count': 0, 'delay': 0}
+       maxfail = 0
+       multitest = {'run': False, 'count': 1000000, 'delay': 0}
        max_graph_depth = 0
        callloopmaxgap = 0.0001
        callloopmaxlen = 0.005
@@ -148,7 +150,7 @@ class SystemValues:
        x2delay = 0
        skiphtml = False
        usecallgraph = False
-       ftopfunc = 'suspend_devices_and_enter'
+       ftopfunc = 'pm_suspend'
        ftop = False
        usetraceevents = False
        usetracemarkers = True
@@ -164,6 +166,8 @@ class SystemValues:
        predelay = 0
        postdelay = 0
        pmdebug = ''
+       tmstart = 'SUSPEND START %Y%m%d-%H:%M:%S.%f'
+       tmend = 'RESUME COMPLETE %Y%m%d-%H:%M:%S.%f'
        tracefuncs = {
                'sys_sync': {},
                'ksys_sync': {},
@@ -183,9 +187,11 @@ class SystemValues:
                'acpi_s2idle_sync': {},
                'acpi_s2idle_begin': {},
                'acpi_s2idle_prepare': {},
+               'acpi_s2idle_prepare_late': {},
                'acpi_s2idle_wake': {},
                'acpi_s2idle_wakeup': {},
                'acpi_s2idle_restore': {},
+               'acpi_s2idle_restore_early': {},
                'hibernate_preallocate_memory': {},
                'create_basic_memory_bitmaps': {},
                'swsusp_write': {},
@@ -270,12 +276,23 @@ class SystemValues:
                'intel_opregion_init': {},
                'intel_fbdev_set_suspend': {},
        }
+       infocmds = [
+               [0, 'kparams', 'cat', '/proc/cmdline'],
+               [0, 'mcelog', 'mcelog'],
+               [0, 'pcidevices', 'lspci', '-tv'],
+               [0, 'usbdevices', 'lsusb', '-t'],
+               [1, 'interrupts', 'cat', '/proc/interrupts'],
+               [1, 'wakeups', 'cat', '/sys/kernel/debug/wakeup_sources'],
+               [2, 'gpecounts', 'sh', '-c', 'grep -v invalid /sys/firmware/acpi/interrupts/*'],
+               [2, 'suspendstats', 'sh', '-c', 'grep -v invalid /sys/power/suspend_stats/*'],
+               [2, 'cpuidle', 'sh', '-c', 'grep -v invalid /sys/devices/system/cpu/cpu*/cpuidle/state*/s2idle/*'],
+               [2, 'battery', 'sh', '-c', 'grep -v invalid /sys/class/power_supply/*/*'],
+       ]
        cgblacklist = []
        kprobes = dict()
        timeformat = '%.3f'
        cmdline = '%s %s' % \
                        (os.path.basename(sys.argv[0]), ' '.join(sys.argv[1:]))
-       kparams = ''
        sudouser = ''
        def __init__(self):
                self.archargs = 'args_'+platform.machine()
@@ -295,6 +312,9 @@ class SystemValues:
                if os.getuid() == 0 and 'SUDO_USER' in os.environ and \
                        os.environ['SUDO_USER']:
                        self.sudouser = os.environ['SUDO_USER']
+       def resetlog(self):
+               self.logmsg = ''
+               self.platinfo = []
        def vprint(self, msg):
                self.logmsg += msg+'\n'
                if self.verbose or msg.startswith('WARNING:'):
@@ -304,11 +324,11 @@ class SystemValues:
                        return
                signame = self.signames[signum] if signum in self.signames else 'UNKNOWN'
                msg = 'Signal %s caused a tool exit, line %d' % (signame, frame.f_lineno)
-               sysvals.outputResult({'error':msg})
+               self.outputResult({'error':msg})
                sys.exit(3)
        def signalHandlerInit(self):
                capture = ['BUS', 'SYS', 'XCPU', 'XFSZ', 'PWR', 'HUP', 'INT', 'QUIT',
-                       'ILL', 'ABRT', 'FPE', 'SEGV', 'TERM', 'TSTP']
+                       'ILL', 'ABRT', 'FPE', 'SEGV', 'TERM']
                self.signames = dict()
                for i in capture:
                        s = 'SIG'+i
@@ -336,6 +356,8 @@ class SystemValues:
                        self.outputResult({'error':msg})
                        sys.exit(1)
                return False
+       def usable(self, file):
+               return (os.path.exists(file) and os.path.getsize(file) > 0)
        def getExec(self, cmd):
                try:
                        fp = Popen(['which', cmd], stdout=PIPE, stderr=PIPE).stdout
@@ -389,12 +411,6 @@ class SystemValues:
                r = info['bios-release-date'] if 'bios-release-date' in info else ''
                self.sysstamp = '# sysinfo | man:%s | plat:%s | cpu:%s | bios:%s | biosdate:%s | numcpu:%d | memsz:%d | memfr:%d' % \
                        (m, p, c, b, r, self.cpucount, self.memtotal, self.memfree)
-               try:
-                       kcmd = open('/proc/cmdline', 'r').read().strip()
-               except:
-                       kcmd = ''
-               if kcmd:
-                       self.sysstamp += '\n# kparams | %s' % kcmd
        def printSystemInfo(self, fatal=False):
                self.rootCheck(True)
                out = dmidecode(self.mempath, fatal)
@@ -441,6 +457,7 @@ class SystemValues:
                        self.testdir+'/'+self.prefix+'_'+self.suspendmode+'.html'
                if not os.path.isdir(self.testdir):
                        os.makedirs(self.testdir)
+               self.sudoUserchown(self.testdir)
        def getValueList(self, value):
                out = []
                for i in value.split(','):
@@ -486,7 +503,7 @@ class SystemValues:
                fp.close()
                self.dmesgstart = float(ktime)
        def getdmesg(self, testdata):
-               op = self.writeDatafileHeader(sysvals.dmesgfile, testdata)
+               op = self.writeDatafileHeader(self.dmesgfile, testdata)
                # store all new dmesg lines since initdmesg was called
                fp = Popen('dmesg', stdout=PIPE).stdout
                for line in fp:
@@ -716,9 +733,10 @@ class SystemValues:
                        if name == f:
                                return True
                return False
-       def initFtrace(self):
-               self.printSystemInfo(False)
-               pprint('INITIALIZING FTRACE...')
+       def initFtrace(self, quiet=False):
+               if not quiet:
+                       sysvals.printSystemInfo(False)
+                       pprint('INITIALIZING FTRACE...')
                # turn trace off
                self.fsetVal('0', 'tracing_on')
                self.cleanupFtrace()
@@ -746,7 +764,7 @@ class SystemValues:
                        if tgtsize < 65536:
                                tgtsize = int(self.fgetVal('buffer_size_kb')) * cpus
                                break
-               pprint('Setting trace buffers to %d kB (%d kB per cpu)' % (tgtsize, tgtsize/cpus))
+               self.vprint('Setting trace buffers to %d kB (%d kB per cpu)' % (tgtsize, tgtsize/cpus))
                # initialize the callgraph trace
                if(self.usecallgraph):
                        # set trace type
@@ -782,7 +800,8 @@ class SystemValues:
                        if self.usedevsrc:
                                for name in self.dev_tracefuncs:
                                        self.defaultKprobe(name, self.dev_tracefuncs[name])
-                       pprint('INITIALIZING KPROBES...')
+                       if not quiet:
+                               pprint('INITIALIZING KPROBES...')
                        self.addKprobes(self.verbose)
                if(self.usetraceevents):
                        # turn trace events on
@@ -827,21 +846,10 @@ class SystemValues:
                                fw = test['fw']
                                if(fw):
                                        fp.write('# fwsuspend %u fwresume %u\n' % (fw[0], fw[1]))
-                       if 'mcelog' in test:
-                               fp.write('# mcelog %s\n' % test['mcelog'])
                        if 'turbo' in test:
                                fp.write('# turbostat %s\n' % test['turbo'])
-                       if 'bat' in test:
-                               (a1, c1), (a2, c2) = test['bat']
-                               fp.write('# battery %s %d %s %d\n' % (a1, c1, a2, c2))
                        if 'wifi' in test:
-                               wstr = []
-                               for wifi in test['wifi']:
-                                       tmp = []
-                                       for key in sorted(wifi):
-                                               tmp.append('%s:%s' % (key, wifi[key]))
-                                       wstr.append('|'.join(tmp))
-                               fp.write('# wifi %s\n' % (','.join(wstr)))
+                               fp.write('# wifi %s\n' % test['wifi'])
                        if test['error'] or len(testdata) > 1:
                                fp.write('# enter_sleep_error %s\n' % test['error'])
                return fp
@@ -901,23 +909,7 @@ class SystemValues:
        def b64zip(self, data):
                out = base64.b64encode(codecs.encode(data.encode(), 'zlib')).decode()
                return out
-       def mcelog(self, clear=False):
-               cmd = self.getExec('mcelog')
-               if not cmd:
-                       return ''
-               if clear:
-                       call(cmd+' > /dev/null 2>&1', shell=True)
-                       return ''
-               try:
-                       fp = Popen([cmd], stdout=PIPE, stderr=PIPE).stdout
-                       out = ascii(fp.read()).strip()
-                       fp.close()
-               except:
-                       return ''
-               if not out:
-                       return ''
-               return self.b64zip(out)
-       def platforminfo(self):
+       def platforminfo(self, cmdafter):
                # add platform info on to a completed ftrace file
                if not os.path.exists(self.ftracefile):
                        return False
@@ -1001,31 +993,76 @@ class SystemValues:
                footer += '# platform-devinfo: %s\n' % self.b64zip(out)
 
                # add a line for each of these commands with their outputs
-               cmds = [
-                       ['pcidevices', 'lspci', '-tv'],
-                       ['interrupts', 'cat', '/proc/interrupts'],
-                       ['gpecounts', 'sh', '-c', 'grep -v invalid /sys/firmware/acpi/interrupts/gpe*'],
-               ]
-               for cargs in cmds:
-                       name = cargs[0]
-                       cmdline = ' '.join(cargs[1:])
-                       cmdpath = self.getExec(cargs[1])
-                       if not cmdpath:
+               for name, cmdline, info in cmdafter:
+                       footer += '# platform-%s: %s | %s\n' % (name, cmdline, self.b64zip(info))
+
+               with self.openlog(self.ftracefile, 'a') as fp:
+                       fp.write(footer)
+               return True
+       def commonPrefix(self, list):
+               if len(list) < 2:
+                       return ''
+               prefix = list[0]
+               for s in list[1:]:
+                       while s[:len(prefix)] != prefix and prefix:
+                               prefix = prefix[:len(prefix)-1]
+                       if not prefix:
+                               break
+               if '/' in prefix and prefix[-1] != '/':
+                       prefix = prefix[0:prefix.rfind('/')+1]
+               return prefix
+       def dictify(self, text, format):
+               out = dict()
+               header = True if format == 1 else False
+               delim = ' ' if format == 1 else ':'
+               for line in text.split('\n'):
+                       if header:
+                               header, out['@'] = False, line
+                               continue
+                       line = line.strip()
+                       if delim in line:
+                               data = line.split(delim, 1)
+                               num = re.search(r'[\d]+', data[1])
+                               if format == 2 and num:
+                                       out[data[0].strip()] = num.group()
+                               else:
+                                       out[data[0].strip()] = data[1]
+               return out
+       def cmdinfo(self, begin, debug=False):
+               out = []
+               if begin:
+                       self.cmd1 = dict()
+               for cargs in self.infocmds:
+                       delta, name = cargs[0], cargs[1]
+                       cmdline, cmdpath = ' '.join(cargs[2:]), self.getExec(cargs[2])
+                       if not cmdpath or (begin and not delta):
                                continue
-                       cmd = [cmdpath] + cargs[2:]
                        try:
-                               fp = Popen(cmd, stdout=PIPE, stderr=PIPE).stdout
+                               fp = Popen([cmdpath]+cargs[3:], stdout=PIPE, stderr=PIPE).stdout
                                info = ascii(fp.read()).strip()
                                fp.close()
                        except:
                                continue
-                       if not info:
-                               continue
-                       footer += '# platform-%s: %s | %s\n' % (name, cmdline, self.b64zip(info))
-
-               with self.openlog(self.ftracefile, 'a') as fp:
-                       fp.write(footer)
-               return True
+                       if not debug and begin:
+                               self.cmd1[name] = self.dictify(info, delta)
+                       elif not debug and delta and name in self.cmd1:
+                               before, after = self.cmd1[name], self.dictify(info, delta)
+                               dinfo = ('\t%s\n' % before['@']) if '@' in before else ''
+                               prefix = self.commonPrefix(list(before.keys()))
+                               for key in sorted(before):
+                                       if key in after and before[key] != after[key]:
+                                               title = key.replace(prefix, '')
+                                               if delta == 2:
+                                                       dinfo += '\t%s : %s -> %s\n' % \
+                                                               (title, before[key].strip(), after[key].strip())
+                                               else:
+                                                       dinfo += '%10s (start) : %s\n%10s (after) : %s\n' % \
+                                                               (title, before[key], title, after[key])
+                               dinfo = '\tnothing changed' if not dinfo else dinfo.rstrip()
+                               out.append((name, cmdline, dinfo))
+                       else:
+                               out.append((name, cmdline, '\tnothing' if not info else info))
+               return out
        def haveTurbostat(self):
                if not self.tstat:
                        return False
@@ -1035,8 +1072,8 @@ class SystemValues:
                fp = Popen([cmd, '-v'], stdout=PIPE, stderr=PIPE).stderr
                out = ascii(fp.read()).strip()
                fp.close()
-               if re.match('turbostat version [0-9\.]* .*', out):
-                       sysvals.vprint(out)
+               if re.match('turbostat version .*', out):
+                       self.vprint(out)
                        return True
                return False
        def turbostat(self):
@@ -1056,11 +1093,11 @@ class SystemValues:
                fp.close()
                if not keyline or not valline or len(keyline) != len(valline):
                        errmsg = 'unrecognized turbostat output:\n'+rawout.strip()
-                       sysvals.vprint(errmsg)
-                       if not sysvals.verbose:
+                       self.vprint(errmsg)
+                       if not self.verbose:
                                pprint(errmsg)
                        return ''
-               if sysvals.verbose:
+               if self.verbose:
                        pprint(rawout.strip())
                out = []
                for key in keyline:
@@ -1068,30 +1105,36 @@ class SystemValues:
                        val = valline[idx]
                        out.append('%s=%s' % (key, val))
                return '|'.join(out)
-       def checkWifi(self):
-               out = dict()
-               iwcmd, ifcmd = self.getExec('iwconfig'), self.getExec('ifconfig')
-               if not iwcmd or not ifcmd:
-                       return out
-               fp = Popen(iwcmd, stdout=PIPE, stderr=PIPE).stdout
-               for line in fp:
-                       m = re.match('(?P<dev>\S*) .* ESSID:(?P<ess>\S*)', ascii(line))
-                       if not m:
+       def wifiDetails(self, dev):
+               try:
+                       info = open('/sys/class/net/%s/device/uevent' % dev, 'r').read().strip()
+               except:
+                       return dev
+               vals = [dev]
+               for prop in info.split('\n'):
+                       if prop.startswith('DRIVER=') or prop.startswith('PCI_ID='):
+                               vals.append(prop.split('=')[-1])
+               return ':'.join(vals)
+       def checkWifi(self, dev=''):
+               try:
+                       w = open('/proc/net/wireless', 'r').read().strip()
+               except:
+                       return ''
+               for line in reversed(w.split('\n')):
+                       m = re.match(' *(?P<dev>.*): (?P<stat>[0-9a-f]*) .*', w.split('\n')[-1])
+                       if not m or (dev and dev != m.group('dev')):
                                continue
-                       out['device'] = m.group('dev')
-                       if '"' in m.group('ess'):
-                               out['essid'] = m.group('ess').strip('"')
-                               break
-               fp.close()
-               if 'device' in out:
-                       fp = Popen([ifcmd, out['device']], stdout=PIPE, stderr=PIPE).stdout
-                       for line in fp:
-                               m = re.match('.* inet (?P<ip>[0-9\.]*)', ascii(line))
-                               if m:
-                                       out['ip'] = m.group('ip')
-                                       break
-                       fp.close()
-               return out
+                       return m.group('dev')
+               return ''
+       def pollWifi(self, dev, timeout=60):
+               start = time.time()
+               while (time.time() - start) < timeout:
+                       w = self.checkWifi(dev)
+                       if w:
+                               return '%s reconnected %.2f' % \
+                                       (self.wifiDetails(dev), max(0, time.time() - start))
+                       time.sleep(0.01)
+               return '%s timeout %d' % (self.wifiDetails(dev), timeout)
        def errorSummary(self, errinfo, msg):
                found = False
                for entry in errinfo:
@@ -1113,8 +1156,9 @@ class SystemValues:
                                arr[j] = arr[j]\
                                        .replace('\\', '\\\\').replace(']', '\]').replace('[', '\[')\
                                        .replace('.', '\.').replace('+', '\+').replace('*', '\*')\
-                                       .replace('(', '\(').replace(')', '\)')
-               mstr = ' '.join(arr)
+                                       .replace('(', '\(').replace(')', '\)').replace('}', '\}')\
+                                       .replace('{', '\{')
+               mstr = ' *'.join(arr)
                entry = {
                        'line': msg,
                        'match': mstr,
@@ -1122,6 +1166,44 @@ class SystemValues:
                        'urls': {self.hostname: [self.htmlfile]}
                }
                errinfo.append(entry)
+       def multistat(self, start, idx, finish):
+               if 'time' in self.multitest:
+                       id = '%d Duration=%dmin' % (idx+1, self.multitest['time'])
+               else:
+                       id = '%d/%d' % (idx+1, self.multitest['count'])
+               t = time.time()
+               if 'start' not in self.multitest:
+                       self.multitest['start'] = self.multitest['last'] = t
+                       self.multitest['total'] = 0.0
+                       pprint('TEST (%s) START' % id)
+                       return
+               dt = t - self.multitest['last']
+               if not start:
+                       if idx == 0 and self.multitest['delay'] > 0:
+                               self.multitest['total'] += self.multitest['delay']
+                       pprint('TEST (%s) COMPLETE -- Duration %.1fs' % (id, dt))
+                       return
+               self.multitest['total'] += dt
+               self.multitest['last'] = t
+               avg = self.multitest['total'] / idx
+               if 'time' in self.multitest:
+                       left = finish - datetime.now()
+                       left -= timedelta(microseconds=left.microseconds)
+               else:
+                       left = timedelta(seconds=((self.multitest['count'] - idx) * int(avg)))
+               pprint('TEST (%s) START - Avg Duration %.1fs, Time left %s' % \
+                       (id, avg, str(left)))
+       def multiinit(self, c, d):
+               sz, unit = 'count', 'm'
+               if c.endswith('d') or c.endswith('h') or c.endswith('m'):
+                       sz, unit, c = 'time', c[-1], c[:-1]
+               self.multitest['run'] = True
+               self.multitest[sz] = getArgInt('multi: n d (exec count)', c, 1, 1000000, False)
+               self.multitest['delay'] = getArgInt('multi: n d (delay between tests)', d, 0, 3600, False)
+               if unit == 'd':
+                       self.multitest[sz] *= 1440
+               elif unit == 'h':
+                       self.multitest[sz] *= 60
 
 sysvals = SystemValues()
 switchvalues = ['enable', 'disable', 'on', 'off', 'true', 'false', '1', '0']
@@ -1210,25 +1292,30 @@ class Data:
                'resume_complete': {'order': 9, 'color': '#FFFFCC'},
        }
        errlist = {
-               'HWERROR' : '.*\[ *Hardware Error *\].*',
-               'FWBUG'   : '.*\[ *Firmware Bug *\].*',
-               'BUG'     : '.*BUG.*',
-               'ERROR'   : '.*ERROR.*',
-               'WARNING' : '.*WARNING.*',
-               'IRQ'     : '.*genirq: .*',
-               'TASKFAIL': '.*Freezing of tasks *.*',
-               'ACPI'    : '.*ACPI *(?P<b>[A-Za-z]*) *Error[: ].*',
-               'DEVFAIL' : '.* failed to (?P<b>[a-z]*) async: .*',
-               'DISKFULL': '.*No space left on device.*',
-               'USBERR'  : '.*usb .*device .*, error [0-9-]*',
-               'ATAERR'  : ' *ata[0-9\.]*: .*failed.*',
-               'MEIERR'  : ' *mei.*: .*failed.*',
-               'TPMERR'  : '(?i) *tpm *tpm[0-9]*: .*error.*',
+               'HWERROR' : r'.*\[ *Hardware Error *\].*',
+               'FWBUG'   : r'.*\[ *Firmware Bug *\].*',
+               'BUG'     : r'(?i).*\bBUG\b.*',
+               'ERROR'   : r'(?i).*\bERROR\b.*',
+               'WARNING' : r'(?i).*\bWARNING\b.*',
+               'FAULT'   : r'(?i).*\bFAULT\b.*',
+               'FAIL'    : r'(?i).*\bFAILED\b.*',
+               'INVALID' : r'(?i).*\bINVALID\b.*',
+               'CRASH'   : r'(?i).*\bCRASHED\b.*',
+               'IRQ'     : r'.*\bgenirq: .*',
+               'TASKFAIL': r'.*Freezing of tasks *.*',
+               'ACPI'    : r'.*\bACPI *(?P<b>[A-Za-z]*) *Error[: ].*',
+               'DISKFULL': r'.*\bNo space left on device.*',
+               'USBERR'  : r'.*usb .*device .*, error [0-9-]*',
+               'ATAERR'  : r' *ata[0-9\.]*: .*failed.*',
+               'MEIERR'  : r' *mei.*: .*failed.*',
+               'TPMERR'  : r'(?i) *tpm *tpm[0-9]*: .*error.*',
        }
        def __init__(self, num):
                idchar = 'abcdefghij'
                self.start = 0.0 # test start
                self.end = 0.0   # test end
+               self.hwstart = 0 # rtc test start
+               self.hwend = 0   # rtc test end
                self.tSuspended = 0.0 # low-level suspend start
                self.tResumed = 0.0   # low-level resume start
                self.tKernSus = 0.0   # kernel level suspend start
@@ -1240,10 +1327,8 @@ class Data:
                self.stamp = 0
                self.outfile = ''
                self.kerror = False
-               self.battery = 0
-               self.wifi = 0
+               self.wifi = dict()
                self.turbostat = 0
-               self.mcelog = 0
                self.enterfail = ''
                self.currphase = ''
                self.pstl = dict()    # process timeline
@@ -1308,6 +1393,8 @@ class Data:
                                continue
                        dir = 'suspend' if t < self.tSuspended else 'resume'
                        msg = m.group('msg')
+                       if re.match('capability: warning: .*', msg):
+                               continue
                        for err in self.errlist:
                                if re.match(self.errlist[err], msg):
                                        list.append((msg, err, dir, t, i, i))
@@ -1316,17 +1403,26 @@ class Data:
                msglist = []
                for msg, type, dir, t, idx1, idx2 in list:
                        msglist.append(msg)
-                       sysvals.vprint('kernel %s found in %s at %f' % (type, dir, t))
                        self.errorinfo[dir].append((type, t, idx1, idx2))
                if self.kerror:
                        sysvals.dmesglog = True
                if len(self.dmesgtext) < 1 and sysvals.dmesgfile:
                        lf.close()
                return msglist
-       def setStart(self, time):
+       def setStart(self, time, msg=''):
                self.start = time
-       def setEnd(self, time):
+               if msg:
+                       try:
+                               self.hwstart = datetime.strptime(msg, sysvals.tmstart)
+                       except:
+                               self.hwstart = 0
+       def setEnd(self, time, msg=''):
                self.end = time
+               if msg:
+                       try:
+                               self.hwend = datetime.strptime(msg, sysvals.tmend)
+                       except:
+                               self.hwend = 0
        def isTraceEventOutsideDeviceCalls(self, pid, time):
                for phase in self.sortedPhases():
                        list = self.dmesg[phase]['list']
@@ -1546,6 +1642,14 @@ class Data:
                                        self.trimTime(tS, tL, left)
                                        self.tLow.append('%.0f'%(tL*1000))
                        lp = phase
+       def getMemTime(self):
+               if not self.hwstart or not self.hwend:
+                       return
+               stime = (self.tSuspended - self.start) * 1000000
+               rtime = (self.end - self.tResumed) * 1000000
+               hws = self.hwstart + timedelta(microseconds=stime)
+               hwr = self.hwend - timedelta(microseconds=rtime)
+               self.tLow.append('%.0f'%((hwr - hws).total_seconds() * 1000))
        def getTimeValues(self):
                sktime = (self.tSuspended - self.tKernSus) * 1000
                rktime = (self.tKernRes - self.tResumed) * 1000
@@ -1883,9 +1987,9 @@ class Data:
                        c = self.addProcessUsageEvent(ps, tres)
                        if c > 0:
                                sysvals.vprint('%25s (res): %d' % (ps, c))
-       def handleEndMarker(self, time):
+       def handleEndMarker(self, time, msg=''):
                dm = self.dmesg
-               self.setEnd(time)
+               self.setEnd(time, msg)
                self.initDevicegroups()
                # give suspend_prepare an end if needed
                if 'suspend_prepare' in dm and dm['suspend_prepare']['end'] < 0:
@@ -2071,7 +2175,7 @@ class FTraceLine:
                if not self.fevent:
                        return False
                if sysvals.usetracemarkers:
-                       if(self.name == 'SUSPEND START'):
+                       if(self.name.startswith('SUSPEND START')):
                                return True
                        return False
                else:
@@ -2084,7 +2188,7 @@ class FTraceLine:
                if not self.fevent:
                        return False
                if sysvals.usetracemarkers:
-                       if(self.name == 'RESUME COMPLETE'):
+                       if(self.name.startswith('RESUME COMPLETE')):
                                return True
                        return False
                else:
@@ -2444,7 +2548,7 @@ class Timeline:
        def createHeader(self, sv, stamp):
                if(not stamp['time']):
                        return
-               self.html += '<div class="version"><a href="https://01.org/suspendresume">%s v%s</a></div>' \
+               self.html += '<div class="version"><a href="https://01.org/pm-graph">%s v%s</a></div>' \
                        % (sv.title, sv.version)
                if sv.logmsg and sv.testlog:
                        self.html += '<button id="showtest" class="logbtn btnfmt">log</button>'
@@ -2670,14 +2774,11 @@ class TestProps:
        stampfmt = '# [a-z]*-(?P<m>[0-9]{2})(?P<d>[0-9]{2})(?P<y>[0-9]{2})-'+\
                                '(?P<H>[0-9]{2})(?P<M>[0-9]{2})(?P<S>[0-9]{2})'+\
                                ' (?P<host>.*) (?P<mode>.*) (?P<kernel>.*)$'
-       batteryfmt = '^# battery (?P<a1>\w*) (?P<c1>\d*) (?P<a2>\w*) (?P<c2>\d*)'
-       wififmt    = '^# wifi (?P<w>.*)'
+       wififmt    = '^# wifi *(?P<d>\S*) *(?P<s>\S*) *(?P<t>[0-9\.]+).*'
        tstatfmt   = '^# turbostat (?P<t>\S*)'
-       mcelogfmt  = '^# mcelog (?P<m>\S*)'
        testerrfmt = '^# enter_sleep_error (?P<e>.*)'
        sysinfofmt = '^# sysinfo .*'
        cmdlinefmt = '^# command \| (?P<cmd>.*)'
-       kparamsfmt = '^# kparams \| (?P<kp>.*)'
        devpropfmt = '# Device Properties: .*'
        pinfofmt   = '# platform-(?P<val>[a-z,A-Z,0-9]*): (?P<info>.*)'
        tracertypefmt = '# tracer: (?P<t>.*)'
@@ -2695,11 +2796,8 @@ class TestProps:
                self.stamp = ''
                self.sysinfo = ''
                self.cmdline = ''
-               self.kparams = ''
                self.testerror = []
-               self.mcelog = []
                self.turbostat = []
-               self.battery = []
                self.wifi = []
                self.fwdata = []
                self.ftrace_line_fmt = self.ftrace_line_fmt_nop
@@ -2721,21 +2819,12 @@ class TestProps:
                elif re.match(self.sysinfofmt, line):
                        self.sysinfo = line
                        return True
-               elif re.match(self.kparamsfmt, line):
-                       self.kparams = line
-                       return True
                elif re.match(self.cmdlinefmt, line):
                        self.cmdline = line
                        return True
-               elif re.match(self.mcelogfmt, line):
-                       self.mcelog.append(line)
-                       return True
                elif re.match(self.tstatfmt, line):
                        self.turbostat.append(line)
                        return True
-               elif re.match(self.batteryfmt, line):
-                       self.battery.append(line)
-                       return True
                elif re.match(self.wififmt, line):
                        self.wifi.append(line)
                        return True
@@ -2749,6 +2838,8 @@ class TestProps:
        def parseStamp(self, data, sv):
                # global test data
                m = re.match(self.stampfmt, self.stamp)
+               if not self.stamp or not m:
+                       doError('data does not include the expected stamp')
                data.stamp = {'time': '', 'host': '', 'mode': ''}
                dt = datetime(int(m.group('y'))+2000, int(m.group('m')),
                        int(m.group('d')), int(m.group('H')), int(m.group('M')),
@@ -2780,10 +2871,6 @@ class TestProps:
                m = re.match(self.cmdlinefmt, self.cmdline)
                if m:
                        sv.cmdline = m.group('cmd')
-               if self.kparams:
-                       m = re.match(self.kparamsfmt, self.kparams)
-                       if m:
-                               sv.kparams = m.group('kp')
                if not sv.stamp:
                        sv.stamp = data.stamp
                # firmware data
@@ -2793,26 +2880,18 @@ class TestProps:
                                data.fwSuspend, data.fwResume = int(m.group('s')), int(m.group('r'))
                                if(data.fwSuspend > 0 or data.fwResume > 0):
                                        data.fwValid = True
-               # mcelog data
-               if len(self.mcelog) > data.testnumber:
-                       m = re.match(self.mcelogfmt, self.mcelog[data.testnumber])
-                       if m:
-                               data.mcelog = sv.b64unzip(m.group('m'))
                # turbostat data
                if len(self.turbostat) > data.testnumber:
                        m = re.match(self.tstatfmt, self.turbostat[data.testnumber])
                        if m:
                                data.turbostat = m.group('t')
-               # battery data
-               if len(self.battery) > data.testnumber:
-                       m = re.match(self.batteryfmt, self.battery[data.testnumber])
-                       if m:
-                               data.battery = m.groups()
                # wifi data
                if len(self.wifi) > data.testnumber:
                        m = re.match(self.wififmt, self.wifi[data.testnumber])
                        if m:
-                               data.wifi = m.group('w')
+                               data.wifi = {'dev': m.group('d'), 'stat': m.group('s'),
+                                       'time': float(m.group('t'))}
+                               data.stamp['wifi'] = m.group('d')
                # sleep mode enter errors
                if len(self.testerror) > data.testnumber:
                        m = re.match(self.testerrfmt, self.testerror[data.testnumber])
@@ -3012,13 +3091,13 @@ def appendIncompleteTraceLog(testruns):
                if(t.startMarker()):
                        data = testrun[testidx].data
                        tp.parseStamp(data, sysvals)
-                       data.setStart(t.time)
+                       data.setStart(t.time, t.name)
                        continue
                if(not data):
                        continue
                # find the end of resume
                if(t.endMarker()):
-                       data.setEnd(t.time)
+                       data.setEnd(t.time, t.name)
                        testidx += 1
                        if(testidx >= testcnt):
                                break
@@ -3081,7 +3160,7 @@ def parseTraceLog(live=False):
                doError('%s does not exist' % sysvals.ftracefile)
        if not live:
                sysvals.setupAllKprobes()
-       ksuscalls = ['pm_prepare_console']
+       ksuscalls = ['ksys_sync', 'pm_prepare_console']
        krescalls = ['pm_restore_console']
        tracewatch = ['irq_wakeup']
        if sysvals.usekprobes:
@@ -3094,7 +3173,7 @@ def parseTraceLog(live=False):
        testruns = []
        testdata = []
        testrun = 0
-       data = 0
+       data, limbo = 0, True
        tf = sysvals.openlog(sysvals.ftracefile, 'r')
        phase = 'suspend_prepare'
        for line in tf:
@@ -3141,16 +3220,16 @@ def parseTraceLog(live=False):
                        continue
                # find the start of suspend
                if(t.startMarker()):
-                       data = Data(len(testdata))
+                       data, limbo = Data(len(testdata)), False
                        testdata.append(data)
                        testrun = TestRun(data)
                        testruns.append(testrun)
                        tp.parseStamp(data, sysvals)
-                       data.setStart(t.time)
+                       data.setStart(t.time, t.name)
                        data.first_suspend_prepare = True
                        phase = data.setPhase('suspend_prepare', t.time, True)
                        continue
-               if(not data):
+               if(not data or limbo):
                        continue
                # process cpu exec line
                if t.type == 'tracing_mark_write':
@@ -3167,14 +3246,16 @@ def parseTraceLog(live=False):
                                continue
                # find the end of resume
                if(t.endMarker()):
-                       data.handleEndMarker(t.time)
+                       if data.tKernRes == 0:
+                               data.tKernRes = t.time
+                       data.handleEndMarker(t.time, t.name)
                        if(not sysvals.usetracemarkers):
                                # no trace markers? then quit and be sure to finish recording
                                # the event we used to trigger resume end
                                if('thaw_processes' in testrun.ttemp and len(testrun.ttemp['thaw_processes']) > 0):
                                        # if an entry exists, assume this is its end
                                        testrun.ttemp['thaw_processes'][-1]['end'] = t.time
-                               break
+                       limbo = True
                        continue
                # trace event processing
                if(t.fevent):
@@ -3197,7 +3278,7 @@ def parseTraceLog(live=False):
                                # -- phase changes --
                                # start of kernel suspend
                                if(re.match('suspend_enter\[.*', t.name)):
-                                       if(isbegin):
+                                       if(isbegin and data.tKernSus == 0):
                                                data.tKernSus = t.time
                                        continue
                                # suspend_prepare start
@@ -3225,7 +3306,7 @@ def parseTraceLog(live=False):
                                elif(re.match('machine_suspend\[.*', t.name)):
                                        if(isbegin):
                                                lp = data.lastPhase()
-                                               if lp == 'resume_machine':
+                                               if lp.startswith('resume_machine'):
                                                        data.dmesg[lp]['end'] = t.time
                                                phase = data.setPhase('suspend_machine', data.dmesg[lp]['end'], True)
                                                data.setPhase(phase, t.time, False)
@@ -3320,7 +3401,8 @@ def parseTraceLog(live=False):
                                        'proc': m_proc,
                                })
                                # start of kernel resume
-                               if(phase == 'suspend_prepare' and kprobename in ksuscalls):
+                               if(data.tKernSus == 0 and phase == 'suspend_prepare' \
+                                       and kprobename in ksuscalls):
                                        data.tKernSus = t.time
                        elif(t.freturn):
                                if(key not in tp.ktemp) or len(tp.ktemp[key]) < 1:
@@ -3355,7 +3437,7 @@ def parseTraceLog(live=False):
                sysvals.vprint('WARNING: ftrace start marker is missing')
        if data and not data.devicegroups:
                sysvals.vprint('WARNING: ftrace end marker is missing')
-               data.handleEndMarker(t.time)
+               data.handleEndMarker(t.time, t.name)
 
        if sysvals.suspendmode == 'command':
                for test in testruns:
@@ -3476,6 +3558,10 @@ def parseTraceLog(live=False):
                                        data.fwValid = False
                                sysvals.vprint('WARNING: phase "%s" is missing!' % p)
                        lp = p
+               if not terr and 'dev' in data.wifi and data.wifi['stat'] == 'timeout':
+                       terr = '%s%s failed in wifi_resume <i>(%s %.0fs timeout)</i>' % \
+                               (sysvals.suspendmode, tn, data.wifi['dev'], data.wifi['time'])
+                       error.append(terr)
                if not terr and data.enterfail:
                        pprint('test%s FAILED: enter %s failed with %s' % (tn, sysvals.suspendmode, data.enterfail))
                        terr = 'test%s failed to enter %s mode' % (tn, sysvals.suspendmode)
@@ -3933,7 +4019,7 @@ def createHTMLSummarySimple(testruns, htmlfile, title):
        tAvg, tMin, tMax, tMed = [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [dict(), dict()]
        iMin, iMed, iMax = [0, 0], [0, 0], [0, 0]
        num = 0
-       useturbo = False
+       useturbo = usewifi = False
        lastmode = ''
        cnt = dict()
        for data in sorted(testruns, key=lambda v:(v['mode'], v['host'], v['kernel'], v['time'])):
@@ -3952,17 +4038,17 @@ def createHTMLSummarySimple(testruns, htmlfile, title):
                        tAvg, tMin, tMax, tMed = [0.0, 0.0], [0.0, 0.0], [0.0, 0.0], [dict(), dict()]
                        iMin, iMed, iMax = [0, 0], [0, 0], [0, 0]
                        num = 0
-               pkgpc10 = syslpi = ''
+               pkgpc10 = syslpi = wifi = ''
                if 'pkgpc10' in data and 'syslpi' in data:
-                       pkgpc10 = data['pkgpc10']
-                       syslpi = data['syslpi']
-                       useturbo = True
+                       pkgpc10, syslpi, useturbo = data['pkgpc10'], data['syslpi'], True
+               if 'wifi' in data:
+                       wifi, usewifi = data['wifi'], True
                res = data['result']
                tVal = [float(data['suspend']), float(data['resume'])]
                list[mode]['data'].append([data['host'], data['kernel'],
                        data['time'], tVal[0], tVal[1], data['url'], res,
                        data['issues'], data['sus_worst'], data['sus_worsttime'],
-                       data['res_worst'], data['res_worsttime'], pkgpc10, syslpi])
+                       data['res_worst'], data['res_worsttime'], pkgpc10, syslpi, wifi])
                idx = len(list[mode]['data']) - 1
                if res.startswith('fail in'):
                        res = 'fail'
@@ -4002,7 +4088,12 @@ def createHTMLSummarySimple(testruns, htmlfile, title):
        td = '\t<td>{0}</td>\n'
        tdh = '\t<td{1}>{0}</td>\n'
        tdlink = '\t<td><a href="{0}">html</a></td>\n'
-       colspan = '14' if useturbo else '12'
+       cols = 12
+       if useturbo:
+               cols += 2
+       if usewifi:
+               cols += 1
+       colspan = '%d' % cols
 
        # table header
        html += '<table>\n<tr>\n' + th.format('#') +\
@@ -4013,6 +4104,8 @@ def createHTMLSummarySimple(testruns, htmlfile, title):
                th.format('Worst Resume Device') + th.format('RD Time')
        if useturbo:
                html += th.format('PkgPC10') + th.format('SysLPI')
+       if usewifi:
+               html += th.format('Wifi')
        html += th.format('Detail')+'</tr>\n'
        # export list into html
        head = '<tr class="head"><td>{0}</td><td>{1}</td>'+\
@@ -4076,6 +4169,8 @@ def createHTMLSummarySimple(testruns, htmlfile, title):
                        if useturbo:
                                html += td.format(d[12])                                                                # pkg_pc10
                                html += td.format(d[13])                                                                # syslpi
+                       if usewifi:
+                               html += td.format(d[14])                                                                # wifi
                        html += tdlink.format(d[5]) if d[5] else td.format('')          # url
                        html += '</tr>\n'
                        num += 1
@@ -4224,6 +4319,8 @@ def createHTML(testruns, testfail):
                        kerror = True
                if(sysvals.suspendmode in ['freeze', 'standby']):
                        data.trimFreezeTime(testruns[-1].tSuspended)
+               else:
+                       data.getMemTime()
 
        # html function templates
        html_error = '<div id="{1}" title="kernel error/warning" class="err" style="right:{0}%">{2}&rarr;</div>\n'
@@ -4242,13 +4339,10 @@ def createHTML(testruns, testfail):
                '<td class="green">Execution Time: <b>{0} ms</b></td>'\
                '<td class="yellow">Command: <b>{1}</b></td>'\
                '</tr>\n</table>\n'
-       html_timegroups = '<table class="time2">\n<tr>'\
-               '<td class="green" title="time from kernel enter_state({5}) to firmware mode [kernel time only]">{4}Kernel Suspend: {0} ms</td>'\
-               '<td class="purple">{4}Firmware Suspend: {1} ms</td>'\
-               '<td class="purple">{4}Firmware Resume: {2} ms</td>'\
-               '<td class="yellow" title="time from firmware mode to return from kernel enter_state({5}) [kernel time only]">{4}Kernel Resume: {3} ms</td>'\
-               '</tr>\n</table>\n'
        html_fail = '<table class="testfail"><tr><td>{0}</td></tr></table>\n'
+       html_kdesc = '<td class="{3}" title="time spent in kernel execution">{0}Kernel {2}: {1} ms</td>'
+       html_fwdesc = '<td class="{3}" title="time spent in firmware">{0}Firmware {2}: {1} ms</td>'
+       html_wifdesc = '<td class="yellow" title="time for wifi to reconnect after resume complete ({2})">{0}Wifi Resume: {1}</td>'
 
        # html format variables
        scaleH = 20
@@ -4264,13 +4358,10 @@ def createHTML(testruns, testfail):
        # Generate the header for this timeline
        for data in testruns:
                tTotal = data.end - data.start
-               sktime, rktime = data.getTimeValues()
                if(tTotal == 0):
                        doError('No timeline data')
-               if(len(data.tLow) > 0):
-                       low_time = '+'.join(data.tLow)
                if sysvals.suspendmode == 'command':
-                       run_time = '%.0f'%((data.end-data.start)*1000)
+                       run_time = '%.0f' % (tTotal * 1000)
                        if sysvals.testcommand:
                                testdesc = sysvals.testcommand
                        else:
@@ -4279,43 +4370,55 @@ def createHTML(testruns, testfail):
                                testdesc = ordinal(data.testnumber+1)+' '+testdesc
                        thtml = html_timetotal3.format(run_time, testdesc)
                        devtl.html += thtml
-               elif data.fwValid:
-                       suspend_time = '%.0f'%(sktime + (data.fwSuspend/1000000.0))
-                       resume_time = '%.0f'%(rktime + (data.fwResume/1000000.0))
-                       testdesc1 = 'Total'
-                       testdesc2 = ''
-                       stitle = 'time from kernel enter_state(%s) to low-power mode [kernel & firmware time]' % sysvals.suspendmode
-                       rtitle = 'time from low-power mode to return from kernel enter_state(%s) [firmware & kernel time]' % sysvals.suspendmode
-                       if(len(testruns) > 1):
-                               testdesc1 = testdesc2 = ordinal(data.testnumber+1)
-                               testdesc2 += ' '
-                       if(len(data.tLow) == 0):
-                               thtml = html_timetotal.format(suspend_time, \
-                                       resume_time, testdesc1, stitle, rtitle)
-                       else:
-                               thtml = html_timetotal2.format(suspend_time, low_time, \
-                                       resume_time, testdesc1, stitle, rtitle)
-                       devtl.html += thtml
+                       continue
+               # typical full suspend/resume header
+               stot, rtot = sktime, rktime = data.getTimeValues()
+               ssrc, rsrc, testdesc, testdesc2 = ['kernel'], ['kernel'], 'Kernel', ''
+               if data.fwValid:
+                       stot += (data.fwSuspend/1000000.0)
+                       rtot += (data.fwResume/1000000.0)
+                       ssrc.append('firmware')
+                       rsrc.append('firmware')
+                       testdesc = 'Total'
+               if 'time' in data.wifi and data.wifi['stat'] != 'timeout':
+                       rtot += data.end - data.tKernRes + (data.wifi['time'] * 1000.0)
+                       rsrc.append('wifi')
+                       testdesc = 'Total'
+               suspend_time, resume_time = '%.3f' % stot, '%.3f' % rtot
+               stitle = 'time from kernel suspend start to %s mode [%s time]' % \
+                       (sysvals.suspendmode, ' & '.join(ssrc))
+               rtitle = 'time from %s mode to kernel resume complete [%s time]' % \
+                       (sysvals.suspendmode, ' & '.join(rsrc))
+               if(len(testruns) > 1):
+                       testdesc = testdesc2 = ordinal(data.testnumber+1)
+                       testdesc2 += ' '
+               if(len(data.tLow) == 0):
+                       thtml = html_timetotal.format(suspend_time, \
+                               resume_time, testdesc, stitle, rtitle)
+               else:
+                       low_time = '+'.join(data.tLow)
+                       thtml = html_timetotal2.format(suspend_time, low_time, \
+                               resume_time, testdesc, stitle, rtitle)
+               devtl.html += thtml
+               if not data.fwValid and 'dev' not in data.wifi:
+                       continue
+               # extra detail when the times come from multiple sources
+               thtml = '<table class="time2">\n<tr>'
+               thtml += html_kdesc.format(testdesc2, '%.3f'%sktime, 'Suspend', 'green')
+               if data.fwValid:
                        sftime = '%.3f'%(data.fwSuspend / 1000000.0)
                        rftime = '%.3f'%(data.fwResume / 1000000.0)
-                       devtl.html += html_timegroups.format('%.3f'%sktime, \
-                               sftime, rftime, '%.3f'%rktime, testdesc2, sysvals.suspendmode)
-               else:
-                       suspend_time = '%.3f' % sktime
-                       resume_time = '%.3f' % rktime
-                       testdesc = 'Kernel'
-                       stitle = 'time from kernel enter_state(%s) to firmware mode [kernel time only]' % sysvals.suspendmode
-                       rtitle = 'time from firmware mode to return from kernel enter_state(%s) [kernel time only]' % sysvals.suspendmode
-                       if(len(testruns) > 1):
-                               testdesc = ordinal(data.testnumber+1)+' '+testdesc
-                       if(len(data.tLow) == 0):
-                               thtml = html_timetotal.format(suspend_time, \
-                                       resume_time, testdesc, stitle, rtitle)
+                       thtml += html_fwdesc.format(testdesc2, sftime, 'Suspend', 'green')
+                       thtml += html_fwdesc.format(testdesc2, rftime, 'Resume', 'yellow')
+               thtml += html_kdesc.format(testdesc2, '%.3f'%rktime, 'Resume', 'yellow')
+               if 'time' in data.wifi:
+                       if data.wifi['stat'] != 'timeout':
+                               wtime = '%.0f ms'%(data.end - data.tKernRes + (data.wifi['time'] * 1000.0))
                        else:
-                               thtml = html_timetotal2.format(suspend_time, low_time, \
-                                       resume_time, testdesc, stitle, rtitle)
-                       devtl.html += thtml
-
+                               wtime = 'TIMEOUT'
+                       thtml += html_wifdesc.format(testdesc2, wtime, data.wifi['dev'])
+               thtml += '</tr>\n</table>\n'
+               devtl.html += thtml
        if testfail:
                devtl.html += html_fail.format(testfail)
 
@@ -5082,28 +5185,32 @@ def setRuntimeSuspend(before=True):
 # Description:
 #       Execute system suspend through the sysfs interface, then copy the output
 #       dmesg and ftrace files to the test output directory.
-def executeSuspend():
+def executeSuspend(quiet=False):
        pm = ProcessMonitor()
        tp = sysvals.tpath
-       wifi = sysvals.checkWifi()
+       if sysvals.wifi:
+               wifi = sysvals.checkWifi()
        testdata = []
-       battery = True if getBattery() else False
        # run these commands to prepare the system for suspend
        if sysvals.display:
-               pprint('SET DISPLAY TO %s' % sysvals.display.upper())
+               if not quiet:
+                       pprint('SET DISPLAY TO %s' % sysvals.display.upper())
                displayControl(sysvals.display)
                time.sleep(1)
        if sysvals.sync:
-               pprint('SYNCING FILESYSTEMS')
+               if not quiet:
+                       pprint('SYNCING FILESYSTEMS')
                call('sync', shell=True)
        # mark the start point in the kernel ring buffer just as we start
        sysvals.initdmesg()
        # start ftrace
        if(sysvals.usecallgraph or sysvals.usetraceevents):
-               pprint('START TRACING')
+               if not quiet:
+                       pprint('START TRACING')
                sysvals.fsetVal('1', 'tracing_on')
                if sysvals.useprocmon:
                        pm.start()
+       sysvals.cmdinfo(True)
        # execute however many s/r runs requested
        for count in range(1,sysvals.execcount+1):
                # x2delay in between test runs
@@ -5119,15 +5226,14 @@ def executeSuspend():
                                pprint('SUSPEND START')
                        else:
                                pprint('SUSPEND START (press a key to resume)')
-               sysvals.mcelog(True)
-               bat1 = getBattery() if battery else False
                # set rtcwake
                if(sysvals.rtcwake):
-                       pprint('will issue an rtcwake in %d seconds' % sysvals.rtcwaketime)
+                       if not quiet:
+                               pprint('will issue an rtcwake in %d seconds' % sysvals.rtcwaketime)
                        sysvals.rtcWakeAlarmOn()
                # start of suspend trace marker
                if(sysvals.usecallgraph or sysvals.usetraceevents):
-                       sysvals.fsetVal('SUSPEND START', 'trace_marker')
+                       sysvals.fsetVal(datetime.now().strftime(sysvals.tmstart), 'trace_marker')
                # predelay delay
                if(count == 1 and sysvals.predelay > 0):
                        sysvals.fsetVal('WAIT %d' % sysvals.predelay, 'trace_marker')
@@ -5174,37 +5280,33 @@ def executeSuspend():
                # return from suspend
                pprint('RESUME COMPLETE')
                if(sysvals.usecallgraph or sysvals.usetraceevents):
-                       sysvals.fsetVal('RESUME COMPLETE', 'trace_marker')
+                       sysvals.fsetVal(datetime.now().strftime(sysvals.tmend), 'trace_marker')
+               if sysvals.wifi and wifi:
+                       tdata['wifi'] = sysvals.pollWifi(wifi)
                if(sysvals.suspendmode == 'mem' or sysvals.suspendmode == 'command'):
                        tdata['fw'] = getFPDT(False)
-               mcelog = sysvals.mcelog()
-               if mcelog:
-                       tdata['mcelog'] = mcelog
-               bat2 = getBattery() if battery else False
-               if battery and bat1 and bat2:
-                       tdata['bat'] = (bat1, bat2)
-               if 'device' in wifi and 'ip' in wifi:
-                       tdata['wifi'] = (wifi, sysvals.checkWifi())
                testdata.append(tdata)
+       cmdafter = sysvals.cmdinfo(False)
        # stop ftrace
        if(sysvals.usecallgraph or sysvals.usetraceevents):
                if sysvals.useprocmon:
                        pm.stop()
                sysvals.fsetVal('0', 'tracing_on')
        # grab a copy of the dmesg output
-       pprint('CAPTURING DMESG')
+       if not quiet:
+               pprint('CAPTURING DMESG')
        sysvals.getdmesg(testdata)
        # grab a copy of the ftrace output
        if(sysvals.usecallgraph or sysvals.usetraceevents):
-               pprint('CAPTURING TRACE')
+               if not quiet:
+                       pprint('CAPTURING TRACE')
                op = sysvals.writeDatafileHeader(sysvals.ftracefile, testdata)
                fp = open(tp+'trace', 'r')
                for line in fp:
                        op.write(line)
                op.close()
                sysvals.fsetVal('', 'trace')
-               sysvals.platforminfo()
-       return testdata
+               sysvals.platforminfo(cmdafter)
 
 def readFile(file):
        if os.path.islink(file):
@@ -5447,25 +5549,6 @@ def dmidecode(mempath, fatal=False):
                count += 1
        return out
 
-def getBattery():
-       p, charge, bat = '/sys/class/power_supply', 0, {}
-       if not os.path.exists(p):
-               return False
-       for d in os.listdir(p):
-               type = sysvals.getVal(os.path.join(p, d, 'type')).strip().lower()
-               if type != 'battery':
-                       continue
-               for v in ['status', 'energy_now', 'capacity_now']:
-                       bat[v] = sysvals.getVal(os.path.join(p, d, v)).strip().lower()
-               break
-       if 'status' not in bat:
-               return False
-       ac = False if 'discharging' in bat['status'] else True
-       for v in ['energy_now', 'capacity_now']:
-               if v in bat and bat[v]:
-                       charge = int(bat[v])
-       return (ac, charge)
-
 def displayControl(cmd):
        xset, ret = 'timeout 10 xset -d :0.0 {0}', 0
        if sysvals.sudouser:
@@ -5715,6 +5798,17 @@ def statusCheck(probecheck=False):
                status = 'rtcwake is not properly supported'
        pprint('    is rtcwake supported: %s' % res)
 
+       # check info commands
+       pprint('    optional commands this tool may use for info:')
+       no = sysvals.colorText('MISSING')
+       yes = sysvals.colorText('FOUND', 32)
+       for c in ['turbostat', 'mcelog', 'lspci', 'lsusb']:
+               if c == 'turbostat':
+                       res = yes if sysvals.haveTurbostat() else no
+               else:
+                       res = yes if sysvals.getExec(c) else no
+               pprint('        %s: %s' % (c, res))
+
        if not probecheck:
                return status
 
@@ -5780,8 +5874,9 @@ def getArgFloat(name, args, min, max, main=True):
                doError(name+': value should be between %f and %f' % (min, max), True)
        return val
 
-def processData(live=False):
-       pprint('PROCESSING DATA')
+def processData(live=False, quiet=False):
+       if not quiet:
+               pprint('PROCESSING DATA')
        sysvals.vprint('usetraceevents=%s, usetracemarkers=%s, usekprobes=%s' % \
                (sysvals.usetraceevents, sysvals.usetracemarkers, sysvals.usekprobes))
        error = ''
@@ -5796,20 +5891,17 @@ def processData(live=False):
                        parseKernelLog(data)
                if(sysvals.ftracefile and (sysvals.usecallgraph or sysvals.usetraceevents)):
                        appendIncompleteTraceLog(testruns)
+       if not sysvals.stamp:
+               pprint('ERROR: data does not include the expected stamp')
+               return (testruns, {'error': 'timeline generation failed'})
        shown = ['bios', 'biosdate', 'cpu', 'host', 'kernel', 'man', 'memfr',
-                       'memsz', 'mode', 'numcpu', 'plat', 'time']
+                       'memsz', 'mode', 'numcpu', 'plat', 'time', 'wifi']
        sysvals.vprint('System Info:')
        for key in sorted(sysvals.stamp):
                if key in shown:
                        sysvals.vprint('    %-8s : %s' % (key.upper(), sysvals.stamp[key]))
-       if sysvals.kparams:
-               sysvals.vprint('Kparams:\n    %s' % sysvals.kparams)
        sysvals.vprint('Command:\n    %s' % sysvals.cmdline)
        for data in testruns:
-               if data.mcelog:
-                       sysvals.vprint('MCELOG Data:')
-                       for line in data.mcelog.split('\n'):
-                               sysvals.vprint('    %s' % line)
                if data.turbostat:
                        idx, s = 0, 'Turbostat:\n    '
                        for val in data.turbostat.split('|'):
@@ -5819,23 +5911,13 @@ def processData(live=False):
                                        s += '\n    '
                                s += val + ' '
                        sysvals.vprint(s)
-               if data.battery:
-                       a1, c1, a2, c2 = data.battery
-                       s = 'Battery:\n    Before - AC: %s, Charge: %d\n     After - AC: %s, Charge: %d' % \
-                               (a1, int(c1), a2, int(c2))
-                       sysvals.vprint(s)
-               if data.wifi:
-                       w = data.wifi.replace('|', ' ').split(',')
-                       s = 'Wifi:\n    Before %s\n     After %s' % \
-                               (w[0], w[1])
-                       sysvals.vprint(s)
                data.printDetails()
-               if len(sysvals.platinfo) > 0:
-                       sysvals.vprint('\nPlatform Info:')
-                       for info in sysvals.platinfo:
-                               sysvals.vprint(info[0]+' - '+info[1])
-                               sysvals.vprint(info[2])
-                       sysvals.vprint('')
+       if len(sysvals.platinfo) > 0:
+               sysvals.vprint('\nPlatform Info:')
+               for info in sysvals.platinfo:
+                       sysvals.vprint('[%s - %s]' % (info[0], info[1]))
+                       sysvals.vprint(info[2])
+               sysvals.vprint('')
        if sysvals.cgdump:
                for data in testruns:
                        data.debugPrint()
@@ -5845,7 +5927,8 @@ def processData(live=False):
                return (testruns, {'error': 'timeline generation failed'})
        sysvals.vprint('Creating the html timeline (%s)...' % sysvals.htmlfile)
        createHTML(testruns, error)
-       pprint('DONE')
+       if not quiet:
+               pprint('DONE')
        data = testruns[0]
        stamp = data.stamp
        stamp['suspend'], stamp['resume'] = data.getTimeValues()
@@ -5872,31 +5955,28 @@ def rerunTest(htmlfile=''):
                        doError('a directory already exists with this name: %s' % sysvals.htmlfile)
                elif not os.access(sysvals.htmlfile, os.W_OK):
                        doError('missing permission to write to %s' % sysvals.htmlfile)
-       testruns, stamp = processData(False)
-       sysvals.logmsg = ''
+       testruns, stamp = processData()
+       sysvals.resetlog()
        return stamp
 
 # Function: runTest
 # Description:
 #       execute a suspend/resume, gather the logs, and generate the output
-def runTest(n=0):
+def runTest(n=0, quiet=False):
        # prepare for the test
-       sysvals.initFtrace()
+       sysvals.initFtrace(quiet)
        sysvals.initTestOutput('suspend')
 
        # execute the test
-       testdata = executeSuspend()
+       executeSuspend(quiet)
        sysvals.cleanupFtrace()
        if sysvals.skiphtml:
+               sysvals.outputResult({}, n)
                sysvals.sudoUserchown(sysvals.testdir)
                return
-       if not testdata[0]['error']:
-               testruns, stamp = processData(True)
-               for data in testruns:
-                       del data
-       else:
-               stamp = testdata[0]
-
+       testruns, stamp = processData(True, quiet)
+       for data in testruns:
+               del data
        sysvals.sudoUserchown(sysvals.testdir)
        sysvals.outputResult(stamp, n)
        if 'error' in stamp:
@@ -5904,13 +5984,14 @@ def runTest(n=0):
        return 0
 
 def find_in_html(html, start, end, firstonly=True):
-       n, out = 0, []
-       while n < len(html):
-               m = re.search(start, html[n:])
+       n, cnt, out = 0, len(html), []
+       while n < cnt:
+               e = cnt if (n + 10000 > cnt or n == 0) else n + 10000
+               m = re.search(start, html[n:e])
                if not m:
                        break
                i = m.end()
-               m = re.search(end, html[n+i:])
+               m = re.search(end, html[n+i:e])
                if not m:
                        break
                j = m.start()
@@ -5945,7 +6026,7 @@ def data_from_html(file, outpath, issues, fulldetail=False):
        tstr = dt.strftime('%Y/%m/%d %H:%M:%S')
        error = find_in_html(html, '<table class="testfail"><tr><td>', '</td>')
        if error:
-               m = re.match('[a-z]* failed in (?P<p>[a-z0-9_]*) phase', error)
+               m = re.match('[a-z0-9]* failed in (?P<p>\S*).*', error)
                if m:
                        result = 'fail in %s' % m.group('p')
                else:
@@ -5974,6 +6055,9 @@ def data_from_html(file, outpath, issues, fulldetail=False):
                                elist[err[0]] += 1
                for i in elist:
                        ilist.append('%sx%d' % (i, elist[i]) if elist[i] > 1 else i)
+       wifi = find_in_html(html, 'Wifi Resume: ', '</td>')
+       if wifi:
+               extra['wifi'] = wifi
        low = find_in_html(html, 'freeze time: <b>', ' ms</b>')
        if low and '|' in low:
                issue = 'FREEZEx%d' % len(low.split('|'))
@@ -6048,13 +6132,15 @@ def genHtml(subdir, force=False):
        for dirname, dirnames, filenames in os.walk(subdir):
                sysvals.dmesgfile = sysvals.ftracefile = sysvals.htmlfile = ''
                for filename in filenames:
-                       if(re.match('.*_dmesg.txt', filename)):
-                               sysvals.dmesgfile = os.path.join(dirname, filename)
-                       elif(re.match('.*_ftrace.txt', filename)):
-                               sysvals.ftracefile = os.path.join(dirname, filename)
+                       file = os.path.join(dirname, filename)
+                       if sysvals.usable(file):
+                               if(re.match('.*_dmesg.txt', filename)):
+                                       sysvals.dmesgfile = file
+                               elif(re.match('.*_ftrace.txt', filename)):
+                                       sysvals.ftracefile = file
                sysvals.setOutputFile()
-               if sysvals.ftracefile and sysvals.htmlfile and \
-                       (force or not os.path.exists(sysvals.htmlfile)):
+               if (sysvals.dmesgfile or sysvals.ftracefile) and sysvals.htmlfile and \
+                       (force or not sysvals.usable(sysvals.htmlfile)):
                        pprint('FTRACE: %s' % sysvals.ftracefile)
                        if sysvals.dmesgfile:
                                pprint('DMESG : %s' % sysvals.dmesgfile)
@@ -6169,9 +6255,9 @@ def configFromFile(file):
                                sysvals.cgtest = getArgInt('cgtest', value, 0, 1, False)
                        elif(option == 'cgphase'):
                                d = Data(0)
-                               if value not in d.sortedPhases():
+                               if value not in d.phasedef:
                                        doError('invalid phase --> (%s: %s), valid phases are %s'\
-                                               % (option, value, d.sortedPhases()), True)
+                                               % (option, value, d.phasedef.keys()), True)
                                sysvals.cgphase = value
                        elif(option == 'fadd'):
                                file = sysvals.configFile(value)
@@ -6184,9 +6270,7 @@ def configFromFile(file):
                                nums = value.split()
                                if len(nums) != 2:
                                        doError('multi requires 2 integers (exec_count and delay)', True)
-                               sysvals.multitest['run'] = True
-                               sysvals.multitest['count'] = getArgInt('multi: n d (exec count)', nums[0], 2, 1000000, False)
-                               sysvals.multitest['delay'] = getArgInt('multi: n d (delay between tests)', nums[1], 0, 3600, False)
+                               sysvals.multiinit(nums[0], nums[1])
                        elif(option == 'devicefilter'):
                                sysvals.setDeviceFilter(value)
                        elif(option == 'expandcg'):
@@ -6342,6 +6426,7 @@ def printHelp():
        '   -srgap       Add a visible gap in the timeline between sus/res (default: disabled)\n'\
        '   -skiphtml    Run the test and capture the trace logs, but skip the timeline (default: disabled)\n'\
        '   -result fn   Export a results table to a text file for parsing.\n'\
+       '   -wifi        If a wifi connection is available, check that it reconnects after resume.\n'\
        '  [testprep]\n'\
        '   -sync        Sync the filesystems before starting the test\n'\
        '   -rs on/off   Enable/disable runtime suspend for all devices, restore all after test\n'\
@@ -6356,8 +6441,10 @@ def printHelp():
        '   -predelay t  Include t ms delay before 1st suspend (default: 0 ms)\n'\
        '   -postdelay t Include t ms delay after last resume (default: 0 ms)\n'\
        '   -mindev ms   Discard all device blocks shorter than ms milliseconds (e.g. 0.001 for us)\n'\
-       '   -multi n d   Execute <n> consecutive tests at <d> seconds intervals. The outputs will\n'\
-       '                be created in a new subdirectory with a summary page.\n'\
+       '   -multi n d   Execute <n> consecutive tests at <d> seconds intervals. If <n> is followed\n'\
+       '                by a "d", "h", or "m" execute for <n> days, hours, or mins instead.\n'\
+       '                The outputs will be created in a new subdirectory with a summary page.\n'\
+       '   -maxfail n   Abort a -multi run after n consecutive fails (default is 0 = never abort)\n'\
        '  [debug]\n'\
        '   -f           Use ftrace to create device callgraphs (default: disabled)\n'\
        '   -ftop        Use ftrace on the top level call: "%s" (default: disabled)\n'\
@@ -6379,11 +6466,11 @@ def printHelp():
        '   -modes       List available suspend modes\n'\
        '   -status      Test to see if the system is enabled to run this tool\n'\
        '   -fpdt        Print out the contents of the ACPI Firmware Performance Data Table\n'\
-       '   -battery     Print out battery info (if available)\n'\
-       '   -wifi        Print out wifi connection info (if wireless-tools and device exists)\n'\
+       '   -wificheck   Print out wifi connection info\n'\
        '   -x<mode>     Test xset by toggling the given mode (on/off/standby/suspend)\n'\
        '   -sysinfo     Print out system info extracted from BIOS\n'\
        '   -devinfo     Print out the pm settings of all devices which support runtime suspend\n'\
+       '   -cmdinfo     Print out all the platform info collected before and after suspend/resume\n'\
        '   -flist       Print the list of functions currently being captured in ftrace\n'\
        '   -flistall    Print all functions capable of being captured in ftrace\n'\
        '   -summary dir Create a summary of tests in this dir [-genhtml builds missing html]\n'\
@@ -6399,8 +6486,8 @@ if __name__ == '__main__':
        genhtml = False
        cmd = ''
        simplecmds = ['-sysinfo', '-modes', '-fpdt', '-flist', '-flistall',
-               '-devinfo', '-status', '-battery', '-xon', '-xoff', '-xstandby',
-               '-xsuspend', '-xinit', '-xreset', '-xstat', '-wifi']
+               '-devinfo', '-status', '-xon', '-xoff', '-xstandby', '-xsuspend',
+               '-xinit', '-xreset', '-xstat', '-wificheck', '-cmdinfo']
        if '-f' in sys.argv:
                sysvals.cgskip = sysvals.configFile('cgskip.txt')
        # loop through the command line arguments
@@ -6462,8 +6549,15 @@ if __name__ == '__main__':
                        sysvals.usedevsrc = True
                elif(arg == '-sync'):
                        sysvals.sync = True
+               elif(arg == '-wifi'):
+                       sysvals.wifi = True
                elif(arg == '-gzip'):
                        sysvals.gzip = True
+               elif(arg == '-info'):
+                       try:
+                               val = next(args)
+                       except:
+                               doError('-info requires one string argument', True)
                elif(arg == '-rs'):
                        try:
                                val = next(args)
@@ -6555,10 +6649,14 @@ if __name__ == '__main__':
                        sysvals.cgexp = True
                elif(arg == '-srgap'):
                        sysvals.srgap = 5
+               elif(arg == '-maxfail'):
+                       sysvals.maxfail = getArgInt('-maxfail', args, 0, 1000000)
                elif(arg == '-multi'):
-                       sysvals.multitest['run'] = True
-                       sysvals.multitest['count'] = getArgInt('-multi n d (exec count)', args, 2, 1000000)
-                       sysvals.multitest['delay'] = getArgInt('-multi n d (delay between tests)', args, 0, 3600)
+                       try:
+                               c, d = next(args), next(args)
+                       except:
+                               doError('-multi requires two values', True)
+                       sysvals.multiinit(c, d)
                elif(arg == '-o'):
                        try:
                                val = next(args)
@@ -6655,13 +6753,6 @@ if __name__ == '__main__':
                elif(cmd == 'fpdt'):
                        if not getFPDT(True):
                                ret = 1
-               elif(cmd == 'battery'):
-                       out = getBattery()
-                       if out:
-                               pprint('AC Connect    : %s\nBattery Charge: %d' % out)
-                       else:
-                               pprint('no battery found')
-                               ret = 1
                elif(cmd == 'sysinfo'):
                        sysvals.printSystemInfo(True)
                elif(cmd == 'devinfo'):
@@ -6679,13 +6770,15 @@ if __name__ == '__main__':
                        ret = displayControl(cmd[1:])
                elif(cmd == 'xstat'):
                        pprint('Display Status: %s' % displayControl('stat').upper())
-               elif(cmd == 'wifi'):
-                       out = sysvals.checkWifi()
-                       if 'device' not in out:
-                               pprint('WIFI interface not found')
+               elif(cmd == 'wificheck'):
+                       dev = sysvals.checkWifi()
+                       if dev:
+                               print('%s is connected' % sysvals.wifiDetails(dev))
                        else:
-                               for key in sorted(out):
-                                       pprint('%6s: %s' % (key.upper(), out[key]))
+                               print('No wifi connection found')
+               elif(cmd == 'cmdinfo'):
+                       for out in sysvals.cmdinfo(False, True):
+                               print('[%s - %s]\n%s\n' % out)
                sys.exit(ret)
 
        # if instructed, re-analyze existing data files
@@ -6720,24 +6813,38 @@ if __name__ == '__main__':
        setRuntimeSuspend(True)
        if sysvals.display:
                displayControl('init')
-       ret = 0
+       failcnt, ret = 0, 0
        if sysvals.multitest['run']:
                # run multiple tests in a separate subdirectory
                if not sysvals.outdir:
-                       s = 'suspend-x%d' % sysvals.multitest['count']
-                       sysvals.outdir = datetime.now().strftime(s+'-%y%m%d-%H%M%S')
+                       if 'time' in sysvals.multitest:
+                               s = '-%dm' % sysvals.multitest['time']
+                       else:
+                               s = '-x%d' % sysvals.multitest['count']
+                       sysvals.outdir = datetime.now().strftime('suspend-%y%m%d-%H%M%S'+s)
                if not os.path.isdir(sysvals.outdir):
                        os.makedirs(sysvals.outdir)
+               sysvals.sudoUserchown(sysvals.outdir)
+               finish = datetime.now()
+               if 'time' in sysvals.multitest:
+                       finish += timedelta(minutes=sysvals.multitest['time'])
                for i in range(sysvals.multitest['count']):
-                       if(i != 0):
+                       sysvals.multistat(True, i, finish)
+                       if i != 0 and sysvals.multitest['delay'] > 0:
                                pprint('Waiting %d seconds...' % (sysvals.multitest['delay']))
                                time.sleep(sysvals.multitest['delay'])
-                       pprint('TEST (%d/%d) START' % (i+1, sysvals.multitest['count']))
                        fmt = 'suspend-%y%m%d-%H%M%S'
                        sysvals.testdir = os.path.join(sysvals.outdir, datetime.now().strftime(fmt))
-                       ret = runTest(i+1)
-                       pprint('TEST (%d/%d) COMPLETE' % (i+1, sysvals.multitest['count']))
-                       sysvals.logmsg = ''
+                       ret = runTest(i+1, True)
+                       failcnt = 0 if not ret else failcnt + 1
+                       if sysvals.maxfail > 0 and failcnt >= sysvals.maxfail:
+                               pprint('Maximum fail count of %d reached, aborting multitest' % (sysvals.maxfail))
+                               break
+                       time.sleep(5)
+                       sysvals.resetlog()
+                       sysvals.multistat(False, i, finish)
+                       if 'time' in sysvals.multitest and datetime.now() >= finish:
+                               break
                if not sysvals.skiphtml:
                        runSummary(sysvals.outdir, False, False)
                sysvals.sudoUserchown(sysvals.outdir)
index c2c8de4..e59d985 100644 (file)
@@ -11,5 +11,6 @@ CONFIG_PREEMPTIRQ_DELAY_TEST=m
 CONFIG_MODULES=y
 CONFIG_MODULE_UNLOAD=y
 CONFIG_SAMPLES=y
+CONFIG_SAMPLE_FTRACE_DIRECT=m
 CONFIG_SAMPLE_TRACE_PRINTK=m
 CONFIG_KALLSYMS_ALL=y
index 4c156ae..5ec4d9e 100644 (file)
@@ -137,7 +137,7 @@ int dump_queue(struct msgque_data *msgque)
        for (kern_id = 0; kern_id < 256; kern_id++) {
                ret = msgctl(kern_id, MSG_STAT, &ds);
                if (ret < 0) {
-                       if (errno == -EINVAL)
+                       if (errno == EINVAL)
                                continue;
                        printf("Failed to get stats for IPC queue with id %d\n",
                                        kern_id);
index e84d901..676b3a8 100644 (file)
@@ -33,7 +33,7 @@ tap_timeout()
 {
        # Make sure tests will time out if utility is available.
        if [ -x /usr/bin/timeout ] ; then
-               /usr/bin/timeout "$kselftest_timeout" "$1"
+               /usr/bin/timeout --foreground "$kselftest_timeout" "$1"
        else
                "$1"
        fi
index 2902f6a..2bb8c81 100644 (file)
@@ -705,7 +705,7 @@ static void __timeout_handler(int sig, siginfo_t *info, void *ucontext)
        /* Sanity check handler execution environment. */
        if (!t) {
                fprintf(TH_LOG_STREAM,
-                       "no active test in SIGARLM handler!?\n");
+                       "no active test in SIGALRM handler!?\n");
                abort();
        }
        if (sig != SIGALRM || sig != info->si_signo) {
@@ -731,7 +731,7 @@ void __wait_for_test(struct __test_metadata *t)
        if (sigaction(SIGALRM, &action, &saved_action)) {
                t->passed = 0;
                fprintf(TH_LOG_STREAM,
-                       "%s: unable to install SIGARLM handler\n",
+                       "%s: unable to install SIGALRM handler\n",
                        t->name);
                return;
        }
@@ -743,7 +743,7 @@ void __wait_for_test(struct __test_metadata *t)
        if (sigaction(SIGALRM, &saved_action, NULL)) {
                t->passed = 0;
                fprintf(TH_LOG_STREAM,
-                       "%s: unable to uninstall SIGARLM handler\n",
+                       "%s: unable to uninstall SIGALRM handler\n",
                        t->name);
                return;
        }
index 0a15f9e..187b14c 100644 (file)
@@ -4,8 +4,9 @@ CFLAGS += -I../../../../include/uapi/
 CFLAGS += -I../../../../include/
 CFLAGS += -I../../../../usr/include/
 
-TEST_GEN_PROGS := memfd_test fuse_test fuse_mnt
+TEST_GEN_PROGS := memfd_test
 TEST_PROGS := run_fuse_test.sh run_hugetlbfs_test.sh
+TEST_GEN_FILES := fuse_test fuse_mnt
 
 fuse_mnt.o: CFLAGS += $(shell pkg-config fuse --cflags)
 
index 89fb3e0..c0aa46c 100644 (file)
@@ -2803,12 +2803,13 @@ TEST(syscall_restart)
                         offsetof(struct seccomp_data, nr)),
 
 #ifdef __NR_sigreturn
-               BPF_JUMP(BPF_JMP|BPF_JEQ|BPF_K, __NR_sigreturn, 6, 0),
+               BPF_JUMP(BPF_JMP|BPF_JEQ|BPF_K, __NR_sigreturn, 7, 0),
 #endif
-               BPF_JUMP(BPF_JMP|BPF_JEQ|BPF_K, __NR_read, 5, 0),
-               BPF_JUMP(BPF_JMP|BPF_JEQ|BPF_K, __NR_exit, 4, 0),
-               BPF_JUMP(BPF_JMP|BPF_JEQ|BPF_K, __NR_rt_sigreturn, 3, 0),
-               BPF_JUMP(BPF_JMP|BPF_JEQ|BPF_K, __NR_nanosleep, 4, 0),
+               BPF_JUMP(BPF_JMP|BPF_JEQ|BPF_K, __NR_read, 6, 0),
+               BPF_JUMP(BPF_JMP|BPF_JEQ|BPF_K, __NR_exit, 5, 0),
+               BPF_JUMP(BPF_JMP|BPF_JEQ|BPF_K, __NR_rt_sigreturn, 4, 0),
+               BPF_JUMP(BPF_JMP|BPF_JEQ|BPF_K, __NR_nanosleep, 5, 0),
+               BPF_JUMP(BPF_JMP|BPF_JEQ|BPF_K, __NR_clock_nanosleep, 4, 0),
                BPF_JUMP(BPF_JMP|BPF_JEQ|BPF_K, __NR_restart_syscall, 4, 0),
 
                /* Allow __NR_write for easy logging. */
@@ -2895,7 +2896,8 @@ TEST(syscall_restart)
        ASSERT_EQ(PTRACE_EVENT_SECCOMP, (status >> 16));
        ASSERT_EQ(0, ptrace(PTRACE_GETEVENTMSG, child_pid, NULL, &msg));
        ASSERT_EQ(0x100, msg);
-       EXPECT_EQ(__NR_nanosleep, get_syscall(_metadata, child_pid));
+       ret = get_syscall(_metadata, child_pid);
+       EXPECT_TRUE(ret == __NR_nanosleep || ret == __NR_clock_nanosleep);
 
        /* Might as well check siginfo for sanity while we're here. */
        ASSERT_EQ(0, ptrace(PTRACE_GETSIGINFO, child_pid, NULL, &info));
index b630c7b..8155c2e 100755 (executable)
@@ -1,17 +1,8 @@
 #!/bin/bash
 # SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause)
-self.flags = flags
 
-# Kselftest framework requirement - SKIP code is 4.
-ksft_skip=4
-
-
-if [ -f /dev/tpm0 ] ; then
-       python -m unittest -v tpm2_tests.SmokeTest
-       python -m unittest -v tpm2_tests.AsyncTest
-else
-       exit $ksft_skip
-fi
+python -m unittest -v tpm2_tests.SmokeTest
+python -m unittest -v tpm2_tests.AsyncTest
 
 CLEAR_CMD=$(which tpm2_clear)
 if [ -n $CLEAR_CMD ]; then
index 180b469..a6f5e34 100755 (executable)
@@ -1,11 +1,4 @@
 #!/bin/bash
 # SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause)
 
-# Kselftest framework requirement - SKIP code is 4.
-ksft_skip=4
-
-if [ -f /dev/tpmrm0 ] ; then
-       python -m unittest -v tpm2_tests.SpaceTest
-else
-       exit $ksft_skip
-fi
+python -m unittest -v tpm2_tests.SpaceTest
index d31db05..6998877 100644 (file)
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0
 # Makefile for vm selftests
 uname_M := $(shell uname -m 2>/dev/null || echo not)
-ARCH ?= $(shell echo $(uname_M) | sed -e 's/aarch64.*/arm64/')
+MACHINE ?= $(shell echo $(uname_M) | sed -e 's/aarch64.*/arm64/')
 
 CFLAGS = -Wall -I ../../../../usr/include $(EXTRA_CFLAGS)
 LDLIBS = -lrt
@@ -20,7 +20,7 @@ TEST_GEN_FILES += thuge-gen
 TEST_GEN_FILES += transhuge-stress
 TEST_GEN_FILES += userfaultfd
 
-ifneq (,$(filter $(ARCH),arm64 ia64 mips64 parisc64 ppc64 riscv64 s390x sh64 sparc64 x86_64))
+ifneq (,$(filter $(MACHINE),arm64 ia64 mips64 parisc64 ppc64 ppc64le riscv64 s390x sh64 sparc64 x86_64))
 TEST_GEN_FILES += va_128TBswitch
 TEST_GEN_FILES += virtual_address_range
 TEST_GEN_FILES += write_to_hugetlbfs
index 665009e..76ca5e7 100755 (executable)
@@ -59,7 +59,7 @@ else
 fi
 
 #filter 64bit architectures
-ARCH64STR="arm64 ia64 mips64 parisc64 ppc64 riscv64 s390x sh64 sparc64 x86_64"
+ARCH64STR="arm64 ia64 mips64 parisc64 ppc64 ppc64le riscv64 s390x sh64 sparc64 x86_64"
 if [ -z $ARCH ]; then
   ARCH=`uname -m 2>/dev/null | sed -e 's/aarch64.*/arm64/'`
 fi
index f33f32f..b587b9a 100644 (file)
@@ -4,7 +4,7 @@ test: virtio_test vringh_test
 virtio_test: virtio_ring.o virtio_test.o
 vringh_test: vringh_test.o vringh.o virtio_ring.o
 
-CFLAGS += -g -O2 -Werror -Wall -I. -I../include/ -I ../../usr/include/ -Wno-pointer-sign -fno-strict-overflow -fno-strict-aliasing -fno-common -MMD -U_FORTIFY_SOURCE
+CFLAGS += -g -O2 -Werror -Wall -I. -I../include/ -I ../../usr/include/ -Wno-pointer-sign -fno-strict-overflow -fno-strict-aliasing -fno-common -MMD -U_FORTIFY_SOURCE -include ../../include/linux/kconfig.h
 vpath %.c ../../drivers/virtio ../../drivers/vhost
 mod:
        ${MAKE} -C `pwd`/../.. M=`pwd`/vhost_test V=${V}
@@ -22,7 +22,8 @@ OOT_CONFIGS=\
        CONFIG_VHOST=m \
        CONFIG_VHOST_NET=n \
        CONFIG_VHOST_SCSI=n \
-       CONFIG_VHOST_VSOCK=n
+       CONFIG_VHOST_VSOCK=n \
+       CONFIG_VHOST_RING=n
 OOT_BUILD=KCFLAGS="-I "${OOT_VHOST} ${MAKE} -C ${OOT_KSRC} V=${V}
 oot-build:
        echo "UNSUPPORTED! Don't use the resulting modules in production!"
index d0351f8..04d563f 100644 (file)
@@ -1,4 +1,5 @@
 /* SPDX-License-Identifier: GPL-2.0 */
+#include <stdlib.h>
 #if defined(__i386__) || defined(__x86_64__)
 #define barrier() asm volatile("" ::: "memory")
 #define virt_mb() __sync_synchronize()
diff --git a/tools/virtio/generated/autoconf.h b/tools/virtio/generated/autoconf.h
new file mode 100644 (file)
index 0000000..e69de29
index 903dc9c..2c51bcc 100644 (file)
@@ -7,4 +7,5 @@
 
 #define READ_ONCE(var) (*((volatile typeof(var) *)(&(var))))
 
+#define __aligned(x) __attribute((__aligned__(x)))
 #endif
index 20f6cf0..9860622 100644 (file)
@@ -1,6 +1,8 @@
 # SPDX-License-Identifier: GPL-2.0
 # Makefile for vm tools
 #
+include ../scripts/Makefile.include
+
 TARGETS=page-types slabinfo page_owner_sort
 
 LIB_DIR = ../lib/api