Compare
205cccd06e545694754e1bf8d626ea96e742cd8a..19fc4240358be2a25ce8e0a49a2819588ed61c5d
pinctrl: qcom: spmi-gpio: make direction changes exclusive
Neither direction callback clears the opposite buffer: .direction_output()
only packs PIN_CONFIG_LEVEL and .direction_input() only packs
PIN_CONFIG_INPUT_ENABLE. As pmic_gpio_populate() seeds input_enabled and
output_enabled from MODE_CTL, a pad left in DIGITAL_INPUT[_OUTPUT] by the
bootloader ends up in DIGITAL_INPUT_OUTPUT whichever direction is
requested. That leaves an input still driving the line, and makes
pmic_gpio_get_direction() report an output as an input, which breaks
consumers that read the direction back:
reg-fixed-voltage regulator-wcn-core-vm-1p35: setup of GPIO (default) failed: -1
reg-fixed-voltage regulator-wcn-core-vm-1p35: error -EPERM: can't get GPIO
Pack the opposite buffer's PIN_CONFIG_*_ENABLE along with the requested
direction, so MODE_CTL becomes DIGITAL_INPUT or DIGITAL_OUTPUT, never
both. pmic_gpio_config_set() writes the registers once after walking all
configs, so this stays a single write.
An open-drain or open-source output is the exception: it only drives one
rail, so pmic_gpio_get() needs the input buffer to sample the line rather
than return the value last written. Program the input buffer from
pad->buffer_type, which gpiolib has already updated via
PIN_CONFIG_DRIVE_OPEN_DRAIN, and key pmic_gpio_get_direction() off
output_enabled so such pads still read back as outputs.
Genuinely bidirectional pads can still be described that way through
pinconf; the gpiolib callbacks now mean what gpiolib says they mean.
Fixes: 263447532463 ("pinctrl: qcom: spmi-gpio: implement .get_direction()")
Assisted-by: LLM
Reviewed-by: Linus Walleij <linusw@kernel.org>
Signed-off-by: Shawn Guo <shengchao.guo@oss.qualcomm.com>
Link: https://patch.msgid.link/20260927010913.1212600-1-shengchao.guo@oss.qualcomm.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Shawn Guo <shengchao.guo@oss.qualcomm.com> · 2026-09-27 01:09 UTC · committed by Bartosz Golaszewski
662 files changed,
+4103
−7973
- .mailmap
- Documentation/admin-guide/ext4.rst
- Documentation/arch/arm64/silicon-errata.rst
- Documentation/devicetree/bindings/iio/adc/rockchip-saradc.yaml
- Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.yaml
- Documentation/filesystems/netfs_library.rst
- Documentation/filesystems/propagate_umount.txt
- Documentation/filesystems/sharedsubtree.rst
- Documentation/networking/strparser.rst
- MAINTAINERS
- Makefile
- arch/arc/Kconfig
- arch/arc/include/asm/atomic64-arcv2.h
- arch/arc/include/asm/cmpxchg.h
- arch/arc/kernel/setup.c
- arch/arc/kernel/smp.c
- arch/arm64/Kconfig
- arch/arm64/boot/dts/freescale/fsl-lx216x.dtsi
- arch/arm64/boot/dts/freescale/imx8mp-var-dart-sonata.dts
- arch/arm64/boot/dts/qcom/x1-microsoft-denali.dtsi
- arch/arm64/include/asm/el2_setup.h
- arch/arm64/kernel/Makefile
- arch/arm64/kernel/cpu_errata.c
- arch/arm64/kernel/cpufeature.c
- arch/arm64/kernel/signal.c
- arch/arm64/kernel/topology.c
- arch/arm64/kernel/vdso/Makefile
- arch/arm64/kvm/emulate-nested.c
- arch/arm64/kvm/hyp/include/nvhe/pkvm.h
- arch/arm64/kvm/hyp/nvhe/hyp-main.c
- arch/arm64/kvm/hyp/nvhe/pkvm.c
- arch/arm64/kvm/mmu.c
- arch/arm64/kvm/vgic/vgic-init.c
- arch/arm64/kvm/vgic/vgic-its.c
- arch/arm64/kvm/vgic/vgic-v2.c
- arch/arm64/kvm/vgic/vgic-v3.c
- arch/arm64/kvm/vgic/vgic.c
- arch/arm64/mm/mmu.c
- arch/arm64/net/bpf_jit_comp.c
- arch/arm64/tools/cpucaps
- arch/loongarch/net/bpf_jit.c
- arch/loongarch/vdso/Makefile
- arch/powerpc/kernel/vdso/Makefile
- arch/powerpc/kvm/book3s_hv.c
- arch/powerpc/net/bpf_jit_comp.c
- arch/powerpc/perf/imc-pmu.c
- arch/riscv/Kconfig
- arch/riscv/Kconfig.errata
- arch/riscv/Kconfig.socs
- arch/riscv/errata/sifive/errata.c
- arch/riscv/include/asm/cpufeature.h
- arch/riscv/include/asm/errata_list_vendors.h
- arch/riscv/include/asm/futex.h
- arch/riscv/include/asm/insn-def.h
- arch/riscv/include/asm/scs.h
- arch/riscv/include/asm/vector.h
- arch/riscv/include/uapi/asm/vendor/mips.h
- arch/riscv/kernel/cpufeature.c
- arch/riscv/kernel/entry.S
- arch/riscv/kernel/patch.c
- arch/riscv/kernel/ptrace.c
- arch/riscv/kernel/setup.c
- arch/riscv/kernel/smpboot.c
- arch/riscv/kernel/suspend.c
- arch/riscv/kernel/vdso/Makefile
- arch/riscv/kvm/aia_device.c
- arch/riscv/lib/strnlen.S
- arch/riscv/mm/extable.c
- arch/riscv/net/bpf_jit_comp64.c
- arch/s390/kernel/vdso/Makefile
- arch/s390/kvm/s390/s390.c
- arch/s390/net/bpf_jit_comp.c
- arch/um/drivers/vector_transports.c
- arch/x86/crypto/aesni-intel_glue.c
- arch/x86/entry/vdso/vdso64/Makefile
- arch/x86/include/asm/cpufeatures.h
- arch/x86/include/asm/tlb.h
- arch/x86/include/uapi/asm/ptrace-abi.h
- arch/x86/kernel/cpu/amd.c
- arch/x86/kernel/sys_x86_64.c
- arch/x86/kvm/mmu/mmu.c
- arch/x86/kvm/svm/sev.c
- arch/x86/kvm/svm/svm.c
- arch/x86/kvm/svm/svm.h
- arch/x86/kvm/vmx/nested.c
- arch/x86/kvm/vmx/tdx.c
- arch/x86/mm/pgtable.c
- arch/x86/net/bpf_jit_comp.c
- arch/x86/um/asm/ptrace.h
- arch/x86/um/ptrace_32.c
- block/blk-cgroup.c
- block/blk-mq.c
- block/fops.c
- block/mq-deadline.c
- crypto/aes.c
- drivers/accessibility/braille/braille_console.c
- drivers/android/binder.c
- drivers/android/binder/node.rs
- drivers/android/binder/node/wrapper.rs
- drivers/android/binder/rust_binderfs.c
- drivers/android/binder/thread.rs
- drivers/android/binderfs.c
- drivers/ata/libata-scsi.c
- drivers/block/drbd/drbd_nl_gen.c
- drivers/block/virtio_blk.c
- drivers/block/zloop.c
- drivers/bluetooth/btintel.c
- drivers/bluetooth/btintel_pcie.c
- drivers/char/mem.c
- drivers/char/tpm/tpm-interface.c
- drivers/char/tpm/tpm2-cmd.c
- drivers/char/tpm/tpm2-sessions.c
- drivers/clk/qcom/gcc-eliza.c
- drivers/clk/qcom/gcc-hawi.c
- drivers/clk/qcom/gcc-kaanapali.c
- drivers/clk/qcom/gpucc-glymur.c
- drivers/clk/qcom/gpucc-kaanapali.c
- drivers/clk/spacemit/ccu-k3.c
- drivers/clk/ti/composite.c
- drivers/cpufreq/cpufreq.c
- drivers/cpufreq/intel_pstate.c
- drivers/edac/altera_edac.c
- drivers/edac/amd64_edac.c
- drivers/edac/versalnet_edac.c
- drivers/gpio/gpio-exar.c
- drivers/gpio/gpio-mpsse.c
- drivers/gpio/gpio-mxc.c
- drivers/gpio/gpio-nct6694.c
- drivers/gpio/gpio-xilinx.c
- drivers/gpio/gpiolib-kunit.c
- drivers/gpio/gpiolib-shared.c
- drivers/gpio/gpiolib.c
- drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c
- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
- drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
- drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
- drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
- drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
- drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
- drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
- drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c
- drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c
- drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c
- drivers/gpu/drm/amd/amdgpu/gmc_v12_1.c
- drivers/gpu/drm/amd/amdgpu/mes_userqueue.c
- drivers/gpu/drm/amd/amdgpu/sdma_v7_1.c
- drivers/gpu/drm/amd/amdgpu/vi.c
- drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
- drivers/gpu/drm/amd/amdkfd/kfd_priv.h
- drivers/gpu/drm/amd/amdkfd/kfd_svm.c
- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_backlight.c
- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c
- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c
- drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_connector_test.c
- drivers/gpu/drm/amd/display/dc/dc.h
- drivers/gpu/drm/amd/display/dc/dml/Makefile
- drivers/gpu/drm/amd/display/dc/dml2_0/Makefile
- drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.c
- drivers/gpu/drm/amd/display/dc/resource/dce60/dce60_resource.c
- drivers/gpu/drm/amd/display/dc/resource/dce80/dce80_resource.c
- drivers/gpu/drm/amd/display/modules/power/power.c
- drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c
- drivers/gpu/drm/aspeed/aspeed_gfx_drv.c
- drivers/gpu/drm/bridge/th1520-dw-hdmi.c
- drivers/gpu/drm/display/drm_dp_helper.c
- drivers/gpu/drm/drm_bridge.c
- drivers/gpu/drm/drm_fb_helper.c
- drivers/gpu/drm/gud/gud_pipe.c
- drivers/gpu/drm/i915/display/intel_display_params.c
- drivers/gpu/drm/i915/display/intel_display_params.h
- drivers/gpu/drm/i915/display/intel_vrr.c
- drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
- drivers/gpu/drm/i915/gt/intel_rps.c
- drivers/gpu/drm/imagination/pvr_mmu.c
- drivers/gpu/drm/imagination/pvr_vm.c
- drivers/gpu/drm/mediatek/mtk_drm_drv.c
- drivers/gpu/drm/mediatek/mtk_hdmi_ddc_v2.c
- drivers/gpu/drm/mediatek/mtk_hdmi_regs_v2.h
- drivers/gpu/drm/nouveau/nouveau_abi16.c
- drivers/gpu/drm/nouveau/nvkm/engine/device/user.c
- drivers/gpu/drm/panthor/panthor_sched.c
- drivers/gpu/drm/radeon/radeon_bios.c
- drivers/gpu/drm/vc4/vc4_bo.c
- drivers/gpu/drm/vc4/vc4_drv.c
- drivers/gpu/drm/vc4/vc4_drv.h
- drivers/gpu/drm/vc4/vc4_gem.c
- drivers/gpu/drm/vc4/vc4_irq.c
- drivers/gpu/drm/vc4/vc4_v3d.c
- drivers/gpu/drm/vc4/vc4_validate.c
- drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c
- drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
- drivers/gpu/drm/xe/display/xe_fb_pin.c
- drivers/gpu/drm/xe/xe_bo.c
- drivers/gpu/drm/xe/xe_bo.h
- drivers/gpu/drm/xe/xe_i2c.c
- drivers/gpu/drm/xe/xe_lrc.c
- drivers/gpu/drm/xe/xe_mmio.c
- drivers/gpu/drm/xe/xe_pci_sriov.c
- drivers/gpu/drm/xe/xe_sysctrl_mailbox.c
- drivers/hid/bpf/hid_bpf_dispatch.c
- drivers/hid/hid-ids.h
- drivers/hid/hid-logitech-dj.c
- drivers/hid/hid-logitech-hidpp.c
- drivers/hid/hid-multitouch.c
- drivers/hid/hid-universal-pidff.c
- drivers/hid/intel-thc-hid/intel-quicki2c/pci-quicki2c.c
- drivers/hid/intel-thc-hid/intel-quickspi/pci-quickspi.c
- drivers/i2c/busses/i2c-at91-master.c
- drivers/i2c/busses/i2c-qcom-geni.c
- drivers/i2c/busses/i2c-xiic.c
- drivers/iio/accel/kionix-kx022a.c
- drivers/iio/accel/kxcjk-1013.c
- drivers/iio/accel/sca3000.c
- drivers/iio/adc/ad4030.c
- drivers/iio/adc/ad7173.c
- drivers/iio/adc/ad_sigma_delta.c
- drivers/iio/adc/ade9000.c
- drivers/iio/adc/adi-axi-adc.c
- drivers/iio/adc/aspeed_adc.c
- drivers/iio/adc/axp288_adc.c
- drivers/iio/adc/max1363.c
- drivers/iio/adc/pac1934.c
- drivers/iio/adc/rohm-bd79124.c
- drivers/iio/adc/stm32-adc.c
- drivers/iio/adc/sun4i-gpadc-iio.c
- drivers/iio/adc/xilinx-xadc-core.c
- drivers/iio/buffer/industrialio-buffer-dmaengine.c
- drivers/iio/cdc/ad7150.c
- drivers/iio/common/inv_sensors/inv_sensors_timestamp.c
- drivers/iio/dac/mcp47a1.c
- drivers/iio/dac/rohm-bd79703.c
- drivers/iio/frequency/adf4377.c
- drivers/iio/frequency/admv1013.c
- drivers/iio/gyro/adis16136.c
- drivers/iio/health/max30102.c
- drivers/iio/imu/adis16400.c
- drivers/iio/imu/adis16480.c
- drivers/iio/imu/inv_icm42607/inv_icm42607_core.c
- drivers/iio/industrialio-buffer.c
- drivers/iio/industrialio-trigger.c
- drivers/iio/light/gp2ap020a00f.c
- drivers/iio/light/rohm-bu27034.c
- drivers/iio/pressure/bmp280-core.c
- drivers/iio/pressure/rohm-bm1390.c
- drivers/iio/proximity/aw96103.c
- drivers/iio/proximity/isl29501.c
- drivers/iio/proximity/pulsedlight-lidar-lite-v2.c
- drivers/iio/proximity/sx9324.c
- drivers/iio/proximity/vcnl3020.c
- drivers/iio/proximity/vl53l0x-i2c.c
- drivers/input/joystick/xpad.c
- drivers/input/keyboard/atkbd.c
- drivers/input/misc/ati_remote2.c
- drivers/input/mouse/synaptics.c
- drivers/input/serio/i8042-acpipnpio.h
- drivers/input/touchscreen/s6sy761.c
- drivers/interconnect/qcom/x1e80100.c
- drivers/iommu/dma-iommu.c
- drivers/md/dm-crypt.c
- drivers/md/dm-integrity.c
- drivers/md/dm-ioctl.c
- drivers/md/dm-snap.c
- drivers/media/usb/em28xx/em28xx-video.c
- drivers/memstick/core/memstick.c
- drivers/memstick/host/rtsx_usb_ms.c
- drivers/mmc/host/cavium-octeon.c
- drivers/mmc/host/cavium-thunderx.c
- drivers/mmc/host/mtk-sd.c
- drivers/mmc/host/sdhci-sprd.c
- drivers/mtd/chips/cfi_cmdset_0001.c
- drivers/mtd/devices/block2mtd.c
- drivers/mtd/devices/mtd_intel_dg.c
- drivers/mtd/mtdcore.c
- drivers/mtd/nand/ecc.c
- drivers/mtd/nand/raw/cadence-nand-controller.c
- drivers/mtd/nand/raw/vf610_nfc.c
- drivers/mtd/nand/spi/core.c
- drivers/mtd/spi-nor/core.c
- drivers/net/amt.c
- drivers/net/bareudp.c
- drivers/net/bonding/bond_main.c
- drivers/net/can/dev/skb.c
- drivers/net/can/usb/f81604.c
- drivers/net/can/vxcan.c
- drivers/net/dsa/microchip/ksz_common.h
- drivers/net/ethernet/airoha/airoha_eth.c
- drivers/net/ethernet/airoha/airoha_eth.h
- drivers/net/ethernet/allwinner/sun4i-emac.c
- drivers/net/ethernet/broadcom/bcmsysport.c
- drivers/net/ethernet/broadcom/bnxt/bnxt.c
- drivers/net/ethernet/broadcom/bnxt/bnxt.h
- drivers/net/ethernet/broadcom/genet/bcmgenet.c
- drivers/net/ethernet/broadcom/genet/bcmgenet.h
- drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c
- drivers/net/ethernet/cadence/macb_main.c
- drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c
- drivers/net/ethernet/google/gve/gve_main.c
- drivers/net/ethernet/google/gve/gve_rx_dqo.c
- drivers/net/ethernet/google/gve/gve_tx_dqo.c
- drivers/net/ethernet/ibm/ibmveth.c
- drivers/net/ethernet/intel/e1000e/netdev.c
- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
- drivers/net/ethernet/intel/iavf/iavf.h
- drivers/net/ethernet/intel/iavf/iavf_main.c
- drivers/net/ethernet/intel/iavf/iavf_virtchnl.c
- drivers/net/ethernet/intel/ice/devlink/port.c
- drivers/net/ethernet/intel/ice/ice_eswitch.c
- drivers/net/ethernet/intel/ice/ice_sriov.c
- drivers/net/ethernet/intel/ice/ice_txrx.c
- drivers/net/ethernet/marvell/mvneta.c
- drivers/net/ethernet/marvell/octeontx2/af/mcs.c
- drivers/net/ethernet/marvell/octeontx2/nic/cn20k.c
- drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
- drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
- drivers/net/ethernet/mediatek/mtk_eth_soc.c
- drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c
- drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
- drivers/net/ethernet/mellanox/mlx5/core/esw/adj_vport.c
- drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c
- drivers/net/ethernet/mellanox/mlx5/core/vport.c
- drivers/net/ethernet/mellanox/mlxsw/spectrum.h
- drivers/net/ethernet/mellanox/mlxsw/spectrum_acl.c
- drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c
- drivers/net/ethernet/microchip/sparx5/sparx5_main.c
- drivers/net/ethernet/microchip/sparx5/sparx5_main.h
- drivers/net/ethernet/microchip/sparx5/sparx5_netdev.c
- drivers/net/ethernet/microchip/sparx5/sparx5_ptp.c
- drivers/net/ethernet/microchip/sparx5/sparx5_tc_matchall.c
- drivers/net/ethernet/microchip/vcap/vcap_api.c
- drivers/net/ethernet/microsoft/mana/mana_bpf.c
- drivers/net/ethernet/microsoft/mana/mana_en.c
- drivers/net/ethernet/microsoft/mana/mana_ethtool.c
- drivers/net/ethernet/realtek/r8169_main.c
- drivers/net/ethernet/stmicro/stmmac/hwif.h
- drivers/net/ethernet/stmicro/stmmac/stmmac.h
- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
- drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c
- drivers/net/ethernet/stmicro/stmmac/stmmac_vlan.c
- drivers/net/ethernet/xilinx/xilinx_axienet.h
- drivers/net/ethernet/xilinx/xilinx_axienet_main.c
- drivers/net/pcs/pcs-rzn1-miic.c
- drivers/net/pfcp.c
- drivers/net/phy/aquantia/aquantia_main.c
- drivers/net/phy/qcom/at803x.c
- drivers/net/team/team_core.c
- drivers/net/team/team_mode_broadcast.c
- drivers/net/tun.c
- drivers/net/usb/ax88179_178a.c
- drivers/net/usb/qmi_wwan.c
- drivers/net/veth.c
- drivers/net/virtio_net.c
- drivers/net/wireguard/noise.c
- drivers/net/wireguard/queueing.h
- drivers/net/wireless/ath/ath11k/mac.c
- drivers/net/wireless/ath/ath12k/core.c
- drivers/net/wireless/ath/ath12k/core.h
- drivers/net/wireless/ath/ath12k/hif.h
- drivers/net/wireless/ath/ath12k/pci.c
- drivers/net/wireless/ath/ath9k/hif_usb.c
- drivers/net/wireless/ath/ath9k/htc.h
- drivers/net/wireless/ath/ath9k/htc_drv_init.c
- drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
- drivers/net/wireless/ath/ath9k/wmi.c
- drivers/net/wireless/ath/ath9k/wmi.h
- drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
- drivers/net/wireless/intel/iwlegacy/3945-mac.c
- drivers/net/wireless/intersil/p54/fwio.c
- drivers/net/wireless/marvell/libertas/tx.c
- drivers/net/wireless/mediatek/mt76/mt76.h
- drivers/net/wireless/mediatek/mt76/mt7603/init.c
- drivers/net/wireless/mediatek/mt76/mt7915/init.c
- drivers/net/wireless/mediatek/mt76/mt7915/main.c
- drivers/net/wireless/mediatek/mt76/mt7925/mac.c
- drivers/net/wireless/mediatek/mt76/mt7925/main.c
- drivers/net/wireless/mediatek/mt76/mt792x_acpi_sar.c
- drivers/net/wireless/mediatek/mt76/mt792x_acpi_sar.h
- drivers/net/wireless/mediatek/mt76/mt7996/init.c
- drivers/net/wireless/mediatek/mt76/mt7996/main.c
- drivers/net/wireless/mediatek/mt76/mt7996/mcu.h
- drivers/net/wireless/mediatek/mt76/tx.c
- drivers/net/wireless/nxp/nxpwifi/11n.c
- drivers/net/wireless/nxp/nxpwifi/11n_aggr.c
- drivers/net/wireless/nxp/nxpwifi/11n_rxreorder.c
- drivers/net/wireless/nxp/nxpwifi/cfg80211.c
- drivers/net/wireless/nxp/nxpwifi/init.c
- drivers/net/wireless/nxp/nxpwifi/main.c
- drivers/net/wireless/nxp/nxpwifi/uap_event.c
- drivers/net/wireless/nxp/nxpwifi/util.c
- drivers/net/wireless/silabs/wfx/hif_tx.c
- drivers/net/wireless/st/cw1200/bh.c
- drivers/net/wireless/st/cw1200/txrx.c
- drivers/net/wireless/ti/wlcore/main.c
- drivers/net/xen-netfront.c
- drivers/nvme/host/core.c
- drivers/nvme/host/fc.c
- drivers/nvme/host/multipath.c
- drivers/nvme/host/nvme.h
- drivers/nvme/host/pci.c
- drivers/nvme/host/sysfs.c
- drivers/nvme/host/tcp.c
- drivers/nvme/target/configfs.c
- drivers/nvme/target/core.c
- drivers/nvme/target/fabrics-cmd-auth.c
- drivers/nvme/target/nvmet.h
- drivers/nvme/target/pci-epf.c
- drivers/nvme/target/pr.c
- drivers/of/base.c
- drivers/of/irq.c
- drivers/of/overlay.c
- drivers/pci/pci.c
- drivers/pci/pcie/aer.c
- drivers/pinctrl/qcom/pinctrl-hawi.c
- drivers/pinctrl/qcom/pinctrl-ipq5018.c
- drivers/pinctrl/qcom/pinctrl-maili.c
- drivers/pinctrl/qcom/pinctrl-nord.c
- drivers/pinctrl/qcom/pinctrl-qcs8300.c
- drivers/pinctrl/qcom/pinctrl-spmi-gpio.c
- drivers/pmdomain/imx/imx8m-blk-ctrl.c
- drivers/pmdomain/rockchip/pm-domains.c
- drivers/power/sequencing/pwrseq-pcie-m2.c
- drivers/ptp/ptp_ocp.c
- drivers/regulator/ltc3676.c
- drivers/regulator/of_regulator.c
- drivers/regulator/tps6594-regulator.c
- drivers/rtc/dev.c
- drivers/rtc/rtc-ac100.c
- drivers/rtc/rtc-efi.c
- drivers/rtc/rtc-mpfs.c
- drivers/rtc/rtc-spear.c
- drivers/scsi/ch.c
- drivers/scsi/qedi/qedi_main.c
- drivers/spi/spi-cadence-quadspi.c
- drivers/spi/spi-cs42l43.c
- drivers/spi/spi-nxp-fspi.c
- drivers/spi/spi-sg2044-nor.c
- drivers/staging/greybus/uart.c
- drivers/tee/optee/ffa_abi.c
- drivers/tee/optee/optee_msg.h
- drivers/tee/optee/smc_abi.c
- drivers/tee/qcomtee/async.c
- drivers/tee/qcomtee/qcomtee_msg.h
- drivers/tee/qcomtee/qcomtee_object.h
- drivers/tee/tee_shm.c
- drivers/thunderbolt/ctl.c
- drivers/thunderbolt/domain.c
- drivers/thunderbolt/nhi.c
- drivers/thunderbolt/nhi.h
- drivers/thunderbolt/nhi_regs.h
- drivers/thunderbolt/pci.c
- drivers/thunderbolt/quirks.c
- drivers/thunderbolt/stream.c
- drivers/thunderbolt/switch.c
- drivers/thunderbolt/tb.c
- drivers/thunderbolt/test.c
- drivers/thunderbolt/tunnel.c
- drivers/thunderbolt/tunnel.h
- drivers/thunderbolt/xdomain.c
- drivers/tty/amiserial.c
- drivers/tty/n_gsm.c
- drivers/tty/serial/8250/8250_bcm7271.c
- drivers/tty/serial/8250/8250_omap.c
- drivers/tty/serial/8250/8250_port.c
- drivers/tty/serial/amba-pl011.c
- drivers/tty/serial/imx.c
- drivers/tty/serial/kgdboc.c
- drivers/tty/serial/ma35d1_serial.c
- drivers/tty/serial/max3100.c
- drivers/tty/serial/mpc52xx_uart.c
- drivers/tty/serial/qcom_geni_serial.c
- drivers/tty/serial/sc16is7xx.c
- drivers/tty/serial/serial-tegra.c
- drivers/tty/serial/serial_core.c
- drivers/tty/serial/sifive.c
- drivers/tty/serial/vt8500_serial.c
- drivers/tty/tty_io.c
- drivers/tty/tty_port.c
- drivers/tty/vcc.c
- drivers/tty/vt/selection.c
- drivers/tty/vt/vc_screen.c
- drivers/tty/vt/vt.c
- drivers/ufs/core/ufs-mcq.c
- drivers/ufs/core/ufshcd.c
- drivers/ufs/host/ufs-mediatek.c
- drivers/usb/cdns3/cdns3-gadget.c
- drivers/usb/cdns3/cdns3-pci-wrap.c
- drivers/usb/chipidea/ci_hdrc_tegra.c
- drivers/usb/class/cdc-acm.c
- drivers/usb/class/cdc-acm.h
- drivers/usb/core/hub.c
- drivers/usb/core/message.c
- drivers/usb/dwc2/hcd.c
- drivers/usb/dwc3/core.h
- drivers/usb/dwc3/dwc3-am62.c
- drivers/usb/dwc3/ep0.c
- drivers/usb/dwc3/gadget.c
- drivers/usb/gadget/function/f_fs.c
- drivers/usb/gadget/function/f_midi2.c
- drivers/usb/gadget/function/f_uac1_legacy.c
- drivers/usb/gadget/udc/aspeed-vhub/core.c
- drivers/usb/gadget/udc/aspeed-vhub/dev.c
- drivers/usb/gadget/udc/aspeed-vhub/hub.c
- drivers/usb/gadget/udc/aspeed-vhub/vhub.h
- drivers/usb/gadget/udc/dummy_hcd.c
- drivers/usb/host/octeon-hcd.c
- drivers/usb/host/ohci-da8xx.c
- drivers/usb/host/ohci-s3c2410.c
- drivers/usb/host/ohci-spear.c
- drivers/usb/host/ohci-st.c
- drivers/usb/mtu3/mtu3_trace.h
- drivers/usb/serial/bus.c
- drivers/usb/serial/cp210x.c
- drivers/usb/serial/generic.c
- drivers/usb/serial/option.c
- drivers/usb/serial/quatech2.c
- drivers/usb/serial/ssu100.c
- drivers/usb/serial/usb-serial.c
- drivers/usb/serial/xr_serial.c
- drivers/usb/storage/sierra_ms.c
- drivers/usb/typec/anx7411.c
- drivers/usb/typec/port-mapper.c
- drivers/usb/typec/tcpm/tcpm.c
- drivers/usb/typec/tipd/core.c
- drivers/usb/typec/ucsi/displayport.c
- drivers/usb/typec/ucsi/ucsi.c
- drivers/usb/typec/ucsi/ucsi_acpi.c
- drivers/usb/typec/ucsi/ucsi_glink.c
- drivers/virt/nitro_enclaves/ne_misc_dev.c
- drivers/virt/vmgenid.c
- fs/btrfs/inode.c
- fs/btrfs/ioctl.c
- fs/btrfs/scrub.c
- fs/btrfs/transaction.c
- fs/btrfs/xattr.c
- fs/dcache.c
- fs/ext4/super.c
- fs/fcntl.c
- fs/fhandle.c
- fs/file_table.c
- fs/fs_context.c
- fs/mount.h
- fs/namei.c
- fs/namespace.c
- fs/netfs/buffered_read.c
- fs/netfs/buffered_write.c
- fs/netfs/direct_write.c
- fs/netfs/internal.h
- fs/netfs/misc.c
- fs/netfs/read_collect.c
- fs/notify/mark.c
- fs/nullfs.c
- fs/pnode.c
- fs/readdir.c
- fs/smb/client/cifsfs.c
- fs/smb/client/cifsfs.h
- fs/smb/client/cifsglob.h
- fs/smb/client/file.c
- fs/smb/client/inode.c
- fs/smb/client/smb2ops.c
- fs/smb/client/smb2pdu.c
- fs/verity/fsverity_private.h
- fs/verity/open.c
- fs/xfs/libxfs/xfs_exchmaps.c
- fs/xfs/libxfs/xfs_log_format.h
- fs/xfs/xfs_bmap_util.c
- fs/xfs/xfs_exchrange.c
- include/linux/bpf.h
- include/linux/can/core.h
- include/linux/can/skb.h
- include/linux/console.h
- include/linux/cpufreq.h
- include/linux/fs.h
- include/linux/hrtimer_rearm.h
- include/linux/io_uring_types.h
- include/linux/kvm_host.h
- include/linux/mount.h
- include/linux/mtd/nand.h
- include/linux/netdevice.h
- include/linux/netfilter_netdev.h
- include/linux/netfs.h
- include/linux/nsproxy.h
- include/linux/nvme.h
- include/linux/perf_event.h
- include/linux/rtnetlink.h
- include/linux/sched/ext.h
- include/linux/siphash.h
- include/linux/skbuff.h
- include/linux/soc/qcom/geni-se.h
- include/linux/thunderbolt.h
- include/linux/tty.h
- include/linux/tty_driver.h
- include/linux/tty_port.h
- include/linux/usb/serial.h
- include/linux/virtio_net.h
- include/net/amt.h
- include/net/bluetooth/hci_core.h
- include/net/bluetooth/rfcomm.h
- include/net/can.h
- include/net/gso.h
- include/net/ip.h
- include/net/mana/mana.h
- include/net/netfilter/nf_flow_table.h
- include/net/sch_generic.h
- include/net/strparser.h
- include/net/xdp.h
- include/sound/core.h
- include/sound/cs35l56.h
- include/uapi/linux/alloc_tag.h
- include/uapi/linux/random.h
- include/vdso/getrandom.h
- init/Kconfig
- io_uring/bpf_filter.c
- io_uring/cancel.c
- io_uring/cmd_net.c
- io_uring/io_uring.c
- io_uring/kbuf.c
- io_uring/loop.c
- io_uring/memmap.c
- io_uring/memmap.h
- io_uring/net.c
- io_uring/register.c
- io_uring/tw.c
- io_uring/zcrx.c
- kernel/audit_tree.c
- kernel/bpf/core.c
- kernel/bpf/hashtab.c
- kernel/bpf/memalloc.c
- kernel/bpf/syscall.c
- kernel/bpf/trampoline.c
- kernel/bpf/verifier.c
- kernel/cgroup/cpuset.c
- kernel/dma/swiotlb.c
- kernel/events/core.c
- kernel/events/ring_buffer.c
- kernel/fork.c
- kernel/futex/core.c
- kernel/irq/Kconfig
- kernel/irq/Makefile
- kernel/kprobes.c
- kernel/module/main.c
- kernel/nsproxy.c
- kernel/printk/nbcon.c
- kernel/rcu/srcutree.c
- kernel/sched/ext/ext.c
- kernel/sched/ext/inlines.h
- kernel/sched/ext/internal.h
- kernel/sched/ext/sub.c
- kernel/sched/sched.h
- kernel/sysctl.c
- kernel/time/jiffies.c
- kernel/trace/fprobe.c
- kernel/workqueue.c
- lib/Kconfig.debug
- lib/dim/Makefile
- lib/dim/dim.c
- lib/dim/dim_kunit.c
- mm/damon/core.c
- mm/kasan/common.c
modified .mailmap
| @@ -101,7 +101,6 @@ Andy Chiu <andybnac@gmail.com> <andy.chiu@sifive.com> | |||
| 101 | 101 | Andy Chiu <andybnac@gmail.com> <taochiu@synology.com> | |
| 102 | 102 | Andy Shevchenko <andy@kernel.org> <andy@smile.org.ua> | |
| 103 | 103 | Andy Shevchenko <andy@kernel.org> <ext-andriy.shevchenko@nokia.com> | |
| 104 | - | Andy Yan <andyshrk@163.com> <andy.yan@rock-chips.com> | |
| 105 | 104 | Anilkumar Kolli <quic_akolli@quicinc.com> <akolli@codeaurora.org> | |
| 106 | 105 | Anirudh Ghayal <quic_aghayal@quicinc.com> <aghayal@codeaurora.org> | |
| 107 | 106 | Antoine Tenart <atenart@kernel.org> <antoine.tenart@bootlin.com> | |
| @@ -287,8 +286,6 @@ Ed L. Cashin <ecashin@coraid.com> | |||
| 287 | 286 | Elliot Berman <quic_eberman@quicinc.com> <eberman@codeaurora.org> | |
| 288 | 287 | Enric Balletbo i Serra <eballetbo@kernel.org> <enric.balletbo@collabora.com> | |
| 289 | 288 | Enric Balletbo i Serra <eballetbo@kernel.org> <eballetbo@iseebcn.com> | |
| 290 | - | Eric Dumazet <edumazet@kernel.org> <edumazet@google.com> | |
| 291 | - | Eric Dumazet <edumazet@kernel.org> <eric.dumazet@gmail.com> | |
| 292 | 289 | Erik Kaneda <erik.kaneda@intel.com> <erik.schmauss@intel.com> | |
| 293 | 290 | Ethan Carter Edwards <ethan@ethancedwards.com> Ethan Edwards <ethancarteredwards@gmail.com> | |
| 294 | 291 | Eugen Hristev <ehristev@kernel.org> <eugen.hristev@microchip.com> | |
| @@ -462,8 +459,7 @@ Johan Hovold <johan@kernel.org> <jhovold@gmail.com> | |||
| 462 | 459 | Johan Hovold <johan@kernel.org> <johan@hovoldconsulting.com> | |
| 463 | 460 | John Crispin <john@phrozen.org> <blogic@openwrt.org> | |
| 464 | 461 | John Fastabend <john.fastabend@gmail.com> <john.r.fastabend@intel.com> | |
| 465 | - | John Garry <john.garry@linux.dev> <john.garry@huawei.com> | |
| 466 | - | John Garry <john.garry@linux.dev> <john.g.garry@oracle.com> | |
| 462 | + | John Garry <john.g.garry@oracle.com> <john.garry@huawei.com> | |
| 467 | 463 | John Keeping <john@keeping.me.uk> <john@metanate.com> | |
| 468 | 464 | John Moon <john@jmoon.dev> <quic_johmoo@quicinc.com> | |
| 469 | 465 | John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de> | |
| @@ -488,7 +484,6 @@ Juha Yrjola <juha.yrjola@nokia.com> | |||
| 488 | 484 | Juha Yrjola <juha.yrjola@solidboot.com> | |
| 489 | 485 | Julien Thierry <julien.thierry.kdev@gmail.com> <julien.thierry@arm.com> | |
| 490 | 486 | Justin Iurman <justin.iurman@gmail.com> <justin.iurman@uliege.be> | |
| 491 | - | Imre Kaloz <kaloz@kernel.org> <kaloz@openwrt.org> | |
| 492 | 487 | Ira Weiny <iweiny@kernel.org> <ira.weiny@intel.com> | |
| 493 | 488 | Iskren Chernev <me@iskren.info> <iskren.chernev@gmail.com> | |
| 494 | 489 | Kalle Valo <kvalo@kernel.org> <kvalo@codeaurora.org> | |
modified Documentation/admin-guide/ext4.rst
| @@ -172,8 +172,7 @@ When mounting an ext4 filesystem, the following option are accepted: | |||
| 172 | 172 | data=journal | |
| 173 | 173 | All data are committed into the journal prior to being written into the | |
| 174 | 174 | main file system. Enabling this mode will disable delayed allocation | |
| 175 | - | and O_DIRECT support. This feature is deprecated and support | |
| 176 | - | will be removed in January 2028. | |
| 175 | + | and O_DIRECT support. | |
| 177 | 176 | ||
| 178 | 177 | data=ordered (*) | |
| 179 | 178 | All data are forced directly out to the main file system prior to its | |
| @@ -419,8 +418,7 @@ There are 3 different data modes: | |||
| 419 | 418 | consistent state. This mode is the slowest except when data needs to be read | |
| 420 | 419 | from and written to disk at the same time where it outperforms all others | |
| 421 | 420 | modes. Enabling this mode will disable delayed allocation and O_DIRECT | |
| 422 | - | support. The data=journal feature is deprecated and support will be | |
| 423 | - | removed in January 2028. | |
| 421 | + | support. | |
| 424 | 422 | ||
| 425 | 423 | /proc entries | |
| 426 | 424 | ============= | |
modified Documentation/arch/arm64/silicon-errata.rst
| @@ -174,8 +174,6 @@ stable kernels. | |||
| 174 | 174 | +----------------+-----------------+-----------------+-----------------------------+ | |
| 175 | 175 | | ARM | Cortex-A725 | #3456106 | ARM64_ERRATUM_3194386 | | |
| 176 | 176 | +----------------+-----------------+-----------------+-----------------------------+ | |
| 177 | - | | ARM | Cortex-A725 | #3821522 | ARM64_ERRATUM_3821522 | | |
| 178 | - | +----------------+-----------------+-----------------+-----------------------------+ | |
| 179 | 177 | | ARM | Cortex-X1 | #1502854 | N/A | | |
| 180 | 178 | +----------------+-----------------+-----------------+-----------------------------+ | |
| 181 | 179 | | ARM | Cortex-X1 | #3324344 | ARM64_ERRATUM_3194386 | | |
modified Documentation/devicetree/bindings/iio/adc/rockchip-saradc.yaml
| @@ -12,19 +12,19 @@ maintainers: | |||
| 12 | 12 | properties: | |
| 13 | 13 | compatible: | |
| 14 | 14 | oneOf: | |
| 15 | - | - enum: | |
| 16 | - | - rockchip,saradc | |
| 17 | - | - rockchip,rk3066-tsadc | |
| 18 | - | - rockchip,rk3399-saradc | |
| 19 | - | - rockchip,rk3528-saradc | |
| 20 | - | - rockchip,rk3562-saradc | |
| 21 | - | - rockchip,rk3588-saradc | |
| 22 | - | - rockchip,rv1106-saradc | |
| 15 | + | - const: rockchip,saradc | |
| 16 | + | - const: rockchip,rk3066-tsadc | |
| 17 | + | - const: rockchip,rk3399-saradc | |
| 18 | + | - const: rockchip,rk3528-saradc | |
| 23 | 19 | - items: | |
| 24 | 20 | - const: rockchip,rk3506-saradc | |
| 25 | 21 | - const: rockchip,rk3528-saradc | |
| 22 | + | - const: rockchip,rk3562-saradc | |
| 23 | + | - const: rockchip,rk3588-saradc | |
| 26 | 24 | - items: | |
| 27 | - | - const: rockchip,rk3576-saradc | |
| 25 | + | - enum: | |
| 26 | + | - rockchip,rk3576-saradc | |
| 27 | + | - rockchip,rv1106-saradc | |
| 28 | 28 | - const: rockchip,rk3588-saradc | |
| 29 | 29 | - items: | |
| 30 | 30 | - enum: | |
modified Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.yaml
| @@ -77,7 +77,6 @@ properties: | |||
| 77 | 77 | - mscc,ocelot-spi | |
| 78 | 78 | - mscc,jaguar2-spi | |
| 79 | 79 | - sophgo,sg2042-spi | |
| 80 | - | - syna,sl2610-spi | |
| 81 | 80 | - thead,th1520-spi | |
| 82 | 81 | - ultrarisc,dp1000-spi | |
| 83 | 82 | - const: snps,dw-apb-ssi | |
modified Documentation/filesystems/netfs_library.rst
| @@ -451,32 +451,6 @@ one. | |||
| 451 | 451 | The inode should be marked ``NETFS_ICTX_SINGLE_NO_UPLOAD`` if this API is to be | |
| 452 | 452 | used. The writeback function requires the buffer to be of ITER_FOLIOQ type. | |
| 453 | 453 | ||
| 454 | - | Clearing Stale Post-EOF Pagecache | |
| 455 | - | --------------------------------- | |
| 456 | - | ||
| 457 | - | When a file is extended, data left in the pagecache past the old EOF by a write | |
| 458 | - | through an mmap must not be exposed as file content. Netfslib clears this on | |
| 459 | - | its own write paths, and exports a helper so a filesystem can do the same from | |
| 460 | - | a resize path (truncate, setattr, fallocate and the like) that holds the | |
| 461 | - | inode's ``i_rwsem`` exclusively across the whole resize:: | |
| 462 | - | ||
| 463 | - | void netfs_clear_stale_post_isize(struct inode *inode, uoff_t from, | |
| 464 | - | uoff_t to); | |
| 465 | - | ||
| 466 | - | This zeroes any such data within the ``[from, to)`` hole to be made, where | |
| 467 | - | @from is the old EOF and @to is the new one, and the caller must have already | |
| 468 | - | updated ``i_size`` to @to before calling it. Only the folio straddling @from | |
| 469 | - | can hold data written past the EOF through an mmap, as pages wholly beyond the | |
| 470 | - | EOF can't be faulted in, so the zeroing is limited to that folio. The folio is | |
| 471 | - | zeroed rather than dropped so that a concurrent extending write can't lose | |
| 472 | - | data. | |
| 473 | - | ||
| 474 | - | This overlaps with ``pagecache_isize_extended()`` but can't reuse it: that | |
| 475 | - | helper is keyed on a sub-page block size and is a no-op when the block size is | |
| 476 | - | ``>= PAGE_SIZE`` (as on network filesystems), and it doesn't wait for | |
| 477 | - | writeback. As both address the same problem, a change to one should probably | |
| 478 | - | be reflected in the other to keep them in sync. | |
| 479 | - | ||
| 480 | 454 | High-Level VM API | |
| 481 | 455 | ================== | |
| 482 | 456 | ||
modified Documentation/filesystems/propagate_umount.txt
| @@ -32,12 +32,12 @@ of set. They can be reparented to the place where the bottom of | |||
| 32 | 32 | stack is attached to a mount that will survive. NOTE: doing that | |
| 33 | 33 | will violate a constraint on having no more than one mount with | |
| 34 | 34 | the same parent/mountpoint pair; however, the caller (umount_tree()) | |
| 35 | - | will immediately remedy that - it detaches every element of the set | |
| 36 | - | from its parent. Since all conflicts created by reparenting have | |
| 37 | - | common parent *not* in the set and one side of the conflict (bottom | |
| 38 | - | of the stack of overmounts) is in the set, it will be resolved. | |
| 39 | - | However, we rely upon umount_tree() doing that pretty much immediately | |
| 40 | - | after the call of propagate_umount(). | |
| 35 | + | will immediately remedy that - it may keep unmounted element attached | |
| 36 | + | to parent, but only if the parent itself is unmounted. Since all | |
| 37 | + | conflicts created by reparenting have common parent *not* in the | |
| 38 | + | set and one side of the conflict (bottom of the stack of overmounts) | |
| 39 | + | is in the set, it will be resolved. However, we rely upon umount_tree() | |
| 40 | + | doing that pretty much immediately after the call of propagate_umount(). | |
| 41 | 41 | ||
| 42 | 42 | Algorithm is based on two statements: | |
| 43 | 43 | 1) for any set S, there is a maximal non-shifting subset of S | |
modified Documentation/networking/strparser.rst
| @@ -77,7 +77,7 @@ Functions | |||
| 77 | 77 | ||
| 78 | 78 | strp_done is called to release any resources held by the stream | |
| 79 | 79 | parser instance. This must be called after the stream processor | |
| 80 | - | has been stopped. The socket lock must not be held. | |
| 80 | + | has been stopped. | |
| 81 | 81 | ||
| 82 | 82 | :: | |
| 83 | 83 | ||
modified MAINTAINERS
| @@ -3012,7 +3012,7 @@ F: arch/arm/boot/dts/ti/omap/omap3-igep* | |||
| 3012 | 3012 | ||
| 3013 | 3013 | ARM/INTEL IXP4XX ARM ARCHITECTURE | |
| 3014 | 3014 | M: Linus Walleij <linusw@kernel.org> | |
| 3015 | - | M: Imre Kaloz <kaloz@kernel.org> | |
| 3015 | + | M: Imre Kaloz <kaloz@openwrt.org> | |
| 3016 | 3016 | L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) | |
| 3017 | 3017 | S: Maintained | |
| 3018 | 3018 | F: Documentation/devicetree/bindings/arm/intel-ixp4xx.yaml | |
| @@ -5143,7 +5143,6 @@ L: netdev@vger.kernel.org | |||
| 5143 | 5143 | L: openwrt-devel@lists.openwrt.org (subscribers-only) | |
| 5144 | 5144 | S: Supported | |
| 5145 | 5145 | F: Documentation/devicetree/bindings/net/dsa/brcm,b53.yaml | |
| 5146 | - | F: Documentation/networking/dsa/b53.rst | |
| 5147 | 5146 | F: drivers/net/dsa/b53/* | |
| 5148 | 5147 | F: drivers/net/dsa/bcm_sf2* | |
| 5149 | 5148 | F: include/linux/dsa/brcm.h | |
| @@ -9861,7 +9860,7 @@ L: linux-ext4@vger.kernel.org | |||
| 9861 | 9860 | S: Maintained | |
| 9862 | 9861 | W: http://ext4.wiki.kernel.org | |
| 9863 | 9862 | Q: http://patchwork.ozlabs.org/project/linux-ext4/list/ | |
| 9864 | - | T: git git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git dev | |
| 9863 | + | T: git git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git | |
| 9865 | 9864 | F: Documentation/filesystems/ext4/ | |
| 9866 | 9865 | F: fs/ext4/ | |
| 9867 | 9866 | F: include/trace/events/ext4.h | |
| @@ -17210,6 +17209,31 @@ F: include/trace/events/ksm.h | |||
| 17210 | 17209 | F: mm/ksm.c | |
| 17211 | 17210 | F: mm/mm_slot.h | |
| 17212 | 17211 | ||
| 17212 | + | MEMORY MANAGEMENT - MEMORY POLICY AND MIGRATION | |
| 17213 | + | M: Andrew Morton <akpm@linux-foundation.org> | |
| 17214 | + | M: David Hildenbrand <david@kernel.org> | |
| 17215 | + | R: Zi Yan <ziy@nvidia.com> | |
| 17216 | + | R: Matthew Brost <matthew.brost@intel.com> | |
| 17217 | + | R: Joshua Hahn <joshua.hahnjy@gmail.com> | |
| 17218 | + | R: Rakie Kim <rakie.kim@sk.com> | |
| 17219 | + | R: Byungchul Park <byungchul@sk.com> | |
| 17220 | + | R: Gregory Price <gourry@gourry.net> | |
| 17221 | + | R: Ying Huang <ying.huang@linux.alibaba.com> | |
| 17222 | + | R: Alistair Popple <apopple@nvidia.com> | |
| 17223 | + | L: linux-mm@kvack.org | |
| 17224 | + | S: Maintained | |
| 17225 | + | W: http://www.linux-mm.org | |
| 17226 | + | T: git git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm | |
| 17227 | + | F: Documentation/ABI/testing/sysfs-kernel-mm-mempolicy | |
| 17228 | + | F: Documentation/ABI/testing/sysfs-kernel-mm-mempolicy-weighted-interleave | |
| 17229 | + | F: include/linux/mempolicy.h | |
| 17230 | + | F: include/uapi/linux/mempolicy.h | |
| 17231 | + | F: include/linux/migrate.h | |
| 17232 | + | F: include/linux/migrate_mode.h | |
| 17233 | + | F: mm/mempolicy.c | |
| 17234 | + | F: mm/migrate.c | |
| 17235 | + | F: mm/migrate_device.c | |
| 17236 | + | ||
| 17213 | 17237 | MEMORY MANAGEMENT - MGLRU (MULTI-GEN LRU) | |
| 17214 | 17238 | M: Andrew Morton <akpm@linux-foundation.org> | |
| 17215 | 17239 | R: Kairui Song <kasong@tencent.com> | |
| @@ -17232,25 +17256,6 @@ F: include/linux/mmzone.h | |||
| 17232 | 17256 | F: mm/vmscan.c | |
| 17233 | 17257 | F: mm/workingset.c | |
| 17234 | 17258 | ||
| 17235 | - | MEMORY MANAGEMENT - MIGRATION | |
| 17236 | - | M: Andrew Morton <akpm@linux-foundation.org> | |
| 17237 | - | M: David Hildenbrand <david@kernel.org> | |
| 17238 | - | R: Zi Yan <ziy@nvidia.com> | |
| 17239 | - | R: Matthew Brost <matthew.brost@intel.com> | |
| 17240 | - | R: Joshua Hahn <joshua.hahnjy@gmail.com> | |
| 17241 | - | R: Byungchul Park <byungchul@sk.com> | |
| 17242 | - | R: Gregory Price <gourry@gourry.net> | |
| 17243 | - | R: Ying Huang <ying.huang@linux.alibaba.com> | |
| 17244 | - | R: Alistair Popple <apopple@nvidia.com> | |
| 17245 | - | L: linux-mm@kvack.org | |
| 17246 | - | S: Maintained | |
| 17247 | - | W: http://www.linux-mm.org | |
| 17248 | - | T: git git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm | |
| 17249 | - | F: include/linux/migrate.h | |
| 17250 | - | F: include/linux/migrate_mode.h | |
| 17251 | - | F: mm/migrate.c | |
| 17252 | - | F: mm/migrate_device.c | |
| 17253 | - | ||
| 17254 | 17259 | MEMORY MANAGEMENT - MISC | |
| 17255 | 17260 | M: Andrew Morton <akpm@linux-foundation.org> | |
| 17256 | 17261 | M: David Hildenbrand <david@kernel.org> | |
| @@ -17266,6 +17271,7 @@ W: http://www.linux-mm.org | |||
| 17266 | 17271 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm | |
| 17267 | 17272 | F: Documentation/ABI/testing/sysfs-kernel-mm | |
| 17268 | 17273 | F: Documentation/ABI/testing/sysfs-kernel-mm-cma | |
| 17274 | + | F: Documentation/ABI/testing/sysfs-kernel-mm-memory-tiers | |
| 17269 | 17275 | F: Documentation/ABI/testing/sysfs-kernel-mm-numa | |
| 17270 | 17276 | F: Documentation/admin-guide/mm/ | |
| 17271 | 17277 | F: Documentation/mm/ | |
| @@ -17273,6 +17279,7 @@ F: drivers/char/mem.c | |||
| 17273 | 17279 | F: include/linux/cma.h | |
| 17274 | 17280 | F: include/linux/dmapool.h | |
| 17275 | 17281 | F: include/linux/ioremap.h | |
| 17282 | + | F: include/linux/memory-tiers.h | |
| 17276 | 17283 | F: include/linux/page_idle.h | |
| 17277 | 17284 | F: mm/backing-dev.c | |
| 17278 | 17285 | F: mm/cma.c | |
| @@ -17284,6 +17291,7 @@ F: mm/early_ioremap.c | |||
| 17284 | 17291 | F: mm/fadvise.c | |
| 17285 | 17292 | F: mm/ioremap.c | |
| 17286 | 17293 | F: mm/mapping_dirty_helpers.c | |
| 17294 | + | F: mm/memory-tiers.c | |
| 17287 | 17295 | F: mm/page_idle.c | |
| 17288 | 17296 | F: mm/pgalloc-track.h | |
| 17289 | 17297 | F: mm/process_vm_access.c | |
| @@ -17300,27 +17308,6 @@ F: mm/numa.c | |||
| 17300 | 17308 | F: mm/numa_emulation.c | |
| 17301 | 17309 | F: mm/numa_memblks.c | |
| 17302 | 17310 | ||
| 17303 | - | MEMORY MANAGEMENT - NUMA PLACEMENT | |
| 17304 | - | M: Andrew Morton <akpm@linux-foundation.org> | |
| 17305 | - | M: David Hildenbrand <david@kernel.org> | |
| 17306 | - | M: Gregory Price <gourry@gourry.net> | |
| 17307 | - | R: Zi Yan <ziy@nvidia.com> | |
| 17308 | - | R: Joshua Hahn <joshua.hahnjy@gmail.com> | |
| 17309 | - | R: Rakie Kim <rakie.kim@sk.com> | |
| 17310 | - | R: Ying Huang <ying.huang@linux.alibaba.com> | |
| 17311 | - | L: linux-mm@kvack.org | |
| 17312 | - | S: Maintained | |
| 17313 | - | W: http://www.linux-mm.org | |
| 17314 | - | T: git git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm | |
| 17315 | - | F: Documentation/ABI/testing/sysfs-kernel-mm-memory-tiers | |
| 17316 | - | F: Documentation/ABI/testing/sysfs-kernel-mm-mempolicy | |
| 17317 | - | F: Documentation/ABI/testing/sysfs-kernel-mm-mempolicy-weighted-interleave | |
| 17318 | - | F: include/linux/memory-tiers.h | |
| 17319 | - | F: include/linux/mempolicy.h | |
| 17320 | - | F: include/uapi/linux/mempolicy.h | |
| 17321 | - | F: mm/memory-tiers.c | |
| 17322 | - | F: mm/mempolicy.c | |
| 17323 | - | ||
| 17324 | 17311 | MEMORY MANAGEMENT - OOM KILLER | |
| 17325 | 17312 | M: Michal Hocko <mhocko@suse.com> | |
| 17326 | 17313 | R: David Rientjes <rientjes@google.com> | |
| @@ -18898,7 +18885,7 @@ F: net/core/drop_monitor.c | |||
| 18898 | 18885 | NETWORKING DRIVERS | |
| 18899 | 18886 | M: Andrew Lunn <andrew+netdev@lunn.ch> | |
| 18900 | 18887 | M: "David S. Miller" <davem@davemloft.net> | |
| 18901 | - | M: Eric Dumazet <edumazet@kernel.org> | |
| 18888 | + | M: Eric Dumazet <edumazet@google.com> | |
| 18902 | 18889 | M: Jakub Kicinski <kuba@kernel.org> | |
| 18903 | 18890 | M: Paolo Abeni <pabeni@redhat.com> | |
| 18904 | 18891 | L: netdev@vger.kernel.org | |
| @@ -19015,7 +19002,7 @@ K: struct\s+phy_port|phy_port_ | |||
| 19015 | 19002 | ||
| 19016 | 19003 | NETWORKING [GENERAL] | |
| 19017 | 19004 | M: "David S. Miller" <davem@davemloft.net> | |
| 19018 | - | M: Eric Dumazet <edumazet@kernel.org> | |
| 19005 | + | M: Eric Dumazet <edumazet@google.com> | |
| 19019 | 19006 | M: Jakub Kicinski <kuba@kernel.org> | |
| 19020 | 19007 | M: Paolo Abeni <pabeni@redhat.com> | |
| 19021 | 19008 | R: Simon Horman <horms@kernel.org> | |
| @@ -19241,7 +19228,7 @@ F: net/ipv6/seg6* | |||
| 19241 | 19228 | F: tools/testing/selftests/net/srv6* | |
| 19242 | 19229 | ||
| 19243 | 19230 | NETWORKING [TCP] | |
| 19244 | - | M: Eric Dumazet <edumazet@kernel.org> | |
| 19231 | + | M: Eric Dumazet <edumazet@google.com> | |
| 19245 | 19232 | M: Neal Cardwell <ncardwell@google.com> | |
| 19246 | 19233 | R: Kuniyuki Iwashima <kuniyu@google.com> | |
| 19247 | 19234 | L: netdev@vger.kernel.org | |
| @@ -19274,7 +19261,7 @@ F: net/tls/ | |||
| 19274 | 19261 | F: tools/testing/selftests/net/tls.c | |
| 19275 | 19262 | ||
| 19276 | 19263 | NETWORKING [SOCKETS] | |
| 19277 | - | M: Eric Dumazet <edumazet@kernel.org> | |
| 19264 | + | M: Eric Dumazet <edumazet@google.com> | |
| 19278 | 19265 | M: Kuniyuki Iwashima <kuniyu@google.com> | |
| 19279 | 19266 | M: Paolo Abeni <pabeni@redhat.com> | |
| 19280 | 19267 | M: Willem de Bruijn <willemb@google.com> | |
| @@ -20570,7 +20557,6 @@ ORACLE CLUSTER FILESYSTEM 2 (OCFS2) | |||
| 20570 | 20557 | M: Mark Fasheh <mark@fasheh.com> | |
| 20571 | 20558 | M: Joel Becker <jlbec@evilplan.org> | |
| 20572 | 20559 | M: Joseph Qi <joseph.qi@linux.alibaba.com> | |
| 20573 | - | R: Heming Zhao <heming.zhao@suse.com> | |
| 20574 | 20560 | L: ocfs2-devel@lists.linux.dev | |
| 20575 | 20561 | S: Supported | |
| 20576 | 20562 | W: http://ocfs2.wiki.kernel.org | |
| @@ -24489,11 +24475,6 @@ R: Marc Murphy <marc.murphy@sancloud.com> | |||
| 24489 | 24475 | S: Supported | |
| 24490 | 24476 | F: arch/arm/boot/dts/ti/omap/am335x-sancloud* | |
| 24491 | 24477 | ||
| 24492 | - | SB1250-DUART BROADCOM SOC SERIAL DRIVER | |
| 24493 | - | M: "Maciej W. Rozycki" <macro@orcam.me.uk> | |
| 24494 | - | S: Maintained | |
| 24495 | - | F: drivers/tty/serial/sb1250-duart.c | |
| 24496 | - | ||
| 24497 | 24478 | SBOM | |
| 24498 | 24479 | M: Luis Augenstein <luis.augenstein@tngtech.com> | |
| 24499 | 24480 | M: Maximilian Huber <maximilian.huber@tngtech.com> | |
| @@ -25204,7 +25185,7 @@ R: David Rientjes <rientjes@google.com> | |||
| 25204 | 25185 | R: Roman Gushchin <roman.gushchin@linux.dev> | |
| 25205 | 25186 | L: linux-mm@kvack.org | |
| 25206 | 25187 | S: Maintained | |
| 25207 | - | T: git git://git.kernel.org/pub/scm/linux/kernel/git/mm/slab.git | |
| 25188 | + | T: git git://git.kernel.org/pub/scm/linux/kernel/git/vbabka/slab.git | |
| 25208 | 25189 | F: Documentation/admin-guide/mm/slab.rst | |
| 25209 | 25190 | F: Documentation/mm/slab.rst | |
| 25210 | 25191 | F: include/linux/mempool.h | |
modified Makefile
| @@ -2,7 +2,7 @@ | |||
| 2 | 2 | VERSION = 7 | |
| 3 | 3 | PATCHLEVEL = 3 | |
| 4 | 4 | SUBLEVEL = 0 | |
| 5 | - | EXTRAVERSION = -rc7 | |
| 5 | + | EXTRAVERSION = -rc5 | |
| 6 | 6 | NAME = Baby Opossum Posse | |
| 7 | 7 | ||
| 8 | 8 | # *DOCUMENTATION* | |
modified arch/arc/Kconfig
| @@ -331,9 +331,13 @@ config ARC_FPU_SAVE_RESTORE | |||
| 331 | 331 | for floating point exceptions and rounding modes. These are | |
| 332 | 332 | preserved across task context switch when enabled. | |
| 333 | 333 | ||
| 334 | + | config ARC_CANT_LLSC | |
| 335 | + | def_bool n | |
| 336 | + | ||
| 334 | 337 | config ARC_HAS_LLSC | |
| 335 | 338 | bool "Insn: LLOCK/SCOND (efficient atomic ops)" | |
| 336 | 339 | default y | |
| 340 | + | depends on !ARC_CANT_LLSC | |
| 337 | 341 | ||
| 338 | 342 | if ISA_ARCV2 | |
| 339 | 343 | ||
modified arch/arc/include/asm/atomic64-arcv2.h
| @@ -156,12 +156,6 @@ static inline u64 __arch_cmpxchg64_relaxed(volatile void *ptr, u64 old, u64 new) | |||
| 156 | 156 | } | |
| 157 | 157 | #define arch_cmpxchg64_relaxed __arch_cmpxchg64_relaxed | |
| 158 | 158 | ||
| 159 | - | static inline s64 arch_atomic64_cmpxchg_relaxed(atomic64_t *v, s64 old, s64 new) | |
| 160 | - | { | |
| 161 | - | return arch_cmpxchg64_relaxed(&v->counter, old, new); | |
| 162 | - | } | |
| 163 | - | #define arch_atomic64_cmpxchg_relaxed arch_atomic64_cmpxchg_relaxed | |
| 164 | - | ||
| 165 | 159 | static inline s64 arch_atomic64_xchg(atomic64_t *ptr, s64 new) | |
| 166 | 160 | { | |
| 167 | 161 | s64 prev; | |
modified arch/arc/include/asm/cmpxchg.h
| @@ -46,7 +46,7 @@ | |||
| 46 | 46 | __typeof__(*(ptr)) _n_ = (new); \ | |
| 47 | 47 | __typeof__(*(ptr)) _prev_; \ | |
| 48 | 48 | \ | |
| 49 | - | switch (sizeof(*(_p_))) { \ | |
| 49 | + | switch(sizeof((_p_))) { \ | |
| 50 | 50 | case 1: \ | |
| 51 | 51 | _prev_ = (__typeof__(*(ptr)))cmpxchg_emu_u8((volatile u8 *__force)_p_, (uintptr_t)_o_, (uintptr_t)_n_); \ | |
| 52 | 52 | break; \ | |
| @@ -102,7 +102,7 @@ | |||
| 102 | 102 | __typeof__(ptr) _p_ = (ptr); \ | |
| 103 | 103 | __typeof__(*(ptr)) _val_ = (val); \ | |
| 104 | 104 | \ | |
| 105 | - | switch (sizeof(*(_p_))) { \ | |
| 105 | + | switch(sizeof(*(_p_))) { \ | |
| 106 | 106 | case 4: \ | |
| 107 | 107 | _val_ = __arch_xchg(_p_, _val_); \ | |
| 108 | 108 | break; \ | |
modified arch/arc/kernel/setup.c
| @@ -593,7 +593,6 @@ static int show_cpuinfo(struct seq_file *m, void *v) | |||
| 593 | 593 | cpu_id); | |
| 594 | 594 | } else { | |
| 595 | 595 | freq = clk_get_rate(cpu_clk); | |
| 596 | - | clk_put(cpu_clk); | |
| 597 | 596 | } | |
| 598 | 597 | if (freq) | |
| 599 | 598 | seq_printf(m, "CPU speed\t: %lu.%02lu Mhz\n", | |
modified arch/arc/kernel/smp.c
| @@ -12,6 +12,7 @@ | |||
| 12 | 12 | #include <linux/spinlock.h> | |
| 13 | 13 | #include <linux/sched/mm.h> | |
| 14 | 14 | #include <linux/interrupt.h> | |
| 15 | + | #include <linux/profile.h> | |
| 15 | 16 | #include <linux/mm.h> | |
| 16 | 17 | #include <linux/cpu.h> | |
| 17 | 18 | #include <linux/irq.h> | |
modified arch/arm64/Kconfig
| @@ -1040,17 +1040,9 @@ config ARM64_ERRATUM_1902691 | |||
| 1040 | 1040 | ||
| 1041 | 1041 | If unsure, say Y. | |
| 1042 | 1042 | ||
| 1043 | - | config ARM64_WORKAROUND_BROKEN_AMU_CONSTCNT | |
| 1044 | - | bool | |
| 1045 | - | # Targeting errata affecting AMEVCNTR01, the AMU constant counter. | |
| 1046 | - | # On affected CPUs the counter may not increment at the expected rate, | |
| 1047 | - | # making it unreliable. As a result, AMU users should treat it as | |
| 1048 | - | # unavailable rather than relying on misleading counter values. | |
| 1049 | - | ||
| 1050 | 1043 | config ARM64_ERRATUM_2457168 | |
| 1051 | 1044 | bool "Cortex-A510: 2457168: workaround for AMEVCNTR01 incrementing incorrectly" | |
| 1052 | 1045 | depends on ARM64_AMU_EXTN | |
| 1053 | - | select ARM64_WORKAROUND_BROKEN_AMU_CONSTCNT | |
| 1054 | 1046 | default y | |
| 1055 | 1047 | help | |
| 1056 | 1048 | This option adds the workaround for ARM Cortex-A510 erratum 2457168. | |
| @@ -1081,28 +1073,6 @@ config ARM64_ERRATUM_2645198 | |||
| 1081 | 1073 | ||
| 1082 | 1074 | If unsure, say Y. | |
| 1083 | 1075 | ||
| 1084 | - | config ARM64_ERRATUM_3821522 | |
| 1085 | - | bool "Cortex-A725: 3821522: workaround for possible CNT_CYCLES increment error due to WFE/WFI" | |
| 1086 | - | depends on ARM64_AMU_EXTN | |
| 1087 | - | select ARM64_WORKAROUND_BROKEN_AMU_CONSTCNT | |
| 1088 | - | default y | |
| 1089 | - | help | |
| 1090 | - | This option adds the workaround for ARM Cortex-A725 erratum 3821522. | |
| 1091 | - | ||
| 1092 | - | On affected A725 cores, the CNT_CYCLES event may incur a significant | |
| 1093 | - | increment error when entering and subsequently exiting WFx. | |
| 1094 | - | As a result, the CNT_CYCLES may diverge from the system counter | |
| 1095 | - | frequency at which it is expected to increment. | |
| 1096 | - | This renders the AMU counter AMEVCNTR01, that implements CNT_CYCLES, | |
| 1097 | - | being unreliable and unsuitable for use. | |
| 1098 | - | ||
| 1099 | - | Since there is no hardware workaround, reads of the affected CNT_CYCLES | |
| 1100 | - | counter return 0 in the relevant paths. This causes users of the counter | |
| 1101 | - | to treat it as unavailable and is functionally equivalent to firmware | |
| 1102 | - | disabling the affected counter. | |
| 1103 | - | ||
| 1104 | - | If unsure, say Y. | |
| 1105 | - | ||
| 1106 | 1076 | config ARM64_WORKAROUND_SPECULATIVE_UNPRIV_LOAD | |
| 1107 | 1077 | bool | |
| 1108 | 1078 | ||
modified arch/arm64/boot/dts/freescale/fsl-lx216x.dtsi
| @@ -1602,7 +1602,7 @@ | |||
| 1602 | 1602 | }; | |
| 1603 | 1603 | ||
| 1604 | 1604 | dspi2_miso_mosi_pins: iic5-spi3-pins { | |
| 1605 | - | pinctrl-single,bits = <0x0 (0x3 << 9) (0x7 << 9)>; | |
| 1605 | + | pinctrl-single,bits = <0x3 (0x2 << 9) (0x7 << 9)>; | |
| 1606 | 1606 | }; | |
| 1607 | 1607 | ||
| 1608 | 1608 | i2c5_pins: iic6-i2c-pins { | |
| @@ -1622,7 +1622,7 @@ | |||
| 1622 | 1622 | }; | |
| 1623 | 1623 | ||
| 1624 | 1624 | gpio1_31_28_pins: xspi1-data74-gpio-pins { | |
| 1625 | - | pinctrl-single,bits = <0x0 (0x1 << 15) (0x7 << 15)>; | |
| 1625 | + | pinctrl-single,bits = <0x0 0x1 (0x7 << 15)>; | |
| 1626 | 1626 | }; | |
| 1627 | 1627 | ||
| 1628 | 1628 | fspi_data30_pins: xspi1-data30-pins { | |
| @@ -1630,7 +1630,7 @@ | |||
| 1630 | 1630 | }; | |
| 1631 | 1631 | ||
| 1632 | 1632 | gpio1_27_24_pins: xspi1-data30-gpio-pins { | |
| 1633 | - | pinctrl-single,bits = <0x0 (0x1 << 18) (0x7 << 18)>; | |
| 1633 | + | pinctrl-single,bits = <0x0 0x1 (0x7 << 18)>; | |
| 1634 | 1634 | }; | |
| 1635 | 1635 | ||
| 1636 | 1636 | fspi_dqs_sck_cs10_pins: xspi1-base-pins { | |
| @@ -1638,7 +1638,7 @@ | |||
| 1638 | 1638 | }; | |
| 1639 | 1639 | ||
| 1640 | 1640 | gpio1_23_20_pins: xspi1-base-gpio-pins { | |
| 1641 | - | pinctrl-single,bits = <0x0 (0x1 << 21) (0x7 << 21)>; | |
| 1641 | + | pinctrl-single,bits = <0x0 0x1 (0x7 << 21)>; | |
| 1642 | 1642 | }; | |
| 1643 | 1643 | ||
| 1644 | 1644 | esdhc0_cmd_data30_clk_vsel_pins: sdhc1-base-sdhc-vsel-pins { | |
| @@ -1687,19 +1687,12 @@ | |||
| 1687 | 1687 | }; | |
| 1688 | 1688 | ||
| 1689 | 1689 | /* RCWSR14 */ | |
| 1690 | - | /* | |
| 1691 | - | * IIC1_PMUX is a single bit at RCWSR14[10], but bit-per-mux | |
| 1692 | - | * uses the mask for the field to clear before applying the | |
| 1693 | - | * value. | |
| 1694 | - | * So bits 11 and 12, which are reserved, are written as 0 | |
| 1695 | - | * on every mux switch, it is harmless. | |
| 1696 | - | */ | |
| 1697 | 1690 | i2c0_pins: iic1-i2c-pins { | |
| 1698 | - | pinctrl-single,bits = <0x8 0x0 (0x7 << 10)>; | |
| 1691 | + | pinctrl-single,bits = <0x8 0x0 (0x1 << 10)>; | |
| 1699 | 1692 | }; | |
| 1700 | 1693 | ||
| 1701 | 1694 | gpio0_3_2_pins: iic1-gpio-pins { | |
| 1702 | - | pinctrl-single,bits = <0x8 (0x1 << 10) (0x7 << 10)>; | |
| 1695 | + | pinctrl-single,bits = <0x8 (0x1 << 10) (0x1 << 10)>; | |
| 1703 | 1696 | }; | |
| 1704 | 1697 | }; | |
| 1705 | 1698 | ||
modified arch/arm64/boot/dts/freescale/imx8mp-var-dart-sonata.dts
| @@ -511,7 +511,6 @@ | |||
| 511 | 511 | pinctrl-2 = <&pinctrl_usdhc2_200mhz>, <&pinctrl_usdhc2_gpio>; | |
| 512 | 512 | cd-gpios = <&gpio2 12 GPIO_ACTIVE_LOW>; | |
| 513 | 513 | vmmc-supply = <®_usdhc2_vmmc>; | |
| 514 | - | vqmmc-supply = <&ldo5>; | |
| 515 | 514 | bus-width = <4>; | |
| 516 | 515 | status = "okay"; | |
| 517 | 516 | }; | |
modified arch/arm64/boot/dts/qcom/x1-microsoft-denali.dtsi
| @@ -863,11 +863,11 @@ | |||
| 863 | 863 | }; | |
| 864 | 864 | ||
| 865 | 865 | &lpass_vamacro { | |
| 866 | - | pinctrl-0 = <&dmic01_default>; | |
| 866 | + | pinctrl-0 = <&dmic01_default>, <&dmic23_default>; | |
| 867 | 867 | pinctrl-names = "default"; | |
| 868 | 868 | ||
| 869 | 869 | vdd-micb-supply = <&vreg_l1b_1p8>; | |
| 870 | - | qcom,dmic-sample-rate = <2400000>; | |
| 870 | + | qcom,dmic-sample-rate = <4800000>; | |
| 871 | 871 | }; | |
| 872 | 872 | ||
| 873 | 873 | &mdss { | |
modified arch/arm64/include/asm/el2_setup.h
| @@ -421,9 +421,8 @@ | |||
| 421 | 421 | mov x2, xzr | |
| 422 | 422 | mrs x1, id_aa64dfr0_el1 | |
| 423 | 423 | ubfx x1, x1, #ID_AA64DFR0_EL1_PMUVer_SHIFT, #4 | |
| 424 | - | cmp x1, #ID_AA64DFR0_EL1_PMUVer_IMP_DEF | |
| 425 | - | ccmp x1, #ID_AA64DFR0_EL1_PMUVer_V3P9, #8, ne | |
| 426 | - | b.lt .Lskip_pmuv3p9_\@ // Skip if < PMUv3p9 or IMP_DEF | |
| 424 | + | cmp x1, #ID_AA64DFR0_EL1_PMUVer_V3P9 | |
| 425 | + | b.lt .Lskip_pmuv3p9_\@ | |
| 427 | 426 | ||
| 428 | 427 | orr x0, x0, #HDFGRTR2_EL2_nPMICNTR_EL0 | |
| 429 | 428 | orr x0, x0, #HDFGRTR2_EL2_nPMICFILTR_EL0 | |
modified arch/arm64/kernel/Makefile
| @@ -25,9 +25,6 @@ KASAN_SANITIZE_stacktrace.o := n | |||
| 25 | 25 | KCOV_INSTRUMENT_entry-common.o := n | |
| 26 | 26 | KCOV_INSTRUMENT_idle.o := n | |
| 27 | 27 | ||
| 28 | - | # Softirq stack switching can run outside interrupt context. | |
| 29 | - | KCOV_INSTRUMENT_irq.o := n | |
| 30 | - | ||
| 31 | 28 | # Object file lists. | |
| 32 | 29 | obj-y := debug-monitors.o entry.o irq.o fpsimd.o \ | |
| 33 | 30 | entry-common.o process.o ptrace.o \ | |
modified arch/arm64/kernel/cpu_errata.c
| @@ -384,20 +384,6 @@ static const struct arm64_cpu_capabilities arm64_repeat_tlbi_list[] = { | |||
| 384 | 384 | }; | |
| 385 | 385 | #endif | |
| 386 | 386 | ||
| 387 | - | #ifdef CONFIG_ARM64_WORKAROUND_BROKEN_AMU_CONSTCNT | |
| 388 | - | static const struct midr_range workaround_amu_constcnt_list[] = { | |
| 389 | - | #ifdef CONFIG_ARM64_ERRATUM_2457168 | |
| 390 | - | /* Cortex-A510 r0p0-r1p1 */ | |
| 391 | - | MIDR_RANGE(MIDR_CORTEX_A510, 0, 0, 1, 1), | |
| 392 | - | #endif | |
| 393 | - | #ifdef CONFIG_ARM64_ERRATUM_3821522 | |
| 394 | - | /* Cortex-A725 r0p0 - r0p2 */ | |
| 395 | - | MIDR_RANGE(MIDR_CORTEX_A725, 0, 0, 0, 2), | |
| 396 | - | #endif | |
| 397 | - | {} | |
| 398 | - | }; | |
| 399 | - | #endif /* CONFIG_ARM64_WORKAROUND_BROKEN_AMU_CONSTCNT */ | |
| 400 | - | ||
| 401 | 387 | #ifdef CONFIG_CAVIUM_ERRATUM_23154 | |
| 402 | 388 | static const struct midr_range cavium_erratum_23154_cpus[] = { | |
| 403 | 389 | MIDR_ALL_VERSIONS(MIDR_THUNDERX), | |
| @@ -933,12 +919,14 @@ const struct arm64_cpu_capabilities arm64_errata[] = { | |||
| 933 | 919 | ERRATA_MIDR_REV_RANGE(MIDR_CORTEX_A510, 0, 0, 2) | |
| 934 | 920 | }, | |
| 935 | 921 | #endif | |
| 936 | - | #ifdef CONFIG_ARM64_WORKAROUND_BROKEN_AMU_CONSTCNT | |
| 922 | + | #ifdef CONFIG_ARM64_ERRATUM_2457168 | |
| 937 | 923 | { | |
| 938 | - | .desc = "Broken AMU AMEVCNTR01 (const counter)", | |
| 939 | - | .capability = ARM64_WORKAROUND_BROKEN_AMU_CONSTCNT, | |
| 924 | + | .desc = "ARM erratum 2457168", | |
| 925 | + | .capability = ARM64_WORKAROUND_2457168, | |
| 940 | 926 | .type = ARM64_CPUCAP_WEAK_LOCAL_CPU_FEATURE, | |
| 941 | - | CAP_MIDR_RANGE_LIST(workaround_amu_constcnt_list) | |
| 927 | + | ||
| 928 | + | /* Cortex-A510 r0p0-r1p1 */ | |
| 929 | + | CAP_MIDR_RANGE(MIDR_CORTEX_A510, 0, 0, 1, 1) | |
| 942 | 930 | }, | |
| 943 | 931 | #endif | |
| 944 | 932 | #ifdef CONFIG_ARM64_ERRATUM_2038923 | |
modified arch/arm64/kernel/cpufeature.c
| @@ -2089,7 +2089,7 @@ static void cpu_amu_enable(struct arm64_cpu_capabilities const *cap) | |||
| 2089 | 2089 | cpumask_set_cpu(smp_processor_id(), &amu_cpus); | |
| 2090 | 2090 | ||
| 2091 | 2091 | /* 0 reference values signal broken/disabled counters */ | |
| 2092 | - | if (!this_cpu_has_cap(ARM64_WORKAROUND_BROKEN_AMU_CONSTCNT)) | |
| 2092 | + | if (!this_cpu_has_cap(ARM64_WORKAROUND_2457168)) | |
| 2093 | 2093 | update_freq_counters_refs(); | |
| 2094 | 2094 | } | |
| 2095 | 2095 | } | |
modified arch/arm64/kernel/signal.c
| @@ -433,7 +433,6 @@ static int restore_sve_fpsimd_context(struct user_ctxs *user) | |||
| 433 | 433 | unsigned int vl, vq; | |
| 434 | 434 | struct user_fpsimd_state fpsimd; | |
| 435 | 435 | u16 user_vl, flags; | |
| 436 | - | bool fpsimd_only; | |
| 437 | 436 | bool sm; | |
| 438 | 437 | ||
| 439 | 438 | if (user->sve_size < sizeof(*user->sve)) | |
| @@ -444,33 +443,19 @@ static int restore_sve_fpsimd_context(struct user_ctxs *user) | |||
| 444 | 443 | if (err) | |
| 445 | 444 | return err; | |
| 446 | 445 | ||
| 447 | - | fpsimd_only = (user->sve_size == sizeof(*user->sve)); | |
| 448 | 446 | sm = flags & SVE_SIG_FLAG_SM; | |
| 449 | - | ||
| 450 | 447 | if (sm) { | |
| 451 | 448 | if (!system_supports_sme()) | |
| 452 | 449 | return -EINVAL; | |
| 453 | 450 | ||
| 454 | - | /* | |
| 455 | - | * Streaming SVE state is always preserved with an SVE payload. | |
| 456 | - | * Only accept streaming state which has an SVE payload. | |
| 457 | - | */ | |
| 458 | - | if (fpsimd_only) | |
| 459 | - | return -EINVAL; | |
| 460 | - | ||
| 461 | 451 | vl = task_get_sme_vl(current); | |
| 462 | 452 | } else { | |
| 463 | 453 | /* | |
| 464 | - | * Non-streaming SVE state may be preserved without an SVE | |
| 465 | - | * payload, in which case all state is saved in the FPSIMD | |
| 466 | - | * context. | |
| 467 | - | * | |
| 468 | - | * On SME-only systems, non-streaming (FPSIMD-only) state is | |
| 469 | - | * always preserved without an SVE payload, and with VL==0. On | |
| 470 | - | * such systems, only accept non-streaming state without an SVE | |
| 471 | - | * payload. | |
| 454 | + | * A SME only system use SVE for streaming mode so can | |
| 455 | + | * have a SVE formatted context with a zero VL and no | |
| 456 | + | * payload data. | |
| 472 | 457 | */ | |
| 473 | - | if (!system_supports_sve() && !fpsimd_only) | |
| 458 | + | if (!system_supports_sve() && !system_supports_sme()) | |
| 474 | 459 | return -EINVAL; | |
| 475 | 460 | ||
| 476 | 461 | vl = task_get_sve_vl(current); | |
| @@ -479,7 +464,16 @@ static int restore_sve_fpsimd_context(struct user_ctxs *user) | |||
| 479 | 464 | if (user_vl != vl) | |
| 480 | 465 | return -EINVAL; | |
| 481 | 466 | ||
| 482 | - | if (fpsimd_only) | |
| 467 | + | /* | |
| 468 | + | * Non-streaming SVE state may be preserved without an SVE payload, in | |
| 469 | + | * which case the SVE context only has a header with VL==0, and all | |
| 470 | + | * state can be restored from the FPSIMD context. | |
| 471 | + | * | |
| 472 | + | * Streaming SVE state is always preserved with an SVE payload. For | |
| 473 | + | * consistency and robustness, reject restoring streaming SVE state | |
| 474 | + | * without an SVE payload. | |
| 475 | + | */ | |
| 476 | + | if (!sm && user->sve_size == sizeof(*user->sve)) | |
| 483 | 477 | return restore_fpsimd_context(user); | |
| 484 | 478 | ||
| 485 | 479 | vq = sve_vq_from_vl(vl); | |
modified arch/arm64/kernel/topology.c
| @@ -186,6 +186,7 @@ int arch_freq_get_on_cpu(int cpu) | |||
| 186 | 186 | struct amu_cntr_sample *amu_sample; | |
| 187 | 187 | unsigned int start_cpu = cpu; | |
| 188 | 188 | unsigned long last_update; | |
| 189 | + | unsigned int freq = 0; | |
| 189 | 190 | u64 scale; | |
| 190 | 191 | ||
| 191 | 192 | if (!amu_fie_cpu_supported(cpu) || !arch_scale_freq_ref(cpu)) | |
| @@ -244,8 +245,9 @@ int arch_freq_get_on_cpu(int cpu) | |||
| 244 | 245 | * (see amu_scale_freq_tick for details) | |
| 245 | 246 | */ | |
| 246 | 247 | scale = arch_scale_freq_capacity(cpu); | |
| 247 | - | ||
| 248 | - | return (scale * arch_scale_freq_ref(cpu)) >> SCHED_CAPACITY_SHIFT; | |
| 248 | + | freq = scale * arch_scale_freq_ref(cpu); | |
| 249 | + | freq >>= SCHED_CAPACITY_SHIFT; | |
| 250 | + | return freq; | |
| 249 | 251 | } | |
| 250 | 252 | ||
| 251 | 253 | static void amu_fie_setup(const struct cpumask *cpus) | |
| @@ -395,13 +397,12 @@ static void cpu_read_corecnt(void *val) | |||
| 395 | 397 | static void cpu_read_constcnt(void *val) | |
| 396 | 398 | { | |
| 397 | 399 | /* | |
| 398 | - | * Return 0 if the current CPU is affected by a HW erratum. | |
| 399 | - | * A value of 0 is also returned if the current CPU does not | |
| 400 | - | * support AMUs or if the counter is disabled. A return | |
| 401 | - | * value of 0 at counter read is properly handled as an error | |
| 402 | - | * case by the users of the counter. | |
| 400 | + | * Return 0 if the current CPU is affected by erratum 2457168. A value | |
| 401 | + | * of 0 is also returned if the current CPU does not support AMUs or if | |
| 402 | + | * the counter is disabled. A return value of 0 at counter read is | |
| 403 | + | * properly handled as an error case by the users of the counter. | |
| 403 | 404 | */ | |
| 404 | - | *(u64 *)val = this_cpu_has_cap(ARM64_WORKAROUND_BROKEN_AMU_CONSTCNT) ? | |
| 405 | + | *(u64 *)val = this_cpu_has_cap(ARM64_WORKAROUND_2457168) ? | |
| 405 | 406 | 0UL : read_constcnt(); | |
| 406 | 407 | } | |
| 407 | 408 | ||
| @@ -462,9 +463,8 @@ static void amu_read_core_const_ctrs(void *val) | |||
| 462 | 463 | ||
| 463 | 464 | /* | |
| 464 | 465 | * cpu_read_constcnt() incurs slight latency due to the | |
| 465 | - | * ARM64_WORKAROUND_BROKEN_AMU_CONSTCNT check. | |
| 466 | - | * Read it first to minimize the sampling skew between the const | |
| 467 | - | * and core counters. | |
| 466 | + | * ARM64_WORKAROUND_2457168 check. Read it first to minimize | |
| 467 | + | * the sampling skew between the const and core counters. | |
| 468 | 468 | */ | |
| 469 | 469 | cpu_read_constcnt(&ctrs->constcnt); | |
| 470 | 470 | cpu_read_corecnt(&ctrs->corecnt); | |
modified arch/arm64/kernel/vdso/Makefile
| @@ -41,7 +41,7 @@ CC_FLAGS_REMOVE_VDSO := $(CC_FLAGS_FTRACE) -Os $(CC_FLAGS_SCS) \ | |||
| 41 | 41 | $(CC_FLAGS_LTO) $(CC_FLAGS_CFI) \ | |
| 42 | 42 | -Wmissing-prototypes -Wmissing-declarations | |
| 43 | 43 | ||
| 44 | - | CC_FLAGS_ADD_VDSO := -O2 -mcmodel=tiny -fasynchronous-unwind-tables $(CONFIG_CC_OPT_INLINE_MEMSET) | |
| 44 | + | CC_FLAGS_ADD_VDSO := -O2 -mcmodel=tiny -fasynchronous-unwind-tables | |
| 45 | 45 | ||
| 46 | 46 | CFLAGS_REMOVE_vgettimeofday.o = $(CC_FLAGS_REMOVE_VDSO) | |
| 47 | 47 | CFLAGS_REMOVE_vgetrandom.o = $(CC_FLAGS_REMOVE_VDSO) | |
modified arch/arm64/kvm/emulate-nested.c
| @@ -2386,6 +2386,9 @@ int __init populate_nv_trap_config(void) | |||
| 2386 | 2386 | print_nv_trap_error(fgt, "FGT bit is reserved", ret); | |
| 2387 | 2387 | } | |
| 2388 | 2388 | ||
| 2389 | + | if (!cpus_have_final_cap(ARM64_HAS_FGT)) | |
| 2390 | + | continue; | |
| 2391 | + | ||
| 2389 | 2392 | prev = xa_store(&sr_forward_xa, enc, | |
| 2390 | 2393 | xa_mk_value(tc.val), GFP_KERNEL); | |
| 2391 | 2394 | ||
modified arch/arm64/kvm/hyp/include/nvhe/pkvm.h
| @@ -12,15 +12,6 @@ | |||
| 12 | 12 | #include <nvhe/gfp.h> | |
| 13 | 13 | #include <nvhe/spinlock.h> | |
| 14 | 14 | ||
| 15 | - | /* | |
| 16 | - | * HCR_EL2 bits EL2 takes from the host on each entry, per VM type. The rest | |
| 17 | - | * are EL2's own and nothing the host sets there reaches the guest. | |
| 18 | - | */ | |
| 19 | - | #define PKVM_HCR_EL2_HOST_PVM (HCR_EL2_TWI | HCR_EL2_TWE | HCR_EL2_VSE) | |
| 20 | - | #define PKVM_HCR_EL2_HOST_NPVM (PKVM_HCR_EL2_HOST_PVM | HCR_EL2_VI | HCR_EL2_VF | \ | |
| 21 | - | HCR_EL2_TVM | HCR_EL2_TID2 | HCR_EL2_TID4 | \ | |
| 22 | - | HCR_EL2_TID5 | HCR_EL2_TTLBOS) | |
| 23 | - | ||
| 24 | 15 | /* | |
| 25 | 16 | * Holds the relevant data for maintaining the vcpu state completely at hyp. | |
| 26 | 17 | */ | |
modified arch/arm64/kvm/hyp/nvhe/hyp-main.c
| @@ -216,7 +216,6 @@ static void sync_debug_state(struct pkvm_hyp_vcpu *hyp_vcpu) | |||
| 216 | 216 | static void flush_hyp_vcpu(struct pkvm_hyp_vcpu *hyp_vcpu) | |
| 217 | 217 | { | |
| 218 | 218 | struct kvm_vcpu *host_vcpu = hyp_vcpu->host_vcpu; | |
| 219 | - | u64 host_hcr_mask = PKVM_HCR_EL2_HOST_PVM; | |
| 220 | 219 | ||
| 221 | 220 | fpsimd_sve_flush(); | |
| 222 | 221 | flush_debug_state(hyp_vcpu); | |
| @@ -229,7 +228,6 @@ static void flush_hyp_vcpu(struct pkvm_hyp_vcpu *hyp_vcpu) | |||
| 229 | 228 | if (!pkvm_hyp_vcpu_is_protected(hyp_vcpu)) { | |
| 230 | 229 | if (vcpu_get_flag(host_vcpu, PKVM_HOST_STATE_DIRTY)) | |
| 231 | 230 | flush_hyp_vcpu_state(hyp_vcpu); | |
| 232 | - | host_hcr_mask = PKVM_HCR_EL2_HOST_NPVM; | |
| 233 | 231 | } else { | |
| 234 | 232 | hyp_vcpu->vcpu.arch.ctxt = host_vcpu->arch.ctxt; | |
| 235 | 233 | } | |
| @@ -243,8 +241,9 @@ static void flush_hyp_vcpu(struct pkvm_hyp_vcpu *hyp_vcpu) | |||
| 243 | 241 | * trap-control bit, so it must flow to the hyp vCPU alongside TWI/TWE | |
| 244 | 242 | * for the vSError to be delivered. sync_hyp_vcpu() reflects it back. | |
| 245 | 243 | */ | |
| 246 | - | hyp_vcpu->vcpu.arch.hcr_el2 &= ~host_hcr_mask; | |
| 247 | - | hyp_vcpu->vcpu.arch.hcr_el2 |= READ_ONCE(host_vcpu->arch.hcr_el2) & host_hcr_mask; | |
| 244 | + | hyp_vcpu->vcpu.arch.hcr_el2 &= ~(HCR_TWI | HCR_TWE | HCR_VSE); | |
| 245 | + | hyp_vcpu->vcpu.arch.hcr_el2 |= READ_ONCE(host_vcpu->arch.hcr_el2) & | |
| 246 | + | (HCR_TWI | HCR_TWE | HCR_VSE); | |
| 248 | 247 | ||
| 249 | 248 | hyp_vcpu->vcpu.arch.iflags = host_vcpu->arch.iflags; | |
| 250 | 249 | ||
modified arch/arm64/kvm/hyp/nvhe/pkvm.c
| @@ -30,7 +30,6 @@ unsigned int kvm_host_sve_max_vl; | |||
| 30 | 30 | */ | |
| 31 | 31 | static DEFINE_PER_CPU(struct pkvm_hyp_vcpu *, loaded_hyp_vcpu); | |
| 32 | 32 | ||
| 33 | - | /* The PKVM_HCR_EL2_HOST_{PVM,NPVM} bits of this value come from the host on each entry. */ | |
| 34 | 33 | static void pkvm_vcpu_reset_hcr(struct kvm_vcpu *vcpu) | |
| 35 | 34 | { | |
| 36 | 35 | vcpu->arch.hcr_el2 = HCR_GUEST_FLAGS; | |
| @@ -48,17 +47,18 @@ static void pkvm_vcpu_reset_hcr(struct kvm_vcpu *vcpu) | |||
| 48 | 47 | if (cpus_have_final_cap(ARM64_HAS_STAGE2_FWB)) | |
| 49 | 48 | vcpu->arch.hcr_el2 |= HCR_FWB; | |
| 50 | 49 | ||
| 51 | - | /* | |
| 52 | - | * Without AArch32 EL1, leave RW set and let the entry fail with an | |
| 53 | - | * illegal exception return: the *32_EL2 registers EL2 would otherwise | |
| 54 | - | * switch are UNDEFINED there. | |
| 55 | - | */ | |
| 56 | - | if (vcpu_has_feature(vcpu, KVM_ARM_VCPU_EL1_32BIT) && | |
| 57 | - | cpus_have_final_cap(ARM64_HAS_32BIT_EL1)) | |
| 58 | - | vcpu->arch.hcr_el2 &= ~HCR_EL2_RW; | |
| 50 | + | if (cpus_have_final_cap(ARM64_HAS_EVT) && | |
| 51 | + | !cpus_have_final_cap(ARM64_MISMATCHED_CACHE_TYPE) && | |
| 52 | + | kvm_read_vm_id_reg(vcpu->kvm, SYS_CTR_EL0) == read_cpuid(CTR_EL0)) | |
| 53 | + | vcpu->arch.hcr_el2 |= HCR_TID4; | |
| 54 | + | else | |
| 55 | + | vcpu->arch.hcr_el2 |= HCR_TID2; | |
| 59 | 56 | ||
| 60 | 57 | if (vcpu_has_ptrauth(vcpu)) | |
| 61 | 58 | vcpu->arch.hcr_el2 |= (HCR_API | HCR_APK); | |
| 59 | + | ||
| 60 | + | if (kvm_has_mte(vcpu->kvm)) | |
| 61 | + | vcpu->arch.hcr_el2 |= HCR_ATA; | |
| 62 | 62 | } | |
| 63 | 63 | ||
| 64 | 64 | static void pvm_init_traps_hcr(struct kvm_vcpu *vcpu) | |
| @@ -76,13 +76,6 @@ static void pvm_init_traps_hcr(struct kvm_vcpu *vcpu) | |||
| 76 | 76 | */ | |
| 77 | 77 | val |= HCR_TACR | HCR_TIDCP | HCR_TID3 | HCR_TID1; | |
| 78 | 78 | ||
| 79 | - | if (cpus_have_final_cap(ARM64_HAS_EVT) && | |
| 80 | - | !cpus_have_final_cap(ARM64_MISMATCHED_CACHE_TYPE) && | |
| 81 | - | kvm_read_vm_id_reg(kvm, SYS_CTR_EL0) == read_cpuid(CTR_EL0)) | |
| 82 | - | val |= HCR_EL2_TID4; | |
| 83 | - | else | |
| 84 | - | val |= HCR_EL2_TID2; | |
| 85 | - | ||
| 86 | 79 | if (!kvm_has_feat(kvm, ID_AA64PFR0_EL1, RAS, IMP)) { | |
| 87 | 80 | val |= HCR_TERR | HCR_TEA; | |
| 88 | 81 | val &= ~(HCR_FIEN); | |
modified arch/arm64/kvm/mmu.c
| @@ -1468,11 +1468,32 @@ transparent_hugepage_adjust(struct kvm *kvm, struct kvm_memory_slot *memslot, | |||
| 1468 | 1468 | return PAGE_SIZE; | |
| 1469 | 1469 | } | |
| 1470 | 1470 | ||
| 1471 | - | static int get_vma_page_shift(struct vm_area_struct *vma) | |
| 1471 | + | static int get_vma_page_shift(struct vm_area_struct *vma, unsigned long hva) | |
| 1472 | 1472 | { | |
| 1473 | - | if (is_vm_hugetlb_page(vma)) | |
| 1473 | + | unsigned long pa; | |
| 1474 | + | ||
| 1475 | + | if (is_vm_hugetlb_page(vma) && !(vma->vm_flags & VM_PFNMAP)) | |
| 1474 | 1476 | return huge_page_shift(hstate_vma(vma)); | |
| 1475 | 1477 | ||
| 1478 | + | if (!(vma->vm_flags & VM_PFNMAP)) | |
| 1479 | + | return PAGE_SHIFT; | |
| 1480 | + | ||
| 1481 | + | VM_BUG_ON(is_vm_hugetlb_page(vma)); | |
| 1482 | + | ||
| 1483 | + | pa = (vma->vm_pgoff << PAGE_SHIFT) + (hva - vma->vm_start); | |
| 1484 | + | ||
| 1485 | + | #ifndef __PAGETABLE_PMD_FOLDED | |
| 1486 | + | if ((hva & (PUD_SIZE - 1)) == (pa & (PUD_SIZE - 1)) && | |
| 1487 | + | ALIGN_DOWN(hva, PUD_SIZE) >= vma->vm_start && | |
| 1488 | + | ALIGN(hva, PUD_SIZE) <= vma->vm_end) | |
| 1489 | + | return PUD_SHIFT; | |
| 1490 | + | #endif | |
| 1491 | + | ||
| 1492 | + | if ((hva & (PMD_SIZE - 1)) == (pa & (PMD_SIZE - 1)) && | |
| 1493 | + | ALIGN_DOWN(hva, PMD_SIZE) >= vma->vm_start && | |
| 1494 | + | ALIGN(hva, PMD_SIZE) <= vma->vm_end) | |
| 1495 | + | return PMD_SHIFT; | |
| 1496 | + | ||
| 1476 | 1497 | return PAGE_SHIFT; | |
| 1477 | 1498 | } | |
| 1478 | 1499 | ||
| @@ -1773,7 +1794,7 @@ static short kvm_s2_resolve_vma_size(const struct kvm_s2_fault_desc *s2fd, | |||
| 1773 | 1794 | vma_shift = PAGE_SHIFT; | |
| 1774 | 1795 | } else { | |
| 1775 | 1796 | s2vi->max_map_size = PUD_SIZE; | |
| 1776 | - | vma_shift = get_vma_page_shift(vma); | |
| 1797 | + | vma_shift = get_vma_page_shift(vma, s2fd->hva); | |
| 1777 | 1798 | } | |
| 1778 | 1799 | ||
| 1779 | 1800 | switch (vma_shift) { | |
| @@ -1931,6 +1952,16 @@ static int kvm_s2_fault_pin_pfn(const struct kvm_s2_fault_desc *s2fd, | |||
| 1931 | 1952 | return -EFAULT; | |
| 1932 | 1953 | } | |
| 1933 | 1954 | } else { | |
| 1955 | + | /* | |
| 1956 | + | * If the page was identified as device early by looking at | |
| 1957 | + | * the VMA flags, vma_pagesize is already representing the | |
| 1958 | + | * largest quantity we can map. If instead it was mapped | |
| 1959 | + | * via __kvm_faultin_pfn(), vma_pagesize is set to PAGE_SIZE | |
| 1960 | + | * and must not be upgraded. | |
| 1961 | + | * | |
| 1962 | + | * In both cases, we don't let transparent_hugepage_adjust() | |
| 1963 | + | * change things at the last minute. | |
| 1964 | + | */ | |
| 1934 | 1965 | s2vi->map_non_cacheable = true; | |
| 1935 | 1966 | } | |
| 1936 | 1967 | ||
| @@ -2020,10 +2051,10 @@ static int kvm_s2_fault_map(const struct kvm_s2_fault_desc *s2fd, | |||
| 2020 | 2051 | ||
| 2021 | 2052 | /* | |
| 2022 | 2053 | * If we are not forced to use page mapping, check if we are | |
| 2023 | - | * backed by a huge stage-1 mapping and thus use block mapping if | |
| 2024 | - | * possible. | |
| 2054 | + | * backed by a THP and thus use block mapping if possible. | |
| 2025 | 2055 | */ | |
| 2026 | - | if (mapping_size == PAGE_SIZE && s2vi->max_map_size != PAGE_SIZE) { | |
| 2056 | + | if (mapping_size == PAGE_SIZE && | |
| 2057 | + | !(s2vi->max_map_size == PAGE_SIZE || s2vi->map_non_cacheable)) { | |
| 2027 | 2058 | if (perm_fault_granule > PAGE_SIZE) { | |
| 2028 | 2059 | mapping_size = perm_fault_granule; | |
| 2029 | 2060 | } else { | |
| @@ -2104,6 +2135,10 @@ static int user_mem_abort(const struct kvm_s2_fault_desc *s2fd) | |||
| 2104 | 2135 | return ret; | |
| 2105 | 2136 | } | |
| 2106 | 2137 | ||
| 2138 | + | /* | |
| 2139 | + | * Let's check if we will get back a huge page backed by hugetlbfs, or | |
| 2140 | + | * get block mapping for device MMIO region. | |
| 2141 | + | */ | |
| 2107 | 2142 | ret = kvm_s2_fault_pin_pfn(s2fd, &s2vi); | |
| 2108 | 2143 | if (ret != 1) | |
| 2109 | 2144 | return ret; | |
modified arch/arm64/kvm/vgic/vgic-init.c
| @@ -97,9 +97,6 @@ int kvm_vgic_create(struct kvm *kvm, u32 type) | |||
| 97 | 97 | /* | |
| 98 | 98 | * - Acquiring the vCPU mutex for every *online* vCPU to prevent | |
| 99 | 99 | * concurrent vCPU ioctls for vCPUs already visible to userspace. | |
| 100 | - | * This also ensures KVM isn't in the middle of creating a vCPU, | |
| 101 | - | * i.e. that there are no vCPUs that have been created but aren't | |
| 102 | - | * yet fully online. | |
| 103 | 100 | */ | |
| 104 | 101 | ret = -EBUSY; | |
| 105 | 102 | if (kvm_trylock_all_vcpus(kvm)) | |
| @@ -108,11 +105,18 @@ int kvm_vgic_create(struct kvm *kvm, u32 type) | |||
| 108 | 105 | /* | |
| 109 | 106 | * - Taking the config_lock which protects VGIC data structures such | |
| 110 | 107 | * as the per-vCPU arrays of private IRQs (SGIs, PPIs). | |
| 108 | + | */ | |
| 109 | + | mutex_lock(&kvm->arch.config_lock); | |
| 110 | + | ||
| 111 | + | /* | |
| 112 | + | * - Bailing on the entire thing if a vCPU is in the middle of creation, | |
| 113 | + | * dropped the kvm->lock, but hasn't reached kvm_arch_vcpu_create(). | |
| 111 | 114 | * | |
| 112 | 115 | * The whole combination of this guarantees that no vCPU can get into | |
| 113 | 116 | * KVM with a VGIC configuration inconsistent with the VM's VGIC. | |
| 114 | 117 | */ | |
| 115 | - | mutex_lock(&kvm->arch.config_lock); | |
| 118 | + | if (kvm->created_vcpus != atomic_read(&kvm->online_vcpus)) | |
| 119 | + | goto out_unlock; | |
| 116 | 120 | ||
| 117 | 121 | if (irqchip_in_kernel(kvm)) { | |
| 118 | 122 | ret = -EEXIST; | |
modified arch/arm64/kvm/vgic/vgic-its.c
| @@ -319,16 +319,12 @@ static int update_lpi_config(struct kvm *kvm, struct vgic_irq *irq, | |||
| 319 | 319 | return ret; | |
| 320 | 320 | } | |
| 321 | 321 | ||
| 322 | - | static int update_affinity(struct vgic_irq *irq, | |
| 323 | - | struct kvm_vcpu *from_vcpu, struct kvm_vcpu *vcpu) | |
| 322 | + | static int update_affinity(struct vgic_irq *irq, struct kvm_vcpu *vcpu) | |
| 324 | 323 | { | |
| 325 | 324 | struct its_vlpi_map map; | |
| 326 | 325 | int ret; | |
| 327 | 326 | ||
| 328 | 327 | guard(raw_spinlock_irqsave)(&irq->irq_lock); | |
| 329 | - | if (from_vcpu && irq->target_vcpu != from_vcpu) | |
| 330 | - | return 0; | |
| 331 | - | ||
| 332 | 328 | irq->target_vcpu = vcpu; | |
| 333 | 329 | ||
| 334 | 330 | if (!irq->hw) | |
| @@ -366,7 +362,7 @@ static void update_affinity_ite(struct kvm *kvm, struct its_ite *ite) | |||
| 366 | 362 | return; | |
| 367 | 363 | ||
| 368 | 364 | vcpu = collection_to_vcpu(kvm, ite->collection); | |
| 369 | - | update_affinity(ite->irq, NULL, vcpu); | |
| 365 | + | update_affinity(ite->irq, vcpu); | |
| 370 | 366 | } | |
| 371 | 367 | ||
| 372 | 368 | /* | |
| @@ -860,7 +856,7 @@ static int vgic_its_cmd_handle_movi(struct kvm *kvm, struct vgic_its *its, | |||
| 860 | 856 | ||
| 861 | 857 | vgic_its_invalidate_cache(its); | |
| 862 | 858 | ||
| 863 | - | return update_affinity(ite->irq, NULL, vcpu); | |
| 859 | + | return update_affinity(ite->irq, vcpu); | |
| 864 | 860 | } | |
| 865 | 861 | ||
| 866 | 862 | static bool __is_visible_gfn_locked(struct vgic_its *its, gpa_t gpa) | |
| @@ -1387,7 +1383,7 @@ static int vgic_its_cmd_handle_movall(struct kvm *kvm, struct vgic_its *its, | |||
| 1387 | 1383 | if (!irq) | |
| 1388 | 1384 | continue; | |
| 1389 | 1385 | ||
| 1390 | - | update_affinity(irq, vcpu1, vcpu2); | |
| 1386 | + | update_affinity(irq, vcpu2); | |
| 1391 | 1387 | ||
| 1392 | 1388 | vgic_put_irq(kvm, irq); | |
| 1393 | 1389 | } | |
modified arch/arm64/kvm/vgic/vgic-v2.c
| @@ -122,10 +122,6 @@ void vgic_v2_fold_lr_state(struct kvm_vcpu *vcpu) | |||
| 122 | 122 | for (int lr = 0; lr < vgic_cpu->vgic_v2.used_lrs; lr++) | |
| 123 | 123 | vgic_v2_fold_lr(vcpu, cpuif->vgic_lr[lr]); | |
| 124 | 124 | ||
| 125 | - | cpuif->used_lrs = 0; | |
| 126 | - | if (!irq) | |
| 127 | - | return; | |
| 128 | - | ||
| 129 | 125 | /* See the GICv3 equivalent for the EOIcount handling rationale */ | |
| 130 | 126 | list_for_each_entry_continue(irq, &vgic_cpu->ap_list_head, ap_list) { | |
| 131 | 127 | u32 lr; | |
| @@ -148,6 +144,8 @@ void vgic_v2_fold_lr_state(struct kvm_vcpu *vcpu) | |||
| 148 | 144 | vgic_v2_fold_lr(vcpu, lr); | |
| 149 | 145 | eoicount--; | |
| 150 | 146 | } | |
| 147 | + | ||
| 148 | + | cpuif->used_lrs = 0; | |
| 151 | 149 | } | |
| 152 | 150 | ||
| 153 | 151 | void vgic_v2_deactivate(struct kvm_vcpu *vcpu, u32 val) | |
modified arch/arm64/kvm/vgic/vgic-v3.c
| @@ -155,10 +155,6 @@ void vgic_v3_fold_lr_state(struct kvm_vcpu *vcpu) | |||
| 155 | 155 | for (int lr = 0; lr < cpuif->used_lrs; lr++) | |
| 156 | 156 | vgic_v3_fold_lr(vcpu, cpuif->vgic_lr[lr]); | |
| 157 | 157 | ||
| 158 | - | cpuif->used_lrs = 0; | |
| 159 | - | if (!irq) | |
| 160 | - | return; | |
| 161 | - | ||
| 162 | 158 | /* | |
| 163 | 159 | * EOIMode=0: use EOIcount to emulate deactivation. We are | |
| 164 | 160 | * guaranteed to deactivate in reverse order of the activation, so | |
| @@ -192,6 +188,8 @@ void vgic_v3_fold_lr_state(struct kvm_vcpu *vcpu) | |||
| 192 | 188 | vgic_v3_fold_lr(vcpu, lr); | |
| 193 | 189 | eoicount--; | |
| 194 | 190 | } | |
| 191 | + | ||
| 192 | + | cpuif->used_lrs = 0; | |
| 195 | 193 | } | |
| 196 | 194 | ||
| 197 | 195 | void vgic_v3_deactivate(struct kvm_vcpu *vcpu, u64 val) | |
modified arch/arm64/kvm/vgic/vgic.c
| @@ -853,17 +853,6 @@ retry: | |||
| 853 | 853 | goto retry; | |
| 854 | 854 | } | |
| 855 | 855 | ||
| 856 | - | /* | |
| 857 | - | * Fix the last_lr_irq refcount which was obtained while | |
| 858 | - | * populating the LRs. This can also result in the LPI being | |
| 859 | - | * deleted. | |
| 860 | - | */ | |
| 861 | - | irq = *host_data_ptr(last_lr_irq); | |
| 862 | - | if (irq) { | |
| 863 | - | deleted_lpis |= vgic_put_irq_norelease(vcpu->kvm, irq); | |
| 864 | - | *host_data_ptr(last_lr_irq) = NULL; | |
| 865 | - | } | |
| 866 | - | ||
| 867 | 856 | raw_spin_unlock(&vgic_cpu->ap_list_lock); | |
| 868 | 857 | ||
| 869 | 858 | if (unlikely(deleted_lpis)) | |
| @@ -877,6 +866,9 @@ static void vgic_fold_state(struct kvm_vcpu *vcpu) | |||
| 877 | 866 | return; | |
| 878 | 867 | } | |
| 879 | 868 | ||
| 869 | + | if (!*host_data_ptr(last_lr_irq)) | |
| 870 | + | return; | |
| 871 | + | ||
| 880 | 872 | if (kvm_vgic_global_state.type == VGIC_V2) | |
| 881 | 873 | vgic_v2_fold_lr_state(vcpu); | |
| 882 | 874 | else | |
| @@ -1029,14 +1021,11 @@ static void vgic_flush_lr_state(struct kvm_vcpu *vcpu) | |||
| 1029 | 1021 | scoped_guard(raw_spinlock, &irq->irq_lock) { | |
| 1030 | 1022 | if (likely(vgic_target_oracle(irq) == vcpu)) { | |
| 1031 | 1023 | vgic_populate_lr(vcpu, irq, count++); | |
| 1032 | - | if (count == kvm_vgic_global_state.nr_lr) { | |
| 1033 | - | vgic_get_irq_ref(irq); | |
| 1034 | - | *host_data_ptr(last_lr_irq) = irq; | |
| 1035 | - | } | |
| 1024 | + | *host_data_ptr(last_lr_irq) = irq; | |
| 1036 | 1025 | } | |
| 1037 | 1026 | } | |
| 1038 | 1027 | ||
| 1039 | - | if (*host_data_ptr(last_lr_irq)) | |
| 1028 | + | if (count == kvm_vgic_global_state.nr_lr) | |
| 1040 | 1029 | break; | |
| 1041 | 1030 | } | |
| 1042 | 1031 | ||
modified arch/arm64/mm/mmu.c
| @@ -2295,7 +2295,7 @@ pte_t modify_prot_start_ptes(struct vm_area_struct *vma, unsigned long addr, | |||
| 2295 | 2295 | * in cases where cpu is affected with errata #2645198. | |
| 2296 | 2296 | */ | |
| 2297 | 2297 | if (pte_accessible(vma->vm_mm, pte) && pte_user_exec(pte)) | |
| 2298 | - | __flush_tlb_range(vma, addr, addr + nr * PAGE_SIZE, | |
| 2298 | + | __flush_tlb_range(vma, addr, nr * PAGE_SIZE, | |
| 2299 | 2299 | PAGE_SIZE, 3, TLBF_NOWALKCACHE); | |
| 2300 | 2300 | } | |
| 2301 | 2301 | ||
modified arch/arm64/net/bpf_jit_comp.c
| @@ -2418,11 +2418,10 @@ bool bpf_jit_supports_subprog_tailcalls(void) | |||
| 2418 | 2418 | return true; | |
| 2419 | 2419 | } | |
| 2420 | 2420 | ||
| 2421 | - | static void invoke_bpf_prog(struct jit_ctx *ctx, struct bpf_tramp_image *im, | |
| 2422 | - | struct bpf_tramp_node *node, int bargs_off, | |
| 2423 | - | int retval_off, int run_ctx_off, bool save_ret) | |
| 2421 | + | static void invoke_bpf_prog(struct jit_ctx *ctx, struct bpf_tramp_node *node, | |
| 2422 | + | int bargs_off, int retval_off, int run_ctx_off, | |
| 2423 | + | bool save_ret) | |
| 2424 | 2424 | { | |
| 2425 | - | void *skip; | |
| 2426 | 2425 | __le32 *branch; | |
| 2427 | 2426 | u64 enter_prog; | |
| 2428 | 2427 | u64 exit_prog; | |
| @@ -2432,10 +2431,6 @@ static void invoke_bpf_prog(struct jit_ctx *ctx, struct bpf_tramp_image *im, | |||
| 2432 | 2431 | enter_prog = (u64)bpf_trampoline_enter(p); | |
| 2433 | 2432 | exit_prog = (u64)bpf_trampoline_exit(p); | |
| 2434 | 2433 | ||
| 2435 | - | /* nop, patched to skip this prog when it is detached */ | |
| 2436 | - | skip = ctx->ro_image + ctx->idx; | |
| 2437 | - | emit(A64_NOP, ctx); | |
| 2438 | - | ||
| 2439 | 2434 | if (node->cookie == 0) { | |
| 2440 | 2435 | /* if cookie is zero, one instruction is enough to store it */ | |
| 2441 | 2436 | emit(A64_STR64I(A64_ZR, A64_SP, run_ctx_off + cookie_off), ctx); | |
| @@ -2488,13 +2483,11 @@ static void invoke_bpf_prog(struct jit_ctx *ctx, struct bpf_tramp_image *im, | |||
| 2488 | 2483 | emit(A64_ADD_I(1, A64_R(2), A64_SP, run_ctx_off), ctx); | |
| 2489 | 2484 | ||
| 2490 | 2485 | emit_call(exit_prog, ctx); | |
| 2491 | - | ||
| 2492 | - | bpf_tramp_image_add_skip(im, p, skip, ctx->ro_image + ctx->idx); | |
| 2493 | 2486 | } | |
| 2494 | 2487 | ||
| 2495 | - | static void invoke_bpf_mod_ret(struct jit_ctx *ctx, struct bpf_tramp_image *im, | |
| 2496 | - | struct bpf_tramp_nodes *tn, int bargs_off, | |
| 2497 | - | int retval_off, int run_ctx_off, __le32 **branches) | |
| 2488 | + | static void invoke_bpf_mod_ret(struct jit_ctx *ctx, struct bpf_tramp_nodes *tn, | |
| 2489 | + | int bargs_off, int retval_off, int run_ctx_off, | |
| 2490 | + | __le32 **branches) | |
| 2498 | 2491 | { | |
| 2499 | 2492 | int i; | |
| 2500 | 2493 | ||
| @@ -2503,7 +2496,7 @@ static void invoke_bpf_mod_ret(struct jit_ctx *ctx, struct bpf_tramp_image *im, | |||
| 2503 | 2496 | */ | |
| 2504 | 2497 | emit(A64_STR64I(A64_ZR, A64_SP, retval_off), ctx); | |
| 2505 | 2498 | for (i = 0; i < tn->nr_nodes; i++) { | |
| 2506 | - | invoke_bpf_prog(ctx, im, tn->nodes[i], bargs_off, retval_off, | |
| 2499 | + | invoke_bpf_prog(ctx, tn->nodes[i], bargs_off, retval_off, | |
| 2507 | 2500 | run_ctx_off, true); | |
| 2508 | 2501 | /* if (*(u64 *)(sp + retval_off) != 0) | |
| 2509 | 2502 | * goto do_fexit; | |
| @@ -2889,7 +2882,7 @@ static int prepare_trampoline(struct jit_ctx *ctx, struct bpf_tramp_image *im, | |||
| 2889 | 2882 | store_func_meta(ctx, meta, func_meta_off); | |
| 2890 | 2883 | cookie_bargs_off--; | |
| 2891 | 2884 | } | |
| 2892 | - | invoke_bpf_prog(ctx, im, fentry->nodes[i], bargs_off, | |
| 2885 | + | invoke_bpf_prog(ctx, fentry->nodes[i], bargs_off, | |
| 2893 | 2886 | retval_off, run_ctx_off, | |
| 2894 | 2887 | flags & BPF_TRAMP_F_RET_FENTRY_RET); | |
| 2895 | 2888 | } | |
| @@ -2900,7 +2893,7 @@ static int prepare_trampoline(struct jit_ctx *ctx, struct bpf_tramp_image *im, | |||
| 2900 | 2893 | if (!branches) | |
| 2901 | 2894 | return -ENOMEM; | |
| 2902 | 2895 | ||
| 2903 | - | invoke_bpf_mod_ret(ctx, im, fmod_ret, bargs_off, retval_off, | |
| 2896 | + | invoke_bpf_mod_ret(ctx, fmod_ret, bargs_off, retval_off, | |
| 2904 | 2897 | run_ctx_off, branches); | |
| 2905 | 2898 | } | |
| 2906 | 2899 | ||
| @@ -2913,6 +2906,9 @@ static int prepare_trampoline(struct jit_ctx *ctx, struct bpf_tramp_image *im, | |||
| 2913 | 2906 | emit(A64_RET(A64_R(10)), ctx); | |
| 2914 | 2907 | /* store return value */ | |
| 2915 | 2908 | emit(A64_STR64I(A64_R(0), A64_SP, retval_off), ctx); | |
| 2909 | + | /* reserve a nop for bpf_tramp_image_put */ | |
| 2910 | + | im->ip_after_call = ctx->ro_image + ctx->idx; | |
| 2911 | + | emit(A64_NOP, ctx); | |
| 2916 | 2912 | } | |
| 2917 | 2913 | ||
| 2918 | 2914 | /* update the branches saved in invoke_bpf_mod_ret with cbnz */ | |
| @@ -2934,11 +2930,12 @@ static int prepare_trampoline(struct jit_ctx *ctx, struct bpf_tramp_image *im, | |||
| 2934 | 2930 | store_func_meta(ctx, meta, func_meta_off); | |
| 2935 | 2931 | cookie_bargs_off--; | |
| 2936 | 2932 | } | |
| 2937 | - | invoke_bpf_prog(ctx, im, fexit->nodes[i], bargs_off, retval_off, | |
| 2933 | + | invoke_bpf_prog(ctx, fexit->nodes[i], bargs_off, retval_off, | |
| 2938 | 2934 | run_ctx_off, false); | |
| 2939 | 2935 | } | |
| 2940 | 2936 | ||
| 2941 | 2937 | if (flags & BPF_TRAMP_F_CALL_ORIG) { | |
| 2938 | + | im->ip_epilogue = ctx->ro_image + ctx->idx; | |
| 2942 | 2939 | /* for the first pass, assume the worst case */ | |
| 2943 | 2940 | if (!ctx->image) | |
| 2944 | 2941 | ctx->idx += 4; | |
| @@ -2997,7 +2994,7 @@ int arch_bpf_trampoline_size(const struct btf_func_model *m, u32 flags, | |||
| 2997 | 2994 | .image = NULL, | |
| 2998 | 2995 | .idx = 0, | |
| 2999 | 2996 | }; | |
| 3000 | - | struct bpf_tramp_image im = {}; | |
| 2997 | + | struct bpf_tramp_image im; | |
| 3001 | 2998 | struct arg_aux aaux; | |
| 3002 | 2999 | int ret; | |
| 3003 | 3000 | ||
| @@ -3284,10 +3281,6 @@ int bpf_arch_text_poke(void *ip, enum bpf_text_poke_type old_t, | |||
| 3284 | 3281 | * longer reachable, since bpf_tramp_image_put() function already | |
| 3285 | 3282 | * uses percpu_ref and task-based rcu to do the sync, no need to call | |
| 3286 | 3283 | * the sync version here, see bpf_tramp_image_put() for details. | |
| 3287 | - | * | |
| 3288 | - | * 3. when a detached prog is patched out of a trampoline, a CPU that | |
| 3289 | - | * still executes the old nop calls the prog before it went through | |
| 3290 | - | * a quiescent state, and the prog is freed after grace periods. | |
| 3291 | 3284 | */ | |
| 3292 | 3285 | ret = aarch64_insn_patch_text_nosync(ip, new_insn); | |
| 3293 | 3286 | out: | |
modified arch/arm64/tools/cpucaps
| @@ -105,6 +105,7 @@ WORKAROUND_1902691 | |||
| 105 | 105 | WORKAROUND_2038923 | |
| 106 | 106 | WORKAROUND_2064142 | |
| 107 | 107 | WORKAROUND_2077057 | |
| 108 | + | WORKAROUND_2457168 | |
| 108 | 109 | WORKAROUND_2645198 | |
| 109 | 110 | WORKAROUND_2658417 | |
| 110 | 111 | WORKAROUND_4193714 | |
| @@ -131,4 +132,3 @@ WORKAROUND_REPEAT_TLBI_SYNC | |||
| 131 | 132 | WORKAROUND_SPECULATIVE_AT | |
| 132 | 133 | WORKAROUND_SPECULATIVE_SSBS | |
| 133 | 134 | WORKAROUND_SPECULATIVE_UNPRIV_LOAD | |
| 134 | - | WORKAROUND_BROKEN_AMU_CONSTCNT | |
modified arch/loongarch/net/bpf_jit.c
| @@ -1578,24 +1578,6 @@ void *bpf_arch_text_copy(void *dst, void *src, size_t len) | |||
| 1578 | 1578 | return ret ? ERR_PTR(-EINVAL) : dst; | |
| 1579 | 1579 | } | |
| 1580 | 1580 | ||
| 1581 | - | int arch_bpf_trampoline_skip(void *nop, void *target) | |
| 1582 | - | { | |
| 1583 | - | u32 old_insn = INSN_NOP; | |
| 1584 | - | u32 new_insn = larch_insn_gen_b((unsigned long)nop, (unsigned long)target); | |
| 1585 | - | int ret; | |
| 1586 | - | ||
| 1587 | - | if (memcmp(nop, &old_insn, LOONGARCH_INSN_SIZE)) | |
| 1588 | - | return -EFAULT; | |
| 1589 | - | ||
| 1590 | - | cpus_read_lock(); | |
| 1591 | - | mutex_lock(&text_mutex); | |
| 1592 | - | ret = larch_insn_text_copy(nop, &new_insn, LOONGARCH_INSN_SIZE); | |
| 1593 | - | mutex_unlock(&text_mutex); | |
| 1594 | - | cpus_read_unlock(); | |
| 1595 | - | ||
| 1596 | - | return ret; | |
| 1597 | - | } | |
| 1598 | - | ||
| 1599 | 1581 | int bpf_arch_text_poke(void *ip, enum bpf_text_poke_type old_t, | |
| 1600 | 1582 | enum bpf_text_poke_type new_t, void *old_addr, | |
| 1601 | 1583 | void *new_addr) | |
| @@ -1714,18 +1696,13 @@ static void restore_stk_args(struct jit_ctx *ctx, int nr_stk_args, int args_off, | |||
| 1714 | 1696 | } | |
| 1715 | 1697 | } | |
| 1716 | 1698 | ||
| 1717 | - | static int invoke_bpf_prog(struct jit_ctx *ctx, struct bpf_tramp_image *im, | |
| 1718 | - | struct bpf_tramp_node *n, int args_off, int retval_off, | |
| 1719 | - | int run_ctx_off, bool save_ret) | |
| 1699 | + | static int invoke_bpf_prog(struct jit_ctx *ctx, struct bpf_tramp_node *n, | |
| 1700 | + | int args_off, int retval_off, int run_ctx_off, bool save_ret) | |
| 1720 | 1701 | { | |
| 1721 | 1702 | int ret; | |
| 1722 | 1703 | u32 *branch; | |
| 1723 | 1704 | struct bpf_prog *p = n->link->prog; | |
| 1724 | 1705 | int cookie_off = offsetof(struct bpf_tramp_run_ctx, bpf_cookie); | |
| 1725 | - | void *skip = ctx->ro_image + ctx->idx; | |
| 1726 | - | ||
| 1727 | - | /* nop, patched to a b over this prog when it is detached */ | |
| 1728 | - | emit_insn(ctx, nop); | |
| 1729 | 1706 | ||
| 1730 | 1707 | if (n->cookie) | |
| 1731 | 1708 | emit_store_stack_imm64(ctx, LOONGARCH_GPR_T1, | |
| @@ -1778,17 +1755,13 @@ static int invoke_bpf_prog(struct jit_ctx *ctx, struct bpf_tramp_image *im, | |||
| 1778 | 1755 | /* arg3: &run_ctx */ | |
| 1779 | 1756 | emit_insn(ctx, addid, LOONGARCH_GPR_A2, LOONGARCH_GPR_FP, -run_ctx_off); | |
| 1780 | 1757 | ret = emit_call(ctx, (const u64)bpf_trampoline_exit(p)); | |
| 1781 | - | if (ret) | |
| 1782 | - | return ret; | |
| 1783 | 1758 | ||
| 1784 | - | bpf_tramp_image_add_skip(im, p, skip, ctx->ro_image + ctx->idx); | |
| 1785 | - | return 0; | |
| 1759 | + | return ret; | |
| 1786 | 1760 | } | |
| 1787 | 1761 | ||
| 1788 | - | static int invoke_bpf(struct jit_ctx *ctx, struct bpf_tramp_image *im, | |
| 1789 | - | struct bpf_tramp_nodes *tn, int args_off, int retval_off, | |
| 1790 | - | int run_ctx_off, int func_meta_off, bool save_ret, | |
| 1791 | - | u64 func_meta, int cookie_off) | |
| 1762 | + | static int invoke_bpf(struct jit_ctx *ctx, struct bpf_tramp_nodes *tn, | |
| 1763 | + | int args_off, int retval_off, int run_ctx_off, | |
| 1764 | + | int func_meta_off, bool save_ret, u64 func_meta, int cookie_off) | |
| 1792 | 1765 | { | |
| 1793 | 1766 | int i, cur_cookie = (cookie_off - args_off) / 8; | |
| 1794 | 1767 | ||
| @@ -1801,8 +1774,7 @@ static int invoke_bpf(struct jit_ctx *ctx, struct bpf_tramp_image *im, | |||
| 1801 | 1774 | emit_store_stack_imm64(ctx, LOONGARCH_GPR_T1, -func_meta_off, meta); | |
| 1802 | 1775 | cur_cookie--; | |
| 1803 | 1776 | } | |
| 1804 | - | err = invoke_bpf_prog(ctx, im, tn->nodes[i], args_off, retval_off, | |
| 1805 | - | run_ctx_off, save_ret); | |
| 1777 | + | err = invoke_bpf_prog(ctx, tn->nodes[i], args_off, retval_off, run_ctx_off, save_ret); | |
| 1806 | 1778 | if (err) | |
| 1807 | 1779 | return err; | |
| 1808 | 1780 | } | |
| @@ -2045,7 +2017,7 @@ static int __arch_prepare_bpf_trampoline(struct jit_ctx *ctx, struct bpf_tramp_i | |||
| 2045 | 2017 | } | |
| 2046 | 2018 | ||
| 2047 | 2019 | if (fentry->nr_nodes) { | |
| 2048 | - | ret = invoke_bpf(ctx, im, fentry, args_off, retval_off, run_ctx_off, func_meta_off, | |
| 2020 | + | ret = invoke_bpf(ctx, fentry, args_off, retval_off, run_ctx_off, func_meta_off, | |
| 2049 | 2021 | flags & BPF_TRAMP_F_RET_FENTRY_RET, func_meta, cookie_off); | |
| 2050 | 2022 | if (ret) | |
| 2051 | 2023 | return ret; | |
| @@ -2057,7 +2029,7 @@ static int __arch_prepare_bpf_trampoline(struct jit_ctx *ctx, struct bpf_tramp_i | |||
| 2057 | 2029 | ||
| 2058 | 2030 | emit_insn(ctx, std, LOONGARCH_GPR_ZERO, LOONGARCH_GPR_FP, -retval_off); | |
| 2059 | 2031 | for (i = 0; i < fmod_ret->nr_nodes; i++) { | |
| 2060 | - | ret = invoke_bpf_prog(ctx, im, fmod_ret->nodes[i], | |
| 2032 | + | ret = invoke_bpf_prog(ctx, fmod_ret->nodes[i], | |
| 2061 | 2033 | args_off, retval_off, run_ctx_off, true); | |
| 2062 | 2034 | if (ret) | |
| 2063 | 2035 | goto out; | |
| @@ -2079,6 +2051,10 @@ static int __arch_prepare_bpf_trampoline(struct jit_ctx *ctx, struct bpf_tramp_i | |||
| 2079 | 2051 | goto out; | |
| 2080 | 2052 | emit_insn(ctx, std, LOONGARCH_GPR_A0, LOONGARCH_GPR_FP, -retval_off); | |
| 2081 | 2053 | emit_insn(ctx, std, regmap[BPF_REG_0], LOONGARCH_GPR_FP, -(retval_off - 8)); | |
| 2054 | + | im->ip_after_call = ctx->ro_image + ctx->idx; | |
| 2055 | + | /* Reserve space for the move_imm + jirl instruction */ | |
| 2056 | + | for (i = 0; i < LOONGARCH_LONG_JUMP_NINSNS; i++) | |
| 2057 | + | emit_insn(ctx, nop); | |
| 2082 | 2058 | } | |
| 2083 | 2059 | ||
| 2084 | 2060 | for (i = 0; ctx->image && i < fmod_ret->nr_nodes; i++) { | |
| @@ -2092,13 +2068,14 @@ static int __arch_prepare_bpf_trampoline(struct jit_ctx *ctx, struct bpf_tramp_i | |||
| 2092 | 2068 | emit_store_stack_imm64(ctx, LOONGARCH_GPR_T1, -func_meta_off, func_meta); | |
| 2093 | 2069 | ||
| 2094 | 2070 | if (fexit->nr_nodes) { | |
| 2095 | - | ret = invoke_bpf(ctx, im, fexit, args_off, retval_off, run_ctx_off, | |
| 2071 | + | ret = invoke_bpf(ctx, fexit, args_off, retval_off, run_ctx_off, | |
| 2096 | 2072 | func_meta_off, false, func_meta, cookie_off); | |
| 2097 | 2073 | if (ret) | |
| 2098 | 2074 | goto out; | |
| 2099 | 2075 | } | |
| 2100 | 2076 | ||
| 2101 | 2077 | if (flags & BPF_TRAMP_F_CALL_ORIG) { | |
| 2078 | + | im->ip_epilogue = ctx->ro_image + ctx->idx; | |
| 2102 | 2079 | move_addr(ctx, LOONGARCH_GPR_A0, (const u64)im); | |
| 2103 | 2080 | ret = emit_call(ctx, (const u64)__bpf_tramp_exit); | |
| 2104 | 2081 | if (ret) | |
| @@ -2200,8 +2177,11 @@ int arch_bpf_trampoline_size(const struct btf_func_model *m, u32 flags, | |||
| 2200 | 2177 | struct bpf_tramp_nodes *tnodes, void *func_addr) | |
| 2201 | 2178 | { | |
| 2202 | 2179 | int ret; | |
| 2203 | - | struct jit_ctx ctx = {}; | |
| 2204 | - | struct bpf_tramp_image im = {}; | |
| 2180 | + | struct jit_ctx ctx; | |
| 2181 | + | struct bpf_tramp_image im; | |
| 2182 | + | ||
| 2183 | + | ctx.image = NULL; | |
| 2184 | + | ctx.idx = 0; | |
| 2205 | 2185 | ||
| 2206 | 2186 | ret = __arch_prepare_bpf_trampoline(&ctx, &im, m, tnodes, func_addr, flags); | |
| 2207 | 2187 | ||
modified arch/loongarch/vdso/Makefile
| @@ -16,7 +16,6 @@ ccflags-vdso := \ | |||
| 16 | 16 | $(filter -m64,$(KBUILD_CFLAGS)) \ | |
| 17 | 17 | $(filter -march=%,$(KBUILD_CFLAGS)) \ | |
| 18 | 18 | $(filter -m%-float,$(KBUILD_CFLAGS)) \ | |
| 19 | - | $(CONFIG_CC_OPT_INLINE_MEMSET) \ | |
| 20 | 19 | $(CLANG_FLAGS) \ | |
| 21 | 20 | -D__VDSO__ | |
| 22 | 21 | ||
modified arch/powerpc/kernel/vdso/Makefile
| @@ -43,7 +43,6 @@ ccflags-y := -fno-common -fno-builtin -DBUILD_VDSO | |||
| 43 | 43 | ccflags-y += $(DISABLE_LATENT_ENTROPY_PLUGIN) | |
| 44 | 44 | ccflags-y += $(call cc-option, -fno-stack-protector) | |
| 45 | 45 | ccflags-y += -DDISABLE_BRANCH_PROFILING | |
| 46 | - | ccflags-y += $(CONFIG_CC_OPT_INLINE_MEMSET) | |
| 47 | 46 | ccflags-y += -ffreestanding -fasynchronous-unwind-tables | |
| 48 | 47 | ccflags-remove-y := $(CC_FLAGS_FTRACE) | |
| 49 | 48 | ldflags-y := -Wl,--hash-style=both -nostdlib -shared -z noexecstack $(CLANG_FLAGS) | |
modified arch/powerpc/kvm/book3s_hv.c
| @@ -3058,6 +3058,7 @@ static int kvmppc_core_vcpu_create_hv(struct kvm_vcpu *vcpu) | |||
| 3058 | 3058 | ||
| 3059 | 3059 | init_waitqueue_head(&vcpu->arch.cpu_run); | |
| 3060 | 3060 | ||
| 3061 | + | mutex_lock(&kvm->lock); | |
| 3061 | 3062 | vcore = NULL; | |
| 3062 | 3063 | err = -EINVAL; | |
| 3063 | 3064 | if (cpu_has_feature(CPU_FTR_ARCH_300)) { | |
| @@ -3090,6 +3091,7 @@ static int kvmppc_core_vcpu_create_hv(struct kvm_vcpu *vcpu) | |||
| 3090 | 3091 | mutex_unlock(&kvm->arch.mmu_setup_lock); | |
| 3091 | 3092 | } | |
| 3092 | 3093 | } | |
| 3094 | + | mutex_unlock(&kvm->lock); | |
| 3093 | 3095 | ||
| 3094 | 3096 | if (!vcore) | |
| 3095 | 3097 | return err; | |
modified arch/powerpc/net/bpf_jit_comp.c
| @@ -602,18 +602,14 @@ int arch_protect_bpf_trampoline(void *image, unsigned int size) | |||
| 602 | 602 | } | |
| 603 | 603 | ||
| 604 | 604 | static int invoke_bpf_prog(u32 *image, u32 *ro_image, struct codegen_context *ctx, | |
| 605 | - | struct bpf_tramp_image *im, struct bpf_tramp_node *n, | |
| 606 | - | int regs_off, int retval_off, int run_ctx_off, bool save_ret) | |
| 605 | + | struct bpf_tramp_node *n, int regs_off, int retval_off, | |
| 606 | + | int run_ctx_off, bool save_ret) | |
| 607 | 607 | { | |
| 608 | 608 | struct bpf_prog *p = n->link->prog; | |
| 609 | 609 | ppc_inst_t branch_insn; | |
| 610 | - | u32 jmp_idx, skip_idx; | |
| 610 | + | u32 jmp_idx; | |
| 611 | 611 | int ret = 0; | |
| 612 | 612 | ||
| 613 | - | /* nop, patched to skip this prog when it is detached */ | |
| 614 | - | skip_idx = ctx->idx; | |
| 615 | - | EMIT(PPC_RAW_NOP()); | |
| 616 | - | ||
| 617 | 613 | /* Save cookie */ | |
| 618 | 614 | if (IS_ENABLED(CONFIG_PPC64)) { | |
| 619 | 615 | PPC_LI64(_R3, n->cookie); | |
| @@ -683,17 +679,13 @@ static int invoke_bpf_prog(u32 *image, u32 *ro_image, struct codegen_context *ct | |||
| 683 | 679 | EMIT(PPC_RAW_ADDI(_R5, _R1, run_ctx_off)); | |
| 684 | 680 | ret = bpf_jit_emit_func_call_rel(image, ro_image, ctx, | |
| 685 | 681 | (unsigned long)bpf_trampoline_exit(p)); | |
| 686 | - | if (ret) | |
| 687 | - | return ret; | |
| 688 | 682 | ||
| 689 | - | if (ro_image) /* image is NULL for dummy pass */ | |
| 690 | - | bpf_tramp_image_add_skip(im, p, &ro_image[skip_idx], &ro_image[ctx->idx]); | |
| 691 | - | return 0; | |
| 683 | + | return ret; | |
| 692 | 684 | } | |
| 693 | 685 | ||
| 694 | 686 | static int invoke_bpf_mod_ret(u32 *image, u32 *ro_image, struct codegen_context *ctx, | |
| 695 | - | struct bpf_tramp_image *im, struct bpf_tramp_nodes *tn, | |
| 696 | - | int regs_off, int retval_off, int run_ctx_off, u32 *branches) | |
| 687 | + | struct bpf_tramp_nodes *tn, int regs_off, int retval_off, | |
| 688 | + | int run_ctx_off, u32 *branches) | |
| 697 | 689 | { | |
| 698 | 690 | int i; | |
| 699 | 691 | ||
| @@ -704,8 +696,8 @@ static int invoke_bpf_mod_ret(u32 *image, u32 *ro_image, struct codegen_context | |||
| 704 | 696 | EMIT(PPC_RAW_LI(_R3, 0)); | |
| 705 | 697 | EMIT(PPC_RAW_STL(_R3, _R1, retval_off)); | |
| 706 | 698 | for (i = 0; i < tn->nr_nodes; i++) { | |
| 707 | - | if (invoke_bpf_prog(image, ro_image, ctx, im, tn->nodes[i], regs_off, | |
| 708 | - | retval_off, run_ctx_off, true)) | |
| 699 | + | if (invoke_bpf_prog(image, ro_image, ctx, tn->nodes[i], regs_off, retval_off, | |
| 700 | + | run_ctx_off, true)) | |
| 709 | 701 | return -EINVAL; | |
| 710 | 702 | ||
| 711 | 703 | /* | |
| @@ -1051,8 +1043,8 @@ static int __arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *rw_im | |||
| 1051 | 1043 | cookie_ctx_off--; | |
| 1052 | 1044 | } | |
| 1053 | 1045 | ||
| 1054 | - | if (invoke_bpf_prog(image, ro_image, ctx, im, fentry->nodes[i], regs_off, | |
| 1055 | - | retval_off, run_ctx_off, flags & BPF_TRAMP_F_RET_FENTRY_RET)) | |
| 1046 | + | if (invoke_bpf_prog(image, ro_image, ctx, fentry->nodes[i], regs_off, retval_off, | |
| 1047 | + | run_ctx_off, flags & BPF_TRAMP_F_RET_FENTRY_RET)) | |
| 1056 | 1048 | return -EINVAL; | |
| 1057 | 1049 | } | |
| 1058 | 1050 | ||
| @@ -1061,7 +1053,7 @@ static int __arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *rw_im | |||
| 1061 | 1053 | if (!branches) | |
| 1062 | 1054 | return -ENOMEM; | |
| 1063 | 1055 | ||
| 1064 | - | if (invoke_bpf_mod_ret(image, ro_image, ctx, im, fmod_ret, regs_off, retval_off, | |
| 1056 | + | if (invoke_bpf_mod_ret(image, ro_image, ctx, fmod_ret, regs_off, retval_off, | |
| 1065 | 1057 | run_ctx_off, branches)) { | |
| 1066 | 1058 | ret = -EINVAL; | |
| 1067 | 1059 | goto cleanup; | |
| @@ -1098,6 +1090,11 @@ static int __arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *rw_im | |||
| 1098 | 1090 | /* Restore updated tail_call_cnt */ | |
| 1099 | 1091 | if (flags & BPF_TRAMP_F_TAIL_CALL_CTX) | |
| 1100 | 1092 | bpf_trampoline_restore_tail_call_cnt(image, ctx, bpf_frame_size, r4_off); | |
| 1093 | + | ||
| 1094 | + | /* Reserve space to patch branch instruction to skip fexit progs */ | |
| 1095 | + | if (ro_image) /* image is NULL for dummy pass */ | |
| 1096 | + | im->ip_after_call = &((u32 *)ro_image)[ctx->idx]; | |
| 1097 | + | EMIT(PPC_RAW_NOP()); | |
| 1101 | 1098 | } | |
| 1102 | 1099 | ||
| 1103 | 1100 | /* Update branches saved in invoke_bpf_mod_ret with address of do_fexit */ | |
| @@ -1126,14 +1123,16 @@ static int __arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *rw_im | |||
| 1126 | 1123 | cookie_ctx_off--; | |
| 1127 | 1124 | } | |
| 1128 | 1125 | ||
| 1129 | - | if (invoke_bpf_prog(image, ro_image, ctx, im, fexit->nodes[i], regs_off, | |
| 1130 | - | retval_off, run_ctx_off, false)) { | |
| 1126 | + | if (invoke_bpf_prog(image, ro_image, ctx, fexit->nodes[i], regs_off, retval_off, | |
| 1127 | + | run_ctx_off, false)) { | |
| 1131 | 1128 | ret = -EINVAL; | |
| 1132 | 1129 | goto cleanup; | |
| 1133 | 1130 | } | |
| 1134 | 1131 | } | |
| 1135 | 1132 | ||
| 1136 | 1133 | if (flags & BPF_TRAMP_F_CALL_ORIG) { | |
| 1134 | + | if (ro_image) /* image is NULL for dummy pass */ | |
| 1135 | + | im->ip_epilogue = &((u32 *)ro_image)[ctx->idx]; | |
| 1137 | 1136 | PPC_LI_ADDR(_R3, im); | |
| 1138 | 1137 | ret = bpf_jit_emit_func_call_rel(image, ro_image, ctx, | |
| 1139 | 1138 | (unsigned long)__bpf_tramp_exit); | |
| @@ -1193,7 +1192,7 @@ cleanup: | |||
| 1193 | 1192 | int arch_bpf_trampoline_size(const struct btf_func_model *m, u32 flags, | |
| 1194 | 1193 | struct bpf_tramp_nodes *tnodes, void *func_addr) | |
| 1195 | 1194 | { | |
| 1196 | - | struct bpf_tramp_image im = {}; | |
| 1195 | + | struct bpf_tramp_image im; | |
| 1197 | 1196 | int ret; | |
| 1198 | 1197 | ||
| 1199 | 1198 | ret = __arch_prepare_bpf_trampoline(&im, NULL, NULL, NULL, m, flags, tnodes, func_addr); | |
| @@ -1321,7 +1320,7 @@ int bpf_arch_text_poke(void *ip, enum bpf_text_poke_type old_t, | |||
| 1321 | 1320 | ||
| 1322 | 1321 | /* | |
| 1323 | 1322 | * If we are not poking at bpf prog entry, then we are simply patching in/out | |
| 1324 | - | * an unconditional branch instruction in a trampoline image | |
| 1323 | + | * an unconditional branch instruction at im->ip_after_call | |
| 1325 | 1324 | */ | |
| 1326 | 1325 | if (offset) { | |
| 1327 | 1326 | if (old_t == BPF_MOD_CALL || new_t == BPF_MOD_CALL) { | |
modified arch/powerpc/perf/imc-pmu.c
| @@ -1275,8 +1275,6 @@ static int trace_imc_prepare_sample(struct trace_imc_data *mem, | |||
| 1275 | 1275 | struct perf_event_header *header, | |
| 1276 | 1276 | struct perf_event *event) | |
| 1277 | 1277 | { | |
| 1278 | - | u16 misc = 0; | |
| 1279 | - | ||
| 1280 | 1278 | /* Sanity checks for a valid record */ | |
| 1281 | 1279 | if (be64_to_cpu(READ_ONCE(mem->tb1)) > *prev_tb) | |
| 1282 | 1280 | *prev_tb = be64_to_cpu(READ_ONCE(mem->tb1)); | |
| @@ -1291,19 +1289,23 @@ static int trace_imc_prepare_sample(struct trace_imc_data *mem, | |||
| 1291 | 1289 | data->ip = be64_to_cpu(READ_ONCE(mem->ip)); | |
| 1292 | 1290 | data->period = event->hw.last_period; | |
| 1293 | 1291 | ||
| 1292 | + | header->type = PERF_RECORD_SAMPLE; | |
| 1293 | + | header->size = sizeof(*header) + event->header_size; | |
| 1294 | + | header->misc = 0; | |
| 1295 | + | ||
| 1294 | 1296 | if (cpu_has_feature(CPU_FTR_ARCH_31)) { | |
| 1295 | 1297 | switch (IMC_TRACE_RECORD_VAL_HVPR(be64_to_cpu(READ_ONCE(mem->val)))) { | |
| 1296 | 1298 | case 0:/* when MSR HV and PR not set in the trace-record */ | |
| 1297 | - | misc |= PERF_RECORD_MISC_GUEST_KERNEL; | |
| 1299 | + | header->misc |= PERF_RECORD_MISC_GUEST_KERNEL; | |
| 1298 | 1300 | break; | |
| 1299 | 1301 | case 1: /* MSR HV is 0 and PR is 1 */ | |
| 1300 | - | misc |= PERF_RECORD_MISC_GUEST_USER; | |
| 1302 | + | header->misc |= PERF_RECORD_MISC_GUEST_USER; | |
| 1301 | 1303 | break; | |
| 1302 | 1304 | case 2: /* MSR HV is 1 and PR is 0 */ | |
| 1303 | - | misc |= PERF_RECORD_MISC_KERNEL; | |
| 1305 | + | header->misc |= PERF_RECORD_MISC_KERNEL; | |
| 1304 | 1306 | break; | |
| 1305 | 1307 | case 3: /* MSR HV is 1 and PR is 1 */ | |
| 1306 | - | misc |= PERF_RECORD_MISC_USER; | |
| 1308 | + | header->misc |= PERF_RECORD_MISC_USER; | |
| 1307 | 1309 | break; | |
| 1308 | 1310 | default: | |
| 1309 | 1311 | pr_info("IMC: Unable to set the flag based on MSR bits\n"); | |
| @@ -1311,14 +1313,11 @@ static int trace_imc_prepare_sample(struct trace_imc_data *mem, | |||
| 1311 | 1313 | } | |
| 1312 | 1314 | } else { | |
| 1313 | 1315 | if (is_kernel_addr(data->ip)) | |
| 1314 | - | misc |= PERF_RECORD_MISC_KERNEL; | |
| 1316 | + | header->misc |= PERF_RECORD_MISC_KERNEL; | |
| 1315 | 1317 | else | |
| 1316 | - | misc |= PERF_RECORD_MISC_USER; | |
| 1318 | + | header->misc |= PERF_RECORD_MISC_USER; | |
| 1317 | 1319 | } | |
| 1318 | - | perf_event_header__init(header, data, | |
| 1319 | - | PERF_RECORD_SAMPLE, misc, | |
| 1320 | - | sizeof(*header) + event->header_size, | |
| 1321 | - | event); | |
| 1320 | + | perf_event_header__init_id(header, data, event); | |
| 1322 | 1321 | ||
| 1323 | 1322 | return 0; | |
| 1324 | 1323 | } | |
modified arch/riscv/Kconfig
| @@ -453,10 +453,9 @@ config SMP | |||
| 453 | 453 | config NR_CPUS | |
| 454 | 454 | int "Maximum number of CPUs (2-512)" | |
| 455 | 455 | depends on SMP | |
| 456 | - | range 2 512 if !RISCV_SBI_V01 && 64BIT | |
| 457 | - | range 2 128 if !RISCV_SBI_V01 && 32BIT | |
| 458 | - | range 2 64 if RISCV_SBI_V01 && 64BIT | |
| 456 | + | range 2 512 if !RISCV_SBI_V01 | |
| 459 | 457 | range 2 32 if RISCV_SBI_V01 && 32BIT | |
| 458 | + | range 2 64 if RISCV_SBI_V01 && 64BIT | |
| 460 | 459 | default "32" if 32BIT | |
| 461 | 460 | default "64" if RISCV_SBI_V01 && 64BIT | |
| 462 | 461 | default "256" if !RISCV_SBI_V01 && 64BIT | |
modified arch/riscv/Kconfig.errata
| @@ -46,7 +46,7 @@ config ERRATA_MIPS_P8700_PAUSE_OPCODE | |||
| 46 | 46 | ||
| 47 | 47 | config ERRATA_SIFIVE | |
| 48 | 48 | bool "SiFive errata" | |
| 49 | - | depends on RISCV_ALTERNATIVE && 64BIT | |
| 49 | + | depends on RISCV_ALTERNATIVE | |
| 50 | 50 | help | |
| 51 | 51 | All SiFive errata Kconfig depend on this Kconfig. Disabling | |
| 52 | 52 | this Kconfig will disable all SiFive errata. Please say "Y" | |
| @@ -96,20 +96,6 @@ config ERRATA_STARFIVE_JH7100 | |||
| 96 | 96 | Say "Y" if you want to support the BeagleV Starlight and/or | |
| 97 | 97 | StarFive VisionFive V1 boards. | |
| 98 | 98 | ||
| 99 | - | config ERRATA_SIFIVE_MAL_9092 | |
| 100 | - | bool "Apply SiFive HLV/HLVX/HSV fence errata" | |
| 101 | - | depends on ERRATA_SIFIVE && 64BIT | |
| 102 | - | default y | |
| 103 | - | help | |
| 104 | - | This will apply the SiFive MAL-9092 errata to add fence.rw | |
| 105 | - | instructions around all HLV/HLVX/HSV instructions. | |
| 106 | - | ||
| 107 | - | Note: HSTATUS.HU is cleared during KVM initialization. If future | |
| 108 | - | changes enable HSTATUS.HU to allow hypervisor instructions in | |
| 109 | - | U-mode, additional errata handling may be required. | |
| 110 | - | ||
| 111 | - | If you don't know what to do here, say "Y". | |
| 112 | - | ||
| 113 | 99 | config ERRATA_THEAD | |
| 114 | 100 | bool "T-HEAD errata" | |
| 115 | 101 | depends on RISCV_ALTERNATIVE | |
| @@ -160,7 +146,6 @@ config ERRATA_THEAD_PMU | |||
| 160 | 146 | config ERRATA_THEAD_GHOSTWRITE | |
| 161 | 147 | bool "Apply T-Head Ghostwrite errata" | |
| 162 | 148 | depends on ERRATA_THEAD && RISCV_ISA_XTHEADVECTOR | |
| 163 | - | select RISCV_ALTERNATIVE_EARLY | |
| 164 | 149 | default y | |
| 165 | 150 | help | |
| 166 | 151 | The T-Head C9xx cores have a vulnerability in the xtheadvector | |
modified arch/riscv/Kconfig.socs
| @@ -34,7 +34,6 @@ config ARCH_RENESAS | |||
| 34 | 34 | config ARCH_SIFIVE | |
| 35 | 35 | bool "SiFive SoCs" | |
| 36 | 36 | select ERRATA_SIFIVE | |
| 37 | - | depends on 64BIT | |
| 38 | 37 | help | |
| 39 | 38 | This enables support for SiFive SoC platform hardware. | |
| 40 | 39 | ||
modified arch/riscv/errata/sifive/errata.c
| @@ -51,22 +51,6 @@ static bool errata_cip_1200_check_func(unsigned long arch_id, unsigned long imp | |||
| 51 | 51 | return true; | |
| 52 | 52 | } | |
| 53 | 53 | ||
| 54 | - | static bool errata_mal_9092_check_func(unsigned long arch_id, unsigned long impid) | |
| 55 | - | { | |
| 56 | - | /* | |
| 57 | - | * Affected cores: | |
| 58 | - | * Architecture ID: 0x8000000000000109 | |
| 59 | - | * Implementation ID: 0x19251031, 0x19251217, 0x19260320 | |
| 60 | - | */ | |
| 61 | - | ||
| 62 | - | if (arch_id != 0x8000000000000109) | |
| 63 | - | return false; | |
| 64 | - | if (impid != 0x19251031 && impid != 0x19251217 && impid != 0x19260320) | |
| 65 | - | return false; | |
| 66 | - | ||
| 67 | - | return true; | |
| 68 | - | } | |
| 69 | - | ||
| 70 | 54 | static struct errata_info_t errata_list[ERRATA_SIFIVE_NUMBER] = { | |
| 71 | 55 | { | |
| 72 | 56 | .name = "cip-453", | |
| @@ -76,10 +60,6 @@ static struct errata_info_t errata_list[ERRATA_SIFIVE_NUMBER] = { | |||
| 76 | 60 | .name = "cip-1200", | |
| 77 | 61 | .check_func = errata_cip_1200_check_func | |
| 78 | 62 | }, | |
| 79 | - | { | |
| 80 | - | .name = "mal-9092", | |
| 81 | - | .check_func = errata_mal_9092_check_func | |
| 82 | - | }, | |
| 83 | 63 | }; | |
| 84 | 64 | ||
| 85 | 65 | static u32 __init_or_module sifive_errata_probe(unsigned long archid, | |
modified arch/riscv/include/asm/cpufeature.h
| @@ -40,8 +40,6 @@ extern u32 thead_vlenb_of; | |||
| 40 | 40 | ||
| 41 | 41 | void __init riscv_user_isa_enable(void); | |
| 42 | 42 | ||
| 43 | - | void riscv_clear_hypervisor_csr(void); | |
| 44 | - | ||
| 45 | 43 | #define _RISCV_ISA_EXT_DATA(_name, _id, _subset_exts, _subset_exts_size, _validate) { \ | |
| 46 | 44 | .name = #_name, \ | |
| 47 | 45 | .property = #_name, \ | |
modified arch/riscv/include/asm/errata_list_vendors.h
| @@ -11,8 +11,7 @@ | |||
| 11 | 11 | #ifdef CONFIG_ERRATA_SIFIVE | |
| 12 | 12 | #define ERRATA_SIFIVE_CIP_453 0 | |
| 13 | 13 | #define ERRATA_SIFIVE_CIP_1200 1 | |
| 14 | - | #define ERRATA_SIFIVE_MAL_9092 2 | |
| 15 | - | #define ERRATA_SIFIVE_NUMBER 3 | |
| 14 | + | #define ERRATA_SIFIVE_NUMBER 2 | |
| 16 | 15 | #endif | |
| 17 | 16 | ||
| 18 | 17 | #ifdef CONFIG_ERRATA_THEAD | |
modified arch/riscv/include/asm/futex.h
| @@ -40,7 +40,6 @@ arch_futex_atomic_op_inuser(int op, int oparg, int *oval, u32 __user *uaddr) | |||
| 40 | 40 | ||
| 41 | 41 | if (!access_ok(uaddr, sizeof(u32))) | |
| 42 | 42 | return -EFAULT; | |
| 43 | - | uaddr = untagged_addr(uaddr); | |
| 44 | 43 | ||
| 45 | 44 | switch (op) { | |
| 46 | 45 | case FUTEX_OP_SET: | |
| @@ -83,7 +82,6 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, | |||
| 83 | 82 | ||
| 84 | 83 | if (!access_ok(uaddr, sizeof(u32))) | |
| 85 | 84 | return -EFAULT; | |
| 86 | - | uaddr = untagged_addr(uaddr); | |
| 87 | 85 | ||
| 88 | 86 | __enable_user_access(); | |
| 89 | 87 | __asm__ __volatile__ ( | |
modified arch/riscv/include/asm/insn-def.h
| @@ -192,28 +192,18 @@ | |||
| 192 | 192 | INSN_R(OPCODE_SYSTEM, FUNC3(0), FUNC7(49), \ | |
| 193 | 193 | __RD(0), RS1(gaddr), RS2(vmid)) | |
| 194 | 194 | ||
| 195 | - | #define ALT_SIFIVE_MAL_9092_FENCE \ | |
| 196 | - | ALTERNATIVE("nop", "fence rw, rw", SIFIVE_VENDOR_ID, \ | |
| 197 | - | ERRATA_SIFIVE_MAL_9092, CONFIG_ERRATA_SIFIVE_MAL_9092) | |
| 198 | - | ||
| 199 | 195 | #define HLVX_HU(dest, addr) \ | |
| 200 | - | ALT_SIFIVE_MAL_9092_FENCE "\n" \ | |
| 201 | 196 | INSN_R(OPCODE_SYSTEM, FUNC3(4), FUNC7(50), \ | |
| 202 | - | RD(dest), RS1(addr), __RS2(3)) "\n" \ | |
| 203 | - | ALT_SIFIVE_MAL_9092_FENCE | |
| 197 | + | RD(dest), RS1(addr), __RS2(3)) | |
| 204 | 198 | ||
| 205 | 199 | #define HLV_W(dest, addr) \ | |
| 206 | - | ALT_SIFIVE_MAL_9092_FENCE "\n" \ | |
| 207 | 200 | INSN_R(OPCODE_SYSTEM, FUNC3(4), FUNC7(52), \ | |
| 208 | - | RD(dest), RS1(addr), __RS2(0)) "\n" \ | |
| 209 | - | ALT_SIFIVE_MAL_9092_FENCE | |
| 201 | + | RD(dest), RS1(addr), __RS2(0)) | |
| 210 | 202 | ||
| 211 | 203 | #ifdef CONFIG_64BIT | |
| 212 | 204 | #define HLV_D(dest, addr) \ | |
| 213 | - | ALT_SIFIVE_MAL_9092_FENCE "\n" \ | |
| 214 | 205 | INSN_R(OPCODE_SYSTEM, FUNC3(4), FUNC7(54), \ | |
| 215 | - | RD(dest), RS1(addr), __RS2(0)) "\n" \ | |
| 216 | - | ALT_SIFIVE_MAL_9092_FENCE | |
| 206 | + | RD(dest), RS1(addr), __RS2(0)) | |
| 217 | 207 | #else | |
| 218 | 208 | #define HLV_D(dest, addr) \ | |
| 219 | 209 | __ASM_STR(.error "hlv.d requires 64-bit support") | |
modified arch/riscv/include/asm/scs.h
| @@ -4,7 +4,6 @@ | |||
| 4 | 4 | ||
| 5 | 5 | #ifdef __ASSEMBLER__ | |
| 6 | 6 | #include <asm/asm-offsets.h> | |
| 7 | - | #include <asm/csr.h> | |
| 8 | 7 | ||
| 9 | 8 | #ifdef CONFIG_SHADOW_CALL_STACK | |
| 10 | 9 | ||
| @@ -23,17 +22,9 @@ | |||
| 23 | 22 | REG_L gp, TASK_TI_SCS_SP(tp) | |
| 24 | 23 | .endm | |
| 25 | 24 | ||
| 26 | - | /* | |
| 27 | - | * Load task_scs_sp(current) to gp, but only when the trap came from U-mode. | |
| 28 | - | * The source privilege level is taken from the saved sstatus.SPP bit (written | |
| 29 | - | * by hardware on trap entry), not by comparing tp. tp is a user-writable | |
| 30 | - | * register, so gating the shadow call stack reload on it let a user task that | |
| 31 | - | * set tp == ¤t skip the reload and run the kernel with an attacker | |
| 32 | - | * controlled gp (the shadow call stack pointer). | |
| 33 | - | */ | |
| 34 | - | .macro scs_load_current_if_from_user status, tmp | |
| 35 | - | andi \tmp, \status, SR_SPP | |
| 36 | - | bnez \tmp, _skip_scs | |
| 25 | + | /* Load task_scs_sp(current) to gp, but only if tp has changed. */ | |
| 26 | + | .macro scs_load_current_if_task_changed prev | |
| 27 | + | beq \prev, tp, _skip_scs | |
| 37 | 28 | scs_load_current | |
| 38 | 29 | _skip_scs: | |
| 39 | 30 | .endm | |
| @@ -51,7 +42,7 @@ _skip_scs: | |||
| 51 | 42 | .endm | |
| 52 | 43 | .macro scs_load_current | |
| 53 | 44 | .endm | |
| 54 | - | .macro scs_load_current_if_from_user status, tmp | |
| 45 | + | .macro scs_load_current_if_task_changed prev | |
| 55 | 46 | .endm | |
| 56 | 47 | .macro scs_save_current | |
| 57 | 48 | .endm | |
modified arch/riscv/include/asm/vector.h
| @@ -137,8 +137,8 @@ static __always_inline void __vstate_csr_save(struct __riscv_v_ext_state *dest) | |||
| 137 | 137 | "csrr %0, " __stringify(CSR_VSTART) "\n\t" | |
| 138 | 138 | "csrr %1, " __stringify(CSR_VTYPE) "\n\t" | |
| 139 | 139 | "csrr %2, " __stringify(CSR_VL) "\n\t" | |
| 140 | - | : "=r" (dest->vstart), "=r" (dest->vtype), "=r" (dest->vl) | |
| 141 | - | : :); | |
| 140 | + | : "=r" (dest->vstart), "=r" (dest->vtype), "=r" (dest->vl), | |
| 141 | + | "=r" (dest->vcsr) : :); | |
| 142 | 142 | ||
| 143 | 143 | if (has_xtheadvector()) { | |
| 144 | 144 | unsigned long status; | |
| @@ -230,7 +230,7 @@ static inline void __riscv_v_vstate_save(struct __riscv_v_ext_state *save_to, | |||
| 230 | 230 | "add %1, %1, %0\n\t" | |
| 231 | 231 | "vse8.v v24, (%1)\n\t" | |
| 232 | 232 | ".option pop\n\t" | |
| 233 | - | : "=&r" (vl), "+r" (datap) : : "memory"); | |
| 233 | + | : "=&r" (vl) : "r" (datap) : "memory"); | |
| 234 | 234 | } | |
| 235 | 235 | riscv_v_disable(); | |
| 236 | 236 | } | |
| @@ -266,7 +266,7 @@ static inline void __riscv_v_vstate_restore(struct __riscv_v_ext_state *restore_ | |||
| 266 | 266 | "add %1, %1, %0\n\t" | |
| 267 | 267 | "vle8.v v24, (%1)\n\t" | |
| 268 | 268 | ".option pop\n\t" | |
| 269 | - | : "=&r" (vl), "+r" (datap) : : "memory"); | |
| 269 | + | : "=&r" (vl) : "r" (datap) : "memory"); | |
| 270 | 270 | } | |
| 271 | 271 | __vstate_csr_restore(restore_from); | |
| 272 | 272 | riscv_v_disable(); | |
modified arch/riscv/include/uapi/asm/vendor/mips.h
| @@ -1,5 +1,3 @@ | |||
| 1 | 1 | /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ | |
| 2 | 2 | ||
| 3 | - | #include <linux/const.h> | |
| 4 | - | ||
| 5 | - | #define RISCV_HWPROBE_VENDOR_EXT_XMIPSEXECTL _BITULL(0) | |
| 3 | + | #define RISCV_HWPROBE_VENDOR_EXT_XMIPSEXECTL BIT(0) | |
modified arch/riscv/kernel/cpufeature.c
| @@ -1233,18 +1233,6 @@ void __init riscv_user_isa_enable(void) | |||
| 1233 | 1233 | pr_warn("Zicbop disabled as it is unavailable on some harts\n"); | |
| 1234 | 1234 | } | |
| 1235 | 1235 | ||
| 1236 | - | void riscv_clear_hypervisor_csr(void) | |
| 1237 | - | { | |
| 1238 | - | if (!riscv_has_extension_unlikely(RISCV_ISA_EXT_H)) | |
| 1239 | - | return; | |
| 1240 | - | ||
| 1241 | - | /* | |
| 1242 | - | * Clear HSTATUS.HU to restrict hypervisor instructions to HS-mode. | |
| 1243 | - | * This prevents user-mode from executing HLV/HSV instructions. | |
| 1244 | - | */ | |
| 1245 | - | csr_clear(CSR_HSTATUS, HSTATUS_HU); | |
| 1246 | - | } | |
| 1247 | - | ||
| 1248 | 1236 | #ifdef CONFIG_RISCV_ALTERNATIVE | |
| 1249 | 1237 | /* | |
| 1250 | 1238 | * Alternative patch sites consider 48 bits when determining when to patch | |
modified arch/riscv/kernel/entry.S
| @@ -208,7 +208,7 @@ SYM_CODE_START(handle_exception) | |||
| 208 | 208 | load_global_pointer | |
| 209 | 209 | ||
| 210 | 210 | /* Load the kernel shadow call stack pointer if coming from userspace */ | |
| 211 | - | scs_load_current_if_from_user s1, s5 | |
| 211 | + | scs_load_current_if_task_changed s5 | |
| 212 | 212 | ||
| 213 | 213 | #ifdef CONFIG_RISCV_ISA_V_PREEMPTIVE | |
| 214 | 214 | move a0, sp | |
modified arch/riscv/kernel/patch.c
| @@ -48,7 +48,7 @@ static __always_inline void *patch_map(void *addr, const unsigned int fixmap) | |||
| 48 | 48 | if (!IS_ENABLED(CONFIG_STRICT_KERNEL_RWX)) | |
| 49 | 49 | return addr; | |
| 50 | 50 | phys = __pa_symbol(addr); | |
| 51 | - | } else if (IS_ENABLED(CONFIG_EXECMEM)) { | |
| 51 | + | } else if (IS_ENABLED(CONFIG_STRICT_MODULE_RWX)) { | |
| 52 | 52 | struct page *page = vmalloc_to_page(addr); | |
| 53 | 53 | ||
| 54 | 54 | BUG_ON(!page); | |
modified arch/riscv/kernel/ptrace.c
| @@ -230,7 +230,6 @@ static int riscv_vr_set(struct task_struct *target, | |||
| 230 | 230 | return -ENODATA; | |
| 231 | 231 | ||
| 232 | 232 | /* Copy rest of the vstate except datap */ | |
| 233 | - | memset(&ptrace_vstate, 0, sizeof(ptrace_vstate)); | |
| 234 | 233 | ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &ptrace_vstate, 0, | |
| 235 | 234 | sizeof(struct __riscv_v_regset_state)); | |
| 236 | 235 | if (unlikely(ret)) | |
| @@ -300,9 +299,6 @@ static int riscv_cfi_get(struct task_struct *target, | |||
| 300 | 299 | struct user_cfi_state user_cfi; | |
| 301 | 300 | struct pt_regs *regs; | |
| 302 | 301 | ||
| 303 | - | if (!is_user_lpad_enabled() && !is_user_shstk_enabled()) | |
| 304 | - | return -EINVAL; | |
| 305 | - | ||
| 306 | 302 | memset(&user_cfi, 0, sizeof(user_cfi)); | |
| 307 | 303 | regs = task_pt_regs(target); | |
| 308 | 304 | ||
| @@ -341,12 +337,8 @@ static int riscv_cfi_set(struct task_struct *target, | |||
| 341 | 337 | struct user_cfi_state user_cfi; | |
| 342 | 338 | struct pt_regs *regs; | |
| 343 | 339 | ||
| 344 | - | if (!is_user_lpad_enabled() && !is_user_shstk_enabled()) | |
| 345 | - | return -EINVAL; | |
| 346 | - | ||
| 347 | 340 | regs = task_pt_regs(target); | |
| 348 | 341 | ||
| 349 | - | memset(&user_cfi, 0, sizeof(user_cfi)); | |
| 350 | 342 | ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &user_cfi, 0, -1); | |
| 351 | 343 | if (ret) | |
| 352 | 344 | return ret; | |
modified arch/riscv/kernel/setup.c
| @@ -366,8 +366,6 @@ void __init setup_arch(char **cmdline_p) | |||
| 366 | 366 | ||
| 367 | 367 | if (!IS_ENABLED(CONFIG_RISCV_ISA_ZBB) || !riscv_isa_extension_available(NULL, ZBB)) | |
| 368 | 368 | static_branch_disable(&efficient_ffs_key); | |
| 369 | - | ||
| 370 | - | riscv_clear_hypervisor_csr(); | |
| 371 | 369 | } | |
| 372 | 370 | ||
| 373 | 371 | bool arch_cpu_is_hotpluggable(int cpu) | |
modified arch/riscv/kernel/smpboot.c
| @@ -244,8 +244,6 @@ asmlinkage __visible void smp_callin(void) | |||
| 244 | 244 | ||
| 245 | 245 | numa_add_cpu(curr_cpuid); | |
| 246 | 246 | ||
| 247 | - | riscv_clear_hypervisor_csr(); | |
| 248 | - | ||
| 249 | 247 | pr_debug("CPU%u: Booted secondary hartid %lu\n", curr_cpuid, | |
| 250 | 248 | cpuid_to_hartid_map(curr_cpuid)); | |
| 251 | 249 | ||
modified arch/riscv/kernel/suspend.c
| @@ -43,8 +43,6 @@ void suspend_save_csrs(struct suspend_context *context) | |||
| 43 | 43 | ||
| 44 | 44 | void suspend_restore_csrs(struct suspend_context *context) | |
| 45 | 45 | { | |
| 46 | - | riscv_clear_hypervisor_csr(); | |
| 47 | - | ||
| 48 | 46 | csr_write(CSR_SCRATCH, 0); | |
| 49 | 47 | if (riscv_has_extension_unlikely(RISCV_ISA_EXT_XLINUXENVCFG)) | |
| 50 | 48 | csr_write(CSR_ENVCFG, context->envcfg); | |
modified arch/riscv/kernel/vdso/Makefile
| @@ -36,7 +36,6 @@ endif | |||
| 36 | 36 | ccflags-y := -fno-stack-protector | |
| 37 | 37 | ccflags-y += -DDISABLE_BRANCH_PROFILING | |
| 38 | 38 | ccflags-y += -fno-builtin | |
| 39 | - | ccflags-y += $(CONFIG_CC_OPT_INLINE_MEMSET) | |
| 40 | 39 | ccflags-y += $(KBUILD_BASE_ISA)$(CFI_MARCH) | |
| 41 | 40 | ccflags-y += $(CFI_FULL) | |
| 42 | 41 | asflags-y += $(KBUILD_BASE_ISA)$(CFI_MARCH) | |
modified arch/riscv/kvm/aia_device.c
| @@ -237,7 +237,7 @@ static int aia_init(struct kvm *kvm) | |||
| 237 | 237 | return -EBUSY; | |
| 238 | 238 | ||
| 239 | 239 | /* We might be in the middle of creating a VCPU? */ | |
| 240 | - | if (kvm_is_vcpu_creation_in_progress(kvm)) | |
| 240 | + | if (kvm->created_vcpus != atomic_read(&kvm->online_vcpus)) | |
| 241 | 241 | return -EBUSY; | |
| 242 | 242 | ||
| 243 | 243 | /* Number of sources should be less than or equals number of IDs */ | |
modified arch/riscv/lib/strnlen.S
| @@ -87,25 +87,9 @@ strnlen_zbb: | |||
| 87 | 87 | * Aligned boundary. Use the address of the last valid byte | |
| 88 | 88 | * (s + count - 1) to avoid loading a word past the count | |
| 89 | 89 | * boundary in the loop below. count == 0 is handled above. | |
| 90 | - | * | |
| 91 | - | * Saturate the boundary when s + count would wrap around (very | |
| 92 | - | * large counts, e.g. SIZE_MAX passed by FORTIFY strcat/strlcat | |
| 93 | - | * with a destination whose size is unknown at compile time). | |
| 94 | - | * Without this, the wrapped boundary lands before s and the | |
| 95 | - | * pre-loop guard below always exits, returning a truncated | |
| 96 | - | * length. | |
| 97 | - | * | |
| 98 | - | * Clamping the increment to ~s (== SIZE_MAX - s) keeps the | |
| 99 | - | * computation branchless and wrap-free: | |
| 100 | - | * | |
| 101 | - | * s + min(count - 1, ~s) == saturating_add(s, count - 1) | |
| 102 | - | * | |
| 103 | - | * Saturating makes the scan equivalent to strlen(). | |
| 104 | 90 | */ | |
| 105 | - | addi t4, a1, -1 /* count - 1 */ | |
| 106 | - | not t1, a0 /* SIZE_MAX - s */ | |
| 107 | - | minu t4, t4, t1 /* clamp, so s + t4 can never wrap */ | |
| 108 | - | add t4, a0, t4 /* saturated s + count - 1 */ | |
| 91 | + | add t4, a0, a1 | |
| 92 | + | addi t4, t4, -1 | |
| 109 | 93 | andi t4, t4, -SZREG | |
| 110 | 94 | ||
| 111 | 95 | /* Get the first word. */ | |
modified arch/riscv/mm/extable.c
| @@ -68,8 +68,8 @@ ex_handler_load_unaligned_zeropad(const struct exception_table_entry *ex, | |||
| 68 | 68 | ||
| 69 | 69 | addr = regs_get_gpr(regs, reg_addr * sizeof(unsigned long)); | |
| 70 | 70 | ||
| 71 | - | offset = addr & (sizeof(data) - 1); | |
| 72 | - | addr &= ~(sizeof(data) - 1); | |
| 71 | + | offset = addr & 0x7UL; | |
| 72 | + | addr &= ~0x7UL; | |
| 73 | 73 | ||
| 74 | 74 | data = *(unsigned long *)addr >> (offset * 8); | |
| 75 | 75 | ||
modified arch/riscv/net/bpf_jit_comp64.c
| @@ -822,24 +822,6 @@ static int gen_jump_or_nops(void *target, void *ip, u32 *insns, bool is_call) | |||
| 822 | 822 | return emit_jump_and_link(is_call ? RV_REG_T0 : RV_REG_ZERO, rvoff, false, &ctx); | |
| 823 | 823 | } | |
| 824 | 824 | ||
| 825 | - | int arch_bpf_trampoline_skip(void *nop, void *target) | |
| 826 | - | { | |
| 827 | - | u32 old_insn = rv_nop(); | |
| 828 | - | u32 new_insn = rv_jal(RV_REG_ZERO, (target - nop) >> 1); | |
| 829 | - | int ret; | |
| 830 | - | ||
| 831 | - | if (memcmp(nop, &old_insn, sizeof(old_insn))) | |
| 832 | - | return -EFAULT; | |
| 833 | - | ||
| 834 | - | cpus_read_lock(); | |
| 835 | - | mutex_lock(&text_mutex); | |
| 836 | - | ret = patch_text(nop, &new_insn, sizeof(new_insn)); | |
| 837 | - | mutex_unlock(&text_mutex); | |
| 838 | - | cpus_read_unlock(); | |
| 839 | - | ||
| 840 | - | return ret; | |
| 841 | - | } | |
| 842 | - | ||
| 843 | 825 | int bpf_arch_text_poke(void *ip, enum bpf_text_poke_type old_t, | |
| 844 | 826 | enum bpf_text_poke_type new_t, void *old_addr, | |
| 845 | 827 | void *new_addr) | |
| @@ -922,17 +904,12 @@ static void emit_store_stack_imm64(u8 reg, int stack_off, u64 imm64, | |||
| 922 | 904 | emit_sd(RV_REG_FP, stack_off, reg, ctx); | |
| 923 | 905 | } | |
| 924 | 906 | ||
| 925 | - | static int invoke_bpf_prog(struct bpf_tramp_image *im, struct bpf_tramp_node *node, | |
| 926 | - | int args_off, int retval_off, int run_ctx_off, bool save_ret, | |
| 927 | - | struct rv_jit_context *ctx) | |
| 907 | + | static int invoke_bpf_prog(struct bpf_tramp_node *node, int args_off, int retval_off, | |
| 908 | + | int run_ctx_off, bool save_ret, struct rv_jit_context *ctx) | |
| 928 | 909 | { | |
| 929 | 910 | int ret, branch_off; | |
| 930 | 911 | struct bpf_prog *p = node->link->prog; | |
| 931 | 912 | int cookie_off = offsetof(struct bpf_tramp_run_ctx, bpf_cookie); | |
| 932 | - | void *skip = ctx->ro_insns + ctx->ninsns; | |
| 933 | - | ||
| 934 | - | /* nop, patched to a jal over this prog when it is detached */ | |
| 935 | - | emit(rv_nop(), ctx); | |
| 936 | 913 | ||
| 937 | 914 | if (node->cookie) | |
| 938 | 915 | emit_store_stack_imm64(RV_REG_T1, -run_ctx_off + cookie_off, node->cookie, ctx); | |
| @@ -985,17 +962,13 @@ static int invoke_bpf_prog(struct bpf_tramp_image *im, struct bpf_tramp_node *no | |||
| 985 | 962 | /* arg3: &run_ctx */ | |
| 986 | 963 | emit_addi(RV_REG_A2, RV_REG_FP, -run_ctx_off, ctx); | |
| 987 | 964 | ret = emit_call((const u64)bpf_trampoline_exit(p), true, ctx); | |
| 988 | - | if (ret) | |
| 989 | - | return ret; | |
| 990 | 965 | ||
| 991 | - | bpf_tramp_image_add_skip(im, p, skip, ctx->ro_insns + ctx->ninsns); | |
| 992 | - | return 0; | |
| 966 | + | return ret; | |
| 993 | 967 | } | |
| 994 | 968 | ||
| 995 | - | static int invoke_bpf(struct bpf_tramp_image *im, struct bpf_tramp_nodes *tn, | |
| 996 | - | int args_off, int retval_off, int run_ctx_off, int func_meta_off, | |
| 997 | - | bool save_ret, u64 func_meta, int cookie_off, | |
| 998 | - | struct rv_jit_context *ctx) | |
| 969 | + | static int invoke_bpf(struct bpf_tramp_nodes *tn, int args_off, int retval_off, | |
| 970 | + | int run_ctx_off, int func_meta_off, bool save_ret, u64 func_meta, | |
| 971 | + | int cookie_off, struct rv_jit_context *ctx) | |
| 999 | 972 | { | |
| 1000 | 973 | int i, cur_cookie = (cookie_off - args_off) / 8; | |
| 1001 | 974 | ||
| @@ -1008,8 +981,8 @@ static int invoke_bpf(struct bpf_tramp_image *im, struct bpf_tramp_nodes *tn, | |||
| 1008 | 981 | emit_store_stack_imm64(RV_REG_T1, -func_meta_off, meta, ctx); | |
| 1009 | 982 | cur_cookie--; | |
| 1010 | 983 | } | |
| 1011 | - | err = invoke_bpf_prog(im, tn->nodes[i], args_off, retval_off, | |
| 1012 | - | run_ctx_off, save_ret, ctx); | |
| 984 | + | err = invoke_bpf_prog(tn->nodes[i], args_off, retval_off, run_ctx_off, | |
| 985 | + | save_ret, ctx); | |
| 1013 | 986 | if (err) | |
| 1014 | 987 | return err; | |
| 1015 | 988 | } | |
| @@ -1197,7 +1170,7 @@ static int __arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, | |||
| 1197 | 1170 | } | |
| 1198 | 1171 | ||
| 1199 | 1172 | if (fentry->nr_nodes) { | |
| 1200 | - | ret = invoke_bpf(im, fentry, args_off, retval_off, run_ctx_off, func_meta_off, | |
| 1173 | + | ret = invoke_bpf(fentry, args_off, retval_off, run_ctx_off, func_meta_off, | |
| 1201 | 1174 | flags & BPF_TRAMP_F_RET_FENTRY_RET, func_meta, cookie_off, ctx); | |
| 1202 | 1175 | if (ret) | |
| 1203 | 1176 | return ret; | |
| @@ -1211,7 +1184,7 @@ static int __arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, | |||
| 1211 | 1184 | /* cleanup to avoid garbage return value confusion */ | |
| 1212 | 1185 | emit_sd(RV_REG_FP, -retval_off, RV_REG_ZERO, ctx); | |
| 1213 | 1186 | for (i = 0; i < fmod_ret->nr_nodes; i++) { | |
| 1214 | - | ret = invoke_bpf_prog(im, fmod_ret->nodes[i], args_off, retval_off, | |
| 1187 | + | ret = invoke_bpf_prog(fmod_ret->nodes[i], args_off, retval_off, | |
| 1215 | 1188 | run_ctx_off, true, ctx); | |
| 1216 | 1189 | if (ret) | |
| 1217 | 1190 | goto out; | |
| @@ -1238,6 +1211,10 @@ static int __arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, | |||
| 1238 | 1211 | emit_sd(RV_REG_FP, -tcc_off, RV_REG_TCC, ctx); | |
| 1239 | 1212 | emit_sd(RV_REG_FP, -retval_off, RV_REG_A0, ctx); | |
| 1240 | 1213 | emit_sd(RV_REG_FP, -(retval_off - 8), regmap[BPF_REG_0], ctx); | |
| 1214 | + | im->ip_after_call = ctx->ro_insns + ctx->ninsns; | |
| 1215 | + | /* 2 nops reserved for auipc+jalr pair */ | |
| 1216 | + | emit(rv_nop(), ctx); | |
| 1217 | + | emit(rv_nop(), ctx); | |
| 1241 | 1218 | } | |
| 1242 | 1219 | ||
| 1243 | 1220 | /* update branches saved in invoke_bpf_mod_ret with bnez */ | |
| @@ -1253,13 +1230,14 @@ static int __arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, | |||
| 1253 | 1230 | emit_store_stack_imm64(RV_REG_T1, -func_meta_off, func_meta, ctx); | |
| 1254 | 1231 | ||
| 1255 | 1232 | if (fexit->nr_nodes) { | |
| 1256 | - | ret = invoke_bpf(im, fexit, args_off, retval_off, run_ctx_off, func_meta_off, | |
| 1233 | + | ret = invoke_bpf(fexit, args_off, retval_off, run_ctx_off, func_meta_off, | |
| 1257 | 1234 | false, func_meta, cookie_off, ctx); | |
| 1258 | 1235 | if (ret) | |
| 1259 | 1236 | goto out; | |
| 1260 | 1237 | } | |
| 1261 | 1238 | ||
| 1262 | 1239 | if (flags & BPF_TRAMP_F_CALL_ORIG) { | |
| 1240 | + | im->ip_epilogue = ctx->ro_insns + ctx->ninsns; | |
| 1263 | 1241 | emit_imm(RV_REG_A0, ctx->insns ? (const s64)im : RV_MAX_COUNT_IMM, ctx); | |
| 1264 | 1242 | ret = emit_call((const u64)__bpf_tramp_exit, true, ctx); | |
| 1265 | 1243 | if (ret) | |
| @@ -1321,7 +1299,7 @@ out: | |||
| 1321 | 1299 | int arch_bpf_trampoline_size(const struct btf_func_model *m, u32 flags, | |
| 1322 | 1300 | struct bpf_tramp_nodes *tnodes, void *func_addr) | |
| 1323 | 1301 | { | |
| 1324 | - | struct bpf_tramp_image im = {}; | |
| 1302 | + | struct bpf_tramp_image im; | |
| 1325 | 1303 | struct rv_jit_context ctx; | |
| 1326 | 1304 | int ret; | |
| 1327 | 1305 | ||
modified arch/s390/kernel/vdso/Makefile
| @@ -29,7 +29,6 @@ KBUILD_CFLAGS_VDSO := $(filter-out -munaligned-symbols,$(KBUILD_CFLAGS_VDSO)) | |||
| 29 | 29 | KBUILD_CFLAGS_VDSO := $(filter-out -fno-asynchronous-unwind-tables,$(KBUILD_CFLAGS_VDSO)) | |
| 30 | 30 | KBUILD_CFLAGS_VDSO += -fPIC -fno-common -fno-builtin -fasynchronous-unwind-tables | |
| 31 | 31 | KBUILD_CFLAGS_VDSO += -fno-stack-protector $(DISABLE_KSTACK_ERASE) | |
| 32 | - | KBUILD_CFLAGS_VDSO += $(CONFIG_CC_OPT_INLINE_MEMSET) | |
| 33 | 32 | ldflags-y := -shared -soname=linux-vdso.so.1 \ | |
| 34 | 33 | --hash-style=both --build-id=sha1 \ | |
| 35 | 34 | $(call ld-option, --eh-frame-hdr) -T | |
modified arch/s390/kvm/s390/s390.c
| @@ -3579,11 +3579,12 @@ void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu) | |||
| 3579 | 3579 | ||
| 3580 | 3580 | void kvm_arch_vcpu_postcreate(struct kvm_vcpu *vcpu) | |
| 3581 | 3581 | { | |
| 3582 | + | mutex_lock(&vcpu->kvm->lock); | |
| 3582 | 3583 | preempt_disable(); | |
| 3583 | 3584 | vcpu->arch.sie_block->epoch = vcpu->kvm->arch.epoch; | |
| 3584 | 3585 | vcpu->arch.sie_block->epdx = vcpu->kvm->arch.epdx; | |
| 3585 | 3586 | preempt_enable(); | |
| 3586 | - | ||
| 3587 | + | mutex_unlock(&vcpu->kvm->lock); | |
| 3587 | 3588 | if (!kvm_is_ucontrol(vcpu->kvm)) { | |
| 3588 | 3589 | vcpu->arch.gmap = vcpu->kvm->arch.gmap; | |
| 3589 | 3590 | sca_add_vcpu(vcpu); | |
| @@ -3756,11 +3757,13 @@ static int kvm_s390_vcpu_setup(struct kvm_vcpu *vcpu) | |||
| 3756 | 3757 | ||
| 3757 | 3758 | kvm_s390_vcpu_pci_setup(vcpu); | |
| 3758 | 3759 | ||
| 3760 | + | mutex_lock(&vcpu->kvm->lock); | |
| 3759 | 3761 | if (kvm_s390_pv_is_protected(vcpu->kvm)) { | |
| 3760 | 3762 | rc = kvm_s390_pv_create_cpu(vcpu, &uvrc, &uvrrc); | |
| 3761 | 3763 | if (rc) | |
| 3762 | 3764 | kvm_s390_vcpu_unsetup_cmma(vcpu); | |
| 3763 | 3765 | } | |
| 3766 | + | mutex_unlock(&vcpu->kvm->lock); | |
| 3764 | 3767 | ||
| 3765 | 3768 | return rc; | |
| 3766 | 3769 | } | |
modified arch/s390/net/bpf_jit_comp.c
| @@ -2566,8 +2566,6 @@ struct bpf_tramp_jit { | |||
| 2566 | 2566 | int r14_off; /* Offset of saved %r14, has to be at the | |
| 2567 | 2567 | * bottom */ | |
| 2568 | 2568 | int do_fexit; /* do_fexit: label */ | |
| 2569 | - | int skip[BPF_MAX_TRAMP_LINKS]; /* skip: labels after each prog */ | |
| 2570 | - | int nr_progs; | |
| 2571 | 2569 | }; | |
| 2572 | 2570 | ||
| 2573 | 2571 | static void load_imm64(struct bpf_jit *jit, int dst_reg, u64 val) | |
| @@ -2586,7 +2584,6 @@ static void emit_store_stack_imm64(struct bpf_jit *jit, int tmp_reg, int stack_o | |||
| 2586 | 2584 | } | |
| 2587 | 2585 | ||
| 2588 | 2586 | static int invoke_bpf_prog(struct bpf_tramp_jit *tjit, | |
| 2589 | - | struct bpf_tramp_image *im, | |
| 2590 | 2587 | const struct btf_func_model *m, | |
| 2591 | 2588 | struct bpf_tramp_node *node, bool save_ret) | |
| 2592 | 2589 | { | |
| @@ -2594,20 +2591,8 @@ static int invoke_bpf_prog(struct bpf_tramp_jit *tjit, | |||
| 2594 | 2591 | int cookie_off = tjit->run_ctx_off + | |
| 2595 | 2592 | offsetof(struct bpf_tramp_run_ctx, bpf_cookie); | |
| 2596 | 2593 | struct bpf_prog *p = node->link->prog; | |
| 2597 | - | void *skip = jit->prg_buf + jit->prg; | |
| 2598 | - | int idx = tjit->nr_progs++; | |
| 2599 | 2594 | int patch; | |
| 2600 | 2595 | ||
| 2601 | - | if (idx >= ARRAY_SIZE(tjit->skip)) | |
| 2602 | - | return -E2BIG; | |
| 2603 | - | ||
| 2604 | - | /* | |
| 2605 | - | * nop, patched to skip this prog when it is detached | |
| 2606 | - | */ | |
| 2607 | - | ||
| 2608 | - | /* brcl 0,skip */ | |
| 2609 | - | EMIT6_PCREL_RILC(0xc0040000, 0, tjit->skip[idx]); | |
| 2610 | - | ||
| 2611 | 2596 | /* | |
| 2612 | 2597 | * run_ctx.cookie = node->cookie; | |
| 2613 | 2598 | */ | |
| @@ -2667,15 +2652,10 @@ static int invoke_bpf_prog(struct bpf_tramp_jit *tjit, | |||
| 2667 | 2652 | /* brasl %r14,__bpf_prog_exit */ | |
| 2668 | 2653 | EMIT6_PCREL_RILB_PTR(0xc0050000, REG_14, bpf_trampoline_exit(p)); | |
| 2669 | 2654 | ||
| 2670 | - | /* skip: */ | |
| 2671 | - | tjit->skip[idx] = jit->prg; | |
| 2672 | - | bpf_tramp_image_add_skip(im, p, skip, jit->prg_buf + jit->prg); | |
| 2673 | - | ||
| 2674 | 2655 | return 0; | |
| 2675 | 2656 | } | |
| 2676 | 2657 | ||
| 2677 | 2658 | static int invoke_bpf(struct bpf_tramp_jit *tjit, | |
| 2678 | - | struct bpf_tramp_image *im, | |
| 2679 | 2659 | const struct btf_func_model *m, | |
| 2680 | 2660 | struct bpf_tramp_nodes *tn, bool save_ret, | |
| 2681 | 2661 | u64 func_meta, int cookie_off) | |
| @@ -2690,7 +2670,7 @@ static int invoke_bpf(struct bpf_tramp_jit *tjit, | |||
| 2690 | 2670 | emit_store_stack_imm64(jit, REG_0, tjit->func_meta_off, meta); | |
| 2691 | 2671 | cur_cookie--; | |
| 2692 | 2672 | } | |
| 2693 | - | if (invoke_bpf_prog(tjit, im, m, tn->nodes[i], save_ret)) | |
| 2673 | + | if (invoke_bpf_prog(tjit, m, tn->nodes[i], save_ret)) | |
| 2694 | 2674 | return -EINVAL; | |
| 2695 | 2675 | } | |
| 2696 | 2676 | ||
| @@ -2732,11 +2712,6 @@ static int __arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, | |||
| 2732 | 2712 | u64 func_meta; | |
| 2733 | 2713 | int i, j; | |
| 2734 | 2714 | ||
| 2735 | - | /* The skip labels are taken from the previous pass. */ | |
| 2736 | - | tjit->nr_progs = 0; | |
| 2737 | - | if (im) | |
| 2738 | - | im->nr_skips = 0; | |
| 2739 | - | ||
| 2740 | 2715 | /* Support as many stack arguments as "mvc" instruction can handle. */ | |
| 2741 | 2716 | nr_reg_args = min_t(int, m->nr_args, MAX_NR_REG_ARGS); | |
| 2742 | 2717 | nr_stack_args = m->nr_args - nr_reg_args; | |
| @@ -2900,7 +2875,7 @@ static int __arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, | |||
| 2900 | 2875 | emit_store_stack_imm64(jit, REG_0, tjit->retval_off, 0); | |
| 2901 | 2876 | } | |
| 2902 | 2877 | ||
| 2903 | - | if (invoke_bpf(tjit, im, m, fentry, flags & BPF_TRAMP_F_RET_FENTRY_RET, | |
| 2878 | + | if (invoke_bpf(tjit, m, fentry, flags & BPF_TRAMP_F_RET_FENTRY_RET, | |
| 2904 | 2879 | func_meta, cookie_off)) | |
| 2905 | 2880 | return -EINVAL; | |
| 2906 | 2881 | ||
| @@ -2914,7 +2889,7 @@ static int __arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, | |||
| 2914 | 2889 | 0xf000 | tjit->retval_off); | |
| 2915 | 2890 | ||
| 2916 | 2891 | for (i = 0; i < fmod_ret->nr_nodes; i++) { | |
| 2917 | - | if (invoke_bpf_prog(tjit, im, m, fmod_ret->nodes[i], true)) | |
| 2892 | + | if (invoke_bpf_prog(tjit, m, fmod_ret->nodes[i], true)) | |
| 2918 | 2893 | return -EINVAL; | |
| 2919 | 2894 | ||
| 2920 | 2895 | /* | |
| @@ -2968,6 +2943,15 @@ static int __arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, | |||
| 2968 | 2943 | /* mvc tccnt_off(%r15),tail_call_cnt(4,%r15) */ | |
| 2969 | 2944 | _EMIT6(0xd203f000 | tjit->tccnt_off, | |
| 2970 | 2945 | 0xf000 | offsetof(struct prog_frame, tail_call_cnt)); | |
| 2946 | + | ||
| 2947 | + | im->ip_after_call = jit->prg_buf + jit->prg; | |
| 2948 | + | ||
| 2949 | + | /* | |
| 2950 | + | * The following nop will be patched by bpf_tramp_image_put(). | |
| 2951 | + | */ | |
| 2952 | + | ||
| 2953 | + | /* brcl 0,im->ip_epilogue */ | |
| 2954 | + | EMIT6_PCREL_RILC(0xc0040000, 0, (u64)im->ip_epilogue); | |
| 2971 | 2955 | } | |
| 2972 | 2956 | ||
| 2973 | 2957 | /* Set the "is_return" flag for fsession. */ | |
| @@ -2978,10 +2962,12 @@ static int __arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, | |||
| 2978 | 2962 | ||
| 2979 | 2963 | /* do_fexit: */ | |
| 2980 | 2964 | tjit->do_fexit = jit->prg; | |
| 2981 | - | if (invoke_bpf(tjit, im, m, fexit, false, func_meta, cookie_off)) | |
| 2965 | + | if (invoke_bpf(tjit, m, fexit, false, func_meta, cookie_off)) | |
| 2982 | 2966 | return -EINVAL; | |
| 2983 | 2967 | ||
| 2984 | 2968 | if (flags & BPF_TRAMP_F_CALL_ORIG) { | |
| 2969 | + | im->ip_epilogue = jit->prg_buf + jit->prg; | |
| 2970 | + | ||
| 2985 | 2971 | /* | |
| 2986 | 2972 | * __bpf_tramp_exit(im); | |
| 2987 | 2973 | */ | |
| @@ -3030,7 +3016,7 @@ static int __arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, | |||
| 3030 | 3016 | int arch_bpf_trampoline_size(const struct btf_func_model *m, u32 flags, | |
| 3031 | 3017 | struct bpf_tramp_nodes *tnodes, void *orig_call) | |
| 3032 | 3018 | { | |
| 3033 | - | struct bpf_tramp_image im = {}; | |
| 3019 | + | struct bpf_tramp_image im; | |
| 3034 | 3020 | struct bpf_tramp_jit tjit; | |
| 3035 | 3021 | int ret; | |
| 3036 | 3022 | ||
modified arch/um/drivers/vector_transports.c
| @@ -209,7 +209,6 @@ static int raw_verify_header( | |||
| 209 | 209 | if ((vheader->flags & VIRTIO_NET_HDR_F_DATA_VALID) > 0) | |
| 210 | 210 | return 1; | |
| 211 | 211 | ||
| 212 | - | skb_set_network_header(skb, ETH_HLEN); | |
| 213 | 212 | virtio_net_hdr_to_skb(skb, vheader, virtio_legacy_is_little_endian()); | |
| 214 | 213 | return 0; | |
| 215 | 214 | } | |
modified arch/x86/crypto/aesni-intel_glue.c
| @@ -1293,7 +1293,6 @@ static void gcm_process_assoc(const struct aes_gcm_key *key, u8 ghash_acc[16], | |||
| 1293 | 1293 | unsigned int len; | |
| 1294 | 1294 | const u8 *src = walk.addr; | |
| 1295 | 1295 | ||
| 1296 | - | assoclen -= orig_len_this_step; | |
| 1297 | 1296 | if (unlikely(pos)) { | |
| 1298 | 1297 | len = min(len_this_step, 16 - pos); | |
| 1299 | 1298 | memcpy(&buf[pos], src, len); | |
| @@ -1321,6 +1320,7 @@ next: | |||
| 1321 | 1320 | kernel_fpu_end(); | |
| 1322 | 1321 | kernel_fpu_begin(); | |
| 1323 | 1322 | } | |
| 1323 | + | assoclen -= orig_len_this_step; | |
| 1324 | 1324 | } | |
| 1325 | 1325 | if (unlikely(pos)) | |
| 1326 | 1326 | aes_gcm_aad_update(key, ghash_acc, buf, pos, flags); | |
modified arch/x86/entry/vdso/vdso64/Makefile
| @@ -14,7 +14,7 @@ vobjs-$(CONFIG_X86_SGX) += vsgx.o | |||
| 14 | 14 | vobjs-$(CONFIG_FUTEX_ROBUST_UNLOCK) += vfutex.o | |
| 15 | 15 | ||
| 16 | 16 | # Compilation flags | |
| 17 | - | flags-y := -DBUILD_VDSO64 -m64 -mcmodel=small $(CONFIG_CC_OPT_INLINE_MEMSET) | |
| 17 | + | flags-y := -DBUILD_VDSO64 -m64 -mcmodel=small | |
| 18 | 18 | ||
| 19 | 19 | # The location of this include matters! | |
| 20 | 20 | include $(src)/../common/Makefile.include | |
modified arch/x86/include/asm/cpufeatures.h
| @@ -477,8 +477,6 @@ | |||
| 477 | 477 | #define X86_FEATURE_NO_NESTED_DATA_BP (20*32+ 0) /* No Nested Data Breakpoints */ | |
| 478 | 478 | #define X86_FEATURE_WRMSR_XX_BASE_NS (20*32+ 1) /* WRMSR to {FS,GS,KERNEL_GS}_BASE is non-serializing */ | |
| 479 | 479 | #define X86_FEATURE_LFENCE_RDTSC (20*32+ 2) /* LFENCE always serializing / synchronizes RDTSC */ | |
| 480 | - | ||
| 481 | - | #define X86_FEATURE_TLBSYNC_SFW_NO (20*32+ 4) /* TLBI Erratum #1718 fixed in microcode */ | |
| 482 | 480 | #define X86_FEATURE_VERW_CLEAR (20*32+ 5) /* The memory form of VERW mitigates TSA */ | |
| 483 | 481 | #define X86_FEATURE_NULL_SEL_CLR_BASE (20*32+ 6) /* Null Selector Clears Base */ | |
| 484 | 482 | ||
| @@ -589,5 +587,4 @@ | |||
| 589 | 587 | #define X86_BUG_TSA X86_BUG( 1*32+ 9) /* "tsa" CPU is affected by Transient Scheduler Attacks */ | |
| 590 | 588 | #define X86_BUG_VMSCAPE X86_BUG( 1*32+10) /* "vmscape" CPU is affected by VMSCAPE attacks from guests */ | |
| 591 | 589 | #define X86_BUG_SEAMRET_INVD_VMCS X86_BUG( 1*32+11) /* "seamret_invd_vmcs" SEAMRET from P-SEAMLDR clears the current VMCS */ | |
| 592 | - | #define X86_BUG_TLBI X86_BUG( 1*32+12) /* "tlbi" AMD TLBI Erratum #1718 */ | |
| 593 | 590 | #endif /* _ASM_X86_CPUFEATURES_H */ | |
modified arch/x86/include/asm/tlb.h
| @@ -110,12 +110,6 @@ static inline void __tlbsync(void) | |||
| 110 | 110 | ||
| 111 | 111 | /* TLBSYNC: supported in binutils >= 0.36. */ | |
| 112 | 112 | asm volatile(".byte 0x0f, 0x01, 0xff" ::: "memory"); | |
| 113 | - | ||
| 114 | - | if (!static_cpu_has_bug(X86_BUG_TLBI)) | |
| 115 | - | return; | |
| 116 | - | ||
| 117 | - | /* TLBSYNC: supported in binutils >= 0.36. */ | |
| 118 | - | asm volatile(".byte 0x0f, 0x01, 0xff" ::: "memory"); | |
| 119 | 113 | } | |
| 120 | 114 | #else | |
| 121 | 115 | /* Some compilers (I'm looking at you clang!) simply can't do DCE */ | |
modified arch/x86/include/uapi/asm/ptrace-abi.h
| @@ -2,7 +2,6 @@ | |||
| 2 | 2 | #ifndef _ASM_X86_PTRACE_ABI_H | |
| 3 | 3 | #define _ASM_X86_PTRACE_ABI_H | |
| 4 | 4 | ||
| 5 | - | #if defined(__ASSEMBLER__) || defined(__FRAME_OFFSETS) | |
| 6 | 5 | #ifdef __i386__ | |
| 7 | 6 | ||
| 8 | 7 | #define EBX 0 | |
| @@ -26,6 +25,7 @@ | |||
| 26 | 25 | ||
| 27 | 26 | #else /* __i386__ */ | |
| 28 | 27 | ||
| 28 | + | #if defined(__ASSEMBLER__) || defined(__FRAME_OFFSETS) | |
| 29 | 29 | /* | |
| 30 | 30 | * C ABI says these regs are callee-preserved. They aren't saved on kernel entry | |
| 31 | 31 | * unless syscall needs a complete, fully filled "struct pt_regs". | |
| @@ -57,12 +57,12 @@ | |||
| 57 | 57 | #define EFLAGS 144 | |
| 58 | 58 | #define RSP 152 | |
| 59 | 59 | #define SS 160 | |
| 60 | + | #endif /* __ASSEMBLER__ */ | |
| 60 | 61 | ||
| 61 | 62 | /* top of stack page */ | |
| 62 | 63 | #define FRAME_SIZE 168 | |
| 63 | 64 | ||
| 64 | 65 | #endif /* !__i386__ */ | |
| 65 | - | #endif /* defined(__ASSEMBLER__) || defined(__FRAME_OFFSETS) */ | |
| 66 | 66 | ||
| 67 | 67 | /* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */ | |
| 68 | 68 | #define PTRACE_GETREGS 12 | |
modified arch/x86/kernel/cpu/amd.c
| @@ -1049,10 +1049,6 @@ static void init_amd_zen5(struct cpuinfo_x86 *c) | |||
| 1049 | 1049 | msr_clear_bit(MSR_AMD64_CPUID_FN_7, 18); | |
| 1050 | 1050 | pr_emerg_once("RDSEED32 is broken. Disabling the corresponding CPUID bit.\n"); | |
| 1051 | 1051 | } | |
| 1052 | - | ||
| 1053 | - | if (cpu_has(c, X86_FEATURE_INVLPGB) && | |
| 1054 | - | !cpu_has(c, X86_FEATURE_TLBSYNC_SFW_NO)) | |
| 1055 | - | set_cpu_bug(c, X86_BUG_TLBI); | |
| 1056 | 1052 | } | |
| 1057 | 1053 | ||
| 1058 | 1054 | static void init_amd(struct cpuinfo_x86 *c) | |
modified arch/x86/kernel/sys_x86_64.c
| @@ -50,16 +50,9 @@ static unsigned long get_align_mask(struct file *filp) | |||
| 50 | 50 | * value before calling vm_unmapped_area() or ORed directly to the | |
| 51 | 51 | * address. | |
| 52 | 52 | */ | |
| 53 | - | static unsigned long get_align_bits(struct file *filp) | |
| 53 | + | static unsigned long get_align_bits(void) | |
| 54 | 54 | { | |
| 55 | - | /* | |
| 56 | - | * va_align.bits is smaller than the huge page size and will | |
| 57 | - | * lead to misaligned huge pages. Ignore it for huge mappings. | |
| 58 | - | */ | |
| 59 | - | if (is_file_hugepages(filp)) | |
| 60 | - | return 0; | |
| 61 | - | ||
| 62 | - | return va_align.bits & get_align_mask(filp); | |
| 55 | + | return va_align.bits & get_align_mask(NULL); | |
| 63 | 56 | } | |
| 64 | 57 | ||
| 65 | 58 | static int __init control_va_addr_alignment(char *str) | |
| @@ -164,7 +157,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr, unsigned long len, | |||
| 164 | 157 | } | |
| 165 | 158 | if (filp) { | |
| 166 | 159 | info.align_mask = get_align_mask(filp); | |
| 167 | - | info.align_offset += get_align_bits(filp); | |
| 160 | + | info.align_offset += get_align_bits(); | |
| 168 | 161 | } | |
| 169 | 162 | ||
| 170 | 163 | return vm_unmapped_area(&info); | |
| @@ -229,7 +222,7 @@ get_unmapped_area: | |||
| 229 | 222 | ||
| 230 | 223 | if (filp) { | |
| 231 | 224 | info.align_mask = get_align_mask(filp); | |
| 232 | - | info.align_offset += get_align_bits(filp); | |
| 225 | + | info.align_offset += get_align_bits(); | |
| 233 | 226 | } | |
| 234 | 227 | addr = vm_unmapped_area(&info); | |
| 235 | 228 | if (!(addr & ~PAGE_MASK)) | |
modified arch/x86/kvm/mmu/mmu.c
| @@ -2512,12 +2512,6 @@ static void shadow_walk_init_using_root(struct kvm_shadow_walk_iterator *iterato | |||
| 2512 | 2512 | ||
| 2513 | 2513 | iterator->addr = addr; | |
| 2514 | 2514 | iterator->shadow_addr = root; | |
| 2515 | - | ||
| 2516 | - | if (WARN_ON_ONCE(!VALID_PAGE(root)) || kvm_mmu_is_dummy_root(root)) { | |
| 2517 | - | iterator->level = 0; | |
| 2518 | - | return; | |
| 2519 | - | } | |
| 2520 | - | ||
| 2521 | 2515 | iterator->level = vcpu->arch.mmu->root_role.level; | |
| 2522 | 2516 | ||
| 2523 | 2517 | if (iterator->level >= PT64_ROOT_4LEVEL && | |
modified arch/x86/kvm/svm/sev.c
| @@ -488,20 +488,6 @@ static void snp_guest_req_cleanup(struct kvm *kvm) | |||
| 488 | 488 | sev->guest_resp_buf = NULL; | |
| 489 | 489 | } | |
| 490 | 490 | ||
| 491 | - | static int sev_alloc_have_run_cpus(struct kvm_sev_info *sev) | |
| 492 | - | { | |
| 493 | - | if (!zalloc_cpumask_var(&sev->have_run_cpus, GFP_KERNEL_ACCOUNT)) | |
| 494 | - | return -ENOMEM; | |
| 495 | - | ||
| 496 | - | return 0; | |
| 497 | - | } | |
| 498 | - | ||
| 499 | - | static void sev_free_have_run_cpus(struct kvm_sev_info *sev) | |
| 500 | - | { | |
| 501 | - | free_cpumask_var(sev->have_run_cpus); | |
| 502 | - | memset(&sev->have_run_cpus, 0, sizeof(sev->have_run_cpus)); | |
| 503 | - | } | |
| 504 | - | ||
| 505 | 491 | static int __sev_guest_init(struct kvm *kvm, struct kvm_sev_cmd *argp, | |
| 506 | 492 | struct kvm_sev_init *data, | |
| 507 | 493 | unsigned long vm_type) | |
| @@ -559,9 +545,10 @@ static int __sev_guest_init(struct kvm *kvm, struct kvm_sev_cmd *argp, | |||
| 559 | 545 | if (ret) | |
| 560 | 546 | goto e_free_asid; | |
| 561 | 547 | ||
| 562 | - | ret = sev_alloc_have_run_cpus(sev); | |
| 563 | - | if (ret) | |
| 548 | + | if (!zalloc_cpumask_var(&sev->have_run_cpus, GFP_KERNEL_ACCOUNT)) { | |
| 549 | + | ret = -ENOMEM; | |
| 564 | 550 | goto e_free_asid; | |
| 551 | + | } | |
| 565 | 552 | ||
| 566 | 553 | /* This needs to happen after SEV/SNP firmware initialization. */ | |
| 567 | 554 | if (snp_active) { | |
| @@ -579,7 +566,7 @@ static int __sev_guest_init(struct kvm *kvm, struct kvm_sev_cmd *argp, | |||
| 579 | 566 | return 0; | |
| 580 | 567 | ||
| 581 | 568 | e_free: | |
| 582 | - | sev_free_have_run_cpus(sev); | |
| 569 | + | free_cpumask_var(sev->have_run_cpus); | |
| 583 | 570 | e_free_asid: | |
| 584 | 571 | argp->error = init_args.error; | |
| 585 | 572 | sev_asid_free(sev); | |
| @@ -1138,6 +1125,9 @@ static int sev_launch_update_vmsa(struct kvm *kvm, struct kvm_sev_cmd *argp) | |||
| 1138 | 1125 | if (!sev_es_guest(kvm)) | |
| 1139 | 1126 | return -ENOTTY; | |
| 1140 | 1127 | ||
| 1128 | + | if (kvm_is_vcpu_creation_in_progress(kvm)) | |
| 1129 | + | return -EBUSY; | |
| 1130 | + | ||
| 1141 | 1131 | ret = kvm_lock_all_vcpus(kvm); | |
| 1142 | 1132 | if (ret) | |
| 1143 | 1133 | return ret; | |
| @@ -2045,13 +2035,6 @@ static void sev_migrate_from(struct kvm *dst_kvm, struct kvm *src_kvm) | |||
| 2045 | 2035 | struct kvm_sev_info *mirror; | |
| 2046 | 2036 | unsigned long i; | |
| 2047 | 2037 | ||
| 2048 | - | /* | |
| 2049 | - | * Do cache maintenance on the source VM *before* clearing "SEV active", | |
| 2050 | - | * as memory reclaim flows won't trigger cache maintenance on the VM | |
| 2051 | - | * once it's no longer an SEV VM. | |
| 2052 | - | */ | |
| 2053 | - | sev_writeback_caches(src_kvm); | |
| 2054 | - | ||
| 2055 | 2038 | dst->active = true; | |
| 2056 | 2039 | dst->asid = src->asid; | |
| 2057 | 2040 | dst->handle = src->handle; | |
| @@ -2065,6 +2048,12 @@ static void sev_migrate_from(struct kvm *dst_kvm, struct kvm *src_kvm) | |||
| 2065 | 2048 | src->pages_locked = 0; | |
| 2066 | 2049 | src->es_active = false; | |
| 2067 | 2050 | ||
| 2051 | + | /* | |
| 2052 | + | * Do cache maintenance on the source VM as it is no longer an SEV VM, | |
| 2053 | + | * i.e. memory reclaim flows won't trigger cache maintenance on the VM. | |
| 2054 | + | */ | |
| 2055 | + | sev_writeback_caches(src_kvm); | |
| 2056 | + | ||
| 2068 | 2057 | list_cut_before(&dst->regions_list, &src->regions_list, &src->regions_list); | |
| 2069 | 2058 | ||
| 2070 | 2059 | mutex_lock(&sev_mirror_lock); | |
| @@ -2132,6 +2121,10 @@ static int sev_check_source_vcpus(struct kvm *dst, struct kvm *src) | |||
| 2132 | 2121 | struct kvm_vcpu *src_vcpu; | |
| 2133 | 2122 | unsigned long i; | |
| 2134 | 2123 | ||
| 2124 | + | if (kvm_is_vcpu_creation_in_progress(src) || | |
| 2125 | + | kvm_is_vcpu_creation_in_progress(dst)) | |
| 2126 | + | return -EBUSY; | |
| 2127 | + | ||
| 2135 | 2128 | if (!sev_es_guest(src)) | |
| 2136 | 2129 | return 0; | |
| 2137 | 2130 | ||
| @@ -2205,9 +2198,10 @@ int sev_vm_move_enc_context_from(struct kvm *kvm, unsigned int source_fd) | |||
| 2205 | 2198 | * does not, i.e. KVM could skip flushes if memory is reclaimed from | |
| 2206 | 2199 | * the old VM but not the new VM. | |
| 2207 | 2200 | */ | |
| 2208 | - | ret = sev_alloc_have_run_cpus(dst_sev); | |
| 2209 | - | if (ret) | |
| 2201 | + | if (!zalloc_cpumask_var(&dst_sev->have_run_cpus, GFP_KERNEL_ACCOUNT)) { | |
| 2202 | + | ret = -ENOMEM; | |
| 2210 | 2203 | goto out_source_vcpu; | |
| 2204 | + | } | |
| 2211 | 2205 | ||
| 2212 | 2206 | sev_migrate_from(kvm, source_kvm); | |
| 2213 | 2207 | kvm_vm_dead(source_kvm); | |
| @@ -2526,6 +2520,9 @@ static int snp_launch_update_vmsa(struct kvm *kvm, struct kvm_sev_cmd *argp) | |||
| 2526 | 2520 | unsigned long i; | |
| 2527 | 2521 | int ret; | |
| 2528 | 2522 | ||
| 2523 | + | if (kvm_is_vcpu_creation_in_progress(kvm)) | |
| 2524 | + | return -EBUSY; | |
| 2525 | + | ||
| 2529 | 2526 | ret = kvm_lock_all_vcpus(kvm); | |
| 2530 | 2527 | if (ret) | |
| 2531 | 2528 | return ret; | |
| @@ -2901,9 +2898,10 @@ int sev_vm_copy_enc_context_from(struct kvm *kvm, unsigned int source_fd) | |||
| 2901 | 2898 | } | |
| 2902 | 2899 | ||
| 2903 | 2900 | mirror_sev = to_kvm_sev_info(kvm); | |
| 2904 | - | ret = sev_alloc_have_run_cpus(mirror_sev); | |
| 2905 | - | if (ret) | |
| 2901 | + | if (!zalloc_cpumask_var(&mirror_sev->have_run_cpus, GFP_KERNEL_ACCOUNT)) { | |
| 2902 | + | ret = -ENOMEM; | |
| 2906 | 2903 | goto e_unlock; | |
| 2904 | + | } | |
| 2907 | 2905 | ||
| 2908 | 2906 | /* | |
| 2909 | 2907 | * The mirror kvm holds an enc_context_owner ref so its asid can't | |
| @@ -2996,7 +2994,7 @@ void sev_vm_destroy(struct kvm *kvm) | |||
| 2996 | 2994 | * Free the mask even if the VM is not *currently* an SEV VM, as it may | |
| 2997 | 2995 | * have been an SEV VM prior to intra-host migration. | |
| 2998 | 2996 | */ | |
| 2999 | - | sev_free_have_run_cpus(sev); | |
| 2997 | + | free_cpumask_var(sev->have_run_cpus); | |
| 3000 | 2998 | ||
| 3001 | 2999 | if (!sev_guest(kvm)) | |
| 3002 | 3000 | return; | |
| @@ -3632,6 +3630,7 @@ int pre_sev_run(struct vcpu_svm *svm, int cpu) | |||
| 3632 | 3630 | ||
| 3633 | 3631 | sd->sev_vmcbs[asid] = svm->vmcb; | |
| 3634 | 3632 | svm->vmcb->control.tlb_ctl = TLB_CONTROL_FLUSH_ASID; | |
| 3633 | + | vmcb_mark_dirty(svm->vmcb, VMCB_ASID); | |
| 3635 | 3634 | return 0; | |
| 3636 | 3635 | } | |
| 3637 | 3636 | ||
modified arch/x86/kvm/svm/svm.c
| @@ -673,7 +673,16 @@ static void clr_dr_intercepts(struct vcpu_svm *svm) | |||
| 673 | 673 | ||
| 674 | 674 | static bool msr_write_intercepted(struct vcpu_svm *svm, u32 msr) | |
| 675 | 675 | { | |
| 676 | - | void *msrpm = __va(__sme_clr(svm->vmcb->control.msrpm_base_pa)); | |
| 676 | + | /* | |
| 677 | + | * For non-nested case: | |
| 678 | + | * If the L01 MSR bitmap does not intercept the MSR, then we need to | |
| 679 | + | * save it. | |
| 680 | + | * | |
| 681 | + | * For nested case: | |
| 682 | + | * If the L02 MSR bitmap does not intercept the MSR, then we need to | |
| 683 | + | * save it. | |
| 684 | + | */ | |
| 685 | + | void *msrpm = is_guest_mode(&svm->vcpu) ? svm->nested.msrpm : svm->msrpm; | |
| 677 | 686 | ||
| 678 | 687 | return svm_test_msr_bitmap_write(msrpm, msr); | |
| 679 | 688 | } | |
| @@ -1893,7 +1902,8 @@ static void new_asid(struct vcpu_svm *svm, struct svm_cpu_data *sd) | |||
| 1893 | 1902 | if (sd->next_asid > sd->max_asid) { | |
| 1894 | 1903 | ++sd->asid_generation; | |
| 1895 | 1904 | sd->next_asid = sd->min_asid; | |
| 1896 | - | sd->flush_all_asids = true; | |
| 1905 | + | svm->vmcb->control.tlb_ctl = TLB_CONTROL_FLUSH_ALL_ASID; | |
| 1906 | + | vmcb_mark_dirty(svm->vmcb, VMCB_ASID); | |
| 1897 | 1907 | } | |
| 1898 | 1908 | ||
| 1899 | 1909 | svm->current_vmcb->asid_generation = sd->asid_generation; | |
| @@ -4518,9 +4528,6 @@ static __no_kcsan fastpath_t svm_vcpu_run(struct kvm_vcpu *vcpu, u64 run_flags) | |||
| 4518 | 4528 | svm->vmcb->control.asid = svm->asid; | |
| 4519 | 4529 | vmcb_mark_dirty(svm->vmcb, VMCB_ASID); | |
| 4520 | 4530 | } | |
| 4521 | - | if (this_cpu_ptr(&svm_data)->flush_all_asids) | |
| 4522 | - | svm->vmcb->control.tlb_ctl = TLB_CONTROL_FLUSH_ALL_ASID; | |
| 4523 | - | ||
| 4524 | 4531 | svm->vmcb->save.cr2 = vcpu->arch.cr2; | |
| 4525 | 4532 | ||
| 4526 | 4533 | if (guest_cpu_cap_has(vcpu, X86_FEATURE_ERAPS) && | |
| @@ -4611,23 +4618,16 @@ static __no_kcsan fastpath_t svm_vcpu_run(struct kvm_vcpu *vcpu, u64 run_flags) | |||
| 4611 | 4618 | vcpu->arch.nested_run_pending = 0; | |
| 4612 | 4619 | } | |
| 4613 | 4620 | ||
| 4614 | - | if (!svm_is_vmrun_failure(svm->vmcb->control.exit_code)) { | |
| 4615 | - | this_cpu_ptr(&svm_data)->flush_all_asids = false; | |
| 4616 | - | svm->vmcb->control.tlb_ctl = TLB_CONTROL_DO_NOTHING; | |
| 4621 | + | svm->vmcb->control.tlb_ctl = TLB_CONTROL_DO_NOTHING; | |
| 4617 | 4622 | ||
| 4618 | - | /* | |
| 4619 | - | * Unconditionally mask off the CLEAR_RAP bit, the AND is just | |
| 4620 | - | * as cheap as the TEST+Jcc to avoid it. | |
| 4621 | - | */ | |
| 4622 | - | if (cpu_feature_enabled(X86_FEATURE_ERAPS)) | |
| 4623 | - | svm->vmcb->control.erap_ctl &= ~ERAP_CONTROL_CLEAR_RAP; | |
| 4624 | - | ||
| 4625 | - | vmcb_mark_all_clean(svm->vmcb); | |
| 4623 | + | /* | |
| 4624 | + | * Unconditionally mask off the CLEAR_RAP bit, the AND is just as cheap | |
| 4625 | + | * as the TEST+Jcc to avoid it. | |
| 4626 | + | */ | |
| 4627 | + | if (cpu_feature_enabled(X86_FEATURE_ERAPS)) | |
| 4628 | + | svm->vmcb->control.erap_ctl &= ~ERAP_CONTROL_CLEAR_RAP; | |
| 4626 | 4629 | ||
| 4627 | - | if (!msr_write_intercepted(svm, MSR_AMD64_PERF_CNTR_GLOBAL_CTL)) | |
| 4628 | - | rdmsrq(MSR_AMD64_PERF_CNTR_GLOBAL_CTL, | |
| 4629 | - | vcpu_to_pmu(vcpu)->global_ctrl); | |
| 4630 | - | } | |
| 4630 | + | vmcb_mark_all_clean(svm->vmcb); | |
| 4631 | 4631 | ||
| 4632 | 4632 | /* if exit due to PF check for async PF */ | |
| 4633 | 4633 | if (svm->vmcb->control.exit_code == SVM_EXIT_EXCP_BASE + PF_VECTOR) | |
| @@ -4636,6 +4636,9 @@ static __no_kcsan fastpath_t svm_vcpu_run(struct kvm_vcpu *vcpu, u64 run_flags) | |||
| 4636 | 4636 | ||
| 4637 | 4637 | kvm_clear_available_registers(vcpu, SVM_REGS_LAZY_LOAD_SET); | |
| 4638 | 4638 | ||
| 4639 | + | if (!msr_write_intercepted(svm, MSR_AMD64_PERF_CNTR_GLOBAL_CTL)) | |
| 4640 | + | rdmsrq(MSR_AMD64_PERF_CNTR_GLOBAL_CTL, vcpu_to_pmu(vcpu)->global_ctrl); | |
| 4641 | + | ||
| 4639 | 4642 | trace_kvm_exit(vcpu, KVM_ISA_SVM); | |
| 4640 | 4643 | ||
| 4641 | 4644 | svm_complete_interrupts(vcpu); | |
modified arch/x86/kvm/svm/svm.h
| @@ -376,7 +376,6 @@ struct svm_cpu_data { | |||
| 376 | 376 | u32 next_asid; | |
| 377 | 377 | u32 min_asid; | |
| 378 | 378 | ||
| 379 | - | bool flush_all_asids; | |
| 380 | 379 | bool bp_spec_reduce_set; | |
| 381 | 380 | ||
| 382 | 381 | struct vmcb *save_area; | |
modified arch/x86/kvm/vmx/nested.c
| @@ -1754,9 +1754,6 @@ static void copy_vmcs12_to_shadow(struct vcpu_vmx *vmx) | |||
| 1754 | 1754 | static void copy_enlightened_to_vmcs12(struct vcpu_vmx *vmx, u32 hv_clean_fields) | |
| 1755 | 1755 | { | |
| 1756 | 1756 | #ifdef CONFIG_KVM_HYPERV | |
| 1757 | - | const u64 runtime_controls = HV_VMX_ENLIGHTENED_CLEAN_FIELD_CONTROL_GRP1 | | |
| 1758 | - | HV_VMX_ENLIGHTENED_CLEAN_FIELD_CONTROL_GRP2 | | |
| 1759 | - | HV_VMX_ENLIGHTENED_CLEAN_FIELD_CONTROL_PROC; | |
| 1760 | 1757 | struct vmcs12 *vmcs12 = vmx->nested.cached_vmcs12; | |
| 1761 | 1758 | struct hv_enlightened_vmcs *evmcs = nested_vmx_evmcs(vmx); | |
| 1762 | 1759 | struct kvm_vcpu_hv *hv_vcpu = to_hv_vcpu(&vmx->vcpu); | |
| @@ -1765,9 +1762,6 @@ static void copy_enlightened_to_vmcs12(struct vcpu_vmx *vmx, u32 hv_clean_fields | |||
| 1765 | 1762 | vmcs12->tpr_threshold = evmcs->tpr_threshold; | |
| 1766 | 1763 | vmcs12->guest_rip = evmcs->guest_rip; | |
| 1767 | 1764 | ||
| 1768 | - | if ((hv_clean_fields & runtime_controls) != runtime_controls) | |
| 1769 | - | vmx->nested.force_msr_bitmap_recalc = true; | |
| 1770 | - | ||
| 1771 | 1765 | if (unlikely(!(hv_clean_fields & | |
| 1772 | 1766 | HV_VMX_ENLIGHTENED_CLEAN_FIELD_ENLIGHTENMENTSCONTROL))) { | |
| 1773 | 1767 | hv_vcpu->nested.pa_page_gpa = evmcs->partition_assist_page; | |
modified arch/x86/kvm/vmx/tdx.c
| @@ -2728,6 +2728,11 @@ static tdx_vm_state_guard_t tdx_acquire_vm_state_locks(struct kvm *kvm) | |||
| 2728 | 2728 | ||
| 2729 | 2729 | mutex_lock(&kvm->lock); | |
| 2730 | 2730 | ||
| 2731 | + | if (kvm->created_vcpus != atomic_read(&kvm->online_vcpus)) { | |
| 2732 | + | r = -EBUSY; | |
| 2733 | + | goto out_err; | |
| 2734 | + | } | |
| 2735 | + | ||
| 2731 | 2736 | r = kvm_lock_all_vcpus(kvm); | |
| 2732 | 2737 | if (r) | |
| 2733 | 2738 | goto out_err; | |
modified arch/x86/mm/pgtable.c
| @@ -705,37 +705,47 @@ int pmd_clear_huge(pmd_t *pmd) | |||
| 705 | 705 | } | |
| 706 | 706 | ||
| 707 | 707 | #ifdef CONFIG_X86_64 | |
| 708 | - | /* | |
| 709 | - | * Given a PUD poitner, detach and free the pointed-to | |
| 710 | - | * PMD page and any PTE page children. The entire range | |
| 711 | - | * under the PUD must not have any valid translations | |
| 712 | - | * and the TLB must have already been flushed. | |
| 708 | + | /** | |
| 709 | + | * pud_free_pmd_page - Clear PUD entry and free PMD page | |
| 710 | + | * @pud: Pointer to a PUD | |
| 711 | + | * @addr: Virtual address associated with PUD | |
| 712 | + | * | |
| 713 | + | * Context: The PUD range has been unmapped and TLB purged. | |
| 714 | + | * Return: 1 if clearing the entry succeeded. 0 otherwise. | |
| 715 | + | * | |
| 716 | + | * NOTE: Callers must allow a single page allocation. | |
| 713 | 717 | */ | |
| 714 | 718 | int pud_free_pmd_page(pud_t *pud, unsigned long addr) | |
| 715 | 719 | { | |
| 720 | + | pmd_t *pmd, *pmd_sv; | |
| 716 | 721 | struct ptdesc *pt; | |
| 717 | - | pmd_t *pmd; | |
| 718 | 722 | int i; | |
| 719 | 723 | ||
| 720 | 724 | pmd = pud_pgtable(*pud); | |
| 725 | + | pmd_sv = (pmd_t *)__get_free_page(GFP_KERNEL); | |
| 726 | + | if (!pmd_sv) | |
| 727 | + | return 0; | |
| 728 | + | ||
| 729 | + | for (i = 0; i < PTRS_PER_PMD; i++) { | |
| 730 | + | pmd_sv[i] = pmd[i]; | |
| 731 | + | if (!pmd_none(pmd[i])) | |
| 732 | + | pmd_clear(&pmd[i]); | |
| 733 | + | } | |
| 721 | 734 | ||
| 722 | - | /* Detach the PMD page: */ | |
| 723 | 735 | pud_clear(pud); | |
| 724 | 736 | ||
| 725 | - | /* | |
| 726 | - | * PMD and all its descendents are unreachable | |
| 727 | - | * via normal page walks. Make them unreachable | |
| 728 | - | * in cached mid-level walks too: | |
| 729 | - | */ | |
| 737 | + | /* INVLPG to clear all paging-structure caches */ | |
| 730 | 738 | flush_tlb_kernel_range(addr, addr + PAGE_SIZE-1); | |
| 731 | 739 | ||
| 732 | 740 | for (i = 0; i < PTRS_PER_PMD; i++) { | |
| 733 | - | if (!pmd_none(pmd[i])) { | |
| 734 | - | pt = page_ptdesc(pmd_page(pmd[i])); | |
| 741 | + | if (!pmd_none(pmd_sv[i])) { | |
| 742 | + | pt = page_ptdesc(pmd_page(pmd_sv[i])); | |
| 735 | 743 | pagetable_dtor_free(pt); | |
| 736 | 744 | } | |
| 737 | 745 | } | |
| 738 | 746 | ||
| 747 | + | free_page((unsigned long)pmd_sv); | |
| 748 | + | ||
| 739 | 749 | pmd_free(&init_mm, pmd); | |
| 740 | 750 | ||
| 741 | 751 | return 1; | |
modified arch/x86/net/bpf_jit_comp.c
| @@ -3217,21 +3217,16 @@ static void restore_regs(const struct btf_func_model *m, u8 **prog, | |||
| 3217 | 3217 | } | |
| 3218 | 3218 | ||
| 3219 | 3219 | static int invoke_bpf_prog(const struct btf_func_model *m, u8 **pprog, | |
| 3220 | - | struct bpf_tramp_image *im, | |
| 3221 | 3220 | struct bpf_tramp_node *node, int stack_size, | |
| 3222 | 3221 | int run_ctx_off, bool save_ret, | |
| 3223 | 3222 | void *image, void *rw_image) | |
| 3224 | 3223 | { | |
| 3225 | 3224 | u8 *prog = *pprog; | |
| 3226 | - | u8 *jmp_insn, *skip; | |
| 3225 | + | u8 *jmp_insn; | |
| 3227 | 3226 | int ctx_cookie_off = offsetof(struct bpf_tramp_run_ctx, bpf_cookie); | |
| 3228 | 3227 | struct bpf_prog *p = node->link->prog; | |
| 3229 | 3228 | u64 cookie = node->cookie; | |
| 3230 | 3229 | ||
| 3231 | - | /* nop, patched to skip this prog when it is detached */ | |
| 3232 | - | skip = image + (prog - (u8 *)rw_image); | |
| 3233 | - | emit_nops(&prog, X86_PATCH_SIZE); | |
| 3234 | - | ||
| 3235 | 3230 | /* mov rdi, cookie */ | |
| 3236 | 3231 | emit_mov_imm64(&prog, BPF_REG_1, (long) cookie >> 32, (u32) (long) cookie); | |
| 3237 | 3232 | ||
| @@ -3306,8 +3301,6 @@ static int invoke_bpf_prog(const struct btf_func_model *m, u8 **pprog, | |||
| 3306 | 3301 | if (emit_rsb_call(&prog, bpf_trampoline_exit(p), image + (prog - (u8 *)rw_image))) | |
| 3307 | 3302 | return -EINVAL; | |
| 3308 | 3303 | ||
| 3309 | - | bpf_tramp_image_add_skip(im, p, skip, image + (prog - (u8 *)rw_image)); | |
| 3310 | - | ||
| 3311 | 3304 | *pprog = prog; | |
| 3312 | 3305 | return 0; | |
| 3313 | 3306 | } | |
| @@ -3339,7 +3332,6 @@ static int emit_cond_near_jump(u8 **pprog, void *func, void *ip, u8 jmp_cond) | |||
| 3339 | 3332 | } | |
| 3340 | 3333 | ||
| 3341 | 3334 | static int invoke_bpf(const struct btf_func_model *m, u8 **pprog, | |
| 3342 | - | struct bpf_tramp_image *im, | |
| 3343 | 3335 | struct bpf_tramp_nodes *tl, int stack_size, | |
| 3344 | 3336 | int run_ctx_off, int func_meta_off, bool save_ret, | |
| 3345 | 3337 | void *image, void *rw_image, u64 func_meta, | |
| @@ -3354,7 +3346,7 @@ static int invoke_bpf(const struct btf_func_model *m, u8 **pprog, | |||
| 3354 | 3346 | func_meta | (cur_cookie << BPF_TRAMP_COOKIE_INDEX_SHIFT)); | |
| 3355 | 3347 | cur_cookie--; | |
| 3356 | 3348 | } | |
| 3357 | - | if (invoke_bpf_prog(m, &prog, im, tl->nodes[i], stack_size, | |
| 3349 | + | if (invoke_bpf_prog(m, &prog, tl->nodes[i], stack_size, | |
| 3358 | 3350 | run_ctx_off, save_ret, image, rw_image)) | |
| 3359 | 3351 | return -EINVAL; | |
| 3360 | 3352 | } | |
| @@ -3363,7 +3355,6 @@ static int invoke_bpf(const struct btf_func_model *m, u8 **pprog, | |||
| 3363 | 3355 | } | |
| 3364 | 3356 | ||
| 3365 | 3357 | static int invoke_bpf_mod_ret(const struct btf_func_model *m, u8 **pprog, | |
| 3366 | - | struct bpf_tramp_image *im, | |
| 3367 | 3358 | struct bpf_tramp_nodes *tl, int stack_size, | |
| 3368 | 3359 | int run_ctx_off, u8 **branches, | |
| 3369 | 3360 | void *image, void *rw_image) | |
| @@ -3377,7 +3368,7 @@ static int invoke_bpf_mod_ret(const struct btf_func_model *m, u8 **pprog, | |||
| 3377 | 3368 | emit_mov_imm32(&prog, false, BPF_REG_0, 0); | |
| 3378 | 3369 | emit_stx(&prog, BPF_DW, BPF_REG_FP, BPF_REG_0, -8); | |
| 3379 | 3370 | for (i = 0; i < tl->nr_nodes; i++) { | |
| 3380 | - | if (invoke_bpf_prog(m, &prog, im, tl->nodes[i], stack_size, run_ctx_off, true, | |
| 3371 | + | if (invoke_bpf_prog(m, &prog, tl->nodes[i], stack_size, run_ctx_off, true, | |
| 3381 | 3372 | image, rw_image)) | |
| 3382 | 3373 | return -EINVAL; | |
| 3383 | 3374 | ||
| @@ -3649,7 +3640,7 @@ static int __arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *rw_im | |||
| 3649 | 3640 | } | |
| 3650 | 3641 | ||
| 3651 | 3642 | if (fentry->nr_nodes) { | |
| 3652 | - | if (invoke_bpf(m, &prog, im, fentry, regs_off, run_ctx_off, func_meta_off, | |
| 3643 | + | if (invoke_bpf(m, &prog, fentry, regs_off, run_ctx_off, func_meta_off, | |
| 3653 | 3644 | flags & BPF_TRAMP_F_RET_FENTRY_RET, image, rw_image, | |
| 3654 | 3645 | func_meta, cookie_off)) | |
| 3655 | 3646 | return -EINVAL; | |
| @@ -3661,7 +3652,7 @@ static int __arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *rw_im | |||
| 3661 | 3652 | if (!branches) | |
| 3662 | 3653 | return -ENOMEM; | |
| 3663 | 3654 | ||
| 3664 | - | if (invoke_bpf_mod_ret(m, &prog, im, fmod_ret, regs_off, | |
| 3655 | + | if (invoke_bpf_mod_ret(m, &prog, fmod_ret, regs_off, | |
| 3665 | 3656 | run_ctx_off, branches, image, rw_image)) { | |
| 3666 | 3657 | ret = -EINVAL; | |
| 3667 | 3658 | goto cleanup; | |
| @@ -3691,6 +3682,8 @@ static int __arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *rw_im | |||
| 3691 | 3682 | } | |
| 3692 | 3683 | /* remember return value in a stack for bpf prog to access */ | |
| 3693 | 3684 | emit_stx(&prog, BPF_DW, BPF_REG_FP, BPF_REG_0, -8); | |
| 3685 | + | im->ip_after_call = image + (prog - (u8 *)rw_image); | |
| 3686 | + | emit_nops(&prog, X86_PATCH_SIZE); | |
| 3694 | 3687 | } | |
| 3695 | 3688 | ||
| 3696 | 3689 | if (fmod_ret->nr_nodes) { | |
| @@ -3715,7 +3708,7 @@ static int __arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *rw_im | |||
| 3715 | 3708 | emit_store_stack_imm64(&prog, BPF_REG_0, -func_meta_off, func_meta); | |
| 3716 | 3709 | ||
| 3717 | 3710 | if (fexit->nr_nodes) { | |
| 3718 | - | if (invoke_bpf(m, &prog, im, fexit, regs_off, run_ctx_off, func_meta_off, | |
| 3711 | + | if (invoke_bpf(m, &prog, fexit, regs_off, run_ctx_off, func_meta_off, | |
| 3719 | 3712 | false, image, rw_image, func_meta, cookie_off)) { | |
| 3720 | 3713 | ret = -EINVAL; | |
| 3721 | 3714 | goto cleanup; | |
| @@ -3730,6 +3723,7 @@ static int __arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *rw_im | |||
| 3730 | 3723 | * restored to R0. | |
| 3731 | 3724 | */ | |
| 3732 | 3725 | if (flags & BPF_TRAMP_F_CALL_ORIG) { | |
| 3726 | + | im->ip_epilogue = image + (prog - (u8 *)rw_image); | |
| 3733 | 3727 | /* arg1: mov rdi, im */ | |
| 3734 | 3728 | emit_mov_imm64(&prog, BPF_REG_1, (long) im >> 32, (u32) (long) im); | |
| 3735 | 3729 | if (emit_rsb_call(&prog, __bpf_tramp_exit, image + (prog - (u8 *)rw_image))) { | |
| @@ -3817,7 +3811,7 @@ out: | |||
| 3817 | 3811 | int arch_bpf_trampoline_size(const struct btf_func_model *m, u32 flags, | |
| 3818 | 3812 | struct bpf_tramp_nodes *tnodes, void *func_addr) | |
| 3819 | 3813 | { | |
| 3820 | - | struct bpf_tramp_image im = {}; | |
| 3814 | + | struct bpf_tramp_image im; | |
| 3821 | 3815 | void *image; | |
| 3822 | 3816 | int ret; | |
| 3823 | 3817 | ||
modified arch/x86/um/asm/ptrace.h
| @@ -13,7 +13,9 @@ enum { | |||
| 13 | 13 | }; | |
| 14 | 14 | ||
| 15 | 15 | #include <linux/compiler.h> | |
| 16 | - | #define __FRAME_OFFSETS /* Needed to get the register macros */ | |
| 16 | + | #ifndef CONFIG_X86_32 | |
| 17 | + | #define __FRAME_OFFSETS /* Needed to get the R* macros */ | |
| 18 | + | #endif | |
| 17 | 19 | #include <asm/ptrace-generic.h> | |
| 18 | 20 | ||
| 19 | 21 | #define user_mode(r) UPT_IS_USER(&(r)->regs) | |
modified arch/x86/um/ptrace_32.c
| @@ -7,7 +7,6 @@ | |||
| 7 | 7 | #include <linux/sched.h> | |
| 8 | 8 | #include <linux/uaccess.h> | |
| 9 | 9 | #include <linux/regset.h> | |
| 10 | - | #define __FRAME_OFFSETS | |
| 11 | 10 | #include <asm/ptrace-abi.h> | |
| 12 | 11 | #include <registers.h> | |
| 13 | 12 | #include <skas.h> | |
modified block/blk-cgroup.c
| @@ -2091,7 +2091,6 @@ static inline struct blkcg_gq *blkg_tryget_closest(struct bio *bio, | |||
| 2091 | 2091 | struct request_queue *q = bio->bi_bdev->bd_queue; | |
| 2092 | 2092 | struct blkcg *blkcg = css_to_blkcg(css); | |
| 2093 | 2093 | struct blkcg_gq *blkg; | |
| 2094 | - | unsigned long flags; | |
| 2095 | 2094 | ||
| 2096 | 2095 | rcu_read_lock(); | |
| 2097 | 2096 | blkg = blkg_lookup(blkcg, q); | |
| @@ -2106,11 +2105,11 @@ static inline struct blkcg_gq *blkg_tryget_closest(struct bio *bio, | |||
| 2106 | 2105 | * Fast path failed, we're probably issuing IO in this cgroup the first | |
| 2107 | 2106 | * time, hold lock to create new blkg. | |
| 2108 | 2107 | */ | |
| 2109 | - | spin_lock_irqsave(&q->queue_lock, flags); | |
| 2108 | + | spin_lock_irq(&q->queue_lock); | |
| 2110 | 2109 | blkg = blkg_lookup_create(blkcg, bio->bi_bdev->bd_disk); | |
| 2111 | 2110 | if (blkg) | |
| 2112 | 2111 | blkg = blkg_lookup_tryget(blkg); | |
| 2113 | - | spin_unlock_irqrestore(&q->queue_lock, flags); | |
| 2112 | + | spin_unlock_irq(&q->queue_lock); | |
| 2114 | 2113 | ||
| 2115 | 2114 | return blkg; | |
| 2116 | 2115 | } | |
modified block/blk-mq.c
| @@ -447,6 +447,16 @@ static struct request *blk_mq_rq_ctx_init(struct blk_mq_alloc_data *data, | |||
| 447 | 447 | WRITE_ONCE(rq->deadline, 0); | |
| 448 | 448 | req_ref_set(rq, 1); | |
| 449 | 449 | ||
| 450 | + | if (rq->rq_flags & RQF_USE_SCHED) { | |
| 451 | + | struct elevator_queue *e = data->q->elevator; | |
| 452 | + | ||
| 453 | + | INIT_HLIST_NODE(&rq->hash); | |
| 454 | + | RB_CLEAR_NODE(&rq->rb_node); | |
| 455 | + | ||
| 456 | + | if (e->type->ops.prepare_request) | |
| 457 | + | e->type->ops.prepare_request(rq); | |
| 458 | + | } | |
| 459 | + | ||
| 450 | 460 | return rq; | |
| 451 | 461 | } | |
| 452 | 462 | ||
| @@ -488,12 +498,6 @@ __blk_mq_alloc_requests_batch(struct blk_mq_alloc_data *data) | |||
| 488 | 498 | return rq_list_pop(data->cached_rqs); | |
| 489 | 499 | } | |
| 490 | 500 | ||
| 491 | - | static bool blk_op_bypass_sched(blk_opf_t opf) | |
| 492 | - | { | |
| 493 | - | return (opf & REQ_OP_MASK) == REQ_OP_FLUSH || | |
| 494 | - | blk_op_is_passthrough(opf); | |
| 495 | - | } | |
| 496 | - | ||
| 497 | 501 | static void blk_mq_limit_depth(struct blk_mq_alloc_data *data) | |
| 498 | 502 | { | |
| 499 | 503 | struct elevator_mq_ops *ops; | |
| @@ -514,10 +518,12 @@ static void blk_mq_limit_depth(struct blk_mq_alloc_data *data) | |||
| 514 | 518 | * Flush/passthrough requests are special and go directly to the | |
| 515 | 519 | * dispatch list, they are not subject to the async_depth limit. | |
| 516 | 520 | */ | |
| 517 | - | if (blk_op_bypass_sched(data->cmd_flags)) | |
| 521 | + | if ((data->cmd_flags & REQ_OP_MASK) == REQ_OP_FLUSH || | |
| 522 | + | blk_op_is_passthrough(data->cmd_flags)) | |
| 518 | 523 | return; | |
| 519 | 524 | ||
| 520 | 525 | WARN_ON_ONCE(data->flags & BLK_MQ_REQ_RESERVED); | |
| 526 | + | data->rq_flags |= RQF_USE_SCHED; | |
| 521 | 527 | ||
| 522 | 528 | /* | |
| 523 | 529 | * By default, sync requests have no limit, and async requests are | |
| @@ -528,29 +534,6 @@ static void blk_mq_limit_depth(struct blk_mq_alloc_data *data) | |||
| 528 | 534 | ops->limit_depth(data->cmd_flags, data); | |
| 529 | 535 | } | |
| 530 | 536 | ||
| 531 | - | /* | |
| 532 | - | * Finish initializing a request once it has been claimed for an operation. | |
| 533 | - | * Cached requests are allocated before that operation is known. | |
| 534 | - | */ | |
| 535 | - | static void blk_mq_rq_late_init(struct request *rq, u64 alloc_time_ns) | |
| 536 | - | { | |
| 537 | - | struct elevator_queue *e; | |
| 538 | - | ||
| 539 | - | blk_mq_rq_time_init(rq, alloc_time_ns); | |
| 540 | - | ||
| 541 | - | if (!(rq->rq_flags & RQF_SCHED_TAGS) || (rq->rq_flags & RQF_RESV) || | |
| 542 | - | blk_op_bypass_sched(rq->cmd_flags)) | |
| 543 | - | return; | |
| 544 | - | ||
| 545 | - | rq->rq_flags |= RQF_USE_SCHED; | |
| 546 | - | INIT_HLIST_NODE(&rq->hash); | |
| 547 | - | RB_CLEAR_NODE(&rq->rb_node); | |
| 548 | - | ||
| 549 | - | e = rq->q->elevator; | |
| 550 | - | if (e->type->ops.prepare_request) | |
| 551 | - | e->type->ops.prepare_request(rq); | |
| 552 | - | } | |
| 553 | - | ||
| 554 | 537 | static struct request *__blk_mq_alloc_requests(struct blk_mq_alloc_data *data) | |
| 555 | 538 | { | |
| 556 | 539 | struct request_queue *q = data->q; | |
| @@ -579,7 +562,7 @@ retry: | |||
| 579 | 562 | if (data->nr_tags > 1) { | |
| 580 | 563 | rq = __blk_mq_alloc_requests_batch(data); | |
| 581 | 564 | if (rq) { | |
| 582 | - | blk_mq_rq_late_init(rq, alloc_time_ns); | |
| 565 | + | blk_mq_rq_time_init(rq, alloc_time_ns); | |
| 583 | 566 | return rq; | |
| 584 | 567 | } | |
| 585 | 568 | data->nr_tags = 1; | |
| @@ -607,7 +590,7 @@ retry: | |||
| 607 | 590 | if (!(data->rq_flags & RQF_SCHED_TAGS)) | |
| 608 | 591 | blk_mq_inc_active_requests(data->hctx); | |
| 609 | 592 | rq = blk_mq_rq_ctx_init(data, blk_mq_tags_from_data(data), tag); | |
| 610 | - | blk_mq_rq_late_init(rq, alloc_time_ns); | |
| 593 | + | blk_mq_rq_time_init(rq, alloc_time_ns); | |
| 611 | 594 | return rq; | |
| 612 | 595 | } | |
| 613 | 596 | ||
| @@ -654,6 +637,8 @@ static struct request *blk_mq_alloc_cached_request(struct request_queue *q, | |||
| 654 | 637 | if (plug->nr_ios == 1) | |
| 655 | 638 | return NULL; | |
| 656 | 639 | rq = blk_mq_rq_cache_fill(q, plug, opf, flags); | |
| 640 | + | if (!rq) | |
| 641 | + | return NULL; | |
| 657 | 642 | } else { | |
| 658 | 643 | rq = rq_list_peek(&plug->cached_rqs); | |
| 659 | 644 | if (!rq || rq->q != q) | |
| @@ -661,13 +646,15 @@ static struct request *blk_mq_alloc_cached_request(struct request_queue *q, | |||
| 661 | 646 | ||
| 662 | 647 | if (blk_mq_get_hctx_type(opf) != rq->mq_hctx->type) | |
| 663 | 648 | return NULL; | |
| 649 | + | if (op_is_flush(rq->cmd_flags) != op_is_flush(opf)) | |
| 650 | + | return NULL; | |
| 664 | 651 | ||
| 665 | 652 | rq_list_pop(&plug->cached_rqs); | |
| 666 | - | rq->cmd_flags = opf; | |
| 667 | - | INIT_LIST_HEAD(&rq->queuelist); | |
| 668 | - | blk_mq_rq_late_init(rq, blk_time_get_ns()); | |
| 653 | + | blk_mq_rq_time_init(rq, blk_time_get_ns()); | |
| 669 | 654 | } | |
| 670 | 655 | ||
| 656 | + | rq->cmd_flags = opf; | |
| 657 | + | INIT_LIST_HEAD(&rq->queuelist); | |
| 671 | 658 | return rq; | |
| 672 | 659 | } | |
| 673 | 660 | ||
| @@ -779,7 +766,7 @@ struct request *blk_mq_alloc_request_hctx(struct request_queue *q, | |||
| 779 | 766 | if (!(data.rq_flags & RQF_SCHED_TAGS)) | |
| 780 | 767 | blk_mq_inc_active_requests(data.hctx); | |
| 781 | 768 | rq = blk_mq_rq_ctx_init(&data, blk_mq_tags_from_data(&data), tag); | |
| 782 | - | blk_mq_rq_late_init(rq, alloc_time_ns); | |
| 769 | + | blk_mq_rq_time_init(rq, alloc_time_ns); | |
| 783 | 770 | rq->__data_len = 0; | |
| 784 | 771 | rq->phys_gap_bit = 0; | |
| 785 | 772 | rq->__sector = (sector_t) -1; | |
| @@ -3073,6 +3060,8 @@ static struct request *blk_mq_get_cached_request(struct blk_plug *plug, | |||
| 3073 | 3060 | if (type != rq->mq_hctx->type && | |
| 3074 | 3061 | (type != HCTX_TYPE_READ || rq->mq_hctx->type != HCTX_TYPE_DEFAULT)) | |
| 3075 | 3062 | return NULL; | |
| 3063 | + | if (op_is_flush(rq->cmd_flags) != op_is_flush(opf)) | |
| 3064 | + | return NULL; | |
| 3076 | 3065 | rq_list_pop(&plug->cached_rqs); | |
| 3077 | 3066 | return rq; | |
| 3078 | 3067 | } | |
| @@ -3174,9 +3163,9 @@ void blk_mq_submit_bio(struct bio *bio) | |||
| 3174 | 3163 | new_request: | |
| 3175 | 3164 | if (rq) { | |
| 3176 | 3165 | rq_qos_throttle(rq->q, bio); | |
| 3166 | + | blk_mq_rq_time_init(rq, blk_time_get_ns()); | |
| 3177 | 3167 | rq->cmd_flags = bio->bi_opf; | |
| 3178 | 3168 | INIT_LIST_HEAD(&rq->queuelist); | |
| 3179 | - | blk_mq_rq_late_init(rq, blk_time_get_ns()); | |
| 3180 | 3169 | } else { | |
| 3181 | 3170 | rq = blk_mq_get_new_requests(q, plug, bio); | |
| 3182 | 3171 | if (unlikely(!rq)) { | |
modified block/fops.c
| @@ -402,11 +402,6 @@ static ssize_t blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter) | |||
| 402 | 402 | if (blkdev_dio_invalid(bdev, iocb, iter)) | |
| 403 | 403 | return -EINVAL; | |
| 404 | 404 | ||
| 405 | - | /* HIPRI needs private as bio; HAS_METADATA keeps it as uio_meta */ | |
| 406 | - | if ((iocb->ki_flags & IOCB_HIPRI) && | |
| 407 | - | (iocb->ki_flags & IOCB_HAS_METADATA)) | |
| 408 | - | return -EOPNOTSUPP; | |
| 409 | - | ||
| 410 | 405 | if (iov_iter_rw(iter) == WRITE) { | |
| 411 | 406 | u16 max_write_streams = bdev_max_write_streams(bdev); | |
| 412 | 407 | ||
modified block/mq-deadline.c
| @@ -685,7 +685,7 @@ static void dd_insert_requests(struct blk_mq_hw_ctx *hctx, | |||
| 685 | 685 | blk_mq_free_requests(&free); | |
| 686 | 686 | } | |
| 687 | 687 | ||
| 688 | - | /* Callback from inside blk_mq_rq_late_init(). */ | |
| 688 | + | /* Callback from inside blk_mq_rq_ctx_init(). */ | |
| 689 | 689 | static void dd_prepare_request(struct request *rq) | |
| 690 | 690 | { | |
| 691 | 691 | rq->elv.priv[0] = NULL; | |
modified crypto/aes.c
| @@ -637,18 +637,7 @@ static struct skcipher_alg skcipher_algs[] = { | |||
| 637 | 637 | .decrypt = crypto_aes_cbc_decrypt, | |
| 638 | 638 | }, | |
| 639 | 639 | #endif | |
| 640 | - | /* | |
| 641 | - | * Don't register library-based "cts(cbc(aes))" on architectures where | |
| 642 | - | * it might block a "better" implementation from being instantiated via | |
| 643 | - | * the "cts" template. These exclusions are temporary and will go away | |
| 644 | - | * as the arch-optimized AES code is migrated into the library. | |
| 645 | - | */ | |
| 646 | - | #if IS_ENABLED(CONFIG_CRYPTO_CTS) && \ | |
| 647 | - | !(IS_ENABLED(CONFIG_ARM) || \ | |
| 648 | - | IS_ENABLED(CONFIG_ARM64) || \ | |
| 649 | - | IS_ENABLED(CONFIG_PPC) || \ | |
| 650 | - | IS_ENABLED(CONFIG_S390) || \ | |
| 651 | - | IS_ENABLED(CONFIG_SPARC)) | |
| 640 | + | #if IS_ENABLED(CONFIG_CRYPTO_CTS) | |
| 652 | 641 | { | |
| 653 | 642 | .base.cra_name = "cts(cbc(aes))", | |
| 654 | 643 | .base.cra_driver_name = "cts-cbc-aes-lib", | |
| @@ -698,13 +687,7 @@ static struct skcipher_alg skcipher_algs[] = { | |||
| 698 | 687 | .decrypt = crypto_aes_xctr_crypt, | |
| 699 | 688 | }, | |
| 700 | 689 | #endif | |
| 701 | - | /* | |
| 702 | - | * Don't register library-based "xts(aes)" on architectures where it | |
| 703 | - | * might block a "better" implementation from being instantiated via the | |
| 704 | - | * "xts" template. This exclusion is temporary and will go away when | |
| 705 | - | * the library AES-XTS is optimized for SPARC. | |
| 706 | - | */ | |
| 707 | - | #if IS_ENABLED(CONFIG_CRYPTO_XTS) && !IS_ENABLED(CONFIG_SPARC) | |
| 690 | + | #if IS_ENABLED(CONFIG_CRYPTO_XTS) | |
| 708 | 691 | { | |
| 709 | 692 | .base.cra_name = "xts(aes)", | |
| 710 | 693 | .base.cra_driver_name = "xts-aes-lib", | |
| @@ -997,20 +980,7 @@ static __maybe_unused int crypto_aes_ccm_decrypt(struct aead_request *req) | |||
| 997 | 980 | } | |
| 998 | 981 | ||
| 999 | 982 | static struct aead_alg aead_algs[] = { | |
| 1000 | - | /* | |
| 1001 | - | * Don't register library-based "gcm(aes)" and "rfc4106(gcm(aes))" on | |
| 1002 | - | * architectures where they might block a "better" implementation from | |
| 1003 | - | * being instantiated via the "gcm" and "rfc4106" templates. These | |
| 1004 | - | * exclusions are temporary and will go away as the arch-optimized AES | |
| 1005 | - | * code is migrated into the library. | |
| 1006 | - | */ | |
| 1007 | - | #if IS_ENABLED(CONFIG_CRYPTO_GCM) && \ | |
| 1008 | - | !(IS_ENABLED(CONFIG_ARM) || \ | |
| 1009 | - | IS_ENABLED(CONFIG_ARM64) || \ | |
| 1010 | - | IS_ENABLED(CONFIG_PPC) || \ | |
| 1011 | - | IS_ENABLED(CONFIG_RISCV) || \ | |
| 1012 | - | IS_ENABLED(CONFIG_S390) || \ | |
| 1013 | - | IS_ENABLED(CONFIG_SPARC)) | |
| 983 | + | #if IS_ENABLED(CONFIG_CRYPTO_GCM) | |
| 1014 | 984 | { | |
| 1015 | 985 | .base.cra_name = "gcm(aes)", | |
| 1016 | 986 | .base.cra_driver_name = "gcm-aes-lib", | |
| @@ -1042,20 +1012,7 @@ static struct aead_alg aead_algs[] = { | |||
| 1042 | 1012 | .chunksize = AES_BLOCK_SIZE, | |
| 1043 | 1013 | }, | |
| 1044 | 1014 | #endif /* CONFIG_CRYPTO_GCM */ | |
| 1045 | - | /* | |
| 1046 | - | * Don't register library-based "ccm(aes)" on architectures where it | |
| 1047 | - | * might block a "better" implementation from being instantiated via the | |
| 1048 | - | * "ccm" template. These exclusions are temporary and will go away as | |
| 1049 | - | * the arch-optimized AES code is migrated into the library. | |
| 1050 | - | */ | |
| 1051 | - | #if IS_ENABLED(CONFIG_CRYPTO_CCM) && \ | |
| 1052 | - | !(IS_ENABLED(CONFIG_ARM) || \ | |
| 1053 | - | IS_ENABLED(CONFIG_ARM64) || \ | |
| 1054 | - | IS_ENABLED(CONFIG_PPC) || \ | |
| 1055 | - | IS_ENABLED(CONFIG_RISCV) || \ | |
| 1056 | - | IS_ENABLED(CONFIG_S390) || \ | |
| 1057 | - | IS_ENABLED(CONFIG_SPARC) || \ | |
| 1058 | - | IS_ENABLED(CONFIG_X86)) | |
| 1015 | + | #if IS_ENABLED(CONFIG_CRYPTO_CCM) | |
| 1059 | 1016 | { | |
| 1060 | 1017 | .base.cra_name = "ccm(aes)", | |
| 1061 | 1018 | .base.cra_driver_name = "ccm-aes-lib", | |
modified drivers/accessibility/braille/braille_console.c
| @@ -62,50 +62,14 @@ static void braille_write(u16 *buf) | |||
| 62 | 62 | { | |
| 63 | 63 | static u16 lastwrite[WIDTH]; | |
| 64 | 64 | unsigned char data[1 + 1 + 2*WIDTH + 2 + 1], csum = 0, *c; | |
| 65 | - | struct nbcon_write_context wctxt = { }; | |
| 66 | - | unsigned long flags; | |
| 67 | 65 | u16 out; | |
| 68 | 66 | int i; | |
| 69 | 67 | ||
| 70 | 68 | if (!braille_co) | |
| 71 | 69 | return; | |
| 72 | 70 | ||
| 73 | - | /* | |
| 74 | - | * Braille console is not registered in console_list. Instead, it | |
| 75 | - | * is integrated with VT and shows what appears on the graphical | |
| 76 | - | * console under console_lock(). From this POV it is a legacy | |
| 77 | - | * console. But it calls serial console driver which might be | |
| 78 | - | * converted to the NBCON API. It is similar to | |
| 79 | - | * nbcon_legacy_emit_next_record() except that we should try | |
| 80 | - | * harder to get the lock. Otherwise, the Braille device won't show | |
| 81 | - | * everything what is displayed on the terminal. | |
| 82 | - | * | |
| 83 | - | * In short, simulate the original locking using NBCON API. | |
| 84 | - | */ | |
| 85 | - | if (braille_co->flags & CON_NBCON) { | |
| 86 | - | if (panic_on_this_cpu()) { | |
| 87 | - | /* | |
| 88 | - | * This should be good enough in practice. Most/all | |
| 89 | - | * serial console drivers have the atomic callback. | |
| 90 | - | */ | |
| 91 | - | if (!braille_co->write_atomic) | |
| 92 | - | return; | |
| 93 | - | ||
| 94 | - | local_irq_save(flags); | |
| 95 | - | /* NBCON API strictly requires the ownership. */ | |
| 96 | - | if (!nbcon_braille_try_acquire(braille_co, &wctxt)) { | |
| 97 | - | local_irq_restore(flags); | |
| 98 | - | return; | |
| 99 | - | } | |
| 100 | - | } else { | |
| 101 | - | braille_co->device_lock(braille_co, &flags); | |
| 102 | - | while (!nbcon_braille_try_acquire(braille_co, &wctxt)) | |
| 103 | - | cpu_relax(); | |
| 104 | - | } | |
| 105 | - | } | |
| 106 | - | ||
| 107 | 71 | if (!memcmp(lastwrite, buf, WIDTH * sizeof(*buf))) | |
| 108 | - | goto unlock_nbcon; | |
| 72 | + | return; | |
| 109 | 73 | memcpy(lastwrite, buf, WIDTH * sizeof(*buf)); | |
| 110 | 74 | ||
| 111 | 75 | #define SOH 1 | |
| @@ -138,24 +102,7 @@ static void braille_write(u16 *buf) | |||
| 138 | 102 | *c++ = csum; | |
| 139 | 103 | *c++ = ETX; | |
| 140 | 104 | ||
| 141 | - | if (braille_co->flags & CON_NBCON) { | |
| 142 | - | nbcon_write_context_set_buf(&wctxt, (char *)data, c - data); | |
| 143 | - | if (panic_on_this_cpu()) | |
| 144 | - | braille_co->write_atomic(braille_co, &wctxt); | |
| 145 | - | else | |
| 146 | - | braille_co->write_thread(braille_co, &wctxt); | |
| 147 | - | } else { | |
| 148 | - | braille_co->write(braille_co, data, c - data); | |
| 149 | - | } | |
| 150 | - | ||
| 151 | - | unlock_nbcon: | |
| 152 | - | if (braille_co->flags & CON_NBCON) { | |
| 153 | - | nbcon_braille_release(&wctxt); | |
| 154 | - | if (panic_on_this_cpu()) | |
| 155 | - | local_irq_restore(flags); | |
| 156 | - | else | |
| 157 | - | braille_co->device_unlock(braille_co, flags); | |
| 158 | - | } | |
| 105 | + | braille_co->write(braille_co, data, c - data); | |
| 159 | 106 | } | |
| 160 | 107 | ||
| 161 | 108 | /* Follow the VC cursor*/ | |
modified drivers/android/binder.c
| @@ -2930,9 +2930,8 @@ static int binder_proc_transaction(struct binder_transaction *t, | |||
| 2930 | 2930 | t_outdated->buffer = NULL; | |
| 2931 | 2931 | buffer->transaction = NULL; | |
| 2932 | 2932 | trace_binder_transaction_update_buffer_release(buffer); | |
| 2933 | - | binder_release_entire_buffer(proc, NULL, buffer, true); | |
| 2933 | + | binder_release_entire_buffer(proc, NULL, buffer, false); | |
| 2934 | 2934 | binder_alloc_free_buf(&proc->alloc, buffer); | |
| 2935 | - | binder_free_txn_fixups(t_outdated); | |
| 2936 | 2935 | kfree(t_outdated); | |
| 2937 | 2936 | binder_stats_deleted(BINDER_STAT_TRANSACTION); | |
| 2938 | 2937 | } | |
modified drivers/android/binder/node.rs
| @@ -51,9 +51,9 @@ pub(crate) struct CouldNotDeliverCriticalIncrement; | |||
| 51 | 51 | /// about to drop the weak reference, then the strong increment could be processed after the | |
| 52 | 52 | /// other thread has already exited, which would be too late. | |
| 53 | 53 | /// | |
| 54 | - | /// Note that trying to create a `ListArc` to the node can succeed even if `has_pushed_node` is | |
| 54 | + | /// Note that trying to create a `ListArc` to the node can succeed even if `has_normal_push` is | |
| 55 | 55 | /// set. This is because another thread might just have popped the node from a todo list, but not | |
| 56 | - | /// yet called `do_work`. However, if `has_pushed_node` is false, then creating a `ListArc` should | |
| 56 | + | /// yet called `do_work`. However, if `has_normal_push` is false, then creating a `ListArc` should | |
| 57 | 57 | /// always succeed. | |
| 58 | 58 | /// | |
| 59 | 59 | /// Like the other fields in `NodeInner`, the delivery state is protected by the process lock. | |
| @@ -738,21 +738,7 @@ impl DeliverToRead for Node { | |||
| 738 | 738 | self.do_work_locked(writer, owner_inner) | |
| 739 | 739 | } | |
| 740 | 740 | ||
| 741 | - | fn cancel(self: DArc<Self>) { | |
| 742 | - | let _drop_outside_lock; | |
| 743 | - | let mut owner_inner = self.owner.inner.lock(); | |
| 744 | - | ||
| 745 | - | // We only do something on BINDER_THREAD_EXIT, not process exit. | |
| 746 | - | if owner_inner.is_dead { | |
| 747 | - | return; | |
| 748 | - | } | |
| 749 | - | ||
| 750 | - | // If BINDER_THREAD_EXIT is invoked on a thread with a pending node refcount update, we | |
| 751 | - | // should move ourselves to ensure the refcount update is still delivered. | |
| 752 | - | if let Some(node) = ListArc::try_from_arc_borrow(self.as_arc_borrow()) { | |
| 753 | - | _drop_outside_lock = owner_inner.push_work(&self.owner, node); | |
| 754 | - | } | |
| 755 | - | } | |
| 741 | + | fn cancel(self: DArc<Self>) {} | |
| 756 | 742 | ||
| 757 | 743 | fn should_sync_wakeup(&self) -> bool { | |
| 758 | 744 | false | |
modified drivers/android/binder/node/wrapper.rs
| @@ -57,39 +57,7 @@ impl DeliverToRead for NodeWrapper { | |||
| 57 | 57 | node.do_work_locked(writer, owner_inner) | |
| 58 | 58 | } | |
| 59 | 59 | ||
| 60 | - | fn cancel(self: DArc<Self>) { | |
| 61 | - | let _drop_outside_lock; | |
| 62 | - | let node = &self.node; | |
| 63 | - | let mut owner_inner = node.owner.inner.lock(); | |
| 64 | - | ||
| 65 | - | // We only do something on BINDER_THREAD_EXIT, not process exit. | |
| 66 | - | if owner_inner.is_dead { | |
| 67 | - | return; | |
| 68 | - | } | |
| 69 | - | ||
| 70 | - | // We transfer the responsibility of the node refcount update to the scheduled Node because | |
| 71 | - | // NodeWrapper has no way to re-create the ListArc. | |
| 72 | - | let inner = node.inner.access_mut(&mut owner_inner); | |
| 73 | - | ||
| 74 | - | let ds = &mut inner.delivery_state; | |
| 75 | - | assert!(ds.has_pushed_wrapper); | |
| 76 | - | assert!(ds.has_strong_zero2one); | |
| 77 | - | ds.has_pushed_wrapper = false; | |
| 78 | - | ||
| 79 | - | // We are changing the state to one where the Node is the strong zero2one update instead of | |
| 80 | - | // the wrapper. | |
| 81 | - | ds.has_weak_zero2one = false; | |
| 82 | - | ||
| 83 | - | if !ds.has_pushed_node { | |
| 84 | - | if let Some(node2) = ListArc::try_from_arc_borrow(node.as_arc_borrow()) { | |
| 85 | - | ds.has_pushed_node = true; | |
| 86 | - | _drop_outside_lock = owner_inner.push_work(&node.owner, node2); | |
| 87 | - | } else { | |
| 88 | - | // This can't actually happen. | |
| 89 | - | ds.has_strong_zero2one = false; | |
| 90 | - | } | |
| 91 | - | } | |
| 92 | - | } | |
| 60 | + | fn cancel(self: DArc<Self>) {} | |
| 93 | 61 | ||
| 94 | 62 | fn should_sync_wakeup(&self) -> bool { | |
| 95 | 63 | false | |
modified drivers/android/binder/rust_binderfs.c
| @@ -72,7 +72,6 @@ struct binder_features { | |||
| 72 | 72 | bool oneway_spam_detection; | |
| 73 | 73 | bool extended_error; | |
| 74 | 74 | bool freeze_notification; | |
| 75 | - | bool transaction_report; | |
| 76 | 75 | }; | |
| 77 | 76 | ||
| 78 | 77 | static const struct constant_table binderfs_param_stats[] = { | |
| @@ -90,7 +89,6 @@ static struct binder_features binder_features = { | |||
| 90 | 89 | .oneway_spam_detection = true, | |
| 91 | 90 | .extended_error = true, | |
| 92 | 91 | .freeze_notification = true, | |
| 93 | - | .transaction_report = true, | |
| 94 | 92 | }; | |
| 95 | 93 | ||
| 96 | 94 | static inline struct binderfs_info *BINDERFS_SB(const struct super_block *sb) | |
| @@ -568,12 +566,6 @@ static int init_binder_features(struct super_block *sb) | |||
| 568 | 566 | if (IS_ERR(dentry)) | |
| 569 | 567 | return PTR_ERR(dentry); | |
| 570 | 568 | ||
| 571 | - | dentry = rust_binderfs_create_file(dir, "transaction_report", | |
| 572 | - | &binder_features_fops, | |
| 573 | - | &binder_features.transaction_report); | |
| 574 | - | if (IS_ERR(dentry)) | |
| 575 | - | return PTR_ERR(dentry); | |
| 576 | - | ||
| 577 | 569 | return 0; | |
| 578 | 570 | } | |
| 579 | 571 | ||
modified drivers/android/binder/thread.rs
| @@ -686,12 +686,6 @@ impl Thread { | |||
| 686 | 686 | self.inner.lock().push_return_work(reply); | |
| 687 | 687 | } | |
| 688 | 688 | ||
| 689 | - | pub(crate) fn pop_work_even_if_deferred(&self) -> Option<DLArc<dyn DeliverToRead>> { | |
| 690 | - | let mut thread_inner = self.inner.lock(); | |
| 691 | - | thread_inner.process_work_list = true; | |
| 692 | - | thread_inner.pop_work() | |
| 693 | - | } | |
| 694 | - | ||
| 695 | 689 | fn translate_object( | |
| 696 | 690 | &self, | |
| 697 | 691 | obj_index: usize, | |
| @@ -1684,7 +1678,7 @@ impl Thread { | |||
| 1684 | 1678 | self.unwind_transaction_stack(); | |
| 1685 | 1679 | ||
| 1686 | 1680 | // Cancel all pending work items. | |
| 1687 | - | while let Some(work) = self.pop_work_even_if_deferred() { | |
| 1681 | + | while let Ok(Some(work)) = self.get_work_local(false) { | |
| 1688 | 1682 | work.into_arc().cancel(); | |
| 1689 | 1683 | } | |
| 1690 | 1684 | } | |
modified drivers/android/binderfs.c
| @@ -189,11 +189,12 @@ static int binderfs_binder_device_create(struct inode *ref_inode, | |||
| 189 | 189 | goto err; | |
| 190 | 190 | } | |
| 191 | 191 | inode->i_private = device; | |
| 192 | - | binder_add_device(device); | |
| 193 | 192 | d_make_persistent(dentry, inode); | |
| 194 | 193 | fsnotify_create(root->d_inode, dentry); | |
| 195 | 194 | simple_done_creating(dentry); | |
| 196 | 195 | ||
| 196 | + | binder_add_device(device); | |
| 197 | + | ||
| 197 | 198 | return 0; | |
| 198 | 199 | ||
| 199 | 200 | err: | |
modified drivers/ata/libata-scsi.c
| @@ -3059,15 +3059,10 @@ static void atapi_qc_complete(struct ata_queued_cmd *qc) | |||
| 3059 | 3059 | if (qc->cdb[0] == ALLOW_MEDIUM_REMOVAL && qc->dev->sdev) | |
| 3060 | 3060 | qc->dev->sdev->locked = 0; | |
| 3061 | 3061 | ||
| 3062 | - | /* | |
| 3063 | - | * Report CHECK CONDITION unless the command was terminated | |
| 3064 | - | * with a host byte set. Only set the status byte, so that the | |
| 3065 | - | * SCSI midlayer internal byte, which scsi_check_sense() may | |
| 3066 | - | * have set from the sense data, is preserved. | |
| 3067 | - | */ | |
| 3068 | - | if (get_host_byte(cmd) == DID_OK) | |
| 3069 | - | set_status_byte(cmd, SAM_STAT_CHECK_CONDITION); | |
| 3070 | - | ata_scsi_qc_done(qc, false, 0); | |
| 3062 | + | if (cmd->result) | |
| 3063 | + | ata_scsi_qc_done(qc, false, 0); | |
| 3064 | + | else | |
| 3065 | + | ata_scsi_qc_done(qc, true, SAM_STAT_CHECK_CONDITION); | |
| 3071 | 3066 | goto schedule_deferred; | |
| 3072 | 3067 | } | |
| 3073 | 3068 | ||
modified drivers/block/drbd/drbd_nl_gen.c
| @@ -638,6 +638,10 @@ const struct genl_split_ops drbd_nl_ops[32] = { | |||
| 638 | 638 | }, | |
| 639 | 639 | }; | |
| 640 | 640 | ||
| 641 | + | static const struct genl_multicast_group drbd_nl_mcgrps[] = { | |
| 642 | + | [DRBD_NLGRP_EVENTS] = { "events", }, | |
| 643 | + | }; | |
| 644 | + | ||
| 641 | 645 | static int __drbd_cfg_context_from_attrs(struct drbd_cfg_context *s, | |
| 642 | 646 | struct nlattr ***ret_nested_attribute_table, | |
| 643 | 647 | struct genl_info *info) | |
modified drivers/block/virtio_blk.c
| @@ -743,7 +743,6 @@ static int virtblk_read_zoned_limits(struct virtio_blk *vblk, | |||
| 743 | 743 | dev_warn(&vdev->dev, "zero write granularity reported\n"); | |
| 744 | 744 | return -ENODEV; | |
| 745 | 745 | } | |
| 746 | - | lim->zone_write_granularity = wg; | |
| 747 | 746 | lim->physical_block_size = wg; | |
| 748 | 747 | lim->io_min = wg; | |
| 749 | 748 | ||
modified drivers/block/zloop.c
| @@ -800,27 +800,6 @@ static void zloop_cmd_workfn(struct work_struct *work) | |||
| 800 | 800 | current->flags = orig_flags; | |
| 801 | 801 | } | |
| 802 | 802 | ||
| 803 | - | static void zloop_fill_zero_rq(struct request *rq, unsigned int zero_from) | |
| 804 | - | { | |
| 805 | - | struct req_iterator iter; | |
| 806 | - | struct bio_vec bv; | |
| 807 | - | unsigned int pos = 0; | |
| 808 | - | unsigned int end, off; | |
| 809 | - | ||
| 810 | - | rq_for_each_segment(bv, rq, iter) { | |
| 811 | - | end = pos + bv.bv_len; | |
| 812 | - | if (end > zero_from) { | |
| 813 | - | if (pos < zero_from) | |
| 814 | - | off = zero_from - pos; | |
| 815 | - | else | |
| 816 | - | off = 0; | |
| 817 | - | memzero_page(bv.bv_page, bv.bv_offset + off, | |
| 818 | - | bv.bv_len - off); | |
| 819 | - | } | |
| 820 | - | pos = end; | |
| 821 | - | } | |
| 822 | - | } | |
| 823 | - | ||
| 824 | 803 | static void zloop_complete_rq(struct request *rq) | |
| 825 | 804 | { | |
| 826 | 805 | struct zloop_cmd *cmd = blk_mq_rq_to_pdu(rq); | |
| @@ -835,9 +814,13 @@ static void zloop_complete_rq(struct request *rq) | |||
| 835 | 814 | pr_err("Zone %u: failed read sector %llu, %llu sectors\n", | |
| 836 | 815 | zone_no, cmd->sector, cmd->nr_sectors); | |
| 837 | 816 | ||
| 838 | - | /* Short read. Zero out the unread tail beyond cmd->ret. */ | |
| 839 | - | if (cmd->ret >= 0 && cmd->ret != blk_rq_bytes(rq)) | |
| 840 | - | zloop_fill_zero_rq(rq, cmd->ret); | |
| 817 | + | if (cmd->ret >= 0 && cmd->ret != blk_rq_bytes(rq)) { | |
| 818 | + | /* short read */ | |
| 819 | + | struct bio *bio; | |
| 820 | + | ||
| 821 | + | __rq_for_each_bio(bio, rq) | |
| 822 | + | zero_fill_bio(bio); | |
| 823 | + | } | |
| 841 | 824 | break; | |
| 842 | 825 | case REQ_OP_WRITE: | |
| 843 | 826 | case REQ_OP_ZONE_APPEND: | |
modified drivers/bluetooth/btintel.c
| @@ -289,8 +289,7 @@ void btintel_hw_error(struct hci_dev *hdev, u8 code) | |||
| 289 | 289 | goto unlock; | |
| 290 | 290 | } | |
| 291 | 291 | ||
| 292 | - | bt_dev_err(hdev, "Exception info %.*s", (int)(skb->len - 1), | |
| 293 | - | (char *)(skb->data + 1)); | |
| 292 | + | bt_dev_err(hdev, "Exception info %s", (char *)(skb->data + 1)); | |
| 294 | 293 | ||
| 295 | 294 | kfree_skb(skb); | |
| 296 | 295 | ||
| @@ -409,16 +408,8 @@ int btintel_load_ddc_config(struct hci_dev *hdev, const char *ddc_name) | |||
| 409 | 408 | /* DDC file contains one or more DDC structure which has | |
| 410 | 409 | * Length (1 byte), DDC ID (2 bytes), and DDC value (Length - 2). | |
| 411 | 410 | */ | |
| 412 | - | while (fw->size > (size_t)(fw_ptr - fw->data)) { | |
| 413 | - | size_t remaining = fw->size - (fw_ptr - fw->data); | |
| 414 | - | unsigned int cmd_plen = fw_ptr[0] + 1U; | |
| 415 | - | ||
| 416 | - | if (cmd_plen < 3 || cmd_plen > U8_MAX || cmd_plen > remaining) { | |
| 417 | - | bt_dev_err(hdev, "Malformed DDC record (plen=%u, remaining=%zu)", | |
| 418 | - | cmd_plen, remaining); | |
| 419 | - | release_firmware(fw); | |
| 420 | - | return -EINVAL; | |
| 421 | - | } | |
| 411 | + | while (fw->size > fw_ptr - fw->data) { | |
| 412 | + | u8 cmd_plen = fw_ptr[0] + sizeof(u8); | |
| 422 | 413 | ||
| 423 | 414 | skb = __hci_cmd_sync(hdev, 0xfc8b, cmd_plen, fw_ptr, | |
| 424 | 415 | HCI_INIT_TIMEOUT); | |
modified drivers/bluetooth/btintel_pcie.c
| @@ -401,7 +401,7 @@ static int btintel_pcie_send_sync(struct btintel_pcie_data *data, | |||
| 401 | 401 | ||
| 402 | 402 | tfd_index = data->ia.tr_hia[BTINTEL_PCIE_TXQ_NUM]; | |
| 403 | 403 | ||
| 404 | - | if (tfd_index >= txq->count) | |
| 404 | + | if (tfd_index > txq->count) | |
| 405 | 405 | return -ERANGE; | |
| 406 | 406 | ||
| 407 | 407 | if (skb->len > BTINTEL_PCIE_BUFFER_SIZE - BTINTEL_PCIE_HCI_TYPE_LEN) { | |
| @@ -1197,7 +1197,7 @@ static int btintel_pcie_recv_frame(struct btintel_pcie_data *data, | |||
| 1197 | 1197 | { | |
| 1198 | 1198 | int ret; | |
| 1199 | 1199 | u8 pkt_type; | |
| 1200 | - | u32 plen; | |
| 1200 | + | u16 plen; | |
| 1201 | 1201 | u32 pcie_pkt_type; | |
| 1202 | 1202 | void *pdata; | |
| 1203 | 1203 | struct hci_dev *hdev = data->hdev; | |
| @@ -1777,7 +1777,7 @@ static irqreturn_t btintel_pcie_irq_msix_handler(int irq, void *dev_id) | |||
| 1777 | 1777 | static int btintel_pcie_setup_irq(struct btintel_pcie_data *data) | |
| 1778 | 1778 | { | |
| 1779 | 1779 | int err; | |
| 1780 | - | int num_irqs, i, j; | |
| 1780 | + | int num_irqs, i; | |
| 1781 | 1781 | ||
| 1782 | 1782 | for (i = 0; i < BTINTEL_PCIE_MSIX_VEC_MAX; i++) | |
| 1783 | 1783 | data->msix_entries[i].entry = i; | |
| @@ -1806,10 +1806,6 @@ static int btintel_pcie_setup_irq(struct btintel_pcie_data *data) | |||
| 1806 | 1806 | KBUILD_MODNAME, | |
| 1807 | 1807 | msix_entry); | |
| 1808 | 1808 | if (err) { | |
| 1809 | - | for (j = 0; j < i; j++) | |
| 1810 | - | devm_free_irq(&data->pdev->dev, | |
| 1811 | - | data->msix_entries[j].vector, | |
| 1812 | - | &data->msix_entries[j]); | |
| 1813 | 1809 | pci_free_irq_vectors(data->pdev); | |
| 1814 | 1810 | data->alloc_vecs = 0; | |
| 1815 | 1811 | return err; | |
| @@ -1881,13 +1877,6 @@ static int btintel_pcie_config_pcie(struct pci_dev *pdev, | |||
| 1881 | 1877 | if (IS_ERR(data->base_addr)) | |
| 1882 | 1878 | return PTR_ERR(data->base_addr); | |
| 1883 | 1879 | ||
| 1884 | - | /* Do shared hardware reset to ensure a clean start before | |
| 1885 | - | * configuring interrupts. | |
| 1886 | - | */ | |
| 1887 | - | err = btintel_pcie_reset_bt(data); | |
| 1888 | - | if (err) | |
| 1889 | - | return err; | |
| 1890 | - | ||
| 1891 | 1880 | err = btintel_pcie_setup_irq(data); | |
| 1892 | 1881 | if (err) | |
| 1893 | 1882 | return err; | |
| @@ -2230,16 +2219,6 @@ static int btintel_pcie_send_frame(struct hci_dev *hdev, | |||
| 2230 | 2219 | if (test_bit(BTINTEL_PCIE_RECOVERY_IN_PROGRESS, &data->flags)) | |
| 2231 | 2220 | return -ENODEV; | |
| 2232 | 2221 | ||
| 2233 | - | /* Account for the 4-byte PCIe type header prepended before the | |
| 2234 | - | * DMA copy. Written as a subtraction to avoid wrap-around on | |
| 2235 | - | * attacker-controlled skb->len. | |
| 2236 | - | */ | |
| 2237 | - | if (skb->len > BTINTEL_PCIE_BUFFER_SIZE - BTINTEL_PCIE_HCI_TYPE_LEN) { | |
| 2238 | - | bt_dev_err(hdev, "Packet too large: %u > %u", skb->len, | |
| 2239 | - | BTINTEL_PCIE_BUFFER_SIZE - BTINTEL_PCIE_HCI_TYPE_LEN); | |
| 2240 | - | return -EMSGSIZE; | |
| 2241 | - | } | |
| 2242 | - | ||
| 2243 | 2222 | /* Due to the fw limitation, the type header of the packet should be | |
| 2244 | 2223 | * 4 bytes unlike 1 byte for UART. In UART, the firmware can read | |
| 2245 | 2224 | * the first byte to get the packet type and redirect the rest of data | |
| @@ -3149,7 +3128,7 @@ static void btintel_pcie_remove(struct pci_dev *pdev) | |||
| 3149 | 3128 | struct msix_entry *msix_entry; | |
| 3150 | 3129 | ||
| 3151 | 3130 | msix_entry = &data->msix_entries[i]; | |
| 3152 | - | devm_free_irq(&pdev->dev, msix_entry->vector, msix_entry); | |
| 3131 | + | free_irq(msix_entry->vector, msix_entry); | |
| 3153 | 3132 | } | |
| 3154 | 3133 | ||
| 3155 | 3134 | pci_free_irq_vectors(pdev); | |
modified drivers/char/mem.c
| @@ -503,7 +503,7 @@ static int mmap_zero_prepare(struct vm_area_desc *desc) | |||
| 503 | 503 | #ifndef CONFIG_MMU | |
| 504 | 504 | return -ENOSYS; | |
| 505 | 505 | #endif | |
| 506 | - | if (vma_desc_test(desc, VMA_MAYSHARE_BIT)) | |
| 506 | + | if (vma_desc_test(desc, VMA_SHARED_BIT)) | |
| 507 | 507 | return shmem_zero_setup_desc(desc); | |
| 508 | 508 | ||
| 509 | 509 | /* | |
modified drivers/char/tpm/tpm-interface.c
| @@ -268,7 +268,7 @@ ssize_t tpm_transmit_cmd(struct tpm_chip *chip, struct tpm_buf *buf, | |||
| 268 | 268 | int err; | |
| 269 | 269 | ssize_t len; | |
| 270 | 270 | ||
| 271 | - | len = tpm_transmit(chip, buf->data, buf->capacity); | |
| 271 | + | len = tpm_transmit(chip, buf->data, PAGE_SIZE); | |
| 272 | 272 | if (len < 0) | |
| 273 | 273 | return len; | |
| 274 | 274 | ||
modified drivers/char/tpm/tpm2-cmd.c
| @@ -281,10 +281,8 @@ int tpm2_get_random(struct tpm_chip *chip, u8 *dest, size_t max) | |||
| 281 | 281 | } | |
| 282 | 282 | tpm_buf_append_u16(buf, num_bytes); | |
| 283 | 283 | err = tpm_buf_fill_hmac_session(chip, buf); | |
| 284 | - | if (err) { | |
| 285 | - | tpm2_end_auth_session(chip); | |
| 284 | + | if (err) | |
| 286 | 285 | return err; | |
| 287 | - | } | |
| 288 | 286 | ||
| 289 | 287 | err = tpm_transmit_cmd(chip, buf, | |
| 290 | 288 | offsetof(struct tpm2_get_random_out, | |
| @@ -307,7 +305,7 @@ int tpm2_get_random(struct tpm_chip *chip, u8 *dest, size_t max) | |||
| 307 | 305 | out = (struct tpm2_get_random_out *)&buf->data[offset]; | |
| 308 | 306 | recd = min_t(u32, be16_to_cpu(out->size), num_bytes); | |
| 309 | 307 | if (tpm_buf_length(buf) < | |
| 310 | - | offset + | |
| 308 | + | TPM_HEADER_SIZE + | |
| 311 | 309 | offsetof(struct tpm2_get_random_out, buffer) + | |
| 312 | 310 | recd) { | |
| 313 | 311 | tpm2_end_auth_session(chip); | |
modified drivers/char/tpm/tpm2-sessions.c
| @@ -975,7 +975,6 @@ static int tpm2_load_null(struct tpm_chip *chip, u32 *null_key) | |||
| 975 | 975 | /* Deduce from the name change TPM interference: */ | |
| 976 | 976 | dev_err(&chip->dev, "null key integrity check failed\n"); | |
| 977 | 977 | tpm2_flush_context(chip, tmp_null_key); | |
| 978 | - | rc = -ENODEV; | |
| 979 | 978 | ||
| 980 | 979 | err: | |
| 981 | 980 | if (rc) { | |
modified drivers/clk/qcom/gcc-eliza.c
| @@ -3010,6 +3010,8 @@ static const u32 gcc_eliza_critical_cbcrs[] = { | |||
| 3010 | 3010 | 0x26034, /* GCC_CAMERA_XO_CLK */ | |
| 3011 | 3011 | 0x27004, /* GCC_DISP_AHB_CLK */ | |
| 3012 | 3012 | 0x71004, /* GCC_GPU_CFG_AHB_CLK */ | |
| 3013 | + | 0x52010, /* GCC_PCIE_RSCC_CFG_AHB_CLK */ | |
| 3014 | + | 0x52010, /* GCC_PCIE_RSCC_XO_CLK */ | |
| 3013 | 3015 | 0x32004, /* GCC_VIDEO_AHB_CLK */ | |
| 3014 | 3016 | 0x32038, /* GCC_VIDEO_XO_CLK */ | |
| 3015 | 3017 | }; | |
| @@ -3043,10 +3045,6 @@ static const struct regmap_config gcc_eliza_regmap_config = { | |||
| 3043 | 3045 | ||
| 3044 | 3046 | static void clk_eliza_regs_configure(struct device *dev, struct regmap *regmap) | |
| 3045 | 3047 | { | |
| 3046 | - | /* Keep clocks always enabled */ | |
| 3047 | - | regmap_update_bits(regmap, 0x52010, BIT(20), BIT(20)); /* GCC_PCIE_RSCC_CFG_AHB_CLK */ | |
| 3048 | - | regmap_update_bits(regmap, 0x52010, BIT(21), BIT(21)); /* GCC_PCIE_RSCC_XO_CLK */ | |
| 3049 | - | ||
| 3050 | 3048 | /* FORCE_MEM_CORE_ON for ufs phy ice core and gcc ufs phy axi clocks */ | |
| 3051 | 3049 | qcom_branch_set_force_mem_core(regmap, gcc_ufs_phy_ice_core_clk, true); | |
| 3052 | 3050 | qcom_branch_set_force_mem_core(regmap, gcc_ufs_phy_axi_clk, true); | |
modified drivers/clk/qcom/gcc-hawi.c
| @@ -3692,6 +3692,8 @@ static const u32 gcc_hawi_critical_cbcrs[] = { | |||
| 3692 | 3692 | 0x67084, /* GCC_PCIE_1_RSC_CORE_CLK */ | |
| 3693 | 3693 | 0x43014, /* GCC_PCIE_LINK_XO_CLK */ | |
| 3694 | 3694 | 0x6b088, /* GCC_PCIE_RSC_CORE_CLK */ | |
| 3695 | + | 0x52010, /* GCC_PCIE_RSCC_CFG_AHB_CLK */ | |
| 3696 | + | 0x52010, /* GCC_PCIE_RSCC_XO_CLK */ | |
| 3695 | 3697 | 0x32004, /* GCC_VIDEO_AHB_CLK */ | |
| 3696 | 3698 | 0x32028, /* GCC_VIDEO_XO_CLK */ | |
| 3697 | 3699 | }; | |
| @@ -3761,10 +3763,6 @@ static const struct regmap_config gcc_hawi_regmap_config = { | |||
| 3761 | 3763 | ||
| 3762 | 3764 | static void clk_hawi_regs_configure(struct device *dev, struct regmap *regmap) | |
| 3763 | 3765 | { | |
| 3764 | - | /* Keep clocks always enabled */ | |
| 3765 | - | regmap_update_bits(regmap, 0x52010, BIT(20), BIT(20)); /* GCC_PCIE_RSCC_CFG_AHB_CLK */ | |
| 3766 | - | regmap_update_bits(regmap, 0x52010, BIT(21), BIT(21)); /* GCC_PCIE_RSCC_XO_CLK */ | |
| 3767 | - | ||
| 3768 | 3766 | /* FORCE_MEM_CORE_ON for ufs phy ice core clocks */ | |
| 3769 | 3767 | qcom_branch_set_force_mem_core(regmap, gcc_ufs_phy_ice_core_clk, true); | |
| 3770 | 3768 | } | |
modified drivers/clk/qcom/gcc-kaanapali.c
| @@ -3464,6 +3464,8 @@ static const u32 gcc_kaanapali_critical_cbcrs[] = { | |||
| 3464 | 3464 | 0x9f004, /* GCC_EVA_AHB_CLK */ | |
| 3465 | 3465 | 0x9f024, /* GCC_EVA_XO_CLK */ | |
| 3466 | 3466 | 0x71004, /* GCC_GPU_CFG_AHB_CLK */ | |
| 3467 | + | 0x52010, /* GCC_PCIE_RSCC_CFG_AHB_CLK */ | |
| 3468 | + | 0x52010, /* GCC_PCIE_RSCC_XO_CLK */ | |
| 3467 | 3469 | 0x32004, /* GCC_VIDEO_AHB_CLK */ | |
| 3468 | 3470 | 0x32040, /* GCC_VIDEO_XO_CLK */ | |
| 3469 | 3471 | }; | |
| @@ -3478,10 +3480,6 @@ static const struct regmap_config gcc_kaanapali_regmap_config = { | |||
| 3478 | 3480 | ||
| 3479 | 3481 | static void clk_kaanapali_regs_configure(struct device *dev, struct regmap *regmap) | |
| 3480 | 3482 | { | |
| 3481 | - | /* Keep clocks always enabled */ | |
| 3482 | - | regmap_update_bits(regmap, 0x52010, BIT(20), BIT(20)); /* GCC_PCIE_RSCC_CFG_AHB_CLK */ | |
| 3483 | - | regmap_update_bits(regmap, 0x52010, BIT(21), BIT(21)); /* GCC_PCIE_RSCC_XO_CLK */ | |
| 3484 | - | ||
| 3485 | 3483 | /* FORCE_MEM_CORE_ON for ufs phy ice core clocks */ | |
| 3486 | 3484 | qcom_branch_set_force_mem_core(regmap, gcc_ufs_phy_ice_core_clk, true); | |
| 3487 | 3485 | } | |
modified drivers/clk/qcom/gpucc-glymur.c
| @@ -510,7 +510,7 @@ static struct gdsc gpu_cc_cx_gdsc = { | |||
| 510 | 510 | .name = "gpu_cc_cx_gdsc", | |
| 511 | 511 | }, | |
| 512 | 512 | .pwrsts = PWRSTS_OFF_ON, | |
| 513 | - | .flags = RETAIN_FF_ENABLE | VOTABLE, | |
| 513 | + | .flags = POLL_CFG_GDSCR | RETAIN_FF_ENABLE, | |
| 514 | 514 | }; | |
| 515 | 515 | ||
| 516 | 516 | static struct clk_regmap *gpu_cc_glymur_clocks[] = { | |
modified drivers/clk/qcom/gpucc-kaanapali.c
| @@ -380,7 +380,7 @@ static struct gdsc gpu_cc_cx_gdsc = { | |||
| 380 | 380 | .name = "gpu_cc_cx_gdsc", | |
| 381 | 381 | }, | |
| 382 | 382 | .pwrsts = PWRSTS_OFF_ON, | |
| 383 | - | .flags = RETAIN_FF_ENABLE | VOTABLE, | |
| 383 | + | .flags = POLL_CFG_GDSCR | RETAIN_FF_ENABLE, | |
| 384 | 384 | }; | |
| 385 | 385 | ||
| 386 | 386 | static struct clk_regmap *gpu_cc_kaanapali_clocks[] = { | |
modified drivers/clk/spacemit/ccu-k3.c
| @@ -30,87 +30,14 @@ static const struct ccu_pll_rate_tbl pll2_rate_tbl[] = { | |||
| 30 | 30 | }; | |
| 31 | 31 | ||
| 32 | 32 | static const struct ccu_pll_rate_tbl pll3_rate_tbl[] = { | |
| 33 | - | CCU_PLLA_RATE(1050000000UL, 0x0b2b3000, 0x00000000, 0xa0458080), | |
| 34 | - | CCU_PLLA_RATE(1100000000UL, 0x0b2d3555, 0x00005500, 0xa0458181), | |
| 35 | - | CCU_PLLA_RATE(1150000000UL, 0x0b2f3aaa, 0x0000ab00, 0xa0458181), | |
| 36 | - | CCU_PLLA_RATE(1200000000UL, 0x0b320000, 0x00000000, 0xa0458181), | |
| 37 | - | CCU_PLLA_RATE(1250000000UL, 0x0b340555, 0x00005500, 0xa0458181), | |
| 38 | - | CCU_PLLA_RATE(1300000000UL, 0x0b360aaa, 0x0000ab00, 0xa0458282), | |
| 39 | - | CCU_PLLA_RATE(1350000000UL, 0x0b381000, 0x00000000, 0xa0458282), | |
| 40 | - | CCU_PLLA_RATE(1400000000UL, 0x0b3a1555, 0x00005500, 0xa0458282), | |
| 41 | - | CCU_PLLA_RATE(1450000000UL, 0x0b3c1aaa, 0x0000ab00, 0xa0458383), | |
| 42 | - | CCU_PLLA_RATE(1500000000UL, 0x0b3e2000, 0x00000000, 0xa0458383), | |
| 43 | - | CCU_PLLA_RATE(1550000000UL, 0x0b402555, 0x00005500, 0xa0458383), | |
| 44 | - | CCU_PLLA_RATE(1600000000UL, 0x0b422aaa, 0x0000ab00, 0xa0458484), | |
| 45 | - | CCU_PLLA_RATE(1650000000UL, 0x0b443000, 0x00000000, 0xa0458484), | |
| 46 | - | CCU_PLLA_RATE(1700000000UL, 0x0b463555, 0x00005500, 0xa0458484), | |
| 47 | - | CCU_PLLA_RATE(1750000000UL, 0x0b483aaa, 0x0000ab00, 0xa0458585), | |
| 48 | - | CCU_PLLA_RATE(1800000000UL, 0x0b4b0000, 0x00000000, 0xa0458585), | |
| 49 | - | CCU_PLLA_RATE(1850000000UL, 0x0b4d0555, 0x00005500, 0xa0458585), | |
| 50 | - | CCU_PLLA_RATE(1900000000UL, 0x0b4f0aaa, 0x0000ab00, 0xa0458686), | |
| 51 | - | CCU_PLLA_RATE(1950000000UL, 0x0b511000, 0x00000000, 0xa0458686), | |
| 52 | - | CCU_PLLA_RATE(2000000000UL, 0x0b292aaa, 0x0000ab00, 0xa0558686), | |
| 53 | - | CCU_PLLA_RATE(2050000000UL, 0x0b2a2d55, 0x00005500, 0xa0558686), | |
| 54 | - | CCU_PLLA_RATE(2100000000UL, 0x0b2b3000, 0x00000000, 0xa0558787), | |
| 55 | - | CCU_PLLA_RATE(2150000000UL, 0x0b2c32aa, 0x0000ab00, 0xa0558787), | |
| 56 | 33 | CCU_PLLA_RATE(2200000000UL, 0x0b2d3555, 0x00005500, 0xa0558787), | |
| 57 | - | CCU_PLLA_RATE(2250000000UL, 0x0b2e3800, 0x00000000, 0xa0558888), | |
| 58 | - | CCU_PLLA_RATE(2300000000UL, 0x0b2f3aaa, 0x0000ab00, 0xa0558888), | |
| 59 | - | CCU_PLLA_RATE(2350000000UL, 0x0b303d55, 0x00005500, 0xa0558888), | |
| 60 | - | CCU_PLLA_RATE(2400000000UL, 0x0b320000, 0x00000000, 0xa0558989), | |
| 61 | 34 | }; | |
| 62 | 35 | ||
| 63 | 36 | static const struct ccu_pll_rate_tbl pll4_rate_tbl[] = { | |
| 64 | - | CCU_PLLA_RATE(1050000000UL, 0x0b2b3000, 0x00000000, 0xa0458080), | |
| 65 | - | CCU_PLLA_RATE(1100000000UL, 0x0b2d3555, 0x00005500, 0xa0458181), | |
| 66 | - | CCU_PLLA_RATE(1150000000UL, 0x0b2f3aaa, 0x0000ab00, 0xa0458181), | |
| 67 | - | CCU_PLLA_RATE(1200000000UL, 0x0b320000, 0x00000000, 0xa0458181), | |
| 68 | - | CCU_PLLA_RATE(1250000000UL, 0x0b340555, 0x00005500, 0xa0458181), | |
| 69 | - | CCU_PLLA_RATE(1300000000UL, 0x0b360aaa, 0x0000ab00, 0xa0458282), | |
| 70 | - | CCU_PLLA_RATE(1350000000UL, 0x0b381000, 0x00000000, 0xa0458282), | |
| 71 | - | CCU_PLLA_RATE(1400000000UL, 0x0b3a1555, 0x00005500, 0xa0458282), | |
| 72 | - | CCU_PLLA_RATE(1450000000UL, 0x0b3c1aaa, 0x0000ab00, 0xa0458383), | |
| 73 | - | CCU_PLLA_RATE(1500000000UL, 0x0b3e2000, 0x00000000, 0xa0458383), | |
| 74 | - | CCU_PLLA_RATE(1550000000UL, 0x0b402555, 0x00005500, 0xa0458383), | |
| 75 | - | CCU_PLLA_RATE(1600000000UL, 0x0b422aaa, 0x0000ab00, 0xa0458484), | |
| 76 | - | CCU_PLLA_RATE(1650000000UL, 0x0b443000, 0x00000000, 0xa0458484), | |
| 77 | - | CCU_PLLA_RATE(1700000000UL, 0x0b463555, 0x00005500, 0xa0458484), | |
| 78 | - | CCU_PLLA_RATE(1750000000UL, 0x0b483aaa, 0x0000ab00, 0xa0458585), | |
| 79 | - | CCU_PLLA_RATE(1800000000UL, 0x0b4b0000, 0x00000000, 0xa0458585), | |
| 80 | - | CCU_PLLA_RATE(1850000000UL, 0x0b4d0555, 0x00005500, 0xa0458585), | |
| 81 | - | CCU_PLLA_RATE(1900000000UL, 0x0b4f0aaa, 0x0000ab00, 0xa0458686), | |
| 82 | - | CCU_PLLA_RATE(1950000000UL, 0x0b511000, 0x00000000, 0xa0458686), | |
| 83 | - | CCU_PLLA_RATE(2000000000UL, 0x0b292aaa, 0x0000ab00, 0xa0558686), | |
| 84 | - | CCU_PLLA_RATE(2050000000UL, 0x0b2a2d55, 0x00005500, 0xa0558686), | |
| 85 | - | CCU_PLLA_RATE(2100000000UL, 0x0b2b3000, 0x00000000, 0xa0558787), | |
| 86 | - | CCU_PLLA_RATE(2150000000UL, 0x0b2c32aa, 0x0000ab00, 0xa0558787), | |
| 87 | 37 | CCU_PLLA_RATE(2200000000UL, 0x0b2d3555, 0x00005500, 0xa0558787), | |
| 88 | - | CCU_PLLA_RATE(2250000000UL, 0x0b2e3800, 0x00000000, 0xa0558888), | |
| 89 | - | CCU_PLLA_RATE(2300000000UL, 0x0b2f3aaa, 0x0000ab00, 0xa0558888), | |
| 90 | - | CCU_PLLA_RATE(2350000000UL, 0x0b303d55, 0x00005500, 0xa0558888), | |
| 91 | - | CCU_PLLA_RATE(2400000000UL, 0x0b320000, 0x00000000, 0xa0558989), | |
| 92 | 38 | }; | |
| 93 | 39 | ||
| 94 | 40 | static const struct ccu_pll_rate_tbl pll5_rate_tbl[] = { | |
| 95 | - | CCU_PLLA_RATE(1050000000UL, 0x0b2b3000, 0x00000000, 0xa0458080), | |
| 96 | - | CCU_PLLA_RATE(1100000000UL, 0x0b2d3555, 0x00005500, 0xa0458181), | |
| 97 | - | CCU_PLLA_RATE(1150000000UL, 0x0b2f3aaa, 0x0000ab00, 0xa0458181), | |
| 98 | - | CCU_PLLA_RATE(1200000000UL, 0x0b320000, 0x00000000, 0xa0458181), | |
| 99 | - | CCU_PLLA_RATE(1250000000UL, 0x0b340555, 0x00005500, 0xa0458181), | |
| 100 | - | CCU_PLLA_RATE(1300000000UL, 0x0b360aaa, 0x0000ab00, 0xa0458282), | |
| 101 | - | CCU_PLLA_RATE(1350000000UL, 0x0b381000, 0x00000000, 0xa0458282), | |
| 102 | - | CCU_PLLA_RATE(1400000000UL, 0x0b3a1555, 0x00005500, 0xa0458282), | |
| 103 | - | CCU_PLLA_RATE(1450000000UL, 0x0b3c1aaa, 0x0000ab00, 0xa0458383), | |
| 104 | - | CCU_PLLA_RATE(1500000000UL, 0x0b3e2000, 0x00000000, 0xa0458383), | |
| 105 | - | CCU_PLLA_RATE(1550000000UL, 0x0b402555, 0x00005500, 0xa0458383), | |
| 106 | - | CCU_PLLA_RATE(1600000000UL, 0x0b422aaa, 0x0000ab00, 0xa0458484), | |
| 107 | - | CCU_PLLA_RATE(1650000000UL, 0x0b443000, 0x00000000, 0xa0458484), | |
| 108 | - | CCU_PLLA_RATE(1700000000UL, 0x0b463555, 0x00005500, 0xa0458484), | |
| 109 | - | CCU_PLLA_RATE(1750000000UL, 0x0b483aaa, 0x0000ab00, 0xa0458585), | |
| 110 | - | CCU_PLLA_RATE(1800000000UL, 0x0b4b0000, 0x00000000, 0xa0458585), | |
| 111 | - | CCU_PLLA_RATE(1850000000UL, 0x0b4d0555, 0x00005500, 0xa0458585), | |
| 112 | - | CCU_PLLA_RATE(1900000000UL, 0x0b4f0aaa, 0x0000ab00, 0xa0458686), | |
| 113 | - | CCU_PLLA_RATE(1950000000UL, 0x0b511000, 0x00000000, 0xa0458686), | |
| 114 | 41 | CCU_PLLA_RATE(2000000000UL, 0x0b292aaa, 0x0000ab00, 0xa0558686), | |
| 115 | 42 | }; | |
| 116 | 43 | ||
| @@ -123,25 +50,6 @@ static const struct ccu_pll_rate_tbl pll7_rate_tbl[] = { | |||
| 123 | 50 | }; | |
| 124 | 51 | ||
| 125 | 52 | static const struct ccu_pll_rate_tbl pll8_rate_tbl[] = { | |
| 126 | - | CCU_PLLA_RATE(1050000000UL, 0x0b2b3000, 0x00000000, 0xa0458080), | |
| 127 | - | CCU_PLLA_RATE(1100000000UL, 0x0b2d3555, 0x00005500, 0xa0458181), | |
| 128 | - | CCU_PLLA_RATE(1150000000UL, 0x0b2f3aaa, 0x0000ab00, 0xa0458181), | |
| 129 | - | CCU_PLLA_RATE(1200000000UL, 0x0b320000, 0x00000000, 0xa0458181), | |
| 130 | - | CCU_PLLA_RATE(1250000000UL, 0x0b340555, 0x00005500, 0xa0458181), | |
| 131 | - | CCU_PLLA_RATE(1300000000UL, 0x0b360aaa, 0x0000ab00, 0xa0458282), | |
| 132 | - | CCU_PLLA_RATE(1350000000UL, 0x0b381000, 0x00000000, 0xa0458282), | |
| 133 | - | CCU_PLLA_RATE(1400000000UL, 0x0b3a1555, 0x00005500, 0xa0458282), | |
| 134 | - | CCU_PLLA_RATE(1450000000UL, 0x0b3c1aaa, 0x0000ab00, 0xa0458383), | |
| 135 | - | CCU_PLLA_RATE(1500000000UL, 0x0b3e2000, 0x00000000, 0xa0458383), | |
| 136 | - | CCU_PLLA_RATE(1550000000UL, 0x0b402555, 0x00005500, 0xa0458383), | |
| 137 | - | CCU_PLLA_RATE(1600000000UL, 0x0b422aaa, 0x0000ab00, 0xa0458484), | |
| 138 | - | CCU_PLLA_RATE(1650000000UL, 0x0b443000, 0x00000000, 0xa0458484), | |
| 139 | - | CCU_PLLA_RATE(1700000000UL, 0x0b463555, 0x00005500, 0xa0458484), | |
| 140 | - | CCU_PLLA_RATE(1750000000UL, 0x0b483aaa, 0x0000ab00, 0xa0458585), | |
| 141 | - | CCU_PLLA_RATE(1800000000UL, 0x0b4b0000, 0x00000000, 0xa0458585), | |
| 142 | - | CCU_PLLA_RATE(1850000000UL, 0x0b4d0555, 0x00005500, 0xa0458585), | |
| 143 | - | CCU_PLLA_RATE(1900000000UL, 0x0b4f0aaa, 0x0000ab00, 0xa0458686), | |
| 144 | - | CCU_PLLA_RATE(1950000000UL, 0x0b511000, 0x00000000, 0xa0458686), | |
| 145 | 53 | CCU_PLLA_RATE(2000000000UL, 0x0b292aaa, 0x0000ab00, 0xa0558686), | |
| 146 | 54 | }; | |
| 147 | 55 | ||
modified drivers/clk/ti/composite.c
| @@ -52,7 +52,7 @@ static const struct clk_ops ti_composite_gate_ops = { | |||
| 52 | 52 | ||
| 53 | 53 | struct component_clk { | |
| 54 | 54 | int num_parents; | |
| 55 | - | const char **parent_names; | |
| 55 | + | struct clk_parent_data *parent_data; | |
| 56 | 56 | struct device_node *node; | |
| 57 | 57 | int type; | |
| 58 | 58 | struct clk_hw *hw; | |
| @@ -116,7 +116,7 @@ static void __init _register_composite(void *user, | |||
| 116 | 116 | struct clk_hw_omap_comp *cclk = to_clk_hw_comp(hw); | |
| 117 | 117 | struct component_clk *comp; | |
| 118 | 118 | int num_parents = 0; | |
| 119 | - | const char **parent_names = NULL; | |
| 119 | + | struct clk_parent_data *parent_data = NULL; | |
| 120 | 120 | const char *name; | |
| 121 | 121 | int i; | |
| 122 | 122 | int ret; | |
| @@ -155,7 +155,7 @@ static void __init _register_composite(void *user, | |||
| 155 | 155 | continue; | |
| 156 | 156 | if (comp->num_parents) { | |
| 157 | 157 | num_parents = comp->num_parents; | |
| 158 | - | parent_names = comp->parent_names; | |
| 158 | + | parent_data = comp->parent_data; | |
| 159 | 159 | break; | |
| 160 | 160 | } | |
| 161 | 161 | } | |
| @@ -166,8 +166,8 @@ static void __init _register_composite(void *user, | |||
| 166 | 166 | } | |
| 167 | 167 | ||
| 168 | 168 | name = ti_dt_clk_name(node); | |
| 169 | - | clk = clk_register_composite(NULL, name, | |
| 170 | - | parent_names, num_parents, | |
| 169 | + | clk = clk_register_composite_pdata(NULL, name, | |
| 170 | + | parent_data, num_parents, | |
| 171 | 171 | _get_hw(cclk, CLK_COMPONENT_TYPE_MUX), | |
| 172 | 172 | &ti_clk_mux_ops, | |
| 173 | 173 | _get_hw(cclk, CLK_COMPONENT_TYPE_DIVIDER), | |
| @@ -190,7 +190,7 @@ cleanup: | |||
| 190 | 190 | if (!cclk->comp_clks[i]) | |
| 191 | 191 | continue; | |
| 192 | 192 | list_del(&cclk->comp_clks[i]->link); | |
| 193 | - | kfree(cclk->comp_clks[i]->parent_names); | |
| 193 | + | kfree(cclk->comp_clks[i]->parent_data); | |
| 194 | 194 | kfree(cclk->comp_clks[i]); | |
| 195 | 195 | } | |
| 196 | 196 | ||
| @@ -237,8 +237,9 @@ int __init ti_clk_add_component(struct device_node *node, struct clk_hw *hw, | |||
| 237 | 237 | int type) | |
| 238 | 238 | { | |
| 239 | 239 | unsigned int num_parents; | |
| 240 | - | const char **parent_names; | |
| 240 | + | struct clk_parent_data *parent_data; | |
| 241 | 241 | struct component_clk *clk; | |
| 242 | + | unsigned int i; | |
| 242 | 243 | ||
| 243 | 244 | num_parents = of_clk_get_parent_count(node); | |
| 244 | 245 | ||
| @@ -247,20 +248,21 @@ int __init ti_clk_add_component(struct device_node *node, struct clk_hw *hw, | |||
| 247 | 248 | return -EINVAL; | |
| 248 | 249 | } | |
| 249 | 250 | ||
| 250 | - | parent_names = kcalloc(num_parents, sizeof(char *), GFP_KERNEL); | |
| 251 | - | if (!parent_names) | |
| 251 | + | parent_data = kzalloc_objs(*parent_data, num_parents); | |
| 252 | + | if (!parent_data) | |
| 252 | 253 | return -ENOMEM; | |
| 253 | 254 | ||
| 254 | - | of_clk_parent_fill(node, parent_names, num_parents); | |
| 255 | + | for (i = 0; i < num_parents; i++) | |
| 256 | + | parent_data[i].index = i; | |
| 255 | 257 | ||
| 256 | 258 | clk = kzalloc_obj(*clk); | |
| 257 | 259 | if (!clk) { | |
| 258 | - | kfree(parent_names); | |
| 260 | + | kfree(parent_data); | |
| 259 | 261 | return -ENOMEM; | |
| 260 | 262 | } | |
| 261 | 263 | ||
| 262 | 264 | clk->num_parents = num_parents; | |
| 263 | - | clk->parent_names = parent_names; | |
| 265 | + | clk->parent_data = parent_data; | |
| 264 | 266 | clk->hw = hw; | |
| 265 | 267 | clk->node = node; | |
| 266 | 268 | clk->type = type; | |
modified drivers/cpufreq/cpufreq.c
| @@ -2590,8 +2590,8 @@ static void cpufreq_update_pressure(struct cpufreq_policy *policy) | |||
| 2590 | 2590 | ||
| 2591 | 2591 | cpu = cpumask_first(policy->related_cpus); | |
| 2592 | 2592 | max_freq = arch_scale_freq_ref(cpu); | |
| 2593 | - | if (!max_freq && cpufreq_driver->scale_freq_ref) | |
| 2594 | - | max_freq = cpufreq_driver->scale_freq_ref(policy); | |
| 2593 | + | if (!max_freq) | |
| 2594 | + | max_freq = policy->cpuinfo.max_freq; | |
| 2595 | 2595 | ||
| 2596 | 2596 | capped_freq = policy->max; | |
| 2597 | 2597 | ||
modified drivers/cpufreq/intel_pstate.c
| @@ -1135,14 +1135,6 @@ static bool hybrid_clear_max_perf_cpu(void) | |||
| 1135 | 1135 | return ret; | |
| 1136 | 1136 | } | |
| 1137 | 1137 | ||
| 1138 | - | static unsigned int intel_pstate_scale_freq_ref(struct cpufreq_policy *policy) | |
| 1139 | - | { | |
| 1140 | - | if (READ_ONCE(all_cpu_data[policy->cpu]->capacity_perf)) | |
| 1141 | - | return policy->cpuinfo.max_freq; | |
| 1142 | - | ||
| 1143 | - | return 0; | |
| 1144 | - | } | |
| 1145 | - | ||
| 1146 | 1138 | static void intel_pstate_update_freq_limits(struct cpudata *cpu) | |
| 1147 | 1139 | { | |
| 1148 | 1140 | int scaling = cpu->pstate.scaling; | |
| @@ -3096,7 +3088,6 @@ static struct cpufreq_driver intel_pstate = { | |||
| 3096 | 3088 | .offline = intel_pstate_cpu_offline, | |
| 3097 | 3089 | .online = intel_pstate_cpu_online, | |
| 3098 | 3090 | .update_limits = intel_pstate_update_limits, | |
| 3099 | - | .scale_freq_ref = intel_pstate_scale_freq_ref, | |
| 3100 | 3091 | .name = "intel_pstate", | |
| 3101 | 3092 | }; | |
| 3102 | 3093 | ||
| @@ -3420,7 +3411,6 @@ static struct cpufreq_driver intel_cpufreq = { | |||
| 3420 | 3411 | .suspend = intel_cpufreq_suspend, | |
| 3421 | 3412 | .resume = intel_pstate_resume, | |
| 3422 | 3413 | .update_limits = intel_pstate_update_limits, | |
| 3423 | - | .scale_freq_ref = intel_pstate_scale_freq_ref, | |
| 3424 | 3414 | .name = "intel_cpufreq", | |
| 3425 | 3415 | }; | |
| 3426 | 3416 | ||
modified drivers/edac/altera_edac.c
| @@ -453,6 +453,15 @@ free: | |||
| 453 | 453 | return res; | |
| 454 | 454 | } | |
| 455 | 455 | ||
| 456 | + | static void altr_sdram_remove(struct platform_device *pdev) | |
| 457 | + | { | |
| 458 | + | struct mem_ctl_info *mci = platform_get_drvdata(pdev); | |
| 459 | + | ||
| 460 | + | edac_mc_del_mc(&pdev->dev); | |
| 461 | + | edac_mc_free(mci); | |
| 462 | + | platform_set_drvdata(pdev, NULL); | |
| 463 | + | } | |
| 464 | + | ||
| 456 | 465 | /* | |
| 457 | 466 | * If you want to suspend, need to disable EDAC by removing it | |
| 458 | 467 | * from the device tree or defconfig. | |
| @@ -472,13 +481,13 @@ static const struct dev_pm_ops altr_sdram_pm_ops = { | |||
| 472 | 481 | ||
| 473 | 482 | static struct platform_driver altr_sdram_edac_driver = { | |
| 474 | 483 | .probe = altr_sdram_probe, | |
| 484 | + | .remove = altr_sdram_remove, | |
| 475 | 485 | .driver = { | |
| 476 | 486 | .name = "altr_sdram_edac", | |
| 477 | 487 | #ifdef CONFIG_PM | |
| 478 | 488 | .pm = &altr_sdram_pm_ops, | |
| 479 | 489 | #endif | |
| 480 | 490 | .of_match_table = altr_sdram_ctrl_of_match, | |
| 481 | - | .suppress_bind_attrs = true, | |
| 482 | 491 | }, | |
| 483 | 492 | }; | |
| 484 | 493 | ||
| @@ -508,7 +517,6 @@ static struct platform_driver altr_edac_driver = { | |||
| 508 | 517 | .driver = { | |
| 509 | 518 | .name = "socfpga_ecc_manager", | |
| 510 | 519 | .of_match_table = altr_edac_of_match, | |
| 511 | - | .suppress_bind_attrs = true, | |
| 512 | 520 | }, | |
| 513 | 521 | }; | |
| 514 | 522 | module_platform_driver(altr_edac_driver); | |
| @@ -795,12 +803,22 @@ fail: | |||
| 795 | 803 | return res; | |
| 796 | 804 | } | |
| 797 | 805 | ||
| 806 | + | static void altr_edac_device_remove(struct platform_device *pdev) | |
| 807 | + | { | |
| 808 | + | struct edac_device_ctl_info *dci = platform_get_drvdata(pdev); | |
| 809 | + | struct altr_edac_device_dev *drvdata = dci->pvt_info; | |
| 810 | + | ||
| 811 | + | debugfs_remove_recursive(drvdata->debugfs_dir); | |
| 812 | + | edac_device_del_device(&pdev->dev); | |
| 813 | + | edac_device_free_ctl_info(dci); | |
| 814 | + | } | |
| 815 | + | ||
| 798 | 816 | static struct platform_driver altr_edac_device_driver = { | |
| 799 | 817 | .probe = altr_edac_device_probe, | |
| 818 | + | .remove = altr_edac_device_remove, | |
| 800 | 819 | .driver = { | |
| 801 | 820 | .name = "altr_edac_device", | |
| 802 | 821 | .of_match_table = altr_edac_device_of_match, | |
| 803 | - | .suppress_bind_attrs = true, | |
| 804 | 822 | }, | |
| 805 | 823 | }; | |
| 806 | 824 | module_platform_driver(altr_edac_device_driver); | |
| @@ -926,7 +944,7 @@ static int __maybe_unused altr_init_memory_port(void __iomem *ioaddr, int port) | |||
| 926 | 944 | return ret; | |
| 927 | 945 | } | |
| 928 | 946 | ||
| 929 | - | static int __maybe_unused | |
| 947 | + | static __init int __maybe_unused | |
| 930 | 948 | altr_init_a10_ecc_block(struct device_node *np, u32 irq_mask, | |
| 931 | 949 | u32 ecc_ctrl_en_mask, bool dual_port) | |
| 932 | 950 | { | |
| @@ -1001,7 +1019,7 @@ out: | |||
| 1001 | 1019 | ||
| 1002 | 1020 | static int validate_parent_available(struct device_node *np); | |
| 1003 | 1021 | static const struct of_device_id altr_edac_a10_device_of_match[]; | |
| 1004 | - | static int __maybe_unused altr_init_a10_ecc_device_type(char *compat) | |
| 1022 | + | static int __init __maybe_unused altr_init_a10_ecc_device_type(char *compat) | |
| 1005 | 1023 | { | |
| 1006 | 1024 | int irq; | |
| 1007 | 1025 | struct device_node *child, *np; | |
| @@ -1330,7 +1348,7 @@ static const struct edac_device_prv_data a10_l2ecc_data = { | |||
| 1330 | 1348 | ||
| 1331 | 1349 | #ifdef CONFIG_EDAC_ALTERA_ETHERNET | |
| 1332 | 1350 | ||
| 1333 | - | static int socfpga_init_ethernet_ecc(struct altr_edac_device_dev *dev) | |
| 1351 | + | static int __init socfpga_init_ethernet_ecc(struct altr_edac_device_dev *dev) | |
| 1334 | 1352 | { | |
| 1335 | 1353 | int ret; | |
| 1336 | 1354 | ||
| @@ -1360,7 +1378,7 @@ static const struct edac_device_prv_data a10_enetecc_data = { | |||
| 1360 | 1378 | ||
| 1361 | 1379 | #ifdef CONFIG_EDAC_ALTERA_NAND | |
| 1362 | 1380 | ||
| 1363 | - | static int socfpga_init_nand_ecc(struct altr_edac_device_dev *device) | |
| 1381 | + | static int __init socfpga_init_nand_ecc(struct altr_edac_device_dev *device) | |
| 1364 | 1382 | { | |
| 1365 | 1383 | int ret; | |
| 1366 | 1384 | ||
| @@ -1390,7 +1408,7 @@ static const struct edac_device_prv_data a10_nandecc_data = { | |||
| 1390 | 1408 | ||
| 1391 | 1409 | #ifdef CONFIG_EDAC_ALTERA_DMA | |
| 1392 | 1410 | ||
| 1393 | - | static int socfpga_init_dma_ecc(struct altr_edac_device_dev *device) | |
| 1411 | + | static int __init socfpga_init_dma_ecc(struct altr_edac_device_dev *device) | |
| 1394 | 1412 | { | |
| 1395 | 1413 | int ret; | |
| 1396 | 1414 | ||
| @@ -1420,7 +1438,7 @@ static const struct edac_device_prv_data a10_dmaecc_data = { | |||
| 1420 | 1438 | ||
| 1421 | 1439 | #ifdef CONFIG_EDAC_ALTERA_USB | |
| 1422 | 1440 | ||
| 1423 | - | static int socfpga_init_usb_ecc(struct altr_edac_device_dev *device) | |
| 1441 | + | static int __init socfpga_init_usb_ecc(struct altr_edac_device_dev *device) | |
| 1424 | 1442 | { | |
| 1425 | 1443 | int ret; | |
| 1426 | 1444 | ||
| @@ -1450,7 +1468,7 @@ static const struct edac_device_prv_data a10_usbecc_data = { | |||
| 1450 | 1468 | ||
| 1451 | 1469 | #ifdef CONFIG_EDAC_ALTERA_QSPI | |
| 1452 | 1470 | ||
| 1453 | - | static int socfpga_init_qspi_ecc(struct altr_edac_device_dev *device) | |
| 1471 | + | static int __init socfpga_init_qspi_ecc(struct altr_edac_device_dev *device) | |
| 1454 | 1472 | { | |
| 1455 | 1473 | int ret; | |
| 1456 | 1474 | ||
| @@ -1506,7 +1524,6 @@ static int altr_portb_setup(struct altr_edac_device_dev *device) | |||
| 1506 | 1524 | dci = edac_device_alloc_ctl_info(sizeof(*altdev), ecc_name, 1, | |
| 1507 | 1525 | ecc_name, 1, 0, edac_idx); | |
| 1508 | 1526 | if (!dci) { | |
| 1509 | - | of_node_put(np); | |
| 1510 | 1527 | edac_printk(KERN_ERR, EDAC_DEVICE, | |
| 1511 | 1528 | "%s: Unable to allocate PortB EDAC device\n", | |
| 1512 | 1529 | ecc_name); | |
| @@ -1517,11 +1534,8 @@ static int altr_portb_setup(struct altr_edac_device_dev *device) | |||
| 1517 | 1534 | altdev = dci->pvt_info; | |
| 1518 | 1535 | *altdev = *device; | |
| 1519 | 1536 | ||
| 1520 | - | if (!devres_open_group(device->edac->dev, altr_portb_setup, GFP_KERNEL)) { | |
| 1521 | - | edac_device_free_ctl_info(dci); | |
| 1522 | - | of_node_put(np); | |
| 1537 | + | if (!devres_open_group(device->edac->dev, altr_portb_setup, GFP_KERNEL)) | |
| 1523 | 1538 | return -ENOMEM; | |
| 1524 | - | } | |
| 1525 | 1539 | ||
| 1526 | 1540 | /* Update PortB specific values */ | |
| 1527 | 1541 | altdev->edac_dev_name = ecc_name; | |
| @@ -1586,8 +1600,6 @@ static int altr_portb_setup(struct altr_edac_device_dev *device) | |||
| 1586 | 1600 | rc = -ENOMEM; | |
| 1587 | 1601 | goto err_release_group_1; | |
| 1588 | 1602 | } | |
| 1589 | - | of_node_put(np); | |
| 1590 | - | ||
| 1591 | 1603 | altr_create_edacdev_dbgfs(dci, prv); | |
| 1592 | 1604 | ||
| 1593 | 1605 | list_add(&altdev->next, &altdev->edac->a10_ecc_devices); | |
| @@ -1597,20 +1609,14 @@ static int altr_portb_setup(struct altr_edac_device_dev *device) | |||
| 1597 | 1609 | return 0; | |
| 1598 | 1610 | ||
| 1599 | 1611 | err_release_group_1: | |
| 1600 | - | /* | |
| 1601 | - | * Release the devres group first so the managed IRQs are | |
| 1602 | - | * unregistered before dci (which contains the IRQ handler's | |
| 1603 | - | * data via dci->pvt_info) is freed, avoiding a use-after-free. | |
| 1604 | - | */ | |
| 1605 | - | devres_release_group(device->edac->dev, altr_portb_setup); | |
| 1606 | 1612 | edac_device_free_ctl_info(dci); | |
| 1607 | - | of_node_put(np); | |
| 1613 | + | devres_release_group(device->edac->dev, altr_portb_setup); | |
| 1608 | 1614 | edac_printk(KERN_ERR, EDAC_DEVICE, | |
| 1609 | 1615 | "%s:Error setting up EDAC device: %d\n", ecc_name, rc); | |
| 1610 | 1616 | return rc; | |
| 1611 | 1617 | } | |
| 1612 | 1618 | ||
| 1613 | - | static int socfpga_init_sdmmc_ecc(struct altr_edac_device_dev *device) | |
| 1619 | + | static int __init socfpga_init_sdmmc_ecc(struct altr_edac_device_dev *device) | |
| 1614 | 1620 | { | |
| 1615 | 1621 | int rc = -ENODEV; | |
| 1616 | 1622 | struct device_node *child; | |
| @@ -1632,7 +1638,7 @@ static int socfpga_init_sdmmc_ecc(struct altr_edac_device_dev *device) | |||
| 1632 | 1638 | goto exit; | |
| 1633 | 1639 | ||
| 1634 | 1640 | /* Setup portB */ | |
| 1635 | - | rc = altr_portb_setup(device); | |
| 1641 | + | return altr_portb_setup(device); | |
| 1636 | 1642 | ||
| 1637 | 1643 | exit: | |
| 1638 | 1644 | of_node_put(child); | |
| @@ -2007,17 +2013,9 @@ static int altr_edac_a10_device_add(struct altr_arria10_edac *edac, | |||
| 2007 | 2013 | return 0; | |
| 2008 | 2014 | ||
| 2009 | 2015 | err_release_group1: | |
| 2010 | - | /* | |
| 2011 | - | * Release the devres group first so the managed IRQs are | |
| 2012 | - | * unregistered before dci (which contains the IRQ handler's | |
| 2013 | - | * data via dci->pvt_info) is freed, avoiding a use-after-free. | |
| 2014 | - | */ | |
| 2015 | - | devres_release_group(edac->dev, NULL); | |
| 2016 | 2016 | edac_device_free_ctl_info(dci); | |
| 2017 | - | goto err_print; | |
| 2018 | 2017 | err_release_group: | |
| 2019 | 2018 | devres_release_group(edac->dev, NULL); | |
| 2020 | - | err_print: | |
| 2021 | 2019 | edac_printk(KERN_ERR, EDAC_DEVICE, | |
| 2022 | 2020 | "%s:Error setting up EDAC device: %d\n", ecc_name, rc); | |
| 2023 | 2021 | ||
| @@ -2216,7 +2214,6 @@ static struct platform_driver altr_edac_a10_driver = { | |||
| 2216 | 2214 | .driver = { | |
| 2217 | 2215 | .name = "socfpga_a10_ecc_manager", | |
| 2218 | 2216 | .of_match_table = altr_edac_a10_of_match, | |
| 2219 | - | .suppress_bind_attrs = true, | |
| 2220 | 2217 | }, | |
| 2221 | 2218 | }; | |
| 2222 | 2219 | module_platform_driver(altr_edac_a10_driver); | |
modified drivers/edac/amd64_edac.c
| @@ -2796,13 +2796,13 @@ static inline void decode_bus_error(int node_id, struct mce *m) | |||
| 2796 | 2796 | * the instance_id. For example, instance_id=0xYXXXXX where Y is the channel | |
| 2797 | 2797 | * number. | |
| 2798 | 2798 | * | |
| 2799 | - | * For DRAM ECC errors, the Chip Select number is given in bits [1:0] of | |
| 2799 | + | * For DRAM ECC errors, the Chip Select number is given in bits [2:0] of | |
| 2800 | 2800 | * the MCA_SYND[ErrorInformation] field. | |
| 2801 | 2801 | */ | |
| 2802 | 2802 | static void umc_get_err_info(struct mce *m, struct err_info *err) | |
| 2803 | 2803 | { | |
| 2804 | 2804 | err->channel = (m->ipid & GENMASK(31, 0)) >> 20; | |
| 2805 | - | err->csrow = m->synd & 0x3; | |
| 2805 | + | err->csrow = m->synd & 0x7; | |
| 2806 | 2806 | } | |
| 2807 | 2807 | ||
| 2808 | 2808 | static void decode_umc_error(int node_id, struct mce *m) | |
modified drivers/edac/versalnet_edac.c
| @@ -953,7 +953,6 @@ static void mc_remove(struct platform_device *pdev) | |||
| 953 | 953 | remove_versalnet(priv); | |
| 954 | 954 | rproc_shutdown(priv->mcdi->r5_rproc); | |
| 955 | 955 | cdx_mcdi_finish(priv->mcdi); | |
| 956 | - | rproc_put(priv->mcdi->r5_rproc); | |
| 957 | 956 | kfree(priv->mcdi); | |
| 958 | 957 | } | |
| 959 | 958 | ||
modified drivers/gpio/gpio-exar.c
| @@ -199,7 +199,6 @@ static int gpio_exar_probe(struct platform_device *pdev) | |||
| 199 | 199 | index = ida_alloc(&ida_index, GFP_KERNEL); | |
| 200 | 200 | if (index < 0) | |
| 201 | 201 | return index; | |
| 202 | - | exar_gpio->index = index; | |
| 203 | 202 | ||
| 204 | 203 | ret = devm_add_action_or_reset(dev, exar_devm_ida_free, exar_gpio); | |
| 205 | 204 | if (ret) | |
| @@ -215,6 +214,7 @@ static int gpio_exar_probe(struct platform_device *pdev) | |||
| 215 | 214 | exar_gpio->gpio_chip.set = exar_set_value; | |
| 216 | 215 | exar_gpio->gpio_chip.base = -1; | |
| 217 | 216 | exar_gpio->gpio_chip.ngpio = ngpios; | |
| 217 | + | exar_gpio->index = index; | |
| 218 | 218 | exar_gpio->first_pin = first_pin; | |
| 219 | 219 | ||
| 220 | 220 | ret = devm_gpiochip_add_data(dev, &exar_gpio->gpio_chip, exar_gpio); | |
modified drivers/gpio/gpio-mpsse.c
| @@ -10,7 +10,6 @@ | |||
| 10 | 10 | #include <linux/cleanup.h> | |
| 11 | 11 | #include <linux/gpio/driver.h> | |
| 12 | 12 | #include <linux/mutex.h> | |
| 13 | - | #include <linux/rcupdate.h> | |
| 14 | 13 | #include <linux/spinlock.h> | |
| 15 | 14 | #include <linux/usb.h> | |
| 16 | 15 | ||
| @@ -25,7 +24,6 @@ struct mpsse_priv { | |||
| 25 | 24 | raw_spinlock_t irq_spin; /* protects worker list */ | |
| 26 | 25 | atomic_t irq_type[16]; /* pin -> edge detection type */ | |
| 27 | 26 | atomic_t irq_enabled; | |
| 28 | - | atomic_t dying; /* no new workers after disconnect */ | |
| 29 | 27 | int id; | |
| 30 | 28 | ||
| 31 | 29 | u8 gpio_outputs[2]; /* Output states for GPIOs [L, H] */ | |
| @@ -48,7 +46,6 @@ struct mpsse_worker { | |||
| 48 | 46 | atomic_t cancelled; | |
| 49 | 47 | struct list_head list; /* linked list */ | |
| 50 | 48 | struct list_head destroy; /* teardown linked list */ | |
| 51 | - | struct rcu_head rcu; /* deferred free for dying path */ | |
| 52 | 49 | }; | |
| 53 | 50 | ||
| 54 | 51 | struct bulk_desc { | |
| @@ -528,24 +525,10 @@ static void gpio_mpsse_irq_enable(struct irq_data *irqd) | |||
| 528 | 525 | worker->priv = priv; | |
| 529 | 526 | INIT_LIST_HEAD(&worker->list); | |
| 530 | 527 | INIT_WORK(&worker->work, gpio_mpsse_poll); | |
| 528 | + | schedule_work(&worker->work); | |
| 531 | 529 | ||
| 532 | - | scoped_guard(raw_spinlock_irqsave, &priv->irq_spin) { | |
| 533 | - | if (atomic_read(&priv->dying)) { | |
| 534 | - | /* | |
| 535 | - | * Cannot kfree() here: this callback | |
| 536 | - | * runs with the IRQ descriptor's raw | |
| 537 | - | * spinlock held and kfree() may sleep | |
| 538 | - | * on PREEMPT_RT. The worker is not | |
| 539 | - | * yet published, so the deferred free | |
| 540 | - | * is unobservable. | |
| 541 | - | */ | |
| 542 | - | kfree_rcu(worker, rcu); | |
| 543 | - | return; | |
| 544 | - | } | |
| 545 | - | ||
| 530 | + | scoped_guard(raw_spinlock_irqsave, &priv->irq_spin) | |
| 546 | 531 | list_add(&worker->list, &priv->workers); | |
| 547 | - | schedule_work(&worker->work); | |
| 548 | - | } | |
| 549 | 532 | } | |
| 550 | 533 | } | |
| 551 | 534 | ||
| @@ -721,9 +704,6 @@ static void gpio_mpsse_disconnect(struct usb_interface *intf) | |||
| 721 | 704 | { | |
| 722 | 705 | struct mpsse_priv *priv = usb_get_intfdata(intf); | |
| 723 | 706 | ||
| 724 | - | scoped_guard(raw_spinlock_irqsave, &priv->irq_spin) | |
| 725 | - | atomic_set(&priv->dying, 1); | |
| 726 | - | ||
| 727 | 707 | /* | |
| 728 | 708 | * Lock prevents double-free of worker from here and the teardown | |
| 729 | 709 | * step at the beginning of gpio_mpsse_poll | |
modified drivers/gpio/gpio-mxc.c
| @@ -7,7 +7,6 @@ | |||
| 7 | 7 | // Authors: Daniel Mack, Juergen Beisert. | |
| 8 | 8 | // Copyright (C) 2004-2010 Freescale Semiconductor, Inc. All Rights Reserved. | |
| 9 | 9 | ||
| 10 | - | #include <linux/bitops.h> | |
| 11 | 10 | #include <linux/cleanup.h> | |
| 12 | 11 | #include <linux/clk.h> | |
| 13 | 12 | #include <linux/err.h> | |
| @@ -69,11 +68,11 @@ struct mxc_gpio_port { | |||
| 69 | 68 | struct irq_domain *domain; | |
| 70 | 69 | struct gpio_generic_chip gen_gc; | |
| 71 | 70 | struct device *dev; | |
| 72 | - | unsigned long both_edges; | |
| 71 | + | u32 both_edges; | |
| 73 | 72 | struct mxc_gpio_reg_saved gpio_saved_reg; | |
| 74 | 73 | bool power_off; | |
| 74 | + | u32 wakeup_pads; | |
| 75 | 75 | bool is_pad_wakeup; | |
| 76 | - | unsigned long wakeup_pads; | |
| 77 | 76 | u32 pad_type[32]; | |
| 78 | 77 | const struct mxc_gpio_hwdata *hwdata; | |
| 79 | 78 | }; | |
| @@ -169,7 +168,7 @@ static int gpio_set_irq_type(struct irq_data *d, u32 type) | |||
| 169 | 168 | int edge; | |
| 170 | 169 | void __iomem *reg = port->base; | |
| 171 | 170 | ||
| 172 | - | clear_bit(gpio_idx, &port->both_edges); | |
| 171 | + | port->both_edges &= ~(1 << gpio_idx); | |
| 173 | 172 | switch (type) { | |
| 174 | 173 | case IRQ_TYPE_EDGE_RISING: | |
| 175 | 174 | edge = GPIO_INT_RISE_EDGE; | |
| @@ -189,7 +188,7 @@ static int gpio_set_irq_type(struct irq_data *d, u32 type) | |||
| 189 | 188 | edge = GPIO_INT_HIGH_LEV; | |
| 190 | 189 | pr_debug("mxc: set GPIO %d to high trigger\n", gpio_idx); | |
| 191 | 190 | } | |
| 192 | - | set_bit(gpio_idx, &port->both_edges); | |
| 191 | + | port->both_edges |= 1 << gpio_idx; | |
| 193 | 192 | } | |
| 194 | 193 | break; | |
| 195 | 194 | case IRQ_TYPE_LEVEL_LOW: | |
| @@ -260,7 +259,7 @@ static void mxc_gpio_irq_handler(struct mxc_gpio_port *port, u32 irq_stat) | |||
| 260 | 259 | while (irq_stat != 0) { | |
| 261 | 260 | int irqoffset = fls(irq_stat) - 1; | |
| 262 | 261 | ||
| 263 | - | if (test_bit(irqoffset, &port->both_edges)) | |
| 262 | + | if (port->both_edges & (1 << irqoffset)) | |
| 264 | 263 | mxc_flip_edge(port, irqoffset); | |
| 265 | 264 | ||
| 266 | 265 | generic_handle_domain_irq(port->domain, irqoffset); | |
| @@ -331,18 +330,16 @@ static int gpio_set_wake_irq(struct irq_data *d, u32 enable) | |||
| 331 | 330 | ret = enable_irq_wake(port->irq_high); | |
| 332 | 331 | else | |
| 333 | 332 | ret = enable_irq_wake(port->irq); | |
| 333 | + | port->wakeup_pads |= BIT(gpio_idx); | |
| 334 | 334 | } else { | |
| 335 | 335 | if (port->irq_high && (gpio_idx >= 16)) | |
| 336 | 336 | ret = disable_irq_wake(port->irq_high); | |
| 337 | 337 | else | |
| 338 | 338 | ret = disable_irq_wake(port->irq); | |
| 339 | + | port->wakeup_pads &= ~BIT(gpio_idx); | |
| 339 | 340 | } | |
| 340 | - | if (ret) | |
| 341 | - | return ret; | |
| 342 | - | ||
| 343 | - | assign_bit(gpio_idx, &port->wakeup_pads, enable); | |
| 344 | 341 | ||
| 345 | - | return 0; | |
| 342 | + | return ret; | |
| 346 | 343 | } | |
| 347 | 344 | ||
| 348 | 345 | static int mxc_gpio_init_gc(struct mxc_gpio_port *port, int irq_base) | |
| @@ -477,6 +474,8 @@ static int mxc_gpio_probe(struct platform_device *pdev) | |||
| 477 | 474 | } else | |
| 478 | 475 | port->mx_irq_handler = mx3_gpio_irq_handler; | |
| 479 | 476 | ||
| 477 | + | mxc_update_irq_chained_handler(port, true); | |
| 478 | + | ||
| 480 | 479 | config.dev = &pdev->dev; | |
| 481 | 480 | config.sz = 4; | |
| 482 | 481 | config.dat = port->base + GPIO_PSR; | |
| @@ -500,6 +499,10 @@ static int mxc_gpio_probe(struct platform_device *pdev) | |||
| 500 | 499 | else /* silence boot time warning */ | |
| 501 | 500 | port->gen_gc.gc.base = -1; | |
| 502 | 501 | ||
| 502 | + | err = devm_gpiochip_add_data(&pdev->dev, &port->gen_gc.gc, port); | |
| 503 | + | if (err) | |
| 504 | + | goto out_bgio; | |
| 505 | + | ||
| 503 | 506 | irq_base = devm_irq_alloc_descs(&pdev->dev, -1, 0, 32, numa_node_id()); | |
| 504 | 507 | if (irq_base < 0) { | |
| 505 | 508 | err = irq_base; | |
| @@ -520,19 +523,8 @@ static int mxc_gpio_probe(struct platform_device *pdev) | |||
| 520 | 523 | if (err < 0) | |
| 521 | 524 | goto out_irqdomain_remove; | |
| 522 | 525 | ||
| 523 | - | /* | |
| 524 | - | * Register the GPIO chip last: devm_gpiochip_add_data() makes the | |
| 525 | - | * chip visible to consumers immediately, so the IRQ domain and | |
| 526 | - | * generic irq chip must be ready before any to_irq() call. | |
| 527 | - | */ | |
| 528 | - | err = devm_gpiochip_add_data(&pdev->dev, &port->gen_gc.gc, port); | |
| 529 | - | if (err) | |
| 530 | - | goto out_irqdomain_remove; | |
| 531 | - | ||
| 532 | 526 | list_add_tail(&port->node, &mxc_gpio_ports); | |
| 533 | 527 | ||
| 534 | - | mxc_update_irq_chained_handler(port, true); | |
| 535 | - | ||
| 536 | 528 | platform_set_drvdata(pdev, port); | |
| 537 | 529 | pm_runtime_put_autosuspend(&pdev->dev); | |
| 538 | 530 | ||
modified drivers/gpio/gpio-nct6694.c
| @@ -444,7 +444,7 @@ static int nct6694_gpio_probe(struct platform_device *pdev) | |||
| 444 | 444 | data->gpio.set_config = nct6694_set_config; | |
| 445 | 445 | data->gpio.init_valid_mask = nct6694_init_valid_mask; | |
| 446 | 446 | data->gpio.base = -1; | |
| 447 | - | data->gpio.can_sleep = true; | |
| 447 | + | data->gpio.can_sleep = false; | |
| 448 | 448 | data->gpio.owner = THIS_MODULE; | |
| 449 | 449 | data->gpio.ngpio = NCT6694_NR_GPIO; | |
| 450 | 450 | ||
modified drivers/gpio/gpio-xilinx.c
| @@ -271,7 +271,14 @@ static void xgpio_save_regs(struct xgpio_instance *chip) | |||
| 271 | 271 | ||
| 272 | 272 | static int xgpio_request(struct gpio_chip *chip, unsigned int offset) | |
| 273 | 273 | { | |
| 274 | - | return pm_runtime_resume_and_get(chip->parent); | |
| 274 | + | int ret; | |
| 275 | + | ||
| 276 | + | ret = pm_runtime_get_sync(chip->parent); | |
| 277 | + | /* | |
| 278 | + | * If the device is already active pm_runtime_get() will return 1 on | |
| 279 | + | * success, but gpio_request still needs to return 0. | |
| 280 | + | */ | |
| 281 | + | return ret < 0 ? ret : 0; | |
| 275 | 282 | } | |
| 276 | 283 | ||
| 277 | 284 | static void xgpio_free(struct gpio_chip *chip, unsigned int offset) | |
modified drivers/gpio/gpiolib-kunit.c
| @@ -28,8 +28,6 @@ | |||
| 28 | 28 | ||
| 29 | 29 | #define GPIO_TEST_PROVIDER_NGPIO 4 | |
| 30 | 30 | ||
| 31 | - | KUNIT_DEFINE_ACTION_WRAPPER(gpio_device_put_wrapper, gpio_device_put, struct gpio_device *); | |
| 32 | - | ||
| 33 | 31 | /* | |
| 34 | 32 | * The test provider tracks per-line direction and value so that lines can be | |
| 35 | 33 | * driven as both inputs and outputs - this is needed to exercise input as well | |
| @@ -772,7 +770,6 @@ static void gpio_hog_assert(struct kunit *test, unsigned int offset, | |||
| 772 | 770 | struct property_entry properties[2]; | |
| 773 | 771 | struct platform_device *pdev; | |
| 774 | 772 | struct fwnode_handle *fwnode; | |
| 775 | - | struct gpio_device *gdev; | |
| 776 | 773 | struct gpio_desc *desc; | |
| 777 | 774 | bool bound = true; | |
| 778 | 775 | int ret; | |
| @@ -792,12 +789,10 @@ static void gpio_hog_assert(struct kunit *test, unsigned int offset, | |||
| 792 | 789 | wait_for_device_probe(); | |
| 793 | 790 | ||
| 794 | 791 | /* The hog must have configured the line with the expected direction. */ | |
| 795 | - | gdev = gpio_device_find_by_label(GPIO_CONSUMER_NAME); | |
| 792 | + | struct gpio_device *gdev __free(gpio_device_put) = | |
| 793 | + | gpio_device_find_by_label(GPIO_CONSUMER_NAME); | |
| 796 | 794 | KUNIT_ASSERT_NOT_ERR_OR_NULL(test, gdev); | |
| 797 | 795 | ||
| 798 | - | ret = kunit_add_action_or_reset(test, gpio_device_put_wrapper, gdev); | |
| 799 | - | KUNIT_ASSERT_EQ(test, ret, 0); | |
| 800 | - | ||
| 801 | 796 | desc = gpio_device_get_desc(gdev, offset); | |
| 802 | 797 | KUNIT_ASSERT_NOT_ERR_OR_NULL(test, desc); | |
| 803 | 798 | ||
modified drivers/gpio/gpiolib.c
| @@ -3954,17 +3954,16 @@ int gpiod_set_array_value_complex(bool raw, bool can_sleep, | |||
| 3954 | 3954 | } while ((i < array_size) && | |
| 3955 | 3955 | gpio_device_chip_cmp(desc_array[i]->gdev, guard.gc)); | |
| 3956 | 3956 | /* push collected bits to outputs */ | |
| 3957 | - | ret = 0; | |
| 3958 | - | if (count != 0) | |
| 3957 | + | if (count != 0) { | |
| 3959 | 3958 | ret = gpiochip_set_multiple(guard.gc, mask, bits); | |
| 3959 | + | if (ret) | |
| 3960 | + | return ret; | |
| 3961 | + | } | |
| 3960 | 3962 | ||
| 3961 | 3963 | if (mask != fastpath_mask) | |
| 3962 | 3964 | bitmap_free(mask); | |
| 3963 | 3965 | if (bits != fastpath_bits) | |
| 3964 | 3966 | bitmap_free(bits); | |
| 3965 | - | ||
| 3966 | - | if (ret) | |
| 3967 | - | return ret; | |
| 3968 | 3967 | } | |
| 3969 | 3968 | return 0; | |
| 3970 | 3969 | } | |
modified drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c
| @@ -318,7 +318,7 @@ static int acp_hw_init(struct amdgpu_ip_block *ip_block) | |||
| 318 | 318 | r = device_for_each_child(adev->acp.parent, &adev->acp.acp_genpd->gpd, | |
| 319 | 319 | acp_genpd_add_device); | |
| 320 | 320 | if (r) | |
| 321 | - | goto failure_remove_mfd; | |
| 321 | + | goto failure; | |
| 322 | 322 | break; | |
| 323 | 323 | } | |
| 324 | 324 | default: | |
| @@ -443,7 +443,7 @@ static int acp_hw_init(struct amdgpu_ip_block *ip_block) | |||
| 443 | 443 | r = device_for_each_child(adev->acp.parent, &adev->acp.acp_genpd->gpd, | |
| 444 | 444 | acp_genpd_add_device); | |
| 445 | 445 | if (r) | |
| 446 | - | goto failure_remove_mfd; | |
| 446 | + | goto failure; | |
| 447 | 447 | } | |
| 448 | 448 | ||
| 449 | 449 | /* Assert Soft reset of ACP */ | |
| @@ -461,7 +461,7 @@ static int acp_hw_init(struct amdgpu_ip_block *ip_block) | |||
| 461 | 461 | if (--count == 0) { | |
| 462 | 462 | dev_err(&adev->pdev->dev, "Failed to reset ACP\n"); | |
| 463 | 463 | r = -ETIMEDOUT; | |
| 464 | - | goto failure_remove_mfd; | |
| 464 | + | goto failure; | |
| 465 | 465 | } | |
| 466 | 466 | udelay(100); | |
| 467 | 467 | } | |
| @@ -479,7 +479,7 @@ static int acp_hw_init(struct amdgpu_ip_block *ip_block) | |||
| 479 | 479 | if (--count == 0) { | |
| 480 | 480 | dev_err(&adev->pdev->dev, "Failed to reset ACP\n"); | |
| 481 | 481 | r = -ETIMEDOUT; | |
| 482 | - | goto failure_remove_mfd; | |
| 482 | + | goto failure; | |
| 483 | 483 | } | |
| 484 | 484 | udelay(100); | |
| 485 | 485 | } | |
| @@ -489,11 +489,6 @@ static int acp_hw_init(struct amdgpu_ip_block *ip_block) | |||
| 489 | 489 | cgs_write_register(adev->acp.cgs_device, mmACP_SOFT_RESET, val); | |
| 490 | 490 | return 0; | |
| 491 | 491 | ||
| 492 | - | failure_remove_mfd: | |
| 493 | - | device_for_each_child(adev->acp.parent, NULL, | |
| 494 | - | acp_genpd_remove_device); | |
| 495 | - | mfd_remove_devices(adev->acp.parent); | |
| 496 | - | ||
| 497 | 492 | failure: | |
| 498 | 493 | kfree(adev->acp.i2s_pdata); | |
| 499 | 494 | kfree(adev->acp.acp_res); | |
modified drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
| @@ -598,18 +598,14 @@ int amdgpu_amdkfd_get_dmabuf_info(struct amdgpu_device *adev, int dma_buf_fd, | |||
| 598 | 598 | /* first get metadata_size by buffer = NULL */ | |
| 599 | 599 | r = amdgpu_bo_get_metadata(bo, NULL, 0, | |
| 600 | 600 | metadata_size, NULL); | |
| 601 | - | if (r) | |
| 602 | - | goto out_put; | |
| 603 | 601 | ||
| 604 | 602 | /* user buf_size is bigger than bo metadata_size | |
| 605 | 603 | * allocate a buf at kernel space and copy */ | |
| 606 | 604 | if (*metadata_size <= buffer_size) { | |
| 607 | 605 | *metadata_buffer = kzalloc(*metadata_size, GFP_KERNEL); | |
| 608 | 606 | ||
| 609 | - | if (!*metadata_buffer) { | |
| 610 | - | r = -ENOMEM; | |
| 611 | - | goto out_put; | |
| 612 | - | } | |
| 607 | + | if (!*metadata_buffer) | |
| 608 | + | return -ENOMEM; | |
| 613 | 609 | ||
| 614 | 610 | r = amdgpu_bo_get_metadata(bo, *metadata_buffer, *metadata_size, | |
| 615 | 611 | NULL, &metadata_flags); | |
modified drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
| @@ -121,20 +121,6 @@ static int amdgpu_debugfs_process_reg_op(bool read, struct file *f, | |||
| 121 | 121 | ||
| 122 | 122 | *pos &= (1UL << 22) - 1; | |
| 123 | 123 | ||
| 124 | - | if (size > PAGE_SIZE) | |
| 125 | - | return -EINVAL; | |
| 126 | - | ||
| 127 | - | /* | |
| 128 | - | * Access the user buffer only while none of the locks below are held: | |
| 129 | - | * a fault takes mmap_lock, and grbm_idx_mutex and srbm_mutex nest | |
| 130 | - | * inside it. | |
| 131 | - | */ | |
| 132 | - | u32 *data __free(kfree) = kmalloc(size, GFP_KERNEL); | |
| 133 | - | if (!data) | |
| 134 | - | return -ENOMEM; | |
| 135 | - | if (!read && copy_from_user(data, buf, size)) | |
| 136 | - | return -EFAULT; | |
| 137 | - | ||
| 138 | 124 | r = pm_runtime_get_sync(adev_to_drm(adev)->dev); | |
| 139 | 125 | if (r < 0) { | |
| 140 | 126 | pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); | |
| @@ -166,16 +152,28 @@ static int amdgpu_debugfs_process_reg_op(bool read, struct file *f, | |||
| 166 | 152 | mutex_lock(&adev->pm.mutex); | |
| 167 | 153 | ||
| 168 | 154 | while (size) { | |
| 169 | - | if (read) | |
| 170 | - | data[result >> 2] = RREG32(*pos >> 2); | |
| 171 | - | else | |
| 172 | - | amdgpu_mm_wreg_mmio_rlc(adev, *pos >> 2, data[result >> 2], 0); | |
| 155 | + | uint32_t value; | |
| 156 | + | ||
| 157 | + | if (read) { | |
| 158 | + | value = RREG32(*pos >> 2); | |
| 159 | + | r = put_user(value, (uint32_t *)buf); | |
| 160 | + | } else { | |
| 161 | + | r = get_user(value, (uint32_t *)buf); | |
| 162 | + | if (!r) | |
| 163 | + | amdgpu_mm_wreg_mmio_rlc(adev, *pos >> 2, value, 0); | |
| 164 | + | } | |
| 165 | + | if (r) { | |
| 166 | + | result = r; | |
| 167 | + | goto end; | |
| 168 | + | } | |
| 173 | 169 | ||
| 174 | 170 | result += 4; | |
| 171 | + | buf += 4; | |
| 175 | 172 | *pos += 4; | |
| 176 | 173 | size -= 4; | |
| 177 | 174 | } | |
| 178 | 175 | ||
| 176 | + | end: | |
| 179 | 177 | if (use_bank) { | |
| 180 | 178 | amdgpu_gfx_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff, 0); | |
| 181 | 179 | mutex_unlock(&adev->grbm_idx_mutex); | |
| @@ -190,10 +188,6 @@ static int amdgpu_debugfs_process_reg_op(bool read, struct file *f, | |||
| 190 | 188 | pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); | |
| 191 | 189 | ||
| 192 | 190 | amdgpu_virt_disable_access_debugfs(adev); | |
| 193 | - | ||
| 194 | - | if (read && copy_to_user(buf, data, result)) | |
| 195 | - | return -EFAULT; | |
| 196 | - | ||
| 197 | 191 | return result; | |
| 198 | 192 | } | |
| 199 | 193 | ||
| @@ -244,24 +238,11 @@ static ssize_t amdgpu_debugfs_regs2_op(struct file *f, char __user *buf, u32 off | |||
| 244 | 238 | struct amdgpu_device *adev = rd->adev; | |
| 245 | 239 | ssize_t result = 0; | |
| 246 | 240 | int r; | |
| 241 | + | uint32_t value; | |
| 247 | 242 | ||
| 248 | 243 | if (size & 0x3 || offset & 0x3) | |
| 249 | 244 | return -EINVAL; | |
| 250 | 245 | ||
| 251 | - | if (size > PAGE_SIZE) | |
| 252 | - | return -EINVAL; | |
| 253 | - | ||
| 254 | - | /* | |
| 255 | - | * Access the user buffer only while none of the locks below are held: | |
| 256 | - | * a fault takes mmap_lock, and grbm_idx_mutex and srbm_mutex nest | |
| 257 | - | * inside it. | |
| 258 | - | */ | |
| 259 | - | u32 *data __free(kfree) = kmalloc(size, GFP_KERNEL); | |
| 260 | - | if (!data) | |
| 261 | - | return -ENOMEM; | |
| 262 | - | if (write_en && copy_from_user(data, buf, size)) | |
| 263 | - | return -EFAULT; | |
| 264 | - | ||
| 265 | 246 | r = pm_runtime_get_sync(adev_to_drm(adev)->dev); | |
| 266 | 247 | if (r < 0) { | |
| 267 | 248 | pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); | |
| @@ -300,16 +281,24 @@ static ssize_t amdgpu_debugfs_regs2_op(struct file *f, char __user *buf, u32 off | |||
| 300 | 281 | mutex_lock(&adev->pm.mutex); | |
| 301 | 282 | ||
| 302 | 283 | while (size) { | |
| 303 | - | if (!write_en) | |
| 304 | - | data[result >> 2] = RREG32(offset >> 2); | |
| 305 | - | else | |
| 306 | - | amdgpu_mm_wreg_mmio_rlc(adev, offset >> 2, data[result >> 2], | |
| 307 | - | rd->id.xcc_id); | |
| 284 | + | if (!write_en) { | |
| 285 | + | value = RREG32(offset >> 2); | |
| 286 | + | r = put_user(value, (uint32_t *)buf); | |
| 287 | + | } else { | |
| 288 | + | r = get_user(value, (uint32_t *)buf); | |
| 289 | + | if (!r) | |
| 290 | + | amdgpu_mm_wreg_mmio_rlc(adev, offset >> 2, value, rd->id.xcc_id); | |
| 291 | + | } | |
| 292 | + | if (r) { | |
| 293 | + | result = r; | |
| 294 | + | goto end; | |
| 295 | + | } | |
| 308 | 296 | offset += 4; | |
| 309 | 297 | size -= 4; | |
| 310 | 298 | result += 4; | |
| 299 | + | buf += 4; | |
| 311 | 300 | } | |
| 312 | - | ||
| 301 | + | end: | |
| 313 | 302 | if (rd->id.use_grbm) { | |
| 314 | 303 | amdgpu_gfx_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff, rd->id.xcc_id); | |
| 315 | 304 | mutex_unlock(&adev->grbm_idx_mutex); | |
| @@ -328,10 +317,6 @@ static ssize_t amdgpu_debugfs_regs2_op(struct file *f, char __user *buf, u32 off | |||
| 328 | 317 | pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); | |
| 329 | 318 | ||
| 330 | 319 | amdgpu_virt_disable_access_debugfs(adev); | |
| 331 | - | ||
| 332 | - | if (!write_en && copy_to_user(buf, data, result)) | |
| 333 | - | return -EFAULT; | |
| 334 | - | ||
| 335 | 320 | return result; | |
| 336 | 321 | } | |
| 337 | 322 | ||
modified drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
| @@ -1325,8 +1325,6 @@ static int amdgpu_discovery_sysfs_ips(struct amdgpu_device *adev, | |||
| 1325 | 1325 | ip_hw_instance->kobj.kset = &ip_hw_id->hw_id_kset; | |
| 1326 | 1326 | res = kobject_add(&ip_hw_instance->kobj, NULL, | |
| 1327 | 1327 | "%d", ip_hw_instance->num_instance); | |
| 1328 | - | if (res) | |
| 1329 | - | kobject_put(&ip_hw_instance->kobj); | |
| 1330 | 1328 | next_ip: | |
| 1331 | 1329 | if (reg_base_64) | |
| 1332 | 1330 | ip_offset += struct_size(ip, base_address_64, | |
modified drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
| @@ -2664,14 +2664,6 @@ static int amdgpu_pmops_suspend_noirq(struct device *dev) | |||
| 2664 | 2664 | struct amdgpu_device *adev = drm_to_adev(drm_dev); | |
| 2665 | 2665 | int r; | |
| 2666 | 2666 | ||
| 2667 | - | /* | |
| 2668 | - | * A GPU parked by vga_switcheroo has no power and no PCIe link, so the | |
| 2669 | - | * ASIC reset below would fail and abort the whole noirq suspend phase. | |
| 2670 | - | * Bail out like amdgpu_device_prepare/suspend/resume() already do. | |
| 2671 | - | */ | |
| 2672 | - | if (drm_dev->switch_power_state == DRM_SWITCH_POWER_OFF) | |
| 2673 | - | return 0; | |
| 2674 | - | ||
| 2675 | 2667 | if (amdgpu_acpi_should_gpu_reset(adev)) { | |
| 2676 | 2668 | amdgpu_device_lock_reset_domain(adev->reset_domain); | |
| 2677 | 2669 | r = amdgpu_asic_reset(adev); | |
modified drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
| @@ -724,14 +724,8 @@ void amdgpu_ring_set_fence_errors_and_reemit(struct amdgpu_ring *ring, | |||
| 724 | 724 | bool is_guilty_fence; | |
| 725 | 725 | bool is_guilty_context; | |
| 726 | 726 | ||
| 727 | - | last_seq = amdgpu_fence_read(ring); | |
| 728 | - | seq = ring->fence_drv.sync_seq; | |
| 729 | - | ||
| 730 | - | /* Hardware completion can precede the interrupt which signals fences. */ | |
| 731 | - | if (last_seq == seq) { | |
| 732 | - | amdgpu_fence_process(ring); | |
| 733 | - | return; | |
| 734 | - | } | |
| 727 | + | last_seq = amdgpu_fence_read(ring) & ring->fence_drv.num_fences_mask; | |
| 728 | + | seq = ring->fence_drv.sync_seq & ring->fence_drv.num_fences_mask; | |
| 735 | 729 | ||
| 736 | 730 | /* If there is nothing to reemit, return early and set an error on the fence | |
| 737 | 731 | * if applicable. If all of the fences are siganlled, this will be a nop. | |
| @@ -739,9 +733,7 @@ void amdgpu_ring_set_fence_errors_and_reemit(struct amdgpu_ring *ring, | |||
| 739 | 733 | * we are skipping it on purpose. | |
| 740 | 734 | */ | |
| 741 | 735 | if (!ring->ring_backup_entries_to_copy) { | |
| 742 | - | if (guilty_fence) | |
| 743 | - | amdgpu_fence_driver_force_completion(ring, | |
| 744 | - | &guilty_fence->base); | |
| 736 | + | amdgpu_fence_driver_force_completion(ring, &guilty_fence->base); | |
| 745 | 737 | return; | |
| 746 | 738 | } | |
| 747 | 739 | ring->reemit = true; | |
| @@ -749,8 +741,9 @@ void amdgpu_ring_set_fence_errors_and_reemit(struct amdgpu_ring *ring, | |||
| 749 | 741 | spin_lock_irqsave(&ring->fence_drv.lock, flags); | |
| 750 | 742 | do { | |
| 751 | 743 | last_seq++; | |
| 744 | + | last_seq &= ring->fence_drv.num_fences_mask; | |
| 752 | 745 | ||
| 753 | - | ptr = &ring->fence_drv.fences[last_seq & ring->fence_drv.num_fences_mask]; | |
| 746 | + | ptr = &ring->fence_drv.fences[last_seq]; | |
| 754 | 747 | rcu_read_lock(); | |
| 755 | 748 | unprocessed = rcu_dereference(*ptr); | |
| 756 | 749 | ||
| @@ -807,24 +800,26 @@ void amdgpu_ring_backup_unprocessed_commands(struct amdgpu_ring *ring, | |||
| 807 | 800 | struct amdgpu_fence *fence; | |
| 808 | 801 | u32 seq, last_seq; | |
| 809 | 802 | ||
| 810 | - | last_seq = amdgpu_fence_read(ring); | |
| 811 | - | seq = ring->fence_drv.sync_seq; | |
| 803 | + | last_seq = amdgpu_fence_read(ring) & ring->fence_drv.num_fences_mask; | |
| 804 | + | seq = ring->fence_drv.sync_seq & ring->fence_drv.num_fences_mask; | |
| 812 | 805 | ring->ring_backup_entries_to_copy = 0; | |
| 813 | 806 | ||
| 814 | - | /* | |
| 815 | - | * Avoid replay loops for a repeated guilty fence. NULL identifies a | |
| 816 | - | * collateral ring, whose pending commands still need backup. | |
| 807 | + | /* if we've already seen this fence, return early. | |
| 808 | + | * ring->ring_backup_entries_to_copy is set to 0 so | |
| 809 | + | * the reemit helper will return early as well to | |
| 810 | + | * avoid getting stuck in a reemit loop. | |
| 817 | 811 | */ | |
| 818 | - | if (guilty_fence && ring->guilty_fence == guilty_fence) { | |
| 812 | + | if (ring->guilty_fence == guilty_fence) { | |
| 819 | 813 | ring->guilty_fence = NULL; | |
| 820 | 814 | return; | |
| 821 | 815 | } | |
| 822 | 816 | ring->guilty_fence = guilty_fence; | |
| 823 | 817 | ||
| 824 | - | while (last_seq != seq) { | |
| 818 | + | do { | |
| 825 | 819 | last_seq++; | |
| 820 | + | last_seq &= ring->fence_drv.num_fences_mask; | |
| 826 | 821 | ||
| 827 | - | ptr = &ring->fence_drv.fences[last_seq & ring->fence_drv.num_fences_mask]; | |
| 822 | + | ptr = &ring->fence_drv.fences[last_seq]; | |
| 828 | 823 | rcu_read_lock(); | |
| 829 | 824 | unprocessed = rcu_dereference(*ptr); | |
| 830 | 825 | ||
| @@ -834,7 +829,7 @@ void amdgpu_ring_backup_unprocessed_commands(struct amdgpu_ring *ring, | |||
| 834 | 829 | amdgpu_ring_backup_unprocessed_command(ring, fence); | |
| 835 | 830 | } | |
| 836 | 831 | rcu_read_unlock(); | |
| 837 | - | } | |
| 832 | + | } while (last_seq != seq); | |
| 838 | 833 | } | |
| 839 | 834 | ||
| 840 | 835 | struct amdgpu_fence * | |
modified drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
| @@ -1080,17 +1080,20 @@ void amdgpu_gmc_init_vga_resv_regions(struct amdgpu_device *adev) | |||
| 1080 | 1080 | case CHIP_RENOIR: | |
| 1081 | 1081 | adev->mman.keep_stolen_vga_memory = true; | |
| 1082 | 1082 | break; | |
| 1083 | + | case CHIP_POLARIS10: | |
| 1084 | + | case CHIP_POLARIS11: | |
| 1085 | + | case CHIP_POLARIS12: | |
| 1086 | + | /* MacBookPros with switchable graphics put VRAM at 0 when | |
| 1087 | + | * the iGPU is enabled which results in cursor issues if | |
| 1088 | + | * the cursor ends up at 0. Reserve vram at 0 in that case. | |
| 1089 | + | */ | |
| 1090 | + | if (adev->gmc.vram_start == 0) | |
| 1091 | + | adev->mman.keep_stolen_vga_memory = true; | |
| 1092 | + | break; | |
| 1083 | 1093 | default: | |
| 1084 | 1094 | adev->mman.keep_stolen_vga_memory = false; | |
| 1085 | 1095 | break; | |
| 1086 | 1096 | } | |
| 1087 | - | /* MacBookPros with switchable graphics put VRAM at 0 when | |
| 1088 | - | * the iGPU is enabled which results in cursor issues if | |
| 1089 | - | * the cursor ends up at 0. Reserve vram at 0 in that case. | |
| 1090 | - | */ | |
| 1091 | - | if ((adev->pdev->subsystem_vendor == PCI_VENDOR_ID_APPLE) && | |
| 1092 | - | (adev->gmc.vram_start == 0)) | |
| 1093 | - | adev->mman.keep_stolen_vga_memory = true; | |
| 1094 | 1097 | ||
| 1095 | 1098 | if (amdgpu_sriov_vf(adev) || | |
| 1096 | 1099 | !amdgpu_device_has_display_hardware(adev)) { | |
modified drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
| @@ -30,7 +30,6 @@ | |||
| 30 | 30 | #include <drm/amdgpu_drm.h> | |
| 31 | 31 | #include <drm/drm_drv.h> | |
| 32 | 32 | #include <drm/drm_fb_helper.h> | |
| 33 | - | #include <drm/drm_vblank.h> | |
| 34 | 33 | #include "amdgpu_uvd.h" | |
| 35 | 34 | #include "amdgpu_vce.h" | |
| 36 | 35 | #include "atom.h" | |
| @@ -1661,9 +1660,6 @@ u32 amdgpu_get_vblank_counter_kms(struct drm_crtc *crtc) | |||
| 1661 | 1660 | DRM_ERROR("Invalid crtc %u\n", pipe); | |
| 1662 | 1661 | return -EINVAL; | |
| 1663 | 1662 | } | |
| 1664 | - | if (!down_read_trylock(&adev->reset_domain->sem)) | |
| 1665 | - | return drm_crtc_vblank_count(crtc); | |
| 1666 | - | ||
| 1667 | 1663 | ||
| 1668 | 1664 | /* The hw increments its frame counter at start of vsync, not at start | |
| 1669 | 1665 | * of vblank, as is required by DRM core vblank counter handling. | |
| @@ -1709,7 +1705,6 @@ u32 amdgpu_get_vblank_counter_kms(struct drm_crtc *crtc) | |||
| 1709 | 1705 | DRM_DEBUG_VBL("NULL mode info! Returned count may be wrong.\n"); | |
| 1710 | 1706 | } | |
| 1711 | 1707 | ||
| 1712 | - | up_read(&adev->reset_domain->sem); | |
| 1713 | 1708 | return count; | |
| 1714 | 1709 | } | |
| 1715 | 1710 | ||
modified drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
| @@ -2342,7 +2342,7 @@ void amdgpu_ttm_fini(struct amdgpu_device *adev) | |||
| 2342 | 2342 | void amdgpu_ttm_enable_buffer_funcs(struct amdgpu_device *adev) | |
| 2343 | 2343 | { | |
| 2344 | 2344 | struct ttm_resource_manager *man = ttm_manager_type(&adev->mman.bdev, TTM_PL_VRAM); | |
| 2345 | - | u32 num_clear_entities, num_move_entities, sdma_ip_version; | |
| 2345 | + | u32 num_clear_entities, num_move_entities; | |
| 2346 | 2346 | int r, i, j; | |
| 2347 | 2347 | ||
| 2348 | 2348 | if (!adev->mman.initialized || amdgpu_in_reset(adev) || | |
| @@ -2367,12 +2367,6 @@ void amdgpu_ttm_enable_buffer_funcs(struct amdgpu_device *adev) | |||
| 2367 | 2367 | ||
| 2368 | 2368 | num_clear_entities = MIN(adev->mman.num_buffer_funcs_scheds, TTM_NUM_MOVE_FENCES); | |
| 2369 | 2369 | num_move_entities = MIN(adev->mman.num_buffer_funcs_scheds, TTM_NUM_MOVE_FENCES); | |
| 2370 | - | /* TODO: workaround for DCC corruption when moving BOs from multiple queues at | |
| 2371 | - | * the same time: use a single queue until the root cause is identified and fixed. | |
| 2372 | - | */ | |
| 2373 | - | sdma_ip_version = amdgpu_ip_version(adev, SDMA0_HWIP, 0); | |
| 2374 | - | if (sdma_ip_version == IP_VERSION(7, 0, 0) || sdma_ip_version == IP_VERSION(7, 0, 1)) | |
| 2375 | - | num_move_entities = 1; | |
| 2376 | 2370 | ||
| 2377 | 2371 | adev->mman.clear_entities = kzalloc_objs(struct amdgpu_ttm_buffer_entity, | |
| 2378 | 2372 | num_clear_entities); | |
modified drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
| @@ -472,7 +472,6 @@ amdgpu_userq_get_doorbell_index(struct amdgpu_userq_mgr *uq_mgr, | |||
| 472 | 472 | u64 doorbell_index; | |
| 473 | 473 | struct drm_gem_object *gobj; | |
| 474 | 474 | struct amdgpu_userq_obj *db_obj = db_info->db_obj; | |
| 475 | - | struct amdgpu_bo *abo; | |
| 476 | 475 | int r, db_size; | |
| 477 | 476 | ||
| 478 | 477 | gobj = drm_gem_object_lookup(filp, db_info->doorbell_handle); | |
| @@ -481,17 +480,7 @@ amdgpu_userq_get_doorbell_index(struct amdgpu_userq_mgr *uq_mgr, | |||
| 481 | 480 | return -EINVAL; | |
| 482 | 481 | } | |
| 483 | 482 | ||
| 484 | - | /* | |
| 485 | - | * Pinning a regular BO into the doorbell domain would discard its | |
| 486 | - | * contents, possibly those of a buffer shared by another client. | |
| 487 | - | */ | |
| 488 | - | abo = gem_to_amdgpu_bo(gobj); | |
| 489 | - | if (!(abo->preferred_domains & AMDGPU_GEM_DOMAIN_DOORBELL)) { | |
| 490 | - | drm_gem_object_put(gobj); | |
| 491 | - | return -EINVAL; | |
| 492 | - | } | |
| 493 | - | ||
| 494 | - | db_obj->obj = amdgpu_bo_ref(abo); | |
| 483 | + | db_obj->obj = amdgpu_bo_ref(gem_to_amdgpu_bo(gobj)); | |
| 495 | 484 | drm_gem_object_put(gobj); | |
| 496 | 485 | ||
| 497 | 486 | r = amdgpu_bo_reserve(db_obj->obj, true); | |
modified drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
| @@ -3808,7 +3808,6 @@ static int gfx_v11_0_cp_gfx_resume(struct amdgpu_device *adev) | |||
| 3808 | 3808 | rb_bufsz = order_base_2(ring->ring_size / 8); | |
| 3809 | 3809 | tmp = REG_SET_FIELD(0, CP_RB0_CNTL, RB_BUFSZ, rb_bufsz); | |
| 3810 | 3810 | tmp = REG_SET_FIELD(tmp, CP_RB0_CNTL, RB_BLKSZ, rb_bufsz - 2); | |
| 3811 | - | tmp = REG_SET_FIELD(tmp, CP_RB0_CNTL, KMD_QUEUE, 1); | |
| 3812 | 3811 | WREG32_SOC15(GC, 0, regCP_RB0_CNTL, tmp); | |
| 3813 | 3812 | ||
| 3814 | 3813 | /* Initialize the ring buffer's write pointers */ | |
| @@ -4217,7 +4216,6 @@ static int gfx_v11_0_gfx_mqd_init(struct amdgpu_device *adev, void *m, | |||
| 4217 | 4216 | tmp = regCP_GFX_HQD_CNTL_DEFAULT; | |
| 4218 | 4217 | tmp = REG_SET_FIELD(tmp, CP_GFX_HQD_CNTL, RB_BUFSZ, rb_bufsz); | |
| 4219 | 4218 | tmp = REG_SET_FIELD(tmp, CP_GFX_HQD_CNTL, RB_BLKSZ, rb_bufsz - 2); | |
| 4220 | - | tmp = REG_SET_FIELD(tmp, CP_GFX_HQD_CNTL, KMD_QUEUE, prop->kernel_queue); | |
| 4221 | 4219 | #ifdef __BIG_ENDIAN | |
| 4222 | 4220 | tmp = REG_SET_FIELD(tmp, CP_GFX_HQD_CNTL, BUF_SWAP, 1); | |
| 4223 | 4221 | #endif | |
modified drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c
| @@ -2767,7 +2767,6 @@ static int gfx_v12_0_cp_gfx_resume(struct amdgpu_device *adev) | |||
| 2767 | 2767 | rb_bufsz = order_base_2(ring->ring_size / 8); | |
| 2768 | 2768 | tmp = REG_SET_FIELD(0, CP_RB0_CNTL, RB_BUFSZ, rb_bufsz); | |
| 2769 | 2769 | tmp = REG_SET_FIELD(tmp, CP_RB0_CNTL, RB_BLKSZ, rb_bufsz - 2); | |
| 2770 | - | tmp = REG_SET_FIELD(tmp, CP_RB0_CNTL, KMD_QUEUE, 1); | |
| 2771 | 2770 | WREG32_SOC15(GC, 0, regCP_RB0_CNTL, tmp); | |
| 2772 | 2771 | ||
| 2773 | 2772 | /* Initialize the ring buffer's write pointers */ | |
| @@ -3060,7 +3059,6 @@ static int gfx_v12_0_gfx_mqd_init(struct amdgpu_device *adev, void *m, | |||
| 3060 | 3059 | tmp = regCP_GFX_HQD_CNTL_DEFAULT; | |
| 3061 | 3060 | tmp = REG_SET_FIELD(tmp, CP_GFX_HQD_CNTL, RB_BUFSZ, rb_bufsz); | |
| 3062 | 3061 | tmp = REG_SET_FIELD(tmp, CP_GFX_HQD_CNTL, RB_BLKSZ, rb_bufsz - 2); | |
| 3063 | - | tmp = REG_SET_FIELD(tmp, CP_GFX_HQD_CNTL, KMD_QUEUE, prop->kernel_queue); | |
| 3064 | 3062 | #ifdef __BIG_ENDIAN | |
| 3065 | 3063 | tmp = REG_SET_FIELD(tmp, CP_GFX_HQD_CNTL, BUF_SWAP, 1); | |
| 3066 | 3064 | #endif | |
modified drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c
| @@ -322,14 +322,6 @@ static const u32 verde_rlc_save_restore_register_list[] = | |||
| 322 | 322 | 0x00000000 | |
| 323 | 323 | }; | |
| 324 | 324 | ||
| 325 | - | static void gfx_v6_0_free_microcode(struct amdgpu_device *adev) | |
| 326 | - | { | |
| 327 | - | amdgpu_ucode_release(&adev->gfx.pfp_fw); | |
| 328 | - | amdgpu_ucode_release(&adev->gfx.me_fw); | |
| 329 | - | amdgpu_ucode_release(&adev->gfx.ce_fw); | |
| 330 | - | amdgpu_ucode_release(&adev->gfx.rlc_fw); | |
| 331 | - | } | |
| 332 | - | ||
| 333 | 325 | static int gfx_v6_0_init_microcode(struct amdgpu_device *adev) | |
| 334 | 326 | { | |
| 335 | 327 | const char *chip_name; | |
| @@ -3257,7 +3249,6 @@ static int gfx_v6_0_sw_fini(struct amdgpu_ip_block *ip_block) | |||
| 3257 | 3249 | amdgpu_ring_fini(&adev->gfx.compute_ring[i]); | |
| 3258 | 3250 | ||
| 3259 | 3251 | amdgpu_gfx_rlc_fini(adev); | |
| 3260 | - | gfx_v6_0_free_microcode(adev); | |
| 3261 | 3252 | ||
| 3262 | 3253 | return 0; | |
| 3263 | 3254 | } | |
modified drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c
| @@ -327,7 +327,7 @@ static void gmc_v12_0_flush_gpu_tlb(struct amdgpu_device *adev, uint32_t vmid, | |||
| 327 | 327 | return; | |
| 328 | 328 | } | |
| 329 | 329 | ||
| 330 | - | gmc_v12_0_flush_vm_hub(adev, vmid, vmhub, flush_type); | |
| 330 | + | gmc_v12_0_flush_vm_hub(adev, vmid, vmhub, 0); | |
| 331 | 331 | return; | |
| 332 | 332 | } | |
| 333 | 333 | ||
modified drivers/gpu/drm/amd/amdgpu/gmc_v12_1.c
| @@ -389,7 +389,7 @@ static void gmc_v12_1_flush_gpu_tlb(struct amdgpu_device *adev, uint32_t vmid, | |||
| 389 | 389 | return; | |
| 390 | 390 | } | |
| 391 | 391 | ||
| 392 | - | gmc_v12_1_flush_vm_hub(adev, vmid, vmhub, flush_type); | |
| 392 | + | gmc_v12_1_flush_vm_hub(adev, vmid, vmhub, 0); | |
| 393 | 393 | return; | |
| 394 | 394 | } | |
| 395 | 395 | ||
modified drivers/gpu/drm/amd/amdgpu/mes_userqueue.c
| @@ -361,7 +361,8 @@ static int mes_userq_mqd_create(struct amdgpu_usermode_queue *queue, | |||
| 361 | 361 | ||
| 362 | 362 | compute_mqd = memdup_user(u64_to_user_ptr(mqd_user->mqd), mqd_user->mqd_size); | |
| 363 | 363 | if (IS_ERR(compute_mqd)) { | |
| 364 | - | r = PTR_ERR(compute_mqd); | |
| 364 | + | DRM_ERROR("Failed to read user MQD\n"); | |
| 365 | + | r = -ENOMEM; | |
| 365 | 366 | goto free_mqd; | |
| 366 | 367 | } | |
| 367 | 368 | ||
| @@ -405,7 +406,8 @@ static int mes_userq_mqd_create(struct amdgpu_usermode_queue *queue, | |||
| 405 | 406 | ||
| 406 | 407 | mqd_gfx_v11 = memdup_user(u64_to_user_ptr(mqd_user->mqd), mqd_user->mqd_size); | |
| 407 | 408 | if (IS_ERR(mqd_gfx_v11)) { | |
| 408 | - | r = PTR_ERR(mqd_gfx_v11); | |
| 409 | + | DRM_ERROR("Failed to read user MQD\n"); | |
| 410 | + | r = -ENOMEM; | |
| 409 | 411 | goto free_mqd; | |
| 410 | 412 | } | |
| 411 | 413 | ||
| @@ -449,7 +451,8 @@ static int mes_userq_mqd_create(struct amdgpu_usermode_queue *queue, | |||
| 449 | 451 | ||
| 450 | 452 | mqd_sdma_v11 = memdup_user(u64_to_user_ptr(mqd_user->mqd), mqd_user->mqd_size); | |
| 451 | 453 | if (IS_ERR(mqd_sdma_v11)) { | |
| 452 | - | r = PTR_ERR(mqd_sdma_v11); | |
| 454 | + | DRM_ERROR("Failed to read sdma user MQD\n"); | |
| 455 | + | r = -ENOMEM; | |
| 453 | 456 | goto free_mqd; | |
| 454 | 457 | } | |
| 455 | 458 | ||
modified drivers/gpu/drm/amd/amdgpu/sdma_v7_1.c
| @@ -1339,6 +1339,10 @@ static int sdma_v7_1_sw_init(struct amdgpu_ip_block *ip_block) | |||
| 1339 | 1339 | else | |
| 1340 | 1340 | DRM_ERROR("Failed to allocated memory for SDMA IP Dump\n"); | |
| 1341 | 1341 | ||
| 1342 | + | #ifdef CONFIG_DRM_AMDGPU_NAVI3X_USERQ | |
| 1343 | + | adev->userq_funcs[AMDGPU_HW_IP_DMA] = &userq_mes_funcs; | |
| 1344 | + | #endif | |
| 1345 | + | ||
| 1342 | 1346 | return r; | |
| 1343 | 1347 | } | |
| 1344 | 1348 | ||
modified drivers/gpu/drm/amd/amdgpu/vi.c
| @@ -1397,7 +1397,6 @@ struct vi_reset_quirk { | |||
| 1397 | 1397 | static const struct vi_reset_quirk vi_reset_quirks[] = { | |
| 1398 | 1398 | { 0x67ef, PCI_VENDOR_ID_APPLE, 0x0190, 0xe3 }, /* Radeon Pro 555X */ | |
| 1399 | 1399 | { 0x67ef, PCI_VENDOR_ID_APPLE, 0x018f, 0xc2 }, /* Radeon Pro 560X */ | |
| 1400 | - | { 0x67ef, PCI_VENDOR_ID_APPLE, 0x017a, 0xc7 }, /* Radeon Pro 555 */ | |
| 1401 | 1400 | }; | |
| 1402 | 1401 | ||
| 1403 | 1402 | static bool vi_need_reset_on_init(struct amdgpu_device *adev) | |
modified drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
| @@ -572,32 +572,12 @@ static int allocate_doorbell(struct qcm_process_device *qpd, | |||
| 572 | 572 | * we need the physical sdma engine id in order to get the | |
| 573 | 573 | * correct doorbell offset. | |
| 574 | 574 | */ | |
| 575 | - | u32 engine_base = idx_offset[dev->node_id * | |
| 576 | - | get_num_all_sdma_engines(qpd->dqm) + | |
| 577 | - | q->properties.sdma_engine_id]; | |
| 578 | - | u32 valid_id; | |
| 579 | - | ||
| 580 | - | /* | |
| 581 | - | * With the aqua_vanjaram doorbell layout, a shader doorbell | |
| 582 | - | * write whose 32-byte block starts in the previous engine's | |
| 583 | - | * range rings that engine instead. Engine ranges are 10 | |
| 584 | - | * indices apart (sdma_doorbell_range = 20 dwords, halved for | |
| 585 | - | * 8-byte doorbells, in aqua_vanjaram_doorbell_index_init()), | |
| 586 | - | * which puts odd engines 2 indices into a shared block. | |
| 587 | - | * Aligning costs at most 2 indices, and 8 queues per engine use | |
| 588 | - | * only 4 of the 10, so the aligned base stays in range. The | |
| 589 | - | * 512-index mirror offset keeps the alignment. | |
| 590 | - | */ | |
| 591 | - | if (KFD_GC_VERSION(dev) == IP_VERSION(9, 4, 3) || | |
| 592 | - | KFD_GC_VERSION(dev) == IP_VERSION(9, 4, 4) || | |
| 593 | - | KFD_GC_VERSION(dev) == IP_VERSION(9, 5, 0)) | |
| 594 | - | engine_base = ALIGN(engine_base, | |
| 595 | - | KFD_SDMA_SHADER_DOORBELL_GRANULARITY); | |
| 596 | - | ||
| 597 | - | valid_id = engine_base + | |
| 598 | - | (q->properties.sdma_queue_id & 1) * | |
| 599 | - | KFD_QUEUE_DOORBELL_MIRROR_OFFSET + | |
| 600 | - | (q->properties.sdma_queue_id >> 1); | |
| 575 | + | uint32_t valid_id = idx_offset[qpd->dqm->dev->node_id * | |
| 576 | + | get_num_all_sdma_engines(qpd->dqm) + | |
| 577 | + | q->properties.sdma_engine_id] | |
| 578 | + | + (q->properties.sdma_queue_id & 1) | |
| 579 | + | * KFD_QUEUE_DOORBELL_MIRROR_OFFSET | |
| 580 | + | + (q->properties.sdma_queue_id >> 1); | |
| 601 | 581 | ||
| 602 | 582 | if (restore_id && *restore_id != valid_id) | |
| 603 | 583 | return -EINVAL; | |
modified drivers/gpu/drm/amd/amdkfd/kfd_priv.h
| @@ -133,13 +133,6 @@ | |||
| 133 | 133 | */ | |
| 134 | 134 | #define KFD_QUEUE_DOORBELL_MIRROR_OFFSET 512 | |
| 135 | 135 | ||
| 136 | - | /* | |
| 137 | - | * On GC 9.4.3, 9.4.4 and 9.5.0, doorbell writes issued from shaders are | |
| 138 | - | * routed to an SDMA engine at 32-byte granularity, i.e. 4 indices with the | |
| 139 | - | * 8-byte SDMA doorbells used on SOC15. | |
| 140 | - | */ | |
| 141 | - | #define KFD_SDMA_SHADER_DOORBELL_GRANULARITY 4 | |
| 142 | - | ||
| 143 | 136 | /** | |
| 144 | 137 | * enum kfd_ioctl_flags - KFD ioctl flags | |
| 145 | 138 | * Various flags that can be set in &amdkfd_ioctl_desc.flags to control how | |
modified drivers/gpu/drm/amd/amdkfd/kfd_svm.c
| @@ -1752,15 +1752,12 @@ static int svm_range_validate_and_map(struct mm_struct *mm, | |||
| 1752 | 1752 | } | |
| 1753 | 1753 | ||
| 1754 | 1754 | /* | |
| 1755 | - | * If prange with always mapped flag is not mapped or migrated | |
| 1756 | - | * yet, update mapping on GPUs with ACCESS attribute. Don't add | |
| 1757 | - | * them otherwise, ACCESS GPUs may be on different XGMI hives, | |
| 1758 | - | * that would force hmm_range_fault to migrate VRAM back to ram. | |
| 1755 | + | * If prange with always mapped flag, update mapping on GPUs with | |
| 1756 | + | * ACCESS attribute | |
| 1759 | 1757 | */ | |
| 1760 | - | if (bitmap_empty(ctx->bitmap, MAX_GPU_INSTANCE) && | |
| 1761 | - | prange->flags & KFD_IOCTL_SVM_FLAG_GPU_ALWAYS_MAPPED) | |
| 1762 | - | bitmap_copy(ctx->bitmap, prange->bitmap_access, | |
| 1763 | - | MAX_GPU_INSTANCE); | |
| 1758 | + | if (prange->flags & KFD_IOCTL_SVM_FLAG_GPU_ALWAYS_MAPPED) | |
| 1759 | + | bitmap_or(ctx->bitmap, ctx->bitmap, prange->bitmap_access, | |
| 1760 | + | MAX_GPU_INSTANCE); | |
| 1764 | 1761 | } else { | |
| 1765 | 1762 | bitmap_or(ctx->bitmap, prange->bitmap_access, | |
| 1766 | 1763 | prange->bitmap_aip, MAX_GPU_INSTANCE); | |
modified drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
| @@ -426,8 +426,6 @@ static int amdgpu_dm_init_power_module(struct amdgpu_display_manager *dm) | |||
| 426 | 426 | init_data[i].use_custom_backlight_caps = false; | |
| 427 | 427 | init_data[i].custom_backlight_caps_config_no = 0; | |
| 428 | 428 | init_data[i].use_linear_backlight_curve = false; | |
| 429 | - | if (amdgpu_dc_debug_mask & DC_DISABLE_CUSTOM_BRIGHTNESS_CURVE) | |
| 430 | - | init_data[i].use_linear_backlight_curve = true; | |
| 431 | 429 | init_data[i].def_varibright_enable = 0; | |
| 432 | 430 | init_data[i].varibright_level = 0; | |
| 433 | 431 | /* | |
| @@ -1584,14 +1582,9 @@ static int dm_suspend(struct amdgpu_ip_block *ip_block) | |||
| 1584 | 1582 | dc_allow_idle_optimizations(adev->dm.dc, false); | |
| 1585 | 1583 | ||
| 1586 | 1584 | dm->cached_dc_state = dc_state_create_copy(dm->dc->current_state); | |
| 1587 | - | if (!dm->cached_dc_state) { | |
| 1588 | - | drm_err(adev_to_drm(adev), | |
| 1589 | - | "Failed to allocate cached DC state during suspend\n"); | |
| 1590 | - | mutex_unlock(&dm->dc_lock); | |
| 1591 | - | return -ENOMEM; | |
| 1592 | - | } | |
| 1593 | 1585 | ||
| 1594 | - | dm_gpureset_toggle_interrupts(adev, dm->cached_dc_state, false); | |
| 1586 | + | if (dm->cached_dc_state) | |
| 1587 | + | dm_gpureset_toggle_interrupts(adev, dm->cached_dc_state, false); | |
| 1595 | 1588 | ||
| 1596 | 1589 | res = amdgpu_dm_commit_zero_streams(dm->dc); | |
| 1597 | 1590 | if (res != DC_OK) { | |
| @@ -3708,13 +3701,6 @@ static void amdgpu_dm_enable_self_refresh(struct amdgpu_display_manager *dm, | |||
| 3708 | 3701 | struct amdgpu_dm_connector *aconn = | |
| 3709 | 3702 | (struct amdgpu_dm_connector *)acrtc_state->stream->dm_stream_context; | |
| 3710 | 3703 | ||
| 3711 | - | if (!acrtc_state->base.async_flip) { | |
| 3712 | - | amdgpu_dm_psr_set_event(dm, acrtc_state->stream, false, | |
| 3713 | - | psr_event_immediate_flip, false); | |
| 3714 | - | amdgpu_dm_replay_set_event(dm, acrtc_state->stream, false, | |
| 3715 | - | replay_event_immediate_flip, false); | |
| 3716 | - | } | |
| 3717 | - | ||
| 3718 | 3704 | /* Decrement skip count when SR is enabled and we're doing fast updates. */ | |
| 3719 | 3705 | if (acrtc_state->update_type == UPDATE_TYPE_FAST && | |
| 3720 | 3706 | (psr->psr_feature_enabled || pr->replay_feature_enabled)) { | |
| @@ -4125,18 +4111,6 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_commit *state, | |||
| 4125 | 4111 | spin_unlock_irqrestore(&pcrtc->dev->event_lock, flags); | |
| 4126 | 4112 | } | |
| 4127 | 4113 | mutex_lock(&dm->dc_lock); | |
| 4128 | - | /* | |
| 4129 | - | * Tearing (immediate) flips cannot work with panel self-refresh | |
| 4130 | - | * features. The event is cleared by | |
| 4131 | - | * amdgpu_dm_enable_self_refresh() once async flips stop. | |
| 4132 | - | */ | |
| 4133 | - | if (immediate_flip) { | |
| 4134 | - | dc_exit_ips_for_hw_access(dm->dc); | |
| 4135 | - | amdgpu_dm_psr_set_event(dm, acrtc_state->stream, true, | |
| 4136 | - | psr_event_immediate_flip, true); | |
| 4137 | - | amdgpu_dm_replay_set_event(dm, acrtc_state->stream, true, | |
| 4138 | - | replay_event_immediate_flip, true); | |
| 4139 | - | } | |
| 4140 | 4114 | update_planes_and_stream_adapter(dm->dc, | |
| 4141 | 4115 | acrtc_state->update_type, | |
| 4142 | 4116 | planes_count, | |
modified drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_backlight.c
| @@ -39,7 +39,6 @@ | |||
| 39 | 39 | #include "modules/inc/mod_power.h" | |
| 40 | 40 | ||
| 41 | 41 | #include <linux/backlight.h> | |
| 42 | - | #include <linux/minmax.h> | |
| 43 | 42 | #include <linux/power_supply.h> | |
| 44 | 43 | #include <drm/drm_edid.h> | |
| 45 | 44 | #include <drm/drm_utils.h> | |
| @@ -119,68 +118,6 @@ static inline u32 scale_fw_to_input(int min, int max, u64 input) | |||
| 119 | 118 | return min + DIV_ROUND_CLOSEST_ULL(input * (max - min), AMDGPU_MAX_BL_LEVEL); | |
| 120 | 119 | } | |
| 121 | 120 | ||
| 122 | - | static u32 backlight_signal_to_luminance(const struct amdgpu_dm_backlight_caps *caps, | |
| 123 | - | u32 signal) | |
| 124 | - | { | |
| 125 | - | u32 lower_signal, upper_signal; | |
| 126 | - | u32 lower_lum, upper_lum; | |
| 127 | - | int i; | |
| 128 | - | ||
| 129 | - | if (!caps->data_points) | |
| 130 | - | return DIV_ROUND_CLOSEST(signal * 100, AMDGPU_MAX_BL_LEVEL); | |
| 131 | - | ||
| 132 | - | if (signal < caps->luminance_data[0].input_signal) { | |
| 133 | - | lower_signal = 0; | |
| 134 | - | lower_lum = 0; | |
| 135 | - | upper_signal = caps->luminance_data[0].input_signal; | |
| 136 | - | upper_lum = caps->luminance_data[0].luminance; | |
| 137 | - | } else if (signal >= | |
| 138 | - | caps->luminance_data[caps->data_points - 1].input_signal) { | |
| 139 | - | lower_signal = caps->luminance_data[caps->data_points - 1].input_signal; | |
| 140 | - | lower_lum = caps->luminance_data[caps->data_points - 1].luminance; | |
| 141 | - | upper_signal = caps->max_input_signal; | |
| 142 | - | upper_lum = 100; | |
| 143 | - | } else { | |
| 144 | - | for (i = 1; | |
| 145 | - | i < caps->data_points && | |
| 146 | - | signal > caps->luminance_data[i].input_signal; | |
| 147 | - | i++) | |
| 148 | - | ; | |
| 149 | - | ||
| 150 | - | lower_signal = caps->luminance_data[i - 1].input_signal; | |
| 151 | - | upper_signal = caps->luminance_data[i].input_signal; | |
| 152 | - | lower_lum = caps->luminance_data[i - 1].luminance; | |
| 153 | - | upper_lum = caps->luminance_data[i].luminance; | |
| 154 | - | } | |
| 155 | - | ||
| 156 | - | if (upper_signal == lower_signal) | |
| 157 | - | return upper_lum; | |
| 158 | - | ||
| 159 | - | return lower_lum + DIV_ROUND_CLOSEST((upper_lum - lower_lum) * | |
| 160 | - | (signal - lower_signal), | |
| 161 | - | upper_signal - lower_signal); | |
| 162 | - | } | |
| 163 | - | ||
| 164 | - | static u32 convert_brightness_to_millipercent(const struct amdgpu_dm_backlight_caps *caps, | |
| 165 | - | u32 user_brightness) | |
| 166 | - | { | |
| 167 | - | unsigned int min, max; | |
| 168 | - | u32 signal, luminance; | |
| 169 | - | ||
| 170 | - | if (!get_brightness_range(caps, &min, &max)) | |
| 171 | - | return DIV_ROUND_CLOSEST_ULL((u64)user_brightness * 100000, | |
| 172 | - | MAX_BACKLIGHT_LEVEL); | |
| 173 | - | ||
| 174 | - | user_brightness = clamp(user_brightness, min, max); | |
| 175 | - | if (amdgpu_dc_debug_mask & DC_DISABLE_CUSTOM_BRIGHTNESS_CURVE) | |
| 176 | - | return DIV_ROUND_CLOSEST_ULL((u64)user_brightness * 100000, max); | |
| 177 | - | ||
| 178 | - | signal = scale_input_to_fw(max, user_brightness); | |
| 179 | - | luminance = backlight_signal_to_luminance(caps, signal); | |
| 180 | - | ||
| 181 | - | return min_t(u32, luminance * 1000, 100000); | |
| 182 | - | } | |
| 183 | - | ||
| 184 | 121 | STATIC_IFN_KUNIT | |
| 185 | 122 | void convert_custom_brightness(const struct amdgpu_dm_backlight_caps *caps, | |
| 186 | 123 | unsigned int min, unsigned int max, | |
| @@ -323,10 +260,10 @@ void amdgpu_dm_backlight_set_level(struct amdgpu_display_manager *dm, | |||
| 323 | 260 | struct amdgpu_dm_backlight_caps *caps; | |
| 324 | 261 | struct dc_link *link; | |
| 325 | 262 | u32 brightness = 0; | |
| 326 | - | u32 millipercent = 0; | |
| 327 | 263 | bool rc = false, reallow_idle = false; | |
| 328 | 264 | struct drm_connector *connector; | |
| 329 | 265 | struct dc_stream_state *stream; | |
| 266 | + | unsigned int min, max; | |
| 330 | 267 | ||
| 331 | 268 | list_for_each_entry(connector, &dm->ddev->mode_config.connector_list, head) { | |
| 332 | 269 | struct amdgpu_dm_connector *aconnector = to_amdgpu_dm_connector(connector); | |
| @@ -349,21 +286,12 @@ void amdgpu_dm_backlight_set_level(struct amdgpu_display_manager *dm, | |||
| 349 | 286 | /* update scratch register */ | |
| 350 | 287 | if (bl_idx == 0) | |
| 351 | 288 | amdgpu_atombios_scratch_regs_set_backlight_level(dm->adev, dm->brightness[bl_idx]); | |
| 352 | - | ||
| 289 | + | brightness = convert_brightness_from_user(caps, dm->brightness[bl_idx]); | |
| 353 | 290 | link = (struct dc_link *)dm->backlight_link[bl_idx]; | |
| 354 | - | stream = dm_find_stream_with_link(dm, link); | |
| 355 | - | if (!stream) | |
| 356 | - | return; | |
| 357 | 291 | ||
| 358 | - | if (caps->aux_support) { | |
| 359 | - | brightness = convert_brightness_from_user(caps, dm->brightness[bl_idx]); | |
| 360 | - | /* Apply brightness quirk */ | |
| 361 | - | if (caps->brightness_mask) | |
| 362 | - | brightness |= caps->brightness_mask; | |
| 363 | - | } else { | |
| 364 | - | millipercent = convert_brightness_to_millipercent(caps, | |
| 365 | - | user_brightness); | |
| 366 | - | } | |
| 292 | + | /* Apply brightness quirk */ | |
| 293 | + | if (caps->brightness_mask) | |
| 294 | + | brightness |= caps->brightness_mask; | |
| 367 | 295 | ||
| 368 | 296 | if (trace_amdgpu_dm_brightness_enabled()) { | |
| 369 | 297 | trace_amdgpu_dm_brightness(__builtin_return_address(0), | |
| @@ -373,6 +301,10 @@ void amdgpu_dm_backlight_set_level(struct amdgpu_display_manager *dm, | |||
| 373 | 301 | power_supply_is_system_supplied() > 0); | |
| 374 | 302 | } | |
| 375 | 303 | ||
| 304 | + | stream = dm_find_stream_with_link(dm, link); | |
| 305 | + | if (!stream) | |
| 306 | + | return; | |
| 307 | + | ||
| 376 | 308 | mutex_lock(&dm->dc_lock); | |
| 377 | 309 | if (dm->dc->caps.ips_support && dm->dc->ctx->dmub_srv->idle_allowed) { | |
| 378 | 310 | dc_allow_idle_optimizations(dm->dc, false); | |
| @@ -384,8 +316,10 @@ void amdgpu_dm_backlight_set_level(struct amdgpu_display_manager *dm, | |||
| 384 | 316 | AUX_BL_DEFAULT_TRANSITION_TIME_MS, false, true); | |
| 385 | 317 | } else { | |
| 386 | 318 | /* power module uses millipercent */ | |
| 319 | + | get_brightness_range(caps, &min, &max); | |
| 320 | + | brightness = DIV_ROUND_CLOSEST(brightness * 100, (max - min)) * 1000; | |
| 387 | 321 | rc = mod_power_set_backlight_percent(dm->power_module, stream, | |
| 388 | - | millipercent, 0, false); | |
| 322 | + | brightness, 0, false); | |
| 389 | 323 | } | |
| 390 | 324 | ||
| 391 | 325 | /* | |
modified drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c
| @@ -732,24 +732,6 @@ get_aspect_ratio(const struct drm_display_mode *mode_in) | |||
| 732 | 732 | } | |
| 733 | 733 | EXPORT_IF_KUNIT(get_aspect_ratio); | |
| 734 | 734 | ||
| 735 | - | /* | |
| 736 | - | * CTA-861 5.1: RGB video formats default to limited range except 640x480 (VIC 1). | |
| 737 | - | * With Broadcast RGB left at Automatic follow that default, as i915 does. | |
| 738 | - | */ | |
| 739 | - | static bool rgb_output_is_limited_range(const struct dc_crtc_timing *dc_crtc_timing, | |
| 740 | - | const struct drm_connector_state *connector_state) | |
| 741 | - | { | |
| 742 | - | switch (connector_state->hdmi.broadcast_rgb) { | |
| 743 | - | case DRM_HDMI_BROADCAST_RGB_FULL: | |
| 744 | - | return false; | |
| 745 | - | case DRM_HDMI_BROADCAST_RGB_LIMITED: | |
| 746 | - | return true; | |
| 747 | - | default: | |
| 748 | - | return connector_state->connector->display_info.is_hdmi && | |
| 749 | - | dc_crtc_timing->vic > 1; | |
| 750 | - | } | |
| 751 | - | } | |
| 752 | - | ||
| 753 | 735 | enum dc_color_space | |
| 754 | 736 | amdgpu_dm_get_output_color_space(const struct dc_crtc_timing *dc_crtc_timing, | |
| 755 | 737 | const struct drm_connector_state *connector_state) | |
| @@ -775,7 +757,7 @@ amdgpu_dm_get_output_color_space(const struct dc_crtc_timing *dc_crtc_timing, | |||
| 775 | 757 | case DRM_MODE_COLORIMETRY_BT2020_RGB: | |
| 776 | 758 | case DRM_MODE_COLORIMETRY_BT2020_YCC: | |
| 777 | 759 | if (dc_crtc_timing->pixel_encoding == PIXEL_ENCODING_RGB) { | |
| 778 | - | if (rgb_output_is_limited_range(dc_crtc_timing, connector_state)) | |
| 760 | + | if (connector_state->hdmi.broadcast_rgb == DRM_HDMI_BROADCAST_RGB_LIMITED) | |
| 779 | 761 | color_space = COLOR_SPACE_2020_RGB_LIMITEDRANGE; | |
| 780 | 762 | else | |
| 781 | 763 | color_space = COLOR_SPACE_2020_RGB_FULLRANGE; | |
| @@ -787,7 +769,7 @@ amdgpu_dm_get_output_color_space(const struct dc_crtc_timing *dc_crtc_timing, | |||
| 787 | 769 | default: | |
| 788 | 770 | if (dc_crtc_timing->pixel_encoding == PIXEL_ENCODING_RGB) { | |
| 789 | 771 | color_space = COLOR_SPACE_SRGB; | |
| 790 | - | if (rgb_output_is_limited_range(dc_crtc_timing, connector_state)) | |
| 772 | + | if (connector_state->hdmi.broadcast_rgb == DRM_HDMI_BROADCAST_RGB_LIMITED) | |
| 791 | 773 | color_space = COLOR_SPACE_SRGB_LIMITED; | |
| 792 | 774 | /* | |
| 793 | 775 | * 27030khz is the separation point between HDTV and SDTV | |
| @@ -1012,15 +994,10 @@ decide_crtc_timing_for_drm_display_mode(struct drm_display_mode *drm_mode, | |||
| 1012 | 994 | const struct drm_display_mode *native_mode, | |
| 1013 | 995 | bool scale_enabled) | |
| 1014 | 996 | { | |
| 1015 | - | /* Inserted modes copy the native sync; a sink mode with equal totals may not */ | |
| 1016 | 997 | if (scale_enabled || ( | |
| 1017 | 998 | native_mode->clock == drm_mode->clock && | |
| 1018 | 999 | native_mode->htotal == drm_mode->htotal && | |
| 1019 | - | native_mode->vtotal == drm_mode->vtotal && | |
| 1020 | - | native_mode->hsync_start == drm_mode->hsync_start && | |
| 1021 | - | native_mode->hsync_end == drm_mode->hsync_end && | |
| 1022 | - | native_mode->vsync_start == drm_mode->vsync_start && | |
| 1023 | - | native_mode->vsync_end == drm_mode->vsync_end)) { | |
| 1000 | + | native_mode->vtotal == drm_mode->vtotal)) { | |
| 1024 | 1001 | if (native_mode->crtc_clock) | |
| 1025 | 1002 | copy_crtc_timing_for_drm_display_mode(native_mode, drm_mode); | |
| 1026 | 1003 | } else { | |
| @@ -2279,8 +2256,8 @@ amdgpu_dm_create_validate_stream_for_sink(struct drm_connector *connector, | |||
| 2279 | 2256 | * below gate which of these entries are actually attempted. | |
| 2280 | 2257 | */ | |
| 2281 | 2258 | static const enum dc_pixel_encoding encoding_order[] = { | |
| 2282 | - | PIXEL_ENCODING_RGB, | |
| 2283 | 2259 | PIXEL_ENCODING_YCBCR444, | |
| 2260 | + | PIXEL_ENCODING_RGB, | |
| 2284 | 2261 | PIXEL_ENCODING_YCBCR422, | |
| 2285 | 2262 | PIXEL_ENCODING_YCBCR420, | |
| 2286 | 2263 | }; | |
modified drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c
| @@ -1231,8 +1231,7 @@ static bool get_conv_frl_bw(struct amdgpu_dm_connector *aconnector, | |||
| 1231 | 1231 | unsigned int max_sink_bw_in_kbps = 0; | |
| 1232 | 1232 | unsigned int dsc_max_sink_bw_in_kbps = 0; | |
| 1233 | 1233 | ||
| 1234 | - | if (aconnector->dc_sink && | |
| 1235 | - | aconnector->dc_link->dc->caps.dp_hdmi21_pcon_support && | |
| 1234 | + | if (aconnector->dc_link->dc->caps.dp_hdmi21_pcon_support && | |
| 1236 | 1235 | aconnector->mst_downstream_port_caps.bytes.byte0.bits.DWN_STRM_PORTX_TYPE == DOWN_STREAM_DETAILED_HDMI) { | |
| 1237 | 1236 | max_conv_bw_in_kbps = dc_link_bw_kbps_from_raw_frl_link_rate_data( | |
| 1238 | 1237 | aconnector->dc_link->dc, | |
| @@ -1997,9 +1996,6 @@ enum dc_status dm_dp_mst_is_port_support_mode( | |||
| 1997 | 1996 | struct dc_dsc_config_options dsc_options = {0}; | |
| 1998 | 1997 | uint32_t stream_kbps; | |
| 1999 | 1998 | ||
| 2000 | - | if (!aconnector->dc_sink) | |
| 2001 | - | return DC_FAIL_BANDWIDTH_VALIDATE; | |
| 2002 | - | ||
| 2003 | 1999 | /* DSC unnecessary case | |
| 2004 | 2000 | * Check if timing could be supported within end-to-end BW | |
| 2005 | 2001 | */ | |
modified drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c
| @@ -112,7 +112,25 @@ void amdgpu_dm_plane_fill_blending_from_plane_state(const struct drm_plane_state | |||
| 112 | 112 | ||
| 113 | 113 | if (plane_state->pixel_blend_mode == DRM_MODE_BLEND_PREMULTI || | |
| 114 | 114 | plane_state->pixel_blend_mode == DRM_MODE_BLEND_COVERAGE) { | |
| 115 | - | *per_pixel_alpha = plane_state->fb->format->has_alpha; | |
| 115 | + | static const uint32_t alpha_formats[] = { | |
| 116 | + | DRM_FORMAT_ARGB8888, | |
| 117 | + | DRM_FORMAT_RGBA8888, | |
| 118 | + | DRM_FORMAT_ABGR8888, | |
| 119 | + | DRM_FORMAT_ARGB2101010, | |
| 120 | + | DRM_FORMAT_ABGR2101010, | |
| 121 | + | DRM_FORMAT_ARGB16161616, | |
| 122 | + | DRM_FORMAT_ABGR16161616, | |
| 123 | + | DRM_FORMAT_ARGB16161616F, | |
| 124 | + | }; | |
| 125 | + | uint32_t format = plane_state->fb->format->format; | |
| 126 | + | unsigned int i; | |
| 127 | + | ||
| 128 | + | for (i = 0; i < ARRAY_SIZE(alpha_formats); ++i) { | |
| 129 | + | if (format == alpha_formats[i]) { | |
| 130 | + | *per_pixel_alpha = true; | |
| 131 | + | break; | |
| 132 | + | } | |
| 133 | + | } | |
| 116 | 134 | ||
| 117 | 135 | if (*per_pixel_alpha && plane_state->pixel_blend_mode == DRM_MODE_BLEND_COVERAGE) | |
| 118 | 136 | *pre_multiplied_alpha = false; | |
modified drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_connector_test.c
| @@ -409,9 +409,7 @@ static void dm_test_output_color_space_default_rgb_full(struct kunit *test) | |||
| 409 | 409 | { | |
| 410 | 410 | struct dc_crtc_timing timing = {}; | |
| 411 | 411 | struct drm_connector_state state = {}; | |
| 412 | - | struct drm_connector *connector = kunit_kzalloc(test, sizeof(*connector), GFP_KERNEL); | |
| 413 | 412 | ||
| 414 | - | state.connector = connector; | |
| 415 | 413 | timing.pixel_encoding = PIXEL_ENCODING_RGB; | |
| 416 | 414 | state.colorspace = DRM_MODE_COLORIMETRY_DEFAULT; | |
| 417 | 415 | state.hdmi.broadcast_rgb = DRM_HDMI_BROADCAST_RGB_AUTO; | |
| @@ -561,9 +559,7 @@ static void dm_test_output_color_space_bt2020_rgb(struct kunit *test) | |||
| 561 | 559 | { | |
| 562 | 560 | struct dc_crtc_timing timing = {}; | |
| 563 | 561 | struct drm_connector_state state = {}; | |
| 564 | - | struct drm_connector *connector = kunit_kzalloc(test, sizeof(*connector), GFP_KERNEL); | |
| 565 | 562 | ||
| 566 | - | state.connector = connector; | |
| 567 | 563 | timing.pixel_encoding = PIXEL_ENCODING_RGB; | |
| 568 | 564 | state.colorspace = DRM_MODE_COLORIMETRY_BT2020_RGB; | |
| 569 | 565 | ||
| @@ -588,110 +584,6 @@ static void dm_test_output_color_space_bt2020_rgb_limited(struct kunit *test) | |||
| 588 | 584 | (int)COLOR_SPACE_2020_RGB_LIMITEDRANGE); | |
| 589 | 585 | } | |
| 590 | 586 | ||
| 591 | - | /** | |
| 592 | - | * dm_test_output_color_space_default_rgb_auto_hdmi_cta - Automatic follows the CTA-861 default | |
| 593 | - | * @test: The KUnit test context | |
| 594 | - | */ | |
| 595 | - | static void dm_test_output_color_space_default_rgb_auto_hdmi_cta(struct kunit *test) | |
| 596 | - | { | |
| 597 | - | struct dc_crtc_timing timing = {}; | |
| 598 | - | struct drm_connector_state state = {}; | |
| 599 | - | struct drm_connector *connector = kunit_kzalloc(test, sizeof(*connector), GFP_KERNEL); | |
| 600 | - | ||
| 601 | - | connector->display_info.is_hdmi = true; | |
| 602 | - | timing.pixel_encoding = PIXEL_ENCODING_RGB; | |
| 603 | - | timing.vic = 32; | |
| 604 | - | state.connector = connector; | |
| 605 | - | state.colorspace = DRM_MODE_COLORIMETRY_DEFAULT; | |
| 606 | - | state.hdmi.broadcast_rgb = DRM_HDMI_BROADCAST_RGB_AUTO; | |
| 607 | - | ||
| 608 | - | KUNIT_EXPECT_EQ(test, (int)amdgpu_dm_get_output_color_space(&timing, &state), | |
| 609 | - | (int)COLOR_SPACE_SRGB_LIMITED); | |
| 610 | - | } | |
| 611 | - | ||
| 612 | - | /** | |
| 613 | - | * dm_test_output_color_space_default_rgb_auto_hdmi_vga - 640x480 (VIC 1) stays full range | |
| 614 | - | * @test: The KUnit test context | |
| 615 | - | */ | |
| 616 | - | static void dm_test_output_color_space_default_rgb_auto_hdmi_vga(struct kunit *test) | |
| 617 | - | { | |
| 618 | - | struct dc_crtc_timing timing = {}; | |
| 619 | - | struct drm_connector_state state = {}; | |
| 620 | - | struct drm_connector *connector = kunit_kzalloc(test, sizeof(*connector), GFP_KERNEL); | |
| 621 | - | ||
| 622 | - | connector->display_info.is_hdmi = true; | |
| 623 | - | timing.pixel_encoding = PIXEL_ENCODING_RGB; | |
| 624 | - | timing.vic = 1; | |
| 625 | - | state.connector = connector; | |
| 626 | - | state.colorspace = DRM_MODE_COLORIMETRY_DEFAULT; | |
| 627 | - | state.hdmi.broadcast_rgb = DRM_HDMI_BROADCAST_RGB_AUTO; | |
| 628 | - | ||
| 629 | - | KUNIT_EXPECT_EQ(test, (int)amdgpu_dm_get_output_color_space(&timing, &state), | |
| 630 | - | (int)COLOR_SPACE_SRGB); | |
| 631 | - | } | |
| 632 | - | ||
| 633 | - | /** | |
| 634 | - | * dm_test_output_color_space_default_rgb_auto_dp_cta - Automatic on a non-HDMI sink is full range | |
| 635 | - | * @test: The KUnit test context | |
| 636 | - | */ | |
| 637 | - | static void dm_test_output_color_space_default_rgb_auto_dp_cta(struct kunit *test) | |
| 638 | - | { | |
| 639 | - | struct dc_crtc_timing timing = {}; | |
| 640 | - | struct drm_connector_state state = {}; | |
| 641 | - | struct drm_connector *connector = kunit_kzalloc(test, sizeof(*connector), GFP_KERNEL); | |
| 642 | - | ||
| 643 | - | timing.pixel_encoding = PIXEL_ENCODING_RGB; | |
| 644 | - | timing.vic = 32; | |
| 645 | - | state.connector = connector; | |
| 646 | - | state.colorspace = DRM_MODE_COLORIMETRY_DEFAULT; | |
| 647 | - | state.hdmi.broadcast_rgb = DRM_HDMI_BROADCAST_RGB_AUTO; | |
| 648 | - | ||
| 649 | - | KUNIT_EXPECT_EQ(test, (int)amdgpu_dm_get_output_color_space(&timing, &state), | |
| 650 | - | (int)COLOR_SPACE_SRGB); | |
| 651 | - | } | |
| 652 | - | ||
| 653 | - | /** | |
| 654 | - | * dm_test_output_color_space_default_rgb_full_hdmi_cta - Full overrides the CTA-861 default | |
| 655 | - | * @test: The KUnit test context | |
| 656 | - | */ | |
| 657 | - | static void dm_test_output_color_space_default_rgb_full_hdmi_cta(struct kunit *test) | |
| 658 | - | { | |
| 659 | - | struct dc_crtc_timing timing = {}; | |
| 660 | - | struct drm_connector_state state = {}; | |
| 661 | - | struct drm_connector *connector = kunit_kzalloc(test, sizeof(*connector), GFP_KERNEL); | |
| 662 | - | ||
| 663 | - | connector->display_info.is_hdmi = true; | |
| 664 | - | timing.pixel_encoding = PIXEL_ENCODING_RGB; | |
| 665 | - | timing.vic = 32; | |
| 666 | - | state.connector = connector; | |
| 667 | - | state.colorspace = DRM_MODE_COLORIMETRY_DEFAULT; | |
| 668 | - | state.hdmi.broadcast_rgb = DRM_HDMI_BROADCAST_RGB_FULL; | |
| 669 | - | ||
| 670 | - | KUNIT_EXPECT_EQ(test, (int)amdgpu_dm_get_output_color_space(&timing, &state), | |
| 671 | - | (int)COLOR_SPACE_SRGB); | |
| 672 | - | } | |
| 673 | - | ||
| 674 | - | /** | |
| 675 | - | * dm_test_output_color_space_bt2020_rgb_auto_hdmi_cta - BT.2020 RGB follows the same default | |
| 676 | - | * @test: The KUnit test context | |
| 677 | - | */ | |
| 678 | - | static void dm_test_output_color_space_bt2020_rgb_auto_hdmi_cta(struct kunit *test) | |
| 679 | - | { | |
| 680 | - | struct dc_crtc_timing timing = {}; | |
| 681 | - | struct drm_connector_state state = {}; | |
| 682 | - | struct drm_connector *connector = kunit_kzalloc(test, sizeof(*connector), GFP_KERNEL); | |
| 683 | - | ||
| 684 | - | connector->display_info.is_hdmi = true; | |
| 685 | - | timing.pixel_encoding = PIXEL_ENCODING_RGB; | |
| 686 | - | timing.vic = 32; | |
| 687 | - | state.connector = connector; | |
| 688 | - | state.colorspace = DRM_MODE_COLORIMETRY_BT2020_RGB; | |
| 689 | - | state.hdmi.broadcast_rgb = DRM_HDMI_BROADCAST_RGB_AUTO; | |
| 690 | - | ||
| 691 | - | KUNIT_EXPECT_EQ(test, (int)amdgpu_dm_get_output_color_space(&timing, &state), | |
| 692 | - | (int)COLOR_SPACE_2020_RGB_LIMITEDRANGE); | |
| 693 | - | } | |
| 694 | - | ||
| 695 | 587 | /** | |
| 696 | 588 | * dm_test_output_color_space_bt2020_ycc - Test Output color space bt2020 ycc | |
| 697 | 589 | * @test: The KUnit test context | |
| @@ -755,9 +647,7 @@ static void dm_test_output_color_space_bt2020_ycc_rgb_encoding(struct kunit *tes | |||
| 755 | 647 | { | |
| 756 | 648 | struct dc_crtc_timing timing = {}; | |
| 757 | 649 | struct drm_connector_state state = {}; | |
| 758 | - | struct drm_connector *connector = kunit_kzalloc(test, sizeof(*connector), GFP_KERNEL); | |
| 759 | 650 | ||
| 760 | - | state.connector = connector; | |
| 761 | 651 | timing.pixel_encoding = PIXEL_ENCODING_RGB; | |
| 762 | 652 | state.colorspace = DRM_MODE_COLORIMETRY_BT2020_YCC; | |
| 763 | 653 | ||
| @@ -1572,46 +1462,6 @@ static void dm_test_decide_crtc_timing_no_crtc_clock(struct kunit *test) | |||
| 1572 | 1462 | KUNIT_EXPECT_EQ(test, drm_mode.crtc_hdisplay, 0); | |
| 1573 | 1463 | } | |
| 1574 | 1464 | ||
| 1575 | - | static void dm_test_decide_crtc_timing_sink_mode_same_totals(struct kunit *test) | |
| 1576 | - | { | |
| 1577 | - | struct drm_display_mode native_mode = { | |
| 1578 | - | DRM_MODE("3840x2160", DRM_MODE_TYPE_DRIVER, 594000, 3840, 4016, 4104, | |
| 1579 | - | 4400, 0, 2160, 2168, 2178, 2250, 0, | |
| 1580 | - | DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }; | |
| 1581 | - | struct drm_display_mode drm_mode = { | |
| 1582 | - | DRM_MODE("4096x2160", DRM_MODE_TYPE_DRIVER, 594000, 4096, 4184, 4272, | |
| 1583 | - | 4400, 0, 2160, 2168, 2178, 2250, 0, | |
| 1584 | - | DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }; | |
| 1585 | - | ||
| 1586 | - | drm_mode_set_crtcinfo(&native_mode, 0); | |
| 1587 | - | drm_mode_set_crtcinfo(&drm_mode, 0); | |
| 1588 | - | ||
| 1589 | - | decide_crtc_timing_for_drm_display_mode(&drm_mode, &native_mode, false); | |
| 1590 | - | ||
| 1591 | - | KUNIT_EXPECT_EQ(test, drm_mode.crtc_hdisplay, 4096); | |
| 1592 | - | KUNIT_EXPECT_EQ(test, drm_mode.crtc_hsync_start, 4184); | |
| 1593 | - | } | |
| 1594 | - | ||
| 1595 | - | static void dm_test_decide_crtc_timing_inserted_mode(struct kunit *test) | |
| 1596 | - | { | |
| 1597 | - | struct drm_display_mode native_mode = { | |
| 1598 | - | DRM_MODE("3840x2160", DRM_MODE_TYPE_DRIVER, 594000, 3840, 4016, 4104, | |
| 1599 | - | 4400, 0, 2160, 2168, 2178, 2250, 0, | |
| 1600 | - | DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }; | |
| 1601 | - | struct drm_display_mode drm_mode; | |
| 1602 | - | ||
| 1603 | - | drm_mode_set_crtcinfo(&native_mode, 0); | |
| 1604 | - | drm_mode = native_mode; | |
| 1605 | - | drm_mode.hdisplay = 1920; | |
| 1606 | - | drm_mode.vdisplay = 1080; | |
| 1607 | - | drm_mode_set_crtcinfo(&drm_mode, 0); | |
| 1608 | - | ||
| 1609 | - | decide_crtc_timing_for_drm_display_mode(&drm_mode, &native_mode, false); | |
| 1610 | - | ||
| 1611 | - | KUNIT_EXPECT_EQ(test, drm_mode.crtc_hdisplay, 3840); | |
| 1612 | - | KUNIT_EXPECT_EQ(test, drm_mode.crtc_vdisplay, 2160); | |
| 1613 | - | } | |
| 1614 | - | ||
| 1615 | 1465 | /* Tests for amdgpu_dm_connector_funcs_reset() */ | |
| 1616 | 1466 | ||
| 1617 | 1467 | static const struct drm_connector_funcs dm_test_connector_funcs = { | |
| @@ -3575,7 +3425,6 @@ static struct dm_test_fill_ctx *dm_test_fill_ctx_alloc(struct kunit *test) | |||
| 3575 | 3425 | ||
| 3576 | 3426 | ctx->conn_state = drmm_kzalloc(ctx->drm, sizeof(*ctx->conn_state), GFP_KERNEL); | |
| 3577 | 3427 | KUNIT_ASSERT_NOT_NULL(test, ctx->conn_state); | |
| 3578 | - | ctx->conn_state->connector = &ctx->aconnector->base; | |
| 3579 | 3428 | ctx->stream = kunit_kzalloc(test, sizeof(*ctx->stream), GFP_KERNEL); | |
| 3580 | 3429 | KUNIT_ASSERT_NOT_NULL(test, ctx->stream); | |
| 3581 | 3430 | ctx->mode = kunit_kzalloc(test, sizeof(*ctx->mode), GFP_KERNEL); | |
| @@ -3969,7 +3818,6 @@ static struct dm_test_stream_ctx *dm_test_stream_ctx_alloc(struct kunit *test) | |||
| 3969 | 3818 | ||
| 3970 | 3819 | ctx->dm_state = kunit_kzalloc(test, sizeof(*ctx->dm_state), GFP_KERNEL); | |
| 3971 | 3820 | KUNIT_ASSERT_NOT_NULL(test, ctx->dm_state); | |
| 3972 | - | ctx->dm_state->base.connector = &ctx->aconnector->base; | |
| 3973 | 3821 | ctx->dm_state->scaling = RMX_OFF; | |
| 3974 | 3822 | ||
| 3975 | 3823 | ctx->mode = kunit_kzalloc(test, sizeof(*ctx->mode), GFP_KERNEL); | |
| @@ -5610,11 +5458,6 @@ static struct kunit_case amdgpu_dm_connector_tests[] = { | |||
| 5610 | 5458 | KUNIT_CASE(dm_test_output_color_space_oprgb), | |
| 5611 | 5459 | KUNIT_CASE(dm_test_output_color_space_bt2020_rgb), | |
| 5612 | 5460 | KUNIT_CASE(dm_test_output_color_space_bt2020_rgb_limited), | |
| 5613 | - | KUNIT_CASE(dm_test_output_color_space_default_rgb_auto_hdmi_cta), | |
| 5614 | - | KUNIT_CASE(dm_test_output_color_space_default_rgb_auto_hdmi_vga), | |
| 5615 | - | KUNIT_CASE(dm_test_output_color_space_default_rgb_auto_dp_cta), | |
| 5616 | - | KUNIT_CASE(dm_test_output_color_space_default_rgb_full_hdmi_cta), | |
| 5617 | - | KUNIT_CASE(dm_test_output_color_space_bt2020_rgb_auto_hdmi_cta), | |
| 5618 | 5461 | KUNIT_CASE(dm_test_output_color_space_bt2020_ycc), | |
| 5619 | 5462 | KUNIT_CASE(dm_test_output_color_space_default_ycbcr709_y_only), | |
| 5620 | 5463 | KUNIT_CASE(dm_test_output_color_space_default_ycbcr601), | |
| @@ -5675,8 +5518,6 @@ static struct kunit_case amdgpu_dm_connector_tests[] = { | |||
| 5675 | 5518 | KUNIT_CASE(dm_test_decide_crtc_timing_matching_mode), | |
| 5676 | 5519 | KUNIT_CASE(dm_test_decide_crtc_timing_no_copy), | |
| 5677 | 5520 | KUNIT_CASE(dm_test_decide_crtc_timing_no_crtc_clock), | |
| 5678 | - | KUNIT_CASE(dm_test_decide_crtc_timing_sink_mode_same_totals), | |
| 5679 | - | KUNIT_CASE(dm_test_decide_crtc_timing_inserted_mode), | |
| 5680 | 5521 | /* amdgpu_dm_connector_funcs_reset */ | |
| 5681 | 5522 | KUNIT_CASE(dm_test_funcs_reset_sets_defaults), | |
| 5682 | 5523 | KUNIT_CASE(dm_test_funcs_reset_edp_abm_level), | |
modified drivers/gpu/drm/amd/display/dc/dc.h
| @@ -1905,7 +1905,6 @@ struct dc_scratch_space { | |||
| 1905 | 1905 | struct ddc_service *ddc; | |
| 1906 | 1906 | ||
| 1907 | 1907 | enum dp_panel_mode panel_mode; | |
| 1908 | - | bool panel_mode_initialized; | |
| 1909 | 1908 | bool aux_mode; | |
| 1910 | 1909 | ||
| 1911 | 1910 | /* Private to DC core */ | |
modified drivers/gpu/drm/amd/display/dc/dml/Makefile
| @@ -29,7 +29,7 @@ dml_ccflags := $(CC_FLAGS_FPU) | |||
| 29 | 29 | dml_rcflags := $(CC_FLAGS_NO_FPU) | |
| 30 | 30 | ||
| 31 | 31 | ifneq ($(CONFIG_FRAME_WARN),0) | |
| 32 | - | ifneq ($(filter y,$(CONFIG_KASAN) $(CONFIG_KCSAN) $(CONFIG_UBSAN)),) | |
| 32 | + | ifeq ($(filter y,$(CONFIG_KASAN)$(CONFIG_KCSAN)$(CONFIG_UBSAN)),y) | |
| 33 | 33 | ifeq ($(CONFIG_CC_IS_CLANG)$(CONFIG_COMPILE_TEST),yy) | |
| 34 | 34 | frame_warn_limit := 4096 | |
| 35 | 35 | else | |
modified drivers/gpu/drm/amd/display/dc/dml2_0/Makefile
| @@ -28,7 +28,7 @@ dml2_ccflags := $(CC_FLAGS_FPU) | |||
| 28 | 28 | dml2_rcflags := $(CC_FLAGS_NO_FPU) | |
| 29 | 29 | ||
| 30 | 30 | ifneq ($(CONFIG_FRAME_WARN),0) | |
| 31 | - | ifneq ($(filter y,$(CONFIG_KASAN) $(CONFIG_KCSAN) $(CONFIG_UBSAN)),) | |
| 31 | + | ifeq ($(filter y,$(CONFIG_KASAN)$(CONFIG_KCSAN)$(CONFIG_UBSAN)),y) | |
| 32 | 32 | ifeq ($(CONFIG_CC_IS_CLANG)$(CONFIG_COMPILE_TEST),yy) | |
| 33 | 33 | frame_warn_limit := 4096 | |
| 34 | 34 | else | |
modified drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.c
| @@ -93,7 +93,6 @@ void dp_set_panel_mode(struct dc_link *link, enum dp_panel_mode panel_mode) | |||
| 93 | 93 | } | |
| 94 | 94 | ||
| 95 | 95 | link->panel_mode = panel_mode; | |
| 96 | - | link->panel_mode_initialized = true; | |
| 97 | 96 | DC_LOG_DETECTION_DP_CAPS("%d eDP panel mode supported: %d, enabled: %d\n", | |
| 98 | 97 | link->link_index, | |
| 99 | 98 | link->dpcd_caps.panel_mode_edp, | |
| @@ -1298,8 +1297,7 @@ void edp_set_panel_assr(struct dc_link *link, struct pipe_ctx *pipe_ctx, | |||
| 1298 | 1297 | ||
| 1299 | 1298 | result = cp_psp->funcs.enable_assr(cp_psp->handle, link); | |
| 1300 | 1299 | ||
| 1301 | - | if (!result && link->panel_mode_initialized && | |
| 1302 | - | link->panel_mode != DP_PANEL_MODE_EDP) | |
| 1300 | + | if (!result && link->panel_mode != DP_PANEL_MODE_EDP) | |
| 1303 | 1301 | *panel_mode = DP_PANEL_MODE_DEFAULT; | |
| 1304 | 1302 | } | |
| 1305 | 1303 | } | |
modified drivers/gpu/drm/amd/display/dc/resource/dce60/dce60_resource.c
| @@ -448,12 +448,6 @@ static const struct dce_abm_mask abm_mask = { | |||
| 448 | 448 | ABM_MASK_SH_LIST_DCE110(_MASK) | |
| 449 | 449 | }; | |
| 450 | 450 | ||
| 451 | - | static const struct dc_debug_options debug_defaults = { 0 }; | |
| 452 | - | ||
| 453 | - | static const struct dc_check_config config_defaults = { | |
| 454 | - | .enable_legacy_fast_update = true, | |
| 455 | - | }; | |
| 456 | - | ||
| 457 | 451 | #define CTX ctx | |
| 458 | 452 | #define REG(reg) mm ## reg | |
| 459 | 453 | ||
| @@ -943,8 +937,6 @@ static bool dce60_construct( | |||
| 943 | 937 | dc->caps.max_cursor_size = 64; | |
| 944 | 938 | dc->caps.dual_link_dvi = true; | |
| 945 | 939 | dc->caps.extended_aux_timeout_support = false; | |
| 946 | - | dc->debug = debug_defaults; | |
| 947 | - | dc->check_config = config_defaults; | |
| 948 | 940 | ||
| 949 | 941 | /************************************************* | |
| 950 | 942 | * Create resources * | |
| @@ -1142,8 +1134,6 @@ static bool dce61_construct( | |||
| 1142 | 1134 | dc->caps.i2c_speed_in_khz = 40; | |
| 1143 | 1135 | dc->caps.max_cursor_size = 64; | |
| 1144 | 1136 | dc->caps.is_apu = true; | |
| 1145 | - | dc->debug = debug_defaults; | |
| 1146 | - | dc->check_config = config_defaults; | |
| 1147 | 1137 | ||
| 1148 | 1138 | /************************************************* | |
| 1149 | 1139 | * Create resources * | |
| @@ -1341,8 +1331,7 @@ static bool dce64_construct( | |||
| 1341 | 1331 | dc->caps.max_downscale_ratio = 200; | |
| 1342 | 1332 | dc->caps.i2c_speed_in_khz = 40; | |
| 1343 | 1333 | dc->caps.max_cursor_size = 64; | |
| 1344 | - | dc->debug = debug_defaults; | |
| 1345 | - | dc->check_config = config_defaults; | |
| 1334 | + | dc->caps.is_apu = true; | |
| 1346 | 1335 | ||
| 1347 | 1336 | /************************************************* | |
| 1348 | 1337 | * Create resources * | |
modified drivers/gpu/drm/amd/display/dc/resource/dce80/dce80_resource.c
| @@ -1148,8 +1148,6 @@ static bool dce81_construct( | |||
| 1148 | 1148 | dc->caps.max_cursor_size = 128; | |
| 1149 | 1149 | dc->caps.min_horizontal_blanking_period = 80; | |
| 1150 | 1150 | dc->caps.is_apu = true; | |
| 1151 | - | dc->debug = debug_defaults; | |
| 1152 | - | dc->check_config = config_defaults; | |
| 1153 | 1151 | ||
| 1154 | 1152 | /************************************************* | |
| 1155 | 1153 | * Create resources * | |
modified drivers/gpu/drm/amd/display/modules/power/power.c
| @@ -328,7 +328,6 @@ bool mod_power_add_stream(struct mod_power *mod_power, | |||
| 328 | 328 | core_power->map[core_power->num_entities].psr_enabled = 0; | |
| 329 | 329 | core_power->map[core_power->num_entities].psr_events = psr_event_vsync; | |
| 330 | 330 | core_power->map[core_power->num_entities].psr_power_opt = 0; | |
| 331 | - | core_power->map[core_power->num_entities].replay_events = replay_event_vsync; | |
| 332 | 331 | core_power->num_entities++; | |
| 333 | 332 | return true; | |
| 334 | 333 | } | |
| @@ -388,7 +387,6 @@ bool mod_power_remove_stream(struct mod_power *mod_power, | |||
| 388 | 387 | core_power->map[i].psr_enabled = core_power->map[i + 1].psr_enabled; | |
| 389 | 388 | core_power->map[i].psr_events = core_power->map[i + 1].psr_events; | |
| 390 | 389 | core_power->map[i].psr_power_opt = core_power->map[i + 1].psr_power_opt; | |
| 391 | - | core_power->map[i].replay_events = core_power->map[i + 1].replay_events; | |
| 392 | 390 | ||
| 393 | 391 | memcpy(core_power->map[i].psr_context, core_power->map[i + 1].psr_context, sizeof(struct mod_power_psr_context)); | |
| 394 | 392 | memset(core_power->map[i + 1].psr_context, 0, sizeof(struct mod_power_psr_context)); | |
modified drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c
| @@ -5263,8 +5263,7 @@ static int si_init_smc_table(struct amdgpu_device *adev) | |||
| 5263 | 5263 | break; | |
| 5264 | 5264 | } | |
| 5265 | 5265 | ||
| 5266 | - | if ((adev->flags & AMD_IS_MOBILITY) && | |
| 5267 | - | (adev->pm.dpm.platform_caps & ATOM_PP_PLATFORM_CAP_HARDWAREDC)) | |
| 5266 | + | if (adev->pm.dpm.platform_caps & ATOM_PP_PLATFORM_CAP_HARDWAREDC) | |
| 5268 | 5267 | table->systemFlags |= PPSMC_SYSTEMFLAG_GPIO_DC; | |
| 5269 | 5268 | ||
| 5270 | 5269 | if (adev->pm.dpm.platform_caps & ATOM_PP_PLATFORM_CAP_REGULATOR_HOT) { | |
| @@ -7238,19 +7237,6 @@ static void si_parse_pplib_non_clock_info(struct amdgpu_device *adev, | |||
| 7238 | 7237 | adev->pm.dpm.uvd_ps = rps; | |
| 7239 | 7238 | } | |
| 7240 | 7239 | ||
| 7241 | - | static void si_update_limits(struct amdgpu_clock_and_voltage_limits *limits, | |
| 7242 | - | struct rv7xx_pl *pl) | |
| 7243 | - | { | |
| 7244 | - | if (pl->sclk > limits->sclk) | |
| 7245 | - | limits->sclk = pl->sclk; | |
| 7246 | - | if (pl->mclk > limits->mclk) | |
| 7247 | - | limits->mclk = pl->mclk; | |
| 7248 | - | if (pl->vddc > limits->vddc) | |
| 7249 | - | limits->vddc = pl->vddc; | |
| 7250 | - | if (pl->vddci > limits->vddci) | |
| 7251 | - | limits->vddci = pl->vddci; | |
| 7252 | - | } | |
| 7253 | - | ||
| 7254 | 7240 | static void si_parse_pplib_clock_info(struct amdgpu_device *adev, | |
| 7255 | 7241 | struct amdgpu_ps *rps, int index, | |
| 7256 | 7242 | union pplib_clock_info *clock_info) | |
| @@ -7259,6 +7245,7 @@ static void si_parse_pplib_clock_info(struct amdgpu_device *adev, | |||
| 7259 | 7245 | struct evergreen_power_info *eg_pi = evergreen_get_pi(adev); | |
| 7260 | 7246 | struct si_power_info *si_pi = si_get_pi(adev); | |
| 7261 | 7247 | struct si_ps *ps = si_get_ps(rps); | |
| 7248 | + | struct amdgpu_clock_and_voltage_limits *limits; | |
| 7262 | 7249 | u16 leakage_voltage; | |
| 7263 | 7250 | struct rv7xx_pl *pl = &ps->performance_levels[index]; | |
| 7264 | 7251 | int ret; | |
| @@ -7323,14 +7310,26 @@ static void si_parse_pplib_clock_info(struct amdgpu_device *adev, | |||
| 7323 | 7310 | * VBIOS can contain conflicting values between: | |
| 7324 | 7311 | * - the maximum allowed clocks and voltages on AC or DC | |
| 7325 | 7312 | * - the clocks and voltages in power states on AC or DC | |
| 7326 | - | * | |
| 7327 | - | * Assume that the AC limits are the maximum of all power states, | |
| 7328 | - | * and the DC limits are the maximum of battery power states. | |
| 7329 | 7313 | */ | |
| 7330 | - | si_update_limits(&adev->pm.dpm.dyn_state.max_clock_voltage_on_ac, pl); | |
| 7331 | 7314 | if ((rps->class & ATOM_PPLIB_CLASSIFICATION_UI_MASK) == | |
| 7315 | + | ATOM_PPLIB_CLASSIFICATION_UI_PERFORMANCE) | |
| 7316 | + | limits = &adev->pm.dpm.dyn_state.max_clock_voltage_on_ac; | |
| 7317 | + | else if ((rps->class & ATOM_PPLIB_CLASSIFICATION_UI_MASK) == | |
| 7332 | 7318 | ATOM_PPLIB_CLASSIFICATION_UI_BATTERY) | |
| 7333 | - | si_update_limits(&adev->pm.dpm.dyn_state.max_clock_voltage_on_dc, pl); | |
| 7319 | + | limits = &adev->pm.dpm.dyn_state.max_clock_voltage_on_dc; | |
| 7320 | + | else | |
| 7321 | + | limits = NULL; | |
| 7322 | + | ||
| 7323 | + | if (limits) { | |
| 7324 | + | if (pl->sclk > limits->sclk) | |
| 7325 | + | limits->sclk = pl->sclk; | |
| 7326 | + | if (pl->mclk > limits->mclk) | |
| 7327 | + | limits->mclk = pl->mclk; | |
| 7328 | + | if (pl->vddc > limits->vddc) | |
| 7329 | + | limits->vddc = pl->vddc; | |
| 7330 | + | if (pl->vddci > limits->vddci) | |
| 7331 | + | limits->vddci = pl->vddci; | |
| 7332 | + | } | |
| 7334 | 7333 | } | |
| 7335 | 7334 | ||
| 7336 | 7335 | union pplib_power_state { | |
modified drivers/gpu/drm/aspeed/aspeed_gfx_drv.c
| @@ -189,12 +189,13 @@ static int aspeed_gfx_load(struct drm_device *drm) | |||
| 189 | 189 | } | |
| 190 | 190 | reset_control_deassert(priv->rst); | |
| 191 | 191 | ||
| 192 | - | priv->clk = devm_clk_get_enabled(drm->dev, NULL); | |
| 192 | + | priv->clk = devm_clk_get(drm->dev, NULL); | |
| 193 | 193 | if (IS_ERR(priv->clk)) { | |
| 194 | 194 | dev_err(&pdev->dev, | |
| 195 | - | "failed to get and enable clock\n"); | |
| 195 | + | "missing or invalid clk device tree entry"); | |
| 196 | 196 | return PTR_ERR(priv->clk); | |
| 197 | 197 | } | |
| 198 | + | clk_prepare_enable(priv->clk); | |
| 198 | 199 | ||
| 199 | 200 | /* Sanitize control registers */ | |
| 200 | 201 | writel(0, priv->base + CRT_CTRL1); | |
modified drivers/gpu/drm/bridge/th1520-dw-hdmi.c
| @@ -135,8 +135,8 @@ static int th1520_dw_hdmi_probe(struct platform_device *pdev) | |||
| 135 | 135 | plat_data->priv_data = hdmi; | |
| 136 | 136 | ||
| 137 | 137 | hdmi->dw_hdmi = dw_hdmi_probe(pdev, plat_data); | |
| 138 | - | if (IS_ERR(hdmi->dw_hdmi)) | |
| 139 | - | return PTR_ERR(hdmi->dw_hdmi); | |
| 138 | + | if (IS_ERR(hdmi)) | |
| 139 | + | return PTR_ERR(hdmi); | |
| 140 | 140 | ||
| 141 | 141 | platform_set_drvdata(pdev, hdmi); | |
| 142 | 142 | ||
| @@ -145,9 +145,9 @@ static int th1520_dw_hdmi_probe(struct platform_device *pdev) | |||
| 145 | 145 | ||
| 146 | 146 | static void th1520_dw_hdmi_remove(struct platform_device *pdev) | |
| 147 | 147 | { | |
| 148 | - | struct th1520_hdmi *hdmi = platform_get_drvdata(pdev); | |
| 148 | + | struct dw_hdmi *hdmi = platform_get_drvdata(pdev); | |
| 149 | 149 | ||
| 150 | - | dw_hdmi_remove(hdmi->dw_hdmi); | |
| 150 | + | dw_hdmi_remove(hdmi); | |
| 151 | 151 | } | |
| 152 | 152 | ||
| 153 | 153 | static const struct of_device_id th1520_dw_hdmi_of_table[] = { | |
modified drivers/gpu/drm/display/drm_dp_helper.c
| @@ -4634,9 +4634,7 @@ static int dp_aux_backlight_update_status(struct backlight_device *bd) | |||
| 4634 | 4634 | ||
| 4635 | 4635 | if (!backlight_is_blank(bd)) { | |
| 4636 | 4636 | if (!bl->enabled) { | |
| 4637 | - | ret = drm_edp_backlight_enable(bl->aux, &bl->info, brightness); | |
| 4638 | - | if (ret) | |
| 4639 | - | return ret; | |
| 4637 | + | drm_edp_backlight_enable(bl->aux, &bl->info, brightness); | |
| 4640 | 4638 | bl->enabled = true; | |
| 4641 | 4639 | return 0; | |
| 4642 | 4640 | } | |
modified drivers/gpu/drm/drm_bridge.c
| @@ -454,10 +454,8 @@ void drm_bridge_add(struct drm_bridge *bridge) | |||
| 454 | 454 | * in bridge_lingering_list. Remove it or bridge_lingering_list will be | |
| 455 | 455 | * corrupted when adding this bridge to bridge_list below. | |
| 456 | 456 | */ | |
| 457 | - | mutex_lock(&bridge_lock); | |
| 458 | 457 | if (!list_empty(&bridge->list)) | |
| 459 | 458 | list_del_init(&bridge->list); | |
| 460 | - | mutex_unlock(&bridge_lock); | |
| 461 | 459 | ||
| 462 | 460 | mutex_init(&bridge->hpd_state_mutex); | |
| 463 | 461 | mutex_init(&bridge->hpd_mutex); | |
| @@ -595,10 +593,8 @@ int drm_bridge_attach(struct drm_encoder *encoder, struct drm_bridge *bridge, | |||
| 595 | 593 | if (!bridge->container) | |
| 596 | 594 | DRM_WARN("DRM bridge corrupted or not allocated by devm_drm_bridge_alloc()\n"); | |
| 597 | 595 | ||
| 598 | - | scoped_guard(mutex, &bridge_lock) { | |
| 599 | - | if (list_empty(&bridge->list)) | |
| 600 | - | DRM_WARN("Missing drm_bridge_add() before attach\n"); | |
| 601 | - | } | |
| 596 | + | if (list_empty(&bridge->list)) | |
| 597 | + | DRM_WARN("Missing drm_bridge_add() before attach\n"); | |
| 602 | 598 | ||
| 603 | 599 | drm_bridge_get(bridge); | |
| 604 | 600 | ||
modified drivers/gpu/drm/drm_fb_helper.c
| @@ -1724,10 +1724,10 @@ __drm_fb_helper_initial_config_and_unlock(struct drm_fb_helper *fb_helper) | |||
| 1724 | 1724 | ||
| 1725 | 1725 | ret = drm_fb_helper_single_fb_probe(fb_helper); | |
| 1726 | 1726 | if (ret < 0) { | |
| 1727 | - | /* modesets are probed but fb_helper->fb isn't; defer restore too */ | |
| 1728 | - | fb_helper->deferred_setup = true; | |
| 1729 | - | if (ret == -EAGAIN) | |
| 1727 | + | if (ret == -EAGAIN) { | |
| 1728 | + | fb_helper->deferred_setup = true; | |
| 1730 | 1729 | ret = 0; | |
| 1730 | + | } | |
| 1731 | 1731 | mutex_unlock(&fb_helper->lock); | |
| 1732 | 1732 | ||
| 1733 | 1733 | goto err_drm_fb_helper_release_info; | |
modified drivers/gpu/drm/gud/gud_pipe.c
| @@ -507,7 +507,6 @@ int gud_plane_atomic_check(struct drm_plane *plane, | |||
| 507 | 507 | for_each_new_connector_in_state(state, connector, connector_state, i) { | |
| 508 | 508 | if (connector_state->crtc) | |
| 509 | 509 | break; | |
| 510 | - | connector_state = NULL; | |
| 511 | 510 | } | |
| 512 | 511 | ||
| 513 | 512 | /* | |
modified drivers/gpu/drm/i915/display/intel_display_params.c
| @@ -120,10 +120,6 @@ intel_display_param_named_unsafe(enable_psr, int, 0400, | |||
| 120 | 120 | "(0=disabled, 1=enable up to PSR1, 2=enable up to PSR2) " | |
| 121 | 121 | "Default: -1 (use per-chip default)"); | |
| 122 | 122 | ||
| 123 | - | intel_display_param_named_unsafe(enable_dc_balance, bool, 0400, | |
| 124 | - | "Enable VRR DC balance (0=disabled, 1=enabled). " | |
| 125 | - | "Default: 0 (disabled)"); | |
| 126 | - | ||
| 127 | 123 | intel_display_param_named_unsafe(enable_panel_replay, int, 0400, | |
| 128 | 124 | "Enable Panel Replay (0=disabled, 1=enabled). Default: -1 (use per-chip default)"); | |
| 129 | 125 | ||
modified drivers/gpu/drm/i915/display/intel_display_params.h
| @@ -46,7 +46,6 @@ struct drm_printer; | |||
| 46 | 46 | param(bool, enable_dp_mst, true, 0600) \ | |
| 47 | 47 | param(int, enable_fbc, -1, 0600) \ | |
| 48 | 48 | param(int, enable_psr, -1, 0600) \ | |
| 49 | - | param(bool, enable_dc_balance, false, 0600) \ | |
| 50 | 49 | param(int, enable_panel_replay, -1, 0600) \ | |
| 51 | 50 | param(bool, psr_safest_params, false, 0400) \ | |
| 52 | 51 | param(bool, enable_psr2_sel_fetch, true, 0400) \ | |
modified drivers/gpu/drm/i915/display/intel_vrr.c
| @@ -386,12 +386,10 @@ static bool intel_vrr_dc_balance_possible(const struct intel_crtc_state *crtc_st | |||
| 386 | 386 | static void | |
| 387 | 387 | intel_vrr_dc_balance_compute_config(struct intel_crtc_state *crtc_state) | |
| 388 | 388 | { | |
| 389 | - | struct intel_display *display = to_intel_display(crtc_state); | |
| 390 | 389 | int guardband_usec, adjustment_usec; | |
| 391 | 390 | struct drm_display_mode *adjusted_mode = &crtc_state->hw.adjusted_mode; | |
| 392 | 391 | ||
| 393 | - | if (!intel_vrr_dc_balance_possible(crtc_state) || | |
| 394 | - | !crtc_state->vrr.enable || !display->params.enable_dc_balance) | |
| 392 | + | if (!intel_vrr_dc_balance_possible(crtc_state) || !crtc_state->vrr.enable) | |
| 395 | 393 | return; | |
| 396 | 394 | ||
| 397 | 395 | crtc_state->vrr.dc_balance.vmax = crtc_state->vrr.vmax; | |
modified drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
| @@ -1766,7 +1766,6 @@ static int eb_reinit_userptr(struct i915_execbuffer *eb) | |||
| 1766 | 1766 | ||
| 1767 | 1767 | static noinline int eb_relocate_parse_slow(struct i915_execbuffer *eb) | |
| 1768 | 1768 | { | |
| 1769 | - | const unsigned int count = eb->buffer_count; | |
| 1770 | 1769 | bool have_copy = false; | |
| 1771 | 1770 | struct eb_vma *ev; | |
| 1772 | 1771 | int err = 0; | |
| @@ -1869,6 +1868,7 @@ err: | |||
| 1869 | 1868 | ||
| 1870 | 1869 | out: | |
| 1871 | 1870 | if (have_copy) { | |
| 1871 | + | const unsigned int count = eb->buffer_count; | |
| 1872 | 1872 | unsigned int i; | |
| 1873 | 1873 | ||
| 1874 | 1874 | for (i = 0; i < count; i++) { | |
modified drivers/gpu/drm/i915/gt/intel_rps.c
| @@ -1904,8 +1904,7 @@ static void rps_work(struct work_struct *work) | |||
| 1904 | 1904 | ||
| 1905 | 1905 | out: | |
| 1906 | 1906 | spin_lock_irq(gt->irq_lock); | |
| 1907 | - | if (intel_rps_is_active(rps)) | |
| 1908 | - | gen6_gt_pm_unmask_irq(gt, rps->pm_events); | |
| 1907 | + | gen6_gt_pm_unmask_irq(gt, rps->pm_events); | |
| 1909 | 1908 | spin_unlock_irq(gt->irq_lock); | |
| 1910 | 1909 | } | |
| 1911 | 1910 | ||
modified drivers/gpu/drm/imagination/pvr_mmu.c
| @@ -2337,7 +2337,7 @@ void pvr_mmu_op_context_destroy(struct pvr_mmu_op_context *op_ctx) | |||
| 2337 | 2337 | * @ctx: MMU context associated with owning VM context. | |
| 2338 | 2338 | * @sgt: Scatter gather table containing pages pinned for use by this context. | |
| 2339 | 2339 | * @device_addr: Virtual device address at the start of the requested mapping. | |
| 2340 | - | * @sgt_offset: Offset into @sgt of the start of the requested mapping. | |
| 2340 | + | * @sgt_offset: Start offset of the requested device-virtual memory mapping. | |
| 2341 | 2341 | * @size: Size in bytes of the requested device-virtual memory mapping. For an | |
| 2342 | 2342 | * unmapping, this should be zero so that no page tables are allocated. | |
| 2343 | 2343 | * | |
| @@ -2350,6 +2350,7 @@ struct pvr_mmu_op_context * | |||
| 2350 | 2350 | pvr_mmu_op_context_create(struct pvr_mmu_context *ctx, struct sg_table *sgt, | |
| 2351 | 2351 | u64 device_addr, u64 sgt_offset, u64 size) | |
| 2352 | 2352 | { | |
| 2353 | + | u64 start_addr = device_addr + sgt_offset; | |
| 2353 | 2354 | int err; | |
| 2354 | 2355 | ||
| 2355 | 2356 | struct pvr_mmu_op_context *op_ctx = kzalloc_obj(*op_ctx); | |
| @@ -2364,18 +2365,18 @@ pvr_mmu_op_context_create(struct pvr_mmu_context *ctx, struct sg_table *sgt, | |||
| 2364 | 2365 | ||
| 2365 | 2366 | if (size) { | |
| 2366 | 2367 | /* | |
| 2367 | - | * The page tables needed are set by the device-virtual range | |
| 2368 | - | * being mapped: one level 1 table per 1GiB region and one | |
| 2369 | - | * level 0 table per 2MiB region the range touches. Tables that | |
| 2370 | - | * already exist are not consumed, so this is an upper bound. | |
| 2368 | + | * The number of page table objects we need to prealloc is | |
| 2369 | + | * indicated by the mapping size, start address and the sizes | |
| 2370 | + | * of the areas mapped per PT or PD. The range calculation is | |
| 2371 | + | * identical to that for the index into a table for a device | |
| 2372 | + | * address, so we reuse those functions here. | |
| 2371 | 2373 | */ | |
| 2372 | - | const u64 last_addr = device_addr + size - 1; | |
| 2373 | - | const u64 l1_count = | |
| 2374 | - | (last_addr >> ROGUE_MMUCTRL_VADDR_PC_INDEX_SHIFT) - | |
| 2375 | - | (device_addr >> ROGUE_MMUCTRL_VADDR_PC_INDEX_SHIFT) + 1; | |
| 2376 | - | const u64 l0_count = | |
| 2377 | - | (last_addr >> ROGUE_MMUCTRL_VADDR_PD_INDEX_SHIFT) - | |
| 2378 | - | (device_addr >> ROGUE_MMUCTRL_VADDR_PD_INDEX_SHIFT) + 1; | |
| 2374 | + | const u32 l1_start_idx = pvr_page_table_l2_idx(start_addr); | |
| 2375 | + | const u32 l1_end_idx = pvr_page_table_l2_idx(start_addr + size); | |
| 2376 | + | const u32 l1_count = l1_end_idx - l1_start_idx + 1; | |
| 2377 | + | const u32 l0_start_idx = pvr_page_table_l1_idx(start_addr); | |
| 2378 | + | const u32 l0_end_idx = pvr_page_table_l1_idx(start_addr + size); | |
| 2379 | + | const u32 l0_count = l0_end_idx - l0_start_idx + 1; | |
| 2379 | 2380 | ||
| 2380 | 2381 | /* | |
| 2381 | 2382 | * Alloc and push page table entries until we have enough of | |
modified drivers/gpu/drm/imagination/pvr_vm.c
| @@ -418,8 +418,6 @@ pvr_vm_gpuva_unmap(struct drm_gpuva_op *op, void *op_ctx) | |||
| 418 | 418 | static int | |
| 419 | 419 | pvr_vm_gpuva_remap(struct drm_gpuva_op *op, void *op_ctx) | |
| 420 | 420 | { | |
| 421 | - | /* The split parts belong to the object of the mapping being split. */ | |
| 422 | - | struct drm_gpuvm_bo *vm_bo = op->remap.unmap->va->vm_bo; | |
| 423 | 421 | struct pvr_vm_bind_op *ctx = op_ctx; | |
| 424 | 422 | u64 va_start = 0, va_range = 0; | |
| 425 | 423 | int err; | |
| @@ -435,12 +433,14 @@ pvr_vm_gpuva_remap(struct drm_gpuva_op *op, void *op_ctx) | |||
| 435 | 433 | drm_gpuva_remap(&ctx->prev_va->base, &ctx->next_va->base, &op->remap); | |
| 436 | 434 | ||
| 437 | 435 | if (op->remap.prev) { | |
| 438 | - | drm_gpuva_link(&ctx->prev_va->base, vm_bo); | |
| 436 | + | pvr_gem_object_get(gem_to_pvr_gem(ctx->prev_va->base.gem.obj)); | |
| 437 | + | drm_gpuva_link(&ctx->prev_va->base, ctx->gpuvm_bo); | |
| 439 | 438 | ctx->prev_va = NULL; | |
| 440 | 439 | } | |
| 441 | 440 | ||
| 442 | 441 | if (op->remap.next) { | |
| 443 | - | drm_gpuva_link(&ctx->next_va->base, vm_bo); | |
| 442 | + | pvr_gem_object_get(gem_to_pvr_gem(ctx->next_va->base.gem.obj)); | |
| 443 | + | drm_gpuva_link(&ctx->next_va->base, ctx->gpuvm_bo); | |
| 444 | 444 | ctx->next_va = NULL; | |
| 445 | 445 | } | |
| 446 | 446 | ||
modified drivers/gpu/drm/mediatek/mtk_drm_drv.c
| @@ -638,10 +638,8 @@ static int mtk_drm_bind(struct device *dev) | |||
| 638 | 638 | private->mtk_drm_bound = true; | |
| 639 | 639 | private->dev = dev; | |
| 640 | 640 | ||
| 641 | - | if (!mtk_drm_get_all_drm_priv(dev)) { | |
| 642 | - | put_device(private->mutex_dev); | |
| 641 | + | if (!mtk_drm_get_all_drm_priv(dev)) | |
| 643 | 642 | return 0; | |
| 644 | - | } | |
| 645 | 643 | ||
| 646 | 644 | drm = drm_dev_alloc(&mtk_drm_driver, dev); | |
| 647 | 645 | if (IS_ERR(drm)) { | |
| @@ -1062,7 +1060,7 @@ static int mtk_drm_probe(struct platform_device *pdev) | |||
| 1062 | 1060 | struct mtk_mmsys_driver_data *mtk_drm_data; | |
| 1063 | 1061 | struct device_node *node; | |
| 1064 | 1062 | struct component_match *match = NULL; | |
| 1065 | - | struct platform_device *ovl_adaptor = NULL; | |
| 1063 | + | struct platform_device *ovl_adaptor; | |
| 1066 | 1064 | int ret; | |
| 1067 | 1065 | int i; | |
| 1068 | 1066 | ||
| @@ -1114,9 +1112,6 @@ static int mtk_drm_probe(struct platform_device *pdev) | |||
| 1114 | 1112 | PLATFORM_DEVID_AUTO, | |
| 1115 | 1113 | (void *)private->mmsys_dev, | |
| 1116 | 1114 | sizeof(*private->mmsys_dev)); | |
| 1117 | - | if (IS_ERR(ovl_adaptor)) | |
| 1118 | - | return PTR_ERR(ovl_adaptor); | |
| 1119 | - | ||
| 1120 | 1115 | private->ddp_comp[DDP_COMPONENT_DRM_OVL_ADAPTOR].dev = &ovl_adaptor->dev; | |
| 1121 | 1116 | mtk_ddp_comp_init(dev, NULL, &private->ddp_comp[DDP_COMPONENT_DRM_OVL_ADAPTOR], | |
| 1122 | 1117 | DDP_COMPONENT_DRM_OVL_ADAPTOR); | |
| @@ -1210,8 +1205,6 @@ static int mtk_drm_probe(struct platform_device *pdev) | |||
| 1210 | 1205 | err_pm: | |
| 1211 | 1206 | pm_runtime_disable(dev); | |
| 1212 | 1207 | err_node: | |
| 1213 | - | if (ovl_adaptor) | |
| 1214 | - | platform_device_unregister(ovl_adaptor); | |
| 1215 | 1208 | of_node_put(private->mutex_node); | |
| 1216 | 1209 | for (i = 0; i < DDP_COMPONENT_DRM_ID_MAX; i++) | |
| 1217 | 1210 | of_node_put(private->comp_node[i]); | |
| @@ -1221,15 +1214,9 @@ err_node: | |||
| 1221 | 1214 | static void mtk_drm_remove(struct platform_device *pdev) | |
| 1222 | 1215 | { | |
| 1223 | 1216 | struct mtk_drm_private *private = platform_get_drvdata(pdev); | |
| 1224 | - | struct device *ovl_adaptor_dev; | |
| 1225 | 1217 | int i; | |
| 1226 | 1218 | ||
| 1227 | - | ovl_adaptor_dev = | |
| 1228 | - | private->ddp_comp[DDP_COMPONENT_DRM_OVL_ADAPTOR].dev; | |
| 1229 | - | ||
| 1230 | 1219 | component_master_del(&pdev->dev, &mtk_drm_ops); | |
| 1231 | - | if (ovl_adaptor_dev) | |
| 1232 | - | platform_device_unregister(to_platform_device(ovl_adaptor_dev)); | |
| 1233 | 1220 | pm_runtime_disable(&pdev->dev); | |
| 1234 | 1221 | of_node_put(private->mutex_node); | |
| 1235 | 1222 | for (i = 0; i < DDP_COMPONENT_DRM_ID_MAX; i++) | |
modified drivers/gpu/drm/mediatek/mtk_hdmi_ddc_v2.c
| @@ -376,10 +376,8 @@ static int mtk_hdmi_ddc_v2_probe(struct platform_device *pdev) | |||
| 376 | 376 | pm_runtime_get_sync(dev); | |
| 377 | 377 | ||
| 378 | 378 | ret = devm_i2c_add_adapter(dev, &ddc->adap); | |
| 379 | - | if (ret < 0) { | |
| 380 | - | pm_runtime_put_noidle(dev); | |
| 379 | + | if (ret < 0) | |
| 381 | 380 | return dev_err_probe(dev, ret, "Cannot add DDC I2C adapter\n"); | |
| 382 | - | } | |
| 383 | 381 | ||
| 384 | 382 | platform_set_drvdata(pdev, ddc); | |
| 385 | 383 | return 0; | |
modified drivers/gpu/drm/mediatek/mtk_hdmi_regs_v2.h
| @@ -173,7 +173,7 @@ | |||
| 173 | 173 | #define TPI_AUDIO_LOOKUP_EN BIT(2) | |
| 174 | 174 | ||
| 175 | 175 | /* Video downsampling configuration */ | |
| 176 | - | #define VID_DOWNSAMPLE_CONFIG 0x8f0 | |
| 176 | + | #define VID_DOWNSAMPLE_CONFIG 0x8d0 | |
| 177 | 177 | #define C444_C422_CONFIG_ENABLE BIT(0) | |
| 178 | 178 | #define C422_C420_CONFIG_ENABLE BIT(4) | |
| 179 | 179 | #define C422_C420_CONFIG_BYPASS BIT(5) | |
modified drivers/gpu/drm/nouveau/nouveau_abi16.c
| @@ -488,7 +488,7 @@ nouveau_abi16_ioctl_channel_alloc(ABI16_IOCTL_ARGS) | |||
| 488 | 488 | goto done; | |
| 489 | 489 | break; | |
| 490 | 490 | case NV_DEVICE_INFO_V0_TURING: | |
| 491 | - | if (engine == NV_DEVICE_HOST_RUNLIST_ENGINES_GR) { | |
| 491 | + | if (engine != NV_DEVICE_HOST_RUNLIST_ENGINES_NVDEC) { | |
| 492 | 492 | ret = nvif_object_ctor(&chan->chan->user, "abi16CeWar", | |
| 493 | 493 | 0, TURING_DMA_COPY_A, NULL, 0, | |
| 494 | 494 | &chan->ce); | |
modified drivers/gpu/drm/nouveau/nvkm/engine/device/user.c
| @@ -201,7 +201,7 @@ nvkm_udevice_gcx_ready(struct nvkm_udevice *udev, void *data, u32 size) | |||
| 201 | 201 | } *args = data; | |
| 202 | 202 | int ret = -ENOSYS; | |
| 203 | 203 | ||
| 204 | - | if (!gsp || !gsp->rm) { | |
| 204 | + | if (!gsp) { | |
| 205 | 205 | args->v0.ready = NV_DEVICE_GC6_READY | NV_DEVICE_GCOFF_READY; | |
| 206 | 206 | return 0; | |
| 207 | 207 | } | |
modified drivers/gpu/drm/panthor/panthor_sched.c
| @@ -3674,9 +3674,6 @@ int panthor_group_create(struct panthor_file *pfile, | |||
| 3674 | 3674 | hweight64(group_args->tiler_core_mask) < group_args->max_tiler_cores) | |
| 3675 | 3675 | return -EINVAL; | |
| 3676 | 3676 | ||
| 3677 | - | if (group_args->queues.count > sched->cs_slot_count) | |
| 3678 | - | return -EINVAL; | |
| 3679 | - | ||
| 3680 | 3677 | group = kzalloc_obj(*group); | |
| 3681 | 3678 | if (!group) | |
| 3682 | 3679 | return -ENOMEM; | |
modified drivers/gpu/drm/radeon/radeon_bios.c
| @@ -49,7 +49,6 @@ | |||
| 49 | 49 | static bool igp_read_bios_from_vram(struct radeon_device *rdev) | |
| 50 | 50 | { | |
| 51 | 51 | uint8_t __iomem *bios; | |
| 52 | - | uint8_t val1, val2; | |
| 53 | 52 | resource_size_t vram_base; | |
| 54 | 53 | resource_size_t size = 256 * 1024; /* ??? */ | |
| 55 | 54 | ||
| @@ -64,10 +63,7 @@ static bool igp_read_bios_from_vram(struct radeon_device *rdev) | |||
| 64 | 63 | return false; | |
| 65 | 64 | } | |
| 66 | 65 | ||
| 67 | - | val1 = readb(&bios[0]); | |
| 68 | - | val2 = readb(&bios[1]); | |
| 69 | - | ||
| 70 | - | if (size == 0 || val1 != 0x55 || val2 != 0xaa) { | |
| 66 | + | if (size == 0 || bios[0] != 0x55 || bios[1] != 0xaa) { | |
| 71 | 67 | iounmap(bios); | |
| 72 | 68 | return false; | |
| 73 | 69 | } | |
modified drivers/gpu/drm/vc4/vc4_bo.c
| @@ -204,7 +204,7 @@ static struct list_head *vc4_get_cache_list_for_size(struct drm_device *dev, | |||
| 204 | 204 | struct list_head *new_list; | |
| 205 | 205 | uint32_t i; | |
| 206 | 206 | ||
| 207 | - | new_list = kvmalloc_objs(struct list_head, new_size); | |
| 207 | + | new_list = kmalloc_objs(struct list_head, new_size); | |
| 208 | 208 | if (!new_list) | |
| 209 | 209 | return NULL; | |
| 210 | 210 | ||
| @@ -224,7 +224,7 @@ static struct list_head *vc4_get_cache_list_for_size(struct drm_device *dev, | |||
| 224 | 224 | for (i = vc4->bo_cache.size_list_size; i < new_size; i++) | |
| 225 | 225 | INIT_LIST_HEAD(&new_list[i]); | |
| 226 | 226 | ||
| 227 | - | kvfree(vc4->bo_cache.size_list); | |
| 227 | + | kfree(vc4->bo_cache.size_list); | |
| 228 | 228 | vc4->bo_cache.size_list = new_list; | |
| 229 | 229 | vc4->bo_cache.size_list_size = new_size; | |
| 230 | 230 | } | |
| @@ -1052,7 +1052,6 @@ static void vc4_bo_cache_destroy(struct drm_device *dev, void *unused) | |||
| 1052 | 1052 | cancel_work_sync(&vc4->bo_cache.time_work); | |
| 1053 | 1053 | ||
| 1054 | 1054 | vc4_bo_cache_purge(dev); | |
| 1055 | - | kvfree(vc4->bo_cache.size_list); | |
| 1056 | 1055 | ||
| 1057 | 1056 | for (i = 0; i < vc4->num_labels; i++) { | |
| 1058 | 1057 | if (vc4->bo_labels[i].num_allocated) { | |
modified drivers/gpu/drm/vc4/vc4_drv.c
| @@ -360,11 +360,8 @@ static int vc4_drm_bind(struct device *dev) | |||
| 360 | 360 | } | |
| 361 | 361 | ||
| 362 | 362 | ret = aperture_remove_all_conflicting_devices(driver->name); | |
| 363 | - | if (ret) { | |
| 364 | - | if (firmware) | |
| 365 | - | rpi_firmware_put(firmware); | |
| 363 | + | if (ret) | |
| 366 | 364 | goto err; | |
| 367 | - | } | |
| 368 | 365 | ||
| 369 | 366 | if (firmware) { | |
| 370 | 367 | ret = rpi_firmware_property(firmware, | |
modified drivers/gpu/drm/vc4/vc4_drv.h
| @@ -1051,7 +1051,7 @@ void vc4_plane_async_set_fb(struct drm_plane *plane, | |||
| 1051 | 1051 | /* vc4_v3d.c */ | |
| 1052 | 1052 | extern struct platform_driver vc4_v3d_driver; | |
| 1053 | 1053 | extern const struct of_device_id vc4_v3d_dt_match[]; | |
| 1054 | - | int vc4_v3d_get_bin_slot(struct vc4_dev *vc4, long timeout); | |
| 1054 | + | int vc4_v3d_get_bin_slot(struct vc4_dev *vc4); | |
| 1055 | 1055 | int vc4_v3d_bin_bo_get(struct vc4_dev *vc4, bool *used); | |
| 1056 | 1056 | void vc4_v3d_bin_bo_put(struct vc4_dev *vc4); | |
| 1057 | 1057 | int vc4_v3d_pm_get(struct vc4_dev *vc4); | |
modified drivers/gpu/drm/vc4/vc4_gem.c
| @@ -877,17 +877,11 @@ vc4_complete_exec(struct drm_device *dev, struct vc4_exec_info *exec) | |||
| 877 | 877 | drm_gem_object_put(&bo->base.base); | |
| 878 | 878 | } | |
| 879 | 879 | ||
| 880 | - | /* Free up the allocation of any bin slots we used. Jobs that ran to | |
| 881 | - | * completion had their slots released in vc4_irq_finish_render_job(). | |
| 882 | - | * Only jobs that never completed still have slots to be released here. | |
| 883 | - | */ | |
| 880 | + | /* Free up the allocation of any bin slots we used. */ | |
| 884 | 881 | spin_lock_irqsave(&vc4->job_lock, irqflags); | |
| 885 | 882 | vc4->bin_alloc_used &= ~exec->bin_slots; | |
| 886 | 883 | spin_unlock_irqrestore(&vc4->job_lock, irqflags); | |
| 887 | 884 | ||
| 888 | - | /* Let anyone waiting on the binner pool retry. */ | |
| 889 | - | wake_up_all(&vc4->job_wait_queue); | |
| 890 | - | ||
| 891 | 885 | /* Release the reference on the binner BO if needed. */ | |
| 892 | 886 | if (exec->bin_bo_used) | |
| 893 | 887 | vc4_v3d_bin_bo_put(vc4); | |
modified drivers/gpu/drm/vc4/vc4_irq.c
| @@ -74,7 +74,7 @@ vc4_overflow_mem_work(struct work_struct *work) | |||
| 74 | 74 | ||
| 75 | 75 | bo = vc4->bin_bo; | |
| 76 | 76 | ||
| 77 | - | bin_bo_slot = vc4_v3d_get_bin_slot(vc4, msecs_to_jiffies(500)); | |
| 77 | + | bin_bo_slot = vc4_v3d_get_bin_slot(vc4); | |
| 78 | 78 | if (bin_bo_slot < 0) { | |
| 79 | 79 | drm_err(&vc4->base, "Couldn't allocate binner overflow mem\n"); | |
| 80 | 80 | goto complete; | |
| @@ -165,10 +165,6 @@ vc4_irq_finish_render_job(struct drm_device *dev) | |||
| 165 | 165 | trace_vc4_rcl_end_irq(dev, exec->seqno); | |
| 166 | 166 | ||
| 167 | 167 | vc4->finished_seqno++; | |
| 168 | - | ||
| 169 | - | vc4->bin_alloc_used &= ~exec->bin_slots; | |
| 170 | - | exec->bin_slots = 0; | |
| 171 | - | ||
| 172 | 168 | list_move_tail(&exec->head, &vc4->job_done_list); | |
| 173 | 169 | ||
| 174 | 170 | nextbin = vc4_first_bin_job(vc4); | |
| @@ -280,7 +276,7 @@ vc4_irq_disable(struct drm_device *dev) | |||
| 280 | 276 | V3D_WRITE(V3D_INTCTL, V3D_DRIVER_IRQS); | |
| 281 | 277 | ||
| 282 | 278 | /* Finish any interrupt handler still in flight. */ | |
| 283 | - | disable_irq(vc4->irq); | |
| 279 | + | synchronize_irq(vc4->irq); | |
| 284 | 280 | ||
| 285 | 281 | cancel_work_sync(&vc4->overflow_mem_work); | |
| 286 | 282 | } | |
| @@ -288,6 +284,7 @@ vc4_irq_disable(struct drm_device *dev) | |||
| 288 | 284 | int vc4_irq_install(struct drm_device *dev, int irq) | |
| 289 | 285 | { | |
| 290 | 286 | struct vc4_dev *vc4 = to_vc4_dev(dev); | |
| 287 | + | int ret; | |
| 291 | 288 | ||
| 292 | 289 | if (WARN_ON_ONCE(vc4->gen > VC4_GEN_4)) | |
| 293 | 290 | return -ENODEV; | |
| @@ -301,8 +298,19 @@ int vc4_irq_install(struct drm_device *dev, int irq) | |||
| 301 | 298 | init_waitqueue_head(&vc4->job_wait_queue); | |
| 302 | 299 | INIT_WORK(&vc4->overflow_mem_work, vc4_overflow_mem_work); | |
| 303 | 300 | ||
| 304 | - | return devm_request_irq(dev->dev, irq, vc4_irq, IRQF_NO_AUTOEN, | |
| 305 | - | dev_name(dev->dev), dev); | |
| 301 | + | /* Clear any pending interrupts someone might have left around | |
| 302 | + | * for us. | |
| 303 | + | */ | |
| 304 | + | V3D_WRITE(V3D_INTCTL, V3D_DRIVER_IRQS); | |
| 305 | + | ||
| 306 | + | ret = devm_request_irq(dev->dev, irq, vc4_irq, 0, | |
| 307 | + | dev_name(dev->dev), dev); | |
| 308 | + | if (ret) | |
| 309 | + | return ret; | |
| 310 | + | ||
| 311 | + | vc4_irq_enable(dev); | |
| 312 | + | ||
| 313 | + | return 0; | |
| 306 | 314 | } | |
| 307 | 315 | ||
| 308 | 316 | void vc4_irq_uninstall(struct drm_device *dev) | |
modified drivers/gpu/drm/vc4/vc4_v3d.c
| @@ -9,7 +9,6 @@ | |||
| 9 | 9 | #include <linux/component.h> | |
| 10 | 10 | #include <linux/platform_device.h> | |
| 11 | 11 | #include <linux/pm_runtime.h> | |
| 12 | - | #include <linux/timer.h> | |
| 13 | 12 | ||
| 14 | 13 | #include <drm/drm_print.h> | |
| 15 | 14 | ||
| @@ -173,42 +172,46 @@ static void vc4_v3d_init_hw(struct drm_device *dev) | |||
| 173 | 172 | V3D_WRITE(V3D_VPMBASE, 0); | |
| 174 | 173 | } | |
| 175 | 174 | ||
| 176 | - | static int bin_slot_try_alloc(struct vc4_dev *vc4) | |
| 175 | + | int vc4_v3d_get_bin_slot(struct vc4_dev *vc4) | |
| 177 | 176 | { | |
| 177 | + | struct drm_device *dev = &vc4->base; | |
| 178 | + | unsigned long irqflags; | |
| 178 | 179 | int slot; | |
| 180 | + | uint64_t seqno = 0; | |
| 181 | + | struct vc4_exec_info *exec; | |
| 179 | 182 | ||
| 180 | - | guard(spinlock_irqsave)(&vc4->job_lock); | |
| 183 | + | if (WARN_ON_ONCE(vc4->gen > VC4_GEN_4)) | |
| 184 | + | return -ENODEV; | |
| 181 | 185 | ||
| 186 | + | try_again: | |
| 187 | + | spin_lock_irqsave(&vc4->job_lock, irqflags); | |
| 182 | 188 | slot = ffs(~vc4->bin_alloc_used); | |
| 183 | 189 | if (slot != 0) { | |
| 184 | 190 | /* Switch from ffs() bit index to a 0-based index. */ | |
| 185 | 191 | slot--; | |
| 186 | 192 | vc4->bin_alloc_used |= BIT(slot); | |
| 187 | - | } else { | |
| 188 | - | slot = -ENOMEM; | |
| 193 | + | spin_unlock_irqrestore(&vc4->job_lock, irqflags); | |
| 194 | + | return slot; | |
| 189 | 195 | } | |
| 190 | 196 | ||
| 191 | - | return slot; | |
| 192 | - | } | |
| 197 | + | /* Couldn't find an open slot. Wait for render to complete | |
| 198 | + | * and try again. | |
| 199 | + | */ | |
| 200 | + | exec = vc4_last_render_job(vc4); | |
| 201 | + | if (exec) | |
| 202 | + | seqno = exec->seqno; | |
| 203 | + | spin_unlock_irqrestore(&vc4->job_lock, irqflags); | |
| 193 | 204 | ||
| 194 | - | int vc4_v3d_get_bin_slot(struct vc4_dev *vc4, long timeout) | |
| 195 | - | { | |
| 196 | - | int slot; | |
| 197 | - | long ret; | |
| 205 | + | if (seqno) { | |
| 206 | + | int ret = vc4_wait_for_seqno(dev, seqno, ~0ull, true); | |
| 198 | 207 | ||
| 199 | - | if (WARN_ON_ONCE(vc4->gen > VC4_GEN_4)) | |
| 200 | - | return -ENODEV; | |
| 208 | + | if (ret == 0) | |
| 209 | + | goto try_again; | |
| 201 | 210 | ||
| 202 | - | /* If the pool is full, wait for a job to release its slots. */ | |
| 203 | - | ret = wait_event_interruptible_timeout(vc4->job_wait_queue, | |
| 204 | - | (slot = bin_slot_try_alloc(vc4)) >= 0, | |
| 205 | - | timeout); | |
| 206 | - | if (ret < 0) | |
| 207 | 211 | return ret; | |
| 208 | - | if (ret == 0) | |
| 209 | - | return -ENOMEM; | |
| 212 | + | } | |
| 210 | 213 | ||
| 211 | - | return slot; | |
| 214 | + | return -ENOMEM; | |
| 212 | 215 | } | |
| 213 | 216 | ||
| 214 | 217 | /* | |
| @@ -393,7 +396,6 @@ static int vc4_v3d_runtime_resume(struct device *dev) | |||
| 393 | 396 | vc4_v3d_init_hw(&vc4->base); | |
| 394 | 397 | ||
| 395 | 398 | vc4_irq_enable(&vc4->base); | |
| 396 | - | enable_irq(vc4->irq); | |
| 397 | 399 | ||
| 398 | 400 | return 0; | |
| 399 | 401 | } | |
| @@ -450,12 +452,6 @@ static int vc4_v3d_bind(struct device *dev, struct device *master, void *data) | |||
| 450 | 452 | return ret; | |
| 451 | 453 | vc4->irq = ret; | |
| 452 | 454 | ||
| 453 | - | ret = vc4_irq_install(drm, vc4->irq); | |
| 454 | - | if (ret) { | |
| 455 | - | drm_err(drm, "Failed to install IRQ handler\n"); | |
| 456 | - | return ret; | |
| 457 | - | } | |
| 458 | - | ||
| 459 | 455 | ret = devm_pm_runtime_enable(dev); | |
| 460 | 456 | if (ret) | |
| 461 | 457 | return ret; | |
| @@ -477,6 +473,12 @@ static int vc4_v3d_bind(struct device *dev, struct device *master, void *data) | |||
| 477 | 473 | V3D_WRITE(V3D_BPOA, 0); | |
| 478 | 474 | V3D_WRITE(V3D_BPOS, 0); | |
| 479 | 475 | ||
| 476 | + | ret = vc4_irq_install(drm, vc4->irq); | |
| 477 | + | if (ret) { | |
| 478 | + | drm_err(drm, "Failed to install IRQ handler\n"); | |
| 479 | + | goto err_put_runtime_pm; | |
| 480 | + | } | |
| 481 | + | ||
| 480 | 482 | pm_runtime_use_autosuspend(dev); | |
| 481 | 483 | pm_runtime_set_autosuspend_delay(dev, 40); /* a little over 2 frames. */ | |
| 482 | 484 | pm_runtime_put_autosuspend(dev); | |
| @@ -495,15 +497,8 @@ static void vc4_v3d_unbind(struct device *dev, struct device *master, | |||
| 495 | 497 | struct drm_device *drm = data; | |
| 496 | 498 | struct vc4_dev *vc4 = to_vc4_dev(drm); | |
| 497 | 499 | ||
| 498 | - | /* A straggler vc4_reset() re-enables the interrupt. */ | |
| 499 | - | timer_shutdown_sync(&vc4->hangcheck.timer); | |
| 500 | - | cancel_work_sync(&vc4->hangcheck.reset_work); | |
| 501 | - | ||
| 502 | 500 | vc4_irq_uninstall(drm); | |
| 503 | 501 | ||
| 504 | - | /* Flush rather than cancel, so queued completions release their jobs. */ | |
| 505 | - | flush_work(&vc4->job_done_work); | |
| 506 | - | ||
| 507 | 502 | /* Disable the binner's overflow memory address, so the next | |
| 508 | 503 | * driver probe (if any) doesn't try to reuse our old | |
| 509 | 504 | * allocation. | |
modified drivers/gpu/drm/vc4/vc4_validate.c
| @@ -402,7 +402,7 @@ validate_tile_binning_config(VALIDATE_ARGS) | |||
| 402 | 402 | return -EINVAL; | |
| 403 | 403 | } | |
| 404 | 404 | ||
| 405 | - | bin_slot = vc4_v3d_get_bin_slot(vc4, MAX_SCHEDULE_TIMEOUT); | |
| 405 | + | bin_slot = vc4_v3d_get_bin_slot(vc4); | |
| 406 | 406 | if (bin_slot < 0) { | |
| 407 | 407 | if (bin_slot != -EINTR && bin_slot != -ERESTARTSYS) { | |
| 408 | 408 | drm_err(dev, "Failed to allocate binner memory: %d\n", | |
modified drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c
| @@ -324,7 +324,6 @@ void vmw_kms_cursor_snoop(struct vmw_surface *srf, | |||
| 324 | 324 | unsigned long kmap_num; | |
| 325 | 325 | SVGA3dCopyBox *box; | |
| 326 | 326 | u32 box_count; | |
| 327 | - | u64 src_extent; | |
| 328 | 327 | void *virtual; | |
| 329 | 328 | bool is_iomem; | |
| 330 | 329 | struct vmw_dma_cmd { | |
| @@ -336,8 +335,6 @@ void vmw_kms_cursor_snoop(struct vmw_surface *srf, | |||
| 336 | 335 | vmw_surface_get_desc(VMW_CURSOR_SNOOP_FORMAT); | |
| 337 | 336 | const u32 image_pitch = VMW_CURSOR_SNOOP_WIDTH * desc->pitchBytesPerBlock; | |
| 338 | 337 | ||
| 339 | - | BUILD_BUG_ON(sizeof(*srf->snooper.image) != desc->pitchBytesPerBlock); | |
| 340 | - | ||
| 341 | 338 | cmd = container_of(header, struct vmw_dma_cmd, header); | |
| 342 | 339 | ||
| 343 | 340 | /* No snooper installed, nothing to copy */ | |
| @@ -375,19 +372,8 @@ void vmw_kms_cursor_snoop(struct vmw_surface *srf, | |||
| 375 | 372 | return; | |
| 376 | 373 | } | |
| 377 | 374 | ||
| 378 | - | if (box->w == 0 || box->h == 0) | |
| 379 | - | return; | |
| 380 | - | ||
| 381 | - | src_extent = (u64)(box->h - 1) * cmd->dma.guest.pitch + | |
| 382 | - | (u64)box->w * desc->pitchBytesPerBlock; | |
| 383 | - | if (src_extent > bo->base.size) { | |
| 384 | - | DRM_ERROR("Cursor snoop source of %llu bytes exceeds the %zu byte buffer\n", | |
| 385 | - | src_extent, bo->base.size); | |
| 386 | - | return; | |
| 387 | - | } | |
| 388 | - | ||
| 389 | 375 | kmap_offset = cmd->dma.guest.ptr.offset >> PAGE_SHIFT; | |
| 390 | - | kmap_num = PFN_UP(src_extent); | |
| 376 | + | kmap_num = (VMW_CURSOR_SNOOP_HEIGHT * image_pitch) >> PAGE_SHIFT; | |
| 391 | 377 | ||
| 392 | 378 | ret = ttm_bo_reserve(bo, true, false, NULL); | |
| 393 | 379 | if (unlikely(ret != 0)) { | |
| @@ -401,16 +387,14 @@ void vmw_kms_cursor_snoop(struct vmw_surface *srf, | |||
| 401 | 387 | ||
| 402 | 388 | virtual = ttm_kmap_obj_virtual(&map, &is_iomem); | |
| 403 | 389 | ||
| 404 | - | if (box->w == VMW_CURSOR_SNOOP_WIDTH && | |
| 405 | - | box->h == VMW_CURSOR_SNOOP_HEIGHT && | |
| 406 | - | cmd->dma.guest.pitch == image_pitch) { | |
| 390 | + | if (box->w == VMW_CURSOR_SNOOP_WIDTH && cmd->dma.guest.pitch == image_pitch) { | |
| 407 | 391 | memcpy(srf->snooper.image, virtual, | |
| 408 | 392 | VMW_CURSOR_SNOOP_HEIGHT * image_pitch); | |
| 409 | 393 | } else { | |
| 410 | - | /* The destination stride is in pixels. */ | |
| 394 | + | /* Image is unsigned pointer. */ | |
| 411 | 395 | for (i = 0; i < box->h; i++) | |
| 412 | - | memcpy(srf->snooper.image + i * VMW_CURSOR_SNOOP_WIDTH, | |
| 413 | - | virtual + (size_t)i * cmd->dma.guest.pitch, | |
| 396 | + | memcpy(srf->snooper.image + i * image_pitch, | |
| 397 | + | virtual + i * cmd->dma.guest.pitch, | |
| 414 | 398 | box->w * desc->pitchBytesPerBlock); | |
| 415 | 399 | } | |
| 416 | 400 | srf->snooper.id++; | |
modified drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
| @@ -20,18 +20,10 @@ | |||
| 20 | 20 | #include <drm/drm_rect.h> | |
| 21 | 21 | #include <drm/drm_sysfs.h> | |
| 22 | 22 | #include <drm/drm_edid.h> | |
| 23 | - | #include <drm/drm_blend.h> | |
| 24 | 23 | ||
| 25 | 24 | void vmw_du_init(struct vmw_display_unit *du) | |
| 26 | 25 | { | |
| 27 | 26 | vmw_vkms_crtc_init(&du->crtc); | |
| 28 | - | drm_plane_create_blend_mode_property(&du->primary, | |
| 29 | - | BIT(DRM_MODE_BLEND_PIXEL_NONE) | | |
| 30 | - | BIT(DRM_MODE_BLEND_PREMULTI)); | |
| 31 | - | // Check that the cursor plane was actually initialized | |
| 32 | - | if (du->crtc.cursor == &du->cursor.base) | |
| 33 | - | drm_plane_create_blend_mode_property(&du->cursor.base, | |
| 34 | - | BIT(DRM_MODE_BLEND_PREMULTI)); | |
| 35 | 27 | } | |
| 36 | 28 | ||
| 37 | 29 | void vmw_du_cleanup(struct vmw_display_unit *du) | |
modified drivers/gpu/drm/xe/display/xe_fb_pin.c
| @@ -356,7 +356,7 @@ static struct i915_vma *__xe_pin_fb_vma(struct drm_gem_object *obj, bool is_dpt, | |||
| 356 | 356 | drm_exec_retry_on_contention(&exec); | |
| 357 | 357 | xe_validation_retry_on_oom(&ctx, &ret); | |
| 358 | 358 | if (!ret) | |
| 359 | - | xe_bo_pin_account(bo); | |
| 359 | + | ttm_bo_pin(&bo->ttm); | |
| 360 | 360 | } | |
| 361 | 361 | if (ret) | |
| 362 | 362 | goto err; | |
| @@ -373,7 +373,7 @@ static struct i915_vma *__xe_pin_fb_vma(struct drm_gem_object *obj, bool is_dpt, | |||
| 373 | 373 | ||
| 374 | 374 | err_unpin: | |
| 375 | 375 | ttm_bo_reserve(&bo->ttm, false, false, NULL); | |
| 376 | - | xe_bo_unpin_account(bo); | |
| 376 | + | ttm_bo_unpin(&bo->ttm); | |
| 377 | 377 | ttm_bo_unreserve(&bo->ttm); | |
| 378 | 378 | err: | |
| 379 | 379 | kfree(vma); | |
| @@ -393,7 +393,7 @@ static void __xe_unpin_fb_vma(struct i915_vma *vma) | |||
| 393 | 393 | xe_ggtt_node_remove(vma->node, false); | |
| 394 | 394 | ||
| 395 | 395 | ttm_bo_reserve(&vma->bo->ttm, false, false, NULL); | |
| 396 | - | xe_bo_unpin_account(vma->bo); | |
| 396 | + | ttm_bo_unpin(&vma->bo->ttm); | |
| 397 | 397 | ttm_bo_unreserve(&vma->bo->ttm); | |
| 398 | 398 | kfree(vma); | |
| 399 | 399 | } | |
modified drivers/gpu/drm/xe/xe_bo.c
| @@ -455,100 +455,6 @@ static void xe_ttm_tt_account_subtract(struct xe_device *xe, struct ttm_tt *tt) | |||
| 455 | 455 | xe_shrinker_mod_pages(xe->mem.shrinker, -(long)tt->num_pages, 0); | |
| 456 | 456 | } | |
| 457 | 457 | ||
| 458 | - | static bool xe_ttm_bo_is_imported(struct ttm_buffer_object *tbo) | |
| 459 | - | { | |
| 460 | - | dma_resv_assert_held(tbo->base.resv); | |
| 461 | - | ||
| 462 | - | return tbo->ttm && | |
| 463 | - | (tbo->ttm->page_flags & (TTM_TT_FLAG_EXTERNAL | TTM_TT_FLAG_EXTERNAL_MAPPABLE)) == | |
| 464 | - | TTM_TT_FLAG_EXTERNAL; | |
| 465 | - | } | |
| 466 | - | ||
| 467 | - | /* | |
| 468 | - | * Account @bo's pages as pinned for the shrinker. Removes @bo's pages | |
| 469 | - | * from the shrinker's shrinkable / purgeable counts on the transition | |
| 470 | - | * from unpinned to pinned. Must be called with @bo's dma-resv held, | |
| 471 | - | * after &ttm_buffer_object.pin_count has been incremented by | |
| 472 | - | * ttm_bo_pin(). Safe to call unconditionally regardless of which pin | |
| 473 | - | * path (kernel, external, framebuffer, backup object, ...) is pinning | |
| 474 | - | * @bo, since it only acts on the true 0->1 pin_count transition. | |
| 475 | - | * | |
| 476 | - | * Imported bos (xe_ttm_bo_is_imported()) are excluded: for those, | |
| 477 | - | * xe_ttm_tt_populate() never actually populates the tt or calls | |
| 478 | - | * xe_ttm_tt_account_add(), but TTM core's ttm_tt_populate() still | |
| 479 | - | * unconditionally marks the tt as populated on driver-hook success. | |
| 480 | - | * Relying on ttm_tt_is_populated() for these would subtract pages that | |
| 481 | - | * were never added, underflowing the shrinker's counts. | |
| 482 | - | */ | |
| 483 | - | static void xe_bo_account_pin(struct xe_bo *bo) | |
| 484 | - | { | |
| 485 | - | struct xe_device *xe = xe_bo_device(bo); | |
| 486 | - | ||
| 487 | - | if (bo->ttm.pin_count == 1 && bo->ttm.ttm && ttm_tt_is_populated(bo->ttm.ttm) && | |
| 488 | - | !xe_ttm_bo_is_imported(&bo->ttm)) | |
| 489 | - | xe_ttm_tt_account_subtract(xe, bo->ttm.ttm); | |
| 490 | - | } | |
| 491 | - | ||
| 492 | - | /* | |
| 493 | - | * Counterpart to xe_bo_account_pin(). Must be called with @bo's dma-resv | |
| 494 | - | * held, before &ttm_buffer_object.pin_count is decremented by | |
| 495 | - | * ttm_bo_unpin(), so that the check against the true 1->0 transition sees | |
| 496 | - | * the pin count that is about to be released. See xe_bo_account_pin() for | |
| 497 | - | * why imported bos are excluded. | |
| 498 | - | * | |
| 499 | - | * On the true last unpin, also removes @bo from whichever pinned-bo list | |
| 500 | - | * (external or kernel_bo_present) it may currently be linked on, since a | |
| 501 | - | * bo's final unpin can happen through a pin path (e.g. framebuffer, | |
| 502 | - | * backup object) that has no notion of, or ownership over, that list. | |
| 503 | - | * This is safe and list-agnostic: list_del_init() only needs the node | |
| 504 | - | * itself, not knowledge of which list it is threaded through, and is a | |
| 505 | - | * no-op if @bo is not linked. | |
| 506 | - | */ | |
| 507 | - | static void xe_bo_account_unpin(struct xe_bo *bo) | |
| 508 | - | { | |
| 509 | - | struct xe_device *xe = xe_bo_device(bo); | |
| 510 | - | bool last_unpin = bo->ttm.pin_count == 1; | |
| 511 | - | ||
| 512 | - | if (last_unpin && !list_empty(&bo->pinned_link)) { | |
| 513 | - | spin_lock(&xe->pinned.lock); | |
| 514 | - | list_del_init(&bo->pinned_link); | |
| 515 | - | spin_unlock(&xe->pinned.lock); | |
| 516 | - | } | |
| 517 | - | ||
| 518 | - | if (last_unpin && bo->ttm.ttm && ttm_tt_is_populated(bo->ttm.ttm) && | |
| 519 | - | !xe_ttm_bo_is_imported(&bo->ttm)) | |
| 520 | - | xe_ttm_tt_account_add(xe, bo->ttm.ttm); | |
| 521 | - | } | |
| 522 | - | ||
| 523 | - | /** | |
| 524 | - | * xe_bo_pin_account() - Pin a bo and account its pages for the shrinker | |
| 525 | - | * @bo: The buffer object to pin. | |
| 526 | - | * | |
| 527 | - | * Pins @bo via ttm_bo_pin() and updates the shrinker's shrinkable / | |
| 528 | - | * purgeable page accounting to match. Must be called with @bo's dma-resv | |
| 529 | - | * held. Safe to call regardless of which pin path (kernel, external, | |
| 530 | - | * framebuffer, backup object, ...) is pinning @bo. | |
| 531 | - | */ | |
| 532 | - | void xe_bo_pin_account(struct xe_bo *bo) | |
| 533 | - | { | |
| 534 | - | ttm_bo_pin(&bo->ttm); | |
| 535 | - | xe_bo_account_pin(bo); | |
| 536 | - | } | |
| 537 | - | ||
| 538 | - | /** | |
| 539 | - | * xe_bo_unpin_account() - Unpin a bo and account its pages for the shrinker | |
| 540 | - | * @bo: The buffer object to unpin. | |
| 541 | - | * | |
| 542 | - | * Counterpart to xe_bo_pin_account(). Updates the shrinker's shrinkable / | |
| 543 | - | * purgeable page accounting to match, then unpins @bo via ttm_bo_unpin(). | |
| 544 | - | * Must be called with @bo's dma-resv held. | |
| 545 | - | */ | |
| 546 | - | void xe_bo_unpin_account(struct xe_bo *bo) | |
| 547 | - | { | |
| 548 | - | xe_bo_account_unpin(bo); | |
| 549 | - | ttm_bo_unpin(&bo->ttm); | |
| 550 | - | } | |
| 551 | - | ||
| 552 | 458 | static void update_global_total_pages(struct ttm_device *ttm_dev, | |
| 553 | 459 | long num_pages) | |
| 554 | 460 | { | |
| @@ -1483,8 +1389,7 @@ int xe_bo_notifier_prepare_pinned(struct xe_bo *bo) | |||
| 1483 | 1389 | } | |
| 1484 | 1390 | ||
| 1485 | 1391 | backup->parent_obj = xe_bo_get(bo); /* Released by bo_destroy */ | |
| 1486 | - | /* Note: XE_BO_FLAG_SYSTEM resolves to XE_PL_TT so already populated. */ | |
| 1487 | - | xe_bo_pin_account(backup); | |
| 1392 | + | ttm_bo_pin(&backup->ttm); | |
| 1488 | 1393 | bo->backup_obj = backup; | |
| 1489 | 1394 | } | |
| 1490 | 1395 | ||
| @@ -1504,7 +1409,7 @@ int xe_bo_notifier_unprepare_pinned(struct xe_bo *bo) | |||
| 1504 | 1409 | { | |
| 1505 | 1410 | xe_bo_lock(bo, false); | |
| 1506 | 1411 | if (bo->backup_obj) { | |
| 1507 | - | xe_bo_unpin_account(bo->backup_obj); | |
| 1412 | + | ttm_bo_unpin(&bo->backup_obj->ttm); | |
| 1508 | 1413 | xe_bo_put(bo->backup_obj); | |
| 1509 | 1414 | bo->backup_obj = NULL; | |
| 1510 | 1415 | } | |
| @@ -1715,7 +1620,7 @@ out_backup: | |||
| 1715 | 1620 | xe_bo_vunmap(backup); | |
| 1716 | 1621 | if (!bo->backup_obj) { | |
| 1717 | 1622 | if (xe_bo_is_pinned(backup)) | |
| 1718 | - | xe_bo_unpin_account(backup); | |
| 1623 | + | ttm_bo_unpin(&backup->ttm); | |
| 1719 | 1624 | xe_bo_put(backup); | |
| 1720 | 1625 | } | |
| 1721 | 1626 | out_unlock_bo: | |
| @@ -2107,6 +2012,15 @@ static vm_fault_t xe_err_to_fault_t(int err) | |||
| 2107 | 2012 | return VM_FAULT_SIGBUS; | |
| 2108 | 2013 | } | |
| 2109 | 2014 | ||
| 2015 | + | static bool xe_ttm_bo_is_imported(struct ttm_buffer_object *tbo) | |
| 2016 | + | { | |
| 2017 | + | dma_resv_assert_held(tbo->base.resv); | |
| 2018 | + | ||
| 2019 | + | return tbo->ttm && | |
| 2020 | + | (tbo->ttm->page_flags & (TTM_TT_FLAG_EXTERNAL | TTM_TT_FLAG_EXTERNAL_MAPPABLE)) == | |
| 2021 | + | TTM_TT_FLAG_EXTERNAL; | |
| 2022 | + | } | |
| 2023 | + | ||
| 2110 | 2024 | static vm_fault_t xe_bo_cpu_fault_fastpath(struct vm_fault *vmf, struct xe_device *xe, | |
| 2111 | 2025 | struct xe_bo *bo, bool needs_rpm) | |
| 2112 | 2026 | { | |
| @@ -3227,13 +3141,12 @@ uint64_t vram_region_gpu_offset(struct ttm_resource *res) | |||
| 3227 | 3141 | int xe_bo_pin_external(struct xe_bo *bo, bool in_place, struct drm_exec *exec) | |
| 3228 | 3142 | { | |
| 3229 | 3143 | struct xe_device *xe = xe_bo_device(bo); | |
| 3230 | - | bool first_pin = !xe_bo_is_pinned(bo); | |
| 3231 | 3144 | int err; | |
| 3232 | 3145 | ||
| 3233 | 3146 | xe_assert(xe, !bo->vm); | |
| 3234 | 3147 | xe_assert(xe, xe_bo_is_user(bo)); | |
| 3235 | 3148 | ||
| 3236 | - | if (first_pin) { | |
| 3149 | + | if (!xe_bo_is_pinned(bo)) { | |
| 3237 | 3150 | if (!in_place) { | |
| 3238 | 3151 | err = xe_bo_validate(bo, NULL, false, exec); | |
| 3239 | 3152 | if (err) | |
| @@ -3245,7 +3158,9 @@ int xe_bo_pin_external(struct xe_bo *bo, bool in_place, struct drm_exec *exec) | |||
| 3245 | 3158 | spin_unlock(&xe->pinned.lock); | |
| 3246 | 3159 | } | |
| 3247 | 3160 | ||
| 3248 | - | xe_bo_pin_account(bo); | |
| 3161 | + | ttm_bo_pin(&bo->ttm); | |
| 3162 | + | if (bo->ttm.ttm && ttm_tt_is_populated(bo->ttm.ttm)) | |
| 3163 | + | xe_ttm_tt_account_subtract(xe, bo->ttm.ttm); | |
| 3249 | 3164 | ||
| 3250 | 3165 | /* | |
| 3251 | 3166 | * FIXME: If we always use the reserve / unreserve functions for locking | |
| @@ -3301,7 +3216,9 @@ int xe_bo_pin(struct xe_bo *bo, struct drm_exec *exec) | |||
| 3301 | 3216 | spin_unlock(&xe->pinned.lock); | |
| 3302 | 3217 | } | |
| 3303 | 3218 | ||
| 3304 | - | xe_bo_pin_account(bo); | |
| 3219 | + | ttm_bo_pin(&bo->ttm); | |
| 3220 | + | if (bo->ttm.ttm && ttm_tt_is_populated(bo->ttm.ttm)) | |
| 3221 | + | xe_ttm_tt_account_subtract(xe, bo->ttm.ttm); | |
| 3305 | 3222 | ||
| 3306 | 3223 | /* | |
| 3307 | 3224 | * FIXME: If we always use the reserve / unreserve functions for locking | |
| @@ -3330,7 +3247,14 @@ void xe_bo_unpin_external(struct xe_bo *bo) | |||
| 3330 | 3247 | xe_assert(xe, xe_bo_is_pinned(bo)); | |
| 3331 | 3248 | xe_assert(xe, xe_bo_is_user(bo)); | |
| 3332 | 3249 | ||
| 3333 | - | xe_bo_unpin_account(bo); | |
| 3250 | + | spin_lock(&xe->pinned.lock); | |
| 3251 | + | if (bo->ttm.pin_count == 1 && !list_empty(&bo->pinned_link)) | |
| 3252 | + | list_del_init(&bo->pinned_link); | |
| 3253 | + | spin_unlock(&xe->pinned.lock); | |
| 3254 | + | ||
| 3255 | + | ttm_bo_unpin(&bo->ttm); | |
| 3256 | + | if (bo->ttm.ttm && ttm_tt_is_populated(bo->ttm.ttm)) | |
| 3257 | + | xe_ttm_tt_account_add(xe, bo->ttm.ttm); | |
| 3334 | 3258 | ||
| 3335 | 3259 | /* | |
| 3336 | 3260 | * FIXME: If we always use the reserve / unreserve functions for locking | |
| @@ -3348,16 +3272,21 @@ void xe_bo_unpin(struct xe_bo *bo) | |||
| 3348 | 3272 | xe_assert(xe, xe_bo_is_pinned(bo)); | |
| 3349 | 3273 | ||
| 3350 | 3274 | if (mem_type_is_vram(place->mem_type) || bo->flags & XE_BO_FLAG_GGTT) { | |
| 3275 | + | spin_lock(&xe->pinned.lock); | |
| 3351 | 3276 | xe_assert(xe, !list_empty(&bo->pinned_link)); | |
| 3277 | + | list_del_init(&bo->pinned_link); | |
| 3278 | + | spin_unlock(&xe->pinned.lock); | |
| 3352 | 3279 | ||
| 3353 | 3280 | if (bo->backup_obj) { | |
| 3354 | 3281 | if (xe_bo_is_pinned(bo->backup_obj)) | |
| 3355 | - | xe_bo_unpin_account(bo->backup_obj); | |
| 3282 | + | ttm_bo_unpin(&bo->backup_obj->ttm); | |
| 3356 | 3283 | xe_bo_put(bo->backup_obj); | |
| 3357 | 3284 | bo->backup_obj = NULL; | |
| 3358 | 3285 | } | |
| 3359 | 3286 | } | |
| 3360 | - | xe_bo_unpin_account(bo); | |
| 3287 | + | ttm_bo_unpin(&bo->ttm); | |
| 3288 | + | if (bo->ttm.ttm && ttm_tt_is_populated(bo->ttm.ttm)) | |
| 3289 | + | xe_ttm_tt_account_add(xe, bo->ttm.ttm); | |
| 3361 | 3290 | } | |
| 3362 | 3291 | ||
| 3363 | 3292 | /** | |
modified drivers/gpu/drm/xe/xe_bo.h
| @@ -229,8 +229,6 @@ int xe_bo_pin_external(struct xe_bo *bo, bool in_place, struct drm_exec *exec); | |||
| 229 | 229 | int xe_bo_pin(struct xe_bo *bo, struct drm_exec *exec); | |
| 230 | 230 | void xe_bo_unpin_external(struct xe_bo *bo); | |
| 231 | 231 | void xe_bo_unpin(struct xe_bo *bo); | |
| 232 | - | void xe_bo_pin_account(struct xe_bo *bo); | |
| 233 | - | void xe_bo_unpin_account(struct xe_bo *bo); | |
| 234 | 232 | int xe_bo_validate(struct xe_bo *bo, struct xe_vm *vm, bool allow_res_evict, | |
| 235 | 233 | struct drm_exec *exec); | |
| 236 | 234 | ||
modified drivers/gpu/drm/xe/xe_i2c.c
| @@ -324,15 +324,12 @@ static void xe_i2c_remove(void *data) | |||
| 324 | 324 | xe_i2c_irq_reset(xe); | |
| 325 | 325 | xe_amc_exit(i2c); | |
| 326 | 326 | ||
| 327 | - | /* Stop the notifier from arming the client work before teardown. */ | |
| 328 | - | bus_unregister_notifier(&i2c_bus_type, &i2c->bus_notifier); | |
| 329 | - | cancel_work_sync(&i2c->work); | |
| 330 | - | ||
| 331 | 327 | for (i = 0; i < XE_I2C_MAX_CLIENTS; i++) { | |
| 332 | 328 | i2c_unregister_device(i2c->client[i]); | |
| 333 | 329 | i2c->client[i] = NULL; | |
| 334 | 330 | } | |
| 335 | 331 | ||
| 332 | + | bus_unregister_notifier(&i2c_bus_type, &i2c->bus_notifier); | |
| 336 | 333 | xe_i2c_unregister_adapter(i2c); | |
| 337 | 334 | xe->i2c = NULL; | |
| 338 | 335 | } | |
modified drivers/gpu/drm/xe/xe_lrc.c
| @@ -1099,7 +1099,8 @@ static void xe_lrc_finish(struct xe_lrc *lrc) | |||
| 1099 | 1099 | #define CONTEXT_ACTIVE XE_LRC_CTX_TIMESTAMP_ACTIVE | |
| 1100 | 1100 | static ssize_t setup_utilization_wa(struct xe_lrc *lrc, | |
| 1101 | 1101 | struct xe_hw_engine *hwe, | |
| 1102 | - | u32 *batch, size_t max_len, bool indirect) | |
| 1102 | + | u32 *batch, | |
| 1103 | + | size_t max_len) | |
| 1103 | 1104 | { | |
| 1104 | 1105 | u32 *cmd = batch; | |
| 1105 | 1106 | ||
| @@ -1130,25 +1131,19 @@ static ssize_t setup_utilization_wa(struct xe_lrc *lrc, | |||
| 1130 | 1131 | } | |
| 1131 | 1132 | ||
| 1132 | 1133 | static ssize_t setup_timestamp_wa(struct xe_lrc *lrc, struct xe_hw_engine *hwe, | |
| 1133 | - | u32 *batch, size_t max_len, bool indirect) | |
| 1134 | + | u32 *batch, size_t max_len) | |
| 1134 | 1135 | { | |
| 1135 | 1136 | const u32 ts_addr = __xe_lrc_ctx_timestamp_ggtt_addr(lrc); | |
| 1136 | 1137 | u32 *cmd = batch; | |
| 1137 | 1138 | ||
| 1138 | - | if (!XE_GT_WA(lrc->gt, 16010904313)) | |
| 1139 | - | return 0; | |
| 1140 | - | ||
| 1141 | - | if (!indirect && | |
| 1142 | - | !(hwe->class == XE_ENGINE_CLASS_COPY || | |
| 1139 | + | if (!XE_GT_WA(lrc->gt, 16010904313) || | |
| 1140 | + | !(hwe->class == XE_ENGINE_CLASS_RENDER || | |
| 1141 | + | hwe->class == XE_ENGINE_CLASS_COMPUTE || | |
| 1142 | + | hwe->class == XE_ENGINE_CLASS_COPY || | |
| 1143 | 1143 | hwe->class == XE_ENGINE_CLASS_VIDEO_DECODE || | |
| 1144 | 1144 | hwe->class == XE_ENGINE_CLASS_VIDEO_ENHANCE)) | |
| 1145 | 1145 | return 0; | |
| 1146 | 1146 | ||
| 1147 | - | if (indirect && | |
| 1148 | - | !(hwe->class == XE_ENGINE_CLASS_RENDER || | |
| 1149 | - | hwe->class == XE_ENGINE_CLASS_COMPUTE)) | |
| 1150 | - | return 0; | |
| 1151 | - | ||
| 1152 | 1147 | if (xe_gt_WARN_ON(lrc->gt, max_len < 12)) | |
| 1153 | 1148 | return -ENOSPC; | |
| 1154 | 1149 | ||
| @@ -1174,8 +1169,7 @@ static ssize_t setup_timestamp_wa(struct xe_lrc *lrc, struct xe_hw_engine *hwe, | |||
| 1174 | 1169 | ||
| 1175 | 1170 | static ssize_t setup_configfs_post_ctx_restore_bb(struct xe_lrc *lrc, | |
| 1176 | 1171 | struct xe_hw_engine *hwe, | |
| 1177 | - | u32 *batch, size_t max_len, | |
| 1178 | - | bool indirect) | |
| 1172 | + | u32 *batch, size_t max_len) | |
| 1179 | 1173 | { | |
| 1180 | 1174 | struct xe_device *xe = gt_to_xe(lrc->gt); | |
| 1181 | 1175 | const u32 *user_batch; | |
| @@ -1204,8 +1198,7 @@ static ssize_t setup_configfs_post_ctx_restore_bb(struct xe_lrc *lrc, | |||
| 1204 | 1198 | ||
| 1205 | 1199 | static ssize_t setup_configfs_mid_ctx_restore_bb(struct xe_lrc *lrc, | |
| 1206 | 1200 | struct xe_hw_engine *hwe, | |
| 1207 | - | u32 *batch, size_t max_len, | |
| 1208 | - | bool indirect) | |
| 1201 | + | u32 *batch, size_t max_len) | |
| 1209 | 1202 | { | |
| 1210 | 1203 | struct xe_device *xe = gt_to_xe(lrc->gt); | |
| 1211 | 1204 | const u32 *user_batch; | |
| @@ -1234,8 +1227,7 @@ static ssize_t setup_configfs_mid_ctx_restore_bb(struct xe_lrc *lrc, | |||
| 1234 | 1227 | ||
| 1235 | 1228 | static ssize_t setup_invalidate_state_cache_wa(struct xe_lrc *lrc, | |
| 1236 | 1229 | struct xe_hw_engine *hwe, | |
| 1237 | - | u32 *batch, size_t max_len, | |
| 1238 | - | bool indirect) | |
| 1230 | + | u32 *batch, size_t max_len) | |
| 1239 | 1231 | { | |
| 1240 | 1232 | u32 *cmd = batch; | |
| 1241 | 1233 | ||
| @@ -1255,8 +1247,7 @@ static ssize_t setup_invalidate_state_cache_wa(struct xe_lrc *lrc, | |||
| 1255 | 1247 | ||
| 1256 | 1248 | static ssize_t setup_invalidate_auxccs_wa(struct xe_lrc *lrc, | |
| 1257 | 1249 | struct xe_hw_engine *hwe, | |
| 1258 | - | u32 *batch, size_t max_len, | |
| 1259 | - | bool indirect) | |
| 1250 | + | u32 *batch, size_t max_len) | |
| 1260 | 1251 | { | |
| 1261 | 1252 | struct xe_gt *gt = lrc->gt; | |
| 1262 | 1253 | u32 *(*emit)(struct xe_gt *gt, u32 *cmd) = | |
| @@ -1273,7 +1264,7 @@ static ssize_t setup_invalidate_auxccs_wa(struct xe_lrc *lrc, | |||
| 1273 | 1264 | ||
| 1274 | 1265 | struct bo_setup { | |
| 1275 | 1266 | ssize_t (*setup)(struct xe_lrc *lrc, struct xe_hw_engine *hwe, | |
| 1276 | - | u32 *batch, size_t max_size, bool indirect); | |
| 1267 | + | u32 *batch, size_t max_size); | |
| 1277 | 1268 | }; | |
| 1278 | 1269 | ||
| 1279 | 1270 | struct bo_setup_state { | |
| @@ -1282,7 +1273,6 @@ struct bo_setup_state { | |||
| 1282 | 1273 | struct xe_hw_engine *hwe; | |
| 1283 | 1274 | size_t max_size; | |
| 1284 | 1275 | size_t reserve_dw; | |
| 1285 | - | bool indirect; | |
| 1286 | 1276 | unsigned int offset; | |
| 1287 | 1277 | const struct bo_setup *funcs; | |
| 1288 | 1278 | unsigned int num_funcs; | |
| @@ -1308,8 +1298,7 @@ static int setup_bo(struct bo_setup_state *state) | |||
| 1308 | 1298 | ||
| 1309 | 1299 | for (size_t i = 0; i < state->num_funcs; i++) { | |
| 1310 | 1300 | ssize_t len = state->funcs[i].setup(state->lrc, state->hwe, | |
| 1311 | - | state->ptr, remain, | |
| 1312 | - | state->indirect); | |
| 1301 | + | state->ptr, remain); | |
| 1313 | 1302 | ||
| 1314 | 1303 | remain -= len; | |
| 1315 | 1304 | ||
| @@ -1415,7 +1404,6 @@ setup_indirect_ctx(struct xe_lrc *lrc, struct xe_hw_engine *hwe) | |||
| 1415 | 1404 | struct bo_setup_state state = { | |
| 1416 | 1405 | .lrc = lrc, | |
| 1417 | 1406 | .hwe = hwe, | |
| 1418 | - | .indirect = true, | |
| 1419 | 1407 | .max_size = (63 * 64) /* max 63 cachelines */, | |
| 1420 | 1408 | .buffer = NULL, | |
| 1421 | 1409 | .offset = __xe_lrc_indirect_ctx_offset(lrc), | |
modified drivers/gpu/drm/xe/xe_mmio.c
| @@ -320,7 +320,6 @@ u64 xe_mmio_read64_2x32(struct xe_mmio *mmio, struct xe_reg reg) | |||
| 320 | 320 | return (u64)udw << 32 | ldw; | |
| 321 | 321 | } | |
| 322 | 322 | ||
| 323 | - | #define __XE_MMIO_WAIT_MAX_BACKOFF_100MS (100 * USEC_PER_MSEC) | |
| 324 | 323 | static int __xe_mmio_wait32(struct xe_mmio *mmio, struct xe_reg reg, u32 mask, u32 val, | |
| 325 | 324 | u32 timeout_us, u32 *out_val, bool atomic, bool expect_match) | |
| 326 | 325 | { | |
| @@ -351,10 +350,10 @@ static int __xe_mmio_wait32(struct xe_mmio *mmio, struct xe_reg reg, u32 mask, u | |||
| 351 | 350 | wait = ktime_us_delta(end, cur); | |
| 352 | 351 | ||
| 353 | 352 | if (atomic) | |
| 354 | - | udelay(min_t(s64, wait, (MAX_UDELAY_MS * 1000))); | |
| 353 | + | udelay(wait); | |
| 355 | 354 | else | |
| 356 | 355 | usleep_range(wait, wait << 1); | |
| 357 | - | wait = min_t(s64, wait << 1, __XE_MMIO_WAIT_MAX_BACKOFF_100MS); | |
| 356 | + | wait <<= 1; | |
| 358 | 357 | } | |
| 359 | 358 | ||
| 360 | 359 | if (ret != 0) { | |
modified drivers/gpu/drm/xe/xe_pci_sriov.c
| @@ -82,33 +82,16 @@ static void pf_engine_activity_stats(struct xe_device *xe, unsigned int num_vfs, | |||
| 82 | 82 | } | |
| 83 | 83 | } | |
| 84 | 84 | ||
| 85 | - | static int pf_resize_vf_vram_bar(struct xe_device *xe, int num_vfs) | |
| 85 | + | static int resize_vf_vram_bar(struct xe_device *xe, int num_vfs) | |
| 86 | 86 | { | |
| 87 | 87 | struct pci_dev *pdev = to_pci_dev(xe->drm.dev); | |
| 88 | - | char buf[10]; | |
| 89 | 88 | u32 sizes; | |
| 90 | - | int size; | |
| 91 | - | int err; | |
| 92 | - | ||
| 93 | - | if (!IS_DGFX(xe)) | |
| 94 | - | return 0; | |
| 95 | 89 | ||
| 96 | 90 | sizes = pci_iov_vf_bar_get_sizes(pdev, VF_LMEM_BAR, num_vfs); | |
| 97 | 91 | if (!sizes) | |
| 98 | 92 | return 0; | |
| 99 | 93 | ||
| 100 | - | size = __fls(sizes); | |
| 101 | - | string_get_size(pci_rebar_size_to_bytes(size), 1, STRING_UNITS_2, buf, sizeof(buf)); | |
| 102 | - | ||
| 103 | - | err = pci_iov_vf_bar_set_size(pdev, VF_LMEM_BAR, size); | |
| 104 | - | if (err) { | |
| 105 | - | xe_sriov_notice(xe, "Failed to resize VF BAR %u to %s (%pe)\n", | |
| 106 | - | VF_LMEM_BAR, buf, ERR_PTR(err)); | |
| 107 | - | return err; | |
| 108 | - | } | |
| 109 | - | ||
| 110 | - | xe_sriov_dbg(xe, "VF LMEM BAR resized to %s\n", buf); | |
| 111 | - | return 0; | |
| 94 | + | return pci_iov_vf_bar_set_size(pdev, VF_LMEM_BAR, __fls(sizes)); | |
| 112 | 95 | } | |
| 113 | 96 | ||
| 114 | 97 | static int pf_prepare_vfs_enabling(struct xe_device *xe) | |
| @@ -159,7 +142,11 @@ static int pf_enable_vfs(struct xe_device *xe, int num_vfs) | |||
| 159 | 142 | if (err < 0) | |
| 160 | 143 | goto failed; | |
| 161 | 144 | ||
| 162 | - | pf_resize_vf_vram_bar(xe, num_vfs); | |
| 145 | + | if (IS_DGFX(xe)) { | |
| 146 | + | err = resize_vf_vram_bar(xe, num_vfs); | |
| 147 | + | if (err) | |
| 148 | + | xe_sriov_info(xe, "Failed to set VF LMEM BAR size: %d\n", err); | |
| 149 | + | } | |
| 163 | 150 | ||
| 164 | 151 | err = pci_enable_sriov(pdev, num_vfs); | |
| 165 | 152 | if (err < 0) | |
| @@ -177,7 +164,6 @@ static int pf_enable_vfs(struct xe_device *xe, int num_vfs) | |||
| 177 | 164 | return num_vfs; | |
| 178 | 165 | ||
| 179 | 166 | failed: | |
| 180 | - | pf_resize_vf_vram_bar(xe, xe->sriov.pf.device_total_vfs); | |
| 181 | 167 | xe_sriov_pf_unprovision_vfs(xe, num_vfs); | |
| 182 | 168 | xe_pm_runtime_put(xe); | |
| 183 | 169 | pf_finish_vfs_enabling(xe); | |
| @@ -205,8 +191,6 @@ static int pf_disable_vfs(struct xe_device *xe) | |||
| 205 | 191 | ||
| 206 | 192 | pci_disable_sriov(pdev); | |
| 207 | 193 | ||
| 208 | - | pf_resize_vf_vram_bar(xe, xe->sriov.pf.device_total_vfs); | |
| 209 | - | ||
| 210 | 194 | xe_sriov_pf_reprovision_default(xe); | |
| 211 | 195 | ||
| 212 | 196 | pf_reset_vfs(xe, num_vfs); | |
modified drivers/gpu/drm/xe/xe_sysctrl_mailbox.c
| @@ -19,20 +19,20 @@ | |||
| 19 | 19 | #include "xe_sysctrl_mailbox_types.h" | |
| 20 | 20 | ||
| 21 | 21 | struct xe_sysctrl_mailbox_msg_hdr { | |
| 22 | - | u32 data; | |
| 23 | - | }; | |
| 22 | + | __le32 data; | |
| 23 | + | } __packed; | |
| 24 | 24 | ||
| 25 | 25 | #define XE_SYSCTRL_HDR_GROUP_ID(hdr) \ | |
| 26 | - | FIELD_GET(SYSCTRL_HDR_GROUP_ID_MASK, (hdr)->data) | |
| 26 | + | FIELD_GET(SYSCTRL_HDR_GROUP_ID_MASK, le32_to_cpu((hdr)->data)) | |
| 27 | 27 | ||
| 28 | 28 | #define XE_SYSCTRL_HDR_COMMAND(hdr) \ | |
| 29 | - | FIELD_GET(SYSCTRL_HDR_COMMAND_MASK, (hdr)->data) | |
| 29 | + | FIELD_GET(SYSCTRL_HDR_COMMAND_MASK, le32_to_cpu((hdr)->data)) | |
| 30 | 30 | ||
| 31 | 31 | #define XE_SYSCTRL_HDR_IS_RESPONSE(hdr) \ | |
| 32 | - | FIELD_GET(SYSCTRL_HDR_IS_RESPONSE, (hdr)->data) | |
| 32 | + | FIELD_GET(SYSCTRL_HDR_IS_RESPONSE, le32_to_cpu((hdr)->data)) | |
| 33 | 33 | ||
| 34 | 34 | #define XE_SYSCTRL_HDR_RESULT(hdr) \ | |
| 35 | - | FIELD_GET(SYSCTRL_HDR_RESULT_MASK, (hdr)->data) | |
| 35 | + | FIELD_GET(SYSCTRL_HDR_RESULT_MASK, le32_to_cpu((hdr)->data)) | |
| 36 | 36 | ||
| 37 | 37 | static bool sysctrl_wait_bit_clear(struct xe_sysctrl *sc, u32 bit_mask, | |
| 38 | 38 | unsigned int timeout_ms) | |
| @@ -126,8 +126,8 @@ static int sysctrl_prepare_command(struct xe_device *xe, | |||
| 126 | 126 | return -ENOMEM; | |
| 127 | 127 | ||
| 128 | 128 | hdr = (struct xe_sysctrl_mailbox_msg_hdr *)buffer; | |
| 129 | - | hdr->data = FIELD_PREP(SYSCTRL_HDR_GROUP_ID_MASK, group_id) | | |
| 130 | - | FIELD_PREP(SYSCTRL_HDR_COMMAND_MASK, command); | |
| 129 | + | hdr->data = cpu_to_le32(FIELD_PREP(SYSCTRL_HDR_GROUP_ID_MASK, group_id) | | |
| 130 | + | FIELD_PREP(SYSCTRL_HDR_COMMAND_MASK, command)); | |
| 131 | 131 | ||
| 132 | 132 | if (data_in && data_in_len) | |
| 133 | 133 | memcpy(buffer + sizeof(*hdr), data_in, data_in_len); | |
modified drivers/hid/bpf/hid_bpf_dispatch.c
| @@ -453,7 +453,7 @@ hid_bpf_hw_request(struct hid_bpf_ctx *ctx, __u8 *buf, size_t buf__sz, | |||
| 453 | 453 | (u64)(long)ctx, | |
| 454 | 454 | true); /* prevent infinite recursions */ | |
| 455 | 455 | ||
| 456 | - | if (ret > (ssize_t)size) | |
| 456 | + | if (ret > size) | |
| 457 | 457 | ret = size; | |
| 458 | 458 | if (ret > 0) | |
| 459 | 459 | memcpy(buf, dma_data, ret); | |
modified drivers/hid/hid-ids.h
| @@ -1510,9 +1510,6 @@ | |||
| 1510 | 1510 | #define USB_DEVICE_ID_ASUS_MD_5110 0x5110 | |
| 1511 | 1511 | #define USB_DEVICE_ID_TURBOX_TOUCHSCREEN_MOSART 0x7100 | |
| 1512 | 1512 | ||
| 1513 | - | #define USB_VENDOR_ID_TURTLE_BEACH 0x10f5 | |
| 1514 | - | #define USB_DEVICE_ID_TB_VELOCITYONE_RACE 0x7077 | |
| 1515 | - | ||
| 1516 | 1513 | #define USB_VENDOR_ID_TWINHAN 0x6253 | |
| 1517 | 1514 | #define USB_DEVICE_ID_TWINHAN_IR_REMOTE 0x0100 | |
| 1518 | 1515 | ||
modified drivers/hid/hid-logitech-dj.c
| @@ -121,6 +121,7 @@ enum recvr_type { | |||
| 121 | 121 | recvr_type_27mhz, | |
| 122 | 122 | recvr_type_bluetooth, | |
| 123 | 123 | recvr_type_dinovo, | |
| 124 | + | recvr_type_bolt, | |
| 124 | 125 | }; | |
| 125 | 126 | ||
| 126 | 127 | struct dj_report { | |
| @@ -1156,6 +1157,10 @@ static void logi_hidpp_recv_queue_notif(struct hid_device *hdev, | |||
| 1156 | 1157 | logi_hidpp_dev_conn_notif_equad(hdev, hidpp_report, &workitem); | |
| 1157 | 1158 | workitem.reports_supported |= STD_KEYBOARD; | |
| 1158 | 1159 | break; | |
| 1160 | + | case 0x10: | |
| 1161 | + | device_type = "Bolt"; | |
| 1162 | + | logi_hidpp_dev_conn_notif_equad(hdev, hidpp_report, &workitem); | |
| 1163 | + | break; | |
| 1159 | 1164 | } | |
| 1160 | 1165 | ||
| 1161 | 1166 | /* custom receiver device (eg. powerplay) */ | |
| @@ -1745,6 +1750,24 @@ static int logi_dj_hidpp_event(struct hid_device *hdev, | |||
| 1745 | 1750 | ||
| 1746 | 1751 | dj_dev = djrcv_dev->paired_dj_devices[device_index]; | |
| 1747 | 1752 | ||
| 1753 | + | /* | |
| 1754 | + | * Bolt receivers send explicit unpair notifications as HID++ events; | |
| 1755 | + | * queue device removal when we receive one. | |
| 1756 | + | */ | |
| 1757 | + | if (djrcv_dev->type == recvr_type_bolt && | |
| 1758 | + | hidpp_report->report_id == REPORT_ID_HIDPP_SHORT && | |
| 1759 | + | hidpp_report->sub_id == REPORT_TYPE_NOTIF_DEVICE_UNPAIRED) { | |
| 1760 | + | struct dj_workitem workitem = { | |
| 1761 | + | .device_index = device_index, | |
| 1762 | + | .type = WORKITEM_TYPE_UNPAIRED, | |
| 1763 | + | }; | |
| 1764 | + | ||
| 1765 | + | kfifo_in(&djrcv_dev->notif_fifo, &workitem, sizeof(workitem)); | |
| 1766 | + | schedule_work(&djrcv_dev->work); | |
| 1767 | + | spin_unlock_irqrestore(&djrcv_dev->lock, flags); | |
| 1768 | + | return false; | |
| 1769 | + | } | |
| 1770 | + | ||
| 1748 | 1771 | /* | |
| 1749 | 1772 | * With 27 MHz receivers, we do not get an explicit unpair event, | |
| 1750 | 1773 | * remove the old device if the user has paired a *different* device. | |
| @@ -1884,6 +1907,9 @@ static int logi_dj_probe(struct hid_device *hdev, | |||
| 1884 | 1907 | * treat these as logitech-dj interfaces then this causes input events | |
| 1885 | 1908 | * reported through this extra interface to not be reported correctly. | |
| 1886 | 1909 | * To avoid this, we treat these as generic-hid devices. | |
| 1910 | + | * | |
| 1911 | + | * Bolt receivers only use LOGITECH_DJ_INTERFACE_NUMBER for receiver | |
| 1912 | + | * reporting. Treat all other Bolt interfaces as generic-hid devices. | |
| 1887 | 1913 | */ | |
| 1888 | 1914 | switch (id->driver_data) { | |
| 1889 | 1915 | case recvr_type_dj: no_dj_interfaces = 3; break; | |
| @@ -1897,10 +1923,20 @@ static int logi_dj_probe(struct hid_device *hdev, | |||
| 1897 | 1923 | } | |
| 1898 | 1924 | if (hid_is_usb(hdev)) { | |
| 1899 | 1925 | intf = to_usb_interface(hdev->dev.parent); | |
| 1900 | - | if (intf && intf->altsetting->desc.bInterfaceNumber >= | |
| 1901 | - | no_dj_interfaces) { | |
| 1902 | - | hdev->quirks |= HID_QUIRK_INPUT_PER_APP; | |
| 1903 | - | return hid_hw_start(hdev, HID_CONNECT_DEFAULT); | |
| 1926 | + | if (intf) { | |
| 1927 | + | bool generic_hid_interface; | |
| 1928 | + | ||
| 1929 | + | if (id->driver_data == recvr_type_bolt) | |
| 1930 | + | generic_hid_interface = | |
| 1931 | + | intf->altsetting->desc.bInterfaceNumber != | |
| 1932 | + | LOGITECH_DJ_INTERFACE_NUMBER; | |
| 1933 | + | else | |
| 1934 | + | generic_hid_interface = | |
| 1935 | + | intf->altsetting->desc.bInterfaceNumber >= no_dj_interfaces; | |
| 1936 | + | if (generic_hid_interface) { | |
| 1937 | + | hdev->quirks |= HID_QUIRK_INPUT_PER_APP; | |
| 1938 | + | return hid_hw_start(hdev, HID_CONNECT_DEFAULT); | |
| 1939 | + | } | |
| 1904 | 1940 | } | |
| 1905 | 1941 | } | |
| 1906 | 1942 | ||
| @@ -2103,6 +2139,10 @@ static const struct hid_device_id logi_dj_receivers[] = { | |||
| 2103 | 2139 | HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, | |
| 2104 | 2140 | USB_DEVICE_ID_LOGITECH_NANO_RECEIVER_LIGHTSPEED_1_3), | |
| 2105 | 2141 | .driver_data = recvr_type_gaming_hidpp_ls_1_3}, | |
| 2142 | + | { /* Logitech Bolt receiver (0xc548) */ | |
| 2143 | + | HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, | |
| 2144 | + | USB_DEVICE_ID_LOGITECH_BOLT_RECEIVER), | |
| 2145 | + | .driver_data = recvr_type_bolt}, | |
| 2106 | 2146 | { /* Logitech lightspeed receiver (0xc54d) */ | |
| 2107 | 2147 | HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, | |
| 2108 | 2148 | USB_DEVICE_ID_LOGITECH_NANO_RECEIVER_LIGHTSPEED_1_4), | |
modified drivers/hid/hid-logitech-hidpp.c
| @@ -988,7 +988,8 @@ static int hidpp_root_get_protocol_version(struct hidpp_device *hidpp) | |||
| 988 | 988 | } | |
| 989 | 989 | ||
| 990 | 990 | /* the device might not be connected */ | |
| 991 | - | if (ret == HIDPP_ERROR_RESOURCE_ERROR || | |
| 991 | + | if (ret == HIDPP_ERROR_CONNECT_FAIL || | |
| 992 | + | ret == HIDPP_ERROR_RESOURCE_ERROR || | |
| 992 | 993 | ret == HIDPP_ERROR_UNKNOWN_DEVICE) | |
| 993 | 994 | return -EIO; | |
| 994 | 995 | ||
| @@ -4404,8 +4405,50 @@ static int hidpp_initialize_battery(struct hidpp_device *hidpp) | |||
| 4404 | 4405 | return ret; | |
| 4405 | 4406 | } | |
| 4406 | 4407 | ||
| 4408 | + | static bool hidpp_is_bolt_child(struct hid_device *hdev) | |
| 4409 | + | { | |
| 4410 | + | struct device *parent = hdev->dev.parent; | |
| 4411 | + | struct hid_device *receiver_hdev; | |
| 4412 | + | ||
| 4413 | + | if (!parent) | |
| 4414 | + | return false; | |
| 4415 | + | ||
| 4416 | + | receiver_hdev = to_hid_device(parent); | |
| 4417 | + | return receiver_hdev->vendor == USB_VENDOR_ID_LOGITECH && | |
| 4418 | + | receiver_hdev->product == USB_DEVICE_ID_LOGITECH_BOLT_RECEIVER; | |
| 4419 | + | } | |
| 4420 | + | ||
| 4421 | + | static int hidpp_bolt_init(struct hidpp_device *hidpp) | |
| 4422 | + | { | |
| 4423 | + | struct hid_device *hdev = hidpp->hid_dev; | |
| 4424 | + | char *name; | |
| 4425 | + | int ret; | |
| 4426 | + | ||
| 4427 | + | ret = hidpp_serial_init(hidpp); | |
| 4428 | + | if (ret) | |
| 4429 | + | return ret; | |
| 4430 | + | ||
| 4431 | + | name = hidpp_get_device_name(hidpp); | |
| 4432 | + | if (!name) | |
| 4433 | + | return -EIO; | |
| 4434 | + | ||
| 4435 | + | snprintf(hdev->name, sizeof(hdev->name), "%s", name); | |
| 4436 | + | dbg_hid("HID++ Bolt: Got name: %s\n", name); | |
| 4437 | + | ||
| 4438 | + | kfree(name); | |
| 4439 | + | return 0; | |
| 4440 | + | } | |
| 4441 | + | ||
| 4442 | + | static int hidpp_receiver_init(struct hidpp_device *hidpp) | |
| 4443 | + | { | |
| 4444 | + | if (hidpp_is_bolt_child(hidpp->hid_dev)) | |
| 4445 | + | return hidpp_bolt_init(hidpp); | |
| 4446 | + | ||
| 4447 | + | return hidpp_unifying_init(hidpp); | |
| 4448 | + | } | |
| 4449 | + | ||
| 4407 | 4450 | /* Get name + serial for USB and Bluetooth HID++ devices */ | |
| 4408 | - | static void hidpp_non_unifying_init(struct hidpp_device *hidpp) | |
| 4451 | + | static void hidpp_non_receiver_init(struct hidpp_device *hidpp) | |
| 4409 | 4452 | { | |
| 4410 | 4453 | struct hid_device *hdev = hidpp->hid_dev; | |
| 4411 | 4454 | char *name; | |
| @@ -4757,9 +4800,9 @@ static int hidpp_probe(struct hid_device *hdev, const struct hid_device_id *id) | |||
| 4757 | 4800 | ||
| 4758 | 4801 | /* Get name + serial, store in hdev->name + hdev->uniq */ | |
| 4759 | 4802 | if (id->group == HID_GROUP_LOGITECH_DJ_DEVICE) | |
| 4760 | - | hidpp_unifying_init(hidpp); | |
| 4803 | + | hidpp_receiver_init(hidpp); | |
| 4761 | 4804 | else | |
| 4762 | - | hidpp_non_unifying_init(hidpp); | |
| 4805 | + | hidpp_non_receiver_init(hidpp); | |
| 4763 | 4806 | ||
| 4764 | 4807 | if (hidpp->quirks & HIDPP_QUIRK_DELAYED_INIT) | |
| 4765 | 4808 | connect_mask &= ~HID_CONNECT_HIDINPUT; | |
modified drivers/hid/hid-multitouch.c
| @@ -2249,7 +2249,7 @@ static void mt_remove(struct hid_device *hdev) | |||
| 2249 | 2249 | { | |
| 2250 | 2250 | struct mt_device *td = hid_get_drvdata(hdev); | |
| 2251 | 2251 | ||
| 2252 | - | timer_shutdown_sync(&td->release_timer); | |
| 2252 | + | timer_delete_sync(&td->release_timer); | |
| 2253 | 2253 | ||
| 2254 | 2254 | sysfs_remove_group(&hdev->dev.kobj, &mt_attribute_group); | |
| 2255 | 2255 | hid_hw_stop(hdev); | |
modified drivers/hid/hid-universal-pidff.c
| @@ -187,7 +187,6 @@ static const struct hid_device_id universal_pidff_devices[] = { | |||
| 187 | 187 | { HID_USB_DEVICE(USB_VENDOR_ID_ASETEK, USB_DEVICE_ID_ASETEK_FORTE) }, | |
| 188 | 188 | { HID_USB_DEVICE(USB_VENDOR_ID_ASETEK, USB_DEVICE_ID_ASETEK_LA_PRIMA) }, | |
| 189 | 189 | { HID_USB_DEVICE(USB_VENDOR_ID_ASETEK, USB_DEVICE_ID_ASETEK_TONY_KANAAN) }, | |
| 190 | - | { HID_USB_DEVICE(USB_VENDOR_ID_TURTLE_BEACH, USB_DEVICE_ID_TB_VELOCITYONE_RACE)}, | |
| 191 | 190 | {} | |
| 192 | 191 | }; | |
| 193 | 192 | MODULE_DEVICE_TABLE(hid, universal_pidff_devices); | |
modified drivers/hid/intel-thc-hid/intel-quicki2c/pci-quicki2c.c
| @@ -606,8 +606,7 @@ static int quicki2c_alloc_report_buf(struct quicki2c_device *qcdev) | |||
| 606 | 606 | */ | |
| 607 | 607 | max_report_len = max(le16_to_cpu(qcdev->dev_desc.max_input_len), SZ_4K); | |
| 608 | 608 | ||
| 609 | - | qcdev->input_buf = devm_kzalloc(qcdev->dev, | |
| 610 | - | HIDI2C_PACKET_LEN(max_report_len), GFP_KERNEL); | |
| 609 | + | qcdev->input_buf = devm_kzalloc(qcdev->dev, max_report_len, GFP_KERNEL); | |
| 611 | 610 | if (!qcdev->input_buf) | |
| 612 | 611 | return -ENOMEM; | |
| 613 | 612 | ||
| @@ -617,8 +616,7 @@ static int quicki2c_alloc_report_buf(struct quicki2c_device *qcdev) | |||
| 617 | 616 | max_report_len = max(le16_to_cpu(qcdev->dev_desc.max_output_len), | |
| 618 | 617 | max_report_len); | |
| 619 | 618 | ||
| 620 | - | qcdev->report_buf = devm_kzalloc(qcdev->dev, | |
| 621 | - | HIDI2C_PACKET_LEN(max_report_len), GFP_KERNEL); | |
| 619 | + | qcdev->report_buf = devm_kzalloc(qcdev->dev, max_report_len, GFP_KERNEL); | |
| 622 | 620 | if (!qcdev->report_buf) | |
| 623 | 621 | return -ENOMEM; | |
| 624 | 622 | ||
modified drivers/hid/intel-thc-hid/intel-quickspi/pci-quickspi.c
| @@ -552,8 +552,7 @@ static int quickspi_alloc_report_buf(struct quickspi_device *qsdev) | |||
| 552 | 552 | max_input_len = max(le16_to_cpu(qsdev->dev_desc.rep_desc_len), | |
| 553 | 553 | le16_to_cpu(qsdev->dev_desc.max_input_len)); | |
| 554 | 554 | ||
| 555 | - | qsdev->input_buf = devm_kzalloc(qsdev->dev, | |
| 556 | - | HIDSPI_INPUT_BODY_SIZE(max_input_len), GFP_KERNEL); | |
| 555 | + | qsdev->input_buf = devm_kzalloc(qsdev->dev, max_input_len, GFP_KERNEL); | |
| 557 | 556 | if (!qsdev->input_buf) | |
| 558 | 557 | return -ENOMEM; | |
| 559 | 558 | ||
modified drivers/i2c/busses/i2c-at91-master.c
| @@ -921,14 +921,8 @@ int at91_twi_probe_master(struct platform_device *pdev, | |||
| 921 | 921 | at91_calc_twi_clock(dev); | |
| 922 | 922 | ||
| 923 | 923 | rc = at91_init_twi_recovery_info(pdev, dev); | |
| 924 | - | if (rc == -EPROBE_DEFER) { | |
| 925 | - | /* | |
| 926 | - | * The DMA channels were already set up above, release them | |
| 927 | - | * before deferring the probe so they are not leaked. | |
| 928 | - | */ | |
| 929 | - | at91_twi_dma_release(dev); | |
| 924 | + | if (rc == -EPROBE_DEFER) | |
| 930 | 925 | return rc; | |
| 931 | - | } | |
| 932 | 926 | ||
| 933 | 927 | dev->adapter.algo = &at91_twi_algorithm; | |
| 934 | 928 | dev->adapter.quirks = &at91_twi_quirks; | |
modified drivers/i2c/busses/i2c-qcom-geni.c
| @@ -1003,14 +1003,13 @@ static int geni_i2c_xfer(struct i2c_adapter *adap, | |||
| 1003 | 1003 | ||
| 1004 | 1004 | ret = gi2c->dev_data->set_rate(&gi2c->se, gi2c->clk_freq_out); | |
| 1005 | 1005 | if (ret) | |
| 1006 | - | goto out_pm; | |
| 1006 | + | return ret; | |
| 1007 | 1007 | ||
| 1008 | 1008 | if (gi2c->gpi_mode) | |
| 1009 | 1009 | ret = geni_i2c_gpi_xfer(gi2c, msgs, num); | |
| 1010 | 1010 | else | |
| 1011 | 1011 | ret = geni_i2c_fifo_xfer(gi2c, msgs, num); | |
| 1012 | 1012 | ||
| 1013 | - | out_pm: | |
| 1014 | 1013 | pm_runtime_put_autosuspend(gi2c->se.dev); | |
| 1015 | 1014 | gi2c->cur = NULL; | |
| 1016 | 1015 | gi2c->err = 0; | |
modified drivers/i2c/busses/i2c-xiic.c
| @@ -73,9 +73,6 @@ enum i2c_scl_freq { | |||
| 73 | 73 | * @prev_msg_tx: Previous message is Tx | |
| 74 | 74 | * @quirks: To hold platform specific bug info | |
| 75 | 75 | * @smbus_block_read: Flag to handle block read | |
| 76 | - | * @smbus_actual_len: Valid byte count (length + payload + optional PEC) of a | |
| 77 | - | * padded SMBus block read. msg->len is trimmed to this on completion. | |
| 78 | - | * Zero when no trimming is needed. | |
| 79 | 76 | * @input_clk: Input clock to I2C controller | |
| 80 | 77 | * @i2c_clk: I2C SCL frequency | |
| 81 | 78 | * @atomic: Mode of transfer | |
| @@ -101,7 +98,6 @@ struct xiic_i2c { | |||
| 101 | 98 | bool prev_msg_tx; | |
| 102 | 99 | u32 quirks; | |
| 103 | 100 | bool smbus_block_read; | |
| 104 | - | unsigned int smbus_actual_len; | |
| 105 | 101 | unsigned long input_clk; | |
| 106 | 102 | unsigned int i2c_clk; | |
| 107 | 103 | bool atomic; | |
| @@ -543,38 +539,30 @@ static void xiic_smbus_block_read_setup(struct xiic_i2c *i2c) | |||
| 543 | 539 | ||
| 544 | 540 | /* Check if received length is valid */ | |
| 545 | 541 | if (rxmsg_len <= I2C_SMBUS_BLOCK_MAX) { | |
| 546 | - | unsigned int pec_len = i2c->rx_msg->len - 1; | |
| 547 | - | ||
| 548 | 542 | /* Set Receive fifo depth */ | |
| 549 | - | if (rxmsg_len + pec_len > IIC_RX_FIFO_DEPTH) { | |
| 543 | + | if (rxmsg_len > IIC_RX_FIFO_DEPTH) { | |
| 550 | 544 | /* | |
| 551 | - | * Trailing bytes (payload plus any PEC) exceed Rx FIFO | |
| 552 | - | * capacity, so drain in chunks. This also keeps the | |
| 553 | - | * else branch below from pushing rfd_set past the | |
| 554 | - | * 4-bit XIIC_RFD_REG_OFFSET field. | |
| 545 | + | * When Rx msg len greater than or equal to Rx fifo capacity | |
| 546 | + | * Receive fifo depth should set to Rx fifo capacity minus 1 | |
| 555 | 547 | */ | |
| 556 | 548 | rfd_set = IIC_RX_FIFO_DEPTH - 1; | |
| 557 | - | i2c->rx_msg->len = rxmsg_len + 1 + pec_len; | |
| 558 | - | } else if (1 + rxmsg_len + pec_len < SMBUS_BLOCK_READ_MIN_LEN) { | |
| 549 | + | i2c->rx_msg->len = rxmsg_len + 1; | |
| 550 | + | } else if ((rxmsg_len == 1) || | |
| 551 | + | (rxmsg_len == 0)) { | |
| 559 | 552 | /* | |
| 560 | - | * The HW needs SMBUS_BLOCK_READ_MIN_LEN bytes on the | |
| 561 | - | * bus to exit cleanly: by the time the ISR reads the | |
| 562 | - | * length byte the second byte is already being clocked | |
| 563 | - | * in, too late to NACK. Pad the drain target and record | |
| 564 | - | * the real length, trimmed back on completion so the | |
| 565 | - | * PEC check sees the right byte. | |
| 553 | + | * Minimum of 3 bytes required to exit cleanly. 1 byte | |
| 554 | + | * already received, Second byte is being received. Have | |
| 555 | + | * to set NACK in read_rx before receiving the last byte | |
| 566 | 556 | */ | |
| 567 | 557 | rfd_set = 0; | |
| 568 | 558 | i2c->rx_msg->len = SMBUS_BLOCK_READ_MIN_LEN; | |
| 569 | - | i2c->smbus_actual_len = 1 + rxmsg_len + pec_len; | |
| 570 | 559 | } else { | |
| 571 | 560 | /* | |
| 572 | - | * All trailing bytes fit in the Rx FIFO. Defer RX_FULL | |
| 573 | - | * until every one of them is buffered, so the drain | |
| 574 | - | * takes xiic_read_rx()'s bytes_rem == 0 path. | |
| 561 | + | * When Rx msg len less than Rx fifo capacity | |
| 562 | + | * Receive fifo depth should set to Rx msg len minus 2 | |
| 575 | 563 | */ | |
| 576 | - | rfd_set = rxmsg_len + pec_len - 1; | |
| 577 | - | i2c->rx_msg->len = rxmsg_len + 1 + pec_len; | |
| 564 | + | rfd_set = rxmsg_len - 2; | |
| 565 | + | i2c->rx_msg->len = rxmsg_len + 1; | |
| 578 | 566 | } | |
| 579 | 567 | xiic_setreg8(i2c, XIIC_RFD_REG_OFFSET, rfd_set); | |
| 580 | 568 | ||
| @@ -587,16 +575,6 @@ static void xiic_smbus_block_read_setup(struct xiic_i2c *i2c) | |||
| 587 | 575 | dev_err(i2c->adap.dev.parent, "smbus_block_read Invalid msg length\n"); | |
| 588 | 576 | } | |
| 589 | 577 | ||
| 590 | - | /* | |
| 591 | - | * Undo the setup-time padding of a short SMBus block read before rx_msg is | |
| 592 | - | * cleared, so the PEC check sees the right byte. | |
| 593 | - | */ | |
| 594 | - | static void xiic_smbus_trim_len(struct xiic_i2c *i2c) | |
| 595 | - | { | |
| 596 | - | if (i2c->rx_msg && i2c->smbus_actual_len) | |
| 597 | - | i2c->rx_msg->len = i2c->smbus_actual_len; | |
| 598 | - | } | |
| 599 | - | ||
| 600 | 578 | static void xiic_read_rx(struct xiic_i2c *i2c) | |
| 601 | 579 | { | |
| 602 | 580 | u8 bytes_in_fifo, cr = 0, bytes_to_read = 0; | |
| @@ -819,8 +797,6 @@ static irqreturn_t xiic_process(int irq, void *dev_id) | |||
| 819 | 797 | ||
| 820 | 798 | xiic_read_rx(i2c); | |
| 821 | 799 | if (xiic_rx_space(i2c) == 0) { | |
| 822 | - | xiic_smbus_trim_len(i2c); | |
| 823 | - | ||
| 824 | 800 | /* this is the last part of the message */ | |
| 825 | 801 | i2c->rx_msg = NULL; | |
| 826 | 802 | ||
| @@ -889,11 +865,8 @@ static irqreturn_t xiic_process(int irq, void *dev_id) | |||
| 889 | 865 | ||
| 890 | 866 | if (i2c->tx_msg && i2c->smbus_block_read) { | |
| 891 | 867 | i2c->smbus_block_read = false; | |
| 892 | - | /* | |
| 893 | - | * Drive xiic_tx_space() to 0 to signal STATE_DONE | |
| 894 | - | * without truncating the rx_msg length. | |
| 895 | - | */ | |
| 896 | - | i2c->tx_pos = i2c->tx_msg->len; | |
| 868 | + | /* Set requested message len=1 to indicate STATE_DONE */ | |
| 869 | + | i2c->tx_msg->len = 1; | |
| 897 | 870 | } | |
| 898 | 871 | ||
| 899 | 872 | if (!i2c->tx_msg) | |
| @@ -965,7 +938,6 @@ static void xiic_recv_atomic(struct xiic_i2c *i2c) | |||
| 965 | 938 | return; | |
| 966 | 939 | } | |
| 967 | 940 | ||
| 968 | - | xiic_smbus_trim_len(i2c); | |
| 969 | 941 | i2c->rx_msg = NULL; | |
| 970 | 942 | xiic_irq_clr_en(i2c, XIIC_INTR_TX_ERROR_MASK); | |
| 971 | 943 | ||
| @@ -983,9 +955,6 @@ static void xiic_start_recv(struct xiic_i2c *i2c) | |||
| 983 | 955 | u8 cr = 0, rfd_set = 0; | |
| 984 | 956 | struct i2c_msg *msg = i2c->rx_msg = i2c->tx_msg; | |
| 985 | 957 | ||
| 986 | - | /* A stale value from an aborted block read would truncate this msg. */ | |
| 987 | - | i2c->smbus_actual_len = 0; | |
| 988 | - | ||
| 989 | 958 | if (!i2c->atomic) | |
| 990 | 959 | dev_dbg(i2c->adap.dev.parent, "%s entry, ISR: 0x%x, CR: 0x%x\n", | |
| 991 | 960 | __func__, xiic_getreg32(i2c, XIIC_IISR_OFFSET), | |
modified drivers/iio/accel/kionix-kx022a.c
| @@ -649,7 +649,7 @@ static int kx022a_read_raw(struct iio_dev *idev, | |||
| 649 | 649 | if (ret) | |
| 650 | 650 | return ret; | |
| 651 | 651 | ||
| 652 | - | if ((regval & KX022A_MASK_ODR) >= | |
| 652 | + | if ((regval & KX022A_MASK_ODR) > | |
| 653 | 653 | ARRAY_SIZE(kx022a_accel_samp_freq_table)) { | |
| 654 | 654 | dev_err(data->dev, "Invalid ODR\n"); | |
| 655 | 655 | return -EINVAL; | |
| @@ -980,44 +980,26 @@ static int kx022a_fifo_enable(struct kx022a_data *data) | |||
| 980 | 980 | guard(mutex)(&data->mutex); | |
| 981 | 981 | ret = __kx022a_turn_on_off(data, false); | |
| 982 | 982 | if (ret) | |
| 983 | - | goto err_free_out; | |
| 983 | + | return ret; | |
| 984 | 984 | ||
| 985 | 985 | /* Update watermark to HW */ | |
| 986 | 986 | ret = kx022a_fifo_set_wmi(data); | |
| 987 | 987 | if (ret) | |
| 988 | - | goto err_turn_on_out; | |
| 988 | + | return ret; | |
| 989 | 989 | ||
| 990 | 990 | /* Enable buffer */ | |
| 991 | 991 | ret = regmap_set_bits(data->regmap, data->chip_info->buf_cntl2, | |
| 992 | 992 | KX022A_MASK_BUF_EN); | |
| 993 | 993 | if (ret) | |
| 994 | - | goto err_turn_on_out; | |
| 994 | + | return ret; | |
| 995 | 995 | ||
| 996 | 996 | data->state |= KX022A_STATE_FIFO; | |
| 997 | 997 | ret = regmap_set_bits(data->regmap, data->ien_reg, | |
| 998 | 998 | KX022A_MASK_WMI); | |
| 999 | 999 | if (ret) | |
| 1000 | - | goto err_buf_disable_out; | |
| 1001 | - | ||
| 1002 | - | ret = __kx022a_turn_on_off(data, true); | |
| 1003 | - | if (ret) | |
| 1004 | - | goto err_wmi_clear_out; | |
| 1005 | - | ||
| 1006 | - | return ret; | |
| 1007 | - | ||
| 1008 | - | err_wmi_clear_out: | |
| 1009 | - | regmap_clear_bits(data->regmap, data->ien_reg, | |
| 1010 | - | KX022A_MASK_WMI); | |
| 1011 | - | err_buf_disable_out: | |
| 1012 | - | regmap_clear_bits(data->regmap, data->chip_info->buf_cntl2, | |
| 1013 | - | KX022A_MASK_BUF_EN); | |
| 1014 | - | data->state &= ~KX022A_STATE_FIFO; | |
| 1015 | - | err_turn_on_out: | |
| 1016 | - | __kx022a_turn_on_off(data, true); | |
| 1017 | - | err_free_out: | |
| 1018 | - | kfree(data->fifo_buffer); | |
| 1000 | + | return ret; | |
| 1019 | 1001 | ||
| 1020 | - | return ret; | |
| 1002 | + | return __kx022a_turn_on_off(data, true); | |
| 1021 | 1003 | } | |
| 1022 | 1004 | ||
| 1023 | 1005 | static int kx022a_buffer_postenable(struct iio_dev *idev) | |
modified drivers/iio/accel/kxcjk-1013.c
| @@ -1030,7 +1030,7 @@ static int kxcjk1013_write_event_config(struct iio_dev *indio_dev, | |||
| 1030 | 1030 | struct kxcjk1013_data *data = iio_priv(indio_dev); | |
| 1031 | 1031 | int ret; | |
| 1032 | 1032 | ||
| 1033 | - | if (state == data->ev_enable_state) | |
| 1033 | + | if (state && data->ev_enable_state) | |
| 1034 | 1034 | return 0; | |
| 1035 | 1035 | ||
| 1036 | 1036 | mutex_lock(&data->mutex); | |
modified drivers/iio/accel/sca3000.c
| @@ -638,7 +638,7 @@ static int sca3000_write_raw_samp_freq(struct sca3000_state *st, int val) | |||
| 638 | 638 | ||
| 639 | 639 | if (val == base_freq / 2) | |
| 640 | 640 | ctrlval |= SCA3000_REG_OUT_CTRL_BUF_DIV_2; | |
| 641 | - | else if (val == base_freq / 4) | |
| 641 | + | if (val == base_freq / 4) | |
| 642 | 642 | ctrlval |= SCA3000_REG_OUT_CTRL_BUF_DIV_4; | |
| 643 | 643 | else if (val != base_freq) | |
| 644 | 644 | return -EINVAL; | |
modified drivers/iio/adc/ad4030.c
| @@ -746,21 +746,14 @@ static int ad4030_set_chan_calibbias(struct iio_dev *indio_dev, | |||
| 746 | 746 | static int ad4030_set_avg_frame_len(struct iio_dev *dev, int avg_val) | |
| 747 | 747 | { | |
| 748 | 748 | struct ad4030_state *st = iio_priv(dev); | |
| 749 | + | unsigned int avg_log2 = ilog2(avg_val); | |
| 749 | 750 | unsigned int last_avg_idx = ARRAY_SIZE(ad4030_average_modes) - 1; | |
| 750 | - | unsigned int avg_log2; | |
| 751 | 751 | int freq_hz; | |
| 752 | 752 | int ret; | |
| 753 | 753 | ||
| 754 | - | /* Reject unsupported modes */ | |
| 755 | - | if (avg_val > ad4030_average_modes[last_avg_idx]) | |
| 756 | - | return -EINVAL; | |
| 757 | - | ||
| 758 | - | /* Avoid invalid values for logarithm since it's undefined */ | |
| 759 | - | if (avg_val < 1) | |
| 754 | + | if (avg_val < 0 || avg_val > ad4030_average_modes[last_avg_idx]) | |
| 760 | 755 | return -EINVAL; | |
| 761 | 756 | ||
| 762 | - | avg_log2 = ilog2(avg_val); | |
| 763 | - | ||
| 764 | 757 | if (st->offload_trigger) { | |
| 765 | 758 | /* | |
| 766 | 759 | * The sample averaging and sampling frequency configurations | |
modified drivers/iio/adc/ad7173.c
| @@ -775,9 +775,9 @@ static int ad7173_load_config(struct ad7173_state *st, | |||
| 775 | 775 | ||
| 776 | 776 | return ad_sd_write_reg(&st->sd, AD7173_REG_FILTER(free_cfg_slot), 2, | |
| 777 | 777 | FIELD_PREP(AD7173_FILTER_SINC3_MAP, 0) | | |
| 778 | - | FIELD_PREP(AD7173_FILTER_ENHFILTEN, | |
| 779 | - | post_filter_enable) | | |
| 780 | 778 | FIELD_PREP(AD7173_FILTER_ENHFILT_MASK, | |
| 779 | + | post_filter_enable) | | |
| 780 | + | FIELD_PREP(AD7173_FILTER_ENHFILTEN, | |
| 781 | 781 | post_filter_select) | | |
| 782 | 782 | FIELD_PREP(AD7173_FILTER_ORDER, 0) | | |
| 783 | 783 | FIELD_PREP(AD7173_FILTER_ODR_MASK, | |
modified drivers/iio/adc/ad_sigma_delta.c
| @@ -498,6 +498,7 @@ static int ad_sd_buffer_postenable(struct iio_dev *indio_dev) | |||
| 498 | 498 | const struct iio_scan_type *scan_type = &indio_dev->channels[0].scan_type; | |
| 499 | 499 | struct spi_transfer *xfer = sigma_delta->sample_xfer; | |
| 500 | 500 | unsigned int i, slot, channel; | |
| 501 | + | u8 *samples_buf; | |
| 501 | 502 | int ret; | |
| 502 | 503 | ||
| 503 | 504 | if (sigma_delta->num_slots == 1) { | |
| @@ -529,7 +530,7 @@ static int ad_sd_buffer_postenable(struct iio_dev *indio_dev) | |||
| 529 | 530 | xfer[1].bits_per_word = scan_type->realbits; | |
| 530 | 531 | xfer[1].len = spi_bpw_to_bytes(scan_type->realbits); | |
| 531 | 532 | } else { | |
| 532 | - | unsigned int scan_size; | |
| 533 | + | unsigned int samples_buf_size, scan_size; | |
| 533 | 534 | ||
| 534 | 535 | if (sigma_delta->active_slots > 1) { | |
| 535 | 536 | ret = ad_sigma_delta_append_status(sigma_delta, true); | |
| @@ -537,6 +538,17 @@ static int ad_sd_buffer_postenable(struct iio_dev *indio_dev) | |||
| 537 | 538 | return ret; | |
| 538 | 539 | } | |
| 539 | 540 | ||
| 541 | + | samples_buf_size = | |
| 542 | + | ALIGN(slot * BITS_TO_BYTES(scan_type->storagebits), | |
| 543 | + | sizeof(s64)); | |
| 544 | + | samples_buf_size += sizeof(s64); | |
| 545 | + | samples_buf = devm_krealloc(&sigma_delta->spi->dev, | |
| 546 | + | sigma_delta->samples_buf, | |
| 547 | + | samples_buf_size, GFP_KERNEL); | |
| 548 | + | if (!samples_buf) | |
| 549 | + | return -ENOMEM; | |
| 550 | + | ||
| 551 | + | sigma_delta->samples_buf = samples_buf; | |
| 540 | 552 | scan_size = BITS_TO_BYTES(scan_type->realbits + scan_type->shift); | |
| 541 | 553 | /* For 24-bit data, there is an extra byte of padding. */ | |
| 542 | 554 | xfer[1].rx_buf = &sigma_delta->rx_buf[scan_size == 3 ? 1 : 0]; | |
| @@ -843,23 +855,6 @@ int devm_ad_sd_setup_buffer_and_trigger(struct device *dev, struct iio_dev *indi | |||
| 843 | 855 | ||
| 844 | 856 | indio_dev->setup_ops = &ad_sd_buffer_setup_ops; | |
| 845 | 857 | } else { | |
| 846 | - | const struct iio_scan_type *scan_type = | |
| 847 | - | &indio_dev->channels[0].scan_type; | |
| 848 | - | unsigned int samples_buf_size; | |
| 849 | - | ||
| 850 | - | /* | |
| 851 | - | * Worst-case size: all sequencer slots can be active, capped | |
| 852 | - | * at num_slots by ad_sd_validate_scan_mask(). | |
| 853 | - | */ | |
| 854 | - | samples_buf_size = | |
| 855 | - | ALIGN(sigma_delta->num_slots * | |
| 856 | - | BITS_TO_BYTES(scan_type->storagebits), | |
| 857 | - | sizeof(s64)); | |
| 858 | - | samples_buf_size += sizeof(s64); | |
| 859 | - | sigma_delta->samples_buf = devm_kzalloc(dev, samples_buf_size, GFP_KERNEL); | |
| 860 | - | if (!sigma_delta->samples_buf) | |
| 861 | - | return -ENOMEM; | |
| 862 | - | ||
| 863 | 858 | ret = devm_iio_triggered_buffer_setup(dev, indio_dev, | |
| 864 | 859 | &iio_pollfunc_store_time, | |
| 865 | 860 | &ad_sd_trigger_handler, | |
modified drivers/iio/adc/ade9000.c
| @@ -219,7 +219,7 @@ | |||
| 219 | 219 | #define ADE9000_ST1_ERROR2_BIT BIT(30) | |
| 220 | 220 | #define ADE9000_ST1_ERROR3_BIT BIT(31) | |
| 221 | 221 | #define ADE9000_ST1_CROSSING_FIRST 6 | |
| 222 | - | #define ADE9000_ST1_CROSSING_DEPTH 26 | |
| 222 | + | #define ADE9000_ST1_CROSSING_DEPTH 25 | |
| 223 | 223 | ||
| 224 | 224 | #define ADE9000_WFB_TRG_DIP_BIT BIT(0) | |
| 225 | 225 | #define ADE9000_WFB_TRG_SWELL_BIT BIT(1) | |
| @@ -444,7 +444,7 @@ static const struct iio_chan_spec_ext_info ade9000_ext_info[] = { | |||
| 444 | 444 | BIT(IIO_CHAN_INFO_CALIBSCALE), \ | |
| 445 | 445 | .event_spec = ade9000_current_events, \ | |
| 446 | 446 | .num_event_specs = ARRAY_SIZE(ade9000_current_events), \ | |
| 447 | - | .scan_index = num * 2, \ | |
| 447 | + | .scan_index = num, \ | |
| 448 | 448 | .indexed = 1, \ | |
| 449 | 449 | .scan_type = { \ | |
| 450 | 450 | .sign = 's', \ | |
| @@ -464,7 +464,7 @@ static const struct iio_chan_spec_ext_info ade9000_ext_info[] = { | |||
| 464 | 464 | BIT(IIO_CHAN_INFO_FREQUENCY), \ | |
| 465 | 465 | .event_spec = ade9000_voltage_events, \ | |
| 466 | 466 | .num_event_specs = ARRAY_SIZE(ade9000_voltage_events), \ | |
| 467 | - | .scan_index = num * 2 + 1, /* interleave with current channels */ \ | |
| 467 | + | .scan_index = num + 1, /* interleave with current channels */ \ | |
| 468 | 468 | .indexed = 1, \ | |
| 469 | 469 | .scan_type = { \ | |
| 470 | 470 | .sign = 's', \ | |
| @@ -1647,9 +1647,8 @@ static int ade9000_setup_clkout(struct device *dev, struct ade9000_state *st) | |||
| 1647 | 1647 | return 0; | |
| 1648 | 1648 | ||
| 1649 | 1649 | /* CLKOUT passes through CLKIN with divider of 1 */ | |
| 1650 | - | clkout_hw = devm_clk_hw_register_fixed_factor(dev, "clkout", | |
| 1651 | - | __clk_get_name(st->clkin), | |
| 1652 | - | CLK_SET_RATE_PARENT, 1, 1); | |
| 1650 | + | clkout_hw = devm_clk_hw_register_divider(dev, "clkout", __clk_get_name(st->clkin), | |
| 1651 | + | CLK_SET_RATE_PARENT, NULL, 0, 1, 0, NULL); | |
| 1653 | 1652 | if (IS_ERR(clkout_hw)) | |
| 1654 | 1653 | return dev_err_probe(dev, PTR_ERR(clkout_hw), "Failed to register clkout"); | |
| 1655 | 1654 | ||
| @@ -1706,6 +1705,18 @@ static int ade9000_probe(struct spi_device *spi) | |||
| 1706 | 1705 | if (ret) | |
| 1707 | 1706 | return ret; | |
| 1708 | 1707 | ||
| 1708 | + | ret = ade9000_request_irq(dev, "irq0", ade9000_irq0_thread, indio_dev); | |
| 1709 | + | if (ret) | |
| 1710 | + | return ret; | |
| 1711 | + | ||
| 1712 | + | ret = ade9000_request_irq(dev, "irq1", ade9000_irq1_thread, indio_dev); | |
| 1713 | + | if (ret) | |
| 1714 | + | return ret; | |
| 1715 | + | ||
| 1716 | + | ret = ade9000_request_irq(dev, "dready", ade9000_dready_thread, indio_dev); | |
| 1717 | + | if (ret) | |
| 1718 | + | return ret; | |
| 1719 | + | ||
| 1709 | 1720 | /* External CMOS clock input (optional - crystal can be used instead) */ | |
| 1710 | 1721 | st->clkin = devm_clk_get_optional_enabled(dev, NULL); | |
| 1711 | 1722 | if (IS_ERR(st->clkin)) | |
| @@ -1725,19 +1736,6 @@ static int ade9000_probe(struct spi_device *spi) | |||
| 1725 | 1736 | return dev_err_probe(&spi->dev, ret, | |
| 1726 | 1737 | "Failed to get and enable vdd regulator\n"); | |
| 1727 | 1738 | ||
| 1728 | - | /* Request IRQs only after powering the chip; the handlers do SPI access. */ | |
| 1729 | - | ret = ade9000_request_irq(dev, "irq0", ade9000_irq0_thread, indio_dev); | |
| 1730 | - | if (ret) | |
| 1731 | - | return ret; | |
| 1732 | - | ||
| 1733 | - | ret = ade9000_request_irq(dev, "irq1", ade9000_irq1_thread, indio_dev); | |
| 1734 | - | if (ret) | |
| 1735 | - | return ret; | |
| 1736 | - | ||
| 1737 | - | ret = ade9000_request_irq(dev, "dready", ade9000_dready_thread, indio_dev); | |
| 1738 | - | if (ret) | |
| 1739 | - | return ret; | |
| 1740 | - | ||
| 1741 | 1739 | indio_dev->channels = ade9000_channels; | |
| 1742 | 1740 | indio_dev->num_channels = ARRAY_SIZE(ade9000_channels); | |
| 1743 | 1741 | ||
modified drivers/iio/adc/adi-axi-adc.c
| @@ -714,10 +714,6 @@ static int adi_axi_adc_probe(struct platform_device *pdev) | |||
| 714 | 714 | if (!st) | |
| 715 | 715 | return -ENOMEM; | |
| 716 | 716 | ||
| 717 | - | ret = devm_mutex_init(dev, &st->lock); | |
| 718 | - | if (ret) | |
| 719 | - | return ret; | |
| 720 | - | ||
| 721 | 717 | base = devm_platform_ioremap_resource(pdev, 0); | |
| 722 | 718 | if (IS_ERR(base)) | |
| 723 | 719 | return PTR_ERR(base); | |
modified drivers/iio/adc/aspeed_adc.c
| @@ -585,9 +585,7 @@ static int aspeed_adc_probe(struct platform_device *pdev) | |||
| 585 | 585 | return dev_err_probe(dev, PTR_ERR(data->rst), | |
| 586 | 586 | "invalid or missing reset controller device tree entry"); | |
| 587 | 587 | ||
| 588 | - | ret = reset_control_deassert(data->rst); | |
| 589 | - | if (ret) | |
| 590 | - | return ret; | |
| 588 | + | reset_control_deassert(data->rst); | |
| 591 | 589 | ||
| 592 | 590 | ret = devm_add_action_or_reset(dev, aspeed_adc_reset_assert, data->rst); | |
| 593 | 591 | if (ret) | |
modified drivers/iio/adc/axp288_adc.c
| @@ -207,14 +207,6 @@ static const struct dmi_system_id axp288_adc_ts_bias_override[] = { | |||
| 207 | 207 | }, | |
| 208 | 208 | .driver_data = (void *)(uintptr_t)AXP288_ADC_TS_BIAS_80UA, | |
| 209 | 209 | }, | |
| 210 | - | { | |
| 211 | - | /* Haier HV103H */ | |
| 212 | - | .matches = { | |
| 213 | - | DMI_MATCH(DMI_SYS_VENDOR, "Haier"), | |
| 214 | - | DMI_MATCH(DMI_PRODUCT_NAME, "HV103H"), | |
| 215 | - | }, | |
| 216 | - | .driver_data = (void *)(uintptr_t)AXP288_ADC_TS_BIAS_80UA, | |
| 217 | - | }, | |
| 218 | 210 | { } | |
| 219 | 211 | }; | |
| 220 | 212 | ||
modified drivers/iio/adc/max1363.c
| @@ -404,14 +404,6 @@ static int max1363_read_single_chan(struct iio_dev *indio_dev, | |||
| 404 | 404 | ||
| 405 | 405 | data = rxbuf[0]; | |
| 406 | 406 | } | |
| 407 | - | ||
| 408 | - | /* | |
| 409 | - | * Differential channels are bipolar and the device returns the sample | |
| 410 | - | * in two's complement, so sign-extend it from the resolution bit. | |
| 411 | - | */ | |
| 412 | - | if (chan->differential) | |
| 413 | - | data = sign_extend32(data, st->chip_info->bits - 1); | |
| 414 | - | ||
| 415 | 407 | *val = data; | |
| 416 | 408 | ||
| 417 | 409 | return 0; | |
modified drivers/iio/adc/pac1934.c
| @@ -1108,10 +1108,6 @@ static int pac1934_acpi_parse_channel_config(struct i2c_client *client, | |||
| 1108 | 1108 | devm_kmemdup(dev, rez->package.elements[i].string.pointer, | |
| 1109 | 1109 | (size_t)rez->package.elements[i].string.length + 1, | |
| 1110 | 1110 | GFP_KERNEL); | |
| 1111 | - | if (!info->labels[idx]) { | |
| 1112 | - | ACPI_FREE(rez); | |
| 1113 | - | return -ENOMEM; | |
| 1114 | - | } | |
| 1115 | 1111 | info->labels[idx][rez->package.elements[i].string.length] = '\0'; | |
| 1116 | 1112 | info->shunts[idx] = rez->package.elements[i + 1].integer.value * 1000; | |
| 1117 | 1113 | info->active_channels[idx] = (info->shunts[idx] != 0); | |
modified drivers/iio/adc/rohm-bd79124.c
| @@ -200,7 +200,7 @@ static int bd79124gpo_set_multiple(struct gpio_chip *gc, unsigned long *mask, | |||
| 200 | 200 | if (ret) | |
| 201 | 201 | return ret; | |
| 202 | 202 | ||
| 203 | - | if (*mask & ~all_gpos) { | |
| 203 | + | if (all_gpos ^ *mask) { | |
| 204 | 204 | dev_dbg(data->dev, "Invalid mux config. Can't set value.\n"); | |
| 205 | 205 | ||
| 206 | 206 | return -EINVAL; | |
| @@ -381,9 +381,6 @@ static int bd79124_start_measurement(struct bd79124_data *data, int chan) | |||
| 381 | 381 | ||
| 382 | 382 | /* See if already started */ | |
| 383 | 383 | ret = regmap_read(data->map, BD79124_REG_AUTO_CHANNELS, &val); | |
| 384 | - | if (ret) | |
| 385 | - | return ret; | |
| 386 | - | ||
| 387 | 384 | if (val & BIT(chan)) | |
| 388 | 385 | return 0; | |
| 389 | 386 | ||
| @@ -423,16 +420,11 @@ static int bd79124_stop_measurement(struct bd79124_data *data, int chan) | |||
| 423 | 420 | ||
| 424 | 421 | /* See if already stopped */ | |
| 425 | 422 | ret = regmap_read(data->map, BD79124_REG_AUTO_CHANNELS, &enabled_chans); | |
| 426 | - | if (ret) | |
| 427 | - | return ret; | |
| 428 | - | ||
| 429 | 423 | if (!(enabled_chans & BIT(chan))) | |
| 430 | 424 | return 0; | |
| 431 | 425 | ||
| 432 | 426 | ret = regmap_clear_bits(data->map, BD79124_REG_SEQ_CFG, | |
| 433 | 427 | BD79124_MSK_SEQ_START); | |
| 434 | - | if (ret) | |
| 435 | - | return ret; | |
| 436 | 428 | ||
| 437 | 429 | /* Clear the channel from the measured channels */ | |
| 438 | 430 | enabled_chans &= ~BIT(chan); | |
| @@ -532,7 +524,7 @@ static int bd79124_enable_event(struct bd79124_data *data, | |||
| 532 | 524 | return ret; | |
| 533 | 525 | ||
| 534 | 526 | if (dir == IIO_EV_DIR_RISING) { | |
| 535 | - | limit = &data->alarm_r_limit[channel]; | |
| 527 | + | limit = &data->alarm_f_limit[channel]; | |
| 536 | 528 | reg = BD79124_GET_HIGH_LIMIT_REG(channel); | |
| 537 | 529 | } else { | |
| 538 | 530 | limit = &data->alarm_f_limit[channel]; | |
| @@ -927,13 +919,13 @@ static int bd79124_chan_init(struct bd79124_data *data, int channel) | |||
| 927 | 919 | { | |
| 928 | 920 | int ret; | |
| 929 | 921 | ||
| 930 | - | ret = bd79124_write_int_to_reg(data, BD79124_GET_HIGH_LIMIT_REG(channel), | |
| 931 | - | BD79124_HIGH_LIMIT_MAX); | |
| 922 | + | ret = regmap_write(data->map, BD79124_GET_HIGH_LIMIT_REG(channel), | |
| 923 | + | BD79124_HIGH_LIMIT_MAX); | |
| 932 | 924 | if (ret) | |
| 933 | 925 | return ret; | |
| 934 | 926 | ||
| 935 | - | return bd79124_write_int_to_reg(data, BD79124_GET_LOW_LIMIT_REG(channel), | |
| 936 | - | BD79124_LOW_LIMIT_MIN); | |
| 927 | + | return regmap_write(data->map, BD79124_GET_LOW_LIMIT_REG(channel), | |
| 928 | + | BD79124_LOW_LIMIT_MIN); | |
| 937 | 929 | } | |
| 938 | 930 | ||
| 939 | 931 | static int bd79124_get_gpio_pins(const struct iio_chan_spec *cs, int num_channels) | |
modified drivers/iio/adc/stm32-adc.c
| @@ -1608,16 +1608,11 @@ static int stm32_adc_read_raw(struct iio_dev *indio_dev, | |||
| 1608 | 1608 | ret = stm32_adc_single_conv(indio_dev, chan, val); | |
| 1609 | 1609 | else | |
| 1610 | 1610 | ret = -EINVAL; | |
| 1611 | - | iio_device_release_direct(indio_dev); | |
| 1612 | - | if (ret < 0) | |
| 1613 | - | return ret; | |
| 1614 | 1611 | ||
| 1615 | - | if (mask == IIO_CHAN_INFO_PROCESSED) { | |
| 1616 | - | if (*val == 0) | |
| 1617 | - | return -EINVAL; | |
| 1612 | + | if (mask == IIO_CHAN_INFO_PROCESSED) | |
| 1618 | 1613 | *val = STM32_ADC_VREFINT_VOLTAGE * adc->vrefint.vrefint_cal / *val; | |
| 1619 | - | } | |
| 1620 | 1614 | ||
| 1615 | + | iio_device_release_direct(indio_dev); | |
| 1621 | 1616 | return ret; | |
| 1622 | 1617 | ||
| 1623 | 1618 | case IIO_CHAN_INFO_SCALE: | |
| @@ -2268,37 +2263,33 @@ static int stm32_adc_populate_int_ch(struct iio_dev *indio_dev, const char *ch_n | |||
| 2268 | 2263 | ||
| 2269 | 2264 | for (i = 0; i < STM32_ADC_INT_CH_NB; i++) { | |
| 2270 | 2265 | if (!strncmp(stm32_adc_ic[i].name, ch_name, STM32_ADC_CH_SZ)) { | |
| 2271 | - | bool na; | |
| 2272 | - | ||
| 2273 | 2266 | /* Check internal channel availability */ | |
| 2274 | 2267 | switch (i) { | |
| 2275 | 2268 | case STM32_ADC_INT_CH_VDDCORE: | |
| 2276 | - | na = !adc->cfg->regs->or_vddcore.reg; | |
| 2269 | + | if (!adc->cfg->regs->or_vddcore.reg) | |
| 2270 | + | dev_warn(&indio_dev->dev, | |
| 2271 | + | "%s channel not available\n", ch_name); | |
| 2277 | 2272 | break; | |
| 2278 | 2273 | case STM32_ADC_INT_CH_VDDCPU: | |
| 2279 | - | na = !adc->cfg->regs->or_vddcpu.reg; | |
| 2274 | + | if (!adc->cfg->regs->or_vddcpu.reg) | |
| 2275 | + | dev_warn(&indio_dev->dev, | |
| 2276 | + | "%s channel not available\n", ch_name); | |
| 2280 | 2277 | break; | |
| 2281 | 2278 | case STM32_ADC_INT_CH_VDDQ_DDR: | |
| 2282 | - | na = !adc->cfg->regs->or_vddq_ddr.reg; | |
| 2279 | + | if (!adc->cfg->regs->or_vddq_ddr.reg) | |
| 2280 | + | dev_warn(&indio_dev->dev, | |
| 2281 | + | "%s channel not available\n", ch_name); | |
| 2283 | 2282 | break; | |
| 2284 | 2283 | case STM32_ADC_INT_CH_VREFINT: | |
| 2285 | - | na = !adc->cfg->regs->ccr_vref.reg; | |
| 2284 | + | if (!adc->cfg->regs->ccr_vref.reg) | |
| 2285 | + | dev_warn(&indio_dev->dev, | |
| 2286 | + | "%s channel not available\n", ch_name); | |
| 2286 | 2287 | break; | |
| 2287 | 2288 | case STM32_ADC_INT_CH_VBAT: | |
| 2288 | - | na = !adc->cfg->regs->ccr_vbat.reg; | |
| 2289 | + | if (!adc->cfg->regs->ccr_vbat.reg) | |
| 2290 | + | dev_warn(&indio_dev->dev, | |
| 2291 | + | "%s channel not available\n", ch_name); | |
| 2289 | 2292 | break; | |
| 2290 | - | default: | |
| 2291 | - | return -EINVAL; | |
| 2292 | - | } | |
| 2293 | - | ||
| 2294 | - | if (na) { | |
| 2295 | - | /* | |
| 2296 | - | * Channel label matches an internal STM32 ADC channel. | |
| 2297 | - | * Warn about it, as there's normally no restriction on the | |
| 2298 | - | * name but that's not among available internal channels. | |
| 2299 | - | */ | |
| 2300 | - | dev_warn(&indio_dev->dev, "no %s internal channel\n", ch_name); | |
| 2301 | - | return 0; | |
| 2302 | 2293 | } | |
| 2303 | 2294 | ||
| 2304 | 2295 | if (stm32_adc_ic[i].idx != STM32_ADC_INT_CH_VREFINT) { | |
modified drivers/iio/adc/sun4i-gpadc-iio.c
| @@ -638,10 +638,10 @@ static int sun4i_gpadc_probe(struct platform_device *pdev) | |||
| 638 | 638 | * thermal because no thermal DT node is found. | |
| 639 | 639 | */ | |
| 640 | 640 | if (IS_ERR(info->tzd) && PTR_ERR(info->tzd) != -ENODEV) { | |
| 641 | - | ret = dev_err_probe(&pdev->dev, | |
| 642 | - | PTR_ERR(info->tzd), | |
| 643 | - | "could not register thermal sensor\n"); | |
| 644 | - | goto err_map; | |
| 641 | + | dev_err(&pdev->dev, | |
| 642 | + | "could not register thermal sensor: %ld\n", | |
| 643 | + | PTR_ERR(info->tzd)); | |
| 644 | + | return PTR_ERR(info->tzd); | |
| 645 | 645 | } | |
| 646 | 646 | } | |
| 647 | 647 | ||
| @@ -657,6 +657,7 @@ err_map: | |||
| 657 | 657 | if (!info->no_irq && IS_ENABLED(CONFIG_THERMAL_OF)) | |
| 658 | 658 | iio_map_array_unregister(indio_dev); | |
| 659 | 659 | ||
| 660 | + | pm_runtime_put(&pdev->dev); | |
| 660 | 661 | pm_runtime_disable(&pdev->dev); | |
| 661 | 662 | ||
| 662 | 663 | return ret; | |
| @@ -667,6 +668,7 @@ static void sun4i_gpadc_remove(struct platform_device *pdev) | |||
| 667 | 668 | struct iio_dev *indio_dev = platform_get_drvdata(pdev); | |
| 668 | 669 | struct sun4i_gpadc_iio *info = iio_priv(indio_dev); | |
| 669 | 670 | ||
| 671 | + | pm_runtime_put(&pdev->dev); | |
| 670 | 672 | pm_runtime_disable(&pdev->dev); | |
| 671 | 673 | ||
| 672 | 674 | if (!IS_ENABLED(CONFIG_THERMAL_OF)) | |
modified drivers/iio/adc/xilinx-xadc-core.c
| @@ -1401,14 +1401,13 @@ static int xadc_probe(struct platform_device *pdev) | |||
| 1401 | 1401 | } | |
| 1402 | 1402 | ||
| 1403 | 1403 | if (irq > 0) { | |
| 1404 | - | /* Clear out any work queued by the interrupt */ | |
| 1405 | - | ret = devm_add_action_or_reset(dev, xadc_cancel_delayed_work, | |
| 1406 | - | &xadc->zynq_unmask_work); | |
| 1404 | + | ret = devm_request_irq(dev, irq, xadc->ops->interrupt_handler, | |
| 1405 | + | 0, dev_name(dev), indio_dev); | |
| 1407 | 1406 | if (ret) | |
| 1408 | 1407 | return ret; | |
| 1409 | 1408 | ||
| 1410 | - | ret = devm_request_irq(dev, irq, xadc->ops->interrupt_handler, | |
| 1411 | - | 0, dev_name(dev), indio_dev); | |
| 1409 | + | ret = devm_add_action_or_reset(dev, xadc_cancel_delayed_work, | |
| 1410 | + | &xadc->zynq_unmask_work); | |
| 1412 | 1411 | if (ret) | |
| 1413 | 1412 | return ret; | |
| 1414 | 1413 | } | |
modified drivers/iio/buffer/industrialio-buffer-dmaengine.c
| @@ -104,13 +104,10 @@ static int iio_dmaengine_buffer_submit_block(struct iio_dma_buffer_queue *queue, | |||
| 104 | 104 | if (block->sg_table) { | |
| 105 | 105 | unsigned long flags; | |
| 106 | 106 | ||
| 107 | - | /* | |
| 108 | - | * Only the first sgt->nents entries carry a valid | |
| 109 | - | * sg_dma_address()/sg_dma_len() pair as mapping the table may | |
| 110 | - | * have coalesced entries, in which case nents is smaller than | |
| 111 | - | * orig_nents. | |
| 112 | - | */ | |
| 113 | - | nents = block->sg_table->nents; | |
| 107 | + | sgl = block->sg_table->sgl; | |
| 108 | + | nents = sg_nents_for_len(sgl, block->bytes_used); | |
| 109 | + | if (nents < 0) | |
| 110 | + | return nents; | |
| 114 | 111 | ||
| 115 | 112 | vecs = kmalloc_objs(*vecs, nents, GFP_ATOMIC); | |
| 116 | 113 | if (!vecs) | |
| @@ -118,8 +115,7 @@ static int iio_dmaengine_buffer_submit_block(struct iio_dma_buffer_queue *queue, | |||
| 118 | 115 | ||
| 119 | 116 | len_total = block->bytes_used; | |
| 120 | 117 | ||
| 121 | - | sgl = block->sg_table->sgl; | |
| 122 | - | for (i = 0; i < nents && len_total; i++) { | |
| 118 | + | for (i = 0; i < nents; i++) { | |
| 123 | 119 | vecs[i].addr = sg_dma_address(sgl); | |
| 124 | 120 | vecs[i].len = min(sg_dma_len(sgl), len_total); | |
| 125 | 121 | len_total -= vecs[i].len; | |
| @@ -127,8 +123,6 @@ static int iio_dmaengine_buffer_submit_block(struct iio_dma_buffer_queue *queue, | |||
| 127 | 123 | sgl = sg_next(sgl); | |
| 128 | 124 | } | |
| 129 | 125 | ||
| 130 | - | nents = i; | |
| 131 | - | ||
| 132 | 126 | if (block->cyclic) | |
| 133 | 127 | flags = DMA_PREP_REPEAT; | |
| 134 | 128 | else | |
modified drivers/iio/cdc/ad7150.c
| @@ -636,13 +636,11 @@ static const struct i2c_device_id ad7150_id[] = { | |||
| 636 | 636 | MODULE_DEVICE_TABLE(i2c, ad7150_id); | |
| 637 | 637 | ||
| 638 | 638 | static const struct of_device_id ad7150_of_match[] = { | |
| 639 | - | { .compatible = "adi,ad7150" }, | |
| 640 | - | { .compatible = "adi,ad7151" }, | |
| 641 | - | { .compatible = "adi,ad7156" }, | |
| 639 | + | { "adi,ad7150" }, | |
| 640 | + | { "adi,ad7151" }, | |
| 641 | + | { "adi,ad7156" }, | |
| 642 | 642 | { } | |
| 643 | 643 | }; | |
| 644 | - | MODULE_DEVICE_TABLE(of, ad7150_of_match); | |
| 645 | - | ||
| 646 | 644 | static struct i2c_driver ad7150_driver = { | |
| 647 | 645 | .driver = { | |
| 648 | 646 | .name = "ad7150", | |
modified drivers/iio/common/inv_sensors/inv_sensors_timestamp.c
| @@ -167,16 +167,11 @@ void inv_sensors_timestamp_interrupt(struct inv_sensors_timestamp *ts, | |||
| 167 | 167 | valid = inv_validate_period(ts, period); | |
| 168 | 168 | } | |
| 169 | 169 | ||
| 170 | - | /* | |
| 171 | - | * If interrupt interval is valid, sync with interrupt timestamp. | |
| 172 | - | * Otherwise, use estimated value while ensuring interrupt timestamp | |
| 173 | - | * remains the maximum possible value. | |
| 174 | - | */ | |
| 175 | - | period = inv_align_timestamp_it(ts, sample_nb); | |
| 170 | + | /* if interrupt interval is valid, sync with interrupt timestamp */ | |
| 176 | 171 | if (valid) | |
| 177 | - | ts->period = period; | |
| 172 | + | ts->period = inv_align_timestamp_it(ts, sample_nb); | |
| 178 | 173 | else | |
| 179 | - | ts->period = min(ts->mult * ts->chip_period.val, period); | |
| 174 | + | ts->period = ts->mult * ts->chip_period.val; | |
| 180 | 175 | } | |
| 181 | 176 | EXPORT_SYMBOL_NS_GPL(inv_sensors_timestamp_interrupt, "IIO_INV_SENSORS_TIMESTAMP"); | |
| 182 | 177 | ||
modified drivers/iio/dac/mcp47a1.c
| @@ -26,7 +26,7 @@ struct mcp47a1_data { | |||
| 26 | 26 | int vref_mV; | |
| 27 | 27 | }; | |
| 28 | 28 | ||
| 29 | - | static const int mcp47a1_raw_avail[] = { 0, 1, MCP47A1_MAX_STEPS }; | |
| 29 | + | static const int mcp47a1_raw_avail[] = { 0, 1, MCP47A1_MAX_STEPS - 1 }; | |
| 30 | 30 | ||
| 31 | 31 | static const struct iio_chan_spec mcp47a1_channel = { | |
| 32 | 32 | .type = IIO_VOLTAGE, | |
| @@ -46,7 +46,7 @@ static int mcp47a1_write(struct iio_dev *indio_dev, | |||
| 46 | 46 | ||
| 47 | 47 | switch (mask) { | |
| 48 | 48 | case IIO_CHAN_INFO_RAW: | |
| 49 | - | if (!in_range(val, 0, MCP47A1_MAX_STEPS + 1)) | |
| 49 | + | if (!in_range(val, 0, MCP47A1_MAX_STEPS)) | |
| 50 | 50 | return -EINVAL; | |
| 51 | 51 | ||
| 52 | 52 | return i2c_smbus_write_byte_data(data->client, MCP47A1_CMD_CODE, | |
modified drivers/iio/dac/rohm-bd79703.c
| @@ -73,9 +73,6 @@ static int bd79703_write_raw(struct iio_dev *idev, | |||
| 73 | 73 | { | |
| 74 | 74 | struct bd79703_data *data = iio_priv(idev); | |
| 75 | 75 | ||
| 76 | - | if (mask != IIO_CHAN_INFO_RAW) | |
| 77 | - | return -EINVAL; | |
| 78 | - | ||
| 79 | 76 | if (val < 0 || val >= 1 << BD79703_DAC_BITS) | |
| 80 | 77 | return -EINVAL; | |
| 81 | 78 | ||
modified drivers/iio/frequency/adf4377.c
| @@ -988,10 +988,10 @@ static const struct clk_ops adf4377_clk_ops = { | |||
| 988 | 988 | ||
| 989 | 989 | static int adf4377_clk_register(struct adf4377_state *st) | |
| 990 | 990 | { | |
| 991 | - | struct clk_parent_data parent_data = { }; | |
| 992 | 991 | struct spi_device *spi = st->spi; | |
| 993 | 992 | struct device *dev = &spi->dev; | |
| 994 | - | struct clk_init_data init = { }; | |
| 993 | + | struct clk_init_data init; | |
| 994 | + | struct clk_parent_data parent_data; | |
| 995 | 995 | int ret; | |
| 996 | 996 | ||
| 997 | 997 | if (!device_property_present(dev, "#clock-cells")) | |
modified drivers/iio/frequency/admv1013.c
| @@ -195,7 +195,7 @@ static int admv1013_read_raw(struct iio_dev *indio_dev, | |||
| 195 | 195 | ||
| 196 | 196 | switch (info) { | |
| 197 | 197 | case IIO_CHAN_INFO_CALIBBIAS: | |
| 198 | - | switch (chan->channel2) { | |
| 198 | + | switch (chan->channel) { | |
| 199 | 199 | case IIO_MOD_I: | |
| 200 | 200 | addr = ADMV1013_REG_OFFSET_ADJUST_I; | |
| 201 | 201 | break; | |
| @@ -601,15 +601,12 @@ static int admv1013_probe(struct spi_device *spi) | |||
| 601 | 601 | "failed to get the LO input clock\n"); | |
| 602 | 602 | ||
| 603 | 603 | st->nb.notifier_call = admv1013_freq_change; | |
| 604 | - | ||
| 605 | - | ret = devm_mutex_init(dev, &st->lock); | |
| 606 | - | if (ret) | |
| 607 | - | return ret; | |
| 608 | - | ||
| 609 | 604 | ret = devm_clk_notifier_register(dev, st->clkin, &st->nb); | |
| 610 | 605 | if (ret) | |
| 611 | 606 | return ret; | |
| 612 | 607 | ||
| 608 | + | mutex_init(&st->lock); | |
| 609 | + | ||
| 613 | 610 | ret = admv1013_init(st, vcm_uv); | |
| 614 | 611 | if (ret) | |
| 615 | 612 | return dev_err_probe(dev, ret, "admv1013 init failed\n"); | |
modified drivers/iio/gyro/adis16136.c
| @@ -145,7 +145,7 @@ static int adis16136_debugfs_init(struct iio_dev *indio_dev) | |||
| 145 | 145 | struct adis16136 *adis16136 = iio_priv(indio_dev); | |
| 146 | 146 | struct dentry *d = iio_get_debugfs_dentry(indio_dev); | |
| 147 | 147 | ||
| 148 | - | debugfs_create_file("serial_number", 0400, | |
| 148 | + | debugfs_create_file_unsafe("serial_number", 0400, | |
| 149 | 149 | d, adis16136, &adis16136_serial_fops); | |
| 150 | 150 | debugfs_create_file_unsafe("product_id", 0400, | |
| 151 | 151 | d, adis16136, &adis16136_product_id_fops); | |
modified drivers/iio/health/max30102.c
| @@ -290,15 +290,9 @@ static irqreturn_t max30102_interrupt_handler(int irq, void *private) | |||
| 290 | 290 | { | |
| 291 | 291 | struct iio_dev *indio_dev = private; | |
| 292 | 292 | struct max30102_data *data = iio_priv(indio_dev); | |
| 293 | - | unsigned int measurements; | |
| 294 | - | int ret, cnt; | |
| 295 | - | ||
| 296 | - | cnt = max30102_fifo_count(data); | |
| 297 | - | if (cnt <= 0) | |
| 298 | - | return IRQ_HANDLED; | |
| 299 | - | ||
| 300 | - | measurements = bitmap_weight(indio_dev->active_scan_mask, | |
| 301 | - | iio_get_masklength(indio_dev)); | |
| 293 | + | unsigned int measurements = bitmap_weight(indio_dev->active_scan_mask, | |
| 294 | + | iio_get_masklength(indio_dev)); | |
| 295 | + | int ret, cnt = 0; | |
| 302 | 296 | ||
| 303 | 297 | mutex_lock(&data->lock); | |
| 304 | 298 | ||
modified drivers/iio/imu/adis16400.c
| @@ -280,7 +280,7 @@ static void adis16400_debugfs_init(struct iio_dev *indio_dev) | |||
| 280 | 280 | return; | |
| 281 | 281 | ||
| 282 | 282 | if (st->variant->flags & ADIS16400_HAS_SERIAL_NUMBER) | |
| 283 | - | debugfs_create_file("serial_number", 0400, | |
| 283 | + | debugfs_create_file_unsafe("serial_number", 0400, | |
| 284 | 284 | d, st, &adis16400_serial_number_fops); | |
| 285 | 285 | if (st->variant->flags & ADIS16400_HAS_PROD_ID) | |
| 286 | 286 | debugfs_create_file_unsafe("product_id", 0400, | |
modified drivers/iio/imu/adis16480.c
| @@ -309,9 +309,9 @@ static void adis16480_debugfs_init(struct iio_dev *indio_dev) | |||
| 309 | 309 | if (!IS_ENABLED(CONFIG_DEBUG_FS)) | |
| 310 | 310 | return; | |
| 311 | 311 | ||
| 312 | - | debugfs_create_file("firmware_revision", 0400, | |
| 312 | + | debugfs_create_file_unsafe("firmware_revision", 0400, | |
| 313 | 313 | d, adis16480, &adis16480_firmware_revision_fops); | |
| 314 | - | debugfs_create_file("firmware_date", 0400, | |
| 314 | + | debugfs_create_file_unsafe("firmware_date", 0400, | |
| 315 | 315 | d, adis16480, &adis16480_firmware_date_fops); | |
| 316 | 316 | debugfs_create_file_unsafe("serial_number", 0400, | |
| 317 | 317 | d, adis16480, &adis16480_serial_number_fops); | |
modified drivers/iio/imu/inv_icm42607/inv_icm42607_core.c
| @@ -537,8 +537,9 @@ static int inv_icm42607_enable_vddio_reg(struct inv_icm42607_state *st) | |||
| 537 | 537 | return 0; | |
| 538 | 538 | } | |
| 539 | 539 | ||
| 540 | - | static int inv_icm42607_sensors_off(struct inv_icm42607_state *st) | |
| 540 | + | static void inv_icm42607_sensors_off(void *_data) | |
| 541 | 541 | { | |
| 542 | + | struct inv_icm42607_state *st = _data; | |
| 542 | 543 | const struct device *dev = regmap_get_device(st->map); | |
| 543 | 544 | int ret; | |
| 544 | 545 | ||
| @@ -551,13 +552,6 @@ static int inv_icm42607_sensors_off(struct inv_icm42607_state *st) | |||
| 551 | 552 | st->conf.accel.mode); | |
| 552 | 553 | if (ret) | |
| 553 | 554 | dev_err(dev, "Unable to turn off sensors\n"); | |
| 554 | - | ||
| 555 | - | return ret; | |
| 556 | - | } | |
| 557 | - | ||
| 558 | - | static void inv_icm42607_sensors_off_action(void *data) | |
| 559 | - | { | |
| 560 | - | inv_icm42607_sensors_off(data); | |
| 561 | 555 | } | |
| 562 | 556 | ||
| 563 | 557 | static void inv_icm42607_disable_vddio_reg(void *_data) | |
| @@ -625,7 +619,7 @@ int inv_icm42607_core_probe(struct regmap *regmap, | |||
| 625 | 619 | * Ensure if sensors get turned on at some point, they're turned off | |
| 626 | 620 | * as part of teardown. | |
| 627 | 621 | */ | |
| 628 | - | ret = devm_add_action_or_reset(dev, inv_icm42607_sensors_off_action, st); | |
| 622 | + | ret = devm_add_action_or_reset(dev, inv_icm42607_sensors_off, st); | |
| 629 | 623 | if (ret) | |
| 630 | 624 | return ret; | |
| 631 | 625 | ||
| @@ -664,8 +658,9 @@ static int inv_icm42607_suspend(struct device *dev) | |||
| 664 | 658 | return 0; | |
| 665 | 659 | } | |
| 666 | 660 | ||
| 667 | - | static int inv_icm42607_resume_core(struct inv_icm42607_state *st) | |
| 661 | + | static int inv_icm42607_resume(struct device *dev) | |
| 668 | 662 | { | |
| 663 | + | struct inv_icm42607_state *st = dev_get_drvdata(dev); | |
| 669 | 664 | int ret; | |
| 670 | 665 | ||
| 671 | 666 | ret = inv_icm42607_enable_vddio_reg(st); | |
| @@ -674,25 +669,9 @@ static int inv_icm42607_resume_core(struct inv_icm42607_state *st) | |||
| 674 | 669 | ||
| 675 | 670 | /* Sync the regcache again after regulator shutdown. */ | |
| 676 | 671 | regcache_mark_dirty(st->map); | |
| 677 | - | ||
| 678 | - | return regcache_sync(st->map); | |
| 679 | - | } | |
| 680 | - | ||
| 681 | - | static int inv_icm42607_resume(struct device *dev) | |
| 682 | - | { | |
| 683 | - | struct inv_icm42607_state *st = dev_get_drvdata(dev); | |
| 684 | - | int ret; | |
| 685 | - | ||
| 686 | - | ret = inv_icm42607_resume_core(st); | |
| 687 | - | if (ret) { | |
| 688 | - | int rc; | |
| 689 | - | ||
| 690 | - | rc = pm_runtime_force_resume(dev); | |
| 691 | - | if (rc) | |
| 692 | - | dev_warn(dev, "Failed to restore runtime PM state: %d\n", rc); | |
| 693 | - | ||
| 672 | + | ret = regcache_sync(st->map); | |
| 673 | + | if (ret) | |
| 694 | 674 | return ret; | |
| 695 | - | } | |
| 696 | 675 | ||
| 697 | 676 | return pm_runtime_force_resume(dev); | |
| 698 | 677 | } | |
| @@ -709,7 +688,8 @@ static int inv_icm42607_runtime_suspend(struct device *dev) | |||
| 709 | 688 | * however the tradeoff is that an unused sensor won't be | |
| 710 | 689 | * turned off until the entire chip is no longer in use. | |
| 711 | 690 | */ | |
| 712 | - | return inv_icm42607_sensors_off(st); | |
| 691 | + | inv_icm42607_sensors_off(st); | |
| 692 | + | return 0; | |
| 713 | 693 | } | |
| 714 | 694 | ||
| 715 | 695 | EXPORT_NS_GPL_DEV_PM_OPS(inv_icm42607_pm_ops, IIO_ICM42607) = { | |
modified drivers/iio/industrialio-buffer.c
| @@ -1377,10 +1377,6 @@ EXPORT_SYMBOL_GPL(iio_update_buffers); | |||
| 1377 | 1377 | ||
| 1378 | 1378 | void iio_disable_all_buffers(struct iio_dev *indio_dev) | |
| 1379 | 1379 | { | |
| 1380 | - | struct iio_dev_opaque *iio_dev_opaque = to_iio_dev_opaque(indio_dev); | |
| 1381 | - | ||
| 1382 | - | guard(mutex)(&iio_dev_opaque->mlock); | |
| 1383 | - | ||
| 1384 | 1380 | iio_disable_buffers(indio_dev); | |
| 1385 | 1381 | iio_buffer_deactivate_all(indio_dev); | |
| 1386 | 1382 | } | |
| @@ -2466,8 +2462,7 @@ int iio_push_to_buffers_with_ts_unaligned(struct iio_dev *indio_dev, | |||
| 2466 | 2462 | ||
| 2467 | 2463 | bb = devm_krealloc(&indio_dev->dev, | |
| 2468 | 2464 | iio_dev_opaque->bounce_buffer, | |
| 2469 | - | indio_dev->scan_bytes, | |
| 2470 | - | GFP_KERNEL | __GFP_ZERO); | |
| 2465 | + | indio_dev->scan_bytes, GFP_KERNEL); | |
| 2471 | 2466 | if (!bb) | |
| 2472 | 2467 | return -ENOMEM; | |
| 2473 | 2468 | iio_dev_opaque->bounce_buffer = bb; | |
modified drivers/iio/industrialio-trigger.c
| @@ -509,8 +509,6 @@ static void iio_trig_release(struct device *device) | |||
| 509 | 509 | struct iio_trigger *trig = to_iio_trigger(device); | |
| 510 | 510 | int i; | |
| 511 | 511 | ||
| 512 | - | cancel_work_sync(&trig->reenable_work); | |
| 513 | - | ||
| 514 | 512 | if (trig->subirq_base) { | |
| 515 | 513 | for (i = 0; i < CONFIG_IIO_CONSUMERS_PER_TRIGGER; i++) { | |
| 516 | 514 | irq_modify_status(trig->subirq_base + i, | |
modified drivers/iio/light/gp2ap020a00f.c
| @@ -1497,7 +1497,6 @@ error_trigger_unregister: | |||
| 1497 | 1497 | iio_trigger_unregister(data->trig); | |
| 1498 | 1498 | error_free_irq: | |
| 1499 | 1499 | free_irq(client->irq, indio_dev); | |
| 1500 | - | irq_work_sync(&data->work); | |
| 1501 | 1500 | error_uninit_buffer: | |
| 1502 | 1501 | iio_triggered_buffer_cleanup(indio_dev); | |
| 1503 | 1502 | error_regulator_disable: | |
| @@ -1520,7 +1519,6 @@ static void gp2ap020a00f_remove(struct i2c_client *client) | |||
| 1520 | 1519 | iio_device_unregister(indio_dev); | |
| 1521 | 1520 | iio_trigger_unregister(data->trig); | |
| 1522 | 1521 | free_irq(client->irq, indio_dev); | |
| 1523 | - | irq_work_sync(&data->work); | |
| 1524 | 1522 | iio_triggered_buffer_cleanup(indio_dev); | |
| 1525 | 1523 | regulator_disable(data->vled_reg); | |
| 1526 | 1524 | } | |
modified drivers/iio/light/rohm-bu27034.c
| @@ -137,7 +137,6 @@ static const struct iio_gain_sel_pair bu27034_gains[] = { | |||
| 137 | 137 | #define BU27034_MEAS_MODE_200MS 2 | |
| 138 | 138 | #define BU27034_MEAS_MODE_400MS 4 | |
| 139 | 139 | ||
| 140 | - | #define BU27034_INT_TIME_US_MIN (55 * USEC_PER_MSEC) | |
| 141 | 140 | static const struct iio_itime_sel_mul bu27034_itimes[] = { | |
| 142 | 141 | GAIN_SCALE_ITIME_US(400000, BU27034_MEAS_MODE_400MS, 8), | |
| 143 | 142 | GAIN_SCALE_ITIME_US(200000, BU27034_MEAS_MODE_200MS, 4), | |
| @@ -297,7 +296,7 @@ static int bu27034_get_gain(struct bu27034_data *data, int chan, int *gain) | |||
| 297 | 296 | return 0; | |
| 298 | 297 | } | |
| 299 | 298 | ||
| 300 | - | static int bu27034_get_int_time(struct bu27034_data *data, int *itime) | |
| 299 | + | static int bu27034_get_int_time(struct bu27034_data *data) | |
| 301 | 300 | { | |
| 302 | 301 | int ret, sel; | |
| 303 | 302 | ||
| @@ -305,30 +304,24 @@ static int bu27034_get_int_time(struct bu27034_data *data, int *itime) | |||
| 305 | 304 | if (ret) | |
| 306 | 305 | return ret; | |
| 307 | 306 | ||
| 308 | - | ret = iio_gts_find_int_time_by_sel(&data->gts, | |
| 309 | - | sel & BU27034_MASK_MEAS_MODE); | |
| 310 | - | if (ret < 0) | |
| 311 | - | return ret; | |
| 312 | - | ||
| 313 | - | *itime = ret; | |
| 314 | - | ||
| 315 | - | return 0; | |
| 307 | + | return iio_gts_find_int_time_by_sel(&data->gts, | |
| 308 | + | sel & BU27034_MASK_MEAS_MODE); | |
| 316 | 309 | } | |
| 317 | 310 | ||
| 318 | 311 | static int _bu27034_get_scale(struct bu27034_data *data, int channel, int *val, | |
| 319 | 312 | int *val2) | |
| 320 | 313 | { | |
| 321 | - | int gain, itime, ret; | |
| 314 | + | int gain, ret; | |
| 322 | 315 | ||
| 323 | 316 | ret = bu27034_get_gain(data, channel, &gain); | |
| 324 | 317 | if (ret) | |
| 325 | 318 | return ret; | |
| 326 | 319 | ||
| 327 | - | ret = bu27034_get_int_time(data, &itime); | |
| 328 | - | if (ret) | |
| 320 | + | ret = bu27034_get_int_time(data); | |
| 321 | + | if (ret < 0) | |
| 329 | 322 | return ret; | |
| 330 | 323 | ||
| 331 | - | return iio_gts_get_scale(&data->gts, gain, itime, val, val2); | |
| 324 | + | return iio_gts_get_scale(&data->gts, gain, ret, val, val2); | |
| 332 | 325 | } | |
| 333 | 326 | ||
| 334 | 327 | static int bu27034_get_scale(struct bu27034_data *data, int channel, int *val, | |
| @@ -404,10 +397,12 @@ static int bu27034_try_set_int_time(struct bu27034_data *data, int time_us) | |||
| 404 | 397 | int ret, int_time_old, i; | |
| 405 | 398 | ||
| 406 | 399 | guard(mutex)(&data->mutex); | |
| 407 | - | ret = bu27034_get_int_time(data, &int_time_old); | |
| 408 | - | if (ret) | |
| 400 | + | ret = bu27034_get_int_time(data); | |
| 401 | + | if (ret < 0) | |
| 409 | 402 | return ret; | |
| 410 | 403 | ||
| 404 | + | int_time_old = ret; | |
| 405 | + | ||
| 411 | 406 | if (!iio_gts_valid_time(&data->gts, time_us)) { | |
| 412 | 407 | dev_err(data->dev, "Unsupported integration time %u\n", | |
| 413 | 408 | time_us); | |
| @@ -420,7 +415,7 @@ static int bu27034_try_set_int_time(struct bu27034_data *data, int time_us) | |||
| 420 | 415 | for (i = 0; i < numg; i++) { | |
| 421 | 416 | ret = bu27034_get_gain(data, gains[i].chan, &gains[i].old_gain); | |
| 422 | 417 | if (ret) | |
| 423 | - | return ret; | |
| 418 | + | return 0; | |
| 424 | 419 | ||
| 425 | 420 | ret = iio_gts_find_new_gain_by_old_gain_time(&data->gts, | |
| 426 | 421 | gains[i].old_gain, | |
| @@ -846,7 +841,7 @@ static int bu27034_meas_set(struct bu27034_data *data, bool en) | |||
| 846 | 841 | static int bu27034_get_single_result(struct bu27034_data *data, int chan, | |
| 847 | 842 | int *val) | |
| 848 | 843 | { | |
| 849 | - | int ret, itime; | |
| 844 | + | int ret; | |
| 850 | 845 | ||
| 851 | 846 | if (chan < BU27034_CHAN_DATA0 || chan > BU27034_CHAN_DATA1) | |
| 852 | 847 | return -EINVAL; | |
| @@ -855,11 +850,11 @@ static int bu27034_get_single_result(struct bu27034_data *data, int chan, | |||
| 855 | 850 | if (ret) | |
| 856 | 851 | return ret; | |
| 857 | 852 | ||
| 858 | - | ret = bu27034_get_int_time(data, &itime); | |
| 859 | - | if (ret) | |
| 853 | + | ret = bu27034_get_int_time(data); | |
| 854 | + | if (ret < 0) | |
| 860 | 855 | return ret; | |
| 861 | 856 | ||
| 862 | - | msleep(itime / 1000); | |
| 857 | + | msleep(ret / 1000); | |
| 863 | 858 | ||
| 864 | 859 | return bu27034_read_result(data, chan, val); | |
| 865 | 860 | } | |
| @@ -909,10 +904,12 @@ static int bu27034_calc_mlux(struct bu27034_data *data, __le16 *res, int *val) | |||
| 909 | 904 | if (ret) | |
| 910 | 905 | return ret; | |
| 911 | 906 | ||
| 912 | - | ret = bu27034_get_int_time(data, &meastime); | |
| 913 | - | if (ret) | |
| 907 | + | ret = bu27034_get_int_time(data); | |
| 908 | + | if (ret < 0) | |
| 914 | 909 | return ret; | |
| 915 | 910 | ||
| 911 | + | meastime = ret; | |
| 912 | + | ||
| 916 | 913 | d1_d0_ratio_scaled = (unsigned int)ch1 * (unsigned int)gain0 * 100; | |
| 917 | 914 | helper64 = (u64)ch1 * (u64)gain0 * 100LLU; | |
| 918 | 915 | ||
| @@ -973,9 +970,9 @@ static int bu27034_read_raw(struct iio_dev *idev, | |||
| 973 | 970 | switch (mask) { | |
| 974 | 971 | case IIO_CHAN_INFO_INT_TIME: | |
| 975 | 972 | *val = 0; | |
| 976 | - | ret = bu27034_get_int_time(data, val2); | |
| 977 | - | if (ret) | |
| 978 | - | return ret; | |
| 973 | + | *val2 = bu27034_get_int_time(data); | |
| 974 | + | if (*val2 < 0) | |
| 975 | + | return *val2; | |
| 979 | 976 | ||
| 980 | 977 | return IIO_VAL_INT_PLUS_MICRO; | |
| 981 | 978 | ||
| @@ -1160,20 +1157,11 @@ static int bu27034_buffer_thread(void *arg) | |||
| 1160 | 1157 | { | |
| 1161 | 1158 | struct iio_dev *idev = arg; | |
| 1162 | 1159 | struct bu27034_data *data; | |
| 1163 | - | int wait_ms, ret; | |
| 1160 | + | int wait_ms; | |
| 1164 | 1161 | ||
| 1165 | 1162 | data = iio_priv(idev); | |
| 1166 | 1163 | ||
| 1167 | - | /* | |
| 1168 | - | * If reading the integration time fails, default to the minimum so we | |
| 1169 | - | * don't lose samples. This may waste CPU cycles, but as a hardening | |
| 1170 | - | * against theoretical, once-in-a-blue-moon error, this should be Ok. | |
| 1171 | - | */ | |
| 1172 | - | wait_ms = BU27034_INT_TIME_US_MIN; | |
| 1173 | - | ret = bu27034_get_int_time(data, &wait_ms); | |
| 1174 | - | if (ret) | |
| 1175 | - | dev_warn(data->dev, "Failed to get integration time\n"); | |
| 1176 | - | ||
| 1164 | + | wait_ms = bu27034_get_int_time(data); | |
| 1177 | 1165 | wait_ms /= 1000; | |
| 1178 | 1166 | ||
| 1179 | 1167 | wait_ms -= BU27034_MEAS_WAIT_PREMATURE_MS; | |
modified drivers/iio/pressure/bmp280-core.c
| @@ -839,7 +839,7 @@ static int bmp280_write_sampling_frequency(struct bmp280_data *data, | |||
| 839 | 839 | int val, int val2) | |
| 840 | 840 | { | |
| 841 | 841 | const int (*avail)[2] = data->chip_info->sampling_freq_avail; | |
| 842 | - | const int n = data->chip_info->num_sampling_freq_avail / 2; | |
| 842 | + | const int n = data->chip_info->num_sampling_freq_avail; | |
| 843 | 843 | int ret, prev; | |
| 844 | 844 | int i; | |
| 845 | 845 | ||
modified drivers/iio/pressure/rohm-bm1390.c
| @@ -289,7 +289,7 @@ static int bm1390_read_data(struct bm1390_data *data, | |||
| 289 | 289 | if (warn) | |
| 290 | 290 | dev_warn(data->dev, "Failed to stop measurement (%d)\n", warn); | |
| 291 | 291 | ||
| 292 | - | return ret; | |
| 292 | + | return 0; | |
| 293 | 293 | } | |
| 294 | 294 | ||
| 295 | 295 | static int bm1390_read_raw(struct iio_dev *idev, | |
modified drivers/iio/proximity/aw96103.c
| @@ -24,7 +24,6 @@ | |||
| 24 | 24 | #define AW96103_BIN_VALID_DATA_OFFSET 64 | |
| 25 | 25 | #define AW96103_BIN_DATA_LEN_OFFSET 16 | |
| 26 | 26 | #define AW96103_BIN_DATA_REG_NUM_SIZE 4 | |
| 27 | - | #define AW96103_BIN_REG_SIZE 6 | |
| 28 | 27 | #define AW96103_BIN_CHIP_TYPE_SIZE 8 | |
| 29 | 28 | #define AW96103_BIN_CHIP_TYPE_OFFSET 24 | |
| 30 | 29 | ||
| @@ -230,27 +229,14 @@ static const struct aw_chip_info aw_chip_info_tbl[] = { | |||
| 230 | 229 | }, | |
| 231 | 230 | }; | |
| 232 | 231 | ||
| 233 | - | static int aw96103_parsing_bin_file(struct aw_bin *bin) | |
| 232 | + | static void aw96103_parsing_bin_file(struct aw_bin *bin) | |
| 234 | 233 | { | |
| 235 | - | u32 data_len; | |
| 236 | - | ||
| 237 | - | if (bin->len < AW96103_BIN_VALID_DATA_OFFSET) | |
| 238 | - | return -EINVAL; | |
| 239 | - | ||
| 240 | - | data_len = get_unaligned_le32(bin->data + AW96103_BIN_DATA_LEN_OFFSET); | |
| 241 | - | if (data_len < AW96103_BIN_DATA_REG_NUM_SIZE) | |
| 242 | - | return -EINVAL; | |
| 243 | - | ||
| 244 | - | bin->valid_data_len = data_len - AW96103_BIN_DATA_REG_NUM_SIZE; | |
| 245 | - | if (bin->valid_data_len > bin->len - AW96103_BIN_VALID_DATA_OFFSET || | |
| 246 | - | bin->valid_data_len % AW96103_BIN_REG_SIZE) | |
| 247 | - | return -EINVAL; | |
| 248 | - | ||
| 249 | 234 | bin->valid_data_addr = AW96103_BIN_VALID_DATA_OFFSET; | |
| 235 | + | bin->valid_data_len = | |
| 236 | + | *(unsigned int *)(bin->data + AW96103_BIN_DATA_LEN_OFFSET) - | |
| 237 | + | AW96103_BIN_DATA_REG_NUM_SIZE; | |
| 250 | 238 | memcpy(bin->chip_type, bin->data + AW96103_BIN_CHIP_TYPE_OFFSET, | |
| 251 | 239 | AW96103_BIN_CHIP_TYPE_SIZE); | |
| 252 | - | ||
| 253 | - | return 0; | |
| 254 | 240 | } | |
| 255 | 241 | ||
| 256 | 242 | static const struct regmap_config aw96103_regmap_confg = { | |
| @@ -514,7 +500,7 @@ static int aw96103_bin_valid_loaded(struct aw96103 *aw96103, | |||
| 514 | 500 | int ret; | |
| 515 | 501 | ||
| 516 | 502 | for (i = 0; i < aw_bin_data_s->valid_data_len; | |
| 517 | - | i += AW96103_BIN_REG_SIZE, start_addr += AW96103_BIN_REG_SIZE) { | |
| 503 | + | i += 6, start_addr += 6) { | |
| 518 | 504 | reg_addr = get_unaligned_le16(aw_bin_data_s->data + start_addr); | |
| 519 | 505 | reg_data = get_unaligned_le32(aw_bin_data_s->data + | |
| 520 | 506 | start_addr + 2); | |
| @@ -564,8 +550,6 @@ static int aw96103_para_loaded(struct aw96103 *aw96103) | |||
| 564 | 550 | static int aw96103_cfg_all_loaded(const struct firmware *cont, | |
| 565 | 551 | struct aw96103 *aw96103) | |
| 566 | 552 | { | |
| 567 | - | int ret; | |
| 568 | - | ||
| 569 | 553 | if (!cont) | |
| 570 | 554 | return -EINVAL; | |
| 571 | 555 | ||
| @@ -577,9 +561,7 @@ static int aw96103_cfg_all_loaded(const struct firmware *cont, | |||
| 577 | 561 | aw_bin->len = cont->size; | |
| 578 | 562 | memcpy(aw_bin->data, cont->data, cont->size); | |
| 579 | 563 | release_firmware(cont); | |
| 580 | - | ret = aw96103_parsing_bin_file(aw_bin); | |
| 581 | - | if (ret) | |
| 582 | - | return ret; | |
| 564 | + | aw96103_parsing_bin_file(aw_bin); | |
| 583 | 565 | ||
| 584 | 566 | return aw96103_bin_valid_loaded(aw96103, aw_bin); | |
| 585 | 567 | } | |
modified drivers/iio/proximity/isl29501.c
| @@ -226,7 +226,7 @@ err: | |||
| 226 | 226 | return ret; | |
| 227 | 227 | } | |
| 228 | 228 | ||
| 229 | - | static int isl29501_register_write(struct isl29501_private *isl29501, | |
| 229 | + | static u32 isl29501_register_write(struct isl29501_private *isl29501, | |
| 230 | 230 | enum isl29501_register_name name, | |
| 231 | 231 | u32 value) | |
| 232 | 232 | { | |
modified drivers/iio/proximity/pulsedlight-lidar-lite-v2.c
| @@ -294,14 +294,12 @@ static int lidar_probe(struct i2c_client *client) | |||
| 294 | 294 | ||
| 295 | 295 | ret = pm_runtime_set_active(&client->dev); | |
| 296 | 296 | if (ret) | |
| 297 | - | goto error_unreg_dev; | |
| 297 | + | goto error_unreg_buffer; | |
| 298 | 298 | pm_runtime_enable(&client->dev); | |
| 299 | 299 | pm_runtime_idle(&client->dev); | |
| 300 | 300 | ||
| 301 | 301 | return 0; | |
| 302 | 302 | ||
| 303 | - | error_unreg_dev: | |
| 304 | - | iio_device_unregister(indio_dev); | |
| 305 | 303 | error_unreg_buffer: | |
| 306 | 304 | iio_triggered_buffer_cleanup(indio_dev); | |
| 307 | 305 | ||
modified drivers/iio/proximity/sx9324.c
| @@ -222,7 +222,7 @@ static const struct iio_chan_spec_ext_info sx9324_channel_ext_info[] = { | |||
| 222 | 222 | .scan_index = idx, \ | |
| 223 | 223 | .scan_type = { \ | |
| 224 | 224 | .sign = 's', \ | |
| 225 | - | .realbits = 16, \ | |
| 225 | + | .realbits = 12, \ | |
| 226 | 226 | .storagebits = 16, \ | |
| 227 | 227 | .endianness = IIO_BE, \ | |
| 228 | 228 | }, \ | |
modified drivers/iio/proximity/vcnl3020.c
| @@ -584,26 +584,16 @@ static irqreturn_t vcnl3020_handle_irq_thread(int irq, void *p) | |||
| 584 | 584 | return IRQ_HANDLED; | |
| 585 | 585 | } | |
| 586 | 586 | ||
| 587 | - | if (!(isr & (VCNL_INT_TH_HI | VCNL_INT_TH_LOW))) | |
| 587 | + | if (!(isr & VCNL_ICR_THRES_EN)) | |
| 588 | 588 | return IRQ_NONE; | |
| 589 | 589 | ||
| 590 | - | if (isr & VCNL_INT_TH_HI) { | |
| 591 | - | iio_push_event(indio_dev, | |
| 592 | - | IIO_UNMOD_EVENT_CODE(IIO_PROXIMITY, 0, | |
| 593 | - | IIO_EV_TYPE_THRESH, | |
| 594 | - | IIO_EV_DIR_RISING), | |
| 595 | - | iio_get_time_ns(indio_dev)); | |
| 596 | - | } | |
| 597 | - | ||
| 598 | - | if (isr & VCNL_INT_TH_LOW) { | |
| 599 | - | iio_push_event(indio_dev, | |
| 600 | - | IIO_UNMOD_EVENT_CODE(IIO_PROXIMITY, 0, | |
| 601 | - | IIO_EV_TYPE_THRESH, | |
| 602 | - | IIO_EV_DIR_FALLING), | |
| 603 | - | iio_get_time_ns(indio_dev)); | |
| 604 | - | } | |
| 590 | + | iio_push_event(indio_dev, | |
| 591 | + | IIO_UNMOD_EVENT_CODE(IIO_PROXIMITY, 1, | |
| 592 | + | IIO_EV_TYPE_THRESH, | |
| 593 | + | IIO_EV_DIR_RISING), | |
| 594 | + | iio_get_time_ns(indio_dev)); | |
| 605 | 595 | ||
| 606 | - | rc = regmap_write(data->regmap, VCNL_ISR, isr & (VCNL_INT_TH_HI | VCNL_INT_TH_LOW)); | |
| 596 | + | rc = regmap_write(data->regmap, VCNL_ISR, isr & VCNL_ICR_THRES_EN); | |
| 607 | 597 | if (rc) | |
| 608 | 598 | dev_err(data->dev, "Error (%d) writing in reg (0x%x)\n", | |
| 609 | 599 | rc, VCNL_ISR); | |
modified drivers/iio/proximity/vl53l0x-i2c.c
| @@ -219,10 +219,7 @@ static int vl53l0x_read_raw(struct iio_dev *indio_dev, | |||
| 219 | 219 | ||
| 220 | 220 | switch (mask) { | |
| 221 | 221 | case IIO_CHAN_INFO_RAW: | |
| 222 | - | if (!iio_device_claim_direct(indio_dev)) | |
| 223 | - | return -EBUSY; | |
| 224 | 222 | ret = vl53l0x_read_proximity(data, chan, val); | |
| 225 | - | iio_device_release_direct(indio_dev); | |
| 226 | 223 | if (ret < 0) | |
| 227 | 224 | return ret; | |
| 228 | 225 | ||
modified drivers/input/joystick/xpad.c
| @@ -302,8 +302,6 @@ static const struct xpad_device { | |||
| 302 | 302 | { 0x17ef, 0x6182, "Lenovo Legion Controller for Windows", 0, XTYPE_XBOX360 }, | |
| 303 | 303 | { 0x1949, 0x041a, "Amazon Game Controller", 0, XTYPE_XBOX360 }, | |
| 304 | 304 | { 0x1a86, 0xe310, "Legion Go S", 0, XTYPE_XBOX360 }, | |
| 305 | - | { 0x1b1c, 0x2b1f, "Corsair Novablade Pro (Wired)", 0, XTYPE_XBOX360 }, | |
| 306 | - | { 0x1b1c, 0x2b2b, "Corsair Novablade Pro (2.4 GHz Receiver)", 0, XTYPE_XBOX360 }, | |
| 307 | 305 | { 0x1bad, 0x0002, "Harmonix Rock Band Guitar", 0, XTYPE_XBOX360 }, | |
| 308 | 306 | { 0x1bad, 0x0003, "Harmonix Rock Band Drumkit", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 }, | |
| 309 | 307 | { 0x1bad, 0x0130, "Ion Drum Rocker", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 }, | |
| @@ -381,7 +379,6 @@ static const struct xpad_device { | |||
| 381 | 379 | { 0x2993, 0x2001, "TECNO Pocket Go", 0, XTYPE_XBOX360 }, | |
| 382 | 380 | { 0x2dc8, 0x2000, "8BitDo Pro 2 Wired Controller fox Xbox", 0, XTYPE_XBOXONE }, | |
| 383 | 381 | { 0x2dc8, 0x200f, "8BitDo Ultimate 3-mode Controller for Xbox", MAP_SHARE_BUTTON, XTYPE_XBOXONE }, | |
| 384 | - | { 0x2dc8, 0x201e, "8BitDo Pro 2 Wired Controller for Xbox", MAP_SHARE_BUTTON, XTYPE_XBOXONE }, | |
| 385 | 382 | { 0x2dc8, 0x3106, "8BitDo Ultimate Wireless / Pro 2 Wired Controller", 0, XTYPE_XBOX360 }, | |
| 386 | 383 | { 0x2dc8, 0x3109, "8BitDo Ultimate Wireless Bluetooth", 0, XTYPE_XBOX360 }, | |
| 387 | 384 | { 0x2dc8, 0x310a, "8BitDo Ultimate 2C Wireless Controller", 0, XTYPE_XBOX360 }, | |
| @@ -548,7 +545,6 @@ static const struct usb_device_id xpad_table[] = { | |||
| 548 | 545 | XPAD_XBOX360_VENDOR(0x17ef), /* Lenovo */ | |
| 549 | 546 | XPAD_XBOX360_VENDOR(0x1949), /* Amazon controllers */ | |
| 550 | 547 | XPAD_XBOX360_VENDOR(0x1a86), /* Nanjing Qinheng Microelectronics (WCH) */ | |
| 551 | - | XPAD_XBOX360_VENDOR(0x1b1c), /* Corsair controllers */ | |
| 552 | 548 | XPAD_XBOX360_VENDOR(0x1bad), /* Harmonix Rock Band guitar and drums */ | |
| 553 | 549 | XPAD_XBOX360_VENDOR(0x1ee9), /* ZOTAC Technology Limited */ | |
| 554 | 550 | XPAD_XBOX360_VENDOR(0x20bc), /* BETOP wireless dongles */ | |
modified drivers/input/keyboard/atkbd.c
| @@ -1938,14 +1938,6 @@ static const struct dmi_system_id atkbd_dmi_quirk_table[] __initconst = { | |||
| 1938 | 1938 | }, | |
| 1939 | 1939 | .callback = atkbd_deactivate_fixup, | |
| 1940 | 1940 | }, | |
| 1941 | - | { | |
| 1942 | - | /* Lenovo IdeaPad Slim 3 15IWC11 (83RR) */ | |
| 1943 | - | .matches = { | |
| 1944 | - | DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), | |
| 1945 | - | DMI_MATCH(DMI_PRODUCT_NAME, "83RR"), | |
| 1946 | - | }, | |
| 1947 | - | .callback = atkbd_deactivate_fixup, | |
| 1948 | - | }, | |
| 1949 | 1941 | { | |
| 1950 | 1942 | /* Xiaomi Book Pro 14 (TM2424) */ | |
| 1951 | 1943 | .matches = { | |
modified drivers/input/misc/ati_remote2.c
| @@ -672,7 +672,8 @@ static ssize_t ati_remote2_show_channel_mask(struct device *dev, | |||
| 672 | 672 | struct device_attribute *attr, | |
| 673 | 673 | char *buf) | |
| 674 | 674 | { | |
| 675 | - | struct usb_interface *intf = to_usb_interface(dev); | |
| 675 | + | struct usb_device *udev = to_usb_device(dev); | |
| 676 | + | struct usb_interface *intf = usb_ifnum_to_if(udev, 0); | |
| 676 | 677 | struct ati_remote2 *ar2 = usb_get_intfdata(intf); | |
| 677 | 678 | ||
| 678 | 679 | return sprintf(buf, "0x%04x\n", ar2->channel_mask); | |
| @@ -682,7 +683,8 @@ static ssize_t ati_remote2_store_channel_mask(struct device *dev, | |||
| 682 | 683 | struct device_attribute *attr, | |
| 683 | 684 | const char *buf, size_t count) | |
| 684 | 685 | { | |
| 685 | - | struct usb_interface *intf = to_usb_interface(dev); | |
| 686 | + | struct usb_device *udev = to_usb_device(dev); | |
| 687 | + | struct usb_interface *intf = usb_ifnum_to_if(udev, 0); | |
| 686 | 688 | struct ati_remote2 *ar2 = usb_get_intfdata(intf); | |
| 687 | 689 | unsigned int mask; | |
| 688 | 690 | int r; | |
| @@ -718,7 +720,8 @@ static ssize_t ati_remote2_show_mode_mask(struct device *dev, | |||
| 718 | 720 | struct device_attribute *attr, | |
| 719 | 721 | char *buf) | |
| 720 | 722 | { | |
| 721 | - | struct usb_interface *intf = to_usb_interface(dev); | |
| 723 | + | struct usb_device *udev = to_usb_device(dev); | |
| 724 | + | struct usb_interface *intf = usb_ifnum_to_if(udev, 0); | |
| 722 | 725 | struct ati_remote2 *ar2 = usb_get_intfdata(intf); | |
| 723 | 726 | ||
| 724 | 727 | return sprintf(buf, "0x%02x\n", ar2->mode_mask); | |
| @@ -728,7 +731,8 @@ static ssize_t ati_remote2_store_mode_mask(struct device *dev, | |||
| 728 | 731 | struct device_attribute *attr, | |
| 729 | 732 | const char *buf, size_t count) | |
| 730 | 733 | { | |
| 731 | - | struct usb_interface *intf = to_usb_interface(dev); | |
| 734 | + | struct usb_device *udev = to_usb_device(dev); | |
| 735 | + | struct usb_interface *intf = usb_ifnum_to_if(udev, 0); | |
| 732 | 736 | struct ati_remote2 *ar2 = usb_get_intfdata(intf); | |
| 733 | 737 | unsigned int mask; | |
| 734 | 738 | int err; | |
modified drivers/input/mouse/synaptics.c
| @@ -192,7 +192,6 @@ static const char * const smbus_pnp_ids[] = { | |||
| 192 | 192 | "LEN2054", /* E480 */ | |
| 193 | 193 | "LEN2055", /* E580 */ | |
| 194 | 194 | "LEN2058", /* E490 */ | |
| 195 | - | "LEN205b", /* T490 */ | |
| 196 | 195 | "LEN2068", /* T14 Gen 1 */ | |
| 197 | 196 | "SYN1221", /* TUXEDO InfinityBook Pro 14 v5 */ | |
| 198 | 197 | "SYN3003", /* HP EliteBook 850 G1 */ | |
| @@ -1840,10 +1839,8 @@ static int synaptics_setup_intertouch(struct psmouse *psmouse, | |||
| 1840 | 1839 | return -ENXIO; | |
| 1841 | 1840 | } | |
| 1842 | 1841 | ||
| 1843 | - | /* Disable intertouch on known-broken T440p board revisions */ | |
| 1844 | - | if (info->board_id == 2722 && | |
| 1845 | - | psmouse_matches_pnp_id(psmouse, | |
| 1846 | - | (const char * const []){"LEN0036", NULL})) { | |
| 1842 | + | /* Disable intertouch on known-broken board revisions */ | |
| 1843 | + | if (info->board_id == 2722) { | |
| 1847 | 1844 | psmouse_info(psmouse, | |
| 1848 | 1845 | "Disabling intertouch for board id %u\n", | |
| 1849 | 1846 | info->board_id); | |
modified drivers/input/serio/i8042-acpipnpio.h
| @@ -671,15 +671,6 @@ static const struct dmi_system_id i8042_dmi_quirk_table[] __initconst = { | |||
| 671 | 671 | }, | |
| 672 | 672 | .driver_data = (void *)(SERIO_QUIRK_NOAUX) | |
| 673 | 673 | }, | |
| 674 | - | { | |
| 675 | - | /* Fujitsu LIFEBOOK U7410 */ | |
| 676 | - | /* Mux mode also disturbs the EC keyboard, causing spurious ACKs */ | |
| 677 | - | .matches = { | |
| 678 | - | DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU CLIENT COMPUTING LIMITED"), | |
| 679 | - | DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK U7410"), | |
| 680 | - | }, | |
| 681 | - | .driver_data = (void *)(SERIO_QUIRK_NOMUX) | |
| 682 | - | }, | |
| 683 | 674 | { | |
| 684 | 675 | /* Gigabyte M912 */ | |
| 685 | 676 | .matches = { | |
modified drivers/input/touchscreen/s6sy761.c
| @@ -500,22 +500,10 @@ static int s6sy761_suspend(struct device *dev) | |||
| 500 | 500 | static int s6sy761_resume(struct device *dev) | |
| 501 | 501 | { | |
| 502 | 502 | struct s6sy761_data *sdata = dev_get_drvdata(dev); | |
| 503 | - | int err; | |
| 504 | - | ||
| 505 | - | err = s6sy761_power_on(sdata); | |
| 506 | - | if (err) | |
| 507 | - | return err; | |
| 508 | 503 | ||
| 509 | 504 | enable_irq(sdata->client->irq); | |
| 510 | 505 | ||
| 511 | - | guard(mutex)(&sdata->input->mutex); | |
| 512 | - | ||
| 513 | - | if (!input_device_enabled(sdata->input)) | |
| 514 | - | return 0; | |
| 515 | - | ||
| 516 | - | err = i2c_smbus_write_byte(sdata->client, S6SY761_SENSE_ON); | |
| 517 | - | ||
| 518 | - | return err; | |
| 506 | + | return s6sy761_power_on(sdata); | |
| 519 | 507 | } | |
| 520 | 508 | ||
| 521 | 509 | static const struct dev_pm_ops s6sy761_pm_ops = { | |
modified drivers/interconnect/qcom/x1e80100.c
| @@ -173,6 +173,13 @@ static struct qcom_icc_node qhm_qspi = { | |||
| 173 | 173 | .name = "qhm_qspi", | |
| 174 | 174 | .channels = 1, | |
| 175 | 175 | .buswidth = 4, | |
| 176 | + | .qosbox = &(const struct qcom_icc_qosbox) { | |
| 177 | + | .num_ports = 1, | |
| 178 | + | .port_offsets = { 0xb000 }, | |
| 179 | + | .prio = 2, | |
| 180 | + | .urg_fwd = 0, | |
| 181 | + | .prio_fwd_disable = 1, | |
| 182 | + | }, | |
| 176 | 183 | .num_links = 1, | |
| 177 | 184 | .link_nodes = { &qns_a1noc_snoc }, | |
| 178 | 185 | }; | |
| @@ -181,6 +188,13 @@ static struct qcom_icc_node qhm_qup1 = { | |||
| 181 | 188 | .name = "qhm_qup1", | |
| 182 | 189 | .channels = 1, | |
| 183 | 190 | .buswidth = 4, | |
| 191 | + | .qosbox = &(const struct qcom_icc_qosbox) { | |
| 192 | + | .num_ports = 1, | |
| 193 | + | .port_offsets = { 0xc000 }, | |
| 194 | + | .prio = 2, | |
| 195 | + | .urg_fwd = 0, | |
| 196 | + | .prio_fwd_disable = 1, | |
| 197 | + | }, | |
| 184 | 198 | .num_links = 1, | |
| 185 | 199 | .link_nodes = { &qns_a1noc_snoc }, | |
| 186 | 200 | }; | |
| @@ -189,6 +203,13 @@ static struct qcom_icc_node xm_sdc4 = { | |||
| 189 | 203 | .name = "xm_sdc4", | |
| 190 | 204 | .channels = 1, | |
| 191 | 205 | .buswidth = 8, | |
| 206 | + | .qosbox = &(const struct qcom_icc_qosbox) { | |
| 207 | + | .num_ports = 1, | |
| 208 | + | .port_offsets = { 0xd000 }, | |
| 209 | + | .prio = 2, | |
| 210 | + | .urg_fwd = 0, | |
| 211 | + | .prio_fwd_disable = 1, | |
| 212 | + | }, | |
| 192 | 213 | .num_links = 1, | |
| 193 | 214 | .link_nodes = { &qns_a1noc_snoc }, | |
| 194 | 215 | }; | |
| @@ -197,6 +218,13 @@ static struct qcom_icc_node xm_ufs_mem = { | |||
| 197 | 218 | .name = "xm_ufs_mem", | |
| 198 | 219 | .channels = 1, | |
| 199 | 220 | .buswidth = 16, | |
| 221 | + | .qosbox = &(const struct qcom_icc_qosbox) { | |
| 222 | + | .num_ports = 1, | |
| 223 | + | .port_offsets = { 0xe000 }, | |
| 224 | + | .prio = 2, | |
| 225 | + | .urg_fwd = 0, | |
| 226 | + | .prio_fwd_disable = 1, | |
| 227 | + | }, | |
| 200 | 228 | .num_links = 1, | |
| 201 | 229 | .link_nodes = { &qns_a1noc_snoc }, | |
| 202 | 230 | }; | |
| @@ -205,6 +233,13 @@ static struct qcom_icc_node qhm_qup0 = { | |||
| 205 | 233 | .name = "qhm_qup0", | |
| 206 | 234 | .channels = 1, | |
| 207 | 235 | .buswidth = 4, | |
| 236 | + | .qosbox = &(const struct qcom_icc_qosbox) { | |
| 237 | + | .num_ports = 1, | |
| 238 | + | .port_offsets = { 0x16000 }, | |
| 239 | + | .prio = 2, | |
| 240 | + | .urg_fwd = 0, | |
| 241 | + | .prio_fwd_disable = 1, | |
| 242 | + | }, | |
| 208 | 243 | .num_links = 1, | |
| 209 | 244 | .link_nodes = { &qns_a2noc_snoc }, | |
| 210 | 245 | }; | |
| @@ -213,6 +248,13 @@ static struct qcom_icc_node qhm_qup2 = { | |||
| 213 | 248 | .name = "qhm_qup2", | |
| 214 | 249 | .channels = 1, | |
| 215 | 250 | .buswidth = 4, | |
| 251 | + | .qosbox = &(const struct qcom_icc_qosbox) { | |
| 252 | + | .num_ports = 1, | |
| 253 | + | .port_offsets = { 0x11000 }, | |
| 254 | + | .prio = 2, | |
| 255 | + | .urg_fwd = 0, | |
| 256 | + | .prio_fwd_disable = 1, | |
| 257 | + | }, | |
| 216 | 258 | .num_links = 1, | |
| 217 | 259 | .link_nodes = { &qns_a2noc_snoc }, | |
| 218 | 260 | }; | |
| @@ -221,6 +263,13 @@ static struct qcom_icc_node qxm_crypto = { | |||
| 221 | 263 | .name = "qxm_crypto", | |
| 222 | 264 | .channels = 1, | |
| 223 | 265 | .buswidth = 8, | |
| 266 | + | .qosbox = &(const struct qcom_icc_qosbox) { | |
| 267 | + | .num_ports = 1, | |
| 268 | + | .port_offsets = { 0x12000 }, | |
| 269 | + | .prio = 2, | |
| 270 | + | .urg_fwd = 0, | |
| 271 | + | .prio_fwd_disable = 1, | |
| 272 | + | }, | |
| 224 | 273 | .num_links = 1, | |
| 225 | 274 | .link_nodes = { &qns_a2noc_snoc }, | |
| 226 | 275 | }; | |
| @@ -237,6 +286,13 @@ static struct qcom_icc_node xm_qdss_etr_0 = { | |||
| 237 | 286 | .name = "xm_qdss_etr_0", | |
| 238 | 287 | .channels = 1, | |
| 239 | 288 | .buswidth = 8, | |
| 289 | + | .qosbox = &(const struct qcom_icc_qosbox) { | |
| 290 | + | .num_ports = 1, | |
| 291 | + | .port_offsets = { 0x13000 }, | |
| 292 | + | .prio = 2, | |
| 293 | + | .urg_fwd = 0, | |
| 294 | + | .prio_fwd_disable = 1, | |
| 295 | + | }, | |
| 240 | 296 | .num_links = 1, | |
| 241 | 297 | .link_nodes = { &qns_a2noc_snoc }, | |
| 242 | 298 | }; | |
| @@ -245,6 +301,13 @@ static struct qcom_icc_node xm_qdss_etr_1 = { | |||
| 245 | 301 | .name = "xm_qdss_etr_1", | |
| 246 | 302 | .channels = 1, | |
| 247 | 303 | .buswidth = 8, | |
| 304 | + | .qosbox = &(const struct qcom_icc_qosbox) { | |
| 305 | + | .num_ports = 1, | |
| 306 | + | .port_offsets = { 0x14000 }, | |
| 307 | + | .prio = 2, | |
| 308 | + | .urg_fwd = 0, | |
| 309 | + | .prio_fwd_disable = 1, | |
| 310 | + | }, | |
| 248 | 311 | .num_links = 1, | |
| 249 | 312 | .link_nodes = { &qns_a2noc_snoc }, | |
| 250 | 313 | }; | |
| @@ -253,6 +316,13 @@ static struct qcom_icc_node xm_sdc2 = { | |||
| 253 | 316 | .name = "xm_sdc2", | |
| 254 | 317 | .channels = 1, | |
| 255 | 318 | .buswidth = 8, | |
| 319 | + | .qosbox = &(const struct qcom_icc_qosbox) { | |
| 320 | + | .num_ports = 1, | |
| 321 | + | .port_offsets = { 0x15000 }, | |
| 322 | + | .prio = 2, | |
| 323 | + | .urg_fwd = 0, | |
| 324 | + | .prio_fwd_disable = 1, | |
| 325 | + | }, | |
| 256 | 326 | .num_links = 1, | |
| 257 | 327 | .link_nodes = { &qns_a2noc_snoc }, | |
| 258 | 328 | }; | |
| @@ -337,6 +407,13 @@ static struct qcom_icc_node alm_gpu_tcu = { | |||
| 337 | 407 | .name = "alm_gpu_tcu", | |
| 338 | 408 | .channels = 1, | |
| 339 | 409 | .buswidth = 8, | |
| 410 | + | .qosbox = &(const struct qcom_icc_qosbox) { | |
| 411 | + | .num_ports = 1, | |
| 412 | + | .port_offsets = { 0x271000 }, | |
| 413 | + | .prio = 1, | |
| 414 | + | .urg_fwd = 0, | |
| 415 | + | .prio_fwd_disable = 1, | |
| 416 | + | }, | |
| 340 | 417 | .num_links = 2, | |
| 341 | 418 | .link_nodes = { &qns_gem_noc_cnoc, &qns_llcc }, | |
| 342 | 419 | }; | |
| @@ -345,6 +422,13 @@ static struct qcom_icc_node alm_pcie_tcu = { | |||
| 345 | 422 | .name = "alm_pcie_tcu", | |
| 346 | 423 | .channels = 1, | |
| 347 | 424 | .buswidth = 8, | |
| 425 | + | .qosbox = &(const struct qcom_icc_qosbox) { | |
| 426 | + | .num_ports = 1, | |
| 427 | + | .port_offsets = { 0x27d000 }, | |
| 428 | + | .prio = 3, | |
| 429 | + | .urg_fwd = 0, | |
| 430 | + | .prio_fwd_disable = 1, | |
| 431 | + | }, | |
| 348 | 432 | .num_links = 2, | |
| 349 | 433 | .link_nodes = { &qns_gem_noc_cnoc, &qns_llcc }, | |
| 350 | 434 | }; | |
| @@ -353,6 +437,13 @@ static struct qcom_icc_node alm_sys_tcu = { | |||
| 353 | 437 | .name = "alm_sys_tcu", | |
| 354 | 438 | .channels = 1, | |
| 355 | 439 | .buswidth = 8, | |
| 440 | + | .qosbox = &(const struct qcom_icc_qosbox) { | |
| 441 | + | .num_ports = 1, | |
| 442 | + | .port_offsets = { 0x273000 }, | |
| 443 | + | .prio = 6, | |
| 444 | + | .urg_fwd = 0, | |
| 445 | + | .prio_fwd_disable = 1, | |
| 446 | + | }, | |
| 356 | 447 | .num_links = 2, | |
| 357 | 448 | .link_nodes = { &qns_gem_noc_cnoc, &qns_llcc }, | |
| 358 | 449 | }; | |
| @@ -370,6 +461,13 @@ static struct qcom_icc_node qnm_gpu = { | |||
| 370 | 461 | .name = "qnm_gpu", | |
| 371 | 462 | .channels = 4, | |
| 372 | 463 | .buswidth = 32, | |
| 464 | + | .qosbox = &(const struct qcom_icc_qosbox) { | |
| 465 | + | .num_ports = 4, | |
| 466 | + | .port_offsets = { 0x51000, 0x58000, 0xd1000, 0xd8000 }, | |
| 467 | + | .prio = 0, | |
| 468 | + | .urg_fwd = 0, | |
| 469 | + | .prio_fwd_disable = 1, | |
| 470 | + | }, | |
| 373 | 471 | .num_links = 2, | |
| 374 | 472 | .link_nodes = { &qns_gem_noc_cnoc, &qns_llcc }, | |
| 375 | 473 | }; | |
| @@ -378,6 +476,13 @@ static struct qcom_icc_node qnm_lpass = { | |||
| 378 | 476 | .name = "qnm_lpass", | |
| 379 | 477 | .channels = 1, | |
| 380 | 478 | .buswidth = 16, | |
| 479 | + | .qosbox = &(const struct qcom_icc_qosbox) { | |
| 480 | + | .num_ports = 1, | |
| 481 | + | .port_offsets = { 0x275000 }, | |
| 482 | + | .prio = 0, | |
| 483 | + | .urg_fwd = 1, | |
| 484 | + | .prio_fwd_disable = 0, | |
| 485 | + | }, | |
| 381 | 486 | .num_links = 3, | |
| 382 | 487 | .link_nodes = { &qns_gem_noc_cnoc, &qns_llcc, | |
| 383 | 488 | &qns_pcie }, | |
| @@ -387,6 +492,13 @@ static struct qcom_icc_node qnm_mnoc_hf = { | |||
| 387 | 492 | .name = "qnm_mnoc_hf", | |
| 388 | 493 | .channels = 2, | |
| 389 | 494 | .buswidth = 32, | |
| 495 | + | .qosbox = &(const struct qcom_icc_qosbox) { | |
| 496 | + | .num_ports = 2, | |
| 497 | + | .port_offsets = { 0x53000, 0xd3000 }, | |
| 498 | + | .prio = 0, | |
| 499 | + | .urg_fwd = 1, | |
| 500 | + | .prio_fwd_disable = 0, | |
| 501 | + | }, | |
| 390 | 502 | .num_links = 2, | |
| 391 | 503 | .link_nodes = { &qns_gem_noc_cnoc, &qns_llcc }, | |
| 392 | 504 | }; | |
| @@ -395,6 +507,13 @@ static struct qcom_icc_node qnm_mnoc_sf = { | |||
| 395 | 507 | .name = "qnm_mnoc_sf", | |
| 396 | 508 | .channels = 2, | |
| 397 | 509 | .buswidth = 32, | |
| 510 | + | .qosbox = &(const struct qcom_icc_qosbox) { | |
| 511 | + | .num_ports = 2, | |
| 512 | + | .port_offsets = { 0x55000, 0xd5000 }, | |
| 513 | + | .prio = 0, | |
| 514 | + | .urg_fwd = 1, | |
| 515 | + | .prio_fwd_disable = 0, | |
| 516 | + | }, | |
| 398 | 517 | .num_links = 2, | |
| 399 | 518 | .link_nodes = { &qns_gem_noc_cnoc, &qns_llcc }, | |
| 400 | 519 | }; | |
| @@ -403,6 +522,13 @@ static struct qcom_icc_node qnm_nsp_noc = { | |||
| 403 | 522 | .name = "qnm_nsp_noc", | |
| 404 | 523 | .channels = 2, | |
| 405 | 524 | .buswidth = 32, | |
| 525 | + | .qosbox = &(const struct qcom_icc_qosbox) { | |
| 526 | + | .num_ports = 2, | |
| 527 | + | .port_offsets = { 0x57000, 0xd7000 }, | |
| 528 | + | .prio = 0, | |
| 529 | + | .urg_fwd = 0, | |
| 530 | + | .prio_fwd_disable = 1, | |
| 531 | + | }, | |
| 406 | 532 | .num_links = 3, | |
| 407 | 533 | .link_nodes = { &qns_gem_noc_cnoc, &qns_llcc, | |
| 408 | 534 | &qns_pcie }, | |
| @@ -412,6 +538,13 @@ static struct qcom_icc_node qnm_pcie = { | |||
| 412 | 538 | .name = "qnm_pcie", | |
| 413 | 539 | .channels = 1, | |
| 414 | 540 | .buswidth = 64, | |
| 541 | + | .qosbox = &(const struct qcom_icc_qosbox) { | |
| 542 | + | .num_ports = 1, | |
| 543 | + | .port_offsets = { 0x277000 }, | |
| 544 | + | .prio = 0, | |
| 545 | + | .urg_fwd = 1, | |
| 546 | + | .prio_fwd_disable = 0, | |
| 547 | + | }, | |
| 415 | 548 | .num_links = 2, | |
| 416 | 549 | .link_nodes = { &qns_gem_noc_cnoc, &qns_llcc }, | |
| 417 | 550 | }; | |
| @@ -420,6 +553,13 @@ static struct qcom_icc_node qnm_snoc_sf = { | |||
| 420 | 553 | .name = "qnm_snoc_sf", | |
| 421 | 554 | .channels = 1, | |
| 422 | 555 | .buswidth = 64, | |
| 556 | + | .qosbox = &(const struct qcom_icc_qosbox) { | |
| 557 | + | .num_ports = 1, | |
| 558 | + | .port_offsets = { 0x27b000 }, | |
| 559 | + | .prio = 2, | |
| 560 | + | .urg_fwd = 1, | |
| 561 | + | .prio_fwd_disable = 0, | |
| 562 | + | }, | |
| 423 | 563 | .num_links = 3, | |
| 424 | 564 | .link_nodes = { &qns_gem_noc_cnoc, &qns_llcc, | |
| 425 | 565 | &qns_pcie }, | |
| @@ -429,6 +569,13 @@ static struct qcom_icc_node xm_gic = { | |||
| 429 | 569 | .name = "xm_gic", | |
| 430 | 570 | .channels = 1, | |
| 431 | 571 | .buswidth = 8, | |
| 572 | + | .qosbox = &(const struct qcom_icc_qosbox) { | |
| 573 | + | .num_ports = 1, | |
| 574 | + | .port_offsets = { 0x27f000 }, | |
| 575 | + | .prio = 2, | |
| 576 | + | .urg_fwd = 0, | |
| 577 | + | .prio_fwd_disable = 1, | |
| 578 | + | }, | |
| 432 | 579 | .num_links = 1, | |
| 433 | 580 | .link_nodes = { &qns_llcc }, | |
| 434 | 581 | }; | |
| @@ -469,6 +616,13 @@ static struct qcom_icc_node qnm_av1_enc = { | |||
| 469 | 616 | .name = "qnm_av1_enc", | |
| 470 | 617 | .channels = 1, | |
| 471 | 618 | .buswidth = 32, | |
| 619 | + | .qosbox = &(const struct qcom_icc_qosbox) { | |
| 620 | + | .num_ports = 1, | |
| 621 | + | .port_offsets = { 0x2f000 }, | |
| 622 | + | .prio = 4, | |
| 623 | + | .urg_fwd = 0, | |
| 624 | + | .prio_fwd_disable = 1, | |
| 625 | + | }, | |
| 472 | 626 | .num_links = 1, | |
| 473 | 627 | .link_nodes = { &qns_mem_noc_sf }, | |
| 474 | 628 | }; | |
| @@ -477,6 +631,13 @@ static struct qcom_icc_node qnm_camnoc_hf = { | |||
| 477 | 631 | .name = "qnm_camnoc_hf", | |
| 478 | 632 | .channels = 2, | |
| 479 | 633 | .buswidth = 32, | |
| 634 | + | .qosbox = &(const struct qcom_icc_qosbox) { | |
| 635 | + | .num_ports = 2, | |
| 636 | + | .port_offsets = { 0x28000, 0x29000 }, | |
| 637 | + | .prio = 0, | |
| 638 | + | .urg_fwd = 1, | |
| 639 | + | .prio_fwd_disable = 0, | |
| 640 | + | }, | |
| 480 | 641 | .num_links = 1, | |
| 481 | 642 | .link_nodes = { &qns_mem_noc_hf }, | |
| 482 | 643 | }; | |
| @@ -485,6 +646,13 @@ static struct qcom_icc_node qnm_camnoc_icp = { | |||
| 485 | 646 | .name = "qnm_camnoc_icp", | |
| 486 | 647 | .channels = 1, | |
| 487 | 648 | .buswidth = 8, | |
| 649 | + | .qosbox = &(const struct qcom_icc_qosbox) { | |
| 650 | + | .num_ports = 1, | |
| 651 | + | .port_offsets = { 0x2a000 }, | |
| 652 | + | .prio = 4, | |
| 653 | + | .urg_fwd = 0, | |
| 654 | + | .prio_fwd_disable = 1, | |
| 655 | + | }, | |
| 488 | 656 | .num_links = 1, | |
| 489 | 657 | .link_nodes = { &qns_mem_noc_sf }, | |
| 490 | 658 | }; | |
| @@ -493,6 +661,13 @@ static struct qcom_icc_node qnm_camnoc_sf = { | |||
| 493 | 661 | .name = "qnm_camnoc_sf", | |
| 494 | 662 | .channels = 2, | |
| 495 | 663 | .buswidth = 32, | |
| 664 | + | .qosbox = &(const struct qcom_icc_qosbox) { | |
| 665 | + | .num_ports = 2, | |
| 666 | + | .port_offsets = { 0x2b000, 0x2c000 }, | |
| 667 | + | .prio = 0, | |
| 668 | + | .urg_fwd = 1, | |
| 669 | + | .prio_fwd_disable = 0, | |
| 670 | + | }, | |
| 496 | 671 | .num_links = 1, | |
| 497 | 672 | .link_nodes = { &qns_mem_noc_sf }, | |
| 498 | 673 | }; | |
| @@ -501,6 +676,13 @@ static struct qcom_icc_node qnm_eva = { | |||
| 501 | 676 | .name = "qnm_eva", | |
| 502 | 677 | .channels = 1, | |
| 503 | 678 | .buswidth = 32, | |
| 679 | + | .qosbox = &(const struct qcom_icc_qosbox) { | |
| 680 | + | .num_ports = 1, | |
| 681 | + | .port_offsets = { 0x33000 }, | |
| 682 | + | .prio = 0, | |
| 683 | + | .urg_fwd = 1, | |
| 684 | + | .prio_fwd_disable = 0, | |
| 685 | + | }, | |
| 504 | 686 | .num_links = 1, | |
| 505 | 687 | .link_nodes = { &qns_mem_noc_sf }, | |
| 506 | 688 | }; | |
| @@ -509,6 +691,13 @@ static struct qcom_icc_node qnm_mdp = { | |||
| 509 | 691 | .name = "qnm_mdp", | |
| 510 | 692 | .channels = 2, | |
| 511 | 693 | .buswidth = 32, | |
| 694 | + | .qosbox = &(const struct qcom_icc_qosbox) { | |
| 695 | + | .num_ports = 2, | |
| 696 | + | .port_offsets = { 0x2d000, 0x2e000 }, | |
| 697 | + | .prio = 0, | |
| 698 | + | .urg_fwd = 1, | |
| 699 | + | .prio_fwd_disable = 0, | |
| 700 | + | }, | |
| 512 | 701 | .num_links = 1, | |
| 513 | 702 | .link_nodes = { &qns_mem_noc_hf }, | |
| 514 | 703 | }; | |
| @@ -517,6 +706,13 @@ static struct qcom_icc_node qnm_video = { | |||
| 517 | 706 | .name = "qnm_video", | |
| 518 | 707 | .channels = 2, | |
| 519 | 708 | .buswidth = 32, | |
| 709 | + | .qosbox = &(const struct qcom_icc_qosbox) { | |
| 710 | + | .num_ports = 2, | |
| 711 | + | .port_offsets = { 0x30000, 0x31000 }, | |
| 712 | + | .prio = 0, | |
| 713 | + | .urg_fwd = 1, | |
| 714 | + | .prio_fwd_disable = 0, | |
| 715 | + | }, | |
| 520 | 716 | .num_links = 1, | |
| 521 | 717 | .link_nodes = { &qns_mem_noc_sf }, | |
| 522 | 718 | }; | |
| @@ -525,6 +721,13 @@ static struct qcom_icc_node qnm_video_cv_cpu = { | |||
| 525 | 721 | .name = "qnm_video_cv_cpu", | |
| 526 | 722 | .channels = 1, | |
| 527 | 723 | .buswidth = 8, | |
| 724 | + | .qosbox = &(const struct qcom_icc_qosbox) { | |
| 725 | + | .num_ports = 1, | |
| 726 | + | .port_offsets = { 0x32000 }, | |
| 727 | + | .prio = 4, | |
| 728 | + | .urg_fwd = 0, | |
| 729 | + | .prio_fwd_disable = 1, | |
| 730 | + | }, | |
| 528 | 731 | .num_links = 1, | |
| 529 | 732 | .link_nodes = { &qns_mem_noc_sf }, | |
| 530 | 733 | }; | |
| @@ -533,6 +736,13 @@ static struct qcom_icc_node qnm_video_v_cpu = { | |||
| 533 | 736 | .name = "qnm_video_v_cpu", | |
| 534 | 737 | .channels = 1, | |
| 535 | 738 | .buswidth = 8, | |
| 739 | + | .qosbox = &(const struct qcom_icc_qosbox) { | |
| 740 | + | .num_ports = 1, | |
| 741 | + | .port_offsets = { 0x34000 }, | |
| 742 | + | .prio = 4, | |
| 743 | + | .urg_fwd = 0, | |
| 744 | + | .prio_fwd_disable = 1, | |
| 745 | + | }, | |
| 536 | 746 | .num_links = 1, | |
| 537 | 747 | .link_nodes = { &qns_mem_noc_sf }, | |
| 538 | 748 | }; | |
| @@ -573,6 +783,13 @@ static struct qcom_icc_node xm_pcie_3 = { | |||
| 573 | 783 | .name = "xm_pcie_3", | |
| 574 | 784 | .channels = 1, | |
| 575 | 785 | .buswidth = 64, | |
| 786 | + | .qosbox = &(const struct qcom_icc_qosbox) { | |
| 787 | + | .num_ports = 1, | |
| 788 | + | .port_offsets = { 0x7000 }, | |
| 789 | + | .prio = 2, | |
| 790 | + | .urg_fwd = 0, | |
| 791 | + | .prio_fwd_disable = 1, | |
| 792 | + | }, | |
| 576 | 793 | .num_links = 1, | |
| 577 | 794 | .link_nodes = { &qns_pcie_north_gem_noc }, | |
| 578 | 795 | }; | |
| @@ -581,6 +798,13 @@ static struct qcom_icc_node xm_pcie_4 = { | |||
| 581 | 798 | .name = "xm_pcie_4", | |
| 582 | 799 | .channels = 1, | |
| 583 | 800 | .buswidth = 8, | |
| 801 | + | .qosbox = &(const struct qcom_icc_qosbox) { | |
| 802 | + | .num_ports = 1, | |
| 803 | + | .port_offsets = { 0x8000 }, | |
| 804 | + | .prio = 2, | |
| 805 | + | .urg_fwd = 0, | |
| 806 | + | .prio_fwd_disable = 1, | |
| 807 | + | }, | |
| 584 | 808 | .num_links = 1, | |
| 585 | 809 | .link_nodes = { &qns_pcie_north_gem_noc }, | |
| 586 | 810 | }; | |
| @@ -589,6 +813,13 @@ static struct qcom_icc_node xm_pcie_5 = { | |||
| 589 | 813 | .name = "xm_pcie_5", | |
| 590 | 814 | .channels = 1, | |
| 591 | 815 | .buswidth = 8, | |
| 816 | + | .qosbox = &(const struct qcom_icc_qosbox) { | |
| 817 | + | .num_ports = 1, | |
| 818 | + | .port_offsets = { 0x9000 }, | |
| 819 | + | .prio = 3, | |
| 820 | + | .urg_fwd = 0, | |
| 821 | + | .prio_fwd_disable = 1, | |
| 822 | + | }, | |
| 592 | 823 | .num_links = 1, | |
| 593 | 824 | .link_nodes = { &qns_pcie_north_gem_noc }, | |
| 594 | 825 | }; | |
| @@ -597,6 +828,13 @@ static struct qcom_icc_node xm_pcie_0 = { | |||
| 597 | 828 | .name = "xm_pcie_0", | |
| 598 | 829 | .channels = 1, | |
| 599 | 830 | .buswidth = 16, | |
| 831 | + | .qosbox = &(const struct qcom_icc_qosbox) { | |
| 832 | + | .num_ports = 1, | |
| 833 | + | .port_offsets = { 0x9000 }, | |
| 834 | + | .prio = 2, | |
| 835 | + | .urg_fwd = 0, | |
| 836 | + | .prio_fwd_disable = 1, | |
| 837 | + | }, | |
| 600 | 838 | .num_links = 1, | |
| 601 | 839 | .link_nodes = { &qns_pcie_south_gem_noc }, | |
| 602 | 840 | }; | |
| @@ -605,6 +843,13 @@ static struct qcom_icc_node xm_pcie_1 = { | |||
| 605 | 843 | .name = "xm_pcie_1", | |
| 606 | 844 | .channels = 1, | |
| 607 | 845 | .buswidth = 16, | |
| 846 | + | .qosbox = &(const struct qcom_icc_qosbox) { | |
| 847 | + | .num_ports = 1, | |
| 848 | + | .port_offsets = { 0xa000 }, | |
| 849 | + | .prio = 2, | |
| 850 | + | .urg_fwd = 0, | |
| 851 | + | .prio_fwd_disable = 1, | |
| 852 | + | }, | |
| 608 | 853 | .num_links = 1, | |
| 609 | 854 | .link_nodes = { &qns_pcie_south_gem_noc }, | |
| 610 | 855 | }; | |
| @@ -613,6 +858,13 @@ static struct qcom_icc_node xm_pcie_2 = { | |||
| 613 | 858 | .name = "xm_pcie_2", | |
| 614 | 859 | .channels = 1, | |
| 615 | 860 | .buswidth = 16, | |
| 861 | + | .qosbox = &(const struct qcom_icc_qosbox) { | |
| 862 | + | .num_ports = 1, | |
| 863 | + | .port_offsets = { 0xb000 }, | |
| 864 | + | .prio = 2, | |
| 865 | + | .urg_fwd = 0, | |
| 866 | + | .prio_fwd_disable = 1, | |
| 867 | + | }, | |
| 616 | 868 | .num_links = 1, | |
| 617 | 869 | .link_nodes = { &qns_pcie_south_gem_noc }, | |
| 618 | 870 | }; | |
| @@ -621,6 +873,13 @@ static struct qcom_icc_node xm_pcie_6a = { | |||
| 621 | 873 | .name = "xm_pcie_6a", | |
| 622 | 874 | .channels = 1, | |
| 623 | 875 | .buswidth = 32, | |
| 876 | + | .qosbox = &(const struct qcom_icc_qosbox) { | |
| 877 | + | .num_ports = 1, | |
| 878 | + | .port_offsets = { 0xc000 }, | |
| 879 | + | .prio = 2, | |
| 880 | + | .urg_fwd = 0, | |
| 881 | + | .prio_fwd_disable = 1, | |
| 882 | + | }, | |
| 624 | 883 | .num_links = 1, | |
| 625 | 884 | .link_nodes = { &qns_pcie_south_gem_noc }, | |
| 626 | 885 | }; | |
| @@ -629,6 +888,13 @@ static struct qcom_icc_node xm_pcie_6b = { | |||
| 629 | 888 | .name = "xm_pcie_6b", | |
| 630 | 889 | .channels = 1, | |
| 631 | 890 | .buswidth = 16, | |
| 891 | + | .qosbox = &(const struct qcom_icc_qosbox) { | |
| 892 | + | .num_ports = 1, | |
| 893 | + | .port_offsets = { 0xd000 }, | |
| 894 | + | .prio = 2, | |
| 895 | + | .urg_fwd = 0, | |
| 896 | + | .prio_fwd_disable = 1, | |
| 897 | + | }, | |
| 632 | 898 | .num_links = 1, | |
| 633 | 899 | .link_nodes = { &qns_pcie_south_gem_noc }, | |
| 634 | 900 | }; | |
| @@ -653,6 +919,13 @@ static struct qcom_icc_node qnm_gic = { | |||
| 653 | 919 | .name = "qnm_gic", | |
| 654 | 920 | .channels = 1, | |
| 655 | 921 | .buswidth = 8, | |
| 922 | + | .qosbox = &(const struct qcom_icc_qosbox) { | |
| 923 | + | .num_ports = 1, | |
| 924 | + | .port_offsets = { 0x1c000 }, | |
| 925 | + | .prio = 2, | |
| 926 | + | .urg_fwd = 0, | |
| 927 | + | .prio_fwd_disable = 1, | |
| 928 | + | }, | |
| 656 | 929 | .num_links = 1, | |
| 657 | 930 | .link_nodes = { &qns_gemnoc_sf }, | |
| 658 | 931 | }; | |
| @@ -685,6 +958,13 @@ static struct qcom_icc_node xm_usb2_0 = { | |||
| 685 | 958 | .name = "xm_usb2_0", | |
| 686 | 959 | .channels = 1, | |
| 687 | 960 | .buswidth = 8, | |
| 961 | + | .qosbox = &(const struct qcom_icc_qosbox) { | |
| 962 | + | .num_ports = 1, | |
| 963 | + | .port_offsets = { 0x6000 }, | |
| 964 | + | .prio = 2, | |
| 965 | + | .urg_fwd = 0, | |
| 966 | + | .prio_fwd_disable = 1, | |
| 967 | + | }, | |
| 688 | 968 | .num_links = 1, | |
| 689 | 969 | .link_nodes = { &qns_aggre_usb_north_snoc }, | |
| 690 | 970 | }; | |
| @@ -693,6 +973,13 @@ static struct qcom_icc_node xm_usb3_mp = { | |||
| 693 | 973 | .name = "xm_usb3_mp", | |
| 694 | 974 | .channels = 1, | |
| 695 | 975 | .buswidth = 16, | |
| 976 | + | .qosbox = &(const struct qcom_icc_qosbox) { | |
| 977 | + | .num_ports = 1, | |
| 978 | + | .port_offsets = { 0x7000 }, | |
| 979 | + | .prio = 2, | |
| 980 | + | .urg_fwd = 0, | |
| 981 | + | .prio_fwd_disable = 1, | |
| 982 | + | }, | |
| 696 | 983 | .num_links = 1, | |
| 697 | 984 | .link_nodes = { &qns_aggre_usb_north_snoc }, | |
| 698 | 985 | }; | |
| @@ -701,6 +988,13 @@ static struct qcom_icc_node xm_usb3_0 = { | |||
| 701 | 988 | .name = "xm_usb3_0", | |
| 702 | 989 | .channels = 1, | |
| 703 | 990 | .buswidth = 8, | |
| 991 | + | .qosbox = &(const struct qcom_icc_qosbox) { | |
| 992 | + | .num_ports = 1, | |
| 993 | + | .port_offsets = { 0xa000 }, | |
| 994 | + | .prio = 2, | |
| 995 | + | .urg_fwd = 0, | |
| 996 | + | .prio_fwd_disable = 1, | |
| 997 | + | }, | |
| 704 | 998 | .num_links = 1, | |
| 705 | 999 | .link_nodes = { &qns_aggre_usb_south_snoc }, | |
| 706 | 1000 | }; | |
| @@ -709,6 +1003,13 @@ static struct qcom_icc_node xm_usb3_1 = { | |||
| 709 | 1003 | .name = "xm_usb3_1", | |
| 710 | 1004 | .channels = 1, | |
| 711 | 1005 | .buswidth = 8, | |
| 1006 | + | .qosbox = &(const struct qcom_icc_qosbox) { | |
| 1007 | + | .num_ports = 1, | |
| 1008 | + | .port_offsets = { 0xb000 }, | |
| 1009 | + | .prio = 2, | |
| 1010 | + | .urg_fwd = 0, | |
| 1011 | + | .prio_fwd_disable = 1, | |
| 1012 | + | }, | |
| 712 | 1013 | .num_links = 1, | |
| 713 | 1014 | .link_nodes = { &qns_aggre_usb_south_snoc }, | |
| 714 | 1015 | }; | |
| @@ -717,6 +1018,13 @@ static struct qcom_icc_node xm_usb3_2 = { | |||
| 717 | 1018 | .name = "xm_usb3_2", | |
| 718 | 1019 | .channels = 1, | |
| 719 | 1020 | .buswidth = 8, | |
| 1021 | + | .qosbox = &(const struct qcom_icc_qosbox) { | |
| 1022 | + | .num_ports = 1, | |
| 1023 | + | .port_offsets = { 0xc000 }, | |
| 1024 | + | .prio = 2, | |
| 1025 | + | .urg_fwd = 0, | |
| 1026 | + | .prio_fwd_disable = 1, | |
| 1027 | + | }, | |
| 720 | 1028 | .num_links = 1, | |
| 721 | 1029 | .link_nodes = { &qns_aggre_usb_south_snoc }, | |
| 722 | 1030 | }; | |
| @@ -725,6 +1033,13 @@ static struct qcom_icc_node xm_usb4_0 = { | |||
| 725 | 1033 | .name = "xm_usb4_0", | |
| 726 | 1034 | .channels = 1, | |
| 727 | 1035 | .buswidth = 16, | |
| 1036 | + | .qosbox = &(const struct qcom_icc_qosbox) { | |
| 1037 | + | .num_ports = 1, | |
| 1038 | + | .port_offsets = { 0xd000 }, | |
| 1039 | + | .prio = 2, | |
| 1040 | + | .urg_fwd = 0, | |
| 1041 | + | .prio_fwd_disable = 1, | |
| 1042 | + | }, | |
| 728 | 1043 | .num_links = 1, | |
| 729 | 1044 | .link_nodes = { &qns_aggre_usb_south_snoc }, | |
| 730 | 1045 | }; | |
| @@ -733,6 +1048,13 @@ static struct qcom_icc_node xm_usb4_1 = { | |||
| 733 | 1048 | .name = "xm_usb4_1", | |
| 734 | 1049 | .channels = 1, | |
| 735 | 1050 | .buswidth = 16, | |
| 1051 | + | .qosbox = &(const struct qcom_icc_qosbox) { | |
| 1052 | + | .num_ports = 1, | |
| 1053 | + | .port_offsets = { 0xe000 }, | |
| 1054 | + | .prio = 2, | |
| 1055 | + | .urg_fwd = 0, | |
| 1056 | + | .prio_fwd_disable = 1, | |
| 1057 | + | }, | |
| 736 | 1058 | .num_links = 1, | |
| 737 | 1059 | .link_nodes = { &qns_aggre_usb_south_snoc }, | |
| 738 | 1060 | }; | |
| @@ -741,6 +1063,13 @@ static struct qcom_icc_node xm_usb4_2 = { | |||
| 741 | 1063 | .name = "xm_usb4_2", | |
| 742 | 1064 | .channels = 1, | |
| 743 | 1065 | .buswidth = 16, | |
| 1066 | + | .qosbox = &(const struct qcom_icc_qosbox) { | |
| 1067 | + | .num_ports = 1, | |
| 1068 | + | .port_offsets = { 0xf000 }, | |
| 1069 | + | .prio = 2, | |
| 1070 | + | .urg_fwd = 0, | |
| 1071 | + | .prio_fwd_disable = 1, | |
| 1072 | + | }, | |
| 744 | 1073 | .num_links = 1, | |
| 745 | 1074 | .link_nodes = { &qns_aggre_usb_south_snoc }, | |
| 746 | 1075 | }; | |
| @@ -1466,11 +1795,21 @@ static struct qcom_icc_node * const aggre1_noc_nodes[] = { | |||
| 1466 | 1795 | [SLAVE_A1NOC_SNOC] = &qns_a1noc_snoc, | |
| 1467 | 1796 | }; | |
| 1468 | 1797 | ||
| 1798 | + | static const struct regmap_config x1e80100_aggre1_noc_regmap_config = { | |
| 1799 | + | .reg_bits = 32, | |
| 1800 | + | .reg_stride = 4, | |
| 1801 | + | .val_bits = 32, | |
| 1802 | + | .max_register = 0x14400, | |
| 1803 | + | .fast_io = true, | |
| 1804 | + | }; | |
| 1805 | + | ||
| 1469 | 1806 | static const struct qcom_icc_desc x1e80100_aggre1_noc = { | |
| 1807 | + | .config = &x1e80100_aggre1_noc_regmap_config, | |
| 1470 | 1808 | .nodes = aggre1_noc_nodes, | |
| 1471 | 1809 | .num_nodes = ARRAY_SIZE(aggre1_noc_nodes), | |
| 1472 | 1810 | .bcms = aggre1_noc_bcms, | |
| 1473 | 1811 | .num_bcms = ARRAY_SIZE(aggre1_noc_bcms), | |
| 1812 | + | .qos_requires_clocks = true, | |
| 1474 | 1813 | }; | |
| 1475 | 1814 | ||
| 1476 | 1815 | static struct qcom_icc_bcm * const aggre2_noc_bcms[] = { | |
| @@ -1488,7 +1827,16 @@ static struct qcom_icc_node * const aggre2_noc_nodes[] = { | |||
| 1488 | 1827 | [SLAVE_A2NOC_SNOC] = &qns_a2noc_snoc, | |
| 1489 | 1828 | }; | |
| 1490 | 1829 | ||
| 1830 | + | static const struct regmap_config x1e80100_aggre2_noc_regmap_config = { | |
| 1831 | + | .reg_bits = 32, | |
| 1832 | + | .reg_stride = 4, | |
| 1833 | + | .val_bits = 32, | |
| 1834 | + | .max_register = 0x1c400, | |
| 1835 | + | .fast_io = true, | |
| 1836 | + | }; | |
| 1837 | + | ||
| 1491 | 1838 | static const struct qcom_icc_desc x1e80100_aggre2_noc = { | |
| 1839 | + | .config = &x1e80100_aggre2_noc_regmap_config, | |
| 1492 | 1840 | .nodes = aggre2_noc_nodes, | |
| 1493 | 1841 | .num_nodes = ARRAY_SIZE(aggre2_noc_nodes), | |
| 1494 | 1842 | .bcms = aggre2_noc_bcms, | |
| @@ -1573,7 +1921,16 @@ static struct qcom_icc_node * const cnoc_cfg_nodes[] = { | |||
| 1573 | 1921 | [SLAVE_TCU] = &xs_sys_tcu_cfg, | |
| 1574 | 1922 | }; | |
| 1575 | 1923 | ||
| 1924 | + | static const struct regmap_config x1e80100_cnoc_cfg_regmap_config = { | |
| 1925 | + | .reg_bits = 32, | |
| 1926 | + | .reg_stride = 4, | |
| 1927 | + | .val_bits = 32, | |
| 1928 | + | .max_register = 0x6600, | |
| 1929 | + | .fast_io = true, | |
| 1930 | + | }; | |
| 1931 | + | ||
| 1576 | 1932 | static const struct qcom_icc_desc x1e80100_cnoc_cfg = { | |
| 1933 | + | .config = &x1e80100_cnoc_cfg_regmap_config, | |
| 1577 | 1934 | .nodes = cnoc_cfg_nodes, | |
| 1578 | 1935 | .num_nodes = ARRAY_SIZE(cnoc_cfg_nodes), | |
| 1579 | 1936 | .bcms = cnoc_cfg_bcms, | |
| @@ -1603,7 +1960,16 @@ static struct qcom_icc_node * const cnoc_main_nodes[] = { | |||
| 1603 | 1960 | [SLAVE_PCIE_6B] = &xs_pcie_6b, | |
| 1604 | 1961 | }; | |
| 1605 | 1962 | ||
| 1963 | + | static const struct regmap_config x1e80100_cnoc_main_regmap_config = { | |
| 1964 | + | .reg_bits = 32, | |
| 1965 | + | .reg_stride = 4, | |
| 1966 | + | .val_bits = 32, | |
| 1967 | + | .max_register = 0x14400, | |
| 1968 | + | .fast_io = true, | |
| 1969 | + | }; | |
| 1970 | + | ||
| 1606 | 1971 | static const struct qcom_icc_desc x1e80100_cnoc_main = { | |
| 1972 | + | .config = &x1e80100_cnoc_main_regmap_config, | |
| 1607 | 1973 | .nodes = cnoc_main_nodes, | |
| 1608 | 1974 | .num_nodes = ARRAY_SIZE(cnoc_main_nodes), | |
| 1609 | 1975 | .bcms = cnoc_main_bcms, | |
| @@ -1633,7 +1999,16 @@ static struct qcom_icc_node * const gem_noc_nodes[] = { | |||
| 1633 | 1999 | [SLAVE_MEM_NOC_PCIE_SNOC] = &qns_pcie, | |
| 1634 | 2000 | }; | |
| 1635 | 2001 | ||
| 2002 | + | static const struct regmap_config x1e80100_gem_noc_regmap_config = { | |
| 2003 | + | .reg_bits = 32, | |
| 2004 | + | .reg_stride = 4, | |
| 2005 | + | .val_bits = 32, | |
| 2006 | + | .max_register = 0x311200, | |
| 2007 | + | .fast_io = true, | |
| 2008 | + | }; | |
| 2009 | + | ||
| 1636 | 2010 | static const struct qcom_icc_desc x1e80100_gem_noc = { | |
| 2011 | + | .config = &x1e80100_gem_noc_regmap_config, | |
| 1637 | 2012 | .nodes = gem_noc_nodes, | |
| 1638 | 2013 | .num_nodes = ARRAY_SIZE(gem_noc_nodes), | |
| 1639 | 2014 | .bcms = gem_noc_bcms, | |
| @@ -1648,7 +2023,16 @@ static struct qcom_icc_node * const lpass_ag_noc_nodes[] = { | |||
| 1648 | 2023 | [SLAVE_LPASS_GEM_NOC] = &qns_lpass_ag_noc_gemnoc, | |
| 1649 | 2024 | }; | |
| 1650 | 2025 | ||
| 2026 | + | static const struct regmap_config x1e80100_lpass_ag_noc_regmap_config = { | |
| 2027 | + | .reg_bits = 32, | |
| 2028 | + | .reg_stride = 4, | |
| 2029 | + | .val_bits = 32, | |
| 2030 | + | .max_register = 0xe080, | |
| 2031 | + | .fast_io = true, | |
| 2032 | + | }; | |
| 2033 | + | ||
| 1651 | 2034 | static const struct qcom_icc_desc x1e80100_lpass_ag_noc = { | |
| 2035 | + | .config = &x1e80100_lpass_ag_noc_regmap_config, | |
| 1652 | 2036 | .nodes = lpass_ag_noc_nodes, | |
| 1653 | 2037 | .num_nodes = ARRAY_SIZE(lpass_ag_noc_nodes), | |
| 1654 | 2038 | .bcms = lpass_ag_noc_bcms, | |
| @@ -1664,7 +2048,16 @@ static struct qcom_icc_node * const lpass_lpiaon_noc_nodes[] = { | |||
| 1664 | 2048 | [SLAVE_LPIAON_NOC_LPASS_AG_NOC] = &qns_lpass_aggnoc, | |
| 1665 | 2049 | }; | |
| 1666 | 2050 | ||
| 2051 | + | static const struct regmap_config x1e80100_lpass_lpiaon_noc_regmap_config = { | |
| 2052 | + | .reg_bits = 32, | |
| 2053 | + | .reg_stride = 4, | |
| 2054 | + | .val_bits = 32, | |
| 2055 | + | .max_register = 0x19080, | |
| 2056 | + | .fast_io = true, | |
| 2057 | + | }; | |
| 2058 | + | ||
| 1667 | 2059 | static const struct qcom_icc_desc x1e80100_lpass_lpiaon_noc = { | |
| 2060 | + | .config = &x1e80100_lpass_lpiaon_noc_regmap_config, | |
| 1668 | 2061 | .nodes = lpass_lpiaon_noc_nodes, | |
| 1669 | 2062 | .num_nodes = ARRAY_SIZE(lpass_lpiaon_noc_nodes), | |
| 1670 | 2063 | .bcms = lpass_lpiaon_noc_bcms, | |
| @@ -1679,7 +2072,16 @@ static struct qcom_icc_node * const lpass_lpicx_noc_nodes[] = { | |||
| 1679 | 2072 | [SLAVE_LPICX_NOC_LPIAON_NOC] = &qns_lpi_aon_noc, | |
| 1680 | 2073 | }; | |
| 1681 | 2074 | ||
| 2075 | + | static const struct regmap_config x1e80100_lpass_lpicx_noc_regmap_config = { | |
| 2076 | + | .reg_bits = 32, | |
| 2077 | + | .reg_stride = 4, | |
| 2078 | + | .val_bits = 32, | |
| 2079 | + | .max_register = 0x3a200, | |
| 2080 | + | .fast_io = true, | |
| 2081 | + | }; | |
| 2082 | + | ||
| 1682 | 2083 | static const struct qcom_icc_desc x1e80100_lpass_lpicx_noc = { | |
| 2084 | + | .config = &x1e80100_lpass_lpicx_noc_regmap_config, | |
| 1683 | 2085 | .nodes = lpass_lpicx_noc_nodes, | |
| 1684 | 2086 | .num_nodes = ARRAY_SIZE(lpass_lpicx_noc_nodes), | |
| 1685 | 2087 | .bcms = lpass_lpicx_noc_bcms, | |
| @@ -1724,7 +2126,16 @@ static struct qcom_icc_node * const mmss_noc_nodes[] = { | |||
| 1724 | 2126 | [SLAVE_SERVICE_MNOC] = &srvc_mnoc, | |
| 1725 | 2127 | }; | |
| 1726 | 2128 | ||
| 2129 | + | static const struct regmap_config x1e80100_mmss_noc_regmap_config = { | |
| 2130 | + | .reg_bits = 32, | |
| 2131 | + | .reg_stride = 4, | |
| 2132 | + | .val_bits = 32, | |
| 2133 | + | .max_register = 0x5b800, | |
| 2134 | + | .fast_io = true, | |
| 2135 | + | }; | |
| 2136 | + | ||
| 1727 | 2137 | static const struct qcom_icc_desc x1e80100_mmss_noc = { | |
| 2138 | + | .config = &x1e80100_mmss_noc_regmap_config, | |
| 1728 | 2139 | .nodes = mmss_noc_nodes, | |
| 1729 | 2140 | .num_nodes = ARRAY_SIZE(mmss_noc_nodes), | |
| 1730 | 2141 | .bcms = mmss_noc_bcms, | |
| @@ -1740,7 +2151,16 @@ static struct qcom_icc_node * const nsp_noc_nodes[] = { | |||
| 1740 | 2151 | [SLAVE_CDSP_MEM_NOC] = &qns_nsp_gemnoc, | |
| 1741 | 2152 | }; | |
| 1742 | 2153 | ||
| 2154 | + | static const struct regmap_config x1e80100_nsp_noc_regmap_config = { | |
| 2155 | + | .reg_bits = 32, | |
| 2156 | + | .reg_stride = 4, | |
| 2157 | + | .val_bits = 32, | |
| 2158 | + | .max_register = 0xe080, | |
| 2159 | + | .fast_io = true, | |
| 2160 | + | }; | |
| 2161 | + | ||
| 1743 | 2162 | static const struct qcom_icc_desc x1e80100_nsp_noc = { | |
| 2163 | + | .config = &x1e80100_nsp_noc_regmap_config, | |
| 1744 | 2164 | .nodes = nsp_noc_nodes, | |
| 1745 | 2165 | .num_nodes = ARRAY_SIZE(nsp_noc_nodes), | |
| 1746 | 2166 | .bcms = nsp_noc_bcms, | |
| @@ -1757,7 +2177,16 @@ static struct qcom_icc_node * const pcie_center_anoc_nodes[] = { | |||
| 1757 | 2177 | [SLAVE_ANOC_PCIE_GEM_NOC] = &qns_pcie_mem_noc, | |
| 1758 | 2178 | }; | |
| 1759 | 2179 | ||
| 2180 | + | static const struct regmap_config x1e80100_pcie_center_anoc_regmap_config = { | |
| 2181 | + | .reg_bits = 32, | |
| 2182 | + | .reg_stride = 4, | |
| 2183 | + | .val_bits = 32, | |
| 2184 | + | .max_register = 0x7000, | |
| 2185 | + | .fast_io = true, | |
| 2186 | + | }; | |
| 2187 | + | ||
| 1760 | 2188 | static const struct qcom_icc_desc x1e80100_pcie_center_anoc = { | |
| 2189 | + | .config = &x1e80100_pcie_center_anoc_regmap_config, | |
| 1761 | 2190 | .nodes = pcie_center_anoc_nodes, | |
| 1762 | 2191 | .num_nodes = ARRAY_SIZE(pcie_center_anoc_nodes), | |
| 1763 | 2192 | .bcms = pcie_center_anoc_bcms, | |
| @@ -1774,7 +2203,16 @@ static struct qcom_icc_node * const pcie_north_anoc_nodes[] = { | |||
| 1774 | 2203 | [SLAVE_PCIE_NORTH] = &qns_pcie_north_gem_noc, | |
| 1775 | 2204 | }; | |
| 1776 | 2205 | ||
| 2206 | + | static const struct regmap_config x1e80100_pcie_north_anoc_regmap_config = { | |
| 2207 | + | .reg_bits = 32, | |
| 2208 | + | .reg_stride = 4, | |
| 2209 | + | .val_bits = 32, | |
| 2210 | + | .max_register = 0x9080, | |
| 2211 | + | .fast_io = true, | |
| 2212 | + | }; | |
| 2213 | + | ||
| 1777 | 2214 | static const struct qcom_icc_desc x1e80100_pcie_north_anoc = { | |
| 2215 | + | .config = &x1e80100_pcie_north_anoc_regmap_config, | |
| 1778 | 2216 | .nodes = pcie_north_anoc_nodes, | |
| 1779 | 2217 | .num_nodes = ARRAY_SIZE(pcie_north_anoc_nodes), | |
| 1780 | 2218 | .bcms = pcie_north_anoc_bcms, | |
| @@ -1793,7 +2231,16 @@ static struct qcom_icc_node * const pcie_south_anoc_nodes[] = { | |||
| 1793 | 2231 | [SLAVE_PCIE_SOUTH] = &qns_pcie_south_gem_noc, | |
| 1794 | 2232 | }; | |
| 1795 | 2233 | ||
| 2234 | + | static const struct regmap_config x1e80100_pcie_south_anoc_regmap_config = { | |
| 2235 | + | .reg_bits = 32, | |
| 2236 | + | .reg_stride = 4, | |
| 2237 | + | .val_bits = 32, | |
| 2238 | + | .max_register = 0xd080, | |
| 2239 | + | .fast_io = true, | |
| 2240 | + | }; | |
| 2241 | + | ||
| 1796 | 2242 | static const struct qcom_icc_desc x1e80100_pcie_south_anoc = { | |
| 2243 | + | .config = &x1e80100_pcie_south_anoc_regmap_config, | |
| 1797 | 2244 | .nodes = pcie_south_anoc_nodes, | |
| 1798 | 2245 | .num_nodes = ARRAY_SIZE(pcie_south_anoc_nodes), | |
| 1799 | 2246 | .bcms = pcie_south_anoc_bcms, | |
| @@ -1815,7 +2262,16 @@ static struct qcom_icc_node * const system_noc_nodes[] = { | |||
| 1815 | 2262 | [SLAVE_SNOC_GEM_NOC_SF] = &qns_gemnoc_sf, | |
| 1816 | 2263 | }; | |
| 1817 | 2264 | ||
| 2265 | + | static const struct regmap_config x1e80100_system_noc_regmap_config = { | |
| 2266 | + | .reg_bits = 32, | |
| 2267 | + | .reg_stride = 4, | |
| 2268 | + | .val_bits = 32, | |
| 2269 | + | .max_register = 0x1c080, | |
| 2270 | + | .fast_io = true, | |
| 2271 | + | }; | |
| 2272 | + | ||
| 1818 | 2273 | static const struct qcom_icc_desc x1e80100_system_noc = { | |
| 2274 | + | .config = &x1e80100_system_noc_regmap_config, | |
| 1819 | 2275 | .nodes = system_noc_nodes, | |
| 1820 | 2276 | .num_nodes = ARRAY_SIZE(system_noc_nodes), | |
| 1821 | 2277 | .bcms = system_noc_bcms, | |
| @@ -1831,7 +2287,16 @@ static struct qcom_icc_node * const usb_center_anoc_nodes[] = { | |||
| 1831 | 2287 | [SLAVE_USB_NOC_SNOC] = &qns_aggre_usb_snoc, | |
| 1832 | 2288 | }; | |
| 1833 | 2289 | ||
| 2290 | + | static const struct regmap_config x1e80100_usb_center_anoc_regmap_config = { | |
| 2291 | + | .reg_bits = 32, | |
| 2292 | + | .reg_stride = 4, | |
| 2293 | + | .val_bits = 32, | |
| 2294 | + | .max_register = 0x8800, | |
| 2295 | + | .fast_io = true, | |
| 2296 | + | }; | |
| 2297 | + | ||
| 1834 | 2298 | static const struct qcom_icc_desc x1e80100_usb_center_anoc = { | |
| 2299 | + | .config = &x1e80100_usb_center_anoc_regmap_config, | |
| 1835 | 2300 | .nodes = usb_center_anoc_nodes, | |
| 1836 | 2301 | .num_nodes = ARRAY_SIZE(usb_center_anoc_nodes), | |
| 1837 | 2302 | .bcms = usb_center_anoc_bcms, | |
| @@ -1847,11 +2312,21 @@ static struct qcom_icc_node * const usb_north_anoc_nodes[] = { | |||
| 1847 | 2312 | [SLAVE_AGGRE_USB_NORTH] = &qns_aggre_usb_north_snoc, | |
| 1848 | 2313 | }; | |
| 1849 | 2314 | ||
| 2315 | + | static const struct regmap_config x1e80100_usb_north_anoc_regmap_config = { | |
| 2316 | + | .reg_bits = 32, | |
| 2317 | + | .reg_stride = 4, | |
| 2318 | + | .val_bits = 32, | |
| 2319 | + | .max_register = 0x7080, | |
| 2320 | + | .fast_io = true, | |
| 2321 | + | }; | |
| 2322 | + | ||
| 1850 | 2323 | static const struct qcom_icc_desc x1e80100_usb_north_anoc = { | |
| 2324 | + | .config = &x1e80100_usb_north_anoc_regmap_config, | |
| 1851 | 2325 | .nodes = usb_north_anoc_nodes, | |
| 1852 | 2326 | .num_nodes = ARRAY_SIZE(usb_north_anoc_nodes), | |
| 1853 | 2327 | .bcms = usb_north_anoc_bcms, | |
| 1854 | 2328 | .num_bcms = ARRAY_SIZE(usb_north_anoc_bcms), | |
| 2329 | + | .qos_requires_clocks = true, | |
| 1855 | 2330 | }; | |
| 1856 | 2331 | ||
| 1857 | 2332 | static struct qcom_icc_bcm * const usb_south_anoc_bcms[] = { | |
| @@ -1867,11 +2342,21 @@ static struct qcom_icc_node * const usb_south_anoc_nodes[] = { | |||
| 1867 | 2342 | [SLAVE_AGGRE_USB_SOUTH] = &qns_aggre_usb_south_snoc, | |
| 1868 | 2343 | }; | |
| 1869 | 2344 | ||
| 2345 | + | static const struct regmap_config x1e80100_usb_south_anoc_regmap_config = { | |
| 2346 | + | .reg_bits = 32, | |
| 2347 | + | .reg_stride = 4, | |
| 2348 | + | .val_bits = 32, | |
| 2349 | + | .max_register = 0xf080, | |
| 2350 | + | .fast_io = true, | |
| 2351 | + | }; | |
| 2352 | + | ||
| 1870 | 2353 | static const struct qcom_icc_desc x1e80100_usb_south_anoc = { | |
| 2354 | + | .config = &x1e80100_usb_south_anoc_regmap_config, | |
| 1871 | 2355 | .nodes = usb_south_anoc_nodes, | |
| 1872 | 2356 | .num_nodes = ARRAY_SIZE(usb_south_anoc_nodes), | |
| 1873 | 2357 | .bcms = usb_south_anoc_bcms, | |
| 1874 | 2358 | .num_bcms = ARRAY_SIZE(usb_south_anoc_bcms), | |
| 2359 | + | .qos_requires_clocks = true, | |
| 1875 | 2360 | }; | |
| 1876 | 2361 | ||
| 1877 | 2362 | static const struct of_device_id qnoc_of_match[] = { | |
modified drivers/iommu/dma-iommu.c
| @@ -1228,9 +1228,9 @@ dma_addr_t iommu_dma_map_phys(struct device *dev, phys_addr_t phys, size_t size, | |||
| 1228 | 1228 | * If both the physical buffer start address and size are page aligned, | |
| 1229 | 1229 | * we don't need to use a bounce page. | |
| 1230 | 1230 | */ | |
| 1231 | - | if (!(attrs & DMA_ATTR_MMIO) && dev_use_swiotlb(dev, size, dir) && | |
| 1231 | + | if (dev_use_swiotlb(dev, size, dir) && | |
| 1232 | 1232 | iova_unaligned(iovad, phys, size)) { | |
| 1233 | - | if (attrs & DMA_ATTR_REQUIRE_COHERENT) | |
| 1233 | + | if (attrs & (DMA_ATTR_MMIO | DMA_ATTR_REQUIRE_COHERENT)) | |
| 1234 | 1234 | return DMA_MAPPING_ERROR; | |
| 1235 | 1235 | ||
| 1236 | 1236 | phys = iommu_dma_map_swiotlb(dev, phys, size, dir, attrs); | |
modified drivers/md/dm-crypt.c
| @@ -2894,13 +2894,8 @@ static int crypt_ctr_cipher_new(struct dm_target *ti, char *cipher_in, char *key | |||
| 2894 | 2894 | } | |
| 2895 | 2895 | } | |
| 2896 | 2896 | ||
| 2897 | - | if (*ivmode && !strcmp(*ivmode, "lmk")) { | |
| 2898 | - | if (crypt_integrity_aead(cc)) { | |
| 2899 | - | ti->error = "AEAD transforms not supported for LMK"; | |
| 2900 | - | return -EINVAL; | |
| 2901 | - | } | |
| 2897 | + | if (*ivmode && !strcmp(*ivmode, "lmk")) | |
| 2902 | 2898 | cc->tfms_count = 64; | |
| 2903 | - | } | |
| 2904 | 2899 | ||
| 2905 | 2900 | if (*ivmode && !strcmp(*ivmode, "essiv")) { | |
| 2906 | 2901 | if (!*ivopts) { | |
modified drivers/md/dm-integrity.c
| @@ -180,7 +180,6 @@ struct dm_integrity_c { | |||
| 180 | 180 | struct dm_bufio_client *bufio; | |
| 181 | 181 | struct workqueue_struct *metadata_wq; | |
| 182 | 182 | struct superblock *sb; | |
| 183 | - | struct superblock *sb_copy; | |
| 184 | 183 | unsigned int journal_pages; | |
| 185 | 184 | unsigned int n_bitmap_blocks; | |
| 186 | 185 | ||
| @@ -2722,7 +2721,7 @@ static void dm_integrity_inline_recheck(struct work_struct *w) | |||
| 2722 | 2721 | outgoing_data = dio->integrity_payload + PAGE_SIZE; | |
| 2723 | 2722 | ||
| 2724 | 2723 | while (dio->bio_details.bi_iter.bi_size) { | |
| 2725 | - | char digest[MAX_T(size_t, HASH_MAX_DIGESTSIZE, MAX_TAG_SIZE)]; | |
| 2724 | + | char digest[HASH_MAX_DIGESTSIZE]; | |
| 2726 | 2725 | int r; | |
| 2727 | 2726 | struct bio_integrity_payload *bip; | |
| 2728 | 2727 | struct bio_vec bv; | |
| @@ -2789,7 +2788,7 @@ static inline bool dm_integrity_check(struct dm_integrity_c *ic, struct dm_integ | |||
| 2789 | 2788 | unsigned pos = 0; | |
| 2790 | 2789 | ||
| 2791 | 2790 | while (dio->bio_details.bi_iter.bi_size) { | |
| 2792 | - | char digest[MAX_T(size_t, HASH_MAX_DIGESTSIZE, MAX_TAG_SIZE)]; | |
| 2791 | + | char digest[HASH_MAX_DIGESTSIZE]; | |
| 2793 | 2792 | struct bio_vec bv = bio_iter_iovec(bio, dio->bio_details.bi_iter); | |
| 2794 | 2793 | char *mem = integrity_kmap(ic, bv.bv_page); | |
| 2795 | 2794 | integrity_sector_checksum(ic, &dio->ahash_req, dio->bio_details.bi_iter.bi_sector, mem, bv.bv_offset, digest); | |
| @@ -3859,35 +3858,6 @@ static void dm_integrity_postsuspend(struct dm_target *ti) | |||
| 3859 | 3858 | ic->journal_uptodate = true; | |
| 3860 | 3859 | } | |
| 3861 | 3860 | ||
| 3862 | - | /* | |
| 3863 | - | * The superblock is re-read from the device on every resume, so that we pick | |
| 3864 | - | * up the flags and the recalculate position. The geometry described by the | |
| 3865 | - | * superblock must not change though - the in-memory structures (and the | |
| 3866 | - | * journal in particular) were sized according to the superblock that was | |
| 3867 | - | * validated in the constructor. Reject a superblock that was modified behind | |
| 3868 | - | * our back. | |
| 3869 | - | * | |
| 3870 | - | * Only the fields that the driver never rewrites may be tested here. In | |
| 3871 | - | * particular, "version" is recalculated by sb_set_version on every superblock | |
| 3872 | - | * write and it depends on SB_FLAG_RECALCULATING and SB_FLAG_DIRTY_BITMAP, and | |
| 3873 | - | * SB_FLAG_DISCARD_KEYED may be set by dm_integrity_resume itself. | |
| 3874 | - | */ | |
| 3875 | - | static bool superblock_changed(struct dm_integrity_c *ic) | |
| 3876 | - | { | |
| 3877 | - | const __le32 immutable_flags = cpu_to_le32(SB_FLAG_HAVE_JOURNAL_MAC | | |
| 3878 | - | SB_FLAG_FIXED_PADDING | | |
| 3879 | - | SB_FLAG_FIXED_HMAC | | |
| 3880 | - | SB_FLAG_INLINE); | |
| 3881 | - | ||
| 3882 | - | return memcmp(ic->sb->magic, ic->sb_copy->magic, sizeof(ic->sb->magic)) != 0 || | |
| 3883 | - | ic->sb->log2_interleave_sectors != ic->sb_copy->log2_interleave_sectors || | |
| 3884 | - | ic->sb->integrity_tag_size != ic->sb_copy->integrity_tag_size || | |
| 3885 | - | ic->sb->journal_sections != ic->sb_copy->journal_sections || | |
| 3886 | - | ic->sb->log2_sectors_per_block != ic->sb_copy->log2_sectors_per_block || | |
| 3887 | - | ((ic->sb->flags ^ ic->sb_copy->flags) & immutable_flags) != 0 || | |
| 3888 | - | memcmp(ic->sb->salt, ic->sb_copy->salt, SALT_SIZE) != 0; | |
| 3889 | - | } | |
| 3890 | - | ||
| 3891 | 3861 | static void dm_integrity_resume(struct dm_target *ti) | |
| 3892 | 3862 | { | |
| 3893 | 3863 | struct dm_integrity_c *ic = ti->private; | |
| @@ -3906,18 +3876,6 @@ static void dm_integrity_resume(struct dm_target *ti) | |||
| 3906 | 3876 | if (r) | |
| 3907 | 3877 | dm_integrity_io_error(ic, "reading superblock", r); | |
| 3908 | 3878 | ||
| 3909 | - | if (unlikely(superblock_changed(ic))) { | |
| 3910 | - | /* | |
| 3911 | - | * Restore the superblock that we validated in the constructor, | |
| 3912 | - | * so that the rest of the driver doesn't operate on values | |
| 3913 | - | * that don't match the in-memory structures. | |
| 3914 | - | */ | |
| 3915 | - | memcpy(ic->sb, ic->sb_copy, sizeof(struct superblock)); | |
| 3916 | - | DMERR("The superblock was changed while the device was suspended"); | |
| 3917 | - | dm_integrity_io_error(ic, "superblock check", -EINVAL); | |
| 3918 | - | goto skip_writes; | |
| 3919 | - | } | |
| 3920 | - | ||
| 3921 | 3879 | if (ic->mode == 'R') | |
| 3922 | 3880 | goto skip_writes; | |
| 3923 | 3881 | ||
| @@ -5469,13 +5427,6 @@ try_smaller_buffer: | |||
| 5469 | 5427 | ic->just_formatted = true; | |
| 5470 | 5428 | } | |
| 5471 | 5429 | ||
| 5472 | - | ic->sb_copy = kmemdup(ic->sb, sizeof(struct superblock), GFP_KERNEL); | |
| 5473 | - | if (!ic->sb_copy) { | |
| 5474 | - | ti->error = "Cannot allocate superblock copy"; | |
| 5475 | - | r = -ENOMEM; | |
| 5476 | - | goto bad; | |
| 5477 | - | } | |
| 5478 | - | ||
| 5479 | 5430 | if (!ic->meta_dev && ic->mode != 'I') { | |
| 5480 | 5431 | r = dm_set_target_max_io_len(ti, 1U << ic->sb->log2_interleave_sectors); | |
| 5481 | 5432 | if (r) | |
| @@ -5574,7 +5525,6 @@ static void dm_integrity_dtr(struct dm_target *ti) | |||
| 5574 | 5525 | kvfree(ic->journal_tree); | |
| 5575 | 5526 | if (ic->sb) | |
| 5576 | 5527 | free_pages_exact(ic->sb, SB_SECTORS << SECTOR_SHIFT); | |
| 5577 | - | kfree(ic->sb_copy); | |
| 5578 | 5528 | ||
| 5579 | 5529 | if (ic->internal_shash) | |
| 5580 | 5530 | crypto_free_shash(ic->internal_shash); | |
modified drivers/md/dm-ioctl.c
| @@ -656,16 +656,10 @@ static void *get_result_buffer(struct dm_ioctl *param, size_t param_size, | |||
| 656 | 656 | { | |
| 657 | 657 | param->data_start = align_ptr(param + 1) - (void *) param; | |
| 658 | 658 | ||
| 659 | - | if (param->data_start < param_size) { | |
| 659 | + | if (param->data_start < param_size) | |
| 660 | 660 | *len = param_size - param->data_start; | |
| 661 | - | } else { | |
| 662 | - | /* | |
| 663 | - | * The buffer can be as small as offsetof(*param, data), which | |
| 664 | - | * is less than sizeof(*param), so don't run off the end of it. | |
| 665 | - | */ | |
| 661 | + | else | |
| 666 | 662 | *len = 0; | |
| 667 | - | param->data_start = param_size; | |
| 668 | - | } | |
| 669 | 663 | ||
| 670 | 664 | return ((void *) param) + param->data_start; | |
| 671 | 665 | } | |
| @@ -1273,7 +1267,6 @@ static int do_resume(struct dm_ioctl *param) | |||
| 1273 | 1267 | /* Do we need to load a new map ? */ | |
| 1274 | 1268 | if (new_map) { | |
| 1275 | 1269 | sector_t old_size, new_size; | |
| 1276 | - | blk_mode_t new_map_mode; | |
| 1277 | 1270 | ||
| 1278 | 1271 | dm_ima_context_table_op(md, ima_context, DM_IMA_TABLE_SAVE); | |
| 1279 | 1272 | /* Suspend if it isn't already suspended */ | |
| @@ -1306,7 +1299,6 @@ static int do_resume(struct dm_ioctl *param) | |||
| 1306 | 1299 | } | |
| 1307 | 1300 | } | |
| 1308 | 1301 | ||
| 1309 | - | new_map_mode = dm_table_get_mode(new_map); | |
| 1310 | 1302 | old_size = dm_get_size(md); | |
| 1311 | 1303 | old_map = dm_swap_table(md, new_map); | |
| 1312 | 1304 | if (IS_ERR(old_map)) { | |
| @@ -1322,7 +1314,7 @@ static int do_resume(struct dm_ioctl *param) | |||
| 1322 | 1314 | if (old_size && new_size && old_size != new_size) | |
| 1323 | 1315 | need_resize_uevent = true; | |
| 1324 | 1316 | ||
| 1325 | - | if (new_map_mode & BLK_OPEN_WRITE) | |
| 1317 | + | if (dm_table_get_mode(new_map) & BLK_OPEN_WRITE) | |
| 1326 | 1318 | set_disk_ro(dm_disk(md), 0); | |
| 1327 | 1319 | else | |
| 1328 | 1320 | set_disk_ro(dm_disk(md), 1); | |
modified drivers/md/dm-snap.c
| @@ -1292,20 +1292,6 @@ static int snapshot_ctr(struct dm_target *ti, unsigned int argc, char **argv) | |||
| 1292 | 1292 | goto bad_store; | |
| 1293 | 1293 | } | |
| 1294 | 1294 | ||
| 1295 | - | /* | |
| 1296 | - | * snapshot-merge requires the optional prepare_merge/commit_merge | |
| 1297 | - | * callbacks; the transient exception store does not implement them. | |
| 1298 | - | * The handover path checks this in __validate_exception_handover(), | |
| 1299 | - | * but a directly constructed snapshot-merge never goes through it. | |
| 1300 | - | */ | |
| 1301 | - | if (dm_target_is_snapshot_merge(ti) && | |
| 1302 | - | (!s->store->type->prepare_merge || | |
| 1303 | - | !s->store->type->commit_merge)) { | |
| 1304 | - | ti->error = "Snapshot exception store does not support snapshot-merge."; | |
| 1305 | - | r = -EINVAL; | |
| 1306 | - | goto bad_hash_tables; | |
| 1307 | - | } | |
| 1308 | - | ||
| 1309 | 1295 | argv += args_used; | |
| 1310 | 1296 | argc -= args_used; | |
| 1311 | 1297 | ||
modified drivers/media/usb/em28xx/em28xx-video.c
| @@ -2416,7 +2416,7 @@ static int em28xx_v4l2_fini(struct em28xx *dev) | |||
| 2416 | 2416 | if (video_is_registered(&v4l2->radio_dev)) { | |
| 2417 | 2417 | dev_info(&dev->intf->dev, "V4L2 device %s deregistered\n", | |
| 2418 | 2418 | video_device_node_name(&v4l2->radio_dev)); | |
| 2419 | - | video_unregister_device(&v4l2->radio_dev); | |
| 2419 | + | vb2_video_unregister_device(&v4l2->radio_dev); | |
| 2420 | 2420 | } | |
| 2421 | 2421 | if (video_is_registered(&v4l2->vbi_dev)) { | |
| 2422 | 2422 | dev_info(&dev->intf->dev, "V4L2 device %s deregistered\n", | |
| @@ -3082,7 +3082,7 @@ unregister_dev: | |||
| 3082 | 3082 | dev_info(&dev->intf->dev, | |
| 3083 | 3083 | "V4L2 device %s deregistered\n", | |
| 3084 | 3084 | video_device_node_name(&v4l2->radio_dev)); | |
| 3085 | - | video_unregister_device(&v4l2->radio_dev); | |
| 3085 | + | vb2_video_unregister_device(&v4l2->radio_dev); | |
| 3086 | 3086 | } | |
| 3087 | 3087 | if (video_is_registered(&v4l2->vbi_dev)) { | |
| 3088 | 3088 | dev_info(&dev->intf->dev, | |
modified drivers/memstick/core/memstick.c
| @@ -370,7 +370,9 @@ int memstick_set_rw_addr(struct memstick_dev *card) | |||
| 370 | 370 | { | |
| 371 | 371 | card->next_request = h_memstick_set_rw_addr; | |
| 372 | 372 | memstick_new_req(card->host); | |
| 373 | - | wait_for_completion(&card->mrq_complete); | |
| 373 | + | if (!wait_for_completion_timeout(&card->mrq_complete, | |
| 374 | + | msecs_to_jiffies(500))) | |
| 375 | + | card->current_mrq.error = -ETIMEDOUT; | |
| 374 | 376 | ||
| 375 | 377 | return card->current_mrq.error; | |
| 376 | 378 | } | |
| @@ -403,7 +405,9 @@ static struct memstick_dev *memstick_alloc_card(struct memstick_host *host) | |||
| 403 | 405 | ||
| 404 | 406 | card->next_request = h_memstick_read_dev_id; | |
| 405 | 407 | memstick_new_req(host); | |
| 406 | - | wait_for_completion(&card->mrq_complete); | |
| 408 | + | if (!wait_for_completion_timeout(&card->mrq_complete, | |
| 409 | + | msecs_to_jiffies(500))) | |
| 410 | + | card->current_mrq.error = -ETIMEDOUT; | |
| 407 | 411 | ||
| 408 | 412 | if (card->current_mrq.error) | |
| 409 | 413 | goto err_out; | |
modified drivers/memstick/host/rtsx_usb_ms.c
| @@ -27,6 +27,7 @@ struct rtsx_usb_ms { | |||
| 27 | 27 | struct memstick_host *msh; | |
| 28 | 28 | struct memstick_request *req; | |
| 29 | 29 | ||
| 30 | + | struct mutex host_mutex; | |
| 30 | 31 | struct work_struct handle_req; | |
| 31 | 32 | struct delayed_work poll_card; | |
| 32 | 33 | ||
| @@ -513,13 +514,6 @@ static void rtsx_usb_ms_handle_req(struct work_struct *work) | |||
| 513 | 514 | struct memstick_host *msh = host->msh; | |
| 514 | 515 | int rc; | |
| 515 | 516 | ||
| 516 | - | /* Fail requests after eject so their waiters are released. */ | |
| 517 | - | if (host->eject) { | |
| 518 | - | while (!memstick_next_req(msh, &host->req)) | |
| 519 | - | host->req->error = -ENOMEDIUM; | |
| 520 | - | return; | |
| 521 | - | } | |
| 522 | - | ||
| 523 | 517 | if (!host->req) { | |
| 524 | 518 | pm_runtime_get_sync(ms_dev(host)); | |
| 525 | 519 | do { | |
| @@ -553,7 +547,8 @@ static void rtsx_usb_ms_request(struct memstick_host *msh) | |||
| 553 | 547 | ||
| 554 | 548 | dev_dbg(ms_dev(host), "--> %s\n", __func__); | |
| 555 | 549 | ||
| 556 | - | schedule_work(&host->handle_req); | |
| 550 | + | if (!host->eject) | |
| 551 | + | schedule_work(&host->handle_req); | |
| 557 | 552 | } | |
| 558 | 553 | ||
| 559 | 554 | static int rtsx_usb_ms_set_param(struct memstick_host *msh, | |
| @@ -786,6 +781,7 @@ static int rtsx_usb_ms_drv_probe(struct platform_device *pdev) | |||
| 786 | 781 | host->power_mode = MEMSTICK_POWER_OFF; | |
| 787 | 782 | platform_set_drvdata(pdev, host); | |
| 788 | 783 | ||
| 784 | + | mutex_init(&host->host_mutex); | |
| 789 | 785 | INIT_WORK(&host->handle_req, rtsx_usb_ms_handle_req); | |
| 790 | 786 | ||
| 791 | 787 | INIT_DELAYED_WORK(&host->poll_card, rtsx_usb_ms_poll_card); | |
| @@ -816,12 +812,27 @@ static void rtsx_usb_ms_drv_remove(struct platform_device *pdev) | |||
| 816 | 812 | { | |
| 817 | 813 | struct rtsx_usb_ms *host = platform_get_drvdata(pdev); | |
| 818 | 814 | struct memstick_host *msh = host->msh; | |
| 815 | + | int err; | |
| 819 | 816 | ||
| 820 | 817 | host->eject = true; | |
| 821 | 818 | msh->removing = true; | |
| 822 | - | flush_work(&host->handle_req); | |
| 819 | + | cancel_work_sync(&host->handle_req); | |
| 823 | 820 | cancel_delayed_work_sync(&host->poll_card); | |
| 824 | 821 | ||
| 822 | + | mutex_lock(&host->host_mutex); | |
| 823 | + | if (host->req) { | |
| 824 | + | dev_dbg(ms_dev(host), | |
| 825 | + | "%s: Controller removed during transfer\n", | |
| 826 | + | dev_name(&msh->dev)); | |
| 827 | + | host->req->error = -ENOMEDIUM; | |
| 828 | + | do { | |
| 829 | + | err = memstick_next_req(msh, &host->req); | |
| 830 | + | if (!err) | |
| 831 | + | host->req->error = -ENOMEDIUM; | |
| 832 | + | } while (!err); | |
| 833 | + | } | |
| 834 | + | mutex_unlock(&host->host_mutex); | |
| 835 | + | ||
| 825 | 836 | /* Balance possible unbalanced usage count | |
| 826 | 837 | * e.g. unconditional module removal | |
| 827 | 838 | */ | |
| @@ -830,8 +841,6 @@ static void rtsx_usb_ms_drv_remove(struct platform_device *pdev) | |||
| 830 | 841 | ||
| 831 | 842 | pm_runtime_disable(ms_dev(host)); | |
| 832 | 843 | memstick_remove_host(msh); | |
| 833 | - | /* No card, no new requests; wait for the last failed one to finish. */ | |
| 834 | - | cancel_work_sync(&host->handle_req); | |
| 835 | 844 | dev_dbg(ms_dev(host), | |
| 836 | 845 | ": Realtek USB Memstick controller has been removed\n"); | |
| 837 | 846 | memstick_free_host(msh); | |
modified drivers/mmc/host/cavium-octeon.c
| @@ -295,12 +295,9 @@ static void octeon_mmc_remove(struct platform_device *pdev) | |||
| 295 | 295 | u64 dma_cfg; | |
| 296 | 296 | int i; | |
| 297 | 297 | ||
| 298 | - | for (i = 0; i < CAVIUM_MAX_MMC; i++) { | |
| 298 | + | for (i = 0; i < CAVIUM_MAX_MMC; i++) | |
| 299 | 299 | if (host->slot[i]) | |
| 300 | 300 | cvm_mmc_of_slot_remove(host->slot[i]); | |
| 301 | - | if (host->slot_pdev[i]) | |
| 302 | - | of_platform_device_destroy(&host->slot_pdev[i]->dev, NULL); | |
| 303 | - | } | |
| 304 | 301 | ||
| 305 | 302 | dma_cfg = readq(host->dma_base + MIO_EMM_DMA_CFG(host)); | |
| 306 | 303 | dma_cfg &= ~MIO_EMM_DMA_CFG_EN; | |
modified drivers/mmc/host/cavium-thunderx.c
| @@ -173,12 +173,9 @@ static void thunder_mmc_remove(struct pci_dev *pdev) | |||
| 173 | 173 | u64 dma_cfg; | |
| 174 | 174 | int i; | |
| 175 | 175 | ||
| 176 | - | for (i = 0; i < CAVIUM_MAX_MMC; i++) { | |
| 176 | + | for (i = 0; i < CAVIUM_MAX_MMC; i++) | |
| 177 | 177 | if (host->slot[i]) | |
| 178 | 178 | cvm_mmc_of_slot_remove(host->slot[i]); | |
| 179 | - | if (host->slot_pdev[i]) | |
| 180 | - | of_platform_device_destroy(&host->slot_pdev[i]->dev, NULL); | |
| 181 | - | } | |
| 182 | 179 | ||
| 183 | 180 | dma_cfg = readq(host->dma_base + MIO_EMM_DMA_CFG(host)); | |
| 184 | 181 | dma_cfg &= ~MIO_EMM_DMA_CFG_EN; | |
modified drivers/mmc/host/mtk-sd.c
| @@ -3216,7 +3216,6 @@ static void msdc_drv_remove(struct platform_device *pdev) | |||
| 3216 | 3216 | ||
| 3217 | 3217 | platform_set_drvdata(pdev, NULL); | |
| 3218 | 3218 | mmc_remove_host(mmc); | |
| 3219 | - | cancel_delayed_work_sync(&host->req_timeout); | |
| 3220 | 3219 | msdc_deinit_hw(host); | |
| 3221 | 3220 | msdc_gate_clock(host); | |
| 3222 | 3221 | ||
modified drivers/mmc/host/sdhci-sprd.c
| @@ -890,10 +890,6 @@ static void sdhci_sprd_remove(struct platform_device *pdev) | |||
| 890 | 890 | struct sdhci_host *host = platform_get_drvdata(pdev); | |
| 891 | 891 | struct sdhci_sprd_host *sprd_host = TO_SPRD_HOST(host); | |
| 892 | 892 | ||
| 893 | - | pm_runtime_get_sync(&pdev->dev); | |
| 894 | - | pm_runtime_disable(&pdev->dev); | |
| 895 | - | pm_runtime_put_noidle(&pdev->dev); | |
| 896 | - | ||
| 897 | 893 | sdhci_remove_host(host, 0); | |
| 898 | 894 | ||
| 899 | 895 | clk_disable_unprepare(sprd_host->clk_sdio); | |
modified drivers/mtd/chips/cfi_cmdset_0001.c
| @@ -1716,24 +1716,12 @@ static int cfi_intelext_write_words (struct mtd_info *mtd, loff_t to , size_t le | |||
| 1716 | 1716 | } | |
| 1717 | 1717 | ||
| 1718 | 1718 | ||
| 1719 | - | /* | |
| 1720 | - | * Keep noinline: inlined, the map_word temporaries put do_write_buffer() over | |
| 1721 | - | * the frame-size limit with MTD_MAP_BANK_WIDTH_32 and KASAN_STACK. | |
| 1722 | - | */ | |
| 1723 | - | static noinline void __xipram cfi_write_cmd(struct map_info *map, | |
| 1724 | - | unsigned long cmd, unsigned long adr) | |
| 1725 | - | { | |
| 1726 | - | struct cfi_private *cfi = map->fldrv_priv; | |
| 1727 | - | ||
| 1728 | - | map_write(map, CMD(cmd), adr); | |
| 1729 | - | } | |
| 1730 | - | ||
| 1731 | 1719 | static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip, | |
| 1732 | 1720 | unsigned long adr, const struct kvec **pvec, | |
| 1733 | 1721 | unsigned long *pvec_seek, int len) | |
| 1734 | 1722 | { | |
| 1735 | 1723 | struct cfi_private *cfi = map->fldrv_priv; | |
| 1736 | - | map_word status, datum; | |
| 1724 | + | map_word status, write_cmd, datum; | |
| 1737 | 1725 | unsigned long cmd_adr; | |
| 1738 | 1726 | int ret, wbufsize, word_gap, words; | |
| 1739 | 1727 | const struct kvec *vec; | |
| @@ -1752,6 +1740,9 @@ static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip, | |||
| 1752 | 1740 | if (is_LH28F640BF(cfi)) | |
| 1753 | 1741 | cmd_adr = adr; | |
| 1754 | 1742 | ||
| 1743 | + | /* Let's determine this according to the interleave only once */ | |
| 1744 | + | write_cmd = (cfi->cfiq->P_ID != P_ID_INTEL_PERFORMANCE) ? CMD(0xe8) : CMD(0xe9); | |
| 1745 | + | ||
| 1755 | 1746 | mutex_lock(&chip->mutex); | |
| 1756 | 1747 | ret = get_chip(map, chip, cmd_adr, FL_WRITING); | |
| 1757 | 1748 | if (ret) { | |
| @@ -1768,7 +1759,7 @@ static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip, | |||
| 1768 | 1759 | So we must check here and reset those bits if they're set. Otherwise | |
| 1769 | 1760 | we're just pissing in the wind */ | |
| 1770 | 1761 | if (chip->state != FL_STATUS) { | |
| 1771 | - | cfi_write_cmd(map, 0x70, cmd_adr); | |
| 1762 | + | map_write(map, CMD(0x70), cmd_adr); | |
| 1772 | 1763 | chip->state = FL_STATUS; | |
| 1773 | 1764 | } | |
| 1774 | 1765 | status = map_read(map, cmd_adr); | |
| @@ -1776,22 +1767,21 @@ static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip, | |||
| 1776 | 1767 | xip_enable(map, chip, cmd_adr); | |
| 1777 | 1768 | printk(KERN_WARNING "SR.4 or SR.5 bits set in buffer write (status %lx). Clearing.\n", status.x[0]); | |
| 1778 | 1769 | xip_disable(map, chip, cmd_adr); | |
| 1779 | - | cfi_write_cmd(map, 0x50, cmd_adr); | |
| 1780 | - | cfi_write_cmd(map, 0x70, cmd_adr); | |
| 1770 | + | map_write(map, CMD(0x50), cmd_adr); | |
| 1771 | + | map_write(map, CMD(0x70), cmd_adr); | |
| 1781 | 1772 | } | |
| 1782 | 1773 | ||
| 1783 | 1774 | chip->state = FL_WRITING_TO_BUFFER; | |
| 1784 | - | cfi_write_cmd(map, (cfi->cfiq->P_ID != P_ID_INTEL_PERFORMANCE) ? 0xe8 : 0xe9, | |
| 1785 | - | cmd_adr); | |
| 1775 | + | map_write(map, write_cmd, cmd_adr); | |
| 1786 | 1776 | ret = WAIT_TIMEOUT(map, chip, cmd_adr, 0, 0); | |
| 1787 | 1777 | if (ret) { | |
| 1788 | 1778 | /* Argh. Not ready for write to buffer */ | |
| 1789 | 1779 | map_word Xstatus = map_read(map, cmd_adr); | |
| 1790 | - | cfi_write_cmd(map, 0x70, cmd_adr); | |
| 1780 | + | map_write(map, CMD(0x70), cmd_adr); | |
| 1791 | 1781 | chip->state = FL_STATUS; | |
| 1792 | 1782 | status = map_read(map, cmd_adr); | |
| 1793 | - | cfi_write_cmd(map, 0x50, cmd_adr); | |
| 1794 | - | cfi_write_cmd(map, 0x70, cmd_adr); | |
| 1783 | + | map_write(map, CMD(0x50), cmd_adr); | |
| 1784 | + | map_write(map, CMD(0x70), cmd_adr); | |
| 1795 | 1785 | xip_enable(map, chip, cmd_adr); | |
| 1796 | 1786 | printk(KERN_ERR "%s: Chip not ready for buffer write. Xstatus = %lx, status = %lx\n", | |
| 1797 | 1787 | map->name, Xstatus.x[0], status.x[0]); | |
| @@ -1810,7 +1800,7 @@ static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip, | |||
| 1810 | 1800 | } | |
| 1811 | 1801 | ||
| 1812 | 1802 | /* Write length of data to come */ | |
| 1813 | - | cfi_write_cmd(map, words, cmd_adr); | |
| 1803 | + | map_write(map, CMD(words), cmd_adr ); | |
| 1814 | 1804 | ||
| 1815 | 1805 | /* Write data */ | |
| 1816 | 1806 | vec = *pvec; | |
| @@ -1847,7 +1837,7 @@ static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip, | |||
| 1847 | 1837 | *pvec_seek = vec_seek; | |
| 1848 | 1838 | ||
| 1849 | 1839 | /* GO GO GO */ | |
| 1850 | - | cfi_write_cmd(map, 0xd0, cmd_adr); | |
| 1840 | + | map_write(map, CMD(0xd0), cmd_adr); | |
| 1851 | 1841 | chip->state = FL_WRITING; | |
| 1852 | 1842 | ||
| 1853 | 1843 | ret = INVAL_CACHE_AND_WAIT(map, chip, cmd_adr, | |
| @@ -1855,7 +1845,7 @@ static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip, | |||
| 1855 | 1845 | chip->buffer_write_time, | |
| 1856 | 1846 | chip->buffer_write_time_max); | |
| 1857 | 1847 | if (ret) { | |
| 1858 | - | cfi_write_cmd(map, 0x70, cmd_adr); | |
| 1848 | + | map_write(map, CMD(0x70), cmd_adr); | |
| 1859 | 1849 | chip->state = FL_STATUS; | |
| 1860 | 1850 | xip_enable(map, chip, cmd_adr); | |
| 1861 | 1851 | printk(KERN_ERR "%s: buffer write error (status timeout)\n", map->name); | |
| @@ -1868,8 +1858,8 @@ static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip, | |||
| 1868 | 1858 | unsigned long chipstatus = MERGESTATUS(status); | |
| 1869 | 1859 | ||
| 1870 | 1860 | /* reset status */ | |
| 1871 | - | cfi_write_cmd(map, 0x50, cmd_adr); | |
| 1872 | - | cfi_write_cmd(map, 0x70, cmd_adr); | |
| 1861 | + | map_write(map, CMD(0x50), cmd_adr); | |
| 1862 | + | map_write(map, CMD(0x70), cmd_adr); | |
| 1873 | 1863 | xip_enable(map, chip, cmd_adr); | |
| 1874 | 1864 | ||
| 1875 | 1865 | if (chipstatus & 0x02) { | |
modified drivers/mtd/devices/block2mtd.c
| @@ -293,7 +293,7 @@ static struct block2mtd_dev *add_device(char *devname, int erase_size, | |||
| 293 | 293 | } | |
| 294 | 294 | ||
| 295 | 295 | size = bdev_nr_bytes(bdev); | |
| 296 | - | if (!erase_size || (long)size % erase_size) { | |
| 296 | + | if ((long)size % erase_size) { | |
| 297 | 297 | pr_err("erasesize must be a divisor of device size\n"); | |
| 298 | 298 | goto err_free_block2mtd; | |
| 299 | 299 | } | |
modified drivers/mtd/devices/mtd_intel_dg.c
| @@ -387,7 +387,7 @@ idg_erase(struct intel_dg_nvm *nvm, u8 region, loff_t from, u64 len, u64 *fail_a | |||
| 387 | 387 | void __iomem *base2 = nvm->base2; | |
| 388 | 388 | void __iomem *base = nvm->base; | |
| 389 | 389 | const u32 block = 0x10; | |
| 390 | - | u32 iter; | |
| 390 | + | u32 iter = 0; | |
| 391 | 391 | u32 reg; | |
| 392 | 392 | u64 i; | |
| 393 | 393 | ||
| @@ -396,7 +396,6 @@ idg_erase(struct intel_dg_nvm *nvm, u8 region, loff_t from, u64 len, u64 *fail_a | |||
| 396 | 396 | iowrite32(region << 24 | block, base + NVM_ERASE_REG); | |
| 397 | 397 | if (nvm->non_posted_erase) { | |
| 398 | 398 | /* Wait for Erase Done */ | |
| 399 | - | iter = 0; | |
| 400 | 399 | reg = ioread32(base2 + NVM_DEBUG_REG); | |
| 401 | 400 | while (!(reg & NVM_NON_POSTED_ERASE_DONE) && | |
| 402 | 401 | ++iter < NVM_NON_POSTED_ERASE_DONE_ITER) { | |
modified drivers/mtd/mtdcore.c
| @@ -1083,7 +1083,6 @@ static int mtd_otp_nvmem_add(struct mtd_info *mtd) | |||
| 1083 | 1083 | ||
| 1084 | 1084 | err: | |
| 1085 | 1085 | nvmem_unregister(mtd->otp_user_nvmem); | |
| 1086 | - | mtd->otp_user_nvmem = NULL; | |
| 1087 | 1086 | /* Don't report error if OTP is not supported. */ | |
| 1088 | 1087 | if (err == -EOPNOTSUPP) | |
| 1089 | 1088 | return 0; | |
| @@ -1333,7 +1332,7 @@ int __get_mtd_device(struct mtd_info *mtd) | |||
| 1333 | 1332 | int err; | |
| 1334 | 1333 | ||
| 1335 | 1334 | if (master->_get_device) { | |
| 1336 | - | err = master->_get_device(master); | |
| 1335 | + | err = master->_get_device(mtd); | |
| 1337 | 1336 | if (err) | |
| 1338 | 1337 | return err; | |
| 1339 | 1338 | } | |
modified drivers/mtd/nand/ecc.c
| @@ -159,13 +159,6 @@ int nand_ecc_finish_io_req(struct nand_device *nand, | |||
| 159 | 159 | } | |
| 160 | 160 | EXPORT_SYMBOL(nand_ecc_finish_io_req); | |
| 161 | 161 | ||
| 162 | - | bool nand_ecc_is_pipelined(const struct nand_device *nand) | |
| 163 | - | { | |
| 164 | - | return nand->ecc.engine && | |
| 165 | - | nand->ecc.engine->integration == NAND_ECC_ENGINE_INTEGRATION_PIPELINED; | |
| 166 | - | } | |
| 167 | - | EXPORT_SYMBOL(nand_ecc_is_pipelined); | |
| 168 | - | ||
| 169 | 162 | /* Define default OOB placement schemes for large and small page devices */ | |
| 170 | 163 | static int nand_ooblayout_ecc_sp(struct mtd_info *mtd, int section, | |
| 171 | 164 | struct mtd_oob_region *oobregion) | |
modified drivers/mtd/nand/raw/cadence-nand-controller.c
| @@ -3143,9 +3143,6 @@ static int cadence_nand_init(struct cdns_nand_ctrl *cdns_ctrl) | |||
| 3143 | 3143 | goto free_buf_desc; | |
| 3144 | 3144 | } | |
| 3145 | 3145 | ||
| 3146 | - | spin_lock_init(&cdns_ctrl->irq_lock); | |
| 3147 | - | init_completion(&cdns_ctrl->complete); | |
| 3148 | - | ||
| 3149 | 3146 | if (devm_request_irq(cdns_ctrl->dev, cdns_ctrl->irq, cadence_nand_isr, | |
| 3150 | 3147 | IRQF_SHARED, "cadence-nand-controller", | |
| 3151 | 3148 | cdns_ctrl)) { | |
| @@ -3154,6 +3151,9 @@ static int cadence_nand_init(struct cdns_nand_ctrl *cdns_ctrl) | |||
| 3154 | 3151 | goto free_buf; | |
| 3155 | 3152 | } | |
| 3156 | 3153 | ||
| 3154 | + | spin_lock_init(&cdns_ctrl->irq_lock); | |
| 3155 | + | init_completion(&cdns_ctrl->complete); | |
| 3156 | + | ||
| 3157 | 3157 | ret = cadence_nand_hw_init(cdns_ctrl); | |
| 3158 | 3158 | if (ret) | |
| 3159 | 3159 | goto disable_irq; | |
modified drivers/mtd/nand/raw/vf610_nfc.c
| @@ -505,11 +505,6 @@ static int vf610_nfc_exec_op(struct nand_chip *chip, | |||
| 505 | 505 | check_only); | |
| 506 | 506 | } | |
| 507 | 507 | ||
| 508 | - | static unsigned int vf610_nfc_spare_size(struct mtd_info *mtd) | |
| 509 | - | { | |
| 510 | - | return min_t(unsigned int, mtd->oobsize, 64); | |
| 511 | - | } | |
| 512 | - | ||
| 513 | 508 | static inline int vf610_nfc_correct_data(struct nand_chip *chip, uint8_t *dat, | |
| 514 | 509 | uint8_t *oob, int page) | |
| 515 | 510 | { | |
| @@ -519,7 +514,6 @@ static inline int vf610_nfc_correct_data(struct nand_chip *chip, uint8_t *dat, | |||
| 519 | 514 | u8 ecc_status; | |
| 520 | 515 | u8 ecc_count; | |
| 521 | 516 | int flips_threshold = nfc->chip.ecc.strength / 2; | |
| 522 | - | int ret; | |
| 523 | 517 | ||
| 524 | 518 | ecc_status = vf610_nfc_read(nfc, ecc_status_off) & 0xff; | |
| 525 | 519 | ecc_count = ecc_status & ECC_STATUS_ERR_COUNT; | |
| @@ -527,22 +521,16 @@ static inline int vf610_nfc_correct_data(struct nand_chip *chip, uint8_t *dat, | |||
| 527 | 521 | if (!(ecc_status & ECC_STATUS_MASK)) | |
| 528 | 522 | return ecc_count; | |
| 529 | 523 | ||
| 530 | - | /* The failed decode leaves a bogus correction in SRAM; re-read without ECC */ | |
| 531 | 524 | nfc->data_access = true; | |
| 532 | - | ret = nand_read_page_op(&nfc->chip, page, 0, dat, mtd->writesize); | |
| 533 | - | if (!ret) | |
| 534 | - | ret = nand_read_oob_op(&nfc->chip, page, 0, oob, | |
| 535 | - | vf610_nfc_spare_size(mtd)); | |
| 525 | + | nand_read_oob_op(&nfc->chip, page, 0, oob, mtd->oobsize); | |
| 536 | 526 | nfc->data_access = false; | |
| 537 | - | if (ret) | |
| 538 | - | return ret; | |
| 539 | 527 | ||
| 540 | 528 | /* | |
| 541 | - | * Run the erased-page check with the driver's historic threshold | |
| 542 | - | * of half the ECC strength. | |
| 529 | + | * On an erased page, bit count (including OOB) should be zero or | |
| 530 | + | * at least less then half of the ECC strength. | |
| 543 | 531 | */ | |
| 544 | - | return nand_check_erased_ecc_chunk(dat, mtd->writesize, oob, | |
| 545 | - | vf610_nfc_spare_size(mtd), NULL, 0, | |
| 532 | + | return nand_check_erased_ecc_chunk(dat, nfc->chip.ecc.size, oob, | |
| 533 | + | mtd->oobsize, NULL, 0, | |
| 546 | 534 | flips_threshold); | |
| 547 | 535 | } | |
| 548 | 536 | ||
| @@ -563,7 +551,7 @@ static int vf610_nfc_read_page(struct nand_chip *chip, uint8_t *buf, | |||
| 563 | 551 | { | |
| 564 | 552 | struct vf610_nfc *nfc = chip_to_nfc(chip); | |
| 565 | 553 | struct mtd_info *mtd = nand_to_mtd(chip); | |
| 566 | - | int trfr_sz = mtd->writesize + vf610_nfc_spare_size(mtd); | |
| 554 | + | int trfr_sz = mtd->writesize + mtd->oobsize; | |
| 567 | 555 | u32 row = 0, cmd1 = 0, cmd2 = 0, code = 0; | |
| 568 | 556 | int stat; | |
| 569 | 557 | ||
| @@ -589,16 +577,11 @@ static int vf610_nfc_read_page(struct nand_chip *chip, uint8_t *buf, | |||
| 589 | 577 | */ | |
| 590 | 578 | vf610_nfc_rd_from_sram(buf, nfc->regs + NFC_MAIN_AREA(0), | |
| 591 | 579 | mtd->writesize, false); | |
| 592 | - | if (oob_required) { | |
| 593 | - | unsigned int spare = vf610_nfc_spare_size(mtd); | |
| 594 | - | ||
| 580 | + | if (oob_required) | |
| 595 | 581 | vf610_nfc_rd_from_sram(chip->oob_poi, | |
| 596 | 582 | nfc->regs + NFC_MAIN_AREA(0) + | |
| 597 | 583 | mtd->writesize, | |
| 598 | - | spare, false); | |
| 599 | - | /* Not transferred, and never written: reads back erased */ | |
| 600 | - | memset(chip->oob_poi + spare, 0xff, mtd->oobsize - spare); | |
| 601 | - | } | |
| 584 | + | mtd->oobsize, false); | |
| 602 | 585 | ||
| 603 | 586 | stat = vf610_nfc_correct_data(chip, buf, chip->oob_poi, page); | |
| 604 | 587 | ||
| @@ -616,7 +599,7 @@ static int vf610_nfc_write_page(struct nand_chip *chip, const uint8_t *buf, | |||
| 616 | 599 | { | |
| 617 | 600 | struct vf610_nfc *nfc = chip_to_nfc(chip); | |
| 618 | 601 | struct mtd_info *mtd = nand_to_mtd(chip); | |
| 619 | - | int trfr_sz = mtd->writesize + vf610_nfc_spare_size(mtd); | |
| 602 | + | int trfr_sz = mtd->writesize + mtd->oobsize; | |
| 620 | 603 | u32 row = 0, cmd1 = 0, cmd2 = 0, code = 0; | |
| 621 | 604 | u8 status; | |
| 622 | 605 | int ret; | |
| @@ -757,49 +740,6 @@ static void vf610_nfc_init_controller(struct vf610_nfc *nfc) | |||
| 757 | 740 | } | |
| 758 | 741 | } | |
| 759 | 742 | ||
| 760 | - | /* | |
| 761 | - | * With 64 byte OOB chips the core's large page layout matches what | |
| 762 | - | * U-Boot uses, and on chips with more, U-Boot and older kernels clamped | |
| 763 | - | * mtd->oobsize to 64. Modifying the OOB size is no longer possible, the | |
| 764 | - | * actual chip geometry must be respected, so to avoid breaking those | |
| 765 | - | * existing setups use our own layout: the core's large page one, | |
| 766 | - | * computed over the first 64 spare bytes only. | |
| 767 | - | */ | |
| 768 | - | static int vf610_nfc_ooblayout_ecc(struct mtd_info *mtd, int section, | |
| 769 | - | struct mtd_oob_region *oobregion) | |
| 770 | - | { | |
| 771 | - | struct nand_device *nand = mtd_to_nanddev(mtd); | |
| 772 | - | unsigned int total_ecc_bytes = nand->ecc.ctx.total; | |
| 773 | - | ||
| 774 | - | if (section || !total_ecc_bytes) | |
| 775 | - | return -ERANGE; | |
| 776 | - | ||
| 777 | - | oobregion->length = total_ecc_bytes; | |
| 778 | - | oobregion->offset = vf610_nfc_spare_size(mtd) - oobregion->length; | |
| 779 | - | ||
| 780 | - | return 0; | |
| 781 | - | } | |
| 782 | - | ||
| 783 | - | static int vf610_nfc_ooblayout_free(struct mtd_info *mtd, int section, | |
| 784 | - | struct mtd_oob_region *oobregion) | |
| 785 | - | { | |
| 786 | - | struct nand_device *nand = mtd_to_nanddev(mtd); | |
| 787 | - | unsigned int total_ecc_bytes = nand->ecc.ctx.total; | |
| 788 | - | ||
| 789 | - | if (section) | |
| 790 | - | return -ERANGE; | |
| 791 | - | ||
| 792 | - | oobregion->length = vf610_nfc_spare_size(mtd) - total_ecc_bytes - 2; | |
| 793 | - | oobregion->offset = 2; | |
| 794 | - | ||
| 795 | - | return 0; | |
| 796 | - | } | |
| 797 | - | ||
| 798 | - | static const struct mtd_ooblayout_ops vf610_nfc_ooblayout_ops = { | |
| 799 | - | .ecc = vf610_nfc_ooblayout_ecc, | |
| 800 | - | .free = vf610_nfc_ooblayout_free, | |
| 801 | - | }; | |
| 802 | - | ||
| 803 | 743 | static int vf610_nfc_attach_chip(struct nand_chip *chip) | |
| 804 | 744 | { | |
| 805 | 745 | struct mtd_info *mtd = nand_to_mtd(chip); | |
| @@ -830,7 +770,12 @@ static int vf610_nfc_attach_chip(struct nand_chip *chip) | |||
| 830 | 770 | return -ENXIO; | |
| 831 | 771 | } | |
| 832 | 772 | ||
| 833 | - | mtd_set_ooblayout(mtd, &vf610_nfc_ooblayout_ops); | |
| 773 | + | /* Only 64 byte ECC layouts known */ | |
| 774 | + | if (mtd->oobsize > 64) | |
| 775 | + | mtd->oobsize = 64; | |
| 776 | + | ||
| 777 | + | /* Use default large page ECC layout defined in NAND core */ | |
| 778 | + | mtd_set_ooblayout(mtd, nand_get_large_page_ooblayout()); | |
| 834 | 779 | if (chip->ecc.strength == 32) { | |
| 835 | 780 | nfc->ecc_mode = ECC_60_BYTE; | |
| 836 | 781 | chip->ecc.bytes = 60; | |
modified drivers/mtd/nand/spi/core.c
| @@ -281,26 +281,8 @@ static int spinand_init_cfg_cache(struct spinand_device *spinand) | |||
| 281 | 281 | static int spinand_init_quad_enable(struct spinand_device *spinand, | |
| 282 | 282 | bool enable) | |
| 283 | 283 | { | |
| 284 | - | struct nand_device *nand = spinand_to_nand(spinand); | |
| 285 | - | unsigned int target; | |
| 286 | - | int ret; | |
| 287 | - | ||
| 288 | - | /* | |
| 289 | - | * QE is a per-die setting on some devices. Program each target | |
| 290 | - | * individually when enabling or disabling quad I/O mode. | |
| 291 | - | */ | |
| 292 | - | for (target = 0; target < nand->memorg.ntargets; target++) { | |
| 293 | - | ret = spinand_select_target(spinand, target); | |
| 294 | - | if (ret) | |
| 295 | - | return ret; | |
| 296 | - | ||
| 297 | - | ret = spinand_upd_cfg(spinand, CFG_QUAD_ENABLE, | |
| 298 | - | enable ? CFG_QUAD_ENABLE : 0); | |
| 299 | - | if (ret) | |
| 300 | - | return ret; | |
| 301 | - | } | |
| 302 | - | ||
| 303 | - | return 0; | |
| 284 | + | return spinand_upd_cfg(spinand, CFG_QUAD_ENABLE, | |
| 285 | + | enable ? CFG_QUAD_ENABLE : 0); | |
| 304 | 286 | } | |
| 305 | 287 | ||
| 306 | 288 | static int spinand_ecc_enable(struct spinand_device *spinand, | |
| @@ -526,7 +508,8 @@ static int spinand_read_from_cache_op(struct spinand_device *spinand, | |||
| 526 | 508 | else | |
| 527 | 509 | rdesc->info.op_tmpl = &rdesc->info.primary_op_tmpl; | |
| 528 | 510 | ||
| 529 | - | if (nand_ecc_is_pipelined(nand) && req->mode != MTD_OPS_RAW) | |
| 511 | + | if (nand->ecc.engine->integration == NAND_ECC_ENGINE_INTEGRATION_PIPELINED && | |
| 512 | + | req->mode != MTD_OPS_RAW) | |
| 530 | 513 | rdesc->info.op_tmpl->data.ecc = true; | |
| 531 | 514 | else | |
| 532 | 515 | rdesc->info.op_tmpl->data.ecc = false; | |
| @@ -620,7 +603,8 @@ static int spinand_write_to_cache_op(struct spinand_device *spinand, | |||
| 620 | 603 | ||
| 621 | 604 | wdesc = spinand->dirmaps[req->pos.plane].wdesc; | |
| 622 | 605 | ||
| 623 | - | if (nand_ecc_is_pipelined(nand) && req->mode != MTD_OPS_RAW) | |
| 606 | + | if (nand->ecc.engine->integration == NAND_ECC_ENGINE_INTEGRATION_PIPELINED && | |
| 607 | + | req->mode != MTD_OPS_RAW) | |
| 624 | 608 | wdesc->info.op_tmpl->data.ecc = true; | |
| 625 | 609 | else | |
| 626 | 610 | wdesc->info.op_tmpl->data.ecc = false; | |
| @@ -1277,7 +1261,7 @@ static int spinand_create_dirmap(struct spinand_device *spinand, | |||
| 1277 | 1261 | struct spi_mem_dirmap_desc *desc; | |
| 1278 | 1262 | bool enable_ecc = false, secondary_op = false; | |
| 1279 | 1263 | ||
| 1280 | - | if (nand_ecc_is_pipelined(nand)) | |
| 1264 | + | if (nand->ecc.engine->integration == NAND_ECC_ENGINE_INTEGRATION_PIPELINED) | |
| 1281 | 1265 | enable_ecc = true; | |
| 1282 | 1266 | ||
| 1283 | 1267 | if (spinand->cont_read_possible && spinand->op_templates->cont_read_cache) | |
| @@ -1813,19 +1797,19 @@ try_ssdr: | |||
| 1813 | 1797 | spinand->ssdr_op_templates.write_cache->data.buswidth == 4 || | |
| 1814 | 1798 | spinand->ssdr_op_templates.update_cache->data.buswidth == 4) | |
| 1815 | 1799 | quad_enable = true; | |
| 1816 | - | ||
| 1817 | - | ret = spinand_init_quad_enable(spinand, quad_enable); | |
| 1818 | - | if (ret) | |
| 1819 | - | return ret; | |
| 1820 | 1800 | } | |
| 1821 | 1801 | ||
| 1802 | + | ret = spinand_init_quad_enable(spinand, quad_enable); | |
| 1803 | + | if (ret) | |
| 1804 | + | return ret; | |
| 1805 | + | ||
| 1822 | 1806 | if (spinand->configure_chip) { | |
| 1823 | 1807 | ret = spinand->configure_chip(spinand, SSDR); | |
| 1824 | 1808 | if (ret) | |
| 1825 | 1809 | return ret; | |
| 1826 | 1810 | } | |
| 1827 | 1811 | ||
| 1828 | - | return 0; | |
| 1812 | + | return ret; | |
| 1829 | 1813 | } | |
| 1830 | 1814 | ||
| 1831 | 1815 | static int spinand_init_flash(struct spinand_device *spinand) | |
| @@ -1996,17 +1980,12 @@ static int spinand_init(struct spinand_device *spinand) | |||
| 1996 | 1980 | goto err_cleanup_ecc_engine; | |
| 1997 | 1981 | } | |
| 1998 | 1982 | ||
| 1999 | - | if (!nand->ecc.engine) { | |
| 2000 | - | if (spinand->eccinfo.ooblayout) | |
| 2001 | - | mtd_set_ooblayout(mtd, spinand->eccinfo.ooblayout); | |
| 2002 | - | else | |
| 2003 | - | mtd_set_ooblayout(mtd, &spinand_noecc_ooblayout); | |
| 1983 | + | if (nand->ecc.engine) { | |
| 1984 | + | ret = mtd_ooblayout_count_freebytes(mtd); | |
| 1985 | + | if (ret < 0) | |
| 1986 | + | goto err_cleanup_ecc_engine; | |
| 2004 | 1987 | } | |
| 2005 | 1988 | ||
| 2006 | - | ret = mtd_ooblayout_count_freebytes(mtd); | |
| 2007 | - | if (ret < 0) | |
| 2008 | - | goto err_cleanup_ecc_engine; | |
| 2009 | - | ||
| 2010 | 1989 | mtd->oobavail = ret; | |
| 2011 | 1990 | ||
| 2012 | 1991 | /* Propagate ECC information to mtd_info */ | |
modified drivers/mtd/spi-nor/core.c
| @@ -1310,7 +1310,7 @@ static bool spi_nor_rww_start_exclusive(struct spi_nor *nor) | |||
| 1310 | 1310 | { | |
| 1311 | 1311 | struct spi_nor_rww *rww = &nor->rww; | |
| 1312 | 1312 | ||
| 1313 | - | guard(mutex)(&nor->lock); | |
| 1313 | + | mutex_lock(&nor->lock); | |
| 1314 | 1314 | ||
| 1315 | 1315 | if (rww->ongoing_io || rww->ongoing_rd || rww->ongoing_pe) | |
| 1316 | 1316 | return false; | |
modified drivers/net/amt.c
| @@ -80,6 +80,15 @@ static struct in6_addr mld2_all_node = MLD2_ALL_NODE_INIT; | |||
| 80 | 80 | static struct mld2_grec mldv2_zero_grec; | |
| 81 | 81 | #endif | |
| 82 | 82 | ||
| 83 | + | static struct amt_skb_cb *amt_skb_cb(struct sk_buff *skb) | |
| 84 | + | { | |
| 85 | + | BUILD_BUG_ON(sizeof(struct amt_skb_cb) + sizeof(struct tc_skb_cb) > | |
| 86 | + | sizeof_field(struct sk_buff, cb)); | |
| 87 | + | ||
| 88 | + | return (struct amt_skb_cb *)((void *)skb->cb + | |
| 89 | + | sizeof(struct tc_skb_cb)); | |
| 90 | + | } | |
| 91 | + | ||
| 83 | 92 | static void __amt_source_gc_work(void) | |
| 84 | 93 | { | |
| 85 | 94 | struct amt_source_node *snode; | |
| @@ -782,11 +791,6 @@ out: | |||
| 782 | 791 | rcu_read_unlock(); | |
| 783 | 792 | } | |
| 784 | 793 | ||
| 785 | - | static bool amt_send_membership_query(struct amt_dev *amt, | |
| 786 | - | struct sk_buff *skb, | |
| 787 | - | struct amt_tunnel_list *tunnel, | |
| 788 | - | bool v6); | |
| 789 | - | ||
| 790 | 794 | static void amt_send_igmp_gq(struct amt_dev *amt, | |
| 791 | 795 | struct amt_tunnel_list *tunnel) | |
| 792 | 796 | { | |
| @@ -796,11 +800,8 @@ static void amt_send_igmp_gq(struct amt_dev *amt, | |||
| 796 | 800 | if (!skb) | |
| 797 | 801 | return; | |
| 798 | 802 | ||
| 799 | - | skb_pull(skb, sizeof(struct ethhdr)); | |
| 800 | - | if (amt_send_membership_query(amt, skb, tunnel, false)) { | |
| 801 | - | amt->dev->stats.tx_dropped++; | |
| 802 | - | kfree_skb(skb); | |
| 803 | - | } | |
| 803 | + | amt_skb_cb(skb)->tunnel = tunnel; | |
| 804 | + | dev_queue_xmit(skb); | |
| 804 | 805 | } | |
| 805 | 806 | ||
| 806 | 807 | #if IS_ENABLED(CONFIG_IPV6) | |
| @@ -884,11 +885,8 @@ static void amt_send_mld_gq(struct amt_dev *amt, struct amt_tunnel_list *tunnel) | |||
| 884 | 885 | if (!skb) | |
| 885 | 886 | return; | |
| 886 | 887 | ||
| 887 | - | skb_pull(skb, sizeof(struct ethhdr)); | |
| 888 | - | if (amt_send_membership_query(amt, skb, tunnel, true)) { | |
| 889 | - | amt->dev->stats.tx_dropped++; | |
| 890 | - | kfree_skb(skb); | |
| 891 | - | } | |
| 888 | + | amt_skb_cb(skb)->tunnel = tunnel; | |
| 889 | + | dev_queue_xmit(skb); | |
| 892 | 890 | } | |
| 893 | 891 | #else | |
| 894 | 892 | static void amt_send_mld_gq(struct amt_dev *amt, struct amt_tunnel_list *tunnel) | |
| @@ -1188,6 +1186,7 @@ static netdev_tx_t amt_dev_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 1188 | 1186 | #endif | |
| 1189 | 1187 | bool report = false; | |
| 1190 | 1188 | struct igmphdr *ih; | |
| 1189 | + | bool query = false; | |
| 1191 | 1190 | struct iphdr *iph; | |
| 1192 | 1191 | bool data = false; | |
| 1193 | 1192 | bool v6 = false; | |
| @@ -1205,6 +1204,9 @@ static netdev_tx_t amt_dev_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 1205 | 1204 | case IGMP_HOST_MEMBERSHIP_REPORT: | |
| 1206 | 1205 | report = true; | |
| 1207 | 1206 | break; | |
| 1207 | + | case IGMP_HOST_MEMBERSHIP_QUERY: | |
| 1208 | + | query = true; | |
| 1209 | + | break; | |
| 1208 | 1210 | default: | |
| 1209 | 1211 | goto free; | |
| 1210 | 1212 | } | |
| @@ -1226,6 +1228,9 @@ static netdev_tx_t amt_dev_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 1226 | 1228 | case ICMPV6_MLD2_REPORT: | |
| 1227 | 1229 | report = true; | |
| 1228 | 1230 | break; | |
| 1231 | + | case ICMPV6_MGM_QUERY: | |
| 1232 | + | query = true; | |
| 1233 | + | break; | |
| 1229 | 1234 | default: | |
| 1230 | 1235 | goto free; | |
| 1231 | 1236 | } | |
| @@ -1256,6 +1261,19 @@ static netdev_tx_t amt_dev_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 1256 | 1261 | goto free; | |
| 1257 | 1262 | goto unlock; | |
| 1258 | 1263 | } else if (amt->mode == AMT_MODE_RELAY) { | |
| 1264 | + | if (query) { | |
| 1265 | + | tunnel = amt_skb_cb(skb)->tunnel; | |
| 1266 | + | if (!tunnel) { | |
| 1267 | + | WARN_ON(1); | |
| 1268 | + | goto free; | |
| 1269 | + | } | |
| 1270 | + | ||
| 1271 | + | /* Do not forward unexpected query */ | |
| 1272 | + | if (amt_send_membership_query(amt, skb, tunnel, v6)) | |
| 1273 | + | goto free; | |
| 1274 | + | goto unlock; | |
| 1275 | + | } | |
| 1276 | + | ||
| 1259 | 1277 | if (!data) | |
| 1260 | 1278 | goto free; | |
| 1261 | 1279 | list_for_each_entry_rcu(tunnel, &amt->tunnel_list, list) { | |
modified drivers/net/bareudp.c
| @@ -356,7 +356,7 @@ static int bareudp_xmit_skb(struct sk_buff *skb, struct net_device *dev, | |||
| 356 | 356 | if (err) | |
| 357 | 357 | goto free_dst; | |
| 358 | 358 | ||
| 359 | - | skb_set_inner_protocol(skb, skb->protocol); | |
| 359 | + | skb_set_inner_protocol(skb, bareudp->ethertype); | |
| 360 | 360 | udp_tunnel_xmit_skb(rt, sk, skb, saddr, info->key.u.ipv4.dst, | |
| 361 | 361 | tos, ttl, df, sport, bareudp->port, | |
| 362 | 362 | !net_eq(bareudp->net, dev_net(bareudp->dev)), | |
| @@ -424,7 +424,6 @@ static int bareudp6_xmit_skb(struct sk_buff *skb, struct net_device *dev, | |||
| 424 | 424 | if (err) | |
| 425 | 425 | goto free_dst; | |
| 426 | 426 | ||
| 427 | - | skb_set_inner_protocol(skb, skb->protocol); | |
| 428 | 427 | daddr = info->key.u.ipv6.dst; | |
| 429 | 428 | udp_tunnel6_xmit_skb(dst, sk, skb, dev, | |
| 430 | 429 | &saddr, &daddr, prio, ttl, | |
modified drivers/net/bonding/bond_main.c
| @@ -5732,12 +5732,12 @@ static int bond_xdp_set(struct net_device *dev, struct bpf_prog *prog, | |||
| 5732 | 5732 | bpf_prog_inc(prog); | |
| 5733 | 5733 | } | |
| 5734 | 5734 | ||
| 5735 | - | if (prog && !old_prog) | |
| 5735 | + | if (prog) { | |
| 5736 | 5736 | static_branch_inc(&bpf_master_redirect_enabled_key); | |
| 5737 | - | else if (!prog && old_prog) | |
| 5738 | - | static_branch_dec(&bpf_master_redirect_enabled_key); | |
| 5739 | - | if (old_prog) | |
| 5737 | + | } else if (old_prog) { | |
| 5740 | 5738 | bpf_prog_put(old_prog); | |
| 5739 | + | static_branch_dec(&bpf_master_redirect_enabled_key); | |
| 5740 | + | } | |
| 5741 | 5741 | ||
| 5742 | 5742 | return 0; | |
| 5743 | 5743 | ||
modified drivers/net/can/dev/skb.c
| @@ -210,10 +210,6 @@ static void init_can_skb(struct sk_buff *skb) | |||
| 210 | 210 | { | |
| 211 | 211 | skb->pkt_type = PACKET_BROADCAST; | |
| 212 | 212 | skb->ip_summed = CHECKSUM_UNNECESSARY; | |
| 213 | - | ||
| 214 | - | skb_reset_mac_header(skb); | |
| 215 | - | skb_reset_network_header(skb); | |
| 216 | - | skb_reset_transport_header(skb); | |
| 217 | 213 | } | |
| 218 | 214 | ||
| 219 | 215 | struct sk_buff *alloc_can_skb(struct net_device *dev, struct can_frame **cf) | |
modified drivers/net/can/usb/f81604.c
| @@ -169,7 +169,7 @@ struct f81604_int_data { | |||
| 169 | 169 | u8 rxerr; | |
| 170 | 170 | u8 txerr; | |
| 171 | 171 | u8 val; | |
| 172 | - | } __packed; | |
| 172 | + | } __packed __aligned(4); | |
| 173 | 173 | ||
| 174 | 174 | struct f81604_sff { | |
| 175 | 175 | __be16 id; | |
modified drivers/net/can/vxcan.c
| @@ -79,9 +79,6 @@ static netdev_tx_t vxcan_xmit(struct sk_buff *oskb, struct net_device *dev) | |||
| 79 | 79 | ||
| 80 | 80 | /* reset CAN GW hop counter */ | |
| 81 | 81 | csx->can_gw_hops = 0; | |
| 82 | - | /* start with new CAN skb UID in the other namespace */ | |
| 83 | - | csx->can_skb_uid = 0; | |
| 84 | - | ||
| 85 | 82 | skb->pkt_type = PACKET_BROADCAST; | |
| 86 | 83 | skb->dev = peer; | |
| 87 | 84 | skb->ip_summed = CHECKSUM_UNNECESSARY; | |
modified drivers/net/dsa/microchip/ksz_common.h
| @@ -853,7 +853,7 @@ static inline bool ksz_is_sgmii_port(struct ksz_device *dev, int port) | |||
| 853 | 853 | #define KSZ88_FAMILY_ID 0x88 | |
| 854 | 854 | #define KSZ8895_FAMILY_ID 0x95 | |
| 855 | 855 | ||
| 856 | - | #define KSZ8_PORT_STATUS_0 0x18 | |
| 856 | + | #define KSZ8_PORT_STATUS_0 0x08 | |
| 857 | 857 | #define KSZ8_PORT_FIBER_MODE BIT(7) | |
| 858 | 858 | ||
| 859 | 859 | #define SW_CHIP_ID_M GENMASK(7, 4) | |
modified drivers/net/ethernet/airoha/airoha_eth.c
| @@ -2800,34 +2800,14 @@ static int airoha_qdma_set_trtcm_param(struct airoha_qdma *qdma, int channel, | |||
| 2800 | 2800 | FIELD_PREP(TRTCM_METER_GROUP_MASK, group) | | |
| 2801 | 2801 | FIELD_PREP(TRTCM_PARAM_INDEX_MASK, idx) | | |
| 2802 | 2802 | FIELD_PREP(TRTCM_PARAM_RATE_TYPE_MASK, mode); | |
| 2803 | - | int i; | |
| 2804 | - | ||
| 2805 | - | /* | |
| 2806 | - | * HW might be in the middle of bucket handling and might | |
| 2807 | - | * require an additional try to actually apply the new TRTCM | |
| 2808 | - | * config. | |
| 2809 | - | */ | |
| 2810 | - | for (i = 0; i < TRTCM_CONFIG_RETRY_MAX; i++) { | |
| 2811 | - | u32 data = 0; | |
| 2812 | - | ||
| 2813 | - | airoha_qdma_wr(qdma, REG_TRTCM_DATA_LOW(addr), val); | |
| 2814 | - | airoha_qdma_wr(qdma, REG_TRTCM_CFG_PARAM(addr), config); | |
| 2815 | - | ||
| 2816 | - | if (read_poll_timeout(airoha_qdma_rr, data, | |
| 2817 | - | data & TRTCM_PARAM_RW_DONE_MASK, | |
| 2818 | - | USEC_PER_MSEC, 10 * USEC_PER_MSEC, | |
| 2819 | - | true, qdma, REG_TRTCM_CFG_PARAM(addr))) | |
| 2820 | - | continue; | |
| 2821 | - | ||
| 2822 | - | if (airoha_qdma_get_trtcm_param(qdma, channel, addr, param, | |
| 2823 | - | mode, &data, NULL)) | |
| 2824 | - | continue; | |
| 2825 | 2803 | ||
| 2826 | - | if (data == val) | |
| 2827 | - | return 0; | |
| 2828 | - | } | |
| 2804 | + | airoha_qdma_wr(qdma, REG_TRTCM_DATA_LOW(addr), val); | |
| 2805 | + | airoha_qdma_wr(qdma, REG_TRTCM_CFG_PARAM(addr), config); | |
| 2829 | 2806 | ||
| 2830 | - | return -EBUSY; | |
| 2807 | + | return read_poll_timeout(airoha_qdma_rr, val, | |
| 2808 | + | val & TRTCM_PARAM_RW_DONE_MASK, | |
| 2809 | + | USEC_PER_MSEC, 10 * USEC_PER_MSEC, true, | |
| 2810 | + | qdma, REG_TRTCM_CFG_PARAM(addr)); | |
| 2831 | 2811 | } | |
| 2832 | 2812 | ||
| 2833 | 2813 | static int airoha_qdma_set_trtcm_config(struct airoha_qdma *qdma, int channel, | |
modified drivers/net/ethernet/airoha/airoha_eth.h
| @@ -171,8 +171,6 @@ enum trtcm_param { | |||
| 171 | 171 | #define TRTCM_TOKEN_RATE_MASK GENMASK(23, 6) | |
| 172 | 172 | #define TRTCM_TOKEN_RATE_FRACTION_MASK GENMASK(5, 0) | |
| 173 | 173 | ||
| 174 | - | #define TRTCM_CONFIG_RETRY_MAX 2 | |
| 175 | - | ||
| 176 | 174 | enum airoha_dma_map_type { | |
| 177 | 175 | AIROHA_DMA_UNMAPPED, | |
| 178 | 176 | AIROHA_DMA_MAP_SINGLE, | |
modified drivers/net/ethernet/allwinner/sun4i-emac.c
| @@ -300,7 +300,7 @@ static int emac_dma_inblk_32bit(struct emac_board_info *db, | |||
| 300 | 300 | if (!req) { | |
| 301 | 301 | dev_err(db->dev, "alloc emac dma req error.\n"); | |
| 302 | 302 | ret = -ENOMEM; | |
| 303 | - | goto prepare_err; | |
| 303 | + | goto alloc_req_err; | |
| 304 | 304 | } | |
| 305 | 305 | ||
| 306 | 306 | desc->callback_param = req; | |
| @@ -319,6 +319,9 @@ static int emac_dma_inblk_32bit(struct emac_board_info *db, | |||
| 319 | 319 | submit_err: | |
| 320 | 320 | emac_free_dma_req(req); | |
| 321 | 321 | ||
| 322 | + | alloc_req_err: | |
| 323 | + | dmaengine_desc_free(desc); | |
| 324 | + | ||
| 322 | 325 | prepare_err: | |
| 323 | 326 | dma_unmap_single(db->dev, rxbuf, count, DMA_FROM_DEVICE); | |
| 324 | 327 | return ret; | |
modified drivers/net/ethernet/broadcom/bcmsysport.c
| @@ -391,10 +391,8 @@ static void bcm_sysport_update_mib_counters(struct bcm_sysport_priv *priv) | |||
| 391 | 391 | if (priv->is_lite) | |
| 392 | 392 | continue; | |
| 393 | 393 | ||
| 394 | - | if (s->type == BCM_SYSPORT_STAT_MIB_TX) | |
| 394 | + | if (s->type != BCM_SYSPORT_STAT_MIB_RX) | |
| 395 | 395 | offset = UMAC_MIB_STAT_OFFSET; | |
| 396 | - | else if (s->type == BCM_SYSPORT_STAT_RUNT) | |
| 397 | - | offset = 2 * UMAC_MIB_STAT_OFFSET; | |
| 398 | 396 | val = umac_readl(priv, UMAC_MIB_START + j + offset); | |
| 399 | 397 | break; | |
| 400 | 398 | case BCM_SYSPORT_STAT_RXCHK: | |
| @@ -484,10 +482,10 @@ static void bcm_sysport_get_stats(struct net_device *dev, | |||
| 484 | 482 | s->type == BCM_SYSPORT_STAT_NETDEV64) { | |
| 485 | 483 | do { | |
| 486 | 484 | start = u64_stats_fetch_begin(syncp); | |
| 487 | - | data[j] = *(u64 *)p; | |
| 485 | + | data[i] = *(u64 *)p; | |
| 488 | 486 | } while (u64_stats_fetch_retry(syncp, start)); | |
| 489 | 487 | } else | |
| 490 | - | data[j] = *(u32 *)p; | |
| 488 | + | data[i] = *(u32 *)p; | |
| 491 | 489 | j++; | |
| 492 | 490 | } | |
| 493 | 491 | ||
modified drivers/net/ethernet/broadcom/bnxt/bnxt.c
| @@ -486,7 +486,7 @@ static netdev_tx_t bnxt_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 486 | 486 | struct netdev_queue *txq; | |
| 487 | 487 | int i; | |
| 488 | 488 | dma_addr_t mapping; | |
| 489 | - | unsigned int length; | |
| 489 | + | unsigned int length, pad = 0; | |
| 490 | 490 | u32 len, free_size, vlan_tag_flags, cfa_action, flags; | |
| 491 | 491 | struct bnxt_ptp_cfg *ptp = bp->ptp_cfg; | |
| 492 | 492 | struct pci_dev *pdev = bp->pdev; | |
| @@ -536,16 +536,6 @@ static netdev_tx_t bnxt_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 536 | 536 | return rc < 0 ? NETDEV_TX_BUSY : NETDEV_TX_OK; | |
| 537 | 537 | } | |
| 538 | 538 | ||
| 539 | - | /* Pad after the SW USO branch: bnxt_sw_udp_gso_xmit() would | |
| 540 | - | * otherwise account the padding as UDP payload. | |
| 541 | - | * Must be done before skb_shinfo(skb)->nr_frags is sampled, | |
| 542 | - | * because skb_put_padto() might linearize the skb. | |
| 543 | - | */ | |
| 544 | - | if (skb_put_padto(skb, BNXT_MIN_PKT_SIZE)) { | |
| 545 | - | /* SKB already freed. */ | |
| 546 | - | goto tx_kick_pending; | |
| 547 | - | } | |
| 548 | - | ||
| 549 | 539 | free_size = bnxt_tx_avail(bp, txr); | |
| 550 | 540 | if (unlikely(free_size < skb_shinfo(skb)->nr_frags + 2)) { | |
| 551 | 541 | /* We must have raced with NAPI cleanup */ | |
| @@ -682,6 +672,14 @@ static netdev_tx_t bnxt_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 682 | 672 | } | |
| 683 | 673 | ||
| 684 | 674 | normal_tx: | |
| 675 | + | if (length < BNXT_MIN_PKT_SIZE) { | |
| 676 | + | pad = BNXT_MIN_PKT_SIZE - length; | |
| 677 | + | if (skb_pad(skb, pad)) | |
| 678 | + | /* SKB already freed. */ | |
| 679 | + | goto tx_kick_pending; | |
| 680 | + | length = BNXT_MIN_PKT_SIZE; | |
| 681 | + | } | |
| 682 | + | ||
| 685 | 683 | mapping = dma_map_single(&pdev->dev, skb->data, len, DMA_TO_DEVICE); | |
| 686 | 684 | ||
| 687 | 685 | if (unlikely(dma_mapping_error(&pdev->dev, mapping))) | |
| @@ -761,7 +759,10 @@ normal_tx: | |||
| 761 | 759 | txbd->tx_bd_len_flags_type = cpu_to_le32(flags); | |
| 762 | 760 | } | |
| 763 | 761 | ||
| 764 | - | txbd->tx_bd_len_flags_type |= cpu_to_le32(TX_BD_FLAGS_PACKET_END); | |
| 762 | + | flags &= ~TX_BD_LEN; | |
| 763 | + | txbd->tx_bd_len_flags_type = | |
| 764 | + | cpu_to_le32(((len + pad) << TX_BD_LEN_SHIFT) | flags | | |
| 765 | + | TX_BD_FLAGS_PACKET_END); | |
| 765 | 766 | ||
| 766 | 767 | netdev_tx_sent_queue(txq, skb->len); | |
| 767 | 768 | ||
| @@ -15546,7 +15547,7 @@ static void bnxt_fw_reset_task(struct work_struct *work) | |||
| 15546 | 15547 | if (test_and_clear_bit(BNXT_STATE_FW_ACTIVATE_RESET, &bp->state) && | |
| 15547 | 15548 | !test_bit(BNXT_STATE_FW_ACTIVATE, &bp->state)) | |
| 15548 | 15549 | bnxt_dl_remote_reload(bp); | |
| 15549 | - | if (!pci_is_enabled(bp->pdev) && pci_enable_device(bp->pdev)) { | |
| 15550 | + | if (pci_enable_device(bp->pdev)) { | |
| 15550 | 15551 | netdev_err(bp->dev, "Cannot re-enable PCI device\n"); | |
| 15551 | 15552 | rc = -ENODEV; | |
| 15552 | 15553 | goto fw_reset_abort; | |
| @@ -17110,51 +17111,6 @@ void bnxt_print_device_info(struct bnxt *bp) | |||
| 17110 | 17111 | pcie_print_link_status(bp->pdev); | |
| 17111 | 17112 | } | |
| 17112 | 17113 | ||
| 17113 | - | static void bnxt_clear_bars(struct pci_dev *pdev) | |
| 17114 | - | { | |
| 17115 | - | int off; | |
| 17116 | - | ||
| 17117 | - | for (off = PCI_BASE_ADDRESS_0; off <= PCI_BASE_ADDRESS_5; off += 4) | |
| 17118 | - | pci_write_config_dword(pdev, off, 0); | |
| 17119 | - | } | |
| 17120 | - | ||
| 17121 | - | /* Clear any pending DMA transactions from crash kernel while loading driver in | |
| 17122 | - | * capture kernel. | |
| 17123 | - | */ | |
| 17124 | - | static int bnxt_kdump_reset(struct pci_dev *pdev) | |
| 17125 | - | { | |
| 17126 | - | int rc, i; | |
| 17127 | - | u16 cmd; | |
| 17128 | - | ||
| 17129 | - | pci_read_config_word(pdev, PCI_COMMAND, &cmd); | |
| 17130 | - | cmd &= ~(PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY); | |
| 17131 | - | pci_write_config_word(pdev, PCI_COMMAND, cmd); | |
| 17132 | - | ||
| 17133 | - | if (pci_save_state(pdev)) | |
| 17134 | - | dev_warn(&pdev->dev, "Failed to save PCI state, PCI restore may be incomplete\n"); | |
| 17135 | - | ||
| 17136 | - | rc = pcie_flr(pdev); | |
| 17137 | - | if (rc) | |
| 17138 | - | dev_warn(&pdev->dev, "pcie_flr() failed (rc: %d), trying to continue\n", | |
| 17139 | - | rc); | |
| 17140 | - | ||
| 17141 | - | /* In case device is not returning CRS, wait 5 seconds longer */ | |
| 17142 | - | for (i = 0; i < 50; i++) { | |
| 17143 | - | pci_read_config_word(pdev, PCI_COMMAND, &cmd); | |
| 17144 | - | if (!PCI_POSSIBLE_ERROR(cmd)) | |
| 17145 | - | break; | |
| 17146 | - | msleep(100); | |
| 17147 | - | } | |
| 17148 | - | if (PCI_POSSIBLE_ERROR(cmd)) { | |
| 17149 | - | dev_err(&pdev->dev, "PCI config space inaccessible after FLR, aborting\n"); | |
| 17150 | - | return -ENODEV; | |
| 17151 | - | } | |
| 17152 | - | ||
| 17153 | - | bnxt_clear_bars(pdev); | |
| 17154 | - | pci_restore_state(pdev); | |
| 17155 | - | return 0; | |
| 17156 | - | } | |
| 17157 | - | ||
| 17158 | 17114 | static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |
| 17159 | 17115 | { | |
| 17160 | 17116 | struct bnxt_hw_resc *hw_resc; | |
| @@ -17170,10 +17126,12 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 17170 | 17126 | return -ENODEV; | |
| 17171 | 17127 | } | |
| 17172 | 17128 | ||
| 17129 | + | /* Clear any pending DMA transactions from crash kernel | |
| 17130 | + | * while loading driver in capture kernel. | |
| 17131 | + | */ | |
| 17173 | 17132 | if (is_kdump_kernel()) { | |
| 17174 | - | rc = bnxt_kdump_reset(pdev); | |
| 17175 | - | if (rc) | |
| 17176 | - | return rc; | |
| 17133 | + | pci_clear_master(pdev); | |
| 17134 | + | pcie_flr(pdev); | |
| 17177 | 17135 | } | |
| 17178 | 17136 | ||
| 17179 | 17137 | max_irqs = bnxt_get_max_irq(pdev); | |
| @@ -17607,8 +17565,10 @@ static pci_ers_result_t bnxt_io_error_detected(struct pci_dev *pdev, | |||
| 17607 | 17565 | * so we disable bus master to prevent any potential bad DMAs before | |
| 17608 | 17566 | * freeing kernel memory. | |
| 17609 | 17567 | */ | |
| 17610 | - | if (state == pci_channel_io_frozen) | |
| 17568 | + | if (state == pci_channel_io_frozen) { | |
| 17569 | + | set_bit(BNXT_STATE_PCI_CHANNEL_IO_FROZEN, &bp->state); | |
| 17611 | 17570 | bnxt_fw_fatal_close(bp); | |
| 17571 | + | } | |
| 17612 | 17572 | ||
| 17613 | 17573 | if (netif_running(netdev)) | |
| 17614 | 17574 | __bnxt_close_nic(bp, true, true); | |
| @@ -17638,80 +17598,69 @@ static pci_ers_result_t bnxt_io_slot_reset(struct pci_dev *pdev) | |||
| 17638 | 17598 | struct bnxt *bp = netdev_priv(netdev); | |
| 17639 | 17599 | int retry = 0; | |
| 17640 | 17600 | int err = 0; | |
| 17641 | - | u16 cmd; | |
| 17601 | + | int off; | |
| 17642 | 17602 | ||
| 17643 | 17603 | netdev_info(bp->dev, "PCI Slot Reset\n"); | |
| 17644 | 17604 | ||
| 17645 | - | /* After a PCIe hot reset, the chip should return CRS when the | |
| 17646 | - | * vendor ID config register is read until it is ready. On all | |
| 17647 | - | * chips, this is not happening reliably so add a 5-second delay | |
| 17648 | - | * as a workaround. | |
| 17649 | - | */ | |
| 17650 | - | msleep(5000); | |
| 17605 | + | if (test_bit(BNXT_STATE_PCI_CHANNEL_IO_FROZEN, &bp->state)) { | |
| 17606 | + | /* After DPC, the chip should return CRS when the vendor ID | |
| 17607 | + | * config register is read until it is ready. On all chips, | |
| 17608 | + | * this is not happening reliably so add a 5-second delay as a | |
| 17609 | + | * workaround. | |
| 17610 | + | */ | |
| 17611 | + | msleep(5000); | |
| 17612 | + | } | |
| 17651 | 17613 | ||
| 17652 | 17614 | netdev_lock(netdev); | |
| 17653 | 17615 | ||
| 17654 | - | pci_read_config_word(pdev, PCI_COMMAND, &cmd); | |
| 17655 | - | if (PCI_POSSIBLE_ERROR(cmd)) { | |
| 17616 | + | if (pci_enable_device(pdev)) { | |
| 17656 | 17617 | dev_err(&pdev->dev, | |
| 17657 | - | "PCI config space inaccessible after reset\n"); | |
| 17658 | - | goto reset_exit; | |
| 17659 | - | } | |
| 17618 | + | "Cannot re-enable PCI device after reset.\n"); | |
| 17619 | + | } else { | |
| 17620 | + | pci_set_master(pdev); | |
| 17621 | + | /* Upon fatal error, our device internal logic that latches to | |
| 17622 | + | * BAR value is getting reset and will restore only upon | |
| 17623 | + | * rewriting the BARs. | |
| 17624 | + | * | |
| 17625 | + | * As pci_restore_state() does not re-write the BARs if the | |
| 17626 | + | * value is same as saved value earlier, driver needs to | |
| 17627 | + | * write the BARs to 0 to force restore, in case of fatal error. | |
| 17628 | + | */ | |
| 17629 | + | if (test_and_clear_bit(BNXT_STATE_PCI_CHANNEL_IO_FROZEN, | |
| 17630 | + | &bp->state)) { | |
| 17631 | + | for (off = PCI_BASE_ADDRESS_0; | |
| 17632 | + | off <= PCI_BASE_ADDRESS_5; off += 4) | |
| 17633 | + | pci_write_config_dword(bp->pdev, off, 0); | |
| 17634 | + | } | |
| 17635 | + | pci_restore_state(pdev); | |
| 17660 | 17636 | ||
| 17661 | - | /* Upon PCIe error, our device internal logic that latches to | |
| 17662 | - | * BAR value is getting reset and will restore only upon | |
| 17663 | - | * rewriting the BARs. | |
| 17664 | - | * | |
| 17665 | - | * As pci_restore_state() does not re-write the BARs if the | |
| 17666 | - | * value is same as saved value earlier, driver needs to | |
| 17667 | - | * write the BARs to 0 to force restore. | |
| 17668 | - | */ | |
| 17669 | - | pci_clear_master(pdev); | |
| 17670 | - | pci_read_config_word(pdev, PCI_COMMAND, &cmd); | |
| 17671 | - | cmd &= ~PCI_COMMAND_MEMORY; | |
| 17672 | - | pci_write_config_word(pdev, PCI_COMMAND, cmd); | |
| 17637 | + | bnxt_inv_fw_health_reg(bp); | |
| 17638 | + | bnxt_try_map_fw_health_reg(bp); | |
| 17673 | 17639 | ||
| 17674 | - | bnxt_clear_bars(pdev); | |
| 17675 | - | pci_restore_state(pdev); | |
| 17640 | + | /* In some PCIe AER scenarios, firmware may take up to | |
| 17641 | + | * 10 seconds to become ready in the worst case. | |
| 17642 | + | */ | |
| 17643 | + | do { | |
| 17644 | + | err = bnxt_try_recover_fw(bp); | |
| 17645 | + | if (!err) | |
| 17646 | + | break; | |
| 17647 | + | retry++; | |
| 17648 | + | } while (retry < BNXT_FW_SLOT_RESET_RETRY); | |
| 17676 | 17649 | ||
| 17677 | - | if (!pci_is_enabled(pdev) && pci_enable_device(pdev)) { | |
| 17678 | - | dev_err(&pdev->dev, | |
| 17679 | - | "Cannot re-enable PCI device after reset.\n"); | |
| 17680 | - | pci_read_config_word(pdev, PCI_COMMAND, &cmd); | |
| 17681 | - | if (!PCI_POSSIBLE_ERROR(cmd)) { | |
| 17682 | - | cmd &= ~(PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY); | |
| 17683 | - | pci_write_config_word(pdev, PCI_COMMAND, cmd); | |
| 17650 | + | if (err) { | |
| 17651 | + | dev_err(&pdev->dev, "Firmware not ready\n"); | |
| 17652 | + | goto reset_exit; | |
| 17684 | 17653 | } | |
| 17685 | - | goto reset_exit; | |
| 17686 | - | } | |
| 17687 | - | pci_set_master(pdev); | |
| 17688 | 17654 | ||
| 17689 | - | bnxt_inv_fw_health_reg(bp); | |
| 17690 | - | bnxt_try_map_fw_health_reg(bp); | |
| 17691 | - | ||
| 17692 | - | /* In some PCIe AER scenarios, firmware may take up to | |
| 17693 | - | * 10 seconds to become ready in the worst case. | |
| 17694 | - | */ | |
| 17695 | - | do { | |
| 17696 | - | err = bnxt_try_recover_fw(bp); | |
| 17655 | + | err = bnxt_hwrm_func_reset(bp); | |
| 17697 | 17656 | if (!err) | |
| 17698 | - | break; | |
| 17699 | - | retry++; | |
| 17700 | - | } while (retry < BNXT_FW_SLOT_RESET_RETRY); | |
| 17657 | + | result = PCI_ERS_RESULT_RECOVERED; | |
| 17701 | 17658 | ||
| 17702 | - | if (err) { | |
| 17703 | - | dev_err(&pdev->dev, "Firmware not ready\n"); | |
| 17704 | - | goto reset_exit; | |
| 17659 | + | /* IRQ will be initialized later in bnxt_io_resume */ | |
| 17660 | + | bnxt_ulp_irq_stop(bp); | |
| 17661 | + | bnxt_clear_int_mode(bp); | |
| 17705 | 17662 | } | |
| 17706 | 17663 | ||
| 17707 | - | err = bnxt_hwrm_func_reset(bp); | |
| 17708 | - | if (!err) | |
| 17709 | - | result = PCI_ERS_RESULT_RECOVERED; | |
| 17710 | - | ||
| 17711 | - | /* IRQ will be initialized later in bnxt_io_resume */ | |
| 17712 | - | bnxt_ulp_irq_stop(bp); | |
| 17713 | - | bnxt_clear_int_mode(bp); | |
| 17714 | - | ||
| 17715 | 17664 | reset_exit: | |
| 17716 | 17665 | clear_bit(BNXT_STATE_IN_FW_RESET, &bp->state); | |
| 17717 | 17666 | bnxt_clear_reservations(bp, true); | |
modified drivers/net/ethernet/broadcom/bnxt/bnxt.h
| @@ -2468,6 +2468,7 @@ struct bnxt { | |||
| 2468 | 2468 | #define BNXT_STATE_ABORT_ERR 5 | |
| 2469 | 2469 | #define BNXT_STATE_FW_FATAL_COND 6 | |
| 2470 | 2470 | #define BNXT_STATE_DRV_REGISTERED 7 | |
| 2471 | + | #define BNXT_STATE_PCI_CHANNEL_IO_FROZEN 8 | |
| 2471 | 2472 | #define BNXT_STATE_NAPI_DISABLED 9 | |
| 2472 | 2473 | #define BNXT_STATE_FW_ACTIVATE 11 | |
| 2473 | 2474 | #define BNXT_STATE_RECOVER 12 | |
modified drivers/net/ethernet/broadcom/genet/bcmgenet.c
| @@ -57,9 +57,6 @@ | |||
| 57 | 57 | */ | |
| 58 | 58 | #define GENET_RSB_PAD (sizeof(struct status_64) + 2) | |
| 59 | 59 | ||
| 60 | - | /* RX buffer plus the skb_shared_info napi_build_skb() places behind it */ | |
| 61 | - | #define GENET_RX_BUF_SIZE SKB_HEAD_ALIGN(RX_BUF_LENGTH) | |
| 62 | - | ||
| 63 | 60 | /* Tx/Rx DMA register offset, skip 256 descriptors */ | |
| 64 | 61 | #define WORDS_PER_BD(p) (p->hw_params->words_per_bd) | |
| 65 | 62 | #define DMA_DESC_SIZE (WORDS_PER_BD(priv) * sizeof(u32)) | |
| @@ -2257,12 +2254,11 @@ static int bcmgenet_rx_refill(struct bcmgenet_rx_ring *ring, | |||
| 2257 | 2254 | struct enet_cb *cb) | |
| 2258 | 2255 | { | |
| 2259 | 2256 | struct bcmgenet_priv *priv = ring->priv; | |
| 2260 | - | unsigned int size = GENET_RX_BUF_SIZE; | |
| 2261 | - | unsigned int offset; | |
| 2262 | 2257 | dma_addr_t mapping; | |
| 2263 | 2258 | struct page *page; | |
| 2264 | 2259 | ||
| 2265 | - | page = page_pool_dev_alloc(ring->page_pool, &offset, &size); | |
| 2260 | + | page = page_pool_alloc_pages(ring->page_pool, | |
| 2261 | + | GFP_ATOMIC); | |
| 2266 | 2262 | if (!page) { | |
| 2267 | 2263 | priv->mib.alloc_rx_buff_failed++; | |
| 2268 | 2264 | netif_err(priv, rx_err, priv->dev, | |
| @@ -2271,13 +2267,9 @@ static int bcmgenet_rx_refill(struct bcmgenet_rx_ring *ring, | |||
| 2271 | 2267 | } | |
| 2272 | 2268 | ||
| 2273 | 2269 | /* page_pool handles DMA mapping via PP_FLAG_DMA_MAP */ | |
| 2274 | - | mapping = page_pool_get_dma_addr(page) + offset; | |
| 2275 | - | dma_sync_single_for_device(&priv->pdev->dev, mapping, RX_BUF_LENGTH, | |
| 2276 | - | DMA_FROM_DEVICE); | |
| 2270 | + | mapping = page_pool_get_dma_addr(page); | |
| 2277 | 2271 | ||
| 2278 | 2272 | cb->rx_page = page; | |
| 2279 | - | cb->rx_offset = offset; | |
| 2280 | - | cb->rx_size = size; | |
| 2281 | 2273 | dmadesc_set_addr(priv, cb->bd_addr, mapping); | |
| 2282 | 2274 | ||
| 2283 | 2275 | return 0; | |
| @@ -2331,7 +2323,6 @@ static unsigned int bcmgenet_desc_rx(struct bcmgenet_rx_ring *ring, | |||
| 2331 | 2323 | ||
| 2332 | 2324 | while ((rxpktprocessed < rxpkttoprocess) && | |
| 2333 | 2325 | (rxpktprocessed < budget)) { | |
| 2334 | - | unsigned int rx_offset, rx_size; | |
| 2335 | 2326 | struct status_64 *status; | |
| 2336 | 2327 | struct page *rx_page; | |
| 2337 | 2328 | void *hard_start; | |
| @@ -2341,8 +2332,6 @@ static unsigned int bcmgenet_desc_rx(struct bcmgenet_rx_ring *ring, | |||
| 2341 | 2332 | ||
| 2342 | 2333 | /* Save the received page before refilling */ | |
| 2343 | 2334 | rx_page = cb->rx_page; | |
| 2344 | - | rx_offset = cb->rx_offset; | |
| 2345 | - | rx_size = cb->rx_size; | |
| 2346 | 2335 | ||
| 2347 | 2336 | if (bcmgenet_rx_refill(ring, cb)) { | |
| 2348 | 2337 | BCMGENET_STATS64_INC(stats, dropped); | |
| @@ -2352,10 +2341,10 @@ static unsigned int bcmgenet_desc_rx(struct bcmgenet_rx_ring *ring, | |||
| 2352 | 2341 | /* Sync the full buffer; the HW may have written anywhere | |
| 2353 | 2342 | * up to RX_BUF_LENGTH. | |
| 2354 | 2343 | */ | |
| 2355 | - | page_pool_dma_sync_for_cpu(ring->page_pool, rx_page, rx_offset, | |
| 2344 | + | page_pool_dma_sync_for_cpu(ring->page_pool, rx_page, 0, | |
| 2356 | 2345 | RX_BUF_LENGTH); | |
| 2357 | 2346 | ||
| 2358 | - | hard_start = page_address(rx_page) + rx_offset; | |
| 2347 | + | hard_start = page_address(rx_page); | |
| 2359 | 2348 | status = (struct status_64 *)hard_start; | |
| 2360 | 2349 | dma_length_status = status->length_status; | |
| 2361 | 2350 | ||
| @@ -2421,7 +2410,7 @@ static unsigned int bcmgenet_desc_rx(struct bcmgenet_rx_ring *ring, | |||
| 2421 | 2410 | /* Build SKB from the page - data starts at hard_start, | |
| 2422 | 2411 | * frame begins after RSB(64) + pad(2) = 66 bytes. | |
| 2423 | 2412 | */ | |
| 2424 | - | skb = napi_build_skb(hard_start, rx_size); | |
| 2413 | + | skb = napi_build_skb(hard_start, PAGE_SIZE); | |
| 2425 | 2414 | if (unlikely(!skb)) { | |
| 2426 | 2415 | BCMGENET_STATS64_INC(stats, dropped); | |
| 2427 | 2416 | page_pool_put_full_page(ring->page_pool, rx_page, | |
| @@ -2773,16 +2762,14 @@ static void bcmgenet_init_tx_ring(struct bcmgenet_priv *priv, | |||
| 2773 | 2762 | static int bcmgenet_rx_ring_create_pool(struct bcmgenet_priv *priv, | |
| 2774 | 2763 | struct bcmgenet_rx_ring *ring) | |
| 2775 | 2764 | { | |
| 2776 | - | /* Buffers share a page. bcmgenet_rx_refill() syncs each one for the | |
| 2777 | - | * device, PP_FLAG_DMA_SYNC_DEV would sync the whole page. | |
| 2778 | - | */ | |
| 2779 | 2765 | struct page_pool_params pp_params = { | |
| 2780 | 2766 | .order = 0, | |
| 2781 | - | .flags = PP_FLAG_DMA_MAP, | |
| 2767 | + | .flags = PP_FLAG_DMA_MAP | PP_FLAG_DMA_SYNC_DEV, | |
| 2782 | 2768 | .pool_size = ring->size, | |
| 2783 | 2769 | .nid = NUMA_NO_NODE, | |
| 2784 | 2770 | .dev = &priv->pdev->dev, | |
| 2785 | 2771 | .dma_dir = DMA_FROM_DEVICE, | |
| 2772 | + | .max_len = RX_BUF_LENGTH, | |
| 2786 | 2773 | }; | |
| 2787 | 2774 | int err; | |
| 2788 | 2775 | ||
| @@ -4151,11 +4138,8 @@ static int bcmgenet_probe(struct platform_device *pdev) | |||
| 4151 | 4138 | netif_set_real_num_rx_queues(priv->dev, priv->hw_params->rx_queues + 1); | |
| 4152 | 4139 | ||
| 4153 | 4140 | /* Set default coalescing parameters */ | |
| 4154 | - | for (i = 0; i <= priv->hw_params->rx_queues; i++) { | |
| 4155 | - | priv->rx_rings[i].priv = priv; | |
| 4156 | - | priv->rx_rings[i].index = i; | |
| 4141 | + | for (i = 0; i <= priv->hw_params->rx_queues; i++) | |
| 4157 | 4142 | priv->rx_rings[i].rx_max_coalesced_frames = 1; | |
| 4158 | - | } | |
| 4159 | 4143 | ||
| 4160 | 4144 | /* Initialize u64 stats seq counter for 32bit machines */ | |
| 4161 | 4145 | for (i = 0; i <= GENET_MAX_MQ_CNT; i++) { | |
modified drivers/net/ethernet/broadcom/genet/bcmgenet.h
| @@ -470,8 +470,6 @@ struct bcmgenet_rx_stats64 { | |||
| 470 | 470 | struct enet_cb { | |
| 471 | 471 | struct sk_buff *skb; | |
| 472 | 472 | struct page *rx_page; | |
| 473 | - | unsigned int rx_offset; | |
| 474 | - | unsigned int rx_size; | |
| 475 | 473 | void __iomem *bd_addr; | |
| 476 | 474 | DEFINE_DMA_UNMAP_ADDR(dma_addr); | |
| 477 | 475 | DEFINE_DMA_UNMAP_LEN(dma_len); | |
modified drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c
| @@ -253,17 +253,6 @@ int bcmgenet_wol_power_up_cfg(struct bcmgenet_priv *priv, | |||
| 253 | 253 | reg = bcmgenet_umac_readl(priv, UMAC_CMD); | |
| 254 | 254 | reg &= ~CMD_CRC_FWD; | |
| 255 | 255 | bcmgenet_umac_writel(priv, reg, UMAC_CMD); | |
| 256 | - | ||
| 257 | - | /* | |
| 258 | - | * Mirror wol_power_down_cfg(). If only UMAC_RX | |
| 259 | - | * is enabled, then we must place the UMAC back | |
| 260 | - | * into SW_RESET. | |
| 261 | - | */ | |
| 262 | - | reg = bcmgenet_umac_readl(priv, UMAC_CMD); | |
| 263 | - | if ((reg & CMD_RX_EN) && !(reg & CMD_TX_EN)) { | |
| 264 | - | reg |= CMD_SW_RESET; | |
| 265 | - | bcmgenet_umac_writel(priv, reg, UMAC_CMD); | |
| 266 | - | } | |
| 267 | 256 | spin_unlock_bh(&priv->reg_lock); | |
| 268 | 257 | ||
| 269 | 258 | /* Resume link status tracking */ | |
modified drivers/net/ethernet/cadence/macb_main.c
| @@ -2421,40 +2421,34 @@ static inline int macb_clear_csum(struct sk_buff *skb) | |||
| 2421 | 2421 | return 0; | |
| 2422 | 2422 | } | |
| 2423 | 2423 | ||
| 2424 | - | static bool macb_needs_sw_fcs(struct sk_buff *skb, struct net_device *netdev) | |
| 2425 | - | { | |
| 2426 | - | return netdev->features & NETIF_F_HW_CSUM && | |
| 2427 | - | skb->ip_summed != CHECKSUM_PARTIAL && | |
| 2428 | - | !skb_shinfo(skb)->gso_size && !ptp_one_step_sync(skb); | |
| 2429 | - | } | |
| 2430 | - | ||
| 2431 | 2424 | /* Returns a negative errno, or the FCS bytes appended (0 or ETH_FCS_LEN). */ | |
| 2432 | - | static int macb_pad_and_fcs(struct sk_buff **skb, bool add_fcs) | |
| 2425 | + | static int macb_pad_and_fcs(struct sk_buff **skb, struct net_device *netdev) | |
| 2433 | 2426 | { | |
| 2434 | 2427 | bool cloned = skb_cloned(*skb) || skb_header_cloned(*skb) || | |
| 2435 | 2428 | skb_is_nonlinear(*skb); | |
| 2436 | 2429 | int padlen = ETH_ZLEN - (*skb)->len; | |
| 2437 | 2430 | int tailroom = skb_tailroom(*skb); | |
| 2438 | - | bool shared = skb_shared(*skb); | |
| 2439 | 2431 | struct sk_buff *nskb; | |
| 2440 | 2432 | u32 fcs; | |
| 2441 | 2433 | ||
| 2442 | - | if (!add_fcs) | |
| 2434 | + | if (!(netdev->features & NETIF_F_HW_CSUM) || | |
| 2435 | + | !((*skb)->ip_summed != CHECKSUM_PARTIAL) || | |
| 2436 | + | skb_shinfo(*skb)->gso_size || ptp_one_step_sync(*skb)) | |
| 2443 | 2437 | return 0; | |
| 2444 | 2438 | ||
| 2445 | 2439 | if (padlen <= 0) { | |
| 2446 | - | /* FCS could be appended to tailroom. */ | |
| 2447 | - | if (!shared && !skb_is_nonlinear(*skb) && | |
| 2448 | - | tailroom >= ETH_FCS_LEN) | |
| 2440 | + | /* FCS could be appeded to tailroom. */ | |
| 2441 | + | if (tailroom >= ETH_FCS_LEN) | |
| 2449 | 2442 | goto add_fcs; | |
| 2450 | - | /* Reallocate with room for the FCS. */ | |
| 2451 | - | padlen = ETH_FCS_LEN; | |
| 2443 | + | /* No room for FCS, need to reallocate skb. */ | |
| 2444 | + | else | |
| 2445 | + | padlen = ETH_FCS_LEN; | |
| 2452 | 2446 | } else { | |
| 2453 | 2447 | /* Add room for FCS. */ | |
| 2454 | 2448 | padlen += ETH_FCS_LEN; | |
| 2455 | 2449 | } | |
| 2456 | 2450 | ||
| 2457 | - | if (shared || cloned || tailroom < padlen) { | |
| 2451 | + | if (cloned || tailroom < padlen) { | |
| 2458 | 2452 | nskb = skb_copy_expand(*skb, 0, padlen, GFP_ATOMIC); | |
| 2459 | 2453 | if (!nskb) | |
| 2460 | 2454 | return -ENOMEM; | |
| @@ -2487,15 +2481,27 @@ static netdev_tx_t macb_start_xmit(struct sk_buff *skb, | |||
| 2487 | 2481 | unsigned int desc_cnt, nr_frags, frag_size, f; | |
| 2488 | 2482 | struct macb_queue *queue = &bp->queues[q]; | |
| 2489 | 2483 | netdev_tx_t ret = NETDEV_TX_OK; | |
| 2490 | - | unsigned int hdrlen, tx_len; | |
| 2491 | - | bool add_fcs, is_lso; | |
| 2484 | + | unsigned int hdrlen; | |
| 2492 | 2485 | unsigned long flags; | |
| 2493 | 2486 | int fcs_len; | |
| 2487 | + | bool is_lso; | |
| 2488 | + | ||
| 2489 | + | if (macb_clear_csum(skb)) { | |
| 2490 | + | dev_kfree_skb_any(skb); | |
| 2491 | + | return ret; | |
| 2492 | + | } | |
| 2493 | + | ||
| 2494 | + | fcs_len = macb_pad_and_fcs(&skb, netdev); | |
| 2495 | + | if (fcs_len < 0) { | |
| 2496 | + | dev_kfree_skb_any(skb); | |
| 2497 | + | return ret; | |
| 2498 | + | } | |
| 2499 | + | ||
| 2500 | + | if (macb_dma_ptp(bp) && | |
| 2501 | + | (skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP)) | |
| 2502 | + | skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS; | |
| 2494 | 2503 | ||
| 2495 | - | add_fcs = macb_needs_sw_fcs(skb, netdev); | |
| 2496 | 2504 | is_lso = (skb_shinfo(skb)->gso_size != 0); | |
| 2497 | - | tx_len = add_fcs ? max_t(unsigned int, skb->len, ETH_ZLEN) + | |
| 2498 | - | ETH_FCS_LEN : skb->len; | |
| 2499 | 2505 | ||
| 2500 | 2506 | if (is_lso) { | |
| 2501 | 2507 | /* length of headers */ | |
| @@ -2509,11 +2515,8 @@ static netdev_tx_t macb_start_xmit(struct sk_buff *skb, | |||
| 2509 | 2515 | /* if this is required, would need to copy to single buffer */ | |
| 2510 | 2516 | return NETDEV_TX_BUSY; | |
| 2511 | 2517 | } | |
| 2512 | - | } else if (add_fcs) { | |
| 2513 | - | hdrlen = umin(tx_len, bp->max_tx_length); | |
| 2514 | - | } else { | |
| 2518 | + | } else | |
| 2515 | 2519 | hdrlen = umin(skb_headlen(skb), bp->max_tx_length); | |
| 2516 | - | } | |
| 2517 | 2520 | ||
| 2518 | 2521 | #if defined(DEBUG) && defined(VERBOSE_DEBUG) | |
| 2519 | 2522 | netdev_vdbg(bp->netdev, | |
| @@ -2528,18 +2531,12 @@ static netdev_tx_t macb_start_xmit(struct sk_buff *skb, | |||
| 2528 | 2531 | * socket buffer: skb fragments of jumbo frames may need to be | |
| 2529 | 2532 | * split into many buffer descriptors. | |
| 2530 | 2533 | */ | |
| 2531 | - | if (add_fcs) { | |
| 2532 | - | /* macb_pad_and_fcs() linearizes the skb before adding the FCS. */ | |
| 2533 | - | desc_cnt = DIV_ROUND_UP(tx_len, bp->max_tx_length); | |
| 2534 | - | nr_frags = 0; | |
| 2535 | - | } else if (is_lso && (skb_headlen(skb) > hdrlen)) { | |
| 2534 | + | if (is_lso && (skb_headlen(skb) > hdrlen)) | |
| 2536 | 2535 | /* extra header descriptor if also payload in first buffer */ | |
| 2537 | 2536 | desc_cnt = DIV_ROUND_UP((skb_headlen(skb) - hdrlen), bp->max_tx_length) + 1; | |
| 2538 | - | nr_frags = skb_shinfo(skb)->nr_frags; | |
| 2539 | - | } else { | |
| 2537 | + | else | |
| 2540 | 2538 | desc_cnt = DIV_ROUND_UP(skb_headlen(skb), bp->max_tx_length); | |
| 2541 | - | nr_frags = skb_shinfo(skb)->nr_frags; | |
| 2542 | - | } | |
| 2539 | + | nr_frags = skb_shinfo(skb)->nr_frags; | |
| 2543 | 2540 | for (f = 0; f < nr_frags; f++) { | |
| 2544 | 2541 | frag_size = skb_frag_size(&skb_shinfo(skb)->frags[f]); | |
| 2545 | 2542 | desc_cnt += DIV_ROUND_UP(frag_size, bp->max_tx_length); | |
| @@ -2557,21 +2554,6 @@ static netdev_tx_t macb_start_xmit(struct sk_buff *skb, | |||
| 2557 | 2554 | goto unlock; | |
| 2558 | 2555 | } | |
| 2559 | 2556 | ||
| 2560 | - | if (macb_clear_csum(skb)) { | |
| 2561 | - | dev_kfree_skb_any(skb); | |
| 2562 | - | goto unlock; | |
| 2563 | - | } | |
| 2564 | - | ||
| 2565 | - | fcs_len = macb_pad_and_fcs(&skb, add_fcs); | |
| 2566 | - | if (fcs_len < 0) { | |
| 2567 | - | dev_kfree_skb_any(skb); | |
| 2568 | - | goto unlock; | |
| 2569 | - | } | |
| 2570 | - | ||
| 2571 | - | if (macb_dma_ptp(bp) && | |
| 2572 | - | (skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP)) | |
| 2573 | - | skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS; | |
| 2574 | - | ||
| 2575 | 2557 | /* Map socket buffer for DMA transfer */ | |
| 2576 | 2558 | if (macb_tx_map(bp, queue, skb, hdrlen, fcs_len)) { | |
| 2577 | 2559 | dev_kfree_skb_any(skb); | |
modified drivers/net/ethernet/chelsio/inline_crypto/ch_ktls/chcr_ktls.c
| @@ -389,7 +389,7 @@ static void chcr_ktls_dev_del(struct net_device *netdev, | |||
| 389 | 389 | cxgb4_remove_tid(&tx_info->adap->tids, tx_info->tx_chan, | |
| 390 | 390 | tx_info->tid, tx_info->ip_family); | |
| 391 | 391 | ||
| 392 | - | xa_erase_bh(&u_ctx->tid_list, tx_info->tid); | |
| 392 | + | xa_erase(&u_ctx->tid_list, tx_info->tid); | |
| 393 | 393 | } | |
| 394 | 394 | ||
| 395 | 395 | port_stats = &tx_info->adap->ch_ktls_stats.ktls_port[tx_info->port_id]; | |
| @@ -577,7 +577,7 @@ free_tid: | |||
| 577 | 577 | cxgb4_remove_tid(&tx_info->adap->tids, tx_info->tx_chan, | |
| 578 | 578 | tx_info->tid, tx_info->ip_family); | |
| 579 | 579 | ||
| 580 | - | xa_erase_bh(&u_ctx->tid_list, tx_info->tid); | |
| 580 | + | xa_erase(&u_ctx->tid_list, tx_info->tid); | |
| 581 | 581 | ||
| 582 | 582 | put_module: | |
| 583 | 583 | /* release module refcount */ | |
modified drivers/net/ethernet/google/gve/gve_main.c
| @@ -1708,17 +1708,17 @@ static int gve_xsk_pool_disable(struct net_device *dev, | |||
| 1708 | 1708 | } | |
| 1709 | 1709 | ||
| 1710 | 1710 | napi_rx = &priv->ntfy_blocks[priv->rx[qid].ntfy_id].napi; | |
| 1711 | - | napi_disable_locked(napi_rx); /* make sure current rx poll is done */ | |
| 1711 | + | napi_disable(napi_rx); /* make sure current rx poll is done */ | |
| 1712 | 1712 | ||
| 1713 | 1713 | tx_qid = gve_xdp_tx_queue_id(priv, qid); | |
| 1714 | 1714 | napi_tx = &priv->ntfy_blocks[priv->tx[tx_qid].ntfy_id].napi; | |
| 1715 | - | napi_disable_locked(napi_tx); /* make sure current tx poll is done */ | |
| 1715 | + | napi_disable(napi_tx); /* make sure current tx poll is done */ | |
| 1716 | 1716 | ||
| 1717 | 1717 | gve_unreg_xsk_pool(priv, qid); | |
| 1718 | 1718 | smp_mb(); /* Make sure it is visible to the workers on datapath */ | |
| 1719 | 1719 | ||
| 1720 | - | napi_enable_locked(napi_rx); | |
| 1721 | - | napi_enable_locked(napi_tx); | |
| 1720 | + | napi_enable(napi_rx); | |
| 1721 | + | napi_enable(napi_tx); | |
| 1722 | 1722 | if (gve_is_gqi(priv)) { | |
| 1723 | 1723 | if (gve_rx_work_pending(&priv->rx[qid])) | |
| 1724 | 1724 | napi_schedule(napi_rx); | |
modified drivers/net/ethernet/google/gve/gve_rx_dqo.c
| @@ -113,12 +113,6 @@ static void gve_rx_reset_ring_dqo(struct gve_priv *priv, int idx) | |||
| 113 | 113 | gve_free_to_page_pool(rx, bs, false); | |
| 114 | 114 | else | |
| 115 | 115 | gve_free_qpl_page_dqo(bs); | |
| 116 | - | ||
| 117 | - | if (gve_buf_state_is_allocated(rx, bs) && | |
| 118 | - | bs->xsk_buff) { | |
| 119 | - | xsk_buff_free(bs->xsk_buff); | |
| 120 | - | bs->xsk_buff = NULL; | |
| 121 | - | } | |
| 122 | 116 | } | |
| 123 | 117 | } | |
| 124 | 118 | ||
| @@ -842,12 +836,7 @@ static int gve_rx_dqo(struct napi_struct *napi, struct gve_rx_ring *rx, | |||
| 842 | 836 | } | |
| 843 | 837 | ||
| 844 | 838 | if (unlikely(compl_desc->rx_error)) { | |
| 845 | - | if (buf_state->xsk_buff) { | |
| 846 | - | xsk_buff_free(buf_state->xsk_buff); | |
| 847 | - | gve_free_buf_state(rx, buf_state); | |
| 848 | - | } else { | |
| 849 | - | gve_free_buffer(rx, buf_state); | |
| 850 | - | } | |
| 839 | + | gve_free_buffer(rx, buf_state); | |
| 851 | 840 | return -EINVAL; | |
| 852 | 841 | } | |
| 853 | 842 | ||
modified drivers/net/ethernet/google/gve/gve_tx_dqo.c
| @@ -595,25 +595,25 @@ static int gve_prep_tso(struct sk_buff *skb) | |||
| 595 | 595 | err = skb_cow_head(skb, 0); | |
| 596 | 596 | if (err < 0) | |
| 597 | 597 | return err; | |
| 598 | - | shinfo = skb_shinfo(skb); | |
| 599 | 598 | ||
| 600 | 599 | l4_start = skb_transport_offset(skb); | |
| 601 | 600 | paylen = skb->len - l4_start; | |
| 602 | 601 | ||
| 603 | - | /* gso_type is a bitmask: SKB_GSO_DODGY, SKB_GSO_TCP_ECN and | |
| 604 | - | * SKB_GSO_TCP_FIXEDID may be set alongside the protocol bit. | |
| 605 | - | */ | |
| 606 | - | if (shinfo->gso_type & (SKB_GSO_TCPV4 | SKB_GSO_TCPV6)) { | |
| 602 | + | switch (shinfo->gso_type) { | |
| 603 | + | case SKB_GSO_TCPV4: | |
| 604 | + | case SKB_GSO_TCPV6: | |
| 607 | 605 | tcp = tcp_hdr(skb); | |
| 608 | 606 | csum_replace_by_diff(&tcp->check, | |
| 609 | 607 | (__force __wsum)htonl(paylen)); | |
| 610 | 608 | header_len = skb_tcp_all_headers(skb); | |
| 611 | - | } else if (shinfo->gso_type & SKB_GSO_UDP_L4) { | |
| 609 | + | break; | |
| 610 | + | case SKB_GSO_UDP_L4: | |
| 612 | 611 | udp = udp_hdr(skb); | |
| 613 | 612 | csum_replace_by_diff(&udp->check, | |
| 614 | 613 | (__force __wsum)htonl(paylen)); | |
| 615 | 614 | header_len = sizeof(struct udphdr) + l4_start; | |
| 616 | - | } else { | |
| 615 | + | break; | |
| 616 | + | default: | |
| 617 | 617 | return -EINVAL; | |
| 618 | 618 | } | |
| 619 | 619 | ||
modified drivers/net/ethernet/ibm/ibmveth.c
| @@ -553,15 +553,10 @@ static int ibmveth_rxq_harvest_buffer(struct ibmveth_adapter *adapter, | |||
| 553 | 553 | ||
| 554 | 554 | static void ibmveth_free_tx_ltb(struct ibmveth_adapter *adapter, int idx) | |
| 555 | 555 | { | |
| 556 | - | void *ptr = adapter->tx_ltb_ptr[idx]; | |
| 557 | - | ||
| 558 | - | if (!ptr) | |
| 559 | - | return; | |
| 560 | - | ||
| 561 | - | adapter->tx_ltb_ptr[idx] = NULL; | |
| 562 | 556 | dma_unmap_single(&adapter->vdev->dev, adapter->tx_ltb_dma[idx], | |
| 563 | 557 | adapter->tx_ltb_size, DMA_TO_DEVICE); | |
| 564 | - | kfree(ptr); | |
| 558 | + | kfree(adapter->tx_ltb_ptr[idx]); | |
| 559 | + | adapter->tx_ltb_ptr[idx] = NULL; | |
| 565 | 560 | } | |
| 566 | 561 | ||
| 567 | 562 | static int ibmveth_allocate_tx_ltb(struct ibmveth_adapter *adapter, int idx) | |
| @@ -672,7 +667,7 @@ static int ibmveth_open(struct net_device *netdev) | |||
| 672 | 667 | ||
| 673 | 668 | for (i = 0; i < netdev->real_num_tx_queues; i++) { | |
| 674 | 669 | if (ibmveth_allocate_tx_ltb(adapter, i)) | |
| 675 | - | goto out_unmap_filter_list; | |
| 670 | + | goto out_free_tx_ltb; | |
| 676 | 671 | } | |
| 677 | 672 | ||
| 678 | 673 | adapter->rx_queue.index = 0; | |
| @@ -723,6 +718,10 @@ static int ibmveth_open(struct net_device *netdev) | |||
| 723 | 718 | if (rc != 0) { | |
| 724 | 719 | netdev_err(netdev, "unable to request irq 0x%x, rc %d\n", | |
| 725 | 720 | netdev->irq, rc); | |
| 721 | + | do { | |
| 722 | + | lpar_rc = h_free_logical_lan(adapter->vdev->unit_address); | |
| 723 | + | } while (H_IS_LONG_BUSY(lpar_rc) || (lpar_rc == H_BUSY)); | |
| 724 | + | ||
| 726 | 725 | goto out_free_buffer_pools; | |
| 727 | 726 | } | |
| 728 | 727 | ||
| @@ -738,9 +737,6 @@ static int ibmveth_open(struct net_device *netdev) | |||
| 738 | 737 | return 0; | |
| 739 | 738 | ||
| 740 | 739 | out_free_buffer_pools: | |
| 741 | - | do { | |
| 742 | - | lpar_rc = h_free_logical_lan(adapter->vdev->unit_address); | |
| 743 | - | } while (H_IS_LONG_BUSY(lpar_rc) || (lpar_rc == H_BUSY)); | |
| 744 | 740 | while (--i >= 0) { | |
| 745 | 741 | if (adapter->rx_buff_pool[i].active) | |
| 746 | 742 | ibmveth_free_buffer_pool(adapter, | |
| @@ -750,8 +746,10 @@ out_unmap_filter_list: | |||
| 750 | 746 | dma_unmap_single(dev, adapter->filter_list_dma, 4096, | |
| 751 | 747 | DMA_BIDIRECTIONAL); | |
| 752 | 748 | ||
| 753 | - | for (i = netdev->real_num_tx_queues - 1; i >= 0; i--) | |
| 749 | + | out_free_tx_ltb: | |
| 750 | + | while (--i >= 0) { | |
| 754 | 751 | ibmveth_free_tx_ltb(adapter, i); | |
| 752 | + | } | |
| 755 | 753 | ||
| 756 | 754 | out_unmap_buffer_list: | |
| 757 | 755 | dma_unmap_single(dev, adapter->buffer_list_dma, 4096, | |
modified drivers/net/ethernet/intel/e1000e/netdev.c
| @@ -67,13 +67,6 @@ static const struct dmi_system_id disable_k1_list[] = { | |||
| 67 | 67 | DMI_MATCH(DMI_PRODUCT_NAME, "Dell Pro 16 Plus PB16250"), | |
| 68 | 68 | }, | |
| 69 | 69 | }, | |
| 70 | - | { | |
| 71 | - | .ident = "Lenovo ThinkPad P14s Gen 5", | |
| 72 | - | .matches = { | |
| 73 | - | DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), | |
| 74 | - | DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad P14s Gen 5"), | |
| 75 | - | }, | |
| 76 | - | }, | |
| 77 | 70 | {} | |
| 78 | 71 | }; | |
| 79 | 72 | ||
modified drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
| @@ -4943,20 +4943,6 @@ out: | |||
| 4943 | 4943 | return ret; | |
| 4944 | 4944 | } | |
| 4945 | 4945 | ||
| 4946 | - | /** | |
| 4947 | - | * i40e_setup_vf_trust - Enable/disable VF trust mode without reset | |
| 4948 | - | * @vf: VF to configure | |
| 4949 | - | * @setting: trust setting | |
| 4950 | - | * | |
| 4951 | - | * Update VF flags when changing trust without performing a VF reset. | |
| 4952 | - | * This is only called when it's safe to skip the reset (VF has no advanced | |
| 4953 | - | * features configured that need cleanup). | |
| 4954 | - | */ | |
| 4955 | - | static void i40e_setup_vf_trust(struct i40e_vf *vf, bool setting) | |
| 4956 | - | { | |
| 4957 | - | assign_bit(I40E_VIRTCHNL_VF_CAP_PRIVILEGE, &vf->vf_caps, setting); | |
| 4958 | - | } | |
| 4959 | - | ||
| 4960 | 4946 | /** | |
| 4961 | 4947 | * i40e_ndo_set_vf_trust | |
| 4962 | 4948 | * @netdev: network interface device structure of the pf | |
| @@ -5001,20 +4987,19 @@ int i40e_ndo_set_vf_trust(struct net_device *netdev, int vf_id, bool setting) | |||
| 5001 | 4987 | set_bit(__I40E_MACVLAN_SYNC_PENDING, pf->state); | |
| 5002 | 4988 | pf->vsi[vf->lan_vsi_idx]->flags |= I40E_VSI_FLAG_FILTER_CHANGED; | |
| 5003 | 4989 | ||
| 5004 | - | /* Reset only if revoking trust and VF has advanced features configured */ | |
| 5005 | - | if (!setting && | |
| 5006 | - | (vf->adq_enabled || vf->num_cloud_filters > 0 || | |
| 5007 | - | test_bit(I40E_VF_STATE_UC_PROMISC, &vf->vf_states) || | |
| 5008 | - | test_bit(I40E_VF_STATE_MC_PROMISC, &vf->vf_states))) { | |
| 5009 | - | i40e_vc_reset_vf(vf, true); | |
| 5010 | - | i40e_del_all_cloud_filters(vf); | |
| 5011 | - | } else { | |
| 5012 | - | i40e_setup_vf_trust(vf, setting); | |
| 5013 | - | } | |
| 5014 | - | ||
| 4990 | + | i40e_vc_reset_vf(vf, true); | |
| 5015 | 4991 | dev_info(&pf->pdev->dev, "VF %u is now %strusted\n", | |
| 5016 | 4992 | vf_id, setting ? "" : "un"); | |
| 5017 | 4993 | ||
| 4994 | + | if (vf->adq_enabled) { | |
| 4995 | + | if (!vf->trusted) { | |
| 4996 | + | dev_info(&pf->pdev->dev, | |
| 4997 | + | "VF %u no longer Trusted, deleting all cloud filters\n", | |
| 4998 | + | vf_id); | |
| 4999 | + | i40e_del_all_cloud_filters(vf); | |
| 5000 | + | } | |
| 5001 | + | } | |
| 5002 | + | ||
| 5018 | 5003 | out: | |
| 5019 | 5004 | clear_bit(__I40E_VIRTCHNL_OP_PENDING, pf->state); | |
| 5020 | 5005 | return ret; | |
modified drivers/net/ethernet/intel/iavf/iavf.h
| @@ -259,6 +259,7 @@ struct iavf_adapter { | |||
| 259 | 259 | struct work_struct adminq_task; | |
| 260 | 260 | struct work_struct finish_config; | |
| 261 | 261 | wait_queue_head_t down_waitqueue; | |
| 262 | + | wait_queue_head_t vc_waitqueue; | |
| 262 | 263 | struct iavf_q_vector *q_vectors; | |
| 263 | 264 | struct list_head vlan_filter_list; | |
| 264 | 265 | int num_vlan_filters; | |
| @@ -587,9 +588,8 @@ void iavf_configure_queues(struct iavf_adapter *adapter); | |||
| 587 | 588 | void iavf_enable_queues(struct iavf_adapter *adapter); | |
| 588 | 589 | void iavf_disable_queues(struct iavf_adapter *adapter); | |
| 589 | 590 | void iavf_map_queues(struct iavf_adapter *adapter); | |
| 590 | - | int iavf_add_ether_addrs(struct iavf_adapter *adapter); | |
| 591 | + | void iavf_add_ether_addrs(struct iavf_adapter *adapter); | |
| 591 | 592 | void iavf_del_ether_addrs(struct iavf_adapter *adapter); | |
| 592 | - | void iavf_mac_add_reject(struct iavf_adapter *adapter); | |
| 593 | 593 | void iavf_add_vlans(struct iavf_adapter *adapter); | |
| 594 | 594 | void iavf_del_vlans(struct iavf_adapter *adapter); | |
| 595 | 595 | void iavf_set_promiscuous(struct iavf_adapter *adapter); | |
| @@ -606,13 +606,6 @@ void iavf_disable_vlan_stripping(struct iavf_adapter *adapter); | |||
| 606 | 606 | void iavf_virtchnl_completion(struct iavf_adapter *adapter, | |
| 607 | 607 | enum virtchnl_ops v_opcode, | |
| 608 | 608 | enum iavf_status v_retval, u8 *msg, u16 msglen); | |
| 609 | - | int iavf_poll_virtchnl_response(struct iavf_adapter *adapter, | |
| 610 | - | struct iavf_arq_event_info *event, | |
| 611 | - | bool (*condition)(struct iavf_adapter *adapter, | |
| 612 | - | const void *data, | |
| 613 | - | enum virtchnl_ops v_op), | |
| 614 | - | const void *cond_data, | |
| 615 | - | unsigned int timeout_ms); | |
| 616 | 609 | int iavf_config_rss(struct iavf_adapter *adapter); | |
| 617 | 610 | void iavf_cfg_queues_bw(struct iavf_adapter *adapter); | |
| 618 | 611 | void iavf_cfg_queues_quanta_size(struct iavf_adapter *adapter); | |
modified drivers/net/ethernet/intel/iavf/iavf_main.c
| @@ -1029,60 +1029,6 @@ static bool iavf_is_mac_set_handled(struct net_device *netdev, | |||
| 1029 | 1029 | return ret; | |
| 1030 | 1030 | } | |
| 1031 | 1031 | ||
| 1032 | - | /** | |
| 1033 | - | * iavf_mac_change_done - Check if MAC change completed | |
| 1034 | - | * @adapter: board private structure | |
| 1035 | - | * @data: MAC address being checked (as const void *) | |
| 1036 | - | * @v_op: virtchnl opcode from processed message | |
| 1037 | - | * | |
| 1038 | - | * Callback for iavf_poll_virtchnl_response() to check if MAC change completed. | |
| 1039 | - | * | |
| 1040 | - | * Return: true if MAC change completed, false otherwise | |
| 1041 | - | */ | |
| 1042 | - | static bool iavf_mac_change_done(struct iavf_adapter *adapter, | |
| 1043 | - | const void *data, enum virtchnl_ops v_op) | |
| 1044 | - | { | |
| 1045 | - | const u8 *addr = data; | |
| 1046 | - | ||
| 1047 | - | return iavf_is_mac_set_handled(adapter->netdev, addr); | |
| 1048 | - | } | |
| 1049 | - | ||
| 1050 | - | /** | |
| 1051 | - | * iavf_set_mac_sync - Synchronously change MAC address | |
| 1052 | - | * @adapter: board private structure | |
| 1053 | - | * @addr: MAC address to set | |
| 1054 | - | * | |
| 1055 | - | * Send MAC change request to PF and poll admin queue for response. | |
| 1056 | - | * Caller must hold netdev_lock. This can sleep for up to 2.5 seconds. | |
| 1057 | - | * Event buffer is allocated before sending to avoid state mismatch if | |
| 1058 | - | * allocation fails after message is sent to PF. | |
| 1059 | - | * | |
| 1060 | - | * Return: 0 on success, negative on failure | |
| 1061 | - | */ | |
| 1062 | - | static int iavf_set_mac_sync(struct iavf_adapter *adapter, const u8 *addr) | |
| 1063 | - | { | |
| 1064 | - | struct iavf_arq_event_info event; | |
| 1065 | - | int ret; | |
| 1066 | - | ||
| 1067 | - | netdev_assert_locked(adapter->netdev); | |
| 1068 | - | ||
| 1069 | - | event.buf_len = IAVF_MAX_AQ_BUF_SIZE; | |
| 1070 | - | event.msg_buf = kzalloc(event.buf_len, GFP_KERNEL); | |
| 1071 | - | if (!event.msg_buf) | |
| 1072 | - | return -ENOMEM; | |
| 1073 | - | ||
| 1074 | - | ret = iavf_add_ether_addrs(adapter); | |
| 1075 | - | if (ret) | |
| 1076 | - | goto out; | |
| 1077 | - | ||
| 1078 | - | ret = iavf_poll_virtchnl_response(adapter, &event, | |
| 1079 | - | iavf_mac_change_done, addr, 2500); | |
| 1080 | - | ||
| 1081 | - | out: | |
| 1082 | - | kfree(event.msg_buf); | |
| 1083 | - | return ret; | |
| 1084 | - | } | |
| 1085 | - | ||
| 1086 | 1032 | /** | |
| 1087 | 1033 | * iavf_set_mac - NDO callback to set port MAC address | |
| 1088 | 1034 | * @netdev: network interface device structure | |
| @@ -1100,23 +1046,25 @@ static int iavf_set_mac(struct net_device *netdev, void *p) | |||
| 1100 | 1046 | return -EADDRNOTAVAIL; | |
| 1101 | 1047 | ||
| 1102 | 1048 | ret = iavf_replace_primary_mac(adapter, addr->sa_data); | |
| 1049 | + | ||
| 1103 | 1050 | if (ret) | |
| 1104 | 1051 | return ret; | |
| 1105 | 1052 | ||
| 1106 | - | ret = iavf_set_mac_sync(adapter, addr->sa_data); | |
| 1107 | - | if (ret) { | |
| 1108 | - | /* Rollback only if send failed (message never reached PF). | |
| 1109 | - | * Don't rollback on timeout (-EAGAIN) because the message was | |
| 1110 | - | * sent and PF will eventually respond. When the response arrives, | |
| 1111 | - | * iavf_virtchnl_completion() will handle rollback (on PF error) | |
| 1112 | - | * or acceptance (on PF success) automatically. | |
| 1113 | - | */ | |
| 1114 | - | if (ret != -EAGAIN) { | |
| 1115 | - | iavf_mac_add_reject(adapter); | |
| 1116 | - | ether_addr_copy(adapter->hw.mac.addr, netdev->dev_addr); | |
| 1117 | - | } | |
| 1053 | + | ret = wait_event_interruptible_timeout(adapter->vc_waitqueue, | |
| 1054 | + | iavf_is_mac_set_handled(netdev, addr->sa_data), | |
| 1055 | + | msecs_to_jiffies(2500)); | |
| 1056 | + | ||
| 1057 | + | /* If ret < 0 then it means wait was interrupted. | |
| 1058 | + | * If ret == 0 then it means we got a timeout. | |
| 1059 | + | * else it means we got response for set MAC from PF, | |
| 1060 | + | * check if netdev MAC was updated to requested MAC, | |
| 1061 | + | * if yes then set MAC succeeded otherwise it failed return -EACCES | |
| 1062 | + | */ | |
| 1063 | + | if (ret < 0) | |
| 1118 | 1064 | return ret; | |
| 1119 | - | } | |
| 1065 | + | ||
| 1066 | + | if (!ret) | |
| 1067 | + | return -EAGAIN; | |
| 1120 | 1068 | ||
| 1121 | 1069 | if (!ether_addr_equal(netdev->dev_addr, addr->sa_data)) | |
| 1122 | 1070 | return -EACCES; | |
| @@ -5446,6 +5394,9 @@ static int iavf_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 5446 | 5394 | /* Setup the wait queue for indicating transition to down status */ | |
| 5447 | 5395 | init_waitqueue_head(&adapter->down_waitqueue); | |
| 5448 | 5396 | ||
| 5397 | + | /* Setup the wait queue for indicating virtchannel events */ | |
| 5398 | + | init_waitqueue_head(&adapter->vc_waitqueue); | |
| 5399 | + | ||
| 5449 | 5400 | INIT_LIST_HEAD(&adapter->ptp.aq_cmds); | |
| 5450 | 5401 | init_waitqueue_head(&adapter->ptp.phc_time_waitqueue); | |
| 5451 | 5402 | mutex_init(&adapter->ptp.aq_cmd_lock); | |
modified drivers/net/ethernet/intel/iavf/iavf_virtchnl.c
| @@ -2,7 +2,6 @@ | |||
| 2 | 2 | /* Copyright(c) 2013 - 2018 Intel Corporation. */ | |
| 3 | 3 | ||
| 4 | 4 | #include <linux/net/intel/libie/rx.h> | |
| 5 | - | #include <net/netdev_lock.h> | |
| 6 | 5 | ||
| 7 | 6 | #include "iavf.h" | |
| 8 | 7 | #include "iavf_ptp.h" | |
| @@ -556,23 +555,20 @@ iavf_set_mac_addr_type(struct virtchnl_ether_addr *virtchnl_ether_addr, | |||
| 556 | 555 | * @adapter: adapter structure | |
| 557 | 556 | * | |
| 558 | 557 | * Request that the PF add one or more addresses to our filters. | |
| 559 | - | * | |
| 560 | - | * Return: 0 on success, negative on failure | |
| 561 | - | */ | |
| 562 | - | int iavf_add_ether_addrs(struct iavf_adapter *adapter) | |
| 558 | + | **/ | |
| 559 | + | void iavf_add_ether_addrs(struct iavf_adapter *adapter) | |
| 563 | 560 | { | |
| 564 | 561 | struct virtchnl_ether_addr_list *veal; | |
| 565 | 562 | struct iavf_mac_filter *f; | |
| 566 | 563 | int i = 0, count = 0; | |
| 567 | 564 | bool more = false; | |
| 568 | 565 | size_t len; | |
| 569 | - | int ret; | |
| 570 | 566 | ||
| 571 | 567 | if (adapter->current_op != VIRTCHNL_OP_UNKNOWN) { | |
| 572 | 568 | /* bail because we already have a command pending */ | |
| 573 | 569 | dev_err(&adapter->pdev->dev, "Cannot add filters, command %d pending\n", | |
| 574 | 570 | adapter->current_op); | |
| 575 | - | return -EBUSY; | |
| 571 | + | return; | |
| 576 | 572 | } | |
| 577 | 573 | ||
| 578 | 574 | spin_lock_bh(&adapter->mac_vlan_list_lock); | |
| @@ -584,7 +580,7 @@ int iavf_add_ether_addrs(struct iavf_adapter *adapter) | |||
| 584 | 580 | if (!count) { | |
| 585 | 581 | adapter->aq_required &= ~IAVF_FLAG_AQ_ADD_MAC_FILTER; | |
| 586 | 582 | spin_unlock_bh(&adapter->mac_vlan_list_lock); | |
| 587 | - | return 0; | |
| 583 | + | return; | |
| 588 | 584 | } | |
| 589 | 585 | adapter->current_op = VIRTCHNL_OP_ADD_ETH_ADDR; | |
| 590 | 586 | ||
| @@ -598,9 +594,8 @@ int iavf_add_ether_addrs(struct iavf_adapter *adapter) | |||
| 598 | 594 | ||
| 599 | 595 | veal = kzalloc(len, GFP_ATOMIC); | |
| 600 | 596 | if (!veal) { | |
| 601 | - | adapter->current_op = VIRTCHNL_OP_UNKNOWN; | |
| 602 | 597 | spin_unlock_bh(&adapter->mac_vlan_list_lock); | |
| 603 | - | return -ENOMEM; | |
| 598 | + | return; | |
| 604 | 599 | } | |
| 605 | 600 | ||
| 606 | 601 | veal->vsi_id = adapter->vsi_res->vsi_id; | |
| @@ -620,15 +615,8 @@ int iavf_add_ether_addrs(struct iavf_adapter *adapter) | |||
| 620 | 615 | ||
| 621 | 616 | spin_unlock_bh(&adapter->mac_vlan_list_lock); | |
| 622 | 617 | ||
| 623 | - | ret = iavf_send_pf_msg(adapter, VIRTCHNL_OP_ADD_ETH_ADDR, (u8 *)veal, len); | |
| 618 | + | iavf_send_pf_msg(adapter, VIRTCHNL_OP_ADD_ETH_ADDR, (u8 *)veal, len); | |
| 624 | 619 | kfree(veal); | |
| 625 | - | if (ret) { | |
| 626 | - | dev_err(&adapter->pdev->dev, | |
| 627 | - | "Unable to send ADD_ETH_ADDR message to PF, error %d\n", ret); | |
| 628 | - | adapter->current_op = VIRTCHNL_OP_UNKNOWN; | |
| 629 | - | } | |
| 630 | - | ||
| 631 | - | return ret; | |
| 632 | 620 | } | |
| 633 | 621 | ||
| 634 | 622 | /** | |
| @@ -724,8 +712,8 @@ static void iavf_mac_add_ok(struct iavf_adapter *adapter) | |||
| 724 | 712 | * @adapter: adapter structure | |
| 725 | 713 | * | |
| 726 | 714 | * Remove filters from list based on PF response. | |
| 727 | - | */ | |
| 728 | - | void iavf_mac_add_reject(struct iavf_adapter *adapter) | |
| 715 | + | **/ | |
| 716 | + | static void iavf_mac_add_reject(struct iavf_adapter *adapter) | |
| 729 | 717 | { | |
| 730 | 718 | struct net_device *netdev = adapter->netdev; | |
| 731 | 719 | struct iavf_mac_filter *f, *ftmp; | |
| @@ -2376,6 +2364,7 @@ void iavf_virtchnl_completion(struct iavf_adapter *adapter, | |||
| 2376 | 2364 | iavf_mac_add_reject(adapter); | |
| 2377 | 2365 | /* restore administratively set MAC address */ | |
| 2378 | 2366 | ether_addr_copy(adapter->hw.mac.addr, netdev->dev_addr); | |
| 2367 | + | wake_up(&adapter->vc_waitqueue); | |
| 2379 | 2368 | break; | |
| 2380 | 2369 | case VIRTCHNL_OP_DEL_ETH_ADDR: | |
| 2381 | 2370 | dev_err(&adapter->pdev->dev, "Failed to delete MAC filter, error %s\n", | |
| @@ -2566,6 +2555,7 @@ void iavf_virtchnl_completion(struct iavf_adapter *adapter, | |||
| 2566 | 2555 | eth_hw_addr_set(netdev, adapter->hw.mac.addr); | |
| 2567 | 2556 | netif_addr_unlock_bh(netdev); | |
| 2568 | 2557 | } | |
| 2558 | + | wake_up(&adapter->vc_waitqueue); | |
| 2569 | 2559 | break; | |
| 2570 | 2560 | case VIRTCHNL_OP_GET_STATS: { | |
| 2571 | 2561 | struct iavf_eth_stats *stats = | |
| @@ -2960,72 +2950,3 @@ void iavf_virtchnl_completion(struct iavf_adapter *adapter, | |||
| 2960 | 2950 | } /* switch v_opcode */ | |
| 2961 | 2951 | adapter->current_op = VIRTCHNL_OP_UNKNOWN; | |
| 2962 | 2952 | } | |
| 2963 | - | ||
| 2964 | - | /** | |
| 2965 | - | * iavf_poll_virtchnl_response - Poll admin queue for virtchnl response | |
| 2966 | - | * @adapter: adapter structure | |
| 2967 | - | * @event: pre-allocated event buffer to use for polling | |
| 2968 | - | * @condition: callback to check if desired response received | |
| 2969 | - | * @cond_data: context data passed to condition callback | |
| 2970 | - | * @timeout_ms: maximum time to wait in milliseconds | |
| 2971 | - | * | |
| 2972 | - | * Polls the admin queue and processes all incoming virtchnl messages. | |
| 2973 | - | * After processing each valid message, calls the condition callback to check | |
| 2974 | - | * if the expected response has been received. The callback receives the opcode | |
| 2975 | - | * of the processed message to identify which response was received. Continues | |
| 2976 | - | * polling until the callback returns true or timeout expires. | |
| 2977 | - | * | |
| 2978 | - | * Caller must allocate event buffer before sending any messages to PF to avoid | |
| 2979 | - | * state mismatch if allocation fails after message is sent. | |
| 2980 | - | * | |
| 2981 | - | * Caller must hold netdev_lock. This can sleep for up to timeout_ms while | |
| 2982 | - | * polling hardware. | |
| 2983 | - | * | |
| 2984 | - | * Return: 0 on success (condition met), -EAGAIN on timeout, or error code | |
| 2985 | - | */ | |
| 2986 | - | int iavf_poll_virtchnl_response(struct iavf_adapter *adapter, | |
| 2987 | - | struct iavf_arq_event_info *event, | |
| 2988 | - | bool (*condition)(struct iavf_adapter *adapter, | |
| 2989 | - | const void *data, | |
| 2990 | - | enum virtchnl_ops v_op), | |
| 2991 | - | const void *cond_data, | |
| 2992 | - | unsigned int timeout_ms) | |
| 2993 | - | { | |
| 2994 | - | struct iavf_hw *hw = &adapter->hw; | |
| 2995 | - | enum virtchnl_ops received_op; | |
| 2996 | - | unsigned long timeout; | |
| 2997 | - | int ret = -EAGAIN; | |
| 2998 | - | u16 pending = 0; | |
| 2999 | - | u32 v_retval; | |
| 3000 | - | ||
| 3001 | - | netdev_assert_locked(adapter->netdev); | |
| 3002 | - | ||
| 3003 | - | timeout = jiffies + msecs_to_jiffies(timeout_ms); | |
| 3004 | - | do { | |
| 3005 | - | if (!pending) | |
| 3006 | - | usleep_range(50, 75); | |
| 3007 | - | ||
| 3008 | - | if (iavf_clean_arq_element(hw, event, &pending) == IAVF_SUCCESS) { | |
| 3009 | - | received_op = (enum virtchnl_ops)le32_to_cpu(event->desc.cookie_high); | |
| 3010 | - | if (received_op != VIRTCHNL_OP_UNKNOWN) { | |
| 3011 | - | v_retval = le32_to_cpu(event->desc.cookie_low); | |
| 3012 | - | ||
| 3013 | - | iavf_virtchnl_completion(adapter, received_op, | |
| 3014 | - | (enum iavf_status)v_retval, | |
| 3015 | - | event->msg_buf, event->msg_len); | |
| 3016 | - | ||
| 3017 | - | if (condition(adapter, cond_data, received_op)) { | |
| 3018 | - | ret = 0; | |
| 3019 | - | break; | |
| 3020 | - | } | |
| 3021 | - | } | |
| 3022 | - | ||
| 3023 | - | memset(event->msg_buf, 0, IAVF_MAX_AQ_BUF_SIZE); | |
| 3024 | - | ||
| 3025 | - | if (pending) | |
| 3026 | - | continue; | |
| 3027 | - | } | |
| 3028 | - | } while (time_before(jiffies, timeout)); | |
| 3029 | - | ||
| 3030 | - | return ret; | |
| 3031 | - | } | |
modified drivers/net/ethernet/intel/ice/devlink/port.c
| @@ -590,8 +590,8 @@ static void ice_dealloc_dynamic_port(struct ice_dynamic_port *dyn_port) | |||
| 590 | 590 | ||
| 591 | 591 | xa_erase(&pf->sf_nums, devlink_port->attrs.pci_sf.sf); | |
| 592 | 592 | ice_eswitch_detach_sf(pf, dyn_port); | |
| 593 | - | xa_erase(&pf->dyn_ports, dyn_port->vsi->idx); | |
| 594 | 593 | ice_vsi_free(dyn_port->vsi); | |
| 594 | + | xa_erase(&pf->dyn_ports, dyn_port->vsi->idx); | |
| 595 | 595 | kfree(dyn_port); | |
| 596 | 596 | } | |
| 597 | 597 | ||
modified drivers/net/ethernet/intel/ice/ice_eswitch.c
| @@ -95,7 +95,7 @@ ice_eswitch_release_repr(struct ice_pf *pf, struct ice_repr *repr) | |||
| 95 | 95 | return; | |
| 96 | 96 | ||
| 97 | 97 | ice_vsi_update_security(vsi, ice_vsi_ctx_set_antispoof); | |
| 98 | - | dst_release(&repr->dst->dst); | |
| 98 | + | metadata_dst_free(repr->dst); | |
| 99 | 99 | repr->dst = NULL; | |
| 100 | 100 | ice_fltr_add_mac_and_broadcast(vsi, repr->parent_mac, | |
| 101 | 101 | ICE_FWD_TO_VSI); | |
modified drivers/net/ethernet/intel/ice/ice_sriov.c
| @@ -1366,20 +1366,6 @@ int ice_set_vf_mac(struct net_device *netdev, int vf_id, u8 *mac) | |||
| 1366 | 1366 | return __ice_set_vf_mac(ice_netdev_to_pf(netdev), vf_id, mac); | |
| 1367 | 1367 | } | |
| 1368 | 1368 | ||
| 1369 | - | /** | |
| 1370 | - | * ice_setup_vf_trust - Enable/disable VF trust mode without reset | |
| 1371 | - | * @vf: VF to configure | |
| 1372 | - | * @setting: trust setting | |
| 1373 | - | * | |
| 1374 | - | * Update VF flags when changing trust without performing a VF reset. | |
| 1375 | - | * This is only called when it's safe to skip the reset (VF has no advanced | |
| 1376 | - | * features configured that need cleanup). | |
| 1377 | - | */ | |
| 1378 | - | static void ice_setup_vf_trust(struct ice_vf *vf, bool setting) | |
| 1379 | - | { | |
| 1380 | - | assign_bit(ICE_VIRTCHNL_VF_CAP_PRIVILEGE, &vf->vf_caps, setting); | |
| 1381 | - | } | |
| 1382 | - | ||
| 1383 | 1369 | /** | |
| 1384 | 1370 | * ice_set_vf_trust | |
| 1385 | 1371 | * @netdev: network interface device structure | |
| @@ -1415,19 +1401,11 @@ int ice_set_vf_trust(struct net_device *netdev, int vf_id, bool trusted) | |||
| 1415 | 1401 | ||
| 1416 | 1402 | mutex_lock(&vf->cfg_lock); | |
| 1417 | 1403 | ||
| 1418 | - | /* Reset only if revoking trust and VF has advanced features configured */ | |
| 1419 | - | if (!trusted && | |
| 1420 | - | (vf->num_mac_lldp > 0 || | |
| 1421 | - | test_bit(ICE_VF_STATE_UC_PROMISC, vf->vf_states) || | |
| 1422 | - | test_bit(ICE_VF_STATE_MC_PROMISC, vf->vf_states))) { | |
| 1423 | - | while (vf->num_mac_lldp) | |
| 1424 | - | ice_vf_update_mac_lldp_num(vf, ice_get_vf_vsi(vf), false); | |
| 1425 | - | vf->trusted = trusted; | |
| 1426 | - | ice_reset_vf(vf, ICE_VF_RESET_NOTIFY); | |
| 1427 | - | } else { | |
| 1428 | - | vf->trusted = trusted; | |
| 1429 | - | ice_setup_vf_trust(vf, trusted); | |
| 1430 | - | } | |
| 1404 | + | while (!trusted && vf->num_mac_lldp) | |
| 1405 | + | ice_vf_update_mac_lldp_num(vf, ice_get_vf_vsi(vf), false); | |
| 1406 | + | ||
| 1407 | + | vf->trusted = trusted; | |
| 1408 | + | ice_reset_vf(vf, ICE_VF_RESET_NOTIFY); | |
| 1431 | 1409 | dev_info(ice_pf_to_dev(pf), "VF %u is now %strusted\n", | |
| 1432 | 1410 | vf_id, trusted ? "" : "un"); | |
| 1433 | 1411 | ||
modified drivers/net/ethernet/intel/ice/ice_txrx.c
| @@ -1561,10 +1561,10 @@ ice_tx_map(struct ice_tx_ring *tx_ring, struct ice_tx_buf *first, | |||
| 1561 | 1561 | } | |
| 1562 | 1562 | } | |
| 1563 | 1563 | tstamp_ring->next_to_use = j; | |
| 1564 | - | writel(j, tstamp_ring->tail); | |
| 1564 | + | writel_relaxed(j, tstamp_ring->tail); | |
| 1565 | 1565 | } else { | |
| 1566 | 1566 | ring_kick: | |
| 1567 | - | writel(i, tx_ring->tail); | |
| 1567 | + | writel_relaxed(i, tx_ring->tail); | |
| 1568 | 1568 | } | |
| 1569 | 1569 | return; | |
| 1570 | 1570 | ||
modified drivers/net/ethernet/marvell/mvneta.c
| @@ -2340,7 +2340,7 @@ mvneta_swbm_rx_frame(struct mvneta_port *pp, | |||
| 2340 | 2340 | ||
| 2341 | 2341 | /* Prefetch header */ | |
| 2342 | 2342 | prefetch(data); | |
| 2343 | - | xdp_reinit_buff(xdp); | |
| 2343 | + | xdp_buff_clear_frags_flag(xdp); | |
| 2344 | 2344 | xdp_prepare_buff(xdp, data, pp->rx_offset_correction + MVNETA_MH_SIZE, | |
| 2345 | 2345 | data_len, true); | |
| 2346 | 2346 | } | |
modified drivers/net/ethernet/marvell/octeontx2/af/mcs.c
| @@ -314,7 +314,7 @@ int mcs_clear_all_stats(struct mcs *mcs, u16 pcifunc, int dir) | |||
| 314 | 314 | } | |
| 315 | 315 | ||
| 316 | 316 | /* Clear SC stats */ | |
| 317 | - | for (id = 0; id < map->sc.max; id++) { | |
| 317 | + | for (id = 0; id < map->secy.max; id++) { | |
| 318 | 318 | if (map->sc2pf_map[id] != pcifunc) | |
| 319 | 319 | continue; | |
| 320 | 320 | mcs_clear_stats(mcs, MCS_SC_STATS, id, dir); | |
| @@ -738,7 +738,7 @@ int mcs_free_all_rsrc(struct mcs *mcs, int dir, u16 pcifunc) | |||
| 738 | 738 | } | |
| 739 | 739 | ||
| 740 | 740 | /* free sc entries */ | |
| 741 | - | for (id = 0; id < map->sc.max; id++) { | |
| 741 | + | for (id = 0; id < map->secy.max; id++) { | |
| 742 | 742 | if (map->sc2pf_map[id] != pcifunc) | |
| 743 | 743 | continue; | |
| 744 | 744 | mcs_free_rsrc(&map->sc, map->sc2pf_map, id, pcifunc); | |
modified drivers/net/ethernet/marvell/octeontx2/nic/cn20k.c
| @@ -242,6 +242,15 @@ int cn20k_register_pfvf_mbox_intr(struct otx2_nic *pf, int numvfs) | |||
| 242 | 242 | ||
| 243 | 243 | #define RQ_BP_LVL_AURA (255 - ((85 * 256) / 100)) /* BP when 85% is full */ | |
| 244 | 244 | ||
| 245 | + | static u8 cn20k_aura_bpid_idx(struct otx2_nic *pfvf, int aura_id) | |
| 246 | + | { | |
| 247 | + | #ifdef CONFIG_DCB | |
| 248 | + | return pfvf->queue_to_pfc_map[aura_id]; | |
| 249 | + | #else | |
| 250 | + | return 0; | |
| 251 | + | #endif | |
| 252 | + | } | |
| 253 | + | ||
| 245 | 254 | static int cn20k_tc_get_entry_index(struct otx2_flow_config *flow_cfg, | |
| 246 | 255 | struct otx2_tc_flow *node) | |
| 247 | 256 | { | |
| @@ -571,7 +580,7 @@ static int cn20k_aura_aq_init(struct otx2_nic *pfvf, int aura_id, | |||
| 571 | 580 | if (pfvf->nix_blkaddr == BLKADDR_NIX1) | |
| 572 | 581 | aq->aura.bp_ena = 1; | |
| 573 | 582 | ||
| 574 | - | bpid_idx = otx2_get_bpid_idx(pfvf, aura_id); | |
| 583 | + | bpid_idx = cn20k_aura_bpid_idx(pfvf, aura_id); | |
| 575 | 584 | aq->aura.bpid = pfvf->bpid[bpid_idx]; | |
| 576 | 585 | ||
| 577 | 586 | /* Set backpressure level for RQ's Aura */ | |
modified drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
| @@ -394,7 +394,7 @@ int otx2_rss_init(struct otx2_nic *pfvf) | |||
| 394 | 394 | struct otx2_rss_info *rss = &pfvf->hw.rss_info; | |
| 395 | 395 | int idx, ret = 0; | |
| 396 | 396 | ||
| 397 | - | rss->rss_size = ARRAY_SIZE(rss->ind_tbl); | |
| 397 | + | rss->rss_size = sizeof(*rss->ind_tbl); | |
| 398 | 398 | ||
| 399 | 399 | /* Init RSS key if it is not setup already */ | |
| 400 | 400 | if (!rss->enable) | |
| @@ -1055,7 +1055,6 @@ int otx2_cq_init(struct otx2_nic *pfvf, u16 qidx) | |||
| 1055 | 1055 | struct nix_aq_enq_req *aq; | |
| 1056 | 1056 | struct otx2_cq_queue *cq; | |
| 1057 | 1057 | struct otx2_pool *pool; | |
| 1058 | - | u8 bpid_idx; | |
| 1059 | 1058 | ||
| 1060 | 1059 | cq = &qset->cq[qidx]; | |
| 1061 | 1060 | cq->cq_idx = qidx; | |
| @@ -1133,8 +1132,11 @@ int otx2_cq_init(struct otx2_nic *pfvf, u16 qidx) | |||
| 1133 | 1132 | if (!is_otx2_lbkvf(pfvf->pdev)) { | |
| 1134 | 1133 | /* Enable receive CQ backpressure */ | |
| 1135 | 1134 | aq->cq.bp_ena = 1; | |
| 1136 | - | bpid_idx = otx2_get_bpid_idx(pfvf, qidx); | |
| 1137 | - | aq->cq.bpid = pfvf->bpid[bpid_idx]; | |
| 1135 | + | #ifdef CONFIG_DCB | |
| 1136 | + | aq->cq.bpid = pfvf->bpid[pfvf->queue_to_pfc_map[qidx]]; | |
| 1137 | + | #else | |
| 1138 | + | aq->cq.bpid = pfvf->bpid[0]; | |
| 1139 | + | #endif | |
| 1138 | 1140 | ||
| 1139 | 1141 | /* Set backpressure level is same as cq pass level */ | |
| 1140 | 1142 | aq->cq.bp = RQ_PASS_LVL_CQ(pfvf->hw.rq_skid, qset->rqe_cnt); | |
| @@ -1376,7 +1378,6 @@ int otx2_aura_aq_init(struct otx2_nic *pfvf, int aura_id, | |||
| 1376 | 1378 | { | |
| 1377 | 1379 | struct npa_aq_enq_req *aq; | |
| 1378 | 1380 | struct otx2_pool *pool; | |
| 1379 | - | u8 bpid_idx; | |
| 1380 | 1381 | int err; | |
| 1381 | 1382 | ||
| 1382 | 1383 | pool = &pfvf->qset.pool[pool_id]; | |
| @@ -1432,8 +1433,11 @@ int otx2_aura_aq_init(struct otx2_nic *pfvf, int aura_id, | |||
| 1432 | 1433 | */ | |
| 1433 | 1434 | if (pfvf->nix_blkaddr == BLKADDR_NIX1) | |
| 1434 | 1435 | aq->aura.bp_ena = 1; | |
| 1435 | - | bpid_idx = otx2_get_bpid_idx(pfvf, aura_id); | |
| 1436 | - | aq->aura.nix0_bpid = pfvf->bpid[bpid_idx]; | |
| 1436 | + | #ifdef CONFIG_DCB | |
| 1437 | + | aq->aura.nix0_bpid = pfvf->bpid[pfvf->queue_to_pfc_map[aura_id]]; | |
| 1438 | + | #else | |
| 1439 | + | aq->aura.nix0_bpid = pfvf->bpid[0]; | |
| 1440 | + | #endif | |
| 1437 | 1441 | ||
| 1438 | 1442 | /* Set backpressure level for RQ's Aura */ | |
| 1439 | 1443 | aq->aura.bp = RQ_BP_LVL_AURA; | |
modified drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h
| @@ -1029,15 +1029,6 @@ static inline int otx2_tc_flower_rule_cnt(struct otx2_nic *pfvf) | |||
| 1029 | 1029 | return pfvf->flow_cfg->nr_flows; | |
| 1030 | 1030 | } | |
| 1031 | 1031 | ||
| 1032 | - | static inline u8 otx2_get_bpid_idx(struct otx2_nic *pfvf, int qidx) | |
| 1033 | - | { | |
| 1034 | - | #ifdef CONFIG_DCB | |
| 1035 | - | if (pfvf->queue_to_pfc_map) | |
| 1036 | - | return pfvf->queue_to_pfc_map[qidx]; | |
| 1037 | - | #endif | |
| 1038 | - | return 0; | |
| 1039 | - | } | |
| 1040 | - | ||
| 1041 | 1032 | /* MSI-X APIs */ | |
| 1042 | 1033 | void otx2_free_cints(struct otx2_nic *pfvf, int n); | |
| 1043 | 1034 | void otx2_set_cints_affinity(struct otx2_nic *pfvf); | |
modified drivers/net/ethernet/mediatek/mtk_eth_soc.c
| @@ -5341,22 +5341,6 @@ static int mtk_probe(struct platform_device *pdev) | |||
| 5341 | 5341 | } | |
| 5342 | 5342 | } | |
| 5343 | 5343 | ||
| 5344 | - | /* we run 2 devices on the same DMA ring so we need a dummy device | |
| 5345 | - | * for NAPI to work. Allocate it before registering the netdevs so a | |
| 5346 | - | * concurrent ndo_open (e.g. netifd bringing the first netdev up the | |
| 5347 | - | * instant it is registered) never observes eth->dummy_dev == NULL in | |
| 5348 | - | * mtk_dma_init() -> mtk_rx_alloc() -> __xdp_rxq_info_reg() (net/core/xdp.c | |
| 5349 | - | * "Missing net_device from driver") and fails the first open. | |
| 5350 | - | */ | |
| 5351 | - | eth->dummy_dev = alloc_netdev_dummy(0); | |
| 5352 | - | if (!eth->dummy_dev) { | |
| 5353 | - | err = -ENOMEM; | |
| 5354 | - | dev_err(eth->dev, "failed to allocated dummy device\n"); | |
| 5355 | - | goto err_unreg_netdev; | |
| 5356 | - | } | |
| 5357 | - | netif_napi_add(eth->dummy_dev, ð->tx_napi, mtk_napi_tx); | |
| 5358 | - | netif_napi_add(eth->dummy_dev, ð->rx_napi, mtk_napi_rx); | |
| 5359 | - | ||
| 5360 | 5344 | for (i = 0; i < MTK_MAX_DEVS; i++) { | |
| 5361 | 5345 | if (!eth->netdev[i]) | |
| 5362 | 5346 | continue; | |
| @@ -5371,6 +5355,18 @@ static int mtk_probe(struct platform_device *pdev) | |||
| 5371 | 5355 | eth->netdev[i]->base_addr, eth->irq[MTK_FE_IRQ_SHARED]); | |
| 5372 | 5356 | } | |
| 5373 | 5357 | ||
| 5358 | + | /* we run 2 devices on the same DMA ring so we need a dummy device | |
| 5359 | + | * for NAPI to work | |
| 5360 | + | */ | |
| 5361 | + | eth->dummy_dev = alloc_netdev_dummy(0); | |
| 5362 | + | if (!eth->dummy_dev) { | |
| 5363 | + | err = -ENOMEM; | |
| 5364 | + | dev_err(eth->dev, "failed to allocated dummy device\n"); | |
| 5365 | + | goto err_unreg_netdev; | |
| 5366 | + | } | |
| 5367 | + | netif_napi_add(eth->dummy_dev, ð->tx_napi, mtk_napi_tx); | |
| 5368 | + | netif_napi_add(eth->dummy_dev, ð->rx_napi, mtk_napi_rx); | |
| 5369 | + | ||
| 5374 | 5370 | platform_set_drvdata(pdev, eth); | |
| 5375 | 5371 | schedule_delayed_work(ð->reset.monitor_work, | |
| 5376 | 5372 | MTK_DMA_MONITOR_TIMEOUT); | |
| @@ -5380,16 +5376,6 @@ static int mtk_probe(struct platform_device *pdev) | |||
| 5380 | 5376 | err_unreg_netdev: | |
| 5381 | 5377 | mtk_unreg_dev(eth); | |
| 5382 | 5378 | err_deinit_ppe: | |
| 5383 | - | /* A netdev opened while probe was still registering can have queued | |
| 5384 | - | * the frame-engine reset worker, which takes rtnl and drives the | |
| 5385 | - | * hardware; cancel it before anything below is torn down. | |
| 5386 | - | */ | |
| 5387 | - | cancel_work_sync(ð->pending_work); | |
| 5388 | - | if (eth->dummy_dev) { | |
| 5389 | - | netif_napi_del(ð->tx_napi); | |
| 5390 | - | netif_napi_del(ð->rx_napi); | |
| 5391 | - | free_netdev(eth->dummy_dev); | |
| 5392 | - | } | |
| 5393 | 5379 | mtk_ppe_deinit(eth); | |
| 5394 | 5380 | mtk_mdio_cleanup(eth); | |
| 5395 | 5381 | err_free_dev: | |
modified drivers/net/ethernet/mellanox/mlx5/core/en/xdp.c
| @@ -293,9 +293,6 @@ static u64 mlx5e_xsk_fill_timestamp(void *_priv) | |||
| 293 | 293 | struct mlx5e_xsk_tx_complete *priv = _priv; | |
| 294 | 294 | u64 ts; | |
| 295 | 295 | ||
| 296 | - | if (!priv->cqe) | |
| 297 | - | return 0; | |
| 298 | - | ||
| 299 | 296 | ts = get_cqe_ts(priv->cqe); | |
| 300 | 297 | ||
| 301 | 298 | if (mlx5_is_real_time_rq(priv->cq->mdev) || mlx5_is_real_time_sq(priv->cq->mdev)) | |
modified drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
| @@ -908,12 +908,10 @@ int mlx5e_poll_ico_cq(struct mlx5e_cq *cq) | |||
| 908 | 908 | } while (!last_wqe); | |
| 909 | 909 | } while ((++i < MLX5E_TX_CQ_POLL_BUDGET) && (cqe = mlx5_cqwq_get_cqe(&cq->wq))); | |
| 910 | 910 | ||
| 911 | - | mlx5_cqwq_update_db_record(&cq->wq); | |
| 911 | + | sq->cc = sqcc; | |
| 912 | 912 | ||
| 913 | - | /* ensure cq space is freed before enabling more cqes */ | |
| 914 | - | dma_wmb(); | |
| 913 | + | mlx5_cqwq_update_db_record(&cq->wq); | |
| 915 | 914 | ||
| 916 | - | sq->cc = sqcc; | |
| 917 | 915 | return i; | |
| 918 | 916 | } | |
| 919 | 917 | ||
modified drivers/net/ethernet/mellanox/mlx5/core/esw/adj_vport.c
| @@ -11,6 +11,26 @@ int mlx5_esw_adj_vport_modify(struct mlx5_core_dev *dev, u16 vport, | |||
| 11 | 11 | ||
| 12 | 12 | lockdep_assert_held(&dev->priv.eswitch->state_lock); | |
| 13 | 13 | ||
| 14 | + | if (MLX5_CAP_ESW(dev, esw_vport_state_max_tx_speed)) { | |
| 15 | + | u8 op_mod = MLX5_VPORT_STATE_OP_MOD_ESW_VPORT; | |
| 16 | + | struct mlx5_vport *esw_vport; | |
| 17 | + | u32 speed = 0; | |
| 18 | + | int err; | |
| 19 | + | ||
| 20 | + | err = mlx5_query_vport_max_tx_speed(dev, op_mod, vport, | |
| 21 | + | true, &speed, NULL); | |
| 22 | + | if (err) { | |
| 23 | + | esw_vport = mlx5_eswitch_get_vport(dev->priv.eswitch, | |
| 24 | + | vport); | |
| 25 | + | speed = IS_ERR(esw_vport) ? 0 : | |
| 26 | + | esw_vport->agg_max_tx_speed; | |
| 27 | + | mlx5_core_dbg(dev, | |
| 28 | + | "Failed to query vport %d max tx speed, err=%d, using cached %u\n", | |
| 29 | + | vport, err, speed); | |
| 30 | + | } | |
| 31 | + | MLX5_SET(modify_vport_state_in, in, max_tx_speed, speed); | |
| 32 | + | } | |
| 33 | + | ||
| 14 | 34 | MLX5_SET(modify_vport_state_in, in, opcode, | |
| 15 | 35 | MLX5_CMD_OP_MODIFY_VPORT_STATE); | |
| 16 | 36 | MLX5_SET(modify_vport_state_in, in, op_mod, | |
modified drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c
| @@ -1432,40 +1432,30 @@ static bool mlx5_lag_should_disable_lag(struct mlx5_lag *ldev, bool do_bond) | |||
| 1432 | 1432 | } | |
| 1433 | 1433 | ||
| 1434 | 1434 | #ifdef CONFIG_MLX5_ESWITCH | |
| 1435 | - | static int mlx5_lag_get_devices_oper_speed(struct mlx5_lag *ldev, | |
| 1436 | - | u32 *sum_speed) | |
| 1435 | + | static int | |
| 1436 | + | mlx5_lag_sum_devices_speed(struct mlx5_lag *ldev, u32 *sum_speed, | |
| 1437 | + | int (*get_speed)(struct mlx5_core_dev *, u32 *)) | |
| 1437 | 1438 | { | |
| 1439 | + | struct mlx5_core_dev *pf_mdev; | |
| 1440 | + | struct lag_func *pf; | |
| 1438 | 1441 | int pf_idx; | |
| 1442 | + | u32 speed; | |
| 1443 | + | int ret; | |
| 1439 | 1444 | ||
| 1440 | 1445 | *sum_speed = 0; | |
| 1441 | 1446 | mlx5_ldev_for_each(pf_idx, 0, ldev) { | |
| 1442 | - | u8 opmod = MLX5_VPORT_STATE_OP_MOD_VNIC_VPORT; | |
| 1443 | - | struct mlx5_core_dev *pf_mdev; | |
| 1444 | - | struct lag_func *pf; | |
| 1445 | - | u32 speed; | |
| 1446 | - | u8 state; | |
| 1447 | - | int ret; | |
| 1448 | - | ||
| 1449 | 1447 | pf = mlx5_lag_pf(ldev, pf_idx); | |
| 1450 | 1448 | if (!pf) | |
| 1451 | 1449 | continue; | |
| 1452 | 1450 | pf_mdev = pf->dev; | |
| 1453 | 1451 | if (!pf_mdev) | |
| 1454 | 1452 | continue; | |
| 1455 | - | ret = mlx5_query_vport_max_tx_speed(pf_mdev, opmod, 0, 0, | |
| 1456 | - | &speed, &state); | |
| 1457 | - | if (ret) { | |
| 1458 | - | mlx5_core_dbg(pf_mdev, "State query failed (err=%d)\n", | |
| 1459 | - | ret); | |
| 1460 | - | return ret; | |
| 1461 | - | } | |
| 1462 | - | if (state != VPORT_STATE_UP) | |
| 1463 | - | continue; | |
| 1464 | 1453 | ||
| 1465 | - | ret = mlx5_port_oper_linkspeed(pf_mdev, &speed); | |
| 1454 | + | ret = get_speed(pf_mdev, &speed); | |
| 1466 | 1455 | if (ret) { | |
| 1467 | 1456 | mlx5_core_dbg(pf_mdev, | |
| 1468 | - | "Failed to get oper speed (err=%d)\n", | |
| 1457 | + | "Failed to get device speed using %ps. Device %s speed is not available (err=%d)\n", | |
| 1458 | + | get_speed, dev_name(pf_mdev->device), | |
| 1469 | 1459 | ret); | |
| 1470 | 1460 | return ret; | |
| 1471 | 1461 | } | |
| @@ -1476,42 +1466,17 @@ static int mlx5_lag_get_devices_oper_speed(struct mlx5_lag *ldev, | |||
| 1476 | 1466 | return 0; | |
| 1477 | 1467 | } | |
| 1478 | 1468 | ||
| 1479 | - | static int mlx5_lag_get_devices_max_speed(struct mlx5_lag *ldev, u32 *max_speed) | |
| 1469 | + | static int mlx5_lag_sum_devices_max_speed(struct mlx5_lag *ldev, u32 *max_speed) | |
| 1480 | 1470 | { | |
| 1481 | - | bool take_max; | |
| 1482 | - | int pf_idx; | |
| 1483 | - | ||
| 1484 | - | take_max = ldev->tracker.tx_type == NETDEV_LAG_TX_TYPE_ACTIVEBACKUP; | |
| 1485 | - | if (ldev->mode == MLX5_LAG_MODE_MPESW) | |
| 1486 | - | take_max = false; | |
| 1487 | - | ||
| 1488 | - | *max_speed = 0; | |
| 1489 | - | mlx5_ldev_for_each(pf_idx, 0, ldev) { | |
| 1490 | - | struct mlx5_core_dev *pf_mdev; | |
| 1491 | - | struct lag_func *pf; | |
| 1492 | - | u32 speed; | |
| 1493 | - | int ret; | |
| 1494 | - | ||
| 1495 | - | pf = mlx5_lag_pf(ldev, pf_idx); | |
| 1496 | - | if (!pf) | |
| 1497 | - | continue; | |
| 1498 | - | pf_mdev = pf->dev; | |
| 1499 | - | if (!pf_mdev) | |
| 1500 | - | continue; | |
| 1501 | - | ||
| 1502 | - | ret = mlx5_port_max_linkspeed(pf_mdev, &speed); | |
| 1503 | - | if (ret) { | |
| 1504 | - | mlx5_core_dbg(pf_mdev, | |
| 1505 | - | "Failed to get max speed (err=%d)\n", | |
| 1506 | - | ret); | |
| 1507 | - | return ret; | |
| 1508 | - | } | |
| 1509 | - | ||
| 1510 | - | *max_speed = take_max ? | |
| 1511 | - | max(*max_speed, speed) : *max_speed + speed; | |
| 1512 | - | } | |
| 1471 | + | return mlx5_lag_sum_devices_speed(ldev, max_speed, | |
| 1472 | + | mlx5_port_max_linkspeed); | |
| 1473 | + | } | |
| 1513 | 1474 | ||
| 1514 | - | return 0; | |
| 1475 | + | static int mlx5_lag_sum_devices_oper_speed(struct mlx5_lag *ldev, | |
| 1476 | + | u32 *oper_speed) | |
| 1477 | + | { | |
| 1478 | + | return mlx5_lag_sum_devices_speed(ldev, oper_speed, | |
| 1479 | + | mlx5_port_oper_linkspeed); | |
| 1515 | 1480 | } | |
| 1516 | 1481 | ||
| 1517 | 1482 | static void mlx5_lag_modify_device_vports_speed(struct mlx5_core_dev *mdev, | |
| @@ -1560,7 +1525,7 @@ void mlx5_lag_set_vports_agg_speed(struct mlx5_lag *ldev) | |||
| 1560 | 1525 | int pf_idx; | |
| 1561 | 1526 | ||
| 1562 | 1527 | if (ldev->mode == MLX5_LAG_MODE_MPESW) { | |
| 1563 | - | if (mlx5_lag_get_devices_oper_speed(ldev, &speed)) | |
| 1528 | + | if (mlx5_lag_sum_devices_oper_speed(ldev, &speed)) | |
| 1564 | 1529 | return; | |
| 1565 | 1530 | } else { | |
| 1566 | 1531 | speed = ldev->tracker.bond_speed_mbps; | |
| @@ -1568,8 +1533,8 @@ void mlx5_lag_set_vports_agg_speed(struct mlx5_lag *ldev) | |||
| 1568 | 1533 | return; | |
| 1569 | 1534 | } | |
| 1570 | 1535 | ||
| 1571 | - | /* If speed is not set, fall back to the max achievable speed */ | |
| 1572 | - | if (!speed && mlx5_lag_get_devices_max_speed(ldev, &speed)) | |
| 1536 | + | /* If speed is not set, use the sum of max speeds of all PFs */ | |
| 1537 | + | if (!speed && mlx5_lag_sum_devices_max_speed(ldev, &speed)) | |
| 1573 | 1538 | return; | |
| 1574 | 1539 | ||
| 1575 | 1540 | speed = speed / MLX5_MAX_TX_SPEED_UNIT; | |
| @@ -1978,11 +1943,9 @@ static int mlx5_handle_changeupper_event(struct mlx5_lag *ldev, | |||
| 1978 | 1943 | } | |
| 1979 | 1944 | } | |
| 1980 | 1945 | if (i < MLX5_MAX_PORTS) { | |
| 1981 | - | if (netif_is_bond_master(upper)) { | |
| 1982 | - | slave = bond_slave_get_rcu(ndev_tmp); | |
| 1983 | - | if (slave) | |
| 1984 | - | has_inactive |= bond_is_slave_inactive(slave); | |
| 1985 | - | } | |
| 1946 | + | slave = bond_slave_get_rcu(ndev_tmp); | |
| 1947 | + | if (slave) | |
| 1948 | + | has_inactive |= bond_is_slave_inactive(slave); | |
| 1986 | 1949 | bond_status |= (1 << idx); | |
| 1987 | 1950 | } | |
| 1988 | 1951 | ||
| @@ -2066,7 +2029,7 @@ static int mlx5_handle_changeinfodata_event(struct mlx5_lag *ldev, | |||
| 2066 | 2029 | bool has_inactive = 0; | |
| 2067 | 2030 | int idx; | |
| 2068 | 2031 | ||
| 2069 | - | if (!netif_is_bond_master(ndev)) | |
| 2032 | + | if (!netif_is_lag_master(ndev)) | |
| 2070 | 2033 | return 0; | |
| 2071 | 2034 | ||
| 2072 | 2035 | rcu_read_lock(); | |
modified drivers/net/ethernet/mellanox/mlx5/core/vport.c
| @@ -93,6 +93,30 @@ int mlx5_modify_vport_admin_state(struct mlx5_core_dev *mdev, u8 opmod, | |||
| 93 | 93 | lockdep_assert_held(&mdev->priv.eswitch->state_lock); | |
| 94 | 94 | #endif | |
| 95 | 95 | ||
| 96 | + | if (MLX5_CAP_ESW(mdev, esw_vport_state_max_tx_speed) && | |
| 97 | + | opmod == MLX5_VPORT_STATE_OP_MOD_ESW_VPORT && | |
| 98 | + | vport != MLX5_VPORT_UPLINK) { | |
| 99 | + | u32 speed = 0; | |
| 100 | + | int err; | |
| 101 | + | ||
| 102 | + | err = mlx5_query_vport_max_tx_speed(mdev, opmod, vport, | |
| 103 | + | other_vport, &speed, NULL); | |
| 104 | + | if (err) { | |
| 105 | + | #ifdef CONFIG_MLX5_ESWITCH | |
| 106 | + | struct mlx5_vport *esw_vport; | |
| 107 | + | ||
| 108 | + | esw_vport = mlx5_eswitch_get_vport(mdev->priv.eswitch, | |
| 109 | + | vport); | |
| 110 | + | speed = IS_ERR(esw_vport) ? 0 : | |
| 111 | + | esw_vport->agg_max_tx_speed; | |
| 112 | + | #endif | |
| 113 | + | mlx5_core_dbg(mdev, | |
| 114 | + | "Failed to query vport %d max tx speed, err=%d, using cached %u\n", | |
| 115 | + | vport, err, speed); | |
| 116 | + | } | |
| 117 | + | MLX5_SET(modify_vport_state_in, in, max_tx_speed, speed); | |
| 118 | + | } | |
| 119 | + | ||
| 96 | 120 | MLX5_SET(modify_vport_state_in, in, opcode, | |
| 97 | 121 | MLX5_CMD_OP_MODIFY_VPORT_STATE); | |
| 98 | 122 | MLX5_SET(modify_vport_state_in, in, op_mod, opmod); | |
modified drivers/net/ethernet/mellanox/mlxsw/spectrum.h
| @@ -989,8 +989,6 @@ void mlxsw_sp_acl_ruleset_prio_get(struct mlxsw_sp_acl_ruleset *ruleset, | |||
| 989 | 989 | struct mlxsw_sp_acl_rule_info * | |
| 990 | 990 | mlxsw_sp_acl_rulei_create(struct mlxsw_sp_acl *acl, | |
| 991 | 991 | struct mlxsw_afa_block *afa_block); | |
| 992 | - | void mlxsw_sp_acl_rulei_free(struct mlxsw_sp *mlxsw_sp, | |
| 993 | - | const struct mlxsw_sp_acl_rule_info *rulei); | |
| 994 | 992 | void mlxsw_sp_acl_rulei_destroy(struct mlxsw_sp *mlxsw_sp, | |
| 995 | 993 | struct mlxsw_sp_acl_rule_info *rulei); | |
| 996 | 994 | int mlxsw_sp_acl_rulei_commit(struct mlxsw_sp_acl_rule_info *rulei); | |
modified drivers/net/ethernet/mellanox/mlxsw/spectrum_acl.c
| @@ -340,8 +340,8 @@ err_afa_block_create: | |||
| 340 | 340 | return ERR_PTR(err); | |
| 341 | 341 | } | |
| 342 | 342 | ||
| 343 | - | void mlxsw_sp_acl_rulei_free(struct mlxsw_sp *mlxsw_sp, | |
| 344 | - | const struct mlxsw_sp_acl_rule_info *rulei) | |
| 343 | + | void mlxsw_sp_acl_rulei_destroy(struct mlxsw_sp *mlxsw_sp, | |
| 344 | + | struct mlxsw_sp_acl_rule_info *rulei) | |
| 345 | 345 | { | |
| 346 | 346 | if (rulei->action_created) | |
| 347 | 347 | mlxsw_afa_block_destroy(rulei->act_block); | |
| @@ -351,12 +351,6 @@ void mlxsw_sp_acl_rulei_free(struct mlxsw_sp *mlxsw_sp, | |||
| 351 | 351 | if (rulei->dst_port_range_reg_valid) | |
| 352 | 352 | mlxsw_sp_port_range_reg_put(mlxsw_sp, | |
| 353 | 353 | rulei->dst_port_range_reg_index); | |
| 354 | - | } | |
| 355 | - | ||
| 356 | - | void mlxsw_sp_acl_rulei_destroy(struct mlxsw_sp *mlxsw_sp, | |
| 357 | - | struct mlxsw_sp_acl_rule_info *rulei) | |
| 358 | - | { | |
| 359 | - | mlxsw_sp_acl_rulei_free(mlxsw_sp, rulei); | |
| 360 | 354 | kfree(rulei); | |
| 361 | 355 | } | |
| 362 | 356 | ||
modified drivers/net/ethernet/mellanox/mlxsw/spectrum_flower.c
| @@ -862,19 +862,14 @@ int mlxsw_sp_flower_tmplt_create(struct mlxsw_sp *mlxsw_sp, | |||
| 862 | 862 | memset(&rulei, 0, sizeof(rulei)); | |
| 863 | 863 | err = mlxsw_sp_flower_parse(mlxsw_sp, block, &rulei, f); | |
| 864 | 864 | if (err) | |
| 865 | - | goto out; | |
| 866 | - | ||
| 865 | + | return err; | |
| 867 | 866 | ruleset = mlxsw_sp_acl_ruleset_get(mlxsw_sp, block, | |
| 868 | 867 | f->common.chain_index, | |
| 869 | 868 | MLXSW_SP_ACL_PROFILE_FLOWER, | |
| 870 | 869 | &rulei.values.elusage); | |
| 871 | - | err = PTR_ERR_OR_ZERO(ruleset); | |
| 872 | - | ||
| 873 | - | out: | |
| 874 | - | mlxsw_sp_acl_rulei_free(mlxsw_sp, &rulei); | |
| 875 | 870 | ||
| 876 | 871 | /* keep the reference to the ruleset */ | |
| 877 | - | return err; | |
| 872 | + | return PTR_ERR_OR_ZERO(ruleset); | |
| 878 | 873 | } | |
| 879 | 874 | ||
| 880 | 875 | void mlxsw_sp_flower_tmplt_destroy(struct mlxsw_sp *mlxsw_sp, | |
modified drivers/net/ethernet/microchip/sparx5/sparx5_main.c
| @@ -898,7 +898,6 @@ static int mchp_sparx5_probe(struct platform_device *pdev) | |||
| 898 | 898 | dev_info(sparx5->dev, "MAC addr was not set, use random MAC\n"); | |
| 899 | 899 | eth_random_addr(sparx5->base_mac); | |
| 900 | 900 | sparx5->base_mac[5] = 0; | |
| 901 | - | sparx5->base_mac_assign_type = NET_ADDR_RANDOM; | |
| 902 | 901 | } | |
| 903 | 902 | ||
| 904 | 903 | sparx5->fdma_irq = platform_get_irq_byname(sparx5->pdev, "fdma"); | |
modified drivers/net/ethernet/microchip/sparx5/sparx5_main.h
| @@ -392,7 +392,6 @@ struct sparx5 { | |||
| 392 | 392 | struct notifier_block switchdev_blocking_nb; | |
| 393 | 393 | /* Switch state */ | |
| 394 | 394 | u8 base_mac[ETH_ALEN]; | |
| 395 | - | u8 base_mac_assign_type; | |
| 396 | 395 | /* Associated bridge device (when bridged) */ | |
| 397 | 396 | struct net_device *hw_bridge_dev; | |
| 398 | 397 | /* Bridged interfaces */ | |
modified drivers/net/ethernet/microchip/sparx5/sparx5_netdev.c
| @@ -294,7 +294,6 @@ struct net_device *sparx5_create_netdev(struct sparx5 *sparx5, u32 portno) | |||
| 294 | 294 | ndev->ethtool_ops = &sparx5_ethtool_ops; | |
| 295 | 295 | ||
| 296 | 296 | eth_hw_addr_gen(ndev, sparx5->base_mac, portno + 1); | |
| 297 | - | ndev->addr_assign_type = sparx5->base_mac_assign_type; | |
| 298 | 297 | ||
| 299 | 298 | return ndev; | |
| 300 | 299 | } | |
modified drivers/net/ethernet/microchip/sparx5/sparx5_ptp.c
| @@ -622,9 +622,18 @@ int sparx5_ptp_init(struct sparx5 *sparx5) | |||
| 622 | 622 | sparx5->ptp = 1; | |
| 623 | 623 | } | |
| 624 | 624 | ||
| 625 | - | /* The base, non-PTP-capable lan969x variants need the | |
| 626 | - | * first TOD counter running to forward frames. | |
| 627 | - | */ | |
| 625 | + | if (!sparx5->ptp) | |
| 626 | + | return 0; | |
| 627 | + | ||
| 628 | + | for (i = 0; i < SPARX5_PHC_COUNT; ++i) { | |
| 629 | + | err = sparx5_ptp_phc_init(sparx5, i, &sparx5_ptp_clock_info); | |
| 630 | + | if (err) | |
| 631 | + | return err; | |
| 632 | + | } | |
| 633 | + | ||
| 634 | + | spin_lock_init(&sparx5->ptp_clock_lock); | |
| 635 | + | spin_lock_init(&sparx5->ptp_ts_id_lock); | |
| 636 | + | mutex_init(&sparx5->ptp_lock); | |
| 628 | 637 | ||
| 629 | 638 | /* Disable master counters */ | |
| 630 | 639 | spx5_wr(PTP_PTP_DOM_CFG_PTP_ENA_SET(0), sparx5, PTP_PTP_DOM_CFG); | |
| @@ -648,19 +657,6 @@ int sparx5_ptp_init(struct sparx5 *sparx5) | |||
| 648 | 657 | /* Enable master counters */ | |
| 649 | 658 | spx5_wr(PTP_PTP_DOM_CFG_PTP_ENA_SET(0x7), sparx5, PTP_PTP_DOM_CFG); | |
| 650 | 659 | ||
| 651 | - | if (!sparx5->ptp) | |
| 652 | - | return 0; | |
| 653 | - | ||
| 654 | - | for (i = 0; i < SPARX5_PHC_COUNT; ++i) { | |
| 655 | - | err = sparx5_ptp_phc_init(sparx5, i, &sparx5_ptp_clock_info); | |
| 656 | - | if (err) | |
| 657 | - | return err; | |
| 658 | - | } | |
| 659 | - | ||
| 660 | - | spin_lock_init(&sparx5->ptp_clock_lock); | |
| 661 | - | spin_lock_init(&sparx5->ptp_ts_id_lock); | |
| 662 | - | mutex_init(&sparx5->ptp_lock); | |
| 663 | - | ||
| 664 | 660 | for (i = 0; i < sparx5->data->consts->n_ports; i++) { | |
| 665 | 661 | port = sparx5->ports[i]; | |
| 666 | 662 | if (!port) | |
| @@ -677,9 +673,6 @@ void sparx5_ptp_deinit(struct sparx5 *sparx5) | |||
| 677 | 673 | struct sparx5_port *port; | |
| 678 | 674 | int i; | |
| 679 | 675 | ||
| 680 | - | if (!sparx5->ptp) | |
| 681 | - | return; | |
| 682 | - | ||
| 683 | 676 | if (sparx5->ptp_irq >= 0) { | |
| 684 | 677 | disable_irq(sparx5->ptp_irq); | |
| 685 | 678 | sparx5->ptp_irq = -ENXIO; | |
modified drivers/net/ethernet/microchip/sparx5/sparx5_tc_matchall.c
| @@ -160,7 +160,6 @@ static int sparx5_tc_matchall_destroy(struct net_device *ndev, | |||
| 160 | 160 | } | |
| 161 | 161 | ||
| 162 | 162 | list_del(&entry->list); | |
| 163 | - | kfree(entry); | |
| 164 | 163 | ||
| 165 | 164 | return err; | |
| 166 | 165 | } | |
modified drivers/net/ethernet/microchip/vcap/vcap_api.c
| @@ -3527,8 +3527,8 @@ int vcap_filter_rule_keys(struct vcap_rule *rule, | |||
| 3527 | 3527 | if (key == keylist[idx]) { | |
| 3528 | 3528 | list_del(&ckf->ctrl.list); | |
| 3529 | 3529 | kfree(ckf); | |
| 3530 | + | idx++; | |
| 3530 | 3531 | err = 0; | |
| 3531 | - | break; | |
| 3532 | 3532 | } | |
| 3533 | 3533 | } | |
| 3534 | 3534 | } | |
modified drivers/net/ethernet/microsoft/mana/mana_bpf.c
| @@ -91,7 +91,7 @@ u32 mana_run_xdp(struct net_device *ndev, struct mana_rxq *rxq, | |||
| 91 | 91 | goto out; | |
| 92 | 92 | ||
| 93 | 93 | xdp_init_buff(xdp, PAGE_SIZE, &rxq->xdp_rxq); | |
| 94 | - | xdp_prepare_buff(xdp, buf_va, rxq->headroom, pkt_len, true); | |
| 94 | + | xdp_prepare_buff(xdp, buf_va, XDP_PACKET_HEADROOM, pkt_len, true); | |
| 95 | 95 | ||
| 96 | 96 | act = bpf_prog_run_xdp(prog, xdp); | |
| 97 | 97 | ||
| @@ -183,9 +183,9 @@ static int mana_xdp_set(struct net_device *ndev, struct bpf_prog *prog, | |||
| 183 | 183 | if (!old_prog && !prog) | |
| 184 | 184 | return 0; | |
| 185 | 185 | ||
| 186 | - | if (prog && ndev->mtu > MANA_XDP_MTU_MAX(ndev)) { | |
| 186 | + | if (prog && ndev->mtu > MANA_XDP_MTU_MAX) { | |
| 187 | 187 | netdev_err(ndev, "XDP: mtu:%u too large, mtu_max:%lu\n", | |
| 188 | - | ndev->mtu, MANA_XDP_MTU_MAX(ndev)); | |
| 188 | + | ndev->mtu, MANA_XDP_MTU_MAX); | |
| 189 | 189 | NL_SET_ERR_MSG_MOD(extack, "XDP: mtu too large"); | |
| 190 | 190 | ||
| 191 | 191 | return -EOPNOTSUPP; | |
| @@ -238,7 +238,7 @@ static int mana_xdp_set(struct net_device *ndev, struct bpf_prog *prog, | |||
| 238 | 238 | bpf_prog_put(old_prog); | |
| 239 | 239 | ||
| 240 | 240 | if (prog) | |
| 241 | - | ndev->max_mtu = min_t(unsigned int, MANA_XDP_MTU_MAX(ndev), | |
| 241 | + | ndev->max_mtu = min_t(unsigned int, MANA_XDP_MTU_MAX, | |
| 242 | 242 | gc->adapter_mtu - ETH_HLEN); | |
| 243 | 243 | else | |
| 244 | 244 | ndev->max_mtu = gc->adapter_mtu - ETH_HLEN; | |
modified drivers/net/ethernet/microsoft/mana/mana_en.c
| @@ -758,44 +758,6 @@ static void *mana_get_rxbuf_pre(struct mana_rxq *rxq, dma_addr_t *da) | |||
| 758 | 758 | return va; | |
| 759 | 759 | } | |
| 760 | 760 | ||
| 761 | - | /* Reserve enough headroom to satisfy the skb_cow() in ip_forward() and avoid | |
| 762 | - | * reallocation: the TX path keeps the SGE DMA mappings in struct mana_skb_head | |
| 763 | - | * at skb->head, so the port advertises ndev->needed_headroom = MANA_HEADROOM. | |
| 764 | - | */ | |
| 765 | - | static u32 mana_get_rxbuf_headroom(struct mana_port_context *apc) | |
| 766 | - | { | |
| 767 | - | if (mana_xdp_get(apc)) | |
| 768 | - | return mana_xdp_headroom(apc->ndev); | |
| 769 | - | ||
| 770 | - | return LL_RESERVED_SPACE(apc->ndev); | |
| 771 | - | } | |
| 772 | - | ||
| 773 | - | static u32 mana_get_rxbuf_size(struct mana_port_context *apc, u32 mtu) | |
| 774 | - | { | |
| 775 | - | u32 len = SKB_DATA_ALIGN(mtu + MANA_RXBUF_PAD + | |
| 776 | - | mana_get_rxbuf_headroom(apc)); | |
| 777 | - | ||
| 778 | - | return ALIGN(len, MANA_RX_FRAG_ALIGNMENT); | |
| 779 | - | } | |
| 780 | - | ||
| 781 | - | /* Returns true when one RX buffer per page is already required by XDP or by | |
| 782 | - | * the buffer size implied by the MTU, i.e. regardless of the | |
| 783 | - | * MANA_PRIV_FLAG_USE_FULL_PAGE_RXBUF private flag. | |
| 784 | - | */ | |
| 785 | - | bool mana_single_rxbuf_per_page_forced(struct mana_port_context *apc, u32 mtu) | |
| 786 | - | { | |
| 787 | - | /* For xdp make sure only one packet fits per page. */ | |
| 788 | - | if (mana_xdp_get(apc)) | |
| 789 | - | return true; | |
| 790 | - | ||
| 791 | - | /* Only use the page_pool fragment path when at least two buffers, | |
| 792 | - | * including the headroom each of them has to reserve, actually fit | |
| 793 | - | * into one page. Otherwise the fragment path degenerates into one | |
| 794 | - | * buffer per page while still paying the fragment accounting cost. | |
| 795 | - | */ | |
| 796 | - | return PAGE_SIZE / mana_get_rxbuf_size(apc, mtu) < 2; | |
| 797 | - | } | |
| 798 | - | ||
| 799 | 761 | static bool | |
| 800 | 762 | mana_use_single_rxbuf_per_page(struct mana_port_context *apc, u32 mtu) | |
| 801 | 763 | { | |
| @@ -808,27 +770,32 @@ mana_use_single_rxbuf_per_page(struct mana_port_context *apc, u32 mtu) | |||
| 808 | 770 | if (apc->priv_flags & BIT(MANA_PRIV_FLAG_USE_FULL_PAGE_RXBUF)) | |
| 809 | 771 | return true; | |
| 810 | 772 | ||
| 811 | - | return mana_single_rxbuf_per_page_forced(apc, mtu); | |
| 773 | + | /* For xdp and jumbo frames make sure only one packet fits per page. */ | |
| 774 | + | if (mtu + MANA_RXBUF_PAD > PAGE_SIZE / 2 || mana_xdp_get(apc)) | |
| 775 | + | return true; | |
| 776 | + | ||
| 777 | + | return false; | |
| 812 | 778 | } | |
| 813 | 779 | ||
| 814 | - | /* Get RX buffer's data size, alloc size, headroom and frag count based on MTU */ | |
| 780 | + | /* Get RX buffer's data size, alloc size, XDP headroom based on MTU */ | |
| 815 | 781 | static void mana_get_rxbuf_cfg(struct mana_port_context *apc, | |
| 816 | 782 | int mtu, u32 *datasize, u32 *alloc_size, | |
| 817 | 783 | u32 *headroom, u32 *frag_count) | |
| 818 | 784 | { | |
| 819 | - | u32 buf_size; | |
| 785 | + | u32 len, buf_size; | |
| 820 | 786 | ||
| 821 | 787 | /* Calculate datasize first (consistent across all cases) */ | |
| 822 | 788 | *datasize = mtu + ETH_HLEN; | |
| 823 | 789 | ||
| 824 | - | *headroom = mana_get_rxbuf_headroom(apc); | |
| 825 | - | ||
| 826 | 790 | if (mana_use_single_rxbuf_per_page(apc, mtu)) { | |
| 827 | - | if (mana_xdp_get(apc)) | |
| 791 | + | if (mana_xdp_get(apc)) { | |
| 792 | + | *headroom = XDP_PACKET_HEADROOM; | |
| 828 | 793 | *alloc_size = PAGE_SIZE; | |
| 829 | - | else | |
| 794 | + | } else { | |
| 795 | + | *headroom = 0; /* no support for XDP */ | |
| 830 | 796 | *alloc_size = SKB_DATA_ALIGN(mtu + MANA_RXBUF_PAD + | |
| 831 | 797 | *headroom); | |
| 798 | + | } | |
| 832 | 799 | ||
| 833 | 800 | *frag_count = 1; | |
| 834 | 801 | ||
| @@ -842,7 +809,11 @@ static void mana_get_rxbuf_cfg(struct mana_port_context *apc, | |||
| 842 | 809 | } | |
| 843 | 810 | ||
| 844 | 811 | /* Standard MTU case - optimize for multiple packets per page */ | |
| 845 | - | buf_size = mana_get_rxbuf_size(apc, mtu); | |
| 812 | + | *headroom = 0; | |
| 813 | + | ||
| 814 | + | /* Calculate base buffer size needed */ | |
| 815 | + | len = SKB_DATA_ALIGN(mtu + MANA_RXBUF_PAD + *headroom); | |
| 816 | + | buf_size = ALIGN(len, MANA_RX_FRAG_ALIGNMENT); | |
| 846 | 817 | ||
| 847 | 818 | /* Calculate how many packets can fit in a page */ | |
| 848 | 819 | *frag_count = PAGE_SIZE / buf_size; | |
modified drivers/net/ethernet/microsoft/mana/mana_ethtool.c
| @@ -815,12 +815,12 @@ static int mana_set_priv_flags(struct net_device *ndev, u32 priv_flags) | |||
| 815 | 815 | if (!apc->port_is_up) | |
| 816 | 816 | return 0; | |
| 817 | 817 | ||
| 818 | - | /* If XDP is attached or the MTU already forces one buffer per | |
| 819 | - | * page, single-buffer-per-page is used regardless of this | |
| 820 | - | * flag. Skip the expensive detach/attach cycle since nothing | |
| 821 | - | * changes. | |
| 818 | + | /* If XDP is attached or MTU is jumbo, single-buffer-per-page | |
| 819 | + | * is already forced regardless of this flag. Skip the | |
| 820 | + | * expensive detach/attach cycle since nothing changes. | |
| 822 | 821 | */ | |
| 823 | - | if (mana_single_rxbuf_per_page_forced(apc, ndev->mtu)) | |
| 822 | + | if (ndev->mtu + MANA_RXBUF_PAD > PAGE_SIZE / 2 || | |
| 823 | + | mana_xdp_get(apc)) | |
| 824 | 824 | return 0; | |
| 825 | 825 | ||
| 826 | 826 | /* Block RDMA from grabbing the vport during detach/attach */ | |
modified drivers/net/ethernet/realtek/r8169_main.c
| @@ -5484,12 +5484,6 @@ static int r8169_mdio_register(struct rtl8169_private *tp) | |||
| 5484 | 5484 | phy_disable_eee_mode(tp->phydev, | |
| 5485 | 5485 | ETHTOOL_LINK_MODE_2500baseT_Full_BIT); | |
| 5486 | 5486 | ||
| 5487 | - | /* Keep EEE off but the version stays EEE-capable so that link-up | |
| 5488 | - | * still clears the MAC TX-LPI bits. | |
| 5489 | - | */ | |
| 5490 | - | if (tp->mac_version == RTL_GIGA_MAC_VER_46) | |
| 5491 | - | phy_disable_eee(tp->phydev); | |
| 5492 | - | ||
| 5493 | 5487 | /* PHY will be woken up in rtl_open() */ | |
| 5494 | 5488 | phy_suspend(tp->phydev); | |
| 5495 | 5489 | ||
modified drivers/net/ethernet/stmicro/stmmac/hwif.h
| @@ -633,7 +633,7 @@ struct stmmac_est_ops { | |||
| 633 | 633 | struct stmmac_vlan_ops { | |
| 634 | 634 | /* VLAN */ | |
| 635 | 635 | void (*update_vlan_hash)(struct mac_device_info *hw, u32 hash, | |
| 636 | - | bool is_svlan); | |
| 636 | + | u16 perfect_match, bool is_double); | |
| 637 | 637 | void (*enable_vlan)(struct mac_device_info *hw, u32 type); | |
| 638 | 638 | void (*rx_hw_vlan)(struct mac_device_info *hw, struct dma_desc *rx_desc, | |
| 639 | 639 | struct sk_buff *skb); | |
modified drivers/net/ethernet/stmicro/stmmac/stmmac.h
| @@ -344,7 +344,7 @@ struct stmmac_priv { | |||
| 344 | 344 | void __iomem *ptpaddr; | |
| 345 | 345 | void __iomem *estaddr; | |
| 346 | 346 | unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)]; | |
| 347 | - | unsigned int num_svlans; | |
| 347 | + | unsigned int num_double_vlans; | |
| 348 | 348 | int sfty_irq; | |
| 349 | 349 | struct stmmac_msi *msi; | |
| 350 | 350 | ||
modified drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
| @@ -1629,16 +1629,6 @@ static void stmmac_clear_descriptors(struct stmmac_priv *priv, | |||
| 1629 | 1629 | stmmac_clear_tx_descriptors(priv, dma_conf, queue); | |
| 1630 | 1630 | } | |
| 1631 | 1631 | ||
| 1632 | - | static bool stmmac_rx_check_buf2_cap(struct stmmac_priv *priv) | |
| 1633 | - | { | |
| 1634 | - | /* Only cores that can program an independent secondary RX buffer | |
| 1635 | - | * (used for scatter-gather overflow or split-header payload) back | |
| 1636 | - | * buffer2. Legacy cores have no set_sec_addr op, so buffer2 is | |
| 1637 | - | * never handed to the hardware there. | |
| 1638 | - | */ | |
| 1639 | - | return priv->hw->desc && priv->hw->desc->set_sec_addr; | |
| 1640 | - | } | |
| 1641 | - | ||
| 1642 | 1632 | /** | |
| 1643 | 1633 | * stmmac_init_rx_buffers - init the RX descriptor buffer. | |
| 1644 | 1634 | * @priv: driver private structure | |
| @@ -1669,13 +1659,16 @@ static int stmmac_init_rx_buffers(struct stmmac_priv *priv, | |||
| 1669 | 1659 | buf->page_offset = stmmac_rx_offset(priv); | |
| 1670 | 1660 | } | |
| 1671 | 1661 | ||
| 1672 | - | if (stmmac_rx_check_buf2_cap(priv) && !buf->sec_page) { | |
| 1662 | + | if (priv->sph_active && !buf->sec_page) { | |
| 1673 | 1663 | buf->sec_page = page_pool_alloc_pages(rx_q->page_pool, gfp); | |
| 1674 | 1664 | if (!buf->sec_page) | |
| 1675 | 1665 | return -ENOMEM; | |
| 1676 | 1666 | ||
| 1677 | 1667 | buf->sec_addr = page_pool_get_dma_addr(buf->sec_page); | |
| 1678 | 1668 | stmmac_set_desc_sec_addr(priv, p, buf->sec_addr, true); | |
| 1669 | + | } else { | |
| 1670 | + | buf->sec_page = NULL; | |
| 1671 | + | stmmac_set_desc_sec_addr(priv, p, buf->sec_addr, false); | |
| 1679 | 1672 | } | |
| 1680 | 1673 | ||
| 1681 | 1674 | buf->addr = page_pool_get_dma_addr(buf->page) + buf->page_offset; | |
| @@ -2263,8 +2256,13 @@ static int __alloc_dma_rx_desc_resources(struct stmmac_priv *priv, | |||
| 2263 | 2256 | pp_params.nid = dev_to_node(priv->device); | |
| 2264 | 2257 | pp_params.dev = priv->device; | |
| 2265 | 2258 | pp_params.dma_dir = xdp_prog ? DMA_BIDIRECTIONAL : DMA_FROM_DEVICE; | |
| 2266 | - | pp_params.offset = 0; | |
| 2267 | - | pp_params.max_len = dma_conf->dma_buf_sz + stmmac_rx_offset(priv); | |
| 2259 | + | pp_params.offset = stmmac_rx_offset(priv); | |
| 2260 | + | pp_params.max_len = dma_conf->dma_buf_sz; | |
| 2261 | + | ||
| 2262 | + | if (priv->sph_active) { | |
| 2263 | + | pp_params.offset = 0; | |
| 2264 | + | pp_params.max_len += stmmac_rx_offset(priv); | |
| 2265 | + | } | |
| 2268 | 2266 | ||
| 2269 | 2267 | rx_q->page_pool = page_pool_create(&pp_params); | |
| 2270 | 2268 | if (IS_ERR(rx_q->page_pool)) { | |
| @@ -5101,7 +5099,7 @@ static inline void stmmac_rx_refill(struct stmmac_priv *priv, u32 queue) | |||
| 5101 | 5099 | break; | |
| 5102 | 5100 | } | |
| 5103 | 5101 | ||
| 5104 | - | if (stmmac_rx_check_buf2_cap(priv) && !buf->sec_page) { | |
| 5102 | + | if (priv->sph_active && !buf->sec_page) { | |
| 5105 | 5103 | buf->sec_page = page_pool_alloc_pages(rx_q->page_pool, gfp); | |
| 5106 | 5104 | if (!buf->sec_page) | |
| 5107 | 5105 | break; | |
| @@ -5112,8 +5110,10 @@ static inline void stmmac_rx_refill(struct stmmac_priv *priv, u32 queue) | |||
| 5112 | 5110 | buf->addr = page_pool_get_dma_addr(buf->page) + buf->page_offset; | |
| 5113 | 5111 | ||
| 5114 | 5112 | stmmac_set_desc_addr(priv, p, buf->addr); | |
| 5115 | - | stmmac_set_desc_sec_addr(priv, p, buf->sec_addr, | |
| 5116 | - | stmmac_rx_check_buf2_cap(priv)); | |
| 5113 | + | if (priv->sph_active) | |
| 5114 | + | stmmac_set_desc_sec_addr(priv, p, buf->sec_addr, true); | |
| 5115 | + | else | |
| 5116 | + | stmmac_set_desc_sec_addr(priv, p, buf->sec_addr, false); | |
| 5117 | 5117 | stmmac_refill_desc3(priv, rx_q, p); | |
| 5118 | 5118 | ||
| 5119 | 5119 | rx_q->rx_count_frames++; | |
| @@ -5144,9 +5144,7 @@ static unsigned int stmmac_rx_buf1_len(struct stmmac_priv *priv, | |||
| 5144 | 5144 | unsigned int plen = 0, hlen = 0; | |
| 5145 | 5145 | int coe = priv->hw->rx_csum; | |
| 5146 | 5146 | ||
| 5147 | - | /* Not first descriptor, SPH enabled: buffer1 only carries the | |
| 5148 | - | * split header of the first descriptor, so it is zero here. | |
| 5149 | - | */ | |
| 5147 | + | /* Not first descriptor, buffer is always zero */ | |
| 5150 | 5148 | if (priv->sph_active && len) | |
| 5151 | 5149 | return 0; | |
| 5152 | 5150 | ||
| @@ -5157,16 +5155,14 @@ static unsigned int stmmac_rx_buf1_len(struct stmmac_priv *priv, | |||
| 5157 | 5155 | return hlen; | |
| 5158 | 5156 | } | |
| 5159 | 5157 | ||
| 5160 | - | /* Not last descriptor and not split header: buffer1 is fully filled */ | |
| 5158 | + | /* First descriptor, not last descriptor and not split header */ | |
| 5161 | 5159 | if (status & rx_not_ls) | |
| 5162 | 5160 | return priv->dma_conf.dma_buf_sz; | |
| 5163 | 5161 | ||
| 5164 | 5162 | plen = stmmac_get_rx_frame_len(priv, p, coe); | |
| 5165 | 5163 | ||
| 5166 | - | /* Last descriptor and not split header: buffer1 holds the remaining | |
| 5167 | - | * bytes of the frame, up to dma_buf_sz | |
| 5168 | - | */ | |
| 5169 | - | return min_t(unsigned int, priv->dma_conf.dma_buf_sz, plen - len); | |
| 5164 | + | /* First descriptor and last descriptor and not split header */ | |
| 5165 | + | return min_t(unsigned int, priv->dma_conf.dma_buf_sz, plen); | |
| 5170 | 5166 | } | |
| 5171 | 5167 | ||
| 5172 | 5168 | static unsigned int stmmac_rx_buf2_len(struct stmmac_priv *priv, | |
| @@ -5176,7 +5172,8 @@ static unsigned int stmmac_rx_buf2_len(struct stmmac_priv *priv, | |||
| 5176 | 5172 | int coe = priv->hw->rx_csum; | |
| 5177 | 5173 | unsigned int plen = 0; | |
| 5178 | 5174 | ||
| 5179 | - | if (!stmmac_rx_check_buf2_cap(priv)) | |
| 5175 | + | /* Not split header, buffer is not available */ | |
| 5176 | + | if (!priv->sph_active) | |
| 5180 | 5177 | return 0; | |
| 5181 | 5178 | ||
| 5182 | 5179 | /* For GMAC4, when split header is enabled, in some rare cases, the | |
| @@ -5193,15 +5190,14 @@ static unsigned int stmmac_rx_buf2_len(struct stmmac_priv *priv, | |||
| 5193 | 5190 | * Thus 'plen - len' always gives the correct length of buf2. | |
| 5194 | 5191 | */ | |
| 5195 | 5192 | ||
| 5196 | - | /* Not GMAC4, or non-SPH and not last descriptor */ | |
| 5197 | - | if ((priv->plat->core_type != DWMAC_CORE_GMAC4 || !priv->sph_active) && | |
| 5198 | - | (status & rx_not_ls)) | |
| 5193 | + | /* Not GMAC4 and not last descriptor */ | |
| 5194 | + | if (priv->plat->core_type != DWMAC_CORE_GMAC4 && (status & rx_not_ls)) | |
| 5199 | 5195 | return priv->dma_conf.dma_buf_sz; | |
| 5200 | 5196 | ||
| 5201 | 5197 | /* GMAC4 or last descriptor */ | |
| 5202 | 5198 | plen = stmmac_get_rx_frame_len(priv, p, coe); | |
| 5203 | 5199 | ||
| 5204 | - | return plen > len ? plen - len : 0; | |
| 5200 | + | return plen - len; | |
| 5205 | 5201 | } | |
| 5206 | 5202 | ||
| 5207 | 5203 | static int stmmac_xdp_xmit_xdpf(struct stmmac_priv *priv, int queue, | |
| @@ -5724,7 +5720,6 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue) | |||
| 5724 | 5720 | unsigned int desc_size; | |
| 5725 | 5721 | struct sk_buff *skb = NULL; | |
| 5726 | 5722 | struct stmmac_xdp_buff ctx; | |
| 5727 | - | bool fcs_stripped = false; | |
| 5728 | 5723 | int xdp_status = 0; | |
| 5729 | 5724 | int bufsz; | |
| 5730 | 5725 | ||
| @@ -5814,25 +5809,24 @@ read_again: | |||
| 5814 | 5809 | len += buf2_len; | |
| 5815 | 5810 | ||
| 5816 | 5811 | /* ACS is disabled; strip manually. */ | |
| 5817 | - | if (likely(!(status & rx_not_ls))) | |
| 5818 | - | len -= ETH_FCS_LEN; | |
| 5812 | + | if (likely(!(status & rx_not_ls))) { | |
| 5813 | + | if (buf2_len) { | |
| 5814 | + | buf2_len -= ETH_FCS_LEN; | |
| 5815 | + | len -= ETH_FCS_LEN; | |
| 5816 | + | } else if (buf1_len) { | |
| 5817 | + | buf1_len -= ETH_FCS_LEN; | |
| 5818 | + | len -= ETH_FCS_LEN; | |
| 5819 | + | } | |
| 5820 | + | } | |
| 5819 | 5821 | ||
| 5820 | 5822 | if (!skb) { | |
| 5821 | 5823 | unsigned int pre_len, sync_len; | |
| 5822 | 5824 | ||
| 5823 | - | /* Each frame starts here: reset the FCS handling */ | |
| 5824 | - | fcs_stripped = false; | |
| 5825 | - | ||
| 5826 | 5825 | dma_sync_single_for_cpu(priv->device, buf->addr, | |
| 5827 | 5826 | buf1_len, dma_dir); | |
| 5828 | 5827 | net_prefetch(page_address(buf->page) + | |
| 5829 | 5828 | buf->page_offset); | |
| 5830 | 5829 | ||
| 5831 | - | if (stmmac_xdp_is_enabled(priv) && !buf2_len) { | |
| 5832 | - | buf1_len -= ETH_FCS_LEN; | |
| 5833 | - | fcs_stripped = true; | |
| 5834 | - | } | |
| 5835 | - | ||
| 5836 | 5830 | xdp_init_buff(&ctx.xdp, bufsz, &rx_q->xdp_rxq); | |
| 5837 | 5831 | xdp_prepare_buff(&ctx.xdp, page_address(buf->page), | |
| 5838 | 5832 | buf->page_offset, buf1_len, true); | |
| @@ -5933,15 +5927,6 @@ drain_data: | |||
| 5933 | 5927 | ||
| 5934 | 5928 | /* Got entire packet into SKB. Finish it. */ | |
| 5935 | 5929 | ||
| 5936 | - | /* Remove FCS if needed */ | |
| 5937 | - | if (!fcs_stripped && pskb_trim(skb, len)) { | |
| 5938 | - | dev_kfree_skb_any(skb); | |
| 5939 | - | skb = NULL; | |
| 5940 | - | rx_dropped++; | |
| 5941 | - | count++; | |
| 5942 | - | continue; | |
| 5943 | - | } | |
| 5944 | - | ||
| 5945 | 5930 | stmmac_get_rx_hwtstamp(priv, p, np, skb); | |
| 5946 | 5931 | ||
| 5947 | 5932 | if (priv->hw->hw_vlan_en) | |
| @@ -6226,13 +6211,6 @@ static netdev_features_t stmmac_fix_features(struct net_device *dev, | |||
| 6226 | 6211 | if (priv->plat->bugged_jumbo && (dev->mtu > ETH_DATA_LEN)) | |
| 6227 | 6212 | features &= ~NETIF_F_CSUM_MASK; | |
| 6228 | 6213 | ||
| 6229 | - | if (priv->plat->core_type == DWMAC_CORE_XGMAC) { | |
| 6230 | - | if (features & NETIF_F_HW_VLAN_CTAG_RX) | |
| 6231 | - | features |= NETIF_F_HW_VLAN_STAG_RX; | |
| 6232 | - | else | |
| 6233 | - | features &= ~NETIF_F_HW_VLAN_STAG_RX; | |
| 6234 | - | } | |
| 6235 | - | ||
| 6236 | 6214 | return features; | |
| 6237 | 6215 | } | |
| 6238 | 6216 | ||
| @@ -6857,21 +6835,32 @@ static u32 stmmac_vid_crc32_le(__le16 vid_le) | |||
| 6857 | 6835 | return crc; | |
| 6858 | 6836 | } | |
| 6859 | 6837 | ||
| 6860 | - | static int stmmac_vlan_update(struct stmmac_priv *priv, bool is_svlan) | |
| 6838 | + | static int stmmac_vlan_update(struct stmmac_priv *priv, bool is_double) | |
| 6861 | 6839 | { | |
| 6862 | 6840 | u32 crc, hash = 0; | |
| 6841 | + | u16 pmatch = 0; | |
| 6842 | + | int count = 0; | |
| 6863 | 6843 | u16 vid = 0; | |
| 6864 | 6844 | ||
| 6865 | 6845 | for_each_set_bit(vid, priv->active_vlans, VLAN_N_VID) { | |
| 6866 | 6846 | __le16 vid_le = cpu_to_le16(vid); | |
| 6867 | 6847 | crc = bitrev32(~stmmac_vid_crc32_le(vid_le)) >> 28; | |
| 6868 | 6848 | hash |= (1 << crc); | |
| 6849 | + | count++; | |
| 6850 | + | } | |
| 6851 | + | ||
| 6852 | + | if (!priv->dma_cap.vlhash) { | |
| 6853 | + | if (count > 2) /* VID = 0 always passes filter */ | |
| 6854 | + | return -EOPNOTSUPP; | |
| 6855 | + | ||
| 6856 | + | pmatch = vid; | |
| 6857 | + | hash = 0; | |
| 6869 | 6858 | } | |
| 6870 | 6859 | ||
| 6871 | 6860 | if (!netif_running(priv->dev)) | |
| 6872 | 6861 | return 0; | |
| 6873 | 6862 | ||
| 6874 | - | return stmmac_update_vlan_hash(priv, priv->hw, hash, is_svlan); | |
| 6863 | + | return stmmac_update_vlan_hash(priv, priv->hw, hash, pmatch, is_double); | |
| 6875 | 6864 | } | |
| 6876 | 6865 | ||
| 6877 | 6866 | /* FIXME: This may need RXC to be running, but it may be called with BH | |
| @@ -6880,8 +6869,8 @@ static int stmmac_vlan_update(struct stmmac_priv *priv, bool is_svlan) | |||
| 6880 | 6869 | static int stmmac_vlan_rx_add_vid(struct net_device *ndev, __be16 proto, u16 vid) | |
| 6881 | 6870 | { | |
| 6882 | 6871 | struct stmmac_priv *priv = netdev_priv(ndev); | |
| 6883 | - | unsigned int num_svlans; | |
| 6884 | - | bool is_svlan = false; | |
| 6872 | + | unsigned int num_double_vlans; | |
| 6873 | + | bool is_double = false; | |
| 6885 | 6874 | int ret; | |
| 6886 | 6875 | ||
| 6887 | 6876 | ret = pm_runtime_resume_and_get(priv->device); | |
| @@ -6889,11 +6878,11 @@ static int stmmac_vlan_rx_add_vid(struct net_device *ndev, __be16 proto, u16 vid | |||
| 6889 | 6878 | return ret; | |
| 6890 | 6879 | ||
| 6891 | 6880 | if (be16_to_cpu(proto) == ETH_P_8021AD) | |
| 6892 | - | is_svlan = true; | |
| 6881 | + | is_double = true; | |
| 6893 | 6882 | ||
| 6894 | 6883 | set_bit(vid, priv->active_vlans); | |
| 6895 | - | num_svlans = priv->num_svlans + is_svlan; | |
| 6896 | - | ret = stmmac_vlan_update(priv, num_svlans); | |
| 6884 | + | num_double_vlans = priv->num_double_vlans + is_double; | |
| 6885 | + | ret = stmmac_vlan_update(priv, num_double_vlans); | |
| 6897 | 6886 | if (ret) { | |
| 6898 | 6887 | clear_bit(vid, priv->active_vlans); | |
| 6899 | 6888 | goto err_pm_put; | |
| @@ -6903,12 +6892,12 @@ static int stmmac_vlan_rx_add_vid(struct net_device *ndev, __be16 proto, u16 vid | |||
| 6903 | 6892 | ret = stmmac_add_hw_vlan_rx_fltr(priv, ndev, priv->hw, proto, vid); | |
| 6904 | 6893 | if (ret) { | |
| 6905 | 6894 | clear_bit(vid, priv->active_vlans); | |
| 6906 | - | stmmac_vlan_update(priv, priv->num_svlans); | |
| 6895 | + | stmmac_vlan_update(priv, priv->num_double_vlans); | |
| 6907 | 6896 | goto err_pm_put; | |
| 6908 | 6897 | } | |
| 6909 | 6898 | } | |
| 6910 | 6899 | ||
| 6911 | - | priv->num_svlans = num_svlans; | |
| 6900 | + | priv->num_double_vlans = num_double_vlans; | |
| 6912 | 6901 | ||
| 6913 | 6902 | err_pm_put: | |
| 6914 | 6903 | pm_runtime_put(priv->device); | |
| @@ -6922,8 +6911,8 @@ err_pm_put: | |||
| 6922 | 6911 | static int stmmac_vlan_rx_kill_vid(struct net_device *ndev, __be16 proto, u16 vid) | |
| 6923 | 6912 | { | |
| 6924 | 6913 | struct stmmac_priv *priv = netdev_priv(ndev); | |
| 6925 | - | unsigned int num_svlans; | |
| 6926 | - | bool is_svlan = false; | |
| 6914 | + | unsigned int num_double_vlans; | |
| 6915 | + | bool is_double = false; | |
| 6927 | 6916 | int ret; | |
| 6928 | 6917 | ||
| 6929 | 6918 | ret = pm_runtime_resume_and_get(priv->device); | |
| @@ -6931,11 +6920,11 @@ static int stmmac_vlan_rx_kill_vid(struct net_device *ndev, __be16 proto, u16 vi | |||
| 6931 | 6920 | return ret; | |
| 6932 | 6921 | ||
| 6933 | 6922 | if (be16_to_cpu(proto) == ETH_P_8021AD) | |
| 6934 | - | is_svlan = true; | |
| 6923 | + | is_double = true; | |
| 6935 | 6924 | ||
| 6936 | 6925 | clear_bit(vid, priv->active_vlans); | |
| 6937 | - | num_svlans = priv->num_svlans - is_svlan; | |
| 6938 | - | ret = stmmac_vlan_update(priv, num_svlans); | |
| 6926 | + | num_double_vlans = priv->num_double_vlans - is_double; | |
| 6927 | + | ret = stmmac_vlan_update(priv, num_double_vlans); | |
| 6939 | 6928 | if (ret) { | |
| 6940 | 6929 | set_bit(vid, priv->active_vlans); | |
| 6941 | 6930 | goto del_vlan_error; | |
| @@ -6945,12 +6934,12 @@ static int stmmac_vlan_rx_kill_vid(struct net_device *ndev, __be16 proto, u16 vi | |||
| 6945 | 6934 | ret = stmmac_del_hw_vlan_rx_fltr(priv, ndev, priv->hw, proto, vid); | |
| 6946 | 6935 | if (ret) { | |
| 6947 | 6936 | set_bit(vid, priv->active_vlans); | |
| 6948 | - | stmmac_vlan_update(priv, priv->num_svlans); | |
| 6937 | + | stmmac_vlan_update(priv, priv->num_double_vlans); | |
| 6949 | 6938 | goto del_vlan_error; | |
| 6950 | 6939 | } | |
| 6951 | 6940 | } | |
| 6952 | 6941 | ||
| 6953 | - | priv->num_svlans = num_svlans; | |
| 6942 | + | priv->num_double_vlans = num_double_vlans; | |
| 6954 | 6943 | ||
| 6955 | 6944 | del_vlan_error: | |
| 6956 | 6945 | pm_runtime_put(priv->device); | |
| @@ -6966,7 +6955,7 @@ static void stmmac_vlan_restore(struct stmmac_priv *priv) | |||
| 6966 | 6955 | if (priv->hw->num_vlan) | |
| 6967 | 6956 | stmmac_restore_hw_vlan_rx_fltr(priv, priv->dev, priv->hw); | |
| 6968 | 6957 | ||
| 6969 | - | stmmac_vlan_update(priv, priv->num_svlans); | |
| 6958 | + | stmmac_vlan_update(priv, priv->num_double_vlans); | |
| 6970 | 6959 | } | |
| 6971 | 6960 | ||
| 6972 | 6961 | static int stmmac_bpf(struct net_device *dev, struct netdev_bpf *bpf) | |
| @@ -8005,18 +7994,14 @@ static int __stmmac_dvr_probe(struct device *device, | |||
| 8005 | 7994 | ndev->watchdog_timeo = msecs_to_jiffies(watchdog); | |
| 8006 | 7995 | #ifdef STMMAC_VLAN_TAG_USED | |
| 8007 | 7996 | /* Both mac100 and gmac support receive VLAN tag detection */ | |
| 8008 | - | ndev->features |= NETIF_F_HW_VLAN_CTAG_RX; | |
| 8009 | - | if (priv->plat->core_type == DWMAC_CORE_XGMAC) | |
| 8010 | - | ndev->features |= NETIF_F_HW_VLAN_STAG_RX; | |
| 8011 | - | ||
| 7997 | + | ndev->features |= NETIF_F_HW_VLAN_CTAG_RX | NETIF_F_HW_VLAN_STAG_RX; | |
| 8012 | 7998 | if (dwmac_is_xmac(priv->plat->core_type)) { | |
| 8013 | 7999 | ndev->hw_features |= NETIF_F_HW_VLAN_CTAG_RX; | |
| 8014 | 8000 | priv->hw->hw_vlan_en = true; | |
| 8015 | 8001 | } | |
| 8016 | 8002 | if (priv->dma_cap.vlhash) { | |
| 8017 | 8003 | ndev->features |= NETIF_F_HW_VLAN_CTAG_FILTER; | |
| 8018 | - | if (priv->plat->core_type == DWMAC_CORE_XGMAC) | |
| 8019 | - | ndev->features |= NETIF_F_HW_VLAN_STAG_FILTER; | |
| 8004 | + | ndev->features |= NETIF_F_HW_VLAN_STAG_FILTER; | |
| 8020 | 8005 | } | |
| 8021 | 8006 | if (priv->dma_cap.vlins) | |
| 8022 | 8007 | ndev->features |= NETIF_F_HW_VLAN_CTAG_TX; | |
modified drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c
| @@ -243,7 +243,7 @@ struct stmmac_test_priv { | |||
| 243 | 243 | int (*func)(struct sk_buff *skb, struct net_device *ndev, | |
| 244 | 244 | struct packet_type *pt, struct net_device *orig_ndev); | |
| 245 | 245 | bool capture_all; | |
| 246 | - | int svlan; | |
| 246 | + | int double_vlan; | |
| 247 | 247 | int vlan_id; | |
| 248 | 248 | int ok; | |
| 249 | 249 | }; | |
| @@ -285,7 +285,7 @@ static int stmmac_test_loopback_validate(struct sk_buff *skb, | |||
| 285 | 285 | } | |
| 286 | 286 | ||
| 287 | 287 | ihdr = ip_hdr(skb); | |
| 288 | - | if (tpriv->svlan) | |
| 288 | + | if (tpriv->double_vlan) | |
| 289 | 289 | ihdr = (struct iphdr *)(skb_network_header(skb) + 4); | |
| 290 | 290 | ||
| 291 | 291 | if (tpriv->packet->tcp) { | |
| @@ -936,7 +936,7 @@ static int stmmac_test_vlan_validate(struct sk_buff *skb, | |||
| 936 | 936 | struct iphdr *ihdr; | |
| 937 | 937 | u16 proto; | |
| 938 | 938 | ||
| 939 | - | proto = tpriv->svlan ? ETH_P_8021AD : ETH_P_8021Q; | |
| 939 | + | proto = tpriv->double_vlan ? ETH_P_8021AD : ETH_P_8021Q; | |
| 940 | 940 | ||
| 941 | 941 | skb = skb_unshare(skb, GFP_ATOMIC); | |
| 942 | 942 | if (!skb) | |
| @@ -963,7 +963,7 @@ static int stmmac_test_vlan_validate(struct sk_buff *skb, | |||
| 963 | 963 | } | |
| 964 | 964 | ||
| 965 | 965 | ihdr = ip_hdr(skb); | |
| 966 | - | if (tpriv->svlan) | |
| 966 | + | if (tpriv->double_vlan) | |
| 967 | 967 | ihdr = (struct iphdr *)(skb_network_header(skb) + 4); | |
| 968 | 968 | if (ihdr->protocol != IPPROTO_UDP) | |
| 969 | 969 | goto out; | |
| @@ -1080,7 +1080,7 @@ static int stmmac_test_vlanfilt_perfect(struct stmmac_priv *priv) | |||
| 1080 | 1080 | return ret; | |
| 1081 | 1081 | } | |
| 1082 | 1082 | ||
| 1083 | - | static int __stmmac_test_svlanfilt(struct stmmac_priv *priv) | |
| 1083 | + | static int __stmmac_test_dvlanfilt(struct stmmac_priv *priv) | |
| 1084 | 1084 | { | |
| 1085 | 1085 | struct stmmac_packet_attrs attr = { }; | |
| 1086 | 1086 | struct stmmac_test_priv *tpriv; | |
| @@ -1092,7 +1092,7 @@ static int __stmmac_test_svlanfilt(struct stmmac_priv *priv) | |||
| 1092 | 1092 | return -ENOMEM; | |
| 1093 | 1093 | ||
| 1094 | 1094 | tpriv->ok = false; | |
| 1095 | - | tpriv->svlan = true; | |
| 1095 | + | tpriv->double_vlan = true; | |
| 1096 | 1096 | init_completion(&tpriv->comp); | |
| 1097 | 1097 | ||
| 1098 | 1098 | tpriv->pt.type = htons(ETH_P_8021Q); | |
| @@ -1155,15 +1155,15 @@ cleanup: | |||
| 1155 | 1155 | return ret; | |
| 1156 | 1156 | } | |
| 1157 | 1157 | ||
| 1158 | - | static int stmmac_test_svlanfilt(struct stmmac_priv *priv) | |
| 1158 | + | static int stmmac_test_dvlanfilt(struct stmmac_priv *priv) | |
| 1159 | 1159 | { | |
| 1160 | 1160 | if (!priv->dma_cap.vlhash) | |
| 1161 | 1161 | return -EOPNOTSUPP; | |
| 1162 | 1162 | ||
| 1163 | - | return __stmmac_test_svlanfilt(priv); | |
| 1163 | + | return __stmmac_test_dvlanfilt(priv); | |
| 1164 | 1164 | } | |
| 1165 | 1165 | ||
| 1166 | - | static int stmmac_test_svlanfilt_perfect(struct stmmac_priv *priv) | |
| 1166 | + | static int stmmac_test_dvlanfilt_perfect(struct stmmac_priv *priv) | |
| 1167 | 1167 | { | |
| 1168 | 1168 | int ret, prev_cap = priv->dma_cap.vlhash; | |
| 1169 | 1169 | ||
| @@ -1171,7 +1171,7 @@ static int stmmac_test_svlanfilt_perfect(struct stmmac_priv *priv) | |||
| 1171 | 1171 | return -EOPNOTSUPP; | |
| 1172 | 1172 | ||
| 1173 | 1173 | priv->dma_cap.vlhash = 0; | |
| 1174 | - | ret = __stmmac_test_svlanfilt(priv); | |
| 1174 | + | ret = __stmmac_test_dvlanfilt(priv); | |
| 1175 | 1175 | priv->dma_cap.vlhash = prev_cap; | |
| 1176 | 1176 | ||
| 1177 | 1177 | return ret; | |
| @@ -1372,7 +1372,7 @@ static int stmmac_test_vlanoff_common(struct stmmac_priv *priv, bool svlan) | |||
| 1372 | 1372 | proto = svlan ? ETH_P_8021AD : ETH_P_8021Q; | |
| 1373 | 1373 | ||
| 1374 | 1374 | tpriv->ok = false; | |
| 1375 | - | tpriv->svlan = svlan; | |
| 1375 | + | tpriv->double_vlan = svlan; | |
| 1376 | 1376 | init_completion(&tpriv->comp); | |
| 1377 | 1377 | ||
| 1378 | 1378 | tpriv->pt.type = svlan ? htons(ETH_P_8021Q) : htons(ETH_P_IP); | |
| @@ -1960,11 +1960,11 @@ static const struct stmmac_test { | |||
| 1960 | 1960 | .name = "VLAN Filtering (perf) ", | |
| 1961 | 1961 | .fn = stmmac_test_vlanfilt_perfect, | |
| 1962 | 1962 | }, { | |
| 1963 | - | .name = "SVLAN Filtering ", | |
| 1964 | - | .fn = stmmac_test_svlanfilt, | |
| 1963 | + | .name = "Double VLAN Filter ", | |
| 1964 | + | .fn = stmmac_test_dvlanfilt, | |
| 1965 | 1965 | }, { | |
| 1966 | - | .name = "SVLAN Filtering (perf) ", | |
| 1967 | - | .fn = stmmac_test_svlanfilt_perfect, | |
| 1966 | + | .name = "Double VLAN Filter (perf) ", | |
| 1967 | + | .fn = stmmac_test_dvlanfilt_perfect, | |
| 1968 | 1968 | }, { | |
| 1969 | 1969 | .name = "Flexible RX Parser ", | |
| 1970 | 1970 | .fn = stmmac_test_rxp, | |
modified drivers/net/ethernet/stmicro/stmmac/stmmac_vlan.c
| @@ -162,7 +162,7 @@ static void vlan_restore_hw_rx_fltr(struct net_device *dev, | |||
| 162 | 162 | } | |
| 163 | 163 | ||
| 164 | 164 | static void vlan_update_hash(struct mac_device_info *hw, u32 hash, | |
| 165 | - | bool is_svlan) | |
| 165 | + | u16 perfect_match, bool is_double) | |
| 166 | 166 | { | |
| 167 | 167 | void __iomem *ioaddr = hw->pcsr; | |
| 168 | 168 | u32 value; | |
| @@ -173,17 +173,34 @@ static void vlan_update_hash(struct mac_device_info *hw, u32 hash, | |||
| 173 | 173 | ||
| 174 | 174 | if (hash) { | |
| 175 | 175 | value |= VLAN_VTHM | VLAN_ETV; | |
| 176 | - | if (is_svlan) { | |
| 176 | + | if (is_double) { | |
| 177 | + | value |= VLAN_EDVLP; | |
| 177 | 178 | value |= VLAN_ESVL; | |
| 178 | 179 | value |= VLAN_DOVLTC; | |
| 179 | 180 | } else { | |
| 181 | + | value &= ~VLAN_EDVLP; | |
| 180 | 182 | value &= ~VLAN_ESVL; | |
| 181 | 183 | value &= ~VLAN_DOVLTC; | |
| 182 | 184 | } | |
| 183 | 185 | ||
| 184 | 186 | writel(value, ioaddr + VLAN_TAG); | |
| 187 | + | } else if (perfect_match) { | |
| 188 | + | u32 value = VLAN_ETV; | |
| 189 | + | ||
| 190 | + | if (is_double) { | |
| 191 | + | value |= VLAN_EDVLP; | |
| 192 | + | value |= VLAN_ESVL; | |
| 193 | + | value |= VLAN_DOVLTC; | |
| 194 | + | } else { | |
| 195 | + | value &= ~VLAN_EDVLP; | |
| 196 | + | value &= ~VLAN_ESVL; | |
| 197 | + | value &= ~VLAN_DOVLTC; | |
| 198 | + | } | |
| 199 | + | ||
| 200 | + | writel(value | perfect_match, ioaddr + VLAN_TAG); | |
| 185 | 201 | } else { | |
| 186 | - | value &= ~(VLAN_VTHM | VLAN_ETV | VLAN_ESVL); | |
| 202 | + | value &= ~(VLAN_VTHM | VLAN_ETV); | |
| 203 | + | value &= ~(VLAN_EDVLP | VLAN_ESVL); | |
| 187 | 204 | value &= ~VLAN_DOVLTC; | |
| 188 | 205 | value &= ~VLAN_VID; | |
| 189 | 206 | ||
| @@ -219,7 +236,6 @@ static void vlan_set_hw_mode(struct mac_device_info *hw) | |||
| 219 | 236 | void __iomem *ioaddr = hw->pcsr; | |
| 220 | 237 | u32 value = readl(ioaddr + VLAN_TAG); | |
| 221 | 238 | ||
| 222 | - | value |= VLAN_EDVLP; | |
| 223 | 239 | value &= ~VLAN_TAG_CTRL_EVLS_MASK; | |
| 224 | 240 | ||
| 225 | 241 | if (hw->hw_vlan_en) | |
| @@ -235,7 +251,7 @@ static void vlan_set_hw_mode(struct mac_device_info *hw) | |||
| 235 | 251 | } | |
| 236 | 252 | ||
| 237 | 253 | static void dwxgmac2_update_vlan_hash(struct mac_device_info *hw, u32 hash, | |
| 238 | - | bool is_svlan) | |
| 254 | + | u16 perfect_match, bool is_double) | |
| 239 | 255 | { | |
| 240 | 256 | void __iomem *ioaddr = hw->pcsr; | |
| 241 | 257 | ||
| @@ -251,16 +267,41 @@ static void dwxgmac2_update_vlan_hash(struct mac_device_info *hw, u32 hash, | |||
| 251 | 267 | value = readl(ioaddr + VLAN_TAG); | |
| 252 | 268 | ||
| 253 | 269 | value |= VLAN_VTHM | VLAN_ETV; | |
| 254 | - | if (is_svlan) { | |
| 270 | + | if (is_double) { | |
| 271 | + | value |= VLAN_EDVLP; | |
| 255 | 272 | value |= VLAN_ESVL; | |
| 256 | 273 | value |= VLAN_DOVLTC; | |
| 257 | 274 | } else { | |
| 275 | + | value &= ~VLAN_EDVLP; | |
| 258 | 276 | value &= ~VLAN_ESVL; | |
| 259 | 277 | value &= ~VLAN_DOVLTC; | |
| 260 | 278 | } | |
| 261 | 279 | ||
| 262 | 280 | value &= ~VLAN_VID; | |
| 263 | 281 | writel(value, ioaddr + VLAN_TAG); | |
| 282 | + | } else if (perfect_match) { | |
| 283 | + | u32 value = readl(ioaddr + XGMAC_PACKET_FILTER); | |
| 284 | + | ||
| 285 | + | value |= XGMAC_FILTER_VTFE; | |
| 286 | + | ||
| 287 | + | writel(value, ioaddr + XGMAC_PACKET_FILTER); | |
| 288 | + | ||
| 289 | + | value = readl(ioaddr + VLAN_TAG); | |
| 290 | + | ||
| 291 | + | value &= ~VLAN_VTHM; | |
| 292 | + | value |= VLAN_ETV; | |
| 293 | + | if (is_double) { | |
| 294 | + | value |= VLAN_EDVLP; | |
| 295 | + | value |= VLAN_ESVL; | |
| 296 | + | value |= VLAN_DOVLTC; | |
| 297 | + | } else { | |
| 298 | + | value &= ~VLAN_EDVLP; | |
| 299 | + | value &= ~VLAN_ESVL; | |
| 300 | + | value &= ~VLAN_DOVLTC; | |
| 301 | + | } | |
| 302 | + | ||
| 303 | + | value &= ~VLAN_VID; | |
| 304 | + | writel(value | perfect_match, ioaddr + VLAN_TAG); | |
| 264 | 305 | } else { | |
| 265 | 306 | u32 value = readl(ioaddr + XGMAC_PACKET_FILTER); | |
| 266 | 307 | ||
| @@ -270,7 +311,8 @@ static void dwxgmac2_update_vlan_hash(struct mac_device_info *hw, u32 hash, | |||
| 270 | 311 | ||
| 271 | 312 | value = readl(ioaddr + VLAN_TAG); | |
| 272 | 313 | ||
| 273 | - | value &= ~(VLAN_VTHM | VLAN_ETV | VLAN_ESVL); | |
| 314 | + | value &= ~(VLAN_VTHM | VLAN_ETV); | |
| 315 | + | value &= ~(VLAN_EDVLP | VLAN_ESVL); | |
| 274 | 316 | value &= ~VLAN_DOVLTC; | |
| 275 | 317 | value &= ~VLAN_VID; | |
| 276 | 318 | ||
| @@ -278,14 +320,6 @@ static void dwxgmac2_update_vlan_hash(struct mac_device_info *hw, u32 hash, | |||
| 278 | 320 | } | |
| 279 | 321 | } | |
| 280 | 322 | ||
| 281 | - | static void dwxlgmac2_set_hw_vlan_mode(struct mac_device_info *hw) | |
| 282 | - | { | |
| 283 | - | void __iomem *ioaddr = hw->pcsr; | |
| 284 | - | u32 value = readl(ioaddr + VLAN_TAG); | |
| 285 | - | ||
| 286 | - | writel(value | VLAN_EDVLP, ioaddr + VLAN_TAG); | |
| 287 | - | } | |
| 288 | - | ||
| 289 | 323 | const struct stmmac_vlan_ops dwmac_vlan_ops = { | |
| 290 | 324 | .update_vlan_hash = vlan_update_hash, | |
| 291 | 325 | .enable_vlan = vlan_enable, | |
| @@ -299,7 +333,6 @@ const struct stmmac_vlan_ops dwmac_vlan_ops = { | |||
| 299 | 333 | const struct stmmac_vlan_ops dwxlgmac2_vlan_ops = { | |
| 300 | 334 | .update_vlan_hash = dwxgmac2_update_vlan_hash, | |
| 301 | 335 | .enable_vlan = vlan_enable, | |
| 302 | - | .set_hw_vlan_mode = dwxlgmac2_set_hw_vlan_mode, | |
| 303 | 336 | }; | |
| 304 | 337 | ||
| 305 | 338 | const struct stmmac_vlan_ops dwxgmac210_vlan_ops = { | |
modified drivers/net/ethernet/xilinx/xilinx_axienet.h
| @@ -523,9 +523,8 @@ struct skbuf_dma_descriptor { | |||
| 523 | 523 | * @stats_work: Work for reading the hardware statistics counters often enough | |
| 524 | 524 | * to catch overflows. | |
| 525 | 525 | * @dma_err_task: Work structure to process Axi DMA errors | |
| 526 | - | * @stopping: Set when we are about to stop the device: makes @dma_err_task | |
| 527 | - | * a no-op (legacy DMA path) and fences RX descriptor | |
| 528 | - | * resubmission in axienet_dma_rx_cb() (dmaengine path). | |
| 526 | + | * @stopping: Set when @dma_err_task shouldn't do anything because we are | |
| 527 | + | * about to stop the device. | |
| 529 | 528 | * @tx_irq: Axidma TX IRQ number | |
| 530 | 529 | * @rx_irq: Axidma RX IRQ number | |
| 531 | 530 | * @eth_irq: Ethernet core IRQ number | |
| @@ -546,7 +545,6 @@ struct skbuf_dma_descriptor { | |||
| 546 | 545 | * @tx_ring_tail: TX skb ring buffer tail index. | |
| 547 | 546 | * @rx_ring_head: RX skb ring buffer head index. | |
| 548 | 547 | * @rx_ring_tail: RX skb ring buffer tail index. | |
| 549 | - | * @rx_submit_lock: Protects RX ring resubmission vs teardown in dmaengine path. | |
| 550 | 548 | */ | |
| 551 | 549 | struct axienet_local { | |
| 552 | 550 | struct net_device *ndev; | |
| @@ -628,7 +626,6 @@ struct axienet_local { | |||
| 628 | 626 | int tx_ring_tail; | |
| 629 | 627 | int rx_ring_head; | |
| 630 | 628 | int rx_ring_tail; | |
| 631 | - | spinlock_t rx_submit_lock; | |
| 632 | 629 | }; | |
| 633 | 630 | ||
| 634 | 631 | /** | |
modified drivers/net/ethernet/xilinx/xilinx_axienet_main.c
| @@ -881,7 +881,6 @@ static void axienet_dma_tx_cb(void *data, const struct dmaengine_result *result) | |||
| 881 | 881 | u64_stats_update_end(&lp->tx_stat_sync); | |
| 882 | 882 | dma_unmap_sg(lp->dev, skbuf_dma->sgl, skbuf_dma->sg_len, DMA_TO_DEVICE); | |
| 883 | 883 | dev_consume_skb_any(skbuf_dma->skb); | |
| 884 | - | skbuf_dma->skb = NULL; | |
| 885 | 884 | netif_txq_completed_wake(txq, 1, len, | |
| 886 | 885 | CIRC_SPACE(lp->tx_ring_head, lp->tx_ring_tail, TX_BD_NUM_MAX), | |
| 887 | 886 | 2); | |
| @@ -1172,7 +1171,6 @@ static void axienet_dma_rx_cb(void *data, const struct dmaengine_result *result) | |||
| 1172 | 1171 | &meta_max_len); | |
| 1173 | 1172 | dma_unmap_single(lp->dev, skbuf_dma->dma_address, lp->max_frm_size, | |
| 1174 | 1173 | DMA_FROM_DEVICE); | |
| 1175 | - | skbuf_dma->skb = NULL; | |
| 1176 | 1174 | ||
| 1177 | 1175 | if (IS_ERR(app_metadata)) { | |
| 1178 | 1176 | if (net_ratelimit()) | |
| @@ -1195,17 +1193,10 @@ static void axienet_dma_rx_cb(void *data, const struct dmaengine_result *result) | |||
| 1195 | 1193 | u64_stats_update_end(&lp->rx_stat_sync); | |
| 1196 | 1194 | ||
| 1197 | 1195 | rx_submit: | |
| 1198 | - | spin_lock(&lp->rx_submit_lock); | |
| 1199 | - | if (lp->stopping) { | |
| 1200 | - | spin_unlock(&lp->rx_submit_lock); | |
| 1201 | - | return; | |
| 1202 | - | } | |
| 1203 | - | ||
| 1204 | 1196 | for (i = 0; i < CIRC_SPACE(lp->rx_ring_head, lp->rx_ring_tail, | |
| 1205 | 1197 | RX_BUF_NUM_DEFAULT); i++) | |
| 1206 | 1198 | axienet_rx_submit_desc(lp->ndev); | |
| 1207 | 1199 | dma_async_issue_pending(lp->rx_chan); | |
| 1208 | - | spin_unlock(&lp->rx_submit_lock); | |
| 1209 | 1200 | } | |
| 1210 | 1201 | ||
| 1211 | 1202 | /** | |
| @@ -1550,7 +1541,6 @@ static int axienet_init_dmaengine(struct net_device *ndev) | |||
| 1550 | 1541 | lp->tx_ring_head = 0; | |
| 1551 | 1542 | lp->rx_ring_tail = 0; | |
| 1552 | 1543 | lp->rx_ring_head = 0; | |
| 1553 | - | lp->stopping = false; | |
| 1554 | 1544 | lp->tx_skb_ring = kzalloc_objs(*lp->tx_skb_ring, TX_BD_NUM_MAX); | |
| 1555 | 1545 | if (!lp->tx_skb_ring) { | |
| 1556 | 1546 | ret = -ENOMEM; | |
| @@ -1762,42 +1752,20 @@ static int axienet_stop(struct net_device *ndev) | |||
| 1762 | 1752 | free_irq(lp->rx_irq, ndev); | |
| 1763 | 1753 | axienet_dma_bd_release(ndev); | |
| 1764 | 1754 | } else { | |
| 1765 | - | struct skbuf_dma_descriptor *skbuf_dma; | |
| 1766 | - | ||
| 1767 | - | spin_lock_bh(&lp->rx_submit_lock); | |
| 1768 | - | lp->stopping = true; | |
| 1769 | - | spin_unlock_bh(&lp->rx_submit_lock); | |
| 1770 | - | ||
| 1771 | 1755 | dmaengine_terminate_sync(lp->tx_chan); | |
| 1756 | + | dmaengine_synchronize(lp->tx_chan); | |
| 1772 | 1757 | dmaengine_terminate_sync(lp->rx_chan); | |
| 1758 | + | dmaengine_synchronize(lp->rx_chan); | |
| 1773 | 1759 | ||
| 1774 | - | dma_release_channel(lp->rx_chan); | |
| 1775 | - | dma_release_channel(lp->tx_chan); | |
| 1776 | - | ||
| 1777 | - | /* Unmap and free any buffer the terminate did not reclaim, so it | |
| 1778 | - | * is not leaked; a non-NULL skb marks such a slot. | |
| 1779 | - | */ | |
| 1780 | - | for (i = 0; i < TX_BD_NUM_MAX; i++) { | |
| 1781 | - | skbuf_dma = lp->tx_skb_ring[i]; | |
| 1782 | - | if (skbuf_dma && skbuf_dma->skb) { | |
| 1783 | - | dma_unmap_sg(lp->dev, skbuf_dma->sgl, | |
| 1784 | - | skbuf_dma->sg_len, DMA_TO_DEVICE); | |
| 1785 | - | dev_kfree_skb_any(skbuf_dma->skb); | |
| 1786 | - | } | |
| 1787 | - | kfree(skbuf_dma); | |
| 1788 | - | } | |
| 1760 | + | for (i = 0; i < TX_BD_NUM_MAX; i++) | |
| 1761 | + | kfree(lp->tx_skb_ring[i]); | |
| 1789 | 1762 | kfree(lp->tx_skb_ring); | |
| 1790 | - | ||
| 1791 | - | for (i = 0; i < RX_BUF_NUM_DEFAULT; i++) { | |
| 1792 | - | skbuf_dma = lp->rx_skb_ring[i]; | |
| 1793 | - | if (skbuf_dma && skbuf_dma->skb) { | |
| 1794 | - | dma_unmap_single(lp->dev, skbuf_dma->dma_address, | |
| 1795 | - | lp->max_frm_size, DMA_FROM_DEVICE); | |
| 1796 | - | dev_kfree_skb_any(skbuf_dma->skb); | |
| 1797 | - | } | |
| 1798 | - | kfree(skbuf_dma); | |
| 1799 | - | } | |
| 1763 | + | for (i = 0; i < RX_BUF_NUM_DEFAULT; i++) | |
| 1764 | + | kfree(lp->rx_skb_ring[i]); | |
| 1800 | 1765 | kfree(lp->rx_skb_ring); | |
| 1766 | + | ||
| 1767 | + | dma_release_channel(lp->rx_chan); | |
| 1768 | + | dma_release_channel(lp->tx_chan); | |
| 1801 | 1769 | } | |
| 1802 | 1770 | ||
| 1803 | 1771 | netdev_reset_queue(ndev); | |
| @@ -3097,7 +3065,6 @@ static int axienet_probe(struct platform_device *pdev) | |||
| 3097 | 3065 | ||
| 3098 | 3066 | spin_lock_init(&lp->rx_cr_lock); | |
| 3099 | 3067 | spin_lock_init(&lp->tx_cr_lock); | |
| 3100 | - | spin_lock_init(&lp->rx_submit_lock); | |
| 3101 | 3068 | INIT_WORK(&lp->rx_dim.work, axienet_rx_dim_work); | |
| 3102 | 3069 | lp->rx_dim_enabled = true; | |
| 3103 | 3070 | lp->rx_dim.profile_ix = 1; | |
modified drivers/net/pcs/pcs-rzn1-miic.c
| @@ -270,9 +270,6 @@ static struct miic_port *phylink_pcs_to_miic_port(struct phylink_pcs *pcs) | |||
| 270 | 270 | ||
| 271 | 271 | static void miic_unlock_regs(struct miic *miic) | |
| 272 | 272 | { | |
| 273 | - | /* Clear protection state */ | |
| 274 | - | writel(0x0000, miic->base + MIIC_PRCMD); | |
| 275 | - | ||
| 276 | 273 | /* Unprotect register writes */ | |
| 277 | 274 | writel(0x00A5, miic->base + MIIC_PRCMD); | |
| 278 | 275 | writel(0x0001, miic->base + MIIC_PRCMD); | |
modified drivers/net/pfcp.c
| @@ -65,13 +65,6 @@ static int pfcp_encap_recv(struct sock *sk, struct sk_buff *skb) | |||
| 65 | 65 | goto drop; | |
| 66 | 66 | ||
| 67 | 67 | unparsed = pfcp_hdr(skb); | |
| 68 | - | if (unparsed->flags & PFCP_SEID_FLAG) { | |
| 69 | - | if (unlikely(!pskb_may_pull(skb, PFCP_HLEN + | |
| 70 | - | offsetofend(struct pfcphdr_session, | |
| 71 | - | seid)))) | |
| 72 | - | goto drop; | |
| 73 | - | unparsed = pfcp_hdr(skb); | |
| 74 | - | } | |
| 75 | 68 | ||
| 76 | 69 | ip_tunnel_flags_zero(flags); | |
| 77 | 70 | tun_dst = udp_tun_rx_dst(skb, sk->sk_family, flags, 0, | |
| @@ -112,9 +105,6 @@ drop: | |||
| 112 | 105 | ||
| 113 | 106 | static void pfcp_del_sock(struct pfcp_dev *pfcp) | |
| 114 | 107 | { | |
| 115 | - | if (!pfcp->sk) | |
| 116 | - | return; | |
| 117 | - | ||
| 118 | 108 | udp_tunnel_sock_release(pfcp->sk); | |
| 119 | 109 | pfcp->sk = NULL; | |
| 120 | 110 | } | |
modified drivers/net/phy/aquantia/aquantia_main.c
| @@ -544,7 +544,7 @@ static int aqr_gen1_read_status(struct phy_device *phydev) | |||
| 544 | 544 | if (ret) | |
| 545 | 545 | return ret; | |
| 546 | 546 | ||
| 547 | - | if (!phydev->link) | |
| 547 | + | if (!phydev->link || phydev->autoneg == AUTONEG_DISABLE) | |
| 548 | 548 | return 0; | |
| 549 | 549 | ||
| 550 | 550 | /* The status register is not immediately correct on line side link up. | |
| @@ -594,9 +594,6 @@ static int aqr_gen1_read_status(struct phy_device *phydev) | |||
| 594 | 594 | ||
| 595 | 595 | phydev->interface = aqr_translate_interface(phydev, interface); | |
| 596 | 596 | ||
| 597 | - | if (phydev->autoneg == AUTONEG_DISABLE) | |
| 598 | - | return 0; | |
| 599 | - | ||
| 600 | 597 | /* Read rate from vendor register */ | |
| 601 | 598 | return aqr_gen1_read_rate(phydev); | |
| 602 | 599 | } | |
modified drivers/net/phy/qcom/at803x.c
| @@ -1051,15 +1051,11 @@ static int ipq5018_config_init(struct phy_device *phydev) | |||
| 1051 | 1051 | if (priv->set_short_cable_dac) { | |
| 1052 | 1052 | /* setting MDAC (Multi-level Digital-to-Analog Converter) in MMD1 */ | |
| 1053 | 1053 | phy_modify_mmd(phydev, MDIO_MMD_PMAPMD, IPQ5018_PHY_MMD1_MDAC, | |
| 1054 | - | IPQ5018_PHY_DAC_MASK, | |
| 1055 | - | FIELD_PREP(IPQ5018_PHY_DAC_MASK, | |
| 1056 | - | IPQ5018_PHY_MMD1_MDAC_VAL)); | |
| 1054 | + | IPQ5018_PHY_DAC_MASK, IPQ5018_PHY_MMD1_MDAC_VAL); | |
| 1057 | 1055 | ||
| 1058 | 1056 | /* setting EDAC (Error-detection and Correction) in debug register */ | |
| 1059 | 1057 | at803x_debug_reg_mask(phydev, IPQ5018_PHY_DEBUG_EDAC, | |
| 1060 | - | IPQ5018_PHY_DAC_MASK, | |
| 1061 | - | FIELD_PREP(IPQ5018_PHY_DAC_MASK, | |
| 1062 | - | IPQ5018_PHY_DEBUG_EDAC_VAL)); | |
| 1058 | + | IPQ5018_PHY_DAC_MASK, IPQ5018_PHY_DEBUG_EDAC_VAL); | |
| 1063 | 1059 | } | |
| 1064 | 1060 | ||
| 1065 | 1061 | return 0; | |
modified drivers/net/team/team_core.c
| @@ -820,8 +820,7 @@ static struct list_head *__team_get_qom_list(struct team *team, u16 queue_id) | |||
| 820 | 820 | /* | |
| 821 | 821 | * note: already called with rcu_read_lock | |
| 822 | 822 | */ | |
| 823 | - | static bool team_queue_override_transmit(struct team *team, struct sk_buff *skb, | |
| 824 | - | bool *tx_success) | |
| 823 | + | static bool team_queue_override_transmit(struct team *team, struct sk_buff *skb) | |
| 825 | 824 | { | |
| 826 | 825 | struct list_head *qom_list; | |
| 827 | 826 | struct team_port *port; | |
| @@ -829,11 +828,11 @@ static bool team_queue_override_transmit(struct team *team, struct sk_buff *skb, | |||
| 829 | 828 | if (!team->queue_override_enabled || !skb->queue_mapping) | |
| 830 | 829 | return false; | |
| 831 | 830 | qom_list = __team_get_qom_list(team, skb->queue_mapping); | |
| 832 | - | port = list_first_or_null_rcu(qom_list, struct team_port, qom_list); | |
| 833 | - | if (!port) | |
| 834 | - | return false; | |
| 835 | - | *tx_success = !team_dev_queue_xmit(team, port, skb); | |
| 836 | - | return true; | |
| 831 | + | list_for_each_entry_rcu(port, qom_list, qom_list) { | |
| 832 | + | if (!team_dev_queue_xmit(team, port, skb)) | |
| 833 | + | return true; | |
| 834 | + | } | |
| 835 | + | return false; | |
| 837 | 836 | } | |
| 838 | 837 | ||
| 839 | 838 | static void __team_queue_override_port_del(struct team *team, | |
| @@ -1865,7 +1864,8 @@ static netdev_tx_t team_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 1865 | 1864 | bool tx_success; | |
| 1866 | 1865 | unsigned int len = skb->len; | |
| 1867 | 1866 | ||
| 1868 | - | if (!team_queue_override_transmit(team, skb, &tx_success)) | |
| 1867 | + | tx_success = team_queue_override_transmit(team, skb); | |
| 1868 | + | if (!tx_success) | |
| 1869 | 1869 | tx_success = READ_ONCE(team->ops.transmit)(team, skb); | |
| 1870 | 1870 | if (tx_success) { | |
| 1871 | 1871 | struct team_pcpu_stats *pcpu_stats; | |
modified drivers/net/team/team_mode_broadcast.c
| @@ -37,8 +37,6 @@ static bool bc_transmit(struct team *team, struct sk_buff *skb) | |||
| 37 | 37 | ret = !team_dev_queue_xmit(team, last, skb); | |
| 38 | 38 | if (!sum_ret) | |
| 39 | 39 | sum_ret = ret; | |
| 40 | - | } else { | |
| 41 | - | dev_kfree_skb_any(skb); | |
| 42 | 40 | } | |
| 43 | 41 | return sum_ret; | |
| 44 | 42 | } | |
modified drivers/net/tun.c
| @@ -1897,7 +1897,12 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile, | |||
| 1897 | 1897 | } | |
| 1898 | 1898 | } | |
| 1899 | 1899 | ||
| 1900 | - | skb->dev = tun->dev; | |
| 1900 | + | if (tun_vnet_hdr_tnl_to_skb(tun->flags, features, skb, &hdr)) { | |
| 1901 | + | atomic_long_inc(&tun->rx_frame_errors); | |
| 1902 | + | err = -EINVAL; | |
| 1903 | + | goto free_skb; | |
| 1904 | + | } | |
| 1905 | + | ||
| 1901 | 1906 | switch (tun->flags & TUN_TYPE_MASK) { | |
| 1902 | 1907 | case IFF_TUN: | |
| 1903 | 1908 | if (tun->flags & IFF_NO_PI) { | |
| @@ -1922,8 +1927,9 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile, | |||
| 1922 | 1927 | } | |
| 1923 | 1928 | } | |
| 1924 | 1929 | ||
| 1925 | - | skb_reset_network_header(skb); | |
| 1930 | + | skb_reset_mac_header(skb); | |
| 1926 | 1931 | skb->protocol = pi.proto; | |
| 1932 | + | skb->dev = tun->dev; | |
| 1927 | 1933 | break; | |
| 1928 | 1934 | case IFF_TAP: | |
| 1929 | 1935 | if (!pskb_may_pull(skb, ETH_HLEN)) { | |
| @@ -1931,19 +1937,10 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile, | |||
| 1931 | 1937 | drop_reason = SKB_DROP_REASON_HDR_TRUNC; | |
| 1932 | 1938 | goto drop; | |
| 1933 | 1939 | } | |
| 1934 | - | skb_set_network_header(skb, ETH_HLEN); | |
| 1940 | + | skb->protocol = eth_type_trans(skb, tun->dev); | |
| 1935 | 1941 | break; | |
| 1936 | 1942 | } | |
| 1937 | 1943 | ||
| 1938 | - | if (tun_vnet_hdr_tnl_to_skb(tun->flags, features, skb, &hdr)) { | |
| 1939 | - | atomic_long_inc(&tun->rx_frame_errors); | |
| 1940 | - | err = -EINVAL; | |
| 1941 | - | goto free_skb; | |
| 1942 | - | } | |
| 1943 | - | ||
| 1944 | - | if ((tun->flags & TUN_TYPE_MASK) == IFF_TAP) | |
| 1945 | - | skb->protocol = eth_type_trans(skb, tun->dev); | |
| 1946 | - | ||
| 1947 | 1944 | /* copy skb_ubuf_info for callback when skb has no error */ | |
| 1948 | 1945 | if (zerocopy) { | |
| 1949 | 1946 | skb_zcopy_init(skb, msg_control); | |
| @@ -2603,8 +2600,6 @@ build: | |||
| 2603 | 2600 | ||
| 2604 | 2601 | features = tun_vnet_hdr_guest_features(READ_ONCE(tun->vnet_hdr_sz)); | |
| 2605 | 2602 | tnl_hdr = (struct virtio_net_hdr_v1_hash_tunnel *)gso; | |
| 2606 | - | skb->dev = tun->dev; | |
| 2607 | - | skb_set_network_header(skb, ETH_HLEN); | |
| 2608 | 2603 | if (tun_vnet_hdr_tnl_to_skb(tun->flags, features, skb, tnl_hdr)) { | |
| 2609 | 2604 | atomic_long_inc(&tun->rx_frame_errors); | |
| 2610 | 2605 | kfree_skb(skb); | |
modified drivers/net/usb/ax88179_178a.c
| @@ -1457,11 +1457,11 @@ static int ax88179_rx_fixup(struct usbnet *dev, struct sk_buff *skb) | |||
| 1457 | 1457 | return 1; | |
| 1458 | 1458 | } | |
| 1459 | 1459 | ||
| 1460 | - | ax_skb = netdev_alloc_skb_ip_align(dev->net, pkt_len - 2); | |
| 1460 | + | ax_skb = netdev_alloc_skb_ip_align(dev->net, pkt_len); | |
| 1461 | 1461 | if (!ax_skb) | |
| 1462 | 1462 | return 0; | |
| 1463 | - | skb_put(ax_skb, pkt_len - 2); | |
| 1464 | - | memcpy(ax_skb->data, skb->data + 2, pkt_len - 2); | |
| 1463 | + | skb_put(ax_skb, pkt_len); | |
| 1464 | + | memcpy(ax_skb->data, skb->data + 2, pkt_len); | |
| 1465 | 1465 | ||
| 1466 | 1466 | ax88179_rx_checksum(ax_skb, pkt_hdr); | |
| 1467 | 1467 | usbnet_skb_return(dev, ax_skb); | |
modified drivers/net/usb/qmi_wwan.c
| @@ -1455,7 +1455,6 @@ static const struct usb_device_id products[] = { | |||
| 1455 | 1455 | {QMI_QUIRK_SET_DTR(0x1546, 0x1312, 4)}, /* u-blox LARA-R6 01B */ | |
| 1456 | 1456 | {QMI_QUIRK_SET_DTR(0x1546, 0x1342, 4)}, /* u-blox LARA-L6 */ | |
| 1457 | 1457 | {QMI_QUIRK_SET_DTR(0x33f8, 0x0104, 4)}, /* Rolling RW101 RMNET */ | |
| 1458 | - | {QMI_QUIRK_SET_DTR(0x33f8, 0x9300, 8)}, /* Rolling RN947R RMNET */ | |
| 1459 | 1458 | {QMI_FIXED_INTF(0x2dee, 0x4d22, 5)}, /* MeiG Smart SRM825L */ | |
| 1460 | 1459 | {QMI_QUIRK_SET_DTR(0x2dee, 0x4d63, 0)}, /* MeiG SRM813Q w/ Modem(PPP) */ | |
| 1461 | 1460 | {QMI_QUIRK_SET_DTR(0x2dee, 0x4d64, 0)}, /* MeiG SRM813Q w/ NMEA */ | |
modified drivers/net/veth.c
| @@ -1415,7 +1415,6 @@ static int veth_open(struct net_device *dev) | |||
| 1415 | 1415 | } | |
| 1416 | 1416 | ||
| 1417 | 1417 | veth_set_xdp_features(dev); | |
| 1418 | - | veth_set_xdp_features(peer); | |
| 1419 | 1418 | ||
| 1420 | 1419 | return 0; | |
| 1421 | 1420 | } | |
modified drivers/net/virtio_net.c
| @@ -2515,8 +2515,6 @@ static void virtnet_receive_done(struct virtnet_info *vi, struct receive_queue * | |||
| 2515 | 2515 | goto frame_err; | |
| 2516 | 2516 | } | |
| 2517 | 2517 | ||
| 2518 | - | skb->dev = dev; | |
| 2519 | - | skb_set_network_header(skb, ETH_HLEN); | |
| 2520 | 2518 | if (virtio_net_hdr_tnl_to_skb(skb, &hdr->tnl_hdr, vi->rx_tnl, | |
| 2521 | 2519 | vi->rx_tnl_csum, | |
| 2522 | 2520 | virtio_is_little_endian(vi->vdev))) { | |
modified drivers/net/wireguard/noise.c
| @@ -784,11 +784,10 @@ wg_noise_handshake_consume_response(struct message_handshake_response *src, | |||
| 784 | 784 | ||
| 785 | 785 | /* Success! Copy everything to peer */ | |
| 786 | 786 | down_write(&handshake->lock); | |
| 787 | - | /* Check that the state is the same and that this is still the | |
| 788 | - | * initiation we started with, while we have an exclusive lock. | |
| 787 | + | /* It's important to check that the state is still the same, while we | |
| 788 | + | * have an exclusive lock. | |
| 789 | 789 | */ | |
| 790 | - | if (handshake->state != state || | |
| 791 | - | crypto_memneq(handshake->ephemeral_private, ephemeral_private, NOISE_PUBLIC_KEY_LEN)) { | |
| 790 | + | if (handshake->state != state) { | |
| 792 | 791 | up_write(&handshake->lock); | |
| 793 | 792 | goto fail; | |
| 794 | 793 | } | |
modified drivers/net/wireguard/queueing.h
| @@ -78,14 +78,12 @@ static inline void wg_reset_packet(struct sk_buff *skb, bool encapsulating) | |||
| 78 | 78 | u8 l4_hash = skb->l4_hash; | |
| 79 | 79 | u8 sw_hash = skb->sw_hash; | |
| 80 | 80 | u32 hash = skb->hash; | |
| 81 | - | u8 tstamp_type = skb->tstamp_type; | |
| 82 | 81 | skb_scrub_packet(skb, true); | |
| 83 | 82 | memset(&skb->headers, 0, sizeof(skb->headers)); | |
| 84 | 83 | if (encapsulating) { | |
| 85 | 84 | skb->l4_hash = l4_hash; | |
| 86 | 85 | skb->sw_hash = sw_hash; | |
| 87 | 86 | skb->hash = hash; | |
| 88 | - | skb->tstamp_type = tstamp_type; | |
| 89 | 87 | } | |
| 90 | 88 | skb->queue_mapping = 0; | |
| 91 | 89 | skb->nohdr = 0; | |
modified drivers/net/wireless/ath/ath11k/mac.c
| @@ -6716,7 +6716,6 @@ static int ath11k_mac_op_start(struct ieee80211_hw *hw) | |||
| 6716 | 6716 | ar->num_started_vdevs = 0; | |
| 6717 | 6717 | ar->num_created_vdevs = 0; | |
| 6718 | 6718 | ar->num_peers = 0; | |
| 6719 | - | ar->num_stations = 0; | |
| 6720 | 6719 | ar->allocated_vdev_map = 0; | |
| 6721 | 6720 | ||
| 6722 | 6721 | /* Configure monitor status ring with default rx_filter to get rx status | |
modified drivers/net/wireless/ath/ath12k/core.c
| @@ -1776,6 +1776,29 @@ int ath12k_core_pre_init(struct ath12k_base *ab) | |||
| 1776 | 1776 | return 0; | |
| 1777 | 1777 | } | |
| 1778 | 1778 | ||
| 1779 | + | static int ath12k_core_panic_handler(struct notifier_block *nb, | |
| 1780 | + | unsigned long action, void *data) | |
| 1781 | + | { | |
| 1782 | + | struct ath12k_base *ab = container_of(nb, struct ath12k_base, | |
| 1783 | + | panic_nb); | |
| 1784 | + | ||
| 1785 | + | return ath12k_hif_panic_handler(ab); | |
| 1786 | + | } | |
| 1787 | + | ||
| 1788 | + | static int ath12k_core_panic_notifier_register(struct ath12k_base *ab) | |
| 1789 | + | { | |
| 1790 | + | ab->panic_nb.notifier_call = ath12k_core_panic_handler; | |
| 1791 | + | ||
| 1792 | + | return atomic_notifier_chain_register(&panic_notifier_list, | |
| 1793 | + | &ab->panic_nb); | |
| 1794 | + | } | |
| 1795 | + | ||
| 1796 | + | static void ath12k_core_panic_notifier_unregister(struct ath12k_base *ab) | |
| 1797 | + | { | |
| 1798 | + | atomic_notifier_chain_unregister(&panic_notifier_list, | |
| 1799 | + | &ab->panic_nb); | |
| 1800 | + | } | |
| 1801 | + | ||
| 1779 | 1802 | static inline | |
| 1780 | 1803 | bool ath12k_core_hw_group_create_ready(struct ath12k_hw_group *ag) | |
| 1781 | 1804 | { | |
| @@ -2191,13 +2214,18 @@ int ath12k_core_init(struct ath12k_base *ab) | |||
| 2191 | 2214 | struct ath12k_hw_group *ag; | |
| 2192 | 2215 | int ret; | |
| 2193 | 2216 | ||
| 2217 | + | ret = ath12k_core_panic_notifier_register(ab); | |
| 2218 | + | if (ret) | |
| 2219 | + | ath12k_warn(ab, "failed to register panic handler: %d\n", ret); | |
| 2220 | + | ||
| 2194 | 2221 | mutex_lock(&ath12k_hw_group_mutex); | |
| 2195 | 2222 | ||
| 2196 | 2223 | ag = ath12k_core_hw_group_assign(ab); | |
| 2197 | 2224 | if (!ag) { | |
| 2198 | 2225 | mutex_unlock(&ath12k_hw_group_mutex); | |
| 2199 | 2226 | ath12k_warn(ab, "unable to get hw group\n"); | |
| 2200 | - | return -ENODEV; | |
| 2227 | + | ret = -ENODEV; | |
| 2228 | + | goto err_unregister_notifier; | |
| 2201 | 2229 | } | |
| 2202 | 2230 | ||
| 2203 | 2231 | mutex_unlock(&ath12k_hw_group_mutex); | |
| @@ -2222,6 +2250,8 @@ int ath12k_core_init(struct ath12k_base *ab) | |||
| 2222 | 2250 | ||
| 2223 | 2251 | err_unassign_hw_group: | |
| 2224 | 2252 | ath12k_core_hw_group_unassign(ab); | |
| 2253 | + | err_unregister_notifier: | |
| 2254 | + | ath12k_core_panic_notifier_unregister(ab); | |
| 2225 | 2255 | ||
| 2226 | 2256 | return ret; | |
| 2227 | 2257 | } | |
| @@ -2230,6 +2260,7 @@ void ath12k_core_deinit(struct ath12k_base *ab) | |||
| 2230 | 2260 | { | |
| 2231 | 2261 | ath12k_core_hw_group_destroy(ab->ag); | |
| 2232 | 2262 | ath12k_core_hw_group_unassign(ab); | |
| 2263 | + | ath12k_core_panic_notifier_unregister(ab); | |
| 2233 | 2264 | } | |
| 2234 | 2265 | ||
| 2235 | 2266 | void ath12k_core_free(struct ath12k_base *ab) | |
modified drivers/net/wireless/ath/ath12k/core.h
| @@ -15,6 +15,7 @@ | |||
| 15 | 15 | #include <linux/ctype.h> | |
| 16 | 16 | #include <linux/firmware.h> | |
| 17 | 17 | #include <linux/of_reserved_mem.h> | |
| 18 | + | #include <linux/panic_notifier.h> | |
| 18 | 19 | #include <linux/average.h> | |
| 19 | 20 | #include <linux/of.h> | |
| 20 | 21 | #include <linux/rhashtable.h> | |
| @@ -1138,6 +1139,8 @@ struct ath12k_base { | |||
| 1138 | 1139 | ||
| 1139 | 1140 | #endif /* CONFIG_ACPI */ | |
| 1140 | 1141 | ||
| 1142 | + | struct notifier_block panic_nb; | |
| 1143 | + | ||
| 1141 | 1144 | struct ath12k_hw_group *ag; | |
| 1142 | 1145 | struct ath12k_wsi_info wsi_info; | |
| 1143 | 1146 | enum ath12k_qmi_firmware_mode fw_mode; | |
modified drivers/net/wireless/ath/ath12k/hif.h
| @@ -30,6 +30,7 @@ struct ath12k_hif_ops { | |||
| 30 | 30 | void (*ce_irq_enable)(struct ath12k_base *ab); | |
| 31 | 31 | void (*ce_irq_disable)(struct ath12k_base *ab); | |
| 32 | 32 | void (*get_ce_msi_idx)(struct ath12k_base *ab, u32 ce_id, u32 *msi_idx); | |
| 33 | + | int (*panic_handler)(struct ath12k_base *ab); | |
| 33 | 34 | void (*coredump_download)(struct ath12k_base *ab); | |
| 34 | 35 | }; | |
| 35 | 36 | ||
| @@ -148,6 +149,14 @@ static inline void ath12k_hif_power_down(struct ath12k_base *ab, bool is_suspend | |||
| 148 | 149 | ab->hif.ops->power_down(ab, is_suspend); | |
| 149 | 150 | } | |
| 150 | 151 | ||
| 152 | + | static inline int ath12k_hif_panic_handler(struct ath12k_base *ab) | |
| 153 | + | { | |
| 154 | + | if (!ab->hif.ops->panic_handler) | |
| 155 | + | return NOTIFY_DONE; | |
| 156 | + | ||
| 157 | + | return ab->hif.ops->panic_handler(ab); | |
| 158 | + | } | |
| 159 | + | ||
| 151 | 160 | static inline void ath12k_hif_coredump_download(struct ath12k_base *ab) | |
| 152 | 161 | { | |
| 153 | 162 | if (ab->hif.ops->coredump_download) | |
modified drivers/net/wireless/ath/ath12k/pci.c
| @@ -1484,6 +1484,13 @@ void ath12k_pci_power_down(struct ath12k_base *ab, bool is_suspend) | |||
| 1484 | 1484 | ath12k_pci_sw_reset(ab_pci->ab, false); | |
| 1485 | 1485 | } | |
| 1486 | 1486 | ||
| 1487 | + | static int ath12k_pci_panic_handler(struct ath12k_base *ab) | |
| 1488 | + | { | |
| 1489 | + | ath12k_pci_sw_reset(ab, false); | |
| 1490 | + | ||
| 1491 | + | return NOTIFY_OK; | |
| 1492 | + | } | |
| 1493 | + | ||
| 1487 | 1494 | static const struct ath12k_hif_ops ath12k_pci_hif_ops = { | |
| 1488 | 1495 | .start = ath12k_pci_start, | |
| 1489 | 1496 | .stop = ath12k_pci_stop, | |
| @@ -1501,6 +1508,7 @@ static const struct ath12k_hif_ops ath12k_pci_hif_ops = { | |||
| 1501 | 1508 | .ce_irq_enable = ath12k_pci_hif_ce_irq_enable, | |
| 1502 | 1509 | .ce_irq_disable = ath12k_pci_hif_ce_irq_disable, | |
| 1503 | 1510 | .get_ce_msi_idx = ath12k_pci_get_ce_msi_idx, | |
| 1511 | + | .panic_handler = ath12k_pci_panic_handler, | |
| 1504 | 1512 | #ifdef CONFIG_ATH12K_COREDUMP | |
| 1505 | 1513 | .coredump_download = ath12k_pci_coredump_download, | |
| 1506 | 1514 | #endif | |
modified drivers/net/wireless/ath/ath9k/hif_usb.c
| @@ -14,7 +14,6 @@ | |||
| 14 | 14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
| 15 | 15 | */ | |
| 16 | 16 | ||
| 17 | - | #include <linux/math.h> | |
| 18 | 17 | #include <linux/unaligned.h> | |
| 19 | 18 | #include "htc.h" | |
| 20 | 19 | ||
| @@ -329,14 +328,11 @@ static int __hif_usb_tx(struct hif_device_usb *hif_dev) | |||
| 329 | 328 | tx_skb_cnt = min_t(u16, hif_dev->tx.tx_skb_cnt, MAX_TX_AGGR_NUM); | |
| 330 | 329 | ||
| 331 | 330 | for (i = 0; i < tx_skb_cnt; i++) { | |
| 332 | - | nskb = skb_peek(&hif_dev->tx.tx_skb_queue); | |
| 333 | - | if (!nskb) | |
| 334 | - | break; | |
| 331 | + | nskb = __skb_dequeue(&hif_dev->tx.tx_skb_queue); | |
| 335 | 332 | ||
| 336 | - | if (tx_buf->offset + nskb->len + 4 > MAX_TX_BUF_SIZE) | |
| 337 | - | break; | |
| 333 | + | /* Should never be NULL */ | |
| 334 | + | BUG_ON(!nskb); | |
| 338 | 335 | ||
| 339 | - | nskb = __skb_dequeue(&hif_dev->tx.tx_skb_queue); | |
| 340 | 336 | hif_dev->tx.tx_skb_cnt--; | |
| 341 | 337 | ||
| 342 | 338 | buf = tx_buf->buf; | |
| @@ -346,8 +342,13 @@ static int __hif_usb_tx(struct hif_device_usb *hif_dev) | |||
| 346 | 342 | *hdr++ = cpu_to_le16(ATH_USB_TX_STREAM_MODE_TAG); | |
| 347 | 343 | buf += 4; | |
| 348 | 344 | memcpy(buf, nskb->data, nskb->len); | |
| 349 | - | tx_buf->len = tx_buf->offset + nskb->len + 4; | |
| 350 | - | tx_buf->offset += round_up(nskb->len + 4, 4); | |
| 345 | + | tx_buf->len = nskb->len + 4; | |
| 346 | + | ||
| 347 | + | if (i < (tx_skb_cnt - 1)) | |
| 348 | + | tx_buf->offset += (((tx_buf->len - 1) / 4) + 1) * 4; | |
| 349 | + | ||
| 350 | + | if (i == (tx_skb_cnt - 1)) | |
| 351 | + | tx_buf->len += tx_buf->offset; | |
| 351 | 352 | ||
| 352 | 353 | __skb_queue_tail(&tx_buf->skb_queue, nskb); | |
| 353 | 354 | TX_STAT_INC(hif_dev, skb_queued); | |
modified drivers/net/wireless/ath/ath9k/htc.h
| @@ -281,6 +281,7 @@ struct ath9k_htc_rxbuf { | |||
| 281 | 281 | struct ath9k_htc_rx { | |
| 282 | 282 | struct list_head rxbuf; | |
| 283 | 283 | spinlock_t rxbuflock; | |
| 284 | + | bool initialized; | |
| 284 | 285 | }; | |
| 285 | 286 | ||
| 286 | 287 | #define ATH9K_HTC_TX_CLEANUP_INTERVAL 50 /* ms */ | |
modified drivers/net/wireless/ath/ath9k/htc_drv_init.c
| @@ -910,9 +910,6 @@ static int ath9k_init_device(struct ath9k_htc_priv *priv, | |||
| 910 | 910 | ath9k_init_leds(priv); | |
| 911 | 911 | ath9k_start_rfkill_poll(priv); | |
| 912 | 912 | ||
| 913 | - | /* signal completion to ath9k_htc_rxep() and ath9k_wmi_event_tasklet() */ | |
| 914 | - | smp_store_release(&priv->initialized, true); | |
| 915 | - | ||
| 916 | 913 | return 0; | |
| 917 | 914 | ||
| 918 | 915 | err_world: | |
| @@ -969,6 +966,10 @@ int ath9k_htc_probe_device(struct htc_target *htc_handle, struct device *dev, | |||
| 969 | 966 | ||
| 970 | 967 | htc_handle->drv_priv = priv; | |
| 971 | 968 | ||
| 969 | + | /* Allow ath9k_wmi_event_tasklet() to operate. */ | |
| 970 | + | smp_wmb(); | |
| 971 | + | priv->initialized = true; | |
| 972 | + | ||
| 972 | 973 | return 0; | |
| 973 | 974 | ||
| 974 | 975 | err_init: | |
modified drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
| @@ -1141,8 +1141,8 @@ void ath9k_htc_rxep(void *drv_priv, struct sk_buff *skb, | |||
| 1141 | 1141 | struct ath9k_htc_rxbuf *rxbuf = NULL, *tmp_buf = NULL; | |
| 1142 | 1142 | unsigned long flags; | |
| 1143 | 1143 | ||
| 1144 | - | /* Check if ath9k_init_device() completed. */ | |
| 1145 | - | if (!smp_load_acquire(&priv->initialized)) | |
| 1144 | + | /* Check if ath9k_rx_init() completed. */ | |
| 1145 | + | if (!data_race(priv->rx.initialized)) | |
| 1146 | 1146 | goto err; | |
| 1147 | 1147 | ||
| 1148 | 1148 | spin_lock_irqsave(&priv->rx.rxbuflock, flags); | |
| @@ -1200,6 +1200,10 @@ int ath9k_rx_init(struct ath9k_htc_priv *priv) | |||
| 1200 | 1200 | list_add_tail(&rxbuf->list, &priv->rx.rxbuf); | |
| 1201 | 1201 | } | |
| 1202 | 1202 | ||
| 1203 | + | /* Allow ath9k_htc_rxep() to operate. */ | |
| 1204 | + | smp_wmb(); | |
| 1205 | + | priv->rx.initialized = true; | |
| 1206 | + | ||
| 1203 | 1207 | return 0; | |
| 1204 | 1208 | ||
| 1205 | 1209 | err: | |
modified drivers/net/wireless/ath/ath9k/wmi.c
| @@ -146,12 +146,6 @@ void ath9k_wmi_event_tasklet(struct tasklet_struct *t) | |||
| 146 | 146 | unsigned long flags; | |
| 147 | 147 | u16 cmd_id; | |
| 148 | 148 | ||
| 149 | - | /* Check if ath9k_init_device() completed. */ | |
| 150 | - | if (!smp_load_acquire(&priv->initialized)) { | |
| 151 | - | tasklet_schedule(t); | |
| 152 | - | return; | |
| 153 | - | } | |
| 154 | - | ||
| 155 | 149 | do { | |
| 156 | 150 | spin_lock_irqsave(&wmi->wmi_lock, flags); | |
| 157 | 151 | skb = __skb_dequeue(&wmi->wmi_event_queue); | |
| @@ -161,6 +155,12 @@ void ath9k_wmi_event_tasklet(struct tasklet_struct *t) | |||
| 161 | 155 | } | |
| 162 | 156 | spin_unlock_irqrestore(&wmi->wmi_lock, flags); | |
| 163 | 157 | ||
| 158 | + | /* Check if ath9k_htc_probe_device() completed. */ | |
| 159 | + | if (!data_race(priv->initialized)) { | |
| 160 | + | kfree_skb(skb); | |
| 161 | + | continue; | |
| 162 | + | } | |
| 163 | + | ||
| 164 | 164 | hdr = (struct wmi_cmd_hdr *) skb->data; | |
| 165 | 165 | cmd_id = be16_to_cpu(hdr->command_id); | |
| 166 | 166 | wmi_event = skb_pull(skb, sizeof(struct wmi_cmd_hdr)); | |
| @@ -206,16 +206,9 @@ static void ath9k_wmi_rsp_callback(struct wmi *wmi, struct sk_buff *skb) | |||
| 206 | 206 | { | |
| 207 | 207 | skb_pull(skb, sizeof(struct wmi_cmd_hdr)); | |
| 208 | 208 | ||
| 209 | - | if (wmi->cmd_rsp_buf && wmi->cmd_rsp_len) { | |
| 210 | - | if (skb->len < wmi->cmd_rsp_len) { | |
| 211 | - | wmi->cmd_rsp_status = -EMSGSIZE; | |
| 212 | - | goto complete; | |
| 213 | - | } | |
| 209 | + | if (wmi->cmd_rsp_buf != NULL && wmi->cmd_rsp_len != 0) | |
| 214 | 210 | memcpy(wmi->cmd_rsp_buf, skb->data, wmi->cmd_rsp_len); | |
| 215 | - | } | |
| 216 | - | wmi->cmd_rsp_status = 0; | |
| 217 | 211 | ||
| 218 | - | complete: | |
| 219 | 212 | complete(&wmi->cmd_wait); | |
| 220 | 213 | } | |
| 221 | 214 | ||
| @@ -307,7 +300,6 @@ static int ath9k_wmi_cmd_issue(struct wmi *wmi, | |||
| 307 | 300 | /* record the rsp buffer and length */ | |
| 308 | 301 | wmi->cmd_rsp_buf = rsp_buf; | |
| 309 | 302 | wmi->cmd_rsp_len = rsp_len; | |
| 310 | - | wmi->cmd_rsp_status = 0; | |
| 311 | 303 | ||
| 312 | 304 | wmi->last_seq_id = wmi->tx_seq_id; | |
| 313 | 305 | spin_unlock_irqrestore(&wmi->wmi_lock, flags); | |
| @@ -364,13 +356,9 @@ int ath9k_wmi_cmd(struct wmi *wmi, enum wmi_cmd_id cmd_id, | |||
| 364 | 356 | return -ETIMEDOUT; | |
| 365 | 357 | } | |
| 366 | 358 | ||
| 367 | - | spin_lock_irqsave(&wmi->wmi_lock, flags); | |
| 368 | - | ret = wmi->cmd_rsp_status; | |
| 369 | - | spin_unlock_irqrestore(&wmi->wmi_lock, flags); | |
| 370 | - | ||
| 371 | 359 | mutex_unlock(&wmi->op_mutex); | |
| 372 | 360 | ||
| 373 | - | return ret; | |
| 361 | + | return 0; | |
| 374 | 362 | ||
| 375 | 363 | out: | |
| 376 | 364 | ath_dbg(common, WMI, "WMI failure for: %s\n", wmi_cmd_to_name(cmd_id)); | |
modified drivers/net/wireless/ath/ath9k/wmi.h
| @@ -157,7 +157,6 @@ struct wmi { | |||
| 157 | 157 | u16 tx_seq_id; | |
| 158 | 158 | u8 *cmd_rsp_buf; | |
| 159 | 159 | u32 cmd_rsp_len; | |
| 160 | - | int cmd_rsp_status; | |
| 161 | 160 | bool stopped; | |
| 162 | 161 | ||
| 163 | 162 | struct list_head pending_tx_events; | |
modified drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
| @@ -1489,31 +1489,8 @@ void brcmf_detach(struct device *dev) | |||
| 1489 | 1489 | brcmf_bus_change_state(bus_if, BRCMF_BUS_DOWN); | |
| 1490 | 1490 | /* make sure primary interface removed last */ | |
| 1491 | 1491 | for (i = BRCMF_MAX_IFS - 1; i > -1; i--) { | |
| 1492 | - | struct brcmf_if *ifp = drvr->iflist[i]; | |
| 1493 | - | ||
| 1494 | - | if (!ifp) | |
| 1495 | - | continue; | |
| 1496 | - | ||
| 1497 | - | if (ifp->ndev) { | |
| 1498 | - | brcmf_remove_interface(ifp, false); | |
| 1499 | - | continue; | |
| 1500 | - | } | |
| 1501 | - | ||
| 1502 | - | /* The P2P device interface has no netdev. Its removal can | |
| 1503 | - | * race with NL80211_CMD_DEL_INTERFACE issued by a user space | |
| 1504 | - | * process that is exiting (e.g. wpa_supplicant), which ends | |
| 1505 | - | * in brcmf_p2p_del_vif() under RTNL and the wiphy mutex. If | |
| 1506 | - | * both paths remove the interface, the wdev is unregistered | |
| 1507 | - | * twice and the vif is used after being freed. Take the same | |
| 1508 | - | * locks and re-read iflist, so only one path removes it. | |
| 1509 | - | */ | |
| 1510 | - | rtnl_lock(); | |
| 1511 | - | wiphy_lock(drvr->wiphy); | |
| 1512 | - | ifp = drvr->iflist[i]; | |
| 1513 | - | if (ifp) | |
| 1514 | - | brcmf_remove_interface(ifp, true); | |
| 1515 | - | wiphy_unlock(drvr->wiphy); | |
| 1516 | - | rtnl_unlock(); | |
| 1492 | + | if (drvr->iflist[i]) | |
| 1493 | + | brcmf_remove_interface(drvr->iflist[i], false); | |
| 1517 | 1494 | } | |
| 1518 | 1495 | brcmf_bus_stop(drvr->bus_if); | |
| 1519 | 1496 | ||
modified drivers/net/wireless/intel/iwlegacy/3945-mac.c
| @@ -3807,7 +3807,6 @@ il3945_pci_remove(struct pci_dev *pdev) | |||
| 3807 | 3807 | ||
| 3808 | 3808 | il_free_channel_map(il); | |
| 3809 | 3809 | il_free_geos(il); | |
| 3810 | - | il_eeprom_free(il); | |
| 3811 | 3810 | kfree(il->scan_cmd); | |
| 3812 | 3811 | dev_kfree_skb(il->beacon_skb); | |
| 3813 | 3812 | ieee80211_free_hw(il->hw); | |
modified drivers/net/wireless/intersil/p54/fwio.c
| @@ -52,13 +52,6 @@ int p54_parse_firmware(struct ieee80211_hw *dev, const struct firmware *fw) | |||
| 52 | 52 | u32 code = le32_to_cpu(bootrec->code); | |
| 53 | 53 | switch (code) { | |
| 54 | 54 | case BR_CODE_COMPONENT_ID: | |
| 55 | - | if (len < sizeof(struct bootrec_comp_id) / | |
| 56 | - | sizeof(*bootrec->data)) { | |
| 57 | - | wiphy_err(priv->hw->wiphy, | |
| 58 | - | "firmware component ID is too short\n"); | |
| 59 | - | return -EINVAL; | |
| 60 | - | } | |
| 61 | - | ||
| 62 | 55 | priv->fw_interface = be32_to_cpup((__be32 *) | |
| 63 | 56 | bootrec->data); | |
| 64 | 57 | switch (priv->fw_interface) { | |
| @@ -79,41 +72,16 @@ int p54_parse_firmware(struct ieee80211_hw *dev, const struct firmware *fw) | |||
| 79 | 72 | } | |
| 80 | 73 | break; | |
| 81 | 74 | case BR_CODE_COMPONENT_VERSION: | |
| 82 | - | if (len < DIV_ROUND_UP(sizeof(struct bootrec_comp_ver), | |
| 83 | - | sizeof(*bootrec->data))) { | |
| 84 | - | wiphy_err(priv->hw->wiphy, | |
| 85 | - | "firmware component version is too short\n"); | |
| 86 | - | return -EINVAL; | |
| 87 | - | } | |
| 88 | - | ||
| 89 | 75 | /* 24 bytes should be enough for all firmwares */ | |
| 90 | - | if (strnlen((unsigned char *)bootrec->data, | |
| 91 | - | sizeof(struct bootrec_comp_ver)) < | |
| 92 | - | sizeof(struct bootrec_comp_ver)) | |
| 93 | - | fw_version = (unsigned char *)bootrec->data; | |
| 76 | + | if (strnlen((unsigned char *) bootrec->data, 24) < 24) | |
| 77 | + | fw_version = (unsigned char *) bootrec->data; | |
| 94 | 78 | break; | |
| 95 | 79 | case BR_CODE_DESCR: { | |
| 96 | 80 | struct bootrec_desc *desc = | |
| 97 | 81 | (struct bootrec_desc *)bootrec->data; | |
| 98 | - | u32 rx_start, rx_end; | |
| 99 | - | ||
| 100 | - | /* 0xa is the shortest descriptor in supported firmware. */ | |
| 101 | - | if (len < 0xa) { | |
| 102 | - | wiphy_err(priv->hw->wiphy, | |
| 103 | - | "firmware descriptor is too short\n"); | |
| 104 | - | return -EINVAL; | |
| 105 | - | } | |
| 106 | - | ||
| 107 | - | rx_start = le32_to_cpu(desc->rx_start); | |
| 108 | - | rx_end = le32_to_cpu(desc->rx_end); | |
| 109 | - | if (rx_end < 0x3500 || rx_end - 0x3500 <= rx_start) { | |
| 110 | - | wiphy_err(priv->hw->wiphy, | |
| 111 | - | "firmware descriptor has invalid RX range\n"); | |
| 112 | - | return -EINVAL; | |
| 113 | - | } | |
| 114 | - | ||
| 115 | - | priv->rx_start = rx_start; | |
| 116 | - | priv->rx_end = rx_end - 0x3500; | |
| 82 | + | priv->rx_start = le32_to_cpu(desc->rx_start); | |
| 83 | + | /* FIXME add sanity checking */ | |
| 84 | + | priv->rx_end = le32_to_cpu(desc->rx_end) - 0x3500; | |
| 117 | 85 | priv->headroom = desc->headroom; | |
| 118 | 86 | priv->tailroom = desc->tailroom; | |
| 119 | 87 | priv->privacy_caps = desc->privacy_caps; | |
modified drivers/net/wireless/marvell/libertas/tx.c
| @@ -117,6 +117,13 @@ netdev_tx_t lbs_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 117 | 117 | if (priv->wdev->iftype == NL80211_IFTYPE_MONITOR) { | |
| 118 | 118 | struct tx_radiotap_hdr *rtap_hdr = (void *)skb->data; | |
| 119 | 119 | ||
| 120 | + | if (skb->len < sizeof(*rtap_hdr) + 4 + ETH_ALEN) { | |
| 121 | + | lbs_deb_tx("tx err: short monitor frame %u\n", skb->len); | |
| 122 | + | dev->stats.tx_dropped++; | |
| 123 | + | dev->stats.tx_errors++; | |
| 124 | + | goto free; | |
| 125 | + | } | |
| 126 | + | ||
| 120 | 127 | /* set txpd fields from the radiotap header */ | |
| 121 | 128 | txpd->tx_control = cpu_to_le32(convert_radiotap_rate_to_mv(rtap_hdr->rate)); | |
| 122 | 129 | ||
modified drivers/net/wireless/mediatek/mt76/mt76.h
| @@ -1426,13 +1426,6 @@ mtxq_to_txq(struct mt76_txq *mtxq) | |||
| 1426 | 1426 | return container_of(ptr, struct ieee80211_txq, drv_priv); | |
| 1427 | 1427 | } | |
| 1428 | 1428 | ||
| 1429 | - | /* peer-wide state uses the wcid of the primary link */ | |
| 1430 | - | static inline struct mt76_wcid * | |
| 1431 | - | mt76_wcid_primary(struct mt76_wcid *wcid) | |
| 1432 | - | { | |
| 1433 | - | return wcid->def_wcid ? wcid->def_wcid : wcid; | |
| 1434 | - | } | |
| 1435 | - | ||
| 1436 | 1429 | static inline struct ieee80211_sta * | |
| 1437 | 1430 | wcid_to_sta(struct mt76_wcid *wcid) | |
| 1438 | 1431 | { | |
modified drivers/net/wireless/mediatek/mt76/mt7603/init.c
| @@ -230,7 +230,6 @@ mt7603_mac_init(struct mt7603_dev *dev) | |||
| 230 | 230 | ||
| 231 | 231 | eth_broadcast_addr(bc_addr); | |
| 232 | 232 | mt7603_wtbl_init(dev, MT7603_WTBL_RESERVED, -1, bc_addr); | |
| 233 | - | mt76_wcid_init(&dev->global_sta.wcid, 0); | |
| 234 | 233 | dev->global_sta.wcid.idx = MT7603_WTBL_RESERVED; | |
| 235 | 234 | rcu_assign_pointer(dev->mt76.wcid[MT7603_WTBL_RESERVED], | |
| 236 | 235 | &dev->global_sta.wcid); | |
modified drivers/net/wireless/mediatek/mt76/mt7915/init.c
| @@ -1238,12 +1238,6 @@ static void mt7915_unregister_ext_phy(struct mt7915_dev *dev) | |||
| 1238 | 1238 | ||
| 1239 | 1239 | static void mt7915_stop_hardware(struct mt7915_dev *dev) | |
| 1240 | 1240 | { | |
| 1241 | - | int i; | |
| 1242 | - | ||
| 1243 | - | mt76_for_each_q_rx(&dev->mt76, i) { | |
| 1244 | - | if (!mt76_queue_is_wed_rro(&dev->mt76.q_rx[i])) | |
| 1245 | - | napi_disable(&dev->mt76.napi[i]); | |
| 1246 | - | } | |
| 1247 | 1241 | mt7915_mcu_exit(dev); | |
| 1248 | 1242 | mt76_connac2_tx_token_put(&dev->mt76); | |
| 1249 | 1243 | mt7915_dma_cleanup(dev); | |
modified drivers/net/wireless/mediatek/mt76/mt7915/main.c
| @@ -805,7 +805,6 @@ __mt7915_drop_sta(void *ptr, u8 *mac, struct ieee80211_vif *vif) | |||
| 805 | 805 | ||
| 806 | 806 | msta = (struct mt7915_sta *)sta->drv_priv; | |
| 807 | 807 | mt7915_mcu_add_sta(data->dev, vif, sta, CONN_STATE_DISCONNECT, false); | |
| 808 | - | msta->wcid.tx_info &= ~MT_WCID_TX_INFO_SET; | |
| 809 | 808 | msta->wcid.sta_disabled = 1; | |
| 810 | 809 | msta->wcid.sta = 0; | |
| 811 | 810 | } | |
| @@ -872,7 +871,6 @@ int mt7915_mac_sta_event(struct mt76_dev *mdev, struct ieee80211_vif *vif, | |||
| 872 | 871 | mutex_unlock(&dev->mt76.mutex); | |
| 873 | 872 | ||
| 874 | 873 | mt7915_mcu_add_sta(dev, vif, sta, CONN_STATE_DISCONNECT, false); | |
| 875 | - | msta->wcid.tx_info &= ~MT_WCID_TX_INFO_SET; | |
| 876 | 874 | msta->wcid.sta_disabled = 1; | |
| 877 | 875 | msta->wcid.sta = 0; | |
| 878 | 876 | return 0; | |
modified drivers/net/wireless/mediatek/mt76/mt7925/mac.c
| @@ -798,8 +798,7 @@ mt7925_mac_write_txwi(struct mt76_dev *dev, __le32 *txwi, | |||
| 798 | 798 | val = FIELD_PREP(MT_TXD1_WLAN_IDX, wcid->idx) | | |
| 799 | 799 | FIELD_PREP(MT_TXD1_OWN_MAC, omac_idx); | |
| 800 | 800 | ||
| 801 | - | /* 0xff means BAND_AUTO to the firmware, and TGID cannot encode it */ | |
| 802 | - | if (band_idx && band_idx != 0xff) | |
| 801 | + | if (band_idx) | |
| 803 | 802 | val |= FIELD_PREP(MT_TXD1_TGID, band_idx); | |
| 804 | 803 | ||
| 805 | 804 | txwi[1] = cpu_to_le32(val); | |
modified drivers/net/wireless/mediatek/mt76/mt7925/main.c
| @@ -2294,18 +2294,6 @@ mt7925_change_vif_links(struct ieee80211_hw *hw, struct ieee80211_vif *vif, | |||
| 2294 | 2294 | ||
| 2295 | 2295 | mvif->valid_links = new_links; | |
| 2296 | 2296 | ||
| 2297 | - | /* Restore the legacy BSS after disabling MLO */ | |
| 2298 | - | if (old_links && !new_links) { | |
| 2299 | - | mt792x_mac_link_bss_remove(dev, &mvif->bss_conf, | |
| 2300 | - | &mvif->sta.deflink); | |
| 2301 | - | err = mt7925_mac_link_bss_add(dev, &vif->bss_conf, | |
| 2302 | - | &mvif->sta.deflink); | |
| 2303 | - | if (err < 0) { | |
| 2304 | - | mt792x_mutex_release(dev); | |
| 2305 | - | return err; | |
| 2306 | - | } | |
| 2307 | - | } | |
| 2308 | - | ||
| 2309 | 2297 | mt792x_mutex_release(dev); | |
| 2310 | 2298 | ||
| 2311 | 2299 | return 0; | |
modified drivers/net/wireless/mediatek/mt76/mt792x_acpi_sar.c
| @@ -108,98 +108,68 @@ mt792x_asar_acpi_read_mtcl(struct mt792x_dev *dev, u8 **table, u8 *version) | |||
| 108 | 108 | return ret; | |
| 109 | 109 | } | |
| 110 | 110 | ||
| 111 | - | /* A table's layout is decided by the version byte in MTCL, but some firmware | |
| 112 | - | * labels a version 2 table as version 1. Accept whichever layout the table | |
| 113 | - | * actually has: for every accepted entry count the two do not overlap, since | |
| 114 | - | * one is 6 + 5n bytes and the other 7 + 7n. | |
| 115 | - | */ | |
| 116 | - | static bool | |
| 117 | - | mt792x_asar_fits(u8 *table, int len, int prelen, int sarlen, int nr_off, | |
| 118 | - | int min, int max) | |
| 119 | - | { | |
| 120 | - | int tblcnt; | |
| 121 | - | ||
| 122 | - | if (len < prelen || (len - prelen) % sarlen) | |
| 123 | - | return false; | |
| 124 | - | ||
| 125 | - | tblcnt = (len - prelen) / sarlen; | |
| 126 | - | if (tblcnt < min || tblcnt > max) | |
| 127 | - | return false; | |
| 128 | - | ||
| 129 | - | return tblcnt == table[nr_off]; | |
| 130 | - | } | |
| 131 | - | ||
| 132 | 111 | /* MTDS : Dynamic SAR Power Table */ | |
| 133 | 112 | static int | |
| 134 | - | mt792x_asar_acpi_read_mtds(struct mt792x_dev *dev, u8 **table, u8 version, | |
| 135 | - | u8 *used) | |
| 113 | + | mt792x_asar_acpi_read_mtds(struct mt792x_dev *dev, u8 **table, u8 version) | |
| 136 | 114 | { | |
| 137 | - | int len, ret; | |
| 138 | - | u8 *t; | |
| 115 | + | int len, ret, sarlen, prelen, tblcnt; | |
| 116 | + | bool enable; | |
| 139 | 117 | ||
| 140 | 118 | ret = mt792x_acpi_read(dev, MT792x_ACPI_MTDS, table, &len); | |
| 141 | 119 | if (ret) | |
| 142 | 120 | return ret; | |
| 143 | 121 | ||
| 144 | - | t = *table; | |
| 145 | - | ||
| 146 | 122 | /* Table content validation */ | |
| 147 | - | if (mt792x_asar_fits(t, len, sizeof(struct mt792x_asar_dyn), | |
| 148 | - | sizeof(struct mt792x_asar_dyn_limit), | |
| 149 | - | offsetof(struct mt792x_asar_dyn, nr_tbl), | |
| 150 | - | MT792x_ASAR_MIN_DYN, MT792x_ASAR_MAX_DYN)) | |
| 151 | - | *used = 1; | |
| 152 | - | else if (mt792x_asar_fits(t, len, sizeof(struct mt792x_asar_dyn_v2), | |
| 153 | - | sizeof(struct mt792x_asar_dyn_limit_v2), | |
| 154 | - | offsetof(struct mt792x_asar_dyn_v2, nr_tbl), | |
| 155 | - | MT792x_ASAR_MIN_DYN, MT792x_ASAR_MAX_DYN)) | |
| 156 | - | *used = 2; | |
| 157 | - | else | |
| 123 | + | switch (version) { | |
| 124 | + | case 1: | |
| 125 | + | enable = ((struct mt792x_asar_dyn *)*table)->enable; | |
| 126 | + | sarlen = sizeof(struct mt792x_asar_dyn_limit); | |
| 127 | + | prelen = sizeof(struct mt792x_asar_dyn); | |
| 128 | + | break; | |
| 129 | + | case 2: | |
| 130 | + | enable = ((struct mt792x_asar_dyn_v2 *)*table)->enable; | |
| 131 | + | sarlen = sizeof(struct mt792x_asar_dyn_limit_v2); | |
| 132 | + | prelen = sizeof(struct mt792x_asar_dyn_v2); | |
| 133 | + | break; | |
| 134 | + | default: | |
| 158 | 135 | return -EINVAL; | |
| 136 | + | } | |
| 159 | 137 | ||
| 160 | - | if (!t[offsetof(struct mt792x_asar_dyn, enable)]) | |
| 138 | + | tblcnt = (len - prelen) / sarlen; | |
| 139 | + | if (!enable || | |
| 140 | + | tblcnt > MT792x_ASAR_MAX_DYN || tblcnt < MT792x_ASAR_MIN_DYN) | |
| 161 | 141 | return -EINVAL; | |
| 162 | 142 | ||
| 163 | - | if (version && *used != version) | |
| 164 | - | dev_info(dev->mt76.dev, | |
| 165 | - | "MTDS is v%u, MTCL says v%u; using v%u\n", | |
| 166 | - | *used, version, *used); | |
| 167 | - | ||
| 168 | 143 | return 0; | |
| 169 | 144 | } | |
| 170 | 145 | ||
| 171 | 146 | /* MTGS : Geo SAR Power Table */ | |
| 172 | 147 | static int | |
| 173 | - | mt792x_asar_acpi_read_mtgs(struct mt792x_dev *dev, u8 **table, u8 version, | |
| 174 | - | u8 *used) | |
| 148 | + | mt792x_asar_acpi_read_mtgs(struct mt792x_dev *dev, u8 **table, u8 version) | |
| 175 | 149 | { | |
| 176 | - | int len, ret; | |
| 177 | - | u8 *t; | |
| 150 | + | int len, ret, sarlen, prelen, tblcnt; | |
| 178 | 151 | ||
| 179 | 152 | ret = mt792x_acpi_read(dev, MT792x_ACPI_MTGS, table, &len); | |
| 180 | 153 | if (ret) | |
| 181 | 154 | return ret; | |
| 182 | 155 | ||
| 183 | - | t = *table; | |
| 184 | - | ||
| 185 | 156 | /* Table content validation */ | |
| 186 | - | if (mt792x_asar_fits(t, len, sizeof(struct mt792x_asar_geo), | |
| 187 | - | sizeof(struct mt792x_asar_geo_limit), | |
| 188 | - | offsetof(struct mt792x_asar_geo, nr_tbl), | |
| 189 | - | MT792x_ASAR_MIN_GEO, MT792x_ASAR_MAX_GEO)) | |
| 190 | - | *used = 1; | |
| 191 | - | else if (mt792x_asar_fits(t, len, sizeof(struct mt792x_asar_geo_v2), | |
| 192 | - | sizeof(struct mt792x_asar_geo_limit_v2), | |
| 193 | - | offsetof(struct mt792x_asar_geo_v2, nr_tbl), | |
| 194 | - | MT792x_ASAR_MIN_GEO, MT792x_ASAR_MAX_GEO)) | |
| 195 | - | *used = 2; | |
| 196 | - | else | |
| 157 | + | switch (version) { | |
| 158 | + | case 1: | |
| 159 | + | sarlen = sizeof(struct mt792x_asar_geo_limit); | |
| 160 | + | prelen = sizeof(struct mt792x_asar_geo); | |
| 161 | + | break; | |
| 162 | + | case 2: | |
| 163 | + | sarlen = sizeof(struct mt792x_asar_geo_limit_v2); | |
| 164 | + | prelen = sizeof(struct mt792x_asar_geo_v2); | |
| 165 | + | break; | |
| 166 | + | default: | |
| 197 | 167 | return -EINVAL; | |
| 168 | + | } | |
| 198 | 169 | ||
| 199 | - | if (version && *used != version) | |
| 200 | - | dev_info(dev->mt76.dev, | |
| 201 | - | "MTGS is v%u, MTCL says v%u; using v%u\n", | |
| 202 | - | *used, version, *used); | |
| 170 | + | tblcnt = (len - prelen) / sarlen; | |
| 171 | + | if (tblcnt > MT792x_ASAR_MAX_GEO || tblcnt < MT792x_ASAR_MIN_GEO) | |
| 172 | + | return -EINVAL; | |
| 203 | 173 | ||
| 204 | 174 | return 0; | |
| 205 | 175 | } | |
| @@ -235,16 +205,14 @@ int mt792x_init_acpi_sar(struct mt792x_dev *dev) | |||
| 235 | 205 | asar->countrylist = NULL; | |
| 236 | 206 | } | |
| 237 | 207 | ||
| 238 | - | ret = mt792x_asar_acpi_read_mtds(dev, (u8 **)&asar->dyn, asar->ver, | |
| 239 | - | &asar->dyn_ver); | |
| 208 | + | ret = mt792x_asar_acpi_read_mtds(dev, (u8 **)&asar->dyn, asar->ver); | |
| 240 | 209 | if (ret) { | |
| 241 | 210 | devm_kfree(dev->mt76.dev, asar->dyn); | |
| 242 | 211 | asar->dyn = NULL; | |
| 243 | 212 | } | |
| 244 | 213 | ||
| 245 | 214 | /* MTGS is optional */ | |
| 246 | - | ret = mt792x_asar_acpi_read_mtgs(dev, (u8 **)&asar->geo, asar->ver, | |
| 247 | - | &asar->geo_ver); | |
| 215 | + | ret = mt792x_asar_acpi_read_mtgs(dev, (u8 **)&asar->geo, asar->ver); | |
| 248 | 216 | if (ret) { | |
| 249 | 217 | devm_kfree(dev->mt76.dev, asar->geo); | |
| 250 | 218 | asar->geo = NULL; | |
| @@ -286,7 +254,7 @@ mt792x_asar_get_geo_pwr(struct mt792x_phy *phy, | |||
| 286 | 254 | break; | |
| 287 | 255 | } | |
| 288 | 256 | ||
| 289 | - | if (asar->geo_ver == 1) { | |
| 257 | + | if (asar->ver == 1) { | |
| 290 | 258 | band_pwr = &asar->geo->tbl[idx].band[0]; | |
| 291 | 259 | max = ARRAY_SIZE(asar->geo->tbl[idx].band); | |
| 292 | 260 | } else { | |
| @@ -311,18 +279,10 @@ mt792x_asar_get_geo_pwr(struct mt792x_phy *phy, | |||
| 311 | 279 | if (idx >= max) | |
| 312 | 280 | return dyn_power; | |
| 313 | 281 | ||
| 314 | - | band_pwr += idx; | |
| 315 | - | ||
| 316 | - | /* Some OEM tables carry 0xff here; narrowed to s8 that is -1 and | |
| 317 | - | * wins the min() below. Take it as no limit. | |
| 318 | - | */ | |
| 319 | - | if (band_pwr->pwr == 0xff) | |
| 320 | - | return dyn_power; | |
| 321 | - | ||
| 322 | - | geo_power = band_pwr->pwr; | |
| 282 | + | geo_power = (band_pwr + idx)->pwr; | |
| 283 | + | dyn_power += (band_pwr + idx)->offset; | |
| 323 | 284 | ||
| 324 | - | return min_t(int, geo_power, | |
| 325 | - | min_t(int, dyn_power + band_pwr->offset, 127)); | |
| 285 | + | return min(geo_power, dyn_power); | |
| 326 | 286 | } | |
| 327 | 287 | ||
| 328 | 288 | static s8 | |
| @@ -337,7 +297,7 @@ mt792x_asar_range_pwr(struct mt792x_phy *phy, | |||
| 337 | 297 | if (!capa) | |
| 338 | 298 | return 127; | |
| 339 | 299 | ||
| 340 | - | if (asar->dyn_ver == 1) { | |
| 300 | + | if (asar->ver == 1) { | |
| 341 | 301 | limit = &asar->dyn->tbl[0].frp[0]; | |
| 342 | 302 | max = ARRAY_SIZE(asar->dyn->tbl[0].frp); | |
| 343 | 303 | } else { | |
| @@ -355,9 +315,7 @@ mt792x_asar_range_pwr(struct mt792x_phy *phy, | |||
| 355 | 315 | else | |
| 356 | 316 | band = NL80211_BAND_2GHZ; | |
| 357 | 317 | ||
| 358 | - | /* 0xff: no dynamic limit, see mt792x_asar_get_geo_pwr() */ | |
| 359 | - | return mt792x_asar_get_geo_pwr(phy, band, | |
| 360 | - | limit[idx] == 0xff ? 127 : limit[idx]); | |
| 318 | + | return mt792x_asar_get_geo_pwr(phy, band, limit[idx]); | |
| 361 | 319 | } | |
| 362 | 320 | ||
| 363 | 321 | int mt792x_init_acpi_sar_power(struct mt792x_phy *phy, bool set_default) | |
modified drivers/net/wireless/mediatek/mt76/mt792x_acpi_sar.h
| @@ -105,8 +105,6 @@ struct mt792x_asar_fg { | |||
| 105 | 105 | ||
| 106 | 106 | struct mt792x_acpi_sar { | |
| 107 | 107 | u8 ver; | |
| 108 | - | u8 dyn_ver; | |
| 109 | - | u8 geo_ver; | |
| 110 | 108 | union { | |
| 111 | 109 | struct mt792x_asar_dyn *dyn; | |
| 112 | 110 | struct mt792x_asar_dyn_v2 *dyn_v2; | |
modified drivers/net/wireless/mediatek/mt76/mt7996/init.c
| @@ -540,7 +540,6 @@ mt7996_init_wiphy(struct ieee80211_hw *hw, struct mtk_wed_device *wed) | |||
| 540 | 540 | ieee80211_hw_set(hw, NO_VIRTUAL_MONITOR); | |
| 541 | 541 | ieee80211_hw_set(hw, SUPPORTS_MULTI_BSSID); | |
| 542 | 542 | ieee80211_hw_set(hw, CHANCTX_STA_CSA); | |
| 543 | - | ieee80211_hw_set(hw, CONNECTION_MONITOR); | |
| 544 | 543 | ||
| 545 | 544 | hw->max_tx_fragments = 4; | |
| 546 | 545 | wiphy->txq_memory_limit = 32 << 20; /* 32 MiB */ | |
| @@ -1248,7 +1247,7 @@ static int mt7996_variant_fem_init(struct mt7996_dev *dev) | |||
| 1248 | 1247 | adie_ver = u32_get_bits(regval, MT_ADIE_VERSION_MASK); | |
| 1249 | 1248 | idx = MT7976C_EFUSE_OFFSET % MT7996_EEPROM_BLOCK_SIZE; | |
| 1250 | 1249 | is_7976c = adie_ver == 0x8a10 || adie_ver == 0x8b00 || | |
| 1251 | - | adie_ver == 0x8c10 || (!ret && buf[idx] == 0xc); | |
| 1250 | + | adie_ver == 0x8c10 || buf[idx] == 0xc; | |
| 1252 | 1251 | ||
| 1253 | 1252 | adie_id = u32_get_bits(regval, MT_ADIE_CHIP_ID_MASK); | |
| 1254 | 1253 | if (adie_id == 0x7975 || adie_id == 0x7979 || | |
modified drivers/net/wireless/mediatek/mt76/mt7996/main.c
| @@ -310,14 +310,7 @@ int mt7996_vif_link_add(struct mt76_phy *mphy, struct ieee80211_vif *vif, | |||
| 310 | 310 | if (vif->type == NL80211_IFTYPE_AP) | |
| 311 | 311 | return mt7996_mcu_mld_link_oper(dev, link_conf, link, | |
| 312 | 312 | true); | |
| 313 | - | ||
| 314 | - | /* update the link address */ | |
| 315 | - | ret = mt7996_mcu_add_dev_info(phy, vif, link_conf, mlink, true); | |
| 316 | - | if (ret) | |
| 317 | - | return ret; | |
| 318 | - | ||
| 319 | - | return mt7996_mcu_add_bss_info(phy, vif, link_conf, mlink, | |
| 320 | - | msta_link, true); | |
| 313 | + | return 0; | |
| 321 | 314 | } | |
| 322 | 315 | ||
| 323 | 316 | mlink->idx = __ffs64(~dev->mt76.vif_mask); | |
| @@ -1433,7 +1426,6 @@ mt7996_mac_sta_event(struct mt7996_dev *dev, struct ieee80211_vif *vif, | |||
| 1433 | 1426 | else if (sta->mlo && links == BIT(link_id)) /* last link */ | |
| 1434 | 1427 | mt7996_mcu_teardown_mld_sta(dev, link, | |
| 1435 | 1428 | msta_link); | |
| 1436 | - | msta_link->wcid.tx_info &= ~MT_WCID_TX_INFO_SET; | |
| 1437 | 1429 | msta_link->wcid.sta_disabled = 1; | |
| 1438 | 1430 | msta_link->wcid.sta = 0; | |
| 1439 | 1431 | links = links & ~BIT(link_id); | |
modified drivers/net/wireless/mediatek/mt76/mt7996/mcu.h
| @@ -284,9 +284,6 @@ struct mt7996_mcu_wed_rro_ba_delete_event { | |||
| 284 | 284 | __le16 len; | |
| 285 | 285 | ||
| 286 | 286 | __le16 session_id; | |
| 287 | - | __le16 wlan_id; | |
| 288 | - | u8 tid; | |
| 289 | - | u8 __rsv1; | |
| 290 | 287 | u8 __rsv2[2]; | |
| 291 | 288 | } __packed; | |
| 292 | 289 | ||
modified drivers/net/wireless/mediatek/mt76/tx.c
| @@ -234,8 +234,6 @@ mt76_tx_check_non_aql(struct mt76_dev *dev, struct mt76_wcid *wcid, | |||
| 234 | 234 | if (!wcid || info->tx_time_est) | |
| 235 | 235 | return; | |
| 236 | 236 | ||
| 237 | - | wcid = mt76_wcid_primary(wcid); | |
| 238 | - | ||
| 239 | 237 | pending = atomic_dec_return(&wcid->non_aql_packets); | |
| 240 | 238 | if (pending < 0) | |
| 241 | 239 | atomic_cmpxchg(&wcid->non_aql_packets, pending, 0); | |
| @@ -346,8 +344,7 @@ __mt76_tx_queue_skb(struct mt76_phy *phy, int qid, struct sk_buff *skb, | |||
| 346 | 344 | if (!non_aql) | |
| 347 | 345 | return idx; | |
| 348 | 346 | ||
| 349 | - | /* the hardware can report the completion on a different link */ | |
| 350 | - | pending = atomic_inc_return(&mt76_wcid_primary(wcid)->non_aql_packets); | |
| 347 | + | pending = atomic_inc_return(&wcid->non_aql_packets); | |
| 351 | 348 | if (stop && pending >= MT_MAX_NON_AQL_PKT) | |
| 352 | 349 | *stop = true; | |
| 353 | 350 | ||
| @@ -509,8 +506,7 @@ mt76_txq_send_burst(struct mt76_phy *phy, struct mt76_queue *q, | |||
| 509 | 506 | return 0; | |
| 510 | 507 | } | |
| 511 | 508 | ||
| 512 | - | if (atomic_read(&mt76_wcid_primary(wcid)->non_aql_packets) >= | |
| 513 | - | MT_MAX_NON_AQL_PKT) | |
| 509 | + | if (atomic_read(&wcid->non_aql_packets) >= MT_MAX_NON_AQL_PKT) | |
| 514 | 510 | return 0; | |
| 515 | 511 | ||
| 516 | 512 | skb = mt76_txq_dequeue(phy, mtxq); | |
| @@ -607,8 +603,7 @@ mt76_txq_schedule_list(struct mt76_phy *phy, enum mt76_txq_id qid) | |||
| 607 | 603 | continue; | |
| 608 | 604 | } | |
| 609 | 605 | ||
| 610 | - | if (atomic_read(&mt76_wcid_primary(wcid)->non_aql_packets) >= | |
| 611 | - | MT_MAX_NON_AQL_PKT) | |
| 606 | + | if (atomic_read(&wcid->non_aql_packets) >= MT_MAX_NON_AQL_PKT) | |
| 612 | 607 | continue; | |
| 613 | 608 | if (dev->queue_ops->tx_cleanup && | |
| 614 | 609 | q->queued + 2 * MT_TXQ_FREE_THR >= q->ndesc) { | |
| @@ -680,8 +675,7 @@ mt76_txq_schedule_pending_wcid(struct mt76_phy *phy, struct mt76_wcid *wcid, | |||
| 680 | 675 | if ((dev->drv->drv_flags & MT_DRV_HW_MGMT_TXQ) && | |
| 681 | 676 | !(info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP) && | |
| 682 | 677 | !ieee80211_is_data_present(hdr->frame_control) && | |
| 683 | - | (!(wcid->tx_info & MT_WCID_TX_INFO_SET) || | |
| 684 | - | !ieee80211_is_bufferable_mmpdu(skb) || | |
| 678 | + | (!ieee80211_is_bufferable_mmpdu(skb) || | |
| 685 | 679 | ieee80211_is_deauth(hdr->frame_control) || | |
| 686 | 680 | ieee80211_is_disassoc(hdr->frame_control) || | |
| 687 | 681 | head == &wcid->tx_offchannel)) | |
modified drivers/net/wireless/nxp/nxpwifi/11n.c
| @@ -451,7 +451,7 @@ void | |||
| 451 | 451 | nxpwifi_11n_delete_tx_ba_stream_tbl_entry(struct nxpwifi_private *priv, | |
| 452 | 452 | struct nxpwifi_tx_ba_stream_tbl *tbl) | |
| 453 | 453 | { | |
| 454 | - | if (!tbl || !nxpwifi_is_tx_ba_stream_ptr_valid(priv, tbl)) | |
| 454 | + | if (!tbl || nxpwifi_is_tx_ba_stream_ptr_valid(priv, tbl)) | |
| 455 | 455 | return; | |
| 456 | 456 | ||
| 457 | 457 | nxpwifi_dbg(priv->adapter, INFO, | |
modified drivers/net/wireless/nxp/nxpwifi/11n_aggr.c
| @@ -168,7 +168,6 @@ nxpwifi_11n_aggregate_pkt(struct nxpwifi_private *priv, | |||
| 168 | 168 | ||
| 169 | 169 | if (!nxpwifi_is_ralist_valid(priv, pra_list, ptrindex)) { | |
| 170 | 170 | spin_unlock_bh(&priv->wmm.ra_list_spinlock); | |
| 171 | - | nxpwifi_write_data_complete(adapter, skb_aggr, 1, -1); | |
| 172 | 171 | return -ENOENT; | |
| 173 | 172 | } | |
| 174 | 173 | ||
modified drivers/net/wireless/nxp/nxpwifi/11n_rxreorder.c
| @@ -205,12 +205,11 @@ void nxpwifi_11n_del_rx_reorder_tbl_by_ta(struct nxpwifi_private *priv, u8 *ta) | |||
| 205 | 205 | return; | |
| 206 | 206 | ||
| 207 | 207 | for (i = 0; i < MAX_NUM_TID; i++) { | |
| 208 | - | scoped_guard(rcu) { | |
| 209 | - | list_for_each_entry_rcu(tbl, &priv->rx_reorder_tbl_ptr[i], list) { | |
| 210 | - | if (!memcmp(tbl->ta, ta, ETH_ALEN)) { | |
| 211 | - | INIT_LIST_HEAD(&tbl->tmp_list); | |
| 212 | - | list_add_tail(&tbl->tmp_list, &to_delete); | |
| 213 | - | } | |
| 208 | + | guard(rcu)(); | |
| 209 | + | list_for_each_entry_rcu(tbl, &priv->rx_reorder_tbl_ptr[i], list) { | |
| 210 | + | if (!memcmp(tbl->ta, ta, ETH_ALEN)) { | |
| 211 | + | INIT_LIST_HEAD(&tbl->tmp_list); | |
| 212 | + | list_add_tail(&tbl->tmp_list, &to_delete); | |
| 214 | 213 | } | |
| 215 | 214 | } | |
| 216 | 215 | ||
modified drivers/net/wireless/nxp/nxpwifi/cfg80211.c
| @@ -1539,11 +1539,9 @@ nxpwifi_cfg80211_del_station(struct wiphy *wiphy, struct wireless_dev *wdev, | |||
| 1539 | 1539 | ||
| 1540 | 1540 | eth_zero_addr(deauth_mac); | |
| 1541 | 1541 | ||
| 1542 | - | rcu_read_lock(); | |
| 1543 | 1542 | sta_node = nxpwifi_get_sta_entry(priv, params->mac); | |
| 1544 | 1543 | if (sta_node) | |
| 1545 | 1544 | ether_addr_copy(deauth_mac, params->mac); | |
| 1546 | - | rcu_read_unlock(); | |
| 1547 | 1545 | ||
| 1548 | 1546 | if (is_valid_ether_addr(deauth_mac)) { | |
| 1549 | 1547 | ret = nxpwifi_uap_sta_deauth(priv, deauth_mac); | |
| @@ -3325,7 +3323,6 @@ nxpwifi_cfg80211_authenticate(struct wiphy *wiphy, | |||
| 3325 | 3323 | struct nxpwifi_adapter *adapter = priv->adapter; | |
| 3326 | 3324 | struct sk_buff *skb; | |
| 3327 | 3325 | u16 pkt_len, auth_alg; | |
| 3328 | - | size_t frame_len; | |
| 3329 | 3326 | int ret; | |
| 3330 | 3327 | struct ieee80211_mgmt *mgmt; | |
| 3331 | 3328 | struct nxpwifi_txinfo *tx_info; | |
| @@ -3399,25 +3396,13 @@ nxpwifi_cfg80211_authenticate(struct wiphy *wiphy, | |||
| 3399 | 3396 | ||
| 3400 | 3397 | nxpwifi_cancel_scan(adapter); | |
| 3401 | 3398 | ||
| 3402 | - | frame_len = req->ie_len + req->auth_data_len + | |
| 3403 | - | sizeof(struct ieee80211_hdr_3addr) + NXPWIFI_AUTH_BODY_LEN; | |
| 3399 | + | pkt_len = (u16)req->ie_len + req->auth_data_len + | |
| 3400 | + | NXPWIFI_MGMT_HEADER_LEN + NXPWIFI_AUTH_BODY_LEN; | |
| 3404 | 3401 | ||
| 3405 | 3402 | if (req->auth_data_len >= 4) | |
| 3406 | - | frame_len -= 4; | |
| 3407 | - | ||
| 3408 | - | /* nxpwifi_form_mgmt_frame() inserts address4, so the frame handed to | |
| 3409 | - | * the firmware is ETH_ALEN longer than the one built here. | |
| 3410 | - | */ | |
| 3411 | - | if (frame_len > U16_MAX - ETH_ALEN) { | |
| 3412 | - | nxpwifi_dbg(adapter, ERROR, | |
| 3413 | - | "auth frame too long: %zu bytes\n", frame_len); | |
| 3414 | - | return -EINVAL; | |
| 3415 | - | } | |
| 3416 | - | pkt_len = frame_len + ETH_ALEN; | |
| 3403 | + | pkt_len -= 4; | |
| 3417 | 3404 | ||
| 3418 | - | mgmt = kzalloc(frame_len, GFP_KERNEL); | |
| 3419 | - | if (!mgmt) | |
| 3420 | - | return -ENOMEM; | |
| 3405 | + | mgmt = kzalloc(pkt_len, GFP_KERNEL); | |
| 3421 | 3406 | ||
| 3422 | 3407 | skb = dev_alloc_skb(NXPWIFI_MIN_DATA_HEADER_LEN + | |
| 3423 | 3408 | NXPWIFI_MGMT_FRAME_HEADER_SIZE + | |
| @@ -3425,7 +3410,6 @@ nxpwifi_cfg80211_authenticate(struct wiphy *wiphy, | |||
| 3425 | 3410 | if (!skb) { | |
| 3426 | 3411 | nxpwifi_dbg(adapter, ERROR, | |
| 3427 | 3412 | "allocate skb failed for management frame\n"); | |
| 3428 | - | kfree(mgmt); | |
| 3429 | 3413 | return -ENOMEM; | |
| 3430 | 3414 | } | |
| 3431 | 3415 | ||
| @@ -3464,7 +3448,7 @@ nxpwifi_cfg80211_authenticate(struct wiphy *wiphy, | |||
| 3464 | 3448 | memcpy((u8 *)varptr, req->ie, req->ie_len); | |
| 3465 | 3449 | } | |
| 3466 | 3450 | ||
| 3467 | - | nxpwifi_form_mgmt_frame(skb, (const u8 *)mgmt, frame_len); | |
| 3451 | + | nxpwifi_form_mgmt_frame(skb, (const u8 *)mgmt, pkt_len); | |
| 3468 | 3452 | kfree(mgmt); | |
| 3469 | 3453 | priv->auth_flag = HOST_MLME_AUTH_PENDING; | |
| 3470 | 3454 | priv->auth_alg = auth_alg; | |
| @@ -3745,9 +3729,8 @@ int nxpwifi_init_channel_scan_gap(struct nxpwifi_adapter *adapter) | |||
| 3745 | 3729 | * additional active scan request for hidden SSIDs on passive channels. | |
| 3746 | 3730 | */ | |
| 3747 | 3731 | adapter->num_in_chan_stats = 2 * (n_channels_bg + n_channels_a); | |
| 3748 | - | adapter->chan_stats = kcalloc(adapter->num_in_chan_stats, | |
| 3749 | - | sizeof(*adapter->chan_stats), | |
| 3750 | - | GFP_KERNEL); | |
| 3732 | + | adapter->chan_stats = vmalloc(array_size(sizeof(*adapter->chan_stats), | |
| 3733 | + | adapter->num_in_chan_stats)); | |
| 3751 | 3734 | ||
| 3752 | 3735 | if (!adapter->chan_stats) | |
| 3753 | 3736 | return -ENOMEM; | |
modified drivers/net/wireless/nxp/nxpwifi/init.c
| @@ -328,7 +328,7 @@ static void nxpwifi_invalidate_lists(struct nxpwifi_adapter *adapter) | |||
| 328 | 328 | static void | |
| 329 | 329 | nxpwifi_adapter_cleanup(struct nxpwifi_adapter *adapter) | |
| 330 | 330 | { | |
| 331 | - | timer_delete_sync(&adapter->wakeup_timer); | |
| 331 | + | timer_delete(&adapter->wakeup_timer); | |
| 332 | 332 | nxpwifi_cancel_all_pending_cmd(adapter); | |
| 333 | 333 | wake_up_interruptible(&adapter->cmd_wait_q.wait); | |
| 334 | 334 | wake_up_interruptible(&adapter->hs_activate_wait_q); | |
modified drivers/net/wireless/nxp/nxpwifi/main.c
| @@ -644,7 +644,7 @@ static int _nxpwifi_fw_dpc(const struct firmware *firmware, void *context) | |||
| 644 | 644 | goto done; | |
| 645 | 645 | ||
| 646 | 646 | err_add_intf: | |
| 647 | - | kfree(adapter->chan_stats); | |
| 647 | + | vfree(adapter->chan_stats); | |
| 648 | 648 | err_init_chan_scan: | |
| 649 | 649 | wiphy_unregister(adapter->wiphy); | |
| 650 | 650 | wiphy_free(adapter->wiphy); | |
| @@ -1384,7 +1384,7 @@ static void nxpwifi_uninit_sw(struct nxpwifi_adapter *adapter) | |||
| 1384 | 1384 | wiphy_free(adapter->wiphy); | |
| 1385 | 1385 | adapter->wiphy = NULL; | |
| 1386 | 1386 | ||
| 1387 | - | kfree(adapter->chan_stats); | |
| 1387 | + | vfree(adapter->chan_stats); | |
| 1388 | 1388 | nxpwifi_free_cmd_buffers(adapter); | |
| 1389 | 1389 | } | |
| 1390 | 1390 | ||
modified drivers/net/wireless/nxp/nxpwifi/uap_event.c
| @@ -75,7 +75,6 @@ nxpwifi_uap_event_sta_deauth(struct nxpwifi_private *priv) | |||
| 75 | 75 | nxpwifi_del_tx_ba_stream_tbl_by_ra(priv, deauth_mac); | |
| 76 | 76 | } | |
| 77 | 77 | nxpwifi_wmm_del_peer_ra_list(priv, deauth_mac); | |
| 78 | - | nxpwifi_del_sta_entry(priv, deauth_mac); | |
| 79 | 78 | ||
| 80 | 79 | return 0; | |
| 81 | 80 | } | |
modified drivers/net/wireless/nxp/nxpwifi/util.c
| @@ -1041,23 +1041,19 @@ nxpwifi_set_sta_ht_cap(struct nxpwifi_private *priv, const u8 *ies, | |||
| 1041 | 1041 | } | |
| 1042 | 1042 | } | |
| 1043 | 1043 | ||
| 1044 | - | /* Delete a station from list. */ | |
| 1044 | + | /* Delete a station from list; called under cfg80211 mutex. */ | |
| 1045 | 1045 | ||
| 1046 | 1046 | void nxpwifi_del_sta_entry(struct nxpwifi_private *priv, const u8 *mac) | |
| 1047 | 1047 | { | |
| 1048 | 1048 | struct nxpwifi_sta_node *node; | |
| 1049 | 1049 | ||
| 1050 | - | spin_lock_bh(&priv->sta_list_spinlock); | |
| 1051 | - | ||
| 1052 | - | list_for_each_entry(node, &priv->sta_list, list) { | |
| 1050 | + | list_for_each_entry_rcu(node, &priv->sta_list, list) { | |
| 1053 | 1051 | if (!memcmp(node->mac_addr, mac, ETH_ALEN)) { | |
| 1054 | 1052 | list_del_rcu(&node->list); | |
| 1055 | 1053 | kfree_rcu(node, rcu); | |
| 1056 | 1054 | break; | |
| 1057 | 1055 | } | |
| 1058 | 1056 | } | |
| 1059 | - | ||
| 1060 | - | spin_unlock_bh(&priv->sta_list_spinlock); | |
| 1061 | 1057 | } | |
| 1062 | 1058 | ||
| 1063 | 1059 | /* Delete all stations from list. */ | |
modified drivers/net/wireless/silabs/wfx/hif_tx.c
| @@ -207,11 +207,9 @@ int wfx_hif_read_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id, void *val, si | |||
| 207 | 207 | dev_warn(wdev->dev, "%s: confirmation mismatch request\n", __func__); | |
| 208 | 208 | ret = -EIO; | |
| 209 | 209 | } | |
| 210 | - | if (!ret && le16_to_cpu(reply->length) > val_len) { | |
| 210 | + | if (ret == -ENOMEM) | |
| 211 | 211 | dev_err(wdev->dev, "buffer is too small to receive %s (%zu < %d)\n", | |
| 212 | 212 | wfx_get_mib_name(mib_id), val_len, le16_to_cpu(reply->length)); | |
| 213 | - | ret = -EIO; | |
| 214 | - | } | |
| 215 | 213 | if (!ret) | |
| 216 | 214 | memcpy(val, &reply->mib_data, le16_to_cpu(reply->length)); | |
| 217 | 215 | else | |
modified drivers/net/wireless/st/cw1200/bh.c
| @@ -344,7 +344,6 @@ static int cw1200_bh_tx_helper(struct cw1200_common *priv, | |||
| 344 | 344 | int *tx_burst) | |
| 345 | 345 | { | |
| 346 | 346 | size_t tx_len; | |
| 347 | - | size_t aligned_len; | |
| 348 | 347 | u8 *data; | |
| 349 | 348 | int ret; | |
| 350 | 349 | struct wsm_hdr *wsm; | |
| @@ -377,14 +376,9 @@ static int cw1200_bh_tx_helper(struct cw1200_common *priv, | |||
| 377 | 376 | ||
| 378 | 377 | atomic_inc(&priv->bh_tx); | |
| 379 | 378 | ||
| 380 | - | aligned_len = priv->hwbus_ops->align_size( | |
| 379 | + | tx_len = priv->hwbus_ops->align_size( | |
| 381 | 380 | priv->hwbus_priv, tx_len); | |
| 382 | 381 | ||
| 383 | - | /* Zero the bus alignment padding so no stale data is sent. */ | |
| 384 | - | if (aligned_len > tx_len) | |
| 385 | - | memset(data + tx_len, 0, aligned_len - tx_len); | |
| 386 | - | tx_len = aligned_len; | |
| 387 | - | ||
| 388 | 382 | /* Check if not exceeding CW1200 capabilities */ | |
| 389 | 383 | if (WARN_ON_ONCE(tx_len > EFFECTIVE_BUF_SIZE)) | |
| 390 | 384 | pr_debug("Write aligned len: %zu\n", tx_len); | |
modified drivers/net/wireless/st/cw1200/txrx.c
| @@ -14,7 +14,6 @@ | |||
| 14 | 14 | #include "wsm.h" | |
| 15 | 15 | #include "bh.h" | |
| 16 | 16 | #include "sta.h" | |
| 17 | - | #include "hwbus.h" | |
| 18 | 17 | #include "debug.h" | |
| 19 | 18 | ||
| 20 | 19 | #define CW1200_INVALID_RATE_ID (0xFF) | |
| @@ -717,7 +716,6 @@ void cw1200_tx(struct ieee80211_hw *dev, | |||
| 717 | 716 | struct ieee80211_sta *sta; | |
| 718 | 717 | struct wsm_tx *wsm; | |
| 719 | 718 | bool tid_update = false; | |
| 720 | - | size_t pad_len; | |
| 721 | 719 | u8 flags = 0; | |
| 722 | 720 | int ret; | |
| 723 | 721 | ||
| @@ -766,18 +764,6 @@ void cw1200_tx(struct ieee80211_hw *dev, | |||
| 766 | 764 | ||
| 767 | 765 | sta = t.sta; | |
| 768 | 766 | ||
| 769 | - | /* | |
| 770 | - | * The bus transfer is padded up to the bus alignment and the | |
| 771 | - | * padding is transferred from the frame buffer. Make sure the | |
| 772 | - | * buffer has room for the padding so the device never receives | |
| 773 | - | * data past the end of the frame. | |
| 774 | - | */ | |
| 775 | - | pad_len = priv->hwbus_ops->align_size(priv->hwbus_priv, skb->len) - | |
| 776 | - | skb->len; | |
| 777 | - | if (skb_tailroom(skb) < pad_len && | |
| 778 | - | pskb_expand_head(skb, 0, pad_len, GFP_ATOMIC)) | |
| 779 | - | goto drop; | |
| 780 | - | ||
| 781 | 767 | spin_lock_bh(&priv->ps_state_lock); | |
| 782 | 768 | { | |
| 783 | 769 | tid_update = cw1200_tx_h_pm_state(priv, &t); | |
modified drivers/net/wireless/ti/wlcore/main.c
| @@ -6809,10 +6809,8 @@ void wlcore_remove(struct platform_device *pdev) | |||
| 6809 | 6809 | ||
| 6810 | 6810 | if (pdev_data->family && pdev_data->family->nvs_name) | |
| 6811 | 6811 | wait_for_completion(&wl->nvs_loading_complete); | |
| 6812 | - | if (!wl->initialized) { | |
| 6813 | - | pm_runtime_put_noidle(wl->dev); | |
| 6812 | + | if (!wl->initialized) | |
| 6814 | 6813 | return; | |
| 6815 | - | } | |
| 6816 | 6814 | ||
| 6817 | 6815 | if (wl->wakeirq >= 0) { | |
| 6818 | 6816 | dev_pm_clear_wake_irq(wl->dev); | |
modified drivers/net/xen-netfront.c
| @@ -1234,16 +1234,8 @@ static int handle_incoming_queue(struct netfront_queue *queue, | |||
| 1234 | 1234 | while ((skb = __skb_dequeue(rxq)) != NULL) { | |
| 1235 | 1235 | int pull_to = NETFRONT_SKB_CB(skb)->pull_to; | |
| 1236 | 1236 | ||
| 1237 | - | /* pull_to comes from the first slot's length, which the | |
| 1238 | - | * backend controls. Make sure the head holds at least an | |
| 1239 | - | * Ethernet header for eth_type_trans(). | |
| 1240 | - | */ | |
| 1241 | - | if (!pskb_may_pull(skb, max(pull_to, ETH_HLEN))) { | |
| 1242 | - | kfree_skb(skb); | |
| 1243 | - | packets_dropped++; | |
| 1244 | - | queue->info->netdev->stats.rx_errors++; | |
| 1245 | - | continue; | |
| 1246 | - | } | |
| 1237 | + | if (pull_to > skb_headlen(skb)) | |
| 1238 | + | __pskb_pull_tail(skb, pull_to - skb_headlen(skb)); | |
| 1247 | 1239 | ||
| 1248 | 1240 | /* Ethernet work: Delayed to here as it peeks the header. */ | |
| 1249 | 1241 | skb->protocol = eth_type_trans(skb, queue->info->netdev); | |
| @@ -1346,10 +1338,8 @@ err: | |||
| 1346 | 1338 | skb->data_len = rx->status; | |
| 1347 | 1339 | skb->len += rx->status; | |
| 1348 | 1340 | ||
| 1349 | - | if (unlikely(xennet_fill_frags(queue, skb, &tmpq))) { | |
| 1350 | - | __skb_queue_head(&tmpq, skb); | |
| 1341 | + | if (unlikely(xennet_fill_frags(queue, skb, &tmpq))) | |
| 1351 | 1342 | goto err; | |
| 1352 | - | } | |
| 1353 | 1343 | ||
| 1354 | 1344 | if (rx->flags & XEN_NETRXF_csum_blank) | |
| 1355 | 1345 | skb->ip_summed = CHECKSUM_PARTIAL; | |
modified drivers/nvme/host/core.c
| @@ -2617,19 +2617,10 @@ static int nvme_update_ns_info(struct nvme_ns *ns, struct nvme_ns_info *info) | |||
| 2617 | 2617 | set_capacity_and_notify(ns->head->disk, get_capacity(ns->disk)); | |
| 2618 | 2618 | set_disk_ro(ns->head->disk, nvme_ns_is_readonly(ns, info)); | |
| 2619 | 2619 | nvme_mpath_revalidate_paths(ns->head); | |
| 2620 | + | ret = nvme_mpath_revalidate_zones(ns->head); | |
| 2620 | 2621 | ||
| 2621 | 2622 | unfreeze_head_queue: | |
| 2622 | 2623 | blk_mq_unfreeze_queue(ns->head->disk->queue, memflags); | |
| 2623 | - | ||
| 2624 | - | /* | |
| 2625 | - | * Wait until the head queue is unfrozen before revalidating | |
| 2626 | - | * its zones. blk_revalidate_disk_zones() takes the queue limits | |
| 2627 | - | * lock and then freezes the queue on its own, so it must not be | |
| 2628 | - | * called with the queue already frozen. This is also what | |
| 2629 | - | * nvme_update_ns_info_block() does for ns->disk. | |
| 2630 | - | */ | |
| 2631 | - | if (!ret) | |
| 2632 | - | ret = nvme_mpath_revalidate_zones(ns->head); | |
| 2633 | 2624 | } | |
| 2634 | 2625 | ||
| 2635 | 2626 | return ret; | |
| @@ -3204,16 +3195,9 @@ static void nvme_release_subsystem(struct device *dev) | |||
| 3204 | 3195 | { | |
| 3205 | 3196 | struct nvme_subsystem *subsys = | |
| 3206 | 3197 | container_of(dev, struct nvme_subsystem, dev); | |
| 3207 | - | struct nvme_effects_log *cel; | |
| 3208 | - | unsigned long i; | |
| 3209 | 3198 | ||
| 3210 | 3199 | if (subsys->instance >= 0) | |
| 3211 | 3200 | ida_free(&nvme_instance_ida, subsys->instance); | |
| 3212 | - | xa_for_each(&subsys->cels, i, cel) { | |
| 3213 | - | xa_erase(&subsys->cels, i); | |
| 3214 | - | kfree(cel); | |
| 3215 | - | } | |
| 3216 | - | xa_destroy(&subsys->cels); | |
| 3217 | 3201 | kfree(subsys); | |
| 3218 | 3202 | } | |
| 3219 | 3203 | ||
| @@ -3327,7 +3311,6 @@ static int nvme_init_subsystem(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id) | |||
| 3327 | 3311 | kref_init(&subsys->ref); | |
| 3328 | 3312 | INIT_LIST_HEAD(&subsys->ctrls); | |
| 3329 | 3313 | INIT_LIST_HEAD(&subsys->nsheads); | |
| 3330 | - | xa_init(&subsys->cels); | |
| 3331 | 3314 | nvme_init_subnqn(subsys, ctrl, id); | |
| 3332 | 3315 | memcpy(subsys->serial, id->sn, sizeof(subsys->serial)); | |
| 3333 | 3316 | memcpy(subsys->model, id->mn, sizeof(subsys->model)); | |
| @@ -3430,7 +3413,7 @@ int nvme_get_log(struct nvme_ctrl *ctrl, u32 nsid, u8 log_page, u8 lsp, u8 csi, | |||
| 3430 | 3413 | static int nvme_get_effects_log(struct nvme_ctrl *ctrl, u8 csi, | |
| 3431 | 3414 | struct nvme_effects_log **log) | |
| 3432 | 3415 | { | |
| 3433 | - | struct nvme_effects_log *old, *cel = xa_load(&ctrl->subsys->cels, csi); | |
| 3416 | + | struct nvme_effects_log *old, *cel = xa_load(&ctrl->cels, csi); | |
| 3434 | 3417 | int ret; | |
| 3435 | 3418 | ||
| 3436 | 3419 | if (cel) | |
| @@ -3447,7 +3430,7 @@ static int nvme_get_effects_log(struct nvme_ctrl *ctrl, u8 csi, | |||
| 3447 | 3430 | return ret; | |
| 3448 | 3431 | } | |
| 3449 | 3432 | ||
| 3450 | - | old = xa_store(&ctrl->subsys->cels, csi, cel, GFP_KERNEL); | |
| 3433 | + | old = xa_store(&ctrl->cels, csi, cel, GFP_KERNEL); | |
| 3451 | 3434 | if (xa_is_err(old)) { | |
| 3452 | 3435 | kfree(cel); | |
| 3453 | 3436 | return xa_err(old); | |
| @@ -3522,7 +3505,7 @@ static int nvme_init_effects_log(struct nvme_ctrl *ctrl, | |||
| 3522 | 3505 | if (!effects) | |
| 3523 | 3506 | return -ENOMEM; | |
| 3524 | 3507 | ||
| 3525 | - | old = xa_store(&ctrl->subsys->cels, csi, effects, GFP_KERNEL); | |
| 3508 | + | old = xa_store(&ctrl->cels, csi, effects, GFP_KERNEL); | |
| 3526 | 3509 | if (xa_is_err(old)) { | |
| 3527 | 3510 | kfree(effects); | |
| 3528 | 3511 | return xa_err(old); | |
| @@ -3568,27 +3551,23 @@ static int nvme_init_effects(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id) | |||
| 3568 | 3551 | { | |
| 3569 | 3552 | int ret = 0; | |
| 3570 | 3553 | ||
| 3571 | - | mutex_lock(&ctrl->subsys->lock); | |
| 3572 | - | ctrl->effects = xa_load(&ctrl->subsys->cels, NVME_CSI_NVM); | |
| 3573 | 3554 | if (ctrl->effects) | |
| 3574 | - | goto out_unlock; | |
| 3555 | + | return 0; | |
| 3575 | 3556 | ||
| 3576 | 3557 | if (id->lpa & NVME_CTRL_LPA_CMD_EFFECTS_LOG) { | |
| 3577 | 3558 | ret = nvme_get_effects_log(ctrl, NVME_CSI_NVM, &ctrl->effects); | |
| 3578 | 3559 | if (ret < 0) | |
| 3579 | - | goto out_unlock; | |
| 3560 | + | return ret; | |
| 3580 | 3561 | } | |
| 3581 | 3562 | ||
| 3582 | 3563 | if (!ctrl->effects) { | |
| 3583 | 3564 | ret = nvme_init_effects_log(ctrl, NVME_CSI_NVM, &ctrl->effects); | |
| 3584 | 3565 | if (ret < 0) | |
| 3585 | - | goto out_unlock; | |
| 3566 | + | return ret; | |
| 3586 | 3567 | } | |
| 3587 | 3568 | ||
| 3588 | 3569 | nvme_init_known_nvm_effects(ctrl); | |
| 3589 | - | out_unlock: | |
| 3590 | - | mutex_unlock(&ctrl->subsys->lock); | |
| 3591 | - | return ret; | |
| 3570 | + | return 0; | |
| 3592 | 3571 | } | |
| 3593 | 3572 | ||
| 3594 | 3573 | static int nvme_check_ctrl_fabric_info(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id) | |
| @@ -3952,9 +3931,9 @@ void nvme_cdev_del(struct cdev *cdev, struct device *cdev_device) | |||
| 3952 | 3931 | put_device(cdev_device); | |
| 3953 | 3932 | } | |
| 3954 | 3933 | ||
| 3955 | - | int nvme_cdev_add(struct cdev *cdev, struct device *cdev_device, | |
| 3956 | - | const struct file_operations *fops, struct module *owner, | |
| 3957 | - | int ctrl, int head) | |
| 3934 | + | int nvme_cdev_add(const char *name, struct cdev *cdev, | |
| 3935 | + | struct device *cdev_device, | |
| 3936 | + | const struct file_operations *fops, struct module *owner) | |
| 3958 | 3937 | { | |
| 3959 | 3938 | int minor, ret; | |
| 3960 | 3939 | ||
| @@ -3962,7 +3941,7 @@ int nvme_cdev_add(struct cdev *cdev, struct device *cdev_device, | |||
| 3962 | 3941 | if (minor < 0) | |
| 3963 | 3942 | return minor; | |
| 3964 | 3943 | ||
| 3965 | - | ret = dev_set_name(cdev_device, "ng%dn%d", ctrl, head); | |
| 3944 | + | ret = dev_set_name(cdev_device, name); | |
| 3966 | 3945 | if (ret) { | |
| 3967 | 3946 | ida_free(&nvme_ns_chr_minor_ida, minor); | |
| 3968 | 3947 | return ret; | |
| @@ -4003,14 +3982,17 @@ static const struct file_operations nvme_ns_chr_fops = { | |||
| 4003 | 3982 | ||
| 4004 | 3983 | static void nvme_add_ns_cdev(struct nvme_ns *ns) | |
| 4005 | 3984 | { | |
| 3985 | + | char name[32]; | |
| 3986 | + | ||
| 4006 | 3987 | ns->cdev_device.parent = ns->ctrl->device; | |
| 3988 | + | snprintf(name, sizeof(name), "ng%dn%d", ns->ctrl->instance, | |
| 3989 | + | ns->head->instance); | |
| 4007 | 3990 | ||
| 4008 | 3991 | nvme_get_ns(ns); /* Undone in nvme_cdev_rel() */ | |
| 4009 | - | if (nvme_cdev_add(&ns->cdev, &ns->cdev_device, | |
| 4010 | - | &nvme_ns_chr_fops, ns->ctrl->ops->module, | |
| 4011 | - | ns->ctrl->instance, ns->head->instance)) { | |
| 4012 | - | dev_err(ns->ctrl->device, "Unable to create the ng%dn%d device\n", | |
| 4013 | - | ns->ctrl->instance, ns->head->instance); | |
| 3992 | + | if (nvme_cdev_add(name, &ns->cdev, &ns->cdev_device, | |
| 3993 | + | &nvme_ns_chr_fops, ns->ctrl->ops->module)) { | |
| 3994 | + | dev_err(ns->ctrl->device, "Unable to create the %s device\n", | |
| 3995 | + | name); | |
| 4014 | 3996 | nvme_put_ns(ns); | |
| 4015 | 3997 | return; | |
| 4016 | 3998 | } | |
| @@ -5173,6 +5155,19 @@ void nvme_uninit_ctrl(struct nvme_ctrl *ctrl) | |||
| 5173 | 5155 | } | |
| 5174 | 5156 | EXPORT_SYMBOL_GPL(nvme_uninit_ctrl); | |
| 5175 | 5157 | ||
| 5158 | + | static void nvme_free_cels(struct nvme_ctrl *ctrl) | |
| 5159 | + | { | |
| 5160 | + | struct nvme_effects_log *cel; | |
| 5161 | + | unsigned long i; | |
| 5162 | + | ||
| 5163 | + | xa_for_each(&ctrl->cels, i, cel) { | |
| 5164 | + | xa_erase(&ctrl->cels, i); | |
| 5165 | + | kfree(cel); | |
| 5166 | + | } | |
| 5167 | + | ||
| 5168 | + | xa_destroy(&ctrl->cels); | |
| 5169 | + | } | |
| 5170 | + | ||
| 5176 | 5171 | static void nvme_free_ctrl(struct device *dev) | |
| 5177 | 5172 | { | |
| 5178 | 5173 | struct nvme_ctrl *ctrl = | |
| @@ -5185,6 +5180,7 @@ static void nvme_free_ctrl(struct device *dev) | |||
| 5185 | 5180 | blk_put_queue(ctrl->fabrics_q); | |
| 5186 | 5181 | if (!subsys || ctrl->instance != subsys->instance) | |
| 5187 | 5182 | ida_free(&nvme_instance_ida, ctrl->instance); | |
| 5183 | + | nvme_free_cels(ctrl); | |
| 5188 | 5184 | nvme_mpath_uninit(ctrl); | |
| 5189 | 5185 | cleanup_srcu_struct(&ctrl->srcu); | |
| 5190 | 5186 | nvme_auth_stop(ctrl); | |
| @@ -5230,6 +5226,7 @@ int nvme_init_ctrl(struct nvme_ctrl *ctrl, struct device *dev, | |||
| 5230 | 5226 | ||
| 5231 | 5227 | mutex_init(&ctrl->scan_lock); | |
| 5232 | 5228 | INIT_LIST_HEAD(&ctrl->namespaces); | |
| 5229 | + | xa_init(&ctrl->cels); | |
| 5233 | 5230 | ctrl->dev = dev; | |
| 5234 | 5231 | ctrl->ops = ops; | |
| 5235 | 5232 | ctrl->quirks = quirks; | |
modified drivers/nvme/host/fc.c
| @@ -3338,7 +3338,7 @@ nvme_fc_reconnect_or_delete(struct nvme_fc_ctrl *ctrl, int status) | |||
| 3338 | 3338 | ctrl->cnum, min_t(int, portptr->dev_loss_tmo, | |
| 3339 | 3339 | (ctrl->ctrl.opts->max_reconnects * | |
| 3340 | 3340 | ctrl->ctrl.opts->reconnect_delay))); | |
| 3341 | - | nvme_delete_ctrl(&ctrl->ctrl); | |
| 3341 | + | WARN_ON(nvme_delete_ctrl(&ctrl->ctrl)); | |
| 3342 | 3342 | } | |
| 3343 | 3343 | } | |
| 3344 | 3344 | ||
modified drivers/nvme/host/multipath.c
| @@ -646,15 +646,17 @@ static const struct file_operations nvme_ns_head_chr_fops = { | |||
| 646 | 646 | ||
| 647 | 647 | static void nvme_add_ns_head_cdev(struct nvme_ns_head *head) | |
| 648 | 648 | { | |
| 649 | + | char name[32]; | |
| 650 | + | ||
| 649 | 651 | head->cdev_device.parent = &head->subsys->dev; | |
| 652 | + | snprintf(name, sizeof(name), "ng%dn%d", head->subsys->instance, | |
| 653 | + | head->instance); | |
| 650 | 654 | ||
| 651 | 655 | nvme_get_ns_head(head); /* Undone in nvme_cdev_rel() */ | |
| 652 | - | if (nvme_cdev_add(&head->cdev, &head->cdev_device, | |
| 653 | - | &nvme_ns_head_chr_fops, THIS_MODULE, | |
| 654 | - | head->subsys->instance, head->instance)) { | |
| 656 | + | if (nvme_cdev_add(name, &head->cdev, &head->cdev_device, | |
| 657 | + | &nvme_ns_head_chr_fops, THIS_MODULE)) { | |
| 655 | 658 | dev_err(disk_to_dev(head->disk), | |
| 656 | - | "Unable to create the ng%dn%d device\n", | |
| 657 | - | head->subsys->instance, head->instance); | |
| 659 | + | "Unable to create the %s device\n", name); | |
| 658 | 660 | nvme_put_ns_head(head); | |
| 659 | 661 | return; | |
| 660 | 662 | } | |
| @@ -761,6 +763,8 @@ int nvme_mpath_alloc_disk(struct nvme_ctrl *ctrl, struct nvme_ns_head *head) | |||
| 761 | 763 | lim.dma_alignment = 3; | |
| 762 | 764 | lim.features |= BLK_FEAT_IO_STAT | BLK_FEAT_NOWAIT | | |
| 763 | 765 | BLK_FEAT_POLL | BLK_FEAT_ATOMIC_WRITES | BLK_FEAT_PCI_P2PDMA; | |
| 766 | + | if (head->ids.csi == NVME_CSI_ZNS) | |
| 767 | + | lim.features |= BLK_FEAT_ZONED; | |
| 764 | 768 | ||
| 765 | 769 | head->disk = blk_alloc_disk(&lim, ctrl->numa_node); | |
| 766 | 770 | if (IS_ERR(head->disk)) | |
| @@ -841,8 +845,7 @@ static int nvme_parse_ana_log(struct nvme_ctrl *ctrl, void *data, | |||
| 841 | 845 | u32 nr_nsids; | |
| 842 | 846 | size_t nsid_buf_size; | |
| 843 | 847 | ||
| 844 | - | if (WARN_ON_ONCE(offset > ctrl->ana_log_size || | |
| 845 | - | sizeof(*desc) > ctrl->ana_log_size - offset)) | |
| 848 | + | if (WARN_ON_ONCE(offset > ctrl->ana_log_size - sizeof(*desc))) | |
| 846 | 849 | return -EINVAL; | |
| 847 | 850 | ||
| 848 | 851 | nr_nsids = le32_to_cpu(desc->nnsids); | |
| @@ -858,7 +861,7 @@ static int nvme_parse_ana_log(struct nvme_ctrl *ctrl, void *data, | |||
| 858 | 861 | return -EINVAL; | |
| 859 | 862 | ||
| 860 | 863 | offset += sizeof(*desc); | |
| 861 | - | if (WARN_ON_ONCE(nsid_buf_size > ctrl->ana_log_size - offset)) | |
| 864 | + | if (WARN_ON_ONCE(offset > ctrl->ana_log_size - nsid_buf_size)) | |
| 862 | 865 | return -EINVAL; | |
| 863 | 866 | ||
| 864 | 867 | error = cb(ctrl, desc, data); | |
modified drivers/nvme/host/nvme.h
| @@ -415,6 +415,7 @@ struct nvme_ctrl { | |||
| 415 | 415 | unsigned long quirks; | |
| 416 | 416 | struct nvme_id_power_state psd[32]; | |
| 417 | 417 | struct nvme_effects_log *effects; | |
| 418 | + | struct xarray cels; | |
| 418 | 419 | struct work_struct scan_work; | |
| 419 | 420 | struct work_struct async_event_work; | |
| 420 | 421 | struct delayed_work ka_work; | |
| @@ -508,8 +509,6 @@ struct nvme_subsystem { | |||
| 508 | 509 | __guarded_by(&nvme_subsystems_lock); | |
| 509 | 510 | struct list_head nsheads | |
| 510 | 511 | __guarded_by(&lock); | |
| 511 | - | /* Command effects logs, indexed by CSI and protected by lock. */ | |
| 512 | - | struct xarray cels; | |
| 513 | 512 | char subnqn[NVMF_NQN_SIZE]; | |
| 514 | 513 | char serial[20]; | |
| 515 | 514 | char model[40]; | |
| @@ -1014,9 +1013,9 @@ int nvme_get_log(struct nvme_ctrl *ctrl, u32 nsid, u8 log_page, u8 lsp, u8 csi, | |||
| 1014 | 1013 | void nvme_get_ns_head(struct nvme_ns_head *head); | |
| 1015 | 1014 | bool nvme_tryget_ns_head(struct nvme_ns_head *head); | |
| 1016 | 1015 | void nvme_put_ns_head(struct nvme_ns_head *head); | |
| 1017 | - | int nvme_cdev_add(struct cdev *cdev, struct device *cdev_device, | |
| 1018 | - | const struct file_operations *fops, struct module *owner, | |
| 1019 | - | int ctrl, int head); | |
| 1016 | + | int nvme_cdev_add(const char *name, struct cdev *cdev, | |
| 1017 | + | struct device *cdev_device, | |
| 1018 | + | const struct file_operations *fops, struct module *owner); | |
| 1020 | 1019 | void nvme_cdev_del(struct cdev *cdev, struct device *cdev_device); | |
| 1021 | 1020 | int nvme_ioctl(struct block_device *bdev, blk_mode_t mode, | |
| 1022 | 1021 | unsigned int cmd, unsigned long arg); | |
modified drivers/nvme/host/pci.c
| @@ -4196,8 +4196,6 @@ static const struct pci_device_id nvme_id_table[] = { | |||
| 4196 | 4196 | .driver_data = NVME_QUIRK_IGNORE_DEV_SUBNQN }, | |
| 4197 | 4197 | { PCI_DEVICE(0x1344, 0x6001), /* Micron Nitro NVMe */ | |
| 4198 | 4198 | .driver_data = NVME_QUIRK_BOGUS_NID, }, | |
| 4199 | - | { PCI_DEVICE(0x1344, 0x6004), /* Micron 4100AT */ | |
| 4200 | - | .driver_data = NVME_QUIRK_DMAPOOL_ALIGN_512, }, | |
| 4201 | 4199 | { PCI_DEVICE(0x1c5c, 0x1504), /* SK Hynix PC400 */ | |
| 4202 | 4200 | .driver_data = NVME_QUIRK_DISABLE_WRITE_ZEROES, }, | |
| 4203 | 4201 | { PCI_DEVICE(0x1c5c, 0x174a), /* SK Hynix P31 SSD */ | |
modified drivers/nvme/host/sysfs.c
| @@ -679,7 +679,7 @@ static ssize_t cntrltype_show(struct device *dev, | |||
| 679 | 679 | if (ctrl->cntrltype > NVME_CTRL_ADMIN || !type[ctrl->cntrltype]) | |
| 680 | 680 | return sysfs_emit(buf, "reserved\n"); | |
| 681 | 681 | ||
| 682 | - | return sysfs_emit(buf, "%s", type[ctrl->cntrltype]); | |
| 682 | + | return sysfs_emit(buf, type[ctrl->cntrltype]); | |
| 683 | 683 | } | |
| 684 | 684 | static DEVICE_ATTR_RO(cntrltype); | |
| 685 | 685 | ||
| @@ -696,7 +696,7 @@ static ssize_t dctype_show(struct device *dev, | |||
| 696 | 696 | if (ctrl->dctype > NVME_DCTYPE_CDC || !type[ctrl->dctype]) | |
| 697 | 697 | return sysfs_emit(buf, "reserved\n"); | |
| 698 | 698 | ||
| 699 | - | return sysfs_emit(buf, "%s", type[ctrl->dctype]); | |
| 699 | + | return sysfs_emit(buf, type[ctrl->dctype]); | |
| 700 | 700 | } | |
| 701 | 701 | static DEVICE_ATTR_RO(dctype); | |
| 702 | 702 | ||
modified drivers/nvme/host/tcp.c
| @@ -144,6 +144,11 @@ struct nvme_tcp_queue { | |||
| 144 | 144 | void (*state_change)(struct sock *); | |
| 145 | 145 | void (*data_ready)(struct sock *); | |
| 146 | 146 | void (*write_space)(struct sock *); | |
| 147 | + | ||
| 148 | + | #ifdef CONFIG_DEBUG_LOCK_ALLOC | |
| 149 | + | struct lock_class_key nvme_tcp_sk_key; | |
| 150 | + | struct lock_class_key nvme_tcp_slock_key; | |
| 151 | + | #endif | |
| 147 | 152 | }; | |
| 148 | 153 | ||
| 149 | 154 | static DEFINE_MUTEX(nvme_tcp_ctrl_mutex); | |
| @@ -180,12 +185,9 @@ static int nvme_tcp_try_send(struct nvme_tcp_queue *queue); | |||
| 180 | 185 | * a separate class prevents lockdep from conflating nvme-tcp socket use with | |
| 181 | 186 | * user-space socket API use. | |
| 182 | 187 | */ | |
| 183 | - | static struct lock_class_key nvme_tcp_sk_key[2]; | |
| 184 | - | static struct lock_class_key nvme_tcp_slock_key[2]; | |
| 185 | - | ||
| 186 | - | static void nvme_tcp_reclassify_socket(struct socket *sock) | |
| 188 | + | static void nvme_tcp_reclassify_socket(struct nvme_tcp_queue *queue) | |
| 187 | 189 | { | |
| 188 | - | struct sock *sk = sock->sk; | |
| 190 | + | struct sock *sk = queue->sock->sk; | |
| 189 | 191 | ||
| 190 | 192 | if (WARN_ON_ONCE(!sock_allow_reclassification(sk))) | |
| 191 | 193 | return; | |
| @@ -193,22 +195,20 @@ static void nvme_tcp_reclassify_socket(struct socket *sock) | |||
| 193 | 195 | switch (sk->sk_family) { | |
| 194 | 196 | case AF_INET: | |
| 195 | 197 | sock_lock_init_class_and_name(sk, "slock-AF_INET-NVME", | |
| 196 | - | &nvme_tcp_slock_key[0], | |
| 198 | + | &queue->nvme_tcp_slock_key, | |
| 197 | 199 | "sk_lock-AF_INET-NVME", | |
| 198 | - | &nvme_tcp_sk_key[0]); | |
| 200 | + | &queue->nvme_tcp_sk_key); | |
| 199 | 201 | break; | |
| 200 | 202 | case AF_INET6: | |
| 201 | 203 | sock_lock_init_class_and_name(sk, "slock-AF_INET6-NVME", | |
| 202 | - | &nvme_tcp_slock_key[1], | |
| 204 | + | &queue->nvme_tcp_slock_key, | |
| 203 | 205 | "sk_lock-AF_INET6-NVME", | |
| 204 | - | &nvme_tcp_sk_key[1]); | |
| 206 | + | &queue->nvme_tcp_sk_key); | |
| 205 | 207 | break; | |
| 206 | 208 | default: | |
| 207 | 209 | WARN_ON_ONCE(1); | |
| 208 | 210 | } | |
| 209 | 211 | } | |
| 210 | - | #else | |
| 211 | - | static void nvme_tcp_reclassify_socket(struct socket *sock) { } | |
| 212 | 212 | #endif | |
| 213 | 213 | ||
| 214 | 214 | static inline struct nvme_tcp_ctrl *to_tcp_ctrl(struct nvme_ctrl *ctrl) | |
| @@ -1523,6 +1523,11 @@ static void nvme_tcp_free_queue(struct nvme_ctrl *nctrl, int qid) | |||
| 1523 | 1523 | mutex_destroy(&queue->send_mutex); | |
| 1524 | 1524 | mutex_destroy(&queue->queue_lock); | |
| 1525 | 1525 | mutex_destroy(&queue->pf_cache_lock); | |
| 1526 | + | ||
| 1527 | + | #ifdef CONFIG_DEBUG_LOCK_ALLOC | |
| 1528 | + | lockdep_unregister_key(&queue->nvme_tcp_sk_key); | |
| 1529 | + | lockdep_unregister_key(&queue->nvme_tcp_slock_key); | |
| 1530 | + | #endif | |
| 1526 | 1531 | } | |
| 1527 | 1532 | ||
| 1528 | 1533 | static int nvme_tcp_init_connection(struct nvme_tcp_queue *queue) | |
| @@ -1870,6 +1875,12 @@ static int nvme_tcp_alloc_queue(struct nvme_ctrl *nctrl, int qid, | |||
| 1870 | 1875 | ||
| 1871 | 1876 | sk_net_refcnt_upgrade(queue->sock->sk); | |
| 1872 | 1877 | ||
| 1878 | + | #ifdef CONFIG_DEBUG_LOCK_ALLOC | |
| 1879 | + | lockdep_register_key(&queue->nvme_tcp_sk_key); | |
| 1880 | + | lockdep_register_key(&queue->nvme_tcp_slock_key); | |
| 1881 | + | nvme_tcp_reclassify_socket(queue); | |
| 1882 | + | #endif | |
| 1883 | + | ||
| 1873 | 1884 | /* Single syn retry */ | |
| 1874 | 1885 | tcp_sock_set_syncnt(queue->sock->sk, 1); | |
| 1875 | 1886 | ||
| @@ -1957,8 +1968,6 @@ static int nvme_tcp_alloc_queue(struct nvme_ctrl *nctrl, int qid, | |||
| 1957 | 1968 | goto err_init_connect; | |
| 1958 | 1969 | } | |
| 1959 | 1970 | ||
| 1960 | - | nvme_tcp_reclassify_socket(queue->sock); | |
| 1961 | - | ||
| 1962 | 1971 | ret = nvme_tcp_init_connection(queue); | |
| 1963 | 1972 | if (ret) | |
| 1964 | 1973 | goto err_init_connect; | |
| @@ -1975,6 +1984,10 @@ err_sock: | |||
| 1975 | 1984 | /* Use sync variant - see nvme_tcp_free_queue() for explanation */ | |
| 1976 | 1985 | __fput_sync(queue->sock->file); | |
| 1977 | 1986 | queue->sock = NULL; | |
| 1987 | + | #ifdef CONFIG_DEBUG_LOCK_ALLOC | |
| 1988 | + | lockdep_unregister_key(&queue->nvme_tcp_sk_key); | |
| 1989 | + | lockdep_unregister_key(&queue->nvme_tcp_slock_key); | |
| 1990 | + | #endif | |
| 1978 | 1991 | err_destroy_mutex: | |
| 1979 | 1992 | mutex_destroy(&queue->send_mutex); | |
| 1980 | 1993 | mutex_destroy(&queue->queue_lock); | |
modified drivers/nvme/target/configfs.c
| @@ -534,7 +534,6 @@ static ssize_t nvmet_ns_device_path_store(struct config_item *item, | |||
| 534 | 534 | struct nvmet_subsys *subsys = ns->subsys; | |
| 535 | 535 | size_t len; | |
| 536 | 536 | int ret; | |
| 537 | - | char *new_path = NULL; | |
| 538 | 537 | ||
| 539 | 538 | mutex_lock(&subsys->lock); | |
| 540 | 539 | ret = -EBUSY; | |
| @@ -546,14 +545,12 @@ static ssize_t nvmet_ns_device_path_store(struct config_item *item, | |||
| 546 | 545 | if (!len) | |
| 547 | 546 | goto out_unlock; | |
| 548 | 547 | ||
| 548 | + | kfree(ns->device_path); | |
| 549 | 549 | ret = -ENOMEM; | |
| 550 | - | new_path = kmemdup_nul(page, len, GFP_KERNEL); | |
| 551 | - | if (!new_path) | |
| 550 | + | ns->device_path = kmemdup_nul(page, len, GFP_KERNEL); | |
| 551 | + | if (!ns->device_path) | |
| 552 | 552 | goto out_unlock; | |
| 553 | 553 | ||
| 554 | - | kfree(ns->device_path); | |
| 555 | - | ns->device_path = new_path; | |
| 556 | - | ||
| 557 | 554 | mutex_unlock(&subsys->lock); | |
| 558 | 555 | return count; | |
| 559 | 556 | ||
modified drivers/nvme/target/core.c
| @@ -446,27 +446,20 @@ u16 nvmet_req_find_ns(struct nvmet_req *req) | |||
| 446 | 446 | { | |
| 447 | 447 | u32 nsid = le32_to_cpu(req->cmd->common.nsid); | |
| 448 | 448 | struct nvmet_subsys *subsys = nvmet_req_subsys(req); | |
| 449 | - | u16 status = NVME_SC_SUCCESS; | |
| 450 | 449 | ||
| 451 | - | rcu_read_lock(); | |
| 452 | 450 | req->ns = xa_load(&subsys->namespaces, nsid); | |
| 453 | - | if (unlikely(!req->ns) || | |
| 454 | - | !test_bit(NVMET_NS_IO_LIVE, &req->ns->flags) || | |
| 455 | - | !percpu_ref_tryget_live_rcu(&req->ns->ref)) { | |
| 451 | + | if (unlikely(!req->ns || !req->ns->enabled)) { | |
| 456 | 452 | req->error_loc = offsetof(struct nvme_common_command, nsid); | |
| 457 | - | if (!req->ns) { /* ns doesn't exist! */ | |
| 458 | - | status = NVME_SC_INVALID_NS | NVME_STATUS_DNR; | |
| 459 | - | goto unlock; | |
| 460 | - | } | |
| 453 | + | if (!req->ns) /* ns doesn't exist! */ | |
| 454 | + | return NVME_SC_INVALID_NS | NVME_STATUS_DNR; | |
| 461 | 455 | ||
| 462 | 456 | /* ns exists but it's disabled */ | |
| 463 | 457 | req->ns = NULL; | |
| 464 | - | status = NVME_SC_INTERNAL_PATH_ERROR; | |
| 458 | + | return NVME_SC_INTERNAL_PATH_ERROR; | |
| 465 | 459 | } | |
| 466 | - | unlock: | |
| 467 | - | rcu_read_unlock(); | |
| 468 | 460 | ||
| 469 | - | return status; | |
| 461 | + | percpu_ref_get(&req->ns->ref); | |
| 462 | + | return NVME_SC_SUCCESS; | |
| 470 | 463 | } | |
| 471 | 464 | ||
| 472 | 465 | static void nvmet_destroy_namespace(struct percpu_ref *ref) | |
| @@ -630,7 +623,6 @@ int nvmet_ns_enable(struct nvmet_ns *ns) | |||
| 630 | 623 | ns->enabled = true; | |
| 631 | 624 | xa_set_mark(&subsys->namespaces, ns->nsid, NVMET_NS_ENABLED); | |
| 632 | 625 | nvmet_debugfs_ns_setup(ns); | |
| 633 | - | set_bit(NVMET_NS_IO_LIVE, &ns->flags); | |
| 634 | 626 | ret = 0; | |
| 635 | 627 | out_unlock: | |
| 636 | 628 | mutex_unlock(&subsys->lock); | |
| @@ -651,11 +643,11 @@ void nvmet_ns_disable(struct nvmet_ns *ns) | |||
| 651 | 643 | struct nvmet_subsys *subsys = ns->subsys; | |
| 652 | 644 | struct nvmet_ctrl *ctrl; | |
| 653 | 645 | ||
| 654 | - | if (!test_and_clear_bit(NVMET_NS_IO_LIVE, &ns->flags)) | |
| 655 | - | return; | |
| 656 | - | ||
| 657 | 646 | mutex_lock(&subsys->lock); | |
| 647 | + | if (!ns->enabled) | |
| 648 | + | goto out_unlock; | |
| 658 | 649 | ||
| 650 | + | ns->enabled = false; | |
| 659 | 651 | xa_clear_mark(&subsys->namespaces, ns->nsid, NVMET_NS_ENABLED); | |
| 660 | 652 | nvmet_debugfs_ns_free(ns); | |
| 661 | 653 | ||
| @@ -683,7 +675,7 @@ void nvmet_ns_disable(struct nvmet_ns *ns) | |||
| 683 | 675 | mutex_lock(&subsys->lock); | |
| 684 | 676 | nvmet_ns_changed(subsys, ns->nsid); | |
| 685 | 677 | nvmet_ns_dev_disable(ns); | |
| 686 | - | ns->enabled = false; | |
| 678 | + | out_unlock: | |
| 687 | 679 | mutex_unlock(&subsys->lock); | |
| 688 | 680 | } | |
| 689 | 681 | ||
| @@ -1325,7 +1317,7 @@ static int nvmet_req_alloc_p2pmem_sgls(struct pci_dev *p2p_dev, | |||
| 1325 | 1317 | ||
| 1326 | 1318 | return 0; | |
| 1327 | 1319 | out_free_sg: | |
| 1328 | - | pci_p2pmem_free_sgl(p2p_dev, req->sg); | |
| 1320 | + | pci_p2pmem_free_sgl(req->p2p_dev, req->sg); | |
| 1329 | 1321 | out_err: | |
| 1330 | 1322 | return -ENOMEM; | |
| 1331 | 1323 | } | |
| @@ -1656,8 +1648,6 @@ struct nvmet_ctrl *nvmet_alloc_ctrl(struct nvmet_alloc_ctrl_args *args) | |||
| 1656 | 1648 | INIT_DELAYED_WORK(&ctrl->ka_work, nvmet_keep_alive_timer); | |
| 1657 | 1649 | ||
| 1658 | 1650 | memcpy(ctrl->hostnqn, args->hostnqn, NVMF_NQN_SIZE); | |
| 1659 | - | if (args->hostid) | |
| 1660 | - | uuid_copy(&ctrl->hostid, args->hostid); | |
| 1661 | 1651 | ||
| 1662 | 1652 | kref_init(&ctrl->ref); | |
| 1663 | 1653 | ctrl->subsys = subsys; | |
| @@ -1716,6 +1706,9 @@ struct nvmet_ctrl *nvmet_alloc_ctrl(struct nvmet_alloc_ctrl_args *args) | |||
| 1716 | 1706 | ||
| 1717 | 1707 | nvmet_start_keep_alive_timer(ctrl); | |
| 1718 | 1708 | ||
| 1709 | + | if (args->hostid) | |
| 1710 | + | uuid_copy(&ctrl->hostid, args->hostid); | |
| 1711 | + | ||
| 1719 | 1712 | dhchap_status = nvmet_setup_auth(ctrl, args->sq, false); | |
| 1720 | 1713 | if (dhchap_status) { | |
| 1721 | 1714 | pr_err("Failed to setup authentication, dhchap status %u\n", | |
modified drivers/nvme/target/fabrics-cmd-auth.c
| @@ -427,7 +427,7 @@ static int nvmet_auth_challenge(struct nvmet_req *req, void *d, int al) | |||
| 427 | 427 | struct nvmet_ctrl *ctrl = req->sq->ctrl; | |
| 428 | 428 | int ret = 0; | |
| 429 | 429 | int hash_len = nvme_auth_hmac_hash_len(ctrl->shash_id); | |
| 430 | - | int data_size = sizeof(*data) + hash_len; | |
| 430 | + | int data_size = sizeof(*d) + hash_len; | |
| 431 | 431 | ||
| 432 | 432 | if (ctrl->dh_tfm) | |
| 433 | 433 | data_size += ctrl->dh_keysize; | |
modified drivers/nvme/target/nvmet.h
| @@ -112,8 +112,6 @@ struct nvmet_ns { | |||
| 112 | 112 | ||
| 113 | 113 | bool buffered_io; | |
| 114 | 114 | bool enabled; | |
| 115 | - | #define NVMET_NS_IO_LIVE 0 | |
| 116 | - | unsigned long flags; | |
| 117 | 115 | struct nvmet_subsys *subsys; | |
| 118 | 116 | const char *device_path; | |
| 119 | 117 | ||
modified drivers/nvme/target/pci-epf.c
| @@ -978,9 +978,6 @@ nvmet_pci_epf_get_sgl_segment(struct nvmet_pci_epf_ctrl *ctrl, | |||
| 978 | 978 | int nr_descs, ret; | |
| 979 | 979 | void *buf; | |
| 980 | 980 | ||
| 981 | - | if (length < sizeof(struct nvme_sgl_desc)) | |
| 982 | - | return NULL; | |
| 983 | - | ||
| 984 | 981 | buf = kmalloc(length, GFP_KERNEL); | |
| 985 | 982 | if (!buf) | |
| 986 | 983 | return NULL; | |
modified drivers/nvme/target/pr.c
| @@ -51,8 +51,6 @@ u16 nvmet_set_feat_resv_notif_mask(struct nvmet_req *req, u32 mask) | |||
| 51 | 51 | ||
| 52 | 52 | if (nsid != U32_MAX) { | |
| 53 | 53 | status = nvmet_req_find_ns(req); | |
| 54 | - | if (status == (NVME_SC_INVALID_NS | NVME_STATUS_DNR)) | |
| 55 | - | return NVME_SC_INVALID_FIELD | NVME_STATUS_DNR; | |
| 56 | 54 | if (status) | |
| 57 | 55 | return status; | |
| 58 | 56 | if (!req->ns->pr.enable) | |
| @@ -77,8 +75,6 @@ u16 nvmet_get_feat_resv_notif_mask(struct nvmet_req *req) | |||
| 77 | 75 | u16 status; | |
| 78 | 76 | ||
| 79 | 77 | status = nvmet_req_find_ns(req); | |
| 80 | - | if (status == (NVME_SC_INVALID_NS | NVME_STATUS_DNR)) | |
| 81 | - | return NVME_SC_INVALID_FIELD | NVME_STATUS_DNR; | |
| 82 | 78 | if (status) | |
| 83 | 79 | return status; | |
| 84 | 80 | ||
modified drivers/of/base.c
| @@ -96,17 +96,9 @@ static bool __of_node_is_type(const struct device_node *np, const char *type) | |||
| 96 | 96 | return !strcmp(match, type); | |
| 97 | 97 | } | |
| 98 | 98 | ||
| 99 | - | static bool of_coreboot_present(void) | |
| 100 | - | { | |
| 101 | - | struct device_node *np __free(device_node) = | |
| 102 | - | of_find_compatible_node(NULL, NULL, "coreboot"); | |
| 103 | - | ||
| 104 | - | return np; | |
| 105 | - | } | |
| 106 | - | ||
| 107 | 99 | #define EXCLUDED_DEFAULT_CELLS_PLATFORMS ( \ | |
| 108 | 100 | IS_ENABLED(CONFIG_SPARC) || \ | |
| 109 | - | of_coreboot_present() \ | |
| 101 | + | of_find_compatible_node(NULL, NULL, "coreboot") \ | |
| 110 | 102 | ) | |
| 111 | 103 | ||
| 112 | 104 | int of_bus_n_addr_cells(struct device_node *np) | |
modified drivers/of/irq.c
| @@ -754,8 +754,6 @@ void __init of_irq_init(const struct of_device_id *matches) | |||
| 754 | 754 | ||
| 755 | 755 | list_for_each_entry_safe(desc, temp_desc, &intc_parent_list, list) { | |
| 756 | 756 | list_del(&desc->list); | |
| 757 | - | of_node_put(desc->interrupt_parent); | |
| 758 | - | of_node_put(desc->dev); | |
| 759 | 757 | kfree(desc); | |
| 760 | 758 | } | |
| 761 | 759 | err: | |
modified drivers/of/overlay.c
| @@ -256,9 +256,6 @@ static struct property *dup_and_fixup_symbol_prop( | |||
| 256 | 256 | if (!target_path) | |
| 257 | 257 | return NULL; | |
| 258 | 258 | target_path_len = strlen(target_path); | |
| 259 | - | /* a root target renders as "/"; drop it to avoid "//" results */ | |
| 260 | - | if (target_path_len == 1 && target_path[0] == '/' && path_tail_len) | |
| 261 | - | target_path_len = 0; | |
| 262 | 259 | ||
| 263 | 260 | new_prop = kzalloc_obj(*new_prop); | |
| 264 | 261 | if (!new_prop) | |
| @@ -361,13 +358,12 @@ static int add_changeset_property(struct overlay_changeset *ovcs, | |||
| 361 | 358 | return -ENOMEM; | |
| 362 | 359 | ||
| 363 | 360 | if (!prop) { | |
| 364 | - | ret = of_changeset_add_property(&ovcs->cset, target->np, | |
| 365 | - | new_prop); | |
| 366 | - | /* the detached node owns the property until the apply */ | |
| 367 | - | if (!ret && !target->in_livetree) { | |
| 361 | + | if (!target->in_livetree) { | |
| 368 | 362 | new_prop->next = target->np->deadprops; | |
| 369 | 363 | target->np->deadprops = new_prop; | |
| 370 | 364 | } | |
| 365 | + | ret = of_changeset_add_property(&ovcs->cset, target->np, | |
| 366 | + | new_prop); | |
| 371 | 367 | } else { | |
| 372 | 368 | ret = of_changeset_update_property(&ovcs->cset, target->np, | |
| 373 | 369 | new_prop); | |
| @@ -857,10 +853,6 @@ static int init_overlay_changeset(struct overlay_changeset *ovcs, | |||
| 857 | 853 | err_out: | |
| 858 | 854 | pr_err("%s() failed, ret = %d\n", __func__, ret); | |
| 859 | 855 | ||
| 860 | - | /* let free_overlay_changeset() put the fragments set up so far */ | |
| 861 | - | if (ovcs->fragments) | |
| 862 | - | ovcs->count = cnt; | |
| 863 | - | ||
| 864 | 856 | return ret; | |
| 865 | 857 | } | |
| 866 | 858 | ||
| @@ -871,8 +863,7 @@ static void free_overlay_changeset(struct overlay_changeset *ovcs) | |||
| 871 | 863 | if (ovcs->cset.entries.next) | |
| 872 | 864 | of_changeset_destroy(&ovcs->cset); | |
| 873 | 865 | ||
| 874 | - | /* a failed idr_alloc() leaves its negative error in ovcs->id */ | |
| 875 | - | if (ovcs->id > 0) { | |
| 866 | + | if (ovcs->id) { | |
| 876 | 867 | idr_remove(&ovcs_idr, ovcs->id); | |
| 877 | 868 | list_del(&ovcs->ovcs_list); | |
| 878 | 869 | ovcs->id = 0; | |
modified drivers/pci/pci.c
| @@ -3769,21 +3769,8 @@ int pci_enable_atomic_ops_to_root(struct pci_dev *dev, u32 cap_mask) | |||
| 3769 | 3769 | } | |
| 3770 | 3770 | ||
| 3771 | 3771 | root = pcie_find_root_port(dev); | |
| 3772 | - | if (!root) { | |
| 3773 | - | ||
| 3774 | - | /* | |
| 3775 | - | * A hypervisor may expose a topology with the root port | |
| 3776 | - | * not visible to the guest. If the hypervisor has already | |
| 3777 | - | * set AtomicOp Requester Enable in the endpoint, we assume | |
| 3778 | - | * it has verified support in the root port, so it is safe | |
| 3779 | - | * for the driver to use AtomicOps. | |
| 3780 | - | */ | |
| 3781 | - | pcie_capability_read_dword(dev, PCI_EXP_DEVCTL2, &ctl2); | |
| 3782 | - | if (ctl2 & PCI_EXP_DEVCTL2_ATOMIC_REQ) | |
| 3783 | - | return 0; | |
| 3784 | - | ||
| 3772 | + | if (!root) | |
| 3785 | 3773 | return -EINVAL; | |
| 3786 | - | } | |
| 3787 | 3774 | ||
| 3788 | 3775 | pcie_capability_read_dword(root, PCI_EXP_DEVCAP2, &cap); | |
| 3789 | 3776 | if ((cap & cap_mask) != cap_mask) | |
modified drivers/pci/pcie/aer.c
| @@ -1360,10 +1360,8 @@ static DEFINE_KFIFO(aer_recover_ring, struct aer_recover_entry, | |||
| 1360 | 1360 | ||
| 1361 | 1361 | static void aer_recover_work_func(struct work_struct *work) | |
| 1362 | 1362 | { | |
| 1363 | - | struct aer_capability_regs *regs; | |
| 1364 | 1363 | struct aer_recover_entry entry; | |
| 1365 | 1364 | struct pci_dev *pdev; | |
| 1366 | - | u32 err; | |
| 1367 | 1365 | ||
| 1368 | 1366 | while (kfifo_get(&aer_recover_ring, &entry)) { | |
| 1369 | 1367 | pdev = pci_get_domain_bus_and_slot(entry.domain, entry.bus, | |
| @@ -1377,12 +1375,6 @@ static void aer_recover_work_func(struct work_struct *work) | |||
| 1377 | 1375 | } | |
| 1378 | 1376 | pci_print_aer(pdev, entry.severity, entry.regs); | |
| 1379 | 1377 | ||
| 1380 | - | regs = entry.regs; | |
| 1381 | - | if (entry.severity == AER_CORRECTABLE) | |
| 1382 | - | err = regs->cor_status & ~regs->cor_mask; | |
| 1383 | - | else | |
| 1384 | - | err = regs->uncor_status & ~regs->uncor_mask; | |
| 1385 | - | ||
| 1386 | 1378 | /* | |
| 1387 | 1379 | * Memory for aer_capability_regs(entry.regs) is being | |
| 1388 | 1380 | * allocated from the ghes_estatus_pool to protect it from | |
| @@ -1393,14 +1385,12 @@ static void aer_recover_work_func(struct work_struct *work) | |||
| 1393 | 1385 | ghes_estatus_pool_region_free((unsigned long)entry.regs, | |
| 1394 | 1386 | sizeof(struct aer_capability_regs)); | |
| 1395 | 1387 | ||
| 1396 | - | if (err) { | |
| 1397 | - | if (entry.severity == AER_NONFATAL) | |
| 1398 | - | pcie_do_recovery(pdev, pci_channel_io_normal, | |
| 1399 | - | aer_root_reset); | |
| 1400 | - | else if (entry.severity == AER_FATAL) | |
| 1401 | - | pcie_do_recovery(pdev, pci_channel_io_frozen, | |
| 1402 | - | aer_root_reset); | |
| 1403 | - | } | |
| 1388 | + | if (entry.severity == AER_NONFATAL) | |
| 1389 | + | pcie_do_recovery(pdev, pci_channel_io_normal, | |
| 1390 | + | aer_root_reset); | |
| 1391 | + | else if (entry.severity == AER_FATAL) | |
| 1392 | + | pcie_do_recovery(pdev, pci_channel_io_frozen, | |
| 1393 | + | aer_root_reset); | |
| 1404 | 1394 | pci_dev_put(pdev); | |
| 1405 | 1395 | } | |
| 1406 | 1396 | } | |
modified drivers/pinctrl/qcom/pinctrl-hawi.c
| @@ -47,6 +47,7 @@ | |||
| 47 | 47 | .intr_wakeup_present_bit = 6, \ | |
| 48 | 48 | .intr_wakeup_enable_bit = 7, \ | |
| 49 | 49 | .intr_target_bit = 8, \ | |
| 50 | + | .intr_target_width = 4, \ | |
| 50 | 51 | .intr_target_kpss_val = 3, \ | |
| 51 | 52 | .intr_raw_status_bit = 4, \ | |
| 52 | 53 | .intr_polarity_bit = 1, \ | |
modified drivers/pinctrl/qcom/pinctrl-ipq5018.c
| @@ -563,7 +563,7 @@ static const char * const qdss_cti_trig_out_b1_groups[] = { | |||
| 563 | 563 | }; | |
| 564 | 564 | ||
| 565 | 565 | static const char * const pwm3_groups[] = { | |
| 566 | - | "gpio45", | |
| 566 | + | "gpio45", "gpio13", | |
| 567 | 567 | }; | |
| 568 | 568 | ||
| 569 | 569 | static const char * const qdss_cti_trig_in_b1_groups[] = { | |
| @@ -689,7 +689,7 @@ static const struct msm_pingroup ipq5018_groups[] = { | |||
| 689 | 689 | PINGROUP(10, blsp0_spi, blsp1_uart0, led0, gcc_plltest, qdss_tracedata_a, _, _, _, _), | |
| 690 | 690 | PINGROUP(11, blsp0_spi, blsp1_uart0, _, gcc_tlmm, qdss_tracedata_a, _, _, _, _), | |
| 691 | 691 | PINGROUP(12, blsp0_spi, blsp0_i2c, blsp1_uart0, _, gcc_plltest, qdss_tracedata_a, _, _, _), | |
| 692 | - | PINGROUP(13, blsp0_spi, blsp0_i2c, blsp1_uart0, _, qdss_tracedata_a, _, _, _, _), | |
| 692 | + | PINGROUP(13, blsp0_spi, blsp0_i2c, blsp1_uart0, pwm3, qdss_tracedata_a, _, _, _, _), | |
| 693 | 693 | PINGROUP(14, pcie0_clk, _, _, cri_trng0, qdss_tracedata_a, _, _, _, _), | |
| 694 | 694 | PINGROUP(15, _, _, cri_trng1, qdss_tracedata_a, _, _, _, _, _), | |
| 695 | 695 | PINGROUP(16, pcie0_wake, _, _, cri_trng, qdss_tracedata_a, _, _, _, _), | |
modified drivers/pinctrl/qcom/pinctrl-maili.c
| @@ -47,6 +47,7 @@ | |||
| 47 | 47 | .intr_wakeup_present_bit = 6, \ | |
| 48 | 48 | .intr_wakeup_enable_bit = 7, \ | |
| 49 | 49 | .intr_target_bit = 8, \ | |
| 50 | + | .intr_target_width = 4, \ | |
| 50 | 51 | .intr_target_kpss_val = 3, \ | |
| 51 | 52 | .intr_raw_status_bit = 4, \ | |
| 52 | 53 | .intr_polarity_bit = 1, \ | |
modified drivers/pinctrl/qcom/pinctrl-nord.c
| @@ -32,6 +32,7 @@ | |||
| 32 | 32 | .intr_wakeup_present_bit = 6, \ | |
| 33 | 33 | .intr_wakeup_enable_bit = 7, \ | |
| 34 | 34 | .intr_target_bit = 8, \ | |
| 35 | + | .intr_target_width = 4, \ | |
| 35 | 36 | .intr_target_kpss_val = 3, \ | |
| 36 | 37 | .intr_raw_status_bit = 4, \ | |
| 37 | 38 | .intr_polarity_bit = 1, \ | |
modified drivers/pinctrl/qcom/pinctrl-qcs8300.c
| @@ -45,6 +45,7 @@ | |||
| 45 | 45 | .intr_enable_bit = 0, \ | |
| 46 | 46 | .intr_status_bit = 0, \ | |
| 47 | 47 | .intr_target_bit = 5, \ | |
| 48 | + | .intr_target_width = 4, \ | |
| 48 | 49 | .intr_target_kpss_val = 3, \ | |
| 49 | 50 | .intr_raw_status_bit = 4, \ | |
| 50 | 51 | .intr_polarity_bit = 1, \ | |
modified drivers/pinctrl/qcom/pinctrl-spmi-gpio.c
| @@ -734,29 +734,50 @@ static int pmic_gpio_get_direction(struct gpio_chip *chip, unsigned pin) | |||
| 734 | 734 | (!pad->input_enabled && !pad->output_enabled)) | |
| 735 | 735 | return -EINVAL; | |
| 736 | 736 | ||
| 737 | - | /* Make sure the state is aligned on what pmic_gpio_get() returns */ | |
| 738 | - | return pad->input_enabled ? GPIO_LINE_DIRECTION_IN : GPIO_LINE_DIRECTION_OUT; | |
| 737 | + | /* | |
| 738 | + | * An open-drain or open-source pad keeps its input buffer enabled while | |
| 739 | + | * driving, so the output buffer is what tells the direction. | |
| 740 | + | */ | |
| 741 | + | return pad->output_enabled ? GPIO_LINE_DIRECTION_OUT : GPIO_LINE_DIRECTION_IN; | |
| 739 | 742 | } | |
| 740 | 743 | ||
| 741 | 744 | static int pmic_gpio_direction_input(struct gpio_chip *chip, unsigned pin) | |
| 742 | 745 | { | |
| 743 | 746 | struct pmic_gpio_state *state = gpiochip_get_data(chip); | |
| 744 | - | unsigned long config; | |
| 747 | + | unsigned long configs[2]; | |
| 745 | 748 | ||
| 746 | - | config = pinconf_to_config_packed(PIN_CONFIG_INPUT_ENABLE, 1); | |
| 749 | + | configs[0] = pinconf_to_config_packed(PIN_CONFIG_OUTPUT_ENABLE, 0); | |
| 750 | + | configs[1] = pinconf_to_config_packed(PIN_CONFIG_INPUT_ENABLE, 1); | |
| 747 | 751 | ||
| 748 | - | return pmic_gpio_config_set(state->ctrl, pin, &config, 1); | |
| 752 | + | return pmic_gpio_config_set(state->ctrl, pin, configs, | |
| 753 | + | ARRAY_SIZE(configs)); | |
| 749 | 754 | } | |
| 750 | 755 | ||
| 751 | 756 | static int pmic_gpio_direction_output(struct gpio_chip *chip, | |
| 752 | 757 | unsigned pin, int val) | |
| 753 | 758 | { | |
| 754 | 759 | struct pmic_gpio_state *state = gpiochip_get_data(chip); | |
| 755 | - | unsigned long config; | |
| 760 | + | struct pmic_gpio_pad *pad = state->ctrl->desc->pins[pin].drv_data; | |
| 761 | + | unsigned long configs[2]; | |
| 756 | 762 | ||
| 757 | - | config = pinconf_to_config_packed(PIN_CONFIG_LEVEL, val); | |
| 763 | + | /* | |
| 764 | + | * An open-drain or open-source pad only ever drives one rail, so the | |
| 765 | + | * line can still be sampled while the pad is an output. Keep the input | |
| 766 | + | * buffer enabled for those, so that pmic_gpio_get() reports what is on | |
| 767 | + | * the wire rather than the value last written, and disable it for a | |
| 768 | + | * CMOS pad, so that the pad ends up in DIGITAL_OUTPUT rather than | |
| 769 | + | * DIGITAL_INPUT_OUTPUT. Program it either way, as the buffer may have | |
| 770 | + | * been left in the opposite state by the bootloader or by an earlier | |
| 771 | + | * direction change with a different buffer type. gpiolib applies | |
| 772 | + | * PIN_CONFIG_DRIVE_OPEN_DRAIN before calling this, so buffer_type is | |
| 773 | + | * already up to date here. | |
| 774 | + | */ | |
| 775 | + | configs[0] = pinconf_to_config_packed(PIN_CONFIG_INPUT_ENABLE, | |
| 776 | + | pad->buffer_type != PMIC_GPIO_OUT_BUF_CMOS); | |
| 777 | + | configs[1] = pinconf_to_config_packed(PIN_CONFIG_LEVEL, val); | |
| 758 | 778 | ||
| 759 | - | return pmic_gpio_config_set(state->ctrl, pin, &config, 1); | |
| 779 | + | return pmic_gpio_config_set(state->ctrl, pin, configs, | |
| 780 | + | ARRAY_SIZE(configs)); | |
| 760 | 781 | } | |
| 761 | 782 | ||
| 762 | 783 | static int pmic_gpio_get(struct gpio_chip *chip, unsigned pin) | |
modified drivers/pmdomain/imx/imx8m-blk-ctrl.c
| @@ -15,7 +15,6 @@ | |||
| 15 | 15 | #include <linux/pm_runtime.h> | |
| 16 | 16 | #include <linux/regmap.h> | |
| 17 | 17 | #include <linux/clk.h> | |
| 18 | - | #include <linux/mutex.h> | |
| 19 | 18 | ||
| 20 | 19 | #include <dt-bindings/power/imx8mm-power.h> | |
| 21 | 20 | #include <dt-bindings/power/imx8mn-power.h> | |
| @@ -35,12 +34,6 @@ struct imx8m_blk_ctrl { | |||
| 35 | 34 | struct regmap *regmap; | |
| 36 | 35 | struct imx8m_blk_ctrl_domain *domains; | |
| 37 | 36 | struct genpd_onecell_data onecell_data; | |
| 38 | - | /* | |
| 39 | - | * Serializes the blk-ctrl reset/clock sequence across sibling domains; | |
| 40 | - | * their transitions interact through the shared VPUMIX bus domain, | |
| 41 | - | * VPU_NOC and the not-ack-verified ADB400 handshake (ERR050531). | |
| 42 | - | */ | |
| 43 | - | struct mutex power_lock; | |
| 44 | 37 | }; | |
| 45 | 38 | ||
| 46 | 39 | struct imx8m_blk_ctrl_domain_data { | |
| @@ -105,8 +98,6 @@ static int imx8m_blk_ctrl_power_on(struct generic_pm_domain *genpd) | |||
| 105 | 98 | struct imx8m_blk_ctrl *bc = domain->bc; | |
| 106 | 99 | int ret; | |
| 107 | 100 | ||
| 108 | - | guard(mutex)(&bc->power_lock); | |
| 109 | - | ||
| 110 | 101 | /* make sure bus domain is awake */ | |
| 111 | 102 | ret = pm_runtime_get_sync(bc->bus_power_dev); | |
| 112 | 103 | if (ret < 0) { | |
| @@ -173,8 +164,6 @@ static int imx8m_blk_ctrl_power_off(struct generic_pm_domain *genpd) | |||
| 173 | 164 | const struct imx8m_blk_ctrl_domain_data *data = domain->data; | |
| 174 | 165 | struct imx8m_blk_ctrl *bc = domain->bc; | |
| 175 | 166 | ||
| 176 | - | guard(mutex)(&bc->power_lock); | |
| 177 | - | ||
| 178 | 167 | /* put devices into reset and disable clocks */ | |
| 179 | 168 | if (data->mipi_phy_rst_mask) | |
| 180 | 169 | regmap_clear_bits(bc->regmap, BLK_MIPI_RESET_DIV, data->mipi_phy_rst_mask); | |
| @@ -213,10 +202,6 @@ static int imx8m_blk_ctrl_probe(struct platform_device *pdev) | |||
| 213 | 202 | ||
| 214 | 203 | bc->dev = dev; | |
| 215 | 204 | ||
| 216 | - | ret = devm_mutex_init(dev, &bc->power_lock); | |
| 217 | - | if (ret) | |
| 218 | - | return ret; | |
| 219 | - | ||
| 220 | 205 | bc_data = of_device_get_match_data(dev); | |
| 221 | 206 | ||
| 222 | 207 | base = devm_platform_ioremap_resource(pdev, 0); | |
modified drivers/pmdomain/rockchip/pm-domains.c
| @@ -759,19 +759,7 @@ static int rockchip_pd_attach_dev(struct generic_pm_domain *genpd, | |||
| 759 | 759 | } | |
| 760 | 760 | ||
| 761 | 761 | i = 0; | |
| 762 | - | while (1) { | |
| 763 | - | clk = of_clk_get(dev->of_node, i++); | |
| 764 | - | if (IS_ERR(clk)) { | |
| 765 | - | error = PTR_ERR(clk); | |
| 766 | - | if (error == -ENOENT) | |
| 767 | - | break; | |
| 768 | - | ||
| 769 | - | dev_err(dev, "failed to get clock %d: %d\n", i - 1, | |
| 770 | - | error); | |
| 771 | - | pm_clk_destroy(dev); | |
| 772 | - | return error; | |
| 773 | - | } | |
| 774 | - | ||
| 762 | + | while ((clk = of_clk_get(dev->of_node, i++)) && !IS_ERR(clk)) { | |
| 775 | 763 | dev_dbg(dev, "adding clock '%pC' to list of PM clocks\n", clk); | |
| 776 | 764 | error = pm_clk_add_clk(dev, clk); | |
| 777 | 765 | if (error) { | |
| @@ -854,7 +842,7 @@ static int rockchip_pm_add_one_domain(struct rockchip_pmu *pmu, | |||
| 854 | 842 | dev_err(pmu->dev, | |
| 855 | 843 | "%pOFn: failed to get clk at index %d: %d\n", | |
| 856 | 844 | node, i, error); | |
| 857 | - | goto err_put_clocks; | |
| 845 | + | return error; | |
| 858 | 846 | } | |
| 859 | 847 | } | |
| 860 | 848 | ||
| @@ -1030,9 +1018,7 @@ static int rockchip_pm_add_subdomain(struct rockchip_pmu *pmu, | |||
| 1030 | 1018 | parent_domain->name, child_domain->name); | |
| 1031 | 1019 | } | |
| 1032 | 1020 | ||
| 1033 | - | error = rockchip_pm_add_subdomain(pmu, np); | |
| 1034 | - | if (error) | |
| 1035 | - | return error; | |
| 1021 | + | rockchip_pm_add_subdomain(pmu, np); | |
| 1036 | 1022 | } | |
| 1037 | 1023 | ||
| 1038 | 1024 | return 0; | |
modified drivers/power/sequencing/pwrseq-pcie-m2.c
| @@ -197,8 +197,6 @@ static const struct pci_device_id pwrseq_m2_pci_ids[] = { | |||
| 197 | 197 | .driver_data = (kernel_ulong_t)"qcom,wcn6855-bt" }, | |
| 198 | 198 | { PCI_DEVICE_SUB(PCI_VENDOR_ID_QCOM, 0x1107, PCI_VENDOR_ID_QCOM, 0x337c), | |
| 199 | 199 | .driver_data = (kernel_ulong_t)"qcom,wcn7850-bt" }, | |
| 200 | - | { PCI_DEVICE_SUB(PCI_VENDOR_ID_QCOM, 0x1107, PCI_VENDOR_ID_LENOVO, 0xe0e9), | |
| 201 | - | .driver_data = (kernel_ulong_t)"qcom,wcn7850-bt" }, | |
| 202 | 200 | { } /* Sentinel */ | |
| 203 | 201 | }; | |
| 204 | 202 | ||
| @@ -572,7 +570,6 @@ err_destroy_mutex: | |||
| 572 | 570 | mutex_destroy(&ctx->list_lock); | |
| 573 | 571 | err_free_regulators: | |
| 574 | 572 | regulator_bulk_free(ctx->num_vregs, ctx->regs); | |
| 575 | - | kfree(ctx->regs); | |
| 576 | 573 | ||
| 577 | 574 | return ret; | |
| 578 | 575 | } | |
| @@ -586,7 +583,6 @@ static void pwrseq_pcie_m2_remove(struct platform_device *pdev) | |||
| 586 | 583 | mutex_destroy(&ctx->list_lock); | |
| 587 | 584 | ||
| 588 | 585 | regulator_bulk_free(ctx->num_vregs, ctx->regs); | |
| 589 | - | kfree(ctx->regs); | |
| 590 | 586 | } | |
| 591 | 587 | ||
| 592 | 588 | static const struct of_device_id pwrseq_pcie_m2_of_match[] = { | |
modified drivers/ptp/ptp_ocp.c
| @@ -1825,7 +1825,7 @@ ptp_ocp_watchdog(struct timer_list *t) | |||
| 1825 | 1825 | static void | |
| 1826 | 1826 | ptp_ocp_estimate_pci_timing(struct ptp_ocp *bp) | |
| 1827 | 1827 | { | |
| 1828 | - | ktime_t start, end, delay = KTIME_MAX; | |
| 1828 | + | ktime_t start, end, delay = U64_MAX; | |
| 1829 | 1829 | u32 ctrl; | |
| 1830 | 1830 | int i; | |
| 1831 | 1831 | ||
modified drivers/regulator/ltc3676.c
| @@ -232,7 +232,7 @@ static const struct regulator_desc ltc3676_regulators[LTC3676_NUM_REGULATORS] = | |||
| 232 | 232 | LTC3676_FIXED_REG(LDO4, ldo4, LDOB, 2), | |
| 233 | 233 | }; | |
| 234 | 234 | ||
| 235 | - | static bool ltc3676_writeable_reg(struct device *dev, unsigned int reg) | |
| 235 | + | static bool ltc3676_readable_writeable_reg(struct device *dev, unsigned int reg) | |
| 236 | 236 | { | |
| 237 | 237 | switch (reg) { | |
| 238 | 238 | case LTC3676_BUCK1 ... LTC3676_IRQSTAT: | |
| @@ -243,15 +243,6 @@ static bool ltc3676_writeable_reg(struct device *dev, unsigned int reg) | |||
| 243 | 243 | return false; | |
| 244 | 244 | } | |
| 245 | 245 | ||
| 246 | - | static bool ltc3676_readable_reg(struct device *dev, unsigned int reg) | |
| 247 | - | { | |
| 248 | - | switch (reg) { | |
| 249 | - | case LTC3676_BUCK1 ... LTC3676_IRQSTAT: | |
| 250 | - | return true; | |
| 251 | - | } | |
| 252 | - | return false; | |
| 253 | - | } | |
| 254 | - | ||
| 255 | 246 | static bool ltc3676_volatile_reg(struct device *dev, unsigned int reg) | |
| 256 | 247 | { | |
| 257 | 248 | switch (reg) { | |
| @@ -264,8 +255,8 @@ static bool ltc3676_volatile_reg(struct device *dev, unsigned int reg) | |||
| 264 | 255 | static const struct regmap_config ltc3676_regmap_config = { | |
| 265 | 256 | .reg_bits = 8, | |
| 266 | 257 | .val_bits = 8, | |
| 267 | - | .writeable_reg = ltc3676_writeable_reg, | |
| 268 | - | .readable_reg = ltc3676_readable_reg, | |
| 258 | + | .writeable_reg = ltc3676_readable_writeable_reg, | |
| 259 | + | .readable_reg = ltc3676_readable_writeable_reg, | |
| 269 | 260 | .volatile_reg = ltc3676_volatile_reg, | |
| 270 | 261 | .max_register = LTC3676_CLIRQ, | |
| 271 | 262 | .use_single_read = true, | |
modified drivers/regulator/of_regulator.c
| @@ -929,26 +929,21 @@ static int is_supply_name(const char *name) | |||
| 929 | 929 | * before returning to the caller, and @consumers will not be | |
| 930 | 930 | * changed. | |
| 931 | 931 | * | |
| 932 | - | * On success the array is allocated here and handed to the caller, which | |
| 933 | - | * owns it from then on: release the regulators with regulator_bulk_free() | |
| 934 | - | * and free the array itself with kfree(). The supply names live in the | |
| 935 | - | * same allocation, so they are gone once the array is freed. | |
| 936 | - | * | |
| 937 | 932 | * Return: Number of regulators on success, or a negative error number | |
| 938 | 933 | * on failure. | |
| 939 | 934 | */ | |
| 940 | 935 | int of_regulator_bulk_get_all(struct device *dev, struct device_node *np, | |
| 941 | 936 | struct regulator_bulk_data **consumers) | |
| 942 | 937 | { | |
| 943 | - | int num_consumers = 0, names_len = 0; | |
| 938 | + | int num_consumers = 0; | |
| 944 | 939 | struct regulator *tmp; | |
| 945 | 940 | struct regulator_bulk_data *_consumers = NULL; | |
| 946 | 941 | struct property *prop; | |
| 947 | - | char *names; | |
| 948 | 942 | int i, n = 0, ret; | |
| 943 | + | char name[64]; | |
| 949 | 944 | ||
| 950 | 945 | /* | |
| 951 | - | * first pass: get numbers of xxx-supply and the room their names take | |
| 946 | + | * first pass: get numbers of xxx-supply | |
| 952 | 947 | * second pass: fill consumers | |
| 953 | 948 | */ | |
| 954 | 949 | restart: | |
| @@ -958,19 +953,16 @@ restart: | |||
| 958 | 953 | continue; | |
| 959 | 954 | if (!_consumers) { | |
| 960 | 955 | num_consumers++; | |
| 961 | - | names_len += i + 1; | |
| 962 | 956 | continue; | |
| 963 | 957 | } else { | |
| 964 | - | memcpy(names, prop->name, i); | |
| 965 | - | names[i] = '\0'; | |
| 966 | - | tmp = regulator_get(dev, names); | |
| 958 | + | memcpy(name, prop->name, i); | |
| 959 | + | name[i] = '\0'; | |
| 960 | + | tmp = regulator_get(dev, name); | |
| 967 | 961 | if (IS_ERR(tmp)) { | |
| 968 | 962 | ret = PTR_ERR(tmp); | |
| 969 | 963 | goto error; | |
| 970 | 964 | } | |
| 971 | - | _consumers[n].supply = names; | |
| 972 | 965 | _consumers[n].consumer = tmp; | |
| 973 | - | names += i + 1; | |
| 974 | 966 | n++; | |
| 975 | 967 | continue; | |
| 976 | 968 | } | |
| @@ -981,16 +973,9 @@ restart: | |||
| 981 | 973 | } | |
| 982 | 974 | if (num_consumers == 0) | |
| 983 | 975 | return 0; | |
| 984 | - | /* | |
| 985 | - | * The supply names are kept in the same allocation as the array, so | |
| 986 | - | * that they share its lifetime and the caller has nothing extra to | |
| 987 | - | * free. | |
| 988 | - | */ | |
| 989 | - | _consumers = kzalloc(size_add(size_mul(num_consumers, sizeof(*_consumers)), | |
| 990 | - | names_len), GFP_KERNEL); | |
| 976 | + | _consumers = kmalloc_objs(struct regulator_bulk_data, num_consumers); | |
| 991 | 977 | if (!_consumers) | |
| 992 | 978 | return -ENOMEM; | |
| 993 | - | names = (char *)(_consumers + num_consumers); | |
| 994 | 979 | goto restart; | |
| 995 | 980 | ||
| 996 | 981 | error: | |
modified drivers/regulator/tps6594-regulator.c
| @@ -241,21 +241,21 @@ static const struct regulator_desc tps65224_buck_regs[] = { | |||
| 241 | 241 | TPS65224_MASK_BUCKS_VSET, | |
| 242 | 242 | TPS6594_REG_BUCKX_CTRL(1), | |
| 243 | 243 | TPS6594_BIT_BUCK_EN, 0, 0, tps65224_bucks_2_3_4_ranges, | |
| 244 | - | ARRAY_SIZE(tps65224_bucks_2_3_4_ranges), 0, 0, NULL, 0, 0), | |
| 244 | + | 4, 0, 0, NULL, 0, 0), | |
| 245 | 245 | TPS6594_REGULATOR("BUCK3", "buck3", TPS6594_BUCK_3, | |
| 246 | 246 | REGULATOR_VOLTAGE, tps6594_bucks_ops, TPS65224_MASK_BUCKS_VSET, | |
| 247 | 247 | TPS6594_REG_BUCKX_VOUT_1(2), | |
| 248 | 248 | TPS65224_MASK_BUCKS_VSET, | |
| 249 | 249 | TPS6594_REG_BUCKX_CTRL(2), | |
| 250 | 250 | TPS6594_BIT_BUCK_EN, 0, 0, tps65224_bucks_2_3_4_ranges, | |
| 251 | - | ARRAY_SIZE(tps65224_bucks_2_3_4_ranges), 0, 0, NULL, 0, 0), | |
| 251 | + | 4, 0, 0, NULL, 0, 0), | |
| 252 | 252 | TPS6594_REGULATOR("BUCK4", "buck4", TPS6594_BUCK_4, | |
| 253 | 253 | REGULATOR_VOLTAGE, tps6594_bucks_ops, TPS65224_MASK_BUCKS_VSET, | |
| 254 | 254 | TPS6594_REG_BUCKX_VOUT_1(3), | |
| 255 | 255 | TPS65224_MASK_BUCKS_VSET, | |
| 256 | 256 | TPS6594_REG_BUCKX_CTRL(3), | |
| 257 | 257 | TPS6594_BIT_BUCK_EN, 0, 0, tps65224_bucks_2_3_4_ranges, | |
| 258 | - | ARRAY_SIZE(tps65224_bucks_2_3_4_ranges), 0, 0, NULL, 0, 0), | |
| 258 | + | 4, 0, 0, NULL, 0, 0), | |
| 259 | 259 | }; | |
| 260 | 260 | ||
| 261 | 261 | static const struct tps6594_regulator_irq_type tps6594_buck1_irq_types[] = { | |
modified drivers/rtc/dev.c
| @@ -216,7 +216,7 @@ static long rtc_dev_ioctl(struct file *file, | |||
| 216 | 216 | struct rtc_device *rtc = file->private_data; | |
| 217 | 217 | const struct rtc_class_ops *ops = rtc->ops; | |
| 218 | 218 | struct rtc_time tm; | |
| 219 | - | struct rtc_wkalrm alarm = { 0 }; | |
| 219 | + | struct rtc_wkalrm alarm; | |
| 220 | 220 | struct rtc_param param; | |
| 221 | 221 | void __user *uarg = (void __user *)arg; | |
| 222 | 222 | ||
modified drivers/rtc/rtc-ac100.c
| @@ -317,12 +317,10 @@ static int ac100_rtc_register_clks(struct ac100_rtc_dev *chip) | |||
| 317 | 317 | if (!chip->clk_data) | |
| 318 | 318 | return -ENOMEM; | |
| 319 | 319 | ||
| 320 | - | chip->clk_data->num = AC100_CLKOUT_NUM; | |
| 321 | - | ||
| 322 | - | chip->rtc_32k_clk = devm_clk_hw_register_fixed_rate(chip->dev, | |
| 323 | - | AC100_RTC_32K_NAME, | |
| 324 | - | NULL, 0, | |
| 325 | - | AC100_RTC_32K_RATE); | |
| 320 | + | chip->rtc_32k_clk = clk_hw_register_fixed_rate(chip->dev, | |
| 321 | + | AC100_RTC_32K_NAME, | |
| 322 | + | NULL, 0, | |
| 323 | + | AC100_RTC_32K_RATE); | |
| 326 | 324 | if (IS_ERR(chip->rtc_32k_clk)) { | |
| 327 | 325 | ret = PTR_ERR(chip->rtc_32k_clk); | |
| 328 | 326 | dev_err(chip->dev, "Failed to register RTC-32k clock: %d\n", | |
| @@ -356,14 +354,29 @@ static int ac100_rtc_register_clks(struct ac100_rtc_dev *chip) | |||
| 356 | 354 | if (ret) { | |
| 357 | 355 | dev_err(chip->dev, "Failed to register clk '%s': %d\n", | |
| 358 | 356 | init.name, ret); | |
| 359 | - | return ret; | |
| 357 | + | goto err_unregister_rtc_32k; | |
| 360 | 358 | } | |
| 361 | 359 | ||
| 362 | 360 | chip->clk_data->hws[i] = &clk->hw; | |
| 363 | 361 | } | |
| 364 | 362 | ||
| 365 | - | return devm_of_clk_add_hw_provider(chip->dev, of_clk_hw_onecell_get, | |
| 366 | - | chip->clk_data); | |
| 363 | + | chip->clk_data->num = i; | |
| 364 | + | ret = of_clk_add_hw_provider(np, of_clk_hw_onecell_get, chip->clk_data); | |
| 365 | + | if (ret) | |
| 366 | + | goto err_unregister_rtc_32k; | |
| 367 | + | ||
| 368 | + | return 0; | |
| 369 | + | ||
| 370 | + | err_unregister_rtc_32k: | |
| 371 | + | clk_unregister_fixed_rate(chip->rtc_32k_clk->clk); | |
| 372 | + | ||
| 373 | + | return ret; | |
| 374 | + | } | |
| 375 | + | ||
| 376 | + | static void ac100_rtc_unregister_clks(struct ac100_rtc_dev *chip) | |
| 377 | + | { | |
| 378 | + | of_clk_del_provider(chip->dev->of_node); | |
| 379 | + | clk_unregister_fixed_rate(chip->rtc_32k_clk->clk); | |
| 367 | 380 | } | |
| 368 | 381 | ||
| 369 | 382 | /* | |
| @@ -601,6 +614,13 @@ static int ac100_rtc_probe(struct platform_device *pdev) | |||
| 601 | 614 | return devm_rtc_register_device(chip->rtc); | |
| 602 | 615 | } | |
| 603 | 616 | ||
| 617 | + | static void ac100_rtc_remove(struct platform_device *pdev) | |
| 618 | + | { | |
| 619 | + | struct ac100_rtc_dev *chip = platform_get_drvdata(pdev); | |
| 620 | + | ||
| 621 | + | ac100_rtc_unregister_clks(chip); | |
| 622 | + | } | |
| 623 | + | ||
| 604 | 624 | static const struct of_device_id ac100_rtc_match[] = { | |
| 605 | 625 | { .compatible = "x-powers,ac100-rtc" }, | |
| 606 | 626 | { }, | |
| @@ -609,6 +629,7 @@ MODULE_DEVICE_TABLE(of, ac100_rtc_match); | |||
| 609 | 629 | ||
| 610 | 630 | static struct platform_driver ac100_rtc_driver = { | |
| 611 | 631 | .probe = ac100_rtc_probe, | |
| 632 | + | .remove = ac100_rtc_remove, | |
| 612 | 633 | .driver = { | |
| 613 | 634 | .name = "ac100-rtc", | |
| 614 | 635 | .of_match_table = of_match_ptr(ac100_rtc_match), | |
modified drivers/rtc/rtc-efi.c
| @@ -52,7 +52,6 @@ compute_wday(efi_time_t *eft, int yday) | |||
| 52 | 52 | static void | |
| 53 | 53 | convert_to_efi_time(struct rtc_time *wtime, efi_time_t *eft) | |
| 54 | 54 | { | |
| 55 | - | memset(eft, 0, sizeof(*eft)); | |
| 56 | 55 | eft->year = wtime->tm_year + 1900; | |
| 57 | 56 | eft->month = wtime->tm_mon + 1; | |
| 58 | 57 | eft->day = wtime->tm_mday; | |
| @@ -113,35 +112,6 @@ convert_from_efi_time(efi_time_t *eft, struct rtc_time *wtime) | |||
| 113 | 112 | return true; | |
| 114 | 113 | } | |
| 115 | 114 | ||
| 116 | - | static int efi_read_alarm(struct device *dev, struct rtc_wkalrm *wkalrm) | |
| 117 | - | { | |
| 118 | - | efi_time_t eft; | |
| 119 | - | efi_status_t status; | |
| 120 | - | ||
| 121 | - | memset(&eft, 0, sizeof(eft)); | |
| 122 | - | status = efi.get_wakeup_time((efi_bool_t *)&wkalrm->enabled, | |
| 123 | - | (efi_bool_t *)&wkalrm->pending, &eft); | |
| 124 | - | if (status != EFI_SUCCESS) | |
| 125 | - | return -EINVAL; | |
| 126 | - | ||
| 127 | - | if (!convert_from_efi_time(&eft, &wkalrm->time)) | |
| 128 | - | return -EIO; | |
| 129 | - | ||
| 130 | - | return rtc_valid_tm(&wkalrm->time); | |
| 131 | - | } | |
| 132 | - | ||
| 133 | - | static int efi_set_alarm(struct device *dev, struct rtc_wkalrm *wkalrm) | |
| 134 | - | { | |
| 135 | - | efi_time_t eft; | |
| 136 | - | efi_status_t status; | |
| 137 | - | ||
| 138 | - | convert_to_efi_time(&wkalrm->time, &eft); | |
| 139 | - | ||
| 140 | - | status = efi.set_wakeup_time((efi_bool_t)!!wkalrm->enabled, &eft); | |
| 141 | - | ||
| 142 | - | return status == EFI_SUCCESS ? 0 : -EINVAL; | |
| 143 | - | } | |
| 144 | - | ||
| 145 | 115 | static int efi_read_time(struct device *dev, struct rtc_time *tm) | |
| 146 | 116 | { | |
| 147 | 117 | efi_status_t status; | |
| @@ -176,21 +146,13 @@ static int efi_set_time(struct device *dev, struct rtc_time *tm) | |||
| 176 | 146 | ||
| 177 | 147 | static int efi_procfs(struct device *dev, struct seq_file *seq) | |
| 178 | 148 | { | |
| 179 | - | efi_time_t eft, alm; | |
| 149 | + | efi_time_t eft; | |
| 180 | 150 | efi_time_cap_t cap; | |
| 181 | - | efi_bool_t enabled, pending; | |
| 182 | - | struct rtc_device *rtc = dev_get_drvdata(dev); | |
| 183 | 151 | ||
| 184 | 152 | memset(&eft, 0, sizeof(eft)); | |
| 185 | - | memset(&alm, 0, sizeof(alm)); | |
| 186 | 153 | memset(&cap, 0, sizeof(cap)); | |
| 187 | 154 | ||
| 188 | 155 | efi.get_time(&eft, &cap); | |
| 189 | - | if (test_bit(RTC_FEATURE_ALARM, rtc->features) && | |
| 190 | - | efi.get_wakeup_time(&enabled, &pending, &alm) != EFI_SUCCESS) { | |
| 191 | - | enabled = 0; | |
| 192 | - | pending = 0; | |
| 193 | - | } | |
| 194 | 156 | ||
| 195 | 157 | seq_printf(seq, | |
| 196 | 158 | "Time\t\t: %u:%u:%u.%09u\n" | |
| @@ -206,25 +168,6 @@ static int efi_procfs(struct device *dev, struct seq_file *seq) | |||
| 206 | 168 | /* XXX fixme: convert to string? */ | |
| 207 | 169 | seq_printf(seq, "Timezone\t: %u\n", eft.timezone); | |
| 208 | 170 | ||
| 209 | - | if (test_bit(RTC_FEATURE_ALARM, rtc->features)) { | |
| 210 | - | seq_printf(seq, | |
| 211 | - | "Alarm Time\t: %u:%u:%u.%09u\n" | |
| 212 | - | "Alarm Date\t: %u-%u-%u\n" | |
| 213 | - | "Alarm Daylight\t: %u\n" | |
| 214 | - | "Enabled\t\t: %s\n" | |
| 215 | - | "Pending\t\t: %s\n", | |
| 216 | - | alm.hour, alm.minute, alm.second, alm.nanosecond, | |
| 217 | - | alm.year, alm.month, alm.day, | |
| 218 | - | alm.daylight, | |
| 219 | - | enabled == 1 ? "yes" : "no", | |
| 220 | - | pending == 1 ? "yes" : "no"); | |
| 221 | - | ||
| 222 | - | if (alm.timezone == EFI_UNSPECIFIED_TIMEZONE) | |
| 223 | - | seq_puts(seq, "Alarm Timezone\t: unspecified\n"); | |
| 224 | - | else | |
| 225 | - | seq_printf(seq, "Alarm Timezone\t: %d\n", alm.timezone); | |
| 226 | - | } | |
| 227 | - | ||
| 228 | 171 | /* | |
| 229 | 172 | * now prints the capabilities | |
| 230 | 173 | */ | |
| @@ -240,8 +183,6 @@ static int efi_procfs(struct device *dev, struct seq_file *seq) | |||
| 240 | 183 | static const struct rtc_class_ops efi_rtc_ops = { | |
| 241 | 184 | .read_time = efi_read_time, | |
| 242 | 185 | .set_time = efi_set_time, | |
| 243 | - | .read_alarm = efi_read_alarm, | |
| 244 | - | .set_alarm = efi_set_alarm, | |
| 245 | 186 | .proc = efi_procfs, | |
| 246 | 187 | }; | |
| 247 | 188 | ||
| @@ -250,7 +191,6 @@ static int __init efi_rtc_probe(struct platform_device *dev) | |||
| 250 | 191 | struct rtc_device *rtc; | |
| 251 | 192 | efi_time_t eft; | |
| 252 | 193 | efi_time_cap_t cap; | |
| 253 | - | efi_bool_t enabled, pending; | |
| 254 | 194 | ||
| 255 | 195 | /* First check if the RTC is usable */ | |
| 256 | 196 | if (efi.get_time(&eft, &cap) != EFI_SUCCESS) | |
| @@ -263,23 +203,7 @@ static int __init efi_rtc_probe(struct platform_device *dev) | |||
| 263 | 203 | platform_set_drvdata(dev, rtc); | |
| 264 | 204 | ||
| 265 | 205 | rtc->ops = &efi_rtc_ops; | |
| 266 | - | clear_bit(RTC_FEATURE_UPDATE_INTERRUPT, rtc->features); | |
| 267 | - | ||
| 268 | - | /* | |
| 269 | - | * The EFI_RT_SUPPORTED_WAKEUP_SERVICES bit defaults to enabled | |
| 270 | - | * and only gets cleared when the RT_PROP table explicitly says | |
| 271 | - | * wakeup is unsupported. Many platforms lack an RT_PROP table | |
| 272 | - | * even though they don't implement the wakeup runtime service, | |
| 273 | - | * so probe by actually calling GetWakeupTime() to avoid exposing | |
| 274 | - | * a broken alarm to userspace. | |
| 275 | - | */ | |
| 276 | - | if (efi_rt_services_supported(EFI_RT_SUPPORTED_WAKEUP_SERVICES) && | |
| 277 | - | efi.get_wakeup_time(&enabled, &pending, &eft) == EFI_SUCCESS) { | |
| 278 | - | set_bit(RTC_FEATURE_ALARM, rtc->features); | |
| 279 | - | set_bit(RTC_FEATURE_ALARM_WAKEUP_ONLY, rtc->features); | |
| 280 | - | } else { | |
| 281 | - | clear_bit(RTC_FEATURE_ALARM, rtc->features); | |
| 282 | - | } | |
| 206 | + | clear_bit(RTC_FEATURE_ALARM, rtc->features); | |
| 283 | 207 | ||
| 284 | 208 | device_init_wakeup(&dev->dev, true); | |
| 285 | 209 | ||
modified drivers/rtc/rtc-mpfs.c
| @@ -256,12 +256,8 @@ static int mpfs_rtc_probe(struct platform_device *pdev) | |||
| 256 | 256 | return ret; | |
| 257 | 257 | } | |
| 258 | 258 | ||
| 259 | - | clk = devm_clk_get(&pdev->dev, "rtcref"); | |
| 260 | - | if (IS_ERR(clk)) | |
| 261 | - | return PTR_ERR(clk); | |
| 262 | - | ||
| 263 | 259 | /* prescaler hardware adds 1 to reg value */ | |
| 264 | - | prescaler = clk_get_rate(clk) - 1; | |
| 260 | + | prescaler = clk_get_rate(devm_clk_get(&pdev->dev, "rtcref")) - 1; | |
| 265 | 261 | if (prescaler > MAX_PRESCALER_COUNT) { | |
| 266 | 262 | dev_dbg(&pdev->dev, "invalid prescaler %lu\n", prescaler); | |
| 267 | 263 | return -EINVAL; | |
modified drivers/rtc/rtc-spear.c
| @@ -363,12 +363,6 @@ static int spear_rtc_probe(struct platform_device *pdev) | |||
| 363 | 363 | if (irq < 0) | |
| 364 | 364 | return irq; | |
| 365 | 365 | ||
| 366 | - | config->ioaddr = devm_platform_ioremap_resource(pdev, 0); | |
| 367 | - | if (IS_ERR(config->ioaddr)) | |
| 368 | - | return PTR_ERR(config->ioaddr); | |
| 369 | - | ||
| 370 | - | spin_lock_init(&config->lock); | |
| 371 | - | ||
| 372 | 366 | status = devm_request_irq(&pdev->dev, irq, spear_rtc_irq, 0, pdev->name, | |
| 373 | 367 | config); | |
| 374 | 368 | if (status) { | |
| @@ -377,6 +371,10 @@ static int spear_rtc_probe(struct platform_device *pdev) | |||
| 377 | 371 | return status; | |
| 378 | 372 | } | |
| 379 | 373 | ||
| 374 | + | config->ioaddr = devm_platform_ioremap_resource(pdev, 0); | |
| 375 | + | if (IS_ERR(config->ioaddr)) | |
| 376 | + | return PTR_ERR(config->ioaddr); | |
| 377 | + | ||
| 380 | 378 | config->clk = devm_clk_get(&pdev->dev, NULL); | |
| 381 | 379 | if (IS_ERR(config->clk)) | |
| 382 | 380 | return PTR_ERR(config->clk); | |
| @@ -385,6 +383,7 @@ static int spear_rtc_probe(struct platform_device *pdev) | |||
| 385 | 383 | if (status < 0) | |
| 386 | 384 | return status; | |
| 387 | 385 | ||
| 386 | + | spin_lock_init(&config->lock); | |
| 388 | 387 | platform_set_drvdata(pdev, config); | |
| 389 | 388 | ||
| 390 | 389 | config->rtc->ops = &spear_rtc_ops; | |
modified drivers/scsi/ch.c
| @@ -112,6 +112,7 @@ typedef struct { | |||
| 112 | 112 | int minor; | |
| 113 | 113 | char name[8]; | |
| 114 | 114 | struct scsi_device *device; | |
| 115 | + | struct scsi_device **dt; /* ptrs to data transfer elements */ | |
| 115 | 116 | u_int firsts[CH_TYPES]; | |
| 116 | 117 | u_int counts[CH_TYPES]; | |
| 117 | 118 | u_int voltags; | |
| @@ -362,10 +363,15 @@ ch_readconfig(scsi_changer *ch) | |||
| 362 | 363 | vendor_labels[i]); | |
| 363 | 364 | } | |
| 364 | 365 | ||
| 365 | - | /* report the devices of the data transfer elements */ | |
| 366 | - | for (elem = 0; elem < ch->counts[CHET_DT]; elem++) { | |
| 367 | - | struct scsi_device *sdev; | |
| 366 | + | /* look up the devices of the data transfer elements */ | |
| 367 | + | ch->dt = kzalloc_objs(*ch->dt, ch->counts[CHET_DT]); | |
| 368 | + | ||
| 369 | + | if (!ch->dt) { | |
| 370 | + | kfree(buffer); | |
| 371 | + | return -ENOMEM; | |
| 372 | + | } | |
| 368 | 373 | ||
| 374 | + | for (elem = 0; elem < ch->counts[CHET_DT]; elem++) { | |
| 369 | 375 | id = -1; | |
| 370 | 376 | lun = 0; | |
| 371 | 377 | if (elem < CH_DT_MAX && -1 != dt_id[elem]) { | |
| @@ -381,8 +387,10 @@ ch_readconfig(scsi_changer *ch) | |||
| 381 | 387 | VPRINTK(KERN_INFO, "dt 0x%x: ",elem+ch->firsts[CHET_DT]); | |
| 382 | 388 | if (data[6] & 0x80) { | |
| 383 | 389 | VPRINTK(KERN_CONT, "not this SCSI bus\n"); | |
| 390 | + | ch->dt[elem] = NULL; | |
| 384 | 391 | } else if (0 == (data[6] & 0x30)) { | |
| 385 | 392 | VPRINTK(KERN_CONT, "ID/LUN unknown\n"); | |
| 393 | + | ch->dt[elem] = NULL; | |
| 386 | 394 | } else { | |
| 387 | 395 | id = ch->device->id; | |
| 388 | 396 | lun = 0; | |
| @@ -392,16 +400,18 @@ ch_readconfig(scsi_changer *ch) | |||
| 392 | 400 | } | |
| 393 | 401 | if (-1 != id) { | |
| 394 | 402 | VPRINTK(KERN_CONT, "ID %i, LUN %i, ",id,lun); | |
| 395 | - | sdev = scsi_device_lookup(ch->device->host, | |
| 396 | - | ch->device->channel, | |
| 397 | - | id, lun); | |
| 398 | - | if (!sdev) { | |
| 403 | + | ch->dt[elem] = | |
| 404 | + | scsi_device_lookup(ch->device->host, | |
| 405 | + | ch->device->channel, | |
| 406 | + | id,lun); | |
| 407 | + | if (!ch->dt[elem]) { | |
| 399 | 408 | /* should not happen */ | |
| 400 | 409 | VPRINTK(KERN_CONT, "Huh? device not found!\n"); | |
| 401 | 410 | } else { | |
| 402 | 411 | VPRINTK(KERN_CONT, "name: %8.8s %16.16s %4.4s\n", | |
| 403 | - | sdev->vendor, sdev->model, sdev->rev); | |
| 404 | - | scsi_device_put(sdev); | |
| 412 | + | ch->dt[elem]->vendor, | |
| 413 | + | ch->dt[elem]->model, | |
| 414 | + | ch->dt[elem]->rev); | |
| 405 | 415 | } | |
| 406 | 416 | } | |
| 407 | 417 | } | |
| @@ -565,6 +575,7 @@ static void ch_destroy(struct kref *ref) | |||
| 565 | 575 | scsi_changer *ch = container_of(ref, scsi_changer, ref); | |
| 566 | 576 | ||
| 567 | 577 | ch->device = NULL; | |
| 578 | + | kfree(ch->dt); | |
| 568 | 579 | kfree(ch); | |
| 569 | 580 | } | |
| 570 | 581 | ||
modified drivers/scsi/qedi/qedi_main.c
| @@ -2652,6 +2652,8 @@ retry_probe: | |||
| 2652 | 2652 | snprintf(host_buf, sizeof(host_buf), "host_%d", qedi->shost->host_no); | |
| 2653 | 2653 | qedi_ops->common->set_name(qedi->cdev, host_buf); | |
| 2654 | 2654 | ||
| 2655 | + | qedi_ops->register_ops(qedi->cdev, &qedi_cb_ops, qedi); | |
| 2656 | + | ||
| 2655 | 2657 | memset(¶ms, 0, sizeof(params)); | |
| 2656 | 2658 | params.mtu = DEF_PATH_MTU + IPV6_HDR_LEN + TCP_HDR_LEN; | |
| 2657 | 2659 | qedi->ll2_mtu = DEF_PATH_MTU; | |
| @@ -2668,7 +2670,6 @@ retry_probe: | |||
| 2668 | 2670 | spin_lock_init(&qedi->task_idx_lock); | |
| 2669 | 2671 | mutex_init(&qedi->stats_lock); | |
| 2670 | 2672 | } | |
| 2671 | - | qedi_ops->register_ops(qedi->cdev, &qedi_cb_ops, qedi); | |
| 2672 | 2673 | qedi_ops->ll2->register_cb_ops(qedi->cdev, &qedi_ll2_cb_ops, qedi); | |
| 2673 | 2674 | qedi_ops->ll2->start(qedi->cdev, ¶ms); | |
| 2674 | 2675 | ||
modified drivers/spi/spi-cadence-quadspi.c
| @@ -1056,7 +1056,8 @@ static int cqspi_write_setup(struct cqspi_flash_pdata *f_pdata, | |||
| 1056 | 1056 | * care of polling the status register. | |
| 1057 | 1057 | */ | |
| 1058 | 1058 | if (cqspi->wr_completion) { | |
| 1059 | - | reg = CQSPI_REG_WR_DISABLE_AUTO_POLL; | |
| 1059 | + | reg = readl(reg_base + CQSPI_REG_WR_COMPLETION_CTRL); | |
| 1060 | + | reg |= CQSPI_REG_WR_DISABLE_AUTO_POLL; | |
| 1060 | 1061 | writel(reg, reg_base + CQSPI_REG_WR_COMPLETION_CTRL); | |
| 1061 | 1062 | /* | |
| 1062 | 1063 | * DAC mode require auto polling as flash needs to be polled | |
modified drivers/spi/spi-cs42l43.c
| @@ -11,7 +11,6 @@ | |||
| 11 | 11 | #include <linux/bitfield.h> | |
| 12 | 12 | #include <linux/cleanup.h> | |
| 13 | 13 | #include <linux/device.h> | |
| 14 | - | #include <linux/dmi.h> | |
| 15 | 14 | #include <linux/errno.h> | |
| 16 | 15 | #include <linux/gpio/consumer.h> | |
| 17 | 16 | #include <linux/gpio/machine.h> | |
| @@ -216,108 +215,12 @@ static size_t cs42l43_spi_max_length(struct spi_device *spi) | |||
| 216 | 215 | return CS42L43_SPI_MAX_LENGTH; | |
| 217 | 216 | } | |
| 218 | 217 | ||
| 219 | - | /* | |
| 220 | - | * Workaround needed for two speaker ID pins in one ACPI GpioIo() but | |
| 221 | - | * the Linux-specific _DSD property only contains one pin. | |
| 222 | - | * Create a temporary acpi_gpio_mapping pointing at both pins. | |
| 223 | - | */ | |
| 224 | - | static const struct acpi_gpio_params cs42l43_2bit_speaker_id_from_one_gpioio_params[] = { | |
| 225 | - | [0] = { | |
| 226 | - | .crs_entry_index = 0, | |
| 227 | - | .line_index = 0, | |
| 228 | - | }, | |
| 229 | - | [1] = { | |
| 230 | - | .crs_entry_index = 0, | |
| 231 | - | .line_index = 1, | |
| 232 | - | }, | |
| 233 | - | }; | |
| 234 | - | ||
| 235 | - | static const struct acpi_gpio_mapping cs42l43_2bit_speaker_id_from_one_gpioio_mapping[] = { | |
| 236 | - | { | |
| 237 | - | .name = "spk-id-quirk-gpios", | |
| 238 | - | .data = cs42l43_2bit_speaker_id_from_one_gpioio_params, | |
| 239 | - | .size = ARRAY_SIZE(cs42l43_2bit_speaker_id_from_one_gpioio_params), | |
| 240 | - | }, | |
| 241 | - | { } | |
| 242 | - | }; | |
| 243 | - | ||
| 244 | - | static int cs42l43_get_2bit_speaker_id_from_one_gpioio(struct cs42l43_spi *priv, int *result) | |
| 245 | - | { | |
| 246 | - | struct fwnode_reference_args args; | |
| 247 | - | struct acpi_device *adev; | |
| 248 | - | struct gpio_desc *desc; | |
| 249 | - | u32 spkid = 0; | |
| 250 | - | int i, ret; | |
| 251 | - | ||
| 252 | - | /* Use the _DSD property to get the node containing the GpioIo() */ | |
| 253 | - | ret = fwnode_property_get_reference_args(dev_fwnode(priv->dev), "spk-id-gpios", | |
| 254 | - | NULL, 3, 0, &args); | |
| 255 | - | if (ret) | |
| 256 | - | return ret; | |
| 257 | - | ||
| 258 | - | struct fwnode_handle *fwnode __free(fwnode_handle) = args.fwnode; | |
| 259 | - | ||
| 260 | - | /* An acpi_gpio_mapping must be added to the node that contains the GpioIo() */ | |
| 261 | - | adev = to_acpi_device_node(fwnode); | |
| 262 | - | if (!adev) | |
| 263 | - | return -EINVAL; | |
| 264 | - | ||
| 265 | - | ret = acpi_dev_add_driver_gpios(adev, cs42l43_2bit_speaker_id_from_one_gpioio_mapping); | |
| 266 | - | if (ret) | |
| 267 | - | return ret; | |
| 268 | - | ||
| 269 | - | /* gpiod_get_array() can't read from a mapping in a child node */ | |
| 270 | - | for (i = 0; i < ARRAY_SIZE(cs42l43_2bit_speaker_id_from_one_gpioio_params); i++) { | |
| 271 | - | desc = fwnode_gpiod_get_index(fwnode, "spk-id-quirk", i, GPIOD_IN, | |
| 272 | - | dev_name(priv->dev)); | |
| 273 | - | if (IS_ERR(desc)) { | |
| 274 | - | ret = PTR_ERR(desc); | |
| 275 | - | goto out; | |
| 276 | - | } | |
| 277 | - | ||
| 278 | - | ret = gpiod_get_value_cansleep(desc); | |
| 279 | - | gpiod_put(desc); | |
| 280 | - | if (ret < 0) | |
| 281 | - | goto out; | |
| 282 | - | ||
| 283 | - | spkid |= (u32)ret << i; | |
| 284 | - | } | |
| 285 | - | ||
| 286 | - | dev_dbg(priv->dev, "spk-id-gpios = %u\n", spkid); | |
| 287 | - | *result = spkid; | |
| 288 | - | ret = 0; | |
| 289 | - | out: | |
| 290 | - | acpi_dev_remove_driver_gpios(adev); | |
| 291 | - | ||
| 292 | - | return ret; | |
| 293 | - | } | |
| 294 | - | ||
| 295 | - | static const struct dmi_system_id cs42l43_spk_id_quirks[] = { | |
| 296 | - | { | |
| 297 | - | .ident = "Dell XPS 13 DX13260", | |
| 298 | - | .matches = { | |
| 299 | - | DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc"), | |
| 300 | - | DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "0E53"), | |
| 301 | - | }, | |
| 302 | - | .driver_data = cs42l43_get_2bit_speaker_id_from_one_gpioio, | |
| 303 | - | }, | |
| 304 | - | { } | |
| 305 | - | }; | |
| 306 | - | ||
| 307 | 218 | static int cs42l43_get_speaker_id_gpios(struct cs42l43_spi *priv, int *result) | |
| 308 | 219 | { | |
| 309 | - | const struct dmi_system_id *dmi_id; | |
| 310 | 220 | struct gpio_descs *descs; | |
| 311 | 221 | u32 spkid; | |
| 312 | 222 | int i, ret; | |
| 313 | 223 | ||
| 314 | - | dmi_id = dmi_first_match(cs42l43_spk_id_quirks); | |
| 315 | - | if (dmi_id) { | |
| 316 | - | int (*get_speaker_id)(struct cs42l43_spi *priv, int *result) = dmi_id->driver_data; | |
| 317 | - | ||
| 318 | - | return get_speaker_id(priv, result); | |
| 319 | - | } | |
| 320 | - | ||
| 321 | 224 | descs = gpiod_get_array_optional(priv->dev, "spk-id", GPIOD_IN); | |
| 322 | 225 | if (!descs) | |
| 323 | 226 | return 0; | |
modified drivers/spi/spi-nxp-fspi.c
| @@ -898,10 +898,10 @@ static int nxp_fspi_select_mem(struct nxp_fspi *f, struct spi_device *spi, | |||
| 898 | 898 | dev_dbg(f->dev, "Target device [CS:%x] selected\n", spi_get_chipselect(spi, 0)); | |
| 899 | 899 | ||
| 900 | 900 | /* | |
| 901 | - | * Per the FlexSPI reference manual (initialization sequence), MCR0 | |
| 902 | - | * should be configured while the module is in stop mode (MCR0[MDIS] = 1). | |
| 903 | - | * Enter stop mode before reconfiguring the RX sample clock source, then | |
| 904 | - | * exit stop mode afterwards. | |
| 901 | + | * Per the FlexSPI reference manual (initialization sequence), MCR0 and | |
| 902 | + | * the DLL control registers should be configured while the module is in | |
| 903 | + | * stop mode (MCR0[MDIS] = 1). Enter stop mode before reconfiguring the | |
| 904 | + | * RX sample clock source and the DLL, then exit stop mode afterwards. | |
| 905 | 905 | */ | |
| 906 | 906 | reg = fspi_readl(f, f->iobase + FSPI_MCR0); | |
| 907 | 907 | fspi_writel(f, reg | FSPI_MCR0_MDIS, f->iobase + FSPI_MCR0); | |
| @@ -936,16 +936,6 @@ static int nxp_fspi_select_mem(struct nxp_fspi *f, struct spi_device *spi, | |||
| 936 | 936 | if (ret) | |
| 937 | 937 | return ret; | |
| 938 | 938 | ||
| 939 | - | /* | |
| 940 | - | * Exit stop mode before running the DLL calibration. The DLL | |
| 941 | - | * reference clock is derived from the module clock domain, which is | |
| 942 | - | * gated while MCR0[MDIS] = 1. Calibrating the DLL in stop mode leaves | |
| 943 | - | * the STS2 lock bits stuck at 0 (the DLL never runs), so clear MDIS | |
| 944 | - | * first and let the module and reference clock run. | |
| 945 | - | */ | |
| 946 | - | reg = fspi_readl(f, f->iobase + FSPI_MCR0); | |
| 947 | - | fspi_writel(f, reg & ~FSPI_MCR0_MDIS, f->iobase + FSPI_MCR0); | |
| 948 | - | ||
| 949 | 939 | /* | |
| 950 | 940 | * If clock rate > 100MHz, then switch from DLL override mode to | |
| 951 | 941 | * DLL calibration mode. | |
| @@ -955,6 +945,10 @@ static int nxp_fspi_select_mem(struct nxp_fspi *f, struct spi_device *spi, | |||
| 955 | 945 | else | |
| 956 | 946 | nxp_fspi_dll_override(f); | |
| 957 | 947 | ||
| 948 | + | /* Exit stop mode now that MCR0 and the DLL have been reconfigured. */ | |
| 949 | + | reg = fspi_readl(f, f->iobase + FSPI_MCR0); | |
| 950 | + | fspi_writel(f, reg & ~FSPI_MCR0_MDIS, f->iobase + FSPI_MCR0); | |
| 951 | + | ||
| 958 | 952 | f->pre_op_rate = op->max_freq; | |
| 959 | 953 | ||
| 960 | 954 | f->selected = spi_get_chipselect(spi, 0); | |
modified drivers/spi/spi-sg2044-nor.c
| @@ -307,15 +307,15 @@ static ssize_t sg2044_spifmc_tran_cmd(struct sg2044_spifmc *spifmc, | |||
| 307 | 307 | return 0; | |
| 308 | 308 | } | |
| 309 | 309 | ||
| 310 | - | static int sg2044_spifmc_trans(struct sg2044_spifmc *spifmc, | |
| 311 | - | const struct spi_mem_op *op) | |
| 310 | + | static void sg2044_spifmc_trans(struct sg2044_spifmc *spifmc, | |
| 311 | + | const struct spi_mem_op *op) | |
| 312 | 312 | { | |
| 313 | 313 | if (op->data.dir == SPI_MEM_DATA_IN) | |
| 314 | - | return sg2044_spifmc_read(spifmc, op); | |
| 314 | + | sg2044_spifmc_read(spifmc, op); | |
| 315 | 315 | else if (op->data.dir == SPI_MEM_DATA_OUT) | |
| 316 | - | return sg2044_spifmc_write(spifmc, op); | |
| 316 | + | sg2044_spifmc_write(spifmc, op); | |
| 317 | 317 | else | |
| 318 | - | return sg2044_spifmc_tran_cmd(spifmc, op); | |
| 318 | + | sg2044_spifmc_tran_cmd(spifmc, op); | |
| 319 | 319 | } | |
| 320 | 320 | ||
| 321 | 321 | static ssize_t sg2044_spifmc_trans_reg(struct sg2044_spifmc *spifmc, | |
| @@ -385,64 +385,29 @@ static ssize_t sg2044_spifmc_trans_reg(struct sg2044_spifmc *spifmc, | |||
| 385 | 385 | return 0; | |
| 386 | 386 | } | |
| 387 | 387 | ||
| 388 | - | static int sg2044_spifmc_set_speed(struct sg2044_spifmc *spifmc, | |
| 389 | - | unsigned int speed_hz) | |
| 390 | - | { | |
| 391 | - | unsigned long rate = clk_get_rate(spifmc->clk); | |
| 392 | - | u64 div; | |
| 393 | - | u32 reg; | |
| 394 | - | ||
| 395 | - | if (!rate) | |
| 396 | - | return -EINVAL; | |
| 397 | - | ||
| 398 | - | /* SCK = HCLK / (2 * (SckDiv + 1)); round down the resulting SCK. */ | |
| 399 | - | div = speed_hz ? DIV_ROUND_UP_ULL(rate, 2ULL * speed_hz) : 1; | |
| 400 | - | if (div > SPIFMC_CTRL_SCK_DIV_MASK + 1) | |
| 401 | - | return -EINVAL; | |
| 402 | - | ||
| 403 | - | reg = readl(spifmc->io_base + SPIFMC_CTRL); | |
| 404 | - | reg &= ~SPIFMC_CTRL_SCK_DIV_MASK; | |
| 405 | - | reg |= div - 1; | |
| 406 | - | writel(reg, spifmc->io_base + SPIFMC_CTRL); | |
| 407 | - | ||
| 408 | - | return 0; | |
| 409 | - | } | |
| 410 | - | ||
| 411 | 388 | static int sg2044_spifmc_exec_op(struct spi_mem *mem, | |
| 412 | 389 | const struct spi_mem_op *op) | |
| 413 | 390 | { | |
| 414 | 391 | struct sg2044_spifmc *spifmc; | |
| 415 | - | int ret; | |
| 416 | 392 | ||
| 417 | 393 | spifmc = spi_controller_get_devdata(mem->spi->controller); | |
| 418 | 394 | ||
| 419 | 395 | mutex_lock(&spifmc->lock); | |
| 420 | 396 | ||
| 421 | - | ret = sg2044_spifmc_set_speed(spifmc, op->max_freq ? | |
| 422 | - | min(op->max_freq, mem->spi->max_speed_hz) : | |
| 423 | - | mem->spi->max_speed_hz); | |
| 424 | - | if (ret) | |
| 425 | - | goto out_unlock; | |
| 426 | - | ||
| 427 | 397 | if (op->addr.nbytes == 0) | |
| 428 | - | ret = sg2044_spifmc_trans_reg(spifmc, op); | |
| 398 | + | sg2044_spifmc_trans_reg(spifmc, op); | |
| 429 | 399 | else | |
| 430 | - | ret = sg2044_spifmc_trans(spifmc, op); | |
| 400 | + | sg2044_spifmc_trans(spifmc, op); | |
| 431 | 401 | ||
| 432 | - | out_unlock: | |
| 433 | 402 | mutex_unlock(&spifmc->lock); | |
| 434 | 403 | ||
| 435 | - | return ret; | |
| 404 | + | return 0; | |
| 436 | 405 | } | |
| 437 | 406 | ||
| 438 | 407 | static const struct spi_controller_mem_ops sg2044_spifmc_mem_ops = { | |
| 439 | 408 | .exec_op = sg2044_spifmc_exec_op, | |
| 440 | 409 | }; | |
| 441 | 410 | ||
| 442 | - | static const struct spi_controller_mem_caps sg2044_spifmc_mem_caps = { | |
| 443 | - | .per_op_freq = true, | |
| 444 | - | }; | |
| 445 | - | ||
| 446 | 411 | static void sg2044_spifmc_init(struct sg2044_spifmc *spifmc) | |
| 447 | 412 | { | |
| 448 | 413 | u32 tran_csr; | |
| @@ -482,10 +447,6 @@ static int sg2044_spifmc_probe(struct platform_device *pdev) | |||
| 482 | 447 | if (IS_ERR(spifmc->clk)) | |
| 483 | 448 | return dev_err_probe(dev, PTR_ERR(spifmc->clk), "Cannot get and enable AHB clock\n"); | |
| 484 | 449 | ||
| 485 | - | ctrl->max_speed_hz = clk_get_rate(spifmc->clk) / 2; | |
| 486 | - | if (!ctrl->max_speed_hz) | |
| 487 | - | return dev_err_probe(dev, -EINVAL, "Invalid AHB clock rate\n"); | |
| 488 | - | ||
| 489 | 450 | spifmc->dev = &pdev->dev; | |
| 490 | 451 | spifmc->ctrl = ctrl; | |
| 491 | 452 | ||
| @@ -497,7 +458,6 @@ static int sg2044_spifmc_probe(struct platform_device *pdev) | |||
| 497 | 458 | ctrl->bits_per_word_mask = SPI_BPW_MASK(8); | |
| 498 | 459 | ctrl->auto_runtime_pm = false; | |
| 499 | 460 | ctrl->mem_ops = &sg2044_spifmc_mem_ops; | |
| 500 | - | ctrl->mem_caps = &sg2044_spifmc_mem_caps; | |
| 501 | 461 | ctrl->mode_bits = SPI_RX_DUAL | SPI_TX_DUAL | SPI_RX_QUAD | SPI_TX_QUAD; | |
| 502 | 462 | ||
| 503 | 463 | ret = devm_mutex_init(dev, &spifmc->lock); | |
modified drivers/staging/greybus/uart.c
| @@ -948,8 +948,7 @@ static int gb_tty_init(void) | |||
| 948 | 948 | int retval = 0; | |
| 949 | 949 | ||
| 950 | 950 | gb_tty_driver = tty_alloc_driver(GB_NUM_MINORS, TTY_DRIVER_REAL_RAW | | |
| 951 | - | TTY_DRIVER_DYNAMIC_DEV | | |
| 952 | - | TTY_DRIVER_RESET_SAVED_TERMIOS); | |
| 951 | + | TTY_DRIVER_DYNAMIC_DEV); | |
| 953 | 952 | if (IS_ERR(gb_tty_driver)) { | |
| 954 | 953 | pr_err("Can not allocate tty driver\n"); | |
| 955 | 954 | retval = PTR_ERR(gb_tty_driver); | |
modified drivers/tee/optee/ffa_abi.c
| @@ -198,8 +198,7 @@ static int to_msg_param_ffa_mem(struct optee_msg_param *mp, | |||
| 198 | 198 | if (shm) { | |
| 199 | 199 | u64 shm_offs = p->u.memref.shm_offs; | |
| 200 | 200 | ||
| 201 | - | mp->u.fmem.internal_offs = tee_shm_get_page_offset(shm) & | |
| 202 | - | (FFA_PAGE_SIZE - 1); | |
| 201 | + | mp->u.fmem.internal_offs = shm->offset; | |
| 203 | 202 | ||
| 204 | 203 | mp->u.fmem.offs_low = shm_offs; | |
| 205 | 204 | mp->u.fmem.offs_high = shm_offs >> 32; | |
| @@ -285,26 +284,14 @@ static int optee_ffa_shm_register(struct tee_context *ctx, struct tee_shm *shm, | |||
| 285 | 284 | .nattrs = 1, | |
| 286 | 285 | }; | |
| 287 | 286 | struct sg_table sgt; | |
| 288 | - | size_t ffa_offs; | |
| 289 | 287 | int rc; | |
| 290 | 288 | ||
| 291 | - | if (!num_pages) | |
| 292 | - | return -EINVAL; | |
| 293 | - | ||
| 294 | 289 | rc = optee_check_mem_type(start, num_pages); | |
| 295 | 290 | if (rc) | |
| 296 | 291 | return rc; | |
| 297 | 292 | ||
| 298 | - | /* | |
| 299 | - | * Start the FF-A descriptor at the 4 KiB page containing the shared | |
| 300 | - | * buffer, skipping unused leading 4 KiB pages when PAGE_SIZE is | |
| 301 | - | * larger. Same approach as optee_fill_pages_list() in the SMC ABI. | |
| 302 | - | * This leaves only the offset into that 4 KiB page for internal_offs. | |
| 303 | - | */ | |
| 304 | - | ffa_offs = round_down(tee_shm_get_page_offset(shm), FFA_PAGE_SIZE); | |
| 305 | - | rc = sg_alloc_table_from_pages(&sgt, pages, num_pages, ffa_offs, | |
| 306 | - | num_pages * PAGE_SIZE - ffa_offs, | |
| 307 | - | GFP_KERNEL); | |
| 293 | + | rc = sg_alloc_table_from_pages(&sgt, pages, num_pages, 0, | |
| 294 | + | num_pages * PAGE_SIZE, GFP_KERNEL); | |
| 308 | 295 | if (rc) | |
| 309 | 296 | return rc; | |
| 310 | 297 | args.sg = sgt.sgl; | |
| @@ -471,8 +458,7 @@ static void handle_ffa_rpc_func_cmd_shm_alloc(struct tee_context *ctx, | |||
| 471 | 458 | .attr = OPTEE_MSG_ATTR_TYPE_FMEM_OUTPUT, | |
| 472 | 459 | .u.fmem.size = tee_shm_get_size(shm), | |
| 473 | 460 | .u.fmem.global_id = shm->sec_world_id, | |
| 474 | - | .u.fmem.internal_offs = tee_shm_get_page_offset(shm) & | |
| 475 | - | (FFA_PAGE_SIZE - 1), | |
| 461 | + | .u.fmem.internal_offs = shm->offset, | |
| 476 | 462 | }; | |
| 477 | 463 | ||
| 478 | 464 | arg->ret = TEEC_SUCCESS; | |
| @@ -1137,6 +1123,14 @@ static int optee_ffa_probe(struct ffa_device *ffa_dev) | |||
| 1137 | 1123 | ||
| 1138 | 1124 | optee_set_dev_group(optee); | |
| 1139 | 1125 | ||
| 1126 | + | rc = tee_device_register(optee->teedev); | |
| 1127 | + | if (rc) | |
| 1128 | + | goto err_unreg_supp_teedev; | |
| 1129 | + | ||
| 1130 | + | rc = tee_device_register(optee->supp_teedev); | |
| 1131 | + | if (rc) | |
| 1132 | + | goto err_unreg_supp_teedev; | |
| 1133 | + | ||
| 1140 | 1134 | rc = rhashtable_init(&optee->ffa.global_ids, &shm_rhash_params); | |
| 1141 | 1135 | if (rc) | |
| 1142 | 1136 | goto err_unreg_supp_teedev; | |
| @@ -1165,14 +1159,6 @@ static int optee_ffa_probe(struct ffa_device *ffa_dev) | |||
| 1165 | 1159 | if (optee_ffa_protmem_pool_init(optee, sec_caps)) | |
| 1166 | 1160 | pr_info("Protected memory service not available\n"); | |
| 1167 | 1161 | ||
| 1168 | - | rc = tee_device_register(optee->teedev); | |
| 1169 | - | if (rc) | |
| 1170 | - | goto err_unregister_devices; | |
| 1171 | - | ||
| 1172 | - | rc = tee_device_register(optee->supp_teedev); | |
| 1173 | - | if (rc) | |
| 1174 | - | goto err_unregister_devices; | |
| 1175 | - | ||
| 1176 | 1162 | rc = optee_enumerate_devices(PTA_CMD_GET_DEVICES); | |
| 1177 | 1163 | if (rc) | |
| 1178 | 1164 | goto err_unregister_devices; | |
modified drivers/tee/optee/optee_msg.h
| @@ -136,8 +136,8 @@ struct optee_msg_param_rmem { | |||
| 136 | 136 | * struct optee_msg_param_fmem - FF-A memory reference parameter | |
| 137 | 137 | * @offs_low: lower bits of offset into shared memory reference | |
| 138 | 138 | * @offs_high: higher bits of offset into shared memory reference | |
| 139 | - | * @internal_offs: offset into the first 4 KiB page of the FF-A shared | |
| 140 | - | * memory region | |
| 139 | + | * @internal_offs: internal offset into the first page of shared memory | |
| 140 | + | * reference | |
| 141 | 141 | * @size: size of the buffer | |
| 142 | 142 | * @global_id: global identifier of the shared memory | |
| 143 | 143 | */ | |
modified drivers/tee/optee/smc_abi.c
| @@ -1849,6 +1849,14 @@ static int optee_probe(struct platform_device *pdev) | |||
| 1849 | 1849 | ||
| 1850 | 1850 | optee_set_dev_group(optee); | |
| 1851 | 1851 | ||
| 1852 | + | rc = tee_device_register(optee->teedev); | |
| 1853 | + | if (rc) | |
| 1854 | + | goto err_unreg_supp_teedev; | |
| 1855 | + | ||
| 1856 | + | rc = tee_device_register(optee->supp_teedev); | |
| 1857 | + | if (rc) | |
| 1858 | + | goto err_unreg_supp_teedev; | |
| 1859 | + | ||
| 1852 | 1860 | optee_cq_init(&optee->call_queue, thread_count); | |
| 1853 | 1861 | optee_supp_init(&optee->supp); | |
| 1854 | 1862 | optee->smc.memremaped_shm = memremaped_shm; | |
| @@ -1908,14 +1916,6 @@ static int optee_probe(struct platform_device *pdev) | |||
| 1908 | 1916 | if (optee->smc.sec_caps & OPTEE_SMC_SEC_CAP_DYNAMIC_SHM) | |
| 1909 | 1917 | pr_info("dynamic shared memory is enabled\n"); | |
| 1910 | 1918 | ||
| 1911 | - | rc = tee_device_register(optee->teedev); | |
| 1912 | - | if (rc) | |
| 1913 | - | goto err_disable_shm_cache; | |
| 1914 | - | ||
| 1915 | - | rc = tee_device_register(optee->supp_teedev); | |
| 1916 | - | if (rc) | |
| 1917 | - | goto err_disable_shm_cache; | |
| 1918 | - | ||
| 1919 | 1919 | rc = optee_enumerate_devices(PTA_CMD_GET_DEVICES); | |
| 1920 | 1920 | if (rc) | |
| 1921 | 1921 | goto err_disable_shm_cache; | |
| @@ -1942,6 +1942,7 @@ err_supp_uninit: | |||
| 1942 | 1942 | optee_shm_arg_cache_uninit(optee); | |
| 1943 | 1943 | optee_supp_uninit(&optee->supp); | |
| 1944 | 1944 | mutex_destroy(&optee->call_queue.mutex); | |
| 1945 | + | err_unreg_supp_teedev: | |
| 1945 | 1946 | tee_device_unregister(optee->supp_teedev); | |
| 1946 | 1947 | err_unreg_teedev: | |
| 1947 | 1948 | tee_device_unregister(optee->teedev); | |
modified drivers/tee/qcomtee/async.c
| @@ -97,10 +97,10 @@ static void qcomtee_get_async_buffer(struct qcomtee_object_invoke_ctx *oic, | |||
| 97 | 97 | /** | |
| 98 | 98 | * async_release() - Process QTEE async release requests. | |
| 99 | 99 | * @oic: context used for the current invocation. | |
| 100 | - | * @async_msg: async message for object release. | |
| 100 | + | * @msg: async message for object release. | |
| 101 | 101 | * @size: size of the async buffer available. | |
| 102 | 102 | * | |
| 103 | - | * Return: Size of the outbound buffer used when processing @async_msg. | |
| 103 | + | * Return: Size of the outbound buffer used when processing @msg. | |
| 104 | 104 | */ | |
| 105 | 105 | static size_t async_release(struct qcomtee_object_invoke_ctx *oic, | |
| 106 | 106 | struct qcomtee_async_msg_hdr *async_msg, | |
modified drivers/tee/qcomtee/qcomtee_msg.h
| @@ -112,7 +112,7 @@ union qcomtee_msg_arg { | |||
| 112 | 112 | ||
| 113 | 113 | /** | |
| 114 | 114 | * struct qcomtee_msg_object_invoke - Direct object invocation message. | |
| 115 | - | * @cxt: object ID hosted in QTEE. | |
| 115 | + | * @ctx: object ID hosted in QTEE. | |
| 116 | 116 | * @op: operation for the object. | |
| 117 | 117 | * @counts: number of different types of arguments in @args. | |
| 118 | 118 | * @args: array of arguments. | |
modified drivers/tee/qcomtee/qcomtee_object.h
| @@ -74,7 +74,6 @@ enum qcomtee_object_type { | |||
| 74 | 74 | * @QCOMTEE_ARG_TYPE_OO: output object (OO). | |
| 75 | 75 | * @QCOMTEE_ARG_TYPE_IB: input buffer (IB). | |
| 76 | 76 | * @QCOMTEE_ARG_TYPE_IO: input object (IO). | |
| 77 | - | * @QCOMTEE_ARG_TYPE_NR: number of argument types. | |
| 78 | 77 | * | |
| 79 | 78 | * Use the invalid type to specify the end of the argument array. | |
| 80 | 79 | */ | |
modified drivers/tee/tee_shm.c
| @@ -343,10 +343,6 @@ int tee_dyn_shm_alloc_helper(struct tee_shm *shm, size_t size, size_t align, | |||
| 343 | 343 | unsigned int i; | |
| 344 | 344 | int rc = 0; | |
| 345 | 345 | ||
| 346 | - | /* get_order(0) is undefined and exceeds MAX_PAGE_ORDER. */ | |
| 347 | - | if (!nr_pages) | |
| 348 | - | return -EINVAL; | |
| 349 | - | ||
| 350 | 346 | /* | |
| 351 | 347 | * Ignore alignment since this is already going to be page aligned | |
| 352 | 348 | * and there's no need for any larger alignment. | |
modified drivers/thunderbolt/ctl.c
| @@ -73,6 +73,7 @@ struct tb_ctl { | |||
| 73 | 73 | #define tb_ctl_dbg_once(ctl, format, arg...) \ | |
| 74 | 74 | dev_dbg_once((ctl)->nhi->dev, format, ## arg) | |
| 75 | 75 | ||
| 76 | + | static DECLARE_WAIT_QUEUE_HEAD(tb_cfg_request_cancel_queue); | |
| 76 | 77 | /* Serializes access to request kref_get/put */ | |
| 77 | 78 | static DEFINE_MUTEX(tb_cfg_request_lock); | |
| 78 | 79 | ||
| @@ -132,42 +133,41 @@ void tb_cfg_request_put(struct tb_cfg_request *req) | |||
| 132 | 133 | static int tb_cfg_request_enqueue(struct tb_ctl *ctl, | |
| 133 | 134 | struct tb_cfg_request *req) | |
| 134 | 135 | { | |
| 135 | - | tb_cfg_request_get(req); | |
| 136 | - | ||
| 137 | 136 | WARN_ON(test_bit(TB_CFG_REQUEST_ACTIVE, &req->flags)); | |
| 138 | 137 | WARN_ON(req->ctl); | |
| 139 | 138 | ||
| 140 | - | guard(mutex)(&ctl->request_queue_lock); | |
| 139 | + | mutex_lock(&ctl->request_queue_lock); | |
| 141 | 140 | if (!ctl->running) { | |
| 142 | - | tb_cfg_request_put(req); | |
| 141 | + | mutex_unlock(&ctl->request_queue_lock); | |
| 143 | 142 | return -ENOTCONN; | |
| 144 | 143 | } | |
| 145 | 144 | req->ctl = ctl; | |
| 146 | 145 | list_add_tail(&req->list, &ctl->request_queue); | |
| 147 | 146 | set_bit(TB_CFG_REQUEST_ACTIVE, &req->flags); | |
| 147 | + | mutex_unlock(&ctl->request_queue_lock); | |
| 148 | 148 | return 0; | |
| 149 | 149 | } | |
| 150 | 150 | ||
| 151 | - | static bool tb_cfg_request_is_active(struct tb_cfg_request *req) | |
| 152 | - | { | |
| 153 | - | return test_bit(TB_CFG_REQUEST_ACTIVE, &req->flags); | |
| 154 | - | } | |
| 155 | - | ||
| 156 | - | static bool tb_cfg_request_is_canceled(struct tb_cfg_request *req) | |
| 157 | - | { | |
| 158 | - | return test_bit(TB_CFG_REQUEST_CANCELED, &req->flags); | |
| 159 | - | } | |
| 160 | - | ||
| 161 | 151 | static void tb_cfg_request_dequeue(struct tb_cfg_request *req) | |
| 162 | 152 | { | |
| 163 | 153 | struct tb_ctl *ctl = req->ctl; | |
| 164 | 154 | ||
| 165 | - | guard(mutex)(&ctl->request_queue_lock); | |
| 166 | - | if (tb_cfg_request_is_active(req)) { | |
| 167 | - | list_del(&req->list); | |
| 168 | - | clear_bit(TB_CFG_REQUEST_ACTIVE, &req->flags); | |
| 169 | - | tb_cfg_request_put(req); | |
| 155 | + | mutex_lock(&ctl->request_queue_lock); | |
| 156 | + | if (!test_bit(TB_CFG_REQUEST_ACTIVE, &req->flags)) { | |
| 157 | + | mutex_unlock(&ctl->request_queue_lock); | |
| 158 | + | return; | |
| 170 | 159 | } | |
| 160 | + | ||
| 161 | + | list_del(&req->list); | |
| 162 | + | clear_bit(TB_CFG_REQUEST_ACTIVE, &req->flags); | |
| 163 | + | if (test_bit(TB_CFG_REQUEST_CANCELED, &req->flags)) | |
| 164 | + | wake_up(&tb_cfg_request_cancel_queue); | |
| 165 | + | mutex_unlock(&ctl->request_queue_lock); | |
| 166 | + | } | |
| 167 | + | ||
| 168 | + | static bool tb_cfg_request_is_active(struct tb_cfg_request *req) | |
| 169 | + | { | |
| 170 | + | return test_bit(TB_CFG_REQUEST_ACTIVE, &req->flags); | |
| 171 | 171 | } | |
| 172 | 172 | ||
| 173 | 173 | static struct tb_cfg_request * | |
| @@ -178,7 +178,7 @@ tb_cfg_request_find(struct tb_ctl *ctl, struct ctl_pkg *pkg) | |||
| 178 | 178 | mutex_lock(&pkg->ctl->request_queue_lock); | |
| 179 | 179 | list_for_each_entry(iter, &pkg->ctl->request_queue, list) { | |
| 180 | 180 | tb_cfg_request_get(iter); | |
| 181 | - | if (!tb_cfg_request_is_canceled(iter) && iter->match(iter, pkg)) { | |
| 181 | + | if (iter->match(iter, pkg)) { | |
| 182 | 182 | req = iter; | |
| 183 | 183 | break; | |
| 184 | 184 | } | |
| @@ -512,11 +512,8 @@ static void tb_ctl_rx_callback(struct tb_ring *ring, struct ring_frame *frame, | |||
| 512 | 512 | trace_tb_rx(pkg->ctl->index, frame->eof, pkg->buffer, frame->size, !req); | |
| 513 | 513 | ||
| 514 | 514 | if (req) { | |
| 515 | - | scoped_guard(mutex, &pkg->ctl->request_queue_lock) { | |
| 516 | - | if (!tb_cfg_request_is_canceled(req) && | |
| 517 | - | req->copy(req, pkg)) | |
| 518 | - | schedule_work(&req->work); | |
| 519 | - | } | |
| 515 | + | if (req->copy(req, pkg)) | |
| 516 | + | schedule_work(&req->work); | |
| 520 | 517 | tb_cfg_request_put(req); | |
| 521 | 518 | } | |
| 522 | 519 | ||
| @@ -528,10 +525,11 @@ static void tb_cfg_request_work(struct work_struct *work) | |||
| 528 | 525 | { | |
| 529 | 526 | struct tb_cfg_request *req = container_of(work, typeof(*req), work); | |
| 530 | 527 | ||
| 531 | - | if (!tb_cfg_request_is_canceled(req)) | |
| 528 | + | if (!test_bit(TB_CFG_REQUEST_CANCELED, &req->flags)) | |
| 532 | 529 | req->callback(req->callback_data); | |
| 533 | 530 | ||
| 534 | 531 | tb_cfg_request_dequeue(req); | |
| 532 | + | tb_cfg_request_put(req); | |
| 535 | 533 | } | |
| 536 | 534 | ||
| 537 | 535 | /** | |
| @@ -557,9 +555,10 @@ int tb_cfg_request(struct tb_ctl *ctl, struct tb_cfg_request *req, | |||
| 557 | 555 | INIT_WORK(&req->work, tb_cfg_request_work); | |
| 558 | 556 | INIT_LIST_HEAD(&req->list); | |
| 559 | 557 | ||
| 558 | + | tb_cfg_request_get(req); | |
| 560 | 559 | ret = tb_cfg_request_enqueue(ctl, req); | |
| 561 | 560 | if (ret) | |
| 562 | - | return ret; | |
| 561 | + | goto err_put; | |
| 563 | 562 | ||
| 564 | 563 | ret = tb_ctl_tx(ctl, req->request, req->request_size, | |
| 565 | 564 | req->request_type); | |
| @@ -573,6 +572,9 @@ int tb_cfg_request(struct tb_ctl *ctl, struct tb_cfg_request *req, | |||
| 573 | 572 | ||
| 574 | 573 | err_dequeue: | |
| 575 | 574 | tb_cfg_request_dequeue(req); | |
| 575 | + | err_put: | |
| 576 | + | tb_cfg_request_put(req); | |
| 577 | + | ||
| 576 | 578 | return ret; | |
| 577 | 579 | } | |
| 578 | 580 | ||
| @@ -586,10 +588,9 @@ err_dequeue: | |||
| 586 | 588 | */ | |
| 587 | 589 | void tb_cfg_request_cancel(struct tb_cfg_request *req, int err) | |
| 588 | 590 | { | |
| 589 | - | scoped_guard(mutex, &req->ctl->request_queue_lock) | |
| 590 | - | set_bit(TB_CFG_REQUEST_CANCELED, &req->flags); | |
| 591 | - | cancel_work_sync(&req->work); | |
| 592 | - | tb_cfg_request_dequeue(req); | |
| 591 | + | set_bit(TB_CFG_REQUEST_CANCELED, &req->flags); | |
| 592 | + | schedule_work(&req->work); | |
| 593 | + | wait_event(tb_cfg_request_cancel_queue, !tb_cfg_request_is_active(req)); | |
| 593 | 594 | req->result.err = err; | |
| 594 | 595 | } | |
| 595 | 596 | ||
modified drivers/thunderbolt/domain.c
| @@ -788,6 +788,21 @@ int tb_domain_approve_xdomain_paths(struct tb *tb, struct tb_xdomain *xd, | |||
| 788 | 788 | transmit_ring, receive_path, receive_ring); | |
| 789 | 789 | } | |
| 790 | 790 | ||
| 791 | + | static void tb_domain_reset_interface(struct tb *tb) | |
| 792 | + | { | |
| 793 | + | struct tb_nhi *nhi = tb->nhi; | |
| 794 | + | ||
| 795 | + | if (!nhi->ops->reset_interface) | |
| 796 | + | return; | |
| 797 | + | ||
| 798 | + | guard(mutex)(&tb->lock); | |
| 799 | + | ||
| 800 | + | /* The reset clears the ring state so stop the control channel */ | |
| 801 | + | tb_ctl_stop(tb->ctl); | |
| 802 | + | nhi->ops->reset_interface(nhi); | |
| 803 | + | tb_ctl_start(tb->ctl); | |
| 804 | + | } | |
| 805 | + | ||
| 791 | 806 | /** | |
| 792 | 807 | * tb_domain_disconnect_xdomain_paths() - Disable DMA paths for XDomain | |
| 793 | 808 | * @tb: Domain disabling the DMA paths | |
| @@ -810,11 +825,20 @@ int tb_domain_disconnect_xdomain_paths(struct tb *tb, struct tb_xdomain *xd, | |||
| 810 | 825 | int transmit_path, int transmit_ring, | |
| 811 | 826 | int receive_path, int receive_ring) | |
| 812 | 827 | { | |
| 828 | + | int ret; | |
| 829 | + | ||
| 813 | 830 | if (!tb->cm_ops->disconnect_xdomain_paths) | |
| 814 | 831 | return -ENOTSUPP; | |
| 815 | 832 | ||
| 816 | - | return tb->cm_ops->disconnect_xdomain_paths(tb, xd, transmit_path, | |
| 833 | + | ret = tb->cm_ops->disconnect_xdomain_paths(tb, xd, transmit_path, | |
| 817 | 834 | transmit_ring, receive_path, receive_ring); | |
| 835 | + | if (ret) | |
| 836 | + | return ret; | |
| 837 | + | ||
| 838 | + | if (tb->nhi->quirks & QUIRK_RESET_DMA_ON_TEARDOWN) | |
| 839 | + | tb_domain_reset_interface(tb); | |
| 840 | + | ||
| 841 | + | return 0; | |
| 818 | 842 | } | |
| 819 | 843 | ||
| 820 | 844 | static int disconnect_xdomain(struct device *dev, void *data) | |
modified drivers/thunderbolt/nhi.c
| @@ -15,7 +15,6 @@ | |||
| 15 | 15 | #include <linux/dma-mapping.h> | |
| 16 | 16 | #include <linux/interrupt.h> | |
| 17 | 17 | #include <linux/iommu.h> | |
| 18 | - | #include <linux/lockdep.h> | |
| 19 | 18 | #include <linux/module.h> | |
| 20 | 19 | #include <linux/delay.h> | |
| 21 | 20 | #include <linux/property.h> | |
| @@ -561,8 +560,6 @@ static struct tb_ring *tb_ring_alloc(struct tb_nhi *nhi, u32 hop, int size, | |||
| 561 | 560 | INIT_LIST_HEAD(&ring->in_flight); | |
| 562 | 561 | INIT_WORK(&ring->work, ring_work); | |
| 563 | 562 | init_waitqueue_head(&ring->wait); | |
| 564 | - | lockdep_register_key(&ring->lock_key); | |
| 565 | - | lockdep_init_map(&ring->work.lockdep_map, "ring.work", &ring->lock_key, 0); | |
| 566 | 563 | ||
| 567 | 564 | ring->nhi = nhi; | |
| 568 | 565 | ring->hop = hop; | |
| @@ -602,7 +599,6 @@ err_free_descs: | |||
| 602 | 599 | ring->size * sizeof(*ring->descriptors), | |
| 603 | 600 | ring->descriptors, ring->descriptors_dma); | |
| 604 | 601 | err_free_ring: | |
| 605 | - | lockdep_unregister_key(&ring->lock_key); | |
| 606 | 602 | kfree(ring); | |
| 607 | 603 | ||
| 608 | 604 | return NULL; | |
| @@ -852,7 +848,6 @@ void tb_ring_free(struct tb_ring *ring) | |||
| 852 | 848 | * to finish before freeing the ring. | |
| 853 | 849 | */ | |
| 854 | 850 | flush_work(&ring->work); | |
| 855 | - | lockdep_unregister_key(&ring->lock_key); | |
| 856 | 851 | kfree(ring); | |
| 857 | 852 | } | |
| 858 | 853 | EXPORT_SYMBOL_GPL(tb_ring_free); | |
| @@ -1180,6 +1175,32 @@ static void nhi_reset(struct tb_nhi *nhi) | |||
| 1180 | 1175 | dev_warn(nhi->dev, "timeout resetting host router\n"); | |
| 1181 | 1176 | } | |
| 1182 | 1177 | ||
| 1178 | + | /** | |
| 1179 | + | * nhi_reset_interface() - Reset the host interface | |
| 1180 | + | * @nhi: Host interface to reset | |
| 1181 | + | * | |
| 1182 | + | * Brings the registers in the memory BAR back to their default state and | |
| 1183 | + | * clears the End-to-End Flow Control state. The caller is responsible for | |
| 1184 | + | * stopping the control channel over the reset because it clears the ring | |
| 1185 | + | * state as well. | |
| 1186 | + | */ | |
| 1187 | + | void nhi_reset_interface(struct tb_nhi *nhi) | |
| 1188 | + | { | |
| 1189 | + | u32 val; | |
| 1190 | + | ||
| 1191 | + | val = ioread32(nhi->iobase + REG_CAPS); | |
| 1192 | + | /* Only v1 host interfaces implement the reset */ | |
| 1193 | + | if (FIELD_GET(REG_CAPS_VERSION_MASK, val) >= REG_CAPS_VERSION_2) | |
| 1194 | + | return; | |
| 1195 | + | ||
| 1196 | + | dev_dbg(nhi->dev, "issuing host interface reset\n"); | |
| 1197 | + | ||
| 1198 | + | iowrite32(REG_HOST_INTERFACE_RESET_RST, | |
| 1199 | + | nhi->iobase + REG_HOST_INTERFACE_RESET); | |
| 1200 | + | /* Wait for tHIReset (10 ms) to complete */ | |
| 1201 | + | usleep_range(10000, 20000); | |
| 1202 | + | } | |
| 1203 | + | ||
| 1183 | 1204 | static struct tb *nhi_select_cm(struct tb_nhi *nhi) | |
| 1184 | 1205 | { | |
| 1185 | 1206 | struct tb *tb; | |
modified drivers/thunderbolt/nhi.h
| @@ -36,6 +36,8 @@ irqreturn_t nhi_msi(int irq, void *data); | |||
| 36 | 36 | irqreturn_t ring_msix(int irq, void *data); | |
| 37 | 37 | int nhi_probe(struct tb_nhi *nhi); | |
| 38 | 38 | void nhi_shutdown(struct tb_nhi *nhi); | |
| 39 | + | void nhi_reset_interface(struct tb_nhi *nhi); | |
| 40 | + | ||
| 39 | 41 | extern const struct dev_pm_ops nhi_pm_ops; | |
| 40 | 42 | ||
| 41 | 43 | /** | |
| @@ -52,6 +54,7 @@ extern const struct dev_pm_ops nhi_pm_ops; | |||
| 52 | 54 | * @release_ring_irq: NHI specific interrupt release hook | |
| 53 | 55 | * @is_present: Whether the device is currently present on the parent bus | |
| 54 | 56 | * @init_interrupts: NHI specific interrupt initialization hook | |
| 57 | + | * @reset_interface: Resets the host interface | |
| 55 | 58 | */ | |
| 56 | 59 | struct tb_nhi_ops { | |
| 57 | 60 | int (*init)(struct tb_nhi *nhi); | |
| @@ -66,6 +69,7 @@ struct tb_nhi_ops { | |||
| 66 | 69 | void (*release_ring_irq)(struct tb_ring *ring); | |
| 67 | 70 | bool (*is_present)(struct tb_nhi *nhi); | |
| 68 | 71 | int (*init_interrupts)(struct tb_nhi *nhi); | |
| 72 | + | void (*reset_interface)(struct tb_nhi *nhi); | |
| 69 | 73 | }; | |
| 70 | 74 | ||
| 71 | 75 | /* | |
| @@ -116,11 +120,24 @@ struct tb_nhi_ops { | |||
| 116 | 120 | #define PCI_DEVICE_ID_INTEL_PTL_P_NHI0 0xe433 | |
| 117 | 121 | #define PCI_DEVICE_ID_INTEL_PTL_P_NHI1 0xe434 | |
| 118 | 122 | ||
| 123 | + | #define PCI_DEVICE_ID_AMD_1AH_M60H_NHI0 0x1120 | |
| 124 | + | #define PCI_DEVICE_ID_AMD_1AH_M60H_NHI1 0x1121 | |
| 125 | + | #define PCI_DEVICE_ID_AMD_1AH_M68H_NHI0 0x113b | |
| 126 | + | #define PCI_DEVICE_ID_AMD_1AH_M68H_NHI1 0x113c | |
| 127 | + | #define PCI_DEVICE_ID_AMD_1AH_M80H_NHI0 0x1155 | |
| 128 | + | #define PCI_DEVICE_ID_AMD_1AH_M80H_NHI1 0x1158 | |
| 129 | + | #define PCI_DEVICE_ID_AMD_1AH_M80H_NHI2 0x1159 | |
| 130 | + | #define PCI_DEVICE_ID_AMD_1AH_M24H_NHI0 0x151c | |
| 131 | + | #define PCI_DEVICE_ID_AMD_1AH_M24H_NHI1 0x151d | |
| 132 | + | #define PCI_DEVICE_ID_AMD_1AH_M70H_NHI0 0x158d | |
| 133 | + | #define PCI_DEVICE_ID_AMD_1AH_M70H_NHI1 0x158e | |
| 134 | + | ||
| 119 | 135 | #define PCI_CLASS_SERIAL_USB_USB4 0x0c0340 | |
| 120 | 136 | ||
| 121 | 137 | /* Host interface quirks */ | |
| 122 | - | #define QUIRK_AUTO_CLEAR_INT BIT(0) | |
| 123 | - | #define QUIRK_E2E BIT(1) | |
| 138 | + | #define QUIRK_AUTO_CLEAR_INT BIT(0) | |
| 139 | + | #define QUIRK_E2E BIT(1) | |
| 140 | + | #define QUIRK_RESET_DMA_ON_TEARDOWN BIT(2) | |
| 124 | 141 | ||
| 125 | 142 | /* | |
| 126 | 143 | * Minimal number of vectors when we use MSI-X. Two for control channel | |
modified drivers/thunderbolt/nhi_regs.h
| @@ -115,6 +115,10 @@ struct ring_desc { | |||
| 115 | 115 | #define REG_CAPS_VERSION_MASK GENMASK(23, 16) | |
| 116 | 116 | #define REG_CAPS_VERSION_2 0x40 | |
| 117 | 117 | ||
| 118 | + | /* Host Interface Reset - resets TX/RX rings and E2E flow control counters */ | |
| 119 | + | #define REG_HOST_INTERFACE_RESET 0x39858 | |
| 120 | + | #define REG_HOST_INTERFACE_RESET_RST BIT(0) | |
| 121 | + | ||
| 118 | 122 | #define REG_DMA_MISC 0x39864 | |
| 119 | 123 | #define REG_DMA_MISC_INT_AUTO_CLEAR BIT(2) | |
| 120 | 124 | #define REG_DMA_MISC_DISABLE_AUTO_CLEAR BIT(17) | |
modified drivers/thunderbolt/pci.c
| @@ -62,6 +62,27 @@ static void nhi_pci_check_quirks(struct tb_nhi_pci *nhi_pci) | |||
| 62 | 62 | nhi->quirks |= QUIRK_E2E; | |
| 63 | 63 | break; | |
| 64 | 64 | } | |
| 65 | + | } else if (pdev->vendor == PCI_VENDOR_ID_AMD) { | |
| 66 | + | switch (pdev->device) { | |
| 67 | + | case PCI_DEVICE_ID_AMD_1AH_M60H_NHI0: | |
| 68 | + | case PCI_DEVICE_ID_AMD_1AH_M60H_NHI1: | |
| 69 | + | case PCI_DEVICE_ID_AMD_1AH_M68H_NHI0: | |
| 70 | + | case PCI_DEVICE_ID_AMD_1AH_M68H_NHI1: | |
| 71 | + | case PCI_DEVICE_ID_AMD_1AH_M80H_NHI0: | |
| 72 | + | case PCI_DEVICE_ID_AMD_1AH_M80H_NHI1: | |
| 73 | + | case PCI_DEVICE_ID_AMD_1AH_M80H_NHI2: | |
| 74 | + | case PCI_DEVICE_ID_AMD_1AH_M24H_NHI0: | |
| 75 | + | case PCI_DEVICE_ID_AMD_1AH_M24H_NHI1: | |
| 76 | + | case PCI_DEVICE_ID_AMD_1AH_M70H_NHI0: | |
| 77 | + | case PCI_DEVICE_ID_AMD_1AH_M70H_NHI1: | |
| 78 | + | /* | |
| 79 | + | * These AMD hosts may hang the Tx ring when the | |
| 80 | + | * DMA paths are torn down so they need the host | |
| 81 | + | * interface reset after each teardown. | |
| 82 | + | */ | |
| 83 | + | nhi->quirks |= QUIRK_RESET_DMA_ON_TEARDOWN; | |
| 84 | + | break; | |
| 85 | + | } | |
| 65 | 86 | } | |
| 66 | 87 | } | |
| 67 | 88 | ||
| @@ -258,6 +279,7 @@ static const struct tb_nhi_ops pci_nhi_default_ops = { | |||
| 258 | 279 | .shutdown = nhi_pci_release_irq, | |
| 259 | 280 | .is_present = nhi_pci_is_present, | |
| 260 | 281 | .init_interrupts = nhi_pci_init_msi, | |
| 282 | + | .reset_interface = nhi_reset_interface, | |
| 261 | 283 | }; | |
| 262 | 284 | ||
| 263 | 285 | /* Ice Lake specific NHI operations */ | |
| @@ -441,6 +463,7 @@ static const struct tb_nhi_ops icl_nhi_ops = { | |||
| 441 | 463 | .release_ring_irq = nhi_pci_ring_release_msix, | |
| 442 | 464 | .is_present = nhi_pci_is_present, | |
| 443 | 465 | .init_interrupts = nhi_pci_init_msi, | |
| 466 | + | .reset_interface = nhi_reset_interface, | |
| 444 | 467 | }; | |
| 445 | 468 | ||
| 446 | 469 | static int nhi_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |
modified drivers/thunderbolt/quirks.c
| @@ -99,9 +99,6 @@ static const struct tb_quirk tb_quirks[] = { | |||
| 99 | 99 | quirk_usb3_maximum_bandwidth }, | |
| 100 | 100 | { 0x8087, PCI_DEVICE_ID_INTEL_BARLOW_RIDGE_HUB_40G_BRIDGE, 0x0000, 0x0000, | |
| 101 | 101 | quirk_usb3_maximum_bandwidth }, | |
| 102 | - | /* CLx is unstable on the Anker Prime TB5 dock (DROM 01ea:83b5) */ | |
| 103 | - | { 0x8087, PCI_DEVICE_ID_INTEL_BARLOW_RIDGE_HUB_80G_BRIDGE, 0x01ea, 0x83b5, | |
| 104 | - | quirk_clx_disable }, | |
| 105 | 102 | /* | |
| 106 | 103 | * Block Runtime PM in DP redrive mode for Intel Barlow Ridge host | |
| 107 | 104 | * controllers. | |
modified drivers/thunderbolt/stream.c
| @@ -978,9 +978,6 @@ static int tbstream_dev_fops_open(struct inode *inode, struct file *file) | |||
| 978 | 978 | } | |
| 979 | 979 | ||
| 980 | 980 | mutex_unlock(&sdev->lock); | |
| 981 | - | ||
| 982 | - | /* Stream handles IOCB_NOWAIT just fine */ | |
| 983 | - | file->f_mode |= FMODE_NOWAIT; | |
| 984 | 981 | return 0; | |
| 985 | 982 | ||
| 986 | 983 | err_unlock: | |
modified drivers/thunderbolt/switch.c
| @@ -774,7 +774,6 @@ static int tb_port_alloc_hopid(struct tb_port *port, bool in, int min_hopid, | |||
| 774 | 774 | { | |
| 775 | 775 | int port_max_hopid; | |
| 776 | 776 | struct ida *ida; | |
| 777 | - | int ret; | |
| 778 | 777 | ||
| 779 | 778 | if (in) { | |
| 780 | 779 | port_max_hopid = port->config.max_in_hop_id; | |
| @@ -794,11 +793,7 @@ static int tb_port_alloc_hopid(struct tb_port *port, bool in, int min_hopid, | |||
| 794 | 793 | if (max_hopid < 0 || max_hopid > port_max_hopid) | |
| 795 | 794 | max_hopid = port_max_hopid; | |
| 796 | 795 | ||
| 797 | - | ret = ida_alloc_range(ida, min_hopid, max_hopid, GFP_KERNEL); | |
| 798 | - | if (ret >= 0) | |
| 799 | - | tb_switch_get(port->sw); | |
| 800 | - | ||
| 801 | - | return ret; | |
| 796 | + | return ida_alloc_range(ida, min_hopid, max_hopid, GFP_KERNEL); | |
| 802 | 797 | } | |
| 803 | 798 | ||
| 804 | 799 | /** | |
| @@ -837,7 +832,6 @@ int tb_port_alloc_out_hopid(struct tb_port *port, int min_hopid, int max_hopid) | |||
| 837 | 832 | void tb_port_release_in_hopid(struct tb_port *port, int hopid) | |
| 838 | 833 | { | |
| 839 | 834 | ida_free(&port->in_hopids, hopid); | |
| 840 | - | tb_switch_put(port->sw); | |
| 841 | 835 | } | |
| 842 | 836 | ||
| 843 | 837 | /** | |
| @@ -848,7 +842,6 @@ void tb_port_release_in_hopid(struct tb_port *port, int hopid) | |||
| 848 | 842 | void tb_port_release_out_hopid(struct tb_port *port, int hopid) | |
| 849 | 843 | { | |
| 850 | 844 | ida_free(&port->out_hopids, hopid); | |
| 851 | - | tb_switch_put(port->sw); | |
| 852 | 845 | } | |
| 853 | 846 | ||
| 854 | 847 | static inline bool tb_switch_is_reachable(const struct tb_switch *parent, | |
modified drivers/thunderbolt/tb.c
| @@ -89,7 +89,6 @@ static void tb_dp_resource_unavailable(struct tb *tb, struct tb_port *port, | |||
| 89 | 89 | const char *reason); | |
| 90 | 90 | static void tb_queue_dp_bandwidth_request(struct tb *tb, u64 route, u8 port, | |
| 91 | 91 | int retry, unsigned long delay); | |
| 92 | - | static void tb_dp_tunnel_active(struct tb_tunnel *tunnel, void *data); | |
| 93 | 92 | ||
| 94 | 93 | static void tb_queue_hotplug(struct tb *tb, u64 route, u8 port, bool unplug) | |
| 95 | 94 | { | |
| @@ -386,8 +385,7 @@ static void tb_switch_discover_tunnels(struct tb_switch *sw, | |||
| 386 | 385 | ||
| 387 | 386 | switch (port->config.type) { | |
| 388 | 387 | case TB_TYPE_DP_HDMI_IN: | |
| 389 | - | tunnel = tb_tunnel_discover_dp(tb, port, alloc_hopids, | |
| 390 | - | tb_dp_tunnel_active, tb); | |
| 388 | + | tunnel = tb_tunnel_discover_dp(tb, port, alloc_hopids); | |
| 391 | 389 | tb_increase_tmu_accuracy(tunnel); | |
| 392 | 390 | break; | |
| 393 | 391 | ||
| @@ -1912,18 +1910,6 @@ static void tb_dp_tunnel_active(struct tb_tunnel *tunnel, void *data) | |||
| 1912 | 1910 | struct tb *tb = data; | |
| 1913 | 1911 | ||
| 1914 | 1912 | mutex_lock(&tb->lock); | |
| 1915 | - | ||
| 1916 | - | /* | |
| 1917 | - | * If the DPRX read was canceled the tunnel is already being torn | |
| 1918 | - | * down by whoever canceled it. Do not touch the adapters here | |
| 1919 | - | * because the routers may be gone by now. | |
| 1920 | - | */ | |
| 1921 | - | if (tunnel->dprx_canceled) { | |
| 1922 | - | tb_tunnel_dbg(tunnel, "DPRX read canceled, not activating\n"); | |
| 1923 | - | mutex_unlock(&tb->lock); | |
| 1924 | - | return; | |
| 1925 | - | } | |
| 1926 | - | ||
| 1927 | 1913 | if (tb_tunnel_is_active(tunnel)) { | |
| 1928 | 1914 | int consumed_up, consumed_down, ret; | |
| 1929 | 1915 | ||
| @@ -1978,6 +1964,8 @@ static void tb_dp_tunnel_active(struct tb_tunnel *tunnel, void *data) | |||
| 1978 | 1964 | tb_dp_resource_unavailable(tb, in, "DPRX negotiation failed"); | |
| 1979 | 1965 | } | |
| 1980 | 1966 | mutex_unlock(&tb->lock); | |
| 1967 | + | ||
| 1968 | + | tb_domain_put(tb); | |
| 1981 | 1969 | } | |
| 1982 | 1970 | ||
| 1983 | 1971 | static void tb_tunnel_one_dp(struct tb *tb, struct tb_port *in, | |
| @@ -2038,7 +2026,8 @@ static void tb_tunnel_one_dp(struct tb *tb, struct tb_port *in, | |||
| 2038 | 2026 | available_up, available_down); | |
| 2039 | 2027 | ||
| 2040 | 2028 | tunnel = tb_tunnel_alloc_dp(tb, in, out, link_nr, available_up, | |
| 2041 | - | available_down, tb_dp_tunnel_active, tb); | |
| 2029 | + | available_down, tb_dp_tunnel_active, | |
| 2030 | + | tb_domain_get(tb)); | |
| 2042 | 2031 | if (!tunnel) { | |
| 2043 | 2032 | tb_port_dbg(out, "could not allocate DP tunnel\n"); | |
| 2044 | 2033 | goto err_reclaim_usb; | |
| @@ -2059,6 +2048,7 @@ err_free: | |||
| 2059 | 2048 | tb_tunnel_put(tunnel); | |
| 2060 | 2049 | err_reclaim_usb: | |
| 2061 | 2050 | tb_reclaim_usb3_bandwidth(tb, in, out); | |
| 2051 | + | tb_domain_put(tb); | |
| 2062 | 2052 | err_detach_group: | |
| 2063 | 2053 | tb_detach_bandwidth_group(in); | |
| 2064 | 2054 | err_dealloc_dp: | |
| @@ -2960,12 +2950,11 @@ static void tb_stop(struct tb *tb) | |||
| 2960 | 2950 | /* tunnels are only present after everything has been initialized */ | |
| 2961 | 2951 | list_for_each_entry_safe(tunnel, n, &tcm->tunnel_list, list) { | |
| 2962 | 2952 | /* | |
| 2963 | - | * DMA tunnels and DP tunnels which are not yet active require | |
| 2964 | - | * the driver to be functional so we tear them down. | |
| 2965 | - | * Other protocol tunnels can be left intact. | |
| 2953 | + | * DMA tunnels require the driver to be functional so we | |
| 2954 | + | * tear them down. Other protocol tunnels can be left | |
| 2955 | + | * intact. | |
| 2966 | 2956 | */ | |
| 2967 | - | if (tb_tunnel_is_dma(tunnel) || | |
| 2968 | - | (tb_tunnel_is_dp(tunnel) && !tb_tunnel_is_active(tunnel))) | |
| 2957 | + | if (tb_tunnel_is_dma(tunnel)) | |
| 2969 | 2958 | tb_tunnel_deactivate(tunnel); | |
| 2970 | 2959 | tb_tunnel_put(tunnel); | |
| 2971 | 2960 | } | |
| @@ -3285,11 +3274,11 @@ static void tb_remove_work(struct work_struct *work) | |||
| 3285 | 3274 | struct tb *tb = tcm_to_tb(tcm); | |
| 3286 | 3275 | ||
| 3287 | 3276 | mutex_lock(&tb->lock); | |
| 3288 | - | if (tb->root_switch) { | |
| 3277 | + | if (tb->root_switch) | |
| 3289 | 3278 | tb_free_unplugged_children(tb->root_switch); | |
| 3290 | - | tb_free_unplugged_xdomains(tb->root_switch); | |
| 3291 | - | } | |
| 3292 | 3279 | mutex_unlock(&tb->lock); | |
| 3280 | + | ||
| 3281 | + | tb_free_unplugged_xdomains(tb->root_switch); | |
| 3293 | 3282 | } | |
| 3294 | 3283 | ||
| 3295 | 3284 | static int tb_runtime_resume(struct tb *tb) | |
modified drivers/thunderbolt/test.c
| @@ -33,18 +33,6 @@ static void kunit_ida_init(struct kunit *test, struct ida *ida) | |||
| 33 | 33 | kunit_alloc_resource(test, __ida_init, __ida_destroy, GFP_KERNEL, ida); | |
| 34 | 34 | } | |
| 35 | 35 | ||
| 36 | - | static void tb_test_switch_release(struct device *dev) | |
| 37 | - | { | |
| 38 | - | /* The memory is owned by KUnit, nothing to do here */ | |
| 39 | - | } | |
| 40 | - | ||
| 41 | - | static void tb_test_switch_put(void *data) | |
| 42 | - | { | |
| 43 | - | struct tb_switch *sw = data; | |
| 44 | - | ||
| 45 | - | put_device(&sw->dev); | |
| 46 | - | } | |
| 47 | - | ||
| 48 | 36 | static struct tb_switch *alloc_switch(struct kunit *test, u64 route, | |
| 49 | 37 | u8 upstream_port, u8 max_port_number) | |
| 50 | 38 | { | |
| @@ -56,15 +44,6 @@ static struct tb_switch *alloc_switch(struct kunit *test, u64 route, | |||
| 56 | 44 | if (!sw) | |
| 57 | 45 | return NULL; | |
| 58 | 46 | ||
| 59 | - | /* | |
| 60 | - | * HopID allocations take a reference to their routers and those devices | |
| 61 | - | * have to be initialized for that to work. | |
| 62 | - | */ | |
| 63 | - | sw->dev.release = tb_test_switch_release; | |
| 64 | - | device_initialize(&sw->dev); | |
| 65 | - | if (kunit_add_action_or_reset(test, tb_test_switch_put, sw)) | |
| 66 | - | return NULL; | |
| 67 | - | ||
| 68 | 47 | sw->config.upstream_port_number = upstream_port; | |
| 69 | 48 | sw->config.depth = tb_route_length(route); | |
| 70 | 49 | sw->config.route_hi = upper_32_bits(route); | |
| @@ -1407,10 +1386,6 @@ static void tb_test_tunnel_pcie(struct kunit *test) | |||
| 1407 | 1386 | tb_tunnel_put(tunnel1); | |
| 1408 | 1387 | } | |
| 1409 | 1388 | ||
| 1410 | - | static void tb_test_dp_tunnel_active(struct tb_tunnel *tunnel, void *data) | |
| 1411 | - | { | |
| 1412 | - | } | |
| 1413 | - | ||
| 1414 | 1389 | static void tb_test_tunnel_dp(struct kunit *test) | |
| 1415 | 1390 | { | |
| 1416 | 1391 | struct tb_switch *host, *dev; | |
| @@ -1431,8 +1406,7 @@ static void tb_test_tunnel_dp(struct kunit *test) | |||
| 1431 | 1406 | in = &host->ports[5]; | |
| 1432 | 1407 | out = &dev->ports[13]; | |
| 1433 | 1408 | ||
| 1434 | - | tunnel = tb_tunnel_alloc_dp(NULL, in, out, 1, 0, 0, | |
| 1435 | - | tb_test_dp_tunnel_active, NULL); | |
| 1409 | + | tunnel = tb_tunnel_alloc_dp(NULL, in, out, 1, 0, 0, NULL, NULL); | |
| 1436 | 1410 | KUNIT_ASSERT_NOT_NULL(test, tunnel); | |
| 1437 | 1411 | KUNIT_EXPECT_EQ(test, tunnel->type, TB_TUNNEL_DP); | |
| 1438 | 1412 | KUNIT_EXPECT_PTR_EQ(test, tunnel->src_port, in); | |
| @@ -1478,8 +1452,7 @@ static void tb_test_tunnel_dp_chain(struct kunit *test) | |||
| 1478 | 1452 | in = &host->ports[5]; | |
| 1479 | 1453 | out = &dev4->ports[14]; | |
| 1480 | 1454 | ||
| 1481 | - | tunnel = tb_tunnel_alloc_dp(NULL, in, out, 1, 0, 0, | |
| 1482 | - | tb_test_dp_tunnel_active, NULL); | |
| 1455 | + | tunnel = tb_tunnel_alloc_dp(NULL, in, out, 1, 0, 0, NULL, NULL); | |
| 1483 | 1456 | KUNIT_ASSERT_NOT_NULL(test, tunnel); | |
| 1484 | 1457 | KUNIT_EXPECT_EQ(test, tunnel->type, TB_TUNNEL_DP); | |
| 1485 | 1458 | KUNIT_EXPECT_PTR_EQ(test, tunnel->src_port, in); | |
| @@ -1529,8 +1502,7 @@ static void tb_test_tunnel_dp_tree(struct kunit *test) | |||
| 1529 | 1502 | in = &dev2->ports[13]; | |
| 1530 | 1503 | out = &dev5->ports[13]; | |
| 1531 | 1504 | ||
| 1532 | - | tunnel = tb_tunnel_alloc_dp(NULL, in, out, 1, 0, 0, | |
| 1533 | - | tb_test_dp_tunnel_active, NULL); | |
| 1505 | + | tunnel = tb_tunnel_alloc_dp(NULL, in, out, 1, 0, 0, NULL, NULL); | |
| 1534 | 1506 | KUNIT_ASSERT_NOT_NULL(test, tunnel); | |
| 1535 | 1507 | KUNIT_EXPECT_EQ(test, tunnel->type, TB_TUNNEL_DP); | |
| 1536 | 1508 | KUNIT_EXPECT_PTR_EQ(test, tunnel->src_port, in); | |
| @@ -1595,8 +1567,7 @@ static void tb_test_tunnel_dp_max_length(struct kunit *test) | |||
| 1595 | 1567 | in = &dev6->ports[13]; | |
| 1596 | 1568 | out = &dev12->ports[13]; | |
| 1597 | 1569 | ||
| 1598 | - | tunnel = tb_tunnel_alloc_dp(NULL, in, out, 1, 0, 0, | |
| 1599 | - | tb_test_dp_tunnel_active, NULL); | |
| 1570 | + | tunnel = tb_tunnel_alloc_dp(NULL, in, out, 1, 0, 0, NULL, NULL); | |
| 1600 | 1571 | KUNIT_ASSERT_NOT_NULL(test, tunnel); | |
| 1601 | 1572 | KUNIT_EXPECT_EQ(test, tunnel->type, TB_TUNNEL_DP); | |
| 1602 | 1573 | KUNIT_EXPECT_PTR_EQ(test, tunnel->src_port, in); | |
| @@ -1666,8 +1637,7 @@ static void tb_test_tunnel_3dp(struct kunit *test) | |||
| 1666 | 1637 | out2 = &dev5->ports[13]; | |
| 1667 | 1638 | out3 = &dev4->ports[14]; | |
| 1668 | 1639 | ||
| 1669 | - | tunnel1 = tb_tunnel_alloc_dp(NULL, in1, out1, 1, 0, 0, | |
| 1670 | - | tb_test_dp_tunnel_active, NULL); | |
| 1640 | + | tunnel1 = tb_tunnel_alloc_dp(NULL, in1, out1, 1, 0, 0, NULL, NULL); | |
| 1671 | 1641 | KUNIT_ASSERT_TRUE(test, tunnel1 != NULL); | |
| 1672 | 1642 | KUNIT_EXPECT_EQ(test, tunnel1->type, TB_TUNNEL_DP); | |
| 1673 | 1643 | KUNIT_EXPECT_PTR_EQ(test, tunnel1->src_port, in1); | |
| @@ -1675,8 +1645,7 @@ static void tb_test_tunnel_3dp(struct kunit *test) | |||
| 1675 | 1645 | KUNIT_ASSERT_EQ(test, tunnel1->npaths, 3); | |
| 1676 | 1646 | KUNIT_ASSERT_EQ(test, tunnel1->paths[0]->path_length, 3); | |
| 1677 | 1647 | ||
| 1678 | - | tunnel2 = tb_tunnel_alloc_dp(NULL, in2, out2, 1, 0, 0, | |
| 1679 | - | tb_test_dp_tunnel_active, NULL); | |
| 1648 | + | tunnel2 = tb_tunnel_alloc_dp(NULL, in2, out2, 1, 0, 0, NULL, NULL); | |
| 1680 | 1649 | KUNIT_ASSERT_TRUE(test, tunnel2 != NULL); | |
| 1681 | 1650 | KUNIT_EXPECT_EQ(test, tunnel2->type, TB_TUNNEL_DP); | |
| 1682 | 1651 | KUNIT_EXPECT_PTR_EQ(test, tunnel2->src_port, in2); | |
| @@ -1684,8 +1653,7 @@ static void tb_test_tunnel_3dp(struct kunit *test) | |||
| 1684 | 1653 | KUNIT_ASSERT_EQ(test, tunnel2->npaths, 3); | |
| 1685 | 1654 | KUNIT_ASSERT_EQ(test, tunnel2->paths[0]->path_length, 4); | |
| 1686 | 1655 | ||
| 1687 | - | tunnel3 = tb_tunnel_alloc_dp(NULL, in3, out3, 1, 0, 0, | |
| 1688 | - | tb_test_dp_tunnel_active, NULL); | |
| 1656 | + | tunnel3 = tb_tunnel_alloc_dp(NULL, in3, out3, 1, 0, 0, NULL, NULL); | |
| 1689 | 1657 | KUNIT_ASSERT_TRUE(test, tunnel3 != NULL); | |
| 1690 | 1658 | KUNIT_EXPECT_EQ(test, tunnel3->type, TB_TUNNEL_DP); | |
| 1691 | 1659 | KUNIT_EXPECT_PTR_EQ(test, tunnel3->src_port, in3); | |
| @@ -1783,8 +1751,7 @@ static void tb_test_tunnel_port_on_path(struct kunit *test) | |||
| 1783 | 1751 | in = &dev2->ports[13]; | |
| 1784 | 1752 | out = &dev5->ports[13]; | |
| 1785 | 1753 | ||
| 1786 | - | dp_tunnel = tb_tunnel_alloc_dp(NULL, in, out, 1, 0, 0, | |
| 1787 | - | tb_test_dp_tunnel_active, NULL); | |
| 1754 | + | dp_tunnel = tb_tunnel_alloc_dp(NULL, in, out, 1, 0, 0, NULL, NULL); | |
| 1788 | 1755 | KUNIT_ASSERT_NOT_NULL(test, dp_tunnel); | |
| 1789 | 1756 | ||
| 1790 | 1757 | KUNIT_EXPECT_TRUE(test, tb_tunnel_port_on_path(dp_tunnel, in)); | |
| @@ -2216,8 +2183,7 @@ static void tb_test_credit_alloc_dp(struct kunit *test) | |||
| 2216 | 2183 | in = &host->ports[5]; | |
| 2217 | 2184 | out = &dev->ports[14]; | |
| 2218 | 2185 | ||
| 2219 | - | tunnel = tb_tunnel_alloc_dp(NULL, in, out, 1, 0, 0, | |
| 2220 | - | tb_test_dp_tunnel_active, NULL); | |
| 2186 | + | tunnel = tb_tunnel_alloc_dp(NULL, in, out, 1, 0, 0, NULL, NULL); | |
| 2221 | 2187 | KUNIT_ASSERT_NOT_NULL(test, tunnel); | |
| 2222 | 2188 | KUNIT_ASSERT_EQ(test, tunnel->npaths, (size_t)3); | |
| 2223 | 2189 | ||
| @@ -2453,8 +2419,7 @@ static struct tb_tunnel *TB_TEST_DP_TUNNEL1(struct kunit *test, | |||
| 2453 | 2419 | ||
| 2454 | 2420 | in = &host->ports[5]; | |
| 2455 | 2421 | out = &dev->ports[13]; | |
| 2456 | - | dp_tunnel1 = tb_tunnel_alloc_dp(NULL, in, out, 1, 0, 0, | |
| 2457 | - | tb_test_dp_tunnel_active, NULL); | |
| 2422 | + | dp_tunnel1 = tb_tunnel_alloc_dp(NULL, in, out, 1, 0, 0, NULL, NULL); | |
| 2458 | 2423 | KUNIT_ASSERT_NOT_NULL(test, dp_tunnel1); | |
| 2459 | 2424 | KUNIT_ASSERT_EQ(test, dp_tunnel1->npaths, (size_t)3); | |
| 2460 | 2425 | ||
| @@ -2491,8 +2456,7 @@ static struct tb_tunnel *TB_TEST_DP_TUNNEL2(struct kunit *test, | |||
| 2491 | 2456 | ||
| 2492 | 2457 | in = &host->ports[6]; | |
| 2493 | 2458 | out = &dev->ports[14]; | |
| 2494 | - | dp_tunnel2 = tb_tunnel_alloc_dp(NULL, in, out, 1, 0, 0, | |
| 2495 | - | tb_test_dp_tunnel_active, NULL); | |
| 2459 | + | dp_tunnel2 = tb_tunnel_alloc_dp(NULL, in, out, 1, 0, 0, NULL, NULL); | |
| 2496 | 2460 | KUNIT_ASSERT_NOT_NULL(test, dp_tunnel2); | |
| 2497 | 2461 | KUNIT_ASSERT_EQ(test, dp_tunnel2->npaths, (size_t)3); | |
| 2498 | 2462 | ||
modified drivers/thunderbolt/tunnel.c
| @@ -510,7 +510,6 @@ struct tb_tunnel *tb_tunnel_discover_pci(struct tb *tb, struct tb_port *down, | |||
| 510 | 510 | goto err_deactivate; | |
| 511 | 511 | } | |
| 512 | 512 | ||
| 513 | - | tb_tunnel_set_active(tunnel, true); | |
| 514 | 513 | tb_tunnel_dbg(tunnel, "discovered\n"); | |
| 515 | 514 | return tunnel; | |
| 516 | 515 | ||
| @@ -1094,14 +1093,8 @@ static void tb_dp_dprx_work(struct work_struct *work) | |||
| 1094 | 1093 | struct tb_tunnel *tunnel = container_of(work, typeof(*tunnel), dprx_work.work); | |
| 1095 | 1094 | struct tb *tb = tunnel->tb; | |
| 1096 | 1095 | ||
| 1097 | - | /* | |
| 1098 | - | * The DPRX read can be canceled while this work is waiting for | |
| 1099 | - | * tb->lock. Check the flag only once it is held: while the lock is | |
| 1100 | - | * held the tunnel cannot be torn down under us and the adapters are | |
| 1101 | - | * safe to access. | |
| 1102 | - | */ | |
| 1103 | - | mutex_lock(&tb->lock); | |
| 1104 | 1096 | if (!tunnel->dprx_canceled) { | |
| 1097 | + | mutex_lock(&tb->lock); | |
| 1105 | 1098 | if (tb_dp_is_usb4(tunnel->src_port->sw) && | |
| 1106 | 1099 | tb_dp_wait_dprx(tunnel, TB_DPRX_WAIT_TIMEOUT)) { | |
| 1107 | 1100 | if (ktime_before(ktime_get(), tunnel->dprx_timeout)) { | |
| @@ -1113,42 +1106,41 @@ static void tb_dp_dprx_work(struct work_struct *work) | |||
| 1113 | 1106 | } else { | |
| 1114 | 1107 | tb_tunnel_set_active(tunnel, true); | |
| 1115 | 1108 | } | |
| 1109 | + | mutex_unlock(&tb->lock); | |
| 1116 | 1110 | } | |
| 1117 | - | mutex_unlock(&tb->lock); | |
| 1118 | 1111 | ||
| 1119 | - | tunnel->callback(tunnel, tunnel->callback_data); | |
| 1112 | + | if (tunnel->callback) | |
| 1113 | + | tunnel->callback(tunnel, tunnel->callback_data); | |
| 1120 | 1114 | tb_tunnel_put(tunnel); | |
| 1121 | - | tb_domain_put(tb); | |
| 1122 | 1115 | } | |
| 1123 | 1116 | ||
| 1124 | 1117 | static int tb_dp_dprx_start(struct tb_tunnel *tunnel) | |
| 1125 | 1118 | { | |
| 1126 | 1119 | /* | |
| 1127 | - | * Bump up the references to keep the tunnel and the domain around | |
| 1128 | - | * until the work has run or has been canceled. | |
| 1120 | + | * Bump up the reference to keep the tunnel around. It will be | |
| 1121 | + | * dropped in tb_dp_dprx_stop() once the tunnel is deactivated. | |
| 1129 | 1122 | */ | |
| 1130 | 1123 | tb_tunnel_get(tunnel); | |
| 1131 | - | tb_domain_get(tunnel->tb); | |
| 1132 | 1124 | ||
| 1133 | 1125 | tunnel->dprx_started = true; | |
| 1134 | - | tunnel->dprx_canceled = false; | |
| 1135 | - | tunnel->dprx_timeout = dprx_timeout_to_ktime(dprx_timeout); | |
| 1136 | - | queue_delayed_work(tunnel->tb->wq, &tunnel->dprx_work, 0); | |
| 1137 | 1126 | ||
| 1138 | - | return -EINPROGRESS; | |
| 1127 | + | if (tunnel->callback) { | |
| 1128 | + | tunnel->dprx_timeout = dprx_timeout_to_ktime(dprx_timeout); | |
| 1129 | + | queue_delayed_work(tunnel->tb->wq, &tunnel->dprx_work, 0); | |
| 1130 | + | return -EINPROGRESS; | |
| 1131 | + | } | |
| 1132 | + | ||
| 1133 | + | return tb_dp_is_usb4(tunnel->src_port->sw) ? | |
| 1134 | + | tb_dp_wait_dprx(tunnel, dprx_timeout) : 0; | |
| 1139 | 1135 | } | |
| 1140 | 1136 | ||
| 1141 | 1137 | static void tb_dp_dprx_stop(struct tb_tunnel *tunnel) | |
| 1142 | 1138 | { | |
| 1143 | - | struct tb *tb = tunnel->tb; | |
| 1144 | - | ||
| 1145 | 1139 | if (tunnel->dprx_started) { | |
| 1146 | 1140 | tunnel->dprx_started = false; | |
| 1147 | 1141 | tunnel->dprx_canceled = true; | |
| 1148 | - | if (cancel_delayed_work(&tunnel->dprx_work)) { | |
| 1142 | + | if (cancel_delayed_work(&tunnel->dprx_work)) | |
| 1149 | 1143 | tb_tunnel_put(tunnel); | |
| 1150 | - | tb_domain_put(tb); | |
| 1151 | - | } | |
| 1152 | 1144 | } | |
| 1153 | 1145 | } | |
| 1154 | 1146 | ||
| @@ -1590,28 +1582,20 @@ static void tb_dp_dump(struct tb_tunnel *tunnel) | |||
| 1590 | 1582 | * @tb: Pointer to the domain structure | |
| 1591 | 1583 | * @in: DP in adapter | |
| 1592 | 1584 | * @alloc_hopid: Allocate HopIDs from visited ports | |
| 1593 | - | * @callback: Callback that is called when the DP tunnel is fully | |
| 1594 | - | * activated (or there is an error) | |
| 1595 | - | * @callback_data: Data for @callback | |
| 1596 | 1585 | * | |
| 1597 | 1586 | * If @in adapter is active, follows the tunnel to the DP out adapter | |
| 1598 | 1587 | * and back. Returns the discovered tunnel or %NULL if there was no | |
| 1599 | - | * tunnel. See tb_tunnel_alloc_dp() for @callback. | |
| 1588 | + | * tunnel. | |
| 1600 | 1589 | * | |
| 1601 | 1590 | * Return: Pointer to &struct tb_tunnel or %NULL if no tunnel found. | |
| 1602 | 1591 | */ | |
| 1603 | 1592 | struct tb_tunnel *tb_tunnel_discover_dp(struct tb *tb, struct tb_port *in, | |
| 1604 | - | bool alloc_hopid, | |
| 1605 | - | void (*callback)(struct tb_tunnel *, void *), | |
| 1606 | - | void *callback_data) | |
| 1593 | + | bool alloc_hopid) | |
| 1607 | 1594 | { | |
| 1608 | 1595 | struct tb_tunnel *tunnel; | |
| 1609 | 1596 | struct tb_port *port; | |
| 1610 | 1597 | struct tb_path *path; | |
| 1611 | 1598 | ||
| 1612 | - | if (WARN_ON(!callback)) | |
| 1613 | - | return NULL; | |
| 1614 | - | ||
| 1615 | 1599 | if (!tb_dp_port_is_enabled(in)) | |
| 1616 | 1600 | return NULL; | |
| 1617 | 1601 | ||
| @@ -1627,9 +1611,6 @@ struct tb_tunnel *tb_tunnel_discover_dp(struct tb *tb, struct tb_port *in, | |||
| 1627 | 1611 | tunnel->alloc_bandwidth = tb_dp_alloc_bandwidth; | |
| 1628 | 1612 | tunnel->consumed_bandwidth = tb_dp_consumed_bandwidth; | |
| 1629 | 1613 | tunnel->src_port = in; | |
| 1630 | - | tunnel->callback = callback; | |
| 1631 | - | tunnel->callback_data = callback_data; | |
| 1632 | - | INIT_DELAYED_WORK(&tunnel->dprx_work, tb_dp_dprx_work); | |
| 1633 | 1614 | ||
| 1634 | 1615 | path = tb_path_discover(in, TB_DP_VIDEO_HOPID, NULL, -1, | |
| 1635 | 1616 | &tunnel->dst_port, "Video", alloc_hopid); | |
| @@ -1675,7 +1656,6 @@ struct tb_tunnel *tb_tunnel_discover_dp(struct tb *tb, struct tb_port *in, | |||
| 1675 | 1656 | ||
| 1676 | 1657 | tb_dp_dump(tunnel); | |
| 1677 | 1658 | ||
| 1678 | - | tb_tunnel_set_active(tunnel, true); | |
| 1679 | 1659 | tb_tunnel_dbg(tunnel, "discovered\n"); | |
| 1680 | 1660 | return tunnel; | |
| 1681 | 1661 | ||
| @@ -1697,16 +1677,16 @@ err_free: | |||
| 1697 | 1677 | * %0 if no available bandwidth. | |
| 1698 | 1678 | * @max_down: Maximum available downstream bandwidth for the DP tunnel. | |
| 1699 | 1679 | * %0 if no available bandwidth. | |
| 1700 | - | * @callback: Callback that is called when the DP tunnel is fully | |
| 1701 | - | * activated (or there is an error) | |
| 1702 | - | * @callback_data: Data for @callback | |
| 1680 | + | * @callback: Optional callback that is called when the DP tunnel is | |
| 1681 | + | * fully activated (or there is an error) | |
| 1682 | + | * @callback_data: Optional data for @callback | |
| 1703 | 1683 | * | |
| 1704 | 1684 | * Allocates a tunnel between @in and @out that is capable of tunneling | |
| 1705 | - | * Display Port traffic. The @callback is called after tb_tunnel_activate() | |
| 1706 | - | * once the tunnel has been fully activated. It can call | |
| 1707 | - | * tb_tunnel_is_active() to check if activation was successful (or if it | |
| 1708 | - | * returns %false there was some sort of issue). The @callback is called | |
| 1709 | - | * without @tb->lock held. | |
| 1685 | + | * Display Port traffic. If @callback is not %NULL it will be called | |
| 1686 | + | * after tb_tunnel_activate() once the tunnel has been fully activated. | |
| 1687 | + | * It can call tb_tunnel_is_active() to check if activation was | |
| 1688 | + | * successful (or if it returns %false there was some sort of issue). | |
| 1689 | + | * The @callback is called without @tb->lock held. | |
| 1710 | 1690 | * | |
| 1711 | 1691 | * Return: Pointer to @struct tb_tunnel or %NULL in case of failure. | |
| 1712 | 1692 | */ | |
| @@ -1721,7 +1701,7 @@ struct tb_tunnel *tb_tunnel_alloc_dp(struct tb *tb, struct tb_port *in, | |||
| 1721 | 1701 | struct tb_path *path; | |
| 1722 | 1702 | bool pm_support; | |
| 1723 | 1703 | ||
| 1724 | - | if (WARN_ON(!in->cap_adap || !out->cap_adap || !callback)) | |
| 1704 | + | if (WARN_ON(!in->cap_adap || !out->cap_adap)) | |
| 1725 | 1705 | return NULL; | |
| 1726 | 1706 | ||
| 1727 | 1707 | tunnel = tb_tunnel_alloc(tb, 3, TB_TUNNEL_DP); | |
| @@ -2308,7 +2288,6 @@ struct tb_tunnel *tb_tunnel_discover_usb3(struct tb *tb, struct tb_port *down, | |||
| 2308 | 2288 | tb_usb3_reclaim_available_bandwidth; | |
| 2309 | 2289 | } | |
| 2310 | 2290 | ||
| 2311 | - | tb_tunnel_set_active(tunnel, true); | |
| 2312 | 2291 | tb_tunnel_dbg(tunnel, "discovered\n"); | |
| 2313 | 2292 | return tunnel; | |
| 2314 | 2293 | ||
modified drivers/thunderbolt/tunnel.h
| @@ -66,8 +66,8 @@ enum tb_tunnel_state { | |||
| 66 | 66 | * @dprx_canceled: Was DPRX capabilities read poll canceled | |
| 67 | 67 | * @dprx_timeout: If set DPRX capabilities read poll work will timeout after this passes | |
| 68 | 68 | * @dprx_work: Worker that is scheduled to poll completion of DPRX capabilities read | |
| 69 | - | * @callback: Callback called when DP tunnel is fully activated | |
| 70 | - | * @callback_data: Data for @callback | |
| 69 | + | * @callback: Optional callback called when DP tunnel is fully activated | |
| 70 | + | * @callback_data: Optional data for @callback | |
| 71 | 71 | * @paths: All paths required by the tunnel | |
| 72 | 72 | */ | |
| 73 | 73 | struct tb_tunnel { | |
| @@ -117,9 +117,7 @@ struct tb_tunnel *tb_tunnel_alloc_pci(struct tb *tb, struct tb_port *up, | |||
| 117 | 117 | bool tb_tunnel_reserved_pci(struct tb_port *port, int *reserved_up, | |
| 118 | 118 | int *reserved_down); | |
| 119 | 119 | struct tb_tunnel *tb_tunnel_discover_dp(struct tb *tb, struct tb_port *in, | |
| 120 | - | bool alloc_hopid, | |
| 121 | - | void (*callback)(struct tb_tunnel *, void *), | |
| 122 | - | void *callback_data); | |
| 120 | + | bool alloc_hopid); | |
| 123 | 121 | struct tb_tunnel *tb_tunnel_alloc_dp(struct tb *tb, struct tb_port *in, | |
| 124 | 122 | struct tb_port *out, int link_nr, | |
| 125 | 123 | int max_up, int max_down, | |
modified drivers/thunderbolt/xdomain.c
| @@ -377,10 +377,6 @@ static int tb_xdp_properties_request(struct tb_ctl *ctl, u64 route, | |||
| 377 | 377 | ||
| 378 | 378 | len += sizeof(res->hdr.xd_hdr) / 4; | |
| 379 | 379 | len -= sizeof(*res) / 4; | |
| 380 | - | if (len > TB_XDP_PROPERTIES_MAX_DATA_LENGTH) { | |
| 381 | - | ret = -EINVAL; | |
| 382 | - | goto err; | |
| 383 | - | } | |
| 384 | 380 | ||
| 385 | 381 | if (res->offset != req.offset) { | |
| 386 | 382 | ret = -EINVAL; | |
| @@ -1818,6 +1814,7 @@ static void tb_xdomain_state_work(struct work_struct *work) | |||
| 1818 | 1814 | tb_xdomain_failed(xd); | |
| 1819 | 1815 | } else { | |
| 1820 | 1816 | xd->state = XDOMAIN_STATE_ENUMERATED; | |
| 1817 | + | tb_xdomain_queue_properties_changed(xd); | |
| 1821 | 1818 | } | |
| 1822 | 1819 | break; | |
| 1823 | 1820 | ||
modified drivers/tty/amiserial.c
| @@ -1138,6 +1138,11 @@ static int rs_ioctl(struct tty_struct *tty, | |||
| 1138 | 1138 | local_irq_save(flags); | |
| 1139 | 1139 | cnow = info->icount; /* atomic copy */ | |
| 1140 | 1140 | local_irq_restore(flags); | |
| 1141 | + | if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr && | |
| 1142 | + | cnow.dcd == cprev.dcd && cnow.cts == cprev.cts) { | |
| 1143 | + | ret = -EIO; /* no change => error */ | |
| 1144 | + | break; | |
| 1145 | + | } | |
| 1141 | 1146 | if ( ((arg & TIOCM_RNG) && (cnow.rng != cprev.rng)) || | |
| 1142 | 1147 | ((arg & TIOCM_DSR) && (cnow.dsr != cprev.dsr)) || | |
| 1143 | 1148 | ((arg & TIOCM_CD) && (cnow.dcd != cprev.dcd)) || | |
| @@ -1145,10 +1150,6 @@ static int rs_ioctl(struct tty_struct *tty, | |||
| 1145 | 1150 | ret = 0; | |
| 1146 | 1151 | break; | |
| 1147 | 1152 | } | |
| 1148 | - | if (tty_io_error(tty)) { | |
| 1149 | - | ret = -EIO; | |
| 1150 | - | break; | |
| 1151 | - | } | |
| 1152 | 1153 | schedule(); | |
| 1153 | 1154 | /* see if a signal did it */ | |
| 1154 | 1155 | if (signal_pending(current)) { | |
modified drivers/tty/n_gsm.c
| @@ -454,13 +454,14 @@ static const u8 gsm_fcs8[256] = { | |||
| 454 | 454 | ||
| 455 | 455 | static void gsm_dlci_close(struct gsm_dlci *dlci); | |
| 456 | 456 | static int gsmld_output(struct gsm_mux *gsm, u8 *data, int len); | |
| 457 | - | static int gsm_modem_update(struct gsm_dlci *dlci, u8 brk, bool wait); | |
| 457 | + | static int gsm_modem_update(struct gsm_dlci *dlci, u8 brk); | |
| 458 | 458 | static struct gsm_msg *gsm_data_alloc(struct gsm_mux *gsm, u8 addr, int len, | |
| 459 | 459 | u8 ctrl); | |
| 460 | 460 | static int gsm_send_packet(struct gsm_mux *gsm, struct gsm_msg *msg); | |
| 461 | 461 | static struct gsm_dlci *gsm_dlci_alloc(struct gsm_mux *gsm, int addr); | |
| 462 | 462 | static void gsmld_write_trigger(struct gsm_mux *gsm); | |
| 463 | 463 | static void gsmld_write_task(struct work_struct *work); | |
| 464 | + | static int gsm_modem_send_initial_msc(struct gsm_dlci *dlci); | |
| 464 | 465 | ||
| 465 | 466 | /** | |
| 466 | 467 | * gsm_fcs_add - update FCS | |
| @@ -2173,7 +2174,7 @@ static void gsm_dlci_open(struct gsm_dlci *dlci) | |||
| 2173 | 2174 | pr_debug("DLCI %d goes open.\n", dlci->addr); | |
| 2174 | 2175 | /* Send current modem state */ | |
| 2175 | 2176 | if (dlci->addr) { | |
| 2176 | - | gsm_modem_update(dlci, 0, false); | |
| 2177 | + | gsm_modem_send_initial_msc(dlci); | |
| 2177 | 2178 | } else { | |
| 2178 | 2179 | /* Start keep-alive control */ | |
| 2179 | 2180 | gsm->ka_num = 0; | |
| @@ -4135,10 +4136,9 @@ static void gsm_modem_upd_via_data(struct gsm_dlci *dlci, u8 brk) | |||
| 4135 | 4136 | * gsm_modem_upd_via_msc - send modem bits via control frame | |
| 4136 | 4137 | * @dlci: channel | |
| 4137 | 4138 | * @brk: break signal | |
| 4138 | - | * @wait: wait for the MSC command | |
| 4139 | 4139 | */ | |
| 4140 | 4140 | ||
| 4141 | - | static int gsm_modem_upd_via_msc(struct gsm_dlci *dlci, u8 brk, bool wait) | |
| 4141 | + | static int gsm_modem_upd_via_msc(struct gsm_dlci *dlci, u8 brk) | |
| 4142 | 4142 | { | |
| 4143 | 4143 | u8 modembits[3]; | |
| 4144 | 4144 | struct gsm_control *ctrl; | |
| @@ -4155,22 +4155,41 @@ static int gsm_modem_upd_via_msc(struct gsm_dlci *dlci, u8 brk, bool wait) | |||
| 4155 | 4155 | modembits[2] = (brk << 4) | 2 | EA; /* Length, Break, EA */ | |
| 4156 | 4156 | len++; | |
| 4157 | 4157 | } | |
| 4158 | - | if (!wait) | |
| 4159 | - | return gsm_control_command(dlci->gsm, CMD_MSC, modembits, len); | |
| 4160 | 4158 | ctrl = gsm_control_send(dlci->gsm, CMD_MSC, modembits, len); | |
| 4161 | 4159 | if (ctrl == NULL) | |
| 4162 | 4160 | return -ENOMEM; | |
| 4163 | 4161 | return gsm_control_wait(dlci->gsm, ctrl); | |
| 4164 | 4162 | } | |
| 4165 | 4163 | ||
| 4164 | + | /** | |
| 4165 | + | * gsm_modem_send_initial_msc - Send initial modem status message | |
| 4166 | + | * | |
| 4167 | + | * @dlci: channel | |
| 4168 | + | * | |
| 4169 | + | * Send an initial MSC message after DLCI open to set the initial | |
| 4170 | + | * modem status lines. This is only done for basic mode. | |
| 4171 | + | * Does not wait for a response as we cannot block the input queue | |
| 4172 | + | * processing. | |
| 4173 | + | */ | |
| 4174 | + | static int gsm_modem_send_initial_msc(struct gsm_dlci *dlci) | |
| 4175 | + | { | |
| 4176 | + | u8 modembits[2]; | |
| 4177 | + | ||
| 4178 | + | if (dlci->adaption != 1 || dlci->gsm->encoding != GSM_BASIC_OPT) | |
| 4179 | + | return 0; | |
| 4180 | + | ||
| 4181 | + | modembits[0] = (dlci->addr << 2) | 2 | EA; /* DLCI, Valid, EA */ | |
| 4182 | + | modembits[1] = (gsm_encode_modem(dlci) << 1) | EA; | |
| 4183 | + | return gsm_control_command(dlci->gsm, CMD_MSC, (const u8 *)&modembits, 2); | |
| 4184 | + | } | |
| 4185 | + | ||
| 4166 | 4186 | /** | |
| 4167 | 4187 | * gsm_modem_update - send modem status line state | |
| 4168 | 4188 | * @dlci: channel | |
| 4169 | 4189 | * @brk: break signal | |
| 4170 | - | * @wait: wait for the MSC command | |
| 4171 | 4190 | */ | |
| 4172 | 4191 | ||
| 4173 | - | static int gsm_modem_update(struct gsm_dlci *dlci, u8 brk, bool wait) | |
| 4192 | + | static int gsm_modem_update(struct gsm_dlci *dlci, u8 brk) | |
| 4174 | 4193 | { | |
| 4175 | 4194 | if (dlci->gsm->dead) | |
| 4176 | 4195 | return -EL2HLT; | |
| @@ -4180,7 +4199,7 @@ static int gsm_modem_update(struct gsm_dlci *dlci, u8 brk, bool wait) | |||
| 4180 | 4199 | return 0; | |
| 4181 | 4200 | } else if (dlci->gsm->encoding == GSM_BASIC_OPT) { | |
| 4182 | 4201 | /* Send as MSC control message. */ | |
| 4183 | - | return gsm_modem_upd_via_msc(dlci, brk, wait); | |
| 4202 | + | return gsm_modem_upd_via_msc(dlci, brk); | |
| 4184 | 4203 | } | |
| 4185 | 4204 | ||
| 4186 | 4205 | /* Modem status lines are not supported. */ | |
| @@ -4246,7 +4265,7 @@ static void gsm_dtr_rts(struct tty_port *port, bool active) | |||
| 4246 | 4265 | modem_tx &= ~(TIOCM_DTR | TIOCM_RTS); | |
| 4247 | 4266 | if (modem_tx != dlci->modem_tx) { | |
| 4248 | 4267 | dlci->modem_tx = modem_tx; | |
| 4249 | - | gsm_modem_update(dlci, 0, true); | |
| 4268 | + | gsm_modem_update(dlci, 0); | |
| 4250 | 4269 | } | |
| 4251 | 4270 | } | |
| 4252 | 4271 | ||
| @@ -4452,7 +4471,7 @@ static int gsmtty_tiocmset(struct tty_struct *tty, | |||
| 4452 | 4471 | ||
| 4453 | 4472 | if (modem_tx != dlci->modem_tx) { | |
| 4454 | 4473 | dlci->modem_tx = modem_tx; | |
| 4455 | - | return gsm_modem_update(dlci, 0, true); | |
| 4474 | + | return gsm_modem_update(dlci, 0); | |
| 4456 | 4475 | } | |
| 4457 | 4476 | return 0; | |
| 4458 | 4477 | } | |
| @@ -4534,7 +4553,7 @@ static void gsmtty_throttle(struct tty_struct *tty) | |||
| 4534 | 4553 | dlci->modem_tx &= ~TIOCM_RTS; | |
| 4535 | 4554 | dlci->throttled = true; | |
| 4536 | 4555 | /* Send an MSC with RTS cleared */ | |
| 4537 | - | gsm_modem_update(dlci, 0, true); | |
| 4556 | + | gsm_modem_update(dlci, 0); | |
| 4538 | 4557 | } | |
| 4539 | 4558 | ||
| 4540 | 4559 | static void gsmtty_unthrottle(struct tty_struct *tty) | |
| @@ -4546,7 +4565,7 @@ static void gsmtty_unthrottle(struct tty_struct *tty) | |||
| 4546 | 4565 | dlci->modem_tx |= TIOCM_RTS; | |
| 4547 | 4566 | dlci->throttled = false; | |
| 4548 | 4567 | /* Send an MSC with RTS set */ | |
| 4549 | - | gsm_modem_update(dlci, 0, true); | |
| 4568 | + | gsm_modem_update(dlci, 0); | |
| 4550 | 4569 | } | |
| 4551 | 4570 | ||
| 4552 | 4571 | static int gsmtty_break_ctl(struct tty_struct *tty, int state) | |
| @@ -4564,7 +4583,7 @@ static int gsmtty_break_ctl(struct tty_struct *tty, int state) | |||
| 4564 | 4583 | if (encode > 0x0F) | |
| 4565 | 4584 | encode = 0x0F; /* Best effort */ | |
| 4566 | 4585 | } | |
| 4567 | - | return gsm_modem_update(dlci, encode, true); | |
| 4586 | + | return gsm_modem_update(dlci, encode); | |
| 4568 | 4587 | } | |
| 4569 | 4588 | ||
| 4570 | 4589 | static void gsmtty_cleanup(struct tty_struct *tty) | |
modified drivers/tty/serial/8250/8250_bcm7271.c
| @@ -1121,8 +1121,8 @@ static void brcmuart_remove(struct platform_device *pdev) | |||
| 1121 | 1121 | struct brcmuart_priv *priv = platform_get_drvdata(pdev); | |
| 1122 | 1122 | ||
| 1123 | 1123 | debugfs_remove_recursive(priv->debugfs_dir); | |
| 1124 | - | serial8250_unregister_port(priv->line); | |
| 1125 | 1124 | hrtimer_cancel(&priv->hrt); | |
| 1125 | + | serial8250_unregister_port(priv->line); | |
| 1126 | 1126 | brcmuart_free_bufs(&pdev->dev, priv); | |
| 1127 | 1127 | if (priv->dma_enabled) | |
| 1128 | 1128 | brcmuart_arbitration(priv, 0); | |
modified drivers/tty/serial/8250/8250_omap.c
| @@ -711,6 +711,12 @@ static int omap_8250_startup(struct uart_port *port) | |||
| 711 | 711 | struct uart_8250_dma *dma = &priv->omap8250_dma; | |
| 712 | 712 | int ret; | |
| 713 | 713 | ||
| 714 | + | if (priv->wakeirq) { | |
| 715 | + | ret = dev_pm_set_dedicated_wake_irq(port->dev, priv->wakeirq); | |
| 716 | + | if (ret) | |
| 717 | + | return ret; | |
| 718 | + | } | |
| 719 | + | ||
| 714 | 720 | #ifdef CONFIG_PM | |
| 715 | 721 | up->capabilities |= UART_CAP_RPM; | |
| 716 | 722 | #endif | |
| @@ -781,6 +787,7 @@ static void omap_8250_shutdown(struct uart_port *port) | |||
| 781 | 787 | } | |
| 782 | 788 | ||
| 783 | 789 | disable_irq_nosync(port->irq); | |
| 790 | + | dev_pm_clear_wake_irq(port->dev); | |
| 784 | 791 | ||
| 785 | 792 | serial8250_release_dma(up); | |
| 786 | 793 | up->dma = NULL; | |
| @@ -1581,12 +1588,6 @@ static int omap8250_probe(struct platform_device *pdev) | |||
| 1581 | 1588 | ||
| 1582 | 1589 | priv->wakeirq = irq_of_parse_and_map(np, 1); | |
| 1583 | 1590 | ||
| 1584 | - | if (priv->wakeirq) { | |
| 1585 | - | ret = dev_pm_set_dedicated_wake_irq(&pdev->dev, priv->wakeirq); | |
| 1586 | - | if (ret) | |
| 1587 | - | goto err; | |
| 1588 | - | } | |
| 1589 | - | ||
| 1590 | 1591 | ret = serial8250_register_8250_port(&up); | |
| 1591 | 1592 | if (ret < 0) { | |
| 1592 | 1593 | dev_err(&pdev->dev, "unable to register 8250 port\n"); | |
| @@ -1602,7 +1603,6 @@ static int omap8250_probe(struct platform_device *pdev) | |||
| 1602 | 1603 | ||
| 1603 | 1604 | return 0; | |
| 1604 | 1605 | err: | |
| 1605 | - | dev_pm_clear_wake_irq(&pdev->dev); | |
| 1606 | 1606 | pm_runtime_dont_use_autosuspend(&pdev->dev); | |
| 1607 | 1607 | pm_runtime_put_sync(&pdev->dev); | |
| 1608 | 1608 | flush_work(&priv->qos_work); | |
| @@ -1625,7 +1625,6 @@ static void omap8250_remove(struct platform_device *pdev) | |||
| 1625 | 1625 | omap_8250_shutdown(&up->port); | |
| 1626 | 1626 | serial8250_unregister_port(priv->line); | |
| 1627 | 1627 | priv->line = -ENODEV; | |
| 1628 | - | dev_pm_clear_wake_irq(&pdev->dev); | |
| 1629 | 1628 | pm_runtime_dont_use_autosuspend(&pdev->dev); | |
| 1630 | 1629 | pm_runtime_put_sync(&pdev->dev); | |
| 1631 | 1630 | flush_work(&priv->qos_work); | |
modified drivers/tty/serial/8250/8250_port.c
| @@ -3417,11 +3417,8 @@ static void __serial8250_console_write(struct uart_8250_port *up, | |||
| 3417 | 3417 | * If the console printer did not fully output the previous line, it | |
| 3418 | 3418 | * must have been handed or taken over. Insert a newline in order to | |
| 3419 | 3419 | * maintain clean output. | |
| 3420 | - | * | |
| 3421 | - | * Braille consoles are an exception. The serial port is not used | |
| 3422 | - | * for printk(). The driver is supposed to write exactly what it gets. | |
| 3423 | 3420 | */ | |
| 3424 | - | if (unlikely(!up->console_line_ended && !nbcon_write_context_is_braille(wctxt))) { | |
| 3421 | + | if (!up->console_line_ended) { | |
| 3425 | 3422 | if (use_fifo) | |
| 3426 | 3423 | __serial8250_console_fifo_write(up, wctxt, "\n", 1); | |
| 3427 | 3424 | else | |
| @@ -3600,7 +3597,7 @@ int serial8250_console_setup(struct uart_port *port, char *options, bool probe) | |||
| 3600 | 3597 | ||
| 3601 | 3598 | up->console_line_ended = true; | |
| 3602 | 3599 | up->console_msr_work_allow = true; | |
| 3603 | - | up->console_msr_work = IRQ_WORK_INIT_LAZY(console_msr_handler); | |
| 3600 | + | init_irq_work(&up->console_msr_work, console_msr_handler); | |
| 3604 | 3601 | ||
| 3605 | 3602 | if (options) | |
| 3606 | 3603 | uart_parse_options(options, &baud, &parity, &bits, &flow); | |
modified drivers/tty/serial/amba-pl011.c
| @@ -2656,7 +2656,7 @@ pl011_console_write_atomic(struct console *co, struct nbcon_write_context *wctxt | |||
| 2656 | 2656 | uap, REG_CR); | |
| 2657 | 2657 | } | |
| 2658 | 2658 | ||
| 2659 | - | if (unlikely(!uap->console_line_ended && !nbcon_is_braille(co))) | |
| 2659 | + | if (!uap->console_line_ended) | |
| 2660 | 2660 | uart_console_write(&uap->port, "\n", 1, pl011_console_putchar); | |
| 2661 | 2661 | uart_console_write(&uap->port, wctxt->outbuf, wctxt->len, pl011_console_putchar); | |
| 2662 | 2662 | ||
modified drivers/tty/serial/imx.c
| @@ -2136,7 +2136,7 @@ static void imx_uart_console_write_atomic(struct console *co, | |||
| 2136 | 2136 | imx_uart_writel(sport, ucr1, UCR1); | |
| 2137 | 2137 | imx_uart_writel(sport, old_ucr.ucr2 | UCR2_TXEN, UCR2); | |
| 2138 | 2138 | ||
| 2139 | - | if (unlikely(!sport->last_putchar_was_newline && !nbcon_is_braille(co))) | |
| 2139 | + | if (!sport->last_putchar_was_newline) | |
| 2140 | 2140 | uart_console_write(port, "\n", 1, imx_uart_console_putchar); | |
| 2141 | 2141 | uart_console_write(port, wctxt->outbuf, wctxt->len, | |
| 2142 | 2142 | imx_uart_console_putchar); | |
modified drivers/tty/serial/kgdboc.c
| @@ -188,11 +188,6 @@ static void cleanup_kgdboc(void) | |||
| 188 | 188 | ||
| 189 | 189 | kgdboc_unregister_kbd(); | |
| 190 | 190 | kgdb_unregister_io_module(&kgdboc_io_ops); | |
| 191 | - | ||
| 192 | - | if (kgdb_tty_driver) { | |
| 193 | - | tty_driver_kref_put(kgdb_tty_driver); | |
| 194 | - | kgdb_tty_driver = NULL; | |
| 195 | - | } | |
| 196 | 191 | } | |
| 197 | 192 | ||
| 198 | 193 | static int configure_kgdboc(void) | |
| @@ -259,10 +254,6 @@ do_register: | |||
| 259 | 254 | ||
| 260 | 255 | noconfig: | |
| 261 | 256 | kgdboc_unregister_kbd(); | |
| 262 | - | if (kgdb_tty_driver) { | |
| 263 | - | tty_driver_kref_put(kgdb_tty_driver); | |
| 264 | - | kgdb_tty_driver = NULL; | |
| 265 | - | } | |
| 266 | 257 | configured = 0; | |
| 267 | 258 | ||
| 268 | 259 | return err; | |
modified drivers/tty/serial/ma35d1_serial.c
| @@ -728,7 +728,7 @@ static int ma35d1serial_probe(struct platform_device *pdev) | |||
| 728 | 728 | ||
| 729 | 729 | ret = clk_prepare_enable(up->clk); | |
| 730 | 730 | if (ret) | |
| 731 | - | goto err_put_clk; | |
| 731 | + | goto err_iounmap; | |
| 732 | 732 | ||
| 733 | 733 | if (up->port.line != 0) | |
| 734 | 734 | up->port.uartclk = clk_get_rate(up->clk); | |
| @@ -755,9 +755,6 @@ err_free_irq: | |||
| 755 | 755 | err_clk_disable: | |
| 756 | 756 | clk_disable_unprepare(up->clk); | |
| 757 | 757 | ||
| 758 | - | err_put_clk: | |
| 759 | - | clk_put(up->clk); | |
| 760 | - | ||
| 761 | 758 | err_iounmap: | |
| 762 | 759 | iounmap(up->port.membase); | |
| 763 | 760 | return ret; | |
| @@ -773,7 +770,6 @@ static void ma35d1serial_remove(struct platform_device *dev) | |||
| 773 | 770 | ||
| 774 | 771 | uart_remove_one_port(&ma35d1serial_reg, port); | |
| 775 | 772 | clk_disable_unprepare(up->clk); | |
| 776 | - | clk_put(up->clk); | |
| 777 | 773 | } | |
| 778 | 774 | ||
| 779 | 775 | static int ma35d1serial_suspend(struct platform_device *dev, pm_message_t state) | |
modified drivers/tty/serial/max3100.c
| @@ -535,11 +535,11 @@ static void max3100_shutdown(struct uart_port *port) | |||
| 535 | 535 | timer_delete_sync(&s->timer); | |
| 536 | 536 | ||
| 537 | 537 | if (s->workqueue) { | |
| 538 | - | free_irq(port->irq, s); | |
| 539 | - | cancel_work_sync(&s->work); | |
| 540 | 538 | destroy_workqueue(s->workqueue); | |
| 541 | 539 | s->workqueue = NULL; | |
| 542 | 540 | } | |
| 541 | + | if (port->irq) | |
| 542 | + | free_irq(port->irq, s); | |
| 543 | 543 | ||
| 544 | 544 | /* set shutdown mode to save power */ | |
| 545 | 545 | max3100_sr(s, MAX3100_WC | MAX3100_SHDN, &rx); | |
| @@ -753,15 +753,6 @@ static void max3100_remove(struct spi_device *spi) | |||
| 753 | 753 | if (max3100s[i] == s) { | |
| 754 | 754 | dev_dbg(&spi->dev, "%s: removing port %d\n", __func__, i); | |
| 755 | 755 | uart_remove_one_port(&max3100_uart_driver, &max3100s[i]->port); | |
| 756 | - | ||
| 757 | - | s->force_end_work = 1; | |
| 758 | - | timer_shutdown_sync(&s->timer); | |
| 759 | - | if (s->workqueue) { | |
| 760 | - | free_irq(s->port.irq, s); | |
| 761 | - | cancel_work_sync(&s->work); | |
| 762 | - | destroy_workqueue(s->workqueue); | |
| 763 | - | s->workqueue = NULL; | |
| 764 | - | } | |
| 765 | 756 | kfree(max3100s[i]); | |
| 766 | 757 | max3100s[i] = NULL; | |
| 767 | 758 | break; | |
modified drivers/tty/serial/mpc52xx_uart.c
| @@ -634,9 +634,6 @@ static void __exit mpc512x_psc_fifoc_uninit(void) | |||
| 634 | 634 | } | |
| 635 | 635 | } | |
| 636 | 636 | ||
| 637 | - | static struct clk *psc_mclk_clk[MPC52xx_PSC_MAXNUM]; | |
| 638 | - | static struct clk *psc_ipg_clk[MPC52xx_PSC_MAXNUM]; | |
| 639 | - | ||
| 640 | 637 | /* 512x specific interrupt handler. The caller holds the port lock */ | |
| 641 | 638 | static irqreturn_t mpc512x_psc_handle_irq(struct uart_port *port) | |
| 642 | 639 | { | |
| @@ -657,6 +654,9 @@ static irqreturn_t mpc512x_psc_handle_irq(struct uart_port *port) | |||
| 657 | 654 | return IRQ_NONE; | |
| 658 | 655 | } | |
| 659 | 656 | ||
| 657 | + | static struct clk *psc_mclk_clk[MPC52xx_PSC_MAXNUM]; | |
| 658 | + | static struct clk *psc_ipg_clk[MPC52xx_PSC_MAXNUM]; | |
| 659 | + | ||
| 660 | 660 | /* called from within the .request_port() callback (allocation) */ | |
| 661 | 661 | static int mpc512x_psc_alloc_clock(struct uart_port *port) | |
| 662 | 662 | { | |
modified drivers/tty/serial/qcom_geni_serial.c
| @@ -171,6 +171,7 @@ static void qcom_geni_serial_cancel_tx_cmd(struct uart_port *uport); | |||
| 171 | 171 | static int qcom_geni_serial_port_setup(struct uart_port *uport); | |
| 172 | 172 | static void qcom_geni_serial_start_tx_fifo(struct uart_port *uport); | |
| 173 | 173 | static void qcom_geni_serial_resume_tx(struct uart_port *uport); | |
| 174 | + | static void qcom_geni_serial_poll_rx_fifo_locked(struct uart_port *uport); | |
| 174 | 175 | ||
| 175 | 176 | static inline struct qcom_geni_serial_port *to_dev_port(struct uart_port *uport) | |
| 176 | 177 | { | |
| @@ -466,102 +467,6 @@ static int qcom_geni_serial_poll_init(struct uart_port *uport) | |||
| 466 | 467 | #endif | |
| 467 | 468 | ||
| 468 | 469 | #ifdef CONFIG_SERIAL_QCOM_GENI_CONSOLE | |
| 469 | - | static void handle_rx_console(struct uart_port *uport, u32 bytes, bool drop) | |
| 470 | - | { | |
| 471 | - | u32 i; | |
| 472 | - | unsigned char buf[sizeof(u32)]; | |
| 473 | - | struct tty_port *tport; | |
| 474 | - | struct qcom_geni_serial_port *port = to_dev_port(uport); | |
| 475 | - | ||
| 476 | - | tport = &uport->state->port; | |
| 477 | - | for (i = 0; i < bytes; ) { | |
| 478 | - | int c; | |
| 479 | - | int chunk = min_t(int, bytes - i, BYTES_PER_FIFO_WORD); | |
| 480 | - | ||
| 481 | - | ioread32_rep(uport->membase + SE_GENI_RX_FIFOn, buf, 1); | |
| 482 | - | i += chunk; | |
| 483 | - | if (drop) | |
| 484 | - | continue; | |
| 485 | - | ||
| 486 | - | for (c = 0; c < chunk; c++) { | |
| 487 | - | int sysrq; | |
| 488 | - | ||
| 489 | - | uport->icount.rx++; | |
| 490 | - | if (port->brk && buf[c] == 0) { | |
| 491 | - | port->brk = false; | |
| 492 | - | if (uart_handle_break(uport)) | |
| 493 | - | continue; | |
| 494 | - | } | |
| 495 | - | ||
| 496 | - | sysrq = uart_prepare_sysrq_char(uport, buf[c]); | |
| 497 | - | ||
| 498 | - | if (!sysrq) | |
| 499 | - | tty_insert_flip_char(tport, buf[c], TTY_NORMAL); | |
| 500 | - | } | |
| 501 | - | } | |
| 502 | - | if (!drop) | |
| 503 | - | tty_flip_buffer_push(tport); | |
| 504 | - | } | |
| 505 | - | #else | |
| 506 | - | static void handle_rx_console(struct uart_port *uport, u32 bytes, bool drop) | |
| 507 | - | { | |
| 508 | - | ||
| 509 | - | } | |
| 510 | - | #endif | |
| 511 | - | ||
| 512 | - | static void qcom_geni_serial_handle_rx_fifo(struct uart_port *uport, bool drop) | |
| 513 | - | { | |
| 514 | - | u32 status; | |
| 515 | - | u32 word_cnt; | |
| 516 | - | u32 last_word_byte_cnt; | |
| 517 | - | u32 last_word_partial; | |
| 518 | - | u32 total_bytes; | |
| 519 | - | ||
| 520 | - | status = readl(uport->membase + SE_GENI_RX_FIFO_STATUS); | |
| 521 | - | word_cnt = status & RX_FIFO_WC_MSK; | |
| 522 | - | last_word_partial = status & RX_LAST; | |
| 523 | - | last_word_byte_cnt = (status & RX_LAST_BYTE_VALID_MSK) >> | |
| 524 | - | RX_LAST_BYTE_VALID_SHFT; | |
| 525 | - | ||
| 526 | - | if (!word_cnt) | |
| 527 | - | return; | |
| 528 | - | total_bytes = BYTES_PER_FIFO_WORD * (word_cnt - 1); | |
| 529 | - | if (last_word_partial && last_word_byte_cnt) | |
| 530 | - | total_bytes += last_word_byte_cnt; | |
| 531 | - | else | |
| 532 | - | total_bytes += BYTES_PER_FIFO_WORD; | |
| 533 | - | handle_rx_console(uport, total_bytes, drop); | |
| 534 | - | } | |
| 535 | - | ||
| 536 | - | #ifdef CONFIG_SERIAL_QCOM_GENI_CONSOLE | |
| 537 | - | /* Caller holds the UART port lock. */ | |
| 538 | - | static void qcom_geni_serial_poll_rx_fifo_locked(struct uart_port *uport) | |
| 539 | - | { | |
| 540 | - | struct qcom_geni_serial_port *port = to_dev_port(uport); | |
| 541 | - | struct tty_port *tport = &uport->state->port; | |
| 542 | - | u32 s_irq_status; | |
| 543 | - | bool drop_rx = false; | |
| 544 | - | ||
| 545 | - | s_irq_status = readl(uport->membase + SE_GENI_S_IRQ_STATUS); | |
| 546 | - | writel(s_irq_status, uport->membase + SE_GENI_S_IRQ_CLEAR); | |
| 547 | - | ||
| 548 | - | if (s_irq_status & S_RX_FIFO_WR_ERR_EN) { | |
| 549 | - | uport->icount.overrun++; | |
| 550 | - | tty_insert_flip_char(tport, 0, TTY_OVERRUN); | |
| 551 | - | } | |
| 552 | - | ||
| 553 | - | if (s_irq_status & (S_GP_IRQ_0_EN | S_GP_IRQ_1_EN)) { | |
| 554 | - | if (s_irq_status & S_GP_IRQ_0_EN) | |
| 555 | - | uport->icount.parity++; | |
| 556 | - | drop_rx = true; | |
| 557 | - | } else if (s_irq_status & (S_GP_IRQ_2_EN | S_GP_IRQ_3_EN)) { | |
| 558 | - | uport->icount.brk++; | |
| 559 | - | port->brk = true; | |
| 560 | - | } | |
| 561 | - | ||
| 562 | - | qcom_geni_serial_handle_rx_fifo(uport, drop_rx); | |
| 563 | - | } | |
| 564 | - | ||
| 565 | 470 | static void qcom_geni_serial_drain_fifo(struct uart_port *uport) | |
| 566 | 471 | { | |
| 567 | 472 | struct qcom_geni_serial_port *port = to_dev_port(uport); | |
| @@ -771,6 +676,47 @@ static void qcom_geni_serial_console_device_unlock(struct console *co, | |||
| 771 | 676 | #endif | |
| 772 | 677 | } | |
| 773 | 678 | ||
| 679 | + | static void handle_rx_console(struct uart_port *uport, u32 bytes, bool drop) | |
| 680 | + | { | |
| 681 | + | u32 i; | |
| 682 | + | unsigned char buf[sizeof(u32)]; | |
| 683 | + | struct tty_port *tport; | |
| 684 | + | struct qcom_geni_serial_port *port = to_dev_port(uport); | |
| 685 | + | ||
| 686 | + | tport = &uport->state->port; | |
| 687 | + | for (i = 0; i < bytes; ) { | |
| 688 | + | int c; | |
| 689 | + | int chunk = min_t(int, bytes - i, BYTES_PER_FIFO_WORD); | |
| 690 | + | ||
| 691 | + | ioread32_rep(uport->membase + SE_GENI_RX_FIFOn, buf, 1); | |
| 692 | + | i += chunk; | |
| 693 | + | if (drop) | |
| 694 | + | continue; | |
| 695 | + | ||
| 696 | + | for (c = 0; c < chunk; c++) { | |
| 697 | + | int sysrq; | |
| 698 | + | ||
| 699 | + | uport->icount.rx++; | |
| 700 | + | if (port->brk && buf[c] == 0) { | |
| 701 | + | port->brk = false; | |
| 702 | + | if (uart_handle_break(uport)) | |
| 703 | + | continue; | |
| 704 | + | } | |
| 705 | + | ||
| 706 | + | sysrq = uart_prepare_sysrq_char(uport, buf[c]); | |
| 707 | + | ||
| 708 | + | if (!sysrq) | |
| 709 | + | tty_insert_flip_char(tport, buf[c], TTY_NORMAL); | |
| 710 | + | } | |
| 711 | + | } | |
| 712 | + | if (!drop) | |
| 713 | + | tty_flip_buffer_push(tport); | |
| 714 | + | } | |
| 715 | + | #else | |
| 716 | + | static void handle_rx_console(struct uart_port *uport, u32 bytes, bool drop) | |
| 717 | + | { | |
| 718 | + | ||
| 719 | + | } | |
| 774 | 720 | #endif /* CONFIG_SERIAL_QCOM_GENI_CONSOLE */ | |
| 775 | 721 | ||
| 776 | 722 | static void handle_rx_uart(struct uart_port *uport, u32 bytes) | |
| @@ -944,6 +890,58 @@ static void qcom_geni_serial_cancel_tx_cmd(struct uart_port *uport) | |||
| 944 | 890 | port->tx_queued = 0; | |
| 945 | 891 | } | |
| 946 | 892 | ||
| 893 | + | static void qcom_geni_serial_handle_rx_fifo(struct uart_port *uport, bool drop) | |
| 894 | + | { | |
| 895 | + | u32 status; | |
| 896 | + | u32 word_cnt; | |
| 897 | + | u32 last_word_byte_cnt; | |
| 898 | + | u32 last_word_partial; | |
| 899 | + | u32 total_bytes; | |
| 900 | + | ||
| 901 | + | status = readl(uport->membase + SE_GENI_RX_FIFO_STATUS); | |
| 902 | + | word_cnt = status & RX_FIFO_WC_MSK; | |
| 903 | + | last_word_partial = status & RX_LAST; | |
| 904 | + | last_word_byte_cnt = (status & RX_LAST_BYTE_VALID_MSK) >> | |
| 905 | + | RX_LAST_BYTE_VALID_SHFT; | |
| 906 | + | ||
| 907 | + | if (!word_cnt) | |
| 908 | + | return; | |
| 909 | + | total_bytes = BYTES_PER_FIFO_WORD * (word_cnt - 1); | |
| 910 | + | if (last_word_partial && last_word_byte_cnt) | |
| 911 | + | total_bytes += last_word_byte_cnt; | |
| 912 | + | else | |
| 913 | + | total_bytes += BYTES_PER_FIFO_WORD; | |
| 914 | + | handle_rx_console(uport, total_bytes, drop); | |
| 915 | + | } | |
| 916 | + | ||
| 917 | + | /* Caller holds the UART port lock. */ | |
| 918 | + | static void qcom_geni_serial_poll_rx_fifo_locked(struct uart_port *uport) | |
| 919 | + | { | |
| 920 | + | struct qcom_geni_serial_port *port = to_dev_port(uport); | |
| 921 | + | struct tty_port *tport = &uport->state->port; | |
| 922 | + | u32 s_irq_status; | |
| 923 | + | bool drop_rx = false; | |
| 924 | + | ||
| 925 | + | s_irq_status = readl(uport->membase + SE_GENI_S_IRQ_STATUS); | |
| 926 | + | writel(s_irq_status, uport->membase + SE_GENI_S_IRQ_CLEAR); | |
| 927 | + | ||
| 928 | + | if (s_irq_status & S_RX_FIFO_WR_ERR_EN) { | |
| 929 | + | uport->icount.overrun++; | |
| 930 | + | tty_insert_flip_char(tport, 0, TTY_OVERRUN); | |
| 931 | + | } | |
| 932 | + | ||
| 933 | + | if (s_irq_status & (S_GP_IRQ_0_EN | S_GP_IRQ_1_EN)) { | |
| 934 | + | if (s_irq_status & S_GP_IRQ_0_EN) | |
| 935 | + | uport->icount.parity++; | |
| 936 | + | drop_rx = true; | |
| 937 | + | } else if (s_irq_status & (S_GP_IRQ_2_EN | S_GP_IRQ_3_EN)) { | |
| 938 | + | uport->icount.brk++; | |
| 939 | + | port->brk = true; | |
| 940 | + | } | |
| 941 | + | ||
| 942 | + | qcom_geni_serial_handle_rx_fifo(uport, drop_rx); | |
| 943 | + | } | |
| 944 | + | ||
| 947 | 945 | static void qcom_geni_serial_stop_rx_fifo(struct uart_port *uport) | |
| 948 | 946 | { | |
| 949 | 947 | u32 irq_en; | |
| @@ -1484,8 +1482,9 @@ static int geni_serial_set_rate(struct geni_se *se, unsigned long baud) | |||
| 1484 | 1482 | * Bump up BW vote on CPU and CORE path as driver supports FIFO mode | |
| 1485 | 1483 | * only. | |
| 1486 | 1484 | */ | |
| 1487 | - | avg_bw_core = baud > 115200 ? CORE_2X_50_MHZ : CORE_2X_19_2_MHZ; | |
| 1488 | - | port->se.icc_paths[GENI_TO_CORE].avg_bw = Bps_to_icc(avg_bw_core); | |
| 1485 | + | avg_bw_core = (baud > 115200) ? Bps_to_icc(CORE_2X_50_MHZ) | |
| 1486 | + | : GENI_DEFAULT_BW; | |
| 1487 | + | port->se.icc_paths[GENI_TO_CORE].avg_bw = avg_bw_core; | |
| 1489 | 1488 | port->se.icc_paths[CPU_TO_GENI].avg_bw = Bps_to_icc(baud); | |
| 1490 | 1489 | geni_icc_set_bw(&port->se); | |
| 1491 | 1490 | ||
| @@ -1626,37 +1625,16 @@ static int qcom_geni_console_setup(struct console *co, char *options) | |||
| 1626 | 1625 | if (unlikely(!uport->membase)) | |
| 1627 | 1626 | return -ENXIO; | |
| 1628 | 1627 | ||
| 1629 | - | ret = pm_runtime_resume_and_get(uport->dev); | |
| 1630 | - | if (ret < 0) | |
| 1631 | - | return ret; | |
| 1632 | - | ||
| 1633 | 1628 | if (!port->setup) { | |
| 1634 | 1629 | ret = qcom_geni_serial_port_setup(uport); | |
| 1635 | - | if (ret) { | |
| 1636 | - | pm_runtime_put_sync(uport->dev); | |
| 1630 | + | if (ret) | |
| 1637 | 1631 | return ret; | |
| 1638 | - | } | |
| 1639 | 1632 | } | |
| 1640 | 1633 | ||
| 1641 | 1634 | if (options) | |
| 1642 | 1635 | uart_parse_options(options, &baud, &parity, &bits, &flow); | |
| 1643 | 1636 | ||
| 1644 | - | ret = uart_set_options(uport, co, baud, parity, bits, flow); | |
| 1645 | - | if (ret) | |
| 1646 | - | pm_runtime_put_sync(uport->dev); | |
| 1647 | - | ||
| 1648 | - | return ret; | |
| 1649 | - | } | |
| 1650 | - | ||
| 1651 | - | static int qcom_geni_console_exit(struct console *co) | |
| 1652 | - | { | |
| 1653 | - | struct qcom_geni_serial_port *port; | |
| 1654 | - | ||
| 1655 | - | port = get_port_from_line(co->index, true, NULL); | |
| 1656 | - | if (IS_ERR(port)) | |
| 1657 | - | return PTR_ERR(port); | |
| 1658 | - | ||
| 1659 | - | return pm_runtime_put_sync(port->uport.dev); | |
| 1637 | + | return uart_set_options(uport, co, baud, parity, bits, flow); | |
| 1660 | 1638 | } | |
| 1661 | 1639 | ||
| 1662 | 1640 | static void qcom_geni_serial_earlycon_write(struct console *con, | |
| @@ -1773,7 +1751,6 @@ static struct console cons_ops = { | |||
| 1773 | 1751 | .device_unlock = qcom_geni_serial_console_device_unlock, | |
| 1774 | 1752 | .device = uart_console_device, | |
| 1775 | 1753 | .setup = qcom_geni_console_setup, | |
| 1776 | - | .exit = qcom_geni_console_exit, | |
| 1777 | 1754 | .flags = CON_PRINTBUFFER | CON_NBCON, | |
| 1778 | 1755 | .index = -1, | |
| 1779 | 1756 | .data = &qcom_geni_console_driver, | |
| @@ -2122,11 +2099,9 @@ static int qcom_geni_serial_resume(struct device *dev) | |||
| 2122 | 2099 | struct uart_port *uport = &port->uport; | |
| 2123 | 2100 | struct qcom_geni_private_data *private_data = uport->private_data; | |
| 2124 | 2101 | ||
| 2125 | - | if (console_suspend_enabled || !uart_console(uport)) { | |
| 2126 | - | ret = pm_runtime_force_resume(dev); | |
| 2127 | - | if (ret) | |
| 2128 | - | return ret; | |
| 2129 | - | } | |
| 2102 | + | ret = pm_runtime_force_resume(dev); | |
| 2103 | + | if (ret) | |
| 2104 | + | return ret; | |
| 2130 | 2105 | ||
| 2131 | 2106 | ret = uart_resume_port(private_data->drv, uport); | |
| 2132 | 2107 | if (uart_console(uport)) { | |
modified drivers/tty/serial/sc16is7xx.c
| @@ -216,8 +216,6 @@ | |||
| 216 | 216 | #define SC16IS7XX_TLR_TX_TRIGGER(words) ((((words) / 4) & 0x0f) << 0) | |
| 217 | 217 | #define SC16IS7XX_TLR_RX_TRIGGER(words) ((((words) / 4) & 0x0f) << 4) | |
| 218 | 218 | ||
| 219 | - | #define SC16IS7XX_TX_TRIGGER_LEVEL 32 | |
| 220 | - | ||
| 221 | 219 | /* IOControl register bits (Only 75x/76x) */ | |
| 222 | 220 | #define SC16IS7XX_IOCONTROL_LATCH_BIT BIT(0) /* Enable input latching */ | |
| 223 | 221 | #define SC16IS7XX_IOCONTROL_MODEM_A_BIT BIT(1) /* Enable GPIO[7:4] as modem A pins */ | |
| @@ -649,26 +647,12 @@ static void sc16is7xx_handle_rx(struct uart_port *port, unsigned int rxlen, | |||
| 649 | 647 | tty_flip_buffer_push(&port->state->port); | |
| 650 | 648 | } | |
| 651 | 649 | ||
| 652 | - | static unsigned int sc16is7xx_txlvl(struct uart_port *port) | |
| 653 | - | { | |
| 654 | - | unsigned int txlvl; | |
| 655 | - | ||
| 656 | - | txlvl = sc16is7xx_port_read(port, SC16IS7XX_TXLVL_REG); | |
| 657 | - | if (txlvl > SC16IS7XX_FIFO_SIZE) { | |
| 658 | - | dev_err_ratelimited(port->dev, | |
| 659 | - | "chip reports %u free bytes in TX FIFO, but it only has %u\n", | |
| 660 | - | txlvl, SC16IS7XX_FIFO_SIZE); | |
| 661 | - | return 0; | |
| 662 | - | } | |
| 663 | - | ||
| 664 | - | return txlvl; | |
| 665 | - | } | |
| 666 | - | ||
| 667 | 650 | static void sc16is7xx_handle_tx(struct uart_port *port) | |
| 668 | 651 | { | |
| 669 | 652 | struct tty_port *tport = &port->state->port; | |
| 670 | 653 | unsigned long flags; | |
| 671 | 654 | unsigned int txlen; | |
| 655 | + | unsigned char *tail; | |
| 672 | 656 | ||
| 673 | 657 | if (unlikely(port->x_char)) { | |
| 674 | 658 | sc16is7xx_port_write(port, SC16IS7XX_THR_REG, port->x_char); | |
| @@ -685,29 +669,18 @@ static void sc16is7xx_handle_tx(struct uart_port *port) | |||
| 685 | 669 | } | |
| 686 | 670 | ||
| 687 | 671 | /* Limit to space available in TX FIFO */ | |
| 688 | - | txlen = sc16is7xx_txlvl(port); | |
| 689 | - | ||
| 690 | - | /* Handle circular buffer wrap-around by sending multiple segments */ | |
| 691 | - | while (txlen > 0 && !kfifo_is_empty(&tport->xmit_fifo)) { | |
| 692 | - | unsigned char *tail; | |
| 693 | - | unsigned int to_send; | |
| 694 | - | ||
| 695 | - | to_send = kfifo_out_linear_ptr(&tport->xmit_fifo, &tail, txlen); | |
| 696 | - | if (!to_send) | |
| 697 | - | break; | |
| 698 | - | ||
| 699 | - | sc16is7xx_fifo_write(port, tail, to_send); | |
| 700 | - | uart_xmit_advance(port, to_send); | |
| 701 | - | ||
| 702 | - | if (kfifo_is_empty(&tport->xmit_fifo)) | |
| 703 | - | break; | |
| 704 | - | ||
| 705 | - | /* Refill below the trigger to enable the next THRI crossing. */ | |
| 706 | - | txlen = sc16is7xx_txlvl(port); | |
| 707 | - | if (txlen < SC16IS7XX_TX_TRIGGER_LEVEL) | |
| 708 | - | break; | |
| 672 | + | txlen = sc16is7xx_port_read(port, SC16IS7XX_TXLVL_REG); | |
| 673 | + | if (txlen > SC16IS7XX_FIFO_SIZE) { | |
| 674 | + | dev_err_ratelimited(port->dev, | |
| 675 | + | "chip reports %d free bytes in TX fifo, but it only has %d", | |
| 676 | + | txlen, SC16IS7XX_FIFO_SIZE); | |
| 677 | + | txlen = 0; | |
| 709 | 678 | } | |
| 710 | 679 | ||
| 680 | + | txlen = kfifo_out_linear_ptr(&tport->xmit_fifo, &tail, txlen); | |
| 681 | + | sc16is7xx_fifo_write(port, tail, txlen); | |
| 682 | + | uart_xmit_advance(port, txlen); | |
| 683 | + | ||
| 711 | 684 | uart_port_lock_irqsave(port, &flags); | |
| 712 | 685 | if (kfifo_len(&tport->xmit_fifo) < WAKEUP_CHARS) | |
| 713 | 686 | uart_write_wakeup(port); | |
| @@ -1157,10 +1130,6 @@ static int sc16is7xx_startup(struct uart_port *port) | |||
| 1157 | 1130 | SC16IS7XX_TCR_RX_RESUME(24) | | |
| 1158 | 1131 | SC16IS7XX_TCR_RX_HALT(48)); | |
| 1159 | 1132 | ||
| 1160 | - | /* Sync hardware and software TX trigger levels */ | |
| 1161 | - | sc16is7xx_port_write(port, SC16IS7XX_TLR_REG, | |
| 1162 | - | SC16IS7XX_TLR_TX_TRIGGER(SC16IS7XX_TX_TRIGGER_LEVEL)); | |
| 1163 | - | ||
| 1164 | 1133 | /* Disable TCR/TLR access */ | |
| 1165 | 1134 | sc16is7xx_port_update(port, SC16IS7XX_MCR_REG, SC16IS7XX_MCR_TCRTLR_BIT, 0); | |
| 1166 | 1135 | ||
modified drivers/tty/serial/serial-tegra.c
| @@ -306,19 +306,11 @@ static void tegra_uart_fifo_reset(struct tegra_uart_port *tup, u8 fcr_bits) | |||
| 306 | 306 | { | |
| 307 | 307 | unsigned long fcr = tup->fcr_shadow; | |
| 308 | 308 | unsigned int lsr, tmout = 10000; | |
| 309 | - | bool clear_tx = !!(fcr_bits & UART_FCR_CLEAR_XMIT); | |
| 310 | 309 | ||
| 311 | 310 | if (tup->rts_active) | |
| 312 | 311 | set_rts(tup, false); | |
| 313 | 312 | ||
| 314 | - | /* | |
| 315 | - | * Leaving FIFO mode below is a workaround for a Tegra30 | |
| 316 | - | * restriction on clearing the Tx FIFO while FIFO mode is | |
| 317 | - | * enabled. It empties both FIFOs, so applying it to an | |
| 318 | - | * Rx-only reset would destroy an in-flight transmission. | |
| 319 | - | * Only take that path when the caller asked for CLEAR_XMIT. | |
| 320 | - | */ | |
| 321 | - | if (tup->cdata->allow_txfifo_reset_fifo_mode || !clear_tx) { | |
| 313 | + | if (tup->cdata->allow_txfifo_reset_fifo_mode) { | |
| 322 | 314 | fcr |= fcr_bits & (UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT); | |
| 323 | 315 | tegra_uart_write(tup, fcr, UART_FCR); | |
| 324 | 316 | } else { | |
| @@ -343,15 +335,9 @@ static void tegra_uart_fifo_reset(struct tegra_uart_port *tup, u8 fcr_bits) | |||
| 343 | 335 | */ | |
| 344 | 336 | tegra_uart_wait_cycle_time(tup, 32); | |
| 345 | 337 | ||
| 346 | - | /* | |
| 347 | - | * Only wait for the transmitter to drain when the Tx FIFO was | |
| 348 | - | * part of the reset. For an Rx-only reset it is left intact, | |
| 349 | - | * and waiting for TEMT here would spin for a full frame time. | |
| 350 | - | */ | |
| 351 | 338 | do { | |
| 352 | 339 | lsr = tegra_uart_read(tup, UART_LSR); | |
| 353 | - | if ((!clear_tx || (lsr & UART_LSR_TEMT)) && | |
| 354 | - | !(lsr & UART_LSR_DR)) | |
| 340 | + | if ((lsr & UART_LSR_TEMT) && !(lsr & UART_LSR_DR)) | |
| 355 | 341 | break; | |
| 356 | 342 | udelay(1); | |
| 357 | 343 | } while (--tmout); | |
modified drivers/tty/serial/serial_core.c
| @@ -896,7 +896,7 @@ static int uart_set_info(struct tty_struct *tty, struct tty_port *port, | |||
| 896 | 896 | upf_t old_flags, new_flags; | |
| 897 | 897 | int retval; | |
| 898 | 898 | ||
| 899 | - | if (!uport || tty_io_error(tty)) | |
| 899 | + | if (!uport) | |
| 900 | 900 | return -EIO; | |
| 901 | 901 | ||
| 902 | 902 | new_port = new_info->port; | |
| @@ -1119,7 +1119,7 @@ static int uart_break_ctl(struct tty_struct *tty, int break_state) | |||
| 1119 | 1119 | guard(mutex)(&port->mutex); | |
| 1120 | 1120 | ||
| 1121 | 1121 | uport = uart_port_check(state); | |
| 1122 | - | if (!uport || tty_io_error(tty)) | |
| 1122 | + | if (!uport) | |
| 1123 | 1123 | return -EIO; | |
| 1124 | 1124 | ||
| 1125 | 1125 | if (uport->type != PORT_UNKNOWN && uport->ops->break_ctl) | |
| @@ -1144,7 +1144,7 @@ static int uart_do_autoconfig(struct tty_struct *tty, struct uart_state *state) | |||
| 1144 | 1144 | */ | |
| 1145 | 1145 | scoped_cond_guard(mutex_intr, return -ERESTARTSYS, &port->mutex) { | |
| 1146 | 1146 | uport = uart_port_check(state); | |
| 1147 | - | if (!uport || tty_io_error(tty)) | |
| 1147 | + | if (!uport) | |
| 1148 | 1148 | return -EIO; | |
| 1149 | 1149 | ||
| 1150 | 1150 | if (tty_port_users(port) != 1) | |
| @@ -1199,7 +1199,7 @@ static void uart_enable_ms(struct uart_port *uport) | |||
| 1199 | 1199 | * FIXME: This wants extracting into a common all driver implementation | |
| 1200 | 1200 | * of TIOCMWAIT using tty_port. | |
| 1201 | 1201 | */ | |
| 1202 | - | static int uart_wait_modem_status(struct tty_struct *tty, struct uart_state *state, unsigned long arg) | |
| 1202 | + | static int uart_wait_modem_status(struct uart_state *state, unsigned long arg) | |
| 1203 | 1203 | { | |
| 1204 | 1204 | struct uart_port *uport; | |
| 1205 | 1205 | struct tty_port *port = &state->port; | |
| @@ -1213,28 +1213,17 @@ static int uart_wait_modem_status(struct tty_struct *tty, struct uart_state *sta | |||
| 1213 | 1213 | uport = uart_port_ref(state); | |
| 1214 | 1214 | if (!uport) | |
| 1215 | 1215 | return -EIO; | |
| 1216 | - | ||
| 1217 | - | mutex_lock(&port->mutex); | |
| 1218 | - | if (tty_io_error(tty)) { | |
| 1219 | - | mutex_unlock(&port->mutex); | |
| 1220 | - | ret = -EIO; | |
| 1221 | - | goto out_deref; | |
| 1216 | + | scoped_guard(uart_port_lock_irq, uport) { | |
| 1217 | + | memcpy(&cprev, &uport->icount, sizeof(struct uart_icount)); | |
| 1218 | + | uart_enable_ms(uport); | |
| 1222 | 1219 | } | |
| 1223 | 1220 | ||
| 1224 | - | uart_port_lock_irq(uport); | |
| 1225 | - | memcpy(&cprev, &uport->icount, sizeof(struct uart_icount)); | |
| 1226 | - | uart_enable_ms(uport); | |
| 1227 | - | uart_port_unlock_irq(uport); | |
| 1228 | - | ||
| 1229 | - | mutex_unlock(&port->mutex); | |
| 1230 | - | ||
| 1231 | 1221 | add_wait_queue(&port->delta_msr_wait, &wait); | |
| 1232 | 1222 | for (;;) { | |
| 1233 | - | set_current_state(TASK_INTERRUPTIBLE); | |
| 1223 | + | scoped_guard(uart_port_lock_irq, uport) | |
| 1224 | + | memcpy(&cnow, &uport->icount, sizeof(struct uart_icount)); | |
| 1234 | 1225 | ||
| 1235 | - | uart_port_lock_irq(uport); | |
| 1236 | - | memcpy(&cnow, &uport->icount, sizeof(struct uart_icount)); | |
| 1237 | - | uart_port_unlock_irq(uport); | |
| 1226 | + | set_current_state(TASK_INTERRUPTIBLE); | |
| 1238 | 1227 | ||
| 1239 | 1228 | if (((arg & TIOCM_RNG) && (cnow.rng != cprev.rng)) || | |
| 1240 | 1229 | ((arg & TIOCM_DSR) && (cnow.dsr != cprev.dsr)) || | |
| @@ -1244,11 +1233,6 @@ static int uart_wait_modem_status(struct tty_struct *tty, struct uart_state *sta | |||
| 1244 | 1233 | break; | |
| 1245 | 1234 | } | |
| 1246 | 1235 | ||
| 1247 | - | if (tty_io_error(tty)) { | |
| 1248 | - | ret = -EIO; | |
| 1249 | - | break; | |
| 1250 | - | } | |
| 1251 | - | ||
| 1252 | 1236 | schedule(); | |
| 1253 | 1237 | ||
| 1254 | 1238 | /* see if a signal did it */ | |
| @@ -1261,7 +1245,6 @@ static int uart_wait_modem_status(struct tty_struct *tty, struct uart_state *sta | |||
| 1261 | 1245 | } | |
| 1262 | 1246 | __set_current_state(TASK_RUNNING); | |
| 1263 | 1247 | remove_wait_queue(&port->delta_msr_wait, &wait); | |
| 1264 | - | out_deref: | |
| 1265 | 1248 | uart_port_deref(uport); | |
| 1266 | 1249 | ||
| 1267 | 1250 | return ret; | |
| @@ -1584,7 +1567,7 @@ uart_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) | |||
| 1584 | 1567 | ||
| 1585 | 1568 | /* This should only be used when the hardware is present. */ | |
| 1586 | 1569 | if (cmd == TIOCMIWAIT) | |
| 1587 | - | return uart_wait_modem_status(tty, state, arg); | |
| 1570 | + | return uart_wait_modem_status(state, arg); | |
| 1588 | 1571 | ||
| 1589 | 1572 | /* rs485_config requires more locking than others */ | |
| 1590 | 1573 | if (cmd == TIOCSRS485) | |
| @@ -1640,13 +1623,14 @@ static void uart_set_ldisc(struct tty_struct *tty) | |||
| 1640 | 1623 | { | |
| 1641 | 1624 | struct uart_state *state = tty->driver_data; | |
| 1642 | 1625 | struct uart_port *uport; | |
| 1626 | + | struct tty_port *port = &state->port; | |
| 1643 | 1627 | ||
| 1644 | - | guard(mutex)(&state->port.mutex); | |
| 1645 | - | uport = uart_port_check(state); | |
| 1646 | - | if (!uport || tty_io_error(tty)) | |
| 1628 | + | if (!tty_port_initialized(port)) | |
| 1647 | 1629 | return; | |
| 1648 | 1630 | ||
| 1649 | - | if (uport->ops->set_ldisc) | |
| 1631 | + | guard(mutex)(&state->port.mutex); | |
| 1632 | + | uport = uart_port_check(state); | |
| 1633 | + | if (uport && uport->ops->set_ldisc) | |
| 1650 | 1634 | uport->ops->set_ldisc(uport, &tty->termios); | |
| 1651 | 1635 | } | |
| 1652 | 1636 | ||
| @@ -1662,7 +1646,7 @@ static void uart_set_termios(struct tty_struct *tty, | |||
| 1662 | 1646 | guard(mutex)(&state->port.mutex); | |
| 1663 | 1647 | ||
| 1664 | 1648 | uport = uart_port_check(state); | |
| 1665 | - | if (!uport || tty_io_error(tty)) | |
| 1649 | + | if (!uport) | |
| 1666 | 1650 | return; | |
| 1667 | 1651 | ||
| 1668 | 1652 | /* | |
| @@ -1814,14 +1798,7 @@ static void uart_wait_until_sent(struct tty_struct *tty, int timeout) | |||
| 1814 | 1798 | * 'timeout' / 'expire' give us the maximum amount of time | |
| 1815 | 1799 | * we wait. | |
| 1816 | 1800 | */ | |
| 1817 | - | for (;;) { | |
| 1818 | - | mutex_lock(&state->port.mutex); | |
| 1819 | - | if (tty_io_error(tty) || port->ops->tx_empty(port)) { | |
| 1820 | - | mutex_unlock(&state->port.mutex); | |
| 1821 | - | break; | |
| 1822 | - | } | |
| 1823 | - | mutex_unlock(&state->port.mutex); | |
| 1824 | - | ||
| 1801 | + | while (!port->ops->tx_empty(port)) { | |
| 1825 | 1802 | msleep_interruptible(jiffies_to_msecs(char_time)); | |
| 1826 | 1803 | if (signal_pending(current)) | |
| 1827 | 1804 | break; | |
| @@ -3381,7 +3358,6 @@ int serial_core_register_port(struct uart_driver *drv, struct uart_port *port) | |||
| 3381 | 3358 | ||
| 3382 | 3359 | err_unregister_port_dev: | |
| 3383 | 3360 | serial_base_port_device_remove(port->port_dev); | |
| 3384 | - | port->port_dev = NULL; | |
| 3385 | 3361 | ||
| 3386 | 3362 | err_unregister_ctrl_dev: | |
| 3387 | 3363 | serial_base_ctrl_device_remove(new_ctrl_dev); | |
| @@ -3396,24 +3372,12 @@ err_unregister_ctrl_dev: | |||
| 3396 | 3372 | void serial_core_unregister_port(struct uart_driver *drv, struct uart_port *port) | |
| 3397 | 3373 | { | |
| 3398 | 3374 | struct device *phys_dev = port->dev; | |
| 3399 | - | struct serial_port_device *port_dev; | |
| 3400 | - | struct serial_ctrl_device *ctrl_dev; | |
| 3375 | + | struct serial_port_device *port_dev = port->port_dev; | |
| 3376 | + | struct serial_ctrl_device *ctrl_dev = serial_core_get_ctrl_dev(port_dev); | |
| 3401 | 3377 | int ctrl_id = port->ctrl_id; | |
| 3402 | 3378 | ||
| 3403 | 3379 | guard(mutex)(&port_mutex); | |
| 3404 | 3380 | ||
| 3405 | - | /* | |
| 3406 | - | * A NULL port device means there is no registered port device to | |
| 3407 | - | * remove: serial_core_remove_one_port() clears port_dev on | |
| 3408 | - | * teardown, and it is never set if registration failed before | |
| 3409 | - | * serial_core_port_device_add(). | |
| 3410 | - | */ | |
| 3411 | - | port_dev = port->port_dev; | |
| 3412 | - | if (!port_dev) | |
| 3413 | - | return; | |
| 3414 | - | ||
| 3415 | - | ctrl_dev = serial_core_get_ctrl_dev(port_dev); | |
| 3416 | - | ||
| 3417 | 3381 | port->flags |= UPF_DEAD; | |
| 3418 | 3382 | ||
| 3419 | 3383 | serial_core_remove_one_port(drv, port); | |
modified drivers/tty/serial/sifive.c
| @@ -821,7 +821,7 @@ static void sifive_serial_console_write_atomic(struct console *co, | |||
| 821 | 821 | ier = __ssp_readl(ssp, SIFIVE_SERIAL_IE_OFFS); | |
| 822 | 822 | __ssp_writel(0, SIFIVE_SERIAL_IE_OFFS, ssp); | |
| 823 | 823 | ||
| 824 | - | if (unlikely(!ssp->console_line_ended && !nbcon_is_braille(co))) | |
| 824 | + | if (!ssp->console_line_ended) | |
| 825 | 825 | uart_console_write(port, "\n", 1, sifive_serial_console_putchar); | |
| 826 | 826 | uart_console_write(port, wctxt->outbuf, wctxt->len, | |
| 827 | 827 | sifive_serial_console_putchar); | |
modified drivers/tty/serial/vt8500_serial.c
| @@ -656,7 +656,6 @@ static int vt8500_serial_probe(struct platform_device *pdev) | |||
| 656 | 656 | ret = clk_prepare_enable(vt8500_port->clk); | |
| 657 | 657 | if (ret) { | |
| 658 | 658 | dev_err(&pdev->dev, "failed to enable clock\n"); | |
| 659 | - | clk_put(vt8500_port->clk); | |
| 660 | 659 | return ret; | |
| 661 | 660 | } | |
| 662 | 661 | ||
modified drivers/tty/tty_io.c
| @@ -620,8 +620,6 @@ static void __tty_hangup(struct tty_struct *tty, int exit_session) | |||
| 620 | 620 | ||
| 621 | 621 | tty_ldisc_hangup(tty, cons_filp != NULL); | |
| 622 | 622 | ||
| 623 | - | wake_up_interruptible(&tty->break_wait); | |
| 624 | - | ||
| 625 | 623 | spin_lock_irq(&tty->ctrl.lock); | |
| 626 | 624 | clear_bit(TTY_THROTTLED, &tty->flags); | |
| 627 | 625 | clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); | |
| @@ -2433,7 +2431,6 @@ static int tiocgetd(struct tty_struct *tty, int __user *p) | |||
| 2433 | 2431 | * send_break - performed time break | |
| 2434 | 2432 | * @tty: device to break on | |
| 2435 | 2433 | * @duration: timeout in mS | |
| 2436 | - | * @file: file object | |
| 2437 | 2434 | * | |
| 2438 | 2435 | * Perform a timed break on hardware that lacks its own driver level timed | |
| 2439 | 2436 | * break functionality. | |
| @@ -2441,9 +2438,8 @@ static int tiocgetd(struct tty_struct *tty, int __user *p) | |||
| 2441 | 2438 | * Locking: | |
| 2442 | 2439 | * @tty->atomic_write_lock serializes | |
| 2443 | 2440 | */ | |
| 2444 | - | static int send_break(struct file *file, struct tty_struct *tty, unsigned int duration) | |
| 2441 | + | static int send_break(struct tty_struct *tty, unsigned int duration) | |
| 2445 | 2442 | { | |
| 2446 | - | long timeout; | |
| 2447 | 2443 | int retval; | |
| 2448 | 2444 | ||
| 2449 | 2445 | if (tty->ops->break_ctl == NULL) | |
| @@ -2457,26 +2453,13 @@ static int send_break(struct file *file, struct tty_struct *tty, unsigned int du | |||
| 2457 | 2453 | return -EINTR; | |
| 2458 | 2454 | ||
| 2459 | 2455 | retval = tty->ops->break_ctl(tty, -1); | |
| 2460 | - | if (retval) { | |
| 2461 | - | if (retval == -EOPNOTSUPP) { | |
| 2462 | - | /* some drivers can tell only dynamically */ | |
| 2463 | - | retval = 0; | |
| 2464 | - | } | |
| 2465 | - | goto out_unlock; | |
| 2466 | - | } | |
| 2467 | - | ||
| 2468 | - | timeout = msecs_to_jiffies(duration); | |
| 2469 | - | timeout = wait_event_interruptible_timeout(tty->break_wait, | |
| 2470 | - | tty_hung_up_p(file), | |
| 2471 | - | timeout); | |
| 2472 | - | /* return early on hangup only */ | |
| 2473 | - | if (timeout > 0) { | |
| 2474 | - | retval = -EIO; | |
| 2475 | - | goto out_unlock; | |
| 2456 | + | if (!retval) { | |
| 2457 | + | msleep_interruptible(duration); | |
| 2458 | + | retval = tty->ops->break_ctl(tty, 0); | |
| 2459 | + | } else if (retval == -EOPNOTSUPP) { | |
| 2460 | + | /* some drivers can tell only dynamically */ | |
| 2461 | + | retval = 0; | |
| 2476 | 2462 | } | |
| 2477 | - | ||
| 2478 | - | retval = tty->ops->break_ctl(tty, 0); | |
| 2479 | - | out_unlock: | |
| 2480 | 2463 | tty_write_unlock(tty); | |
| 2481 | 2464 | ||
| 2482 | 2465 | if (signal_pending(current)) | |
| @@ -2744,10 +2727,10 @@ long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
| 2744 | 2727 | * This is used by the tcdrain() termios function. | |
| 2745 | 2728 | */ | |
| 2746 | 2729 | if (!arg) | |
| 2747 | - | return send_break(file, tty, 250); | |
| 2730 | + | return send_break(tty, 250); | |
| 2748 | 2731 | return 0; | |
| 2749 | 2732 | case TCSBRKP: /* support for POSIX tcsendbreak() */ | |
| 2750 | - | return send_break(file, tty, arg ? arg * 100 : 250); | |
| 2733 | + | return send_break(tty, arg ? arg*100 : 250); | |
| 2751 | 2734 | ||
| 2752 | 2735 | case TIOCMGET: | |
| 2753 | 2736 | return tty_tiocmget(tty, p); | |
| @@ -3107,7 +3090,6 @@ struct tty_struct *alloc_tty_struct(struct tty_driver *driver, int idx) | |||
| 3107 | 3090 | init_ldsem(&tty->ldisc_sem); | |
| 3108 | 3091 | init_waitqueue_head(&tty->write_wait); | |
| 3109 | 3092 | init_waitqueue_head(&tty->read_wait); | |
| 3110 | - | init_waitqueue_head(&tty->break_wait); | |
| 3111 | 3093 | INIT_WORK(&tty->hangup_work, do_tty_hangup); | |
| 3112 | 3094 | mutex_init(&tty->atomic_write_lock); | |
| 3113 | 3095 | spin_lock_init(&tty->ctrl.lock); | |
| @@ -3256,16 +3238,14 @@ struct device *tty_register_device_attr(struct tty_driver *driver, | |||
| 3256 | 3238 | goto err_put; | |
| 3257 | 3239 | ||
| 3258 | 3240 | if (!(driver->flags & TTY_DRIVER_DYNAMIC_ALLOC)) { | |
| 3259 | - | if (driver->flags & TTY_DRIVER_RESET_SAVED_TERMIOS) { | |
| 3260 | - | /* | |
| 3261 | - | * Free any saved termios data so that the termios | |
| 3262 | - | * state is reset when reusing a minor number. | |
| 3263 | - | */ | |
| 3264 | - | tp = driver->termios[index]; | |
| 3265 | - | if (tp) { | |
| 3266 | - | driver->termios[index] = NULL; | |
| 3267 | - | kfree(tp); | |
| 3268 | - | } | |
| 3241 | + | /* | |
| 3242 | + | * Free any saved termios data so that the termios state is | |
| 3243 | + | * reset when reusing a minor number. | |
| 3244 | + | */ | |
| 3245 | + | tp = driver->termios[index]; | |
| 3246 | + | if (tp) { | |
| 3247 | + | driver->termios[index] = NULL; | |
| 3248 | + | kfree(tp); | |
| 3269 | 3249 | } | |
| 3270 | 3250 | ||
| 3271 | 3251 | retval = tty_cdev_add(driver, devt, index, 1); | |
modified drivers/tty/tty_port.c
| @@ -340,9 +340,19 @@ void tty_port_tty_set(struct tty_port *port, struct tty_struct *tty) | |||
| 340 | 340 | } | |
| 341 | 341 | EXPORT_SYMBOL(tty_port_tty_set); | |
| 342 | 342 | ||
| 343 | - | static void tty_port_shutdown_locked(struct tty_port *port, struct tty_struct *tty) | |
| 343 | + | /** | |
| 344 | + | * tty_port_shutdown - internal helper to shutdown the device | |
| 345 | + | * @port: tty port to be shut down | |
| 346 | + | * @tty: the associated tty | |
| 347 | + | * | |
| 348 | + | * It is used by tty_port_hangup() and tty_port_close(). Its task is to | |
| 349 | + | * shutdown the device if it was initialized (note consoles remain | |
| 350 | + | * functioning). It lowers DTR/RTS (if @tty has HUPCL set) and invokes | |
| 351 | + | * @port->ops->shutdown(). | |
| 352 | + | */ | |
| 353 | + | static void tty_port_shutdown(struct tty_port *port, struct tty_struct *tty) | |
| 344 | 354 | { | |
| 345 | - | lockdep_assert_held(&port->mutex); | |
| 355 | + | guard(mutex)(&port->mutex); | |
| 346 | 356 | ||
| 347 | 357 | if (port->console) | |
| 348 | 358 | return; | |
| @@ -362,23 +372,6 @@ static void tty_port_shutdown_locked(struct tty_port *port, struct tty_struct *t | |||
| 362 | 372 | port->ops->shutdown(port); | |
| 363 | 373 | } | |
| 364 | 374 | ||
| 365 | - | /** | |
| 366 | - | * tty_port_shutdown - internal helper to shutdown the device | |
| 367 | - | * @port: tty port to be shut down | |
| 368 | - | * @tty: the associated tty | |
| 369 | - | * | |
| 370 | - | * It is used by tty_port_hangup() and tty_port_close(). Its task is to | |
| 371 | - | * shutdown the device if it was initialized (note consoles remain | |
| 372 | - | * functioning). It lowers DTR/RTS (if @tty has HUPCL set) and invokes | |
| 373 | - | * @port->ops->shutdown(). | |
| 374 | - | */ | |
| 375 | - | static void tty_port_shutdown(struct tty_port *port, struct tty_struct *tty) | |
| 376 | - | { | |
| 377 | - | guard(mutex)(&port->mutex); | |
| 378 | - | ||
| 379 | - | tty_port_shutdown_locked(port, tty); | |
| 380 | - | } | |
| 381 | - | ||
| 382 | 375 | /** | |
| 383 | 376 | * tty_port_hangup - hangup helper | |
| 384 | 377 | * @port: tty port | |
| @@ -392,58 +385,36 @@ void tty_port_hangup(struct tty_port *port) | |||
| 392 | 385 | { | |
| 393 | 386 | struct tty_struct *tty; | |
| 394 | 387 | ||
| 395 | - | scoped_guard(mutex, &port->mutex) { | |
| 396 | - | scoped_guard(spinlock_irqsave, &port->lock) { | |
| 397 | - | port->count = 0; | |
| 398 | - | tty = port->tty; | |
| 399 | - | if (tty) | |
| 400 | - | set_bit(TTY_IO_ERROR, &tty->flags); | |
| 401 | - | port->tty = NULL; | |
| 402 | - | } | |
| 403 | - | ||
| 404 | - | tty_port_set_active(port, false); | |
| 405 | - | tty_port_shutdown_locked(port, tty); | |
| 388 | + | scoped_guard(spinlock_irqsave, &port->lock) { | |
| 389 | + | port->count = 0; | |
| 390 | + | tty = port->tty; | |
| 391 | + | if (tty) | |
| 392 | + | set_bit(TTY_IO_ERROR, &tty->flags); | |
| 393 | + | port->tty = NULL; | |
| 406 | 394 | } | |
| 395 | + | ||
| 396 | + | tty_port_set_active(port, false); | |
| 397 | + | tty_port_shutdown(port, tty); | |
| 407 | 398 | tty_kref_put(tty); | |
| 408 | 399 | wake_up_interruptible(&port->open_wait); | |
| 409 | 400 | wake_up_interruptible(&port->delta_msr_wait); | |
| 410 | 401 | } | |
| 411 | 402 | EXPORT_SYMBOL(tty_port_hangup); | |
| 412 | 403 | ||
| 413 | - | /** | |
| 414 | - | * tty_port_tty_hangup - helper to hang up a tty asynchronously | |
| 415 | - | * @port: tty port | |
| 416 | - | * @check_clocal: hang only ttys with %CLOCAL unset? | |
| 417 | - | */ | |
| 418 | - | void tty_port_tty_hangup(struct tty_port *port, bool check_clocal) | |
| 404 | + | void __tty_port_tty_hangup(struct tty_port *port, bool check_clocal, bool async) | |
| 419 | 405 | { | |
| 420 | 406 | scoped_guard(tty_port_tty, port) { | |
| 421 | 407 | struct tty_struct *tty = scoped_tty(); | |
| 422 | 408 | ||
| 423 | - | if (!check_clocal || !C_CLOCAL(tty)) | |
| 424 | - | tty_hangup(tty); | |
| 425 | - | } | |
| 426 | - | } | |
| 427 | - | EXPORT_SYMBOL_GPL(tty_port_tty_hangup); | |
| 428 | - | ||
| 429 | - | /** | |
| 430 | - | * tty_port_tty_vhangup - helper to hang up a tty synchronously | |
| 431 | - | * @port: tty port | |
| 432 | - | */ | |
| 433 | - | void tty_port_tty_vhangup(struct tty_port *port) | |
| 434 | - | { | |
| 435 | - | struct tty_struct *tty; | |
| 436 | - | ||
| 437 | - | mutex_lock(&port->mutex); | |
| 438 | - | tty = tty_port_tty_get(port); | |
| 439 | - | mutex_unlock(&port->mutex); | |
| 440 | - | ||
| 441 | - | if (tty) { | |
| 442 | - | tty_vhangup(tty); | |
| 443 | - | tty_kref_put(tty); | |
| 409 | + | if (!check_clocal || !C_CLOCAL(tty)) { | |
| 410 | + | if (async) | |
| 411 | + | tty_hangup(tty); | |
| 412 | + | else | |
| 413 | + | tty_vhangup(tty); | |
| 414 | + | } | |
| 444 | 415 | } | |
| 445 | 416 | } | |
| 446 | - | EXPORT_SYMBOL_GPL(tty_port_tty_vhangup); | |
| 417 | + | EXPORT_SYMBOL_GPL(__tty_port_tty_hangup); | |
| 447 | 418 | ||
| 448 | 419 | /** | |
| 449 | 420 | * tty_port_tty_wakeup - helper to wake up a tty | |
| @@ -796,10 +767,8 @@ int tty_port_open(struct tty_port *port, struct tty_struct *tty, | |||
| 796 | 767 | clear_bit(TTY_IO_ERROR, &tty->flags); | |
| 797 | 768 | if (port->ops->activate) { | |
| 798 | 769 | int retval = port->ops->activate(port, tty); | |
| 799 | - | if (retval) { | |
| 800 | - | set_bit(TTY_IO_ERROR, &tty->flags); | |
| 770 | + | if (retval) | |
| 801 | 771 | return retval; | |
| 802 | - | } | |
| 803 | 772 | } | |
| 804 | 773 | tty_port_set_initialized(port, true); | |
| 805 | 774 | } | |
modified drivers/tty/vcc.c
| @@ -492,7 +492,7 @@ static ssize_t domain_show(struct device *dev, | |||
| 492 | 492 | ||
| 493 | 493 | static int vcc_send_ctl(struct vcc_port *port, int ctl) | |
| 494 | 494 | { | |
| 495 | - | struct vio_vcc pkt = {}; | |
| 495 | + | struct vio_vcc pkt; | |
| 496 | 496 | int rv; | |
| 497 | 497 | ||
| 498 | 498 | pkt.tag.type = VIO_TYPE_CTRL; | |
| @@ -986,8 +986,7 @@ static void vcc_cleanup(struct tty_struct *tty) | |||
| 986 | 986 | ||
| 987 | 987 | port = vcc_get(tty->index, true); | |
| 988 | 988 | if (port) { | |
| 989 | - | scoped_guard(spinlock_irqsave, &port->lock) | |
| 990 | - | port->tty = NULL; | |
| 989 | + | port->tty = NULL; | |
| 991 | 990 | ||
| 992 | 991 | if (port->removed) { | |
| 993 | 992 | vcc_table_remove(tty->index); | |
modified drivers/tty/vt/selection.c
| @@ -434,8 +434,8 @@ int paste_selection(struct tty_struct *tty) | |||
| 434 | 434 | bps = NULL; | |
| 435 | 435 | } | |
| 436 | 436 | ||
| 437 | - | if (vc_sel.buf_len > pasted) { | |
| 438 | - | count = vc_sel.buf_len - pasted; | |
| 437 | + | count = vc_sel.buf_len - pasted; | |
| 438 | + | if (count) { | |
| 439 | 439 | pasted += tty_ldisc_receive_buf(ld, vc_sel.buffer + pasted, | |
| 440 | 440 | NULL, count); | |
| 441 | 441 | if (vc_sel.buf_len > pasted) | |
modified drivers/tty/vt/vc_screen.c
| @@ -631,18 +631,6 @@ vcs_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) | |||
| 631 | 631 | ret = copy_from_user(con_buf, buf, this_round); | |
| 632 | 632 | console_lock(); | |
| 633 | 633 | ||
| 634 | - | /* The vc might have been freed or vcs_size might have changed | |
| 635 | - | * while we slept to grab the user buffer; recheck here, before | |
| 636 | - | * if (ret), so every break path below passes a fresh vc to the | |
| 637 | - | * post-loop vcs_scr_updated(). Return data written so far. | |
| 638 | - | */ | |
| 639 | - | vc = vcs_vc(inode, &viewed); | |
| 640 | - | if (!vc) { | |
| 641 | - | if (written) | |
| 642 | - | break; | |
| 643 | - | return -ENXIO; | |
| 644 | - | } | |
| 645 | - | ||
| 646 | 634 | if (ret) { | |
| 647 | 635 | this_round -= ret; | |
| 648 | 636 | if (!this_round) { | |
| @@ -654,6 +642,17 @@ vcs_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) | |||
| 654 | 642 | return -EFAULT; | |
| 655 | 643 | } | |
| 656 | 644 | } | |
| 645 | + | ||
| 646 | + | /* The vc might have been freed or vcs_size might have changed | |
| 647 | + | * while we slept to grab the user buffer, so recheck. | |
| 648 | + | * Return data written up to now on failure. | |
| 649 | + | */ | |
| 650 | + | vc = vcs_vc(inode, &viewed); | |
| 651 | + | if (!vc) { | |
| 652 | + | if (written) | |
| 653 | + | break; | |
| 654 | + | return -ENXIO; | |
| 655 | + | } | |
| 657 | 656 | size = vcs_size(vc, attr, false); | |
| 658 | 657 | if (size < 0) { | |
| 659 | 658 | if (written) | |
modified drivers/tty/vt/vt.c
| @@ -1134,8 +1134,6 @@ int vc_allocate(unsigned int currcons) /* return 0 on success */ | |||
| 1134 | 1134 | return 0; | |
| 1135 | 1135 | err_free: | |
| 1136 | 1136 | visual_deinit(vc); | |
| 1137 | - | if (*vc->uni_pagedict_loc) | |
| 1138 | - | con_free_unimap(vc); | |
| 1139 | 1137 | kfree(vc); | |
| 1140 | 1138 | vc_cons[currcons].d = NULL; | |
| 1141 | 1139 | return err; | |
| @@ -2862,8 +2860,7 @@ static void do_con_trol(struct tty_struct *tty, struct vc_data *vc, u8 c) | |||
| 2862 | 2860 | csi_J(vc, CSI_J_VISIBLE); | |
| 2863 | 2861 | vc->vc_video_erase_char = | |
| 2864 | 2862 | (vc->vc_video_erase_char & 0xff00) | ' '; | |
| 2865 | - | if (con_should_update(vc)) | |
| 2866 | - | do_update_region(vc, vc->vc_origin, vc->vc_screenbuf_size / 2); | |
| 2863 | + | do_update_region(vc, vc->vc_origin, vc->vc_screenbuf_size / 2); | |
| 2867 | 2864 | } | |
| 2868 | 2865 | return; | |
| 2869 | 2866 | case ESsetG0: /* ESC ( */ | |
modified drivers/ufs/core/ufs-mcq.c
| @@ -312,24 +312,20 @@ static int ufshcd_mcq_get_tag(struct ufs_hba *hba, struct cq_entry *cqe) | |||
| 312 | 312 | UFSHCD_NUM_RESERVED; | |
| 313 | 313 | } | |
| 314 | 314 | ||
| 315 | - | static void ufshcd_mcq_compl_cqe(struct ufs_hba *hba, struct cq_entry *cqe) | |
| 316 | - | { | |
| 317 | - | int tag = ufshcd_mcq_get_tag(hba, cqe); | |
| 318 | - | ||
| 319 | - | ufshcd_compl_one_cqe(hba, tag, cqe); | |
| 320 | - | /* After processing the CQE, mark it as an empty (invalid) entry. */ | |
| 321 | - | cqe->command_desc_base_addr = 0; | |
| 322 | - | } | |
| 323 | - | ||
| 324 | 315 | static void ufshcd_mcq_process_cqe(struct ufs_hba *hba, | |
| 325 | 316 | struct ufs_hw_queue *hwq) | |
| 326 | 317 | { | |
| 327 | 318 | struct cq_entry *cqe = ufshcd_mcq_cur_cqe(hwq); | |
| 328 | 319 | ||
| 329 | - | if (cqe->command_desc_base_addr) | |
| 330 | - | ufshcd_mcq_compl_cqe(hba, cqe); | |
| 331 | - | else | |
| 320 | + | if (cqe->command_desc_base_addr) { | |
| 321 | + | int tag = ufshcd_mcq_get_tag(hba, cqe); | |
| 322 | + | ||
| 323 | + | ufshcd_compl_one_cqe(hba, tag, cqe); | |
| 324 | + | /* After processed the cqe, mark it empty (invalid) entry */ | |
| 325 | + | cqe->command_desc_base_addr = 0; | |
| 326 | + | } else { | |
| 332 | 327 | dev_err(hba->dev, "Abnormal CQ entry!\n"); | |
| 328 | + | } | |
| 333 | 329 | } | |
| 334 | 330 | ||
| 335 | 331 | /* | |
| @@ -337,7 +333,7 @@ static void ufshcd_mcq_process_cqe(struct ufs_hba *hba, | |||
| 337 | 333 | * controller disabled (HCE = 0). Reading host controller registers, e.g. the | |
| 338 | 334 | * CQ tail pointer (CQTPy), may not be safe with the host controller disabled. | |
| 339 | 335 | * Hence, iterate over all completion queue entries. This won't result in | |
| 340 | - | * double completions because ufshcd_mcq_compl_cqe() clears a CQE after it | |
| 336 | + | * double completions because ufshcd_mcq_process_cqe() clears a CQE after it | |
| 341 | 337 | * has been processed. | |
| 342 | 338 | */ | |
| 343 | 339 | void ufshcd_mcq_compl_all_cqes_lock(struct ufs_hba *hba, | |
| @@ -348,13 +344,13 @@ void ufshcd_mcq_compl_all_cqes_lock(struct ufs_hba *hba, | |||
| 348 | 344 | ||
| 349 | 345 | spin_lock_irqsave(&hwq->cq_lock, flags); | |
| 350 | 346 | while (entries > 0) { | |
| 351 | - | struct cq_entry *cqe = ufshcd_mcq_cur_cqe(hwq); | |
| 352 | - | ||
| 353 | - | if (cqe->command_desc_base_addr) | |
| 354 | - | ufshcd_mcq_compl_cqe(hba, cqe); | |
| 347 | + | ufshcd_mcq_process_cqe(hba, hwq); | |
| 355 | 348 | ufshcd_mcq_inc_cq_head_slot(hwq); | |
| 356 | 349 | entries--; | |
| 357 | 350 | } | |
| 351 | + | ||
| 352 | + | ufshcd_mcq_update_cq_tail_slot(hwq); | |
| 353 | + | hwq->cq_head_slot = hwq->cq_tail_slot; | |
| 358 | 354 | spin_unlock_irqrestore(&hwq->cq_lock, flags); | |
| 359 | 355 | } | |
| 360 | 356 | ||
modified drivers/ufs/core/ufshcd.c
| @@ -6044,6 +6044,8 @@ static bool ufshcd_mcq_force_compl_one(struct request *rq, void *priv) | |||
| 6044 | 6044 | if (blk_mq_is_reserved_rq(rq) || !hwq) | |
| 6045 | 6045 | return true; | |
| 6046 | 6046 | ||
| 6047 | + | ufshcd_mcq_compl_all_cqes_lock(hba, hwq); | |
| 6048 | + | ||
| 6047 | 6049 | /* | |
| 6048 | 6050 | * For those cmds of which the cqes are not present in the cq, complete | |
| 6049 | 6051 | * them explicitly. | |
| @@ -6059,6 +6061,19 @@ static bool ufshcd_mcq_force_compl_one(struct request *rq, void *priv) | |||
| 6059 | 6061 | return true; | |
| 6060 | 6062 | } | |
| 6061 | 6063 | ||
| 6064 | + | static bool ufshcd_mcq_compl_one(struct request *rq, void *priv) | |
| 6065 | + | { | |
| 6066 | + | struct scsi_device *sdev = rq->q->queuedata; | |
| 6067 | + | struct Scsi_Host *shost = sdev->host; | |
| 6068 | + | struct ufs_hba *hba = shost_priv(shost); | |
| 6069 | + | struct ufs_hw_queue *hwq = ufshcd_mcq_req_to_hwq(hba, rq); | |
| 6070 | + | ||
| 6071 | + | if (!blk_mq_is_reserved_rq(rq) && hwq) | |
| 6072 | + | ufshcd_mcq_poll_cqe_lock(hba, hwq); | |
| 6073 | + | ||
| 6074 | + | return true; | |
| 6075 | + | } | |
| 6076 | + | ||
| 6062 | 6077 | /** | |
| 6063 | 6078 | * ufshcd_mcq_compl_pending_transfer - MCQ mode function. It is | |
| 6064 | 6079 | * invoked from the error handler context or ufshcd_host_reset_and_restore() | |
| @@ -6073,18 +6088,10 @@ static bool ufshcd_mcq_force_compl_one(struct request *rq, void *priv) | |||
| 6073 | 6088 | static void ufshcd_mcq_compl_pending_transfer(struct ufs_hba *hba, | |
| 6074 | 6089 | bool force_compl) | |
| 6075 | 6090 | { | |
| 6076 | - | int i; | |
| 6077 | - | ||
| 6078 | - | for (i = 0; i < hba->nr_hw_queues; i++) { | |
| 6079 | - | if (force_compl) | |
| 6080 | - | ufshcd_mcq_compl_all_cqes_lock(hba, &hba->uhq[i]); | |
| 6081 | - | else | |
| 6082 | - | ufshcd_mcq_poll_cqe_lock(hba, &hba->uhq[i]); | |
| 6083 | - | } | |
| 6084 | - | ||
| 6085 | - | if (force_compl) | |
| 6086 | - | blk_mq_tagset_busy_iter(&hba->host->tag_set, | |
| 6087 | - | ufshcd_mcq_force_compl_one, NULL); | |
| 6091 | + | blk_mq_tagset_busy_iter(&hba->host->tag_set, | |
| 6092 | + | force_compl ? ufshcd_mcq_force_compl_one : | |
| 6093 | + | ufshcd_mcq_compl_one, | |
| 6094 | + | NULL); | |
| 6088 | 6095 | } | |
| 6089 | 6096 | ||
| 6090 | 6097 | /** | |
| @@ -9549,7 +9556,6 @@ static void ufshcd_async_scan(void *data, async_cookie_t cookie) | |||
| 9549 | 9556 | ret = ufshcd_add_lus(hba); | |
| 9550 | 9557 | ||
| 9551 | 9558 | out: | |
| 9552 | - | ufshcd_release(hba); | |
| 9553 | 9559 | pm_runtime_put_sync(hba->dev); | |
| 9554 | 9560 | ||
| 9555 | 9561 | if (ret) | |
| @@ -11272,9 +11278,6 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq) | |||
| 11272 | 11278 | ||
| 11273 | 11279 | ufshcd_init_clk_gating(hba); | |
| 11274 | 11280 | ||
| 11275 | - | /* Released by ufshcd_async_scan(), or by out_release on failure. */ | |
| 11276 | - | ufshcd_hold(hba); | |
| 11277 | - | ||
| 11278 | 11281 | ufshcd_init_clk_scaling(hba); | |
| 11279 | 11282 | ||
| 11280 | 11283 | /* | |
| @@ -11295,7 +11298,7 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq) | |||
| 11295 | 11298 | err = devm_request_irq(dev, irq, ufshcd_intr, IRQF_SHARED, UFSHCD, hba); | |
| 11296 | 11299 | if (err) { | |
| 11297 | 11300 | dev_err(hba->dev, "request irq failed\n"); | |
| 11298 | - | goto out_release; | |
| 11301 | + | goto out_disable; | |
| 11299 | 11302 | } else { | |
| 11300 | 11303 | hba->is_irq_enabled = true; | |
| 11301 | 11304 | } | |
| @@ -11311,7 +11314,7 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq) | |||
| 11311 | 11314 | dev_err(hba->dev, "Host controller enable failed\n"); | |
| 11312 | 11315 | ufshcd_print_evt_hist(hba); | |
| 11313 | 11316 | ufshcd_print_host_state(hba); | |
| 11314 | - | goto out_release; | |
| 11317 | + | goto out_disable; | |
| 11315 | 11318 | } | |
| 11316 | 11319 | ||
| 11317 | 11320 | INIT_DELAYED_WORK(&hba->rpm_dev_flush_recheck_work, ufshcd_rpm_dev_flush_recheck_work); | |
| @@ -11325,7 +11328,7 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq) | |||
| 11325 | 11328 | ||
| 11326 | 11329 | err = ufshcd_add_scsi_host(hba); | |
| 11327 | 11330 | if (err) | |
| 11328 | - | goto out_release; | |
| 11331 | + | goto out_disable; | |
| 11329 | 11332 | ||
| 11330 | 11333 | /* Hold auto suspend until async scan completes */ | |
| 11331 | 11334 | pm_runtime_get_sync(dev); | |
| @@ -11345,7 +11348,7 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq) | |||
| 11345 | 11348 | ||
| 11346 | 11349 | err = ufshcd_link_startup(hba); | |
| 11347 | 11350 | if (err) | |
| 11348 | - | goto out_release; | |
| 11351 | + | goto out_disable; | |
| 11349 | 11352 | ||
| 11350 | 11353 | if (hba->mcq_enabled) | |
| 11351 | 11354 | ufshcd_config_mcq(hba); | |
| @@ -11362,23 +11365,23 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq) | |||
| 11362 | 11365 | /* Verify device initialization by sending NOP OUT UPIU */ | |
| 11363 | 11366 | err = ufshcd_verify_dev_init(hba); | |
| 11364 | 11367 | if (err) | |
| 11365 | - | goto out_release; | |
| 11368 | + | goto out_disable; | |
| 11366 | 11369 | ||
| 11367 | 11370 | /* Initiate UFS initialization, and waiting until completion */ | |
| 11368 | 11371 | err = ufshcd_complete_dev_init(hba); | |
| 11369 | 11372 | if (err) | |
| 11370 | - | goto out_release; | |
| 11373 | + | goto out_disable; | |
| 11371 | 11374 | ||
| 11372 | 11375 | err = ufshcd_device_params_init(hba); | |
| 11373 | 11376 | if (err) | |
| 11374 | - | goto out_release; | |
| 11377 | + | goto out_disable; | |
| 11375 | 11378 | ||
| 11376 | 11379 | err = ufshcd_post_device_init(hba); | |
| 11377 | 11380 | ||
| 11378 | 11381 | initialized: | |
| 11379 | 11382 | ufshcd_process_probe_result(hba, probe_start, err); | |
| 11380 | 11383 | if (err) | |
| 11381 | - | goto out_release; | |
| 11384 | + | goto out_disable; | |
| 11382 | 11385 | ||
| 11383 | 11386 | ufs_sysfs_add_nodes(hba->dev); | |
| 11384 | 11387 | hba->dme_qos_sysfs_handle = sysfs_get_dirent(hba->dev->kobj.sd, | |
| @@ -11389,8 +11392,6 @@ initialized: | |||
| 11389 | 11392 | ufshcd_pm_qos_init(hba); | |
| 11390 | 11393 | return 0; | |
| 11391 | 11394 | ||
| 11392 | - | out_release: | |
| 11393 | - | ufshcd_release(hba); | |
| 11394 | 11395 | out_disable: | |
| 11395 | 11396 | hba->is_irq_enabled = false; | |
| 11396 | 11397 | ufshcd_hba_exit(hba); | |
modified drivers/ufs/host/ufs-mediatek.c
| @@ -509,7 +509,6 @@ static int ufs_mtk_mphy_power_on(struct ufs_hba *hba, bool on) | |||
| 509 | 509 | struct ufs_mtk_host *host = ufshcd_get_variant(hba); | |
| 510 | 510 | struct phy *mphy = host->mphy; | |
| 511 | 511 | struct arm_smccc_res res; | |
| 512 | - | int err; | |
| 513 | 512 | int ret = 0; | |
| 514 | 513 | ||
| 515 | 514 | if (!mphy || !(on ^ host->mphy_powered_on)) | |
| @@ -524,18 +523,7 @@ static int ufs_mtk_mphy_power_on(struct ufs_hba *hba, bool on) | |||
| 524 | 523 | usleep_range(200, 210); | |
| 525 | 524 | ufs_mtk_va09_pwr_ctrl(res, 1); | |
| 526 | 525 | } | |
| 527 | - | ret = phy_power_on(mphy); | |
| 528 | - | if (ret) { | |
| 529 | - | if (ufs_mtk_is_va09_supported(hba)) { | |
| 530 | - | ufs_mtk_va09_pwr_ctrl(res, 0); | |
| 531 | - | err = regulator_disable(host->reg_va09); | |
| 532 | - | if (err) | |
| 533 | - | dev_err(hba->dev, | |
| 534 | - | "failed to unwind va09: %d\n", err); | |
| 535 | - | } | |
| 536 | - | dev_err(hba->dev, "failed to enable mphy: %d\n", ret); | |
| 537 | - | return ret; | |
| 538 | - | } | |
| 526 | + | phy_power_on(mphy); | |
| 539 | 527 | } else { | |
| 540 | 528 | phy_power_off(mphy); | |
| 541 | 529 | if (ufs_mtk_is_va09_supported(hba)) { | |
| @@ -1307,9 +1295,7 @@ static int ufs_mtk_init(struct ufs_hba *hba) | |||
| 1307 | 1295 | * | |
| 1308 | 1296 | * Enable phy clocks specifically here. | |
| 1309 | 1297 | */ | |
| 1310 | - | err = ufs_mtk_mphy_power_on(hba, true); | |
| 1311 | - | if (err) | |
| 1312 | - | goto out_variant_clear; | |
| 1298 | + | ufs_mtk_mphy_power_on(hba, true); | |
| 1313 | 1299 | ||
| 1314 | 1300 | if (ufs_mtk_is_rtff_mtcmos(hba)) { | |
| 1315 | 1301 | /* First Restore here, to avoid backup unexpected value */ | |
modified drivers/usb/cdns3/cdns3-gadget.c
| @@ -3269,10 +3269,6 @@ static void cdns3_gadget_exit(struct cdns *cdns) | |||
| 3269 | 3269 | usb_del_gadget(&priv_dev->gadget); | |
| 3270 | 3270 | devm_free_irq(cdns->dev, cdns->dev_irq, priv_dev); | |
| 3271 | 3271 | ||
| 3272 | - | /* The works can still be queued until the IRQ is freed. */ | |
| 3273 | - | cancel_work_sync(&priv_dev->pending_status_wq); | |
| 3274 | - | cancel_work_sync(&priv_dev->aligned_buf_wq); | |
| 3275 | - | ||
| 3276 | 3272 | cdns3_free_all_eps(priv_dev); | |
| 3277 | 3273 | ||
| 3278 | 3274 | while (!list_empty(&priv_dev->aligned_buf_list)) { | |
modified drivers/usb/cdns3/cdns3-pci-wrap.c
| @@ -96,11 +96,6 @@ static int cdns3_pci_probe(struct pci_dev *pdev, | |||
| 96 | 96 | ||
| 97 | 97 | if (pci_is_enabled(func)) { | |
| 98 | 98 | wrap = pci_get_drvdata(func); | |
| 99 | - | if (!wrap) { | |
| 100 | - | dev_err(&pdev->dev, | |
| 101 | - | "second function not initialized, retrying\n"); | |
| 102 | - | return -EPROBE_DEFER; | |
| 103 | - | } | |
| 104 | 99 | } else { | |
| 105 | 100 | wrap = kzalloc_obj(*wrap); | |
| 106 | 101 | if (!wrap) | |
modified drivers/usb/chipidea/ci_hdrc_tegra.c
| @@ -306,10 +306,8 @@ static int tegra_usb_probe(struct platform_device *pdev) | |||
| 306 | 306 | ||
| 307 | 307 | pm_runtime_enable(&pdev->dev); | |
| 308 | 308 | err = pm_runtime_resume_and_get(&pdev->dev); | |
| 309 | - | if (err) { | |
| 310 | - | pm_runtime_disable(&pdev->dev); | |
| 309 | + | if (err) | |
| 311 | 310 | return err; | |
| 312 | - | } | |
| 313 | 311 | ||
| 314 | 312 | if (device_property_present(&pdev->dev, "nvidia,needs-double-reset")) | |
| 315 | 313 | usb->needs_double_reset = true; | |
modified drivers/usb/class/cdc-acm.c
| @@ -331,6 +331,7 @@ static void acm_process_notification(struct acm *acm, unsigned char *buf) | |||
| 331 | 331 | ||
| 332 | 332 | spin_lock_irqsave(&acm->read_lock, flags); | |
| 333 | 333 | acm->ctrlin = newctrl; | |
| 334 | + | acm->oldcount = acm->iocount; | |
| 334 | 335 | ||
| 335 | 336 | if (difference & USB_CDC_SERIAL_STATE_DSR) | |
| 336 | 337 | acm->iocount.dsr++; | |
| @@ -787,9 +788,6 @@ static void acm_port_shutdown(struct tty_port *port) | |||
| 787 | 788 | usb_autopm_put_interface_async(acm->control); | |
| 788 | 789 | } | |
| 789 | 790 | ||
| 790 | - | if (acm->disconnected) | |
| 791 | - | return; | |
| 792 | - | ||
| 793 | 791 | acm_unpoison_urbs(acm); | |
| 794 | 792 | ||
| 795 | 793 | if (acm->quirks & ALWAYS_POLL_CTRL) { | |
| @@ -1029,16 +1027,11 @@ static int wait_serial_change(struct acm *acm, unsigned long arg) | |||
| 1029 | 1027 | DECLARE_WAITQUEUE(wait, current); | |
| 1030 | 1028 | struct async_icount old, new; | |
| 1031 | 1029 | ||
| 1032 | - | spin_lock_irq(&acm->read_lock); | |
| 1033 | - | old = acm->iocount; | |
| 1034 | - | spin_unlock_irq(&acm->read_lock); | |
| 1035 | - | ||
| 1036 | - | add_wait_queue(&acm->wioctl, &wait); | |
| 1037 | - | for (;;) { | |
| 1038 | - | set_current_state(TASK_INTERRUPTIBLE); | |
| 1039 | - | ||
| 1030 | + | do { | |
| 1040 | 1031 | spin_lock_irq(&acm->read_lock); | |
| 1032 | + | old = acm->oldcount; | |
| 1041 | 1033 | new = acm->iocount; | |
| 1034 | + | acm->oldcount = new; | |
| 1042 | 1035 | spin_unlock_irq(&acm->read_lock); | |
| 1043 | 1036 | ||
| 1044 | 1037 | if ((arg & TIOCM_DSR) && | |
| @@ -1051,20 +1044,22 @@ static int wait_serial_change(struct acm *acm, unsigned long arg) | |||
| 1051 | 1044 | old.rng != new.rng) | |
| 1052 | 1045 | break; | |
| 1053 | 1046 | ||
| 1047 | + | add_wait_queue(&acm->wioctl, &wait); | |
| 1048 | + | set_current_state(TASK_INTERRUPTIBLE); | |
| 1049 | + | schedule(); | |
| 1050 | + | remove_wait_queue(&acm->wioctl, &wait); | |
| 1054 | 1051 | if (acm->disconnected) { | |
| 1055 | - | rv = -ENODEV; | |
| 1056 | - | break; | |
| 1052 | + | if (arg & TIOCM_CD) | |
| 1053 | + | break; | |
| 1054 | + | else | |
| 1055 | + | rv = -ENODEV; | |
| 1056 | + | } else { | |
| 1057 | + | if (signal_pending(current)) | |
| 1058 | + | rv = -ERESTARTSYS; | |
| 1057 | 1059 | } | |
| 1060 | + | } while (!rv); | |
| 1058 | 1061 | ||
| 1059 | - | schedule(); | |
| 1060 | - | ||
| 1061 | - | if (signal_pending(current)) { | |
| 1062 | - | rv = -ERESTARTSYS; | |
| 1063 | - | break; | |
| 1064 | - | } | |
| 1065 | - | } | |
| 1066 | - | __set_current_state(TASK_RUNNING); | |
| 1067 | - | remove_wait_queue(&acm->wioctl, &wait); | |
| 1062 | + | ||
| 1068 | 1063 | ||
| 1069 | 1064 | return rv; | |
| 1070 | 1065 | } | |
| @@ -2145,7 +2140,7 @@ static int __init acm_init(void) | |||
| 2145 | 2140 | { | |
| 2146 | 2141 | int retval; | |
| 2147 | 2142 | acm_tty_driver = tty_alloc_driver(ACM_TTY_MINORS, TTY_DRIVER_REAL_RAW | | |
| 2148 | - | TTY_DRIVER_DYNAMIC_DEV | TTY_DRIVER_RESET_SAVED_TERMIOS); | |
| 2143 | + | TTY_DRIVER_DYNAMIC_DEV); | |
| 2149 | 2144 | if (IS_ERR(acm_tty_driver)) | |
| 2150 | 2145 | return PTR_ERR(acm_tty_driver); | |
| 2151 | 2146 | acm_tty_driver->driver_name = "acm", | |
modified drivers/usb/class/cdc-acm.h
| @@ -90,6 +90,7 @@ struct acm { | |||
| 90 | 90 | unsigned int ctrlin; /* input control lines (DCD, DSR, RI, break, overruns) */ | |
| 91 | 91 | unsigned int ctrlout; /* output control lines (DTR, RTS) */ | |
| 92 | 92 | struct async_icount iocount; /* counters for control line changes */ | |
| 93 | + | struct async_icount oldcount; /* for comparison of counter */ | |
| 93 | 94 | wait_queue_head_t wioctl; /* for ioctl */ | |
| 94 | 95 | unsigned int writesize; /* max packet size for the output bulk endpoint */ | |
| 95 | 96 | unsigned int readsize,ctrlsize; /* buffer sizes for freeing */ | |
modified drivers/usb/core/hub.c
| @@ -73,11 +73,8 @@ | |||
| 73 | 73 | /* | |
| 74 | 74 | * Give SS hubs 200ms time after wake to train downstream links before | |
| 75 | 75 | * assuming no port activity and allowing hub to runtime suspend back. | |
| 76 | - | * Root hubs have no upstream hub whose wake propagation needs to be | |
| 77 | - | * accounted for, so they need less time, use 120ms for them. | |
| 78 | 76 | */ | |
| 79 | 77 | #define USB_SS_PORT_U0_WAKE_TIME 200 /* ms */ | |
| 80 | - | #define USB_SS_RH_PORT_U0_WAKE_TIME 120 /* ms */ | |
| 81 | 78 | ||
| 82 | 79 | /* Protect struct usb_device->state and ->children members | |
| 83 | 80 | * Note: Both are also protected by ->dev.sem, except that ->state can | |
| @@ -1361,9 +1358,7 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type) | |||
| 1361 | 1358 | ||
| 1362 | 1359 | queue_delayed_work(system_power_efficient_wq, | |
| 1363 | 1360 | &hub->post_resume_work, | |
| 1364 | - | msecs_to_jiffies(hdev->parent ? | |
| 1365 | - | USB_SS_PORT_U0_WAKE_TIME : | |
| 1366 | - | USB_SS_RH_PORT_U0_WAKE_TIME)); | |
| 1361 | + | msecs_to_jiffies(USB_SS_PORT_U0_WAKE_TIME)); | |
| 1367 | 1362 | return; | |
| 1368 | 1363 | } | |
| 1369 | 1364 | ||
modified drivers/usb/core/message.c
| @@ -1337,8 +1337,7 @@ static void remove_intf_ep_devs(struct usb_interface *intf) | |||
| 1337 | 1337 | * | |
| 1338 | 1338 | * Disables the endpoint for URB submission and nukes all pending URBs. | |
| 1339 | 1339 | * If @reset_hardware is set then also deallocates hcd/hardware state | |
| 1340 | - | * for the endpoint (clearing both ep_in and ep_out pointers for | |
| 1341 | - | * bidirectional non-ep0 control endpoints). | |
| 1340 | + | * for the endpoint. | |
| 1342 | 1341 | */ | |
| 1343 | 1342 | void usb_disable_endpoint(struct usb_device *dev, unsigned int epaddr, | |
| 1344 | 1343 | bool reset_hardware) | |
| @@ -1359,11 +1358,6 @@ void usb_disable_endpoint(struct usb_device *dev, unsigned int epaddr, | |||
| 1359 | 1358 | dev->ep_in[epnum] = NULL; | |
| 1360 | 1359 | } | |
| 1361 | 1360 | if (ep) { | |
| 1362 | - | if (reset_hardware && epnum != 0 && | |
| 1363 | - | usb_endpoint_xfer_control(&ep->desc)) { | |
| 1364 | - | dev->ep_out[epnum] = NULL; | |
| 1365 | - | dev->ep_in[epnum] = NULL; | |
| 1366 | - | } | |
| 1367 | 1361 | ep->enabled = 0; | |
| 1368 | 1362 | usb_hcd_flush_endpoint(dev, ep); | |
| 1369 | 1363 | if (reset_hardware) | |
modified drivers/usb/dwc2/hcd.c
| @@ -5082,13 +5082,14 @@ static void dwc2_hcd_free(struct dwc2_hsotg *hsotg) | |||
| 5082 | 5082 | } | |
| 5083 | 5083 | ||
| 5084 | 5084 | cancel_work_sync(&hsotg->phy_reset_work); | |
| 5085 | + | ||
| 5086 | + | timer_delete(&hsotg->wkp_timer); | |
| 5085 | 5087 | } | |
| 5086 | 5088 | ||
| 5087 | 5089 | static void dwc2_hcd_release(struct dwc2_hsotg *hsotg) | |
| 5088 | 5090 | { | |
| 5089 | 5091 | /* Turn off all host-specific interrupts */ | |
| 5090 | 5092 | dwc2_disable_host_interrupts(hsotg); | |
| 5091 | - | timer_shutdown_sync(&hsotg->wkp_timer); | |
| 5092 | 5093 | ||
| 5093 | 5094 | dwc2_hcd_free(hsotg); | |
| 5094 | 5095 | } | |
modified drivers/usb/dwc3/core.h
| @@ -49,7 +49,6 @@ | |||
| 49 | 49 | #define DWC3_ENDPOINTS_NUM 32 | |
| 50 | 50 | #define DWC3_XHCI_RESOURCES_NUM 2 | |
| 51 | 51 | #define DWC3_ISOC_MAX_RETRIES 5 | |
| 52 | - | #define DWC3_ERR_RECOVERY_MAX 3 | |
| 53 | 52 | ||
| 54 | 53 | #define DWC3_SCRATCHBUF_SIZE 4096 /* each buffer is assumed to be 4KiB */ | |
| 55 | 54 | #define DWC3_EVENT_BUFFERS_SIZE 4096 | |
| @@ -842,12 +841,6 @@ enum dwc3_link_state { | |||
| 842 | 841 | DWC3_LINK_STATE_MASK = 0x0f, | |
| 843 | 842 | }; | |
| 844 | 843 | ||
| 845 | - | enum dwc3_err_state { | |
| 846 | - | DWC3_ERR_NONE = 0, | |
| 847 | - | DWC3_ERR_RECOVERY, | |
| 848 | - | DWC3_ERR_UNRECOVERABLE, | |
| 849 | - | }; | |
| 850 | - | ||
| 851 | 844 | /* TRB Length, PCM and Status */ | |
| 852 | 845 | #define DWC3_TRB_SIZE_MASK (0x00ffffff) | |
| 853 | 846 | #define DWC3_TRB_SIZE_LENGTH(n) ((n) & DWC3_TRB_SIZE_MASK) | |
| @@ -1011,7 +1004,6 @@ struct dwc3_glue_ops { | |||
| 1011 | 1004 | /** | |
| 1012 | 1005 | * struct dwc3 - representation of our controller | |
| 1013 | 1006 | * @drd_work: workqueue used for role swapping | |
| 1014 | - | * @err_recovery_work: workqueue used for controller error recovery | |
| 1015 | 1007 | * @ep0_trb: trb which is used for the ctrl_req | |
| 1016 | 1008 | * @bounce: address of bounce buffer | |
| 1017 | 1009 | * @setup_buf: used while precessing STD USB requests | |
| @@ -1021,7 +1013,6 @@ struct dwc3_glue_ops { | |||
| 1021 | 1013 | * @ep0_in_setup: one control transfer is completed and enter setup phase | |
| 1022 | 1014 | * @lock: for synchronizing | |
| 1023 | 1015 | * @mutex: for mode switching | |
| 1024 | - | * @connect_mutex: for the pull-up and err_recovery_work | |
| 1025 | 1016 | * @dev: pointer to our struct device | |
| 1026 | 1017 | * @sysdev: pointer to the DMA-capable device | |
| 1027 | 1018 | * @xhci: pointer to our xHCI child | |
| @@ -1088,9 +1079,6 @@ struct dwc3_glue_ops { | |||
| 1088 | 1079 | * @ep0_next_event: hold the next expected event | |
| 1089 | 1080 | * @ep0state: state of endpoint zero | |
| 1090 | 1081 | * @link_state: link state | |
| 1091 | - | * @err_state: current error recovery state. | |
| 1092 | - | * @err_recovery_count: number of consecutive error recovery attempts until | |
| 1093 | - | * confirmed healthy and reset to 0 on reset event. | |
| 1094 | 1082 | * @speed: device speed (super, high, full, low) | |
| 1095 | 1083 | * @hwparams: copy of hwparams registers | |
| 1096 | 1084 | * @regset: debugfs pointer to regdump file | |
| @@ -1201,7 +1189,6 @@ struct dwc3_glue_ops { | |||
| 1201 | 1189 | */ | |
| 1202 | 1190 | struct dwc3 { | |
| 1203 | 1191 | struct work_struct drd_work; | |
| 1204 | - | struct work_struct err_recovery_work; | |
| 1205 | 1192 | struct dwc3_trb *ep0_trb; | |
| 1206 | 1193 | void *bounce; | |
| 1207 | 1194 | u8 *setup_buf; | |
| @@ -1216,9 +1203,6 @@ struct dwc3 { | |||
| 1216 | 1203 | /* mode switching lock */ | |
| 1217 | 1204 | struct mutex mutex; | |
| 1218 | 1205 | ||
| 1219 | - | /* serializes pull-up run/stop vs error recovery */ | |
| 1220 | - | struct mutex connect_mutex; | |
| 1221 | - | ||
| 1222 | 1206 | struct device *dev; | |
| 1223 | 1207 | struct device *sysdev; | |
| 1224 | 1208 | ||
| @@ -1348,9 +1332,6 @@ struct dwc3 { | |||
| 1348 | 1332 | enum dwc3_ep0_next ep0_next_event; | |
| 1349 | 1333 | enum dwc3_ep0_state ep0state; | |
| 1350 | 1334 | enum dwc3_link_state link_state; | |
| 1351 | - | enum dwc3_err_state err_state; | |
| 1352 | - | ||
| 1353 | - | u32 err_recovery_count; | |
| 1354 | 1335 | ||
| 1355 | 1336 | u16 u2sel; | |
| 1356 | 1337 | u16 u2pel; | |
modified drivers/usb/dwc3/dwc3-am62.c
| @@ -299,7 +299,6 @@ static int dwc3_ti_probe(struct platform_device *pdev) | |||
| 299 | 299 | ||
| 300 | 300 | err_pm_disable: | |
| 301 | 301 | clk_disable_unprepare(am62->usb2_refclk); | |
| 302 | - | pm_runtime_put_noidle(dev); | |
| 303 | 302 | pm_runtime_disable(dev); | |
| 304 | 303 | pm_runtime_set_suspended(dev); | |
| 305 | 304 | return ret; | |
modified drivers/usb/dwc3/ep0.c
| @@ -200,11 +200,6 @@ int dwc3_gadget_ep0_queue(struct usb_ep *ep, struct usb_request *request, | |||
| 200 | 200 | int ret; | |
| 201 | 201 | ||
| 202 | 202 | spin_lock_irqsave(&dwc->lock, flags); | |
| 203 | - | if (dwc->err_state != DWC3_ERR_NONE) { | |
| 204 | - | ret = -ESHUTDOWN; | |
| 205 | - | goto out; | |
| 206 | - | } | |
| 207 | - | ||
| 208 | 203 | if (!dep->endpoint.desc || !dwc->pullups_connected || !dwc->connected) { | |
| 209 | 204 | dev_err(dwc->dev, "%s: can't queue to disabled endpoint\n", | |
| 210 | 205 | dep->name); | |
| @@ -276,10 +271,6 @@ int dwc3_gadget_ep0_set_halt(struct usb_ep *ep, int value) | |||
| 276 | 271 | int ret; | |
| 277 | 272 | ||
| 278 | 273 | spin_lock_irqsave(&dwc->lock, flags); | |
| 279 | - | if (dwc->err_state != DWC3_ERR_NONE) { | |
| 280 | - | spin_unlock_irqrestore(&dwc->lock, flags); | |
| 281 | - | return -ESHUTDOWN; | |
| 282 | - | } | |
| 283 | 274 | ret = __dwc3_gadget_ep0_set_halt(ep, value); | |
| 284 | 275 | spin_unlock_irqrestore(&dwc->lock, flags); | |
| 285 | 276 | ||
modified drivers/usb/dwc3/gadget.c
| @@ -1149,10 +1149,6 @@ static int dwc3_gadget_ep_enable(struct usb_ep *ep, | |||
| 1149 | 1149 | return 0; | |
| 1150 | 1150 | ||
| 1151 | 1151 | spin_lock_irqsave(&dwc->lock, flags); | |
| 1152 | - | if (dwc->err_state != DWC3_ERR_NONE) { | |
| 1153 | - | spin_unlock_irqrestore(&dwc->lock, flags); | |
| 1154 | - | return -ESHUTDOWN; | |
| 1155 | - | } | |
| 1156 | 1152 | ret = __dwc3_gadget_ep_enable(dep, DWC3_DEPCFG_ACTION_INIT); | |
| 1157 | 1153 | spin_unlock_irqrestore(&dwc->lock, flags); | |
| 1158 | 1154 | ||
| @@ -2064,10 +2060,6 @@ static int dwc3_gadget_ep_queue(struct usb_ep *ep, struct usb_request *request, | |||
| 2064 | 2060 | int ret; | |
| 2065 | 2061 | ||
| 2066 | 2062 | spin_lock_irqsave(&dwc->lock, flags); | |
| 2067 | - | if (dwc->err_state != DWC3_ERR_NONE) { | |
| 2068 | - | spin_unlock_irqrestore(&dwc->lock, flags); | |
| 2069 | - | return -ESHUTDOWN; | |
| 2070 | - | } | |
| 2071 | 2063 | ret = __dwc3_gadget_ep_queue(dep, req); | |
| 2072 | 2064 | spin_unlock_irqrestore(&dwc->lock, flags); | |
| 2073 | 2065 | ||
| @@ -2300,10 +2292,6 @@ static int dwc3_gadget_ep_set_halt(struct usb_ep *ep, int value) | |||
| 2300 | 2292 | int ret; | |
| 2301 | 2293 | ||
| 2302 | 2294 | spin_lock_irqsave(&dwc->lock, flags); | |
| 2303 | - | if (dwc->err_state != DWC3_ERR_NONE) { | |
| 2304 | - | spin_unlock_irqrestore(&dwc->lock, flags); | |
| 2305 | - | return -ESHUTDOWN; | |
| 2306 | - | } | |
| 2307 | 2295 | ret = __dwc3_gadget_ep_set_halt(dep, value, false); | |
| 2308 | 2296 | spin_unlock_irqrestore(&dwc->lock, flags); | |
| 2309 | 2297 | ||
| @@ -2318,10 +2306,6 @@ static int dwc3_gadget_ep_set_wedge(struct usb_ep *ep) | |||
| 2318 | 2306 | int ret; | |
| 2319 | 2307 | ||
| 2320 | 2308 | spin_lock_irqsave(&dwc->lock, flags); | |
| 2321 | - | if (dwc->err_state != DWC3_ERR_NONE) { | |
| 2322 | - | spin_unlock_irqrestore(&dwc->lock, flags); | |
| 2323 | - | return -ESHUTDOWN; | |
| 2324 | - | } | |
| 2325 | 2309 | dep->flags |= DWC3_EP_WEDGE; | |
| 2326 | 2310 | ||
| 2327 | 2311 | if (dep->number == 0 || dep->number == 1) | |
| @@ -2453,10 +2437,6 @@ static int dwc3_gadget_wakeup(struct usb_gadget *g) | |||
| 2453 | 2437 | } | |
| 2454 | 2438 | ||
| 2455 | 2439 | spin_lock_irqsave(&dwc->lock, flags); | |
| 2456 | - | if (dwc->err_state != DWC3_ERR_NONE) { | |
| 2457 | - | spin_unlock_irqrestore(&dwc->lock, flags); | |
| 2458 | - | return -ESHUTDOWN; | |
| 2459 | - | } | |
| 2460 | 2440 | if (!dwc->gadget->wakeup_armed) { | |
| 2461 | 2441 | dev_err(dwc->dev, "not armed for remote wakeup\n"); | |
| 2462 | 2442 | spin_unlock_irqrestore(&dwc->lock, flags); | |
| @@ -2484,10 +2464,6 @@ static int dwc3_gadget_func_wakeup(struct usb_gadget *g, int intf_id) | |||
| 2484 | 2464 | } | |
| 2485 | 2465 | ||
| 2486 | 2466 | spin_lock_irqsave(&dwc->lock, flags); | |
| 2487 | - | if (dwc->err_state != DWC3_ERR_NONE) { | |
| 2488 | - | spin_unlock_irqrestore(&dwc->lock, flags); | |
| 2489 | - | return -ESHUTDOWN; | |
| 2490 | - | } | |
| 2491 | 2467 | /* | |
| 2492 | 2468 | * If the link is in U3, signal for remote wakeup and wait for the | |
| 2493 | 2469 | * link to transition to U0 before sending device notification. | |
| @@ -2857,13 +2833,10 @@ static int dwc3_gadget_pullup(struct usb_gadget *g, int is_on) | |||
| 2857 | 2833 | ||
| 2858 | 2834 | synchronize_irq(dwc->irq_gadget); | |
| 2859 | 2835 | ||
| 2860 | - | /* Serialize against dwc3_err_recovery_work() */ | |
| 2861 | - | mutex_lock(&dwc->connect_mutex); | |
| 2862 | 2836 | if (!is_on) | |
| 2863 | 2837 | ret = dwc3_gadget_soft_disconnect(dwc); | |
| 2864 | 2838 | else | |
| 2865 | 2839 | ret = dwc3_gadget_soft_connect(dwc); | |
| 2866 | - | mutex_unlock(&dwc->connect_mutex); | |
| 2867 | 2840 | ||
| 2868 | 2841 | pm_runtime_put(dwc->dev); | |
| 2869 | 2842 | ||
| @@ -4180,10 +4153,6 @@ static void dwc3_gadget_reset_interrupt(struct dwc3 *dwc) | |||
| 4180 | 4153 | ||
| 4181 | 4154 | dwc->suspended = false; | |
| 4182 | 4155 | ||
| 4183 | - | /* The controller is recovered. */ | |
| 4184 | - | if (dwc->err_state == DWC3_ERR_NONE) | |
| 4185 | - | dwc->err_recovery_count = 0; | |
| 4186 | - | ||
| 4187 | 4156 | /* | |
| 4188 | 4157 | * Ideally, dwc3_reset_gadget() would trigger the function | |
| 4189 | 4158 | * drivers to stop any active transfers through ep disable. | |
| @@ -4671,12 +4640,6 @@ static irqreturn_t dwc3_thread_interrupt(int irq, void *_evt) | |||
| 4671 | 4640 | return ret; | |
| 4672 | 4641 | } | |
| 4673 | 4642 | ||
| 4674 | - | static void dwc3_schedule_err_recovery(struct dwc3 *dwc) | |
| 4675 | - | { | |
| 4676 | - | dwc->err_state = DWC3_ERR_RECOVERY; | |
| 4677 | - | schedule_work(&dwc->err_recovery_work); | |
| 4678 | - | } | |
| 4679 | - | ||
| 4680 | 4643 | static irqreturn_t dwc3_check_event_buf(struct dwc3_event_buffer *evt) | |
| 4681 | 4644 | { | |
| 4682 | 4645 | struct dwc3 *dwc = evt->dwc; | |
| @@ -4710,21 +4673,9 @@ static irqreturn_t dwc3_check_event_buf(struct dwc3_event_buffer *evt) | |||
| 4710 | 4673 | return IRQ_NONE; | |
| 4711 | 4674 | ||
| 4712 | 4675 | if (count > evt->length) { | |
| 4713 | - | dev_err(dwc->dev, "invalid count(%u) > evt->length(%u)\n", | |
| 4676 | + | dev_err_ratelimited(dwc->dev, "invalid count(%u) > evt->length(%u)\n", | |
| 4714 | 4677 | count, evt->length); | |
| 4715 | - | /* | |
| 4716 | - | * This is a fatal error - the driver and controller are out of | |
| 4717 | - | * sync on which event has been consumed. Reinitializing the | |
| 4718 | - | * controller is required to recover. Write the bogus count back | |
| 4719 | - | * to GEVNTCOUNT to clear the IRQ source, consistent with the | |
| 4720 | - | * stale event clearing in dwc3_event_buffers_setup(), then | |
| 4721 | - | * schedule error recovery. | |
| 4722 | - | */ | |
| 4723 | - | spin_lock(&dwc->lock); | |
| 4724 | - | dwc3_schedule_err_recovery(dwc); | |
| 4725 | - | spin_unlock(&dwc->lock); | |
| 4726 | - | dwc3_writel(dwc, DWC3_GEVNTCOUNT(0), count); | |
| 4727 | - | return IRQ_HANDLED; | |
| 4678 | + | return IRQ_NONE; | |
| 4728 | 4679 | } | |
| 4729 | 4680 | ||
| 4730 | 4681 | evt->count = count; | |
| @@ -4784,57 +4735,6 @@ static void dwc_gadget_release(struct device *dev) | |||
| 4784 | 4735 | kfree(gadget); | |
| 4785 | 4736 | } | |
| 4786 | 4737 | ||
| 4787 | - | static void dwc3_err_recovery_work(struct work_struct *work) | |
| 4788 | - | { | |
| 4789 | - | struct dwc3 *dwc = container_of(work, struct dwc3, err_recovery_work); | |
| 4790 | - | unsigned long flags; | |
| 4791 | - | int ret; | |
| 4792 | - | ||
| 4793 | - | /* serializes against dwc3_gadget_pullup() */ | |
| 4794 | - | mutex_lock(&dwc->connect_mutex); | |
| 4795 | - | ||
| 4796 | - | ret = dwc3_gadget_soft_disconnect(dwc); | |
| 4797 | - | ||
| 4798 | - | dwc3_disconnect_gadget_sleepable(dwc); | |
| 4799 | - | ||
| 4800 | - | if (ret) | |
| 4801 | - | goto err_unrecoverable; | |
| 4802 | - | ||
| 4803 | - | if (dwc->softconnect) { | |
| 4804 | - | u32 count; | |
| 4805 | - | /* | |
| 4806 | - | * Wait irq to finish before soft_connect resets evt->lpos and | |
| 4807 | - | * the event buffer registers to avoid racing with | |
| 4808 | - | * dwc3_process_event_buf(). | |
| 4809 | - | */ | |
| 4810 | - | synchronize_irq(dwc->irq_gadget); | |
| 4811 | - | ||
| 4812 | - | spin_lock_irqsave(&dwc->lock, flags); | |
| 4813 | - | count = ++dwc->err_recovery_count; | |
| 4814 | - | spin_unlock_irqrestore(&dwc->lock, flags); | |
| 4815 | - | ||
| 4816 | - | if (count > DWC3_ERR_RECOVERY_MAX) | |
| 4817 | - | goto err_unrecoverable; | |
| 4818 | - | ||
| 4819 | - | ret = dwc3_gadget_soft_connect(dwc); | |
| 4820 | - | if (ret) | |
| 4821 | - | goto err_unrecoverable; | |
| 4822 | - | } | |
| 4823 | - | mutex_unlock(&dwc->connect_mutex); | |
| 4824 | - | ||
| 4825 | - | spin_lock_irqsave(&dwc->lock, flags); | |
| 4826 | - | dwc->err_state = DWC3_ERR_NONE; | |
| 4827 | - | spin_unlock_irqrestore(&dwc->lock, flags); | |
| 4828 | - | return; | |
| 4829 | - | ||
| 4830 | - | err_unrecoverable: | |
| 4831 | - | dev_err(dwc->dev, "Unable to recover the controller\n"); | |
| 4832 | - | mutex_unlock(&dwc->connect_mutex); | |
| 4833 | - | spin_lock_irqsave(&dwc->lock, flags); | |
| 4834 | - | dwc->err_state = DWC3_ERR_UNRECOVERABLE; | |
| 4835 | - | spin_unlock_irqrestore(&dwc->lock, flags); | |
| 4836 | - | } | |
| 4837 | - | ||
| 4838 | 4738 | /** | |
| 4839 | 4739 | * dwc3_gadget_init - initializes gadget related registers | |
| 4840 | 4740 | * @dwc: pointer to our controller context structure | |
| @@ -4878,8 +4778,6 @@ int dwc3_gadget_init(struct dwc3 *dwc) | |||
| 4878 | 4778 | } | |
| 4879 | 4779 | ||
| 4880 | 4780 | init_completion(&dwc->ep0_in_setup); | |
| 4881 | - | INIT_WORK(&dwc->err_recovery_work, dwc3_err_recovery_work); | |
| 4882 | - | mutex_init(&dwc->connect_mutex); | |
| 4883 | 4781 | dwc->gadget = kzalloc_obj(struct usb_gadget); | |
| 4884 | 4782 | if (!dwc->gadget) { | |
| 4885 | 4783 | ret = -ENOMEM; | |
| @@ -4976,8 +4874,6 @@ void dwc3_gadget_exit(struct dwc3 *dwc) | |||
| 4976 | 4874 | if (!dwc->gadget) | |
| 4977 | 4875 | return; | |
| 4978 | 4876 | ||
| 4979 | - | cancel_work_sync(&dwc->err_recovery_work); | |
| 4980 | - | mutex_destroy(&dwc->connect_mutex); | |
| 4981 | 4877 | dwc3_enable_susphy(dwc, true); | |
| 4982 | 4878 | usb_del_gadget(dwc->gadget); | |
| 4983 | 4879 | dwc3_gadget_free_endpoints(dwc); | |
modified drivers/usb/gadget/function/f_fs.c
| @@ -1877,9 +1877,8 @@ static long ffs_epfile_ioctl(struct file *file, unsigned code, | |||
| 1877 | 1877 | break; | |
| 1878 | 1878 | case FUNCTIONFS_ENDPOINT_DESC: | |
| 1879 | 1879 | { | |
| 1880 | - | const struct usb_endpoint_descriptor *desc; | |
| 1881 | - | struct usb_endpoint_descriptor desc1; | |
| 1882 | 1880 | int desc_idx; | |
| 1881 | + | struct usb_endpoint_descriptor desc1, *desc; | |
| 1883 | 1882 | ||
| 1884 | 1883 | switch (epfile->ffs->gadget->speed) { | |
| 1885 | 1884 | case USB_SPEED_SUPER: | |
| @@ -1893,17 +1892,7 @@ static long ffs_epfile_ioctl(struct file *file, unsigned code, | |||
| 1893 | 1892 | desc_idx = 0; | |
| 1894 | 1893 | } | |
| 1895 | 1894 | ||
| 1896 | - | do { | |
| 1897 | - | desc = epfile->ep->descs[desc_idx]; | |
| 1898 | - | } while (!desc && --desc_idx >= 0); | |
| 1899 | - | ||
| 1900 | - | if (!desc) | |
| 1901 | - | desc = epfile->ep->ep->desc; | |
| 1902 | - | if (!desc) { | |
| 1903 | - | ret = -EINVAL; | |
| 1904 | - | break; | |
| 1905 | - | } | |
| 1906 | - | ||
| 1895 | + | desc = epfile->ep->descs[desc_idx]; | |
| 1907 | 1896 | memcpy(&desc1, desc, desc->bLength); | |
| 1908 | 1897 | ||
| 1909 | 1898 | spin_unlock_irq(&epfile->ffs->eps_lock); | |
modified drivers/usb/gadget/function/f_midi2.c
| @@ -1633,8 +1633,8 @@ struct f_midi2_usb_config { | |||
| 1633 | 1633 | ||
| 1634 | 1634 | /* MIDI 1.0 jacks */ | |
| 1635 | 1635 | unsigned char jack_in, jack_out, jack_id; | |
| 1636 | - | struct usb_midi_in_jack_descriptor jack_ins[MAX_CABLES * 2]; | |
| 1637 | - | struct usb_midi_out_jack_descriptor_1 jack_outs[MAX_CABLES * 2]; | |
| 1636 | + | struct usb_midi_in_jack_descriptor jack_ins[MAX_CABLES]; | |
| 1637 | + | struct usb_midi_out_jack_descriptor_1 jack_outs[MAX_CABLES]; | |
| 1638 | 1638 | }; | |
| 1639 | 1639 | ||
| 1640 | 1640 | static int append_config(struct f_midi2_usb_config *config, void *d) | |
modified drivers/usb/gadget/function/f_uac1_legacy.c
| @@ -797,9 +797,6 @@ fail: | |||
| 797 | 797 | ||
| 798 | 798 | static int generic_set_cmd(struct usb_audio_control *con, u8 cmd, int value) | |
| 799 | 799 | { | |
| 800 | - | if (cmd >= ARRAY_SIZE(con->data)) | |
| 801 | - | return -EINVAL; | |
| 802 | - | ||
| 803 | 800 | con->data[cmd] = value; | |
| 804 | 801 | ||
| 805 | 802 | return 0; | |
| @@ -807,9 +804,6 @@ static int generic_set_cmd(struct usb_audio_control *con, u8 cmd, int value) | |||
| 807 | 804 | ||
| 808 | 805 | static int generic_get_cmd(struct usb_audio_control *con, u8 cmd) | |
| 809 | 806 | { | |
| 810 | - | if (cmd >= ARRAY_SIZE(con->data)) | |
| 811 | - | return -EINVAL; | |
| 812 | - | ||
| 813 | 807 | return con->data[cmd]; | |
| 814 | 808 | } | |
| 815 | 809 | ||
modified drivers/usb/gadget/udc/aspeed-vhub/core.c
| @@ -267,9 +267,6 @@ static void ast_vhub_remove(struct platform_device *pdev) | |||
| 267 | 267 | for (i = 0; i < vhub->max_ports; i++) | |
| 268 | 268 | ast_vhub_del_dev(&vhub->ports[i].dev); | |
| 269 | 269 | ||
| 270 | - | /* Final drain; the worker takes vhub->lock, so stay outside of it */ | |
| 271 | - | cancel_work_sync(&vhub->wake_work); | |
| 272 | - | ||
| 273 | 270 | spin_lock_irqsave(&vhub->lock, flags); | |
| 274 | 271 | ||
| 275 | 272 | /* Mask & ack all interrupts */ | |
| @@ -331,7 +328,6 @@ static int ast_vhub_probe(struct platform_device *pdev) | |||
| 331 | 328 | return -ENOMEM; | |
| 332 | 329 | ||
| 333 | 330 | spin_lock_init(&vhub->lock); | |
| 334 | - | INIT_WORK(&vhub->wake_work, ast_vhub_wake_work); | |
| 335 | 331 | vhub->pdev = pdev; | |
| 336 | 332 | vhub->port_irq_mask = GENMASK(VHUB_IRQ_DEV1_BIT + vhub->max_ports - 1, | |
| 337 | 333 | VHUB_IRQ_DEV1_BIT); | |
modified drivers/usb/gadget/udc/aspeed-vhub/dev.c
| @@ -280,7 +280,7 @@ static int ast_vhub_udc_wakeup(struct usb_gadget* gadget) | |||
| 280 | 280 | int rc = -EINVAL; | |
| 281 | 281 | ||
| 282 | 282 | spin_lock_irqsave(&d->vhub->lock, flags); | |
| 283 | - | if (!d->wakeup_en || !d->registered) | |
| 283 | + | if (!d->wakeup_en) | |
| 284 | 284 | goto err; | |
| 285 | 285 | ||
| 286 | 286 | DDBG(d, "Device initiated wakeup\n"); | |
modified drivers/usb/gadget/udc/aspeed-vhub/hub.c
| @@ -558,7 +558,7 @@ void ast_vhub_device_connect(struct ast_vhub *vhub, | |||
| 558 | 558 | ast_vhub_send_host_wakeup(vhub); | |
| 559 | 559 | } | |
| 560 | 560 | ||
| 561 | - | void ast_vhub_wake_work(struct work_struct *work) | |
| 561 | + | static void ast_vhub_wake_work(struct work_struct *work) | |
| 562 | 562 | { | |
| 563 | 563 | struct ast_vhub *vhub = container_of(work, | |
| 564 | 564 | struct ast_vhub, | |
| @@ -588,8 +588,6 @@ void ast_vhub_wake_work(struct work_struct *work) | |||
| 588 | 588 | ||
| 589 | 589 | void ast_vhub_hub_wake_all(struct ast_vhub *vhub) | |
| 590 | 590 | { | |
| 591 | - | lockdep_assert_held(&vhub->lock); | |
| 592 | - | ||
| 593 | 591 | /* | |
| 594 | 592 | * A device is trying to wake the world, because this | |
| 595 | 593 | * can recurse into the device, we break the call chain | |
| @@ -1078,6 +1076,7 @@ static int ast_vhub_init_desc(struct ast_vhub *vhub) | |||
| 1078 | 1076 | int ast_vhub_init_hub(struct ast_vhub *vhub) | |
| 1079 | 1077 | { | |
| 1080 | 1078 | vhub->speed = USB_SPEED_UNKNOWN; | |
| 1079 | + | INIT_WORK(&vhub->wake_work, ast_vhub_wake_work); | |
| 1081 | 1080 | ||
| 1082 | 1081 | return ast_vhub_init_desc(vhub); | |
| 1083 | 1082 | } | |
modified drivers/usb/gadget/udc/aspeed-vhub/vhub.h
| @@ -547,7 +547,6 @@ void ast_vhub_hub_suspend(struct ast_vhub *vhub); | |||
| 547 | 547 | void ast_vhub_hub_resume(struct ast_vhub *vhub); | |
| 548 | 548 | void ast_vhub_hub_reset(struct ast_vhub *vhub); | |
| 549 | 549 | void ast_vhub_hub_wake_all(struct ast_vhub *vhub); | |
| 550 | - | void ast_vhub_wake_work(struct work_struct *work); | |
| 551 | 550 | ||
| 552 | 551 | /* dev.c */ | |
| 553 | 552 | int ast_vhub_init_dev(struct ast_vhub *vhub, unsigned int idx); | |
modified drivers/usb/gadget/udc/dummy_hcd.c
| @@ -343,11 +343,9 @@ static void dummy_giveback(struct dummy *dum, struct usb_ep *_ep, | |||
| 343 | 343 | { | |
| 344 | 344 | bool fifo = req == &dum->fifo_req; | |
| 345 | 345 | ||
| 346 | - | ++dum->callback_usage; | |
| 347 | 346 | spin_unlock(&dum->lock); | |
| 348 | 347 | usb_gadget_giveback_request(_ep, &req->req); | |
| 349 | 348 | spin_lock(&dum->lock); | |
| 350 | - | --dum->callback_usage; | |
| 351 | 349 | if (fifo) | |
| 352 | 350 | dum->fifo_req_busy = 0; | |
| 353 | 351 | } | |
| @@ -761,13 +759,11 @@ static int dummy_queue(struct usb_ep *_ep, struct usb_request *_req, | |||
| 761 | 759 | req->req.complete = fifo_complete; | |
| 762 | 760 | ||
| 763 | 761 | list_add_tail(&req->queue, &ep->queue); | |
| 764 | - | ++dum->callback_usage; | |
| 765 | 762 | spin_unlock(&dum->lock); | |
| 766 | 763 | _req->actual = _req->length; | |
| 767 | 764 | _req->status = 0; | |
| 768 | 765 | usb_gadget_giveback_request(_ep, _req); | |
| 769 | 766 | spin_lock(&dum->lock); | |
| 770 | - | --dum->callback_usage; | |
| 771 | 767 | } else | |
| 772 | 768 | list_add_tail(&req->queue, &ep->queue); | |
| 773 | 769 | spin_unlock_irqrestore(&dum->lock, flags); | |
modified drivers/usb/host/octeon-hcd.c
| @@ -378,22 +378,8 @@ struct octeon_hcd { | |||
| 378 | 378 | struct cvmx_usb_transaction *active_split; | |
| 379 | 379 | struct cvmx_usb_tx_fifo periodic; | |
| 380 | 380 | struct cvmx_usb_tx_fifo nonperiodic; | |
| 381 | - | struct hrtimer sof_timer; | |
| 382 | 381 | }; | |
| 383 | 382 | ||
| 384 | - | static int cvmx_usb_poll(struct octeon_hcd *usb); | |
| 385 | - | ||
| 386 | - | static enum hrtimer_restart octeon_usb_sof_timer(struct hrtimer *t) | |
| 387 | - | { | |
| 388 | - | struct octeon_hcd *usb = container_of(t, struct octeon_hcd, sof_timer); | |
| 389 | - | unsigned long flags; | |
| 390 | - | ||
| 391 | - | spin_lock_irqsave(&usb->lock, flags); | |
| 392 | - | cvmx_usb_poll(usb); | |
| 393 | - | spin_unlock_irqrestore(&usb->lock, flags); | |
| 394 | - | return HRTIMER_NORESTART; | |
| 395 | - | } | |
| 396 | - | ||
| 397 | 383 | /* | |
| 398 | 384 | * This macro logically sets a single field in a CSR. It does the sequence | |
| 399 | 385 | * read, modify, and write | |
| @@ -592,7 +578,7 @@ static int cvmx_wait_tx_rx(struct octeon_hcd *usb, int fflsh_type) | |||
| 592 | 578 | int result; | |
| 593 | 579 | u64 address = CVMX_USBCX_GRSTCTL(usb->index); | |
| 594 | 580 | u64 done = cvmx_get_cycle() + 100 * | |
| 595 | - | (u64)octeon_get_clock_rate() / 1000000; | |
| 581 | + | (u64)octeon_get_clock_rate / 1000000; | |
| 596 | 582 | union cvmx_usbcx_grstctl c; | |
| 597 | 583 | ||
| 598 | 584 | while (1) { | |
| @@ -867,14 +853,6 @@ retry: | |||
| 867 | 853 | * USBC_GAHBCFG[PTXFEMPLVL] | |
| 868 | 854 | * Global interrupt mask, USBC_GAHBCFG[GLBLINTRMSK] = 1 | |
| 869 | 855 | */ | |
| 870 | - | usbcx_gahbcfg.u32 = cvmx_usb_read_csr32(usb, | |
| 871 | - | CVMX_USBCX_GHWCFG3(usb->index)); | |
| 872 | - | if (usbcx_gahbcfg.u32 == 0xffffffff || usbcx_gahbcfg.u32 == 0) { | |
| 873 | - | dev_err(dev, "USB core is not responding (GHWCFG3=0x%08x)\n", | |
| 874 | - | usbcx_gahbcfg.u32); | |
| 875 | - | return -ENODEV; | |
| 876 | - | } | |
| 877 | - | ||
| 878 | 856 | usbcx_gahbcfg.u32 = 0; | |
| 879 | 857 | usbcx_gahbcfg.s.dmaen = !(usb->init_flags & | |
| 880 | 858 | CVMX_USB_INITIALIZE_FLAGS_NO_DMA); | |
| @@ -1922,7 +1900,6 @@ static void cvmx_usb_schedule(struct octeon_hcd *usb, int is_sof) | |||
| 1922 | 1900 | int channel; | |
| 1923 | 1901 | struct cvmx_usb_pipe *pipe; | |
| 1924 | 1902 | int need_sof; | |
| 1925 | - | u64 min_due; | |
| 1926 | 1903 | enum cvmx_usb_transfer ttype; | |
| 1927 | 1904 | ||
| 1928 | 1905 | if (usb->init_flags & CVMX_USB_INITIALIZE_FLAGS_NO_DMA) { | |
| @@ -1963,33 +1940,15 @@ done: | |||
| 1963 | 1940 | * future that might need to be scheduled | |
| 1964 | 1941 | */ | |
| 1965 | 1942 | need_sof = 0; | |
| 1966 | - | min_due = ~0ull; | |
| 1967 | 1943 | for (ttype = CVMX_USB_TRANSFER_CONTROL; | |
| 1968 | 1944 | ttype <= CVMX_USB_TRANSFER_INTERRUPT; ttype++) { | |
| 1969 | 1945 | list_for_each_entry(pipe, &usb->active_pipes[ttype], node) { | |
| 1970 | - | if (pipe->next_tx_frame > usb->frame_number && | |
| 1971 | - | pipe->next_tx_frame < min_due) | |
| 1972 | - | min_due = pipe->next_tx_frame; | |
| 1946 | + | if (pipe->next_tx_frame > usb->frame_number) { | |
| 1947 | + | need_sof = 1; | |
| 1948 | + | break; | |
| 1949 | + | } | |
| 1973 | 1950 | } | |
| 1974 | 1951 | } | |
| 1975 | - | if (min_due != ~0ull) { | |
| 1976 | - | u64 delta = min_due - usb->frame_number; | |
| 1977 | - | ||
| 1978 | - | /* | |
| 1979 | - | * frame_number is resynced from HFNUM on every poll, so a | |
| 1980 | - | * deadline that is many frames away does not need an | |
| 1981 | - | * interrupt on every SOF to count them down - sleep on the | |
| 1982 | - | * timer instead and keep SOF interrupts for deadlines within | |
| 1983 | - | * a few frames. Stay well below the 16383-frame wrap of | |
| 1984 | - | * HFNUM. One (micro)frame is 125us in high-speed mode. | |
| 1985 | - | */ | |
| 1986 | - | if (delta <= 4 || delta > 8000) | |
| 1987 | - | need_sof = 1; | |
| 1988 | - | else | |
| 1989 | - | hrtimer_start(&usb->sof_timer, | |
| 1990 | - | ns_to_ktime((delta - 2) * 125000), | |
| 1991 | - | HRTIMER_MODE_REL); | |
| 1992 | - | } | |
| 1993 | 1952 | USB_SET_FIELD32(CVMX_USBCX_GINTMSK(usb->index), | |
| 1994 | 1953 | cvmx_usbcx_gintmsk, sofmsk, need_sof); | |
| 1995 | 1954 | } | |
| @@ -3679,8 +3638,6 @@ static int octeon_usb_probe(struct platform_device *pdev) | |||
| 3679 | 3638 | usb = (struct octeon_hcd *)hcd->hcd_priv; | |
| 3680 | 3639 | ||
| 3681 | 3640 | spin_lock_init(&usb->lock); | |
| 3682 | - | hrtimer_setup(&usb->sof_timer, octeon_usb_sof_timer, CLOCK_MONOTONIC, | |
| 3683 | - | HRTIMER_MODE_REL); | |
| 3684 | 3641 | ||
| 3685 | 3642 | usb->init_flags = initialize_flags; | |
| 3686 | 3643 | ||
| @@ -3731,7 +3688,6 @@ static void octeon_usb_remove(struct platform_device *pdev) | |||
| 3731 | 3688 | unsigned long flags; | |
| 3732 | 3689 | ||
| 3733 | 3690 | usb_remove_hcd(hcd); | |
| 3734 | - | hrtimer_cancel(&usb->sof_timer); | |
| 3735 | 3691 | spin_lock_irqsave(&usb->lock, flags); | |
| 3736 | 3692 | status = cvmx_usb_shutdown(usb); | |
| 3737 | 3693 | spin_unlock_irqrestore(&usb->lock, flags); | |
modified drivers/usb/host/ohci-da8xx.c
| @@ -447,7 +447,6 @@ static int ohci_da8xx_probe(struct platform_device *pdev) | |||
| 447 | 447 | ||
| 448 | 448 | err_remove_hcd: | |
| 449 | 449 | usb_remove_hcd(hcd); | |
| 450 | - | device_wakeup_disable(hcd->self.controller); | |
| 451 | 450 | err: | |
| 452 | 451 | usb_put_hcd(hcd); | |
| 453 | 452 | return error; | |
| @@ -458,7 +457,6 @@ static void ohci_da8xx_remove(struct platform_device *pdev) | |||
| 458 | 457 | struct usb_hcd *hcd = platform_get_drvdata(pdev); | |
| 459 | 458 | ||
| 460 | 459 | usb_remove_hcd(hcd); | |
| 461 | - | device_wakeup_disable(hcd->self.controller); | |
| 462 | 460 | usb_put_hcd(hcd); | |
| 463 | 461 | } | |
| 464 | 462 | ||
modified drivers/usb/host/ohci-s3c2410.c
| @@ -335,7 +335,6 @@ ohci_hcd_s3c2410_remove(struct platform_device *dev) | |||
| 335 | 335 | struct usb_hcd *hcd = platform_get_drvdata(dev); | |
| 336 | 336 | ||
| 337 | 337 | usb_remove_hcd(hcd); | |
| 338 | - | device_wakeup_disable(hcd->self.controller); | |
| 339 | 338 | s3c2410_stop_hc(dev); | |
| 340 | 339 | usb_put_hcd(hcd); | |
| 341 | 340 | } | |
modified drivers/usb/host/ohci-spear.c
| @@ -103,7 +103,6 @@ static void spear_ohci_hcd_drv_remove(struct platform_device *pdev) | |||
| 103 | 103 | struct spear_ohci *sohci_p = to_spear_ohci(hcd); | |
| 104 | 104 | ||
| 105 | 105 | usb_remove_hcd(hcd); | |
| 106 | - | device_wakeup_disable(hcd->self.controller); | |
| 107 | 106 | clk_disable_unprepare(sohci_p->clk); | |
| 108 | 107 | ||
| 109 | 108 | usb_put_hcd(hcd); | |
modified drivers/usb/host/ohci-st.c
| @@ -235,7 +235,6 @@ static void st_ohci_platform_remove(struct platform_device *dev) | |||
| 235 | 235 | int clk; | |
| 236 | 236 | ||
| 237 | 237 | usb_remove_hcd(hcd); | |
| 238 | - | device_wakeup_disable(hcd->self.controller); | |
| 239 | 238 | ||
| 240 | 239 | if (pdata->power_off) | |
| 241 | 240 | pdata->power_off(dev); | |
modified drivers/usb/mtu3/mtu3_trace.h
| @@ -224,7 +224,6 @@ DECLARE_EVENT_CLASS(mtu3_log_ep, | |||
| 224 | 224 | __field(unsigned int, flags) | |
| 225 | 225 | __field(unsigned int, direction) | |
| 226 | 226 | __field(struct mtu3_gpd_ring *, gpd_ring) | |
| 227 | - | __field(dma_addr_t, gpd_ring_dma) | |
| 228 | 227 | ), | |
| 229 | 228 | TP_fast_assign( | |
| 230 | 229 | __assign_str(name); | |
| @@ -236,13 +235,12 @@ DECLARE_EVENT_CLASS(mtu3_log_ep, | |||
| 236 | 235 | __entry->flags = mep->flags; | |
| 237 | 236 | __entry->direction = mep->is_in; | |
| 238 | 237 | __entry->gpd_ring = &mep->gpd_ring; | |
| 239 | - | __entry->gpd_ring_dma = mep->gpd_ring.dma | |
| 240 | 238 | ), | |
| 241 | 239 | TP_printk("%s: type %s maxp %d slot %d mult %d burst %d ring %p/%pad flags %c:%c%c%c:%c", | |
| 242 | 240 | __get_str(name), usb_ep_type_string(__entry->type), | |
| 243 | 241 | __entry->maxp, __entry->slot, | |
| 244 | 242 | __entry->mult, __entry->maxburst, | |
| 245 | - | __entry->gpd_ring, &__entry->gpd_ring_dma, | |
| 243 | + | __entry->gpd_ring, &__entry->gpd_ring->dma, | |
| 246 | 244 | __entry->flags & MTU3_EP_ENABLED ? 'E' : 'e', | |
| 247 | 245 | __entry->flags & MTU3_EP_STALL ? 'S' : 's', | |
| 248 | 246 | __entry->flags & MTU3_EP_WEDGE ? 'W' : 'w', | |
modified drivers/usb/serial/bus.c
| @@ -165,11 +165,7 @@ int usb_serial_bus_register(struct usb_serial_driver *driver) | |||
| 165 | 165 | ||
| 166 | 166 | void usb_serial_bus_deregister(struct usb_serial_driver *driver) | |
| 167 | 167 | { | |
| 168 | - | driver_unregister(&driver->driver); | |
| 169 | 168 | free_dynids(driver); | |
| 169 | + | driver_unregister(&driver->driver); | |
| 170 | 170 | } | |
| 171 | 171 | ||
| 172 | - | void usb_serial_bus_remove_new_id(struct usb_serial_driver *driver) | |
| 173 | - | { | |
| 174 | - | driver_remove_file(&driver->driver, &driver_attr_new_id); | |
| 175 | - | } | |
modified drivers/usb/serial/cp210x.c
| @@ -223,7 +223,6 @@ static const struct usb_device_id id_table[] = { | |||
| 223 | 223 | { USB_DEVICE(0x19CF, 0x3000) }, /* Parrot NMEA GPS Flight Recorder */ | |
| 224 | 224 | { USB_DEVICE(0x1ADB, 0x0001) }, /* Schweitzer Engineering C662 Cable */ | |
| 225 | 225 | { USB_DEVICE(0x1B1C, 0x1C00) }, /* Corsair USB Dongle */ | |
| 226 | - | { USB_DEVICE(0x1B1C, 0x1C02) }, /* Corsair AX1500i Power Supply */ | |
| 227 | 226 | { USB_DEVICE(0x1B93, 0x1013) }, /* Phoenix Contact UPS Device */ | |
| 228 | 227 | { USB_DEVICE(0x1BA4, 0x0002) }, /* Silicon Labs 358x factory default */ | |
| 229 | 228 | { USB_DEVICE(0x1BE3, 0x07A6) }, /* WAGO 750-923 USB Service Cable */ | |
modified drivers/usb/serial/generic.c
| @@ -266,7 +266,6 @@ EXPORT_SYMBOL_GPL(usb_serial_generic_chars_in_buffer); | |||
| 266 | 266 | void usb_serial_generic_wait_until_sent(struct tty_struct *tty, long timeout) | |
| 267 | 267 | { | |
| 268 | 268 | struct usb_serial_port *port = tty->driver_data; | |
| 269 | - | struct tty_port *tport = &port->port; | |
| 270 | 269 | unsigned int bps; | |
| 271 | 270 | unsigned long period; | |
| 272 | 271 | unsigned long expire; | |
| @@ -286,14 +285,7 @@ void usb_serial_generic_wait_until_sent(struct tty_struct *tty, long timeout) | |||
| 286 | 285 | __func__, jiffies_to_msecs(timeout), | |
| 287 | 286 | jiffies_to_msecs(period)); | |
| 288 | 287 | expire = jiffies + timeout; | |
| 289 | - | for (;;) { | |
| 290 | - | mutex_lock(&tport->mutex); | |
| 291 | - | if (tty_io_error(tty) || port->serial->type->tx_empty(port)) { | |
| 292 | - | mutex_unlock(&tport->mutex); | |
| 293 | - | break; | |
| 294 | - | } | |
| 295 | - | mutex_unlock(&tport->mutex); | |
| 296 | - | ||
| 288 | + | while (!port->serial->type->tx_empty(port)) { | |
| 297 | 289 | schedule_timeout_interruptible(period); | |
| 298 | 290 | if (signal_pending(current)) | |
| 299 | 291 | break; | |
modified drivers/usb/serial/option.c
| @@ -260,7 +260,6 @@ static void option_instat_callback(struct urb *urb); | |||
| 260 | 260 | #define QUECTEL_PRODUCT_EM060K_12a 0x012a | |
| 261 | 261 | #define QUECTEL_PRODUCT_EM060K_12b 0x012b | |
| 262 | 262 | #define QUECTEL_PRODUCT_EM060K_12c 0x012c | |
| 263 | - | #define QUECTEL_PRODUCT_RG660QB 0x013d | |
| 264 | 263 | #define QUECTEL_PRODUCT_EG91 0x0191 | |
| 265 | 264 | #define QUECTEL_PRODUCT_EG95 0x0195 | |
| 266 | 265 | #define QUECTEL_PRODUCT_BG96 0x0296 | |
| @@ -281,7 +280,6 @@ static void option_instat_callback(struct urb *urb); | |||
| 281 | 280 | #define QUECTEL_PRODUCT_EC200U 0x0901 | |
| 282 | 281 | #define QUECTEL_PRODUCT_EG912Y 0x6001 | |
| 283 | 282 | #define QUECTEL_PRODUCT_EC200S_CN 0x6002 | |
| 284 | - | #define QUECTEL_PRODUCT_EG060W 0x6004 | |
| 285 | 283 | #define QUECTEL_PRODUCT_EC200A 0x6005 | |
| 286 | 284 | #define QUECTEL_PRODUCT_EG916Q 0x6007 | |
| 287 | 285 | #define QUECTEL_PRODUCT_EM061K_LWW 0x6008 | |
| @@ -1270,15 +1268,12 @@ static const struct usb_device_id option_ids[] = { | |||
| 1270 | 1268 | { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC200A, 0xff, 0, 0) }, | |
| 1271 | 1269 | { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC200U, 0xff, 0, 0) }, | |
| 1272 | 1270 | { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC200S_CN, 0xff, 0, 0) }, | |
| 1273 | - | { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EG060W, 0xff, 0, 0) }, | |
| 1274 | 1271 | { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EC200T, 0xff, 0, 0) }, | |
| 1275 | 1272 | { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EG912Y, 0xff, 0, 0) }, | |
| 1276 | 1273 | { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_EG916Q, 0xff, 0x00, 0x00) }, | |
| 1277 | 1274 | { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RM500K, 0xff, 0x00, 0x00) }, | |
| 1278 | 1275 | { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RG650V, 0xff, 0xff, 0x30) }, | |
| 1279 | 1276 | { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RG650V, 0xff, 0, 0) }, | |
| 1280 | - | { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RG660QB, 0xff, 0xff, 0x30) }, | |
| 1281 | - | { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RG660QB, 0xff, 0, 0) }, | |
| 1282 | 1277 | { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RG255C, 0xff, 0xff, 0x30) }, | |
| 1283 | 1278 | { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RG255C, 0xff, 0, 0) }, | |
| 1284 | 1279 | { USB_DEVICE_AND_INTERFACE_INFO(QUECTEL_VENDOR_ID, QUECTEL_PRODUCT_RG255C, 0xff, 0xff, 0x40) }, | |
| @@ -2173,8 +2168,6 @@ static const struct usb_device_id option_ids[] = { | |||
| 2173 | 2168 | { USB_DEVICE_INTERFACE_CLASS(0x1e0e, 0x9003, 0xff) }, /* Simcom SIM7500/SIM7600 MBIM mode */ | |
| 2174 | 2169 | { USB_DEVICE_INTERFACE_CLASS(0x1e0e, 0x9011, 0xff), /* Simcom SIM7500/SIM7600 RNDIS mode */ | |
| 2175 | 2170 | .driver_info = RSVD(7) }, | |
| 2176 | - | { USB_DEVICE_INTERFACE_CLASS(0x1e0e, 0x902b, 0xff), | |
| 2177 | - | .driver_info = RSVD(4) }, | |
| 2178 | 2171 | { USB_DEVICE(0x1e0e, 0x9071), /* Simcom SIM8230 RMNET mode */ | |
| 2179 | 2172 | .driver_info = RSVD(3) | RSVD(4) }, | |
| 2180 | 2173 | { USB_DEVICE_INTERFACE_CLASS(0x1e0e, 0x9078, 0xff), /* Simcom SIM8230 ECM mode */ | |
| @@ -2436,13 +2429,6 @@ static const struct usb_device_id option_ids[] = { | |||
| 2436 | 2429 | .driver_info = RSVD(5) }, | |
| 2437 | 2430 | { USB_DEVICE_INTERFACE_CLASS(0x0489, 0xe167, 0xff), /* Foxconn T99W640 MBIM */ | |
| 2438 | 2431 | .driver_info = RSVD(3) }, | |
| 2439 | - | { USB_DEVICE_AND_INTERFACE_INFO(0x04b7, 0x4d22, 0xff, 0x10, 0x01) }, /* Compal EXC-T1 */ | |
| 2440 | - | { USB_DEVICE_AND_INTERFACE_INFO(0x04b7, 0x4d22, 0xff, 0x10, 0x02) }, | |
| 2441 | - | { USB_DEVICE_AND_INTERFACE_INFO(0x04b7, 0x4d22, 0xff, 0x10, 0x03) }, | |
| 2442 | - | { USB_DEVICE_AND_INTERFACE_INFO(0x04b7, 0x4d22, 0xff, 0x10, 0x04) }, | |
| 2443 | - | { USB_DEVICE_AND_INTERFACE_INFO(0x04b7, 0x8217, 0xff, 0xff, 0x30) }, /* Compal EXM-G1x */ | |
| 2444 | - | { USB_DEVICE_AND_INTERFACE_INFO(0x04b7, 0x8217, 0xff, 0xff, 0x40) }, | |
| 2445 | - | { USB_DEVICE_AND_INTERFACE_INFO(0x04b7, 0x8217, 0xff, 0xff, 0x60) }, | |
| 2446 | 2432 | { USB_DEVICE(0x1508, 0x1001), /* Fibocom NL668 (IOT version) */ | |
| 2447 | 2433 | .driver_info = RSVD(4) | RSVD(5) | RSVD(6) }, | |
| 2448 | 2434 | { USB_DEVICE(0x1782, 0x4d10) }, /* Fibocom L610 (AT mode) */ | |
modified drivers/usb/serial/quatech2.c
| @@ -52,7 +52,6 @@ | |||
| 52 | 52 | #define QT2_XMIT_FLUSH 0x05 /* no following info */ | |
| 53 | 53 | #define QT2_CONTROL_ESCAPE 0xff /* pass through previous 2 control bytes */ | |
| 54 | 54 | ||
| 55 | - | #define MIN_BAUD_RATE 50 | |
| 56 | 55 | #define MAX_BAUD_RATE 921600 | |
| 57 | 56 | #define DEFAULT_BAUD_RATE 9600 | |
| 58 | 57 | ||
| @@ -157,7 +156,7 @@ static inline int calc_baud_divisor(int baudrate) | |||
| 157 | 156 | ||
| 158 | 157 | static inline int qt2_set_port_config(struct usb_device *dev, | |
| 159 | 158 | unsigned char port_number, | |
| 160 | - | speed_t baudrate, u16 lcr) | |
| 159 | + | u16 baudrate, u16 lcr) | |
| 161 | 160 | { | |
| 162 | 161 | int divisor = calc_baud_divisor(baudrate); | |
| 163 | 162 | u16 index = ((u16) (lcr << 8) | (u16) (port_number)); | |
| @@ -258,9 +257,9 @@ static void qt2_set_termios(struct tty_struct *tty, | |||
| 258 | 257 | struct usb_device *dev = port->serial->dev; | |
| 259 | 258 | struct qt2_port_private *port_priv; | |
| 260 | 259 | struct ktermios *termios = &tty->termios; | |
| 260 | + | u16 baud; | |
| 261 | 261 | unsigned int cflag = termios->c_cflag; | |
| 262 | 262 | u16 new_lcr = 0; | |
| 263 | - | speed_t baud; | |
| 264 | 263 | int status; | |
| 265 | 264 | ||
| 266 | 265 | port_priv = usb_get_serial_port_data(port); | |
| @@ -278,18 +277,6 @@ static void qt2_set_termios(struct tty_struct *tty, | |||
| 278 | 277 | if (!baud) | |
| 279 | 278 | baud = 9600; | |
| 280 | 279 | ||
| 281 | - | if (baud < MIN_BAUD_RATE || baud > MAX_BAUD_RATE) { | |
| 282 | - | if (old_termios) | |
| 283 | - | baud = tty_termios_baud_rate(old_termios); | |
| 284 | - | else | |
| 285 | - | baud = clamp(baud, MIN_BAUD_RATE, MAX_BAUD_RATE); | |
| 286 | - | ||
| 287 | - | tty_encode_baud_rate(tty, baud, baud); | |
| 288 | - | ||
| 289 | - | if (!baud) | |
| 290 | - | baud = 9600; | |
| 291 | - | } | |
| 292 | - | ||
| 293 | 280 | status = qt2_set_port_config(dev, port_priv->device_port, baud, | |
| 294 | 281 | new_lcr); | |
| 295 | 282 | if (status < 0) | |
| @@ -386,7 +373,7 @@ static int qt2_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
| 386 | 373 | port_priv->device_port = (u8) device_port; | |
| 387 | 374 | ||
| 388 | 375 | if (tty) | |
| 389 | - | qt2_set_termios(tty, port, NULL); | |
| 376 | + | qt2_set_termios(tty, port, &tty->termios); | |
| 390 | 377 | ||
| 391 | 378 | return 0; | |
| 392 | 379 | ||
modified drivers/usb/serial/ssu100.c
| @@ -32,7 +32,6 @@ | |||
| 32 | 32 | ||
| 33 | 33 | #define SERIAL_EVEN_PARITY (UART_LCR_PARITY | UART_LCR_EPAR) | |
| 34 | 34 | ||
| 35 | - | #define MIN_BAUD_RATE 50 | |
| 36 | 35 | #define MAX_BAUD_RATE 460800 | |
| 37 | 36 | ||
| 38 | 37 | #define ATC_DISABLED 0x00 | |
| @@ -218,10 +217,9 @@ static void ssu100_set_termios(struct tty_struct *tty, | |||
| 218 | 217 | { | |
| 219 | 218 | struct usb_device *dev = port->serial->dev; | |
| 220 | 219 | struct ktermios *termios = &tty->termios; | |
| 221 | - | speed_t baud, remainder; | |
| 220 | + | u16 baud, divisor, remainder; | |
| 222 | 221 | unsigned int cflag = termios->c_cflag; | |
| 223 | 222 | u16 urb_value = 0; /* will hold the new flags */ | |
| 224 | - | u16 divisor; | |
| 225 | 223 | int result; | |
| 226 | 224 | ||
| 227 | 225 | if (cflag & PARENB) { | |
| @@ -237,18 +235,6 @@ static void ssu100_set_termios(struct tty_struct *tty, | |||
| 237 | 235 | if (!baud) | |
| 238 | 236 | baud = 9600; | |
| 239 | 237 | ||
| 240 | - | if (baud < MIN_BAUD_RATE || baud > MAX_BAUD_RATE) { | |
| 241 | - | if (old_termios) | |
| 242 | - | baud = tty_termios_baud_rate(old_termios); | |
| 243 | - | else | |
| 244 | - | baud = clamp(baud, MIN_BAUD_RATE, MAX_BAUD_RATE); | |
| 245 | - | ||
| 246 | - | tty_encode_baud_rate(tty, baud, baud); | |
| 247 | - | ||
| 248 | - | if (!baud) | |
| 249 | - | baud = 9600; | |
| 250 | - | } | |
| 251 | - | ||
| 252 | 238 | dev_dbg(&port->dev, "%s - got baud = %d\n", __func__, baud); | |
| 253 | 239 | ||
| 254 | 240 | ||
| @@ -324,7 +310,7 @@ static int ssu100_open(struct tty_struct *tty, struct usb_serial_port *port) | |||
| 324 | 310 | dev_dbg(&port->dev, "%s - set uart failed\n", __func__); | |
| 325 | 311 | ||
| 326 | 312 | if (tty) | |
| 327 | - | ssu100_set_termios(tty, port, NULL); | |
| 313 | + | ssu100_set_termios(tty, port, &tty->termios); | |
| 328 | 314 | ||
| 329 | 315 | return usb_serial_generic_open(tty, port); | |
| 330 | 316 | } | |
modified drivers/usb/serial/usb-serial.c
| @@ -400,13 +400,17 @@ static unsigned int serial_chars_in_buffer(struct tty_struct *tty) | |||
| 400 | 400 | static void serial_wait_until_sent(struct tty_struct *tty, int timeout) | |
| 401 | 401 | { | |
| 402 | 402 | struct usb_serial_port *port = tty->driver_data; | |
| 403 | + | struct usb_serial *serial = port->serial; | |
| 403 | 404 | ||
| 404 | 405 | dev_dbg(&port->dev, "%s\n", __func__); | |
| 405 | 406 | ||
| 406 | 407 | if (!port->serial->type->wait_until_sent) | |
| 407 | 408 | return; | |
| 408 | 409 | ||
| 409 | - | port->serial->type->wait_until_sent(tty, timeout); | |
| 410 | + | mutex_lock(&serial->disc_mutex); | |
| 411 | + | if (!serial->disconnected) | |
| 412 | + | port->serial->type->wait_until_sent(tty, timeout); | |
| 413 | + | mutex_unlock(&serial->disc_mutex); | |
| 410 | 414 | } | |
| 411 | 415 | ||
| 412 | 416 | static void serial_throttle(struct tty_struct *tty) | |
| @@ -434,13 +438,8 @@ static int serial_get_serial(struct tty_struct *tty, struct serial_struct *ss) | |||
| 434 | 438 | struct usb_serial_port *port = tty->driver_data; | |
| 435 | 439 | struct tty_port *tport = &port->port; | |
| 436 | 440 | unsigned int close_delay, closing_wait; | |
| 437 | - | int ret = 0; | |
| 438 | 441 | ||
| 439 | 442 | mutex_lock(&tport->mutex); | |
| 440 | - | if (tty_io_error(tty)) { | |
| 441 | - | ret = -EIO; | |
| 442 | - | goto out_unlock; | |
| 443 | - | } | |
| 444 | 443 | ||
| 445 | 444 | close_delay = jiffies_to_msecs(tport->close_delay) / 10; | |
| 446 | 445 | closing_wait = tport->closing_wait; | |
| @@ -453,10 +452,10 @@ static int serial_get_serial(struct tty_struct *tty, struct serial_struct *ss) | |||
| 453 | 452 | ||
| 454 | 453 | if (port->serial->type->get_serial) | |
| 455 | 454 | port->serial->type->get_serial(tty, ss); | |
| 456 | - | out_unlock: | |
| 455 | + | ||
| 457 | 456 | mutex_unlock(&tport->mutex); | |
| 458 | 457 | ||
| 459 | - | return ret; | |
| 458 | + | return 0; | |
| 460 | 459 | } | |
| 461 | 460 | ||
| 462 | 461 | static int serial_set_serial(struct tty_struct *tty, struct serial_struct *ss) | |
| @@ -472,10 +471,6 @@ static int serial_set_serial(struct tty_struct *tty, struct serial_struct *ss) | |||
| 472 | 471 | closing_wait = msecs_to_jiffies(closing_wait * 10); | |
| 473 | 472 | ||
| 474 | 473 | mutex_lock(&tport->mutex); | |
| 475 | - | if (tty_io_error(tty)) { | |
| 476 | - | ret = -EIO; | |
| 477 | - | goto out_unlock; | |
| 478 | - | } | |
| 479 | 474 | ||
| 480 | 475 | if (!capable(CAP_SYS_ADMIN)) { | |
| 481 | 476 | if (close_delay != tport->close_delay || | |
| @@ -503,7 +498,6 @@ static int serial_ioctl(struct tty_struct *tty, | |||
| 503 | 498 | unsigned int cmd, unsigned long arg) | |
| 504 | 499 | { | |
| 505 | 500 | struct usb_serial_port *port = tty->driver_data; | |
| 506 | - | struct tty_port *tport = &port->port; | |
| 507 | 501 | int retval = -ENOIOCTLCMD; | |
| 508 | 502 | ||
| 509 | 503 | dev_dbg(&port->dev, "%s - cmd 0x%04x\n", __func__, cmd); | |
| @@ -514,21 +508,8 @@ static int serial_ioctl(struct tty_struct *tty, | |||
| 514 | 508 | retval = port->serial->type->tiocmiwait(tty, arg); | |
| 515 | 509 | break; | |
| 516 | 510 | default: | |
| 517 | - | if (!port->serial->type->ioctl) | |
| 518 | - | break; | |
| 519 | - | ||
| 520 | - | if (cmd == TIOCSRS485) | |
| 521 | - | down_write(&tty->termios_rwsem); | |
| 522 | - | ||
| 523 | - | mutex_lock(&tport->mutex); | |
| 524 | - | if (tty_io_error(tty)) | |
| 525 | - | retval = -EIO; | |
| 526 | - | else | |
| 511 | + | if (port->serial->type->ioctl) | |
| 527 | 512 | retval = port->serial->type->ioctl(tty, cmd, arg); | |
| 528 | - | mutex_unlock(&tport->mutex); | |
| 529 | - | ||
| 530 | - | if (cmd == TIOCSRS485) | |
| 531 | - | up_write(&tty->termios_rwsem); | |
| 532 | 513 | } | |
| 533 | 514 | ||
| 534 | 515 | return retval; | |
| @@ -538,40 +519,25 @@ static void serial_set_termios(struct tty_struct *tty, | |||
| 538 | 519 | const struct ktermios *old) | |
| 539 | 520 | { | |
| 540 | 521 | struct usb_serial_port *port = tty->driver_data; | |
| 541 | - | struct tty_port *tport = &port->port; | |
| 542 | 522 | ||
| 543 | 523 | dev_dbg(&port->dev, "%s\n", __func__); | |
| 544 | 524 | ||
| 545 | - | if (!port->serial->type->set_termios) { | |
| 546 | - | tty_termios_copy_hw(&tty->termios, old); | |
| 547 | - | return; | |
| 548 | - | } | |
| 549 | - | ||
| 550 | - | mutex_lock(&tport->mutex); | |
| 551 | - | if (!tty_io_error(tty)) | |
| 525 | + | if (port->serial->type->set_termios) | |
| 552 | 526 | port->serial->type->set_termios(tty, port, old); | |
| 553 | - | mutex_unlock(&tport->mutex); | |
| 527 | + | else | |
| 528 | + | tty_termios_copy_hw(&tty->termios, old); | |
| 554 | 529 | } | |
| 555 | 530 | ||
| 556 | 531 | static int serial_break(struct tty_struct *tty, int break_state) | |
| 557 | 532 | { | |
| 558 | 533 | struct usb_serial_port *port = tty->driver_data; | |
| 559 | - | struct tty_port *tport = &port->port; | |
| 560 | - | int ret; | |
| 561 | 534 | ||
| 562 | 535 | dev_dbg(&port->dev, "%s\n", __func__); | |
| 563 | 536 | ||
| 564 | - | if (!port->serial->type->break_ctl) | |
| 565 | - | return -ENOTTY; | |
| 566 | - | ||
| 567 | - | mutex_lock(&tport->mutex); | |
| 568 | - | if (tty_io_error(tty)) | |
| 569 | - | ret = -EIO; | |
| 570 | - | else | |
| 571 | - | ret = port->serial->type->break_ctl(tty, break_state); | |
| 572 | - | mutex_unlock(&tport->mutex); | |
| 537 | + | if (port->serial->type->break_ctl) | |
| 538 | + | return port->serial->type->break_ctl(tty, break_state); | |
| 573 | 539 | ||
| 574 | - | return ret; | |
| 540 | + | return -ENOTTY; | |
| 575 | 541 | } | |
| 576 | 542 | ||
| 577 | 543 | static int serial_proc_show(struct seq_file *m, void *v) | |
| @@ -612,44 +578,24 @@ static int serial_proc_show(struct seq_file *m, void *v) | |||
| 612 | 578 | static int serial_tiocmget(struct tty_struct *tty) | |
| 613 | 579 | { | |
| 614 | 580 | struct usb_serial_port *port = tty->driver_data; | |
| 615 | - | struct tty_port *tport = &port->port; | |
| 616 | - | int ret; | |
| 617 | 581 | ||
| 618 | 582 | dev_dbg(&port->dev, "%s\n", __func__); | |
| 619 | 583 | ||
| 620 | - | if (!port->serial->type->tiocmget) | |
| 621 | - | return -ENOTTY; | |
| 622 | - | ||
| 623 | - | mutex_lock(&tport->mutex); | |
| 624 | - | if (tty_io_error(tty)) | |
| 625 | - | ret = -EIO; | |
| 626 | - | else | |
| 627 | - | ret = port->serial->type->tiocmget(tty); | |
| 628 | - | mutex_unlock(&tport->mutex); | |
| 629 | - | ||
| 630 | - | return ret; | |
| 584 | + | if (port->serial->type->tiocmget) | |
| 585 | + | return port->serial->type->tiocmget(tty); | |
| 586 | + | return -ENOTTY; | |
| 631 | 587 | } | |
| 632 | 588 | ||
| 633 | 589 | static int serial_tiocmset(struct tty_struct *tty, | |
| 634 | 590 | unsigned int set, unsigned int clear) | |
| 635 | 591 | { | |
| 636 | 592 | struct usb_serial_port *port = tty->driver_data; | |
| 637 | - | struct tty_port *tport = &port->port; | |
| 638 | - | int ret; | |
| 639 | 593 | ||
| 640 | 594 | dev_dbg(&port->dev, "%s\n", __func__); | |
| 641 | 595 | ||
| 642 | - | if (!port->serial->type->tiocmset) | |
| 643 | - | return -ENOTTY; | |
| 644 | - | ||
| 645 | - | mutex_lock(&tport->mutex); | |
| 646 | - | if (tty_io_error(tty)) | |
| 647 | - | ret = -EIO; | |
| 648 | - | else | |
| 649 | - | ret = port->serial->type->tiocmset(tty, set, clear); | |
| 650 | - | mutex_unlock(&tport->mutex); | |
| 651 | - | ||
| 652 | - | return ret; | |
| 596 | + | if (port->serial->type->tiocmset) | |
| 597 | + | return port->serial->type->tiocmset(tty, set, clear); | |
| 598 | + | return -ENOTTY; | |
| 653 | 599 | } | |
| 654 | 600 | ||
| 655 | 601 | static int serial_get_icount(struct tty_struct *tty, | |
| @@ -1245,16 +1191,11 @@ static void usb_serial_disconnect(struct usb_interface *interface) | |||
| 1245 | 1191 | usb_serial_port_poison_urbs(port); | |
| 1246 | 1192 | wake_up_interruptible(&port->port.delta_msr_wait); | |
| 1247 | 1193 | cancel_work_sync(&port->work); | |
| 1248 | - | } | |
| 1249 | - | ||
| 1250 | - | if (serial->type->disconnect) | |
| 1251 | - | serial->type->disconnect(serial); | |
| 1252 | - | ||
| 1253 | - | for (i = 0; i < serial->num_ports; ++i) { | |
| 1254 | - | port = serial->port[i]; | |
| 1255 | 1194 | if (device_is_registered(&port->dev)) | |
| 1256 | 1195 | device_del(&port->dev); | |
| 1257 | 1196 | } | |
| 1197 | + | if (serial->type->disconnect) | |
| 1198 | + | serial->type->disconnect(serial); | |
| 1258 | 1199 | ||
| 1259 | 1200 | release_sibling(serial, interface); | |
| 1260 | 1201 | ||
| @@ -1372,8 +1313,7 @@ static int __init usb_serial_init(void) | |||
| 1372 | 1313 | int result; | |
| 1373 | 1314 | ||
| 1374 | 1315 | usb_serial_tty_driver = tty_alloc_driver(USB_SERIAL_TTY_MINORS, | |
| 1375 | - | TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV | | |
| 1376 | - | TTY_DRIVER_RESET_SAVED_TERMIOS); | |
| 1316 | + | TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV); | |
| 1377 | 1317 | if (IS_ERR(usb_serial_tty_driver)) | |
| 1378 | 1318 | return PTR_ERR(usb_serial_tty_driver); | |
| 1379 | 1319 | ||
| @@ -1524,7 +1464,7 @@ int __usb_serial_register_drivers(struct usb_serial_driver *const serial_drivers | |||
| 1524 | 1464 | { | |
| 1525 | 1465 | int rc; | |
| 1526 | 1466 | struct usb_driver *udriver; | |
| 1527 | - | struct usb_serial_driver * const *sd, * const *s; | |
| 1467 | + | struct usb_serial_driver * const *sd; | |
| 1528 | 1468 | ||
| 1529 | 1469 | /* | |
| 1530 | 1470 | * udriver must be registered before any of the serial drivers, | |
| @@ -1577,11 +1517,9 @@ int __usb_serial_register_drivers(struct usb_serial_driver *const serial_drivers | |||
| 1577 | 1517 | return 0; | |
| 1578 | 1518 | ||
| 1579 | 1519 | err_deregister_drivers: | |
| 1580 | - | for (s = serial_drivers; s < sd; ++s) | |
| 1581 | - | usb_serial_bus_remove_new_id(*s); | |
| 1582 | - | usb_deregister(udriver); | |
| 1583 | 1520 | while (sd-- > serial_drivers) | |
| 1584 | 1521 | usb_serial_deregister(*sd); | |
| 1522 | + | usb_deregister(udriver); | |
| 1585 | 1523 | err_free_driver: | |
| 1586 | 1524 | kfree(udriver); | |
| 1587 | 1525 | return rc; | |
| @@ -1599,23 +1537,10 @@ EXPORT_SYMBOL_GPL(__usb_serial_register_drivers); | |||
| 1599 | 1537 | void usb_serial_deregister_drivers(struct usb_serial_driver *const serial_drivers[]) | |
| 1600 | 1538 | { | |
| 1601 | 1539 | struct usb_driver *udriver = (*serial_drivers)->usb_driver; | |
| 1602 | - | struct usb_serial_driver * const *sd; | |
| 1603 | - | ||
| 1604 | - | /* | |
| 1605 | - | * udriver must be deregistered before the serial drivers so that | |
| 1606 | - | * I/O is stopped before unbinding the ports. | |
| 1607 | - | * | |
| 1608 | - | * Remove the new_id attributes to prevent ids from being added and | |
| 1609 | - | * triggering a probe of udriver after it has been deregistered. | |
| 1610 | - | */ | |
| 1611 | - | for (sd = serial_drivers; *sd; ++sd) | |
| 1612 | - | usb_serial_bus_remove_new_id(*sd); | |
| 1613 | 1540 | ||
| 1541 | + | for (; *serial_drivers; ++serial_drivers) | |
| 1542 | + | usb_serial_deregister(*serial_drivers); | |
| 1614 | 1543 | usb_deregister(udriver); | |
| 1615 | - | ||
| 1616 | - | for (sd = serial_drivers; *sd; ++sd) | |
| 1617 | - | usb_serial_deregister(*sd); | |
| 1618 | - | ||
| 1619 | 1544 | kfree(udriver); | |
| 1620 | 1545 | } | |
| 1621 | 1546 | EXPORT_SYMBOL_GPL(usb_serial_deregister_drivers); | |
modified drivers/usb/serial/xr_serial.c
| @@ -850,9 +850,12 @@ static int xr_get_rs485_config(struct tty_struct *tty, | |||
| 850 | 850 | struct usb_serial_port *port = tty->driver_data; | |
| 851 | 851 | struct xr_data *data = usb_get_serial_port_data(port); | |
| 852 | 852 | ||
| 853 | - | /* core holds port mutex */ | |
| 854 | - | if (copy_to_user(argp, &data->rs485, sizeof(data->rs485))) | |
| 853 | + | down_read(&tty->termios_rwsem); | |
| 854 | + | if (copy_to_user(argp, &data->rs485, sizeof(data->rs485))) { | |
| 855 | + | up_read(&tty->termios_rwsem); | |
| 855 | 856 | return -EFAULT; | |
| 857 | + | } | |
| 858 | + | up_read(&tty->termios_rwsem); | |
| 856 | 859 | ||
| 857 | 860 | return 0; | |
| 858 | 861 | } | |
| @@ -868,9 +871,10 @@ static int xr_set_rs485_config(struct tty_struct *tty, | |||
| 868 | 871 | return -EFAULT; | |
| 869 | 872 | xr_sanitize_serial_rs485(&rs485); | |
| 870 | 873 | ||
| 871 | - | /* core holds termios rwsem and port mutex */ | |
| 874 | + | down_write(&tty->termios_rwsem); | |
| 872 | 875 | data->rs485 = rs485; | |
| 873 | 876 | xr_set_flow_mode(tty, port, NULL); | |
| 877 | + | up_write(&tty->termios_rwsem); | |
| 874 | 878 | ||
| 875 | 879 | if (copy_to_user(argp, &rs485, sizeof(rs485))) | |
| 876 | 880 | return -EFAULT; | |
modified drivers/usb/storage/sierra_ms.c
| @@ -77,13 +77,6 @@ static int sierra_get_swoc_info(struct usb_device *udev, | |||
| 77 | 77 | sizeof(struct swoc_info), /* __u16 size */ | |
| 78 | 78 | USB_CTRL_SET_TIMEOUT); /* int timeout */ | |
| 79 | 79 | ||
| 80 | - | /* | |
| 81 | - | * A short IN transfer leaves the tail of swocInfo uninitialized; | |
| 82 | - | * only a full transfer is valid. | |
| 83 | - | */ | |
| 84 | - | if (result != sizeof(struct swoc_info)) | |
| 85 | - | return -EIO; | |
| 86 | - | ||
| 87 | 80 | swocInfo->LinuxSKU = le16_to_cpu(swocInfo->LinuxSKU); | |
| 88 | 81 | swocInfo->LinuxVer = le16_to_cpu(swocInfo->LinuxVer); | |
| 89 | 82 | return result; | |
modified drivers/usb/typec/anx7411.c
| @@ -1566,11 +1566,8 @@ static void anx7411_i2c_remove(struct i2c_client *client) | |||
| 1566 | 1566 | anx7411_partner_unregister_altmode(plat); | |
| 1567 | 1567 | anx7411_unregister_partner(plat); | |
| 1568 | 1568 | ||
| 1569 | - | if (plat->workqueue) { | |
| 1570 | - | disable_irq(plat->intp_irq); | |
| 1571 | - | cancel_work_sync(&plat->work); | |
| 1569 | + | if (plat->workqueue) | |
| 1572 | 1570 | destroy_workqueue(plat->workqueue); | |
| 1573 | - | } | |
| 1574 | 1571 | ||
| 1575 | 1572 | i2c_unregister_device(plat->spi_client); | |
| 1576 | 1573 | ||
modified drivers/usb/typec/port-mapper.c
| @@ -42,23 +42,6 @@ static int usb4_port_compare(struct device *dev, void *fwnode) | |||
| 42 | 42 | return usb4_usb3_port_match(dev, fwnode); | |
| 43 | 43 | } | |
| 44 | 44 | ||
| 45 | - | static bool typec_has_usb4_host_interface(const struct fwnode_handle *fwnode) | |
| 46 | - | { | |
| 47 | - | if (!IS_REACHABLE(CONFIG_USB4)) | |
| 48 | - | return false; | |
| 49 | - | ||
| 50 | - | struct fwnode_handle *nhi_fwnode __free(fwnode_handle) = | |
| 51 | - | fwnode_find_reference(fwnode, "usb4-host-interface", 0); | |
| 52 | - | ||
| 53 | - | /* | |
| 54 | - | * The USB4 port can only appear if the host interface is enabled in | |
| 55 | - | * the firmware and has been enumerated as a device. The latter is | |
| 56 | - | * the same check as in usb_acpi_add_usb4_devlink(). | |
| 57 | - | */ | |
| 58 | - | return !IS_ERR(nhi_fwnode) && fwnode_device_is_available(nhi_fwnode) && | |
| 59 | - | nhi_fwnode->dev; | |
| 60 | - | } | |
| 61 | - | ||
| 62 | 45 | static int typec_port_compare(struct device *dev, void *fwnode) | |
| 63 | 46 | { | |
| 64 | 47 | return device_match_fwnode(dev, fwnode); | |
| @@ -81,11 +64,11 @@ static int typec_port_match(struct device *dev, void *data) | |||
| 81 | 64 | adev_fwnode); | |
| 82 | 65 | ||
| 83 | 66 | /* | |
| 84 | - | * If dev is USB 3.x port, it may have reference to an available | |
| 67 | + | * If dev is USB 3.x port, it may have reference to the | |
| 85 | 68 | * USB4 host interface in which case we can also link the | |
| 86 | 69 | * Type-C port with the USB4 port. | |
| 87 | 70 | */ | |
| 88 | - | if (typec_has_usb4_host_interface(adev_fwnode)) | |
| 71 | + | if (fwnode_property_present(adev_fwnode, "usb4-host-interface")) | |
| 89 | 72 | component_match_add(&arg->port->dev, &arg->match, | |
| 90 | 73 | usb4_port_compare, adev_fwnode); | |
| 91 | 74 | } | |
modified drivers/usb/typec/tcpm/tcpm.c
| @@ -1756,8 +1756,7 @@ static void mod_enable_frs_delayed_work(struct tcpm_port *port, unsigned int del | |||
| 1756 | 1756 | static void mod_vdm_discovery_cancel_delayed_work(struct tcpm_port *port) | |
| 1757 | 1757 | { | |
| 1758 | 1758 | hrtimer_cancel(&port->vdm_discovery_timer); | |
| 1759 | - | if (port->wq) | |
| 1760 | - | kthread_cancel_work_sync(&port->vdm_discovery_work); | |
| 1759 | + | kthread_cancel_work_sync(&port->vdm_discovery_work); | |
| 1761 | 1760 | } | |
| 1762 | 1761 | ||
| 1763 | 1762 | static void mod_vdm_discovery_delayed_work(struct tcpm_port *port, unsigned int delay_ms) | |
| @@ -7114,7 +7113,7 @@ static void tcpm_pd_event_handler(struct kthread_work *work) | |||
| 7114 | 7113 | port->upcoming_state = FR_SWAP_SEND; | |
| 7115 | 7114 | ret = tcpm_ams_start(port, FAST_ROLE_SWAP); | |
| 7116 | 7115 | if (ret == -EAGAIN) | |
| 7117 | - | tcpm_set_state(port, ERROR_RECOVERY, 0); | |
| 7116 | + | port->upcoming_state = INVALID_STATE; | |
| 7118 | 7117 | } else { | |
| 7119 | 7118 | tcpm_log(port, "Discarding FRS_SIGNAL! Not in sink ready"); | |
| 7120 | 7119 | } | |
| @@ -8978,7 +8977,6 @@ void tcpm_unregister_port(struct tcpm_port *port) | |||
| 8978 | 8977 | ||
| 8979 | 8978 | port->registered = false; | |
| 8980 | 8979 | kthread_destroy_worker(port->wq); | |
| 8981 | - | port->wq = NULL; | |
| 8982 | 8980 | ||
| 8983 | 8981 | hrtimer_cancel(&port->vdm_discovery_timer); | |
| 8984 | 8982 | hrtimer_cancel(&port->enable_frs_timer); | |
modified drivers/usb/typec/tipd/core.c
| @@ -343,7 +343,7 @@ static void tps6598x_set_data_role(struct tps6598x *tps, | |||
| 343 | 343 | ||
| 344 | 344 | static int tps6598x_connect(struct tps6598x *tps, u32 status) | |
| 345 | 345 | { | |
| 346 | - | struct typec_partner_desc desc = { }; | |
| 346 | + | struct typec_partner_desc desc; | |
| 347 | 347 | enum typec_pwr_opmode mode; | |
| 348 | 348 | int ret; | |
| 349 | 349 | ||
| @@ -354,6 +354,7 @@ static int tps6598x_connect(struct tps6598x *tps, u32 status) | |||
| 354 | 354 | ||
| 355 | 355 | desc.usb_pd = mode == TYPEC_PWR_MODE_PD; | |
| 356 | 356 | desc.accessory = TYPEC_ACCESSORY_NONE; /* XXX: handle accessories */ | |
| 357 | + | desc.identity = NULL; | |
| 357 | 358 | ||
| 358 | 359 | if (desc.usb_pd) { | |
| 359 | 360 | ret = tps6598x_read_partner_identity(tps); | |
| @@ -849,10 +850,11 @@ static void cd321x_update_work(struct work_struct *work) | |||
| 849 | 850 | ||
| 850 | 851 | /* Set up partner if we were previously disconnected (or changed). */ | |
| 851 | 852 | if (!tps->partner) { | |
| 852 | - | struct typec_partner_desc desc = { }; | |
| 853 | + | struct typec_partner_desc desc; | |
| 853 | 854 | ||
| 854 | 855 | desc.usb_pd = is_pd; | |
| 855 | 856 | desc.accessory = TYPEC_ACCESSORY_NONE; /* XXX: handle accessories */ | |
| 857 | + | desc.identity = NULL; | |
| 856 | 858 | ||
| 857 | 859 | if (desc.usb_pd) | |
| 858 | 860 | desc.identity = &st.partner_identity; | |
| @@ -1790,7 +1792,6 @@ static int tps6598x_probe(struct i2c_client *client) | |||
| 1790 | 1792 | const struct tipd_data *data; | |
| 1791 | 1793 | struct tps6598x *tps; | |
| 1792 | 1794 | struct fwnode_handle *fwnode; | |
| 1793 | - | bool patch_loaded = false; | |
| 1794 | 1795 | u32 status; | |
| 1795 | 1796 | u32 vid = 0; | |
| 1796 | 1797 | int ret; | |
| @@ -1846,7 +1847,6 @@ static int tps6598x_probe(struct i2c_client *client) | |||
| 1846 | 1847 | return ret; | |
| 1847 | 1848 | ||
| 1848 | 1849 | if (ret == TPS_MODE_PTCH) { | |
| 1849 | - | patch_loaded = true; | |
| 1850 | 1850 | ret = tps->data->init(tps); | |
| 1851 | 1851 | if (ret) | |
| 1852 | 1852 | return ret; | |
| @@ -1937,8 +1937,7 @@ err_clear_mask: | |||
| 1937 | 1937 | tps6598x_write64(tps, TPS_REG_INT_MASK1, 0); | |
| 1938 | 1938 | err_reset_controller: | |
| 1939 | 1939 | /* Reset PD controller to remove any applied patch */ | |
| 1940 | - | if (patch_loaded) | |
| 1941 | - | tps->data->reset(tps); | |
| 1940 | + | tps->data->reset(tps); | |
| 1942 | 1941 | ||
| 1943 | 1942 | return ret; | |
| 1944 | 1943 | } | |
modified drivers/usb/typec/ucsi/displayport.c
| @@ -71,14 +71,11 @@ static int ucsi_displayport_enter(struct typec_altmode *alt, u32 *vdo) | |||
| 71 | 71 | if (ret < 0) { | |
| 72 | 72 | if (ucsi->version > 0x0100) | |
| 73 | 73 | goto err_unlock; | |
| 74 | + | cur = 0xff; | |
| 74 | 75 | } | |
| 75 | 76 | ||
| 76 | - | if (cur != 0xff) { | |
| 77 | - | if (cur < UCSI_MAX_ALTMODES) | |
| 78 | - | ret = dp->con->port_altmode[cur] == alt ? 0 : -EBUSY; | |
| 79 | - | else | |
| 80 | - | ret = -EINVAL; | |
| 81 | - | ||
| 77 | + | if (cur < UCSI_MAX_ALTMODES) { | |
| 78 | + | ret = dp->con->port_altmode[cur] == alt ? 0 : -EBUSY; | |
| 82 | 79 | goto err_unlock; | |
| 83 | 80 | } | |
| 84 | 81 | ||
modified drivers/usb/typec/ucsi/ucsi.c
| @@ -1801,21 +1801,10 @@ static struct fwnode_handle *ucsi_find_fwnode(struct ucsi_connector *con) | |||
| 1801 | 1801 | { | |
| 1802 | 1802 | struct fwnode_handle *fwnode; | |
| 1803 | 1803 | int i = 1; | |
| 1804 | - | int ret; | |
| 1805 | - | u32 port; | |
| 1806 | 1804 | ||
| 1807 | - | device_for_each_child_node(con->ucsi->dev, fwnode) { | |
| 1808 | - | ret = fwnode_property_read_u32(fwnode, "reg", &port); | |
| 1809 | - | if (ret < 0) { | |
| 1810 | - | if (i == con->num) | |
| 1811 | - | return fwnode; | |
| 1812 | - | } else { | |
| 1813 | - | if (port == con->num - 1) | |
| 1814 | - | return fwnode; | |
| 1815 | - | } | |
| 1816 | - | ||
| 1817 | - | i++; | |
| 1818 | - | } | |
| 1805 | + | device_for_each_child_node(con->ucsi->dev, fwnode) | |
| 1806 | + | if (i++ == con->num) | |
| 1807 | + | return fwnode; | |
| 1819 | 1808 | return NULL; | |
| 1820 | 1809 | } | |
| 1821 | 1810 | ||
modified drivers/usb/typec/ucsi/ucsi_acpi.c
| @@ -121,33 +121,6 @@ static const struct ucsi_operations ucsi_acpi_ops = { | |||
| 121 | 121 | .async_control = ucsi_acpi_async_control | |
| 122 | 122 | }; | |
| 123 | 123 | ||
| 124 | - | static int ucsi_acer_read_version(struct ucsi *ucsi, u16 *version) | |
| 125 | - | { | |
| 126 | - | struct ucsi_acpi *ua = ucsi_get_drvdata(ucsi); | |
| 127 | - | int ret; | |
| 128 | - | ||
| 129 | - | ret = ucsi_acpi_read_version(ucsi, version); | |
| 130 | - | if (ret) | |
| 131 | - | return ret; | |
| 132 | - | ||
| 133 | - | if (!*version) { | |
| 134 | - | dev_warn(ua->dev, "UCSI version is zero, assuming 1.2\n"); | |
| 135 | - | *version = UCSI_VERSION_1_2; | |
| 136 | - | } | |
| 137 | - | ||
| 138 | - | return 0; | |
| 139 | - | } | |
| 140 | - | ||
| 141 | - | static const struct ucsi_operations ucsi_acer_ops = { | |
| 142 | - | .read_version = ucsi_acer_read_version, | |
| 143 | - | .read_cci = ucsi_acpi_read_cci, | |
| 144 | - | .poll_cci = ucsi_acpi_poll_cci, | |
| 145 | - | .read_message_in = ucsi_acpi_read_message_in, | |
| 146 | - | .write_message_out = ucsi_acpi_write_message_out, | |
| 147 | - | .sync_control = ucsi_sync_control_common, | |
| 148 | - | .async_control = ucsi_acpi_async_control | |
| 149 | - | }; | |
| 150 | - | ||
| 151 | 124 | static int ucsi_gram_sync_control(struct ucsi *ucsi, u64 command, u32 *cci, | |
| 152 | 125 | void *val, size_t len, void *msg_out, | |
| 153 | 126 | size_t msg_out_size) | |
| @@ -189,13 +162,6 @@ static const struct ucsi_operations ucsi_gram_ops = { | |||
| 189 | 162 | }; | |
| 190 | 163 | ||
| 191 | 164 | static const struct dmi_system_id ucsi_acpi_quirks[] = { | |
| 192 | - | { | |
| 193 | - | .matches = { | |
| 194 | - | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), | |
| 195 | - | DMI_MATCH(DMI_PRODUCT_NAME, "Nitro ANV15-41"), | |
| 196 | - | }, | |
| 197 | - | .driver_data = (void *)&ucsi_acer_ops, | |
| 198 | - | }, | |
| 199 | 165 | { | |
| 200 | 166 | .matches = { | |
| 201 | 167 | DMI_MATCH(DMI_SYS_VENDOR, "LG Electronics"), | |
modified drivers/usb/typec/ucsi/ucsi_glink.c
| @@ -362,10 +362,6 @@ static void pmic_glink_ucsi_destroy(void *data) | |||
| 362 | 362 | { | |
| 363 | 363 | struct pmic_glink_ucsi *ucsi = data; | |
| 364 | 364 | ||
| 365 | - | /* Drain the work items before ucsi_destroy() frees the ucsi instance */ | |
| 366 | - | cancel_work_sync(&ucsi->notify_work); | |
| 367 | - | cancel_work_sync(&ucsi->register_work); | |
| 368 | - | ||
| 369 | 365 | /* Protect to make sure we're not in a middle of a transaction from a glink callback */ | |
| 370 | 366 | mutex_lock(&ucsi->lock); | |
| 371 | 367 | ucsi_destroy(ucsi->ucsi); | |
| @@ -471,15 +467,8 @@ static void pmic_glink_ucsi_remove(struct auxiliary_device *adev) | |||
| 471 | 467 | { | |
| 472 | 468 | struct pmic_glink_ucsi *ucsi = dev_get_drvdata(&adev->dev); | |
| 473 | 469 | ||
| 474 | - | /* Callbacks can queue work until devres releases the client */ | |
| 475 | - | disable_work_sync(&ucsi->notify_work); | |
| 476 | - | disable_work_sync(&ucsi->register_work); | |
| 477 | - | ||
| 478 | - | /* register_work may have unregistered the instance already */ | |
| 479 | - | if (ucsi->ucsi_registered) { | |
| 480 | - | ucsi->ucsi_registered = false; | |
| 481 | - | ucsi_unregister(ucsi->ucsi); | |
| 482 | - | } | |
| 470 | + | /* Unregister first to stop having read & writes */ | |
| 471 | + | ucsi_unregister(ucsi->ucsi); | |
| 483 | 472 | } | |
| 484 | 473 | ||
| 485 | 474 | static const struct auxiliary_device_id pmic_glink_ucsi_id_table[] = { | |
modified drivers/virt/nitro_enclaves/ne_misc_dev.c
| @@ -1706,7 +1706,6 @@ static int ne_create_vm_ioctl(struct ne_pci_dev *ne_pci_dev, u64 __user *slot_ui | |||
| 1706 | 1706 | return enclave_fd; | |
| 1707 | 1707 | ||
| 1708 | 1708 | put_file: | |
| 1709 | - | enclave_file->private_data = NULL; | |
| 1710 | 1709 | fput(enclave_file); | |
| 1711 | 1710 | put_fd: | |
| 1712 | 1711 | put_unused_fd(enclave_fd); | |
modified drivers/virt/vmgenid.c
| @@ -25,7 +25,7 @@ struct vmgenid_state { | |||
| 25 | 25 | ||
| 26 | 26 | static void vmgenid_notify(struct device *device) | |
| 27 | 27 | { | |
| 28 | - | struct vmgenid_state *state = dev_get_drvdata(device); | |
| 28 | + | struct vmgenid_state *state = device->driver_data; | |
| 29 | 29 | u8 old_id[VMGENID_SIZE]; | |
| 30 | 30 | ||
| 31 | 31 | memcpy(old_id, state->this_id, sizeof(old_id)); | |
| @@ -75,16 +75,13 @@ static int vmgenid_add_acpi(struct device *dev, struct vmgenid_state *state) | |||
| 75 | 75 | phys_addr = (obj->package.elements[0].integer.value << 0) | | |
| 76 | 76 | (obj->package.elements[1].integer.value << 32); | |
| 77 | 77 | ||
| 78 | - | virt_addr = devm_memremap(&device->dev, phys_addr, VMGENID_SIZE, | |
| 79 | - | MEMREMAP_WB | MEMREMAP_DEC); | |
| 78 | + | virt_addr = devm_memremap(&device->dev, phys_addr, VMGENID_SIZE, MEMREMAP_WB); | |
| 80 | 79 | if (IS_ERR(virt_addr)) { | |
| 81 | 80 | ret = PTR_ERR(virt_addr); | |
| 82 | 81 | goto out; | |
| 83 | 82 | } | |
| 84 | 83 | setup_vmgenid_state(state, virt_addr); | |
| 85 | 84 | ||
| 86 | - | dev_set_drvdata(dev, state); | |
| 87 | - | ||
| 88 | 85 | status = acpi_install_notify_handler(device->handle, ACPI_DEVICE_NOTIFY, | |
| 89 | 86 | vmgenid_acpi_handler, dev); | |
| 90 | 87 | if (ACPI_FAILURE(status)) { | |
| @@ -92,6 +89,7 @@ static int vmgenid_add_acpi(struct device *dev, struct vmgenid_state *state) | |||
| 92 | 89 | goto out; | |
| 93 | 90 | } | |
| 94 | 91 | ||
| 92 | + | dev->driver_data = state; | |
| 95 | 93 | out: | |
| 96 | 94 | ACPI_FREE(parsed.pointer); | |
| 97 | 95 | return ret; | |
| @@ -125,13 +123,12 @@ static int vmgenid_add_of(struct platform_device *pdev, | |||
| 125 | 123 | if (ret < 0) | |
| 126 | 124 | return ret; | |
| 127 | 125 | ||
| 128 | - | dev_set_drvdata(&pdev->dev, state); | |
| 129 | - | ||
| 130 | 126 | ret = devm_request_irq(&pdev->dev, ret, vmgenid_of_irq_handler, | |
| 131 | 127 | IRQF_SHARED, "vmgenid", &pdev->dev); | |
| 132 | 128 | if (ret < 0) | |
| 133 | 129 | return ret; | |
| 134 | 130 | ||
| 131 | + | pdev->dev.driver_data = state; | |
| 135 | 132 | return 0; | |
| 136 | 133 | } | |
| 137 | 134 | ||
modified fs/btrfs/inode.c
| @@ -9623,6 +9623,7 @@ int btrfs_encoded_read_regular_fill_pages(struct btrfs_inode *inode, | |||
| 9623 | 9623 | struct completion sync_reads; | |
| 9624 | 9624 | unsigned long i = 0; | |
| 9625 | 9625 | struct btrfs_bio *bbio; | |
| 9626 | + | int ret; | |
| 9626 | 9627 | ||
| 9627 | 9628 | /* | |
| 9628 | 9629 | * Fast path for synchronous reads which completes in this call, io_uring | |
| @@ -9669,10 +9670,10 @@ int btrfs_encoded_read_regular_fill_pages(struct btrfs_inode *inode, | |||
| 9669 | 9670 | ||
| 9670 | 9671 | if (uring_ctx) { | |
| 9671 | 9672 | if (refcount_dec_and_test(&priv->pending_refs)) { | |
| 9672 | - | int error = blk_status_to_errno(READ_ONCE(priv->status)); | |
| 9673 | - | ||
| 9674 | - | btrfs_uring_read_extent_endio(uring_ctx, error); | |
| 9673 | + | ret = blk_status_to_errno(READ_ONCE(priv->status)); | |
| 9674 | + | btrfs_uring_read_extent_endio(uring_ctx, ret); | |
| 9675 | 9675 | kfree(priv); | |
| 9676 | + | return ret; | |
| 9676 | 9677 | } | |
| 9677 | 9678 | ||
| 9678 | 9679 | return -EIOCBQUEUED; | |
modified fs/btrfs/ioctl.c
| @@ -4601,7 +4601,7 @@ static void btrfs_uring_read_finished(struct io_tw_req tw_req, io_tw_token_t tw) | |||
| 4601 | 4601 | size_t page_offset; | |
| 4602 | 4602 | ssize_t ret; | |
| 4603 | 4603 | ||
| 4604 | - | /* The inode lock has already been acquired in btrfs_encoded_read(). */ | |
| 4604 | + | /* The inode lock has already been acquired in btrfs_uring_read_extent. */ | |
| 4605 | 4605 | btrfs_lockdep_inode_acquire(inode, i_rwsem); | |
| 4606 | 4606 | ||
| 4607 | 4607 | if (priv->err) { | |
| @@ -4667,6 +4667,7 @@ static int btrfs_uring_read_extent(struct kiocb *iocb, struct iov_iter *iter, | |||
| 4667 | 4667 | struct iovec *iov, struct io_uring_cmd *cmd) | |
| 4668 | 4668 | { | |
| 4669 | 4669 | struct btrfs_inode *inode = BTRFS_I(file_inode(iocb->ki_filp)); | |
| 4670 | + | struct extent_io_tree *io_tree = &inode->io_tree; | |
| 4670 | 4671 | struct page **pages = NULL; | |
| 4671 | 4672 | struct btrfs_uring_priv *priv = NULL; | |
| 4672 | 4673 | unsigned long nr_pages; | |
| @@ -4722,6 +4723,8 @@ static int btrfs_uring_read_extent(struct kiocb *iocb, struct iov_iter *iter, | |||
| 4722 | 4723 | return -EIOCBQUEUED; | |
| 4723 | 4724 | ||
| 4724 | 4725 | out_fail: | |
| 4726 | + | btrfs_unlock_extent(io_tree, start, lockend, &cached_state); | |
| 4727 | + | btrfs_inode_unlock(inode, BTRFS_ILOCK_SHARED); | |
| 4725 | 4728 | kfree(priv); | |
| 4726 | 4729 | for (int i = 0; i < nr_pages; i++) { | |
| 4727 | 4730 | if (pages[i]) | |
| @@ -4834,7 +4837,7 @@ static int btrfs_uring_encoded_read(struct io_uring_cmd *cmd, unsigned int issue | |||
| 4834 | 4837 | ret = btrfs_encoded_read(&kiocb, &data->iter, &data->args, &cached_state, | |
| 4835 | 4838 | &disk_bytenr, &disk_io_size); | |
| 4836 | 4839 | if (ret == -EAGAIN) | |
| 4837 | - | goto out_free; | |
| 4840 | + | goto out_acct; | |
| 4838 | 4841 | if (ret < 0 && ret != -EIOCBQUEUED) | |
| 4839 | 4842 | goto out_free; | |
| 4840 | 4843 | ||
| @@ -4862,10 +4865,8 @@ static int btrfs_uring_encoded_read(struct io_uring_cmd *cmd, unsigned int issue | |||
| 4862 | 4865 | cached_state, disk_bytenr, disk_io_size, | |
| 4863 | 4866 | count, data->args.compression, | |
| 4864 | 4867 | data->iov, cmd); | |
| 4865 | - | if (ret == -EIOCBQUEUED) | |
| 4866 | - | goto out_acct; | |
| 4867 | - | btrfs_unlock_extent(io_tree, start, lockend, &cached_state); | |
| 4868 | - | btrfs_inode_unlock(inode, BTRFS_ILOCK_SHARED); | |
| 4868 | + | ||
| 4869 | + | goto out_acct; | |
| 4869 | 4870 | } | |
| 4870 | 4871 | ||
| 4871 | 4872 | out_free: | |
| @@ -4876,10 +4877,8 @@ out_acct: | |||
| 4876 | 4877 | add_rchar(current, ret); | |
| 4877 | 4878 | inc_syscr(current); | |
| 4878 | 4879 | ||
| 4879 | - | if (ret != -EIOCBQUEUED) { | |
| 4880 | + | if (ret != -EIOCBQUEUED && ret != -EAGAIN) | |
| 4880 | 4881 | kfree(data); | |
| 4881 | - | bc->data = NULL; | |
| 4882 | - | } | |
| 4883 | 4882 | ||
| 4884 | 4883 | return ret; | |
| 4885 | 4884 | } | |
| @@ -4908,11 +4907,6 @@ static int btrfs_uring_encoded_write(struct io_uring_cmd *cmd, unsigned int issu | |||
| 4908 | 4907 | goto out_acct; | |
| 4909 | 4908 | } | |
| 4910 | 4909 | ||
| 4911 | - | if (issue_flags & IO_URING_F_NONBLOCK) { | |
| 4912 | - | ret = -EAGAIN; | |
| 4913 | - | goto out_acct; | |
| 4914 | - | } | |
| 4915 | - | ||
| 4916 | 4910 | if (!data) { | |
| 4917 | 4911 | data = kzalloc_obj(*data, GFP_NOFS); | |
| 4918 | 4912 | if (!data) { | |
| @@ -4981,6 +4975,11 @@ static int btrfs_uring_encoded_write(struct io_uring_cmd *cmd, unsigned int issu | |||
| 4981 | 4975 | } | |
| 4982 | 4976 | } | |
| 4983 | 4977 | ||
| 4978 | + | if (issue_flags & IO_URING_F_NONBLOCK) { | |
| 4979 | + | ret = -EAGAIN; | |
| 4980 | + | goto out_acct; | |
| 4981 | + | } | |
| 4982 | + | ||
| 4984 | 4983 | pos = data->args.offset; | |
| 4985 | 4984 | ret = rw_verify_area(WRITE, file, &pos, data->args.len); | |
| 4986 | 4985 | if (ret < 0) | |
| @@ -5006,8 +5005,8 @@ out_acct: | |||
| 5006 | 5005 | add_wchar(current, ret); | |
| 5007 | 5006 | inc_syscw(current); | |
| 5008 | 5007 | ||
| 5009 | - | kfree(data); | |
| 5010 | - | bc->data = NULL; | |
| 5008 | + | if (ret != -EAGAIN) | |
| 5009 | + | kfree(data); | |
| 5011 | 5010 | return ret; | |
| 5012 | 5011 | } | |
| 5013 | 5012 | ||
modified fs/btrfs/scrub.c
| @@ -536,10 +536,8 @@ static int scrub_print_warning_inode(u64 inum, u64 offset, u64 num_bytes, | |||
| 536 | 536 | } | |
| 537 | 537 | ret = paths_from_inode(inum, ipath); | |
| 538 | 538 | ||
| 539 | - | if (ret < 0) { | |
| 540 | - | btrfs_put_root(local_root); | |
| 539 | + | if (ret < 0) | |
| 541 | 540 | goto err; | |
| 542 | - | } | |
| 543 | 541 | ||
| 544 | 542 | /* | |
| 545 | 543 | * we deliberately ignore the bit ipath might have been too small to | |
modified fs/btrfs/transaction.c
| @@ -432,7 +432,6 @@ static int record_root_in_trans(struct btrfs_trans_handle *trans, | |||
| 432 | 432 | spin_lock(&fs_info->fs_roots_radix_lock); | |
| 433 | 433 | if (btrfs_get_root_last_trans(root) == trans->transid && !force) { | |
| 434 | 434 | spin_unlock(&fs_info->fs_roots_radix_lock); | |
| 435 | - | clear_bit(BTRFS_ROOT_IN_TRANS_SETUP, &root->state); | |
| 436 | 435 | return 0; | |
| 437 | 436 | } | |
| 438 | 437 | radix_tree_tag_set(&fs_info->fs_roots_radix, | |
modified fs/btrfs/xattr.c
| @@ -161,7 +161,6 @@ int btrfs_setxattr(struct btrfs_trans_handle *trans, struct inode *inode, | |||
| 161 | 161 | const u16 old_data_len = btrfs_dir_data_len(leaf, di); | |
| 162 | 162 | const u32 item_size = btrfs_item_size(leaf, slot); | |
| 163 | 163 | const u32 data_size = sizeof(*di) + name_len + size; | |
| 164 | - | unsigned long name_ptr; | |
| 165 | 164 | unsigned long data_ptr; | |
| 166 | 165 | char *ptr; | |
| 167 | 166 | ||
| @@ -190,16 +189,8 @@ int btrfs_setxattr(struct btrfs_trans_handle *trans, struct inode *inode, | |||
| 190 | 189 | ptr = btrfs_item_ptr(leaf, slot, char); | |
| 191 | 190 | ptr += btrfs_item_size(leaf, slot) - data_size; | |
| 192 | 191 | di = (struct btrfs_dir_item *)ptr; | |
| 193 | - | memzero_extent_buffer(leaf, (unsigned long)ptr + | |
| 194 | - | offsetof(struct btrfs_dir_item, location), | |
| 195 | - | sizeof(struct btrfs_disk_key)); | |
| 196 | - | btrfs_set_dir_flags(leaf, di, BTRFS_FT_XATTR); | |
| 197 | - | btrfs_set_dir_transid(leaf, di, trans->transid); | |
| 198 | - | btrfs_set_dir_name_len(leaf, di, name_len); | |
| 199 | 192 | btrfs_set_dir_data_len(leaf, di, size); | |
| 200 | - | name_ptr = (unsigned long)(di + 1); | |
| 201 | 193 | data_ptr = ((unsigned long)(di + 1)) + name_len; | |
| 202 | - | write_extent_buffer(leaf, name, name_ptr, name_len); | |
| 203 | 194 | write_extent_buffer(leaf, value, data_ptr, size); | |
| 204 | 195 | } else { | |
| 205 | 196 | /* | |
| @@ -329,8 +320,10 @@ ssize_t btrfs_listxattr(struct dentry *dentry, char *buffer, size_t size) | |||
| 329 | 320 | if (!size) | |
| 330 | 321 | goto next; | |
| 331 | 322 | ||
| 332 | - | if (!buffer || (name_len + 1) > size_left) | |
| 333 | - | return -ERANGE; | |
| 323 | + | if (!buffer || (name_len + 1) > size_left) { | |
| 324 | + | iter_ret = -ERANGE; | |
| 325 | + | break; | |
| 326 | + | } | |
| 334 | 327 | ||
| 335 | 328 | read_extent_buffer(leaf, buffer, name_ptr, name_len); | |
| 336 | 329 | buffer[name_len] = '\0'; | |
modified fs/dcache.c
| @@ -1583,8 +1583,6 @@ EXPORT_SYMBOL(path_has_submounts); | |||
| 1583 | 1583 | * | |
| 1584 | 1584 | * Only one of d_invalidate() and d_set_mounted() must succeed. For | |
| 1585 | 1585 | * this reason take rename_lock and d_lock on dentry and ancestors. | |
| 1586 | - | * Likewise for dont_mount() which marks a dentry that is being removed | |
| 1587 | - | * under d_lock. | |
| 1588 | 1586 | */ | |
| 1589 | 1587 | int d_set_mounted(struct dentry *dentry) | |
| 1590 | 1588 | { | |
| @@ -1601,7 +1599,7 @@ int d_set_mounted(struct dentry *dentry) | |||
| 1601 | 1599 | spin_unlock(&p->d_lock); | |
| 1602 | 1600 | } | |
| 1603 | 1601 | spin_lock(&dentry->d_lock); | |
| 1604 | - | if (!d_unlinked(dentry) && !cant_mount(dentry)) { | |
| 1602 | + | if (!d_unlinked(dentry)) { | |
| 1605 | 1603 | ret = -EBUSY; | |
| 1606 | 1604 | if (!d_mountpoint(dentry)) { | |
| 1607 | 1605 | dentry->d_flags |= DCACHE_MOUNTED; | |
modified fs/ext4/super.c
| @@ -5057,7 +5057,6 @@ out: | |||
| 5057 | 5057 | static int ext4_check_journal_data_mode(struct super_block *sb) | |
| 5058 | 5058 | { | |
| 5059 | 5059 | if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA) { | |
| 5060 | - | printk(KERN_WARNING "EXT4-fs: The data=journal mount option is deprecated and support will be removed in January 2028\n"); | |
| 5061 | 5060 | printk_once(KERN_WARNING "EXT4-fs: Warning: mounting with " | |
| 5062 | 5061 | "data=journal disables delayed allocation, " | |
| 5063 | 5062 | "dioread_nolock, O_DIRECT and fast_commit support!\n"); | |
modified fs/fcntl.c
| @@ -372,9 +372,6 @@ static long fcntl_set_rw_hint(struct file *file, unsigned long arg) | |||
| 372 | 372 | u64 __user *argp = (u64 __user *)arg; | |
| 373 | 373 | u64 hint; | |
| 374 | 374 | ||
| 375 | - | /* nothing is ever written to it */ | |
| 376 | - | if (IS_IMMUTABLE(inode)) | |
| 377 | - | return -EPERM; | |
| 378 | 375 | if (!inode_owner_or_capable(file_mnt_idmap(file), inode)) | |
| 379 | 376 | return -EPERM; | |
| 380 | 377 | ||
modified fs/fhandle.c
| @@ -298,22 +298,6 @@ static bool capable_wrt_mount(struct mount *mount) | |||
| 298 | 298 | return mnt_ns && ns_capable(mnt_ns->user_ns, CAP_SYS_ADMIN); | |
| 299 | 299 | } | |
| 300 | 300 | ||
| 301 | - | /* | |
| 302 | - | * Does the caller have an unobstructed way to everything below @root? Only | |
| 303 | - | * if the mount is mounted, the caller is privileged over its mount namespace | |
| 304 | - | * and no locked child covers something below @root->dentry. One answer from | |
| 305 | - | * under mount_lock: an umount in between clears ->mnt_ns and takes the | |
| 306 | - | * children off the mount, the locked ones too. | |
| 307 | - | */ | |
| 308 | - | static bool subtree_unobstructed(const struct path *root) | |
| 309 | - | { | |
| 310 | - | struct mount *mnt = real_mount(root->mnt); | |
| 311 | - | ||
| 312 | - | guard(mount_locked_reader)(); | |
| 313 | - | return is_mounted(root->mnt) && capable_wrt_mount(mnt) && | |
| 314 | - | !has_locked_children(mnt, root->dentry); | |
| 315 | - | } | |
| 316 | - | ||
| 317 | 301 | static inline int may_decode_fh(struct handle_to_path_ctx *ctx, | |
| 318 | 302 | unsigned int o_flags) | |
| 319 | 303 | { | |
| @@ -348,7 +332,9 @@ static inline int may_decode_fh(struct handle_to_path_ctx *ctx, | |||
| 348 | 332 | ||
| 349 | 333 | if (ns_capable(root->mnt->mnt_sb->s_user_ns, CAP_SYS_ADMIN)) | |
| 350 | 334 | ctx->flags = HANDLE_CHECK_PERMS; | |
| 351 | - | else if (subtree_unobstructed(root)) | |
| 335 | + | else if (is_mounted(root->mnt) && | |
| 336 | + | capable_wrt_mount(real_mount(root->mnt)) && | |
| 337 | + | !has_locked_children(real_mount(root->mnt), root->dentry)) | |
| 352 | 338 | ctx->flags = HANDLE_CHECK_PERMS | HANDLE_CHECK_SUBTREE; | |
| 353 | 339 | else | |
| 354 | 340 | return -EPERM; | |
modified fs/file_table.c
| @@ -520,8 +520,7 @@ static void __fput(struct file *file) | |||
| 520 | 520 | dput(dentry); | |
| 521 | 521 | if (unlikely(mode & FMODE_NEED_UNMOUNT)) | |
| 522 | 522 | dissolve_on_fput(mnt); | |
| 523 | - | else | |
| 524 | - | mntput(mnt); | |
| 523 | + | mntput(mnt); | |
| 525 | 524 | out: | |
| 526 | 525 | file_free(file); | |
| 527 | 526 | } | |
modified fs/fs_context.c
| @@ -315,10 +315,6 @@ struct fs_context *fs_context_for_reconfigure(struct dentry *dentry, | |||
| 315 | 315 | unsigned int sb_flags, | |
| 316 | 316 | unsigned int sb_flags_mask) | |
| 317 | 317 | { | |
| 318 | - | /* kernel-internal superblocks are nobody's to reconfigure */ | |
| 319 | - | if (dentry->d_sb->s_flags & SB_NOUSER) | |
| 320 | - | return ERR_PTR(-EINVAL); | |
| 321 | - | ||
| 322 | 318 | return alloc_fs_context(dentry->d_sb->s_type, dentry, sb_flags, | |
| 323 | 319 | sb_flags_mask, FS_CONTEXT_FOR_RECONFIGURE); | |
| 324 | 320 | } | |
modified fs/mount.h
| @@ -6,8 +6,6 @@ | |||
| 6 | 6 | #include <linux/fs_pin.h> | |
| 7 | 7 | ||
| 8 | 8 | extern struct file_system_type nullfs_fs_type; | |
| 9 | - | extern struct dentry *nullfs_new_file(struct super_block *sb); | |
| 10 | - | extern struct vfsmount *knullfs; | |
| 11 | 9 | extern struct list_head notify_list; | |
| 12 | 10 | ||
| 13 | 11 | struct mnt_namespace { | |
| @@ -35,20 +33,16 @@ struct mnt_namespace { | |||
| 35 | 33 | } __randomize_layout; | |
| 36 | 34 | ||
| 37 | 35 | struct mnt_pcp { | |
| 38 | - | unsigned int mnt_gets; | |
| 39 | - | unsigned int mnt_puts; | |
| 36 | + | int mnt_count; | |
| 40 | 37 | int mnt_writers; | |
| 41 | 38 | }; | |
| 42 | 39 | ||
| 43 | 40 | struct mountpoint { | |
| 44 | 41 | struct hlist_node m_hash; | |
| 45 | 42 | struct dentry *m_dentry; | |
| 46 | - | struct hlist_head m_list; /* mounts on it and pins */ | |
| 47 | - | struct hlist_head m_covers; /* covers of unmounted parents */ | |
| 43 | + | struct hlist_head m_list; | |
| 48 | 44 | }; | |
| 49 | 45 | ||
| 50 | - | struct mnt_cover; | |
| 51 | - | ||
| 52 | 46 | struct mount { | |
| 53 | 47 | struct hlist_node mnt_hash; | |
| 54 | 48 | struct mount *mnt_parent; | |
| @@ -90,7 +84,7 @@ struct mount { | |||
| 90 | 84 | struct mountpoint *mnt_mp; /* where is it mounted */ | |
| 91 | 85 | union { | |
| 92 | 86 | struct hlist_node mnt_mp_list; /* list mounts with the same mountpoint */ | |
| 93 | - | struct hlist_node mnt_umount; /* on the unmounted list */ | |
| 87 | + | struct hlist_node mnt_umount; | |
| 94 | 88 | }; | |
| 95 | 89 | #ifdef CONFIG_FSNOTIFY | |
| 96 | 90 | struct fsnotify_mark_connector __rcu *mnt_fsnotify_marks; | |
| @@ -104,8 +98,7 @@ struct mount { | |||
| 104 | 98 | int mnt_group_id; /* peer group identifier */ | |
| 105 | 99 | int mnt_expiry_mark; /* true if marked for expiry */ | |
| 106 | 100 | struct hlist_head mnt_pins; | |
| 107 | - | struct mnt_cover *mnt_cover; /* the one it may leave behind */ | |
| 108 | - | struct hlist_head mnt_covers; /* left behind by its unmounted children */ | |
| 101 | + | struct hlist_head mnt_stuck_children; | |
| 109 | 102 | struct hlist_node mnt_ns_visible; /* link in ns->mnt_visible_mounts */ | |
| 110 | 103 | struct mount *overmount; /* mounted on ->mnt_root */ | |
| 111 | 104 | } __randomize_layout; | |
| @@ -240,9 +233,6 @@ static inline struct mnt_namespace *to_mnt_ns(struct ns_common *ns) | |||
| 240 | 233 | #ifdef CONFIG_FSNOTIFY | |
| 241 | 234 | static inline void mnt_notify_add(struct mount *m) | |
| 242 | 235 | { | |
| 243 | - | /* queued already under this namespace_sem hold */ | |
| 244 | - | if (!list_empty(&m->to_notify)) | |
| 245 | - | return; | |
| 246 | 236 | /* Optimize the case where there are no watches */ | |
| 247 | 237 | if ((m->mnt_ns && m->mnt_ns->n_fsnotify_marks) || | |
| 248 | 238 | (m->prev_ns && m->prev_ns->n_fsnotify_marks)) | |
modified fs/namei.c
| @@ -2086,33 +2086,6 @@ all_done: // pure jump | |||
| 2086 | 2086 | return NULL; | |
| 2087 | 2087 | } | |
| 2088 | 2088 | ||
| 2089 | - | /* | |
| 2090 | - | * Be careful in case the dentry is unlinked or renamed. Any mounts | |
| 2091 | - | * stacked on top of it are going away. We need to make sure that we | |
| 2092 | - | * don't reveal the underyling dentry during refwalk. In rcuwalk we | |
| 2093 | - | * catch this via d_seq and another lookup for the name. Give the same | |
| 2094 | - | * guarantee in refwalk. | |
| 2095 | - | */ | |
| 2096 | - | static bool unlink_may_reveal(struct nameidata *nd, int flags, | |
| 2097 | - | struct path *path, struct dentry *dentry) | |
| 2098 | - | { | |
| 2099 | - | /* ".." and LOOKUP_DOWN may land on an unhashed directory */ | |
| 2100 | - | if (flags & WALK_NOFOLLOW) | |
| 2101 | - | return false; | |
| 2102 | - | if (nd->flags & LOOKUP_REVAL) | |
| 2103 | - | return false; | |
| 2104 | - | /* We crossed onto a mount and the name led us here while it still existed */ | |
| 2105 | - | if (path->mnt != nd->path.mnt) | |
| 2106 | - | return false; | |
| 2107 | - | /* only a name on its way out is flagged */ | |
| 2108 | - | if (likely(!cant_mount(dentry))) | |
| 2109 | - | return false; | |
| 2110 | - | if (!d_unlinked(dentry)) | |
| 2111 | - | return false; | |
| 2112 | - | dput(no_free_ptr(path->dentry)); | |
| 2113 | - | return true; | |
| 2114 | - | } | |
| 2115 | - | ||
| 2116 | 2089 | /* | |
| 2117 | 2090 | * Do we need to follow links? We _really_ want to be able | |
| 2118 | 2091 | * to do this check without having to look at inode->i_op, | |
| @@ -2142,8 +2115,6 @@ static noinline const char *step_into_slowpath(struct nameidata *nd, int flags, | |||
| 2142 | 2115 | if (unlikely(!inode)) | |
| 2143 | 2116 | return ERR_PTR(-ENOENT); | |
| 2144 | 2117 | } else { | |
| 2145 | - | if (unlikely(unlink_may_reveal(nd, flags, &path, dentry))) | |
| 2146 | - | return ERR_PTR(-ESTALE); | |
| 2147 | 2118 | dput(nd->path.dentry); | |
| 2148 | 2119 | if (nd->path.mnt != path.mnt) | |
| 2149 | 2120 | mntput(nd->path.mnt); | |
modified fs/namespace.c
| @@ -80,8 +80,6 @@ static u64 mnt_id_ctr = MNT_UNIQUE_ID_OFFSET; | |||
| 80 | 80 | static struct hlist_head *mount_hashtable __ro_after_init; | |
| 81 | 81 | static struct hlist_head *mountpoint_hashtable __ro_after_init; | |
| 82 | 82 | static struct kmem_cache *mnt_cache __ro_after_init; | |
| 83 | - | struct vfsmount *knullfs __ro_after_init; /* private nullfs instance */ | |
| 84 | - | static struct vfsmount *knullfs_file __ro_after_init; /* its regular file */ | |
| 85 | 83 | static DECLARE_RWSEM(namespace_sem); | |
| 86 | 84 | static HLIST_HEAD(unmounted); /* protected by namespace_sem */ | |
| 87 | 85 | static LIST_HEAD(ex_mountpoints); /* protected by namespace_sem */ | |
| @@ -132,6 +130,7 @@ static void mnt_ns_release(struct mnt_namespace *ns) | |||
| 132 | 130 | { | |
| 133 | 131 | /* keep alive for {list,stat}mount() */ | |
| 134 | 132 | if (ns && refcount_dec_and_test(&ns->passive)) { | |
| 133 | + | fsnotify_mntns_delete(ns); | |
| 135 | 134 | put_user_ns(ns->user_ns); | |
| 136 | 135 | kfree(ns); | |
| 137 | 136 | } | |
| @@ -211,19 +210,6 @@ static inline struct hlist_head *mp_hash(struct dentry *dentry) | |||
| 211 | 210 | return &mountpoint_hashtable[tmp & mp_hash_mask]; | |
| 212 | 211 | } | |
| 213 | 212 | ||
| 214 | - | /* | |
| 215 | - | * What an unmounted mount leaves behind at its unmounted parent instead of | |
| 216 | - | * staying attached to it. A lookup on the parent at the mountpoint finds | |
| 217 | - | * a stand-in for as long as the cover is there. The parent frees it. | |
| 218 | - | */ | |
| 219 | - | struct mnt_cover { | |
| 220 | - | struct hlist_node node; /* parent->mnt_covers, RCU */ | |
| 221 | - | struct hlist_node pin; /* mp->m_covers, keeps the mountpoint */ | |
| 222 | - | struct dentry *dentry; | |
| 223 | - | struct mountpoint *mp; | |
| 224 | - | struct rcu_head rcu; | |
| 225 | - | }; | |
| 226 | - | ||
| 227 | 213 | static int mnt_alloc_id(struct mount *mnt) | |
| 228 | 214 | { | |
| 229 | 215 | int res; | |
| @@ -263,24 +249,16 @@ void mnt_release_group_id(struct mount *mnt) | |||
| 263 | 249 | mnt->mnt_group_id = 0; | |
| 264 | 250 | } | |
| 265 | 251 | ||
| 266 | - | static inline void mnt_inc_count(struct mount *mnt) | |
| 267 | - | { | |
| 268 | - | #ifdef CONFIG_SMP | |
| 269 | - | this_cpu_inc(mnt->mnt_pcp->mnt_gets); | |
| 270 | - | #else | |
| 271 | - | preempt_disable(); | |
| 272 | - | mnt->mnt_count++; | |
| 273 | - | preempt_enable(); | |
| 274 | - | #endif | |
| 275 | - | } | |
| 276 | - | ||
| 277 | - | static inline void mnt_dec_count(struct mount *mnt) | |
| 252 | + | /* | |
| 253 | + | * vfsmount lock must be held for read | |
| 254 | + | */ | |
| 255 | + | static inline void mnt_add_count(struct mount *mnt, int n) | |
| 278 | 256 | { | |
| 279 | 257 | #ifdef CONFIG_SMP | |
| 280 | - | this_cpu_inc(mnt->mnt_pcp->mnt_puts); | |
| 258 | + | this_cpu_add(mnt->mnt_pcp->mnt_count, n); | |
| 281 | 259 | #else | |
| 282 | 260 | preempt_disable(); | |
| 283 | - | mnt->mnt_count--; | |
| 261 | + | mnt->mnt_count += n; | |
| 284 | 262 | preempt_enable(); | |
| 285 | 263 | #endif | |
| 286 | 264 | } | |
| @@ -291,17 +269,14 @@ static inline void mnt_dec_count(struct mount *mnt) | |||
| 291 | 269 | int mnt_get_count(struct mount *mnt) | |
| 292 | 270 | { | |
| 293 | 271 | #ifdef CONFIG_SMP | |
| 294 | - | unsigned int gets = 0, puts = 0; | |
| 272 | + | int count = 0; | |
| 295 | 273 | int cpu; | |
| 296 | 274 | ||
| 297 | - | /* puts first, so a put counted here has its get counted below */ | |
| 298 | - | for_each_possible_cpu(cpu) | |
| 299 | - | puts += per_cpu_ptr(mnt->mnt_pcp, cpu)->mnt_puts; | |
| 300 | - | smp_mb(); /* pairs with the smp_wmb() in mntput_no_expire() */ | |
| 301 | - | for_each_possible_cpu(cpu) | |
| 302 | - | gets += per_cpu_ptr(mnt->mnt_pcp, cpu)->mnt_gets; | |
| 275 | + | for_each_possible_cpu(cpu) { | |
| 276 | + | count += per_cpu_ptr(mnt->mnt_pcp, cpu)->mnt_count; | |
| 277 | + | } | |
| 303 | 278 | ||
| 304 | - | return gets - puts; | |
| 279 | + | return count; | |
| 305 | 280 | #else | |
| 306 | 281 | return mnt->mnt_count; | |
| 307 | 282 | #endif | |
| @@ -313,10 +288,6 @@ static struct mount *alloc_vfsmnt(const char *name) | |||
| 313 | 288 | if (mnt) { | |
| 314 | 289 | int err; | |
| 315 | 290 | ||
| 316 | - | mnt->mnt_cover = kzalloc_obj(struct mnt_cover, GFP_KERNEL_ACCOUNT); | |
| 317 | - | if (!mnt->mnt_cover) | |
| 318 | - | goto out_free_cache; | |
| 319 | - | ||
| 320 | 291 | err = mnt_alloc_id(mnt); | |
| 321 | 292 | if (err) | |
| 322 | 293 | goto out_free_cache; | |
| @@ -334,7 +305,7 @@ static struct mount *alloc_vfsmnt(const char *name) | |||
| 334 | 305 | if (!mnt->mnt_pcp) | |
| 335 | 306 | goto out_free_devname; | |
| 336 | 307 | ||
| 337 | - | this_cpu_inc(mnt->mnt_pcp->mnt_gets); | |
| 308 | + | this_cpu_add(mnt->mnt_pcp->mnt_count, 1); | |
| 338 | 309 | #else | |
| 339 | 310 | mnt->mnt_count = 1; | |
| 340 | 311 | mnt->mnt_writers = 0; | |
| @@ -349,11 +320,8 @@ static struct mount *alloc_vfsmnt(const char *name) | |||
| 349 | 320 | INIT_HLIST_HEAD(&mnt->mnt_slave_list); | |
| 350 | 321 | INIT_HLIST_NODE(&mnt->mnt_slave); | |
| 351 | 322 | INIT_HLIST_NODE(&mnt->mnt_mp_list); | |
| 352 | - | INIT_HLIST_HEAD(&mnt->mnt_covers); | |
| 323 | + | INIT_HLIST_HEAD(&mnt->mnt_stuck_children); | |
| 353 | 324 | INIT_HLIST_NODE(&mnt->mnt_ns_visible); | |
| 354 | - | #ifdef CONFIG_FSNOTIFY | |
| 355 | - | INIT_LIST_HEAD(&mnt->to_notify); | |
| 356 | - | #endif | |
| 357 | 325 | RB_CLEAR_NODE(&mnt->mnt_node); | |
| 358 | 326 | mnt->mnt.mnt_idmap = &nop_mnt_idmap; | |
| 359 | 327 | } | |
| @@ -366,7 +334,6 @@ out_free_devname: | |||
| 366 | 334 | out_free_id: | |
| 367 | 335 | mnt_free_id(mnt); | |
| 368 | 336 | out_free_cache: | |
| 369 | - | kfree(mnt->mnt_cover); | |
| 370 | 337 | kmem_cache_free(mnt_cache, mnt); | |
| 371 | 338 | return NULL; | |
| 372 | 339 | } | |
| @@ -758,8 +725,6 @@ int sb_prepare_remount_readonly(struct super_block *sb) | |||
| 758 | 725 | static void free_vfsmnt(struct mount *mnt) | |
| 759 | 726 | { | |
| 760 | 727 | mnt_idmap_put(mnt_idmap(&mnt->mnt)); | |
| 761 | - | /* NULL if it left it behind */ | |
| 762 | - | kfree(mnt->mnt_cover); | |
| 763 | 728 | kfree_const(mnt->mnt_devname); | |
| 764 | 729 | #ifdef CONFIG_SMP | |
| 765 | 730 | free_percpu(mnt->mnt_pcp); | |
| @@ -781,13 +746,13 @@ int __legitimize_mnt(struct vfsmount *bastard, unsigned seq) | |||
| 781 | 746 | if (bastard == NULL) | |
| 782 | 747 | return 0; | |
| 783 | 748 | mnt = real_mount(bastard); | |
| 784 | - | mnt_inc_count(mnt); | |
| 785 | - | smp_mb(); /* see mntput_no_expire_slowpath() and do_umount() */ | |
| 749 | + | mnt_add_count(mnt, 1); | |
| 750 | + | smp_mb(); // see mntput_no_expire() and do_umount() | |
| 786 | 751 | if (likely(!read_seqretry(&mount_lock, seq))) | |
| 787 | 752 | return 0; | |
| 788 | 753 | lock_mount_hash(); | |
| 789 | 754 | if (unlikely(bastard->mnt_flags & (MNT_SYNC_UMOUNT | MNT_DOOMED))) { | |
| 790 | - | mnt_dec_count(mnt); | |
| 755 | + | mnt_add_count(mnt, -1); | |
| 791 | 756 | unlock_mount_hash(); | |
| 792 | 757 | return 1; | |
| 793 | 758 | } | |
| @@ -816,31 +781,20 @@ static bool legitimize_mnt(struct vfsmount *bastard, unsigned seq) | |||
| 816 | 781 | * @dentry: dentry of mountpoint | |
| 817 | 782 | * | |
| 818 | 783 | * If @mnt has a child mount @c mounted on @dentry find and return it. | |
| 819 | - | * If @mnt is unmounted and a child that was unmounted with it left its | |
| 820 | - | * cover behind at @dentry, return the stand-in for it instead: knullfs | |
| 821 | - | * for a directory, its regular file for anything else. | |
| 822 | 784 | * Caller must either hold the spinlock component of @mount_lock or | |
| 823 | 785 | * hold rcu_read_lock(), sample the seqcount component before the call | |
| 824 | 786 | * and recheck it afterwards. | |
| 825 | 787 | * | |
| 826 | - | * Return: The child of @mnt mounted on @dentry, a stand-in or %NULL. | |
| 788 | + | * Return: The child of @mnt mounted on @dentry or %NULL. | |
| 827 | 789 | */ | |
| 828 | 790 | struct mount *__lookup_mnt(struct vfsmount *mnt, struct dentry *dentry) | |
| 829 | 791 | { | |
| 830 | 792 | struct hlist_head *head = m_hash(mnt, dentry); | |
| 831 | - | struct mnt_cover *cover; | |
| 832 | 793 | struct mount *p; | |
| 833 | 794 | ||
| 834 | 795 | hlist_for_each_entry_rcu(p, head, mnt_hash) | |
| 835 | 796 | if (&p->mnt_parent->mnt == mnt && p->mnt_mountpoint == dentry) | |
| 836 | 797 | return p; | |
| 837 | - | /* an unmounted mount keeps the covers its unmounted children left */ | |
| 838 | - | /* a lockless caller rechecks mount_lock after a miss, a stale flag is harmless */ | |
| 839 | - | if (unlikely(data_race(mnt->mnt_flags) & MNT_UMOUNT)) { | |
| 840 | - | hlist_for_each_entry_rcu(cover, &real_mount(mnt)->mnt_covers, node) | |
| 841 | - | if (cover->dentry == dentry) | |
| 842 | - | return real_mount(d_is_dir(dentry) ? knullfs : knullfs_file); | |
| 843 | - | } | |
| 844 | 798 | return NULL; | |
| 845 | 799 | } | |
| 846 | 800 | ||
| @@ -956,7 +910,6 @@ mountpoint: | |||
| 956 | 910 | mp->m_dentry = dget(dentry); | |
| 957 | 911 | hlist_add_head(&mp->m_hash, mp_hash(dentry)); | |
| 958 | 912 | INIT_HLIST_HEAD(&mp->m_list); | |
| 959 | - | INIT_HLIST_HEAD(&mp->m_covers); | |
| 960 | 913 | hlist_add_head(&m->node, &mp->m_list); | |
| 961 | 914 | m->mp = no_free_ptr(mp); | |
| 962 | 915 | read_sequnlock_excl(&mount_lock); | |
| @@ -969,7 +922,7 @@ mountpoint: | |||
| 969 | 922 | */ | |
| 970 | 923 | static void maybe_free_mountpoint(struct mountpoint *mp, struct list_head *list) | |
| 971 | 924 | { | |
| 972 | - | if (hlist_empty(&mp->m_list) && hlist_empty(&mp->m_covers)) { | |
| 925 | + | if (hlist_empty(&mp->m_list)) { | |
| 973 | 926 | struct dentry *dentry = mp->m_dentry; | |
| 974 | 927 | spin_lock(&dentry->d_lock); | |
| 975 | 928 | dentry->d_flags &= ~DCACHE_MOUNTED; | |
| @@ -1056,36 +1009,6 @@ static void umount_mnt(struct mount *mnt) | |||
| 1056 | 1009 | __umount_mnt(mnt, &ex_mountpoints); | |
| 1057 | 1010 | } | |
| 1058 | 1011 | ||
| 1059 | - | /* | |
| 1060 | - | * @mnt is unmounted together with its parent and would have stayed attached | |
| 1061 | - | * to it. Leave its cover behind before it is detached so that a lookup on the | |
| 1062 | - | * parent at the mountpoint keeps finding a mount instead of what @mnt covered. | |
| 1063 | - | * | |
| 1064 | - | * locks: mount_lock[write_seqlock] | |
| 1065 | - | */ | |
| 1066 | - | static void leave_cover(struct mount *mnt) | |
| 1067 | - | { | |
| 1068 | - | struct mnt_cover *cover = mnt->mnt_cover; | |
| 1069 | - | ||
| 1070 | - | mnt->mnt_cover = NULL; | |
| 1071 | - | cover->dentry = mnt->mnt_mountpoint; | |
| 1072 | - | cover->mp = mnt->mnt_mp; | |
| 1073 | - | /* keeps the mountpoint once @mnt has let go of it */ | |
| 1074 | - | hlist_add_head(&cover->pin, &cover->mp->m_covers); | |
| 1075 | - | hlist_add_head_rcu(&cover->node, &mnt->mnt_parent->mnt_covers); | |
| 1076 | - | } | |
| 1077 | - | ||
| 1078 | - | /* | |
| 1079 | - | * locks: mount_lock[write_seqlock] | |
| 1080 | - | */ | |
| 1081 | - | static void drop_cover(struct mnt_cover *cover, struct list_head *shrink_list) | |
| 1082 | - | { | |
| 1083 | - | hlist_del_rcu(&cover->node); | |
| 1084 | - | hlist_del(&cover->pin); | |
| 1085 | - | maybe_free_mountpoint(cover->mp, shrink_list); | |
| 1086 | - | kfree_rcu(cover, rcu); | |
| 1087 | - | } | |
| 1088 | - | ||
| 1089 | 1012 | /* | |
| 1090 | 1013 | * vfsmount lock must be held for write | |
| 1091 | 1014 | */ | |
| @@ -1135,10 +1058,7 @@ static void attach_mnt(struct mount *mnt, struct mount *parent, | |||
| 1135 | 1058 | void mnt_change_mountpoint(struct mount *parent, struct mountpoint *mp, struct mount *mnt) | |
| 1136 | 1059 | { | |
| 1137 | 1060 | struct mountpoint *old_mp = mnt->mnt_mp; | |
| 1138 | - | struct mount *old_parent = mnt->mnt_parent; | |
| 1139 | 1061 | ||
| 1140 | - | if (old_parent->overmount == mnt) | |
| 1141 | - | old_parent->overmount = NULL; | |
| 1142 | 1062 | list_del_init(&mnt->mnt_child); | |
| 1143 | 1063 | hlist_del_init(&mnt->mnt_mp_list); | |
| 1144 | 1064 | hlist_del_init_rcu(&mnt->mnt_hash); | |
| @@ -1334,7 +1254,6 @@ static struct mount *clone_mnt(struct mount *old, struct dentry *root, | |||
| 1334 | 1254 | ||
| 1335 | 1255 | mnt->mnt.mnt_flags = READ_ONCE(old->mnt.mnt_flags) & | |
| 1336 | 1256 | ~MNT_INTERNAL_FLAGS; | |
| 1337 | - | mnt->mnt_t_flags = old->mnt_t_flags & T_UNBINDABLE; | |
| 1338 | 1257 | ||
| 1339 | 1258 | if (flag & (CL_SLAVE | CL_PRIVATE)) | |
| 1340 | 1259 | mnt->mnt_group_id = 0; /* not a peer of original */ | |
| @@ -1377,6 +1296,8 @@ static struct mount *clone_mnt(struct mount *old, struct dentry *root, | |||
| 1377 | 1296 | ||
| 1378 | 1297 | static void cleanup_mnt(struct mount *mnt) | |
| 1379 | 1298 | { | |
| 1299 | + | struct hlist_node *p; | |
| 1300 | + | struct mount *m; | |
| 1380 | 1301 | /* | |
| 1381 | 1302 | * The warning here probably indicates that somebody messed | |
| 1382 | 1303 | * up a mnt_want/drop_write() pair. If this happens, the | |
| @@ -1387,6 +1308,10 @@ static void cleanup_mnt(struct mount *mnt) | |||
| 1387 | 1308 | WARN_ON(mnt_get_writers(mnt)); | |
| 1388 | 1309 | if (unlikely(mnt->mnt_pins.first)) | |
| 1389 | 1310 | mnt_pin_kill(mnt); | |
| 1311 | + | hlist_for_each_entry_safe(m, p, &mnt->mnt_stuck_children, mnt_umount) { | |
| 1312 | + | hlist_del(&m->mnt_umount); | |
| 1313 | + | mntput(&m->mnt); | |
| 1314 | + | } | |
| 1390 | 1315 | fsnotify_vfsmount_delete(&mnt->mnt); | |
| 1391 | 1316 | dput(mnt->mnt.mnt_root); | |
| 1392 | 1317 | deactivate_super(mnt->mnt.mnt_sb); | |
| @@ -1412,8 +1337,6 @@ static DECLARE_DELAYED_WORK(delayed_mntput_work, delayed_mntput); | |||
| 1412 | 1337 | ||
| 1413 | 1338 | static void noinline mntput_no_expire_slowpath(struct mount *mnt) | |
| 1414 | 1339 | { | |
| 1415 | - | struct mnt_cover *cover; | |
| 1416 | - | struct hlist_node *n; | |
| 1417 | 1340 | LIST_HEAD(list); | |
| 1418 | 1341 | int count; | |
| 1419 | 1342 | ||
| @@ -1424,7 +1347,7 @@ static void noinline mntput_no_expire_slowpath(struct mount *mnt) | |||
| 1424 | 1347 | * mount_lock, we'll see their refcount increment here. | |
| 1425 | 1348 | */ | |
| 1426 | 1349 | smp_mb(); | |
| 1427 | - | mnt_dec_count(mnt); | |
| 1350 | + | mnt_add_count(mnt, -1); | |
| 1428 | 1351 | count = mnt_get_count(mnt); | |
| 1429 | 1352 | if (count != 0) { | |
| 1430 | 1353 | WARN_ON(count < 0); | |
| @@ -1444,10 +1367,13 @@ static void noinline mntput_no_expire_slowpath(struct mount *mnt) | |||
| 1444 | 1367 | if (unlikely(!list_empty(&mnt->mnt_expire))) | |
| 1445 | 1368 | list_del(&mnt->mnt_expire); | |
| 1446 | 1369 | ||
| 1447 | - | /* nothing stays attached to an unmounted mount */ | |
| 1448 | - | VFS_WARN_ON_ONCE(!list_empty(&mnt->mnt_mounts)); | |
| 1449 | - | hlist_for_each_entry_safe(cover, n, &mnt->mnt_covers, node) | |
| 1450 | - | drop_cover(cover, &list); | |
| 1370 | + | if (unlikely(!list_empty(&mnt->mnt_mounts))) { | |
| 1371 | + | struct mount *p, *tmp; | |
| 1372 | + | list_for_each_entry_safe(p, tmp, &mnt->mnt_mounts, mnt_child) { | |
| 1373 | + | __umount_mnt(p, &list); | |
| 1374 | + | hlist_add_head(&p->mnt_umount, &mnt->mnt_stuck_children); | |
| 1375 | + | } | |
| 1376 | + | } | |
| 1451 | 1377 | unlock_mount_hash(); | |
| 1452 | 1378 | shrink_dentry_list(&list); | |
| 1453 | 1379 | ||
| @@ -1478,8 +1404,7 @@ static void mntput_no_expire(struct mount *mnt) | |||
| 1478 | 1404 | * non-NULL under rcu_read_lock(), the reference | |
| 1479 | 1405 | * we are dropping is not the final one. | |
| 1480 | 1406 | */ | |
| 1481 | - | smp_wmb(); /* pairs with the smp_mb() in mnt_get_count() */ | |
| 1482 | - | mnt_dec_count(mnt); | |
| 1407 | + | mnt_add_count(mnt, -1); | |
| 1483 | 1408 | rcu_read_unlock(); | |
| 1484 | 1409 | return; | |
| 1485 | 1410 | } | |
| @@ -1501,7 +1426,7 @@ EXPORT_SYMBOL(mntput); | |||
| 1501 | 1426 | struct vfsmount *mntget(struct vfsmount *mnt) | |
| 1502 | 1427 | { | |
| 1503 | 1428 | if (mnt) | |
| 1504 | - | mnt_inc_count(real_mount(mnt)); | |
| 1429 | + | mnt_add_count(real_mount(mnt), 1); | |
| 1505 | 1430 | return mnt; | |
| 1506 | 1431 | } | |
| 1507 | 1432 | EXPORT_SYMBOL(mntget); | |
| @@ -1812,17 +1737,36 @@ static inline void namespace_lock(void) | |||
| 1812 | 1737 | enum umount_tree_flags { | |
| 1813 | 1738 | UMOUNT_SYNC = 1, | |
| 1814 | 1739 | UMOUNT_PROPAGATE = 2, | |
| 1815 | - | UMOUNT_COVER = 4, | |
| 1740 | + | UMOUNT_CONNECTED = 4, | |
| 1816 | 1741 | }; | |
| 1817 | 1742 | ||
| 1818 | - | /* Do we need to leave the mountpoint on the parent covered? */ | |
| 1819 | - | static bool needs_cover(struct mount *mnt, enum umount_tree_flags how) | |
| 1743 | + | static bool disconnect_mount(struct mount *mnt, enum umount_tree_flags how) | |
| 1820 | 1744 | { | |
| 1745 | + | /* Leaving mounts connected is only valid for lazy umounts */ | |
| 1821 | 1746 | if (how & UMOUNT_SYNC) | |
| 1822 | - | return false; | |
| 1747 | + | return true; | |
| 1748 | + | ||
| 1749 | + | /* A mount without a parent has nothing to be connected to */ | |
| 1750 | + | if (!mnt_has_parent(mnt)) | |
| 1751 | + | return true; | |
| 1752 | + | ||
| 1753 | + | /* Because the reference counting rules change when mounts are | |
| 1754 | + | * unmounted and connected, umounted mounts may not be | |
| 1755 | + | * connected to mounted mounts. | |
| 1756 | + | */ | |
| 1823 | 1757 | if (!(mnt->mnt_parent->mnt.mnt_flags & MNT_UMOUNT)) | |
| 1758 | + | return true; | |
| 1759 | + | ||
| 1760 | + | /* Has it been requested that the mount remain connected? */ | |
| 1761 | + | if (how & UMOUNT_CONNECTED) | |
| 1824 | 1762 | return false; | |
| 1825 | - | return (how & UMOUNT_COVER) || IS_MNT_LOCKED(mnt); | |
| 1763 | + | ||
| 1764 | + | /* Is the mount locked such that it needs to remain connected? */ | |
| 1765 | + | if (IS_MNT_LOCKED(mnt)) | |
| 1766 | + | return false; | |
| 1767 | + | ||
| 1768 | + | /* By default disconnect the mount */ | |
| 1769 | + | return true; | |
| 1826 | 1770 | } | |
| 1827 | 1771 | ||
| 1828 | 1772 | /* | |
| @@ -1839,8 +1783,6 @@ static void umount_tree(struct mount *mnt, enum umount_tree_flags how) | |||
| 1839 | 1783 | ||
| 1840 | 1784 | /* Gather the mounts to umount */ | |
| 1841 | 1785 | for (p = mnt; p; p = next_mnt(p, mnt)) { | |
| 1842 | - | /* A mount is unmounted once. */ | |
| 1843 | - | VFS_WARN_ON_ONCE(p->mnt.mnt_flags & MNT_UMOUNT); | |
| 1844 | 1786 | p->mnt.mnt_flags |= MNT_UMOUNT; | |
| 1845 | 1787 | if (mnt_ns_attached(p)) | |
| 1846 | 1788 | move_from_ns(p); | |
| @@ -1860,6 +1802,7 @@ static void umount_tree(struct mount *mnt, enum umount_tree_flags how) | |||
| 1860 | 1802 | ||
| 1861 | 1803 | while (!list_empty(&tmp_list)) { | |
| 1862 | 1804 | struct mnt_namespace *ns; | |
| 1805 | + | bool disconnect; | |
| 1863 | 1806 | p = list_first_entry(&tmp_list, struct mount, mnt_list); | |
| 1864 | 1807 | list_del_init(&p->mnt_expire); | |
| 1865 | 1808 | list_del_init(&p->mnt_list); | |
| @@ -1872,12 +1815,17 @@ static void umount_tree(struct mount *mnt, enum umount_tree_flags how) | |||
| 1872 | 1815 | if (how & UMOUNT_SYNC) | |
| 1873 | 1816 | p->mnt.mnt_flags |= MNT_SYNC_UMOUNT; | |
| 1874 | 1817 | ||
| 1818 | + | disconnect = disconnect_mount(p, how); | |
| 1875 | 1819 | if (mnt_has_parent(p)) { | |
| 1876 | - | if (needs_cover(p, how)) | |
| 1877 | - | leave_cover(p); | |
| 1878 | - | umount_mnt(p); | |
| 1820 | + | if (!disconnect) { | |
| 1821 | + | /* Don't forget about p */ | |
| 1822 | + | list_add_tail(&p->mnt_child, &p->mnt_parent->mnt_mounts); | |
| 1823 | + | } else { | |
| 1824 | + | umount_mnt(p); | |
| 1825 | + | } | |
| 1879 | 1826 | } | |
| 1880 | - | hlist_add_head(&p->mnt_umount, &unmounted); | |
| 1827 | + | if (disconnect) | |
| 1828 | + | hlist_add_head(&p->mnt_umount, &unmounted); | |
| 1881 | 1829 | ||
| 1882 | 1830 | /* | |
| 1883 | 1831 | * At this point p->mnt_ns is NULL, notification will be queued | |
| @@ -2028,16 +1976,11 @@ out: | |||
| 2028 | 1976 | * detach_mounts allows lazily unmounting those mounts instead of | |
| 2029 | 1977 | * leaking them. | |
| 2030 | 1978 | * | |
| 2031 | - | * The dentry is unhashed before the mounts go so that no lookup finds | |
| 2032 | - | * what they covered. The caller removes it for good afterwards. | |
| 2033 | - | * | |
| 2034 | 1979 | * The caller may hold dentry->d_inode->i_rwsem. | |
| 2035 | 1980 | */ | |
| 2036 | 1981 | void __detach_mounts(struct dentry *dentry) | |
| 2037 | 1982 | { | |
| 2038 | 1983 | struct pinned_mountpoint mp = {}; | |
| 2039 | - | struct mnt_cover *cover; | |
| 2040 | - | struct hlist_node *n; | |
| 2041 | 1984 | struct mount *mnt; | |
| 2042 | 1985 | ||
| 2043 | 1986 | guard(namespace_excl)(); | |
| @@ -2046,16 +1989,15 @@ void __detach_mounts(struct dentry *dentry) | |||
| 2046 | 1989 | if (!lookup_mountpoint(dentry, &mp)) | |
| 2047 | 1990 | return; | |
| 2048 | 1991 | ||
| 2049 | - | /* the name goes first, what covered it goes second */ | |
| 2050 | - | d_drop(dentry); | |
| 2051 | 1992 | event++; | |
| 2052 | 1993 | while (mp.node.next) { | |
| 2053 | 1994 | mnt = hlist_entry(mp.node.next, struct mount, mnt_mp_list); | |
| 2054 | - | umount_tree(mnt, UMOUNT_COVER); | |
| 1995 | + | if (mnt->mnt.mnt_flags & MNT_UMOUNT) { | |
| 1996 | + | umount_mnt(mnt); | |
| 1997 | + | hlist_add_head(&mnt->mnt_umount, &unmounted); | |
| 1998 | + | } | |
| 1999 | + | else umount_tree(mnt, UMOUNT_CONNECTED); | |
| 2055 | 2000 | } | |
| 2056 | - | /* the dentry goes away, so do the covers left behind on it */ | |
| 2057 | - | hlist_for_each_entry_safe(cover, n, &mp.mp->m_covers, pin) | |
| 2058 | - | drop_cover(cover, &ex_mountpoints); | |
| 2059 | 2001 | unpin_mountpoint(&mp); | |
| 2060 | 2002 | } | |
| 2061 | 2003 | ||
| @@ -2352,11 +2294,9 @@ void drop_collected_paths(const struct path *paths, const struct path *prealloc) | |||
| 2352 | 2294 | ||
| 2353 | 2295 | static struct mnt_namespace *alloc_mnt_ns(struct user_namespace *, bool); | |
| 2354 | 2296 | ||
| 2355 | - | /* Consumes the caller's reference to @mnt. */ | |
| 2356 | 2297 | void dissolve_on_fput(struct vfsmount *mnt) | |
| 2357 | 2298 | { | |
| 2358 | - | struct vfsmount *p __free(mntput) = mnt; | |
| 2359 | - | struct mount *m = real_mount(p); | |
| 2299 | + | struct mount *m = real_mount(mnt); | |
| 2360 | 2300 | ||
| 2361 | 2301 | /* | |
| 2362 | 2302 | * m used to be the root of anon namespace; if it still is one, | |
| @@ -2379,14 +2319,13 @@ void dissolve_on_fput(struct vfsmount *mnt) | |||
| 2379 | 2319 | ||
| 2380 | 2320 | emptied_ns = m->mnt_ns; | |
| 2381 | 2321 | lock_mount_hash(); | |
| 2382 | - | umount_tree(m, UMOUNT_COVER); | |
| 2322 | + | umount_tree(m, UMOUNT_CONNECTED); | |
| 2383 | 2323 | unlock_mount_hash(); | |
| 2384 | - | mntput(no_free_ptr(p)); | |
| 2385 | 2324 | } | |
| 2386 | 2325 | } | |
| 2387 | 2326 | ||
| 2388 | 2327 | /* locks: namespace_shared && pinned(mnt) || mount_locked_reader */ | |
| 2389 | - | bool has_locked_children(struct mount *mnt, struct dentry *dentry) | |
| 2328 | + | static bool __has_locked_children(struct mount *mnt, struct dentry *dentry) | |
| 2390 | 2329 | { | |
| 2391 | 2330 | struct mount *child; | |
| 2392 | 2331 | ||
| @@ -2400,16 +2339,10 @@ bool has_locked_children(struct mount *mnt, struct dentry *dentry) | |||
| 2400 | 2339 | return false; | |
| 2401 | 2340 | } | |
| 2402 | 2341 | ||
| 2403 | - | /* locks: namespace_shared && pinned(mnt) || mount_locked_reader */ | |
| 2404 | - | static bool __has_children(struct mount *mnt, struct dentry *dentry) | |
| 2342 | + | bool has_locked_children(struct mount *mnt, struct dentry *dentry) | |
| 2405 | 2343 | { | |
| 2406 | - | struct mount *child; | |
| 2407 | - | ||
| 2408 | - | list_for_each_entry(child, &mnt->mnt_mounts, mnt_child) { | |
| 2409 | - | if (is_subdir(child->mnt_mountpoint, dentry)) | |
| 2410 | - | return true; | |
| 2411 | - | } | |
| 2412 | - | return false; | |
| 2344 | + | guard(mount_locked_reader)(); | |
| 2345 | + | return __has_locked_children(mnt, dentry); | |
| 2413 | 2346 | } | |
| 2414 | 2347 | ||
| 2415 | 2348 | /* | |
| @@ -2468,7 +2401,7 @@ struct vfsmount *clone_private_mount(const struct path *path) | |||
| 2468 | 2401 | if (!ns_capable(old_mnt->mnt_ns->user_ns, CAP_SYS_ADMIN)) | |
| 2469 | 2402 | return ERR_PTR(-EPERM); | |
| 2470 | 2403 | ||
| 2471 | - | if (has_locked_children(old_mnt, path->dentry)) | |
| 2404 | + | if (__has_locked_children(old_mnt, path->dentry)) | |
| 2472 | 2405 | return ERR_PTR(-EINVAL); | |
| 2473 | 2406 | ||
| 2474 | 2407 | new_mnt = clone_mnt(old_mnt, path->dentry, CL_PRIVATE); | |
| @@ -2631,11 +2564,11 @@ enum mnt_tree_flags_t { | |||
| 2631 | 2564 | static int attach_recursive_mnt(struct mount *source_mnt, | |
| 2632 | 2565 | const struct pinned_mountpoint *dest) | |
| 2633 | 2566 | { | |
| 2567 | + | struct user_namespace *user_ns = current->nsproxy->mnt_ns->user_ns; | |
| 2634 | 2568 | struct mount *dest_mnt = dest->parent; | |
| 2635 | 2569 | struct mountpoint *dest_mp = dest->mp; | |
| 2636 | 2570 | HLIST_HEAD(tree_list); | |
| 2637 | 2571 | struct mnt_namespace *ns = dest_mnt->mnt_ns; | |
| 2638 | - | struct user_namespace *user_ns = ns->user_ns; | |
| 2639 | 2572 | struct pinned_mountpoint root = {}; | |
| 2640 | 2573 | struct mountpoint *shorter = NULL; | |
| 2641 | 2574 | struct mount *child, *p; | |
| @@ -2644,31 +2577,13 @@ static int attach_recursive_mnt(struct mount *source_mnt, | |||
| 2644 | 2577 | int err = 0; | |
| 2645 | 2578 | bool moving = mnt_has_parent(source_mnt); | |
| 2646 | 2579 | ||
| 2647 | - | /* | |
| 2648 | - | * A caller in an unprivileged mount namespaces may trigger an | |
| 2649 | - | * automount and propagate locked mounts into privileged mount | |
| 2650 | - | * namespaces. Take ownership from the target mount namespace. | |
| 2651 | - | * It's equivalent for everything but the automount case. | |
| 2652 | - | * | |
| 2653 | - | * Detached trees in anonymous mount namespaces by be handed | |
| 2654 | - | * over via SCM_RIGHTS or inherited in other ways on purpose | |
| 2655 | - | * the attaching task's mount namespace is authoritative, not | |
| 2656 | - | * the creator of the detached tree. | |
| 2657 | - | */ | |
| 2658 | - | if (is_anon_ns(ns)) | |
| 2659 | - | user_ns = current->nsproxy->mnt_ns->user_ns; | |
| 2660 | - | else | |
| 2661 | - | user_ns = ns->user_ns; | |
| 2662 | - | ||
| 2663 | 2580 | /* | |
| 2664 | 2581 | * Preallocate a mountpoint in case the new mounts need to be | |
| 2665 | 2582 | * mounted beneath mounts on the same mountpoint. | |
| 2666 | 2583 | */ | |
| 2667 | - | for (top = source_mnt; ; top = top->overmount) { | |
| 2584 | + | for (top = source_mnt; unlikely(top->overmount); top = top->overmount) { | |
| 2668 | 2585 | if (!shorter && is_mnt_ns_file(top->mnt.mnt_root)) | |
| 2669 | 2586 | shorter = top->mnt_mp; | |
| 2670 | - | if (likely(!top->overmount)) | |
| 2671 | - | break; | |
| 2672 | 2587 | } | |
| 2673 | 2588 | err = get_mountpoint(top->mnt.mnt_root, &root); | |
| 2674 | 2589 | if (err) | |
| @@ -2739,17 +2654,15 @@ static int attach_recursive_mnt(struct mount *source_mnt, | |||
| 2739 | 2654 | /* | |
| 2740 | 2655 | * If @q was locked it was meant to hide | |
| 2741 | 2656 | * whatever was under it. Let @child take over | |
| 2742 | - | * that job and lock it. If @child is the mount | |
| 2743 | - | * the caller placed we can then unlock @q: | |
| 2744 | - | * nothing another namespace does removes it | |
| 2745 | - | * again. A propagated copy goes away when the | |
| 2746 | - | * mounter of the original unmounts it, so @q | |
| 2747 | - | * keeps its lock. | |
| 2657 | + | * that job and lock it, then we can unlock @q. | |
| 2658 | + | * That'll allow another namespace to shed @q | |
| 2659 | + | * and reveal @child. Clearly, that mounter | |
| 2660 | + | * consented to this by not severing the mount | |
| 2661 | + | * relationship. Otherwise, what's the point. | |
| 2748 | 2662 | */ | |
| 2749 | 2663 | if (IS_MNT_LOCKED(q)) { | |
| 2750 | 2664 | child->mnt.mnt_flags |= MNT_LOCKED; | |
| 2751 | - | if (child == source_mnt) | |
| 2752 | - | q->mnt.mnt_flags &= ~MNT_LOCKED; | |
| 2665 | + | q->mnt.mnt_flags &= ~MNT_LOCKED; | |
| 2753 | 2666 | } | |
| 2754 | 2667 | mnt_change_mountpoint(r, mp, q); | |
| 2755 | 2668 | } | |
| @@ -2846,11 +2759,6 @@ static void do_lock_mount(const struct path *path, | |||
| 2846 | 2759 | ||
| 2847 | 2760 | scoped_guard(mount_locked_reader) { | |
| 2848 | 2761 | m = where_to_mount(path, &dentry, beneath); | |
| 2849 | - | /* sticky, so it takes no locks to refuse it */ | |
| 2850 | - | if (unlikely(cant_mount(dentry))) { | |
| 2851 | - | res->parent = ERR_PTR(-ENOENT); | |
| 2852 | - | return; | |
| 2853 | - | } | |
| 2854 | 2762 | if (&m->mnt != path->mnt) { | |
| 2855 | 2763 | mntget(&m->mnt); | |
| 2856 | 2764 | dget(dentry); | |
| @@ -3081,14 +2989,7 @@ static struct mount *__do_loopback(const struct path *old_path, | |||
| 3081 | 2989 | if (!may_copy_tree(old_path)) | |
| 3082 | 2990 | return ERR_PTR(-EINVAL); | |
| 3083 | 2991 | ||
| 3084 | - | /* a pseudo dentry is freed without an RCU delay, no walk may find it */ | |
| 3085 | - | if (old_path->dentry->d_flags & DCACHE_NORCU) | |
| 3086 | - | return ERR_PTR(-EINVAL); | |
| 3087 | - | ||
| 3088 | - | if (recurse && !old->mnt_ns) | |
| 3089 | - | return ERR_PTR(-EINVAL); | |
| 3090 | - | ||
| 3091 | - | if (!recurse && has_locked_children(old, old_path->dentry)) | |
| 2992 | + | if (!recurse && __has_locked_children(old, old_path->dentry)) | |
| 3092 | 2993 | return ERR_PTR(-EINVAL); | |
| 3093 | 2994 | ||
| 3094 | 2995 | if (recurse) | |
| @@ -3127,11 +3028,7 @@ static int do_loopback(const struct path *path, const char *old_name, | |||
| 3127 | 3028 | if (IS_ERR(mnt)) | |
| 3128 | 3029 | return PTR_ERR(mnt); | |
| 3129 | 3030 | ||
| 3130 | - | /* the copy may carry mount namespace files from below the source */ | |
| 3131 | - | if (recurse && !check_for_nsfs_mounts(mnt)) | |
| 3132 | - | err = -EINVAL; | |
| 3133 | - | else | |
| 3134 | - | err = graft_tree(mnt, &mp); | |
| 3031 | + | err = graft_tree(mnt, &mp); | |
| 3135 | 3032 | if (err) { | |
| 3136 | 3033 | lock_mount_hash(); | |
| 3137 | 3034 | umount_tree(mnt, UMOUNT_SYNC); | |
| @@ -3191,7 +3088,7 @@ static struct file *open_detached_copy(struct path *path, unsigned int flags) | |||
| 3191 | 3088 | path->mnt = mntget(&ns->root->mnt); | |
| 3192 | 3089 | file = dentry_open(path, O_PATH, current_cred()); | |
| 3193 | 3090 | if (IS_ERR(file)) | |
| 3194 | - | dissolve_on_fput(no_free_ptr(path->mnt)); | |
| 3091 | + | dissolve_on_fput(path->mnt); | |
| 3195 | 3092 | else | |
| 3196 | 3093 | file->f_mode |= FMODE_NEED_UNMOUNT; | |
| 3197 | 3094 | return file; | |
| @@ -3213,18 +3110,12 @@ static struct mnt_namespace *create_new_namespace(struct path *path, | |||
| 3213 | 3110 | struct mount *mnt; | |
| 3214 | 3111 | unsigned int copy_flags = 0; | |
| 3215 | 3112 | bool locked = false, recurse = flags & MOUNT_COPY_RECURSIVE; | |
| 3216 | - | bool foreign = user_ns != ns->user_ns; | |
| 3217 | 3113 | ||
| 3218 | 3114 | if (unlikely(!d_can_lookup(path->dentry))) | |
| 3219 | 3115 | return ERR_PTR(-ENOTDIR); | |
| 3220 | 3116 | ||
| 3221 | - | /* | |
| 3222 | - | * Without privileges over the mount namespace the copy is made from | |
| 3223 | - | * nothing mounted below @path may be left out. It would reveal what | |
| 3224 | - | * it covers. That's what unshare() gives such a caller as well. | |
| 3225 | - | */ | |
| 3226 | - | if (foreign) | |
| 3227 | - | copy_flags |= CL_SLAVE | CL_COPY_UNBINDABLE; | |
| 3117 | + | if (user_ns != ns->user_ns) | |
| 3118 | + | copy_flags |= CL_SLAVE; | |
| 3228 | 3119 | ||
| 3229 | 3120 | new_ns = alloc_mnt_ns(user_ns, false); | |
| 3230 | 3121 | if (IS_ERR(new_ns)) | |
| @@ -3258,14 +3149,10 @@ static struct mnt_namespace *create_new_namespace(struct path *path, | |||
| 3258 | 3149 | /* | |
| 3259 | 3150 | * We don't emulate unshare()ing a mount namespace. We stick to | |
| 3260 | 3151 | * the restrictions of creating detached bind-mounts. It has a | |
| 3261 | - | * lot saner and simpler semantics. A caller without privileges | |
| 3262 | - | * over the mount namespace can't leave out any child though. | |
| 3152 | + | * lot saner and simpler semantics. | |
| 3263 | 3153 | */ | |
| 3264 | 3154 | if (flags & MOUNT_COPY_NEW) | |
| 3265 | 3155 | mnt = clone_mnt(real_mount(path->mnt), path->dentry, copy_flags); | |
| 3266 | - | else if (foreign && !recurse && | |
| 3267 | - | __has_children(real_mount(path->mnt), path->dentry)) | |
| 3268 | - | mnt = ERR_PTR(-EINVAL); | |
| 3269 | 3156 | else | |
| 3270 | 3157 | mnt = __do_loopback(path, recurse, copy_flags); | |
| 3271 | 3158 | scoped_guard(mount_writer) { | |
| @@ -3282,7 +3169,7 @@ static struct mnt_namespace *create_new_namespace(struct path *path, | |||
| 3282 | 3169 | * of the real rootfs we created. | |
| 3283 | 3170 | */ | |
| 3284 | 3171 | attach_mnt(mnt, new_ns_root, mp.mp); | |
| 3285 | - | if (foreign) | |
| 3172 | + | if (user_ns != ns->user_ns) | |
| 3286 | 3173 | lock_mnt_tree(new_ns_root); | |
| 3287 | 3174 | } | |
| 3288 | 3175 | ||
| @@ -3576,11 +3463,11 @@ static int do_set_group(const struct path *from_path, const struct path *to_path | |||
| 3576 | 3463 | return -EINVAL; | |
| 3577 | 3464 | ||
| 3578 | 3465 | /* From mount should not have locked children in place of To's root */ | |
| 3579 | - | if (has_locked_children(from, to->mnt.mnt_root)) | |
| 3466 | + | if (__has_locked_children(from, to->mnt.mnt_root)) | |
| 3580 | 3467 | return -EINVAL; | |
| 3581 | 3468 | ||
| 3582 | 3469 | /* Setting sharing groups is only allowed on private mounts */ | |
| 3583 | - | if (IS_MNT_SHARED(to) || IS_MNT_SLAVE(to) || IS_MNT_UNBINDABLE(to)) | |
| 3470 | + | if (IS_MNT_SHARED(to) || IS_MNT_SLAVE(to)) | |
| 3584 | 3471 | return -EINVAL; | |
| 3585 | 3472 | ||
| 3586 | 3473 | /* From should not be private */ | |
| @@ -3856,7 +3743,7 @@ static int do_add_mount(struct mount *newmnt, const struct pinned_mountpoint *mp | |||
| 3856 | 3743 | if (!(mnt_flags & MNT_SHRINKABLE)) | |
| 3857 | 3744 | return -EINVAL; | |
| 3858 | 3745 | /* ... and for those we'd better have mountpoint still alive */ | |
| 3859 | - | if (!is_mounted(&parent->mnt)) | |
| 3746 | + | if (!parent->mnt_ns) | |
| 3860 | 3747 | return -EINVAL; | |
| 3861 | 3748 | } | |
| 3862 | 3749 | ||
| @@ -4066,8 +3953,6 @@ void mark_mounts_for_expiry(struct list_head *mounts) | |||
| 4066 | 3953 | list_for_each_entry_safe(mnt, next, mounts, mnt_expire) { | |
| 4067 | 3954 | if (!is_mounted(&mnt->mnt)) | |
| 4068 | 3955 | continue; | |
| 4069 | - | /* lock_mnt_tree() leaves expirable mounts alone */ | |
| 4070 | - | VFS_WARN_ON_ONCE(IS_MNT_LOCKED(mnt)); | |
| 4071 | 3956 | if (!xchg(&mnt->mnt_expiry_mark, 1) || | |
| 4072 | 3957 | propagate_mount_busy(mnt, 1)) | |
| 4073 | 3958 | continue; | |
| @@ -4075,11 +3960,6 @@ void mark_mounts_for_expiry(struct list_head *mounts) | |||
| 4075 | 3960 | } | |
| 4076 | 3961 | while (!list_empty(&graveyard)) { | |
| 4077 | 3962 | mnt = list_first_entry(&graveyard, struct mount, mnt_expire); | |
| 4078 | - | /* an earlier umount_tree() may have moved a busy mount here */ | |
| 4079 | - | if (propagate_mount_busy(mnt, 1)) { | |
| 4080 | - | list_move(&mnt->mnt_expire, mounts); | |
| 4081 | - | continue; | |
| 4082 | - | } | |
| 4083 | 3963 | touch_mnt_namespace(mnt->mnt_ns); | |
| 4084 | 3964 | umount_tree(mnt, UMOUNT_PROPAGATE|UMOUNT_SYNC); | |
| 4085 | 3965 | } | |
| @@ -4087,38 +3967,17 @@ void mark_mounts_for_expiry(struct list_head *mounts) | |||
| 4087 | 3967 | ||
| 4088 | 3968 | EXPORT_SYMBOL_GPL(mark_mounts_for_expiry); | |
| 4089 | 3969 | ||
| 4090 | - | /* | |
| 4091 | - | * Unmount @mnt if it's a shrinkable mount without children that nobody uses. | |
| 4092 | - | * | |
| 4093 | - | * mount_lock must be held for write | |
| 4094 | - | */ | |
| 4095 | - | static bool shrink_submount(struct mount *mnt) | |
| 4096 | - | { | |
| 4097 | - | /* not the kernel's to remove either */ | |
| 4098 | - | if (IS_MNT_LOCKED(mnt) || propagate_mount_busy(mnt, 1)) | |
| 4099 | - | return false; | |
| 4100 | - | touch_mnt_namespace(mnt->mnt_ns); | |
| 4101 | - | umount_tree(mnt, UMOUNT_PROPAGATE|UMOUNT_SYNC); | |
| 4102 | - | return true; | |
| 4103 | - | } | |
| 4104 | - | ||
| 4105 | 3970 | /* | |
| 4106 | 3971 | * Ripoff of 'select_parent()' | |
| 4107 | 3972 | * | |
| 4108 | - | * unmount the shrinkable submounts of @parent that aren't busy, children | |
| 4109 | - | * before their parent, and say whether anything went | |
| 4110 | - | * | |
| 4111 | - | * The cursor into the children of @this_parent survives the umount of a | |
| 4112 | - | * child mount without child mounts. The mounts that get umounted together with | |
| 4113 | - | * it are located under receiving mounts of @this_parent and never under | |
| 4114 | - | * @this_parent itself. The one exception is @this_parent getting unmounted | |
| 4115 | - | * then the walk starts over. | |
| 3973 | + | * search the list of submounts for a given mountpoint, and move any | |
| 3974 | + | * shrinkable submounts to the 'graveyard' list. | |
| 4116 | 3975 | */ | |
| 4117 | - | static bool __shrink_submounts(struct mount *parent) | |
| 3976 | + | static int select_submounts(struct mount *parent, struct list_head *graveyard) | |
| 4118 | 3977 | { | |
| 4119 | 3978 | struct mount *this_parent = parent; | |
| 4120 | 3979 | struct list_head *next; | |
| 4121 | - | bool shrunk = false; | |
| 3980 | + | int found = 0; | |
| 4122 | 3981 | ||
| 4123 | 3982 | repeat: | |
| 4124 | 3983 | next = this_parent->mnt_mounts.next; | |
| @@ -4137,45 +3996,42 @@ resume: | |||
| 4137 | 3996 | this_parent = mnt; | |
| 4138 | 3997 | goto repeat; | |
| 4139 | 3998 | } | |
| 4140 | - | if (!shrink_submount(mnt)) | |
| 4141 | - | continue; | |
| 4142 | - | shrunk = true; | |
| 4143 | - | if (unlikely(this_parent->mnt.mnt_flags & MNT_UMOUNT)) | |
| 4144 | - | return true; | |
| 3999 | + | ||
| 4000 | + | if (!propagate_mount_busy(mnt, 1)) { | |
| 4001 | + | list_move_tail(&mnt->mnt_expire, graveyard); | |
| 4002 | + | found++; | |
| 4003 | + | } | |
| 4145 | 4004 | } | |
| 4146 | 4005 | /* | |
| 4147 | 4006 | * All done at this level ... ascend and resume the search | |
| 4148 | 4007 | */ | |
| 4149 | 4008 | if (this_parent != parent) { | |
| 4150 | - | struct mount *mnt = this_parent; | |
| 4151 | - | ||
| 4152 | - | next = mnt->mnt_child.next; | |
| 4153 | - | this_parent = mnt->mnt_parent; | |
| 4154 | - | /* its children are gone, maybe it can go as well */ | |
| 4155 | - | if (shrink_submount(mnt)) { | |
| 4156 | - | shrunk = true; | |
| 4157 | - | if (unlikely(this_parent->mnt.mnt_flags & MNT_UMOUNT)) | |
| 4158 | - | return true; | |
| 4159 | - | } | |
| 4009 | + | next = this_parent->mnt_child.next; | |
| 4010 | + | this_parent = this_parent->mnt_parent; | |
| 4160 | 4011 | goto resume; | |
| 4161 | 4012 | } | |
| 4162 | - | return shrunk; | |
| 4013 | + | return found; | |
| 4163 | 4014 | } | |
| 4164 | 4015 | ||
| 4165 | 4016 | /* | |
| 4166 | - | * unmount the shrinkable submounts of @mnt that aren't busy | |
| 4167 | - | * | |
| 4168 | - | * The busy check and the umount of a mount are adjacent. An umount can | |
| 4169 | - | * still empty or move a mount in a part of the tree that was walked | |
| 4170 | - | * already, so walk again until nothing goes. | |
| 4017 | + | * process a list of expirable mountpoints with the intent of discarding any | |
| 4018 | + | * submounts of a specific parent mountpoint | |
| 4171 | 4019 | * | |
| 4172 | 4020 | * mount_lock must be held for write | |
| 4173 | 4021 | */ | |
| 4174 | 4022 | static void shrink_submounts(struct mount *mnt) | |
| 4175 | 4023 | { | |
| 4176 | - | for (;;) { | |
| 4177 | - | if (!__shrink_submounts(mnt)) | |
| 4178 | - | break; | |
| 4024 | + | LIST_HEAD(graveyard); | |
| 4025 | + | struct mount *m; | |
| 4026 | + | ||
| 4027 | + | /* extract submounts of 'mountpoint' from the expiration list */ | |
| 4028 | + | while (select_submounts(mnt, &graveyard)) { | |
| 4029 | + | while (!list_empty(&graveyard)) { | |
| 4030 | + | m = list_first_entry(&graveyard, struct mount, | |
| 4031 | + | mnt_expire); | |
| 4032 | + | touch_mnt_namespace(m->mnt_ns); | |
| 4033 | + | umount_tree(m, UMOUNT_PROPAGATE|UMOUNT_SYNC); | |
| 4034 | + | } | |
| 4179 | 4035 | } | |
| 4180 | 4036 | } | |
| 4181 | 4037 | ||
| @@ -4340,8 +4196,6 @@ static void free_mnt_ns(struct mnt_namespace *ns) | |||
| 4340 | 4196 | if (!is_anon_ns(ns)) | |
| 4341 | 4197 | ns_common_free(ns); | |
| 4342 | 4198 | dec_mnt_namespaces(ns->ucounts); | |
| 4343 | - | /* the last active reference is gone, no mark can show up anymore */ | |
| 4344 | - | fsnotify_mntns_delete(ns); | |
| 4345 | 4199 | mnt_ns_tree_remove(ns); | |
| 4346 | 4200 | } | |
| 4347 | 4201 | ||
| @@ -4691,7 +4545,7 @@ SYSCALL_DEFINE3(fsmount, int, fs_fd, unsigned int, flags, | |||
| 4691 | 4545 | FD_PREPARE(fdf, (flags & FSMOUNT_CLOEXEC) ? O_CLOEXEC : 0, | |
| 4692 | 4546 | dentry_open(&new_path, O_PATH, fc->cred)); | |
| 4693 | 4547 | if (fdf.err) { | |
| 4694 | - | dissolve_on_fput(no_free_ptr(new_path.mnt)); | |
| 4548 | + | dissolve_on_fput(new_path.mnt); | |
| 4695 | 4549 | return fdf.err; | |
| 4696 | 4550 | } | |
| 4697 | 4551 | ||
| @@ -4843,15 +4697,14 @@ int path_pivot_root(struct path *new, struct path *old) | |||
| 4843 | 4697 | ||
| 4844 | 4698 | new_mnt = real_mount(new->mnt); | |
| 4845 | 4699 | root_mnt = real_mount(root.mnt); | |
| 4846 | - | /* only a mounted mount has a parent that namespace_sem pins */ | |
| 4847 | - | if (!check_mnt(root_mnt) || !check_mnt(new_mnt)) | |
| 4848 | - | return -EINVAL; | |
| 4849 | 4700 | ex_parent = new_mnt->mnt_parent; | |
| 4850 | 4701 | root_parent = root_mnt->mnt_parent; | |
| 4851 | 4702 | if (IS_MNT_SHARED(old_mnt) || | |
| 4852 | 4703 | IS_MNT_SHARED(ex_parent) || | |
| 4853 | 4704 | IS_MNT_SHARED(root_parent)) | |
| 4854 | 4705 | return -EINVAL; | |
| 4706 | + | if (!check_mnt(root_mnt) || !check_mnt(new_mnt)) | |
| 4707 | + | return -EINVAL; | |
| 4855 | 4708 | if (new_mnt->mnt.mnt_flags & MNT_LOCKED) | |
| 4856 | 4709 | return -EINVAL; | |
| 4857 | 4710 | if (d_unlinked(new->dentry)) | |
| @@ -5102,11 +4955,6 @@ static int do_mount_setattr(const struct path *path, struct mount_kattr *kattr) | |||
| 5102 | 4955 | * propagation. | |
| 5103 | 4956 | */ | |
| 5104 | 4957 | namespace_lock(); | |
| 5105 | - | /* invent_group_ids() walks the tree, only walk a mounted one */ | |
| 5106 | - | if (!anon_ns_root(mnt) && !check_mnt(mnt)) { | |
| 5107 | - | namespace_unlock(); | |
| 5108 | - | return -EINVAL; | |
| 5109 | - | } | |
| 5110 | 4958 | if (kattr->propagation == MS_SHARED) { | |
| 5111 | 4959 | err = invent_group_ids(mnt, kattr->kflags & MOUNT_KATTR_RECURSE); | |
| 5112 | 4960 | if (err) { | |
| @@ -5119,7 +4967,6 @@ static int do_mount_setattr(const struct path *path, struct mount_kattr *kattr) | |||
| 5119 | 4967 | err = -EINVAL; | |
| 5120 | 4968 | lock_mount_hash(); | |
| 5121 | 4969 | ||
| 5122 | - | /* Checked under namespace_sem already if the propagation changes. */ | |
| 5123 | 4970 | if (!anon_ns_root(mnt) && !check_mnt(mnt)) | |
| 5124 | 4971 | goto out; | |
| 5125 | 4972 | ||
| @@ -5472,25 +5319,15 @@ static void statmount_sb_basic(struct kstatmount *s) | |||
| 5472 | 5319 | s->sm.sb_flags = sb->s_flags & (SB_RDONLY|SB_SYNCHRONOUS|SB_DIRSYNC|SB_LAZYTIME); | |
| 5473 | 5320 | } | |
| 5474 | 5321 | ||
| 5475 | - | static void statmount_mnt_parent(struct kstatmount *s, const struct mount *m) | |
| 5476 | - | { | |
| 5477 | - | s->sm.mnt_parent_id = m->mnt_parent->mnt_id_unique; | |
| 5478 | - | s->sm.mnt_parent_id_old = m->mnt_parent->mnt_id; | |
| 5479 | - | } | |
| 5480 | - | ||
| 5481 | 5322 | static void statmount_mnt_basic(struct kstatmount *s) | |
| 5482 | 5323 | { | |
| 5483 | 5324 | struct mount *m = real_mount(s->mnt); | |
| 5484 | 5325 | ||
| 5485 | 5326 | s->sm.mask |= STATMOUNT_MNT_BASIC; | |
| 5486 | 5327 | s->sm.mnt_id = m->mnt_id_unique; | |
| 5328 | + | s->sm.mnt_parent_id = m->mnt_parent->mnt_id_unique; | |
| 5487 | 5329 | s->sm.mnt_id_old = m->mnt_id; | |
| 5488 | - | /* An unmounted mount is cut loose from its parent under mount_lock alone. */ | |
| 5489 | - | if (likely(is_mounted(s->mnt))) | |
| 5490 | - | statmount_mnt_parent(s, m); | |
| 5491 | - | else | |
| 5492 | - | scoped_guard(mount_locked_reader) | |
| 5493 | - | statmount_mnt_parent(s, m); | |
| 5330 | + | s->sm.mnt_parent_id_old = m->mnt_parent->mnt_id; | |
| 5494 | 5331 | s->sm.mnt_attr = mnt_to_attr_flags(&m->mnt); | |
| 5495 | 5332 | s->sm.mnt_propagation = mnt_to_propagation_flags(m); | |
| 5496 | 5333 | s->sm.mnt_peer_group = m->mnt_group_id; | |
| @@ -6362,25 +6199,6 @@ static void __init mount_rootfs_on_nullfs(struct vfsmount *mnt, | |||
| 6362 | 6199 | attach_mnt(real_mount(mnt), mp.parent, mp.mp); | |
| 6363 | 6200 | } | |
| 6364 | 6201 | ||
| 6365 | - | static struct vfsmount *__init knullfs_file_mount(void) | |
| 6366 | - | { | |
| 6367 | - | struct dentry *file; | |
| 6368 | - | struct mount *mnt; | |
| 6369 | - | ||
| 6370 | - | file = nullfs_new_file(knullfs->mnt_sb); | |
| 6371 | - | if (IS_ERR(file)) | |
| 6372 | - | return ERR_CAST(file); | |
| 6373 | - | mnt = clone_mnt(real_mount(knullfs), file, CL_PRIVATE); | |
| 6374 | - | dput(file); | |
| 6375 | - | if (IS_ERR(mnt)) | |
| 6376 | - | return ERR_CAST(mnt); | |
| 6377 | - | mnt->mnt_ns = MNT_NS_INTERNAL; | |
| 6378 | - | mnt->mnt.mnt_flags |= MNT_INTERNAL; | |
| 6379 | - | mnt->mnt.mnt_flags &= ~MNT_READONLY; | |
| 6380 | - | dont_mount(mnt->mnt.mnt_root); | |
| 6381 | - | return &mnt->mnt; | |
| 6382 | - | } | |
| 6383 | - | ||
| 6384 | 6202 | static void __init init_mount_tree(void) | |
| 6385 | 6203 | { | |
| 6386 | 6204 | struct vfsmount *mnt, *nullfs_mnt; | |
| @@ -6392,14 +6210,10 @@ static void __init init_mount_tree(void) | |||
| 6392 | 6210 | * | |
| 6393 | 6211 | * (1) nullfs with mount id 1 | |
| 6394 | 6212 | * (2) mutable rootfs with mount id 2 | |
| 6395 | - | * (3) private nullfs for kthreads (SB_KERNMOUNT), kept in knullfs | |
| 6396 | - | * (4) a second mount of (3) rooted on a regular file, kept in | |
| 6397 | - | * knullfs_file | |
| 6213 | + | * (3) private nullfs for kthreads (SB_KERNMOUNT) | |
| 6398 | 6214 | * | |
| 6399 | 6215 | * with (2) mounted on top of (1). The init_task's root and pwd | |
| 6400 | 6216 | * are pointed at (3) so all kthreads start isolated in nullfs. | |
| 6401 | - | * A lookup at the cover an unmounted mount left behind finds (3) | |
| 6402 | - | * or (4), see __lookup_mnt(). | |
| 6403 | 6217 | */ | |
| 6404 | 6218 | nullfs_mnt = vfs_kern_mount(&nullfs_fs_type, 0, "nullfs", NULL); | |
| 6405 | 6219 | if (IS_ERR(nullfs_mnt)) | |
| @@ -6431,18 +6245,11 @@ static void __init init_mount_tree(void) | |||
| 6431 | 6245 | init_mnt_ns.nr_mounts++; | |
| 6432 | 6246 | } | |
| 6433 | 6247 | ||
| 6434 | - | knullfs = kern_mount(&nullfs_fs_type); | |
| 6435 | - | if (IS_ERR(knullfs)) | |
| 6248 | + | nullfs_mnt = kern_mount(&nullfs_fs_type); | |
| 6249 | + | if (IS_ERR(nullfs_mnt)) | |
| 6436 | 6250 | panic("VFS: Failed to create private nullfs instance"); | |
| 6437 | - | /* nothing is ever mounted on the root of a kernel thread */ | |
| 6438 | - | dont_mount(knullfs->mnt_root); | |
| 6439 | - | /* and nothing is ever written through it */ | |
| 6440 | - | knullfs->mnt_flags |= MNT_READONLY; | |
| 6441 | - | knullfs_file = knullfs_file_mount(); | |
| 6442 | - | if (IS_ERR(knullfs_file)) | |
| 6443 | - | panic("VFS: Failed to create the nullfs file stand-in"); | |
| 6444 | - | root.mnt = knullfs; | |
| 6445 | - | root.dentry = knullfs->mnt_root; | |
| 6251 | + | root.mnt = nullfs_mnt; | |
| 6252 | + | root.dentry = nullfs_mnt->mnt_root; | |
| 6446 | 6253 | ||
| 6447 | 6254 | init_task.nsproxy->mnt_ns = &init_mnt_ns; | |
| 6448 | 6255 | get_mnt_ns(&init_mnt_ns); | |
modified fs/netfs/buffered_read.c
| @@ -541,13 +541,6 @@ static int netfs_read_gaps(struct file *file, struct folio *folio) | |||
| 541 | 541 | ||
| 542 | 542 | ret = netfs_wait_for_read(rreq); | |
| 543 | 543 | if (ret >= 0) { | |
| 544 | - | if (ret < flen) { | |
| 545 | - | struct iov_iter iter; | |
| 546 | - | ||
| 547 | - | iov_iter_bvec(&iter, ITER_DEST, bvec, i, flen); | |
| 548 | - | iov_iter_advance(&iter, ret); | |
| 549 | - | iov_iter_zero(flen - ret, &iter); | |
| 550 | - | } | |
| 551 | 544 | if (group) | |
| 552 | 545 | folio_change_private(folio, group); | |
| 553 | 546 | else | |
modified fs/netfs/buffered_write.c
| @@ -469,7 +469,6 @@ ssize_t netfs_buffered_write_iter_locked(struct kiocb *iocb, struct iov_iter *fr | |||
| 469 | 469 | struct netfs_group *netfs_group) | |
| 470 | 470 | { | |
| 471 | 471 | struct file *file = iocb->ki_filp; | |
| 472 | - | struct inode *inode = file_inode(file); | |
| 473 | 472 | ssize_t ret; | |
| 474 | 473 | ||
| 475 | 474 | trace_netfs_write_iter(iocb, from); | |
| @@ -482,14 +481,6 @@ ssize_t netfs_buffered_write_iter_locked(struct kiocb *iocb, struct iov_iter *fr | |||
| 482 | 481 | if (ret) | |
| 483 | 482 | return ret; | |
| 484 | 483 | ||
| 485 | - | if (iocb->ki_pos > i_size_read(inode)) { | |
| 486 | - | ret = netfs_clear_stale_pre_isize(inode, i_size_read(inode), | |
| 487 | - | iocb->ki_pos, | |
| 488 | - | iocb->ki_flags & IOCB_NOWAIT); | |
| 489 | - | if (ret) | |
| 490 | - | return ret; | |
| 491 | - | } | |
| 492 | - | ||
| 493 | 484 | return netfs_perform_write(iocb, from, netfs_group); | |
| 494 | 485 | } | |
| 495 | 486 | EXPORT_SYMBOL(netfs_buffered_write_iter_locked); | |
modified fs/netfs/direct_write.c
| @@ -359,15 +359,6 @@ ssize_t netfs_unbuffered_write_iter(struct kiocb *iocb, struct iov_iter *from) | |||
| 359 | 359 | ret = file_update_time(file); | |
| 360 | 360 | if (ret < 0) | |
| 361 | 361 | goto out; | |
| 362 | - | ||
| 363 | - | if (iocb->ki_pos > i_size_read(inode)) { | |
| 364 | - | ret = netfs_clear_stale_pre_isize(inode, i_size_read(inode), | |
| 365 | - | iocb->ki_pos, | |
| 366 | - | iocb->ki_flags & IOCB_NOWAIT); | |
| 367 | - | if (ret < 0) | |
| 368 | - | goto out; | |
| 369 | - | } | |
| 370 | - | ||
| 371 | 362 | if (iocb->ki_flags & IOCB_NOWAIT) { | |
| 372 | 363 | /* We could block if there are any pages in the range. */ | |
| 373 | 364 | ret = -EAGAIN; | |
modified fs/netfs/internal.h
| @@ -80,8 +80,6 @@ ssize_t netfs_wait_for_write(struct netfs_io_request *rreq); | |||
| 80 | 80 | void netfs_wait_for_paused_read(struct netfs_io_request *rreq); | |
| 81 | 81 | void netfs_wait_for_paused_write(struct netfs_io_request *rreq); | |
| 82 | 82 | void netfs_wait_for_put_ra_refs(struct netfs_io_request *rreq); | |
| 83 | - | int netfs_clear_stale_pre_isize(struct inode *inode, uoff_t from, | |
| 84 | - | uoff_t to, bool nowait); | |
| 85 | 83 | ||
| 86 | 84 | /* | |
| 87 | 85 | * objects.c | |
modified fs/netfs/misc.c
| @@ -6,7 +6,6 @@ | |||
| 6 | 6 | */ | |
| 7 | 7 | ||
| 8 | 8 | #include <linux/swap.h> | |
| 9 | - | #include <linux/rmap.h> | |
| 10 | 9 | #include "internal.h" | |
| 11 | 10 | ||
| 12 | 11 | /** | |
| @@ -583,101 +582,3 @@ void netfs_wait_for_put_ra_refs(struct netfs_io_request *rreq) | |||
| 583 | 582 | trace_netfs_rreq(rreq, netfs_rreq_trace_waited_put_ra_refs); | |
| 584 | 583 | finish_wait(&rreq->waitq, &myself); | |
| 585 | 584 | } | |
| 586 | - | ||
| 587 | - | /** | |
| 588 | - | * netfs_clear_stale_isize - Clear stale pagecache in a to-be-created hole | |
| 589 | - | * @inode: The inode to act upon. | |
| 590 | - | * @from: The base of the hole to be made. | |
| 591 | - | * @to: The top of the hole to be made. | |
| 592 | - | * @nowait: True to return -EAGAIN rather than block. | |
| 593 | - | * @exclusive: True if the caller holds i_rwsem exclusively for the resize. | |
| 594 | - | * | |
| 595 | - | * Zero any data left in the pagecache within the [@from, @to) hole by a | |
| 596 | - | * write through an mmap so that it isn't exposed as file content once the | |
| 597 | - | * file is extended. Only the uptodate folio straddling @from can hold such | |
| 598 | - | * data as pages wholly beyond the EOF can't be faulted in, so the zeroing | |
| 599 | - | * is limited to that folio. The folio is zeroed rather than dropped so | |
| 600 | - | * that a concurrent extending write can't lose data. | |
| 601 | - | * | |
| 602 | - | * If @exclusive is false, @from is re-read from i_size and used to clamp | |
| 603 | - | * the zeroed range, for callers that may race with another writer also | |
| 604 | - | * extending the file (eg. multiple buffered writes extending the same file | |
| 605 | - | * under a shared i_rwsem). If @exclusive is true, for callers that hold | |
| 606 | - | * i_rwsem exclusively across the whole resize and have already updated | |
| 607 | - | * i_size to @to, staleness is decided from the folio's dirty state instead: | |
| 608 | - | * since no genuine concurrent buffered writer can be racing, a lockless | |
| 609 | - | * stat() adopting a server-confirmed size mid-resize has no data behind it | |
| 610 | - | * and never dirties the folio, so it can't fool this check into skipping | |
| 611 | - | * the zeroing the way it could fool the @exclusive false clamp. | |
| 612 | - | * | |
| 613 | - | * pagecache_isize_extended() can't be reused here: it is keyed on a | |
| 614 | - | * sub-page block size (a no-op when the block size is >= PAGE_SIZE, as on | |
| 615 | - | * network filesystems), runs after i_size is updated, can't honour | |
| 616 | - | * @nowait, and doesn't wait for writeback. Keep the two in sync if either | |
| 617 | - | * is changed. | |
| 618 | - | * | |
| 619 | - | * Return: 0 on success, or -EAGAIN if @nowait is set and the folio is | |
| 620 | - | * mapped or under writeback and so can't be cleaned without blocking. | |
| 621 | - | */ | |
| 622 | - | static int netfs_clear_stale_isize(struct inode *inode, uoff_t from, | |
| 623 | - | uoff_t to, bool nowait, bool exclusive) | |
| 624 | - | { | |
| 625 | - | struct address_space *mapping = inode->i_mapping; | |
| 626 | - | fgf_t fgp = FGP_LOCK; | |
| 627 | - | struct folio *folio; | |
| 628 | - | int ret; | |
| 629 | - | ||
| 630 | - | if (from >= to) | |
| 631 | - | return 0; | |
| 632 | - | ||
| 633 | - | if (nowait) | |
| 634 | - | fgp |= FGP_NOWAIT; | |
| 635 | - | ||
| 636 | - | folio = __filemap_get_folio(mapping, from >> PAGE_SHIFT, fgp, 0); | |
| 637 | - | if (IS_ERR(folio)) | |
| 638 | - | return PTR_ERR(folio) == -EAGAIN ? -EAGAIN : 0; | |
| 639 | - | ||
| 640 | - | ret = 0; | |
| 641 | - | if (nowait && (folio_mapped(folio) || folio_test_writeback(folio))) { | |
| 642 | - | ret = -EAGAIN; | |
| 643 | - | goto out; | |
| 644 | - | } | |
| 645 | - | ||
| 646 | - | folio_wait_writeback(folio); | |
| 647 | - | ||
| 648 | - | if (folio_mkclean(folio)) | |
| 649 | - | folio_mark_dirty(folio); | |
| 650 | - | ||
| 651 | - | if (folio_test_uptodate(folio) && | |
| 652 | - | (!exclusive || folio_test_dirty(folio))) { | |
| 653 | - | uoff_t fpos = folio_pos(folio); | |
| 654 | - | ||
| 655 | - | if (!exclusive) | |
| 656 | - | from = umax(from, i_size_read(inode)); | |
| 657 | - | if (from < to && from < fpos + folio_size(folio)) { | |
| 658 | - | size_t end = umin(to - fpos, folio_size(folio)); | |
| 659 | - | size_t offset = from - fpos; | |
| 660 | - | ||
| 661 | - | folio_zero_segment(folio, offset, end); | |
| 662 | - | } | |
| 663 | - | } | |
| 664 | - | out: | |
| 665 | - | folio_unlock(folio); | |
| 666 | - | folio_put(folio); | |
| 667 | - | return ret; | |
| 668 | - | } | |
| 669 | - | ||
| 670 | - | /* Clear stale pagecache before an extending buffered/DIO write. */ | |
| 671 | - | int netfs_clear_stale_pre_isize(struct inode *inode, uoff_t from, | |
| 672 | - | uoff_t to, bool nowait) | |
| 673 | - | { | |
| 674 | - | return netfs_clear_stale_isize(inode, from, to, nowait, false); | |
| 675 | - | } | |
| 676 | - | ||
| 677 | - | /* Clear stale pagecache when extending a file under an exclusive resize. */ | |
| 678 | - | void netfs_clear_stale_post_isize(struct inode *inode, uoff_t from, | |
| 679 | - | uoff_t to) | |
| 680 | - | { | |
| 681 | - | netfs_clear_stale_isize(inode, from, to, false, true); | |
| 682 | - | } | |
| 683 | - | EXPORT_SYMBOL(netfs_clear_stale_post_isize); | |
modified fs/netfs/read_collect.c
| @@ -33,22 +33,6 @@ static void netfs_clear_unread(struct netfs_io_subrequest *subreq) | |||
| 33 | 33 | __set_bit(NETFS_SREQ_HIT_EOF, &subreq->flags); | |
| 34 | 34 | } | |
| 35 | 35 | ||
| 36 | - | static void netfs_clear_unread_dio(struct netfs_io_subrequest *subreq) | |
| 37 | - | { | |
| 38 | - | uoff_t pos = subreq->start + subreq->transferred; | |
| 39 | - | struct netfs_io_request *rreq = subreq->rreq; | |
| 40 | - | size_t fill; | |
| 41 | - | ||
| 42 | - | if (pos >= rreq->i_size) | |
| 43 | - | return; | |
| 44 | - | ||
| 45 | - | fill = min_t(uoff_t, rreq->i_size - pos, | |
| 46 | - | subreq->len - subreq->transferred); | |
| 47 | - | ||
| 48 | - | netfs_reset_iter(subreq); | |
| 49 | - | subreq->transferred += iov_iter_zero(fill, &subreq->io_iter); | |
| 50 | - | } | |
| 51 | - | ||
| 52 | 36 | /* | |
| 53 | 37 | * Cancel the copy-to-cache mark on a folio. | |
| 54 | 38 | */ | |
| @@ -327,14 +311,6 @@ reassess: | |||
| 327 | 311 | test_bit(NETFS_SREQ_HIT_EOF, &front->flags)) | |
| 328 | 312 | netfs_read_unlock_folios(rreq, ¬es); | |
| 329 | 313 | } else { | |
| 330 | - | if (!(notes & HIT_PENDING) && | |
| 331 | - | front->error == 0 && | |
| 332 | - | transferred < front->len && | |
| 333 | - | test_bit(NETFS_SREQ_CLEAR_TAIL, &front->flags)) { | |
| 334 | - | netfs_clear_unread_dio(front); | |
| 335 | - | transferred = front->transferred; | |
| 336 | - | trace_netfs_sreq(front, netfs_sreq_trace_clear); | |
| 337 | - | } | |
| 338 | 314 | stream->collected_to = front->start + transferred; | |
| 339 | 315 | rreq->collected_to = stream->collected_to; | |
| 340 | 316 | } | |
modified fs/notify/mark.c
| @@ -903,10 +903,6 @@ static int fsnotify_add_mark_list(struct fsnotify_mark *mark, void *obj, | |||
| 903 | 903 | if (WARN_ON(!fsnotify_valid_obj_type(obj_type))) | |
| 904 | 904 | return -EINVAL; | |
| 905 | 905 | ||
| 906 | - | /* the filesystem doesn't want its objects watched */ | |
| 907 | - | if (sb && (sb->s_type->fs_flags & FS_DISALLOW_NOTIFY)) | |
| 908 | - | return -EINVAL; | |
| 909 | - | ||
| 910 | 906 | /* | |
| 911 | 907 | * Attach the sb info before attaching a connector to any object on sb. | |
| 912 | 908 | * The sb info will remain attached as long as sb lives. | |
modified fs/nullfs.c
| @@ -3,8 +3,6 @@ | |||
| 3 | 3 | #include <linux/fs/super_types.h> | |
| 4 | 4 | #include <linux/fs_context.h> | |
| 5 | 5 | #include <linux/magic.h> | |
| 6 | - | #include <linux/splice.h> | |
| 7 | - | #include <linux/uio.h> | |
| 8 | 6 | ||
| 9 | 7 | #include "mount.h" | |
| 10 | 8 | ||
| @@ -12,121 +10,6 @@ static const struct super_operations nullfs_super_operations = { | |||
| 12 | 10 | .statfs = simple_statfs, | |
| 13 | 11 | }; | |
| 14 | 12 | ||
| 15 | - | static loff_t nullfs_dir_llseek(struct file *file, loff_t offset, int whence) | |
| 16 | - | { | |
| 17 | - | /* an empty directory has two entries . and .. at offsets 0 and 1 */ | |
| 18 | - | return generic_file_llseek_size(file, offset, whence, 2, 2); | |
| 19 | - | } | |
| 20 | - | ||
| 21 | - | static int nullfs_dir_readdir(struct file *file, struct dir_context *ctx) | |
| 22 | - | { | |
| 23 | - | dir_emit_dots(file, ctx); | |
| 24 | - | return 0; | |
| 25 | - | } | |
| 26 | - | ||
| 27 | - | /* the one inode of nullfs is shared by every holder, so no locks on it */ | |
| 28 | - | static int nullfs_nolock(struct file *file, int cmd, struct file_lock *fl) | |
| 29 | - | { | |
| 30 | - | return -ENOLCK; | |
| 31 | - | } | |
| 32 | - | ||
| 33 | - | /* what libfs gives an empty directory, plus the refusal of file locks */ | |
| 34 | - | static const struct file_operations nullfs_dir_operations = { | |
| 35 | - | .llseek = nullfs_dir_llseek, | |
| 36 | - | .read = generic_read_dir, | |
| 37 | - | .iterate_shared = nullfs_dir_readdir, | |
| 38 | - | .fsync = noop_fsync, | |
| 39 | - | .lock = nullfs_nolock, | |
| 40 | - | .flock = nullfs_nolock, | |
| 41 | - | .fop_flags = FOP_IMMUTABLE, | |
| 42 | - | }; | |
| 43 | - | ||
| 44 | - | static ssize_t nullfs_file_read_iter(struct kiocb *iocb, struct iov_iter *to) | |
| 45 | - | { | |
| 46 | - | return 0; | |
| 47 | - | } | |
| 48 | - | ||
| 49 | - | static ssize_t nullfs_file_splice_read(struct file *in, loff_t *ppos, | |
| 50 | - | struct pipe_inode_info *pipe, | |
| 51 | - | size_t len, unsigned int flags) | |
| 52 | - | { | |
| 53 | - | return 0; | |
| 54 | - | } | |
| 55 | - | ||
| 56 | - | static ssize_t nullfs_file_write_iter(struct kiocb *iocb, struct iov_iter *from) | |
| 57 | - | { | |
| 58 | - | size_t count = iov_iter_count(from); | |
| 59 | - | ||
| 60 | - | iov_iter_advance(from, count); | |
| 61 | - | return count; | |
| 62 | - | } | |
| 63 | - | ||
| 64 | - | static int nullfs_pipe_to_null(struct pipe_inode_info *pipe, | |
| 65 | - | struct pipe_buffer *buf, struct splice_desc *sd) | |
| 66 | - | { | |
| 67 | - | return sd->len; | |
| 68 | - | } | |
| 69 | - | ||
| 70 | - | static ssize_t nullfs_file_splice_write(struct pipe_inode_info *pipe, | |
| 71 | - | struct file *out, loff_t *ppos, | |
| 72 | - | size_t len, unsigned int flags) | |
| 73 | - | { | |
| 74 | - | return splice_from_pipe(pipe, out, ppos, len, flags, nullfs_pipe_to_null); | |
| 75 | - | } | |
| 76 | - | ||
| 77 | - | static int nullfs_file_setattr(struct mnt_idmap *idmap, struct dentry *dentry, | |
| 78 | - | struct iattr *attr) | |
| 79 | - | { | |
| 80 | - | if (attr->ia_valid & (ATTR_MODE | ATTR_UID | ATTR_GID)) | |
| 81 | - | return -EPERM; | |
| 82 | - | return 0; | |
| 83 | - | } | |
| 84 | - | ||
| 85 | - | static const struct inode_operations nullfs_file_inode_operations = { | |
| 86 | - | .setattr = nullfs_file_setattr, | |
| 87 | - | }; | |
| 88 | - | ||
| 89 | - | static const struct file_operations nullfs_file_operations = { | |
| 90 | - | .llseek = generic_file_llseek, | |
| 91 | - | .read_iter = nullfs_file_read_iter, | |
| 92 | - | .write_iter = nullfs_file_write_iter, | |
| 93 | - | .splice_read = nullfs_file_splice_read, | |
| 94 | - | .splice_write = nullfs_file_splice_write, | |
| 95 | - | .fsync = noop_fsync, | |
| 96 | - | .lock = nullfs_nolock, | |
| 97 | - | .flock = nullfs_nolock, | |
| 98 | - | }; | |
| 99 | - | ||
| 100 | - | /* | |
| 101 | - | * An empty regular file on @sb as a dentry of its own, never hashed under | |
| 102 | - | * the root so no lookup finds it. | |
| 103 | - | */ | |
| 104 | - | struct dentry *nullfs_new_file(struct super_block *sb) | |
| 105 | - | { | |
| 106 | - | struct dentry *dentry; | |
| 107 | - | struct inode *inode; | |
| 108 | - | ||
| 109 | - | inode = new_inode(sb); | |
| 110 | - | if (!inode) | |
| 111 | - | return ERR_PTR(-ENOMEM); | |
| 112 | - | ||
| 113 | - | /* the root directory is 1 */ | |
| 114 | - | inode->i_ino = 2; | |
| 115 | - | inode->i_mode = S_IFREG | 0666; | |
| 116 | - | inode->i_op = &nullfs_file_inode_operations; | |
| 117 | - | inode->i_fop = &nullfs_file_operations; | |
| 118 | - | simple_inode_init_ts(inode); | |
| 119 | - | inode->i_flags |= S_NOATIME; | |
| 120 | - | ||
| 121 | - | dentry = d_alloc_anon(sb); | |
| 122 | - | if (!dentry) { | |
| 123 | - | iput(inode); | |
| 124 | - | return ERR_PTR(-ENOMEM); | |
| 125 | - | } | |
| 126 | - | d_instantiate(dentry, inode); | |
| 127 | - | return dentry; | |
| 128 | - | } | |
| 129 | - | ||
| 130 | 13 | static int nullfs_fs_fill_super(struct super_block *s, struct fs_context *fc) | |
| 131 | 14 | { | |
| 132 | 15 | struct inode *inode; | |
| @@ -147,11 +30,10 @@ static int nullfs_fs_fill_super(struct super_block *s, struct fs_context *fc) | |||
| 147 | 30 | ||
| 148 | 31 | /* nullfs is permanently empty... */ | |
| 149 | 32 | make_empty_dir_inode(inode); | |
| 150 | - | inode->i_fop = &nullfs_dir_operations; | |
| 151 | 33 | simple_inode_init_ts(inode); | |
| 152 | 34 | inode->i_ino = 1; | |
| 153 | - | /* ... and immutable, reading it leaves no trace either. */ | |
| 154 | - | inode->i_flags |= S_IMMUTABLE | S_NOATIME; | |
| 35 | + | /* ... and immutable. */ | |
| 36 | + | inode->i_flags |= S_IMMUTABLE; | |
| 155 | 37 | ||
| 156 | 38 | s->s_root = d_make_root(inode); | |
| 157 | 39 | if (!s->s_root) | |
| @@ -179,7 +61,6 @@ static int nullfs_init_fs_context(struct fs_context *fc) | |||
| 179 | 61 | ||
| 180 | 62 | struct file_system_type nullfs_fs_type = { | |
| 181 | 63 | .name = "nullfs", | |
| 182 | - | .fs_flags = FS_DISALLOW_NOTIFY, | |
| 183 | 64 | .init_fs_context = nullfs_init_fs_context, | |
| 184 | 65 | .kill_sb = kill_anon_super, | |
| 185 | 66 | }; | |
modified fs/pnode.c
| @@ -410,99 +410,19 @@ bool propagation_would_overmount(const struct mount *from, | |||
| 410 | 410 | return false; | |
| 411 | 411 | } | |
| 412 | 412 | ||
| 413 | - | /* Does @m receive propagation from @parent? */ | |
| 414 | - | static bool receives_from(struct mount *m, struct mount *parent) | |
| 415 | - | { | |
| 416 | - | if (m == parent) | |
| 417 | - | return false; | |
| 418 | - | for (; m; m = m->mnt_master) | |
| 419 | - | if (m == parent || peers(m, parent)) | |
| 420 | - | return true; | |
| 421 | - | return false; | |
| 422 | - | } | |
| 423 | - | ||
| 424 | - | /* | |
| 425 | - | * Does @m receive propagation from the victim's parent as well? If so, then | |
| 426 | - | * the mount at the victim's mountpoint inside of @m is a umount candidate as | |
| 427 | - | * well. So it's the next candidate in the chain. Otherwise the chain ends at | |
| 428 | - | * @m. | |
| 429 | - | */ | |
| 430 | - | static struct mount *next_candidate(struct mount *m, struct mount *victim) | |
| 431 | - | { | |
| 432 | - | if (!receives_from(m, victim->mnt_parent)) | |
| 433 | - | return NULL; | |
| 434 | - | return __lookup_mnt(&m->mnt, victim->mnt_mountpoint); | |
| 435 | - | } | |
| 436 | - | ||
| 437 | - | /* | |
| 438 | - | * Would propagate_umount() pull out a mount of the chain of candidates that | |
| 439 | - | * starts at @c, and does that mount have references beyond its own? | |
| 440 | - | * | |
| 441 | - | * This mirrors how trim_one(), trim_ancestors() and handle_locked() handle a | |
| 442 | - | * synchronous umount: | |
| 443 | - | * | |
| 444 | - | * - single victim | |
| 445 | - | * - without children | |
| 446 | - | * - with MNT_LOCKED already cleared on every candidate by propagate_mount_unlock() | |
| 447 | - | * | |
| 448 | - | * A copy of the victim gets unmounted when each of its children is | |
| 449 | - | * the next candidate in the chain or its overmount, unless the next | |
| 450 | - | * unmount candidate is not its overmount and some unmount candidate further | |
| 451 | - | * down has a child outside the chain. Keep this in sync with | |
| 452 | - | * Documentation/filesystems/propagate_umount.txt. | |
| 453 | - | */ | |
| 454 | - | static bool chain_busy(struct mount *c, struct mount *victim) | |
| 455 | - | { | |
| 456 | - | struct mount *m, *n, *next, *deepest = NULL; | |
| 457 | - | bool above; | |
| 458 | - | ||
| 459 | - | /* the deepest candidate with a child outside the chain */ | |
| 460 | - | for (m = c; m; m = next) { | |
| 461 | - | next = next_candidate(m, victim); | |
| 462 | - | list_for_each_entry(n, &m->mnt_mounts, mnt_child) { | |
| 463 | - | if (n != next && n != victim) { | |
| 464 | - | deepest = m; | |
| 465 | - | break; | |
| 466 | - | } | |
| 467 | - | } | |
| 468 | - | } | |
| 469 | - | ||
| 470 | - | above = deepest != NULL; /* @deepest is at or below @m */ | |
| 471 | - | for (m = c; m; m = next) { | |
| 472 | - | bool goes = true; | |
| 473 | - | ||
| 474 | - | next = next_candidate(m, victim); | |
| 475 | - | list_for_each_entry(n, &m->mnt_mounts, mnt_child) { | |
| 476 | - | if (n != next && n != m->overmount && n != victim) { | |
| 477 | - | goes = false; | |
| 478 | - | break; | |
| 479 | - | } | |
| 480 | - | } | |
| 481 | - | if (goes && next && next != m->overmount && above && m != deepest) | |
| 482 | - | goes = false; | |
| 483 | - | if (m == deepest) | |
| 484 | - | above = false; | |
| 485 | - | if (goes && do_refcount_check(m, 1)) | |
| 486 | - | return true; | |
| 487 | - | } | |
| 488 | - | return false; | |
| 489 | - | } | |
| 490 | - | ||
| 491 | 413 | /* | |
| 492 | 414 | * check if the mount 'mnt' can be unmounted successfully. | |
| 493 | 415 | * @mnt: the mount to be checked for unmount | |
| 494 | 416 | * NOTE: unmounting 'mnt' would naturally propagate to all | |
| 495 | 417 | * other mounts its parent propagates to. | |
| 496 | - | * Check if any of the mounts that propagate_umount() would pull out | |
| 497 | - | * along with it have more references than their own. If so return busy. | |
| 418 | + | * Check if any of these mounts that **do not have submounts** | |
| 419 | + | * have more references than 'refcnt'. If so return busy. | |
| 498 | 420 | * | |
| 499 | 421 | * vfsmount lock must be held for write | |
| 500 | 422 | */ | |
| 501 | 423 | int propagate_mount_busy(struct mount *mnt, int refcnt) | |
| 502 | 424 | { | |
| 503 | 425 | struct mount *parent = mnt->mnt_parent; | |
| 504 | - | struct dentry *mp = mnt->mnt_mountpoint; | |
| 505 | - | struct mount *m; | |
| 506 | 426 | ||
| 507 | 427 | /* | |
| 508 | 428 | * quickly check if the current mount can be unmounted. | |
| @@ -515,16 +435,24 @@ int propagate_mount_busy(struct mount *mnt, int refcnt) | |||
| 515 | 435 | if (mnt == parent) | |
| 516 | 436 | return 0; | |
| 517 | 437 | ||
| 518 | - | /* the candidates are the mounts at @mp below the receivers */ | |
| 519 | - | for (m = propagation_next(parent, parent); m; | |
| 520 | - | m = propagation_next(m, parent)) { | |
| 521 | - | struct mount *c = __lookup_mnt(&m->mnt, mp); | |
| 438 | + | for (struct mount *m = propagation_next(parent, parent); m; | |
| 439 | + | m = propagation_next(m, parent)) { | |
| 440 | + | struct list_head *head; | |
| 441 | + | struct mount *child = __lookup_mnt(&m->mnt, mnt->mnt_mountpoint); | |
| 522 | 442 | ||
| 523 | - | /* each chain once, from its top: skip receivers that are candidates */ | |
| 524 | - | if (!c || (mnt_has_parent(m) && m->mnt_mountpoint == mp && | |
| 525 | - | receives_from(m->mnt_parent, parent))) | |
| 443 | + | if (!child) | |
| 526 | 444 | continue; | |
| 527 | - | if (chain_busy(c, mnt)) | |
| 445 | + | ||
| 446 | + | head = &child->mnt_mounts; | |
| 447 | + | if (!list_empty(head)) { | |
| 448 | + | /* | |
| 449 | + | * a mount that covers child completely wouldn't prevent | |
| 450 | + | * it being pulled out; any other would. | |
| 451 | + | */ | |
| 452 | + | if (!list_is_singular(head) || !child->overmount) | |
| 453 | + | continue; | |
| 454 | + | } | |
| 455 | + | if (do_refcount_check(child, 1)) | |
| 528 | 456 | return 1; | |
| 529 | 457 | } | |
| 530 | 458 | return 0; | |
| @@ -697,8 +625,8 @@ static void handle_locked(struct mount *m, struct list_head *to_umount) | |||
| 697 | 625 | * the same parent and mountpoint; that will be remedied as soon as we | |
| 698 | 626 | * return from propagate_umount() - its caller (umount_tree()) will detach | |
| 699 | 627 | * the stack from the parent it (and now @m) is attached to. umount_tree() | |
| 700 | - | * detaches every unmounted mount from its parent, whether that parent | |
| 701 | - | * remains in the tree or not. | |
| 628 | + | * might choose to keep unmounted pieces stuck to each other, but it always | |
| 629 | + | * detaches them from the mounts that remain in the tree. | |
| 702 | 630 | */ | |
| 703 | 631 | static void reparent(struct mount *m) | |
| 704 | 632 | { | |
modified fs/readdir.c
| @@ -87,8 +87,6 @@ EXPORT_SYMBOL(wrap_directory_iterator); | |||
| 87 | 87 | int iterate_dir(struct file *file, struct dir_context *ctx) | |
| 88 | 88 | { | |
| 89 | 89 | struct inode *inode = file_inode(file); | |
| 90 | - | /* never an entry, never removed: nothing for the lock to keep still */ | |
| 91 | - | bool locked = !(file->f_op->fop_flags & FOP_IMMUTABLE); | |
| 92 | 90 | int res = -ENOTDIR; | |
| 93 | 91 | ||
| 94 | 92 | if (!file->f_op->iterate_shared) | |
| @@ -102,11 +100,9 @@ int iterate_dir(struct file *file, struct dir_context *ctx) | |||
| 102 | 100 | if (res) | |
| 103 | 101 | goto out; | |
| 104 | 102 | ||
| 105 | - | if (locked) { | |
| 106 | - | res = down_read_killable(&inode->i_rwsem); | |
| 107 | - | if (res) | |
| 108 | - | goto out; | |
| 109 | - | } | |
| 103 | + | res = down_read_killable(&inode->i_rwsem); | |
| 104 | + | if (res) | |
| 105 | + | goto out; | |
| 110 | 106 | ||
| 111 | 107 | res = -ENOENT; | |
| 112 | 108 | if (!IS_DEADDIR(inode)) { | |
| @@ -116,8 +112,7 @@ int iterate_dir(struct file *file, struct dir_context *ctx) | |||
| 116 | 112 | fsnotify_access(file); | |
| 117 | 113 | file_accessed(file); | |
| 118 | 114 | } | |
| 119 | - | if (locked) | |
| 120 | - | inode_unlock_shared(inode); | |
| 115 | + | inode_unlock_shared(inode); | |
| 121 | 116 | out: | |
| 122 | 117 | return res; | |
| 123 | 118 | } | |
modified fs/smb/client/cifsfs.c
| @@ -1412,7 +1412,6 @@ static loff_t cifs_remap_file_range(struct file *src_file, loff_t off, | |||
| 1412 | 1412 | * server could even support copy of range where source = target | |
| 1413 | 1413 | */ | |
| 1414 | 1414 | lock_two_nondirectories(target_inode, src_inode); | |
| 1415 | - | filemap_invalidate_lock(target_inode->i_mapping); | |
| 1416 | 1415 | ||
| 1417 | 1416 | if (len == 0) { | |
| 1418 | 1417 | loff_t src_size = i_size_read(src_inode); | |
| @@ -1468,15 +1467,9 @@ static loff_t cifs_remap_file_range(struct file *src_file, loff_t off, | |||
| 1468 | 1467 | i_size = target_inode->i_size; | |
| 1469 | 1468 | spin_unlock(&target_inode->i_lock); | |
| 1470 | 1469 | ||
| 1471 | - | /* | |
| 1472 | - | * Discard all the folios that overlap the destination region. Start at | |
| 1473 | - | * the old EOF when extending so the folio straddling it, which may hold | |
| 1474 | - | * data written past EOF through an mmap, is dropped too. | |
| 1475 | - | */ | |
| 1470 | + | /* Discard all the folios that overlap the destination region. */ | |
| 1476 | 1471 | cifs_dbg(FYI, "about to discard pages %llx-%llx\n", fstart, fend); | |
| 1477 | - | truncate_inode_pages_range(&target_inode->i_data, | |
| 1478 | - | min(fstart, i_size), fend); | |
| 1479 | - | netfs_wait_for_outstanding_io(target_inode); | |
| 1472 | + | truncate_inode_pages_range(&target_inode->i_data, fstart, fend); | |
| 1480 | 1473 | ||
| 1481 | 1474 | fscache_invalidate(cifs_inode_cookie(target_inode), NULL, i_size, 0); | |
| 1482 | 1475 | ||
| @@ -1515,7 +1508,6 @@ static loff_t cifs_remap_file_range(struct file *src_file, loff_t off, | |||
| 1515 | 1508 | if (rc) | |
| 1516 | 1509 | CIFS_I(target_inode)->time = 0; | |
| 1517 | 1510 | unlock: | |
| 1518 | - | filemap_invalidate_unlock(target_inode->i_mapping); | |
| 1519 | 1511 | /* although unlocking in the reverse order from locking is not | |
| 1520 | 1512 | strictly necessary here it is a little cleaner to be consistent */ | |
| 1521 | 1513 | unlock_two_nondirectories(src_inode, target_inode); | |
| @@ -1539,9 +1531,6 @@ ssize_t cifs_file_copychunk_range(unsigned int xid, | |||
| 1539 | 1531 | struct cifs_tcon *target_tcon; | |
| 1540 | 1532 | ssize_t rc; | |
| 1541 | 1533 | ||
| 1542 | - | if (len == 0) | |
| 1543 | - | return 0; | |
| 1544 | - | ||
| 1545 | 1534 | cifs_dbg(FYI, "copychunk range\n"); | |
| 1546 | 1535 | ||
| 1547 | 1536 | if (!src_file->private_data || !dst_file->private_data) { | |
| @@ -1571,7 +1560,6 @@ ssize_t cifs_file_copychunk_range(unsigned int xid, | |||
| 1571 | 1560 | * server could even support copy of range where source = target | |
| 1572 | 1561 | */ | |
| 1573 | 1562 | lock_two_nondirectories(target_inode, src_inode); | |
| 1574 | - | filemap_invalidate_lock(target_inode->i_mapping); | |
| 1575 | 1563 | ||
| 1576 | 1564 | cifs_dbg(FYI, "about to flush pages\n"); | |
| 1577 | 1565 | ||
| @@ -1593,28 +1581,10 @@ ssize_t cifs_file_copychunk_range(unsigned int xid, | |||
| 1593 | 1581 | /* Flush and invalidate all the folios in the destination region. If | |
| 1594 | 1582 | * the copy was successful, then some of the flush is extra overhead, | |
| 1595 | 1583 | * but we need to allow for the copy failing in some way (eg. ENOSPC). | |
| 1596 | - | * | |
| 1597 | - | * Start at the old EOF when extending so the folio straddling it, which | |
| 1598 | - | * may hold data written past EOF through an mmap, is dropped too. | |
| 1599 | 1584 | */ | |
| 1600 | - | if (target_inode->i_mapping->nrpages) { | |
| 1601 | - | loff_t fstart = min(destoff, i_size_read(target_inode)); | |
| 1602 | - | loff_t fend = destoff + len - 1; | |
| 1603 | - | ||
| 1604 | - | unmap_mapping_pages(target_inode->i_mapping, | |
| 1605 | - | fstart >> PAGE_SHIFT, | |
| 1606 | - | (fend >> PAGE_SHIFT) - | |
| 1607 | - | (fstart >> PAGE_SHIFT) + 1, | |
| 1608 | - | false); | |
| 1609 | - | rc = filemap_write_and_wait_range(target_inode->i_mapping, | |
| 1610 | - | fstart, fend); | |
| 1611 | - | if (rc) | |
| 1612 | - | goto unlock; | |
| 1613 | - | invalidate_inode_pages2_range(target_inode->i_mapping, | |
| 1614 | - | fstart >> PAGE_SHIFT, | |
| 1615 | - | fend >> PAGE_SHIFT); | |
| 1616 | - | } | |
| 1617 | - | netfs_wait_for_outstanding_io(target_inode); | |
| 1585 | + | rc = filemap_invalidate_inode(target_inode, true, destoff, destoff + len - 1); | |
| 1586 | + | if (rc) | |
| 1587 | + | goto unlock; | |
| 1618 | 1588 | ||
| 1619 | 1589 | fscache_invalidate(cifs_inode_cookie(target_inode), NULL, | |
| 1620 | 1590 | i_size_read(target_inode), 0); | |
| @@ -1646,7 +1616,6 @@ ssize_t cifs_file_copychunk_range(unsigned int xid, | |||
| 1646 | 1616 | CIFS_I(target_inode)->time = 0; | |
| 1647 | 1617 | ||
| 1648 | 1618 | unlock: | |
| 1649 | - | filemap_invalidate_unlock(target_inode->i_mapping); | |
| 1650 | 1619 | /* although unlocking in the reverse order from locking is not | |
| 1651 | 1620 | * strictly necessary here it is a little cleaner to be consistent | |
| 1652 | 1621 | */ | |
modified fs/smb/client/cifsfs.h
| @@ -146,9 +146,8 @@ ssize_t cifs_file_copychunk_range(unsigned int xid, struct file *src_file, | |||
| 146 | 146 | unsigned int flags); | |
| 147 | 147 | ||
| 148 | 148 | long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg); | |
| 149 | - | void cifs_setsize(struct inode *inode, loff_t old_size, loff_t offset); | |
| 150 | - | void cifs_resize_file_locked(struct inode *inode, loff_t old_size, | |
| 151 | - | loff_t offset); | |
| 149 | + | void cifs_setsize(struct inode *inode, loff_t offset); | |
| 150 | + | void cifs_resize_file_locked(struct inode *inode, loff_t offset); | |
| 152 | 151 | ||
| 153 | 152 | struct fs_context; | |
| 154 | 153 | struct smb3_fs_context; | |
modified fs/smb/client/cifsglob.h
| @@ -1450,11 +1450,11 @@ struct cifsFileInfo { | |||
| 1450 | 1450 | struct dentry *dentry; | |
| 1451 | 1451 | struct tcon_link *tlink; | |
| 1452 | 1452 | unsigned int f_flags; | |
| 1453 | - | bool invalidHandle; /* file closed via session abend */ | |
| 1454 | - | bool swapfile; | |
| 1455 | - | bool oplock_break_cancelled; | |
| 1456 | - | bool status_file_deleted; /* file has been deleted */ | |
| 1457 | - | bool offload; /* offload final part of _put to a wq */ | |
| 1453 | + | bool invalidHandle:1; /* file closed via session abend */ | |
| 1454 | + | bool swapfile:1; | |
| 1455 | + | bool oplock_break_cancelled:1; | |
| 1456 | + | bool status_file_deleted:1; /* file has been deleted */ | |
| 1457 | + | bool offload:1; /* offload final part of _put to a wq */ | |
| 1458 | 1458 | __u16 oplock_epoch; /* epoch from the lease break */ | |
| 1459 | 1459 | __u32 oplock_level; /* oplock/lease level from the lease break */ | |
| 1460 | 1460 | int count; | |
modified fs/smb/client/file.c
| @@ -1012,14 +1012,11 @@ static int cifs_do_truncate(const unsigned int xid, struct dentry *dentry) | |||
| 1012 | 1012 | } | |
| 1013 | 1013 | mapping_set_error(inode->i_mapping, rc); | |
| 1014 | 1014 | ||
| 1015 | - | netfs_wait_for_outstanding_io(inode); | |
| 1016 | - | ||
| 1017 | 1015 | cfile = find_writable_file(cinode, FIND_FSUID_ONLY); | |
| 1018 | 1016 | rc = cifs_file_flush(xid, inode, cfile); | |
| 1019 | 1017 | if (!rc) { | |
| 1020 | 1018 | if (cfile) { | |
| 1021 | 1019 | struct netfs_inode *ictx = netfs_inode(inode); | |
| 1022 | - | loff_t old_size = i_size_read(inode); | |
| 1023 | 1020 | ||
| 1024 | 1021 | tcon = tlink_tcon(cfile->tlink); | |
| 1025 | 1022 | server = tcon->ses->server; | |
| @@ -1028,7 +1025,7 @@ static int cifs_do_truncate(const unsigned int xid, struct dentry *dentry) | |||
| 1028 | 1025 | cfile, 0, false); | |
| 1029 | 1026 | if (!rc) { | |
| 1030 | 1027 | netfs_resize_file(&cinode->netfs, 0, true); | |
| 1031 | - | cifs_setsize(inode, old_size, 0); | |
| 1028 | + | cifs_setsize(inode, 0); | |
| 1032 | 1029 | cifs_invalidate_cache(inode, 0); | |
| 1033 | 1030 | } | |
| 1034 | 1031 | netfs_wb_end(ictx); | |
modified fs/smb/client/inode.c
| @@ -88,8 +88,6 @@ static void cifs_set_ops(struct inode *inode) | |||
| 88 | 88 | else | |
| 89 | 89 | inode->i_data.a_ops = &cifs_addr_ops; | |
| 90 | 90 | mapping_set_large_folios(inode->i_mapping); | |
| 91 | - | if (tcon->ses->server->sign) | |
| 92 | - | mapping_set_stable_writes(inode->i_mapping); | |
| 93 | 91 | break; | |
| 94 | 92 | case S_IFDIR: | |
| 95 | 93 | if (IS_AUTOMOUNT(inode)) { | |
| @@ -3055,12 +3053,15 @@ int cifs_fiemap(struct inode *inode, struct fiemap_extent_info *fei, u64 start, | |||
| 3055 | 3053 | return -EOPNOTSUPP; | |
| 3056 | 3054 | } | |
| 3057 | 3055 | ||
| 3058 | - | void cifs_setsize(struct inode *inode, loff_t old_size, loff_t offset) | |
| 3056 | + | void cifs_setsize(struct inode *inode, loff_t offset) | |
| 3059 | 3057 | { | |
| 3058 | + | loff_t old_size; | |
| 3060 | 3059 | u64 blocks = CIFS_INO_BLOCKS(offset); | |
| 3061 | 3060 | ||
| 3062 | 3061 | spin_lock(&inode->i_lock); | |
| 3062 | + | old_size = i_size_read(inode); | |
| 3063 | 3063 | i_size_write(inode, offset); | |
| 3064 | + | ||
| 3064 | 3065 | /* | |
| 3065 | 3066 | * Extending EOF does not allocate the intervening range. Only clamp | |
| 3066 | 3067 | * i_blocks on shrink; allocation growth comes from writes or from the | |
| @@ -3070,28 +3071,20 @@ void cifs_setsize(struct inode *inode, loff_t old_size, loff_t offset) | |||
| 3070 | 3071 | inode->i_blocks = blocks; | |
| 3071 | 3072 | spin_unlock(&inode->i_lock); | |
| 3072 | 3073 | inode_set_mtime_to_ts(inode, inode_set_ctime_current(inode)); | |
| 3073 | - | ||
| 3074 | - | /* | |
| 3075 | - | * Zero the tail of the folio straddling the old EOF so data dirtied | |
| 3076 | - | * past EOF through an mmap isn't exposed. truncate_pagecache() then | |
| 3077 | - | * drops any pagecache beyond the new EOF, as in truncate_setsize(). | |
| 3078 | - | */ | |
| 3079 | 3074 | if (offset > old_size) | |
| 3080 | - | netfs_clear_stale_post_isize(inode, old_size, offset); | |
| 3081 | - | ||
| 3075 | + | pagecache_isize_extended(inode, old_size, offset); | |
| 3082 | 3076 | truncate_pagecache(inode, offset); | |
| 3083 | 3077 | netfs_wait_for_outstanding_io(inode); | |
| 3084 | 3078 | } | |
| 3085 | 3079 | ||
| 3086 | - | void cifs_resize_file_locked(struct inode *inode, loff_t old_size, | |
| 3087 | - | loff_t offset) | |
| 3080 | + | void cifs_resize_file_locked(struct inode *inode, loff_t offset) | |
| 3088 | 3081 | { | |
| 3089 | 3082 | struct fscache_cookie *cookie = cifs_inode_cookie(inode); | |
| 3090 | 3083 | ||
| 3091 | 3084 | lockdep_assert_held_write(&inode->i_rwsem); | |
| 3092 | 3085 | ||
| 3093 | 3086 | netfs_resize_file(netfs_inode(inode), offset, true); | |
| 3094 | - | cifs_setsize(inode, old_size, offset); | |
| 3087 | + | cifs_setsize(inode, offset); | |
| 3095 | 3088 | ||
| 3096 | 3089 | if (!cookie) | |
| 3097 | 3090 | return; | |
| @@ -3108,7 +3101,6 @@ int cifs_file_set_size(const unsigned int xid, struct dentry *dentry, | |||
| 3108 | 3101 | struct inode *inode = d_inode(dentry); | |
| 3109 | 3102 | struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); | |
| 3110 | 3103 | struct cifsInodeInfo *cifsInode = CIFS_I(inode); | |
| 3111 | - | loff_t old_size = i_size_read(inode); | |
| 3112 | 3104 | struct tcon_link *tlink = NULL; | |
| 3113 | 3105 | struct cifs_tcon *tcon = NULL; | |
| 3114 | 3106 | struct TCP_Server_Info *server; | |
| @@ -3167,7 +3159,7 @@ int cifs_file_set_size(const unsigned int xid, struct dentry *dentry, | |||
| 3167 | 3159 | ||
| 3168 | 3160 | set_size_out: | |
| 3169 | 3161 | if (rc == 0) | |
| 3170 | - | cifs_resize_file_locked(inode, old_size, size); | |
| 3162 | + | cifs_resize_file_locked(inode, size); | |
| 3171 | 3163 | ||
| 3172 | 3164 | return rc; | |
| 3173 | 3165 | } | |
modified fs/smb/client/smb2ops.c
| @@ -2287,7 +2287,6 @@ smb2_duplicate_extents(const unsigned int xid, | |||
| 2287 | 2287 | struct duplicate_extents_to_file dup_ext_buf; | |
| 2288 | 2288 | struct timespec64 ts; | |
| 2289 | 2289 | struct cifs_tcon *tcon = tlink_tcon(trgtfile->tlink); | |
| 2290 | - | loff_t old_size; | |
| 2291 | 2290 | u64 asize; | |
| 2292 | 2291 | ||
| 2293 | 2292 | /* server fileays advertise duplicate extent support with this flag */ | |
| @@ -2306,12 +2305,11 @@ smb2_duplicate_extents(const unsigned int xid, | |||
| 2306 | 2305 | trgtfile->fid.volatile_fid, tcon->tid, | |
| 2307 | 2306 | tcon->ses->Suid, src_off, dest_off, len); | |
| 2308 | 2307 | inode = d_inode(trgtfile->dentry); | |
| 2309 | - | old_size = i_size_read(inode); | |
| 2310 | - | if (old_size < dest_off + len) { | |
| 2308 | + | if (i_size_read(inode) < dest_off + len) { | |
| 2311 | 2309 | rc = smb2_set_file_size(xid, tcon, trgtfile, dest_off + len, false); | |
| 2312 | 2310 | if (rc) | |
| 2313 | 2311 | goto duplicate_extents_out; | |
| 2314 | - | cifs_resize_file_locked(inode, old_size, dest_off + len); | |
| 2312 | + | cifs_resize_file_locked(inode, dest_off + len); | |
| 2315 | 2313 | } | |
| 2316 | 2314 | rc = SMB2_ioctl(xid, tcon, trgtfile->fid.persistent_fid, | |
| 2317 | 2315 | trgtfile->fid.volatile_fid, | |
| @@ -3522,21 +3520,6 @@ static long smb3_zero_data(struct file *file, struct cifs_tcon *tcon, | |||
| 3522 | 3520 | 0, NULL, NULL); | |
| 3523 | 3521 | } | |
| 3524 | 3522 | ||
| 3525 | - | static long query_server_eof(const unsigned int xid, | |
| 3526 | - | struct cifs_tcon *tcon, | |
| 3527 | - | struct cifsFileInfo *cfile, | |
| 3528 | - | unsigned long long *eof) | |
| 3529 | - | { | |
| 3530 | - | struct smb2_file_all_info file_inf = {}; | |
| 3531 | - | long rc; | |
| 3532 | - | ||
| 3533 | - | rc = SMB2_query_info(xid, tcon, cfile->fid.persistent_fid, | |
| 3534 | - | cfile->fid.volatile_fid, &file_inf); | |
| 3535 | - | if (!rc) | |
| 3536 | - | *eof = le64_to_cpu(file_inf.EndOfFile); | |
| 3537 | - | return rc; | |
| 3538 | - | } | |
| 3539 | - | ||
| 3540 | 3523 | static long smb3_zero_range(struct file *file, struct cifs_tcon *tcon, | |
| 3541 | 3524 | unsigned long long offset, unsigned long long len, | |
| 3542 | 3525 | bool keep_size) | |
| @@ -3564,32 +3547,25 @@ static long smb3_zero_range(struct file *file, struct cifs_tcon *tcon, | |||
| 3564 | 3547 | filemap_invalidate_lock(inode->i_mapping); | |
| 3565 | 3548 | ||
| 3566 | 3549 | netfs_read_sizes(inode, &i_size, &remote_i_size, &zero_point); | |
| 3550 | + | if (offset + len >= remote_i_size && offset < i_size) { | |
| 3551 | + | unsigned long long top = umin(offset + len, i_size); | |
| 3567 | 3552 | ||
| 3568 | - | rc = filemap_write_and_wait_range(inode->i_mapping, offset, | |
| 3569 | - | offset + len - 1); | |
| 3570 | - | if (rc < 0) | |
| 3571 | - | goto zero_range_exit; | |
| 3553 | + | rc = filemap_write_and_wait_range(inode->i_mapping, offset, top - 1); | |
| 3554 | + | if (rc < 0) | |
| 3555 | + | goto zero_range_exit; | |
| 3556 | + | } | |
| 3572 | 3557 | ||
| 3573 | 3558 | /* | |
| 3574 | 3559 | * We zero the range through ioctl, so we need remove the page caches | |
| 3575 | 3560 | * first, otherwise the data may be inconsistent with the server. | |
| 3576 | - | * | |
| 3577 | - | * Start at the old EOF when extending so the folio straddling it, which | |
| 3578 | - | * may hold data written past EOF through an mmap, is dropped too. | |
| 3579 | 3561 | */ | |
| 3580 | - | truncate_pagecache_range(inode, min(offset, i_size), offset + len - 1); | |
| 3562 | + | truncate_pagecache_range(inode, offset, offset + len - 1); | |
| 3581 | 3563 | netfs_wait_for_outstanding_io(inode); | |
| 3582 | 3564 | ||
| 3583 | - | if (!keep_size && !CIFS_CACHE_READ(cifsi)) { | |
| 3584 | - | rc = query_server_eof(xid, tcon, cfile, &remote_i_size); | |
| 3585 | - | if (rc) | |
| 3586 | - | goto zero_range_exit; | |
| 3587 | - | i_size = max(i_size, remote_i_size); | |
| 3588 | - | if (i_size < new_size) { | |
| 3589 | - | rc = -EOPNOTSUPP; | |
| 3590 | - | goto zero_range_exit; | |
| 3591 | - | } | |
| 3592 | - | } | |
| 3565 | + | /* if file not oplocked can't be sure whether asking to extend size */ | |
| 3566 | + | rc = -EOPNOTSUPP; | |
| 3567 | + | if (keep_size == false && !CIFS_CACHE_READ(cifsi)) | |
| 3568 | + | goto zero_range_exit; | |
| 3593 | 3569 | ||
| 3594 | 3570 | fscache_invalidate(cifs_inode_cookie(inode), NULL, | |
| 3595 | 3571 | i_size_read(inode), 0); | |
| @@ -3601,7 +3577,7 @@ static long smb3_zero_range(struct file *file, struct cifs_tcon *tcon, | |||
| 3601 | 3577 | /* | |
| 3602 | 3578 | * do we also need to change the size of the file? | |
| 3603 | 3579 | */ | |
| 3604 | - | if (!keep_size && umax(i_size, i_size_read(inode)) < new_size) { | |
| 3580 | + | if (keep_size == false && (unsigned long long)i_size_read(inode) < new_size) { | |
| 3605 | 3581 | rc = SMB2_set_eof(xid, tcon, cfile->fid.persistent_fid, | |
| 3606 | 3582 | cfile->fid.volatile_fid, cfile->pid, new_size); | |
| 3607 | 3583 | if (rc >= 0) { | |
| @@ -3747,8 +3723,7 @@ static int smb3_simple_fallocate_write_range(unsigned int xid, | |||
| 3747 | 3723 | static int smb3_simple_fallocate_range(unsigned int xid, | |
| 3748 | 3724 | struct cifs_tcon *tcon, | |
| 3749 | 3725 | struct cifsFileInfo *cfile, | |
| 3750 | - | loff_t off, loff_t len, | |
| 3751 | - | loff_t old_eof) | |
| 3726 | + | loff_t off, loff_t len) | |
| 3752 | 3727 | { | |
| 3753 | 3728 | struct file_allocated_range_buffer in_data, *out_data = NULL, *tmp_data; | |
| 3754 | 3729 | struct inode *inode = d_inode(cfile->dentry); | |
| @@ -3764,30 +3739,12 @@ static int smb3_simple_fallocate_range(unsigned int xid, | |||
| 3764 | 3739 | goto out; | |
| 3765 | 3740 | } | |
| 3766 | 3741 | ||
| 3767 | - | if (off >= old_eof) { | |
| 3742 | + | if (off >= i_size_read(inode)) { | |
| 3768 | 3743 | rc = smb3_simple_fallocate_write_range(xid, tcon, cfile, | |
| 3769 | 3744 | off, len, buf); | |
| 3770 | 3745 | goto out; | |
| 3771 | 3746 | } | |
| 3772 | 3747 | ||
| 3773 | - | filemap_invalidate_lock(inode->i_mapping); | |
| 3774 | - | ||
| 3775 | - | /* | |
| 3776 | - | * Flush and commit the data to the server, otherwise | |
| 3777 | - | * FSCTL_QUERY_ALLOCATED_RANGES might report recently written data as | |
| 3778 | - | * unallocated holes on Windows Servers, and the loop below would | |
| 3779 | - | * then zero-fill them and corrupt the file. | |
| 3780 | - | */ | |
| 3781 | - | rc = filemap_write_and_wait_range(inode->i_mapping, off, | |
| 3782 | - | off + len - 1); | |
| 3783 | - | if (rc) | |
| 3784 | - | goto out_unlock; | |
| 3785 | - | netfs_wait_for_outstanding_io(inode); | |
| 3786 | - | rc = SMB2_flush(xid, tcon, cfile->fid.persistent_fid, | |
| 3787 | - | cfile->fid.volatile_fid); | |
| 3788 | - | if (rc) | |
| 3789 | - | goto out_unlock; | |
| 3790 | - | ||
| 3791 | 3748 | in_data.file_offset = cpu_to_le64(off); | |
| 3792 | 3749 | in_data.length = cpu_to_le64(len); | |
| 3793 | 3750 | rc = SMB2_ioctl(xid, tcon, cfile->fid.persistent_fid, | |
| @@ -3797,7 +3754,7 @@ static int smb3_simple_fallocate_range(unsigned int xid, | |||
| 3797 | 3754 | 1024 * sizeof(struct file_allocated_range_buffer), | |
| 3798 | 3755 | (char **)&out_data, &out_data_len); | |
| 3799 | 3756 | if (rc) | |
| 3800 | - | goto out_unlock; | |
| 3757 | + | goto out; | |
| 3801 | 3758 | ||
| 3802 | 3759 | tmp_data = out_data; | |
| 3803 | 3760 | while (len) { | |
| @@ -3807,12 +3764,12 @@ static int smb3_simple_fallocate_range(unsigned int xid, | |||
| 3807 | 3764 | if (out_data_len == 0) { | |
| 3808 | 3765 | rc = smb3_simple_fallocate_write_range(xid, tcon, | |
| 3809 | 3766 | cfile, off, len, buf); | |
| 3810 | - | goto out_unlock; | |
| 3767 | + | goto out; | |
| 3811 | 3768 | } | |
| 3812 | 3769 | ||
| 3813 | 3770 | if (out_data_len < sizeof(struct file_allocated_range_buffer)) { | |
| 3814 | 3771 | rc = -EINVAL; | |
| 3815 | - | goto out_unlock; | |
| 3772 | + | goto out; | |
| 3816 | 3773 | } | |
| 3817 | 3774 | ||
| 3818 | 3775 | range_start = le64_to_cpu(tmp_data->file_offset); | |
| @@ -3820,7 +3777,7 @@ static int smb3_simple_fallocate_range(unsigned int xid, | |||
| 3820 | 3777 | if (check_add_overflow(range_start, range_len, &range_end) || | |
| 3821 | 3778 | range_end > S64_MAX) { | |
| 3822 | 3779 | rc = -EINVAL; | |
| 3823 | - | goto out_unlock; | |
| 3780 | + | goto out; | |
| 3824 | 3781 | } | |
| 3825 | 3782 | ||
| 3826 | 3783 | if (off < range_start) { | |
| @@ -3835,11 +3792,11 @@ static int smb3_simple_fallocate_range(unsigned int xid, | |||
| 3835 | 3792 | rc = smb3_simple_fallocate_write_range(xid, tcon, | |
| 3836 | 3793 | cfile, off, l, buf); | |
| 3837 | 3794 | if (rc) | |
| 3838 | - | goto out_unlock; | |
| 3795 | + | goto out; | |
| 3839 | 3796 | off = off + l; | |
| 3840 | 3797 | len = len - l; | |
| 3841 | 3798 | if (len == 0) | |
| 3842 | - | goto out_unlock; | |
| 3799 | + | goto out; | |
| 3843 | 3800 | } | |
| 3844 | 3801 | /* | |
| 3845 | 3802 | * We are at a section of allocated data, just skip forward | |
| @@ -3858,8 +3815,6 @@ static int smb3_simple_fallocate_range(unsigned int xid, | |||
| 3858 | 3815 | out_data_len -= sizeof(struct file_allocated_range_buffer); | |
| 3859 | 3816 | } | |
| 3860 | 3817 | ||
| 3861 | - | out_unlock: | |
| 3862 | - | filemap_invalidate_unlock(inode->i_mapping); | |
| 3863 | 3818 | out: | |
| 3864 | 3819 | kfree(out_data); | |
| 3865 | 3820 | kvfree(buf); | |
| @@ -3875,7 +3830,7 @@ static long smb3_simple_falloc(struct file *file, struct cifs_tcon *tcon, | |||
| 3875 | 3830 | struct cifsFileInfo *cfile = file->private_data; | |
| 3876 | 3831 | long rc = -EOPNOTSUPP; | |
| 3877 | 3832 | unsigned int xid; | |
| 3878 | - | loff_t old_eof, new_eof, local_eof; | |
| 3833 | + | loff_t old_eof, new_eof; | |
| 3879 | 3834 | struct smb2_file_all_info file_inf; | |
| 3880 | 3835 | u64 asize; | |
| 3881 | 3836 | int qrc; | |
| @@ -3884,37 +3839,18 @@ static long smb3_simple_falloc(struct file *file, struct cifs_tcon *tcon, | |||
| 3884 | 3839 | ||
| 3885 | 3840 | inode = d_inode(cfile->dentry); | |
| 3886 | 3841 | cifsi = CIFS_I(inode); | |
| 3887 | - | old_eof = local_eof = i_size_read(inode); | |
| 3842 | + | old_eof = i_size_read(inode); | |
| 3888 | 3843 | ||
| 3889 | 3844 | trace_smb3_falloc_enter(xid, cfile->fid.persistent_fid, tcon->tid, | |
| 3890 | 3845 | tcon->ses->Suid, off, len); | |
| 3891 | - | ||
| 3892 | - | if (!keep_size && !CIFS_CACHE_READ(cifsi)) { | |
| 3893 | - | unsigned long long server_eof; | |
| 3894 | - | ||
| 3895 | - | rc = filemap_write_and_wait(inode->i_mapping); | |
| 3896 | - | if (rc) { | |
| 3846 | + | /* if file not oplocked can't be sure whether asking to extend size */ | |
| 3847 | + | if (!CIFS_CACHE_READ(cifsi)) | |
| 3848 | + | if (!keep_size) { | |
| 3897 | 3849 | trace_smb3_falloc_err(xid, cfile->fid.persistent_fid, | |
| 3898 | 3850 | tcon->tid, tcon->ses->Suid, off, len, rc); | |
| 3899 | 3851 | free_xid(xid); | |
| 3900 | 3852 | return rc; | |
| 3901 | 3853 | } | |
| 3902 | - | netfs_wait_for_outstanding_io(inode); | |
| 3903 | - | ||
| 3904 | - | rc = query_server_eof(xid, tcon, cfile, &server_eof); | |
| 3905 | - | if (rc) { | |
| 3906 | - | trace_smb3_falloc_err(xid, cfile->fid.persistent_fid, | |
| 3907 | - | tcon->tid, tcon->ses->Suid, off, len, rc); | |
| 3908 | - | free_xid(xid); | |
| 3909 | - | return rc; | |
| 3910 | - | } | |
| 3911 | - | /* | |
| 3912 | - | * Only use the larger EOF to decide whether we're extending. | |
| 3913 | - | * The pagecache zeroing below must still key off the local | |
| 3914 | - | * i_size, so keep local_eof for that. | |
| 3915 | - | */ | |
| 3916 | - | old_eof = max_t(loff_t, old_eof, server_eof); | |
| 3917 | - | } | |
| 3918 | 3854 | ||
| 3919 | 3855 | /* | |
| 3920 | 3856 | * Extending the file | |
| @@ -3938,7 +3874,7 @@ static long smb3_simple_falloc(struct file *file, struct cifs_tcon *tcon, | |||
| 3938 | 3874 | } | |
| 3939 | 3875 | ||
| 3940 | 3876 | rc = smb3_simple_fallocate_range(xid, tcon, cfile, | |
| 3941 | - | off, len, old_eof); | |
| 3877 | + | off, len); | |
| 3942 | 3878 | if (rc) { | |
| 3943 | 3879 | spin_lock(&inode->i_lock); | |
| 3944 | 3880 | cifsi->time = 0; | |
| @@ -3947,7 +3883,7 @@ static long smb3_simple_falloc(struct file *file, struct cifs_tcon *tcon, | |||
| 3947 | 3883 | } | |
| 3948 | 3884 | ||
| 3949 | 3885 | new_eof = off + len; | |
| 3950 | - | cifs_resize_file_locked(inode, local_eof, new_eof); | |
| 3886 | + | cifs_resize_file_locked(inode, new_eof); | |
| 3951 | 3887 | ||
| 3952 | 3888 | qrc = SMB2_query_info(xid, tcon, | |
| 3953 | 3889 | cfile->fid.persistent_fid, | |
| @@ -3995,7 +3931,7 @@ static long smb3_simple_falloc(struct file *file, struct cifs_tcon *tcon, | |||
| 3995 | 3931 | if (rc) | |
| 3996 | 3932 | goto out; | |
| 3997 | 3933 | ||
| 3998 | - | cifs_resize_file_locked(inode, local_eof, new_eof); | |
| 3934 | + | cifs_resize_file_locked(inode, new_eof); | |
| 3999 | 3935 | ||
| 4000 | 3936 | qrc = SMB2_query_info(xid, tcon, | |
| 4001 | 3937 | cfile->fid.persistent_fid, | |
| @@ -4040,7 +3976,7 @@ static long smb3_simple_falloc(struct file *file, struct cifs_tcon *tcon, | |||
| 4040 | 3976 | } | |
| 4041 | 3977 | } | |
| 4042 | 3978 | ||
| 4043 | - | if (keep_size || old_eof >= off + len) { | |
| 3979 | + | if ((keep_size == true) || (i_size_read(inode) >= off + len)) { | |
| 4044 | 3980 | /* | |
| 4045 | 3981 | * At this point, we are trying to fallocate an internal | |
| 4046 | 3982 | * regions of a sparse file. Since smb2 does not have a | |
| @@ -4057,7 +3993,7 @@ static long smb3_simple_falloc(struct file *file, struct cifs_tcon *tcon, | |||
| 4057 | 3993 | */ | |
| 4058 | 3994 | if (len <= 1024 * 1024) { | |
| 4059 | 3995 | rc = smb3_simple_fallocate_range(xid, tcon, cfile, | |
| 4060 | - | off, len, old_eof); | |
| 3996 | + | off, len); | |
| 4061 | 3997 | goto out; | |
| 4062 | 3998 | } | |
| 4063 | 3999 | ||
| @@ -4069,7 +4005,7 @@ static long smb3_simple_falloc(struct file *file, struct cifs_tcon *tcon, | |||
| 4069 | 4005 | * ie potentially making a few extra pages at the beginning | |
| 4070 | 4006 | * or end of the file non-sparse via set_sparse is harmless. | |
| 4071 | 4007 | */ | |
| 4072 | - | if (off > 8192 || off + len + 8192 < old_eof) { | |
| 4008 | + | if ((off > 8192) || (off + len + 8192 < i_size_read(inode))) { | |
| 4073 | 4009 | rc = -EOPNOTSUPP; | |
| 4074 | 4010 | goto out; | |
| 4075 | 4011 | } | |
modified fs/smb/client/smb2pdu.c
| @@ -4796,20 +4796,14 @@ do_retry: | |||
| 4796 | 4796 | rdata->got_bytes); | |
| 4797 | 4797 | ||
| 4798 | 4798 | if (rdata->result == -ENODATA) { | |
| 4799 | + | __set_bit(NETFS_SREQ_HIT_EOF, &rdata->subreq.flags); | |
| 4799 | 4800 | rdata->result = 0; | |
| 4800 | - | if (rdata->subreq.start + rdata->subreq.transferred >= i_size_read(inode)) | |
| 4801 | - | __set_bit(NETFS_SREQ_HIT_EOF, &rdata->subreq.flags); | |
| 4802 | - | else | |
| 4803 | - | __set_bit(NETFS_SREQ_CLEAR_TAIL, &rdata->subreq.flags); | |
| 4804 | 4801 | } else { | |
| 4805 | 4802 | size_t trans = rdata->subreq.transferred + rdata->got_bytes; | |
| 4806 | 4803 | if (trans < rdata->subreq.len && | |
| 4807 | 4804 | rdata->subreq.start + trans >= netfs_read_remote_i_size(inode)) { | |
| 4805 | + | __set_bit(NETFS_SREQ_HIT_EOF, &rdata->subreq.flags); | |
| 4808 | 4806 | rdata->result = 0; | |
| 4809 | - | if (rdata->subreq.start + trans >= i_size_read(inode)) | |
| 4810 | - | __set_bit(NETFS_SREQ_HIT_EOF, &rdata->subreq.flags); | |
| 4811 | - | else | |
| 4812 | - | __set_bit(NETFS_SREQ_CLEAR_TAIL, &rdata->subreq.flags); | |
| 4813 | 4807 | } | |
| 4814 | 4808 | if (rdata->got_bytes) | |
| 4815 | 4809 | __set_bit(NETFS_SREQ_MADE_PROGRESS, &rdata->subreq.flags); | |
modified fs/verity/fsverity_private.h
| @@ -11,7 +11,6 @@ | |||
| 11 | 11 | #define pr_fmt(fmt) "fs-verity: " fmt | |
| 12 | 12 | ||
| 13 | 13 | #include <linux/fsverity.h> | |
| 14 | - | #include <linux/rcupdate.h> | |
| 15 | 14 | #include <linux/rhashtable.h> | |
| 16 | 15 | ||
| 17 | 16 | /* | |
| @@ -77,19 +76,7 @@ struct merkle_tree_params { | |||
| 77 | 76 | struct fsverity_info { | |
| 78 | 77 | struct rhash_head rhash_head; | |
| 79 | 78 | struct merkle_tree_params tree_params; | |
| 80 | - | union { | |
| 81 | - | u8 root_hash[FS_VERITY_MAX_DIGEST_SIZE]; | |
| 82 | - | ||
| 83 | - | /* | |
| 84 | - | * Used for final freeing of the struct, in which case root_hash | |
| 85 | - | * is no longer needed. Specifically, the only fields needed | |
| 86 | - | * besides the rcu_head are those needed by fsverity_free_info() | |
| 87 | - | * itself, and those that can be accessed by fsverity_get_info() | |
| 88 | - | * (rhash_head and inode) during the RCU-protected rhashtable | |
| 89 | - | * chain search trying to find another inode's fsverity_info. | |
| 90 | - | */ | |
| 91 | - | struct rcu_head rcu_head; | |
| 92 | - | }; | |
| 79 | + | u8 root_hash[FS_VERITY_MAX_DIGEST_SIZE]; | |
| 93 | 80 | u8 file_digest[FS_VERITY_MAX_DIGEST_SIZE]; | |
| 94 | 81 | struct inode *inode; | |
| 95 | 82 | unsigned long *hash_block_verified; | |
modified fs/verity/open.c
| @@ -399,22 +399,11 @@ void fsverity_free_info(struct fsverity_info *vi) | |||
| 399 | 399 | kmem_cache_free(fsverity_info_cachep, vi); | |
| 400 | 400 | } | |
| 401 | 401 | ||
| 402 | - | static void fsverity_free_info_rcu(struct rcu_head *head) | |
| 403 | - | { | |
| 404 | - | fsverity_free_info(container_of(head, struct fsverity_info, rcu_head)); | |
| 405 | - | } | |
| 406 | - | ||
| 407 | 402 | void fsverity_remove_info(struct fsverity_info *vi) | |
| 408 | 403 | { | |
| 409 | 404 | rhashtable_remove_fast(&fsverity_info_hash, &vi->rhash_head, | |
| 410 | 405 | fsverity_info_hash_params); | |
| 411 | - | /* | |
| 412 | - | * The freeing must be RCU-delayed because __fsverity_get_info() for a | |
| 413 | - | * *different* inode's fsverity_info in the same rhashtable hash chain | |
| 414 | - | * can still be accessing *this* fsverity_info's rhash_head and inode | |
| 415 | - | * fields as part of the RCU-protected hash chain search. | |
| 416 | - | */ | |
| 417 | - | call_rcu(&vi->rcu_head, fsverity_free_info_rcu); | |
| 406 | + | fsverity_free_info(vi); | |
| 418 | 407 | } | |
| 419 | 408 | ||
| 420 | 409 | void fsverity_cleanup_inode(struct inode *inode) | |
modified fs/xfs/libxfs/xfs_exchmaps.c
| @@ -49,7 +49,7 @@ struct xfs_exchmaps_adjacent { | |||
| 49 | 49 | .right2 = { .br_startblock = HOLESTARTBLOCK }, \ | |
| 50 | 50 | } | |
| 51 | 51 | ||
| 52 | - | /* Information to reset CoW fork state after an exchange. */ | |
| 52 | + | /* Information to reset reflink flag / CoW fork state after an exchange. */ | |
| 53 | 53 | ||
| 54 | 54 | /* | |
| 55 | 55 | * If the reflink flag is set on either inode, make sure it has an incore CoW | |
| @@ -127,7 +127,9 @@ xmi_has_more_exchange_work(const struct xfs_exchmaps_intent *xmi) | |||
| 127 | 127 | static inline bool | |
| 128 | 128 | xmi_has_postop_work(const struct xfs_exchmaps_intent *xmi) | |
| 129 | 129 | { | |
| 130 | - | return xmi->xmi_flags & __XFS_EXCHMAPS_INO2_SHORTFORM; | |
| 130 | + | return xmi->xmi_flags & (XFS_EXCHMAPS_CLEAR_INO1_REFLINK | | |
| 131 | + | XFS_EXCHMAPS_CLEAR_INO2_REFLINK | | |
| 132 | + | __XFS_EXCHMAPS_INO2_SHORTFORM); | |
| 131 | 133 | } | |
| 132 | 134 | ||
| 133 | 135 | /* Check all mappings to make sure we can actually exchange them. */ | |
| @@ -523,6 +525,18 @@ free: | |||
| 523 | 525 | return error; | |
| 524 | 526 | } | |
| 525 | 527 | ||
| 528 | + | /* Clear the reflink flag after an exchange. */ | |
| 529 | + | static inline void | |
| 530 | + | xfs_exchmaps_clear_reflink( | |
| 531 | + | struct xfs_trans *tp, | |
| 532 | + | struct xfs_inode *ip) | |
| 533 | + | { | |
| 534 | + | trace_xfs_reflink_unset_inode_flag(ip); | |
| 535 | + | ||
| 536 | + | ip->i_diflags2 &= ~XFS_DIFLAG2_REFLINK; | |
| 537 | + | xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); | |
| 538 | + | } | |
| 539 | + | ||
| 526 | 540 | /* Finish whatever work might come after an exchange operation. */ | |
| 527 | 541 | static int | |
| 528 | 542 | xfs_exchmaps_do_postop_work( | |
| @@ -543,6 +557,16 @@ xfs_exchmaps_do_postop_work( | |||
| 543 | 557 | return error; | |
| 544 | 558 | } | |
| 545 | 559 | ||
| 560 | + | if (xmi->xmi_flags & XFS_EXCHMAPS_CLEAR_INO1_REFLINK) { | |
| 561 | + | xfs_exchmaps_clear_reflink(tp, xmi->xmi_ip1); | |
| 562 | + | xmi->xmi_flags &= ~XFS_EXCHMAPS_CLEAR_INO1_REFLINK; | |
| 563 | + | } | |
| 564 | + | ||
| 565 | + | if (xmi->xmi_flags & XFS_EXCHMAPS_CLEAR_INO2_REFLINK) { | |
| 566 | + | xfs_exchmaps_clear_reflink(tp, xmi->xmi_ip2); | |
| 567 | + | xmi->xmi_flags &= ~XFS_EXCHMAPS_CLEAR_INO2_REFLINK; | |
| 568 | + | } | |
| 569 | + | ||
| 546 | 570 | return 0; | |
| 547 | 571 | } | |
| 548 | 572 | ||
| @@ -924,14 +948,46 @@ xfs_exchmaps_intent_destroy_cache(void) | |||
| 924 | 948 | } | |
| 925 | 949 | ||
| 926 | 950 | /* | |
| 927 | - | * Allocate and initialize a new incore intent item from a request. | |
| 951 | + | * Decide if we will exchange the reflink flags between the two files after the | |
| 952 | + | * exchange. The only time we want to do this is if we're exchanging all | |
| 953 | + | * mappings under EOF and the inode reflink flags have different states. | |
| 928 | 954 | */ | |
| 955 | + | static inline bool | |
| 956 | + | xmi_can_exchange_reflink_flags( | |
| 957 | + | const struct xfs_exchmaps_req *req, | |
| 958 | + | unsigned int reflink_state) | |
| 959 | + | { | |
| 960 | + | struct xfs_mount *mp = req->ip1->i_mount; | |
| 961 | + | ||
| 962 | + | /* | |
| 963 | + | * The INO1_WRITTEN optimization can skip exchanging hole and | |
| 964 | + | * unwritten mappings, which means we cannot guarantee that all | |
| 965 | + | * shared extents actually moved to the other file. Clearing the | |
| 966 | + | * reflink flag of an inode that still holds shared extents breaks | |
| 967 | + | * the CoW write path, so refuse to exchange the flags in that case. | |
| 968 | + | */ | |
| 969 | + | if (req->flags & XFS_EXCHMAPS_INO1_WRITTEN) | |
| 970 | + | return false; | |
| 971 | + | ||
| 972 | + | if (hweight32(reflink_state) != 1) | |
| 973 | + | return false; | |
| 974 | + | if (req->startoff1 != 0 || req->startoff2 != 0) | |
| 975 | + | return false; | |
| 976 | + | if (req->blockcount != XFS_B_TO_FSB(mp, req->ip1->i_disk_size)) | |
| 977 | + | return false; | |
| 978 | + | if (req->blockcount != XFS_B_TO_FSB(mp, req->ip2->i_disk_size)) | |
| 979 | + | return false; | |
| 980 | + | return true; | |
| 981 | + | } | |
| 982 | + | ||
| 983 | + | ||
| 984 | + | /* Allocate and initialize a new incore intent item from a request. */ | |
| 929 | 985 | struct xfs_exchmaps_intent * | |
| 930 | 986 | xfs_exchmaps_init_intent( | |
| 931 | 987 | const struct xfs_exchmaps_req *req) | |
| 932 | 988 | { | |
| 933 | 989 | struct xfs_exchmaps_intent *xmi; | |
| 934 | - | struct xfs_mount *mp = req->ip1->i_mount; | |
| 990 | + | unsigned int rs = 0; | |
| 935 | 991 | ||
| 936 | 992 | xmi = kmem_cache_zalloc(xfs_exchmaps_intent_cache, | |
| 937 | 993 | GFP_NOFS | __GFP_NOFAIL); | |
| @@ -949,18 +1005,27 @@ xfs_exchmaps_init_intent( | |||
| 949 | 1005 | return xmi; | |
| 950 | 1006 | } | |
| 951 | 1007 | ||
| 952 | - | /* | |
| 953 | - | * If the caller wanted, set each file's size to that file's exchange | |
| 954 | - | * offset + length exchanged from the other file because the ranges in | |
| 955 | - | * each file might be different lengths. | |
| 956 | - | */ | |
| 957 | 1008 | if (req->flags & XFS_EXCHMAPS_SET_SIZES) { | |
| 958 | - | loff_t off1 = XFS_FSB_TO_B(mp, xmi->xmi_startoff1); | |
| 959 | - | loff_t off2 = XFS_FSB_TO_B(mp, xmi->xmi_startoff2); | |
| 960 | - | ||
| 961 | 1009 | xmi->xmi_flags |= XFS_EXCHMAPS_SET_SIZES; | |
| 962 | - | xmi->xmi_isize1 = off1 + (req->ip2->i_disk_size - off2); | |
| 963 | - | xmi->xmi_isize2 = off2 + (req->ip1->i_disk_size - off1); | |
| 1010 | + | xmi->xmi_isize1 = req->ip2->i_disk_size; | |
| 1011 | + | xmi->xmi_isize2 = req->ip1->i_disk_size; | |
| 1012 | + | } | |
| 1013 | + | ||
| 1014 | + | /* Record the state of each inode's reflink flag before the op. */ | |
| 1015 | + | if (xfs_is_reflink_inode(req->ip1)) | |
| 1016 | + | rs |= 1; | |
| 1017 | + | if (xfs_is_reflink_inode(req->ip2)) | |
| 1018 | + | rs |= 2; | |
| 1019 | + | ||
| 1020 | + | /* | |
| 1021 | + | * Figure out if we're clearing the reflink flags (which effectively | |
| 1022 | + | * exchanges them) after the operation. | |
| 1023 | + | */ | |
| 1024 | + | if (xmi_can_exchange_reflink_flags(req, rs)) { | |
| 1025 | + | if (rs & 1) | |
| 1026 | + | xmi->xmi_flags |= XFS_EXCHMAPS_CLEAR_INO1_REFLINK; | |
| 1027 | + | if (rs & 2) | |
| 1028 | + | xmi->xmi_flags |= XFS_EXCHMAPS_CLEAR_INO2_REFLINK; | |
| 964 | 1029 | } | |
| 965 | 1030 | ||
| 966 | 1031 | if (S_ISDIR(VFS_I(xmi->xmi_ip2)->i_mode) || | |
modified fs/xfs/libxfs/xfs_log_format.h
| @@ -927,8 +927,10 @@ struct xfs_xmi_log_format { | |||
| 927 | 927 | */ | |
| 928 | 928 | #define XFS_EXCHMAPS_INO1_WRITTEN (1ULL << 2) | |
| 929 | 929 | ||
| 930 | - | /* No longer set, but older intents may carry them; keep them valid. */ | |
| 930 | + | /* Clear the reflink flag from inode1 after the operation. */ | |
| 931 | 931 | #define XFS_EXCHMAPS_CLEAR_INO1_REFLINK (1ULL << 3) | |
| 932 | + | ||
| 933 | + | /* Clear the reflink flag from inode2 after the operation. */ | |
| 932 | 934 | #define XFS_EXCHMAPS_CLEAR_INO2_REFLINK (1ULL << 4) | |
| 933 | 935 | ||
| 934 | 936 | #define XFS_EXCHMAPS_LOGGED_FLAGS (XFS_EXCHMAPS_ATTR_FORK | \ | |
modified fs/xfs/xfs_bmap_util.c
| @@ -1544,6 +1544,7 @@ xfs_swap_extents( | |||
| 1544 | 1544 | struct xfs_bstat *sbp = &sxp->sx_stat; | |
| 1545 | 1545 | int src_log_flags, target_log_flags; | |
| 1546 | 1546 | int error = 0; | |
| 1547 | + | uint64_t f; | |
| 1547 | 1548 | int resblks = 0; | |
| 1548 | 1549 | unsigned int flags = 0; | |
| 1549 | 1550 | struct timespec64 ctime, mtime; | |
| @@ -1699,12 +1700,14 @@ xfs_swap_extents( | |||
| 1699 | 1700 | if (error) | |
| 1700 | 1701 | goto out_trans_cancel; | |
| 1701 | 1702 | ||
| 1702 | - | /* Either inode may now own shared blocks; flag both, with CoW forks. */ | |
| 1703 | - | if ((ip->i_diflags2 | tip->i_diflags2) & XFS_DIFLAG2_REFLINK) { | |
| 1704 | - | ip->i_diflags2 |= XFS_DIFLAG2_REFLINK; | |
| 1705 | - | tip->i_diflags2 |= XFS_DIFLAG2_REFLINK; | |
| 1706 | - | xfs_ifork_init_cow(ip); | |
| 1707 | - | xfs_ifork_init_cow(tip); | |
| 1703 | + | /* Do we have to swap reflink flags? */ | |
| 1704 | + | if ((ip->i_diflags2 & XFS_DIFLAG2_REFLINK) ^ | |
| 1705 | + | (tip->i_diflags2 & XFS_DIFLAG2_REFLINK)) { | |
| 1706 | + | f = ip->i_diflags2 & XFS_DIFLAG2_REFLINK; | |
| 1707 | + | ip->i_diflags2 &= ~XFS_DIFLAG2_REFLINK; | |
| 1708 | + | ip->i_diflags2 |= tip->i_diflags2 & XFS_DIFLAG2_REFLINK; | |
| 1709 | + | tip->i_diflags2 &= ~XFS_DIFLAG2_REFLINK; | |
| 1710 | + | tip->i_diflags2 |= f & XFS_DIFLAG2_REFLINK; | |
| 1708 | 1711 | } | |
| 1709 | 1712 | ||
| 1710 | 1713 | /* Swap the cow forks. */ | |
modified fs/xfs/xfs_exchrange.c
| @@ -290,20 +290,17 @@ retry: | |||
| 290 | 290 | goto out_unlock; | |
| 291 | 291 | ||
| 292 | 292 | /* | |
| 293 | - | * If the caller wanted, set each file's size to that file's exchange | |
| 294 | - | * offset + length exchanged from the other file because the ranges in | |
| 295 | - | * each file might be different lengths. This should be safe because | |
| 296 | - | * we flushed both files' page caches, exchanged all the mappings, and | |
| 297 | - | * updated the ondisk sizes. | |
| 293 | + | * If the caller wanted us to exchange the contents of two complete | |
| 294 | + | * files of unequal length, exchange the incore sizes now. This should | |
| 295 | + | * be safe because we flushed both files' page caches, exchanged all | |
| 296 | + | * the mappings, and updated the ondisk sizes. | |
| 298 | 297 | */ | |
| 299 | 298 | if (fxr->flags & XFS_EXCHANGE_RANGE_TO_EOF) { | |
| 300 | - | loff_t old_ip1_size = i_size_read(VFS_I(ip1)); | |
| 301 | - | loff_t old_ip2_size = i_size_read(VFS_I(ip2)); | |
| 299 | + | loff_t temp; | |
| 302 | 300 | ||
| 303 | - | i_size_write(VFS_I(ip2), fxr->file2_offset + | |
| 304 | - | (old_ip1_size - fxr->file1_offset)); | |
| 305 | - | i_size_write(VFS_I(ip1), fxr->file1_offset + | |
| 306 | - | (old_ip2_size - fxr->file2_offset)); | |
| 301 | + | temp = i_size_read(VFS_I(ip2)); | |
| 302 | + | i_size_write(VFS_I(ip2), i_size_read(VFS_I(ip1))); | |
| 303 | + | i_size_write(VFS_I(ip1), temp); | |
| 307 | 304 | } | |
| 308 | 305 | ||
| 309 | 306 | out_unlock: | |
| @@ -448,30 +445,6 @@ xfs_exchange_range_checks( | |||
| 448 | 445 | return blen == fxr->length ? 0 : -EINVAL; | |
| 449 | 446 | } | |
| 450 | 447 | ||
| 451 | - | /* Flush all relevant dirty pagecache near the range to be exchanged. */ | |
| 452 | - | static inline int | |
| 453 | - | xfs_exchange_range_flush( | |
| 454 | - | struct xfs_inode *ip, | |
| 455 | - | const struct xfs_exchrange *fxr, | |
| 456 | - | loff_t offset) | |
| 457 | - | { | |
| 458 | - | /* | |
| 459 | - | * If TO_EOF is set, the ondisk file size update logic depends on the | |
| 460 | - | * ondisk file size matching the incore file size. Flush everything. | |
| 461 | - | */ | |
| 462 | - | if (fxr->flags & XFS_EXCHANGE_RANGE_TO_EOF) | |
| 463 | - | return filemap_write_and_wait(VFS_I(ip)->i_mapping); | |
| 464 | - | ||
| 465 | - | /* | |
| 466 | - | * Because we're updating the ondisk mappings, flush all dirty data | |
| 467 | - | * between the ondisk size and the exchange offset to reduce the chance | |
| 468 | - | * of zeroed file contents in that gap after a crash. | |
| 469 | - | */ | |
| 470 | - | return filemap_write_and_wait_range(VFS_I(ip)->i_mapping, | |
| 471 | - | min(offset, ip->i_disk_size), | |
| 472 | - | offset + fxr->length - 1); | |
| 473 | - | } | |
| 474 | - | ||
| 475 | 448 | /* | |
| 476 | 449 | * Check that the two inodes are eligible for range exchanges, the ranges make | |
| 477 | 450 | * sense, and then flush all dirty data. Caller must ensure that the inodes | |
| @@ -497,11 +470,15 @@ xfs_exchange_range_prep( | |||
| 497 | 470 | if (!same_inode) | |
| 498 | 471 | inode_dio_wait(inode2); | |
| 499 | 472 | ||
| 500 | - | error = xfs_exchange_range_flush(XFS_I(inode1), fxr, fxr->file1_offset); | |
| 473 | + | error = filemap_write_and_wait_range(inode1->i_mapping, | |
| 474 | + | fxr->file1_offset, | |
| 475 | + | fxr->file1_offset + fxr->length - 1); | |
| 501 | 476 | if (error) | |
| 502 | 477 | return error; | |
| 503 | 478 | ||
| 504 | - | error = xfs_exchange_range_flush(XFS_I(inode2), fxr, fxr->file2_offset); | |
| 479 | + | error = filemap_write_and_wait_range(inode2->i_mapping, | |
| 480 | + | fxr->file2_offset, | |
| 481 | + | fxr->file2_offset + fxr->length - 1); | |
| 505 | 482 | if (error) | |
| 506 | 483 | return error; | |
| 507 | 484 | ||
modified include/linux/bpf.h
| @@ -1258,15 +1258,11 @@ struct btf_func_model { | |||
| 1258 | 1258 | #define BPF_TRAMP_F_INDIRECT BIT(8) | |
| 1259 | 1259 | ||
| 1260 | 1260 | /* Each call __bpf_prog_enter + call bpf_func + call __bpf_prog_exit is ~50 | |
| 1261 | - | * bytes on x86. The trampoline image has to fit in PAGE_SIZE. | |
| 1261 | + | * bytes on x86. | |
| 1262 | 1262 | */ | |
| 1263 | 1263 | enum { | |
| 1264 | - | #if defined(__s390x__) || defined(__powerpc64__) | |
| 1264 | + | #if defined(__s390x__) | |
| 1265 | 1265 | BPF_MAX_TRAMP_LINKS = 27, | |
| 1266 | - | #elif defined(__x86_64__) | |
| 1267 | - | BPF_MAX_TRAMP_LINKS = 36, | |
| 1268 | - | #elif defined(__aarch64__) | |
| 1269 | - | BPF_MAX_TRAMP_LINKS = 37, | |
| 1270 | 1266 | #else | |
| 1271 | 1267 | BPF_MAX_TRAMP_LINKS = 38, | |
| 1272 | 1268 | #endif | |
| @@ -1319,7 +1315,6 @@ int arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *image, void *i | |||
| 1319 | 1315 | void *arch_alloc_bpf_trampoline(unsigned int size); | |
| 1320 | 1316 | void arch_free_bpf_trampoline(void *image, unsigned int size); | |
| 1321 | 1317 | int __must_check arch_protect_bpf_trampoline(void *image, unsigned int size); | |
| 1322 | - | int arch_bpf_trampoline_skip(void *nop, void *target); | |
| 1323 | 1318 | int arch_bpf_trampoline_size(const struct btf_func_model *m, u32 flags, | |
| 1324 | 1319 | struct bpf_tramp_nodes *tnodes, void *func_addr); | |
| 1325 | 1320 | ||
| @@ -1368,48 +1363,19 @@ enum bpf_tramp_prog_type { | |||
| 1368 | 1363 | BPF_TRAMP_FSESSION, | |
| 1369 | 1364 | }; | |
| 1370 | 1365 | ||
| 1371 | - | /* | |
| 1372 | - | * Each prog call in a trampoline image is preceded by a nop. When the prog is | |
| 1373 | - | * detached, the nop is patched to a jump to target, right after the call, so | |
| 1374 | - | * that tasks still running in the image skip the prog. | |
| 1375 | - | */ | |
| 1376 | - | struct bpf_tramp_skip { | |
| 1377 | - | struct bpf_prog *prog; | |
| 1378 | - | void *nop; | |
| 1379 | - | void *target; | |
| 1380 | - | }; | |
| 1381 | - | ||
| 1382 | 1366 | struct bpf_tramp_image { | |
| 1383 | 1367 | void *image; | |
| 1384 | 1368 | int size; | |
| 1385 | 1369 | struct bpf_ksym ksym; | |
| 1386 | 1370 | struct percpu_ref pcref; | |
| 1387 | - | bool call_orig; | |
| 1388 | - | /* entry in tr->images, the image holds a reference on tr */ | |
| 1389 | - | struct bpf_trampoline *tr; | |
| 1390 | - | struct list_head list; | |
| 1391 | - | int nr_skips; | |
| 1392 | - | struct bpf_tramp_skip *skips; | |
| 1371 | + | void *ip_after_call; | |
| 1372 | + | void *ip_epilogue; | |
| 1393 | 1373 | union { | |
| 1394 | 1374 | struct rcu_head rcu; | |
| 1395 | 1375 | struct work_struct work; | |
| 1396 | 1376 | }; | |
| 1397 | 1377 | }; | |
| 1398 | 1378 | ||
| 1399 | - | static inline void bpf_tramp_image_add_skip(struct bpf_tramp_image *im, struct bpf_prog *prog, | |
| 1400 | - | void *nop, void *target) | |
| 1401 | - | { | |
| 1402 | - | struct bpf_tramp_skip *skip; | |
| 1403 | - | ||
| 1404 | - | /* struct_ops trampolines and arch_bpf_trampoline_size() have no image */ | |
| 1405 | - | if (!im || !im->skips) | |
| 1406 | - | return; | |
| 1407 | - | skip = &im->skips[im->nr_skips++]; | |
| 1408 | - | skip->prog = prog; | |
| 1409 | - | skip->nop = nop; | |
| 1410 | - | skip->target = target; | |
| 1411 | - | } | |
| 1412 | - | ||
| 1413 | 1379 | struct bpf_trampoline { | |
| 1414 | 1380 | /* hlist for trampoline_key_table */ | |
| 1415 | 1381 | struct hlist_node hlist_key; | |
| @@ -1436,8 +1402,6 @@ struct bpf_trampoline { | |||
| 1436 | 1402 | int progs_cnt[BPF_TRAMP_MAX]; | |
| 1437 | 1403 | /* Executable image of trampoline */ | |
| 1438 | 1404 | struct bpf_tramp_image *cur_image; | |
| 1439 | - | /* Images not freed yet, cur_image and older ones still in use */ | |
| 1440 | - | struct list_head images; | |
| 1441 | 1405 | /* Used as temporary old image storage for multi_attach */ | |
| 1442 | 1406 | struct { | |
| 1443 | 1407 | struct bpf_tramp_image *old_image; | |
| @@ -1806,7 +1770,6 @@ struct bpf_prog_aux { | |||
| 1806 | 1770 | bool offload_requested; /* Program is bound and offloaded to the netdev. */ | |
| 1807 | 1771 | bool attach_btf_trace; /* true if attaching to BTF-enabled raw tp */ | |
| 1808 | 1772 | bool attach_tracing_prog; /* true if tracing another tracing program */ | |
| 1809 | - | bool tramp_linked; /* true if it was ever linked to a trampoline */ | |
| 1810 | 1773 | bool func_proto_unreliable; | |
| 1811 | 1774 | bool tail_call_reachable; | |
| 1812 | 1775 | bool xdp_has_frags; | |
modified include/linux/can/core.h
| @@ -17,7 +17,6 @@ | |||
| 17 | 17 | #include <linux/can.h> | |
| 18 | 18 | #include <linux/skbuff.h> | |
| 19 | 19 | #include <linux/netdevice.h> | |
| 20 | - | #include <net/can.h> | |
| 21 | 20 | ||
| 22 | 21 | #define DNAME(dev) ((dev) ? (dev)->name : "any") | |
| 23 | 22 | ||
| @@ -59,7 +58,7 @@ extern void can_rx_unregister(struct net *net, struct net_device *dev, | |||
| 59 | 58 | void *data); | |
| 60 | 59 | ||
| 61 | 60 | extern int can_send(struct sk_buff *skb, int loop); | |
| 62 | - | void can_set_skb_uid(struct can_skb_ext *csx); | |
| 61 | + | void can_set_skb_uid(struct sk_buff *skb); | |
| 63 | 62 | void can_sock_destruct(struct sock *sk); | |
| 64 | 63 | ||
| 65 | 64 | #endif /* !_CAN_CORE_H */ | |
modified include/linux/can/skb.h
| @@ -43,10 +43,8 @@ static inline struct can_skb_ext *can_skb_ext_add(struct sk_buff *skb) | |||
| 43 | 43 | struct can_skb_ext *csx = skb_ext_add(skb, SKB_EXT_CAN); | |
| 44 | 44 | ||
| 45 | 45 | /* skb_ext_add() returns uninitialized space */ | |
| 46 | - | if (csx) { | |
| 46 | + | if (csx) | |
| 47 | 47 | csx->can_gw_hops = 0; | |
| 48 | - | csx->can_skb_uid = 0; | |
| 49 | - | } | |
| 50 | 48 | ||
| 51 | 49 | return csx; | |
| 52 | 50 | } | |
modified include/linux/console.h
| @@ -615,15 +615,6 @@ extern bool nbcon_allow_unsafe_takeover(void); | |||
| 615 | 615 | extern bool nbcon_kdb_try_acquire(struct console *con, | |
| 616 | 616 | struct nbcon_write_context *wctxt); | |
| 617 | 617 | extern void nbcon_kdb_release(struct nbcon_write_context *wctxt); | |
| 618 | - | extern bool nbcon_write_context_is_braille(struct nbcon_write_context *wctxt); | |
| 619 | - | extern bool nbcon_braille_try_acquire(struct console *con, | |
| 620 | - | struct nbcon_write_context *wctxt); | |
| 621 | - | extern void nbcon_braille_release(struct nbcon_write_context *wctxt); | |
| 622 | - | ||
| 623 | - | static inline bool nbcon_is_braille(struct console *con) | |
| 624 | - | { | |
| 625 | - | return con && (con->flags & CON_BRL); | |
| 626 | - | } | |
| 627 | 618 | ||
| 628 | 619 | /* | |
| 629 | 620 | * Check if the given console is currently capable and allowed to print | |
| @@ -687,14 +678,8 @@ static inline void nbcon_reacquire_nobuf(struct nbcon_write_context *wctxt) { } | |||
| 687 | 678 | static inline bool nbcon_kdb_try_acquire(struct console *con, | |
| 688 | 679 | struct nbcon_write_context *wctxt) { return false; } | |
| 689 | 680 | static inline void nbcon_kdb_release(struct nbcon_write_context *wctxt) { } | |
| 690 | - | static inline | |
| 691 | - | bool nbcon_write_context_is_braille(struct nbcon_write_context *wctxt) { return false; } | |
| 692 | 681 | static inline bool console_is_usable(struct console *con, short flags, | |
| 693 | 682 | bool use_atomic) { return false; } | |
| 694 | - | static inline bool nbcon_braille_try_acquire(struct console *con, | |
| 695 | - | struct nbcon_write_context *wctxt) { return false; } | |
| 696 | - | static inline void nbcon_braille_release(struct nbcon_write_context *wctxt) { } | |
| 697 | - | static inline bool nbcon_is_braille(struct console *con) { return false; } | |
| 698 | 683 | #endif | |
| 699 | 684 | ||
| 700 | 685 | extern int console_set_on_cmdline; | |
modified include/linux/cpufreq.h
| @@ -420,9 +420,6 @@ struct cpufreq_driver { | |||
| 420 | 420 | /* Will be called after the driver is fully initialized */ | |
| 421 | 421 | void (*ready)(struct cpufreq_policy *policy); | |
| 422 | 422 | ||
| 423 | - | /* Return the capacity reference frequency for policy. */ | |
| 424 | - | unsigned int (*scale_freq_ref)(struct cpufreq_policy *policy); | |
| 425 | - | ||
| 426 | 423 | struct freq_attr **attr; | |
| 427 | 424 | ||
| 428 | 425 | /* platform specific boost support code */ | |
modified include/linux/fs.h
| @@ -1978,8 +1978,6 @@ struct file_operations { | |||
| 1978 | 1978 | #define FOP_ASYNC_LOCK ((__force fop_flags_t)(1 << 6)) | |
| 1979 | 1979 | /* File system supports uncached read/write buffered IO */ | |
| 1980 | 1980 | #define FOP_DONTCACHE ((__force fop_flags_t)(1 << 7)) | |
| 1981 | - | /* Never changes and is never removed, readdir of a directory takes no lock */ | |
| 1982 | - | #define FOP_IMMUTABLE ((__force fop_flags_t)(1 << 8)) | |
| 1983 | 1981 | ||
| 1984 | 1982 | /* Wrap a directory iterator that needs exclusive inode access */ | |
| 1985 | 1983 | int wrap_directory_iterator(struct file *, struct dir_context *, | |
| @@ -2298,7 +2296,6 @@ struct file_system_type { | |||
| 2298 | 2296 | #define FS_POWER_FREEZE 256 /* Always freeze on suspend/hibernate */ | |
| 2299 | 2297 | #define FS_USERNS_MOUNT_RESTRICTED 512 /* Restrict mount in userns if not already visible */ | |
| 2300 | 2298 | #define FS_USERNS_DELEGATABLE 1024 /* Can be mounted inside userns from outside */ | |
| 2301 | - | #define FS_DISALLOW_NOTIFY 2048 /* No fsnotify marks on its objects */ | |
| 2302 | 2299 | #define FS_RENAME_DOES_D_MOVE 32768 /* FS will handle d_move() during rename() internally. */ | |
| 2303 | 2300 | int (*init_fs_context)(struct fs_context *); | |
| 2304 | 2301 | const struct fs_parameter_spec *parameters; | |
modified include/linux/hrtimer_rearm.h
| @@ -45,7 +45,7 @@ hrtimer_rearm_deferred_user_irq(unsigned long *tif_work, const unsigned long tif | |||
| 45 | 45 | clear_thread_flag(TIF_HRTIMER_REARM); | |
| 46 | 46 | __hrtimer_rearm_deferred(); | |
| 47 | 47 | /* Don't go into the loop if HRTIMER_REARM was the only flag */ | |
| 48 | - | *tif_work &= ~_TIF_HRTIMER_REARM; | |
| 48 | + | *tif_work &= ~TIF_HRTIMER_REARM; | |
| 49 | 49 | return !*tif_work; | |
| 50 | 50 | } | |
| 51 | 51 | return false; | |
modified include/linux/io_uring_types.h
| @@ -322,8 +322,6 @@ enum { | |||
| 322 | 322 | IO_RING_F_DRAIN_DISABLED = BIT(10), | |
| 323 | 323 | IO_RING_F_COMPAT = BIT(11), | |
| 324 | 324 | IO_RING_F_IOWQ_LIMITS_SET = BIT(12), | |
| 325 | - | /* restrictions were inherited from the task that created the ring */ | |
| 326 | - | IO_RING_F_RESTRICT_INHERITED = BIT(13), | |
| 327 | 325 | }; | |
| 328 | 326 | ||
| 329 | 327 | struct iou_ctx {}; | |
modified include/linux/kvm_host.h
| @@ -791,6 +791,7 @@ struct kvm { | |||
| 791 | 791 | /* The current active memslot set for each address space */ | |
| 792 | 792 | struct kvm_memslots __rcu *memslots[KVM_MAX_NR_ADDRESS_SPACES]; | |
| 793 | 793 | struct xarray vcpu_array; | |
| 794 | + | DECLARE_BITMAP(vcpu_ids, KVM_MAX_VCPU_IDS); | |
| 794 | 795 | /* | |
| 795 | 796 | * Protected by slots_lock, but can be read outside if an | |
| 796 | 797 | * incorrect answer is acceptable. | |
modified include/linux/mount.h
| @@ -52,7 +52,7 @@ enum mount_flags { | |||
| 52 | 52 | MNT_ATIME_MASK = MNT_NOATIME | MNT_NODIRATIME | MNT_RELATIME, | |
| 53 | 53 | ||
| 54 | 54 | MNT_INTERNAL_FLAGS = MNT_INTERNAL | MNT_DOOMED | | |
| 55 | - | MNT_SYNC_UMOUNT | MNT_LOCKED | MNT_UMOUNT | |
| 55 | + | MNT_SYNC_UMOUNT | MNT_LOCKED | |
| 56 | 56 | }; | |
| 57 | 57 | ||
| 58 | 58 | struct vfsmount { | |
modified include/linux/mtd/nand.h
| @@ -305,8 +305,6 @@ int nand_ecc_prepare_io_req(struct nand_device *nand, | |||
| 305 | 305 | struct nand_page_io_req *req); | |
| 306 | 306 | int nand_ecc_finish_io_req(struct nand_device *nand, | |
| 307 | 307 | struct nand_page_io_req *req); | |
| 308 | - | bool nand_ecc_is_pipelined(const struct nand_device *nand); | |
| 309 | - | ||
| 310 | 308 | bool nand_ecc_is_strong_enough(struct nand_device *nand); | |
| 311 | 309 | ||
| 312 | 310 | #if IS_REACHABLE(CONFIG_MTD_NAND_CORE) | |
modified include/linux/netdevice.h
| @@ -887,7 +887,6 @@ enum net_device_path_type { | |||
| 887 | 887 | DEV_PATH_DSA, | |
| 888 | 888 | DEV_PATH_MTK_WDMA, | |
| 889 | 889 | DEV_PATH_TUN, | |
| 890 | - | DEV_PATH_IEEE80211, | |
| 891 | 890 | }; | |
| 892 | 891 | ||
| 893 | 892 | struct net_device_path { | |
| @@ -954,8 +953,6 @@ struct net_device_path_ctx { | |||
| 954 | 953 | u16 id; | |
| 955 | 954 | __be16 proto; | |
| 956 | 955 | } vlan[NET_DEVICE_PATH_VLAN_MAX]; | |
| 957 | - | ||
| 958 | - | bool ieee80211; | |
| 959 | 956 | }; | |
| 960 | 957 | ||
| 961 | 958 | enum tc_setup_type { | |
modified include/linux/netfilter_netdev.h
| @@ -133,7 +133,7 @@ static inline struct sk_buff *nf_hook_egress(struct sk_buff *skb, int *rc, | |||
| 133 | 133 | ||
| 134 | 134 | static inline void nf_skip_egress(struct sk_buff *skb, bool skip) | |
| 135 | 135 | { | |
| 136 | - | #ifdef CONFIG_NET_EGRESS | |
| 136 | + | #ifdef CONFIG_NETFILTER_SKIP_EGRESS | |
| 137 | 137 | skb->nf_skip_egress = skip; | |
| 138 | 138 | #endif | |
| 139 | 139 | } | |
modified include/linux/netfs.h
| @@ -397,8 +397,6 @@ ssize_t netfs_unbuffered_write_iter(struct kiocb *iocb, struct iov_iter *from); | |||
| 397 | 397 | ssize_t netfs_unbuffered_write_iter_locked(struct kiocb *iocb, struct iov_iter *iter, | |
| 398 | 398 | struct netfs_group *netfs_group); | |
| 399 | 399 | ssize_t netfs_file_write_iter(struct kiocb *iocb, struct iov_iter *from); | |
| 400 | - | void netfs_clear_stale_post_isize(struct inode *inode, uoff_t from, | |
| 401 | - | uoff_t to); | |
| 402 | 400 | ||
| 403 | 401 | /* Single, monolithic object read/write API. */ | |
| 404 | 402 | void netfs_single_mark_inode_dirty(struct inode *inode); | |
modified include/linux/nsproxy.h
| @@ -100,7 +100,6 @@ void exit_cred_namespaces(struct task_struct *tsk); | |||
| 100 | 100 | void switch_task_namespaces(struct task_struct *tsk, struct nsproxy *new); | |
| 101 | 101 | int exec_task_namespaces(void); | |
| 102 | 102 | void deactivate_nsproxy(struct nsproxy *ns); | |
| 103 | - | void nsproxy_free(struct nsproxy *ns); | |
| 104 | 103 | int unshare_nsproxy_namespaces(unsigned long, struct nsproxy **, | |
| 105 | 104 | struct cred *, struct fs_struct *); | |
| 106 | 105 | int __init nsproxy_cache_init(void); | |
modified include/linux/nvme.h
| @@ -1266,8 +1266,8 @@ enum { | |||
| 1266 | 1266 | NVME_ZRASF_ZONE_STATE_IMP_OPEN = 0x02, | |
| 1267 | 1267 | NVME_ZRASF_ZONE_STATE_EXP_OPEN = 0x03, | |
| 1268 | 1268 | NVME_ZRASF_ZONE_STATE_CLOSED = 0x04, | |
| 1269 | - | NVME_ZRASF_ZONE_STATE_FULL = 0x05, | |
| 1270 | - | NVME_ZRASF_ZONE_STATE_READONLY = 0x06, | |
| 1269 | + | NVME_ZRASF_ZONE_STATE_READONLY = 0x05, | |
| 1270 | + | NVME_ZRASF_ZONE_STATE_FULL = 0x06, | |
| 1271 | 1271 | NVME_ZRASF_ZONE_STATE_OFFLINE = 0x07, | |
| 1272 | 1272 | NVME_REPORT_ZONE_PARTIAL = 1, | |
| 1273 | 1273 | }; | |
modified include/linux/perf_event.h
| @@ -1506,10 +1506,9 @@ is_default_overflow_handler(struct perf_event *event) | |||
| 1506 | 1506 | } | |
| 1507 | 1507 | ||
| 1508 | 1508 | extern void | |
| 1509 | - | perf_event_header__init(struct perf_event_header *header, | |
| 1510 | - | struct perf_sample_data *data, | |
| 1511 | - | u32 type, u16 misc, u16 size, | |
| 1512 | - | struct perf_event *event); | |
| 1509 | + | perf_event_header__init_id(struct perf_event_header *header, | |
| 1510 | + | struct perf_sample_data *data, | |
| 1511 | + | struct perf_event *event); | |
| 1513 | 1512 | extern void | |
| 1514 | 1513 | perf_event__output_id_sample(struct perf_event *event, | |
| 1515 | 1514 | struct perf_output_handle *handle, | |
modified include/linux/rtnetlink.h
| @@ -186,12 +186,7 @@ void net_dec_ingress_queue(void); | |||
| 186 | 186 | #ifdef CONFIG_NET_EGRESS | |
| 187 | 187 | void net_inc_egress_queue(void); | |
| 188 | 188 | void net_dec_egress_queue(void); | |
| 189 | - | bool netdev_xmit_skip_txqueue(bool skip); | |
| 190 | - | #else | |
| 191 | - | static inline bool netdev_xmit_skip_txqueue(bool skip) | |
| 192 | - | { | |
| 193 | - | return false; | |
| 194 | - | } | |
| 189 | + | void netdev_xmit_skip_txqueue(bool skip); | |
| 195 | 190 | #endif | |
| 196 | 191 | ||
| 197 | 192 | void rtnetlink_init(void); | |
modified include/linux/sched/ext.h
| @@ -207,7 +207,6 @@ struct sched_ext_entity { | |||
| 207 | 207 | s32 holding_cpu; | |
| 208 | 208 | s32 selected_cpu; | |
| 209 | 209 | s32 runnable_cpu; /* cpu @p is runnable on, -1 if not */ | |
| 210 | - | u32 ops_qseq; /* protected by rq lock */ | |
| 211 | 210 | struct task_struct *kf_tasks[2]; /* see SCX_CALL_OP_TASK() */ | |
| 212 | 211 | ||
| 213 | 212 | struct list_head runnable_node; /* rq->scx.runnable_list */ | |
modified include/linux/siphash.h
| @@ -75,10 +75,8 @@ static inline u64 ___siphash_aligned(const __le64 *data, size_t len, | |||
| 75 | 75 | /** | |
| 76 | 76 | * siphash - compute 64-bit siphash PRF value | |
| 77 | 77 | * @data: buffer to hash | |
| 78 | - | * @len: size of @data | |
| 78 | + | * @size: size of @data | |
| 79 | 79 | * @key: the siphash key | |
| 80 | - | * | |
| 81 | - | * Returns: siphash PRF value | |
| 82 | 80 | */ | |
| 83 | 81 | static inline u64 siphash(const void *data, size_t len, | |
| 84 | 82 | const siphash_key_t *key) | |
| @@ -127,10 +125,8 @@ static inline u32 ___hsiphash_aligned(const __le32 *data, size_t len, | |||
| 127 | 125 | /** | |
| 128 | 126 | * hsiphash - compute 32-bit hsiphash PRF value | |
| 129 | 127 | * @data: buffer to hash | |
| 130 | - | * @len: size of @data | |
| 128 | + | * @size: size of @data | |
| 131 | 129 | * @key: the hsiphash key | |
| 132 | - | * | |
| 133 | - | * Returns: hsiphash PRF value | |
| 134 | 130 | */ | |
| 135 | 131 | static inline u32 hsiphash(const void *data, size_t len, | |
| 136 | 132 | const hsiphash_key_t *key) | |
modified include/linux/skbuff.h
| @@ -1020,7 +1020,7 @@ struct sk_buff { | |||
| 1020 | 1020 | #ifdef CONFIG_NET_REDIRECT | |
| 1021 | 1021 | __u8 from_ingress:1; | |
| 1022 | 1022 | #endif | |
| 1023 | - | #ifdef CONFIG_NET_EGRESS | |
| 1023 | + | #ifdef CONFIG_NETFILTER_SKIP_EGRESS | |
| 1024 | 1024 | __u8 nf_skip_egress:1; | |
| 1025 | 1025 | #endif | |
| 1026 | 1026 | #ifdef CONFIG_SKB_DECRYPTED | |
modified include/linux/soc/qcom/geni-se.h
| @@ -347,12 +347,17 @@ struct geni_se { | |||
| 347 | 347 | #define QUP_SE_VERSION_2_5 0x20050000 | |
| 348 | 348 | ||
| 349 | 349 | /* | |
| 350 | - | * QUP Core 2X clock votes used by GENI clients through the "qup-core" ICC | |
| 351 | - | * path. Values are in Bps and must be converted with Bps_to_icc() before | |
| 352 | - | * setting avg_bw. | |
| 350 | + | * Define bandwidth thresholds that cause the underlying Core 2X interconnect | |
| 351 | + | * clock to run at the named frequency. These baseline values are recommended | |
| 352 | + | * by the hardware team, and are not dynamically scaled with GENI bandwidth | |
| 353 | + | * beyond basic on/off. | |
| 353 | 354 | */ | |
| 354 | - | #define CORE_2X_19_2_MHZ 9600000 | |
| 355 | - | #define CORE_2X_50_MHZ 25000000 | |
| 355 | + | #define CORE_2X_19_2_MHZ 960 | |
| 356 | + | #define CORE_2X_50_MHZ 2500 | |
| 357 | + | #define CORE_2X_100_MHZ 5000 | |
| 358 | + | #define CORE_2X_150_MHZ 7500 | |
| 359 | + | #define CORE_2X_200_MHZ 10000 | |
| 360 | + | #define CORE_2X_236_MHZ 16383 | |
| 356 | 361 | ||
| 357 | 362 | #define GENI_DEFAULT_BW Bps_to_icc(1000) | |
| 358 | 363 | ||
modified include/linux/thunderbolt.h
| @@ -22,7 +22,6 @@ struct device; | |||
| 22 | 22 | #include <linux/device.h> | |
| 23 | 23 | #include <linux/idr.h> | |
| 24 | 24 | #include <linux/list.h> | |
| 25 | - | #include <linux/lockdep.h> | |
| 26 | 25 | #include <linux/mutex.h> | |
| 27 | 26 | #include <linux/device-id/tb.h> | |
| 28 | 27 | #include <linux/pci.h> | |
| @@ -566,7 +565,6 @@ struct tb_nhi { | |||
| 566 | 565 | * @interval_nsec: Interval counter if interrupt throttling is to be | |
| 567 | 566 | * used with this ring (in ns) | |
| 568 | 567 | * @wait: Used to signal that the ring may be empty now | |
| 569 | - | * @lock_key: Lock validator class key per-ring | |
| 570 | 568 | */ | |
| 571 | 569 | struct tb_ring { | |
| 572 | 570 | spinlock_t lock; | |
| @@ -592,7 +590,6 @@ struct tb_ring { | |||
| 592 | 590 | void *poll_data; | |
| 593 | 591 | unsigned int interval_nsec; | |
| 594 | 592 | wait_queue_head_t wait; | |
| 595 | - | struct lock_class_key lock_key; | |
| 596 | 593 | }; | |
| 597 | 594 | ||
| 598 | 595 | /* Leave ring interrupt enabled on suspend */ | |
modified include/linux/tty.h
| @@ -168,7 +168,6 @@ struct tty_operations; | |||
| 168 | 168 | * @write_wait: concurrent writers are waiting in this queue until they are | |
| 169 | 169 | * allowed to write | |
| 170 | 170 | * @read_wait: readers wait for data in this queue | |
| 171 | - | * @break_wait: wait queue for timed breaks | |
| 172 | 171 | * @hangup_work: normally a work to perform a hangup (do_tty_hangup()); while | |
| 173 | 172 | * freeing the tty, (re)used to release_one_tty() | |
| 174 | 173 | * @disc_data: pointer to @ldisc's private data (e.g. to &struct n_tty_data) | |
| @@ -231,7 +230,6 @@ struct tty_struct { | |||
| 231 | 230 | struct fasync_struct *fasync; | |
| 232 | 231 | wait_queue_head_t write_wait; | |
| 233 | 232 | wait_queue_head_t read_wait; | |
| 234 | - | wait_queue_head_t break_wait; | |
| 235 | 233 | struct work_struct hangup_work; | |
| 236 | 234 | void *disc_data; | |
| 237 | 235 | void *driver_data; | |
modified include/linux/tty_driver.h
| @@ -73,11 +73,6 @@ struct serial_struct; | |||
| 73 | 73 | * @TTY_DRIVER_NO_WORKQUEUE: | |
| 74 | 74 | * Do not create workqueue when tty_register_driver(). Whenever set, flip | |
| 75 | 75 | * buffer workqueue can be set by tty_port_link_wq() for every port. | |
| 76 | - | * | |
| 77 | - | * @TTY_DRIVER_RESET_SAVED_TERMIOS: | |
| 78 | - | * Reset any saved termios settings on device registration when reusing a | |
| 79 | - | * minor number. Must only be set by drivers that guarantee that the minor | |
| 80 | - | * number is no longer in use. | |
| 81 | 76 | */ | |
| 82 | 77 | enum tty_driver_flag { | |
| 83 | 78 | TTY_DRIVER_INSTALLED = BIT(0), | |
| @@ -89,7 +84,6 @@ enum tty_driver_flag { | |||
| 89 | 84 | TTY_DRIVER_DYNAMIC_ALLOC = BIT(6), | |
| 90 | 85 | TTY_DRIVER_UNNUMBERED_NODE = BIT(7), | |
| 91 | 86 | TTY_DRIVER_NO_WORKQUEUE = BIT(8), | |
| 92 | - | TTY_DRIVER_RESET_SAVED_TERMIOS = BIT(9), | |
| 93 | 87 | }; | |
| 94 | 88 | ||
| 95 | 89 | enum tty_driver_type { | |
modified include/linux/tty_port.h
| @@ -245,8 +245,7 @@ bool tty_port_carrier_raised(struct tty_port *port); | |||
| 245 | 245 | void tty_port_raise_dtr_rts(struct tty_port *port); | |
| 246 | 246 | void tty_port_lower_dtr_rts(struct tty_port *port); | |
| 247 | 247 | void tty_port_hangup(struct tty_port *port); | |
| 248 | - | void tty_port_tty_hangup(struct tty_port *port, bool check_clocal); | |
| 249 | - | void tty_port_tty_vhangup(struct tty_port *port); | |
| 248 | + | void __tty_port_tty_hangup(struct tty_port *port, bool check_clocal, bool async); | |
| 250 | 249 | void tty_port_tty_wakeup(struct tty_port *port); | |
| 251 | 250 | int tty_port_block_til_ready(struct tty_port *port, struct tty_struct *tty, | |
| 252 | 251 | struct file *filp); | |
| @@ -265,6 +264,25 @@ static inline int tty_port_users(struct tty_port *port) | |||
| 265 | 264 | return port->count + port->blocked_open; | |
| 266 | 265 | } | |
| 267 | 266 | ||
| 267 | + | /** | |
| 268 | + | * tty_port_tty_hangup - helper to hang up a tty asynchronously | |
| 269 | + | * @port: tty port | |
| 270 | + | * @check_clocal: hang only ttys with %CLOCAL unset? | |
| 271 | + | */ | |
| 272 | + | static inline void tty_port_tty_hangup(struct tty_port *port, bool check_clocal) | |
| 273 | + | { | |
| 274 | + | __tty_port_tty_hangup(port, check_clocal, true); | |
| 275 | + | } | |
| 276 | + | ||
| 277 | + | /** | |
| 278 | + | * tty_port_tty_vhangup - helper to hang up a tty synchronously | |
| 279 | + | * @port: tty port | |
| 280 | + | */ | |
| 281 | + | static inline void tty_port_tty_vhangup(struct tty_port *port) | |
| 282 | + | { | |
| 283 | + | __tty_port_tty_hangup(port, false, false); | |
| 284 | + | } | |
| 285 | + | ||
| 268 | 286 | #ifdef CONFIG_TTY | |
| 269 | 287 | void tty_kref_put(struct tty_struct *tty); | |
| 270 | 288 | __DEFINE_CLASS_IS_CONDITIONAL(tty_port_tty, true); | |
modified include/linux/usb/serial.h
| @@ -381,7 +381,6 @@ void usb_serial_handle_dcd_change(struct usb_serial_port *usb_port, | |||
| 381 | 381 | ||
| 382 | 382 | int usb_serial_bus_register(struct usb_serial_driver *device); | |
| 383 | 383 | void usb_serial_bus_deregister(struct usb_serial_driver *device); | |
| 384 | - | void usb_serial_bus_remove_new_id(struct usb_serial_driver *driver); | |
| 385 | 384 | ||
| 386 | 385 | extern const struct bus_type usb_serial_bus_type; | |
| 387 | 386 | extern struct tty_driver *usb_serial_tty_driver; | |
modified include/linux/virtio_net.h
| @@ -111,38 +111,48 @@ static inline int __virtio_net_hdr_to_skb(struct sk_buff *skb, | |||
| 111 | 111 | p_off = nh_min_len + thlen; | |
| 112 | 112 | if (!pskb_may_pull(skb, p_off)) | |
| 113 | 113 | return -EINVAL; | |
| 114 | - | } else if (gso_type) { | |
| 114 | + | } else { | |
| 115 | 115 | /* gso packets without NEEDS_CSUM do not set transport_offset. | |
| 116 | 116 | * probe and drop if does not match one of the above types. | |
| 117 | 117 | */ | |
| 118 | - | struct flow_keys_basic keys; | |
| 119 | - | ||
| 120 | - | if (!skb->protocol) { | |
| 121 | - | skb->protocol = dev_parse_header_protocol(skb); | |
| 122 | - | if (!skb->protocol) | |
| 123 | - | virtio_net_hdr_set_proto(skb, hdr); | |
| 124 | - | } | |
| 118 | + | if (gso_type && skb->network_header) { | |
| 119 | + | struct flow_keys_basic keys; | |
| 120 | + | ||
| 121 | + | if (!skb->protocol) { | |
| 122 | + | __be16 protocol = dev_parse_header_protocol(skb); | |
| 123 | + | ||
| 124 | + | if (!protocol) | |
| 125 | + | virtio_net_hdr_set_proto(skb, hdr); | |
| 126 | + | else if (!virtio_net_hdr_match_proto(protocol, | |
| 127 | + | hdr_gso_type)) | |
| 128 | + | return -EINVAL; | |
| 129 | + | else | |
| 130 | + | skb->protocol = protocol; | |
| 131 | + | } | |
| 125 | 132 | retry: | |
| 126 | - | if (!skb_flow_dissect_flow_keys_basic(NULL, skb, &keys, | |
| 127 | - | NULL, 0, 0, 0, | |
| 128 | - | 0)) { | |
| 129 | - | /* UFO does not specify ipv4 or 6: try both */ | |
| 130 | - | if (gso_type & SKB_GSO_UDP && | |
| 131 | - | skb->protocol == htons(ETH_P_IP)) { | |
| 132 | - | skb->protocol = htons(ETH_P_IPV6); | |
| 133 | - | goto retry; | |
| 133 | + | if (!skb_flow_dissect_flow_keys_basic(NULL, skb, &keys, | |
| 134 | + | NULL, 0, 0, 0, | |
| 135 | + | 0)) { | |
| 136 | + | /* UFO does not specify ipv4 or 6: try both */ | |
| 137 | + | if (gso_type & SKB_GSO_UDP && | |
| 138 | + | skb->protocol == htons(ETH_P_IP)) { | |
| 139 | + | skb->protocol = htons(ETH_P_IPV6); | |
| 140 | + | goto retry; | |
| 141 | + | } | |
| 142 | + | return -EINVAL; | |
| 134 | 143 | } | |
| 135 | - | return -EINVAL; | |
| 136 | - | } | |
| 137 | 144 | ||
| 138 | - | p_off = keys.control.thoff + thlen; | |
| 139 | - | if (!pskb_may_pull(skb, p_off) || | |
| 140 | - | keys.basic.ip_proto != ip_proto || | |
| 141 | - | !virtio_net_hdr_match_proto(keys.basic.n_proto, | |
| 142 | - | hdr_gso_type)) | |
| 143 | - | return -EINVAL; | |
| 145 | + | p_off = keys.control.thoff + thlen; | |
| 146 | + | if (!pskb_may_pull(skb, p_off) || | |
| 147 | + | keys.basic.ip_proto != ip_proto) | |
| 148 | + | return -EINVAL; | |
| 144 | 149 | ||
| 145 | - | skb_set_transport_header(skb, keys.control.thoff); | |
| 150 | + | skb_set_transport_header(skb, keys.control.thoff); | |
| 151 | + | } else if (gso_type) { | |
| 152 | + | p_off = nh_min_len + thlen; | |
| 153 | + | if (!pskb_may_pull(skb, p_off)) | |
| 154 | + | return -EINVAL; | |
| 155 | + | } | |
| 146 | 156 | } | |
| 147 | 157 | ||
| 148 | 158 | if (hdr_gso_type != VIRTIO_NET_HDR_GSO_NONE) { | |
modified include/net/amt.h
| @@ -231,6 +231,10 @@ struct amt_relay_headers { | |||
| 231 | 231 | }; | |
| 232 | 232 | } __packed; | |
| 233 | 233 | ||
| 234 | + | struct amt_skb_cb { | |
| 235 | + | struct amt_tunnel_list *tunnel; | |
| 236 | + | }; | |
| 237 | + | ||
| 234 | 238 | struct amt_tunnel_list { | |
| 235 | 239 | struct list_head list; | |
| 236 | 240 | /* Protect All resources under an amt_tunne_list */ | |
modified include/net/bluetooth/hci_core.h
| @@ -62,7 +62,7 @@ struct inquiry_entry { | |||
| 62 | 62 | NAME_PENDING, | |
| 63 | 63 | NAME_KNOWN, | |
| 64 | 64 | } name_state; | |
| 65 | - | unsigned long timestamp; | |
| 65 | + | __u32 timestamp; | |
| 66 | 66 | struct inquiry_data data; | |
| 67 | 67 | }; | |
| 68 | 68 | ||
| @@ -78,7 +78,7 @@ struct discovery_state { | |||
| 78 | 78 | struct list_head all; /* All devices found during inquiry */ | |
| 79 | 79 | struct list_head unknown; /* Name state not known */ | |
| 80 | 80 | struct list_head resolve; /* Name needs to be resolved */ | |
| 81 | - | unsigned long timestamp; | |
| 81 | + | __u32 timestamp; | |
| 82 | 82 | bdaddr_t last_adv_addr; | |
| 83 | 83 | u8 last_adv_addr_type; | |
| 84 | 84 | s8 last_adv_rssi; | |
| @@ -562,7 +562,6 @@ struct hci_dev { | |||
| 562 | 562 | struct list_head link_keys; | |
| 563 | 563 | struct list_head long_term_keys; | |
| 564 | 564 | struct list_head identity_resolving_keys; | |
| 565 | - | struct mutex remote_oob_lock; | |
| 566 | 565 | struct list_head remote_oob_data; | |
| 567 | 566 | struct list_head le_accept_list; | |
| 568 | 567 | struct list_head le_resolv_list; | |
modified include/net/bluetooth/rfcomm.h
| @@ -207,7 +207,6 @@ struct rfcomm_dlc { | |||
| 207 | 207 | #define RFCOMM_AUTH_REJECT 7 | |
| 208 | 208 | #define RFCOMM_DEFER_SETUP 8 | |
| 209 | 209 | #define RFCOMM_ENC_DROP 9 | |
| 210 | - | #define RFCOMM_CLOSED 10 | |
| 211 | 210 | ||
| 212 | 211 | /* Scheduling flags and events */ | |
| 213 | 212 | #define RFCOMM_SCHED_WAKEUP 31 | |
modified include/net/can.h
| @@ -17,14 +17,12 @@ | |||
| 17 | 17 | * @can_framelen: cached echo CAN frame length for bql | |
| 18 | 18 | * @can_gw_hops: can-gw CAN frame time-to-live counter | |
| 19 | 19 | * @can_ext_flags: CAN skb extensions flags | |
| 20 | - | * @can_skb_uid: CAN skb UID for raw_rcv and isotp echo handling | |
| 21 | 20 | */ | |
| 22 | 21 | struct can_skb_ext { | |
| 23 | 22 | int can_iif; | |
| 24 | 23 | u16 can_framelen; | |
| 25 | 24 | u8 can_gw_hops; | |
| 26 | 25 | u8 can_ext_flags; | |
| 27 | - | u32 can_skb_uid; | |
| 28 | 26 | }; | |
| 29 | 27 | ||
| 30 | 28 | #endif /* _NET_CAN_H */ | |
modified include/net/gso.h
| @@ -19,18 +19,10 @@ struct skb_gso_cb { | |||
| 19 | 19 | int encap_level; | |
| 20 | 20 | __wsum csum; | |
| 21 | 21 | __u16 csum_start; | |
| 22 | - | /* Number of IPv4/IPv6 GSO handler entries for this packet. */ | |
| 23 | - | u8 recursion_counter; | |
| 24 | 22 | }; | |
| 25 | 23 | #define SKB_GSO_CB_OFFSET 32 | |
| 26 | 24 | #define SKB_GSO_CB(skb) ((struct skb_gso_cb *)((skb)->cb + SKB_GSO_CB_OFFSET)) | |
| 27 | 25 | ||
| 28 | - | static inline bool gso_recursion_inc_test(struct sk_buff *skb, | |
| 29 | - | unsigned int limit) | |
| 30 | - | { | |
| 31 | - | return ++SKB_GSO_CB(skb)->recursion_counter > limit; | |
| 32 | - | } | |
| 33 | - | ||
| 34 | 26 | static inline int skb_tnl_header_len(const struct sk_buff *inner_skb) | |
| 35 | 27 | { | |
| 36 | 28 | return (skb_mac_header(inner_skb) - inner_skb->head) - | |
modified include/net/ip.h
| @@ -74,13 +74,6 @@ static inline unsigned int ip_hdrlen(const struct sk_buff *skb) | |||
| 74 | 74 | return ip_hdr(skb)->ihl * 4; | |
| 75 | 75 | } | |
| 76 | 76 | ||
| 77 | - | static inline int ip_check_csum_start(const struct sk_buff *skb) | |
| 78 | - | { | |
| 79 | - | if (unlikely(skb->csum_start < skb->network_header + ip_hdrlen(skb))) | |
| 80 | - | return -EINVAL; | |
| 81 | - | return 0; | |
| 82 | - | } | |
| 83 | - | ||
| 84 | 77 | struct ipcm_cookie { | |
| 85 | 78 | struct sockcm_cookie sockc; | |
| 86 | 79 | __be32 addr; | |
modified include/net/mana/mana.h
| @@ -377,18 +377,7 @@ struct mana_recv_buf_oob { | |||
| 377 | 377 | #define MANA_RXBUF_PAD (SKB_DATA_ALIGN(sizeof(struct skb_shared_info)) \ | |
| 378 | 378 | + ETH_HLEN) | |
| 379 | 379 | ||
| 380 | - | /* Headroom an RX buffer has to reserve while XDP is attached: the XDP program | |
| 381 | - | * needs XDP_PACKET_HEADROOM, and the TX path needs LL_RESERVED_SPACE() (see | |
| 382 | - | * mana_get_rxbuf_headroom()). LL_RESERVED_SPACE() grows with MAX_SKB_FRAGS and | |
| 383 | - | * exceeds XDP_PACKET_HEADROOM once CONFIG_MAX_SKB_FRAGS is 19 or more. | |
| 384 | - | */ | |
| 385 | - | static inline u32 mana_xdp_headroom(struct net_device *ndev) | |
| 386 | - | { | |
| 387 | - | return max_t(u32, LL_RESERVED_SPACE(ndev), XDP_PACKET_HEADROOM); | |
| 388 | - | } | |
| 389 | - | ||
| 390 | - | #define MANA_XDP_MTU_MAX(ndev) \ | |
| 391 | - | (PAGE_SIZE - MANA_RXBUF_PAD - mana_xdp_headroom(ndev)) | |
| 380 | + | #define MANA_XDP_MTU_MAX (PAGE_SIZE - MANA_RXBUF_PAD - XDP_PACKET_HEADROOM) | |
| 392 | 381 | ||
| 393 | 382 | struct mana_rxq { | |
| 394 | 383 | struct gdma_queue *gdma_rq; | |
| @@ -702,7 +691,6 @@ int mana_query_link_cfg(struct mana_port_context *apc); | |||
| 702 | 691 | int mana_set_bw_clamp(struct mana_port_context *apc, u32 speed, | |
| 703 | 692 | int enable_clamping); | |
| 704 | 693 | void mana_query_phy_stats(struct mana_port_context *apc); | |
| 705 | - | bool mana_single_rxbuf_per_page_forced(struct mana_port_context *apc, u32 mtu); | |
| 706 | 694 | int mana_pre_alloc_rxbufs(struct mana_port_context *apc, int mtu, int num_queues); | |
| 707 | 695 | void mana_pre_dealloc_rxbufs(struct mana_port_context *apc); | |
| 708 | 696 | void mana_unmap_skb(struct sk_buff *skb, struct mana_port_context *apc); | |
modified include/net/netfilter/nf_flow_table.h
| @@ -183,10 +183,10 @@ enum nf_flow_flags { | |||
| 183 | 183 | NF_FLOW_DNAT, | |
| 184 | 184 | NF_FLOW_CLOSING, | |
| 185 | 185 | NF_FLOW_TEARDOWN, | |
| 186 | - | NF_FLOW_PENDING, | |
| 187 | 186 | NF_FLOW_HW, | |
| 188 | 187 | NF_FLOW_HW_DYING, | |
| 189 | 188 | NF_FLOW_HW_DEAD, | |
| 189 | + | NF_FLOW_HW_PENDING, | |
| 190 | 190 | NF_FLOW_HW_BIDIRECTIONAL, | |
| 191 | 191 | NF_FLOW_HW_ESTABLISHED, | |
| 192 | 192 | }; | |
modified include/net/sch_generic.h
| @@ -810,15 +810,6 @@ static inline bool skb_at_tc_ingress(const struct sk_buff *skb) | |||
| 810 | 810 | #endif | |
| 811 | 811 | } | |
| 812 | 812 | ||
| 813 | - | static inline bool skb_at_tc_egress(const struct sk_buff *skb) | |
| 814 | - | { | |
| 815 | - | #ifdef CONFIG_NET_EGRESS | |
| 816 | - | return skb->nf_skip_egress && !skb_at_tc_ingress(skb); | |
| 817 | - | #else | |
| 818 | - | return false; | |
| 819 | - | #endif | |
| 820 | - | } | |
| 821 | - | ||
| 822 | 813 | static inline bool skb_skip_tc_classify(struct sk_buff *skb) | |
| 823 | 814 | { | |
| 824 | 815 | #ifdef CONFIG_NET_CLS_ACT | |
modified include/net/strparser.h
| @@ -91,11 +91,11 @@ static inline struct strp_msg *strp_msg(struct sk_buff *skb) | |||
| 91 | 91 | struct strparser { | |
| 92 | 92 | struct sock *sk; | |
| 93 | 93 | ||
| 94 | - | u8 stopped; | |
| 95 | - | u8 paused; | |
| 96 | - | u8 aborted; | |
| 97 | - | u8 interrupted; | |
| 98 | - | u8 unrecov_intr; | |
| 94 | + | u32 stopped : 1; | |
| 95 | + | u32 paused : 1; | |
| 96 | + | u32 aborted : 1; | |
| 97 | + | u32 interrupted : 1; | |
| 98 | + | u32 unrecov_intr : 1; | |
| 99 | 99 | ||
| 100 | 100 | struct sk_buff **skb_nextp; | |
| 101 | 101 | struct sk_buff *skb_head; | |
modified include/net/xdp.h
| @@ -106,11 +106,6 @@ struct xdp_buff { | |||
| 106 | 106 | }; | |
| 107 | 107 | }; | |
| 108 | 108 | ||
| 109 | - | static __always_inline void xdp_reinit_buff(struct xdp_buff *xdp) | |
| 110 | - | { | |
| 111 | - | xdp->flags = 0; | |
| 112 | - | } | |
| 113 | - | ||
| 114 | 109 | static __always_inline bool xdp_buff_has_frags(const struct xdp_buff *xdp) | |
| 115 | 110 | { | |
| 116 | 111 | return !!(xdp->flags & XDP_FLAGS_HAS_FRAGS); | |
modified include/sound/core.h
| @@ -340,15 +340,6 @@ static inline void snd_card_unref(struct snd_card *card) | |||
| 340 | 340 | ||
| 341 | 341 | DEFINE_FREE(snd_card_unref, struct snd_card *, if (_T) snd_card_unref(_T)) | |
| 342 | 342 | ||
| 343 | - | /* | |
| 344 | - | * For automatic error handling at probe time, assign the card like: | |
| 345 | - | * struct snd_card *card __free(snd_card_free) = NULL; | |
| 346 | - | * then create and process as usual. | |
| 347 | - | * But, don't forget to clear to NULL at successful return for avoiding | |
| 348 | - | * the unexpected cleanup! | |
| 349 | - | */ | |
| 350 | - | DEFINE_FREE(snd_card_free, struct snd_card *, if (_T) snd_card_free(_T)) | |
| 351 | - | ||
| 352 | 343 | #define snd_card_set_dev(card, devptr) ((card)->dev = (devptr)) | |
| 353 | 344 | ||
| 354 | 345 | /* device.c */ | |
modified include/sound/cs35l56.h
| @@ -312,7 +312,6 @@ struct snd_ctl_elem_value; | |||
| 312 | 312 | ||
| 313 | 313 | #define CS35L56_SDW1_PLAYBACK_PORT 1 | |
| 314 | 314 | #define CS35L56_SDW1_CAPTURE_PORT 3 | |
| 315 | - | #define CS35L56_OT25_CAPTURE_PORT 4 | |
| 316 | 315 | ||
| 317 | 316 | #define CS35L56_NUM_BULK_SUPPLIES 3 | |
| 318 | 317 | #define CS35L56_NUM_DSP_REGIONS 5 | |
modified include/uapi/linux/alloc_tag.h
| @@ -38,7 +38,6 @@ struct allocinfo_counter { | |||
| 38 | 38 | __u64 bytes; | |
| 39 | 39 | __u64 calls; | |
| 40 | 40 | __u8 accurate; | |
| 41 | - | __u8 pad[7]; | |
| 42 | 41 | } __attribute__((aligned(8))); | |
| 43 | 42 | ||
| 44 | 43 | struct allocinfo_tag_data { | |
modified include/uapi/linux/random.h
| @@ -58,7 +58,7 @@ struct rand_pool_info { | |||
| 58 | 58 | /** | |
| 59 | 59 | * struct vgetrandom_opaque_params - arguments for allocating memory for vgetrandom | |
| 60 | 60 | * | |
| 61 | - | * @size_of_opaque_state: Size of each state passed to vgetrandom(). | |
| 61 | + | * @size_per_opaque_state: Size of each state that is to be passed to vgetrandom(). | |
| 62 | 62 | * @mmap_prot: Value of the prot argument in mmap(2). | |
| 63 | 63 | * @mmap_flags: Value of the flags argument in mmap(2). | |
| 64 | 64 | * @reserved: Reserved for future use. | |
modified include/vdso/getrandom.h
| @@ -64,7 +64,7 @@ extern void __arch_chacha20_blocks_nostack(u8 *dst_bytes, const u32 *key, u32 *c | |||
| 64 | 64 | * @opaque_state: Passed to __cvdso_getrandom(). | |
| 65 | 65 | * @opaque_len: Passed to __cvdso_getrandom(); | |
| 66 | 66 | * | |
| 67 | - | * This function is implemented by making a single call to __cvdso_getrandom(), whose | |
| 67 | + | * This function is implemented by making a single call to to __cvdso_getrandom(), whose | |
| 68 | 68 | * documentation may be consulted for more information. | |
| 69 | 69 | * | |
| 70 | 70 | * Returns: The return value of __cvdso_getrandom(). | |
modified init/Kconfig
| @@ -173,11 +173,6 @@ config CC_HAS_ALLOC_TOKEN | |||
| 173 | 173 | config CC_HAS_MULTIDIMENSIONAL_NONSTRING | |
| 174 | 174 | def_bool $(success,echo 'char tag[][4] __attribute__((__nonstring__)) = { };' | $(CC) $(CLANG_FLAGS) -x c - -c -o /dev/null -Werror) | |
| 175 | 175 | ||
| 176 | - | config CC_OPT_INLINE_MEMSET | |
| 177 | - | string | |
| 178 | - | default "-finline-stringops=memset" if $(cc-option,-finline-stringops=memset) | |
| 179 | - | default "-mllvm -max-store-memset=4294967294" if $(cc-option,-mllvm -max-store-memset=4294967294) | |
| 180 | - | ||
| 181 | 176 | config LD_CAN_USE_KEEP_IN_OVERLAY | |
| 182 | 177 | # ld.lld prior to 21.0.0 did not support KEEP within an overlay description | |
| 183 | 178 | # https://github.com/llvm/llvm-project/pull/130661 | |
modified io_uring/bpf_filter.c
| @@ -253,7 +253,6 @@ void io_bpf_filter_clone(struct io_restriction *dst, struct io_restriction *src) | |||
| 253 | 253 | * If the src filter is going away, just ignore it. | |
| 254 | 254 | */ | |
| 255 | 255 | if (refcount_inc_not_zero(&src->bpf_filters->refs)) { | |
| 256 | - | src->bpf_filters_cow = true; | |
| 257 | 256 | dst->bpf_filters = src->bpf_filters; | |
| 258 | 257 | dst->bpf_filters_cow = true; | |
| 259 | 258 | } | |
modified io_uring/cancel.c
| @@ -634,11 +634,12 @@ __cold void io_uring_cancel_generic(bool cancel_all, struct io_sq_data *sqd) | |||
| 634 | 634 | prepare_to_wait(&tctx->wait, &wait, TASK_INTERRUPTIBLE); | |
| 635 | 635 | io_run_task_work(); | |
| 636 | 636 | io_uring_drop_tctx_refs(current); | |
| 637 | - | /* only skip the sleep for local work this task may run */ | |
| 638 | 637 | xa_for_each(&tctx->xa, index, node) { | |
| 639 | - | if (io_local_work_pending(node->ctx) && | |
| 640 | - | io_allowed_defer_tw_run(node->ctx)) | |
| 638 | + | if (io_local_work_pending(node->ctx)) { | |
| 639 | + | WARN_ON_ONCE(node->ctx->submitter_task && | |
| 640 | + | node->ctx->submitter_task != current); | |
| 641 | 641 | goto end_wait; | |
| 642 | + | } | |
| 642 | 643 | } | |
| 643 | 644 | /* | |
| 644 | 645 | * If we've seen completions, retry without waiting. This | |
modified io_uring/cmd_net.c
| @@ -69,8 +69,8 @@ static inline int io_uring_cmd_setsockopt(struct socket *sock, | |||
| 69 | 69 | optlen); | |
| 70 | 70 | } | |
| 71 | 71 | ||
| 72 | - | static int io_process_timestamp_skb(struct io_uring_cmd *cmd, struct sock *sk, | |
| 73 | - | struct sk_buff *skb, unsigned int issue_flags) | |
| 72 | + | static bool io_process_timestamp_skb(struct io_uring_cmd *cmd, struct sock *sk, | |
| 73 | + | struct sk_buff *skb, unsigned issue_flags) | |
| 74 | 74 | { | |
| 75 | 75 | struct sock_exterr_skb *serr = SKB_EXT_ERR(skb); | |
| 76 | 76 | struct io_uring_cqe cqe[2]; | |
| @@ -83,7 +83,7 @@ static int io_process_timestamp_skb(struct io_uring_cmd *cmd, struct sock *sk, | |||
| 83 | 83 | ||
| 84 | 84 | ret = skb_get_tx_timestamp(skb, sk, &ts); | |
| 85 | 85 | if (ret < 0) | |
| 86 | - | return ret; | |
| 86 | + | return false; | |
| 87 | 87 | ||
| 88 | 88 | tskey = serr->ee.ee_data; | |
| 89 | 89 | tstype = serr->ee.ee_info; | |
| @@ -98,9 +98,7 @@ static int io_process_timestamp_skb(struct io_uring_cmd *cmd, struct sock *sk, | |||
| 98 | 98 | iots = (struct io_timespec *)&cqe[1]; | |
| 99 | 99 | iots->tv_sec = ts.tv_sec; | |
| 100 | 100 | iots->tv_nsec = ts.tv_nsec; | |
| 101 | - | if (!io_uring_cmd_post_mshot_cqe32(cmd, issue_flags, cqe)) | |
| 102 | - | return -ENOBUFS; | |
| 103 | - | return 0; | |
| 101 | + | return io_uring_cmd_post_mshot_cqe32(cmd, issue_flags, cqe); | |
| 104 | 102 | } | |
| 105 | 103 | ||
| 106 | 104 | static int io_uring_cmd_timestamp(struct socket *sock, | |
| @@ -137,8 +135,7 @@ static int io_uring_cmd_timestamp(struct socket *sock, | |||
| 137 | 135 | skb = skb_peek(&list); | |
| 138 | 136 | if (!skb) | |
| 139 | 137 | break; | |
| 140 | - | ret = io_process_timestamp_skb(cmd, sk, skb, issue_flags); | |
| 141 | - | if (ret) | |
| 138 | + | if (!io_process_timestamp_skb(cmd, sk, skb, issue_flags)) | |
| 142 | 139 | break; | |
| 143 | 140 | __skb_dequeue(&list); | |
| 144 | 141 | consume_skb(skb); | |
| @@ -148,12 +145,6 @@ static int io_uring_cmd_timestamp(struct socket *sock, | |||
| 148 | 145 | scoped_guard(spinlock_irqsave, &q->lock) | |
| 149 | 146 | skb_queue_splice(&list, q); | |
| 150 | 147 | } | |
| 151 | - | /* | |
| 152 | - | * Aux CQEs cannot overflow and the poll is edge triggered, so nothing | |
| 153 | - | * re-runs the command once the CQ drains. End the multishot instead. | |
| 154 | - | */ | |
| 155 | - | if (ret == -ENOBUFS) | |
| 156 | - | return -ENOBUFS; | |
| 157 | 148 | return -EAGAIN; | |
| 158 | 149 | } | |
| 159 | 150 | ||
modified io_uring/io_uring.c
| @@ -733,8 +733,7 @@ bool io_cqe_cache_refill(struct io_ring_ctx *ctx, bool overflow, bool cqe32) | |||
| 733 | 733 | * Post dummy CQE if a 32b CQE is needed and there's only room for a | |
| 734 | 734 | * 16b CQE before the ring wraps. | |
| 735 | 735 | */ | |
| 736 | - | if (cqe32 && (ctx->flags & IORING_SETUP_CQE_MIXED) && | |
| 737 | - | off + 1 == ctx->cq_entries) { | |
| 736 | + | if (cqe32 && off + 1 == ctx->cq_entries) { | |
| 738 | 737 | if (!io_fill_nop_cqe(ctx, off)) | |
| 739 | 738 | return false; | |
| 740 | 739 | off = 0; | |
| @@ -743,13 +742,12 @@ bool io_cqe_cache_refill(struct io_ring_ctx *ctx, bool overflow, bool cqe32) | |||
| 743 | 742 | free = ctx->cq_entries - io_cqring_queued(ctx); | |
| 744 | 743 | /* we need a contiguous range, limit based on the current array offset */ | |
| 745 | 744 | len = min(free, ctx->cq_entries - off); | |
| 745 | + | if (len < (cqe32 + 1)) | |
| 746 | + | return false; | |
| 747 | + | ||
| 746 | 748 | if (ctx->flags & IORING_SETUP_CQE32) { | |
| 747 | - | if (!len) | |
| 748 | - | return false; | |
| 749 | 749 | off <<= 1; | |
| 750 | 750 | len <<= 1; | |
| 751 | - | } else if (len < (cqe32 + 1)) { | |
| 752 | - | return false; | |
| 753 | 751 | } | |
| 754 | 752 | ||
| 755 | 753 | ctx->cqe_cached = &rings->cqes[off]; | |
| @@ -783,7 +781,7 @@ static bool io_fill_cqe_aux(struct io_ring_ctx *ctx, u64 user_data, s32 res, | |||
| 783 | 781 | WRITE_ONCE(cqe->res, res); | |
| 784 | 782 | WRITE_ONCE(cqe->flags, cflags); | |
| 785 | 783 | ||
| 786 | - | if (cqe32 || (ctx->flags & IORING_SETUP_CQE32)) { | |
| 784 | + | if (cqe32) { | |
| 787 | 785 | WRITE_ONCE(cqe->big_cqe[0], 0); | |
| 788 | 786 | WRITE_ONCE(cqe->big_cqe[1], 0); | |
| 789 | 787 | } | |
| @@ -2070,9 +2068,8 @@ int io_submit_sqes(struct io_ring_ctx *ctx, unsigned int nr) | |||
| 2070 | 2068 | ||
| 2071 | 2069 | static void io_rings_free(struct io_ring_ctx *ctx) | |
| 2072 | 2070 | { | |
| 2073 | - | /* ring memory is not charged to RLIMIT_MEMLOCK, hence no user */ | |
| 2074 | - | io_free_region(NULL, &ctx->sq_region); | |
| 2075 | - | io_free_region(NULL, &ctx->ring_region); | |
| 2071 | + | io_free_region(ctx->user, &ctx->sq_region); | |
| 2072 | + | io_free_region(ctx->user, &ctx->ring_region); | |
| 2076 | 2073 | ctx->rings = NULL; | |
| 2077 | 2074 | RCU_INIT_POINTER(ctx->rings_rcu, NULL); | |
| 2078 | 2075 | ctx->sq_sqes = NULL; | |
| @@ -2406,8 +2403,8 @@ static __cold void io_ring_exit_work(struct work_struct *work) | |||
| 2406 | 2403 | spin_lock(&ctx->completion_lock); | |
| 2407 | 2404 | spin_unlock(&ctx->completion_lock); | |
| 2408 | 2405 | ||
| 2409 | - | /* pairs with the RCU read sections in the task_work add paths */ | |
| 2410 | - | if (ctx->flags & (IORING_SETUP_DEFER_TASKRUN | IORING_SETUP_SQPOLL)) | |
| 2406 | + | /* pairs with RCU read section in io_req_local_work_add() */ | |
| 2407 | + | if (ctx->flags & IORING_SETUP_DEFER_TASKRUN) | |
| 2411 | 2408 | synchronize_rcu(); | |
| 2412 | 2409 | ||
| 2413 | 2410 | io_ring_ctx_free(ctx); | |
| @@ -2736,8 +2733,7 @@ static __cold int io_allocate_scq_urings(struct io_ring_ctx *ctx, | |||
| 2736 | 2733 | rd.user_addr = p->cq_off.user_addr; | |
| 2737 | 2734 | rd.flags |= IORING_MEM_REGION_TYPE_USER; | |
| 2738 | 2735 | } | |
| 2739 | - | /* ring memory is not charged to RLIMIT_MEMLOCK, hence no user */ | |
| 2740 | - | ret = io_create_region(NULL, &ctx->ring_region, &rd, IORING_OFF_CQ_RING); | |
| 2736 | + | ret = io_create_region(ctx, &ctx->ring_region, &rd, IORING_OFF_CQ_RING); | |
| 2741 | 2737 | if (ret) | |
| 2742 | 2738 | return ret; | |
| 2743 | 2739 | ctx->rings = rings = io_region_get_ptr(&ctx->ring_region); | |
| @@ -2751,7 +2747,7 @@ static __cold int io_allocate_scq_urings(struct io_ring_ctx *ctx, | |||
| 2751 | 2747 | rd.user_addr = p->sq_off.user_addr; | |
| 2752 | 2748 | rd.flags |= IORING_MEM_REGION_TYPE_USER; | |
| 2753 | 2749 | } | |
| 2754 | - | ret = io_create_region(NULL, &ctx->sq_region, &rd, IORING_OFF_SQES); | |
| 2750 | + | ret = io_create_region(ctx, &ctx->sq_region, &rd, IORING_OFF_SQES); | |
| 2755 | 2751 | if (ret) { | |
| 2756 | 2752 | io_rings_free(ctx); | |
| 2757 | 2753 | return ret; | |
| @@ -2962,8 +2958,7 @@ static void io_ctx_restriction_clone(struct io_ring_ctx *ctx, | |||
| 2962 | 2958 | if (dst->op_registered) | |
| 2963 | 2959 | ctx->int_flags |= IO_RING_F_OP_RESTRICTED; | |
| 2964 | 2960 | if (dst->reg_registered) | |
| 2965 | - | ctx->int_flags |= IO_RING_F_REG_RESTRICTED | | |
| 2966 | - | IO_RING_F_RESTRICT_INHERITED; | |
| 2961 | + | ctx->int_flags |= IO_RING_F_REG_RESTRICTED; | |
| 2967 | 2962 | } | |
| 2968 | 2963 | ||
| 2969 | 2964 | static __cold int io_uring_create(struct io_ctx_config *config) | |
modified io_uring/kbuf.c
| @@ -459,7 +459,7 @@ static int io_remove_buffers_legacy(struct io_ring_ctx *ctx, | |||
| 459 | 459 | static void io_put_bl(struct io_ring_ctx *ctx, struct io_buffer_list *bl) | |
| 460 | 460 | { | |
| 461 | 461 | if (bl->flags & IOBL_BUF_RING) | |
| 462 | - | io_free_region(NULL, &bl->region); | |
| 462 | + | io_free_region(ctx->user, &bl->region); | |
| 463 | 463 | else | |
| 464 | 464 | io_remove_buffers_legacy(ctx, bl, -1U); | |
| 465 | 465 | ||
| @@ -676,7 +676,7 @@ int io_register_pbuf_ring(struct io_ring_ctx *ctx, void __user *arg) | |||
| 676 | 676 | rd.user_addr = reg.ring_addr; | |
| 677 | 677 | rd.flags |= IORING_MEM_REGION_TYPE_USER; | |
| 678 | 678 | } | |
| 679 | - | ret = io_create_region(NULL, &bl->region, &rd, mmap_offset); | |
| 679 | + | ret = io_create_region(ctx, &bl->region, &rd, mmap_offset); | |
| 680 | 680 | if (ret) | |
| 681 | 681 | goto fail; | |
| 682 | 682 | br = io_region_get_ptr(&bl->region); | |
| @@ -709,7 +709,7 @@ int io_register_pbuf_ring(struct io_ring_ctx *ctx, void __user *arg) | |||
| 709 | 709 | if (!ret) | |
| 710 | 710 | return 0; | |
| 711 | 711 | fail: | |
| 712 | - | io_free_region(NULL, &bl->region); | |
| 712 | + | io_free_region(ctx->user, &bl->region); | |
| 713 | 713 | kfree(bl); | |
| 714 | 714 | return ret; | |
| 715 | 715 | } | |
modified io_uring/loop.c
| @@ -2,7 +2,6 @@ | |||
| 2 | 2 | #include "io_uring.h" | |
| 3 | 3 | #include "wait.h" | |
| 4 | 4 | #include "loop.h" | |
| 5 | - | #include "tctx.h" | |
| 6 | 5 | ||
| 7 | 6 | static inline int io_loop_nr_cqes(const struct io_ring_ctx *ctx, | |
| 8 | 7 | const struct iou_loop_params *lp) | |
| @@ -82,10 +81,6 @@ int io_run_loop(struct io_ring_ctx *ctx) | |||
| 82 | 81 | { | |
| 83 | 82 | int ret; | |
| 84 | 83 | ||
| 85 | - | ret = io_uring_add_tctx_node(ctx); | |
| 86 | - | if (unlikely(ret)) | |
| 87 | - | return ret; | |
| 88 | - | ||
| 89 | 84 | if (!io_allowed_run_tw(ctx)) | |
| 90 | 85 | return -EEXIST; | |
| 91 | 86 | ||
modified io_uring/memmap.c
| @@ -204,7 +204,7 @@ done: | |||
| 204 | 204 | return 0; | |
| 205 | 205 | } | |
| 206 | 206 | ||
| 207 | - | int io_create_region(struct user_struct *user, struct io_mapped_region *mr, | |
| 207 | + | int io_create_region(struct io_ring_ctx *ctx, struct io_mapped_region *mr, | |
| 208 | 208 | struct io_uring_region_desc *reg, | |
| 209 | 209 | unsigned long mmap_offset) | |
| 210 | 210 | { | |
| @@ -230,8 +230,8 @@ int io_create_region(struct user_struct *user, struct io_mapped_region *mr, | |||
| 230 | 230 | return -EOVERFLOW; | |
| 231 | 231 | ||
| 232 | 232 | nr_pages = reg->size >> PAGE_SHIFT; | |
| 233 | - | if (user) { | |
| 234 | - | ret = __io_account_mem(user, nr_pages); | |
| 233 | + | if (ctx->user) { | |
| 234 | + | ret = __io_account_mem(ctx->user, nr_pages); | |
| 235 | 235 | if (ret) | |
| 236 | 236 | return ret; | |
| 237 | 237 | } | |
| @@ -240,7 +240,7 @@ int io_create_region(struct user_struct *user, struct io_mapped_region *mr, | |||
| 240 | 240 | if (reg->flags & IORING_MEM_REGION_TYPE_USER) | |
| 241 | 241 | ret = io_region_pin_pages(mr, reg); | |
| 242 | 242 | else | |
| 243 | - | ret = io_region_allocate_pages(mr, reg, mmap_offset, user); | |
| 243 | + | ret = io_region_allocate_pages(mr, reg, mmap_offset, ctx->user); | |
| 244 | 244 | if (ret) | |
| 245 | 245 | goto out_free; | |
| 246 | 246 | ||
| @@ -249,7 +249,7 @@ int io_create_region(struct user_struct *user, struct io_mapped_region *mr, | |||
| 249 | 249 | goto out_free; | |
| 250 | 250 | return 0; | |
| 251 | 251 | out_free: | |
| 252 | - | io_free_region(user, mr); | |
| 252 | + | io_free_region(ctx->user, mr); | |
| 253 | 253 | return ret; | |
| 254 | 254 | } | |
| 255 | 255 | ||
modified io_uring/memmap.h
| @@ -18,7 +18,7 @@ unsigned long io_uring_get_unmapped_area(struct file *file, unsigned long addr, | |||
| 18 | 18 | int io_uring_mmap(struct file *file, struct vm_area_struct *vma); | |
| 19 | 19 | ||
| 20 | 20 | void io_free_region(struct user_struct *user, struct io_mapped_region *mr); | |
| 21 | - | int io_create_region(struct user_struct *user, struct io_mapped_region *mr, | |
| 21 | + | int io_create_region(struct io_ring_ctx *ctx, struct io_mapped_region *mr, | |
| 22 | 22 | struct io_uring_region_desc *reg, | |
| 23 | 23 | unsigned long mmap_offset); | |
| 24 | 24 | ||
modified io_uring/net.c
| @@ -7,7 +7,6 @@ | |||
| 7 | 7 | #include <linux/un.h> | |
| 8 | 8 | #include <linux/compat.h> | |
| 9 | 9 | #include <net/compat.h> | |
| 10 | - | #include <net/ipv6.h> | |
| 11 | 10 | #include <linux/io_uring.h> | |
| 12 | 11 | ||
| 13 | 12 | #include <uapi/linux/io_uring.h> | |
| @@ -1742,8 +1741,7 @@ void io_connect_bpf_populate(struct io_uring_bpf_ctx *bctx, struct io_kiocb *req | |||
| 1742 | 1741 | case AF_INET6: { | |
| 1743 | 1742 | struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)ss; | |
| 1744 | 1743 | ||
| 1745 | - | /* The IPv6 stack accepts SIN6_LEN_RFC2133; port and addr are in it. */ | |
| 1746 | - | if (conn->addr_len < SIN6_LEN_RFC2133) | |
| 1744 | + | if (conn->addr_len < (int)sizeof(*sin6)) | |
| 1747 | 1745 | break; | |
| 1748 | 1746 | bctx->connect.port = sin6->sin6_port; | |
| 1749 | 1747 | memcpy(bctx->connect.v6_addr, &sin6->sin6_addr, | |
modified io_uring/register.c
| @@ -480,9 +480,8 @@ struct io_ring_ctx_rings { | |||
| 480 | 480 | static void io_register_free_rings(struct io_ring_ctx *ctx, | |
| 481 | 481 | struct io_ring_ctx_rings *r) | |
| 482 | 482 | { | |
| 483 | - | /* ring memory is not charged to RLIMIT_MEMLOCK, hence no user */ | |
| 484 | - | io_free_region(NULL, &r->sq_region); | |
| 485 | - | io_free_region(NULL, &r->ring_region); | |
| 483 | + | io_free_region(ctx->user, &r->sq_region); | |
| 484 | + | io_free_region(ctx->user, &r->ring_region); | |
| 486 | 485 | } | |
| 487 | 486 | ||
| 488 | 487 | #define swap_old(ctx, o, n, field) \ | |
| @@ -530,7 +529,7 @@ static int io_register_resize_rings(struct io_ring_ctx *ctx, void __user *arg) | |||
| 530 | 529 | rd.user_addr = p->cq_off.user_addr; | |
| 531 | 530 | rd.flags |= IORING_MEM_REGION_TYPE_USER; | |
| 532 | 531 | } | |
| 533 | - | ret = io_create_region(NULL, &n.ring_region, &rd, IORING_OFF_CQ_RING); | |
| 532 | + | ret = io_create_region(ctx, &n.ring_region, &rd, IORING_OFF_CQ_RING); | |
| 534 | 533 | if (ret) | |
| 535 | 534 | return ret; | |
| 536 | 535 | ||
| @@ -560,7 +559,7 @@ static int io_register_resize_rings(struct io_ring_ctx *ctx, void __user *arg) | |||
| 560 | 559 | rd.user_addr = p->sq_off.user_addr; | |
| 561 | 560 | rd.flags |= IORING_MEM_REGION_TYPE_USER; | |
| 562 | 561 | } | |
| 563 | - | ret = io_create_region(NULL, &n.sq_region, &rd, IORING_OFF_SQES); | |
| 562 | + | ret = io_create_region(ctx, &n.sq_region, &rd, IORING_OFF_SQES); | |
| 564 | 563 | if (ret) { | |
| 565 | 564 | io_register_free_rings(ctx, &n); | |
| 566 | 565 | return ret; | |
| @@ -731,8 +730,7 @@ static int io_register_mem_region(struct io_ring_ctx *ctx, void __user *uarg) | |||
| 731 | 730 | !(ctx->flags & IORING_SETUP_R_DISABLED)) | |
| 732 | 731 | return -EINVAL; | |
| 733 | 732 | ||
| 734 | - | ret = io_create_region(ctx->user, ®ion, &rd, | |
| 735 | - | IORING_MAP_OFF_PARAM_REGION); | |
| 733 | + | ret = io_create_region(ctx, ®ion, &rd, IORING_MAP_OFF_PARAM_REGION); | |
| 736 | 734 | if (ret) | |
| 737 | 735 | return ret; | |
| 738 | 736 | if (copy_to_user(rd_uptr, &rd, sizeof(rd))) { | |
| @@ -766,14 +764,7 @@ static int __io_uring_register(struct io_ring_ctx *ctx, unsigned opcode, | |||
| 766 | 764 | if (ctx->submitter_task && ctx->submitter_task != current) | |
| 767 | 765 | return -EEXIST; | |
| 768 | 766 | ||
| 769 | - | /* | |
| 770 | - | * A disabled ring is exempt from its own register restrictions, so | |
| 771 | - | * that the creator can set them up and then enable the ring. That | |
| 772 | - | * does not apply to restrictions inherited from the task. | |
| 773 | - | */ | |
| 774 | - | if ((ctx->int_flags & IO_RING_F_REG_RESTRICTED) && | |
| 775 | - | (!(ctx->flags & IORING_SETUP_R_DISABLED) || | |
| 776 | - | (ctx->int_flags & IO_RING_F_RESTRICT_INHERITED))) { | |
| 767 | + | if ((ctx->int_flags & IO_RING_F_REG_RESTRICTED) && !(ctx->flags & IORING_SETUP_R_DISABLED)) { | |
| 777 | 768 | opcode = array_index_nospec(opcode, IORING_REGISTER_LAST); | |
| 778 | 769 | if (!test_bit(opcode, ctx->restrictions.register_op)) | |
| 779 | 770 | return -EACCES; | |
modified io_uring/tw.c
| @@ -210,9 +210,6 @@ void io_req_normal_work_add(struct io_kiocb *req) | |||
| 210 | 210 | struct io_uring_task *tctx = req->tctx; | |
| 211 | 211 | struct io_ring_ctx *ctx = req->ctx; | |
| 212 | 212 | ||
| 213 | - | /* SQPOLL can retire the request on push, see io_ring_exit_work() */ | |
| 214 | - | guard(rcu)(); | |
| 215 | - | ||
| 216 | 213 | /* tw run already pending, nothing else to do */ | |
| 217 | 214 | if (!mpscq_push(&tctx->task_list, &req->io_task_work.node)) | |
| 218 | 215 | return; | |
modified io_uring/zcrx.c
| @@ -374,7 +374,6 @@ struct io_zcrx_args { | |||
| 374 | 374 | struct io_kiocb *req; | |
| 375 | 375 | struct io_zcrx_ifq *ifq; | |
| 376 | 376 | unsigned nr_skbs; | |
| 377 | - | bool stopped_early; | |
| 378 | 377 | }; | |
| 379 | 378 | ||
| 380 | 379 | static const struct memory_provider_ops io_uring_pp_zc_ops; | |
| @@ -432,7 +431,7 @@ static int io_allocate_rbuf_ring(struct io_ring_ctx *ctx, | |||
| 432 | 431 | mmap_offset = IORING_MAP_OFF_ZCRX_REGION; | |
| 433 | 432 | mmap_offset += (u64)id << IORING_OFF_ZCRX_SHIFT; | |
| 434 | 433 | ||
| 435 | - | ret = io_create_region(ctx->user, &ifq->rq_region, rd, mmap_offset); | |
| 434 | + | ret = io_create_region(ctx, &ifq->rq_region, rd, mmap_offset); | |
| 436 | 435 | if (ret < 0) | |
| 437 | 436 | return ret; | |
| 438 | 437 | ||
| @@ -1900,9 +1899,6 @@ io_zcrx_recv_skb(read_descriptor_t *desc, struct sk_buff *skb, | |||
| 1900 | 1899 | } | |
| 1901 | 1900 | ||
| 1902 | 1901 | out: | |
| 1903 | - | /* Bytes left in len mean an error stopped the walk early. */ | |
| 1904 | - | if (len) | |
| 1905 | - | args->stopped_early = true; | |
| 1906 | 1902 | if (offset == start_off) | |
| 1907 | 1903 | return ret; | |
| 1908 | 1904 | desc->count -= (offset - start_off); | |
| @@ -1939,9 +1935,8 @@ static int io_zcrx_tcp_recvmsg(struct io_kiocb *req, struct io_zcrx_ifq *ifq, | |||
| 1939 | 1935 | ret = -ENOTCONN; | |
| 1940 | 1936 | else | |
| 1941 | 1937 | ret = -EAGAIN; | |
| 1942 | - | } else if ((issue_flags & IO_URING_F_MULTISHOT) && | |
| 1943 | - | (unlikely(args.nr_skbs > IO_SKBS_PER_CALL_LIMIT) || | |
| 1944 | - | args.stopped_early)) { | |
| 1938 | + | } else if (unlikely(args.nr_skbs > IO_SKBS_PER_CALL_LIMIT) && | |
| 1939 | + | (issue_flags & IO_URING_F_MULTISHOT)) { | |
| 1945 | 1940 | ret = IOU_REQUEUE; | |
| 1946 | 1941 | } else if (sock_flag(sk, SOCK_DONE)) { | |
| 1947 | 1942 | /* Make it to retry until it finally gets 0. */ | |
modified kernel/audit_tree.c
| @@ -545,38 +545,22 @@ static void kill_rules(struct audit_context *context, struct audit_tree *tree) | |||
| 545 | 545 | { | |
| 546 | 546 | struct audit_krule *rule, *next; | |
| 547 | 547 | struct audit_entry *entry; | |
| 548 | - | bool need_sync = false; | |
| 549 | 548 | ||
| 550 | 549 | list_for_each_entry_safe(rule, next, &tree->rules, rlist) { | |
| 551 | 550 | entry = container_of(rule, struct audit_entry, rule); | |
| 552 | 551 | ||
| 552 | + | list_del_init(&rule->rlist); | |
| 553 | 553 | if (rule->tree) { | |
| 554 | 554 | /* not a half-baked one */ | |
| 555 | 555 | audit_tree_log_remove_rule(context, rule); | |
| 556 | + | if (entry->rule.exe) | |
| 557 | + | audit_remove_mark(entry->rule.exe); | |
| 556 | 558 | rule->tree = NULL; | |
| 557 | 559 | list_del_rcu(&entry->list); | |
| 558 | 560 | list_del(&entry->rule.list); | |
| 559 | - | if (entry->rule.exe) | |
| 560 | - | need_sync = true; | |
| 561 | - | } else { | |
| 562 | - | list_del_init(&rule->rlist); | |
| 561 | + | call_rcu(&entry->rcu, audit_free_rule_rcu); | |
| 563 | 562 | } | |
| 564 | 563 | } | |
| 565 | - | ||
| 566 | - | if (list_empty(&tree->rules)) | |
| 567 | - | return; | |
| 568 | - | ||
| 569 | - | if (need_sync) | |
| 570 | - | synchronize_rcu(); | |
| 571 | - | ||
| 572 | - | list_for_each_entry_safe(rule, next, &tree->rules, rlist) { | |
| 573 | - | entry = container_of(rule, struct audit_entry, rule); | |
| 574 | - | ||
| 575 | - | list_del_init(&rule->rlist); | |
| 576 | - | if (entry->rule.exe) | |
| 577 | - | audit_remove_mark(entry->rule.exe); | |
| 578 | - | call_rcu(&entry->rcu, audit_free_rule_rcu); | |
| 579 | - | } | |
| 580 | 564 | } | |
| 581 | 565 | ||
| 582 | 566 | /* | |
modified kernel/bpf/core.c
| @@ -1362,7 +1362,7 @@ static int bpf_jit_blind_insn(const struct bpf_insn *from, | |||
| 1362 | 1362 | { | |
| 1363 | 1363 | struct bpf_insn *to = to_buff; | |
| 1364 | 1364 | u32 imm_rnd = get_random_u32(); | |
| 1365 | - | int off; | |
| 1365 | + | s16 off; | |
| 1366 | 1366 | ||
| 1367 | 1367 | BUILD_BUG_ON(BPF_REG_PARAMS + 2 != MAX_BPF_JIT_REG); | |
| 1368 | 1368 | BUILD_BUG_ON(BPF_REG_AX + 1 != MAX_BPF_JIT_REG); | |
| @@ -1438,8 +1438,6 @@ static int bpf_jit_blind_insn(const struct bpf_insn *from, | |||
| 1438 | 1438 | off = from->off; | |
| 1439 | 1439 | if (off < 0) | |
| 1440 | 1440 | off -= 2; | |
| 1441 | - | if (off < S16_MIN) | |
| 1442 | - | return -ERANGE; | |
| 1443 | 1441 | *to++ = BPF_ALU64_IMM(BPF_MOV, BPF_REG_AX, imm_rnd ^ from->imm); | |
| 1444 | 1442 | *to++ = BPF_ALU64_IMM(BPF_XOR, BPF_REG_AX, imm_rnd); | |
| 1445 | 1443 | *to++ = BPF_JMP_REG(from->code, from->dst_reg, BPF_REG_AX, off); | |
| @@ -1460,8 +1458,6 @@ static int bpf_jit_blind_insn(const struct bpf_insn *from, | |||
| 1460 | 1458 | off = from->off; | |
| 1461 | 1459 | if (off < 0) | |
| 1462 | 1460 | off -= 2; | |
| 1463 | - | if (off < S16_MIN) | |
| 1464 | - | return -ERANGE; | |
| 1465 | 1461 | *to++ = BPF_ALU32_IMM(BPF_MOV, BPF_REG_AX, imm_rnd ^ from->imm); | |
| 1466 | 1462 | *to++ = BPF_ALU32_IMM(BPF_XOR, BPF_REG_AX, imm_rnd); | |
| 1467 | 1463 | *to++ = BPF_JMP32_REG(from->code, from->dst_reg, BPF_REG_AX, | |
| @@ -1610,9 +1606,7 @@ struct bpf_prog *bpf_jit_blind_constants(struct bpf_verifier_env *env, struct bp | |||
| 1610 | 1606 | if (!rewritten) | |
| 1611 | 1607 | continue; | |
| 1612 | 1608 | ||
| 1613 | - | if (rewritten < 0) | |
| 1614 | - | tmp = ERR_PTR(rewritten); | |
| 1615 | - | else if (env) | |
| 1609 | + | if (env) | |
| 1616 | 1610 | tmp = bpf_patch_insn_data(env, i, insn_buff, rewritten); | |
| 1617 | 1611 | else | |
| 1618 | 1612 | tmp = bpf_patch_insn_single(clone, i, insn_buff, rewritten); | |
modified kernel/bpf/hashtab.c
| @@ -128,7 +128,6 @@ struct htab_elem { | |||
| 128 | 128 | ||
| 129 | 129 | struct htab_btf_record { | |
| 130 | 130 | struct btf_record *record; | |
| 131 | - | struct btf *btf; | |
| 132 | 131 | u32 key_size; | |
| 133 | 132 | }; | |
| 134 | 133 | ||
| @@ -498,13 +497,8 @@ static void htab_dtor_ctx_free(void *ctx) | |||
| 498 | 497 | { | |
| 499 | 498 | struct htab_btf_record *hrec = ctx; | |
| 500 | 499 | ||
| 501 | - | /* | |
| 502 | - | * The duplicated record still points into the map BTF, so free it | |
| 503 | - | * before dropping the reference that keeps that BTF alive. | |
| 504 | - | */ | |
| 505 | 500 | btf_record_free(hrec->record); | |
| 506 | - | btf_put(hrec->btf); | |
| 507 | - | kfree(hrec); | |
| 501 | + | kfree(ctx); | |
| 508 | 502 | } | |
| 509 | 503 | ||
| 510 | 504 | static int bpf_ma_set_dtor(struct bpf_map *map, struct bpf_mem_alloc *ma, | |
| @@ -527,15 +521,6 @@ static int bpf_ma_set_dtor(struct bpf_map *map, struct bpf_mem_alloc *ma, | |||
| 527 | 521 | kfree(hrec); | |
| 528 | 522 | return err; | |
| 529 | 523 | } | |
| 530 | - | /* | |
| 531 | - | * btf_record_dup() only acquires kernel and module BTF. Fields whose | |
| 532 | - | * types live in the map BTF keep pointing into it: kptrs to local | |
| 533 | - | * types refer to map->btf, and graph roots carry a value record owned | |
| 534 | - | * by its struct meta table. The context can outlive the map when the | |
| 535 | - | * allocator defers its teardown, so hold a reference of our own. | |
| 536 | - | */ | |
| 537 | - | hrec->btf = map->btf; | |
| 538 | - | btf_get(hrec->btf); | |
| 539 | 524 | bpf_mem_alloc_set_dtor(ma, dtor, htab_dtor_ctx_free, hrec); | |
| 540 | 525 | return 0; | |
| 541 | 526 | } | |
| @@ -3374,10 +3359,8 @@ static int __rhtab_map_lookup_and_delete_batch(struct bpf_map *map, | |||
| 3374 | 3359 | } | |
| 3375 | 3360 | ||
| 3376 | 3361 | if (do_delete) { | |
| 3377 | - | migrate_disable(); | |
| 3378 | 3362 | for (i = 0; i < total; i++) | |
| 3379 | 3363 | rhtab_delete_elem(rhtab, del_elems[i], NULL, 0); | |
| 3380 | - | migrate_enable(); | |
| 3381 | 3364 | } | |
| 3382 | 3365 | ||
| 3383 | 3366 | rcu_read_unlock(); | |
modified kernel/bpf/memalloc.c
| @@ -118,11 +118,6 @@ struct bpf_mem_cache { | |||
| 118 | 118 | struct llist_head free_by_rcu_ttrace; | |
| 119 | 119 | struct llist_head waiting_for_gp_ttrace; | |
| 120 | 120 | struct rcu_head rcu_ttrace; | |
| 121 | - | /* | |
| 122 | - | * 0 - idle | |
| 123 | - | * 1 - __free_rcu() is queued | |
| 124 | - | * 2 - __free_rcu() is queued and free_by_rcu_ttrace got more objects since | |
| 125 | - | */ | |
| 126 | 121 | atomic_t call_rcu_ttrace_in_progress; | |
| 127 | 122 | raw_spinlock_t lock; | |
| 128 | 123 | }; | |
| @@ -281,8 +276,6 @@ static int free_all(struct bpf_mem_cache *c, struct llist_node *llnode, bool per | |||
| 281 | 276 | return cnt; | |
| 282 | 277 | } | |
| 283 | 278 | ||
| 284 | - | static void __do_call_rcu_ttrace(struct bpf_mem_cache *c); | |
| 285 | - | ||
| 286 | 279 | static void __free_rcu(struct rcu_head *head) | |
| 287 | 280 | { | |
| 288 | 281 | struct bpf_mem_cache *c = container_of(head, struct bpf_mem_cache, rcu_ttrace); | |
| @@ -292,19 +285,7 @@ static void __free_rcu(struct rcu_head *head) | |||
| 292 | 285 | llnode = llist_del_all(&c->waiting_for_gp_ttrace); | |
| 293 | 286 | ||
| 294 | 287 | free_all(c, llnode, !!c->percpu_size); | |
| 295 | - | ||
| 296 | - | /* | |
| 297 | - | * do_call_rcu_ttrace() that ran while GP was in flight left its objects | |
| 298 | - | * in free_by_rcu_ttrace. This cache may never free or alloc in bulk | |
| 299 | - | * again, so start the next GP from here. | |
| 300 | - | * 'c' can be freed as soon as call_rcu_ttrace_in_progress is zero. | |
| 301 | - | */ | |
| 302 | - | if (atomic_cmpxchg(&c->call_rcu_ttrace_in_progress, 1, 0) == 1) | |
| 303 | - | return; | |
| 304 | - | ||
| 305 | - | /* Pairs with synchronize_rcu() in free_mem_alloc() */ | |
| 306 | - | guard(rcu)(); | |
| 307 | - | __do_call_rcu_ttrace(c); | |
| 288 | + | atomic_set(&c->call_rcu_ttrace_in_progress, 0); | |
| 308 | 289 | } | |
| 309 | 290 | ||
| 310 | 291 | static void enque_to_free(struct bpf_mem_cache *c, void *obj) | |
| @@ -317,15 +298,18 @@ static void enque_to_free(struct bpf_mem_cache *c, void *obj) | |||
| 317 | 298 | llist_add(llnode, &c->free_by_rcu_ttrace); | |
| 318 | 299 | } | |
| 319 | 300 | ||
| 320 | - | static void __do_call_rcu_ttrace(struct bpf_mem_cache *c) | |
| 301 | + | static void do_call_rcu_ttrace(struct bpf_mem_cache *c) | |
| 321 | 302 | { | |
| 322 | 303 | struct llist_node *llnode, *t; | |
| 323 | 304 | ||
| 324 | - | /* | |
| 325 | - | * Must be done before llist_del_all(). Objects that it misses were | |
| 326 | - | * added by do_call_rcu_ttrace() that will set 2 after this store. | |
| 327 | - | */ | |
| 328 | - | atomic_set(&c->call_rcu_ttrace_in_progress, 1); | |
| 305 | + | if (atomic_xchg(&c->call_rcu_ttrace_in_progress, 1)) { | |
| 306 | + | if (unlikely(READ_ONCE(c->draining))) { | |
| 307 | + | scoped_guard(raw_spinlock_irqsave, &c->lock) | |
| 308 | + | llnode = llist_del_all(&c->free_by_rcu_ttrace); | |
| 309 | + | free_all(c, llnode, !!c->percpu_size); | |
| 310 | + | } | |
| 311 | + | return; | |
| 312 | + | } | |
| 329 | 313 | ||
| 330 | 314 | WARN_ON_ONCE(!llist_empty(&c->waiting_for_gp_ttrace)); | |
| 331 | 315 | llist_for_each_safe(llnode, t, llist_del_all(&c->free_by_rcu_ttrace)) | |
| @@ -344,22 +328,6 @@ static void __do_call_rcu_ttrace(struct bpf_mem_cache *c) | |||
| 344 | 328 | call_rcu_tasks_trace(&c->rcu_ttrace, __free_rcu); | |
| 345 | 329 | } | |
| 346 | 330 | ||
| 347 | - | static void do_call_rcu_ttrace(struct bpf_mem_cache *c) | |
| 348 | - | { | |
| 349 | - | struct llist_node *llnode; | |
| 350 | - | ||
| 351 | - | if (atomic_xchg(&c->call_rcu_ttrace_in_progress, 2)) { | |
| 352 | - | if (unlikely(READ_ONCE(c->draining))) { | |
| 353 | - | scoped_guard(raw_spinlock_irqsave, &c->lock) | |
| 354 | - | llnode = llist_del_all(&c->free_by_rcu_ttrace); | |
| 355 | - | free_all(c, llnode, !!c->percpu_size); | |
| 356 | - | } | |
| 357 | - | return; | |
| 358 | - | } | |
| 359 | - | ||
| 360 | - | __do_call_rcu_ttrace(c); | |
| 361 | - | } | |
| 362 | - | ||
| 363 | 331 | static void free_bulk(struct bpf_mem_cache *c) | |
| 364 | 332 | { | |
| 365 | 333 | struct bpf_mem_cache *tgt = c->tgt; | |
| @@ -732,12 +700,7 @@ static void free_mem_alloc(struct bpf_mem_alloc *ma) | |||
| 732 | 700 | * to wait for the pending __free_by_rcu(), and __free_rcu(). RCU Tasks | |
| 733 | 701 | * Trace grace period implies RCU grace period, so all __free_rcu don't | |
| 734 | 702 | * need extra call_rcu() (and thus extra rcu_barrier() here). | |
| 735 | - | * | |
| 736 | - | * __free_rcu() queues itself again unless it sees 'draining'. After | |
| 737 | - | * synchronize_rcu() it either did that already or will not do it, so | |
| 738 | - | * rcu_barrier_tasks_trace() cannot miss it. | |
| 739 | 703 | */ | |
| 740 | - | synchronize_rcu(); | |
| 741 | 704 | rcu_barrier(); /* wait for __free_by_rcu */ | |
| 742 | 705 | rcu_barrier_tasks_trace(); /* wait for __free_rcu */ | |
| 743 | 706 | free_mem_alloc_no_barrier(ma); | |
modified kernel/bpf/syscall.c
| @@ -2448,21 +2448,6 @@ static void __bpf_prog_put_rcu(struct rcu_head *rcu) | |||
| 2448 | 2448 | bpf_prog_free(aux->prog); | |
| 2449 | 2449 | } | |
| 2450 | 2450 | ||
| 2451 | - | /* | |
| 2452 | - | * Progs called from a trampoline can also be reached by a task that was | |
| 2453 | - | * preempted in the trampoline before the prog's enter helper took its RCU | |
| 2454 | - | * read lock, wait for those first. | |
| 2455 | - | */ | |
| 2456 | - | static void __bpf_prog_put_rcu_tasks(struct rcu_head *rcu) | |
| 2457 | - | { | |
| 2458 | - | struct bpf_prog *prog = container_of(rcu, struct bpf_prog_aux, rcu)->prog; | |
| 2459 | - | ||
| 2460 | - | if (prog->sleepable) | |
| 2461 | - | call_rcu_tasks_trace(rcu, __bpf_prog_put_rcu); | |
| 2462 | - | else | |
| 2463 | - | call_rcu(rcu, __bpf_prog_put_rcu); | |
| 2464 | - | } | |
| 2465 | - | ||
| 2466 | 2451 | static void __bpf_prog_put_noref(struct bpf_prog *prog, bool deferred) | |
| 2467 | 2452 | { | |
| 2468 | 2453 | bpf_prog_kallsyms_del_all(prog); | |
| @@ -2476,9 +2461,7 @@ static void __bpf_prog_put_noref(struct bpf_prog *prog, bool deferred) | |||
| 2476 | 2461 | btf_put(prog->aux->attach_btf); | |
| 2477 | 2462 | ||
| 2478 | 2463 | if (deferred) { | |
| 2479 | - | if (IS_ENABLED(CONFIG_TASKS_RCU) && prog->aux->tramp_linked) | |
| 2480 | - | call_rcu_tasks(&prog->aux->rcu, __bpf_prog_put_rcu_tasks); | |
| 2481 | - | else if (prog->sleepable) | |
| 2464 | + | if (prog->sleepable) | |
| 2482 | 2465 | call_rcu_tasks_trace(&prog->aux->rcu, __bpf_prog_put_rcu); | |
| 2483 | 2466 | else | |
| 2484 | 2467 | call_rcu(&prog->aux->rcu, __bpf_prog_put_rcu); | |
modified kernel/bpf/trampoline.c
| @@ -401,7 +401,6 @@ static struct bpf_trampoline *bpf_trampoline_lookup(u64 key, unsigned long ip) | |||
| 401 | 401 | head = &trampoline_ip_table[hash_64(tr->ip, TRAMPOLINE_HASH_BITS)]; | |
| 402 | 402 | hlist_add_head(&tr->hlist_ip, head); | |
| 403 | 403 | refcount_set(&tr->refcnt, 1); | |
| 404 | - | INIT_LIST_HEAD(&tr->images); | |
| 405 | 404 | for (i = 0; i < BPF_TRAMP_MAX; i++) | |
| 406 | 405 | INIT_HLIST_HEAD(&tr->progs_hlist[i]); | |
| 407 | 406 | out: | |
| @@ -566,22 +565,15 @@ static void bpf_tramp_image_free(struct bpf_tramp_image *im) | |||
| 566 | 565 | arch_free_bpf_trampoline(im->image, im->size); | |
| 567 | 566 | bpf_jit_uncharge_modmem(im->size); | |
| 568 | 567 | percpu_ref_exit(&im->pcref); | |
| 569 | - | kfree(im->skips); | |
| 570 | 568 | kfree_rcu(im, rcu); | |
| 571 | 569 | } | |
| 572 | 570 | ||
| 573 | 571 | static void __bpf_tramp_image_put_deferred(struct work_struct *work) | |
| 574 | 572 | { | |
| 575 | 573 | struct bpf_tramp_image *im; | |
| 576 | - | struct bpf_trampoline *tr; | |
| 577 | 574 | ||
| 578 | 575 | im = container_of(work, struct bpf_tramp_image, work); | |
| 579 | - | tr = im->tr; | |
| 580 | - | trampoline_lock(tr); | |
| 581 | - | list_del(&im->list); | |
| 582 | - | trampoline_unlock(tr); | |
| 583 | 576 | bpf_tramp_image_free(im); | |
| 584 | - | bpf_trampoline_put(tr); | |
| 585 | 577 | } | |
| 586 | 578 | ||
| 587 | 579 | /* callback, fexit step 3 or fentry step 2 */ | |
| @@ -609,7 +601,7 @@ static void __bpf_tramp_image_put_rcu_tasks(struct rcu_head *rcu) | |||
| 609 | 601 | struct bpf_tramp_image *im; | |
| 610 | 602 | ||
| 611 | 603 | im = container_of(rcu, struct bpf_tramp_image, rcu); | |
| 612 | - | if (im->call_orig) | |
| 604 | + | if (im->ip_after_call) | |
| 613 | 605 | /* the case of fmod_ret/fexit trampoline and CONFIG_PREEMPTION=y */ | |
| 614 | 606 | percpu_ref_kill(&im->pcref); | |
| 615 | 607 | else | |
| @@ -629,9 +621,9 @@ static void bpf_tramp_image_put(struct bpf_tramp_image *im) | |||
| 629 | 621 | * | |
| 630 | 622 | * The trampoline is unreachable before bpf_tramp_image_put(). | |
| 631 | 623 | * | |
| 632 | - | * Progs are patched out of the image when they are detached, see | |
| 633 | - | * bpf_trampoline_skip_prog(), so they can be freed even if a task is | |
| 634 | - | * still in the image. | |
| 624 | + | * First, patch the trampoline to avoid calling into fexit progs. | |
| 625 | + | * The progs will be freed even if the original function is still | |
| 626 | + | * executing or sleeping. | |
| 635 | 627 | * In case of CONFIG_PREEMPT=y use call_rcu_tasks() to wait on | |
| 636 | 628 | * first few asm instructions to execute and call into | |
| 637 | 629 | * __bpf_tramp_enter->percpu_ref_get. | |
| @@ -645,7 +637,11 @@ static void bpf_tramp_image_put(struct bpf_tramp_image *im) | |||
| 645 | 637 | * percpu_ref_kill will be waiting for. Hence the first | |
| 646 | 638 | * call_rcu_tasks() is not necessary. | |
| 647 | 639 | */ | |
| 648 | - | if (im->call_orig) { | |
| 640 | + | if (im->ip_after_call) { | |
| 641 | + | int err = bpf_arch_text_poke(im->ip_after_call, BPF_MOD_NOP, | |
| 642 | + | BPF_MOD_JUMP, NULL, | |
| 643 | + | im->ip_epilogue); | |
| 644 | + | WARN_ON(err); | |
| 649 | 645 | if (IS_ENABLED(CONFIG_TASKS_RCU)) | |
| 650 | 646 | call_rcu_tasks(&im->rcu, __bpf_tramp_image_put_rcu_tasks); | |
| 651 | 647 | else | |
| @@ -662,7 +658,7 @@ static void bpf_tramp_image_put(struct bpf_tramp_image *im) | |||
| 662 | 658 | call_rcu_tasks_trace(&im->rcu, __bpf_tramp_image_put_rcu_tasks); | |
| 663 | 659 | } | |
| 664 | 660 | ||
| 665 | - | static struct bpf_tramp_image *bpf_tramp_image_alloc(u64 key, int size, int nr_progs) | |
| 661 | + | static struct bpf_tramp_image *bpf_tramp_image_alloc(u64 key, int size) | |
| 666 | 662 | { | |
| 667 | 663 | struct bpf_tramp_image *im; | |
| 668 | 664 | struct bpf_ksym *ksym; | |
| @@ -673,10 +669,6 @@ static struct bpf_tramp_image *bpf_tramp_image_alloc(u64 key, int size, int nr_p | |||
| 673 | 669 | if (!im) | |
| 674 | 670 | goto out; | |
| 675 | 671 | ||
| 676 | - | im->skips = kzalloc_objs(*im->skips, nr_progs); | |
| 677 | - | if (!im->skips) | |
| 678 | - | goto out_free_im; | |
| 679 | - | ||
| 680 | 672 | err = bpf_jit_charge_modmem(size); | |
| 681 | 673 | if (err) | |
| 682 | 674 | goto out_free_im; | |
| @@ -703,7 +695,6 @@ out_free_image: | |||
| 703 | 695 | out_uncharge: | |
| 704 | 696 | bpf_jit_uncharge_modmem(size); | |
| 705 | 697 | out_free_im: | |
| 706 | - | kfree(im->skips); | |
| 707 | 698 | kfree(im); | |
| 708 | 699 | out: | |
| 709 | 700 | return ERR_PTR(err); | |
| @@ -780,12 +771,11 @@ again: | |||
| 780 | 771 | goto out; | |
| 781 | 772 | } | |
| 782 | 773 | ||
| 783 | - | im = bpf_tramp_image_alloc(tr->key, size, total); | |
| 774 | + | im = bpf_tramp_image_alloc(tr->key, size); | |
| 784 | 775 | if (IS_ERR(im)) { | |
| 785 | 776 | err = PTR_ERR(im); | |
| 786 | 777 | goto out; | |
| 787 | 778 | } | |
| 788 | - | im->call_orig = tr->flags & BPF_TRAMP_F_CALL_ORIG; | |
| 789 | 779 | ||
| 790 | 780 | err = arch_prepare_bpf_trampoline(im, im->image, im->image + size, | |
| 791 | 781 | &tr->func.model, tr->flags, tnodes, | |
| @@ -816,14 +806,8 @@ again: | |||
| 816 | 806 | #endif | |
| 817 | 807 | ||
| 818 | 808 | out_free: | |
| 819 | - | if (err) { | |
| 809 | + | if (err) | |
| 820 | 810 | bpf_tramp_image_free(im); | |
| 821 | - | } else { | |
| 822 | - | /* track the image until it is freed, for bpf_trampoline_skip_prog() */ | |
| 823 | - | refcount_inc(&tr->refcnt); | |
| 824 | - | im->tr = tr; | |
| 825 | - | list_add(&im->list, &tr->images); | |
| 826 | - | } | |
| 827 | 811 | out: | |
| 828 | 812 | /* If any error happens, restore previous flags */ | |
| 829 | 813 | if (err) | |
| @@ -923,7 +907,6 @@ static int bpf_trampoline_add_prog(struct bpf_trampoline *tr, | |||
| 923 | 907 | } | |
| 924 | 908 | ||
| 925 | 909 | hlist_add_head(&node->tramp_hlist, prog_list); | |
| 926 | - | node->link->prog->aux->tramp_linked = true; | |
| 927 | 910 | if (kind == BPF_TRAMP_FSESSION) { | |
| 928 | 911 | tr->progs_cnt[BPF_TRAMP_FENTRY]++; | |
| 929 | 912 | fexit = fsession_exit(node); | |
| @@ -937,41 +920,6 @@ static int bpf_trampoline_add_prog(struct bpf_trampoline *tr, | |||
| 937 | 920 | return 0; | |
| 938 | 921 | } | |
| 939 | 922 | ||
| 940 | - | /* | |
| 941 | - | * Patch the nop in front of a prog call to a jump over it. A task can be | |
| 942 | - | * preempted anywhere in the image, so archs that need several instructions for | |
| 943 | - | * a jump of any range patch a single near branch here instead. | |
| 944 | - | */ | |
| 945 | - | int __weak arch_bpf_trampoline_skip(void *nop, void *target) | |
| 946 | - | { | |
| 947 | - | return bpf_arch_text_poke(nop, BPF_MOD_NOP, BPF_MOD_JUMP, NULL, target); | |
| 948 | - | } | |
| 949 | - | ||
| 950 | - | /* | |
| 951 | - | * prog was detached and can be freed, but tasks may still be running in images | |
| 952 | - | * that call it, sleeping in an earlier prog for example. They can be in any | |
| 953 | - | * image that is not freed yet, not only in cur_image, so patch all of them to | |
| 954 | - | * jump over prog. | |
| 955 | - | */ | |
| 956 | - | static void bpf_trampoline_skip_prog(struct bpf_trampoline *tr, struct bpf_prog *prog) | |
| 957 | - | { | |
| 958 | - | struct bpf_tramp_image *im; | |
| 959 | - | int i, err; | |
| 960 | - | ||
| 961 | - | list_for_each_entry(im, &tr->images, list) { | |
| 962 | - | for (i = 0; i < im->nr_skips; i++) { | |
| 963 | - | struct bpf_tramp_skip *skip = &im->skips[i]; | |
| 964 | - | ||
| 965 | - | if (skip->prog != prog) | |
| 966 | - | continue; | |
| 967 | - | err = arch_bpf_trampoline_skip(skip->nop, skip->target); | |
| 968 | - | WARN_ON_ONCE(err); | |
| 969 | - | /* not a nop anymore, and prog's address can be reused */ | |
| 970 | - | skip->prog = NULL; | |
| 971 | - | } | |
| 972 | - | } | |
| 973 | - | } | |
| 974 | - | ||
| 975 | 923 | static void bpf_trampoline_remove_prog(struct bpf_trampoline *tr, | |
| 976 | 924 | struct bpf_tramp_node *node) | |
| 977 | 925 | { | |
| @@ -989,7 +937,6 @@ static void bpf_trampoline_remove_prog(struct bpf_trampoline *tr, | |||
| 989 | 937 | } | |
| 990 | 938 | hlist_del_init(&node->tramp_hlist); | |
| 991 | 939 | tr->progs_cnt[kind]--; | |
| 992 | - | bpf_trampoline_skip_prog(tr, node->link->prog); | |
| 993 | 940 | } | |
| 994 | 941 | ||
| 995 | 942 | static int __bpf_trampoline_link_prog(struct bpf_tramp_node *node, | |
| @@ -1298,9 +1245,11 @@ void bpf_trampoline_put(struct bpf_trampoline *tr) | |||
| 1298 | 1245 | if (WARN_ON_ONCE(!hlist_empty(&tr->progs_hlist[i]))) | |
| 1299 | 1246 | goto out; | |
| 1300 | 1247 | ||
| 1301 | - | /* | |
| 1302 | - | * All progs are detached and the last image has been freed, images | |
| 1303 | - | * hold a reference on the trampoline until then. | |
| 1248 | + | /* This code will be executed even when the last bpf_tramp_image | |
| 1249 | + | * is alive. All progs are detached from the trampoline and the | |
| 1250 | + | * trampoline image is patched with jmp into epilogue to skip | |
| 1251 | + | * fexit progs. The fentry-only trampoline will be freed via | |
| 1252 | + | * multiple rcu callbacks. | |
| 1304 | 1253 | */ | |
| 1305 | 1254 | hlist_del(&tr->hlist_key); | |
| 1306 | 1255 | hlist_del(&tr->hlist_ip); | |
modified kernel/bpf/verifier.c
| @@ -14826,15 +14826,7 @@ static int adjust_ptr_min_max_vals(struct bpf_verifier_env *env, struct bpf_insn | |||
| 14826 | 14826 | "Tighten the scalar bounds before the arithmetic so the resulting pointer remains within the allowed range."); | |
| 14827 | 14827 | return -EINVAL; | |
| 14828 | 14828 | } | |
| 14829 | - | /* | |
| 14830 | - | * A packet pointer that keeps its id or range is checked against a | |
| 14831 | - | * range set from the checked pointer's umax, so var_off must not tighten | |
| 14832 | - | * its umax. r32 must still match var_off for reg_bounds_sanity_check(). | |
| 14833 | - | */ | |
| 14834 | - | if (reg_is_pkt_pointer(dst_reg) && (known || dst_reg->range > 0)) | |
| 14835 | - | __update_reg32_bounds(dst_reg); | |
| 14836 | - | else | |
| 14837 | - | reg_bounds_sync(dst_reg); | |
| 14829 | + | reg_bounds_sync(dst_reg); | |
| 14838 | 14830 | bounds_ret = sanitize_check_bounds(env, insn, dst_reg); | |
| 14839 | 14831 | if (bounds_ret == -EACCES) | |
| 14840 | 14832 | return bounds_ret; | |
modified kernel/cgroup/cpuset.c
| @@ -152,12 +152,6 @@ static cpumask_var_t isolated_cpus; /* CSCB */ | |||
| 152 | 152 | */ | |
| 153 | 153 | static bool update_housekeeping; /* RWCS */ | |
| 154 | 154 | ||
| 155 | - | /* | |
| 156 | - | * Set if "cpuset_v2_mode" mount option is used | |
| 157 | - | * Cached at bind time and not lock protected; accessed via {READ,WRITE}_ONCE | |
| 158 | - | */ | |
| 159 | - | static bool cpuset_v2_mode; | |
| 160 | - | ||
| 161 | 155 | /* | |
| 162 | 156 | * Copy of isolated_cpus to be passed to housekeeping_update() | |
| 163 | 157 | */ | |
| @@ -445,7 +439,8 @@ static inline bool cpuset_v2(void) | |||
| 445 | 439 | */ | |
| 446 | 440 | static inline bool is_in_v2_mode(void) | |
| 447 | 441 | { | |
| 448 | - | return cpuset_v2() || READ_ONCE(cpuset_v2_mode); | |
| 442 | + | return cpuset_v2() || | |
| 443 | + | (cpuset_cgrp_subsys.root->flags & CGRP_ROOT_CPUSET_V2_MODE); | |
| 449 | 444 | } | |
| 450 | 445 | ||
| 451 | 446 | /** | |
| @@ -518,26 +513,10 @@ static void guarantee_active_cpus(struct task_struct *tsk, | |||
| 518 | 513 | rcu_read_lock(); | |
| 519 | 514 | cs = task_cs(tsk); | |
| 520 | 515 | ||
| 521 | - | while (!cpumask_intersects(cs->effective_cpus, pmask)) { | |
| 516 | + | while (!cpumask_intersects(cs->effective_cpus, pmask)) | |
| 522 | 517 | cs = parent_cs(cs); | |
| 523 | - | if (unlikely(!cs)) { | |
| 524 | - | /* | |
| 525 | - | * The top cpuset doesn't have any active cpu as a | |
| 526 | - | * consequence of a race between its caller and the cpu | |
| 527 | - | * hotplug operation where cpu_active_mask is updated | |
| 528 | - | * asynchronously before cpuset_handle_hotplug() is | |
| 529 | - | * being called to adjust the effective_cpus of the | |
| 530 | - | * affected cpusets. But we know the top cpuset's | |
| 531 | - | * effective_cpus is on its way to be identical to | |
| 532 | - | * cpu_active_mask minus the exclusive CPUs dedicated | |
| 533 | - | * to other valid cpuset partitions. Just pass back | |
| 534 | - | * the filtered cpu_active_mask in this case. | |
| 535 | - | */ | |
| 536 | - | goto out_unlock; | |
| 537 | - | } | |
| 538 | - | } | |
| 518 | + | ||
| 539 | 519 | cpumask_and(pmask, pmask, cs->effective_cpus); | |
| 540 | - | out_unlock: | |
| 541 | 520 | rcu_read_unlock(); | |
| 542 | 521 | } | |
| 543 | 522 | ||
| @@ -3753,8 +3732,6 @@ static void cpuset_bind(struct cgroup_subsys_state *root_css) | |||
| 3753 | 3732 | mutex_lock(&cpuset_mutex); | |
| 3754 | 3733 | spin_lock_irq(&callback_lock); | |
| 3755 | 3734 | ||
| 3756 | - | WRITE_ONCE(cpuset_v2_mode, | |
| 3757 | - | !!(cpuset_cgrp_subsys.root->flags & CGRP_ROOT_CPUSET_V2_MODE)); | |
| 3758 | 3735 | if (is_in_v2_mode()) { | |
| 3759 | 3736 | cpumask_copy(top_cpuset.cpus_allowed, cpu_possible_mask); | |
| 3760 | 3737 | cpumask_copy(top_cpuset.effective_xcpus, cpu_possible_mask); | |
| @@ -4067,16 +4044,15 @@ static void cpuset_handle_hotplug(void) | |||
| 4067 | 4044 | static cpumask_t new_cpus; | |
| 4068 | 4045 | static nodemask_t new_mems; | |
| 4069 | 4046 | bool cpus_updated, mems_updated; | |
| 4070 | - | bool on_dfl; | |
| 4047 | + | bool on_dfl = is_in_v2_mode(); | |
| 4071 | 4048 | struct tmpmasks tmp, *ptmp = NULL; | |
| 4072 | 4049 | ||
| 4073 | - | lockdep_assert_cpus_held(); | |
| 4074 | - | mutex_lock(&cpuset_mutex); | |
| 4075 | - | ||
| 4076 | - | on_dfl = is_in_v2_mode(); | |
| 4077 | 4050 | if (on_dfl && !alloc_tmpmasks(&tmp)) | |
| 4078 | 4051 | ptmp = &tmp; | |
| 4079 | 4052 | ||
| 4053 | + | lockdep_assert_cpus_held(); | |
| 4054 | + | mutex_lock(&cpuset_mutex); | |
| 4055 | + | ||
| 4080 | 4056 | /* fetch the available cpus/mems and find out which changed how */ | |
| 4081 | 4057 | cpumask_copy(&new_cpus, cpu_active_mask); | |
| 4082 | 4058 | new_mems = node_states[N_MEMORY]; | |
modified kernel/dma/swiotlb.c
| @@ -1844,10 +1844,10 @@ phys_addr_t default_swiotlb_base(void) | |||
| 1844 | 1844 | phys_addr_t default_swiotlb_limit(void) | |
| 1845 | 1845 | { | |
| 1846 | 1846 | #ifdef CONFIG_SWIOTLB_DYNAMIC | |
| 1847 | - | if (io_tlb_default_mem.can_grow) | |
| 1848 | - | return io_tlb_default_mem.phys_limit; | |
| 1849 | - | #endif | |
| 1847 | + | return io_tlb_default_mem.phys_limit; | |
| 1848 | + | #else | |
| 1850 | 1849 | return io_tlb_default_mem.defpool.end - 1; | |
| 1850 | + | #endif | |
| 1851 | 1851 | } | |
| 1852 | 1852 | ||
| 1853 | 1853 | #ifdef CONFIG_DEBUG_FS | |
modified kernel/events/core.c
| @@ -7626,11 +7626,9 @@ static void perf_sigtrap(struct perf_event *event) | |||
| 7626 | 7626 | { | |
| 7627 | 7627 | /* | |
| 7628 | 7628 | * Both perf_pending_task() and perf_pending_irq() can race with the | |
| 7629 | - | * task exiting or exec-ing. We can determine if such a race has | |
| 7630 | - | * occurred by checking if perf_event_exit_task(), which will set | |
| 7631 | - | * ctx->task to TASK_TOMBSTONE, has already been called. | |
| 7629 | + | * task exiting. | |
| 7632 | 7630 | */ | |
| 7633 | - | if (event->ctx->task == TASK_TOMBSTONE) | |
| 7631 | + | if (current->flags & PF_EXITING) | |
| 7634 | 7632 | return; | |
| 7635 | 7633 | ||
| 7636 | 7634 | /* | |
| @@ -8131,15 +8129,10 @@ static void __perf_event_header__init_id(struct perf_sample_data *data, | |||
| 8131 | 8129 | } | |
| 8132 | 8130 | } | |
| 8133 | 8131 | ||
| 8134 | - | void perf_event_header__init(struct perf_event_header *header, | |
| 8135 | - | struct perf_sample_data *data, | |
| 8136 | - | u32 type, u16 misc, u16 size, | |
| 8137 | - | struct perf_event *event) | |
| 8132 | + | void perf_event_header__init_id(struct perf_event_header *header, | |
| 8133 | + | struct perf_sample_data *data, | |
| 8134 | + | struct perf_event *event) | |
| 8138 | 8135 | { | |
| 8139 | - | header->type = type; | |
| 8140 | - | header->misc = misc; | |
| 8141 | - | header->size = size; | |
| 8142 | - | ||
| 8143 | 8136 | if (event->attr.sample_id_all) { | |
| 8144 | 8137 | header->size += event->id_header_size; | |
| 8145 | 8138 | __perf_event_header__init_id(data, event, event->attr.sample_type); | |
| @@ -8976,16 +8969,17 @@ perf_event_read_event(struct perf_event *event, | |||
| 8976 | 8969 | struct perf_output_handle handle; | |
| 8977 | 8970 | struct perf_sample_data sample; | |
| 8978 | 8971 | struct perf_read_event read_event = { | |
| 8972 | + | .header = { | |
| 8973 | + | .type = PERF_RECORD_READ, | |
| 8974 | + | .misc = 0, | |
| 8975 | + | .size = sizeof(read_event) + event->read_size, | |
| 8976 | + | }, | |
| 8979 | 8977 | .pid = perf_event_pid(event, task), | |
| 8980 | 8978 | .tid = perf_event_tid(event, task), | |
| 8981 | 8979 | }; | |
| 8982 | 8980 | int ret; | |
| 8983 | 8981 | ||
| 8984 | - | perf_event_header__init(&read_event.header, &sample, | |
| 8985 | - | PERF_RECORD_READ, | |
| 8986 | - | /* misc= */ 0, | |
| 8987 | - | sizeof(read_event) + event->read_size, | |
| 8988 | - | event); | |
| 8982 | + | perf_event_header__init_id(&read_event.header, &sample, event); | |
| 8989 | 8983 | ret = perf_output_begin(&handle, &sample, event, read_event.header.size); | |
| 8990 | 8984 | if (ret) | |
| 8991 | 8985 | return; | |
| @@ -9226,7 +9220,6 @@ struct perf_task_event { | |||
| 9226 | 9220 | u32 ptid; | |
| 9227 | 9221 | u64 time; | |
| 9228 | 9222 | } event_id; | |
| 9229 | - | int new; | |
| 9230 | 9223 | }; | |
| 9231 | 9224 | ||
| 9232 | 9225 | static int perf_event_task_match(struct perf_event *event) | |
| @@ -9243,21 +9236,17 @@ static void perf_event_task_output(struct perf_event *event, | |||
| 9243 | 9236 | struct perf_output_handle handle; | |
| 9244 | 9237 | struct perf_sample_data sample; | |
| 9245 | 9238 | struct task_struct *task = task_event->task; | |
| 9246 | - | int ret; | |
| 9239 | + | int ret, size = task_event->event_id.header.size; | |
| 9247 | 9240 | ||
| 9248 | 9241 | if (!perf_event_task_match(event)) | |
| 9249 | 9242 | return; | |
| 9250 | 9243 | ||
| 9251 | - | perf_event_header__init(&task_event->event_id.header, &sample, | |
| 9252 | - | task_event->new ? PERF_RECORD_FORK : PERF_RECORD_EXIT, | |
| 9253 | - | /* misc= */ 0, | |
| 9254 | - | sizeof(task_event->event_id), | |
| 9255 | - | event); | |
| 9244 | + | perf_event_header__init_id(&task_event->event_id.header, &sample, event); | |
| 9256 | 9245 | ||
| 9257 | 9246 | ret = perf_output_begin(&handle, &sample, event, | |
| 9258 | 9247 | task_event->event_id.header.size); | |
| 9259 | 9248 | if (ret) | |
| 9260 | - | return; | |
| 9249 | + | goto out; | |
| 9261 | 9250 | ||
| 9262 | 9251 | task_event->event_id.pid = perf_event_pid(event, task); | |
| 9263 | 9252 | task_event->event_id.tid = perf_event_tid(event, task); | |
| @@ -9279,6 +9268,8 @@ static void perf_event_task_output(struct perf_event *event, | |||
| 9279 | 9268 | perf_event__output_id_sample(event, &handle, &sample); | |
| 9280 | 9269 | ||
| 9281 | 9270 | perf_output_end(&handle); | |
| 9271 | + | out: | |
| 9272 | + | task_event->event_id.header.size = size; | |
| 9282 | 9273 | } | |
| 9283 | 9274 | ||
| 9284 | 9275 | static void perf_event_task(struct task_struct *task, | |
| @@ -9295,7 +9286,18 @@ static void perf_event_task(struct task_struct *task, | |||
| 9295 | 9286 | task_event = (struct perf_task_event){ | |
| 9296 | 9287 | .task = task, | |
| 9297 | 9288 | .task_ctx = task_ctx, | |
| 9298 | - | .new = new, | |
| 9289 | + | .event_id = { | |
| 9290 | + | .header = { | |
| 9291 | + | .type = new ? PERF_RECORD_FORK : PERF_RECORD_EXIT, | |
| 9292 | + | .misc = 0, | |
| 9293 | + | .size = sizeof(task_event.event_id), | |
| 9294 | + | }, | |
| 9295 | + | /* .pid */ | |
| 9296 | + | /* .ppid */ | |
| 9297 | + | /* .tid */ | |
| 9298 | + | /* .ptid */ | |
| 9299 | + | /* .time */ | |
| 9300 | + | }, | |
| 9299 | 9301 | }; | |
| 9300 | 9302 | ||
| 9301 | 9303 | perf_iterate_sb(perf_event_task_output, | |
| @@ -9372,7 +9374,6 @@ struct perf_comm_event { | |||
| 9372 | 9374 | u32 pid; | |
| 9373 | 9375 | u32 tid; | |
| 9374 | 9376 | } event_id; | |
| 9375 | - | bool exec; | |
| 9376 | 9377 | }; | |
| 9377 | 9378 | ||
| 9378 | 9379 | static int perf_event_comm_match(struct perf_event *event) | |
| @@ -9386,21 +9387,18 @@ static void perf_event_comm_output(struct perf_event *event, | |||
| 9386 | 9387 | struct perf_comm_event *comm_event = data; | |
| 9387 | 9388 | struct perf_output_handle handle; | |
| 9388 | 9389 | struct perf_sample_data sample; | |
| 9390 | + | int size = comm_event->event_id.header.size; | |
| 9389 | 9391 | int ret; | |
| 9390 | 9392 | ||
| 9391 | 9393 | if (!perf_event_comm_match(event)) | |
| 9392 | 9394 | return; | |
| 9393 | 9395 | ||
| 9394 | - | perf_event_header__init(&comm_event->event_id.header, &sample, | |
| 9395 | - | PERF_RECORD_COMM, | |
| 9396 | - | comm_event->exec ? PERF_RECORD_MISC_COMM_EXEC : 0, | |
| 9397 | - | sizeof(comm_event->event_id) + comm_event->comm_size, | |
| 9398 | - | event); | |
| 9396 | + | perf_event_header__init_id(&comm_event->event_id.header, &sample, event); | |
| 9399 | 9397 | ret = perf_output_begin(&handle, &sample, event, | |
| 9400 | 9398 | comm_event->event_id.header.size); | |
| 9401 | 9399 | ||
| 9402 | 9400 | if (ret) | |
| 9403 | - | return; | |
| 9401 | + | goto out; | |
| 9404 | 9402 | ||
| 9405 | 9403 | comm_event->event_id.pid = perf_event_pid(event, comm_event->task); | |
| 9406 | 9404 | comm_event->event_id.tid = perf_event_tid(event, comm_event->task); | |
| @@ -9412,6 +9410,8 @@ static void perf_event_comm_output(struct perf_event *event, | |||
| 9412 | 9410 | perf_event__output_id_sample(event, &handle, &sample); | |
| 9413 | 9411 | ||
| 9414 | 9412 | perf_output_end(&handle); | |
| 9413 | + | out: | |
| 9414 | + | comm_event->event_id.header.size = size; | |
| 9415 | 9415 | } | |
| 9416 | 9416 | ||
| 9417 | 9417 | static void perf_event_comm_event(struct perf_comm_event *comm_event) | |
| @@ -9426,6 +9426,8 @@ static void perf_event_comm_event(struct perf_comm_event *comm_event) | |||
| 9426 | 9426 | comm_event->comm = comm; | |
| 9427 | 9427 | comm_event->comm_size = size; | |
| 9428 | 9428 | ||
| 9429 | + | comm_event->event_id.header.size = sizeof(comm_event->event_id) + size; | |
| 9430 | + | ||
| 9429 | 9431 | perf_iterate_sb(perf_event_comm_output, | |
| 9430 | 9432 | comm_event, | |
| 9431 | 9433 | NULL); | |
| @@ -9442,8 +9444,15 @@ void perf_event_comm(struct task_struct *task, bool exec) | |||
| 9442 | 9444 | .task = task, | |
| 9443 | 9445 | /* .comm */ | |
| 9444 | 9446 | /* .comm_size */ | |
| 9445 | - | /* .event_id */ | |
| 9446 | - | .exec = exec, | |
| 9447 | + | .event_id = { | |
| 9448 | + | .header = { | |
| 9449 | + | .type = PERF_RECORD_COMM, | |
| 9450 | + | .misc = exec ? PERF_RECORD_MISC_COMM_EXEC : 0, | |
| 9451 | + | /* .size */ | |
| 9452 | + | }, | |
| 9453 | + | /* .pid */ | |
| 9454 | + | /* .tid */ | |
| 9455 | + | }, | |
| 9447 | 9456 | }; | |
| 9448 | 9457 | ||
| 9449 | 9458 | perf_event_comm_event(&comm_event); | |
| @@ -9477,20 +9486,18 @@ static void perf_event_namespaces_output(struct perf_event *event, | |||
| 9477 | 9486 | struct perf_namespaces_event *namespaces_event = data; | |
| 9478 | 9487 | struct perf_output_handle handle; | |
| 9479 | 9488 | struct perf_sample_data sample; | |
| 9489 | + | u16 header_size = namespaces_event->event_id.header.size; | |
| 9480 | 9490 | int ret; | |
| 9481 | 9491 | ||
| 9482 | 9492 | if (!perf_event_namespaces_match(event)) | |
| 9483 | 9493 | return; | |
| 9484 | 9494 | ||
| 9485 | - | perf_event_header__init(&namespaces_event->event_id.header, &sample, | |
| 9486 | - | PERF_RECORD_NAMESPACES, | |
| 9487 | - | /* misc= */ 0, | |
| 9488 | - | sizeof(namespaces_event->event_id), | |
| 9489 | - | event); | |
| 9495 | + | perf_event_header__init_id(&namespaces_event->event_id.header, | |
| 9496 | + | &sample, event); | |
| 9490 | 9497 | ret = perf_output_begin(&handle, &sample, event, | |
| 9491 | 9498 | namespaces_event->event_id.header.size); | |
| 9492 | 9499 | if (ret) | |
| 9493 | - | return; | |
| 9500 | + | goto out; | |
| 9494 | 9501 | ||
| 9495 | 9502 | namespaces_event->event_id.pid = perf_event_pid(event, | |
| 9496 | 9503 | namespaces_event->task); | |
| @@ -9502,6 +9509,8 @@ static void perf_event_namespaces_output(struct perf_event *event, | |||
| 9502 | 9509 | perf_event__output_id_sample(event, &handle, &sample); | |
| 9503 | 9510 | ||
| 9504 | 9511 | perf_output_end(&handle); | |
| 9512 | + | out: | |
| 9513 | + | namespaces_event->event_id.header.size = header_size; | |
| 9505 | 9514 | } | |
| 9506 | 9515 | ||
| 9507 | 9516 | static void perf_fill_ns_link_info(struct perf_ns_link_info *ns_link_info, | |
| @@ -9532,7 +9541,11 @@ void perf_event_namespaces(struct task_struct *task) | |||
| 9532 | 9541 | namespaces_event = (struct perf_namespaces_event){ | |
| 9533 | 9542 | .task = task, | |
| 9534 | 9543 | .event_id = { | |
| 9535 | - | /* .header */ | |
| 9544 | + | .header = { | |
| 9545 | + | .type = PERF_RECORD_NAMESPACES, | |
| 9546 | + | .misc = 0, | |
| 9547 | + | .size = sizeof(namespaces_event.event_id), | |
| 9548 | + | }, | |
| 9536 | 9549 | /* .pid */ | |
| 9537 | 9550 | /* .tid */ | |
| 9538 | 9551 | .nr_namespaces = NR_NAMESPACES, | |
| @@ -9600,19 +9613,18 @@ static void perf_event_cgroup_output(struct perf_event *event, void *data) | |||
| 9600 | 9613 | struct perf_cgroup_event *cgroup_event = data; | |
| 9601 | 9614 | struct perf_output_handle handle; | |
| 9602 | 9615 | struct perf_sample_data sample; | |
| 9616 | + | u16 header_size = cgroup_event->event_id.header.size; | |
| 9603 | 9617 | int ret; | |
| 9604 | - | u16 size = sizeof(cgroup_event->event_id) + cgroup_event->path_size; | |
| 9605 | 9618 | ||
| 9606 | 9619 | if (!perf_event_cgroup_match(event)) | |
| 9607 | 9620 | return; | |
| 9608 | 9621 | ||
| 9609 | - | perf_event_header__init(&cgroup_event->event_id.header, &sample, | |
| 9610 | - | PERF_RECORD_CGROUP, /* misc= */ 0, size, | |
| 9611 | - | event); | |
| 9622 | + | perf_event_header__init_id(&cgroup_event->event_id.header, | |
| 9623 | + | &sample, event); | |
| 9612 | 9624 | ret = perf_output_begin(&handle, &sample, event, | |
| 9613 | 9625 | cgroup_event->event_id.header.size); | |
| 9614 | 9626 | if (ret) | |
| 9615 | - | return; | |
| 9627 | + | goto out; | |
| 9616 | 9628 | ||
| 9617 | 9629 | perf_output_put(&handle, cgroup_event->event_id); | |
| 9618 | 9630 | __output_copy(&handle, cgroup_event->path, cgroup_event->path_size); | |
| @@ -9620,6 +9632,8 @@ static void perf_event_cgroup_output(struct perf_event *event, void *data) | |||
| 9620 | 9632 | perf_event__output_id_sample(event, &handle, &sample); | |
| 9621 | 9633 | ||
| 9622 | 9634 | perf_output_end(&handle); | |
| 9635 | + | out: | |
| 9636 | + | cgroup_event->event_id.header.size = header_size; | |
| 9623 | 9637 | } | |
| 9624 | 9638 | ||
| 9625 | 9639 | static void perf_event_cgroup(struct cgroup *cgrp) | |
| @@ -9634,6 +9648,11 @@ static void perf_event_cgroup(struct cgroup *cgrp) | |||
| 9634 | 9648 | ||
| 9635 | 9649 | cgroup_event = (struct perf_cgroup_event){ | |
| 9636 | 9650 | .event_id = { | |
| 9651 | + | .header = { | |
| 9652 | + | .type = PERF_RECORD_CGROUP, | |
| 9653 | + | .misc = 0, | |
| 9654 | + | .size = sizeof(cgroup_event.event_id), | |
| 9655 | + | }, | |
| 9637 | 9656 | .id = cgroup_id(cgrp), | |
| 9638 | 9657 | }, | |
| 9639 | 9658 | }; | |
| @@ -9656,6 +9675,7 @@ static void perf_event_cgroup(struct cgroup *cgrp) | |||
| 9656 | 9675 | while (!IS_ALIGNED(size, sizeof(u64))) | |
| 9657 | 9676 | cgroup_event.path[size++] = '\0'; | |
| 9658 | 9677 | ||
| 9678 | + | cgroup_event.event_id.header.size += size; | |
| 9659 | 9679 | cgroup_event.path_size = size; | |
| 9660 | 9680 | ||
| 9661 | 9681 | perf_iterate_sb(perf_event_cgroup_output, | |
| @@ -9711,40 +9731,38 @@ static void perf_event_mmap_output(struct perf_event *event, | |||
| 9711 | 9731 | struct perf_mmap_event *mmap_event = data; | |
| 9712 | 9732 | struct perf_output_handle handle; | |
| 9713 | 9733 | struct perf_sample_data sample; | |
| 9714 | - | int size = sizeof(mmap_event->event_id) + mmap_event->file_size; | |
| 9715 | - | u32 type = PERF_RECORD_MMAP; | |
| 9716 | - | u16 misc = PERF_RECORD_MISC_USER; | |
| 9717 | - | bool use_build_id = false; | |
| 9734 | + | int size = mmap_event->event_id.header.size; | |
| 9735 | + | u32 type = mmap_event->event_id.header.type; | |
| 9736 | + | bool use_build_id; | |
| 9718 | 9737 | int ret; | |
| 9719 | 9738 | ||
| 9720 | 9739 | if (!perf_event_mmap_match(event, data)) | |
| 9721 | 9740 | return; | |
| 9722 | 9741 | ||
| 9723 | 9742 | if (event->attr.mmap2) { | |
| 9724 | - | type = PERF_RECORD_MMAP2; | |
| 9725 | - | size += sizeof(mmap_event->maj); | |
| 9726 | - | size += sizeof(mmap_event->min); | |
| 9727 | - | size += sizeof(mmap_event->ino); | |
| 9728 | - | size += sizeof(mmap_event->ino_generation); | |
| 9729 | - | size += sizeof(mmap_event->prot); | |
| 9730 | - | size += sizeof(mmap_event->flags); | |
| 9731 | - | use_build_id = event->attr.build_id && mmap_event->build_id_size; | |
| 9732 | - | if (use_build_id) | |
| 9733 | - | misc |= PERF_RECORD_MISC_MMAP_BUILD_ID; | |
| 9734 | - | } | |
| 9735 | - | if (!(mmap_event->vma->vm_flags & VM_EXEC)) | |
| 9736 | - | misc |= PERF_RECORD_MISC_MMAP_DATA; | |
| 9737 | - | ||
| 9738 | - | perf_event_header__init(&mmap_event->event_id.header, &sample, | |
| 9739 | - | type, misc, size, event); | |
| 9743 | + | mmap_event->event_id.header.type = PERF_RECORD_MMAP2; | |
| 9744 | + | mmap_event->event_id.header.size += sizeof(mmap_event->maj); | |
| 9745 | + | mmap_event->event_id.header.size += sizeof(mmap_event->min); | |
| 9746 | + | mmap_event->event_id.header.size += sizeof(mmap_event->ino); | |
| 9747 | + | mmap_event->event_id.header.size += sizeof(mmap_event->ino_generation); | |
| 9748 | + | mmap_event->event_id.header.size += sizeof(mmap_event->prot); | |
| 9749 | + | mmap_event->event_id.header.size += sizeof(mmap_event->flags); | |
| 9750 | + | } | |
| 9751 | + | ||
| 9752 | + | perf_event_header__init_id(&mmap_event->event_id.header, &sample, event); | |
| 9740 | 9753 | ret = perf_output_begin(&handle, &sample, event, | |
| 9741 | 9754 | mmap_event->event_id.header.size); | |
| 9742 | 9755 | if (ret) | |
| 9743 | - | return; | |
| 9756 | + | goto out; | |
| 9744 | 9757 | ||
| 9745 | 9758 | mmap_event->event_id.pid = perf_event_pid(event, current); | |
| 9746 | 9759 | mmap_event->event_id.tid = perf_event_tid(event, current); | |
| 9747 | 9760 | ||
| 9761 | + | use_build_id = event->attr.build_id && mmap_event->build_id_size; | |
| 9762 | + | ||
| 9763 | + | if (event->attr.mmap2 && use_build_id) | |
| 9764 | + | mmap_event->event_id.header.misc |= PERF_RECORD_MISC_MMAP_BUILD_ID; | |
| 9765 | + | ||
| 9748 | 9766 | perf_output_put(&handle, mmap_event->event_id); | |
| 9749 | 9767 | ||
| 9750 | 9768 | if (event->attr.mmap2) { | |
| @@ -9769,6 +9787,9 @@ static void perf_event_mmap_output(struct perf_event *event, | |||
| 9769 | 9787 | perf_event__output_id_sample(event, &handle, &sample); | |
| 9770 | 9788 | ||
| 9771 | 9789 | perf_output_end(&handle); | |
| 9790 | + | out: | |
| 9791 | + | mmap_event->event_id.header.size = size; | |
| 9792 | + | mmap_event->event_id.header.type = type; | |
| 9772 | 9793 | } | |
| 9773 | 9794 | ||
| 9774 | 9795 | static void perf_event_mmap_event(struct perf_mmap_event *mmap_event) | |
| @@ -9864,6 +9885,11 @@ got_name: | |||
| 9864 | 9885 | mmap_event->prot = prot; | |
| 9865 | 9886 | mmap_event->flags = flags; | |
| 9866 | 9887 | ||
| 9888 | + | if (!(vma->vm_flags & VM_EXEC)) | |
| 9889 | + | mmap_event->event_id.header.misc |= PERF_RECORD_MISC_MMAP_DATA; | |
| 9890 | + | ||
| 9891 | + | mmap_event->event_id.header.size = sizeof(mmap_event->event_id) + size; | |
| 9892 | + | ||
| 9867 | 9893 | if (atomic_read(&nr_build_id_events)) | |
| 9868 | 9894 | build_id_parse_nofault(vma, mmap_event->build_id, &mmap_event->build_id_size); | |
| 9869 | 9895 | ||
| @@ -9983,7 +10009,11 @@ void perf_event_mmap(struct vm_area_struct *vma) | |||
| 9983 | 10009 | /* .file_name */ | |
| 9984 | 10010 | /* .file_size */ | |
| 9985 | 10011 | .event_id = { | |
| 9986 | - | /* .header */ | |
| 10012 | + | .header = { | |
| 10013 | + | .type = PERF_RECORD_MMAP, | |
| 10014 | + | .misc = PERF_RECORD_MISC_USER, | |
| 10015 | + | /* .size */ | |
| 10016 | + | }, | |
| 9987 | 10017 | /* .pid */ | |
| 9988 | 10018 | /* .tid */ | |
| 9989 | 10019 | .start = vma->vm_start, | |
| @@ -10013,15 +10043,18 @@ void perf_event_aux_event(struct perf_event *event, unsigned long head, | |||
| 10013 | 10043 | u64 size; | |
| 10014 | 10044 | u64 flags; | |
| 10015 | 10045 | } rec = { | |
| 10046 | + | .header = { | |
| 10047 | + | .type = PERF_RECORD_AUX, | |
| 10048 | + | .misc = 0, | |
| 10049 | + | .size = sizeof(rec), | |
| 10050 | + | }, | |
| 10016 | 10051 | .offset = head, | |
| 10017 | 10052 | .size = size, | |
| 10018 | 10053 | .flags = flags, | |
| 10019 | 10054 | }; | |
| 10020 | 10055 | int ret; | |
| 10021 | 10056 | ||
| 10022 | - | perf_event_header__init(&rec.header, &sample, | |
| 10023 | - | PERF_RECORD_AUX, /* misc= */ 0, sizeof(rec), | |
| 10024 | - | event); | |
| 10057 | + | perf_event_header__init_id(&rec.header, &sample, event); | |
| 10025 | 10058 | ret = perf_output_begin(&handle, &sample, event, rec.header.size); | |
| 10026 | 10059 | ||
| 10027 | 10060 | if (ret) | |
| @@ -10046,14 +10079,15 @@ void perf_log_lost_samples(struct perf_event *event, u64 lost) | |||
| 10046 | 10079 | struct perf_event_header header; | |
| 10047 | 10080 | u64 lost; | |
| 10048 | 10081 | } lost_samples_event = { | |
| 10082 | + | .header = { | |
| 10083 | + | .type = PERF_RECORD_LOST_SAMPLES, | |
| 10084 | + | .misc = 0, | |
| 10085 | + | .size = sizeof(lost_samples_event), | |
| 10086 | + | }, | |
| 10049 | 10087 | .lost = lost, | |
| 10050 | 10088 | }; | |
| 10051 | 10089 | ||
| 10052 | - | perf_event_header__init(&lost_samples_event.header, &sample, | |
| 10053 | - | PERF_RECORD_LOST_SAMPLES, | |
| 10054 | - | /* misc= */ 0, | |
| 10055 | - | sizeof(lost_samples_event), | |
| 10056 | - | event); | |
| 10090 | + | perf_event_header__init_id(&lost_samples_event.header, &sample, event); | |
| 10057 | 10091 | ||
| 10058 | 10092 | ret = perf_output_begin(&handle, &sample, event, | |
| 10059 | 10093 | lost_samples_event.header.size); | |
| @@ -10078,8 +10112,6 @@ struct perf_switch_event { | |||
| 10078 | 10112 | u32 next_prev_pid; | |
| 10079 | 10113 | u32 next_prev_tid; | |
| 10080 | 10114 | } event_id; | |
| 10081 | - | bool sched_in; | |
| 10082 | - | bool preempt; | |
| 10083 | 10115 | }; | |
| 10084 | 10116 | ||
| 10085 | 10117 | static int perf_event_switch_match(struct perf_event *event) | |
| @@ -10092,9 +10124,6 @@ static void perf_event_switch_output(struct perf_event *event, void *data) | |||
| 10092 | 10124 | struct perf_switch_event *se = data; | |
| 10093 | 10125 | struct perf_output_handle handle; | |
| 10094 | 10126 | struct perf_sample_data sample; | |
| 10095 | - | u32 type; | |
| 10096 | - | u16 misc; | |
| 10097 | - | u16 size; | |
| 10098 | 10127 | int ret; | |
| 10099 | 10128 | ||
| 10100 | 10129 | if (!perf_event_switch_match(event)) | |
| @@ -10102,22 +10131,18 @@ static void perf_event_switch_output(struct perf_event *event, void *data) | |||
| 10102 | 10131 | ||
| 10103 | 10132 | /* Only CPU-wide events are allowed to see next/prev pid/tid */ | |
| 10104 | 10133 | if (event->ctx->task) { | |
| 10105 | - | type = PERF_RECORD_SWITCH; | |
| 10106 | - | size = sizeof(se->event_id.header); | |
| 10134 | + | se->event_id.header.type = PERF_RECORD_SWITCH; | |
| 10135 | + | se->event_id.header.size = sizeof(se->event_id.header); | |
| 10107 | 10136 | } else { | |
| 10108 | - | type = PERF_RECORD_SWITCH_CPU_WIDE; | |
| 10109 | - | size = sizeof(se->event_id); | |
| 10137 | + | se->event_id.header.type = PERF_RECORD_SWITCH_CPU_WIDE; | |
| 10138 | + | se->event_id.header.size = sizeof(se->event_id); | |
| 10110 | 10139 | se->event_id.next_prev_pid = | |
| 10111 | 10140 | perf_event_pid(event, se->next_prev); | |
| 10112 | 10141 | se->event_id.next_prev_tid = | |
| 10113 | 10142 | perf_event_tid(event, se->next_prev); | |
| 10114 | 10143 | } | |
| 10115 | - | misc = se->sched_in ? 0 : PERF_RECORD_MISC_SWITCH_OUT; | |
| 10116 | - | if (se->preempt) | |
| 10117 | - | misc |= PERF_RECORD_MISC_SWITCH_OUT_PREEMPT; | |
| 10118 | 10144 | ||
| 10119 | - | perf_event_header__init(&se->event_id.header, &sample, | |
| 10120 | - | type, misc, size, event); | |
| 10145 | + | perf_event_header__init_id(&se->event_id.header, &sample, event); | |
| 10121 | 10146 | ||
| 10122 | 10147 | ret = perf_output_begin(&handle, &sample, event, se->event_id.header.size); | |
| 10123 | 10148 | if (ret) | |
| @@ -10143,11 +10168,22 @@ static void perf_event_switch(struct task_struct *task, | |||
| 10143 | 10168 | switch_event = (struct perf_switch_event){ | |
| 10144 | 10169 | .task = task, | |
| 10145 | 10170 | .next_prev = next_prev, | |
| 10146 | - | /* .event_id */ | |
| 10147 | - | .sched_in = sched_in, | |
| 10148 | - | .preempt = !sched_in && task_is_runnable(task), | |
| 10171 | + | .event_id = { | |
| 10172 | + | .header = { | |
| 10173 | + | /* .type */ | |
| 10174 | + | .misc = sched_in ? 0 : PERF_RECORD_MISC_SWITCH_OUT, | |
| 10175 | + | /* .size */ | |
| 10176 | + | }, | |
| 10177 | + | /* .next_prev_pid */ | |
| 10178 | + | /* .next_prev_tid */ | |
| 10179 | + | }, | |
| 10149 | 10180 | }; | |
| 10150 | 10181 | ||
| 10182 | + | if (!sched_in && task_is_runnable(task)) { | |
| 10183 | + | switch_event.event_id.header.misc |= | |
| 10184 | + | PERF_RECORD_MISC_SWITCH_OUT_PREEMPT; | |
| 10185 | + | } | |
| 10186 | + | ||
| 10151 | 10187 | perf_iterate_sb(perf_event_switch_output, &switch_event, NULL); | |
| 10152 | 10188 | } | |
| 10153 | 10189 | ||
| @@ -10167,17 +10203,20 @@ static void perf_log_throttle(struct perf_event *event, int enable) | |||
| 10167 | 10203 | u64 id; | |
| 10168 | 10204 | u64 stream_id; | |
| 10169 | 10205 | } throttle_event = { | |
| 10206 | + | .header = { | |
| 10207 | + | .type = PERF_RECORD_THROTTLE, | |
| 10208 | + | .misc = 0, | |
| 10209 | + | .size = sizeof(throttle_event), | |
| 10210 | + | }, | |
| 10170 | 10211 | .time = perf_event_clock(event), | |
| 10171 | 10212 | .id = primary_event_id(event), | |
| 10172 | 10213 | .stream_id = event->id, | |
| 10173 | 10214 | }; | |
| 10174 | 10215 | ||
| 10175 | - | perf_event_header__init(&throttle_event.header, &sample, | |
| 10176 | - | enable ? PERF_RECORD_UNTHROTTLE | |
| 10177 | - | : PERF_RECORD_THROTTLE, | |
| 10178 | - | /* misc= */ 0, | |
| 10179 | - | sizeof(throttle_event), | |
| 10180 | - | event); | |
| 10216 | + | if (enable) | |
| 10217 | + | throttle_event.header.type = PERF_RECORD_UNTHROTTLE; | |
| 10218 | + | ||
| 10219 | + | perf_event_header__init_id(&throttle_event.header, &sample, event); | |
| 10181 | 10220 | ||
| 10182 | 10221 | ret = perf_output_begin(&handle, &sample, event, | |
| 10183 | 10222 | throttle_event.header.size); | |
| @@ -10216,14 +10255,12 @@ static void perf_event_ksymbol_output(struct perf_event *event, void *data) | |||
| 10216 | 10255 | struct perf_output_handle handle; | |
| 10217 | 10256 | struct perf_sample_data sample; | |
| 10218 | 10257 | int ret; | |
| 10219 | - | u16 size = sizeof(ksymbol_event->event_id) + ksymbol_event->name_len; | |
| 10220 | 10258 | ||
| 10221 | 10259 | if (!perf_event_ksymbol_match(event)) | |
| 10222 | 10260 | return; | |
| 10223 | 10261 | ||
| 10224 | - | perf_event_header__init(&ksymbol_event->event_id.header, &sample, | |
| 10225 | - | PERF_RECORD_KSYMBOL, /* misc= */ 0, size, | |
| 10226 | - | event); | |
| 10262 | + | perf_event_header__init_id(&ksymbol_event->event_id.header, | |
| 10263 | + | &sample, event); | |
| 10227 | 10264 | ret = perf_output_begin(&handle, &sample, event, | |
| 10228 | 10265 | ksymbol_event->event_id.header.size); | |
| 10229 | 10266 | if (ret) | |
| @@ -10264,6 +10301,11 @@ void perf_event_ksymbol(u16 ksym_type, u64 addr, u32 len, bool unregister, | |||
| 10264 | 10301 | .name = name, | |
| 10265 | 10302 | .name_len = name_len, | |
| 10266 | 10303 | .event_id = { | |
| 10304 | + | .header = { | |
| 10305 | + | .type = PERF_RECORD_KSYMBOL, | |
| 10306 | + | .size = sizeof(ksymbol_event.event_id) + | |
| 10307 | + | name_len, | |
| 10308 | + | }, | |
| 10267 | 10309 | .addr = addr, | |
| 10268 | 10310 | .len = len, | |
| 10269 | 10311 | .ksym_type = ksym_type, | |
| @@ -10307,11 +10349,8 @@ static void perf_event_bpf_output(struct perf_event *event, void *data) | |||
| 10307 | 10349 | if (!perf_event_bpf_match(event)) | |
| 10308 | 10350 | return; | |
| 10309 | 10351 | ||
| 10310 | - | perf_event_header__init(&bpf_event->event_id.header, &sample, | |
| 10311 | - | PERF_RECORD_BPF_EVENT, | |
| 10312 | - | /* misc= */ 0, | |
| 10313 | - | sizeof(bpf_event->event_id), | |
| 10314 | - | event); | |
| 10352 | + | perf_event_header__init_id(&bpf_event->event_id.header, | |
| 10353 | + | &sample, event); | |
| 10315 | 10354 | ret = perf_output_begin(&handle, &sample, event, | |
| 10316 | 10355 | bpf_event->event_id.header.size); | |
| 10317 | 10356 | if (ret) | |
| @@ -10367,6 +10406,10 @@ void perf_event_bpf_event(struct bpf_prog *prog, | |||
| 10367 | 10406 | bpf_event = (struct perf_bpf_event){ | |
| 10368 | 10407 | .prog = prog, | |
| 10369 | 10408 | .event_id = { | |
| 10409 | + | .header = { | |
| 10410 | + | .type = PERF_RECORD_BPF_EVENT, | |
| 10411 | + | .size = sizeof(bpf_event.event_id), | |
| 10412 | + | }, | |
| 10370 | 10413 | .type = type, | |
| 10371 | 10414 | .flags = flags, | |
| 10372 | 10415 | .id = prog->aux->id, | |
| @@ -10394,23 +10437,18 @@ static void perf_callchain_deferred_output(struct perf_event *event, void *data) | |||
| 10394 | 10437 | struct perf_callchain_deferred_event *deferred_event = data; | |
| 10395 | 10438 | struct perf_output_handle handle; | |
| 10396 | 10439 | struct perf_sample_data sample; | |
| 10397 | - | int ret; | |
| 10398 | - | u16 size = sizeof(deferred_event->event) + (deferred_event->trace->nr * sizeof(u64)); | |
| 10440 | + | int ret, size = deferred_event->event.header.size; | |
| 10399 | 10441 | ||
| 10400 | 10442 | if (!event->attr.defer_output) | |
| 10401 | 10443 | return; | |
| 10402 | 10444 | ||
| 10403 | 10445 | /* XXX do we really need sample_id_all for this ??? */ | |
| 10404 | - | perf_event_header__init(&deferred_event->event.header, &sample, | |
| 10405 | - | PERF_RECORD_CALLCHAIN_DEFERRED, | |
| 10406 | - | PERF_RECORD_MISC_USER, | |
| 10407 | - | size, | |
| 10408 | - | event); | |
| 10446 | + | perf_event_header__init_id(&deferred_event->event.header, &sample, event); | |
| 10409 | 10447 | ||
| 10410 | 10448 | ret = perf_output_begin(&handle, &sample, event, | |
| 10411 | 10449 | deferred_event->event.header.size); | |
| 10412 | 10450 | if (ret) | |
| 10413 | - | return; | |
| 10451 | + | goto out; | |
| 10414 | 10452 | ||
| 10415 | 10453 | perf_output_put(&handle, deferred_event->event); | |
| 10416 | 10454 | for (int i = 0; i < deferred_event->trace->nr; i++) { | |
| @@ -10420,6 +10458,8 @@ static void perf_callchain_deferred_output(struct perf_event *event, void *data) | |||
| 10420 | 10458 | perf_event__output_id_sample(event, &handle, &sample); | |
| 10421 | 10459 | ||
| 10422 | 10460 | perf_output_end(&handle); | |
| 10461 | + | out: | |
| 10462 | + | deferred_event->event.header.size = size; | |
| 10423 | 10463 | } | |
| 10424 | 10464 | ||
| 10425 | 10465 | static void perf_unwind_deferred_callback(struct unwind_work *work, | |
| @@ -10428,6 +10468,12 @@ static void perf_unwind_deferred_callback(struct unwind_work *work, | |||
| 10428 | 10468 | struct perf_callchain_deferred_event deferred_event = { | |
| 10429 | 10469 | .trace = trace, | |
| 10430 | 10470 | .event = { | |
| 10471 | + | .header = { | |
| 10472 | + | .type = PERF_RECORD_CALLCHAIN_DEFERRED, | |
| 10473 | + | .misc = PERF_RECORD_MISC_USER, | |
| 10474 | + | .size = sizeof(deferred_event.event) + | |
| 10475 | + | (trace->nr * sizeof(u64)), | |
| 10476 | + | }, | |
| 10431 | 10477 | .cookie = cookie, | |
| 10432 | 10478 | .nr = trace->nr, | |
| 10433 | 10479 | }, | |
| @@ -10439,8 +10485,7 @@ static void perf_unwind_deferred_callback(struct unwind_work *work, | |||
| 10439 | 10485 | struct perf_text_poke_event { | |
| 10440 | 10486 | const void *old_bytes; | |
| 10441 | 10487 | const void *new_bytes; | |
| 10442 | - | u16 tot; | |
| 10443 | - | u16 pad; | |
| 10488 | + | size_t pad; | |
| 10444 | 10489 | u16 old_len; | |
| 10445 | 10490 | u16 new_len; | |
| 10446 | 10491 | ||
| @@ -10461,18 +10506,13 @@ static void perf_event_text_poke_output(struct perf_event *event, void *data) | |||
| 10461 | 10506 | struct perf_text_poke_event *text_poke_event = data; | |
| 10462 | 10507 | struct perf_output_handle handle; | |
| 10463 | 10508 | struct perf_sample_data sample; | |
| 10464 | - | u16 size = sizeof(text_poke_event->event_id) + text_poke_event->tot + text_poke_event->pad; | |
| 10465 | 10509 | u64 padding = 0; | |
| 10466 | 10510 | int ret; | |
| 10467 | 10511 | ||
| 10468 | 10512 | if (!perf_event_text_poke_match(event)) | |
| 10469 | 10513 | return; | |
| 10470 | 10514 | ||
| 10471 | - | perf_event_header__init(&text_poke_event->event_id.header, &sample, | |
| 10472 | - | PERF_RECORD_TEXT_POKE, | |
| 10473 | - | PERF_RECORD_MISC_KERNEL, | |
| 10474 | - | size, | |
| 10475 | - | event); | |
| 10515 | + | perf_event_header__init_id(&text_poke_event->event_id.header, &sample, event); | |
| 10476 | 10516 | ||
| 10477 | 10517 | ret = perf_output_begin(&handle, &sample, event, | |
| 10478 | 10518 | text_poke_event->event_id.header.size); | |
| @@ -10510,11 +10550,15 @@ void perf_event_text_poke(const void *addr, const void *old_bytes, | |||
| 10510 | 10550 | text_poke_event = (struct perf_text_poke_event){ | |
| 10511 | 10551 | .old_bytes = old_bytes, | |
| 10512 | 10552 | .new_bytes = new_bytes, | |
| 10513 | - | .tot = tot, | |
| 10514 | 10553 | .pad = pad, | |
| 10515 | 10554 | .old_len = old_len, | |
| 10516 | 10555 | .new_len = new_len, | |
| 10517 | 10556 | .event_id = { | |
| 10557 | + | .header = { | |
| 10558 | + | .type = PERF_RECORD_TEXT_POKE, | |
| 10559 | + | .misc = PERF_RECORD_MISC_KERNEL, | |
| 10560 | + | .size = sizeof(text_poke_event.event_id) + tot + pad, | |
| 10561 | + | }, | |
| 10518 | 10562 | .addr = (unsigned long)addr, | |
| 10519 | 10563 | }, | |
| 10520 | 10564 | }; | |
| @@ -10545,12 +10589,13 @@ static void perf_log_itrace_start(struct perf_event *event) | |||
| 10545 | 10589 | event->attach_state & PERF_ATTACH_ITRACE) | |
| 10546 | 10590 | return; | |
| 10547 | 10591 | ||
| 10592 | + | rec.header.type = PERF_RECORD_ITRACE_START; | |
| 10593 | + | rec.header.misc = 0; | |
| 10594 | + | rec.header.size = sizeof(rec); | |
| 10548 | 10595 | rec.pid = perf_event_pid(event, current); | |
| 10549 | 10596 | rec.tid = perf_event_tid(event, current); | |
| 10550 | 10597 | ||
| 10551 | - | perf_event_header__init(&rec.header, &sample, | |
| 10552 | - | PERF_RECORD_ITRACE_START, /* misc= */ 0, sizeof(rec), | |
| 10553 | - | event); | |
| 10598 | + | perf_event_header__init_id(&rec.header, &sample, event); | |
| 10554 | 10599 | ret = perf_output_begin(&handle, &sample, event, rec.header.size); | |
| 10555 | 10600 | ||
| 10556 | 10601 | if (ret) | |
| @@ -10575,10 +10620,12 @@ void perf_report_aux_output_id(struct perf_event *event, u64 hw_id) | |||
| 10575 | 10620 | if (event->parent) | |
| 10576 | 10621 | event = event->parent; | |
| 10577 | 10622 | ||
| 10578 | - | rec.hw_id = hw_id; | |
| 10579 | - | perf_event_header__init(&rec.header, &sample, | |
| 10580 | - | PERF_RECORD_AUX_OUTPUT_HW_ID, /* misc= */ 0, | |
| 10581 | - | sizeof(rec), event); | |
| 10623 | + | rec.header.type = PERF_RECORD_AUX_OUTPUT_HW_ID; | |
| 10624 | + | rec.header.misc = 0; | |
| 10625 | + | rec.header.size = sizeof(rec); | |
| 10626 | + | rec.hw_id = hw_id; | |
| 10627 | + | ||
| 10628 | + | perf_event_header__init_id(&rec.header, &sample, event); | |
| 10582 | 10629 | ret = perf_output_begin(&handle, &sample, event, rec.header.size); | |
| 10583 | 10630 | ||
| 10584 | 10631 | if (ret) | |
| @@ -13906,7 +13953,7 @@ SYSCALL_DEFINE5(perf_event_open, | |||
| 13906 | 13953 | if (err) | |
| 13907 | 13954 | return err; | |
| 13908 | 13955 | ||
| 13909 | - | if (!attr.exclude_kernel || attr.text_poke || | |
| 13956 | + | if (!attr.exclude_kernel || | |
| 13910 | 13957 | ((attr.sample_type & PERF_SAMPLE_CALLCHAIN) && | |
| 13911 | 13958 | !attr.exclude_callchain_kernel)) { | |
| 13912 | 13959 | err = perf_allow_kernel(); | |
modified kernel/events/ring_buffer.c
| @@ -246,13 +246,14 @@ __perf_output_begin(struct perf_output_handle *handle, | |||
| 246 | 246 | handle->size = (1UL << page_shift) - offset; | |
| 247 | 247 | ||
| 248 | 248 | if (unlikely(have_lost)) { | |
| 249 | + | lost_event.header.size = sizeof(lost_event); | |
| 250 | + | lost_event.header.type = PERF_RECORD_LOST; | |
| 251 | + | lost_event.header.misc = 0; | |
| 249 | 252 | lost_event.id = event->id; | |
| 250 | 253 | lost_event.lost = local_xchg(&rb->lost, 0); | |
| 251 | 254 | ||
| 252 | 255 | /* XXX mostly redundant; @data is already fully initializes */ | |
| 253 | - | perf_event_header__init(&lost_event.header, data, | |
| 254 | - | PERF_RECORD_LOST, /* misc= */ 0, | |
| 255 | - | sizeof(lost_event), event); | |
| 256 | + | perf_event_header__init_id(&lost_event.header, data, event); | |
| 256 | 257 | perf_output_put(handle, lost_event); | |
| 257 | 258 | perf_event__output_id_sample(event, handle, data); | |
| 258 | 259 | } | |
modified kernel/fork.c
| @@ -3317,17 +3317,14 @@ int ksys_unshare(unsigned long unshare_flags) | |||
| 3317 | 3317 | shm_init_task(current); | |
| 3318 | 3318 | } | |
| 3319 | 3319 | ||
| 3320 | - | if (new_fs) { | |
| 3321 | - | new_fs = switch_fs_struct(new_fs); | |
| 3322 | - | if (new_fs) | |
| 3323 | - | free_fs_struct(no_free_ptr(new_fs)); | |
| 3324 | - | } | |
| 3325 | - | ||
| 3326 | 3320 | if (new_nsproxy) { | |
| 3327 | 3321 | switch_task_namespaces(current, new_nsproxy); | |
| 3328 | 3322 | new_nsproxy = NULL; | |
| 3329 | 3323 | } | |
| 3330 | 3324 | ||
| 3325 | + | if (new_fs) | |
| 3326 | + | new_fs = switch_fs_struct(new_fs); | |
| 3327 | + | ||
| 3331 | 3328 | if (new_fd) { | |
| 3332 | 3329 | guard(task_lock)(current); | |
| 3333 | 3330 | swap(current->files, new_fd); | |
| @@ -3343,9 +3340,8 @@ int ksys_unshare(unsigned long unshare_flags) | |||
| 3343 | 3340 | perf_event_namespaces(current); | |
| 3344 | 3341 | ||
| 3345 | 3342 | bad_unshare_cleanup_nsproxy: | |
| 3346 | - | /* never installed, so no active references to drop */ | |
| 3347 | 3343 | if (new_nsproxy) | |
| 3348 | - | nsproxy_free(new_nsproxy); | |
| 3344 | + | put_nsproxy(new_nsproxy); | |
| 3349 | 3345 | bad_unshare_cleanup_cred: | |
| 3350 | 3346 | if (new_cred) | |
| 3351 | 3347 | put_cred(new_cred); | |
modified kernel/futex/core.c
| @@ -213,12 +213,10 @@ static bool __futex_pivot_hash(struct mm_struct *mm, struct futex_private_hash * | |||
| 213 | 213 | futex_rehash_private(fph, new); | |
| 214 | 214 | } | |
| 215 | 215 | new->state = FR_PERCPU; | |
| 216 | - | rcu_assign_pointer(mmph->hash, new); | |
| 217 | - | /* | |
| 218 | - | * mmph->batches must reference a grace period which started after | |
| 219 | - | * mmph->hash was assigned. See futex_ref_drop(). | |
| 220 | - | */ | |
| 221 | - | mmph->batches = get_state_synchronize_rcu(); | |
| 216 | + | scoped_guard(rcu) { | |
| 217 | + | mmph->batches = get_state_synchronize_rcu(); | |
| 218 | + | rcu_assign_pointer(mmph->hash, new); | |
| 219 | + | } | |
| 222 | 220 | kvfree_rcu(fph, rcu); | |
| 223 | 221 | return true; | |
| 224 | 222 | } | |
modified kernel/irq/Kconfig
| @@ -150,18 +150,6 @@ config IRQ_KUNIT_TEST | |||
| 150 | 150 | ||
| 151 | 151 | If unsure, say N. | |
| 152 | 152 | ||
| 153 | - | config REFCOUNT_INTERRUPT_KUNIT_TEST | |
| 154 | - | tristate "Test refcounted interrupt enable/disable" if !KUNIT_ALL_TESTS | |
| 155 | - | depends on KUNIT | |
| 156 | - | default KUNIT_ALL_TESTS | |
| 157 | - | help | |
| 158 | - | This builds the kunit tests for the refcounted interrupt | |
| 159 | - | infrastructure. It verifies the correctness of single, nested, | |
| 160 | - | and multiple interrupt enable/disable state changes and ensures | |
| 161 | - | that the underlying reference counting mechanisms work as expected. | |
| 162 | - | ||
| 163 | - | If unsure, say N. | |
| 164 | - | ||
| 165 | 153 | endmenu | |
| 166 | 154 | ||
| 167 | 155 | config GENERIC_IRQ_MULTI_HANDLER | |
modified kernel/irq/Makefile
| @@ -16,4 +16,4 @@ obj-$(CONFIG_SMP) += affinity.o | |||
| 16 | 16 | obj-$(CONFIG_GENERIC_IRQ_DEBUGFS) += debugfs.o | |
| 17 | 17 | obj-$(CONFIG_GENERIC_IRQ_MATRIX_ALLOCATOR) += matrix.o | |
| 18 | 18 | obj-$(CONFIG_IRQ_KUNIT_TEST) += irq_test.o | |
| 19 | - | obj-$(CONFIG_REFCOUNT_INTERRUPT_KUNIT_TEST) += refcount_interrupt_test.o | |
| 19 | + | obj-$(CONFIG_KUNIT) += refcount_interrupt_test.o | |
modified kernel/kprobes.c
| @@ -496,16 +496,14 @@ static bool kprobe_queued(struct kprobe *p) | |||
| 496 | 496 | static struct kprobe *get_optimized_kprobe(kprobe_opcode_t *addr) | |
| 497 | 497 | { | |
| 498 | 498 | int i; | |
| 499 | - | struct kprobe *p; | |
| 499 | + | struct kprobe *p = NULL; | |
| 500 | 500 | struct optimized_kprobe *op; | |
| 501 | 501 | ||
| 502 | 502 | /* Don't check i == 0, since that is a breakpoint case. */ | |
| 503 | - | for (i = 1; i < MAX_OPTIMIZED_LENGTH / sizeof(kprobe_opcode_t); i++) { | |
| 503 | + | for (i = 1; !p && i < MAX_OPTIMIZED_LENGTH / sizeof(kprobe_opcode_t); i++) | |
| 504 | 504 | p = get_kprobe(addr - i); | |
| 505 | - | /* A disabled probe can have prepared, but inactive, optinsns. */ | |
| 506 | - | if (!p || !kprobe_optready(p) || kprobe_disarmed(p)) | |
| 507 | - | continue; | |
| 508 | 505 | ||
| 506 | + | if (p && kprobe_optready(p)) { | |
| 509 | 507 | op = container_of(p, struct optimized_kprobe, kp); | |
| 510 | 508 | if (arch_within_optimized_kprobe(op, addr)) | |
| 511 | 509 | return p; | |
modified kernel/module/main.c
| @@ -3581,9 +3581,8 @@ static int load_module(struct load_info *info, const char __user *uargs, | |||
| 3581 | 3581 | goto sysfs_cleanup; | |
| 3582 | 3582 | } | |
| 3583 | 3583 | ||
| 3584 | - | err = codetag_load_module(mod); | |
| 3585 | - | if (err) | |
| 3586 | - | goto livepatch_cleanup; | |
| 3584 | + | if (codetag_load_module(mod)) | |
| 3585 | + | goto sysfs_cleanup; | |
| 3587 | 3586 | ||
| 3588 | 3587 | /* Get rid of temporary copy. */ | |
| 3589 | 3588 | free_copy(info, flags); | |
| @@ -3593,9 +3592,6 @@ static int load_module(struct load_info *info, const char __user *uargs, | |||
| 3593 | 3592 | ||
| 3594 | 3593 | return do_init_module(mod); | |
| 3595 | 3594 | ||
| 3596 | - | livepatch_cleanup: | |
| 3597 | - | if (is_livepatch_module(mod)) | |
| 3598 | - | free_module_elf(mod); | |
| 3599 | 3595 | sysfs_cleanup: | |
| 3600 | 3596 | mod_sysfs_teardown(mod); | |
| 3601 | 3597 | coming_cleanup: | |
modified kernel/nsproxy.c
| @@ -61,7 +61,7 @@ static inline struct nsproxy *create_nsproxy(void) | |||
| 61 | 61 | return nsproxy; | |
| 62 | 62 | } | |
| 63 | 63 | ||
| 64 | - | void nsproxy_free(struct nsproxy *ns) | |
| 64 | + | static inline void nsproxy_free(struct nsproxy *ns) | |
| 65 | 65 | { | |
| 66 | 66 | put_mnt_ns(ns->mnt_ns); | |
| 67 | 67 | put_uts_ns(ns->uts_ns); | |
modified kernel/printk/nbcon.c
| @@ -1887,7 +1887,6 @@ bool nbcon_device_try_acquire(struct console *con) | |||
| 1887 | 1887 | ||
| 1888 | 1888 | memset(ctxt, 0, sizeof(*ctxt)); | |
| 1889 | 1889 | ctxt->console = con; | |
| 1890 | - | /* Keep in sync with nbcon_braille_try_acquire(). */ | |
| 1891 | 1890 | ctxt->prio = NBCON_PRIO_NORMAL; | |
| 1892 | 1891 | ||
| 1893 | 1892 | if (!nbcon_context_try_acquire(ctxt, false)) | |
| @@ -2003,81 +2002,3 @@ void nbcon_kdb_release(struct nbcon_write_context *wctxt) | |||
| 2003 | 2002 | */ | |
| 2004 | 2003 | __nbcon_atomic_flush_pending_con(ctxt->console, prb_next_reserve_seq(prb)); | |
| 2005 | 2004 | } | |
| 2006 | - | ||
| 2007 | - | /** | |
| 2008 | - | * nbcon_is_braille - Checks whether the nbcon write context is using Braille console | |
| 2009 | - | * | |
| 2010 | - | * @wctxt: checked nbcon write context | |
| 2011 | - | * | |
| 2012 | - | * Return: True when the write context is associated with a Braille console. | |
| 2013 | - | * Otherwise, return false. | |
| 2014 | - | * | |
| 2015 | - | * Context: Can be called in any context but only when Braille console is | |
| 2016 | - | * registered and the struct console could not disappear. | |
| 2017 | - | */ | |
| 2018 | - | bool nbcon_write_context_is_braille(struct nbcon_write_context *wctxt) | |
| 2019 | - | { | |
| 2020 | - | struct nbcon_context *ctxt = &ACCESS_PRIVATE(wctxt, ctxt); | |
| 2021 | - | struct console *con = ctxt->console; | |
| 2022 | - | ||
| 2023 | - | return con && con->flags & CON_BRL; | |
| 2024 | - | } | |
| 2025 | - | EXPORT_SYMBOL_GPL(nbcon_write_context_is_braille); | |
| 2026 | - | ||
| 2027 | - | /** | |
| 2028 | - | * nbcon_braille_try_acquire - Try to acquire nbcon console for braille_write() | |
| 2029 | - | * | |
| 2030 | - | * @con: The nbcon console to acquire | |
| 2031 | - | * @wctxt: The nbcon write context to be used on success | |
| 2032 | - | * | |
| 2033 | - | * Context: braille_write() for emitting a single buffer on Braille console. | |
| 2034 | - | * | |
| 2035 | - | * Return: True if the console was acquired. False otherwise. | |
| 2036 | - | * | |
| 2037 | - | * Braille console is not registered as a proper printk consoles. Instead, | |
| 2038 | - | * it is integrated with the graphical virtual terminal. | |
| 2039 | - | * | |
| 2040 | - | * This function is going to synchronize the Braille write against other | |
| 2041 | - | * operations on the used serial port. The port can be used also for a user | |
| 2042 | - | * input but printk() won't emit the messages there directly. It means | |
| 2043 | - | * the other operations will get synchronized using nbcon_device_try_acquire(). | |
| 2044 | - | */ | |
| 2045 | - | bool nbcon_braille_try_acquire(struct console *con, | |
| 2046 | - | struct nbcon_write_context *wctxt) | |
| 2047 | - | { | |
| 2048 | - | struct nbcon_context *ctxt = &ACCESS_PRIVATE(wctxt, ctxt); | |
| 2049 | - | bool success; | |
| 2050 | - | ||
| 2051 | - | memset(ctxt, 0, sizeof(*ctxt)); | |
| 2052 | - | ctxt->console = con; | |
| 2053 | - | /* Keep in sync with nbcon_device_try_acquire(). */ | |
| 2054 | - | if (panic_on_this_cpu()) | |
| 2055 | - | ctxt->prio = NBCON_PRIO_PANIC; | |
| 2056 | - | else | |
| 2057 | - | ctxt->prio = NBCON_PRIO_NORMAL; | |
| 2058 | - | ||
| 2059 | - | success = nbcon_context_try_acquire(ctxt, false); | |
| 2060 | - | /* | |
| 2061 | - | * Try hard in panic, otherwise the Braille console would | |
| 2062 | - | * miss a text on the related VT. | |
| 2063 | - | */ | |
| 2064 | - | if (panic_on_this_cpu() && !success) { | |
| 2065 | - | ctxt->allow_unsafe_takeover = true; | |
| 2066 | - | success = nbcon_context_try_acquire(ctxt, false); | |
| 2067 | - | } | |
| 2068 | - | ||
| 2069 | - | return success; | |
| 2070 | - | } | |
| 2071 | - | ||
| 2072 | - | /** | |
| 2073 | - | * nbcon_braille_release - Release the nbcon console | |
| 2074 | - | * | |
| 2075 | - | * @wctxt: The nbcon write context initialized by a successful | |
| 2076 | - | * nbcon_braille_try_acquire() | |
| 2077 | - | */ | |
| 2078 | - | void nbcon_braille_release(struct nbcon_write_context *wctxt) | |
| 2079 | - | { | |
| 2080 | - | struct nbcon_context *ctxt = &ACCESS_PRIVATE(wctxt, ctxt); | |
| 2081 | - | ||
| 2082 | - | nbcon_context_release(ctxt); | |
| 2083 | - | } | |
modified kernel/rcu/srcutree.c
| @@ -704,7 +704,7 @@ void cleanup_srcu_struct(struct srcu_struct *ssp) | |||
| 704 | 704 | // Call srcu_barrier() before this cleanup_srcu_struct() | |
| 705 | 705 | // to avoid triggering this WARN_ON(). | |
| 706 | 706 | if (WARN_ON(timer_delete_sync(&sdp->delay_work) && | |
| 707 | - | !rcu_segcblist_empty(&sdp->srcu_cblist)) && | |
| 707 | + | rcu_segcblist_n_cbs(&sdp->srcu_cblist)) && | |
| 708 | 708 | rcu_cpu_beenfullyonline(sdp->cpu)) | |
| 709 | 709 | queue_work_on(sdp->cpu, rcu_gp_wq, &sdp->work); | |
| 710 | 710 | flush_work(&sdp->work); | |
modified kernel/sched/ext/ext.c
| @@ -2057,14 +2057,8 @@ void scx_do_enqueue_task(struct rq *rq, struct task_struct *p, u64 enq_flags, | |||
| 2057 | 2057 | if (unlikely(!SCX_HAS_OP(sch, enqueue))) | |
| 2058 | 2058 | goto global; | |
| 2059 | 2059 | ||
| 2060 | - | /* | |
| 2061 | - | * DSQ bypass didn't trigger, enqueue on the BPF scheduler. Wrap the | |
| 2062 | - | * per-task qseq counter where the QSEQ field wraps and skip 0, which is | |
| 2063 | - | * what scx_bpf_dsq_insert() records for a task in NONE or DISPATCHING. | |
| 2064 | - | */ | |
| 2065 | - | p->scx.ops_qseq = ((p->scx.ops_qseq + 1) & | |
| 2066 | - | (SCX_OPSS_QSEQ_MASK >> SCX_OPSS_QSEQ_SHIFT)) ?: 1; | |
| 2067 | - | qseq = (unsigned long)p->scx.ops_qseq << SCX_OPSS_QSEQ_SHIFT; | |
| 2060 | + | /* DSQ bypass didn't trigger, enqueue on the BPF scheduler */ | |
| 2061 | + | qseq = rq->scx.ops_qseq++ << SCX_OPSS_QSEQ_SHIFT; | |
| 2068 | 2062 | ||
| 2069 | 2063 | WARN_ON_ONCE(atomic_long_read(&p->scx.ops_state) != SCX_OPSS_NONE); | |
| 2070 | 2064 | atomic_long_set(&p->scx.ops_state, SCX_OPSS_QUEUEING | qseq); | |
| @@ -2129,8 +2123,8 @@ static void set_task_runnable(struct rq *rq, struct task_struct *p) | |||
| 2129 | 2123 | } | |
| 2130 | 2124 | ||
| 2131 | 2125 | /* | |
| 2132 | - | * list_add_tail() must be used. scx_bypass() and rq_offline_scx() | |
| 2133 | - | * depend on tasks being appended to the runnable_list. | |
| 2126 | + | * list_add_tail() must be used. scx_bypass() depends on tasks being | |
| 2127 | + | * appended to the runnable_list. | |
| 2134 | 2128 | */ | |
| 2135 | 2129 | list_add_tail(&p->scx.runnable_node, &rq->scx.runnable_list); | |
| 2136 | 2130 | ||
| @@ -2158,13 +2152,6 @@ static void enqueue_task_scx(struct rq *rq, struct task_struct *p, int core_enq_ | |||
| 2158 | 2152 | int sticky_cpu = p->scx.sticky_cpu; | |
| 2159 | 2153 | u64 enq_flags = core_enq_flags | rq->scx.remote_activate_enq_flags; | |
| 2160 | 2154 | ||
| 2161 | - | /* | |
| 2162 | - | * An SCX-internal migration ends on arrival. Clear sticky_cpu so @p can | |
| 2163 | - | * leave custody when inserted into the destination DSQ. | |
| 2164 | - | */ | |
| 2165 | - | if (sticky_cpu >= 0) | |
| 2166 | - | p->scx.sticky_cpu = -1; | |
| 2167 | - | ||
| 2168 | 2155 | /* | |
| 2169 | 2156 | * SCX_RQ_IN_WAKEUP promises a task_woken_scx() call once this enqueue | |
| 2170 | 2157 | * returns. Only the core's wakeup path delivers one. The flags stashed | |
| @@ -2203,6 +2190,9 @@ static void enqueue_task_scx(struct rq *rq, struct task_struct *p, int core_enq_ | |||
| 2203 | 2190 | dl_server_start(&rq->ext_server); | |
| 2204 | 2191 | ||
| 2205 | 2192 | scx_do_enqueue_task(rq, p, enq_flags, sticky_cpu); | |
| 2193 | + | ||
| 2194 | + | if (sticky_cpu >= 0) | |
| 2195 | + | p->scx.sticky_cpu = -1; | |
| 2206 | 2196 | out: | |
| 2207 | 2197 | rq->scx.flags &= ~SCX_RQ_IN_WAKEUP; | |
| 2208 | 2198 | ||
| @@ -3741,26 +3731,8 @@ static void rq_online_scx(struct rq *rq) | |||
| 3741 | 3731 | ||
| 3742 | 3732 | static void rq_offline_scx(struct rq *rq) | |
| 3743 | 3733 | { | |
| 3744 | - | struct task_struct *p, *n; | |
| 3745 | - | ||
| 3746 | 3734 | rq->scx.flags &= ~SCX_RQ_ONLINE; | |
| 3747 | - | ||
| 3748 | - | /* sched domain rebuilds call rq_offline with the CPU staying alive */ | |
| 3749 | - | if (cpu_active(cpu_of(rq))) | |
| 3750 | - | return; | |
| 3751 | - | ||
| 3752 | 3735 | scx_rescue_flush(rq); | |
| 3753 | - | ||
| 3754 | - | /* | |
| 3755 | - | * An offline CPU no longer calls ops.dispatch(). Re-enqueue its tasks | |
| 3756 | - | * onto the local DSQ so that they run here and balance_push() moves | |
| 3757 | - | * them off. | |
| 3758 | - | */ | |
| 3759 | - | list_for_each_entry_safe_reverse(p, n, &rq->scx.runnable_list, scx.runnable_node) { | |
| 3760 | - | if (p->scx.dsq == &rq->scx.local_dsq) | |
| 3761 | - | continue; | |
| 3762 | - | guard(sched_change)(p, DEQUEUE_SAVE | DEQUEUE_MOVE | DEQUEUE_NOCLOCK); | |
| 3763 | - | } | |
| 3764 | 3736 | } | |
| 3765 | 3737 | ||
| 3766 | 3738 | static bool check_rq_for_timeouts(struct rq *rq) | |
| @@ -6975,9 +6947,9 @@ static void scx_dump_cpu(struct scx_sched *sch, struct seq_buf *s, | |||
| 6975 | 6947 | seq_buf_init(&ns, buf, avail); | |
| 6976 | 6948 | ||
| 6977 | 6949 | dump_newline(&ns); | |
| 6978 | - | scx_dump_line(&ns, "CPU %-4d: nr_run=%u flags=0x%x cpu_rel=%d ksync=%lu", | |
| 6950 | + | scx_dump_line(&ns, "CPU %-4d: nr_run=%u flags=0x%x cpu_rel=%d ops_qseq=%lu ksync=%lu", | |
| 6979 | 6951 | cpu, rq->scx.nr_running, rq->scx.flags, rq->scx.cpu_released, | |
| 6980 | - | rq->scx.kick_sync); | |
| 6952 | + | rq->scx.ops_qseq, rq->scx.kick_sync); | |
| 6981 | 6953 | scx_rescue_dump(&ns, rq); | |
| 6982 | 6954 | scx_dump_line(&ns, " curr=%s[%d] class=%ps", | |
| 6983 | 6955 | rq->curr->comm, rq->curr->pid, rq->curr->sched_class); | |
modified kernel/sched/ext/inlines.h
| @@ -70,13 +70,7 @@ scx_dispatch_sched(struct scx_sched *sch, struct rq *rq, | |||
| 70 | 70 | #endif /* CONFIG_EXT_SUB_SCHED */ | |
| 71 | 71 | } | |
| 72 | 72 | ||
| 73 | - | /* | |
| 74 | - | * scx_rq_online() can't be used. Its cpu_active() test goes false | |
| 75 | - | * before CPU hotplug waits for an RCU grace period, and | |
| 76 | - | * rq_offline_scx() moves this CPU's tasks to the local DSQ only after | |
| 77 | - | * the wait. The grace period can depend on those tasks running. | |
| 78 | - | */ | |
| 79 | - | if (unlikely(!SCX_HAS_OP(sch, dispatch)) || !(rq->scx.flags & SCX_RQ_ONLINE)) | |
| 73 | + | if (unlikely(!SCX_HAS_OP(sch, dispatch)) || !scx_rq_online(rq)) | |
| 80 | 74 | return SCX_DSP_NONE; | |
| 81 | 75 | ||
| 82 | 76 | dspc->rq = rq; | |
modified kernel/sched/ext/internal.h
| @@ -1998,11 +1998,6 @@ enum scx_ops_state { | |||
| 1998 | 1998 | * dequeue/requeue, the dispatcher can tell whether it still has a claim | |
| 1999 | 1999 | * on the task being dispatched. | |
| 2000 | 2000 | * | |
| 2001 | - | * QSEQ is generated from the per-task p->scx.ops_qseq counter so that | |
| 2002 | - | * it doesn't repeat across QUEUED instances of the same task even if | |
| 2003 | - | * the task moves between rqs. 0 is never used as a valid QSEQ since | |
| 2004 | - | * NONE and DISPATCHING map to this value. | |
| 2005 | - | * | |
| 2006 | 2001 | * As some 32bit archs can't do 64bit store_release/load_acquire, | |
| 2007 | 2002 | * p->scx.ops_state is atomic_long_t which leaves 30 bits for QSEQ on | |
| 2008 | 2003 | * 32bit machines. The dispatch race window QSEQ protects is very narrow | |
modified kernel/sched/ext/sub.c
| @@ -585,6 +585,10 @@ void scx_rescue_flush(struct rq *rq) | |||
| 585 | 585 | ||
| 586 | 586 | lockdep_assert_rq_held(rq); | |
| 587 | 587 | ||
| 588 | + | /* sched domain rebuilds call rq_offline with the CPU staying alive */ | |
| 589 | + | if (cpu_active(cpu_of(rq))) | |
| 590 | + | return; | |
| 591 | + | ||
| 588 | 592 | /* end the current rescue */ | |
| 589 | 593 | if (rq->scx.rescue.curr) | |
| 590 | 594 | scx_task_slice_ended(rq, rq->scx.rescue.curr); | |
modified kernel/sched/sched.h
| @@ -816,6 +816,7 @@ struct scx_rq { | |||
| 816 | 816 | #endif | |
| 817 | 817 | struct list_head runnable_list; /* runnable tasks on this rq */ | |
| 818 | 818 | struct list_head ddsp_deferred_locals; /* deferred ddsps from enq */ | |
| 819 | + | unsigned long ops_qseq; | |
| 819 | 820 | /* both stashed across the activate_task() in move_remote_task_to_local_dsq() */ | |
| 820 | 821 | u64 remote_activate_enq_flags; | |
| 821 | 822 | struct scx_sched *remote_activate_sch; | |
| @@ -4221,9 +4222,8 @@ extern void balance_callbacks(struct rq *rq, struct balance_callback *head); | |||
| 4221 | 4222 | * after which it is enqueued again. | |
| 4222 | 4223 | * | |
| 4223 | 4224 | * Typically this must be called while holding task_rq_lock, since most/all | |
| 4224 | - | * properties are serialized under those locks. There are currently two | |
| 4225 | - | * exceptions to this rule in sched/ext which only hold rq->lock: scx_bypass() | |
| 4226 | - | * and rq_offline_scx(). | |
| 4225 | + | * properties are serialized under those locks. There is currently one | |
| 4226 | + | * exception to this rule in sched/ext which only holds rq->lock. | |
| 4227 | 4227 | */ | |
| 4228 | 4228 | ||
| 4229 | 4229 | /* | |
modified kernel/sysctl.c
| @@ -483,7 +483,7 @@ int proc_int_k2u_conv_kop(ulong *u_ptr, const int *k_ptr, bool *negp, | |||
| 483 | 483 | ||
| 484 | 484 | if (val < 0) { | |
| 485 | 485 | *negp = true; | |
| 486 | - | *u_ptr = k_ptr_op ? k_ptr_op(-(ulong)val) : -(ulong)val; | |
| 486 | + | *u_ptr = k_ptr_op ? -k_ptr_op((ulong)val) : -(ulong)val; | |
| 487 | 487 | } else { | |
| 488 | 488 | *negp = false; | |
| 489 | 489 | *u_ptr = k_ptr_op ? k_ptr_op((ulong)val) : (ulong) val; | |
modified kernel/time/jiffies.c
| @@ -101,8 +101,6 @@ void __init register_refined_jiffies(long cycles_per_second) | |||
| 101 | 101 | #ifdef CONFIG_SYSCTL | |
| 102 | 102 | static ulong mult_hz(const ulong val) | |
| 103 | 103 | { | |
| 104 | - | if (val >= ULONG_MAX / HZ) | |
| 105 | - | return ULONG_MAX; | |
| 106 | 104 | return val * HZ; | |
| 107 | 105 | } | |
| 108 | 106 | ||
modified kernel/trace/fprobe.c
| @@ -47,10 +47,6 @@ static struct rhltable fprobe_ip_table; | |||
| 47 | 47 | static DEFINE_MUTEX(fprobe_mutex); | |
| 48 | 48 | static struct fgraph_ops fprobe_graph_ops; | |
| 49 | 49 | ||
| 50 | - | DEFINE_LOCK_GUARD_0(rcu_sched_notrace, | |
| 51 | - | rcu_read_lock_sched_notrace(), | |
| 52 | - | rcu_read_unlock_sched_notrace()) | |
| 53 | - | ||
| 54 | 50 | static u32 fprobe_node_hashfn(const void *data, u32 len, u32 seed) | |
| 55 | 51 | { | |
| 56 | 52 | return hash_ptr(*(unsigned long **)data, 32); | |
| @@ -333,14 +329,16 @@ static void fprobe_ftrace_entry(unsigned long ip, unsigned long parent_ip, | |||
| 333 | 329 | struct fprobe *fp; | |
| 334 | 330 | int bit; | |
| 335 | 331 | ||
| 336 | - | if (!rcu_is_watching()) | |
| 337 | - | return; | |
| 338 | - | ||
| 339 | 332 | bit = ftrace_test_recursion_trylock(ip, parent_ip); | |
| 340 | 333 | if (bit < 0) | |
| 341 | 334 | return; | |
| 342 | 335 | ||
| 343 | - | guard(rcu_sched_notrace)(); | |
| 336 | + | /* | |
| 337 | + | * ftrace_test_recursion_trylock() disables preemption, but | |
| 338 | + | * rhltable_lookup() checks whether rcu_read_lcok is held. | |
| 339 | + | * So we take rcu_read_lock() here. | |
| 340 | + | */ | |
| 341 | + | rcu_read_lock(); | |
| 344 | 342 | head = rhltable_lookup(&fprobe_ip_table, &ip, fprobe_rht_params); | |
| 345 | 343 | ||
| 346 | 344 | rhl_for_each_entry_rcu(node, pos, head, hlist) { | |
| @@ -355,6 +353,7 @@ static void fprobe_ftrace_entry(unsigned long ip, unsigned long parent_ip, | |||
| 355 | 353 | else | |
| 356 | 354 | __fprobe_handler(ip, parent_ip, fp, fregs, NULL); | |
| 357 | 355 | } | |
| 356 | + | rcu_read_unlock(); | |
| 358 | 357 | ftrace_test_recursion_unlock(bit); | |
| 359 | 358 | } | |
| 360 | 359 | NOKPROBE_SYMBOL(fprobe_ftrace_entry); | |
| @@ -568,13 +567,10 @@ static int fprobe_fgraph_entry(struct ftrace_graph_ent *trace, struct fgraph_ops | |||
| 568 | 567 | struct fprobe *fp; | |
| 569 | 568 | int used, ret; | |
| 570 | 569 | ||
| 571 | - | if (!rcu_is_watching()) | |
| 572 | - | return 0; | |
| 573 | - | ||
| 574 | 570 | if (WARN_ON_ONCE(!fregs)) | |
| 575 | 571 | return 0; | |
| 576 | 572 | ||
| 577 | - | guard(rcu_sched_notrace)(); | |
| 573 | + | guard(rcu)(); | |
| 578 | 574 | head = rhltable_lookup(&fprobe_ip_table, &func, fprobe_rht_params); | |
| 579 | 575 | reserved_words = 0; | |
| 580 | 576 | rhl_for_each_entry_rcu(node, pos, head, hlist) { | |
| @@ -669,16 +665,13 @@ static void fprobe_return(struct ftrace_graph_ret *trace, | |||
| 669 | 665 | int size, curr; | |
| 670 | 666 | int size_words; | |
| 671 | 667 | ||
| 672 | - | if (!rcu_is_watching()) | |
| 673 | - | return; | |
| 674 | - | ||
| 675 | 668 | fgraph_data = (unsigned long *)fgraph_retrieve_data(gops->idx, &size); | |
| 676 | 669 | if (WARN_ON_ONCE(!fgraph_data)) | |
| 677 | 670 | return; | |
| 678 | 671 | size_words = SIZE_IN_LONG(size); | |
| 679 | 672 | ret_ip = ftrace_regs_get_instruction_pointer(fregs); | |
| 680 | 673 | ||
| 681 | - | guard(rcu_sched_notrace)(); | |
| 674 | + | preempt_disable_notrace(); | |
| 682 | 675 | ||
| 683 | 676 | curr = 0; | |
| 684 | 677 | while (size_words > curr) { | |
| @@ -694,6 +687,7 @@ static void fprobe_return(struct ftrace_graph_ret *trace, | |||
| 694 | 687 | } | |
| 695 | 688 | curr += size; | |
| 696 | 689 | } | |
| 690 | + | preempt_enable_notrace(); | |
| 697 | 691 | } | |
| 698 | 692 | NOKPROBE_SYMBOL(fprobe_return); | |
| 699 | 693 | ||
modified kernel/workqueue.c
| @@ -2290,7 +2290,7 @@ static bool is_chained_work(struct workqueue_struct *wq) | |||
| 2290 | 2290 | * Return %true iff I'm a worker executing a work item on @wq. If | |
| 2291 | 2291 | * I'm @worker, it's safe to dereference it without locking. | |
| 2292 | 2292 | */ | |
| 2293 | - | return worker && worker->current_pwq && worker->current_pwq->wq == wq; | |
| 2293 | + | return worker && worker->current_pwq->wq == wq; | |
| 2294 | 2294 | } | |
| 2295 | 2295 | ||
| 2296 | 2296 | /* | |
modified lib/Kconfig.debug
| @@ -2906,21 +2906,6 @@ config LIVEUPDATE_TEST | |||
| 2906 | 2906 | ||
| 2907 | 2907 | If unsure, say N | |
| 2908 | 2908 | ||
| 2909 | - | config DIMLIB_KUNIT_TEST | |
| 2910 | - | tristate "KUnit test for the DIM library" if !KUNIT_ALL_TESTS | |
| 2911 | - | depends on KUNIT && NET | |
| 2912 | - | select DIMLIB | |
| 2913 | - | default KUNIT_ALL_TESTS | |
| 2914 | - | help | |
| 2915 | - | This builds the KUnit test for the Dynamic Interrupt Moderation | |
| 2916 | - | library (lib/dim/), which checks the rate statistics computed by | |
| 2917 | - | dim_calc_stats(). | |
| 2918 | - | ||
| 2919 | - | For more information on KUnit and unit tests in general please refer | |
| 2920 | - | to the KUnit documentation in Documentation/dev-tools/kunit/. | |
| 2921 | - | ||
| 2922 | - | If unsure, say N. | |
| 2923 | - | ||
| 2924 | 2909 | config CMDLINE_KUNIT_TEST | |
| 2925 | 2910 | tristate "KUnit test for cmdline API" if !KUNIT_ALL_TESTS | |
| 2926 | 2911 | depends on KUNIT | |
modified lib/dim/Makefile
| @@ -5,5 +5,3 @@ | |||
| 5 | 5 | obj-$(CONFIG_DIMLIB) += dimlib.o | |
| 6 | 6 | ||
| 7 | 7 | dimlib-y := dim.o net_dim.o rdma_dim.o | |
| 8 | - | ||
| 9 | - | obj-$(CONFIG_DIMLIB_KUNIT_TEST) += dim_kunit.o | |
modified lib/dim/dim.c
| @@ -69,15 +69,11 @@ bool dim_calc_stats(const struct dim_sample *start, | |||
| 69 | 69 | if (!delta_us) | |
| 70 | 70 | return false; | |
| 71 | 71 | ||
| 72 | - | /* u32 * USEC_PER_MSEC overflows a 32-bit long */ | |
| 73 | - | curr_stats->ppms = DIV_ROUND_UP_ULL((u64)npkts * USEC_PER_MSEC, | |
| 74 | - | delta_us); | |
| 75 | - | curr_stats->bpms = DIV_ROUND_UP_ULL((u64)nbytes * USEC_PER_MSEC, | |
| 76 | - | delta_us); | |
| 72 | + | curr_stats->ppms = DIV_ROUND_UP(npkts * USEC_PER_MSEC, delta_us); | |
| 73 | + | curr_stats->bpms = DIV_ROUND_UP(nbytes * USEC_PER_MSEC, delta_us); | |
| 77 | 74 | curr_stats->epms = DIV_ROUND_UP(DIM_NEVENTS * USEC_PER_MSEC, | |
| 78 | 75 | delta_us); | |
| 79 | - | curr_stats->cpms = DIV_ROUND_UP_ULL((u64)ncomps * USEC_PER_MSEC, | |
| 80 | - | delta_us); | |
| 76 | + | curr_stats->cpms = DIV_ROUND_UP(ncomps * USEC_PER_MSEC, delta_us); | |
| 81 | 77 | if (curr_stats->epms != 0) | |
| 82 | 78 | curr_stats->cpe_ratio = DIV_ROUND_DOWN_ULL( | |
| 83 | 79 | curr_stats->cpms * 100, curr_stats->epms); | |
deleted lib/dim/dim_kunit.c mode 100644
| @@ -1,126 +0,0 @@ | |||
| 1 | - | // SPDX-License-Identifier: GPL-2.0 | |
| 2 | - | /* | |
| 3 | - | * KUnit tests for the Dynamic Interrupt Moderation library | |
| 4 | - | */ | |
| 5 | - | ||
| 6 | - | #include <kunit/test.h> | |
| 7 | - | #include <linux/dim.h> | |
| 8 | - | #include <linux/ktime.h> | |
| 9 | - | #include <linux/module.h> | |
| 10 | - | ||
| 11 | - | struct dim_calc_stats_case { | |
| 12 | - | const char *name; | |
| 13 | - | u32 delta_us; | |
| 14 | - | u32 start_pkts, end_pkts; | |
| 15 | - | u32 start_bytes, end_bytes; | |
| 16 | - | u32 start_comps, end_comps; | |
| 17 | - | int ppms, bpms, cpms; | |
| 18 | - | }; | |
| 19 | - | ||
| 20 | - | static const struct dim_calc_stats_case dim_calc_stats_cases[] = { | |
| 21 | - | { | |
| 22 | - | .name = "small", | |
| 23 | - | .delta_us = 1000, | |
| 24 | - | .end_pkts = 640, .end_bytes = 640 * 1500, .end_comps = 64, | |
| 25 | - | .ppms = 640, .bpms = 960000, .cpms = 64, | |
| 26 | - | }, | |
| 27 | - | { | |
| 28 | - | .name = "round_up", | |
| 29 | - | .delta_us = 3000, | |
| 30 | - | .end_pkts = 10, .end_bytes = 10, .end_comps = 1, | |
| 31 | - | .ppms = 4, .bpms = 4, .cpms = 1, | |
| 32 | - | }, | |
| 33 | - | { | |
| 34 | - | .name = "counter_wrap", | |
| 35 | - | .delta_us = 1000, | |
| 36 | - | .start_pkts = 0xffffff00, .end_pkts = 0x100, | |
| 37 | - | .start_bytes = 0xfffff000, .end_bytes = 0x1000, | |
| 38 | - | .start_comps = 0xfffffff0, .end_comps = 0x10, | |
| 39 | - | .ppms = 0x200, .bpms = 0x2000, .cpms = 0x20, | |
| 40 | - | }, | |
| 41 | - | { | |
| 42 | - | /* 30 MB in 10 ms (24 Gbit/s): nbytes * 1000 exceeds 32 bits */ | |
| 43 | - | .name = "many_bytes", | |
| 44 | - | .delta_us = 10000, | |
| 45 | - | .end_pkts = 20000, .end_bytes = 30000000, .end_comps = 64, | |
| 46 | - | .ppms = 2000, .bpms = 3000000, .cpms = 7, | |
| 47 | - | }, | |
| 48 | - | { | |
| 49 | - | /* 4.3 MB in 16 ms (2.15 Gbit/s), just above the 32-bit limit */ | |
| 50 | - | .name = "bytes_32bit_limit", | |
| 51 | - | .delta_us = 16000, | |
| 52 | - | .end_pkts = 2900, .end_bytes = 4300000, .end_comps = 64, | |
| 53 | - | .ppms = 182, .bpms = 268750, .cpms = 4, | |
| 54 | - | }, | |
| 55 | - | { | |
| 56 | - | /* 5 MB in 40 ms: a 1 Gbit/s link at line rate */ | |
| 57 | - | .name = "gigabit", | |
| 58 | - | .delta_us = 40000, | |
| 59 | - | .end_pkts = 3300, .end_bytes = 5000000, .end_comps = 64, | |
| 60 | - | .ppms = 83, .bpms = 125000, .cpms = 2, | |
| 61 | - | }, | |
| 62 | - | { | |
| 63 | - | /* 5 million packets and completions in 2 s */ | |
| 64 | - | .name = "many_packets", | |
| 65 | - | .delta_us = 2000000, | |
| 66 | - | .end_pkts = 5000000, .end_bytes = 5000000, .end_comps = 5000000, | |
| 67 | - | .ppms = 2500, .bpms = 2500, .cpms = 2500, | |
| 68 | - | }, | |
| 69 | - | }; | |
| 70 | - | ||
| 71 | - | static void dim_calc_stats_case_desc(const struct dim_calc_stats_case *t, | |
| 72 | - | char *desc) | |
| 73 | - | { | |
| 74 | - | strscpy(desc, t->name, KUNIT_PARAM_DESC_SIZE); | |
| 75 | - | } | |
| 76 | - | ||
| 77 | - | KUNIT_ARRAY_PARAM(dim_calc_stats, dim_calc_stats_cases, | |
| 78 | - | dim_calc_stats_case_desc); | |
| 79 | - | ||
| 80 | - | static void dim_calc_stats_test(struct kunit *test) | |
| 81 | - | { | |
| 82 | - | const struct dim_calc_stats_case *t = test->param_value; | |
| 83 | - | struct dim_sample start = {}, end = {}; | |
| 84 | - | struct dim_stats stats = {}; | |
| 85 | - | ||
| 86 | - | dim_update_sample_with_comps(0, t->start_pkts, t->start_bytes, | |
| 87 | - | t->start_comps, &start); | |
| 88 | - | dim_update_sample_with_comps(DIM_NEVENTS, t->end_pkts, t->end_bytes, | |
| 89 | - | t->end_comps, &end); | |
| 90 | - | /* dim_update_sample() stamps ktime_get(); use fixed times instead */ | |
| 91 | - | start.time = ktime_set(1000, 0); | |
| 92 | - | end.time = ktime_add_us(start.time, t->delta_us); | |
| 93 | - | ||
| 94 | - | KUNIT_ASSERT_TRUE(test, dim_calc_stats(&start, &end, &stats)); | |
| 95 | - | KUNIT_EXPECT_EQ(test, stats.ppms, t->ppms); | |
| 96 | - | KUNIT_EXPECT_EQ(test, stats.bpms, t->bpms); | |
| 97 | - | KUNIT_EXPECT_EQ(test, stats.cpms, t->cpms); | |
| 98 | - | KUNIT_EXPECT_EQ(test, stats.epms, | |
| 99 | - | (int)DIV_ROUND_UP(DIM_NEVENTS * USEC_PER_MSEC, | |
| 100 | - | t->delta_us)); | |
| 101 | - | } | |
| 102 | - | ||
| 103 | - | static void dim_calc_stats_no_time_test(struct kunit *test) | |
| 104 | - | { | |
| 105 | - | struct dim_sample sample = {}; | |
| 106 | - | struct dim_stats stats = {}; | |
| 107 | - | ||
| 108 | - | dim_update_sample_with_comps(0, 100, 1000, 10, &sample); | |
| 109 | - | KUNIT_EXPECT_FALSE(test, dim_calc_stats(&sample, &sample, &stats)); | |
| 110 | - | } | |
| 111 | - | ||
| 112 | - | static struct kunit_case dim_test_cases[] = { | |
| 113 | - | KUNIT_CASE_PARAM(dim_calc_stats_test, dim_calc_stats_gen_params), | |
| 114 | - | KUNIT_CASE(dim_calc_stats_no_time_test), | |
| 115 | - | {} | |
| 116 | - | }; | |
| 117 | - | ||
| 118 | - | static struct kunit_suite dim_test_suite = { | |
| 119 | - | .name = "dim", | |
| 120 | - | .test_cases = dim_test_cases, | |
| 121 | - | }; | |
| 122 | - | ||
| 123 | - | kunit_test_suite(dim_test_suite); | |
| 124 | - | ||
| 125 | - | MODULE_DESCRIPTION("KUnit tests for the DIM library"); | |
| 126 | - | MODULE_LICENSE("GPL"); | |
modified mm/damon/core.c
| @@ -3147,7 +3147,7 @@ static void damos_adjust_quota(struct damon_ctx *c, struct damos *s) | |||
| 3147 | 3147 | unsigned long cumulated_sz, cached_esz; | |
| 3148 | 3148 | unsigned int score, max_score = 0; | |
| 3149 | 3149 | ||
| 3150 | - | if (!damos_quota_is_set(quota)) | |
| 3150 | + | if (!quota->ms && !quota->sz && list_empty("a->goals)) | |
| 3151 | 3151 | return; | |
| 3152 | 3152 | ||
| 3153 | 3153 | /* First charge window */ | |
modified mm/kasan/common.c
| @@ -114,23 +114,12 @@ void kasan_unpoison_task_stack(struct task_struct *task) | |||
| 114 | 114 | /* Unpoison the stack for the current task beyond a watermark sp value. */ | |
| 115 | 115 | asmlinkage void kasan_unpoison_task_stack_below(const void *watermark) | |
| 116 | 116 | { | |
| 117 | - | void *base; | |
| 118 | - | ||
| 119 | - | /* | |
| 120 | - | * Only the generic mode needs this. In the tag-based mode the | |
| 121 | - | * compiler fully initializes the shadow of stack variables on | |
| 122 | - | * function entry, so stale tags left below the watermark are | |
| 123 | - | * harmless. | |
| 124 | - | */ | |
This diff is too large to show in full - only the first part is shown.