Merge branches 'pm-core', 'pm-sleep', 'pm-pci' and 'pm-domains'
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 13 Oct 2020 12:48:20 +0000 (14:48 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 13 Oct 2020 12:48:20 +0000 (14:48 +0200)
* pm-core:
  PM: runtime: Fix timer_expires data type on 32-bit arches
  PM: runtime: Remove link state checks in rpm_get/put_supplier()

* pm-sleep:
  ACPI: EC: PM: Drop ec_no_wakeup check from acpi_ec_dispatch_gpe()
  ACPI: EC: PM: Flush EC work unconditionally after wakeup
  PM: hibernate: remove the bogus call to get_gendisk() in software_resume()
  PM: hibernate: Batch hibernate and resume IO requests

* pm-pci:
  PCI/ACPI: Whitelist hotplug ports for D3 if power managed by ACPI

* pm-domains:
  PM: domains: Allow to abort power off when no ->power_off() callback
  PM: domains: Rename power state enums for genpd

441 files changed:
Documentation/admin-guide/cgroup-v2.rst
Documentation/admin-guide/device-mapper/dm-crypt.rst
Documentation/admin-guide/pm/cpuidle.rst
Documentation/bpf/ringbuf.rst
Documentation/devicetree/bindings/arm/bcm/raspberrypi,bcm2835-firmware.yaml
Documentation/devicetree/bindings/cpufreq/cpufreq-qcom-hw.txt
Documentation/devicetree/bindings/crypto/ti,sa2ul.yaml
Documentation/devicetree/bindings/display/xlnx/xlnx,zynqmp-dpsub.yaml
Documentation/devicetree/bindings/dma/xilinx/xlnx,zynqmp-dpdma.yaml
Documentation/devicetree/bindings/gpio/sgpio-aspeed.txt
Documentation/devicetree/bindings/leds/cznic,turris-omnia-leds.yaml
Documentation/devicetree/bindings/media/i2c/imx274.txt [deleted file]
Documentation/devicetree/bindings/media/i2c/sony,imx274.yaml [new file with mode: 0644]
Documentation/devicetree/bindings/opp/opp.txt
Documentation/kbuild/llvm.rst
Documentation/networking/ethtool-netlink.rst
Documentation/userspace-api/media/v4l/buffer.rst
Documentation/userspace-api/media/v4l/vidioc-create-bufs.rst
Documentation/userspace-api/media/v4l/vidioc-reqbufs.rst
Documentation/virt/kvm/api.rst
MAINTAINERS
Makefile
arch/arm/boot/dts/at91-sama5d2_icp.dts
arch/arm/boot/dts/bcm2835-rpi.dtsi
arch/arm/boot/dts/tegra20-cpu-opp-microvolt.dtsi
arch/arm/boot/dts/tegra20-cpu-opp.dtsi
arch/arm/boot/dts/tegra30-cpu-opp-microvolt.dtsi
arch/arm/boot/dts/tegra30-cpu-opp.dtsi
arch/arm/include/asm/topology.h
arch/arm/mach-imx/cpuidle-imx6q.c
arch/arm64/include/asm/kvm_emulate.h
arch/arm64/include/asm/topology.h
arch/arm64/kernel/acpi.c
arch/arm64/kernel/topology.c
arch/arm64/kvm/hyp/include/hyp/switch.h
arch/arm64/kvm/hyp/nvhe/tlb.c
arch/arm64/kvm/mmu.c
arch/ia64/mm/init.c
arch/mips/bcm47xx/setup.c
arch/mips/include/asm/cpu-type.h
arch/mips/loongson2ef/Platform
arch/mips/loongson64/cop2-ex.c
arch/riscv/include/asm/stackprotector.h
arch/riscv/include/asm/timex.h
arch/s390/include/asm/pgtable.h
arch/x86/entry/common.c
arch/x86/entry/entry_64.S
arch/x86/include/asm/idtentry.h
arch/x86/include/asm/irq_stack.h
arch/x86/kernel/apic/io_apic.c
arch/x86/kernel/irq.c
arch/x86/kernel/irq_64.c
arch/x86/kernel/kvm.c
arch/x86/kvm/svm/svm.c
arch/x86/kvm/vmx/vmx.c
arch/x86/kvm/vmx/vmx.h
arch/x86/kvm/x86.c
arch/x86/lib/usercopy_64.c
block/blk-mq.c
block/blk-settings.c
drivers/acpi/acpi_processor.c
drivers/acpi/processor_idle.c
drivers/atm/eni.c
drivers/base/arch_topology.c
drivers/base/node.c
drivers/base/power/domain.c
drivers/base/power/runtime.c
drivers/base/regmap/internal.h
drivers/base/regmap/regcache.c
drivers/base/regmap/regmap-debugfs.c
drivers/base/regmap/regmap.c
drivers/clk/samsung/clk-exynos4.c
drivers/clk/samsung/clk-exynos5420.c
drivers/clk/socfpga/clk-s10.c
drivers/clk/tegra/clk-pll.c
drivers/clk/tegra/clk-tegra210-emc.c
drivers/clocksource/h8300_timer8.c
drivers/clocksource/timer-clint.c
drivers/clocksource/timer-gx6605s.c
drivers/clocksource/timer-ti-dm-systimer.c
drivers/cpufreq/Kconfig.arm
drivers/cpufreq/armada-37xx-cpufreq.c
drivers/cpufreq/cpufreq-dt-platdev.c
drivers/cpufreq/cpufreq-dt.c
drivers/cpufreq/cpufreq.c
drivers/cpufreq/cpufreq_stats.c
drivers/cpufreq/imx6q-cpufreq.c
drivers/cpufreq/intel_pstate.c
drivers/cpufreq/qcom-cpufreq-hw.c
drivers/cpufreq/s5pv210-cpufreq.c
drivers/cpufreq/scmi-cpufreq.c
drivers/cpufreq/scpi-cpufreq.c
drivers/cpufreq/sti-cpufreq.c
drivers/cpufreq/tegra186-cpufreq.c
drivers/cpufreq/vexpress-spc-cpufreq.c
drivers/cpuidle/cpuidle-psci-domain.c
drivers/cpuidle/cpuidle-psci.c
drivers/cpuidle/cpuidle-tegra.c
drivers/cpuidle/cpuidle.c
drivers/cpuidle/sysfs.c
drivers/devfreq/devfreq-event.c
drivers/devfreq/devfreq.c
drivers/devfreq/exynos-bus.c
drivers/devfreq/rk3399_dmc.c
drivers/devfreq/tegra30-devfreq.c
drivers/dma-buf/dma-buf.c
drivers/dma/dmatest.c
drivers/firmware/psci/psci.c
drivers/gpio/gpio-amd-fch.c
drivers/gpio/gpio-aspeed-sgpio.c
drivers/gpio/gpio-aspeed.c
drivers/gpio/gpio-mockup.c
drivers/gpio/gpio-omap.c
drivers/gpio/gpio-pca953x.c
drivers/gpio/gpio-siox.c
drivers/gpio/gpio-sprd.c
drivers/gpio/gpio-tc3589x.c
drivers/gpio/gpiolib-cdev.c
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c
drivers/gpu/drm/amd/amdgpu/vcn_v3_0.c
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_hdcp.c
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn21/rn_clk_mgr.c
drivers/gpu/drm/amd/display/dc/dcn30/Makefile
drivers/gpu/drm/amd/include/asic_reg/gc/gc_10_3_0_default.h
drivers/gpu/drm/amd/include/asic_reg/gc/gc_10_3_0_offset.h
drivers/gpu/drm/amd/include/asic_reg/gc/gc_10_3_0_sh_mask.h
drivers/gpu/drm/amd/include/asic_reg/vcn/vcn_3_0_0_sh_mask.h
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c
drivers/gpu/drm/amd/powerplay/renoir_ppt.c
drivers/gpu/drm/i915/gvt/vgpu.c
drivers/gpu/drm/i915/selftests/mock_gem_device.c
drivers/gpu/drm/sun4i/sun8i_csc.h
drivers/gpu/drm/sun4i/sun8i_mixer.c
drivers/gpu/drm/vc4/vc4_hdmi.c
drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c
drivers/gpu/drm/vmwgfx/vmwgfx_thp.c
drivers/i2c/busses/i2c-cpm.c
drivers/i2c/busses/i2c-i801.c
drivers/i2c/busses/i2c-npcm7xx.c
drivers/iio/adc/ad7124.c
drivers/iio/adc/qcom-spmi-adc5.c
drivers/infiniband/core/device.c
drivers/input/mouse/trackpoint.c
drivers/input/serio/i8042-x86ia64io.h
drivers/iommu/amd/init.c
drivers/iommu/exynos-iommu.c
drivers/iommu/intel/iommu.c
drivers/md/dm.c
drivers/media/cec/core/cec-adap.c
drivers/media/common/videobuf2/videobuf2-core.c
drivers/media/common/videobuf2/videobuf2-dma-contig.c
drivers/media/common/videobuf2/videobuf2-dma-sg.c
drivers/media/common/videobuf2/videobuf2-v4l2.c
drivers/media/dvb-core/dvb_vb2.c
drivers/media/v4l2-core/v4l2-compat-ioctl32.c
drivers/media/v4l2-core/v4l2-ioctl.c
drivers/memory/samsung/exynos5422-dmc.c
drivers/memstick/core/memstick.c
drivers/mmc/host/mmc_spi.c
drivers/mmc/host/sdhci-pci-core.c
drivers/net/dsa/microchip/ksz8795.c
drivers/net/dsa/microchip/ksz9477.c
drivers/net/dsa/microchip/ksz_common.c
drivers/net/dsa/microchip/ksz_common.h
drivers/net/dsa/ocelot/felix.c
drivers/net/dsa/ocelot/felix_vsc9959.c
drivers/net/dsa/ocelot/seville_vsc9953.c
drivers/net/dsa/rtl8366.c
drivers/net/ethernet/broadcom/bnxt/bnxt.c
drivers/net/ethernet/broadcom/bnxt/bnxt.h
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
drivers/net/ethernet/cadence/macb_main.c
drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c
drivers/net/ethernet/chelsio/cxgb4/cxgb4_mps.c
drivers/net/ethernet/dec/tulip/de2104x.c
drivers/net/ethernet/freescale/dpaa2/dpmac-cmd.h
drivers/net/ethernet/freescale/enetc/enetc_pf.c
drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c
drivers/net/ethernet/hisilicon/hns/hns_ethtool.c
drivers/net/ethernet/huawei/hinic/hinic_ethtool.c
drivers/net/ethernet/huawei/hinic/hinic_hw_mgmt.c
drivers/net/ethernet/huawei/hinic/hinic_main.c
drivers/net/ethernet/huawei/hinic/hinic_rx.c
drivers/net/ethernet/huawei/hinic/hinic_tx.c
drivers/net/ethernet/ibm/ibmvnic.c
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
drivers/net/ethernet/intel/igc/igc.h
drivers/net/ethernet/intel/igc/igc_ptp.c
drivers/net/ethernet/lantiq_xrx200.c
drivers/net/ethernet/marvell/mvneta.c
drivers/net/ethernet/mellanox/mlx5/core/en.h
drivers/net/ethernet/mellanox/mlx5/core/en/monitor_stats.c
drivers/net/ethernet/mellanox/mlx5/core/en/port.c
drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c
drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.h
drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h
drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c
drivers/net/ethernet/mellanox/mlx5/core/en/xsk/rx.c
drivers/net/ethernet/mellanox/mlx5/core/en/xsk/setup.c
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls_rx.c
drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls_stats.c
drivers/net/ethernet/mellanox/mlx5/core/en_main.c
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
drivers/net/ethernet/mellanox/mlx5/core/en_stats.c
drivers/net/ethernet/mellanox/mlx5/core/en_stats.h
drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c
drivers/net/ethernet/mscc/ocelot.c
drivers/net/ethernet/mscc/ocelot_net.c
drivers/net/ethernet/mscc/ocelot_vsc7514.c
drivers/net/ethernet/netronome/nfp/nfp_net_ethtool.c
drivers/net/ethernet/qlogic/qed/qed_dev.c
drivers/net/ethernet/qlogic/qed/qed_l2.c
drivers/net/ethernet/qlogic/qed/qed_main.c
drivers/net/ethernet/qlogic/qed/qed_sriov.c
drivers/net/ethernet/qlogic/qede/qede_filter.c
drivers/net/ethernet/qlogic/qede/qede_main.c
drivers/net/ethernet/sfc/ef100.c
drivers/net/ethernet/ti/cpsw_new.c
drivers/net/geneve.c
drivers/net/hyperv/hyperv_net.h
drivers/net/hyperv/netvsc.c
drivers/net/hyperv/netvsc_drv.c
drivers/net/hyperv/rndis_filter.c
drivers/net/ieee802154/adf7242.c
drivers/net/ieee802154/ca8210.c
drivers/net/ipa/ipa_table.c
drivers/net/phy/phy.c
drivers/net/phy/phy_device.c
drivers/net/usb/rndis_host.c
drivers/net/wan/hdlc_cisco.c
drivers/net/wan/hdlc_fr.c
drivers/net/wan/hdlc_ppp.c
drivers/net/wan/lapbether.c
drivers/net/wireguard/noise.c
drivers/net/wireguard/peerlookup.c
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
drivers/net/wireless/marvell/mwifiex/fw.h
drivers/net/wireless/marvell/mwifiex/sta_cmdresp.c
drivers/net/wireless/mediatek/mt76/mt7615/mcu.c
drivers/net/wireless/mediatek/mt76/mt7915/init.c
drivers/net/wireless/mediatek/mt76/mt7915/mac.c
drivers/net/wireless/ti/wlcore/cmd.h
drivers/net/wireless/ti/wlcore/main.c
drivers/nvme/host/Kconfig
drivers/nvme/host/core.c
drivers/nvme/host/fc.c
drivers/nvme/host/hwmon.c
drivers/nvme/host/nvme.h
drivers/nvme/host/pci.c
drivers/nvme/target/passthru.c
drivers/opp/core.c
drivers/opp/cpu.c
drivers/opp/of.c
drivers/opp/opp.h
drivers/pci/controller/pcie-rockchip-host.c
drivers/pci/pci-acpi.c
drivers/phy/ti/phy-am654-serdes.c
drivers/pinctrl/intel/pinctrl-cherryview.c
drivers/pinctrl/mediatek/pinctrl-mtk-common-v2.c
drivers/pinctrl/mvebu/pinctrl-armada-xp.c
drivers/pinctrl/qcom/pinctrl-sm8250.c
drivers/regulator/axp20x-regulator.c
drivers/s390/block/dasd_fba.c
drivers/s390/crypto/zcrypt_api.c
drivers/s390/net/qeth_l2_main.c
drivers/s390/net/qeth_l3_main.c
drivers/scsi/iscsi_tcp.c
drivers/scsi/lpfc/lpfc_hbadisc.c
drivers/scsi/sd.c
drivers/scsi/sd.h
drivers/scsi/sd_zbc.c
drivers/soc/samsung/exynos-asv.c
drivers/spi/spi-bcm-qspi.c
drivers/spi/spi-bcm2835.c
drivers/spi/spi-fsl-dspi.c
drivers/spi/spi-fsl-espi.c
drivers/target/target_core_transport.c
drivers/usb/core/driver.c
drivers/usb/gadget/function/f_ncm.c
drivers/usb/usbip/stub_dev.c
drivers/vhost/iotlb.c
drivers/vhost/vdpa.c
drivers/xen/events/events_base.c
fs/autofs/waitq.c
fs/btrfs/dev-replace.c
fs/btrfs/disk-io.c
fs/btrfs/sysfs.c
fs/btrfs/volumes.c
fs/btrfs/volumes.h
fs/eventpoll.c
fs/fuse/file.c
fs/io_uring.c
fs/nfs/dir.c
fs/nfs/flexfilelayout/flexfilelayout.c
fs/nfs/nfs42proc.c
fs/pipe.c
fs/read_write.c
fs/splice.c
fs/vboxsf/super.c
include/linux/acpi.h
include/linux/arch_topology.h
include/linux/blk_types.h
include/linux/blkdev.h
include/linux/cpufreq.h
include/linux/cpuidle.h
include/linux/dax.h
include/linux/devfreq-event.h
include/linux/devfreq.h
include/linux/fs_parser.h
include/linux/kprobes.h
include/linux/memstick.h
include/linux/mm.h
include/linux/mm_types.h
include/linux/mmzone.h
include/linux/netdev_features.h
include/linux/netdevice.h
include/linux/nfs_xdr.h
include/linux/node.h
include/linux/pgtable.h
include/linux/pipe_fs_i.h
include/linux/pm.h
include/linux/pm_domain.h
include/linux/psci.h
include/linux/qed/qed_if.h
include/linux/skbuff.h
include/linux/vmstat.h
include/media/videobuf2-core.h
include/net/flow.h
include/net/netlink.h
include/net/netns/nftables.h
include/net/sctp/structs.h
include/net/vxlan.h
include/soc/mscc/ocelot.h
include/uapi/linux/ethtool_netlink.h
include/uapi/linux/videodev2.h
init/main.c
kernel/bpf/hashtab.c
kernel/bpf/inode.c
kernel/fork.c
kernel/kprobes.c
kernel/rcu/tasks.h
kernel/rcu/tree.c
kernel/sched/cpufreq_schedutil.c
kernel/trace/ftrace.c
kernel/trace/trace.c
kernel/trace/trace_events_hist.c
kernel/trace/trace_output.c
lib/bootconfig.c
lib/memregion.c
lib/random32.c
lib/string.c
lib/test_rhashtable.c
mm/filemap.c
mm/gup.c
mm/huge_memory.c
mm/madvise.c
mm/memcontrol.c
mm/memory.c
mm/memory_hotplug.c
mm/migrate.c
mm/page_alloc.c
mm/slab.c
mm/slub.c
mm/swapfile.c
net/batman-adv/bridge_loop_avoidance.c
net/batman-adv/bridge_loop_avoidance.h
net/batman-adv/multicast.c
net/batman-adv/multicast.h
net/batman-adv/routing.c
net/batman-adv/soft-interface.c
net/bridge/br_vlan.c
net/core/dev.c
net/core/dst.c
net/core/fib_rules.c
net/core/filter.c
net/core/net_namespace.c
net/dcb/dcbnl.c
net/dsa/slave.c
net/dsa/tag_ocelot.c
net/ethtool/tunnels.c
net/hsr/hsr_netlink.c
net/ipv4/fib_frontend.c
net/ipv4/inet_diag.c
net/ipv4/ip_output.c
net/ipv4/ip_tunnel_core.c
net/ipv4/route.c
net/ipv6/Kconfig
net/ipv6/ip6_fib.c
net/ipv6/route.c
net/mac80211/airtime.c
net/mac80211/mlme.c
net/mac80211/rx.c
net/mac80211/util.c
net/mac80211/vht.c
net/mac802154/tx.c
net/mptcp/pm_netlink.c
net/mptcp/subflow.c
net/netfilter/nf_conntrack_netlink.c
net/netfilter/nf_conntrack_proto.c
net/netfilter/nf_tables_api.c
net/netfilter/nft_meta.c
net/qrtr/qrtr.c
net/sched/act_ife.c
net/sched/act_tunnel_key.c
net/sched/cls_flower.c
net/sched/sch_generic.c
net/sched/sch_taprio.c
net/sctp/socket.c
net/sunrpc/svcsock.c
net/tipc/group.c
net/tipc/link.c
net/tipc/msg.c
net/tipc/socket.c
net/wireless/Kconfig
net/wireless/util.c
net/xdp/xdp_umem.c
scripts/dtc/Makefile
scripts/kallsyms.c
scripts/spelling.txt
sound/pci/asihpi/hpioctl.c
sound/pci/hda/patch_realtek.c
sound/usb/mixer_maps.c
sound/usb/quirks.c
tools/bootconfig/test-bootconfig.sh
tools/bpf/Makefile
tools/bpf/resolve_btfids/Makefile
tools/io_uring/io_uring-bench.c
tools/lib/bpf/Makefile
tools/lib/bpf/libbpf.c
tools/testing/selftests/bpf/progs/bpf_iter_bpf_hash_map.c
tools/testing/selftests/kvm/x86_64/debug_regs.c
tools/testing/selftests/net/rtnetlink.sh

index 6be4378..baa07b3 100644 (file)
@@ -1324,15 +1324,26 @@ PAGE_SIZE multiple when read back.
          pgmajfault
                Number of major page faults incurred
 
-         workingset_refault
-               Number of refaults of previously evicted pages
+         workingset_refault_anon
+               Number of refaults of previously evicted anonymous pages.
 
-         workingset_activate
-               Number of refaulted pages that were immediately activated
+         workingset_refault_file
+               Number of refaults of previously evicted file pages.
 
-         workingset_restore
-               Number of restored pages which have been detected as an active
-               workingset before they got reclaimed.
+         workingset_activate_anon
+               Number of refaulted anonymous pages that were immediately
+               activated.
+
+         workingset_activate_file
+               Number of refaulted file pages that were immediately activated.
+
+         workingset_restore_anon
+               Number of restored anonymous pages which have been detected as
+               an active workingset before they got reclaimed.
+
+         workingset_restore_file
+               Number of restored file pages which have been detected as an
+               active workingset before they got reclaimed.
 
          workingset_nodereclaim
                Number of times a shadow node has been reclaimed
index 8f4a3f8..bc28a95 100644 (file)
@@ -67,7 +67,7 @@ Parameters::
     the value passed in <key_size>.
 
 <key_type>
-    Either 'logon' or 'user' kernel key type.
+    Either 'logon', 'user' or 'encrypted' kernel key type.
 
 <key_description>
     The kernel keyring key description crypt target should look for
@@ -121,6 +121,14 @@ submit_from_crypt_cpus
     thread because it benefits CFQ to have writes submitted using the
     same context.
 
+no_read_workqueue
+    Bypass dm-crypt internal workqueue and process read requests synchronously.
+
+no_write_workqueue
+    Bypass dm-crypt internal workqueue and process write requests synchronously.
+    This option is automatically enabled for host-managed zoned block devices
+    (e.g. host-managed SMR hard-disks).
+
 integrity:<bytes>:<type>
     The device requires additional <bytes> metadata per-sector stored
     in per-bio integrity structure. This metadata must by provided
index a96a423..37940a0 100644 (file)
@@ -528,6 +528,10 @@ object corresponding to it, as follows:
        Total number of times the hardware has been asked by the given CPU to
        enter this idle state.
 
+``rejected``
+       Total number of times a request to enter this idle state on the given
+       CPU was rejected.
+
 The :file:`desc` and :file:`name` files both contain strings.  The difference
 between them is that the name is expected to be more concise, while the
 description may be longer and it may contain white space or special characters.
@@ -572,6 +576,11 @@ particular case.  For these reasons, the only reliable way to find out how
 much time has been spent by the hardware in different idle states supported by
 it is to use idle state residency counters in the hardware, if available.
 
+Generally, an interrupt received when trying to enter an idle state causes the
+idle state entry request to be rejected, in which case the ``CPUIdle`` driver
+may return an error code to indicate that this was the case. The :file:`usage`
+and :file:`rejected` files report the number of times the given idle state
+was entered successfully or rejected, respectively.
 
 .. _cpu-pm-qos:
 
@@ -690,7 +699,7 @@ which of the two parameters is added to the kernel command line.  In the
 instruction of the CPUs (which, as a rule, suspends the execution of the program
 and causes the hardware to attempt to enter the shallowest available idle state)
 for this purpose, and if ``idle=poll`` is used, idle CPUs will execute a
-more or less ``lightweight'' sequence of instructions in a tight loop.  [Note
+more or less "lightweight" sequence of instructions in a tight loop.  [Note
 that using ``idle=poll`` is somewhat drastic in many cases, as preventing idle
 CPUs from saving almost any energy at all may not be the only effect of it.
 For example, on Intel hardware it effectively prevents CPUs from using
index 75f943f..6a615cd 100644 (file)
@@ -182,9 +182,6 @@ in the order of reservations, but only after all previous records where
 already committed. It is thus possible for slow producers to temporarily hold
 off submitted records, that were reserved later.
 
-Reservation/commit/consumer protocol is verified by litmus tests in
-Documentation/litmus_tests/bpf-rb/_.
-
 One interesting implementation bit, that significantly simplifies (and thus
 speeds up as well) implementation of both producers and consumers is how data
 area is mapped twice contiguously back-to-back in the virtual memory. This
@@ -200,7 +197,7 @@ a self-pacing notifications of new data being availability.
 being available after commit only if consumer has already caught up right up to
 the record being committed. If not, consumer still has to catch up and thus
 will see new data anyways without needing an extra poll notification.
-Benchmarks (see tools/testing/selftests/bpf/benchs/bench_ringbuf.c_) show that
+Benchmarks (see tools/testing/selftests/bpf/benchs/bench_ringbufs.c) show that
 this allows to achieve a very high throughput without having to resort to
 tricks like "notify only every Nth sample", which are necessary with perf
 buffer. For extreme cases, when BPF program wants more manual control of
index 17e4f20..6834f5e 100644 (file)
@@ -23,7 +23,7 @@ properties:
   compatible:
     items:
       - const: raspberrypi,bcm2835-firmware
-      - const: simple-bus
+      - const: simple-mfd
 
   mboxes:
     $ref: '/schemas/types.yaml#/definitions/phandle'
@@ -57,7 +57,7 @@ required:
 examples:
   - |
     firmware {
-        compatible = "raspberrypi,bcm2835-firmware", "simple-bus";
+        compatible = "raspberrypi,bcm2835-firmware", "simple-mfd";
         mboxes = <&mailbox>;
 
         firmware_clocks: clocks {
index 3385694..9299028 100644 (file)
@@ -8,7 +8,7 @@ Properties:
 - compatible
        Usage:          required
        Value type:     <string>
-       Definition:     must be "qcom,cpufreq-hw".
+       Definition:     must be "qcom,cpufreq-hw" or "qcom,cpufreq-epss".
 
 - clocks
        Usage:          required
index 85ef69f..1465c9e 100644 (file)
@@ -67,7 +67,7 @@ examples:
 
     main_crypto: crypto@4e00000 {
         compatible = "ti,j721-sa2ul";
-        reg = <0x0 0x4e00000 0x0 0x1200>;
+        reg = <0x4e00000 0x1200>;
         power-domains = <&k3_pds 264 TI_SCI_PD_EXCLUSIVE>;
         dmas = <&main_udmap 0xc000>, <&main_udmap 0x4000>,
                <&main_udmap 0x4001>;
index 52a939c..7b9d468 100644 (file)
@@ -145,10 +145,10 @@ examples:
 
     display@fd4a0000 {
         compatible = "xlnx,zynqmp-dpsub-1.7";
-        reg = <0x0 0xfd4a0000 0x0 0x1000>,
-              <0x0 0xfd4aa000 0x0 0x1000>,
-              <0x0 0xfd4ab000 0x0 0x1000>,
-              <0x0 0xfd4ac000 0x0 0x1000>;
+        reg = <0xfd4a0000 0x1000>,
+              <0xfd4aa000 0x1000>,
+              <0xfd4ab000 0x1000>,
+              <0xfd4ac000 0x1000>;
         reg-names = "dp", "blend", "av_buf", "aud";
         interrupts = <0 119 4>;
         interrupt-parent = <&gic>;
index 5de510f..2a595b1 100644 (file)
@@ -57,7 +57,7 @@ examples:
 
     dma: dma-controller@fd4c0000 {
       compatible = "xlnx,zynqmp-dpdma";
-      reg = <0x0 0xfd4c0000 0x0 0x1000>;
+      reg = <0xfd4c0000 0x1000>;
       interrupts = <GIC_SPI 122 IRQ_TYPE_LEVEL_HIGH>;
       interrupt-parent = <&gic>;
       clocks = <&dpdma_clk>;
index d4d8391..be329ea 100644 (file)
@@ -20,8 +20,9 @@ Required properties:
 - gpio-controller : Marks the device node as a GPIO controller
 - interrupts : Interrupt specifier, see interrupt-controller/interrupts.txt
 - interrupt-controller : Mark the GPIO controller as an interrupt-controller
-- ngpios : number of GPIO lines, see gpio.txt
-  (should be multiple of 8, up to 80 pins)
+- ngpios : number of *hardware* GPIO lines, see gpio.txt. This will expose
+  2 software GPIOs per hardware GPIO: one for hardware input, one for hardware
+  output. Up to 80 pins, must be a multiple of 8.
 - clocks : A phandle to the APB clock for SGPM clock division
 - bus-frequency : SGPM CLK frequency
 
index 24ad144..fe7fa25 100644 (file)
@@ -30,7 +30,7 @@ properties:
     const: 0
 
 patternProperties:
-  "^multi-led[0-9a-f]$":
+  "^multi-led@[0-9a-b]$":
     type: object
     allOf:
       - $ref: leds-class-multicolor.yaml#
diff --git a/Documentation/devicetree/bindings/media/i2c/imx274.txt b/Documentation/devicetree/bindings/media/i2c/imx274.txt
deleted file mode 100644 (file)
index 0727079..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-* Sony 1/2.5-Inch 8.51Mp CMOS Digital Image Sensor
-
-The Sony imx274 is a 1/2.5-inch CMOS active pixel digital image sensor with
-an active array size of 3864H x 2202V. It is programmable through I2C
-interface. The I2C address is fixed to 0x1a as per sensor data sheet.
-Image data is sent through MIPI CSI-2, which is configured as 4 lanes
-at 1440 Mbps.
-
-
-Required Properties:
-- compatible: value should be "sony,imx274" for imx274 sensor
-- reg: I2C bus address of the device
-
-Optional Properties:
-- reset-gpios: Sensor reset GPIO
-- clocks: Reference to the input clock.
-- clock-names: Should be "inck".
-- VANA-supply: Sensor 2.8v analog supply.
-- VDIG-supply: Sensor 1.8v digital core supply.
-- VDDL-supply: Sensor digital IO 1.2v supply.
-
-The imx274 device node should contain one 'port' child node with
-an 'endpoint' subnode. For further reading on port node refer to
-Documentation/devicetree/bindings/media/video-interfaces.txt.
-
-Example:
-       sensor@1a {
-               compatible = "sony,imx274";
-               reg = <0x1a>;
-               #address-cells = <1>;
-               #size-cells = <0>;
-               reset-gpios = <&gpio_sensor 0 0>;
-               port {
-                       sensor_out: endpoint {
-                               remote-endpoint = <&csiss_in>;
-                       };
-               };
-       };
diff --git a/Documentation/devicetree/bindings/media/i2c/sony,imx274.yaml b/Documentation/devicetree/bindings/media/i2c/sony,imx274.yaml
new file mode 100644 (file)
index 0000000..f697e1a
--- /dev/null
@@ -0,0 +1,76 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/media/i2c/sony,imx274.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Sony 1/2.5-Inch 8.51MP CMOS Digital Image Sensor
+
+maintainers:
+  - Leon Luo <leonl@leopardimaging.com>
+
+description: |
+  The Sony IMX274 is a 1/2.5-inch CMOS active pixel digital image sensor with an
+  active array size of 3864H x 2202V. It is programmable through I2C interface.
+  Image data is sent through MIPI CSI-2, which is configured as 4 lanes at 1440
+  Mbps.
+
+properties:
+  compatible:
+    const: sony,imx274
+
+  reg:
+    const: 0x1a
+
+  reset-gpios:
+    maxItems: 1
+
+  clocks:
+    maxItems: 1
+
+  clock-names:
+    const: inck
+
+  vana-supply:
+    description: Sensor 2.8 V analog supply.
+    maxItems: 1
+
+  vdig-supply:
+    description: Sensor 1.8 V digital core supply.
+    maxItems: 1
+
+  vddl-supply:
+    description: Sensor digital IO 1.2 V supply.
+    maxItems: 1
+
+  port:
+    type: object
+    description: Output video port. See ../video-interfaces.txt.
+
+required:
+  - compatible
+  - reg
+  - port
+
+additionalProperties: false
+
+examples:
+  - |
+    i2c0 {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        imx274: camera-sensor@1a {
+            compatible = "sony,imx274";
+            reg = <0x1a>;
+            reset-gpios = <&gpio_sensor 0 0>;
+
+            port {
+                sensor_out: endpoint {
+                    remote-endpoint = <&csiss_in>;
+                };
+            };
+        };
+    };
+
+...
index 9d16d41..9847dfe 100644 (file)
@@ -154,25 +154,27 @@ Optional properties:
 - opp-suspend: Marks the OPP to be used during device suspend. If multiple OPPs
   in the table have this, the OPP with highest opp-hz will be used.
 
-- opp-supported-hw: This enables us to select only a subset of OPPs from the
-  larger OPP table, based on what version of the hardware we are running on. We
-  still can't have multiple nodes with the same opp-hz value in OPP table.
-
-  It's a user defined array containing a hierarchy of hardware version numbers,
-  supported by the OPP. For example: a platform with hierarchy of three levels
-  of versions (A, B and C), this field should be like <X Y Z>, where X
-  corresponds to Version hierarchy A, Y corresponds to version hierarchy B and Z
-  corresponds to version hierarchy C.
-
-  Each level of hierarchy is represented by a 32 bit value, and so there can be
-  only 32 different supported version per hierarchy. i.e. 1 bit per version. A
-  value of 0xFFFFFFFF will enable the OPP for all versions for that hierarchy
-  level. And a value of 0x00000000 will disable the OPP completely, and so we
-  never want that to happen.
-
-  If 32 values aren't sufficient for a version hierarchy, than that version
-  hierarchy can be contained in multiple 32 bit values. i.e. <X Y Z1 Z2> in the
-  above example, Z1 & Z2 refer to the version hierarchy Z.
+- opp-supported-hw: This property allows a platform to enable only a subset of
+  the OPPs from the larger set present in the OPP table, based on the current
+  version of the hardware (already known to the operating system).
+
+  Each block present in the array of blocks in this property, represents a
+  sub-group of hardware versions supported by the OPP. i.e. <sub-group A>,
+  <sub-group B>, etc. The OPP will be enabled if _any_ of these sub-groups match
+  the hardware's version.
+
+  Each sub-group is a platform defined array representing the hierarchy of
+  hardware versions supported by the platform. For a platform with three
+  hierarchical levels of version (X.Y.Z), this field shall look like
+
+  opp-supported-hw = <X1 Y1 Z1>, <X2 Y2 Z2>, <X3 Y3 Z3>.
+
+  Each level (eg. X1) in version hierarchy is represented by a 32 bit value, one
+  bit per version and so there can be maximum 32 versions per level. Logical AND
+  (&) operation is performed for each level with the hardware's level version
+  and a non-zero output for _all_ the levels in a sub-group means the OPP is
+  supported by hardware. A value of 0xFFFFFFFF for each level in the sub-group
+  will enable the OPP for all versions for the hardware.
 
 - status: Marks the node enabled/disabled.
 
@@ -503,7 +505,6 @@ Example 5: opp-supported-hw
                         */
                        opp-supported-hw = <0xF 0xFFFFFFFF 0xFFFFFFFF>
                        opp-hz = /bits/ 64 <600000000>;
-                       opp-microvolt = <915000 900000 925000>;
                        ...
                };
 
@@ -516,7 +517,17 @@ Example 5: opp-supported-hw
                         */
                        opp-supported-hw = <0x20 0xff0000ff 0x0000f4f0>
                        opp-hz = /bits/ 64 <800000000>;
-                       opp-microvolt = <915000 900000 925000>;
+                       ...
+               };
+
+               opp-900000000 {
+                       /*
+                        * Supports:
+                        * - All cuts and substrate where process version is 0x2.
+                        * - All cuts and process where substrate version is 0x2.
+                        */
+                       opp-supported-hw = <0xFFFFFFFF 0xFFFFFFFF 0x02>, <0xFFFFFFFF 0x01 0xFFFFFFFF>
+                       opp-hz = /bits/ 64 <900000000>;
                        ...
                };
        };
index 334df75..dae90c2 100644 (file)
@@ -39,10 +39,10 @@ which can help simplify cross compiling. ::
        ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- make CC=clang
 
 ``CROSS_COMPILE`` is not used to prefix the Clang compiler binary, instead
-``CROSS_COMPILE`` is used to set a command line flag: ``--target <triple>``. For
+``CROSS_COMPILE`` is used to set a command line flag: ``--target=<triple>``. For
 example: ::
 
-       clang --target aarch64-linux-gnu foo.c
+       clang --target=aarch64-linux-gnu foo.c
 
 LLVM Utilities
 --------------
index d53bcb3..b5a7988 100644 (file)
@@ -206,6 +206,7 @@ Userspace to kernel:
   ``ETHTOOL_MSG_TSINFO_GET``           get timestamping info
   ``ETHTOOL_MSG_CABLE_TEST_ACT``        action start cable test
   ``ETHTOOL_MSG_CABLE_TEST_TDR_ACT``    action start raw TDR cable test
+  ``ETHTOOL_MSG_TUNNEL_INFO_GET``       get tunnel offload info
   ===================================== ================================
 
 Kernel to userspace:
@@ -239,6 +240,7 @@ Kernel to userspace:
   ``ETHTOOL_MSG_TSINFO_GET_REPLY``     timestamping info
   ``ETHTOOL_MSG_CABLE_TEST_NTF``        Cable test results
   ``ETHTOOL_MSG_CABLE_TEST_TDR_NTF``    Cable test TDR results
+  ``ETHTOOL_MSG_TUNNEL_INFO_GET_REPLY`` tunnel offload info
   ===================================== =================================
 
 ``GET`` requests are sent by userspace applications to retrieve device
@@ -1363,4 +1365,5 @@ are netlink only.
   ``ETHTOOL_SFECPARAM``               n/a
   n/a                                 ''ETHTOOL_MSG_CABLE_TEST_ACT''
   n/a                                 ''ETHTOOL_MSG_CABLE_TEST_TDR_ACT''
+  n/a                                 ``ETHTOOL_MSG_TUNNEL_INFO_GET``
   =================================== =====================================
index 57e752a..2044ed1 100644 (file)
@@ -701,23 +701,6 @@ Memory Consistency Flags
     :stub-columns: 0
     :widths:       3 1 4
 
-    * .. _`V4L2-FLAG-MEMORY-NON-CONSISTENT`:
-
-      - ``V4L2_FLAG_MEMORY_NON_CONSISTENT``
-      - 0x00000001
-      - A buffer is allocated either in consistent (it will be automatically
-       coherent between the CPU and the bus) or non-consistent memory. The
-       latter can provide performance gains, for instance the CPU cache
-       sync/flush operations can be avoided if the buffer is accessed by the
-       corresponding device only and the CPU does not read/write to/from that
-       buffer. However, this requires extra care from the driver -- it must
-       guarantee memory consistency by issuing a cache flush/sync when
-       consistency is needed. If this flag is set V4L2 will attempt to
-       allocate the buffer in non-consistent memory. The flag takes effect
-       only if the buffer is used for :ref:`memory mapping <mmap>` I/O and the
-       queue reports the :ref:`V4L2_BUF_CAP_SUPPORTS_MMAP_CACHE_HINTS
-       <V4L2-BUF-CAP-SUPPORTS-MMAP-CACHE-HINTS>` capability.
-
 .. c:type:: v4l2_memory
 
 enum v4l2_memory
index f2a7028..12cf6b4 100644 (file)
@@ -120,13 +120,9 @@ than the number requested.
        If you want to just query the capabilities without making any
        other changes, then set ``count`` to 0, ``memory`` to
        ``V4L2_MEMORY_MMAP`` and ``format.type`` to the buffer type.
-    * - __u32
-      - ``flags``
-      - Specifies additional buffer management attributes.
-       See :ref:`memory-flags`.
 
     * - __u32
-      - ``reserved``\ [6]
+      - ``reserved``\ [7]
       - A place holder for future extensions. Drivers and applications
        must set the array to zero.
 
index 75d894d..0e3e2fd 100644 (file)
@@ -112,17 +112,10 @@ aborting or finishing any DMA in progress, an implicit
        ``V4L2_MEMORY_MMAP`` and ``type`` set to the buffer type. This will
        free any previously allocated buffers, so this is typically something
        that will be done at the start of the application.
-    * - union {
-      - (anonymous)
-    * - __u32
-      - ``flags``
-      - Specifies additional buffer management attributes.
-       See :ref:`memory-flags`.
     * - __u32
       - ``reserved``\ [1]
-      - Kept for backwards compatibility. Use ``flags`` instead.
-    * - }
-      -
+      - A place holder for future extensions. Drivers and applications
+       must set the array to zero.
 
 .. tabularcolumns:: |p{6.1cm}|p{2.2cm}|p{8.7cm}|
 
@@ -169,7 +162,6 @@ aborting or finishing any DMA in progress, an implicit
       - This capability is set by the driver to indicate that the queue supports
         cache and memory management hints. However, it's only valid when the
         queue is used for :ref:`memory mapping <mmap>` streaming I/O. See
-        :ref:`V4L2_FLAG_MEMORY_NON_CONSISTENT <V4L2-FLAG-MEMORY-NON-CONSISTENT>`,
         :ref:`V4L2_BUF_FLAG_NO_CACHE_INVALIDATE <V4L2-BUF-FLAG-NO-CACHE-INVALIDATE>` and
         :ref:`V4L2_BUF_FLAG_NO_CACHE_CLEAN <V4L2-BUF-FLAG-NO-CACHE-CLEAN>`.
 
index d2b733d..51191b5 100644 (file)
@@ -6173,3 +6173,23 @@ specific interfaces must be consistent, i.e. if one says the feature
 is supported, than the other should as well and vice versa.  For arm64
 see Documentation/virt/kvm/devices/vcpu.rst "KVM_ARM_VCPU_PVTIME_CTRL".
 For x86 see Documentation/virt/kvm/msr.rst "MSR_KVM_STEAL_TIME".
+
+8.25 KVM_CAP_S390_DIAG318
+-------------------------
+
+:Architectures: s390
+
+This capability enables a guest to set information about its control program
+(i.e. guest kernel type and version). The information is helpful during
+system/firmware service events, providing additional data about the guest
+environments running on the machine.
+
+The information is associated with the DIAGNOSE 0x318 instruction, which sets
+an 8-byte value consisting of a one-byte Control Program Name Code (CPNC) and
+a 7-byte Control Program Version Code (CPVC). The CPNC determines what
+environment the control program is running in (e.g. Linux, z/VM...), and the
+CPVC is used for information specific to OS (e.g. Linux version, Linux
+distribution...)
+
+If this capability is available, then the CPNC and CPVC can be synchronized
+between KVM and userspace via the sync regs mechanism (KVM_SYNC_DIAG318).
index d746519..33b27e6 100644 (file)
@@ -4408,12 +4408,6 @@ T:       git git://git.infradead.org/users/hch/configfs.git
 F:     fs/configfs/
 F:     include/linux/configfs.h
 
-CONNECTOR
-M:     Evgeniy Polyakov <zbr@ioremap.net>
-L:     netdev@vger.kernel.org
-S:     Maintained
-F:     drivers/connector/
-
 CONSOLE SUBSYSTEM
 M:     Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 S:     Supported
@@ -8329,8 +8323,9 @@ S:        Supported
 F:     drivers/pci/hotplug/rpaphp*
 
 IBM Power SRIOV Virtual NIC Device Driver
-M:     Thomas Falcon <tlfalcon@linux.ibm.com>
-M:     John Allen <jallen@linux.ibm.com>
+M:     Dany Madden <drt@linux.ibm.com>
+M:     Lijun Pan <ljp@linux.ibm.com>
+M:     Sukadev Bhattiprolu <sukadev@linux.ibm.com>
 L:     netdev@vger.kernel.org
 S:     Supported
 F:     drivers/net/ethernet/ibm/ibmvnic.*
@@ -8344,7 +8339,7 @@ F:        arch/powerpc/platforms/powernv/copy-paste.h
 F:     arch/powerpc/platforms/powernv/vas*
 
 IBM Power Virtual Ethernet Device Driver
-M:     Thomas Falcon <tlfalcon@linux.ibm.com>
+M:     Cristobal Forno <cforno12@linux.ibm.com>
 L:     netdev@vger.kernel.org
 S:     Supported
 F:     drivers/net/ethernet/ibm/ibmveth.*
@@ -11042,6 +11037,7 @@ F:      drivers/char/hw_random/mtk-rng.c
 
 MEDIATEK SWITCH DRIVER
 M:     Sean Wang <sean.wang@mediatek.com>
+M:     Landen Chao <Landen.Chao@mediatek.com>
 L:     netdev@vger.kernel.org
 S:     Maintained
 F:     drivers/net/dsa/mt7530.*
@@ -12055,6 +12051,7 @@ Q:      http://patchwork.ozlabs.org/project/netdev/list/
 T:     git git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git
 T:     git git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git
 F:     Documentation/devicetree/bindings/net/
+F:     drivers/connector/
 F:     drivers/net/
 F:     include/linux/etherdevice.h
 F:     include/linux/fcdevice.h
@@ -13185,6 +13182,7 @@ F:      drivers/firmware/pcdp.*
 
 PCI DRIVER FOR AARDVARK (Marvell Armada 3700)
 M:     Thomas Petazzoni <thomas.petazzoni@bootlin.com>
+M:     Pali Rohár <pali@kernel.org>
 L:     linux-pci@vger.kernel.org
 L:     linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
 S:     Maintained
@@ -16157,7 +16155,7 @@ M:      Leon Luo <leonl@leopardimaging.com>
 L:     linux-media@vger.kernel.org
 S:     Maintained
 T:     git git://linuxtv.org/media_tree.git
-F:     Documentation/devicetree/bindings/media/i2c/imx274.txt
+F:     Documentation/devicetree/bindings/media/i2c/sony,imx274.yaml
 F:     drivers/media/i2c/imx274.c
 
 SONY IMX290 SENSOR DRIVER
index 2b66d33..f84d7e4 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,7 @@
 VERSION = 5
 PATCHLEVEL = 9
 SUBLEVEL = 0
-EXTRAVERSION = -rc6
+EXTRAVERSION = -rc8
 NAME = Kleptomaniac Octopus
 
 # *DOCUMENTATION*
index 8d19925..6783cf1 100644 (file)
                switch0: ksz8563@0 {
                        compatible = "microchip,ksz8563";
                        reg = <0>;
-                       phy-mode = "mii";
                        reset-gpios = <&pioA PIN_PD4 GPIO_ACTIVE_LOW>;
 
                        spi-max-frequency = <500000>;
                                        reg = <2>;
                                        label = "cpu";
                                        ethernet = <&macb0>;
+                                       phy-mode = "mii";
                                        fixed-link {
                                                speed = <100>;
                                                full-duplex;
index f7ae5a4..d94357b 100644 (file)
@@ -13,7 +13,7 @@
 
        soc {
                firmware: firmware {
-                       compatible = "raspberrypi,bcm2835-firmware", "simple-bus";
+                       compatible = "raspberrypi,bcm2835-firmware", "simple-mfd";
                        #address-cells = <1>;
                        #size-cells = <1>;
 
index dce85d3..6f3e8c5 100644 (file)
                        opp-microvolt = <800000 800000 1125000>;
                };
 
-               opp@456000000,800,2,2 {
-                       opp-microvolt = <800000 800000 1125000>;
-               };
-
-               opp@456000000,800,3,2 {
-                       opp-microvolt = <800000 800000 1125000>;
-               };
-
                opp@456000000,825 {
                        opp-microvolt = <825000 825000 1125000>;
                };
                        opp-microvolt = <800000 800000 1125000>;
                };
 
-               opp@608000000,800,3,2 {
-                       opp-microvolt = <800000 800000 1125000>;
-               };
-
                opp@608000000,825 {
                        opp-microvolt = <825000 825000 1125000>;
                };
                        opp-microvolt = <875000 875000 1125000>;
                };
 
-               opp@760000000,875,1,1 {
-                       opp-microvolt = <875000 875000 1125000>;
-               };
-
-               opp@760000000,875,0,2 {
-                       opp-microvolt = <875000 875000 1125000>;
-               };
-
-               opp@760000000,875,1,2 {
-                       opp-microvolt = <875000 875000 1125000>;
-               };
-
                opp@760000000,900 {
                        opp-microvolt = <900000 900000 1125000>;
                };
                        opp-microvolt = <950000 950000 1125000>;
                };
 
-               opp@912000000,950,0,2 {
-                       opp-microvolt = <950000 950000 1125000>;
-               };
-
-               opp@912000000,950,2,2 {
-                       opp-microvolt = <950000 950000 1125000>;
-               };
-
                opp@912000000,1000 {
                        opp-microvolt = <1000000 1000000 1125000>;
                };
                        opp-microvolt = <1000000 1000000 1125000>;
                };
 
-               opp@1000000000,1000,0,2 {
-                       opp-microvolt = <1000000 1000000 1125000>;
-               };
-
                opp@1000000000,1025 {
                        opp-microvolt = <1025000 1025000 1125000>;
                };
index 9b8fedb..702a635 100644 (file)
 
                opp@456000000,800 {
                        clock-latency-ns = <400000>;
-                       opp-supported-hw = <0x03 0x0006>;
-                       opp-hz = /bits/ 64 <456000000>;
-               };
-
-               opp@456000000,800,2,2 {
-                       clock-latency-ns = <400000>;
-                       opp-supported-hw = <0x04 0x0004>;
-                       opp-hz = /bits/ 64 <456000000>;
-               };
-
-               opp@456000000,800,3,2 {
-                       clock-latency-ns = <400000>;
-                       opp-supported-hw = <0x08 0x0004>;
+                       opp-supported-hw = <0x03 0x0006>, <0x04 0x0004>,
+                                          <0x08 0x0004>;
                        opp-hz = /bits/ 64 <456000000>;
                };
 
 
                opp@608000000,800 {
                        clock-latency-ns = <400000>;
-                       opp-supported-hw = <0x04 0x0006>;
-                       opp-hz = /bits/ 64 <608000000>;
-               };
-
-               opp@608000000,800,3,2 {
-                       clock-latency-ns = <400000>;
-                       opp-supported-hw = <0x08 0x0004>;
+                       opp-supported-hw = <0x04 0x0006>, <0x08 0x0004>;
                        opp-hz = /bits/ 64 <608000000>;
                };
 
 
                opp@760000000,875 {
                        clock-latency-ns = <400000>;
-                       opp-supported-hw = <0x04 0x0001>;
-                       opp-hz = /bits/ 64 <760000000>;
-               };
-
-               opp@760000000,875,1,1 {
-                       clock-latency-ns = <400000>;
-                       opp-supported-hw = <0x02 0x0002>;
-                       opp-hz = /bits/ 64 <760000000>;
-               };
-
-               opp@760000000,875,0,2 {
-                       clock-latency-ns = <400000>;
-                       opp-supported-hw = <0x01 0x0004>;
-                       opp-hz = /bits/ 64 <760000000>;
-               };
-
-               opp@760000000,875,1,2 {
-                       clock-latency-ns = <400000>;
-                       opp-supported-hw = <0x02 0x0004>;
+                       opp-supported-hw = <0x04 0x0001>, <0x02 0x0002>,
+                                          <0x01 0x0004>, <0x02 0x0004>;
                        opp-hz = /bits/ 64 <760000000>;
                };
 
 
                opp@912000000,950 {
                        clock-latency-ns = <400000>;
-                       opp-supported-hw = <0x02 0x0006>;
-                       opp-hz = /bits/ 64 <912000000>;
-               };
-
-               opp@912000000,950,0,2 {
-                       clock-latency-ns = <400000>;
-                       opp-supported-hw = <0x01 0x0004>;
-                       opp-hz = /bits/ 64 <912000000>;
-               };
-
-               opp@912000000,950,2,2 {
-                       clock-latency-ns = <400000>;
-                       opp-supported-hw = <0x04 0x0004>;
+                       opp-supported-hw = <0x02 0x0006>, <0x01 0x0004>,
+                                          <0x04 0x0004>;
                        opp-hz = /bits/ 64 <912000000>;
                };
 
 
                opp@1000000000,1000 {
                        clock-latency-ns = <400000>;
-                       opp-supported-hw = <0x02 0x0006>;
-                       opp-hz = /bits/ 64 <1000000000>;
-               };
-
-               opp@1000000000,1000,0,2 {
-                       clock-latency-ns = <400000>;
-                       opp-supported-hw = <0x01 0x0004>;
+                       opp-supported-hw = <0x02 0x0006>, <0x01 0x0004>;
                        opp-hz = /bits/ 64 <1000000000>;
                };
 
index d682f74..1be715d 100644 (file)
                        opp-microvolt = <850000 850000 1250000>;
                };
 
-               opp@475000000,850,0,1 {
-                       opp-microvolt = <850000 850000 1250000>;
-               };
-
-               opp@475000000,850,0,4 {
-                       opp-microvolt = <850000 850000 1250000>;
-               };
-
-               opp@475000000,850,0,7 {
-                       opp-microvolt = <850000 850000 1250000>;
-               };
-
-               opp@475000000,850,0,8 {
-                       opp-microvolt = <850000 850000 1250000>;
-               };
-
                opp@608000000,850 {
                        opp-microvolt = <850000 850000 1250000>;
                };
                        opp-microvolt = <850000 850000 1250000>;
                };
 
-               opp@640000000,850,1,1 {
-                       opp-microvolt = <850000 850000 1250000>;
-               };
-
-               opp@640000000,850,2,1 {
-                       opp-microvolt = <850000 850000 1250000>;
-               };
-
-               opp@640000000,850,3,1 {
-                       opp-microvolt = <850000 850000 1250000>;
-               };
-
-               opp@640000000,850,1,4 {
-                       opp-microvolt = <850000 850000 1250000>;
-               };
-
-               opp@640000000,850,2,4 {
-                       opp-microvolt = <850000 850000 1250000>;
-               };
-
-               opp@640000000,850,3,4 {
-                       opp-microvolt = <850000 850000 1250000>;
-               };
-
-               opp@640000000,850,1,7 {
-                       opp-microvolt = <850000 850000 1250000>;
-               };
-
-               opp@640000000,850,2,7 {
-                       opp-microvolt = <850000 850000 1250000>;
-               };
-
-               opp@640000000,850,3,7 {
-                       opp-microvolt = <850000 850000 1250000>;
-               };
-
-               opp@640000000,850,4,7 {
-                       opp-microvolt = <850000 850000 1250000>;
-               };
-
-               opp@640000000,850,1,8 {
-                       opp-microvolt = <850000 850000 1250000>;
-               };
-
-               opp@640000000,850,2,8 {
-                       opp-microvolt = <850000 850000 1250000>;
-               };
-
-               opp@640000000,850,3,8 {
-                       opp-microvolt = <850000 850000 1250000>;
-               };
-
-               opp@640000000,850,4,8 {
-                       opp-microvolt = <850000 850000 1250000>;
-               };
-
                opp@640000000,900 {
                        opp-microvolt = <900000 900000 1250000>;
                };
                        opp-microvolt = <850000 850000 1250000>;
                };
 
-               opp@760000000,850,3,1 {
-                       opp-microvolt = <850000 850000 1250000>;
-               };
-
-               opp@760000000,850,3,2 {
-                       opp-microvolt = <850000 850000 1250000>;
-               };
-
-               opp@760000000,850,3,3 {
-                       opp-microvolt = <850000 850000 1250000>;
-               };
-
-               opp@760000000,850,3,4 {
-                       opp-microvolt = <850000 850000 1250000>;
-               };
-
-               opp@760000000,850,3,7 {
-                       opp-microvolt = <850000 850000 1250000>;
-               };
-
-               opp@760000000,850,4,7 {
-                       opp-microvolt = <850000 850000 1250000>;
-               };
-
-               opp@760000000,850,3,8 {
-                       opp-microvolt = <850000 850000 1250000>;
-               };
-
-               opp@760000000,850,4,8 {
-                       opp-microvolt = <850000 850000 1250000>;
-               };
-
-               opp@760000000,850,0,10 {
-                       opp-microvolt = <850000 850000 1250000>;
-               };
-
                opp@760000000,900 {
                        opp-microvolt = <900000 900000 1250000>;
                };
 
-               opp@760000000,900,1,1 {
-                       opp-microvolt = <900000 900000 1250000>;
-               };
-
-               opp@760000000,900,2,1 {
-                       opp-microvolt = <900000 900000 1250000>;
-               };
-
-               opp@760000000,900,1,2 {
-                       opp-microvolt = <900000 900000 1250000>;
-               };
-
-               opp@760000000,900,2,2 {
-                       opp-microvolt = <900000 900000 1250000>;
-               };
-
-               opp@760000000,900,1,3 {
-                       opp-microvolt = <900000 900000 1250000>;
-               };
-
-               opp@760000000,900,2,3 {
-                       opp-microvolt = <900000 900000 1250000>;
-               };
-
-               opp@760000000,900,1,4 {
-                       opp-microvolt = <900000 900000 1250000>;
-               };
-
-               opp@760000000,900,2,4 {
-                       opp-microvolt = <900000 900000 1250000>;
-               };
-
-               opp@760000000,900,1,7 {
-                       opp-microvolt = <900000 900000 1250000>;
-               };
-
-               opp@760000000,900,2,7 {
-                       opp-microvolt = <900000 900000 1250000>;
-               };
-
-               opp@760000000,900,1,8 {
-                       opp-microvolt = <900000 900000 1250000>;
-               };
-
-               opp@760000000,900,2,8 {
-                       opp-microvolt = <900000 900000 1250000>;
-               };
-
                opp@760000000,912 {
                        opp-microvolt = <912000 912000 1250000>;
                };
                        opp-microvolt = <900000 900000 1250000>;
                };
 
-               opp@860000000,900,2,1 {
-                       opp-microvolt = <900000 900000 1250000>;
-               };
-
-               opp@860000000,900,3,1 {
-                       opp-microvolt = <900000 900000 1250000>;
-               };
-
-               opp@860000000,900,2,2 {
-                       opp-microvolt = <900000 900000 1250000>;
-               };
-
-               opp@860000000,900,3,2 {
-                       opp-microvolt = <900000 900000 1250000>;
-               };
-
-               opp@860000000,900,2,3 {
-                       opp-microvolt = <900000 900000 1250000>;
-               };
-
-               opp@860000000,900,3,3 {
-                       opp-microvolt = <900000 900000 1250000>;
-               };
-
-               opp@860000000,900,2,4 {
-                       opp-microvolt = <900000 900000 1250000>;
-               };
-
-               opp@860000000,900,3,4 {
-                       opp-microvolt = <900000 900000 1250000>;
-               };
-
-               opp@860000000,900,2,7 {
-                       opp-microvolt = <900000 900000 1250000>;
-               };
-
-               opp@860000000,900,3,7 {
-                       opp-microvolt = <900000 900000 1250000>;
-               };
-
-               opp@860000000,900,4,7 {
-                       opp-microvolt = <900000 900000 1250000>;
-               };
-
-               opp@860000000,900,2,8 {
-                       opp-microvolt = <900000 900000 1250000>;
-               };
-
-               opp@860000000,900,3,8 {
-                       opp-microvolt = <900000 900000 1250000>;
-               };
-
-               opp@860000000,900,4,8 {
-                       opp-microvolt = <900000 900000 1250000>;
-               };
-
                opp@860000000,975 {
                        opp-microvolt = <975000 975000 1250000>;
                };
 
-               opp@860000000,975,1,1 {
-                       opp-microvolt = <975000 975000 1250000>;
-               };
-
-               opp@860000000,975,1,2 {
-                       opp-microvolt = <975000 975000 1250000>;
-               };
-
-               opp@860000000,975,1,3 {
-                       opp-microvolt = <975000 975000 1250000>;
-               };
-
-               opp@860000000,975,1,4 {
-                       opp-microvolt = <975000 975000 1250000>;
-               };
-
-               opp@860000000,975,1,7 {
-                       opp-microvolt = <975000 975000 1250000>;
-               };
-
-               opp@860000000,975,1,8 {
-                       opp-microvolt = <975000 975000 1250000>;
-               };
-
                opp@860000000,1000 {
                        opp-microvolt = <1000000 1000000 1250000>;
                };
                        opp-microvolt = <975000 975000 1250000>;
                };
 
-               opp@1000000000,975,2,1 {
-                       opp-microvolt = <975000 975000 1250000>;
-               };
-
-               opp@1000000000,975,3,1 {
-                       opp-microvolt = <975000 975000 1250000>;
-               };
-
-               opp@1000000000,975,2,2 {
-                       opp-microvolt = <975000 975000 1250000>;
-               };
-
-               opp@1000000000,975,3,2 {
-                       opp-microvolt = <975000 975000 1250000>;
-               };
-
-               opp@1000000000,975,2,3 {
-                       opp-microvolt = <975000 975000 1250000>;
-               };
-
-               opp@1000000000,975,3,3 {
-                       opp-microvolt = <975000 975000 1250000>;
-               };
-
-               opp@1000000000,975,2,4 {
-                       opp-microvolt = <975000 975000 1250000>;
-               };
-
-               opp@1000000000,975,3,4 {
-                       opp-microvolt = <975000 975000 1250000>;
-               };
-
-               opp@1000000000,975,2,7 {
-                       opp-microvolt = <975000 975000 1250000>;
-               };
-
-               opp@1000000000,975,3,7 {
-                       opp-microvolt = <975000 975000 1250000>;
-               };
-
-               opp@1000000000,975,4,7 {
-                       opp-microvolt = <975000 975000 1250000>;
-               };
-
-               opp@1000000000,975,2,8 {
-                       opp-microvolt = <975000 975000 1250000>;
-               };
-
-               opp@1000000000,975,3,8 {
-                       opp-microvolt = <975000 975000 1250000>;
-               };
-
-               opp@1000000000,975,4,8 {
-                       opp-microvolt = <975000 975000 1250000>;
-               };
-
                opp@1000000000,1000 {
                        opp-microvolt = <1000000 1000000 1250000>;
                };
                        opp-microvolt = <975000 975000 1250000>;
                };
 
-               opp@1100000000,975,3,1 {
-                       opp-microvolt = <975000 975000 1250000>;
-               };
-
-               opp@1100000000,975,3,2 {
-                       opp-microvolt = <975000 975000 1250000>;
-               };
-
-               opp@1100000000,975,3,3 {
-                       opp-microvolt = <975000 975000 1250000>;
-               };
-
-               opp@1100000000,975,3,4 {
-                       opp-microvolt = <975000 975000 1250000>;
-               };
-
-               opp@1100000000,975,3,7 {
-                       opp-microvolt = <975000 975000 1250000>;
-               };
-
-               opp@1100000000,975,4,7 {
-                       opp-microvolt = <975000 975000 1250000>;
-               };
-
-               opp@1100000000,975,3,8 {
-                       opp-microvolt = <975000 975000 1250000>;
-               };
-
-               opp@1100000000,975,4,8 {
-                       opp-microvolt = <975000 975000 1250000>;
-               };
-
                opp@1100000000,1000 {
                        opp-microvolt = <1000000 1000000 1250000>;
                };
 
-               opp@1100000000,1000,2,1 {
-                       opp-microvolt = <1000000 1000000 1250000>;
-               };
-
-               opp@1100000000,1000,2,2 {
-                       opp-microvolt = <1000000 1000000 1250000>;
-               };
-
-               opp@1100000000,1000,2,3 {
-                       opp-microvolt = <1000000 1000000 1250000>;
-               };
-
-               opp@1100000000,1000,2,4 {
-                       opp-microvolt = <1000000 1000000 1250000>;
-               };
-
-               opp@1100000000,1000,2,7 {
-                       opp-microvolt = <1000000 1000000 1250000>;
-               };
-
-               opp@1100000000,1000,2,8 {
-                       opp-microvolt = <1000000 1000000 1250000>;
-               };
-
                opp@1100000000,1025 {
                        opp-microvolt = <1025000 1025000 1250000>;
                };
                        opp-microvolt = <1000000 1000000 1250000>;
                };
 
-               opp@1200000000,1000,3,1 {
-                       opp-microvolt = <1000000 1000000 1250000>;
-               };
-
-               opp@1200000000,1000,3,2 {
-                       opp-microvolt = <1000000 1000000 1250000>;
-               };
-
-               opp@1200000000,1000,3,3 {
-                       opp-microvolt = <1000000 1000000 1250000>;
-               };
-
-               opp@1200000000,1000,3,4 {
-                       opp-microvolt = <1000000 1000000 1250000>;
-               };
-
-               opp@1200000000,1000,3,7 {
-                       opp-microvolt = <1000000 1000000 1250000>;
-               };
-
-               opp@1200000000,1000,4,7 {
-                       opp-microvolt = <1000000 1000000 1250000>;
-               };
-
-               opp@1200000000,1000,3,8 {
-                       opp-microvolt = <1000000 1000000 1250000>;
-               };
-
-               opp@1200000000,1000,4,8 {
-                       opp-microvolt = <1000000 1000000 1250000>;
-               };
-
                opp@1200000000,1025 {
                        opp-microvolt = <1025000 1025000 1250000>;
                };
 
-               opp@1200000000,1025,2,1 {
-                       opp-microvolt = <1025000 1025000 1250000>;
-               };
-
-               opp@1200000000,1025,2,2 {
-                       opp-microvolt = <1025000 1025000 1250000>;
-               };
-
-               opp@1200000000,1025,2,3 {
-                       opp-microvolt = <1025000 1025000 1250000>;
-               };
-
-               opp@1200000000,1025,2,4 {
-                       opp-microvolt = <1025000 1025000 1250000>;
-               };
-
-               opp@1200000000,1025,2,7 {
-                       opp-microvolt = <1025000 1025000 1250000>;
-               };
-
-               opp@1200000000,1025,2,8 {
-                       opp-microvolt = <1025000 1025000 1250000>;
-               };
-
                opp@1200000000,1050 {
                        opp-microvolt = <1050000 1050000 1250000>;
                };
                        opp-microvolt = <1000000 1000000 1250000>;
                };
 
-               opp@1300000000,1000,4,7 {
-                       opp-microvolt = <1000000 1000000 1250000>;
-               };
-
-               opp@1300000000,1000,4,8 {
-                       opp-microvolt = <1000000 1000000 1250000>;
-               };
-
                opp@1300000000,1025 {
                        opp-microvolt = <1025000 1025000 1250000>;
                };
 
-               opp@1300000000,1025,3,1 {
-                       opp-microvolt = <1025000 1025000 1250000>;
-               };
-
-               opp@1300000000,1025,3,7 {
-                       opp-microvolt = <1025000 1025000 1250000>;
-               };
-
-               opp@1300000000,1025,3,8 {
-                       opp-microvolt = <1025000 1025000 1250000>;
-               };
-
                opp@1300000000,1050 {
                        opp-microvolt = <1050000 1050000 1250000>;
                };
 
-               opp@1300000000,1050,2,1 {
-                       opp-microvolt = <1050000 1050000 1250000>;
-               };
-
-               opp@1300000000,1050,3,2 {
-                       opp-microvolt = <1050000 1050000 1250000>;
-               };
-
-               opp@1300000000,1050,3,3 {
-                       opp-microvolt = <1050000 1050000 1250000>;
-               };
-
-               opp@1300000000,1050,3,4 {
-                       opp-microvolt = <1050000 1050000 1250000>;
-               };
-
-               opp@1300000000,1050,3,5 {
-                       opp-microvolt = <1050000 1050000 1250000>;
-               };
-
-               opp@1300000000,1050,3,6 {
-                       opp-microvolt = <1050000 1050000 1250000>;
-               };
-
-               opp@1300000000,1050,2,7 {
-                       opp-microvolt = <1050000 1050000 1250000>;
-               };
-
-               opp@1300000000,1050,2,8 {
-                       opp-microvolt = <1050000 1050000 1250000>;
-               };
-
-               opp@1300000000,1050,3,12 {
-                       opp-microvolt = <1050000 1050000 1250000>;
-               };
-
-               opp@1300000000,1050,3,13 {
-                       opp-microvolt = <1050000 1050000 1250000>;
-               };
-
                opp@1300000000,1075 {
                        opp-microvolt = <1075000 1075000 1250000>;
                };
 
-               opp@1300000000,1075,2,2 {
-                       opp-microvolt = <1075000 1075000 1250000>;
-               };
-
-               opp@1300000000,1075,2,3 {
-                       opp-microvolt = <1075000 1075000 1250000>;
-               };
-
-               opp@1300000000,1075,2,4 {
-                       opp-microvolt = <1075000 1075000 1250000>;
-               };
-
                opp@1300000000,1100 {
                        opp-microvolt = <1100000 1100000 1250000>;
                };
                        opp-microvolt = <1150000 1150000 1250000>;
                };
 
-               opp@1400000000,1150,2,4 {
-                       opp-microvolt = <1150000 1150000 1250000>;
-               };
-
                opp@1400000000,1175 {
                        opp-microvolt = <1175000 1175000 1250000>;
                };
                        opp-microvolt = <1125000 1125000 1250000>;
                };
 
-               opp@1500000000,1125,4,5 {
-                       opp-microvolt = <1125000 1125000 1250000>;
-               };
-
-               opp@1500000000,1125,4,6 {
-                       opp-microvolt = <1125000 1125000 1250000>;
-               };
-
-               opp@1500000000,1125,4,12 {
-                       opp-microvolt = <1125000 1125000 1250000>;
-               };
-
-               opp@1500000000,1125,4,13 {
-                       opp-microvolt = <1125000 1125000 1250000>;
-               };
-
                opp@1500000000,1150 {
                        opp-microvolt = <1150000 1150000 1250000>;
                };
 
-               opp@1500000000,1150,3,5 {
-                       opp-microvolt = <1150000 1150000 1250000>;
-               };
-
-               opp@1500000000,1150,3,6 {
-                       opp-microvolt = <1150000 1150000 1250000>;
-               };
-
-               opp@1500000000,1150,3,12 {
-                       opp-microvolt = <1150000 1150000 1250000>;
-               };
-
-               opp@1500000000,1150,3,13 {
-                       opp-microvolt = <1150000 1150000 1250000>;
-               };
-
                opp@1500000000,1200 {
                        opp-microvolt = <1200000 1200000 1250000>;
                };
index 8e434f6..0f71350 100644 (file)
 
                opp@475000000,850 {
                        clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x0F 0x0001>;
-                       opp-hz = /bits/ 64 <475000000>;
-               };
-
-               opp@475000000,850,0,1 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x01 0x0002>;
-                       opp-hz = /bits/ 64 <475000000>;
-               };
-
-               opp@475000000,850,0,4 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x01 0x0010>;
-                       opp-hz = /bits/ 64 <475000000>;
-               };
-
-               opp@475000000,850,0,7 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x01 0x0080>;
-                       opp-hz = /bits/ 64 <475000000>;
-               };
-
-               opp@475000000,850,0,8 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x01 0x0100>;
-                       opp-hz = /bits/ 64 <475000000>;
-               };
-
-               opp@608000000,850 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x1F 0x0400>;
-                       opp-hz = /bits/ 64 <608000000>;
-               };
-
-               opp@608000000,912 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x1F 0x0200>;
-                       opp-hz = /bits/ 64 <608000000>;
-               };
-
-               opp@620000000,850 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x1E 0x306C>;
-                       opp-hz = /bits/ 64 <620000000>;
-               };
-
-               opp@640000000,850 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x0F 0x0001>;
-                       opp-hz = /bits/ 64 <640000000>;
-               };
-
-               opp@640000000,850,1,1 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x02 0x0002>;
-                       opp-hz = /bits/ 64 <640000000>;
-               };
-
-               opp@640000000,850,2,1 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x04 0x0002>;
-                       opp-hz = /bits/ 64 <640000000>;
-               };
-
-               opp@640000000,850,3,1 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x08 0x0002>;
-                       opp-hz = /bits/ 64 <640000000>;
-               };
-
-               opp@640000000,850,1,4 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x02 0x0010>;
-                       opp-hz = /bits/ 64 <640000000>;
-               };
-
-               opp@640000000,850,2,4 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x04 0x0010>;
-                       opp-hz = /bits/ 64 <640000000>;
-               };
-
-               opp@640000000,850,3,4 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x08 0x0010>;
-                       opp-hz = /bits/ 64 <640000000>;
-               };
-
-               opp@640000000,850,1,7 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x02 0x0080>;
-                       opp-hz = /bits/ 64 <640000000>;
-               };
-
-               opp@640000000,850,2,7 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x04 0x0080>;
-                       opp-hz = /bits/ 64 <640000000>;
-               };
-
-               opp@640000000,850,3,7 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x08 0x0080>;
-                       opp-hz = /bits/ 64 <640000000>;
-               };
-
-               opp@640000000,850,4,7 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x10 0x0080>;
-                       opp-hz = /bits/ 64 <640000000>;
-               };
-
-               opp@640000000,850,1,8 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x02 0x0100>;
-                       opp-hz = /bits/ 64 <640000000>;
-               };
-
-               opp@640000000,850,2,8 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x04 0x0100>;
-                       opp-hz = /bits/ 64 <640000000>;
-               };
-
-               opp@640000000,850,3,8 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x08 0x0100>;
-                       opp-hz = /bits/ 64 <640000000>;
-               };
-
-               opp@640000000,850,4,8 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x10 0x0100>;
-                       opp-hz = /bits/ 64 <640000000>;
-               };
-
-               opp@640000000,900 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x01 0x0192>;
-                       opp-hz = /bits/ 64 <640000000>;
-               };
-
-               opp@760000000,850 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x1E 0x3461>;
-                       opp-hz = /bits/ 64 <760000000>;
-               };
-
-               opp@760000000,850,3,1 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x08 0x0002>;
-                       opp-hz = /bits/ 64 <760000000>;
-               };
-
-               opp@760000000,850,3,2 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x08 0x0004>;
-                       opp-hz = /bits/ 64 <760000000>;
-               };
-
-               opp@760000000,850,3,3 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x08 0x0008>;
-                       opp-hz = /bits/ 64 <760000000>;
-               };
-
-               opp@760000000,850,3,4 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x08 0x0010>;
-                       opp-hz = /bits/ 64 <760000000>;
-               };
-
-               opp@760000000,850,3,7 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x08 0x0080>;
-                       opp-hz = /bits/ 64 <760000000>;
-               };
-
-               opp@760000000,850,4,7 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x10 0x0080>;
-                       opp-hz = /bits/ 64 <760000000>;
-               };
-
-               opp@760000000,850,3,8 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x08 0x0100>;
-                       opp-hz = /bits/ 64 <760000000>;
-               };
-
-               opp@760000000,850,4,8 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x10 0x0100>;
-                       opp-hz = /bits/ 64 <760000000>;
-               };
-
-               opp@760000000,850,0,10 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x01 0x0400>;
-                       opp-hz = /bits/ 64 <760000000>;
-               };
-
-               opp@760000000,900 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x01 0x0001>;
-                       opp-hz = /bits/ 64 <760000000>;
-               };
-
-               opp@760000000,900,1,1 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x02 0x0002>;
-                       opp-hz = /bits/ 64 <760000000>;
-               };
-
-               opp@760000000,900,2,1 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x04 0x0002>;
-                       opp-hz = /bits/ 64 <760000000>;
-               };
-
-               opp@760000000,900,1,2 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x02 0x0004>;
-                       opp-hz = /bits/ 64 <760000000>;
-               };
-
-               opp@760000000,900,2,2 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x04 0x0004>;
-                       opp-hz = /bits/ 64 <760000000>;
-               };
-
-               opp@760000000,900,1,3 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x02 0x0008>;
-                       opp-hz = /bits/ 64 <760000000>;
-               };
-
-               opp@760000000,900,2,3 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x04 0x0008>;
-                       opp-hz = /bits/ 64 <760000000>;
-               };
-
-               opp@760000000,900,1,4 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x02 0x0010>;
-                       opp-hz = /bits/ 64 <760000000>;
-               };
-
-               opp@760000000,900,2,4 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x04 0x0010>;
-                       opp-hz = /bits/ 64 <760000000>;
-               };
-
-               opp@760000000,900,1,7 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x02 0x0080>;
-                       opp-hz = /bits/ 64 <760000000>;
-               };
-
-               opp@760000000,900,2,7 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x04 0x0080>;
-                       opp-hz = /bits/ 64 <760000000>;
-               };
-
-               opp@760000000,900,1,8 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x02 0x0100>;
-                       opp-hz = /bits/ 64 <760000000>;
-               };
-
-               opp@760000000,900,2,8 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x04 0x0100>;
-                       opp-hz = /bits/ 64 <760000000>;
-               };
-
-               opp@760000000,912 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x1F 0x0200>;
-                       opp-hz = /bits/ 64 <760000000>;
-               };
-
-               opp@760000000,975 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x01 0x0192>;
-                       opp-hz = /bits/ 64 <760000000>;
-               };
-
-               opp@816000000,850 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x1F 0x0400>;
-                       opp-hz = /bits/ 64 <816000000>;
-               };
-
-               opp@816000000,912 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x1F 0x0200>;
-                       opp-hz = /bits/ 64 <816000000>;
-               };
-
-               opp@860000000,850 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x0C 0x0001>;
-                       opp-hz = /bits/ 64 <860000000>;
-               };
-
-               opp@860000000,900 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x02 0x0001>;
-                       opp-hz = /bits/ 64 <860000000>;
-               };
-
-               opp@860000000,900,2,1 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x04 0x0002>;
-                       opp-hz = /bits/ 64 <860000000>;
-               };
-
-               opp@860000000,900,3,1 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x08 0x0002>;
-                       opp-hz = /bits/ 64 <860000000>;
-               };
-
-               opp@860000000,900,2,2 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x04 0x0004>;
-                       opp-hz = /bits/ 64 <860000000>;
-               };
-
-               opp@860000000,900,3,2 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x08 0x0004>;
-                       opp-hz = /bits/ 64 <860000000>;
-               };
-
-               opp@860000000,900,2,3 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x04 0x0008>;
-                       opp-hz = /bits/ 64 <860000000>;
-               };
-
-               opp@860000000,900,3,3 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x08 0x0008>;
-                       opp-hz = /bits/ 64 <860000000>;
-               };
-
-               opp@860000000,900,2,4 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x04 0x0010>;
-                       opp-hz = /bits/ 64 <860000000>;
-               };
-
-               opp@860000000,900,3,4 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x08 0x0010>;
-                       opp-hz = /bits/ 64 <860000000>;
-               };
-
-               opp@860000000,900,2,7 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x04 0x0080>;
-                       opp-hz = /bits/ 64 <860000000>;
-               };
-
-               opp@860000000,900,3,7 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x08 0x0080>;
-                       opp-hz = /bits/ 64 <860000000>;
-               };
-
-               opp@860000000,900,4,7 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x10 0x0080>;
-                       opp-hz = /bits/ 64 <860000000>;
-               };
-
-               opp@860000000,900,2,8 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x04 0x0100>;
-                       opp-hz = /bits/ 64 <860000000>;
-               };
-
-               opp@860000000,900,3,8 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x08 0x0100>;
-                       opp-hz = /bits/ 64 <860000000>;
-               };
-
-               opp@860000000,900,4,8 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x10 0x0100>;
-                       opp-hz = /bits/ 64 <860000000>;
-               };
-
-               opp@860000000,975 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x01 0x0001>;
-                       opp-hz = /bits/ 64 <860000000>;
-               };
-
-               opp@860000000,975,1,1 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x02 0x0002>;
-                       opp-hz = /bits/ 64 <860000000>;
-               };
-
-               opp@860000000,975,1,2 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x02 0x0004>;
-                       opp-hz = /bits/ 64 <860000000>;
-               };
-
-               opp@860000000,975,1,3 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x02 0x0008>;
-                       opp-hz = /bits/ 64 <860000000>;
-               };
-
-               opp@860000000,975,1,4 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x02 0x0010>;
-                       opp-hz = /bits/ 64 <860000000>;
-               };
-
-               opp@860000000,975,1,7 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x02 0x0080>;
-                       opp-hz = /bits/ 64 <860000000>;
-               };
-
-               opp@860000000,975,1,8 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x02 0x0100>;
-                       opp-hz = /bits/ 64 <860000000>;
-               };
-
-               opp@860000000,1000 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x01 0x0192>;
-                       opp-hz = /bits/ 64 <860000000>;
-               };
-
-               opp@910000000,900 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x18 0x3060>;
-                       opp-hz = /bits/ 64 <910000000>;
-               };
-
-               opp@1000000000,900 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x0C 0x0001>;
-                       opp-hz = /bits/ 64 <1000000000>;
-               };
-
-               opp@1000000000,975 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x03 0x0001>;
-                       opp-hz = /bits/ 64 <1000000000>;
-               };
-
-               opp@1000000000,975,2,1 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x04 0x0002>;
-                       opp-hz = /bits/ 64 <1000000000>;
-               };
-
-               opp@1000000000,975,3,1 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x08 0x0002>;
-                       opp-hz = /bits/ 64 <1000000000>;
-               };
-
-               opp@1000000000,975,2,2 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x04 0x0004>;
-                       opp-hz = /bits/ 64 <1000000000>;
-               };
-
-               opp@1000000000,975,3,2 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x08 0x0004>;
-                       opp-hz = /bits/ 64 <1000000000>;
-               };
-
-               opp@1000000000,975,2,3 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x04 0x0008>;
-                       opp-hz = /bits/ 64 <1000000000>;
-               };
-
-               opp@1000000000,975,3,3 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x08 0x0008>;
-                       opp-hz = /bits/ 64 <1000000000>;
-               };
-
-               opp@1000000000,975,2,4 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x04 0x0010>;
-                       opp-hz = /bits/ 64 <1000000000>;
-               };
-
-               opp@1000000000,975,3,4 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x08 0x0010>;
-                       opp-hz = /bits/ 64 <1000000000>;
-               };
-
-               opp@1000000000,975,2,7 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x04 0x0080>;
-                       opp-hz = /bits/ 64 <1000000000>;
-               };
-
-               opp@1000000000,975,3,7 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x08 0x0080>;
-                       opp-hz = /bits/ 64 <1000000000>;
+                       opp-supported-hw = <0x0F 0x0001>, <0x01 0x0002>,
+                                          <0x01 0x0010>, <0x01 0x0080>,
+                                          <0x01 0x0100>;
+                       opp-hz = /bits/ 64 <475000000>;
                };
 
-               opp@1000000000,975,4,7 {
+               opp@608000000,850 {
                        clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x10 0x0080>;
-                       opp-hz = /bits/ 64 <1000000000>;
+                       opp-supported-hw = <0x1F 0x0400>;
+                       opp-hz = /bits/ 64 <608000000>;
                };
 
-               opp@1000000000,975,2,8 {
+               opp@608000000,912 {
                        clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x04 0x0100>;
-                       opp-hz = /bits/ 64 <1000000000>;
+                       opp-supported-hw = <0x1F 0x0200>;
+                       opp-hz = /bits/ 64 <608000000>;
                };
 
-               opp@1000000000,975,3,8 {
+               opp@620000000,850 {
                        clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x08 0x0100>;
-                       opp-hz = /bits/ 64 <1000000000>;
+                       opp-supported-hw = <0x1E 0x306C>;
+                       opp-hz = /bits/ 64 <620000000>;
                };
 
-               opp@1000000000,975,4,8 {
+               opp@640000000,850 {
                        clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x10 0x0100>;
-                       opp-hz = /bits/ 64 <1000000000>;
+                       opp-supported-hw = <0x0F 0x0001>, <0x02 0x0002>,
+                                          <0x04 0x0002>, <0x08 0x0002>,
+                                          <0x02 0x0010>, <0x04 0x0010>,
+                                          <0x08 0x0010>, <0x02 0x0080>,
+                                          <0x04 0x0080>, <0x08 0x0080>,
+                                          <0x10 0x0080>, <0x02 0x0100>,
+                                          <0x04 0x0100>, <0x08 0x0100>,
+                                          <0x10 0x0100>;
+                       opp-hz = /bits/ 64 <640000000>;
                };
 
-               opp@1000000000,1000 {
+               opp@640000000,900 {
                        clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x02 0x019E>;
-                       opp-hz = /bits/ 64 <1000000000>;
+                       opp-supported-hw = <0x01 0x0192>;
+                       opp-hz = /bits/ 64 <640000000>;
                };
 
-               opp@1000000000,1025 {
+               opp@760000000,850 {
                        clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x01 0x0192>;
-                       opp-hz = /bits/ 64 <1000000000>;
+                       opp-supported-hw = <0x1E 0x3461>, <0x08 0x0002>,
+                                          <0x08 0x0004>, <0x08 0x0008>,
+                                          <0x08 0x0010>, <0x08 0x0080>,
+                                          <0x10 0x0080>, <0x08 0x0100>,
+                                          <0x10 0x0100>, <0x01 0x0400>;
+                       opp-hz = /bits/ 64 <760000000>;
                };
 
-               opp@1100000000,900 {
+               opp@760000000,900 {
                        clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x08 0x0001>;
-                       opp-hz = /bits/ 64 <1100000000>;
+                       opp-supported-hw = <0x01 0x0001>, <0x02 0x0002>,
+                                          <0x04 0x0002>, <0x02 0x0004>,
+                                          <0x04 0x0004>, <0x02 0x0008>,
+                                          <0x04 0x0008>, <0x02 0x0010>,
+                                          <0x04 0x0010>, <0x02 0x0080>,
+                                          <0x04 0x0080>, <0x02 0x0100>,
+                                          <0x04 0x0100>;
+                       opp-hz = /bits/ 64 <760000000>;
                };
 
-               opp@1100000000,975 {
+               opp@760000000,912 {
                        clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x06 0x0001>;
-                       opp-hz = /bits/ 64 <1100000000>;
+                       opp-supported-hw = <0x1F 0x0200>;
+                       opp-hz = /bits/ 64 <760000000>;
                };
 
-               opp@1100000000,975,3,1 {
+               opp@760000000,975 {
                        clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x08 0x0002>;
-                       opp-hz = /bits/ 64 <1100000000>;
+                       opp-supported-hw = <0x01 0x0192>;
+                       opp-hz = /bits/ 64 <760000000>;
                };
 
-               opp@1100000000,975,3,2 {
+               opp@816000000,850 {
                        clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x08 0x0004>;
-                       opp-hz = /bits/ 64 <1100000000>;
+                       opp-supported-hw = <0x1F 0x0400>;
+                       opp-hz = /bits/ 64 <816000000>;
                };
 
-               opp@1100000000,975,3,3 {
+               opp@816000000,912 {
                        clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x08 0x0008>;
-                       opp-hz = /bits/ 64 <1100000000>;
+                       opp-supported-hw = <0x1F 0x0200>;
+                       opp-hz = /bits/ 64 <816000000>;
                };
 
-               opp@1100000000,975,3,4 {
+               opp@860000000,850 {
                        clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x08 0x0010>;
-                       opp-hz = /bits/ 64 <1100000000>;
+                       opp-supported-hw = <0x0C 0x0001>;
+                       opp-hz = /bits/ 64 <860000000>;
                };
 
-               opp@1100000000,975,3,7 {
+               opp@860000000,900 {
                        clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x08 0x0080>;
-                       opp-hz = /bits/ 64 <1100000000>;
+                       opp-supported-hw = <0x02 0x0001>, <0x04 0x0002>,
+                                          <0x08 0x0002>, <0x04 0x0004>,
+                                          <0x08 0x0004>, <0x04 0x0008>,
+                                          <0x08 0x0008>, <0x04 0x0010>,
+                                          <0x08 0x0010>, <0x04 0x0080>,
+                                          <0x08 0x0080>, <0x10 0x0080>,
+                                          <0x04 0x0100>, <0x08 0x0100>,
+                                          <0x10 0x0100>;
+                       opp-hz = /bits/ 64 <860000000>;
                };
 
-               opp@1100000000,975,4,7 {
+               opp@860000000,975 {
                        clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x10 0x0080>;
-                       opp-hz = /bits/ 64 <1100000000>;
+                       opp-supported-hw = <0x01 0x0001>, <0x02 0x0002>,
+                                          <0x02 0x0004>, <0x02 0x0008>,
+                                          <0x02 0x0010>, <0x02 0x0080>,
+                                          <0x02 0x0100>;
+                       opp-hz = /bits/ 64 <860000000>;
                };
 
-               opp@1100000000,975,3,8 {
+               opp@860000000,1000 {
                        clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x08 0x0100>;
-                       opp-hz = /bits/ 64 <1100000000>;
+                       opp-supported-hw = <0x01 0x0192>;
+                       opp-hz = /bits/ 64 <860000000>;
                };
 
-               opp@1100000000,975,4,8 {
+               opp@910000000,900 {
                        clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x10 0x0100>;
-                       opp-hz = /bits/ 64 <1100000000>;
+                       opp-supported-hw = <0x18 0x3060>;
+                       opp-hz = /bits/ 64 <910000000>;
                };
 
-               opp@1100000000,1000 {
+               opp@1000000000,900 {
                        clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x01 0x0001>;
-                       opp-hz = /bits/ 64 <1100000000>;
+                       opp-supported-hw = <0x0C 0x0001>;
+                       opp-hz = /bits/ 64 <1000000000>;
                };
 
-               opp@1100000000,1000,2,1 {
+               opp@1000000000,975 {
                        clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x04 0x0002>;
-                       opp-hz = /bits/ 64 <1100000000>;
+                       opp-supported-hw = <0x03 0x0001>, <0x04 0x0002>,
+                                          <0x08 0x0002>, <0x04 0x0004>,
+                                          <0x08 0x0004>, <0x04 0x0008>,
+                                          <0x08 0x0008>, <0x04 0x0010>,
+                                          <0x08 0x0010>, <0x04 0x0080>,
+                                          <0x08 0x0080>, <0x10 0x0080>,
+                                          <0x04 0x0100>, <0x08 0x0100>,
+                                          <0x10 0x0100>;
+                       opp-hz = /bits/ 64 <1000000000>;
                };
 
-               opp@1100000000,1000,2,2 {
+               opp@1000000000,1000 {
                        clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x04 0x0004>;
-                       opp-hz = /bits/ 64 <1100000000>;
+                       opp-supported-hw = <0x02 0x019E>;
+                       opp-hz = /bits/ 64 <1000000000>;
                };
 
-               opp@1100000000,1000,2,3 {
+               opp@1000000000,1025 {
                        clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x04 0x0008>;
-                       opp-hz = /bits/ 64 <1100000000>;
+                       opp-supported-hw = <0x01 0x0192>;
+                       opp-hz = /bits/ 64 <1000000000>;
                };
 
-               opp@1100000000,1000,2,4 {
+               opp@1100000000,900 {
                        clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x04 0x0010>;
+                       opp-supported-hw = <0x08 0x0001>;
                        opp-hz = /bits/ 64 <1100000000>;
                };
 
-               opp@1100000000,1000,2,7 {
+               opp@1100000000,975 {
                        clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x04 0x0080>;
+                       opp-supported-hw = <0x06 0x0001>, <0x08 0x0002>,
+                                          <0x08 0x0004>, <0x08 0x0008>,
+                                          <0x08 0x0010>, <0x08 0x0080>,
+                                          <0x10 0x0080>, <0x08 0x0100>,
+                                          <0x10 0x0100>;
                        opp-hz = /bits/ 64 <1100000000>;
                };
 
-               opp@1100000000,1000,2,8 {
+               opp@1100000000,1000 {
                        clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x04 0x0100>;
+                       opp-supported-hw = <0x01 0x0001>, <0x04 0x0002>,
+                                          <0x04 0x0004>, <0x04 0x0008>,
+                                          <0x04 0x0010>, <0x04 0x0080>,
+                                          <0x04 0x0100>;
                        opp-hz = /bits/ 64 <1100000000>;
                };
 
 
                opp@1200000000,1000 {
                        clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x04 0x0001>;
-                       opp-hz = /bits/ 64 <1200000000>;
-               };
-
-               opp@1200000000,1000,3,1 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x08 0x0002>;
-                       opp-hz = /bits/ 64 <1200000000>;
-               };
-
-               opp@1200000000,1000,3,2 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x08 0x0004>;
-                       opp-hz = /bits/ 64 <1200000000>;
-               };
-
-               opp@1200000000,1000,3,3 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x08 0x0008>;
-                       opp-hz = /bits/ 64 <1200000000>;
-               };
-
-               opp@1200000000,1000,3,4 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x08 0x0010>;
-                       opp-hz = /bits/ 64 <1200000000>;
-               };
-
-               opp@1200000000,1000,3,7 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x08 0x0080>;
-                       opp-hz = /bits/ 64 <1200000000>;
-               };
-
-               opp@1200000000,1000,4,7 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x10 0x0080>;
-                       opp-hz = /bits/ 64 <1200000000>;
-               };
-
-               opp@1200000000,1000,3,8 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x08 0x0100>;
-                       opp-hz = /bits/ 64 <1200000000>;
-               };
-
-               opp@1200000000,1000,4,8 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x10 0x0100>;
+                       opp-supported-hw = <0x04 0x0001>, <0x08 0x0002>,
+                                          <0x08 0x0004>, <0x08 0x0008>,
+                                          <0x08 0x0010>, <0x08 0x0080>,
+                                          <0x10 0x0080>, <0x08 0x0100>,
+                                          <0x10 0x0100>;
                        opp-hz = /bits/ 64 <1200000000>;
                };
 
                opp@1200000000,1025 {
                        clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x02 0x0001>;
-                       opp-hz = /bits/ 64 <1200000000>;
-               };
-
-               opp@1200000000,1025,2,1 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x04 0x0002>;
-                       opp-hz = /bits/ 64 <1200000000>;
-               };
-
-               opp@1200000000,1025,2,2 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x04 0x0004>;
-                       opp-hz = /bits/ 64 <1200000000>;
-               };
-
-               opp@1200000000,1025,2,3 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x04 0x0008>;
-                       opp-hz = /bits/ 64 <1200000000>;
-               };
-
-               opp@1200000000,1025,2,4 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x04 0x0010>;
-                       opp-hz = /bits/ 64 <1200000000>;
-               };
-
-               opp@1200000000,1025,2,7 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x04 0x0080>;
-                       opp-hz = /bits/ 64 <1200000000>;
-               };
-
-               opp@1200000000,1025,2,8 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x04 0x0100>;
+                       opp-supported-hw = <0x02 0x0001>, <0x04 0x0002>,
+                                          <0x04 0x0004>, <0x04 0x0008>,
+                                          <0x04 0x0010>, <0x04 0x0080>,
+                                          <0x04 0x0100>;
                        opp-hz = /bits/ 64 <1200000000>;
                };
 
 
                opp@1300000000,1000 {
                        clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x08 0x0001>;
-                       opp-hz = /bits/ 64 <1300000000>;
-               };
-
-               opp@1300000000,1000,4,7 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x10 0x0080>;
-                       opp-hz = /bits/ 64 <1300000000>;
-               };
-
-               opp@1300000000,1000,4,8 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x10 0x0100>;
+                       opp-supported-hw = <0x08 0x0001>, <0x10 0x0080>,
+                                          <0x10 0x0100>;
                        opp-hz = /bits/ 64 <1300000000>;
                };
 
                opp@1300000000,1025 {
                        clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x04 0x0001>;
-                       opp-hz = /bits/ 64 <1300000000>;
-               };
-
-               opp@1300000000,1025,3,1 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x08 0x0002>;
-                       opp-hz = /bits/ 64 <1300000000>;
-               };
-
-               opp@1300000000,1025,3,7 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x08 0x0080>;
-                       opp-hz = /bits/ 64 <1300000000>;
-               };
-
-               opp@1300000000,1025,3,8 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x08 0x0100>;
+                       opp-supported-hw = <0x04 0x0001>, <0x08 0x0002>,
+                                          <0x08 0x0080>, <0x08 0x0100>;
                        opp-hz = /bits/ 64 <1300000000>;
                };
 
                opp@1300000000,1050 {
                        clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x12 0x3061>;
-                       opp-hz = /bits/ 64 <1300000000>;
-               };
-
-               opp@1300000000,1050,2,1 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x04 0x0002>;
-                       opp-hz = /bits/ 64 <1300000000>;
-               };
-
-               opp@1300000000,1050,3,2 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x08 0x0004>;
-                       opp-hz = /bits/ 64 <1300000000>;
-               };
-
-               opp@1300000000,1050,3,3 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x08 0x0008>;
-                       opp-hz = /bits/ 64 <1300000000>;
-               };
-
-               opp@1300000000,1050,3,4 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x08 0x0010>;
-                       opp-hz = /bits/ 64 <1300000000>;
-               };
-
-               opp@1300000000,1050,3,5 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x08 0x0020>;
-                       opp-hz = /bits/ 64 <1300000000>;
-               };
-
-               opp@1300000000,1050,3,6 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x08 0x0040>;
-                       opp-hz = /bits/ 64 <1300000000>;
-               };
-
-               opp@1300000000,1050,2,7 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x04 0x0080>;
-                       opp-hz = /bits/ 64 <1300000000>;
-               };
-
-               opp@1300000000,1050,2,8 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x04 0x0100>;
-                       opp-hz = /bits/ 64 <1300000000>;
-               };
-
-               opp@1300000000,1050,3,12 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x08 0x1000>;
-                       opp-hz = /bits/ 64 <1300000000>;
-               };
-
-               opp@1300000000,1050,3,13 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x08 0x2000>;
+                       opp-supported-hw = <0x12 0x3061>, <0x04 0x0002>,
+                                          <0x08 0x0004>, <0x08 0x0008>,
+                                          <0x08 0x0010>, <0x08 0x0020>,
+                                          <0x08 0x0040>, <0x04 0x0080>,
+                                          <0x04 0x0100>, <0x08 0x1000>,
+                                          <0x08 0x2000>;
                        opp-hz = /bits/ 64 <1300000000>;
                };
 
                opp@1300000000,1075 {
                        clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x02 0x0182>;
-                       opp-hz = /bits/ 64 <1300000000>;
-               };
-
-               opp@1300000000,1075,2,2 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x04 0x0004>;
-                       opp-hz = /bits/ 64 <1300000000>;
-               };
-
-               opp@1300000000,1075,2,3 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x04 0x0008>;
-                       opp-hz = /bits/ 64 <1300000000>;
-               };
-
-               opp@1300000000,1075,2,4 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x04 0x0010>;
+                       opp-supported-hw = <0x02 0x0182>, <0x04 0x0004>,
+                                          <0x04 0x0008>, <0x04 0x0010>;
                        opp-hz = /bits/ 64 <1300000000>;
                };
 
 
                opp@1400000000,1150 {
                        clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x02 0x000C>;
-                       opp-hz = /bits/ 64 <1400000000>;
-               };
-
-               opp@1400000000,1150,2,4 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x04 0x0010>;
+                       opp-supported-hw = <0x02 0x000C>, <0x04 0x0010>;
                        opp-hz = /bits/ 64 <1400000000>;
                };
 
 
                opp@1500000000,1125 {
                        clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x08 0x0010>;
-                       opp-hz = /bits/ 64 <1500000000>;
-               };
-
-               opp@1500000000,1125,4,5 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x10 0x0020>;
-                       opp-hz = /bits/ 64 <1500000000>;
-               };
-
-               opp@1500000000,1125,4,6 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x10 0x0040>;
-                       opp-hz = /bits/ 64 <1500000000>;
-               };
-
-               opp@1500000000,1125,4,12 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x10 0x1000>;
-                       opp-hz = /bits/ 64 <1500000000>;
-               };
-
-               opp@1500000000,1125,4,13 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x10 0x2000>;
+                       opp-supported-hw = <0x08 0x0010>, <0x10 0x0020>,
+                                          <0x10 0x0040>, <0x10 0x1000>,
+                                          <0x10 0x2000>;
                        opp-hz = /bits/ 64 <1500000000>;
                };
 
                opp@1500000000,1150 {
                        clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x04 0x0010>;
-                       opp-hz = /bits/ 64 <1500000000>;
-               };
-
-               opp@1500000000,1150,3,5 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x08 0x0020>;
-                       opp-hz = /bits/ 64 <1500000000>;
-               };
-
-               opp@1500000000,1150,3,6 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x08 0x0040>;
-                       opp-hz = /bits/ 64 <1500000000>;
-               };
-
-               opp@1500000000,1150,3,12 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x08 0x1000>;
-                       opp-hz = /bits/ 64 <1500000000>;
-               };
-
-               opp@1500000000,1150,3,13 {
-                       clock-latency-ns = <100000>;
-                       opp-supported-hw = <0x08 0x2000>;
+                       opp-supported-hw = <0x04 0x0010>, <0x08 0x0020>,
+                                          <0x08 0x0040>, <0x08 0x1000>,
+                                          <0x08 0x2000>;
                        opp-hz = /bits/ 64 <1500000000>;
                };
 
index e0593cf..470299e 100644 (file)
@@ -7,8 +7,13 @@
 #include <linux/cpumask.h>
 #include <linux/arch_topology.h>
 
+/* big.LITTLE switcher is incompatible with frequency invariance */
+#ifndef CONFIG_BL_SWITCHER
 /* Replace task scheduler's default frequency-invariant accounting */
+#define arch_set_freq_scale topology_set_freq_scale
 #define arch_scale_freq_capacity topology_get_freq_scale
+#define arch_scale_freq_invariant topology_scale_freq_invariant
+#endif
 
 /* Replace task scheduler's default cpu-invariant accounting */
 #define arch_scale_cpu_capacity topology_get_cpu_scale
index 24dd5bb..094337d 100644 (file)
@@ -24,7 +24,9 @@ static int imx6q_enter_wait(struct cpuidle_device *dev,
                imx6_set_lpm(WAIT_UNCLOCKED);
        raw_spin_unlock(&cpuidle_lock);
 
+       rcu_idle_enter();
        cpu_do_idle();
+       rcu_idle_exit();
 
        raw_spin_lock(&cpuidle_lock);
        if (num_idle_cpus-- == num_online_cpus())
@@ -44,7 +46,7 @@ static struct cpuidle_driver imx6q_cpuidle_driver = {
                {
                        .exit_latency = 50,
                        .target_residency = 75,
-                       .flags = CPUIDLE_FLAG_TIMER_STOP,
+                       .flags = CPUIDLE_FLAG_TIMER_STOP | CPUIDLE_FLAG_RCU_IDLE,
                        .enter = imx6q_enter_wait,
                        .name = "WAIT",
                        .desc = "Clock off",
index 49a55be..1cc5f5f 100644 (file)
@@ -298,15 +298,15 @@ static __always_inline int kvm_vcpu_dabt_get_rd(const struct kvm_vcpu *vcpu)
        return (kvm_vcpu_get_esr(vcpu) & ESR_ELx_SRT_MASK) >> ESR_ELx_SRT_SHIFT;
 }
 
-static __always_inline bool kvm_vcpu_dabt_iss1tw(const struct kvm_vcpu *vcpu)
+static __always_inline bool kvm_vcpu_abt_iss1tw(const struct kvm_vcpu *vcpu)
 {
        return !!(kvm_vcpu_get_esr(vcpu) & ESR_ELx_S1PTW);
 }
 
+/* Always check for S1PTW *before* using this. */
 static __always_inline bool kvm_vcpu_dabt_iswrite(const struct kvm_vcpu *vcpu)
 {
-       return !!(kvm_vcpu_get_esr(vcpu) & ESR_ELx_WNR) ||
-               kvm_vcpu_dabt_iss1tw(vcpu); /* AF/DBM update */
+       return kvm_vcpu_get_esr(vcpu) & ESR_ELx_WNR;
 }
 
 static inline bool kvm_vcpu_dabt_is_cm(const struct kvm_vcpu *vcpu)
@@ -335,6 +335,11 @@ static inline bool kvm_vcpu_trap_is_iabt(const struct kvm_vcpu *vcpu)
        return kvm_vcpu_trap_get_class(vcpu) == ESR_ELx_EC_IABT_LOW;
 }
 
+static inline bool kvm_vcpu_trap_is_exec_fault(const struct kvm_vcpu *vcpu)
+{
+       return kvm_vcpu_trap_is_iabt(vcpu) && !kvm_vcpu_abt_iss1tw(vcpu);
+}
+
 static __always_inline u8 kvm_vcpu_trap_get_fault(const struct kvm_vcpu *vcpu)
 {
        return kvm_vcpu_get_esr(vcpu) & ESR_ELx_FSC;
@@ -372,6 +377,9 @@ static __always_inline int kvm_vcpu_sys_get_rt(struct kvm_vcpu *vcpu)
 
 static inline bool kvm_is_write_fault(struct kvm_vcpu *vcpu)
 {
+       if (kvm_vcpu_abt_iss1tw(vcpu))
+               return true;
+
        if (kvm_vcpu_trap_is_iabt(vcpu))
                return false;
 
index e042f65..11a4652 100644 (file)
@@ -26,7 +26,9 @@ void topology_scale_freq_tick(void);
 #endif /* CONFIG_ARM64_AMU_EXTN */
 
 /* Replace task scheduler's default frequency-invariant accounting */
+#define arch_set_freq_scale topology_set_freq_scale
 #define arch_scale_freq_capacity topology_get_freq_scale
+#define arch_scale_freq_invariant topology_scale_freq_invariant
 
 /* Replace task scheduler's default cpu-invariant accounting */
 #define arch_scale_cpu_capacity topology_get_cpu_scale
index a85174d..cada0b8 100644 (file)
@@ -298,8 +298,21 @@ void __iomem *acpi_os_ioremap(acpi_physical_address phys, acpi_size size)
                case EFI_BOOT_SERVICES_DATA:
                case EFI_CONVENTIONAL_MEMORY:
                case EFI_PERSISTENT_MEMORY:
-                       pr_warn(FW_BUG "requested region covers kernel memory @ %pa\n", &phys);
-                       return NULL;
+                       if (memblock_is_map_memory(phys) ||
+                           !memblock_is_region_memory(phys, size)) {
+                               pr_warn(FW_BUG "requested region covers kernel memory @ %pa\n", &phys);
+                               return NULL;
+                       }
+                       /*
+                        * Mapping kernel memory is permitted if the region in
+                        * question is covered by a single memblock with the
+                        * NOMAP attribute set: this enables the use of ACPI
+                        * table overrides passed via initramfs, which are
+                        * reserved in memory using arch_reserve_mem_area()
+                        * below. As this particular use case only requires
+                        * read access, fall through to the R/O mapping case.
+                        */
+                       fallthrough;
 
                case EFI_RUNTIME_SERVICES_CODE:
                        /*
@@ -388,3 +401,8 @@ int apei_claim_sea(struct pt_regs *regs)
 
        return err;
 }
+
+void arch_reserve_mem_area(acpi_physical_address addr, size_t size)
+{
+       memblock_mark_nomap(addr, size);
+}
index 0801a0f..4064d39 100644 (file)
@@ -246,6 +246,13 @@ static int __init init_amu_fie(void)
                static_branch_enable(&amu_fie_key);
        }
 
+       /*
+        * If the system is not fully invariant after AMU init, disable
+        * partial use of counters for frequency invariance.
+        */
+       if (!topology_scale_freq_invariant())
+               static_branch_disable(&amu_fie_key);
+
 free_valid_mask:
        free_cpumask_var(valid_cpus);
 
@@ -253,7 +260,7 @@ free_valid_mask:
 }
 late_initcall_sync(init_amu_fie);
 
-bool arch_freq_counters_available(struct cpumask *cpus)
+bool arch_freq_counters_available(const struct cpumask *cpus)
 {
        return amu_freq_invariant() &&
               cpumask_subset(cpus, amu_fie_cpus);
index 5b6b8fa..0261308 100644 (file)
@@ -449,7 +449,7 @@ static inline bool fixup_guest_exit(struct kvm_vcpu *vcpu, u64 *exit_code)
                        kvm_vcpu_trap_get_fault_type(vcpu) == FSC_FAULT &&
                        kvm_vcpu_dabt_isvalid(vcpu) &&
                        !kvm_vcpu_abt_issea(vcpu) &&
-                       !kvm_vcpu_dabt_iss1tw(vcpu);
+                       !kvm_vcpu_abt_iss1tw(vcpu);
 
                if (valid) {
                        int ret = __vgic_v2_perform_cpuif_access(vcpu);
index 69eae60..b15d65a 100644 (file)
@@ -31,7 +31,14 @@ static void __tlb_switch_to_guest(struct kvm_s2_mmu *mmu,
                isb();
        }
 
+       /*
+        * __load_guest_stage2() includes an ISB only when the AT
+        * workaround is applied. Take care of the opposite condition,
+        * ensuring that we always have an ISB, but not two ISBs back
+        * to back.
+        */
        __load_guest_stage2(mmu);
+       asm(ALTERNATIVE("isb", "nop", ARM64_WORKAROUND_SPECULATIVE_AT));
 }
 
 static void __tlb_switch_to_host(struct tlb_inv_context *cxt)
index 9a636b8..3d26b47 100644 (file)
@@ -1849,7 +1849,7 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
        struct kvm_s2_mmu *mmu = vcpu->arch.hw_mmu;
 
        write_fault = kvm_is_write_fault(vcpu);
-       exec_fault = kvm_vcpu_trap_is_iabt(vcpu);
+       exec_fault = kvm_vcpu_trap_is_exec_fault(vcpu);
        VM_BUG_ON(write_fault && exec_fault);
 
        if (fault_status == FSC_PERM && !write_fault && !exec_fault) {
@@ -2131,7 +2131,7 @@ int kvm_handle_guest_abort(struct kvm_vcpu *vcpu)
                        goto out;
                }
 
-               if (kvm_vcpu_dabt_iss1tw(vcpu)) {
+               if (kvm_vcpu_abt_iss1tw(vcpu)) {
                        kvm_inject_dabt(vcpu, kvm_vcpu_get_hfar(vcpu));
                        ret = 1;
                        goto out_unlock;
index 0b3fb4c..8e7b8c6 100644 (file)
@@ -538,7 +538,7 @@ virtual_memmap_init(u64 start, u64 end, void *arg)
        if (map_start < map_end)
                memmap_init_zone((unsigned long)(map_end - map_start),
                                 args->nid, args->zone, page_to_pfn(map_start),
-                                MEMMAP_EARLY, NULL);
+                                MEMINIT_EARLY, NULL);
        return 0;
 }
 
@@ -547,8 +547,8 @@ memmap_init (unsigned long size, int nid, unsigned long zone,
             unsigned long start_pfn)
 {
        if (!vmem_map) {
-               memmap_init_zone(size, nid, zone, start_pfn, MEMMAP_EARLY,
-                               NULL);
+               memmap_init_zone(size, nid, zone, start_pfn,
+                                MEMINIT_EARLY, NULL);
        } else {
                struct page *start;
                struct memmap_init_callback_data args;
index 82627c2..01427bd 100644 (file)
@@ -148,7 +148,7 @@ void __init plat_mem_setup(void)
 {
        struct cpuinfo_mips *c = &current_cpu_data;
 
-       if ((c->cputype == CPU_74K) || (c->cputype == CPU_1074K)) {
+       if (c->cputype == CPU_74K) {
                pr_info("Using bcma bus\n");
 #ifdef CONFIG_BCM47XX_BCMA
                bcm47xx_bus_type = BCM47XX_BUS_TYPE_BCMA;
index 75a7a38..3288cef 100644 (file)
@@ -47,6 +47,7 @@ static inline int __pure __get_cpu_type(const int cpu_type)
        case CPU_34K:
        case CPU_1004K:
        case CPU_74K:
+       case CPU_1074K:
        case CPU_M14KC:
        case CPU_M14KEC:
        case CPU_INTERAPTIV:
index 4ab55f1..ae023b9 100644 (file)
@@ -44,6 +44,10 @@ ifdef CONFIG_CPU_LOONGSON2F_WORKAROUNDS
   endif
 endif
 
+# Some -march= flags enable MMI instructions, and GCC complains about that
+# support being enabled alongside -msoft-float. Thus explicitly disable MMI.
+cflags-y += $(call cc-option,-mno-loongson-mmi)
+
 #
 # Loongson Machines' Support
 #
index f130f62..00055d4 100644 (file)
@@ -95,10 +95,8 @@ static int loongson_cu2_call(struct notifier_block *nfb, unsigned long action,
                        if (res)
                                goto fault;
 
-                       set_fpr64(current->thread.fpu.fpr,
-                               insn.loongson3_lswc2_format.rt, value);
-                       set_fpr64(current->thread.fpu.fpr,
-                               insn.loongson3_lswc2_format.rq, value_next);
+                       set_fpr64(&current->thread.fpu.fpr[insn.loongson3_lswc2_format.rt], 0, value);
+                       set_fpr64(&current->thread.fpu.fpr[insn.loongson3_lswc2_format.rq], 0, value_next);
                        compute_return_epc(regs);
                        own_fpu(1);
                }
@@ -130,15 +128,13 @@ static int loongson_cu2_call(struct notifier_block *nfb, unsigned long action,
                                goto sigbus;
 
                        lose_fpu(1);
-                       value_next = get_fpr64(current->thread.fpu.fpr,
-                                       insn.loongson3_lswc2_format.rq);
+                       value_next = get_fpr64(&current->thread.fpu.fpr[insn.loongson3_lswc2_format.rq], 0);
 
                        StoreDW(addr + 8, value_next, res);
                        if (res)
                                goto fault;
 
-                       value = get_fpr64(current->thread.fpu.fpr,
-                                       insn.loongson3_lswc2_format.rt);
+                       value = get_fpr64(&current->thread.fpu.fpr[insn.loongson3_lswc2_format.rt], 0);
 
                        StoreDW(addr, value, res);
                        if (res)
@@ -204,8 +200,7 @@ static int loongson_cu2_call(struct notifier_block *nfb, unsigned long action,
                        if (res)
                                goto fault;
 
-                       set_fpr64(current->thread.fpu.fpr,
-                                       insn.loongson3_lsdc2_format.rt, value);
+                       set_fpr64(&current->thread.fpu.fpr[insn.loongson3_lsdc2_format.rt], 0, value);
                        compute_return_epc(regs);
                        own_fpu(1);
 
@@ -221,8 +216,7 @@ static int loongson_cu2_call(struct notifier_block *nfb, unsigned long action,
                        if (res)
                                goto fault;
 
-                       set_fpr64(current->thread.fpu.fpr,
-                                       insn.loongson3_lsdc2_format.rt, value);
+                       set_fpr64(&current->thread.fpu.fpr[insn.loongson3_lsdc2_format.rt], 0, value);
                        compute_return_epc(regs);
                        own_fpu(1);
                        break;
@@ -286,8 +280,7 @@ static int loongson_cu2_call(struct notifier_block *nfb, unsigned long action,
                                goto sigbus;
 
                        lose_fpu(1);
-                       value = get_fpr64(current->thread.fpu.fpr,
-                                       insn.loongson3_lsdc2_format.rt);
+                       value = get_fpr64(&current->thread.fpu.fpr[insn.loongson3_lsdc2_format.rt], 0);
 
                        StoreW(addr, value, res);
                        if (res)
@@ -305,8 +298,7 @@ static int loongson_cu2_call(struct notifier_block *nfb, unsigned long action,
                                goto sigbus;
 
                        lose_fpu(1);
-                       value = get_fpr64(current->thread.fpu.fpr,
-                                       insn.loongson3_lsdc2_format.rt);
+                       value = get_fpr64(&current->thread.fpu.fpr[insn.loongson3_lsdc2_format.rt], 0);
 
                        StoreDW(addr, value, res);
                        if (res)
index d95f7b2..5962f88 100644 (file)
@@ -5,7 +5,6 @@
 
 #include <linux/random.h>
 #include <linux/version.h>
-#include <asm/timex.h>
 
 extern unsigned long __stack_chk_guard;
 
@@ -18,12 +17,9 @@ extern unsigned long __stack_chk_guard;
 static __always_inline void boot_init_stack_canary(void)
 {
        unsigned long canary;
-       unsigned long tsc;
 
        /* Try to get a semi random initial value. */
        get_random_bytes(&canary, sizeof(canary));
-       tsc = get_cycles();
-       canary += tsc + (tsc << BITS_PER_LONG/2);
        canary ^= LINUX_VERSION_CODE;
        canary &= CANARY_MASK;
 
index 7f659dd..ab10490 100644 (file)
@@ -33,6 +33,19 @@ static inline u32 get_cycles_hi(void)
 #define get_cycles_hi get_cycles_hi
 #endif /* CONFIG_64BIT */
 
+/*
+ * Much like MIPS, we may not have a viable counter to use at an early point
+ * in the boot process. Unfortunately we don't have a fallback, so instead
+ * we just return 0.
+ */
+static inline unsigned long random_get_entropy(void)
+{
+       if (unlikely(clint_time_val == NULL))
+               return 0;
+       return get_cycles();
+}
+#define random_get_entropy()   random_get_entropy()
+
 #else /* CONFIG_RISCV_M_MODE */
 
 static inline cycles_t get_cycles(void)
index 7eb01a5..b55561c 100644 (file)
@@ -1260,26 +1260,44 @@ static inline pgd_t *pgd_offset_raw(pgd_t *pgd, unsigned long address)
 
 #define pgd_offset(mm, address) pgd_offset_raw(READ_ONCE((mm)->pgd), address)
 
-static inline p4d_t *p4d_offset(pgd_t *pgd, unsigned long address)
+static inline p4d_t *p4d_offset_lockless(pgd_t *pgdp, pgd_t pgd, unsigned long address)
 {
-       if ((pgd_val(*pgd) & _REGION_ENTRY_TYPE_MASK) >= _REGION_ENTRY_TYPE_R1)
-               return (p4d_t *) pgd_deref(*pgd) + p4d_index(address);
-       return (p4d_t *) pgd;
+       if ((pgd_val(pgd) & _REGION_ENTRY_TYPE_MASK) >= _REGION_ENTRY_TYPE_R1)
+               return (p4d_t *) pgd_deref(pgd) + p4d_index(address);
+       return (p4d_t *) pgdp;
 }
+#define p4d_offset_lockless p4d_offset_lockless
 
-static inline pud_t *pud_offset(p4d_t *p4d, unsigned long address)
+static inline p4d_t *p4d_offset(pgd_t *pgdp, unsigned long address)
 {
-       if ((p4d_val(*p4d) & _REGION_ENTRY_TYPE_MASK) >= _REGION_ENTRY_TYPE_R2)
-               return (pud_t *) p4d_deref(*p4d) + pud_index(address);
-       return (pud_t *) p4d;
+       return p4d_offset_lockless(pgdp, *pgdp, address);
+}
+
+static inline pud_t *pud_offset_lockless(p4d_t *p4dp, p4d_t p4d, unsigned long address)
+{
+       if ((p4d_val(p4d) & _REGION_ENTRY_TYPE_MASK) >= _REGION_ENTRY_TYPE_R2)
+               return (pud_t *) p4d_deref(p4d) + pud_index(address);
+       return (pud_t *) p4dp;
+}
+#define pud_offset_lockless pud_offset_lockless
+
+static inline pud_t *pud_offset(p4d_t *p4dp, unsigned long address)
+{
+       return pud_offset_lockless(p4dp, *p4dp, address);
 }
 #define pud_offset pud_offset
 
-static inline pmd_t *pmd_offset(pud_t *pud, unsigned long address)
+static inline pmd_t *pmd_offset_lockless(pud_t *pudp, pud_t pud, unsigned long address)
+{
+       if ((pud_val(pud) & _REGION_ENTRY_TYPE_MASK) >= _REGION_ENTRY_TYPE_R3)
+               return (pmd_t *) pud_deref(pud) + pmd_index(address);
+       return (pmd_t *) pudp;
+}
+#define pmd_offset_lockless pmd_offset_lockless
+
+static inline pmd_t *pmd_offset(pud_t *pudp, unsigned long address)
 {
-       if ((pud_val(*pud) & _REGION_ENTRY_TYPE_MASK) >= _REGION_ENTRY_TYPE_R3)
-               return (pmd_t *) pud_deref(*pud) + pmd_index(address);
-       return (pmd_t *) pud;
+       return pmd_offset_lockless(pudp, *pudp, address);
 }
 #define pmd_offset pmd_offset
 
index 2f84c7c..870efee 100644 (file)
@@ -299,7 +299,7 @@ __visible noinstr void xen_pv_evtchn_do_upcall(struct pt_regs *regs)
        old_regs = set_irq_regs(regs);
 
        instrumentation_begin();
-       run_on_irqstack_cond(__xen_pv_evtchn_do_upcall, NULL, regs);
+       run_on_irqstack_cond(__xen_pv_evtchn_do_upcall, regs);
        instrumentation_begin();
 
        set_irq_regs(old_regs);
index 70dea93..d977079 100644 (file)
@@ -682,6 +682,8 @@ SYM_CODE_END(.Lbad_gs)
  * rdx: Function argument (can be NULL if none)
  */
 SYM_FUNC_START(asm_call_on_stack)
+SYM_INNER_LABEL(asm_call_sysvec_on_stack, SYM_L_GLOBAL)
+SYM_INNER_LABEL(asm_call_irq_on_stack, SYM_L_GLOBAL)
        /*
         * Save the frame pointer unconditionally. This allows the ORC
         * unwinder to handle the stack switch.
index a433661..a063864 100644 (file)
@@ -242,7 +242,7 @@ __visible noinstr void func(struct pt_regs *regs)                   \
        instrumentation_begin();                                        \
        irq_enter_rcu();                                                \
        kvm_set_cpu_l1tf_flush_l1d();                                   \
-       run_on_irqstack_cond(__##func, regs, regs);                     \
+       run_sysvec_on_irqstack_cond(__##func, regs);                    \
        irq_exit_rcu();                                                 \
        instrumentation_end();                                          \
        irqentry_exit(regs, state);                                     \
index 4ae66f0..7758169 100644 (file)
@@ -12,20 +12,50 @@ static __always_inline bool irqstack_active(void)
        return __this_cpu_read(irq_count) != -1;
 }
 
-void asm_call_on_stack(void *sp, void *func, void *arg);
+void asm_call_on_stack(void *sp, void (*func)(void), void *arg);
+void asm_call_sysvec_on_stack(void *sp, void (*func)(struct pt_regs *regs),
+                             struct pt_regs *regs);
+void asm_call_irq_on_stack(void *sp, void (*func)(struct irq_desc *desc),
+                          struct irq_desc *desc);
 
-static __always_inline void __run_on_irqstack(void *func, void *arg)
+static __always_inline void __run_on_irqstack(void (*func)(void))
 {
        void *tos = __this_cpu_read(hardirq_stack_ptr);
 
        __this_cpu_add(irq_count, 1);
-       asm_call_on_stack(tos - 8, func, arg);
+       asm_call_on_stack(tos - 8, func, NULL);
+       __this_cpu_sub(irq_count, 1);
+}
+
+static __always_inline void
+__run_sysvec_on_irqstack(void (*func)(struct pt_regs *regs),
+                        struct pt_regs *regs)
+{
+       void *tos = __this_cpu_read(hardirq_stack_ptr);
+
+       __this_cpu_add(irq_count, 1);
+       asm_call_sysvec_on_stack(tos - 8, func, regs);
+       __this_cpu_sub(irq_count, 1);
+}
+
+static __always_inline void
+__run_irq_on_irqstack(void (*func)(struct irq_desc *desc),
+                     struct irq_desc *desc)
+{
+       void *tos = __this_cpu_read(hardirq_stack_ptr);
+
+       __this_cpu_add(irq_count, 1);
+       asm_call_irq_on_stack(tos - 8, func, desc);
        __this_cpu_sub(irq_count, 1);
 }
 
 #else /* CONFIG_X86_64 */
 static inline bool irqstack_active(void) { return false; }
-static inline void __run_on_irqstack(void *func, void *arg) { }
+static inline void __run_on_irqstack(void (*func)(void)) { }
+static inline void __run_sysvec_on_irqstack(void (*func)(struct pt_regs *regs),
+                                           struct pt_regs *regs) { }
+static inline void __run_irq_on_irqstack(void (*func)(struct irq_desc *desc),
+                                        struct irq_desc *desc) { }
 #endif /* !CONFIG_X86_64 */
 
 static __always_inline bool irq_needs_irq_stack(struct pt_regs *regs)
@@ -37,17 +67,40 @@ static __always_inline bool irq_needs_irq_stack(struct pt_regs *regs)
        return !user_mode(regs) && !irqstack_active();
 }
 
-static __always_inline void run_on_irqstack_cond(void *func, void *arg,
+
+static __always_inline void run_on_irqstack_cond(void (*func)(void),
                                                 struct pt_regs *regs)
 {
-       void (*__func)(void *arg) = func;
+       lockdep_assert_irqs_disabled();
+
+       if (irq_needs_irq_stack(regs))
+               __run_on_irqstack(func);
+       else
+               func();
+}
+
+static __always_inline void
+run_sysvec_on_irqstack_cond(void (*func)(struct pt_regs *regs),
+                           struct pt_regs *regs)
+{
+       lockdep_assert_irqs_disabled();
 
+       if (irq_needs_irq_stack(regs))
+               __run_sysvec_on_irqstack(func, regs);
+       else
+               func(regs);
+}
+
+static __always_inline void
+run_irq_on_irqstack_cond(void (*func)(struct irq_desc *desc), struct irq_desc *desc,
+                        struct pt_regs *regs)
+{
        lockdep_assert_irqs_disabled();
 
        if (irq_needs_irq_stack(regs))
-               __run_on_irqstack(__func, arg);
+               __run_irq_on_irqstack(func, desc);
        else
-               __func(arg);
+               func(desc);
 }
 
 #endif
index 779a89e..21f9c7f 100644 (file)
@@ -2243,6 +2243,7 @@ static inline void __init check_timer(void)
        legacy_pic->init(0);
        legacy_pic->make_irq(0);
        apic_write(APIC_LVT0, APIC_DM_EXTINT);
+       legacy_pic->unmask(0);
 
        unlock_ExtINT_logic();
 
index 1810602..c5dd503 100644 (file)
@@ -227,7 +227,7 @@ static __always_inline void handle_irq(struct irq_desc *desc,
                                       struct pt_regs *regs)
 {
        if (IS_ENABLED(CONFIG_X86_64))
-               run_on_irqstack_cond(desc->handle_irq, desc, regs);
+               run_irq_on_irqstack_cond(desc->handle_irq, desc, regs);
        else
                __handle_irq(desc, regs);
 }
index 1b4fe93..440eed5 100644 (file)
@@ -74,5 +74,5 @@ int irq_init_percpu_irqstack(unsigned int cpu)
 
 void do_softirq_own_stack(void)
 {
-       run_on_irqstack_cond(__do_softirq, NULL, NULL);
+       run_on_irqstack_cond(__do_softirq, NULL);
 }
index 1b51b72..9663ba3 100644 (file)
@@ -652,6 +652,7 @@ static void __init kvm_guest_init(void)
        }
 
        if (pv_tlb_flush_supported()) {
+               pv_ops.mmu.flush_tlb_others = kvm_flush_tlb_others;
                pv_ops.mmu.tlb_remove_table = tlb_remove_table;
                pr_info("KVM setup pv remote TLB flush\n");
        }
@@ -764,14 +765,6 @@ static __init int activate_jump_labels(void)
 }
 arch_initcall(activate_jump_labels);
 
-static void kvm_free_pv_cpu_mask(void)
-{
-       unsigned int cpu;
-
-       for_each_possible_cpu(cpu)
-               free_cpumask_var(per_cpu(__pv_cpu_mask, cpu));
-}
-
 static __init int kvm_alloc_cpumask(void)
 {
        int cpu;
@@ -790,20 +783,11 @@ static __init int kvm_alloc_cpumask(void)
 
        if (alloc)
                for_each_possible_cpu(cpu) {
-                       if (!zalloc_cpumask_var_node(
-                               per_cpu_ptr(&__pv_cpu_mask, cpu),
-                               GFP_KERNEL, cpu_to_node(cpu))) {
-                               goto zalloc_cpumask_fail;
-                       }
+                       zalloc_cpumask_var_node(per_cpu_ptr(&__pv_cpu_mask, cpu),
+                               GFP_KERNEL, cpu_to_node(cpu));
                }
 
-       apic->send_IPI_mask_allbutself = kvm_send_ipi_mask_allbutself;
-       pv_ops.mmu.flush_tlb_others = kvm_flush_tlb_others;
        return 0;
-
-zalloc_cpumask_fail:
-       kvm_free_pv_cpu_mask();
-       return -ENOMEM;
 }
 arch_initcall(kvm_alloc_cpumask);
 
index c44f3e9..91ea74a 100644 (file)
@@ -2183,6 +2183,12 @@ static int iret_interception(struct vcpu_svm *svm)
        return 1;
 }
 
+static int invd_interception(struct vcpu_svm *svm)
+{
+       /* Treat an INVD instruction as a NOP and just skip it. */
+       return kvm_skip_emulated_instruction(&svm->vcpu);
+}
+
 static int invlpg_interception(struct vcpu_svm *svm)
 {
        if (!static_cpu_has(X86_FEATURE_DECODEASSISTS))
@@ -2774,7 +2780,7 @@ static int (*const svm_exit_handlers[])(struct vcpu_svm *svm) = {
        [SVM_EXIT_RDPMC]                        = rdpmc_interception,
        [SVM_EXIT_CPUID]                        = cpuid_interception,
        [SVM_EXIT_IRET]                         = iret_interception,
-       [SVM_EXIT_INVD]                         = emulate_on_interception,
+       [SVM_EXIT_INVD]                         = invd_interception,
        [SVM_EXIT_PAUSE]                        = pause_interception,
        [SVM_EXIT_HLT]                          = halt_interception,
        [SVM_EXIT_INVLPG]                       = invlpg_interception,
index 8646a79..96979c0 100644 (file)
@@ -129,6 +129,9 @@ static bool __read_mostly enable_preemption_timer = 1;
 module_param_named(preemption_timer, enable_preemption_timer, bool, S_IRUGO);
 #endif
 
+extern bool __read_mostly allow_smaller_maxphyaddr;
+module_param(allow_smaller_maxphyaddr, bool, S_IRUGO);
+
 #define KVM_VM_CR0_ALWAYS_OFF (X86_CR0_NW | X86_CR0_CD)
 #define KVM_VM_CR0_ALWAYS_ON_UNRESTRICTED_GUEST X86_CR0_NE
 #define KVM_VM_CR0_ALWAYS_ON                           \
@@ -791,6 +794,18 @@ void update_exception_bitmap(struct kvm_vcpu *vcpu)
         */
        if (is_guest_mode(vcpu))
                eb |= get_vmcs12(vcpu)->exception_bitmap;
+        else {
+               /*
+                * If EPT is enabled, #PF is only trapped if MAXPHYADDR is mismatched
+                * between guest and host.  In that case we only care about present
+                * faults.  For vmcs02, however, PFEC_MASK and PFEC_MATCH are set in
+                * prepare_vmcs02_rare.
+                */
+               bool selective_pf_trap = enable_ept && (eb & (1u << PF_VECTOR));
+               int mask = selective_pf_trap ? PFERR_PRESENT_MASK : 0;
+               vmcs_write32(PAGE_FAULT_ERROR_CODE_MASK, mask);
+               vmcs_write32(PAGE_FAULT_ERROR_CODE_MATCH, mask);
+       }
 
        vmcs_write32(EXCEPTION_BITMAP, eb);
 }
@@ -4352,16 +4367,6 @@ static void init_vmcs(struct vcpu_vmx *vmx)
                vmx->pt_desc.guest.output_mask = 0x7F;
                vmcs_write64(GUEST_IA32_RTIT_CTL, 0);
        }
-
-       /*
-        * If EPT is enabled, #PF is only trapped if MAXPHYADDR is mismatched
-        * between guest and host.  In that case we only care about present
-        * faults.
-        */
-       if (enable_ept) {
-               vmcs_write32(PAGE_FAULT_ERROR_CODE_MASK, PFERR_PRESENT_MASK);
-               vmcs_write32(PAGE_FAULT_ERROR_CODE_MATCH, PFERR_PRESENT_MASK);
-       }
 }
 
 static void vmx_vcpu_reset(struct kvm_vcpu *vcpu, bool init_event)
@@ -4803,6 +4808,7 @@ static int handle_exception_nmi(struct kvm_vcpu *vcpu)
                         * EPT will cause page fault only if we need to
                         * detect illegal GPAs.
                         */
+                       WARN_ON_ONCE(!allow_smaller_maxphyaddr);
                        kvm_fixup_and_inject_pf_error(vcpu, cr2, error_code);
                        return 1;
                } else
@@ -5331,7 +5337,7 @@ static int handle_ept_violation(struct kvm_vcpu *vcpu)
         * would also use advanced VM-exit information for EPT violations to
         * reconstruct the page fault error code.
         */
-       if (unlikely(kvm_mmu_is_illegal_gpa(vcpu, gpa)))
+       if (unlikely(allow_smaller_maxphyaddr && kvm_mmu_is_illegal_gpa(vcpu, gpa)))
                return kvm_emulate_instruction(vcpu, 0);
 
        return kvm_mmu_page_fault(vcpu, gpa, error_code, NULL, 0);
@@ -8305,11 +8311,12 @@ static int __init vmx_init(void)
        vmx_check_vmcs12_offsets();
 
        /*
-        * Intel processors don't have problems with
-        * GUEST_MAXPHYADDR < HOST_MAXPHYADDR so enable
-        * it for VMX by default
+        * Shadow paging doesn't have a (further) performance penalty
+        * from GUEST_MAXPHYADDR < HOST_MAXPHYADDR so enable it
+        * by default
         */
-       allow_smaller_maxphyaddr = true;
+       if (!enable_ept)
+               allow_smaller_maxphyaddr = true;
 
        return 0;
 }
index a2f8212..a0e4772 100644 (file)
@@ -552,7 +552,10 @@ static inline bool vmx_has_waitpkg(struct vcpu_vmx *vmx)
 
 static inline bool vmx_need_pf_intercept(struct kvm_vcpu *vcpu)
 {
-       return !enable_ept || cpuid_maxphyaddr(vcpu) < boot_cpu_data.x86_phys_bits;
+       if (!enable_ept)
+               return true;
+
+       return allow_smaller_maxphyaddr && cpuid_maxphyaddr(vcpu) < boot_cpu_data.x86_phys_bits;
 }
 
 void dump_vmcs(void);
index 1994602..ce856e0 100644 (file)
@@ -188,7 +188,7 @@ static struct kvm_shared_msrs __percpu *shared_msrs;
 u64 __read_mostly host_efer;
 EXPORT_SYMBOL_GPL(host_efer);
 
-bool __read_mostly allow_smaller_maxphyaddr;
+bool __read_mostly allow_smaller_maxphyaddr = 0;
 EXPORT_SYMBOL_GPL(allow_smaller_maxphyaddr);
 
 static u64 __read_mostly host_xss;
@@ -976,6 +976,7 @@ int kvm_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4)
        unsigned long old_cr4 = kvm_read_cr4(vcpu);
        unsigned long pdptr_bits = X86_CR4_PGE | X86_CR4_PSE | X86_CR4_PAE |
                                   X86_CR4_SMEP;
+       unsigned long mmu_role_bits = pdptr_bits | X86_CR4_SMAP | X86_CR4_PKE;
 
        if (kvm_valid_cr4(vcpu, cr4))
                return 1;
@@ -1003,7 +1004,7 @@ int kvm_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4)
        if (kvm_x86_ops.set_cr4(vcpu, cr4))
                return 1;
 
-       if (((cr4 ^ old_cr4) & pdptr_bits) ||
+       if (((cr4 ^ old_cr4) & mmu_role_bits) ||
            (!(cr4 & X86_CR4_PCIDE) && (old_cr4 & X86_CR4_PCIDE)))
                kvm_mmu_reset_context(vcpu);
 
@@ -3221,9 +3222,22 @@ int kvm_get_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
        case MSR_IA32_POWER_CTL:
                msr_info->data = vcpu->arch.msr_ia32_power_ctl;
                break;
-       case MSR_IA32_TSC:
-               msr_info->data = kvm_scale_tsc(vcpu, rdtsc()) + vcpu->arch.tsc_offset;
+       case MSR_IA32_TSC: {
+               /*
+                * Intel SDM states that MSR_IA32_TSC read adds the TSC offset
+                * even when not intercepted. AMD manual doesn't explicitly
+                * state this but appears to behave the same.
+                *
+                * On userspace reads and writes, however, we unconditionally
+                * operate L1's TSC value to ensure backwards-compatible
+                * behavior for migration.
+                */
+               u64 tsc_offset = msr_info->host_initiated ? vcpu->arch.l1_tsc_offset :
+                                                           vcpu->arch.tsc_offset;
+
+               msr_info->data = kvm_scale_tsc(vcpu, rdtsc()) + tsc_offset;
                break;
+       }
        case MSR_MTRRcap:
        case 0x200 ... 0x2ff:
                return kvm_mtrr_get_msr(vcpu, msr_info->index, &msr_info->data);
index b0dfac3..1847e99 100644 (file)
@@ -120,7 +120,7 @@ long __copy_user_flushcache(void *dst, const void __user *src, unsigned size)
         */
        if (size < 8) {
                if (!IS_ALIGNED(dest, 4) || size != 4)
-                       clean_cache_range(dst, 1);
+                       clean_cache_range(dst, size);
        } else {
                if (!IS_ALIGNED(dest, 8)) {
                        dest = ALIGN(dest, boot_cpu_data.x86_clflush_size);
index b3d2785..cdced4a 100644 (file)
@@ -1412,6 +1412,11 @@ out:
 
        hctx->dispatched[queued_to_index(queued)]++;
 
+       /* If we didn't flush the entire list, we could have told the driver
+        * there was more coming, but that turned out to be a lie.
+        */
+       if ((!list_empty(list) || errors) && q->mq_ops->commit_rqs && queued)
+               q->mq_ops->commit_rqs(hctx);
        /*
         * Any items that need requeuing? Stuff them into hctx->dispatch,
         * that is where we will continue on next queue run.
@@ -1425,14 +1430,6 @@ out:
 
                blk_mq_release_budgets(q, nr_budgets);
 
-               /*
-                * If we didn't flush the entire list, we could have told
-                * the driver there was more coming, but that turned out to
-                * be a lie.
-                */
-               if (q->mq_ops->commit_rqs && queued)
-                       q->mq_ops->commit_rqs(hctx);
-
                spin_lock(&hctx->lock);
                list_splice_tail_init(list, &hctx->dispatch);
                spin_unlock(&hctx->lock);
@@ -2079,6 +2076,7 @@ void blk_mq_try_issue_list_directly(struct blk_mq_hw_ctx *hctx,
                struct list_head *list)
 {
        int queued = 0;
+       int errors = 0;
 
        while (!list_empty(list)) {
                blk_status_t ret;
@@ -2095,6 +2093,7 @@ void blk_mq_try_issue_list_directly(struct blk_mq_hw_ctx *hctx,
                                break;
                        }
                        blk_mq_end_request(rq, ret);
+                       errors++;
                } else
                        queued++;
        }
@@ -2104,7 +2103,8 @@ void blk_mq_try_issue_list_directly(struct blk_mq_hw_ctx *hctx,
         * the driver there was more coming, but that turned out to
         * be a lie.
         */
-       if (!list_empty(list) && hctx->queue->mq_ops->commit_rqs && queued)
+       if ((!list_empty(list) || errors) &&
+            hctx->queue->mq_ops->commit_rqs && queued)
                hctx->queue->mq_ops->commit_rqs(hctx);
 }
 
index 76a7e03..34b721a 100644 (file)
@@ -801,6 +801,52 @@ bool blk_queue_can_use_dma_map_merging(struct request_queue *q,
 }
 EXPORT_SYMBOL_GPL(blk_queue_can_use_dma_map_merging);
 
+/**
+ * blk_queue_set_zoned - configure a disk queue zoned model.
+ * @disk:      the gendisk of the queue to configure
+ * @model:     the zoned model to set
+ *
+ * Set the zoned model of the request queue of @disk according to @model.
+ * When @model is BLK_ZONED_HM (host managed), this should be called only
+ * if zoned block device support is enabled (CONFIG_BLK_DEV_ZONED option).
+ * If @model specifies BLK_ZONED_HA (host aware), the effective model used
+ * depends on CONFIG_BLK_DEV_ZONED settings and on the existence of partitions
+ * on the disk.
+ */
+void blk_queue_set_zoned(struct gendisk *disk, enum blk_zoned_model model)
+{
+       switch (model) {
+       case BLK_ZONED_HM:
+               /*
+                * Host managed devices are supported only if
+                * CONFIG_BLK_DEV_ZONED is enabled.
+                */
+               WARN_ON_ONCE(!IS_ENABLED(CONFIG_BLK_DEV_ZONED));
+               break;
+       case BLK_ZONED_HA:
+               /*
+                * Host aware devices can be treated either as regular block
+                * devices (similar to drive managed devices) or as zoned block
+                * devices to take advantage of the zone command set, similarly
+                * to host managed devices. We try the latter if there are no
+                * partitions and zoned block device support is enabled, else
+                * we do nothing special as far as the block layer is concerned.
+                */
+               if (!IS_ENABLED(CONFIG_BLK_DEV_ZONED) ||
+                   disk_has_partitions(disk))
+                       model = BLK_ZONED_NONE;
+               break;
+       case BLK_ZONED_NONE:
+       default:
+               if (WARN_ON_ONCE(model != BLK_ZONED_NONE))
+                       model = BLK_ZONED_NONE;
+               break;
+       }
+
+       disk->queue->limits.zoned = model;
+}
+EXPORT_SYMBOL_GPL(blk_queue_set_zoned);
+
 static int __init blk_settings_init(void)
 {
        blk_max_low_pfn = max_low_pfn - 1;
index b51ddf3..412a972 100644 (file)
@@ -798,22 +798,34 @@ int acpi_processor_evaluate_cst(acpi_handle handle, u32 cpu,
                memset(&cx, 0, sizeof(cx));
 
                element = &cst->package.elements[i];
-               if (element->type != ACPI_TYPE_PACKAGE)
+               if (element->type != ACPI_TYPE_PACKAGE) {
+                       acpi_handle_info(handle, "_CST C%d type(%x) is not package, skip...\n",
+                                        i, element->type);
                        continue;
+               }
 
-               if (element->package.count != 4)
+               if (element->package.count != 4) {
+                       acpi_handle_info(handle, "_CST C%d package count(%d) is not 4, skip...\n",
+                                        i, element->package.count);
                        continue;
+               }
 
                obj = &element->package.elements[0];
 
-               if (obj->type != ACPI_TYPE_BUFFER)
+               if (obj->type != ACPI_TYPE_BUFFER) {
+                       acpi_handle_info(handle, "_CST C%d package element[0] type(%x) is not buffer, skip...\n",
+                                        i, obj->type);
                        continue;
+               }
 
                reg = (struct acpi_power_register *)obj->buffer.pointer;
 
                obj = &element->package.elements[1];
-               if (obj->type != ACPI_TYPE_INTEGER)
+               if (obj->type != ACPI_TYPE_INTEGER) {
+                       acpi_handle_info(handle, "_CST C[%d] package element[1] type(%x) is not integer, skip...\n",
+                                        i, obj->type);
                        continue;
+               }
 
                cx.type = obj->integer.value;
                /*
@@ -850,6 +862,8 @@ int acpi_processor_evaluate_cst(acpi_handle handle, u32 cpu,
                                cx.entry_method = ACPI_CSTATE_HALT;
                                snprintf(cx.desc, ACPI_CX_DESC_LEN, "ACPI HLT");
                        } else {
+                               acpi_handle_info(handle, "_CST C%d declares FIXED_HARDWARE C-state but not supported in hardware, skip...\n",
+                                                i);
                                continue;
                        }
                } else if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_IO) {
@@ -857,6 +871,8 @@ int acpi_processor_evaluate_cst(acpi_handle handle, u32 cpu,
                        snprintf(cx.desc, ACPI_CX_DESC_LEN, "ACPI IOPORT 0x%x",
                                 cx.address);
                } else {
+                       acpi_handle_info(handle, "_CST C%d space_id(%x) neither FIXED_HARDWARE nor SYSTEM_IO, skip...\n",
+                                        i, reg->space_id);
                        continue;
                }
 
@@ -864,14 +880,20 @@ int acpi_processor_evaluate_cst(acpi_handle handle, u32 cpu,
                        cx.valid = 1;
 
                obj = &element->package.elements[2];
-               if (obj->type != ACPI_TYPE_INTEGER)
+               if (obj->type != ACPI_TYPE_INTEGER) {
+                       acpi_handle_info(handle, "_CST C%d package element[2] type(%x) not integer, skip...\n",
+                                        i, obj->type);
                        continue;
+               }
 
                cx.latency = obj->integer.value;
 
                obj = &element->package.elements[3];
-               if (obj->type != ACPI_TYPE_INTEGER)
+               if (obj->type != ACPI_TYPE_INTEGER) {
+                       acpi_handle_info(handle, "_CST C%d package element[3] type(%x) not integer, skip...\n",
+                                        i, obj->type);
                        continue;
+               }
 
                memcpy(&info->states[++last_index], &cx, sizeof(cx));
        }
index 7ecb90e..f66236c 100644 (file)
@@ -176,6 +176,7 @@ static void lapic_timer_propagate_broadcast(struct acpi_processor *pr) { }
 static bool lapic_timer_needs_broadcast(struct acpi_processor *pr,
                                        struct acpi_processor_cx *cx)
 {
+       return false;
 }
 
 #endif
index 39be444..316a994 100644 (file)
@@ -2224,7 +2224,7 @@ static int eni_init_one(struct pci_dev *pci_dev,
 
        rc = dma_set_mask_and_coherent(&pci_dev->dev, DMA_BIT_MASK(32));
        if (rc < 0)
-               goto out;
+               goto err_disable;
 
        rc = -ENOMEM;
        eni_dev = kmalloc(sizeof(struct eni_dev), GFP_KERNEL);
index 75f72d6..c1a9e2f 100644 (file)
 #include <linux/sched.h>
 #include <linux/smp.h>
 
-__weak bool arch_freq_counters_available(struct cpumask *cpus)
+bool topology_scale_freq_invariant(void)
+{
+       return cpufreq_supports_freq_invariance() ||
+              arch_freq_counters_available(cpu_online_mask);
+}
+
+__weak bool arch_freq_counters_available(const struct cpumask *cpus)
 {
        return false;
 }
 DEFINE_PER_CPU(unsigned long, freq_scale) = SCHED_CAPACITY_SCALE;
 
-void arch_set_freq_scale(struct cpumask *cpus, unsigned long cur_freq,
-                        unsigned long max_freq)
+void topology_set_freq_scale(const struct cpumask *cpus, unsigned long cur_freq,
+                            unsigned long max_freq)
 {
        unsigned long scale;
        int i;
 
+       if (WARN_ON_ONCE(!cur_freq || !max_freq))
+               return;
+
        /*
         * If the use of counters for FIE is enabled, just return as we don't
         * want to update the scale factor with information from CPUFREQ.
index 508b80f..50af16e 100644 (file)
@@ -761,14 +761,36 @@ static int __ref get_nid_for_pfn(unsigned long pfn)
        return pfn_to_nid(pfn);
 }
 
+static int do_register_memory_block_under_node(int nid,
+                                              struct memory_block *mem_blk)
+{
+       int ret;
+
+       /*
+        * If this memory block spans multiple nodes, we only indicate
+        * the last processed node.
+        */
+       mem_blk->nid = nid;
+
+       ret = sysfs_create_link_nowarn(&node_devices[nid]->dev.kobj,
+                                      &mem_blk->dev.kobj,
+                                      kobject_name(&mem_blk->dev.kobj));
+       if (ret)
+               return ret;
+
+       return sysfs_create_link_nowarn(&mem_blk->dev.kobj,
+                               &node_devices[nid]->dev.kobj,
+                               kobject_name(&node_devices[nid]->dev.kobj));
+}
+
 /* register memory section under specified node if it spans that node */
-static int register_mem_sect_under_node(struct memory_block *mem_blk,
-                                        void *arg)
+static int register_mem_block_under_node_early(struct memory_block *mem_blk,
+                                              void *arg)
 {
        unsigned long memory_block_pfns = memory_block_size_bytes() / PAGE_SIZE;
        unsigned long start_pfn = section_nr_to_pfn(mem_blk->start_section_nr);
        unsigned long end_pfn = start_pfn + memory_block_pfns - 1;
-       int ret, nid = *(int *)arg;
+       int nid = *(int *)arg;
        unsigned long pfn;
 
        for (pfn = start_pfn; pfn <= end_pfn; pfn++) {
@@ -785,38 +807,33 @@ static int register_mem_sect_under_node(struct memory_block *mem_blk,
                }
 
                /*
-                * We need to check if page belongs to nid only for the boot
-                * case, during hotplug we know that all pages in the memory
-                * block belong to the same node.
-                */
-               if (system_state == SYSTEM_BOOTING) {
-                       page_nid = get_nid_for_pfn(pfn);
-                       if (page_nid < 0)
-                               continue;
-                       if (page_nid != nid)
-                               continue;
-               }
-
-               /*
-                * If this memory block spans multiple nodes, we only indicate
-                * the last processed node.
+                * We need to check if page belongs to nid only at the boot
+                * case because node's ranges can be interleaved.
                 */
-               mem_blk->nid = nid;
-
-               ret = sysfs_create_link_nowarn(&node_devices[nid]->dev.kobj,
-                                       &mem_blk->dev.kobj,
-                                       kobject_name(&mem_blk->dev.kobj));
-               if (ret)
-                       return ret;
+               page_nid = get_nid_for_pfn(pfn);
+               if (page_nid < 0)
+                       continue;
+               if (page_nid != nid)
+                       continue;
 
-               return sysfs_create_link_nowarn(&mem_blk->dev.kobj,
-                               &node_devices[nid]->dev.kobj,
-                               kobject_name(&node_devices[nid]->dev.kobj));
+               return do_register_memory_block_under_node(nid, mem_blk);
        }
        /* mem section does not span the specified node */
        return 0;
 }
 
+/*
+ * During hotplug we know that all pages in the memory block belong to the same
+ * node.
+ */
+static int register_mem_block_under_node_hotplug(struct memory_block *mem_blk,
+                                                void *arg)
+{
+       int nid = *(int *)arg;
+
+       return do_register_memory_block_under_node(nid, mem_blk);
+}
+
 /*
  * Unregister a memory block device under the node it spans. Memory blocks
  * with multiple nodes cannot be offlined and therefore also never be removed.
@@ -832,11 +849,19 @@ void unregister_memory_block_under_nodes(struct memory_block *mem_blk)
                          kobject_name(&node_devices[mem_blk->nid]->dev.kobj));
 }
 
-int link_mem_sections(int nid, unsigned long start_pfn, unsigned long end_pfn)
+int link_mem_sections(int nid, unsigned long start_pfn, unsigned long end_pfn,
+                     enum meminit_context context)
 {
+       walk_memory_blocks_func_t func;
+
+       if (context == MEMINIT_HOTPLUG)
+               func = register_mem_block_under_node_hotplug;
+       else
+               func = register_mem_block_under_node_early;
+
        return walk_memory_blocks(PFN_PHYS(start_pfn),
                                  PFN_PHYS(end_pfn - start_pfn), (void *)&nid,
-                                 register_mem_sect_under_node);
+                                 func);
 }
 
 #ifdef CONFIG_HUGETLBFS
index 2cb5e04..05bb4d4 100644 (file)
@@ -123,7 +123,7 @@ static const struct genpd_lock_ops genpd_spin_ops = {
 #define genpd_lock_interruptible(p)    p->lock_ops->lock_interruptible(p)
 #define genpd_unlock(p)                        p->lock_ops->unlock(p)
 
-#define genpd_status_on(genpd)         (genpd->status == GPD_STATE_ACTIVE)
+#define genpd_status_on(genpd)         (genpd->status == GENPD_STATE_ON)
 #define genpd_is_irq_safe(genpd)       (genpd->flags & GENPD_FLAG_IRQ_SAFE)
 #define genpd_is_always_on(genpd)      (genpd->flags & GENPD_FLAG_ALWAYS_ON)
 #define genpd_is_active_wakeup(genpd)  (genpd->flags & GENPD_FLAG_ACTIVE_WAKEUP)
@@ -222,7 +222,7 @@ static void genpd_update_accounting(struct generic_pm_domain *genpd)
         * out of off and so update the idle time and vice
         * versa.
         */
-       if (genpd->status == GPD_STATE_ACTIVE) {
+       if (genpd->status == GENPD_STATE_ON) {
                int state_idx = genpd->state_idx;
 
                genpd->states[state_idx].idle_time =
@@ -497,6 +497,7 @@ static int genpd_power_off(struct generic_pm_domain *genpd, bool one_dev_on,
        struct pm_domain_data *pdd;
        struct gpd_link *link;
        unsigned int not_suspended = 0;
+       int ret;
 
        /*
         * Do not try to power off the domain in the following situations:
@@ -544,26 +545,15 @@ static int genpd_power_off(struct generic_pm_domain *genpd, bool one_dev_on,
        if (!genpd->gov)
                genpd->state_idx = 0;
 
-       if (genpd->power_off) {
-               int ret;
-
-               if (atomic_read(&genpd->sd_count) > 0)
-                       return -EBUSY;
+       /* Don't power off, if a child domain is waiting to power on. */
+       if (atomic_read(&genpd->sd_count) > 0)
+               return -EBUSY;
 
-               /*
-                * If sd_count > 0 at this point, one of the subdomains hasn't
-                * managed to call genpd_power_on() for the parent yet after
-                * incrementing it.  In that case genpd_power_on() will wait
-                * for us to drop the lock, so we can call .power_off() and let
-                * the genpd_power_on() restore power for us (this shouldn't
-                * happen very often).
-                */
-               ret = _genpd_power_off(genpd, true);
-               if (ret)
-                       return ret;
-       }
+       ret = _genpd_power_off(genpd, true);
+       if (ret)
+               return ret;
 
-       genpd->status = GPD_STATE_POWER_OFF;
+       genpd->status = GENPD_STATE_OFF;
        genpd_update_accounting(genpd);
 
        list_for_each_entry(link, &genpd->child_links, child_node) {
@@ -616,7 +606,7 @@ static int genpd_power_on(struct generic_pm_domain *genpd, unsigned int depth)
        if (ret)
                goto err;
 
-       genpd->status = GPD_STATE_ACTIVE;
+       genpd->status = GENPD_STATE_ON;
        genpd_update_accounting(genpd);
 
        return 0;
@@ -961,7 +951,7 @@ static void genpd_sync_power_off(struct generic_pm_domain *genpd, bool use_lock,
        if (_genpd_power_off(genpd, false))
                return;
 
-       genpd->status = GPD_STATE_POWER_OFF;
+       genpd->status = GENPD_STATE_OFF;
 
        list_for_each_entry(link, &genpd->child_links, child_node) {
                genpd_sd_counter_dec(link->parent);
@@ -1007,8 +997,7 @@ static void genpd_sync_power_on(struct generic_pm_domain *genpd, bool use_lock,
        }
 
        _genpd_power_on(genpd, false);
-
-       genpd->status = GPD_STATE_ACTIVE;
+       genpd->status = GENPD_STATE_ON;
 }
 
 /**
@@ -1287,7 +1276,7 @@ static int genpd_restore_noirq(struct device *dev)
                 * so make it appear as powered off to genpd_sync_power_on(),
                 * so that it tries to power it on in case it was really off.
                 */
-               genpd->status = GPD_STATE_POWER_OFF;
+               genpd->status = GENPD_STATE_OFF;
 
        genpd_sync_power_on(genpd, true, 0);
        genpd_unlock(genpd);
@@ -1777,7 +1766,7 @@ int pm_genpd_init(struct generic_pm_domain *genpd,
        genpd->gov = gov;
        INIT_WORK(&genpd->power_off_work, genpd_power_off_work_fn);
        atomic_set(&genpd->sd_count, 0);
-       genpd->status = is_off ? GPD_STATE_POWER_OFF : GPD_STATE_ACTIVE;
+       genpd->status = is_off ? GENPD_STATE_OFF : GENPD_STATE_ON;
        genpd->device_count = 0;
        genpd->max_off_time_ns = -1;
        genpd->max_off_time_changed = true;
@@ -2044,8 +2033,9 @@ int of_genpd_add_provider_simple(struct device_node *np,
        if (genpd->set_performance_state) {
                ret = dev_pm_opp_of_add_table(&genpd->dev);
                if (ret) {
-                       dev_err(&genpd->dev, "Failed to add OPP table: %d\n",
-                               ret);
+                       if (ret != -EPROBE_DEFER)
+                               dev_err(&genpd->dev, "Failed to add OPP table: %d\n",
+                                       ret);
                        goto unlock;
                }
 
@@ -2054,7 +2044,7 @@ int of_genpd_add_provider_simple(struct device_node *np,
                 * state.
                 */
                genpd->opp_table = dev_pm_opp_get_opp_table(&genpd->dev);
-               WARN_ON(!genpd->opp_table);
+               WARN_ON(IS_ERR(genpd->opp_table));
        }
 
        ret = genpd_add_provider(np, genpd_xlate_simple, genpd);
@@ -2111,8 +2101,9 @@ int of_genpd_add_provider_onecell(struct device_node *np,
                if (genpd->set_performance_state) {
                        ret = dev_pm_opp_of_add_table_indexed(&genpd->dev, i);
                        if (ret) {
-                               dev_err(&genpd->dev, "Failed to add OPP table for index %d: %d\n",
-                                       i, ret);
+                               if (ret != -EPROBE_DEFER)
+                                       dev_err(&genpd->dev, "Failed to add OPP table for index %d: %d\n",
+                                               i, ret);
                                goto error;
                        }
 
@@ -2121,7 +2112,7 @@ int of_genpd_add_provider_onecell(struct device_node *np,
                         * performance state.
                         */
                        genpd->opp_table = dev_pm_opp_get_opp_table_indexed(&genpd->dev, i);
-                       WARN_ON(!genpd->opp_table);
+                       WARN_ON(IS_ERR(genpd->opp_table));
                }
 
                genpd->provider = &np->fwnode;
@@ -2802,8 +2793,8 @@ static int genpd_summary_one(struct seq_file *s,
                        struct generic_pm_domain *genpd)
 {
        static const char * const status_lookup[] = {
-               [GPD_STATE_ACTIVE] = "on",
-               [GPD_STATE_POWER_OFF] = "off"
+               [GENPD_STATE_ON] = "on",
+               [GENPD_STATE_OFF] = "off"
        };
        struct pm_domain_data *pm_data;
        const char *kobj_path;
@@ -2881,8 +2872,8 @@ static int summary_show(struct seq_file *s, void *data)
 static int status_show(struct seq_file *s, void *data)
 {
        static const char * const status_lookup[] = {
-               [GPD_STATE_ACTIVE] = "on",
-               [GPD_STATE_POWER_OFF] = "off"
+               [GENPD_STATE_ON] = "on",
+               [GENPD_STATE_OFF] = "off"
        };
 
        struct generic_pm_domain *genpd = s->private;
@@ -2895,7 +2886,7 @@ static int status_show(struct seq_file *s, void *data)
        if (WARN_ON_ONCE(genpd->status >= ARRAY_SIZE(status_lookup)))
                goto exit;
 
-       if (genpd->status == GPD_STATE_POWER_OFF)
+       if (genpd->status == GENPD_STATE_OFF)
                seq_printf(s, "%s-%u\n", status_lookup[genpd->status],
                        genpd->state_idx);
        else
@@ -2938,7 +2929,7 @@ static int idle_states_show(struct seq_file *s, void *data)
                ktime_t delta = 0;
                s64 msecs;
 
-               if ((genpd->status == GPD_STATE_POWER_OFF) &&
+               if ((genpd->status == GENPD_STATE_OFF) &&
                                (genpd->state_idx == i))
                        delta = ktime_sub(ktime_get(), genpd->accounting_time);
 
@@ -2961,7 +2952,7 @@ static int active_time_show(struct seq_file *s, void *data)
        if (ret)
                return -ERESTARTSYS;
 
-       if (genpd->status == GPD_STATE_ACTIVE)
+       if (genpd->status == GENPD_STATE_ON)
                delta = ktime_sub(ktime_get(), genpd->accounting_time);
 
        seq_printf(s, "%lld ms\n", ktime_to_ms(
@@ -2984,7 +2975,7 @@ static int total_idle_time_show(struct seq_file *s, void *data)
 
        for (i = 0; i < genpd->state_count; i++) {
 
-               if ((genpd->status == GPD_STATE_POWER_OFF) &&
+               if ((genpd->status == GENPD_STATE_OFF) &&
                                (genpd->state_idx == i))
                        delta = ktime_sub(ktime_get(), genpd->accounting_time);
 
index 8143210..6f605f7 100644 (file)
@@ -291,8 +291,7 @@ static int rpm_get_suppliers(struct device *dev)
                                device_links_read_lock_held()) {
                int retval;
 
-               if (!(link->flags & DL_FLAG_PM_RUNTIME) ||
-                   READ_ONCE(link->status) == DL_STATE_SUPPLIER_UNBIND)
+               if (!(link->flags & DL_FLAG_PM_RUNTIME))
                        continue;
 
                retval = pm_runtime_get_sync(link->supplier);
@@ -312,8 +311,6 @@ static void rpm_put_suppliers(struct device *dev)
 
        list_for_each_entry_rcu(link, &dev->links.suppliers, c_node,
                                device_links_read_lock_held()) {
-               if (READ_ONCE(link->status) == DL_STATE_SUPPLIER_UNBIND)
-                       continue;
 
                while (refcount_dec_not_one(&link->rpm_active))
                        pm_runtime_put(link->supplier);
index 3d80c4b..7be2fcf 100644 (file)
@@ -217,7 +217,7 @@ struct regmap_field {
 
 #ifdef CONFIG_DEBUG_FS
 extern void regmap_debugfs_initcall(void);
-extern void regmap_debugfs_init(struct regmap *map, const char *name);
+extern void regmap_debugfs_init(struct regmap *map);
 extern void regmap_debugfs_exit(struct regmap *map);
 
 static inline void regmap_debugfs_disable(struct regmap *map)
@@ -227,7 +227,7 @@ static inline void regmap_debugfs_disable(struct regmap *map)
 
 #else
 static inline void regmap_debugfs_initcall(void) { }
-static inline void regmap_debugfs_init(struct regmap *map, const char *name) { }
+static inline void regmap_debugfs_init(struct regmap *map) { }
 static inline void regmap_debugfs_exit(struct regmap *map) { }
 static inline void regmap_debugfs_disable(struct regmap *map) { }
 #endif
@@ -259,7 +259,7 @@ bool regcache_set_val(struct regmap *map, void *base, unsigned int idx,
 int regcache_lookup_reg(struct regmap *map, unsigned int reg);
 
 int _regmap_raw_write(struct regmap *map, unsigned int reg,
-                     const void *val, size_t val_len);
+                     const void *val, size_t val_len, bool noinc);
 
 void regmap_async_complete_cb(struct regmap_async *async, int ret);
 
index a93cafd..7f4b3b6 100644 (file)
@@ -717,7 +717,7 @@ static int regcache_sync_block_raw_flush(struct regmap *map, const void **data,
 
        map->cache_bypass = true;
 
-       ret = _regmap_raw_write(map, base, *data, count * val_bytes);
+       ret = _regmap_raw_write(map, base, *data, count * val_bytes, false);
        if (ret)
                dev_err(map->dev, "Unable to sync registers %#x-%#x. %d\n",
                        base, cur - map->reg_stride, ret);
index f58baff..b6d63ef 100644 (file)
@@ -17,7 +17,6 @@
 
 struct regmap_debugfs_node {
        struct regmap *map;
-       const char *name;
        struct list_head link;
 };
 
@@ -544,11 +543,12 @@ static const struct file_operations regmap_cache_bypass_fops = {
        .write = regmap_cache_bypass_write_file,
 };
 
-void regmap_debugfs_init(struct regmap *map, const char *name)
+void regmap_debugfs_init(struct regmap *map)
 {
        struct rb_node *next;
        struct regmap_range_node *range_node;
        const char *devname = "dummy";
+       const char *name = map->name;
 
        /*
         * Userspace can initiate reads from the hardware over debugfs.
@@ -569,7 +569,6 @@ void regmap_debugfs_init(struct regmap *map, const char *name)
                if (!node)
                        return;
                node->map = map;
-               node->name = name;
                mutex_lock(&regmap_debugfs_early_lock);
                list_add(&node->link, &regmap_debugfs_early_list);
                mutex_unlock(&regmap_debugfs_early_lock);
@@ -679,7 +678,7 @@ void regmap_debugfs_initcall(void)
 
        mutex_lock(&regmap_debugfs_early_lock);
        list_for_each_entry_safe(node, tmp, &regmap_debugfs_early_list, link) {
-               regmap_debugfs_init(node->map, node->name);
+               regmap_debugfs_init(node->map);
                list_del(&node->link);
                kfree(node);
        }
index e93700a..b71f9ec 100644 (file)
@@ -581,14 +581,34 @@ static void regmap_range_exit(struct regmap *map)
        kfree(map->selector_work_buf);
 }
 
+static int regmap_set_name(struct regmap *map, const struct regmap_config *config)
+{
+       if (config->name) {
+               const char *name = kstrdup_const(config->name, GFP_KERNEL);
+
+               if (!name)
+                       return -ENOMEM;
+
+               kfree_const(map->name);
+               map->name = name;
+       }
+
+       return 0;
+}
+
 int regmap_attach_dev(struct device *dev, struct regmap *map,
                      const struct regmap_config *config)
 {
        struct regmap **m;
+       int ret;
 
        map->dev = dev;
 
-       regmap_debugfs_init(map, config->name);
+       ret = regmap_set_name(map, config);
+       if (ret)
+               return ret;
+
+       regmap_debugfs_init(map);
 
        /* Add a devres resource for dev_get_regmap() */
        m = devres_alloc(dev_get_regmap_release, sizeof(*m), GFP_KERNEL);
@@ -687,13 +707,9 @@ struct regmap *__regmap_init(struct device *dev,
                goto err;
        }
 
-       if (config->name) {
-               map->name = kstrdup_const(config->name, GFP_KERNEL);
-               if (!map->name) {
-                       ret = -ENOMEM;
-                       goto err_map;
-               }
-       }
+       ret = regmap_set_name(map, config);
+       if (ret)
+               goto err_map;
 
        if (config->disable_locking) {
                map->lock = map->unlock = regmap_lock_unlock_none;
@@ -1137,7 +1153,7 @@ skip_format_initialization:
                if (ret != 0)
                        goto err_regcache;
        } else {
-               regmap_debugfs_init(map, config->name);
+               regmap_debugfs_init(map);
        }
 
        return map;
@@ -1297,6 +1313,8 @@ EXPORT_SYMBOL_GPL(regmap_field_free);
  */
 int regmap_reinit_cache(struct regmap *map, const struct regmap_config *config)
 {
+       int ret;
+
        regcache_exit(map);
        regmap_debugfs_exit(map);
 
@@ -1309,7 +1327,11 @@ int regmap_reinit_cache(struct regmap *map, const struct regmap_config *config)
        map->readable_noinc_reg = config->readable_noinc_reg;
        map->cache_type = config->cache_type;
 
-       regmap_debugfs_init(map, config->name);
+       ret = regmap_set_name(map, config);
+       if (ret)
+               return ret;
+
+       regmap_debugfs_init(map);
 
        map->cache_bypass = false;
        map->cache_only = false;
@@ -1464,7 +1486,7 @@ static void regmap_set_work_buf_flag_mask(struct regmap *map, int max_bytes,
 }
 
 static int _regmap_raw_write_impl(struct regmap *map, unsigned int reg,
-                                 const void *val, size_t val_len)
+                                 const void *val, size_t val_len, bool noinc)
 {
        struct regmap_range_node *range;
        unsigned long flags;
@@ -1523,7 +1545,7 @@ static int _regmap_raw_write_impl(struct regmap *map, unsigned int reg,
                                win_residue, val_len / map->format.val_bytes);
                        ret = _regmap_raw_write_impl(map, reg, val,
                                                     win_residue *
-                                                    map->format.val_bytes);
+                                                    map->format.val_bytes, noinc);
                        if (ret != 0)
                                return ret;
 
@@ -1537,7 +1559,7 @@ static int _regmap_raw_write_impl(struct regmap *map, unsigned int reg,
                        win_residue = range->window_len - win_offset;
                }
 
-               ret = _regmap_select_page(map, &reg, range, val_num);
+               ret = _regmap_select_page(map, &reg, range, noinc ? 1 : val_num);
                if (ret != 0)
                        return ret;
        }
@@ -1745,7 +1767,8 @@ static int _regmap_bus_raw_write(void *context, unsigned int reg,
                                      map->work_buf +
                                      map->format.reg_bytes +
                                      map->format.pad_bytes,
-                                     map->format.val_bytes);
+                                     map->format.val_bytes,
+                                     false);
 }
 
 static inline void *_regmap_map_get_context(struct regmap *map)
@@ -1839,7 +1862,7 @@ int regmap_write_async(struct regmap *map, unsigned int reg, unsigned int val)
 EXPORT_SYMBOL_GPL(regmap_write_async);
 
 int _regmap_raw_write(struct regmap *map, unsigned int reg,
-                     const void *val, size_t val_len)
+                     const void *val, size_t val_len, bool noinc)
 {
        size_t val_bytes = map->format.val_bytes;
        size_t val_count = val_len / val_bytes;
@@ -1860,7 +1883,7 @@ int _regmap_raw_write(struct regmap *map, unsigned int reg,
 
        /* Write as many bytes as possible with chunk_size */
        for (i = 0; i < chunk_count; i++) {
-               ret = _regmap_raw_write_impl(map, reg, val, chunk_bytes);
+               ret = _regmap_raw_write_impl(map, reg, val, chunk_bytes, noinc);
                if (ret)
                        return ret;
 
@@ -1871,7 +1894,7 @@ int _regmap_raw_write(struct regmap *map, unsigned int reg,
 
        /* Write remaining bytes */
        if (val_len)
-               ret = _regmap_raw_write_impl(map, reg, val, val_len);
+               ret = _regmap_raw_write_impl(map, reg, val, val_len, noinc);
 
        return ret;
 }
@@ -1904,7 +1927,7 @@ int regmap_raw_write(struct regmap *map, unsigned int reg,
 
        map->lock(map->lock_arg);
 
-       ret = _regmap_raw_write(map, reg, val, val_len);
+       ret = _regmap_raw_write(map, reg, val, val_len, false);
 
        map->unlock(map->lock_arg);
 
@@ -1962,7 +1985,7 @@ int regmap_noinc_write(struct regmap *map, unsigned int reg,
                        write_len = map->max_raw_write;
                else
                        write_len = val_len;
-               ret = _regmap_raw_write(map, reg, val, write_len);
+               ret = _regmap_raw_write(map, reg, val, write_len, true);
                if (ret)
                        goto out_unlock;
                val = ((u8 *)val) + write_len;
@@ -2439,7 +2462,7 @@ int regmap_raw_write_async(struct regmap *map, unsigned int reg,
 
        map->async = true;
 
-       ret = _regmap_raw_write(map, reg, val, val_len);
+       ret = _regmap_raw_write(map, reg, val, val_len, false);
 
        map->async = false;
 
@@ -2450,7 +2473,7 @@ int regmap_raw_write_async(struct regmap *map, unsigned int reg,
 EXPORT_SYMBOL_GPL(regmap_raw_write_async);
 
 static int _regmap_raw_read(struct regmap *map, unsigned int reg, void *val,
-                           unsigned int val_len)
+                           unsigned int val_len, bool noinc)
 {
        struct regmap_range_node *range;
        int ret;
@@ -2463,7 +2486,7 @@ static int _regmap_raw_read(struct regmap *map, unsigned int reg, void *val,
        range = _regmap_range_lookup(map, reg);
        if (range) {
                ret = _regmap_select_page(map, &reg, range,
-                                         val_len / map->format.val_bytes);
+                                         noinc ? 1 : val_len / map->format.val_bytes);
                if (ret != 0)
                        return ret;
        }
@@ -2501,7 +2524,7 @@ static int _regmap_bus_read(void *context, unsigned int reg,
        if (!map->format.parse_val)
                return -EINVAL;
 
-       ret = _regmap_raw_read(map, reg, work_val, map->format.val_bytes);
+       ret = _regmap_raw_read(map, reg, work_val, map->format.val_bytes, false);
        if (ret == 0)
                *val = map->format.parse_val(work_val);
 
@@ -2617,7 +2640,7 @@ int regmap_raw_read(struct regmap *map, unsigned int reg, void *val,
 
                /* Read bytes that fit into whole chunks */
                for (i = 0; i < chunk_count; i++) {
-                       ret = _regmap_raw_read(map, reg, val, chunk_bytes);
+                       ret = _regmap_raw_read(map, reg, val, chunk_bytes, false);
                        if (ret != 0)
                                goto out;
 
@@ -2628,7 +2651,7 @@ int regmap_raw_read(struct regmap *map, unsigned int reg, void *val,
 
                /* Read remaining bytes */
                if (val_len) {
-                       ret = _regmap_raw_read(map, reg, val, val_len);
+                       ret = _regmap_raw_read(map, reg, val, val_len, false);
                        if (ret != 0)
                                goto out;
                }
@@ -2703,7 +2726,7 @@ int regmap_noinc_read(struct regmap *map, unsigned int reg,
                        read_len = map->max_raw_read;
                else
                        read_len = val_len;
-               ret = _regmap_raw_read(map, reg, val, read_len);
+               ret = _regmap_raw_read(map, reg, val, read_len, true);
                if (ret)
                        goto out_unlock;
                val = ((u8 *)val) + read_len;
index 51564fc..f408628 100644 (file)
@@ -927,7 +927,7 @@ static const struct samsung_gate_clock exynos4210_gate_clks[] __initconst = {
        GATE(CLK_PCIE, "pcie", "aclk133", GATE_IP_FSYS, 14, 0, 0),
        GATE(CLK_SMMU_PCIE, "smmu_pcie", "aclk133", GATE_IP_FSYS, 18, 0, 0),
        GATE(CLK_MODEMIF, "modemif", "aclk100", GATE_IP_PERIL, 28, 0, 0),
-       GATE(CLK_CHIPID, "chipid", "aclk100", E4210_GATE_IP_PERIR, 0, 0, 0),
+       GATE(CLK_CHIPID, "chipid", "aclk100", E4210_GATE_IP_PERIR, 0, CLK_IGNORE_UNUSED, 0),
        GATE(CLK_SYSREG, "sysreg", "aclk100", E4210_GATE_IP_PERIR, 0,
                        CLK_IGNORE_UNUSED, 0),
        GATE(CLK_HDMI_CEC, "hdmi_cec", "aclk100", E4210_GATE_IP_PERIR, 11, 0,
@@ -969,7 +969,7 @@ static const struct samsung_gate_clock exynos4x12_gate_clks[] __initconst = {
                0),
        GATE(CLK_TSADC, "tsadc", "aclk133", E4X12_GATE_BUS_FSYS1, 16, 0, 0),
        GATE(CLK_MIPI_HSI, "mipi_hsi", "aclk133", GATE_IP_FSYS, 10, 0, 0),
-       GATE(CLK_CHIPID, "chipid", "aclk100", E4X12_GATE_IP_PERIR, 0, 0, 0),
+       GATE(CLK_CHIPID, "chipid", "aclk100", E4X12_GATE_IP_PERIR, 0, CLK_IGNORE_UNUSED, 0),
        GATE(CLK_SYSREG, "sysreg", "aclk100", E4X12_GATE_IP_PERIR, 1,
                        CLK_IGNORE_UNUSED, 0),
        GATE(CLK_HDMI_CEC, "hdmi_cec", "aclk100", E4X12_GATE_IP_PERIR, 11, 0,
index fea3339..bd62087 100644 (file)
@@ -1655,6 +1655,11 @@ static void __init exynos5x_clk_init(struct device_node *np,
         * main G3D clock enablement status.
         */
        clk_prepare_enable(__clk_lookup("mout_sw_aclk_g3d"));
+       /*
+        * Keep top BPLL mux enabled permanently to ensure that DRAM operates
+        * properly.
+        */
+       clk_prepare_enable(__clk_lookup("mout_bpll"));
 
        samsung_clk_of_add_provider(np, ctx);
 }
index c1dfc9b..661a8e9 100644 (file)
@@ -209,7 +209,7 @@ static const struct stratix10_perip_cnt_clock s10_main_perip_cnt_clks[] = {
        { STRATIX10_EMAC_B_FREE_CLK, "emacb_free_clk", NULL, emacb_free_mux, ARRAY_SIZE(emacb_free_mux),
          0, 0, 2, 0xB0, 1},
        { STRATIX10_EMAC_PTP_FREE_CLK, "emac_ptp_free_clk", NULL, emac_ptp_free_mux,
-         ARRAY_SIZE(emac_ptp_free_mux), 0, 0, 4, 0xB0, 2},
+         ARRAY_SIZE(emac_ptp_free_mux), 0, 0, 2, 0xB0, 2},
        { STRATIX10_GPIO_DB_FREE_CLK, "gpio_db_free_clk", NULL, gpio_db_free_mux,
          ARRAY_SIZE(gpio_db_free_mux), 0, 0, 0, 0xB0, 3},
        { STRATIX10_SDMMC_FREE_CLK, "sdmmc_free_clk", NULL, sdmmc_free_mux,
index f180c05..c5cc0a2 100644 (file)
@@ -1611,9 +1611,6 @@ static int clk_plle_tegra114_enable(struct clk_hw *hw)
        unsigned long flags = 0;
        unsigned long input_rate;
 
-       if (clk_pll_is_enabled(hw))
-               return 0;
-
        input_rate = clk_hw_get_rate(clk_hw_get_parent(hw));
 
        if (_get_table_rate(hw, &sel, pll->params->fixed_rate, input_rate))
@@ -1673,7 +1670,7 @@ static int clk_plle_tegra114_enable(struct clk_hw *hw)
        pll_writel(val, PLLE_SS_CTRL, pll);
        udelay(1);
 
-       /* Enable hw control of xusb brick pll */
+       /* Enable HW control of XUSB brick PLL */
        val = pll_readl_misc(pll);
        val &= ~PLLE_MISC_IDDQ_SW_CTRL;
        pll_writel_misc(val, pll);
@@ -1696,7 +1693,7 @@ static int clk_plle_tegra114_enable(struct clk_hw *hw)
        val |= XUSBIO_PLL_CFG0_SEQ_ENABLE;
        pll_writel(val, XUSBIO_PLL_CFG0, pll);
 
-       /* Enable hw control of SATA pll */
+       /* Enable HW control of SATA PLL */
        val = pll_readl(SATA_PLL_CFG0, pll);
        val &= ~SATA_PLL_CFG0_PADPLL_RESET_SWCTL;
        val |= SATA_PLL_CFG0_PADPLL_USE_LOCKDET;
index 352a2c3..51fd0ec 100644 (file)
@@ -12,6 +12,8 @@
 #include <linux/io.h>
 #include <linux/slab.h>
 
+#include "clk.h"
+
 #define CLK_SOURCE_EMC 0x19c
 #define  CLK_SOURCE_EMC_2X_CLK_SRC GENMASK(31, 29)
 #define  CLK_SOURCE_EMC_MC_EMC_SAME_FREQ BIT(16)
index 1d740a8..47114c2 100644 (file)
@@ -169,7 +169,7 @@ static int __init h8300_8timer_init(struct device_node *node)
                return PTR_ERR(clk);
        }
 
-       ret = ENXIO;
+       ret = -ENXIO;
        base = of_iomap(node, 0);
        if (!base) {
                pr_err("failed to map registers for clockevent\n");
index d17367d..6cfe2ab 100644 (file)
@@ -38,6 +38,7 @@ static unsigned int clint_timer_irq;
 
 #ifdef CONFIG_RISCV_M_MODE
 u64 __iomem *clint_time_val;
+EXPORT_SYMBOL(clint_time_val);
 #endif
 
 static void clint_send_ipi(const struct cpumask *target)
index 80d0939..8d386ad 100644 (file)
@@ -28,6 +28,7 @@ static irqreturn_t gx6605s_timer_interrupt(int irq, void *dev)
        void __iomem *base = timer_of_base(to_timer_of(ce));
 
        writel_relaxed(GX6605S_STATUS_CLR, base + TIMER_STATUS);
+       writel_relaxed(0, base + TIMER_INI);
 
        ce->event_handler(ce);
 
index f6fd1c1..33b3e8a 100644 (file)
@@ -69,12 +69,33 @@ static bool dmtimer_systimer_revision1(struct dmtimer_systimer *t)
        return !(tidr >> 16);
 }
 
+static void dmtimer_systimer_enable(struct dmtimer_systimer *t)
+{
+       u32 val;
+
+       if (dmtimer_systimer_revision1(t))
+               val = DMTIMER_TYPE1_ENABLE;
+       else
+               val = DMTIMER_TYPE2_ENABLE;
+
+       writel_relaxed(val, t->base + t->sysc);
+}
+
+static void dmtimer_systimer_disable(struct dmtimer_systimer *t)
+{
+       if (!dmtimer_systimer_revision1(t))
+               return;
+
+       writel_relaxed(DMTIMER_TYPE1_DISABLE, t->base + t->sysc);
+}
+
 static int __init dmtimer_systimer_type1_reset(struct dmtimer_systimer *t)
 {
        void __iomem *syss = t->base + OMAP_TIMER_V1_SYS_STAT_OFFSET;
        int ret;
        u32 l;
 
+       dmtimer_systimer_enable(t);
        writel_relaxed(BIT(1) | BIT(2), t->base + t->ifctrl);
        ret = readl_poll_timeout_atomic(syss, l, l & BIT(0), 100,
                                        DMTIMER_RESET_WAIT);
@@ -88,6 +109,7 @@ static int __init dmtimer_systimer_type2_reset(struct dmtimer_systimer *t)
        void __iomem *sysc = t->base + t->sysc;
        u32 l;
 
+       dmtimer_systimer_enable(t);
        l = readl_relaxed(sysc);
        l |= BIT(0);
        writel_relaxed(l, sysc);
@@ -336,26 +358,6 @@ static int __init dmtimer_systimer_init_clock(struct dmtimer_systimer *t,
        return 0;
 }
 
-static void dmtimer_systimer_enable(struct dmtimer_systimer *t)
-{
-       u32 val;
-
-       if (dmtimer_systimer_revision1(t))
-               val = DMTIMER_TYPE1_ENABLE;
-       else
-               val = DMTIMER_TYPE2_ENABLE;
-
-       writel_relaxed(val, t->base + t->sysc);
-}
-
-static void dmtimer_systimer_disable(struct dmtimer_systimer *t)
-{
-       if (!dmtimer_systimer_revision1(t))
-               return;
-
-       writel_relaxed(DMTIMER_TYPE1_DISABLE, t->base + t->sysc);
-}
-
 static int __init dmtimer_systimer_setup(struct device_node *np,
                                         struct dmtimer_systimer *t)
 {
@@ -409,8 +411,8 @@ static int __init dmtimer_systimer_setup(struct device_node *np,
        t->wakeup = regbase + _OMAP_TIMER_WAKEUP_EN_OFFSET;
        t->ifctrl = regbase + _OMAP_TIMER_IF_CTRL_OFFSET;
 
-       dmtimer_systimer_enable(t);
        dmtimer_systimer_reset(t);
+       dmtimer_systimer_enable(t);
        pr_debug("dmtimer rev %08x sysc %08x\n", readl_relaxed(t->base),
                 readl_relaxed(t->base + t->sysc));
 
index cb72fb5..bf5830e 100644 (file)
@@ -283,7 +283,7 @@ config ARM_SPEAR_CPUFREQ
 
 config ARM_STI_CPUFREQ
        tristate "STi CPUFreq support"
-       depends on SOC_STIH407
+       depends on CPUFREQ_DT && SOC_STIH407
        help
          This driver uses the generic OPP framework to match the running
          platform with a predefined set of suitable values.  If not provided
index df1c941..b4af409 100644 (file)
@@ -484,6 +484,12 @@ remove_opp:
 /* late_initcall, to guarantee the driver is loaded after A37xx clock driver */
 late_initcall(armada37xx_cpufreq_driver_init);
 
+static const struct of_device_id __maybe_unused armada37xx_cpufreq_of_match[] = {
+       { .compatible = "marvell,armada-3700-nb-pm" },
+       { },
+};
+MODULE_DEVICE_TABLE(of, armada37xx_cpufreq_of_match);
+
 MODULE_AUTHOR("Gregory CLEMENT <gregory.clement@free-electrons.com>");
 MODULE_DESCRIPTION("Armada 37xx cpufreq driver");
 MODULE_LICENSE("GPL");
index 7d01df7..3776d96 100644 (file)
@@ -137,6 +137,7 @@ static const struct of_device_id blacklist[] __initconst = {
 
        { .compatible = "st,stih407", },
        { .compatible = "st,stih410", },
+       { .compatible = "st,stih418", },
 
        { .compatible = "sigma,tango4", },
 
index 944d7b4..e363ae0 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/cpufreq.h>
 #include <linux/cpumask.h>
 #include <linux/err.h>
+#include <linux/list.h>
 #include <linux/module.h>
 #include <linux/of.h>
 #include <linux/pm_opp.h>
 #include "cpufreq-dt.h"
 
 struct private_data {
-       struct opp_table *opp_table;
+       struct list_head node;
+
+       cpumask_var_t cpus;
        struct device *cpu_dev;
-       const char *reg_name;
+       struct opp_table *opp_table;
+       struct opp_table *reg_opp_table;
        bool have_static_opps;
 };
 
+static LIST_HEAD(priv_list);
+
 static struct freq_attr *cpufreq_dt_attr[] = {
        &cpufreq_freq_attr_scaling_available_freqs,
        NULL,   /* Extra space for boost-attr if required */
        NULL,
 };
 
+static struct private_data *cpufreq_dt_find_data(int cpu)
+{
+       struct private_data *priv;
+
+       list_for_each_entry(priv, &priv_list, node) {
+               if (cpumask_test_cpu(cpu, priv->cpus))
+                       return priv;
+       }
+
+       return NULL;
+}
+
 static int set_target(struct cpufreq_policy *policy, unsigned int index)
 {
        struct private_data *priv = policy->driver_data;
        unsigned long freq = policy->freq_table[index].frequency;
-       int ret;
-
-       ret = dev_pm_opp_set_rate(priv->cpu_dev, freq * 1000);
-
-       if (!ret) {
-               arch_set_freq_scale(policy->related_cpus, freq,
-                                   policy->cpuinfo.max_freq);
-       }
 
-       return ret;
+       return dev_pm_opp_set_rate(priv->cpu_dev, freq * 1000);
 }
 
 /*
@@ -90,83 +100,24 @@ node_put:
        return name;
 }
 
-static int resources_available(void)
-{
-       struct device *cpu_dev;
-       struct regulator *cpu_reg;
-       struct clk *cpu_clk;
-       int ret = 0;
-       const char *name;
-
-       cpu_dev = get_cpu_device(0);
-       if (!cpu_dev) {
-               pr_err("failed to get cpu0 device\n");
-               return -ENODEV;
-       }
-
-       cpu_clk = clk_get(cpu_dev, NULL);
-       ret = PTR_ERR_OR_ZERO(cpu_clk);
-       if (ret) {
-               /*
-                * If cpu's clk node is present, but clock is not yet
-                * registered, we should try defering probe.
-                */
-               if (ret == -EPROBE_DEFER)
-                       dev_dbg(cpu_dev, "clock not ready, retry\n");
-               else
-                       dev_err(cpu_dev, "failed to get clock: %d\n", ret);
-
-               return ret;
-       }
-
-       clk_put(cpu_clk);
-
-       ret = dev_pm_opp_of_find_icc_paths(cpu_dev, NULL);
-       if (ret)
-               return ret;
-
-       name = find_supply_name(cpu_dev);
-       /* Platform doesn't require regulator */
-       if (!name)
-               return 0;
-
-       cpu_reg = regulator_get_optional(cpu_dev, name);
-       ret = PTR_ERR_OR_ZERO(cpu_reg);
-       if (ret) {
-               /*
-                * If cpu's regulator supply node is present, but regulator is
-                * not yet registered, we should try defering probe.
-                */
-               if (ret == -EPROBE_DEFER)
-                       dev_dbg(cpu_dev, "cpu0 regulator not ready, retry\n");
-               else
-                       dev_dbg(cpu_dev, "no regulator for cpu0: %d\n", ret);
-
-               return ret;
-       }
-
-       regulator_put(cpu_reg);
-       return 0;
-}
-
 static int cpufreq_init(struct cpufreq_policy *policy)
 {
        struct cpufreq_frequency_table *freq_table;
-       struct opp_table *opp_table = NULL;
        struct private_data *priv;
        struct device *cpu_dev;
        struct clk *cpu_clk;
        unsigned int transition_latency;
-       bool fallback = false;
-       const char *name;
        int ret;
 
-       cpu_dev = get_cpu_device(policy->cpu);
-       if (!cpu_dev) {
-               pr_err("failed to get cpu%d device\n", policy->cpu);
+       priv = cpufreq_dt_find_data(policy->cpu);
+       if (!priv) {
+               pr_err("failed to find data for cpu%d\n", policy->cpu);
                return -ENODEV;
        }
 
+       cpu_dev = priv->cpu_dev;
+       cpumask_copy(policy->cpus, priv->cpus);
+
        cpu_clk = clk_get(cpu_dev, NULL);
        if (IS_ERR(cpu_clk)) {
                ret = PTR_ERR(cpu_clk);
@@ -174,45 +125,6 @@ static int cpufreq_init(struct cpufreq_policy *policy)
                return ret;
        }
 
-       /* Get OPP-sharing information from "operating-points-v2" bindings */
-       ret = dev_pm_opp_of_get_sharing_cpus(cpu_dev, policy->cpus);
-       if (ret) {
-               if (ret != -ENOENT)
-                       goto out_put_clk;
-
-               /*
-                * operating-points-v2 not supported, fallback to old method of
-                * finding shared-OPPs for backward compatibility if the
-                * platform hasn't set sharing CPUs.
-                */
-               if (dev_pm_opp_get_sharing_cpus(cpu_dev, policy->cpus))
-                       fallback = true;
-       }
-
-       /*
-        * OPP layer will be taking care of regulators now, but it needs to know
-        * the name of the regulator first.
-        */
-       name = find_supply_name(cpu_dev);
-       if (name) {
-               opp_table = dev_pm_opp_set_regulators(cpu_dev, &name, 1);
-               if (IS_ERR(opp_table)) {
-                       ret = PTR_ERR(opp_table);
-                       dev_err(cpu_dev, "Failed to set regulator for cpu%d: %d\n",
-                               policy->cpu, ret);
-                       goto out_put_clk;
-               }
-       }
-
-       priv = kzalloc(sizeof(*priv), GFP_KERNEL);
-       if (!priv) {
-               ret = -ENOMEM;
-               goto out_put_regulator;
-       }
-
-       priv->reg_name = name;
-       priv->opp_table = opp_table;
-
        /*
         * Initialize OPP tables for all policy->cpus. They will be shared by
         * all CPUs which have marked their CPUs shared with OPP bindings.
@@ -232,31 +144,17 @@ static int cpufreq_init(struct cpufreq_policy *policy)
         */
        ret = dev_pm_opp_get_opp_count(cpu_dev);
        if (ret <= 0) {
-               dev_dbg(cpu_dev, "OPP table is not ready, deferring probe\n");
-               ret = -EPROBE_DEFER;
+               dev_err(cpu_dev, "OPP table can't be empty\n");
+               ret = -ENODEV;
                goto out_free_opp;
        }
 
-       if (fallback) {
-               cpumask_setall(policy->cpus);
-
-               /*
-                * OPP tables are initialized only for policy->cpu, do it for
-                * others as well.
-                */
-               ret = dev_pm_opp_set_sharing_cpus(cpu_dev, policy->cpus);
-               if (ret)
-                       dev_err(cpu_dev, "%s: failed to mark OPPs as shared: %d\n",
-                               __func__, ret);
-       }
-
        ret = dev_pm_opp_init_cpufreq_table(cpu_dev, &freq_table);
        if (ret) {
                dev_err(cpu_dev, "failed to init cpufreq table: %d\n", ret);
                goto out_free_opp;
        }
 
-       priv->cpu_dev = cpu_dev;
        policy->driver_data = priv;
        policy->clk = cpu_clk;
        policy->freq_table = freq_table;
@@ -288,11 +186,6 @@ out_free_cpufreq_table:
 out_free_opp:
        if (priv->have_static_opps)
                dev_pm_opp_of_cpumask_remove_table(policy->cpus);
-       kfree(priv);
-out_put_regulator:
-       if (name)
-               dev_pm_opp_put_regulators(opp_table);
-out_put_clk:
        clk_put(cpu_clk);
 
        return ret;
@@ -320,12 +213,7 @@ static int cpufreq_exit(struct cpufreq_policy *policy)
        dev_pm_opp_free_cpufreq_table(priv->cpu_dev, &policy->freq_table);
        if (priv->have_static_opps)
                dev_pm_opp_of_cpumask_remove_table(policy->related_cpus);
-       if (priv->reg_name)
-               dev_pm_opp_put_regulators(priv->opp_table);
-
        clk_put(policy->clk);
-       kfree(priv);
-
        return 0;
 }
 
@@ -344,21 +232,119 @@ static struct cpufreq_driver dt_cpufreq_driver = {
        .suspend = cpufreq_generic_suspend,
 };
 
-static int dt_cpufreq_probe(struct platform_device *pdev)
+static int dt_cpufreq_early_init(struct device *dev, int cpu)
 {
-       struct cpufreq_dt_platform_data *data = dev_get_platdata(&pdev->dev);
+       struct private_data *priv;
+       struct device *cpu_dev;
+       const char *reg_name;
        int ret;
 
+       /* Check if this CPU is already covered by some other policy */
+       if (cpufreq_dt_find_data(cpu))
+               return 0;
+
+       cpu_dev = get_cpu_device(cpu);
+       if (!cpu_dev)
+               return -EPROBE_DEFER;
+
+       priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
+       if (!priv)
+               return -ENOMEM;
+
+       if (!alloc_cpumask_var(&priv->cpus, GFP_KERNEL))
+               return -ENOMEM;
+
+       priv->cpu_dev = cpu_dev;
+
+       /* Try to get OPP table early to ensure resources are available */
+       priv->opp_table = dev_pm_opp_get_opp_table(cpu_dev);
+       if (IS_ERR(priv->opp_table)) {
+               ret = PTR_ERR(priv->opp_table);
+               if (ret != -EPROBE_DEFER)
+                       dev_err(cpu_dev, "failed to get OPP table: %d\n", ret);
+               goto free_cpumask;
+       }
+
        /*
-        * All per-cluster (CPUs sharing clock/voltages) initialization is done
-        * from ->init(). In probe(), we just need to make sure that clk and
-        * regulators are available. Else defer probe and retry.
-        *
-        * FIXME: Is checking this only for CPU0 sufficient ?
+        * OPP layer will be taking care of regulators now, but it needs to know
+        * the name of the regulator first.
         */
-       ret = resources_available();
-       if (ret)
-               return ret;
+       reg_name = find_supply_name(cpu_dev);
+       if (reg_name) {
+               priv->reg_opp_table = dev_pm_opp_set_regulators(cpu_dev,
+                                                               &reg_name, 1);
+               if (IS_ERR(priv->reg_opp_table)) {
+                       ret = PTR_ERR(priv->reg_opp_table);
+                       if (ret != -EPROBE_DEFER)
+                               dev_err(cpu_dev, "failed to set regulators: %d\n",
+                                       ret);
+                       goto put_table;
+               }
+       }
+
+       /* Find OPP sharing information so we can fill pri->cpus here */
+       /* Get OPP-sharing information from "operating-points-v2" bindings */
+       ret = dev_pm_opp_of_get_sharing_cpus(cpu_dev, priv->cpus);
+       if (ret) {
+               if (ret != -ENOENT)
+                       goto put_reg;
+
+               /*
+                * operating-points-v2 not supported, fallback to all CPUs share
+                * OPP for backward compatibility if the platform hasn't set
+                * sharing CPUs.
+                */
+               if (dev_pm_opp_get_sharing_cpus(cpu_dev, priv->cpus)) {
+                       cpumask_setall(priv->cpus);
+
+                       /*
+                        * OPP tables are initialized only for cpu, do it for
+                        * others as well.
+                        */
+                       ret = dev_pm_opp_set_sharing_cpus(cpu_dev, priv->cpus);
+                       if (ret)
+                               dev_err(cpu_dev, "%s: failed to mark OPPs as shared: %d\n",
+                                       __func__, ret);
+               }
+       }
+
+       list_add(&priv->node, &priv_list);
+       return 0;
+
+put_reg:
+       if (priv->reg_opp_table)
+               dev_pm_opp_put_regulators(priv->reg_opp_table);
+put_table:
+       dev_pm_opp_put_opp_table(priv->opp_table);
+free_cpumask:
+       free_cpumask_var(priv->cpus);
+       return ret;
+}
+
+static void dt_cpufreq_release(void)
+{
+       struct private_data *priv, *tmp;
+
+       list_for_each_entry_safe(priv, tmp, &priv_list, node) {
+               if (priv->reg_opp_table)
+                       dev_pm_opp_put_regulators(priv->reg_opp_table);
+               dev_pm_opp_put_opp_table(priv->opp_table);
+               free_cpumask_var(priv->cpus);
+               list_del(&priv->node);
+       }
+}
+
+static int dt_cpufreq_probe(struct platform_device *pdev)
+{
+       struct cpufreq_dt_platform_data *data = dev_get_platdata(&pdev->dev);
+       int ret, cpu;
+
+       /* Request resources early so we can return in case of -EPROBE_DEFER */
+       for_each_possible_cpu(cpu) {
+               ret = dt_cpufreq_early_init(&pdev->dev, cpu);
+               if (ret)
+                       goto err;
+       }
 
        if (data) {
                if (data->have_governor_per_policy)
@@ -374,15 +360,21 @@ static int dt_cpufreq_probe(struct platform_device *pdev)
        }
 
        ret = cpufreq_register_driver(&dt_cpufreq_driver);
-       if (ret)
+       if (ret) {
                dev_err(&pdev->dev, "failed register driver: %d\n", ret);
+               goto err;
+       }
 
+       return 0;
+err:
+       dt_cpufreq_release();
        return ret;
 }
 
 static int dt_cpufreq_remove(struct platform_device *pdev)
 {
        cpufreq_unregister_driver(&dt_cpufreq_driver);
+       dt_cpufreq_release();
        return 0;
 }
 
index 47aa90f..1877f5e 100644 (file)
@@ -61,6 +61,12 @@ static struct cpufreq_driver *cpufreq_driver;
 static DEFINE_PER_CPU(struct cpufreq_policy *, cpufreq_cpu_data);
 static DEFINE_RWLOCK(cpufreq_driver_lock);
 
+static DEFINE_STATIC_KEY_FALSE(cpufreq_freq_invariance);
+bool cpufreq_supports_freq_invariance(void)
+{
+       return static_branch_likely(&cpufreq_freq_invariance);
+}
+
 /* Flag to suspend/resume CPUFreq governors */
 static bool cpufreq_suspended;
 
@@ -154,12 +160,6 @@ u64 get_cpu_idle_time(unsigned int cpu, u64 *wall, int io_busy)
 }
 EXPORT_SYMBOL_GPL(get_cpu_idle_time);
 
-__weak void arch_set_freq_scale(struct cpumask *cpus, unsigned long cur_freq,
-               unsigned long max_freq)
-{
-}
-EXPORT_SYMBOL_GPL(arch_set_freq_scale);
-
 /*
  * This is a generic cpufreq init() routine which can be used by cpufreq
  * drivers of SMP systems. It will do following:
@@ -446,6 +446,10 @@ void cpufreq_freq_transition_end(struct cpufreq_policy *policy,
 
        cpufreq_notify_post_transition(policy, freqs, transition_failed);
 
+       arch_set_freq_scale(policy->related_cpus,
+                           policy->cur,
+                           policy->cpuinfo.max_freq);
+
        policy->transition_ongoing = false;
        policy->transition_task = NULL;
 
@@ -2056,9 +2060,26 @@ EXPORT_SYMBOL(cpufreq_unregister_notifier);
 unsigned int cpufreq_driver_fast_switch(struct cpufreq_policy *policy,
                                        unsigned int target_freq)
 {
+       unsigned int freq;
+       int cpu;
+
        target_freq = clamp_val(target_freq, policy->min, policy->max);
+       freq = cpufreq_driver->fast_switch(policy, target_freq);
 
-       return cpufreq_driver->fast_switch(policy, target_freq);
+       if (!freq)
+               return 0;
+
+       policy->cur = freq;
+       arch_set_freq_scale(policy->related_cpus, freq,
+                           policy->cpuinfo.max_freq);
+       cpufreq_stats_record_transition(policy, freq);
+
+       if (trace_cpu_frequency_enabled()) {
+               for_each_cpu(cpu, policy->cpus)
+                       trace_cpu_frequency(freq, cpu);
+       }
+
+       return freq;
 }
 EXPORT_SYMBOL_GPL(cpufreq_driver_fast_switch);
 
@@ -2710,6 +2731,15 @@ int cpufreq_register_driver(struct cpufreq_driver *driver_data)
        cpufreq_driver = driver_data;
        write_unlock_irqrestore(&cpufreq_driver_lock, flags);
 
+       /*
+        * Mark support for the scheduler's frequency invariance engine for
+        * drivers that implement target(), target_index() or fast_switch().
+        */
+       if (!cpufreq_driver->setpolicy) {
+               static_branch_enable_cpuslocked(&cpufreq_freq_invariance);
+               pr_debug("supports frequency invariance");
+       }
+
        if (driver_data->setpolicy)
                driver_data->flags |= CPUFREQ_CONST_LOOPS;
 
@@ -2779,6 +2809,7 @@ int cpufreq_unregister_driver(struct cpufreq_driver *driver)
        cpus_read_lock();
        subsys_interface_unregister(&cpufreq_interface);
        remove_boost_sysfs_file();
+       static_branch_disable_cpuslocked(&cpufreq_freq_invariance);
        cpuhp_remove_state_nocalls_cpuslocked(hp_online);
 
        write_lock_irqsave(&cpufreq_driver_lock, flags);
index 94d959a..6cd5c8a 100644 (file)
@@ -19,64 +19,104 @@ struct cpufreq_stats {
        unsigned int state_num;
        unsigned int last_index;
        u64 *time_in_state;
-       spinlock_t lock;
        unsigned int *freq_table;
        unsigned int *trans_table;
+
+       /* Deferred reset */
+       unsigned int reset_pending;
+       unsigned long long reset_time;
 };
 
-static void cpufreq_stats_update(struct cpufreq_stats *stats)
+static void cpufreq_stats_update(struct cpufreq_stats *stats,
+                                unsigned long long time)
 {
        unsigned long long cur_time = get_jiffies_64();
 
-       stats->time_in_state[stats->last_index] += cur_time - stats->last_time;
+       stats->time_in_state[stats->last_index] += cur_time - time;
        stats->last_time = cur_time;
 }
 
-static void cpufreq_stats_clear_table(struct cpufreq_stats *stats)
+static void cpufreq_stats_reset_table(struct cpufreq_stats *stats)
 {
        unsigned int count = stats->max_state;
 
-       spin_lock(&stats->lock);
        memset(stats->time_in_state, 0, count * sizeof(u64));
        memset(stats->trans_table, 0, count * count * sizeof(int));
        stats->last_time = get_jiffies_64();
        stats->total_trans = 0;
-       spin_unlock(&stats->lock);
+
+       /* Adjust for the time elapsed since reset was requested */
+       WRITE_ONCE(stats->reset_pending, 0);
+       /*
+        * Prevent the reset_time read from being reordered before the
+        * reset_pending accesses in cpufreq_stats_record_transition().
+        */
+       smp_rmb();
+       cpufreq_stats_update(stats, READ_ONCE(stats->reset_time));
 }
 
 static ssize_t show_total_trans(struct cpufreq_policy *policy, char *buf)
 {
-       return sprintf(buf, "%d\n", policy->stats->total_trans);
+       struct cpufreq_stats *stats = policy->stats;
+
+       if (READ_ONCE(stats->reset_pending))
+               return sprintf(buf, "%d\n", 0);
+       else
+               return sprintf(buf, "%u\n", stats->total_trans);
 }
 cpufreq_freq_attr_ro(total_trans);
 
 static ssize_t show_time_in_state(struct cpufreq_policy *policy, char *buf)
 {
        struct cpufreq_stats *stats = policy->stats;
+       bool pending = READ_ONCE(stats->reset_pending);
+       unsigned long long time;
        ssize_t len = 0;
        int i;
 
-       if (policy->fast_switch_enabled)
-               return 0;
-
-       spin_lock(&stats->lock);
-       cpufreq_stats_update(stats);
-       spin_unlock(&stats->lock);
-
        for (i = 0; i < stats->state_num; i++) {
+               if (pending) {
+                       if (i == stats->last_index) {
+                               /*
+                                * Prevent the reset_time read from occurring
+                                * before the reset_pending read above.
+                                */
+                               smp_rmb();
+                               time = get_jiffies_64() - READ_ONCE(stats->reset_time);
+                       } else {
+                               time = 0;
+                       }
+               } else {
+                       time = stats->time_in_state[i];
+                       if (i == stats->last_index)
+                               time += get_jiffies_64() - stats->last_time;
+               }
+
                len += sprintf(buf + len, "%u %llu\n", stats->freq_table[i],
-                       (unsigned long long)
-                       jiffies_64_to_clock_t(stats->time_in_state[i]));
+                              jiffies_64_to_clock_t(time));
        }
        return len;
 }
 cpufreq_freq_attr_ro(time_in_state);
 
+/* We don't care what is written to the attribute */
 static ssize_t store_reset(struct cpufreq_policy *policy, const char *buf,
                           size_t count)
 {
-       /* We don't care what is written to the attribute. */
-       cpufreq_stats_clear_table(policy->stats);
+       struct cpufreq_stats *stats = policy->stats;
+
+       /*
+        * Defer resetting of stats to cpufreq_stats_record_transition() to
+        * avoid races.
+        */
+       WRITE_ONCE(stats->reset_time, get_jiffies_64());
+       /*
+        * The memory barrier below is to prevent the readers of reset_time from
+        * seeing a stale or partially updated value.
+        */
+       smp_wmb();
+       WRITE_ONCE(stats->reset_pending, 1);
+
        return count;
 }
 cpufreq_freq_attr_wo(reset);
@@ -84,11 +124,9 @@ cpufreq_freq_attr_wo(reset);
 static ssize_t show_trans_table(struct cpufreq_policy *policy, char *buf)
 {
        struct cpufreq_stats *stats = policy->stats;
+       bool pending = READ_ONCE(stats->reset_pending);
        ssize_t len = 0;
-       int i, j;
-
-       if (policy->fast_switch_enabled)
-               return 0;
+       int i, j, count;
 
        len += scnprintf(buf + len, PAGE_SIZE - len, "   From  :    To\n");
        len += scnprintf(buf + len, PAGE_SIZE - len, "         : ");
@@ -113,8 +151,13 @@ static ssize_t show_trans_table(struct cpufreq_policy *policy, char *buf)
                for (j = 0; j < stats->state_num; j++) {
                        if (len >= PAGE_SIZE)
                                break;
-                       len += scnprintf(buf + len, PAGE_SIZE - len, "%9u ",
-                                       stats->trans_table[i*stats->max_state+j]);
+
+                       if (pending)
+                               count = 0;
+                       else
+                               count = stats->trans_table[i * stats->max_state + j];
+
+                       len += scnprintf(buf + len, PAGE_SIZE - len, "%9u ", count);
                }
                if (len >= PAGE_SIZE)
                        break;
@@ -208,7 +251,6 @@ void cpufreq_stats_create_table(struct cpufreq_policy *policy)
        stats->state_num = i;
        stats->last_time = get_jiffies_64();
        stats->last_index = freq_table_get_index(stats, policy->cur);
-       spin_lock_init(&stats->lock);
 
        policy->stats = stats;
        ret = sysfs_create_group(&policy->kobj, &stats_attr_group);
@@ -228,23 +270,22 @@ void cpufreq_stats_record_transition(struct cpufreq_policy *policy,
        struct cpufreq_stats *stats = policy->stats;
        int old_index, new_index;
 
-       if (!stats) {
-               pr_debug("%s: No stats found\n", __func__);
+       if (unlikely(!stats))
                return;
-       }
+
+       if (unlikely(READ_ONCE(stats->reset_pending)))
+               cpufreq_stats_reset_table(stats);
 
        old_index = stats->last_index;
        new_index = freq_table_get_index(stats, new_freq);
 
        /* We can't do stats->time_in_state[-1]= .. */
-       if (old_index == -1 || new_index == -1 || old_index == new_index)
+       if (unlikely(old_index == -1 || new_index == -1 || old_index == new_index))
                return;
 
-       spin_lock(&stats->lock);
-       cpufreq_stats_update(stats);
+       cpufreq_stats_update(stats, stats->last_time);
 
        stats->last_index = new_index;
        stats->trans_table[old_index * stats->max_state + new_index]++;
        stats->total_trans++;
-       spin_unlock(&stats->lock);
 }
index ef7b34c..5bf5fc7 100644 (file)
@@ -48,7 +48,6 @@ static struct clk_bulk_data clks[] = {
 };
 
 static struct device *cpu_dev;
-static bool free_opp;
 static struct cpufreq_frequency_table *freq_table;
 static unsigned int max_freq;
 static unsigned int transition_latency;
@@ -390,9 +389,6 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev)
                goto put_reg;
        }
 
-       /* Because we have added the OPPs here, we must free them */
-       free_opp = true;
-
        if (of_machine_is_compatible("fsl,imx6ul") ||
            of_machine_is_compatible("fsl,imx6ull")) {
                ret = imx6ul_opp_check_speed_grading(cpu_dev);
@@ -507,8 +503,7 @@ soc_opp_out:
 free_freq_table:
        dev_pm_opp_free_cpufreq_table(cpu_dev, &freq_table);
 out_free_opp:
-       if (free_opp)
-               dev_pm_opp_of_remove_table(cpu_dev);
+       dev_pm_opp_of_remove_table(cpu_dev);
 put_reg:
        if (!IS_ERR(arm_reg))
                regulator_put(arm_reg);
@@ -528,8 +523,7 @@ static int imx6q_cpufreq_remove(struct platform_device *pdev)
 {
        cpufreq_unregister_driver(&imx6q_cpufreq_driver);
        dev_pm_opp_free_cpufreq_table(cpu_dev, &freq_table);
-       if (free_opp)
-               dev_pm_opp_of_remove_table(cpu_dev);
+       dev_pm_opp_of_remove_table(cpu_dev);
        regulator_put(arm_reg);
        if (!IS_ERR(pu_reg))
                regulator_put(pu_reg);
index a827b00..9a515c4 100644 (file)
@@ -2781,6 +2781,7 @@ static int intel_pstate_update_status(const char *buf, size_t size)
 
                cpufreq_unregister_driver(intel_pstate_driver);
                intel_pstate_driver_cleanup();
+               return 0;
        }
 
        if (size == 6 && !strncmp(buf, "active", size)) {
index 3fb044b..9ed5341 100644 (file)
 #define LUT_L_VAL                      GENMASK(7, 0)
 #define LUT_CORE_COUNT                 GENMASK(18, 16)
 #define LUT_VOLT                       GENMASK(11, 0)
-#define LUT_ROW_SIZE                   32
 #define CLK_HW_DIV                     2
 #define LUT_TURBO_IND                  1
 
-/* Register offsets */
-#define REG_ENABLE                     0x0
-#define REG_FREQ_LUT                   0x110
-#define REG_VOLT_LUT                   0x114
-#define REG_PERF_STATE                 0x920
+struct qcom_cpufreq_soc_data {
+       u32 reg_enable;
+       u32 reg_freq_lut;
+       u32 reg_volt_lut;
+       u32 reg_perf_state;
+       u8 lut_row_size;
+};
+
+struct qcom_cpufreq_data {
+       void __iomem *base;
+       const struct qcom_cpufreq_soc_data *soc_data;
+};
 
 static unsigned long cpu_hw_rate, xo_rate;
-static struct platform_device *global_pdev;
 static bool icc_scaling_enabled;
 
 static int qcom_cpufreq_set_bw(struct cpufreq_policy *policy,
@@ -77,22 +82,22 @@ static int qcom_cpufreq_update_opp(struct device *cpu_dev,
 static int qcom_cpufreq_hw_target_index(struct cpufreq_policy *policy,
                                        unsigned int index)
 {
-       void __iomem *perf_state_reg = policy->driver_data;
+       struct qcom_cpufreq_data *data = policy->driver_data;
+       const struct qcom_cpufreq_soc_data *soc_data = data->soc_data;
        unsigned long freq = policy->freq_table[index].frequency;
 
-       writel_relaxed(index, perf_state_reg);
+       writel_relaxed(index, data->base + soc_data->reg_perf_state);
 
        if (icc_scaling_enabled)
                qcom_cpufreq_set_bw(policy, freq);
 
-       arch_set_freq_scale(policy->related_cpus, freq,
-                           policy->cpuinfo.max_freq);
        return 0;
 }
 
 static unsigned int qcom_cpufreq_hw_get(unsigned int cpu)
 {
-       void __iomem *perf_state_reg;
+       struct qcom_cpufreq_data *data;
+       const struct qcom_cpufreq_soc_data *soc_data;
        struct cpufreq_policy *policy;
        unsigned int index;
 
@@ -100,9 +105,10 @@ static unsigned int qcom_cpufreq_hw_get(unsigned int cpu)
        if (!policy)
                return 0;
 
-       perf_state_reg = policy->driver_data;
+       data = policy->driver_data;
+       soc_data = data->soc_data;
 
-       index = readl_relaxed(perf_state_reg);
+       index = readl_relaxed(data->base + soc_data->reg_perf_state);
        index = min(index, LUT_MAX_ENTRIES - 1);
 
        return policy->freq_table[index].frequency;
@@ -111,23 +117,18 @@ static unsigned int qcom_cpufreq_hw_get(unsigned int cpu)
 static unsigned int qcom_cpufreq_hw_fast_switch(struct cpufreq_policy *policy,
                                                unsigned int target_freq)
 {
-       void __iomem *perf_state_reg = policy->driver_data;
+       struct qcom_cpufreq_data *data = policy->driver_data;
+       const struct qcom_cpufreq_soc_data *soc_data = data->soc_data;
        unsigned int index;
-       unsigned long freq;
 
        index = policy->cached_resolved_idx;
-       writel_relaxed(index, perf_state_reg);
+       writel_relaxed(index, data->base + soc_data->reg_perf_state);
 
-       freq = policy->freq_table[index].frequency;
-       arch_set_freq_scale(policy->related_cpus, freq,
-                           policy->cpuinfo.max_freq);
-
-       return freq;
+       return policy->freq_table[index].frequency;
 }
 
 static int qcom_cpufreq_hw_read_lut(struct device *cpu_dev,
-                                   struct cpufreq_policy *policy,
-                                   void __iomem *base)
+                                   struct cpufreq_policy *policy)
 {
        u32 data, src, lval, i, core_count, prev_freq = 0, freq;
        u32 volt;
@@ -135,6 +136,8 @@ static int qcom_cpufreq_hw_read_lut(struct device *cpu_dev,
        struct dev_pm_opp *opp;
        unsigned long rate;
        int ret;
+       struct qcom_cpufreq_data *drv_data = policy->driver_data;
+       const struct qcom_cpufreq_soc_data *soc_data = drv_data->soc_data;
 
        table = kcalloc(LUT_MAX_ENTRIES + 1, sizeof(*table), GFP_KERNEL);
        if (!table)
@@ -161,14 +164,14 @@ static int qcom_cpufreq_hw_read_lut(struct device *cpu_dev,
        }
 
        for (i = 0; i < LUT_MAX_ENTRIES; i++) {
-               data = readl_relaxed(base + REG_FREQ_LUT +
-                                     i * LUT_ROW_SIZE);
+               data = readl_relaxed(drv_data->base + soc_data->reg_freq_lut +
+                                     i * soc_data->lut_row_size);
                src = FIELD_GET(LUT_SRC, data);
                lval = FIELD_GET(LUT_L_VAL, data);
                core_count = FIELD_GET(LUT_CORE_COUNT, data);
 
-               data = readl_relaxed(base + REG_VOLT_LUT +
-                                     i * LUT_ROW_SIZE);
+               data = readl_relaxed(drv_data->base + soc_data->reg_volt_lut +
+                                     i * soc_data->lut_row_size);
                volt = FIELD_GET(LUT_VOLT, data) * 1000;
 
                if (src)
@@ -177,10 +180,15 @@ static int qcom_cpufreq_hw_read_lut(struct device *cpu_dev,
                        freq = cpu_hw_rate / 1000;
 
                if (freq != prev_freq && core_count != LUT_TURBO_IND) {
-                       table[i].frequency = freq;
-                       qcom_cpufreq_update_opp(cpu_dev, freq, volt);
-                       dev_dbg(cpu_dev, "index=%d freq=%d, core_count %d\n", i,
+                       if (!qcom_cpufreq_update_opp(cpu_dev, freq, volt)) {
+                               table[i].frequency = freq;
+                               dev_dbg(cpu_dev, "index=%d freq=%d, core_count %d\n", i,
                                freq, core_count);
+                       } else {
+                               dev_warn(cpu_dev, "failed to update OPP for freq=%d\n", freq);
+                               table[i].frequency = CPUFREQ_ENTRY_INVALID;
+                       }
+
                } else if (core_count == LUT_TURBO_IND) {
                        table[i].frequency = CPUFREQ_ENTRY_INVALID;
                }
@@ -197,9 +205,13 @@ static int qcom_cpufreq_hw_read_lut(struct device *cpu_dev,
                         * as the boost frequency
                         */
                        if (prev->frequency == CPUFREQ_ENTRY_INVALID) {
-                               prev->frequency = prev_freq;
-                               prev->flags = CPUFREQ_BOOST_FREQ;
-                               qcom_cpufreq_update_opp(cpu_dev, prev_freq, volt);
+                               if (!qcom_cpufreq_update_opp(cpu_dev, prev_freq, volt)) {
+                                       prev->frequency = prev_freq;
+                                       prev->flags = CPUFREQ_BOOST_FREQ;
+                               } else {
+                                       dev_warn(cpu_dev, "failed to update OPP for freq=%d\n",
+                                                freq);
+                               }
                        }
 
                        break;
@@ -238,14 +250,38 @@ static void qcom_get_related_cpus(int index, struct cpumask *m)
        }
 }
 
+static const struct qcom_cpufreq_soc_data qcom_soc_data = {
+       .reg_enable = 0x0,
+       .reg_freq_lut = 0x110,
+       .reg_volt_lut = 0x114,
+       .reg_perf_state = 0x920,
+       .lut_row_size = 32,
+};
+
+static const struct qcom_cpufreq_soc_data epss_soc_data = {
+       .reg_enable = 0x0,
+       .reg_freq_lut = 0x100,
+       .reg_volt_lut = 0x200,
+       .reg_perf_state = 0x320,
+       .lut_row_size = 4,
+};
+
+static const struct of_device_id qcom_cpufreq_hw_match[] = {
+       { .compatible = "qcom,cpufreq-hw", .data = &qcom_soc_data },
+       { .compatible = "qcom,cpufreq-epss", .data = &epss_soc_data },
+       {}
+};
+MODULE_DEVICE_TABLE(of, qcom_cpufreq_hw_match);
+
 static int qcom_cpufreq_hw_cpu_init(struct cpufreq_policy *policy)
 {
-       struct device *dev = &global_pdev->dev;
+       struct platform_device *pdev = cpufreq_get_driver_data();
+       struct device *dev = &pdev->dev;
        struct of_phandle_args args;
        struct device_node *cpu_np;
        struct device *cpu_dev;
-       struct resource *res;
        void __iomem *base;
+       struct qcom_cpufreq_data *data;
        int ret, index;
 
        cpu_dev = get_cpu_device(policy->cpu);
@@ -267,16 +303,21 @@ static int qcom_cpufreq_hw_cpu_init(struct cpufreq_policy *policy)
 
        index = args.args[0];
 
-       res = platform_get_resource(global_pdev, IORESOURCE_MEM, index);
-       if (!res)
-               return -ENODEV;
+       base = devm_platform_ioremap_resource(pdev, index);
+       if (IS_ERR(base))
+               return PTR_ERR(base);
 
-       base = devm_ioremap(dev, res->start, resource_size(res));
-       if (!base)
-               return -ENOMEM;
+       data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
+       if (!data) {
+               ret = -ENOMEM;
+               goto error;
+       }
+
+       data->soc_data = of_device_get_match_data(&pdev->dev);
+       data->base = base;
 
        /* HW should be in enabled state to proceed */
-       if (!(readl_relaxed(base + REG_ENABLE) & 0x1)) {
+       if (!(readl_relaxed(base + data->soc_data->reg_enable) & 0x1)) {
                dev_err(dev, "Domain-%d cpufreq hardware not enabled\n", index);
                ret = -ENODEV;
                goto error;
@@ -289,9 +330,9 @@ static int qcom_cpufreq_hw_cpu_init(struct cpufreq_policy *policy)
                goto error;
        }
 
-       policy->driver_data = base + REG_PERF_STATE;
+       policy->driver_data = data;
 
-       ret = qcom_cpufreq_hw_read_lut(cpu_dev, policy, base);
+       ret = qcom_cpufreq_hw_read_lut(cpu_dev, policy);
        if (ret) {
                dev_err(dev, "Domain-%d failed to read LUT\n", index);
                goto error;
@@ -315,12 +356,13 @@ error:
 static int qcom_cpufreq_hw_cpu_exit(struct cpufreq_policy *policy)
 {
        struct device *cpu_dev = get_cpu_device(policy->cpu);
-       void __iomem *base = policy->driver_data - REG_PERF_STATE;
+       struct qcom_cpufreq_data *data = policy->driver_data;
+       struct platform_device *pdev = cpufreq_get_driver_data();
 
        dev_pm_opp_remove_all_dynamic(cpu_dev);
        dev_pm_opp_of_cpumask_remove_table(policy->related_cpus);
        kfree(policy->freq_table);
-       devm_iounmap(&global_pdev->dev, base);
+       devm_iounmap(&pdev->dev, data->base);
 
        return 0;
 }
@@ -365,7 +407,7 @@ static int qcom_cpufreq_hw_driver_probe(struct platform_device *pdev)
        cpu_hw_rate = clk_get_rate(clk) / CLK_HW_DIV;
        clk_put(clk);
 
-       global_pdev = pdev;
+       cpufreq_qcom_hw_driver.driver_data = pdev;
 
        /* Check for optional interconnect paths on CPU0 */
        cpu_dev = get_cpu_device(0);
@@ -390,12 +432,6 @@ static int qcom_cpufreq_hw_driver_remove(struct platform_device *pdev)
        return cpufreq_unregister_driver(&cpufreq_qcom_hw_driver);
 }
 
-static const struct of_device_id qcom_cpufreq_hw_match[] = {
-       { .compatible = "qcom,cpufreq-hw" },
-       {}
-};
-MODULE_DEVICE_TABLE(of, qcom_cpufreq_hw_match);
-
 static struct platform_driver qcom_cpufreq_hw_driver = {
        .probe = qcom_cpufreq_hw_driver_probe,
        .remove = qcom_cpufreq_hw_driver_remove,
index e84281e..bed496c 100644 (file)
@@ -590,6 +590,7 @@ static struct notifier_block s5pv210_cpufreq_reboot_notifier = {
 
 static int s5pv210_cpufreq_probe(struct platform_device *pdev)
 {
+       struct device *dev = &pdev->dev;
        struct device_node *np;
        int id, result = 0;
 
@@ -602,28 +603,20 @@ static int s5pv210_cpufreq_probe(struct platform_device *pdev)
         * cpufreq-dt driver.
         */
        arm_regulator = regulator_get(NULL, "vddarm");
-       if (IS_ERR(arm_regulator)) {
-               if (PTR_ERR(arm_regulator) == -EPROBE_DEFER)
-                       pr_debug("vddarm regulator not ready, defer\n");
-               else
-                       pr_err("failed to get regulator vddarm\n");
-               return PTR_ERR(arm_regulator);
-       }
+       if (IS_ERR(arm_regulator))
+               return dev_err_probe(dev, PTR_ERR(arm_regulator),
+                                    "failed to get regulator vddarm\n");
 
        int_regulator = regulator_get(NULL, "vddint");
        if (IS_ERR(int_regulator)) {
-               if (PTR_ERR(int_regulator) == -EPROBE_DEFER)
-                       pr_debug("vddint regulator not ready, defer\n");
-               else
-                       pr_err("failed to get regulator vddint\n");
-               result = PTR_ERR(int_regulator);
+               result = dev_err_probe(dev, PTR_ERR(int_regulator),
+                                      "failed to get regulator vddint\n");
                goto err_int_regulator;
        }
 
        np = of_find_compatible_node(NULL, NULL, "samsung,s5pv210-clock");
        if (!np) {
-               pr_err("%s: failed to find clock controller DT node\n",
-                       __func__);
+               dev_err(dev, "failed to find clock controller DT node\n");
                result = -ENODEV;
                goto err_clock;
        }
@@ -631,7 +624,7 @@ static int s5pv210_cpufreq_probe(struct platform_device *pdev)
        clk_base = of_iomap(np, 0);
        of_node_put(np);
        if (!clk_base) {
-               pr_err("%s: failed to map clock registers\n", __func__);
+               dev_err(dev, "failed to map clock registers\n");
                result = -EFAULT;
                goto err_clock;
        }
@@ -639,8 +632,7 @@ static int s5pv210_cpufreq_probe(struct platform_device *pdev)
        for_each_compatible_node(np, NULL, "samsung,s5pv210-dmc") {
                id = of_alias_get_id(np, "dmc");
                if (id < 0 || id >= ARRAY_SIZE(dmc_base)) {
-                       pr_err("%s: failed to get alias of dmc node '%pOFn'\n",
-                               __func__, np);
+                       dev_err(dev, "failed to get alias of dmc node '%pOFn'\n", np);
                        of_node_put(np);
                        result = id;
                        goto err_clk_base;
@@ -648,8 +640,7 @@ static int s5pv210_cpufreq_probe(struct platform_device *pdev)
 
                dmc_base[id] = of_iomap(np, 0);
                if (!dmc_base[id]) {
-                       pr_err("%s: failed to map dmc%d registers\n",
-                               __func__, id);
+                       dev_err(dev, "failed to map dmc%d registers\n", id);
                        of_node_put(np);
                        result = -EFAULT;
                        goto err_dmc;
@@ -658,7 +649,7 @@ static int s5pv210_cpufreq_probe(struct platform_device *pdev)
 
        for (id = 0; id < ARRAY_SIZE(dmc_base); ++id) {
                if (!dmc_base[id]) {
-                       pr_err("%s: failed to find dmc%d node\n", __func__, id);
+                       dev_err(dev, "failed to find dmc%d node\n", id);
                        result = -ENODEV;
                        goto err_dmc;
                }
index fb42e33..6dd1311 100644 (file)
@@ -48,16 +48,11 @@ static unsigned int scmi_cpufreq_get_rate(unsigned int cpu)
 static int
 scmi_cpufreq_set_target(struct cpufreq_policy *policy, unsigned int index)
 {
-       int ret;
        struct scmi_data *priv = policy->driver_data;
        struct scmi_perf_ops *perf_ops = handle->perf_ops;
        u64 freq = policy->freq_table[index].frequency;
 
-       ret = perf_ops->freq_set(handle, priv->domain_id, freq * 1000, false);
-       if (!ret)
-               arch_set_freq_scale(policy->related_cpus, freq,
-                                   policy->cpuinfo.max_freq);
-       return ret;
+       return perf_ops->freq_set(handle, priv->domain_id, freq * 1000, false);
 }
 
 static unsigned int scmi_cpufreq_fast_switch(struct cpufreq_policy *policy,
@@ -67,11 +62,8 @@ static unsigned int scmi_cpufreq_fast_switch(struct cpufreq_policy *policy,
        struct scmi_perf_ops *perf_ops = handle->perf_ops;
 
        if (!perf_ops->freq_set(handle, priv->domain_id,
-                               target_freq * 1000, true)) {
-               arch_set_freq_scale(policy->related_cpus, target_freq,
-                                   policy->cpuinfo.max_freq);
+                               target_freq * 1000, true))
                return target_freq;
-       }
 
        return 0;
 }
index b0f5388..43db05b 100644 (file)
@@ -47,9 +47,8 @@ static unsigned int scpi_cpufreq_get_rate(unsigned int cpu)
 static int
 scpi_cpufreq_set_target(struct cpufreq_policy *policy, unsigned int index)
 {
-       unsigned long freq = policy->freq_table[index].frequency;
+       u64 rate = policy->freq_table[index].frequency * 1000;
        struct scpi_data *priv = policy->driver_data;
-       u64 rate = freq * 1000;
        int ret;
 
        ret = clk_set_rate(priv->clk, rate);
@@ -60,9 +59,6 @@ scpi_cpufreq_set_target(struct cpufreq_policy *policy, unsigned int index)
        if (clk_get_rate(priv->clk) != rate)
                return -EIO;
 
-       arch_set_freq_scale(policy->related_cpus, freq,
-                           policy->cpuinfo.max_freq);
-
        return 0;
 }
 
index a5ad96d..4ac6fb2 100644 (file)
@@ -141,7 +141,8 @@ static const struct reg_field sti_stih407_dvfs_regfields[DVFS_MAX_REGFIELDS] = {
 static const struct reg_field *sti_cpufreq_match(void)
 {
        if (of_machine_is_compatible("st,stih407") ||
-           of_machine_is_compatible("st,stih410"))
+           of_machine_is_compatible("st,stih410") ||
+           of_machine_is_compatible("st,stih418"))
                return sti_stih407_dvfs_regfields;
 
        return NULL;
@@ -258,7 +259,8 @@ static int sti_cpufreq_init(void)
        int ret;
 
        if ((!of_machine_is_compatible("st,stih407")) &&
-               (!of_machine_is_compatible("st,stih410")))
+               (!of_machine_is_compatible("st,stih410")) &&
+               (!of_machine_is_compatible("st,stih418")))
                return -ENODEV;
 
        ddata.cpu = get_cpu_device(0);
index 01e1f58..4b4079f 100644 (file)
@@ -14,6 +14,7 @@
 
 #define EDVD_CORE_VOLT_FREQ(core)              (0x20 + (core) * 0x4)
 #define EDVD_CORE_VOLT_FREQ_F_SHIFT            0
+#define EDVD_CORE_VOLT_FREQ_F_MASK             0xffff
 #define EDVD_CORE_VOLT_FREQ_V_SHIFT            16
 
 struct tegra186_cpufreq_cluster_info {
@@ -91,10 +92,39 @@ static int tegra186_cpufreq_set_target(struct cpufreq_policy *policy,
        return 0;
 }
 
+static unsigned int tegra186_cpufreq_get(unsigned int cpu)
+{
+       struct cpufreq_frequency_table *tbl;
+       struct cpufreq_policy *policy;
+       void __iomem *edvd_reg;
+       unsigned int i, freq = 0;
+       u32 ndiv;
+
+       policy = cpufreq_cpu_get(cpu);
+       if (!policy)
+               return 0;
+
+       tbl = policy->freq_table;
+       edvd_reg = policy->driver_data;
+       ndiv = readl(edvd_reg) & EDVD_CORE_VOLT_FREQ_F_MASK;
+
+       for (i = 0; tbl[i].frequency != CPUFREQ_TABLE_END; i++) {
+               if ((tbl[i].driver_data & EDVD_CORE_VOLT_FREQ_F_MASK) == ndiv) {
+                       freq = tbl[i].frequency;
+                       break;
+               }
+       }
+
+       cpufreq_cpu_put(policy);
+
+       return freq;
+}
+
 static struct cpufreq_driver tegra186_cpufreq_driver = {
        .name = "tegra186",
        .flags = CPUFREQ_STICKY | CPUFREQ_HAVE_GOVERNOR_PER_POLICY |
                        CPUFREQ_NEED_INITIAL_FREQ_CHECK,
+       .get = tegra186_cpufreq_get,
        .verify = cpufreq_generic_frequency_table_verify,
        .target_index = tegra186_cpufreq_set_target,
        .init = tegra186_cpufreq_init,
index 4e8b1de..e89b905 100644 (file)
@@ -182,7 +182,6 @@ static int ve_spc_cpufreq_set_target(struct cpufreq_policy *policy,
 {
        u32 cpu = policy->cpu, cur_cluster, new_cluster, actual_cluster;
        unsigned int freqs_new;
-       int ret;
 
        cur_cluster = cpu_to_cluster(cpu);
        new_cluster = actual_cluster = per_cpu(physical_cluster, cpu);
@@ -197,15 +196,8 @@ static int ve_spc_cpufreq_set_target(struct cpufreq_policy *policy,
                        new_cluster = A15_CLUSTER;
        }
 
-       ret = ve_spc_cpufreq_set_rate(cpu, actual_cluster, new_cluster,
-                                     freqs_new);
-
-       if (!ret) {
-               arch_set_freq_scale(policy->related_cpus, freqs_new,
-                                   policy->cpuinfo.max_freq);
-       }
-
-       return ret;
+       return ve_spc_cpufreq_set_rate(cpu, actual_cluster, new_cluster,
+                                      freqs_new);
 }
 
 static inline u32 get_table_count(struct cpufreq_frequency_table *table)
index b6e9649..4a031c6 100644 (file)
@@ -105,7 +105,7 @@ static void psci_pd_free_states(struct genpd_power_state *states,
        kfree(states);
 }
 
-static int psci_pd_init(struct device_node *np)
+static int psci_pd_init(struct device_node *np, bool use_osi)
 {
        struct generic_pm_domain *pd;
        struct psci_pd_provider *pd_provider;
@@ -135,11 +135,16 @@ static int psci_pd_init(struct device_node *np)
 
        pd->free_states = psci_pd_free_states;
        pd->name = kbasename(pd->name);
-       pd->power_off = psci_pd_power_off;
        pd->states = states;
        pd->state_count = state_count;
        pd->flags |= GENPD_FLAG_IRQ_SAFE | GENPD_FLAG_CPU_DOMAIN;
 
+       /* Allow power off when OSI has been successfully enabled. */
+       if (use_osi)
+               pd->power_off = psci_pd_power_off;
+       else
+               pd->flags |= GENPD_FLAG_ALWAYS_ON;
+
        /* Use governor for CPU PM domains if it has some states to manage. */
        pd_gov = state_count > 0 ? &pm_domain_cpu_gov : NULL;
 
@@ -190,7 +195,7 @@ static void psci_pd_remove(void)
        }
 }
 
-static int psci_pd_init_topology(struct device_node *np, bool add)
+static int psci_pd_init_topology(struct device_node *np)
 {
        struct device_node *node;
        struct of_phandle_args child, parent;
@@ -203,9 +208,7 @@ static int psci_pd_init_topology(struct device_node *np, bool add)
 
                child.np = node;
                child.args_count = 0;
-
-               ret = add ? of_genpd_add_subdomain(&parent, &child) :
-                       of_genpd_remove_subdomain(&parent, &child);
+               ret = of_genpd_add_subdomain(&parent, &child);
                of_node_put(parent.np);
                if (ret) {
                        of_node_put(node);
@@ -216,14 +219,20 @@ static int psci_pd_init_topology(struct device_node *np, bool add)
        return 0;
 }
 
-static int psci_pd_add_topology(struct device_node *np)
+static bool psci_pd_try_set_osi_mode(void)
 {
-       return psci_pd_init_topology(np, true);
-}
+       int ret;
 
-static void psci_pd_remove_topology(struct device_node *np)
-{
-       psci_pd_init_topology(np, false);
+       if (!psci_has_osi_support())
+               return false;
+
+       ret = psci_set_osi_mode(true);
+       if (ret) {
+               pr_warn("failed to enable OSI mode: %d\n", ret);
+               return false;
+       }
+
+       return true;
 }
 
 static void psci_cpuidle_domain_sync_state(struct device *dev)
@@ -244,14 +253,14 @@ static int psci_cpuidle_domain_probe(struct platform_device *pdev)
 {
        struct device_node *np = pdev->dev.of_node;
        struct device_node *node;
+       bool use_osi;
        int ret = 0, pd_count = 0;
 
        if (!np)
                return -ENODEV;
 
-       /* Currently limit the hierarchical topology to be used in OSI mode. */
-       if (!psci_has_osi_support())
-               return 0;
+       /* If OSI mode is supported, let's try to enable it. */
+       use_osi = psci_pd_try_set_osi_mode();
 
        /*
         * Parse child nodes for the "#power-domain-cells" property and
@@ -261,7 +270,7 @@ static int psci_cpuidle_domain_probe(struct platform_device *pdev)
                if (!of_find_property(node, "#power-domain-cells", NULL))
                        continue;
 
-               ret = psci_pd_init(node);
+               ret = psci_pd_init(node, use_osi);
                if (ret)
                        goto put_node;
 
@@ -270,30 +279,24 @@ static int psci_cpuidle_domain_probe(struct platform_device *pdev)
 
        /* Bail out if not using the hierarchical CPU topology. */
        if (!pd_count)
-               return 0;
+               goto no_pd;
 
        /* Link genpd masters/subdomains to model the CPU topology. */
-       ret = psci_pd_add_topology(np);
+       ret = psci_pd_init_topology(np);
        if (ret)
                goto remove_pd;
 
-       /* Try to enable OSI mode. */
-       ret = psci_set_osi_mode();
-       if (ret) {
-               pr_warn("failed to enable OSI mode: %d\n", ret);
-               psci_pd_remove_topology(np);
-               goto remove_pd;
-       }
-
        pr_info("Initialized CPU PM domain topology\n");
        return 0;
 
 put_node:
        of_node_put(node);
 remove_pd:
-       if (pd_count)
-               psci_pd_remove();
+       psci_pd_remove();
        pr_err("failed to create CPU PM domains ret=%d\n", ret);
+no_pd:
+       if (use_osi)
+               psci_set_osi_mode(false);
        return ret;
 }
 
index 7446384..d928b37 100644 (file)
@@ -66,7 +66,7 @@ static int psci_enter_domain_idle_state(struct cpuidle_device *dev,
                return -1;
 
        /* Do runtime PM to manage a hierarchical CPU toplogy. */
-       pm_runtime_put_sync_suspend(pd_dev);
+       RCU_NONIDLE(pm_runtime_put_sync_suspend(pd_dev));
 
        state = psci_get_domain_state();
        if (!state)
@@ -74,7 +74,7 @@ static int psci_enter_domain_idle_state(struct cpuidle_device *dev,
 
        ret = psci_cpu_suspend_enter(state) ? -1 : idx;
 
-       pm_runtime_get_sync(pd_dev);
+       RCU_NONIDLE(pm_runtime_get_sync(pd_dev));
 
        cpu_pm_exit();
 
index a12fb14..e895670 100644 (file)
@@ -172,7 +172,7 @@ static int tegra_cpuidle_coupled_barrier(struct cpuidle_device *dev)
 static int tegra_cpuidle_state_enter(struct cpuidle_device *dev,
                                     int index, unsigned int cpu)
 {
-       int ret;
+       int err;
 
        /*
         * CC6 state is the "CPU cluster power-off" state.  In order to
@@ -183,9 +183,9 @@ static int tegra_cpuidle_state_enter(struct cpuidle_device *dev,
         * CPU cores, GIC and L2 cache).
         */
        if (index == TEGRA_CC6) {
-               ret = tegra_cpuidle_coupled_barrier(dev);
-               if (ret)
-                       return ret;
+               err = tegra_cpuidle_coupled_barrier(dev);
+               if (err)
+                       return err;
        }
 
        local_fiq_disable();
@@ -194,15 +194,15 @@ static int tegra_cpuidle_state_enter(struct cpuidle_device *dev,
 
        switch (index) {
        case TEGRA_C7:
-               ret = tegra_cpuidle_c7_enter();
+               err = tegra_cpuidle_c7_enter();
                break;
 
        case TEGRA_CC6:
-               ret = tegra_cpuidle_cc6_enter(cpu);
+               err = tegra_cpuidle_cc6_enter(cpu);
                break;
 
        default:
-               ret = -EINVAL;
+               err = -EINVAL;
                break;
        }
 
@@ -210,7 +210,7 @@ static int tegra_cpuidle_state_enter(struct cpuidle_device *dev,
        tegra_pm_clear_cpu_in_lp2();
        local_fiq_enable();
 
-       return ret;
+       return err ?: index;
 }
 
 static int tegra_cpuidle_adjust_state_index(int index, unsigned int cpu)
@@ -236,21 +236,27 @@ static int tegra_cpuidle_enter(struct cpuidle_device *dev,
                               int index)
 {
        unsigned int cpu = cpu_logical_map(dev->cpu);
-       int err;
+       int ret;
 
        index = tegra_cpuidle_adjust_state_index(index, cpu);
        if (dev->states_usage[index].disable)
                return -1;
 
        if (index == TEGRA_C1)
-               err = arm_cpuidle_simple_enter(dev, drv, index);
+               ret = arm_cpuidle_simple_enter(dev, drv, index);
        else
-               err = tegra_cpuidle_state_enter(dev, index, cpu);
+               ret = tegra_cpuidle_state_enter(dev, index, cpu);
 
-       if (err && (err != -EINTR || index != TEGRA_CC6))
-               pr_err_once("failed to enter state %d err: %d\n", index, err);
+       if (ret < 0) {
+               if (ret != -EINTR || index != TEGRA_CC6)
+                       pr_err_once("failed to enter state %d err: %d\n",
+                                   index, ret);
+               index = -1;
+       } else {
+               index = ret;
+       }
 
-       return err ? -1 : index;
+       return index;
 }
 
 static int tegra114_enter_s2idle(struct cpuidle_device *dev,
index 6c7e562..83af15f 100644 (file)
@@ -142,11 +142,6 @@ static void enter_s2idle_proper(struct cpuidle_driver *drv,
 
        time_start = ns_to_ktime(local_clock());
 
-       /*
-        * trace_suspend_resume() called by tick_freeze() for the last CPU
-        * executing it contains RCU usage regarded as invalid in the idle
-        * context, so tell RCU about that.
-        */
        tick_freeze();
        /*
         * The state used here cannot be a "coupled" one, because the "coupled"
@@ -159,11 +154,6 @@ static void enter_s2idle_proper(struct cpuidle_driver *drv,
        target_state->enter_s2idle(dev, drv, index);
        if (WARN_ON_ONCE(!irqs_disabled()))
                local_irq_disable();
-       /*
-        * timekeeping_resume() that will be called by tick_unfreeze() for the
-        * first CPU executing it calls functions containing RCU read-side
-        * critical sections, so tell RCU about that.
-        */
        if (!(target_state->flags & CPUIDLE_FLAG_RCU_IDLE))
                rcu_idle_exit();
        tick_unfreeze();
@@ -307,6 +297,7 @@ int cpuidle_enter_state(struct cpuidle_device *dev, struct cpuidle_driver *drv,
                }
        } else {
                dev->last_residency_ns = 0;
+               dev->states_usage[index].rejected++;
        }
 
        return entered_state;
index 091d1ca..53ec958 100644 (file)
@@ -256,6 +256,7 @@ define_show_state_time_function(exit_latency)
 define_show_state_time_function(target_residency)
 define_show_state_function(power_usage)
 define_show_state_ull_function(usage)
+define_show_state_ull_function(rejected)
 define_show_state_str_function(name)
 define_show_state_str_function(desc)
 define_show_state_ull_function(above)
@@ -312,6 +313,7 @@ define_one_state_ro(latency, show_state_exit_latency);
 define_one_state_ro(residency, show_state_target_residency);
 define_one_state_ro(power, show_state_power_usage);
 define_one_state_ro(usage, show_state_usage);
+define_one_state_ro(rejected, show_state_rejected);
 define_one_state_ro(time, show_state_time);
 define_one_state_rw(disable, show_state_disable, store_state_disable);
 define_one_state_ro(above, show_state_above);
@@ -325,6 +327,7 @@ static struct attribute *cpuidle_state_default_attrs[] = {
        &attr_residency.attr,
        &attr_power.attr,
        &attr_usage.attr,
+       &attr_rejected.attr,
        &attr_time.attr,
        &attr_disable.attr,
        &attr_above.attr,
index 56efbeb..6765c03 100644 (file)
@@ -213,20 +213,21 @@ EXPORT_SYMBOL_GPL(devfreq_event_reset_event);
  * devfreq_event_get_edev_by_phandle() - Get the devfreq-event dev from
  *                                      devicetree.
  * @dev                : the pointer to the given device
+ * @phandle_name: name of property holding a phandle value
  * @index      : the index into list of devfreq-event device
  *
  * Note that this function return the pointer of devfreq-event device.
  */
 struct devfreq_event_dev *devfreq_event_get_edev_by_phandle(struct device *dev,
-                                                     int index)
+                                       const char *phandle_name, int index)
 {
        struct device_node *node;
        struct devfreq_event_dev *edev;
 
-       if (!dev->of_node)
+       if (!dev->of_node || !phandle_name)
                return ERR_PTR(-EINVAL);
 
-       node = of_parse_phandle(dev->of_node, "devfreq-events", index);
+       node = of_parse_phandle(dev->of_node, phandle_name, index);
        if (!node)
                return ERR_PTR(-ENODEV);
 
@@ -258,19 +259,20 @@ EXPORT_SYMBOL_GPL(devfreq_event_get_edev_by_phandle);
 /**
  * devfreq_event_get_edev_count() - Get the count of devfreq-event dev
  * @dev                : the pointer to the given device
+ * @phandle_name: name of property holding a phandle value
  *
  * Note that this function return the count of devfreq-event devices.
  */
-int devfreq_event_get_edev_count(struct device *dev)
+int devfreq_event_get_edev_count(struct device *dev, const char *phandle_name)
 {
        int count;
 
-       if (!dev->of_node) {
+       if (!dev->of_node || !phandle_name) {
                dev_err(dev, "device does not have a device node entry\n");
                return -EINVAL;
        }
 
-       count = of_property_count_elems_of_size(dev->of_node, "devfreq-events",
+       count = of_property_count_elems_of_size(dev->of_node, phandle_name,
                                                sizeof(u32));
        if (count < 0) {
                dev_err(dev,
index 561d91b..861c100 100644 (file)
@@ -983,48 +983,75 @@ struct devfreq *devm_devfreq_add_device(struct device *dev,
 EXPORT_SYMBOL(devm_devfreq_add_device);
 
 #ifdef CONFIG_OF
+/*
+ * devfreq_get_devfreq_by_node - Get the devfreq device from devicetree
+ * @node - pointer to device_node
+ *
+ * return the instance of devfreq device
+ */
+struct devfreq *devfreq_get_devfreq_by_node(struct device_node *node)
+{
+       struct devfreq *devfreq;
+
+       if (!node)
+               return ERR_PTR(-EINVAL);
+
+       mutex_lock(&devfreq_list_lock);
+       list_for_each_entry(devfreq, &devfreq_list, node) {
+               if (devfreq->dev.parent
+                       && devfreq->dev.parent->of_node == node) {
+                       mutex_unlock(&devfreq_list_lock);
+                       return devfreq;
+               }
+       }
+       mutex_unlock(&devfreq_list_lock);
+
+       return ERR_PTR(-ENODEV);
+}
+
 /*
  * devfreq_get_devfreq_by_phandle - Get the devfreq device from devicetree
  * @dev - instance to the given device
+ * @phandle_name - name of property holding a phandle value
  * @index - index into list of devfreq
  *
  * return the instance of devfreq device
  */
-struct devfreq *devfreq_get_devfreq_by_phandle(struct device *dev, int index)
+struct devfreq *devfreq_get_devfreq_by_phandle(struct device *dev,
+                                       const char *phandle_name, int index)
 {
        struct device_node *node;
        struct devfreq *devfreq;
 
-       if (!dev)
+       if (!dev || !phandle_name)
                return ERR_PTR(-EINVAL);
 
        if (!dev->of_node)
                return ERR_PTR(-EINVAL);
 
-       node = of_parse_phandle(dev->of_node, "devfreq", index);
+       node = of_parse_phandle(dev->of_node, phandle_name, index);
        if (!node)
                return ERR_PTR(-ENODEV);
 
-       mutex_lock(&devfreq_list_lock);
-       list_for_each_entry(devfreq, &devfreq_list, node) {
-               if (devfreq->dev.parent
-                       && devfreq->dev.parent->of_node == node) {
-                       mutex_unlock(&devfreq_list_lock);
-                       of_node_put(node);
-                       return devfreq;
-               }
-       }
-       mutex_unlock(&devfreq_list_lock);
+       devfreq = devfreq_get_devfreq_by_node(node);
        of_node_put(node);
 
-       return ERR_PTR(-EPROBE_DEFER);
+       return devfreq;
 }
+
 #else
-struct devfreq *devfreq_get_devfreq_by_phandle(struct device *dev, int index)
+struct devfreq *devfreq_get_devfreq_by_node(struct device_node *node)
+{
+       return ERR_PTR(-ENODEV);
+}
+
+struct devfreq *devfreq_get_devfreq_by_phandle(struct device *dev,
+                                       const char *phandle_name, int index)
 {
        return ERR_PTR(-ENODEV);
 }
 #endif /* CONFIG_OF */
+EXPORT_SYMBOL_GPL(devfreq_get_devfreq_by_node);
 EXPORT_SYMBOL_GPL(devfreq_get_devfreq_by_phandle);
 
 /**
@@ -1766,20 +1793,23 @@ static int devfreq_summary_show(struct seq_file *s, void *data)
        struct devfreq *p_devfreq = NULL;
        unsigned long cur_freq, min_freq, max_freq;
        unsigned int polling_ms;
+       unsigned int timer;
 
-       seq_printf(s, "%-30s %-30s %-15s %10s %12s %12s %12s\n",
+       seq_printf(s, "%-30s %-30s %-15s %-10s %10s %12s %12s %12s\n",
                        "dev",
                        "parent_dev",
                        "governor",
+                       "timer",
                        "polling_ms",
                        "cur_freq_Hz",
                        "min_freq_Hz",
                        "max_freq_Hz");
-       seq_printf(s, "%30s %30s %15s %10s %12s %12s %12s\n",
+       seq_printf(s, "%30s %30s %15s %10s %10s %12s %12s %12s\n",
                        "------------------------------",
                        "------------------------------",
                        "---------------",
                        "----------",
+                       "----------",
                        "------------",
                        "------------",
                        "------------");
@@ -1803,13 +1833,15 @@ static int devfreq_summary_show(struct seq_file *s, void *data)
                cur_freq = devfreq->previous_freq;
                get_freq_range(devfreq, &min_freq, &max_freq);
                polling_ms = devfreq->profile->polling_ms;
+               timer = devfreq->profile->timer;
                mutex_unlock(&devfreq->lock);
 
                seq_printf(s,
-                       "%-30s %-30s %-15s %10d %12ld %12ld %12ld\n",
+                       "%-30s %-30s %-15s %-10s %10d %12ld %12ld %12ld\n",
                        dev_name(&devfreq->dev),
                        p_devfreq ? dev_name(&p_devfreq->dev) : "null",
                        devfreq->governor_name,
+                       polling_ms ? timer_name[timer] : "null",
                        polling_ms,
                        cur_freq,
                        min_freq,
index 8fa8eb5..1e684a4 100644 (file)
@@ -193,7 +193,7 @@ static int exynos_bus_parent_parse_of(struct device_node *np,
         * Get the devfreq-event devices to get the current utilization of
         * buses. This raw data will be used in devfreq ondemand governor.
         */
-       count = devfreq_event_get_edev_count(dev);
+       count = devfreq_event_get_edev_count(dev, "devfreq-events");
        if (count < 0) {
                dev_err(dev, "failed to get the count of devfreq-event dev\n");
                ret = count;
@@ -209,7 +209,8 @@ static int exynos_bus_parent_parse_of(struct device_node *np,
        }
 
        for (i = 0; i < count; i++) {
-               bus->edev[i] = devfreq_event_get_edev_by_phandle(dev, i);
+               bus->edev[i] = devfreq_event_get_edev_by_phandle(dev,
+                                                       "devfreq-events", i);
                if (IS_ERR(bus->edev[i])) {
                        ret = -EPROBE_DEFER;
                        goto err_regulator;
@@ -360,7 +361,7 @@ static int exynos_bus_profile_init_passive(struct exynos_bus *bus,
        profile->exit = exynos_bus_passive_exit;
 
        /* Get the instance of parent devfreq device */
-       parent_devfreq = devfreq_get_devfreq_by_phandle(dev, 0);
+       parent_devfreq = devfreq_get_devfreq_by_phandle(dev, "devfreq", 0);
        if (IS_ERR(parent_devfreq))
                return -EPROBE_DEFER;
 
index 027769e..2e91216 100644 (file)
@@ -341,7 +341,7 @@ static int rk3399_dmcfreq_probe(struct platform_device *pdev)
                return PTR_ERR(data->dmc_clk);
        }
 
-       data->edev = devfreq_event_get_edev_by_phandle(dev, 0);
+       data->edev = devfreq_event_get_edev_by_phandle(dev, "devfreq-events", 0);
        if (IS_ERR(data->edev))
                return -EPROBE_DEFER;
 
index e94a278..f5e74c2 100644 (file)
@@ -822,8 +822,6 @@ static int tegra_devfreq_probe(struct platform_device *pdev)
                return err;
        }
 
-       reset_control_assert(tegra->reset);
-
        err = clk_prepare_enable(tegra->clock);
        if (err) {
                dev_err(&pdev->dev,
@@ -831,12 +829,17 @@ static int tegra_devfreq_probe(struct platform_device *pdev)
                return err;
        }
 
-       reset_control_deassert(tegra->reset);
+       err = reset_control_reset(tegra->reset);
+       if (err) {
+               dev_err(&pdev->dev, "Failed to reset hardware: %d\n", err);
+               goto disable_clk;
+       }
 
        rate = clk_round_rate(tegra->emc_clock, ULONG_MAX);
        if (rate < 0) {
                dev_err(&pdev->dev, "Failed to round clock rate: %ld\n", rate);
-               return rate;
+               err = rate;
+               goto disable_clk;
        }
 
        tegra->max_freq = rate / KHZ;
@@ -897,6 +900,7 @@ remove_opps:
        dev_pm_opp_remove_all_dynamic(&pdev->dev);
 
        reset_control_reset(tegra->reset);
+disable_clk:
        clk_disable_unprepare(tegra->clock);
 
        return err;
index 58564d8..844967f 100644 (file)
@@ -59,6 +59,8 @@ static void dma_buf_release(struct dentry *dentry)
        struct dma_buf *dmabuf;
 
        dmabuf = dentry->d_fsdata;
+       if (unlikely(!dmabuf))
+               return;
 
        BUG_ON(dmabuf->vmapping_counter);
 
index 45d4d92..a819611 100644 (file)
@@ -129,6 +129,7 @@ struct dmatest_params {
  * @nr_channels:       number of channels under test
  * @lock:              access protection to the fields of this structure
  * @did_init:          module has been initialized completely
+ * @last_error:                test has faced configuration issues
  */
 static struct dmatest_info {
        /* Test parameters */
@@ -137,6 +138,7 @@ static struct dmatest_info {
        /* Internal state */
        struct list_head        channels;
        unsigned int            nr_channels;
+       int                     last_error;
        struct mutex            lock;
        bool                    did_init;
 } test_info = {
@@ -1184,10 +1186,22 @@ static int dmatest_run_set(const char *val, const struct kernel_param *kp)
                return ret;
        } else if (dmatest_run) {
                if (!is_threaded_test_pending(info)) {
-                       pr_info("No channels configured, continue with any\n");
-                       if (!is_threaded_test_run(info))
-                               stop_threaded_test(info);
-                       add_threaded_test(info);
+                       /*
+                        * We have nothing to run. This can be due to:
+                        */
+                       ret = info->last_error;
+                       if (ret) {
+                               /* 1) Misconfiguration */
+                               pr_err("Channel misconfigured, can't continue\n");
+                               mutex_unlock(&info->lock);
+                               return ret;
+                       } else {
+                               /* 2) We rely on defaults */
+                               pr_info("No channels configured, continue with any\n");
+                               if (!is_threaded_test_run(info))
+                                       stop_threaded_test(info);
+                               add_threaded_test(info);
+                       }
                }
                start_threaded_tests(info);
        } else {
@@ -1204,7 +1218,7 @@ static int dmatest_chan_set(const char *val, const struct kernel_param *kp)
        struct dmatest_info *info = &test_info;
        struct dmatest_chan *dtc;
        char chan_reset_val[20];
-       int ret = 0;
+       int ret;
 
        mutex_lock(&info->lock);
        ret = param_set_copystring(val, kp);
@@ -1259,12 +1273,14 @@ static int dmatest_chan_set(const char *val, const struct kernel_param *kp)
                goto add_chan_err;
        }
 
+       info->last_error = ret;
        mutex_unlock(&info->lock);
 
        return ret;
 
 add_chan_err:
        param_set_copystring(chan_reset_val, kp);
+       info->last_error = ret;
        mutex_unlock(&info->lock);
 
        return ret;
index 92013ec..00af99b 100644 (file)
@@ -151,12 +151,15 @@ static u32 psci_get_version(void)
        return invoke_psci_fn(PSCI_0_2_FN_PSCI_VERSION, 0, 0, 0);
 }
 
-int psci_set_osi_mode(void)
+int psci_set_osi_mode(bool enable)
 {
+       unsigned long suspend_mode;
        int err;
 
-       err = invoke_psci_fn(PSCI_1_0_FN_SET_SUSPEND_MODE,
-                            PSCI_1_0_SUSPEND_MODE_OSI, 0, 0);
+       suspend_mode = enable ? PSCI_1_0_SUSPEND_MODE_OSI :
+                       PSCI_1_0_SUSPEND_MODE_PC;
+
+       err = invoke_psci_fn(PSCI_1_0_FN_SET_SUSPEND_MODE, suspend_mode, 0, 0);
        return psci_to_linux_errno(err);
 }
 
@@ -546,8 +549,7 @@ static int __init psci_1_0_init(struct device_node *np)
                pr_info("OSI mode supported.\n");
 
                /* Default to PC mode. */
-               invoke_psci_fn(PSCI_1_0_FN_SET_SUSPEND_MODE,
-                              PSCI_1_0_SUSPEND_MODE_PC, 0, 0);
+               psci_set_osi_mode(false);
        }
 
        return 0;
index 4e44ba4..2a21354 100644 (file)
@@ -92,7 +92,7 @@ static int amd_fch_gpio_get_direction(struct gpio_chip *gc, unsigned int gpio)
        ret = (readl_relaxed(ptr) & AMD_FCH_GPIO_FLAG_DIRECTION);
        spin_unlock_irqrestore(&priv->lock, flags);
 
-       return ret ? GPIO_LINE_DIRECTION_IN : GPIO_LINE_DIRECTION_OUT;
+       return ret ? GPIO_LINE_DIRECTION_OUT : GPIO_LINE_DIRECTION_IN;
 }
 
 static void amd_fch_gpio_set(struct gpio_chip *gc,
index 3aa4593..64e54f8 100644 (file)
 #include <linux/spinlock.h>
 #include <linux/string.h>
 
-#define MAX_NR_SGPIO                   80
+/*
+ * MAX_NR_HW_GPIO represents the number of actual hardware-supported GPIOs (ie,
+ * slots within the clocked serial GPIO data). Since each HW GPIO is both an
+ * input and an output, we provide MAX_NR_HW_GPIO * 2 lines on our gpiochip
+ * device.
+ *
+ * We use SGPIO_OUTPUT_OFFSET to define the split between the inputs and
+ * outputs; the inputs start at line 0, the outputs start at OUTPUT_OFFSET.
+ */
+#define MAX_NR_HW_SGPIO                        80
+#define SGPIO_OUTPUT_OFFSET            MAX_NR_HW_SGPIO
 
 #define ASPEED_SGPIO_CTRL              0x54
 
@@ -30,8 +40,8 @@ struct aspeed_sgpio {
        struct clk *pclk;
        spinlock_t lock;
        void __iomem *base;
-       uint32_t dir_in[3];
        int irq;
+       int n_sgpio;
 };
 
 struct aspeed_sgpio_bank {
@@ -111,31 +121,69 @@ static void __iomem *bank_reg(struct aspeed_sgpio *gpio,
        }
 }
 
-#define GPIO_BANK(x)    ((x) >> 5)
-#define GPIO_OFFSET(x)  ((x) & 0x1f)
+#define GPIO_BANK(x)    ((x % SGPIO_OUTPUT_OFFSET) >> 5)
+#define GPIO_OFFSET(x)  ((x % SGPIO_OUTPUT_OFFSET) & 0x1f)
 #define GPIO_BIT(x)     BIT(GPIO_OFFSET(x))
 
 static const struct aspeed_sgpio_bank *to_bank(unsigned int offset)
 {
-       unsigned int bank = GPIO_BANK(offset);
+       unsigned int bank;
+
+       bank = GPIO_BANK(offset);
 
        WARN_ON(bank >= ARRAY_SIZE(aspeed_sgpio_banks));
        return &aspeed_sgpio_banks[bank];
 }
 
+static int aspeed_sgpio_init_valid_mask(struct gpio_chip *gc,
+               unsigned long *valid_mask, unsigned int ngpios)
+{
+       struct aspeed_sgpio *sgpio = gpiochip_get_data(gc);
+       int n = sgpio->n_sgpio;
+       int c = SGPIO_OUTPUT_OFFSET - n;
+
+       WARN_ON(ngpios < MAX_NR_HW_SGPIO * 2);
+
+       /* input GPIOs in the lower range */
+       bitmap_set(valid_mask, 0, n);
+       bitmap_clear(valid_mask, n, c);
+
+       /* output GPIOS above SGPIO_OUTPUT_OFFSET */
+       bitmap_set(valid_mask, SGPIO_OUTPUT_OFFSET, n);
+       bitmap_clear(valid_mask, SGPIO_OUTPUT_OFFSET + n, c);
+
+       return 0;
+}
+
+static void aspeed_sgpio_irq_init_valid_mask(struct gpio_chip *gc,
+               unsigned long *valid_mask, unsigned int ngpios)
+{
+       struct aspeed_sgpio *sgpio = gpiochip_get_data(gc);
+       int n = sgpio->n_sgpio;
+
+       WARN_ON(ngpios < MAX_NR_HW_SGPIO * 2);
+
+       /* input GPIOs in the lower range */
+       bitmap_set(valid_mask, 0, n);
+       bitmap_clear(valid_mask, n, ngpios - n);
+}
+
+static bool aspeed_sgpio_is_input(unsigned int offset)
+{
+       return offset < SGPIO_OUTPUT_OFFSET;
+}
+
 static int aspeed_sgpio_get(struct gpio_chip *gc, unsigned int offset)
 {
        struct aspeed_sgpio *gpio = gpiochip_get_data(gc);
        const struct aspeed_sgpio_bank *bank = to_bank(offset);
        unsigned long flags;
        enum aspeed_sgpio_reg reg;
-       bool is_input;
        int rc = 0;
 
        spin_lock_irqsave(&gpio->lock, flags);
 
-       is_input = gpio->dir_in[GPIO_BANK(offset)] & GPIO_BIT(offset);
-       reg = is_input ? reg_val : reg_rdata;
+       reg = aspeed_sgpio_is_input(offset) ? reg_val : reg_rdata;
        rc = !!(ioread32(bank_reg(gpio, bank, reg)) & GPIO_BIT(offset));
 
        spin_unlock_irqrestore(&gpio->lock, flags);
@@ -143,22 +191,31 @@ static int aspeed_sgpio_get(struct gpio_chip *gc, unsigned int offset)
        return rc;
 }
 
-static void sgpio_set_value(struct gpio_chip *gc, unsigned int offset, int val)
+static int sgpio_set_value(struct gpio_chip *gc, unsigned int offset, int val)
 {
        struct aspeed_sgpio *gpio = gpiochip_get_data(gc);
        const struct aspeed_sgpio_bank *bank = to_bank(offset);
-       void __iomem *addr;
+       void __iomem *addr_r, *addr_w;
        u32 reg = 0;
 
-       addr = bank_reg(gpio, bank, reg_val);
-       reg = ioread32(addr);
+       if (aspeed_sgpio_is_input(offset))
+               return -EINVAL;
+
+       /* Since this is an output, read the cached value from rdata, then
+        * update val. */
+       addr_r = bank_reg(gpio, bank, reg_rdata);
+       addr_w = bank_reg(gpio, bank, reg_val);
+
+       reg = ioread32(addr_r);
 
        if (val)
                reg |= GPIO_BIT(offset);
        else
                reg &= ~GPIO_BIT(offset);
 
-       iowrite32(reg, addr);
+       iowrite32(reg, addr_w);
+
+       return 0;
 }
 
 static void aspeed_sgpio_set(struct gpio_chip *gc, unsigned int offset, int val)
@@ -175,43 +232,28 @@ static void aspeed_sgpio_set(struct gpio_chip *gc, unsigned int offset, int val)
 
 static int aspeed_sgpio_dir_in(struct gpio_chip *gc, unsigned int offset)
 {
-       struct aspeed_sgpio *gpio = gpiochip_get_data(gc);
-       unsigned long flags;
-
-       spin_lock_irqsave(&gpio->lock, flags);
-       gpio->dir_in[GPIO_BANK(offset)] |= GPIO_BIT(offset);
-       spin_unlock_irqrestore(&gpio->lock, flags);
-
-       return 0;
+       return aspeed_sgpio_is_input(offset) ? 0 : -EINVAL;
 }
 
 static int aspeed_sgpio_dir_out(struct gpio_chip *gc, unsigned int offset, int val)
 {
        struct aspeed_sgpio *gpio = gpiochip_get_data(gc);
        unsigned long flags;
+       int rc;
 
-       spin_lock_irqsave(&gpio->lock, flags);
-
-       gpio->dir_in[GPIO_BANK(offset)] &= ~GPIO_BIT(offset);
-       sgpio_set_value(gc, offset, val);
+       /* No special action is required for setting the direction; we'll
+        * error-out in sgpio_set_value if this isn't an output GPIO */
 
+       spin_lock_irqsave(&gpio->lock, flags);
+       rc = sgpio_set_value(gc, offset, val);
        spin_unlock_irqrestore(&gpio->lock, flags);
 
-       return 0;
+       return rc;
 }
 
 static int aspeed_sgpio_get_direction(struct gpio_chip *gc, unsigned int offset)
 {
-       int dir_status;
-       struct aspeed_sgpio *gpio = gpiochip_get_data(gc);
-       unsigned long flags;
-
-       spin_lock_irqsave(&gpio->lock, flags);
-       dir_status = gpio->dir_in[GPIO_BANK(offset)] & GPIO_BIT(offset);
-       spin_unlock_irqrestore(&gpio->lock, flags);
-
-       return dir_status;
-
+       return !!aspeed_sgpio_is_input(offset);
 }
 
 static void irqd_to_aspeed_sgpio_data(struct irq_data *d,
@@ -402,6 +444,7 @@ static int aspeed_sgpio_setup_irqs(struct aspeed_sgpio *gpio,
 
        irq = &gpio->chip.irq;
        irq->chip = &aspeed_sgpio_irqchip;
+       irq->init_valid_mask = aspeed_sgpio_irq_init_valid_mask;
        irq->handler = handle_bad_irq;
        irq->default_type = IRQ_TYPE_NONE;
        irq->parent_handler = aspeed_sgpio_irq_handler;
@@ -409,17 +452,15 @@ static int aspeed_sgpio_setup_irqs(struct aspeed_sgpio *gpio,
        irq->parents = &gpio->irq;
        irq->num_parents = 1;
 
-       /* set IRQ settings and Enable Interrupt */
+       /* Apply default IRQ settings */
        for (i = 0; i < ARRAY_SIZE(aspeed_sgpio_banks); i++) {
                bank = &aspeed_sgpio_banks[i];
                /* set falling or level-low irq */
                iowrite32(0x00000000, bank_reg(gpio, bank, reg_irq_type0));
                /* trigger type is edge */
                iowrite32(0x00000000, bank_reg(gpio, bank, reg_irq_type1));
-               /* dual edge trigger mode. */
-               iowrite32(0xffffffff, bank_reg(gpio, bank, reg_irq_type2));
-               /* enable irq */
-               iowrite32(0xffffffff, bank_reg(gpio, bank, reg_irq_enable));
+               /* single edge trigger */
+               iowrite32(0x00000000, bank_reg(gpio, bank, reg_irq_type2));
        }
 
        return 0;
@@ -452,11 +493,12 @@ static int __init aspeed_sgpio_probe(struct platform_device *pdev)
        if (rc < 0) {
                dev_err(&pdev->dev, "Could not read ngpios property\n");
                return -EINVAL;
-       } else if (nr_gpios > MAX_NR_SGPIO) {
+       } else if (nr_gpios > MAX_NR_HW_SGPIO) {
                dev_err(&pdev->dev, "Number of GPIOs exceeds the maximum of %d: %d\n",
-                       MAX_NR_SGPIO, nr_gpios);
+                       MAX_NR_HW_SGPIO, nr_gpios);
                return -EINVAL;
        }
+       gpio->n_sgpio = nr_gpios;
 
        rc = of_property_read_u32(pdev->dev.of_node, "bus-frequency", &sgpio_freq);
        if (rc < 0) {
@@ -497,7 +539,8 @@ static int __init aspeed_sgpio_probe(struct platform_device *pdev)
        spin_lock_init(&gpio->lock);
 
        gpio->chip.parent = &pdev->dev;
-       gpio->chip.ngpio = nr_gpios;
+       gpio->chip.ngpio = MAX_NR_HW_SGPIO * 2;
+       gpio->chip.init_valid_mask = aspeed_sgpio_init_valid_mask;
        gpio->chip.direction_input = aspeed_sgpio_dir_in;
        gpio->chip.direction_output = aspeed_sgpio_dir_out;
        gpio->chip.get_direction = aspeed_sgpio_get_direction;
@@ -509,9 +552,6 @@ static int __init aspeed_sgpio_probe(struct platform_device *pdev)
        gpio->chip.label = dev_name(&pdev->dev);
        gpio->chip.base = -1;
 
-       /* set all SGPIO pins as input (1). */
-       memset(gpio->dir_in, 0xff, sizeof(gpio->dir_in));
-
        aspeed_sgpio_setup_irqs(gpio, pdev);
 
        rc = devm_gpiochip_add_data(&pdev->dev, &gpio->chip, gpio);
index bf08b45..e44d5de 100644 (file)
@@ -1114,8 +1114,8 @@ static const struct aspeed_gpio_config ast2500_config =
 
 static const struct aspeed_bank_props ast2600_bank_props[] = {
        /*     input      output   */
-       {5, 0xffffffff,  0x0000ffff}, /* U/V/W/X */
-       {6, 0xffff0000,  0x0fff0000}, /* Y/Z */
+       {5, 0xffffffff,  0xffffff00}, /* U/V/W/X */
+       {6, 0x0000ffff,  0x0000ffff}, /* Y/Z */
        { },
 };
 
index bc34518..1652897 100644 (file)
@@ -552,6 +552,7 @@ static int __init gpio_mockup_init(void)
        err = platform_driver_register(&gpio_mockup_driver);
        if (err) {
                gpio_mockup_err("error registering platform driver\n");
+               debugfs_remove_recursive(gpio_mockup_dbg_dir);
                return err;
        }
 
@@ -582,6 +583,7 @@ static int __init gpio_mockup_init(void)
                        gpio_mockup_err("error registering device");
                        platform_driver_unregister(&gpio_mockup_driver);
                        gpio_mockup_unregister_pdevs();
+                       debugfs_remove_recursive(gpio_mockup_dbg_dir);
                        return PTR_ERR(pdev);
                }
 
index 7fbe0c9..0ea640f 100644 (file)
@@ -1516,7 +1516,7 @@ static int __maybe_unused omap_gpio_runtime_resume(struct device *dev)
        return 0;
 }
 
-static int omap_gpio_suspend(struct device *dev)
+static int __maybe_unused omap_gpio_suspend(struct device *dev)
 {
        struct gpio_bank *bank = dev_get_drvdata(dev);
 
@@ -1528,7 +1528,7 @@ static int omap_gpio_suspend(struct device *dev)
        return omap_gpio_runtime_suspend(dev);
 }
 
-static int omap_gpio_resume(struct device *dev)
+static int __maybe_unused omap_gpio_resume(struct device *dev)
 {
        struct gpio_bank *bank = dev_get_drvdata(dev);
 
index bd2e96c..fb61f2f 100644 (file)
@@ -818,6 +818,8 @@ static irqreturn_t pca953x_irq_handler(int irq, void *devid)
        int level;
        bool ret;
 
+       bitmap_zero(pending, MAX_LINE);
+
        mutex_lock(&chip->i2c_lock);
        ret = pca953x_irq_pending(chip, pending);
        mutex_unlock(&chip->i2c_lock);
@@ -940,6 +942,7 @@ out:
 static int device_pca957x_init(struct pca953x_chip *chip, u32 invert)
 {
        DECLARE_BITMAP(val, MAX_LINE);
+       unsigned int i;
        int ret;
 
        ret = device_pca95xx_init(chip, invert);
@@ -947,7 +950,9 @@ static int device_pca957x_init(struct pca953x_chip *chip, u32 invert)
                goto out;
 
        /* To enable register 6, 7 to control pull up and pull down */
-       memset(val, 0x02, NBANK(chip));
+       for (i = 0; i < NBANK(chip); i++)
+               bitmap_set_value8(val, 0x02, i * BANK_SZ);
+
        ret = pca953x_write_regs(chip, PCA957X_BKEN, val);
        if (ret)
                goto out;
index 26e1fe0..f8c5e9f 100644 (file)
@@ -245,6 +245,7 @@ static int gpio_siox_probe(struct siox_device *sdevice)
        girq->chip = &ddata->ichip;
        girq->default_type = IRQ_TYPE_NONE;
        girq->handler = handle_level_irq;
+       girq->threaded = true;
 
        ret = devm_gpiochip_add_data(dev, &ddata->gchip, NULL);
        if (ret)
index d7314d3..36ea8a3 100644 (file)
@@ -149,17 +149,20 @@ static int sprd_gpio_irq_set_type(struct irq_data *data,
                sprd_gpio_update(chip, offset, SPRD_GPIO_IS, 0);
                sprd_gpio_update(chip, offset, SPRD_GPIO_IBE, 0);
                sprd_gpio_update(chip, offset, SPRD_GPIO_IEV, 1);
+               sprd_gpio_update(chip, offset, SPRD_GPIO_IC, 1);
                irq_set_handler_locked(data, handle_edge_irq);
                break;
        case IRQ_TYPE_EDGE_FALLING:
                sprd_gpio_update(chip, offset, SPRD_GPIO_IS, 0);
                sprd_gpio_update(chip, offset, SPRD_GPIO_IBE, 0);
                sprd_gpio_update(chip, offset, SPRD_GPIO_IEV, 0);
+               sprd_gpio_update(chip, offset, SPRD_GPIO_IC, 1);
                irq_set_handler_locked(data, handle_edge_irq);
                break;
        case IRQ_TYPE_EDGE_BOTH:
                sprd_gpio_update(chip, offset, SPRD_GPIO_IS, 0);
                sprd_gpio_update(chip, offset, SPRD_GPIO_IBE, 1);
+               sprd_gpio_update(chip, offset, SPRD_GPIO_IC, 1);
                irq_set_handler_locked(data, handle_edge_irq);
                break;
        case IRQ_TYPE_LEVEL_HIGH:
index 58b0da9..ea3f68a 100644 (file)
@@ -212,7 +212,7 @@ static void tc3589x_gpio_irq_sync_unlock(struct irq_data *d)
                                continue;
 
                        tc3589x_gpio->oldregs[i][j] = new;
-                       tc3589x_reg_write(tc3589x, regmap[i] + j * 8, new);
+                       tc3589x_reg_write(tc3589x, regmap[i] + j, new);
                }
        }
 
index e6c9b78..76c36b0 100644 (file)
@@ -423,6 +423,21 @@ static __poll_t lineevent_poll(struct file *file,
        return events;
 }
 
+static ssize_t lineevent_get_size(void)
+{
+#ifdef __x86_64__
+       /* i386 has no padding after 'id' */
+       if (in_ia32_syscall()) {
+               struct compat_gpioeevent_data {
+                       compat_u64      timestamp;
+                       u32             id;
+               };
+
+               return sizeof(struct compat_gpioeevent_data);
+       }
+#endif
+       return sizeof(struct gpioevent_data);
+}
 
 static ssize_t lineevent_read(struct file *file,
                              char __user *buf,
@@ -432,9 +447,20 @@ static ssize_t lineevent_read(struct file *file,
        struct lineevent_state *le = file->private_data;
        struct gpioevent_data ge;
        ssize_t bytes_read = 0;
+       ssize_t ge_size;
        int ret;
 
-       if (count < sizeof(ge))
+       /*
+        * When compatible system call is being used the struct gpioevent_data,
+        * in case of at least ia32, has different size due to the alignment
+        * differences. Because we have first member 64 bits followed by one of
+        * 32 bits there is no gap between them. The only difference is the
+        * padding at the end of the data structure. Hence, we calculate the
+        * actual sizeof() and pass this as an argument to copy_to_user() to
+        * drop unneeded bytes from the output.
+        */
+       ge_size = lineevent_get_size();
+       if (count < ge_size)
                return -EINVAL;
 
        do {
@@ -470,10 +496,10 @@ static ssize_t lineevent_read(struct file *file,
                        break;
                }
 
-               if (copy_to_user(buf + bytes_read, &ge, sizeof(ge)))
+               if (copy_to_user(buf + bytes_read, &ge, ge_size))
                        return -EFAULT;
-               bytes_read += sizeof(ge);
-       } while (count >= bytes_read + sizeof(ge));
+               bytes_read += ge_size;
+       } while (count >= bytes_read + ge_size);
 
        return bytes_read;
 }
index eb7cfe8..d0b8d0d 100644 (file)
@@ -80,8 +80,6 @@ MODULE_FIRMWARE("amdgpu/renoir_gpu_info.bin");
 MODULE_FIRMWARE("amdgpu/navi10_gpu_info.bin");
 MODULE_FIRMWARE("amdgpu/navi14_gpu_info.bin");
 MODULE_FIRMWARE("amdgpu/navi12_gpu_info.bin");
-MODULE_FIRMWARE("amdgpu/sienna_cichlid_gpu_info.bin");
-MODULE_FIRMWARE("amdgpu/navy_flounder_gpu_info.bin");
 
 #define AMDGPU_RESUME_MS               2000
 
@@ -1600,6 +1598,8 @@ static int amdgpu_device_parse_gpu_info_fw(struct amdgpu_device *adev)
        case CHIP_CARRIZO:
        case CHIP_STONEY:
        case CHIP_VEGA20:
+       case CHIP_SIENNA_CICHLID:
+       case CHIP_NAVY_FLOUNDER:
        default:
                return 0;
        case CHIP_VEGA10:
@@ -1631,12 +1631,6 @@ static int amdgpu_device_parse_gpu_info_fw(struct amdgpu_device *adev)
        case CHIP_NAVI12:
                chip_name = "navi12";
                break;
-       case CHIP_SIENNA_CICHLID:
-               chip_name = "sienna_cichlid";
-               break;
-       case CHIP_NAVY_FLOUNDER:
-               chip_name = "navy_flounder";
-               break;
        }
 
        snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_gpu_info.bin", chip_name);
index d761729..44c1f6e 100644 (file)
@@ -297,7 +297,7 @@ int amdgpu_display_crtc_set_config(struct drm_mode_set *set,
           take the current one */
        if (active && !adev->have_disp_power_ref) {
                adev->have_disp_power_ref = true;
-               goto out;
+               return ret;
        }
        /* if we have no active crtcs, then drop the power ref
           we got before */
index 26127c7..321032d 100644 (file)
@@ -1044,8 +1044,16 @@ static const struct pci_device_id pciidlist[] = {
        {0x1002, 0x1636, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RENOIR|AMD_IS_APU},
 
        /* Navi12 */
-       {0x1002, 0x7360, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_NAVI12|AMD_EXP_HW_SUPPORT},
-       {0x1002, 0x7362, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_NAVI12|AMD_EXP_HW_SUPPORT},
+       {0x1002, 0x7360, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_NAVI12},
+       {0x1002, 0x7362, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_NAVI12},
+
+       /* Sienna_Cichlid */
+       {0x1002, 0x73A0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SIENNA_CICHLID},
+       {0x1002, 0x73A2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SIENNA_CICHLID},
+       {0x1002, 0x73A3, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SIENNA_CICHLID},
+       {0x1002, 0x73AB, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SIENNA_CICHLID},
+       {0x1002, 0x73AE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SIENNA_CICHLID},
+       {0x1002, 0x73BF, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_SIENNA_CICHLID},
 
        {0, 0, 0}
 };
index e11c5d6..978bae7 100644 (file)
@@ -1076,6 +1076,7 @@ static int amdgpu_ttm_tt_pin_userptr(struct ttm_tt *ttm)
 
 release_sg:
        kfree(ttm->sg);
+       ttm->sg = NULL;
        return r;
 }
 
index 037a187..f73ce97 100644 (file)
@@ -3595,6 +3595,9 @@ static void gfx_v10_0_check_gfxoff_flag(struct amdgpu_device *adev)
                if (!gfx_v10_0_navi10_gfxoff_should_enable(adev))
                        adev->pm.pp_feature &= ~PP_GFXOFF_MASK;
                break;
+       case CHIP_NAVY_FLOUNDER:
+               adev->pm.pp_feature &= ~PP_GFXOFF_MASK;
+               break;
        default:
                break;
        }
index 63e5547..3a805ea 100644 (file)
@@ -746,18 +746,18 @@ static void vcn_v3_0_disable_clock_gating(struct amdgpu_device *adev, int inst)
                | UVD_SUVD_CGC_GATE__IME_HEVC_MASK
                | UVD_SUVD_CGC_GATE__EFC_MASK
                | UVD_SUVD_CGC_GATE__SAOE_MASK
-               | 0x08000000
+               | UVD_SUVD_CGC_GATE__SRE_AV1_MASK
                | UVD_SUVD_CGC_GATE__FBC_PCLK_MASK
                | UVD_SUVD_CGC_GATE__FBC_CCLK_MASK
-               | 0x40000000
+               | UVD_SUVD_CGC_GATE__SCM_AV1_MASK
                | UVD_SUVD_CGC_GATE__SMPA_MASK);
        WREG32_SOC15(VCN, inst, mmUVD_SUVD_CGC_GATE, data);
 
        data = RREG32_SOC15(VCN, inst, mmUVD_SUVD_CGC_GATE2);
        data |= (UVD_SUVD_CGC_GATE2__MPBE0_MASK
                | UVD_SUVD_CGC_GATE2__MPBE1_MASK
-               | 0x00000004
-               | 0x00000008
+               | UVD_SUVD_CGC_GATE2__SIT_AV1_MASK
+               | UVD_SUVD_CGC_GATE2__SDB_AV1_MASK
                | UVD_SUVD_CGC_GATE2__MPC1_MASK);
        WREG32_SOC15(VCN, inst, mmUVD_SUVD_CGC_GATE2, data);
 
@@ -776,8 +776,8 @@ static void vcn_v3_0_disable_clock_gating(struct amdgpu_device *adev, int inst)
                | UVD_SUVD_CGC_CTRL__SMPA_MODE_MASK
                | UVD_SUVD_CGC_CTRL__MPBE0_MODE_MASK
                | UVD_SUVD_CGC_CTRL__MPBE1_MODE_MASK
-               | 0x00008000
-               | 0x00010000
+               | UVD_SUVD_CGC_CTRL__SIT_AV1_MODE_MASK
+               | UVD_SUVD_CGC_CTRL__SDB_AV1_MODE_MASK
                | UVD_SUVD_CGC_CTRL__MPC1_MODE_MASK
                | UVD_SUVD_CGC_CTRL__FBC_PCLK_MASK
                | UVD_SUVD_CGC_CTRL__FBC_CCLK_MASK);
@@ -892,8 +892,8 @@ static void vcn_v3_0_enable_clock_gating(struct amdgpu_device *adev, int inst)
                | UVD_SUVD_CGC_CTRL__SMPA_MODE_MASK
                | UVD_SUVD_CGC_CTRL__MPBE0_MODE_MASK
                | UVD_SUVD_CGC_CTRL__MPBE1_MODE_MASK
-               | 0x00008000
-               | 0x00010000
+               | UVD_SUVD_CGC_CTRL__SIT_AV1_MODE_MASK
+               | UVD_SUVD_CGC_CTRL__SDB_AV1_MODE_MASK
                | UVD_SUVD_CGC_CTRL__MPC1_MODE_MASK
                | UVD_SUVD_CGC_CTRL__FBC_PCLK_MASK
                | UVD_SUVD_CGC_CTRL__FBC_CCLK_MASK);
index 694c5bc..c2cd184 100644 (file)
@@ -604,7 +604,7 @@ struct hdcp_workqueue *hdcp_create_workqueue(struct amdgpu_device *adev, struct
        int i = 0;
 
        hdcp_work = kcalloc(max_caps, sizeof(*hdcp_work), GFP_KERNEL);
-       if (hdcp_work == NULL)
+       if (ZERO_OR_NULL_PTR(hdcp_work))
                return NULL;
 
        hdcp_work->srm = kcalloc(PSP_HDCP_SRM_FIRST_GEN_MAX_SIZE, sizeof(*hdcp_work->srm), GFP_KERNEL);
index 543afa3..21a3073 100644 (file)
@@ -783,7 +783,6 @@ void rn_clk_mgr_construct(
        } else {
                struct clk_log_info log_info = {0};
 
-               clk_mgr->smu_ver = rn_vbios_smu_get_smu_version(clk_mgr);
                clk_mgr->periodic_retraining_disabled = rn_vbios_smu_is_periodic_retraining_disabled(clk_mgr);
 
                /* SMU Version 55.51.0 and up no longer have an issue
index 025637a..bd2a068 100644 (file)
@@ -31,9 +31,21 @@ DCN30 = dcn30_init.o dcn30_hubbub.o dcn30_hubp.o dcn30_dpp.o dcn30_optc.o \
        dcn30_dio_link_encoder.o dcn30_resource.o
 
 
-CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_optc.o := -mhard-float -msse -mpreferred-stack-boundary=4
-
+ifdef CONFIG_X86
 CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_resource.o := -mhard-float -msse
+CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_optc.o := -mhard-float -msse
+endif
+
+ifdef CONFIG_PPC64
+CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_resource.o := -mhard-float -maltivec
+CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_optc.o := -mhard-float -maltivec
+endif
+
+ifdef CONFIG_ARM64
+CFLAGS_REMOVE_$(AMDDALPATH)/dc/dcn30/dcn30_resource.o := -mgeneral-regs-only
+CFLAGS_REMOVE_$(AMDDALPATH)/dc/dcn30/dcn30_optc.o := -mgeneral-regs-only
+endif
+
 ifdef CONFIG_CC_IS_GCC
 ifeq ($(call cc-ifversion, -lt, 0701, y), y)
 IS_OLD_GCC = 1
@@ -45,8 +57,10 @@ ifdef IS_OLD_GCC
 # GCC < 7.1 cannot compile code using `double` and -mpreferred-stack-boundary=3
 # (8B stack alignment).
 CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_resource.o += -mpreferred-stack-boundary=4
+CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_optc.o += -mpreferred-stack-boundary=4
 else
 CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_resource.o += -msse2
+CFLAGS_$(AMDDALPATH)/dc/dcn30/dcn30_optc.o += -msse2
 endif
 
 AMD_DAL_DCN30 = $(addprefix $(AMDDALPATH)/dc/dcn30/,$(DCN30))
index 1116779..e245e91 100644 (file)
 #define mmDB_STENCIL_WRITE_BASE_DEFAULT                                          0x00000000
 #define mmDB_RESERVED_REG_1_DEFAULT                                              0x00000000
 #define mmDB_RESERVED_REG_3_DEFAULT                                              0x00000000
+#define mmDB_VRS_OVERRIDE_CNTL_DEFAULT                                           0x00000000
 #define mmDB_Z_READ_BASE_HI_DEFAULT                                              0x00000000
 #define mmDB_STENCIL_READ_BASE_HI_DEFAULT                                        0x00000000
 #define mmDB_Z_WRITE_BASE_HI_DEFAULT                                             0x00000000
 #define mmPA_SU_OVER_RASTERIZATION_CNTL_DEFAULT                                  0x00000000
 #define mmPA_STEREO_CNTL_DEFAULT                                                 0x00000000
 #define mmPA_STATE_STEREO_X_DEFAULT                                              0x00000000
+#define mmPA_CL_VRS_CNTL_DEFAULT                                                 0x00000000
 #define mmPA_SU_POINT_SIZE_DEFAULT                                               0x00000000
 #define mmPA_SU_POINT_MINMAX_DEFAULT                                             0x00000000
 #define mmPA_SU_LINE_CNTL_DEFAULT                                                0x00000000
index 05d1b0a..644a9fa 100644 (file)
 #define mmDB_RESERVED_REG_1_BASE_IDX                                                                   1
 #define mmDB_RESERVED_REG_3                                                                            0x0017
 #define mmDB_RESERVED_REG_3_BASE_IDX                                                                   1
+#define mmDB_VRS_OVERRIDE_CNTL                                                                         0x0019
+#define mmDB_VRS_OVERRIDE_CNTL_BASE_IDX                                                                1
 #define mmDB_Z_READ_BASE_HI                                                                            0x001a
 #define mmDB_Z_READ_BASE_HI_BASE_IDX                                                                   1
 #define mmDB_STENCIL_READ_BASE_HI                                                                      0x001b
 #define mmPA_STEREO_CNTL_BASE_IDX                                                                      1
 #define mmPA_STATE_STEREO_X                                                                            0x0211
 #define mmPA_STATE_STEREO_X_BASE_IDX                                                                   1
+#define mmPA_CL_VRS_CNTL                                                                               0x0212
+#define mmPA_CL_VRS_CNTL_BASE_IDX                                                                      1
 #define mmPA_SU_POINT_SIZE                                                                             0x0280
 #define mmPA_SU_POINT_SIZE_BASE_IDX                                                                    1
 #define mmPA_SU_POINT_MINMAX                                                                           0x0281
index aac57f7..2e449fc 100644 (file)
 #define DB_EXCEPTION_CONTROL__AUTO_FLUSH_HTILE__SHIFT                                                         0x3
 #define DB_EXCEPTION_CONTROL__AUTO_FLUSH_QUAD__SHIFT                                                          0x4
 #define DB_EXCEPTION_CONTROL__FORCE_SUMMARIZE__SHIFT                                                          0x8
+#define DB_EXCEPTION_CONTROL__FORCE_VRS_RATE_FINE__SHIFT                                                      0x10
 #define DB_EXCEPTION_CONTROL__DTAG_WATERMARK__SHIFT                                                           0x18
 #define DB_EXCEPTION_CONTROL__EARLY_Z_PANIC_DISABLE_MASK                                                      0x00000001L
 #define DB_EXCEPTION_CONTROL__LATE_Z_PANIC_DISABLE_MASK                                                       0x00000002L
 #define DB_EXCEPTION_CONTROL__AUTO_FLUSH_HTILE_MASK                                                           0x00000008L
 #define DB_EXCEPTION_CONTROL__AUTO_FLUSH_QUAD_MASK                                                            0x00000010L
 #define DB_EXCEPTION_CONTROL__FORCE_SUMMARIZE_MASK                                                            0x00000F00L
+#define DB_EXCEPTION_CONTROL__FORCE_VRS_RATE_FINE_MASK                                                        0x00FF0000L
 #define DB_EXCEPTION_CONTROL__DTAG_WATERMARK_MASK                                                             0x7F000000L
 //DB_DFSM_CONFIG
 #define DB_DFSM_CONFIG__BYPASS_DFSM__SHIFT                                                                    0x0
 #define CB_HW_CONTROL_3__DISABLE_NACK_PROCESSING_CM__SHIFT                                                    0x18
 #define CB_HW_CONTROL_3__DISABLE_NACK_COLOR_RD_WR_OPT__SHIFT                                                  0x19
 #define CB_HW_CONTROL_3__DISABLE_BLENDER_CLOCK_GATING__SHIFT                                                  0x1a
+#define CB_HW_CONTROL_3__DISABLE_DCC_VRS_OPT__SHIFT                                                           0x1c
 #define CB_HW_CONTROL_3__DISABLE_FMASK_NOFETCH_OPT__SHIFT                                                     0x1e
 #define CB_HW_CONTROL_3__DISABLE_FMASK_NOFETCH_OPT_BC__SHIFT                                                  0x1f
 #define CB_HW_CONTROL_3__DISABLE_SLOW_MODE_EMPTY_HALF_QUAD_KILL_MASK                                          0x00000001L
 #define CB_HW_CONTROL_3__DISABLE_NACK_PROCESSING_CM_MASK                                                      0x01000000L
 #define CB_HW_CONTROL_3__DISABLE_NACK_COLOR_RD_WR_OPT_MASK                                                    0x02000000L
 #define CB_HW_CONTROL_3__DISABLE_BLENDER_CLOCK_GATING_MASK                                                    0x04000000L
+#define CB_HW_CONTROL_3__DISABLE_DCC_VRS_OPT_MASK                                                             0x10000000L
 #define CB_HW_CONTROL_3__DISABLE_FMASK_NOFETCH_OPT_MASK                                                       0x40000000L
 #define CB_HW_CONTROL_3__DISABLE_FMASK_NOFETCH_OPT_BC_MASK                                                    0x80000000L
 //CB_HW_CONTROL
 #define CB_HW_CONTROL__ALLOW_MRT_WITH_DUAL_SOURCE__SHIFT                                                      0x0
+#define CB_HW_CONTROL__DISABLE_VRS_FILLRATE_OPTIMIZATION__SHIFT                                               0x1
 #define CB_HW_CONTROL__DISABLE_FILLRATE_OPT_FIX_WITH_CFC__SHIFT                                               0x3
 #define CB_HW_CONTROL__DISABLE_POST_DCC_WITH_CFC_FIX__SHIFT                                                   0x4
+#define CB_HW_CONTROL__DISABLE_COMPRESS_1FRAG_WHEN_VRS_RATE_HINT_EN__SHIFT                                    0x5
 #define CB_HW_CONTROL__RMI_CREDITS__SHIFT                                                                     0x6
 #define CB_HW_CONTROL__CHICKEN_BITS__SHIFT                                                                    0xc
 #define CB_HW_CONTROL__DISABLE_FMASK_MULTI_MGCG_DOMAINS__SHIFT                                                0xf
 #define CB_HW_CONTROL__DISABLE_CC_IB_SERIALIZER_STATE_OPT__SHIFT                                              0x1e
 #define CB_HW_CONTROL__DISABLE_PIXEL_IN_QUAD_FIX_FOR_LINEAR_SURFACE__SHIFT                                    0x1f
 #define CB_HW_CONTROL__ALLOW_MRT_WITH_DUAL_SOURCE_MASK                                                        0x00000001L
+#define CB_HW_CONTROL__DISABLE_VRS_FILLRATE_OPTIMIZATION_MASK                                                 0x00000002L
 #define CB_HW_CONTROL__DISABLE_FILLRATE_OPT_FIX_WITH_CFC_MASK                                                 0x00000008L
 #define CB_HW_CONTROL__DISABLE_POST_DCC_WITH_CFC_FIX_MASK                                                     0x00000010L
+#define CB_HW_CONTROL__DISABLE_COMPRESS_1FRAG_WHEN_VRS_RATE_HINT_EN_MASK                                      0x00000020L
 #define CB_HW_CONTROL__RMI_CREDITS_MASK                                                                       0x00000FC0L
 #define CB_HW_CONTROL__CHICKEN_BITS_MASK                                                                      0x00007000L
 #define CB_HW_CONTROL__DISABLE_FMASK_MULTI_MGCG_DOMAINS_MASK                                                  0x00008000L
 #define DB_RENDER_OVERRIDE2__PRESERVE_SRESULTS__SHIFT                                                         0x16
 #define DB_RENDER_OVERRIDE2__DISABLE_FAST_PASS__SHIFT                                                         0x17
 #define DB_RENDER_OVERRIDE2__ALLOW_PARTIAL_RES_HIER_KILL__SHIFT                                               0x19
+#define DB_RENDER_OVERRIDE2__FORCE_VRS_RATE_FINE__SHIFT                                                       0x1a
 #define DB_RENDER_OVERRIDE2__CENTROID_COMPUTATION_MODE__SHIFT                                                 0x1b
 #define DB_RENDER_OVERRIDE2__PARTIAL_SQUAD_LAUNCH_CONTROL_MASK                                                0x00000003L
 #define DB_RENDER_OVERRIDE2__PARTIAL_SQUAD_LAUNCH_COUNTDOWN_MASK                                              0x0000001CL
 #define DB_RENDER_OVERRIDE2__PRESERVE_SRESULTS_MASK                                                           0x00400000L
 #define DB_RENDER_OVERRIDE2__DISABLE_FAST_PASS_MASK                                                           0x00800000L
 #define DB_RENDER_OVERRIDE2__ALLOW_PARTIAL_RES_HIER_KILL_MASK                                                 0x02000000L
+#define DB_RENDER_OVERRIDE2__FORCE_VRS_RATE_FINE_MASK                                                         0x04000000L
 #define DB_RENDER_OVERRIDE2__CENTROID_COMPUTATION_MODE_MASK                                                   0x18000000L
 //DB_HTILE_DATA_BASE
 #define DB_HTILE_DATA_BASE__BASE_256B__SHIFT                                                                  0x0
 //DB_RESERVED_REG_3
 #define DB_RESERVED_REG_3__FIELD_1__SHIFT                                                                     0x0
 #define DB_RESERVED_REG_3__FIELD_1_MASK                                                                       0x003FFFFFL
+//DB_VRS_OVERRIDE_CNTL
+#define DB_VRS_OVERRIDE_CNTL__VRS_OVERRIDE_RATE_COMBINER_MODE__SHIFT                                          0x0
+#define DB_VRS_OVERRIDE_CNTL__VRS_OVERRIDE_RATE_X__SHIFT                                                      0x4
+#define DB_VRS_OVERRIDE_CNTL__VRS_OVERRIDE_RATE_Y__SHIFT                                                      0x6
+#define DB_VRS_OVERRIDE_CNTL__VRS_OVERRIDE_RATE_COMBINER_MODE_MASK                                            0x00000007L
+#define DB_VRS_OVERRIDE_CNTL__VRS_OVERRIDE_RATE_X_MASK                                                        0x00000030L
+#define DB_VRS_OVERRIDE_CNTL__VRS_OVERRIDE_RATE_Y_MASK                                                        0x000000C0L
 //DB_Z_READ_BASE_HI
 #define DB_Z_READ_BASE_HI__BASE_HI__SHIFT                                                                     0x0
 #define DB_Z_READ_BASE_HI__BASE_HI_MASK                                                                       0x000000FFL
 #define PA_CL_VS_OUT_CNTL__VS_OUT_MISC_SIDE_BUS_ENA__SHIFT                                                    0x18
 #define PA_CL_VS_OUT_CNTL__USE_VTX_GS_CUT_FLAG__SHIFT                                                         0x19
 #define PA_CL_VS_OUT_CNTL__USE_VTX_LINE_WIDTH__SHIFT                                                          0x1b
+#define PA_CL_VS_OUT_CNTL__USE_VTX_VRS_RATE__SHIFT                                                            0x1c
 #define PA_CL_VS_OUT_CNTL__BYPASS_VTX_RATE_COMBINER__SHIFT                                                    0x1d
 #define PA_CL_VS_OUT_CNTL__BYPASS_PRIM_RATE_COMBINER__SHIFT                                                   0x1e
 #define PA_CL_VS_OUT_CNTL__CLIP_DIST_ENA_0_MASK                                                               0x00000001L
 #define PA_CL_VS_OUT_CNTL__VS_OUT_MISC_SIDE_BUS_ENA_MASK                                                      0x01000000L
 #define PA_CL_VS_OUT_CNTL__USE_VTX_GS_CUT_FLAG_MASK                                                           0x02000000L
 #define PA_CL_VS_OUT_CNTL__USE_VTX_LINE_WIDTH_MASK                                                            0x08000000L
+#define PA_CL_VS_OUT_CNTL__USE_VTX_VRS_RATE_MASK                                                              0x10000000L
 #define PA_CL_VS_OUT_CNTL__BYPASS_VTX_RATE_COMBINER_MASK                                                      0x20000000L
 #define PA_CL_VS_OUT_CNTL__BYPASS_PRIM_RATE_COMBINER_MASK                                                     0x40000000L
 //PA_CL_NANINF_CNTL
 //PA_STATE_STEREO_X
 #define PA_STATE_STEREO_X__STEREO_X_OFFSET__SHIFT                                                             0x0
 #define PA_STATE_STEREO_X__STEREO_X_OFFSET_MASK                                                               0xFFFFFFFFL
+//PA_CL_VRS_CNTL
+#define PA_CL_VRS_CNTL__VERTEX_RATE_COMBINER_MODE__SHIFT                                                      0x0
+#define PA_CL_VRS_CNTL__PRIMITIVE_RATE_COMBINER_MODE__SHIFT                                                   0x3
+#define PA_CL_VRS_CNTL__HTILE_RATE_COMBINER_MODE__SHIFT                                                       0x6
+#define PA_CL_VRS_CNTL__SAMPLE_ITER_COMBINER_MODE__SHIFT                                                      0x9
+#define PA_CL_VRS_CNTL__EXPOSE_VRS_PIXELS_MASK__SHIFT                                                         0xd
+#define PA_CL_VRS_CNTL__CMASK_RATE_HINT_FORCE_ZERO__SHIFT                                                     0xe
+#define PA_CL_VRS_CNTL__VERTEX_RATE_COMBINER_MODE_MASK                                                        0x00000007L
+#define PA_CL_VRS_CNTL__PRIMITIVE_RATE_COMBINER_MODE_MASK                                                     0x00000038L
+#define PA_CL_VRS_CNTL__HTILE_RATE_COMBINER_MODE_MASK                                                         0x000001C0L
+#define PA_CL_VRS_CNTL__SAMPLE_ITER_COMBINER_MODE_MASK                                                        0x00000E00L
+#define PA_CL_VRS_CNTL__EXPOSE_VRS_PIXELS_MASK_MASK                                                           0x00002000L
+#define PA_CL_VRS_CNTL__CMASK_RATE_HINT_FORCE_ZERO_MASK                                                       0x00004000L
 //PA_SU_POINT_SIZE
 #define PA_SU_POINT_SIZE__HEIGHT__SHIFT                                                                       0x0
 #define PA_SU_POINT_SIZE__WIDTH__SHIFT                                                                        0x10
 #define DB_HTILE_SURFACE__DST_OUTSIDE_ZERO_TO_ONE__SHIFT                                                      0x10
 #define DB_HTILE_SURFACE__RESERVED_FIELD_6__SHIFT                                                             0x11
 #define DB_HTILE_SURFACE__PIPE_ALIGNED__SHIFT                                                                 0x12
+#define DB_HTILE_SURFACE__VRS_HTILE_ENCODING__SHIFT                                                           0x13
 #define DB_HTILE_SURFACE__RESERVED_FIELD_1_MASK                                                               0x00000001L
 #define DB_HTILE_SURFACE__FULL_CACHE_MASK                                                                     0x00000002L
 #define DB_HTILE_SURFACE__RESERVED_FIELD_2_MASK                                                               0x00000004L
 #define DB_HTILE_SURFACE__DST_OUTSIDE_ZERO_TO_ONE_MASK                                                        0x00010000L
 #define DB_HTILE_SURFACE__RESERVED_FIELD_6_MASK                                                               0x00020000L
 #define DB_HTILE_SURFACE__PIPE_ALIGNED_MASK                                                                   0x00040000L
+#define DB_HTILE_SURFACE__VRS_HTILE_ENCODING_MASK                                                             0x00180000L
 //DB_SRESULTS_COMPARE_STATE0
 #define DB_SRESULTS_COMPARE_STATE0__COMPAREFUNC0__SHIFT                                                       0x0
 #define DB_SRESULTS_COMPARE_STATE0__COMPAREVALUE0__SHIFT                                                      0x4
 #define CB_COLOR0_ATTRIB3__CMASK_PIPE_ALIGNED__SHIFT                                                          0x1a
 #define CB_COLOR0_ATTRIB3__RESOURCE_LEVEL__SHIFT                                                              0x1b
 #define CB_COLOR0_ATTRIB3__DCC_PIPE_ALIGNED__SHIFT                                                            0x1e
+#define CB_COLOR0_ATTRIB3__VRS_RATE_HINT_ENABLE__SHIFT                                                        0x1f
 #define CB_COLOR0_ATTRIB3__MIP0_DEPTH_MASK                                                                    0x00001FFFL
 #define CB_COLOR0_ATTRIB3__META_LINEAR_MASK                                                                   0x00002000L
 #define CB_COLOR0_ATTRIB3__COLOR_SW_MODE_MASK                                                                 0x0007C000L
 #define CB_COLOR0_ATTRIB3__CMASK_PIPE_ALIGNED_MASK                                                            0x04000000L
 #define CB_COLOR0_ATTRIB3__RESOURCE_LEVEL_MASK                                                                0x38000000L
 #define CB_COLOR0_ATTRIB3__DCC_PIPE_ALIGNED_MASK                                                              0x40000000L
+#define CB_COLOR0_ATTRIB3__VRS_RATE_HINT_ENABLE_MASK                                                          0x80000000L
 //CB_COLOR1_ATTRIB3
 #define CB_COLOR1_ATTRIB3__MIP0_DEPTH__SHIFT                                                                  0x0
 #define CB_COLOR1_ATTRIB3__META_LINEAR__SHIFT                                                                 0xd
 #define CB_COLOR1_ATTRIB3__CMASK_PIPE_ALIGNED__SHIFT                                                          0x1a
 #define CB_COLOR1_ATTRIB3__RESOURCE_LEVEL__SHIFT                                                              0x1b
 #define CB_COLOR1_ATTRIB3__DCC_PIPE_ALIGNED__SHIFT                                                            0x1e
+#define CB_COLOR1_ATTRIB3__VRS_RATE_HINT_ENABLE__SHIFT                                                        0x1f
 #define CB_COLOR1_ATTRIB3__MIP0_DEPTH_MASK                                                                    0x00001FFFL
 #define CB_COLOR1_ATTRIB3__META_LINEAR_MASK                                                                   0x00002000L
 #define CB_COLOR1_ATTRIB3__COLOR_SW_MODE_MASK                                                                 0x0007C000L
 #define CB_COLOR1_ATTRIB3__CMASK_PIPE_ALIGNED_MASK                                                            0x04000000L
 #define CB_COLOR1_ATTRIB3__RESOURCE_LEVEL_MASK                                                                0x38000000L
 #define CB_COLOR1_ATTRIB3__DCC_PIPE_ALIGNED_MASK                                                              0x40000000L
+#define CB_COLOR1_ATTRIB3__VRS_RATE_HINT_ENABLE_MASK                                                          0x80000000L
 //CB_COLOR2_ATTRIB3
 #define CB_COLOR2_ATTRIB3__MIP0_DEPTH__SHIFT                                                                  0x0
 #define CB_COLOR2_ATTRIB3__META_LINEAR__SHIFT                                                                 0xd
 #define CB_COLOR2_ATTRIB3__CMASK_PIPE_ALIGNED__SHIFT                                                          0x1a
 #define CB_COLOR2_ATTRIB3__RESOURCE_LEVEL__SHIFT                                                              0x1b
 #define CB_COLOR2_ATTRIB3__DCC_PIPE_ALIGNED__SHIFT                                                            0x1e
+#define CB_COLOR2_ATTRIB3__VRS_RATE_HINT_ENABLE__SHIFT                                                        0x1f
 #define CB_COLOR2_ATTRIB3__MIP0_DEPTH_MASK                                                                    0x00001FFFL
 #define CB_COLOR2_ATTRIB3__META_LINEAR_MASK                                                                   0x00002000L
 #define CB_COLOR2_ATTRIB3__COLOR_SW_MODE_MASK                                                                 0x0007C000L
 #define CB_COLOR2_ATTRIB3__CMASK_PIPE_ALIGNED_MASK                                                            0x04000000L
 #define CB_COLOR2_ATTRIB3__RESOURCE_LEVEL_MASK                                                                0x38000000L
 #define CB_COLOR2_ATTRIB3__DCC_PIPE_ALIGNED_MASK                                                              0x40000000L
+#define CB_COLOR2_ATTRIB3__VRS_RATE_HINT_ENABLE_MASK                                                          0x80000000L
 //CB_COLOR3_ATTRIB3
 #define CB_COLOR3_ATTRIB3__MIP0_DEPTH__SHIFT                                                                  0x0
 #define CB_COLOR3_ATTRIB3__META_LINEAR__SHIFT                                                                 0xd
 #define CB_COLOR3_ATTRIB3__CMASK_PIPE_ALIGNED__SHIFT                                                          0x1a
 #define CB_COLOR3_ATTRIB3__RESOURCE_LEVEL__SHIFT                                                              0x1b
 #define CB_COLOR3_ATTRIB3__DCC_PIPE_ALIGNED__SHIFT                                                            0x1e
+#define CB_COLOR3_ATTRIB3__VRS_RATE_HINT_ENABLE__SHIFT                                                        0x1f
 #define CB_COLOR3_ATTRIB3__MIP0_DEPTH_MASK                                                                    0x00001FFFL
 #define CB_COLOR3_ATTRIB3__META_LINEAR_MASK                                                                   0x00002000L
 #define CB_COLOR3_ATTRIB3__COLOR_SW_MODE_MASK                                                                 0x0007C000L
 #define CB_COLOR3_ATTRIB3__CMASK_PIPE_ALIGNED_MASK                                                            0x04000000L
 #define CB_COLOR3_ATTRIB3__RESOURCE_LEVEL_MASK                                                                0x38000000L
 #define CB_COLOR3_ATTRIB3__DCC_PIPE_ALIGNED_MASK                                                              0x40000000L
+#define CB_COLOR3_ATTRIB3__VRS_RATE_HINT_ENABLE_MASK                                                          0x80000000L
 //CB_COLOR4_ATTRIB3
 #define CB_COLOR4_ATTRIB3__MIP0_DEPTH__SHIFT                                                                  0x0
 #define CB_COLOR4_ATTRIB3__META_LINEAR__SHIFT                                                                 0xd
 #define CB_COLOR4_ATTRIB3__CMASK_PIPE_ALIGNED__SHIFT                                                          0x1a
 #define CB_COLOR4_ATTRIB3__RESOURCE_LEVEL__SHIFT                                                              0x1b
 #define CB_COLOR4_ATTRIB3__DCC_PIPE_ALIGNED__SHIFT                                                            0x1e
+#define CB_COLOR4_ATTRIB3__VRS_RATE_HINT_ENABLE__SHIFT                                                        0x1f
 #define CB_COLOR4_ATTRIB3__MIP0_DEPTH_MASK                                                                    0x00001FFFL
 #define CB_COLOR4_ATTRIB3__META_LINEAR_MASK                                                                   0x00002000L
 #define CB_COLOR4_ATTRIB3__COLOR_SW_MODE_MASK                                                                 0x0007C000L
 #define CB_COLOR4_ATTRIB3__CMASK_PIPE_ALIGNED_MASK                                                            0x04000000L
 #define CB_COLOR4_ATTRIB3__RESOURCE_LEVEL_MASK                                                                0x38000000L
 #define CB_COLOR4_ATTRIB3__DCC_PIPE_ALIGNED_MASK                                                              0x40000000L
+#define CB_COLOR4_ATTRIB3__VRS_RATE_HINT_ENABLE_MASK                                                          0x80000000L
 //CB_COLOR5_ATTRIB3
 #define CB_COLOR5_ATTRIB3__MIP0_DEPTH__SHIFT                                                                  0x0
 #define CB_COLOR5_ATTRIB3__META_LINEAR__SHIFT                                                                 0xd
 #define CB_COLOR5_ATTRIB3__CMASK_PIPE_ALIGNED__SHIFT                                                          0x1a
 #define CB_COLOR5_ATTRIB3__RESOURCE_LEVEL__SHIFT                                                              0x1b
 #define CB_COLOR5_ATTRIB3__DCC_PIPE_ALIGNED__SHIFT                                                            0x1e
+#define CB_COLOR5_ATTRIB3__VRS_RATE_HINT_ENABLE__SHIFT                                                        0x1f
 #define CB_COLOR5_ATTRIB3__MIP0_DEPTH_MASK                                                                    0x00001FFFL
 #define CB_COLOR5_ATTRIB3__META_LINEAR_MASK                                                                   0x00002000L
 #define CB_COLOR5_ATTRIB3__COLOR_SW_MODE_MASK                                                                 0x0007C000L
 #define CB_COLOR5_ATTRIB3__CMASK_PIPE_ALIGNED_MASK                                                            0x04000000L
 #define CB_COLOR5_ATTRIB3__RESOURCE_LEVEL_MASK                                                                0x38000000L
 #define CB_COLOR5_ATTRIB3__DCC_PIPE_ALIGNED_MASK                                                              0x40000000L
+#define CB_COLOR5_ATTRIB3__VRS_RATE_HINT_ENABLE_MASK                                                          0x80000000L
 //CB_COLOR6_ATTRIB3
 #define CB_COLOR6_ATTRIB3__MIP0_DEPTH__SHIFT                                                                  0x0
 #define CB_COLOR6_ATTRIB3__META_LINEAR__SHIFT                                                                 0xd
 #define CB_COLOR6_ATTRIB3__CMASK_PIPE_ALIGNED__SHIFT                                                          0x1a
 #define CB_COLOR6_ATTRIB3__RESOURCE_LEVEL__SHIFT                                                              0x1b
 #define CB_COLOR6_ATTRIB3__DCC_PIPE_ALIGNED__SHIFT                                                            0x1e
+#define CB_COLOR6_ATTRIB3__VRS_RATE_HINT_ENABLE__SHIFT                                                        0x1f
 #define CB_COLOR6_ATTRIB3__MIP0_DEPTH_MASK                                                                    0x00001FFFL
 #define CB_COLOR6_ATTRIB3__META_LINEAR_MASK                                                                   0x00002000L
 #define CB_COLOR6_ATTRIB3__COLOR_SW_MODE_MASK                                                                 0x0007C000L
 #define CB_COLOR6_ATTRIB3__CMASK_PIPE_ALIGNED_MASK                                                            0x04000000L
 #define CB_COLOR6_ATTRIB3__RESOURCE_LEVEL_MASK                                                                0x38000000L
 #define CB_COLOR6_ATTRIB3__DCC_PIPE_ALIGNED_MASK                                                              0x40000000L
+#define CB_COLOR6_ATTRIB3__VRS_RATE_HINT_ENABLE_MASK                                                          0x80000000L
 //CB_COLOR7_ATTRIB3
 #define CB_COLOR7_ATTRIB3__MIP0_DEPTH__SHIFT                                                                  0x0
 #define CB_COLOR7_ATTRIB3__META_LINEAR__SHIFT                                                                 0xd
 #define CB_COLOR7_ATTRIB3__CMASK_PIPE_ALIGNED__SHIFT                                                          0x1a
 #define CB_COLOR7_ATTRIB3__RESOURCE_LEVEL__SHIFT                                                              0x1b
 #define CB_COLOR7_ATTRIB3__DCC_PIPE_ALIGNED__SHIFT                                                            0x1e
+#define CB_COLOR7_ATTRIB3__VRS_RATE_HINT_ENABLE__SHIFT                                                        0x1f
 #define CB_COLOR7_ATTRIB3__MIP0_DEPTH_MASK                                                                    0x00001FFFL
 #define CB_COLOR7_ATTRIB3__META_LINEAR_MASK                                                                   0x00002000L
 #define CB_COLOR7_ATTRIB3__COLOR_SW_MODE_MASK                                                                 0x0007C000L
 #define CB_COLOR7_ATTRIB3__CMASK_PIPE_ALIGNED_MASK                                                            0x04000000L
 #define CB_COLOR7_ATTRIB3__RESOURCE_LEVEL_MASK                                                                0x38000000L
 #define CB_COLOR7_ATTRIB3__DCC_PIPE_ALIGNED_MASK                                                              0x40000000L
+#define CB_COLOR7_ATTRIB3__VRS_RATE_HINT_ENABLE_MASK                                                          0x80000000L
 
 
 // addressBlock: gc_gfxudec
index c0efd90..58cf7ad 100644 (file)
 #define VCN_FEATURES__HAS_MJPEG2_IDCT_DEC__SHIFT                                                              0x7
 #define VCN_FEATURES__HAS_SCLR_DEC__SHIFT                                                                     0x8
 #define VCN_FEATURES__HAS_VP9_DEC__SHIFT                                                                      0x9
+#define VCN_FEATURES__HAS_AV1_DEC__SHIFT                                                                      0xa
 #define VCN_FEATURES__HAS_EFC_ENC__SHIFT                                                                      0xb
 #define VCN_FEATURES__HAS_EFC_HDR2SDR_ENC__SHIFT                                                              0xc
 #define VCN_FEATURES__HAS_DUAL_MJPEG_DEC__SHIFT                                                               0xd
 #define VCN_FEATURES__HAS_MJPEG2_IDCT_DEC_MASK                                                                0x00000080L
 #define VCN_FEATURES__HAS_SCLR_DEC_MASK                                                                       0x00000100L
 #define VCN_FEATURES__HAS_VP9_DEC_MASK                                                                        0x00000200L
+#define VCN_FEATURES__HAS_AV1_DEC_MASK                                                                        0x00000400L
 #define VCN_FEATURES__HAS_EFC_ENC_MASK                                                                        0x00000800L
 #define VCN_FEATURES__HAS_EFC_HDR2SDR_ENC_MASK                                                                0x00001000L
 #define VCN_FEATURES__HAS_DUAL_MJPEG_DEC_MASK                                                                 0x00002000L
 #define UVD_SUVD_CGC_GATE__IME_HEVC__SHIFT                                                                    0x18
 #define UVD_SUVD_CGC_GATE__EFC__SHIFT                                                                         0x19
 #define UVD_SUVD_CGC_GATE__SAOE__SHIFT                                                                        0x1a
+#define UVD_SUVD_CGC_GATE__SRE_AV1__SHIFT                                                                     0x1b
 #define UVD_SUVD_CGC_GATE__FBC_PCLK__SHIFT                                                                    0x1c
 #define UVD_SUVD_CGC_GATE__FBC_CCLK__SHIFT                                                                    0x1d
+#define UVD_SUVD_CGC_GATE__SCM_AV1__SHIFT                                                                     0x1e
 #define UVD_SUVD_CGC_GATE__SMPA__SHIFT                                                                        0x1f
 #define UVD_SUVD_CGC_GATE__SRE_MASK                                                                           0x00000001L
 #define UVD_SUVD_CGC_GATE__SIT_MASK                                                                           0x00000002L
 #define UVD_SUVD_CGC_GATE__IME_HEVC_MASK                                                                      0x01000000L
 #define UVD_SUVD_CGC_GATE__EFC_MASK                                                                           0x02000000L
 #define UVD_SUVD_CGC_GATE__SAOE_MASK                                                                          0x04000000L
+#define UVD_SUVD_CGC_GATE__SRE_AV1_MASK                                                                       0x08000000L
 #define UVD_SUVD_CGC_GATE__FBC_PCLK_MASK                                                                      0x10000000L
 #define UVD_SUVD_CGC_GATE__FBC_CCLK_MASK                                                                      0x20000000L
+#define UVD_SUVD_CGC_GATE__SCM_AV1_MASK                                                                       0x40000000L
 #define UVD_SUVD_CGC_GATE__SMPA_MASK                                                                          0x80000000L
 //UVD_SUVD_CGC_STATUS
 #define UVD_SUVD_CGC_STATUS__SRE_VCLK__SHIFT                                                                  0x0
 #define UVD_SUVD_CGC_STATUS__IME_HEVC_DCLK__SHIFT                                                             0x1b
 #define UVD_SUVD_CGC_STATUS__EFC_DCLK__SHIFT                                                                  0x1c
 #define UVD_SUVD_CGC_STATUS__SAOE_DCLK__SHIFT                                                                 0x1d
+#define UVD_SUVD_CGC_STATUS__SRE_AV1_VCLK__SHIFT                                                              0x1e
+#define UVD_SUVD_CGC_STATUS__SCM_AV1_DCLK__SHIFT                                                              0x1f
 #define UVD_SUVD_CGC_STATUS__SRE_VCLK_MASK                                                                    0x00000001L
 #define UVD_SUVD_CGC_STATUS__SRE_DCLK_MASK                                                                    0x00000002L
 #define UVD_SUVD_CGC_STATUS__SIT_DCLK_MASK                                                                    0x00000004L
 #define UVD_SUVD_CGC_STATUS__IME_HEVC_DCLK_MASK                                                               0x08000000L
 #define UVD_SUVD_CGC_STATUS__EFC_DCLK_MASK                                                                    0x10000000L
 #define UVD_SUVD_CGC_STATUS__SAOE_DCLK_MASK                                                                   0x20000000L
+#define UVD_SUVD_CGC_STATUS__SRE_AV1_VCLK_MASK                                                                0x40000000L
+#define UVD_SUVD_CGC_STATUS__SCM_AV1_DCLK_MASK                                                                0x80000000L
 //UVD_SUVD_CGC_CTRL
 #define UVD_SUVD_CGC_CTRL__SRE_MODE__SHIFT                                                                    0x0
 #define UVD_SUVD_CGC_CTRL__SIT_MODE__SHIFT                                                                    0x1
 #define UVD_SUVD_CGC_CTRL__SMPA_MODE__SHIFT                                                                   0xc
 #define UVD_SUVD_CGC_CTRL__MPBE0_MODE__SHIFT                                                                  0xd
 #define UVD_SUVD_CGC_CTRL__MPBE1_MODE__SHIFT                                                                  0xe
+#define UVD_SUVD_CGC_CTRL__SIT_AV1_MODE__SHIFT                                                                0xf
+#define UVD_SUVD_CGC_CTRL__SDB_AV1_MODE__SHIFT                                                                0x10
 #define UVD_SUVD_CGC_CTRL__MPC1_MODE__SHIFT                                                                   0x11
 #define UVD_SUVD_CGC_CTRL__FBC_PCLK__SHIFT                                                                    0x1c
 #define UVD_SUVD_CGC_CTRL__FBC_CCLK__SHIFT                                                                    0x1d
 #define UVD_SUVD_CGC_CTRL__SMPA_MODE_MASK                                                                     0x00001000L
 #define UVD_SUVD_CGC_CTRL__MPBE0_MODE_MASK                                                                    0x00002000L
 #define UVD_SUVD_CGC_CTRL__MPBE1_MODE_MASK                                                                    0x00004000L
+#define UVD_SUVD_CGC_CTRL__SIT_AV1_MODE_MASK                                                                  0x00008000L
+#define UVD_SUVD_CGC_CTRL__SDB_AV1_MODE_MASK                                                                  0x00010000L
 #define UVD_SUVD_CGC_CTRL__MPC1_MODE_MASK                                                                     0x00020000L
 #define UVD_SUVD_CGC_CTRL__FBC_PCLK_MASK                                                                      0x10000000L
 #define UVD_SUVD_CGC_CTRL__FBC_CCLK_MASK                                                                      0x20000000L
 #define UVD_SUVD_CGC_STATUS2__SMPA_VCLK__SHIFT                                                                0x0
 #define UVD_SUVD_CGC_STATUS2__SMPA_DCLK__SHIFT                                                                0x1
 #define UVD_SUVD_CGC_STATUS2__MPBE1_DCLK__SHIFT                                                               0x3
+#define UVD_SUVD_CGC_STATUS2__SIT_AV1_DCLK__SHIFT                                                             0x4
+#define UVD_SUVD_CGC_STATUS2__SDB_AV1_DCLK__SHIFT                                                             0x5
 #define UVD_SUVD_CGC_STATUS2__MPC1_DCLK__SHIFT                                                                0x6
 #define UVD_SUVD_CGC_STATUS2__MPC1_SCLK__SHIFT                                                                0x7
 #define UVD_SUVD_CGC_STATUS2__MPC1_VCLK__SHIFT                                                                0x8
 #define UVD_SUVD_CGC_STATUS2__SMPA_VCLK_MASK                                                                  0x00000001L
 #define UVD_SUVD_CGC_STATUS2__SMPA_DCLK_MASK                                                                  0x00000002L
 #define UVD_SUVD_CGC_STATUS2__MPBE1_DCLK_MASK                                                                 0x00000008L
+#define UVD_SUVD_CGC_STATUS2__SIT_AV1_DCLK_MASK                                                               0x00000010L
+#define UVD_SUVD_CGC_STATUS2__SDB_AV1_DCLK_MASK                                                               0x00000020L
 #define UVD_SUVD_CGC_STATUS2__MPC1_DCLK_MASK                                                                  0x00000040L
 #define UVD_SUVD_CGC_STATUS2__MPC1_SCLK_MASK                                                                  0x00000080L
 #define UVD_SUVD_CGC_STATUS2__MPC1_VCLK_MASK                                                                  0x00000100L
 //UVD_SUVD_CGC_GATE2
 #define UVD_SUVD_CGC_GATE2__MPBE0__SHIFT                                                                      0x0
 #define UVD_SUVD_CGC_GATE2__MPBE1__SHIFT                                                                      0x1
+#define UVD_SUVD_CGC_GATE2__SIT_AV1__SHIFT                                                                    0x2
+#define UVD_SUVD_CGC_GATE2__SDB_AV1__SHIFT                                                                    0x3
 #define UVD_SUVD_CGC_GATE2__MPC1__SHIFT                                                                       0x4
 #define UVD_SUVD_CGC_GATE2__MPBE0_MASK                                                                        0x00000001L
 #define UVD_SUVD_CGC_GATE2__MPBE1_MASK                                                                        0x00000002L
+#define UVD_SUVD_CGC_GATE2__SIT_AV1_MASK                                                                      0x00000004L
+#define UVD_SUVD_CGC_GATE2__SDB_AV1_MASK                                                                      0x00000008L
 #define UVD_SUVD_CGC_GATE2__MPC1_MASK                                                                         0x00000010L
 //UVD_SUVD_INT_STATUS2
 #define UVD_SUVD_INT_STATUS2__SMPA_FUNC_INT__SHIFT                                                            0x0
 #define UVD_SUVD_INT_STATUS2__SMPA_ERR_INT__SHIFT                                                             0x5
+#define UVD_SUVD_INT_STATUS2__SDB_AV1_FUNC_INT__SHIFT                                                         0x6
+#define UVD_SUVD_INT_STATUS2__SDB_AV1_ERR_INT__SHIFT                                                          0xb
 #define UVD_SUVD_INT_STATUS2__SMPA_FUNC_INT_MASK                                                              0x0000001FL
 #define UVD_SUVD_INT_STATUS2__SMPA_ERR_INT_MASK                                                               0x00000020L
+#define UVD_SUVD_INT_STATUS2__SDB_AV1_FUNC_INT_MASK                                                           0x000007C0L
+#define UVD_SUVD_INT_STATUS2__SDB_AV1_ERR_INT_MASK                                                            0x00000800L
 //UVD_SUVD_INT_EN2
 #define UVD_SUVD_INT_EN2__SMPA_FUNC_INT_EN__SHIFT                                                             0x0
 #define UVD_SUVD_INT_EN2__SMPA_ERR_INT_EN__SHIFT                                                              0x5
+#define UVD_SUVD_INT_EN2__SDB_AV1_FUNC_INT_EN__SHIFT                                                          0x6
+#define UVD_SUVD_INT_EN2__SDB_AV1_ERR_INT_EN__SHIFT                                                           0xb
 #define UVD_SUVD_INT_EN2__SMPA_FUNC_INT_EN_MASK                                                               0x0000001FL
 #define UVD_SUVD_INT_EN2__SMPA_ERR_INT_EN_MASK                                                                0x00000020L
+#define UVD_SUVD_INT_EN2__SDB_AV1_FUNC_INT_EN_MASK                                                            0x000007C0L
+#define UVD_SUVD_INT_EN2__SDB_AV1_ERR_INT_EN_MASK                                                             0x00000800L
 //UVD_SUVD_INT_ACK2
 #define UVD_SUVD_INT_ACK2__SMPA_FUNC_INT_ACK__SHIFT                                                           0x0
 #define UVD_SUVD_INT_ACK2__SMPA_ERR_INT_ACK__SHIFT                                                            0x5
+#define UVD_SUVD_INT_ACK2__SDB_AV1_FUNC_INT_ACK__SHIFT                                                        0x6
+#define UVD_SUVD_INT_ACK2__SDB_AV1_ERR_INT_ACK__SHIFT                                                         0xb
 #define UVD_SUVD_INT_ACK2__SMPA_FUNC_INT_ACK_MASK                                                             0x0000001FL
 #define UVD_SUVD_INT_ACK2__SMPA_ERR_INT_ACK_MASK                                                              0x00000020L
+#define UVD_SUVD_INT_ACK2__SDB_AV1_FUNC_INT_ACK_MASK                                                          0x000007C0L
+#define UVD_SUVD_INT_ACK2__SDB_AV1_ERR_INT_ACK_MASK                                                           0x00000800L
 
 
 // addressBlock: uvd0_ecpudec
index 63f945f..8dc5abb 100644 (file)
@@ -479,17 +479,6 @@ static int smu_late_init(void *handle)
                return ret;
        }
 
-       /*
-        * Set initialized values (get from vbios) to dpm tables context such as
-        * gfxclk, memclk, dcefclk, and etc. And enable the DPM feature for each
-        * type of clks.
-        */
-       ret = smu_set_default_dpm_table(smu);
-       if (ret) {
-               dev_err(adev->dev, "Failed to setup default dpm clock tables!\n");
-               return ret;
-       }
-
        ret = smu_populate_umd_state_clk(smu);
        if (ret) {
                dev_err(adev->dev, "Failed to populate UMD state clocks!\n");
@@ -984,6 +973,17 @@ static int smu_smc_hw_setup(struct smu_context *smu)
                return ret;
        }
 
+       /*
+        * Set initialized values (get from vbios) to dpm tables context such as
+        * gfxclk, memclk, dcefclk, and etc. And enable the DPM feature for each
+        * type of clks.
+        */
+       ret = smu_set_default_dpm_table(smu);
+       if (ret) {
+               dev_err(adev->dev, "Failed to setup default dpm clock tables!\n");
+               return ret;
+       }
+
        ret = smu_notify_display_change(smu);
        if (ret)
                return ret;
index 9ee8cf8..43f7adf 100644 (file)
@@ -563,6 +563,8 @@ static int smu10_dpm_force_dpm_level(struct pp_hwmgr *hwmgr,
        struct smu10_hwmgr *data = hwmgr->backend;
        uint32_t min_sclk = hwmgr->display_config->min_core_set_clock;
        uint32_t min_mclk = hwmgr->display_config->min_mem_set_clock/100;
+       uint32_t index_fclk = data->clock_vol_info.vdd_dep_on_fclk->count - 1;
+       uint32_t index_socclk = data->clock_vol_info.vdd_dep_on_socclk->count - 1;
 
        if (hwmgr->smu_version < 0x1E3700) {
                pr_info("smu firmware version too old, can not set dpm level\n");
@@ -676,13 +678,13 @@ static int smu10_dpm_force_dpm_level(struct pp_hwmgr *hwmgr,
                smum_send_msg_to_smc_with_parameter(hwmgr,
                                                PPSMC_MSG_SetHardMinFclkByFreq,
                                                hwmgr->display_config->num_display > 3 ?
-                                               SMU10_UMD_PSTATE_PEAK_FCLK :
+                                               data->clock_vol_info.vdd_dep_on_fclk->entries[0].clk :
                                                min_mclk,
                                                NULL);
 
                smum_send_msg_to_smc_with_parameter(hwmgr,
                                                PPSMC_MSG_SetHardMinSocclkByFreq,
-                                               SMU10_UMD_PSTATE_MIN_SOCCLK,
+                                               data->clock_vol_info.vdd_dep_on_socclk->entries[0].clk,
                                                NULL);
                smum_send_msg_to_smc_with_parameter(hwmgr,
                                                PPSMC_MSG_SetHardMinVcn,
@@ -695,11 +697,11 @@ static int smu10_dpm_force_dpm_level(struct pp_hwmgr *hwmgr,
                                                NULL);
                smum_send_msg_to_smc_with_parameter(hwmgr,
                                                PPSMC_MSG_SetSoftMaxFclkByFreq,
-                                               SMU10_UMD_PSTATE_PEAK_FCLK,
+                                               data->clock_vol_info.vdd_dep_on_fclk->entries[index_fclk].clk,
                                                NULL);
                smum_send_msg_to_smc_with_parameter(hwmgr,
                                                PPSMC_MSG_SetSoftMaxSocclkByFreq,
-                                               SMU10_UMD_PSTATE_PEAK_SOCCLK,
+                                               data->clock_vol_info.vdd_dep_on_socclk->entries[index_socclk].clk,
                                                NULL);
                smum_send_msg_to_smc_with_parameter(hwmgr,
                                                PPSMC_MSG_SetSoftMaxVcn,
index dbb676c..15263cf 100644 (file)
@@ -232,14 +232,16 @@ static int renoir_get_profiling_clk_mask(struct smu_context *smu,
                        *sclk_mask = 0;
        } else if (level == AMD_DPM_FORCED_LEVEL_PROFILE_MIN_MCLK) {
                if (mclk_mask)
-                       *mclk_mask = 0;
+                       /* mclk levels are in reverse order */
+                       *mclk_mask = NUM_MEMCLK_DPM_LEVELS - 1;
        } else if (level == AMD_DPM_FORCED_LEVEL_PROFILE_PEAK) {
                if(sclk_mask)
                        /* The sclk as gfxclk and has three level about max/min/current */
                        *sclk_mask = 3 - 1;
 
                if(mclk_mask)
-                       *mclk_mask = NUM_MEMCLK_DPM_LEVELS - 1;
+                       /* mclk levels are in reverse order */
+                       *mclk_mask = 0;
 
                if(soc_mask)
                        *soc_mask = NUM_SOCCLK_DPM_LEVELS - 1;
@@ -333,7 +335,7 @@ static int renoir_get_dpm_ultimate_freq(struct smu_context *smu,
                case SMU_UCLK:
                case SMU_FCLK:
                case SMU_MCLK:
-                       ret = renoir_get_dpm_clk_limited(smu, clk_type, 0, min);
+                       ret = renoir_get_dpm_clk_limited(smu, clk_type, NUM_MEMCLK_DPM_LEVELS - 1, min);
                        if (ret)
                                goto failed;
                        break;
index 8fa9b31..f6d7e33 100644 (file)
@@ -368,6 +368,7 @@ void intel_gvt_destroy_idle_vgpu(struct intel_vgpu *vgpu)
 static struct intel_vgpu *__intel_gvt_create_vgpu(struct intel_gvt *gvt,
                struct intel_vgpu_creation_params *param)
 {
+       struct drm_i915_private *dev_priv = gvt->gt->i915;
        struct intel_vgpu *vgpu;
        int ret;
 
@@ -436,7 +437,10 @@ static struct intel_vgpu *__intel_gvt_create_vgpu(struct intel_gvt *gvt,
        if (ret)
                goto out_clean_sched_policy;
 
-       ret = intel_gvt_hypervisor_set_edid(vgpu, PORT_D);
+       if (IS_BROADWELL(dev_priv))
+               ret = intel_gvt_hypervisor_set_edid(vgpu, PORT_B);
+       else
+               ret = intel_gvt_hypervisor_set_edid(vgpu, PORT_D);
        if (ret)
                goto out_clean_sched_policy;
 
index f127e63..397c313 100644 (file)
@@ -118,11 +118,11 @@ static struct dev_pm_domain pm_domain = {
 
 struct drm_i915_private *mock_gem_device(void)
 {
-       struct drm_i915_private *i915;
-       struct pci_dev *pdev;
 #if IS_ENABLED(CONFIG_IOMMU_API) && defined(CONFIG_INTEL_IOMMU)
-       struct dev_iommu iommu;
+       static struct dev_iommu fake_iommu = { .priv = (void *)-1 };
 #endif
+       struct drm_i915_private *i915;
+       struct pci_dev *pdev;
        int err;
 
        pdev = kzalloc(sizeof(*pdev), GFP_KERNEL);
@@ -141,10 +141,8 @@ struct drm_i915_private *mock_gem_device(void)
        dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
 
 #if IS_ENABLED(CONFIG_IOMMU_API) && defined(CONFIG_INTEL_IOMMU)
-       /* HACK HACK HACK to disable iommu for the fake device; force identity mapping */
-       memset(&iommu, 0, sizeof(iommu));
-       iommu.priv = (void *)-1;
-       pdev->dev.iommu = &iommu;
+       /* HACK to disable iommu for the fake device; force identity mapping */
+       pdev->dev.iommu = &fake_iommu;
 #endif
 
        pci_set_drvdata(pdev, i915);
index f42441b..a55a38a 100644 (file)
@@ -12,7 +12,7 @@ struct sun8i_mixer;
 
 /* VI channel CSC units offsets */
 #define CCSC00_OFFSET 0xAA050
-#define CCSC01_OFFSET 0xFA000
+#define CCSC01_OFFSET 0xFA050
 #define CCSC10_OFFSET 0xA0000
 #define CCSC11_OFFSET 0xF0000
 
index cc4fb91..c330402 100644 (file)
@@ -307,7 +307,7 @@ static struct regmap_config sun8i_mixer_regmap_config = {
        .reg_bits       = 32,
        .val_bits       = 32,
        .reg_stride     = 4,
-       .max_register   = 0xbfffc, /* guessed */
+       .max_register   = 0xffffc, /* guessed */
 };
 
 static int sun8i_mixer_of_get_id(struct device_node *node)
index 15a11cd..6339c6f 100644 (file)
@@ -1117,6 +1117,7 @@ static int vc4_hdmi_audio_init(struct vc4_hdmi *hdmi)
        card->num_links = 1;
        card->name = "vc4-hdmi";
        card->dev = dev;
+       card->owner = THIS_MODULE;
 
        /*
         * Be careful, snd_soc_register_card() calls dev_set_drvdata() and
index 4a76fc7..f8bdd4e 100644 (file)
@@ -55,7 +55,7 @@ static int vmw_gmrid_man_get_node(struct ttm_mem_type_manager *man,
 
        id = ida_alloc_max(&gman->gmr_ida, gman->max_gmr_ids - 1, GFP_KERNEL);
        if (id < 0)
-               return (id != -ENOMEM ? 0 : id);
+               return id;
 
        spin_lock(&gman->lock);
 
index b7c816b..c8b9335 100644 (file)
@@ -95,7 +95,7 @@ found_unlock:
                mem->start = node->start;
        }
 
-       return 0;
+       return ret;
 }
 
 
index 1213e19..24d584a 100644 (file)
@@ -65,6 +65,9 @@ struct i2c_ram {
        char    res1[4];        /* Reserved */
        ushort  rpbase;         /* Relocation pointer */
        char    res2[2];        /* Reserved */
+       /* The following elements are only for CPM2 */
+       char    res3[4];        /* Reserved */
+       uint    sdmatmp;        /* Internal */
 };
 
 #define I2COM_START    0x80
index ebb4c0b..bffca72 100644 (file)
@@ -1917,6 +1917,7 @@ static int i801_probe(struct pci_dev *dev, const struct pci_device_id *id)
 
        pci_set_drvdata(dev, priv);
 
+       dev_pm_set_driver_flags(&dev->dev, DPM_FLAG_NO_DIRECT_COMPLETE);
        pm_runtime_set_autosuspend_delay(&dev->dev, 1000);
        pm_runtime_use_autosuspend(&dev->dev);
        pm_runtime_put_autosuspend(&dev->dev);
index dfcf04e..2ad1663 100644 (file)
@@ -2163,6 +2163,15 @@ static int npcm_i2c_master_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs,
        if (bus->cmd_err == -EAGAIN)
                ret = i2c_recover_bus(adap);
 
+       /*
+        * After any type of error, check if LAST bit is still set,
+        * due to a HW issue.
+        * It cannot be cleared without resetting the module.
+        */
+       if (bus->cmd_err &&
+           (NPCM_I2CRXF_CTL_LAST_PEC & ioread8(bus->reg + NPCM_I2CRXF_CTL)))
+               npcm_i2c_reset(bus);
+
 #if IS_ENABLED(CONFIG_I2C_SLAVE)
        /* reenable slave if it was enabled */
        if (bus->slave)
index 8dce06e..766c733 100644 (file)
@@ -177,12 +177,12 @@ static const struct iio_chan_spec ad7124_channel_template = {
 
 static struct ad7124_chip_info ad7124_chip_info_tbl[] = {
        [ID_AD7124_4] = {
-               .name = "ad7127-4",
+               .name = "ad7124-4",
                .chip_id = CHIPID_AD7124_4,
                .num_inputs = 8,
        },
        [ID_AD7124_8] = {
-               .name = "ad7127-8",
+               .name = "ad7124-8",
                .chip_id = CHIPID_AD7124_8,
                .num_inputs = 16,
        },
index b4b73c9..c10aa28 100644 (file)
@@ -982,7 +982,7 @@ static int adc5_probe(struct platform_device *pdev)
 
 static struct platform_driver adc5_driver = {
        .driver = {
-               .name = "qcom-spmi-adc5.c",
+               .name = "qcom-spmi-adc5",
                .of_match_table = adc5_match_table,
        },
        .probe = adc5_probe,
index c36b4d2..23ee65a 100644 (file)
@@ -1285,6 +1285,8 @@ static void disable_device(struct ib_device *device)
                remove_client_context(device, cid);
        }
 
+       ib_cq_pool_destroy(device);
+
        /* Pairs with refcount_set in enable_device */
        ib_device_put(device);
        wait_for_completion(&device->unreg_completion);
@@ -1328,6 +1330,8 @@ static int enable_device_and_get(struct ib_device *device)
                        goto out;
        }
 
+       ib_cq_pool_init(device);
+
        down_read(&clients_rwsem);
        xa_for_each_marked (&clients, index, client, CLIENT_REGISTERED) {
                ret = add_client_context(device, client);
@@ -1400,7 +1404,6 @@ int ib_register_device(struct ib_device *device, const char *name)
                goto dev_cleanup;
        }
 
-       ib_cq_pool_init(device);
        ret = enable_device_and_get(device);
        dev_set_uevent_suppress(&device->dev, false);
        /* Mark for userspace that device is ready */
@@ -1455,7 +1458,6 @@ static void __ib_unregister_device(struct ib_device *ib_dev)
                goto out;
 
        disable_device(ib_dev);
-       ib_cq_pool_destroy(ib_dev);
 
        /* Expedite removing unregistered pointers from the hash table */
        free_netdevs(ib_dev);
index 854d5e7..ef2fa09 100644 (file)
@@ -282,6 +282,8 @@ static int trackpoint_start_protocol(struct psmouse *psmouse,
        case TP_VARIANT_ALPS:
        case TP_VARIANT_ELAN:
        case TP_VARIANT_NXP:
+       case TP_VARIANT_JYT_SYNAPTICS:
+       case TP_VARIANT_SYNAPTICS:
                if (variant_id)
                        *variant_id = param[0];
                if (firmware_id)
index 37fb9aa..a4c9b96 100644 (file)
@@ -721,6 +721,13 @@ static const struct dmi_system_id __initconst i8042_dmi_nopnp_table[] = {
                        DMI_MATCH(DMI_BOARD_VENDOR, "MICRO-STAR INTERNATIONAL CO., LTD"),
                },
        },
+       {
+               /* Acer Aspire 5 A515 */
+               .matches = {
+                       DMI_MATCH(DMI_BOARD_NAME, "Grumpy_PK"),
+                       DMI_MATCH(DMI_BOARD_VENDOR, "PK"),
+               },
+       },
        { }
 };
 
index 445a08d..1ba6b4c 100644 (file)
@@ -1103,25 +1103,6 @@ static int __init add_early_maps(void)
        return 0;
 }
 
-/*
- * Reads the device exclusion range from ACPI and initializes the IOMMU with
- * it
- */
-static void __init set_device_exclusion_range(u16 devid, struct ivmd_header *m)
-{
-       if (!(m->flags & IVMD_FLAG_EXCL_RANGE))
-               return;
-
-       /*
-        * Treat per-device exclusion ranges as r/w unity-mapped regions
-        * since some buggy BIOSes might lead to the overwritten exclusion
-        * range (exclusion_start and exclusion_length members). This
-        * happens when there are multiple exclusion ranges (IVMD entries)
-        * defined in ACPI table.
-        */
-       m->flags = (IVMD_FLAG_IW | IVMD_FLAG_IR | IVMD_FLAG_UNITY_MAP);
-}
-
 /*
  * Takes a pointer to an AMD IOMMU entry in the ACPI table and
  * initializes the hardware and our data structures with it.
@@ -2073,30 +2054,6 @@ static void __init free_unity_maps(void)
        }
 }
 
-/* called when we find an exclusion range definition in ACPI */
-static int __init init_exclusion_range(struct ivmd_header *m)
-{
-       int i;
-
-       switch (m->type) {
-       case ACPI_IVMD_TYPE:
-               set_device_exclusion_range(m->devid, m);
-               break;
-       case ACPI_IVMD_TYPE_ALL:
-               for (i = 0; i <= amd_iommu_last_bdf; ++i)
-                       set_device_exclusion_range(i, m);
-               break;
-       case ACPI_IVMD_TYPE_RANGE:
-               for (i = m->devid; i <= m->aux; ++i)
-                       set_device_exclusion_range(i, m);
-               break;
-       default:
-               break;
-       }
-
-       return 0;
-}
-
 /* called for unity map ACPI definition */
 static int __init init_unity_map_range(struct ivmd_header *m)
 {
@@ -2107,9 +2064,6 @@ static int __init init_unity_map_range(struct ivmd_header *m)
        if (e == NULL)
                return -ENOMEM;
 
-       if (m->flags & IVMD_FLAG_EXCL_RANGE)
-               init_exclusion_range(m);
-
        switch (m->type) {
        default:
                kfree(e);
@@ -2133,6 +2087,16 @@ static int __init init_unity_map_range(struct ivmd_header *m)
        e->address_end = e->address_start + PAGE_ALIGN(m->range_length);
        e->prot = m->flags >> 1;
 
+       /*
+        * Treat per-device exclusion ranges as r/w unity-mapped regions
+        * since some buggy BIOSes might lead to the overwritten exclusion
+        * range (exclusion_start and exclusion_length members). This
+        * happens when there are multiple exclusion ranges (IVMD entries)
+        * defined in ACPI table.
+        */
+       if (m->flags & IVMD_FLAG_EXCL_RANGE)
+               e->prot = (IVMD_FLAG_IW | IVMD_FLAG_IR) >> 1;
+
        DUMP_printk("%s devid_start: %02x:%02x.%x devid_end: %02x:%02x.%x"
                    " range_start: %016llx range_end: %016llx flags: %x\n", s,
                    PCI_BUS_NUM(e->devid_start), PCI_SLOT(e->devid_start),
index bad3c0c..de324b4 100644 (file)
@@ -1295,13 +1295,17 @@ static int exynos_iommu_of_xlate(struct device *dev,
                return -ENODEV;
 
        data = platform_get_drvdata(sysmmu);
-       if (!data)
+       if (!data) {
+               put_device(&sysmmu->dev);
                return -ENODEV;
+       }
 
        if (!owner) {
                owner = kzalloc(sizeof(*owner), GFP_KERNEL);
-               if (!owner)
+               if (!owner) {
+                       put_device(&sysmmu->dev);
                        return -ENOMEM;
+               }
 
                INIT_LIST_HEAD(&owner->controllers);
                mutex_init(&owner->rpm_lock);
index 87b17ba..2239c21 100644 (file)
@@ -2664,7 +2664,7 @@ static struct dmar_domain *dmar_insert_one_dev_info(struct intel_iommu *iommu,
                }
 
                /* Setup the PASID entry for requests without PASID: */
-               spin_lock(&iommu->lock);
+               spin_lock_irqsave(&iommu->lock, flags);
                if (hw_pass_through && domain_type_is_si(domain))
                        ret = intel_pasid_setup_pass_through(iommu, domain,
                                        dev, PASID_RID2PASID);
@@ -2674,7 +2674,7 @@ static struct dmar_domain *dmar_insert_one_dev_info(struct intel_iommu *iommu,
                else
                        ret = intel_pasid_setup_second_level(iommu, domain,
                                        dev, PASID_RID2PASID);
-               spin_unlock(&iommu->lock);
+               spin_unlock_irqrestore(&iommu->lock, flags);
                if (ret) {
                        dev_err(dev, "Setup RID2PASID failed\n");
                        dmar_remove_one_dev_info(dev);
index 4a40df8..6ed05ca 100644 (file)
@@ -1724,23 +1724,6 @@ out:
        return ret;
 }
 
-static void dm_queue_split(struct mapped_device *md, struct dm_target *ti, struct bio **bio)
-{
-       unsigned len, sector_count;
-
-       sector_count = bio_sectors(*bio);
-       len = min_t(sector_t, max_io_len((*bio)->bi_iter.bi_sector, ti), sector_count);
-
-       if (sector_count > len) {
-               struct bio *split = bio_split(*bio, len, GFP_NOIO, &md->queue->bio_split);
-
-               bio_chain(split, *bio);
-               trace_block_split(md->queue, split, (*bio)->bi_iter.bi_sector);
-               submit_bio_noacct(*bio);
-               *bio = split;
-       }
-}
-
 static blk_qc_t dm_process_bio(struct mapped_device *md,
                               struct dm_table *map, struct bio *bio)
 {
@@ -1761,21 +1744,21 @@ static blk_qc_t dm_process_bio(struct mapped_device *md,
        }
 
        /*
-        * If in ->queue_bio we need to use blk_queue_split(), otherwise
+        * If in ->submit_bio we need to use blk_queue_split(), otherwise
         * queue_limits for abnormal requests (e.g. discard, writesame, etc)
         * won't be imposed.
+        * If called from dm_wq_work() for deferred bio processing, bio
+        * was already handled by following code with previous ->submit_bio.
         */
        if (current->bio_list) {
                if (is_abnormal_io(bio))
                        blk_queue_split(&bio);
-               else
-                       dm_queue_split(md, ti, &bio);
+               /* regular IO is split by __split_and_process_bio */
        }
 
        if (dm_get_md_type(md) == DM_TYPE_NVME_BIO_BASED)
                return __process_bio(md, map, bio, ti);
-       else
-               return __split_and_process_bio(md, map, bio);
+       return __split_and_process_bio(md, map, bio);
 }
 
 static blk_qc_t dm_submit_bio(struct bio *bio)
index 4efe801..926d65d 100644 (file)
@@ -1199,7 +1199,7 @@ void cec_received_msg_ts(struct cec_adapter *adap,
                        /* Cancel the pending timeout work */
                        if (!cancel_delayed_work(&data->work)) {
                                mutex_unlock(&adap->lock);
-                               flush_scheduled_work();
+                               cancel_delayed_work_sync(&data->work);
                                mutex_lock(&adap->lock);
                        }
                        /*
index f544d33..4eab6d8 100644 (file)
@@ -721,39 +721,14 @@ int vb2_verify_memory_type(struct vb2_queue *q,
 }
 EXPORT_SYMBOL(vb2_verify_memory_type);
 
-static void set_queue_consistency(struct vb2_queue *q, bool consistent_mem)
-{
-       q->dma_attrs &= ~DMA_ATTR_NON_CONSISTENT;
-
-       if (!vb2_queue_allows_cache_hints(q))
-               return;
-       if (!consistent_mem)
-               q->dma_attrs |= DMA_ATTR_NON_CONSISTENT;
-}
-
-static bool verify_consistency_attr(struct vb2_queue *q, bool consistent_mem)
-{
-       bool queue_is_consistent = !(q->dma_attrs & DMA_ATTR_NON_CONSISTENT);
-
-       if (consistent_mem != queue_is_consistent) {
-               dprintk(q, 1, "memory consistency model mismatch\n");
-               return false;
-       }
-       return true;
-}
-
 int vb2_core_reqbufs(struct vb2_queue *q, enum vb2_memory memory,
-                    unsigned int flags, unsigned int *count)
+                    unsigned int *count)
 {
        unsigned int num_buffers, allocated_buffers, num_planes = 0;
        unsigned plane_sizes[VB2_MAX_PLANES] = { };
-       bool consistent_mem = true;
        unsigned int i;
        int ret;
 
-       if (flags & V4L2_FLAG_MEMORY_NON_CONSISTENT)
-               consistent_mem = false;
-
        if (q->streaming) {
                dprintk(q, 1, "streaming active\n");
                return -EBUSY;
@@ -765,8 +740,7 @@ int vb2_core_reqbufs(struct vb2_queue *q, enum vb2_memory memory,
        }
 
        if (*count == 0 || q->num_buffers != 0 ||
-           (q->memory != VB2_MEMORY_UNKNOWN && q->memory != memory) ||
-           !verify_consistency_attr(q, consistent_mem)) {
+           (q->memory != VB2_MEMORY_UNKNOWN && q->memory != memory)) {
                /*
                 * We already have buffers allocated, so first check if they
                 * are not in use and can be freed.
@@ -803,7 +777,6 @@ int vb2_core_reqbufs(struct vb2_queue *q, enum vb2_memory memory,
        num_buffers = min_t(unsigned int, num_buffers, VB2_MAX_FRAME);
        memset(q->alloc_devs, 0, sizeof(q->alloc_devs));
        q->memory = memory;
-       set_queue_consistency(q, consistent_mem);
 
        /*
         * Ask the driver how many buffers and planes per buffer it requires.
@@ -888,18 +861,14 @@ int vb2_core_reqbufs(struct vb2_queue *q, enum vb2_memory memory,
 EXPORT_SYMBOL_GPL(vb2_core_reqbufs);
 
 int vb2_core_create_bufs(struct vb2_queue *q, enum vb2_memory memory,
-                        unsigned int flags, unsigned int *count,
+                        unsigned int *count,
                         unsigned int requested_planes,
                         const unsigned int requested_sizes[])
 {
        unsigned int num_planes = 0, num_buffers, allocated_buffers;
        unsigned plane_sizes[VB2_MAX_PLANES] = { };
-       bool consistent_mem = true;
        int ret;
 
-       if (flags & V4L2_FLAG_MEMORY_NON_CONSISTENT)
-               consistent_mem = false;
-
        if (q->num_buffers == VB2_MAX_FRAME) {
                dprintk(q, 1, "maximum number of buffers already allocated\n");
                return -ENOBUFS;
@@ -912,15 +881,12 @@ int vb2_core_create_bufs(struct vb2_queue *q, enum vb2_memory memory,
                }
                memset(q->alloc_devs, 0, sizeof(q->alloc_devs));
                q->memory = memory;
-               set_queue_consistency(q, consistent_mem);
                q->waiting_for_buffers = !q->is_output;
        } else {
                if (q->memory != memory) {
                        dprintk(q, 1, "memory model mismatch\n");
                        return -EINVAL;
                }
-               if (!verify_consistency_attr(q, consistent_mem))
-                       return -EINVAL;
        }
 
        num_buffers = min(*count, VB2_MAX_FRAME - q->num_buffers);
@@ -2581,7 +2547,7 @@ static int __vb2_init_fileio(struct vb2_queue *q, int read)
        fileio->memory = VB2_MEMORY_MMAP;
        fileio->type = q->type;
        q->fileio = fileio;
-       ret = vb2_core_reqbufs(q, fileio->memory, 0, &fileio->count);
+       ret = vb2_core_reqbufs(q, fileio->memory, &fileio->count);
        if (ret)
                goto err_kfree;
 
@@ -2638,7 +2604,7 @@ static int __vb2_init_fileio(struct vb2_queue *q, int read)
 
 err_reqbufs:
        fileio->count = 0;
-       vb2_core_reqbufs(q, fileio->memory, 0, &fileio->count);
+       vb2_core_reqbufs(q, fileio->memory, &fileio->count);
 
 err_kfree:
        q->fileio = NULL;
@@ -2658,7 +2624,7 @@ static int __vb2_cleanup_fileio(struct vb2_queue *q)
                vb2_core_streamoff(q, q->type);
                q->fileio = NULL;
                fileio->count = 0;
-               vb2_core_reqbufs(q, fileio->memory, 0, &fileio->count);
+               vb2_core_reqbufs(q, fileio->memory, &fileio->count);
                kfree(fileio);
                dprintk(q, 3, "file io emulator closed\n");
        }
index ec3446c..7b1b86e 100644 (file)
@@ -42,11 +42,6 @@ struct vb2_dc_buf {
        struct dma_buf_attachment       *db_attach;
 };
 
-static inline bool vb2_dc_buffer_consistent(unsigned long attr)
-{
-       return !(attr & DMA_ATTR_NON_CONSISTENT);
-}
-
 /*********************************************/
 /*        scatterlist table functions        */
 /*********************************************/
@@ -341,13 +336,6 @@ static int
 vb2_dc_dmabuf_ops_begin_cpu_access(struct dma_buf *dbuf,
                                   enum dma_data_direction direction)
 {
-       struct vb2_dc_buf *buf = dbuf->priv;
-       struct sg_table *sgt = buf->dma_sgt;
-
-       if (vb2_dc_buffer_consistent(buf->attrs))
-               return 0;
-
-       dma_sync_sg_for_cpu(buf->dev, sgt->sgl, sgt->nents, buf->dma_dir);
        return 0;
 }
 
@@ -355,13 +343,6 @@ static int
 vb2_dc_dmabuf_ops_end_cpu_access(struct dma_buf *dbuf,
                                 enum dma_data_direction direction)
 {
-       struct vb2_dc_buf *buf = dbuf->priv;
-       struct sg_table *sgt = buf->dma_sgt;
-
-       if (vb2_dc_buffer_consistent(buf->attrs))
-               return 0;
-
-       dma_sync_sg_for_device(buf->dev, sgt->sgl, sgt->nents, buf->dma_dir);
        return 0;
 }
 
index 0a40e00..a86fce5 100644 (file)
@@ -123,8 +123,7 @@ static void *vb2_dma_sg_alloc(struct device *dev, unsigned long dma_attrs,
        /*
         * NOTE: dma-sg allocates memory using the page allocator directly, so
         * there is no memory consistency guarantee, hence dma-sg ignores DMA
-        * attributes passed from the upper layer. That means that
-        * V4L2_FLAG_MEMORY_NON_CONSISTENT has no effect on dma-sg buffers.
+        * attributes passed from the upper layer.
         */
        buf->pages = kvmalloc_array(buf->num_pages, sizeof(struct page *),
                                    GFP_KERNEL | __GFP_ZERO);
index 30caad2..cfe197d 100644 (file)
@@ -722,22 +722,12 @@ static void fill_buf_caps(struct vb2_queue *q, u32 *caps)
 #endif
 }
 
-static void clear_consistency_attr(struct vb2_queue *q,
-                                  int memory,
-                                  unsigned int *flags)
-{
-       if (!q->allow_cache_hints || memory != V4L2_MEMORY_MMAP)
-               *flags &= ~V4L2_FLAG_MEMORY_NON_CONSISTENT;
-}
-
 int vb2_reqbufs(struct vb2_queue *q, struct v4l2_requestbuffers *req)
 {
        int ret = vb2_verify_memory_type(q, req->memory, req->type);
 
        fill_buf_caps(q, &req->capabilities);
-       clear_consistency_attr(q, req->memory, &req->flags);
-       return ret ? ret : vb2_core_reqbufs(q, req->memory,
-                                           req->flags, &req->count);
+       return ret ? ret : vb2_core_reqbufs(q, req->memory, &req->count);
 }
 EXPORT_SYMBOL_GPL(vb2_reqbufs);
 
@@ -769,7 +759,6 @@ int vb2_create_bufs(struct vb2_queue *q, struct v4l2_create_buffers *create)
        unsigned i;
 
        fill_buf_caps(q, &create->capabilities);
-       clear_consistency_attr(q, create->memory, &create->flags);
        create->index = q->num_buffers;
        if (create->count == 0)
                return ret != -EBUSY ? ret : 0;
@@ -813,7 +802,6 @@ int vb2_create_bufs(struct vb2_queue *q, struct v4l2_create_buffers *create)
                if (requested_sizes[i] == 0)
                        return -EINVAL;
        return ret ? ret : vb2_core_create_bufs(q, create->memory,
-                                               create->flags,
                                                &create->count,
                                                requested_planes,
                                                requested_sizes);
@@ -998,12 +986,11 @@ int vb2_ioctl_reqbufs(struct file *file, void *priv,
        int res = vb2_verify_memory_type(vdev->queue, p->memory, p->type);
 
        fill_buf_caps(vdev->queue, &p->capabilities);
-       clear_consistency_attr(vdev->queue, p->memory, &p->flags);
        if (res)
                return res;
        if (vb2_queue_is_busy(vdev, file))
                return -EBUSY;
-       res = vb2_core_reqbufs(vdev->queue, p->memory, p->flags, &p->count);
+       res = vb2_core_reqbufs(vdev->queue, p->memory, &p->count);
        /* If count == 0, then the owner has released all buffers and he
           is no longer owner of the queue. Otherwise we have a new owner. */
        if (res == 0)
@@ -1021,7 +1008,6 @@ int vb2_ioctl_create_bufs(struct file *file, void *priv,
 
        p->index = vdev->queue->num_buffers;
        fill_buf_caps(vdev->queue, &p->capabilities);
-       clear_consistency_attr(vdev->queue, p->memory, &p->flags);
        /*
         * If count == 0, then just check if memory and type are valid.
         * Any -EBUSY result from vb2_verify_memory_type can be mapped to 0.
index 959d110..6974f17 100644 (file)
@@ -342,7 +342,7 @@ int dvb_vb2_reqbufs(struct dvb_vb2_ctx *ctx, struct dmx_requestbuffers *req)
 
        ctx->buf_siz = req->size;
        ctx->buf_cnt = req->count;
-       ret = vb2_core_reqbufs(&ctx->vb_q, VB2_MEMORY_MMAP, 0, &req->count);
+       ret = vb2_core_reqbufs(&ctx->vb_q, VB2_MEMORY_MMAP, &req->count);
        if (ret) {
                ctx->state = DVB_VB2_STATE_NONE;
                dprintk(1, "[%s] count=%d size=%d errno=%d\n", ctx->name,
index 593bcf6..a99e82e 100644 (file)
@@ -246,9 +246,6 @@ struct v4l2_format32 {
  * @memory:    buffer memory type
  * @format:    frame format, for which buffers are requested
  * @capabilities: capabilities of this buffer type.
- * @flags:     additional buffer management attributes (ignored unless the
- *             queue has V4L2_BUF_CAP_SUPPORTS_MMAP_CACHE_HINTS capability and
- *             configured for MMAP streaming I/O).
  * @reserved:  future extensions
  */
 struct v4l2_create_buffers32 {
@@ -257,8 +254,7 @@ struct v4l2_create_buffers32 {
        __u32                   memory; /* enum v4l2_memory */
        struct v4l2_format32    format;
        __u32                   capabilities;
-       __u32                   flags;
-       __u32                   reserved[6];
+       __u32                   reserved[7];
 };
 
 static int __bufsize_v4l2_format(struct v4l2_format32 __user *p32, u32 *size)
@@ -359,8 +355,7 @@ static int get_v4l2_create32(struct v4l2_create_buffers __user *p64,
 {
        if (!access_ok(p32, sizeof(*p32)) ||
            copy_in_user(p64, p32,
-                        offsetof(struct v4l2_create_buffers32, format)) ||
-           assign_in_user(&p64->flags, &p32->flags))
+                        offsetof(struct v4l2_create_buffers32, format)))
                return -EFAULT;
        return __get_v4l2_format32(&p64->format, &p32->format,
                                   aux_buf, aux_space);
@@ -422,7 +417,6 @@ static int put_v4l2_create32(struct v4l2_create_buffers __user *p64,
            copy_in_user(p32, p64,
                         offsetof(struct v4l2_create_buffers32, format)) ||
            assign_in_user(&p32->capabilities, &p64->capabilities) ||
-           assign_in_user(&p32->flags, &p64->flags) ||
            copy_in_user(p32->reserved, p64->reserved, sizeof(p64->reserved)))
                return -EFAULT;
        return __put_v4l2_format32(&p64->format, &p32->format);
index f74b422..eeff398 100644 (file)
@@ -2042,6 +2042,9 @@ static int v4l_reqbufs(const struct v4l2_ioctl_ops *ops,
 
        if (ret)
                return ret;
+
+       CLEAR_AFTER_FIELD(p, capabilities);
+
        return ops->vidioc_reqbufs(file, fh, p);
 }
 
@@ -2081,7 +2084,7 @@ static int v4l_create_bufs(const struct v4l2_ioctl_ops *ops,
        if (ret)
                return ret;
 
-       CLEAR_AFTER_FIELD(create, flags);
+       CLEAR_AFTER_FIELD(create, capabilities);
 
        v4l_sanitize_format(&create->format);
 
index b9c7956..714d1f6 100644 (file)
@@ -1293,7 +1293,8 @@ static int exynos5_performance_counters_init(struct exynos5_dmc *dmc)
        int counters_size;
        int ret, i;
 
-       dmc->num_counters = devfreq_event_get_edev_count(dmc->dev);
+       dmc->num_counters = devfreq_event_get_edev_count(dmc->dev,
+                                                       "devfreq-events");
        if (dmc->num_counters < 0) {
                dev_err(dmc->dev, "could not get devfreq-event counters\n");
                return dmc->num_counters;
@@ -1306,7 +1307,8 @@ static int exynos5_performance_counters_init(struct exynos5_dmc *dmc)
 
        for (i = 0; i < dmc->num_counters; i++) {
                dmc->counter[i] =
-                       devfreq_event_get_edev_by_phandle(dmc->dev, i);
+                       devfreq_event_get_edev_by_phandle(dmc->dev,
+                                               "devfreq-events", i);
                if (IS_ERR_OR_NULL(dmc->counter[i]))
                        return -EPROBE_DEFER;
        }
index 693ee73..ef03d6f 100644 (file)
@@ -441,6 +441,9 @@ static void memstick_check(struct work_struct *work)
        } else if (host->card->stop)
                host->card->stop(host->card);
 
+       if (host->removing)
+               goto out_power_off;
+
        card = memstick_alloc_card(host);
 
        if (!card) {
@@ -545,6 +548,7 @@ EXPORT_SYMBOL(memstick_add_host);
  */
 void memstick_remove_host(struct memstick_host *host)
 {
+       host->removing = 1;
        flush_workqueue(workqueue);
        mutex_lock(&host->lock);
        if (host->card)
index 5055a7e..18a850f 100644 (file)
@@ -1320,7 +1320,7 @@ static void mmc_spi_dma_free(struct mmc_spi_host *host)
                         DMA_BIDIRECTIONAL);
 }
 #else
-static inline mmc_spi_dma_alloc(struct mmc_spi_host *host) { return 0; }
+static inline int mmc_spi_dma_alloc(struct mmc_spi_host *host) { return 0; }
 static inline void mmc_spi_dma_free(struct mmc_spi_host *host) {}
 #endif
 
index af41380..914f518 100644 (file)
@@ -794,7 +794,8 @@ static int byt_emmc_probe_slot(struct sdhci_pci_slot *slot)
 static bool glk_broken_cqhci(struct sdhci_pci_slot *slot)
 {
        return slot->chip->pdev->device == PCI_DEVICE_ID_INTEL_GLK_EMMC &&
-              dmi_match(DMI_BIOS_VENDOR, "LENOVO");
+              (dmi_match(DMI_BIOS_VENDOR, "LENOVO") ||
+               dmi_match(DMI_SYS_VENDOR, "IRBIS"));
 }
 
 static int glk_emmc_probe_slot(struct sdhci_pci_slot *slot)
index 8f1d15e..f5779e1 100644 (file)
@@ -932,11 +932,19 @@ static void ksz8795_port_setup(struct ksz_device *dev, int port, bool cpu_port)
        ksz_port_cfg(dev, port, P_PRIO_CTRL, PORT_802_1P_ENABLE, true);
 
        if (cpu_port) {
+               if (!p->interface && dev->compat_interface) {
+                       dev_warn(dev->dev,
+                                "Using legacy switch \"phy-mode\" property, because it is missing on port %d node. "
+                                "Please update your device tree.\n",
+                                port);
+                       p->interface = dev->compat_interface;
+               }
+
                /* Configure MII interface for proper network communication. */
                ksz_read8(dev, REG_PORT_5_CTRL_6, &data8);
                data8 &= ~PORT_INTERFACE_TYPE;
                data8 &= ~PORT_GMII_1GPS_MODE;
-               switch (dev->interface) {
+               switch (p->interface) {
                case PHY_INTERFACE_MODE_MII:
                        p->phydev.speed = SPEED_100;
                        break;
@@ -952,11 +960,11 @@ static void ksz8795_port_setup(struct ksz_device *dev, int port, bool cpu_port)
                default:
                        data8 &= ~PORT_RGMII_ID_IN_ENABLE;
                        data8 &= ~PORT_RGMII_ID_OUT_ENABLE;
-                       if (dev->interface == PHY_INTERFACE_MODE_RGMII_ID ||
-                           dev->interface == PHY_INTERFACE_MODE_RGMII_RXID)
+                       if (p->interface == PHY_INTERFACE_MODE_RGMII_ID ||
+                           p->interface == PHY_INTERFACE_MODE_RGMII_RXID)
                                data8 |= PORT_RGMII_ID_IN_ENABLE;
-                       if (dev->interface == PHY_INTERFACE_MODE_RGMII_ID ||
-                           dev->interface == PHY_INTERFACE_MODE_RGMII_TXID)
+                       if (p->interface == PHY_INTERFACE_MODE_RGMII_ID ||
+                           p->interface == PHY_INTERFACE_MODE_RGMII_TXID)
                                data8 |= PORT_RGMII_ID_OUT_ENABLE;
                        data8 |= PORT_GMII_1GPS_MODE;
                        data8 |= PORT_INTERFACE_RGMII;
@@ -1252,7 +1260,7 @@ static int ksz8795_switch_init(struct ksz_device *dev)
        }
 
        /* set the real number of ports */
-       dev->ds->num_ports = dev->port_cnt;
+       dev->ds->num_ports = dev->port_cnt + 1;
 
        return 0;
 }
index 3cb22d1..2f5506a 100644 (file)
@@ -1208,7 +1208,7 @@ static void ksz9477_port_setup(struct ksz_device *dev, int port, bool cpu_port)
 
                /* configure MAC to 1G & RGMII mode */
                ksz_pread8(dev, port, REG_PORT_XMII_CTRL_1, &data8);
-               switch (dev->interface) {
+               switch (p->interface) {
                case PHY_INTERFACE_MODE_MII:
                        ksz9477_set_xmii(dev, 0, &data8);
                        ksz9477_set_gbit(dev, false, &data8);
@@ -1229,11 +1229,11 @@ static void ksz9477_port_setup(struct ksz_device *dev, int port, bool cpu_port)
                        ksz9477_set_gbit(dev, true, &data8);
                        data8 &= ~PORT_RGMII_ID_IG_ENABLE;
                        data8 &= ~PORT_RGMII_ID_EG_ENABLE;
-                       if (dev->interface == PHY_INTERFACE_MODE_RGMII_ID ||
-                           dev->interface == PHY_INTERFACE_MODE_RGMII_RXID)
+                       if (p->interface == PHY_INTERFACE_MODE_RGMII_ID ||
+                           p->interface == PHY_INTERFACE_MODE_RGMII_RXID)
                                data8 |= PORT_RGMII_ID_IG_ENABLE;
-                       if (dev->interface == PHY_INTERFACE_MODE_RGMII_ID ||
-                           dev->interface == PHY_INTERFACE_MODE_RGMII_TXID)
+                       if (p->interface == PHY_INTERFACE_MODE_RGMII_ID ||
+                           p->interface == PHY_INTERFACE_MODE_RGMII_TXID)
                                data8 |= PORT_RGMII_ID_EG_ENABLE;
                        p->phydev.speed = SPEED_1000;
                        break;
@@ -1269,23 +1269,32 @@ static void ksz9477_config_cpu_port(struct dsa_switch *ds)
                        dev->cpu_port = i;
                        dev->host_mask = (1 << dev->cpu_port);
                        dev->port_mask |= dev->host_mask;
+                       p = &dev->ports[i];
 
                        /* Read from XMII register to determine host port
                         * interface.  If set specifically in device tree
                         * note the difference to help debugging.
                         */
                        interface = ksz9477_get_interface(dev, i);
-                       if (!dev->interface)
-                               dev->interface = interface;
-                       if (interface && interface != dev->interface)
+                       if (!p->interface) {
+                               if (dev->compat_interface) {
+                                       dev_warn(dev->dev,
+                                                "Using legacy switch \"phy-mode\" property, because it is missing on port %d node. "
+                                                "Please update your device tree.\n",
+                                                i);
+                                       p->interface = dev->compat_interface;
+                               } else {
+                                       p->interface = interface;
+                               }
+                       }
+                       if (interface && interface != p->interface)
                                dev_info(dev->dev,
                                         "use %s instead of %s\n",
-                                         phy_modes(dev->interface),
+                                         phy_modes(p->interface),
                                          phy_modes(interface));
 
                        /* enable cpu port */
                        ksz9477_port_setup(dev, i, true);
-                       p = &dev->ports[dev->cpu_port];
                        p->vid_member = dev->port_mask;
                        p->on = 1;
                }
index 8d53b12..8e755b5 100644 (file)
@@ -388,6 +388,8 @@ int ksz_switch_register(struct ksz_device *dev,
                        const struct ksz_dev_ops *ops)
 {
        phy_interface_t interface;
+       struct device_node *port;
+       unsigned int port_num;
        int ret;
 
        if (dev->pdata)
@@ -421,10 +423,19 @@ int ksz_switch_register(struct ksz_device *dev,
        /* Host port interface will be self detected, or specifically set in
         * device tree.
         */
+       for (port_num = 0; port_num < dev->port_cnt; ++port_num)
+               dev->ports[port_num].interface = PHY_INTERFACE_MODE_NA;
        if (dev->dev->of_node) {
                ret = of_get_phy_mode(dev->dev->of_node, &interface);
                if (ret == 0)
-                       dev->interface = interface;
+                       dev->compat_interface = interface;
+               for_each_available_child_of_node(dev->dev->of_node, port) {
+                       if (of_property_read_u32(port, "reg", &port_num))
+                               continue;
+                       if (port_num >= dev->port_cnt)
+                               return -EINVAL;
+                       of_get_phy_mode(port, &dev->ports[port_num].interface);
+               }
                dev->synclko_125 = of_property_read_bool(dev->dev->of_node,
                                                         "microchip,synclko-125");
        }
index 2068381..cf866e4 100644 (file)
@@ -39,6 +39,7 @@ struct ksz_port {
        u32 freeze:1;                   /* MIB counter freeze is enabled */
 
        struct ksz_port_mib mib;
+       phy_interface_t interface;
 };
 
 struct ksz_device {
@@ -72,7 +73,7 @@ struct ksz_device {
        int mib_cnt;
        int mib_port_cnt;
        int last_port;                  /* ports after that not used */
-       phy_interface_t interface;
+       phy_interface_t compat_interface;
        u32 regs_size;
        bool phy_errata_9477;
        bool synclko_125;
index 04bfa6e..01427cd 100644 (file)
@@ -585,7 +585,10 @@ static int felix_setup(struct dsa_switch *ds)
        if (err)
                return err;
 
-       ocelot_init(ocelot);
+       err = ocelot_init(ocelot);
+       if (err)
+               return err;
+
        if (ocelot->ptp) {
                err = ocelot_init_timestamp(ocelot, &ocelot_ptp_clock_info);
                if (err) {
@@ -640,10 +643,13 @@ static void felix_teardown(struct dsa_switch *ds)
 {
        struct ocelot *ocelot = ds->priv;
        struct felix *felix = ocelot_to_felix(ocelot);
+       int port;
 
        if (felix->info->mdio_bus_free)
                felix->info->mdio_bus_free(ocelot);
 
+       for (port = 0; port < ocelot->num_phys_ports; port++)
+               ocelot_deinit_port(ocelot, port);
        ocelot_deinit_timestamp(ocelot);
        /* stop workqueue thread */
        ocelot_deinit(ocelot);
index 9b720c8..6855c94 100644 (file)
@@ -645,17 +645,17 @@ static struct vcap_field vsc9959_vcap_is2_keys[] = {
        [VCAP_IS2_HK_DIP_EQ_SIP]                = {118,   1},
        /* IP4_TCP_UDP (TYPE=100) */
        [VCAP_IS2_HK_TCP]                       = {119,   1},
-       [VCAP_IS2_HK_L4_SPORT]                  = {120,  16},
-       [VCAP_IS2_HK_L4_DPORT]                  = {136,  16},
+       [VCAP_IS2_HK_L4_DPORT]                  = {120,  16},
+       [VCAP_IS2_HK_L4_SPORT]                  = {136,  16},
        [VCAP_IS2_HK_L4_RNG]                    = {152,   8},
        [VCAP_IS2_HK_L4_SPORT_EQ_DPORT]         = {160,   1},
        [VCAP_IS2_HK_L4_SEQUENCE_EQ0]           = {161,   1},
-       [VCAP_IS2_HK_L4_URG]                    = {162,   1},
-       [VCAP_IS2_HK_L4_ACK]                    = {163,   1},
-       [VCAP_IS2_HK_L4_PSH]                    = {164,   1},
-       [VCAP_IS2_HK_L4_RST]                    = {165,   1},
-       [VCAP_IS2_HK_L4_SYN]                    = {166,   1},
-       [VCAP_IS2_HK_L4_FIN]                    = {167,   1},
+       [VCAP_IS2_HK_L4_FIN]                    = {162,   1},
+       [VCAP_IS2_HK_L4_SYN]                    = {163,   1},
+       [VCAP_IS2_HK_L4_RST]                    = {164,   1},
+       [VCAP_IS2_HK_L4_PSH]                    = {165,   1},
+       [VCAP_IS2_HK_L4_ACK]                    = {166,   1},
+       [VCAP_IS2_HK_L4_URG]                    = {167,   1},
        [VCAP_IS2_HK_L4_1588_DOM]               = {168,   8},
        [VCAP_IS2_HK_L4_1588_VER]               = {176,   4},
        /* IP4_OTHER (TYPE=101) */
index 625b189..29df079 100644 (file)
@@ -659,17 +659,17 @@ static struct vcap_field vsc9953_vcap_is2_keys[] = {
        [VCAP_IS2_HK_DIP_EQ_SIP]                = {122,   1},
        /* IP4_TCP_UDP (TYPE=100) */
        [VCAP_IS2_HK_TCP]                       = {123,   1},
-       [VCAP_IS2_HK_L4_SPORT]                  = {124,  16},
-       [VCAP_IS2_HK_L4_DPORT]                  = {140,  16},
+       [VCAP_IS2_HK_L4_DPORT]                  = {124,  16},
+       [VCAP_IS2_HK_L4_SPORT]                  = {140,  16},
        [VCAP_IS2_HK_L4_RNG]                    = {156,   8},
        [VCAP_IS2_HK_L4_SPORT_EQ_DPORT]         = {164,   1},
        [VCAP_IS2_HK_L4_SEQUENCE_EQ0]           = {165,   1},
-       [VCAP_IS2_HK_L4_URG]                    = {166,   1},
-       [VCAP_IS2_HK_L4_ACK]                    = {167,   1},
-       [VCAP_IS2_HK_L4_PSH]                    = {168,   1},
-       [VCAP_IS2_HK_L4_RST]                    = {169,   1},
-       [VCAP_IS2_HK_L4_SYN]                    = {170,   1},
-       [VCAP_IS2_HK_L4_FIN]                    = {171,   1},
+       [VCAP_IS2_HK_L4_FIN]                    = {166,   1},
+       [VCAP_IS2_HK_L4_SYN]                    = {167,   1},
+       [VCAP_IS2_HK_L4_RST]                    = {168,   1},
+       [VCAP_IS2_HK_L4_PSH]                    = {169,   1},
+       [VCAP_IS2_HK_L4_ACK]                    = {170,   1},
+       [VCAP_IS2_HK_L4_URG]                    = {171,   1},
        /* IP4_OTHER (TYPE=101) */
        [VCAP_IS2_HK_IP4_L3_PROTO]              = {123,   8},
        [VCAP_IS2_HK_L3_PAYLOAD]                = {131,  56},
@@ -1008,7 +1008,7 @@ static const struct felix_info seville_info_vsc9953 = {
        .vcap_is2_keys          = vsc9953_vcap_is2_keys,
        .vcap_is2_actions       = vsc9953_vcap_is2_actions,
        .vcap                   = vsc9953_vcap_props,
-       .shared_queue_sz        = 128 * 1024,
+       .shared_queue_sz        = 2048 * 1024,
        .num_mact_rows          = 2048,
        .num_ports              = 10,
        .mdio_bus_alloc         = vsc9953_mdio_bus_alloc,
index 8f40fbf..a8c5a93 100644 (file)
@@ -452,13 +452,19 @@ int rtl8366_vlan_del(struct dsa_switch *ds, int port,
                                return ret;
 
                        if (vid == vlanmc.vid) {
-                               /* clear VLAN member configurations */
-                               vlanmc.vid = 0;
-                               vlanmc.priority = 0;
-                               vlanmc.member = 0;
-                               vlanmc.untag = 0;
-                               vlanmc.fid = 0;
-
+                               /* Remove this port from the VLAN */
+                               vlanmc.member &= ~BIT(port);
+                               vlanmc.untag &= ~BIT(port);
+                               /*
+                                * If no ports are members of this VLAN
+                                * anymore then clear the whole member
+                                * config so it can be reused.
+                                */
+                               if (!vlanmc.member && vlanmc.untag) {
+                                       vlanmc.vid = 0;
+                                       vlanmc.priority = 0;
+                                       vlanmc.fid = 0;
+                               }
                                ret = smi->ops->set_vlan_mc(smi, i, &vlanmc);
                                if (ret) {
                                        dev_err(smi->dev,
index b167066..7b7e8b7 100644 (file)
@@ -3782,6 +3782,7 @@ static int bnxt_hwrm_func_qstat_ext(struct bnxt *bp,
                return -EOPNOTSUPP;
 
        bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_FUNC_QSTATS_EXT, -1, -1);
+       req.fid = cpu_to_le16(0xffff);
        req.flags = FUNC_QSTATS_EXT_REQ_FLAGS_COUNTER_MASK;
        mutex_lock(&bp->hwrm_cmd_lock);
        rc = _hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
@@ -3852,7 +3853,7 @@ static void bnxt_init_stats(struct bnxt *bp)
                tx_masks = stats->hw_masks;
                tx_count = sizeof(struct tx_port_stats_ext) / 8;
 
-               flags = FUNC_QSTATS_EXT_REQ_FLAGS_COUNTER_MASK;
+               flags = PORT_QSTATS_EXT_REQ_FLAGS_COUNTER_MASK;
                rc = bnxt_hwrm_port_qstats_ext(bp, flags);
                if (rc) {
                        mask = (1ULL << 40) - 1;
@@ -4305,7 +4306,7 @@ static int bnxt_hwrm_do_send_msg(struct bnxt *bp, void *msg, u32 msg_len,
        u32 bar_offset = BNXT_GRCPF_REG_CHIMP_COMM;
        u16 dst = BNXT_HWRM_CHNL_CHIMP;
 
-       if (test_bit(BNXT_STATE_FW_FATAL_COND, &bp->state))
+       if (BNXT_NO_FW_ACCESS(bp))
                return -EBUSY;
 
        if (msg_len > BNXT_HWRM_MAX_REQ_LEN) {
@@ -5723,7 +5724,7 @@ static int hwrm_ring_free_send_msg(struct bnxt *bp,
        struct hwrm_ring_free_output *resp = bp->hwrm_cmd_resp_addr;
        u16 error_code;
 
-       if (test_bit(BNXT_STATE_FW_FATAL_COND, &bp->state))
+       if (BNXT_NO_FW_ACCESS(bp))
                return 0;
 
        bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_RING_FREE, cmpl_ring_id, -1);
@@ -7817,7 +7818,7 @@ static int bnxt_set_tpa(struct bnxt *bp, bool set_tpa)
 
        if (set_tpa)
                tpa_flags = bp->flags & BNXT_FLAG_TPA;
-       else if (test_bit(BNXT_STATE_FW_FATAL_COND, &bp->state))
+       else if (BNXT_NO_FW_ACCESS(bp))
                return 0;
        for (i = 0; i < bp->nr_vnics; i++) {
                rc = bnxt_hwrm_vnic_set_tpa(bp, i, tpa_flags);
@@ -9311,18 +9312,16 @@ static ssize_t bnxt_show_temp(struct device *dev,
        struct hwrm_temp_monitor_query_output *resp;
        struct bnxt *bp = dev_get_drvdata(dev);
        u32 len = 0;
+       int rc;
 
        resp = bp->hwrm_cmd_resp_addr;
        bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_TEMP_MONITOR_QUERY, -1, -1);
        mutex_lock(&bp->hwrm_cmd_lock);
-       if (!_hwrm_send_message_silent(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT))
+       rc = _hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
+       if (!rc)
                len = sprintf(buf, "%u\n", resp->temp * 1000); /* display millidegree */
        mutex_unlock(&bp->hwrm_cmd_lock);
-
-       if (len)
-               return len;
-
-       return sprintf(buf, "unknown\n");
+       return rc ?: len;
 }
 static SENSOR_DEVICE_ATTR(temp1_input, 0444, bnxt_show_temp, NULL, 0);
 
@@ -9342,7 +9341,16 @@ static void bnxt_hwmon_close(struct bnxt *bp)
 
 static void bnxt_hwmon_open(struct bnxt *bp)
 {
+       struct hwrm_temp_monitor_query_input req = {0};
        struct pci_dev *pdev = bp->pdev;
+       int rc;
+
+       bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_TEMP_MONITOR_QUERY, -1, -1);
+       rc = hwrm_send_message_silent(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
+       if (rc == -EACCES || rc == -EOPNOTSUPP) {
+               bnxt_hwmon_close(bp);
+               return;
+       }
 
        if (bp->hwmon_dev)
                return;
@@ -11779,6 +11787,10 @@ static void bnxt_remove_one(struct pci_dev *pdev)
        if (BNXT_PF(bp))
                bnxt_sriov_disable(bp);
 
+       clear_bit(BNXT_STATE_IN_FW_RESET, &bp->state);
+       bnxt_cancel_sp_work(bp);
+       bp->sp_event = 0;
+
        bnxt_dl_fw_reporters_destroy(bp, true);
        if (BNXT_PF(bp))
                devlink_port_type_clear(&bp->dl_port);
@@ -11786,9 +11798,6 @@ static void bnxt_remove_one(struct pci_dev *pdev)
        unregister_netdev(dev);
        bnxt_dl_unregister(bp);
        bnxt_shutdown_tc(bp);
-       clear_bit(BNXT_STATE_IN_FW_RESET, &bp->state);
-       bnxt_cancel_sp_work(bp);
-       bp->sp_event = 0;
 
        bnxt_clear_int_mode(bp);
        bnxt_hwrm_func_drv_unrgtr(bp);
@@ -12089,7 +12098,7 @@ static int bnxt_init_mac_addr(struct bnxt *bp)
 static void bnxt_vpd_read_info(struct bnxt *bp)
 {
        struct pci_dev *pdev = bp->pdev;
-       int i, len, pos, ro_size;
+       int i, len, pos, ro_size, size;
        ssize_t vpd_size;
        u8 *vpd_data;
 
@@ -12124,7 +12133,8 @@ static void bnxt_vpd_read_info(struct bnxt *bp)
        if (len + pos > vpd_size)
                goto read_sn;
 
-       strlcpy(bp->board_partno, &vpd_data[pos], min(len, BNXT_VPD_FLD_LEN));
+       size = min(len, BNXT_VPD_FLD_LEN - 1);
+       memcpy(bp->board_partno, &vpd_data[pos], size);
 
 read_sn:
        pos = pci_vpd_find_info_keyword(vpd_data, i, ro_size,
@@ -12137,7 +12147,8 @@ read_sn:
        if (len + pos > vpd_size)
                goto exit;
 
-       strlcpy(bp->board_serialno, &vpd_data[pos], min(len, BNXT_VPD_FLD_LEN));
+       size = min(len, BNXT_VPD_FLD_LEN - 1);
+       memcpy(bp->board_serialno, &vpd_data[pos], size);
 exit:
        kfree(vpd_data);
 }
index 5a13eb6..0ef89da 100644 (file)
@@ -1737,6 +1737,10 @@ struct bnxt {
 #define BNXT_STATE_FW_FATAL_COND       6
 #define BNXT_STATE_DRV_REGISTERED      7
 
+#define BNXT_NO_FW_ACCESS(bp)                                  \
+       (test_bit(BNXT_STATE_FW_FATAL_COND, &(bp)->state) ||    \
+        pci_channel_offline((bp)->pdev))
+
        struct bnxt_irq *irq_tbl;
        int                     total_irqs;
        u8                      mac_addr[ETH_ALEN];
index d092833..fecdfd8 100644 (file)
@@ -1322,6 +1322,9 @@ static int bnxt_get_regs_len(struct net_device *dev)
        struct bnxt *bp = netdev_priv(dev);
        int reg_len;
 
+       if (!BNXT_PF(bp))
+               return -EOPNOTSUPP;
+
        reg_len = BNXT_PXP_REG_LEN;
 
        if (bp->fw_cap & BNXT_FW_CAP_PCIE_STATS_SUPPORTED)
@@ -1788,9 +1791,12 @@ static int bnxt_set_pauseparam(struct net_device *dev,
        if (!BNXT_PHY_CFG_ABLE(bp))
                return -EOPNOTSUPP;
 
+       mutex_lock(&bp->link_lock);
        if (epause->autoneg) {
-               if (!(link_info->autoneg & BNXT_AUTONEG_SPEED))
-                       return -EINVAL;
+               if (!(link_info->autoneg & BNXT_AUTONEG_SPEED)) {
+                       rc = -EINVAL;
+                       goto pause_exit;
+               }
 
                link_info->autoneg |= BNXT_AUTONEG_FLOW_CTRL;
                if (bp->hwrm_spec_code >= 0x10201)
@@ -1811,11 +1817,11 @@ static int bnxt_set_pauseparam(struct net_device *dev,
        if (epause->tx_pause)
                link_info->req_flow_ctrl |= BNXT_LINK_PAUSE_TX;
 
-       if (netif_running(dev)) {
-               mutex_lock(&bp->link_lock);
+       if (netif_running(dev))
                rc = bnxt_hwrm_set_pause(bp);
-               mutex_unlock(&bp->link_lock);
-       }
+
+pause_exit:
+       mutex_unlock(&bp->link_lock);
        return rc;
 }
 
@@ -2552,8 +2558,7 @@ static int bnxt_set_eee(struct net_device *dev, struct ethtool_eee *edata)
        struct bnxt *bp = netdev_priv(dev);
        struct ethtool_eee *eee = &bp->eee;
        struct bnxt_link_info *link_info = &bp->link_info;
-       u32 advertising =
-                _bnxt_fw_to_ethtool_adv_spds(link_info->advertising, 0);
+       u32 advertising;
        int rc = 0;
 
        if (!BNXT_PHY_CFG_ABLE(bp))
@@ -2562,19 +2567,23 @@ static int bnxt_set_eee(struct net_device *dev, struct ethtool_eee *edata)
        if (!(bp->flags & BNXT_FLAG_EEE_CAP))
                return -EOPNOTSUPP;
 
+       mutex_lock(&bp->link_lock);
+       advertising = _bnxt_fw_to_ethtool_adv_spds(link_info->advertising, 0);
        if (!edata->eee_enabled)
                goto eee_ok;
 
        if (!(link_info->autoneg & BNXT_AUTONEG_SPEED)) {
                netdev_warn(dev, "EEE requires autoneg\n");
-               return -EINVAL;
+               rc = -EINVAL;
+               goto eee_exit;
        }
        if (edata->tx_lpi_enabled) {
                if (bp->lpi_tmr_hi && (edata->tx_lpi_timer > bp->lpi_tmr_hi ||
                                       edata->tx_lpi_timer < bp->lpi_tmr_lo)) {
                        netdev_warn(dev, "Valid LPI timer range is %d and %d microsecs\n",
                                    bp->lpi_tmr_lo, bp->lpi_tmr_hi);
-                       return -EINVAL;
+                       rc = -EINVAL;
+                       goto eee_exit;
                } else if (!bp->lpi_tmr_hi) {
                        edata->tx_lpi_timer = eee->tx_lpi_timer;
                }
@@ -2584,7 +2593,8 @@ static int bnxt_set_eee(struct net_device *dev, struct ethtool_eee *edata)
        } else if (edata->advertised & ~advertising) {
                netdev_warn(dev, "EEE advertised %x must be a subset of autoneg advertised speeds %x\n",
                            edata->advertised, advertising);
-               return -EINVAL;
+               rc = -EINVAL;
+               goto eee_exit;
        }
 
        eee->advertised = edata->advertised;
@@ -2596,6 +2606,8 @@ eee_ok:
        if (netif_running(dev))
                rc = bnxt_hwrm_set_link_setting(bp, false, true);
 
+eee_exit:
+       mutex_unlock(&bp->link_lock);
        return rc;
 }
 
index 6761f40..9179f7b 100644 (file)
@@ -647,8 +647,7 @@ static void macb_mac_link_up(struct phylink_config *config,
                                ctrl |= GEM_BIT(GBE);
                }
 
-               /* We do not support MLO_PAUSE_RX yet */
-               if (tx_pause)
+               if (rx_pause)
                        ctrl |= MACB_BIT(PAE);
 
                macb_set_tx_clk(bp->tx_clk, speed, ndev);
index 650db92..4814985 100644 (file)
@@ -1911,13 +1911,16 @@ out:
 static int configure_filter_tcb(struct adapter *adap, unsigned int tid,
                                struct filter_entry *f)
 {
-       if (f->fs.hitcnts)
+       if (f->fs.hitcnts) {
                set_tcb_field(adap, f, tid, TCB_TIMESTAMP_W,
-                             TCB_TIMESTAMP_V(TCB_TIMESTAMP_M) |
+                             TCB_TIMESTAMP_V(TCB_TIMESTAMP_M),
+                             TCB_TIMESTAMP_V(0ULL),
+                             1);
+               set_tcb_field(adap, f, tid, TCB_RTT_TS_RECENT_AGE_W,
                              TCB_RTT_TS_RECENT_AGE_V(TCB_RTT_TS_RECENT_AGE_M),
-                             TCB_TIMESTAMP_V(0ULL) |
                              TCB_RTT_TS_RECENT_AGE_V(0ULL),
                              1);
+       }
 
        if (f->fs.newdmac)
                set_tcb_tflag(adap, f, tid, TF_CCTRL_ECE_S, 1,
index b1a073e..a020e84 100644 (file)
@@ -229,7 +229,7 @@ void cxgb4_free_mps_ref_entries(struct adapter *adap)
 {
        struct mps_entries_ref *mps_entry, *tmp;
 
-       if (!list_empty(&adap->mps_ref))
+       if (list_empty(&adap->mps_ref))
                return;
 
        spin_lock(&adap->mps_ref_lock);
index cb116b5..2610efe 100644 (file)
@@ -85,7 +85,7 @@ MODULE_PARM_DESC (rx_copybreak, "de2104x Breakpoint at which Rx packets are copi
 #define DSL                    CONFIG_DE2104X_DSL
 #endif
 
-#define DE_RX_RING_SIZE                64
+#define DE_RX_RING_SIZE                128
 #define DE_TX_RING_SIZE                64
 #define DE_RING_BYTES          \
                ((sizeof(struct de_desc) * DE_RX_RING_SIZE) +   \
index 3ea51dd..a24b20f 100644 (file)
@@ -66,8 +66,8 @@ struct dpmac_cmd_get_counter {
 };
 
 struct dpmac_rsp_get_counter {
-       u64 pad;
-       u64 counter;
+       __le64 pad;
+       __le64 counter;
 };
 
 #endif /* _FSL_DPMAC_CMD_H */
index 26d5981..177334f 100644 (file)
@@ -1053,7 +1053,6 @@ static int enetc_pf_probe(struct pci_dev *pdev,
 
 err_reg_netdev:
        enetc_teardown_serdes(priv);
-       enetc_mdio_remove(pf);
        enetc_free_msix(priv);
 err_alloc_msix:
        enetc_free_si_resources(priv);
@@ -1061,6 +1060,7 @@ err_alloc_si_res:
        si->ndev = NULL;
        free_netdev(ndev);
 err_alloc_netdev:
+       enetc_mdio_remove(pf);
        enetc_of_put_phy(pf);
 err_map_pf_space:
        enetc_pci_remove(pdev);
index ed3829a..a769273 100644 (file)
@@ -334,7 +334,7 @@ static void hns_dsaf_xge_srst_by_port_acpi(struct dsaf_device *dsaf_dev,
  * bit6-11 for ppe0-5
  * bit12-17 for roce0-5
  * bit18-19 for com/dfx
- * @enable: false - request reset , true - drop reset
+ * @dereset: false - request reset , true - drop reset
  */
 static void
 hns_dsaf_srst_chns(struct dsaf_device *dsaf_dev, u32 msk, bool dereset)
@@ -357,7 +357,7 @@ hns_dsaf_srst_chns(struct dsaf_device *dsaf_dev, u32 msk, bool dereset)
  * bit6-11 for ppe0-5
  * bit12-17 for roce0-5
  * bit18-19 for com/dfx
- * @enable: false - request reset , true - drop reset
+ * @dereset: false - request reset , true - drop reset
  */
 static void
 hns_dsaf_srst_chns_acpi(struct dsaf_device *dsaf_dev, u32 msk, bool dereset)
index 4eb5029..14e60c9 100644 (file)
@@ -463,8 +463,8 @@ static int __lb_clean_rings(struct hns_nic_priv *priv,
 
 /**
  * nic_run_loopback_test -  run loopback test
- * @nic_dev: net device
- * @loopback_type: loopback type
+ * @ndev: net device
+ * @loop_mode: loopback mode
  */
 static int __lb_run_test(struct net_device *ndev,
                         enum hnae_loop loop_mode)
@@ -572,7 +572,7 @@ static int __lb_down(struct net_device *ndev, enum hnae_loop loop)
 
 /**
  * hns_nic_self_test - self test
- * @dev: net device
+ * @ndev: net device
  * @eth_test: test cmd
  * @data: test result
  */
@@ -633,7 +633,7 @@ static void hns_nic_self_test(struct net_device *ndev,
 
 /**
  * hns_nic_get_drvinfo - get net driver info
- * @dev: net device
+ * @net_dev: net device
  * @drvinfo: driver info
  */
 static void hns_nic_get_drvinfo(struct net_device *net_dev,
@@ -658,7 +658,7 @@ static void hns_nic_get_drvinfo(struct net_device *net_dev,
 
 /**
  * hns_get_ringparam - get ring parameter
- * @dev: net device
+ * @net_dev: net device
  * @param: ethtool parameter
  */
 static void hns_get_ringparam(struct net_device *net_dev,
@@ -683,7 +683,7 @@ static void hns_get_ringparam(struct net_device *net_dev,
 
 /**
  * hns_get_pauseparam - get pause parameter
- * @dev: net device
+ * @net_dev: net device
  * @param: pause parameter
  */
 static void hns_get_pauseparam(struct net_device *net_dev,
@@ -701,7 +701,7 @@ static void hns_get_pauseparam(struct net_device *net_dev,
 
 /**
  * hns_set_pauseparam - set pause parameter
- * @dev: net device
+ * @net_dev: net device
  * @param: pause parameter
  *
  * Return 0 on success, negative on failure
@@ -725,7 +725,7 @@ static int hns_set_pauseparam(struct net_device *net_dev,
 
 /**
  * hns_get_coalesce - get coalesce info.
- * @dev: net device
+ * @net_dev: net device
  * @ec: coalesce info.
  *
  * Return 0 on success, negative on failure.
@@ -769,7 +769,7 @@ static int hns_get_coalesce(struct net_device *net_dev,
 
 /**
  * hns_set_coalesce - set coalesce info.
- * @dev: net device
+ * @net_dev: net device
  * @ec: coalesce info.
  *
  * Return 0 on success, negative on failure.
@@ -808,7 +808,7 @@ static int hns_set_coalesce(struct net_device *net_dev,
 
 /**
  * hns_get_channels - get channel info.
- * @dev: net device
+ * @net_dev: net device
  * @ch: channel info.
  */
 static void
@@ -825,7 +825,7 @@ hns_get_channels(struct net_device *net_dev, struct ethtool_channels *ch)
 
 /**
  * get_ethtool_stats - get detail statistics.
- * @dev: net device
+ * @netdev: net device
  * @stats: statistics info.
  * @data: statistics data.
  */
@@ -883,8 +883,8 @@ static void hns_get_ethtool_stats(struct net_device *netdev,
 
 /**
  * get_strings: Return a set of strings that describe the requested objects
- * @dev: net device
- * @stats: string set ID.
+ * @netdev: net device
+ * @stringset: string set ID.
  * @data: objects data.
  */
 static void hns_get_strings(struct net_device *netdev, u32 stringset, u8 *data)
@@ -972,7 +972,7 @@ static void hns_get_strings(struct net_device *netdev, u32 stringset, u8 *data)
 
 /**
  * nic_get_sset_count - get string set count witch returned by nic_get_strings.
- * @dev: net device
+ * @netdev: net device
  * @stringset: string set index, 0: self test string; 1: statistics string.
  *
  * Return string set count.
@@ -1006,7 +1006,7 @@ static int hns_get_sset_count(struct net_device *netdev, int stringset)
 
 /**
  * hns_phy_led_set - set phy LED status.
- * @dev: net device
+ * @netdev: net device
  * @value: LED state.
  *
  * Return 0 on success, negative on failure.
@@ -1028,7 +1028,7 @@ static int hns_phy_led_set(struct net_device *netdev, int value)
 
 /**
  * nic_set_phys_id - set phy identify LED.
- * @dev: net device
+ * @netdev: net device
  * @state: LED state.
  *
  * Return 0 on success, negative on failure.
@@ -1104,9 +1104,9 @@ hns_set_phys_id(struct net_device *netdev, enum ethtool_phys_id_state state)
 
 /**
  * hns_get_regs - get net device register
- * @dev: net device
+ * @net_dev: net device
  * @cmd: ethtool cmd
- * @date: register data
+ * @data: register data
  */
 static void hns_get_regs(struct net_device *net_dev, struct ethtool_regs *cmd,
                         void *data)
@@ -1126,7 +1126,7 @@ static void hns_get_regs(struct net_device *net_dev, struct ethtool_regs *cmd,
 
 /**
  * nic_get_regs_len - get total register len.
- * @dev: net device
+ * @net_dev: net device
  *
  * Return total register len.
  */
@@ -1151,7 +1151,7 @@ static int hns_get_regs_len(struct net_device *net_dev)
 
 /**
  * hns_nic_nway_reset - nway reset
- * @dev: net device
+ * @netdev: net device
  *
  * Return 0 on success, negative on failure
  */
index 6bb65ad..c340d9a 100644 (file)
@@ -1654,6 +1654,7 @@ static void hinic_diag_test(struct net_device *netdev,
        }
 
        netif_carrier_off(netdev);
+       netif_tx_disable(netdev);
 
        err = do_lp_test(nic_dev, eth_test->flags, LP_DEFAULT_TIME,
                         &test_index);
@@ -1662,9 +1663,12 @@ static void hinic_diag_test(struct net_device *netdev,
                data[test_index] = 1;
        }
 
+       netif_tx_wake_all_queues(netdev);
+
        err = hinic_port_link_state(nic_dev, &link_state);
        if (!err && link_state == HINIC_LINK_STATE_UP)
                netif_carrier_on(netdev);
+
 }
 
 static int hinic_set_phys_id(struct net_device *netdev,
index c6ce596..2ebae6c 100644 (file)
 
 #define MGMT_MSG_TIMEOUT                5000
 
+#define SET_FUNC_PORT_MBOX_TIMEOUT     30000
+
 #define SET_FUNC_PORT_MGMT_TIMEOUT     25000
 
+#define UPDATE_FW_MGMT_TIMEOUT         20000
+
 #define mgmt_to_pfhwdev(pf_mgmt)        \
                container_of(pf_mgmt, struct hinic_pfhwdev, pf_to_mgmt)
 
@@ -361,16 +365,22 @@ int hinic_msg_to_mgmt(struct hinic_pf_to_mgmt *pf_to_mgmt,
                return -EINVAL;
        }
 
-       if (cmd == HINIC_PORT_CMD_SET_FUNC_STATE)
-               timeout = SET_FUNC_PORT_MGMT_TIMEOUT;
+       if (HINIC_IS_VF(hwif)) {
+               if (cmd == HINIC_PORT_CMD_SET_FUNC_STATE)
+                       timeout = SET_FUNC_PORT_MBOX_TIMEOUT;
 
-       if (HINIC_IS_VF(hwif))
                return hinic_mbox_to_pf(pf_to_mgmt->hwdev, mod, cmd, buf_in,
-                                       in_size, buf_out, out_size, 0);
-       else
+                                       in_size, buf_out, out_size, timeout);
+       } else {
+               if (cmd == HINIC_PORT_CMD_SET_FUNC_STATE)
+                       timeout = SET_FUNC_PORT_MGMT_TIMEOUT;
+               else if (cmd == HINIC_PORT_CMD_UPDATE_FW)
+                       timeout = UPDATE_FW_MGMT_TIMEOUT;
+
                return msg_to_mgmt_sync(pf_to_mgmt, mod, cmd, buf_in, in_size,
                                buf_out, out_size, MGMT_DIRECT_SEND,
                                MSG_NOT_RESP, timeout);
+       }
 }
 
 static void recv_mgmt_msg_work_handler(struct work_struct *work)
index 501056f..28581bd 100644 (file)
@@ -174,6 +174,24 @@ err_init_txq:
        return err;
 }
 
+static void enable_txqs_napi(struct hinic_dev *nic_dev)
+{
+       int num_txqs = hinic_hwdev_num_qps(nic_dev->hwdev);
+       int i;
+
+       for (i = 0; i < num_txqs; i++)
+               napi_enable(&nic_dev->txqs[i].napi);
+}
+
+static void disable_txqs_napi(struct hinic_dev *nic_dev)
+{
+       int num_txqs = hinic_hwdev_num_qps(nic_dev->hwdev);
+       int i;
+
+       for (i = 0; i < num_txqs; i++)
+               napi_disable(&nic_dev->txqs[i].napi);
+}
+
 /**
  * free_txqs - Free the Logical Tx Queues of specific NIC device
  * @nic_dev: the specific NIC device
@@ -400,6 +418,8 @@ int hinic_open(struct net_device *netdev)
                goto err_create_txqs;
        }
 
+       enable_txqs_napi(nic_dev);
+
        err = create_rxqs(nic_dev);
        if (err) {
                netif_err(nic_dev, drv, netdev,
@@ -484,6 +504,7 @@ err_port_state:
        }
 
 err_create_rxqs:
+       disable_txqs_napi(nic_dev);
        free_txqs(nic_dev);
 
 err_create_txqs:
@@ -497,6 +518,9 @@ int hinic_close(struct net_device *netdev)
        struct hinic_dev *nic_dev = netdev_priv(netdev);
        unsigned int flags;
 
+       /* Disable txq napi firstly to aviod rewaking txq in free_tx_poll */
+       disable_txqs_napi(nic_dev);
+
        down(&nic_dev->mgmt_lock);
 
        flags = nic_dev->flags;
index 5bee951..d0072f5 100644 (file)
@@ -543,18 +543,25 @@ static int rx_request_irq(struct hinic_rxq *rxq)
        if (err) {
                netif_err(nic_dev, drv, rxq->netdev,
                          "Failed to set RX interrupt coalescing attribute\n");
-               rx_del_napi(rxq);
-               return err;
+               goto err_req_irq;
        }
 
        err = request_irq(rq->irq, rx_irq, 0, rxq->irq_name, rxq);
-       if (err) {
-               rx_del_napi(rxq);
-               return err;
-       }
+       if (err)
+               goto err_req_irq;
 
        cpumask_set_cpu(qp->q_id % num_online_cpus(), &rq->affinity_mask);
-       return irq_set_affinity_hint(rq->irq, &rq->affinity_mask);
+       err = irq_set_affinity_hint(rq->irq, &rq->affinity_mask);
+       if (err)
+               goto err_irq_affinity;
+
+       return 0;
+
+err_irq_affinity:
+       free_irq(rq->irq, rxq);
+err_req_irq:
+       rx_del_napi(rxq);
+       return err;
 }
 
 static void rx_free_irq(struct hinic_rxq *rxq)
index a97498e..c1f81e9 100644 (file)
@@ -717,8 +717,8 @@ static int free_tx_poll(struct napi_struct *napi, int budget)
                netdev_txq = netdev_get_tx_queue(txq->netdev, qp->q_id);
 
                __netif_tx_lock(netdev_txq, smp_processor_id());
-
-               netif_wake_subqueue(nic_dev->netdev, qp->q_id);
+               if (!netif_testing(nic_dev->netdev))
+                       netif_wake_subqueue(nic_dev->netdev, qp->q_id);
 
                __netif_tx_unlock(netdev_txq);
 
@@ -745,18 +745,6 @@ static int free_tx_poll(struct napi_struct *napi, int budget)
        return budget;
 }
 
-static void tx_napi_add(struct hinic_txq *txq, int weight)
-{
-       netif_napi_add(txq->netdev, &txq->napi, free_tx_poll, weight);
-       napi_enable(&txq->napi);
-}
-
-static void tx_napi_del(struct hinic_txq *txq)
-{
-       napi_disable(&txq->napi);
-       netif_napi_del(&txq->napi);
-}
-
 static irqreturn_t tx_irq(int irq, void *data)
 {
        struct hinic_txq *txq = data;
@@ -790,7 +778,7 @@ static int tx_request_irq(struct hinic_txq *txq)
 
        qp = container_of(sq, struct hinic_qp, sq);
 
-       tx_napi_add(txq, nic_dev->tx_weight);
+       netif_napi_add(txq->netdev, &txq->napi, free_tx_poll, nic_dev->tx_weight);
 
        hinic_hwdev_msix_set(nic_dev->hwdev, sq->msix_entry,
                             TX_IRQ_NO_PENDING, TX_IRQ_NO_COALESC,
@@ -807,14 +795,14 @@ static int tx_request_irq(struct hinic_txq *txq)
        if (err) {
                netif_err(nic_dev, drv, txq->netdev,
                          "Failed to set TX interrupt coalescing attribute\n");
-               tx_napi_del(txq);
+               netif_napi_del(&txq->napi);
                return err;
        }
 
        err = request_irq(sq->irq, tx_irq, 0, txq->irq_name, txq);
        if (err) {
                dev_err(&pdev->dev, "Failed to request Tx irq\n");
-               tx_napi_del(txq);
+               netif_napi_del(&txq->napi);
                return err;
        }
 
@@ -826,7 +814,7 @@ static void tx_free_irq(struct hinic_txq *txq)
        struct hinic_sq *sq = txq->sq;
 
        free_irq(sq->irq, txq);
-       tx_napi_del(txq);
+       netif_napi_del(&txq->napi);
 }
 
 /**
index d3a7743..1b702a4 100644 (file)
@@ -2032,16 +2032,18 @@ static int do_reset(struct ibmvnic_adapter *adapter,
 
                } else {
                        rc = reset_tx_pools(adapter);
-                       if (rc)
+                       if (rc) {
                                netdev_dbg(adapter->netdev, "reset tx pools failed (%d)\n",
                                                rc);
                                goto out;
+                       }
 
                        rc = reset_rx_pools(adapter);
-                       if (rc)
+                       if (rc) {
                                netdev_dbg(adapter->netdev, "reset rx pools failed (%d)\n",
                                                rc);
                                goto out;
+                       }
                }
                ibmvnic_disable_irqs(adapter);
        }
index 8e133d6..47bfb2e 100644 (file)
@@ -1115,7 +1115,7 @@ static int i40e_quiesce_vf_pci(struct i40e_vf *vf)
 static int i40e_getnum_vf_vsi_vlan_filters(struct i40e_vsi *vsi)
 {
        struct i40e_mac_filter *f;
-       int num_vlans = 0, bkt;
+       u16 num_vlans = 0, bkt;
 
        hash_for_each(vsi->mac_filter_hash, bkt, f, hlist) {
                if (f->vlan >= 0 && f->vlan <= I40E_MAX_VLANID)
@@ -1134,8 +1134,8 @@ static int i40e_getnum_vf_vsi_vlan_filters(struct i40e_vsi *vsi)
  *
  * Called to get number of VLANs and VLAN list present in mac_filter_hash.
  **/
-static void i40e_get_vlan_list_sync(struct i40e_vsi *vsi, int *num_vlans,
-                                          s16 **vlan_list)
+static void i40e_get_vlan_list_sync(struct i40e_vsi *vsi, u16 *num_vlans,
+                                   s16 **vlan_list)
 {
        struct i40e_mac_filter *f;
        int i = 0;
@@ -1169,11 +1169,11 @@ err:
  **/
 static i40e_status
 i40e_set_vsi_promisc(struct i40e_vf *vf, u16 seid, bool multi_enable,
-                    bool unicast_enable, s16 *vl, int num_vlans)
+                    bool unicast_enable, s16 *vl, u16 num_vlans)
 {
+       i40e_status aq_ret, aq_tmp = 0;
        struct i40e_pf *pf = vf->pf;
        struct i40e_hw *hw = &pf->hw;
-       i40e_status aq_ret;
        int i;
 
        /* No VLAN to set promisc on, set on VSI */
@@ -1222,6 +1222,9 @@ i40e_set_vsi_promisc(struct i40e_vf *vf, u16 seid, bool multi_enable,
                                vf->vf_id,
                                i40e_stat_str(&pf->hw, aq_ret),
                                i40e_aq_str(&pf->hw, aq_err));
+
+                       if (!aq_tmp)
+                               aq_tmp = aq_ret;
                }
 
                aq_ret = i40e_aq_set_vsi_uc_promisc_on_vlan(hw, seid,
@@ -1235,8 +1238,15 @@ i40e_set_vsi_promisc(struct i40e_vf *vf, u16 seid, bool multi_enable,
                                vf->vf_id,
                                i40e_stat_str(&pf->hw, aq_ret),
                                i40e_aq_str(&pf->hw, aq_err));
+
+                       if (!aq_tmp)
+                               aq_tmp = aq_ret;
                }
        }
+
+       if (aq_tmp)
+               aq_ret = aq_tmp;
+
        return aq_ret;
 }
 
@@ -1258,7 +1268,7 @@ static i40e_status i40e_config_vf_promiscuous_mode(struct i40e_vf *vf,
        i40e_status aq_ret = I40E_SUCCESS;
        struct i40e_pf *pf = vf->pf;
        struct i40e_vsi *vsi;
-       int num_vlans;
+       u16 num_vlans;
        s16 *vl;
 
        vsi = i40e_find_vsi_from_id(pf, vsi_id);
index 3070dfd..2d566f3 100644 (file)
@@ -299,18 +299,14 @@ extern char igc_driver_name[];
 #define IGC_RX_HDR_LEN                 IGC_RXBUFFER_256
 
 /* Transmit and receive latency (for PTP timestamps) */
-/* FIXME: These values were estimated using the ones that i225 has as
- * basis, they seem to provide good numbers with ptp4l/phc2sys, but we
- * need to confirm them.
- */
-#define IGC_I225_TX_LATENCY_10         9542
-#define IGC_I225_TX_LATENCY_100                1024
-#define IGC_I225_TX_LATENCY_1000       178
-#define IGC_I225_TX_LATENCY_2500       64
-#define IGC_I225_RX_LATENCY_10         20662
-#define IGC_I225_RX_LATENCY_100                2213
-#define IGC_I225_RX_LATENCY_1000       448
-#define IGC_I225_RX_LATENCY_2500       160
+#define IGC_I225_TX_LATENCY_10         240
+#define IGC_I225_TX_LATENCY_100                58
+#define IGC_I225_TX_LATENCY_1000       80
+#define IGC_I225_TX_LATENCY_2500       1325
+#define IGC_I225_RX_LATENCY_10         6450
+#define IGC_I225_RX_LATENCY_100                185
+#define IGC_I225_RX_LATENCY_1000       300
+#define IGC_I225_RX_LATENCY_2500       1485
 
 /* RX and TX descriptor control thresholds.
  * PTHRESH - MAC will consider prefetch if it has fewer than this number of
index 36c9992..6a9b510 100644 (file)
@@ -364,6 +364,7 @@ static void igc_ptp_tx_hwtstamp(struct igc_adapter *adapter)
        struct sk_buff *skb = adapter->ptp_tx_skb;
        struct skb_shared_hwtstamps shhwtstamps;
        struct igc_hw *hw = &adapter->hw;
+       int adjust = 0;
        u64 regval;
 
        if (WARN_ON_ONCE(!skb))
@@ -373,6 +374,24 @@ static void igc_ptp_tx_hwtstamp(struct igc_adapter *adapter)
        regval |= (u64)rd32(IGC_TXSTMPH) << 32;
        igc_ptp_systim_to_hwtstamp(adapter, &shhwtstamps, regval);
 
+       switch (adapter->link_speed) {
+       case SPEED_10:
+               adjust = IGC_I225_TX_LATENCY_10;
+               break;
+       case SPEED_100:
+               adjust = IGC_I225_TX_LATENCY_100;
+               break;
+       case SPEED_1000:
+               adjust = IGC_I225_TX_LATENCY_1000;
+               break;
+       case SPEED_2500:
+               adjust = IGC_I225_TX_LATENCY_2500;
+               break;
+       }
+
+       shhwtstamps.hwtstamp =
+               ktime_add_ns(shhwtstamps.hwtstamp, adjust);
+
        /* Clear the lock early before calling skb_tstamp_tx so that
         * applications are not woken up before the lock bit is clear. We use
         * a copy of the skb pointer to ensure other threads can't change it
index 1645e4e..635ff3a 100644 (file)
@@ -230,8 +230,8 @@ static int xrx200_poll_rx(struct napi_struct *napi, int budget)
        }
 
        if (rx < budget) {
-               napi_complete(&ch->napi);
-               ltq_dma_enable_irq(&ch->dma);
+               if (napi_complete_done(&ch->napi, rx))
+                       ltq_dma_enable_irq(&ch->dma);
        }
 
        return rx;
@@ -268,9 +268,12 @@ static int xrx200_tx_housekeeping(struct napi_struct *napi, int budget)
        net_dev->stats.tx_bytes += bytes;
        netdev_completed_queue(ch->priv->net_dev, pkts, bytes);
 
+       if (netif_queue_stopped(net_dev))
+               netif_wake_queue(net_dev);
+
        if (pkts < budget) {
-               napi_complete(&ch->napi);
-               ltq_dma_enable_irq(&ch->dma);
+               if (napi_complete_done(&ch->napi, pkts))
+                       ltq_dma_enable_irq(&ch->dma);
        }
 
        return pkts;
@@ -342,10 +345,12 @@ static irqreturn_t xrx200_dma_irq(int irq, void *ptr)
 {
        struct xrx200_chan *ch = ptr;
 
-       ltq_dma_disable_irq(&ch->dma);
-       ltq_dma_ack_irq(&ch->dma);
+       if (napi_schedule_prep(&ch->napi)) {
+               __napi_schedule(&ch->napi);
+               ltq_dma_disable_irq(&ch->dma);
+       }
 
-       napi_schedule(&ch->napi);
+       ltq_dma_ack_irq(&ch->dma);
 
        return IRQ_HANDLED;
 }
@@ -499,7 +504,7 @@ static int xrx200_probe(struct platform_device *pdev)
 
        /* setup NAPI */
        netif_napi_add(net_dev, &priv->chan_rx.napi, xrx200_poll_rx, 32);
-       netif_napi_add(net_dev, &priv->chan_tx.napi, xrx200_tx_housekeeping, 32);
+       netif_tx_napi_add(net_dev, &priv->chan_tx.napi, xrx200_tx_housekeeping, 32);
 
        platform_set_drvdata(pdev, priv);
 
index dfcb176..c4345e3 100644 (file)
@@ -2029,11 +2029,11 @@ mvneta_xdp_put_buff(struct mvneta_port *pp, struct mvneta_rx_queue *rxq,
        struct skb_shared_info *sinfo = xdp_get_shared_info_from_buff(xdp);
        int i;
 
-       page_pool_put_page(rxq->page_pool, virt_to_head_page(xdp->data),
-                          sync_len, napi);
        for (i = 0; i < sinfo->nr_frags; i++)
                page_pool_put_full_page(rxq->page_pool,
                                        skb_frag_page(&sinfo->frags[i]), napi);
+       page_pool_put_page(rxq->page_pool, virt_to_head_page(xdp->data),
+                          sync_len, napi);
 }
 
 static int
@@ -2383,8 +2383,12 @@ static int mvneta_rx_swbm(struct napi_struct *napi,
                        mvneta_swbm_rx_frame(pp, rx_desc, rxq, &xdp_buf,
                                             &size, page, &ps);
                } else {
-                       if (unlikely(!xdp_buf.data_hard_start))
+                       if (unlikely(!xdp_buf.data_hard_start)) {
+                               rx_desc->buf_phys_addr = 0;
+                               page_pool_put_full_page(rxq->page_pool, page,
+                                                       true);
                                continue;
+                       }
 
                        mvneta_swbm_add_rx_fragment(pp, rx_desc, rxq, &xdp_buf,
                                                    &size, page);
index 0cc2080..90d5caa 100644 (file)
@@ -600,7 +600,7 @@ struct mlx5e_rq {
        struct dim         dim; /* Dynamic Interrupt Moderation */
 
        /* XDP */
-       struct bpf_prog       *xdp_prog;
+       struct bpf_prog __rcu *xdp_prog;
        struct mlx5e_xdpsq    *xdpsq;
        DECLARE_BITMAP(flags, 8);
        struct page_pool      *page_pool;
@@ -1005,7 +1005,6 @@ int mlx5e_update_nic_rx(struct mlx5e_priv *priv);
 void mlx5e_update_carrier(struct mlx5e_priv *priv);
 int mlx5e_close(struct net_device *netdev);
 int mlx5e_open(struct net_device *netdev);
-void mlx5e_update_ndo_stats(struct mlx5e_priv *priv);
 
 void mlx5e_queue_update_stats(struct mlx5e_priv *priv);
 int mlx5e_bits_invert(unsigned long a, int size);
index 8fe8b4d..254c847 100644 (file)
@@ -51,7 +51,7 @@ static void mlx5e_monitor_counters_work(struct work_struct *work)
                                               monitor_counters_work);
 
        mutex_lock(&priv->state_lock);
-       mlx5e_update_ndo_stats(priv);
+       mlx5e_stats_update_ndo_stats(priv);
        mutex_unlock(&priv->state_lock);
        mlx5e_monitor_counter_arm(priv);
 }
index 5de1cb9..96608db 100644 (file)
@@ -490,11 +490,8 @@ bool mlx5e_fec_in_caps(struct mlx5_core_dev *dev, int fec_policy)
        int err;
        int i;
 
-       if (!MLX5_CAP_GEN(dev, pcam_reg))
-               return -EOPNOTSUPP;
-
-       if (!MLX5_CAP_PCAM_REG(dev, pplm))
-               return -EOPNOTSUPP;
+       if (!MLX5_CAP_GEN(dev, pcam_reg) || !MLX5_CAP_PCAM_REG(dev, pplm))
+               return false;
 
        MLX5_SET(pplm_reg, in, local_port, 1);
        err =  mlx5_core_access_reg(dev, in, sz, out, sz, MLX5_REG_PPLM, 0, 0);
index c6bc922..bc5f72e 100644 (file)
@@ -699,6 +699,7 @@ mlx5_tc_ct_entry_add_rule(struct mlx5_tc_ct_priv *ct_priv,
 err_rule:
        mlx5e_mod_hdr_detach(ct_priv->esw->dev,
                             &esw->offloads.mod_hdr, zone_rule->mh);
+       mapping_remove(ct_priv->labels_mapping, attr->ct_attr.ct_labels_id);
 err_mod_hdr:
        kfree(spec);
        return err;
@@ -958,12 +959,22 @@ mlx5_tc_ct_add_no_trk_match(struct mlx5e_priv *priv,
        return 0;
 }
 
+void mlx5_tc_ct_match_del(struct mlx5e_priv *priv, struct mlx5_ct_attr *ct_attr)
+{
+       struct mlx5_tc_ct_priv *ct_priv = mlx5_tc_ct_get_ct_priv(priv);
+
+       if (!ct_priv || !ct_attr->ct_labels_id)
+               return;
+
+       mapping_remove(ct_priv->labels_mapping, ct_attr->ct_labels_id);
+}
+
 int
-mlx5_tc_ct_parse_match(struct mlx5e_priv *priv,
-                      struct mlx5_flow_spec *spec,
-                      struct flow_cls_offload *f,
-                      struct mlx5_ct_attr *ct_attr,
-                      struct netlink_ext_ack *extack)
+mlx5_tc_ct_match_add(struct mlx5e_priv *priv,
+                    struct mlx5_flow_spec *spec,
+                    struct flow_cls_offload *f,
+                    struct mlx5_ct_attr *ct_attr,
+                    struct netlink_ext_ack *extack)
 {
        struct mlx5_tc_ct_priv *ct_priv = mlx5_tc_ct_get_ct_priv(priv);
        struct flow_rule *rule = flow_cls_offload_flow_rule(f);
index 3baef91..708c216 100644 (file)
@@ -87,12 +87,15 @@ mlx5_tc_ct_init(struct mlx5_rep_uplink_priv *uplink_priv);
 void
 mlx5_tc_ct_clean(struct mlx5_rep_uplink_priv *uplink_priv);
 
+void
+mlx5_tc_ct_match_del(struct mlx5e_priv *priv, struct mlx5_ct_attr *ct_attr);
+
 int
-mlx5_tc_ct_parse_match(struct mlx5e_priv *priv,
-                      struct mlx5_flow_spec *spec,
-                      struct flow_cls_offload *f,
-                      struct mlx5_ct_attr *ct_attr,
-                      struct netlink_ext_ack *extack);
+mlx5_tc_ct_match_add(struct mlx5e_priv *priv,
+                    struct mlx5_flow_spec *spec,
+                    struct flow_cls_offload *f,
+                    struct mlx5_ct_attr *ct_attr,
+                    struct netlink_ext_ack *extack);
 int
 mlx5_tc_ct_add_no_trk_match(struct mlx5e_priv *priv,
                            struct mlx5_flow_spec *spec);
@@ -130,12 +133,15 @@ mlx5_tc_ct_clean(struct mlx5_rep_uplink_priv *uplink_priv)
 {
 }
 
+static inline void
+mlx5_tc_ct_match_del(struct mlx5e_priv *priv, struct mlx5_ct_attr *ct_attr) {}
+
 static inline int
-mlx5_tc_ct_parse_match(struct mlx5e_priv *priv,
-                      struct mlx5_flow_spec *spec,
-                      struct flow_cls_offload *f,
-                      struct mlx5_ct_attr *ct_attr,
-                      struct netlink_ext_ack *extack)
+mlx5_tc_ct_match_add(struct mlx5e_priv *priv,
+                    struct mlx5_flow_spec *spec,
+                    struct flow_cls_offload *f,
+                    struct mlx5_ct_attr *ct_attr,
+                    struct netlink_ext_ack *extack)
 {
        struct flow_rule *rule = flow_cls_offload_flow_rule(f);
 
index 9334c9c..24336c6 100644 (file)
@@ -20,6 +20,11 @@ enum mlx5e_icosq_wqe_type {
 };
 
 /* General */
+static inline bool mlx5e_skb_is_multicast(struct sk_buff *skb)
+{
+       return skb->pkt_type == PACKET_MULTICAST || skb->pkt_type == PACKET_BROADCAST;
+}
+
 void mlx5e_trigger_irq(struct mlx5e_icosq *sq);
 void mlx5e_completion_event(struct mlx5_core_cq *mcq, struct mlx5_eqe *eqe);
 void mlx5e_cq_error_event(struct mlx5_core_cq *mcq, enum mlx5_event event);
index 0e6946f..b28df21 100644 (file)
@@ -122,7 +122,7 @@ mlx5e_xmit_xdp_buff(struct mlx5e_xdpsq *sq, struct mlx5e_rq *rq,
 bool mlx5e_xdp_handle(struct mlx5e_rq *rq, struct mlx5e_dma_info *di,
                      u32 *len, struct xdp_buff *xdp)
 {
-       struct bpf_prog *prog = READ_ONCE(rq->xdp_prog);
+       struct bpf_prog *prog = rcu_dereference(rq->xdp_prog);
        u32 act;
        int err;
 
index a33a1f7..40db27b 100644 (file)
@@ -31,7 +31,6 @@ struct sk_buff *mlx5e_xsk_skb_from_cqe_mpwrq_linear(struct mlx5e_rq *rq,
 {
        struct xdp_buff *xdp = wi->umr.dma_info[page_idx].xsk;
        u32 cqe_bcnt32 = cqe_bcnt;
-       bool consumed;
 
        /* Check packet size. Note LRO doesn't use linear SKB */
        if (unlikely(cqe_bcnt > rq->hw_mtu)) {
@@ -51,10 +50,6 @@ struct sk_buff *mlx5e_xsk_skb_from_cqe_mpwrq_linear(struct mlx5e_rq *rq,
        xsk_buff_dma_sync_for_cpu(xdp);
        prefetch(xdp->data);
 
-       rcu_read_lock();
-       consumed = mlx5e_xdp_handle(rq, NULL, &cqe_bcnt32, xdp);
-       rcu_read_unlock();
-
        /* Possible flows:
         * - XDP_REDIRECT to XSKMAP:
         *   The page is owned by the userspace from now.
@@ -70,7 +65,7 @@ struct sk_buff *mlx5e_xsk_skb_from_cqe_mpwrq_linear(struct mlx5e_rq *rq,
         * allocated first from the Reuse Ring, so it has enough space.
         */
 
-       if (likely(consumed)) {
+       if (likely(mlx5e_xdp_handle(rq, NULL, &cqe_bcnt32, xdp))) {
                if (likely(__test_and_clear_bit(MLX5E_RQ_FLAG_XDP_XMIT, rq->flags)))
                        __set_bit(page_idx, wi->xdp_xmit_bitmap); /* non-atomic */
                return NULL; /* page/packet was consumed by XDP */
@@ -88,7 +83,6 @@ struct sk_buff *mlx5e_xsk_skb_from_cqe_linear(struct mlx5e_rq *rq,
                                              u32 cqe_bcnt)
 {
        struct xdp_buff *xdp = wi->di->xsk;
-       bool consumed;
 
        /* wi->offset is not used in this function, because xdp->data and the
         * DMA address point directly to the necessary place. Furthermore, the
@@ -107,11 +101,7 @@ struct sk_buff *mlx5e_xsk_skb_from_cqe_linear(struct mlx5e_rq *rq,
                return NULL;
        }
 
-       rcu_read_lock();
-       consumed = mlx5e_xdp_handle(rq, NULL, &cqe_bcnt, xdp);
-       rcu_read_unlock();
-
-       if (likely(consumed))
+       if (likely(mlx5e_xdp_handle(rq, NULL, &cqe_bcnt, xdp)))
                return NULL; /* page/packet was consumed by XDP */
 
        /* XDP_PASS: copy the data from the UMEM to a new SKB. The frame reuse
index dd9df51..55e65a4 100644 (file)
@@ -106,8 +106,7 @@ err_free_cparam:
 void mlx5e_close_xsk(struct mlx5e_channel *c)
 {
        clear_bit(MLX5E_CHANNEL_STATE_XSK, c->state);
-       napi_synchronize(&c->napi);
-       synchronize_rcu(); /* Sync with the XSK wakeup. */
+       synchronize_rcu(); /* Sync with the XSK wakeup and with NAPI. */
 
        mlx5e_close_rq(&c->xskrq);
        mlx5e_close_cq(&c->xskrq.cq);
index acf6d80..6bbfcf1 100644 (file)
@@ -234,7 +234,7 @@ mlx5e_get_ktls_rx_priv_ctx(struct tls_context *tls_ctx)
 
 /* Re-sync */
 /* Runs in work context */
-static struct mlx5_wqe_ctrl_seg *
+static int
 resync_post_get_progress_params(struct mlx5e_icosq *sq,
                                struct mlx5e_ktls_offload_context_rx *priv_rx)
 {
@@ -258,15 +258,19 @@ resync_post_get_progress_params(struct mlx5e_icosq *sq,
                                       PROGRESS_PARAMS_PADDED_SIZE, DMA_FROM_DEVICE);
        if (unlikely(dma_mapping_error(pdev, buf->dma_addr))) {
                err = -ENOMEM;
-               goto err_out;
+               goto err_free;
        }
 
        buf->priv_rx = priv_rx;
 
        BUILD_BUG_ON(MLX5E_KTLS_GET_PROGRESS_WQEBBS != 1);
+
+       spin_lock(&sq->channel->async_icosq_lock);
+
        if (unlikely(!mlx5e_wqc_has_room_for(&sq->wq, sq->cc, sq->pc, 1))) {
+               spin_unlock(&sq->channel->async_icosq_lock);
                err = -ENOSPC;
-               goto err_out;
+               goto err_dma_unmap;
        }
 
        pi = mlx5e_icosq_get_next_pi(sq, 1);
@@ -294,12 +298,18 @@ resync_post_get_progress_params(struct mlx5e_icosq *sq,
        };
        icosq_fill_wi(sq, pi, &wi);
        sq->pc++;
+       mlx5e_notify_hw(&sq->wq, sq->pc, sq->uar_map, cseg);
+       spin_unlock(&sq->channel->async_icosq_lock);
 
-       return cseg;
+       return 0;
 
+err_dma_unmap:
+       dma_unmap_single(pdev, buf->dma_addr, PROGRESS_PARAMS_PADDED_SIZE, DMA_FROM_DEVICE);
+err_free:
+       kfree(buf);
 err_out:
        priv_rx->stats->tls_resync_req_skip++;
-       return ERR_PTR(err);
+       return err;
 }
 
 /* Function is called with elevated refcount.
@@ -309,10 +319,8 @@ static void resync_handle_work(struct work_struct *work)
 {
        struct mlx5e_ktls_offload_context_rx *priv_rx;
        struct mlx5e_ktls_rx_resync_ctx *resync;
-       struct mlx5_wqe_ctrl_seg *cseg;
        struct mlx5e_channel *c;
        struct mlx5e_icosq *sq;
-       struct mlx5_wq_cyc *wq;
 
        resync = container_of(work, struct mlx5e_ktls_rx_resync_ctx, work);
        priv_rx = container_of(resync, struct mlx5e_ktls_offload_context_rx, resync);
@@ -324,18 +332,9 @@ static void resync_handle_work(struct work_struct *work)
 
        c = resync->priv->channels.c[priv_rx->rxq];
        sq = &c->async_icosq;
-       wq = &sq->wq;
-
-       spin_lock(&c->async_icosq_lock);
 
-       cseg = resync_post_get_progress_params(sq, priv_rx);
-       if (IS_ERR(cseg)) {
+       if (resync_post_get_progress_params(sq, priv_rx))
                refcount_dec(&resync->refcnt);
-               goto unlock;
-       }
-       mlx5e_notify_hw(wq, sq->pc, sq->uar_map, cseg);
-unlock:
-       spin_unlock(&c->async_icosq_lock);
 }
 
 static void resync_init(struct mlx5e_ktls_rx_resync_ctx *resync,
@@ -386,16 +385,17 @@ void mlx5e_ktls_handle_get_psv_completion(struct mlx5e_icosq_wqe_info *wi,
        struct mlx5e_ktls_offload_context_rx *priv_rx;
        struct mlx5e_ktls_rx_resync_ctx *resync;
        u8 tracker_state, auth_state, *ctx;
+       struct device *dev;
        u32 hw_seq;
 
        priv_rx = buf->priv_rx;
        resync = &priv_rx->resync;
-
+       dev = resync->priv->mdev->device;
        if (unlikely(test_bit(MLX5E_PRIV_RX_FLAG_DELETING, priv_rx->flags)))
                goto out;
 
-       dma_sync_single_for_cpu(resync->priv->mdev->device, buf->dma_addr,
-                               PROGRESS_PARAMS_PADDED_SIZE, DMA_FROM_DEVICE);
+       dma_sync_single_for_cpu(dev, buf->dma_addr, PROGRESS_PARAMS_PADDED_SIZE,
+                               DMA_FROM_DEVICE);
 
        ctx = buf->progress.ctx;
        tracker_state = MLX5_GET(tls_progress_params, ctx, record_tracker_state);
@@ -411,6 +411,7 @@ void mlx5e_ktls_handle_get_psv_completion(struct mlx5e_icosq_wqe_info *wi,
        priv_rx->stats->tls_resync_req_end++;
 out:
        refcount_dec(&resync->refcnt);
+       dma_unmap_single(dev, buf->dma_addr, PROGRESS_PARAMS_PADDED_SIZE, DMA_FROM_DEVICE);
        kfree(buf);
 }
 
@@ -659,7 +660,7 @@ void mlx5e_ktls_del_rx(struct net_device *netdev, struct tls_context *tls_ctx)
        priv_rx = mlx5e_get_ktls_rx_priv_ctx(tls_ctx);
        set_bit(MLX5E_PRIV_RX_FLAG_DELETING, priv_rx->flags);
        mlx5e_set_ktls_rx_priv_ctx(tls_ctx, NULL);
-       napi_synchronize(&priv->channels.c[priv_rx->rxq]->napi);
+       synchronize_rcu(); /* Sync with NAPI */
        if (!cancel_work_sync(&priv_rx->rule.work))
                /* completion is needed, as the priv_rx in the add flow
                 * is maintained on the wqe info (wi), not on the socket.
index 01468ec..b949b9a 100644 (file)
@@ -35,7 +35,6 @@
 #include <net/sock.h>
 
 #include "en.h"
-#include "accel/tls.h"
 #include "fpga/sdk.h"
 #include "en_accel/tls.h"
 
@@ -51,9 +50,14 @@ static const struct counter_desc mlx5e_tls_sw_stats_desc[] = {
 
 #define NUM_TLS_SW_COUNTERS ARRAY_SIZE(mlx5e_tls_sw_stats_desc)
 
+static bool is_tls_atomic_stats(struct mlx5e_priv *priv)
+{
+       return priv->tls && !mlx5_accel_is_ktls_device(priv->mdev);
+}
+
 int mlx5e_tls_get_count(struct mlx5e_priv *priv)
 {
-       if (!priv->tls)
+       if (!is_tls_atomic_stats(priv))
                return 0;
 
        return NUM_TLS_SW_COUNTERS;
@@ -63,7 +67,7 @@ int mlx5e_tls_get_strings(struct mlx5e_priv *priv, uint8_t *data)
 {
        unsigned int i, idx = 0;
 
-       if (!priv->tls)
+       if (!is_tls_atomic_stats(priv))
                return 0;
 
        for (i = 0; i < NUM_TLS_SW_COUNTERS; i++)
@@ -77,7 +81,7 @@ int mlx5e_tls_get_stats(struct mlx5e_priv *priv, u64 *data)
 {
        int i, idx = 0;
 
-       if (!priv->tls)
+       if (!is_tls_atomic_stats(priv))
                return 0;
 
        for (i = 0; i < NUM_TLS_SW_COUNTERS; i++)
index aebcf73..b3cda7b 100644 (file)
@@ -158,16 +158,6 @@ static void mlx5e_update_carrier_work(struct work_struct *work)
        mutex_unlock(&priv->state_lock);
 }
 
-void mlx5e_update_ndo_stats(struct mlx5e_priv *priv)
-{
-       int i;
-
-       for (i = mlx5e_nic_stats_grps_num(priv) - 1; i >= 0; i--)
-               if (mlx5e_nic_stats_grps[i]->update_stats_mask &
-                   MLX5E_NDO_UPDATE_STATS)
-                       mlx5e_nic_stats_grps[i]->update_stats(priv);
-}
-
 static void mlx5e_update_stats_work(struct work_struct *work)
 {
        struct mlx5e_priv *priv = container_of(work, struct mlx5e_priv,
@@ -399,7 +389,7 @@ static int mlx5e_alloc_rq(struct mlx5e_channel *c,
 
        if (params->xdp_prog)
                bpf_prog_inc(params->xdp_prog);
-       rq->xdp_prog = params->xdp_prog;
+       RCU_INIT_POINTER(rq->xdp_prog, params->xdp_prog);
 
        rq_xdp_ix = rq->ix;
        if (xsk)
@@ -408,7 +398,7 @@ static int mlx5e_alloc_rq(struct mlx5e_channel *c,
        if (err < 0)
                goto err_rq_wq_destroy;
 
-       rq->buff.map_dir = rq->xdp_prog ? DMA_BIDIRECTIONAL : DMA_FROM_DEVICE;
+       rq->buff.map_dir = params->xdp_prog ? DMA_BIDIRECTIONAL : DMA_FROM_DEVICE;
        rq->buff.headroom = mlx5e_get_rq_headroom(mdev, params, xsk);
        pool_size = 1 << params->log_rq_mtu_frames;
 
@@ -564,8 +554,8 @@ err_free:
        }
 
 err_rq_wq_destroy:
-       if (rq->xdp_prog)
-               bpf_prog_put(rq->xdp_prog);
+       if (params->xdp_prog)
+               bpf_prog_put(params->xdp_prog);
        xdp_rxq_info_unreg(&rq->xdp_rxq);
        page_pool_destroy(rq->page_pool);
        mlx5_wq_destroy(&rq->wq_ctrl);
@@ -575,10 +565,16 @@ err_rq_wq_destroy:
 
 static void mlx5e_free_rq(struct mlx5e_rq *rq)
 {
+       struct mlx5e_channel *c = rq->channel;
+       struct bpf_prog *old_prog = NULL;
        int i;
 
-       if (rq->xdp_prog)
-               bpf_prog_put(rq->xdp_prog);
+       /* drop_rq has neither channel nor xdp_prog. */
+       if (c)
+               old_prog = rcu_dereference_protected(rq->xdp_prog,
+                                                    lockdep_is_held(&c->priv->state_lock));
+       if (old_prog)
+               bpf_prog_put(old_prog);
 
        switch (rq->wq_type) {
        case MLX5_WQ_TYPE_LINKED_LIST_STRIDING_RQ:
@@ -867,7 +863,7 @@ void mlx5e_activate_rq(struct mlx5e_rq *rq)
 void mlx5e_deactivate_rq(struct mlx5e_rq *rq)
 {
        clear_bit(MLX5E_RQ_STATE_ENABLED, &rq->state);
-       napi_synchronize(&rq->channel->napi); /* prevent mlx5e_post_rx_wqes */
+       synchronize_rcu(); /* Sync with NAPI to prevent mlx5e_post_rx_wqes. */
 }
 
 void mlx5e_close_rq(struct mlx5e_rq *rq)
@@ -1312,12 +1308,10 @@ void mlx5e_tx_disable_queue(struct netdev_queue *txq)
 
 static void mlx5e_deactivate_txqsq(struct mlx5e_txqsq *sq)
 {
-       struct mlx5e_channel *c = sq->channel;
        struct mlx5_wq_cyc *wq = &sq->wq;
 
        clear_bit(MLX5E_SQ_STATE_ENABLED, &sq->state);
-       /* prevent netif_tx_wake_queue */
-       napi_synchronize(&c->napi);
+       synchronize_rcu(); /* Sync with NAPI to prevent netif_tx_wake_queue. */
 
        mlx5e_tx_disable_queue(sq->txq);
 
@@ -1392,10 +1386,8 @@ void mlx5e_activate_icosq(struct mlx5e_icosq *icosq)
 
 void mlx5e_deactivate_icosq(struct mlx5e_icosq *icosq)
 {
-       struct mlx5e_channel *c = icosq->channel;
-
        clear_bit(MLX5E_SQ_STATE_ENABLED, &icosq->state);
-       napi_synchronize(&c->napi);
+       synchronize_rcu(); /* Sync with NAPI. */
 }
 
 void mlx5e_close_icosq(struct mlx5e_icosq *sq)
@@ -1474,7 +1466,7 @@ void mlx5e_close_xdpsq(struct mlx5e_xdpsq *sq)
        struct mlx5e_channel *c = sq->channel;
 
        clear_bit(MLX5E_SQ_STATE_ENABLED, &sq->state);
-       napi_synchronize(&c->napi);
+       synchronize_rcu(); /* Sync with NAPI. */
 
        mlx5e_destroy_sq(c->mdev, sq->sqn);
        mlx5e_free_xdpsq_descs(sq);
@@ -3567,6 +3559,7 @@ void mlx5e_fold_sw_stats64(struct mlx5e_priv *priv, struct rtnl_link_stats64 *s)
 
                s->rx_packets   += rq_stats->packets + xskrq_stats->packets;
                s->rx_bytes     += rq_stats->bytes + xskrq_stats->bytes;
+               s->multicast    += rq_stats->mcast_packets + xskrq_stats->mcast_packets;
 
                for (j = 0; j < priv->max_opened_tc; j++) {
                        struct mlx5e_sq_stats *sq_stats = &channel_stats->sq[j];
@@ -3582,7 +3575,6 @@ void
 mlx5e_get_stats(struct net_device *dev, struct rtnl_link_stats64 *stats)
 {
        struct mlx5e_priv *priv = netdev_priv(dev);
-       struct mlx5e_vport_stats *vstats = &priv->stats.vport;
        struct mlx5e_pport_stats *pstats = &priv->stats.pport;
 
        /* In switchdev mode, monitor counters doesn't monitor
@@ -3617,12 +3609,6 @@ mlx5e_get_stats(struct net_device *dev, struct rtnl_link_stats64 *stats)
        stats->rx_errors = stats->rx_length_errors + stats->rx_crc_errors +
                           stats->rx_frame_errors;
        stats->tx_errors = stats->tx_aborted_errors + stats->tx_carrier_errors;
-
-       /* vport multicast also counts packets that are dropped due to steering
-        * or rx out of buffer
-        */
-       stats->multicast =
-               VPORT_COUNTER_GET(vstats, received_eth_multicast.packets);
 }
 
 static void mlx5e_set_rx_mode(struct net_device *dev)
@@ -4330,6 +4316,16 @@ static int mlx5e_xdp_allowed(struct mlx5e_priv *priv, struct bpf_prog *prog)
        return 0;
 }
 
+static void mlx5e_rq_replace_xdp_prog(struct mlx5e_rq *rq, struct bpf_prog *prog)
+{
+       struct bpf_prog *old_prog;
+
+       old_prog = rcu_replace_pointer(rq->xdp_prog, prog,
+                                      lockdep_is_held(&rq->channel->priv->state_lock));
+       if (old_prog)
+               bpf_prog_put(old_prog);
+}
+
 static int mlx5e_xdp_set(struct net_device *netdev, struct bpf_prog *prog)
 {
        struct mlx5e_priv *priv = netdev_priv(netdev);
@@ -4388,29 +4384,10 @@ static int mlx5e_xdp_set(struct net_device *netdev, struct bpf_prog *prog)
         */
        for (i = 0; i < priv->channels.num; i++) {
                struct mlx5e_channel *c = priv->channels.c[i];
-               bool xsk_open = test_bit(MLX5E_CHANNEL_STATE_XSK, c->state);
-
-               clear_bit(MLX5E_RQ_STATE_ENABLED, &c->rq.state);
-               if (xsk_open)
-                       clear_bit(MLX5E_RQ_STATE_ENABLED, &c->xskrq.state);
-               napi_synchronize(&c->napi);
-               /* prevent mlx5e_poll_rx_cq from accessing rq->xdp_prog */
-
-               old_prog = xchg(&c->rq.xdp_prog, prog);
-               if (old_prog)
-                       bpf_prog_put(old_prog);
-
-               if (xsk_open) {
-                       old_prog = xchg(&c->xskrq.xdp_prog, prog);
-                       if (old_prog)
-                               bpf_prog_put(old_prog);
-               }
 
-               set_bit(MLX5E_RQ_STATE_ENABLED, &c->rq.state);
-               if (xsk_open)
-                       set_bit(MLX5E_RQ_STATE_ENABLED, &c->xskrq.state);
-               /* napi_schedule in case we have missed anything */
-               napi_schedule(&c->napi);
+               mlx5e_rq_replace_xdp_prog(&c->rq, prog);
+               if (test_bit(MLX5E_CHANNEL_STATE_XSK, c->state))
+                       mlx5e_rq_replace_xdp_prog(&c->xskrq, prog);
        }
 
 unlock:
@@ -5200,7 +5177,7 @@ static const struct mlx5e_profile mlx5e_nic_profile = {
        .enable            = mlx5e_nic_enable,
        .disable           = mlx5e_nic_disable,
        .update_rx         = mlx5e_update_nic_rx,
-       .update_stats      = mlx5e_update_ndo_stats,
+       .update_stats      = mlx5e_stats_update_ndo_stats,
        .update_carrier    = mlx5e_update_carrier,
        .rx_handlers       = &mlx5e_rx_handlers_nic,
        .max_tc            = MLX5E_MAX_NUM_TC,
index e13e5d1..e979bff 100644 (file)
@@ -1171,7 +1171,7 @@ static const struct mlx5e_profile mlx5e_rep_profile = {
        .cleanup_tx             = mlx5e_cleanup_rep_tx,
        .enable                 = mlx5e_rep_enable,
        .update_rx              = mlx5e_update_rep_rx,
-       .update_stats           = mlx5e_update_ndo_stats,
+       .update_stats           = mlx5e_stats_update_ndo_stats,
        .rx_handlers            = &mlx5e_rx_handlers_rep,
        .max_tc                 = 1,
        .rq_groups              = MLX5E_NUM_RQ_GROUPS(REGULAR),
@@ -1189,7 +1189,7 @@ static const struct mlx5e_profile mlx5e_uplink_rep_profile = {
        .enable                 = mlx5e_uplink_rep_enable,
        .disable                = mlx5e_uplink_rep_disable,
        .update_rx              = mlx5e_update_rep_rx,
-       .update_stats           = mlx5e_update_ndo_stats,
+       .update_stats           = mlx5e_stats_update_ndo_stats,
        .update_carrier         = mlx5e_update_carrier,
        .rx_handlers            = &mlx5e_rx_handlers_rep,
        .max_tc                 = MLX5E_MAX_NUM_TC,
index 65828af..64c8ac5 100644 (file)
@@ -53,6 +53,7 @@
 #include "en/xsk/rx.h"
 #include "en/health.h"
 #include "en/params.h"
+#include "en/txrx.h"
 
 static struct sk_buff *
 mlx5e_skb_from_cqe_mpwrq_linear(struct mlx5e_rq *rq, struct mlx5e_mpw_info *wi,
@@ -1080,6 +1081,9 @@ static inline void mlx5e_build_rx_skb(struct mlx5_cqe64 *cqe,
                mlx5e_enable_ecn(rq, skb);
 
        skb->protocol = eth_type_trans(skb, netdev);
+
+       if (unlikely(mlx5e_skb_is_multicast(skb)))
+               stats->mcast_packets++;
 }
 
 static inline void mlx5e_complete_rx_cqe(struct mlx5e_rq *rq,
@@ -1132,7 +1136,6 @@ mlx5e_skb_from_cqe_linear(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe,
        struct xdp_buff xdp;
        struct sk_buff *skb;
        void *va, *data;
-       bool consumed;
        u32 frag_size;
 
        va             = page_address(di->page) + wi->offset;
@@ -1144,11 +1147,8 @@ mlx5e_skb_from_cqe_linear(struct mlx5e_rq *rq, struct mlx5_cqe64 *cqe,
        prefetchw(va); /* xdp_frame data area */
        prefetch(data);
 
-       rcu_read_lock();
        mlx5e_fill_xdp_buff(rq, va, rx_headroom, cqe_bcnt, &xdp);
-       consumed = mlx5e_xdp_handle(rq, di, &cqe_bcnt, &xdp);
-       rcu_read_unlock();
-       if (consumed)
+       if (mlx5e_xdp_handle(rq, di, &cqe_bcnt, &xdp))
                return NULL; /* page/packet was consumed by XDP */
 
        rx_headroom = xdp.data - xdp.data_hard_start;
@@ -1438,7 +1438,6 @@ mlx5e_skb_from_cqe_mpwrq_linear(struct mlx5e_rq *rq, struct mlx5e_mpw_info *wi,
        struct sk_buff *skb;
        void *va, *data;
        u32 frag_size;
-       bool consumed;
 
        /* Check packet size. Note LRO doesn't use linear SKB */
        if (unlikely(cqe_bcnt > rq->hw_mtu)) {
@@ -1455,11 +1454,8 @@ mlx5e_skb_from_cqe_mpwrq_linear(struct mlx5e_rq *rq, struct mlx5e_mpw_info *wi,
        prefetchw(va); /* xdp_frame data area */
        prefetch(data);
 
-       rcu_read_lock();
        mlx5e_fill_xdp_buff(rq, va, rx_headroom, cqe_bcnt32, &xdp);
-       consumed = mlx5e_xdp_handle(rq, di, &cqe_bcnt32, &xdp);
-       rcu_read_unlock();
-       if (consumed) {
+       if (mlx5e_xdp_handle(rq, di, &cqe_bcnt32, &xdp)) {
                if (__test_and_clear_bit(MLX5E_RQ_FLAG_XDP_XMIT, rq->flags))
                        __set_bit(page_idx, wi->xdp_xmit_bitmap); /* non-atomic */
                return NULL; /* page/packet was consumed by XDP */
index e3b2f59..f6383bc 100644 (file)
@@ -54,6 +54,18 @@ unsigned int mlx5e_stats_total_num(struct mlx5e_priv *priv)
        return total;
 }
 
+void mlx5e_stats_update_ndo_stats(struct mlx5e_priv *priv)
+{
+       mlx5e_stats_grp_t *stats_grps = priv->profile->stats_grps;
+       const unsigned int num_stats_grps = stats_grps_num(priv);
+       int i;
+
+       for (i = num_stats_grps - 1; i >= 0; i--)
+               if (stats_grps[i]->update_stats &&
+                   stats_grps[i]->update_stats_mask & MLX5E_NDO_UPDATE_STATS)
+                       stats_grps[i]->update_stats(priv);
+}
+
 void mlx5e_stats_update(struct mlx5e_priv *priv)
 {
        mlx5e_stats_grp_t *stats_grps = priv->profile->stats_grps;
index 2e1cca1..562263d 100644 (file)
@@ -103,6 +103,7 @@ unsigned int mlx5e_stats_total_num(struct mlx5e_priv *priv);
 void mlx5e_stats_update(struct mlx5e_priv *priv);
 void mlx5e_stats_fill(struct mlx5e_priv *priv, u64 *data, int idx);
 void mlx5e_stats_fill_strings(struct mlx5e_priv *priv, u8 *data);
+void mlx5e_stats_update_ndo_stats(struct mlx5e_priv *priv);
 
 /* Concrete NIC Stats */
 
@@ -119,6 +120,7 @@ struct mlx5e_sw_stats {
        u64 tx_nop;
        u64 rx_lro_packets;
        u64 rx_lro_bytes;
+       u64 rx_mcast_packets;
        u64 rx_ecn_mark;
        u64 rx_removed_vlan_packets;
        u64 rx_csum_unnecessary;
@@ -298,6 +300,7 @@ struct mlx5e_rq_stats {
        u64 csum_none;
        u64 lro_packets;
        u64 lro_bytes;
+       u64 mcast_packets;
        u64 ecn_mark;
        u64 removed_vlan_packets;
        u64 xdp_drop;
index fd53d10..1c93f92 100644 (file)
@@ -1290,11 +1290,8 @@ static void mlx5e_tc_del_fdb_flow(struct mlx5e_priv *priv,
 
        mlx5e_put_flow_tunnel_id(flow);
 
-       if (flow_flag_test(flow, NOT_READY)) {
+       if (flow_flag_test(flow, NOT_READY))
                remove_unready_flow(flow);
-               kvfree(attr->parse_attr);
-               return;
-       }
 
        if (mlx5e_is_offloaded_flow(flow)) {
                if (flow_flag_test(flow, SLOW))
@@ -1315,6 +1312,8 @@ static void mlx5e_tc_del_fdb_flow(struct mlx5e_priv *priv,
                }
        kvfree(attr->parse_attr);
 
+       mlx5_tc_ct_match_del(priv, &flow->esw_attr->ct_attr);
+
        if (attr->action & MLX5_FLOW_CONTEXT_ACTION_MOD_HDR)
                mlx5e_detach_mod_hdr(priv, flow);
 
@@ -2625,6 +2624,22 @@ static struct mlx5_fields fields[] = {
        OFFLOAD(UDP_DPORT, 16, U16_MAX, udp.dest,   0, udp_dport),
 };
 
+static unsigned long mask_to_le(unsigned long mask, int size)
+{
+       __be32 mask_be32;
+       __be16 mask_be16;
+
+       if (size == 32) {
+               mask_be32 = (__force __be32)(mask);
+               mask = (__force unsigned long)cpu_to_le32(be32_to_cpu(mask_be32));
+       } else if (size == 16) {
+               mask_be32 = (__force __be32)(mask);
+               mask_be16 = *(__be16 *)&mask_be32;
+               mask = (__force unsigned long)cpu_to_le16(be16_to_cpu(mask_be16));
+       }
+
+       return mask;
+}
 static int offload_pedit_fields(struct mlx5e_priv *priv,
                                int namespace,
                                struct pedit_headers_action *hdrs,
@@ -2638,9 +2653,7 @@ static int offload_pedit_fields(struct mlx5e_priv *priv,
        u32 *s_masks_p, *a_masks_p, s_mask, a_mask;
        struct mlx5e_tc_mod_hdr_acts *mod_acts;
        struct mlx5_fields *f;
-       unsigned long mask;
-       __be32 mask_be32;
-       __be16 mask_be16;
+       unsigned long mask, field_mask;
        int err;
        u8 cmd;
 
@@ -2706,14 +2719,7 @@ static int offload_pedit_fields(struct mlx5e_priv *priv,
                if (skip)
                        continue;
 
-               if (f->field_bsize == 32) {
-                       mask_be32 = (__force __be32)(mask);
-                       mask = (__force unsigned long)cpu_to_le32(be32_to_cpu(mask_be32));
-               } else if (f->field_bsize == 16) {
-                       mask_be32 = (__force __be32)(mask);
-                       mask_be16 = *(__be16 *)&mask_be32;
-                       mask = (__force unsigned long)cpu_to_le16(be16_to_cpu(mask_be16));
-               }
+               mask = mask_to_le(mask, f->field_bsize);
 
                first = find_first_bit(&mask, f->field_bsize);
                next_z = find_next_zero_bit(&mask, f->field_bsize, first);
@@ -2744,9 +2750,10 @@ static int offload_pedit_fields(struct mlx5e_priv *priv,
                if (cmd == MLX5_ACTION_TYPE_SET) {
                        int start;
 
+                       field_mask = mask_to_le(f->field_mask, f->field_bsize);
+
                        /* if field is bit sized it can start not from first bit */
-                       start = find_first_bit((unsigned long *)&f->field_mask,
-                                              f->field_bsize);
+                       start = find_first_bit(&field_mask, f->field_bsize);
 
                        MLX5_SET(set_action_in, action, offset, first - start);
                        /* length is num of bits to be written, zero means length of 32 */
@@ -4402,8 +4409,8 @@ __mlx5e_add_fdb_flow(struct mlx5e_priv *priv,
                goto err_free;
 
        /* actions validation depends on parsing the ct matches first */
-       err = mlx5_tc_ct_parse_match(priv, &parse_attr->spec, f,
-                                    &flow->esw_attr->ct_attr, extack);
+       err = mlx5_tc_ct_match_add(priv, &parse_attr->spec, f,
+                                  &flow->esw_attr->ct_attr, extack);
        if (err)
                goto err_free;
 
index de10b06..d586867 100644 (file)
@@ -121,13 +121,17 @@ int mlx5e_napi_poll(struct napi_struct *napi, int budget)
        struct mlx5e_xdpsq *xsksq = &c->xsksq;
        struct mlx5e_rq *xskrq = &c->xskrq;
        struct mlx5e_rq *rq = &c->rq;
-       bool xsk_open = test_bit(MLX5E_CHANNEL_STATE_XSK, c->state);
        bool aff_change = false;
        bool busy_xsk = false;
        bool busy = false;
        int work_done = 0;
+       bool xsk_open;
        int i;
 
+       rcu_read_lock();
+
+       xsk_open = test_bit(MLX5E_CHANNEL_STATE_XSK, c->state);
+
        ch_stats->poll++;
 
        for (i = 0; i < c->num_tc; i++)
@@ -167,8 +171,10 @@ int mlx5e_napi_poll(struct napi_struct *napi, int budget)
        busy |= busy_xsk;
 
        if (busy) {
-               if (likely(mlx5e_channel_no_affinity_change(c)))
-                       return budget;
+               if (likely(mlx5e_channel_no_affinity_change(c))) {
+                       work_done = budget;
+                       goto out;
+               }
                ch_stats->aff_change++;
                aff_change = true;
                if (budget && work_done == budget)
@@ -176,7 +182,7 @@ int mlx5e_napi_poll(struct napi_struct *napi, int budget)
        }
 
        if (unlikely(!napi_complete_done(napi, work_done)))
-               return work_done;
+               goto out;
 
        ch_stats->arm++;
 
@@ -203,6 +209,9 @@ int mlx5e_napi_poll(struct napi_struct *napi, int budget)
                ch_stats->force_irq++;
        }
 
+out:
+       rcu_read_unlock();
+
        return work_done;
 }
 
index d251692..1bcf260 100644 (file)
@@ -1219,35 +1219,37 @@ static int esw_create_offloads_fdb_tables(struct mlx5_eswitch *esw)
        }
        esw->fdb_table.offloads.send_to_vport_grp = g;
 
-       /* create peer esw miss group */
-       memset(flow_group_in, 0, inlen);
+       if (MLX5_CAP_ESW(esw->dev, merged_eswitch)) {
+               /* create peer esw miss group */
+               memset(flow_group_in, 0, inlen);
 
-       esw_set_flow_group_source_port(esw, flow_group_in);
+               esw_set_flow_group_source_port(esw, flow_group_in);
 
-       if (!mlx5_eswitch_vport_match_metadata_enabled(esw)) {
-               match_criteria = MLX5_ADDR_OF(create_flow_group_in,
-                                             flow_group_in,
-                                             match_criteria);
+               if (!mlx5_eswitch_vport_match_metadata_enabled(esw)) {
+                       match_criteria = MLX5_ADDR_OF(create_flow_group_in,
+                                                     flow_group_in,
+                                                     match_criteria);
 
-               MLX5_SET_TO_ONES(fte_match_param, match_criteria,
-                                misc_parameters.source_eswitch_owner_vhca_id);
+                       MLX5_SET_TO_ONES(fte_match_param, match_criteria,
+                                        misc_parameters.source_eswitch_owner_vhca_id);
 
-               MLX5_SET(create_flow_group_in, flow_group_in,
-                        source_eswitch_owner_vhca_id_valid, 1);
-       }
+                       MLX5_SET(create_flow_group_in, flow_group_in,
+                                source_eswitch_owner_vhca_id_valid, 1);
+               }
 
-       MLX5_SET(create_flow_group_in, flow_group_in, start_flow_index, ix);
-       MLX5_SET(create_flow_group_in, flow_group_in, end_flow_index,
-                ix + esw->total_vports - 1);
-       ix += esw->total_vports;
+               MLX5_SET(create_flow_group_in, flow_group_in, start_flow_index, ix);
+               MLX5_SET(create_flow_group_in, flow_group_in, end_flow_index,
+                        ix + esw->total_vports - 1);
+               ix += esw->total_vports;
 
-       g = mlx5_create_flow_group(fdb, flow_group_in);
-       if (IS_ERR(g)) {
-               err = PTR_ERR(g);
-               esw_warn(dev, "Failed to create peer miss flow group err(%d)\n", err);
-               goto peer_miss_err;
+               g = mlx5_create_flow_group(fdb, flow_group_in);
+               if (IS_ERR(g)) {
+                       err = PTR_ERR(g);
+                       esw_warn(dev, "Failed to create peer miss flow group err(%d)\n", err);
+                       goto peer_miss_err;
+               }
+               esw->fdb_table.offloads.peer_miss_grp = g;
        }
-       esw->fdb_table.offloads.peer_miss_grp = g;
 
        /* create miss group */
        memset(flow_group_in, 0, inlen);
@@ -1281,7 +1283,8 @@ static int esw_create_offloads_fdb_tables(struct mlx5_eswitch *esw)
 miss_rule_err:
        mlx5_destroy_flow_group(esw->fdb_table.offloads.miss_grp);
 miss_err:
-       mlx5_destroy_flow_group(esw->fdb_table.offloads.peer_miss_grp);
+       if (MLX5_CAP_ESW(esw->dev, merged_eswitch))
+               mlx5_destroy_flow_group(esw->fdb_table.offloads.peer_miss_grp);
 peer_miss_err:
        mlx5_destroy_flow_group(esw->fdb_table.offloads.send_to_vport_grp);
 send_vport_err:
@@ -1305,7 +1308,8 @@ static void esw_destroy_offloads_fdb_tables(struct mlx5_eswitch *esw)
        mlx5_del_flow_rules(esw->fdb_table.offloads.miss_rule_multi);
        mlx5_del_flow_rules(esw->fdb_table.offloads.miss_rule_uni);
        mlx5_destroy_flow_group(esw->fdb_table.offloads.send_to_vport_grp);
-       mlx5_destroy_flow_group(esw->fdb_table.offloads.peer_miss_grp);
+       if (MLX5_CAP_ESW(esw->dev, merged_eswitch))
+               mlx5_destroy_flow_group(esw->fdb_table.offloads.peer_miss_grp);
        mlx5_destroy_flow_group(esw->fdb_table.offloads.miss_grp);
 
        mlx5_esw_chains_destroy(esw);
index 9ccec5f..75fa44e 100644 (file)
@@ -654,7 +654,7 @@ static struct fs_fte *alloc_fte(struct mlx5_flow_table *ft,
        fte->action = *flow_act;
        fte->flow_context = spec->flow_context;
 
-       tree_init_node(&fte->node, NULL, del_sw_fte);
+       tree_init_node(&fte->node, del_hw_fte, del_sw_fte);
 
        return fte;
 }
@@ -1792,7 +1792,6 @@ skip_search:
                up_write_ref_node(&g->node, false);
                rule = add_rule_fg(g, spec, flow_act, dest, dest_num, fte);
                up_write_ref_node(&fte->node, false);
-               tree_put_node(&fte->node, false);
                return rule;
        }
        rule = ERR_PTR(-ENOENT);
@@ -1891,7 +1890,6 @@ search_again_locked:
        up_write_ref_node(&g->node, false);
        rule = add_rule_fg(g, spec, flow_act, dest, dest_num, fte);
        up_write_ref_node(&fte->node, false);
-       tree_put_node(&fte->node, false);
        tree_put_node(&g->node, false);
        return rule;
 
@@ -2001,7 +1999,9 @@ void mlx5_del_flow_rules(struct mlx5_flow_handle *handle)
                up_write_ref_node(&fte->node, false);
        } else {
                del_hw_fte(&fte->node);
-               up_write(&fte->node.lock);
+               /* Avoid double call to del_hw_fte */
+               fte->node.del_hw_func = NULL;
+               up_write_ref_node(&fte->node, false);
                tree_put_node(&fte->node, false);
        }
        kfree(handle);
index 5abb7d2..8518e1d 100644 (file)
@@ -421,10 +421,15 @@ int ocelot_port_add_txtstamp_skb(struct ocelot_port *ocelot_port,
 
        if (ocelot->ptp && shinfo->tx_flags & SKBTX_HW_TSTAMP &&
            ocelot_port->ptp_cmd == IFH_REW_OP_TWO_STEP_PTP) {
+               spin_lock(&ocelot_port->ts_id_lock);
+
                shinfo->tx_flags |= SKBTX_IN_PROGRESS;
                /* Store timestamp ID in cb[0] of sk_buff */
-               skb->cb[0] = ocelot_port->ts_id % 4;
+               skb->cb[0] = ocelot_port->ts_id;
+               ocelot_port->ts_id = (ocelot_port->ts_id + 1) % 4;
                skb_queue_tail(&ocelot_port->tx_skbs, skb);
+
+               spin_unlock(&ocelot_port->ts_id_lock);
                return 0;
        }
        return -ENODATA;
@@ -1300,6 +1305,7 @@ void ocelot_init_port(struct ocelot *ocelot, int port)
        struct ocelot_port *ocelot_port = ocelot->ports[port];
 
        skb_queue_head_init(&ocelot_port->tx_skbs);
+       spin_lock_init(&ocelot_port->ts_id_lock);
 
        /* Basic L2 initialization */
 
@@ -1544,18 +1550,18 @@ EXPORT_SYMBOL(ocelot_init);
 
 void ocelot_deinit(struct ocelot *ocelot)
 {
-       struct ocelot_port *port;
-       int i;
-
        cancel_delayed_work(&ocelot->stats_work);
        destroy_workqueue(ocelot->stats_queue);
        mutex_destroy(&ocelot->stats_lock);
-
-       for (i = 0; i < ocelot->num_phys_ports; i++) {
-               port = ocelot->ports[i];
-               skb_queue_purge(&port->tx_skbs);
-       }
 }
 EXPORT_SYMBOL(ocelot_deinit);
 
+void ocelot_deinit_port(struct ocelot *ocelot, int port)
+{
+       struct ocelot_port *ocelot_port = ocelot->ports[port];
+
+       skb_queue_purge(&ocelot_port->tx_skbs);
+}
+EXPORT_SYMBOL(ocelot_deinit_port);
+
 MODULE_LICENSE("Dual MIT/GPL");
index 0668d23..8490e42 100644 (file)
@@ -330,6 +330,7 @@ static int ocelot_port_xmit(struct sk_buff *skb, struct net_device *dev)
        u8 grp = 0; /* Send everything on CPU group 0 */
        unsigned int i, count, last;
        int port = priv->chip_port;
+       bool do_tstamp;
 
        val = ocelot_read(ocelot, QS_INJ_STATUS);
        if (!(val & QS_INJ_STATUS_FIFO_RDY(BIT(grp))) ||
@@ -344,10 +345,12 @@ static int ocelot_port_xmit(struct sk_buff *skb, struct net_device *dev)
        info.vid = skb_vlan_tag_get(skb);
 
        /* Check if timestamping is needed */
+       do_tstamp = (ocelot_port_add_txtstamp_skb(ocelot_port, skb) == 0);
+
        if (ocelot->ptp && shinfo->tx_flags & SKBTX_HW_TSTAMP) {
                info.rew_op = ocelot_port->ptp_cmd;
                if (ocelot_port->ptp_cmd == IFH_REW_OP_TWO_STEP_PTP)
-                       info.rew_op |= (ocelot_port->ts_id  % 4) << 3;
+                       info.rew_op |= skb->cb[0] << 3;
        }
 
        ocelot_gen_ifh(ifh, &info);
@@ -380,12 +383,9 @@ static int ocelot_port_xmit(struct sk_buff *skb, struct net_device *dev)
        dev->stats.tx_packets++;
        dev->stats.tx_bytes += skb->len;
 
-       if (!ocelot_port_add_txtstamp_skb(ocelot_port, skb)) {
-               ocelot_port->ts_id++;
-               return NETDEV_TX_OK;
-       }
+       if (!do_tstamp)
+               dev_kfree_skb_any(skb);
 
-       dev_kfree_skb_any(skb);
        return NETDEV_TX_OK;
 }
 
index 65408bc..dfb1535 100644 (file)
@@ -806,17 +806,17 @@ static const struct vcap_field vsc7514_vcap_is2_keys[] = {
        [VCAP_IS2_HK_DIP_EQ_SIP]                = {123,   1},
        /* IP4_TCP_UDP (TYPE=100) */
        [VCAP_IS2_HK_TCP]                       = {124,   1},
-       [VCAP_IS2_HK_L4_SPORT]                  = {125,  16},
-       [VCAP_IS2_HK_L4_DPORT]                  = {141,  16},
+       [VCAP_IS2_HK_L4_DPORT]                  = {125,  16},
+       [VCAP_IS2_HK_L4_SPORT]                  = {141,  16},
        [VCAP_IS2_HK_L4_RNG]                    = {157,   8},
        [VCAP_IS2_HK_L4_SPORT_EQ_DPORT]         = {165,   1},
        [VCAP_IS2_HK_L4_SEQUENCE_EQ0]           = {166,   1},
-       [VCAP_IS2_HK_L4_URG]                    = {167,   1},
-       [VCAP_IS2_HK_L4_ACK]                    = {168,   1},
-       [VCAP_IS2_HK_L4_PSH]                    = {169,   1},
-       [VCAP_IS2_HK_L4_RST]                    = {170,   1},
-       [VCAP_IS2_HK_L4_SYN]                    = {171,   1},
-       [VCAP_IS2_HK_L4_FIN]                    = {172,   1},
+       [VCAP_IS2_HK_L4_FIN]                    = {167,   1},
+       [VCAP_IS2_HK_L4_SYN]                    = {168,   1},
+       [VCAP_IS2_HK_L4_RST]                    = {169,   1},
+       [VCAP_IS2_HK_L4_PSH]                    = {170,   1},
+       [VCAP_IS2_HK_L4_ACK]                    = {171,   1},
+       [VCAP_IS2_HK_L4_URG]                    = {172,   1},
        [VCAP_IS2_HK_L4_1588_DOM]               = {173,   8},
        [VCAP_IS2_HK_L4_1588_VER]               = {181,   4},
        /* IP4_OTHER (TYPE=101) */
@@ -896,11 +896,137 @@ static struct ptp_clock_info ocelot_ptp_clock_info = {
        .enable         = ocelot_ptp_enable,
 };
 
+static void mscc_ocelot_release_ports(struct ocelot *ocelot)
+{
+       int port;
+
+       for (port = 0; port < ocelot->num_phys_ports; port++) {
+               struct ocelot_port_private *priv;
+               struct ocelot_port *ocelot_port;
+
+               ocelot_port = ocelot->ports[port];
+               if (!ocelot_port)
+                       continue;
+
+               ocelot_deinit_port(ocelot, port);
+
+               priv = container_of(ocelot_port, struct ocelot_port_private,
+                                   port);
+
+               unregister_netdev(priv->dev);
+               free_netdev(priv->dev);
+       }
+}
+
+static int mscc_ocelot_init_ports(struct platform_device *pdev,
+                                 struct device_node *ports)
+{
+       struct ocelot *ocelot = platform_get_drvdata(pdev);
+       struct device_node *portnp;
+       int err;
+
+       ocelot->ports = devm_kcalloc(ocelot->dev, ocelot->num_phys_ports,
+                                    sizeof(struct ocelot_port *), GFP_KERNEL);
+       if (!ocelot->ports)
+               return -ENOMEM;
+
+       /* No NPI port */
+       ocelot_configure_cpu(ocelot, -1, OCELOT_TAG_PREFIX_NONE,
+                            OCELOT_TAG_PREFIX_NONE);
+
+       for_each_available_child_of_node(ports, portnp) {
+               struct ocelot_port_private *priv;
+               struct ocelot_port *ocelot_port;
+               struct device_node *phy_node;
+               phy_interface_t phy_mode;
+               struct phy_device *phy;
+               struct regmap *target;
+               struct resource *res;
+               struct phy *serdes;
+               char res_name[8];
+               u32 port;
+
+               if (of_property_read_u32(portnp, "reg", &port))
+                       continue;
+
+               snprintf(res_name, sizeof(res_name), "port%d", port);
+
+               res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
+                                                  res_name);
+               target = ocelot_regmap_init(ocelot, res);
+               if (IS_ERR(target))
+                       continue;
+
+               phy_node = of_parse_phandle(portnp, "phy-handle", 0);
+               if (!phy_node)
+                       continue;
+
+               phy = of_phy_find_device(phy_node);
+               of_node_put(phy_node);
+               if (!phy)
+                       continue;
+
+               err = ocelot_probe_port(ocelot, port, target, phy);
+               if (err) {
+                       of_node_put(portnp);
+                       return err;
+               }
+
+               ocelot_port = ocelot->ports[port];
+               priv = container_of(ocelot_port, struct ocelot_port_private,
+                                   port);
+
+               of_get_phy_mode(portnp, &phy_mode);
+
+               ocelot_port->phy_mode = phy_mode;
+
+               switch (ocelot_port->phy_mode) {
+               case PHY_INTERFACE_MODE_NA:
+                       continue;
+               case PHY_INTERFACE_MODE_SGMII:
+                       break;
+               case PHY_INTERFACE_MODE_QSGMII:
+                       /* Ensure clock signals and speed is set on all
+                        * QSGMII links
+                        */
+                       ocelot_port_writel(ocelot_port,
+                                          DEV_CLOCK_CFG_LINK_SPEED
+                                          (OCELOT_SPEED_1000),
+                                          DEV_CLOCK_CFG);
+                       break;
+               default:
+                       dev_err(ocelot->dev,
+                               "invalid phy mode for port%d, (Q)SGMII only\n",
+                               port);
+                       of_node_put(portnp);
+                       return -EINVAL;
+               }
+
+               serdes = devm_of_phy_get(ocelot->dev, portnp, NULL);
+               if (IS_ERR(serdes)) {
+                       err = PTR_ERR(serdes);
+                       if (err == -EPROBE_DEFER)
+                               dev_dbg(ocelot->dev, "deferring probe\n");
+                       else
+                               dev_err(ocelot->dev,
+                                       "missing SerDes phys for port%d\n",
+                                       port);
+
+                       of_node_put(portnp);
+                       return err;
+               }
+
+               priv->serdes = serdes;
+       }
+
+       return 0;
+}
+
 static int mscc_ocelot_probe(struct platform_device *pdev)
 {
        struct device_node *np = pdev->dev.of_node;
-       struct device_node *ports, *portnp;
        int err, irq_xtr, irq_ptp_rdy;
+       struct device_node *ports;
        struct ocelot *ocelot;
        struct regmap *hsio;
        unsigned int i;
@@ -985,20 +1111,24 @@ static int mscc_ocelot_probe(struct platform_device *pdev)
 
        ports = of_get_child_by_name(np, "ethernet-ports");
        if (!ports) {
-               dev_err(&pdev->dev, "no ethernet-ports child node found\n");
+               dev_err(ocelot->dev, "no ethernet-ports child node found\n");
                return -ENODEV;
        }
 
        ocelot->num_phys_ports = of_get_child_count(ports);
 
-       ocelot->ports = devm_kcalloc(&pdev->dev, ocelot->num_phys_ports,
-                                    sizeof(struct ocelot_port *), GFP_KERNEL);
-
        ocelot->vcap_is2_keys = vsc7514_vcap_is2_keys;
        ocelot->vcap_is2_actions = vsc7514_vcap_is2_actions;
        ocelot->vcap = vsc7514_vcap_props;
 
-       ocelot_init(ocelot);
+       err = ocelot_init(ocelot);
+       if (err)
+               goto out_put_ports;
+
+       err = mscc_ocelot_init_ports(pdev, ports);
+       if (err)
+               goto out_put_ports;
+
        if (ocelot->ptp) {
                err = ocelot_init_timestamp(ocelot, &ocelot_ptp_clock_info);
                if (err) {
@@ -1008,96 +1138,6 @@ static int mscc_ocelot_probe(struct platform_device *pdev)
                }
        }
 
-       /* No NPI port */
-       ocelot_configure_cpu(ocelot, -1, OCELOT_TAG_PREFIX_NONE,
-                            OCELOT_TAG_PREFIX_NONE);
-
-       for_each_available_child_of_node(ports, portnp) {
-               struct ocelot_port_private *priv;
-               struct ocelot_port *ocelot_port;
-               struct device_node *phy_node;
-               phy_interface_t phy_mode;
-               struct phy_device *phy;
-               struct regmap *target;
-               struct resource *res;
-               struct phy *serdes;
-               char res_name[8];
-               u32 port;
-
-               if (of_property_read_u32(portnp, "reg", &port))
-                       continue;
-
-               snprintf(res_name, sizeof(res_name), "port%d", port);
-
-               res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
-                                                  res_name);
-               target = ocelot_regmap_init(ocelot, res);
-               if (IS_ERR(target))
-                       continue;
-
-               phy_node = of_parse_phandle(portnp, "phy-handle", 0);
-               if (!phy_node)
-                       continue;
-
-               phy = of_phy_find_device(phy_node);
-               of_node_put(phy_node);
-               if (!phy)
-                       continue;
-
-               err = ocelot_probe_port(ocelot, port, target, phy);
-               if (err) {
-                       of_node_put(portnp);
-                       goto out_put_ports;
-               }
-
-               ocelot_port = ocelot->ports[port];
-               priv = container_of(ocelot_port, struct ocelot_port_private,
-                                   port);
-
-               of_get_phy_mode(portnp, &phy_mode);
-
-               ocelot_port->phy_mode = phy_mode;
-
-               switch (ocelot_port->phy_mode) {
-               case PHY_INTERFACE_MODE_NA:
-                       continue;
-               case PHY_INTERFACE_MODE_SGMII:
-                       break;
-               case PHY_INTERFACE_MODE_QSGMII:
-                       /* Ensure clock signals and speed is set on all
-                        * QSGMII links
-                        */
-                       ocelot_port_writel(ocelot_port,
-                                          DEV_CLOCK_CFG_LINK_SPEED
-                                          (OCELOT_SPEED_1000),
-                                          DEV_CLOCK_CFG);
-                       break;
-               default:
-                       dev_err(ocelot->dev,
-                               "invalid phy mode for port%d, (Q)SGMII only\n",
-                               port);
-                       of_node_put(portnp);
-                       err = -EINVAL;
-                       goto out_put_ports;
-               }
-
-               serdes = devm_of_phy_get(ocelot->dev, portnp, NULL);
-               if (IS_ERR(serdes)) {
-                       err = PTR_ERR(serdes);
-                       if (err == -EPROBE_DEFER)
-                               dev_dbg(ocelot->dev, "deferring probe\n");
-                       else
-                               dev_err(ocelot->dev,
-                                       "missing SerDes phys for port%d\n",
-                                       port);
-
-                       of_node_put(portnp);
-                       goto out_put_ports;
-               }
-
-               priv->serdes = serdes;
-       }
-
        register_netdevice_notifier(&ocelot_netdevice_nb);
        register_switchdev_notifier(&ocelot_switchdev_nb);
        register_switchdev_blocking_notifier(&ocelot_switchdev_blocking_nb);
@@ -1114,6 +1154,7 @@ static int mscc_ocelot_remove(struct platform_device *pdev)
        struct ocelot *ocelot = platform_get_drvdata(pdev);
 
        ocelot_deinit_timestamp(ocelot);
+       mscc_ocelot_release_ports(ocelot);
        ocelot_deinit(ocelot);
        unregister_switchdev_blocking_notifier(&ocelot_switchdev_blocking_nb);
        unregister_switchdev_notifier(&ocelot_switchdev_nb);
index 6eb9fb9..9c9ae33 100644 (file)
@@ -829,8 +829,8 @@ nfp_port_get_fecparam(struct net_device *netdev,
        struct nfp_eth_table_port *eth_port;
        struct nfp_port *port;
 
-       param->active_fec = ETHTOOL_FEC_NONE_BIT;
-       param->fec = ETHTOOL_FEC_NONE_BIT;
+       param->active_fec = ETHTOOL_FEC_NONE;
+       param->fec = ETHTOOL_FEC_NONE;
 
        port = nfp_port_from_netdev(netdev);
        eth_port = nfp_port_get_eth_port(port);
index b8f076e..3db181f 100644 (file)
@@ -4253,7 +4253,8 @@ static int qed_hw_get_nvm_info(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt)
                        cdev->mf_bits = BIT(QED_MF_LLH_MAC_CLSS) |
                                        BIT(QED_MF_LLH_PROTO_CLSS) |
                                        BIT(QED_MF_LL2_NON_UNICAST) |
-                                       BIT(QED_MF_INTER_PF_SWITCH);
+                                       BIT(QED_MF_INTER_PF_SWITCH) |
+                                       BIT(QED_MF_DISABLE_ARFS);
                        break;
                case NVM_CFG1_GLOB_MF_MODE_DEFAULT:
                        cdev->mf_bits = BIT(QED_MF_LLH_MAC_CLSS) |
@@ -4266,6 +4267,14 @@ static int qed_hw_get_nvm_info(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt)
 
                DP_INFO(p_hwfn, "Multi function mode is 0x%lx\n",
                        cdev->mf_bits);
+
+               /* In CMT the PF is unknown when the GFS block processes the
+                * packet. Therefore cannot use searcher as it has a per PF
+                * database, and thus ARFS must be disabled.
+                *
+                */
+               if (QED_IS_CMT(cdev))
+                       cdev->mf_bits |= BIT(QED_MF_DISABLE_ARFS);
        }
 
        DP_INFO(p_hwfn, "Multi function mode is 0x%lx\n",
index 4c6ac88..07824bf 100644 (file)
@@ -1980,6 +1980,9 @@ void qed_arfs_mode_configure(struct qed_hwfn *p_hwfn,
                             struct qed_ptt *p_ptt,
                             struct qed_arfs_config_params *p_cfg_params)
 {
+       if (test_bit(QED_MF_DISABLE_ARFS, &p_hwfn->cdev->mf_bits))
+               return;
+
        if (p_cfg_params->mode != QED_FILTER_CONFIG_MODE_DISABLE) {
                qed_gft_config(p_hwfn, p_ptt, p_hwfn->rel_pf_id,
                               p_cfg_params->tcp,
index f39f629..50e5eb2 100644 (file)
@@ -444,6 +444,8 @@ int qed_fill_dev_info(struct qed_dev *cdev,
                dev_info->fw_eng = FW_ENGINEERING_VERSION;
                dev_info->b_inter_pf_switch = test_bit(QED_MF_INTER_PF_SWITCH,
                                                       &cdev->mf_bits);
+               if (!test_bit(QED_MF_DISABLE_ARFS, &cdev->mf_bits))
+                       dev_info->b_arfs_capable = true;
                dev_info->tx_switching = true;
 
                if (hw_info->b_wol_support == QED_WOL_SUPPORT_PME)
index f1f75b6..b8dc5c4 100644 (file)
@@ -71,6 +71,7 @@ static int qed_sp_vf_start(struct qed_hwfn *p_hwfn, struct qed_vf_info *p_vf)
                p_ramrod->personality = PERSONALITY_ETH;
                break;
        case QED_PCI_ETH_ROCE:
+       case QED_PCI_ETH_IWARP:
                p_ramrod->personality = PERSONALITY_RDMA_AND_ETH;
                break;
        default:
index f961f65..c59b72c 100644 (file)
@@ -311,6 +311,9 @@ int qede_alloc_arfs(struct qede_dev *edev)
 {
        int i;
 
+       if (!edev->dev_info.common.b_arfs_capable)
+               return -EINVAL;
+
        edev->arfs = vzalloc(sizeof(*edev->arfs));
        if (!edev->arfs)
                return -ENOMEM;
index 140a392..9e1f41b 100644 (file)
@@ -804,7 +804,7 @@ static void qede_init_ndev(struct qede_dev *edev)
                      NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
                      NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_HW_TC;
 
-       if (!IS_VF(edev) && edev->dev_info.common.num_hwfns == 1)
+       if (edev->dev_info.common.b_arfs_capable)
                hw_features |= NETIF_F_NTUPLE;
 
        if (edev->dev_info.common.vxlan_enable ||
@@ -2274,7 +2274,7 @@ static void qede_unload(struct qede_dev *edev, enum qede_unload_mode mode,
        qede_vlan_mark_nonconfigured(edev);
        edev->ops->fastpath_stop(edev->cdev);
 
-       if (!IS_VF(edev) && edev->dev_info.common.num_hwfns == 1) {
+       if (edev->dev_info.common.b_arfs_capable) {
                qede_poll_for_freeing_arfs_filters(edev);
                qede_free_arfs(edev);
        }
@@ -2341,10 +2341,9 @@ static int qede_load(struct qede_dev *edev, enum qede_load_mode mode,
        if (rc)
                goto err2;
 
-       if (!IS_VF(edev) && edev->dev_info.common.num_hwfns == 1) {
-               rc = qede_alloc_arfs(edev);
-               if (rc)
-                       DP_NOTICE(edev, "aRFS memory allocation failed\n");
+       if (qede_alloc_arfs(edev)) {
+               edev->ndev->features &= ~NETIF_F_NTUPLE;
+               edev->dev_info.common.b_arfs_capable = false;
        }
 
        qede_napi_add_enable(edev);
index c54b7f8..ffdb367 100644 (file)
@@ -490,6 +490,7 @@ static int ef100_pci_probe(struct pci_dev *pci_dev,
        if (fcw.offset > pci_resource_len(efx->pci_dev, fcw.bar) - ESE_GZ_FCW_LEN) {
                netif_err(efx, probe, efx->net_dev,
                          "Func control window overruns BAR\n");
+               rc = -EIO;
                goto fail;
        }
 
index 8ed7857..15672d0 100644 (file)
@@ -17,6 +17,7 @@
 #include <linux/phy.h>
 #include <linux/phy/phy.h>
 #include <linux/delay.h>
+#include <linux/pinctrl/consumer.h>
 #include <linux/pm_runtime.h>
 #include <linux/gpio/consumer.h>
 #include <linux/of.h>
@@ -2070,9 +2071,61 @@ static int cpsw_remove(struct platform_device *pdev)
        return 0;
 }
 
+static int __maybe_unused cpsw_suspend(struct device *dev)
+{
+       struct cpsw_common *cpsw = dev_get_drvdata(dev);
+       int i;
+
+       rtnl_lock();
+
+       for (i = 0; i < cpsw->data.slaves; i++) {
+               struct net_device *ndev = cpsw->slaves[i].ndev;
+
+               if (!(ndev && netif_running(ndev)))
+                       continue;
+
+               cpsw_ndo_stop(ndev);
+       }
+
+       rtnl_unlock();
+
+       /* Select sleep pin state */
+       pinctrl_pm_select_sleep_state(dev);
+
+       return 0;
+}
+
+static int __maybe_unused cpsw_resume(struct device *dev)
+{
+       struct cpsw_common *cpsw = dev_get_drvdata(dev);
+       int i;
+
+       /* Select default pin state */
+       pinctrl_pm_select_default_state(dev);
+
+       /* shut up ASSERT_RTNL() warning in netif_set_real_num_tx/rx_queues */
+       rtnl_lock();
+
+       for (i = 0; i < cpsw->data.slaves; i++) {
+               struct net_device *ndev = cpsw->slaves[i].ndev;
+
+               if (!(ndev && netif_running(ndev)))
+                       continue;
+
+               cpsw_ndo_open(ndev);
+       }
+
+       rtnl_unlock();
+
+       return 0;
+}
+
+static SIMPLE_DEV_PM_OPS(cpsw_pm_ops, cpsw_suspend, cpsw_resume);
+
 static struct platform_driver cpsw_driver = {
        .driver = {
                .name    = "cpsw-switch",
+               .pm      = &cpsw_pm_ops,
                .of_match_table = cpsw_of_mtable,
        },
        .probe = cpsw_probe,
index c71f994..974a244 100644 (file)
@@ -777,7 +777,8 @@ static struct rtable *geneve_get_v4_rt(struct sk_buff *skb,
                                       struct net_device *dev,
                                       struct geneve_sock *gs4,
                                       struct flowi4 *fl4,
-                                      const struct ip_tunnel_info *info)
+                                      const struct ip_tunnel_info *info,
+                                      __be16 dport, __be16 sport)
 {
        bool use_cache = ip_tunnel_dst_cache_usable(skb, info);
        struct geneve_dev *geneve = netdev_priv(dev);
@@ -793,6 +794,8 @@ static struct rtable *geneve_get_v4_rt(struct sk_buff *skb,
        fl4->flowi4_proto = IPPROTO_UDP;
        fl4->daddr = info->key.u.ipv4.dst;
        fl4->saddr = info->key.u.ipv4.src;
+       fl4->fl4_dport = dport;
+       fl4->fl4_sport = sport;
 
        tos = info->key.tos;
        if ((tos == 1) && !geneve->cfg.collect_md) {
@@ -827,7 +830,8 @@ static struct dst_entry *geneve_get_v6_dst(struct sk_buff *skb,
                                           struct net_device *dev,
                                           struct geneve_sock *gs6,
                                           struct flowi6 *fl6,
-                                          const struct ip_tunnel_info *info)
+                                          const struct ip_tunnel_info *info,
+                                          __be16 dport, __be16 sport)
 {
        bool use_cache = ip_tunnel_dst_cache_usable(skb, info);
        struct geneve_dev *geneve = netdev_priv(dev);
@@ -843,6 +847,9 @@ static struct dst_entry *geneve_get_v6_dst(struct sk_buff *skb,
        fl6->flowi6_proto = IPPROTO_UDP;
        fl6->daddr = info->key.u.ipv6.dst;
        fl6->saddr = info->key.u.ipv6.src;
+       fl6->fl6_dport = dport;
+       fl6->fl6_sport = sport;
+
        prio = info->key.tos;
        if ((prio == 1) && !geneve->cfg.collect_md) {
                prio = ip_tunnel_get_dsfield(ip_hdr(skb), skb);
@@ -889,7 +896,9 @@ static int geneve_xmit_skb(struct sk_buff *skb, struct net_device *dev,
        __be16 sport;
        int err;
 
-       rt = geneve_get_v4_rt(skb, dev, gs4, &fl4, info);
+       sport = udp_flow_src_port(geneve->net, skb, 1, USHRT_MAX, true);
+       rt = geneve_get_v4_rt(skb, dev, gs4, &fl4, info,
+                             geneve->cfg.info.key.tp_dst, sport);
        if (IS_ERR(rt))
                return PTR_ERR(rt);
 
@@ -919,7 +928,6 @@ static int geneve_xmit_skb(struct sk_buff *skb, struct net_device *dev,
                return -EMSGSIZE;
        }
 
-       sport = udp_flow_src_port(geneve->net, skb, 1, USHRT_MAX, true);
        if (geneve->cfg.collect_md) {
                tos = ip_tunnel_ecn_encap(key->tos, ip_hdr(skb), skb);
                ttl = key->ttl;
@@ -974,7 +982,9 @@ static int geneve6_xmit_skb(struct sk_buff *skb, struct net_device *dev,
        __be16 sport;
        int err;
 
-       dst = geneve_get_v6_dst(skb, dev, gs6, &fl6, info);
+       sport = udp_flow_src_port(geneve->net, skb, 1, USHRT_MAX, true);
+       dst = geneve_get_v6_dst(skb, dev, gs6, &fl6, info,
+                               geneve->cfg.info.key.tp_dst, sport);
        if (IS_ERR(dst))
                return PTR_ERR(dst);
 
@@ -1003,7 +1013,6 @@ static int geneve6_xmit_skb(struct sk_buff *skb, struct net_device *dev,
                return -EMSGSIZE;
        }
 
-       sport = udp_flow_src_port(geneve->net, skb, 1, USHRT_MAX, true);
        if (geneve->cfg.collect_md) {
                prio = ip_tunnel_ecn_encap(key->tos, ip_hdr(skb), skb);
                ttl = key->ttl;
@@ -1085,13 +1094,18 @@ static int geneve_fill_metadata_dst(struct net_device *dev, struct sk_buff *skb)
 {
        struct ip_tunnel_info *info = skb_tunnel_info(skb);
        struct geneve_dev *geneve = netdev_priv(dev);
+       __be16 sport;
 
        if (ip_tunnel_info_af(info) == AF_INET) {
                struct rtable *rt;
                struct flowi4 fl4;
+
                struct geneve_sock *gs4 = rcu_dereference(geneve->sock4);
+               sport = udp_flow_src_port(geneve->net, skb,
+                                         1, USHRT_MAX, true);
 
-               rt = geneve_get_v4_rt(skb, dev, gs4, &fl4, info);
+               rt = geneve_get_v4_rt(skb, dev, gs4, &fl4, info,
+                                     geneve->cfg.info.key.tp_dst, sport);
                if (IS_ERR(rt))
                        return PTR_ERR(rt);
 
@@ -1101,9 +1115,13 @@ static int geneve_fill_metadata_dst(struct net_device *dev, struct sk_buff *skb)
        } else if (ip_tunnel_info_af(info) == AF_INET6) {
                struct dst_entry *dst;
                struct flowi6 fl6;
+
                struct geneve_sock *gs6 = rcu_dereference(geneve->sock6);
+               sport = udp_flow_src_port(geneve->net, skb,
+                                         1, USHRT_MAX, true);
 
-               dst = geneve_get_v6_dst(skb, dev, gs6, &fl6, info);
+               dst = geneve_get_v6_dst(skb, dev, gs6, &fl6, info,
+                                       geneve->cfg.info.key.tp_dst, sport);
                if (IS_ERR(dst))
                        return PTR_ERR(dst);
 
@@ -1114,8 +1132,7 @@ static int geneve_fill_metadata_dst(struct net_device *dev, struct sk_buff *skb)
                return -EINVAL;
        }
 
-       info->key.tp_src = udp_flow_src_port(geneve->net, skb,
-                                            1, USHRT_MAX, true);
+       info->key.tp_src = sport;
        info->key.tp_dst = geneve->cfg.info.key.tp_dst;
        return 0;
 }
index 2181d45..a0f338c 100644 (file)
@@ -847,6 +847,10 @@ struct nvsp_message {
 
 #define NETVSC_XDP_HDRM 256
 
+#define NETVSC_XFER_HEADER_SIZE(rng_cnt) \
+               (offsetof(struct vmtransfer_page_packet_header, ranges) + \
+               (rng_cnt) * sizeof(struct vmtransfer_page_range))
+
 struct multi_send_data {
        struct sk_buff *skb; /* skb containing the pkt */
        struct hv_netvsc_packet *pkt; /* netvsc pkt pending */
@@ -974,6 +978,9 @@ struct net_device_context {
        /* Serial number of the VF to team with */
        u32 vf_serial;
 
+       /* Is the current data path through the VF NIC? */
+       bool  data_path_is_vf;
+
        /* Used to temporarily save the config info across hibernation */
        struct netvsc_device_info *saved_netvsc_dev_info;
 };
index 41f5cf0..5a57d19 100644 (file)
@@ -388,6 +388,15 @@ static int netvsc_init_buf(struct hv_device *device,
        net_device->recv_section_size = resp->sections[0].sub_alloc_size;
        net_device->recv_section_cnt = resp->sections[0].num_sub_allocs;
 
+       /* Ensure buffer will not overflow */
+       if (net_device->recv_section_size < NETVSC_MTU_MIN || (u64)net_device->recv_section_size *
+           (u64)net_device->recv_section_cnt > (u64)buf_size) {
+               netdev_err(ndev, "invalid recv_section_size %u\n",
+                          net_device->recv_section_size);
+               ret = -EINVAL;
+               goto cleanup;
+       }
+
        /* Setup receive completion ring.
         * Add 1 to the recv_section_cnt because at least one entry in a
         * ring buffer has to be empty.
@@ -460,6 +469,12 @@ static int netvsc_init_buf(struct hv_device *device,
        /* Parse the response */
        net_device->send_section_size = init_packet->msg.
                                v1_msg.send_send_buf_complete.section_size;
+       if (net_device->send_section_size < NETVSC_MTU_MIN) {
+               netdev_err(ndev, "invalid send_section_size %u\n",
+                          net_device->send_section_size);
+               ret = -EINVAL;
+               goto cleanup;
+       }
 
        /* Section count is simply the size divided by the section size. */
        net_device->send_section_cnt = buf_size / net_device->send_section_size;
@@ -731,12 +746,49 @@ static void netvsc_send_completion(struct net_device *ndev,
                                   int budget)
 {
        const struct nvsp_message *nvsp_packet = hv_pkt_data(desc);
+       u32 msglen = hv_pkt_datalen(desc);
+
+       /* Ensure packet is big enough to read header fields */
+       if (msglen < sizeof(struct nvsp_message_header)) {
+               netdev_err(ndev, "nvsp_message length too small: %u\n", msglen);
+               return;
+       }
 
        switch (nvsp_packet->hdr.msg_type) {
        case NVSP_MSG_TYPE_INIT_COMPLETE:
+               if (msglen < sizeof(struct nvsp_message_header) +
+                               sizeof(struct nvsp_message_init_complete)) {
+                       netdev_err(ndev, "nvsp_msg length too small: %u\n",
+                                  msglen);
+                       return;
+               }
+               fallthrough;
+
        case NVSP_MSG1_TYPE_SEND_RECV_BUF_COMPLETE:
+               if (msglen < sizeof(struct nvsp_message_header) +
+                               sizeof(struct nvsp_1_message_send_receive_buffer_complete)) {
+                       netdev_err(ndev, "nvsp_msg1 length too small: %u\n",
+                                  msglen);
+                       return;
+               }
+               fallthrough;
+
        case NVSP_MSG1_TYPE_SEND_SEND_BUF_COMPLETE:
+               if (msglen < sizeof(struct nvsp_message_header) +
+                               sizeof(struct nvsp_1_message_send_send_buffer_complete)) {
+                       netdev_err(ndev, "nvsp_msg1 length too small: %u\n",
+                                  msglen);
+                       return;
+               }
+               fallthrough;
+
        case NVSP_MSG5_TYPE_SUBCHANNEL:
+               if (msglen < sizeof(struct nvsp_message_header) +
+                               sizeof(struct nvsp_5_subchannel_complete)) {
+                       netdev_err(ndev, "nvsp_msg5 length too small: %u\n",
+                                  msglen);
+                       return;
+               }
                /* Copy the response back */
                memcpy(&net_device->channel_init_pkt, nvsp_packet,
                       sizeof(struct nvsp_message));
@@ -1117,19 +1169,28 @@ static void enq_receive_complete(struct net_device *ndev,
 static int netvsc_receive(struct net_device *ndev,
                          struct netvsc_device *net_device,
                          struct netvsc_channel *nvchan,
-                         const struct vmpacket_descriptor *desc,
-                         const struct nvsp_message *nvsp)
+                         const struct vmpacket_descriptor *desc)
 {
        struct net_device_context *net_device_ctx = netdev_priv(ndev);
        struct vmbus_channel *channel = nvchan->channel;
        const struct vmtransfer_page_packet_header *vmxferpage_packet
                = container_of(desc, const struct vmtransfer_page_packet_header, d);
+       const struct nvsp_message *nvsp = hv_pkt_data(desc);
+       u32 msglen = hv_pkt_datalen(desc);
        u16 q_idx = channel->offermsg.offer.sub_channel_index;
        char *recv_buf = net_device->recv_buf;
        u32 status = NVSP_STAT_SUCCESS;
        int i;
        int count = 0;
 
+       /* Ensure packet is big enough to read header fields */
+       if (msglen < sizeof(struct nvsp_message_header)) {
+               netif_err(net_device_ctx, rx_err, ndev,
+                         "invalid nvsp header, length too small: %u\n",
+                         msglen);
+               return 0;
+       }
+
        /* Make sure this is a valid nvsp packet */
        if (unlikely(nvsp->hdr.msg_type != NVSP_MSG1_TYPE_SEND_RNDIS_PKT)) {
                netif_err(net_device_ctx, rx_err, ndev,
@@ -1138,6 +1199,14 @@ static int netvsc_receive(struct net_device *ndev,
                return 0;
        }
 
+       /* Validate xfer page pkt header */
+       if ((desc->offset8 << 3) < sizeof(struct vmtransfer_page_packet_header)) {
+               netif_err(net_device_ctx, rx_err, ndev,
+                         "Invalid xfer page pkt, offset too small: %u\n",
+                         desc->offset8 << 3);
+               return 0;
+       }
+
        if (unlikely(vmxferpage_packet->xfer_pageset_id != NETVSC_RECEIVE_BUFFER_ID)) {
                netif_err(net_device_ctx, rx_err, ndev,
                          "Invalid xfer page set id - expecting %x got %x\n",
@@ -1148,6 +1217,14 @@ static int netvsc_receive(struct net_device *ndev,
 
        count = vmxferpage_packet->range_cnt;
 
+       /* Check count for a valid value */
+       if (NETVSC_XFER_HEADER_SIZE(count) > desc->offset8 << 3) {
+               netif_err(net_device_ctx, rx_err, ndev,
+                         "Range count is not valid: %d\n",
+                         count);
+               return 0;
+       }
+
        /* Each range represents 1 RNDIS pkt that contains 1 ethernet frame */
        for (i = 0; i < count; i++) {
                u32 offset = vmxferpage_packet->ranges[i].byte_offset;
@@ -1155,7 +1232,8 @@ static int netvsc_receive(struct net_device *ndev,
                void *data;
                int ret;
 
-               if (unlikely(offset + buflen > net_device->recv_buf_size)) {
+               if (unlikely(offset > net_device->recv_buf_size ||
+                            buflen > net_device->recv_buf_size - offset)) {
                        nvchan->rsc.cnt = 0;
                        status = NVSP_STAT_FAIL;
                        netif_err(net_device_ctx, rx_err, ndev,
@@ -1194,6 +1272,13 @@ static void netvsc_send_table(struct net_device *ndev,
        u32 count, offset, *tab;
        int i;
 
+       /* Ensure packet is big enough to read send_table fields */
+       if (msglen < sizeof(struct nvsp_message_header) +
+                    sizeof(struct nvsp_5_send_indirect_table)) {
+               netdev_err(ndev, "nvsp_v5_msg length too small: %u\n", msglen);
+               return;
+       }
+
        count = nvmsg->msg.v5_msg.send_table.count;
        offset = nvmsg->msg.v5_msg.send_table.offset;
 
@@ -1225,10 +1310,18 @@ static void netvsc_send_table(struct net_device *ndev,
 }
 
 static void netvsc_send_vf(struct net_device *ndev,
-                          const struct nvsp_message *nvmsg)
+                          const struct nvsp_message *nvmsg,
+                          u32 msglen)
 {
        struct net_device_context *net_device_ctx = netdev_priv(ndev);
 
+       /* Ensure packet is big enough to read its fields */
+       if (msglen < sizeof(struct nvsp_message_header) +
+                    sizeof(struct nvsp_4_send_vf_association)) {
+               netdev_err(ndev, "nvsp_v4_msg length too small: %u\n", msglen);
+               return;
+       }
+
        net_device_ctx->vf_alloc = nvmsg->msg.v4_msg.vf_assoc.allocated;
        net_device_ctx->vf_serial = nvmsg->msg.v4_msg.vf_assoc.serial;
        netdev_info(ndev, "VF slot %u %s\n",
@@ -1238,16 +1331,24 @@ static void netvsc_send_vf(struct net_device *ndev,
 
 static void netvsc_receive_inband(struct net_device *ndev,
                                  struct netvsc_device *nvscdev,
-                                 const struct nvsp_message *nvmsg,
-                                 u32 msglen)
+                                 const struct vmpacket_descriptor *desc)
 {
+       const struct nvsp_message *nvmsg = hv_pkt_data(desc);
+       u32 msglen = hv_pkt_datalen(desc);
+
+       /* Ensure packet is big enough to read header fields */
+       if (msglen < sizeof(struct nvsp_message_header)) {
+               netdev_err(ndev, "inband nvsp_message length too small: %u\n", msglen);
+               return;
+       }
+
        switch (nvmsg->hdr.msg_type) {
        case NVSP_MSG5_TYPE_SEND_INDIRECTION_TABLE:
                netvsc_send_table(ndev, nvscdev, nvmsg, msglen);
                break;
 
        case NVSP_MSG4_TYPE_SEND_VF_ASSOCIATION:
-               netvsc_send_vf(ndev, nvmsg);
+               netvsc_send_vf(ndev, nvmsg, msglen);
                break;
        }
 }
@@ -1261,23 +1362,20 @@ static int netvsc_process_raw_pkt(struct hv_device *device,
 {
        struct vmbus_channel *channel = nvchan->channel;
        const struct nvsp_message *nvmsg = hv_pkt_data(desc);
-       u32 msglen = hv_pkt_datalen(desc);
 
        trace_nvsp_recv(ndev, channel, nvmsg);
 
        switch (desc->type) {
        case VM_PKT_COMP:
-               netvsc_send_completion(ndev, net_device, channel,
-                                      desc, budget);
+               netvsc_send_completion(ndev, net_device, channel, desc, budget);
                break;
 
        case VM_PKT_DATA_USING_XFER_PAGES:
-               return netvsc_receive(ndev, net_device, nvchan,
-                                     desc, nvmsg);
+               return netvsc_receive(ndev, net_device, nvchan, desc);
                break;
 
        case VM_PKT_DATA_INBAND:
-               netvsc_receive_inband(ndev, net_device, nvmsg, msglen);
+               netvsc_receive_inband(ndev, net_device, desc);
                break;
 
        default:
index 64b0a74..9869e39 100644 (file)
@@ -748,6 +748,13 @@ void netvsc_linkstatus_callback(struct net_device *net,
        struct netvsc_reconfig *event;
        unsigned long flags;
 
+       /* Ensure the packet is big enough to access its fields */
+       if (resp->msg_len - RNDIS_HEADER_SIZE < sizeof(struct rndis_indicate_status)) {
+               netdev_err(net, "invalid rndis_indicate_status packet, len: %u\n",
+                          resp->msg_len);
+               return;
+       }
+
        /* Update the physical link speed when changing to another vSwitch */
        if (indicate->status == RNDIS_STATUS_LINK_SPEED_CHANGE) {
                u32 speed;
@@ -2366,7 +2373,16 @@ static int netvsc_register_vf(struct net_device *vf_netdev)
        return NOTIFY_OK;
 }
 
-/* VF up/down change detected, schedule to change data path */
+/* Change the data path when VF UP/DOWN/CHANGE are detected.
+ *
+ * Typically a UP or DOWN event is followed by a CHANGE event, so
+ * net_device_ctx->data_path_is_vf is used to cache the current data path
+ * to avoid the duplicate call of netvsc_switch_datapath() and the duplicate
+ * message.
+ *
+ * During hibernation, if a VF NIC driver (e.g. mlx5) preserves the network
+ * interface, there is only the CHANGE event and no UP or DOWN event.
+ */
 static int netvsc_vf_changed(struct net_device *vf_netdev)
 {
        struct net_device_context *net_device_ctx;
@@ -2383,6 +2399,10 @@ static int netvsc_vf_changed(struct net_device *vf_netdev)
        if (!netvsc_dev)
                return NOTIFY_DONE;
 
+       if (net_device_ctx->data_path_is_vf == vf_is_up)
+               return NOTIFY_OK;
+       net_device_ctx->data_path_is_vf = vf_is_up;
+
        netvsc_switch_datapath(ndev, vf_is_up);
        netdev_info(ndev, "Data path switched %s VF: %s\n",
                    vf_is_up ? "to" : "from", vf_netdev->name);
@@ -2587,8 +2607,8 @@ static int netvsc_remove(struct hv_device *dev)
 static int netvsc_suspend(struct hv_device *dev)
 {
        struct net_device_context *ndev_ctx;
-       struct net_device *vf_netdev, *net;
        struct netvsc_device *nvdev;
+       struct net_device *net;
        int ret;
 
        net = hv_get_drvdata(dev);
@@ -2604,10 +2624,6 @@ static int netvsc_suspend(struct hv_device *dev)
                goto out;
        }
 
-       vf_netdev = rtnl_dereference(ndev_ctx->vf_netdev);
-       if (vf_netdev)
-               netvsc_unregister_vf(vf_netdev);
-
        /* Save the current config info */
        ndev_ctx->saved_netvsc_dev_info = netvsc_devinfo_get(nvdev);
 
@@ -2628,6 +2644,12 @@ static int netvsc_resume(struct hv_device *dev)
        rtnl_lock();
 
        net_device_ctx = netdev_priv(net);
+
+       /* Reset the data path to the netvsc NIC before re-opening the vmbus
+        * channel. Later netvsc_netdev_event() will switch the data path to
+        * the VF upon the UP or CHANGE event.
+        */
+       net_device_ctx->data_path_is_vf = false;
        device_info = net_device_ctx->saved_netvsc_dev_info;
 
        ret = netvsc_attach(net, device_info);
@@ -2695,6 +2717,7 @@ static int netvsc_netdev_event(struct notifier_block *this,
                return netvsc_unregister_vf(event_dev);
        case NETDEV_UP:
        case NETDEV_DOWN:
+       case NETDEV_CHANGE:
                return netvsc_vf_changed(event_dev);
        default:
                return NOTIFY_DONE;
index b81ceba..12ad471 100644 (file)
@@ -275,6 +275,16 @@ static void rndis_filter_receive_response(struct net_device *ndev,
                return;
        }
 
+       /* Ensure the packet is big enough to read req_id. Req_id is the 1st
+        * field in any request/response message, so the payload should have at
+        * least sizeof(u32) bytes
+        */
+       if (resp->msg_len - RNDIS_HEADER_SIZE < sizeof(u32)) {
+               netdev_err(ndev, "rndis msg_len too small: %u\n",
+                          resp->msg_len);
+               return;
+       }
+
        spin_lock_irqsave(&dev->request_lock, flags);
        list_for_each_entry(request, &dev->req_list, list_ent) {
                /*
@@ -331,8 +341,9 @@ static void rndis_filter_receive_response(struct net_device *ndev,
  * Get the Per-Packet-Info with the specified type
  * return NULL if not found.
  */
-static inline void *rndis_get_ppi(struct rndis_packet *rpkt,
-                                 u32 type, u8 internal)
+static inline void *rndis_get_ppi(struct net_device *ndev,
+                                 struct rndis_packet *rpkt,
+                                 u32 rpkt_len, u32 type, u8 internal)
 {
        struct rndis_per_packet_info *ppi;
        int len;
@@ -340,11 +351,36 @@ static inline void *rndis_get_ppi(struct rndis_packet *rpkt,
        if (rpkt->per_pkt_info_offset == 0)
                return NULL;
 
+       /* Validate info_offset and info_len */
+       if (rpkt->per_pkt_info_offset < sizeof(struct rndis_packet) ||
+           rpkt->per_pkt_info_offset > rpkt_len) {
+               netdev_err(ndev, "Invalid per_pkt_info_offset: %u\n",
+                          rpkt->per_pkt_info_offset);
+               return NULL;
+       }
+
+       if (rpkt->per_pkt_info_len > rpkt_len - rpkt->per_pkt_info_offset) {
+               netdev_err(ndev, "Invalid per_pkt_info_len: %u\n",
+                          rpkt->per_pkt_info_len);
+               return NULL;
+       }
+
        ppi = (struct rndis_per_packet_info *)((ulong)rpkt +
                rpkt->per_pkt_info_offset);
        len = rpkt->per_pkt_info_len;
 
        while (len > 0) {
+               /* Validate ppi_offset and ppi_size */
+               if (ppi->size > len) {
+                       netdev_err(ndev, "Invalid ppi size: %u\n", ppi->size);
+                       continue;
+               }
+
+               if (ppi->ppi_offset >= ppi->size) {
+                       netdev_err(ndev, "Invalid ppi_offset: %u\n", ppi->ppi_offset);
+                       continue;
+               }
+
                if (ppi->type == type && ppi->internal == internal)
                        return (void *)((ulong)ppi + ppi->ppi_offset);
                len -= ppi->size;
@@ -388,14 +424,29 @@ static int rndis_filter_receive_data(struct net_device *ndev,
        const struct ndis_pkt_8021q_info *vlan;
        const struct rndis_pktinfo_id *pktinfo_id;
        const u32 *hash_info;
-       u32 data_offset;
+       u32 data_offset, rpkt_len;
        void *data;
        bool rsc_more = false;
        int ret;
 
+       /* Ensure data_buflen is big enough to read header fields */
+       if (data_buflen < RNDIS_HEADER_SIZE + sizeof(struct rndis_packet)) {
+               netdev_err(ndev, "invalid rndis pkt, data_buflen too small: %u\n",
+                          data_buflen);
+               return NVSP_STAT_FAIL;
+       }
+
+       /* Validate rndis_pkt offset */
+       if (rndis_pkt->data_offset >= data_buflen - RNDIS_HEADER_SIZE) {
+               netdev_err(ndev, "invalid rndis packet offset: %u\n",
+                          rndis_pkt->data_offset);
+               return NVSP_STAT_FAIL;
+       }
+
        /* Remove the rndis header and pass it back up the stack */
        data_offset = RNDIS_HEADER_SIZE + rndis_pkt->data_offset;
 
+       rpkt_len = data_buflen - RNDIS_HEADER_SIZE;
        data_buflen -= data_offset;
 
        /*
@@ -410,13 +461,13 @@ static int rndis_filter_receive_data(struct net_device *ndev,
                return NVSP_STAT_FAIL;
        }
 
-       vlan = rndis_get_ppi(rndis_pkt, IEEE_8021Q_INFO, 0);
+       vlan = rndis_get_ppi(ndev, rndis_pkt, rpkt_len, IEEE_8021Q_INFO, 0);
 
-       csum_info = rndis_get_ppi(rndis_pkt, TCPIP_CHKSUM_PKTINFO, 0);
+       csum_info = rndis_get_ppi(ndev, rndis_pkt, rpkt_len, TCPIP_CHKSUM_PKTINFO, 0);
 
-       hash_info = rndis_get_ppi(rndis_pkt, NBL_HASH_VALUE, 0);
+       hash_info = rndis_get_ppi(ndev, rndis_pkt, rpkt_len, NBL_HASH_VALUE, 0);
 
-       pktinfo_id = rndis_get_ppi(rndis_pkt, RNDIS_PKTINFO_ID, 1);
+       pktinfo_id = rndis_get_ppi(ndev, rndis_pkt, rpkt_len, RNDIS_PKTINFO_ID, 1);
 
        data = (void *)msg + data_offset;
 
@@ -474,6 +525,14 @@ int rndis_filter_receive(struct net_device *ndev,
        if (netif_msg_rx_status(net_device_ctx))
                dump_rndis_message(ndev, rndis_msg);
 
+       /* Validate incoming rndis_message packet */
+       if (buflen < RNDIS_HEADER_SIZE || rndis_msg->msg_len < RNDIS_HEADER_SIZE ||
+           buflen < rndis_msg->msg_len) {
+               netdev_err(ndev, "Invalid rndis_msg (buflen: %u, msg_len: %u)\n",
+                          buflen, rndis_msg->msg_len);
+               return NVSP_STAT_FAIL;
+       }
+
        switch (rndis_msg->ndis_msg_type) {
        case RNDIS_MSG_PACKET:
                return rndis_filter_receive_data(ndev, net_dev, nvchan,
index c11f32f..7db9cbd 100644 (file)
@@ -882,7 +882,9 @@ static int adf7242_rx(struct adf7242_local *lp)
        int ret;
        u8 lqi, len_u8, *data;
 
-       adf7242_read_reg(lp, 0, &len_u8);
+       ret = adf7242_read_reg(lp, 0, &len_u8);
+       if (ret)
+               return ret;
 
        len = len_u8;
 
index e04c3b6..4eb6470 100644 (file)
@@ -2925,6 +2925,7 @@ static int ca8210_dev_com_init(struct ca8210_priv *priv)
        );
        if (!priv->irq_workqueue) {
                dev_crit(&priv->spi->dev, "alloc of irq_workqueue failed!\n");
+               destroy_workqueue(priv->mlme_workqueue);
                return -ENOMEM;
        }
 
index 2098ca2..b3790aa 100644 (file)
@@ -521,7 +521,7 @@ static void ipa_filter_tuple_zero(struct ipa_endpoint *endpoint)
        val = ioread32(endpoint->ipa->reg_virt + offset);
 
        /* Zero all filter-related fields, preserving the rest */
-       u32_replace_bits(val, 0, IPA_REG_ENDP_FILTER_HASH_MSK_ALL);
+       u32p_replace_bits(&val, 0, IPA_REG_ENDP_FILTER_HASH_MSK_ALL);
 
        iowrite32(val, endpoint->ipa->reg_virt + offset);
 }
@@ -573,7 +573,7 @@ static void ipa_route_tuple_zero(struct ipa *ipa, u32 route_id)
        val = ioread32(ipa->reg_virt + offset);
 
        /* Zero all route-related fields, preserving the rest */
-       u32_replace_bits(val, 0, IPA_REG_ENDP_ROUTER_HASH_MSK_ALL);
+       u32p_replace_bits(&val, 0, IPA_REG_ENDP_ROUTER_HASH_MSK_ALL);
 
        iowrite32(val, ipa->reg_virt + offset);
 }
index 735a806..8947d58 100644 (file)
@@ -996,7 +996,7 @@ void phy_stop(struct phy_device *phydev)
 {
        struct net_device *dev = phydev->attached_dev;
 
-       if (!phy_is_started(phydev)) {
+       if (!phy_is_started(phydev) && phydev->state != PHY_DOWN) {
                WARN(1, "called from state %s\n",
                     phy_state_to_str(phydev->state));
                return;
index 8adfbad..5dab6be 100644 (file)
@@ -1143,10 +1143,6 @@ int phy_init_hw(struct phy_device *phydev)
        if (ret < 0)
                return ret;
 
-       ret = phy_disable_interrupts(phydev);
-       if (ret)
-               return ret;
-
        if (phydev->drv->config_init)
                ret = phydev->drv->config_init(phydev);
 
@@ -1423,6 +1419,10 @@ int phy_attach_direct(struct net_device *dev, struct phy_device *phydev,
        if (err)
                goto error;
 
+       err = phy_disable_interrupts(phydev);
+       if (err)
+               return err;
+
        phy_resume(phydev);
        phy_led_triggers_register(phydev);
 
@@ -1682,7 +1682,8 @@ void phy_detach(struct phy_device *phydev)
 
        phy_led_triggers_unregister(phydev);
 
-       module_put(phydev->mdio.dev.driver->owner);
+       if (phydev->mdio.dev.driver)
+               module_put(phydev->mdio.dev.driver->owner);
 
        /* If the device had no specific driver before (i.e. - it
         * was using the generic driver), we unbind the device
index bd9c078..6fa7a00 100644 (file)
@@ -201,7 +201,7 @@ int rndis_command(struct usbnet *dev, struct rndis_msg_hdr *buf, int buflen)
                        dev_dbg(&info->control->dev,
                                "rndis response error, code %d\n", retval);
                }
-               msleep(20);
+               msleep(40);
        }
        dev_dbg(&info->control->dev, "rndis response timeout\n");
        return -ETIMEDOUT;
index 4441306..cb5898f 100644 (file)
@@ -118,6 +118,7 @@ static void cisco_keepalive_send(struct net_device *dev, u32 type,
        skb_put(skb, sizeof(struct cisco_packet));
        skb->priority = TC_PRIO_CONTROL;
        skb->dev = dev;
+       skb->protocol = htons(ETH_P_HDLC);
        skb_reset_network_header(skb);
 
        dev_queue_xmit(skb);
index 9acad65..d6cfd51 100644 (file)
@@ -433,6 +433,8 @@ static netdev_tx_t pvc_xmit(struct sk_buff *skb, struct net_device *dev)
                        if (pvc->state.fecn) /* TX Congestion counter */
                                dev->stats.tx_compressed++;
                        skb->dev = pvc->frad;
+                       skb->protocol = htons(ETH_P_HDLC);
+                       skb_reset_network_header(skb);
                        dev_queue_xmit(skb);
                        return NETDEV_TX_OK;
                }
@@ -555,6 +557,7 @@ static void fr_lmi_send(struct net_device *dev, int fullrep)
        skb_put(skb, i);
        skb->priority = TC_PRIO_CONTROL;
        skb->dev = dev;
+       skb->protocol = htons(ETH_P_HDLC);
        skb_reset_network_header(skb);
 
        dev_queue_xmit(skb);
@@ -1041,7 +1044,7 @@ static void pvc_setup(struct net_device *dev)
 {
        dev->type = ARPHRD_DLCI;
        dev->flags = IFF_POINTOPOINT;
-       dev->hard_header_len = 10;
+       dev->hard_header_len = 0;
        dev->addr_len = 2;
        netif_keep_dst(dev);
 }
@@ -1093,6 +1096,7 @@ static int fr_add_pvc(struct net_device *frad, unsigned int dlci, int type)
        dev->mtu = HDLC_MAX_MTU;
        dev->min_mtu = 68;
        dev->max_mtu = HDLC_MAX_MTU;
+       dev->needed_headroom = 10;
        dev->priv_flags |= IFF_NO_QUEUE;
        dev->ml_priv = pvc;
 
index 48ced39..64f8556 100644 (file)
@@ -251,6 +251,7 @@ static void ppp_tx_cp(struct net_device *dev, u16 pid, u8 code,
 
        skb->priority = TC_PRIO_CONTROL;
        skb->dev = dev;
+       skb->protocol = htons(ETH_P_HDLC);
        skb_reset_network_header(skb);
        skb_queue_tail(&tx_queue, skb);
 }
@@ -383,11 +384,8 @@ static void ppp_cp_parse_cr(struct net_device *dev, u16 pid, u8 id,
        }
 
        for (opt = data; len; len -= opt[1], opt += opt[1]) {
-               if (len < 2 || len < opt[1]) {
-                       dev->stats.rx_errors++;
-                       kfree(out);
-                       return; /* bad packet, drop silently */
-               }
+               if (len < 2 || opt[1] < 2 || len < opt[1])
+                       goto err_out;
 
                if (pid == PID_LCP)
                        switch (opt[0]) {
@@ -395,6 +393,8 @@ static void ppp_cp_parse_cr(struct net_device *dev, u16 pid, u8 id,
                                continue; /* MRU always OK and > 1500 bytes? */
 
                        case LCP_OPTION_ACCM: /* async control character map */
+                               if (opt[1] < sizeof(valid_accm))
+                                       goto err_out;
                                if (!memcmp(opt, valid_accm,
                                            sizeof(valid_accm)))
                                        continue;
@@ -406,6 +406,8 @@ static void ppp_cp_parse_cr(struct net_device *dev, u16 pid, u8 id,
                                }
                                break;
                        case LCP_OPTION_MAGIC:
+                               if (len < 6)
+                                       goto err_out;
                                if (opt[1] != 6 || (!opt[2] && !opt[3] &&
                                                    !opt[4] && !opt[5]))
                                        break; /* reject invalid magic number */
@@ -424,6 +426,11 @@ static void ppp_cp_parse_cr(struct net_device *dev, u16 pid, u8 id,
                ppp_cp_event(dev, pid, RCR_GOOD, CP_CONF_ACK, id, req_len, data);
 
        kfree(out);
+       return;
+
+err_out:
+       dev->stats.rx_errors++;
+       kfree(out);
 }
 
 static int ppp_rx(struct sk_buff *skb)
index 732a6c1..b6be245 100644 (file)
@@ -198,8 +198,6 @@ static void lapbeth_data_transmit(struct net_device *ndev, struct sk_buff *skb)
        struct net_device *dev;
        int size = skb->len;
 
-       skb->protocol = htons(ETH_P_X25);
-
        ptr = skb_push(skb, 2);
 
        *ptr++ = size % 256;
@@ -210,6 +208,8 @@ static void lapbeth_data_transmit(struct net_device *ndev, struct sk_buff *skb)
 
        skb->dev = dev = lapbeth->ethdev;
 
+       skb->protocol = htons(ETH_P_DEC);
+
        skb_reset_network_header(skb);
 
        dev_hard_header(skb, dev, ETH_P_DEC, bcast_addr, NULL, 0);
index 3dd3b76..c0cfd9b 100644 (file)
@@ -87,15 +87,12 @@ static void handshake_zero(struct noise_handshake *handshake)
 
 void wg_noise_handshake_clear(struct noise_handshake *handshake)
 {
+       down_write(&handshake->lock);
        wg_index_hashtable_remove(
                        handshake->entry.peer->device->index_hashtable,
                        &handshake->entry);
-       down_write(&handshake->lock);
        handshake_zero(handshake);
        up_write(&handshake->lock);
-       wg_index_hashtable_remove(
-                       handshake->entry.peer->device->index_hashtable,
-                       &handshake->entry);
 }
 
 static struct noise_keypair *keypair_create(struct wg_peer *peer)
index e4deb33..f2783aa 100644 (file)
@@ -167,9 +167,13 @@ bool wg_index_hashtable_replace(struct index_hashtable *table,
                                struct index_hashtable_entry *old,
                                struct index_hashtable_entry *new)
 {
-       if (unlikely(hlist_unhashed(&old->index_hash)))
-               return false;
+       bool ret;
+
        spin_lock_bh(&table->lock);
+       ret = !hlist_unhashed(&old->index_hash);
+       if (unlikely(!ret))
+               goto out;
+
        new->index = old->index;
        hlist_replace_rcu(&old->index_hash, &new->index_hash);
 
@@ -180,8 +184,9 @@ bool wg_index_hashtable_replace(struct index_hashtable *table,
         * simply gets dropped, which isn't terrible.
         */
        INIT_HLIST_NODE(&old->index_hash);
+out:
        spin_unlock_bh(&table->lock);
-       return true;
+       return ret;
 }
 
 void wg_index_hashtable_remove(struct index_hashtable *table,
index e8712ad..3c07d1b 100644 (file)
@@ -664,9 +664,15 @@ static void pkt_align(struct sk_buff *p, int len, int align)
 /* To check if there's window offered */
 static bool data_ok(struct brcmf_sdio *bus)
 {
-       /* Reserve TXCTL_CREDITS credits for txctl */
-       return (bus->tx_max - bus->tx_seq) > TXCTL_CREDITS &&
-              ((bus->tx_max - bus->tx_seq) & 0x80) == 0;
+       u8 tx_rsv = 0;
+
+       /* Reserve TXCTL_CREDITS credits for txctl when it is ready to send */
+       if (bus->ctrl_frame_stat)
+               tx_rsv = TXCTL_CREDITS;
+
+       return (bus->tx_max - bus->tx_seq - tx_rsv) != 0 &&
+              ((bus->tx_max - bus->tx_seq - tx_rsv) & 0x80) == 0;
+
 }
 
 /* To check if there's window offered */
index 8047e30..d9f8bdb 100644 (file)
@@ -954,7 +954,7 @@ struct mwifiex_tkip_param {
 struct mwifiex_aes_param {
        u8 pn[WPA_PN_SIZE];
        __le16 key_len;
-       u8 key[WLAN_KEY_LEN_CCMP];
+       u8 key[WLAN_KEY_LEN_CCMP_256];
 } __packed;
 
 struct mwifiex_wapi_param {
index 962d8bf..119ccac 100644 (file)
@@ -619,7 +619,7 @@ static int mwifiex_ret_802_11_key_material_v2(struct mwifiex_private *priv,
        key_v2 = &resp->params.key_material_v2;
 
        len = le16_to_cpu(key_v2->key_param_set.key_params.aes.key_len);
-       if (len > WLAN_KEY_LEN_CCMP)
+       if (len > sizeof(key_v2->key_param_set.key_params.aes.key))
                return -EINVAL;
 
        if (le16_to_cpu(key_v2->action) == HostCmd_ACT_GEN_SET) {
@@ -635,7 +635,7 @@ static int mwifiex_ret_802_11_key_material_v2(struct mwifiex_private *priv,
                return 0;
 
        memset(priv->aes_key_v2.key_param_set.key_params.aes.key, 0,
-              WLAN_KEY_LEN_CCMP);
+              sizeof(key_v2->key_param_set.key_params.aes.key));
        priv->aes_key_v2.key_param_set.key_params.aes.key_len =
                                cpu_to_le16(len);
        memcpy(priv->aes_key_v2.key_param_set.key_params.aes.key,
index d0cbb28..bd316db 100644 (file)
@@ -2128,7 +2128,8 @@ static int mt7615_load_n9(struct mt7615_dev *dev, const char *name)
                 sizeof(dev->mt76.hw->wiphy->fw_version),
                 "%.10s-%.15s", hdr->fw_ver, hdr->build_date);
 
-       if (!strncmp(hdr->fw_ver, "2.0", sizeof(hdr->fw_ver))) {
+       if (!is_mt7615(&dev->mt76) &&
+           !strncmp(hdr->fw_ver, "2.0", sizeof(hdr->fw_ver))) {
                dev->fw_ver = MT7615_FIRMWARE_V2;
                dev->mcu_ops = &sta_update_ops;
        } else {
index e90d008..8d6ceb3 100644 (file)
@@ -699,8 +699,12 @@ void mt7915_unregister_device(struct mt7915_dev *dev)
        spin_lock_bh(&dev->token_lock);
        idr_for_each_entry(&dev->token, txwi, id) {
                mt7915_txp_skb_unmap(&dev->mt76, txwi);
-               if (txwi->skb)
-                       dev_kfree_skb_any(txwi->skb);
+               if (txwi->skb) {
+                       struct ieee80211_hw *hw;
+
+                       hw = mt76_tx_status_get_hw(&dev->mt76, txwi->skb);
+                       ieee80211_free_txskb(hw, txwi->skb);
+               }
                mt76_put_txwi(&dev->mt76, txwi);
        }
        spin_unlock_bh(&dev->token_lock);
index 6825afc..036207f 100644 (file)
@@ -841,7 +841,7 @@ mt7915_tx_complete_status(struct mt76_dev *mdev, struct sk_buff *skb,
        if (sta || !(info->flags & IEEE80211_TX_CTL_NO_ACK))
                mt7915_tx_status(sta, hw, info, NULL);
 
-       dev_kfree_skb(skb);
+       ieee80211_free_txskb(hw, skb);
 }
 
 void mt7915_txp_skb_unmap(struct mt76_dev *dev,
index 9acd8a4..f2609d5 100644 (file)
@@ -458,7 +458,6 @@ enum wl1271_cmd_key_type {
        KEY_TKIP = 2,
        KEY_AES  = 3,
        KEY_GEM  = 4,
-       KEY_IGTK  = 5,
 };
 
 struct wl1271_cmd_set_keys {
index 821ad1a..d2bbd51 100644 (file)
@@ -3559,9 +3559,6 @@ int wlcore_set_key(struct wl1271 *wl, enum set_key_cmd cmd,
        case WL1271_CIPHER_SUITE_GEM:
                key_type = KEY_GEM;
                break;
-       case WLAN_CIPHER_SUITE_AES_CMAC:
-               key_type = KEY_IGTK;
-               break;
        default:
                wl1271_error("Unknown key algo 0x%x", key_conf->cipher);
 
@@ -6231,7 +6228,6 @@ static int wl1271_init_ieee80211(struct wl1271 *wl)
                WLAN_CIPHER_SUITE_TKIP,
                WLAN_CIPHER_SUITE_CCMP,
                WL1271_CIPHER_SUITE_GEM,
-               WLAN_CIPHER_SUITE_AES_CMAC,
        };
 
        /* The tx descriptor buffer */
index 3ed9786..a44d49d 100644 (file)
@@ -73,6 +73,7 @@ config NVME_TCP
        depends on INET
        depends on BLK_DEV_NVME
        select NVME_FABRICS
+       select CRYPTO
        select CRYPTO_CRC32C
        help
          This provides support for the NVMe over Fabrics protocol using
index f3a61a2..8f9d61e 100644 (file)
@@ -3041,7 +3041,7 @@ static int nvme_get_effects_log(struct nvme_ctrl *ctrl, u8 csi,
        if (!cel)
                return -ENOMEM;
 
-       ret = nvme_get_log(ctrl, NVME_NSID_ALL, NVME_LOG_CMD_EFFECTS, 0, csi,
+       ret = nvme_get_log(ctrl, 0x00, NVME_LOG_CMD_EFFECTS, 0, csi,
                        &cel->log, sizeof(cel->log), 0);
        if (ret) {
                kfree(cel);
@@ -3236,8 +3236,11 @@ int nvme_init_identify(struct nvme_ctrl *ctrl)
        if (ret < 0)
                return ret;
 
-       if (!ctrl->identified)
-               nvme_hwmon_init(ctrl);
+       if (!ctrl->identified) {
+               ret = nvme_hwmon_init(ctrl);
+               if (ret < 0)
+                       return ret;
+       }
 
        ctrl->identified = true;
 
@@ -3261,10 +3264,24 @@ static int nvme_dev_open(struct inode *inode, struct file *file)
                return -EWOULDBLOCK;
        }
 
+       nvme_get_ctrl(ctrl);
+       if (!try_module_get(ctrl->ops->module))
+               return -EINVAL;
+
        file->private_data = ctrl;
        return 0;
 }
 
+static int nvme_dev_release(struct inode *inode, struct file *file)
+{
+       struct nvme_ctrl *ctrl =
+               container_of(inode->i_cdev, struct nvme_ctrl, cdev);
+
+       module_put(ctrl->ops->module);
+       nvme_put_ctrl(ctrl);
+       return 0;
+}
+
 static int nvme_dev_user_cmd(struct nvme_ctrl *ctrl, void __user *argp)
 {
        struct nvme_ns *ns;
@@ -3327,6 +3344,7 @@ static long nvme_dev_ioctl(struct file *file, unsigned int cmd,
 static const struct file_operations nvme_dev_fops = {
        .owner          = THIS_MODULE,
        .open           = nvme_dev_open,
+       .release        = nvme_dev_release,
        .unlocked_ioctl = nvme_dev_ioctl,
        .compat_ioctl   = compat_ptr_ioctl,
 };
index e8ef42b..e2e09e2 100644 (file)
@@ -3671,12 +3671,14 @@ nvme_fc_create_ctrl(struct device *dev, struct nvmf_ctrl_options *opts)
        spin_lock_irqsave(&nvme_fc_lock, flags);
        list_for_each_entry(lport, &nvme_fc_lport_list, port_list) {
                if (lport->localport.node_name != laddr.nn ||
-                   lport->localport.port_name != laddr.pn)
+                   lport->localport.port_name != laddr.pn ||
+                   lport->localport.port_state != FC_OBJSTATE_ONLINE)
                        continue;
 
                list_for_each_entry(rport, &lport->endp_list, endp_list) {
                        if (rport->remoteport.node_name != raddr.nn ||
-                           rport->remoteport.port_name != raddr.pn)
+                           rport->remoteport.port_name != raddr.pn ||
+                           rport->remoteport.port_state != FC_OBJSTATE_ONLINE)
                                continue;
 
                        /* if fail to get reference fall through. Will error */
index 412a6c9..552dbc0 100644 (file)
@@ -59,12 +59,8 @@ static int nvme_set_temp_thresh(struct nvme_ctrl *ctrl, int sensor, bool under,
 
 static int nvme_hwmon_get_smart_log(struct nvme_hwmon_data *data)
 {
-       int ret;
-
-       ret = nvme_get_log(data->ctrl, NVME_NSID_ALL, NVME_LOG_SMART, 0,
+       return nvme_get_log(data->ctrl, NVME_NSID_ALL, NVME_LOG_SMART, 0,
                           NVME_CSI_NVM, &data->log, sizeof(data->log), 0);
-
-       return ret <= 0 ? ret : -EIO;
 }
 
 static int nvme_hwmon_read(struct device *dev, enum hwmon_sensor_types type,
@@ -225,7 +221,7 @@ static const struct hwmon_chip_info nvme_hwmon_chip_info = {
        .info   = nvme_hwmon_info,
 };
 
-void nvme_hwmon_init(struct nvme_ctrl *ctrl)
+int nvme_hwmon_init(struct nvme_ctrl *ctrl)
 {
        struct device *dev = ctrl->dev;
        struct nvme_hwmon_data *data;
@@ -234,7 +230,7 @@ void nvme_hwmon_init(struct nvme_ctrl *ctrl)
 
        data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
        if (!data)
-               return;
+               return 0;
 
        data->ctrl = ctrl;
        mutex_init(&data->read_lock);
@@ -244,7 +240,7 @@ void nvme_hwmon_init(struct nvme_ctrl *ctrl)
                dev_warn(ctrl->device,
                        "Failed to read smart log (error %d)\n", err);
                devm_kfree(dev, data);
-               return;
+               return err;
        }
 
        hwmon = devm_hwmon_device_register_with_info(dev, "nvme", data,
@@ -254,4 +250,6 @@ void nvme_hwmon_init(struct nvme_ctrl *ctrl)
                dev_warn(dev, "Failed to instantiate hwmon device\n");
                devm_kfree(dev, data);
        }
+
+       return 0;
 }
index 9fd45ff..2aaedfa 100644 (file)
@@ -827,9 +827,12 @@ static inline struct nvme_ns *nvme_get_ns_from_dev(struct device *dev)
 }
 
 #ifdef CONFIG_NVME_HWMON
-void nvme_hwmon_init(struct nvme_ctrl *ctrl);
+int nvme_hwmon_init(struct nvme_ctrl *ctrl);
 #else
-static inline void nvme_hwmon_init(struct nvme_ctrl *ctrl) { }
+static inline int nvme_hwmon_init(struct nvme_ctrl *ctrl)
+{
+       return 0;
+}
 #endif
 
 u32 nvme_command_effects(struct nvme_ctrl *ctrl, struct nvme_ns *ns,
index 899d2f4..8984796 100644 (file)
@@ -940,13 +940,6 @@ static inline void nvme_handle_cqe(struct nvme_queue *nvmeq, u16 idx)
        struct nvme_completion *cqe = &nvmeq->cqes[idx];
        struct request *req;
 
-       if (unlikely(cqe->command_id >= nvmeq->q_depth)) {
-               dev_warn(nvmeq->dev->ctrl.device,
-                       "invalid id %d completed on queue %d\n",
-                       cqe->command_id, le16_to_cpu(cqe->sq_id));
-               return;
-       }
-
        /*
         * AEN requests are special as they don't time out and can
         * survive any kind of queue freeze and often don't respond to
@@ -960,6 +953,13 @@ static inline void nvme_handle_cqe(struct nvme_queue *nvmeq, u16 idx)
        }
 
        req = blk_mq_tag_to_rq(nvme_queue_tagset(nvmeq), cqe->command_id);
+       if (unlikely(!req)) {
+               dev_warn(nvmeq->dev->ctrl.device,
+                       "invalid id %d completed on queue %d\n",
+                       cqe->command_id, le16_to_cpu(cqe->sq_id));
+               return;
+       }
+
        trace_nvme_sq(req, cqe->sq_head, nvmeq->sq_tail);
        if (!nvme_try_complete_req(req, cqe->status, cqe->result))
                nvme_pci_complete_rq(req);
@@ -3153,7 +3153,8 @@ static const struct pci_device_id nvme_id_table[] = {
        { PCI_VDEVICE(INTEL, 0xf1a5),   /* Intel 600P/P3100 */
                .driver_data = NVME_QUIRK_NO_DEEPEST_PS |
                                NVME_QUIRK_MEDIUM_PRIO_SQ |
-                               NVME_QUIRK_NO_TEMP_THRESH_CHANGE },
+                               NVME_QUIRK_NO_TEMP_THRESH_CHANGE |
+                               NVME_QUIRK_DISABLE_WRITE_ZEROES, },
        { PCI_VDEVICE(INTEL, 0xf1a6),   /* Intel 760p/Pro 7600p */
                .driver_data = NVME_QUIRK_IGNORE_DEV_SUBNQN, },
        { PCI_VDEVICE(INTEL, 0x5845),   /* Qemu emulated controller */
index 8bd7f65..dacfa74 100644 (file)
@@ -517,6 +517,7 @@ int nvmet_passthru_ctrl_enable(struct nvmet_subsys *subsys)
                subsys->ver = NVME_VS(1, 2, 1);
        }
 
+       __module_get(subsys->passthru_ctrl->ops->module);
        mutex_unlock(&subsys->lock);
        return 0;
 
@@ -531,6 +532,7 @@ static void __nvmet_passthru_ctrl_disable(struct nvmet_subsys *subsys)
 {
        if (subsys->passthru_ctrl) {
                xa_erase(&passthru_subsystems, subsys->passthru_ctrl->cntlid);
+               module_put(subsys->passthru_ctrl->ops->module);
                nvme_put_ctrl(subsys->passthru_ctrl);
        }
        subsys->passthru_ctrl = NULL;
index 3ca7543..2483e76 100644 (file)
@@ -703,12 +703,10 @@ static int _generic_set_opp_regulator(struct opp_table *opp_table,
         * Enable the regulator after setting its voltages, otherwise it breaks
         * some boot-enabled regulators.
         */
-       if (unlikely(!opp_table->regulator_enabled)) {
+       if (unlikely(!opp_table->enabled)) {
                ret = regulator_enable(reg);
                if (ret < 0)
                        dev_warn(dev, "Failed to enable regulator: %d", ret);
-               else
-                       opp_table->regulator_enabled = true;
        }
 
        return 0;
@@ -781,29 +779,39 @@ static int _set_opp_custom(const struct opp_table *opp_table,
        return opp_table->set_opp(data);
 }
 
+static int _set_required_opp(struct device *dev, struct device *pd_dev,
+                            struct dev_pm_opp *opp, int i)
+{
+       unsigned int pstate = likely(opp) ? opp->required_opps[i]->pstate : 0;
+       int ret;
+
+       if (!pd_dev)
+               return 0;
+
+       ret = dev_pm_genpd_set_performance_state(pd_dev, pstate);
+       if (ret) {
+               dev_err(dev, "Failed to set performance rate of %s: %d (%d)\n",
+                       dev_name(pd_dev), pstate, ret);
+       }
+
+       return ret;
+}
+
 /* This is only called for PM domain for now */
 static int _set_required_opps(struct device *dev,
                              struct opp_table *opp_table,
-                             struct dev_pm_opp *opp)
+                             struct dev_pm_opp *opp, bool up)
 {
        struct opp_table **required_opp_tables = opp_table->required_opp_tables;
        struct device **genpd_virt_devs = opp_table->genpd_virt_devs;
-       unsigned int pstate;
        int i, ret = 0;
 
        if (!required_opp_tables)
                return 0;
 
        /* Single genpd case */
-       if (!genpd_virt_devs) {
-               pstate = likely(opp) ? opp->required_opps[0]->pstate : 0;
-               ret = dev_pm_genpd_set_performance_state(dev, pstate);
-               if (ret) {
-                       dev_err(dev, "Failed to set performance state of %s: %d (%d)\n",
-                               dev_name(dev), pstate, ret);
-               }
-               return ret;
-       }
+       if (!genpd_virt_devs)
+               return _set_required_opp(dev, dev, opp, 0);
 
        /* Multiple genpd case */
 
@@ -813,19 +821,21 @@ static int _set_required_opps(struct device *dev,
         */
        mutex_lock(&opp_table->genpd_virt_dev_lock);
 
-       for (i = 0; i < opp_table->required_opp_count; i++) {
-               pstate = likely(opp) ? opp->required_opps[i]->pstate : 0;
-
-               if (!genpd_virt_devs[i])
-                       continue;
-
-               ret = dev_pm_genpd_set_performance_state(genpd_virt_devs[i], pstate);
-               if (ret) {
-                       dev_err(dev, "Failed to set performance rate of %s: %d (%d)\n",
-                               dev_name(genpd_virt_devs[i]), pstate, ret);
-                       break;
+       /* Scaling up? Set required OPPs in normal order, else reverse */
+       if (up) {
+               for (i = 0; i < opp_table->required_opp_count; i++) {
+                       ret = _set_required_opp(dev, genpd_virt_devs[i], opp, i);
+                       if (ret)
+                               break;
+               }
+       } else {
+               for (i = opp_table->required_opp_count - 1; i >= 0; i--) {
+                       ret = _set_required_opp(dev, genpd_virt_devs[i], opp, i);
+                       if (ret)
+                               break;
                }
        }
+
        mutex_unlock(&opp_table->genpd_virt_dev_lock);
 
        return ret;
@@ -862,6 +872,34 @@ int dev_pm_opp_set_bw(struct device *dev, struct dev_pm_opp *opp)
 }
 EXPORT_SYMBOL_GPL(dev_pm_opp_set_bw);
 
+static int _opp_set_rate_zero(struct device *dev, struct opp_table *opp_table)
+{
+       int ret;
+
+       if (!opp_table->enabled)
+               return 0;
+
+       /*
+        * Some drivers need to support cases where some platforms may
+        * have OPP table for the device, while others don't and
+        * opp_set_rate() just needs to behave like clk_set_rate().
+        */
+       if (!_get_opp_count(opp_table))
+               return 0;
+
+       ret = _set_opp_bw(opp_table, NULL, dev, true);
+       if (ret)
+               return ret;
+
+       if (opp_table->regulators)
+               regulator_disable(opp_table->regulators[0]);
+
+       ret = _set_required_opps(dev, opp_table, NULL, false);
+
+       opp_table->enabled = false;
+       return ret;
+}
+
 /**
  * dev_pm_opp_set_rate() - Configure new OPP based on frequency
  * @dev:        device for which we do this operation
@@ -888,33 +926,7 @@ int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq)
        }
 
        if (unlikely(!target_freq)) {
-               /*
-                * Some drivers need to support cases where some platforms may
-                * have OPP table for the device, while others don't and
-                * opp_set_rate() just needs to behave like clk_set_rate().
-                */
-               if (!_get_opp_count(opp_table)) {
-                       ret = 0;
-                       goto put_opp_table;
-               }
-
-               if (!opp_table->required_opp_tables && !opp_table->regulators &&
-                   !opp_table->paths) {
-                       dev_err(dev, "target frequency can't be 0\n");
-                       ret = -EINVAL;
-                       goto put_opp_table;
-               }
-
-               ret = _set_opp_bw(opp_table, NULL, dev, true);
-               if (ret)
-                       goto put_opp_table;
-
-               if (opp_table->regulator_enabled) {
-                       regulator_disable(opp_table->regulators[0]);
-                       opp_table->regulator_enabled = false;
-               }
-
-               ret = _set_required_opps(dev, opp_table, NULL);
+               ret = _opp_set_rate_zero(dev, opp_table);
                goto put_opp_table;
        }
 
@@ -933,14 +945,11 @@ int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq)
        old_freq = clk_get_rate(clk);
 
        /* Return early if nothing to do */
-       if (old_freq == freq) {
-               if (!opp_table->required_opp_tables && !opp_table->regulators &&
-                   !opp_table->paths) {
-                       dev_dbg(dev, "%s: old/new frequencies (%lu Hz) are same, nothing to do\n",
-                               __func__, freq);
-                       ret = 0;
-                       goto put_opp_table;
-               }
+       if (opp_table->enabled && old_freq == freq) {
+               dev_dbg(dev, "%s: old/new frequencies (%lu Hz) are same, nothing to do\n",
+                       __func__, freq);
+               ret = 0;
+               goto put_opp_table;
        }
 
        /*
@@ -976,7 +985,7 @@ int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq)
 
        /* Scaling up? Configure required OPPs before frequency */
        if (freq >= old_freq) {
-               ret = _set_required_opps(dev, opp_table, opp);
+               ret = _set_required_opps(dev, opp_table, opp, true);
                if (ret)
                        goto put_opp;
        }
@@ -996,13 +1005,16 @@ int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq)
 
        /* Scaling down? Configure required OPPs after frequency */
        if (!ret && freq < old_freq) {
-               ret = _set_required_opps(dev, opp_table, opp);
+               ret = _set_required_opps(dev, opp_table, opp, false);
                if (ret)
                        dev_err(dev, "Failed to set required opps: %d\n", ret);
        }
 
-       if (!ret)
+       if (!ret) {
                ret = _set_opp_bw(opp_table, opp, dev, false);
+               if (!ret)
+                       opp_table->enabled = true;
+       }
 
 put_opp:
        dev_pm_opp_put(opp);
@@ -1068,7 +1080,7 @@ static struct opp_table *_allocate_opp_table(struct device *dev, int index)
         */
        opp_table = kzalloc(sizeof(*opp_table), GFP_KERNEL);
        if (!opp_table)
-               return NULL;
+               return ERR_PTR(-ENOMEM);
 
        mutex_init(&opp_table->lock);
        mutex_init(&opp_table->genpd_virt_dev_lock);
@@ -1079,8 +1091,8 @@ static struct opp_table *_allocate_opp_table(struct device *dev, int index)
 
        opp_dev = _add_opp_dev(dev, opp_table);
        if (!opp_dev) {
-               kfree(opp_table);
-               return NULL;
+               ret = -ENOMEM;
+               goto err;
        }
 
        _of_init_opp_table(opp_table, dev, index);
@@ -1089,16 +1101,21 @@ static struct opp_table *_allocate_opp_table(struct device *dev, int index)
        opp_table->clk = clk_get(dev, NULL);
        if (IS_ERR(opp_table->clk)) {
                ret = PTR_ERR(opp_table->clk);
-               if (ret != -EPROBE_DEFER)
-                       dev_dbg(dev, "%s: Couldn't find clock: %d\n", __func__,
-                               ret);
+               if (ret == -EPROBE_DEFER)
+                       goto err;
+
+               dev_dbg(dev, "%s: Couldn't find clock: %d\n", __func__, ret);
        }
 
        /* Find interconnect path(s) for the device */
        ret = dev_pm_opp_of_find_icc_paths(dev, opp_table);
-       if (ret)
+       if (ret) {
+               if (ret == -EPROBE_DEFER)
+                       goto err;
+
                dev_warn(dev, "%s: Error finding interconnect paths: %d\n",
                         __func__, ret);
+       }
 
        BLOCKING_INIT_NOTIFIER_HEAD(&opp_table->head);
        INIT_LIST_HEAD(&opp_table->opp_list);
@@ -1107,6 +1124,10 @@ static struct opp_table *_allocate_opp_table(struct device *dev, int index)
        /* Secure the device table modification */
        list_add(&opp_table->node, &opp_tables);
        return opp_table;
+
+err:
+       kfree(opp_table);
+       return ERR_PTR(ret);
 }
 
 void _get_opp_table_kref(struct opp_table *opp_table)
@@ -1129,7 +1150,7 @@ static struct opp_table *_opp_get_opp_table(struct device *dev, int index)
        if (opp_table) {
                if (!_add_opp_dev_unlocked(dev, opp_table)) {
                        dev_pm_opp_put_opp_table(opp_table);
-                       opp_table = NULL;
+                       opp_table = ERR_PTR(-ENOMEM);
                }
                goto unlock;
        }
@@ -1581,8 +1602,8 @@ struct opp_table *dev_pm_opp_set_supported_hw(struct device *dev,
        struct opp_table *opp_table;
 
        opp_table = dev_pm_opp_get_opp_table(dev);
-       if (!opp_table)
-               return ERR_PTR(-ENOMEM);
+       if (IS_ERR(opp_table))
+               return opp_table;
 
        /* Make sure there are no concurrent readers while updating opp_table */
        WARN_ON(!list_empty(&opp_table->opp_list));
@@ -1640,8 +1661,8 @@ struct opp_table *dev_pm_opp_set_prop_name(struct device *dev, const char *name)
        struct opp_table *opp_table;
 
        opp_table = dev_pm_opp_get_opp_table(dev);
-       if (!opp_table)
-               return ERR_PTR(-ENOMEM);
+       if (IS_ERR(opp_table))
+               return opp_table;
 
        /* Make sure there are no concurrent readers while updating opp_table */
        WARN_ON(!list_empty(&opp_table->opp_list));
@@ -1733,8 +1754,8 @@ struct opp_table *dev_pm_opp_set_regulators(struct device *dev,
        int ret, i;
 
        opp_table = dev_pm_opp_get_opp_table(dev);
-       if (!opp_table)
-               return ERR_PTR(-ENOMEM);
+       if (IS_ERR(opp_table))
+               return opp_table;
 
        /* This should be called before OPPs are initialized */
        if (WARN_ON(!list_empty(&opp_table->opp_list))) {
@@ -1804,11 +1825,9 @@ void dev_pm_opp_put_regulators(struct opp_table *opp_table)
        /* Make sure there are no concurrent readers while updating opp_table */
        WARN_ON(!list_empty(&opp_table->opp_list));
 
-       if (opp_table->regulator_enabled) {
+       if (opp_table->enabled) {
                for (i = opp_table->regulator_count - 1; i >= 0; i--)
                        regulator_disable(opp_table->regulators[i]);
-
-               opp_table->regulator_enabled = false;
        }
 
        for (i = opp_table->regulator_count - 1; i >= 0; i--)
@@ -1843,8 +1862,8 @@ struct opp_table *dev_pm_opp_set_clkname(struct device *dev, const char *name)
        int ret;
 
        opp_table = dev_pm_opp_get_opp_table(dev);
-       if (!opp_table)
-               return ERR_PTR(-ENOMEM);
+       if (IS_ERR(opp_table))
+               return opp_table;
 
        /* This should be called before OPPs are initialized */
        if (WARN_ON(!list_empty(&opp_table->opp_list))) {
@@ -1911,8 +1930,8 @@ struct opp_table *dev_pm_opp_register_set_opp_helper(struct device *dev,
                return ERR_PTR(-EINVAL);
 
        opp_table = dev_pm_opp_get_opp_table(dev);
-       if (!opp_table)
-               return ERR_PTR(-ENOMEM);
+       if (!IS_ERR(opp_table))
+               return opp_table;
 
        /* This should be called before OPPs are initialized */
        if (WARN_ON(!list_empty(&opp_table->opp_list))) {
@@ -1949,6 +1968,9 @@ static void _opp_detach_genpd(struct opp_table *opp_table)
 {
        int index;
 
+       if (!opp_table->genpd_virt_devs)
+               return;
+
        for (index = 0; index < opp_table->required_opp_count; index++) {
                if (!opp_table->genpd_virt_devs[index])
                        continue;
@@ -1992,8 +2014,11 @@ struct opp_table *dev_pm_opp_attach_genpd(struct device *dev,
        const char **name = names;
 
        opp_table = dev_pm_opp_get_opp_table(dev);
-       if (!opp_table)
-               return ERR_PTR(-ENOMEM);
+       if (IS_ERR(opp_table))
+               return opp_table;
+
+       if (opp_table->genpd_virt_devs)
+               return opp_table;
 
        /*
         * If the genpd's OPP table isn't already initialized, parsing of the
@@ -2020,12 +2045,6 @@ struct opp_table *dev_pm_opp_attach_genpd(struct device *dev,
                        goto err;
                }
 
-               if (opp_table->genpd_virt_devs[index]) {
-                       dev_err(dev, "Genpd virtual device already set %s\n",
-                               *name);
-                       goto err;
-               }
-
                virt_dev = dev_pm_domain_attach_by_name(dev, *name);
                if (IS_ERR(virt_dev)) {
                        ret = PTR_ERR(virt_dev);
@@ -2098,9 +2117,6 @@ int dev_pm_opp_xlate_performance_state(struct opp_table *src_table,
        int dest_pstate = -EINVAL;
        int i;
 
-       if (!pstate)
-               return 0;
-
        /*
         * Normally the src_table will have the "required_opps" property set to
         * point to one of the OPPs in the dst_table, but in some cases the
@@ -2163,8 +2179,8 @@ int dev_pm_opp_add(struct device *dev, unsigned long freq, unsigned long u_volt)
        int ret;
 
        opp_table = dev_pm_opp_get_opp_table(dev);
-       if (!opp_table)
-               return -ENOMEM;
+       if (IS_ERR(opp_table))
+               return PTR_ERR(opp_table);
 
        /* Fix regulator count for dynamic OPPs */
        opp_table->regulator_count = 1;
@@ -2405,7 +2421,14 @@ int dev_pm_opp_unregister_notifier(struct device *dev,
 }
 EXPORT_SYMBOL(dev_pm_opp_unregister_notifier);
 
-void _dev_pm_opp_find_and_remove_table(struct device *dev)
+/**
+ * dev_pm_opp_remove_table() - Free all OPPs associated with the device
+ * @dev:       device pointer used to lookup OPP table.
+ *
+ * Free both OPPs created using static entries present in DT and the
+ * dynamically added entries.
+ */
+void dev_pm_opp_remove_table(struct device *dev)
 {
        struct opp_table *opp_table;
 
@@ -2432,16 +2455,4 @@ void _dev_pm_opp_find_and_remove_table(struct device *dev)
        /* Drop reference taken by _find_opp_table() */
        dev_pm_opp_put_opp_table(opp_table);
 }
-
-/**
- * dev_pm_opp_remove_table() - Free all OPPs associated with the device
- * @dev:       device pointer used to lookup OPP table.
- *
- * Free both OPPs created using static entries present in DT and the
- * dynamically added entries.
- */
-void dev_pm_opp_remove_table(struct device *dev)
-{
-       _dev_pm_opp_find_and_remove_table(dev);
-}
 EXPORT_SYMBOL_GPL(dev_pm_opp_remove_table);
index b5055cc..5004335 100644 (file)
@@ -124,7 +124,7 @@ void _dev_pm_opp_cpumask_remove_table(const struct cpumask *cpumask,
                        continue;
                }
 
-               _dev_pm_opp_find_and_remove_table(cpu_dev);
+               dev_pm_opp_remove_table(cpu_dev);
        }
 }
 
index 0430290..874b587 100644 (file)
@@ -434,9 +434,9 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_of_find_icc_paths);
 static bool _opp_is_supported(struct device *dev, struct opp_table *opp_table,
                              struct device_node *np)
 {
-       unsigned int count = opp_table->supported_hw_count;
-       u32 version;
-       int ret;
+       unsigned int levels = opp_table->supported_hw_count;
+       int count, versions, ret, i, j;
+       u32 val;
 
        if (!opp_table->supported_hw) {
                /*
@@ -451,21 +451,40 @@ static bool _opp_is_supported(struct device *dev, struct opp_table *opp_table,
                        return true;
        }
 
-       while (count--) {
-               ret = of_property_read_u32_index(np, "opp-supported-hw", count,
-                                                &version);
-               if (ret) {
-                       dev_warn(dev, "%s: failed to read opp-supported-hw property at index %d: %d\n",
-                                __func__, count, ret);
-                       return false;
+       count = of_property_count_u32_elems(np, "opp-supported-hw");
+       if (count <= 0 || count % levels) {
+               dev_err(dev, "%s: Invalid opp-supported-hw property (%d)\n",
+                       __func__, count);
+               return false;
+       }
+
+       versions = count / levels;
+
+       /* All levels in at least one of the versions should match */
+       for (i = 0; i < versions; i++) {
+               bool supported = true;
+
+               for (j = 0; j < levels; j++) {
+                       ret = of_property_read_u32_index(np, "opp-supported-hw",
+                                                        i * levels + j, &val);
+                       if (ret) {
+                               dev_warn(dev, "%s: failed to read opp-supported-hw property at index %d: %d\n",
+                                        __func__, i * levels + j, ret);
+                               return false;
+                       }
+
+                       /* Check if the level is supported */
+                       if (!(val & opp_table->supported_hw[j])) {
+                               supported = false;
+                               break;
+                       }
                }
 
-               /* Both of these are bitwise masks of the versions */
-               if (!(version & opp_table->supported_hw[count]))
-                       return false;
+               if (supported)
+                       return true;
        }
 
-       return true;
+       return false;
 }
 
 static int opp_parse_supplies(struct dev_pm_opp *opp, struct device *dev,
@@ -616,7 +635,7 @@ free_microvolt:
  */
 void dev_pm_opp_of_remove_table(struct device *dev)
 {
-       _dev_pm_opp_find_and_remove_table(dev);
+       dev_pm_opp_remove_table(dev);
 }
 EXPORT_SYMBOL_GPL(dev_pm_opp_of_remove_table);
 
@@ -823,7 +842,7 @@ free_opp:
 static int _of_add_opp_table_v2(struct device *dev, struct opp_table *opp_table)
 {
        struct device_node *np;
-       int ret, count = 0, pstate_count = 0;
+       int ret, count = 0;
        struct dev_pm_opp *opp;
 
        /* OPP table is already initialized for the device */
@@ -857,20 +876,14 @@ static int _of_add_opp_table_v2(struct device *dev, struct opp_table *opp_table)
                goto remove_static_opp;
        }
 
-       list_for_each_entry(opp, &opp_table->opp_list, node)
-               pstate_count += !!opp->pstate;
-
-       /* Either all or none of the nodes shall have performance state set */
-       if (pstate_count && pstate_count != count) {
-               dev_err(dev, "Not all nodes have performance state set (%d: %d)\n",
-                       count, pstate_count);
-               ret = -ENOENT;
-               goto remove_static_opp;
+       list_for_each_entry(opp, &opp_table->opp_list, node) {
+               /* Any non-zero performance state would enable the feature */
+               if (opp->pstate) {
+                       opp_table->genpd_performance_state = true;
+                       break;
+               }
        }
 
-       if (pstate_count)
-               opp_table->genpd_performance_state = true;
-
        return 0;
 
 remove_static_opp:
@@ -886,11 +899,25 @@ static int _of_add_opp_table_v1(struct device *dev, struct opp_table *opp_table)
        const __be32 *val;
        int nr, ret = 0;
 
+       mutex_lock(&opp_table->lock);
+       if (opp_table->parsed_static_opps) {
+               opp_table->parsed_static_opps++;
+               mutex_unlock(&opp_table->lock);
+               return 0;
+       }
+
+       opp_table->parsed_static_opps = 1;
+       mutex_unlock(&opp_table->lock);
+
        prop = of_find_property(dev->of_node, "operating-points", NULL);
-       if (!prop)
-               return -ENODEV;
-       if (!prop->value)
-               return -ENODATA;
+       if (!prop) {
+               ret = -ENODEV;
+               goto remove_static_opp;
+       }
+       if (!prop->value) {
+               ret = -ENODATA;
+               goto remove_static_opp;
+       }
 
        /*
         * Each OPP is a set of tuples consisting of frequency and
@@ -899,13 +926,10 @@ static int _of_add_opp_table_v1(struct device *dev, struct opp_table *opp_table)
        nr = prop->length / sizeof(u32);
        if (nr % 2) {
                dev_err(dev, "%s: Invalid OPP table\n", __func__);
-               return -EINVAL;
+               ret = -EINVAL;
+               goto remove_static_opp;
        }
 
-       mutex_lock(&opp_table->lock);
-       opp_table->parsed_static_opps = 1;
-       mutex_unlock(&opp_table->lock);
-
        val = prop->value;
        while (nr) {
                unsigned long freq = be32_to_cpup(val++) * 1000;
@@ -915,12 +939,14 @@ static int _of_add_opp_table_v1(struct device *dev, struct opp_table *opp_table)
                if (ret) {
                        dev_err(dev, "%s: Failed to add OPP %ld (%d)\n",
                                __func__, freq, ret);
-                       _opp_remove_all_static(opp_table);
-                       return ret;
+                       goto remove_static_opp;
                }
                nr -= 2;
        }
 
+remove_static_opp:
+       _opp_remove_all_static(opp_table);
+
        return ret;
 }
 
@@ -947,8 +973,8 @@ int dev_pm_opp_of_add_table(struct device *dev)
        int ret;
 
        opp_table = dev_pm_opp_get_opp_table_indexed(dev, 0);
-       if (!opp_table)
-               return -ENOMEM;
+       if (IS_ERR(opp_table))
+               return PTR_ERR(opp_table);
 
        /*
         * OPPs have two version of bindings now. Also try the old (v1)
@@ -1002,8 +1028,8 @@ int dev_pm_opp_of_add_table_indexed(struct device *dev, int index)
        }
 
        opp_table = dev_pm_opp_get_opp_table_indexed(dev, index);
-       if (!opp_table)
-               return -ENOMEM;
+       if (IS_ERR(opp_table))
+               return PTR_ERR(opp_table);
 
        ret = _of_add_opp_table_v2(dev, opp_table);
        if (ret)
index c3fcd57..ebd930e 100644 (file)
@@ -147,11 +147,11 @@ enum opp_table_access {
  * @clk: Device's clock handle
  * @regulators: Supply regulators
  * @regulator_count: Number of power supply regulators. Its value can be -1
- * @regulator_enabled: Set to true if regulators were previously enabled.
  * (uninitialized), 0 (no opp-microvolt property) or > 0 (has opp-microvolt
  * property).
  * @paths: Interconnect path handles
  * @path_count: Number of interconnect paths
+ * @enabled: Set to true if the device's resources are enabled/configured.
  * @genpd_performance_state: Device's power domain support performance state.
  * @is_genpd: Marks if the OPP table belongs to a genpd.
  * @set_opp: Platform specific set_opp callback
@@ -195,9 +195,9 @@ struct opp_table {
        struct clk *clk;
        struct regulator **regulators;
        int regulator_count;
-       bool regulator_enabled;
        struct icc_path **paths;
        unsigned int path_count;
+       bool enabled;
        bool genpd_performance_state;
        bool is_genpd;
 
@@ -217,7 +217,6 @@ void _get_opp_table_kref(struct opp_table *opp_table);
 int _get_opp_count(struct opp_table *opp_table);
 struct opp_table *_find_opp_table(struct device *dev);
 struct opp_device *_add_opp_dev(const struct device *dev, struct opp_table *opp_table);
-void _dev_pm_opp_find_and_remove_table(struct device *dev);
 struct dev_pm_opp *_opp_allocate(struct opp_table *opp_table);
 void _opp_free(struct dev_pm_opp *opp);
 int _opp_compare_key(struct dev_pm_opp *opp1, struct dev_pm_opp *opp2);
index 0bb2fb3..9705059 100644 (file)
@@ -71,16 +71,13 @@ static void rockchip_pcie_update_txcredit_mui(struct rockchip_pcie *rockchip)
 static int rockchip_pcie_valid_device(struct rockchip_pcie *rockchip,
                                      struct pci_bus *bus, int dev)
 {
-       /* access only one slot on each root port */
-       if (pci_is_root_bus(bus) && dev > 0)
-               return 0;
-
        /*
-        * do not read more than one device on the bus directly attached
+        * Access only one slot on each root port.
+        * Do not read more than one device on the bus directly attached
         * to RC's downstream side.
         */
-       if (pci_is_root_bus(bus->parent) && dev > 0)
-               return 0;
+       if (pci_is_root_bus(bus) || pci_is_root_bus(bus->parent))
+               return dev == 0;
 
        return 1;
 }
index d5869a0..d9aa551 100644 (file)
@@ -944,6 +944,16 @@ static bool acpi_pci_bridge_d3(struct pci_dev *dev)
        if (!dev->is_hotplug_bridge)
                return false;
 
+       /* Assume D3 support if the bridge is power-manageable by ACPI. */
+       adev = ACPI_COMPANION(&dev->dev);
+       if (!adev && !pci_dev_is_added(dev)) {
+               adev = acpi_pci_find_companion(&dev->dev);
+               ACPI_COMPANION_SET(&dev->dev, adev);
+       }
+
+       if (adev && acpi_device_power_manageable(adev))
+               return true;
+
        /*
         * Look for a special _DSD property for the root port and if it
         * is set we know the hierarchy behind it supports D3 just fine.
index a174b3c..819c49a 100644 (file)
@@ -725,8 +725,10 @@ static int serdes_am654_probe(struct platform_device *pdev)
        pm_runtime_enable(dev);
 
        phy = devm_phy_create(dev, NULL, &ops);
-       if (IS_ERR(phy))
-               return PTR_ERR(phy);
+       if (IS_ERR(phy)) {
+               ret = PTR_ERR(phy);
+               goto clk_err;
+       }
 
        phy_set_drvdata(phy, am654_phy);
        phy_provider = devm_of_phy_provider_register(dev, serdes_am654_xlate);
index 9ef2461..0652109 100644 (file)
@@ -58,6 +58,7 @@
 #define CHV_PADCTRL1_CFGLOCK           BIT(31)
 #define CHV_PADCTRL1_INVRXTX_SHIFT     4
 #define CHV_PADCTRL1_INVRXTX_MASK      GENMASK(7, 4)
+#define CHV_PADCTRL1_INVRXTX_TXDATA    BIT(7)
 #define CHV_PADCTRL1_INVRXTX_RXDATA    BIT(6)
 #define CHV_PADCTRL1_INVRXTX_TXENABLE  BIT(5)
 #define CHV_PADCTRL1_ODEN              BIT(3)
@@ -792,11 +793,22 @@ static int chv_pinmux_set_mux(struct pinctrl_dev *pctldev,
 static void chv_gpio_clear_triggering(struct chv_pinctrl *pctrl,
                                      unsigned int offset)
 {
+       u32 invrxtx_mask = CHV_PADCTRL1_INVRXTX_MASK;
        u32 value;
 
+       /*
+        * One some devices the GPIO should output the inverted value from what
+        * device-drivers / ACPI code expects (inverted external buffer?). The
+        * BIOS makes this work by setting the CHV_PADCTRL1_INVRXTX_TXDATA flag,
+        * preserve this flag if the pin is already setup as GPIO.
+        */
+       value = chv_readl(pctrl, offset, CHV_PADCTRL0);
+       if (value & CHV_PADCTRL0_GPIOEN)
+               invrxtx_mask &= ~CHV_PADCTRL1_INVRXTX_TXDATA;
+
        value = chv_readl(pctrl, offset, CHV_PADCTRL1);
        value &= ~CHV_PADCTRL1_INTWAKECFG_MASK;
-       value &= ~CHV_PADCTRL1_INVRXTX_MASK;
+       value &= ~invrxtx_mask;
        chv_writel(pctrl, offset, CHV_PADCTRL1, value);
 }
 
index 2f3dfb5..35bbe59 100644 (file)
@@ -259,6 +259,10 @@ bool mtk_is_virt_gpio(struct mtk_pinctrl *hw, unsigned int gpio_n)
 
        desc = (const struct mtk_pin_desc *)&hw->soc->pins[gpio_n];
 
+       /* if the GPIO is not supported for eint mode */
+       if (desc->eint.eint_m == NO_EINT_SUPPORT)
+               return virt_gpio;
+
        if (desc->funcs && !desc->funcs[desc->eint.eint_m].name)
                virt_gpio = true;
 
index a767a05..48e2a6c 100644 (file)
@@ -414,7 +414,7 @@ static struct mvebu_mpp_mode mv98dx3236_mpp_modes[] = {
                 MPP_VAR_FUNCTION(0x1, "i2c0", "sck",        V_98DX3236_PLUS)),
        MPP_MODE(15,
                 MPP_VAR_FUNCTION(0x0, "gpio", NULL,         V_98DX3236_PLUS),
-                MPP_VAR_FUNCTION(0x4, "i2c0", "sda",        V_98DX3236_PLUS)),
+                MPP_VAR_FUNCTION(0x1, "i2c0", "sda",        V_98DX3236_PLUS)),
        MPP_MODE(16,
                 MPP_VAR_FUNCTION(0x0, "gpo", NULL,          V_98DX3236_PLUS),
                 MPP_VAR_FUNCTION(0x4, "dev", "oe",          V_98DX3236_PLUS)),
index a660f12..826df0d 100644 (file)
@@ -1308,7 +1308,7 @@ static const struct msm_pingroup sm8250_groups[] = {
        [178] = PINGROUP(178, WEST, _, _, _, _, _, _, _, _, _),
        [179] = PINGROUP(179, WEST, _, _, _, _, _, _, _, _, _),
        [180] = UFS_RESET(ufs_reset, 0xb8000),
-       [181] = SDC_PINGROUP(sdc2_clk, 0x7000, 14, 6),
+       [181] = SDC_PINGROUP(sdc2_clk, 0xb7000, 14, 6),
        [182] = SDC_PINGROUP(sdc2_cmd, 0xb7000, 11, 3),
        [183] = SDC_PINGROUP(sdc2_data, 0xb7000, 9, 0),
 };
index 1bacb37..cd12241 100644 (file)
@@ -42,8 +42,9 @@
 
 #define AXP20X_DCDC2_V_OUT_MASK                GENMASK(5, 0)
 #define AXP20X_DCDC3_V_OUT_MASK                GENMASK(7, 0)
-#define AXP20X_LDO24_V_OUT_MASK                GENMASK(7, 4)
+#define AXP20X_LDO2_V_OUT_MASK         GENMASK(7, 4)
 #define AXP20X_LDO3_V_OUT_MASK         GENMASK(6, 0)
+#define AXP20X_LDO4_V_OUT_MASK         GENMASK(3, 0)
 #define AXP20X_LDO5_V_OUT_MASK         GENMASK(7, 4)
 
 #define AXP20X_PWR_OUT_EXTEN_MASK      BIT_MASK(0)
@@ -542,14 +543,14 @@ static const struct regulator_desc axp20x_regulators[] = {
                 AXP20X_PWR_OUT_CTRL, AXP20X_PWR_OUT_DCDC3_MASK),
        AXP_DESC_FIXED(AXP20X, LDO1, "ldo1", "acin", 1300),
        AXP_DESC(AXP20X, LDO2, "ldo2", "ldo24in", 1800, 3300, 100,
-                AXP20X_LDO24_V_OUT, AXP20X_LDO24_V_OUT_MASK,
+                AXP20X_LDO24_V_OUT, AXP20X_LDO2_V_OUT_MASK,
                 AXP20X_PWR_OUT_CTRL, AXP20X_PWR_OUT_LDO2_MASK),
        AXP_DESC(AXP20X, LDO3, "ldo3", "ldo3in", 700, 3500, 25,
                 AXP20X_LDO3_V_OUT, AXP20X_LDO3_V_OUT_MASK,
                 AXP20X_PWR_OUT_CTRL, AXP20X_PWR_OUT_LDO3_MASK),
        AXP_DESC_RANGES(AXP20X, LDO4, "ldo4", "ldo24in",
                        axp20x_ldo4_ranges, AXP20X_LDO4_V_OUT_NUM_VOLTAGES,
-                       AXP20X_LDO24_V_OUT, AXP20X_LDO24_V_OUT_MASK,
+                       AXP20X_LDO24_V_OUT, AXP20X_LDO4_V_OUT_MASK,
                        AXP20X_PWR_OUT_CTRL, AXP20X_PWR_OUT_LDO4_MASK),
        AXP_DESC_IO(AXP20X, LDO5, "ldo5", "ldo5in", 1800, 3300, 100,
                    AXP20X_LDO5_V_OUT, AXP20X_LDO5_V_OUT_MASK,
index cbb7708..1a44e32 100644 (file)
@@ -40,6 +40,7 @@
 MODULE_LICENSE("GPL");
 
 static struct dasd_discipline dasd_fba_discipline;
+static void *dasd_fba_zero_page;
 
 struct dasd_fba_private {
        struct dasd_fba_characteristics rdc_data;
@@ -270,7 +271,7 @@ static void ccw_write_zero(struct ccw1 *ccw, int count)
        ccw->cmd_code = DASD_FBA_CCW_WRITE;
        ccw->flags |= CCW_FLAG_SLI;
        ccw->count = count;
-       ccw->cda = (__u32) (addr_t) page_to_phys(ZERO_PAGE(0));
+       ccw->cda = (__u32) (addr_t) dasd_fba_zero_page;
 }
 
 /*
@@ -830,6 +831,11 @@ dasd_fba_init(void)
        int ret;
 
        ASCEBC(dasd_fba_discipline.ebcname, 4);
+
+       dasd_fba_zero_page = (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA);
+       if (!dasd_fba_zero_page)
+               return -ENOMEM;
+
        ret = ccw_driver_register(&dasd_fba_driver);
        if (!ret)
                wait_for_device_probe();
@@ -841,6 +847,7 @@ static void __exit
 dasd_fba_cleanup(void)
 {
        ccw_driver_unregister(&dasd_fba_driver);
+       free_page((unsigned long)dasd_fba_zero_page);
 }
 
 module_init(dasd_fba_init);
index 4dbbfd8..f314936 100644 (file)
@@ -1449,7 +1449,8 @@ static long zcrypt_unlocked_ioctl(struct file *filp, unsigned int cmd,
                if (!reqcnt)
                        return -ENOMEM;
                zcrypt_perdev_reqcnt(reqcnt, AP_DEVICES);
-               if (copy_to_user((int __user *) arg, reqcnt, sizeof(reqcnt)))
+               if (copy_to_user((int __user *) arg, reqcnt,
+                                sizeof(u32) * AP_DEVICES))
                        rc = -EFAULT;
                kfree(reqcnt);
                return rc;
index 3a94f6c..6384f7a 100644 (file)
@@ -284,11 +284,11 @@ static void qeth_l2_stop_card(struct qeth_card *card)
 
        if (card->state == CARD_STATE_SOFTSETUP) {
                qeth_clear_ipacmd_list(card);
-               qeth_drain_output_queues(card);
                card->state = CARD_STATE_DOWN;
        }
 
        qeth_qdio_clear_card(card, 0);
+       qeth_drain_output_queues(card);
        qeth_clear_working_pool_list(card);
        flush_workqueue(card->event_wq);
        qeth_flush_local_addrs(card);
index 4d46196..09ef518 100644 (file)
@@ -1168,11 +1168,11 @@ static void qeth_l3_stop_card(struct qeth_card *card)
        if (card->state == CARD_STATE_SOFTSETUP) {
                qeth_l3_clear_ip_htable(card, 1);
                qeth_clear_ipacmd_list(card);
-               qeth_drain_output_queues(card);
                card->state = CARD_STATE_DOWN;
        }
 
        qeth_qdio_clear_card(card, 0);
+       qeth_drain_output_queues(card);
        qeth_clear_working_pool_list(card);
        flush_workqueue(card->event_wq);
        qeth_flush_local_addrs(card);
index b5dd1ca..d10efb6 100644 (file)
@@ -736,6 +736,7 @@ static int iscsi_sw_tcp_conn_get_param(struct iscsi_cls_conn *cls_conn,
        struct iscsi_tcp_conn *tcp_conn = conn->dd_data;
        struct iscsi_sw_tcp_conn *tcp_sw_conn = tcp_conn->dd_data;
        struct sockaddr_in6 addr;
+       struct socket *sock;
        int rc;
 
        switch(param) {
@@ -747,13 +748,17 @@ static int iscsi_sw_tcp_conn_get_param(struct iscsi_cls_conn *cls_conn,
                        spin_unlock_bh(&conn->session->frwd_lock);
                        return -ENOTCONN;
                }
+               sock = tcp_sw_conn->sock;
+               sock_hold(sock->sk);
+               spin_unlock_bh(&conn->session->frwd_lock);
+
                if (param == ISCSI_PARAM_LOCAL_PORT)
-                       rc = kernel_getsockname(tcp_sw_conn->sock,
+                       rc = kernel_getsockname(sock,
                                                (struct sockaddr *)&addr);
                else
-                       rc = kernel_getpeername(tcp_sw_conn->sock,
+                       rc = kernel_getpeername(sock,
                                                (struct sockaddr *)&addr);
-               spin_unlock_bh(&conn->session->frwd_lock);
+               sock_put(sock->sk);
                if (rc < 0)
                        return rc;
 
@@ -775,6 +780,7 @@ static int iscsi_sw_tcp_host_get_param(struct Scsi_Host *shost,
        struct iscsi_tcp_conn *tcp_conn;
        struct iscsi_sw_tcp_conn *tcp_sw_conn;
        struct sockaddr_in6 addr;
+       struct socket *sock;
        int rc;
 
        switch (param) {
@@ -789,16 +795,18 @@ static int iscsi_sw_tcp_host_get_param(struct Scsi_Host *shost,
                        return -ENOTCONN;
                }
                tcp_conn = conn->dd_data;
-
                tcp_sw_conn = tcp_conn->dd_data;
-               if (!tcp_sw_conn->sock) {
+               sock = tcp_sw_conn->sock;
+               if (!sock) {
                        spin_unlock_bh(&session->frwd_lock);
                        return -ENOTCONN;
                }
+               sock_hold(sock->sk);
+               spin_unlock_bh(&session->frwd_lock);
 
-               rc = kernel_getsockname(tcp_sw_conn->sock,
+               rc = kernel_getsockname(sock,
                                        (struct sockaddr *)&addr);
-               spin_unlock_bh(&session->frwd_lock);
+               sock_put(sock->sk);
                if (rc < 0)
                        return rc;
 
index d32c7e7..bb02fd8 100644 (file)
@@ -71,6 +71,7 @@ static void lpfc_disc_timeout_handler(struct lpfc_vport *);
 static void lpfc_disc_flush_list(struct lpfc_vport *vport);
 static void lpfc_unregister_fcfi_cmpl(struct lpfc_hba *, LPFC_MBOXQ_t *);
 static int lpfc_fcf_inuse(struct lpfc_hba *);
+static void lpfc_mbx_cmpl_read_sparam(struct lpfc_hba *, LPFC_MBOXQ_t *);
 
 void
 lpfc_terminate_rport_io(struct fc_rport *rport)
@@ -1138,11 +1139,13 @@ out:
        return;
 }
 
-
 void
 lpfc_mbx_cmpl_local_config_link(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
 {
        struct lpfc_vport *vport = pmb->vport;
+       LPFC_MBOXQ_t *sparam_mb;
+       struct lpfc_dmabuf *sparam_mp;
+       int rc;
 
        if (pmb->u.mb.mbxStatus)
                goto out;
@@ -1167,12 +1170,42 @@ lpfc_mbx_cmpl_local_config_link(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
        }
 
        /* Start discovery by sending a FLOGI. port_state is identically
-        * LPFC_FLOGI while waiting for FLOGI cmpl. Check if sending
-        * the FLOGI is being deferred till after MBX_READ_SPARAM completes.
+        * LPFC_FLOGI while waiting for FLOGI cmpl.
         */
        if (vport->port_state != LPFC_FLOGI) {
-               if (!(phba->hba_flag & HBA_DEFER_FLOGI))
+               /* Issue MBX_READ_SPARAM to update CSPs before FLOGI if
+                * bb-credit recovery is in place.
+                */
+               if (phba->bbcredit_support && phba->cfg_enable_bbcr &&
+                   !(phba->link_flag & LS_LOOPBACK_MODE)) {
+                       sparam_mb = mempool_alloc(phba->mbox_mem_pool,
+                                                 GFP_KERNEL);
+                       if (!sparam_mb)
+                               goto sparam_out;
+
+                       rc = lpfc_read_sparam(phba, sparam_mb, 0);
+                       if (rc) {
+                               mempool_free(sparam_mb, phba->mbox_mem_pool);
+                               goto sparam_out;
+                       }
+                       sparam_mb->vport = vport;
+                       sparam_mb->mbox_cmpl = lpfc_mbx_cmpl_read_sparam;
+                       rc = lpfc_sli_issue_mbox(phba, sparam_mb, MBX_NOWAIT);
+                       if (rc == MBX_NOT_FINISHED) {
+                               sparam_mp = (struct lpfc_dmabuf *)
+                                               sparam_mb->ctx_buf;
+                               lpfc_mbuf_free(phba, sparam_mp->virt,
+                                              sparam_mp->phys);
+                               kfree(sparam_mp);
+                               sparam_mb->ctx_buf = NULL;
+                               mempool_free(sparam_mb, phba->mbox_mem_pool);
+                               goto sparam_out;
+                       }
+
+                       phba->hba_flag |= HBA_DEFER_FLOGI;
+               }  else {
                        lpfc_initial_flogi(vport);
+               }
        } else {
                if (vport->fc_flag & FC_PT2PT)
                        lpfc_disc_start(vport);
@@ -1184,6 +1217,7 @@ out:
                         "0306 CONFIG_LINK mbxStatus error x%x "
                         "HBA state x%x\n",
                         pmb->u.mb.mbxStatus, vport->port_state);
+sparam_out:
        mempool_free(pmb, phba->mbox_mem_pool);
 
        lpfc_linkdown(phba);
@@ -3239,21 +3273,6 @@ lpfc_mbx_process_link_up(struct lpfc_hba *phba, struct lpfc_mbx_read_top *la)
        lpfc_linkup(phba);
        sparam_mbox = NULL;
 
-       if (!(phba->hba_flag & HBA_FCOE_MODE)) {
-               cfglink_mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
-               if (!cfglink_mbox)
-                       goto out;
-               vport->port_state = LPFC_LOCAL_CFG_LINK;
-               lpfc_config_link(phba, cfglink_mbox);
-               cfglink_mbox->vport = vport;
-               cfglink_mbox->mbox_cmpl = lpfc_mbx_cmpl_local_config_link;
-               rc = lpfc_sli_issue_mbox(phba, cfglink_mbox, MBX_NOWAIT);
-               if (rc == MBX_NOT_FINISHED) {
-                       mempool_free(cfglink_mbox, phba->mbox_mem_pool);
-                       goto out;
-               }
-       }
-
        sparam_mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
        if (!sparam_mbox)
                goto out;
@@ -3274,7 +3293,20 @@ lpfc_mbx_process_link_up(struct lpfc_hba *phba, struct lpfc_mbx_read_top *la)
                goto out;
        }
 
-       if (phba->hba_flag & HBA_FCOE_MODE) {
+       if (!(phba->hba_flag & HBA_FCOE_MODE)) {
+               cfglink_mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
+               if (!cfglink_mbox)
+                       goto out;
+               vport->port_state = LPFC_LOCAL_CFG_LINK;
+               lpfc_config_link(phba, cfglink_mbox);
+               cfglink_mbox->vport = vport;
+               cfglink_mbox->mbox_cmpl = lpfc_mbx_cmpl_local_config_link;
+               rc = lpfc_sli_issue_mbox(phba, cfglink_mbox, MBX_NOWAIT);
+               if (rc == MBX_NOT_FINISHED) {
+                       mempool_free(cfglink_mbox, phba->mbox_mem_pool);
+                       goto out;
+               }
+       } else {
                vport->port_state = LPFC_VPORT_UNKNOWN;
                /*
                 * Add the driver's default FCF record at FCF index 0 now. This
@@ -3331,10 +3363,6 @@ lpfc_mbx_process_link_up(struct lpfc_hba *phba, struct lpfc_mbx_read_top *la)
                }
                /* Reset FCF roundrobin bmask for new discovery */
                lpfc_sli4_clear_fcf_rr_bmask(phba);
-       } else {
-               if (phba->bbcredit_support && phba->cfg_enable_bbcr &&
-                   !(phba->link_flag & LS_LOOPBACK_MODE))
-                       phba->hba_flag |= HBA_DEFER_FLOGI;
        }
 
        /* Prepare for LINK up registrations */
index 95018e6..16503e2 100644 (file)
@@ -2964,26 +2964,32 @@ static void sd_read_block_characteristics(struct scsi_disk *sdkp)
 
        if (sdkp->device->type == TYPE_ZBC) {
                /* Host-managed */
-               q->limits.zoned = BLK_ZONED_HM;
+               blk_queue_set_zoned(sdkp->disk, BLK_ZONED_HM);
        } else {
                sdkp->zoned = (buffer[8] >> 4) & 3;
-               if (sdkp->zoned == 1 && !disk_has_partitions(sdkp->disk)) {
+               if (sdkp->zoned == 1) {
                        /* Host-aware */
-                       q->limits.zoned = BLK_ZONED_HA;
+                       blk_queue_set_zoned(sdkp->disk, BLK_ZONED_HA);
                } else {
-                       /*
-                        * Treat drive-managed devices and host-aware devices
-                        * with partitions as regular block devices.
-                        */
-                       q->limits.zoned = BLK_ZONED_NONE;
-                       if (sdkp->zoned == 2 && sdkp->first_scan)
-                               sd_printk(KERN_NOTICE, sdkp,
-                                         "Drive-managed SMR disk\n");
+                       /* Regular disk or drive managed disk */
+                       blk_queue_set_zoned(sdkp->disk, BLK_ZONED_NONE);
                }
        }
-       if (blk_queue_is_zoned(q) && sdkp->first_scan)
+
+       if (!sdkp->first_scan)
+               goto out;
+
+       if (blk_queue_is_zoned(q)) {
                sd_printk(KERN_NOTICE, sdkp, "Host-%s zoned block device\n",
                      q->limits.zoned == BLK_ZONED_HM ? "managed" : "aware");
+       } else {
+               if (sdkp->zoned == 1)
+                       sd_printk(KERN_NOTICE, sdkp,
+                                 "Host-aware SMR disk used as regular disk\n");
+               else if (sdkp->zoned == 2)
+                       sd_printk(KERN_NOTICE, sdkp,
+                                 "Drive-managed SMR disk\n");
+       }
 
  out:
        kfree(buffer);
@@ -3404,10 +3410,6 @@ static int sd_probe(struct device *dev)
        sdkp->first_scan = 1;
        sdkp->max_medium_access_timeouts = SD_MAX_MEDIUM_TIMEOUTS;
 
-       error = sd_zbc_init_disk(sdkp);
-       if (error)
-               goto out_free_index;
-
        sd_revalidate_disk(gd);
 
        gd->flags = GENHD_FL_EXT_DEVT;
index 4933e7d..a3aad60 100644 (file)
@@ -215,7 +215,6 @@ static inline int sd_is_zoned(struct scsi_disk *sdkp)
 
 #ifdef CONFIG_BLK_DEV_ZONED
 
-int sd_zbc_init_disk(struct scsi_disk *sdkp);
 void sd_zbc_release_disk(struct scsi_disk *sdkp);
 int sd_zbc_read_zones(struct scsi_disk *sdkp, unsigned char *buffer);
 int sd_zbc_revalidate_zones(struct scsi_disk *sdkp);
@@ -231,11 +230,6 @@ blk_status_t sd_zbc_prepare_zone_append(struct scsi_cmnd *cmd, sector_t *lba,
 
 #else /* CONFIG_BLK_DEV_ZONED */
 
-static inline int sd_zbc_init_disk(struct scsi_disk *sdkp)
-{
-       return 0;
-}
-
 static inline void sd_zbc_release_disk(struct scsi_disk *sdkp) {}
 
 static inline int sd_zbc_read_zones(struct scsi_disk *sdkp,
@@ -259,7 +253,7 @@ static inline blk_status_t sd_zbc_setup_zone_mgmt_cmnd(struct scsi_cmnd *cmd,
 static inline unsigned int sd_zbc_complete(struct scsi_cmnd *cmd,
                        unsigned int good_bytes, struct scsi_sense_hdr *sshdr)
 {
-       return 0;
+       return good_bytes;
 }
 
 static inline blk_status_t sd_zbc_prepare_zone_append(struct scsi_cmnd *cmd,
index 0e94ff0..cf07b7f 100644 (file)
@@ -651,6 +651,28 @@ static void sd_zbc_print_zones(struct scsi_disk *sdkp)
                          sdkp->zone_blocks);
 }
 
+static int sd_zbc_init_disk(struct scsi_disk *sdkp)
+{
+       sdkp->zones_wp_offset = NULL;
+       spin_lock_init(&sdkp->zones_wp_offset_lock);
+       sdkp->rev_wp_offset = NULL;
+       mutex_init(&sdkp->rev_mutex);
+       INIT_WORK(&sdkp->zone_wp_offset_work, sd_zbc_update_wp_offset_workfn);
+       sdkp->zone_wp_update_buf = kzalloc(SD_BUF_SIZE, GFP_KERNEL);
+       if (!sdkp->zone_wp_update_buf)
+               return -ENOMEM;
+
+       return 0;
+}
+
+void sd_zbc_release_disk(struct scsi_disk *sdkp)
+{
+       kvfree(sdkp->zones_wp_offset);
+       sdkp->zones_wp_offset = NULL;
+       kfree(sdkp->zone_wp_update_buf);
+       sdkp->zone_wp_update_buf = NULL;
+}
+
 static void sd_zbc_revalidate_zones_cb(struct gendisk *disk)
 {
        struct scsi_disk *sdkp = scsi_disk(disk);
@@ -667,7 +689,24 @@ int sd_zbc_revalidate_zones(struct scsi_disk *sdkp)
        u32 max_append;
        int ret = 0;
 
-       if (!sd_is_zoned(sdkp))
+       /*
+        * For all zoned disks, initialize zone append emulation data if not
+        * already done. This is necessary also for host-aware disks used as
+        * regular disks due to the presence of partitions as these partitions
+        * may be deleted and the disk zoned model changed back from
+        * BLK_ZONED_NONE to BLK_ZONED_HA.
+        */
+       if (sd_is_zoned(sdkp) && !sdkp->zone_wp_update_buf) {
+               ret = sd_zbc_init_disk(sdkp);
+               if (ret)
+                       return ret;
+       }
+
+       /*
+        * There is nothing to do for regular disks, including host-aware disks
+        * that have partitions.
+        */
+       if (!blk_queue_is_zoned(q))
                return 0;
 
        /*
@@ -764,28 +803,3 @@ err:
 
        return ret;
 }
-
-int sd_zbc_init_disk(struct scsi_disk *sdkp)
-{
-       if (!sd_is_zoned(sdkp))
-               return 0;
-
-       sdkp->zones_wp_offset = NULL;
-       spin_lock_init(&sdkp->zones_wp_offset_lock);
-       sdkp->rev_wp_offset = NULL;
-       mutex_init(&sdkp->rev_mutex);
-       INIT_WORK(&sdkp->zone_wp_offset_work, sd_zbc_update_wp_offset_workfn);
-       sdkp->zone_wp_update_buf = kzalloc(SD_BUF_SIZE, GFP_KERNEL);
-       if (!sdkp->zone_wp_update_buf)
-               return -ENOMEM;
-
-       return 0;
-}
-
-void sd_zbc_release_disk(struct scsi_disk *sdkp)
-{
-       kvfree(sdkp->zones_wp_offset);
-       sdkp->zones_wp_offset = NULL;
-       kfree(sdkp->zone_wp_update_buf);
-       sdkp->zone_wp_update_buf = NULL;
-}
index 30bb7b7..8abf4df 100644 (file)
@@ -93,7 +93,7 @@ static int exynos_asv_update_opps(struct exynos_asv *asv)
                        continue;
 
                opp_table = dev_pm_opp_get_opp_table(cpu);
-               if (IS_ERR_OR_NULL(opp_table))
+               if (IS_ERR(opp_table))
                        continue;
 
                if (!last_opp_table || opp_table != last_opp_table) {
index 681d090..9cfa15e 100644 (file)
@@ -1295,7 +1295,7 @@ static const struct of_device_id bcm_qspi_of_match[] = {
        },
        {
                .compatible = "brcm,spi-bcm-qspi",
-               .data = &bcm_qspi_rev_data,
+               .data = &bcm_qspi_no_rev_data,
        },
        {
                .compatible = "brcm,spi-bcm7216-qspi",
index c45d76c..41986ac 100644 (file)
@@ -75,7 +75,7 @@
 #define DRV_NAME       "spi-bcm2835"
 
 /* define polling limits */
-unsigned int polling_limit_us = 30;
+static unsigned int polling_limit_us = 30;
 module_param(polling_limit_us, uint, 0664);
 MODULE_PARM_DESC(polling_limit_us,
                 "time in us to run a transfer in polling mode\n");
index 91c6aff..127323a 100644 (file)
@@ -174,17 +174,17 @@ static const struct fsl_dspi_devtype_data devtype_data[] = {
                .fifo_size              = 16,
        },
        [LS2080A] = {
-               .trans_mode             = DSPI_DMA_MODE,
+               .trans_mode             = DSPI_XSPI_MODE,
                .max_clock_factor       = 8,
                .fifo_size              = 4,
        },
        [LS2085A] = {
-               .trans_mode             = DSPI_DMA_MODE,
+               .trans_mode             = DSPI_XSPI_MODE,
                .max_clock_factor       = 8,
                .fifo_size              = 4,
        },
        [LX2160A] = {
-               .trans_mode             = DSPI_DMA_MODE,
+               .trans_mode             = DSPI_XSPI_MODE,
                .max_clock_factor       = 8,
                .fifo_size              = 4,
        },
@@ -1273,11 +1273,14 @@ static int dspi_probe(struct platform_device *pdev)
        void __iomem *base;
        bool big_endian;
 
-       ctlr = spi_alloc_master(&pdev->dev, sizeof(struct fsl_dspi));
+       dspi = devm_kzalloc(&pdev->dev, sizeof(*dspi), GFP_KERNEL);
+       if (!dspi)
+               return -ENOMEM;
+
+       ctlr = spi_alloc_master(&pdev->dev, 0);
        if (!ctlr)
                return -ENOMEM;
 
-       dspi = spi_controller_get_devdata(ctlr);
        dspi->pdev = pdev;
        dspi->ctlr = ctlr;
 
@@ -1414,7 +1417,7 @@ poll_mode:
        if (dspi->devtype_data->trans_mode != DSPI_DMA_MODE)
                ctlr->ptp_sts_supported = true;
 
-       platform_set_drvdata(pdev, ctlr);
+       platform_set_drvdata(pdev, dspi);
 
        ret = spi_register_controller(ctlr);
        if (ret != 0) {
@@ -1437,8 +1440,7 @@ out_ctlr_put:
 
 static int dspi_remove(struct platform_device *pdev)
 {
-       struct spi_controller *ctlr = platform_get_drvdata(pdev);
-       struct fsl_dspi *dspi = spi_controller_get_devdata(ctlr);
+       struct fsl_dspi *dspi = platform_get_drvdata(pdev);
 
        /* Disconnect from the SPI framework */
        spi_unregister_controller(dspi->ctlr);
index e605812..6d148ab 100644 (file)
@@ -564,13 +564,14 @@ static void fsl_espi_cpu_irq(struct fsl_espi *espi, u32 events)
 static irqreturn_t fsl_espi_irq(s32 irq, void *context_data)
 {
        struct fsl_espi *espi = context_data;
-       u32 events;
+       u32 events, mask;
 
        spin_lock(&espi->lock);
 
        /* Get interrupt events(tx/rx) */
        events = fsl_espi_read_reg(espi, ESPI_SPIE);
-       if (!events) {
+       mask = fsl_espi_read_reg(espi, ESPI_SPIM);
+       if (!(events & mask)) {
                spin_unlock(&espi->lock);
                return IRQ_NONE;
        }
index 590eac2..ff26ab0 100644 (file)
@@ -1840,7 +1840,8 @@ int target_submit_tmr(struct se_cmd *se_cmd, struct se_session *se_sess,
         * out unpacked_lun for the original se_cmd.
         */
        if (tm_type == TMR_ABORT_TASK && (flags & TARGET_SCF_LOOKUP_LUN_FROM_TAG)) {
-               if (!target_lookup_lun_from_tag(se_sess, tag, &unpacked_lun))
+               if (!target_lookup_lun_from_tag(se_sess, tag,
+                                               &se_cmd->orig_fe_lun))
                        goto failure;
        }
 
index 7e73e98..b351962 100644 (file)
@@ -269,8 +269,30 @@ static int usb_probe_device(struct device *dev)
        if (error)
                return error;
 
+       /* Probe the USB device with the driver in hand, but only
+        * defer to a generic driver in case the current USB
+        * device driver has an id_table or a match function; i.e.,
+        * when the device driver was explicitly matched against
+        * a device.
+        *
+        * If the device driver does not have either of these,
+        * then we assume that it can bind to any device and is
+        * not truly a more specialized/non-generic driver, so a
+        * return value of -ENODEV should not force the device
+        * to be handled by the generic USB driver, as there
+        * can still be another, more specialized, device driver.
+        *
+        * This accommodates the usbip driver.
+        *
+        * TODO: What if, in the future, there are multiple
+        * specialized USB device drivers for a particular device?
+        * In such cases, there is a need to try all matching
+        * specialised device drivers prior to setting the
+        * use_generic_driver bit.
+        */
        error = udriver->probe(udev);
-       if (error == -ENODEV && udriver != &usb_generic_driver) {
+       if (error == -ENODEV && udriver != &usb_generic_driver &&
+           (udriver->id_table || udriver->match)) {
                udev->use_generic_driver = 1;
                return -EPROBE_DEFER;
        }
@@ -831,14 +853,17 @@ static int usb_device_match(struct device *dev, struct device_driver *drv)
                udev = to_usb_device(dev);
                udrv = to_usb_device_driver(drv);
 
-               if (udrv->id_table &&
-                   usb_device_match_id(udev, udrv->id_table) != NULL) {
-                       return 1;
-               }
+               if (udrv->id_table)
+                       return usb_device_match_id(udev, udrv->id_table) != NULL;
 
                if (udrv->match)
                        return udrv->match(udev);
-               return 0;
+
+               /* If the device driver under consideration does not have a
+                * id_table or a match function, then let the driver's probe
+                * function decide.
+                */
+               return 1;
 
        } else if (is_usb_interface(dev)) {
                struct usb_interface *intf;
@@ -905,26 +930,19 @@ static int usb_uevent(struct device *dev, struct kobj_uevent_env *env)
        return 0;
 }
 
-static bool is_dev_usb_generic_driver(struct device *dev)
-{
-       struct usb_device_driver *udd = dev->driver ?
-               to_usb_device_driver(dev->driver) : NULL;
-
-       return udd == &usb_generic_driver;
-}
-
 static int __usb_bus_reprobe_drivers(struct device *dev, void *data)
 {
        struct usb_device_driver *new_udriver = data;
        struct usb_device *udev;
        int ret;
 
-       if (!is_dev_usb_generic_driver(dev))
+       /* Don't reprobe if current driver isn't usb_generic_driver */
+       if (dev->driver != &usb_generic_driver.drvwrap.driver)
                return 0;
 
        udev = to_usb_device(dev);
        if (usb_device_match_id(udev, new_udriver->id_table) == NULL &&
-           (!new_udriver->match || new_udriver->match(udev) != 0))
+           (!new_udriver->match || new_udriver->match(udev) == 0))
                return 0;
 
        ret = device_reprobe(dev);
index b4206b0..1f63875 100644 (file)
@@ -1189,7 +1189,6 @@ static int ncm_unwrap_ntb(struct gether *port,
        const struct ndp_parser_opts *opts = ncm->parser_opts;
        unsigned        crc_len = ncm->is_crc ? sizeof(uint32_t) : 0;
        int             dgram_counter;
-       bool            ndp_after_header;
 
        /* dwSignature */
        if (get_unaligned_le32(tmp) != opts->nth_sign) {
@@ -1216,7 +1215,6 @@ static int ncm_unwrap_ntb(struct gether *port,
        }
 
        ndp_index = get_ncm(&tmp, opts->ndp_index);
-       ndp_after_header = false;
 
        /* Run through all the NDP's in the NTB */
        do {
@@ -1232,8 +1230,6 @@ static int ncm_unwrap_ntb(struct gether *port,
                             ndp_index);
                        goto err;
                }
-               if (ndp_index == opts->nth_size)
-                       ndp_after_header = true;
 
                /*
                 * walk through NDP
@@ -1312,37 +1308,13 @@ static int ncm_unwrap_ntb(struct gether *port,
                        index2 = get_ncm(&tmp, opts->dgram_item_len);
                        dg_len2 = get_ncm(&tmp, opts->dgram_item_len);
 
-                       if (index2 == 0 || dg_len2 == 0)
-                               break;
-
                        /* wDatagramIndex[1] */
-                       if (ndp_after_header) {
-                               if (index2 < opts->nth_size + opts->ndp_size) {
-                                       INFO(port->func.config->cdev,
-                                            "Bad index: %#X\n", index2);
-                                       goto err;
-                               }
-                       } else {
-                               if (index2 < opts->nth_size + opts->dpe_size) {
-                                       INFO(port->func.config->cdev,
-                                            "Bad index: %#X\n", index2);
-                                       goto err;
-                               }
-                       }
                        if (index2 > block_len - opts->dpe_size) {
                                INFO(port->func.config->cdev,
                                     "Bad index: %#X\n", index2);
                                goto err;
                        }
 
-                       /* wDatagramLength[1] */
-                       if ((dg_len2 < 14 + crc_len) ||
-                                       (dg_len2 > frame_max)) {
-                               INFO(port->func.config->cdev,
-                                    "Bad dgram length: %#X\n", dg_len);
-                               goto err;
-                       }
-
                        /*
                         * Copy the data into a new skb.
                         * This ensures the truesize is correct
@@ -1359,6 +1331,8 @@ static int ncm_unwrap_ntb(struct gether *port,
                        ndp_len -= 2 * (opts->dgram_item_len * 2);
 
                        dgram_counter++;
+                       if (index2 == 0 || dg_len2 == 0)
+                               break;
                } while (ndp_len > 2 * (opts->dgram_item_len * 2));
        } while (ndp_index);
 
index 9d7d642..2305d42 100644 (file)
@@ -461,11 +461,6 @@ static void stub_disconnect(struct usb_device *udev)
        return;
 }
 
-static bool usbip_match(struct usb_device *udev)
-{
-       return true;
-}
-
 #ifdef CONFIG_PM
 
 /* These functions need usb_port_suspend and usb_port_resume,
@@ -491,7 +486,6 @@ struct usb_device_driver stub_driver = {
        .name           = "usbip-host",
        .probe          = stub_probe,
        .disconnect     = stub_disconnect,
-       .match          = usbip_match,
 #ifdef CONFIG_PM
        .suspend        = stub_suspend,
        .resume         = stub_resume,
index 34aec4b..0fd3f87 100644 (file)
@@ -149,7 +149,7 @@ EXPORT_SYMBOL_GPL(vhost_iotlb_free);
  * vhost_iotlb_itree_first - return the first overlapped range
  * @iotlb: the IOTLB
  * @start: start of IOVA range
- * @end: end of IOVA range
+ * @last: last byte in IOVA range
  */
 struct vhost_iotlb_map *
 vhost_iotlb_itree_first(struct vhost_iotlb *iotlb, u64 start, u64 last)
@@ -162,7 +162,7 @@ EXPORT_SYMBOL_GPL(vhost_iotlb_itree_first);
  * vhost_iotlb_itree_next - return the next overlapped range
  * @map: the starting map node
  * @start: start of IOVA range
- * @end: end of IOVA range
+ * @last: last byte IOVA range
  */
 struct vhost_iotlb_map *
 vhost_iotlb_itree_next(struct vhost_iotlb_map *map, u64 start, u64 last)
index 3fab94f..796fe97 100644 (file)
@@ -353,8 +353,6 @@ static long vhost_vdpa_vring_ioctl(struct vhost_vdpa *v, unsigned int cmd,
        struct vdpa_callback cb;
        struct vhost_virtqueue *vq;
        struct vhost_vring_state s;
-       u64 __user *featurep = argp;
-       u64 features;
        u32 idx;
        long r;
 
@@ -381,18 +379,6 @@ static long vhost_vdpa_vring_ioctl(struct vhost_vdpa *v, unsigned int cmd,
 
                vq->last_avail_idx = vq_state.avail_index;
                break;
-       case VHOST_GET_BACKEND_FEATURES:
-               features = VHOST_VDPA_BACKEND_FEATURES;
-               if (copy_to_user(featurep, &features, sizeof(features)))
-                       return -EFAULT;
-               return 0;
-       case VHOST_SET_BACKEND_FEATURES:
-               if (copy_from_user(&features, featurep, sizeof(features)))
-                       return -EFAULT;
-               if (features & ~VHOST_VDPA_BACKEND_FEATURES)
-                       return -EOPNOTSUPP;
-               vhost_set_backend_features(&v->vdev, features);
-               return 0;
        }
 
        r = vhost_vring_ioctl(&v->vdev, cmd, argp);
@@ -440,8 +426,20 @@ static long vhost_vdpa_unlocked_ioctl(struct file *filep,
        struct vhost_vdpa *v = filep->private_data;
        struct vhost_dev *d = &v->vdev;
        void __user *argp = (void __user *)arg;
+       u64 __user *featurep = argp;
+       u64 features;
        long r;
 
+       if (cmd == VHOST_SET_BACKEND_FEATURES) {
+               r = copy_from_user(&features, featurep, sizeof(features));
+               if (r)
+                       return r;
+               if (features & ~VHOST_VDPA_BACKEND_FEATURES)
+                       return -EOPNOTSUPP;
+               vhost_set_backend_features(&v->vdev, features);
+               return 0;
+       }
+
        mutex_lock(&d->mutex);
 
        switch (cmd) {
@@ -476,6 +474,10 @@ static long vhost_vdpa_unlocked_ioctl(struct file *filep,
        case VHOST_VDPA_SET_CONFIG_CALL:
                r = vhost_vdpa_set_config_call(v, argp);
                break;
+       case VHOST_GET_BACKEND_FEATURES:
+               features = VHOST_VDPA_BACKEND_FEATURES;
+               r = copy_to_user(featurep, &features, sizeof(features));
+               break;
        default:
                r = vhost_dev_ioctl(&v->vdev, cmd, argp);
                if (r == -ENOIOCTLCMD)
index 90b8f56..6f02c18 100644 (file)
@@ -92,6 +92,8 @@ static bool (*pirq_needs_eoi)(unsigned irq);
 /* Xen will never allocate port zero for any purpose. */
 #define VALID_EVTCHN(chn)      ((chn) != 0)
 
+static struct irq_info *legacy_info_ptrs[NR_IRQS_LEGACY];
+
 static struct irq_chip xen_dynamic_chip;
 static struct irq_chip xen_percpu_chip;
 static struct irq_chip xen_pirq_chip;
@@ -156,7 +158,18 @@ int get_evtchn_to_irq(evtchn_port_t evtchn)
 /* Get info for IRQ */
 struct irq_info *info_for_irq(unsigned irq)
 {
-       return irq_get_chip_data(irq);
+       if (irq < nr_legacy_irqs())
+               return legacy_info_ptrs[irq];
+       else
+               return irq_get_chip_data(irq);
+}
+
+static void set_info_for_irq(unsigned int irq, struct irq_info *info)
+{
+       if (irq < nr_legacy_irqs())
+               legacy_info_ptrs[irq] = info;
+       else
+               irq_set_chip_data(irq, info);
 }
 
 /* Constructors for packed IRQ information. */
@@ -377,7 +390,7 @@ static void xen_irq_init(unsigned irq)
        info->type = IRQT_UNBOUND;
        info->refcnt = -1;
 
-       irq_set_chip_data(irq, info);
+       set_info_for_irq(irq, info);
 
        list_add_tail(&info->list, &xen_irq_list_head);
 }
@@ -426,14 +439,14 @@ static int __must_check xen_allocate_irq_gsi(unsigned gsi)
 
 static void xen_free_irq(unsigned irq)
 {
-       struct irq_info *info = irq_get_chip_data(irq);
+       struct irq_info *info = info_for_irq(irq);
 
        if (WARN_ON(!info))
                return;
 
        list_del(&info->list);
 
-       irq_set_chip_data(irq, NULL);
+       set_info_for_irq(irq, NULL);
 
        WARN_ON(info->refcnt > 0);
 
@@ -603,7 +616,7 @@ EXPORT_SYMBOL_GPL(xen_irq_from_gsi);
 static void __unbind_from_irq(unsigned int irq)
 {
        evtchn_port_t evtchn = evtchn_from_irq(irq);
-       struct irq_info *info = irq_get_chip_data(irq);
+       struct irq_info *info = info_for_irq(irq);
 
        if (info->refcnt > 0) {
                info->refcnt--;
@@ -1108,7 +1121,7 @@ int bind_ipi_to_irqhandler(enum ipi_vector ipi,
 
 void unbind_from_irqhandler(unsigned int irq, void *dev_id)
 {
-       struct irq_info *info = irq_get_chip_data(irq);
+       struct irq_info *info = info_for_irq(irq);
 
        if (WARN_ON(!info))
                return;
@@ -1142,7 +1155,7 @@ int evtchn_make_refcounted(evtchn_port_t evtchn)
        if (irq == -1)
                return -ENOENT;
 
-       info = irq_get_chip_data(irq);
+       info = info_for_irq(irq);
 
        if (!info)
                return -ENOENT;
@@ -1170,7 +1183,7 @@ int evtchn_get(evtchn_port_t evtchn)
        if (irq == -1)
                goto done;
 
-       info = irq_get_chip_data(irq);
+       info = info_for_irq(irq);
 
        if (!info)
                goto done;
index 74c886f..5ced859 100644 (file)
@@ -53,7 +53,7 @@ static int autofs_write(struct autofs_sb_info *sbi,
 
        mutex_lock(&sbi->pipe_mutex);
        while (bytes) {
-               wr = kernel_write(file, data, bytes, &file->f_pos);
+               wr = __kernel_write(file, data, bytes, NULL);
                if (wr <= 0)
                        break;
                data += wr;
index db93909..e4a1c6a 100644 (file)
@@ -599,6 +599,37 @@ static void btrfs_rm_dev_replace_unblocked(struct btrfs_fs_info *fs_info)
        wake_up(&fs_info->dev_replace.replace_wait);
 }
 
+/*
+ * When finishing the device replace, before swapping the source device with the
+ * target device we must update the chunk allocation state in the target device,
+ * as it is empty because replace works by directly copying the chunks and not
+ * through the normal chunk allocation path.
+ */
+static int btrfs_set_target_alloc_state(struct btrfs_device *srcdev,
+                                       struct btrfs_device *tgtdev)
+{
+       struct extent_state *cached_state = NULL;
+       u64 start = 0;
+       u64 found_start;
+       u64 found_end;
+       int ret = 0;
+
+       lockdep_assert_held(&srcdev->fs_info->chunk_mutex);
+
+       while (!find_first_extent_bit(&srcdev->alloc_state, start,
+                                     &found_start, &found_end,
+                                     CHUNK_ALLOCATED, &cached_state)) {
+               ret = set_extent_bits(&tgtdev->alloc_state, found_start,
+                                     found_end, CHUNK_ALLOCATED);
+               if (ret)
+                       break;
+               start = found_end + 1;
+       }
+
+       free_extent_state(cached_state);
+       return ret;
+}
+
 static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info,
                                       int scrub_ret)
 {
@@ -673,8 +704,14 @@ static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info,
        dev_replace->time_stopped = ktime_get_real_seconds();
        dev_replace->item_needs_writeback = 1;
 
-       /* replace old device with new one in mapping tree */
+       /*
+        * Update allocation state in the new device and replace the old device
+        * with the new one in the mapping tree.
+        */
        if (!scrub_ret) {
+               scrub_ret = btrfs_set_target_alloc_state(src_device, tgt_device);
+               if (scrub_ret)
+                       goto error;
                btrfs_dev_replace_update_device_in_mapping_tree(fs_info,
                                                                src_device,
                                                                tgt_device);
@@ -685,6 +722,7 @@ static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info,
                                 btrfs_dev_name(src_device),
                                 src_device->devid,
                                 rcu_str_deref(tgt_device->name), scrub_ret);
+error:
                up_write(&dev_replace->rwsem);
                mutex_unlock(&fs_info->chunk_mutex);
                mutex_unlock(&fs_info->fs_devices->device_list_mutex);
@@ -745,7 +783,9 @@ static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info,
        /* replace the sysfs entry */
        btrfs_sysfs_remove_devices_dir(fs_info->fs_devices, src_device);
        btrfs_sysfs_update_devid(tgt_device);
-       btrfs_rm_dev_replace_free_srcdev(src_device);
+       if (test_bit(BTRFS_DEV_STATE_WRITEABLE, &src_device->dev_state))
+               btrfs_scratch_superblocks(fs_info, src_device->bdev,
+                                         src_device->name->str);
 
        /* write back the superblocks */
        trans = btrfs_start_transaction(root, 0);
@@ -754,6 +794,8 @@ static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info,
 
        mutex_unlock(&dev_replace->lock_finishing_cancel_unmount);
 
+       btrfs_rm_dev_replace_free_srcdev(src_device);
+
        return 0;
 }
 
index abf86b2..9f72b09 100644 (file)
@@ -636,16 +636,15 @@ static int btree_readpage_end_io_hook(struct btrfs_io_bio *io_bio,
        csum_tree_block(eb, result);
 
        if (memcmp_extent_buffer(eb, result, 0, csum_size)) {
-               u32 val;
-               u32 found = 0;
-
-               memcpy(&found, result, csum_size);
+               u8 val[BTRFS_CSUM_SIZE] = { 0 };
 
                read_extent_buffer(eb, &val, 0, csum_size);
                btrfs_warn_rl(fs_info,
-               "%s checksum verify failed on %llu wanted %x found %x level %d",
+       "%s checksum verify failed on %llu wanted " CSUM_FMT " found " CSUM_FMT " level %d",
                              fs_info->sb->s_id, eb->start,
-                             val, found, btrfs_header_level(eb));
+                             CSUM_FMT_VALUE(csum_size, val),
+                             CSUM_FMT_VALUE(csum_size, result),
+                             btrfs_header_level(eb));
                ret = -EUCLEAN;
                goto err;
        }
index c8df2ed..5be3006 100644 (file)
@@ -1170,10 +1170,12 @@ int btrfs_sysfs_remove_devices_dir(struct btrfs_fs_devices *fs_devices,
                                          disk_kobj->name);
                }
 
-               kobject_del(&one_device->devid_kobj);
-               kobject_put(&one_device->devid_kobj);
+               if (one_device->devid_kobj.state_initialized) {
+                       kobject_del(&one_device->devid_kobj);
+                       kobject_put(&one_device->devid_kobj);
 
-               wait_for_completion(&one_device->kobj_unregister);
+                       wait_for_completion(&one_device->kobj_unregister);
+               }
 
                return 0;
        }
@@ -1186,10 +1188,12 @@ int btrfs_sysfs_remove_devices_dir(struct btrfs_fs_devices *fs_devices,
                        sysfs_remove_link(fs_devices->devices_kobj,
                                          disk_kobj->name);
                }
-               kobject_del(&one_device->devid_kobj);
-               kobject_put(&one_device->devid_kobj);
+               if (one_device->devid_kobj.state_initialized) {
+                       kobject_del(&one_device->devid_kobj);
+                       kobject_put(&one_device->devid_kobj);
 
-               wait_for_completion(&one_device->kobj_unregister);
+                       wait_for_completion(&one_device->kobj_unregister);
+               }
        }
 
        return 0;
index 117b433..1997a7d 100644 (file)
@@ -1999,9 +1999,9 @@ static u64 btrfs_num_devices(struct btrfs_fs_info *fs_info)
        return num_devices;
 }
 
-static void btrfs_scratch_superblocks(struct btrfs_fs_info *fs_info,
-                                     struct block_device *bdev,
-                                     const char *device_path)
+void btrfs_scratch_superblocks(struct btrfs_fs_info *fs_info,
+                              struct block_device *bdev,
+                              const char *device_path)
 {
        struct btrfs_super_block *disk_super;
        int copy_num;
@@ -2224,11 +2224,7 @@ void btrfs_rm_dev_replace_free_srcdev(struct btrfs_device *srcdev)
        struct btrfs_fs_info *fs_info = srcdev->fs_info;
        struct btrfs_fs_devices *fs_devices = srcdev->fs_devices;
 
-       if (test_bit(BTRFS_DEV_STATE_WRITEABLE, &srcdev->dev_state)) {
-               /* zero out the old super if it is writable */
-               btrfs_scratch_superblocks(fs_info, srcdev->bdev,
-                                         srcdev->name->str);
-       }
+       mutex_lock(&uuid_mutex);
 
        btrfs_close_bdev(srcdev);
        synchronize_rcu();
@@ -2258,6 +2254,7 @@ void btrfs_rm_dev_replace_free_srcdev(struct btrfs_device *srcdev)
                close_fs_devices(fs_devices);
                free_fs_devices(fs_devices);
        }
+       mutex_unlock(&uuid_mutex);
 }
 
 void btrfs_destroy_dev_replace_tgtdev(struct btrfs_device *tgtdev)
index 5eea939..302c923 100644 (file)
@@ -573,6 +573,9 @@ void btrfs_set_fs_info_ptr(struct btrfs_fs_info *fs_info);
 void btrfs_reset_fs_info_ptr(struct btrfs_fs_info *fs_info);
 bool btrfs_check_rw_degradable(struct btrfs_fs_info *fs_info,
                                        struct btrfs_device *failing_dev);
+void btrfs_scratch_superblocks(struct btrfs_fs_info *fs_info,
+                              struct block_device *bdev,
+                              const char *device_path);
 
 int btrfs_bg_type_to_factor(u64 flags);
 const char *btrfs_bg_type_to_raid_name(u64 flags);
index 8107e06..4df6112 100644 (file)
@@ -218,8 +218,7 @@ struct eventpoll {
        struct file *file;
 
        /* used to optimize loop detection check */
-       struct list_head visited_list_link;
-       int visited;
+       u64 gen;
 
 #ifdef CONFIG_NET_RX_BUSY_POLL
        /* used to track busy poll napi_id */
@@ -274,6 +273,8 @@ static long max_user_watches __read_mostly;
  */
 static DEFINE_MUTEX(epmutex);
 
+static u64 loop_check_gen = 0;
+
 /* Used to check for epoll file descriptor inclusion loops */
 static struct nested_calls poll_loop_ncalls;
 
@@ -283,9 +284,6 @@ static struct kmem_cache *epi_cache __read_mostly;
 /* Slab cache used to allocate "struct eppoll_entry" */
 static struct kmem_cache *pwq_cache __read_mostly;
 
-/* Visited nodes during ep_loop_check(), so we can unset them when we finish */
-static LIST_HEAD(visited_list);
-
 /*
  * List of files with newly added links, where we may need to limit the number
  * of emanating paths. Protected by the epmutex.
@@ -1450,7 +1448,7 @@ static int reverse_path_check(void)
 
 static int ep_create_wakeup_source(struct epitem *epi)
 {
-       const char *name;
+       struct name_snapshot n;
        struct wakeup_source *ws;
 
        if (!epi->ep->ws) {
@@ -1459,8 +1457,9 @@ static int ep_create_wakeup_source(struct epitem *epi)
                        return -ENOMEM;
        }
 
-       name = epi->ffd.file->f_path.dentry->d_name.name;
-       ws = wakeup_source_register(NULL, name);
+       take_dentry_name_snapshot(&n, epi->ffd.file->f_path.dentry);
+       ws = wakeup_source_register(NULL, n.name.name);
+       release_dentry_name_snapshot(&n);
 
        if (!ws)
                return -ENOMEM;
@@ -1522,6 +1521,22 @@ static int ep_insert(struct eventpoll *ep, const struct epoll_event *event,
                RCU_INIT_POINTER(epi->ws, NULL);
        }
 
+       /* Add the current item to the list of active epoll hook for this file */
+       spin_lock(&tfile->f_lock);
+       list_add_tail_rcu(&epi->fllink, &tfile->f_ep_links);
+       spin_unlock(&tfile->f_lock);
+
+       /*
+        * Add the current item to the RB tree. All RB tree operations are
+        * protected by "mtx", and ep_insert() is called with "mtx" held.
+        */
+       ep_rbtree_insert(ep, epi);
+
+       /* now check if we've created too many backpaths */
+       error = -EINVAL;
+       if (full_check && reverse_path_check())
+               goto error_remove_epi;
+
        /* Initialize the poll table using the queue callback */
        epq.epi = epi;
        init_poll_funcptr(&epq.pt, ep_ptable_queue_proc);
@@ -1544,22 +1559,6 @@ static int ep_insert(struct eventpoll *ep, const struct epoll_event *event,
        if (epi->nwait < 0)
                goto error_unregister;
 
-       /* Add the current item to the list of active epoll hook for this file */
-       spin_lock(&tfile->f_lock);
-       list_add_tail_rcu(&epi->fllink, &tfile->f_ep_links);
-       spin_unlock(&tfile->f_lock);
-
-       /*
-        * Add the current item to the RB tree. All RB tree operations are
-        * protected by "mtx", and ep_insert() is called with "mtx" held.
-        */
-       ep_rbtree_insert(ep, epi);
-
-       /* now check if we've created too many backpaths */
-       error = -EINVAL;
-       if (full_check && reverse_path_check())
-               goto error_remove_epi;
-
        /* We have to drop the new item inside our item list to keep track of it */
        write_lock_irq(&ep->lock);
 
@@ -1588,6 +1587,8 @@ static int ep_insert(struct eventpoll *ep, const struct epoll_event *event,
 
        return 0;
 
+error_unregister:
+       ep_unregister_pollwait(ep, epi);
 error_remove_epi:
        spin_lock(&tfile->f_lock);
        list_del_rcu(&epi->fllink);
@@ -1595,9 +1596,6 @@ error_remove_epi:
 
        rb_erase_cached(&epi->rbn, &ep->rbr);
 
-error_unregister:
-       ep_unregister_pollwait(ep, epi);
-
        /*
         * We need to do this because an event could have been arrived on some
         * allocated wait queue. Note that we don't care about the ep->ovflist
@@ -1972,13 +1970,12 @@ static int ep_loop_check_proc(void *priv, void *cookie, int call_nests)
        struct epitem *epi;
 
        mutex_lock_nested(&ep->mtx, call_nests + 1);
-       ep->visited = 1;
-       list_add(&ep->visited_list_link, &visited_list);
+       ep->gen = loop_check_gen;
        for (rbp = rb_first_cached(&ep->rbr); rbp; rbp = rb_next(rbp)) {
                epi = rb_entry(rbp, struct epitem, rbn);
                if (unlikely(is_file_epoll(epi->ffd.file))) {
                        ep_tovisit = epi->ffd.file->private_data;
-                       if (ep_tovisit->visited)
+                       if (ep_tovisit->gen == loop_check_gen)
                                continue;
                        error = ep_call_nested(&poll_loop_ncalls,
                                        ep_loop_check_proc, epi->ffd.file,
@@ -2019,18 +2016,8 @@ static int ep_loop_check_proc(void *priv, void *cookie, int call_nests)
  */
 static int ep_loop_check(struct eventpoll *ep, struct file *file)
 {
-       int ret;
-       struct eventpoll *ep_cur, *ep_next;
-
-       ret = ep_call_nested(&poll_loop_ncalls,
+       return ep_call_nested(&poll_loop_ncalls,
                              ep_loop_check_proc, file, ep, current);
-       /* clear visited list */
-       list_for_each_entry_safe(ep_cur, ep_next, &visited_list,
-                                                       visited_list_link) {
-               ep_cur->visited = 0;
-               list_del(&ep_cur->visited_list_link);
-       }
-       return ret;
 }
 
 static void clear_tfile_check_list(void)
@@ -2195,11 +2182,13 @@ int do_epoll_ctl(int epfd, int op, int fd, struct epoll_event *epds,
                goto error_tgt_fput;
        if (op == EPOLL_CTL_ADD) {
                if (!list_empty(&f.file->f_ep_links) ||
+                               ep->gen == loop_check_gen ||
                                                is_file_epoll(tf.file)) {
                        mutex_unlock(&ep->mtx);
                        error = epoll_mutex_lock(&epmutex, 0, nonblock);
                        if (error)
                                goto error_tgt_fput;
+                       loop_check_gen++;
                        full_check = 1;
                        if (is_file_epoll(tf.file)) {
                                error = -ELOOP;
@@ -2263,6 +2252,7 @@ int do_epoll_ctl(int epfd, int op, int fd, struct epoll_event *epds,
 error_tgt_fput:
        if (full_check) {
                clear_tfile_check_list();
+               loop_check_gen++;
                mutex_unlock(&epmutex);
        }
 
index 6611ef3..43c165e 100644 (file)
@@ -3091,11 +3091,10 @@ fuse_direct_IO(struct kiocb *iocb, struct iov_iter *iter)
        ssize_t ret = 0;
        struct file *file = iocb->ki_filp;
        struct fuse_file *ff = file->private_data;
-       bool async_dio = ff->fc->async_dio;
        loff_t pos = 0;
        struct inode *inode;
        loff_t i_size;
-       size_t count = iov_iter_count(iter);
+       size_t count = iov_iter_count(iter), shortened = 0;
        loff_t offset = iocb->ki_pos;
        struct fuse_io_priv *io;
 
@@ -3103,17 +3102,9 @@ fuse_direct_IO(struct kiocb *iocb, struct iov_iter *iter)
        inode = file->f_mapping->host;
        i_size = i_size_read(inode);
 
-       if ((iov_iter_rw(iter) == READ) && (offset > i_size))
+       if ((iov_iter_rw(iter) == READ) && (offset >= i_size))
                return 0;
 
-       /* optimization for short read */
-       if (async_dio && iov_iter_rw(iter) != WRITE && offset + count > i_size) {
-               if (offset >= i_size)
-                       return 0;
-               iov_iter_truncate(iter, fuse_round_up(ff->fc, i_size - offset));
-               count = iov_iter_count(iter);
-       }
-
        io = kmalloc(sizeof(struct fuse_io_priv), GFP_KERNEL);
        if (!io)
                return -ENOMEM;
@@ -3129,15 +3120,22 @@ fuse_direct_IO(struct kiocb *iocb, struct iov_iter *iter)
         * By default, we want to optimize all I/Os with async request
         * submission to the client filesystem if supported.
         */
-       io->async = async_dio;
+       io->async = ff->fc->async_dio;
        io->iocb = iocb;
        io->blocking = is_sync_kiocb(iocb);
 
+       /* optimization for short read */
+       if (io->async && !io->write && offset + count > i_size) {
+               iov_iter_truncate(iter, fuse_round_up(ff->fc, i_size - offset));
+               shortened = count - iov_iter_count(iter);
+               count -= shortened;
+       }
+
        /*
         * We cannot asynchronously extend the size of a file.
         * In such case the aio will behave exactly like sync io.
         */
-       if ((offset + count > i_size) && iov_iter_rw(iter) == WRITE)
+       if ((offset + count > i_size) && io->write)
                io->blocking = true;
 
        if (io->async && io->blocking) {
@@ -3155,6 +3153,7 @@ fuse_direct_IO(struct kiocb *iocb, struct iov_iter *iter)
        } else {
                ret = __fuse_direct_read(io, iter, &pos);
        }
+       iov_iter_reexpand(iter, iov_iter_count(iter) + shortened);
 
        if (io->async) {
                bool blocking = io->blocking;
index 3790c7f..aae0ef2 100644 (file)
@@ -1753,6 +1753,9 @@ static int io_req_task_work_add(struct io_kiocb *req, struct callback_head *cb,
        struct io_ring_ctx *ctx = req->ctx;
        int ret, notify;
 
+       if (tsk->flags & PF_EXITING)
+               return -ESRCH;
+
        /*
         * SQPOLL kernel thread doesn't need notification, just a wakeup. For
         * all other cases, use TWA_SIGNAL unconditionally to ensure we're
@@ -1787,8 +1790,10 @@ static void __io_req_task_cancel(struct io_kiocb *req, int error)
 static void io_req_task_cancel(struct callback_head *cb)
 {
        struct io_kiocb *req = container_of(cb, struct io_kiocb, task_work);
+       struct io_ring_ctx *ctx = req->ctx;
 
        __io_req_task_cancel(req, -ECANCELED);
+       percpu_ref_put(&ctx->refs);
 }
 
 static void __io_req_task_submit(struct io_kiocb *req)
@@ -2010,6 +2015,12 @@ static inline unsigned int io_put_rw_kbuf(struct io_kiocb *req)
 
 static inline bool io_run_task_work(void)
 {
+       /*
+        * Not safe to run on exiting task, and the task_work handling will
+        * not add work to such a task.
+        */
+       if (unlikely(current->flags & PF_EXITING))
+               return false;
        if (current->task_works) {
                __set_current_state(TASK_RUNNING);
                task_work_run();
@@ -2283,13 +2294,17 @@ static bool io_resubmit_prep(struct io_kiocb *req, int error)
                goto end_req;
        }
 
-       ret = io_import_iovec(rw, req, &iovec, &iter, false);
-       if (ret < 0)
-               goto end_req;
-       ret = io_setup_async_rw(req, iovec, inline_vecs, &iter, false);
-       if (!ret)
+       if (!req->io) {
+               ret = io_import_iovec(rw, req, &iovec, &iter, false);
+               if (ret < 0)
+                       goto end_req;
+               ret = io_setup_async_rw(req, iovec, inline_vecs, &iter, false);
+               if (!ret)
+                       return true;
+               kfree(iovec);
+       } else {
                return true;
-       kfree(iovec);
+       }
 end_req:
        req_set_fail_links(req);
        io_req_complete(req, ret);
@@ -3034,6 +3049,7 @@ static int io_async_buf_func(struct wait_queue_entry *wait, unsigned mode,
        if (!wake_page_match(wpq, key))
                return 0;
 
+       req->rw.kiocb.ki_flags &= ~IOCB_WAITQ;
        list_del_init(&wait->entry);
 
        init_task_work(&req->task_work, io_req_task_submit);
@@ -3091,6 +3107,7 @@ static bool io_rw_should_retry(struct io_kiocb *req)
        wait->wait.flags = 0;
        INIT_LIST_HEAD(&wait->wait.entry);
        kiocb->ki_flags |= IOCB_WAITQ;
+       kiocb->ki_flags &= ~IOCB_NOWAIT;
        kiocb->ki_waitq = wait;
 
        io_get_req_task(req);
@@ -3115,6 +3132,7 @@ static int io_read(struct io_kiocb *req, bool force_nonblock,
        struct iov_iter __iter, *iter = &__iter;
        ssize_t io_size, ret, ret2;
        size_t iov_count;
+       bool no_async;
 
        if (req->io)
                iter = &req->io->rw.iter;
@@ -3132,7 +3150,8 @@ static int io_read(struct io_kiocb *req, bool force_nonblock,
                kiocb->ki_flags &= ~IOCB_NOWAIT;
 
        /* If the file doesn't support async, just async punt */
-       if (force_nonblock && !io_file_supports_async(req->file, READ))
+       no_async = force_nonblock && !io_file_supports_async(req->file, READ);
+       if (no_async)
                goto copy_iov;
 
        ret = rw_verify_area(READ, req->file, io_kiocb_ppos(kiocb), iov_count);
@@ -3155,10 +3174,8 @@ static int io_read(struct io_kiocb *req, bool force_nonblock,
                        goto done;
                /* some cases will consume bytes even on error returns */
                iov_iter_revert(iter, iov_count - iov_iter_count(iter));
-               ret = io_setup_async_rw(req, iovec, inline_vecs, iter, false);
-               if (ret)
-                       goto out_free;
-               return -EAGAIN;
+               ret = 0;
+               goto copy_iov;
        } else if (ret < 0) {
                /* make sure -ERESTARTSYS -> -EINTR is done */
                goto done;
@@ -3176,6 +3193,8 @@ copy_iov:
                ret = ret2;
                goto out_free;
        }
+       if (no_async)
+               return -EAGAIN;
        /* it's copied and will be cleaned with ->io */
        iovec = NULL;
        /* now use our persistent iterator, if we aren't already */
@@ -3508,8 +3527,6 @@ static int __io_openat_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe
        const char __user *fname;
        int ret;
 
-       if (unlikely(req->ctx->flags & (IORING_SETUP_IOPOLL|IORING_SETUP_SQPOLL)))
-               return -EINVAL;
        if (unlikely(sqe->ioprio || sqe->buf_index))
                return -EINVAL;
        if (unlikely(req->flags & REQ_F_FIXED_FILE))
@@ -3536,6 +3553,8 @@ static int io_openat_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
 {
        u64 flags, mode;
 
+       if (unlikely(req->ctx->flags & (IORING_SETUP_IOPOLL|IORING_SETUP_SQPOLL)))
+               return -EINVAL;
        if (req->flags & REQ_F_NEED_CLEANUP)
                return 0;
        mode = READ_ONCE(sqe->len);
@@ -3550,6 +3569,8 @@ static int io_openat2_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
        size_t len;
        int ret;
 
+       if (unlikely(req->ctx->flags & (IORING_SETUP_IOPOLL|IORING_SETUP_SQPOLL)))
+               return -EINVAL;
        if (req->flags & REQ_F_NEED_CLEANUP)
                return 0;
        how = u64_to_user_ptr(READ_ONCE(sqe->addr2));
@@ -3767,7 +3788,7 @@ static int io_epoll_ctl_prep(struct io_kiocb *req,
 #if defined(CONFIG_EPOLL)
        if (sqe->ioprio || sqe->buf_index)
                return -EINVAL;
-       if (unlikely(req->ctx->flags & IORING_SETUP_IOPOLL))
+       if (unlikely(req->ctx->flags & (IORING_SETUP_IOPOLL | IORING_SETUP_SQPOLL)))
                return -EINVAL;
 
        req->epoll.epfd = READ_ONCE(sqe->fd);
@@ -3882,7 +3903,7 @@ static int io_fadvise(struct io_kiocb *req, bool force_nonblock)
 
 static int io_statx_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
 {
-       if (unlikely(req->ctx->flags & IORING_SETUP_IOPOLL))
+       if (unlikely(req->ctx->flags & (IORING_SETUP_IOPOLL | IORING_SETUP_SQPOLL)))
                return -EINVAL;
        if (sqe->ioprio || sqe->buf_index)
                return -EINVAL;
@@ -4724,6 +4745,8 @@ static int io_poll_double_wake(struct wait_queue_entry *wait, unsigned mode,
        if (mask && !(mask & poll->events))
                return 0;
 
+       list_del_init(&wait->entry);
+
        if (poll && poll->head) {
                bool done;
 
@@ -5399,6 +5422,8 @@ static int io_async_cancel(struct io_kiocb *req)
 static int io_files_update_prep(struct io_kiocb *req,
                                const struct io_uring_sqe *sqe)
 {
+       if (unlikely(req->ctx->flags & IORING_SETUP_SQPOLL))
+               return -EINVAL;
        if (unlikely(req->flags & (REQ_F_FIXED_FILE | REQ_F_BUFFER_SELECT)))
                return -EINVAL;
        if (sqe->ioprio || sqe->rw_flags)
@@ -5449,6 +5474,8 @@ static int io_req_defer_prep(struct io_kiocb *req,
        if (unlikely(ret))
                return ret;
 
+       io_prep_async_work(req);
+
        switch (req->opcode) {
        case IORING_OP_NOP:
                break;
@@ -5646,6 +5673,11 @@ static void __io_clean_op(struct io_kiocb *req)
                        io_put_file(req, req->splice.file_in,
                                    (req->splice.flags & SPLICE_F_FD_IN_FIXED));
                        break;
+               case IORING_OP_OPENAT:
+               case IORING_OP_OPENAT2:
+                       if (req->open.filename)
+                               putname(req->open.filename);
+                       break;
                }
                req->flags &= ~REQ_F_NEED_CLEANUP;
        }
@@ -6323,9 +6355,6 @@ static void io_submit_state_start(struct io_submit_state *state,
                                  struct io_ring_ctx *ctx, unsigned int max_ios)
 {
        blk_start_plug(&state->plug);
-#ifdef CONFIG_BLOCK
-       state->plug.nowait = true;
-#endif
        state->comp.nr = 0;
        INIT_LIST_HEAD(&state->comp.list);
        state->comp.ctx = ctx;
@@ -8180,6 +8209,8 @@ static void io_uring_cancel_files(struct io_ring_ctx *ctx,
                /* cancel this request, or head link requests */
                io_attempt_cancel(ctx, cancel_req);
                io_put_req(cancel_req);
+               /* cancellations _may_ trigger task work */
+               io_run_task_work();
                schedule();
                finish_wait(&ctx->inflight_wait, &wait);
        }
@@ -8385,11 +8416,19 @@ static int io_uring_show_cred(int id, void *p, void *data)
 
 static void __io_uring_show_fdinfo(struct io_ring_ctx *ctx, struct seq_file *m)
 {
+       bool has_lock;
        int i;
 
-       mutex_lock(&ctx->uring_lock);
+       /*
+        * Avoid ABBA deadlock between the seq lock and the io_uring mutex,
+        * since fdinfo case grabs it in the opposite direction of normal use
+        * cases. If we fail to get the lock, we just don't iterate any
+        * structures that could be going away outside the io_uring mutex.
+        */
+       has_lock = mutex_trylock(&ctx->uring_lock);
+
        seq_printf(m, "UserFiles:\t%u\n", ctx->nr_user_files);
-       for (i = 0; i < ctx->nr_user_files; i++) {
+       for (i = 0; has_lock && i < ctx->nr_user_files; i++) {
                struct fixed_file_table *table;
                struct file *f;
 
@@ -8401,13 +8440,13 @@ static void __io_uring_show_fdinfo(struct io_ring_ctx *ctx, struct seq_file *m)
                        seq_printf(m, "%5u: <none>\n", i);
        }
        seq_printf(m, "UserBufs:\t%u\n", ctx->nr_user_bufs);
-       for (i = 0; i < ctx->nr_user_bufs; i++) {
+       for (i = 0; has_lock && i < ctx->nr_user_bufs; i++) {
                struct io_mapped_ubuf *buf = &ctx->user_bufs[i];
 
                seq_printf(m, "%5u: 0x%llx/%u\n", i, buf->ubuf,
                                                (unsigned int) buf->len);
        }
-       if (!idr_is_empty(&ctx->personality_idr)) {
+       if (has_lock && !idr_is_empty(&ctx->personality_idr)) {
                seq_printf(m, "Personalities:\n");
                idr_for_each(&ctx->personality_idr, io_uring_show_cred, m);
        }
@@ -8422,7 +8461,8 @@ static void __io_uring_show_fdinfo(struct io_ring_ctx *ctx, struct seq_file *m)
                                        req->task->task_works != NULL);
        }
        spin_unlock_irq(&ctx->completion_lock);
-       mutex_unlock(&ctx->uring_lock);
+       if (has_lock)
+               mutex_unlock(&ctx->uring_lock);
 }
 
 static void io_uring_show_fdinfo(struct seq_file *m, struct file *f)
index e732580..cb52db9 100644 (file)
@@ -579,6 +579,9 @@ int nfs_readdir_page_filler(nfs_readdir_descriptor_t *desc, struct nfs_entry *en
        xdr_set_scratch_buffer(&stream, page_address(scratch), PAGE_SIZE);
 
        do {
+               if (entry->label)
+                       entry->label->len = NFS4_MAXLABELLEN;
+
                status = xdr_decode(desc, entry, &stream);
                if (status != 0) {
                        if (status == -EAGAIN)
index ff8965d..a163533 100644 (file)
@@ -715,7 +715,7 @@ nfs4_ff_layout_stat_io_end_write(struct rpc_task *task,
 }
 
 static void
-ff_layout_mark_ds_unreachable(struct pnfs_layout_segment *lseg, int idx)
+ff_layout_mark_ds_unreachable(struct pnfs_layout_segment *lseg, u32 idx)
 {
        struct nfs4_deviceid_node *devid = FF_LAYOUT_DEVID_NODE(lseg, idx);
 
@@ -724,7 +724,7 @@ ff_layout_mark_ds_unreachable(struct pnfs_layout_segment *lseg, int idx)
 }
 
 static void
-ff_layout_mark_ds_reachable(struct pnfs_layout_segment *lseg, int idx)
+ff_layout_mark_ds_reachable(struct pnfs_layout_segment *lseg, u32 idx)
 {
        struct nfs4_deviceid_node *devid = FF_LAYOUT_DEVID_NODE(lseg, idx);
 
@@ -734,14 +734,14 @@ ff_layout_mark_ds_reachable(struct pnfs_layout_segment *lseg, int idx)
 
 static struct nfs4_pnfs_ds *
 ff_layout_choose_ds_for_read(struct pnfs_layout_segment *lseg,
-                            int start_idx, int *best_idx,
+                            u32 start_idx, u32 *best_idx,
                             bool check_device)
 {
        struct nfs4_ff_layout_segment *fls = FF_LAYOUT_LSEG(lseg);
        struct nfs4_ff_layout_mirror *mirror;
        struct nfs4_pnfs_ds *ds;
        bool fail_return = false;
-       int idx;
+       u32 idx;
 
        /* mirrors are initially sorted by efficiency */
        for (idx = start_idx; idx < fls->mirror_array_cnt; idx++) {
@@ -766,21 +766,21 @@ ff_layout_choose_ds_for_read(struct pnfs_layout_segment *lseg,
 
 static struct nfs4_pnfs_ds *
 ff_layout_choose_any_ds_for_read(struct pnfs_layout_segment *lseg,
-                                int start_idx, int *best_idx)
+                                u32 start_idx, u32 *best_idx)
 {
        return ff_layout_choose_ds_for_read(lseg, start_idx, best_idx, false);
 }
 
 static struct nfs4_pnfs_ds *
 ff_layout_choose_valid_ds_for_read(struct pnfs_layout_segment *lseg,
-                                  int start_idx, int *best_idx)
+                                  u32 start_idx, u32 *best_idx)
 {
        return ff_layout_choose_ds_for_read(lseg, start_idx, best_idx, true);
 }
 
 static struct nfs4_pnfs_ds *
 ff_layout_choose_best_ds_for_read(struct pnfs_layout_segment *lseg,
-                                 int start_idx, int *best_idx)
+                                 u32 start_idx, u32 *best_idx)
 {
        struct nfs4_pnfs_ds *ds;
 
@@ -791,7 +791,8 @@ ff_layout_choose_best_ds_for_read(struct pnfs_layout_segment *lseg,
 }
 
 static struct nfs4_pnfs_ds *
-ff_layout_get_ds_for_read(struct nfs_pageio_descriptor *pgio, int *best_idx)
+ff_layout_get_ds_for_read(struct nfs_pageio_descriptor *pgio,
+                         u32 *best_idx)
 {
        struct pnfs_layout_segment *lseg = pgio->pg_lseg;
        struct nfs4_pnfs_ds *ds;
@@ -837,7 +838,7 @@ ff_layout_pg_init_read(struct nfs_pageio_descriptor *pgio,
        struct nfs_pgio_mirror *pgm;
        struct nfs4_ff_layout_mirror *mirror;
        struct nfs4_pnfs_ds *ds;
-       int ds_idx;
+       u32 ds_idx, i;
 
 retry:
        ff_layout_pg_check_layout(pgio, req);
@@ -863,14 +864,14 @@ retry:
                goto retry;
        }
 
-       mirror = FF_LAYOUT_COMP(pgio->pg_lseg, ds_idx);
+       for (i = 0; i < pgio->pg_mirror_count; i++) {
+               mirror = FF_LAYOUT_COMP(pgio->pg_lseg, i);
+               pgm = &pgio->pg_mirrors[i];
+               pgm->pg_bsize = mirror->mirror_ds->ds_versions[0].rsize;
+       }
 
        pgio->pg_mirror_idx = ds_idx;
 
-       /* read always uses only one mirror - idx 0 for pgio layer */
-       pgm = &pgio->pg_mirrors[0];
-       pgm->pg_bsize = mirror->mirror_ds->ds_versions[0].rsize;
-
        if (NFS_SERVER(pgio->pg_inode)->flags &
                        (NFS_MOUNT_SOFT|NFS_MOUNT_SOFTERR))
                pgio->pg_maxretrans = io_maxretrans;
@@ -894,7 +895,7 @@ ff_layout_pg_init_write(struct nfs_pageio_descriptor *pgio,
        struct nfs4_ff_layout_mirror *mirror;
        struct nfs_pgio_mirror *pgm;
        struct nfs4_pnfs_ds *ds;
-       int i;
+       u32 i;
 
 retry:
        ff_layout_pg_check_layout(pgio, req);
@@ -1038,7 +1039,7 @@ static void ff_layout_reset_write(struct nfs_pgio_header *hdr, bool retry_pnfs)
 static void ff_layout_resend_pnfs_read(struct nfs_pgio_header *hdr)
 {
        u32 idx = hdr->pgio_mirror_idx + 1;
-       int new_idx = 0;
+       u32 new_idx = 0;
 
        if (ff_layout_choose_any_ds_for_read(hdr->lseg, idx + 1, &new_idx))
                ff_layout_send_layouterror(hdr->lseg);
@@ -1075,7 +1076,7 @@ static int ff_layout_async_handle_error_v4(struct rpc_task *task,
                                           struct nfs4_state *state,
                                           struct nfs_client *clp,
                                           struct pnfs_layout_segment *lseg,
-                                          int idx)
+                                          u32 idx)
 {
        struct pnfs_layout_hdr *lo = lseg->pls_layout;
        struct inode *inode = lo->plh_inode;
@@ -1149,7 +1150,7 @@ reset:
 /* Retry all errors through either pNFS or MDS except for -EJUKEBOX */
 static int ff_layout_async_handle_error_v3(struct rpc_task *task,
                                           struct pnfs_layout_segment *lseg,
-                                          int idx)
+                                          u32 idx)
 {
        struct nfs4_deviceid_node *devid = FF_LAYOUT_DEVID_NODE(lseg, idx);
 
@@ -1184,7 +1185,7 @@ static int ff_layout_async_handle_error(struct rpc_task *task,
                                        struct nfs4_state *state,
                                        struct nfs_client *clp,
                                        struct pnfs_layout_segment *lseg,
-                                       int idx)
+                                       u32 idx)
 {
        int vers = clp->cl_nfs_mod->rpc_vers->number;
 
@@ -1211,7 +1212,7 @@ static int ff_layout_async_handle_error(struct rpc_task *task,
 }
 
 static void ff_layout_io_track_ds_error(struct pnfs_layout_segment *lseg,
-                                       int idx, u64 offset, u64 length,
+                                       u32 idx, u64 offset, u64 length,
                                        u32 *op_status, int opnum, int error)
 {
        struct nfs4_ff_layout_mirror *mirror;
@@ -1809,7 +1810,7 @@ ff_layout_write_pagelist(struct nfs_pgio_header *hdr, int sync)
        loff_t offset = hdr->args.offset;
        int vers;
        struct nfs_fh *fh;
-       int idx = hdr->pgio_mirror_idx;
+       u32 idx = hdr->pgio_mirror_idx;
 
        mirror = FF_LAYOUT_COMP(lseg, idx);
        ds = nfs4_ff_layout_prepare_ds(lseg, mirror, true);
index 142225f..2b2211d 100644 (file)
@@ -356,7 +356,15 @@ static ssize_t _nfs42_proc_copy(struct file *src,
 
        truncate_pagecache_range(dst_inode, pos_dst,
                                 pos_dst + res->write_res.count);
-
+       spin_lock(&dst_inode->i_lock);
+       NFS_I(dst_inode)->cache_validity |= (NFS_INO_REVAL_PAGECACHE |
+                       NFS_INO_REVAL_FORCED | NFS_INO_INVALID_SIZE |
+                       NFS_INO_INVALID_ATTR | NFS_INO_INVALID_DATA);
+       spin_unlock(&dst_inode->i_lock);
+       spin_lock(&src_inode->i_lock);
+       NFS_I(src_inode)->cache_validity |= (NFS_INO_REVAL_PAGECACHE |
+                       NFS_INO_REVAL_FORCED | NFS_INO_INVALID_ATIME);
+       spin_unlock(&src_inode->i_lock);
        status = res->write_res.count;
 out:
        if (args->sync)
index 60dbee4..117db82 100644 (file)
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -106,25 +106,6 @@ void pipe_double_lock(struct pipe_inode_info *pipe1,
        }
 }
 
-/* Drop the inode semaphore and wait for a pipe event, atomically */
-void pipe_wait(struct pipe_inode_info *pipe)
-{
-       DEFINE_WAIT(rdwait);
-       DEFINE_WAIT(wrwait);
-
-       /*
-        * Pipes are system-local resources, so sleeping on them
-        * is considered a noninteractive wait:
-        */
-       prepare_to_wait(&pipe->rd_wait, &rdwait, TASK_INTERRUPTIBLE);
-       prepare_to_wait(&pipe->wr_wait, &wrwait, TASK_INTERRUPTIBLE);
-       pipe_unlock(pipe);
-       schedule();
-       finish_wait(&pipe->rd_wait, &rdwait);
-       finish_wait(&pipe->wr_wait, &wrwait);
-       pipe_lock(pipe);
-}
-
 static void anon_pipe_buf_release(struct pipe_inode_info *pipe,
                                  struct pipe_buffer *buf)
 {
@@ -1035,12 +1016,52 @@ SYSCALL_DEFINE1(pipe, int __user *, fildes)
        return do_pipe2(fildes, 0);
 }
 
+/*
+ * This is the stupid "wait for pipe to be readable or writable"
+ * model.
+ *
+ * See pipe_read/write() for the proper kind of exclusive wait,
+ * but that requires that we wake up any other readers/writers
+ * if we then do not end up reading everything (ie the whole
+ * "wake_next_reader/writer" logic in pipe_read/write()).
+ */
+void pipe_wait_readable(struct pipe_inode_info *pipe)
+{
+       pipe_unlock(pipe);
+       wait_event_interruptible(pipe->rd_wait, pipe_readable(pipe));
+       pipe_lock(pipe);
+}
+
+void pipe_wait_writable(struct pipe_inode_info *pipe)
+{
+       pipe_unlock(pipe);
+       wait_event_interruptible(pipe->wr_wait, pipe_writable(pipe));
+       pipe_lock(pipe);
+}
+
+/*
+ * This depends on both the wait (here) and the wakeup (wake_up_partner)
+ * holding the pipe lock, so "*cnt" is stable and we know a wakeup cannot
+ * race with the count check and waitqueue prep.
+ *
+ * Normally in order to avoid races, you'd do the prepare_to_wait() first,
+ * then check the condition you're waiting for, and only then sleep. But
+ * because of the pipe lock, we can check the condition before being on
+ * the wait queue.
+ *
+ * We use the 'rd_wait' waitqueue for pipe partner waiting.
+ */
 static int wait_for_partner(struct pipe_inode_info *pipe, unsigned int *cnt)
 {
+       DEFINE_WAIT(rdwait);
        int cur = *cnt;
 
        while (cur == *cnt) {
-               pipe_wait(pipe);
+               prepare_to_wait(&pipe->rd_wait, &rdwait, TASK_INTERRUPTIBLE);
+               pipe_unlock(pipe);
+               schedule();
+               finish_wait(&pipe->rd_wait, &rdwait);
+               pipe_lock(pipe);
                if (signal_pending(current))
                        break;
        }
@@ -1050,7 +1071,6 @@ static int wait_for_partner(struct pipe_inode_info *pipe, unsigned int *cnt)
 static void wake_up_partner(struct pipe_inode_info *pipe)
 {
        wake_up_interruptible_all(&pipe->rd_wait);
-       wake_up_interruptible_all(&pipe->wr_wait);
 }
 
 static int fifo_open(struct inode *inode, struct file *filp)
index 5db58b8..d342818 100644 (file)
@@ -538,6 +538,14 @@ ssize_t __kernel_write(struct file *file, const void *buf, size_t count, loff_t
        inc_syscw(current);
        return ret;
 }
+/*
+ * This "EXPORT_SYMBOL_GPL()" is more of a "EXPORT_SYMBOL_DONTUSE()",
+ * but autofs is one of the few internal kernel users that actually
+ * wants this _and_ can be built as a module. So we need to export
+ * this symbol for autofs, even though it really isn't appropriate
+ * for any other kernel modules.
+ */
+EXPORT_SYMBOL_GPL(__kernel_write);
 
 ssize_t kernel_write(struct file *file, const void *buf, size_t count,
                            loff_t *pos)
index d7c8a7c..c3d00df 100644 (file)
@@ -563,7 +563,7 @@ static int splice_from_pipe_next(struct pipe_inode_info *pipe, struct splice_des
                        sd->need_wakeup = false;
                }
 
-               pipe_wait(pipe);
+               pipe_wait_readable(pipe);
        }
 
        return 1;
@@ -1077,7 +1077,7 @@ static int wait_for_space(struct pipe_inode_info *pipe, unsigned flags)
                        return -EAGAIN;
                if (signal_pending(current))
                        return -ERESTARTSYS;
-               pipe_wait(pipe);
+               pipe_wait_writable(pipe);
        }
 }
 
@@ -1454,7 +1454,7 @@ static int ipipe_prep(struct pipe_inode_info *pipe, unsigned int flags)
                        ret = -EAGAIN;
                        break;
                }
-               pipe_wait(pipe);
+               pipe_wait_readable(pipe);
        }
 
        pipe_unlock(pipe);
@@ -1493,7 +1493,7 @@ static int opipe_prep(struct pipe_inode_info *pipe, unsigned int flags)
                        ret = -ERESTARTSYS;
                        break;
                }
-               pipe_wait(pipe);
+               pipe_wait_writable(pipe);
        }
 
        pipe_unlock(pipe);
index 8fe03b4..25aade3 100644 (file)
@@ -384,7 +384,7 @@ fail_nomem:
 
 static int vboxsf_parse_monolithic(struct fs_context *fc, void *data)
 {
-       char *options = data;
+       unsigned char *options = data;
 
        if (options && options[0] == VBSF_MOUNT_SIGNATURE_BYTE_0 &&
                       options[1] == VBSF_MOUNT_SIGNATURE_BYTE_1 &&
index 1e4cdc6..64ae25c 100644 (file)
@@ -958,7 +958,7 @@ void acpi_os_set_prepare_extended_sleep(int (*func)(u8 sleep_state,
 acpi_status acpi_os_prepare_extended_sleep(u8 sleep_state,
                                           u32 val_a, u32 val_b);
 
-#ifdef CONFIG_X86
+#ifndef CONFIG_IA64
 void arch_reserve_mem_area(acpi_physical_address addr, size_t size);
 #else
 static inline void arch_reserve_mem_area(acpi_physical_address addr,
index 69b1dab..0f6cd6b 100644 (file)
@@ -30,7 +30,11 @@ static inline unsigned long topology_get_freq_scale(int cpu)
        return per_cpu(freq_scale, cpu);
 }
 
-bool arch_freq_counters_available(struct cpumask *cpus);
+void topology_set_freq_scale(const struct cpumask *cpus, unsigned long cur_freq,
+                            unsigned long max_freq);
+bool topology_scale_freq_invariant(void);
+
+bool arch_freq_counters_available(const struct cpumask *cpus);
 
 DECLARE_PER_CPU(unsigned long, thermal_pressure);
 
index 4ecf4fe..b3fc5d3 100644 (file)
@@ -497,13 +497,12 @@ static inline int op_stat_group(unsigned int op)
 
 typedef unsigned int blk_qc_t;
 #define BLK_QC_T_NONE          -1U
-#define BLK_QC_T_EAGAIN                -2U
 #define BLK_QC_T_SHIFT         16
 #define BLK_QC_T_INTERNAL      (1U << 31)
 
 static inline bool blk_qc_t_valid(blk_qc_t cookie)
 {
-       return cookie != BLK_QC_T_NONE && cookie != BLK_QC_T_EAGAIN;
+       return cookie != BLK_QC_T_NONE;
 }
 
 static inline unsigned int blk_qc_t_to_queue_num(blk_qc_t cookie)
index bb5636c..868e11f 100644 (file)
@@ -352,6 +352,8 @@ struct queue_limits {
 typedef int (*report_zones_cb)(struct blk_zone *zone, unsigned int idx,
                               void *data);
 
+void blk_queue_set_zoned(struct gendisk *disk, enum blk_zoned_model model);
+
 #ifdef CONFIG_BLK_DEV_ZONED
 
 #define BLK_ALL_ZONES  ((unsigned int)-1)
index a911e5d..fa37b1c 100644 (file)
@@ -217,6 +217,7 @@ void refresh_frequency_limits(struct cpufreq_policy *policy);
 void cpufreq_update_policy(unsigned int cpu);
 void cpufreq_update_limits(unsigned int cpu);
 bool have_governor_per_policy(void);
+bool cpufreq_supports_freq_invariance(void);
 struct kobject *get_governor_parent_kobj(struct cpufreq_policy *policy);
 void cpufreq_enable_fast_switch(struct cpufreq_policy *policy);
 void cpufreq_disable_fast_switch(struct cpufreq_policy *policy);
@@ -237,6 +238,10 @@ static inline unsigned int cpufreq_get_hw_max_freq(unsigned int cpu)
 {
        return 0;
 }
+static inline bool cpufreq_supports_freq_invariance(void)
+{
+       return false;
+}
 static inline void disable_cpufreq(void) { }
 #endif
 
@@ -1006,8 +1011,14 @@ static inline void sched_cpufreq_governor_change(struct cpufreq_policy *policy,
 extern void arch_freq_prepare_all(void);
 extern unsigned int arch_freq_get_on_cpu(int cpu);
 
-extern void arch_set_freq_scale(struct cpumask *cpus, unsigned long cur_freq,
-                               unsigned long max_freq);
+#ifndef arch_set_freq_scale
+static __always_inline
+void arch_set_freq_scale(const struct cpumask *cpus,
+                        unsigned long cur_freq,
+                        unsigned long max_freq)
+{
+}
+#endif
 
 /* the following are really really optional */
 extern struct freq_attr cpufreq_freq_attr_scaling_available_freqs;
index 6175c77..ed0da0e 100644 (file)
@@ -38,6 +38,7 @@ struct cpuidle_state_usage {
        u64                     time_ns;
        unsigned long long      above; /* Number of times it's been too deep */
        unsigned long long      below; /* Number of times it's been too shallow */
+       unsigned long long      rejected; /* Number of times idle entry was rejected */
 #ifdef CONFIG_SUSPEND
        unsigned long long      s2idle_usage;
        unsigned long long      s2idle_time; /* in US */
index 4970313..43b39ab 100644 (file)
@@ -58,6 +58,8 @@ static inline void set_dax_synchronous(struct dax_device *dax_dev)
 {
        __set_dax_synchronous(dax_dev);
 }
+bool dax_supported(struct dax_device *dax_dev, struct block_device *bdev,
+               int blocksize, sector_t start, sector_t len);
 /*
  * Check if given mapping is supported by the file / underlying device.
  */
@@ -104,6 +106,12 @@ static inline bool dax_synchronous(struct dax_device *dax_dev)
 static inline void set_dax_synchronous(struct dax_device *dax_dev)
 {
 }
+static inline bool dax_supported(struct dax_device *dax_dev,
+               struct block_device *bdev, int blocksize, sector_t start,
+               sector_t len)
+{
+       return false;
+}
 static inline bool daxdev_mapping_supported(struct vm_area_struct *vma,
                                struct dax_device *dax_dev)
 {
@@ -130,8 +138,6 @@ static inline bool generic_fsdax_supported(struct dax_device *dax_dev,
        return __generic_fsdax_supported(dax_dev, bdev, blocksize, start,
                        sectors);
 }
-bool dax_supported(struct dax_device *dax_dev, struct block_device *bdev,
-               int blocksize, sector_t start, sector_t len);
 
 static inline void fs_put_dax(struct dax_device *dax_dev)
 {
@@ -159,13 +165,6 @@ static inline bool generic_fsdax_supported(struct dax_device *dax_dev,
        return false;
 }
 
-static inline bool dax_supported(struct dax_device *dax_dev,
-               struct block_device *bdev, int blocksize, sector_t start,
-               sector_t len)
-{
-       return false;
-}
-
 static inline void fs_put_dax(struct dax_device *dax_dev)
 {
 }
index f14f17f..4a50a5c 100644 (file)
@@ -106,8 +106,11 @@ extern int devfreq_event_get_event(struct devfreq_event_dev *edev,
                                struct devfreq_event_data *edata);
 extern int devfreq_event_reset_event(struct devfreq_event_dev *edev);
 extern struct devfreq_event_dev *devfreq_event_get_edev_by_phandle(
-                               struct device *dev, int index);
-extern int devfreq_event_get_edev_count(struct device *dev);
+                               struct device *dev,
+                               const char *phandle_name,
+                               int index);
+extern int devfreq_event_get_edev_count(struct device *dev,
+                               const char *phandle_name);
 extern struct devfreq_event_dev *devfreq_event_add_edev(struct device *dev,
                                struct devfreq_event_desc *desc);
 extern int devfreq_event_remove_edev(struct devfreq_event_dev *edev);
@@ -152,12 +155,15 @@ static inline int devfreq_event_reset_event(struct devfreq_event_dev *edev)
 }
 
 static inline struct devfreq_event_dev *devfreq_event_get_edev_by_phandle(
-                                       struct device *dev, int index)
+                                       struct device *dev,
+                                       const char *phandle_name,
+                                       int index)
 {
        return ERR_PTR(-EINVAL);
 }
 
-static inline int devfreq_event_get_edev_count(struct device *dev)
+static inline int devfreq_event_get_edev_count(struct device *dev,
+                                       const char *phandle_name)
 {
        return -EINVAL;
 }
index 12782fb..2f4a74e 100644 (file)
@@ -261,7 +261,9 @@ void devm_devfreq_unregister_notifier(struct device *dev,
                                struct devfreq *devfreq,
                                struct notifier_block *nb,
                                unsigned int list);
-struct devfreq *devfreq_get_devfreq_by_phandle(struct device *dev, int index);
+struct devfreq *devfreq_get_devfreq_by_node(struct device_node *node);
+struct devfreq *devfreq_get_devfreq_by_phandle(struct device *dev,
+                               const char *phandle_name, int index);
 
 #if IS_ENABLED(CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND)
 /**
@@ -414,8 +416,13 @@ static inline void devm_devfreq_unregister_notifier(struct device *dev,
 {
 }
 
+static inline struct devfreq *devfreq_get_devfreq_by_node(struct device_node *node)
+{
+       return ERR_PTR(-ENODEV);
+}
+
 static inline struct devfreq *devfreq_get_devfreq_by_phandle(struct device *dev,
-                                       int index)
+                                       const char *phandle_name, int index)
 {
        return ERR_PTR(-ENODEV);
 }
index 2eab6d5..aab0ffc 100644 (file)
@@ -120,7 +120,7 @@ static inline bool fs_validate_description(const char *name,
 #define fsparam_u32oct(NAME, OPT) \
                        __fsparam(fs_param_is_u32, NAME, OPT, 0, (void *)8)
 #define fsparam_u32hex(NAME, OPT) \
-                       __fsparam(fs_param_is_u32_hex, NAME, OPT, 0, (void *16))
+                       __fsparam(fs_param_is_u32_hex, NAME, OPT, 0, (void *)16)
 #define fsparam_s32(NAME, OPT) __fsparam(fs_param_is_s32, NAME, OPT, 0, NULL)
 #define fsparam_u64(NAME, OPT) __fsparam(fs_param_is_u64, NAME, OPT, 0, NULL)
 #define fsparam_enum(NAME, OPT, array) __fsparam(fs_param_is_enum, NAME, OPT, 0, array)
index 9be1bff..8aab327 100644 (file)
@@ -373,6 +373,8 @@ void unregister_kretprobes(struct kretprobe **rps, int num);
 void kprobe_flush_task(struct task_struct *tk);
 void recycle_rp_inst(struct kretprobe_instance *ri, struct hlist_head *head);
 
+void kprobe_free_init_mem(void);
+
 int disable_kprobe(struct kprobe *kp);
 int enable_kprobe(struct kprobe *kp);
 
@@ -435,6 +437,9 @@ static inline void unregister_kretprobes(struct kretprobe **rps, int num)
 static inline void kprobe_flush_task(struct task_struct *tk)
 {
 }
+static inline void kprobe_free_init_mem(void)
+{
+}
 static inline int disable_kprobe(struct kprobe *kp)
 {
        return -ENOSYS;
index da4c65f..ebf73d4 100644 (file)
@@ -281,6 +281,7 @@ struct memstick_host {
 
        struct memstick_dev *card;
        unsigned int        retries;
+       bool removing;
 
        /* Notify the host that some requests are pending. */
        void                (*request)(struct memstick_host *host);
index b2f370f..16b799a 100644 (file)
@@ -1646,7 +1646,7 @@ struct mmu_notifier_range;
 void free_pgd_range(struct mmu_gather *tlb, unsigned long addr,
                unsigned long end, unsigned long floor, unsigned long ceiling);
 int copy_page_range(struct mm_struct *dst, struct mm_struct *src,
-                       struct vm_area_struct *vma);
+                   struct vm_area_struct *vma, struct vm_area_struct *new);
 int follow_pte_pmd(struct mm_struct *mm, unsigned long address,
                   struct mmu_notifier_range *range,
                   pte_t **ptepp, pmd_t **pmdpp, spinlock_t **ptlp);
@@ -2416,7 +2416,7 @@ extern int __meminit __early_pfn_to_nid(unsigned long pfn,
 
 extern void set_dma_reserve(unsigned long new_dma_reserve);
 extern void memmap_init_zone(unsigned long, int, unsigned long, unsigned long,
-               enum memmap_context, struct vmem_altmap *);
+               enum meminit_context, struct vmem_altmap *);
 extern void setup_per_zone_wmarks(void);
 extern int __meminit init_per_zone_wmark_min(void);
 extern void mem_init(void);
index 496c3ff..ed028af 100644 (file)
@@ -436,6 +436,16 @@ struct mm_struct {
                 */
                atomic_t mm_count;
 
+               /**
+                * @has_pinned: Whether this mm has pinned any pages.  This can
+                * be either replaced in the future by @pinned_vm when it
+                * becomes stable, or grow into a counter on its own. We're
+                * aggresive on this bit now - even if the pinned pages were
+                * unpinned later on, we'll still keep this bit set for the
+                * lifecycle of this mm just for simplicity.
+                */
+               atomic_t has_pinned;
+
 #ifdef CONFIG_MMU
                atomic_long_t pgtables_bytes;   /* PTE page table pages */
 #endif
index 8379432..0f7a4ff 100644 (file)
@@ -824,10 +824,15 @@ bool zone_watermark_ok(struct zone *z, unsigned int order,
                unsigned int alloc_flags);
 bool zone_watermark_ok_safe(struct zone *z, unsigned int order,
                unsigned long mark, int highest_zoneidx);
-enum memmap_context {
-       MEMMAP_EARLY,
-       MEMMAP_HOTPLUG,
+/*
+ * Memory initialization context, use to differentiate memory added by
+ * the platform statically or via memory hotplug interface.
+ */
+enum meminit_context {
+       MEMINIT_EARLY,
+       MEMINIT_HOTPLUG,
 };
+
 extern void init_currently_empty_zone(struct zone *zone, unsigned long start_pfn,
                                     unsigned long size);
 
index 2cc3cf8..0b17c43 100644 (file)
@@ -193,7 +193,7 @@ static inline int find_next_netdev_feature(u64 feature, unsigned long start)
 #define NETIF_F_GSO_MASK       (__NETIF_F_BIT(NETIF_F_GSO_LAST + 1) - \
                __NETIF_F_BIT(NETIF_F_GSO_SHIFT))
 
-/* List of IP checksum features. Note that NETIF_F_ HW_CSUM should not be
+/* List of IP checksum features. Note that NETIF_F_HW_CSUM should not be
  * set in features when NETIF_F_IP_CSUM or NETIF_F_IPV6_CSUM are set--
  * this would be contradictory
  */
index b0e303f..7bd4fcd 100644 (file)
@@ -1784,6 +1784,7 @@ enum netdev_priv_flags {
  *                             the watchdog (see dev_watchdog())
  *     @watchdog_timer:        List of timers
  *
+ *     @proto_down_reason:     reason a netdev interface is held down
  *     @pcpu_refcnt:           Number of references to this device
  *     @todo_list:             Delayed register/unregister
  *     @link_watch_list:       XXX: need comments on this one
@@ -1848,6 +1849,7 @@ enum netdev_priv_flags {
  *     @udp_tunnel_nic_info:   static structure describing the UDP tunnel
  *                             offload capabilities of the device
  *     @udp_tunnel_nic:        UDP tunnel offload state
+ *     @xdp_state:             stores info on attached XDP BPF programs
  *
  *     FIXME: cleanup struct net_device such that network protocol info
  *     moves out.
index 9408f32..69cb46f 100644 (file)
@@ -1611,8 +1611,8 @@ struct nfs_pgio_header {
        __u64                   mds_offset;     /* Filelayout dense stripe */
        struct nfs_page_array   page_array;
        struct nfs_client       *ds_clp;        /* pNFS data server */
-       int                     ds_commit_idx;  /* ds index if ds_clp is set */
-       int                     pgio_mirror_idx;/* mirror index in pgio layer */
+       u32                     ds_commit_idx;  /* ds index if ds_clp is set */
+       u32                     pgio_mirror_idx;/* mirror index in pgio layer */
 };
 
 struct nfs_mds_commit_info {
index 4866f32..014ba3a 100644 (file)
@@ -99,11 +99,13 @@ extern struct node *node_devices[];
 typedef  void (*node_registration_func_t)(struct node *);
 
 #if defined(CONFIG_MEMORY_HOTPLUG_SPARSE) && defined(CONFIG_NUMA)
-extern int link_mem_sections(int nid, unsigned long start_pfn,
-                            unsigned long end_pfn);
+int link_mem_sections(int nid, unsigned long start_pfn,
+                     unsigned long end_pfn,
+                     enum meminit_context context);
 #else
 static inline int link_mem_sections(int nid, unsigned long start_pfn,
-                                   unsigned long end_pfn)
+                                   unsigned long end_pfn,
+                                   enum meminit_context context)
 {
        return 0;
 }
@@ -128,7 +130,8 @@ static inline int register_one_node(int nid)
                if (error)
                        return error;
                /* link memory sections under this node */
-               error = link_mem_sections(nid, start_pfn, end_pfn);
+               error = link_mem_sections(nid, start_pfn, end_pfn,
+                                         MEMINIT_EARLY);
        }
 
        return error;
index e8cbc2e..90654cb 100644 (file)
@@ -1427,6 +1427,16 @@ typedef unsigned int pgtbl_mod_mask;
 #define mm_pmd_folded(mm)      __is_defined(__PAGETABLE_PMD_FOLDED)
 #endif
 
+#ifndef p4d_offset_lockless
+#define p4d_offset_lockless(pgdp, pgd, address) p4d_offset(&(pgd), address)
+#endif
+#ifndef pud_offset_lockless
+#define pud_offset_lockless(p4dp, p4d, address) pud_offset(&(p4d), address)
+#endif
+#ifndef pmd_offset_lockless
+#define pmd_offset_lockless(pudp, pud, address) pmd_offset(&(pud), address)
+#endif
+
 /*
  * p?d_leaf() - true if this entry is a final mapping to a physical address.
  * This differs from p?d_huge() by the fact that they are always available (if
index 50afd0d..5d2705f 100644 (file)
@@ -240,8 +240,9 @@ extern unsigned int pipe_max_size;
 extern unsigned long pipe_user_pages_hard;
 extern unsigned long pipe_user_pages_soft;
 
-/* Drop the inode semaphore and wait for a pipe event, atomically */
-void pipe_wait(struct pipe_inode_info *pipe);
+/* Wait for a pipe to be readable/writable while dropping the pipe lock */
+void pipe_wait_readable(struct pipe_inode_info *);
+void pipe_wait_writable(struct pipe_inode_info *);
 
 struct pipe_inode_info *alloc_pipe_info(void);
 void free_pipe_info(struct pipe_inode_info *);
index a30a4b5..47aca6b 100644 (file)
@@ -590,7 +590,7 @@ struct dev_pm_info {
 #endif
 #ifdef CONFIG_PM
        struct hrtimer          suspend_timer;
-       unsigned long           timer_expires;
+       u64                     timer_expires;
        struct work_struct      work;
        wait_queue_head_t       wait_queue;
        struct wake_irq         *wakeirq;
index ee11502..66f3c5d 100644 (file)
@@ -64,8 +64,8 @@
 #define GENPD_FLAG_RPM_ALWAYS_ON (1U << 5)
 
 enum gpd_status {
-       GPD_STATE_ACTIVE = 0,   /* PM domain is active */
-       GPD_STATE_POWER_OFF,    /* PM domain is off */
+       GENPD_STATE_ON = 0,     /* PM domain is on */
+       GENPD_STATE_OFF,        /* PM domain is off */
 };
 
 struct dev_power_governor {
index 14ad9b9..2a1bfb8 100644 (file)
@@ -18,7 +18,7 @@ bool psci_tos_resident_on(int cpu);
 
 int psci_cpu_suspend_enter(u32 state);
 bool psci_power_state_is_valid(u32 state);
-int psci_set_osi_mode(void);
+int psci_set_osi_mode(bool enable);
 bool psci_has_osi_support(void);
 
 struct psci_operations {
index cd6a5c7..cdd73af 100644 (file)
@@ -623,6 +623,7 @@ struct qed_dev_info {
 #define QED_MFW_VERSION_3_OFFSET       24
 
        u32             flash_size;
+       bool            b_arfs_capable;
        bool            b_inter_pf_switch;
        bool            tx_switching;
        bool            rdma_supported;
index ed9bea9..04a18e0 100644 (file)
@@ -3223,8 +3223,9 @@ static inline int skb_padto(struct sk_buff *skb, unsigned int len)
  *     is untouched. Otherwise it is extended. Returns zero on
  *     success. The skb is freed on error if @free_on_error is true.
  */
-static inline int __skb_put_padto(struct sk_buff *skb, unsigned int len,
-                                 bool free_on_error)
+static inline int __must_check __skb_put_padto(struct sk_buff *skb,
+                                              unsigned int len,
+                                              bool free_on_error)
 {
        unsigned int size = skb->len;
 
@@ -3247,7 +3248,7 @@ static inline int __skb_put_padto(struct sk_buff *skb, unsigned int len,
  *     is untouched. Otherwise it is extended. Returns zero on
  *     success. The skb is freed on error.
  */
-static inline int skb_put_padto(struct sk_buff *skb, unsigned int len)
+static inline int __must_check skb_put_padto(struct sk_buff *skb, unsigned int len)
 {
        return __skb_put_padto(skb, len, true);
 }
index 91220ac..7557c10 100644 (file)
@@ -312,6 +312,11 @@ static inline void __mod_zone_page_state(struct zone *zone,
 static inline void __mod_node_page_state(struct pglist_data *pgdat,
                        enum node_stat_item item, int delta)
 {
+       if (vmstat_item_in_bytes(item)) {
+               VM_WARN_ON_ONCE(delta & (PAGE_SIZE - 1));
+               delta >>= PAGE_SHIFT;
+       }
+
        node_page_state_add(delta, pgdat, item);
 }
 
index 52ef920..bbb3f26 100644 (file)
@@ -744,8 +744,6 @@ void vb2_core_querybuf(struct vb2_queue *q, unsigned int index, void *pb);
  * vb2_core_reqbufs() - Initiate streaming.
  * @q:         pointer to &struct vb2_queue with videobuf2 queue.
  * @memory:    memory type, as defined by &enum vb2_memory.
- * @flags:     auxiliary queue/buffer management flags. Currently, the only
- *             used flag is %V4L2_FLAG_MEMORY_NON_CONSISTENT.
  * @count:     requested buffer count.
  *
  * Videobuf2 core helper to implement VIDIOC_REQBUF() operation. It is called
@@ -770,13 +768,12 @@ void vb2_core_querybuf(struct vb2_queue *q, unsigned int index, void *pb);
  * Return: returns zero on success; an error code otherwise.
  */
 int vb2_core_reqbufs(struct vb2_queue *q, enum vb2_memory memory,
-                   unsigned int flags, unsigned int *count);
+                   unsigned int *count);
 
 /**
  * vb2_core_create_bufs() - Allocate buffers and any required auxiliary structs
  * @q: pointer to &struct vb2_queue with videobuf2 queue.
  * @memory: memory type, as defined by &enum vb2_memory.
- * @flags: auxiliary queue/buffer management flags.
  * @count: requested buffer count.
  * @requested_planes: number of planes requested.
  * @requested_sizes: array with the size of the planes.
@@ -794,7 +791,7 @@ int vb2_core_reqbufs(struct vb2_queue *q, enum vb2_memory memory,
  * Return: returns zero on success; an error code otherwise.
  */
 int vb2_core_create_bufs(struct vb2_queue *q, enum vb2_memory memory,
-                        unsigned int flags, unsigned int *count,
+                        unsigned int *count,
                         unsigned int requested_planes,
                         const unsigned int requested_sizes[]);
 
index 929d3ca..b2531df 100644 (file)
@@ -116,6 +116,7 @@ static inline void flowi4_init_output(struct flowi4 *fl4, int oif,
        fl4->saddr = saddr;
        fl4->fl4_dport = dport;
        fl4->fl4_sport = sport;
+       fl4->flowi4_multipath_hash = 0;
 }
 
 /* Reset some input parameters after previous lookup */
index c0411f1..8e0eb2c 100644 (file)
@@ -726,7 +726,6 @@ static inline int __nlmsg_parse(const struct nlmsghdr *nlh, int hdrlen,
  * @hdrlen: length of family specific header
  * @tb: destination array with maxtype+1 elements
  * @maxtype: maximum attribute type to be expected
- * @validate: validation strictness
  * @extack: extended ACK report struct
  *
  * See nla_parse()
@@ -824,7 +823,6 @@ static inline int nla_validate_deprecated(const struct nlattr *head, int len,
  * @len: length of attribute stream
  * @maxtype: maximum attribute type to be expected
  * @policy: validation policy
- * @validate: validation strictness
  * @extack: extended ACK report struct
  *
  * Validates all attributes in the specified attribute stream against the
index a1a8d45..6c0806b 100644 (file)
@@ -8,6 +8,7 @@ struct netns_nftables {
        struct list_head        tables;
        struct list_head        commit_list;
        struct list_head        module_list;
+       struct list_head        notify_list;
        struct mutex            commit_mutex;
        unsigned int            base_seq;
        u8                      gencursor;
index b33f1ae..0bdff38 100644 (file)
@@ -226,12 +226,14 @@ struct sctp_sock {
                data_ready_signalled:1;
 
        atomic_t pd_mode;
+
+       /* Fields after this point will be skipped on copies, like on accept
+        * and peeloff operations
+        */
+
        /* Receive to here while partial delivery is in effect. */
        struct sk_buff_head pd_lobby;
 
-       /* These must be the last fields, as they will skipped on copies,
-        * like on accept and peeloff operations
-        */
        struct list_head auto_asconf_list;
        int do_auto_asconf;
 };
index 3a41627..08537aa 100644 (file)
@@ -121,6 +121,9 @@ struct vxlanhdr_gbp {
 #define VXLAN_GBP_POLICY_APPLIED       (BIT(3) << 16)
 #define VXLAN_GBP_ID_MASK              (0xFFFF)
 
+#define VXLAN_GBP_MASK (VXLAN_GBP_DONT_LEARN | VXLAN_GBP_POLICY_APPLIED | \
+                       VXLAN_GBP_ID_MASK)
+
 /*
  * VXLAN Generic Protocol Extension (VXLAN_F_GPE):
  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
index da369b1..0ac4e7f 100644 (file)
@@ -566,6 +566,7 @@ struct ocelot_port {
        u8                              ptp_cmd;
        struct sk_buff_head             tx_skbs;
        u8                              ts_id;
+       spinlock_t                      ts_id_lock;
 
        phy_interface_t                 phy_mode;
 
@@ -677,6 +678,7 @@ void ocelot_configure_cpu(struct ocelot *ocelot, int npi,
 int ocelot_init(struct ocelot *ocelot);
 void ocelot_deinit(struct ocelot *ocelot);
 void ocelot_init_port(struct ocelot *ocelot, int port);
+void ocelot_deinit_port(struct ocelot *ocelot, int port);
 
 /* DSA callbacks */
 void ocelot_port_enable(struct ocelot *ocelot, int port,
index 5dcd24c..72ba36b 100644 (file)
@@ -79,6 +79,7 @@ enum {
        ETHTOOL_MSG_TSINFO_GET_REPLY,
        ETHTOOL_MSG_CABLE_TEST_NTF,
        ETHTOOL_MSG_CABLE_TEST_TDR_NTF,
+       ETHTOOL_MSG_TUNNEL_INFO_GET_REPLY,
 
        /* add new constants above here */
        __ETHTOOL_MSG_KERNEL_CNT,
index c7b70ff..235db77 100644 (file)
@@ -191,8 +191,6 @@ enum v4l2_memory {
        V4L2_MEMORY_DMABUF           = 4,
 };
 
-#define V4L2_FLAG_MEMORY_NON_CONSISTENT                (1 << 0)
-
 /* see also http://vektor.theorem.ca/graphics/ycbcr/ */
 enum v4l2_colorspace {
        /*
@@ -949,10 +947,7 @@ struct v4l2_requestbuffers {
        __u32                   type;           /* enum v4l2_buf_type */
        __u32                   memory;         /* enum v4l2_memory */
        __u32                   capabilities;
-       union {
-               __u32           flags;
-               __u32           reserved[1];
-       };
+       __u32                   reserved[1];
 };
 
 /* capabilities for struct v4l2_requestbuffers and v4l2_create_buffers */
@@ -2456,9 +2451,6 @@ struct v4l2_dbg_chip_info {
  * @memory:    enum v4l2_memory; buffer memory type
  * @format:    frame format, for which buffers are requested
  * @capabilities: capabilities of this buffer type.
- * @flags:     additional buffer management attributes (ignored unless the
- *             queue has V4L2_BUF_CAP_SUPPORTS_MMAP_CACHE_HINTS capability
- *             and configured for MMAP streaming I/O).
  * @reserved:  future extensions
  */
 struct v4l2_create_buffers {
@@ -2467,8 +2459,7 @@ struct v4l2_create_buffers {
        __u32                   memory;
        struct v4l2_format      format;
        __u32                   capabilities;
-       __u32                   flags;
-       __u32                   reserved[6];
+       __u32                   reserved[7];
 };
 
 /*
index ae78fb6..e880b4e 100644 (file)
@@ -33,6 +33,7 @@
 #include <linux/nmi.h>
 #include <linux/percpu.h>
 #include <linux/kmod.h>
+#include <linux/kprobes.h>
 #include <linux/vmalloc.h>
 #include <linux/kernel_stat.h>
 #include <linux/start_kernel.h>
@@ -303,7 +304,7 @@ static void * __init get_boot_config_from_initrd(u32 *_size, u32 *_csum)
 
 #ifdef CONFIG_BOOT_CONFIG
 
-char xbc_namebuf[XBC_KEYLEN_MAX] __initdata;
+static char xbc_namebuf[XBC_KEYLEN_MAX] __initdata;
 
 #define rest(dst, end) ((end) > (dst) ? (end) - (dst) : 0)
 
@@ -1402,6 +1403,7 @@ static int __ref kernel_init(void *unused)
        kernel_init_freeable();
        /* need to finish all async __init code before freeing the memory */
        async_synchronize_full();
+       kprobe_free_init_mem();
        ftrace_free_init_mem();
        free_initmem();
        mark_readonly();
index 78dfff6..7df28a4 100644 (file)
@@ -1622,7 +1622,6 @@ struct bpf_iter_seq_hash_map_info {
        struct bpf_map *map;
        struct bpf_htab *htab;
        void *percpu_value_buf; // non-zero means percpu hash
-       unsigned long flags;
        u32 bucket_id;
        u32 skip_elems;
 };
@@ -1632,7 +1631,6 @@ bpf_hash_map_seq_find_next(struct bpf_iter_seq_hash_map_info *info,
                           struct htab_elem *prev_elem)
 {
        const struct bpf_htab *htab = info->htab;
-       unsigned long flags = info->flags;
        u32 skip_elems = info->skip_elems;
        u32 bucket_id = info->bucket_id;
        struct hlist_nulls_head *head;
@@ -1656,19 +1654,18 @@ bpf_hash_map_seq_find_next(struct bpf_iter_seq_hash_map_info *info,
 
                /* not found, unlock and go to the next bucket */
                b = &htab->buckets[bucket_id++];
-               htab_unlock_bucket(htab, b, flags);
+               rcu_read_unlock();
                skip_elems = 0;
        }
 
        for (i = bucket_id; i < htab->n_buckets; i++) {
                b = &htab->buckets[i];
-               flags = htab_lock_bucket(htab, b);
+               rcu_read_lock();
 
                count = 0;
                head = &b->head;
                hlist_nulls_for_each_entry_rcu(elem, n, head, hash_node) {
                        if (count >= skip_elems) {
-                               info->flags = flags;
                                info->bucket_id = i;
                                info->skip_elems = count;
                                return elem;
@@ -1676,7 +1673,7 @@ bpf_hash_map_seq_find_next(struct bpf_iter_seq_hash_map_info *info,
                        count++;
                }
 
-               htab_unlock_bucket(htab, b, flags);
+               rcu_read_unlock();
                skip_elems = 0;
        }
 
@@ -1754,14 +1751,10 @@ static int bpf_hash_map_seq_show(struct seq_file *seq, void *v)
 
 static void bpf_hash_map_seq_stop(struct seq_file *seq, void *v)
 {
-       struct bpf_iter_seq_hash_map_info *info = seq->private;
-
        if (!v)
                (void)__bpf_hash_map_seq_show(seq, NULL);
        else
-               htab_unlock_bucket(info->htab,
-                                  &info->htab->buckets[info->bucket_id],
-                                  info->flags);
+               rcu_read_unlock();
 }
 
 static int bpf_iter_init_hash_map(void *priv_data,
index fb878ba..18f4969 100644 (file)
@@ -226,10 +226,12 @@ static void *map_seq_next(struct seq_file *m, void *v, loff_t *pos)
        else
                prev_key = key;
 
+       rcu_read_lock();
        if (map->ops->map_get_next_key(map, prev_key, key)) {
                map_iter(m)->done = true;
-               return NULL;
+               key = NULL;
        }
+       rcu_read_unlock();
        return key;
 }
 
index 49677d6..da8d360 100644 (file)
@@ -589,7 +589,7 @@ static __latent_entropy int dup_mmap(struct mm_struct *mm,
 
                mm->map_count++;
                if (!(tmp->vm_flags & VM_WIPEONFORK))
-                       retval = copy_page_range(mm, oldmm, mpnt);
+                       retval = copy_page_range(mm, oldmm, mpnt, tmp);
 
                if (tmp->vm_ops && tmp->vm_ops->open)
                        tmp->vm_ops->open(tmp);
@@ -1011,6 +1011,7 @@ static struct mm_struct *mm_init(struct mm_struct *mm, struct task_struct *p,
        mm_pgtables_bytes_init(mm);
        mm->map_count = 0;
        mm->locked_vm = 0;
+       atomic_set(&mm->has_pinned, 0);
        atomic64_set(&mm->pinned_vm, 0);
        memset(&mm->rss_stat, 0, sizeof(mm->rss_stat));
        spin_lock_init(&mm->page_table_lock);
index 049da84..e995541 100644 (file)
@@ -2162,9 +2162,10 @@ static void kill_kprobe(struct kprobe *p)
 
        /*
         * The module is going away. We should disarm the kprobe which
-        * is using ftrace.
+        * is using ftrace, because ftrace framework is still available at
+        * MODULE_STATE_GOING notification.
         */
-       if (kprobe_ftrace(p))
+       if (kprobe_ftrace(p) && !kprobe_disabled(p) && !kprobes_all_disarmed)
                disarm_kprobe_ftrace(p);
 }
 
@@ -2459,6 +2460,28 @@ static struct notifier_block kprobe_module_nb = {
 extern unsigned long __start_kprobe_blacklist[];
 extern unsigned long __stop_kprobe_blacklist[];
 
+void kprobe_free_init_mem(void)
+{
+       void *start = (void *)(&__init_begin);
+       void *end = (void *)(&__init_end);
+       struct hlist_head *head;
+       struct kprobe *p;
+       int i;
+
+       mutex_lock(&kprobe_mutex);
+
+       /* Kill all kprobes on initmem */
+       for (i = 0; i < KPROBE_TABLE_SIZE; i++) {
+               head = &kprobe_table[i];
+               hlist_for_each_entry(p, head, hlist) {
+                       if (start <= (void *)p->addr && (void *)p->addr < end)
+                               kill_kprobe(p);
+               }
+       }
+
+       mutex_unlock(&kprobe_mutex);
+}
+
 static int __init init_kprobes(void)
 {
        int i, err = 0;
index 835e2df..05d3e13 100644 (file)
@@ -590,7 +590,7 @@ void exit_tasks_rcu_finish(void) __releases(&tasks_rcu_exit_srcu)
 }
 
 #else /* #ifdef CONFIG_TASKS_RCU */
-static void show_rcu_tasks_classic_gp_kthread(void) { }
+static inline void show_rcu_tasks_classic_gp_kthread(void) { }
 void exit_tasks_rcu_start(void) { }
 void exit_tasks_rcu_finish(void) { exit_tasks_rcu_finish_trace(current); }
 #endif /* #else #ifdef CONFIG_TASKS_RCU */
index 8ce77d9..f78ee75 100644 (file)
@@ -673,6 +673,7 @@ void rcu_idle_enter(void)
        lockdep_assert_irqs_disabled();
        rcu_eqs_enter(false);
 }
+EXPORT_SYMBOL_GPL(rcu_idle_enter);
 
 #ifdef CONFIG_NO_HZ_FULL
 /**
@@ -886,6 +887,7 @@ void rcu_idle_exit(void)
        rcu_eqs_exit(false);
        local_irq_restore(flags);
 }
+EXPORT_SYMBOL_GPL(rcu_idle_exit);
 
 #ifdef CONFIG_NO_HZ_FULL
 /**
index e390082..5ae7b4e 100644 (file)
@@ -114,22 +114,8 @@ static bool sugov_update_next_freq(struct sugov_policy *sg_policy, u64 time,
 static void sugov_fast_switch(struct sugov_policy *sg_policy, u64 time,
                              unsigned int next_freq)
 {
-       struct cpufreq_policy *policy = sg_policy->policy;
-       int cpu;
-
-       if (!sugov_update_next_freq(sg_policy, time, next_freq))
-               return;
-
-       next_freq = cpufreq_driver_fast_switch(policy, next_freq);
-       if (!next_freq)
-               return;
-
-       policy->cur = next_freq;
-
-       if (trace_cpu_frequency_enabled()) {
-               for_each_cpu(cpu, policy->cpus)
-                       trace_cpu_frequency(next_freq, cpu);
-       }
+       if (sugov_update_next_freq(sg_policy, time, next_freq))
+               cpufreq_driver_fast_switch(sg_policy->policy, next_freq);
 }
 
 static void sugov_deferred_update(struct sugov_policy *sg_policy, u64 time,
index e9fa580..5414539 100644 (file)
@@ -2782,6 +2782,7 @@ static void ftrace_remove_trampoline_from_kallsyms(struct ftrace_ops *ops)
 {
        lockdep_assert_held(&ftrace_lock);
        list_del_rcu(&ops->list);
+       synchronize_rcu();
 }
 
 /*
@@ -2862,6 +2863,8 @@ int ftrace_startup(struct ftrace_ops *ops, int command)
                __unregister_ftrace_function(ops);
                ftrace_start_up--;
                ops->flags &= ~FTRACE_OPS_FL_ENABLED;
+               if (ops->flags & FTRACE_OPS_FL_DYNAMIC)
+                       ftrace_trampoline_free(ops);
                return ret;
        }
 
@@ -6990,16 +6993,14 @@ static void ftrace_ops_assist_func(unsigned long ip, unsigned long parent_ip,
 {
        int bit;
 
-       if ((op->flags & FTRACE_OPS_FL_RCU) && !rcu_is_watching())
-               return;
-
        bit = trace_test_and_set_recursion(TRACE_LIST_START, TRACE_LIST_MAX);
        if (bit < 0)
                return;
 
        preempt_disable_notrace();
 
-       op->func(ip, parent_ip, op, regs);
+       if (!(op->flags & FTRACE_OPS_FL_RCU) || rcu_is_watching())
+               op->func(ip, parent_ip, op, regs);
 
        preempt_enable_notrace();
        trace_clear_recursion(bit);
index f40d850..d3e5de7 100644 (file)
@@ -3546,13 +3546,15 @@ struct trace_entry *trace_find_next_entry(struct trace_iterator *iter,
        if (iter->ent && iter->ent != iter->temp) {
                if ((!iter->temp || iter->temp_size < iter->ent_size) &&
                    !WARN_ON_ONCE(iter->temp == static_temp_buf)) {
-                       kfree(iter->temp);
-                       iter->temp = kmalloc(iter->ent_size, GFP_KERNEL);
-                       if (!iter->temp)
+                       void *temp;
+                       temp = kmalloc(iter->ent_size, GFP_KERNEL);
+                       if (!temp)
                                return NULL;
+                       kfree(iter->temp);
+                       iter->temp = temp;
+                       iter->temp_size = iter->ent_size;
                }
                memcpy(iter->temp, iter->ent, iter->ent_size);
-               iter->temp_size = iter->ent_size;
                iter->ent = iter->temp;
        }
        entry = __find_next_entry(iter, ent_cpu, NULL, ent_ts);
@@ -3782,14 +3784,14 @@ unsigned long trace_total_entries(struct trace_array *tr)
 
 static void print_lat_help_header(struct seq_file *m)
 {
-       seq_puts(m, "#                  _------=> CPU#            \n"
-                   "#                 / _-----=> irqs-off        \n"
-                   "#                | / _----=> need-resched    \n"
-                   "#                || / _---=> hardirq/softirq \n"
-                   "#                ||| / _--=> preempt-depth   \n"
-                   "#                |||| /     delay            \n"
-                   "#  cmd     pid   ||||| time  |   caller      \n"
-                   "#     \\   /      |||||  \\    |   /         \n");
+       seq_puts(m, "#                    _------=> CPU#            \n"
+                   "#                   / _-----=> irqs-off        \n"
+                   "#                  | / _----=> need-resched    \n"
+                   "#                  || / _---=> hardirq/softirq \n"
+                   "#                  ||| / _--=> preempt-depth   \n"
+                   "#                  |||| /     delay            \n"
+                   "#  cmd     pid     ||||| time  |   caller      \n"
+                   "#     \\   /        |||||  \\    |   /         \n");
 }
 
 static void print_event_info(struct array_buffer *buf, struct seq_file *m)
@@ -3810,26 +3812,26 @@ static void print_func_help_header(struct array_buffer *buf, struct seq_file *m,
 
        print_event_info(buf, m);
 
-       seq_printf(m, "#           TASK-PID   %s  CPU#   TIMESTAMP  FUNCTION\n", tgid ? "TGID     " : "");
-       seq_printf(m, "#              | |     %s    |       |         |\n",      tgid ? "  |      " : "");
+       seq_printf(m, "#           TASK-PID    %s CPU#     TIMESTAMP  FUNCTION\n", tgid ? "   TGID   " : "");
+       seq_printf(m, "#              | |      %s   |         |         |\n",      tgid ? "     |    " : "");
 }
 
 static void print_func_help_header_irq(struct array_buffer *buf, struct seq_file *m,
                                       unsigned int flags)
 {
        bool tgid = flags & TRACE_ITER_RECORD_TGID;
-       const char *space = "          ";
-       int prec = tgid ? 10 : 2;
+       const char *space = "            ";
+       int prec = tgid ? 12 : 2;
 
        print_event_info(buf, m);
 
-       seq_printf(m, "#                          %.*s  _-----=> irqs-off\n", prec, space);
-       seq_printf(m, "#                          %.*s / _----=> need-resched\n", prec, space);
-       seq_printf(m, "#                          %.*s| / _---=> hardirq/softirq\n", prec, space);
-       seq_printf(m, "#                          %.*s|| / _--=> preempt-depth\n", prec, space);
-       seq_printf(m, "#                          %.*s||| /     delay\n", prec, space);
-       seq_printf(m, "#           TASK-PID %.*sCPU#  ||||    TIMESTAMP  FUNCTION\n", prec, "   TGID   ");
-       seq_printf(m, "#              | |   %.*s  |   ||||       |         |\n", prec, "     |    ");
+       seq_printf(m, "#                            %.*s  _-----=> irqs-off\n", prec, space);
+       seq_printf(m, "#                            %.*s / _----=> need-resched\n", prec, space);
+       seq_printf(m, "#                            %.*s| / _---=> hardirq/softirq\n", prec, space);
+       seq_printf(m, "#                            %.*s|| / _--=> preempt-depth\n", prec, space);
+       seq_printf(m, "#                            %.*s||| /     delay\n", prec, space);
+       seq_printf(m, "#           TASK-PID  %.*s CPU#  ||||   TIMESTAMP  FUNCTION\n", prec, "     TGID   ");
+       seq_printf(m, "#              | |    %.*s   |   ||||      |         |\n", prec, "       |    ");
 }
 
 void
index 0b93354..1b2ef64 100644 (file)
@@ -3865,7 +3865,6 @@ static int parse_var_defs(struct hist_trigger_data *hist_data)
 
                        s = kstrdup(field_str, GFP_KERNEL);
                        if (!s) {
-                               kfree(hist_data->attrs->var_defs.name[n_vars]);
                                ret = -ENOMEM;
                                goto free;
                        }
index 4d18935..000e9dc 100644 (file)
@@ -497,7 +497,7 @@ lat_print_generic(struct trace_seq *s, struct trace_entry *entry, int cpu)
 
        trace_find_cmdline(entry->pid, comm);
 
-       trace_seq_printf(s, "%8.8s-%-5d %3d",
+       trace_seq_printf(s, "%8.8s-%-7d %3d",
                         comm, entry->pid, cpu);
 
        return trace_print_lat_fmt(s, entry);
@@ -588,15 +588,15 @@ int trace_print_context(struct trace_iterator *iter)
 
        trace_find_cmdline(entry->pid, comm);
 
-       trace_seq_printf(s, "%16s-%-5d ", comm, entry->pid);
+       trace_seq_printf(s, "%16s-%-7d ", comm, entry->pid);
 
        if (tr->trace_flags & TRACE_ITER_RECORD_TGID) {
                unsigned int tgid = trace_find_tgid(entry->pid);
 
                if (!tgid)
-                       trace_seq_printf(s, "(-----) ");
+                       trace_seq_printf(s, "(-------) ");
                else
-                       trace_seq_printf(s, "(%5d) ", tgid);
+                       trace_seq_printf(s, "(%7d) ", tgid);
        }
 
        trace_seq_printf(s, "[%03d] ", iter->cpu);
@@ -636,7 +636,7 @@ int trace_print_lat_context(struct trace_iterator *iter)
                trace_find_cmdline(entry->pid, comm);
 
                trace_seq_printf(
-                       s, "%16s %5d %3d %d %08x %08lx ",
+                       s, "%16s %7d %3d %d %08x %08lx ",
                        comm, entry->pid, iter->cpu, entry->flags,
                        entry->preempt_count, iter->idx);
        } else {
@@ -917,7 +917,7 @@ static enum print_line_t trace_ctxwake_print(struct trace_iterator *iter,
        S = task_index_to_char(field->prev_state);
        trace_find_cmdline(field->next_pid, comm);
        trace_seq_printf(&iter->seq,
-                        " %5d:%3d:%c %s [%03d] %5d:%3d:%c %s\n",
+                        " %7d:%3d:%c %s [%03d] %7d:%3d:%c %s\n",
                         field->prev_pid,
                         field->prev_prio,
                         S, delim,
index 2c905a9..649ed44 100644 (file)
@@ -31,6 +31,8 @@ static size_t xbc_data_size __initdata;
 static struct xbc_node *last_parent __initdata;
 static const char *xbc_err_msg __initdata;
 static int xbc_err_pos __initdata;
+static int open_brace[XBC_DEPTH_MAX] __initdata;
+static int brace_index __initdata;
 
 static int __init xbc_parse_error(const char *msg, const char *p)
 {
@@ -431,27 +433,27 @@ static char *skip_spaces_until_newline(char *p)
        return p;
 }
 
-static int __init __xbc_open_brace(void)
+static int __init __xbc_open_brace(char *p)
 {
-       /* Mark the last key as open brace */
-       last_parent->next = XBC_NODE_MAX;
+       /* Push the last key as open brace */
+       open_brace[brace_index++] = xbc_node_index(last_parent);
+       if (brace_index >= XBC_DEPTH_MAX)
+               return xbc_parse_error("Exceed max depth of braces", p);
 
        return 0;
 }
 
 static int __init __xbc_close_brace(char *p)
 {
-       struct xbc_node *node;
-
-       if (!last_parent || last_parent->next != XBC_NODE_MAX)
+       brace_index--;
+       if (!last_parent || brace_index < 0 ||
+           (open_brace[brace_index] != xbc_node_index(last_parent)))
                return xbc_parse_error("Unexpected closing brace", p);
 
-       node = last_parent;
-       node->next = 0;
-       do {
-               node = xbc_node_get_parent(node);
-       } while (node && node->next != XBC_NODE_MAX);
-       last_parent = node;
+       if (brace_index == 0)
+               last_parent = NULL;
+       else
+               last_parent = &xbc_nodes[open_brace[brace_index - 1]];
 
        return 0;
 }
@@ -492,8 +494,8 @@ static int __init __xbc_parse_value(char **__v, char **__n)
                        break;
                }
                if (strchr(",;\n#}", c)) {
-                       v = strim(v);
                        *p++ = '\0';
+                       v = strim(v);
                        break;
                }
        }
@@ -661,7 +663,7 @@ static int __init xbc_open_brace(char **k, char *n)
                return ret;
        *k = n;
 
-       return __xbc_open_brace();
+       return __xbc_open_brace(n - 1);
 }
 
 static int __init xbc_close_brace(char **k, char *n)
@@ -681,6 +683,13 @@ static int __init xbc_verify_tree(void)
        int i, depth, len, wlen;
        struct xbc_node *n, *m;
 
+       /* Brace closing */
+       if (brace_index) {
+               n = &xbc_nodes[open_brace[brace_index]];
+               return xbc_parse_error("Brace is not closed",
+                                       xbc_node_get_data(n));
+       }
+
        /* Empty tree */
        if (xbc_node_num == 0) {
                xbc_parse_error("Empty config", xbc_data);
@@ -745,6 +754,7 @@ void __init xbc_destroy_all(void)
        xbc_node_num = 0;
        memblock_free(__pa(xbc_nodes), sizeof(struct xbc_node) * XBC_NODE_MAX);
        xbc_nodes = NULL;
+       brace_index = 0;
 }
 
 /**
index 77c85b5..be5cfa5 100644 (file)
@@ -2,6 +2,7 @@
 /* identifiers for device / performance-differentiated memory regions */
 #include <linux/idr.h>
 #include <linux/types.h>
+#include <linux/memregion.h>
 
 static DEFINE_IDA(memregion_ids);
 
index 9323453..dfb9981 100644 (file)
@@ -49,7 +49,7 @@ static inline void prandom_state_selftest(void)
 }
 #endif
 
-DEFINE_PER_CPU(struct rnd_state, net_rand_state);
+DEFINE_PER_CPU(struct rnd_state, net_rand_state)  __latent_entropy;
 
 /**
  *     prandom_u32_state - seeded pseudo-random number generator.
index 6012c38..4288e01 100644 (file)
@@ -272,6 +272,30 @@ ssize_t strscpy_pad(char *dest, const char *src, size_t count)
 }
 EXPORT_SYMBOL(strscpy_pad);
 
+/**
+ * stpcpy - copy a string from src to dest returning a pointer to the new end
+ *          of dest, including src's %NUL-terminator. May overrun dest.
+ * @dest: pointer to end of string being copied into. Must be large enough
+ *        to receive copy.
+ * @src: pointer to the beginning of string being copied from. Must not overlap
+ *       dest.
+ *
+ * stpcpy differs from strcpy in a key way: the return value is a pointer
+ * to the new %NUL-terminating character in @dest. (For strcpy, the return
+ * value is a pointer to the start of @dest). This interface is considered
+ * unsafe as it doesn't perform bounds checking of the inputs. As such it's
+ * not recommended for usage. Instead, its definition is provided in case
+ * the compiler lowers other libcalls to stpcpy.
+ */
+char *stpcpy(char *__restrict__ dest, const char *__restrict__ src);
+char *stpcpy(char *__restrict__ dest, const char *__restrict__ src)
+{
+       while ((*dest++ = *src++) != '\0')
+               /* nothing */;
+       return --dest;
+}
+EXPORT_SYMBOL(stpcpy);
+
 #ifndef __HAVE_ARCH_STRCAT
 /**
  * strcat - Append one %NUL-terminated string to another
index c5a6fef..76c607e 100644 (file)
@@ -434,7 +434,7 @@ static int __init test_rhltable(unsigned int entries)
                } else {
                        if (WARN(err != -ENOENT, "removed non-existent element, error %d not %d",
                                 err, -ENOENT))
-                       continue;
+                               continue;
                }
        }
 
index 5202e38..99c49ee 100644 (file)
@@ -2365,7 +2365,11 @@ readpage:
                }
 
                if (!PageUptodate(page)) {
-                       error = lock_page_killable(page);
+                       if (iocb->ki_flags & IOCB_WAITQ)
+                               error = lock_page_async(page, iocb->ki_waitq);
+                       else
+                               error = lock_page_killable(page);
+
                        if (unlikely(error))
                                goto readpage_error;
                        if (!PageUptodate(page)) {
index e5739a1..e869c63 100644 (file)
--- a/mm/gup.c
+++ b/mm/gup.c
@@ -1255,6 +1255,9 @@ static __always_inline long __get_user_pages_locked(struct mm_struct *mm,
                BUG_ON(*locked != 1);
        }
 
+       if (flags & FOLL_PIN)
+               atomic_set(&mm->has_pinned, 1);
+
        /*
         * FOLL_PIN and FOLL_GET are mutually exclusive. Traditional behavior
         * is to set FOLL_GET if the caller wants pages[] filled in (but has
@@ -2485,13 +2488,13 @@ static int gup_huge_pgd(pgd_t orig, pgd_t *pgdp, unsigned long addr,
        return 1;
 }
 
-static int gup_pmd_range(pud_t pud, unsigned long addr, unsigned long end,
+static int gup_pmd_range(pud_t *pudp, pud_t pud, unsigned long addr, unsigned long end,
                unsigned int flags, struct page **pages, int *nr)
 {
        unsigned long next;
        pmd_t *pmdp;
 
-       pmdp = pmd_offset(&pud, addr);
+       pmdp = pmd_offset_lockless(pudp, pud, addr);
        do {
                pmd_t pmd = READ_ONCE(*pmdp);
 
@@ -2528,13 +2531,13 @@ static int gup_pmd_range(pud_t pud, unsigned long addr, unsigned long end,
        return 1;
 }
 
-static int gup_pud_range(p4d_t p4d, unsigned long addr, unsigned long end,
+static int gup_pud_range(p4d_t *p4dp, p4d_t p4d, unsigned long addr, unsigned long end,
                         unsigned int flags, struct page **pages, int *nr)
 {
        unsigned long next;
        pud_t *pudp;
 
-       pudp = pud_offset(&p4d, addr);
+       pudp = pud_offset_lockless(p4dp, p4d, addr);
        do {
                pud_t pud = READ_ONCE(*pudp);
 
@@ -2549,20 +2552,20 @@ static int gup_pud_range(p4d_t p4d, unsigned long addr, unsigned long end,
                        if (!gup_huge_pd(__hugepd(pud_val(pud)), addr,
                                         PUD_SHIFT, next, flags, pages, nr))
                                return 0;
-               } else if (!gup_pmd_range(pud, addr, next, flags, pages, nr))
+               } else if (!gup_pmd_range(pudp, pud, addr, next, flags, pages, nr))
                        return 0;
        } while (pudp++, addr = next, addr != end);
 
        return 1;
 }
 
-static int gup_p4d_range(pgd_t pgd, unsigned long addr, unsigned long end,
+static int gup_p4d_range(pgd_t *pgdp, pgd_t pgd, unsigned long addr, unsigned long end,
                         unsigned int flags, struct page **pages, int *nr)
 {
        unsigned long next;
        p4d_t *p4dp;
 
-       p4dp = p4d_offset(&pgd, addr);
+       p4dp = p4d_offset_lockless(pgdp, pgd, addr);
        do {
                p4d_t p4d = READ_ONCE(*p4dp);
 
@@ -2574,7 +2577,7 @@ static int gup_p4d_range(pgd_t pgd, unsigned long addr, unsigned long end,
                        if (!gup_huge_pd(__hugepd(p4d_val(p4d)), addr,
                                         P4D_SHIFT, next, flags, pages, nr))
                                return 0;
-               } else if (!gup_pud_range(p4d, addr, next, flags, pages, nr))
+               } else if (!gup_pud_range(p4dp, p4d, addr, next, flags, pages, nr))
                        return 0;
        } while (p4dp++, addr = next, addr != end);
 
@@ -2602,7 +2605,7 @@ static void gup_pgd_range(unsigned long addr, unsigned long end,
                        if (!gup_huge_pd(__hugepd(pgd_val(pgd)), addr,
                                         PGDIR_SHIFT, next, flags, pages, nr))
                                return;
-               } else if (!gup_p4d_range(pgd, addr, next, flags, pages, nr))
+               } else if (!gup_p4d_range(pgdp, pgd, addr, next, flags, pages, nr))
                        return;
        } while (pgdp++, addr = next, addr != end);
 }
@@ -2660,6 +2663,9 @@ static int internal_get_user_pages_fast(unsigned long start, int nr_pages,
                                       FOLL_FAST_ONLY)))
                return -EINVAL;
 
+       if (gup_flags & FOLL_PIN)
+               atomic_set(&current->mm->has_pinned, 1);
+
        if (!(gup_flags & FOLL_FAST_ONLY))
                might_lock_read(&current->mm->mmap_lock);
 
index faadc44..da39777 100644 (file)
@@ -1074,6 +1074,24 @@ int copy_huge_pmd(struct mm_struct *dst_mm, struct mm_struct *src_mm,
 
        src_page = pmd_page(pmd);
        VM_BUG_ON_PAGE(!PageHead(src_page), src_page);
+
+       /*
+        * If this page is a potentially pinned page, split and retry the fault
+        * with smaller page size.  Normally this should not happen because the
+        * userspace should use MADV_DONTFORK upon pinned regions.  This is a
+        * best effort that the pinned pages won't be replaced by another
+        * random page during the coming copy-on-write.
+        */
+       if (unlikely(is_cow_mapping(vma->vm_flags) &&
+                    atomic_read(&src_mm->has_pinned) &&
+                    page_maybe_dma_pinned(src_page))) {
+               pte_free(dst_mm, pgtable);
+               spin_unlock(src_ptl);
+               spin_unlock(dst_ptl);
+               __split_huge_pmd(vma, src_pmd, addr, false, NULL);
+               return -EAGAIN;
+       }
+
        get_page(src_page);
        page_dup_rmap(src_page, true);
        add_mm_counter(dst_mm, MM_ANONPAGES, HPAGE_PMD_NR);
@@ -1177,6 +1195,16 @@ int copy_huge_pud(struct mm_struct *dst_mm, struct mm_struct *src_mm,
                /* No huge zero pud yet */
        }
 
+       /* Please refer to comments in copy_huge_pmd() */
+       if (unlikely(is_cow_mapping(vma->vm_flags) &&
+                    atomic_read(&src_mm->has_pinned) &&
+                    page_maybe_dma_pinned(pud_page(pud)))) {
+               spin_unlock(src_ptl);
+               spin_unlock(dst_ptl);
+               __split_huge_pud(vma, src_pud, addr);
+               return -EAGAIN;
+       }
+
        pudp_set_wrprotect(src_mm, addr, src_pud);
        pud = pud_mkold(pud_wrprotect(pud));
        set_pud_at(dst_mm, addr, dst_pud, pud);
index d4aa5f7..0e0d610 100644 (file)
@@ -381,9 +381,9 @@ huge_unlock:
                return 0;
        }
 
+regular_page:
        if (pmd_trans_unstable(pmd))
                return 0;
-regular_page:
 #endif
        tlb_change_page_size(tlb, PAGE_SIZE);
        orig_pte = pte = pte_offset_map_lock(vma->vm_mm, pmd, addr, &ptl);
index cfa6cba..6877c76 100644 (file)
@@ -1538,9 +1538,9 @@ static char *memory_stat_format(struct mem_cgroup *memcg)
                       memcg_page_state(memcg, WORKINGSET_ACTIVATE_ANON));
        seq_buf_printf(&s, "workingset_activate_file %lu\n",
                       memcg_page_state(memcg, WORKINGSET_ACTIVATE_FILE));
-       seq_buf_printf(&s, "workingset_restore %lu\n",
+       seq_buf_printf(&s, "workingset_restore_anon %lu\n",
                       memcg_page_state(memcg, WORKINGSET_RESTORE_ANON));
-       seq_buf_printf(&s, "workingset_restore %lu\n",
+       seq_buf_printf(&s, "workingset_restore_file %lu\n",
                       memcg_page_state(memcg, WORKINGSET_RESTORE_FILE));
        seq_buf_printf(&s, "workingset_nodereclaim %lu\n",
                       memcg_page_state(memcg, WORKINGSET_NODERECLAIM));
index 469af37..fcfc4ca 100644 (file)
@@ -695,84 +695,218 @@ out:
  * covered by this vma.
  */
 
-static inline unsigned long
-copy_one_pte(struct mm_struct *dst_mm, struct mm_struct *src_mm,
+static unsigned long
+copy_nonpresent_pte(struct mm_struct *dst_mm, struct mm_struct *src_mm,
                pte_t *dst_pte, pte_t *src_pte, struct vm_area_struct *vma,
                unsigned long addr, int *rss)
 {
        unsigned long vm_flags = vma->vm_flags;
        pte_t pte = *src_pte;
        struct page *page;
+       swp_entry_t entry = pte_to_swp_entry(pte);
+
+       if (likely(!non_swap_entry(entry))) {
+               if (swap_duplicate(entry) < 0)
+                       return entry.val;
+
+               /* make sure dst_mm is on swapoff's mmlist. */
+               if (unlikely(list_empty(&dst_mm->mmlist))) {
+                       spin_lock(&mmlist_lock);
+                       if (list_empty(&dst_mm->mmlist))
+                               list_add(&dst_mm->mmlist,
+                                               &src_mm->mmlist);
+                       spin_unlock(&mmlist_lock);
+               }
+               rss[MM_SWAPENTS]++;
+       } else if (is_migration_entry(entry)) {
+               page = migration_entry_to_page(entry);
 
-       /* pte contains position in swap or file, so copy. */
-       if (unlikely(!pte_present(pte))) {
-               swp_entry_t entry = pte_to_swp_entry(pte);
-
-               if (likely(!non_swap_entry(entry))) {
-                       if (swap_duplicate(entry) < 0)
-                               return entry.val;
-
-                       /* make sure dst_mm is on swapoff's mmlist. */
-                       if (unlikely(list_empty(&dst_mm->mmlist))) {
-                               spin_lock(&mmlist_lock);
-                               if (list_empty(&dst_mm->mmlist))
-                                       list_add(&dst_mm->mmlist,
-                                                       &src_mm->mmlist);
-                               spin_unlock(&mmlist_lock);
-                       }
-                       rss[MM_SWAPENTS]++;
-               } else if (is_migration_entry(entry)) {
-                       page = migration_entry_to_page(entry);
-
-                       rss[mm_counter(page)]++;
-
-                       if (is_write_migration_entry(entry) &&
-                                       is_cow_mapping(vm_flags)) {
-                               /*
-                                * COW mappings require pages in both
-                                * parent and child to be set to read.
-                                */
-                               make_migration_entry_read(&entry);
-                               pte = swp_entry_to_pte(entry);
-                               if (pte_swp_soft_dirty(*src_pte))
-                                       pte = pte_swp_mksoft_dirty(pte);
-                               if (pte_swp_uffd_wp(*src_pte))
-                                       pte = pte_swp_mkuffd_wp(pte);
-                               set_pte_at(src_mm, addr, src_pte, pte);
-                       }
-               } else if (is_device_private_entry(entry)) {
-                       page = device_private_entry_to_page(entry);
+               rss[mm_counter(page)]++;
 
+               if (is_write_migration_entry(entry) &&
+                               is_cow_mapping(vm_flags)) {
                        /*
-                        * Update rss count even for unaddressable pages, as
-                        * they should treated just like normal pages in this
-                        * respect.
-                        *
-                        * We will likely want to have some new rss counters
-                        * for unaddressable pages, at some point. But for now
-                        * keep things as they are.
+                        * COW mappings require pages in both
+                        * parent and child to be set to read.
                         */
-                       get_page(page);
-                       rss[mm_counter(page)]++;
-                       page_dup_rmap(page, false);
+                       make_migration_entry_read(&entry);
+                       pte = swp_entry_to_pte(entry);
+                       if (pte_swp_soft_dirty(*src_pte))
+                               pte = pte_swp_mksoft_dirty(pte);
+                       if (pte_swp_uffd_wp(*src_pte))
+                               pte = pte_swp_mkuffd_wp(pte);
+                       set_pte_at(src_mm, addr, src_pte, pte);
+               }
+       } else if (is_device_private_entry(entry)) {
+               page = device_private_entry_to_page(entry);
 
-                       /*
-                        * We do not preserve soft-dirty information, because so
-                        * far, checkpoint/restore is the only feature that
-                        * requires that. And checkpoint/restore does not work
-                        * when a device driver is involved (you cannot easily
-                        * save and restore device driver state).
-                        */
-                       if (is_write_device_private_entry(entry) &&
-                           is_cow_mapping(vm_flags)) {
-                               make_device_private_entry_read(&entry);
-                               pte = swp_entry_to_pte(entry);
-                               if (pte_swp_uffd_wp(*src_pte))
-                                       pte = pte_swp_mkuffd_wp(pte);
-                               set_pte_at(src_mm, addr, src_pte, pte);
-                       }
+               /*
+                * Update rss count even for unaddressable pages, as
+                * they should treated just like normal pages in this
+                * respect.
+                *
+                * We will likely want to have some new rss counters
+                * for unaddressable pages, at some point. But for now
+                * keep things as they are.
+                */
+               get_page(page);
+               rss[mm_counter(page)]++;
+               page_dup_rmap(page, false);
+
+               /*
+                * We do not preserve soft-dirty information, because so
+                * far, checkpoint/restore is the only feature that
+                * requires that. And checkpoint/restore does not work
+                * when a device driver is involved (you cannot easily
+                * save and restore device driver state).
+                */
+               if (is_write_device_private_entry(entry) &&
+                   is_cow_mapping(vm_flags)) {
+                       make_device_private_entry_read(&entry);
+                       pte = swp_entry_to_pte(entry);
+                       if (pte_swp_uffd_wp(*src_pte))
+                               pte = pte_swp_mkuffd_wp(pte);
+                       set_pte_at(src_mm, addr, src_pte, pte);
                }
-               goto out_set_pte;
+       }
+       set_pte_at(dst_mm, addr, dst_pte, pte);
+       return 0;
+}
+
+/*
+ * Copy a present and normal page if necessary.
+ *
+ * NOTE! The usual case is that this doesn't need to do
+ * anything, and can just return a positive value. That
+ * will let the caller know that it can just increase
+ * the page refcount and re-use the pte the traditional
+ * way.
+ *
+ * But _if_ we need to copy it because it needs to be
+ * pinned in the parent (and the child should get its own
+ * copy rather than just a reference to the same page),
+ * we'll do that here and return zero to let the caller
+ * know we're done.
+ *
+ * And if we need a pre-allocated page but don't yet have
+ * one, return a negative error to let the preallocation
+ * code know so that it can do so outside the page table
+ * lock.
+ */
+static inline int
+copy_present_page(struct mm_struct *dst_mm, struct mm_struct *src_mm,
+               pte_t *dst_pte, pte_t *src_pte,
+               struct vm_area_struct *vma, struct vm_area_struct *new,
+               unsigned long addr, int *rss, struct page **prealloc,
+               pte_t pte, struct page *page)
+{
+       struct page *new_page;
+
+       if (!is_cow_mapping(vma->vm_flags))
+               return 1;
+
+       /*
+        * The trick starts.
+        *
+        * What we want to do is to check whether this page may
+        * have been pinned by the parent process.  If so,
+        * instead of wrprotect the pte on both sides, we copy
+        * the page immediately so that we'll always guarantee
+        * the pinned page won't be randomly replaced in the
+        * future.
+        *
+        * To achieve this, we do the following:
+        *
+        * 1. Write-protect the pte if it's writable.  This is
+        *    to protect concurrent write fast-gup with
+        *    FOLL_PIN, so that we'll fail the fast-gup with
+        *    the write bit removed.
+        *
+        * 2. Check page_maybe_dma_pinned() to see whether this
+        *    page may have been pinned.
+        *
+        * The order of these steps is important to serialize
+        * against the fast-gup code (gup_pte_range()) on the
+        * pte check and try_grab_compound_head(), so that
+        * we'll make sure either we'll capture that fast-gup
+        * so we'll copy the pinned page here, or we'll fail
+        * that fast-gup.
+        *
+        * NOTE! Even if we don't end up copying the page,
+        * we won't undo this wrprotect(), because the normal
+        * reference copy will need it anyway.
+        */
+       if (pte_write(pte))
+               ptep_set_wrprotect(src_mm, addr, src_pte);
+
+       /*
+        * These are the "normally we can just copy by reference"
+        * checks.
+        */
+       if (likely(!atomic_read(&src_mm->has_pinned)))
+               return 1;
+       if (likely(!page_maybe_dma_pinned(page)))
+               return 1;
+
+       /*
+        * Uhhuh. It looks like the page might be a pinned page,
+        * and we actually need to copy it. Now we can set the
+        * source pte back to being writable.
+        */
+       if (pte_write(pte))
+               set_pte_at(src_mm, addr, src_pte, pte);
+
+       new_page = *prealloc;
+       if (!new_page)
+               return -EAGAIN;
+
+       /*
+        * We have a prealloc page, all good!  Take it
+        * over and copy the page & arm it.
+        */
+       *prealloc = NULL;
+       copy_user_highpage(new_page, page, addr, vma);
+       __SetPageUptodate(new_page);
+       page_add_new_anon_rmap(new_page, new, addr, false);
+       lru_cache_add_inactive_or_unevictable(new_page, new);
+       rss[mm_counter(new_page)]++;
+
+       /* All done, just insert the new page copy in the child */
+       pte = mk_pte(new_page, new->vm_page_prot);
+       pte = maybe_mkwrite(pte_mkdirty(pte), new);
+       set_pte_at(dst_mm, addr, dst_pte, pte);
+       return 0;
+}
+
+/*
+ * Copy one pte.  Returns 0 if succeeded, or -EAGAIN if one preallocated page
+ * is required to copy this pte.
+ */
+static inline int
+copy_present_pte(struct mm_struct *dst_mm, struct mm_struct *src_mm,
+               pte_t *dst_pte, pte_t *src_pte, struct vm_area_struct *vma,
+               struct vm_area_struct *new,
+               unsigned long addr, int *rss, struct page **prealloc)
+{
+       unsigned long vm_flags = vma->vm_flags;
+       pte_t pte = *src_pte;
+       struct page *page;
+
+       page = vm_normal_page(vma, addr, pte);
+       if (page) {
+               int retval;
+
+               retval = copy_present_page(dst_mm, src_mm,
+                       dst_pte, src_pte,
+                       vma, new,
+                       addr, rss, prealloc,
+                       pte, page);
+               if (retval <= 0)
+                       return retval;
+
+               get_page(page);
+               page_dup_rmap(page, false);
+               rss[mm_counter(page)]++;
        }
 
        /*
@@ -800,35 +934,51 @@ copy_one_pte(struct mm_struct *dst_mm, struct mm_struct *src_mm,
        if (!(vm_flags & VM_UFFD_WP))
                pte = pte_clear_uffd_wp(pte);
 
-       page = vm_normal_page(vma, addr, pte);
-       if (page) {
-               get_page(page);
-               page_dup_rmap(page, false);
-               rss[mm_counter(page)]++;
-       }
-
-out_set_pte:
        set_pte_at(dst_mm, addr, dst_pte, pte);
        return 0;
 }
 
+static inline struct page *
+page_copy_prealloc(struct mm_struct *src_mm, struct vm_area_struct *vma,
+                  unsigned long addr)
+{
+       struct page *new_page;
+
+       new_page = alloc_page_vma(GFP_HIGHUSER_MOVABLE, vma, addr);
+       if (!new_page)
+               return NULL;
+
+       if (mem_cgroup_charge(new_page, src_mm, GFP_KERNEL)) {
+               put_page(new_page);
+               return NULL;
+       }
+       cgroup_throttle_swaprate(new_page, GFP_KERNEL);
+
+       return new_page;
+}
+
 static int copy_pte_range(struct mm_struct *dst_mm, struct mm_struct *src_mm,
                   pmd_t *dst_pmd, pmd_t *src_pmd, struct vm_area_struct *vma,
+                  struct vm_area_struct *new,
                   unsigned long addr, unsigned long end)
 {
        pte_t *orig_src_pte, *orig_dst_pte;
        pte_t *src_pte, *dst_pte;
        spinlock_t *src_ptl, *dst_ptl;
-       int progress = 0;
+       int progress, ret = 0;
        int rss[NR_MM_COUNTERS];
        swp_entry_t entry = (swp_entry_t){0};
+       struct page *prealloc = NULL;
 
 again:
+       progress = 0;
        init_rss_vec(rss);
 
        dst_pte = pte_alloc_map_lock(dst_mm, dst_pmd, addr, &dst_ptl);
-       if (!dst_pte)
-               return -ENOMEM;
+       if (!dst_pte) {
+               ret = -ENOMEM;
+               goto out;
+       }
        src_pte = pte_offset_map(src_pmd, addr);
        src_ptl = pte_lockptr(src_mm, src_pmd);
        spin_lock_nested(src_ptl, SINGLE_DEPTH_NESTING);
@@ -851,10 +1001,34 @@ again:
                        progress++;
                        continue;
                }
-               entry.val = copy_one_pte(dst_mm, src_mm, dst_pte, src_pte,
+               if (unlikely(!pte_present(*src_pte))) {
+                       entry.val = copy_nonpresent_pte(dst_mm, src_mm,
+                                                       dst_pte, src_pte,
                                                        vma, addr, rss);
-               if (entry.val)
+                       if (entry.val)
+                               break;
+                       progress += 8;
+                       continue;
+               }
+               /* copy_present_pte() will clear `*prealloc' if consumed */
+               ret = copy_present_pte(dst_mm, src_mm, dst_pte, src_pte,
+                                      vma, new, addr, rss, &prealloc);
+               /*
+                * If we need a pre-allocated page for this pte, drop the
+                * locks, allocate, and try again.
+                */
+               if (unlikely(ret == -EAGAIN))
                        break;
+               if (unlikely(prealloc)) {
+                       /*
+                        * pre-alloc page cannot be reused by next time so as
+                        * to strictly follow mempolicy (e.g., alloc_page_vma()
+                        * will allocate page according to address).  This
+                        * could only happen if one pinned pte changed.
+                        */
+                       put_page(prealloc);
+                       prealloc = NULL;
+               }
                progress += 8;
        } while (dst_pte++, src_pte++, addr += PAGE_SIZE, addr != end);
 
@@ -866,17 +1040,30 @@ again:
        cond_resched();
 
        if (entry.val) {
-               if (add_swap_count_continuation(entry, GFP_KERNEL) < 0)
+               if (add_swap_count_continuation(entry, GFP_KERNEL) < 0) {
+                       ret = -ENOMEM;
+                       goto out;
+               }
+               entry.val = 0;
+       } else if (ret) {
+               WARN_ON_ONCE(ret != -EAGAIN);
+               prealloc = page_copy_prealloc(src_mm, vma, addr);
+               if (!prealloc)
                        return -ENOMEM;
-               progress = 0;
+               /* We've captured and resolved the error. Reset, try again. */
+               ret = 0;
        }
        if (addr != end)
                goto again;
-       return 0;
+out:
+       if (unlikely(prealloc))
+               put_page(prealloc);
+       return ret;
 }
 
 static inline int copy_pmd_range(struct mm_struct *dst_mm, struct mm_struct *src_mm,
                pud_t *dst_pud, pud_t *src_pud, struct vm_area_struct *vma,
+               struct vm_area_struct *new,
                unsigned long addr, unsigned long end)
 {
        pmd_t *src_pmd, *dst_pmd;
@@ -903,7 +1090,7 @@ static inline int copy_pmd_range(struct mm_struct *dst_mm, struct mm_struct *src
                if (pmd_none_or_clear_bad(src_pmd))
                        continue;
                if (copy_pte_range(dst_mm, src_mm, dst_pmd, src_pmd,
-                                               vma, addr, next))
+                                  vma, new, addr, next))
                        return -ENOMEM;
        } while (dst_pmd++, src_pmd++, addr = next, addr != end);
        return 0;
@@ -911,6 +1098,7 @@ static inline int copy_pmd_range(struct mm_struct *dst_mm, struct mm_struct *src
 
 static inline int copy_pud_range(struct mm_struct *dst_mm, struct mm_struct *src_mm,
                p4d_t *dst_p4d, p4d_t *src_p4d, struct vm_area_struct *vma,
+               struct vm_area_struct *new,
                unsigned long addr, unsigned long end)
 {
        pud_t *src_pud, *dst_pud;
@@ -937,7 +1125,7 @@ static inline int copy_pud_range(struct mm_struct *dst_mm, struct mm_struct *src
                if (pud_none_or_clear_bad(src_pud))
                        continue;
                if (copy_pmd_range(dst_mm, src_mm, dst_pud, src_pud,
-                                               vma, addr, next))
+                                  vma, new, addr, next))
                        return -ENOMEM;
        } while (dst_pud++, src_pud++, addr = next, addr != end);
        return 0;
@@ -945,6 +1133,7 @@ static inline int copy_pud_range(struct mm_struct *dst_mm, struct mm_struct *src
 
 static inline int copy_p4d_range(struct mm_struct *dst_mm, struct mm_struct *src_mm,
                pgd_t *dst_pgd, pgd_t *src_pgd, struct vm_area_struct *vma,
+               struct vm_area_struct *new,
                unsigned long addr, unsigned long end)
 {
        p4d_t *src_p4d, *dst_p4d;
@@ -959,14 +1148,14 @@ static inline int copy_p4d_range(struct mm_struct *dst_mm, struct mm_struct *src
                if (p4d_none_or_clear_bad(src_p4d))
                        continue;
                if (copy_pud_range(dst_mm, src_mm, dst_p4d, src_p4d,
-                                               vma, addr, next))
+                                  vma, new, addr, next))
                        return -ENOMEM;
        } while (dst_p4d++, src_p4d++, addr = next, addr != end);
        return 0;
 }
 
 int copy_page_range(struct mm_struct *dst_mm, struct mm_struct *src_mm,
-               struct vm_area_struct *vma)
+                   struct vm_area_struct *vma, struct vm_area_struct *new)
 {
        pgd_t *src_pgd, *dst_pgd;
        unsigned long next;
@@ -1021,7 +1210,7 @@ int copy_page_range(struct mm_struct *dst_mm, struct mm_struct *src_mm,
                if (pgd_none_or_clear_bad(src_pgd))
                        continue;
                if (unlikely(copy_p4d_range(dst_mm, src_mm, dst_pgd, src_pgd,
-                                           vma, addr, next))) {
+                                           vma, new, addr, next))) {
                        ret = -ENOMEM;
                        break;
                }
@@ -2955,8 +3144,8 @@ static vm_fault_t do_wp_page(struct vm_fault *vmf)
                 * page count reference, and the page is locked,
                 * it's dark out, and we're wearing sunglasses. Hit it.
                 */
-               wp_page_reuse(vmf);
                unlock_page(page);
+               wp_page_reuse(vmf);
                return VM_FAULT_WRITE;
        } else if (unlikely((vma->vm_flags & (VM_WRITE|VM_SHARED)) ==
                                        (VM_WRITE|VM_SHARED))) {
index b11a269..ce3e73e 100644 (file)
@@ -729,7 +729,7 @@ void __ref move_pfn_range_to_zone(struct zone *zone, unsigned long start_pfn,
         * are reserved so nobody should be touching them so we should be safe
         */
        memmap_init_zone(nr_pages, nid, zone_idx(zone), start_pfn,
-                       MEMMAP_HOTPLUG, altmap);
+                        MEMINIT_HOTPLUG, altmap);
 
        set_zone_contiguous(zone);
 }
@@ -1080,7 +1080,8 @@ int __ref add_memory_resource(int nid, struct resource *res)
        }
 
        /* link memory sections under this node.*/
-       ret = link_mem_sections(nid, PFN_DOWN(start), PFN_UP(start + size - 1));
+       ret = link_mem_sections(nid, PFN_DOWN(start), PFN_UP(start + size - 1),
+                               MEMINIT_HOTPLUG);
        BUG_ON(ret);
 
        /* create new memmap entry */
index aecb143..04a98bb 100644 (file)
@@ -1446,7 +1446,7 @@ retry:
                         * Capture required information that might get lost
                         * during migration.
                         */
-                       is_thp = PageTransHuge(page);
+                       is_thp = PageTransHuge(page) && !PageHuge(page);
                        nr_subpages = thp_nr_pages(page);
                        cond_resched();
 
@@ -1472,7 +1472,7 @@ retry:
                                 * we encounter them after the rest of the list
                                 * is processed.
                                 */
-                               if (PageTransHuge(page) && !PageHuge(page)) {
+                               if (is_thp) {
                                        lock_page(page);
                                        rc = split_huge_page_to_list(page, from);
                                        unlock_page(page);
@@ -1481,8 +1481,7 @@ retry:
                                                nr_thp_split++;
                                                goto retry;
                                        }
-                               }
-                               if (is_thp) {
+
                                        nr_thp_failed++;
                                        nr_failed += nr_subpages;
                                        goto out;
index fab5e97..6866533 100644 (file)
@@ -3367,9 +3367,16 @@ struct page *rmqueue(struct zone *preferred_zone,
        struct page *page;
 
        if (likely(order == 0)) {
-               page = rmqueue_pcplist(preferred_zone, zone, gfp_flags,
+               /*
+                * MIGRATE_MOVABLE pcplist could have the pages on CMA area and
+                * we need to skip it when CMA area isn't allowed.
+                */
+               if (!IS_ENABLED(CONFIG_CMA) || alloc_flags & ALLOC_CMA ||
+                               migratetype != MIGRATE_MOVABLE) {
+                       page = rmqueue_pcplist(preferred_zone, zone, gfp_flags,
                                        migratetype, alloc_flags);
-               goto out;
+                       goto out;
+               }
        }
 
        /*
@@ -3381,7 +3388,13 @@ struct page *rmqueue(struct zone *preferred_zone,
 
        do {
                page = NULL;
-               if (alloc_flags & ALLOC_HARDER) {
+               /*
+                * order-0 request can reach here when the pcplist is skipped
+                * due to non-CMA allocation context. HIGHATOMIC area is
+                * reserved for high-order atomic allocation, so order-0
+                * request should skip it.
+                */
+               if (order > 0 && alloc_flags & ALLOC_HARDER) {
                        page = __rmqueue_smallest(zone, order, MIGRATE_HIGHATOMIC);
                        if (page)
                                trace_mm_page_alloc_zone_locked(page, order, migratetype);
@@ -5975,7 +5988,7 @@ overlap_memmap_init(unsigned long zone, unsigned long *pfn)
  * done. Non-atomic initialization, single-pass.
  */
 void __meminit memmap_init_zone(unsigned long size, int nid, unsigned long zone,
-               unsigned long start_pfn, enum memmap_context context,
+               unsigned long start_pfn, enum meminit_context context,
                struct vmem_altmap *altmap)
 {
        unsigned long pfn, end_pfn = start_pfn + size;
@@ -6007,7 +6020,7 @@ void __meminit memmap_init_zone(unsigned long size, int nid, unsigned long zone,
                 * There can be holes in boot-time mem_map[]s handed to this
                 * function.  They do not exist on hotplugged memory.
                 */
-               if (context == MEMMAP_EARLY) {
+               if (context == MEMINIT_EARLY) {
                        if (overlap_memmap_init(zone, &pfn))
                                continue;
                        if (defer_init(nid, pfn, end_pfn))
@@ -6016,7 +6029,7 @@ void __meminit memmap_init_zone(unsigned long size, int nid, unsigned long zone,
 
                page = pfn_to_page(pfn);
                __init_single_page(page, pfn, zone, nid);
-               if (context == MEMMAP_HOTPLUG)
+               if (context == MEMINIT_HOTPLUG)
                        __SetPageReserved(page);
 
                /*
@@ -6099,7 +6112,7 @@ void __ref memmap_init_zone_device(struct zone *zone,
                 * check here not to call set_pageblock_migratetype() against
                 * pfn out of zone.
                 *
-                * Please note that MEMMAP_HOTPLUG path doesn't clear memmap
+                * Please note that MEMINIT_HOTPLUG path doesn't clear memmap
                 * because this is done early in section_activate()
                 */
                if (!(pfn & (pageblock_nr_pages - 1))) {
@@ -6137,7 +6150,7 @@ void __meminit __weak memmap_init(unsigned long size, int nid,
                if (end_pfn > start_pfn) {
                        size = end_pfn - start_pfn;
                        memmap_init_zone(size, nid, zone, start_pfn,
-                                        MEMMAP_EARLY, NULL);
+                                        MEMINIT_EARLY, NULL);
                }
        }
 }
index 3160dff..f658e86 100644 (file)
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -1632,6 +1632,10 @@ static void slab_destroy(struct kmem_cache *cachep, struct page *page)
                kmem_cache_free(cachep->freelist_cache, freelist);
 }
 
+/*
+ * Update the size of the caches before calling slabs_destroy as it may
+ * recursively call kfree.
+ */
 static void slabs_destroy(struct kmem_cache *cachep, struct list_head *list)
 {
        struct page *page, *n;
@@ -2153,8 +2157,8 @@ static void do_drain(void *arg)
        spin_lock(&n->list_lock);
        free_block(cachep, ac->entry, ac->avail, node, &list);
        spin_unlock(&n->list_lock);
-       slabs_destroy(cachep, &list);
        ac->avail = 0;
+       slabs_destroy(cachep, &list);
 }
 
 static void drain_cpu_caches(struct kmem_cache *cachep)
@@ -3402,9 +3406,9 @@ free_done:
        }
 #endif
        spin_unlock(&n->list_lock);
-       slabs_destroy(cachep, &list);
        ac->avail -= batchcount;
        memmove(ac->entry, &(ac->entry[batchcount]), sizeof(void *)*ac->avail);
+       slabs_destroy(cachep, &list);
 }
 
 /*
index d4177ae..6d35740 100644 (file)
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -1413,10 +1413,6 @@ slab_flags_t kmem_cache_flags(unsigned int object_size,
        char *next_block;
        slab_flags_t block_flags;
 
-       /* If slub_debug = 0, it folds into the if conditional. */
-       if (!slub_debug_string)
-               return flags | slub_debug;
-
        len = strlen(name);
        next_block = slub_debug_string;
        /* Go through all blocks of debug options, see if any matches our slab's name */
@@ -1450,7 +1446,7 @@ slab_flags_t kmem_cache_flags(unsigned int object_size,
                }
        }
 
-       return slub_debug;
+       return flags | slub_debug;
 }
 #else /* !CONFIG_SLUB_DEBUG */
 static inline void setup_object_debug(struct kmem_cache *s,
index 12f59e6..debc941 100644 (file)
@@ -1078,7 +1078,7 @@ start_over:
                        goto nextsi;
                }
                if (size == SWAPFILE_CLUSTER) {
-                       if (!(si->flags & SWP_FS))
+                       if (si->flags & SWP_BLKDEV)
                                n_ret = swap_alloc_cluster(si, swp_entries);
                } else
                        n_ret = scan_swap_map_slots(si, SWAP_HAS_CACHE,
index 8500f56..c350ab6 100644 (file)
@@ -25,6 +25,7 @@
 #include <linux/lockdep.h>
 #include <linux/netdevice.h>
 #include <linux/netlink.h>
+#include <linux/preempt.h>
 #include <linux/rculist.h>
 #include <linux/rcupdate.h>
 #include <linux/seq_file.h>
@@ -83,11 +84,12 @@ static inline u32 batadv_choose_claim(const void *data, u32 size)
  */
 static inline u32 batadv_choose_backbone_gw(const void *data, u32 size)
 {
-       const struct batadv_bla_claim *claim = (struct batadv_bla_claim *)data;
+       const struct batadv_bla_backbone_gw *gw;
        u32 hash = 0;
 
-       hash = jhash(&claim->addr, sizeof(claim->addr), hash);
-       hash = jhash(&claim->vid, sizeof(claim->vid), hash);
+       gw = (struct batadv_bla_backbone_gw *)data;
+       hash = jhash(&gw->orig, sizeof(gw->orig), hash);
+       hash = jhash(&gw->vid, sizeof(gw->vid), hash);
 
        return hash % size;
 }
@@ -1579,13 +1581,16 @@ int batadv_bla_init(struct batadv_priv *bat_priv)
 }
 
 /**
- * batadv_bla_check_bcast_duplist() - Check if a frame is in the broadcast dup.
+ * batadv_bla_check_duplist() - Check if a frame is in the broadcast dup.
  * @bat_priv: the bat priv with all the soft interface information
- * @skb: contains the bcast_packet to be checked
+ * @skb: contains the multicast packet to be checked
+ * @payload_ptr: pointer to position inside the head buffer of the skb
+ *  marking the start of the data to be CRC'ed
+ * @orig: originator mac address, NULL if unknown
  *
- * check if it is on our broadcast list. Another gateway might
- * have sent the same packet because it is connected to the same backbone,
- * so we have to remove this duplicate.
+ * Check if it is on our broadcast list. Another gateway might have sent the
+ * same packet because it is connected to the same backbone, so we have to
+ * remove this duplicate.
  *
  * This is performed by checking the CRC, which will tell us
  * with a good chance that it is the same packet. If it is furthermore
@@ -1594,19 +1599,17 @@ int batadv_bla_init(struct batadv_priv *bat_priv)
  *
  * Return: true if a packet is in the duplicate list, false otherwise.
  */
-bool batadv_bla_check_bcast_duplist(struct batadv_priv *bat_priv,
-                                   struct sk_buff *skb)
+static bool batadv_bla_check_duplist(struct batadv_priv *bat_priv,
+                                    struct sk_buff *skb, u8 *payload_ptr,
+                                    const u8 *orig)
 {
-       int i, curr;
-       __be32 crc;
-       struct batadv_bcast_packet *bcast_packet;
        struct batadv_bcast_duplist_entry *entry;
        bool ret = false;
-
-       bcast_packet = (struct batadv_bcast_packet *)skb->data;
+       int i, curr;
+       __be32 crc;
 
        /* calculate the crc ... */
-       crc = batadv_skb_crc32(skb, (u8 *)(bcast_packet + 1));
+       crc = batadv_skb_crc32(skb, payload_ptr);
 
        spin_lock_bh(&bat_priv->bla.bcast_duplist_lock);
 
@@ -1625,8 +1628,21 @@ bool batadv_bla_check_bcast_duplist(struct batadv_priv *bat_priv,
                if (entry->crc != crc)
                        continue;
 
-               if (batadv_compare_eth(entry->orig, bcast_packet->orig))
-                       continue;
+               /* are the originators both known and not anonymous? */
+               if (orig && !is_zero_ether_addr(orig) &&
+                   !is_zero_ether_addr(entry->orig)) {
+                       /* If known, check if the new frame came from
+                        * the same originator:
+                        * We are safe to take identical frames from the
+                        * same orig, if known, as multiplications in
+                        * the mesh are detected via the (orig, seqno) pair.
+                        * So we can be a bit more liberal here and allow
+                        * identical frames from the same orig which the source
+                        * host might have sent multiple times on purpose.
+                        */
+                       if (batadv_compare_eth(entry->orig, orig))
+                               continue;
+               }
 
                /* this entry seems to match: same crc, not too old,
                 * and from another gw. therefore return true to forbid it.
@@ -1642,7 +1658,14 @@ bool batadv_bla_check_bcast_duplist(struct batadv_priv *bat_priv,
        entry = &bat_priv->bla.bcast_duplist[curr];
        entry->crc = crc;
        entry->entrytime = jiffies;
-       ether_addr_copy(entry->orig, bcast_packet->orig);
+
+       /* known originator */
+       if (orig)
+               ether_addr_copy(entry->orig, orig);
+       /* anonymous originator */
+       else
+               eth_zero_addr(entry->orig);
+
        bat_priv->bla.bcast_duplist_curr = curr;
 
 out:
@@ -1651,6 +1674,48 @@ out:
        return ret;
 }
 
+/**
+ * batadv_bla_check_ucast_duplist() - Check if a frame is in the broadcast dup.
+ * @bat_priv: the bat priv with all the soft interface information
+ * @skb: contains the multicast packet to be checked, decapsulated from a
+ *  unicast_packet
+ *
+ * Check if it is on our broadcast list. Another gateway might have sent the
+ * same packet because it is connected to the same backbone, so we have to
+ * remove this duplicate.
+ *
+ * Return: true if a packet is in the duplicate list, false otherwise.
+ */
+static bool batadv_bla_check_ucast_duplist(struct batadv_priv *bat_priv,
+                                          struct sk_buff *skb)
+{
+       return batadv_bla_check_duplist(bat_priv, skb, (u8 *)skb->data, NULL);
+}
+
+/**
+ * batadv_bla_check_bcast_duplist() - Check if a frame is in the broadcast dup.
+ * @bat_priv: the bat priv with all the soft interface information
+ * @skb: contains the bcast_packet to be checked
+ *
+ * Check if it is on our broadcast list. Another gateway might have sent the
+ * same packet because it is connected to the same backbone, so we have to
+ * remove this duplicate.
+ *
+ * Return: true if a packet is in the duplicate list, false otherwise.
+ */
+bool batadv_bla_check_bcast_duplist(struct batadv_priv *bat_priv,
+                                   struct sk_buff *skb)
+{
+       struct batadv_bcast_packet *bcast_packet;
+       u8 *payload_ptr;
+
+       bcast_packet = (struct batadv_bcast_packet *)skb->data;
+       payload_ptr = (u8 *)(bcast_packet + 1);
+
+       return batadv_bla_check_duplist(bat_priv, skb, payload_ptr,
+                                       bcast_packet->orig);
+}
+
 /**
  * batadv_bla_is_backbone_gw_orig() - Check if the originator is a gateway for
  *  the VLAN identified by vid.
@@ -1812,7 +1877,7 @@ batadv_bla_loopdetect_check(struct batadv_priv *bat_priv, struct sk_buff *skb,
  * @bat_priv: the bat priv with all the soft interface information
  * @skb: the frame to be checked
  * @vid: the VLAN ID of the frame
- * @is_bcast: the packet came in a broadcast packet type.
+ * @packet_type: the batman packet type this frame came in
  *
  * batadv_bla_rx avoidance checks if:
  *  * we have to race for a claim
@@ -1824,7 +1889,7 @@ batadv_bla_loopdetect_check(struct batadv_priv *bat_priv, struct sk_buff *skb,
  * further process the skb.
  */
 bool batadv_bla_rx(struct batadv_priv *bat_priv, struct sk_buff *skb,
-                  unsigned short vid, bool is_bcast)
+                  unsigned short vid, int packet_type)
 {
        struct batadv_bla_backbone_gw *backbone_gw;
        struct ethhdr *ethhdr;
@@ -1846,9 +1911,32 @@ bool batadv_bla_rx(struct batadv_priv *bat_priv, struct sk_buff *skb,
                goto handled;
 
        if (unlikely(atomic_read(&bat_priv->bla.num_requests)))
-               /* don't allow broadcasts while requests are in flight */
-               if (is_multicast_ether_addr(ethhdr->h_dest) && is_bcast)
-                       goto handled;
+               /* don't allow multicast packets while requests are in flight */
+               if (is_multicast_ether_addr(ethhdr->h_dest))
+                       /* Both broadcast flooding or multicast-via-unicasts
+                        * delivery might send to multiple backbone gateways
+                        * sharing the same LAN and therefore need to coordinate
+                        * which backbone gateway forwards into the LAN,
+                        * by claiming the payload source address.
+                        *
+                        * Broadcast flooding and multicast-via-unicasts
+                        * delivery use the following two batman packet types.
+                        * Note: explicitly exclude BATADV_UNICAST_4ADDR,
+                        * as the DHCP gateway feature will send explicitly
+                        * to only one BLA gateway, so the claiming process
+                        * should be avoided there.
+                        */
+                       if (packet_type == BATADV_BCAST ||
+                           packet_type == BATADV_UNICAST)
+                               goto handled;
+
+       /* potential duplicates from foreign BLA backbone gateways via
+        * multicast-in-unicast packets
+        */
+       if (is_multicast_ether_addr(ethhdr->h_dest) &&
+           packet_type == BATADV_UNICAST &&
+           batadv_bla_check_ucast_duplist(bat_priv, skb))
+               goto handled;
 
        ether_addr_copy(search_claim.addr, ethhdr->h_source);
        search_claim.vid = vid;
@@ -1883,13 +1971,14 @@ bool batadv_bla_rx(struct batadv_priv *bat_priv, struct sk_buff *skb,
                goto allow;
        }
 
-       /* if it is a broadcast ... */
-       if (is_multicast_ether_addr(ethhdr->h_dest) && is_bcast) {
+       /* if it is a multicast ... */
+       if (is_multicast_ether_addr(ethhdr->h_dest) &&
+           (packet_type == BATADV_BCAST || packet_type == BATADV_UNICAST)) {
                /* ... drop it. the responsible gateway is in charge.
                 *
-                * We need to check is_bcast because with the gateway
+                * We need to check packet type because with the gateway
                 * feature, broadcasts (like DHCP requests) may be sent
-                * using a unicast packet type.
+                * using a unicast 4 address packet type. See comment above.
                 */
                goto handled;
        } else {
index 41edb2c..a81c41b 100644 (file)
@@ -35,7 +35,7 @@ static inline bool batadv_bla_is_loopdetect_mac(const uint8_t *mac)
 
 #ifdef CONFIG_BATMAN_ADV_BLA
 bool batadv_bla_rx(struct batadv_priv *bat_priv, struct sk_buff *skb,
-                  unsigned short vid, bool is_bcast);
+                  unsigned short vid, int packet_type);
 bool batadv_bla_tx(struct batadv_priv *bat_priv, struct sk_buff *skb,
                   unsigned short vid);
 bool batadv_bla_is_backbone_gw(struct sk_buff *skb,
@@ -66,7 +66,7 @@ bool batadv_bla_check_claim(struct batadv_priv *bat_priv, u8 *addr,
 
 static inline bool batadv_bla_rx(struct batadv_priv *bat_priv,
                                 struct sk_buff *skb, unsigned short vid,
-                                bool is_bcast)
+                                int packet_type)
 {
        return false;
 }
index bdc4a1f..ca24a2e 100644 (file)
@@ -51,6 +51,7 @@
 #include <uapi/linux/batadv_packet.h>
 #include <uapi/linux/batman_adv.h>
 
+#include "bridge_loop_avoidance.h"
 #include "hard-interface.h"
 #include "hash.h"
 #include "log.h"
@@ -1434,6 +1435,35 @@ batadv_mcast_forw_mode(struct batadv_priv *bat_priv, struct sk_buff *skb,
        return BATADV_FORW_ALL;
 }
 
+/**
+ * batadv_mcast_forw_send_orig() - send a multicast packet to an originator
+ * @bat_priv: the bat priv with all the soft interface information
+ * @skb: the multicast packet to send
+ * @vid: the vlan identifier
+ * @orig_node: the originator to send the packet to
+ *
+ * Return: NET_XMIT_DROP in case of error or NET_XMIT_SUCCESS otherwise.
+ */
+int batadv_mcast_forw_send_orig(struct batadv_priv *bat_priv,
+                               struct sk_buff *skb,
+                               unsigned short vid,
+                               struct batadv_orig_node *orig_node)
+{
+       /* Avoid sending multicast-in-unicast packets to other BLA
+        * gateways - they already got the frame from the LAN side
+        * we share with them.
+        * TODO: Refactor to take BLA into account earlier, to avoid
+        * reducing the mcast_fanout count.
+        */
+       if (batadv_bla_is_backbone_gw_orig(bat_priv, orig_node->orig, vid)) {
+               dev_kfree_skb(skb);
+               return NET_XMIT_SUCCESS;
+       }
+
+       return batadv_send_skb_unicast(bat_priv, skb, BATADV_UNICAST, 0,
+                                      orig_node, vid);
+}
+
 /**
  * batadv_mcast_forw_tt() - forwards a packet to multicast listeners
  * @bat_priv: the bat priv with all the soft interface information
@@ -1471,8 +1501,8 @@ batadv_mcast_forw_tt(struct batadv_priv *bat_priv, struct sk_buff *skb,
                        break;
                }
 
-               batadv_send_skb_unicast(bat_priv, newskb, BATADV_UNICAST, 0,
-                                       orig_entry->orig_node, vid);
+               batadv_mcast_forw_send_orig(bat_priv, newskb, vid,
+                                           orig_entry->orig_node);
        }
        rcu_read_unlock();
 
@@ -1513,8 +1543,7 @@ batadv_mcast_forw_want_all_ipv4(struct batadv_priv *bat_priv,
                        break;
                }
 
-               batadv_send_skb_unicast(bat_priv, newskb, BATADV_UNICAST, 0,
-                                       orig_node, vid);
+               batadv_mcast_forw_send_orig(bat_priv, newskb, vid, orig_node);
        }
        rcu_read_unlock();
        return ret;
@@ -1551,8 +1580,7 @@ batadv_mcast_forw_want_all_ipv6(struct batadv_priv *bat_priv,
                        break;
                }
 
-               batadv_send_skb_unicast(bat_priv, newskb, BATADV_UNICAST, 0,
-                                       orig_node, vid);
+               batadv_mcast_forw_send_orig(bat_priv, newskb, vid, orig_node);
        }
        rcu_read_unlock();
        return ret;
@@ -1618,8 +1646,7 @@ batadv_mcast_forw_want_all_rtr4(struct batadv_priv *bat_priv,
                        break;
                }
 
-               batadv_send_skb_unicast(bat_priv, newskb, BATADV_UNICAST, 0,
-                                       orig_node, vid);
+               batadv_mcast_forw_send_orig(bat_priv, newskb, vid, orig_node);
        }
        rcu_read_unlock();
        return ret;
@@ -1656,8 +1683,7 @@ batadv_mcast_forw_want_all_rtr6(struct batadv_priv *bat_priv,
                        break;
                }
 
-               batadv_send_skb_unicast(bat_priv, newskb, BATADV_UNICAST, 0,
-                                       orig_node, vid);
+               batadv_mcast_forw_send_orig(bat_priv, newskb, vid, orig_node);
        }
        rcu_read_unlock();
        return ret;
index ebf8259..3e114bc 100644 (file)
@@ -46,6 +46,11 @@ enum batadv_forw_mode
 batadv_mcast_forw_mode(struct batadv_priv *bat_priv, struct sk_buff *skb,
                       struct batadv_orig_node **mcast_single_orig);
 
+int batadv_mcast_forw_send_orig(struct batadv_priv *bat_priv,
+                               struct sk_buff *skb,
+                               unsigned short vid,
+                               struct batadv_orig_node *orig_node);
+
 int batadv_mcast_forw_send(struct batadv_priv *bat_priv, struct sk_buff *skb,
                           unsigned short vid);
 
@@ -71,6 +76,16 @@ batadv_mcast_forw_mode(struct batadv_priv *bat_priv, struct sk_buff *skb,
        return BATADV_FORW_ALL;
 }
 
+static inline int
+batadv_mcast_forw_send_orig(struct batadv_priv *bat_priv,
+                           struct sk_buff *skb,
+                           unsigned short vid,
+                           struct batadv_orig_node *orig_node)
+{
+       kfree_skb(skb);
+       return NET_XMIT_DROP;
+}
+
 static inline int
 batadv_mcast_forw_send(struct batadv_priv *bat_priv, struct sk_buff *skb,
                       unsigned short vid)
index 27cdf5e..9e5c71e 100644 (file)
@@ -826,6 +826,10 @@ static bool batadv_check_unicast_ttvn(struct batadv_priv *bat_priv,
        vid = batadv_get_vid(skb, hdr_len);
        ethhdr = (struct ethhdr *)(skb->data + hdr_len);
 
+       /* do not reroute multicast frames in a unicast header */
+       if (is_multicast_ether_addr(ethhdr->h_dest))
+               return true;
+
        /* check if the destination client was served by this node and it is now
         * roaming. In this case, it means that the node has got a ROAM_ADV
         * message and that it knows the new destination in the mesh to re-route
index 23833a0..cdde943 100644 (file)
@@ -364,9 +364,8 @@ send:
                                goto dropped;
                        ret = batadv_send_skb_via_gw(bat_priv, skb, vid);
                } else if (mcast_single_orig) {
-                       ret = batadv_send_skb_unicast(bat_priv, skb,
-                                                     BATADV_UNICAST, 0,
-                                                     mcast_single_orig, vid);
+                       ret = batadv_mcast_forw_send_orig(bat_priv, skb, vid,
+                                                         mcast_single_orig);
                } else if (forw_mode == BATADV_FORW_SOME) {
                        ret = batadv_mcast_forw_send(bat_priv, skb, vid);
                } else {
@@ -425,10 +424,10 @@ void batadv_interface_rx(struct net_device *soft_iface,
        struct vlan_ethhdr *vhdr;
        struct ethhdr *ethhdr;
        unsigned short vid;
-       bool is_bcast;
+       int packet_type;
 
        batadv_bcast_packet = (struct batadv_bcast_packet *)skb->data;
-       is_bcast = (batadv_bcast_packet->packet_type == BATADV_BCAST);
+       packet_type = batadv_bcast_packet->packet_type;
 
        skb_pull_rcsum(skb, hdr_size);
        skb_reset_mac_header(skb);
@@ -471,7 +470,7 @@ void batadv_interface_rx(struct net_device *soft_iface,
        /* Let the bridge loop avoidance check the packet. If will
         * not handle it, we can safely push it up.
         */
-       if (batadv_bla_rx(bat_priv, skb, vid, is_bcast))
+       if (batadv_bla_rx(bat_priv, skb, vid, packet_type))
                goto out;
 
        if (orig_node)
index f9092c7..61c94ce 100644 (file)
@@ -1288,11 +1288,13 @@ void br_vlan_get_stats(const struct net_bridge_vlan *v,
        }
 }
 
-static int __br_vlan_get_pvid(const struct net_device *dev,
-                             struct net_bridge_port *p, u16 *p_pvid)
+int br_vlan_get_pvid(const struct net_device *dev, u16 *p_pvid)
 {
        struct net_bridge_vlan_group *vg;
+       struct net_bridge_port *p;
 
+       ASSERT_RTNL();
+       p = br_port_get_check_rtnl(dev);
        if (p)
                vg = nbp_vlan_group(p);
        else if (netif_is_bridge_master(dev))
@@ -1303,18 +1305,23 @@ static int __br_vlan_get_pvid(const struct net_device *dev,
        *p_pvid = br_get_pvid(vg);
        return 0;
 }
-
-int br_vlan_get_pvid(const struct net_device *dev, u16 *p_pvid)
-{
-       ASSERT_RTNL();
-
-       return __br_vlan_get_pvid(dev, br_port_get_check_rtnl(dev), p_pvid);
-}
 EXPORT_SYMBOL_GPL(br_vlan_get_pvid);
 
 int br_vlan_get_pvid_rcu(const struct net_device *dev, u16 *p_pvid)
 {
-       return __br_vlan_get_pvid(dev, br_port_get_check_rcu(dev), p_pvid);
+       struct net_bridge_vlan_group *vg;
+       struct net_bridge_port *p;
+
+       p = br_port_get_check_rcu(dev);
+       if (p)
+               vg = nbp_vlan_group_rcu(p);
+       else if (netif_is_bridge_master(dev))
+               vg = br_vlan_group_rcu(netdev_priv(dev));
+       else
+               return -EINVAL;
+
+       *p_pvid = br_get_pvid(vg);
+       return 0;
 }
 EXPORT_SYMBOL_GPL(br_vlan_get_pvid_rcu);
 
index 4086d33..266073e 100644 (file)
@@ -8647,7 +8647,7 @@ int dev_get_port_parent_id(struct net_device *dev,
                if (!first.id_len)
                        first = *ppid;
                else if (memcmp(&first, ppid, sizeof(*ppid)))
-                       return -ENODATA;
+                       return -EOPNOTSUPP;
        }
 
        return err;
index d6b6ced..0c01bd8 100644 (file)
@@ -144,7 +144,7 @@ static void dst_destroy_rcu(struct rcu_head *head)
 
 /* Operations to mark dst as DEAD and clean up the net device referenced
  * by dst:
- * 1. put the dst under loopback interface and discard all tx/rx packets
+ * 1. put the dst under blackhole interface and discard all tx/rx packets
  *    on this route.
  * 2. release the net_device
  * This function should be called when removing routes from the fib tree
index 51678a5..7bcfb16 100644 (file)
@@ -16,7 +16,7 @@
 #include <net/ip_tunnels.h>
 #include <linux/indirect_call_wrapper.h>
 
-#ifdef CONFIG_IPV6_MULTIPLE_TABLES
+#if defined(CONFIG_IPV6) && defined(CONFIG_IPV6_MULTIPLE_TABLES)
 #ifdef CONFIG_IP_MULTIPLE_TABLES
 #define INDIRECT_CALL_MT(f, f2, f1, ...) \
        INDIRECT_CALL_INET(f, f2, f1, __VA_ARGS__)
index 1f647ab..21eaf3b 100644 (file)
@@ -4838,6 +4838,7 @@ static int bpf_ipv4_fib_lookup(struct net *net, struct bpf_fib_lookup *params,
        fl4.saddr = params->ipv4_src;
        fl4.fl4_sport = params->sport;
        fl4.fl4_dport = params->dport;
+       fl4.flowi4_multipath_hash = 0;
 
        if (flags & BPF_FIB_LOOKUP_DIRECT) {
                u32 tbid = l3mdev_fib_table_rcu(dev) ? : RT_TABLE_MAIN;
@@ -7065,8 +7066,6 @@ static int bpf_gen_ld_abs(const struct bpf_insn *orig,
        bool indirect = BPF_MODE(orig->code) == BPF_IND;
        struct bpf_insn *insn = insn_buf;
 
-       /* We're guaranteed here that CTX is in R6. */
-       *insn++ = BPF_MOV64_REG(BPF_REG_1, BPF_REG_CTX);
        if (!indirect) {
                *insn++ = BPF_MOV64_IMM(BPF_REG_2, orig->imm);
        } else {
@@ -7074,6 +7073,8 @@ static int bpf_gen_ld_abs(const struct bpf_insn *orig,
                if (orig->imm)
                        *insn++ = BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, orig->imm);
        }
+       /* We're guaranteed here that CTX is in R6. */
+       *insn++ = BPF_MOV64_REG(BPF_REG_1, BPF_REG_CTX);
 
        switch (BPF_SIZE(orig->code)) {
        case BPF_B:
@@ -9522,7 +9523,7 @@ BPF_CALL_1(bpf_skc_to_tcp6_sock, struct sock *, sk)
         * trigger an explicit type generation here.
         */
        BTF_TYPE_EMIT(struct tcp6_sock);
-       if (sk_fullsock(sk) && sk->sk_protocol == IPPROTO_TCP &&
+       if (sk && sk_fullsock(sk) && sk->sk_protocol == IPPROTO_TCP &&
            sk->sk_family == AF_INET6)
                return (unsigned long)sk;
 
@@ -9540,7 +9541,7 @@ const struct bpf_func_proto bpf_skc_to_tcp6_sock_proto = {
 
 BPF_CALL_1(bpf_skc_to_tcp_sock, struct sock *, sk)
 {
-       if (sk_fullsock(sk) && sk->sk_protocol == IPPROTO_TCP)
+       if (sk && sk_fullsock(sk) && sk->sk_protocol == IPPROTO_TCP)
                return (unsigned long)sk;
 
        return (unsigned long)NULL;
@@ -9558,12 +9559,12 @@ const struct bpf_func_proto bpf_skc_to_tcp_sock_proto = {
 BPF_CALL_1(bpf_skc_to_tcp_timewait_sock, struct sock *, sk)
 {
 #ifdef CONFIG_INET
-       if (sk->sk_prot == &tcp_prot && sk->sk_state == TCP_TIME_WAIT)
+       if (sk && sk->sk_prot == &tcp_prot && sk->sk_state == TCP_TIME_WAIT)
                return (unsigned long)sk;
 #endif
 
 #if IS_BUILTIN(CONFIG_IPV6)
-       if (sk->sk_prot == &tcpv6_prot && sk->sk_state == TCP_TIME_WAIT)
+       if (sk && sk->sk_prot == &tcpv6_prot && sk->sk_state == TCP_TIME_WAIT)
                return (unsigned long)sk;
 #endif
 
@@ -9582,12 +9583,12 @@ const struct bpf_func_proto bpf_skc_to_tcp_timewait_sock_proto = {
 BPF_CALL_1(bpf_skc_to_tcp_request_sock, struct sock *, sk)
 {
 #ifdef CONFIG_INET
-       if (sk->sk_prot == &tcp_prot  && sk->sk_state == TCP_NEW_SYN_RECV)
+       if (sk && sk->sk_prot == &tcp_prot && sk->sk_state == TCP_NEW_SYN_RECV)
                return (unsigned long)sk;
 #endif
 
 #if IS_BUILTIN(CONFIG_IPV6)
-       if (sk->sk_prot == &tcpv6_prot && sk->sk_state == TCP_NEW_SYN_RECV)
+       if (sk && sk->sk_prot == &tcpv6_prot && sk->sk_state == TCP_NEW_SYN_RECV)
                return (unsigned long)sk;
 #endif
 
@@ -9609,7 +9610,7 @@ BPF_CALL_1(bpf_skc_to_udp6_sock, struct sock *, sk)
         * trigger an explicit type generation here.
         */
        BTF_TYPE_EMIT(struct udp6_sock);
-       if (sk_fullsock(sk) && sk->sk_protocol == IPPROTO_UDP &&
+       if (sk && sk_fullsock(sk) && sk->sk_protocol == IPPROTO_UDP &&
            sk->sk_type == SOCK_DGRAM && sk->sk_family == AF_INET6)
                return (unsigned long)sk;
 
index dcd61ac..944ab21 100644 (file)
@@ -251,10 +251,10 @@ int peernet2id_alloc(struct net *net, struct net *peer, gfp_t gfp)
        if (refcount_read(&net->count) == 0)
                return NETNSA_NSID_NOT_ASSIGNED;
 
-       spin_lock(&net->nsid_lock);
+       spin_lock_bh(&net->nsid_lock);
        id = __peernet2id(net, peer);
        if (id >= 0) {
-               spin_unlock(&net->nsid_lock);
+               spin_unlock_bh(&net->nsid_lock);
                return id;
        }
 
@@ -264,12 +264,12 @@ int peernet2id_alloc(struct net *net, struct net *peer, gfp_t gfp)
         * just been idr_remove()'d from there in cleanup_net().
         */
        if (!maybe_get_net(peer)) {
-               spin_unlock(&net->nsid_lock);
+               spin_unlock_bh(&net->nsid_lock);
                return NETNSA_NSID_NOT_ASSIGNED;
        }
 
        id = alloc_netid(net, peer, -1);
-       spin_unlock(&net->nsid_lock);
+       spin_unlock_bh(&net->nsid_lock);
 
        put_net(peer);
        if (id < 0)
@@ -534,20 +534,20 @@ static void unhash_nsid(struct net *net, struct net *last)
        for_each_net(tmp) {
                int id;
 
-               spin_lock(&tmp->nsid_lock);
+               spin_lock_bh(&tmp->nsid_lock);
                id = __peernet2id(tmp, net);
                if (id >= 0)
                        idr_remove(&tmp->netns_ids, id);
-               spin_unlock(&tmp->nsid_lock);
+               spin_unlock_bh(&tmp->nsid_lock);
                if (id >= 0)
                        rtnl_net_notifyid(tmp, RTM_DELNSID, id, 0, NULL,
                                          GFP_KERNEL);
                if (tmp == last)
                        break;
        }
-       spin_lock(&net->nsid_lock);
+       spin_lock_bh(&net->nsid_lock);
        idr_destroy(&net->netns_ids);
-       spin_unlock(&net->nsid_lock);
+       spin_unlock_bh(&net->nsid_lock);
 }
 
 static LLIST_HEAD(cleanup_list);
@@ -760,9 +760,9 @@ static int rtnl_net_newid(struct sk_buff *skb, struct nlmsghdr *nlh,
                return PTR_ERR(peer);
        }
 
-       spin_lock(&net->nsid_lock);
+       spin_lock_bh(&net->nsid_lock);
        if (__peernet2id(net, peer) >= 0) {
-               spin_unlock(&net->nsid_lock);
+               spin_unlock_bh(&net->nsid_lock);
                err = -EEXIST;
                NL_SET_BAD_ATTR(extack, nla);
                NL_SET_ERR_MSG(extack,
@@ -771,7 +771,7 @@ static int rtnl_net_newid(struct sk_buff *skb, struct nlmsghdr *nlh,
        }
 
        err = alloc_netid(net, peer, nsid);
-       spin_unlock(&net->nsid_lock);
+       spin_unlock_bh(&net->nsid_lock);
        if (err >= 0) {
                rtnl_net_notifyid(net, RTM_NEWNSID, err, NETLINK_CB(skb).portid,
                                  nlh, GFP_KERNEL);
index 84dde5a..16014ad 100644 (file)
@@ -1426,6 +1426,7 @@ static int dcbnl_ieee_set(struct net_device *netdev, struct nlmsghdr *nlh,
 {
        const struct dcbnl_rtnl_ops *ops = netdev->dcbnl_ops;
        struct nlattr *ieee[DCB_ATTR_IEEE_MAX + 1];
+       int prio;
        int err;
 
        if (!ops)
@@ -1475,6 +1476,13 @@ static int dcbnl_ieee_set(struct net_device *netdev, struct nlmsghdr *nlh,
                struct dcbnl_buffer *buffer =
                        nla_data(ieee[DCB_ATTR_DCB_BUFFER]);
 
+               for (prio = 0; prio < ARRAY_SIZE(buffer->prio2buffer); prio++) {
+                       if (buffer->prio2buffer[prio] >= DCBX_MAX_BUFFERS) {
+                               err = -EINVAL;
+                               goto err;
+                       }
+               }
+
                err = ops->dcbnl_setbuffer(netdev, buffer);
                if (err)
                        goto err;
index 9af1a2d..16e5f98 100644 (file)
@@ -1799,15 +1799,27 @@ int dsa_slave_create(struct dsa_port *port)
 
        dsa_slave_notify(slave_dev, DSA_PORT_REGISTER);
 
-       ret = register_netdev(slave_dev);
+       rtnl_lock();
+
+       ret = register_netdevice(slave_dev);
        if (ret) {
                netdev_err(master, "error %d registering interface %s\n",
                           ret, slave_dev->name);
+               rtnl_unlock();
                goto out_phy;
        }
 
+       ret = netdev_upper_dev_link(master, slave_dev, NULL);
+
+       rtnl_unlock();
+
+       if (ret)
+               goto out_unregister;
+
        return 0;
 
+out_unregister:
+       unregister_netdev(slave_dev);
 out_phy:
        rtnl_lock();
        phylink_disconnect_phy(p->dp->pl);
@@ -1824,16 +1836,18 @@ out_free:
 
 void dsa_slave_destroy(struct net_device *slave_dev)
 {
+       struct net_device *master = dsa_slave_to_master(slave_dev);
        struct dsa_port *dp = dsa_slave_to_port(slave_dev);
        struct dsa_slave_priv *p = netdev_priv(slave_dev);
 
        netif_carrier_off(slave_dev);
        rtnl_lock();
+       netdev_upper_dev_unlink(master, slave_dev);
+       unregister_netdevice(slave_dev);
        phylink_disconnect_phy(dp->pl);
        rtnl_unlock();
 
        dsa_slave_notify(slave_dev, DSA_PORT_UNREGISTER);
-       unregister_netdev(slave_dev);
        phylink_destroy(dp->pl);
        gro_cells_destroy(&p->gcells);
        free_percpu(p->stats64);
index 42f327c..b4fc05c 100644 (file)
@@ -160,11 +160,14 @@ static struct sk_buff *ocelot_xmit(struct sk_buff *skb,
        packing(injection, &qos_class, 19,  17, OCELOT_TAG_LEN, PACK, 0);
 
        if (ocelot->ptp && (skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP)) {
+               struct sk_buff *clone = DSA_SKB_CB(skb)->clone;
+
                rew_op = ocelot_port->ptp_cmd;
-               if (ocelot_port->ptp_cmd == IFH_REW_OP_TWO_STEP_PTP) {
-                       rew_op |= (ocelot_port->ts_id  % 4) << 3;
-                       ocelot_port->ts_id++;
-               }
+               /* Retrieve timestamp ID populated inside skb->cb[0] of the
+                * clone by ocelot_port_add_txtstamp_skb
+                */
+               if (ocelot_port->ptp_cmd == IFH_REW_OP_TWO_STEP_PTP)
+                       rew_op |= clone->cb[0] << 3;
 
                packing(injection, &rew_op, 125, 117, OCELOT_TAG_LEN, PACK, 0);
        }
index 84f2328..d93bf2d 100644 (file)
@@ -200,7 +200,7 @@ int ethnl_tunnel_info_doit(struct sk_buff *skb, struct genl_info *info)
        reply_len = ret + ethnl_reply_header_size();
 
        rskb = ethnl_reply_init(reply_len, req_info.dev,
-                               ETHTOOL_MSG_TUNNEL_INFO_GET,
+                               ETHTOOL_MSG_TUNNEL_INFO_GET_REPLY,
                                ETHTOOL_A_TUNNEL_INFO_HEADER,
                                info, &reply_payload);
        if (!rskb) {
@@ -273,7 +273,7 @@ int ethnl_tunnel_info_dumpit(struct sk_buff *skb, struct netlink_callback *cb)
                                goto cont;
 
                        ehdr = ethnl_dump_put(skb, cb,
-                                             ETHTOOL_MSG_TUNNEL_INFO_GET);
+                                             ETHTOOL_MSG_TUNNEL_INFO_GET_REPLY);
                        if (!ehdr) {
                                ret = -EMSGSIZE;
                                goto out;
index 06c3cd9..0e4681c 100644 (file)
@@ -76,7 +76,7 @@ static int hsr_newlink(struct net *src_net, struct net_device *dev,
                proto = nla_get_u8(data[IFLA_HSR_PROTOCOL]);
 
        if (proto >= HSR_PROTOCOL_MAX) {
-               NL_SET_ERR_MSG_MOD(extack, "Unsupported protocol\n");
+               NL_SET_ERR_MSG_MOD(extack, "Unsupported protocol");
                return -EINVAL;
        }
 
@@ -84,14 +84,14 @@ static int hsr_newlink(struct net *src_net, struct net_device *dev,
                proto_version = HSR_V0;
        } else {
                if (proto == HSR_PROTOCOL_PRP) {
-                       NL_SET_ERR_MSG_MOD(extack, "PRP version unsupported\n");
+                       NL_SET_ERR_MSG_MOD(extack, "PRP version unsupported");
                        return -EINVAL;
                }
 
                proto_version = nla_get_u8(data[IFLA_HSR_VERSION]);
                if (proto_version > HSR_V1) {
                        NL_SET_ERR_MSG_MOD(extack,
-                                          "Only HSR version 0/1 supported\n");
+                                          "Only HSR version 0/1 supported");
                        return -EINVAL;
                }
        }
index 4107949..86a23e4 100644 (file)
@@ -362,6 +362,7 @@ static int __fib_validate_source(struct sk_buff *skb, __be32 src, __be32 dst,
        fl4.flowi4_tun_key.tun_id = 0;
        fl4.flowi4_flags = 0;
        fl4.flowi4_uid = sock_net_uid(net, NULL);
+       fl4.flowi4_multipath_hash = 0;
 
        no_addr = idev->ifa_list == NULL;
 
index 4a98dd7..f1bd95f 100644 (file)
@@ -186,8 +186,8 @@ errout:
 }
 EXPORT_SYMBOL_GPL(inet_diag_msg_attrs_fill);
 
-static void inet_diag_parse_attrs(const struct nlmsghdr *nlh, int hdrlen,
-                                 struct nlattr **req_nlas)
+static int inet_diag_parse_attrs(const struct nlmsghdr *nlh, int hdrlen,
+                                struct nlattr **req_nlas)
 {
        struct nlattr *nla;
        int remaining;
@@ -195,9 +195,13 @@ static void inet_diag_parse_attrs(const struct nlmsghdr *nlh, int hdrlen,
        nlmsg_for_each_attr(nla, nlh, hdrlen, remaining) {
                int type = nla_type(nla);
 
+               if (type == INET_DIAG_REQ_PROTOCOL && nla_len(nla) != sizeof(u32))
+                       return -EINVAL;
+
                if (type < __INET_DIAG_REQ_MAX)
                        req_nlas[type] = nla;
        }
+       return 0;
 }
 
 static int inet_diag_get_protocol(const struct inet_diag_req_v2 *req,
@@ -574,7 +578,10 @@ static int inet_diag_cmd_exact(int cmd, struct sk_buff *in_skb,
        int err, protocol;
 
        memset(&dump_data, 0, sizeof(dump_data));
-       inet_diag_parse_attrs(nlh, hdrlen, dump_data.req_nlas);
+       err = inet_diag_parse_attrs(nlh, hdrlen, dump_data.req_nlas);
+       if (err)
+               return err;
+
        protocol = inet_diag_get_protocol(req, &dump_data);
 
        handler = inet_diag_lock_handler(protocol);
@@ -1180,8 +1187,11 @@ static int __inet_diag_dump_start(struct netlink_callback *cb, int hdrlen)
        if (!cb_data)
                return -ENOMEM;
 
-       inet_diag_parse_attrs(nlh, hdrlen, cb_data->req_nlas);
-
+       err = inet_diag_parse_attrs(nlh, hdrlen, cb_data->req_nlas);
+       if (err) {
+               kfree(cb_data);
+               return err;
+       }
        nla = cb_data->inet_diag_nla_bc;
        if (nla) {
                err = inet_diag_bc_audit(nla, skb);
index 61f802d..e6f2ada 100644 (file)
@@ -74,6 +74,7 @@
 #include <net/icmp.h>
 #include <net/checksum.h>
 #include <net/inetpeer.h>
+#include <net/inet_ecn.h>
 #include <net/lwtunnel.h>
 #include <linux/bpf-cgroup.h>
 #include <linux/igmp.h>
@@ -1703,7 +1704,7 @@ void ip_send_unicast_reply(struct sock *sk, struct sk_buff *skb,
        if (IS_ERR(rt))
                return;
 
-       inet_sk(sk)->tos = arg->tos;
+       inet_sk(sk)->tos = arg->tos & ~INET_ECN_MASK;
 
        sk->sk_protocol = ip_hdr(skb)->protocol;
        sk->sk_bound_dev_if = arg->bound_dev_if;
index 75c6013..b2ea1a8 100644 (file)
@@ -554,6 +554,7 @@ static int ip_tun_parse_opts_vxlan(struct nlattr *attr,
 
                attr = tb[LWTUNNEL_IP_OPT_VXLAN_GBP];
                md->gbp = nla_get_u32(attr);
+               md->gbp &= VXLAN_GBP_MASK;
                info->key.tun_flags |= TUNNEL_VXLAN_OPT;
        }
 
index 8ca6bca..58642b2 100644 (file)
@@ -786,8 +786,10 @@ static void __ip_do_redirect(struct rtable *rt, struct sk_buff *skb, struct flow
                        neigh_event_send(n, NULL);
                } else {
                        if (fib_lookup(net, fl4, &res, 0) == 0) {
-                               struct fib_nh_common *nhc = FIB_RES_NHC(res);
+                               struct fib_nh_common *nhc;
 
+                               fib_select_path(net, &res, fl4, skb);
+                               nhc = FIB_RES_NHC(res);
                                update_or_create_fnhe(nhc, fl4->daddr, new_gw,
                                                0, false,
                                                jiffies + ip_rt_gc_timeout);
@@ -1013,6 +1015,7 @@ out:      kfree_skb(skb);
 static void __ip_rt_update_pmtu(struct rtable *rt, struct flowi4 *fl4, u32 mtu)
 {
        struct dst_entry *dst = &rt->dst;
+       struct net *net = dev_net(dst->dev);
        u32 old_mtu = ipv4_mtu(dst);
        struct fib_result res;
        bool lock = false;
@@ -1033,9 +1036,11 @@ static void __ip_rt_update_pmtu(struct rtable *rt, struct flowi4 *fl4, u32 mtu)
                return;
 
        rcu_read_lock();
-       if (fib_lookup(dev_net(dst->dev), fl4, &res, 0) == 0) {
-               struct fib_nh_common *nhc = FIB_RES_NHC(res);
+       if (fib_lookup(net, fl4, &res, 0) == 0) {
+               struct fib_nh_common *nhc;
 
+               fib_select_path(net, &res, fl4, NULL);
+               nhc = FIB_RES_NHC(res);
                update_or_create_fnhe(nhc, fl4->daddr, 0, mtu, lock,
                                      jiffies + ip_rt_mtu_expires);
        }
@@ -2147,6 +2152,7 @@ static int ip_route_input_slow(struct sk_buff *skb, __be32 daddr, __be32 saddr,
        fl4.daddr = daddr;
        fl4.saddr = saddr;
        fl4.flowi4_uid = sock_net_uid(net, NULL);
+       fl4.flowi4_multipath_hash = 0;
 
        if (fib4_rules_early_flow_dissect(net, skb, &fl4, &_flkeys)) {
                flkeys = &_flkeys;
@@ -2667,8 +2673,6 @@ struct rtable *ip_route_output_key_hash_rcu(struct net *net, struct flowi4 *fl4,
        fib_select_path(net, res, fl4, skb);
 
        dev_out = FIB_RES_DEV(*res);
-       fl4->flowi4_oif = dev_out->ifindex;
-
 
 make_route:
        rth = __mkroute_output(res, fl4, orig_oif, dev_out, flags);
index 76bff79..747f56e 100644 (file)
@@ -303,6 +303,7 @@ config IPV6_SEG6_LWTUNNEL
 config IPV6_SEG6_HMAC
        bool "IPv6: Segment Routing HMAC support"
        depends on IPV6
+       select CRYPTO
        select CRYPTO_HMAC
        select CRYPTO_SHA1
        select CRYPTO_SHA256
index 25a90f3..4a664ad 100644 (file)
@@ -1993,14 +1993,19 @@ static void fib6_del_route(struct fib6_table *table, struct fib6_node *fn,
 /* Need to own table->tb6_lock */
 int fib6_del(struct fib6_info *rt, struct nl_info *info)
 {
-       struct fib6_node *fn = rcu_dereference_protected(rt->fib6_node,
-                                   lockdep_is_held(&rt->fib6_table->tb6_lock));
-       struct fib6_table *table = rt->fib6_table;
        struct net *net = info->nl_net;
        struct fib6_info __rcu **rtp;
        struct fib6_info __rcu **rtp_next;
+       struct fib6_table *table;
+       struct fib6_node *fn;
+
+       if (rt == net->ipv6.fib6_null_entry)
+               return -ENOENT;
 
-       if (!fn || rt == net->ipv6.fib6_null_entry)
+       table = rt->fib6_table;
+       fn = rcu_dereference_protected(rt->fib6_node,
+                                      lockdep_is_held(&table->tb6_lock));
+       if (!fn)
                return -ENOENT;
 
        WARN_ON(!(fn->fn_flags & RTN_RTINFO));
index 5e7e25e..fb075d9 100644 (file)
@@ -4202,7 +4202,7 @@ static struct fib6_info *rt6_add_route_info(struct net *net,
                .fc_nlinfo.nl_net = net,
        };
 
-       cfg.fc_table = l3mdev_fib_table(dev) ? : RT6_TABLE_INFO,
+       cfg.fc_table = l3mdev_fib_table(dev) ? : RT6_TABLE_INFO;
        cfg.fc_dst = *prefix;
        cfg.fc_gateway = *gwaddr;
 
index 3149730..26d2f8b 100644 (file)
@@ -560,7 +560,9 @@ static int ieee80211_fill_rx_status(struct ieee80211_rx_status *stat,
        if (rate->idx < 0 || !rate->count)
                return -1;
 
-       if (rate->flags & IEEE80211_TX_RC_80_MHZ_WIDTH)
+       if (rate->flags & IEEE80211_TX_RC_160_MHZ_WIDTH)
+               stat->bw = RATE_INFO_BW_160;
+       else if (rate->flags & IEEE80211_TX_RC_80_MHZ_WIDTH)
                stat->bw = RATE_INFO_BW_80;
        else if (rate->flags & IEEE80211_TX_RC_40_MHZ_WIDTH)
                stat->bw = RATE_INFO_BW_40;
@@ -668,20 +670,26 @@ u32 ieee80211_calc_expected_tx_airtime(struct ieee80211_hw *hw,
                 * This will not be very accurate, but much better than simply
                 * assuming un-aggregated tx in all cases.
                 */
-               if (duration > 400) /* <= VHT20 MCS2 1S */
+               if (duration > 400 * 1024) /* <= VHT20 MCS2 1S */
                        agg_shift = 1;
-               else if (duration > 250) /* <= VHT20 MCS3 1S or MCS1 2S */
+               else if (duration > 250 * 1024) /* <= VHT20 MCS3 1S or MCS1 2S */
                        agg_shift = 2;
-               else if (duration > 150) /* <= VHT20 MCS5 1S or MCS3 2S */
+               else if (duration > 150 * 1024) /* <= VHT20 MCS5 1S or MCS2 2S */
                        agg_shift = 3;
-               else
+               else if (duration > 70 * 1024) /* <= VHT20 MCS5 2S */
                        agg_shift = 4;
+               else if (stat.encoding != RX_ENC_HE ||
+                        duration > 20 * 1024) /* <= HE40 MCS6 2S */
+                       agg_shift = 5;
+               else
+                       agg_shift = 6;
 
                duration *= len;
                duration /= AVG_PKT_SIZE;
                duration /= 1024;
+               duration += (overhead >> agg_shift);
 
-               return duration + (overhead >> agg_shift);
+               return max_t(u32, duration, 4);
        }
 
        if (!conf)
index ac87030..2e400b0 100644 (file)
@@ -4861,6 +4861,7 @@ static int ieee80211_prep_channel(struct ieee80211_sub_if_data *sdata,
        struct ieee80211_supported_band *sband;
        struct cfg80211_chan_def chandef;
        bool is_6ghz = cbss->channel->band == NL80211_BAND_6GHZ;
+       bool is_5ghz = cbss->channel->band == NL80211_BAND_5GHZ;
        struct ieee80211_bss *bss = (void *)cbss->priv;
        int ret;
        u32 i;
@@ -4879,7 +4880,7 @@ static int ieee80211_prep_channel(struct ieee80211_sub_if_data *sdata,
                ifmgd->flags |= IEEE80211_STA_DISABLE_HE;
        }
 
-       if (!sband->vht_cap.vht_supported && !is_6ghz) {
+       if (!sband->vht_cap.vht_supported && is_5ghz) {
                ifmgd->flags |= IEEE80211_STA_DISABLE_VHT;
                ifmgd->flags |= IEEE80211_STA_DISABLE_HE;
        }
index 836cde5..a959ebf 100644 (file)
@@ -451,7 +451,8 @@ ieee80211_add_rx_radiotap_header(struct ieee80211_local *local,
        else if (status->bw == RATE_INFO_BW_5)
                channel_flags |= IEEE80211_CHAN_QUARTER;
 
-       if (status->band == NL80211_BAND_5GHZ)
+       if (status->band == NL80211_BAND_5GHZ ||
+           status->band == NL80211_BAND_6GHZ)
                channel_flags |= IEEE80211_CHAN_OFDM | IEEE80211_CHAN_5GHZ;
        else if (status->encoding != RX_ENC_LEGACY)
                channel_flags |= IEEE80211_CHAN_DYN | IEEE80211_CHAN_2GHZ;
index c8504ff..8d3bfc0 100644 (file)
@@ -3353,9 +3353,10 @@ bool ieee80211_chandef_he_6ghz_oper(struct ieee80211_sub_if_data *sdata,
                he_chandef.center_freq1 =
                        ieee80211_channel_to_frequency(he_6ghz_oper->ccfs0,
                                                       NL80211_BAND_6GHZ);
-               he_chandef.center_freq2 =
-                       ieee80211_channel_to_frequency(he_6ghz_oper->ccfs1,
-                                                      NL80211_BAND_6GHZ);
+               if (support_80_80 || support_160)
+                       he_chandef.center_freq2 =
+                               ieee80211_channel_to_frequency(he_6ghz_oper->ccfs1,
+                                                              NL80211_BAND_6GHZ);
        }
 
        if (!cfg80211_chandef_valid(&he_chandef)) {
index 9c6045f..d1b64d0 100644 (file)
@@ -168,10 +168,7 @@ ieee80211_vht_cap_ie_to_sta_vht_cap(struct ieee80211_sub_if_data *sdata,
        /* take some capabilities as-is */
        cap_info = le32_to_cpu(vht_cap_ie->vht_cap_info);
        vht_cap->cap = cap_info;
-       vht_cap->cap &= IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_3895 |
-                       IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_7991 |
-                       IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454 |
-                       IEEE80211_VHT_CAP_RXLDPC |
+       vht_cap->cap &= IEEE80211_VHT_CAP_RXLDPC |
                        IEEE80211_VHT_CAP_VHT_TXOP_PS |
                        IEEE80211_VHT_CAP_HTC_VHT |
                        IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK |
@@ -180,6 +177,9 @@ ieee80211_vht_cap_ie_to_sta_vht_cap(struct ieee80211_sub_if_data *sdata,
                        IEEE80211_VHT_CAP_RX_ANTENNA_PATTERN |
                        IEEE80211_VHT_CAP_TX_ANTENNA_PATTERN;
 
+       vht_cap->cap |= min_t(u32, cap_info & IEEE80211_VHT_CAP_MAX_MPDU_MASK,
+                             own_cap.cap & IEEE80211_VHT_CAP_MAX_MPDU_MASK);
+
        /* and some based on our own capabilities */
        switch (own_cap.cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK) {
        case IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ:
index ab52811..c829e4a 100644 (file)
@@ -34,11 +34,11 @@ void ieee802154_xmit_worker(struct work_struct *work)
        if (res)
                goto err_tx;
 
-       ieee802154_xmit_complete(&local->hw, skb, false);
-
        dev->stats.tx_packets++;
        dev->stats.tx_bytes += skb->len;
 
+       ieee802154_xmit_complete(&local->hw, skb, false);
+
        return;
 
 err_tx:
@@ -78,6 +78,8 @@ ieee802154_tx(struct ieee802154_local *local, struct sk_buff *skb)
 
        /* async is priority, otherwise sync is fallback */
        if (local->ops->xmit_async) {
+               unsigned int len = skb->len;
+
                ret = drv_xmit_async(local, skb);
                if (ret) {
                        ieee802154_wake_queue(&local->hw);
@@ -85,7 +87,7 @@ ieee802154_tx(struct ieee802154_local *local, struct sk_buff *skb)
                }
 
                dev->stats.tx_packets++;
-               dev->stats.tx_bytes += skb->len;
+               dev->stats.tx_bytes += len;
        } else {
                local->tx_skb = skb;
                queue_work(local->workqueue, &local->tx_work);
index c8820c4..770da36 100644 (file)
@@ -66,6 +66,16 @@ static bool addresses_equal(const struct mptcp_addr_info *a,
        return a->port == b->port;
 }
 
+static bool address_zero(const struct mptcp_addr_info *addr)
+{
+       struct mptcp_addr_info zero;
+
+       memset(&zero, 0, sizeof(zero));
+       zero.family = addr->family;
+
+       return addresses_equal(addr, &zero, false);
+}
+
 static void local_address(const struct sock_common *skc,
                          struct mptcp_addr_info *addr)
 {
@@ -171,9 +181,9 @@ static void check_work_pending(struct mptcp_sock *msk)
 
 static void mptcp_pm_create_subflow_or_signal_addr(struct mptcp_sock *msk)
 {
+       struct mptcp_addr_info remote = { 0 };
        struct sock *sk = (struct sock *)msk;
        struct mptcp_pm_addr_entry *local;
-       struct mptcp_addr_info remote;
        struct pm_nl_pernet *pernet;
 
        pernet = net_generic(sock_net((struct sock *)msk), pm_nl_pernet_id);
@@ -323,10 +333,13 @@ int mptcp_pm_nl_get_local_id(struct mptcp_sock *msk, struct sock_common *skc)
         * addr
         */
        local_address((struct sock_common *)msk, &msk_local);
-       local_address((struct sock_common *)msk, &skc_local);
+       local_address((struct sock_common *)skc, &skc_local);
        if (addresses_equal(&msk_local, &skc_local, false))
                return 0;
 
+       if (address_zero(&skc_local))
+               return 0;
+
        pernet = net_generic(sock_net((struct sock *)msk), pm_nl_pernet_id);
 
        rcu_read_lock();
@@ -341,7 +354,7 @@ int mptcp_pm_nl_get_local_id(struct mptcp_sock *msk, struct sock_common *skc)
                return ret;
 
        /* address not found, add to local list */
-       entry = kmalloc(sizeof(*entry), GFP_KERNEL);
+       entry = kmalloc(sizeof(*entry), GFP_ATOMIC);
        if (!entry)
                return -ENOMEM;
 
index e8cac26..9ead43f 100644 (file)
@@ -1063,6 +1063,7 @@ int __mptcp_subflow_connect(struct sock *sk, int ifindex,
        struct mptcp_sock *msk = mptcp_sk(sk);
        struct mptcp_subflow_context *subflow;
        struct sockaddr_storage addr;
+       int remote_id = remote->id;
        int local_id = loc->id;
        struct socket *sf;
        struct sock *ssk;
@@ -1107,10 +1108,11 @@ int __mptcp_subflow_connect(struct sock *sk, int ifindex,
                goto failed;
 
        mptcp_crypto_key_sha(subflow->remote_key, &remote_token, NULL);
-       pr_debug("msk=%p remote_token=%u local_id=%d", msk, remote_token,
-                local_id);
+       pr_debug("msk=%p remote_token=%u local_id=%d remote_id=%d", msk,
+                remote_token, local_id, remote_id);
        subflow->remote_token = remote_token;
        subflow->local_id = local_id;
+       subflow->remote_id = remote_id;
        subflow->request_join = 1;
        subflow->request_bkup = 1;
        mptcp_info2sockaddr(remote, &addr);
@@ -1347,6 +1349,7 @@ static void subflow_ulp_clone(const struct request_sock *req,
                new_ctx->fully_established = 1;
                new_ctx->backup = subflow_req->backup;
                new_ctx->local_id = subflow_req->local_id;
+               new_ctx->remote_id = subflow_req->remote_id;
                new_ctx->token = subflow_req->token;
                new_ctx->thmac = subflow_req->thmac;
        }
index 832eabe..c3a4214 100644 (file)
@@ -851,7 +851,6 @@ static int ctnetlink_done(struct netlink_callback *cb)
 }
 
 struct ctnetlink_filter {
-       u_int32_t cta_flags;
        u8 family;
 
        u_int32_t orig_flags;
@@ -906,10 +905,6 @@ static int ctnetlink_parse_tuple_filter(const struct nlattr * const cda[],
                                         struct nf_conntrack_zone *zone,
                                         u_int32_t flags);
 
-/* applied on filters */
-#define CTA_FILTER_F_CTA_MARK                  (1 << 0)
-#define CTA_FILTER_F_CTA_MARK_MASK             (1 << 1)
-
 static struct ctnetlink_filter *
 ctnetlink_alloc_filter(const struct nlattr * const cda[], u8 family)
 {
@@ -930,14 +925,10 @@ ctnetlink_alloc_filter(const struct nlattr * const cda[], u8 family)
 #ifdef CONFIG_NF_CONNTRACK_MARK
        if (cda[CTA_MARK]) {
                filter->mark.val = ntohl(nla_get_be32(cda[CTA_MARK]));
-               filter->cta_flags |= CTA_FILTER_FLAG(CTA_MARK);
-
-               if (cda[CTA_MARK_MASK]) {
+               if (cda[CTA_MARK_MASK])
                        filter->mark.mask = ntohl(nla_get_be32(cda[CTA_MARK_MASK]));
-                       filter->cta_flags |= CTA_FILTER_FLAG(CTA_MARK_MASK);
-               } else {
+               else
                        filter->mark.mask = 0xffffffff;
-               }
        } else if (cda[CTA_MARK_MASK]) {
                err = -EINVAL;
                goto err_filter;
@@ -1117,11 +1108,7 @@ static int ctnetlink_filter_match(struct nf_conn *ct, void *data)
        }
 
 #ifdef CONFIG_NF_CONNTRACK_MARK
-       if ((filter->cta_flags & CTA_FILTER_FLAG(CTA_MARK_MASK)) &&
-           (ct->mark & filter->mark.mask) != filter->mark.val)
-               goto ignore_entry;
-       else if ((filter->cta_flags & CTA_FILTER_FLAG(CTA_MARK)) &&
-                ct->mark != filter->mark.val)
+       if ((ct->mark & filter->mark.mask) != filter->mark.val)
                goto ignore_entry;
 #endif
 
@@ -1404,7 +1391,8 @@ ctnetlink_parse_tuple_filter(const struct nlattr * const cda[],
        if (err < 0)
                return err;
 
-
+       if (l3num != NFPROTO_IPV4 && l3num != NFPROTO_IPV6)
+               return -EOPNOTSUPP;
        tuple->src.l3num = l3num;
 
        if (flags & CTA_FILTER_FLAG(CTA_IP_DST) ||
index 95f7998..47e9319 100644 (file)
@@ -565,6 +565,7 @@ static int nf_ct_netns_inet_get(struct net *net)
        int err;
 
        err = nf_ct_netns_do_get(net, NFPROTO_IPV4);
+#if IS_ENABLED(CONFIG_IPV6)
        if (err < 0)
                goto err1;
        err = nf_ct_netns_do_get(net, NFPROTO_IPV6);
@@ -575,6 +576,7 @@ static int nf_ct_netns_inet_get(struct net *net)
 err2:
        nf_ct_netns_put(net, NFPROTO_IPV4);
 err1:
+#endif
        return err;
 }
 
index b7dc1cb..4603b66 100644 (file)
@@ -684,6 +684,18 @@ nla_put_failure:
        return -1;
 }
 
+struct nftnl_skb_parms {
+       bool report;
+};
+#define NFT_CB(skb)    (*(struct nftnl_skb_parms*)&((skb)->cb))
+
+static void nft_notify_enqueue(struct sk_buff *skb, bool report,
+                              struct list_head *notify_list)
+{
+       NFT_CB(skb).report = report;
+       list_add_tail(&skb->list, notify_list);
+}
+
 static void nf_tables_table_notify(const struct nft_ctx *ctx, int event)
 {
        struct sk_buff *skb;
@@ -715,8 +727,7 @@ static void nf_tables_table_notify(const struct nft_ctx *ctx, int event)
                goto err;
        }
 
-       nfnetlink_send(skb, ctx->net, ctx->portid, NFNLGRP_NFTABLES,
-                      ctx->report, GFP_KERNEL);
+       nft_notify_enqueue(skb, ctx->report, &ctx->net->nft.notify_list);
        return;
 err:
        nfnetlink_set_err(ctx->net, ctx->portid, NFNLGRP_NFTABLES, -ENOBUFS);
@@ -1468,8 +1479,7 @@ static void nf_tables_chain_notify(const struct nft_ctx *ctx, int event)
                goto err;
        }
 
-       nfnetlink_send(skb, ctx->net, ctx->portid, NFNLGRP_NFTABLES,
-                      ctx->report, GFP_KERNEL);
+       nft_notify_enqueue(skb, ctx->report, &ctx->net->nft.notify_list);
        return;
 err:
        nfnetlink_set_err(ctx->net, ctx->portid, NFNLGRP_NFTABLES, -ENOBUFS);
@@ -2807,8 +2817,7 @@ static void nf_tables_rule_notify(const struct nft_ctx *ctx,
                goto err;
        }
 
-       nfnetlink_send(skb, ctx->net, ctx->portid, NFNLGRP_NFTABLES,
-                      ctx->report, GFP_KERNEL);
+       nft_notify_enqueue(skb, ctx->report, &ctx->net->nft.notify_list);
        return;
 err:
        nfnetlink_set_err(ctx->net, ctx->portid, NFNLGRP_NFTABLES, -ENOBUFS);
@@ -3837,8 +3846,7 @@ static void nf_tables_set_notify(const struct nft_ctx *ctx,
                goto err;
        }
 
-       nfnetlink_send(skb, ctx->net, portid, NFNLGRP_NFTABLES, ctx->report,
-                      gfp_flags);
+       nft_notify_enqueue(skb, ctx->report, &ctx->net->nft.notify_list);
        return;
 err:
        nfnetlink_set_err(ctx->net, portid, NFNLGRP_NFTABLES, -ENOBUFS);
@@ -4959,8 +4967,7 @@ static void nf_tables_setelem_notify(const struct nft_ctx *ctx,
                goto err;
        }
 
-       nfnetlink_send(skb, net, portid, NFNLGRP_NFTABLES, ctx->report,
-                      GFP_KERNEL);
+       nft_notify_enqueue(skb, ctx->report, &ctx->net->nft.notify_list);
        return;
 err:
        nfnetlink_set_err(net, portid, NFNLGRP_NFTABLES, -ENOBUFS);
@@ -6275,7 +6282,7 @@ void nft_obj_notify(struct net *net, const struct nft_table *table,
                goto err;
        }
 
-       nfnetlink_send(skb, net, portid, NFNLGRP_NFTABLES, report, gfp);
+       nft_notify_enqueue(skb, report, &net->nft.notify_list);
        return;
 err:
        nfnetlink_set_err(net, portid, NFNLGRP_NFTABLES, -ENOBUFS);
@@ -7085,8 +7092,7 @@ static void nf_tables_flowtable_notify(struct nft_ctx *ctx,
                goto err;
        }
 
-       nfnetlink_send(skb, ctx->net, ctx->portid, NFNLGRP_NFTABLES,
-                      ctx->report, GFP_KERNEL);
+       nft_notify_enqueue(skb, ctx->report, &ctx->net->nft.notify_list);
        return;
 err:
        nfnetlink_set_err(ctx->net, ctx->portid, NFNLGRP_NFTABLES, -ENOBUFS);
@@ -7695,6 +7701,41 @@ static void nf_tables_commit_release(struct net *net)
        mutex_unlock(&net->nft.commit_mutex);
 }
 
+static void nft_commit_notify(struct net *net, u32 portid)
+{
+       struct sk_buff *batch_skb = NULL, *nskb, *skb;
+       unsigned char *data;
+       int len;
+
+       list_for_each_entry_safe(skb, nskb, &net->nft.notify_list, list) {
+               if (!batch_skb) {
+new_batch:
+                       batch_skb = skb;
+                       len = NLMSG_GOODSIZE - skb->len;
+                       list_del(&skb->list);
+                       continue;
+               }
+               len -= skb->len;
+               if (len > 0 && NFT_CB(skb).report == NFT_CB(batch_skb).report) {
+                       data = skb_put(batch_skb, skb->len);
+                       memcpy(data, skb->data, skb->len);
+                       list_del(&skb->list);
+                       kfree_skb(skb);
+                       continue;
+               }
+               nfnetlink_send(batch_skb, net, portid, NFNLGRP_NFTABLES,
+                              NFT_CB(batch_skb).report, GFP_KERNEL);
+               goto new_batch;
+       }
+
+       if (batch_skb) {
+               nfnetlink_send(batch_skb, net, portid, NFNLGRP_NFTABLES,
+                              NFT_CB(batch_skb).report, GFP_KERNEL);
+       }
+
+       WARN_ON_ONCE(!list_empty(&net->nft.notify_list));
+}
+
 static int nf_tables_commit(struct net *net, struct sk_buff *skb)
 {
        struct nft_trans *trans, *next;
@@ -7897,6 +7938,7 @@ static int nf_tables_commit(struct net *net, struct sk_buff *skb)
                }
        }
 
+       nft_commit_notify(net, NETLINK_CB(skb).portid);
        nf_tables_gen_notify(net, skb, NFT_MSG_NEWGEN);
        nf_tables_commit_release(net);
 
@@ -8721,6 +8763,7 @@ static int __net_init nf_tables_init_net(struct net *net)
        INIT_LIST_HEAD(&net->nft.tables);
        INIT_LIST_HEAD(&net->nft.commit_list);
        INIT_LIST_HEAD(&net->nft.module_list);
+       INIT_LIST_HEAD(&net->nft.notify_list);
        mutex_init(&net->nft.commit_mutex);
        net->nft.base_seq = 1;
        net->nft.validate_state = NFT_VALIDATE_SKIP;
@@ -8737,6 +8780,7 @@ static void __net_exit nf_tables_exit_net(struct net *net)
        mutex_unlock(&net->nft.commit_mutex);
        WARN_ON_ONCE(!list_empty(&net->nft.tables));
        WARN_ON_ONCE(!list_empty(&net->nft.module_list));
+       WARN_ON_ONCE(!list_empty(&net->nft.notify_list));
 }
 
 static struct pernet_operations nf_tables_net_ops = {
index 7bc6537..b37bd02 100644 (file)
@@ -147,11 +147,11 @@ nft_meta_get_eval_skugid(enum nft_meta_keys key,
 
        switch (key) {
        case NFT_META_SKUID:
-               *dest = from_kuid_munged(&init_user_ns,
+               *dest = from_kuid_munged(sock_net(sk)->user_ns,
                                         sock->file->f_cred->fsuid);
                break;
        case NFT_META_SKGID:
-               *dest = from_kgid_munged(&init_user_ns,
+               *dest = from_kgid_munged(sock_net(sk)->user_ns,
                                         sock->file->f_cred->fsgid);
                break;
        default:
index 90c558f..957aa92 100644 (file)
@@ -332,8 +332,7 @@ static int qrtr_node_enqueue(struct qrtr_node *node, struct sk_buff *skb,
 {
        struct qrtr_hdr_v1 *hdr;
        size_t len = skb->len;
-       int rc = -ENODEV;
-       int confirm_rx;
+       int rc, confirm_rx;
 
        confirm_rx = qrtr_tx_wait(node, to->sq_node, to->sq_port, type);
        if (confirm_rx < 0) {
@@ -357,15 +356,17 @@ static int qrtr_node_enqueue(struct qrtr_node *node, struct sk_buff *skb,
        hdr->size = cpu_to_le32(len);
        hdr->confirm_rx = !!confirm_rx;
 
-       skb_put_padto(skb, ALIGN(len, 4) + sizeof(*hdr));
-
-       mutex_lock(&node->ep_lock);
-       if (node->ep)
-               rc = node->ep->xmit(node->ep, skb);
-       else
-               kfree_skb(skb);
-       mutex_unlock(&node->ep_lock);
+       rc = skb_put_padto(skb, ALIGN(len, 4) + sizeof(*hdr));
 
+       if (!rc) {
+               mutex_lock(&node->ep_lock);
+               rc = -ENODEV;
+               if (node->ep)
+                       rc = node->ep->xmit(node->ep, skb);
+               else
+                       kfree_skb(skb);
+               mutex_unlock(&node->ep_lock);
+       }
        /* Need to ensure that a subsequent message carries the otherwise lost
         * confirm_rx flag if we dropped this one */
        if (rc && confirm_rx)
index c1fcd85..5c56875 100644 (file)
@@ -436,6 +436,25 @@ static void tcf_ife_cleanup(struct tc_action *a)
                kfree_rcu(p, rcu);
 }
 
+static int load_metalist(struct nlattr **tb, bool rtnl_held)
+{
+       int i;
+
+       for (i = 1; i < max_metacnt; i++) {
+               if (tb[i]) {
+                       void *val = nla_data(tb[i]);
+                       int len = nla_len(tb[i]);
+                       int rc;
+
+                       rc = load_metaops_and_vet(i, val, len, rtnl_held);
+                       if (rc != 0)
+                               return rc;
+               }
+       }
+
+       return 0;
+}
+
 static int populate_metalist(struct tcf_ife_info *ife, struct nlattr **tb,
                             bool exists, bool rtnl_held)
 {
@@ -449,10 +468,6 @@ static int populate_metalist(struct tcf_ife_info *ife, struct nlattr **tb,
                        val = nla_data(tb[i]);
                        len = nla_len(tb[i]);
 
-                       rc = load_metaops_and_vet(i, val, len, rtnl_held);
-                       if (rc != 0)
-                               return rc;
-
                        rc = add_metainfo(ife, i, val, len, exists);
                        if (rc)
                                return rc;
@@ -509,6 +524,21 @@ static int tcf_ife_init(struct net *net, struct nlattr *nla,
        if (!p)
                return -ENOMEM;
 
+       if (tb[TCA_IFE_METALST]) {
+               err = nla_parse_nested_deprecated(tb2, IFE_META_MAX,
+                                                 tb[TCA_IFE_METALST], NULL,
+                                                 NULL);
+               if (err) {
+                       kfree(p);
+                       return err;
+               }
+               err = load_metalist(tb2, rtnl_held);
+               if (err) {
+                       kfree(p);
+                       return err;
+               }
+       }
+
        index = parm->index;
        err = tcf_idr_check_alloc(tn, &index, a, bind);
        if (err < 0) {
@@ -570,15 +600,9 @@ static int tcf_ife_init(struct net *net, struct nlattr *nla,
        }
 
        if (tb[TCA_IFE_METALST]) {
-               err = nla_parse_nested_deprecated(tb2, IFE_META_MAX,
-                                                 tb[TCA_IFE_METALST], NULL,
-                                                 NULL);
-               if (err)
-                       goto metadata_parse_err;
                err = populate_metalist(ife, tb2, exists, rtnl_held);
                if (err)
                        goto metadata_parse_err;
-
        } else {
                /* if no passed metadata allow list or passed allow-all
                 * then here we process by adding as many supported metadatum
index 536c4bc..37f1e10 100644 (file)
@@ -156,6 +156,7 @@ tunnel_key_copy_vxlan_opt(const struct nlattr *nla, void *dst, int dst_len,
                struct vxlan_metadata *md = dst;
 
                md->gbp = nla_get_u32(tb[TCA_TUNNEL_KEY_ENC_OPT_VXLAN_GBP]);
+               md->gbp &= VXLAN_GBP_MASK;
        }
 
        return sizeof(struct vxlan_metadata);
index a4f7ef1..fed18fd 100644 (file)
@@ -1175,8 +1175,10 @@ static int fl_set_vxlan_opt(const struct nlattr *nla, struct fl_flow_key *key,
                return -EINVAL;
        }
 
-       if (tb[TCA_FLOWER_KEY_ENC_OPT_VXLAN_GBP])
+       if (tb[TCA_FLOWER_KEY_ENC_OPT_VXLAN_GBP]) {
                md->gbp = nla_get_u32(tb[TCA_FLOWER_KEY_ENC_OPT_VXLAN_GBP]);
+               md->gbp &= VXLAN_GBP_MASK;
+       }
 
        return sizeof(*md);
 }
@@ -1221,6 +1223,7 @@ static int fl_set_erspan_opt(const struct nlattr *nla, struct fl_flow_key *key,
                }
                if (tb[TCA_FLOWER_KEY_ENC_OPT_ERSPAN_INDEX]) {
                        nla = tb[TCA_FLOWER_KEY_ENC_OPT_ERSPAN_INDEX];
+                       memset(&md->u, 0x00, sizeof(md->u));
                        md->u.index = nla_get_be32(nla);
                }
        } else if (md->version == 2) {
index 265a61d..54c4172 100644 (file)
@@ -1131,24 +1131,10 @@ EXPORT_SYMBOL(dev_activate);
 
 static void qdisc_deactivate(struct Qdisc *qdisc)
 {
-       bool nolock = qdisc->flags & TCQ_F_NOLOCK;
-
        if (qdisc->flags & TCQ_F_BUILTIN)
                return;
-       if (test_bit(__QDISC_STATE_DEACTIVATED, &qdisc->state))
-               return;
-
-       if (nolock)
-               spin_lock_bh(&qdisc->seqlock);
-       spin_lock_bh(qdisc_lock(qdisc));
 
        set_bit(__QDISC_STATE_DEACTIVATED, &qdisc->state);
-
-       qdisc_reset(qdisc);
-
-       spin_unlock_bh(qdisc_lock(qdisc));
-       if (nolock)
-               spin_unlock_bh(&qdisc->seqlock);
 }
 
 static void dev_deactivate_queue(struct net_device *dev,
@@ -1165,6 +1151,30 @@ static void dev_deactivate_queue(struct net_device *dev,
        }
 }
 
+static void dev_reset_queue(struct net_device *dev,
+                           struct netdev_queue *dev_queue,
+                           void *_unused)
+{
+       struct Qdisc *qdisc;
+       bool nolock;
+
+       qdisc = dev_queue->qdisc_sleeping;
+       if (!qdisc)
+               return;
+
+       nolock = qdisc->flags & TCQ_F_NOLOCK;
+
+       if (nolock)
+               spin_lock_bh(&qdisc->seqlock);
+       spin_lock_bh(qdisc_lock(qdisc));
+
+       qdisc_reset(qdisc);
+
+       spin_unlock_bh(qdisc_lock(qdisc));
+       if (nolock)
+               spin_unlock_bh(&qdisc->seqlock);
+}
+
 static bool some_qdisc_is_busy(struct net_device *dev)
 {
        unsigned int i;
@@ -1213,12 +1223,20 @@ void dev_deactivate_many(struct list_head *head)
                dev_watchdog_down(dev);
        }
 
-       /* Wait for outstanding qdisc-less dev_queue_xmit calls.
+       /* Wait for outstanding qdisc-less dev_queue_xmit calls or
+        * outstanding qdisc enqueuing calls.
         * This is avoided if all devices are in dismantle phase :
         * Caller will call synchronize_net() for us
         */
        synchronize_net();
 
+       list_for_each_entry(dev, head, close_list) {
+               netdev_for_each_tx_queue(dev, dev_reset_queue, NULL);
+
+               if (dev_ingress_queue(dev))
+                       dev_reset_queue(dev, dev_ingress_queue(dev), NULL);
+       }
+
        /* Wait for outstanding qdisc_run calls. */
        list_for_each_entry(dev, head, close_list) {
                while (some_qdisc_is_busy(dev)) {
index fe53c1e..b0ad768 100644 (file)
@@ -777,9 +777,11 @@ static const struct nla_policy taprio_policy[TCA_TAPRIO_ATTR_MAX + 1] = {
        [TCA_TAPRIO_ATTR_TXTIME_DELAY]               = { .type = NLA_U32 },
 };
 
-static int fill_sched_entry(struct nlattr **tb, struct sched_entry *entry,
+static int fill_sched_entry(struct taprio_sched *q, struct nlattr **tb,
+                           struct sched_entry *entry,
                            struct netlink_ext_ack *extack)
 {
+       int min_duration = length_to_duration(q, ETH_ZLEN);
        u32 interval = 0;
 
        if (tb[TCA_TAPRIO_SCHED_ENTRY_CMD])
@@ -794,7 +796,10 @@ static int fill_sched_entry(struct nlattr **tb, struct sched_entry *entry,
                interval = nla_get_u32(
                        tb[TCA_TAPRIO_SCHED_ENTRY_INTERVAL]);
 
-       if (interval == 0) {
+       /* The interval should allow at least the minimum ethernet
+        * frame to go out.
+        */
+       if (interval < min_duration) {
                NL_SET_ERR_MSG(extack, "Invalid interval for schedule entry");
                return -EINVAL;
        }
@@ -804,8 +809,9 @@ static int fill_sched_entry(struct nlattr **tb, struct sched_entry *entry,
        return 0;
 }
 
-static int parse_sched_entry(struct nlattr *n, struct sched_entry *entry,
-                            int index, struct netlink_ext_ack *extack)
+static int parse_sched_entry(struct taprio_sched *q, struct nlattr *n,
+                            struct sched_entry *entry, int index,
+                            struct netlink_ext_ack *extack)
 {
        struct nlattr *tb[TCA_TAPRIO_SCHED_ENTRY_MAX + 1] = { };
        int err;
@@ -819,10 +825,10 @@ static int parse_sched_entry(struct nlattr *n, struct sched_entry *entry,
 
        entry->index = index;
 
-       return fill_sched_entry(tb, entry, extack);
+       return fill_sched_entry(q, tb, entry, extack);
 }
 
-static int parse_sched_list(struct nlattr *list,
+static int parse_sched_list(struct taprio_sched *q, struct nlattr *list,
                            struct sched_gate_list *sched,
                            struct netlink_ext_ack *extack)
 {
@@ -847,7 +853,7 @@ static int parse_sched_list(struct nlattr *list,
                        return -ENOMEM;
                }
 
-               err = parse_sched_entry(n, entry, i, extack);
+               err = parse_sched_entry(q, n, entry, i, extack);
                if (err < 0) {
                        kfree(entry);
                        return err;
@@ -862,7 +868,7 @@ static int parse_sched_list(struct nlattr *list,
        return i;
 }
 
-static int parse_taprio_schedule(struct nlattr **tb,
+static int parse_taprio_schedule(struct taprio_sched *q, struct nlattr **tb,
                                 struct sched_gate_list *new,
                                 struct netlink_ext_ack *extack)
 {
@@ -883,8 +889,8 @@ static int parse_taprio_schedule(struct nlattr **tb,
                new->cycle_time = nla_get_s64(tb[TCA_TAPRIO_ATTR_SCHED_CYCLE_TIME]);
 
        if (tb[TCA_TAPRIO_ATTR_SCHED_ENTRY_LIST])
-               err = parse_sched_list(
-                       tb[TCA_TAPRIO_ATTR_SCHED_ENTRY_LIST], new, extack);
+               err = parse_sched_list(q, tb[TCA_TAPRIO_ATTR_SCHED_ENTRY_LIST],
+                                      new, extack);
        if (err < 0)
                return err;
 
@@ -1473,7 +1479,7 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt,
                goto free_sched;
        }
 
-       err = parse_taprio_schedule(tb, new_admin, extack);
+       err = parse_taprio_schedule(q, tb, new_admin, extack);
        if (err < 0)
                goto free_sched;
 
index 836615f..53d0a41 100644 (file)
@@ -9220,13 +9220,10 @@ void sctp_copy_sock(struct sock *newsk, struct sock *sk,
 static inline void sctp_copy_descendant(struct sock *sk_to,
                                        const struct sock *sk_from)
 {
-       int ancestor_size = sizeof(struct inet_sock) +
-                           sizeof(struct sctp_sock) -
-                           offsetof(struct sctp_sock, pd_lobby);
-
-       if (sk_from->sk_family == PF_INET6)
-               ancestor_size += sizeof(struct ipv6_pinfo);
+       size_t ancestor_size = sizeof(struct inet_sock);
 
+       ancestor_size += sk_from->sk_prot->obj_size;
+       ancestor_size -= offsetof(struct sctp_sock, pd_lobby);
        __inet_sk_copy_descendant(sk_to, sk_from, ancestor_size);
 }
 
index d5805fa..c2752e2 100644 (file)
@@ -228,7 +228,7 @@ static int svc_one_sock_name(struct svc_sock *svsk, char *buf, int remaining)
 static void svc_flush_bvec(const struct bio_vec *bvec, size_t size, size_t seek)
 {
        struct bvec_iter bi = {
-               .bi_size        = size,
+               .bi_size        = size + seek,
        };
        struct bio_vec bv;
 
index 588c2d2..b1fcd2a 100644 (file)
@@ -273,8 +273,8 @@ static struct tipc_member *tipc_group_find_node(struct tipc_group *grp,
        return NULL;
 }
 
-static void tipc_group_add_to_tree(struct tipc_group *grp,
-                                  struct tipc_member *m)
+static int tipc_group_add_to_tree(struct tipc_group *grp,
+                                 struct tipc_member *m)
 {
        u64 nkey, key = (u64)m->node << 32 | m->port;
        struct rb_node **n, *parent = NULL;
@@ -291,10 +291,11 @@ static void tipc_group_add_to_tree(struct tipc_group *grp,
                else if (key > nkey)
                        n = &(*n)->rb_right;
                else
-                       return;
+                       return -EEXIST;
        }
        rb_link_node(&m->tree_node, parent, n);
        rb_insert_color(&m->tree_node, &grp->members);
+       return 0;
 }
 
 static struct tipc_member *tipc_group_create_member(struct tipc_group *grp,
@@ -302,6 +303,7 @@ static struct tipc_member *tipc_group_create_member(struct tipc_group *grp,
                                                    u32 instance, int state)
 {
        struct tipc_member *m;
+       int ret;
 
        m = kzalloc(sizeof(*m), GFP_ATOMIC);
        if (!m)
@@ -314,8 +316,12 @@ static struct tipc_member *tipc_group_create_member(struct tipc_group *grp,
        m->port = port;
        m->instance = instance;
        m->bc_acked = grp->bc_snd_nxt - 1;
+       ret = tipc_group_add_to_tree(grp, m);
+       if (ret < 0) {
+               kfree(m);
+               return NULL;
+       }
        grp->member_cnt++;
-       tipc_group_add_to_tree(grp, m);
        tipc_nlist_add(&grp->dests, m->node);
        m->state = state;
        return m;
index b736255..cef38a9 100644 (file)
@@ -532,7 +532,8 @@ bool tipc_link_create(struct net *net, char *if_name, int bearer_id,
  * tipc_link_bc_create - create new link to be used for broadcast
  * @net: pointer to associated network namespace
  * @mtu: mtu to be used initially if no peers
- * @window: send window to be used
+ * @min_win: minimal send window to be used by link
+ * @max_win: maximal send window to be used by link
  * @inputq: queue to put messages ready for delivery
  * @namedq: queue to put binding table update messages ready for delivery
  * @link: return value, pointer to put the created link
index 848fae6..52e93ba 100644 (file)
@@ -150,7 +150,8 @@ int tipc_buf_append(struct sk_buff **headbuf, struct sk_buff **buf)
        if (fragid == FIRST_FRAGMENT) {
                if (unlikely(head))
                        goto err;
-               if (unlikely(skb_unclone(frag, GFP_ATOMIC)))
+               frag = skb_unshare(frag, GFP_ATOMIC);
+               if (unlikely(!frag))
                        goto err;
                head = *headbuf = frag;
                *buf = NULL;
index ebd280e..11b27dd 100644 (file)
@@ -2771,10 +2771,7 @@ static int tipc_shutdown(struct socket *sock, int how)
 
        trace_tipc_sk_shutdown(sk, NULL, TIPC_DUMP_ALL, " ");
        __tipc_shutdown(sock, TIPC_CONN_SHUTDOWN);
-       if (tipc_sk_type_connectionless(sk))
-               sk->sk_shutdown = SHUTDOWN_MASK;
-       else
-               sk->sk_shutdown = SEND_SHUTDOWN;
+       sk->sk_shutdown = SHUTDOWN_MASK;
 
        if (sk->sk_state == TIPC_DISCONNECTING) {
                /* Discard any unreceived messages */
index faf7485..27026f5 100644 (file)
@@ -217,6 +217,7 @@ config LIB80211_CRYPT_WEP
 
 config LIB80211_CRYPT_CCMP
        tristate
+       select CRYPTO
        select CRYPTO_AES
        select CRYPTO_CCM
 
index 4a9ff9e..6fa99df 100644 (file)
@@ -95,7 +95,7 @@ u32 ieee80211_channel_to_freq_khz(int chan, enum nl80211_band band)
                /* see 802.11ax D6.1 27.3.23.2 */
                if (chan == 2)
                        return MHZ_TO_KHZ(5935);
-               if (chan <= 253)
+               if (chan <= 233)
                        return MHZ_TO_KHZ(5950 + chan * 5);
                break;
        case NL80211_BAND_60GHZ:
index e97db37..b010bfd 100644 (file)
@@ -303,10 +303,10 @@ static int xdp_umem_account_pages(struct xdp_umem *umem)
 
 static int xdp_umem_reg(struct xdp_umem *umem, struct xdp_umem_reg *mr)
 {
+       u32 npgs_rem, chunk_size = mr->chunk_size, headroom = mr->headroom;
        bool unaligned_chunks = mr->flags & XDP_UMEM_UNALIGNED_CHUNK_FLAG;
-       u32 chunk_size = mr->chunk_size, headroom = mr->headroom;
        u64 npgs, addr = mr->addr, size = mr->len;
-       unsigned int chunks, chunks_per_page;
+       unsigned int chunks, chunks_rem;
        int err;
 
        if (chunk_size < XDP_UMEM_MIN_CHUNK_SIZE || chunk_size > PAGE_SIZE) {
@@ -336,19 +336,18 @@ static int xdp_umem_reg(struct xdp_umem *umem, struct xdp_umem_reg *mr)
        if ((addr + size) < addr)
                return -EINVAL;
 
-       npgs = size >> PAGE_SHIFT;
+       npgs = div_u64_rem(size, PAGE_SIZE, &npgs_rem);
+       if (npgs_rem)
+               npgs++;
        if (npgs > U32_MAX)
                return -EINVAL;
 
-       chunks = (unsigned int)div_u64(size, chunk_size);
+       chunks = (unsigned int)div_u64_rem(size, chunk_size, &chunks_rem);
        if (chunks == 0)
                return -EINVAL;
 
-       if (!unaligned_chunks) {
-               chunks_per_page = PAGE_SIZE / chunk_size;
-               if (chunks < chunks_per_page || chunks % chunks_per_page)
-                       return -EINVAL;
-       }
+       if (!unaligned_chunks && chunks_rem)
+               return -EINVAL;
 
        if (headroom >= chunk_size - XDP_PACKET_HEADROOM)
                return -EINVAL;
index a698ece..4852bf4 100644 (file)
@@ -9,7 +9,7 @@ dtc-objs        := dtc.o flattree.o fstree.o data.o livetree.o treesource.o \
 dtc-objs       += dtc-lexer.lex.o dtc-parser.tab.o
 
 # Source files need to get at the userspace version of libfdt_env.h to compile
-HOST_EXTRACFLAGS := -I $(srctree)/$(src)/libfdt
+HOST_EXTRACFLAGS += -I $(srctree)/$(src)/libfdt
 
 ifeq ($(shell pkg-config --exists yaml-0.1 2>/dev/null && echo yes),)
 ifneq ($(CHECK_DT_BINDING)$(CHECK_DTBS),)
index 0096cd9..7ecd2cc 100644 (file)
@@ -82,6 +82,7 @@ static char *sym_name(const struct sym_entry *s)
 
 static bool is_ignored_symbol(const char *name, char type)
 {
+       /* Symbol names that exactly match to the following are ignored.*/
        static const char * const ignored_symbols[] = {
                /*
                 * Symbols which vary between passes. Passes 1 and 2 must have
@@ -104,6 +105,7 @@ static bool is_ignored_symbol(const char *name, char type)
                NULL
        };
 
+       /* Symbol names that begin with the following are ignored.*/
        static const char * const ignored_prefixes[] = {
                "$",                    /* local symbols for ARM, MIPS, etc. */
                ".LASANPC",             /* s390 kasan local symbols */
@@ -113,6 +115,7 @@ static bool is_ignored_symbol(const char *name, char type)
                NULL
        };
 
+       /* Symbol names that end with the following are ignored.*/
        static const char * const ignored_suffixes[] = {
                "_from_arm",            /* arm */
                "_from_thumb",          /* arm */
@@ -120,9 +123,15 @@ static bool is_ignored_symbol(const char *name, char type)
                NULL
        };
 
+       /* Symbol names that contain the following are ignored.*/
+       static const char * const ignored_matches[] = {
+               ".long_branch.",        /* ppc stub */
+               ".plt_branch.",         /* ppc stub */
+               NULL
+       };
+
        const char * const *p;
 
-       /* Exclude symbols which vary between passes. */
        for (p = ignored_symbols; *p; p++)
                if (!strcmp(name, *p))
                        return true;
@@ -138,6 +147,11 @@ static bool is_ignored_symbol(const char *name, char type)
                        return true;
        }
 
+       for (p = ignored_matches; *p; p++) {
+               if (strstr(name, *p))
+                       return true;
+       }
+
        if (type == 'U' || type == 'u')
                return true;
        /* exclude debugging symbols */
index f253681..feb2efa 100644 (file)
@@ -589,7 +589,7 @@ explictly||explicitly
 expresion||expression
 exprimental||experimental
 extened||extended
-exteneded||extended||extended
+exteneded||extended
 extensability||extensibility
 extention||extension
 extenstion||extension
index 496dcde..9790f51 100644 (file)
@@ -343,7 +343,7 @@ int asihpi_adapter_probe(struct pci_dev *pci_dev,
        struct hpi_message hm;
        struct hpi_response hr;
        struct hpi_adapter adapter;
-       struct hpi_pci pci;
+       struct hpi_pci pci = { 0 };
 
        memset(&adapter, 0, sizeof(adapter));
 
@@ -499,7 +499,7 @@ int asihpi_adapter_probe(struct pci_dev *pci_dev,
        return 0;
 
 err:
-       for (idx = 0; idx < HPI_MAX_ADAPTER_MEM_SPACES; idx++) {
+       while (--idx >= 0) {
                if (pci.ap_mem_base[idx]) {
                        iounmap(pci.ap_mem_base[idx]);
                        pci.ap_mem_base[idx] = NULL;
index 85e2071..d4f17b4 100644 (file)
@@ -2475,7 +2475,6 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = {
        SND_PCI_QUIRK(0x1462, 0x1276, "MSI-GL73", ALC1220_FIXUP_CLEVO_P950),
        SND_PCI_QUIRK(0x1462, 0x1293, "MSI-GP65", ALC1220_FIXUP_CLEVO_P950),
        SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
-       SND_PCI_QUIRK(0x1462, 0x9c37, "MSI X570-A PRO", ALC1220_FIXUP_CLEVO_P950),
        SND_PCI_QUIRK(0x1462, 0xda57, "MSI Z270-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
        SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
        SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
@@ -3428,7 +3427,11 @@ static void alc256_shutup(struct hda_codec *codec)
 
        /* 3k pull low control for Headset jack. */
        /* NOTE: call this before clearing the pin, otherwise codec stalls */
-       alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
+       /* If disable 3k pulldown control for alc257, the Mic detection will not work correctly
+        * when booting with headset plugged. So skip setting it for the codec alc257
+        */
+       if (codec->core.vendor_id != 0x10ec0257)
+               alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
 
        if (!spec->no_shutup_pins)
                snd_hda_codec_write(codec, hp_pin, 0,
@@ -6051,6 +6054,7 @@ static void alc_fixup_thinkpad_acpi(struct hda_codec *codec,
 #include "hp_x360_helper.c"
 
 enum {
+       ALC269_FIXUP_GPIO2,
        ALC269_FIXUP_SONY_VAIO,
        ALC275_FIXUP_SONY_VAIO_GPIO2,
        ALC269_FIXUP_DELL_M101Z,
@@ -6232,6 +6236,10 @@ enum {
 };
 
 static const struct hda_fixup alc269_fixups[] = {
+       [ALC269_FIXUP_GPIO2] = {
+               .type = HDA_FIXUP_FUNC,
+               .v.func = alc_fixup_gpio2,
+       },
        [ALC269_FIXUP_SONY_VAIO] = {
                .type = HDA_FIXUP_PINCTLS,
                .v.pins = (const struct hda_pintbl[]) {
@@ -7051,6 +7059,8 @@ static const struct hda_fixup alc269_fixups[] = {
        [ALC233_FIXUP_LENOVO_MULTI_CODECS] = {
                .type = HDA_FIXUP_FUNC,
                .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
+               .chained = true,
+               .chain_id = ALC269_FIXUP_GPIO2
        },
        [ALC233_FIXUP_ACER_HEADSET_MIC] = {
                .type = HDA_FIXUP_VERBS,
index 5b43e9e..c369c81 100644 (file)
@@ -371,7 +371,6 @@ static const struct usbmix_name_map asus_rog_map[] = {
 };
 
 static const struct usbmix_name_map lenovo_p620_rear_map[] = {
-       { 19, NULL, 2 }, /* FU, Volume */
        { 19, NULL, 12 }, /* FU, Input Gain Pad */
        {}
 };
index 75bbdc6..892296d 100644 (file)
@@ -1678,12 +1678,13 @@ void snd_usb_ctl_msg_quirk(struct usb_device *dev, unsigned int pipe,
            && (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS)
                msleep(20);
 
-       /* Zoom R16/24, Logitech H650e, Jabra 550a, Kingston HyperX needs a tiny
-        * delay here, otherwise requests like get/set frequency return as
-        * failed despite actually succeeding.
+       /* Zoom R16/24, Logitech H650e/H570e, Jabra 550a, Kingston HyperX
+        *  needs a tiny delay here, otherwise requests like get/set
+        *  frequency return as failed despite actually succeeding.
         */
        if ((chip->usb_id == USB_ID(0x1686, 0x00dd) ||
             chip->usb_id == USB_ID(0x046d, 0x0a46) ||
+            chip->usb_id == USB_ID(0x046d, 0x0a56) ||
             chip->usb_id == USB_ID(0x0b0e, 0x0349) ||
             chip->usb_id == USB_ID(0x0951, 0x16ad)) &&
            (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS)
index 56284b9..d295e40 100755 (executable)
@@ -137,6 +137,31 @@ $BOOTCONF $INITRD > $TEMPCONF
 cat $TEMPCONF
 xpass grep \'\"string\"\' $TEMPCONF
 
+echo "Repeat same-key tree"
+cat > $TEMPCONF << EOF
+foo
+bar
+foo { buz }
+EOF
+echo > $INITRD
+
+xpass $BOOTCONF -a $TEMPCONF $INITRD
+$BOOTCONF $INITRD > $OUTFILE
+xpass grep -q "bar" $OUTFILE
+
+
+echo "Remove/keep tailing spaces"
+cat > $TEMPCONF << EOF
+foo = val     # comment
+bar = "val2 " # comment
+EOF
+echo > $INITRD
+
+xpass $BOOTCONF -a $TEMPCONF $INITRD
+$BOOTCONF $INITRD > $OUTFILE
+xfail grep -q val[[:space:]] $OUTFILE
+xpass grep -q val2[[:space:]] $OUTFILE
+
 echo "=== expected failure cases ==="
 for i in samples/bad-* ; do
   xfail $BOOTCONF -a $i $INITRD
index 0a6d09a..39bb322 100644 (file)
@@ -38,7 +38,7 @@ FEATURE_TESTS = libbfd disassembler-four-args
 FEATURE_DISPLAY = libbfd disassembler-four-args
 
 check_feat := 1
-NON_CHECK_FEAT_TARGETS := clean bpftool_clean runqslower_clean
+NON_CHECK_FEAT_TARGETS := clean bpftool_clean runqslower_clean resolve_btfids_clean
 ifdef MAKECMDGOALS
 ifeq ($(filter-out $(NON_CHECK_FEAT_TARGETS),$(MAKECMDGOALS)),)
   check_feat := 0
@@ -89,7 +89,7 @@ $(OUTPUT)bpf_exp.lex.c: $(OUTPUT)bpf_exp.yacc.c
 $(OUTPUT)bpf_exp.yacc.o: $(OUTPUT)bpf_exp.yacc.c
 $(OUTPUT)bpf_exp.lex.o: $(OUTPUT)bpf_exp.lex.c
 
-clean: bpftool_clean runqslower_clean
+clean: bpftool_clean runqslower_clean resolve_btfids_clean
        $(call QUIET_CLEAN, bpf-progs)
        $(Q)$(RM) -r -- $(OUTPUT)*.o $(OUTPUT)bpf_jit_disasm $(OUTPUT)bpf_dbg \
               $(OUTPUT)bpf_asm $(OUTPUT)bpf_exp.yacc.* $(OUTPUT)bpf_exp.lex.*
index a88cd44..fe8eb53 100644 (file)
@@ -80,6 +80,7 @@ libbpf-clean:
 clean: libsubcmd-clean libbpf-clean fixdep-clean
        $(call msg,CLEAN,$(BINARY))
        $(Q)$(RM) -f $(BINARY); \
+       $(RM) -rf $(if $(OUTPUT),$(OUTPUT),.)/feature; \
        find $(if $(OUTPUT),$(OUTPUT),.) -name \*.o -or -name \*.o.cmd -or -name \*.o.d | xargs $(RM)
 
 tags:
index 0f25713..7703f01 100644 (file)
@@ -130,7 +130,7 @@ static int io_uring_register_files(struct submitter *s)
                                        s->nr_files);
 }
 
-static int gettid(void)
+static int lk_gettid(void)
 {
        return syscall(__NR_gettid);
 }
@@ -281,7 +281,7 @@ static void *submitter_fn(void *data)
        struct io_sq_ring *ring = &s->sq_ring;
        int ret, prepped;
 
-       printf("submitter=%d\n", gettid());
+       printf("submitter=%d\n", lk_gettid());
 
        srand48_r(pthread_self(), &s->rand);
 
index bf8ed13..9ae8f4e 100644 (file)
@@ -59,7 +59,7 @@ FEATURE_USER = .libbpf
 FEATURE_TESTS = libelf libelf-mmap zlib bpf reallocarray
 FEATURE_DISPLAY = libelf zlib bpf
 
-INCLUDES = -I. -I$(srctree)/tools/include -I$(srctree)/tools/arch/$(ARCH)/include/uapi -I$(srctree)/tools/include/uapi
+INCLUDES = -I. -I$(srctree)/tools/include -I$(srctree)/tools/include/uapi
 FEATURE_CHECK_CFLAGS-bpf = $(INCLUDES)
 
 check_feat := 1
@@ -152,6 +152,7 @@ GLOBAL_SYM_COUNT = $(shell readelf -s --wide $(BPF_IN_SHARED) | \
                           awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}' | \
                           sort -u | wc -l)
 VERSIONED_SYM_COUNT = $(shell readelf --dyn-syms --wide $(OUTPUT)libbpf.so | \
+                             awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}' | \
                              grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 | sort -u | wc -l)
 
 CMD_TARGETS = $(LIB_TARGET) $(PC_FILE)
@@ -219,6 +220,7 @@ check_abi: $(OUTPUT)libbpf.so
                    awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}'|  \
                    sort -u > $(OUTPUT)libbpf_global_syms.tmp;           \
                readelf --dyn-syms --wide $(OUTPUT)libbpf.so |           \
+                   awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}'|  \
                    grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 |             \
                    sort -u > $(OUTPUT)libbpf_versioned_syms.tmp;        \
                diff -u $(OUTPUT)libbpf_global_syms.tmp                  \
index 0ad0b04..7253b83 100644 (file)
@@ -5203,8 +5203,8 @@ static int bpf_object__collect_map_relos(struct bpf_object *obj,
        int i, j, nrels, new_sz;
        const struct btf_var_secinfo *vi = NULL;
        const struct btf_type *sec, *var, *def;
+       struct bpf_map *map = NULL, *targ_map;
        const struct btf_member *member;
-       struct bpf_map *map, *targ_map;
        const char *name, *mname;
        Elf_Data *symbols;
        unsigned int moff;
index 07ddbfd..6dfce3f 100644 (file)
@@ -47,7 +47,10 @@ int dump_bpf_hash_map(struct bpf_iter__bpf_map_elem *ctx)
        __u32 seq_num = ctx->meta->seq_num;
        struct bpf_map *map = ctx->map;
        struct key_t *key = ctx->key;
+       struct key_t tmp_key;
        __u64 *val = ctx->value;
+       __u64 tmp_val = 0;
+       int ret;
 
        if (in_test_mode) {
                /* test mode is used by selftests to
@@ -61,6 +64,18 @@ int dump_bpf_hash_map(struct bpf_iter__bpf_map_elem *ctx)
                if (key == (void *)0 || val == (void *)0)
                        return 0;
 
+               /* update the value and then delete the <key, value> pair.
+                * it should not impact the existing 'val' which is still
+                * accessible under rcu.
+                */
+               __builtin_memcpy(&tmp_key, key, sizeof(struct key_t));
+               ret = bpf_map_update_elem(&hashmap1, &tmp_key, &tmp_val, 0);
+               if (ret)
+                       return 0;
+               ret = bpf_map_delete_elem(&hashmap1, &tmp_key);
+               if (ret)
+                       return 0;
+
                key_sum_a += key->a;
                key_sum_b += key->b;
                key_sum_c += key->c;
index b8d14f9..2fc6b3a 100644 (file)
@@ -73,7 +73,7 @@ int main(void)
        int i;
        /* Instruction lengths starting at ss_start */
        int ss_size[4] = {
-               3,              /* xor */
+               2,              /* xor */
                2,              /* cpuid */
                5,              /* mov */
                2,              /* rdmsr */
index 7c38a90..8a2fe6d 100755 (executable)
@@ -1175,6 +1175,51 @@ kci_test_neigh_get()
        echo "PASS: neigh get"
 }
 
+kci_test_bridge_parent_id()
+{
+       local ret=0
+       sysfsnet=/sys/bus/netdevsim/devices/netdevsim
+       probed=false
+
+       if [ ! -w /sys/bus/netdevsim/new_device ] ; then
+               modprobe -q netdevsim
+               check_err $?
+               if [ $ret -ne 0 ]; then
+                       echo "SKIP: bridge_parent_id can't load netdevsim"
+                       return $ksft_skip
+               fi
+               probed=true
+       fi
+
+       echo "10 1" > /sys/bus/netdevsim/new_device
+       while [ ! -d ${sysfsnet}10 ] ; do :; done
+       echo "20 1" > /sys/bus/netdevsim/new_device
+       while [ ! -d ${sysfsnet}20 ] ; do :; done
+       udevadm settle
+       dev10=`ls ${sysfsnet}10/net/`
+       dev20=`ls ${sysfsnet}20/net/`
+
+       ip link add name test-bond0 type bond mode 802.3ad
+       ip link set dev $dev10 master test-bond0
+       ip link set dev $dev20 master test-bond0
+       ip link add name test-br0 type bridge
+       ip link set dev test-bond0 master test-br0
+       check_err $?
+
+       # clean up any leftovers
+       ip link del dev test-br0
+       ip link del dev test-bond0
+       echo 20 > /sys/bus/netdevsim/del_device
+       echo 10 > /sys/bus/netdevsim/del_device
+       $probed && rmmod netdevsim
+
+       if [ $ret -ne 0 ]; then
+               echo "FAIL: bridge_parent_id"
+               return 1
+       fi
+       echo "PASS: bridge_parent_id"
+}
+
 kci_test_rtnl()
 {
        local ret=0
@@ -1224,6 +1269,8 @@ kci_test_rtnl()
        check_err $?
        kci_test_neigh_get
        check_err $?
+       kci_test_bridge_parent_id
+       check_err $?
 
        kci_del_dummy
        return $ret