]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
Merge tag 'landlock-6.0-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/mic...
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 23 Sep 2022 15:59:16 +0000 (08:59 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 23 Sep 2022 15:59:16 +0000 (08:59 -0700)
Pull landlock fix from Mickaël Salaün:
 "Fix out-of-tree builds for Landlock tests"

* tag 'landlock-6.0-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/mic/linux:
  selftests/landlock: Fix out-of-tree builds

355 files changed:
.mailmap
Documentation/devicetree/bindings/arm/amlogic/amlogic,meson-gx-ao-secure.yaml
Documentation/devicetree/bindings/display/amlogic,meson-dw-hdmi.yaml
Documentation/devicetree/bindings/display/amlogic,meson-vpu.yaml
Documentation/devicetree/bindings/display/bridge/analogix,anx7814.yaml
Documentation/devicetree/bindings/display/bridge/ite,it66121.yaml
Documentation/devicetree/bindings/display/panel/sgd,gktw70sdae4se.yaml
Documentation/devicetree/bindings/dma/moxa,moxart-dma.txt
Documentation/devicetree/bindings/i2c/amlogic,meson6-i2c.yaml
Documentation/devicetree/bindings/interconnect/fsl,imx8m-noc.yaml
Documentation/devicetree/bindings/interrupt-controller/apple,aic.yaml
Documentation/devicetree/bindings/mailbox/amlogic,meson-gxbb-mhu.yaml
Documentation/devicetree/bindings/media/amlogic,axg-ge2d.yaml
Documentation/devicetree/bindings/media/amlogic,gx-vdec.yaml
Documentation/devicetree/bindings/media/amlogic,meson-gx-ao-cec.yaml
Documentation/devicetree/bindings/memory-controllers/fsl/imx8m-ddrc.yaml
Documentation/devicetree/bindings/mfd/khadas,mcu.yaml
Documentation/devicetree/bindings/net/amlogic,meson-dwmac.yaml
Documentation/devicetree/bindings/phy/amlogic,axg-mipi-dphy.yaml
Documentation/devicetree/bindings/phy/amlogic,meson-g12a-usb2-phy.yaml
Documentation/devicetree/bindings/phy/amlogic,meson-g12a-usb3-pcie-phy.yaml
Documentation/devicetree/bindings/pinctrl/qcom,sc7280-lpass-lpi-pinctrl.yaml
Documentation/devicetree/bindings/pinctrl/qcom,sc7280-pinctrl.yaml
Documentation/devicetree/bindings/power/amlogic,meson-ee-pwrc.yaml
Documentation/devicetree/bindings/power/qcom,rpmpd.yaml
Documentation/devicetree/bindings/reset/amlogic,meson-reset.yaml
Documentation/devicetree/bindings/rng/amlogic,meson-rng.yaml
Documentation/devicetree/bindings/serial/amlogic,meson-uart.yaml
Documentation/devicetree/bindings/soc/amlogic/amlogic,canvas.yaml
Documentation/devicetree/bindings/spi/amlogic,meson-gx-spicc.yaml
Documentation/devicetree/bindings/spi/amlogic,meson6-spifc.yaml
Documentation/devicetree/bindings/usb/amlogic,meson-g12a-usb-ctrl.yaml
Documentation/devicetree/bindings/watchdog/amlogic,meson-gxbb-wdt.yaml
Documentation/networking/mptcp-sysctl.rst
Documentation/networking/nf_conntrack-sysctl.rst
MAINTAINERS
Makefile
arch/arm/boot/dts/lan966x.dtsi
arch/arm/boot/dts/moxart-uc7112lx.dts
arch/arm/boot/dts/moxart.dtsi
arch/arm64/boot/dts/freescale/imx8mm-mx8menlo.dts
arch/arm64/boot/dts/freescale/imx8mm-tqma8mqml-mba8mx.dts
arch/arm64/boot/dts/freescale/imx8mm-tqma8mqml.dtsi
arch/arm64/boot/dts/freescale/imx8mm-verdin.dtsi
arch/arm64/boot/dts/freescale/imx8mn.dtsi
arch/arm64/boot/dts/freescale/imx8mp-tqma8mpql-mba8mpxl.dts
arch/arm64/boot/dts/freescale/imx8mp-venice-gw74xx.dts
arch/arm64/boot/dts/freescale/imx8ulp.dtsi
arch/arm64/boot/dts/rockchip/px30-engicam-px30-core.dtsi
arch/arm64/boot/dts/rockchip/rk3399-gru-bob.dts
arch/arm64/boot/dts/rockchip/rk3399-gru-chromebook.dtsi
arch/arm64/boot/dts/rockchip/rk3399-puma.dtsi
arch/arm64/boot/dts/rockchip/rk3566-quartz64-a.dts
arch/arm64/boot/dts/rockchip/rk3566-quartz64-b.dts
arch/arm64/boot/dts/rockchip/rk3568-bpi-r2-pro.dts
arch/arm64/boot/dts/rockchip/rk3568-evb1-v10.dts
arch/arm64/boot/dts/rockchip/rk3568-rock-3a.dts
arch/arm64/configs/defconfig
arch/arm64/kvm/arm.c
arch/mips/lantiq/clk.c
arch/mips/loongson32/common/platform.c
arch/parisc/Kconfig
arch/riscv/Kconfig
arch/riscv/Kconfig.erratas
arch/riscv/errata/thead/errata.c
arch/riscv/include/asm/cacheflush.h
arch/riscv/kernel/setup.c
arch/riscv/kernel/signal.c
arch/riscv/mm/dma-noncoherent.c
arch/s390/kvm/gaccess.c
arch/s390/kvm/interrupt.c
arch/s390/kvm/kvm-s390.c
arch/s390/kvm/pci.c
arch/s390/kvm/pci.h
arch/um/Makefile
arch/um/kernel/sysrq.c
arch/um/kernel/um_arch.c
arch/x86/include/asm/kvm_host.h
arch/x86/kvm/cpuid.c
arch/x86/kvm/emulate.c
arch/x86/kvm/mmu/mmu.c
arch/x86/kvm/x86.c
arch/x86/um/shared/sysdep/syscalls_32.h
arch/x86/um/tls_32.c
arch/x86/um/vdso/Makefile
block/blk-core.c
block/blk-lib.c
drivers/dma/ti/k3-udma-private.c
drivers/dma/xilinx/xilinx_dma.c
drivers/dma/xilinx/zynqmp_dma.c
drivers/firmware/arm_scmi/clock.c
drivers/firmware/arm_scmi/optee.c
drivers/firmware/arm_scmi/reset.c
drivers/firmware/arm_scmi/scmi_pm_domain.c
drivers/firmware/arm_scmi/sensors.c
drivers/firmware/efi/efibc.c
drivers/firmware/efi/libstub/secureboot.c
drivers/firmware/efi/libstub/x86-stub.c
drivers/gpio/gpio-ftgpio010.c
drivers/gpio/gpio-ixp4xx.c
drivers/gpio/gpio-mockup.c
drivers/gpio/gpio-mpc8xxx.c
drivers/gpio/gpio-mt7621.c
drivers/gpio/gpio-rockchip.c
drivers/gpio/gpio-tqmx86.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_mes.c
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h
drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c
drivers/gpu/drm/amd/amdgpu/nbio_v2_3.c
drivers/gpu/drm/amd/amdgpu/nbio_v6_1.c
drivers/gpu/drm/amd/amdgpu/nbio_v7_4.c
drivers/gpu/drm/amd/amdgpu/nbio_v7_7.c
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c
drivers/gpu/drm/amd/amdgpu/soc15.c
drivers/gpu/drm/amd/amdgpu/soc21.c
drivers/gpu/drm/amd/amdgpu/vega10_ih.c
drivers/gpu/drm/amd/amdgpu/vega20_ih.c
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn31/dcn31_clk_mgr.c
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn314/dcn314_clk_mgr.c
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn315/dcn315_clk_mgr.c
drivers/gpu/drm/amd/display/dc/clk_mgr/dcn316/dcn316_clk_mgr.c
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c
drivers/gpu/drm/amd/display/dc/core/dc_resource.c
drivers/gpu/drm/amd/display/dc/core/dc_stream.c
drivers/gpu/drm/amd/display/dc/dc.h
drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_dsc.h
drivers/gpu/drm/amd/display/dc/dcn20/dcn20_hwseq.c
drivers/gpu/drm/amd/display/dc/dcn314/dcn314_dio_stream_encoder.c
drivers/gpu/drm/amd/display/dc/dcn314/dcn314_hwseq.c
drivers/gpu/drm/amd/display/dc/dcn314/dcn314_hwseq.h
drivers/gpu/drm/amd/display/dc/dcn314/dcn314_init.c
drivers/gpu/drm/amd/display/dc/dcn314/dcn314_resource.c
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hubp.c
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource.c
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource.h
drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource_helpers.c
drivers/gpu/drm/amd/display/dc/dcn321/dcn321_resource.c
drivers/gpu/drm/amd/display/dc/dml/Makefile
drivers/gpu/drm/amd/display/dc/dml/dcn30/display_mode_vba_30.c
drivers/gpu/drm/amd/display/dc/dml/dcn31/dcn31_fpu.c
drivers/gpu/drm/amd/display/dc/dml/dcn31/display_mode_vba_31.c
drivers/gpu/drm/amd/display/dc/dml/dcn314/dcn314_fpu.c
drivers/gpu/drm/amd/display/dc/dml/dcn314/display_mode_vba_314.c
drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.c
drivers/gpu/drm/amd/display/dc/dml/dcn32/dcn32_fpu.h
drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_32.c
drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.c
drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_util_32.h
drivers/gpu/drm/amd/display/dc/dml/display_mode_lib.c
drivers/gpu/drm/amd/display/dc/dml/display_mode_lib.h
drivers/gpu/drm/amd/display/dc/dml/display_mode_vba.h
drivers/gpu/drm/amd/display/dc/inc/hw/clk_mgr.h
drivers/gpu/drm/amd/display/dc/inc/resource.h
drivers/gpu/drm/amd/display/modules/color/color_gamma.c
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
drivers/gpu/drm/gma500/cdv_device.c
drivers/gpu/drm/gma500/gem.c
drivers/gpu/drm/gma500/gma_display.c
drivers/gpu/drm/gma500/oaktrail_device.c
drivers/gpu/drm/gma500/power.c
drivers/gpu/drm/gma500/psb_drv.c
drivers/gpu/drm/gma500/psb_drv.h
drivers/gpu/drm/gma500/psb_irq.c
drivers/gpu/drm/gma500/psb_irq.h
drivers/gpu/drm/hisilicon/hibmc/Kconfig
drivers/gpu/drm/hyperv/hyperv_drm_drv.c
drivers/gpu/drm/i915/display/icl_dsi.c
drivers/gpu/drm/i915/display/intel_dp.c
drivers/gpu/drm/i915/display/intel_vdsc.c
drivers/gpu/drm/i915/gem/i915_gem_context.c
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c
drivers/gpu/drm/i915/i915_gem.c
drivers/gpu/drm/i915/i915_reg.h
drivers/gpu/drm/i915/i915_vma.c
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
drivers/gpu/drm/mediatek/mtk_dsi.c
drivers/gpu/drm/meson/meson_plane.c
drivers/gpu/drm/meson/meson_viu.c
drivers/gpu/drm/mgag200/mgag200_drv.c
drivers/gpu/drm/panel/panel-edp.c
drivers/gpu/drm/panel/panel-simple.c
drivers/gpu/drm/rockchip/cdn-dp-core.c
drivers/gpu/drm/rockchip/rockchip_drm_vop2.c
drivers/hv/hv_fcopy.c
drivers/hv/vmbus_drv.c
drivers/iommu/intel/dmar.c
drivers/iommu/intel/iommu.c
drivers/net/bonding/bond_3ad.c
drivers/net/bonding/bond_main.c
drivers/net/can/flexcan/flexcan-core.c
drivers/net/can/usb/gs_usb.c
drivers/net/dsa/microchip/lan937x_main.c
drivers/net/ethernet/aquantia/atlantic/aq_main.c
drivers/net/ethernet/broadcom/bnxt/bnxt.c
drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c
drivers/net/ethernet/freescale/enetc/Makefile
drivers/net/ethernet/freescale/enetc/enetc.c
drivers/net/ethernet/freescale/enetc/enetc.h
drivers/net/ethernet/freescale/enetc/enetc_pf.c
drivers/net/ethernet/freescale/enetc/enetc_qos.c
drivers/net/ethernet/freescale/enetc/enetc_vf.c
drivers/net/ethernet/freescale/fec.h
drivers/net/ethernet/freescale/fec_main.c
drivers/net/ethernet/freescale/fec_ptp.c
drivers/net/ethernet/google/gve/gve_rx_dqo.c
drivers/net/ethernet/intel/i40e/i40e_main.c
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
drivers/net/ethernet/intel/iavf/iavf_main.c
drivers/net/ethernet/intel/iavf/iavf_txrx.c
drivers/net/ethernet/intel/iavf/iavf_virtchnl.c
drivers/net/ethernet/intel/ice/ice_lib.c
drivers/net/ethernet/intel/ice/ice_main.c
drivers/net/ethernet/intel/ice/ice_txrx.c
drivers/net/ethernet/marvell/prestera/prestera_main.c
drivers/net/ethernet/marvell/prestera/prestera_pci.c
drivers/net/ethernet/mediatek/mtk_eth_soc.c
drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_mdio.c
drivers/net/ethernet/microsoft/mana/gdma_main.c
drivers/net/ethernet/renesas/ravb_main.c
drivers/net/ethernet/renesas/sh_eth.c
drivers/net/ethernet/sfc/efx_channels.c
drivers/net/ethernet/sfc/siena/efx_channels.c
drivers/net/ethernet/sfc/siena/tx.c
drivers/net/ethernet/sfc/tx.c
drivers/net/ethernet/sun/sunhme.c
drivers/net/ipa/ipa_qmi.c
drivers/net/ipa/ipa_qmi_msg.c
drivers/net/ipa/ipa_qmi_msg.h
drivers/net/ipa/ipa_table.c
drivers/net/ipa/ipa_table.h
drivers/net/ipvlan/ipvlan_core.c
drivers/net/mdio/of_mdio.c
drivers/net/netdevsim/hwstats.c
drivers/net/phy/aquantia_main.c
drivers/net/phy/micrel.c
drivers/net/team/team.c
drivers/net/wireguard/netlink.c
drivers/net/wireguard/selftest/ratelimiter.c
drivers/net/wireless/intel/iwlwifi/Kconfig
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
drivers/net/wireless/mediatek/mt76/mac80211.c
drivers/net/wireless/mediatek/mt76/mt7615/mac.c
drivers/of/fdt.c
drivers/parisc/ccio-dma.c
drivers/parisc/iosapic.c
drivers/pinctrl/pinctrl-ocelot.c
drivers/pinctrl/qcom/pinctrl-sc8180x.c
drivers/pinctrl/sunxi/pinctrl-sun50i-a100-r.c
drivers/scsi/mpt3sas/mpt3sas_base.c
drivers/scsi/qedf/qedf_main.c
drivers/scsi/qla2xxx/qla_target.c
drivers/video/fbdev/hyperv_fb.c
drivers/xen/xenbus/xenbus_client.c
fs/btrfs/disk-io.c
fs/btrfs/zoned.c
fs/cifs/cifsfs.h
fs/cifs/connect.c
fs/cifs/file.c
fs/cifs/transport.c
fs/exec.c
fs/exfat/fatent.c
fs/nfs/internal.h
fs/nfs/nfs42proc.c
fs/nfs/super.c
fs/nfs/write.c
fs/nfsd/vfs.c
fs/open.c
include/linux/dmar.h
include/linux/hp_sdc.h
include/linux/of_device.h
include/linux/pci_ids.h
include/linux/scmi_protocol.h
include/net/bluetooth/hci_sock.h
include/net/bond_3ad.h
include/net/bonding.h
include/net/ieee802154_netdev.h
include/trace/events/scmi.h
io_uring/msg_ring.c
io_uring/net.c
io_uring/opdef.c
io_uring/rw.c
kernel/fork.c
kernel/nsproxy.c
mm/slab_common.c
mm/slub.c
net/batman-adv/hard-interface.c
net/bridge/netfilter/ebtables.c
net/compat.c
net/core/flow_dissector.c
net/ieee802154/socket.c
net/ipv4/ipmr.c
net/ipv4/tcp.c
net/ipv4/udp.c
net/ipv6/af_inet6.c
net/ipv6/ip6mr.c
net/mptcp/protocol.c
net/netfilter/nf_conntrack_ftp.c
net/netfilter/nf_conntrack_irc.c
net/netfilter/nf_conntrack_sip.c
net/netfilter/nf_tables_api.c
net/netfilter/nfnetlink_osf.c
net/sched/cls_api.c
net/sched/sch_taprio.c
net/smc/smc_core.c
net/sunrpc/clnt.c
net/sunrpc/xprt.c
sound/core/init.c
sound/pci/hda/hda_bind.c
sound/pci/hda/hda_intel.c
sound/pci/hda/patch_hdmi.c
sound/pci/hda/patch_realtek.c
sound/usb/endpoint.c
sound/usb/endpoint.h
sound/usb/pcm.c
tools/arch/x86/include/asm/cpufeatures.h
tools/hv/hv_kvp_daemon.c
tools/include/uapi/asm/errno.h
tools/lib/perf/evlist.c
tools/perf/builtin-record.c
tools/perf/tests/shell/stat_bpf_counters_cgrp.sh [new file with mode: 0755]
tools/perf/tests/wp.c
tools/perf/util/bpf_counter_cgroup.c
tools/perf/util/bpf_skel/bperf_cgroup.bpf.c
tools/perf/util/genelf.c
tools/perf/util/genelf.h
tools/perf/util/symbol-elf.c
tools/perf/util/synthetic-events.c
tools/testing/selftests/Makefile
tools/testing/selftests/drivers/net/bonding/Makefile
tools/testing/selftests/drivers/net/bonding/bond-arp-interval-causes-panic.sh [new file with mode: 0755]
tools/testing/selftests/drivers/net/bonding/config
tools/testing/selftests/drivers/net/bonding/dev_addr_lists.sh [new file with mode: 0755]
tools/testing/selftests/drivers/net/bonding/lag_lib.sh [new file with mode: 0644]
tools/testing/selftests/drivers/net/team/Makefile [new file with mode: 0644]
tools/testing/selftests/drivers/net/team/config [new file with mode: 0644]
tools/testing/selftests/drivers/net/team/dev_addr_lists.sh [new file with mode: 0755]
tools/testing/selftests/kvm/rseq_test.c
tools/testing/selftests/net/forwarding/router_multicast.sh
tools/testing/selftests/net/forwarding/sch_red.sh
tools/testing/selftests/netfilter/nft_concat_range.sh
tools/testing/selftests/timens/Makefile
tools/testing/selftests/timens/vfork_exec.c [deleted file]
tools/testing/selftests/wireguard/qemu/Makefile

index 8ded2e7c2906f5c858c15893f27740424ff2eeae..d175777af07881fbff82dca171afc6e85f6b0288 100644 (file)
--- a/.mailmap
+++ b/.mailmap
@@ -315,6 +315,7 @@ Morten Welinder <welinder@troll.com>
 Mythri P K <mythripk@ti.com>
 Nadia Yvette Chambers <nyc@holomorphy.com> William Lee Irwin III <wli@holomorphy.com>
 Nathan Chancellor <nathan@kernel.org> <natechancellor@gmail.com>
+Neil Armstrong <neil.armstrong@linaro.org> <narmstrong@baylibre.com>
 Nguyen Anh Quynh <aquynh@gmail.com>
 Nicholas Piggin <npiggin@gmail.com> <npiggen@suse.de>
 Nicholas Piggin <npiggin@gmail.com> <npiggin@kernel.dk>
index 6cc74523ebfd3355cc2d76ca1c7cacac10819007..1748f1605cc701b55ac97687c27c23e0e6716465 100644 (file)
@@ -8,7 +8,7 @@ $schema: "http://devicetree.org/meta-schemas/core.yaml#"
 title: Amlogic Meson Firmware registers Interface
 
 maintainers:
-  - Neil Armstrong <narmstrong@baylibre.com>
+  - Neil Armstrong <neil.armstrong@linaro.org>
 
 description: |
   The Meson SoCs have a register bank with status and data shared with the
index 2e208d2fc98f22e6c60716863e1ba30d8d500495..7cdffdb131ac4ca0b8a93d7133b53d595a2ec0b6 100644 (file)
@@ -8,7 +8,7 @@ $schema: "http://devicetree.org/meta-schemas/core.yaml#"
 title: Amlogic specific extensions to the Synopsys Designware HDMI Controller
 
 maintainers:
-  - Neil Armstrong <narmstrong@baylibre.com>
+  - Neil Armstrong <neil.armstrong@linaro.org>
 
 allOf:
   - $ref: /schemas/sound/name-prefix.yaml#
index 047fd69e0377006da7c112d41ddae8aad19ef171..6655a93b187402d4809a47bb00db22290e954ba8 100644 (file)
@@ -8,7 +8,7 @@ $schema: "http://devicetree.org/meta-schemas/core.yaml#"
 title: Amlogic Meson Display Controller
 
 maintainers:
-  - Neil Armstrong <narmstrong@baylibre.com>
+  - Neil Armstrong <neil.armstrong@linaro.org>
 
 description: |
   The Amlogic Meson Display controller is composed of several components
index bce96b5b0db083463eed3dba24dc6b26b99b025f..4a5e5d9d6f909064ea15e4ba7f8b29827e6b20fb 100644 (file)
@@ -8,7 +8,7 @@ title: Analogix ANX7814 SlimPort (Full-HD Transmitter)
 
 maintainers:
   - Andrzej Hajda <andrzej.hajda@intel.com>
-  - Neil Armstrong <narmstrong@baylibre.com>
+  - Neil Armstrong <neil.armstrong@linaro.org>
   - Robert Foss <robert.foss@linaro.org>
 
 properties:
index c6e81f5322152b84c57cc63496d50b37b0326d1c..1b2185be92cdd32ce67f447f021f55862006a552 100644 (file)
@@ -8,7 +8,7 @@ title: ITE it66121 HDMI bridge Device Tree Bindings
 
 maintainers:
   - Phong LE <ple@baylibre.com>
-  - Neil Armstrong <narmstrong@baylibre.com>
+  - Neil Armstrong <neil.armstrong@linaro.org>
 
 description: |
   The IT66121 is a high-performance and low-power single channel HDMI
index 44e02decdf3a003bc17bfd201d6c332ca3a207df..2e75e3738ff094317e2c8bba97757b5712f43c8d 100644 (file)
@@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
 title: Solomon Goldentek Display GKTW70SDAE4SE 7" WVGA LVDS Display Panel
 
 maintainers:
-  - Neil Armstrong <narmstrong@baylibre.com>
+  - Neil Armstrong <neil.armstrong@linaro.org>
   - Thierry Reding <thierry.reding@gmail.com>
 
 allOf:
index 8a9f3559335b50f0c663bcfe49ca6cc336745e6f..7e14e26676ec9216f610198fb7571ab0e28a558b 100644 (file)
@@ -34,8 +34,8 @@ Example:
 Use specific request line passing from dma
 For example, MMC request line is 5
 
-       sdhci: sdhci@98e00000 {
-               compatible = "moxa,moxart-sdhci";
+       mmc: mmc@98e00000 {
+               compatible = "moxa,moxart-mmc";
                reg = <0x98e00000 0x5C>;
                interrupts = <5 0>;
                clocks = <&clk_apb>;
index 6ecb0270d88d84e2a5b3a873f940bde0011298cc..199a354ccb9701ecd692481244e1bc7522f87172 100644 (file)
@@ -8,7 +8,7 @@ $schema: "http://devicetree.org/meta-schemas/core.yaml#"
 title: Amlogic Meson I2C Controller
 
 maintainers:
-  - Neil Armstrong <narmstrong@baylibre.com>
+  - Neil Armstrong <neil.armstrong@linaro.org>
   - Beniamino Galvani <b.galvani@gmail.com>
 
 allOf:
index 09c8948b5e251ee2d1983d378f31e00e77f8d084..fa4f7685ab2b546d63a5afb754df3c89d18fef52 100644 (file)
@@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
 title: Generic i.MX bus frequency device
 
 maintainers:
-  - Leonard Crestez <leonard.crestez@nxp.com>
+  - Peng Fan <peng.fan@nxp.com>
 
 description: |
   The i.MX SoC family has multiple buses for which clock frequency (and
index 85c85b694217c16d157ee0c68509b95f9baa322c..e18107eafe7cc4038fb2f4b16fe47f0741129175 100644 (file)
@@ -96,7 +96,7 @@ properties:
               Documentation/devicetree/bindings/arm/cpus.yaml).
 
         required:
-          - fiq-index
+          - apple,fiq-index
           - cpus
 
 required:
index ea06976fbbc7ad809797391c19fcb57f12937336..dfd26b998189a10906dc043fc337586e5ee06227 100644 (file)
@@ -8,7 +8,7 @@ $schema: "http://devicetree.org/meta-schemas/core.yaml#"
 title: Amlogic Meson Message-Handling-Unit Controller
 
 maintainers:
-  - Neil Armstrong <narmstrong@baylibre.com>
+  - Neil Armstrong <neil.armstrong@linaro.org>
 
 description: |
   The Amlogic's Meson SoCs Message-Handling-Unit (MHU) is a mailbox controller
index bee93bd8477152f216998d31ba400099a8cc1e95..e551be5e680e36cb06a96a73fe1fea3c32694499 100644 (file)
@@ -8,7 +8,7 @@ $schema: "http://devicetree.org/meta-schemas/core.yaml#"
 title: Amlogic GE2D Acceleration Unit
 
 maintainers:
-  - Neil Armstrong <narmstrong@baylibre.com>
+  - Neil Armstrong <neil.armstrong@linaro.org>
 
 properties:
   compatible:
index 5044c4bb94e099750912b974f0a9c7a4d4b05e25..b827edabcafaa475437b88d3d2b66e350f3a119c 100644 (file)
@@ -8,7 +8,7 @@ $schema: "http://devicetree.org/meta-schemas/core.yaml#"
 title: Amlogic Video Decoder
 
 maintainers:
-  - Neil Armstrong <narmstrong@baylibre.com>
+  - Neil Armstrong <neil.armstrong@linaro.org>
   - Maxime Jourdan <mjourdan@baylibre.com>
 
 description: |
index d93aea6a0258e98dc753020dfe336b27219f8f5f..8d844f4312d157e088dc5b840f094edeae1f0f4d 100644 (file)
@@ -8,7 +8,7 @@ $schema: "http://devicetree.org/meta-schemas/core.yaml#"
 title: Amlogic Meson AO-CEC Controller
 
 maintainers:
-  - Neil Armstrong <narmstrong@baylibre.com>
+  - Neil Armstrong <neil.armstrong@linaro.org>
 
 description: |
   The Amlogic Meson AO-CEC module is present is Amlogic SoCs and its purpose is
index 445e46feda69200ee05c86014501909174e13838..2b39fce5f6504b05694e6f5e184004aaa0c72edc 100644 (file)
@@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
 title: i.MX8M DDR Controller
 
 maintainers:
-  - Leonard Crestez <leonard.crestez@nxp.com>
+  - Peng Fan <peng.fan@nxp.com>
 
 description:
   The DDRC block is integrated in i.MX8M for interfacing with DDR based
index a3b976f101e8c637bfec7122746420bf36f04a9d..5750cc06e92313d575f551b43c098aef244abe87 100644 (file)
@@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
 title: Khadas on-board Microcontroller Device Tree Bindings
 
 maintainers:
-  - Neil Armstrong <narmstrong@baylibre.com>
+  - Neil Armstrong <neil.armstrong@linaro.org>
 
 description: |
   Khadas embeds a microcontroller on their VIM and Edge boards adding some
index 608e1d62bed5ca44b2dcc0d83339ccefe621059f..ddd5a073c3a89183156a32c940ac7a4a829cb333 100644 (file)
@@ -8,7 +8,7 @@ $schema: "http://devicetree.org/meta-schemas/core.yaml#"
 title: Amlogic Meson DWMAC Ethernet controller
 
 maintainers:
-  - Neil Armstrong <narmstrong@baylibre.com>
+  - Neil Armstrong <neil.armstrong@linaro.org>
   - Martin Blumenstingl <martin.blumenstingl@googlemail.com>
 
 # We need a select here so we don't match all nodes with 'snps,dwmac'
index be485f5008870d81b3055d32a373bf5dc94e1725..5eddaed3d8535fc7020240d6f3a52d0a921510ce 100644 (file)
@@ -8,7 +8,7 @@ $schema: "http://devicetree.org/meta-schemas/core.yaml#"
 title: Amlogic AXG MIPI D-PHY
 
 maintainers:
-  - Neil Armstrong <narmstrong@baylibre.com>
+  - Neil Armstrong <neil.armstrong@linaro.org>
 
 properties:
   compatible:
index 399ebde454095fa19519b9ad0718ca3fd8db9a3c..f3a5fbabbbb5971b343ea6f892a49033dddbf5d0 100644 (file)
@@ -8,7 +8,7 @@ $schema: "http://devicetree.org/meta-schemas/core.yaml#"
 title: Amlogic G12A USB2 PHY
 
 maintainers:
-  - Neil Armstrong <narmstrong@baylibre.com>
+  - Neil Armstrong <neil.armstrong@linaro.org>
 
 properties:
   compatible:
index 453c083cf44cb170e5e19038a1c34e6f8ff9d5c0..868b4e6fde71f1fb68d49b9ce8f73fc5176a12e6 100644 (file)
@@ -8,7 +8,7 @@ $schema: "http://devicetree.org/meta-schemas/core.yaml#"
 title: Amlogic G12A USB3 + PCIE Combo PHY
 
 maintainers:
-  - Neil Armstrong <narmstrong@baylibre.com>
+  - Neil Armstrong <neil.armstrong@linaro.org>
 
 properties:
   compatible:
index 33d1d37fdf6db1496f15bacde42e145f2575c51e..624e14f007900473711054e44a9d5c023f85734c 100644 (file)
@@ -8,7 +8,6 @@ title: Qualcomm Technologies, Inc. Low Power Audio SubSystem (LPASS)
   Low Power Island (LPI) TLMM block
 
 maintainers:
-  - Srinivasa Rao Mandadapu <srivasam@codeaurora.org>
   - Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
 
 description: |
index 2d228164357c2cffbccc3a685791c82b5205c16d..2bd60c49a44219606ca67630b24b03e2f3fdf468 100644 (file)
@@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
 title: Qualcomm Technologies, Inc. SC7280 TLMM block
 
 maintainers:
-  - Rajendra Nayak <rnayak@codeaurora.org>
+  - Bjorn Andersson <andersson@kernel.org>
 
 description: |
   This binding describes the Top Level Mode Multiplexer block found in the
index 5390e988a9347a739ff3ae88ae067d07d1528732..43a932237a92c5d8697689fa8a3b7606025713e6 100644 (file)
@@ -8,7 +8,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
 title: Amlogic Meson Everything-Else Power Domains
 
 maintainers:
-  - Neil Armstrong <narmstrong@baylibre.com>
+  - Neil Armstrong <neil.armstrong@linaro.org>
 
 description: |+
   The Everything-Else Power Domains node should be the child of a syscon
index 0ccca493251acf1bacc1bebe63b0688580fec389..3934a2b44894de6b9faf9715d8400a20e3063c1b 100644 (file)
@@ -7,7 +7,7 @@ $schema: http://devicetree.org/meta-schemas/core.yaml#
 title: Qualcomm RPM/RPMh Power domains
 
 maintainers:
-  - Rajendra Nayak <rnayak@codeaurora.org>
+  - Bjorn Andersson <andersson@kernel.org>
 
 description:
   For RPM/RPMh Power domains, we communicate a performance state to RPM/RPMh
index 494a454928ce62dc85b119ec9e1d25bae44bb9a5..98db2aa74dc88f9e6d603ef1df74726f73b1eec9 100644 (file)
@@ -8,7 +8,7 @@ $schema: "http://devicetree.org/meta-schemas/core.yaml#"
 title: Amlogic Meson SoC Reset Controller
 
 maintainers:
-  - Neil Armstrong <narmstrong@baylibre.com>
+  - Neil Armstrong <neil.armstrong@linaro.org>
 
 properties:
   compatible:
index 444be32a8a295ea43e1f806914b39a68fdce59ee..09c6c906b1f9733bbd3d3d66f90f7123e48eb28f 100644 (file)
@@ -8,7 +8,7 @@ $schema: "http://devicetree.org/meta-schemas/core.yaml#"
 title: Amlogic Meson Random number generator
 
 maintainers:
-  - Neil Armstrong <narmstrong@baylibre.com>
+  - Neil Armstrong <neil.armstrong@linaro.org>
 
 properties:
   compatible:
index 72e8868db3e01770d1b4f3bdecd8b36a43619b59..7822705ad16c6baa77d323f3bc2aa5595a3610a4 100644 (file)
@@ -8,7 +8,7 @@ $schema: "http://devicetree.org/meta-schemas/core.yaml#"
 title: Amlogic Meson SoC UART Serial Interface
 
 maintainers:
-  - Neil Armstrong <narmstrong@baylibre.com>
+  - Neil Armstrong <neil.armstrong@linaro.org>
 
 description: |
   The Amlogic Meson SoC UART Serial Interface is present on a large range
index 17db87cb9dabc95a027d1fdbad2b8e0ebc9f10d8..c3c59909635310d6a72a09b57f26c23412c10a0e 100644 (file)
@@ -8,7 +8,7 @@ $schema: "http://devicetree.org/meta-schemas/core.yaml#"
 title: Amlogic Canvas Video Lookup Table
 
 maintainers:
-  - Neil Armstrong <narmstrong@baylibre.com>
+  - Neil Armstrong <neil.armstrong@linaro.org>
   - Maxime Jourdan <mjourdan@baylibre.com>
 
 description: |
index 50de0da42c138ea650e2f8d40a46315e3319081f..0c10f7678178ae0c7a4ffdc4cb2d2ae99118298d 100644 (file)
@@ -8,7 +8,7 @@ $schema: "http://devicetree.org/meta-schemas/core.yaml#"
 title: Amlogic Meson SPI Communication Controller
 
 maintainers:
-  - Neil Armstrong <narmstrong@baylibre.com>
+  - Neil Armstrong <neil.armstrong@linaro.org>
 
 allOf:
   - $ref: "spi-controller.yaml#"
index 8a9d526d06ebf393840a3546bbe661677b8c139c..ac3b2ec300acf0d502c14b2be5193fe281e7f417 100644 (file)
@@ -8,7 +8,7 @@ $schema: "http://devicetree.org/meta-schemas/core.yaml#"
 title: Amlogic Meson SPI Flash Controller
 
 maintainers:
-  - Neil Armstrong <narmstrong@baylibre.com>
+  - Neil Armstrong <neil.armstrong@linaro.org>
 
 allOf:
   - $ref: "spi-controller.yaml#"
index e349fa5de60611e155333c8f9cec378b139139ba..daf2a859418d40563f5c9b800074173e83816f7f 100644 (file)
@@ -8,7 +8,7 @@ $schema: "http://devicetree.org/meta-schemas/core.yaml#"
 title: Amlogic Meson G12A DWC3 USB SoC Controller Glue
 
 maintainers:
-  - Neil Armstrong <narmstrong@baylibre.com>
+  - Neil Armstrong <neil.armstrong@linaro.org>
 
 description: |
   The Amlogic G12A embeds a DWC3 USB IP Core configured for USB2 and USB3
index c7459cf70e30341153e14baeedbaf468f980a6a9..497d60408ea04d7ba8ca49796790ef82f2926de2 100644 (file)
@@ -8,7 +8,7 @@ $schema: "http://devicetree.org/meta-schemas/core.yaml#"
 title: Meson GXBB SoCs Watchdog timer
 
 maintainers:
-  - Neil Armstrong <narmstrong@baylibre.com>
+  - Neil Armstrong <neil.armstrong@linaro.org>
 
 allOf:
   - $ref: watchdog.yaml#
index e263dfcc4b402f45fc606f24c9b56b8b8c11f84f..213510698014eab523daba264ab68714ba69a09e 100644 (file)
@@ -47,7 +47,6 @@ allow_join_initial_addr_port - BOOLEAN
        Default: 1
 
 pm_type - INTEGER
-
        Set the default path manager type to use for each new MPTCP
        socket. In-kernel path management will control subflow
        connections and address advertisements according to
index 834945ebc4cdf3ce3fffeb477d2d9b1047b7a7a4..1120d71f28d7bca75e6a540c03c539175c3d6cc2 100644 (file)
@@ -70,15 +70,6 @@ nf_conntrack_generic_timeout - INTEGER (seconds)
        Default for generic timeout.  This refers to layer 4 unknown/unsupported
        protocols.
 
-nf_conntrack_helper - BOOLEAN
-       - 0 - disabled (default)
-       - not 0 - enabled
-
-       Enable automatic conntrack helper assignment.
-       If disabled it is required to set up iptables rules to assign
-       helpers to connections.  See the CT target description in the
-       iptables-extensions(8) man page for further information.
-
 nf_conntrack_icmp_timeout - INTEGER (seconds)
        default 30
 
index 936490dcc97b627a095489ef69f1316f8f854c68..bf6650f41b04f85b19b8a7ae6e404e60523ecebb 100644 (file)
@@ -671,7 +671,8 @@ F:  fs/afs/
 F:     include/trace/events/afs.h
 
 AGPGART DRIVER
-M:     David Airlie <airlied@linux.ie>
+M:     David Airlie <airlied@redhat.com>
+L:     dri-devel@lists.freedesktop.org
 S:     Maintained
 T:     git git://anongit.freedesktop.org/drm/drm
 F:     drivers/char/agp/
@@ -1803,7 +1804,7 @@ N:        sun[x456789]i
 N:     sun50i
 
 ARM/Amlogic Meson SoC CLOCK FRAMEWORK
-M:     Neil Armstrong <narmstrong@baylibre.com>
+M:     Neil Armstrong <neil.armstrong@linaro.org>
 M:     Jerome Brunet <jbrunet@baylibre.com>
 L:     linux-amlogic@lists.infradead.org
 S:     Maintained
@@ -1828,7 +1829,7 @@ F:        Documentation/devicetree/bindings/sound/amlogic*
 F:     sound/soc/meson/
 
 ARM/Amlogic Meson SoC support
-M:     Neil Armstrong <narmstrong@baylibre.com>
+M:     Neil Armstrong <neil.armstrong@linaro.org>
 M:     Kevin Hilman <khilman@baylibre.com>
 R:     Jerome Brunet <jbrunet@baylibre.com>
 R:     Martin Blumenstingl <martin.blumenstingl@googlemail.com>
@@ -2531,7 +2532,7 @@ W:        http://www.digriz.org.uk/ts78xx/kernel
 F:     arch/arm/mach-orion5x/ts78xx-*
 
 ARM/OXNAS platform support
-M:     Neil Armstrong <narmstrong@baylibre.com>
+M:     Neil Armstrong <neil.armstrong@linaro.org>
 L:     linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
 L:     linux-oxnas@groups.io (moderated for non-subscribers)
 S:     Maintained
@@ -6753,7 +6754,7 @@ F:        Documentation/devicetree/bindings/display/panel/samsung,lms380kf01.yaml
 F:     drivers/gpu/drm/panel/panel-widechips-ws2401.c
 
 DRM DRIVERS
-M:     David Airlie <airlied@linux.ie>
+M:     David Airlie <airlied@gmail.com>
 M:     Daniel Vetter <daniel@ffwll.ch>
 L:     dri-devel@lists.freedesktop.org
 S:     Maintained
@@ -6792,7 +6793,7 @@ F:        Documentation/devicetree/bindings/display/allwinner*
 F:     drivers/gpu/drm/sun4i/
 
 DRM DRIVERS FOR AMLOGIC SOCS
-M:     Neil Armstrong <narmstrong@baylibre.com>
+M:     Neil Armstrong <neil.armstrong@linaro.org>
 L:     dri-devel@lists.freedesktop.org
 L:     linux-amlogic@lists.infradead.org
 S:     Supported
@@ -6814,7 +6815,7 @@ F:        drivers/gpu/drm/atmel-hlcdc/
 
 DRM DRIVERS FOR BRIDGE CHIPS
 M:     Andrzej Hajda <andrzej.hajda@intel.com>
-M:     Neil Armstrong <narmstrong@baylibre.com>
+M:     Neil Armstrong <neil.armstrong@linaro.org>
 M:     Robert Foss <robert.foss@linaro.org>
 R:     Laurent Pinchart <Laurent.pinchart@ideasonboard.com>
 R:     Jonas Karlman <jonas@kwiboo.se>
@@ -8652,8 +8653,8 @@ F:        drivers/input/touchscreen/goodix*
 
 GOOGLE ETHERNET DRIVERS
 M:     Jeroen de Borst <jeroendb@google.com>
-R:     Catherine Sullivan <csully@google.com>
-R:     David Awogbemila <awogbemila@google.com>
+M:     Catherine Sullivan <csully@google.com>
+R:     Shailend Chand <shailend@google.com>
 L:     netdev@vger.kernel.org
 S:     Supported
 F:     Documentation/networking/device_drivers/ethernet/google/gve.rst
@@ -9122,7 +9123,7 @@ S:        Maintained
 F:     drivers/dma/hisi_dma.c
 
 HISILICON GPIO DRIVER
-M:     Luo Jiaxing <luojiaxing@huawei.com>
+M:     Jay Fang <f.fangjian@huawei.com>
 L:     linux-gpio@vger.kernel.org
 S:     Maintained
 F:     drivers/gpio/gpio-hisi.c
@@ -10828,7 +10829,7 @@ F:      drivers/media/tuners/it913x*
 
 ITE IT66121 HDMI BRIDGE DRIVER
 M:     Phong LE <ple@baylibre.com>
-M:     Neil Armstrong <narmstrong@baylibre.com>
+M:     Neil Armstrong <neil.armstrong@linaro.org>
 S:     Maintained
 T:     git git://anongit.freedesktop.org/drm/drm-misc
 F:     Documentation/devicetree/bindings/display/bridge/ite,it66121.yaml
@@ -11347,7 +11348,7 @@ F:      kernel/debug/
 F:     kernel/module/kdb.c
 
 KHADAS MCU MFD DRIVER
-M:     Neil Armstrong <narmstrong@baylibre.com>
+M:     Neil Armstrong <neil.armstrong@linaro.org>
 L:     linux-amlogic@lists.infradead.org
 S:     Maintained
 F:     Documentation/devicetree/bindings/mfd/khadas,mcu.yaml
@@ -13218,7 +13219,7 @@ S:      Maintained
 F:     drivers/watchdog/menz69_wdt.c
 
 MESON AO CEC DRIVER FOR AMLOGIC SOCS
-M:     Neil Armstrong <narmstrong@baylibre.com>
+M:     Neil Armstrong <neil.armstrong@linaro.org>
 L:     linux-media@vger.kernel.org
 L:     linux-amlogic@lists.infradead.org
 S:     Supported
@@ -13229,7 +13230,7 @@ F:      drivers/media/cec/platform/meson/ao-cec-g12a.c
 F:     drivers/media/cec/platform/meson/ao-cec.c
 
 MESON GE2D DRIVER FOR AMLOGIC SOCS
-M:     Neil Armstrong <narmstrong@baylibre.com>
+M:     Neil Armstrong <neil.armstrong@linaro.org>
 L:     linux-media@vger.kernel.org
 L:     linux-amlogic@lists.infradead.org
 S:     Supported
@@ -13245,7 +13246,7 @@ F:      Documentation/devicetree/bindings/mtd/amlogic,meson-nand.txt
 F:     drivers/mtd/nand/raw/meson_*
 
 MESON VIDEO DECODER DRIVER FOR AMLOGIC SOCS
-M:     Neil Armstrong <narmstrong@baylibre.com>
+M:     Neil Armstrong <neil.armstrong@linaro.org>
 L:     linux-media@vger.kernel.org
 L:     linux-amlogic@lists.infradead.org
 S:     Supported
@@ -16857,6 +16858,7 @@ F:      drivers/net/ethernet/qualcomm/emac/
 
 QUALCOMM ETHQOS ETHERNET DRIVER
 M:     Vinod Koul <vkoul@kernel.org>
+R:     Bhupesh Sharma <bhupesh.sharma@linaro.org>
 L:     netdev@vger.kernel.org
 S:     Maintained
 F:     Documentation/devicetree/bindings/net/qcom,ethqos.txt
@@ -19959,6 +19961,7 @@ S:      Supported
 F:     drivers/net/team/
 F:     include/linux/if_team.h
 F:     include/uapi/linux/if_team.h
+F:     tools/testing/selftests/net/team/
 
 TECHNOLOGIC SYSTEMS TS-5500 PLATFORM SUPPORT
 M:     "Savoir-faire Linux Inc." <kernel@savoirfairelinux.com>
@@ -21565,7 +21568,7 @@ F:      drivers/gpio/gpio-virtio.c
 F:     include/uapi/linux/virtio_gpio.h
 
 VIRTIO GPU DRIVER
-M:     David Airlie <airlied@linux.ie>
+M:     David Airlie <airlied@redhat.com>
 M:     Gerd Hoffmann <kraxel@redhat.com>
 R:     Gurchetan Singh <gurchetansingh@chromium.org>
 R:     Chia-I Wu <olvaffe@gmail.com>
index a5e9d9388649ab93a45798ce84873b7ed925ff4f..298f69060f104490f417c8b1e0a3f5779c460aa7 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,7 @@
 VERSION = 6
 PATCHLEVEL = 0
 SUBLEVEL = 0
-EXTRAVERSION = -rc5
+EXTRAVERSION = -rc6
 NAME = Hurr durr I'ma ninja sloth
 
 # *DOCUMENTATION*
index 894bf9da19a4bc038fd2613ebfa79b91b50ba329..0bf8187134227eb99c646a5a00314f821b0d88e2 100644 (file)
 
                        phy0: ethernet-phy@1 {
                                reg = <1>;
-                               interrupts = <GIC_SPI 81 IRQ_TYPE_LEVEL_HIGH>;
+                               interrupts = <GIC_SPI 80 IRQ_TYPE_LEVEL_HIGH>;
                                status = "disabled";
                        };
 
                        phy1: ethernet-phy@2 {
                                reg = <2>;
-                               interrupts = <GIC_SPI 82 IRQ_TYPE_LEVEL_HIGH>;
+                               interrupts = <GIC_SPI 81 IRQ_TYPE_LEVEL_HIGH>;
                                status = "disabled";
                        };
                };
index eb5291b0ee3aa15a6928b08c52806340a234de4a..e07b807b4cec569bbdbf3dd1eb390212b178cb0b 100644 (file)
@@ -79,7 +79,7 @@
        clocks = <&ref12>;
 };
 
-&sdhci {
+&mmc {
        status = "okay";
 };
 
index f5f070a8748231077f623ceac4ce1fa785262624..764832ddfa78ace56941070a49915cc276669d11 100644 (file)
@@ -93,8 +93,8 @@
                        clock-names = "PCLK";
                };
 
-               sdhci: sdhci@98e00000 {
-                       compatible = "moxa,moxart-sdhci";
+               mmc: mmc@98e00000 {
+                       compatible = "moxa,moxart-mmc";
                        reg = <0x98e00000 0x5C>;
                        interrupts = <5 IRQ_TYPE_LEVEL_HIGH>;
                        clocks = <&clk_apb>;
index c97f4e06ae5f304831a2f2e40af4253521f7ee87..32f6f2f50c10ca29c4c80bac23614df665657337 100644 (file)
         * CPLD_reset is RESET_SOFT in schematic
         */
        gpio-line-names =
-               "CPLD_D[1]", "CPLD_int", "CPLD_reset", "",
-               "", "CPLD_D[0]", "", "",
-               "", "", "", "CPLD_D[2]",
-               "CPLD_D[3]", "CPLD_D[4]", "CPLD_D[5]", "CPLD_D[6]",
-               "CPLD_D[7]", "", "", "",
+               "CPLD_D[6]", "CPLD_int", "CPLD_reset", "",
+               "", "CPLD_D[7]", "", "",
+               "", "", "", "CPLD_D[5]",
+               "CPLD_D[4]", "CPLD_D[3]", "CPLD_D[2]", "CPLD_D[1]",
+               "CPLD_D[0]", "", "", "",
                "", "", "", "",
                "", "", "", "KBD_intK",
                "", "", "", "";
index 286d2df01cfa72e38fdacd7777d7b9516efebd66..7e0aeb2db30549b7c9469b7b1d3d1ee908e7e2a1 100644 (file)
@@ -5,7 +5,6 @@
 
 /dts-v1/;
 
-#include <dt-bindings/phy/phy-imx8-pcie.h>
 #include "imx8mm-tqma8mqml.dtsi"
 #include "mba8mx.dtsi"
 
index 16ee9b5179e6e356ad6ad022d6b098b8c8947179..f649dfacb4b696caef22fc9e17a2d55cc20fb8e0 100644 (file)
@@ -3,6 +3,7 @@
  * Copyright 2020-2021 TQ-Systems GmbH
  */
 
+#include <dt-bindings/phy/phy-imx8-pcie.h>
 #include "imx8mm.dtsi"
 
 / {
index b379c461aa13c35c2e4db081f00ae431037b03fd..3ec0c9ac3170588839adcb66d9cbc22777b4b6f5 100644 (file)
                                nxp,dvs-standby-voltage = <850000>;
                                regulator-always-on;
                                regulator-boot-on;
-                               regulator-max-microvolt = <950000>;
-                               regulator-min-microvolt = <850000>;
+                               regulator-max-microvolt = <1050000>;
+                               regulator-min-microvolt = <805000>;
                                regulator-name = "On-module +VDD_ARM (BUCK2)";
                                regulator-ramp-delay = <3125>;
                        };
                        reg_vdd_dram: BUCK3 {
                                regulator-always-on;
                                regulator-boot-on;
-                               regulator-max-microvolt = <950000>;
-                               regulator-min-microvolt = <850000>;
+                               regulator-max-microvolt = <1000000>;
+                               regulator-min-microvolt = <805000>;
                                regulator-name = "On-module +VDD_GPU_VPU_DDR (BUCK3)";
                        };
 
                        reg_vdd_snvs: LDO2 {
                                regulator-always-on;
                                regulator-boot-on;
-                               regulator-max-microvolt = <900000>;
+                               regulator-max-microvolt = <800000>;
                                regulator-min-microvolt = <800000>;
                                regulator-name = "On-module +V0.8_SNVS (LDO2)";
                        };
index 0c71b740a3166fbaa187439665ea58bcc20b87ad..cb2836bfbd95c7a3d7d354a6b63bea2e885f5925 100644 (file)
                                                         <&clk IMX8MN_CLK_GPU_SHADER>,
                                                         <&clk IMX8MN_CLK_GPU_BUS_ROOT>,
                                                         <&clk IMX8MN_CLK_GPU_AHB>;
-                                               resets = <&src IMX8MQ_RESET_GPU_RESET>;
                                        };
 
                                        pgc_dispmix: power-domain@3 {
index d8ca52976170e8ce342d4c7a0c06567841a97645..0e237b2f95415613b225b6b02188970f28b0882d 100644 (file)
                switch-1 {
                        label = "S12";
                        linux,code = <BTN_0>;
-                       gpios = <&gpio5 26 GPIO_ACTIVE_LOW>;
+                       gpios = <&gpio5 27 GPIO_ACTIVE_LOW>;
                };
 
                switch-2 {
                        label = "S13";
                        linux,code = <BTN_1>;
-                       gpios = <&gpio5 27 GPIO_ACTIVE_LOW>;
+                       gpios = <&gpio5 26 GPIO_ACTIVE_LOW>;
                };
        };
 
 
 &pcf85063 {
        /* RTC_EVENT# is connected on MBa8MPxL */
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_pcf85063>;
        interrupt-parent = <&gpio4>;
        interrupts = <28 IRQ_TYPE_EDGE_FALLING>;
 };
                fsl,pins = <MX8MP_IOMUXC_SAI5_RXC__GPIO3_IO20           0x10>; /* Power enable */
        };
 
+       pinctrl_pcf85063: pcf85063grp {
+               fsl,pins = <MX8MP_IOMUXC_SAI3_RXFS__GPIO4_IO28          0x80>;
+       };
+
        /* LVDS Backlight */
        pinctrl_pwm2: pwm2grp {
                fsl,pins = <MX8MP_IOMUXC_SAI5_RXD0__PWM2_OUT            0x14>;
index 6630ec561dc25629b76396248ef614bdb3e06cfd..211e6a1b296e1355c45f020a2fb3bdb502237558 100644 (file)
                pinctrl-names = "default";
                pinctrl-0 = <&pinctrl_reg_can>;
                regulator-name = "can2_stby";
-               gpio = <&gpio3 19 GPIO_ACTIVE_HIGH>;
-               enable-active-high;
+               gpio = <&gpio3 19 GPIO_ACTIVE_LOW>;
                regulator-min-microvolt = <3300000>;
                regulator-max-microvolt = <3300000>;
        };
                        lan1: port@0 {
                                reg = <0>;
                                label = "lan1";
+                               phy-mode = "internal";
                                local-mac-address = [00 00 00 00 00 00];
                        };
 
                        lan2: port@1 {
                                reg = <1>;
                                label = "lan2";
+                               phy-mode = "internal";
                                local-mac-address = [00 00 00 00 00 00];
                        };
 
                        lan3: port@2 {
                                reg = <2>;
                                label = "lan3";
+                               phy-mode = "internal";
                                local-mac-address = [00 00 00 00 00 00];
                        };
 
                        lan4: port@3 {
                                reg = <3>;
                                label = "lan4";
+                               phy-mode = "internal";
                                local-mac-address = [00 00 00 00 00 00];
                        };
 
                        lan5: port@4 {
                                reg = <4>;
                                label = "lan5";
+                               phy-mode = "internal";
                                local-mac-address = [00 00 00 00 00 00];
                        };
 
-                       port@6 {
-                               reg = <6>;
+                       port@5 {
+                               reg = <5>;
                                label = "cpu";
                                ethernet = <&fec>;
                                phy-mode = "rgmii-id";
index 60c1b018bf03db0ed9ea1ac5201129229d336b86..bb56390b8f5412f69e6539b4f8e7c0dcbfe86c66 100644 (file)
                                compatible = "fsl,imx8ulp-pcc3";
                                reg = <0x292d0000 0x10000>;
                                #clock-cells = <1>;
+                               #reset-cells = <1>;
                        };
 
                        tpm5: tpm@29340000 {
                                compatible = "fsl,imx8ulp-pcc4";
                                reg = <0x29800000 0x10000>;
                                #clock-cells = <1>;
+                               #reset-cells = <1>;
                        };
 
                        lpi2c6: i2c@29840000 {
                                compatible = "fsl,imx8ulp-pcc5";
                                reg = <0x2da70000 0x10000>;
                                #clock-cells = <1>;
+                               #reset-cells = <1>;
                        };
                };
 
index 7249871530ab96c778b09a6366a7a8ed817b3a00..5eecbefa8a336e83435c661cc189129ad08ac355 100644 (file)
@@ -2,8 +2,8 @@
 /*
  * Copyright (c) 2020 Fuzhou Rockchip Electronics Co., Ltd
  * Copyright (c) 2020 Engicam srl
- * Copyright (c) 2020 Amarula Solutons
- * Copyright (c) 2020 Amarula Solutons(India)
+ * Copyright (c) 2020 Amarula Solutions
+ * Copyright (c) 2020 Amarula Solutions(India)
  */
 
 #include <dt-bindings/gpio/gpio.h>
index 31ebb4e5fd3307335008ecafd1ca8be1df54a607..0f9cc042d9bf06b3445c2cb125435c823f3b26b4 100644 (file)
@@ -88,3 +88,8 @@
                };
        };
 };
+
+&wlan_host_wake_l {
+       /* Kevin has an external pull up, but Bob does not. */
+       rockchip,pins = <0 RK_PB0 RK_FUNC_GPIO &pcfg_pull_up>;
+};
index cd074641884bfe51cd12293954eb83000e54d95d..ee6095baba4d3a0679f1ce01106ae81c05920760 100644 (file)
 &edp {
        status = "okay";
 
+       /*
+        * eDP PHY/clk don't sync reliably at anything other than 24 MHz. Only
+        * set this here, because rk3399-gru.dtsi ensures we can generate this
+        * off GPLL=600MHz, whereas some other RK3399 boards may not.
+        */
+       assigned-clocks = <&cru PCLK_EDP>;
+       assigned-clock-rates = <24000000>;
+
        ports {
                edp_out: port@1 {
                        reg = <1>;
@@ -578,6 +586,7 @@ ap_i2c_tp: &i2c5 {
        };
 
        wlan_host_wake_l: wlan-host-wake-l {
+               /* Kevin has an external pull up, but Bob does not */
                rockchip,pins = <0 RK_PB0 RK_FUNC_GPIO &pcfg_pull_none>;
        };
 };
index b1ac3a89f259cdcab1842f2e161774a554f814a6..aa3e21bd6c8f44ff5f9b249dd43b56316dbc2a60 100644 (file)
@@ -62,7 +62,6 @@
        vcc5v0_host: vcc5v0-host-regulator {
                compatible = "regulator-fixed";
                gpio = <&gpio4 RK_PA3 GPIO_ACTIVE_LOW>;
-               enable-active-low;
                pinctrl-names = "default";
                pinctrl-0 = <&vcc5v0_host_en>;
                regulator-name = "vcc5v0_host";
index d943559b157cec08d62dbc2cc4748f033131e5a6..a05460b924153ec3df73fb9e311096b9ed3e4f87 100644 (file)
 
        vcc3v3_sd: vcc3v3_sd {
                compatible = "regulator-fixed";
-               enable-active-low;
                gpio = <&gpio0 RK_PA5 GPIO_ACTIVE_LOW>;
                pinctrl-names = "default";
                pinctrl-0 = <&vcc_sd_h>;
index 02d5f5a8ca036171f715114212eb9df5b7042d0c..528bb4e8ac776beee1b111dda93c2db93157236a 100644 (file)
        disable-wp;
        pinctrl-names = "default";
        pinctrl-0 = <&sdmmc0_bus4 &sdmmc0_clk &sdmmc0_cmd &sdmmc0_det>;
-       sd-uhs-sdr104;
+       sd-uhs-sdr50;
        vmmc-supply = <&vcc3v3_sd>;
        vqmmc-supply = <&vccio_sd>;
        status = "okay";
index 5e34bd0b214d624c0ec13c0c9683a25403d68965..93d383b8be878ac20d891b5fcadf3a88f24443bb 100644 (file)
 };
 
 &usb_host0_xhci {
-       extcon = <&usb2phy0>;
+       dr_mode = "host";
        status = "okay";
 };
 
index 6ff89ff95ad1c9ff00ca3855af6e7be3fc8e8bd9..674792567fa6e288c94169406cd69b0e2262d5b2 100644 (file)
 };
 
 &usb2phy0_otg {
-       vbus-supply = <&vcc5v0_usb_otg>;
+       phy-supply = <&vcc5v0_usb_otg>;
        status = "okay";
 };
 
index 6b5093a1a6cf5ca242309eb635b7adac49a4185e..b2e040dffb5913da994c24343050881ae40df7df 100644 (file)
 };
 
 &usb2phy0_otg {
-       vbus-supply = <&vcc5v0_usb_otg>;
+       phy-supply = <&vcc5v0_usb_otg>;
        status = "okay";
 };
 
index d5b2d2dd49043d26aaa71a7e996c083fc75963df..5b167649097edc5aee5f7564cfeb529903095948 100644 (file)
@@ -48,6 +48,7 @@ CONFIG_ARCH_KEEMBAY=y
 CONFIG_ARCH_MEDIATEK=y
 CONFIG_ARCH_MESON=y
 CONFIG_ARCH_MVEBU=y
+CONFIG_ARCH_NXP=y
 CONFIG_ARCH_MXC=y
 CONFIG_ARCH_NPCM=y
 CONFIG_ARCH_QCOM=y
index 2ff0ef62abadc8cbf01a23b4b1df4f46039b55f7..917086be5c6b105186f7b4d8de5754738876c640 100644 (file)
@@ -2114,7 +2114,7 @@ static int finalize_hyp_mode(void)
         * at, which would end badly once inaccessible.
         */
        kmemleak_free_part(__hyp_bss_start, __hyp_bss_end - __hyp_bss_start);
-       kmemleak_free_part(__va(hyp_mem_base), hyp_mem_size);
+       kmemleak_free_part_phys(hyp_mem_base, hyp_mem_size);
        return pkvm_drop_host_privileges();
 }
 
index 7a623684d9b5ed415e167af74e0b9af22ea5d74c..2d5a0bcb0cec156dc5f0daedbdd7c56ff8d62ca4 100644 (file)
@@ -50,6 +50,7 @@ struct clk *clk_get_io(void)
 {
        return &cpu_clk_generic[2];
 }
+EXPORT_SYMBOL_GPL(clk_get_io);
 
 struct clk *clk_get_ppe(void)
 {
index 794c96c2a4cdd96cbaedb651b36a0421b09cbf37..311dc1580bbde98e59f33f508afba7695714923d 100644 (file)
@@ -98,7 +98,7 @@ int ls1x_eth_mux_init(struct platform_device *pdev, void *priv)
        if (plat_dat->bus_id) {
                __raw_writel(__raw_readl(LS1X_MUX_CTRL0) | GMAC1_USE_UART1 |
                             GMAC1_USE_UART0, LS1X_MUX_CTRL0);
-               switch (plat_dat->interface) {
+               switch (plat_dat->phy_interface) {
                case PHY_INTERFACE_MODE_RGMII:
                        val &= ~(GMAC1_USE_TXCLK | GMAC1_USE_PWM23);
                        break;
@@ -107,12 +107,12 @@ int ls1x_eth_mux_init(struct platform_device *pdev, void *priv)
                        break;
                default:
                        pr_err("unsupported mii mode %d\n",
-                              plat_dat->interface);
+                              plat_dat->phy_interface);
                        return -ENOTSUPP;
                }
                val &= ~GMAC1_SHUT;
        } else {
-               switch (plat_dat->interface) {
+               switch (plat_dat->phy_interface) {
                case PHY_INTERFACE_MODE_RGMII:
                        val &= ~(GMAC0_USE_TXCLK | GMAC0_USE_PWM01);
                        break;
@@ -121,7 +121,7 @@ int ls1x_eth_mux_init(struct platform_device *pdev, void *priv)
                        break;
                default:
                        pr_err("unsupported mii mode %d\n",
-                              plat_dat->interface);
+                              plat_dat->phy_interface);
                        return -ENOTSUPP;
                }
                val &= ~GMAC0_SHUT;
@@ -131,7 +131,7 @@ int ls1x_eth_mux_init(struct platform_device *pdev, void *priv)
        plat_dat = dev_get_platdata(&pdev->dev);
 
        val &= ~PHY_INTF_SELI;
-       if (plat_dat->interface == PHY_INTERFACE_MODE_RMII)
+       if (plat_dat->phy_interface == PHY_INTERFACE_MODE_RMII)
                val |= 0x4 << PHY_INTF_SELI_SHIFT;
        __raw_writel(val, LS1X_MUX_CTRL1);
 
@@ -146,9 +146,9 @@ static struct plat_stmmacenet_data ls1x_eth0_pdata = {
        .bus_id                 = 0,
        .phy_addr               = -1,
 #if defined(CONFIG_LOONGSON1_LS1B)
-       .interface              = PHY_INTERFACE_MODE_MII,
+       .phy_interface          = PHY_INTERFACE_MODE_MII,
 #elif defined(CONFIG_LOONGSON1_LS1C)
-       .interface              = PHY_INTERFACE_MODE_RMII,
+       .phy_interface          = PHY_INTERFACE_MODE_RMII,
 #endif
        .mdio_bus_data          = &ls1x_mdio_bus_data,
        .dma_cfg                = &ls1x_eth_dma_cfg,
@@ -186,7 +186,7 @@ struct platform_device ls1x_eth0_pdev = {
 static struct plat_stmmacenet_data ls1x_eth1_pdata = {
        .bus_id                 = 1,
        .phy_addr               = -1,
-       .interface              = PHY_INTERFACE_MODE_MII,
+       .phy_interface          = PHY_INTERFACE_MODE_MII,
        .mdio_bus_data          = &ls1x_mdio_bus_data,
        .dma_cfg                = &ls1x_eth_dma_cfg,
        .has_gmac               = 1,
index 9aede2447011bc13f2fa11081d4ddb350784f285..a98940e6424327fe5a5232dc0613404c5c559ae4 100644 (file)
@@ -224,8 +224,18 @@ config MLONGCALLS
          Enabling this option will probably slow down your kernel.
 
 config 64BIT
-       def_bool "$(ARCH)" = "parisc64"
+       def_bool y if "$(ARCH)" = "parisc64"
+       bool "64-bit kernel" if "$(ARCH)" = "parisc"
        depends on PA8X00
+       help
+         Enable this if you want to support 64bit kernel on PA-RISC platform.
+
+         At the moment, only people willing to use more than 2GB of RAM,
+         or having a 64bit-only capable PA-RISC machine should say Y here.
+
+         Since there is no 64bit userland on PA-RISC, there is no point to
+         enable this option otherwise. The 64bit kernel is significantly bigger
+         and slower than the 32bit one.
 
 choice
        prompt "Kernel page size"
index ed66c31e465590f94c447a1fee2b590e237073e2..59d18881f35be48ebc505a30ff80ea7c4c38d0fc 100644 (file)
@@ -386,6 +386,7 @@ config RISCV_ISA_C
 config RISCV_ISA_SVPBMT
        bool "SVPBMT extension support"
        depends on 64BIT && MMU
+       depends on !XIP_KERNEL
        select RISCV_ALTERNATIVE
        default y
        help
index 6850e9389930240eab28852e1c4f8f7bd3f07fc3..f3623df23b5fcd902339552e303c257a4dd6efa4 100644 (file)
@@ -46,7 +46,7 @@ config ERRATA_THEAD
 
 config ERRATA_THEAD_PBMT
        bool "Apply T-Head memory type errata"
-       depends on ERRATA_THEAD && 64BIT
+       depends on ERRATA_THEAD && 64BIT && MMU
        select RISCV_ALTERNATIVE_EARLY
        default y
        help
@@ -57,7 +57,7 @@ config ERRATA_THEAD_PBMT
 
 config ERRATA_THEAD_CMO
        bool "Apply T-Head cache management errata"
-       depends on ERRATA_THEAD
+       depends on ERRATA_THEAD && MMU
        select RISCV_DMA_NONCOHERENT
        default y
        help
index 202c83f677b2ede1bc0992fffb91442930ffa74b..96648c176f374f10ab3ec079a5480f73dcdb2229 100644 (file)
@@ -37,6 +37,7 @@ static bool errata_probe_cmo(unsigned int stage,
        if (stage == RISCV_ALTERNATIVES_EARLY_BOOT)
                return false;
 
+       riscv_cbom_block_size = L1_CACHE_BYTES;
        riscv_noncoherent_supported();
        return true;
 #else
index a60acaecfedab6ad09e578b1f1a98b04a08541c7..273ece6b622f62726f1c36bc7b9d8305f5df4fea 100644 (file)
@@ -42,6 +42,11 @@ void flush_icache_mm(struct mm_struct *mm, bool local);
 
 #endif /* CONFIG_SMP */
 
+/*
+ * The T-Head CMO errata internally probe the CBOM block size, but otherwise
+ * don't depend on Zicbom.
+ */
+extern unsigned int riscv_cbom_block_size;
 #ifdef CONFIG_RISCV_ISA_ZICBOM
 void riscv_init_cbom_blocksize(void);
 #else
index 95ef6e2bf45c02faffaa4228ae50393d9146c6fd..2dfc463b86bb3d7b601b30d83360b9a4b1492826 100644 (file)
@@ -296,8 +296,8 @@ void __init setup_arch(char **cmdline_p)
        setup_smp();
 #endif
 
-       riscv_fill_hwcap();
        riscv_init_cbom_blocksize();
+       riscv_fill_hwcap();
        apply_boot_alternatives();
 }
 
index 5a2de6b6f882239c37d471b40cfeb683529c5554..5c591123c440910594f0051be1bb6387d72d05d6 100644 (file)
@@ -124,6 +124,8 @@ SYSCALL_DEFINE0(rt_sigreturn)
        if (restore_altstack(&frame->uc.uc_stack))
                goto badframe;
 
+       regs->cause = -1UL;
+
        return regs->a0;
 
 badframe:
index cd2225304c82e2c4efd349a04e93f41a2adfa005..e3f9bdf47c5ff8ea0137540d83875557f192553f 100644 (file)
@@ -12,7 +12,7 @@
 #include <linux/of_device.h>
 #include <asm/cacheflush.h>
 
-static unsigned int riscv_cbom_block_size = L1_CACHE_BYTES;
+unsigned int riscv_cbom_block_size;
 static bool noncoherent_supported;
 
 void arch_sync_dma_for_device(phys_addr_t paddr, size_t size,
@@ -79,38 +79,41 @@ void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
 void riscv_init_cbom_blocksize(void)
 {
        struct device_node *node;
+       unsigned long cbom_hartid;
+       u32 val, probed_block_size;
        int ret;
-       u32 val;
 
+       probed_block_size = 0;
        for_each_of_cpu_node(node) {
                unsigned long hartid;
-               int cbom_hartid;
 
                ret = riscv_of_processor_hartid(node, &hartid);
                if (ret)
                        continue;
 
-               if (hartid < 0)
-                       continue;
-
                /* set block-size for cbom extension if available */
                ret = of_property_read_u32(node, "riscv,cbom-block-size", &val);
                if (ret)
                        continue;
 
-               if (!riscv_cbom_block_size) {
-                       riscv_cbom_block_size = val;
+               if (!probed_block_size) {
+                       probed_block_size = val;
                        cbom_hartid = hartid;
                } else {
-                       if (riscv_cbom_block_size != val)
-                               pr_warn("cbom-block-size mismatched between harts %d and %lu\n",
+                       if (probed_block_size != val)
+                               pr_warn("cbom-block-size mismatched between harts %lu and %lu\n",
                                        cbom_hartid, hartid);
                }
        }
+
+       if (probed_block_size)
+               riscv_cbom_block_size = probed_block_size;
 }
 #endif
 
 void riscv_noncoherent_supported(void)
 {
+       WARN(!riscv_cbom_block_size,
+            "Non-coherent DMA support enabled without a block size\n");
        noncoherent_supported = true;
 }
index 082ec5f2c3a542dbeb48d1f7358bfb1b4545ad23..0243b6e38d364cf005d99803742d55d4c73631b0 100644 (file)
@@ -489,6 +489,8 @@ enum prot_type {
        PROT_TYPE_ALC  = 2,
        PROT_TYPE_DAT  = 3,
        PROT_TYPE_IEP  = 4,
+       /* Dummy value for passing an initialized value when code != PGM_PROTECTION */
+       PROT_NONE,
 };
 
 static int trans_exc_ending(struct kvm_vcpu *vcpu, int code, unsigned long gva, u8 ar,
@@ -504,6 +506,10 @@ static int trans_exc_ending(struct kvm_vcpu *vcpu, int code, unsigned long gva,
        switch (code) {
        case PGM_PROTECTION:
                switch (prot) {
+               case PROT_NONE:
+                       /* We should never get here, acts like termination */
+                       WARN_ON_ONCE(1);
+                       break;
                case PROT_TYPE_IEP:
                        tec->b61 = 1;
                        fallthrough;
@@ -968,8 +974,10 @@ static int guest_range_to_gpas(struct kvm_vcpu *vcpu, unsigned long ga, u8 ar,
                                return rc;
                } else {
                        gpa = kvm_s390_real_to_abs(vcpu, ga);
-                       if (kvm_is_error_gpa(vcpu->kvm, gpa))
+                       if (kvm_is_error_gpa(vcpu->kvm, gpa)) {
                                rc = PGM_ADDRESSING;
+                               prot = PROT_NONE;
+                       }
                }
                if (rc)
                        return trans_exc(vcpu, rc, ga, ar, mode, prot);
@@ -1112,8 +1120,6 @@ int access_guest_with_key(struct kvm_vcpu *vcpu, unsigned long ga, u8 ar,
                if (rc == PGM_PROTECTION && try_storage_prot_override)
                        rc = access_guest_page_with_key(vcpu->kvm, mode, gpas[idx],
                                                        data, fragment_len, PAGE_SPO_ACC);
-               if (rc == PGM_PROTECTION)
-                       prot = PROT_TYPE_KEYC;
                if (rc)
                        break;
                len -= fragment_len;
@@ -1123,6 +1129,10 @@ int access_guest_with_key(struct kvm_vcpu *vcpu, unsigned long ga, u8 ar,
        if (rc > 0) {
                bool terminate = (mode == GACC_STORE) && (idx > 0);
 
+               if (rc == PGM_PROTECTION)
+                       prot = PROT_TYPE_KEYC;
+               else
+                       prot = PROT_NONE;
                rc = trans_exc_ending(vcpu, rc, ga, ar, mode, prot, terminate);
        }
 out_unlock:
index b9c944b262c7955c3a7ce0d51fbf352867d065e0..ab569faf0df241a8bbc03a05e9aa28870c22b61c 100644 (file)
@@ -3324,7 +3324,7 @@ static void aen_host_forward(unsigned long si)
        if (gaite->count == 0)
                return;
        if (gaite->aisb != 0)
-               set_bit_inv(gaite->aisbo, (unsigned long *)gaite->aisb);
+               set_bit_inv(gaite->aisbo, phys_to_virt(gaite->aisb));
 
        kvm = kvm_s390_pci_si_to_kvm(aift, si);
        if (!kvm)
index edfd4bbd0cbae345c8375b35e9ffa2b9e368bdf7..b7ef0b71014df3dd8d92467cad741bfbdf0f06ea 100644 (file)
@@ -505,7 +505,7 @@ int kvm_arch_init(void *opaque)
                goto out;
        }
 
-       if (kvm_s390_pci_interp_allowed()) {
+       if (IS_ENABLED(CONFIG_VFIO_PCI_ZDEV_KVM)) {
                rc = kvm_s390_pci_init();
                if (rc) {
                        pr_err("Unable to allocate AIFT for PCI\n");
@@ -527,7 +527,7 @@ out:
 void kvm_arch_exit(void)
 {
        kvm_s390_gib_destroy();
-       if (kvm_s390_pci_interp_allowed())
+       if (IS_ENABLED(CONFIG_VFIO_PCI_ZDEV_KVM))
                kvm_s390_pci_exit();
        debug_unregister(kvm_s390_dbf);
        debug_unregister(kvm_s390_dbf_uv);
index bb8c335d17b924b1ca4d28055aa834242ba90b96..c50c1645c0aeca81dab6dc2aa9b61b91604adda2 100644 (file)
@@ -58,7 +58,7 @@ static int zpci_setup_aipb(u8 nisc)
        if (!zpci_aipb)
                return -ENOMEM;
 
-       aift->sbv = airq_iv_create(ZPCI_NR_DEVICES, AIRQ_IV_ALLOC, 0);
+       aift->sbv = airq_iv_create(ZPCI_NR_DEVICES, AIRQ_IV_ALLOC, NULL);
        if (!aift->sbv) {
                rc = -ENOMEM;
                goto free_aipb;
@@ -71,7 +71,7 @@ static int zpci_setup_aipb(u8 nisc)
                rc = -ENOMEM;
                goto free_sbv;
        }
-       aift->gait = (struct zpci_gaite *)page_to_phys(page);
+       aift->gait = (struct zpci_gaite *)page_to_virt(page);
 
        zpci_aipb->aipb.faisb = virt_to_phys(aift->sbv->vector);
        zpci_aipb->aipb.gait = virt_to_phys(aift->gait);
@@ -373,7 +373,7 @@ static int kvm_s390_pci_aif_disable(struct zpci_dev *zdev, bool force)
                gaite->gisc = 0;
                gaite->aisbo = 0;
                gaite->gisa = 0;
-               aift->kzdev[zdev->aisb] = 0;
+               aift->kzdev[zdev->aisb] = NULL;
                /* Clear zdev info */
                airq_iv_free_bit(aift->sbv, zdev->aisb);
                airq_iv_release(zdev->aibv);
@@ -672,23 +672,31 @@ out:
 
 int kvm_s390_pci_init(void)
 {
+       zpci_kvm_hook.kvm_register = kvm_s390_pci_register_kvm;
+       zpci_kvm_hook.kvm_unregister = kvm_s390_pci_unregister_kvm;
+
+       if (!kvm_s390_pci_interp_allowed())
+               return 0;
+
        aift = kzalloc(sizeof(struct zpci_aift), GFP_KERNEL);
        if (!aift)
                return -ENOMEM;
 
        spin_lock_init(&aift->gait_lock);
        mutex_init(&aift->aift_lock);
-       zpci_kvm_hook.kvm_register = kvm_s390_pci_register_kvm;
-       zpci_kvm_hook.kvm_unregister = kvm_s390_pci_unregister_kvm;
 
        return 0;
 }
 
 void kvm_s390_pci_exit(void)
 {
-       mutex_destroy(&aift->aift_lock);
        zpci_kvm_hook.kvm_register = NULL;
        zpci_kvm_hook.kvm_unregister = NULL;
 
+       if (!kvm_s390_pci_interp_allowed())
+               return;
+
+       mutex_destroy(&aift->aift_lock);
+
        kfree(aift);
 }
index 3a3606c3a0fe3d5d558032138d7fd76553387e21..486d06ef563f4f65572dda0668b67b976c7f7932 100644 (file)
@@ -46,9 +46,9 @@ extern struct zpci_aift *aift;
 static inline struct kvm *kvm_s390_pci_si_to_kvm(struct zpci_aift *aift,
                                                 unsigned long si)
 {
-       if (!IS_ENABLED(CONFIG_VFIO_PCI_ZDEV_KVM) || aift->kzdev == 0 ||
-           aift->kzdev[si] == 0)
-               return 0;
+       if (!IS_ENABLED(CONFIG_VFIO_PCI_ZDEV_KVM) || !aift->kzdev ||
+           !aift->kzdev[si])
+               return NULL;
        return aift->kzdev[si]->kvm;
 };
 
index f2fe63bfd819f5f07971d4e4d50cbecec983173d..f1d4d67157be0bf568ca476aed3508b9c9fd2f8f 100644 (file)
@@ -132,10 +132,18 @@ export LDS_ELF_FORMAT := $(ELF_FORMAT)
 # The wrappers will select whether using "malloc" or the kernel allocator.
 LINK_WRAPS = -Wl,--wrap,malloc -Wl,--wrap,free -Wl,--wrap,calloc
 
+# Avoid binutils 2.39+ warnings by marking the stack non-executable and
+# ignorning warnings for the kallsyms sections.
+LDFLAGS_EXECSTACK = -z noexecstack
+ifeq ($(CONFIG_LD_IS_BFD),y)
+LDFLAGS_EXECSTACK += $(call ld-option,--no-warn-rwx-segments)
+endif
+
 LD_FLAGS_CMDLINE = $(foreach opt,$(KBUILD_LDFLAGS),-Wl,$(opt))
 
 # Used by link-vmlinux.sh which has special support for um link
 export CFLAGS_vmlinux := $(LINK-y) $(LINK_WRAPS) $(LD_FLAGS_CMDLINE)
+export LDFLAGS_vmlinux := $(LDFLAGS_EXECSTACK)
 
 # When cleaning we don't include .config, so we don't include
 # TT or skas makefiles and don't clean skas_ptregs.h.
index 7452f70d50d06924dbe0039db140ca8a0d0db2db..746715379f12a84abcfe991b3a23218eec7e0fc3 100644 (file)
@@ -48,7 +48,8 @@ void show_stack(struct task_struct *task, unsigned long *stack,
                        break;
                if (i && ((i % STACKSLOTS_PER_LINE) == 0))
                        pr_cont("\n");
-               pr_cont(" %08lx", *stack++);
+               pr_cont(" %08lx", READ_ONCE_NOCHECK(*stack));
+               stack++;
        }
 
        printk("%sCall Trace:\n", loglvl);
index e0de60e503b983c2ab6a2f215c688bf14161e59e..d9e023c78f568fe8c22eb9f7ae07f0cba0a716df 100644 (file)
@@ -33,7 +33,7 @@
 #include "um_arch.h"
 
 #define DEFAULT_COMMAND_LINE_ROOT "root=98:0"
-#define DEFAULT_COMMAND_LINE_CONSOLE "console=tty"
+#define DEFAULT_COMMAND_LINE_CONSOLE "console=tty0"
 
 /* Changed in add_arg and setup_arch, which run before SMP is started */
 static char __initdata command_line[COMMAND_LINE_SIZE] = { 0 };
index 2c96c43c313a260659f82a822afe2a7f9c8a78ce..aa381ab69a1911ffb5afde4e49dc26ab67edc783 100644 (file)
@@ -729,6 +729,7 @@ struct kvm_vcpu_arch {
        struct fpu_guest guest_fpu;
 
        u64 xcr0;
+       u64 guest_supported_xcr0;
 
        struct kvm_pio_request pio;
        void *pio_data;
index 75dcf7a72605f335d0f104b26986d17cc5cd81ec..4c1c2c06e96bb261ee0884adf192f06e231c0c78 100644 (file)
@@ -315,7 +315,6 @@ static void kvm_vcpu_after_set_cpuid(struct kvm_vcpu *vcpu)
 {
        struct kvm_lapic *apic = vcpu->arch.apic;
        struct kvm_cpuid_entry2 *best;
-       u64 guest_supported_xcr0;
 
        best = kvm_find_cpuid_entry(vcpu, 1);
        if (best && apic) {
@@ -327,10 +326,16 @@ static void kvm_vcpu_after_set_cpuid(struct kvm_vcpu *vcpu)
                kvm_apic_set_version(vcpu);
        }
 
-       guest_supported_xcr0 =
+       vcpu->arch.guest_supported_xcr0 =
                cpuid_get_supported_xcr0(vcpu->arch.cpuid_entries, vcpu->arch.cpuid_nent);
 
-       vcpu->arch.guest_fpu.fpstate->user_xfeatures = guest_supported_xcr0;
+       /*
+        * FP+SSE can always be saved/restored via KVM_{G,S}ET_XSAVE, even if
+        * XSAVE/XCRO are not exposed to the guest, and even if XSAVE isn't
+        * supported by the host.
+        */
+       vcpu->arch.guest_fpu.fpstate->user_xfeatures = vcpu->arch.guest_supported_xcr0 |
+                                                      XFEATURE_MASK_FPSSE;
 
        kvm_update_pv_runtime(vcpu);
 
index d5ec3a2ed5a44f32e01a50684ae2dde6b658516d..aacb28c83e437d83712ed029c47f59ffc7c6cde7 100644 (file)
@@ -4132,6 +4132,9 @@ static int em_xsetbv(struct x86_emulate_ctxt *ctxt)
 {
        u32 eax, ecx, edx;
 
+       if (!(ctxt->ops->get_cr(ctxt, 4) & X86_CR4_OSXSAVE))
+               return emulate_ud(ctxt);
+
        eax = reg_read(ctxt, VCPU_REGS_RAX);
        edx = reg_read(ctxt, VCPU_REGS_RDX);
        ecx = reg_read(ctxt, VCPU_REGS_RCX);
index e418ef3ecfcb8cd73c8f0fed3dc8cfe4e05314ac..3552e6af3684437f66f1d6a864499095bf176c74 100644 (file)
@@ -1596,6 +1596,8 @@ static void __rmap_add(struct kvm *kvm,
        rmap_head = gfn_to_rmap(gfn, sp->role.level, slot);
        rmap_count = pte_list_add(cache, spte, rmap_head);
 
+       if (rmap_count > kvm->stat.max_mmu_rmap_size)
+               kvm->stat.max_mmu_rmap_size = rmap_count;
        if (rmap_count > RMAP_RECYCLE_THRESHOLD) {
                kvm_zap_all_rmap_sptes(kvm, rmap_head);
                kvm_flush_remote_tlbs_with_address(
index 43a6a7efc6ece04365b20be62893a521bd29c7c0..b0c47b41c264982c993a098e738fa2ef8f9e6add 100644 (file)
@@ -1011,15 +1011,10 @@ void kvm_load_host_xsave_state(struct kvm_vcpu *vcpu)
 }
 EXPORT_SYMBOL_GPL(kvm_load_host_xsave_state);
 
-static inline u64 kvm_guest_supported_xcr0(struct kvm_vcpu *vcpu)
-{
-       return vcpu->arch.guest_fpu.fpstate->user_xfeatures;
-}
-
 #ifdef CONFIG_X86_64
 static inline u64 kvm_guest_supported_xfd(struct kvm_vcpu *vcpu)
 {
-       return kvm_guest_supported_xcr0(vcpu) & XFEATURE_MASK_USER_DYNAMIC;
+       return vcpu->arch.guest_supported_xcr0 & XFEATURE_MASK_USER_DYNAMIC;
 }
 #endif
 
@@ -1042,7 +1037,7 @@ static int __kvm_set_xcr(struct kvm_vcpu *vcpu, u32 index, u64 xcr)
         * saving.  However, xcr0 bit 0 is always set, even if the
         * emulated CPU does not support XSAVE (see kvm_vcpu_reset()).
         */
-       valid_bits = kvm_guest_supported_xcr0(vcpu) | XFEATURE_MASK_FP;
+       valid_bits = vcpu->arch.guest_supported_xcr0 | XFEATURE_MASK_FP;
        if (xcr0 & ~valid_bits)
                return 1;
 
@@ -1070,6 +1065,7 @@ static int __kvm_set_xcr(struct kvm_vcpu *vcpu, u32 index, u64 xcr)
 
 int kvm_emulate_xsetbv(struct kvm_vcpu *vcpu)
 {
+       /* Note, #UD due to CR4.OSXSAVE=0 has priority over the intercept. */
        if (static_call(kvm_x86_get_cpl)(vcpu) != 0 ||
            __kvm_set_xcr(vcpu, kvm_rcx_read(vcpu), kvm_read_edx_eax(vcpu))) {
                kvm_inject_gp(vcpu, 0);
index 68fd2cf526fd7e47f0dd823db12e8389b01ed6b9..f6e9f84397e792d5f3ba3102f6c10cfe7b57aae6 100644 (file)
@@ -6,10 +6,9 @@
 #include <asm/unistd.h>
 #include <sysdep/ptrace.h>
 
-typedef long syscall_handler_t(struct pt_regs);
+typedef long syscall_handler_t(struct syscall_args);
 
 extern syscall_handler_t *sys_call_table[];
 
 #define EXECUTE_SYSCALL(syscall, regs) \
-       ((long (*)(struct syscall_args)) \
-        (*sys_call_table[syscall]))(SYSCALL_ARGS(&regs->regs))
+       ((*sys_call_table[syscall]))(SYSCALL_ARGS(&regs->regs))
index ac8eee093f9cd0fa112fe89e945202eb60203a84..66162eafd8e8f8770935451b555c644dc5aca688 100644 (file)
@@ -65,9 +65,6 @@ static int get_free_idx(struct task_struct* task)
        struct thread_struct *t = &task->thread;
        int idx;
 
-       if (!t->arch.tls_array)
-               return GDT_ENTRY_TLS_MIN;
-
        for (idx = 0; idx < GDT_ENTRY_TLS_ENTRIES; idx++)
                if (!t->arch.tls_array[idx].present)
                        return idx + GDT_ENTRY_TLS_MIN;
@@ -240,9 +237,6 @@ static int get_tls_entry(struct task_struct *task, struct user_desc *info,
 {
        struct thread_struct *t = &task->thread;
 
-       if (!t->arch.tls_array)
-               goto clear;
-
        if (idx < GDT_ENTRY_TLS_MIN || idx > GDT_ENTRY_TLS_MAX)
                return -EINVAL;
 
index 8c0396fd0e6f691e72a36bad703cf4172f8693da..6fbe97c52c991e2f71cd917d1cbaa6b4bf9ffcf4 100644 (file)
@@ -65,7 +65,7 @@ quiet_cmd_vdso = VDSO    $@
                       -Wl,-T,$(filter %.lds,$^) $(filter %.o,$^) && \
                 sh $(srctree)/$(src)/checkundef.sh '$(NM)' '$@'
 
-VDSO_LDFLAGS = -fPIC -shared -Wl,--hash-style=sysv
+VDSO_LDFLAGS = -fPIC -shared -Wl,--hash-style=sysv -z noexecstack
 GCOV_PROFILE := n
 
 #
index a0d1104c5590c16b9484c925ac387b571e1f15ed..651057c4146b2ace71a4908c937df092483357bc 100644 (file)
@@ -295,7 +295,7 @@ int blk_queue_enter(struct request_queue *q, blk_mq_req_flags_t flags)
 
        while (!blk_try_enter_queue(q, pm)) {
                if (flags & BLK_MQ_REQ_NOWAIT)
-                       return -EBUSY;
+                       return -EAGAIN;
 
                /*
                 * read pair of barrier in blk_freeze_queue_start(), we need to
@@ -325,7 +325,7 @@ int __bio_queue_enter(struct request_queue *q, struct bio *bio)
                        if (test_bit(GD_DEAD, &disk->state))
                                goto dead;
                        bio_wouldblock_error(bio);
-                       return -EBUSY;
+                       return -EAGAIN;
                }
 
                /*
index 67e6dbc1ae8179594a57e89e87d6d247af358940..e59c3069e8351f7edf0d82c6a3b376a3029a994c 100644 (file)
@@ -309,6 +309,11 @@ int blkdev_issue_secure_erase(struct block_device *bdev, sector_t sector,
        struct blk_plug plug;
        int ret = 0;
 
+       /* make sure that "len << SECTOR_SHIFT" doesn't overflow */
+       if (max_sectors > UINT_MAX >> SECTOR_SHIFT)
+               max_sectors = UINT_MAX >> SECTOR_SHIFT;
+       max_sectors &= ~bs_mask;
+
        if (max_sectors == 0)
                return -EOPNOTSUPP;
        if ((sector | nr_sects) & bs_mask)
@@ -322,10 +327,10 @@ int blkdev_issue_secure_erase(struct block_device *bdev, sector_t sector,
 
                bio = blk_next_bio(bio, bdev, 0, REQ_OP_SECURE_ERASE, gfp);
                bio->bi_iter.bi_sector = sector;
-               bio->bi_iter.bi_size = len;
+               bio->bi_iter.bi_size = len << SECTOR_SHIFT;
 
-               sector += len << SECTOR_SHIFT;
-               nr_sects -= len << SECTOR_SHIFT;
+               sector += len;
+               nr_sects -= len;
                if (!nr_sects) {
                        ret = submit_bio_wait(bio);
                        bio_put(bio);
index d4f1e4e9603a400308e514350a2f3ec330c9cbaf..85e00701473cb121ab668c97a2b5c875e082615a 100644 (file)
@@ -31,14 +31,14 @@ struct udma_dev *of_xudma_dev_get(struct device_node *np, const char *property)
        }
 
        pdev = of_find_device_by_node(udma_node);
+       if (np != udma_node)
+               of_node_put(udma_node);
+
        if (!pdev) {
                pr_debug("UDMA device not found\n");
                return ERR_PTR(-EPROBE_DEFER);
        }
 
-       if (np != udma_node)
-               of_node_put(udma_node);
-
        ud = platform_get_drvdata(pdev);
        if (!ud) {
                pr_debug("UDMA has not been probed\n");
index 6276934d4d2be9e3345c20921c5cdfce941f4a79..8cd4e69dc7b4c24b334c450562c2a88925b0f452 100644 (file)
@@ -3040,9 +3040,10 @@ static int xilinx_dma_probe(struct platform_device *pdev)
 
        /* Request and map I/O memory */
        xdev->regs = devm_platform_ioremap_resource(pdev, 0);
-       if (IS_ERR(xdev->regs))
-               return PTR_ERR(xdev->regs);
-
+       if (IS_ERR(xdev->regs)) {
+               err = PTR_ERR(xdev->regs);
+               goto disable_clks;
+       }
        /* Retrieve the DMA engine properties from the device tree */
        xdev->max_buffer_len = GENMASK(XILINX_DMA_MAX_TRANS_LEN_MAX - 1, 0);
        xdev->s2mm_chan_id = xdev->dma_config->max_channels / 2;
@@ -3070,7 +3071,7 @@ static int xilinx_dma_probe(struct platform_device *pdev)
                if (err < 0) {
                        dev_err(xdev->dev,
                                "missing xlnx,num-fstores property\n");
-                       return err;
+                       goto disable_clks;
                }
 
                err = of_property_read_u32(node, "xlnx,flush-fsync",
@@ -3090,7 +3091,11 @@ static int xilinx_dma_probe(struct platform_device *pdev)
                xdev->ext_addr = false;
 
        /* Set the dma mask bits */
-       dma_set_mask_and_coherent(xdev->dev, DMA_BIT_MASK(addr_width));
+       err = dma_set_mask_and_coherent(xdev->dev, DMA_BIT_MASK(addr_width));
+       if (err < 0) {
+               dev_err(xdev->dev, "DMA mask error %d\n", err);
+               goto disable_clks;
+       }
 
        /* Initialize the DMA engine */
        xdev->common.dev = &pdev->dev;
@@ -3137,7 +3142,7 @@ static int xilinx_dma_probe(struct platform_device *pdev)
        for_each_child_of_node(node, child) {
                err = xilinx_dma_child_probe(xdev, child);
                if (err < 0)
-                       goto disable_clks;
+                       goto error;
        }
 
        if (xdev->dma_config->dmatype == XDMA_TYPE_VDMA) {
@@ -3172,12 +3177,12 @@ static int xilinx_dma_probe(struct platform_device *pdev)
 
        return 0;
 
-disable_clks:
-       xdma_disable_allclks(xdev);
 error:
        for (i = 0; i < xdev->dma_config->max_channels; i++)
                if (xdev->chan[i])
                        xilinx_dma_chan_remove(xdev->chan[i]);
+disable_clks:
+       xdma_disable_allclks(xdev);
 
        return err;
 }
index dc299ab3681803ce094cafaaba1d7fa92168baf4..3f4ee39543840095c4a0a97cd2b9740afe174e7a 100644 (file)
@@ -849,7 +849,7 @@ static struct dma_async_tx_descriptor *zynqmp_dma_prep_memcpy(
 
        zynqmp_dma_desc_config_eod(chan, desc);
        async_tx_ack(&first->async_tx);
-       first->async_tx.flags = flags;
+       first->async_tx.flags = (enum dma_ctrl_flags)flags;
        return &first->async_tx;
 }
 
index 3ed7ae0d6781e560a69ed79935acabb1c8266235..96060bf90a24abd63c36a9f702e6c633c01083a1 100644 (file)
@@ -450,9 +450,13 @@ static int scmi_clock_count_get(const struct scmi_protocol_handle *ph)
 static const struct scmi_clock_info *
 scmi_clock_info_get(const struct scmi_protocol_handle *ph, u32 clk_id)
 {
+       struct scmi_clock_info *clk;
        struct clock_info *ci = ph->get_priv(ph);
-       struct scmi_clock_info *clk = ci->clk + clk_id;
 
+       if (clk_id >= ci->num_clocks)
+               return NULL;
+
+       clk = ci->clk + clk_id;
        if (!clk->name[0])
                return NULL;
 
index 8abace56b95885da4ccb9d52488083996c234e9e..f42dad997ac9a50a947191f55d19a05a1c3d08ba 100644 (file)
@@ -106,6 +106,7 @@ enum scmi_optee_pta_cmd {
  * @channel_id: OP-TEE channel ID used for this transport
  * @tee_session: TEE session identifier
  * @caps: OP-TEE SCMI channel capabilities
+ * @rx_len: Response size
  * @mu: Mutex protection on channel access
  * @cinfo: SCMI channel information
  * @shmem: Virtual base address of the shared memory
index 673f3eb498f43483c1ece184c98d8c4b3ce5aef0..e9afa8cab730949ae65b1199283e94cbbe205f78 100644 (file)
@@ -166,9 +166,13 @@ static int scmi_domain_reset(const struct scmi_protocol_handle *ph, u32 domain,
        struct scmi_xfer *t;
        struct scmi_msg_reset_domain_reset *dom;
        struct scmi_reset_info *pi = ph->get_priv(ph);
-       struct reset_dom_info *rdom = pi->dom_info + domain;
+       struct reset_dom_info *rdom;
 
-       if (rdom->async_reset)
+       if (domain >= pi->num_domains)
+               return -EINVAL;
+
+       rdom = pi->dom_info + domain;
+       if (rdom->async_reset && flags & AUTONOMOUS_RESET)
                flags |= ASYNCHRONOUS_RESET;
 
        ret = ph->xops->xfer_get_init(ph, RESET, sizeof(*dom), 0, &t);
@@ -180,7 +184,7 @@ static int scmi_domain_reset(const struct scmi_protocol_handle *ph, u32 domain,
        dom->flags = cpu_to_le32(flags);
        dom->reset_state = cpu_to_le32(state);
 
-       if (rdom->async_reset)
+       if (flags & ASYNCHRONOUS_RESET)
                ret = ph->xops->do_xfer_with_response(ph, t);
        else
                ret = ph->xops->do_xfer(ph, t);
index 581d34c9576954d0b4563090e2d7e08f5ec550da..4e27c3d66a837d9dad46fa2d03adc7ded2f8ab10 100644 (file)
@@ -138,9 +138,28 @@ static int scmi_pm_domain_probe(struct scmi_device *sdev)
        scmi_pd_data->domains = domains;
        scmi_pd_data->num_domains = num_domains;
 
+       dev_set_drvdata(dev, scmi_pd_data);
+
        return of_genpd_add_provider_onecell(np, scmi_pd_data);
 }
 
+static void scmi_pm_domain_remove(struct scmi_device *sdev)
+{
+       int i;
+       struct genpd_onecell_data *scmi_pd_data;
+       struct device *dev = &sdev->dev;
+       struct device_node *np = dev->of_node;
+
+       of_genpd_del_provider(np);
+
+       scmi_pd_data = dev_get_drvdata(dev);
+       for (i = 0; i < scmi_pd_data->num_domains; i++) {
+               if (!scmi_pd_data->domains[i])
+                       continue;
+               pm_genpd_remove(scmi_pd_data->domains[i]);
+       }
+}
+
 static const struct scmi_device_id scmi_id_table[] = {
        { SCMI_PROTOCOL_POWER, "genpd" },
        { },
@@ -150,6 +169,7 @@ MODULE_DEVICE_TABLE(scmi, scmi_id_table);
 static struct scmi_driver scmi_power_domain_driver = {
        .name = "scmi-power-domain",
        .probe = scmi_pm_domain_probe,
+       .remove = scmi_pm_domain_remove,
        .id_table = scmi_id_table,
 };
 module_scmi_driver(scmi_power_domain_driver);
index 7288c61178380813cb63fb83e588180c3308ab93..0b5853fa9d874f2d0800a5fa2aa20a45904e0f66 100644 (file)
@@ -762,6 +762,10 @@ static int scmi_sensor_config_get(const struct scmi_protocol_handle *ph,
 {
        int ret;
        struct scmi_xfer *t;
+       struct sensors_info *si = ph->get_priv(ph);
+
+       if (sensor_id >= si->num_sensors)
+               return -EINVAL;
 
        ret = ph->xops->xfer_get_init(ph, SENSOR_CONFIG_GET,
                                      sizeof(__le32), sizeof(__le32), &t);
@@ -771,7 +775,6 @@ static int scmi_sensor_config_get(const struct scmi_protocol_handle *ph,
        put_unaligned_le32(sensor_id, t->tx.buf);
        ret = ph->xops->do_xfer(ph, t);
        if (!ret) {
-               struct sensors_info *si = ph->get_priv(ph);
                struct scmi_sensor_info *s = si->sensors + sensor_id;
 
                *sensor_config = get_unaligned_le64(t->rx.buf);
@@ -788,6 +791,10 @@ static int scmi_sensor_config_set(const struct scmi_protocol_handle *ph,
        int ret;
        struct scmi_xfer *t;
        struct scmi_msg_sensor_config_set *msg;
+       struct sensors_info *si = ph->get_priv(ph);
+
+       if (sensor_id >= si->num_sensors)
+               return -EINVAL;
 
        ret = ph->xops->xfer_get_init(ph, SENSOR_CONFIG_SET,
                                      sizeof(*msg), 0, &t);
@@ -800,7 +807,6 @@ static int scmi_sensor_config_set(const struct scmi_protocol_handle *ph,
 
        ret = ph->xops->do_xfer(ph, t);
        if (!ret) {
-               struct sensors_info *si = ph->get_priv(ph);
                struct scmi_sensor_info *s = si->sensors + sensor_id;
 
                s->sensor_config = sensor_config;
@@ -831,8 +837,11 @@ static int scmi_sensor_reading_get(const struct scmi_protocol_handle *ph,
        int ret;
        struct scmi_xfer *t;
        struct scmi_msg_sensor_reading_get *sensor;
+       struct scmi_sensor_info *s;
        struct sensors_info *si = ph->get_priv(ph);
-       struct scmi_sensor_info *s = si->sensors + sensor_id;
+
+       if (sensor_id >= si->num_sensors)
+               return -EINVAL;
 
        ret = ph->xops->xfer_get_init(ph, SENSOR_READING_GET,
                                      sizeof(*sensor), 0, &t);
@@ -841,6 +850,7 @@ static int scmi_sensor_reading_get(const struct scmi_protocol_handle *ph,
 
        sensor = t->tx.buf;
        sensor->id = cpu_to_le32(sensor_id);
+       s = si->sensors + sensor_id;
        if (s->async) {
                sensor->flags = cpu_to_le32(SENSOR_READ_ASYNC);
                ret = ph->xops->do_xfer_with_response(ph, t);
@@ -895,9 +905,13 @@ scmi_sensor_reading_get_timestamped(const struct scmi_protocol_handle *ph,
        int ret;
        struct scmi_xfer *t;
        struct scmi_msg_sensor_reading_get *sensor;
+       struct scmi_sensor_info *s;
        struct sensors_info *si = ph->get_priv(ph);
-       struct scmi_sensor_info *s = si->sensors + sensor_id;
 
+       if (sensor_id >= si->num_sensors)
+               return -EINVAL;
+
+       s = si->sensors + sensor_id;
        if (!count || !readings ||
            (!s->num_axis && count > 1) || (s->num_axis && count > s->num_axis))
                return -EINVAL;
@@ -948,6 +962,9 @@ scmi_sensor_info_get(const struct scmi_protocol_handle *ph, u32 sensor_id)
 {
        struct sensors_info *si = ph->get_priv(ph);
 
+       if (sensor_id >= si->num_sensors)
+               return NULL;
+
        return si->sensors + sensor_id;
 }
 
index 8ced7af8e56d28d0dffe40e84506e6a88dd60b54..4f9fb086eab7b0e22252d22e59e5aae55865322d 100644 (file)
@@ -48,6 +48,9 @@ static int efibc_reboot_notifier_call(struct notifier_block *notifier,
                return NOTIFY_DONE;
 
        wdata = kmalloc(MAX_DATA_LEN * sizeof(efi_char16_t), GFP_KERNEL);
+       if (!wdata)
+               return NOTIFY_DONE;
+
        for (l = 0; l < MAX_DATA_LEN - 1 && str[l] != '\0'; l++)
                wdata[l] = str[l];
        wdata[l] = L'\0';
index 8a18930f3eb69561a0dcc199b398b8cd09fd55df..516f4f0069bd2fcfecc37481351e3f576fc5944b 100644 (file)
@@ -14,7 +14,7 @@
 
 /* SHIM variables */
 static const efi_guid_t shim_guid = EFI_SHIM_LOCK_GUID;
-static const efi_char16_t shim_MokSBState_name[] = L"MokSBState";
+static const efi_char16_t shim_MokSBState_name[] = L"MokSBStateRT";
 
 static efi_status_t get_var(efi_char16_t *name, efi_guid_t *vendor, u32 *attr,
                            unsigned long *data_size, void *data)
@@ -43,8 +43,8 @@ enum efi_secureboot_mode efi_get_secureboot(void)
 
        /*
         * See if a user has put the shim into insecure mode. If so, and if the
-        * variable doesn't have the runtime attribute set, we might as well
-        * honor that.
+        * variable doesn't have the non-volatile attribute set, we might as
+        * well honor that.
         */
        size = sizeof(moksbstate);
        status = get_efi_var(shim_MokSBState_name, &shim_guid,
@@ -53,7 +53,7 @@ enum efi_secureboot_mode efi_get_secureboot(void)
        /* If it fails, we don't care why. Default to secure */
        if (status != EFI_SUCCESS)
                goto secure_boot_enabled;
-       if (!(attr & EFI_VARIABLE_RUNTIME_ACCESS) && moksbstate == 1)
+       if (!(attr & EFI_VARIABLE_NON_VOLATILE) && moksbstate == 1)
                return efi_secureboot_mode_disabled;
 
 secure_boot_enabled:
index 43ca665af610c4ff4dc91d8f954976e2ce2445be..7a7abc8959d2b0e3e44dcb06f15fa12432b93c18 100644 (file)
@@ -516,6 +516,13 @@ efi_status_t __efiapi efi_pe_entry(efi_handle_t handle,
        hdr->ramdisk_image = 0;
        hdr->ramdisk_size = 0;
 
+       /*
+        * Disregard any setup data that was provided by the bootloader:
+        * setup_data could be pointing anywhere, and we have no way of
+        * authenticating or validating the payload.
+        */
+       hdr->setup_data = 0;
+
        efi_stub_entry(handle, sys_table_arg, boot_params);
        /* not reached */
 
index f422c3e129a0c4cc1b34c03c746608e387e013e5..f77a965f5780d8d9817f2546df480e3341cb3b68 100644 (file)
  * struct ftgpio_gpio - Gemini GPIO state container
  * @dev: containing device for this instance
  * @gc: gpiochip for this instance
- * @irq: irqchip for this instance
  * @base: remapped I/O-memory base
  * @clk: silicon clock
  */
 struct ftgpio_gpio {
        struct device *dev;
        struct gpio_chip gc;
-       struct irq_chip irq;
        void __iomem *base;
        struct clk *clk;
 };
@@ -70,6 +68,7 @@ static void ftgpio_gpio_mask_irq(struct irq_data *d)
        val = readl(g->base + GPIO_INT_EN);
        val &= ~BIT(irqd_to_hwirq(d));
        writel(val, g->base + GPIO_INT_EN);
+       gpiochip_disable_irq(gc, irqd_to_hwirq(d));
 }
 
 static void ftgpio_gpio_unmask_irq(struct irq_data *d)
@@ -78,6 +77,7 @@ static void ftgpio_gpio_unmask_irq(struct irq_data *d)
        struct ftgpio_gpio *g = gpiochip_get_data(gc);
        u32 val;
 
+       gpiochip_enable_irq(gc, irqd_to_hwirq(d));
        val = readl(g->base + GPIO_INT_EN);
        val |= BIT(irqd_to_hwirq(d));
        writel(val, g->base + GPIO_INT_EN);
@@ -221,6 +221,16 @@ static int ftgpio_gpio_set_config(struct gpio_chip *gc, unsigned int offset,
        return 0;
 }
 
+static const struct irq_chip ftgpio_irq_chip = {
+       .name = "FTGPIO010",
+       .irq_ack = ftgpio_gpio_ack_irq,
+       .irq_mask = ftgpio_gpio_mask_irq,
+       .irq_unmask = ftgpio_gpio_unmask_irq,
+       .irq_set_type = ftgpio_gpio_set_irq_type,
+       .flags = IRQCHIP_IMMUTABLE,
+        GPIOCHIP_IRQ_RESOURCE_HELPERS,
+};
+
 static int ftgpio_gpio_probe(struct platform_device *pdev)
 {
        struct device *dev = &pdev->dev;
@@ -277,14 +287,8 @@ static int ftgpio_gpio_probe(struct platform_device *pdev)
        if (!IS_ERR(g->clk))
                g->gc.set_config = ftgpio_gpio_set_config;
 
-       g->irq.name = "FTGPIO010";
-       g->irq.irq_ack = ftgpio_gpio_ack_irq;
-       g->irq.irq_mask = ftgpio_gpio_mask_irq;
-       g->irq.irq_unmask = ftgpio_gpio_unmask_irq;
-       g->irq.irq_set_type = ftgpio_gpio_set_irq_type;
-
        girq = &g->gc.irq;
-       girq->chip = &g->irq;
+       gpio_irq_chip_set_chip(girq, &ftgpio_irq_chip);
        girq->parent_handler = ftgpio_gpio_irq_handler;
        girq->num_parents = 1;
        girq->parents = devm_kcalloc(dev, 1, sizeof(*girq->parents),
index 312309be0287db567c0a5c838078969fd4b19b1a..56656fb519f8553e783998188473c88db9a6e1b1 100644 (file)
@@ -63,6 +63,14 @@ static void ixp4xx_gpio_irq_ack(struct irq_data *d)
        __raw_writel(BIT(d->hwirq), g->base + IXP4XX_REG_GPIS);
 }
 
+static void ixp4xx_gpio_mask_irq(struct irq_data *d)
+{
+       struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
+
+       irq_chip_mask_parent(d);
+       gpiochip_disable_irq(gc, d->hwirq);
+}
+
 static void ixp4xx_gpio_irq_unmask(struct irq_data *d)
 {
        struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
@@ -72,6 +80,7 @@ static void ixp4xx_gpio_irq_unmask(struct irq_data *d)
        if (!(g->irq_edge & BIT(d->hwirq)))
                ixp4xx_gpio_irq_ack(d);
 
+       gpiochip_enable_irq(gc, d->hwirq);
        irq_chip_unmask_parent(d);
 }
 
@@ -149,12 +158,14 @@ static int ixp4xx_gpio_irq_set_type(struct irq_data *d, unsigned int type)
        return irq_chip_set_type_parent(d, IRQ_TYPE_LEVEL_HIGH);
 }
 
-static struct irq_chip ixp4xx_gpio_irqchip = {
+static const struct irq_chip ixp4xx_gpio_irqchip = {
        .name = "IXP4GPIO",
        .irq_ack = ixp4xx_gpio_irq_ack,
-       .irq_mask = irq_chip_mask_parent,
+       .irq_mask = ixp4xx_gpio_mask_irq,
        .irq_unmask = ixp4xx_gpio_irq_unmask,
        .irq_set_type = ixp4xx_gpio_irq_set_type,
+       .flags = IRQCHIP_IMMUTABLE,
+       GPIOCHIP_IRQ_RESOURCE_HELPERS,
 };
 
 static int ixp4xx_gpio_child_to_parent_hwirq(struct gpio_chip *gc,
@@ -263,7 +274,7 @@ static int ixp4xx_gpio_probe(struct platform_device *pdev)
        g->gc.owner = THIS_MODULE;
 
        girq = &g->gc.irq;
-       girq->chip = &ixp4xx_gpio_irqchip;
+       gpio_irq_chip_set_chip(girq, &ixp4xx_gpio_irqchip);
        girq->fwnode = g->fwnode;
        girq->parent_domain = parent;
        girq->child_to_parent_hwirq = ixp4xx_gpio_child_to_parent_hwirq;
index a2e505a7545cde534182d08befa46c350f1310b0..523dfd17dd922548ebabbd1cd63f7bbf033b73e2 100644 (file)
@@ -533,8 +533,10 @@ static int __init gpio_mockup_register_chip(int idx)
        }
 
        fwnode = fwnode_create_software_node(properties, NULL);
-       if (IS_ERR(fwnode))
+       if (IS_ERR(fwnode)) {
+               kfree_strarray(line_names, ngpio);
                return PTR_ERR(fwnode);
+       }
 
        pdevinfo.name = "gpio-mockup";
        pdevinfo.id = idx;
@@ -597,9 +599,9 @@ static int __init gpio_mockup_init(void)
 
 static void __exit gpio_mockup_exit(void)
 {
+       gpio_mockup_unregister_pdevs();
        debugfs_remove_recursive(gpio_mockup_dbg_dir);
        platform_driver_unregister(&gpio_mockup_driver);
-       gpio_mockup_unregister_pdevs();
 }
 
 module_init(gpio_mockup_init);
index 15049822937a43a19c98d04562c6235b67724332..3eb08cd1fdc0818a89458b5ad72a4761b2b31a9c 100644 (file)
@@ -169,6 +169,7 @@ static int mpc8xxx_irq_set_type(struct irq_data *d, unsigned int flow_type)
 
        switch (flow_type) {
        case IRQ_TYPE_EDGE_FALLING:
+       case IRQ_TYPE_LEVEL_LOW:
                raw_spin_lock_irqsave(&mpc8xxx_gc->lock, flags);
                gc->write_reg(mpc8xxx_gc->regs + GPIO_ICR,
                        gc->read_reg(mpc8xxx_gc->regs + GPIO_ICR)
index d8a26e503ca5d2fe7d99ce2745b484520a2973c0..f163f5ca857beb24d7c3eafffef482a6bb9def6b 100644 (file)
@@ -112,6 +112,8 @@ mediatek_gpio_irq_unmask(struct irq_data *d)
        unsigned long flags;
        u32 rise, fall, high, low;
 
+       gpiochip_enable_irq(gc, d->hwirq);
+
        spin_lock_irqsave(&rg->lock, flags);
        rise = mtk_gpio_r32(rg, GPIO_REG_REDGE);
        fall = mtk_gpio_r32(rg, GPIO_REG_FEDGE);
@@ -143,6 +145,8 @@ mediatek_gpio_irq_mask(struct irq_data *d)
        mtk_gpio_w32(rg, GPIO_REG_HLVL, high & ~BIT(pin));
        mtk_gpio_w32(rg, GPIO_REG_LLVL, low & ~BIT(pin));
        spin_unlock_irqrestore(&rg->lock, flags);
+
+       gpiochip_disable_irq(gc, d->hwirq);
 }
 
 static int
@@ -204,6 +208,16 @@ mediatek_gpio_xlate(struct gpio_chip *chip,
        return gpio % MTK_BANK_WIDTH;
 }
 
+static const struct irq_chip mt7621_irq_chip = {
+       .name           = "mt7621-gpio",
+       .irq_mask_ack   = mediatek_gpio_irq_mask,
+       .irq_mask       = mediatek_gpio_irq_mask,
+       .irq_unmask     = mediatek_gpio_irq_unmask,
+       .irq_set_type   = mediatek_gpio_irq_type,
+       .flags          = IRQCHIP_IMMUTABLE,
+       GPIOCHIP_IRQ_RESOURCE_HELPERS,
+};
+
 static int
 mediatek_gpio_bank_probe(struct device *dev, int bank)
 {
@@ -238,11 +252,6 @@ mediatek_gpio_bank_probe(struct device *dev, int bank)
                return -ENOMEM;
 
        rg->chip.offset = bank * MTK_BANK_WIDTH;
-       rg->irq_chip.name = dev_name(dev);
-       rg->irq_chip.irq_unmask = mediatek_gpio_irq_unmask;
-       rg->irq_chip.irq_mask = mediatek_gpio_irq_mask;
-       rg->irq_chip.irq_mask_ack = mediatek_gpio_irq_mask;
-       rg->irq_chip.irq_set_type = mediatek_gpio_irq_type;
 
        if (mtk->gpio_irq) {
                struct gpio_irq_chip *girq;
@@ -262,7 +271,7 @@ mediatek_gpio_bank_probe(struct device *dev, int bank)
                }
 
                girq = &rg->chip.irq;
-               girq->chip = &rg->irq_chip;
+               gpio_irq_chip_set_chip(girq, &mt7621_irq_chip);
                /* This will let us handle the parent IRQ in the driver */
                girq->parent_handler = NULL;
                girq->num_parents = 0;
index f91e876fd9690cef5aa83775a2504402e6cfb42f..bb50335239ac804e615f045c8e029290d2973fb0 100644 (file)
@@ -419,11 +419,11 @@ static int rockchip_irq_set_type(struct irq_data *d, unsigned int type)
                        goto out;
                } else {
                        bank->toggle_edge_mode |= mask;
-                       level |= mask;
+                       level &= ~mask;
 
                        /*
                         * Determine gpio state. If 1 next interrupt should be
-                        * falling otherwise rising.
+                        * low otherwise high.
                         */
                        data = readl(bank->reg_base + bank->gpio_regs->ext_port);
                        if (data & mask)
index fa4bc7481f9a600b57d8ab6851ac9052c19cb49f..e739dcea61b231ff30387c12fef35ce59272d548 100644 (file)
@@ -307,6 +307,8 @@ static int tqmx86_gpio_probe(struct platform_device *pdev)
                girq->default_type = IRQ_TYPE_NONE;
                girq->handler = handle_simple_irq;
                girq->init_valid_mask = tqmx86_init_irq_valid_mask;
+
+               irq_domain_set_pm_device(girq->domain, dev);
        }
 
        ret = devm_gpiochip_add_data(dev, chip, gpio);
@@ -315,8 +317,6 @@ static int tqmx86_gpio_probe(struct platform_device *pdev)
                goto out_pm_dis;
        }
 
-       irq_domain_set_pm_device(girq->domain, dev);
-
        dev_info(dev, "GPIO functionality initialized with %d pins\n",
                 chip->ngpio);
 
index f8041d4898d1916ab11428b37954e04788a1fc1b..92f185575e941f438b8ed6f0b35e8c54ca497402 100644 (file)
@@ -1986,7 +1986,6 @@ static int lineevent_create(struct gpio_device *gdev, void __user *ip)
                ret = -ENODEV;
                goto out_free_le;
        }
-       le->irq = irq;
 
        if (eflags & GPIOEVENT_REQUEST_RISING_EDGE)
                irqflags |= test_bit(FLAG_ACTIVE_LOW, &desc->flags) ?
@@ -2000,7 +1999,7 @@ static int lineevent_create(struct gpio_device *gdev, void __user *ip)
        init_waitqueue_head(&le->wait);
 
        /* Request a thread to read the events */
-       ret = request_threaded_irq(le->irq,
+       ret = request_threaded_irq(irq,
                                   lineevent_irq_handler,
                                   lineevent_irq_thread,
                                   irqflags,
@@ -2009,6 +2008,8 @@ static int lineevent_create(struct gpio_device *gdev, void __user *ip)
        if (ret)
                goto out_free_le;
 
+       le->irq = irq;
+
        fd = get_unused_fd_flags(O_RDONLY | O_CLOEXEC);
        if (fd < 0) {
                ret = fd;
index 1400abee9f402e3785374516a21105d7120a7ea7..be7aff2d4a57efd7ba345a7b59526d4889dce88a 100644 (file)
@@ -2365,8 +2365,16 @@ static int amdgpu_device_ip_init(struct amdgpu_device *adev)
                }
                adev->ip_blocks[i].status.sw = true;
 
-               /* need to do gmc hw init early so we can allocate gpu mem */
-               if (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_GMC) {
+               if (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_COMMON) {
+                       /* need to do common hw init early so everything is set up for gmc */
+                       r = adev->ip_blocks[i].version->funcs->hw_init((void *)adev);
+                       if (r) {
+                               DRM_ERROR("hw_init %d failed %d\n", i, r);
+                               goto init_failed;
+                       }
+                       adev->ip_blocks[i].status.hw = true;
+               } else if (adev->ip_blocks[i].version->type == AMD_IP_BLOCK_TYPE_GMC) {
+                       /* need to do gmc hw init early so we can allocate gpu mem */
                        /* Try to reserve bad pages early */
                        if (amdgpu_sriov_vf(adev))
                                amdgpu_virt_exchange_data(adev);
@@ -3052,8 +3060,8 @@ static int amdgpu_device_ip_reinit_early_sriov(struct amdgpu_device *adev)
        int i, r;
 
        static enum amd_ip_block_type ip_order[] = {
-               AMD_IP_BLOCK_TYPE_GMC,
                AMD_IP_BLOCK_TYPE_COMMON,
+               AMD_IP_BLOCK_TYPE_GMC,
                AMD_IP_BLOCK_TYPE_PSP,
                AMD_IP_BLOCK_TYPE_IH,
        };
index c20922a5af9fc4d410a34bd12b7b06bbcb455363..23998f727c7f97d50980d89af054dfa98e07dcb5 100644 (file)
@@ -38,6 +38,8 @@
 #include <linux/pci.h>
 #include <linux/pm_runtime.h>
 #include <drm/drm_crtc_helper.h>
+#include <drm/drm_damage_helper.h>
+#include <drm/drm_drv.h>
 #include <drm/drm_edid.h>
 #include <drm/drm_gem_framebuffer_helper.h>
 #include <drm/drm_fb_helper.h>
@@ -498,6 +500,12 @@ static const struct drm_framebuffer_funcs amdgpu_fb_funcs = {
        .create_handle = drm_gem_fb_create_handle,
 };
 
+static const struct drm_framebuffer_funcs amdgpu_fb_funcs_atomic = {
+       .destroy = drm_gem_fb_destroy,
+       .create_handle = drm_gem_fb_create_handle,
+       .dirty = drm_atomic_helper_dirtyfb,
+};
+
 uint32_t amdgpu_display_supported_domains(struct amdgpu_device *adev,
                                          uint64_t bo_flags)
 {
@@ -1100,7 +1108,10 @@ static int amdgpu_display_gem_fb_verify_and_init(struct drm_device *dev,
        if (ret)
                goto err;
 
-       ret = drm_framebuffer_init(dev, &rfb->base, &amdgpu_fb_funcs);
+       if (drm_drv_uses_atomic_modeset(dev))
+               ret = drm_framebuffer_init(dev, &rfb->base, &amdgpu_fb_funcs_atomic);
+       else
+               ret = drm_framebuffer_init(dev, &rfb->base, &amdgpu_fb_funcs);
        if (ret)
                goto err;
 
index fe82b8b19a4ed26406f976924bb36a03f61b4853..0c546245793b9c292851db1098ce14c2f27fe734 100644 (file)
@@ -181,6 +181,9 @@ int amdgpu_mes_init(struct amdgpu_device *adev)
        for (i = 0; i < AMDGPU_MES_MAX_SDMA_PIPES; i++) {
                if (adev->ip_versions[SDMA0_HWIP][0] < IP_VERSION(6, 0, 0))
                        adev->mes.sdma_hqd_mask[i] = i ? 0 : 0x3fc;
+               /* zero sdma_hqd_mask for non-existent engine */
+               else if (adev->sdma.num_instances == 1)
+                       adev->mes.sdma_hqd_mask[i] = i ? 0 : 0xfc;
                else
                        adev->mes.sdma_hqd_mask[i] = 0xfc;
        }
index 35738db12cd1730bcaf6068dca476d3d3c0254a6..c9dec2434f370d9e32683e3babbc5254afecab77 100644 (file)
@@ -756,7 +756,7 @@ static int psp_tmr_init(struct psp_context *psp)
        }
 
        pptr = amdgpu_sriov_vf(psp->adev) ? &tmr_buf : NULL;
-       ret = amdgpu_bo_create_kernel(psp->adev, tmr_size, PSP_TMR_SIZE(psp->adev),
+       ret = amdgpu_bo_create_kernel(psp->adev, tmr_size, PSP_TMR_ALIGNMENT,
                                      AMDGPU_GEM_DOMAIN_VRAM,
                                      &psp->tmr_bo, &psp->tmr_mc_addr, pptr);
 
index c32b74bd970fc53ecb0dc6c3bc833cdf4ac0bc50..e593e8c2a54d6b0d211bd5531ea3b54be4326a50 100644 (file)
@@ -36,6 +36,7 @@
 #define PSP_CMD_BUFFER_SIZE    0x1000
 #define PSP_1_MEG              0x100000
 #define PSP_TMR_SIZE(adev)     ((adev)->asic_type == CHIP_ALDEBARAN ? 0x800000 : 0x400000)
+#define PSP_TMR_ALIGNMENT      0x100000
 #define PSP_FW_NAME_LEN                0x24
 
 enum psp_shared_mem_size {
index ff5361f5c2d4f2746a3db6fc00877733434d6cc9..12c6f97945a52cef376a9987e221fbd06a8ee2a8 100644 (file)
@@ -1811,7 +1811,8 @@ static void amdgpu_ras_log_on_err_counter(struct amdgpu_device *adev)
                amdgpu_ras_query_error_status(adev, &info);
 
                if (adev->ip_versions[MP0_HWIP][0] != IP_VERSION(11, 0, 2) &&
-                   adev->ip_versions[MP0_HWIP][0] != IP_VERSION(11, 0, 4)) {
+                   adev->ip_versions[MP0_HWIP][0] != IP_VERSION(11, 0, 4) &&
+                   adev->ip_versions[MP0_HWIP][0] != IP_VERSION(13, 0, 0)) {
                        if (amdgpu_ras_reset_error_status(adev, info.head.block))
                                dev_warn(adev->dev, "Failed to reset error counter and error status");
                }
index 59cac347baa38ebe0fa7dd908753a9219963a41a..690fd4f639f19cbbbc4330bcd125e76747a0e8a6 100644 (file)
@@ -2484,8 +2484,7 @@ bool amdgpu_vm_handle_fault(struct amdgpu_device *adev, u32 pasid,
                /* Intentionally setting invalid PTE flag
                 * combination to force a no-retry-fault
                 */
-               flags = AMDGPU_PTE_EXECUTABLE | AMDGPU_PDE_PTE |
-                       AMDGPU_PTE_TF;
+               flags = AMDGPU_PTE_SNOOPED | AMDGPU_PTE_PRT;
                value = 0;
        } else if (amdgpu_vm_fault_stop == AMDGPU_VM_FAULT_STOP_NEVER) {
                /* Redirect the access to the dummy page */
index 4603653916f5a551854a784c75da1817731f4bf9..67ca16a8027c7d9afe83e30a916e8a9c0984e0a0 100644 (file)
@@ -1103,10 +1103,13 @@ static void gmc_v9_0_get_vm_pde(struct amdgpu_device *adev, int level,
                        *flags |= AMDGPU_PDE_BFS(0x9);
 
        } else if (level == AMDGPU_VM_PDB0) {
-               if (*flags & AMDGPU_PDE_PTE)
+               if (*flags & AMDGPU_PDE_PTE) {
                        *flags &= ~AMDGPU_PDE_PTE;
-               else
+                       if (!(*flags & AMDGPU_PTE_VALID))
+                               *addr |= 1 << PAGE_SHIFT;
+               } else {
                        *flags |= AMDGPU_PTE_TF;
+               }
        }
 }
 
index b465baa267628229aaee75ec7f8826232390c59b..aa761ff3a5faec4e383b93f7467d13b27974bce6 100644 (file)
@@ -380,6 +380,7 @@ static void nbio_v2_3_enable_aspm(struct amdgpu_device *adev,
                WREG32_PCIE(smnPCIE_LC_CNTL, data);
 }
 
+#ifdef CONFIG_PCIEASPM
 static void nbio_v2_3_program_ltr(struct amdgpu_device *adev)
 {
        uint32_t def, data;
@@ -401,9 +402,11 @@ static void nbio_v2_3_program_ltr(struct amdgpu_device *adev)
        if (def != data)
                WREG32_PCIE(smnBIF_CFG_DEV0_EPF0_DEVICE_CNTL2, data);
 }
+#endif
 
 static void nbio_v2_3_program_aspm(struct amdgpu_device *adev)
 {
+#ifdef CONFIG_PCIEASPM
        uint32_t def, data;
 
        def = data = RREG32_PCIE(smnPCIE_LC_CNTL);
@@ -459,7 +462,10 @@ static void nbio_v2_3_program_aspm(struct amdgpu_device *adev)
        if (def != data)
                WREG32_PCIE(smnPCIE_LC_CNTL6, data);
 
-       nbio_v2_3_program_ltr(adev);
+       /* Don't bother about LTR if LTR is not enabled
+        * in the path */
+       if (adev->pdev->ltr_path)
+               nbio_v2_3_program_ltr(adev);
 
        def = data = RREG32_SOC15(NBIO, 0, mmRCC_BIF_STRAP3);
        data |= 0x5DE0 << RCC_BIF_STRAP3__STRAP_VLINK_ASPM_IDLE_TIMER__SHIFT;
@@ -483,6 +489,7 @@ static void nbio_v2_3_program_aspm(struct amdgpu_device *adev)
        data &= ~PCIE_LC_CNTL3__LC_DSC_DONT_ENTER_L23_AFTER_PME_ACK_MASK;
        if (def != data)
                WREG32_PCIE(smnPCIE_LC_CNTL3, data);
+#endif
 }
 
 static void nbio_v2_3_apply_lc_spc_mode_wa(struct amdgpu_device *adev)
index f7f6ddebd3e49b6ec55f411fda96cf4d35959f33..37615a77287bc00e52dab28d57d25b9df21cc57c 100644 (file)
@@ -282,6 +282,7 @@ static void nbio_v6_1_init_registers(struct amdgpu_device *adev)
                        mmBIF_BX_DEV0_EPF0_VF0_HDP_MEM_COHERENCY_FLUSH_CNTL) << 2;
 }
 
+#ifdef CONFIG_PCIEASPM
 static void nbio_v6_1_program_ltr(struct amdgpu_device *adev)
 {
        uint32_t def, data;
@@ -303,9 +304,11 @@ static void nbio_v6_1_program_ltr(struct amdgpu_device *adev)
        if (def != data)
                WREG32_PCIE(smnBIF_CFG_DEV0_EPF0_DEVICE_CNTL2, data);
 }
+#endif
 
 static void nbio_v6_1_program_aspm(struct amdgpu_device *adev)
 {
+#ifdef CONFIG_PCIEASPM
        uint32_t def, data;
 
        def = data = RREG32_PCIE(smnPCIE_LC_CNTL);
@@ -361,7 +364,10 @@ static void nbio_v6_1_program_aspm(struct amdgpu_device *adev)
        if (def != data)
                WREG32_PCIE(smnPCIE_LC_CNTL6, data);
 
-       nbio_v6_1_program_ltr(adev);
+       /* Don't bother about LTR if LTR is not enabled
+        * in the path */
+       if (adev->pdev->ltr_path)
+               nbio_v6_1_program_ltr(adev);
 
        def = data = RREG32_PCIE(smnRCC_BIF_STRAP3);
        data |= 0x5DE0 << RCC_BIF_STRAP3__STRAP_VLINK_ASPM_IDLE_TIMER__SHIFT;
@@ -385,6 +391,7 @@ static void nbio_v6_1_program_aspm(struct amdgpu_device *adev)
        data &= ~PCIE_LC_CNTL3__LC_DSC_DONT_ENTER_L23_AFTER_PME_ACK_MASK;
        if (def != data)
                WREG32_PCIE(smnPCIE_LC_CNTL3, data);
+#endif
 }
 
 const struct amdgpu_nbio_funcs nbio_v6_1_funcs = {
index 11848d1e238b6b7c3724b339d8c955bc1685d664..19455a72593916989de322cb038ce42b4d7482c2 100644 (file)
@@ -673,6 +673,7 @@ struct amdgpu_nbio_ras nbio_v7_4_ras = {
 };
 
 
+#ifdef CONFIG_PCIEASPM
 static void nbio_v7_4_program_ltr(struct amdgpu_device *adev)
 {
        uint32_t def, data;
@@ -694,9 +695,11 @@ static void nbio_v7_4_program_ltr(struct amdgpu_device *adev)
        if (def != data)
                WREG32_PCIE(smnBIF_CFG_DEV0_EPF0_DEVICE_CNTL2, data);
 }
+#endif
 
 static void nbio_v7_4_program_aspm(struct amdgpu_device *adev)
 {
+#ifdef CONFIG_PCIEASPM
        uint32_t def, data;
 
        if (adev->ip_versions[NBIO_HWIP][0] == IP_VERSION(7, 4, 4))
@@ -755,7 +758,10 @@ static void nbio_v7_4_program_aspm(struct amdgpu_device *adev)
        if (def != data)
                WREG32_PCIE(smnPCIE_LC_CNTL6, data);
 
-       nbio_v7_4_program_ltr(adev);
+       /* Don't bother about LTR if LTR is not enabled
+        * in the path */
+       if (adev->pdev->ltr_path)
+               nbio_v7_4_program_ltr(adev);
 
        def = data = RREG32_PCIE(smnRCC_BIF_STRAP3);
        data |= 0x5DE0 << RCC_BIF_STRAP3__STRAP_VLINK_ASPM_IDLE_TIMER__SHIFT;
@@ -779,6 +785,7 @@ static void nbio_v7_4_program_aspm(struct amdgpu_device *adev)
        data &= ~PCIE_LC_CNTL3__LC_DSC_DONT_ENTER_L23_AFTER_PME_ACK_MASK;
        if (def != data)
                WREG32_PCIE(smnPCIE_LC_CNTL3, data);
+#endif
 }
 
 const struct amdgpu_nbio_funcs nbio_v7_4_funcs = {
index f30bc826a87819b3670f868c188436ce4f467f1d..def89379b51a57b13f1ca14c61899b68ad5ccb45 100644 (file)
 #include "nbio/nbio_7_7_0_sh_mask.h"
 #include <uapi/linux/kfd_ioctl.h>
 
+static void nbio_v7_7_remap_hdp_registers(struct amdgpu_device *adev)
+{
+       WREG32_SOC15(NBIO, 0, regBIF_BX0_REMAP_HDP_MEM_FLUSH_CNTL,
+                    adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_MEM_FLUSH_CNTL);
+       WREG32_SOC15(NBIO, 0, regBIF_BX0_REMAP_HDP_REG_FLUSH_CNTL,
+                    adev->rmmio_remap.reg_offset + KFD_MMIO_REMAP_HDP_REG_FLUSH_CNTL);
+}
+
 static u32 nbio_v7_7_get_rev_id(struct amdgpu_device *adev)
 {
        u32 tmp;
@@ -336,4 +344,5 @@ const struct amdgpu_nbio_funcs nbio_v7_7_funcs = {
        .get_clockgating_state = nbio_v7_7_get_clockgating_state,
        .ih_control = nbio_v7_7_ih_control,
        .init_registers = nbio_v7_7_init_registers,
+       .remap_hdp_registers = nbio_v7_7_remap_hdp_registers,
 };
index 65181efba50ec73c68e44001692259f590983373..56424f75dd2cc900d078bba712b0f882f564c51d 100644 (file)
@@ -1504,6 +1504,11 @@ static int sdma_v4_0_start(struct amdgpu_device *adev)
                WREG32_SDMA(i, mmSDMA0_CNTL, temp);
 
                if (!amdgpu_sriov_vf(adev)) {
+                       ring = &adev->sdma.instance[i].ring;
+                       adev->nbio.funcs->sdma_doorbell_range(adev, i,
+                               ring->use_doorbell, ring->doorbell_index,
+                               adev->doorbell_index.sdma_doorbell_range);
+
                        /* unhalt engine */
                        temp = RREG32_SDMA(i, mmSDMA0_F32_CNTL);
                        temp = REG_SET_FIELD(temp, SDMA0_F32_CNTL, HALT, 0);
index fde6154f200963eb2aa81a039349dc987e1f93c0..183024d7c184e3d2be2b4c1386a827f500661bb2 100644 (file)
@@ -1211,25 +1211,6 @@ static int soc15_common_sw_fini(void *handle)
        return 0;
 }
 
-static void soc15_doorbell_range_init(struct amdgpu_device *adev)
-{
-       int i;
-       struct amdgpu_ring *ring;
-
-       /* sdma/ih doorbell range are programed by hypervisor */
-       if (!amdgpu_sriov_vf(adev)) {
-               for (i = 0; i < adev->sdma.num_instances; i++) {
-                       ring = &adev->sdma.instance[i].ring;
-                       adev->nbio.funcs->sdma_doorbell_range(adev, i,
-                               ring->use_doorbell, ring->doorbell_index,
-                               adev->doorbell_index.sdma_doorbell_range);
-               }
-
-               adev->nbio.funcs->ih_doorbell_range(adev, adev->irq.ih.use_doorbell,
-                                               adev->irq.ih.doorbell_index);
-       }
-}
-
 static int soc15_common_hw_init(void *handle)
 {
        struct amdgpu_device *adev = (struct amdgpu_device *)handle;
@@ -1249,12 +1230,6 @@ static int soc15_common_hw_init(void *handle)
 
        /* enable the doorbell aperture */
        soc15_enable_doorbell_aperture(adev, true);
-       /* HW doorbell routing policy: doorbell writing not
-        * in SDMA/IH/MM/ACV range will be routed to CP. So
-        * we need to init SDMA/IH/MM/ACV doorbell range prior
-        * to CP ip block init and ring test.
-        */
-       soc15_doorbell_range_init(adev);
 
        return 0;
 }
index 55284b24f113934bcf9470be8ab8c03805dbd3b8..2e50db3b761e4697d0426f9abb3654c85975019d 100644 (file)
@@ -421,6 +421,7 @@ static bool soc21_need_full_reset(struct amdgpu_device *adev)
 {
        switch (adev->ip_versions[GC_HWIP][0]) {
        case IP_VERSION(11, 0, 0):
+               return amdgpu_ras_is_supported(adev, AMDGPU_RAS_BLOCK__UMC);
        case IP_VERSION(11, 0, 2):
                return false;
        default:
index 03b7066471f9ad251d4337350ced36882a10f582..1e83db0c5438d0c07b27bf1540ad6b4bdf2bc61e 100644 (file)
@@ -289,6 +289,10 @@ static int vega10_ih_irq_init(struct amdgpu_device *adev)
                }
        }
 
+       if (!amdgpu_sriov_vf(adev))
+               adev->nbio.funcs->ih_doorbell_range(adev, adev->irq.ih.use_doorbell,
+                                                   adev->irq.ih.doorbell_index);
+
        pci_set_master(adev->pdev);
 
        /* enable interrupts */
index 2022ffbb8dba55e6522e56e689d582c87dc6e543..59dfca093155c6a1cf5bd58b8f62a31e2adf4738 100644 (file)
@@ -340,6 +340,10 @@ static int vega20_ih_irq_init(struct amdgpu_device *adev)
                }
        }
 
+       if (!amdgpu_sriov_vf(adev))
+               adev->nbio.funcs->ih_doorbell_range(adev, adev->irq.ih.use_doorbell,
+                                                   adev->irq.ih.doorbell_index);
+
        pci_set_master(adev->pdev);
 
        /* enable interrupts */
index 5140d9c2bf3b40b689134fa9017cf9953aedecd6..1efe7fa5bc58908bf5db8db43c75e920e411584e 100644 (file)
@@ -4759,7 +4759,7 @@ fill_dc_plane_info_and_addr(struct amdgpu_device *adev,
        plane_info->visible = true;
        plane_info->stereo_format = PLANE_STEREO_FORMAT_NONE;
 
-       plane_info->layer_index = 0;
+       plane_info->layer_index = plane_state->normalized_zpos;
 
        ret = fill_plane_color_attributes(plane_state, plane_info->format,
                                          &plane_info->color_space);
@@ -4827,7 +4827,7 @@ static int fill_dc_plane_attributes(struct amdgpu_device *adev,
        dc_plane_state->global_alpha = plane_info.global_alpha;
        dc_plane_state->global_alpha_value = plane_info.global_alpha_value;
        dc_plane_state->dcc = plane_info.dcc;
-       dc_plane_state->layer_index = plane_info.layer_index; // Always returns 0
+       dc_plane_state->layer_index = plane_info.layer_index;
        dc_plane_state->flip_int_enabled = true;
 
        /*
@@ -9485,6 +9485,14 @@ static int amdgpu_dm_atomic_check(struct drm_device *dev,
                }
        }
 
+       /*
+        * DC consults the zpos (layer_index in DC terminology) to determine the
+        * hw plane on which to enable the hw cursor (see
+        * `dcn10_can_pipe_disable_cursor`). By now, all modified planes are in
+        * atomic state, so call drm helper to normalize zpos.
+        */
+       drm_atomic_normalize_zpos(dev, state);
+
        /* Remove exiting planes if they are modified */
        for_each_oldnew_plane_in_state_reverse(state, plane, old_plane_state, new_plane_state, i) {
                ret = dm_update_plane_state(dc, state, plane,
index c09be3f15fe63a0f010f0aeec682f7f8a0d48b28..23a299c929a1369d902979393542ad2bfaf68f55 100644 (file)
@@ -99,7 +99,7 @@ static int dcn31_get_active_display_cnt_wa(
        return display_count;
 }
 
-static void dcn31_disable_otg_wa(struct clk_mgr *clk_mgr_base, bool disable)
+static void dcn31_disable_otg_wa(struct clk_mgr *clk_mgr_base, struct dc_state *context, bool disable)
 {
        struct dc *dc = clk_mgr_base->ctx->dc;
        int i;
@@ -110,9 +110,10 @@ static void dcn31_disable_otg_wa(struct clk_mgr *clk_mgr_base, bool disable)
                if (pipe->top_pipe || pipe->prev_odm_pipe)
                        continue;
                if (pipe->stream && (pipe->stream->dpms_off || dc_is_virtual_signal(pipe->stream->signal))) {
-                       if (disable)
+                       if (disable) {
                                pipe->stream_res.tg->funcs->immediate_disable_crtc(pipe->stream_res.tg);
-                       else
+                               reset_sync_context_for_pipe(dc, context, i);
+                       } else
                                pipe->stream_res.tg->funcs->enable_crtc(pipe->stream_res.tg);
                }
        }
@@ -211,11 +212,11 @@ void dcn31_update_clocks(struct clk_mgr *clk_mgr_base,
        }
 
        if (should_set_clock(safe_to_lower, new_clocks->dispclk_khz, clk_mgr_base->clks.dispclk_khz)) {
-               dcn31_disable_otg_wa(clk_mgr_base, true);
+               dcn31_disable_otg_wa(clk_mgr_base, context, true);
 
                clk_mgr_base->clks.dispclk_khz = new_clocks->dispclk_khz;
                dcn31_smu_set_dispclk(clk_mgr, clk_mgr_base->clks.dispclk_khz);
-               dcn31_disable_otg_wa(clk_mgr_base, false);
+               dcn31_disable_otg_wa(clk_mgr_base, context, false);
 
                update_dispclk = true;
        }
index beb025cd3dc29671a5917a5d0f01ef2c46410d63..8559dcd80af041266274c5f479a016d78d829daa 100644 (file)
@@ -119,7 +119,7 @@ static int dcn314_get_active_display_cnt_wa(
        return display_count;
 }
 
-static void dcn314_disable_otg_wa(struct clk_mgr *clk_mgr_base, bool disable)
+static void dcn314_disable_otg_wa(struct clk_mgr *clk_mgr_base, struct dc_state *context, bool disable)
 {
        struct dc *dc = clk_mgr_base->ctx->dc;
        int i;
@@ -129,11 +129,11 @@ static void dcn314_disable_otg_wa(struct clk_mgr *clk_mgr_base, bool disable)
 
                if (pipe->top_pipe || pipe->prev_odm_pipe)
                        continue;
-               if (pipe->stream && (pipe->stream->dpms_off || pipe->plane_state == NULL ||
-                                    dc_is_virtual_signal(pipe->stream->signal))) {
-                       if (disable)
+               if (pipe->stream && (pipe->stream->dpms_off || dc_is_virtual_signal(pipe->stream->signal))) {
+                       if (disable) {
                                pipe->stream_res.tg->funcs->immediate_disable_crtc(pipe->stream_res.tg);
-                       else
+                               reset_sync_context_for_pipe(dc, context, i);
+                       } else
                                pipe->stream_res.tg->funcs->enable_crtc(pipe->stream_res.tg);
                }
        }
@@ -233,11 +233,11 @@ void dcn314_update_clocks(struct clk_mgr *clk_mgr_base,
        }
 
        if (should_set_clock(safe_to_lower, new_clocks->dispclk_khz, clk_mgr_base->clks.dispclk_khz)) {
-               dcn314_disable_otg_wa(clk_mgr_base, true);
+               dcn314_disable_otg_wa(clk_mgr_base, context, true);
 
                clk_mgr_base->clks.dispclk_khz = new_clocks->dispclk_khz;
                dcn314_smu_set_dispclk(clk_mgr, clk_mgr_base->clks.dispclk_khz);
-               dcn314_disable_otg_wa(clk_mgr_base, false);
+               dcn314_disable_otg_wa(clk_mgr_base, context, false);
 
                update_dispclk = true;
        }
@@ -670,6 +670,8 @@ static void dcn314_clk_mgr_helper_populate_bw_params(struct clk_mgr_internal *cl
        }
        ASSERT(bw_params->clk_table.entries[i-1].dcfclk_mhz);
        bw_params->vram_type = bios_info->memory_type;
+
+       bw_params->dram_channel_width_bytes = bios_info->memory_type == 0x22 ? 8 : 4;
        bw_params->num_channels = bios_info->ma_channel_number ? bios_info->ma_channel_number : 4;
 
        for (i = 0; i < WM_SET_COUNT; i++) {
index cc076621f5e66a3931a1f11d17c863354c7f10f1..98ad8e0fd2d8a1f6ba0e7e849f77e0f9e8687d4e 100644 (file)
@@ -46,6 +46,9 @@
 #define TO_CLK_MGR_DCN315(clk_mgr)\
        container_of(clk_mgr, struct clk_mgr_dcn315, base)
 
+#define UNSUPPORTED_DCFCLK 10000000
+#define MIN_DPP_DISP_CLK     100000
+
 static int dcn315_get_active_display_cnt_wa(
                struct dc *dc,
                struct dc_state *context)
@@ -79,7 +82,7 @@ static int dcn315_get_active_display_cnt_wa(
        return display_count;
 }
 
-static void dcn315_disable_otg_wa(struct clk_mgr *clk_mgr_base, bool disable)
+static void dcn315_disable_otg_wa(struct clk_mgr *clk_mgr_base, struct dc_state *context, bool disable)
 {
        struct dc *dc = clk_mgr_base->ctx->dc;
        int i;
@@ -91,9 +94,10 @@ static void dcn315_disable_otg_wa(struct clk_mgr *clk_mgr_base, bool disable)
                        continue;
                if (pipe->stream && (pipe->stream->dpms_off || pipe->plane_state == NULL ||
                                     dc_is_virtual_signal(pipe->stream->signal))) {
-                       if (disable)
+                       if (disable) {
                                pipe->stream_res.tg->funcs->immediate_disable_crtc(pipe->stream_res.tg);
-                       else
+                               reset_sync_context_for_pipe(dc, context, i);
+                       } else
                                pipe->stream_res.tg->funcs->enable_crtc(pipe->stream_res.tg);
                }
        }
@@ -146,6 +150,9 @@ static void dcn315_update_clocks(struct clk_mgr *clk_mgr_base,
                }
        }
 
+       /* Lock pstate by requesting unsupported dcfclk if change is unsupported */
+       if (!new_clocks->p_state_change_support)
+               new_clocks->dcfclk_khz = UNSUPPORTED_DCFCLK;
        if (should_set_clock(safe_to_lower, new_clocks->dcfclk_khz, clk_mgr_base->clks.dcfclk_khz)) {
                clk_mgr_base->clks.dcfclk_khz = new_clocks->dcfclk_khz;
                dcn315_smu_set_hard_min_dcfclk(clk_mgr, clk_mgr_base->clks.dcfclk_khz);
@@ -159,10 +166,10 @@ static void dcn315_update_clocks(struct clk_mgr *clk_mgr_base,
 
        // workaround: Limit dppclk to 100Mhz to avoid lower eDP panel switch to plus 4K monitor underflow.
        if (!IS_DIAG_DC(dc->ctx->dce_environment)) {
-               if (new_clocks->dppclk_khz < 100000)
-                       new_clocks->dppclk_khz = 100000;
-               if (new_clocks->dispclk_khz < 100000)
-                       new_clocks->dispclk_khz = 100000;
+               if (new_clocks->dppclk_khz < MIN_DPP_DISP_CLK)
+                       new_clocks->dppclk_khz = MIN_DPP_DISP_CLK;
+               if (new_clocks->dispclk_khz < MIN_DPP_DISP_CLK)
+                       new_clocks->dispclk_khz = MIN_DPP_DISP_CLK;
        }
 
        if (should_set_clock(safe_to_lower, new_clocks->dppclk_khz, clk_mgr->base.clks.dppclk_khz)) {
@@ -175,12 +182,12 @@ static void dcn315_update_clocks(struct clk_mgr *clk_mgr_base,
        if (should_set_clock(safe_to_lower, new_clocks->dispclk_khz, clk_mgr_base->clks.dispclk_khz)) {
                /* No need to apply the w/a if we haven't taken over from bios yet */
                if (clk_mgr_base->clks.dispclk_khz)
-                       dcn315_disable_otg_wa(clk_mgr_base, true);
+                       dcn315_disable_otg_wa(clk_mgr_base, context, true);
 
                clk_mgr_base->clks.dispclk_khz = new_clocks->dispclk_khz;
                dcn315_smu_set_dispclk(clk_mgr, clk_mgr_base->clks.dispclk_khz);
                if (clk_mgr_base->clks.dispclk_khz)
-                       dcn315_disable_otg_wa(clk_mgr_base, false);
+                       dcn315_disable_otg_wa(clk_mgr_base, context, false);
 
                update_dispclk = true;
        }
@@ -275,7 +282,7 @@ static struct wm_table ddr5_wm_table = {
                {
                        .wm_inst = WM_A,
                        .wm_type = WM_TYPE_PSTATE_CHG,
-                       .pstate_latency_us = 64.0,
+                       .pstate_latency_us = 129.0,
                        .sr_exit_time_us = 11.5,
                        .sr_enter_plus_exit_time_us = 14.5,
                        .valid = true,
@@ -283,7 +290,7 @@ static struct wm_table ddr5_wm_table = {
                {
                        .wm_inst = WM_B,
                        .wm_type = WM_TYPE_PSTATE_CHG,
-                       .pstate_latency_us = 64.0,
+                       .pstate_latency_us = 129.0,
                        .sr_exit_time_us = 11.5,
                        .sr_enter_plus_exit_time_us = 14.5,
                        .valid = true,
@@ -291,7 +298,7 @@ static struct wm_table ddr5_wm_table = {
                {
                        .wm_inst = WM_C,
                        .wm_type = WM_TYPE_PSTATE_CHG,
-                       .pstate_latency_us = 64.0,
+                       .pstate_latency_us = 129.0,
                        .sr_exit_time_us = 11.5,
                        .sr_enter_plus_exit_time_us = 14.5,
                        .valid = true,
@@ -299,7 +306,7 @@ static struct wm_table ddr5_wm_table = {
                {
                        .wm_inst = WM_D,
                        .wm_type = WM_TYPE_PSTATE_CHG,
-                       .pstate_latency_us = 64.0,
+                       .pstate_latency_us = 129.0,
                        .sr_exit_time_us = 11.5,
                        .sr_enter_plus_exit_time_us = 14.5,
                        .valid = true,
@@ -556,8 +563,7 @@ static void dcn315_clk_mgr_helper_populate_bw_params(
        ASSERT(bw_params->clk_table.entries[i-1].dcfclk_mhz);
        bw_params->vram_type = bios_info->memory_type;
        bw_params->num_channels = bios_info->ma_channel_number;
-       if (!bw_params->num_channels)
-               bw_params->num_channels = 2;
+       bw_params->dram_channel_width_bytes = bios_info->memory_type == 0x22 ? 8 : 4;
 
        for (i = 0; i < WM_SET_COUNT; i++) {
                bw_params->wm_table.entries[i].wm_inst = i;
index 0cd3d2eb7ac700f26f1bec4166f737114cfe475f..187f5b27fdc80dec1545a7c75d5622dd04d4e368 100644 (file)
@@ -112,7 +112,7 @@ static int dcn316_get_active_display_cnt_wa(
        return display_count;
 }
 
-static void dcn316_disable_otg_wa(struct clk_mgr *clk_mgr_base, bool disable)
+static void dcn316_disable_otg_wa(struct clk_mgr *clk_mgr_base, struct dc_state *context, bool disable)
 {
        struct dc *dc = clk_mgr_base->ctx->dc;
        int i;
@@ -124,9 +124,10 @@ static void dcn316_disable_otg_wa(struct clk_mgr *clk_mgr_base, bool disable)
                        continue;
                if (pipe->stream && (pipe->stream->dpms_off || pipe->plane_state == NULL ||
                                     dc_is_virtual_signal(pipe->stream->signal))) {
-                       if (disable)
+                       if (disable) {
                                pipe->stream_res.tg->funcs->immediate_disable_crtc(pipe->stream_res.tg);
-                       else
+                               reset_sync_context_for_pipe(dc, context, i);
+                       } else
                                pipe->stream_res.tg->funcs->enable_crtc(pipe->stream_res.tg);
                }
        }
@@ -221,11 +222,11 @@ static void dcn316_update_clocks(struct clk_mgr *clk_mgr_base,
        }
 
        if (should_set_clock(safe_to_lower, new_clocks->dispclk_khz, clk_mgr_base->clks.dispclk_khz)) {
-               dcn316_disable_otg_wa(clk_mgr_base, true);
+               dcn316_disable_otg_wa(clk_mgr_base, context, true);
 
                clk_mgr_base->clks.dispclk_khz = new_clocks->dispclk_khz;
                dcn316_smu_set_dispclk(clk_mgr, clk_mgr_base->clks.dispclk_khz);
-               dcn316_disable_otg_wa(clk_mgr_base, false);
+               dcn316_disable_otg_wa(clk_mgr_base, context, false);
 
                update_dispclk = true;
        }
index 48dad093ae8ba845a7dbdaecdf1b1b308bd6b0a7..780f7f4c28b62e709b411fcafeb5af248679accd 100644 (file)
@@ -2758,8 +2758,14 @@ bool perform_link_training_with_retries(
                                                skip_video_pattern);
 
                                /* Transmit idle pattern once training successful. */
-                               if (status == LINK_TRAINING_SUCCESS && !is_link_bw_low)
+                               if (status == LINK_TRAINING_SUCCESS && !is_link_bw_low) {
                                        dp_set_hw_test_pattern(link, &pipe_ctx->link_res, DP_TEST_PATTERN_VIDEO_MODE, NULL, 0);
+                                       /* Update verified link settings to current one
+                                        * Because DPIA LT might fallback to lower link setting.
+                                        */
+                                       link->verified_link_cap.link_rate = link->cur_link_settings.link_rate;
+                                       link->verified_link_cap.lane_count = link->cur_link_settings.lane_count;
+                               }
                        } else {
                                status = dc_link_dp_perform_link_training(link,
                                                &pipe_ctx->link_res,
@@ -5121,6 +5127,14 @@ bool dp_retrieve_lttpr_cap(struct dc_link *link)
                                lttpr_dpcd_data[DP_PHY_REPEATER_128B132B_RATES -
                                                                DP_LT_TUNABLE_PHY_REPEATER_FIELD_DATA_STRUCTURE_REV];
 
+               /* If this chip cap is set, at least one retimer must exist in the chain
+                * Override count to 1 if we receive a known bad count (0 or an invalid value) */
+               if (link->chip_caps & EXT_DISPLAY_PATH_CAPS__DP_FIXED_VS_EN &&
+                               (dp_convert_to_count(link->dpcd_caps.lttpr_caps.phy_repeater_cnt) == 0)) {
+                       ASSERT(0);
+                       link->dpcd_caps.lttpr_caps.phy_repeater_cnt = 0x80;
+               }
+
                /* Attempt to train in LTTPR transparent mode if repeater count exceeds 8. */
                is_lttpr_present = (link->dpcd_caps.lttpr_caps.max_lane_count > 0 &&
                                link->dpcd_caps.lttpr_caps.max_lane_count <= 4 &&
index 7dbab15bfa68fc0d8cd1ccfc1e242d7901803959..ccf7bd3d90fe7ddd653a07b9bc086c9e73091d2e 100644 (file)
@@ -3584,6 +3584,23 @@ void check_syncd_pipes_for_disabled_master_pipe(struct dc *dc,
        }
 }
 
+void reset_sync_context_for_pipe(const struct dc *dc,
+       struct dc_state *context,
+       uint8_t pipe_idx)
+{
+       int i;
+       struct pipe_ctx *pipe_ctx_reset;
+
+       /* reset the otg sync context for the pipe and its slave pipes if any */
+       for (i = 0; i < dc->res_pool->pipe_count; i++) {
+               pipe_ctx_reset = &context->res_ctx.pipe_ctx[i];
+
+               if (((GET_PIPE_SYNCD_FROM_PIPE(pipe_ctx_reset) == pipe_idx) &&
+                       IS_PIPE_SYNCD_VALID(pipe_ctx_reset)) || (i == pipe_idx))
+                       SET_PIPE_SYNCD_TO_PIPE(pipe_ctx_reset, i);
+       }
+}
+
 uint8_t resource_transmitter_to_phy_idx(const struct dc *dc, enum transmitter transmitter)
 {
        /* TODO - get transmitter to phy idx mapping from DMUB */
index f62d50901d92e8ea225d98575583481599c49bbc..0c85ab5933b4a5c7203b8cc1063437f0646379dd 100644 (file)
@@ -329,7 +329,7 @@ bool dc_stream_set_cursor_attributes(
 
        dc = stream->ctx->dc;
 
-       if (attributes->height * attributes->width * 4 > 16384)
+       if (dc->debug.allow_sw_cursor_fallback && attributes->height * attributes->width * 4 > 16384)
                if (stream->mall_stream_config.type == SUBVP_MAIN)
                        return false;
 
index 5908b60db313964c9a888b470926a5cc1d478a4c..dbf8158b832e454ead45c1032be1280944a78ea2 100644 (file)
@@ -745,6 +745,7 @@ struct dc_debug_options {
        bool disable_fixed_vs_aux_timeout_wa;
        bool force_disable_subvp;
        bool force_subvp_mclk_switch;
+       bool allow_sw_cursor_fallback;
        bool force_usr_allow;
        /* uses value at boot and disables switch */
        bool disable_dtb_ref_clk_switch;
index 09b304507badb6bc5ec6b800e53a771888edeb61..52a61b3e5a8b06a54ca13f1ca02627fe882794cf 100644 (file)
@@ -417,44 +417,42 @@ static void populate_subvp_cmd_drr_info(struct dc *dc,
        struct dc_crtc_timing *main_timing = &subvp_pipe->stream->timing;
        struct dc_crtc_timing *phantom_timing = &subvp_pipe->stream->mall_stream_config.paired_stream->timing;
        struct dc_crtc_timing *drr_timing = &vblank_pipe->stream->timing;
-       int16_t drr_frame_us = 0;
-       int16_t min_drr_supported_us = 0;
-       int16_t max_drr_supported_us = 0;
-       int16_t max_drr_vblank_us = 0;
-       int16_t max_drr_mallregion_us = 0;
-       int16_t mall_region_us = 0;
-       int16_t prefetch_us = 0;
-       int16_t subvp_active_us = 0;
-       int16_t drr_active_us = 0;
-       int16_t min_vtotal_supported = 0;
-       int16_t max_vtotal_supported = 0;
+       uint16_t drr_frame_us = 0;
+       uint16_t min_drr_supported_us = 0;
+       uint16_t max_drr_supported_us = 0;
+       uint16_t max_drr_vblank_us = 0;
+       uint16_t max_drr_mallregion_us = 0;
+       uint16_t mall_region_us = 0;
+       uint16_t prefetch_us = 0;
+       uint16_t subvp_active_us = 0;
+       uint16_t drr_active_us = 0;
+       uint16_t min_vtotal_supported = 0;
+       uint16_t max_vtotal_supported = 0;
 
        pipe_data->pipe_config.vblank_data.drr_info.drr_in_use = true;
        pipe_data->pipe_config.vblank_data.drr_info.use_ramping = false; // for now don't use ramping
        pipe_data->pipe_config.vblank_data.drr_info.drr_window_size_ms = 4; // hardcode 4ms DRR window for now
 
-       drr_frame_us = div64_s64(drr_timing->v_total * drr_timing->h_total,
-                                (int64_t)(drr_timing->pix_clk_100hz * 100) * 1000000);
+       drr_frame_us = div64_u64(((uint64_t)drr_timing->v_total * drr_timing->h_total * 1000000),
+                       (((uint64_t)drr_timing->pix_clk_100hz * 100)));
        // P-State allow width and FW delays already included phantom_timing->v_addressable
-       mall_region_us = div64_s64(phantom_timing->v_addressable * phantom_timing->h_total,
-                                  (int64_t)(phantom_timing->pix_clk_100hz * 100) * 1000000);
+       mall_region_us = div64_u64(((uint64_t)phantom_timing->v_addressable * phantom_timing->h_total * 1000000),
+                       (((uint64_t)phantom_timing->pix_clk_100hz * 100)));
        min_drr_supported_us = drr_frame_us + mall_region_us + SUBVP_DRR_MARGIN_US;
-       min_vtotal_supported = div64_s64(drr_timing->pix_clk_100hz * 100 *
-                                        (div64_s64((int64_t)min_drr_supported_us, 1000000)),
-                                        (int64_t)drr_timing->h_total);
-
-       prefetch_us = div64_s64((phantom_timing->v_total - phantom_timing->v_front_porch) * phantom_timing->h_total,
-                               (int64_t)(phantom_timing->pix_clk_100hz * 100) * 1000000 +
-                               dc->caps.subvp_prefetch_end_to_mall_start_us);
-       subvp_active_us = div64_s64(main_timing->v_addressable * main_timing->h_total,
-                                   (int64_t)(main_timing->pix_clk_100hz * 100) * 1000000);
-       drr_active_us = div64_s64(drr_timing->v_addressable * drr_timing->h_total,
-                                 (int64_t)(drr_timing->pix_clk_100hz * 100) * 1000000);
-       max_drr_vblank_us = div64_s64((int64_t)(subvp_active_us - prefetch_us - drr_active_us), 2) + drr_active_us;
+       min_vtotal_supported = div64_u64(((uint64_t)drr_timing->pix_clk_100hz * 100 * min_drr_supported_us),
+                       (((uint64_t)drr_timing->h_total * 1000000)));
+
+       prefetch_us = div64_u64(((uint64_t)(phantom_timing->v_total - phantom_timing->v_front_porch) * phantom_timing->h_total * 1000000),
+                       (((uint64_t)phantom_timing->pix_clk_100hz * 100) + dc->caps.subvp_prefetch_end_to_mall_start_us));
+       subvp_active_us = div64_u64(((uint64_t)main_timing->v_addressable * main_timing->h_total * 1000000),
+                       (((uint64_t)main_timing->pix_clk_100hz * 100)));
+       drr_active_us = div64_u64(((uint64_t)drr_timing->v_addressable * drr_timing->h_total * 1000000),
+                       (((uint64_t)drr_timing->pix_clk_100hz * 100)));
+       max_drr_vblank_us = div64_u64((subvp_active_us - prefetch_us - drr_active_us), 2) + drr_active_us;
        max_drr_mallregion_us = subvp_active_us - prefetch_us - mall_region_us;
        max_drr_supported_us = max_drr_vblank_us > max_drr_mallregion_us ? max_drr_vblank_us : max_drr_mallregion_us;
-       max_vtotal_supported = div64_s64(drr_timing->pix_clk_100hz * 100 * (div64_s64((int64_t)max_drr_supported_us, 1000000)),
-                                        (int64_t)drr_timing->h_total);
+       max_vtotal_supported = div64_u64(((uint64_t)drr_timing->pix_clk_100hz * 100 * max_drr_supported_us),
+                       (((uint64_t)drr_timing->h_total * 1000000)));
 
        pipe_data->pipe_config.vblank_data.drr_info.min_vtotal_supported = min_vtotal_supported;
        pipe_data->pipe_config.vblank_data.drr_info.max_vtotal_supported = max_vtotal_supported;
@@ -548,10 +546,12 @@ static void update_subvp_prefetch_end_to_mall_start(struct dc *dc,
        struct dc_crtc_timing *phantom_timing1 = &subvp_pipes[1]->stream->mall_stream_config.paired_stream->timing;
        struct dmub_cmd_fw_assisted_mclk_switch_pipe_data_v2 *pipe_data = NULL;
 
-       subvp0_prefetch_us = div64_s64((phantom_timing0->v_total - phantom_timing0->v_front_porch) * phantom_timing0->h_total,
-                                      (int64_t)(phantom_timing0->pix_clk_100hz * 100) * 1000000 + dc->caps.subvp_prefetch_end_to_mall_start_us);
-       subvp1_prefetch_us = div64_s64((phantom_timing1->v_total - phantom_timing1->v_front_porch) * phantom_timing1->h_total,
-                                      (int64_t)(phantom_timing1->pix_clk_100hz * 100) * 1000000 + dc->caps.subvp_prefetch_end_to_mall_start_us);
+       subvp0_prefetch_us = div64_u64(((uint64_t)(phantom_timing0->v_total - phantom_timing0->v_front_porch) *
+                       (uint64_t)phantom_timing0->h_total * 1000000),
+                       (((uint64_t)phantom_timing0->pix_clk_100hz * 100) + dc->caps.subvp_prefetch_end_to_mall_start_us));
+       subvp1_prefetch_us = div64_u64(((uint64_t)(phantom_timing1->v_total - phantom_timing1->v_front_porch) *
+                       (uint64_t)phantom_timing1->h_total * 1000000),
+                       (((uint64_t)phantom_timing1->pix_clk_100hz * 100) + dc->caps.subvp_prefetch_end_to_mall_start_us));
 
        // Whichever SubVP PIPE has the smaller prefetch (including the prefetch end to mall start time)
        // should increase it's prefetch time to match the other
@@ -559,16 +559,17 @@ static void update_subvp_prefetch_end_to_mall_start(struct dc *dc,
                pipe_data = &cmd->fw_assisted_mclk_switch_v2.config_data.pipe_data[1];
                prefetch_delta_us = subvp0_prefetch_us - subvp1_prefetch_us;
                pipe_data->pipe_config.subvp_data.prefetch_to_mall_start_lines =
-                       div64_s64(((div64_s64((int64_t)(dc->caps.subvp_prefetch_end_to_mall_start_us + prefetch_delta_us), 1000000)) *
-                                  (phantom_timing1->pix_clk_100hz * 100) + phantom_timing1->h_total - 1),
-                                 (int64_t)phantom_timing1->h_total);
+                               div64_u64(((uint64_t)(dc->caps.subvp_prefetch_end_to_mall_start_us + prefetch_delta_us) *
+                                       ((uint64_t)phantom_timing1->pix_clk_100hz * 100) + ((uint64_t)phantom_timing1->h_total * 1000000 - 1)),
+                                       ((uint64_t)phantom_timing1->h_total * 1000000));
+
        } else if (subvp1_prefetch_us >  subvp0_prefetch_us) {
                pipe_data = &cmd->fw_assisted_mclk_switch_v2.config_data.pipe_data[0];
                prefetch_delta_us = subvp1_prefetch_us - subvp0_prefetch_us;
                pipe_data->pipe_config.subvp_data.prefetch_to_mall_start_lines =
-                       div64_s64(((div64_s64((int64_t)(dc->caps.subvp_prefetch_end_to_mall_start_us + prefetch_delta_us), 1000000)) *
-                                  (phantom_timing0->pix_clk_100hz * 100) + phantom_timing0->h_total - 1),
-                                 (int64_t)phantom_timing0->h_total);
+                               div64_u64(((uint64_t)(dc->caps.subvp_prefetch_end_to_mall_start_us + prefetch_delta_us) *
+                                       ((uint64_t)phantom_timing0->pix_clk_100hz * 100) + ((uint64_t)phantom_timing0->h_total * 1000000 - 1)),
+                                       ((uint64_t)phantom_timing0->h_total * 1000000));
        }
 }
 
@@ -630,13 +631,11 @@ static void populate_subvp_cmd_pipe_info(struct dc *dc,
 
        // Round up
        pipe_data->pipe_config.subvp_data.prefetch_to_mall_start_lines =
-               div64_s64(((div64_s64((int64_t)dc->caps.subvp_prefetch_end_to_mall_start_us, 1000000)) *
-                          (phantom_timing->pix_clk_100hz * 100) + phantom_timing->h_total - 1),
-                         (int64_t)phantom_timing->h_total);
+                       div64_u64(((uint64_t)dc->caps.subvp_prefetch_end_to_mall_start_us * ((uint64_t)phantom_timing->pix_clk_100hz * 100) +
+                                       ((uint64_t)phantom_timing->h_total * 1000000 - 1)), ((uint64_t)phantom_timing->h_total * 1000000));
        pipe_data->pipe_config.subvp_data.processing_delay_lines =
-               div64_s64(((div64_s64((int64_t)dc->caps.subvp_fw_processing_delay_us, 1000000)) *
-                          (phantom_timing->pix_clk_100hz * 100) + phantom_timing->h_total - 1),
-                         (int64_t)phantom_timing->h_total);
+                       div64_u64(((uint64_t)(dc->caps.subvp_fw_processing_delay_us) * ((uint64_t)phantom_timing->pix_clk_100hz * 100) +
+                                       ((uint64_t)phantom_timing->h_total * 1000000 - 1)), ((uint64_t)phantom_timing->h_total * 1000000));
        // Find phantom pipe index based on phantom stream
        for (j = 0; j < dc->res_pool->pipe_count; j++) {
                struct pipe_ctx *phantom_pipe = &context->res_ctx.pipe_ctx[j];
index 38a67051d470f24cd1407a0a828b035760b7d36c..aea49334021c90b2f9183713b024721808e9d606 100644 (file)
@@ -2164,7 +2164,8 @@ static void dce110_setup_audio_dto(
                        continue;
                if (pipe_ctx->stream->signal != SIGNAL_TYPE_HDMI_TYPE_A)
                        continue;
-               if (pipe_ctx->stream_res.audio != NULL) {
+               if (pipe_ctx->stream_res.audio != NULL &&
+                       pipe_ctx->stream_res.audio->enabled == false) {
                        struct audio_output audio_output;
 
                        build_audio_output(context, pipe_ctx, &audio_output);
@@ -2204,7 +2205,8 @@ static void dce110_setup_audio_dto(
                        if (!dc_is_dp_signal(pipe_ctx->stream->signal))
                                continue;
 
-                       if (pipe_ctx->stream_res.audio != NULL) {
+                       if (pipe_ctx->stream_res.audio != NULL &&
+                               pipe_ctx->stream_res.audio->enabled == false) {
                                struct audio_output audio_output;
 
                                build_audio_output(context, pipe_ctx, &audio_output);
index cd2671161ef1601b515c4fe1aa8bdb1a4c57b479..7ce64a3c1b02b4364e3bc9387550e76e06a81e60 100644 (file)
        type DSCRM_DSC_FORWARD_EN; \
        type DSCRM_DSC_OPP_PIPE_SOURCE
 
-#define DSC_REG_LIST_DCN314(id) \
-       SRI(DSC_TOP_CONTROL, DSC_TOP, id),\
-       SRI(DSC_DEBUG_CONTROL, DSC_TOP, id),\
-       SRI(DSCC_CONFIG0, DSCC, id),\
-       SRI(DSCC_CONFIG1, DSCC, id),\
-       SRI(DSCC_STATUS, DSCC, id),\
-       SRI(DSCC_INTERRUPT_CONTROL_STATUS, DSCC, id),\
-       SRI(DSCC_PPS_CONFIG0, DSCC, id),\
-       SRI(DSCC_PPS_CONFIG1, DSCC, id),\
-       SRI(DSCC_PPS_CONFIG2, DSCC, id),\
-       SRI(DSCC_PPS_CONFIG3, DSCC, id),\
-       SRI(DSCC_PPS_CONFIG4, DSCC, id),\
-       SRI(DSCC_PPS_CONFIG5, DSCC, id),\
-       SRI(DSCC_PPS_CONFIG6, DSCC, id),\
-       SRI(DSCC_PPS_CONFIG7, DSCC, id),\
-       SRI(DSCC_PPS_CONFIG8, DSCC, id),\
-       SRI(DSCC_PPS_CONFIG9, DSCC, id),\
-       SRI(DSCC_PPS_CONFIG10, DSCC, id),\
-       SRI(DSCC_PPS_CONFIG11, DSCC, id),\
-       SRI(DSCC_PPS_CONFIG12, DSCC, id),\
-       SRI(DSCC_PPS_CONFIG13, DSCC, id),\
-       SRI(DSCC_PPS_CONFIG14, DSCC, id),\
-       SRI(DSCC_PPS_CONFIG15, DSCC, id),\
-       SRI(DSCC_PPS_CONFIG16, DSCC, id),\
-       SRI(DSCC_PPS_CONFIG17, DSCC, id),\
-       SRI(DSCC_PPS_CONFIG18, DSCC, id),\
-       SRI(DSCC_PPS_CONFIG19, DSCC, id),\
-       SRI(DSCC_PPS_CONFIG20, DSCC, id),\
-       SRI(DSCC_PPS_CONFIG21, DSCC, id),\
-       SRI(DSCC_PPS_CONFIG22, DSCC, id),\
-       SRI(DSCC_MEM_POWER_CONTROL, DSCC, id),\
-       SRI(DSCC_R_Y_SQUARED_ERROR_LOWER, DSCC, id),\
-       SRI(DSCC_R_Y_SQUARED_ERROR_UPPER, DSCC, id),\
-       SRI(DSCC_G_CB_SQUARED_ERROR_LOWER, DSCC, id),\
-       SRI(DSCC_G_CB_SQUARED_ERROR_UPPER, DSCC, id),\
-       SRI(DSCC_B_CR_SQUARED_ERROR_LOWER, DSCC, id),\
-       SRI(DSCC_B_CR_SQUARED_ERROR_UPPER, DSCC, id),\
-       SRI(DSCC_MAX_ABS_ERROR0, DSCC, id),\
-       SRI(DSCC_MAX_ABS_ERROR1, DSCC, id),\
-       SRI(DSCC_RATE_BUFFER0_MAX_FULLNESS_LEVEL, DSCC, id),\
-       SRI(DSCC_RATE_BUFFER1_MAX_FULLNESS_LEVEL, DSCC, id),\
-       SRI(DSCC_RATE_BUFFER2_MAX_FULLNESS_LEVEL, DSCC, id),\
-       SRI(DSCC_RATE_BUFFER3_MAX_FULLNESS_LEVEL, DSCC, id),\
-       SRI(DSCC_RATE_CONTROL_BUFFER0_MAX_FULLNESS_LEVEL, DSCC, id),\
-       SRI(DSCC_RATE_CONTROL_BUFFER1_MAX_FULLNESS_LEVEL, DSCC, id),\
-       SRI(DSCC_RATE_CONTROL_BUFFER2_MAX_FULLNESS_LEVEL, DSCC, id),\
-       SRI(DSCC_RATE_CONTROL_BUFFER3_MAX_FULLNESS_LEVEL, DSCC, id),\
-       SRI(DSCCIF_CONFIG0, DSCCIF, id),\
-       SRI(DSCCIF_CONFIG1, DSCCIF, id),\
-       SRI(DSCRM_DSC_FORWARD_CONFIG, DSCRM, id)
-
-#define DSC_REG_LIST_SH_MASK_DCN314(mask_sh)\
-       DSC_SF(DSC_TOP0_DSC_TOP_CONTROL, DSC_CLOCK_EN, mask_sh), \
-       DSC_SF(DSC_TOP0_DSC_TOP_CONTROL, DSC_DISPCLK_R_GATE_DIS, mask_sh), \
-       DSC_SF(DSC_TOP0_DSC_TOP_CONTROL, DSC_DSCCLK_R_GATE_DIS, mask_sh), \
-       DSC_SF(DSC_TOP0_DSC_DEBUG_CONTROL, DSC_DBG_EN, mask_sh), \
-       DSC_SF(DSC_TOP0_DSC_DEBUG_CONTROL, DSC_TEST_CLOCK_MUX_SEL, mask_sh), \
-       DSC_SF(DSCC0_DSCC_CONFIG0, NUMBER_OF_SLICES_PER_LINE, mask_sh), \
-       DSC_SF(DSCC0_DSCC_CONFIG0, ALTERNATE_ICH_ENCODING_EN, mask_sh), \
-       DSC_SF(DSCC0_DSCC_CONFIG0, NUMBER_OF_SLICES_IN_VERTICAL_DIRECTION, mask_sh), \
-       DSC_SF(DSCC0_DSCC_CONFIG1, DSCC_RATE_CONTROL_BUFFER_MODEL_SIZE, mask_sh), \
-       /*DSC_SF(DSCC0_DSCC_CONFIG1, DSCC_DISABLE_ICH, mask_sh),*/ \
-       DSC_SF(DSCC0_DSCC_STATUS, DSCC_DOUBLE_BUFFER_REG_UPDATE_PENDING, mask_sh), \
-       DSC_SF(DSCC0_DSCC_INTERRUPT_CONTROL_STATUS, DSCC_RATE_BUFFER0_OVERFLOW_OCCURRED, mask_sh), \
-       DSC_SF(DSCC0_DSCC_INTERRUPT_CONTROL_STATUS, DSCC_RATE_BUFFER1_OVERFLOW_OCCURRED, mask_sh), \
-       DSC_SF(DSCC0_DSCC_INTERRUPT_CONTROL_STATUS, DSCC_RATE_BUFFER2_OVERFLOW_OCCURRED, mask_sh), \
-       DSC_SF(DSCC0_DSCC_INTERRUPT_CONTROL_STATUS, DSCC_RATE_BUFFER3_OVERFLOW_OCCURRED, mask_sh), \
-       DSC_SF(DSCC0_DSCC_INTERRUPT_CONTROL_STATUS, DSCC_RATE_BUFFER0_UNDERFLOW_OCCURRED, mask_sh), \
-       DSC_SF(DSCC0_DSCC_INTERRUPT_CONTROL_STATUS, DSCC_RATE_BUFFER1_UNDERFLOW_OCCURRED, mask_sh), \
-       DSC_SF(DSCC0_DSCC_INTERRUPT_CONTROL_STATUS, DSCC_RATE_BUFFER2_UNDERFLOW_OCCURRED, mask_sh), \
-       DSC_SF(DSCC0_DSCC_INTERRUPT_CONTROL_STATUS, DSCC_RATE_BUFFER3_UNDERFLOW_OCCURRED, mask_sh), \
-       DSC_SF(DSCC0_DSCC_INTERRUPT_CONTROL_STATUS, DSCC_RATE_CONTROL_BUFFER_MODEL0_OVERFLOW_OCCURRED, mask_sh), \
-       DSC_SF(DSCC0_DSCC_INTERRUPT_CONTROL_STATUS, DSCC_RATE_CONTROL_BUFFER_MODEL1_OVERFLOW_OCCURRED, mask_sh), \
-       DSC_SF(DSCC0_DSCC_INTERRUPT_CONTROL_STATUS, DSCC_RATE_CONTROL_BUFFER_MODEL2_OVERFLOW_OCCURRED, mask_sh), \
-       DSC_SF(DSCC0_DSCC_INTERRUPT_CONTROL_STATUS, DSCC_RATE_CONTROL_BUFFER_MODEL3_OVERFLOW_OCCURRED, mask_sh), \
-       DSC_SF(DSCC0_DSCC_INTERRUPT_CONTROL_STATUS, DSCC_RATE_BUFFER0_OVERFLOW_OCCURRED_INT_EN, mask_sh), \
-       DSC_SF(DSCC0_DSCC_INTERRUPT_CONTROL_STATUS, DSCC_RATE_BUFFER1_OVERFLOW_OCCURRED_INT_EN, mask_sh), \
-       DSC_SF(DSCC0_DSCC_INTERRUPT_CONTROL_STATUS, DSCC_RATE_BUFFER2_OVERFLOW_OCCURRED_INT_EN, mask_sh), \
-       DSC_SF(DSCC0_DSCC_INTERRUPT_CONTROL_STATUS, DSCC_RATE_BUFFER3_OVERFLOW_OCCURRED_INT_EN, mask_sh), \
-       DSC_SF(DSCC0_DSCC_INTERRUPT_CONTROL_STATUS, DSCC_RATE_BUFFER0_UNDERFLOW_OCCURRED_INT_EN, mask_sh), \
-       DSC_SF(DSCC0_DSCC_INTERRUPT_CONTROL_STATUS, DSCC_RATE_BUFFER1_UNDERFLOW_OCCURRED_INT_EN, mask_sh), \
-       DSC_SF(DSCC0_DSCC_INTERRUPT_CONTROL_STATUS, DSCC_RATE_BUFFER2_UNDERFLOW_OCCURRED_INT_EN, mask_sh), \
-       DSC_SF(DSCC0_DSCC_INTERRUPT_CONTROL_STATUS, DSCC_RATE_BUFFER3_UNDERFLOW_OCCURRED_INT_EN, mask_sh), \
-       DSC_SF(DSCC0_DSCC_INTERRUPT_CONTROL_STATUS, DSCC_RATE_CONTROL_BUFFER_MODEL0_OVERFLOW_OCCURRED_INT_EN, mask_sh), \
-       DSC_SF(DSCC0_DSCC_INTERRUPT_CONTROL_STATUS, DSCC_RATE_CONTROL_BUFFER_MODEL1_OVERFLOW_OCCURRED_INT_EN, mask_sh), \
-       DSC_SF(DSCC0_DSCC_INTERRUPT_CONTROL_STATUS, DSCC_RATE_CONTROL_BUFFER_MODEL2_OVERFLOW_OCCURRED_INT_EN, mask_sh), \
-       DSC_SF(DSCC0_DSCC_INTERRUPT_CONTROL_STATUS, DSCC_RATE_CONTROL_BUFFER_MODEL3_OVERFLOW_OCCURRED_INT_EN, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG0, DSC_VERSION_MINOR, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG0, DSC_VERSION_MAJOR, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG0, PPS_IDENTIFIER, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG0, LINEBUF_DEPTH, mask_sh), \
-       DSC2_SF(DSCC0, DSCC_PPS_CONFIG0__BITS_PER_COMPONENT, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG1, BITS_PER_PIXEL, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG1, VBR_ENABLE, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG1, SIMPLE_422, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG1, CONVERT_RGB, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG1, BLOCK_PRED_ENABLE, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG1, NATIVE_422, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG1, NATIVE_420, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG1, CHUNK_SIZE, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG2, PIC_WIDTH, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG2, PIC_HEIGHT, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG3, SLICE_WIDTH, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG3, SLICE_HEIGHT, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG4, INITIAL_XMIT_DELAY, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG4, INITIAL_DEC_DELAY, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG5, INITIAL_SCALE_VALUE, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG5, SCALE_INCREMENT_INTERVAL, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG6, SCALE_DECREMENT_INTERVAL, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG6, FIRST_LINE_BPG_OFFSET, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG6, SECOND_LINE_BPG_OFFSET, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG7, NFL_BPG_OFFSET, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG7, SLICE_BPG_OFFSET, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG8, NSL_BPG_OFFSET, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG8, SECOND_LINE_OFFSET_ADJ, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG9, INITIAL_OFFSET, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG9, FINAL_OFFSET, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG10, FLATNESS_MIN_QP, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG10, FLATNESS_MAX_QP, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG10, RC_MODEL_SIZE, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG11, RC_EDGE_FACTOR, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG11, RC_QUANT_INCR_LIMIT0, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG11, RC_QUANT_INCR_LIMIT1, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG11, RC_TGT_OFFSET_LO, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG11, RC_TGT_OFFSET_HI, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG12, RC_BUF_THRESH0, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG12, RC_BUF_THRESH1, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG12, RC_BUF_THRESH2, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG12, RC_BUF_THRESH3, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG13, RC_BUF_THRESH4, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG13, RC_BUF_THRESH5, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG13, RC_BUF_THRESH6, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG13, RC_BUF_THRESH7, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG14, RC_BUF_THRESH8, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG14, RC_BUF_THRESH9, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG14, RC_BUF_THRESH10, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG14, RC_BUF_THRESH11, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG15, RC_BUF_THRESH12, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG15, RC_BUF_THRESH13, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG15, RANGE_MIN_QP0, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG15, RANGE_MAX_QP0, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG15, RANGE_BPG_OFFSET0, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG16, RANGE_MIN_QP1, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG16, RANGE_MAX_QP1, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG16, RANGE_BPG_OFFSET1, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG16, RANGE_MIN_QP2, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG16, RANGE_MAX_QP2, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG16, RANGE_BPG_OFFSET2, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG17, RANGE_MIN_QP3, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG17, RANGE_MAX_QP3, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG17, RANGE_BPG_OFFSET3, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG17, RANGE_MIN_QP4, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG17, RANGE_MAX_QP4, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG17, RANGE_BPG_OFFSET4, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG18, RANGE_MIN_QP5, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG18, RANGE_MAX_QP5, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG18, RANGE_BPG_OFFSET5, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG18, RANGE_MIN_QP6, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG18, RANGE_MAX_QP6, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG18, RANGE_BPG_OFFSET6, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG19, RANGE_MIN_QP7, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG19, RANGE_MAX_QP7, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG19, RANGE_BPG_OFFSET7, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG19, RANGE_MIN_QP8, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG19, RANGE_MAX_QP8, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG19, RANGE_BPG_OFFSET8, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG20, RANGE_MIN_QP9, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG20, RANGE_MAX_QP9, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG20, RANGE_BPG_OFFSET9, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG20, RANGE_MIN_QP10, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG20, RANGE_MAX_QP10, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG20, RANGE_BPG_OFFSET10, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG21, RANGE_MIN_QP11, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG21, RANGE_MAX_QP11, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG21, RANGE_BPG_OFFSET11, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG21, RANGE_MIN_QP12, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG21, RANGE_MAX_QP12, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG21, RANGE_BPG_OFFSET12, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG22, RANGE_MIN_QP13, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG22, RANGE_MAX_QP13, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG22, RANGE_BPG_OFFSET13, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG22, RANGE_MIN_QP14, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG22, RANGE_MAX_QP14, mask_sh), \
-       DSC_SF(DSCC0_DSCC_PPS_CONFIG22, RANGE_BPG_OFFSET14, mask_sh), \
-       DSC_SF(DSCC0_DSCC_MEM_POWER_CONTROL, DSCC_DEFAULT_MEM_LOW_POWER_STATE, mask_sh), \
-       DSC_SF(DSCC0_DSCC_MEM_POWER_CONTROL, DSCC_MEM_PWR_FORCE, mask_sh), \
-       DSC_SF(DSCC0_DSCC_MEM_POWER_CONTROL, DSCC_MEM_PWR_DIS, mask_sh), \
-       DSC_SF(DSCC0_DSCC_MEM_POWER_CONTROL, DSCC_MEM_PWR_STATE, mask_sh), \
-       DSC_SF(DSCC0_DSCC_MEM_POWER_CONTROL, DSCC_NATIVE_422_MEM_PWR_FORCE, mask_sh), \
-       DSC_SF(DSCC0_DSCC_MEM_POWER_CONTROL, DSCC_NATIVE_422_MEM_PWR_DIS, mask_sh), \
-       DSC_SF(DSCC0_DSCC_MEM_POWER_CONTROL, DSCC_NATIVE_422_MEM_PWR_STATE, mask_sh), \
-       DSC_SF(DSCC0_DSCC_R_Y_SQUARED_ERROR_LOWER, DSCC_R_Y_SQUARED_ERROR_LOWER, mask_sh), \
-       DSC_SF(DSCC0_DSCC_R_Y_SQUARED_ERROR_UPPER, DSCC_R_Y_SQUARED_ERROR_UPPER, mask_sh), \
-       DSC_SF(DSCC0_DSCC_G_CB_SQUARED_ERROR_LOWER, DSCC_G_CB_SQUARED_ERROR_LOWER, mask_sh), \
-       DSC_SF(DSCC0_DSCC_G_CB_SQUARED_ERROR_UPPER, DSCC_G_CB_SQUARED_ERROR_UPPER, mask_sh), \
-       DSC_SF(DSCC0_DSCC_B_CR_SQUARED_ERROR_LOWER, DSCC_B_CR_SQUARED_ERROR_LOWER, mask_sh), \
-       DSC_SF(DSCC0_DSCC_B_CR_SQUARED_ERROR_UPPER, DSCC_B_CR_SQUARED_ERROR_UPPER, mask_sh), \
-       DSC_SF(DSCC0_DSCC_MAX_ABS_ERROR0, DSCC_R_Y_MAX_ABS_ERROR, mask_sh), \
-       DSC_SF(DSCC0_DSCC_MAX_ABS_ERROR0, DSCC_G_CB_MAX_ABS_ERROR, mask_sh), \
-       DSC_SF(DSCC0_DSCC_MAX_ABS_ERROR1, DSCC_B_CR_MAX_ABS_ERROR, mask_sh), \
-       DSC_SF(DSCC0_DSCC_RATE_BUFFER0_MAX_FULLNESS_LEVEL, DSCC_RATE_BUFFER0_MAX_FULLNESS_LEVEL, mask_sh), \
-       DSC_SF(DSCC0_DSCC_RATE_BUFFER1_MAX_FULLNESS_LEVEL, DSCC_RATE_BUFFER1_MAX_FULLNESS_LEVEL, mask_sh), \
-       DSC_SF(DSCC0_DSCC_RATE_BUFFER2_MAX_FULLNESS_LEVEL, DSCC_RATE_BUFFER2_MAX_FULLNESS_LEVEL, mask_sh), \
-       DSC_SF(DSCC0_DSCC_RATE_BUFFER3_MAX_FULLNESS_LEVEL, DSCC_RATE_BUFFER3_MAX_FULLNESS_LEVEL, mask_sh), \
-       DSC_SF(DSCC0_DSCC_RATE_CONTROL_BUFFER0_MAX_FULLNESS_LEVEL, DSCC_RATE_CONTROL_BUFFER0_MAX_FULLNESS_LEVEL, mask_sh), \
-       DSC_SF(DSCC0_DSCC_RATE_CONTROL_BUFFER1_MAX_FULLNESS_LEVEL, DSCC_RATE_CONTROL_BUFFER1_MAX_FULLNESS_LEVEL, mask_sh), \
-       DSC_SF(DSCC0_DSCC_RATE_CONTROL_BUFFER2_MAX_FULLNESS_LEVEL, DSCC_RATE_CONTROL_BUFFER2_MAX_FULLNESS_LEVEL, mask_sh), \
-       DSC_SF(DSCC0_DSCC_RATE_CONTROL_BUFFER3_MAX_FULLNESS_LEVEL, DSCC_RATE_CONTROL_BUFFER3_MAX_FULLNESS_LEVEL, mask_sh), \
-       DSC_SF(DSCCIF0_DSCCIF_CONFIG0, INPUT_INTERFACE_UNDERFLOW_RECOVERY_EN, mask_sh), \
-       DSC_SF(DSCCIF0_DSCCIF_CONFIG0, INPUT_INTERFACE_UNDERFLOW_OCCURRED_INT_EN, mask_sh), \
-       DSC_SF(DSCCIF0_DSCCIF_CONFIG0, INPUT_INTERFACE_UNDERFLOW_OCCURRED_STATUS, mask_sh), \
-       DSC_SF(DSCCIF0_DSCCIF_CONFIG0, INPUT_PIXEL_FORMAT, mask_sh), \
-       DSC2_SF(DSCCIF0, DSCCIF_CONFIG0__BITS_PER_COMPONENT, mask_sh), \
-       DSC_SF(DSCCIF0_DSCCIF_CONFIG0, DOUBLE_BUFFER_REG_UPDATE_PENDING, mask_sh), \
-       DSC_SF(DSCCIF0_DSCCIF_CONFIG1, PIC_WIDTH, mask_sh), \
-       DSC_SF(DSCCIF0_DSCCIF_CONFIG1, PIC_HEIGHT, mask_sh), \
-       DSC_SF(DSCRM0_DSCRM_DSC_FORWARD_CONFIG, DSCRM_DSC_FORWARD_EN, mask_sh), \
-       DSC_SF(DSCRM0_DSCRM_DSC_FORWARD_CONFIG, DSCRM_DSC_OPP_PIPE_SOURCE, mask_sh)
-
-
 struct dcn20_dsc_registers {
        uint32_t DSC_TOP_CONTROL;
        uint32_t DSC_DEBUG_CONTROL;
index 884fa060f37514970c87370a3acda731c0f04f39..598ce872a8d7b6c3ee551197ef150d93920a8ad9 100644 (file)
@@ -1565,6 +1565,7 @@ static void dcn20_update_dchubp_dpp(
        /* Any updates are handled in dc interface, just need
         * to apply existing for plane enable / opp change */
        if (pipe_ctx->update_flags.bits.enable || pipe_ctx->update_flags.bits.opp_changed
+                       || pipe_ctx->update_flags.bits.plane_changed
                        || pipe_ctx->stream->update_flags.bits.gamut_remap
                        || pipe_ctx->stream->update_flags.bits.out_csc) {
                /* dpp/cm gamut remap*/
index e3351ddc566cf6c32d305837d4912243678b2ef2..06d8638db696a8d8892cedacca1178e392fa2d58 100644 (file)
@@ -67,8 +67,7 @@ static void enc314_disable_fifo(struct stream_encoder *enc)
 {
        struct dcn10_stream_encoder *enc1 = DCN10STRENC_FROM_STRENC(enc);
 
-       REG_UPDATE_2(DIG_FIFO_CTRL0, DIG_FIFO_ENABLE, 0,
-                    DIG_FIFO_READ_START_LEVEL, 0);
+       REG_UPDATE(DIG_FIFO_CTRL0, DIG_FIFO_ENABLE, 0);
 }
 
 static void enc314_dp_set_odm_combine(
index 39931d48f3851cebb7c18a9a73f9ba05f6b00ae1..f4d1b83979fe0cd19f7ac3f8c1d58bb576d396b7 100644 (file)
@@ -343,7 +343,6 @@ unsigned int dcn314_calculate_dccg_k1_k2_values(struct pipe_ctx *pipe_ctx, unsig
 {
        struct dc_stream_state *stream = pipe_ctx->stream;
        unsigned int odm_combine_factor = 0;
-       struct dc *dc = pipe_ctx->stream->ctx->dc;
        bool two_pix_per_container = false;
 
        two_pix_per_container = optc2_is_two_pixels_per_containter(&stream->timing);
@@ -364,7 +363,7 @@ unsigned int dcn314_calculate_dccg_k1_k2_values(struct pipe_ctx *pipe_ctx, unsig
                } else {
                        *k1_div = PIXEL_RATE_DIV_BY_1;
                        *k2_div = PIXEL_RATE_DIV_BY_4;
-                       if ((odm_combine_factor == 2) || dc->debug.enable_dp_dig_pixel_rate_div_policy)
+                       if (odm_combine_factor == 2)
                                *k2_div = PIXEL_RATE_DIV_BY_2;
                }
        }
@@ -384,21 +383,10 @@ void dcn314_set_pixels_per_cycle(struct pipe_ctx *pipe_ctx)
                return;
 
        odm_combine_factor = get_odm_config(pipe_ctx, NULL);
-       if (optc2_is_two_pixels_per_containter(&pipe_ctx->stream->timing) || odm_combine_factor > 1
-               || dcn314_is_dp_dig_pixel_rate_div_policy(pipe_ctx))
+       if (optc2_is_two_pixels_per_containter(&pipe_ctx->stream->timing) || odm_combine_factor > 1)
                pix_per_cycle = 2;
 
        if (pipe_ctx->stream_res.stream_enc->funcs->set_input_mode)
                pipe_ctx->stream_res.stream_enc->funcs->set_input_mode(pipe_ctx->stream_res.stream_enc,
                                pix_per_cycle);
 }
-
-bool dcn314_is_dp_dig_pixel_rate_div_policy(struct pipe_ctx *pipe_ctx)
-{
-       struct dc *dc = pipe_ctx->stream->ctx->dc;
-
-       if (dc_is_dp_signal(pipe_ctx->stream->signal) && !is_dp_128b_132b_signal(pipe_ctx) &&
-               dc->debug.enable_dp_dig_pixel_rate_div_policy)
-               return true;
-       return false;
-}
index d014580592aca6aa8286beeb42e0d7a70f5e5211..244280298212c5c97bd9147c4fd51e9650515665 100644 (file)
@@ -41,6 +41,4 @@ unsigned int dcn314_calculate_dccg_k1_k2_values(struct pipe_ctx *pipe_ctx, unsig
 
 void dcn314_set_pixels_per_cycle(struct pipe_ctx *pipe_ctx);
 
-bool dcn314_is_dp_dig_pixel_rate_div_policy(struct pipe_ctx *pipe_ctx);
-
 #endif /* __DC_HWSS_DCN314_H__ */
index fcf67eb3478f07e60e361bdaaee35098c4ad145f..72a563a4c3e811252ec668c76dca32a961866c96 100644 (file)
@@ -146,7 +146,6 @@ static const struct hwseq_private_funcs dcn314_private_funcs = {
        .setup_hpo_hw_control = dcn31_setup_hpo_hw_control,
        .calculate_dccg_k1_k2_values = dcn314_calculate_dccg_k1_k2_values,
        .set_pixels_per_cycle = dcn314_set_pixels_per_cycle,
-       .is_dp_dig_pixel_rate_div_policy = dcn314_is_dp_dig_pixel_rate_div_policy,
 };
 
 void dcn314_hw_sequencer_construct(struct dc *dc)
index 2a2a4a9cc1173f64773988b872ef9b16a3da30bd..44ac1c2aabf5e40df23cf9ca28c27f7478eac2cd 100644 (file)
@@ -87,6 +87,9 @@
 #define DCHUBBUB_DEBUG_CTRL_0__DET_DEPTH__SHIFT                0x10
 #define DCHUBBUB_DEBUG_CTRL_0__DET_DEPTH_MASK          0x01FF0000L
 
+#define DSCC0_DSCC_CONFIG0__ICH_RESET_AT_END_OF_LINE__SHIFT                   0x0
+#define DSCC0_DSCC_CONFIG0__ICH_RESET_AT_END_OF_LINE_MASK                     0x0000000FL
+
 #include "reg_helper.h"
 #include "dce/dmub_abm.h"
 #include "dce/dmub_psr.h"
@@ -579,7 +582,7 @@ static const struct dcn30_mmhubbub_mask mcif_wb30_mask = {
 
 #define dsc_regsDCN314(id)\
 [id] = {\
-       DSC_REG_LIST_DCN314(id)\
+       DSC_REG_LIST_DCN20(id)\
 }
 
 static const struct dcn20_dsc_registers dsc_regs[] = {
@@ -590,11 +593,11 @@ static const struct dcn20_dsc_registers dsc_regs[] = {
 };
 
 static const struct dcn20_dsc_shift dsc_shift = {
-       DSC_REG_LIST_SH_MASK_DCN314(__SHIFT)
+       DSC_REG_LIST_SH_MASK_DCN20(__SHIFT)
 };
 
 static const struct dcn20_dsc_mask dsc_mask = {
-       DSC_REG_LIST_SH_MASK_DCN314(_MASK)
+       DSC_REG_LIST_SH_MASK_DCN20(_MASK)
 };
 
 static const struct dcn30_mpc_registers mpc_regs = {
@@ -844,7 +847,7 @@ static const struct resource_caps res_cap_dcn314 = {
        .num_ddc = 5,
        .num_vmid = 16,
        .num_mpc_3dlut = 2,
-       .num_dsc = 4,
+       .num_dsc = 3,
 };
 
 static const struct dc_plane_cap plane_cap = {
index 6ec1c52535b9b0a8dda30720c517450e38869fa3..2038cbda33f7485648ec60628527b4b72f22437f 100644 (file)
@@ -103,6 +103,11 @@ void hubp32_cursor_set_attributes(
        enum cursor_lines_per_chunk lpc = hubp2_get_lines_per_chunk(
                        attr->width, attr->color_format);
 
+       //Round cursor width up to next multiple of 64
+       uint32_t cursor_width = ((attr->width + 63) / 64) * 64;
+       uint32_t cursor_height = attr->height;
+       uint32_t cursor_size = cursor_width * cursor_height;
+
        hubp->curs_attr = *attr;
 
        REG_UPDATE(CURSOR_SURFACE_ADDRESS_HIGH,
@@ -126,7 +131,24 @@ void hubp32_cursor_set_attributes(
                         /* used to shift the cursor chunk request deadline */
                        CURSOR0_CHUNK_HDL_ADJUST, 3);
 
-       if (attr->width * attr->height * 4 > 16384)
+       switch (attr->color_format) {
+       case CURSOR_MODE_MONO:
+               cursor_size /= 2;
+               break;
+       case CURSOR_MODE_COLOR_1BIT_AND:
+       case CURSOR_MODE_COLOR_PRE_MULTIPLIED_ALPHA:
+       case CURSOR_MODE_COLOR_UN_PRE_MULTIPLIED_ALPHA:
+               cursor_size *= 4;
+               break;
+
+       case CURSOR_MODE_COLOR_64BIT_FP_PRE_MULTIPLIED:
+       case CURSOR_MODE_COLOR_64BIT_FP_UN_PRE_MULTIPLIED:
+       default:
+               cursor_size *= 8;
+               break;
+       }
+
+       if (cursor_size > 16384)
                REG_UPDATE(DCHUBP_MALL_CONFIG, USE_MALL_FOR_CURSOR, true);
        else
                REG_UPDATE(DCHUBP_MALL_CONFIG, USE_MALL_FOR_CURSOR, false);
index 8d9d96c398085b7fa9bfc9a9ece5849cdedd9b08..344fe7535df5b9d46ae32424cc93bb4a515a8705 100644 (file)
@@ -741,7 +741,29 @@ void dcn32_update_mall_sel(struct dc *dc, struct dc_state *context)
                struct hubp *hubp = pipe->plane_res.hubp;
 
                if (pipe->stream && pipe->plane_state && hubp && hubp->funcs->hubp_update_mall_sel) {
-                       if (hubp->curs_attr.width * hubp->curs_attr.height * 4 > 16384)
+                       //Round cursor width up to next multiple of 64
+                       int cursor_width = ((hubp->curs_attr.width + 63) / 64) * 64;
+                       int cursor_height = hubp->curs_attr.height;
+                       int cursor_size = cursor_width * cursor_height;
+
+                       switch (hubp->curs_attr.color_format) {
+                       case CURSOR_MODE_MONO:
+                               cursor_size /= 2;
+                               break;
+                       case CURSOR_MODE_COLOR_1BIT_AND:
+                       case CURSOR_MODE_COLOR_PRE_MULTIPLIED_ALPHA:
+                       case CURSOR_MODE_COLOR_UN_PRE_MULTIPLIED_ALPHA:
+                               cursor_size *= 4;
+                               break;
+
+                       case CURSOR_MODE_COLOR_64BIT_FP_PRE_MULTIPLIED:
+                       case CURSOR_MODE_COLOR_64BIT_FP_UN_PRE_MULTIPLIED:
+                       default:
+                               cursor_size *= 8;
+                               break;
+                       }
+
+                       if (cursor_size > 16384)
                                cache_cursor = true;
 
                        if (pipe->stream->mall_stream_config.type == SUBVP_PHANTOM) {
index 8b887b552f2c764a92816fe8eb4525c7eb7c6760..c3b783cea8a03138e3e7ef343a696e5362c57513 100644 (file)
@@ -871,6 +871,7 @@ static const struct dc_debug_options debug_defaults_drv = {
        .exit_idle_opt_for_cursor_updates = true,
        .enable_single_display_2to1_odm_policy = true,
        .enable_dp_dig_pixel_rate_div_policy = 1,
+       .allow_sw_cursor_fallback = false,
 };
 
 static const struct dc_debug_options debug_defaults_diags = {
@@ -2039,7 +2040,8 @@ static bool dcn32_resource_construct(
        dc->caps.max_downscale_ratio = 600;
        dc->caps.i2c_speed_in_khz = 100;
        dc->caps.i2c_speed_in_khz_hdcp = 100; /*1.4 w/a applied by default*/
-       dc->caps.max_cursor_size = 256;
+       /* TODO: Bring max_cursor_size back to 256 after subvp cursor corruption is fixed*/
+       dc->caps.max_cursor_size = 64;
        dc->caps.min_horizontal_blanking_period = 80;
        dc->caps.dmdata_alloc_size = 2048;
        dc->caps.mall_size_per_mem_channel = 0;
index 1e7e6201c88019769dc4a473c2c532eae8e5154e..cf15d0e5e9b43e1d4d2bba5fde9f29fd29b7fa97 100644 (file)
@@ -30,6 +30,9 @@
 
 #define DCN3_2_DET_SEG_SIZE 64
 #define DCN3_2_MALL_MBLK_SIZE_BYTES 65536 // 64 * 1024
+#define DCN3_2_MBLK_WIDTH 128
+#define DCN3_2_MBLK_HEIGHT_4BPE 128
+#define DCN3_2_MBLK_HEIGHT_8BPE 64
 
 #define TO_DCN32_RES_POOL(pool)\
        container_of(pool, struct dcn32_resource_pool, base)
index ab918fe38f6a57f34dc247937ea2464827124dca..1f195c5b3377d64eb482b4be63c17f05fea10663 100644 (file)
@@ -46,7 +46,6 @@
 uint32_t dcn32_helper_calculate_num_ways_for_subvp(struct dc *dc, struct dc_state *context)
 {
        uint32_t num_ways = 0;
-       uint32_t mall_region_pixels = 0;
        uint32_t bytes_per_pixel = 0;
        uint32_t cache_lines_used = 0;
        uint32_t lines_per_way = 0;
@@ -54,20 +53,64 @@ uint32_t dcn32_helper_calculate_num_ways_for_subvp(struct dc *dc, struct dc_stat
        uint32_t bytes_in_mall = 0;
        uint32_t num_mblks = 0;
        uint32_t cache_lines_per_plane = 0;
-       uint32_t i = 0;
+       uint32_t i = 0, j = 0;
+       uint32_t mblk_width = 0;
+       uint32_t mblk_height = 0;
+       uint32_t full_vp_width_blk_aligned = 0;
+       uint32_t full_vp_height_blk_aligned = 0;
+       uint32_t mall_alloc_width_blk_aligned = 0;
+       uint32_t mall_alloc_height_blk_aligned = 0;
+       uint32_t full_vp_height = 0;
 
        for (i = 0; i < dc->res_pool->pipe_count; i++) {
                struct pipe_ctx *pipe = &context->res_ctx.pipe_ctx[i];
 
                // Find the phantom pipes
-               if (pipe->stream && pipe->plane_state && !pipe->top_pipe &&
+               if (pipe->stream && pipe->plane_state && !pipe->top_pipe && !pipe->prev_odm_pipe &&
                                pipe->stream->mall_stream_config.type == SUBVP_PHANTOM) {
-                       bytes_per_pixel = pipe->plane_state->format >= SURFACE_PIXEL_FORMAT_GRPH_ARGB16161616 ? 8 : 4;
-                       mall_region_pixels = pipe->plane_state->plane_size.surface_pitch * pipe->stream->timing.v_addressable;
+                       struct pipe_ctx *main_pipe = NULL;
+
+                       /* Get full viewport height from main pipe (required for MBLK calculation) */
+                       for (j = 0; j < dc->res_pool->pipe_count; j++) {
+                               main_pipe = &context->res_ctx.pipe_ctx[j];
+                               if (main_pipe->stream == pipe->stream->mall_stream_config.paired_stream) {
+                                       full_vp_height = main_pipe->plane_res.scl_data.viewport.height;
+                                       break;
+                               }
+                       }
 
-                       // For bytes required in MALL, calculate based on number of MBlks required
-                       num_mblks = (mall_region_pixels * bytes_per_pixel +
-                                       DCN3_2_MALL_MBLK_SIZE_BYTES - 1) / DCN3_2_MALL_MBLK_SIZE_BYTES;
+                       bytes_per_pixel = pipe->plane_state->format >= SURFACE_PIXEL_FORMAT_GRPH_ARGB16161616 ? 8 : 4;
+                       mblk_width = DCN3_2_MBLK_WIDTH;
+                       mblk_height = bytes_per_pixel == 4 ? DCN3_2_MBLK_HEIGHT_4BPE : DCN3_2_MBLK_HEIGHT_8BPE;
+
+                       /* full_vp_width_blk_aligned = FLOOR(vp_x_start + full_vp_width + blk_width - 1, blk_width) -
+                        * FLOOR(vp_x_start, blk_width)
+                        */
+                       full_vp_width_blk_aligned = ((pipe->plane_res.scl_data.viewport.x +
+                                       pipe->plane_res.scl_data.viewport.width + mblk_width - 1) / mblk_width * mblk_width) +
+                                       (pipe->plane_res.scl_data.viewport.x / mblk_width * mblk_width);
+
+                       /* full_vp_height_blk_aligned = FLOOR(vp_y_start + full_vp_height + blk_height - 1, blk_height) -
+                        * FLOOR(vp_y_start, blk_height)
+                        */
+                       full_vp_height_blk_aligned = ((pipe->plane_res.scl_data.viewport.y +
+                                       full_vp_height + mblk_height - 1) / mblk_height * mblk_height) +
+                                       (pipe->plane_res.scl_data.viewport.y / mblk_height * mblk_height);
+
+                       /* mall_alloc_width_blk_aligned_l/c = full_vp_width_blk_aligned_l/c */
+                       mall_alloc_width_blk_aligned = full_vp_width_blk_aligned;
+
+                       /* mall_alloc_height_blk_aligned_l/c = CEILING(sub_vp_height_l/c - 1, blk_height_l/c) + blk_height_l/c */
+                       mall_alloc_height_blk_aligned = (pipe->stream->timing.v_addressable - 1 + mblk_height - 1) /
+                                       mblk_height * mblk_height + mblk_height;
+
+                       /* full_mblk_width_ub_l/c = mall_alloc_width_blk_aligned_l/c;
+                        * full_mblk_height_ub_l/c = mall_alloc_height_blk_aligned_l/c;
+                        * num_mblk_l/c = (full_mblk_width_ub_l/c / mblk_width_l/c) * (full_mblk_height_ub_l/c / mblk_height_l/c);
+                        * (Should be divisible, but round up if not)
+                        */
+                       num_mblks = ((mall_alloc_width_blk_aligned + mblk_width - 1) / mblk_width) *
+                                       ((mall_alloc_height_blk_aligned + mblk_height - 1) / mblk_height);
                        bytes_in_mall = num_mblks * DCN3_2_MALL_MBLK_SIZE_BYTES;
                        // cache lines used is total bytes / cache_line size. Add +2 for worst case alignment
                        // (MALL is 64-byte aligned)
index c8b7d6ff38f4fa1887aad87bb8cc6a4bb9bcf0cb..7309eed33a61c2412ce6cc29142e27d0677d26b5 100644 (file)
@@ -872,6 +872,7 @@ static const struct dc_debug_options debug_defaults_drv = {
        .exit_idle_opt_for_cursor_updates = true,
        .enable_single_display_2to1_odm_policy = true,
        .enable_dp_dig_pixel_rate_div_policy = 1,
+       .allow_sw_cursor_fallback = false,
 };
 
 static const struct dc_debug_options debug_defaults_diags = {
@@ -1651,7 +1652,8 @@ static bool dcn321_resource_construct(
        dc->caps.max_downscale_ratio = 600;
        dc->caps.i2c_speed_in_khz = 100;
        dc->caps.i2c_speed_in_khz_hdcp = 100; /*1.4 w/a applied by default*/
-       dc->caps.max_cursor_size = 256;
+       /* TODO: Bring max cursor size back to 256 after subvp cursor corruption is fixed*/
+       dc->caps.max_cursor_size = 64;
        dc->caps.min_horizontal_blanking_period = 80;
        dc->caps.dmdata_alloc_size = 2048;
        dc->caps.mall_size_per_mem_channel = 0;
index 86a3b5bfd699b2c9b5a15ea048be1b2fbe6f9990..cb81ed2fbd539ec08d7993cd2bb5b1ffee7ff81a 100644 (file)
@@ -70,6 +70,8 @@ CFLAGS_$(AMDDALPATH)/dc/dml/dcn30/display_mode_vba_30.o := $(dml_ccflags) $(fram
 CFLAGS_$(AMDDALPATH)/dc/dml/dcn30/display_rq_dlg_calc_30.o := $(dml_ccflags)
 CFLAGS_$(AMDDALPATH)/dc/dml/dcn31/display_mode_vba_31.o := $(dml_ccflags) $(frame_warn_flag)
 CFLAGS_$(AMDDALPATH)/dc/dml/dcn31/display_rq_dlg_calc_31.o := $(dml_ccflags)
+CFLAGS_$(AMDDALPATH)/dc/dml/dcn314/display_mode_vba_314.o := $(dml_ccflags) $(frame_warn_flag)
+CFLAGS_$(AMDDALPATH)/dc/dml/dcn314/display_rq_dlg_calc_314.o := $(dml_ccflags)
 CFLAGS_$(AMDDALPATH)/dc/dml/dcn314/dcn314_fpu.o := $(dml_ccflags)
 CFLAGS_$(AMDDALPATH)/dc/dml/dcn30/dcn30_fpu.o := $(dml_ccflags)
 CFLAGS_$(AMDDALPATH)/dc/dml/dcn32/dcn32_fpu.o := $(dml_ccflags)
@@ -123,6 +125,7 @@ DML += dcn20/display_rq_dlg_calc_20v2.o dcn20/display_mode_vba_20v2.o
 DML += dcn21/display_rq_dlg_calc_21.o dcn21/display_mode_vba_21.o
 DML += dcn30/dcn30_fpu.o dcn30/display_mode_vba_30.o dcn30/display_rq_dlg_calc_30.o
 DML += dcn31/display_mode_vba_31.o dcn31/display_rq_dlg_calc_31.o
+DML += dcn314/display_mode_vba_314.o dcn314/display_rq_dlg_calc_314.o
 DML += dcn32/display_mode_vba_32.o dcn32/display_rq_dlg_calc_32.o dcn32/display_mode_vba_util_32.o
 DML += dcn31/dcn31_fpu.o
 DML += dcn32/dcn32_fpu.o
index 876b321b30ca6517e5a55b497017758a2add3530..1cb858dd6ea0229ed3c68eaf1848fa7d59f6c646 100644 (file)
@@ -6610,8 +6610,7 @@ static double CalculateUrgentLatency(
        return ret;
 }
 
-
-static void UseMinimumDCFCLK(
+static noinline_for_stack void UseMinimumDCFCLK(
                struct display_mode_lib *mode_lib,
                int MaxInterDCNTileRepeaters,
                int MaxPrefetchMode,
index 149a1b17cdf3f34fa26c13fd78ab253da3630dd3..fa7b0291ce4d6e7e1ede80a06e504a137c94f6b0 100644 (file)
@@ -291,6 +291,7 @@ static struct _vcs_dpi_soc_bounding_box_st dcn3_15_soc = {
        .do_urgent_latency_adjustment = false,
        .urgent_latency_adjustment_fabric_clock_component_us = 0,
        .urgent_latency_adjustment_fabric_clock_reference_mhz = 0,
+       .num_chans = 4,
 };
 
 struct _vcs_dpi_ip_params_st dcn3_16_ip = {
@@ -680,7 +681,11 @@ void dcn315_update_bw_bounding_box(struct dc *dc, struct clk_bw_params *bw_param
 
        dcn3_15_ip.max_num_otg = dc->res_pool->res_cap->num_timing_generator;
        dcn3_15_ip.max_num_dpp = dc->res_pool->pipe_count;
-       dcn3_15_soc.num_chans = bw_params->num_channels;
+
+       if (bw_params->num_channels > 0)
+               dcn3_15_soc.num_chans = bw_params->num_channels;
+       if (bw_params->dram_channel_width_bytes > 0)
+               dcn3_15_soc.dram_channel_width_bytes = bw_params->dram_channel_width_bytes;
 
        ASSERT(clk_table->num_entries);
 
index d63b4209b14c080538fb2905129e18354f163dba..8ca66f1644dc8ab00dfbf29705b339e67d6ea138 100644 (file)
@@ -251,33 +251,13 @@ static void CalculateRowBandwidth(
 
 static void CalculateFlipSchedule(
                struct display_mode_lib *mode_lib,
+               unsigned int k,
                double HostVMInefficiencyFactor,
                double UrgentExtraLatency,
                double UrgentLatency,
-               unsigned int GPUVMMaxPageTableLevels,
-               bool HostVMEnable,
-               unsigned int HostVMMaxNonCachedPageTableLevels,
-               bool GPUVMEnable,
-               double HostVMMinPageSize,
                double PDEAndMetaPTEBytesPerFrame,
                double MetaRowBytes,
-               double DPTEBytesPerRow,
-               double BandwidthAvailableForImmediateFlip,
-               unsigned int TotImmediateFlipBytes,
-               enum source_format_class SourcePixelFormat,
-               double LineTime,
-               double VRatio,
-               double VRatioChroma,
-               double Tno_bw,
-               bool DCCEnable,
-               unsigned int dpte_row_height,
-               unsigned int meta_row_height,
-               unsigned int dpte_row_height_chroma,
-               unsigned int meta_row_height_chroma,
-               double *DestinationLinesToRequestVMInImmediateFlip,
-               double *DestinationLinesToRequestRowInImmediateFlip,
-               double *final_flip_bw,
-               bool *ImmediateFlipSupportedForPipe);
+               double DPTEBytesPerRow);
 static double CalculateWriteBackDelay(
                enum source_format_class WritebackPixelFormat,
                double WritebackHRatio,
@@ -311,64 +291,28 @@ static void CalculateVupdateAndDynamicMetadataParameters(
 static void CalculateWatermarksAndDRAMSpeedChangeSupport(
                struct display_mode_lib *mode_lib,
                unsigned int PrefetchMode,
-               unsigned int NumberOfActivePlanes,
-               unsigned int MaxLineBufferLines,
-               unsigned int LineBufferSize,
-               unsigned int WritebackInterfaceBufferSize,
                double DCFCLK,
                double ReturnBW,
-               bool SynchronizedVBlank,
-               unsigned int dpte_group_bytes[],
-               unsigned int MetaChunkSize,
                double UrgentLatency,
                double ExtraLatency,
-               double WritebackLatency,
-               double WritebackChunkSize,
                double SOCCLK,
-               double DRAMClockChangeLatency,
-               double SRExitTime,
-               double SREnterPlusExitTime,
-               double SRExitZ8Time,
-               double SREnterPlusExitZ8Time,
                double DCFCLKDeepSleep,
                unsigned int DETBufferSizeY[],
                unsigned int DETBufferSizeC[],
                unsigned int SwathHeightY[],
                unsigned int SwathHeightC[],
-               unsigned int LBBitPerPixel[],
                double SwathWidthY[],
                double SwathWidthC[],
-               double HRatio[],
-               double HRatioChroma[],
-               unsigned int vtaps[],
-               unsigned int VTAPsChroma[],
-               double VRatio[],
-               double VRatioChroma[],
-               unsigned int HTotal[],
-               double PixelClock[],
-               unsigned int BlendingAndTiming[],
                unsigned int DPPPerPlane[],
                double BytePerPixelDETY[],
                double BytePerPixelDETC[],
-               double DSTXAfterScaler[],
-               double DSTYAfterScaler[],
-               bool WritebackEnable[],
-               enum source_format_class WritebackPixelFormat[],
-               double WritebackDestinationWidth[],
-               double WritebackDestinationHeight[],
-               double WritebackSourceHeight[],
                bool UnboundedRequestEnabled,
                int unsigned CompressedBufferSizeInkByte,
                enum clock_change_support *DRAMClockChangeSupport,
-               double *UrgentWatermark,
-               double *WritebackUrgentWatermark,
-               double *DRAMClockChangeWatermark,
-               double *WritebackDRAMClockChangeWatermark,
                double *StutterExitWatermark,
                double *StutterEnterPlusExitWatermark,
                double *Z8StutterExitWatermark,
-               double *Z8StutterEnterPlusExitWatermark,
-               double *MinActiveDRAMClockChangeLatencySupported);
+               double *Z8StutterEnterPlusExitWatermark);
 
 static void CalculateDCFCLKDeepSleep(
                struct display_mode_lib *mode_lib,
@@ -2904,33 +2848,13 @@ static void DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerforman
                        for (k = 0; k < v->NumberOfActivePlanes; ++k) {
                                CalculateFlipSchedule(
                                                mode_lib,
+                                               k,
                                                HostVMInefficiencyFactor,
                                                v->UrgentExtraLatency,
                                                v->UrgentLatency,
-                                               v->GPUVMMaxPageTableLevels,
-                                               v->HostVMEnable,
-                                               v->HostVMMaxNonCachedPageTableLevels,
-                                               v->GPUVMEnable,
-                                               v->HostVMMinPageSize,
                                                v->PDEAndMetaPTEBytesFrame[k],
                                                v->MetaRowByte[k],
-                                               v->PixelPTEBytesPerRow[k],
-                                               v->BandwidthAvailableForImmediateFlip,
-                                               v->TotImmediateFlipBytes,
-                                               v->SourcePixelFormat[k],
-                                               v->HTotal[k] / v->PixelClock[k],
-                                               v->VRatio[k],
-                                               v->VRatioChroma[k],
-                                               v->Tno_bw[k],
-                                               v->DCCEnable[k],
-                                               v->dpte_row_height[k],
-                                               v->meta_row_height[k],
-                                               v->dpte_row_height_chroma[k],
-                                               v->meta_row_height_chroma[k],
-                                               &v->DestinationLinesToRequestVMInImmediateFlip[k],
-                                               &v->DestinationLinesToRequestRowInImmediateFlip[k],
-                                               &v->final_flip_bw[k],
-                                               &v->ImmediateFlipSupportedForPipe[k]);
+                                               v->PixelPTEBytesPerRow[k]);
                        }
 
                        v->total_dcn_read_bw_with_flip = 0.0;
@@ -3017,64 +2941,28 @@ static void DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerforman
                CalculateWatermarksAndDRAMSpeedChangeSupport(
                                mode_lib,
                                PrefetchMode,
-                               v->NumberOfActivePlanes,
-                               v->MaxLineBufferLines,
-                               v->LineBufferSize,
-                               v->WritebackInterfaceBufferSize,
                                v->DCFCLK,
                                v->ReturnBW,
-                               v->SynchronizedVBlank,
-                               v->dpte_group_bytes,
-                               v->MetaChunkSize,
                                v->UrgentLatency,
                                v->UrgentExtraLatency,
-                               v->WritebackLatency,
-                               v->WritebackChunkSize,
                                v->SOCCLK,
-                               v->DRAMClockChangeLatency,
-                               v->SRExitTime,
-                               v->SREnterPlusExitTime,
-                               v->SRExitZ8Time,
-                               v->SREnterPlusExitZ8Time,
                                v->DCFCLKDeepSleep,
                                v->DETBufferSizeY,
                                v->DETBufferSizeC,
                                v->SwathHeightY,
                                v->SwathHeightC,
-                               v->LBBitPerPixel,
                                v->SwathWidthY,
                                v->SwathWidthC,
-                               v->HRatio,
-                               v->HRatioChroma,
-                               v->vtaps,
-                               v->VTAPsChroma,
-                               v->VRatio,
-                               v->VRatioChroma,
-                               v->HTotal,
-                               v->PixelClock,
-                               v->BlendingAndTiming,
                                v->DPPPerPlane,
                                v->BytePerPixelDETY,
                                v->BytePerPixelDETC,
-                               v->DSTXAfterScaler,
-                               v->DSTYAfterScaler,
-                               v->WritebackEnable,
-                               v->WritebackPixelFormat,
-                               v->WritebackDestinationWidth,
-                               v->WritebackDestinationHeight,
-                               v->WritebackSourceHeight,
                                v->UnboundedRequestEnabled,
                                v->CompressedBufferSizeInkByte,
                                &DRAMClockChangeSupport,
-                               &v->UrgentWatermark,
-                               &v->WritebackUrgentWatermark,
-                               &v->DRAMClockChangeWatermark,
-                               &v->WritebackDRAMClockChangeWatermark,
                                &v->StutterExitWatermark,
                                &v->StutterEnterPlusExitWatermark,
                                &v->Z8StutterExitWatermark,
-                               &v->Z8StutterEnterPlusExitWatermark,
-                               &v->MinActiveDRAMClockChangeLatencySupported);
+                               &v->Z8StutterEnterPlusExitWatermark);
 
                for (k = 0; k < v->NumberOfActivePlanes; ++k) {
                        if (v->WritebackEnable[k] == true) {
@@ -3598,61 +3486,43 @@ static void CalculateRowBandwidth(
 
 static void CalculateFlipSchedule(
                struct display_mode_lib *mode_lib,
+               unsigned int k,
                double HostVMInefficiencyFactor,
                double UrgentExtraLatency,
                double UrgentLatency,
-               unsigned int GPUVMMaxPageTableLevels,
-               bool HostVMEnable,
-               unsigned int HostVMMaxNonCachedPageTableLevels,
-               bool GPUVMEnable,
-               double HostVMMinPageSize,
                double PDEAndMetaPTEBytesPerFrame,
                double MetaRowBytes,
-               double DPTEBytesPerRow,
-               double BandwidthAvailableForImmediateFlip,
-               unsigned int TotImmediateFlipBytes,
-               enum source_format_class SourcePixelFormat,
-               double LineTime,
-               double VRatio,
-               double VRatioChroma,
-               double Tno_bw,
-               bool DCCEnable,
-               unsigned int dpte_row_height,
-               unsigned int meta_row_height,
-               unsigned int dpte_row_height_chroma,
-               unsigned int meta_row_height_chroma,
-               double *DestinationLinesToRequestVMInImmediateFlip,
-               double *DestinationLinesToRequestRowInImmediateFlip,
-               double *final_flip_bw,
-               bool *ImmediateFlipSupportedForPipe)
+               double DPTEBytesPerRow)
 {
+       struct vba_vars_st *v = &mode_lib->vba;
        double min_row_time = 0.0;
        unsigned int HostVMDynamicLevelsTrips;
        double TimeForFetchingMetaPTEImmediateFlip;
        double TimeForFetchingRowInVBlankImmediateFlip;
        double ImmediateFlipBW;
+       double LineTime = v->HTotal[k] / v->PixelClock[k];
 
-       if (GPUVMEnable == true && HostVMEnable == true) {
-               HostVMDynamicLevelsTrips = HostVMMaxNonCachedPageTableLevels;
+       if (v->GPUVMEnable == true && v->HostVMEnable == true) {
+               HostVMDynamicLevelsTrips = v->HostVMMaxNonCachedPageTableLevels;
        } else {
                HostVMDynamicLevelsTrips = 0;
        }
 
-       if (GPUVMEnable == true || DCCEnable == true) {
-               ImmediateFlipBW = (PDEAndMetaPTEBytesPerFrame + MetaRowBytes + DPTEBytesPerRow) * BandwidthAvailableForImmediateFlip / TotImmediateFlipBytes;
+       if (v->GPUVMEnable == true || v->DCCEnable[k] == true) {
+               ImmediateFlipBW = (PDEAndMetaPTEBytesPerFrame + MetaRowBytes + DPTEBytesPerRow) * v->BandwidthAvailableForImmediateFlip / v->TotImmediateFlipBytes;
        }
 
-       if (GPUVMEnable == true) {
+       if (v->GPUVMEnable == true) {
                TimeForFetchingMetaPTEImmediateFlip = dml_max3(
-                               Tno_bw + PDEAndMetaPTEBytesPerFrame * HostVMInefficiencyFactor / ImmediateFlipBW,
-                               UrgentExtraLatency + UrgentLatency * (GPUVMMaxPageTableLevels * (HostVMDynamicLevelsTrips + 1) - 1),
+                               v->Tno_bw[k] + PDEAndMetaPTEBytesPerFrame * HostVMInefficiencyFactor / ImmediateFlipBW,
+                               UrgentExtraLatency + UrgentLatency * (v->GPUVMMaxPageTableLevels * (HostVMDynamicLevelsTrips + 1) - 1),
                                LineTime / 4.0);
        } else {
                TimeForFetchingMetaPTEImmediateFlip = 0;
        }
 
-       *DestinationLinesToRequestVMInImmediateFlip = dml_ceil(4.0 * (TimeForFetchingMetaPTEImmediateFlip / LineTime), 1) / 4.0;
-       if ((GPUVMEnable == true || DCCEnable == true)) {
+       v->DestinationLinesToRequestVMInImmediateFlip[k] = dml_ceil(4.0 * (TimeForFetchingMetaPTEImmediateFlip / LineTime), 1) / 4.0;
+       if ((v->GPUVMEnable == true || v->DCCEnable[k] == true)) {
                TimeForFetchingRowInVBlankImmediateFlip = dml_max3(
                                (MetaRowBytes + DPTEBytesPerRow * HostVMInefficiencyFactor) / ImmediateFlipBW,
                                UrgentLatency * (HostVMDynamicLevelsTrips + 1),
@@ -3661,54 +3531,54 @@ static void CalculateFlipSchedule(
                TimeForFetchingRowInVBlankImmediateFlip = 0;
        }
 
-       *DestinationLinesToRequestRowInImmediateFlip = dml_ceil(4.0 * (TimeForFetchingRowInVBlankImmediateFlip / LineTime), 1) / 4.0;
+       v->DestinationLinesToRequestRowInImmediateFlip[k] = dml_ceil(4.0 * (TimeForFetchingRowInVBlankImmediateFlip / LineTime), 1) / 4.0;
 
-       if (GPUVMEnable == true) {
-               *final_flip_bw = dml_max(
-                               PDEAndMetaPTEBytesPerFrame * HostVMInefficiencyFactor / (*DestinationLinesToRequestVMInImmediateFlip * LineTime),
-                               (MetaRowBytes + DPTEBytesPerRow * HostVMInefficiencyFactor) / (*DestinationLinesToRequestRowInImmediateFlip * LineTime));
-       } else if ((GPUVMEnable == true || DCCEnable == true)) {
-               *final_flip_bw = (MetaRowBytes + DPTEBytesPerRow * HostVMInefficiencyFactor) / (*DestinationLinesToRequestRowInImmediateFlip * LineTime);
+       if (v->GPUVMEnable == true) {
+               v->final_flip_bw[k] = dml_max(
+                               PDEAndMetaPTEBytesPerFrame * HostVMInefficiencyFactor / (v->DestinationLinesToRequestVMInImmediateFlip[k] * LineTime),
+                               (MetaRowBytes + DPTEBytesPerRow * HostVMInefficiencyFactor) / (v->DestinationLinesToRequestRowInImmediateFlip[k] * LineTime));
+       } else if ((v->GPUVMEnable == true || v->DCCEnable[k] == true)) {
+               v->final_flip_bw[k] = (MetaRowBytes + DPTEBytesPerRow * HostVMInefficiencyFactor) / (v->DestinationLinesToRequestRowInImmediateFlip[k] * LineTime);
        } else {
-               *final_flip_bw = 0;
+               v->final_flip_bw[k] = 0;
        }
 
-       if (SourcePixelFormat == dm_420_8 || SourcePixelFormat == dm_420_10 || SourcePixelFormat == dm_rgbe_alpha) {
-               if (GPUVMEnable == true && DCCEnable != true) {
-                       min_row_time = dml_min(dpte_row_height * LineTime / VRatio, dpte_row_height_chroma * LineTime / VRatioChroma);
-               } else if (GPUVMEnable != true && DCCEnable == true) {
-                       min_row_time = dml_min(meta_row_height * LineTime / VRatio, meta_row_height_chroma * LineTime / VRatioChroma);
+       if (v->SourcePixelFormat[k] == dm_420_8 || v->SourcePixelFormat[k] == dm_420_10 || v->SourcePixelFormat[k] == dm_rgbe_alpha) {
+               if (v->GPUVMEnable == true && v->DCCEnable[k] != true) {
+                       min_row_time = dml_min(v->dpte_row_height[k] * LineTime / v->VRatio[k], v->dpte_row_height_chroma[k] * LineTime / v->VRatioChroma[k]);
+               } else if (v->GPUVMEnable != true && v->DCCEnable[k] == true) {
+                       min_row_time = dml_min(v->meta_row_height[k] * LineTime / v->VRatio[k], v->meta_row_height_chroma[k] * LineTime / v->VRatioChroma[k]);
                } else {
                        min_row_time = dml_min4(
-                                       dpte_row_height * LineTime / VRatio,
-                                       meta_row_height * LineTime / VRatio,
-                                       dpte_row_height_chroma * LineTime / VRatioChroma,
-                                       meta_row_height_chroma * LineTime / VRatioChroma);
+                                       v->dpte_row_height[k] * LineTime / v->VRatio[k],
+                                       v->meta_row_height[k] * LineTime / v->VRatio[k],
+                                       v->dpte_row_height_chroma[k] * LineTime / v->VRatioChroma[k],
+                                       v->meta_row_height_chroma[k] * LineTime / v->VRatioChroma[k]);
                }
        } else {
-               if (GPUVMEnable == true && DCCEnable != true) {
-                       min_row_time = dpte_row_height * LineTime / VRatio;
-               } else if (GPUVMEnable != true && DCCEnable == true) {
-                       min_row_time = meta_row_height * LineTime / VRatio;
+               if (v->GPUVMEnable == true && v->DCCEnable[k] != true) {
+                       min_row_time = v->dpte_row_height[k] * LineTime / v->VRatio[k];
+               } else if (v->GPUVMEnable != true && v->DCCEnable[k] == true) {
+                       min_row_time = v->meta_row_height[k] * LineTime / v->VRatio[k];
                } else {
-                       min_row_time = dml_min(dpte_row_height * LineTime / VRatio, meta_row_height * LineTime / VRatio);
+                       min_row_time = dml_min(v->dpte_row_height[k] * LineTime / v->VRatio[k], v->meta_row_height[k] * LineTime / v->VRatio[k]);
                }
        }
 
-       if (*DestinationLinesToRequestVMInImmediateFlip >= 32 || *DestinationLinesToRequestRowInImmediateFlip >= 16
+       if (v->DestinationLinesToRequestVMInImmediateFlip[k] >= 32 || v->DestinationLinesToRequestRowInImmediateFlip[k] >= 16
                        || TimeForFetchingMetaPTEImmediateFlip + 2 * TimeForFetchingRowInVBlankImmediateFlip > min_row_time) {
-               *ImmediateFlipSupportedForPipe = false;
+               v->ImmediateFlipSupportedForPipe[k] = false;
        } else {
-               *ImmediateFlipSupportedForPipe = true;
+               v->ImmediateFlipSupportedForPipe[k] = true;
        }
 
 #ifdef __DML_VBA_DEBUG__
-       dml_print("DML::%s: DestinationLinesToRequestVMInImmediateFlip = %f\n", __func__, *DestinationLinesToRequestVMInImmediateFlip);
-       dml_print("DML::%s: DestinationLinesToRequestRowInImmediateFlip = %f\n", __func__, *DestinationLinesToRequestRowInImmediateFlip);
+       dml_print("DML::%s: DestinationLinesToRequestVMInImmediateFlip = %f\n", __func__, v->DestinationLinesToRequestVMInImmediateFlip[k]);
+       dml_print("DML::%s: DestinationLinesToRequestRowInImmediateFlip = %f\n", __func__, v->DestinationLinesToRequestRowInImmediateFlip[k]);
        dml_print("DML::%s: TimeForFetchingMetaPTEImmediateFlip = %f\n", __func__, TimeForFetchingMetaPTEImmediateFlip);
        dml_print("DML::%s: TimeForFetchingRowInVBlankImmediateFlip = %f\n", __func__, TimeForFetchingRowInVBlankImmediateFlip);
        dml_print("DML::%s: min_row_time = %f\n", __func__, min_row_time);
-       dml_print("DML::%s: ImmediateFlipSupportedForPipe = %d\n", __func__, *ImmediateFlipSupportedForPipe);
+       dml_print("DML::%s: ImmediateFlipSupportedForPipe = %d\n", __func__, v->ImmediateFlipSupportedForPipe[k]);
 #endif
 
 }
@@ -5300,33 +5170,13 @@ void dml31_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l
                                        for (k = 0; k < v->NumberOfActivePlanes; k++) {
                                                CalculateFlipSchedule(
                                                                mode_lib,
+                                                               k,
                                                                HostVMInefficiencyFactor,
                                                                v->ExtraLatency,
                                                                v->UrgLatency[i],
-                                                               v->GPUVMMaxPageTableLevels,
-                                                               v->HostVMEnable,
-                                                               v->HostVMMaxNonCachedPageTableLevels,
-                                                               v->GPUVMEnable,
-                                                               v->HostVMMinPageSize,
                                                                v->PDEAndMetaPTEBytesPerFrame[i][j][k],
                                                                v->MetaRowBytes[i][j][k],
-                                                               v->DPTEBytesPerRow[i][j][k],
-                                                               v->BandwidthAvailableForImmediateFlip,
-                                                               v->TotImmediateFlipBytes,
-                                                               v->SourcePixelFormat[k],
-                                                               v->HTotal[k] / v->PixelClock[k],
-                                                               v->VRatio[k],
-                                                               v->VRatioChroma[k],
-                                                               v->Tno_bw[k],
-                                                               v->DCCEnable[k],
-                                                               v->dpte_row_height[k],
-                                                               v->meta_row_height[k],
-                                                               v->dpte_row_height_chroma[k],
-                                                               v->meta_row_height_chroma[k],
-                                                               &v->DestinationLinesToRequestVMInImmediateFlip[k],
-                                                               &v->DestinationLinesToRequestRowInImmediateFlip[k],
-                                                               &v->final_flip_bw[k],
-                                                               &v->ImmediateFlipSupportedForPipe[k]);
+                                                               v->DPTEBytesPerRow[i][j][k]);
                                        }
                                        v->total_dcn_read_bw_with_flip = 0.0;
                                        for (k = 0; k < v->NumberOfActivePlanes; k++) {
@@ -5384,64 +5234,28 @@ void dml31_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l
                        CalculateWatermarksAndDRAMSpeedChangeSupport(
                                        mode_lib,
                                        v->PrefetchModePerState[i][j],
-                                       v->NumberOfActivePlanes,
-                                       v->MaxLineBufferLines,
-                                       v->LineBufferSize,
-                                       v->WritebackInterfaceBufferSize,
                                        v->DCFCLKState[i][j],
                                        v->ReturnBWPerState[i][j],
-                                       v->SynchronizedVBlank,
-                                       v->dpte_group_bytes,
-                                       v->MetaChunkSize,
                                        v->UrgLatency[i],
                                        v->ExtraLatency,
-                                       v->WritebackLatency,
-                                       v->WritebackChunkSize,
                                        v->SOCCLKPerState[i],
-                                       v->DRAMClockChangeLatency,
-                                       v->SRExitTime,
-                                       v->SREnterPlusExitTime,
-                                       v->SRExitZ8Time,
-                                       v->SREnterPlusExitZ8Time,
                                        v->ProjectedDCFCLKDeepSleep[i][j],
                                        v->DETBufferSizeYThisState,
                                        v->DETBufferSizeCThisState,
                                        v->SwathHeightYThisState,
                                        v->SwathHeightCThisState,
-                                       v->LBBitPerPixel,
                                        v->SwathWidthYThisState,
                                        v->SwathWidthCThisState,
-                                       v->HRatio,
-                                       v->HRatioChroma,
-                                       v->vtaps,
-                                       v->VTAPsChroma,
-                                       v->VRatio,
-                                       v->VRatioChroma,
-                                       v->HTotal,
-                                       v->PixelClock,
-                                       v->BlendingAndTiming,
                                        v->NoOfDPPThisState,
                                        v->BytePerPixelInDETY,
                                        v->BytePerPixelInDETC,
-                                       v->DSTXAfterScaler,
-                                       v->DSTYAfterScaler,
-                                       v->WritebackEnable,
-                                       v->WritebackPixelFormat,
-                                       v->WritebackDestinationWidth,
-                                       v->WritebackDestinationHeight,
-                                       v->WritebackSourceHeight,
                                        UnboundedRequestEnabledThisState,
                                        CompressedBufferSizeInkByteThisState,
                                        &v->DRAMClockChangeSupport[i][j],
-                                       &v->UrgentWatermark,
-                                       &v->WritebackUrgentWatermark,
-                                       &v->DRAMClockChangeWatermark,
-                                       &v->WritebackDRAMClockChangeWatermark,
-                                       &dummy,
                                        &dummy,
                                        &dummy,
                                        &dummy,
-                                       &v->MinActiveDRAMClockChangeLatencySupported);
+                                       &dummy);
                }
        }
 
@@ -5566,64 +5380,28 @@ void dml31_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l
 static void CalculateWatermarksAndDRAMSpeedChangeSupport(
                struct display_mode_lib *mode_lib,
                unsigned int PrefetchMode,
-               unsigned int NumberOfActivePlanes,
-               unsigned int MaxLineBufferLines,
-               unsigned int LineBufferSize,
-               unsigned int WritebackInterfaceBufferSize,
                double DCFCLK,
                double ReturnBW,
-               bool SynchronizedVBlank,
-               unsigned int dpte_group_bytes[],
-               unsigned int MetaChunkSize,
                double UrgentLatency,
                double ExtraLatency,
-               double WritebackLatency,
-               double WritebackChunkSize,
                double SOCCLK,
-               double DRAMClockChangeLatency,
-               double SRExitTime,
-               double SREnterPlusExitTime,
-               double SRExitZ8Time,
-               double SREnterPlusExitZ8Time,
                double DCFCLKDeepSleep,
                unsigned int DETBufferSizeY[],
                unsigned int DETBufferSizeC[],
                unsigned int SwathHeightY[],
                unsigned int SwathHeightC[],
-               unsigned int LBBitPerPixel[],
                double SwathWidthY[],
                double SwathWidthC[],
-               double HRatio[],
-               double HRatioChroma[],
-               unsigned int vtaps[],
-               unsigned int VTAPsChroma[],
-               double VRatio[],
-               double VRatioChroma[],
-               unsigned int HTotal[],
-               double PixelClock[],
-               unsigned int BlendingAndTiming[],
                unsigned int DPPPerPlane[],
                double BytePerPixelDETY[],
                double BytePerPixelDETC[],
-               double DSTXAfterScaler[],
-               double DSTYAfterScaler[],
-               bool WritebackEnable[],
-               enum source_format_class WritebackPixelFormat[],
-               double WritebackDestinationWidth[],
-               double WritebackDestinationHeight[],
-               double WritebackSourceHeight[],
                bool UnboundedRequestEnabled,
                int unsigned CompressedBufferSizeInkByte,
                enum clock_change_support *DRAMClockChangeSupport,
-               double *UrgentWatermark,
-               double *WritebackUrgentWatermark,
-               double *DRAMClockChangeWatermark,
-               double *WritebackDRAMClockChangeWatermark,
                double *StutterExitWatermark,
                double *StutterEnterPlusExitWatermark,
                double *Z8StutterExitWatermark,
-               double *Z8StutterEnterPlusExitWatermark,
-               double *MinActiveDRAMClockChangeLatencySupported)
+               double *Z8StutterEnterPlusExitWatermark)
 {
        struct vba_vars_st *v = &mode_lib->vba;
        double EffectiveLBLatencyHidingY;
@@ -5643,103 +5421,103 @@ static void CalculateWatermarksAndDRAMSpeedChangeSupport(
        double TotalPixelBW = 0.0;
        int k, j;
 
-       *UrgentWatermark = UrgentLatency + ExtraLatency;
+       v->UrgentWatermark = UrgentLatency + ExtraLatency;
 
 #ifdef __DML_VBA_DEBUG__
        dml_print("DML::%s: UrgentLatency = %f\n", __func__, UrgentLatency);
        dml_print("DML::%s: ExtraLatency = %f\n", __func__, ExtraLatency);
-       dml_print("DML::%s: UrgentWatermark = %f\n", __func__, *UrgentWatermark);
+       dml_print("DML::%s: UrgentWatermark = %f\n", __func__, v->UrgentWatermark);
 #endif
 
-       *DRAMClockChangeWatermark = DRAMClockChangeLatency + *UrgentWatermark;
+       v->DRAMClockChangeWatermark = v->DRAMClockChangeLatency + v->UrgentWatermark;
 
 #ifdef __DML_VBA_DEBUG__
-       dml_print("DML::%s: DRAMClockChangeLatency = %f\n", __func__, DRAMClockChangeLatency);
-       dml_print("DML::%s: DRAMClockChangeWatermark = %f\n", __func__, *DRAMClockChangeWatermark);
+       dml_print("DML::%s: v->DRAMClockChangeLatency = %f\n", __func__, v->DRAMClockChangeLatency);
+       dml_print("DML::%s: DRAMClockChangeWatermark = %f\n", __func__, v->DRAMClockChangeWatermark);
 #endif
 
        v->TotalActiveWriteback = 0;
-       for (k = 0; k < NumberOfActivePlanes; ++k) {
-               if (WritebackEnable[k] == true) {
+       for (k = 0; k < v->NumberOfActivePlanes; ++k) {
+               if (v->WritebackEnable[k] == true) {
                        v->TotalActiveWriteback = v->TotalActiveWriteback + 1;
                }
        }
 
        if (v->TotalActiveWriteback <= 1) {
-               *WritebackUrgentWatermark = WritebackLatency;
+               v->WritebackUrgentWatermark = v->WritebackLatency;
        } else {
-               *WritebackUrgentWatermark = WritebackLatency + WritebackChunkSize * 1024.0 / 32.0 / SOCCLK;
+               v->WritebackUrgentWatermark = v->WritebackLatency + v->WritebackChunkSize * 1024.0 / 32.0 / SOCCLK;
        }
 
        if (v->TotalActiveWriteback <= 1) {
-               *WritebackDRAMClockChangeWatermark = DRAMClockChangeLatency + WritebackLatency;
+               v->WritebackDRAMClockChangeWatermark = v->DRAMClockChangeLatency + v->WritebackLatency;
        } else {
-               *WritebackDRAMClockChangeWatermark = DRAMClockChangeLatency + WritebackLatency + WritebackChunkSize * 1024.0 / 32.0 / SOCCLK;
+               v->WritebackDRAMClockChangeWatermark = v->DRAMClockChangeLatency + v->WritebackLatency + v->WritebackChunkSize * 1024.0 / 32.0 / SOCCLK;
        }
 
-       for (k = 0; k < NumberOfActivePlanes; ++k) {
+       for (k = 0; k < v->NumberOfActivePlanes; ++k) {
                TotalPixelBW = TotalPixelBW
-                               + DPPPerPlane[k] * (SwathWidthY[k] * BytePerPixelDETY[k] * VRatio[k] + SwathWidthC[k] * BytePerPixelDETC[k] * VRatioChroma[k])
-                                               / (HTotal[k] / PixelClock[k]);
+                               + DPPPerPlane[k] * (SwathWidthY[k] * BytePerPixelDETY[k] * v->VRatio[k] + SwathWidthC[k] * BytePerPixelDETC[k] * v->VRatioChroma[k])
+                                               / (v->HTotal[k] / v->PixelClock[k]);
        }
 
-       for (k = 0; k < NumberOfActivePlanes; ++k) {
+       for (k = 0; k < v->NumberOfActivePlanes; ++k) {
                double EffectiveDETBufferSizeY = DETBufferSizeY[k];
 
                v->LBLatencyHidingSourceLinesY = dml_min(
-                               (double) MaxLineBufferLines,
-                               dml_floor(LineBufferSize / LBBitPerPixel[k] / (SwathWidthY[k] / dml_max(HRatio[k], 1.0)), 1)) - (vtaps[k] - 1);
+                               (double) v->MaxLineBufferLines,
+                               dml_floor(v->LineBufferSize / v->LBBitPerPixel[k] / (SwathWidthY[k] / dml_max(v->HRatio[k], 1.0)), 1)) - (v->vtaps[k] - 1);
 
                v->LBLatencyHidingSourceLinesC = dml_min(
-                               (double) MaxLineBufferLines,
-                               dml_floor(LineBufferSize / LBBitPerPixel[k] / (SwathWidthC[k] / dml_max(HRatioChroma[k], 1.0)), 1)) - (VTAPsChroma[k] - 1);
+                               (double) v->MaxLineBufferLines,
+                               dml_floor(v->LineBufferSize / v->LBBitPerPixel[k] / (SwathWidthC[k] / dml_max(v->HRatioChroma[k], 1.0)), 1)) - (v->VTAPsChroma[k] - 1);
 
-               EffectiveLBLatencyHidingY = v->LBLatencyHidingSourceLinesY / VRatio[k] * (HTotal[k] / PixelClock[k]);
+               EffectiveLBLatencyHidingY = v->LBLatencyHidingSourceLinesY / v->VRatio[k] * (v->HTotal[k] / v->PixelClock[k]);
 
-               EffectiveLBLatencyHidingC = v->LBLatencyHidingSourceLinesC / VRatioChroma[k] * (HTotal[k] / PixelClock[k]);
+               EffectiveLBLatencyHidingC = v->LBLatencyHidingSourceLinesC / v->VRatioChroma[k] * (v->HTotal[k] / v->PixelClock[k]);
 
                if (UnboundedRequestEnabled) {
                        EffectiveDETBufferSizeY = EffectiveDETBufferSizeY
-                                       + CompressedBufferSizeInkByte * 1024 * SwathWidthY[k] * BytePerPixelDETY[k] * VRatio[k] / (HTotal[k] / PixelClock[k]) / TotalPixelBW;
+                                       + CompressedBufferSizeInkByte * 1024 * SwathWidthY[k] * BytePerPixelDETY[k] * v->VRatio[k] / (v->HTotal[k] / v->PixelClock[k]) / TotalPixelBW;
                }
 
                LinesInDETY[k] = (double) EffectiveDETBufferSizeY / BytePerPixelDETY[k] / SwathWidthY[k];
                LinesInDETYRoundedDownToSwath[k] = dml_floor(LinesInDETY[k], SwathHeightY[k]);
-               FullDETBufferingTimeY = LinesInDETYRoundedDownToSwath[k] * (HTotal[k] / PixelClock[k]) / VRatio[k];
+               FullDETBufferingTimeY = LinesInDETYRoundedDownToSwath[k] * (v->HTotal[k] / v->PixelClock[k]) / v->VRatio[k];
                if (BytePerPixelDETC[k] > 0) {
                        LinesInDETC = v->DETBufferSizeC[k] / BytePerPixelDETC[k] / SwathWidthC[k];
                        LinesInDETCRoundedDownToSwath = dml_floor(LinesInDETC, SwathHeightC[k]);
-                       FullDETBufferingTimeC = LinesInDETCRoundedDownToSwath * (HTotal[k] / PixelClock[k]) / VRatioChroma[k];
+                       FullDETBufferingTimeC = LinesInDETCRoundedDownToSwath * (v->HTotal[k] / v->PixelClock[k]) / v->VRatioChroma[k];
                } else {
                        LinesInDETC = 0;
                        FullDETBufferingTimeC = 999999;
                }
 
                ActiveDRAMClockChangeLatencyMarginY = EffectiveLBLatencyHidingY + FullDETBufferingTimeY
-                               - ((double) DSTXAfterScaler[k] / HTotal[k] + DSTYAfterScaler[k]) * HTotal[k] / PixelClock[k] - *UrgentWatermark - *DRAMClockChangeWatermark;
+                               - ((double) v->DSTXAfterScaler[k] / v->HTotal[k] + v->DSTYAfterScaler[k]) * v->HTotal[k] / v->PixelClock[k] - v->UrgentWatermark - v->DRAMClockChangeWatermark;
 
-               if (NumberOfActivePlanes > 1) {
+               if (v->NumberOfActivePlanes > 1) {
                        ActiveDRAMClockChangeLatencyMarginY = ActiveDRAMClockChangeLatencyMarginY
-                                       - (1 - 1.0 / NumberOfActivePlanes) * SwathHeightY[k] * HTotal[k] / PixelClock[k] / VRatio[k];
+                                       - (1 - 1.0 / v->NumberOfActivePlanes) * SwathHeightY[k] * v->HTotal[k] / v->PixelClock[k] / v->VRatio[k];
                }
 
                if (BytePerPixelDETC[k] > 0) {
                        ActiveDRAMClockChangeLatencyMarginC = EffectiveLBLatencyHidingC + FullDETBufferingTimeC
-                                       - ((double) DSTXAfterScaler[k] / HTotal[k] + DSTYAfterScaler[k]) * HTotal[k] / PixelClock[k] - *UrgentWatermark - *DRAMClockChangeWatermark;
+                                       - ((double) v->DSTXAfterScaler[k] / v->HTotal[k] + v->DSTYAfterScaler[k]) * v->HTotal[k] / v->PixelClock[k] - v->UrgentWatermark - v->DRAMClockChangeWatermark;
 
-                       if (NumberOfActivePlanes > 1) {
+                       if (v->NumberOfActivePlanes > 1) {
                                ActiveDRAMClockChangeLatencyMarginC = ActiveDRAMClockChangeLatencyMarginC
-                                               - (1 - 1.0 / NumberOfActivePlanes) * SwathHeightC[k] * HTotal[k] / PixelClock[k] / VRatioChroma[k];
+                                               - (1 - 1.0 / v->NumberOfActivePlanes) * SwathHeightC[k] * v->HTotal[k] / v->PixelClock[k] / v->VRatioChroma[k];
                        }
                        v->ActiveDRAMClockChangeLatencyMargin[k] = dml_min(ActiveDRAMClockChangeLatencyMarginY, ActiveDRAMClockChangeLatencyMarginC);
                } else {
                        v->ActiveDRAMClockChangeLatencyMargin[k] = ActiveDRAMClockChangeLatencyMarginY;
                }
 
-               if (WritebackEnable[k] == true) {
-                       WritebackDRAMClockChangeLatencyHiding = WritebackInterfaceBufferSize * 1024
-                                       / (WritebackDestinationWidth[k] * WritebackDestinationHeight[k] / (WritebackSourceHeight[k] * HTotal[k] / PixelClock[k]) * 4);
-                       if (WritebackPixelFormat[k] == dm_444_64) {
+               if (v->WritebackEnable[k] == true) {
+                       WritebackDRAMClockChangeLatencyHiding = v->WritebackInterfaceBufferSize * 1024
+                                       / (v->WritebackDestinationWidth[k] * v->WritebackDestinationHeight[k] / (v->WritebackSourceHeight[k] * v->HTotal[k] / v->PixelClock[k]) * 4);
+                       if (v->WritebackPixelFormat[k] == dm_444_64) {
                                WritebackDRAMClockChangeLatencyHiding = WritebackDRAMClockChangeLatencyHiding / 2;
                        }
                        WritebackDRAMClockChangeLatencyMargin = WritebackDRAMClockChangeLatencyHiding - v->WritebackDRAMClockChangeWatermark;
@@ -5749,14 +5527,14 @@ static void CalculateWatermarksAndDRAMSpeedChangeSupport(
 
        v->MinActiveDRAMClockChangeMargin = 999999;
        PlaneWithMinActiveDRAMClockChangeMargin = 0;
-       for (k = 0; k < NumberOfActivePlanes; ++k) {
+       for (k = 0; k < v->NumberOfActivePlanes; ++k) {
                if (v->ActiveDRAMClockChangeLatencyMargin[k] < v->MinActiveDRAMClockChangeMargin) {
                        v->MinActiveDRAMClockChangeMargin = v->ActiveDRAMClockChangeLatencyMargin[k];
-                       if (BlendingAndTiming[k] == k) {
+                       if (v->BlendingAndTiming[k] == k) {
                                PlaneWithMinActiveDRAMClockChangeMargin = k;
                        } else {
-                               for (j = 0; j < NumberOfActivePlanes; ++j) {
-                                       if (BlendingAndTiming[k] == j) {
+                               for (j = 0; j < v->NumberOfActivePlanes; ++j) {
+                                       if (v->BlendingAndTiming[k] == j) {
                                                PlaneWithMinActiveDRAMClockChangeMargin = j;
                                        }
                                }
@@ -5764,11 +5542,11 @@ static void CalculateWatermarksAndDRAMSpeedChangeSupport(
                }
        }
 
-       *MinActiveDRAMClockChangeLatencySupported = v->MinActiveDRAMClockChangeMargin + DRAMClockChangeLatency;
+       v->MinActiveDRAMClockChangeLatencySupported = v->MinActiveDRAMClockChangeMargin + v->DRAMClockChangeLatency ;
 
        SecondMinActiveDRAMClockChangeMarginOneDisplayInVBLank = 999999;
-       for (k = 0; k < NumberOfActivePlanes; ++k) {
-               if (!((k == PlaneWithMinActiveDRAMClockChangeMargin) && (BlendingAndTiming[k] == k)) && !(BlendingAndTiming[k] == PlaneWithMinActiveDRAMClockChangeMargin)
+       for (k = 0; k < v->NumberOfActivePlanes; ++k) {
+               if (!((k == PlaneWithMinActiveDRAMClockChangeMargin) && (v->BlendingAndTiming[k] == k)) && !(v->BlendingAndTiming[k] == PlaneWithMinActiveDRAMClockChangeMargin)
                                && v->ActiveDRAMClockChangeLatencyMargin[k] < SecondMinActiveDRAMClockChangeMarginOneDisplayInVBLank) {
                        SecondMinActiveDRAMClockChangeMarginOneDisplayInVBLank = v->ActiveDRAMClockChangeLatencyMargin[k];
                }
@@ -5776,25 +5554,25 @@ static void CalculateWatermarksAndDRAMSpeedChangeSupport(
 
        v->TotalNumberOfActiveOTG = 0;
 
-       for (k = 0; k < NumberOfActivePlanes; ++k) {
-               if (BlendingAndTiming[k] == k) {
+       for (k = 0; k < v->NumberOfActivePlanes; ++k) {
+               if (v->BlendingAndTiming[k] == k) {
                        v->TotalNumberOfActiveOTG = v->TotalNumberOfActiveOTG + 1;
                }
        }
 
        if (v->MinActiveDRAMClockChangeMargin > 0 && PrefetchMode == 0) {
                *DRAMClockChangeSupport = dm_dram_clock_change_vactive;
-       } else if ((SynchronizedVBlank == true || v->TotalNumberOfActiveOTG == 1
+       } else if ((v->SynchronizedVBlank == true || v->TotalNumberOfActiveOTG == 1
                        || SecondMinActiveDRAMClockChangeMarginOneDisplayInVBLank > 0) && PrefetchMode == 0) {
                *DRAMClockChangeSupport = dm_dram_clock_change_vblank;
        } else {
                *DRAMClockChangeSupport = dm_dram_clock_change_unsupported;
        }
 
-       *StutterExitWatermark = SRExitTime + ExtraLatency + 10 / DCFCLKDeepSleep;
-       *StutterEnterPlusExitWatermark = (SREnterPlusExitTime + ExtraLatency + 10 / DCFCLKDeepSleep);
-       *Z8StutterExitWatermark = SRExitZ8Time + ExtraLatency + 10 / DCFCLKDeepSleep;
-       *Z8StutterEnterPlusExitWatermark = SREnterPlusExitZ8Time + ExtraLatency + 10 / DCFCLKDeepSleep;
+       *StutterExitWatermark = v->SRExitTime + ExtraLatency + 10 / DCFCLKDeepSleep;
+       *StutterEnterPlusExitWatermark = (v->SREnterPlusExitTime + ExtraLatency + 10 / DCFCLKDeepSleep);
+       *Z8StutterExitWatermark = v->SRExitZ8Time + ExtraLatency + 10 / DCFCLKDeepSleep;
+       *Z8StutterEnterPlusExitWatermark = v->SREnterPlusExitZ8Time + ExtraLatency + 10 / DCFCLKDeepSleep;
 
 #ifdef __DML_VBA_DEBUG__
        dml_print("DML::%s: StutterExitWatermark = %f\n", __func__, *StutterExitWatermark);
index 34a5d0f87b5f9e4dce39ba14b04b5a3425e2ef47..4bb3b31ea7e0c87468c81cebe59217f6a82307f1 100644 (file)
@@ -194,6 +194,9 @@ void dcn314_update_bw_bounding_box_fpu(struct dc *dc, struct clk_bw_params *bw_p
                dcn3_14_ip.max_num_otg = dc->res_pool->res_cap->num_timing_generator;
                dcn3_14_ip.max_num_dpp = dc->res_pool->pipe_count;
 
+               if (bw_params->dram_channel_width_bytes > 0)
+                       dcn3_14_soc.dram_channel_width_bytes = bw_params->dram_channel_width_bytes;
+
                if (bw_params->num_channels > 0)
                        dcn3_14_soc.num_chans = bw_params->num_channels;
 
@@ -262,7 +265,7 @@ void dcn314_update_bw_bounding_box_fpu(struct dc *dc, struct clk_bw_params *bw_p
        }
 
        if (!IS_FPGA_MAXIMUS_DC(dc->ctx->dce_environment))
-               dml_init_instance(&dc->dml, &dcn3_14_soc, &dcn3_14_ip, DML_PROJECT_DCN31);
+               dml_init_instance(&dc->dml, &dcn3_14_soc, &dcn3_14_ip, DML_PROJECT_DCN314);
        else
                dml_init_instance(&dc->dml, &dcn3_14_soc, &dcn3_14_ip, DML_PROJECT_DCN31_FPGA);
 }
index fc4d7474c111e056552444220bf7378d429ba1b3..ee821c4fb5dda9f6792b8d755b3715aa12a6790e 100644 (file)
@@ -61,7 +61,7 @@
 // fudge factor for min dcfclk calclation
 #define __DML_MIN_DCFCLK_FACTOR__   1.15
 
-struct {
+typedef struct {
        double DPPCLK;
        double DISPCLK;
        double PixelClock;
@@ -265,33 +265,13 @@ static void CalculateRowBandwidth(
 
 static void CalculateFlipSchedule(
                struct display_mode_lib *mode_lib,
+               unsigned int k,
                double HostVMInefficiencyFactor,
                double UrgentExtraLatency,
                double UrgentLatency,
-               unsigned int GPUVMMaxPageTableLevels,
-               bool HostVMEnable,
-               unsigned int HostVMMaxNonCachedPageTableLevels,
-               bool GPUVMEnable,
-               double HostVMMinPageSize,
                double PDEAndMetaPTEBytesPerFrame,
                double MetaRowBytes,
-               double DPTEBytesPerRow,
-               double BandwidthAvailableForImmediateFlip,
-               unsigned int TotImmediateFlipBytes,
-               enum source_format_class SourcePixelFormat,
-               double LineTime,
-               double VRatio,
-               double VRatioChroma,
-               double Tno_bw,
-               bool DCCEnable,
-               unsigned int dpte_row_height,
-               unsigned int meta_row_height,
-               unsigned int dpte_row_height_chroma,
-               unsigned int meta_row_height_chroma,
-               double *DestinationLinesToRequestVMInImmediateFlip,
-               double *DestinationLinesToRequestRowInImmediateFlip,
-               double *final_flip_bw,
-               bool *ImmediateFlipSupportedForPipe);
+               double DPTEBytesPerRow);
 static double CalculateWriteBackDelay(
                enum source_format_class WritebackPixelFormat,
                double WritebackHRatio,
@@ -325,64 +305,28 @@ static void CalculateVupdateAndDynamicMetadataParameters(
 static void CalculateWatermarksAndDRAMSpeedChangeSupport(
                struct display_mode_lib *mode_lib,
                unsigned int PrefetchMode,
-               unsigned int NumberOfActivePlanes,
-               unsigned int MaxLineBufferLines,
-               unsigned int LineBufferSize,
-               unsigned int WritebackInterfaceBufferSize,
                double DCFCLK,
                double ReturnBW,
-               bool SynchronizedVBlank,
-               unsigned int dpte_group_bytes[],
-               unsigned int MetaChunkSize,
                double UrgentLatency,
                double ExtraLatency,
-               double WritebackLatency,
-               double WritebackChunkSize,
                double SOCCLK,
-               double DRAMClockChangeLatency,
-               double SRExitTime,
-               double SREnterPlusExitTime,
-               double SRExitZ8Time,
-               double SREnterPlusExitZ8Time,
                double DCFCLKDeepSleep,
                unsigned int DETBufferSizeY[],
                unsigned int DETBufferSizeC[],
                unsigned int SwathHeightY[],
                unsigned int SwathHeightC[],
-               unsigned int LBBitPerPixel[],
                double SwathWidthY[],
                double SwathWidthC[],
-               double HRatio[],
-               double HRatioChroma[],
-               unsigned int vtaps[],
-               unsigned int VTAPsChroma[],
-               double VRatio[],
-               double VRatioChroma[],
-               unsigned int HTotal[],
-               double PixelClock[],
-               unsigned int BlendingAndTiming[],
                unsigned int DPPPerPlane[],
                double BytePerPixelDETY[],
                double BytePerPixelDETC[],
-               double DSTXAfterScaler[],
-               double DSTYAfterScaler[],
-               bool WritebackEnable[],
-               enum source_format_class WritebackPixelFormat[],
-               double WritebackDestinationWidth[],
-               double WritebackDestinationHeight[],
-               double WritebackSourceHeight[],
                bool UnboundedRequestEnabled,
                unsigned int CompressedBufferSizeInkByte,
                enum clock_change_support *DRAMClockChangeSupport,
-               double *UrgentWatermark,
-               double *WritebackUrgentWatermark,
-               double *DRAMClockChangeWatermark,
-               double *WritebackDRAMClockChangeWatermark,
                double *StutterExitWatermark,
                double *StutterEnterPlusExitWatermark,
                double *Z8StutterExitWatermark,
-               double *Z8StutterEnterPlusExitWatermark,
-               double *MinActiveDRAMClockChangeLatencySupported);
+               double *Z8StutterEnterPlusExitWatermark);
 
 static void CalculateDCFCLKDeepSleep(
                struct display_mode_lib *mode_lib,
@@ -1599,7 +1543,7 @@ static void CalculateDCCConfiguration(
        int segment_order_vert_contiguous_luma;
        int segment_order_vert_contiguous_chroma;
 
-       enum {
+       typedef enum {
                REQ_256Bytes, REQ_128BytesNonContiguous, REQ_128BytesContiguous, REQ_NA
        } RequestType;
        RequestType RequestLuma;
@@ -2928,33 +2872,13 @@ static void DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerforman
                        for (k = 0; k < v->NumberOfActivePlanes; ++k) {
                                CalculateFlipSchedule(
                                                mode_lib,
+                                               k,
                                                HostVMInefficiencyFactor,
                                                v->UrgentExtraLatency,
                                                v->UrgentLatency,
-                                               v->GPUVMMaxPageTableLevels,
-                                               v->HostVMEnable,
-                                               v->HostVMMaxNonCachedPageTableLevels,
-                                               v->GPUVMEnable,
-                                               v->HostVMMinPageSize,
                                                v->PDEAndMetaPTEBytesFrame[k],
                                                v->MetaRowByte[k],
-                                               v->PixelPTEBytesPerRow[k],
-                                               v->BandwidthAvailableForImmediateFlip,
-                                               v->TotImmediateFlipBytes,
-                                               v->SourcePixelFormat[k],
-                                               v->HTotal[k] / v->PixelClock[k],
-                                               v->VRatio[k],
-                                               v->VRatioChroma[k],
-                                               v->Tno_bw[k],
-                                               v->DCCEnable[k],
-                                               v->dpte_row_height[k],
-                                               v->meta_row_height[k],
-                                               v->dpte_row_height_chroma[k],
-                                               v->meta_row_height_chroma[k],
-                                               &v->DestinationLinesToRequestVMInImmediateFlip[k],
-                                               &v->DestinationLinesToRequestRowInImmediateFlip[k],
-                                               &v->final_flip_bw[k],
-                                               &v->ImmediateFlipSupportedForPipe[k]);
+                                               v->PixelPTEBytesPerRow[k]);
                        }
 
                        v->total_dcn_read_bw_with_flip = 0.0;
@@ -3041,64 +2965,28 @@ static void DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerforman
                CalculateWatermarksAndDRAMSpeedChangeSupport(
                                mode_lib,
                                PrefetchMode,
-                               v->NumberOfActivePlanes,
-                               v->MaxLineBufferLines,
-                               v->LineBufferSize,
-                               v->WritebackInterfaceBufferSize,
                                v->DCFCLK,
                                v->ReturnBW,
-                               v->SynchronizedVBlank,
-                               v->dpte_group_bytes,
-                               v->MetaChunkSize,
                                v->UrgentLatency,
                                v->UrgentExtraLatency,
-                               v->WritebackLatency,
-                               v->WritebackChunkSize,
                                v->SOCCLK,
-                               v->DRAMClockChangeLatency,
-                               v->SRExitTime,
-                               v->SREnterPlusExitTime,
-                               v->SRExitZ8Time,
-                               v->SREnterPlusExitZ8Time,
                                v->DCFCLKDeepSleep,
                                v->DETBufferSizeY,
                                v->DETBufferSizeC,
                                v->SwathHeightY,
                                v->SwathHeightC,
-                               v->LBBitPerPixel,
                                v->SwathWidthY,
                                v->SwathWidthC,
-                               v->HRatio,
-                               v->HRatioChroma,
-                               v->vtaps,
-                               v->VTAPsChroma,
-                               v->VRatio,
-                               v->VRatioChroma,
-                               v->HTotal,
-                               v->PixelClock,
-                               v->BlendingAndTiming,
                                v->DPPPerPlane,
                                v->BytePerPixelDETY,
                                v->BytePerPixelDETC,
-                               v->DSTXAfterScaler,
-                               v->DSTYAfterScaler,
-                               v->WritebackEnable,
-                               v->WritebackPixelFormat,
-                               v->WritebackDestinationWidth,
-                               v->WritebackDestinationHeight,
-                               v->WritebackSourceHeight,
                                v->UnboundedRequestEnabled,
                                v->CompressedBufferSizeInkByte,
                                &DRAMClockChangeSupport,
-                               &v->UrgentWatermark,
-                               &v->WritebackUrgentWatermark,
-                               &v->DRAMClockChangeWatermark,
-                               &v->WritebackDRAMClockChangeWatermark,
                                &v->StutterExitWatermark,
                                &v->StutterEnterPlusExitWatermark,
                                &v->Z8StutterExitWatermark,
-                               &v->Z8StutterEnterPlusExitWatermark,
-                               &v->MinActiveDRAMClockChangeLatencySupported);
+                               &v->Z8StutterEnterPlusExitWatermark);
 
                for (k = 0; k < v->NumberOfActivePlanes; ++k) {
                        if (v->WritebackEnable[k] == true) {
@@ -3710,61 +3598,43 @@ static void CalculateRowBandwidth(
 
 static void CalculateFlipSchedule(
                struct display_mode_lib *mode_lib,
+               unsigned int k,
                double HostVMInefficiencyFactor,
                double UrgentExtraLatency,
                double UrgentLatency,
-               unsigned int GPUVMMaxPageTableLevels,
-               bool HostVMEnable,
-               unsigned int HostVMMaxNonCachedPageTableLevels,
-               bool GPUVMEnable,
-               double HostVMMinPageSize,
                double PDEAndMetaPTEBytesPerFrame,
                double MetaRowBytes,
-               double DPTEBytesPerRow,
-               double BandwidthAvailableForImmediateFlip,
-               unsigned int TotImmediateFlipBytes,
-               enum source_format_class SourcePixelFormat,
-               double LineTime,
-               double VRatio,
-               double VRatioChroma,
-               double Tno_bw,
-               bool DCCEnable,
-               unsigned int dpte_row_height,
-               unsigned int meta_row_height,
-               unsigned int dpte_row_height_chroma,
-               unsigned int meta_row_height_chroma,
-               double *DestinationLinesToRequestVMInImmediateFlip,
-               double *DestinationLinesToRequestRowInImmediateFlip,
-               double *final_flip_bw,
-               bool *ImmediateFlipSupportedForPipe)
+               double DPTEBytesPerRow)
 {
+       struct vba_vars_st *v = &mode_lib->vba;
        double min_row_time = 0.0;
        unsigned int HostVMDynamicLevelsTrips;
        double TimeForFetchingMetaPTEImmediateFlip;
        double TimeForFetchingRowInVBlankImmediateFlip;
        double ImmediateFlipBW;
+       double LineTime = v->HTotal[k] / v->PixelClock[k];
 
-       if (GPUVMEnable == true && HostVMEnable == true) {
-               HostVMDynamicLevelsTrips = HostVMMaxNonCachedPageTableLevels;
+       if (v->GPUVMEnable == true && v->HostVMEnable == true) {
+               HostVMDynamicLevelsTrips = v->HostVMMaxNonCachedPageTableLevels;
        } else {
                HostVMDynamicLevelsTrips = 0;
        }
 
-       if (GPUVMEnable == true || DCCEnable == true) {
-               ImmediateFlipBW = (PDEAndMetaPTEBytesPerFrame + MetaRowBytes + DPTEBytesPerRow) * BandwidthAvailableForImmediateFlip / TotImmediateFlipBytes;
+       if (v->GPUVMEnable == true || v->DCCEnable[k] == true) {
+               ImmediateFlipBW = (PDEAndMetaPTEBytesPerFrame + MetaRowBytes + DPTEBytesPerRow) * v->BandwidthAvailableForImmediateFlip / v->TotImmediateFlipBytes;
        }
 
-       if (GPUVMEnable == true) {
+       if (v->GPUVMEnable == true) {
                TimeForFetchingMetaPTEImmediateFlip = dml_max3(
-                               Tno_bw + PDEAndMetaPTEBytesPerFrame * HostVMInefficiencyFactor / ImmediateFlipBW,
-                               UrgentExtraLatency + UrgentLatency * (GPUVMMaxPageTableLevels * (HostVMDynamicLevelsTrips + 1) - 1),
+                               v->Tno_bw[k] + PDEAndMetaPTEBytesPerFrame * HostVMInefficiencyFactor / ImmediateFlipBW,
+                               UrgentExtraLatency + UrgentLatency * (v->GPUVMMaxPageTableLevels * (HostVMDynamicLevelsTrips + 1) - 1),
                                LineTime / 4.0);
        } else {
                TimeForFetchingMetaPTEImmediateFlip = 0;
        }
 
-       *DestinationLinesToRequestVMInImmediateFlip = dml_ceil(4.0 * (TimeForFetchingMetaPTEImmediateFlip / LineTime), 1) / 4.0;
-       if ((GPUVMEnable == true || DCCEnable == true)) {
+       v->DestinationLinesToRequestVMInImmediateFlip[k] = dml_ceil(4.0 * (TimeForFetchingMetaPTEImmediateFlip / LineTime), 1) / 4.0;
+       if ((v->GPUVMEnable == true || v->DCCEnable[k] == true)) {
                TimeForFetchingRowInVBlankImmediateFlip = dml_max3(
                                (MetaRowBytes + DPTEBytesPerRow * HostVMInefficiencyFactor) / ImmediateFlipBW,
                                UrgentLatency * (HostVMDynamicLevelsTrips + 1),
@@ -3773,54 +3643,54 @@ static void CalculateFlipSchedule(
                TimeForFetchingRowInVBlankImmediateFlip = 0;
        }
 
-       *DestinationLinesToRequestRowInImmediateFlip = dml_ceil(4.0 * (TimeForFetchingRowInVBlankImmediateFlip / LineTime), 1) / 4.0;
+       v->DestinationLinesToRequestRowInImmediateFlip[k] = dml_ceil(4.0 * (TimeForFetchingRowInVBlankImmediateFlip / LineTime), 1) / 4.0;
 
-       if (GPUVMEnable == true) {
-               *final_flip_bw = dml_max(
-                               PDEAndMetaPTEBytesPerFrame * HostVMInefficiencyFactor / (*DestinationLinesToRequestVMInImmediateFlip * LineTime),
-                               (MetaRowBytes + DPTEBytesPerRow * HostVMInefficiencyFactor) / (*DestinationLinesToRequestRowInImmediateFlip * LineTime));
-       } else if ((GPUVMEnable == true || DCCEnable == true)) {
-               *final_flip_bw = (MetaRowBytes + DPTEBytesPerRow * HostVMInefficiencyFactor) / (*DestinationLinesToRequestRowInImmediateFlip * LineTime);
+       if (v->GPUVMEnable == true) {
+               v->final_flip_bw[k] = dml_max(
+                               PDEAndMetaPTEBytesPerFrame * HostVMInefficiencyFactor / (v->DestinationLinesToRequestVMInImmediateFlip[k] * LineTime),
+                               (MetaRowBytes + DPTEBytesPerRow * HostVMInefficiencyFactor) / (v->DestinationLinesToRequestRowInImmediateFlip[k] * LineTime));
+       } else if ((v->GPUVMEnable == true || v->DCCEnable[k] == true)) {
+               v->final_flip_bw[k] = (MetaRowBytes + DPTEBytesPerRow * HostVMInefficiencyFactor) / (v->DestinationLinesToRequestRowInImmediateFlip[k] * LineTime);
        } else {
-               *final_flip_bw = 0;
+               v->final_flip_bw[k] = 0;
        }
 
-       if (SourcePixelFormat == dm_420_8 || SourcePixelFormat == dm_420_10 || SourcePixelFormat == dm_rgbe_alpha) {
-               if (GPUVMEnable == true && DCCEnable != true) {
-                       min_row_time = dml_min(dpte_row_height * LineTime / VRatio, dpte_row_height_chroma * LineTime / VRatioChroma);
-               } else if (GPUVMEnable != true && DCCEnable == true) {
-                       min_row_time = dml_min(meta_row_height * LineTime / VRatio, meta_row_height_chroma * LineTime / VRatioChroma);
+       if (v->SourcePixelFormat[k] == dm_420_8 || v->SourcePixelFormat[k] == dm_420_10 || v->SourcePixelFormat[k] == dm_rgbe_alpha) {
+               if (v->GPUVMEnable == true && v->DCCEnable[k] != true) {
+                       min_row_time = dml_min(v->dpte_row_height[k] * LineTime / v->VRatio[k], v->dpte_row_height_chroma[k] * LineTime / v->VRatioChroma[k]);
+               } else if (v->GPUVMEnable != true && v->DCCEnable[k] == true) {
+                       min_row_time = dml_min(v->meta_row_height[k] * LineTime / v->VRatio[k], v->meta_row_height_chroma[k] * LineTime / v->VRatioChroma[k]);
                } else {
                        min_row_time = dml_min4(
-                                       dpte_row_height * LineTime / VRatio,
-                                       meta_row_height * LineTime / VRatio,
-                                       dpte_row_height_chroma * LineTime / VRatioChroma,
-                                       meta_row_height_chroma * LineTime / VRatioChroma);
+                                       v->dpte_row_height[k] * LineTime / v->VRatio[k],
+                                       v->meta_row_height[k] * LineTime / v->VRatio[k],
+                                       v->dpte_row_height_chroma[k] * LineTime / v->VRatioChroma[k],
+                                       v->meta_row_height_chroma[k] * LineTime / v->VRatioChroma[k]);
                }
        } else {
-               if (GPUVMEnable == true && DCCEnable != true) {
-                       min_row_time = dpte_row_height * LineTime / VRatio;
-               } else if (GPUVMEnable != true && DCCEnable == true) {
-                       min_row_time = meta_row_height * LineTime / VRatio;
+               if (v->GPUVMEnable == true && v->DCCEnable[k] != true) {
+                       min_row_time = v->dpte_row_height[k] * LineTime / v->VRatio[k];
+               } else if (v->GPUVMEnable != true && v->DCCEnable[k] == true) {
+                       min_row_time = v->meta_row_height[k] * LineTime / v->VRatio[k];
                } else {
-                       min_row_time = dml_min(dpte_row_height * LineTime / VRatio, meta_row_height * LineTime / VRatio);
+                       min_row_time = dml_min(v->dpte_row_height[k] * LineTime / v->VRatio[k], v->meta_row_height[k] * LineTime / v->VRatio[k]);
                }
        }
 
-       if (*DestinationLinesToRequestVMInImmediateFlip >= 32 || *DestinationLinesToRequestRowInImmediateFlip >= 16
+       if (v->DestinationLinesToRequestVMInImmediateFlip[k] >= 32 || v->DestinationLinesToRequestRowInImmediateFlip[k] >= 16
                        || TimeForFetchingMetaPTEImmediateFlip + 2 * TimeForFetchingRowInVBlankImmediateFlip > min_row_time) {
-               *ImmediateFlipSupportedForPipe = false;
+               v->ImmediateFlipSupportedForPipe[k] = false;
        } else {
-               *ImmediateFlipSupportedForPipe = true;
+               v->ImmediateFlipSupportedForPipe[k] = true;
        }
 
 #ifdef __DML_VBA_DEBUG__
-       dml_print("DML::%s: DestinationLinesToRequestVMInImmediateFlip = %f\n", __func__, *DestinationLinesToRequestVMInImmediateFlip);
-       dml_print("DML::%s: DestinationLinesToRequestRowInImmediateFlip = %f\n", __func__, *DestinationLinesToRequestRowInImmediateFlip);
+       dml_print("DML::%s: DestinationLinesToRequestVMInImmediateFlip = %f\n", __func__, v->DestinationLinesToRequestVMInImmediateFlip[k]);
+       dml_print("DML::%s: DestinationLinesToRequestRowInImmediateFlip = %f\n", __func__, v->DestinationLinesToRequestRowInImmediateFlip[k]);
        dml_print("DML::%s: TimeForFetchingMetaPTEImmediateFlip = %f\n", __func__, TimeForFetchingMetaPTEImmediateFlip);
        dml_print("DML::%s: TimeForFetchingRowInVBlankImmediateFlip = %f\n", __func__, TimeForFetchingRowInVBlankImmediateFlip);
        dml_print("DML::%s: min_row_time = %f\n", __func__, min_row_time);
-       dml_print("DML::%s: ImmediateFlipSupportedForPipe = %d\n", __func__, *ImmediateFlipSupportedForPipe);
+       dml_print("DML::%s: ImmediateFlipSupportedForPipe = %d\n", __func__, v->ImmediateFlipSupportedForPipe[k]);
 #endif
 
 }
@@ -4071,9 +3941,7 @@ void dml314_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_
 
        v->SourceFormatPixelAndScanSupport = true;
        for (k = 0; k < v->NumberOfActivePlanes; k++) {
-               if ((v->SurfaceTiling[k] == dm_sw_linear && (!(v->SourceScan[k] != dm_vert) || v->DCCEnable[k] == true))
-                               || ((v->SurfaceTiling[k] == dm_sw_64kb_d || v->SurfaceTiling[k] == dm_sw_64kb_d_t
-                                               || v->SurfaceTiling[k] == dm_sw_64kb_d_x) && !(v->SourcePixelFormat[k] == dm_444_64))) {
+               if (v->SurfaceTiling[k] == dm_sw_linear && (!(v->SourceScan[k] != dm_vert) || v->DCCEnable[k] == true)) {
                        v->SourceFormatPixelAndScanSupport = false;
                }
        }
@@ -5414,33 +5282,13 @@ void dml314_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_
                                        for (k = 0; k < v->NumberOfActivePlanes; k++) {
                                                CalculateFlipSchedule(
                                                                mode_lib,
+                                                               k,
                                                                HostVMInefficiencyFactor,
                                                                v->ExtraLatency,
                                                                v->UrgLatency[i],
-                                                               v->GPUVMMaxPageTableLevels,
-                                                               v->HostVMEnable,
-                                                               v->HostVMMaxNonCachedPageTableLevels,
-                                                               v->GPUVMEnable,
-                                                               v->HostVMMinPageSize,
                                                                v->PDEAndMetaPTEBytesPerFrame[i][j][k],
                                                                v->MetaRowBytes[i][j][k],
-                                                               v->DPTEBytesPerRow[i][j][k],
-                                                               v->BandwidthAvailableForImmediateFlip,
-                                                               v->TotImmediateFlipBytes,
-                                                               v->SourcePixelFormat[k],
-                                                               v->HTotal[k] / v->PixelClock[k],
-                                                               v->VRatio[k],
-                                                               v->VRatioChroma[k],
-                                                               v->Tno_bw[k],
-                                                               v->DCCEnable[k],
-                                                               v->dpte_row_height[k],
-                                                               v->meta_row_height[k],
-                                                               v->dpte_row_height_chroma[k],
-                                                               v->meta_row_height_chroma[k],
-                                                               &v->DestinationLinesToRequestVMInImmediateFlip[k],
-                                                               &v->DestinationLinesToRequestRowInImmediateFlip[k],
-                                                               &v->final_flip_bw[k],
-                                                               &v->ImmediateFlipSupportedForPipe[k]);
+                                                               v->DPTEBytesPerRow[i][j][k]);
                                        }
                                        v->total_dcn_read_bw_with_flip = 0.0;
                                        for (k = 0; k < v->NumberOfActivePlanes; k++) {
@@ -5498,64 +5346,28 @@ void dml314_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_
                        CalculateWatermarksAndDRAMSpeedChangeSupport(
                                        mode_lib,
                                        v->PrefetchModePerState[i][j],
-                                       v->NumberOfActivePlanes,
-                                       v->MaxLineBufferLines,
-                                       v->LineBufferSize,
-                                       v->WritebackInterfaceBufferSize,
                                        v->DCFCLKState[i][j],
                                        v->ReturnBWPerState[i][j],
-                                       v->SynchronizedVBlank,
-                                       v->dpte_group_bytes,
-                                       v->MetaChunkSize,
                                        v->UrgLatency[i],
                                        v->ExtraLatency,
-                                       v->WritebackLatency,
-                                       v->WritebackChunkSize,
                                        v->SOCCLKPerState[i],
-                                       v->DRAMClockChangeLatency,
-                                       v->SRExitTime,
-                                       v->SREnterPlusExitTime,
-                                       v->SRExitZ8Time,
-                                       v->SREnterPlusExitZ8Time,
                                        v->ProjectedDCFCLKDeepSleep[i][j],
                                        v->DETBufferSizeYThisState,
                                        v->DETBufferSizeCThisState,
                                        v->SwathHeightYThisState,
                                        v->SwathHeightCThisState,
-                                       v->LBBitPerPixel,
                                        v->SwathWidthYThisState,
                                        v->SwathWidthCThisState,
-                                       v->HRatio,
-                                       v->HRatioChroma,
-                                       v->vtaps,
-                                       v->VTAPsChroma,
-                                       v->VRatio,
-                                       v->VRatioChroma,
-                                       v->HTotal,
-                                       v->PixelClock,
-                                       v->BlendingAndTiming,
                                        v->NoOfDPPThisState,
                                        v->BytePerPixelInDETY,
                                        v->BytePerPixelInDETC,
-                                       v->DSTXAfterScaler,
-                                       v->DSTYAfterScaler,
-                                       v->WritebackEnable,
-                                       v->WritebackPixelFormat,
-                                       v->WritebackDestinationWidth,
-                                       v->WritebackDestinationHeight,
-                                       v->WritebackSourceHeight,
                                        UnboundedRequestEnabledThisState,
                                        CompressedBufferSizeInkByteThisState,
                                        &v->DRAMClockChangeSupport[i][j],
-                                       &v->UrgentWatermark,
-                                       &v->WritebackUrgentWatermark,
-                                       &v->DRAMClockChangeWatermark,
-                                       &v->WritebackDRAMClockChangeWatermark,
-                                       &dummy,
                                        &dummy,
                                        &dummy,
                                        &dummy,
-                                       &v->MinActiveDRAMClockChangeLatencySupported);
+                                       &dummy);
                }
        }
 
@@ -5681,64 +5493,28 @@ void dml314_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_
 static void CalculateWatermarksAndDRAMSpeedChangeSupport(
                struct display_mode_lib *mode_lib,
                unsigned int PrefetchMode,
-               unsigned int NumberOfActivePlanes,
-               unsigned int MaxLineBufferLines,
-               unsigned int LineBufferSize,
-               unsigned int WritebackInterfaceBufferSize,
                double DCFCLK,
                double ReturnBW,
-               bool SynchronizedVBlank,
-               unsigned int dpte_group_bytes[],
-               unsigned int MetaChunkSize,
                double UrgentLatency,
                double ExtraLatency,
-               double WritebackLatency,
-               double WritebackChunkSize,
                double SOCCLK,
-               double DRAMClockChangeLatency,
-               double SRExitTime,
-               double SREnterPlusExitTime,
-               double SRExitZ8Time,
-               double SREnterPlusExitZ8Time,
                double DCFCLKDeepSleep,
                unsigned int DETBufferSizeY[],
                unsigned int DETBufferSizeC[],
                unsigned int SwathHeightY[],
                unsigned int SwathHeightC[],
-               unsigned int LBBitPerPixel[],
                double SwathWidthY[],
                double SwathWidthC[],
-               double HRatio[],
-               double HRatioChroma[],
-               unsigned int vtaps[],
-               unsigned int VTAPsChroma[],
-               double VRatio[],
-               double VRatioChroma[],
-               unsigned int HTotal[],
-               double PixelClock[],
-               unsigned int BlendingAndTiming[],
                unsigned int DPPPerPlane[],
                double BytePerPixelDETY[],
                double BytePerPixelDETC[],
-               double DSTXAfterScaler[],
-               double DSTYAfterScaler[],
-               bool WritebackEnable[],
-               enum source_format_class WritebackPixelFormat[],
-               double WritebackDestinationWidth[],
-               double WritebackDestinationHeight[],
-               double WritebackSourceHeight[],
                bool UnboundedRequestEnabled,
                unsigned int CompressedBufferSizeInkByte,
                enum clock_change_support *DRAMClockChangeSupport,
-               double *UrgentWatermark,
-               double *WritebackUrgentWatermark,
-               double *DRAMClockChangeWatermark,
-               double *WritebackDRAMClockChangeWatermark,
                double *StutterExitWatermark,
                double *StutterEnterPlusExitWatermark,
                double *Z8StutterExitWatermark,
-               double *Z8StutterEnterPlusExitWatermark,
-               double *MinActiveDRAMClockChangeLatencySupported)
+               double *Z8StutterEnterPlusExitWatermark)
 {
        struct vba_vars_st *v = &mode_lib->vba;
        double EffectiveLBLatencyHidingY;
@@ -5758,103 +5534,103 @@ static void CalculateWatermarksAndDRAMSpeedChangeSupport(
        double TotalPixelBW = 0.0;
        int k, j;
 
-       *UrgentWatermark = UrgentLatency + ExtraLatency;
+       v->UrgentWatermark = UrgentLatency + ExtraLatency;
 
 #ifdef __DML_VBA_DEBUG__
        dml_print("DML::%s: UrgentLatency = %f\n", __func__, UrgentLatency);
        dml_print("DML::%s: ExtraLatency = %f\n", __func__, ExtraLatency);
-       dml_print("DML::%s: UrgentWatermark = %f\n", __func__, *UrgentWatermark);
+       dml_print("DML::%s: UrgentWatermark = %f\n", __func__, v->UrgentWatermark);
 #endif
 
-       *DRAMClockChangeWatermark = DRAMClockChangeLatency + *UrgentWatermark;
+       v->DRAMClockChangeWatermark = v->DRAMClockChangeLatency + v->UrgentWatermark;
 
 #ifdef __DML_VBA_DEBUG__
-       dml_print("DML::%s: DRAMClockChangeLatency = %f\n", __func__, DRAMClockChangeLatency);
-       dml_print("DML::%s: DRAMClockChangeWatermark = %f\n", __func__, *DRAMClockChangeWatermark);
+       dml_print("DML::%s: v->DRAMClockChangeLatency = %f\n", __func__, v->DRAMClockChangeLatency);
+       dml_print("DML::%s: DRAMClockChangeWatermark = %f\n", __func__, v->DRAMClockChangeWatermark);
 #endif
 
        v->TotalActiveWriteback = 0;
-       for (k = 0; k < NumberOfActivePlanes; ++k) {
-               if (WritebackEnable[k] == true) {
+       for (k = 0; k < v->NumberOfActivePlanes; ++k) {
+               if (v->WritebackEnable[k] == true) {
                        v->TotalActiveWriteback = v->TotalActiveWriteback + 1;
                }
        }
 
        if (v->TotalActiveWriteback <= 1) {
-               *WritebackUrgentWatermark = WritebackLatency;
+               v->WritebackUrgentWatermark = v->WritebackLatency;
        } else {
-               *WritebackUrgentWatermark = WritebackLatency + WritebackChunkSize * 1024.0 / 32.0 / SOCCLK;
+               v->WritebackUrgentWatermark = v->WritebackLatency + v->WritebackChunkSize * 1024.0 / 32.0 / SOCCLK;
        }
 
        if (v->TotalActiveWriteback <= 1) {
-               *WritebackDRAMClockChangeWatermark = DRAMClockChangeLatency + WritebackLatency;
+               v->WritebackDRAMClockChangeWatermark = v->DRAMClockChangeLatency + v->WritebackLatency;
        } else {
-               *WritebackDRAMClockChangeWatermark = DRAMClockChangeLatency + WritebackLatency + WritebackChunkSize * 1024.0 / 32.0 / SOCCLK;
+               v->WritebackDRAMClockChangeWatermark = v->DRAMClockChangeLatency + v->WritebackLatency + v->WritebackChunkSize * 1024.0 / 32.0 / SOCCLK;
        }
 
-       for (k = 0; k < NumberOfActivePlanes; ++k) {
+       for (k = 0; k < v->NumberOfActivePlanes; ++k) {
                TotalPixelBW = TotalPixelBW
-                               + DPPPerPlane[k] * (SwathWidthY[k] * BytePerPixelDETY[k] * VRatio[k] + SwathWidthC[k] * BytePerPixelDETC[k] * VRatioChroma[k])
-                                               / (HTotal[k] / PixelClock[k]);
+                               + DPPPerPlane[k] * (SwathWidthY[k] * BytePerPixelDETY[k] * v->VRatio[k] + SwathWidthC[k] * BytePerPixelDETC[k] * v->VRatioChroma[k])
+                                               / (v->HTotal[k] / v->PixelClock[k]);
        }
 
-       for (k = 0; k < NumberOfActivePlanes; ++k) {
+       for (k = 0; k < v->NumberOfActivePlanes; ++k) {
                double EffectiveDETBufferSizeY = DETBufferSizeY[k];
 
                v->LBLatencyHidingSourceLinesY = dml_min(
-                               (double) MaxLineBufferLines,
-                               dml_floor(LineBufferSize / LBBitPerPixel[k] / (SwathWidthY[k] / dml_max(HRatio[k], 1.0)), 1)) - (vtaps[k] - 1);
+                               (double) v->MaxLineBufferLines,
+                               dml_floor(v->LineBufferSize / v->LBBitPerPixel[k] / (SwathWidthY[k] / dml_max(v->HRatio[k], 1.0)), 1)) - (v->vtaps[k] - 1);
 
                v->LBLatencyHidingSourceLinesC = dml_min(
-                               (double) MaxLineBufferLines,
-                               dml_floor(LineBufferSize / LBBitPerPixel[k] / (SwathWidthC[k] / dml_max(HRatioChroma[k], 1.0)), 1)) - (VTAPsChroma[k] - 1);
+                               (double) v->MaxLineBufferLines,
+                               dml_floor(v->LineBufferSize / v->LBBitPerPixel[k] / (SwathWidthC[k] / dml_max(v->HRatioChroma[k], 1.0)), 1)) - (v->VTAPsChroma[k] - 1);
 
-               EffectiveLBLatencyHidingY = v->LBLatencyHidingSourceLinesY / VRatio[k] * (HTotal[k] / PixelClock[k]);
+               EffectiveLBLatencyHidingY = v->LBLatencyHidingSourceLinesY / v->VRatio[k] * (v->HTotal[k] / v->PixelClock[k]);
 
-               EffectiveLBLatencyHidingC = v->LBLatencyHidingSourceLinesC / VRatioChroma[k] * (HTotal[k] / PixelClock[k]);
+               EffectiveLBLatencyHidingC = v->LBLatencyHidingSourceLinesC / v->VRatioChroma[k] * (v->HTotal[k] / v->PixelClock[k]);
 
                if (UnboundedRequestEnabled) {
                        EffectiveDETBufferSizeY = EffectiveDETBufferSizeY
-                                       + CompressedBufferSizeInkByte * 1024 * SwathWidthY[k] * BytePerPixelDETY[k] * VRatio[k] / (HTotal[k] / PixelClock[k]) / TotalPixelBW;
+                                       + CompressedBufferSizeInkByte * 1024 * SwathWidthY[k] * BytePerPixelDETY[k] * v->VRatio[k] / (v->HTotal[k] / v->PixelClock[k]) / TotalPixelBW;
                }
 
                LinesInDETY[k] = (double) EffectiveDETBufferSizeY / BytePerPixelDETY[k] / SwathWidthY[k];
                LinesInDETYRoundedDownToSwath[k] = dml_floor(LinesInDETY[k], SwathHeightY[k]);
-               FullDETBufferingTimeY = LinesInDETYRoundedDownToSwath[k] * (HTotal[k] / PixelClock[k]) / VRatio[k];
+               FullDETBufferingTimeY = LinesInDETYRoundedDownToSwath[k] * (v->HTotal[k] / v->PixelClock[k]) / v->VRatio[k];
                if (BytePerPixelDETC[k] > 0) {
                        LinesInDETC = v->DETBufferSizeC[k] / BytePerPixelDETC[k] / SwathWidthC[k];
                        LinesInDETCRoundedDownToSwath = dml_floor(LinesInDETC, SwathHeightC[k]);
-                       FullDETBufferingTimeC = LinesInDETCRoundedDownToSwath * (HTotal[k] / PixelClock[k]) / VRatioChroma[k];
+                       FullDETBufferingTimeC = LinesInDETCRoundedDownToSwath * (v->HTotal[k] / v->PixelClock[k]) / v->VRatioChroma[k];
                } else {
                        LinesInDETC = 0;
                        FullDETBufferingTimeC = 999999;
                }
 
                ActiveDRAMClockChangeLatencyMarginY = EffectiveLBLatencyHidingY + FullDETBufferingTimeY
-                               - ((double) DSTXAfterScaler[k] / HTotal[k] + DSTYAfterScaler[k]) * HTotal[k] / PixelClock[k] - *UrgentWatermark - *DRAMClockChangeWatermark;
+                               - ((double) v->DSTXAfterScaler[k] / v->HTotal[k] + v->DSTYAfterScaler[k]) * v->HTotal[k] / v->PixelClock[k] - v->UrgentWatermark - v->DRAMClockChangeWatermark;
 
-               if (NumberOfActivePlanes > 1) {
+               if (v->NumberOfActivePlanes > 1) {
                        ActiveDRAMClockChangeLatencyMarginY = ActiveDRAMClockChangeLatencyMarginY
-                                       - (1 - 1.0 / NumberOfActivePlanes) * SwathHeightY[k] * HTotal[k] / PixelClock[k] / VRatio[k];
+                                       - (1 - 1.0 / v->NumberOfActivePlanes) * SwathHeightY[k] * v->HTotal[k] / v->PixelClock[k] / v->VRatio[k];
                }
 
                if (BytePerPixelDETC[k] > 0) {
                        ActiveDRAMClockChangeLatencyMarginC = EffectiveLBLatencyHidingC + FullDETBufferingTimeC
-                                       - ((double) DSTXAfterScaler[k] / HTotal[k] + DSTYAfterScaler[k]) * HTotal[k] / PixelClock[k] - *UrgentWatermark - *DRAMClockChangeWatermark;
+                                       - ((double) v->DSTXAfterScaler[k] / v->HTotal[k] + v->DSTYAfterScaler[k]) * v->HTotal[k] / v->PixelClock[k] - v->UrgentWatermark - v->DRAMClockChangeWatermark;
 
-                       if (NumberOfActivePlanes > 1) {
+                       if (v->NumberOfActivePlanes > 1) {
                                ActiveDRAMClockChangeLatencyMarginC = ActiveDRAMClockChangeLatencyMarginC
-                                               - (1 - 1.0 / NumberOfActivePlanes) * SwathHeightC[k] * HTotal[k] / PixelClock[k] / VRatioChroma[k];
+                                               - (1 - 1.0 / v->NumberOfActivePlanes) * SwathHeightC[k] * v->HTotal[k] / v->PixelClock[k] / v->VRatioChroma[k];
                        }
                        v->ActiveDRAMClockChangeLatencyMargin[k] = dml_min(ActiveDRAMClockChangeLatencyMarginY, ActiveDRAMClockChangeLatencyMarginC);
                } else {
                        v->ActiveDRAMClockChangeLatencyMargin[k] = ActiveDRAMClockChangeLatencyMarginY;
                }
 
-               if (WritebackEnable[k] == true) {
-                       WritebackDRAMClockChangeLatencyHiding = WritebackInterfaceBufferSize * 1024
-                                       / (WritebackDestinationWidth[k] * WritebackDestinationHeight[k] / (WritebackSourceHeight[k] * HTotal[k] / PixelClock[k]) * 4);
-                       if (WritebackPixelFormat[k] == dm_444_64) {
+               if (v->WritebackEnable[k] == true) {
+                       WritebackDRAMClockChangeLatencyHiding = v->WritebackInterfaceBufferSize * 1024
+                                       / (v->WritebackDestinationWidth[k] * v->WritebackDestinationHeight[k] / (v->WritebackSourceHeight[k] * v->HTotal[k] / v->PixelClock[k]) * 4);
+                       if (v->WritebackPixelFormat[k] == dm_444_64) {
                                WritebackDRAMClockChangeLatencyHiding = WritebackDRAMClockChangeLatencyHiding / 2;
                        }
                        WritebackDRAMClockChangeLatencyMargin = WritebackDRAMClockChangeLatencyHiding - v->WritebackDRAMClockChangeWatermark;
@@ -5864,14 +5640,14 @@ static void CalculateWatermarksAndDRAMSpeedChangeSupport(
 
        v->MinActiveDRAMClockChangeMargin = 999999;
        PlaneWithMinActiveDRAMClockChangeMargin = 0;
-       for (k = 0; k < NumberOfActivePlanes; ++k) {
+       for (k = 0; k < v->NumberOfActivePlanes; ++k) {
                if (v->ActiveDRAMClockChangeLatencyMargin[k] < v->MinActiveDRAMClockChangeMargin) {
                        v->MinActiveDRAMClockChangeMargin = v->ActiveDRAMClockChangeLatencyMargin[k];
-                       if (BlendingAndTiming[k] == k) {
+                       if (v->BlendingAndTiming[k] == k) {
                                PlaneWithMinActiveDRAMClockChangeMargin = k;
                        } else {
-                               for (j = 0; j < NumberOfActivePlanes; ++j) {
-                                       if (BlendingAndTiming[k] == j) {
+                               for (j = 0; j < v->NumberOfActivePlanes; ++j) {
+                                       if (v->BlendingAndTiming[k] == j) {
                                                PlaneWithMinActiveDRAMClockChangeMargin = j;
                                        }
                                }
@@ -5879,11 +5655,11 @@ static void CalculateWatermarksAndDRAMSpeedChangeSupport(
                }
        }
 
-       *MinActiveDRAMClockChangeLatencySupported = v->MinActiveDRAMClockChangeMargin + DRAMClockChangeLatency;
+       v->MinActiveDRAMClockChangeLatencySupported = v->MinActiveDRAMClockChangeMargin + v->DRAMClockChangeLatency ;
 
        SecondMinActiveDRAMClockChangeMarginOneDisplayInVBLank = 999999;
-       for (k = 0; k < NumberOfActivePlanes; ++k) {
-               if (!((k == PlaneWithMinActiveDRAMClockChangeMargin) && (BlendingAndTiming[k] == k)) && !(BlendingAndTiming[k] == PlaneWithMinActiveDRAMClockChangeMargin)
+       for (k = 0; k < v->NumberOfActivePlanes; ++k) {
+               if (!((k == PlaneWithMinActiveDRAMClockChangeMargin) && (v->BlendingAndTiming[k] == k)) && !(v->BlendingAndTiming[k] == PlaneWithMinActiveDRAMClockChangeMargin)
                                && v->ActiveDRAMClockChangeLatencyMargin[k] < SecondMinActiveDRAMClockChangeMarginOneDisplayInVBLank) {
                        SecondMinActiveDRAMClockChangeMarginOneDisplayInVBLank = v->ActiveDRAMClockChangeLatencyMargin[k];
                }
@@ -5891,25 +5667,25 @@ static void CalculateWatermarksAndDRAMSpeedChangeSupport(
 
        v->TotalNumberOfActiveOTG = 0;
 
-       for (k = 0; k < NumberOfActivePlanes; ++k) {
-               if (BlendingAndTiming[k] == k) {
+       for (k = 0; k < v->NumberOfActivePlanes; ++k) {
+               if (v->BlendingAndTiming[k] == k) {
                        v->TotalNumberOfActiveOTG = v->TotalNumberOfActiveOTG + 1;
                }
        }
 
        if (v->MinActiveDRAMClockChangeMargin > 0 && PrefetchMode == 0) {
                *DRAMClockChangeSupport = dm_dram_clock_change_vactive;
-       } else if ((SynchronizedVBlank == true || v->TotalNumberOfActiveOTG == 1
+       } else if ((v->SynchronizedVBlank == true || v->TotalNumberOfActiveOTG == 1
                        || SecondMinActiveDRAMClockChangeMarginOneDisplayInVBLank > 0) && PrefetchMode == 0) {
                *DRAMClockChangeSupport = dm_dram_clock_change_vblank;
        } else {
                *DRAMClockChangeSupport = dm_dram_clock_change_unsupported;
        }
 
-       *StutterExitWatermark = SRExitTime + ExtraLatency + 10 / DCFCLKDeepSleep;
-       *StutterEnterPlusExitWatermark = (SREnterPlusExitTime + ExtraLatency + 10 / DCFCLKDeepSleep);
-       *Z8StutterExitWatermark = SRExitZ8Time + ExtraLatency + 10 / DCFCLKDeepSleep;
-       *Z8StutterEnterPlusExitWatermark = SREnterPlusExitZ8Time + ExtraLatency + 10 / DCFCLKDeepSleep;
+       *StutterExitWatermark = v->SRExitTime + ExtraLatency + 10 / DCFCLKDeepSleep;
+       *StutterEnterPlusExitWatermark = (v->SREnterPlusExitTime + ExtraLatency + 10 / DCFCLKDeepSleep);
+       *Z8StutterExitWatermark = v->SRExitZ8Time + ExtraLatency + 10 / DCFCLKDeepSleep;
+       *Z8StutterEnterPlusExitWatermark = v->SREnterPlusExitZ8Time + ExtraLatency + 10 / DCFCLKDeepSleep;
 
 #ifdef __DML_VBA_DEBUG__
        dml_print("DML::%s: StutterExitWatermark = %f\n", __func__, *StutterExitWatermark);
@@ -7157,12 +6933,13 @@ static double CalculateExtraLatencyBytes(
                        HostVMDynamicLevels = dml_max(0, (int) HostVMMaxNonCachedPageTableLevels - 1);
                else
                        HostVMDynamicLevels = dml_max(0, (int) HostVMMaxNonCachedPageTableLevels - 2);
-       else
+       } else {
                HostVMDynamicLevels = 0;
+       }
 
        ret = ReorderingBytes + (TotalNumberOfActiveDPP * PixelChunkSizeInKByte + TotalNumberOfDCCActiveDPP * MetaChunkSize) * 1024.0;
 
-       if (GPUVMEnable == true)
+       if (GPUVMEnable == true) {
                for (k = 0; k < NumberOfActivePlanes; ++k)
                        ret = ret + NumberOfDPP[k] * dpte_group_bytes[k] * (1 + 8 * HostVMDynamicLevels) * HostVMInefficiencyFactor;
        }
index 8e4c9d0887ceb90d0a5578dae8f72bbcbb4799a5..f43686997917f2868594ae269b20fd588c7d973f 100644 (file)
@@ -243,6 +243,50 @@ void dcn32_build_wm_range_table_fpu(struct clk_mgr_internal *clk_mgr)
        clk_mgr->base.bw_params->wm_table.nv_entries[WM_D].pmfw_breakdown.max_uclk = 0xFFFF;
 }
 
+/**
+ * Finds dummy_latency_index when MCLK switching using firmware based
+ * vblank stretch is enabled. This function will iterate through the
+ * table of dummy pstate latencies until the lowest value that allows
+ * dm_allow_self_refresh_and_mclk_switch to happen is found
+ */
+int dcn32_find_dummy_latency_index_for_fw_based_mclk_switch(struct dc *dc,
+                                                           struct dc_state *context,
+                                                           display_e2e_pipe_params_st *pipes,
+                                                           int pipe_cnt,
+                                                           int vlevel)
+{
+       const int max_latency_table_entries = 4;
+       const struct vba_vars_st *vba = &context->bw_ctx.dml.vba;
+       int dummy_latency_index = 0;
+
+       dc_assert_fp_enabled();
+
+       while (dummy_latency_index < max_latency_table_entries) {
+               context->bw_ctx.dml.soc.dram_clock_change_latency_us =
+                               dc->clk_mgr->bw_params->dummy_pstate_table[dummy_latency_index].dummy_pstate_latency_us;
+               dcn32_internal_validate_bw(dc, context, pipes, &pipe_cnt, &vlevel, false);
+
+               if (vlevel < context->bw_ctx.dml.vba.soc.num_states &&
+                               vba->DRAMClockChangeSupport[vlevel][vba->maxMpcComb] != dm_dram_clock_change_unsupported)
+                       break;
+
+               dummy_latency_index++;
+       }
+
+       if (dummy_latency_index == max_latency_table_entries) {
+               ASSERT(dummy_latency_index != max_latency_table_entries);
+               /* If the execution gets here, it means dummy p_states are
+                * not possible. This should never happen and would mean
+                * something is severely wrong.
+                * Here we reset dummy_latency_index to 3, because it is
+                * better to have underflows than system crashes.
+                */
+               dummy_latency_index = max_latency_table_entries - 1;
+       }
+
+       return dummy_latency_index;
+}
+
 /**
  * dcn32_helper_populate_phantom_dlg_params - Get DLG params for phantom pipes
  * and populate pipe_ctx with those params.
@@ -1646,7 +1690,7 @@ void dcn32_calculate_wm_and_dlg_fpu(struct dc *dc, struct dc_state *context,
                        dcn30_can_support_mclk_switch_using_fw_based_vblank_stretch(dc, context);
 
                if (context->bw_ctx.bw.dcn.clk.fw_based_mclk_switching) {
-                       dummy_latency_index = dcn30_find_dummy_latency_index_for_fw_based_mclk_switch(dc,
+                       dummy_latency_index = dcn32_find_dummy_latency_index_for_fw_based_mclk_switch(dc,
                                context, pipes, pipe_cnt, vlevel);
 
                        /* After calling dcn30_find_dummy_latency_index_for_fw_based_mclk_switch
index 3ed06ab855beddeedb02b1ab4c8a460d3581338a..6ce2210989796cb3f85c0eb93f8360a7766e14be 100644 (file)
@@ -71,4 +71,10 @@ void dcn32_calculate_wm_and_dlg_fpu(struct dc *dc, struct dc_state *context,
 
 void dcn32_update_bw_bounding_box_fpu(struct dc *dc, struct clk_bw_params *bw_params);
 
+int dcn32_find_dummy_latency_index_for_fw_based_mclk_switch(struct dc *dc,
+                                                           struct dc_state *context,
+                                                           display_e2e_pipe_params_st *pipes,
+                                                           int pipe_cnt,
+                                                           int vlevel);
+
 #endif
index cb2025771646b916d6d0d23224889e6d9d3921a2..6980f698eb23aac36cce0b34278fce22157a4e6d 100644 (file)
@@ -755,30 +755,18 @@ static void DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerforman
                        v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.myPipe.BytePerPixelY = v->BytePerPixelY[k];
                        v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.myPipe.BytePerPixelC = v->BytePerPixelC[k];
                        v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.myPipe.ProgressiveToInterlaceUnitInOPP = mode_lib->vba.ProgressiveToInterlaceUnitInOPP;
-                       v->ErrorResult[k] = dml32_CalculatePrefetchSchedule(v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.HostVMInefficiencyFactor,
-                                       &v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.myPipe, v->DSCDelay[k],
-                                       mode_lib->vba.DPPCLKDelaySubtotal + mode_lib->vba.DPPCLKDelayCNVCFormater,
-                                       mode_lib->vba.DPPCLKDelaySCL,
-                                       mode_lib->vba.DPPCLKDelaySCLLBOnly,
-                                       mode_lib->vba.DPPCLKDelayCNVCCursor,
-                                       mode_lib->vba.DISPCLKDelaySubtotal,
-                                       (unsigned int) (v->SwathWidthY[k] / mode_lib->vba.HRatio[k]),
-                                       mode_lib->vba.OutputFormat[k],
-                                       mode_lib->vba.MaxInterDCNTileRepeaters,
+                       v->ErrorResult[k] = dml32_CalculatePrefetchSchedule(
+                                       v,
+                                       k,
+                                       v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.HostVMInefficiencyFactor,
+                                       &v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.myPipe,
+                                       v->DSCDelay[k],
+                                       (unsigned int) (v->SwathWidthY[k] / v->HRatio[k]),
                                        dml_min(v->VStartupLines, v->MaxVStartupLines[k]),
                                        v->MaxVStartupLines[k],
-                                       mode_lib->vba.GPUVMMaxPageTableLevels,
-                                       mode_lib->vba.GPUVMEnable,
-                                       mode_lib->vba.HostVMEnable,
-                                       mode_lib->vba.HostVMMaxNonCachedPageTableLevels,
-                                       mode_lib->vba.HostVMMinPageSize,
-                                       mode_lib->vba.DynamicMetadataEnable[k],
-                                       mode_lib->vba.DynamicMetadataVMEnabled,
-                                       mode_lib->vba.DynamicMetadataLinesBeforeActiveRequired[k],
-                                       mode_lib->vba.DynamicMetadataTransmittedBytes[k],
                                        v->UrgentLatency,
                                        v->UrgentExtraLatency,
-                                       mode_lib->vba.TCalc,
+                                       v->TCalc,
                                        v->PDEAndMetaPTEBytesFrame[k],
                                        v->MetaRowByte[k],
                                        v->PixelPTEBytesPerRow[k],
@@ -792,8 +780,8 @@ static void DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerforman
                                        v->MaxNumSwathC[k],
                                        v->swath_width_luma_ub[k],
                                        v->swath_width_chroma_ub[k],
-                                       mode_lib->vba.SwathHeightY[k],
-                                       mode_lib->vba.SwathHeightC[k],
+                                       v->SwathHeightY[k],
+                                       v->SwathHeightC[k],
                                        TWait,
                                        /* Output */
                                        &v->DSTXAfterScaler[k],
@@ -1163,58 +1151,28 @@ static void DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerforman
                v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.mmSOCParameters.SMNLatency = mode_lib->vba.SMNLatency;
 
                dml32_CalculateWatermarksMALLUseAndDRAMSpeedChangeSupport(
-                       mode_lib->vba.USRRetrainingRequiredFinal,
-                       mode_lib->vba.UsesMALLForPStateChange,
-                       mode_lib->vba.PrefetchModePerState[mode_lib->vba.VoltageLevel][mode_lib->vba.maxMpcComb],
-                       mode_lib->vba.NumberOfActiveSurfaces,
-                       mode_lib->vba.MaxLineBufferLines,
-                       mode_lib->vba.LineBufferSizeFinal,
-                       mode_lib->vba.WritebackInterfaceBufferSize,
-                       mode_lib->vba.DCFCLK,
-                       mode_lib->vba.ReturnBW,
-                       mode_lib->vba.SynchronizeTimingsFinal,
-                       mode_lib->vba.SynchronizeDRRDisplaysForUCLKPStateChangeFinal,
-                       mode_lib->vba.DRRDisplay,
-                       v->dpte_group_bytes,
-                       v->meta_row_height,
-                       v->meta_row_height_chroma,
+                       v,
+                       v->PrefetchModePerState[v->VoltageLevel][v->maxMpcComb],
+                       v->DCFCLK,
+                       v->ReturnBW,
                        v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.mmSOCParameters,
-                       mode_lib->vba.WritebackChunkSize,
-                       mode_lib->vba.SOCCLK,
+                       v->SOCCLK,
                        v->DCFCLKDeepSleep,
-                       mode_lib->vba.DETBufferSizeY,
-                       mode_lib->vba.DETBufferSizeC,
-                       mode_lib->vba.SwathHeightY,
-                       mode_lib->vba.SwathHeightC,
-                       mode_lib->vba.LBBitPerPixel,
+                       v->DETBufferSizeY,
+                       v->DETBufferSizeC,
+                       v->SwathHeightY,
+                       v->SwathHeightC,
                        v->SwathWidthY,
                        v->SwathWidthC,
-                       mode_lib->vba.HRatio,
-                       mode_lib->vba.HRatioChroma,
-                       mode_lib->vba.vtaps,
-                       mode_lib->vba.VTAPsChroma,
-                       mode_lib->vba.VRatio,
-                       mode_lib->vba.VRatioChroma,
-                       mode_lib->vba.HTotal,
-                       mode_lib->vba.VTotal,
-                       mode_lib->vba.VActive,
-                       mode_lib->vba.PixelClock,
-                       mode_lib->vba.BlendingAndTiming,
-                       mode_lib->vba.DPPPerPlane,
+                       v->DPPPerPlane,
                        v->BytePerPixelDETY,
                        v->BytePerPixelDETC,
                        v->DSTXAfterScaler,
                        v->DSTYAfterScaler,
-                       mode_lib->vba.WritebackEnable,
-                       mode_lib->vba.WritebackPixelFormat,
-                       mode_lib->vba.WritebackDestinationWidth,
-                       mode_lib->vba.WritebackDestinationHeight,
-                       mode_lib->vba.WritebackSourceHeight,
                        v->UnboundedRequestEnabled,
                        v->CompressedBufferSizeInkByte,
 
                        /* Output */
-                       &v->Watermark,
                        &v->dummy_vars.DISPCLKDPPCLKDCFCLKDeepSleepPrefetchParametersWatermarksAndPerformanceCalculation.dummy_dramchange_support,
                        v->MaxActiveDRAMClockChangeLatencySupported,
                        v->SubViewportLinesNeededInMALL,
@@ -1806,10 +1764,10 @@ void dml32_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l
                                &mode_lib->vba.Read256BlockHeightC[k],
                                &mode_lib->vba.Read256BlockWidthY[k],
                                &mode_lib->vba.Read256BlockWidthC[k],
-                               &mode_lib->vba.MicroTileHeightY[k],
-                               &mode_lib->vba.MicroTileHeightC[k],
-                               &mode_lib->vba.MicroTileWidthY[k],
-                               &mode_lib->vba.MicroTileWidthC[k]);
+                               &mode_lib->vba.MacroTileHeightY[k],
+                               &mode_lib->vba.MacroTileHeightC[k],
+                               &mode_lib->vba.MacroTileWidthY[k],
+                               &mode_lib->vba.MacroTileWidthC[k]);
        }
 
        /*Bandwidth Support Check*/
@@ -2034,6 +1992,7 @@ void dml32_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l
                                dml32_CalculateODMMode(
                                                mode_lib->vba.MaximumPixelsPerLinePerDSCUnit,
                                                mode_lib->vba.HActive[k],
+                                               mode_lib->vba.OutputFormat[k],
                                                mode_lib->vba.Output[k],
                                                mode_lib->vba.ODMUse[k],
                                                mode_lib->vba.MaxDispclk[i],
@@ -2055,6 +2014,7 @@ void dml32_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l
                                dml32_CalculateODMMode(
                                                mode_lib->vba.MaximumPixelsPerLinePerDSCUnit,
                                                mode_lib->vba.HActive[k],
+                                               mode_lib->vba.OutputFormat[k],
                                                mode_lib->vba.Output[k],
                                                mode_lib->vba.ODMUse[k],
                                                mode_lib->vba.MaxDispclk[i],
@@ -2659,10 +2619,10 @@ void dml32_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l
                        mode_lib->vba.Read256BlockWidthC,
                        mode_lib->vba.Read256BlockHeightY,
                        mode_lib->vba.Read256BlockHeightC,
-                       mode_lib->vba.MicroTileWidthY,
-                       mode_lib->vba.MicroTileWidthC,
-                       mode_lib->vba.MicroTileHeightY,
-                       mode_lib->vba.MicroTileHeightC,
+                       mode_lib->vba.MacroTileWidthY,
+                       mode_lib->vba.MacroTileWidthC,
+                       mode_lib->vba.MacroTileHeightY,
+                       mode_lib->vba.MacroTileHeightC,
 
                        /* Output */
                        mode_lib->vba.SurfaceSizeInMALL,
@@ -2709,10 +2669,10 @@ void dml32_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l
                                v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].BlockHeight256BytesY = mode_lib->vba.Read256BlockHeightY[k];
                                v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].BlockWidth256BytesC = mode_lib->vba.Read256BlockWidthC[k];
                                v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].BlockHeight256BytesC = mode_lib->vba.Read256BlockHeightC[k];
-                               v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].BlockWidthY = mode_lib->vba.MicroTileWidthY[k];
-                               v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].BlockHeightY = mode_lib->vba.MicroTileHeightY[k];
-                               v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].BlockWidthC = mode_lib->vba.MicroTileWidthC[k];
-                               v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].BlockHeightC = mode_lib->vba.MicroTileHeightC[k];
+                               v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].BlockWidthY = mode_lib->vba.MacroTileWidthY[k];
+                               v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].BlockHeightY = mode_lib->vba.MacroTileHeightY[k];
+                               v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].BlockWidthC = mode_lib->vba.MacroTileWidthC[k];
+                               v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].BlockHeightC = mode_lib->vba.MacroTileHeightC[k];
                                v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].InterlaceEnable = mode_lib->vba.Interlace[k];
                                v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].HTotal = mode_lib->vba.HTotal[k];
                                v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.SurfParameters[k].DCCEnable = mode_lib->vba.DCCEnable[k];
@@ -3258,63 +3218,47 @@ void dml32_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l
 
                                        mode_lib->vba.NoTimeForPrefetch[i][j][k] =
                                                dml32_CalculatePrefetchSchedule(
+                                                       v,
+                                                       k,
                                                        v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.HostVMInefficiencyFactor,
                                                        &v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.myPipe,
-                                                       mode_lib->vba.DSCDelayPerState[i][k],
-                                                       mode_lib->vba.DPPCLKDelaySubtotal +
-                                                               mode_lib->vba.DPPCLKDelayCNVCFormater,
-                                                       mode_lib->vba.DPPCLKDelaySCL,
-                                                       mode_lib->vba.DPPCLKDelaySCLLBOnly,
-                                                       mode_lib->vba.DPPCLKDelayCNVCCursor,
-                                                       mode_lib->vba.DISPCLKDelaySubtotal,
-                                                       mode_lib->vba.SwathWidthYThisState[k] /
-                                                               mode_lib->vba.HRatio[k],
-                                                       mode_lib->vba.OutputFormat[k],
-                                                       mode_lib->vba.MaxInterDCNTileRepeaters,
-                                                       dml_min(mode_lib->vba.MaxVStartup,
-                                                                       mode_lib->vba.MaximumVStartup[i][j][k]),
-                                                       mode_lib->vba.MaximumVStartup[i][j][k],
-                                                       mode_lib->vba.GPUVMMaxPageTableLevels,
-                                                       mode_lib->vba.GPUVMEnable, mode_lib->vba.HostVMEnable,
-                                                       mode_lib->vba.HostVMMaxNonCachedPageTableLevels,
-                                                       mode_lib->vba.HostVMMinPageSize,
-                                                       mode_lib->vba.DynamicMetadataEnable[k],
-                                                       mode_lib->vba.DynamicMetadataVMEnabled,
-                                                       mode_lib->vba.DynamicMetadataLinesBeforeActiveRequired[k],
-                                                       mode_lib->vba.DynamicMetadataTransmittedBytes[k],
-                                                       mode_lib->vba.UrgLatency[i],
-                                                       mode_lib->vba.ExtraLatency,
-                                                       mode_lib->vba.TimeCalc,
-                                                       mode_lib->vba.PDEAndMetaPTEBytesPerFrame[i][j][k],
-                                                       mode_lib->vba.MetaRowBytes[i][j][k],
-                                                       mode_lib->vba.DPTEBytesPerRow[i][j][k],
-                                                       mode_lib->vba.PrefetchLinesY[i][j][k],
-                                                       mode_lib->vba.SwathWidthYThisState[k],
-                                                       mode_lib->vba.PrefillY[k],
-                                                       mode_lib->vba.MaxNumSwY[k],
-                                                       mode_lib->vba.PrefetchLinesC[i][j][k],
-                                                       mode_lib->vba.SwathWidthCThisState[k],
-                                                       mode_lib->vba.PrefillC[k],
-                                                       mode_lib->vba.MaxNumSwC[k],
-                                                       mode_lib->vba.swath_width_luma_ub_this_state[k],
-                                                       mode_lib->vba.swath_width_chroma_ub_this_state[k],
-                                                       mode_lib->vba.SwathHeightYThisState[k],
-                                                       mode_lib->vba.SwathHeightCThisState[k], mode_lib->vba.TWait,
+                                                       v->DSCDelayPerState[i][k],
+                                                       v->SwathWidthYThisState[k] / v->HRatio[k],
+                                                       dml_min(v->MaxVStartup, v->MaximumVStartup[i][j][k]),
+                                                       v->MaximumVStartup[i][j][k],
+                                                       v->UrgLatency[i],
+                                                       v->ExtraLatency,
+                                                       v->TimeCalc,
+                                                       v->PDEAndMetaPTEBytesPerFrame[i][j][k],
+                                                       v->MetaRowBytes[i][j][k],
+                                                       v->DPTEBytesPerRow[i][j][k],
+                                                       v->PrefetchLinesY[i][j][k],
+                                                       v->SwathWidthYThisState[k],
+                                                       v->PrefillY[k],
+                                                       v->MaxNumSwY[k],
+                                                       v->PrefetchLinesC[i][j][k],
+                                                       v->SwathWidthCThisState[k],
+                                                       v->PrefillC[k],
+                                                       v->MaxNumSwC[k],
+                                                       v->swath_width_luma_ub_this_state[k],
+                                                       v->swath_width_chroma_ub_this_state[k],
+                                                       v->SwathHeightYThisState[k],
+                                                       v->SwathHeightCThisState[k], v->TWait,
 
                                                        /* Output */
                                                        &v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.DSTXAfterScaler[k],
                                                        &v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.DSTYAfterScaler[k],
-                                                       &mode_lib->vba.LineTimesForPrefetch[k],
-                                                       &mode_lib->vba.PrefetchBW[k],
-                                                       &mode_lib->vba.LinesForMetaPTE[k],
-                                                       &mode_lib->vba.LinesForMetaAndDPTERow[k],
-                                                       &mode_lib->vba.VRatioPreY[i][j][k],
-                                                       &mode_lib->vba.VRatioPreC[i][j][k],
-                                                       &mode_lib->vba.RequiredPrefetchPixelDataBWLuma[0][0][k],
-                                                       &mode_lib->vba.RequiredPrefetchPixelDataBWChroma[0][0][k],
-                                                       &mode_lib->vba.NoTimeForDynamicMetadata[i][j][k],
-                                                       &mode_lib->vba.Tno_bw[k],
-                                                       &mode_lib->vba.prefetch_vmrow_bw[k],
+                                                       &v->LineTimesForPrefetch[k],
+                                                       &v->PrefetchBW[k],
+                                                       &v->LinesForMetaPTE[k],
+                                                       &v->LinesForMetaAndDPTERow[k],
+                                                       &v->VRatioPreY[i][j][k],
+                                                       &v->VRatioPreC[i][j][k],
+                                                       &v->RequiredPrefetchPixelDataBWLuma[0][0][k],
+                                                       &v->RequiredPrefetchPixelDataBWChroma[0][0][k],
+                                                       &v->NoTimeForDynamicMetadata[i][j][k],
+                                                       &v->Tno_bw[k],
+                                                       &v->prefetch_vmrow_bw[k],
                                                        &v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.dummy_single[0],         // double *Tdmdl_vm
                                                        &v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.dummy_single[1],         // double *Tdmdl
                                                        &v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.dummy_single[2],         // double *TSetup
@@ -3557,62 +3501,32 @@ void dml32_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l
 
                        {
                                dml32_CalculateWatermarksMALLUseAndDRAMSpeedChangeSupport(
-                                               mode_lib->vba.USRRetrainingRequiredFinal,
-                                               mode_lib->vba.UsesMALLForPStateChange,
-                                               mode_lib->vba.PrefetchModePerState[i][j],
-                                               mode_lib->vba.NumberOfActiveSurfaces,
-                                               mode_lib->vba.MaxLineBufferLines,
-                                               mode_lib->vba.LineBufferSizeFinal,
-                                               mode_lib->vba.WritebackInterfaceBufferSize,
-                                               mode_lib->vba.DCFCLKState[i][j],
-                                               mode_lib->vba.ReturnBWPerState[i][j],
-                                               mode_lib->vba.SynchronizeTimingsFinal,
-                                               mode_lib->vba.SynchronizeDRRDisplaysForUCLKPStateChangeFinal,
-                                               mode_lib->vba.DRRDisplay,
-                                               mode_lib->vba.dpte_group_bytes,
-                                               mode_lib->vba.meta_row_height,
-                                               mode_lib->vba.meta_row_height_chroma,
+                                               v,
+                                               v->PrefetchModePerState[i][j],
+                                               v->DCFCLKState[i][j],
+                                               v->ReturnBWPerState[i][j],
                                                v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.mSOCParameters,
-                                               mode_lib->vba.WritebackChunkSize,
-                                               mode_lib->vba.SOCCLKPerState[i],
-                                               mode_lib->vba.ProjectedDCFCLKDeepSleep[i][j],
-                                               mode_lib->vba.DETBufferSizeYThisState,
-                                               mode_lib->vba.DETBufferSizeCThisState,
-                                               mode_lib->vba.SwathHeightYThisState,
-                                               mode_lib->vba.SwathHeightCThisState,
-                                               mode_lib->vba.LBBitPerPixel,
-                                               mode_lib->vba.SwathWidthYThisState, // 24
-                                               mode_lib->vba.SwathWidthCThisState,
-                                               mode_lib->vba.HRatio,
-                                               mode_lib->vba.HRatioChroma,
-                                               mode_lib->vba.vtaps,
-                                               mode_lib->vba.VTAPsChroma,
-                                               mode_lib->vba.VRatio,
-                                               mode_lib->vba.VRatioChroma,
-                                               mode_lib->vba.HTotal,
-                                               mode_lib->vba.VTotal,
-                                               mode_lib->vba.VActive,
-                                               mode_lib->vba.PixelClock,
-                                               mode_lib->vba.BlendingAndTiming,
-                                               mode_lib->vba.NoOfDPPThisState,
-                                               mode_lib->vba.BytePerPixelInDETY,
-                                               mode_lib->vba.BytePerPixelInDETC,
+                                               v->SOCCLKPerState[i],
+                                               v->ProjectedDCFCLKDeepSleep[i][j],
+                                               v->DETBufferSizeYThisState,
+                                               v->DETBufferSizeCThisState,
+                                               v->SwathHeightYThisState,
+                                               v->SwathHeightCThisState,
+                                               v->SwathWidthYThisState, // 24
+                                               v->SwathWidthCThisState,
+                                               v->NoOfDPPThisState,
+                                               v->BytePerPixelInDETY,
+                                               v->BytePerPixelInDETC,
                                                v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.DSTXAfterScaler,
                                                v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.DSTYAfterScaler,
-                                               mode_lib->vba.WritebackEnable,
-                                               mode_lib->vba.WritebackPixelFormat,
-                                               mode_lib->vba.WritebackDestinationWidth,
-                                               mode_lib->vba.WritebackDestinationHeight,
-                                               mode_lib->vba.WritebackSourceHeight,
-                                               mode_lib->vba.UnboundedRequestEnabledThisState,
-                                               mode_lib->vba.CompressedBufferSizeInkByteThisState,
+                                               v->UnboundedRequestEnabledThisState,
+                                               v->CompressedBufferSizeInkByteThisState,
 
                                                /* Output */
-                                               &mode_lib->vba.Watermark, // Store the values in vba
-                                               &mode_lib->vba.DRAMClockChangeSupport[i][j],
+                                               &v->DRAMClockChangeSupport[i][j],
                                                &v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.dummy_single2[0], // double *MaxActiveDRAMClockChangeLatencySupported
                                                &v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.dummy_integer[0], // Long SubViewportLinesNeededInMALL[]
-                                               &mode_lib->vba.FCLKChangeSupport[i][j],
+                                               &v->FCLKChangeSupport[i][j],
                                                &v->dummy_vars.dml32_ModeSupportAndSystemConfigurationFull.dummy_single2[1], // double *MinActiveFCLKChangeLatencySupported
                                                &mode_lib->vba.USRRetrainingSupport[i][j],
                                                mode_lib->vba.ActiveDRAMClockChangeLatencyMargin);
index 05fc14a47fba91b86cc5579c823da689bc719a59..365d290bba99eb8e0fd13167143932677201c783 100644 (file)
@@ -27,6 +27,8 @@
 #include "display_mode_vba_32.h"
 #include "../display_mode_lib.h"
 
+#define DCN32_MAX_FMT_420_BUFFER_WIDTH 4096
+
 unsigned int dml32_dscceComputeDelay(
                unsigned int bpc,
                double BPP,
@@ -1182,6 +1184,7 @@ void dml32_CalculateDETBufferSize(
 void dml32_CalculateODMMode(
                unsigned int MaximumPixelsPerLinePerDSCUnit,
                unsigned int HActive,
+               enum output_format_class OutFormat,
                enum output_encoder_class Output,
                enum odm_combine_policy ODMUse,
                double StateDispclk,
@@ -1253,6 +1256,29 @@ void dml32_CalculateODMMode(
                else
                        *TotalAvailablePipesSupport = false;
        }
+       if (OutFormat == dm_420 && HActive > DCN32_MAX_FMT_420_BUFFER_WIDTH &&
+                       ODMUse != dm_odm_combine_policy_4to1) {
+               if (HActive > DCN32_MAX_FMT_420_BUFFER_WIDTH * 4) {
+                       *ODMMode = dm_odm_combine_mode_disabled;
+                       *NumberOfDPP = 0;
+                       *TotalAvailablePipesSupport = false;
+               } else if (HActive > DCN32_MAX_FMT_420_BUFFER_WIDTH * 2 ||
+                               *ODMMode == dm_odm_combine_mode_4to1) {
+                       *ODMMode = dm_odm_combine_mode_4to1;
+                       *RequiredDISPCLKPerSurface = SurfaceRequiredDISPCLKWithODMCombineFourToOne;
+                       *NumberOfDPP = 4;
+               } else {
+                       *ODMMode = dm_odm_combine_mode_2to1;
+                       *RequiredDISPCLKPerSurface = SurfaceRequiredDISPCLKWithODMCombineTwoToOne;
+                       *NumberOfDPP = 2;
+               }
+       }
+       if (Output == dm_hdmi && OutFormat == dm_420 &&
+                       HActive > DCN32_MAX_FMT_420_BUFFER_WIDTH) {
+               *ODMMode = dm_odm_combine_mode_disabled;
+               *NumberOfDPP = 0;
+               *TotalAvailablePipesSupport = false;
+       }
 }
 
 double dml32_CalculateRequiredDispclk(
@@ -3363,28 +3389,14 @@ double dml32_CalculateExtraLatency(
 } // CalculateExtraLatency
 
 bool dml32_CalculatePrefetchSchedule(
+               struct vba_vars_st *v,
+               unsigned int k,
                double HostVMInefficiencyFactor,
                DmlPipe *myPipe,
                unsigned int DSCDelay,
-               double DPPCLKDelaySubtotalPlusCNVCFormater,
-               double DPPCLKDelaySCL,
-               double DPPCLKDelaySCLLBOnly,
-               double DPPCLKDelayCNVCCursor,
-               double DISPCLKDelaySubtotal,
                unsigned int DPP_RECOUT_WIDTH,
-               enum output_format_class OutputFormat,
-               unsigned int MaxInterDCNTileRepeaters,
                unsigned int VStartup,
                unsigned int MaxVStartup,
-               unsigned int GPUVMPageTableLevels,
-               bool GPUVMEnable,
-               bool HostVMEnable,
-               unsigned int HostVMMaxNonCachedPageTableLevels,
-               double HostVMMinPageSize,
-               bool DynamicMetadataEnable,
-               bool DynamicMetadataVMEnabled,
-               int DynamicMetadataLinesBeforeActiveRequired,
-               unsigned int DynamicMetadataTransmittedBytes,
                double UrgentLatency,
                double UrgentExtraLatency,
                double TCalc,
@@ -3425,6 +3437,7 @@ bool dml32_CalculatePrefetchSchedule(
                double   *VUpdateWidthPix,
                double   *VReadyOffsetPix)
 {
+       double DPPCLKDelaySubtotalPlusCNVCFormater = v->DPPCLKDelaySubtotal + v->DPPCLKDelayCNVCFormater;
        bool MyError = false;
        unsigned int DPPCycles, DISPCLKCycles;
        double DSTTotalPixelsAfterScaler;
@@ -3461,27 +3474,27 @@ bool dml32_CalculatePrefetchSchedule(
        double  Tsw_est1 = 0;
        double  Tsw_est3 = 0;
 
-       if (GPUVMEnable == true && HostVMEnable == true)
-               HostVMDynamicLevelsTrips = HostVMMaxNonCachedPageTableLevels;
+       if (v->GPUVMEnable == true && v->HostVMEnable == true)
+               HostVMDynamicLevelsTrips = v->HostVMMaxNonCachedPageTableLevels;
        else
                HostVMDynamicLevelsTrips = 0;
 #ifdef __DML_VBA_DEBUG__
-       dml_print("DML::%s: GPUVMEnable = %d\n", __func__, GPUVMEnable);
-       dml_print("DML::%s: GPUVMPageTableLevels = %d\n", __func__, GPUVMPageTableLevels);
+       dml_print("DML::%s: v->GPUVMEnable = %d\n", __func__, v->GPUVMEnable);
+       dml_print("DML::%s: v->GPUVMMaxPageTableLevels = %d\n", __func__, v->GPUVMMaxPageTableLevels);
        dml_print("DML::%s: DCCEnable = %d\n", __func__, myPipe->DCCEnable);
-       dml_print("DML::%s: HostVMEnable=%d HostVMInefficiencyFactor=%f\n",
-                       __func__, HostVMEnable, HostVMInefficiencyFactor);
+       dml_print("DML::%s: v->HostVMEnable=%d HostVMInefficiencyFactor=%f\n",
+                       __func__, v->HostVMEnable, HostVMInefficiencyFactor);
 #endif
        dml32_CalculateVUpdateAndDynamicMetadataParameters(
-                       MaxInterDCNTileRepeaters,
+                       v->MaxInterDCNTileRepeaters,
                        myPipe->Dppclk,
                        myPipe->Dispclk,
                        myPipe->DCFClkDeepSleep,
                        myPipe->PixelClock,
                        myPipe->HTotal,
                        myPipe->VBlank,
-                       DynamicMetadataTransmittedBytes,
-                       DynamicMetadataLinesBeforeActiveRequired,
+                       v->DynamicMetadataTransmittedBytes[k],
+                       v->DynamicMetadataLinesBeforeActiveRequired[k],
                        myPipe->InterlaceEnable,
                        myPipe->ProgressiveToInterlaceUnitInOPP,
                        TSetup,
@@ -3496,19 +3509,19 @@ bool dml32_CalculatePrefetchSchedule(
 
        LineTime = myPipe->HTotal / myPipe->PixelClock;
        trip_to_mem = UrgentLatency;
-       Tvm_trips = UrgentExtraLatency + trip_to_mem * (GPUVMPageTableLevels * (HostVMDynamicLevelsTrips + 1) - 1);
+       Tvm_trips = UrgentExtraLatency + trip_to_mem * (v->GPUVMMaxPageTableLevels * (HostVMDynamicLevelsTrips + 1) - 1);
 
-       if (DynamicMetadataVMEnabled == true)
+       if (v->DynamicMetadataVMEnabled == true)
                *Tdmdl = TWait + Tvm_trips + trip_to_mem;
        else
                *Tdmdl = TWait + UrgentExtraLatency;
 
 #ifdef __DML_VBA_ALLOW_DELTA__
-       if (DynamicMetadataEnable == false)
+       if (v->DynamicMetadataEnable[k] == false)
                *Tdmdl = 0.0;
 #endif
 
-       if (DynamicMetadataEnable == true) {
+       if (v->DynamicMetadataEnable[k] == true) {
                if (VStartup * LineTime < *TSetup + *Tdmdl + Tdmbf + Tdmec + Tdmsks) {
                        *NotEnoughTimeForDynamicMetadata = true;
 #ifdef __DML_VBA_DEBUG__
@@ -3528,17 +3541,17 @@ bool dml32_CalculatePrefetchSchedule(
                *NotEnoughTimeForDynamicMetadata = false;
        }
 
-       *Tdmdl_vm =  (DynamicMetadataEnable == true && DynamicMetadataVMEnabled == true &&
-                       GPUVMEnable == true ? TWait + Tvm_trips : 0);
+       *Tdmdl_vm =  (v->DynamicMetadataEnable[k] == true && v->DynamicMetadataVMEnabled == true &&
+                       v->GPUVMEnable == true ? TWait + Tvm_trips : 0);
 
        if (myPipe->ScalerEnabled)
-               DPPCycles = DPPCLKDelaySubtotalPlusCNVCFormater + DPPCLKDelaySCL;
+               DPPCycles = DPPCLKDelaySubtotalPlusCNVCFormater + v->DPPCLKDelaySCL;
        else
-               DPPCycles = DPPCLKDelaySubtotalPlusCNVCFormater + DPPCLKDelaySCLLBOnly;
+               DPPCycles = DPPCLKDelaySubtotalPlusCNVCFormater + v->DPPCLKDelaySCLLBOnly;
 
-       DPPCycles = DPPCycles + myPipe->NumberOfCursors * DPPCLKDelayCNVCCursor;
+       DPPCycles = DPPCycles + myPipe->NumberOfCursors * v->DPPCLKDelayCNVCCursor;
 
-       DISPCLKCycles = DISPCLKDelaySubtotal;
+       DISPCLKCycles = v->DISPCLKDelaySubtotal;
 
        if (myPipe->Dppclk == 0.0 || myPipe->Dispclk == 0.0)
                return true;
@@ -3564,7 +3577,7 @@ bool dml32_CalculatePrefetchSchedule(
        dml_print("DML::%s: DSTXAfterScaler: %d\n", __func__,  *DSTXAfterScaler);
 #endif
 
-       if (OutputFormat == dm_420 || (myPipe->InterlaceEnable && myPipe->ProgressiveToInterlaceUnitInOPP))
+       if (v->OutputFormat[k] == dm_420 || (myPipe->InterlaceEnable && myPipe->ProgressiveToInterlaceUnitInOPP))
                *DSTYAfterScaler = 1;
        else
                *DSTYAfterScaler = 0;
@@ -3581,13 +3594,13 @@ bool dml32_CalculatePrefetchSchedule(
 
        Tr0_trips = trip_to_mem * (HostVMDynamicLevelsTrips + 1);
 
-       if (GPUVMEnable == true) {
+       if (v->GPUVMEnable == true) {
                Tvm_trips_rounded = dml_ceil(4.0 * Tvm_trips / LineTime, 1.0) / 4.0 * LineTime;
                Tr0_trips_rounded = dml_ceil(4.0 * Tr0_trips / LineTime, 1.0) / 4.0 * LineTime;
-               if (GPUVMPageTableLevels >= 3) {
+               if (v->GPUVMMaxPageTableLevels >= 3) {
                        *Tno_bw = UrgentExtraLatency + trip_to_mem *
-                                       (double) ((GPUVMPageTableLevels - 2) * (HostVMDynamicLevelsTrips + 1) - 1);
-               } else if (GPUVMPageTableLevels == 1 && myPipe->DCCEnable != true) {
+                                       (double) ((v->GPUVMMaxPageTableLevels - 2) * (HostVMDynamicLevelsTrips + 1) - 1);
+               } else if (v->GPUVMMaxPageTableLevels == 1 && myPipe->DCCEnable != true) {
                        Tr0_trips_rounded = dml_ceil(4.0 * UrgentExtraLatency / LineTime, 1.0) /
                                        4.0 * LineTime; // VBA_ERROR
                        *Tno_bw = UrgentExtraLatency;
@@ -3622,7 +3635,7 @@ bool dml32_CalculatePrefetchSchedule(
        min_Lsw = dml_max(min_Lsw, 1.0);
        Lsw_oto = dml_ceil(4.0 * dml_max(prefetch_sw_bytes / prefetch_bw_oto / LineTime, min_Lsw), 1.0) / 4.0;
 
-       if (GPUVMEnable == true) {
+       if (v->GPUVMEnable == true) {
                Tvm_oto = dml_max3(
                                Tvm_trips,
                                *Tno_bw + PDEAndMetaPTEBytesFrame * HostVMInefficiencyFactor / prefetch_bw_oto,
@@ -3630,7 +3643,7 @@ bool dml32_CalculatePrefetchSchedule(
        } else
                Tvm_oto = LineTime / 4.0;
 
-       if ((GPUVMEnable == true || myPipe->DCCEnable == true)) {
+       if ((v->GPUVMEnable == true || myPipe->DCCEnable == true)) {
                Tr0_oto = dml_max4(
                                Tr0_trips,
                                (MetaRowByte + PixelPTEBytesPerRow * HostVMInefficiencyFactor) / prefetch_bw_oto,
@@ -3833,7 +3846,7 @@ bool dml32_CalculatePrefetchSchedule(
 #endif
 
                        if (prefetch_bw_equ > 0) {
-                               if (GPUVMEnable == true) {
+                               if (v->GPUVMEnable == true) {
                                        Tvm_equ = dml_max3(*Tno_bw + PDEAndMetaPTEBytesFrame *
                                                        HostVMInefficiencyFactor / prefetch_bw_equ,
                                                        Tvm_trips, LineTime / 4);
@@ -3841,7 +3854,7 @@ bool dml32_CalculatePrefetchSchedule(
                                        Tvm_equ = LineTime / 4;
                                }
 
-                               if ((GPUVMEnable == true || myPipe->DCCEnable == true)) {
+                               if ((v->GPUVMEnable == true || myPipe->DCCEnable == true)) {
                                        Tr0_equ = dml_max4((MetaRowByte + PixelPTEBytesPerRow *
                                                        HostVMInefficiencyFactor) / prefetch_bw_equ, Tr0_trips,
                                                        (LineTime - Tvm_equ) / 2, LineTime / 4);
@@ -4206,58 +4219,28 @@ void dml32_CalculateFlipSchedule(
 } // CalculateFlipSchedule
 
 void dml32_CalculateWatermarksMALLUseAndDRAMSpeedChangeSupport(
-               bool USRRetrainingRequiredFinal,
-               enum dm_use_mall_for_pstate_change_mode UseMALLForPStateChange[],
+               struct vba_vars_st *v,
                unsigned int PrefetchMode,
-               unsigned int NumberOfActiveSurfaces,
-               unsigned int MaxLineBufferLines,
-               unsigned int LineBufferSize,
-               unsigned int WritebackInterfaceBufferSize,
                double DCFCLK,
                double ReturnBW,
-               bool SynchronizeTimingsFinal,
-               bool SynchronizeDRRDisplaysForUCLKPStateChangeFinal,
-               bool DRRDisplay[],
-               unsigned int dpte_group_bytes[],
-               unsigned int meta_row_height[],
-               unsigned int meta_row_height_chroma[],
                SOCParametersList mmSOCParameters,
-               unsigned int WritebackChunkSize,
                double SOCCLK,
                double DCFClkDeepSleep,
                unsigned int DETBufferSizeY[],
                unsigned int DETBufferSizeC[],
                unsigned int SwathHeightY[],
                unsigned int SwathHeightC[],
-               unsigned int LBBitPerPixel[],
                double SwathWidthY[],
                double SwathWidthC[],
-               double HRatio[],
-               double HRatioChroma[],
-               unsigned int VTaps[],
-               unsigned int VTapsChroma[],
-               double VRatio[],
-               double VRatioChroma[],
-               unsigned int HTotal[],
-               unsigned int VTotal[],
-               unsigned int VActive[],
-               double PixelClock[],
-               unsigned int BlendingAndTiming[],
                unsigned int DPPPerSurface[],
                double BytePerPixelDETY[],
                double BytePerPixelDETC[],
                double DSTXAfterScaler[],
                double DSTYAfterScaler[],
-               bool WritebackEnable[],
-               enum source_format_class WritebackPixelFormat[],
-               double WritebackDestinationWidth[],
-               double WritebackDestinationHeight[],
-               double WritebackSourceHeight[],
                bool UnboundedRequestEnabled,
                unsigned int CompressedBufferSizeInkByte,
 
                /* Output */
-               Watermarks *Watermark,
                enum clock_change_support *DRAMClockChangeSupport,
                double MaxActiveDRAMClockChangeLatencySupported[],
                unsigned int SubViewportLinesNeededInMALL[],
@@ -4299,136 +4282,136 @@ void dml32_CalculateWatermarksMALLUseAndDRAMSpeedChangeSupport(
        unsigned int LBLatencyHidingSourceLinesY[DC__NUM_DPP__MAX];
        unsigned int LBLatencyHidingSourceLinesC[DC__NUM_DPP__MAX];
 
-       Watermark->UrgentWatermark = mmSOCParameters.UrgentLatency + mmSOCParameters.ExtraLatency;
-       Watermark->USRRetrainingWatermark = mmSOCParameters.UrgentLatency + mmSOCParameters.ExtraLatency
+       v->Watermark.UrgentWatermark = mmSOCParameters.UrgentLatency + mmSOCParameters.ExtraLatency;
+       v->Watermark.USRRetrainingWatermark = mmSOCParameters.UrgentLatency + mmSOCParameters.ExtraLatency
                        + mmSOCParameters.USRRetrainingLatency + mmSOCParameters.SMNLatency;
-       Watermark->DRAMClockChangeWatermark = mmSOCParameters.DRAMClockChangeLatency + Watermark->UrgentWatermark;
-       Watermark->FCLKChangeWatermark = mmSOCParameters.FCLKChangeLatency + Watermark->UrgentWatermark;
-       Watermark->StutterExitWatermark = mmSOCParameters.SRExitTime + mmSOCParameters.ExtraLatency
+       v->Watermark.DRAMClockChangeWatermark = mmSOCParameters.DRAMClockChangeLatency + v->Watermark.UrgentWatermark;
+       v->Watermark.FCLKChangeWatermark = mmSOCParameters.FCLKChangeLatency + v->Watermark.UrgentWatermark;
+       v->Watermark.StutterExitWatermark = mmSOCParameters.SRExitTime + mmSOCParameters.ExtraLatency
                        + 10 / DCFClkDeepSleep;
-       Watermark->StutterEnterPlusExitWatermark = mmSOCParameters.SREnterPlusExitTime + mmSOCParameters.ExtraLatency
+       v->Watermark.StutterEnterPlusExitWatermark = mmSOCParameters.SREnterPlusExitTime + mmSOCParameters.ExtraLatency
                        + 10 / DCFClkDeepSleep;
-       Watermark->Z8StutterExitWatermark = mmSOCParameters.SRExitZ8Time + mmSOCParameters.ExtraLatency
+       v->Watermark.Z8StutterExitWatermark = mmSOCParameters.SRExitZ8Time + mmSOCParameters.ExtraLatency
                        + 10 / DCFClkDeepSleep;
-       Watermark->Z8StutterEnterPlusExitWatermark = mmSOCParameters.SREnterPlusExitZ8Time
+       v->Watermark.Z8StutterEnterPlusExitWatermark = mmSOCParameters.SREnterPlusExitZ8Time
                        + mmSOCParameters.ExtraLatency + 10 / DCFClkDeepSleep;
 
 #ifdef __DML_VBA_DEBUG__
        dml_print("DML::%s: UrgentLatency = %f\n", __func__, mmSOCParameters.UrgentLatency);
        dml_print("DML::%s: ExtraLatency = %f\n", __func__, mmSOCParameters.ExtraLatency);
        dml_print("DML::%s: DRAMClockChangeLatency = %f\n", __func__, mmSOCParameters.DRAMClockChangeLatency);
-       dml_print("DML::%s: UrgentWatermark = %f\n", __func__, Watermark->UrgentWatermark);
-       dml_print("DML::%s: USRRetrainingWatermark = %f\n", __func__, Watermark->USRRetrainingWatermark);
-       dml_print("DML::%s: DRAMClockChangeWatermark = %f\n", __func__, Watermark->DRAMClockChangeWatermark);
-       dml_print("DML::%s: FCLKChangeWatermark = %f\n", __func__, Watermark->FCLKChangeWatermark);
-       dml_print("DML::%s: StutterExitWatermark = %f\n", __func__, Watermark->StutterExitWatermark);
-       dml_print("DML::%s: StutterEnterPlusExitWatermark = %f\n", __func__, Watermark->StutterEnterPlusExitWatermark);
-       dml_print("DML::%s: Z8StutterExitWatermark = %f\n", __func__, Watermark->Z8StutterExitWatermark);
+       dml_print("DML::%s: UrgentWatermark = %f\n", __func__, v->Watermark.UrgentWatermark);
+       dml_print("DML::%s: USRRetrainingWatermark = %f\n", __func__, v->Watermark.USRRetrainingWatermark);
+       dml_print("DML::%s: DRAMClockChangeWatermark = %f\n", __func__, v->Watermark.DRAMClockChangeWatermark);
+       dml_print("DML::%s: FCLKChangeWatermark = %f\n", __func__, v->Watermark.FCLKChangeWatermark);
+       dml_print("DML::%s: StutterExitWatermark = %f\n", __func__, v->Watermark.StutterExitWatermark);
+       dml_print("DML::%s: StutterEnterPlusExitWatermark = %f\n", __func__, v->Watermark.StutterEnterPlusExitWatermark);
+       dml_print("DML::%s: Z8StutterExitWatermark = %f\n", __func__, v->Watermark.Z8StutterExitWatermark);
        dml_print("DML::%s: Z8StutterEnterPlusExitWatermark = %f\n",
-                       __func__, Watermark->Z8StutterEnterPlusExitWatermark);
+                       __func__, v->Watermark.Z8StutterEnterPlusExitWatermark);
 #endif
 
 
        TotalActiveWriteback = 0;
-       for (k = 0; k < NumberOfActiveSurfaces; ++k) {
-               if (WritebackEnable[k] == true)
+       for (k = 0; k < v->NumberOfActiveSurfaces; ++k) {
+               if (v->WritebackEnable[k] == true)
                        TotalActiveWriteback = TotalActiveWriteback + 1;
        }
 
        if (TotalActiveWriteback <= 1) {
-               Watermark->WritebackUrgentWatermark = mmSOCParameters.WritebackLatency;
+               v->Watermark.WritebackUrgentWatermark = mmSOCParameters.WritebackLatency;
        } else {
-               Watermark->WritebackUrgentWatermark = mmSOCParameters.WritebackLatency
-                               + WritebackChunkSize * 1024.0 / 32.0 / SOCCLK;
+               v->Watermark.WritebackUrgentWatermark = mmSOCParameters.WritebackLatency
+                               + v->WritebackChunkSize * 1024.0 / 32.0 / SOCCLK;
        }
-       if (USRRetrainingRequiredFinal)
-               Watermark->WritebackUrgentWatermark = Watermark->WritebackUrgentWatermark
+       if (v->USRRetrainingRequiredFinal)
+               v->Watermark.WritebackUrgentWatermark = v->Watermark.WritebackUrgentWatermark
                                + mmSOCParameters.USRRetrainingLatency;
 
        if (TotalActiveWriteback <= 1) {
-               Watermark->WritebackDRAMClockChangeWatermark = mmSOCParameters.DRAMClockChangeLatency
+               v->Watermark.WritebackDRAMClockChangeWatermark = mmSOCParameters.DRAMClockChangeLatency
                                + mmSOCParameters.WritebackLatency;
-               Watermark->WritebackFCLKChangeWatermark = mmSOCParameters.FCLKChangeLatency
+               v->Watermark.WritebackFCLKChangeWatermark = mmSOCParameters.FCLKChangeLatency
                                + mmSOCParameters.WritebackLatency;
        } else {
-               Watermark->WritebackDRAMClockChangeWatermark = mmSOCParameters.DRAMClockChangeLatency
-                               + mmSOCParameters.WritebackLatency + WritebackChunkSize * 1024.0 / 32.0 / SOCCLK;
-               Watermark->WritebackFCLKChangeWatermark = mmSOCParameters.FCLKChangeLatency
-                               + mmSOCParameters.WritebackLatency + WritebackChunkSize * 1024 / 32 / SOCCLK;
+               v->Watermark.WritebackDRAMClockChangeWatermark = mmSOCParameters.DRAMClockChangeLatency
+                               + mmSOCParameters.WritebackLatency + v->WritebackChunkSize * 1024.0 / 32.0 / SOCCLK;
+               v->Watermark.WritebackFCLKChangeWatermark = mmSOCParameters.FCLKChangeLatency
+                               + mmSOCParameters.WritebackLatency + v->WritebackChunkSize * 1024 / 32 / SOCCLK;
        }
 
-       if (USRRetrainingRequiredFinal)
-               Watermark->WritebackDRAMClockChangeWatermark = Watermark->WritebackDRAMClockChangeWatermark
+       if (v->USRRetrainingRequiredFinal)
+               v->Watermark.WritebackDRAMClockChangeWatermark = v->Watermark.WritebackDRAMClockChangeWatermark
                                + mmSOCParameters.USRRetrainingLatency;
 
-       if (USRRetrainingRequiredFinal)
-               Watermark->WritebackFCLKChangeWatermark = Watermark->WritebackFCLKChangeWatermark
+       if (v->USRRetrainingRequiredFinal)
+               v->Watermark.WritebackFCLKChangeWatermark = v->Watermark.WritebackFCLKChangeWatermark
                                + mmSOCParameters.USRRetrainingLatency;
 
 #ifdef __DML_VBA_DEBUG__
        dml_print("DML::%s: WritebackDRAMClockChangeWatermark = %f\n",
-                       __func__, Watermark->WritebackDRAMClockChangeWatermark);
-       dml_print("DML::%s: WritebackFCLKChangeWatermark = %f\n", __func__, Watermark->WritebackFCLKChangeWatermark);
-       dml_print("DML::%s: WritebackUrgentWatermark = %f\n", __func__, Watermark->WritebackUrgentWatermark);
-       dml_print("DML::%s: USRRetrainingRequiredFinal = %d\n", __func__, USRRetrainingRequiredFinal);
+                       __func__, v->Watermark.WritebackDRAMClockChangeWatermark);
+       dml_print("DML::%s: WritebackFCLKChangeWatermark = %f\n", __func__, v->Watermark.WritebackFCLKChangeWatermark);
+       dml_print("DML::%s: WritebackUrgentWatermark = %f\n", __func__, v->Watermark.WritebackUrgentWatermark);
+       dml_print("DML::%s: v->USRRetrainingRequiredFinal = %d\n", __func__, v->USRRetrainingRequiredFinal);
        dml_print("DML::%s: USRRetrainingLatency = %f\n", __func__, mmSOCParameters.USRRetrainingLatency);
 #endif
 
-       for (k = 0; k < NumberOfActiveSurfaces; ++k) {
-               TotalPixelBW = TotalPixelBW + DPPPerSurface[k] * (SwathWidthY[k] * BytePerPixelDETY[k] * VRatio[k] +
-                               SwathWidthC[k] * BytePerPixelDETC[k] * VRatioChroma[k]) / (HTotal[k] / PixelClock[k]);
+       for (k = 0; k < v->NumberOfActiveSurfaces; ++k) {
+               TotalPixelBW = TotalPixelBW + DPPPerSurface[k] * (SwathWidthY[k] * BytePerPixelDETY[k] * v->VRatio[k] +
+                               SwathWidthC[k] * BytePerPixelDETC[k] * v->VRatioChroma[k]) / (v->HTotal[k] / v->PixelClock[k]);
        }
 
-       for (k = 0; k < NumberOfActiveSurfaces; ++k) {
+       for (k = 0; k < v->NumberOfActiveSurfaces; ++k) {
 
-               LBLatencyHidingSourceLinesY[k] = dml_min((double) MaxLineBufferLines, dml_floor(LineBufferSize / LBBitPerPixel[k] / (SwathWidthY[k] / dml_max(HRatio[k], 1.0)), 1)) - (VTaps[k] - 1);
-               LBLatencyHidingSourceLinesC[k] = dml_min((double) MaxLineBufferLines, dml_floor(LineBufferSize / LBBitPerPixel[k] / (SwathWidthC[k] / dml_max(HRatioChroma[k], 1.0)), 1)) - (VTapsChroma[k] - 1);
+               LBLatencyHidingSourceLinesY[k] = dml_min((double) v->MaxLineBufferLines, dml_floor(v->LineBufferSizeFinal / v->LBBitPerPixel[k] / (SwathWidthY[k] / dml_max(v->HRatio[k], 1.0)), 1)) - (v->vtaps[k] - 1);
+               LBLatencyHidingSourceLinesC[k] = dml_min((double) v->MaxLineBufferLines, dml_floor(v->LineBufferSizeFinal / v->LBBitPerPixel[k] / (SwathWidthC[k] / dml_max(v->HRatioChroma[k], 1.0)), 1)) - (v->VTAPsChroma[k] - 1);
 
 
 #ifdef __DML_VBA_DEBUG__
-               dml_print("DML::%s: k=%d, MaxLineBufferLines = %d\n", __func__, k, MaxLineBufferLines);
-               dml_print("DML::%s: k=%d, LineBufferSize     = %d\n", __func__, k, LineBufferSize);
-               dml_print("DML::%s: k=%d, LBBitPerPixel      = %d\n", __func__, k, LBBitPerPixel[k]);
-               dml_print("DML::%s: k=%d, HRatio             = %f\n", __func__, k, HRatio[k]);
-               dml_print("DML::%s: k=%d, VTaps              = %d\n", __func__, k, VTaps[k]);
+               dml_print("DML::%s: k=%d, v->MaxLineBufferLines = %d\n", __func__, k, v->MaxLineBufferLines);
+               dml_print("DML::%s: k=%d, v->LineBufferSizeFinal     = %d\n", __func__, k, v->LineBufferSizeFinal);
+               dml_print("DML::%s: k=%d, v->LBBitPerPixel      = %d\n", __func__, k, v->LBBitPerPixel[k]);
+               dml_print("DML::%s: k=%d, v->HRatio             = %f\n", __func__, k, v->HRatio[k]);
+               dml_print("DML::%s: k=%d, v->vtaps              = %d\n", __func__, k, v->vtaps[k]);
 #endif
 
-               EffectiveLBLatencyHidingY = LBLatencyHidingSourceLinesY[k] / VRatio[k] * (HTotal[k] / PixelClock[k]);
-               EffectiveLBLatencyHidingC = LBLatencyHidingSourceLinesC[k] / VRatioChroma[k] * (HTotal[k] / PixelClock[k]);
+               EffectiveLBLatencyHidingY = LBLatencyHidingSourceLinesY[k] / v->VRatio[k] * (v->HTotal[k] / v->PixelClock[k]);
+               EffectiveLBLatencyHidingC = LBLatencyHidingSourceLinesC[k] / v->VRatioChroma[k] * (v->HTotal[k] / v->PixelClock[k]);
                EffectiveDETBufferSizeY = DETBufferSizeY[k];
 
                if (UnboundedRequestEnabled) {
                        EffectiveDETBufferSizeY = EffectiveDETBufferSizeY
                                        + CompressedBufferSizeInkByte * 1024
-                                                       * (SwathWidthY[k] * BytePerPixelDETY[k] * VRatio[k])
-                                                       / (HTotal[k] / PixelClock[k]) / TotalPixelBW;
+                                                       * (SwathWidthY[k] * BytePerPixelDETY[k] * v->VRatio[k])
+                                                       / (v->HTotal[k] / v->PixelClock[k]) / TotalPixelBW;
                }
 
                LinesInDETY[k] = (double) EffectiveDETBufferSizeY / BytePerPixelDETY[k] / SwathWidthY[k];
                LinesInDETYRoundedDownToSwath[k] = dml_floor(LinesInDETY[k], SwathHeightY[k]);
-               FullDETBufferingTimeY = LinesInDETYRoundedDownToSwath[k] * (HTotal[k] / PixelClock[k]) / VRatio[k];
+               FullDETBufferingTimeY = LinesInDETYRoundedDownToSwath[k] * (v->HTotal[k] / v->PixelClock[k]) / v->VRatio[k];
 
                ActiveClockChangeLatencyHidingY = EffectiveLBLatencyHidingY + FullDETBufferingTimeY
-                               - (DSTXAfterScaler[k] / HTotal[k] + DSTYAfterScaler[k]) * HTotal[k] / PixelClock[k];
+                               - (DSTXAfterScaler[k] / v->HTotal[k] + DSTYAfterScaler[k]) * v->HTotal[k] / v->PixelClock[k];
 
-               if (NumberOfActiveSurfaces > 1) {
+               if (v->NumberOfActiveSurfaces > 1) {
                        ActiveClockChangeLatencyHidingY = ActiveClockChangeLatencyHidingY
-                                       - (1 - 1 / NumberOfActiveSurfaces) * SwathHeightY[k] * HTotal[k]
-                                                       / PixelClock[k] / VRatio[k];
+                                       - (1 - 1 / v->NumberOfActiveSurfaces) * SwathHeightY[k] * v->HTotal[k]
+                                                       / v->PixelClock[k] / v->VRatio[k];
                }
 
                if (BytePerPixelDETC[k] > 0) {
                        LinesInDETC[k] = DETBufferSizeC[k] / BytePerPixelDETC[k] / SwathWidthC[k];
                        LinesInDETCRoundedDownToSwath[k] = dml_floor(LinesInDETC[k], SwathHeightC[k]);
-                       FullDETBufferingTimeC = LinesInDETCRoundedDownToSwath[k] * (HTotal[k] / PixelClock[k])
-                                       / VRatioChroma[k];
+                       FullDETBufferingTimeC = LinesInDETCRoundedDownToSwath[k] * (v->HTotal[k] / v->PixelClock[k])
+                                       / v->VRatioChroma[k];
                        ActiveClockChangeLatencyHidingC = EffectiveLBLatencyHidingC + FullDETBufferingTimeC
-                                       - (DSTXAfterScaler[k] / HTotal[k] + DSTYAfterScaler[k]) * HTotal[k]
-                                                       / PixelClock[k];
-                       if (NumberOfActiveSurfaces > 1) {
+                                       - (DSTXAfterScaler[k] / v->HTotal[k] + DSTYAfterScaler[k]) * v->HTotal[k]
+                                                       / v->PixelClock[k];
+                       if (v->NumberOfActiveSurfaces > 1) {
                                ActiveClockChangeLatencyHidingC = ActiveClockChangeLatencyHidingC
-                                               - (1 - 1 / NumberOfActiveSurfaces) * SwathHeightC[k] * HTotal[k]
-                                                               / PixelClock[k] / VRatioChroma[k];
+                                               - (1 - 1 / v->NumberOfActiveSurfaces) * SwathHeightC[k] * v->HTotal[k]
+                                                               / v->PixelClock[k] / v->VRatioChroma[k];
                        }
                        ActiveClockChangeLatencyHiding = dml_min(ActiveClockChangeLatencyHidingY,
                                        ActiveClockChangeLatencyHidingC);
@@ -4436,24 +4419,24 @@ void dml32_CalculateWatermarksMALLUseAndDRAMSpeedChangeSupport(
                        ActiveClockChangeLatencyHiding = ActiveClockChangeLatencyHidingY;
                }
 
-               ActiveDRAMClockChangeLatencyMargin[k] = ActiveClockChangeLatencyHiding - Watermark->UrgentWatermark
-                               - Watermark->DRAMClockChangeWatermark;
-               ActiveFCLKChangeLatencyMargin[k] = ActiveClockChangeLatencyHiding - Watermark->UrgentWatermark
-                               - Watermark->FCLKChangeWatermark;
-               USRRetrainingLatencyMargin[k] = ActiveClockChangeLatencyHiding - Watermark->USRRetrainingWatermark;
-
-               if (WritebackEnable[k]) {
-                       WritebackLatencyHiding = WritebackInterfaceBufferSize * 1024
-                                       / (WritebackDestinationWidth[k] * WritebackDestinationHeight[k]
-                                                       / (WritebackSourceHeight[k] * HTotal[k] / PixelClock[k]) * 4);
-                       if (WritebackPixelFormat[k] == dm_444_64)
+               ActiveDRAMClockChangeLatencyMargin[k] = ActiveClockChangeLatencyHiding - v->Watermark.UrgentWatermark
+                               - v->Watermark.DRAMClockChangeWatermark;
+               ActiveFCLKChangeLatencyMargin[k] = ActiveClockChangeLatencyHiding - v->Watermark.UrgentWatermark
+                               - v->Watermark.FCLKChangeWatermark;
+               USRRetrainingLatencyMargin[k] = ActiveClockChangeLatencyHiding - v->Watermark.USRRetrainingWatermark;
+
+               if (v->WritebackEnable[k]) {
+                       WritebackLatencyHiding = v->WritebackInterfaceBufferSize * 1024
+                                       / (v->WritebackDestinationWidth[k] * v->WritebackDestinationHeight[k]
+                                                       / (v->WritebackSourceHeight[k] * v->HTotal[k] / v->PixelClock[k]) * 4);
+                       if (v->WritebackPixelFormat[k] == dm_444_64)
                                WritebackLatencyHiding = WritebackLatencyHiding / 2;
 
                        WritebackDRAMClockChangeLatencyMargin = WritebackLatencyHiding
-                                       - Watermark->WritebackDRAMClockChangeWatermark;
+                                       - v->Watermark.WritebackDRAMClockChangeWatermark;
 
                        WritebackFCLKChangeLatencyMargin = WritebackLatencyHiding
-                                       - Watermark->WritebackFCLKChangeWatermark;
+                                       - v->Watermark.WritebackFCLKChangeWatermark;
 
                        ActiveDRAMClockChangeLatencyMargin[k] = dml_min(ActiveDRAMClockChangeLatencyMargin[k],
                                        WritebackFCLKChangeLatencyMargin);
@@ -4461,22 +4444,22 @@ void dml32_CalculateWatermarksMALLUseAndDRAMSpeedChangeSupport(
                                        WritebackDRAMClockChangeLatencyMargin);
                }
                MaxActiveDRAMClockChangeLatencySupported[k] =
-                               (UseMALLForPStateChange[k] == dm_use_mall_pstate_change_phantom_pipe) ?
+                               (v->UsesMALLForPStateChange[k] == dm_use_mall_pstate_change_phantom_pipe) ?
                                                0 :
                                                (ActiveDRAMClockChangeLatencyMargin[k]
                                                                + mmSOCParameters.DRAMClockChangeLatency);
        }
 
-       for (i = 0; i < NumberOfActiveSurfaces; ++i) {
-               for (j = 0; j < NumberOfActiveSurfaces; ++j) {
+       for (i = 0; i < v->NumberOfActiveSurfaces; ++i) {
+               for (j = 0; j < v->NumberOfActiveSurfaces; ++j) {
                        if (i == j ||
-                                       (BlendingAndTiming[i] == i && BlendingAndTiming[j] == i) ||
-                                       (BlendingAndTiming[j] == j && BlendingAndTiming[i] == j) ||
-                                       (BlendingAndTiming[i] == BlendingAndTiming[j] && BlendingAndTiming[i] != i) ||
-                                       (SynchronizeTimingsFinal && PixelClock[i] == PixelClock[j] &&
-                                       HTotal[i] == HTotal[j] && VTotal[i] == VTotal[j] &&
-                                       VActive[i] == VActive[j]) || (SynchronizeDRRDisplaysForUCLKPStateChangeFinal &&
-                                       (DRRDisplay[i] || DRRDisplay[j]))) {
+                                       (v->BlendingAndTiming[i] == i && v->BlendingAndTiming[j] == i) ||
+                                       (v->BlendingAndTiming[j] == j && v->BlendingAndTiming[i] == j) ||
+                                       (v->BlendingAndTiming[i] == v->BlendingAndTiming[j] && v->BlendingAndTiming[i] != i) ||
+                                       (v->SynchronizeTimingsFinal && v->PixelClock[i] == v->PixelClock[j] &&
+                                       v->HTotal[i] == v->HTotal[j] && v->VTotal[i] == v->VTotal[j] &&
+                                       v->VActive[i] == v->VActive[j]) || (v->SynchronizeDRRDisplaysForUCLKPStateChangeFinal &&
+                                       (v->DRRDisplay[i] || v->DRRDisplay[j]))) {
                                SynchronizedSurfaces[i][j] = true;
                        } else {
                                SynchronizedSurfaces[i][j] = false;
@@ -4484,8 +4467,8 @@ void dml32_CalculateWatermarksMALLUseAndDRAMSpeedChangeSupport(
                }
        }
 
-       for (k = 0; k < NumberOfActiveSurfaces; ++k) {
-               if ((UseMALLForPStateChange[k] != dm_use_mall_pstate_change_phantom_pipe) &&
+       for (k = 0; k < v->NumberOfActiveSurfaces; ++k) {
+               if ((v->UsesMALLForPStateChange[k] != dm_use_mall_pstate_change_phantom_pipe) &&
                                (!FoundFirstSurfaceWithMinActiveFCLKChangeMargin ||
                                ActiveFCLKChangeLatencyMargin[k] < MinActiveFCLKChangeMargin)) {
                        FoundFirstSurfaceWithMinActiveFCLKChangeMargin = true;
@@ -4497,9 +4480,9 @@ void dml32_CalculateWatermarksMALLUseAndDRAMSpeedChangeSupport(
        *MinActiveFCLKChangeLatencySupported = MinActiveFCLKChangeMargin + mmSOCParameters.FCLKChangeLatency;
 
        SameTimingForFCLKChange = true;
-       for (k = 0; k < NumberOfActiveSurfaces; ++k) {
+       for (k = 0; k < v->NumberOfActiveSurfaces; ++k) {
                if (!SynchronizedSurfaces[k][SurfaceWithMinActiveFCLKChangeMargin]) {
-                       if ((UseMALLForPStateChange[k] != dm_use_mall_pstate_change_phantom_pipe) &&
+                       if ((v->UsesMALLForPStateChange[k] != dm_use_mall_pstate_change_phantom_pipe) &&
                                        (SameTimingForFCLKChange ||
                                        ActiveFCLKChangeLatencyMargin[k] <
                                        SecondMinActiveFCLKChangeMarginOneDisplayInVBLank)) {
@@ -4519,17 +4502,17 @@ void dml32_CalculateWatermarksMALLUseAndDRAMSpeedChangeSupport(
        }
 
        *USRRetrainingSupport = true;
-       for (k = 0; k < NumberOfActiveSurfaces; ++k) {
-               if ((UseMALLForPStateChange[k] != dm_use_mall_pstate_change_phantom_pipe) &&
+       for (k = 0; k < v->NumberOfActiveSurfaces; ++k) {
+               if ((v->UsesMALLForPStateChange[k] != dm_use_mall_pstate_change_phantom_pipe) &&
                                (USRRetrainingLatencyMargin[k] < 0)) {
                        *USRRetrainingSupport = false;
                }
        }
 
-       for (k = 0; k < NumberOfActiveSurfaces; ++k) {
-               if (UseMALLForPStateChange[k] != dm_use_mall_pstate_change_full_frame &&
-                               UseMALLForPStateChange[k] != dm_use_mall_pstate_change_sub_viewport &&
-                               UseMALLForPStateChange[k] != dm_use_mall_pstate_change_phantom_pipe &&
+       for (k = 0; k < v->NumberOfActiveSurfaces; ++k) {
+               if (v->UsesMALLForPStateChange[k] != dm_use_mall_pstate_change_full_frame &&
+                               v->UsesMALLForPStateChange[k] != dm_use_mall_pstate_change_sub_viewport &&
+                               v->UsesMALLForPStateChange[k] != dm_use_mall_pstate_change_phantom_pipe &&
                                ActiveDRAMClockChangeLatencyMargin[k] < 0) {
                        if (PrefetchMode > 0) {
                                DRAMClockChangeSupportNumber = 2;
@@ -4543,10 +4526,10 @@ void dml32_CalculateWatermarksMALLUseAndDRAMSpeedChangeSupport(
                }
        }
 
-       for (k = 0; k < NumberOfActiveSurfaces; ++k) {
-               if (UseMALLForPStateChange[k] == dm_use_mall_pstate_change_full_frame)
+       for (k = 0; k < v->NumberOfActiveSurfaces; ++k) {
+               if (v->UsesMALLForPStateChange[k] == dm_use_mall_pstate_change_full_frame)
                        DRAMClockChangeMethod = 1;
-               else if (UseMALLForPStateChange[k] == dm_use_mall_pstate_change_sub_viewport)
+               else if (v->UsesMALLForPStateChange[k] == dm_use_mall_pstate_change_sub_viewport)
                        DRAMClockChangeMethod = 2;
        }
 
@@ -4573,16 +4556,16 @@ void dml32_CalculateWatermarksMALLUseAndDRAMSpeedChangeSupport(
                        *DRAMClockChangeSupport = dm_dram_clock_change_unsupported;
        }
 
-       for (k = 0; k < NumberOfActiveSurfaces; ++k) {
+       for (k = 0; k < v->NumberOfActiveSurfaces; ++k) {
                unsigned int dst_y_pstate;
                unsigned int src_y_pstate_l;
                unsigned int src_y_pstate_c;
                unsigned int src_y_ahead_l, src_y_ahead_c, sub_vp_lines_l, sub_vp_lines_c;
 
-               dst_y_pstate = dml_ceil((mmSOCParameters.DRAMClockChangeLatency + mmSOCParameters.UrgentLatency) / (HTotal[k] / PixelClock[k]), 1);
-               src_y_pstate_l = dml_ceil(dst_y_pstate * VRatio[k], SwathHeightY[k]);
+               dst_y_pstate = dml_ceil((mmSOCParameters.DRAMClockChangeLatency + mmSOCParameters.UrgentLatency) / (v->HTotal[k] / v->PixelClock[k]), 1);
+               src_y_pstate_l = dml_ceil(dst_y_pstate * v->VRatio[k], SwathHeightY[k]);
                src_y_ahead_l = dml_floor(DETBufferSizeY[k] / BytePerPixelDETY[k] / SwathWidthY[k], SwathHeightY[k]) + LBLatencyHidingSourceLinesY[k];
-               sub_vp_lines_l = src_y_pstate_l + src_y_ahead_l + meta_row_height[k];
+               sub_vp_lines_l = src_y_pstate_l + src_y_ahead_l + v->meta_row_height[k];
 
 #ifdef __DML_VBA_DEBUG__
 dml_print("DML::%s: k=%d, DETBufferSizeY               = %d\n", __func__, k, DETBufferSizeY[k]);
@@ -4593,21 +4576,21 @@ dml_print("DML::%s: k=%d, LBLatencyHidingSourceLinesY  = %d\n", __func__, k, LBL
 dml_print("DML::%s: k=%d, dst_y_pstate      = %d\n", __func__, k, dst_y_pstate);
 dml_print("DML::%s: k=%d, src_y_pstate_l    = %d\n", __func__, k, src_y_pstate_l);
 dml_print("DML::%s: k=%d, src_y_ahead_l     = %d\n", __func__, k, src_y_ahead_l);
-dml_print("DML::%s: k=%d, meta_row_height   = %d\n", __func__, k, meta_row_height[k]);
+dml_print("DML::%s: k=%d, v->meta_row_height   = %d\n", __func__, k, v->meta_row_height[k]);
 dml_print("DML::%s: k=%d, sub_vp_lines_l    = %d\n", __func__, k, sub_vp_lines_l);
 #endif
                SubViewportLinesNeededInMALL[k] = sub_vp_lines_l;
 
                if (BytePerPixelDETC[k] > 0) {
-                       src_y_pstate_c = dml_ceil(dst_y_pstate * VRatioChroma[k], SwathHeightC[k]);
+                       src_y_pstate_c = dml_ceil(dst_y_pstate * v->VRatioChroma[k], SwathHeightC[k]);
                        src_y_ahead_c = dml_floor(DETBufferSizeC[k] / BytePerPixelDETC[k] / SwathWidthC[k], SwathHeightC[k]) + LBLatencyHidingSourceLinesC[k];
-                       sub_vp_lines_c = src_y_pstate_c + src_y_ahead_c + meta_row_height_chroma[k];
+                       sub_vp_lines_c = src_y_pstate_c + src_y_ahead_c + v->meta_row_height_chroma[k];
                        SubViewportLinesNeededInMALL[k] = dml_max(sub_vp_lines_l, sub_vp_lines_c);
 
 #ifdef __DML_VBA_DEBUG__
 dml_print("DML::%s: k=%d, src_y_pstate_c            = %d\n", __func__, k, src_y_pstate_c);
 dml_print("DML::%s: k=%d, src_y_ahead_c             = %d\n", __func__, k, src_y_ahead_c);
-dml_print("DML::%s: k=%d, meta_row_height_chroma    = %d\n", __func__, k, meta_row_height_chroma[k]);
+dml_print("DML::%s: k=%d, v->meta_row_height_chroma    = %d\n", __func__, k, v->meta_row_height_chroma[k]);
 dml_print("DML::%s: k=%d, sub_vp_lines_c            = %d\n", __func__, k, sub_vp_lines_c);
 #endif
                }
index d293856ba906b4032b5e461884a37392ae01fa18..0b427d89b3c5d55a1319e68e80c8761d92c17a08 100644 (file)
@@ -30,6 +30,7 @@
 #include "os_types.h"
 #include "../dc_features.h"
 #include "../display_mode_structs.h"
+#include "dml/display_mode_vba.h"
 
 unsigned int dml32_dscceComputeDelay(
                unsigned int bpc,
@@ -215,6 +216,7 @@ void dml32_CalculateDETBufferSize(
 void dml32_CalculateODMMode(
                unsigned int MaximumPixelsPerLinePerDSCUnit,
                unsigned int HActive,
+               enum output_format_class OutFormat,
                enum output_encoder_class Output,
                enum odm_combine_policy ODMUse,
                double StateDispclk,
@@ -712,28 +714,14 @@ double dml32_CalculateExtraLatency(
                unsigned int HostVMMaxNonCachedPageTableLevels);
 
 bool dml32_CalculatePrefetchSchedule(
+               struct vba_vars_st *v,
+               unsigned int k,
                double HostVMInefficiencyFactor,
                DmlPipe *myPipe,
                unsigned int DSCDelay,
-               double DPPCLKDelaySubtotalPlusCNVCFormater,
-               double DPPCLKDelaySCL,
-               double DPPCLKDelaySCLLBOnly,
-               double DPPCLKDelayCNVCCursor,
-               double DISPCLKDelaySubtotal,
                unsigned int DPP_RECOUT_WIDTH,
-               enum output_format_class OutputFormat,
-               unsigned int MaxInterDCNTileRepeaters,
                unsigned int VStartup,
                unsigned int MaxVStartup,
-               unsigned int GPUVMPageTableLevels,
-               bool GPUVMEnable,
-               bool HostVMEnable,
-               unsigned int HostVMMaxNonCachedPageTableLevels,
-               double HostVMMinPageSize,
-               bool DynamicMetadataEnable,
-               bool DynamicMetadataVMEnabled,
-               int DynamicMetadataLinesBeforeActiveRequired,
-               unsigned int DynamicMetadataTransmittedBytes,
                double UrgentLatency,
                double UrgentExtraLatency,
                double TCalc,
@@ -807,58 +795,28 @@ void dml32_CalculateFlipSchedule(
                bool *ImmediateFlipSupportedForPipe);
 
 void dml32_CalculateWatermarksMALLUseAndDRAMSpeedChangeSupport(
-               bool USRRetrainingRequiredFinal,
-               enum dm_use_mall_for_pstate_change_mode UseMALLForPStateChange[],
+               struct vba_vars_st *v,
                unsigned int PrefetchMode,
-               unsigned int NumberOfActiveSurfaces,
-               unsigned int MaxLineBufferLines,
-               unsigned int LineBufferSize,
-               unsigned int WritebackInterfaceBufferSize,
                double DCFCLK,
                double ReturnBW,
-               bool SynchronizeTimingsFinal,
-               bool SynchronizeDRRDisplaysForUCLKPStateChangeFinal,
-               bool DRRDisplay[],
-               unsigned int dpte_group_bytes[],
-               unsigned int meta_row_height[],
-               unsigned int meta_row_height_chroma[],
                SOCParametersList mmSOCParameters,
-               unsigned int WritebackChunkSize,
                double SOCCLK,
                double DCFClkDeepSleep,
                unsigned int DETBufferSizeY[],
                unsigned int DETBufferSizeC[],
                unsigned int SwathHeightY[],
                unsigned int SwathHeightC[],
-               unsigned int LBBitPerPixel[],
                double SwathWidthY[],
                double SwathWidthC[],
-               double HRatio[],
-               double HRatioChroma[],
-               unsigned int VTaps[],
-               unsigned int VTapsChroma[],
-               double VRatio[],
-               double VRatioChroma[],
-               unsigned int HTotal[],
-               unsigned int VTotal[],
-               unsigned int VActive[],
-               double PixelClock[],
-               unsigned int BlendingAndTiming[],
                unsigned int DPPPerSurface[],
                double BytePerPixelDETY[],
                double BytePerPixelDETC[],
                double DSTXAfterScaler[],
                double DSTYAfterScaler[],
-               bool WritebackEnable[],
-               enum source_format_class WritebackPixelFormat[],
-               double WritebackDestinationWidth[],
-               double WritebackDestinationHeight[],
-               double WritebackSourceHeight[],
                bool UnboundedRequestEnabled,
                unsigned int CompressedBufferSizeInkByte,
 
                /* Output */
-               Watermarks *Watermark,
                enum clock_change_support *DRAMClockChangeSupport,
                double MaxActiveDRAMClockChangeLatencySupported[],
                unsigned int SubViewportLinesNeededInMALL[],
index 5d27ff0ebb5fa17e5c2ea7e4cce14af62191f9eb..f5400eda07a53396ad9eafb09bcf2918dbb81e8d 100644 (file)
@@ -35,6 +35,8 @@
 #include "dcn30/display_rq_dlg_calc_30.h"
 #include "dcn31/display_mode_vba_31.h"
 #include "dcn31/display_rq_dlg_calc_31.h"
+#include "dcn314/display_mode_vba_314.h"
+#include "dcn314/display_rq_dlg_calc_314.h"
 #include "dcn32/display_mode_vba_32.h"
 #include "dcn32/display_rq_dlg_calc_32.h"
 #include "dml_logger.h"
@@ -74,6 +76,13 @@ const struct dml_funcs dml31_funcs = {
        .rq_dlg_get_rq_reg = dml31_rq_dlg_get_rq_reg
 };
 
+const struct dml_funcs dml314_funcs = {
+       .validate = dml314_ModeSupportAndSystemConfigurationFull,
+       .recalculate = dml314_recalculate,
+       .rq_dlg_get_dlg_reg = dml314_rq_dlg_get_dlg_reg,
+       .rq_dlg_get_rq_reg = dml314_rq_dlg_get_rq_reg
+};
+
 const struct dml_funcs dml32_funcs = {
        .validate = dml32_ModeSupportAndSystemConfigurationFull,
     .recalculate = dml32_recalculate,
@@ -107,6 +116,9 @@ void dml_init_instance(struct display_mode_lib *lib,
        case DML_PROJECT_DCN31_FPGA:
                lib->funcs = dml31_funcs;
                break;
+       case DML_PROJECT_DCN314:
+               lib->funcs = dml314_funcs;
+               break;
        case DML_PROJECT_DCN32:
                lib->funcs = dml32_funcs;
                break;
index 2bdd6ed22611d266223ca35f59a14e0d5cd99767..b1878a1440e2bf199bb3bd39dd75002bee1816e6 100644 (file)
@@ -41,6 +41,7 @@ enum dml_project {
        DML_PROJECT_DCN30,
        DML_PROJECT_DCN31,
        DML_PROJECT_DCN31_FPGA,
+       DML_PROJECT_DCN314,
        DML_PROJECT_DCN32,
 };
 
index 492aec634b685815a40c8cb304ae45427d98f323..2051ddaa641a78c57a64ec9d325f301eee09f4d1 100644 (file)
@@ -651,10 +651,10 @@ struct vba_vars_st {
 
        unsigned int OutputTypeAndRatePerState[DC__VOLTAGE_STATES][DC__NUM_DPP__MAX];
        double RequiredDISPCLKPerSurface[DC__VOLTAGE_STATES][2][DC__NUM_DPP__MAX];
-       unsigned int MicroTileHeightY[DC__NUM_DPP__MAX];
-       unsigned int MicroTileHeightC[DC__NUM_DPP__MAX];
-       unsigned int MicroTileWidthY[DC__NUM_DPP__MAX];
-       unsigned int MicroTileWidthC[DC__NUM_DPP__MAX];
+       unsigned int MacroTileHeightY[DC__NUM_DPP__MAX];
+       unsigned int MacroTileHeightC[DC__NUM_DPP__MAX];
+       unsigned int MacroTileWidthY[DC__NUM_DPP__MAX];
+       unsigned int MacroTileWidthC[DC__NUM_DPP__MAX];
        bool ImmediateFlipRequiredFinal;
        bool DCCProgrammingAssumesScanDirectionUnknownFinal;
        bool EnoughWritebackUnits;
@@ -800,8 +800,6 @@ struct vba_vars_st {
        double PSCL_FACTOR[DC__NUM_DPP__MAX];
        double PSCL_FACTOR_CHROMA[DC__NUM_DPP__MAX];
        double MaximumVStartup[DC__VOLTAGE_STATES][2][DC__NUM_DPP__MAX];
-       unsigned int MacroTileWidthY[DC__NUM_DPP__MAX];
-       unsigned int MacroTileWidthC[DC__NUM_DPP__MAX];
        double AlignedDCCMetaPitch[DC__NUM_DPP__MAX];
        double AlignedYPitch[DC__NUM_DPP__MAX];
        double AlignedCPitch[DC__NUM_DPP__MAX];
index 5d2b028e5dadf9564494ac924444e0235c7146b7..d9f1b0a4fbd4ab5874ab9a0f6b14dca6a06073c2 100644 (file)
@@ -214,6 +214,7 @@ struct dummy_pstate_entry {
 struct clk_bw_params {
        unsigned int vram_type;
        unsigned int num_channels;
+       unsigned int dram_channel_width_bytes;
        unsigned int dispclk_vco_khz;
        unsigned int dc_mode_softmax_memclk;
        struct clk_limit_table clk_table;
index 58158764adc0a6f94c326f10f734e9a094abf93e..7614125c92c70b6f284e85e64e86135a2149515d 100644 (file)
@@ -219,6 +219,10 @@ void check_syncd_pipes_for_disabled_master_pipe(struct dc *dc,
        struct dc_state *context,
        uint8_t disabled_master_pipe_idx);
 
+void reset_sync_context_for_pipe(const struct dc *dc,
+       struct dc_state *context,
+       uint8_t pipe_idx);
+
 uint8_t resource_transmitter_to_phy_idx(const struct dc *dc, enum transmitter transmitter);
 
 const struct link_hwss *get_link_hwss(const struct dc_link *link,
index 859ffd8725c5caa76882461072fc1a75b725b42c..04f7656906ca0fa77f362584d6f290daa21897b9 100644 (file)
@@ -1600,6 +1600,7 @@ static void interpolate_user_regamma(uint32_t hw_points_num,
        struct fixed31_32 lut2;
        struct fixed31_32 delta_lut;
        struct fixed31_32 delta_index;
+       const struct fixed31_32 one = dc_fixpt_from_int(1);
 
        i = 0;
        /* fixed_pt library has problems handling too small values */
@@ -1628,6 +1629,9 @@ static void interpolate_user_regamma(uint32_t hw_points_num,
                        } else
                                hw_x = coordinates_x[i].x;
 
+                       if (dc_fixpt_le(one, hw_x))
+                               hw_x = one;
+
                        norm_x = dc_fixpt_mul(norm_factor, hw_x);
                        index = dc_fixpt_floor(norm_x);
                        if (index < 0 || index > 255)
index 6db67f082d91758eece57c919e14e705e0148354..644ea150e0751890820cc79e66c24aa6f61dcb83 100644 (file)
@@ -368,6 +368,17 @@ static void sienna_cichlid_check_bxco_support(struct smu_context *smu)
                smu_baco->platform_support =
                        (val & RCC_BIF_STRAP0__STRAP_PX_CAPABLE_MASK) ? true :
                                                                        false;
+
+               /*
+                * Disable BACO entry/exit completely on below SKUs to
+                * avoid hardware intermittent failures.
+                */
+               if (((adev->pdev->device == 0x73A1) &&
+                   (adev->pdev->revision == 0x00)) ||
+                   ((adev->pdev->device == 0x73BF) &&
+                   (adev->pdev->revision == 0xCF)))
+                       smu_baco->platform_support = false;
+
        }
 }
 
index 24488f4cb78ccb08b07019bd84aa127ee25e74e0..93f9b8377539a4c618da67770495f9febe55a5b4 100644 (file)
@@ -209,7 +209,8 @@ int smu_v13_0_init_pptable_microcode(struct smu_context *smu)
        if (!adev->scpm_enabled)
                return 0;
 
-       if (adev->ip_versions[MP1_HWIP][0] == IP_VERSION(13, 0, 7))
+       if ((adev->ip_versions[MP1_HWIP][0] == IP_VERSION(13, 0, 7)) ||
+           (adev->ip_versions[MP1_HWIP][0] == IP_VERSION(13, 0, 0)))
                return 0;
 
        /* override pptable_id from driver parameter */
@@ -218,27 +219,6 @@ int smu_v13_0_init_pptable_microcode(struct smu_context *smu)
                dev_info(adev->dev, "override pptable id %d\n", pptable_id);
        } else {
                pptable_id = smu->smu_table.boot_values.pp_table_id;
-
-               /*
-                * Temporary solution for SMU V13.0.0 with SCPM enabled:
-                *   - use vbios carried pptable when pptable_id is 3664, 3715 or 3795
-                *   - use 36831 soft pptable when pptable_id is 3683
-                */
-               if (adev->ip_versions[MP1_HWIP][0] == IP_VERSION(13, 0, 0)) {
-                       switch (pptable_id) {
-                       case 3664:
-                       case 3715:
-                       case 3795:
-                               pptable_id = 0;
-                               break;
-                       case 3683:
-                               pptable_id = 36831;
-                               break;
-                       default:
-                               dev_err(adev->dev, "Unsupported pptable id %d\n", pptable_id);
-                               return -EINVAL;
-                       }
-               }
        }
 
        /* "pptable_id == 0" means vbios carries the pptable. */
@@ -471,26 +451,6 @@ int smu_v13_0_setup_pptable(struct smu_context *smu)
        } else {
                pptable_id = smu->smu_table.boot_values.pp_table_id;
 
-               /*
-                * Temporary solution for SMU V13.0.0 with SCPM disabled:
-                *   - use 3664, 3683 or 3715 on request
-                *   - use 3664 when pptable_id is 0
-                * TODO: drop these when the pptable carried in vbios is ready.
-                */
-               if (adev->ip_versions[MP1_HWIP][0] == IP_VERSION(13, 0, 0)) {
-                       switch (pptable_id) {
-                       case 0:
-                               pptable_id = 3664;
-                               break;
-                       case 3664:
-                       case 3683:
-                       case 3715:
-                               break;
-                       default:
-                               dev_err(adev->dev, "Unsupported pptable id %d\n", pptable_id);
-                               return -EINVAL;
-                       }
-               }
        }
 
        /* force using vbios pptable in sriov mode */
index 7db2fd9ea74ad75001f77d3c2319a318660e6990..096327513dd09d9d65167836b81ab0c5c7d94dda 100644 (file)
@@ -410,58 +410,11 @@ static int smu_v13_0_0_setup_pptable(struct smu_context *smu)
 {
        struct smu_table_context *smu_table = &smu->smu_table;
        struct amdgpu_device *adev = smu->adev;
-       uint32_t pptable_id;
        int ret = 0;
 
-       /*
-        * With SCPM enabled, the pptable used will be signed. It cannot
-        * be used directly by driver. To get the raw pptable, we need to
-        * rely on the combo pptable(and its revelant SMU message).
-        */
-       if (adev->scpm_enabled) {
-               ret = smu_v13_0_0_get_pptable_from_pmfw(smu,
-                                                       &smu_table->power_play_table,
-                                                       &smu_table->power_play_table_size);
-       } else {
-               /* override pptable_id from driver parameter */
-               if (amdgpu_smu_pptable_id >= 0) {
-                       pptable_id = amdgpu_smu_pptable_id;
-                       dev_info(adev->dev, "override pptable id %d\n", pptable_id);
-               } else {
-                       pptable_id = smu_table->boot_values.pp_table_id;
-               }
-
-               /*
-                * Temporary solution for SMU V13.0.0 with SCPM disabled:
-                *   - use vbios carried pptable when pptable_id is 3664, 3715 or 3795
-                *   - use soft pptable when pptable_id is 3683
-                */
-               if (adev->ip_versions[MP1_HWIP][0] == IP_VERSION(13, 0, 0)) {
-                       switch (pptable_id) {
-                       case 3664:
-                       case 3715:
-                       case 3795:
-                               pptable_id = 0;
-                               break;
-                       case 3683:
-                               break;
-                       default:
-                               dev_err(adev->dev, "Unsupported pptable id %d\n", pptable_id);
-                               return -EINVAL;
-                       }
-               }
-
-               /* force using vbios pptable in sriov mode */
-               if ((amdgpu_sriov_vf(adev) || !pptable_id) && (amdgpu_emu_mode != 1))
-                       ret = smu_v13_0_0_get_pptable_from_pmfw(smu,
-                                                               &smu_table->power_play_table,
-                                                               &smu_table->power_play_table_size);
-               else
-                       ret = smu_v13_0_get_pptable_from_firmware(smu,
-                                                                 &smu_table->power_play_table,
-                                                                 &smu_table->power_play_table_size,
-                                                                 pptable_id);
-       }
+       ret = smu_v13_0_0_get_pptable_from_pmfw(smu,
+                                               &smu_table->power_play_table,
+                                               &smu_table->power_play_table_size);
        if (ret)
                return ret;
 
index dd32b484dd82557b77a918c99c0953f78f4fb1e7..ce96234f3df2084f80702f060926d77d3b981068 100644 (file)
@@ -581,11 +581,9 @@ static const struct psb_offset cdv_regmap[2] = {
 static int cdv_chip_setup(struct drm_device *dev)
 {
        struct drm_psb_private *dev_priv = to_drm_psb_private(dev);
-       struct pci_dev *pdev = to_pci_dev(dev->dev);
        INIT_WORK(&dev_priv->hotplug_work, cdv_hotplug_work_func);
 
-       if (pci_enable_msi(pdev))
-               dev_warn(dev->dev, "Enabling MSI failed!\n");
+       dev_priv->use_msi = true;
        dev_priv->regmap = cdv_regmap;
        gma_get_core_freq(dev);
        psb_intel_opregion_init(dev);
index dffe37490206d241cda861e2d5000ff0cd5a6094..4b7627a7263788b939025dd298699e2565b1fa6e 100644 (file)
@@ -112,12 +112,12 @@ static void psb_gem_free_object(struct drm_gem_object *obj)
 {
        struct psb_gem_object *pobj = to_psb_gem_object(obj);
 
-       drm_gem_object_release(obj);
-
        /* Undo the mmap pin if we are destroying the object */
        if (pobj->mmapping)
                psb_gem_unpin(pobj);
 
+       drm_gem_object_release(obj);
+
        WARN_ON(pobj->in_gart && !pobj->stolen);
 
        release_resource(&pobj->resource);
index bd40c040a2c91fe402ccdeb1cce63350a0541fb4..2f52eceda3a1e464255fb602b6cc42498822c525 100644 (file)
@@ -532,15 +532,18 @@ int gma_crtc_page_flip(struct drm_crtc *crtc,
                WARN_ON(drm_crtc_vblank_get(crtc) != 0);
 
                gma_crtc->page_flip_event = event;
+               spin_unlock_irqrestore(&dev->event_lock, flags);
 
                /* Call this locked if we want an event at vblank interrupt. */
                ret = crtc_funcs->mode_set_base(crtc, crtc->x, crtc->y, old_fb);
                if (ret) {
-                       gma_crtc->page_flip_event = NULL;
-                       drm_crtc_vblank_put(crtc);
+                       spin_lock_irqsave(&dev->event_lock, flags);
+                       if (gma_crtc->page_flip_event) {
+                               gma_crtc->page_flip_event = NULL;
+                               drm_crtc_vblank_put(crtc);
+                       }
+                       spin_unlock_irqrestore(&dev->event_lock, flags);
                }
-
-               spin_unlock_irqrestore(&dev->event_lock, flags);
        } else {
                ret = crtc_funcs->mode_set_base(crtc, crtc->x, crtc->y, old_fb);
        }
index 5923a9c8931224565545fc163b7602105546a072..f90e628cb482c097f503fc82701e4084a2b00d4d 100644 (file)
@@ -501,12 +501,9 @@ static const struct psb_offset oaktrail_regmap[2] = {
 static int oaktrail_chip_setup(struct drm_device *dev)
 {
        struct drm_psb_private *dev_priv = to_drm_psb_private(dev);
-       struct pci_dev *pdev = to_pci_dev(dev->dev);
        int ret;
 
-       if (pci_enable_msi(pdev))
-               dev_warn(dev->dev, "Enabling MSI failed!\n");
-
+       dev_priv->use_msi = true;
        dev_priv->regmap = oaktrail_regmap;
 
        ret = mid_chip_setup(dev);
index b91de6d36e412e2b4dbbd3f179fd695781f119a3..66873085d45059797cdc94d8ab37ba5513bdd70c 100644 (file)
@@ -139,8 +139,6 @@ static void gma_suspend_pci(struct pci_dev *pdev)
        dev_priv->regs.saveBSM = bsm;
        pci_read_config_dword(pdev, 0xFC, &vbt);
        dev_priv->regs.saveVBT = vbt;
-       pci_read_config_dword(pdev, PSB_PCIx_MSI_ADDR_LOC, &dev_priv->msi_addr);
-       pci_read_config_dword(pdev, PSB_PCIx_MSI_DATA_LOC, &dev_priv->msi_data);
 
        pci_disable_device(pdev);
        pci_set_power_state(pdev, PCI_D3hot);
@@ -168,9 +166,6 @@ static bool gma_resume_pci(struct pci_dev *pdev)
        pci_restore_state(pdev);
        pci_write_config_dword(pdev, 0x5c, dev_priv->regs.saveBSM);
        pci_write_config_dword(pdev, 0xFC, dev_priv->regs.saveVBT);
-       /* restoring MSI address and data in PCIx space */
-       pci_write_config_dword(pdev, PSB_PCIx_MSI_ADDR_LOC, dev_priv->msi_addr);
-       pci_write_config_dword(pdev, PSB_PCIx_MSI_DATA_LOC, dev_priv->msi_data);
        ret = pci_enable_device(pdev);
 
        if (ret != 0)
@@ -223,8 +218,7 @@ int gma_power_resume(struct device *_dev)
        mutex_lock(&power_mutex);
        gma_resume_pci(pdev);
        gma_resume_display(pdev);
-       gma_irq_preinstall(dev);
-       gma_irq_postinstall(dev);
+       gma_irq_install(dev);
        mutex_unlock(&power_mutex);
        return 0;
 }
index 1d8744f3e7020760d4beffba2429815a58f93035..54e756b486060b5388680a93075dfcbd6054ab44 100644 (file)
@@ -383,7 +383,7 @@ static int psb_driver_load(struct drm_device *dev, unsigned long flags)
        PSB_WVDC32(0xFFFFFFFF, PSB_INT_MASK_R);
        spin_unlock_irqrestore(&dev_priv->irqmask_lock, irqflags);
 
-       gma_irq_install(dev, pdev->irq);
+       gma_irq_install(dev);
 
        dev->max_vblank_count = 0xffffff; /* only 24 bits of frame count */
 
index 0ea3d23575f3a638be95c723639938fdd7443492..731cc356c07a39d4aba86cc682134d343ed28535 100644 (file)
@@ -490,6 +490,7 @@ struct drm_psb_private {
        int rpm_enabled;
 
        /* MID specific */
+       bool use_msi;
        bool has_gct;
        struct oaktrail_gct_data gct_data;
 
@@ -499,10 +500,6 @@ struct drm_psb_private {
        /* Register state */
        struct psb_save_area regs;
 
-       /* MSI reg save */
-       uint32_t msi_addr;
-       uint32_t msi_data;
-
        /* Hotplug handling */
        struct work_struct hotplug_work;
 
index e6e6d61bbeab646d05026564d51d9b53174d44f5..038f18ed0a95ee3b43759e32d3c1d84730111dfe 100644 (file)
@@ -316,17 +316,24 @@ void gma_irq_postinstall(struct drm_device *dev)
        spin_unlock_irqrestore(&dev_priv->irqmask_lock, irqflags);
 }
 
-int gma_irq_install(struct drm_device *dev, unsigned int irq)
+int gma_irq_install(struct drm_device *dev)
 {
+       struct drm_psb_private *dev_priv = to_drm_psb_private(dev);
+       struct pci_dev *pdev = to_pci_dev(dev->dev);
        int ret;
 
-       if (irq == IRQ_NOTCONNECTED)
+       if (dev_priv->use_msi && pci_enable_msi(pdev)) {
+               dev_warn(dev->dev, "Enabling MSI failed!\n");
+               dev_priv->use_msi = false;
+       }
+
+       if (pdev->irq == IRQ_NOTCONNECTED)
                return -ENOTCONN;
 
        gma_irq_preinstall(dev);
 
        /* PCI devices require shared interrupts. */
-       ret = request_irq(irq, gma_irq_handler, IRQF_SHARED, dev->driver->name, dev);
+       ret = request_irq(pdev->irq, gma_irq_handler, IRQF_SHARED, dev->driver->name, dev);
        if (ret)
                return ret;
 
@@ -369,6 +376,8 @@ void gma_irq_uninstall(struct drm_device *dev)
        spin_unlock_irqrestore(&dev_priv->irqmask_lock, irqflags);
 
        free_irq(pdev->irq, dev);
+       if (dev_priv->use_msi)
+               pci_disable_msi(pdev);
 }
 
 int gma_crtc_enable_vblank(struct drm_crtc *crtc)
index b51e395194fff2c50fd46cb369377f0007ce09ec..7648f69824a5d4c5b2edf381b30c56524c4cf9c6 100644 (file)
@@ -17,7 +17,7 @@ struct drm_device;
 
 void gma_irq_preinstall(struct drm_device *dev);
 void gma_irq_postinstall(struct drm_device *dev);
-int  gma_irq_install(struct drm_device *dev, unsigned int irq);
+int  gma_irq_install(struct drm_device *dev);
 void gma_irq_uninstall(struct drm_device *dev);
 
 int  gma_crtc_enable_vblank(struct drm_crtc *crtc);
index 073adfe438dddc4775b69cce4617c735059c71a7..4e41c144a2902a20eed70c8c669f59392f1681b5 100644 (file)
@@ -2,6 +2,7 @@
 config DRM_HISI_HIBMC
        tristate "DRM Support for Hisilicon Hibmc"
        depends on DRM && PCI && (ARM64 || COMPILE_TEST)
+       depends on MMU
        select DRM_KMS_HELPER
        select DRM_VRAM_HELPER
        select DRM_TTM
index 6d11e7938c8370f4616a2e6c726c9258e1926d6f..f84d39762a72bef2a62fd904d0c9a59984ff6f4f 100644 (file)
@@ -23,9 +23,6 @@
 #define DRIVER_MAJOR 1
 #define DRIVER_MINOR 0
 
-#define PCI_VENDOR_ID_MICROSOFT 0x1414
-#define PCI_DEVICE_ID_HYPERV_VIDEO 0x5353
-
 DEFINE_DRM_GEM_FOPS(hv_fops);
 
 static struct drm_driver hyperv_driver = {
@@ -133,7 +130,6 @@ static int hyperv_vmbus_probe(struct hv_device *hdev,
        }
 
        ret = hyperv_setup_vram(hv, hdev);
-
        if (ret)
                goto err_vmbus_close;
 
@@ -150,18 +146,20 @@ static int hyperv_vmbus_probe(struct hv_device *hdev,
 
        ret = hyperv_mode_config_init(hv);
        if (ret)
-               goto err_vmbus_close;
+               goto err_free_mmio;
 
        ret = drm_dev_register(dev, 0);
        if (ret) {
                drm_err(dev, "Failed to register drm driver.\n");
-               goto err_vmbus_close;
+               goto err_free_mmio;
        }
 
        drm_fbdev_generic_setup(dev, 0);
 
        return 0;
 
+err_free_mmio:
+       vmbus_free_mmio(hv->mem->start, hv->fb_size);
 err_vmbus_close:
        vmbus_close(hdev->channel);
 err_hv_set_drv_data:
index 885c74f60366b83e8c5a4bc92f542276fe91367b..1390729401a07f1b08f9bff5c8ecd09d1ebc9488 100644 (file)
@@ -1629,6 +1629,8 @@ static int gen11_dsi_dsc_compute_config(struct intel_encoder *encoder,
        /* FIXME: initialize from VBT */
        vdsc_cfg->rc_model_size = DSC_RC_MODEL_SIZE_CONST;
 
+       vdsc_cfg->pic_height = crtc_state->hw.adjusted_mode.crtc_vdisplay;
+
        ret = intel_dsc_compute_params(crtc_state);
        if (ret)
                return ret;
index ac90d455a7c737df8e90e9a26305eb9d082da41f..3ed7eeacc706be3eb6ffdb199053bd140c8ba63c 100644 (file)
@@ -389,23 +389,13 @@ static int dg2_max_source_rate(struct intel_dp *intel_dp)
        return intel_dp_is_edp(intel_dp) ? 810000 : 1350000;
 }
 
-static bool is_low_voltage_sku(struct drm_i915_private *i915, enum phy phy)
-{
-       u32 voltage;
-
-       voltage = intel_de_read(i915, ICL_PORT_COMP_DW3(phy)) & VOLTAGE_INFO_MASK;
-
-       return voltage == VOLTAGE_INFO_0_85V;
-}
-
 static int icl_max_source_rate(struct intel_dp *intel_dp)
 {
        struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
        struct drm_i915_private *dev_priv = to_i915(dig_port->base.base.dev);
        enum phy phy = intel_port_to_phy(dev_priv, dig_port->base.port);
 
-       if (intel_phy_is_combo(dev_priv, phy) &&
-           (is_low_voltage_sku(dev_priv, phy) || !intel_dp_is_edp(intel_dp)))
+       if (intel_phy_is_combo(dev_priv, phy) && !intel_dp_is_edp(intel_dp))
                return 540000;
 
        return 810000;
@@ -413,23 +403,7 @@ static int icl_max_source_rate(struct intel_dp *intel_dp)
 
 static int ehl_max_source_rate(struct intel_dp *intel_dp)
 {
-       struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
-       struct drm_i915_private *dev_priv = to_i915(dig_port->base.base.dev);
-       enum phy phy = intel_port_to_phy(dev_priv, dig_port->base.port);
-
-       if (intel_dp_is_edp(intel_dp) || is_low_voltage_sku(dev_priv, phy))
-               return 540000;
-
-       return 810000;
-}
-
-static int dg1_max_source_rate(struct intel_dp *intel_dp)
-{
-       struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
-       struct drm_i915_private *i915 = to_i915(dig_port->base.base.dev);
-       enum phy phy = intel_port_to_phy(i915, dig_port->base.port);
-
-       if (intel_phy_is_combo(i915, phy) && is_low_voltage_sku(i915, phy))
+       if (intel_dp_is_edp(intel_dp))
                return 540000;
 
        return 810000;
@@ -491,7 +465,7 @@ intel_dp_set_source_rates(struct intel_dp *intel_dp)
                        max_rate = dg2_max_source_rate(intel_dp);
                else if (IS_ALDERLAKE_P(dev_priv) || IS_ALDERLAKE_S(dev_priv) ||
                         IS_DG1(dev_priv) || IS_ROCKETLAKE(dev_priv))
-                       max_rate = dg1_max_source_rate(intel_dp);
+                       max_rate = 810000;
                else if (IS_JSL_EHL(dev_priv))
                        max_rate = ehl_max_source_rate(intel_dp);
                else
@@ -1395,6 +1369,7 @@ static int intel_dp_dsc_compute_params(struct intel_encoder *encoder,
         * DP_DSC_RC_BUF_SIZE for this.
         */
        vdsc_cfg->rc_model_size = DSC_RC_MODEL_SIZE_CONST;
+       vdsc_cfg->pic_height = crtc_state->hw.adjusted_mode.crtc_vdisplay;
 
        /*
         * Slice Height of 8 works for all currently available panels. So start
index 43e1bbc1e3035ff989f437133d7b6e3232d941d5..ca530f0733e0e7c3e92d557d364d18c27c4fa47e 100644 (file)
@@ -460,7 +460,6 @@ int intel_dsc_compute_params(struct intel_crtc_state *pipe_config)
        u8 i = 0;
 
        vdsc_cfg->pic_width = pipe_config->hw.adjusted_mode.crtc_hdisplay;
-       vdsc_cfg->pic_height = pipe_config->hw.adjusted_mode.crtc_vdisplay;
        vdsc_cfg->slice_width = DIV_ROUND_UP(vdsc_cfg->pic_width,
                                             pipe_config->dsc.slice_count);
 
index dabdfe09f5e51438c7d9b203194316f48b71b1d9..0bcde53c50c61578eee1aed70356d82751abd269 100644 (file)
@@ -1269,6 +1269,10 @@ static void i915_gem_context_release_work(struct work_struct *work)
        trace_i915_context_free(ctx);
        GEM_BUG_ON(!i915_gem_context_is_closed(ctx));
 
+       spin_lock(&ctx->i915->gem.contexts.lock);
+       list_del(&ctx->link);
+       spin_unlock(&ctx->i915->gem.contexts.lock);
+
        if (ctx->syncobj)
                drm_syncobj_put(ctx->syncobj);
 
@@ -1521,10 +1525,6 @@ static void context_close(struct i915_gem_context *ctx)
 
        ctx->file_priv = ERR_PTR(-EBADF);
 
-       spin_lock(&ctx->i915->gem.contexts.lock);
-       list_del(&ctx->link);
-       spin_unlock(&ctx->i915->gem.contexts.lock);
-
        client = ctx->client;
        if (client) {
                spin_lock(&client->ctx_lock);
index 834c707d1877b82262e13579905c45a20a325911..3e91f44829e92cf54181904af174c6fc2cef6944 100644 (file)
@@ -1438,7 +1438,12 @@ void intel_guc_busyness_park(struct intel_gt *gt)
        if (!guc_submission_initialized(guc))
                return;
 
-       cancel_delayed_work(&guc->timestamp.work);
+       /*
+        * There is a race with suspend flow where the worker runs after suspend
+        * and causes an unclaimed register access warning. Cancel the worker
+        * synchronously here.
+        */
+       cancel_delayed_work_sync(&guc->timestamp.work);
 
        /*
         * Before parking, we should sample engine busyness stats if we need to.
index 702e5b89be2266c09a9be9fbf708463de30e027b..b605d0ceaefad31b19b7dfbecc272b882652802f 100644 (file)
@@ -1191,7 +1191,8 @@ void i915_gem_driver_release(struct drm_i915_private *dev_priv)
 
        intel_uc_cleanup_firmwares(&to_gt(dev_priv)->uc);
 
-       i915_gem_drain_freed_objects(dev_priv);
+       /* Flush any outstanding work, including i915_gem_context.release_work. */
+       i915_gem_drain_workqueue(dev_priv);
 
        drm_WARN_ON(&dev_priv->drm, !list_empty(&dev_priv->gem.contexts.list));
 }
index 3168d7007e10177bdb15da551c1f5e08caa458f0..135d04c2d41c8cfc9ceb84f973e1afc5027e3ee9 100644 (file)
 
 #define GT0_PERF_LIMIT_REASONS         _MMIO(0x1381a8)
 #define   GT0_PERF_LIMIT_REASONS_MASK  0xde3
-#define   PROCHOT_MASK                 REG_BIT(1)
-#define   THERMAL_LIMIT_MASK           REG_BIT(2)
-#define   RATL_MASK                    REG_BIT(6)
-#define   VR_THERMALERT_MASK           REG_BIT(7)
-#define   VR_TDC_MASK                  REG_BIT(8)
-#define   POWER_LIMIT_4_MASK           REG_BIT(9)
-#define   POWER_LIMIT_1_MASK           REG_BIT(11)
-#define   POWER_LIMIT_2_MASK           REG_BIT(12)
+#define   PROCHOT_MASK                 REG_BIT(0)
+#define   THERMAL_LIMIT_MASK           REG_BIT(1)
+#define   RATL_MASK                    REG_BIT(5)
+#define   VR_THERMALERT_MASK           REG_BIT(6)
+#define   VR_TDC_MASK                  REG_BIT(7)
+#define   POWER_LIMIT_4_MASK           REG_BIT(8)
+#define   POWER_LIMIT_1_MASK           REG_BIT(10)
+#define   POWER_LIMIT_2_MASK           REG_BIT(11)
 
 #define CHV_CLK_CTL1                   _MMIO(0x101100)
 #define VLV_CLK_CTL2                   _MMIO(0x101104)
index 26037171649006b3a6433e5541625e2fc2bb72c9..373582cfd8f31bbe9203fe8adc0162c181585de7 100644 (file)
@@ -1882,12 +1882,13 @@ int _i915_vma_move_to_active(struct i915_vma *vma,
                enum dma_resv_usage usage;
                int idx;
 
-               obj->read_domains = 0;
                if (flags & EXEC_OBJECT_WRITE) {
                        usage = DMA_RESV_USAGE_WRITE;
                        obj->write_domain = I915_GEM_DOMAIN_RENDER;
+                       obj->read_domains = 0;
                } else {
                        usage = DMA_RESV_USAGE_READ;
+                       obj->write_domain = 0;
                }
 
                dma_fence_array_for_each(curr, idx, fence)
index 2d72cc5ddaba4fea36ee175d1159ecb39990abf8..6b6d5335c8347bed246d357a6454c35622f5b4e5 100644 (file)
@@ -157,7 +157,7 @@ static void mtk_dither_config(struct device *dev, unsigned int w,
 {
        struct mtk_ddp_comp_dev *priv = dev_get_drvdata(dev);
 
-       mtk_ddp_write(cmdq_pkt, h << 16 | w, &priv->cmdq_reg, priv->regs, DISP_REG_DITHER_SIZE);
+       mtk_ddp_write(cmdq_pkt, w << 16 | h, &priv->cmdq_reg, priv->regs, DISP_REG_DITHER_SIZE);
        mtk_ddp_write(cmdq_pkt, DITHER_RELAY_MODE, &priv->cmdq_reg, priv->regs,
                      DISP_REG_DITHER_CFG);
        mtk_dither_set_common(priv->regs, &priv->cmdq_reg, bpc, DISP_REG_DITHER_CFG,
index 9cc406e1eee197a1a150d11e6d8ea7a388fc4493..3b7d13028fb6b7577111b0dfac42a1338cfbfd8b 100644 (file)
@@ -685,6 +685,16 @@ static void mtk_dsi_poweroff(struct mtk_dsi *dsi)
        if (--dsi->refcount != 0)
                return;
 
+       /*
+        * mtk_dsi_stop() and mtk_dsi_start() is asymmetric, since
+        * mtk_dsi_stop() should be called after mtk_drm_crtc_atomic_disable(),
+        * which needs irq for vblank, and mtk_dsi_stop() will disable irq.
+        * mtk_dsi_start() needs to be called in mtk_output_dsi_enable(),
+        * after dsi is fully set.
+        */
+       mtk_dsi_stop(dsi);
+
+       mtk_dsi_switch_to_cmd_mode(dsi, VM_DONE_INT_FLAG, 500);
        mtk_dsi_reset_engine(dsi);
        mtk_dsi_lane0_ulp_mode_enter(dsi);
        mtk_dsi_clk_ulp_mode_enter(dsi);
@@ -735,17 +745,6 @@ static void mtk_output_dsi_disable(struct mtk_dsi *dsi)
        if (!dsi->enabled)
                return;
 
-       /*
-        * mtk_dsi_stop() and mtk_dsi_start() is asymmetric, since
-        * mtk_dsi_stop() should be called after mtk_drm_crtc_atomic_disable(),
-        * which needs irq for vblank, and mtk_dsi_stop() will disable irq.
-        * mtk_dsi_start() needs to be called in mtk_output_dsi_enable(),
-        * after dsi is fully set.
-        */
-       mtk_dsi_stop(dsi);
-
-       mtk_dsi_switch_to_cmd_mode(dsi, VM_DONE_INT_FLAG, 500);
-
        dsi->enabled = false;
 }
 
@@ -808,10 +807,13 @@ static void mtk_dsi_bridge_atomic_post_disable(struct drm_bridge *bridge,
 
 static const struct drm_bridge_funcs mtk_dsi_bridge_funcs = {
        .attach = mtk_dsi_bridge_attach,
+       .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state,
        .atomic_disable = mtk_dsi_bridge_atomic_disable,
+       .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state,
        .atomic_enable = mtk_dsi_bridge_atomic_enable,
        .atomic_pre_enable = mtk_dsi_bridge_atomic_pre_enable,
        .atomic_post_disable = mtk_dsi_bridge_atomic_post_disable,
+       .atomic_reset = drm_atomic_helper_bridge_reset,
        .mode_set = mtk_dsi_bridge_mode_set,
 };
 
index b9ac932af8d008fb75815186913a51485733c079..03acc68abf2c51791a7cd5250ee7a8cecd7ad784 100644 (file)
@@ -170,7 +170,7 @@ static void meson_plane_atomic_update(struct drm_plane *plane,
 
        /* Enable OSD and BLK0, set max global alpha */
        priv->viu.osd1_ctrl_stat = OSD_ENABLE |
-                                  (0xFF << OSD_GLOBAL_ALPHA_SHIFT) |
+                                  (0x100 << OSD_GLOBAL_ALPHA_SHIFT) |
                                   OSD_BLK0_ENABLE;
 
        priv->viu.osd1_ctrl_stat2 = readl(priv->io_base +
index bb7e109534de1e958c69fdfd52feae53c5112a0b..d4b907889a21d199a43f0af7a7a6bcf56ec201c8 100644 (file)
@@ -94,7 +94,7 @@ static void meson_viu_set_g12a_osd1_matrix(struct meson_drm *priv,
                priv->io_base + _REG(VPP_WRAP_OSD1_MATRIX_COEF11_12));
        writel(((m[9] & 0x1fff) << 16) | (m[10] & 0x1fff),
                priv->io_base + _REG(VPP_WRAP_OSD1_MATRIX_COEF20_21));
-       writel((m[11] & 0x1fff) << 16,
+       writel((m[11] & 0x1fff),
                priv->io_base + _REG(VPP_WRAP_OSD1_MATRIX_COEF22));
 
        writel(((m[18] & 0xfff) << 16) | (m[19] & 0xfff),
index 251a1bb648cc30903d494b4f631e3c67b050629d..a222bf76804f24d5051dbe0a413798a7f1d29648 100644 (file)
@@ -262,7 +262,11 @@ mgag200_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
        if (ret)
                return ret;
 
-       drm_fbdev_generic_setup(dev, 0);
+       /*
+        * FIXME: A 24-bit color depth does not work with 24 bpp on
+        * G200ER. Force 32 bpp.
+        */
+       drm_fbdev_generic_setup(dev, 32);
 
        return 0;
 }
index cdb154c8b866bbbee2952ab92f1c5b65bc89d000..b75c690bb0cc271b42964765e2f7fd1893dd6b55 100644 (file)
@@ -1295,7 +1295,8 @@ static const struct panel_desc innolux_n116bca_ea1 = {
        },
        .delay = {
                .hpd_absent = 200,
-               .prepare_to_enable = 80,
+               .enable = 80,
+               .disable = 50,
                .unprepare = 500,
        },
 };
index ff5e1a44c43a513a7e8f46a63a914e952ca1f8c6..1e716c23019a148eb1c17484c30b9dbf986a9f5e 100644 (file)
@@ -2257,7 +2257,7 @@ static const struct panel_desc innolux_g121i1_l01 = {
                .enable = 200,
                .disable = 20,
        },
-       .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
+       .bus_format = MEDIA_BUS_FMT_RGB666_1X7X3_SPWG,
        .connector_type = DRM_MODE_CONNECTOR_LVDS,
 };
 
index c204e9b95c1f749d9e2de03929b1c6aa1c76ebb1..518ee13b1d6f42b39516bd12a5f637367404d939 100644 (file)
@@ -283,8 +283,9 @@ static int cdn_dp_connector_get_modes(struct drm_connector *connector)
        return ret;
 }
 
-static int cdn_dp_connector_mode_valid(struct drm_connector *connector,
-                                      struct drm_display_mode *mode)
+static enum drm_mode_status
+cdn_dp_connector_mode_valid(struct drm_connector *connector,
+                           struct drm_display_mode *mode)
 {
        struct cdn_dp_device *dp = connector_to_dp(connector);
        struct drm_display_info *display_info = &dp->connector.display_info;
index e4631f515ba42a33e2a359ba83844bbce606095a..f9aa8b96c69529c58a6eac609735b3859b8cc8b3 100644 (file)
@@ -1439,11 +1439,15 @@ static void rk3568_set_intf_mux(struct vop2_video_port *vp, int id,
                die &= ~RK3568_SYS_DSP_INFACE_EN_HDMI_MUX;
                die |= RK3568_SYS_DSP_INFACE_EN_HDMI |
                           FIELD_PREP(RK3568_SYS_DSP_INFACE_EN_HDMI_MUX, vp->id);
+               dip &= ~RK3568_DSP_IF_POL__HDMI_PIN_POL;
+               dip |= FIELD_PREP(RK3568_DSP_IF_POL__HDMI_PIN_POL, polflags);
                break;
        case ROCKCHIP_VOP2_EP_EDP0:
                die &= ~RK3568_SYS_DSP_INFACE_EN_EDP_MUX;
                die |= RK3568_SYS_DSP_INFACE_EN_EDP |
                           FIELD_PREP(RK3568_SYS_DSP_INFACE_EN_EDP_MUX, vp->id);
+               dip &= ~RK3568_DSP_IF_POL__EDP_PIN_POL;
+               dip |= FIELD_PREP(RK3568_DSP_IF_POL__EDP_PIN_POL, polflags);
                break;
        case ROCKCHIP_VOP2_EP_MIPI0:
                die &= ~RK3568_SYS_DSP_INFACE_EN_MIPI0_MUX;
index 660036da744953ef93ccd204df470b04e64daaee..922d83eb7ddfacf2a43132a438c57af494f0d1f0 100644 (file)
@@ -129,7 +129,7 @@ static void fcopy_send_data(struct work_struct *dummy)
 
        /*
         * The  strings sent from the host are encoded in
-        * in utf16; convert it to utf8 strings.
+        * utf16; convert it to utf8 strings.
         * The host assures us that the utf16 strings will not exceed
         * the max lengths specified. We will however, reserve room
         * for the string terminating character - in the utf16s_utf8s()
index 23c680d1a0f5415735f2ba9d99ec47500a7fbe44..3c833ea60db650f87252d76659b530ff9a7eb34c 100644 (file)
@@ -35,6 +35,7 @@
 #include <linux/kernel.h>
 #include <linux/syscore_ops.h>
 #include <linux/dma-map-ops.h>
+#include <linux/pci.h>
 #include <clocksource/hyperv_timer.h>
 #include "hyperv_vmbus.h"
 
@@ -2262,26 +2263,43 @@ static int vmbus_acpi_remove(struct acpi_device *device)
 
 static void vmbus_reserve_fb(void)
 {
-       int size;
+       resource_size_t start = 0, size;
+       struct pci_dev *pdev;
+
+       if (efi_enabled(EFI_BOOT)) {
+               /* Gen2 VM: get FB base from EFI framebuffer */
+               start = screen_info.lfb_base;
+               size = max_t(__u32, screen_info.lfb_size, 0x800000);
+       } else {
+               /* Gen1 VM: get FB base from PCI */
+               pdev = pci_get_device(PCI_VENDOR_ID_MICROSOFT,
+                                     PCI_DEVICE_ID_HYPERV_VIDEO, NULL);
+               if (!pdev)
+                       return;
+
+               if (pdev->resource[0].flags & IORESOURCE_MEM) {
+                       start = pci_resource_start(pdev, 0);
+                       size = pci_resource_len(pdev, 0);
+               }
+
+               /*
+                * Release the PCI device so hyperv_drm or hyperv_fb driver can
+                * grab it later.
+                */
+               pci_dev_put(pdev);
+       }
+
+       if (!start)
+               return;
+
        /*
         * Make a claim for the frame buffer in the resource tree under the
         * first node, which will be the one below 4GB.  The length seems to
         * be underreported, particularly in a Generation 1 VM.  So start out
         * reserving a larger area and make it smaller until it succeeds.
         */
-
-       if (screen_info.lfb_base) {
-               if (efi_enabled(EFI_BOOT))
-                       size = max_t(__u32, screen_info.lfb_size, 0x800000);
-               else
-                       size = max_t(__u32, screen_info.lfb_size, 0x4000000);
-
-               for (; !fb_mmio && (size >= 0x100000); size >>= 1) {
-                       fb_mmio = __request_region(hyperv_mmio,
-                                                  screen_info.lfb_base, size,
-                                                  fb_mmio_name, 0);
-               }
-       }
+       for (; !fb_mmio && (size >= 0x100000); size >>= 1)
+               fb_mmio = __request_region(hyperv_mmio, start, size, fb_mmio_name, 0);
 }
 
 /**
@@ -2313,7 +2331,7 @@ int vmbus_allocate_mmio(struct resource **new, struct hv_device *device_obj,
                        bool fb_overlap_ok)
 {
        struct resource *iter, *shadow;
-       resource_size_t range_min, range_max, start;
+       resource_size_t range_min, range_max, start, end;
        const char *dev_n = dev_name(&device_obj->device);
        int retval;
 
@@ -2348,6 +2366,14 @@ int vmbus_allocate_mmio(struct resource **new, struct hv_device *device_obj,
                range_max = iter->end;
                start = (range_min + align - 1) & ~(align - 1);
                for (; start + size - 1 <= range_max; start += align) {
+                       end = start + size - 1;
+
+                       /* Skip the whole fb_mmio region if not fb_overlap_ok */
+                       if (!fb_overlap_ok && fb_mmio &&
+                           (((start >= fb_mmio->start) && (start <= fb_mmio->end)) ||
+                            ((end >= fb_mmio->start) && (end <= fb_mmio->end))))
+                               continue;
+
                        shadow = __request_region(iter, start, size, NULL,
                                                  IORESOURCE_BUSY);
                        if (!shadow)
index 497c912ad9e139ddbeae26d7bbfcdb2cd920b79a..5a8f780e7ffd8d95fa162a06c165aac8f2c35cc4 100644 (file)
@@ -2349,13 +2349,6 @@ static int dmar_device_hotplug(acpi_handle handle, bool insert)
        if (!dmar_in_use())
                return 0;
 
-       /*
-        * It's unlikely that any I/O board is hot added before the IOMMU
-        * subsystem is initialized.
-        */
-       if (IS_ENABLED(CONFIG_INTEL_IOMMU) && !intel_iommu_enabled)
-               return -EOPNOTSUPP;
-
        if (dmar_detect_dsm(handle, DMAR_DSM_FUNC_DRHD)) {
                tmp = handle;
        } else {
index 1f2cd43cf9bcf00ff907b5c97a683929d92eceef..31bc50e538a341320564cfe9b5cdf0033c5e70b5 100644 (file)
@@ -399,7 +399,7 @@ static unsigned long __iommu_calculate_sagaw(struct intel_iommu *iommu)
 {
        unsigned long fl_sagaw, sl_sagaw;
 
-       fl_sagaw = BIT(2) | (cap_fl1gp_support(iommu->cap) ? BIT(3) : 0);
+       fl_sagaw = BIT(2) | (cap_5lp_support(iommu->cap) ? BIT(3) : 0);
        sl_sagaw = cap_sagaw(iommu->cap);
 
        /* Second level only. */
@@ -3019,7 +3019,13 @@ static int __init init_dmars(void)
 
 #ifdef CONFIG_INTEL_IOMMU_SVM
                if (pasid_supported(iommu) && ecap_prs(iommu->ecap)) {
+                       /*
+                        * Call dmar_alloc_hwirq() with dmar_global_lock held,
+                        * could cause possible lock race condition.
+                        */
+                       up_write(&dmar_global_lock);
                        ret = intel_svm_enable_prq(iommu);
+                       down_write(&dmar_global_lock);
                        if (ret)
                                goto free_iommu;
                }
@@ -3932,6 +3938,7 @@ int __init intel_iommu_init(void)
        force_on = (!intel_iommu_tboot_noforce && tboot_force_iommu()) ||
                    platform_optin_force_iommu();
 
+       down_write(&dmar_global_lock);
        if (dmar_table_init()) {
                if (force_on)
                        panic("tboot: Failed to initialize DMAR table\n");
@@ -3944,6 +3951,16 @@ int __init intel_iommu_init(void)
                goto out_free_dmar;
        }
 
+       up_write(&dmar_global_lock);
+
+       /*
+        * The bus notifier takes the dmar_global_lock, so lockdep will
+        * complain later when we register it under the lock.
+        */
+       dmar_register_bus_notifier();
+
+       down_write(&dmar_global_lock);
+
        if (!no_iommu)
                intel_iommu_debugfs_init();
 
@@ -3988,9 +4005,11 @@ int __init intel_iommu_init(void)
                pr_err("Initialization failed\n");
                goto out_free_dmar;
        }
+       up_write(&dmar_global_lock);
 
        init_iommu_pm_ops();
 
+       down_read(&dmar_global_lock);
        for_each_active_iommu(iommu, drhd) {
                /*
                 * The flush queue implementation does not perform
@@ -4008,11 +4027,13 @@ int __init intel_iommu_init(void)
                                       "%s", iommu->name);
                iommu_device_register(&iommu->iommu, &intel_iommu_ops, NULL);
        }
+       up_read(&dmar_global_lock);
 
        bus_set_iommu(&pci_bus_type, &intel_iommu_ops);
        if (si_domain && !hw_pass_through)
                register_memory_notifier(&intel_iommu_memory_nb);
 
+       down_read(&dmar_global_lock);
        if (probe_acpi_namespace_devices())
                pr_warn("ACPI name space devices didn't probe correctly\n");
 
@@ -4023,15 +4044,17 @@ int __init intel_iommu_init(void)
 
                iommu_disable_protect_mem_regions(iommu);
        }
+       up_read(&dmar_global_lock);
 
-       intel_iommu_enabled = 1;
-       dmar_register_bus_notifier();
        pr_info("Intel(R) Virtualization Technology for Directed I/O\n");
 
+       intel_iommu_enabled = 1;
+
        return 0;
 
 out_free_dmar:
        intel_iommu_free_dmars();
+       up_write(&dmar_global_lock);
        return ret;
 }
 
index 184608bd89999cfc15f75ae0c259371d6758c7e3..e58a1e0cadd2e1fc8b6278fe8d0700da4b90afc6 100644 (file)
@@ -88,8 +88,9 @@ static const u8 null_mac_addr[ETH_ALEN + 2] __long_aligned = {
 static const u16 ad_ticks_per_sec = 1000 / AD_TIMER_INTERVAL;
 static const int ad_delta_in_ticks = (AD_TIMER_INTERVAL * HZ) / 1000;
 
-static const u8 lacpdu_mcast_addr[ETH_ALEN + 2] __long_aligned =
-       MULTICAST_LACPDU_ADDR;
+const u8 lacpdu_mcast_addr[ETH_ALEN + 2] __long_aligned = {
+       0x01, 0x80, 0xC2, 0x00, 0x00, 0x02
+};
 
 /* ================= main 802.3ad protocol functions ================== */
 static int ad_lacpdu_send(struct port *port);
index 5c2febe9442814ee007963356eb95978364f45dd..86d42306aa5ee2879b0649214589aa29bb114920 100644 (file)
@@ -865,12 +865,8 @@ static void bond_hw_addr_flush(struct net_device *bond_dev,
        dev_uc_unsync(slave_dev, bond_dev);
        dev_mc_unsync(slave_dev, bond_dev);
 
-       if (BOND_MODE(bond) == BOND_MODE_8023AD) {
-               /* del lacpdu mc addr from mc list */
-               u8 lacpdu_multicast[ETH_ALEN] = MULTICAST_LACPDU_ADDR;
-
-               dev_mc_del(slave_dev, lacpdu_multicast);
-       }
+       if (BOND_MODE(bond) == BOND_MODE_8023AD)
+               dev_mc_del(slave_dev, lacpdu_mcast_addr);
 }
 
 /*--------------------------- Active slave change ---------------------------*/
@@ -890,7 +886,8 @@ static void bond_hw_addr_swap(struct bonding *bond, struct slave *new_active,
                if (bond->dev->flags & IFF_ALLMULTI)
                        dev_set_allmulti(old_active->dev, -1);
 
-               bond_hw_addr_flush(bond->dev, old_active->dev);
+               if (bond->dev->flags & IFF_UP)
+                       bond_hw_addr_flush(bond->dev, old_active->dev);
        }
 
        if (new_active) {
@@ -901,10 +898,12 @@ static void bond_hw_addr_swap(struct bonding *bond, struct slave *new_active,
                if (bond->dev->flags & IFF_ALLMULTI)
                        dev_set_allmulti(new_active->dev, 1);
 
-               netif_addr_lock_bh(bond->dev);
-               dev_uc_sync(new_active->dev, bond->dev);
-               dev_mc_sync(new_active->dev, bond->dev);
-               netif_addr_unlock_bh(bond->dev);
+               if (bond->dev->flags & IFF_UP) {
+                       netif_addr_lock_bh(bond->dev);
+                       dev_uc_sync(new_active->dev, bond->dev);
+                       dev_mc_sync(new_active->dev, bond->dev);
+                       netif_addr_unlock_bh(bond->dev);
+               }
        }
 }
 
@@ -2166,16 +2165,14 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev,
                        }
                }
 
-               netif_addr_lock_bh(bond_dev);
-               dev_mc_sync_multiple(slave_dev, bond_dev);
-               dev_uc_sync_multiple(slave_dev, bond_dev);
-               netif_addr_unlock_bh(bond_dev);
-
-               if (BOND_MODE(bond) == BOND_MODE_8023AD) {
-                       /* add lacpdu mc addr to mc list */
-                       u8 lacpdu_multicast[ETH_ALEN] = MULTICAST_LACPDU_ADDR;
+               if (bond_dev->flags & IFF_UP) {
+                       netif_addr_lock_bh(bond_dev);
+                       dev_mc_sync_multiple(slave_dev, bond_dev);
+                       dev_uc_sync_multiple(slave_dev, bond_dev);
+                       netif_addr_unlock_bh(bond_dev);
 
-                       dev_mc_add(slave_dev, lacpdu_multicast);
+                       if (BOND_MODE(bond) == BOND_MODE_8023AD)
+                               dev_mc_add(slave_dev, lacpdu_mcast_addr);
                }
        }
 
@@ -2447,7 +2444,8 @@ static int __bond_release_one(struct net_device *bond_dev,
                if (old_flags & IFF_ALLMULTI)
                        dev_set_allmulti(slave_dev, -1);
 
-               bond_hw_addr_flush(bond_dev, slave_dev);
+               if (old_flags & IFF_UP)
+                       bond_hw_addr_flush(bond_dev, slave_dev);
        }
 
        slave_disable_netpoll(slave);
@@ -4184,6 +4182,12 @@ static int bond_open(struct net_device *bond_dev)
        struct list_head *iter;
        struct slave *slave;
 
+       if (BOND_MODE(bond) == BOND_MODE_ROUNDROBIN && !bond->rr_tx_counter) {
+               bond->rr_tx_counter = alloc_percpu(u32);
+               if (!bond->rr_tx_counter)
+                       return -ENOMEM;
+       }
+
        /* reset slave->backup and slave->inactive */
        if (bond_has_slaves(bond)) {
                bond_for_each_slave(bond, slave, iter) {
@@ -4221,6 +4225,9 @@ static int bond_open(struct net_device *bond_dev)
                /* register to receive LACPDUs */
                bond->recv_probe = bond_3ad_lacpdu_recv;
                bond_3ad_initiate_agg_selection(bond, 1);
+
+               bond_for_each_slave(bond, slave, iter)
+                       dev_mc_add(slave->dev, lacpdu_mcast_addr);
        }
 
        if (bond_mode_can_use_xmit_hash(bond))
@@ -4232,6 +4239,7 @@ static int bond_open(struct net_device *bond_dev)
 static int bond_close(struct net_device *bond_dev)
 {
        struct bonding *bond = netdev_priv(bond_dev);
+       struct slave *slave;
 
        bond_work_cancel_all(bond);
        bond->send_peer_notif = 0;
@@ -4239,6 +4247,19 @@ static int bond_close(struct net_device *bond_dev)
                bond_alb_deinitialize(bond);
        bond->recv_probe = NULL;
 
+       if (bond_uses_primary(bond)) {
+               rcu_read_lock();
+               slave = rcu_dereference(bond->curr_active_slave);
+               if (slave)
+                       bond_hw_addr_flush(bond_dev, slave->dev);
+               rcu_read_unlock();
+       } else {
+               struct list_head *iter;
+
+               bond_for_each_slave(bond, slave, iter)
+                       bond_hw_addr_flush(bond_dev, slave->dev);
+       }
+
        return 0;
 }
 
@@ -6228,15 +6249,6 @@ static int bond_init(struct net_device *bond_dev)
        if (!bond->wq)
                return -ENOMEM;
 
-       if (BOND_MODE(bond) == BOND_MODE_ROUNDROBIN) {
-               bond->rr_tx_counter = alloc_percpu(u32);
-               if (!bond->rr_tx_counter) {
-                       destroy_workqueue(bond->wq);
-                       bond->wq = NULL;
-                       return -ENOMEM;
-               }
-       }
-
        spin_lock_init(&bond->stats_lock);
        netdev_lockdep_set_classes(bond_dev);
 
index f857968efed7d3179d192f48ba3430723d480fb5..ccb438eca517d90f41ba72b656404d29d24a4143 100644 (file)
@@ -941,11 +941,6 @@ static struct sk_buff *flexcan_mailbox_read(struct can_rx_offload *offload,
        u32 reg_ctrl, reg_id, reg_iflag1;
        int i;
 
-       if (unlikely(drop)) {
-               skb = ERR_PTR(-ENOBUFS);
-               goto mark_as_read;
-       }
-
        mb = flexcan_get_mb(priv, n);
 
        if (priv->devtype_data.quirks & FLEXCAN_QUIRK_USE_RX_MAILBOX) {
@@ -974,6 +969,11 @@ static struct sk_buff *flexcan_mailbox_read(struct can_rx_offload *offload,
                reg_ctrl = priv->read(&mb->can_ctrl);
        }
 
+       if (unlikely(drop)) {
+               skb = ERR_PTR(-ENOBUFS);
+               goto mark_as_read;
+       }
+
        if (reg_ctrl & FLEXCAN_MB_CNT_EDL)
                skb = alloc_canfd_skb(offload->dev, &cfd);
        else
index baf749c8cda3f5fb68be38625aa75b0d02fb6b81..c1ff3c046d62c088f87226787419fc407f13b75c 100644 (file)
@@ -824,6 +824,7 @@ static int gs_can_open(struct net_device *netdev)
                flags |= GS_CAN_MODE_TRIPLE_SAMPLE;
 
        /* finally start device */
+       dev->can.state = CAN_STATE_ERROR_ACTIVE;
        dm->mode = cpu_to_le32(GS_CAN_MODE_START);
        dm->flags = cpu_to_le32(flags);
        rc = usb_control_msg(interface_to_usbdev(dev->iface),
@@ -835,13 +836,12 @@ static int gs_can_open(struct net_device *netdev)
        if (rc < 0) {
                netdev_err(netdev, "Couldn't start device (err=%d)\n", rc);
                kfree(dm);
+               dev->can.state = CAN_STATE_STOPPED;
                return rc;
        }
 
        kfree(dm);
 
-       dev->can.state = CAN_STATE_ERROR_ACTIVE;
-
        parent->active_channels++;
        if (!(dev->can.ctrlmode & CAN_CTRLMODE_LISTENONLY))
                netif_start_queue(netdev);
@@ -925,17 +925,21 @@ static int gs_usb_set_identify(struct net_device *netdev, bool do_identify)
 }
 
 /* blink LED's for finding the this interface */
-static int gs_usb_set_phys_id(struct net_device *dev,
+static int gs_usb_set_phys_id(struct net_device *netdev,
                              enum ethtool_phys_id_state state)
 {
+       const struct gs_can *dev = netdev_priv(netdev);
        int rc = 0;
 
+       if (!(dev->feature & GS_CAN_FEATURE_IDENTIFY))
+               return -EOPNOTSUPP;
+
        switch (state) {
        case ETHTOOL_ID_ACTIVE:
-               rc = gs_usb_set_identify(dev, GS_CAN_IDENTIFY_ON);
+               rc = gs_usb_set_identify(netdev, GS_CAN_IDENTIFY_ON);
                break;
        case ETHTOOL_ID_INACTIVE:
-               rc = gs_usb_set_identify(dev, GS_CAN_IDENTIFY_OFF);
+               rc = gs_usb_set_identify(netdev, GS_CAN_IDENTIFY_OFF);
                break;
        default:
                break;
@@ -1072,9 +1076,10 @@ static struct gs_can *gs_make_candev(unsigned int channel,
                dev->feature |= GS_CAN_FEATURE_REQ_USB_QUIRK_LPC546XX |
                        GS_CAN_FEATURE_QUIRK_BREQ_CANTACT_PRO;
 
-       if (le32_to_cpu(dconf->sw_version) > 1)
-               if (feature & GS_CAN_FEATURE_IDENTIFY)
-                       netdev->ethtool_ops = &gs_usb_ethtool_ops;
+       /* GS_CAN_FEATURE_IDENTIFY is only supported for sw_version > 1 */
+       if (!(le32_to_cpu(dconf->sw_version) > 1 &&
+             feature & GS_CAN_FEATURE_IDENTIFY))
+               dev->feature &= ~GS_CAN_FEATURE_IDENTIFY;
 
        kfree(bt_const);
 
index daedd2bf20c1b6a7746cdd6ed495f2582c389836..5579644e8fde447a649c2310ff4e923999ff2e48 100644 (file)
@@ -244,10 +244,6 @@ void lan937x_port_setup(struct ksz_device *dev, int port, bool cpu_port)
                lan937x_port_cfg(dev, port, REG_PORT_CTRL_0,
                                 PORT_TAIL_TAG_ENABLE, true);
 
-       /* disable frame check length field */
-       lan937x_port_cfg(dev, port, REG_PORT_MAC_CTRL_0, PORT_CHECK_LENGTH,
-                        false);
-
        /* set back pressure for half duplex */
        lan937x_port_cfg(dev, port, REG_PORT_MAC_CTRL_1, PORT_BACK_PRESSURE,
                         true);
index 88595863d8bc6cb7472b0cb859aed1674ddc162b..8a0af371e7dc7a0c865ac0f145b2fe02f114b177 100644 (file)
@@ -94,11 +94,8 @@ static int aq_ndev_close(struct net_device *ndev)
        int err = 0;
 
        err = aq_nic_stop(aq_nic);
-       if (err < 0)
-               goto err_exit;
        aq_nic_deinit(aq_nic, true);
 
-err_exit:
        return err;
 }
 
index f46eefb5a029252e87c156f8f2f4b77ceae0003e..96da0ba3d507878de161687a852e7cec912a1616 100644 (file)
@@ -659,7 +659,6 @@ static void bnxt_tx_int(struct bnxt *bp, struct bnxt_napi *bnapi, int nr_pkts)
 
        for (i = 0; i < nr_pkts; i++) {
                struct bnxt_sw_tx_bd *tx_buf;
-               bool compl_deferred = false;
                struct sk_buff *skb;
                int j, last;
 
@@ -668,6 +667,8 @@ static void bnxt_tx_int(struct bnxt *bp, struct bnxt_napi *bnapi, int nr_pkts)
                skb = tx_buf->skb;
                tx_buf->skb = NULL;
 
+               tx_bytes += skb->len;
+
                if (tx_buf->is_push) {
                        tx_buf->is_push = 0;
                        goto next_tx_int;
@@ -688,8 +689,9 @@ static void bnxt_tx_int(struct bnxt *bp, struct bnxt_napi *bnapi, int nr_pkts)
                }
                if (unlikely(skb_shinfo(skb)->tx_flags & SKBTX_IN_PROGRESS)) {
                        if (bp->flags & BNXT_FLAG_CHIP_P5) {
+                               /* PTP worker takes ownership of the skb */
                                if (!bnxt_get_tx_ts_p5(bp, skb))
-                                       compl_deferred = true;
+                                       skb = NULL;
                                else
                                        atomic_inc(&bp->ptp_cfg->tx_avail);
                        }
@@ -698,9 +700,7 @@ static void bnxt_tx_int(struct bnxt *bp, struct bnxt_napi *bnapi, int nr_pkts)
 next_tx_int:
                cons = NEXT_TX(cons);
 
-               tx_bytes += skb->len;
-               if (!compl_deferred)
-                       dev_kfree_skb_any(skb);
+               dev_kfree_skb_any(skb);
        }
 
        netdev_tx_completed_queue(txq, nr_pkts, tx_bytes);
index 7f3c0875b6f5834e58223a13c3cfb1d46b02cec4..8e316367f6cedbf69a84caedf308b27492323cfb 100644 (file)
@@ -317,9 +317,9 @@ void bnxt_ptp_cfg_tstamp_filters(struct bnxt *bp)
 
        if (!(bp->fw_cap & BNXT_FW_CAP_RX_ALL_PKT_TS) && (ptp->tstamp_filters &
            (PORT_MAC_CFG_REQ_FLAGS_ALL_RX_TS_CAPTURE_ENABLE |
-            PORT_MAC_CFG_REQ_FLAGS_PTP_RX_TS_CAPTURE_DISABLE))) {
+            PORT_MAC_CFG_REQ_FLAGS_ALL_RX_TS_CAPTURE_DISABLE))) {
                ptp->tstamp_filters &= ~(PORT_MAC_CFG_REQ_FLAGS_ALL_RX_TS_CAPTURE_ENABLE |
-                                        PORT_MAC_CFG_REQ_FLAGS_PTP_RX_TS_CAPTURE_DISABLE);
+                                        PORT_MAC_CFG_REQ_FLAGS_ALL_RX_TS_CAPTURE_DISABLE);
                netdev_warn(bp->dev, "Unsupported FW for all RX pkts timestamp filter\n");
        }
 
index a139f2e9d59f058d22251ca9563d809da95c199d..e0e8dfd1379301c8167425a3f46e19b70b1d4a58 100644 (file)
@@ -9,7 +9,6 @@ fsl-enetc-$(CONFIG_FSL_ENETC_QOS) += enetc_qos.o
 
 obj-$(CONFIG_FSL_ENETC_VF) += fsl-enetc-vf.o
 fsl-enetc-vf-y := enetc_vf.o $(common-objs)
-fsl-enetc-vf-$(CONFIG_FSL_ENETC_QOS) += enetc_qos.o
 
 obj-$(CONFIG_FSL_ENETC_IERB) += fsl-enetc-ierb.o
 fsl-enetc-ierb-y := enetc_ierb.o
index 4470a4a3e4c3ead28f46d769436bba29e181db83..9f5b921039bd4f5935b29d9030c24ac7c22e3068 100644 (file)
@@ -2432,7 +2432,7 @@ int enetc_close(struct net_device *ndev)
        return 0;
 }
 
-static int enetc_setup_tc_mqprio(struct net_device *ndev, void *type_data)
+int enetc_setup_tc_mqprio(struct net_device *ndev, void *type_data)
 {
        struct enetc_ndev_priv *priv = netdev_priv(ndev);
        struct tc_mqprio_qopt *mqprio = type_data;
@@ -2486,25 +2486,6 @@ static int enetc_setup_tc_mqprio(struct net_device *ndev, void *type_data)
        return 0;
 }
 
-int enetc_setup_tc(struct net_device *ndev, enum tc_setup_type type,
-                  void *type_data)
-{
-       switch (type) {
-       case TC_SETUP_QDISC_MQPRIO:
-               return enetc_setup_tc_mqprio(ndev, type_data);
-       case TC_SETUP_QDISC_TAPRIO:
-               return enetc_setup_tc_taprio(ndev, type_data);
-       case TC_SETUP_QDISC_CBS:
-               return enetc_setup_tc_cbs(ndev, type_data);
-       case TC_SETUP_QDISC_ETF:
-               return enetc_setup_tc_txtime(ndev, type_data);
-       case TC_SETUP_BLOCK:
-               return enetc_setup_tc_psfp(ndev, type_data);
-       default:
-               return -EOPNOTSUPP;
-       }
-}
-
 static int enetc_setup_xdp_prog(struct net_device *dev, struct bpf_prog *prog,
                                struct netlink_ext_ack *extack)
 {
@@ -2600,29 +2581,6 @@ static int enetc_set_rss(struct net_device *ndev, int en)
        return 0;
 }
 
-static int enetc_set_psfp(struct net_device *ndev, int en)
-{
-       struct enetc_ndev_priv *priv = netdev_priv(ndev);
-       int err;
-
-       if (en) {
-               err = enetc_psfp_enable(priv);
-               if (err)
-                       return err;
-
-               priv->active_offloads |= ENETC_F_QCI;
-               return 0;
-       }
-
-       err = enetc_psfp_disable(priv);
-       if (err)
-               return err;
-
-       priv->active_offloads &= ~ENETC_F_QCI;
-
-       return 0;
-}
-
 static void enetc_enable_rxvlan(struct net_device *ndev, bool en)
 {
        struct enetc_ndev_priv *priv = netdev_priv(ndev);
@@ -2641,11 +2599,9 @@ static void enetc_enable_txvlan(struct net_device *ndev, bool en)
                enetc_bdr_enable_txvlan(&priv->si->hw, i, en);
 }
 
-int enetc_set_features(struct net_device *ndev,
-                      netdev_features_t features)
+void enetc_set_features(struct net_device *ndev, netdev_features_t features)
 {
        netdev_features_t changed = ndev->features ^ features;
-       int err = 0;
 
        if (changed & NETIF_F_RXHASH)
                enetc_set_rss(ndev, !!(features & NETIF_F_RXHASH));
@@ -2657,11 +2613,6 @@ int enetc_set_features(struct net_device *ndev,
        if (changed & NETIF_F_HW_VLAN_CTAG_TX)
                enetc_enable_txvlan(ndev,
                                    !!(features & NETIF_F_HW_VLAN_CTAG_TX));
-
-       if (changed & NETIF_F_HW_TC)
-               err = enetc_set_psfp(ndev, !!(features & NETIF_F_HW_TC));
-
-       return err;
 }
 
 #ifdef CONFIG_FSL_ENETC_PTP_CLOCK
index 29922c20531f0a43ed1e480dc769b3efb46f71ac..2cfe6944ebd32b1df738cd6a6c11c27db2ffc296 100644 (file)
@@ -393,11 +393,9 @@ void enetc_start(struct net_device *ndev);
 void enetc_stop(struct net_device *ndev);
 netdev_tx_t enetc_xmit(struct sk_buff *skb, struct net_device *ndev);
 struct net_device_stats *enetc_get_stats(struct net_device *ndev);
-int enetc_set_features(struct net_device *ndev,
-                      netdev_features_t features);
+void enetc_set_features(struct net_device *ndev, netdev_features_t features);
 int enetc_ioctl(struct net_device *ndev, struct ifreq *rq, int cmd);
-int enetc_setup_tc(struct net_device *ndev, enum tc_setup_type type,
-                  void *type_data);
+int enetc_setup_tc_mqprio(struct net_device *ndev, void *type_data);
 int enetc_setup_bpf(struct net_device *dev, struct netdev_bpf *xdp);
 int enetc_xdp_xmit(struct net_device *ndev, int num_frames,
                   struct xdp_frame **frames, u32 flags);
@@ -465,6 +463,7 @@ int enetc_setup_tc_block_cb(enum tc_setup_type type, void *type_data,
 int enetc_setup_tc_psfp(struct net_device *ndev, void *type_data);
 int enetc_psfp_init(struct enetc_ndev_priv *priv);
 int enetc_psfp_clean(struct enetc_ndev_priv *priv);
+int enetc_set_psfp(struct net_device *ndev, bool en);
 
 static inline void enetc_get_max_cap(struct enetc_ndev_priv *priv)
 {
@@ -540,4 +539,9 @@ static inline int enetc_psfp_disable(struct enetc_ndev_priv *priv)
 {
        return 0;
 }
+
+static inline int enetc_set_psfp(struct net_device *ndev, bool en)
+{
+       return 0;
+}
 #endif
index c4a0e836d4f098231249c18d6b06dbde73490a34..bb7750222691dae9608cfc1c0196d22e5f8dd537 100644 (file)
@@ -709,6 +709,13 @@ static int enetc_pf_set_features(struct net_device *ndev,
 {
        netdev_features_t changed = ndev->features ^ features;
        struct enetc_ndev_priv *priv = netdev_priv(ndev);
+       int err;
+
+       if (changed & NETIF_F_HW_TC) {
+               err = enetc_set_psfp(ndev, !!(features & NETIF_F_HW_TC));
+               if (err)
+                       return err;
+       }
 
        if (changed & NETIF_F_HW_VLAN_CTAG_FILTER) {
                struct enetc_pf *pf = enetc_si_priv(priv->si);
@@ -722,7 +729,28 @@ static int enetc_pf_set_features(struct net_device *ndev,
        if (changed & NETIF_F_LOOPBACK)
                enetc_set_loopback(ndev, !!(features & NETIF_F_LOOPBACK));
 
-       return enetc_set_features(ndev, features);
+       enetc_set_features(ndev, features);
+
+       return 0;
+}
+
+static int enetc_pf_setup_tc(struct net_device *ndev, enum tc_setup_type type,
+                            void *type_data)
+{
+       switch (type) {
+       case TC_SETUP_QDISC_MQPRIO:
+               return enetc_setup_tc_mqprio(ndev, type_data);
+       case TC_SETUP_QDISC_TAPRIO:
+               return enetc_setup_tc_taprio(ndev, type_data);
+       case TC_SETUP_QDISC_CBS:
+               return enetc_setup_tc_cbs(ndev, type_data);
+       case TC_SETUP_QDISC_ETF:
+               return enetc_setup_tc_txtime(ndev, type_data);
+       case TC_SETUP_BLOCK:
+               return enetc_setup_tc_psfp(ndev, type_data);
+       default:
+               return -EOPNOTSUPP;
+       }
 }
 
 static const struct net_device_ops enetc_ndev_ops = {
@@ -739,7 +767,7 @@ static const struct net_device_ops enetc_ndev_ops = {
        .ndo_set_vf_spoofchk    = enetc_pf_set_vf_spoofchk,
        .ndo_set_features       = enetc_pf_set_features,
        .ndo_eth_ioctl          = enetc_ioctl,
-       .ndo_setup_tc           = enetc_setup_tc,
+       .ndo_setup_tc           = enetc_pf_setup_tc,
        .ndo_bpf                = enetc_setup_bpf,
        .ndo_xdp_xmit           = enetc_xdp_xmit,
 };
index 582a663ed0ba429fd04fdf032b144e7ac1121b04..f8a2f02ce22de9c02922bb05872ca979519ef65d 100644 (file)
@@ -1517,6 +1517,29 @@ int enetc_setup_tc_block_cb(enum tc_setup_type type, void *type_data,
        }
 }
 
+int enetc_set_psfp(struct net_device *ndev, bool en)
+{
+       struct enetc_ndev_priv *priv = netdev_priv(ndev);
+       int err;
+
+       if (en) {
+               err = enetc_psfp_enable(priv);
+               if (err)
+                       return err;
+
+               priv->active_offloads |= ENETC_F_QCI;
+               return 0;
+       }
+
+       err = enetc_psfp_disable(priv);
+       if (err)
+               return err;
+
+       priv->active_offloads &= ~ENETC_F_QCI;
+
+       return 0;
+}
+
 int enetc_psfp_init(struct enetc_ndev_priv *priv)
 {
        if (epsfp.psfp_sfi_bitmap)
index 17924305afa2f1a916a8a141219643c2490dedf1..dfcaac302e245179438f8acbe6f80fe2778c7cb3 100644 (file)
@@ -88,7 +88,20 @@ static int enetc_vf_set_mac_addr(struct net_device *ndev, void *addr)
 static int enetc_vf_set_features(struct net_device *ndev,
                                 netdev_features_t features)
 {
-       return enetc_set_features(ndev, features);
+       enetc_set_features(ndev, features);
+
+       return 0;
+}
+
+static int enetc_vf_setup_tc(struct net_device *ndev, enum tc_setup_type type,
+                            void *type_data)
+{
+       switch (type) {
+       case TC_SETUP_QDISC_MQPRIO:
+               return enetc_setup_tc_mqprio(ndev, type_data);
+       default:
+               return -EOPNOTSUPP;
+       }
 }
 
 /* Probing/ Init */
@@ -100,7 +113,7 @@ static const struct net_device_ops enetc_ndev_ops = {
        .ndo_set_mac_address    = enetc_vf_set_mac_addr,
        .ndo_set_features       = enetc_vf_set_features,
        .ndo_eth_ioctl          = enetc_ioctl,
-       .ndo_setup_tc           = enetc_setup_tc,
+       .ndo_setup_tc           = enetc_vf_setup_tc,
 };
 
 static void enetc_vf_netdev_setup(struct enetc_si *si, struct net_device *ndev,
index d77ee8936c6a3a0709132b6129adb7ca3a0ef4f7..a5fed00cb971fccd2cdb97521dd0ce49b55d45ea 100644 (file)
@@ -561,6 +561,7 @@ struct fec_enet_private {
        struct clk *clk_2x_txclk;
 
        bool ptp_clk_on;
+       struct mutex ptp_clk_mutex;
        unsigned int num_tx_queues;
        unsigned int num_rx_queues;
 
@@ -638,13 +639,6 @@ struct fec_enet_private {
        int pps_enable;
        unsigned int next_counter;
 
-       struct {
-               struct timespec64 ts_phc;
-               u64 ns_sys;
-               u32 at_corr;
-               u8 at_inc_corr;
-       } ptp_saved_state;
-
        u64 ethtool_stats[];
 };
 
@@ -655,8 +649,5 @@ void fec_ptp_disable_hwts(struct net_device *ndev);
 int fec_ptp_set(struct net_device *ndev, struct ifreq *ifr);
 int fec_ptp_get(struct net_device *ndev, struct ifreq *ifr);
 
-void fec_ptp_save_state(struct fec_enet_private *fep);
-int fec_ptp_restore_state(struct fec_enet_private *fep);
-
 /****************************************************************************/
 #endif /* FEC_H */
index 6152f6dbf1bcf4fc3f406cef4b4970327beb3e73..92c55e1a55076f313e077199b39a7d810aeb4c43 100644 (file)
@@ -286,11 +286,8 @@ MODULE_PARM_DESC(macaddr, "FEC Ethernet MAC address");
 #define FEC_MMFR_TA            (2 << 16)
 #define FEC_MMFR_DATA(v)       (v & 0xffff)
 /* FEC ECR bits definition */
-#define FEC_ECR_RESET   BIT(0)
-#define FEC_ECR_ETHEREN BIT(1)
-#define FEC_ECR_MAGICEN BIT(2)
-#define FEC_ECR_SLEEP   BIT(3)
-#define FEC_ECR_EN1588  BIT(4)
+#define FEC_ECR_MAGICEN                (1 << 2)
+#define FEC_ECR_SLEEP          (1 << 3)
 
 #define FEC_MII_TIMEOUT                30000 /* us */
 
@@ -986,9 +983,6 @@ fec_restart(struct net_device *ndev)
        u32 temp_mac[2];
        u32 rcntl = OPT_FRAME_SIZE | 0x04;
        u32 ecntl = 0x2; /* ETHEREN */
-       struct ptp_clock_request ptp_rq = { .type = PTP_CLK_REQ_PPS };
-
-       fec_ptp_save_state(fep);
 
        /* Whack a reset.  We should wait for this.
         * For i.MX6SX SOC, enet use AXI bus, we use disable MAC
@@ -1142,7 +1136,7 @@ fec_restart(struct net_device *ndev)
        }
 
        if (fep->bufdesc_ex)
-               ecntl |= FEC_ECR_EN1588;
+               ecntl |= (1 << 4);
 
        if (fep->quirks & FEC_QUIRK_DELAYED_CLKS_SUPPORT &&
            fep->rgmii_txc_dly)
@@ -1163,14 +1157,6 @@ fec_restart(struct net_device *ndev)
        if (fep->bufdesc_ex)
                fec_ptp_start_cyclecounter(ndev);
 
-       /* Restart PPS if needed */
-       if (fep->pps_enable) {
-               /* Clear flag so fec_ptp_enable_pps() doesn't return immediately */
-               fep->pps_enable = 0;
-               fec_ptp_restore_state(fep);
-               fep->ptp_caps.enable(&fep->ptp_caps, &ptp_rq, 1);
-       }
-
        /* Enable interrupts we wish to service */
        if (fep->link)
                writel(FEC_DEFAULT_IMASK, fep->hwp + FEC_IMASK);
@@ -1221,8 +1207,6 @@ fec_stop(struct net_device *ndev)
        struct fec_enet_private *fep = netdev_priv(ndev);
        u32 rmii_mode = readl(fep->hwp + FEC_R_CNTRL) & (1 << 8);
        u32 val;
-       struct ptp_clock_request ptp_rq = { .type = PTP_CLK_REQ_PPS };
-       u32 ecntl = 0;
 
        /* We cannot expect a graceful transmit stop without link !!! */
        if (fep->link) {
@@ -1232,8 +1216,6 @@ fec_stop(struct net_device *ndev)
                        netdev_err(ndev, "Graceful transmit stop did not complete!\n");
        }
 
-       fec_ptp_save_state(fep);
-
        /* Whack a reset.  We should wait for this.
         * For i.MX6SX SOC, enet use AXI bus, we use disable MAC
         * instead of reset MAC itself.
@@ -1253,28 +1235,12 @@ fec_stop(struct net_device *ndev)
        writel(fep->phy_speed, fep->hwp + FEC_MII_SPEED);
        writel(FEC_DEFAULT_IMASK, fep->hwp + FEC_IMASK);
 
-       if (fep->bufdesc_ex)
-               ecntl |= FEC_ECR_EN1588;
-
        /* We have to keep ENET enabled to have MII interrupt stay working */
        if (fep->quirks & FEC_QUIRK_ENET_MAC &&
                !(fep->wol_flag & FEC_WOL_FLAG_SLEEP_ON)) {
-               ecntl |= FEC_ECR_ETHEREN;
+               writel(2, fep->hwp + FEC_ECNTRL);
                writel(rmii_mode, fep->hwp + FEC_R_CNTRL);
        }
-
-       writel(ecntl, fep->hwp + FEC_ECNTRL);
-
-       if (fep->bufdesc_ex)
-               fec_ptp_start_cyclecounter(ndev);
-
-       /* Restart PPS if needed */
-       if (fep->pps_enable) {
-               /* Clear flag so fec_ptp_enable_pps() doesn't return immediately */
-               fep->pps_enable = 0;
-               fec_ptp_restore_state(fep);
-               fep->ptp_caps.enable(&fep->ptp_caps, &ptp_rq, 1);
-       }
 }
 
 
@@ -2029,7 +1995,6 @@ static void fec_enet_phy_reset_after_clk_enable(struct net_device *ndev)
 static int fec_enet_clk_enable(struct net_device *ndev, bool enable)
 {
        struct fec_enet_private *fep = netdev_priv(ndev);
-       unsigned long flags;
        int ret;
 
        if (enable) {
@@ -2038,15 +2003,15 @@ static int fec_enet_clk_enable(struct net_device *ndev, bool enable)
                        return ret;
 
                if (fep->clk_ptp) {
-                       spin_lock_irqsave(&fep->tmreg_lock, flags);
+                       mutex_lock(&fep->ptp_clk_mutex);
                        ret = clk_prepare_enable(fep->clk_ptp);
                        if (ret) {
-                               spin_unlock_irqrestore(&fep->tmreg_lock, flags);
+                               mutex_unlock(&fep->ptp_clk_mutex);
                                goto failed_clk_ptp;
                        } else {
                                fep->ptp_clk_on = true;
                        }
-                       spin_unlock_irqrestore(&fep->tmreg_lock, flags);
+                       mutex_unlock(&fep->ptp_clk_mutex);
                }
 
                ret = clk_prepare_enable(fep->clk_ref);
@@ -2061,10 +2026,10 @@ static int fec_enet_clk_enable(struct net_device *ndev, bool enable)
        } else {
                clk_disable_unprepare(fep->clk_enet_out);
                if (fep->clk_ptp) {
-                       spin_lock_irqsave(&fep->tmreg_lock, flags);
+                       mutex_lock(&fep->ptp_clk_mutex);
                        clk_disable_unprepare(fep->clk_ptp);
                        fep->ptp_clk_on = false;
-                       spin_unlock_irqrestore(&fep->tmreg_lock, flags);
+                       mutex_unlock(&fep->ptp_clk_mutex);
                }
                clk_disable_unprepare(fep->clk_ref);
                clk_disable_unprepare(fep->clk_2x_txclk);
@@ -2077,10 +2042,10 @@ failed_clk_2x_txclk:
                clk_disable_unprepare(fep->clk_ref);
 failed_clk_ref:
        if (fep->clk_ptp) {
-               spin_lock_irqsave(&fep->tmreg_lock, flags);
+               mutex_lock(&fep->ptp_clk_mutex);
                clk_disable_unprepare(fep->clk_ptp);
                fep->ptp_clk_on = false;
-               spin_unlock_irqrestore(&fep->tmreg_lock, flags);
+               mutex_unlock(&fep->ptp_clk_mutex);
        }
 failed_clk_ptp:
        clk_disable_unprepare(fep->clk_enet_out);
@@ -3915,7 +3880,7 @@ fec_probe(struct platform_device *pdev)
        }
 
        fep->ptp_clk_on = false;
-       spin_lock_init(&fep->tmreg_lock);
+       mutex_init(&fep->ptp_clk_mutex);
 
        /* clk_ref is optional, depends on board */
        fep->clk_ref = devm_clk_get_optional(&pdev->dev, "enet_clk_ref");
index 8dd5a2615a89f3f0d321d8bafce0e78258f2058a..3dc3c0b626c21c23681782729ff3b0eb2bf09d6a 100644 (file)
@@ -365,19 +365,21 @@ static int fec_ptp_adjtime(struct ptp_clock_info *ptp, s64 delta)
  */
 static int fec_ptp_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts)
 {
-       struct fec_enet_private *fep =
+       struct fec_enet_private *adapter =
            container_of(ptp, struct fec_enet_private, ptp_caps);
        u64 ns;
        unsigned long flags;
 
-       spin_lock_irqsave(&fep->tmreg_lock, flags);
+       mutex_lock(&adapter->ptp_clk_mutex);
        /* Check the ptp clock */
-       if (!fep->ptp_clk_on) {
-               spin_unlock_irqrestore(&fep->tmreg_lock, flags);
+       if (!adapter->ptp_clk_on) {
+               mutex_unlock(&adapter->ptp_clk_mutex);
                return -EINVAL;
        }
-       ns = timecounter_read(&fep->tc);
-       spin_unlock_irqrestore(&fep->tmreg_lock, flags);
+       spin_lock_irqsave(&adapter->tmreg_lock, flags);
+       ns = timecounter_read(&adapter->tc);
+       spin_unlock_irqrestore(&adapter->tmreg_lock, flags);
+       mutex_unlock(&adapter->ptp_clk_mutex);
 
        *ts = ns_to_timespec64(ns);
 
@@ -402,10 +404,10 @@ static int fec_ptp_settime(struct ptp_clock_info *ptp,
        unsigned long flags;
        u32 counter;
 
-       spin_lock_irqsave(&fep->tmreg_lock, flags);
+       mutex_lock(&fep->ptp_clk_mutex);
        /* Check the ptp clock */
        if (!fep->ptp_clk_on) {
-               spin_unlock_irqrestore(&fep->tmreg_lock, flags);
+               mutex_unlock(&fep->ptp_clk_mutex);
                return -EINVAL;
        }
 
@@ -415,9 +417,11 @@ static int fec_ptp_settime(struct ptp_clock_info *ptp,
         */
        counter = ns & fep->cc.mask;
 
+       spin_lock_irqsave(&fep->tmreg_lock, flags);
        writel(counter, fep->hwp + FEC_ATIME);
        timecounter_init(&fep->tc, &fep->cc, ns);
        spin_unlock_irqrestore(&fep->tmreg_lock, flags);
+       mutex_unlock(&fep->ptp_clk_mutex);
        return 0;
 }
 
@@ -514,11 +518,13 @@ static void fec_time_keep(struct work_struct *work)
        struct fec_enet_private *fep = container_of(dwork, struct fec_enet_private, time_keep);
        unsigned long flags;
 
-       spin_lock_irqsave(&fep->tmreg_lock, flags);
+       mutex_lock(&fep->ptp_clk_mutex);
        if (fep->ptp_clk_on) {
+               spin_lock_irqsave(&fep->tmreg_lock, flags);
                timecounter_read(&fep->tc);
+               spin_unlock_irqrestore(&fep->tmreg_lock, flags);
        }
-       spin_unlock_irqrestore(&fep->tmreg_lock, flags);
+       mutex_unlock(&fep->ptp_clk_mutex);
 
        schedule_delayed_work(&fep->time_keep, HZ);
 }
@@ -593,6 +599,8 @@ void fec_ptp_init(struct platform_device *pdev, int irq_idx)
        }
        fep->ptp_inc = NSEC_PER_SEC / fep->cycle_speed;
 
+       spin_lock_init(&fep->tmreg_lock);
+
        fec_ptp_start_cyclecounter(ndev);
 
        INIT_DELAYED_WORK(&fep->time_keep, fec_time_keep);
@@ -625,36 +633,7 @@ void fec_ptp_stop(struct platform_device *pdev)
        struct net_device *ndev = platform_get_drvdata(pdev);
        struct fec_enet_private *fep = netdev_priv(ndev);
 
-       if (fep->pps_enable)
-               fec_ptp_enable_pps(fep, 0);
-
        cancel_delayed_work_sync(&fep->time_keep);
        if (fep->ptp_clock)
                ptp_clock_unregister(fep->ptp_clock);
 }
-
-void fec_ptp_save_state(struct fec_enet_private *fep)
-{
-       u32 atime_inc_corr;
-
-       fec_ptp_gettime(&fep->ptp_caps, &fep->ptp_saved_state.ts_phc);
-       fep->ptp_saved_state.ns_sys = ktime_get_ns();
-
-       fep->ptp_saved_state.at_corr = readl(fep->hwp + FEC_ATIME_CORR);
-       atime_inc_corr = readl(fep->hwp + FEC_ATIME_INC) & FEC_T_INC_CORR_MASK;
-       fep->ptp_saved_state.at_inc_corr = (u8)(atime_inc_corr >> FEC_T_INC_CORR_OFFSET);
-}
-
-int fec_ptp_restore_state(struct fec_enet_private *fep)
-{
-       u32 atime_inc = readl(fep->hwp + FEC_ATIME_INC) & FEC_T_INC_MASK;
-       u64 ns_sys;
-
-       writel(fep->ptp_saved_state.at_corr, fep->hwp + FEC_ATIME_CORR);
-       atime_inc |= ((u32)fep->ptp_saved_state.at_inc_corr) << FEC_T_INC_CORR_OFFSET;
-       writel(atime_inc, fep->hwp + FEC_ATIME_INC);
-
-       ns_sys = ktime_get_ns() - fep->ptp_saved_state.ns_sys;
-       timespec64_add_ns(&fep->ptp_saved_state.ts_phc, ns_sys);
-       return fec_ptp_settime(&fep->ptp_caps, &fep->ptp_saved_state.ts_phc);
-}
index 8c939628e2d85dadfafdf2acb55a43f69763ed90..2e6461b0ea8bcdd3aad7336f160dac7ef0842dfc 100644 (file)
@@ -157,7 +157,7 @@ static int gve_alloc_page_dqo(struct gve_priv *priv,
        int err;
 
        err = gve_alloc_page(priv, &priv->pdev->dev, &buf_state->page_info.page,
-                            &buf_state->addr, DMA_FROM_DEVICE, GFP_KERNEL);
+                            &buf_state->addr, DMA_FROM_DEVICE, GFP_ATOMIC);
        if (err)
                return err;
 
index 10c1e1ea83a1b297a5b38f66c052d29001bcd74d..e3d9804aeb25ec66203807cd78ee11c0c67ffe28 100644 (file)
@@ -5908,6 +5908,26 @@ static int i40e_get_link_speed(struct i40e_vsi *vsi)
        }
 }
 
+/**
+ * i40e_bw_bytes_to_mbits - Convert max_tx_rate from bytes to mbits
+ * @vsi: Pointer to vsi structure
+ * @max_tx_rate: max TX rate in bytes to be converted into Mbits
+ *
+ * Helper function to convert units before send to set BW limit
+ **/
+static u64 i40e_bw_bytes_to_mbits(struct i40e_vsi *vsi, u64 max_tx_rate)
+{
+       if (max_tx_rate < I40E_BW_MBPS_DIVISOR) {
+               dev_warn(&vsi->back->pdev->dev,
+                        "Setting max tx rate to minimum usable value of 50Mbps.\n");
+               max_tx_rate = I40E_BW_CREDIT_DIVISOR;
+       } else {
+               do_div(max_tx_rate, I40E_BW_MBPS_DIVISOR);
+       }
+
+       return max_tx_rate;
+}
+
 /**
  * i40e_set_bw_limit - setup BW limit for Tx traffic based on max_tx_rate
  * @vsi: VSI to be configured
@@ -5930,10 +5950,10 @@ int i40e_set_bw_limit(struct i40e_vsi *vsi, u16 seid, u64 max_tx_rate)
                        max_tx_rate, seid);
                return -EINVAL;
        }
-       if (max_tx_rate && max_tx_rate < 50) {
+       if (max_tx_rate && max_tx_rate < I40E_BW_CREDIT_DIVISOR) {
                dev_warn(&pf->pdev->dev,
                         "Setting max tx rate to minimum usable value of 50Mbps.\n");
-               max_tx_rate = 50;
+               max_tx_rate = I40E_BW_CREDIT_DIVISOR;
        }
 
        /* Tx rate credits are in values of 50Mbps, 0 is disabled */
@@ -8224,9 +8244,9 @@ config_tc:
 
        if (i40e_is_tc_mqprio_enabled(pf)) {
                if (vsi->mqprio_qopt.max_rate[0]) {
-                       u64 max_tx_rate = vsi->mqprio_qopt.max_rate[0];
+                       u64 max_tx_rate = i40e_bw_bytes_to_mbits(vsi,
+                                                 vsi->mqprio_qopt.max_rate[0]);
 
-                       do_div(max_tx_rate, I40E_BW_MBPS_DIVISOR);
                        ret = i40e_set_bw_limit(vsi, vsi->seid, max_tx_rate);
                        if (!ret) {
                                u64 credits = max_tx_rate;
@@ -10971,10 +10991,10 @@ static void i40e_rebuild(struct i40e_pf *pf, bool reinit, bool lock_acquired)
        }
 
        if (vsi->mqprio_qopt.max_rate[0]) {
-               u64 max_tx_rate = vsi->mqprio_qopt.max_rate[0];
+               u64 max_tx_rate = i40e_bw_bytes_to_mbits(vsi,
+                                                 vsi->mqprio_qopt.max_rate[0]);
                u64 credits = 0;
 
-               do_div(max_tx_rate, I40E_BW_MBPS_DIVISOR);
                ret = i40e_set_bw_limit(vsi, vsi->seid, max_tx_rate);
                if (ret)
                        goto end_unlock;
index 4f184c50f6e8b22b66c00ea56200c780c66d6bb4..7e9f6a69eb10ca09ac10667380d312407e22d920 100644 (file)
@@ -2038,6 +2038,25 @@ static void i40e_del_qch(struct i40e_vf *vf)
        }
 }
 
+/**
+ * i40e_vc_get_max_frame_size
+ * @vf: pointer to the VF
+ *
+ * Max frame size is determined based on the current port's max frame size and
+ * whether a port VLAN is configured on this VF. The VF is not aware whether
+ * it's in a port VLAN so the PF needs to account for this in max frame size
+ * checks and sending the max frame size to the VF.
+ **/
+static u16 i40e_vc_get_max_frame_size(struct i40e_vf *vf)
+{
+       u16 max_frame_size = vf->pf->hw.phy.link_info.max_frame_size;
+
+       if (vf->port_vlan_id)
+               max_frame_size -= VLAN_HLEN;
+
+       return max_frame_size;
+}
+
 /**
  * i40e_vc_get_vf_resources_msg
  * @vf: pointer to the VF info
@@ -2139,6 +2158,7 @@ static int i40e_vc_get_vf_resources_msg(struct i40e_vf *vf, u8 *msg)
        vfres->max_vectors = pf->hw.func_caps.num_msix_vectors_vf;
        vfres->rss_key_size = I40E_HKEY_ARRAY_SIZE;
        vfres->rss_lut_size = I40E_VF_HLUT_ARRAY_SIZE;
+       vfres->max_mtu = i40e_vc_get_max_frame_size(vf);
 
        if (vf->lan_vsi_idx) {
                vfres->vsi_res[0].vsi_id = vf->lan_vsi_id;
index 10aa99dfdcdb05749dff5c57470ff38287d893a9..0c89f16bf1e23c4be88eede487fe6945dd6c817e 100644 (file)
@@ -1077,7 +1077,6 @@ static int iavf_set_mac(struct net_device *netdev, void *p)
 {
        struct iavf_adapter *adapter = netdev_priv(netdev);
        struct sockaddr *addr = p;
-       bool handle_mac = iavf_is_mac_set_handled(netdev, addr->sa_data);
        int ret;
 
        if (!is_valid_ether_addr(addr->sa_data))
@@ -1094,10 +1093,9 @@ static int iavf_set_mac(struct net_device *netdev, void *p)
                return 0;
        }
 
-       if (handle_mac)
-               goto done;
-
-       ret = wait_event_interruptible_timeout(adapter->vc_waitqueue, false, msecs_to_jiffies(2500));
+       ret = wait_event_interruptible_timeout(adapter->vc_waitqueue,
+                                              iavf_is_mac_set_handled(netdev, addr->sa_data),
+                                              msecs_to_jiffies(2500));
 
        /* If ret < 0 then it means wait was interrupted.
         * If ret == 0 then it means we got a timeout.
@@ -1111,7 +1109,6 @@ static int iavf_set_mac(struct net_device *netdev, void *p)
        if (!ret)
                return -EAGAIN;
 
-done:
        if (!ether_addr_equal(netdev->dev_addr, addr->sa_data))
                return -EACCES;
 
index 06d18797d25a28c4406f5f3247ab360c3ceb3ef8..18b6a702a1d6dff9e9aeac001526444a6ca38736 100644 (file)
@@ -114,8 +114,11 @@ u32 iavf_get_tx_pending(struct iavf_ring *ring, bool in_sw)
 {
        u32 head, tail;
 
+       /* underlying hardware might not allow access and/or always return
+        * 0 for the head/tail registers so just use the cached values
+        */
        head = ring->next_to_clean;
-       tail = readl(ring->tail);
+       tail = ring->next_to_use;
 
        if (head != tail)
                return (head < tail) ?
@@ -1390,7 +1393,7 @@ static struct sk_buff *iavf_build_skb(struct iavf_ring *rx_ring,
 #endif
        struct sk_buff *skb;
 
-       if (!rx_buffer)
+       if (!rx_buffer || !size)
                return NULL;
        /* prefetch first cache line of first page */
        va = page_address(rx_buffer->page) + rx_buffer->page_offset;
@@ -1548,7 +1551,7 @@ static int iavf_clean_rx_irq(struct iavf_ring *rx_ring, int budget)
                /* exit if we failed to retrieve a buffer */
                if (!skb) {
                        rx_ring->rx_stats.alloc_buff_failed++;
-                       if (rx_buffer)
+                       if (rx_buffer && size)
                                rx_buffer->pagecnt_bias++;
                        break;
                }
index 15ee85dc33bd817829148401b0b75d7527d3bcd3..5a9e6563923ebd7de870e20faf58df474a961deb 100644 (file)
@@ -269,11 +269,14 @@ int iavf_get_vf_vlan_v2_caps(struct iavf_adapter *adapter)
 void iavf_configure_queues(struct iavf_adapter *adapter)
 {
        struct virtchnl_vsi_queue_config_info *vqci;
-       struct virtchnl_queue_pair_info *vqpi;
+       int i, max_frame = adapter->vf_res->max_mtu;
        int pairs = adapter->num_active_queues;
-       int i, max_frame = IAVF_MAX_RXBUFFER;
+       struct virtchnl_queue_pair_info *vqpi;
        size_t len;
 
+       if (max_frame > IAVF_MAX_RXBUFFER || !max_frame)
+               max_frame = IAVF_MAX_RXBUFFER;
+
        if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) {
                /* bail because we already have a command pending */
                dev_err(&adapter->pdev->dev, "Cannot configure queues, command %d pending\n",
index 0c4ec92640710541b0a1220f47c3477c9aa347f3..58d483e2f539e178605f621a6992b32118eed3ea 100644 (file)
@@ -914,7 +914,7 @@ static void ice_set_dflt_vsi_ctx(struct ice_hw *hw, struct ice_vsi_ctx *ctxt)
  */
 static int ice_vsi_setup_q_map(struct ice_vsi *vsi, struct ice_vsi_ctx *ctxt)
 {
-       u16 offset = 0, qmap = 0, tx_count = 0, pow = 0;
+       u16 offset = 0, qmap = 0, tx_count = 0, rx_count = 0, pow = 0;
        u16 num_txq_per_tc, num_rxq_per_tc;
        u16 qcount_tx = vsi->alloc_txq;
        u16 qcount_rx = vsi->alloc_rxq;
@@ -981,23 +981,25 @@ static int ice_vsi_setup_q_map(struct ice_vsi *vsi, struct ice_vsi_ctx *ctxt)
         * at least 1)
         */
        if (offset)
-               vsi->num_rxq = offset;
+               rx_count = offset;
        else
-               vsi->num_rxq = num_rxq_per_tc;
+               rx_count = num_rxq_per_tc;
 
-       if (vsi->num_rxq > vsi->alloc_rxq) {
+       if (rx_count > vsi->alloc_rxq) {
                dev_err(ice_pf_to_dev(vsi->back), "Trying to use more Rx queues (%u), than were allocated (%u)!\n",
-                       vsi->num_rxq, vsi->alloc_rxq);
+                       rx_count, vsi->alloc_rxq);
                return -EINVAL;
        }
 
-       vsi->num_txq = tx_count;
-       if (vsi->num_txq > vsi->alloc_txq) {
+       if (tx_count > vsi->alloc_txq) {
                dev_err(ice_pf_to_dev(vsi->back), "Trying to use more Tx queues (%u), than were allocated (%u)!\n",
-                       vsi->num_txq, vsi->alloc_txq);
+                       tx_count, vsi->alloc_txq);
                return -EINVAL;
        }
 
+       vsi->num_txq = tx_count;
+       vsi->num_rxq = rx_count;
+
        if (vsi->type == ICE_VSI_VF && vsi->num_txq != vsi->num_rxq) {
                dev_dbg(ice_pf_to_dev(vsi->back), "VF VSI should have same number of Tx and Rx queues. Hence making them equal\n");
                /* since there is a chance that num_rxq could have been changed
@@ -3490,6 +3492,7 @@ ice_vsi_setup_q_map_mqprio(struct ice_vsi *vsi, struct ice_vsi_ctx *ctxt,
        u16 pow, offset = 0, qcount_tx = 0, qcount_rx = 0, qmap;
        u16 tc0_offset = vsi->mqprio_qopt.qopt.offset[0];
        int tc0_qcount = vsi->mqprio_qopt.qopt.count[0];
+       u16 new_txq, new_rxq;
        u8 netdev_tc = 0;
        int i;
 
@@ -3530,21 +3533,24 @@ ice_vsi_setup_q_map_mqprio(struct ice_vsi *vsi, struct ice_vsi_ctx *ctxt,
                }
        }
 
-       /* Set actual Tx/Rx queue pairs */
-       vsi->num_txq = offset + qcount_tx;
-       if (vsi->num_txq > vsi->alloc_txq) {
+       new_txq = offset + qcount_tx;
+       if (new_txq > vsi->alloc_txq) {
                dev_err(ice_pf_to_dev(vsi->back), "Trying to use more Tx queues (%u), than were allocated (%u)!\n",
-                       vsi->num_txq, vsi->alloc_txq);
+                       new_txq, vsi->alloc_txq);
                return -EINVAL;
        }
 
-       vsi->num_rxq = offset + qcount_rx;
-       if (vsi->num_rxq > vsi->alloc_rxq) {
+       new_rxq = offset + qcount_rx;
+       if (new_rxq > vsi->alloc_rxq) {
                dev_err(ice_pf_to_dev(vsi->back), "Trying to use more Rx queues (%u), than were allocated (%u)!\n",
-                       vsi->num_rxq, vsi->alloc_rxq);
+                       new_rxq, vsi->alloc_rxq);
                return -EINVAL;
        }
 
+       /* Set actual Tx/Rx queue pairs */
+       vsi->num_txq = new_txq;
+       vsi->num_rxq = new_rxq;
+
        /* Setup queue TC[0].qmap for given VSI context */
        ctxt->info.tc_mapping[0] = cpu_to_le16(qmap);
        ctxt->info.q_mapping[0] = cpu_to_le16(vsi->rxq_map[0]);
@@ -3576,6 +3582,7 @@ int ice_vsi_cfg_tc(struct ice_vsi *vsi, u8 ena_tc)
 {
        u16 max_txqs[ICE_MAX_TRAFFIC_CLASS] = { 0 };
        struct ice_pf *pf = vsi->back;
+       struct ice_tc_cfg old_tc_cfg;
        struct ice_vsi_ctx *ctx;
        struct device *dev;
        int i, ret = 0;
@@ -3600,6 +3607,7 @@ int ice_vsi_cfg_tc(struct ice_vsi *vsi, u8 ena_tc)
                        max_txqs[i] = vsi->num_txq;
        }
 
+       memcpy(&old_tc_cfg, &vsi->tc_cfg, sizeof(old_tc_cfg));
        vsi->tc_cfg.ena_tc = ena_tc;
        vsi->tc_cfg.numtc = num_tc;
 
@@ -3616,8 +3624,10 @@ int ice_vsi_cfg_tc(struct ice_vsi *vsi, u8 ena_tc)
        else
                ret = ice_vsi_setup_q_map(vsi, ctx);
 
-       if (ret)
+       if (ret) {
+               memcpy(&vsi->tc_cfg, &old_tc_cfg, sizeof(vsi->tc_cfg));
                goto out;
+       }
 
        /* must to indicate which section of VSI context are being modified */
        ctx->info.valid_sections = cpu_to_le16(ICE_AQ_VSI_PROP_RXQ_MAP_VALID);
index 8c30eea61b6d9e9f21468dbcb2b1e7b4ff0f1476..e109cb93886be60b1f6d3fed09faa85f7a5515a8 100644 (file)
@@ -2399,8 +2399,6 @@ int ice_schedule_reset(struct ice_pf *pf, enum ice_reset_req reset)
                return -EBUSY;
        }
 
-       ice_unplug_aux_dev(pf);
-
        switch (reset) {
        case ICE_RESET_PFR:
                set_bit(ICE_PFR_REQ, pf->state);
@@ -6651,7 +6649,7 @@ static void ice_napi_disable_all(struct ice_vsi *vsi)
  */
 int ice_down(struct ice_vsi *vsi)
 {
-       int i, tx_err, rx_err, link_err = 0, vlan_err = 0;
+       int i, tx_err, rx_err, vlan_err = 0;
 
        WARN_ON(!test_bit(ICE_VSI_DOWN, vsi->state));
 
@@ -6685,20 +6683,13 @@ int ice_down(struct ice_vsi *vsi)
 
        ice_napi_disable_all(vsi);
 
-       if (test_bit(ICE_FLAG_LINK_DOWN_ON_CLOSE_ENA, vsi->back->flags)) {
-               link_err = ice_force_phys_link_state(vsi, false);
-               if (link_err)
-                       netdev_err(vsi->netdev, "Failed to set physical link down, VSI %d error %d\n",
-                                  vsi->vsi_num, link_err);
-       }
-
        ice_for_each_txq(vsi, i)
                ice_clean_tx_ring(vsi->tx_rings[i]);
 
        ice_for_each_rxq(vsi, i)
                ice_clean_rx_ring(vsi->rx_rings[i]);
 
-       if (tx_err || rx_err || link_err || vlan_err) {
+       if (tx_err || rx_err || vlan_err) {
                netdev_err(vsi->netdev, "Failed to close VSI 0x%04X on switch 0x%04X\n",
                           vsi->vsi_num, vsi->vsw->sw_id);
                return -EIO;
@@ -6860,6 +6851,8 @@ int ice_vsi_open(struct ice_vsi *vsi)
        if (err)
                goto err_setup_rx;
 
+       ice_vsi_cfg_netdev_tc(vsi, vsi->tc_cfg.ena_tc);
+
        if (vsi->type == ICE_VSI_PF) {
                /* Notify the stack of the actual queue counts. */
                err = netif_set_real_num_tx_queues(vsi->netdev, vsi->num_txq);
@@ -8892,6 +8885,16 @@ int ice_stop(struct net_device *netdev)
                return -EBUSY;
        }
 
+       if (test_bit(ICE_FLAG_LINK_DOWN_ON_CLOSE_ENA, vsi->back->flags)) {
+               int link_err = ice_force_phys_link_state(vsi, false);
+
+               if (link_err) {
+                       netdev_err(vsi->netdev, "Failed to set physical link down, VSI %d error %d\n",
+                                  vsi->vsi_num, link_err);
+                       return -EIO;
+               }
+       }
+
        ice_vsi_close(vsi);
 
        return 0;
index 836dce8407124f2f200f36fab42412f80009469e..97453d1dfafedc501d303ed646f4011edfe732d1 100644 (file)
@@ -610,7 +610,7 @@ ice_xdp_xmit(struct net_device *dev, int n, struct xdp_frame **frames,
        if (test_bit(ICE_VSI_DOWN, vsi->state))
                return -ENETDOWN;
 
-       if (!ice_is_xdp_ena_vsi(vsi) || queue_index >= vsi->num_xdp_txq)
+       if (!ice_is_xdp_ena_vsi(vsi))
                return -ENXIO;
 
        if (unlikely(flags & ~XDP_XMIT_FLAGS_MASK))
@@ -621,6 +621,9 @@ ice_xdp_xmit(struct net_device *dev, int n, struct xdp_frame **frames,
                xdp_ring = vsi->xdp_rings[queue_index];
                spin_lock(&xdp_ring->tx_lock);
        } else {
+               /* Generally, should not happen */
+               if (unlikely(queue_index >= vsi->num_xdp_txq))
+                       return -ENXIO;
                xdp_ring = vsi->xdp_rings[queue_index];
        }
 
index ede3e53b97901a16c6c347036920058a27abda6b..a895862b48212fa23f8216967e40a7fb38628747 100644 (file)
@@ -368,6 +368,7 @@ static int prestera_port_sfp_bind(struct prestera_port *port)
        if (!sw->np)
                return 0;
 
+       of_node_get(sw->np);
        ports = of_find_node_by_name(sw->np, "ports");
 
        for_each_child_of_node(ports, node) {
@@ -417,6 +418,7 @@ static int prestera_port_sfp_bind(struct prestera_port *port)
        }
 
 out:
+       of_node_put(node);
        of_node_put(ports);
        return err;
 }
index f538a749ebd4d21d0e4ce4e74ce7f1d7d1663987..59470d99f522892ee1042cf59b2fc813612b34ab 100644 (file)
@@ -872,6 +872,7 @@ static void prestera_pci_remove(struct pci_dev *pdev)
 static const struct pci_device_id prestera_pci_devices[] = {
        { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0xC804) },
        { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0xC80C) },
+       { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0xCC1E) },
        { }
 };
 MODULE_DEVICE_TABLE(pci, prestera_pci_devices);
index 5ace4609de47d22eb88c5eca283068ec3c7e669b..b344632beaddfcba4f93bbb3c07d7ec98397dc9b 100644 (file)
@@ -1458,7 +1458,7 @@ static void mtk_update_rx_cpu_idx(struct mtk_eth *eth)
 
 static bool mtk_page_pool_enabled(struct mtk_eth *eth)
 {
-       return !eth->hwlro;
+       return MTK_HAS_CAPS(eth->soc->caps, MTK_NETSYS_V2);
 }
 
 static struct page_pool *mtk_create_page_pool(struct mtk_eth *eth,
index 85155cd9405c57af5731fbacd922697ebef7e2ae..4aeb927c37153aa6bf39f2f4b1fd92932aa5d8ac 100644 (file)
@@ -179,6 +179,9 @@ static int mlxbf_gige_mdio_read(struct mii_bus *bus, int phy_add, int phy_reg)
        /* Only return ad bits of the gw register */
        ret &= MLXBF_GIGE_MDIO_GW_AD_MASK;
 
+       /* The MDIO lock is set on read. To release it, clear gw register */
+       writel(0, priv->mdio_io + MLXBF_GIGE_MDIO_GW_OFFSET);
+
        return ret;
 }
 
@@ -203,6 +206,9 @@ static int mlxbf_gige_mdio_write(struct mii_bus *bus, int phy_add,
                                        temp, !(temp & MLXBF_GIGE_MDIO_GW_BUSY_MASK),
                                        5, 1000000);
 
+       /* The MDIO lock is set on read. To release it, clear gw register */
+       writel(0, priv->mdio_io + MLXBF_GIGE_MDIO_GW_OFFSET);
+
        return ret;
 }
 
index 5f924018235174ffd7f21488dc21146da3b97715..a6f99b4344d93fa813c6300aa904d3fb4c5e44da 100644 (file)
@@ -397,6 +397,11 @@ static void mana_gd_process_eq_events(void *arg)
                        break;
                }
 
+               /* Per GDMA spec, rmb is necessary after checking owner_bits, before
+                * reading eqe.
+                */
+               rmb();
+
                mana_gd_process_eqe(eq);
 
                eq->head++;
@@ -1134,6 +1139,11 @@ static int mana_gd_read_cqe(struct gdma_queue *cq, struct gdma_comp *comp)
        if (WARN_ON_ONCE(owner_bits != new_bits))
                return -1;
 
+       /* Per GDMA spec, rmb is necessary after checking owner_bits, before
+        * reading completion info
+        */
+       rmb();
+
        comp->wq_num = cqe->cqe_info.wq_num;
        comp->is_sq = cqe->cqe_info.is_sq;
        memcpy(comp->cqe_data, cqe->cqe_data, GDMA_COMP_DATA_SIZE);
@@ -1465,10 +1475,6 @@ static void mana_gd_shutdown(struct pci_dev *pdev)
        pci_disable_device(pdev);
 }
 
-#ifndef PCI_VENDOR_ID_MICROSOFT
-#define PCI_VENDOR_ID_MICROSOFT 0x1414
-#endif
-
 static const struct pci_device_id mana_id_table[] = {
        { PCI_DEVICE(PCI_VENDOR_ID_MICROSOFT, MANA_PF_DEVICE_ID) },
        { PCI_DEVICE(PCI_VENDOR_ID_MICROSOFT, MANA_VF_DEVICE_ID) },
index b357ac4c56c599ad4a73ad8670228fc9fec77722..7e32b04eb0c756cb7d00a50ee866ec0d324951cf 100644 (file)
@@ -1449,6 +1449,8 @@ static int ravb_phy_init(struct net_device *ndev)
                phy_remove_link_mode(phydev, ETHTOOL_LINK_MODE_100baseT_Half_BIT);
        }
 
+       /* Indicate that the MAC is responsible for managing PHY PM */
+       phydev->mac_managed_pm = true;
        phy_attached_info(phydev);
 
        return 0;
index 67ade78fb7671c4a8bbaae0e02b067bd351a3beb..7fd8828d3a8461690b0771bab6a7027585900084 100644 (file)
@@ -2029,6 +2029,8 @@ static int sh_eth_phy_init(struct net_device *ndev)
        if (mdp->cd->register_type != SH_ETH_REG_GIGABIT)
                phy_set_max_speed(phydev, SPEED_100);
 
+       /* Indicate that the MAC is responsible for managing PHY PM */
+       phydev->mac_managed_pm = true;
        phy_attached_info(phydev);
 
        return 0;
index 032b8c0bd78890d6de890fa2cf1fa9405c56ba9f..5b4d661ab98679d25aa58fd061d642674e1db309 100644 (file)
@@ -319,7 +319,7 @@ int efx_probe_interrupts(struct efx_nic *efx)
                efx->n_channels = 1 + (efx_separate_tx_channels ? 1 : 0);
                efx->n_rx_channels = 1;
                efx->n_tx_channels = 1;
-               efx->tx_channel_offset = 1;
+               efx->tx_channel_offset = efx_separate_tx_channels ? 1 : 0;
                efx->n_xdp_channels = 0;
                efx->xdp_channel_offset = efx->n_channels;
                efx->legacy_irq = efx->pci_dev->irq;
index 017212a40df388ecfc6d119f5808545c3c249779..f54ebd007286826bf2bf25742c37e192d1c37d7c 100644 (file)
@@ -320,7 +320,7 @@ int efx_siena_probe_interrupts(struct efx_nic *efx)
                efx->n_channels = 1 + (efx_siena_separate_tx_channels ? 1 : 0);
                efx->n_rx_channels = 1;
                efx->n_tx_channels = 1;
-               efx->tx_channel_offset = 1;
+               efx->tx_channel_offset = efx_siena_separate_tx_channels ? 1 : 0;
                efx->n_xdp_channels = 0;
                efx->xdp_channel_offset = efx->n_channels;
                efx->legacy_irq = efx->pci_dev->irq;
index e166dcb9b99ceaa055a880f57785ee13bfb2a6f9..91e87594ed1eac18e8dbec04c9b29161a3ef0b54 100644 (file)
@@ -336,7 +336,7 @@ netdev_tx_t efx_siena_hard_start_xmit(struct sk_buff *skb,
                 * previous packets out.
                 */
                if (!netdev_xmit_more())
-                       efx_tx_send_pending(tx_queue->channel);
+                       efx_tx_send_pending(efx_get_tx_channel(efx, index));
                return NETDEV_TX_OK;
        }
 
index d12474042c842c186d88f42ba9baa2f7b69abdf1..c5f88f7a7a047db15d67803f2658b9a71eff7a68 100644 (file)
@@ -549,7 +549,7 @@ netdev_tx_t efx_hard_start_xmit(struct sk_buff *skb,
                 * previous packets out.
                 */
                if (!netdev_xmit_more())
-                       efx_tx_send_pending(tx_queue->channel);
+                       efx_tx_send_pending(efx_get_tx_channel(efx, index));
                return NETDEV_TX_OK;
        }
 
index 8594ee839628bd9fa80f1d8a4f8476ba2eab6ef2..88aa0d310aeef75428f97b47e6d7f1029e33440d 100644 (file)
@@ -2020,9 +2020,9 @@ static void happy_meal_rx(struct happy_meal *hp, struct net_device *dev)
 
                        skb_reserve(copy_skb, 2);
                        skb_put(copy_skb, len);
-                       dma_sync_single_for_cpu(hp->dma_dev, dma_addr, len, DMA_FROM_DEVICE);
+                       dma_sync_single_for_cpu(hp->dma_dev, dma_addr, len + 2, DMA_FROM_DEVICE);
                        skb_copy_from_linear_data(skb, copy_skb->data, len);
-                       dma_sync_single_for_device(hp->dma_dev, dma_addr, len, DMA_FROM_DEVICE);
+                       dma_sync_single_for_device(hp->dma_dev, dma_addr, len + 2, DMA_FROM_DEVICE);
                        /* Reuse original ring buffer. */
                        hme_write_rxd(hp, this,
                                      (RXFLAG_OWN|((RX_BUF_ALLOC_SIZE-RX_OFFSET)<<16)),
index ec010cf2e816a9f46336a66a3d52f4bb827c20fd..6f874f99b910cd65805b62cc73c868204a23f58b 100644 (file)
@@ -308,12 +308,12 @@ init_modem_driver_req(struct ipa_qmi *ipa_qmi)
        mem = ipa_mem_find(ipa, IPA_MEM_V4_ROUTE);
        req.v4_route_tbl_info_valid = 1;
        req.v4_route_tbl_info.start = ipa->mem_offset + mem->offset;
-       req.v4_route_tbl_info.count = mem->size / sizeof(__le64);
+       req.v4_route_tbl_info.end = IPA_ROUTE_MODEM_COUNT - 1;
 
        mem = ipa_mem_find(ipa, IPA_MEM_V6_ROUTE);
        req.v6_route_tbl_info_valid = 1;
        req.v6_route_tbl_info.start = ipa->mem_offset + mem->offset;
-       req.v6_route_tbl_info.count = mem->size / sizeof(__le64);
+       req.v6_route_tbl_info.end = IPA_ROUTE_MODEM_COUNT - 1;
 
        mem = ipa_mem_find(ipa, IPA_MEM_V4_FILTER);
        req.v4_filter_tbl_start_valid = 1;
@@ -352,7 +352,7 @@ init_modem_driver_req(struct ipa_qmi *ipa_qmi)
                req.v4_hash_route_tbl_info_valid = 1;
                req.v4_hash_route_tbl_info.start =
                                ipa->mem_offset + mem->offset;
-               req.v4_hash_route_tbl_info.count = mem->size / sizeof(__le64);
+               req.v4_hash_route_tbl_info.end = IPA_ROUTE_MODEM_COUNT - 1;
        }
 
        mem = ipa_mem_find(ipa, IPA_MEM_V6_ROUTE_HASHED);
@@ -360,7 +360,7 @@ init_modem_driver_req(struct ipa_qmi *ipa_qmi)
                req.v6_hash_route_tbl_info_valid = 1;
                req.v6_hash_route_tbl_info.start =
                        ipa->mem_offset + mem->offset;
-               req.v6_hash_route_tbl_info.count = mem->size / sizeof(__le64);
+               req.v6_hash_route_tbl_info.end = IPA_ROUTE_MODEM_COUNT - 1;
        }
 
        mem = ipa_mem_find(ipa, IPA_MEM_V4_FILTER_HASHED);
index 6838e8065072ba7afe3fecd5abbab92b825a098f..75d3fc0092e9233e4fc83c213a69dd64eff405be 100644 (file)
@@ -311,7 +311,7 @@ struct qmi_elem_info ipa_init_modem_driver_req_ei[] = {
                .tlv_type       = 0x12,
                .offset         = offsetof(struct ipa_init_modem_driver_req,
                                           v4_route_tbl_info),
-               .ei_array       = ipa_mem_array_ei,
+               .ei_array       = ipa_mem_bounds_ei,
        },
        {
                .data_type      = QMI_OPT_FLAG,
@@ -332,7 +332,7 @@ struct qmi_elem_info ipa_init_modem_driver_req_ei[] = {
                .tlv_type       = 0x13,
                .offset         = offsetof(struct ipa_init_modem_driver_req,
                                           v6_route_tbl_info),
-               .ei_array       = ipa_mem_array_ei,
+               .ei_array       = ipa_mem_bounds_ei,
        },
        {
                .data_type      = QMI_OPT_FLAG,
@@ -496,7 +496,7 @@ struct qmi_elem_info ipa_init_modem_driver_req_ei[] = {
                .tlv_type       = 0x1b,
                .offset         = offsetof(struct ipa_init_modem_driver_req,
                                           v4_hash_route_tbl_info),
-               .ei_array       = ipa_mem_array_ei,
+               .ei_array       = ipa_mem_bounds_ei,
        },
        {
                .data_type      = QMI_OPT_FLAG,
@@ -517,7 +517,7 @@ struct qmi_elem_info ipa_init_modem_driver_req_ei[] = {
                .tlv_type       = 0x1c,
                .offset         = offsetof(struct ipa_init_modem_driver_req,
                                           v6_hash_route_tbl_info),
-               .ei_array       = ipa_mem_array_ei,
+               .ei_array       = ipa_mem_bounds_ei,
        },
        {
                .data_type      = QMI_OPT_FLAG,
index 495e85abe50bdb8a0e5b7f7dd3fc022449b73469..9651aa59b59685fabe0e11895c5dec10b1a713eb 100644 (file)
@@ -86,9 +86,11 @@ enum ipa_platform_type {
        IPA_QMI_PLATFORM_TYPE_MSM_QNX_V01       = 0x5,  /* QNX MSM */
 };
 
-/* This defines the start and end offset of a range of memory.  Both
- * fields are offsets relative to the start of IPA shared memory.
- * The end value is the last addressable byte *within* the range.
+/* This defines the start and end offset of a range of memory.  The start
+ * value is a byte offset relative to the start of IPA shared memory.  The
+ * end value is the last addressable unit *within* the range.  Typically
+ * the end value is in units of bytes, however it can also be a maximum
+ * array index value.
  */
 struct ipa_mem_bounds {
        u32 start;
@@ -129,18 +131,19 @@ struct ipa_init_modem_driver_req {
        u8                      hdr_tbl_info_valid;
        struct ipa_mem_bounds   hdr_tbl_info;
 
-       /* Routing table information.  These define the location and size of
-        * non-hashable IPv4 and IPv6 filter tables.  The start values are
-        * offsets relative to the start of IPA shared memory.
+       /* Routing table information.  These define the location and maximum
+        * *index* (not byte) for the modem portion of non-hashable IPv4 and
+        * IPv6 routing tables.  The start values are byte offsets relative
+        * to the start of IPA shared memory.
         */
        u8                      v4_route_tbl_info_valid;
-       struct ipa_mem_array    v4_route_tbl_info;
+       struct ipa_mem_bounds   v4_route_tbl_info;
        u8                      v6_route_tbl_info_valid;
-       struct ipa_mem_array    v6_route_tbl_info;
+       struct ipa_mem_bounds   v6_route_tbl_info;
 
        /* Filter table information.  These define the location of the
         * non-hashable IPv4 and IPv6 filter tables.  The start values are
-        * offsets relative to the start of IPA shared memory.
+        * byte offsets relative to the start of IPA shared memory.
         */
        u8                      v4_filter_tbl_start_valid;
        u32                     v4_filter_tbl_start;
@@ -181,18 +184,20 @@ struct ipa_init_modem_driver_req {
        u8                      zip_tbl_info_valid;
        struct ipa_mem_bounds   zip_tbl_info;
 
-       /* Routing table information.  These define the location and size
-        * of hashable IPv4 and IPv6 filter tables.  The start values are
-        * offsets relative to the start of IPA shared memory.
+       /* Routing table information.  These define the location and maximum
+        * *index* (not byte) for the modem portion of hashable IPv4 and IPv6
+        * routing tables (if supported by hardware).  The start values are
+        * byte offsets relative to the start of IPA shared memory.
         */
        u8                      v4_hash_route_tbl_info_valid;
-       struct ipa_mem_array    v4_hash_route_tbl_info;
+       struct ipa_mem_bounds   v4_hash_route_tbl_info;
        u8                      v6_hash_route_tbl_info_valid;
-       struct ipa_mem_array    v6_hash_route_tbl_info;
+       struct ipa_mem_bounds   v6_hash_route_tbl_info;
 
        /* Filter table information.  These define the location and size
-        * of hashable IPv4 and IPv6 filter tables.  The start values are
-        * offsets relative to the start of IPA shared memory.
+        * of hashable IPv4 and IPv6 filter tables (if supported by hardware).
+        * The start values are byte offsets relative to the start of IPA
+        * shared memory.
         */
        u8                      v4_hash_filter_tbl_start_valid;
        u32                     v4_hash_filter_tbl_start;
index 2f5a58bfc529a3148bce114b1fcf4f32f0db07bc..69efe672ca52871c18c0a58b09c6d96485b5ae0b 100644 (file)
 
 /* Assignment of route table entries to the modem and AP */
 #define IPA_ROUTE_MODEM_MIN            0
-#define IPA_ROUTE_MODEM_COUNT          8
-
 #define IPA_ROUTE_AP_MIN               IPA_ROUTE_MODEM_COUNT
 #define IPA_ROUTE_AP_COUNT \
                (IPA_ROUTE_COUNT_MAX - IPA_ROUTE_MODEM_COUNT)
index b6a9a0d79d68e9669b50ca9079bbf6e0d8ad1df5..1538e2e1732fe040c139f320ded2734c8c7f4ca5 100644 (file)
@@ -13,6 +13,9 @@ struct ipa;
 /* The maximum number of filter table entries (IPv4, IPv6; hashed or not) */
 #define IPA_FILTER_COUNT_MAX   14
 
+/* The number of route table entries allotted to the modem */
+#define IPA_ROUTE_MODEM_COUNT  8
+
 /* The maximum number of route table entries (IPv4, IPv6; hashed or not) */
 #define IPA_ROUTE_COUNT_MAX    15
 
index dfeb5b392e642885c3897018337f94fb41d10eab..bb1c298c1e78b8b5721b2bb6fb1de1311b11850a 100644 (file)
@@ -495,7 +495,6 @@ static int ipvlan_process_v6_outbound(struct sk_buff *skb)
 
 static int ipvlan_process_outbound(struct sk_buff *skb)
 {
-       struct ethhdr *ethh = eth_hdr(skb);
        int ret = NET_XMIT_DROP;
 
        /* The ipvlan is a pseudo-L2 device, so the packets that we receive
@@ -505,6 +504,8 @@ static int ipvlan_process_outbound(struct sk_buff *skb)
        if (skb_mac_header_was_set(skb)) {
                /* In this mode we dont care about
                 * multicast and broadcast traffic */
+               struct ethhdr *ethh = eth_hdr(skb);
+
                if (is_multicast_ether_addr(ethh->h_dest)) {
                        pr_debug_ratelimited(
                                "Dropped {multi|broad}cast of type=[%x]\n",
@@ -589,7 +590,7 @@ out:
 static int ipvlan_xmit_mode_l2(struct sk_buff *skb, struct net_device *dev)
 {
        const struct ipvl_dev *ipvlan = netdev_priv(dev);
-       struct ethhdr *eth = eth_hdr(skb);
+       struct ethhdr *eth = skb_eth_hdr(skb);
        struct ipvl_addr *addr;
        void *lyr3h;
        int addr_type;
@@ -619,6 +620,7 @@ static int ipvlan_xmit_mode_l2(struct sk_buff *skb, struct net_device *dev)
                return dev_forward_skb(ipvlan->phy_dev, skb);
 
        } else if (is_multicast_ether_addr(eth->h_dest)) {
+               skb_reset_mac_header(skb);
                ipvlan_skb_crossing_ns(skb, NULL);
                ipvlan_multicast_enqueue(ipvlan->port, skb, true);
                return NET_XMIT_SUCCESS;
index 9e3c815a070f14c4c46f16b84dcfc705d9cd5865..796e9c7857d09428632649dde3d3d172657d8fec 100644 (file)
@@ -231,6 +231,7 @@ int of_mdiobus_register(struct mii_bus *mdio, struct device_node *np)
        return 0;
 
 unregister:
+       of_node_put(child);
        mdiobus_unregister(mdio);
        return rc;
 }
index 605a38e16db056e0c35481075a5d438063f32272..0e58aa7f0374eefefe583b10f73266b19ba2a79c 100644 (file)
@@ -433,11 +433,11 @@ int nsim_dev_hwstats_init(struct nsim_dev *nsim_dev)
                goto err_remove_hwstats_recursive;
        }
 
-       debugfs_create_file("enable_ifindex", 0600, hwstats->l3_ddir, hwstats,
+       debugfs_create_file("enable_ifindex", 0200, hwstats->l3_ddir, hwstats,
                            &nsim_dev_hwstats_l3_enable_fops.fops);
-       debugfs_create_file("disable_ifindex", 0600, hwstats->l3_ddir, hwstats,
+       debugfs_create_file("disable_ifindex", 0200, hwstats->l3_ddir, hwstats,
                            &nsim_dev_hwstats_l3_disable_fops.fops);
-       debugfs_create_file("fail_next_enable", 0600, hwstats->l3_ddir, hwstats,
+       debugfs_create_file("fail_next_enable", 0200, hwstats->l3_ddir, hwstats,
                            &nsim_dev_hwstats_l3_fail_fops.fops);
 
        INIT_DELAYED_WORK(&hwstats->traffic_dw,
index 8b7a46db30e0c39a5afd8ea85ac367bf722eee6e..7111e2e958e9bbaf74490ab010784f8bbe364922 100644 (file)
@@ -91,6 +91,9 @@
 #define VEND1_GLOBAL_FW_ID_MAJOR               GENMASK(15, 8)
 #define VEND1_GLOBAL_FW_ID_MINOR               GENMASK(7, 0)
 
+#define VEND1_GLOBAL_GEN_STAT2                 0xc831
+#define VEND1_GLOBAL_GEN_STAT2_OP_IN_PROG      BIT(15)
+
 #define VEND1_GLOBAL_RSVD_STAT1                        0xc885
 #define VEND1_GLOBAL_RSVD_STAT1_FW_BUILD_ID    GENMASK(7, 4)
 #define VEND1_GLOBAL_RSVD_STAT1_PROV_ID                GENMASK(3, 0)
 #define VEND1_GLOBAL_INT_VEND_MASK_GLOBAL2     BIT(1)
 #define VEND1_GLOBAL_INT_VEND_MASK_GLOBAL3     BIT(0)
 
+/* Sleep and timeout for checking if the Processor-Intensive
+ * MDIO operation is finished
+ */
+#define AQR107_OP_IN_PROG_SLEEP                1000
+#define AQR107_OP_IN_PROG_TIMEOUT      100000
+
 struct aqr107_hw_stat {
        const char *name;
        int reg;
@@ -597,16 +606,52 @@ static void aqr107_link_change_notify(struct phy_device *phydev)
                phydev_info(phydev, "Aquantia 1000Base-T2 mode active\n");
 }
 
+static int aqr107_wait_processor_intensive_op(struct phy_device *phydev)
+{
+       int val, err;
+
+       /* The datasheet notes to wait at least 1ms after issuing a
+        * processor intensive operation before checking.
+        * We cannot use the 'sleep_before_read' parameter of read_poll_timeout
+        * because that just determines the maximum time slept, not the minimum.
+        */
+       usleep_range(1000, 5000);
+
+       err = phy_read_mmd_poll_timeout(phydev, MDIO_MMD_VEND1,
+                                       VEND1_GLOBAL_GEN_STAT2, val,
+                                       !(val & VEND1_GLOBAL_GEN_STAT2_OP_IN_PROG),
+                                       AQR107_OP_IN_PROG_SLEEP,
+                                       AQR107_OP_IN_PROG_TIMEOUT, false);
+       if (err) {
+               phydev_err(phydev, "timeout: processor-intensive MDIO operation\n");
+               return err;
+       }
+
+       return 0;
+}
+
 static int aqr107_suspend(struct phy_device *phydev)
 {
-       return phy_set_bits_mmd(phydev, MDIO_MMD_VEND1, MDIO_CTRL1,
-                               MDIO_CTRL1_LPOWER);
+       int err;
+
+       err = phy_set_bits_mmd(phydev, MDIO_MMD_VEND1, MDIO_CTRL1,
+                              MDIO_CTRL1_LPOWER);
+       if (err)
+               return err;
+
+       return aqr107_wait_processor_intensive_op(phydev);
 }
 
 static int aqr107_resume(struct phy_device *phydev)
 {
-       return phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, MDIO_CTRL1,
-                                 MDIO_CTRL1_LPOWER);
+       int err;
+
+       err = phy_clear_bits_mmd(phydev, MDIO_MMD_VEND1, MDIO_CTRL1,
+                                MDIO_CTRL1_LPOWER);
+       if (err)
+               return err;
+
+       return aqr107_wait_processor_intensive_op(phydev);
 }
 
 static int aqr107_probe(struct phy_device *phydev)
index 6f52b4fb688853cd7552acb1b2121e2713f234af..38234d7e14c5aff8d2c2a34d89dd363b1c35ef69 100644 (file)
@@ -2679,16 +2679,19 @@ static int lan8804_config_init(struct phy_device *phydev)
 static irqreturn_t lan8814_handle_interrupt(struct phy_device *phydev)
 {
        int irq_status, tsu_irq_status;
+       int ret = IRQ_NONE;
 
        irq_status = phy_read(phydev, LAN8814_INTS);
-       if (irq_status > 0 && (irq_status & LAN8814_INT_LINK))
-               phy_trigger_machine(phydev);
-
        if (irq_status < 0) {
                phy_error(phydev);
                return IRQ_NONE;
        }
 
+       if (irq_status & LAN8814_INT_LINK) {
+               phy_trigger_machine(phydev);
+               ret = IRQ_HANDLED;
+       }
+
        while (1) {
                tsu_irq_status = lanphy_read_page_reg(phydev, 4,
                                                      LAN8814_INTR_STS_REG);
@@ -2697,12 +2700,15 @@ static irqreturn_t lan8814_handle_interrupt(struct phy_device *phydev)
                    (tsu_irq_status & (LAN8814_INTR_STS_REG_1588_TSU0_ |
                                       LAN8814_INTR_STS_REG_1588_TSU1_ |
                                       LAN8814_INTR_STS_REG_1588_TSU2_ |
-                                      LAN8814_INTR_STS_REG_1588_TSU3_)))
+                                      LAN8814_INTR_STS_REG_1588_TSU3_))) {
                        lan8814_handle_ptp_interrupt(phydev);
-               else
+                       ret = IRQ_HANDLED;
+               } else {
                        break;
+               }
        }
-       return IRQ_HANDLED;
+
+       return ret;
 }
 
 static int lan8814_ack_interrupt(struct phy_device *phydev)
index aac133a1e27a5f64fe8f83a456aa0598fad6824c..154a3c0a6dfd89f9781115b769d7b3cc59aaf179 100644 (file)
@@ -1275,10 +1275,12 @@ static int team_port_add(struct team *team, struct net_device *port_dev,
                }
        }
 
-       netif_addr_lock_bh(dev);
-       dev_uc_sync_multiple(port_dev, dev);
-       dev_mc_sync_multiple(port_dev, dev);
-       netif_addr_unlock_bh(dev);
+       if (dev->flags & IFF_UP) {
+               netif_addr_lock_bh(dev);
+               dev_uc_sync_multiple(port_dev, dev);
+               dev_mc_sync_multiple(port_dev, dev);
+               netif_addr_unlock_bh(dev);
+       }
 
        port->index = -1;
        list_add_tail_rcu(&port->list, &team->port_list);
@@ -1349,8 +1351,10 @@ static int team_port_del(struct team *team, struct net_device *port_dev)
        netdev_rx_handler_unregister(port_dev);
        team_port_disable_netpoll(port);
        vlan_vids_del_by_dev(port_dev, dev);
-       dev_uc_unsync(port_dev, dev);
-       dev_mc_unsync(port_dev, dev);
+       if (dev->flags & IFF_UP) {
+               dev_uc_unsync(port_dev, dev);
+               dev_mc_unsync(port_dev, dev);
+       }
        dev_close(port_dev);
        team_port_leave(team, port);
 
@@ -1700,6 +1704,14 @@ static int team_open(struct net_device *dev)
 
 static int team_close(struct net_device *dev)
 {
+       struct team *team = netdev_priv(dev);
+       struct team_port *port;
+
+       list_for_each_entry(port, &team->port_list, list) {
+               dev_uc_unsync(port->dev, dev);
+               dev_mc_unsync(port->dev, dev);
+       }
+
        return 0;
 }
 
index d0f3b6d7f40894fdee515c471295d3516da9b13d..5c804bcabfe6be5b87e015b633aaeff57885cb84 100644 (file)
@@ -436,14 +436,13 @@ static int set_peer(struct wg_device *wg, struct nlattr **attrs)
        if (attrs[WGPEER_A_ENDPOINT]) {
                struct sockaddr *addr = nla_data(attrs[WGPEER_A_ENDPOINT]);
                size_t len = nla_len(attrs[WGPEER_A_ENDPOINT]);
+               struct endpoint endpoint = { { { 0 } } };
 
-               if ((len == sizeof(struct sockaddr_in) &&
-                    addr->sa_family == AF_INET) ||
-                   (len == sizeof(struct sockaddr_in6) &&
-                    addr->sa_family == AF_INET6)) {
-                       struct endpoint endpoint = { { { 0 } } };
-
-                       memcpy(&endpoint.addr, addr, len);
+               if (len == sizeof(struct sockaddr_in) && addr->sa_family == AF_INET) {
+                       endpoint.addr4 = *(struct sockaddr_in *)addr;
+                       wg_socket_set_peer_endpoint(peer, &endpoint);
+               } else if (len == sizeof(struct sockaddr_in6) && addr->sa_family == AF_INET6) {
+                       endpoint.addr6 = *(struct sockaddr_in6 *)addr;
                        wg_socket_set_peer_endpoint(peer, &endpoint);
                }
        }
index ba87d294604fe436e9a672dce65a37139a7a32bf..d4bb40a695ab6785968babc1060a8b1010651e8b 100644 (file)
@@ -6,29 +6,28 @@
 #ifdef DEBUG
 
 #include <linux/jiffies.h>
-#include <linux/hrtimer.h>
 
 static const struct {
        bool result;
-       u64 nsec_to_sleep_before;
+       unsigned int msec_to_sleep_before;
 } expected_results[] __initconst = {
        [0 ... PACKETS_BURSTABLE - 1] = { true, 0 },
        [PACKETS_BURSTABLE] = { false, 0 },
-       [PACKETS_BURSTABLE + 1] = { true, NSEC_PER_SEC / PACKETS_PER_SECOND },
+       [PACKETS_BURSTABLE + 1] = { true, MSEC_PER_SEC / PACKETS_PER_SECOND },
        [PACKETS_BURSTABLE + 2] = { false, 0 },
-       [PACKETS_BURSTABLE + 3] = { true, (NSEC_PER_SEC / PACKETS_PER_SECOND) * 2 },
+       [PACKETS_BURSTABLE + 3] = { true, (MSEC_PER_SEC / PACKETS_PER_SECOND) * 2 },
        [PACKETS_BURSTABLE + 4] = { true, 0 },
        [PACKETS_BURSTABLE + 5] = { false, 0 }
 };
 
 static __init unsigned int maximum_jiffies_at_index(int index)
 {
-       u64 total_nsecs = 2 * NSEC_PER_SEC / PACKETS_PER_SECOND / 3;
+       unsigned int total_msecs = 2 * MSEC_PER_SEC / PACKETS_PER_SECOND / 3;
        int i;
 
        for (i = 0; i <= index; ++i)
-               total_nsecs += expected_results[i].nsec_to_sleep_before;
-       return nsecs_to_jiffies(total_nsecs);
+               total_msecs += expected_results[i].msec_to_sleep_before;
+       return msecs_to_jiffies(total_msecs);
 }
 
 static __init int timings_test(struct sk_buff *skb4, struct iphdr *hdr4,
@@ -43,12 +42,8 @@ static __init int timings_test(struct sk_buff *skb4, struct iphdr *hdr4,
        loop_start_time = jiffies;
 
        for (i = 0; i < ARRAY_SIZE(expected_results); ++i) {
-               if (expected_results[i].nsec_to_sleep_before) {
-                       ktime_t timeout = ktime_add(ktime_add_ns(ktime_get_coarse_boottime(), TICK_NSEC * 4 / 3),
-                                                   ns_to_ktime(expected_results[i].nsec_to_sleep_before));
-                       set_current_state(TASK_UNINTERRUPTIBLE);
-                       schedule_hrtimeout_range_clock(&timeout, 0, HRTIMER_MODE_ABS, CLOCK_BOOTTIME);
-               }
+               if (expected_results[i].msec_to_sleep_before)
+                       msleep(expected_results[i].msec_to_sleep_before);
 
                if (time_is_before_jiffies(loop_start_time +
                                           maximum_jiffies_at_index(i)))
@@ -132,7 +127,7 @@ bool __init wg_ratelimiter_selftest(void)
        if (IS_ENABLED(CONFIG_KASAN) || IS_ENABLED(CONFIG_UBSAN))
                return true;
 
-       BUILD_BUG_ON(NSEC_PER_SEC % PACKETS_PER_SECOND != 0);
+       BUILD_BUG_ON(MSEC_PER_SEC % PACKETS_PER_SECOND != 0);
 
        if (wg_ratelimiter_init())
                goto out;
@@ -172,7 +167,7 @@ bool __init wg_ratelimiter_selftest(void)
        ++test;
 #endif
 
-       for (trials = TRIALS_BEFORE_GIVING_UP;;) {
+       for (trials = TRIALS_BEFORE_GIVING_UP; IS_ENABLED(DEBUG_RATELIMITER_TIMINGS);) {
                int test_count = 0, ret;
 
                ret = timings_test(skb4, hdr4, skb6, hdr6, &test_count);
index a647a406b87bea854d73e1de1d851b6376b95e03..b20409f8c13ab554d84106212940a9b5e356cd2c 100644 (file)
@@ -140,6 +140,7 @@ config IWLMEI
        depends on INTEL_MEI
        depends on PM
        depends on CFG80211
+       depends on BROKEN
        help
          Enables the iwlmei kernel module.
 
index 5eb28f8ee87e524560605a14613f2ad81551374e..11536f115198dd2a82667a12dddbbc14d844795e 100644 (file)
@@ -1833,8 +1833,8 @@ static void iwl_mvm_parse_ppe(struct iwl_mvm *mvm,
        * If nss < MAX: we can set zeros in other streams
        */
        if (nss > MAX_HE_SUPP_NSS) {
-               IWL_INFO(mvm, "Got NSS = %d - trimming to %d\n", nss,
-                        MAX_HE_SUPP_NSS);
+               IWL_DEBUG_INFO(mvm, "Got NSS = %d - trimming to %d\n", nss,
+                              MAX_HE_SUPP_NSS);
                nss = MAX_HE_SUPP_NSS;
        }
 
index 253cbc1956d19953ca16dd10b154cf5d5b64c34e..6de13d6414389b5d9873363418cc1d3cfedfeff4 100644 (file)
@@ -267,7 +267,8 @@ static void mt76_init_stream_cap(struct mt76_phy *phy,
        }
        vht_cap->vht_mcs.rx_mcs_map = cpu_to_le16(mcs_map);
        vht_cap->vht_mcs.tx_mcs_map = cpu_to_le16(mcs_map);
-       vht_cap->vht_mcs.tx_highest |=
+       if (ieee80211_hw_check(phy->hw, SUPPORTS_VHT_EXT_NSS_BW))
+               vht_cap->vht_mcs.tx_highest |=
                                cpu_to_le16(IEEE80211_VHT_EXT_NSS_BW_CAPABLE);
 }
 
index ad6c7d632eed45bdcf6c3e0abc43dcae9aab6507..d6aae60c440deb62efdbfb80a3272948460a49bb 100644 (file)
@@ -1088,7 +1088,7 @@ u32 mt7615_mac_get_sta_tid_sn(struct mt7615_dev *dev, int wcid, u8 tid)
        offset %= 32;
 
        val = mt76_rr(dev, addr);
-       val >>= (tid % 32);
+       val >>= offset;
 
        if (offset > 20) {
                addr += 4;
index 7bc92923104c1e21017c81d03bfc796f2f8d4d83..1c573e7a60bc854b8fa0503d4904d6415df9f929 100644 (file)
@@ -314,7 +314,7 @@ static int unflatten_dt_nodes(const void *blob,
        for (offset = 0;
             offset >= 0 && depth >= initial_depth;
             offset = fdt_next_node(blob, offset, &depth)) {
-               if (WARN_ON_ONCE(depth >= FDT_MAX_DEPTH))
+               if (WARN_ON_ONCE(depth >= FDT_MAX_DEPTH - 1))
                        continue;
 
                if (!IS_ENABLED(CONFIG_OF_KOBJ) &&
index f223afe47d1049849e88e678e994b6549bf3d03e..a66386043aa6643d87216005c426da904a0408c7 100644 (file)
@@ -1546,6 +1546,7 @@ static int __init ccio_probe(struct parisc_device *dev)
        }
        ccio_ioc_init(ioc);
        if (ccio_init_resources(ioc)) {
+               iounmap(ioc->ioc_regs);
                kfree(ioc);
                return -ENOMEM;
        }
index 3a8c986156348465b5890317906ecb8dad4bcd5b..bdef7a8d6ab8e89ed60573c88581fcd14ff75d9c 100644 (file)
@@ -221,16 +221,7 @@ static size_t irt_num_entry;
 
 static struct irt_entry *iosapic_alloc_irt(int num_entries)
 {
-       unsigned long a;
-
-       /* The IRT needs to be 8-byte aligned for the PDC call. 
-        * Normally kmalloc would guarantee larger alignment, but
-        * if CONFIG_DEBUG_SLAB is enabled, then we can get only
-        * 4-byte alignment on 32-bit kernels
-        */
-       a = (unsigned long)kmalloc(sizeof(struct irt_entry) * num_entries + 8, GFP_KERNEL);
-       a = (a + 7UL) & ~7UL;
-       return (struct irt_entry *)a;
+       return kcalloc(num_entries, sizeof(struct irt_entry), GFP_KERNEL);
 }
 
 /**
index c5fd154990c8b4b61bd52ca5b733ad9a930738a8..c7df8c5fe5854462d1585782c3d0f72b7a02f5dd 100644 (file)
@@ -331,6 +331,7 @@ struct ocelot_pinctrl {
        const struct ocelot_pincfg_data *pincfg_data;
        struct ocelot_pmx_func func[FUNC_MAX];
        u8 stride;
+       struct workqueue_struct *wq;
 };
 
 struct ocelot_match_data {
@@ -338,6 +339,11 @@ struct ocelot_match_data {
        struct ocelot_pincfg_data pincfg_data;
 };
 
+struct ocelot_irq_work {
+       struct work_struct irq_work;
+       struct irq_desc *irq_desc;
+};
+
 #define LUTON_P(p, f0, f1)                                             \
 static struct ocelot_pin_caps luton_pin_##p = {                                \
        .pin = p,                                                       \
@@ -1813,6 +1819,75 @@ static void ocelot_irq_mask(struct irq_data *data)
        gpiochip_disable_irq(chip, gpio);
 }
 
+static void ocelot_irq_work(struct work_struct *work)
+{
+       struct ocelot_irq_work *w = container_of(work, struct ocelot_irq_work, irq_work);
+       struct irq_chip *parent_chip = irq_desc_get_chip(w->irq_desc);
+       struct gpio_chip *chip = irq_desc_get_chip_data(w->irq_desc);
+       struct irq_data *data = irq_desc_get_irq_data(w->irq_desc);
+       unsigned int gpio = irqd_to_hwirq(data);
+
+       local_irq_disable();
+       chained_irq_enter(parent_chip, w->irq_desc);
+       generic_handle_domain_irq(chip->irq.domain, gpio);
+       chained_irq_exit(parent_chip, w->irq_desc);
+       local_irq_enable();
+
+       kfree(w);
+}
+
+static void ocelot_irq_unmask_level(struct irq_data *data)
+{
+       struct gpio_chip *chip = irq_data_get_irq_chip_data(data);
+       struct ocelot_pinctrl *info = gpiochip_get_data(chip);
+       struct irq_desc *desc = irq_data_to_desc(data);
+       unsigned int gpio = irqd_to_hwirq(data);
+       unsigned int bit = BIT(gpio % 32);
+       bool ack = false, active = false;
+       u8 trigger_level;
+       int val;
+
+       trigger_level = irqd_get_trigger_type(data);
+
+       /* Check if the interrupt line is still active. */
+       regmap_read(info->map, REG(OCELOT_GPIO_IN, info, gpio), &val);
+       if ((!(val & bit) && trigger_level == IRQ_TYPE_LEVEL_LOW) ||
+             (val & bit && trigger_level == IRQ_TYPE_LEVEL_HIGH))
+               active = true;
+
+       /*
+        * Check if the interrupt controller has seen any changes in the
+        * interrupt line.
+        */
+       regmap_read(info->map, REG(OCELOT_GPIO_INTR, info, gpio), &val);
+       if (val & bit)
+               ack = true;
+
+       /* Enable the interrupt now */
+       gpiochip_enable_irq(chip, gpio);
+       regmap_update_bits(info->map, REG(OCELOT_GPIO_INTR_ENA, info, gpio),
+                          bit, bit);
+
+       /*
+        * In case the interrupt line is still active and the interrupt
+        * controller has not seen any changes in the interrupt line, then it
+        * means that there happen another interrupt while the line was active.
+        * So we missed that one, so we need to kick the interrupt again
+        * handler.
+        */
+       if (active && !ack) {
+               struct ocelot_irq_work *work;
+
+               work = kmalloc(sizeof(*work), GFP_ATOMIC);
+               if (!work)
+                       return;
+
+               work->irq_desc = desc;
+               INIT_WORK(&work->irq_work, ocelot_irq_work);
+               queue_work(info->wq, &work->irq_work);
+       }
+}
+
 static void ocelot_irq_unmask(struct irq_data *data)
 {
        struct gpio_chip *chip = irq_data_get_irq_chip_data(data);
@@ -1836,13 +1911,12 @@ static void ocelot_irq_ack(struct irq_data *data)
 
 static int ocelot_irq_set_type(struct irq_data *data, unsigned int type);
 
-static struct irq_chip ocelot_eoi_irqchip = {
+static struct irq_chip ocelot_level_irqchip = {
        .name           = "gpio",
        .irq_mask       = ocelot_irq_mask,
-       .irq_eoi        = ocelot_irq_ack,
-       .irq_unmask     = ocelot_irq_unmask,
-       .flags          = IRQCHIP_EOI_THREADED | IRQCHIP_EOI_IF_HANDLED |
-                         IRQCHIP_IMMUTABLE,
+       .irq_ack        = ocelot_irq_ack,
+       .irq_unmask     = ocelot_irq_unmask_level,
+       .flags          = IRQCHIP_IMMUTABLE,
        .irq_set_type   = ocelot_irq_set_type,
        GPIOCHIP_IRQ_RESOURCE_HELPERS
 };
@@ -1859,14 +1933,9 @@ static struct irq_chip ocelot_irqchip = {
 
 static int ocelot_irq_set_type(struct irq_data *data, unsigned int type)
 {
-       type &= IRQ_TYPE_SENSE_MASK;
-
-       if (!(type & (IRQ_TYPE_EDGE_BOTH | IRQ_TYPE_LEVEL_HIGH)))
-               return -EINVAL;
-
-       if (type & IRQ_TYPE_LEVEL_HIGH)
-               irq_set_chip_handler_name_locked(data, &ocelot_eoi_irqchip,
-                                                handle_fasteoi_irq, NULL);
+       if (type & (IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_LEVEL_LOW))
+               irq_set_chip_handler_name_locked(data, &ocelot_level_irqchip,
+                                                handle_level_irq, NULL);
        if (type & IRQ_TYPE_EDGE_BOTH)
                irq_set_chip_handler_name_locked(data, &ocelot_irqchip,
                                                 handle_edge_irq, NULL);
@@ -1996,6 +2065,10 @@ static int ocelot_pinctrl_probe(struct platform_device *pdev)
        if (!info->desc)
                return -ENOMEM;
 
+       info->wq = alloc_ordered_workqueue("ocelot_ordered", 0);
+       if (!info->wq)
+               return -ENOMEM;
+
        info->pincfg_data = &data->pincfg_data;
 
        reset = devm_reset_control_get_optional_shared(dev, "switch");
@@ -2018,7 +2091,7 @@ static int ocelot_pinctrl_probe(struct platform_device *pdev)
                dev_err(dev, "Failed to create regmap\n");
                return PTR_ERR(info->map);
        }
-       dev_set_drvdata(dev, info->map);
+       dev_set_drvdata(dev, info);
        info->dev = dev;
 
        /* Pinconf registers */
@@ -2043,6 +2116,15 @@ static int ocelot_pinctrl_probe(struct platform_device *pdev)
        return 0;
 }
 
+static int ocelot_pinctrl_remove(struct platform_device *pdev)
+{
+       struct ocelot_pinctrl *info = platform_get_drvdata(pdev);
+
+       destroy_workqueue(info->wq);
+
+       return 0;
+}
+
 static struct platform_driver ocelot_pinctrl_driver = {
        .driver = {
                .name = "pinctrl-ocelot",
@@ -2050,6 +2132,7 @@ static struct platform_driver ocelot_pinctrl_driver = {
                .suppress_bind_attrs = true,
        },
        .probe = ocelot_pinctrl_probe,
+       .remove = ocelot_pinctrl_remove,
 };
 module_platform_driver(ocelot_pinctrl_driver);
 MODULE_LICENSE("Dual MIT/GPL");
index 6bec7f1431348d51480c756d5af5bc029a727973..704a99d2f93cebe91e21e14ac51655bde2de9a3b 100644 (file)
@@ -530,10 +530,10 @@ DECLARE_MSM_GPIO_PINS(187);
 DECLARE_MSM_GPIO_PINS(188);
 DECLARE_MSM_GPIO_PINS(189);
 
-static const unsigned int sdc2_clk_pins[] = { 190 };
-static const unsigned int sdc2_cmd_pins[] = { 191 };
-static const unsigned int sdc2_data_pins[] = { 192 };
-static const unsigned int ufs_reset_pins[] = { 193 };
+static const unsigned int ufs_reset_pins[] = { 190 };
+static const unsigned int sdc2_clk_pins[] = { 191 };
+static const unsigned int sdc2_cmd_pins[] = { 192 };
+static const unsigned int sdc2_data_pins[] = { 193 };
 
 enum sc8180x_functions {
        msm_mux_adsp_ext,
@@ -1582,7 +1582,7 @@ static const int sc8180x_acpi_reserved_gpios[] = {
 static const struct msm_gpio_wakeirq_map sc8180x_pdc_map[] = {
        { 3, 31 }, { 5, 32 }, { 8, 33 }, { 9, 34 }, { 10, 100 }, { 12, 104 },
        { 24, 37 }, { 26, 38 }, { 27, 41 }, { 28, 42 }, { 30, 39 }, { 36, 43 },
-       { 37, 43 }, { 38, 45 }, { 39, 118 }, { 39, 125 }, { 41, 47 },
+       { 37, 44 }, { 38, 45 }, { 39, 118 }, { 39, 125 }, { 41, 47 },
        { 42, 48 }, { 46, 50 }, { 47, 49 }, { 48, 51 }, { 49, 53 }, { 50, 52 },
        { 51, 116 }, { 51, 123 }, { 53, 54 }, { 54, 55 }, { 55, 56 },
        { 56, 57 }, { 58, 58 }, { 60, 60 }, { 68, 62 }, { 70, 63 }, { 76, 86 },
index afc1f5df75450bb5810f482966932bb4b0702aa1..b82ad135bf2aa6aeaaf36724ec586f179cfdb2ae 100644 (file)
@@ -99,7 +99,7 @@ MODULE_DEVICE_TABLE(of, a100_r_pinctrl_match);
 static struct platform_driver a100_r_pinctrl_driver = {
        .probe  = a100_r_pinctrl_probe,
        .driver = {
-               .name           = "sun50iw10p1-r-pinctrl",
+               .name           = "sun50i-a100-r-pinctrl",
                .of_match_table = a100_r_pinctrl_match,
        },
 };
index 565339a0811dbe92b3f341f0f05379d0e6187d67..331e896d8225df01040460c377876bf583894356 100644 (file)
@@ -2993,7 +2993,7 @@ _base_config_dma_addressing(struct MPT3SAS_ADAPTER *ioc, struct pci_dev *pdev)
 
        if (ioc->is_mcpu_endpoint ||
            sizeof(dma_addr_t) == 4 || ioc->use_32bit_dma ||
-           dma_get_required_mask(&pdev->dev) <= 32)
+           dma_get_required_mask(&pdev->dev) <= DMA_BIT_MASK(32))
                ioc->dma_mask = 32;
        /* Set 63 bit DMA mask for all SAS3 and SAS35 controllers */
        else if (ioc->hba_mpi_version_belonged > MPI2_VERSION)
index 3d6b137314f3f215862f898c9506a6c07f6aba54..bbc4d5890ae6abe92d2ff52f4c8d3ad62df08989 100644 (file)
@@ -3686,11 +3686,6 @@ err2:
 err1:
        scsi_host_put(lport->host);
 err0:
-       if (qedf) {
-               QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_DISC, "Probe done.\n");
-
-               clear_bit(QEDF_PROBING, &qedf->flags);
-       }
        return rc;
 }
 
index 62666df1a59eb770ea864c80819ab4223ce8e417..4acff4e84b90910e66eed26b928bfdba575c7420 100644 (file)
@@ -2151,8 +2151,10 @@ static int __qlt_24xx_handle_abts(struct scsi_qla_host *vha,
 
        abort_cmd = ha->tgt.tgt_ops->find_cmd_by_tag(sess,
                                le32_to_cpu(abts->exchange_addr_to_abort));
-       if (!abort_cmd)
+       if (!abort_cmd) {
+               mempool_free(mcmd, qla_tgt_mgmt_cmd_mempool);
                return -EIO;
+       }
        mcmd->unpacked_lun = abort_cmd->se_cmd.orig_fe_lun;
 
        if (abort_cmd->qpair) {
index 886c564787f152f8eef16d0990bf9242662bdc88..b58b445bb529b32edc134356ccac907ea2d3954f 100644 (file)
 #define SYNTHVID_DEPTH_WIN8 32
 #define SYNTHVID_FB_SIZE_WIN8 (8 * 1024 * 1024)
 
-#define PCI_VENDOR_ID_MICROSOFT 0x1414
-#define PCI_DEVICE_ID_HYPERV_VIDEO 0x5353
-
-
 enum pipe_msg_type {
        PIPE_MSG_INVALID,
        PIPE_MSG_DATA,
index d5f3f763717eaee68181a66ec6c7eb19289d2c81..d4b2519257962de62ebb83ac52327e41dcbf6cdb 100644 (file)
@@ -382,9 +382,10 @@ int xenbus_setup_ring(struct xenbus_device *dev, gfp_t gfp, void **vaddr,
        unsigned long ring_size = nr_pages * XEN_PAGE_SIZE;
        grant_ref_t gref_head;
        unsigned int i;
+       void *addr;
        int ret;
 
-       *vaddr = alloc_pages_exact(ring_size, gfp | __GFP_ZERO);
+       addr = *vaddr = alloc_pages_exact(ring_size, gfp | __GFP_ZERO);
        if (!*vaddr) {
                ret = -ENOMEM;
                goto err;
@@ -401,13 +402,15 @@ int xenbus_setup_ring(struct xenbus_device *dev, gfp_t gfp, void **vaddr,
                unsigned long gfn;
 
                if (is_vmalloc_addr(*vaddr))
-                       gfn = pfn_to_gfn(vmalloc_to_pfn(vaddr[i]));
+                       gfn = pfn_to_gfn(vmalloc_to_pfn(addr));
                else
-                       gfn = virt_to_gfn(vaddr[i]);
+                       gfn = virt_to_gfn(addr);
 
                grefs[i] = gnttab_claim_grant_reference(&gref_head);
                gnttab_grant_foreign_access_ref(grefs[i], dev->otherend_id,
                                                gfn, 0);
+
+               addr += XEN_PAGE_SIZE;
        }
 
        return 0;
index 1af28b066b42a1a54c78951de8a0839b6a545532..2633137c3e9f1efc4d07bd262152104a3633e32a 100644 (file)
@@ -4474,6 +4474,17 @@ void __cold close_ctree(struct btrfs_fs_info *fs_info)
 
        set_bit(BTRFS_FS_CLOSING_START, &fs_info->flags);
 
+       /*
+        * If we had UNFINISHED_DROPS we could still be processing them, so
+        * clear that bit and wake up relocation so it can stop.
+        * We must do this before stopping the block group reclaim task, because
+        * at btrfs_relocate_block_group() we wait for this bit, and after the
+        * wait we stop with -EINTR if btrfs_fs_closing() returns non-zero - we
+        * have just set BTRFS_FS_CLOSING_START, so btrfs_fs_closing() will
+        * return 1.
+        */
+       btrfs_wake_unfinished_drop(fs_info);
+
        /*
         * We may have the reclaim task running and relocating a data block group,
         * in which case it may create delayed iputs. So stop it before we park
@@ -4492,12 +4503,6 @@ void __cold close_ctree(struct btrfs_fs_info *fs_info)
         */
        kthread_park(fs_info->cleaner_kthread);
 
-       /*
-        * If we had UNFINISHED_DROPS we could still be processing them, so
-        * clear that bit and wake up relocation so it can stop.
-        */
-       btrfs_wake_unfinished_drop(fs_info);
-
        /* wait for the qgroup rescan worker to stop */
        btrfs_qgroup_wait_for_completion(fs_info, false);
 
@@ -4520,6 +4525,31 @@ void __cold close_ctree(struct btrfs_fs_info *fs_info)
        /* clear out the rbtree of defraggable inodes */
        btrfs_cleanup_defrag_inodes(fs_info);
 
+       /*
+        * After we parked the cleaner kthread, ordered extents may have
+        * completed and created new delayed iputs. If one of the async reclaim
+        * tasks is running and in the RUN_DELAYED_IPUTS flush state, then we
+        * can hang forever trying to stop it, because if a delayed iput is
+        * added after it ran btrfs_run_delayed_iputs() and before it called
+        * btrfs_wait_on_delayed_iputs(), it will hang forever since there is
+        * no one else to run iputs.
+        *
+        * So wait for all ongoing ordered extents to complete and then run
+        * delayed iputs. This works because once we reach this point no one
+        * can either create new ordered extents nor create delayed iputs
+        * through some other means.
+        *
+        * Also note that btrfs_wait_ordered_roots() is not safe here, because
+        * it waits for BTRFS_ORDERED_COMPLETE to be set on an ordered extent,
+        * but the delayed iput for the respective inode is made only when doing
+        * the final btrfs_put_ordered_extent() (which must happen at
+        * btrfs_finish_ordered_io() when we are unmounting).
+        */
+       btrfs_flush_workqueue(fs_info->endio_write_workers);
+       /* Ordered extents for free space inodes. */
+       btrfs_flush_workqueue(fs_info->endio_freespace_worker);
+       btrfs_run_delayed_iputs(fs_info);
+
        cancel_work_sync(&fs_info->async_reclaim_work);
        cancel_work_sync(&fs_info->async_data_reclaim_work);
        cancel_work_sync(&fs_info->preempt_reclaim_work);
index 62e7007a7e46c6ea8bc04f4ba48638498052c11b..73c6929f7be66163d72a36d4790154ba7e882978 100644 (file)
@@ -1918,10 +1918,44 @@ out_unlock:
        return ret;
 }
 
+static void wait_eb_writebacks(struct btrfs_block_group *block_group)
+{
+       struct btrfs_fs_info *fs_info = block_group->fs_info;
+       const u64 end = block_group->start + block_group->length;
+       struct radix_tree_iter iter;
+       struct extent_buffer *eb;
+       void __rcu **slot;
+
+       rcu_read_lock();
+       radix_tree_for_each_slot(slot, &fs_info->buffer_radix, &iter,
+                                block_group->start >> fs_info->sectorsize_bits) {
+               eb = radix_tree_deref_slot(slot);
+               if (!eb)
+                       continue;
+               if (radix_tree_deref_retry(eb)) {
+                       slot = radix_tree_iter_retry(&iter);
+                       continue;
+               }
+
+               if (eb->start < block_group->start)
+                       continue;
+               if (eb->start >= end)
+                       break;
+
+               slot = radix_tree_iter_resume(slot, &iter);
+               rcu_read_unlock();
+               wait_on_extent_buffer_writeback(eb);
+               rcu_read_lock();
+       }
+       rcu_read_unlock();
+}
+
 static int do_zone_finish(struct btrfs_block_group *block_group, bool fully_written)
 {
        struct btrfs_fs_info *fs_info = block_group->fs_info;
        struct map_lookup *map;
+       const bool is_metadata = (block_group->flags &
+                       (BTRFS_BLOCK_GROUP_METADATA | BTRFS_BLOCK_GROUP_SYSTEM));
        int ret = 0;
        int i;
 
@@ -1932,8 +1966,7 @@ static int do_zone_finish(struct btrfs_block_group *block_group, bool fully_writ
        }
 
        /* Check if we have unwritten allocated space */
-       if ((block_group->flags &
-            (BTRFS_BLOCK_GROUP_METADATA | BTRFS_BLOCK_GROUP_SYSTEM)) &&
+       if (is_metadata &&
            block_group->start + block_group->alloc_offset > block_group->meta_write_pointer) {
                spin_unlock(&block_group->lock);
                return -EAGAIN;
@@ -1958,6 +1991,9 @@ static int do_zone_finish(struct btrfs_block_group *block_group, bool fully_writ
                /* No need to wait for NOCOW writers. Zoned mode does not allow that */
                btrfs_wait_ordered_roots(fs_info, U64_MAX, block_group->start,
                                         block_group->length);
+               /* Wait for extent buffers to be written. */
+               if (is_metadata)
+                       wait_eb_writebacks(block_group);
 
                spin_lock(&block_group->lock);
 
index 81f4c15936d050273b9f1ef0a49aa72e86efaf2f..5b4a7a32bdc58c65d71e514dfb0fde0ea2dbac55 100644 (file)
@@ -153,6 +153,6 @@ extern const struct export_operations cifs_export_ops;
 #endif /* CONFIG_CIFS_NFSD_EXPORT */
 
 /* when changing internal version - update following two lines at same time */
-#define SMB3_PRODUCT_BUILD 38
-#define CIFS_VERSION   "2.38"
+#define SMB3_PRODUCT_BUILD 39
+#define CIFS_VERSION   "2.39"
 #endif                         /* _CIFSFS_H */
index a0a06b6f252be3a6d205d325c735d7a17ee02c0a..7ae6f2c08153e63b17cc19262fad12562a53cecd 100644 (file)
@@ -702,9 +702,6 @@ cifs_readv_from_socket(struct TCP_Server_Info *server, struct msghdr *smb_msg)
        int length = 0;
        int total_read;
 
-       smb_msg->msg_control = NULL;
-       smb_msg->msg_controllen = 0;
-
        for (total_read = 0; msg_data_left(smb_msg); total_read += length) {
                try_to_freeze();
 
@@ -760,7 +757,7 @@ int
 cifs_read_from_socket(struct TCP_Server_Info *server, char *buf,
                      unsigned int to_read)
 {
-       struct msghdr smb_msg;
+       struct msghdr smb_msg = {};
        struct kvec iov = {.iov_base = buf, .iov_len = to_read};
        iov_iter_kvec(&smb_msg.msg_iter, READ, &iov, 1, to_read);
 
@@ -770,15 +767,13 @@ cifs_read_from_socket(struct TCP_Server_Info *server, char *buf,
 ssize_t
 cifs_discard_from_socket(struct TCP_Server_Info *server, size_t to_read)
 {
-       struct msghdr smb_msg;
+       struct msghdr smb_msg = {};
 
        /*
         *  iov_iter_discard already sets smb_msg.type and count and iov_offset
         *  and cifs_readv_from_socket sets msg_control and msg_controllen
         *  so little to initialize in struct msghdr
         */
-       smb_msg.msg_name = NULL;
-       smb_msg.msg_namelen = 0;
        iov_iter_discard(&smb_msg.msg_iter, READ, to_read);
 
        return cifs_readv_from_socket(server, &smb_msg);
@@ -788,7 +783,7 @@ int
 cifs_read_page_from_socket(struct TCP_Server_Info *server, struct page *page,
        unsigned int page_offset, unsigned int to_read)
 {
-       struct msghdr smb_msg;
+       struct msghdr smb_msg = {};
        struct bio_vec bv = {
                .bv_page = page, .bv_len = to_read, .bv_offset = page_offset};
        iov_iter_bvec(&smb_msg.msg_iter, READ, &bv, 1, to_read);
@@ -2350,7 +2345,9 @@ cifs_put_tcon(struct cifs_tcon *tcon)
        ses = tcon->ses;
        cifs_dbg(FYI, "%s: tc_count=%d\n", __func__, tcon->tc_count);
        spin_lock(&cifs_tcp_ses_lock);
+       spin_lock(&tcon->tc_lock);
        if (--tcon->tc_count > 0) {
+               spin_unlock(&tcon->tc_lock);
                spin_unlock(&cifs_tcp_ses_lock);
                return;
        }
@@ -2359,6 +2356,7 @@ cifs_put_tcon(struct cifs_tcon *tcon)
        WARN_ON(tcon->tc_count < 0);
 
        list_del_init(&tcon->tcon_list);
+       spin_unlock(&tcon->tc_lock);
        spin_unlock(&cifs_tcp_ses_lock);
 
        /* cancel polling of interfaces */
index fa738adc031f728d2cd553f0dcaababf2fc275ac..6f38b134a346851bb07fe72653571680211ff7e0 100644 (file)
@@ -3575,6 +3575,9 @@ static ssize_t __cifs_writev(
 
 ssize_t cifs_direct_writev(struct kiocb *iocb, struct iov_iter *from)
 {
+       struct file *file = iocb->ki_filp;
+
+       cifs_revalidate_mapping(file->f_inode);
        return __cifs_writev(iocb, from, true);
 }
 
index c2fe035e573ba01eaf366668e83c9802e5752a4d..9a2753e2117073666de3e3f0215dc7526bc8601a 100644 (file)
@@ -194,10 +194,6 @@ smb_send_kvec(struct TCP_Server_Info *server, struct msghdr *smb_msg,
 
        *sent = 0;
 
-       smb_msg->msg_name = (struct sockaddr *) &server->dstaddr;
-       smb_msg->msg_namelen = sizeof(struct sockaddr);
-       smb_msg->msg_control = NULL;
-       smb_msg->msg_controllen = 0;
        if (server->noblocksnd)
                smb_msg->msg_flags = MSG_DONTWAIT + MSG_NOSIGNAL;
        else
@@ -309,7 +305,7 @@ __smb_send_rqst(struct TCP_Server_Info *server, int num_rqst,
        sigset_t mask, oldmask;
        size_t total_len = 0, sent, size;
        struct socket *ssocket = server->ssocket;
-       struct msghdr smb_msg;
+       struct msghdr smb_msg = {};
        __be32 rfc1002_marker;
 
        if (cifs_rdma_enabled(server)) {
index 9a5ca7b82bfc5ee62e1533c35fbf7e587b077572..d046dbb9cbd08317cbaef0fb18a73399dd9571c3 100644 (file)
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -65,7 +65,6 @@
 #include <linux/io_uring.h>
 #include <linux/syscall_user_dispatch.h>
 #include <linux/coredump.h>
-#include <linux/time_namespace.h>
 
 #include <linux/uaccess.h>
 #include <asm/mmu_context.h>
@@ -979,12 +978,10 @@ static int exec_mmap(struct mm_struct *mm)
 {
        struct task_struct *tsk;
        struct mm_struct *old_mm, *active_mm;
-       bool vfork;
        int ret;
 
        /* Notify parent that we're no longer interested in the old VM */
        tsk = current;
-       vfork = !!tsk->vfork_done;
        old_mm = current->mm;
        exec_mm_release(tsk, old_mm);
        if (old_mm)
@@ -1029,10 +1026,6 @@ static int exec_mmap(struct mm_struct *mm)
        tsk->mm->vmacache_seqnum = 0;
        vmacache_flush(tsk);
        task_unlock(tsk);
-
-       if (vfork)
-               timens_on_fork(tsk->nsproxy, tsk);
-
        if (old_mm) {
                mmap_read_unlock(old_mm);
                BUG_ON(active_mm != old_mm);
index ee0b7cf51157059c6fee3c6fc6edd67560862c88..41ae4cce1f4203c1d8ecd6e4bd92e23fc42f7366 100644 (file)
@@ -270,8 +270,7 @@ int exfat_zeroed_cluster(struct inode *dir, unsigned int clu)
        struct super_block *sb = dir->i_sb;
        struct exfat_sb_info *sbi = EXFAT_SB(sb);
        struct buffer_head *bh;
-       sector_t blknr, last_blknr;
-       int i;
+       sector_t blknr, last_blknr, i;
 
        blknr = exfat_cluster_to_sector(sbi, clu);
        last_blknr = blknr + sbi->sect_per_clus;
index 27c720d71b4e33c65b6cf05d5053acec8a853c4c..898dd95bc7a7c705cb8e8de8e229262008efee57 100644 (file)
@@ -606,6 +606,31 @@ static inline gfp_t nfs_io_gfp_mask(void)
        return GFP_KERNEL;
 }
 
+/*
+ * Special version of should_remove_suid() that ignores capabilities.
+ */
+static inline int nfs_should_remove_suid(const struct inode *inode)
+{
+       umode_t mode = inode->i_mode;
+       int kill = 0;
+
+       /* suid always must be killed */
+       if (unlikely(mode & S_ISUID))
+               kill = ATTR_KILL_SUID;
+
+       /*
+        * sgid without any exec bits is just a mandatory locking mark; leave
+        * it alone.  If some exec bits are set, it's a real sgid; kill it.
+        */
+       if (unlikely((mode & S_ISGID) && (mode & S_IXGRP)))
+               kill |= ATTR_KILL_SGID;
+
+       if (unlikely(kill && S_ISREG(mode)))
+               return kill;
+
+       return 0;
+}
+
 /* unlink.c */
 extern struct rpc_task *
 nfs_async_rename(struct inode *old_dir, struct inode *new_dir,
index 068c45b3bc1ab19593441cc5b336e5e50a5e4322..6dab9e40837298405f98617b64076f7a6ce79f90 100644 (file)
@@ -78,10 +78,15 @@ static int _nfs42_proc_fallocate(struct rpc_message *msg, struct file *filep,
 
        status = nfs4_call_sync(server->client, server, msg,
                                &args.seq_args, &res.seq_res, 0);
-       if (status == 0)
+       if (status == 0) {
+               if (nfs_should_remove_suid(inode)) {
+                       spin_lock(&inode->i_lock);
+                       nfs_set_cache_invalid(inode, NFS_INO_INVALID_MODE);
+                       spin_unlock(&inode->i_lock);
+               }
                status = nfs_post_op_update_inode_force_wcc(inode,
                                                            res.falloc_fattr);
-
+       }
        if (msg->rpc_proc == &nfs4_procedures[NFSPROC4_CLNT_ALLOCATE])
                trace_nfs4_fallocate(inode, &args, status);
        else
index 82944e14fcea19533f9bb2ea9e1819ea0da784ec..ee66ffdb985e8094131a5226baecb876cb05c4a0 100644 (file)
@@ -1051,22 +1051,31 @@ static void nfs_fill_super(struct super_block *sb, struct nfs_fs_context *ctx)
        if (ctx->bsize)
                sb->s_blocksize = nfs_block_size(ctx->bsize, &sb->s_blocksize_bits);
 
-       if (server->nfs_client->rpc_ops->version != 2) {
-               /* The VFS shouldn't apply the umask to mode bits. We will do
-                * so ourselves when necessary.
+       switch (server->nfs_client->rpc_ops->version) {
+       case 2:
+               sb->s_time_gran = 1000;
+               sb->s_time_min = 0;
+               sb->s_time_max = U32_MAX;
+               break;
+       case 3:
+               /*
+                * The VFS shouldn't apply the umask to mode bits.
+                * We will do so ourselves when necessary.
                 */
                sb->s_flags |= SB_POSIXACL;
                sb->s_time_gran = 1;
-               sb->s_export_op = &nfs_export_ops;
-       } else
-               sb->s_time_gran = 1000;
-
-       if (server->nfs_client->rpc_ops->version != 4) {
                sb->s_time_min = 0;
                sb->s_time_max = U32_MAX;
-       } else {
+               sb->s_export_op = &nfs_export_ops;
+               break;
+       case 4:
+               sb->s_flags |= SB_POSIXACL;
+               sb->s_time_gran = 1;
                sb->s_time_min = S64_MIN;
                sb->s_time_max = S64_MAX;
+               if (server->caps & NFS_CAP_ATOMIC_OPEN_V1)
+                       sb->s_export_op = &nfs_export_ops;
+               break;
        }
 
        sb->s_magic = NFS_SUPER_MAGIC;
index 1843fa235d9b64c045cc89f3767b2ed9a1cbf6e5..f41d24b54fd1f8b19a3e34e8cfad1bdb7b5ff206 100644 (file)
@@ -1496,31 +1496,6 @@ void nfs_commit_prepare(struct rpc_task *task, void *calldata)
        NFS_PROTO(data->inode)->commit_rpc_prepare(task, data);
 }
 
-/*
- * Special version of should_remove_suid() that ignores capabilities.
- */
-static int nfs_should_remove_suid(const struct inode *inode)
-{
-       umode_t mode = inode->i_mode;
-       int kill = 0;
-
-       /* suid always must be killed */
-       if (unlikely(mode & S_ISUID))
-               kill = ATTR_KILL_SUID;
-
-       /*
-        * sgid without any exec bits is just a mandatory locking mark; leave
-        * it alone.  If some exec bits are set, it's a real sgid; kill it.
-        */
-       if (unlikely((mode & S_ISGID) && (mode & S_IXGRP)))
-               kill |= ATTR_KILL_SGID;
-
-       if (unlikely(kill && S_ISREG(mode)))
-               return kill;
-
-       return 0;
-}
-
 static void nfs_writeback_check_extend(struct nfs_pgio_header *hdr,
                struct nfs_fattr *fattr)
 {
index 9f486b788ed09fdd007ca342bc4f4e9fe34273cb..fc17b0ac8729792ba277d5117ea77da40372d47c 100644 (file)
@@ -300,6 +300,10 @@ commit_metadata(struct svc_fh *fhp)
 static void
 nfsd_sanitize_attrs(struct inode *inode, struct iattr *iap)
 {
+       /* Ignore mode updates on symlinks */
+       if (S_ISLNK(inode->i_mode))
+               iap->ia_valid &= ~ATTR_MODE;
+
        /* sanitize the mode change */
        if (iap->ia_valid & ATTR_MODE) {
                iap->ia_mode &= S_IALLUGO;
@@ -353,7 +357,7 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp,
        int             accmode = NFSD_MAY_SATTR;
        umode_t         ftype = 0;
        __be32          err;
-       int             host_err;
+       int             host_err = 0;
        bool            get_write_count;
        bool            size_change = (iap->ia_valid & ATTR_SIZE);
 
@@ -391,13 +395,6 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp,
        dentry = fhp->fh_dentry;
        inode = d_inode(dentry);
 
-       /* Ignore any mode updates on symlinks */
-       if (S_ISLNK(inode->i_mode))
-               iap->ia_valid &= ~ATTR_MODE;
-
-       if (!iap->ia_valid)
-               return 0;
-
        nfsd_sanitize_attrs(inode, iap);
 
        if (check_guard && guardtime != inode->i_ctime.tv_sec)
@@ -448,8 +445,10 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp,
                        goto out_unlock;
        }
 
-       iap->ia_valid |= ATTR_CTIME;
-       host_err = notify_change(&init_user_ns, dentry, iap, NULL);
+       if (iap->ia_valid) {
+               iap->ia_valid |= ATTR_CTIME;
+               host_err = notify_change(&init_user_ns, dentry, iap, NULL);
+       }
 
 out_unlock:
        if (attr->na_seclabel && attr->na_seclabel->len)
@@ -846,10 +845,14 @@ nfsd_splice_actor(struct pipe_inode_info *pipe, struct pipe_buffer *buf,
                  struct splice_desc *sd)
 {
        struct svc_rqst *rqstp = sd->u.data;
-
-       svc_rqst_replace_page(rqstp, buf->page);
-       if (rqstp->rq_res.page_len == 0)
-               rqstp->rq_res.page_base = buf->offset;
+       struct page *page = buf->page;  // may be a compound one
+       unsigned offset = buf->offset;
+
+       page += offset / PAGE_SIZE;
+       for (int i = sd->len; i > 0; i -= PAGE_SIZE)
+               svc_rqst_replace_page(rqstp, page++);
+       if (rqstp->rq_res.page_len == 0)        // first call
+               rqstp->rq_res.page_base = offset % PAGE_SIZE;
        rqstp->rq_res.page_len += sd->len;
        return sd->len;
 }
index 8a813fa5ca56511fd946903376d40cfcc2cb8d73..cf7e5c350a54be924b40fff310ba03177d539905 100644 (file)
--- a/fs/open.c
+++ b/fs/open.c
@@ -716,6 +716,8 @@ int chown_common(const struct path *path, uid_t user, gid_t group)
        fs_userns = i_user_ns(inode);
 
 retry_deleg:
+       newattrs.ia_vfsuid = INVALID_VFSUID;
+       newattrs.ia_vfsgid = INVALID_VFSGID;
        newattrs.ia_valid =  ATTR_CTIME;
        if ((user != (uid_t)-1) && !setattr_vfsuid(&newattrs, uid))
                return -EINVAL;
index 8917a32173c4eb07ca65c30b13a35c8ce40116d3..d81a51978d0132fc6db24557c8dbe77244f1fe06 100644 (file)
@@ -65,7 +65,6 @@ struct dmar_pci_notify_info {
 
 extern struct rw_semaphore dmar_global_lock;
 extern struct list_head dmar_drhd_units;
-extern int intel_iommu_enabled;
 
 #define for_each_drhd_unit(drhd)                                       \
        list_for_each_entry_rcu(drhd, &dmar_drhd_units, list,           \
@@ -89,8 +88,7 @@ extern int intel_iommu_enabled;
 static inline bool dmar_rcu_check(void)
 {
        return rwsem_is_locked(&dmar_global_lock) ||
-              system_state == SYSTEM_BOOTING ||
-              (IS_ENABLED(CONFIG_INTEL_IOMMU) && !intel_iommu_enabled);
+              system_state == SYSTEM_BOOTING;
 }
 
 #define        dmar_rcu_dereference(p) rcu_dereference_check((p), dmar_rcu_check())
index 6f1dee7e67e068663ab26e288fe1c93c912ecb3c..9be8704e2d38e20e678f62a4c8de365be3497824 100644 (file)
@@ -180,7 +180,7 @@ switch (val) {                                              \
 
 #define HP_SDC_CMD_SET_IM      0x40    /* 010xxxxx == set irq mask */
 
-/* The documents provided do not explicitly state that all registers betwee
+/* The documents provided do not explicitly state that all registers between
  * 0x01 and 0x1f inclusive can be read by sending their register index as a 
  * command, but this is implied and appears to be the case.
  */
index 1d7992a02e36e283438254ef84ad704e209e2848..1a803e4335d30528aae1ba07674d82d47ba84ff3 100644 (file)
@@ -101,8 +101,9 @@ static inline struct device_node *of_cpu_device_node_get(int cpu)
 }
 
 static inline int of_dma_configure_id(struct device *dev,
-                                  struct device_node *np,
-                                  bool force_dma)
+                                     struct device_node *np,
+                                     bool force_dma,
+                                     const u32 *id)
 {
        return 0;
 }
index 6feade66efdbdccf28e85ecb9e37bfd8aa80e227..15b49e655ce3649bd51d958b32fd08703034b0ba 100644 (file)
 #define PCI_DEVICE_ID_ICE_1712         0x1712
 #define PCI_DEVICE_ID_VT1724           0x1724
 
+#define PCI_VENDOR_ID_MICROSOFT                0x1414
+#define PCI_DEVICE_ID_HYPERV_VIDEO     0x5353
+
 #define PCI_VENDOR_ID_OXSEMI           0x1415
 #define PCI_DEVICE_ID_OXSEMI_12PCI840  0x8403
 #define PCI_DEVICE_ID_OXSEMI_PCIe840           0xC000
index a193884ecf2b19d64ae29eecb114dc6e6008d1a9..4f765bc788ffb7bd1a6d09ab3705a2ae27c19e9a 100644 (file)
@@ -84,7 +84,7 @@ struct scmi_protocol_handle;
 struct scmi_clk_proto_ops {
        int (*count_get)(const struct scmi_protocol_handle *ph);
 
-       const struct scmi_clock_info *(*info_get)
+       const struct scmi_clock_info __must_check *(*info_get)
                (const struct scmi_protocol_handle *ph, u32 clk_id);
        int (*rate_get)(const struct scmi_protocol_handle *ph, u32 clk_id,
                        u64 *rate);
@@ -466,7 +466,7 @@ enum scmi_sensor_class {
  */
 struct scmi_sensor_proto_ops {
        int (*count_get)(const struct scmi_protocol_handle *ph);
-       const struct scmi_sensor_info *(*info_get)
+       const struct scmi_sensor_info __must_check *(*info_get)
                (const struct scmi_protocol_handle *ph, u32 sensor_id);
        int (*trip_point_config)(const struct scmi_protocol_handle *ph,
                                 u32 sensor_id, u8 trip_id, u64 trip_value);
index 0520e21ab698349457a7b2861a5eb2d57708419d..9949870f7d780367cd9628522e9a3c00b024493f 100644 (file)
@@ -124,8 +124,6 @@ struct hci_dev_info {
        __u16 acl_pkts;
        __u16 sco_mtu;
        __u16 sco_pkts;
-       __u16 iso_mtu;
-       __u16 iso_pkts;
 
        struct hci_dev_stats stat;
 };
index be2992e6de5d50c5cde8ba4c47a4dd1802c606f2..a016f275cb0163babd5f2c9243371c35f5db959f 100644 (file)
@@ -15,8 +15,6 @@
 #define PKT_TYPE_LACPDU         cpu_to_be16(ETH_P_SLOW)
 #define AD_TIMER_INTERVAL       100 /*msec*/
 
-#define MULTICAST_LACPDU_ADDR    {0x01, 0x80, 0xC2, 0x00, 0x00, 0x02}
-
 #define AD_LACP_SLOW 0
 #define AD_LACP_FAST 1
 
index afd606df149adc4b1e18a562fa5f9f71f0e85a47..e999f851738bd68b88ffb82daa6960aa5068c229 100644 (file)
@@ -786,6 +786,9 @@ extern struct rtnl_link_ops bond_link_ops;
 /* exported from bond_sysfs_slave.c */
 extern const struct sysfs_ops slave_sysfs_ops;
 
+/* exported from bond_3ad.c */
+extern const u8 lacpdu_mcast_addr[];
+
 static inline netdev_tx_t bond_tx_drop(struct net_device *dev, struct sk_buff *skb)
 {
        dev_core_stats_tx_dropped_inc(dev);
index d0d188c3294bd68eeaed992f06a5e20ba33a7648..a8994f307fc3896a85aeecc5007dcadd1166118c 100644 (file)
 #ifndef IEEE802154_NETDEVICE_H
 #define IEEE802154_NETDEVICE_H
 
+#define IEEE802154_REQUIRED_SIZE(struct_type, member) \
+       (offsetof(typeof(struct_type), member) + \
+       sizeof(((typeof(struct_type) *)(NULL))->member))
+
+#define IEEE802154_ADDR_OFFSET \
+       offsetof(typeof(struct sockaddr_ieee802154), addr)
+
+#define IEEE802154_MIN_NAMELEN (IEEE802154_ADDR_OFFSET + \
+       IEEE802154_REQUIRED_SIZE(struct ieee802154_addr_sa, addr_type))
+
+#define IEEE802154_NAMELEN_SHORT (IEEE802154_ADDR_OFFSET + \
+       IEEE802154_REQUIRED_SIZE(struct ieee802154_addr_sa, short_addr))
+
+#define IEEE802154_NAMELEN_LONG (IEEE802154_ADDR_OFFSET + \
+       IEEE802154_REQUIRED_SIZE(struct ieee802154_addr_sa, hwaddr))
+
 #include <net/af_ieee802154.h>
 #include <linux/netdevice.h>
 #include <linux/skbuff.h>
@@ -165,6 +181,27 @@ static inline void ieee802154_devaddr_to_raw(void *raw, __le64 addr)
        memcpy(raw, &temp, IEEE802154_ADDR_LEN);
 }
 
+static inline int
+ieee802154_sockaddr_check_size(struct sockaddr_ieee802154 *daddr, int len)
+{
+       struct ieee802154_addr_sa *sa;
+
+       sa = &daddr->addr;
+       if (len < IEEE802154_MIN_NAMELEN)
+               return -EINVAL;
+       switch (sa->addr_type) {
+       case IEEE802154_ADDR_SHORT:
+               if (len < IEEE802154_NAMELEN_SHORT)
+                       return -EINVAL;
+               break;
+       case IEEE802154_ADDR_LONG:
+               if (len < IEEE802154_NAMELEN_LONG)
+                       return -EINVAL;
+               break;
+       }
+       return 0;
+}
+
 static inline void ieee802154_addr_from_sa(struct ieee802154_addr *a,
                                           const struct ieee802154_addr_sa *sa)
 {
index 65016a767b7ae9e8d041ec406a22ebe8e49ade05..f160d68f961d2685204eaaa95f55061d3471c0c5 100644 (file)
@@ -27,9 +27,9 @@ TRACE_EVENT(scmi_fc_call,
                __entry->val2 = val2;
        ),
 
-       TP_printk("[0x%02X]:[0x%02X]:[%08X]:%u:%u",
-                 __entry->protocol_id, __entry->msg_id,
-                 __entry->res_id, __entry->val1, __entry->val2)
+       TP_printk("pt=%02X msg_id=%02X res_id:%u vals=%u:%u",
+               __entry->protocol_id, __entry->msg_id,
+               __entry->res_id, __entry->val1, __entry->val2)
 );
 
 TRACE_EVENT(scmi_xfer_begin,
@@ -53,9 +53,9 @@ TRACE_EVENT(scmi_xfer_begin,
                __entry->poll = poll;
        ),
 
-       TP_printk("transfer_id=%d msg_id=%u protocol_id=%u seq=%u poll=%u",
-               __entry->transfer_id, __entry->msg_id, __entry->protocol_id,
-               __entry->seq, __entry->poll)
+       TP_printk("pt=%02X msg_id=%02X seq=%04X transfer_id=%X poll=%u",
+               __entry->protocol_id, __entry->msg_id, __entry->seq,
+               __entry->transfer_id, __entry->poll)
 );
 
 TRACE_EVENT(scmi_xfer_response_wait,
@@ -81,9 +81,9 @@ TRACE_EVENT(scmi_xfer_response_wait,
                __entry->poll = poll;
        ),
 
-       TP_printk("transfer_id=%d msg_id=%u protocol_id=%u seq=%u tmo_ms=%u poll=%u",
-               __entry->transfer_id, __entry->msg_id, __entry->protocol_id,
-               __entry->seq, __entry->timeout, __entry->poll)
+       TP_printk("pt=%02X msg_id=%02X seq=%04X transfer_id=%X tmo_ms=%u poll=%u",
+               __entry->protocol_id, __entry->msg_id, __entry->seq,
+               __entry->transfer_id, __entry->timeout, __entry->poll)
 );
 
 TRACE_EVENT(scmi_xfer_end,
@@ -107,9 +107,9 @@ TRACE_EVENT(scmi_xfer_end,
                __entry->status = status;
        ),
 
-       TP_printk("transfer_id=%d msg_id=%u protocol_id=%u seq=%u status=%d",
-               __entry->transfer_id, __entry->msg_id, __entry->protocol_id,
-               __entry->seq, __entry->status)
+       TP_printk("pt=%02X msg_id=%02X seq=%04X transfer_id=%X s=%d",
+               __entry->protocol_id, __entry->msg_id, __entry->seq,
+               __entry->transfer_id, __entry->status)
 );
 
 TRACE_EVENT(scmi_rx_done,
@@ -133,9 +133,9 @@ TRACE_EVENT(scmi_rx_done,
                __entry->msg_type = msg_type;
        ),
 
-       TP_printk("transfer_id=%d msg_id=%u protocol_id=%u seq=%u msg_type=%u",
-               __entry->transfer_id, __entry->msg_id, __entry->protocol_id,
-               __entry->seq, __entry->msg_type)
+       TP_printk("pt=%02X msg_id=%02X seq=%04X transfer_id=%X msg_type=%u",
+               __entry->protocol_id, __entry->msg_id, __entry->seq,
+               __entry->transfer_id, __entry->msg_type)
 );
 
 TRACE_EVENT(scmi_msg_dump,
index 976c4ba68ee7ec07052d0a5473a487ed8a1c9822..4a7e5d030c782f1d175b69afb463b2cc52c7f814 100644 (file)
@@ -165,7 +165,8 @@ done:
                req_set_fail(req);
        io_req_set_res(req, ret, 0);
        /* put file to avoid an attempt to IOPOLL the req */
-       io_put_file(req->file);
+       if (!(req->flags & REQ_F_FIXED_FILE))
+               io_put_file(req->file);
        req->file = NULL;
        return IOU_OK;
 }
index e9efed40cf3d9553d636ea339f15acf7d3d9fefe..60e392f7f2dcdc91c5390be2386a604a741af355 100644 (file)
@@ -905,6 +905,13 @@ int io_sendzc_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
        if (zc->flags & ~(IORING_RECVSEND_POLL_FIRST |
                          IORING_RECVSEND_FIXED_BUF))
                return -EINVAL;
+       notif = zc->notif = io_alloc_notif(ctx);
+       if (!notif)
+               return -ENOMEM;
+       notif->cqe.user_data = req->cqe.user_data;
+       notif->cqe.res = 0;
+       notif->cqe.flags = IORING_CQE_F_NOTIF;
+       req->flags |= REQ_F_NEED_CLEANUP;
        if (zc->flags & IORING_RECVSEND_FIXED_BUF) {
                unsigned idx = READ_ONCE(sqe->buf_index);
 
@@ -912,15 +919,8 @@ int io_sendzc_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
                        return -EFAULT;
                idx = array_index_nospec(idx, ctx->nr_user_bufs);
                req->imu = READ_ONCE(ctx->user_bufs[idx]);
-               io_req_set_rsrc_node(req, ctx, 0);
+               io_req_set_rsrc_node(notif, ctx, 0);
        }
-       notif = zc->notif = io_alloc_notif(ctx);
-       if (!notif)
-               return -ENOMEM;
-       notif->cqe.user_data = req->cqe.user_data;
-       notif->cqe.res = 0;
-       notif->cqe.flags = IORING_CQE_F_NOTIF;
-       req->flags |= REQ_F_NEED_CLEANUP;
 
        zc->buf = u64_to_user_ptr(READ_ONCE(sqe->addr));
        zc->len = READ_ONCE(sqe->len);
index c61494e0a6022e955ca90f50229a1ca8e3f06a67..c4dddd0fd70949c300e519c54c0f6f7d8f13c246 100644 (file)
@@ -471,7 +471,7 @@ const struct io_op_def io_op_defs[] = {
                .prep_async             = io_uring_cmd_prep_async,
        },
        [IORING_OP_SEND_ZC] = {
-               .name                   = "SENDZC_NOTIF",
+               .name                   = "SEND_ZC",
                .needs_file             = 1,
                .unbound_nonreg_file    = 1,
                .pollout                = 1,
index 1e18a44adcf5b08c41f9e5adba50f1d3058e9601..76ebcfebc9a6e32f93b78f42fab0da9ae38c9893 100644 (file)
@@ -206,7 +206,7 @@ static bool __io_complete_rw_common(struct io_kiocb *req, long res)
        return false;
 }
 
-static inline unsigned io_fixup_rw_res(struct io_kiocb *req, unsigned res)
+static inline int io_fixup_rw_res(struct io_kiocb *req, long res)
 {
        struct io_async_rw *io = req->async_data;
 
index 8a9e92068b1509b9502cae5289ab9dd8bdeaaa17..2b6bd511c6ed1cdff351f63a6f657e912ffe2ac1 100644 (file)
@@ -2047,11 +2047,8 @@ static __latent_entropy struct task_struct *copy_process(
        /*
         * If the new process will be in a different time namespace
         * do not allow it to share VM or a thread group with the forking task.
-        *
-        * On vfork, the child process enters the target time namespace only
-        * after exec.
         */
-       if ((clone_flags & (CLONE_VM | CLONE_VFORK)) == CLONE_VM) {
+       if (clone_flags & (CLONE_THREAD | CLONE_VM)) {
                if (nsp->time_ns != nsp->time_ns_for_children)
                        return ERR_PTR(-EINVAL);
        }
index b4cbb406bc2840af0029107e3bbbff030081937f..eec72ca962e249c94266192b77a3c1f92ec8e889 100644 (file)
@@ -179,8 +179,7 @@ int copy_namespaces(unsigned long flags, struct task_struct *tsk)
        if (IS_ERR(new_ns))
                return  PTR_ERR(new_ns);
 
-       if ((flags & CLONE_VM) == 0)
-               timens_on_fork(new_ns, tsk);
+       timens_on_fork(new_ns, tsk);
 
        tsk->nsproxy = new_ns;
        return 0;
index 07b948288f84d2bff32289d662846f941cde0761..ccc02573588f843f2da0d5c8ec128c2ad2bcbd88 100644 (file)
@@ -475,6 +475,7 @@ void slab_kmem_cache_release(struct kmem_cache *s)
 void kmem_cache_destroy(struct kmem_cache *s)
 {
        int refcnt;
+       bool rcu_set;
 
        if (unlikely(!s) || !kasan_check_byte(s))
                return;
@@ -482,6 +483,8 @@ void kmem_cache_destroy(struct kmem_cache *s)
        cpus_read_lock();
        mutex_lock(&slab_mutex);
 
+       rcu_set = s->flags & SLAB_TYPESAFE_BY_RCU;
+
        refcnt = --s->refcount;
        if (refcnt)
                goto out_unlock;
@@ -492,7 +495,7 @@ void kmem_cache_destroy(struct kmem_cache *s)
 out_unlock:
        mutex_unlock(&slab_mutex);
        cpus_read_unlock();
-       if (!refcnt && !(s->flags & SLAB_TYPESAFE_BY_RCU))
+       if (!refcnt && !rcu_set)
                kmem_cache_release(s);
 }
 EXPORT_SYMBOL(kmem_cache_destroy);
index 862dbd9af4f521fe820a9b5bdb69e7a726ba3d5d..4b98dff9be8e33baee842db0fa398964add5a2dd 100644 (file)
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -310,6 +310,11 @@ static inline void stat(const struct kmem_cache *s, enum stat_item si)
  */
 static nodemask_t slab_nodes;
 
+/*
+ * Workqueue used for flush_cpu_slab().
+ */
+static struct workqueue_struct *flushwq;
+
 /********************************************************************
  *                     Core slab cache functions
  *******************************************************************/
@@ -2730,7 +2735,7 @@ static void flush_all_cpus_locked(struct kmem_cache *s)
                INIT_WORK(&sfw->work, flush_cpu_slab);
                sfw->skip = false;
                sfw->s = s;
-               schedule_work_on(cpu, &sfw->work);
+               queue_work_on(cpu, flushwq, &sfw->work);
        }
 
        for_each_online_cpu(cpu) {
@@ -4858,6 +4863,8 @@ void __init kmem_cache_init(void)
 
 void __init kmem_cache_init_late(void)
 {
+       flushwq = alloc_workqueue("slub_flushwq", WQ_MEM_RECLAIM, 0);
+       WARN_ON(!flushwq);
 }
 
 struct kmem_cache *
@@ -4926,6 +4933,8 @@ void *__kmalloc_track_caller(size_t size, gfp_t gfpflags, unsigned long caller)
        /* Honor the call site pointer we received. */
        trace_kmalloc(caller, ret, s, size, s->size, gfpflags);
 
+       ret = kasan_kmalloc(s, ret, size, gfpflags);
+
        return ret;
 }
 EXPORT_SYMBOL(__kmalloc_track_caller);
@@ -4957,6 +4966,8 @@ void *__kmalloc_node_track_caller(size_t size, gfp_t gfpflags,
        /* Honor the call site pointer we received. */
        trace_kmalloc_node(caller, ret, s, size, s->size, gfpflags, node);
 
+       ret = kasan_kmalloc(s, ret, size, gfpflags);
+
        return ret;
 }
 EXPORT_SYMBOL(__kmalloc_node_track_caller);
@@ -5890,7 +5901,8 @@ static char *create_unique_id(struct kmem_cache *s)
        char *name = kmalloc(ID_STR_LENGTH, GFP_KERNEL);
        char *p = name;
 
-       BUG_ON(!name);
+       if (!name)
+               return ERR_PTR(-ENOMEM);
 
        *p++ = ':';
        /*
@@ -5948,6 +5960,8 @@ static int sysfs_slab_add(struct kmem_cache *s)
                 * for the symlinks.
                 */
                name = create_unique_id(s);
+               if (IS_ERR(name))
+                       return PTR_ERR(name);
        }
 
        s->kobj.kset = kset;
index b8f8da7ee3dea4ba09f958e476c6b6f77b05e23a..41c1ad33d009fc7de81cd9f330cbc7d6c7f7f05a 100644 (file)
@@ -10,6 +10,7 @@
 #include <linux/atomic.h>
 #include <linux/byteorder/generic.h>
 #include <linux/container_of.h>
+#include <linux/errno.h>
 #include <linux/gfp.h>
 #include <linux/if.h>
 #include <linux/if_arp.h>
@@ -700,6 +701,9 @@ int batadv_hardif_enable_interface(struct batadv_hard_iface *hard_iface,
        int max_header_len = batadv_max_header_len();
        int ret;
 
+       if (hard_iface->net_dev->mtu < ETH_MIN_MTU + max_header_len)
+               return -EINVAL;
+
        if (hard_iface->if_status != BATADV_IF_NOT_IN_USE)
                goto out;
 
index 9a0ae59cdc500b5e0d5883b1cfd085399350e61d..4f385d52a1c4961c024e41ade13ee75a1a015513 100644 (file)
@@ -1040,8 +1040,10 @@ static int do_replace_finish(struct net *net, struct ebt_replace *repl,
                goto free_iterate;
        }
 
-       if (repl->valid_hooks != t->valid_hooks)
+       if (repl->valid_hooks != t->valid_hooks) {
+               ret = -EINVAL;
                goto free_unlock;
+       }
 
        if (repl->num_counters && repl->num_counters != t->private->nentries) {
                ret = -EINVAL;
index fe9be3c56ef71431599cfd4e22d1d85c55a3949b..385f04a6be2f7a9ef1258619c06c5fdf37b093c5 100644 (file)
@@ -52,6 +52,7 @@ int __get_compat_msghdr(struct msghdr *kmsg,
                kmsg->msg_namelen = sizeof(struct sockaddr_storage);
 
        kmsg->msg_control_is_user = true;
+       kmsg->msg_get_inq = 0;
        kmsg->msg_control_user = compat_ptr(msg->msg_control);
        kmsg->msg_controllen = msg->msg_controllen;
 
index 764c4cb3fe8f41d3ff9c4f9a981563d7296b2c72..5dc3860e9fc7e8d77573e8f29dc52db175f929f8 100644 (file)
@@ -1611,9 +1611,8 @@ static inline void __flow_hash_consistentify(struct flow_keys *keys)
 
        switch (keys->control.addr_type) {
        case FLOW_DISSECTOR_KEY_IPV4_ADDRS:
-               addr_diff = (__force u32)keys->addrs.v4addrs.dst -
-                           (__force u32)keys->addrs.v4addrs.src;
-               if (addr_diff < 0)
+               if ((__force u32)keys->addrs.v4addrs.dst <
+                   (__force u32)keys->addrs.v4addrs.src)
                        swap(keys->addrs.v4addrs.src, keys->addrs.v4addrs.dst);
 
                if ((__force u16)keys->ports.dst <
index 718fb77bb372c67f3514205d649f287bdbc4a609..7889e1ef7fad6daba421eb23919a4c6602e86b4a 100644 (file)
@@ -200,8 +200,9 @@ static int raw_bind(struct sock *sk, struct sockaddr *_uaddr, int len)
        int err = 0;
        struct net_device *dev = NULL;
 
-       if (len < sizeof(*uaddr))
-               return -EINVAL;
+       err = ieee802154_sockaddr_check_size(uaddr, len);
+       if (err < 0)
+               return err;
 
        uaddr = (struct sockaddr_ieee802154 *)_uaddr;
        if (uaddr->family != AF_IEEE802154)
@@ -493,7 +494,8 @@ static int dgram_bind(struct sock *sk, struct sockaddr *uaddr, int len)
 
        ro->bound = 0;
 
-       if (len < sizeof(*addr))
+       err = ieee802154_sockaddr_check_size(addr, len);
+       if (err < 0)
                goto out;
 
        if (addr->family != AF_IEEE802154)
@@ -564,8 +566,9 @@ static int dgram_connect(struct sock *sk, struct sockaddr *uaddr,
        struct dgram_sock *ro = dgram_sk(sk);
        int err = 0;
 
-       if (len < sizeof(*addr))
-               return -EINVAL;
+       err = ieee802154_sockaddr_check_size(addr, len);
+       if (err < 0)
+               return err;
 
        if (addr->family != AF_IEEE802154)
                return -EINVAL;
@@ -604,6 +607,7 @@ static int dgram_sendmsg(struct sock *sk, struct msghdr *msg, size_t size)
        struct ieee802154_mac_cb *cb;
        struct dgram_sock *ro = dgram_sk(sk);
        struct ieee802154_addr dst_addr;
+       DECLARE_SOCKADDR(struct sockaddr_ieee802154*, daddr, msg->msg_name);
        int hlen, tlen;
        int err;
 
@@ -612,10 +616,20 @@ static int dgram_sendmsg(struct sock *sk, struct msghdr *msg, size_t size)
                return -EOPNOTSUPP;
        }
 
-       if (!ro->connected && !msg->msg_name)
-               return -EDESTADDRREQ;
-       else if (ro->connected && msg->msg_name)
-               return -EISCONN;
+       if (msg->msg_name) {
+               if (ro->connected)
+                       return -EISCONN;
+               if (msg->msg_namelen < IEEE802154_MIN_NAMELEN)
+                       return -EINVAL;
+               err = ieee802154_sockaddr_check_size(daddr, msg->msg_namelen);
+               if (err < 0)
+                       return err;
+               ieee802154_addr_from_sa(&dst_addr, &daddr->addr);
+       } else {
+               if (!ro->connected)
+                       return -EDESTADDRREQ;
+               dst_addr = ro->dst_addr;
+       }
 
        if (!ro->bound)
                dev = dev_getfirstbyhwtype(sock_net(sk), ARPHRD_IEEE802154);
@@ -651,16 +665,6 @@ static int dgram_sendmsg(struct sock *sk, struct msghdr *msg, size_t size)
        cb = mac_cb_init(skb);
        cb->type = IEEE802154_FC_TYPE_DATA;
        cb->ackreq = ro->want_ack;
-
-       if (msg->msg_name) {
-               DECLARE_SOCKADDR(struct sockaddr_ieee802154*,
-                                daddr, msg->msg_name);
-
-               ieee802154_addr_from_sa(&dst_addr, &daddr->addr);
-       } else {
-               dst_addr = ro->dst_addr;
-       }
-
        cb->secen = ro->secen;
        cb->secen_override = ro->secen_override;
        cb->seclevel = ro->seclevel;
index 73651d17e51f31c8755da6ac3c1c2763a99b1117..e11d6b0b62b76ebb2e7e8e6325a5a7066f299b91 100644 (file)
@@ -1004,7 +1004,9 @@ static void ipmr_cache_resolve(struct net *net, struct mr_table *mrt,
 
                        rtnl_unicast(skb, net, NETLINK_CB(skb).portid);
                } else {
+                       rcu_read_lock();
                        ip_mr_forward(net, mrt, skb->dev, skb, c, 0);
+                       rcu_read_unlock();
                }
        }
 }
index 6cdfce6f28672d42ce813ba2a9dc4d18b4939e42..e373dde1f46f7b286c01aef022117cb10ba64e45 100644 (file)
@@ -1761,19 +1761,28 @@ int tcp_read_skb(struct sock *sk, skb_read_actor_t recv_actor)
        if (sk->sk_state == TCP_LISTEN)
                return -ENOTCONN;
 
-       skb = tcp_recv_skb(sk, seq, &offset);
-       if (!skb)
-               return 0;
+       while ((skb = tcp_recv_skb(sk, seq, &offset)) != NULL) {
+               u8 tcp_flags;
+               int used;
 
-       __skb_unlink(skb, &sk->sk_receive_queue);
-       WARN_ON(!skb_set_owner_sk_safe(skb, sk));
-       copied = recv_actor(sk, skb);
-       if (copied >= 0) {
-               seq += copied;
-               if (TCP_SKB_CB(skb)->tcp_flags & TCPHDR_FIN)
+               __skb_unlink(skb, &sk->sk_receive_queue);
+               WARN_ON_ONCE(!skb_set_owner_sk_safe(skb, sk));
+               tcp_flags = TCP_SKB_CB(skb)->tcp_flags;
+               used = recv_actor(sk, skb);
+               consume_skb(skb);
+               if (used < 0) {
+                       if (!copied)
+                               copied = used;
+                       break;
+               }
+               seq += used;
+               copied += used;
+
+               if (tcp_flags & TCPHDR_FIN) {
                        ++seq;
+                       break;
+               }
        }
-       consume_skb(skb);
        WRITE_ONCE(tp->copied_seq, seq);
 
        tcp_rcv_space_adjust(sk);
index cd72158e953a5989987c2122f12ed02f15fa7c1b..560d9eadeaa5805e4eeb416ff3b07a36bd746223 100644 (file)
@@ -1821,7 +1821,7 @@ int udp_read_skb(struct sock *sk, skb_read_actor_t recv_actor)
                        continue;
                }
 
-               WARN_ON(!skb_set_owner_sk_safe(skb, sk));
+               WARN_ON_ONCE(!skb_set_owner_sk_safe(skb, sk));
                used = recv_actor(sk, skb);
                if (used <= 0) {
                        if (!copied)
index 2ce0c44d0081440aaf0d7a0d4de2b14775f72917..dbb1430d6cc2e7fa2f11aa719312fd50e88fa37d 100644 (file)
@@ -1070,13 +1070,13 @@ static int __init inet6_init(void)
        for (r = &inetsw6[0]; r < &inetsw6[SOCK_MAX]; ++r)
                INIT_LIST_HEAD(r);
 
+       raw_hashinfo_init(&raw_v6_hashinfo);
+
        if (disable_ipv6_mod) {
                pr_info("Loaded, but administratively disabled, reboot required to enable\n");
                goto out;
        }
 
-       raw_hashinfo_init(&raw_v6_hashinfo);
-
        err = proto_register(&tcpv6_prot, 1);
        if (err)
                goto out;
index a9ba41648e36854fe1702a3397a36a366be4c682..858fd8a28b5b2c698d949677c68cec54a0219868 100644 (file)
@@ -1028,8 +1028,11 @@ static void ip6mr_cache_resolve(struct net *net, struct mr_table *mrt,
                                ((struct nlmsgerr *)nlmsg_data(nlh))->error = -EMSGSIZE;
                        }
                        rtnl_unicast(skb, net, NETLINK_CB(skb).portid);
-               } else
+               } else {
+                       rcu_read_lock();
                        ip6_mr_forward(net, mrt, skb->dev, skb, c);
+                       rcu_read_unlock();
+               }
        }
 }
 
index d398f3810662ba3bb05b3450237772763204def5..969b33a9dd64739948d740cc98969a8416f245ff 100644 (file)
@@ -150,9 +150,15 @@ static bool mptcp_try_coalesce(struct sock *sk, struct sk_buff *to,
                 MPTCP_SKB_CB(from)->map_seq, MPTCP_SKB_CB(to)->map_seq,
                 to->len, MPTCP_SKB_CB(from)->end_seq);
        MPTCP_SKB_CB(to)->end_seq = MPTCP_SKB_CB(from)->end_seq;
-       kfree_skb_partial(from, fragstolen);
+
+       /* note the fwd memory can reach a negative value after accounting
+        * for the delta, but the later skb free will restore a non
+        * negative one
+        */
        atomic_add(delta, &sk->sk_rmem_alloc);
        mptcp_rmem_charge(sk, delta);
+       kfree_skb_partial(from, fragstolen);
+
        return true;
 }
 
index 0d9332e9cf71a8fae7a5e7b5a0bc904863c50072..617f744a2e3a33c223ed2205559df941cbb55174 100644 (file)
@@ -33,6 +33,7 @@ MODULE_AUTHOR("Rusty Russell <rusty@rustcorp.com.au>");
 MODULE_DESCRIPTION("ftp connection tracking helper");
 MODULE_ALIAS("ip_conntrack_ftp");
 MODULE_ALIAS_NFCT_HELPER(HELPER_NAME);
+static DEFINE_SPINLOCK(nf_ftp_lock);
 
 #define MAX_PORTS 8
 static u_int16_t ports[MAX_PORTS];
@@ -409,7 +410,8 @@ static int help(struct sk_buff *skb,
        }
        datalen = skb->len - dataoff;
 
-       spin_lock_bh(&ct->lock);
+       /* seqadj (nat) uses ct->lock internally, nf_nat_ftp would cause deadlock */
+       spin_lock_bh(&nf_ftp_lock);
        fb_ptr = skb->data + dataoff;
 
        ends_in_nl = (fb_ptr[datalen - 1] == '\n');
@@ -538,7 +540,7 @@ out_update_nl:
        if (ends_in_nl)
                update_nl_seq(ct, seq, ct_ftp_info, dir, skb);
  out:
-       spin_unlock_bh(&ct->lock);
+       spin_unlock_bh(&nf_ftp_lock);
        return ret;
 }
 
index 992decbcaa5c1edbb72a9e9703df745895c544ca..5703846bea3b699a8e31ed9ced9c7542362e528b 100644 (file)
@@ -157,15 +157,37 @@ static int help(struct sk_buff *skb, unsigned int protoff,
        data = ib_ptr;
        data_limit = ib_ptr + datalen;
 
-       /* strlen("\1DCC SENT t AAAAAAAA P\1\n")=24
-        * 5+MINMATCHLEN+strlen("t AAAAAAAA P\1\n")=14 */
-       while (data < data_limit - (19 + MINMATCHLEN)) {
-               if (memcmp(data, "\1DCC ", 5)) {
+       /* Skip any whitespace */
+       while (data < data_limit - 10) {
+               if (*data == ' ' || *data == '\r' || *data == '\n')
+                       data++;
+               else
+                       break;
+       }
+
+       /* strlen("PRIVMSG x ")=10 */
+       if (data < data_limit - 10) {
+               if (strncasecmp("PRIVMSG ", data, 8))
+                       goto out;
+               data += 8;
+       }
+
+       /* strlen(" :\1DCC SENT t AAAAAAAA P\1\n")=26
+        * 7+MINMATCHLEN+strlen("t AAAAAAAA P\1\n")=26
+        */
+       while (data < data_limit - (21 + MINMATCHLEN)) {
+               /* Find first " :", the start of message */
+               if (memcmp(data, " :", 2)) {
                        data++;
                        continue;
                }
+               data += 2;
+
+               /* then check that place only for the DCC command */
+               if (memcmp(data, "\1DCC ", 5))
+                       goto out;
                data += 5;
-               /* we have at least (19+MINMATCHLEN)-5 bytes valid data left */
+               /* we have at least (21+MINMATCHLEN)-(2+5) bytes valid data left */
 
                iph = ip_hdr(skb);
                pr_debug("DCC found in master %pI4:%u %pI4:%u\n",
@@ -181,7 +203,7 @@ static int help(struct sk_buff *skb, unsigned int protoff,
                        pr_debug("DCC %s detected\n", dccprotos[i]);
 
                        /* we have at least
-                        * (19+MINMATCHLEN)-5-dccprotos[i].matchlen bytes valid
+                        * (21+MINMATCHLEN)-7-dccprotos[i].matchlen bytes valid
                         * data left (== 14/13 bytes) */
                        if (parse_dcc(data, data_limit, &dcc_ip,
                                       &dcc_port, &addr_beg_p, &addr_end_p)) {
index daf06f71d31cad67e020847dc745e9aa5a422c70..77f5e82d8e3fe3d678cbfaa384d71eb588df14ba 100644 (file)
@@ -477,7 +477,7 @@ static int ct_sip_walk_headers(const struct nf_conn *ct, const char *dptr,
                                return ret;
                        if (ret == 0)
                                break;
-                       dataoff += *matchoff;
+                       dataoff = *matchoff;
                }
                *in_header = 0;
        }
@@ -489,7 +489,7 @@ static int ct_sip_walk_headers(const struct nf_conn *ct, const char *dptr,
                        break;
                if (ret == 0)
                        return ret;
-               dataoff += *matchoff;
+               dataoff = *matchoff;
        }
 
        if (in_header)
index 816052089b336edabca19e38504ae4204d20f4aa..63c70141b3e5d81363dabc5598cae563aac05474 100644 (file)
@@ -2197,7 +2197,6 @@ static int nf_tables_addchain(struct nft_ctx *ctx, u8 family, u8 genmask,
                              struct netlink_ext_ack *extack)
 {
        const struct nlattr * const *nla = ctx->nla;
-       struct nft_stats __percpu *stats = NULL;
        struct nft_table *table = ctx->table;
        struct nft_base_chain *basechain;
        struct net *net = ctx->net;
@@ -2212,6 +2211,7 @@ static int nf_tables_addchain(struct nft_ctx *ctx, u8 family, u8 genmask,
                return -EOVERFLOW;
 
        if (nla[NFTA_CHAIN_HOOK]) {
+               struct nft_stats __percpu *stats = NULL;
                struct nft_chain_hook hook;
 
                if (flags & NFT_CHAIN_BINDING)
@@ -2243,8 +2243,11 @@ static int nf_tables_addchain(struct nft_ctx *ctx, u8 family, u8 genmask,
                if (err < 0) {
                        nft_chain_release_hook(&hook);
                        kfree(basechain);
+                       free_percpu(stats);
                        return err;
                }
+               if (stats)
+                       static_branch_inc(&nft_counters_enabled);
        } else {
                if (flags & NFT_CHAIN_BASE)
                        return -EINVAL;
@@ -2319,9 +2322,6 @@ static int nf_tables_addchain(struct nft_ctx *ctx, u8 family, u8 genmask,
                goto err_unregister_hook;
        }
 
-       if (stats)
-               static_branch_inc(&nft_counters_enabled);
-
        table->use++;
 
        return 0;
index 0fa2e203042728582b9860a6bdd1f798210637af..ee6840bd593378ed23d57fd501f4df3184dc2592 100644 (file)
@@ -269,6 +269,7 @@ bool nf_osf_find(const struct sk_buff *skb,
        struct nf_osf_hdr_ctx ctx;
        const struct tcphdr *tcp;
        struct tcphdr _tcph;
+       bool found = false;
 
        memset(&ctx, 0, sizeof(ctx));
 
@@ -283,10 +284,11 @@ bool nf_osf_find(const struct sk_buff *skb,
 
                data->genre = f->genre;
                data->version = f->version;
+               found = true;
                break;
        }
 
-       return true;
+       return found;
 }
 EXPORT_SYMBOL_GPL(nf_osf_find);
 
index 790d6809be813e82e2e612fb2ed444f27e6b3313..51d175f3fbcb58896455e1f3baebbe94b02509fe 100644 (file)
@@ -2137,6 +2137,7 @@ replay:
        }
 
        if (chain->tmplt_ops && chain->tmplt_ops != tp->ops) {
+               tfilter_put(tp, fh);
                NL_SET_ERR_MSG(extack, "Chain template is set to a different filter kind");
                err = -EINVAL;
                goto errout;
index 0b941dd63d2680d72c598369818410a91b0c576e..86675a79da1e4ac1ede8934c93e2021639018e52 100644 (file)
@@ -67,6 +67,7 @@ struct taprio_sched {
        u32 flags;
        enum tk_offsets tk_offset;
        int clockid;
+       bool offloaded;
        atomic64_t picos_per_byte; /* Using picoseconds because for 10Gbps+
                                    * speeds it's sub-nanoseconds per byte
                                    */
@@ -1279,6 +1280,8 @@ static int taprio_enable_offload(struct net_device *dev,
                goto done;
        }
 
+       q->offloaded = true;
+
 done:
        taprio_offload_free(offload);
 
@@ -1293,12 +1296,9 @@ static int taprio_disable_offload(struct net_device *dev,
        struct tc_taprio_qopt_offload *offload;
        int err;
 
-       if (!FULL_OFFLOAD_IS_ENABLED(q->flags))
+       if (!q->offloaded)
                return 0;
 
-       if (!ops->ndo_setup_tc)
-               return -EOPNOTSUPP;
-
        offload = taprio_offload_alloc(0);
        if (!offload) {
                NL_SET_ERR_MSG(extack,
@@ -1314,6 +1314,8 @@ static int taprio_disable_offload(struct net_device *dev,
                goto out;
        }
 
+       q->offloaded = false;
+
 out:
        taprio_offload_free(offload);
 
@@ -1949,12 +1951,14 @@ start_error:
 
 static struct Qdisc *taprio_leaf(struct Qdisc *sch, unsigned long cl)
 {
-       struct netdev_queue *dev_queue = taprio_queue_get(sch, cl);
+       struct taprio_sched *q = qdisc_priv(sch);
+       struct net_device *dev = qdisc_dev(sch);
+       unsigned int ntx = cl - 1;
 
-       if (!dev_queue)
+       if (ntx >= dev->num_tx_queues)
                return NULL;
 
-       return dev_queue->qdisc_sleeping;
+       return q->qdiscs[ntx];
 }
 
 static unsigned long taprio_find(struct Qdisc *sch, u32 classid)
index ebf56cdf17dbbb5d0e0df48f96757e42e269cf74..df89c2e08cbf455de32166df8d9854a94ae5f64f 100644 (file)
@@ -2239,7 +2239,7 @@ out:
 static int smcr_buf_map_usable_links(struct smc_link_group *lgr,
                                     struct smc_buf_desc *buf_desc, bool is_rmb)
 {
-       int i, rc = 0;
+       int i, rc = 0, cnt = 0;
 
        /* protect against parallel link reconfiguration */
        mutex_lock(&lgr->llc_conf_mutex);
@@ -2252,9 +2252,12 @@ static int smcr_buf_map_usable_links(struct smc_link_group *lgr,
                        rc = -ENOMEM;
                        goto out;
                }
+               cnt++;
        }
 out:
        mutex_unlock(&lgr->llc_conf_mutex);
+       if (!rc && !cnt)
+               rc = -EINVAL;
        return rc;
 }
 
index 7d268a291486ba54f692cbc8dfd1a8dd79529530..c284efa3d1efc2ef4ccab136911365ead224f22d 100644 (file)
@@ -2873,6 +2873,9 @@ int rpc_clnt_test_and_add_xprt(struct rpc_clnt *clnt,
 
        task = rpc_call_null_helper(clnt, xprt, NULL, RPC_TASK_ASYNC,
                        &rpc_cb_add_xprt_call_ops, data);
+       if (IS_ERR(task))
+               return PTR_ERR(task);
+
        data->xps->xps_nunique_destaddr_xprts++;
        rpc_put_task(task);
 success:
index d71eec494826b269a76c887cfa82972fd805e59b..f8fae78156494c19e0aae8270d187155d696608c 100644 (file)
@@ -1179,11 +1179,8 @@ xprt_request_dequeue_receive_locked(struct rpc_task *task)
 {
        struct rpc_rqst *req = task->tk_rqstp;
 
-       if (test_and_clear_bit(RPC_TASK_NEED_RECV, &task->tk_runstate)) {
+       if (test_and_clear_bit(RPC_TASK_NEED_RECV, &task->tk_runstate))
                xprt_request_rb_remove(req->rq_xprt, req);
-               xdr_free_bvec(&req->rq_rcv_buf);
-               req->rq_private_buf.bvec = NULL;
-       }
 }
 
 /**
@@ -1221,6 +1218,8 @@ void xprt_complete_rqst(struct rpc_task *task, int copied)
 
        xprt->stat.recvs++;
 
+       xdr_free_bvec(&req->rq_rcv_buf);
+       req->rq_private_buf.bvec = NULL;
        req->rq_private_buf.len = copied;
        /* Ensure all writes are done before we update */
        /* req->rq_reply_bytes_recvd */
@@ -1453,6 +1452,7 @@ xprt_request_dequeue_xprt(struct rpc_task *task)
                xprt_request_dequeue_transmit_locked(task);
                xprt_request_dequeue_receive_locked(task);
                spin_unlock(&xprt->queue_lock);
+               xdr_free_bvec(&req->rq_rcv_buf);
        }
 }
 
index 193dae361fac39d7d9f3a6a1cd413944eb0e6a2a..5377f94eb2111f844e1c439926f1a27bfb728fd4 100644 (file)
@@ -178,10 +178,8 @@ int snd_card_new(struct device *parent, int idx, const char *xid,
                return -ENOMEM;
 
        err = snd_card_init(card, parent, idx, xid, module, extra_size);
-       if (err < 0) {
-               kfree(card);
-               return err;
-       }
+       if (err < 0)
+               return err; /* card is freed by error handler */
 
        *card_ret = card;
        return 0;
@@ -233,7 +231,7 @@ int snd_devm_card_new(struct device *parent, int idx, const char *xid,
        card->managed = true;
        err = snd_card_init(card, parent, idx, xid, module, extra_size);
        if (err < 0) {
-               devres_free(card);
+               devres_free(card); /* in managed mode, we need to free manually */
                return err;
        }
 
@@ -297,6 +295,8 @@ static int snd_card_init(struct snd_card *card, struct device *parent,
                mutex_unlock(&snd_card_mutex);
                dev_err(parent, "cannot find the slot for index %d (range 0-%i), error: %d\n",
                         idx, snd_ecards_limit - 1, err);
+               if (!card->managed)
+                       kfree(card); /* manually free here, as no destructor called */
                return err;
        }
        set_bit(idx, snd_cards_lock);           /* lock it */
index cae9a975cbcca809bdd59993e1343eebd4c6ad76..1a868dd9dc4b6886a8dda83514052910e52014cc 100644 (file)
@@ -157,10 +157,10 @@ static int hda_codec_driver_remove(struct device *dev)
                return codec->bus->core.ext_ops->hdev_detach(&codec->core);
        }
 
-       refcount_dec(&codec->pcm_ref);
        snd_hda_codec_disconnect_pcms(codec);
        snd_hda_jack_tbl_disconnect(codec);
-       wait_event(codec->remove_sleep, !refcount_read(&codec->pcm_ref));
+       if (!refcount_dec_and_test(&codec->pcm_ref))
+               wait_event(codec->remove_sleep, !refcount_read(&codec->pcm_ref));
        snd_power_sync_ref(codec->bus->card);
 
        if (codec->patch_ops.free)
index b20694fd69dea7d0d72122f9466df7c30beb3691..6f30c374f896ea72411a926a6e51b747dcede921 100644 (file)
@@ -2550,6 +2550,8 @@ static const struct pci_device_id azx_ids[] = {
        /* 5 Series/3400 */
        { PCI_DEVICE(0x8086, 0x3b56),
          .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_INTEL_PCH_NOPM },
+       { PCI_DEVICE(0x8086, 0x3b57),
+         .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_INTEL_PCH_NOPM },
        /* Poulsbo */
        { PCI_DEVICE(0x8086, 0x811b),
          .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_INTEL_PCH_BASE },
index 6c209cd26c0cab1ed9e835e118e6bcfaf37a7f05..c239d9dbbaefe518e83a1a9a1ea16343ce12c409 100644 (file)
@@ -170,6 +170,8 @@ struct hdmi_spec {
        bool dyn_pcm_no_legacy;
        /* hdmi interrupt trigger control flag for Nvidia codec */
        bool hdmi_intr_trig_ctrl;
+       bool nv_dp_workaround; /* workaround DP audio infoframe for Nvidia */
+
        bool intel_hsw_fixup;   /* apply Intel platform-specific fixups */
        /*
         * Non-generic VIA/NVIDIA specific
@@ -679,15 +681,24 @@ static void hdmi_pin_setup_infoframe(struct hda_codec *codec,
                                     int ca, int active_channels,
                                     int conn_type)
 {
+       struct hdmi_spec *spec = codec->spec;
        union audio_infoframe ai;
 
        memset(&ai, 0, sizeof(ai));
-       if (conn_type == 0) { /* HDMI */
+       if ((conn_type == 0) || /* HDMI */
+               /* Nvidia DisplayPort: Nvidia HW expects same layout as HDMI */
+               (conn_type == 1 && spec->nv_dp_workaround)) {
                struct hdmi_audio_infoframe *hdmi_ai = &ai.hdmi;
 
-               hdmi_ai->type           = 0x84;
-               hdmi_ai->ver            = 0x01;
-               hdmi_ai->len            = 0x0a;
+               if (conn_type == 0) { /* HDMI */
+                       hdmi_ai->type           = 0x84;
+                       hdmi_ai->ver            = 0x01;
+                       hdmi_ai->len            = 0x0a;
+               } else {/* Nvidia DP */
+                       hdmi_ai->type           = 0x84;
+                       hdmi_ai->ver            = 0x1b;
+                       hdmi_ai->len            = 0x11 << 2;
+               }
                hdmi_ai->CC02_CT47      = active_channels - 1;
                hdmi_ai->CA             = ca;
                hdmi_checksum_audio_infoframe(hdmi_ai);
@@ -1267,6 +1278,7 @@ static int hdmi_pcm_open(struct hda_pcm_stream *hinfo,
        set_bit(pcm_idx, &spec->pcm_in_use);
        per_pin = get_pin(spec, pin_idx);
        per_pin->cvt_nid = per_cvt->cvt_nid;
+       per_pin->silent_stream = false;
        hinfo->nid = per_cvt->cvt_nid;
 
        /* flip stripe flag for the assigned stream if supported */
@@ -3617,6 +3629,7 @@ static int patch_nvhdmi_2ch(struct hda_codec *codec)
        spec->pcm_playback.rates = SUPPORTED_RATES;
        spec->pcm_playback.maxbps = SUPPORTED_MAXBPS;
        spec->pcm_playback.formats = SUPPORTED_FORMATS;
+       spec->nv_dp_workaround = true;
        return 0;
 }
 
@@ -3756,6 +3769,7 @@ static int patch_nvhdmi(struct hda_codec *codec)
        spec->chmap.ops.chmap_cea_alloc_validate_get_type =
                nvhdmi_chmap_cea_alloc_validate_get_type;
        spec->chmap.ops.chmap_validate = nvhdmi_chmap_validate;
+       spec->nv_dp_workaround = true;
 
        codec->link_down_at_suspend = 1;
 
@@ -3779,6 +3793,7 @@ static int patch_nvhdmi_legacy(struct hda_codec *codec)
        spec->chmap.ops.chmap_cea_alloc_validate_get_type =
                nvhdmi_chmap_cea_alloc_validate_get_type;
        spec->chmap.ops.chmap_validate = nvhdmi_chmap_validate;
+       spec->nv_dp_workaround = true;
 
        codec->link_down_at_suspend = 1;
 
@@ -3984,6 +3999,7 @@ static int tegra_hdmi_init(struct hda_codec *codec)
 
        generic_hdmi_init_per_pins(codec);
 
+       codec->depop_delay = 10;
        codec->patch_ops.build_pcms = tegra_hdmi_build_pcms;
        spec->chmap.ops.chmap_cea_alloc_validate_get_type =
                nvhdmi_chmap_cea_alloc_validate_get_type;
@@ -3992,6 +4008,7 @@ static int tegra_hdmi_init(struct hda_codec *codec)
        spec->chmap.ops.chmap_cea_alloc_validate_get_type =
                nvhdmi_chmap_cea_alloc_validate_get_type;
        spec->chmap.ops.chmap_validate = nvhdmi_chmap_validate;
+       spec->nv_dp_workaround = true;
 
        return 0;
 }
index 38930cf5aace021ff46ae1120318c4e22dd26aca..f9d46ae4c7b71308d70b6da4f73d98070dc2ae83 100644 (file)
@@ -7067,6 +7067,8 @@ enum {
        ALC294_FIXUP_ASUS_GU502_HP,
        ALC294_FIXUP_ASUS_GU502_PINS,
        ALC294_FIXUP_ASUS_GU502_VERBS,
+       ALC294_FIXUP_ASUS_G513_PINS,
+       ALC285_FIXUP_ASUS_G533Z_PINS,
        ALC285_FIXUP_HP_GPIO_LED,
        ALC285_FIXUP_HP_MUTE_LED,
        ALC236_FIXUP_HP_GPIO_LED,
@@ -8405,6 +8407,24 @@ static const struct hda_fixup alc269_fixups[] = {
        [ALC294_FIXUP_ASUS_GU502_HP] = {
                .type = HDA_FIXUP_FUNC,
                .v.func = alc294_fixup_gu502_hp,
+       },
+        [ALC294_FIXUP_ASUS_G513_PINS] = {
+               .type = HDA_FIXUP_PINS,
+               .v.pins = (const struct hda_pintbl[]) {
+                               { 0x19, 0x03a11050 }, /* front HP mic */
+                               { 0x1a, 0x03a11c30 }, /* rear external mic */
+                               { 0x21, 0x03211420 }, /* front HP out */
+                               { }
+               },
+       },
+       [ALC285_FIXUP_ASUS_G533Z_PINS] = {
+               .type = HDA_FIXUP_PINS,
+               .v.pins = (const struct hda_pintbl[]) {
+                       { 0x14, 0x90170120 },
+                       { }
+               },
+               .chained = true,
+               .chain_id = ALC294_FIXUP_ASUS_G513_PINS,
        },
        [ALC294_FIXUP_ASUS_COEF_1B] = {
                .type = HDA_FIXUP_VERBS,
@@ -9149,6 +9169,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
        SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
        SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
        SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB),
+       SND_PCI_QUIRK(0x1028, 0x087d, "Dell Precision 5530", ALC289_FIXUP_DUAL_SPK),
        SND_PCI_QUIRK(0x1028, 0x08ad, "Dell WYSE AIO", ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE),
        SND_PCI_QUIRK(0x1028, 0x08ae, "Dell WYSE NB", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE),
        SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
@@ -9165,6 +9186,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
        SND_PCI_QUIRK(0x1028, 0x0a9d, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
        SND_PCI_QUIRK(0x1028, 0x0a9e, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
        SND_PCI_QUIRK(0x1028, 0x0b19, "Dell XPS 15 9520", ALC289_FIXUP_DUAL_SPK),
+       SND_PCI_QUIRK(0x1028, 0x0b1a, "Dell Precision 5570", ALC289_FIXUP_DUAL_SPK),
        SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
        SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
        SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
@@ -9292,6 +9314,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
        SND_PCI_QUIRK(0x103c, 0x8896, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_MUTE_LED),
        SND_PCI_QUIRK(0x103c, 0x8898, "HP EliteBook 845 G8 Notebook PC", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST),
        SND_PCI_QUIRK(0x103c, 0x88d0, "HP Pavilion 15-eh1xxx (mainboard 88D0)", ALC287_FIXUP_HP_GPIO_LED),
+       SND_PCI_QUIRK(0x103c, 0x8902, "HP OMEN 16", ALC285_FIXUP_HP_MUTE_LED),
        SND_PCI_QUIRK(0x103c, 0x896e, "HP EliteBook x360 830 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
        SND_PCI_QUIRK(0x103c, 0x8971, "HP EliteBook 830 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
        SND_PCI_QUIRK(0x103c, 0x8972, "HP EliteBook 840 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
@@ -9339,10 +9362,11 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
        SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC),
        SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
        SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
+       SND_PCI_QUIRK(0x1043, 0x1662, "ASUS GV301QH", ALC294_FIXUP_ASUS_DUAL_SPK),
+       SND_PCI_QUIRK(0x1043, 0x16b2, "ASUS GU603", ALC289_FIXUP_ASUS_GA401),
        SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
        SND_PCI_QUIRK(0x1043, 0x1740, "ASUS UX430UA", ALC295_FIXUP_ASUS_DACS),
        SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK),
-       SND_PCI_QUIRK(0x1043, 0x1662, "ASUS GV301QH", ALC294_FIXUP_ASUS_DUAL_SPK),
        SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS),
        SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC),
        SND_PCI_QUIRK(0x1043, 0x18f1, "Asus FX505DT", ALC256_FIXUP_ASUS_HEADSET_MIC),
@@ -9358,14 +9382,16 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
        SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
        SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
        SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
+       SND_PCI_QUIRK(0x1043, 0x1c92, "ASUS ROG Strix G15", ALC285_FIXUP_ASUS_G533Z_PINS),
        SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
+       SND_PCI_QUIRK(0x1043, 0x1d42, "ASUS Zephyrus G14 2022", ALC289_FIXUP_ASUS_GA401),
        SND_PCI_QUIRK(0x1043, 0x1d4e, "ASUS TM420", ALC256_FIXUP_ASUS_HPE),
        SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502),
        SND_PCI_QUIRK(0x1043, 0x1e51, "ASUS Zephyrus M15", ALC294_FIXUP_ASUS_GU502_PINS),
+       SND_PCI_QUIRK(0x1043, 0x1e5e, "ASUS ROG Strix G513", ALC294_FIXUP_ASUS_G513_PINS),
        SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA401),
+       SND_PCI_QUIRK(0x1043, 0x1c52, "ASUS Zephyrus G15 2022", ALC289_FIXUP_ASUS_GA401),
        SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401),
-       SND_PCI_QUIRK(0x1043, 0x1d42, "ASUS Zephyrus G14 2022", ALC289_FIXUP_ASUS_GA401),
-       SND_PCI_QUIRK(0x1043, 0x16b2, "ASUS GU603", ALC289_FIXUP_ASUS_GA401),
        SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
        SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
        SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
@@ -9569,6 +9595,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
        SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
        SND_PCI_QUIRK(0x1849, 0x1233, "ASRock NUC Box 1100", ALC233_FIXUP_NO_AUDIO_JACK),
        SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MACH-WX9", ALC256_FIXUP_HUAWEI_MACH_WX9_PINS),
+       SND_PCI_QUIRK(0x19e5, 0x320f, "Huawei WRT-WX9 ", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
        SND_PCI_QUIRK(0x1b35, 0x1235, "CZC B20", ALC269_FIXUP_CZC_B20),
        SND_PCI_QUIRK(0x1b35, 0x1236, "CZC TMI", ALC269_FIXUP_CZC_TMI),
        SND_PCI_QUIRK(0x1b35, 0x1237, "CZC L101", ALC269_FIXUP_CZC_L101),
index 8c8f9a851f894e7a5b3a3d59e3546d608e66cc19..eb71df9da831a3d2dc75f52be797337fa17f41cb 100644 (file)
@@ -758,8 +758,7 @@ bool snd_usb_endpoint_compatible(struct snd_usb_audio *chip,
  * The endpoint needs to be closed via snd_usb_endpoint_close() later.
  *
  * Note that this function doesn't configure the endpoint.  The substream
- * needs to set it up later via snd_usb_endpoint_set_params() and
- * snd_usb_endpoint_prepare().
+ * needs to set it up later via snd_usb_endpoint_configure().
  */
 struct snd_usb_endpoint *
 snd_usb_endpoint_open(struct snd_usb_audio *chip,
@@ -1293,13 +1292,12 @@ out_of_memory:
 /*
  * snd_usb_endpoint_set_params: configure an snd_usb_endpoint
  *
- * It's called either from hw_params callback.
  * Determine the number of URBs to be used on this endpoint.
  * An endpoint must be configured before it can be started.
  * An endpoint that is already running can not be reconfigured.
  */
-int snd_usb_endpoint_set_params(struct snd_usb_audio *chip,
-                               struct snd_usb_endpoint *ep)
+static int snd_usb_endpoint_set_params(struct snd_usb_audio *chip,
+                                      struct snd_usb_endpoint *ep)
 {
        const struct audioformat *fmt = ep->cur_audiofmt;
        int err;
@@ -1382,18 +1380,18 @@ static int init_sample_rate(struct snd_usb_audio *chip,
 }
 
 /*
- * snd_usb_endpoint_prepare: Prepare the endpoint
+ * snd_usb_endpoint_configure: Configure the endpoint
  *
  * This function sets up the EP to be fully usable state.
- * It's called either from prepare callback.
+ * It's called either from hw_params or prepare callback.
  * The function checks need_setup flag, and performs nothing unless needed,
  * so it's safe to call this multiple times.
  *
  * This returns zero if unchanged, 1 if the configuration has changed,
  * or a negative error code.
  */
-int snd_usb_endpoint_prepare(struct snd_usb_audio *chip,
-                            struct snd_usb_endpoint *ep)
+int snd_usb_endpoint_configure(struct snd_usb_audio *chip,
+                              struct snd_usb_endpoint *ep)
 {
        bool iface_first;
        int err = 0;
@@ -1414,6 +1412,9 @@ int snd_usb_endpoint_prepare(struct snd_usb_audio *chip,
                        if (err < 0)
                                goto unlock;
                }
+               err = snd_usb_endpoint_set_params(chip, ep);
+               if (err < 0)
+                       goto unlock;
                goto done;
        }
 
@@ -1441,6 +1442,10 @@ int snd_usb_endpoint_prepare(struct snd_usb_audio *chip,
        if (err < 0)
                goto unlock;
 
+       err = snd_usb_endpoint_set_params(chip, ep);
+       if (err < 0)
+               goto unlock;
+
        err = snd_usb_select_mode_quirk(chip, ep->cur_audiofmt);
        if (err < 0)
                goto unlock;
index e67ea28faa54f689c99991cffc1f8f481278a136..6a9af04cf175afbe31836b98e928fc5ab06c8f1e 100644 (file)
@@ -17,10 +17,8 @@ snd_usb_endpoint_open(struct snd_usb_audio *chip,
                      bool is_sync_ep);
 void snd_usb_endpoint_close(struct snd_usb_audio *chip,
                            struct snd_usb_endpoint *ep);
-int snd_usb_endpoint_set_params(struct snd_usb_audio *chip,
-                               struct snd_usb_endpoint *ep);
-int snd_usb_endpoint_prepare(struct snd_usb_audio *chip,
-                            struct snd_usb_endpoint *ep);
+int snd_usb_endpoint_configure(struct snd_usb_audio *chip,
+                              struct snd_usb_endpoint *ep);
 int snd_usb_endpoint_get_clock_rate(struct snd_usb_audio *chip, int clock);
 
 bool snd_usb_endpoint_compatible(struct snd_usb_audio *chip,
index b604f7e95e8295848ba140ec350eb3ef2afaaa5d..d45d1d7e666447db9862b55dcec0d93152dc6c38 100644 (file)
@@ -443,17 +443,17 @@ static int configure_endpoints(struct snd_usb_audio *chip,
                if (stop_endpoints(subs, false))
                        sync_pending_stops(subs);
                if (subs->sync_endpoint) {
-                       err = snd_usb_endpoint_prepare(chip, subs->sync_endpoint);
+                       err = snd_usb_endpoint_configure(chip, subs->sync_endpoint);
                        if (err < 0)
                                return err;
                }
-               err = snd_usb_endpoint_prepare(chip, subs->data_endpoint);
+               err = snd_usb_endpoint_configure(chip, subs->data_endpoint);
                if (err < 0)
                        return err;
                snd_usb_set_format_quirk(subs, subs->cur_audiofmt);
        } else {
                if (subs->sync_endpoint) {
-                       err = snd_usb_endpoint_prepare(chip, subs->sync_endpoint);
+                       err = snd_usb_endpoint_configure(chip, subs->sync_endpoint);
                        if (err < 0)
                                return err;
                }
@@ -551,13 +551,7 @@ static int snd_usb_hw_params(struct snd_pcm_substream *substream,
        subs->cur_audiofmt = fmt;
        mutex_unlock(&chip->mutex);
 
-       if (subs->sync_endpoint) {
-               ret = snd_usb_endpoint_set_params(chip, subs->sync_endpoint);
-               if (ret < 0)
-                       goto unlock;
-       }
-
-       ret = snd_usb_endpoint_set_params(chip, subs->data_endpoint);
+       ret = configure_endpoints(chip, subs);
 
  unlock:
        if (ret < 0)
index 235dc85c91c3e372980b8b428e9713869115ead4..ef4775c6db01c128ab112a3d741c1b38ef7cdf64 100644 (file)
 #define X86_BUG_ITLB_MULTIHIT          X86_BUG(23) /* CPU may incur MCE during certain page attribute changes */
 #define X86_BUG_SRBDS                  X86_BUG(24) /* CPU may leak RNG bits if not mitigated */
 #define X86_BUG_MMIO_STALE_DATA                X86_BUG(25) /* CPU is affected by Processor MMIO Stale Data vulnerabilities */
-#define X86_BUG_RETBLEED               X86_BUG(26) /* CPU is affected by RETBleed */
-#define X86_BUG_EIBRS_PBRSB            X86_BUG(27) /* EIBRS is vulnerable to Post Barrier RSB Predictions */
+#define X86_BUG_MMIO_UNKNOWN           X86_BUG(26) /* CPU is too old and its MMIO Stale Data status is unknown */
+#define X86_BUG_RETBLEED               X86_BUG(27) /* CPU is affected by RETBleed */
+#define X86_BUG_EIBRS_PBRSB            X86_BUG(28) /* EIBRS is vulnerable to Post Barrier RSB Predictions */
 
 #endif /* _ASM_X86_CPUFEATURES_H */
index 1e6fd6ca513bdf446e2b56816de69a6afc1054eb..27f5e7dfc2f761ad2d2ec9ff8fba996ef046d319 100644 (file)
@@ -44,7 +44,7 @@
 
 /*
  * KVP protocol: The user mode component first registers with the
- * the kernel component. Subsequently, the kernel component requests, data
+ * kernel component. Subsequently, the kernel component requests, data
  * for the specified keys. In response to this message the user mode component
  * fills in the value corresponding to the specified key. We overload the
  * sequence field in the cn_msg header to define our KVP message types.
@@ -772,11 +772,11 @@ static int kvp_process_ip_address(void *addrp,
        const char *str;
 
        if (family == AF_INET) {
-               addr = (struct sockaddr_in *)addrp;
+               addr = addrp;
                str = inet_ntop(family, &addr->sin_addr, tmp, 50);
                addr_length = INET_ADDRSTRLEN;
        } else {
-               addr6 = (struct sockaddr_in6 *)addrp;
+               addr6 = addrp;
                str = inet_ntop(family, &addr6->sin6_addr.s6_addr, tmp, 50);
                addr_length = INET6_ADDRSTRLEN;
        }
index d30439b4b8ab45c7a851891e69ca6ebea007a319..869379f91fe487ad3611966b09bda47462da0b70 100644 (file)
@@ -9,8 +9,8 @@
 #include "../../../arch/alpha/include/uapi/asm/errno.h"
 #elif defined(__mips__)
 #include "../../../arch/mips/include/uapi/asm/errno.h"
-#elif defined(__xtensa__)
-#include "../../../arch/xtensa/include/uapi/asm/errno.h"
+#elif defined(__hppa__)
+#include "../../../arch/parisc/include/uapi/asm/errno.h"
 #else
 #include <asm-generic/errno.h>
 #endif
index 6b1bafe267a4219befee9d9c0dffbcd77fd70a22..8ec5b9f344e02cbb1985f36c66234359e2a00eea 100644 (file)
@@ -441,6 +441,7 @@ mmap_per_evsel(struct perf_evlist *evlist, struct perf_evlist_mmap_ops *ops,
 
        perf_evlist__for_each_entry(evlist, evsel) {
                bool overwrite = evsel->attr.write_backward;
+               enum fdarray_flags flgs;
                struct perf_mmap *map;
                int *output, fd, cpu;
 
@@ -504,8 +505,8 @@ mmap_per_evsel(struct perf_evlist *evlist, struct perf_evlist_mmap_ops *ops,
 
                revent = !overwrite ? POLLIN : 0;
 
-               if (!evsel->system_wide &&
-                   perf_evlist__add_pollfd(evlist, fd, map, revent, fdarray_flag__default) < 0) {
+               flgs = evsel->system_wide ? fdarray_flag__nonfilterable : fdarray_flag__default;
+               if (perf_evlist__add_pollfd(evlist, fd, map, revent, flgs) < 0) {
                        perf_mmap__put(map);
                        return -1;
                }
index f87ef43eb8204a173901975d55da4e87426598a9..0f711f88894cf9ebf87cfa00c390b2e781b8e8b2 100644 (file)
@@ -3371,6 +3371,8 @@ static int record__mmap_cpu_mask_init(struct mmap_cpu_mask *mask, struct perf_cp
                return 0;
 
        perf_cpu_map__for_each_cpu(cpu, idx, cpus) {
+               if (cpu.cpu == -1)
+                       continue;
                /* Return ENODEV is input cpu is greater than max cpu */
                if ((unsigned long)cpu.cpu > mask->nbits)
                        return -ENODEV;
diff --git a/tools/perf/tests/shell/stat_bpf_counters_cgrp.sh b/tools/perf/tests/shell/stat_bpf_counters_cgrp.sh
new file mode 100755 (executable)
index 0000000..d724855
--- /dev/null
@@ -0,0 +1,83 @@
+#!/bin/sh
+# perf stat --bpf-counters --for-each-cgroup test
+# SPDX-License-Identifier: GPL-2.0
+
+set -e
+
+test_cgroups=
+if [ "$1" = "-v" ]; then
+       verbose="1"
+fi
+
+# skip if --bpf-counters --for-each-cgroup is not supported
+check_bpf_counter()
+{
+       if ! perf stat -a --bpf-counters --for-each-cgroup / true > /dev/null 2>&1; then
+               if [ "${verbose}" = "1" ]; then
+                       echo "Skipping: --bpf-counters --for-each-cgroup not supported"
+                       perf --no-pager stat -a --bpf-counters --for-each-cgroup / true || true
+               fi
+               exit 2
+       fi
+}
+
+# find two cgroups to measure
+find_cgroups()
+{
+       # try usual systemd slices first
+       if [ -d /sys/fs/cgroup/system.slice -a -d /sys/fs/cgroup/user.slice ]; then
+               test_cgroups="system.slice,user.slice"
+               return
+       fi
+
+       # try root and self cgroups
+       local self_cgrp=$(grep perf_event /proc/self/cgroup | cut -d: -f3)
+       if [ -z ${self_cgrp} ]; then
+               # cgroup v2 doesn't specify perf_event
+               self_cgrp=$(grep ^0: /proc/self/cgroup | cut -d: -f3)
+       fi
+
+       if [ -z ${self_cgrp} ]; then
+               test_cgroups="/"
+       else
+               test_cgroups="/,${self_cgrp}"
+       fi
+}
+
+# As cgroup events are cpu-wide, we cannot simply compare the result.
+# Just check if it runs without failure and has non-zero results.
+check_system_wide_counted()
+{
+       local output
+
+       output=$(perf stat -a --bpf-counters --for-each-cgroup ${test_cgroups} -e cpu-clock -x, sleep 1  2>&1)
+       if echo ${output} | grep -q -F "<not "; then
+               echo "Some system-wide events are not counted"
+               if [ "${verbose}" = "1" ]; then
+                       echo ${output}
+               fi
+               exit 1
+       fi
+}
+
+check_cpu_list_counted()
+{
+       local output
+
+       output=$(perf stat -C 1 --bpf-counters --for-each-cgroup ${test_cgroups} -e cpu-clock -x, taskset -c 1 sleep 1  2>&1)
+       if echo ${output} | grep -q -F "<not "; then
+               echo "Some CPU events are not counted"
+               if [ "${verbose}" = "1" ]; then
+                       echo ${output}
+               fi
+               exit 1
+       fi
+}
+
+check_bpf_counter
+find_cgroups
+
+check_system_wide_counted
+check_cpu_list_counted
+
+exit 0
index 9d4c45184e715daec8c78ac10189efcc6d456b1e..56455da30341b4ff597d86f71cc41f098d5a0d61 100644 (file)
@@ -2,7 +2,9 @@
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
+#include <errno.h>
 #include <sys/ioctl.h>
+#include <linux/compiler.h>
 #include <linux/hw_breakpoint.h>
 #include <linux/kernel.h>
 #include "tests.h"
@@ -137,8 +139,7 @@ static int test__wp_rw(struct test_suite *test __maybe_unused,
 #endif
 }
 
-static int test__wp_modify(struct test_suite *test __maybe_unused,
-                          int subtest __maybe_unused)
+static int test__wp_modify(struct test_suite *test __maybe_unused, int subtest __maybe_unused)
 {
 #if defined(__s390x__)
        return TEST_SKIP;
@@ -160,6 +161,11 @@ static int test__wp_modify(struct test_suite *test __maybe_unused,
        new_attr.disabled = 1;
        ret = ioctl(fd, PERF_EVENT_IOC_MODIFY_ATTRIBUTES, &new_attr);
        if (ret < 0) {
+               if (errno == ENOTTY) {
+                       test->test_cases[subtest].skip_reason = "missing kernel support";
+                       ret = TEST_SKIP;
+               }
+
                pr_debug("ioctl(PERF_EVENT_IOC_MODIFY_ATTRIBUTES) failed\n");
                close(fd);
                return ret;
index 63b9db657442510a6e8a4cc69266ad4aa4b49bde..3c2df7522f6fcbdc63a918a6d322cd2c3afbcf56 100644 (file)
@@ -95,7 +95,7 @@ static int bperf_load_program(struct evlist *evlist)
 
        perf_cpu_map__for_each_cpu(cpu, i, evlist->core.all_cpus) {
                link = bpf_program__attach_perf_event(skel->progs.on_cgrp_switch,
-                                                     FD(cgrp_switch, cpu.cpu));
+                                                     FD(cgrp_switch, i));
                if (IS_ERR(link)) {
                        pr_err("Failed to attach cgroup program\n");
                        err = PTR_ERR(link);
@@ -115,15 +115,15 @@ static int bperf_load_program(struct evlist *evlist)
                        evsel->cgrp = NULL;
 
                        /* open single copy of the events w/o cgroup */
-                       err = evsel__open_per_cpu(evsel, evlist->core.all_cpus, -1);
+                       err = evsel__open_per_cpu(evsel, evsel->core.cpus, -1);
                        if (err) {
                                pr_err("Failed to open first cgroup events\n");
                                goto out;
                        }
 
                        map_fd = bpf_map__fd(skel->maps.events);
-                       perf_cpu_map__for_each_cpu(cpu, j, evlist->core.all_cpus) {
-                               int fd = FD(evsel, cpu.cpu);
+                       perf_cpu_map__for_each_cpu(cpu, j, evsel->core.cpus) {
+                               int fd = FD(evsel, j);
                                __u32 idx = evsel->core.idx * total_cpus + cpu.cpu;
 
                                err = bpf_map_update_elem(map_fd, &idx, &fd,
@@ -269,7 +269,7 @@ static int bperf_cgrp__read(struct evsel *evsel)
                        goto out;
                }
 
-               perf_cpu_map__for_each_cpu(cpu, i, evlist->core.all_cpus) {
+               perf_cpu_map__for_each_cpu(cpu, i, evsel->core.cpus) {
                        counts = perf_counts(evsel->counts, i, 0);
                        counts->val = values[cpu.cpu].counter;
                        counts->ena = values[cpu.cpu].enabled;
index 292c430768b525afdde468eca9b6ecea40955517..c72f8ad96f75191b9c017207d675cd25a39ca23d 100644 (file)
@@ -176,7 +176,7 @@ static int bperf_cgroup_count(void)
 }
 
 // This will be attached to cgroup-switches event for each cpu
-SEC("perf_events")
+SEC("perf_event")
 int BPF_PROG(on_cgrp_switch)
 {
        return bperf_cgroup_count();
index ed28a0dbcb7f22cf40dba88891b10eb86cdfba91..d81b54563e962b8a0389c7aad0954673b5c7825b 100644 (file)
@@ -253,6 +253,7 @@ jit_write_elf(int fd, uint64_t load_addr, const char *sym,
        Elf_Data *d;
        Elf_Scn *scn;
        Elf_Ehdr *ehdr;
+       Elf_Phdr *phdr;
        Elf_Shdr *shdr;
        uint64_t eh_frame_base_offset;
        char *strsym = NULL;
@@ -287,6 +288,19 @@ jit_write_elf(int fd, uint64_t load_addr, const char *sym,
        ehdr->e_version = EV_CURRENT;
        ehdr->e_shstrndx= unwinding ? 4 : 2; /* shdr index for section name */
 
+       /*
+        * setup program header
+        */
+       phdr = elf_newphdr(e, 1);
+       phdr[0].p_type = PT_LOAD;
+       phdr[0].p_offset = 0;
+       phdr[0].p_vaddr = 0;
+       phdr[0].p_paddr = 0;
+       phdr[0].p_filesz = csize;
+       phdr[0].p_memsz = csize;
+       phdr[0].p_flags = PF_X | PF_R;
+       phdr[0].p_align = 8;
+
        /*
         * setup text section
         */
index ae138afe6c56345a7def862fdc9ae50771616125..b5c909546e3f2041c2c864c12177bb08834cca23 100644 (file)
@@ -53,8 +53,10 @@ int jit_add_debug_info(Elf *e, uint64_t code_addr, void *debug, int nr_debug_ent
 
 #if GEN_ELF_CLASS == ELFCLASS64
 #define elf_newehdr    elf64_newehdr
+#define elf_newphdr    elf64_newphdr
 #define elf_getshdr    elf64_getshdr
 #define Elf_Ehdr       Elf64_Ehdr
+#define Elf_Phdr       Elf64_Phdr
 #define Elf_Shdr       Elf64_Shdr
 #define Elf_Sym                Elf64_Sym
 #define ELF_ST_TYPE(a) ELF64_ST_TYPE(a)
@@ -62,8 +64,10 @@ int jit_add_debug_info(Elf *e, uint64_t code_addr, void *debug, int nr_debug_ent
 #define ELF_ST_VIS(a)  ELF64_ST_VISIBILITY(a)
 #else
 #define elf_newehdr    elf32_newehdr
+#define elf_newphdr    elf32_newphdr
 #define elf_getshdr    elf32_getshdr
 #define Elf_Ehdr       Elf32_Ehdr
+#define Elf_Phdr       Elf32_Phdr
 #define Elf_Shdr       Elf32_Shdr
 #define Elf_Sym                Elf32_Sym
 #define ELF_ST_TYPE(a) ELF32_ST_TYPE(a)
index 75bec32d4f571319e8577e96899dee2a24bb4381..647b7dff8ef36f6bf245df547330fc7cd408e541 100644 (file)
@@ -2102,8 +2102,8 @@ static int kcore_copy__compare_file(const char *from_dir, const char *to_dir,
  * unusual.  One significant peculiarity is that the mapping (start -> pgoff)
  * is not the same for the kernel map and the modules map.  That happens because
  * the data is copied adjacently whereas the original kcore has gaps.  Finally,
- * kallsyms and modules files are compared with their copies to check that
- * modules have not been loaded or unloaded while the copies were taking place.
+ * kallsyms file is compared with its copy to check that modules have not been
+ * loaded or unloaded while the copies were taking place.
  *
  * Return: %0 on success, %-1 on failure.
  */
@@ -2166,9 +2166,6 @@ int kcore_copy(const char *from_dir, const char *to_dir)
                        goto out_extract_close;
        }
 
-       if (kcore_copy__compare_file(from_dir, to_dir, "modules"))
-               goto out_extract_close;
-
        if (kcore_copy__compare_file(from_dir, to_dir, "kallsyms"))
                goto out_extract_close;
 
index 812424dbf2d5b95f1b19df7f704f37643a87dbd6..538790758e242cf16c877356cd7351a951f1e13b 100644 (file)
@@ -367,13 +367,24 @@ static void perf_record_mmap2__read_build_id(struct perf_record_mmap2 *event,
                                             bool is_kernel)
 {
        struct build_id bid;
+       struct nsinfo *nsi;
+       struct nscookie nc;
        int rc;
 
-       if (is_kernel)
+       if (is_kernel) {
                rc = sysfs__read_build_id("/sys/kernel/notes", &bid);
-       else
-               rc = filename__read_build_id(event->filename, &bid) > 0 ? 0 : -1;
+               goto out;
+       }
+
+       nsi = nsinfo__new(event->pid);
+       nsinfo__mountns_enter(nsi, &nc);
 
+       rc = filename__read_build_id(event->filename, &bid) > 0 ? 0 : -1;
+
+       nsinfo__mountns_exit(&nc);
+       nsinfo__put(nsi);
+
+out:
        if (rc == 0) {
                memcpy(event->build_id, bid.data, sizeof(bid.data));
                event->build_id_size = (u8) bid.size;
index c2064a35688b081d41457f21eaa2d53e2f046f87..1fc89b8ef4331ea5c9bd65f91653ccd830b74a2d 100644 (file)
@@ -13,6 +13,7 @@ TARGETS += damon
 TARGETS += drivers/dma-buf
 TARGETS += drivers/s390x/uvdevice
 TARGETS += drivers/net/bonding
+TARGETS += drivers/net/team
 TARGETS += efivarfs
 TARGETS += exec
 TARGETS += filesystems
index ab6c54b1209812ae23fd64b10b1494be946327b0..1d866658e541e559584f2c272db5818106aeffb2 100644 (file)
@@ -1,6 +1,10 @@
 # SPDX-License-Identifier: GPL-2.0
 # Makefile for net selftests
 
-TEST_PROGS := bond-break-lacpdu-tx.sh
+TEST_PROGS := bond-break-lacpdu-tx.sh \
+             dev_addr_lists.sh \
+             bond-arp-interval-causes-panic.sh
+
+TEST_FILES := lag_lib.sh
 
 include ../../../lib.mk
diff --git a/tools/testing/selftests/drivers/net/bonding/bond-arp-interval-causes-panic.sh b/tools/testing/selftests/drivers/net/bonding/bond-arp-interval-causes-panic.sh
new file mode 100755 (executable)
index 0000000..71c00bf
--- /dev/null
@@ -0,0 +1,49 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+#
+# cause kernel oops in bond_rr_gen_slave_id
+DEBUG=${DEBUG:-0}
+
+set -e
+test ${DEBUG} -ne 0 && set -x
+
+finish()
+{
+       ip netns delete server || true
+       ip netns delete client || true
+       ip link del link1_1 || true
+}
+
+trap finish EXIT
+
+client_ip4=192.168.1.198
+server_ip4=192.168.1.254
+
+# setup kernel so it reboots after causing the panic
+echo 180 >/proc/sys/kernel/panic
+
+# build namespaces
+ip link add dev link1_1 type veth peer name link1_2
+
+ip netns add "server"
+ip link set dev link1_2 netns server up name eth0
+ip netns exec server ip addr add ${server_ip4}/24 dev eth0
+
+ip netns add "client"
+ip link set dev link1_1 netns client down name eth0
+ip netns exec client ip link add dev bond0 down type bond mode 1 \
+       miimon 100 all_slaves_active 1
+ip netns exec client ip link set dev eth0 down master bond0
+ip netns exec client ip link set dev bond0 up
+ip netns exec client ip addr add ${client_ip4}/24 dev bond0
+ip netns exec client ping -c 5 $server_ip4 >/dev/null
+
+ip netns exec client ip link set dev eth0 down nomaster
+ip netns exec client ip link set dev bond0 down
+ip netns exec client ip link set dev bond0 type bond mode 0 \
+       arp_interval 1000 arp_ip_target "+${server_ip4}"
+ip netns exec client ip link set dev eth0 down master bond0
+ip netns exec client ip link set dev bond0 up
+ip netns exec client ping -c 5 $server_ip4 >/dev/null
+
+exit 0
index dc1c22de3c923db8d1d98e0d8d4b00b9ab8b2357..70638fa50b2cc872747bd9cdd34a1a111251dc97 100644 (file)
@@ -1 +1,2 @@
 CONFIG_BONDING=y
+CONFIG_MACVLAN=y
diff --git a/tools/testing/selftests/drivers/net/bonding/dev_addr_lists.sh b/tools/testing/selftests/drivers/net/bonding/dev_addr_lists.sh
new file mode 100755 (executable)
index 0000000..e6fa24e
--- /dev/null
@@ -0,0 +1,109 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0
+#
+# Test bond device handling of addr lists (dev->uc, mc)
+#
+
+ALL_TESTS="
+       bond_cleanup_mode1
+       bond_cleanup_mode4
+       bond_listen_lacpdu_multicast_case_down
+       bond_listen_lacpdu_multicast_case_up
+"
+
+REQUIRE_MZ=no
+NUM_NETIFS=0
+lib_dir=$(dirname "$0")
+source "$lib_dir"/../../../net/forwarding/lib.sh
+
+source "$lib_dir"/lag_lib.sh
+
+
+destroy()
+{
+       local ifnames=(dummy1 dummy2 bond1 mv0)
+       local ifname
+
+       for ifname in "${ifnames[@]}"; do
+               ip link del "$ifname" &>/dev/null
+       done
+}
+
+cleanup()
+{
+       pre_cleanup
+
+       destroy
+}
+
+
+# bond driver control paths vary between modes that have a primary slave
+# (bond_uses_primary()) and others. Test both kinds of modes.
+
+bond_cleanup_mode1()
+{
+       RET=0
+
+       test_LAG_cleanup "bonding" "active-backup"
+}
+
+bond_cleanup_mode4() {
+       RET=0
+
+       test_LAG_cleanup "bonding" "802.3ad"
+}
+
+bond_listen_lacpdu_multicast()
+{
+       # Initial state of bond device, up | down
+       local init_state=$1
+       local lacpdu_mc="01:80:c2:00:00:02"
+
+       ip link add dummy1 type dummy
+       ip link add bond1 "$init_state" type bond mode 802.3ad
+       ip link set dev dummy1 master bond1
+       if [ "$init_state" = "down" ]; then
+               ip link set dev bond1 up
+       fi
+
+       grep_bridge_fdb "$lacpdu_mc" bridge fdb show brport dummy1 >/dev/null
+       check_err $? "LACPDU multicast address not present on slave (1)"
+
+       ip link set dev bond1 down
+
+       not grep_bridge_fdb "$lacpdu_mc" bridge fdb show brport dummy1 >/dev/null
+       check_err $? "LACPDU multicast address still present on slave"
+
+       ip link set dev bond1 up
+
+       grep_bridge_fdb "$lacpdu_mc" bridge fdb show brport dummy1 >/dev/null
+       check_err $? "LACPDU multicast address not present on slave (2)"
+
+       cleanup
+
+       log_test "bonding LACPDU multicast address to slave (from bond $init_state)"
+}
+
+# The LACPDU mc addr is added by different paths depending on the initial state
+# of the bond when enslaving a device. Test both cases.
+
+bond_listen_lacpdu_multicast_case_down()
+{
+       RET=0
+
+       bond_listen_lacpdu_multicast "down"
+}
+
+bond_listen_lacpdu_multicast_case_up()
+{
+       RET=0
+
+       bond_listen_lacpdu_multicast "up"
+}
+
+
+trap cleanup EXIT
+
+tests_run
+
+exit "$EXIT_STATUS"
diff --git a/tools/testing/selftests/drivers/net/bonding/lag_lib.sh b/tools/testing/selftests/drivers/net/bonding/lag_lib.sh
new file mode 100644 (file)
index 0000000..16c7fb8
--- /dev/null
@@ -0,0 +1,61 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0
+
+# Test that a link aggregation device (bonding, team) removes the hardware
+# addresses that it adds on its underlying devices.
+test_LAG_cleanup()
+{
+       local driver=$1
+       local mode=$2
+       local ucaddr="02:00:00:12:34:56"
+       local addr6="fe80::78:9abc/64"
+       local mcaddr="33:33:ff:78:9a:bc"
+       local name
+
+       ip link add dummy1 type dummy
+       ip link add dummy2 type dummy
+       if [ "$driver" = "bonding" ]; then
+               name="bond1"
+               ip link add "$name" up type bond mode "$mode"
+               ip link set dev dummy1 master "$name"
+               ip link set dev dummy2 master "$name"
+       elif [ "$driver" = "team" ]; then
+               name="team0"
+               teamd -d -c '
+                       {
+                               "device": "'"$name"'",
+                               "runner": {
+                                       "name": "'"$mode"'"
+                               },
+                               "ports": {
+                                       "dummy1":
+                                               {},
+                                       "dummy2":
+                                               {}
+                               }
+                       }
+               '
+               ip link set dev "$name" up
+       else
+               check_err 1
+               log_test test_LAG_cleanup ": unknown driver \"$driver\""
+               return
+       fi
+
+       # Used to test dev->uc handling
+       ip link add mv0 link "$name" up address "$ucaddr" type macvlan
+       # Used to test dev->mc handling
+       ip address add "$addr6" dev "$name"
+       ip link set dev "$name" down
+       ip link del "$name"
+
+       not grep_bridge_fdb "$ucaddr" bridge fdb show >/dev/null
+       check_err $? "macvlan unicast address still present on a slave"
+
+       not grep_bridge_fdb "$mcaddr" bridge fdb show >/dev/null
+       check_err $? "IPv6 solicited-node multicast mac address still present on a slave"
+
+       cleanup
+
+       log_test "$driver cleanup mode $mode"
+}
diff --git a/tools/testing/selftests/drivers/net/team/Makefile b/tools/testing/selftests/drivers/net/team/Makefile
new file mode 100644 (file)
index 0000000..642d8df
--- /dev/null
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0
+# Makefile for net selftests
+
+TEST_PROGS := dev_addr_lists.sh
+
+include ../../../lib.mk
diff --git a/tools/testing/selftests/drivers/net/team/config b/tools/testing/selftests/drivers/net/team/config
new file mode 100644 (file)
index 0000000..265b688
--- /dev/null
@@ -0,0 +1,3 @@
+CONFIG_NET_TEAM=y
+CONFIG_NET_TEAM_MODE_LOADBALANCE=y
+CONFIG_MACVLAN=y
diff --git a/tools/testing/selftests/drivers/net/team/dev_addr_lists.sh b/tools/testing/selftests/drivers/net/team/dev_addr_lists.sh
new file mode 100755 (executable)
index 0000000..debda72
--- /dev/null
@@ -0,0 +1,51 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0
+#
+# Test team device handling of addr lists (dev->uc, mc)
+#
+
+ALL_TESTS="
+       team_cleanup
+"
+
+REQUIRE_MZ=no
+NUM_NETIFS=0
+lib_dir=$(dirname "$0")
+source "$lib_dir"/../../../net/forwarding/lib.sh
+
+source "$lib_dir"/../bonding/lag_lib.sh
+
+
+destroy()
+{
+       local ifnames=(dummy0 dummy1 team0 mv0)
+       local ifname
+
+       for ifname in "${ifnames[@]}"; do
+               ip link del "$ifname" &>/dev/null
+       done
+}
+
+cleanup()
+{
+       pre_cleanup
+
+       destroy
+}
+
+
+team_cleanup()
+{
+       RET=0
+
+       test_LAG_cleanup "team" "lacp"
+}
+
+
+require_command teamd
+
+trap cleanup EXIT
+
+tests_run
+
+exit "$EXIT_STATUS"
index fac248a436667a38f2d43dc2bb6e63bb9cfea482..6f88da7e60be63844a4c0f18f4ee0f84c5d1c0da 100644 (file)
@@ -227,7 +227,7 @@ int main(int argc, char *argv[])
        ucall_init(vm, NULL);
 
        pthread_create(&migration_thread, NULL, migration_worker,
-                      (void *)(unsigned long)gettid());
+                      (void *)(unsigned long)syscall(SYS_gettid));
 
        for (i = 0; !done; i++) {
                vcpu_run(vcpu);
index 57e90c873a2cf4e6e326ed57b6410414a9dcb597..5a58b1ec8aefb573c944834502084e3d46c4aaf5 100755 (executable)
@@ -28,7 +28,7 @@
 # +------------------+       +------------------+
 #
 
-ALL_TESTS="mcast_v4 mcast_v6 rpf_v4 rpf_v6"
+ALL_TESTS="mcast_v4 mcast_v6 rpf_v4 rpf_v6 unres_v4 unres_v6"
 NUM_NETIFS=6
 source lib.sh
 source tc_common.sh
@@ -406,6 +406,96 @@ rpf_v6()
        log_test "RPF IPv6"
 }
 
+unres_v4()
+{
+       # Send a multicast packet not corresponding to an installed route,
+       # causing the kernel to queue the packet for resolution and emit an
+       # IGMPMSG_NOCACHE notification. smcrouted will react to this
+       # notification by consulting its (*, G) list and installing an (S, G)
+       # route, which will be used to forward the queued packet.
+
+       RET=0
+
+       tc filter add dev $h2 ingress protocol ip pref 1 handle 1 flower \
+               dst_ip 225.1.2.3 ip_proto udp dst_port 12345 action drop
+       tc filter add dev $h3 ingress protocol ip pref 1 handle 1 flower \
+               dst_ip 225.1.2.3 ip_proto udp dst_port 12345 action drop
+
+       # Forwarding should fail before installing a matching (*, G).
+       $MZ $h1 -c 1 -p 128 -t udp "ttl=10,sp=54321,dp=12345" \
+               -a 00:11:22:33:44:55 -b 01:00:5e:01:02:03 \
+               -A 198.51.100.2 -B 225.1.2.3 -q
+
+       tc_check_packets "dev $h2 ingress" 1 0
+       check_err $? "Multicast received on first host when should not"
+       tc_check_packets "dev $h3 ingress" 1 0
+       check_err $? "Multicast received on second host when should not"
+
+       # Create (*, G). Will not be installed in the kernel.
+       create_mcast_sg $rp1 0.0.0.0 225.1.2.3 $rp2 $rp3
+
+       $MZ $h1 -c 1 -p 128 -t udp "ttl=10,sp=54321,dp=12345" \
+               -a 00:11:22:33:44:55 -b 01:00:5e:01:02:03 \
+               -A 198.51.100.2 -B 225.1.2.3 -q
+
+       tc_check_packets "dev $h2 ingress" 1 1
+       check_err $? "Multicast not received on first host"
+       tc_check_packets "dev $h3 ingress" 1 1
+       check_err $? "Multicast not received on second host"
+
+       delete_mcast_sg $rp1 0.0.0.0 225.1.2.3 $rp2 $rp3
+
+       tc filter del dev $h3 ingress protocol ip pref 1 handle 1 flower
+       tc filter del dev $h2 ingress protocol ip pref 1 handle 1 flower
+
+       log_test "Unresolved queue IPv4"
+}
+
+unres_v6()
+{
+       # Send a multicast packet not corresponding to an installed route,
+       # causing the kernel to queue the packet for resolution and emit an
+       # MRT6MSG_NOCACHE notification. smcrouted will react to this
+       # notification by consulting its (*, G) list and installing an (S, G)
+       # route, which will be used to forward the queued packet.
+
+       RET=0
+
+       tc filter add dev $h2 ingress protocol ipv6 pref 1 handle 1 flower \
+               dst_ip ff0e::3 ip_proto udp dst_port 12345 action drop
+       tc filter add dev $h3 ingress protocol ipv6 pref 1 handle 1 flower \
+               dst_ip ff0e::3 ip_proto udp dst_port 12345 action drop
+
+       # Forwarding should fail before installing a matching (*, G).
+       $MZ $h1 -6 -c 1 -p 128 -t udp "ttl=10,sp=54321,dp=12345" \
+               -a 00:11:22:33:44:55 -b 33:33:00:00:00:03 \
+               -A 2001:db8:1::2 -B ff0e::3 -q
+
+       tc_check_packets "dev $h2 ingress" 1 0
+       check_err $? "Multicast received on first host when should not"
+       tc_check_packets "dev $h3 ingress" 1 0
+       check_err $? "Multicast received on second host when should not"
+
+       # Create (*, G). Will not be installed in the kernel.
+       create_mcast_sg $rp1 :: ff0e::3 $rp2 $rp3
+
+       $MZ $h1 -6 -c 1 -p 128 -t udp "ttl=10,sp=54321,dp=12345" \
+               -a 00:11:22:33:44:55 -b 33:33:00:00:00:03 \
+               -A 2001:db8:1::2 -B ff0e::3 -q
+
+       tc_check_packets "dev $h2 ingress" 1 1
+       check_err $? "Multicast not received on first host"
+       tc_check_packets "dev $h3 ingress" 1 1
+       check_err $? "Multicast not received on second host"
+
+       delete_mcast_sg $rp1 :: ff0e::3 $rp2 $rp3
+
+       tc filter del dev $h3 ingress protocol ipv6 pref 1 handle 1 flower
+       tc filter del dev $h2 ingress protocol ipv6 pref 1 handle 1 flower
+
+       log_test "Unresolved queue IPv6"
+}
+
 trap cleanup EXIT
 
 setup_prepare
index e714bae473fb4b424a900f8a94141c6c62eb2c3d..81f31179ac8878d3728755a4a814fae866468799 100755 (executable)
@@ -1,3 +1,4 @@
+#!/bin/bash
 # SPDX-License-Identifier: GPL-2.0
 
 # This test sends one stream of traffic from H1 through a TBF shaper, to a RED
index a6991877e50cdc83546502a8b4dafb5f0f63c5f8..e908009576c74d41823f6ef666b1b75e4ff995d7 100755 (executable)
@@ -91,7 +91,7 @@ src
 start          1
 count          5
 src_delta      2000
-tools          sendip nc bash
+tools          sendip socat nc bash
 proto          udp
 
 race_repeat    3
@@ -116,7 +116,7 @@ src
 start          10
 count          5
 src_delta      2000
-tools          sendip nc bash
+tools          sendip socat nc bash
 proto          udp6
 
 race_repeat    3
@@ -141,7 +141,7 @@ src
 start          1
 count          5
 src_delta      2000
-tools          sendip nc bash
+tools          sendip socat nc bash
 proto          udp
 
 race_repeat    0
@@ -163,7 +163,7 @@ src         mac
 start          10
 count          5
 src_delta      2000
-tools          sendip nc bash
+tools          sendip socat nc bash
 proto          udp6
 
 race_repeat    0
@@ -185,7 +185,7 @@ src         mac proto
 start          10
 count          5
 src_delta      2000
-tools          sendip nc bash
+tools          sendip socat nc bash
 proto          udp6
 
 race_repeat    0
@@ -207,7 +207,7 @@ src         addr4
 start          1
 count          5
 src_delta      2000
-tools          sendip nc bash
+tools          sendip socat nc bash
 proto          udp
 
 race_repeat    3
@@ -227,7 +227,7 @@ src         addr6 port
 start          10
 count          5
 src_delta      2000
-tools          sendip nc
+tools          sendip socat nc
 proto          udp6
 
 race_repeat    3
@@ -247,7 +247,7 @@ src         mac proto addr4
 start          1
 count          5
 src_delta      2000
-tools          sendip nc bash
+tools          sendip socat nc bash
 proto          udp
 
 race_repeat    0
@@ -264,7 +264,7 @@ src         mac
 start          1
 count          5
 src_delta      2000
-tools          sendip nc bash
+tools          sendip socat nc bash
 proto          udp
 
 race_repeat    0
@@ -286,7 +286,7 @@ src         mac addr4
 start          1
 count          5
 src_delta      2000
-tools          sendip nc bash
+tools          sendip socat nc bash
 proto          udp
 
 race_repeat    0
@@ -337,7 +337,7 @@ src         addr4
 start          1
 count          5
 src_delta      2000
-tools          sendip nc
+tools          sendip socat nc
 proto          udp
 
 race_repeat    3
@@ -363,7 +363,7 @@ src         mac
 start          1
 count          1
 src_delta      2000
-tools          sendip nc bash
+tools          sendip socat nc bash
 proto          udp
 
 race_repeat    0
@@ -541,6 +541,24 @@ setup_send_udp() {
                        dst_port=
                        src_addr4=
                }
+       elif command -v socat -v >/dev/null; then
+               send_udp() {
+                       if [ -n "${src_addr4}" ]; then
+                               B ip addr add "${src_addr4}" dev veth_b
+                               __socatbind=",bind=${src_addr4}"
+                               if [ -n "${src_port}" ];then
+                                       __socatbind="${__socatbind}:${src_port}"
+                               fi
+                       fi
+
+                       ip addr add "${dst_addr4}" dev veth_a 2>/dev/null
+                       [ -z "${dst_port}" ] && dst_port=12345
+
+                       echo "test4" | B socat -t 0.01 STDIN UDP4-DATAGRAM:${dst_addr4}:${dst_port}"${__socatbind}"
+
+                       src_addr4=
+                       src_port=
+               }
        elif command -v nc >/dev/null; then
                if nc -u -w0 1.1.1.1 1 2>/dev/null; then
                        # OpenBSD netcat
@@ -606,6 +624,29 @@ setup_send_udp6() {
                        dst_port=
                        src_addr6=
                }
+       elif command -v socat -v >/dev/null; then
+               send_udp6() {
+                       ip -6 addr add "${dst_addr6}" dev veth_a nodad \
+                               2>/dev/null
+
+                       __socatbind6=
+
+                       if [ -n "${src_addr6}" ]; then
+                               if [ -n "${src_addr6} != "${src_addr6_added} ]; then
+                                       B ip addr add "${src_addr6}" dev veth_b nodad
+
+                                       src_addr6_added=${src_addr6}
+                               fi
+
+                               __socatbind6=",bind=[${src_addr6}]"
+
+                               if [ -n "${src_port}" ] ;then
+                                       __socatbind6="${__socatbind6}:${src_port}"
+                               fi
+                       fi
+
+                       echo "test6" | B socat -t 0.01 STDIN UDP6-DATAGRAM:[${dst_addr6}]:${dst_port}"${__socatbind6}"
+               }
        elif command -v nc >/dev/null && nc -u -w0 1.1.1.1 1 2>/dev/null; then
                # GNU netcat might not work with IPv6, try next tool
                send_udp6() {
index f0d51d4d2c879cffaea6143793096e19a9162ec5..3a5936cc10abc29347f1e03d49e7bf4b1600000d 100644 (file)
@@ -1,4 +1,4 @@
-TEST_GEN_PROGS := timens timerfd timer clock_nanosleep procfs exec futex vfork_exec
+TEST_GEN_PROGS := timens timerfd timer clock_nanosleep procfs exec futex
 TEST_GEN_PROGS_EXTENDED := gettime_perf
 
 CFLAGS := -Wall -Werror -pthread
diff --git a/tools/testing/selftests/timens/vfork_exec.c b/tools/testing/selftests/timens/vfork_exec.c
deleted file mode 100644 (file)
index e6ccd90..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-#define _GNU_SOURCE
-#include <errno.h>
-#include <fcntl.h>
-#include <sched.h>
-#include <stdio.h>
-#include <stdbool.h>
-#include <sys/stat.h>
-#include <sys/syscall.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <time.h>
-#include <unistd.h>
-#include <string.h>
-
-#include "log.h"
-#include "timens.h"
-
-#define OFFSET (36000)
-
-int main(int argc, char *argv[])
-{
-       struct timespec now, tst;
-       int status, i;
-       pid_t pid;
-
-       if (argc > 1) {
-               if (sscanf(argv[1], "%ld", &now.tv_sec) != 1)
-                       return pr_perror("sscanf");
-
-               for (i = 0; i < 2; i++) {
-                       _gettime(CLOCK_MONOTONIC, &tst, i);
-                       if (abs(tst.tv_sec - now.tv_sec) > 5)
-                               return pr_fail("%ld %ld\n", now.tv_sec, tst.tv_sec);
-               }
-               return 0;
-       }
-
-       nscheck();
-
-       ksft_set_plan(1);
-
-       clock_gettime(CLOCK_MONOTONIC, &now);
-
-       if (unshare_timens())
-               return 1;
-
-       if (_settime(CLOCK_MONOTONIC, OFFSET))
-               return 1;
-
-       for (i = 0; i < 2; i++) {
-               _gettime(CLOCK_MONOTONIC, &tst, i);
-               if (abs(tst.tv_sec - now.tv_sec) > 5)
-                       return pr_fail("%ld %ld\n",
-                                       now.tv_sec, tst.tv_sec);
-       }
-
-       pid = vfork();
-       if (pid < 0)
-               return pr_perror("fork");
-
-       if (pid == 0) {
-               char now_str[64];
-               char *cargv[] = {"exec", now_str, NULL};
-               char *cenv[] = {NULL};
-
-               // Check that we are still in the source timens.
-               for (i = 0; i < 2; i++) {
-                       _gettime(CLOCK_MONOTONIC, &tst, i);
-                       if (abs(tst.tv_sec - now.tv_sec) > 5)
-                               return pr_fail("%ld %ld\n",
-                                               now.tv_sec, tst.tv_sec);
-               }
-
-               /* Check for proper vvar offsets after execve. */
-               snprintf(now_str, sizeof(now_str), "%ld", now.tv_sec + OFFSET);
-               execve("/proc/self/exe", cargv, cenv);
-               return pr_perror("execve");
-       }
-
-       if (waitpid(pid, &status, 0) != pid)
-               return pr_perror("waitpid");
-
-       if (status)
-               ksft_exit_fail();
-
-       ksft_test_result_pass("exec\n");
-       ksft_exit_pass();
-       return 0;
-}
index fda76282d34b8381d4ca8d1827c78d9ccae98970..e95bd56b332f757321db82ead8181179fce4376b 100644 (file)
@@ -343,8 +343,10 @@ $(KERNEL_BZIMAGE): $(TOOLCHAIN_PATH)/.installed $(KERNEL_BUILD_PATH)/.config $(B
 .PHONY: $(KERNEL_BZIMAGE)
 
 $(TOOLCHAIN_PATH)/$(CHOST)/include/linux/.installed: | $(KERNEL_BUILD_PATH)/.config $(TOOLCHAIN_PATH)/.installed
+ifneq ($(ARCH),um)
        rm -rf $(TOOLCHAIN_PATH)/$(CHOST)/include/linux
        $(MAKE) -C $(KERNEL_PATH) O=$(KERNEL_BUILD_PATH) INSTALL_HDR_PATH=$(TOOLCHAIN_PATH)/$(CHOST) ARCH=$(KERNEL_ARCH) CROSS_COMPILE=$(CROSS_COMPILE) headers_install
+endif
        touch $@
 
 $(TOOLCHAIN_PATH)/.installed: $(TOOLCHAIN_TAR)