Compare
2f46e80fa993fdee5e4fc5da80436e3e21bc2bd0..5e0ed1108504dae408e8cfaabf7ee5f7bb180bca
Revert "dma-buf: Make DMABUF_DEBUG default to y on DEBUG_KERNEL kernels"
This reverts commit 143755bdabaa96776c24f878014608e9cb44f930. That commit fixed a dangling reference in the DMABUF_DEBUG default and thereby enabled the option - and with it the page-stripping sg_table wrapper that dma_buf_map_attachment() hands to importers - on every kernel with DEBUG_KERNEL=y, i.e. virtually every distro kernel. drm/msm is broken by the wrapper. Both of msm's map paths consume sg->length and sg_phys() of the attachment sg_table: msm_iommu_pagetable_map() for the per-process GPU pagetables, and iommu_map_sg() (via iommu_map_sgtable()) for scanout. The wrapper zeroes sg->length and strips the page pointers, so mappings of imported dma-bufs silently map nothing, and userspace observes arm-smmu translation faults from UCHE, e.g. during hardware video decode (clapper, chromium) on Adreno systems: gpu fault: ttbr0=000000088a889000 iova=000000010741c000 dir=READ type=TRANSLATION source=UCHE Bisected on a Snapdragon X1E78100 laptop as v7.3-rc3 good, v7.3-rc4 bad, culprit 143755bdabaa9. Switching msm to sg_dma_address()/sg_dma_len() is not a trivial fix either: those fields are only valid for sg_tables that msm has dma-mapped itself, which native non-MSM_BO_WC objects' sg_tables are not, so the conversion needs more work. The msm maintainer has therefore requested restoring the previous default for v7.3, to be revisited once msm no longer consumes struct page and sg->length of imported sg_tables. Link: https://lore.kernel.org/linux-arm-msm/20260923074256.9357-1-liujianfeng1994@gmail.com/ Suggested-by: Rob Clark <robin.clark@oss.qualcomm.com> Cc: Christian König <christian.koenig@amd.com> Cc: Sumit Semwal <sumit.semwal@linaro.org> Cc: Karl Mehltretter <kmehltretter@gmail.com> Signed-off-by: Jianfeng Liu <liujianfeng1994@gmail.com> Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org> [sumits: as discussed on https://lore.kernel.org/all/CAO_48GEh1p52pA_-NE=rN=_NQ=oAXpeHgHGVZCH6uPnFq7G1gQ@mail.gmail.com/ applying this revert for 7.3 unblock] Link: https://patch.msgid.link/20260926022026.10539-1-liujianfeng1994@gmail.com
Jianfeng Liu <liujianfeng1994@gmail.com> · 2026-09-26 02:20 UTC · committed by Sumit Semwal
681 files changed,
+3331
−8467
- .get_maintainer.ignore
- .mailmap
- Documentation/ABI/testing/sysfs-devices-platform-trackpoint
- Documentation/admin-guide/kernel-parameters.txt
- Documentation/arch/arm64/booting.rst
- Documentation/arch/arm64/memory-tagging-extension.rst
- Documentation/arch/s390/pci.rst
- Documentation/bpf/kfuncs.rst
- Documentation/devicetree/bindings/display/msm/qcom,qcs8300-mdss.yaml
- Documentation/devicetree/bindings/display/msm/qcom,sar2130p-mdss.yaml
- Documentation/devicetree/bindings/display/msm/qcom,sm6150-dpu.yaml
- Documentation/devicetree/bindings/display/msm/qcom,sm8350-mdss.yaml
- Documentation/devicetree/bindings/display/msm/qcom,x1e80100-mdss.yaml
- Documentation/devicetree/bindings/input/mediatek,mt6779-keypad.yaml
- Documentation/devicetree/bindings/pinctrl/qcom,nord-tlmm.yaml
- Documentation/hwmon/cgbc-hwmon.rst
- Documentation/netlink/specs/netdev.yaml
- Documentation/netlink/specs/rt-neigh.yaml
- Documentation/networking/ip-sysctl.rst
- Documentation/trace/events-landlock.rst
- MAINTAINERS
- Makefile
- arch/arm/mach-socfpga/Kconfig
- arch/arm64/boot/dts/altera/socfpga_stratix10_socdk.dtsi
- arch/arm64/boot/dts/altera/socfpga_stratix10_socdk_emmc.dts
- arch/arm64/boot/dts/amlogic/amlogic-t7-a311d2-an400.dts
- arch/arm64/boot/dts/amlogic/amlogic-t7-a311d2-khadas-vim4.dts
- arch/arm64/boot/dts/amlogic/amlogic-t7.dtsi
- 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/boot/dts/renesas/r8a779f0.dtsi
- arch/arm64/boot/dts/renesas/r9a09g047.dtsi
- arch/arm64/boot/dts/renesas/r9a09g056.dtsi
- arch/arm64/boot/dts/renesas/r9a09g057.dtsi
- arch/arm64/boot/dts/renesas/r9a09g077.dtsi
- arch/arm64/boot/dts/renesas/r9a09g087.dtsi
- arch/arm64/include/asm/el2_setup.h
- arch/arm64/include/asm/io.h
- arch/arm64/include/asm/kvm_host.h
- arch/arm64/include/asm/kvm_nested.h
- arch/arm64/include/asm/kvm_pkvm.h
- arch/arm64/include/asm/percpu.h
- arch/arm64/kernel/cpu_errata.c
- arch/arm64/kernel/hibernate-asm.S
- arch/arm64/kernel/hibernate.c
- arch/arm64/kernel/mte.c
- arch/arm64/kernel/pi/idreg-override.c
- arch/arm64/kvm/arm.c
- arch/arm64/kvm/emulate-nested.c
- arch/arm64/kvm/hyp/include/nvhe/mem_protect.h
- arch/arm64/kvm/hyp/include/nvhe/mm.h
- arch/arm64/kvm/hyp/nvhe/mem_protect.c
- arch/arm64/kvm/hyp/nvhe/mm.c
- arch/arm64/kvm/hyp/nvhe/pkvm.c
- arch/arm64/kvm/hyp/nvhe/setup.c
- arch/arm64/kvm/hypercalls.c
- arch/arm64/kvm/mmu.c
- arch/arm64/kvm/nested.c
- arch/arm64/kvm/sys_regs.c
- arch/arm64/kvm/vgic/vgic-its.c
- arch/arm64/net/bpf_jit_comp.c
- arch/mips/Kconfig
- arch/mips/cavium-octeon/octeon-platform.c
- arch/mips/configs/econet_en751221_defconfig
- arch/mips/net/bpf_jit_comp32.c
- arch/mips/net/bpf_jit_comp64.c
- arch/parisc/include/asm/compat_ucontext.h
- arch/parisc/include/asm/thread_info.h
- arch/parisc/kernel/setup.c
- arch/parisc/kernel/unwind.c
- arch/powerpc/kernel/iommu.c
- arch/powerpc/kvm/book3s_hv_nested.c
- arch/powerpc/kvm/book3s_hv_uvmem.c
- arch/riscv/boot/dts/microchip/mpfs-beaglev-fire.dts
- arch/riscv/include/asm/csr.h
- arch/riscv/kvm/aia_imsic.c
- arch/riscv/kvm/mmu.c
- arch/riscv/kvm/nacl.c
- arch/riscv/kvm/vcpu.c
- arch/riscv/kvm/vcpu_exit.c
- arch/riscv/kvm/vcpu_onereg.c
- arch/riscv/kvm/vcpu_pmu.c
- arch/riscv/kvm/vcpu_sbi_hsm.c
- arch/riscv/kvm/vcpu_timer.c
- arch/s390/crypto/hmac_s390.c
- arch/s390/include/asm/debug.h
- arch/s390/kernel/debug.c
- arch/s390/kernel/uv.c
- arch/s390/kvm/gmap/dat.c
- arch/s390/kvm/gmap/dat.h
- arch/s390/kvm/gmap/gmap.c
- arch/s390/kvm/gmap/kvm_mmu.c
- arch/s390/kvm/gmap/kvm_mmu.h
- arch/s390/kvm/s390/gaccess.c
- arch/s390/kvm/s390/interrupt.c
- arch/s390/kvm/s390/s390.c
- arch/s390/kvm/s390/s390.h
- arch/s390/pci/pci_event.c
- arch/s390/pci/pci_report.c
- arch/s390/pci/pci_report.h
- arch/x86/Kconfig.cpu
- arch/x86/Makefile
- arch/x86/coco/sev/svsm.c
- arch/x86/entry/entry_fred.c
- arch/x86/events/amd/brs.c
- arch/x86/events/amd/lbr.c
- arch/x86/events/intel/core.c
- arch/x86/events/intel/ds.c
- arch/x86/events/intel/lbr.c
- arch/x86/events/perf_event.h
- arch/x86/include/asm/div64.h
- arch/x86/include/asm/pgtable.h
- arch/x86/include/asm/text-patching.h
- arch/x86/kernel/alternative.c
- arch/x86/kernel/amd_node.c
- arch/x86/kernel/cpu/mce/core.c
- arch/x86/kernel/cpu/microcode/intel.c
- arch/x86/kernel/kprobes/core.c
- arch/x86/kvm/mmu/mmu.c
- arch/x86/kvm/pmu.c
- arch/x86/kvm/svm/nested.c
- arch/x86/kvm/svm/sev.c
- arch/x86/kvm/vmx/nested.c
- arch/x86/kvm/vmx/pmu_intel.c
- arch/x86/kvm/vmx/tdx.c
- arch/x86/kvm/x86.c
- arch/x86/mm/mem_encrypt.c
- arch/x86/mm/pat/set_memory.c
- arch/x86/pci/fixup.c
- block/blk-zoned.c
- drivers/accel/amdxdna/Kconfig
- drivers/accel/rocket/rocket_device.c
- drivers/accel/rocket/rocket_device.h
- drivers/accel/rocket/rocket_drv.c
- drivers/accel/rocket/rocket_job.c
- drivers/ata/libahci.c
- drivers/ata/libahci_platform.c
- drivers/ata/libata-core.c
- drivers/ata/libata-scsi.c
- drivers/base/cacheinfo.c
- drivers/bluetooth/btintel_pcie.c
- drivers/bluetooth/btmtk.c
- drivers/bluetooth/btmtksdio.c
- drivers/bluetooth/btmtkuart.c
- drivers/bluetooth/btnxpuart.c
- drivers/bluetooth/btusb.c
- drivers/bluetooth/hci_qca.c
- drivers/clk/clk-scpi.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/crypto/caam/jr.c
- drivers/dma-buf/Kconfig
- drivers/dma/dmaengine.c
- drivers/dma/mmp_pdma.c
- drivers/dma/pxa_dma.c
- drivers/dma/sprd-dma.c
- drivers/dma/sun6i-dma.c
- drivers/dma/ti/k3-udma-glue.c
- drivers/dma/xilinx/xilinx_dma.c
- drivers/dpll/dpll_netlink.c
- drivers/firewire/core-cdev.c
- drivers/firmware/arm_ffa/driver.c
- drivers/firmware/arm_scmi/driver.c
- drivers/firmware/arm_scpi.c
- drivers/gpio/gpio-arizona.c
- drivers/gpio/gpio-mvebu.c
- drivers/gpio/gpio-tps65219.c
- drivers/gpio/gpio-virtuser.c
- drivers/gpio/gpio-zynq.c
- drivers/gpio/gpiolib-cdev.c
- drivers/gpio/gpiolib-of.c
- drivers/gpio/gpiolib-shared.c
- drivers/gpio/gpiolib.c
- drivers/gpu/drm/amd/amdgpu/amdgpu.h
- drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
- drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
- drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c
- drivers/gpu/drm/amd/amdgpu/amdgpu_eviction_fence.c
- drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
- drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
- drivers/gpu/drm/amd/amdgpu/amdgpu_userq.h
- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
- drivers/gpu/drm/amd/amdgpu/nbio_v7_9.c
- drivers/gpu/drm/amd/amdgpu/vcn_v4_0_3.c
- drivers/gpu/drm/amd/amdgpu/vcn_v5_0_1.c
- drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
- drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
- drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c
- drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v11.c
- drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v12.c
- drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v12_1.c
- drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c
- drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_vi.c
- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c
- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_irq.c
- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_irq.h
- drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_crtc_test.c
- drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_helpers_test.c
- drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_irq_test.c
- drivers/gpu/drm/amd/display/dc/dml/Makefile
- drivers/gpu/drm/amd/display/dc/dml2_0/Makefile
- drivers/gpu/drm/amd/display/dc/hwss/dcn30/dcn30_hwseq.c
- drivers/gpu/drm/amd/display/dc/hwss/dcn50/dcn50_hwseq.c
- drivers/gpu/drm/amd/display/dc/hwss/dcn60/dcn60_hwseq.c
- drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c
- drivers/gpu/drm/aspeed/aspeed_gfx_drv.c
- drivers/gpu/drm/bridge/th1520-dw-hdmi.c
- drivers/gpu/drm/ci/xfails/msm-apq8016-fails.txt
- 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_cursor.c
- drivers/gpu/drm/i915/display/intel_display_types.h
- drivers/gpu/drm/i915/display/intel_dp_link_caps.c
- drivers/gpu/drm/i915/display/intel_dp_link_training.c
- drivers/gpu/drm/i915/display/intel_dp_mst.c
- drivers/gpu/drm/i915/display/intel_dp_mst.h
- drivers/gpu/drm/i915/display/intel_link_bw.c
- drivers/gpu/drm/i915/display/intel_psr.c
- drivers/gpu/drm/i915/display/intel_quirks.c
- drivers/gpu/drm/i915/display/skl_universal_plane.c
- drivers/gpu/drm/i915/gem/i915_gem_object.c
- drivers/gpu/drm/imagination/pvr_mmu.c
- drivers/gpu/drm/imagination/pvr_vm.c
- drivers/gpu/drm/msm/Makefile
- drivers/gpu/drm/msm/adreno/a6xx_gmu.c
- drivers/gpu/drm/msm/adreno/a6xx_gpu.c
- drivers/gpu/drm/msm/adreno/adreno_device.c
- drivers/gpu/drm/msm/adreno/adreno_gpu.c
- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c
- drivers/gpu/drm/msm/dp/dp_display.c
- drivers/gpu/drm/msm/dsi/dsi_host.c
- drivers/gpu/drm/msm/hdmi/hdmi_phy.c
- drivers/gpu/drm/msm/msm_drv.c
- drivers/gpu/drm/msm/msm_fbdev.c
- drivers/gpu/drm/msm/msm_gem.h
- drivers/gpu/drm/msm/msm_gem_vma.c
- drivers/gpu/drm/msm/msm_ringbuffer.c
- drivers/gpu/drm/msm/msm_ringbuffer.h
- drivers/gpu/drm/msm/registers/adreno/a6xx_gmu.xml
- 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/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_hdmi.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/virtio/virtgpu_plane.c
- drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c
- drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
- drivers/gpu/drm/xe/regs/xe_gt_regs.h
- drivers/gpu/drm/xe/xe_bo.c
- drivers/gpu/drm/xe/xe_bo.h
- drivers/gpu/drm/xe/xe_gt_throttle.c
- drivers/gpu/drm/xe/xe_guc_ads.c
- drivers/gpu/drm/xe/xe_hw_engine.c
- drivers/gpu/drm/xe/xe_i2c.c
- drivers/gpu/drm/xe/xe_mmio_gem.c
- drivers/gpu/drm/xe/xe_mmio_gem.h
- drivers/gpu/drm/xe/xe_shrinker.c
- drivers/gpu/drm/xe/xe_tlb_inval.c
- drivers/gpu/drm/xe/xe_vm.c
- drivers/gpu/drm/xe/xe_wa_oob.rules
- drivers/hid/Kconfig
- drivers/hid/amd-sfh-hid/amd_sfh_common.h
- drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
- drivers/hid/bpf/hid_bpf_dispatch.c
- drivers/hid/hid-alps.c
- drivers/hid/hid-corsair-void.c
- drivers/hid/hid-elecom.c
- drivers/hid/hid-ids.h
- drivers/hid/hid-logitech-hidpp.c
- drivers/hid/hid-multitouch.c
- drivers/hid/hid-oxp.c
- drivers/hid/hid-quirks.c
- drivers/hid/hid-roccat.c
- drivers/hid/hid-steelseries-arctis.c
- drivers/hid/hid-winwing.c
- drivers/hid/i2c-hid/i2c-hid-core.c
- drivers/hid/wacom_sys.c
- drivers/hwmon/cgbc-hwmon.c
- drivers/hwmon/gpio-fan.c
- drivers/hwmon/hp-wmi-sensors.c
- drivers/hwmon/k10temp.c
- drivers/hwmon/pmbus/pmbus.h
- drivers/hwmon/pmbus/tps53679.c
- drivers/hwmon/pwm-fan.c
- drivers/hwmon/w83791d.c
- drivers/hwmon/w83793.c
- drivers/i2c/busses/i2c-at91-core.c
- drivers/i2c/busses/i2c-at91-master.c
- drivers/i2c/busses/i2c-at91.h
- drivers/i2c/busses/i2c-imx.c
- drivers/i2c/busses/i2c-qcom-cci.c
- drivers/i2c/busses/i2c-qcom-geni.c
- drivers/i2c/i2c-atr.c
- drivers/infiniband/core/iwpm_util.c
- drivers/infiniband/core/mad.c
- drivers/infiniband/core/rdma_core.c
- drivers/infiniband/core/ucma.c
- drivers/infiniband/core/uverbs_flow.c
- drivers/infiniband/core/uverbs_main.c
- drivers/infiniband/core/verbs.c
- drivers/infiniband/hw/bnxt_re/main.c
- drivers/infiniband/hw/bnxt_re/uapi.c
- drivers/infiniband/hw/efa/efa_com.c
- drivers/infiniband/hw/efa/efa_com.h
- drivers/infiniband/hw/efa/efa_main.c
- drivers/infiniband/hw/erdma/erdma_main.c
- drivers/infiniband/hw/erdma/erdma_verbs.c
- drivers/infiniband/hw/hfi1/file_ops.c
- drivers/infiniband/hw/irdma/verbs.c
- drivers/infiniband/hw/mlx4/sysfs.c
- drivers/infiniband/hw/mlx5/main.c
- drivers/infiniband/sw/rxe/rxe_mcast.c
- drivers/infiniband/sw/rxe/rxe_mr.c
- drivers/infiniband/sw/rxe/rxe_odp.c
- drivers/infiniband/sw/rxe/rxe_verbs.c
- drivers/infiniband/sw/siw/siw_cm.c
- drivers/infiniband/sw/siw/siw_qp_rx.c
- drivers/infiniband/ulp/ipoib/ipoib.h
- drivers/infiniband/ulp/ipoib/ipoib_ib.c
- drivers/infiniband/ulp/ipoib/ipoib_multicast.c
- drivers/infiniband/ulp/iser/iser_initiator.c
- drivers/infiniband/ulp/isert/ib_isert.c
- drivers/infiniband/ulp/isert/ib_isert.h
- drivers/infiniband/ulp/rtrs/rtrs-clt-trace.h
- drivers/infiniband/ulp/rtrs/rtrs-clt.c
- drivers/infiniband/ulp/rtrs/rtrs-clt.h
- drivers/infiniband/ulp/rtrs/rtrs-srv-trace.h
- drivers/infiniband/ulp/srp/ib_srp.c
- drivers/input/evdev.c
- drivers/input/input-compat.c
- drivers/input/joystick/xpad.c
- drivers/input/keyboard/adp5588-keys.c
- drivers/input/keyboard/atkbd.c
- drivers/input/misc/soc_button_array.c
- drivers/input/mouse/synaptics.c
- drivers/input/rmi4/rmi_driver.c
- drivers/input/rmi4/rmi_smbus.c
- drivers/input/serio/hp_sdc.c
- drivers/input/serio/i8042-acpipnpio.h
- drivers/input/touchscreen/cyttsp5.c
- drivers/input/touchscreen/eeti_ts.c
- drivers/input/touchscreen/tsc2007_core.c
- drivers/memstick/core/ms_block.c
- drivers/mmc/core/bus.c
- drivers/mmc/core/host.c
- drivers/mmc/core/sdio_uart.c
- drivers/mmc/host/mmc_hsq.c
- drivers/mmc/host/mmc_spi.c
- drivers/mmc/host/mmci.c
- drivers/mmc/host/mxcmmc.c
- drivers/mmc/host/rtsx_pci_sdmmc.c
- drivers/mmc/host/sdhci-of-aspeed.c
- drivers/mmc/host/sdhci_am654.c
- drivers/mmc/host/sh_mmcif.c
- drivers/net/bonding/bond_main.c
- drivers/net/dsa/mt7530-mdio.c
- drivers/net/dsa/mt7530.c
- drivers/net/dsa/mv88e6xxx/chip.c
- drivers/net/dsa/mxl862xx/mxl862xx.c
- drivers/net/ethernet/airoha/airoha_npu.c
- drivers/net/ethernet/amazon/ena/ena_netdev.c
- drivers/net/ethernet/atheros/atl1c/atl1c_main.c
- drivers/net/ethernet/atheros/atl1e/atl1e_main.c
- drivers/net/ethernet/atheros/atlx/atl1.c
- drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
- drivers/net/ethernet/broadcom/genet/bcmgenet.c
- drivers/net/ethernet/broadcom/tg3.c
- drivers/net/ethernet/brocade/bna/bnad.c
- drivers/net/ethernet/cadence/macb_main.c
- drivers/net/ethernet/cadence/macb_ptp.c
- drivers/net/ethernet/cortina/gemini.c
- drivers/net/ethernet/freescale/fman/fman.c
- drivers/net/ethernet/google/gve/gve_desc_dqo.h
- drivers/net/ethernet/google/gve/gve_tx_dqo.c
- drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c
- drivers/net/ethernet/ibm/emac/core.c
- drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
- drivers/net/ethernet/marvell/octeontx2/af/common.h
- drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c
- drivers/net/ethernet/mediatek/mtk_eth_soc.c
- drivers/net/ethernet/mellanox/mlx5/core/en/rep/bridge.c
- drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c
- drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.c
- drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c
- drivers/net/ethernet/mellanox/mlx5/core/en_main.c
- drivers/net/ethernet/mellanox/mlx5/core/esw/bridge.c
- drivers/net/ethernet/mellanox/mlx5/core/esw/bridge.h
- drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c
- drivers/net/ethernet/mellanox/mlx5/core/lag/shared_fdb.c
- drivers/net/ethernet/mellanox/mlx5/core/lib/devcom.c
- drivers/net/ethernet/meta/fbnic/fbnic_csr.h
- drivers/net/ethernet/meta/fbnic/fbnic_debugfs.c
- drivers/net/ethernet/meta/fbnic/fbnic_ethtool.c
- drivers/net/ethernet/meta/fbnic/fbnic_fw.c
- drivers/net/ethernet/meta/fbnic/fbnic_fw.h
- drivers/net/ethernet/meta/fbnic/fbnic_pci.c
- drivers/net/ethernet/meta/fbnic/fbnic_txrx.c
- drivers/net/ethernet/meta/fbnic/fbnic_txrx.h
- drivers/net/ethernet/microchip/lan743x_main.c
- drivers/net/ethernet/netronome/nfp/crypto/ipsec.c
- drivers/net/ethernet/sfc/efx.c
- drivers/net/ethernet/socionext/netsec.c
- drivers/net/ethernet/spacemit/k1_emac.c
- drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
- drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
- drivers/net/ethernet/stmicro/stmmac/hwif.h
- drivers/net/ethernet/stmicro/stmmac/ring_mode.c
- drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
- drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c
- drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
- drivers/net/ethernet/ti/netcp_core.c
- drivers/net/ethernet/wangxun/libwx/wx_hw.c
- drivers/net/ethernet/wangxun/libwx/wx_lib.c
- drivers/net/ethernet/wangxun/libwx/wx_ptp.c
- drivers/net/ethernet/wangxun/libwx/wx_type.h
- drivers/net/ethernet/wangxun/txgbe/txgbe_fdir.c
- drivers/net/fddi/skfp/skfddi.c
- drivers/net/macsec.c
- drivers/net/mdio/mdio-realtek-rtl9300.c
- drivers/net/ovpn/netlink.c
- drivers/net/ovpn/peer.c
- drivers/net/ovpn/peer.h
- drivers/net/ovpn/udp.c
- drivers/net/pcs/pcs-rzn1-miic.c
- drivers/net/pcs/pcs-xpcs.c
- drivers/net/phy/intel-xway.c
- drivers/net/phy/mediatek/mtk-phy-lib.c
- drivers/net/phy/micrel.c
- drivers/net/phy/phylink.c
- drivers/net/usb/catc.c
- drivers/net/usb/cdc_mbim.c
- drivers/net/usb/lan78xx.c
- drivers/net/usb/qmi_wwan.c
- drivers/net/usb/sr9700.c
- drivers/net/veth.c
- drivers/net/virtio_net.c
- drivers/net/vrf.c
- drivers/net/vxlan/vxlan_core.c
- drivers/net/wireless/ath/ath11k/mac.c
- drivers/net/wireless/ath/ath12k/wifi7/ahb.c
- drivers/net/wireless/ath/wcn36xx/dxe.c
- drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
- drivers/net/wireless/broadcom/brcm80211/brcmfmac/cyw/core.c
- drivers/net/wireless/broadcom/brcm80211/brcmsmac/mac80211_if.c
- drivers/net/wireless/intel/ipw2x00/ipw2100.c
- drivers/net/wireless/intel/ipw2x00/ipw2200.c
- drivers/net/wireless/intel/ipw2x00/libipw_crypto_tkip.c
- drivers/net/wireless/intel/ipw2x00/libipw_rx.c
- drivers/net/wireless/intel/iwlegacy/common.c
- drivers/net/wireless/intersil/p54/eeprom.c
- drivers/net/wireless/marvell/libertas_tf/main.c
- drivers/net/wireless/marvell/mwifiex/cfg80211.c
- drivers/net/wireless/marvell/mwifiex/pcie.c
- drivers/net/wireless/marvell/mwifiex/scan.c
- drivers/net/wireless/marvell/mwifiex/util.c
- drivers/net/wireless/microchip/wilc1000/cfg80211.c
- drivers/net/wireless/microchip/wilc1000/wlan.c
- drivers/net/wireless/rsi/rsi_91x_mgmt.c
- drivers/net/wireless/ti/wlcore/main.c
- drivers/net/wireless/virtual/mac80211_hwsim_main.c
- drivers/net/wireless/virtual/virt_wifi.c
- drivers/net/wwan/mhi_wwan_mbim.c
- drivers/net/wwan/t7xx/t7xx_netdev.c
- drivers/nfc/microread/microread.c
- drivers/nfc/nfcmrvl/fw_dnld.c
- drivers/nfc/pn533/pn533.c
- drivers/nfc/pn533/pn533.h
- drivers/nfc/pn533/usb.c
- drivers/nfc/pn544/pn544.c
- drivers/nfc/port100.c
- drivers/nfc/st21nfca/core.c
- drivers/nfc/st21nfca/i2c.c
- drivers/nfc/trf7970a.c
- drivers/nfc/virtual_ncidev.c
- drivers/pci/controller/dwc/pci-imx6.c
- drivers/pci/of_property.c
- drivers/pci/setup-bus.c
- drivers/perf/arm-cmn.c
- drivers/perf/arm_brbe.c
- drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c
- drivers/phy/mediatek/phy-mtk-hdmi-mt8195.h
- drivers/phy/renesas/phy-rcar-gen3-usb2.c
- drivers/pinctrl/meson/pinctrl-meson-s4.c
- drivers/pinctrl/microchip/pinctrl-mpfs-mssio.c
- drivers/pinctrl/pinctrl-generic.c
- drivers/pinctrl/pinctrl-single.c
- drivers/pinctrl/qcom/pinctrl-ipq5210.c
- drivers/pinctrl/qcom/pinctrl-nord.c
- drivers/pinctrl/sunxi/pinctrl-sun55i-a523-r.c
- drivers/pinctrl/sunxi/pinctrl-sun55i-a523.c
- drivers/pinctrl/sunxi/pinctrl-sunxi.c
- drivers/pinctrl/sunxi/pinctrl-sunxi.h
- drivers/pinctrl/tegra/pinctrl-tegra238.c
- drivers/power/sequencing/Kconfig
- drivers/power/sequencing/core.c
- drivers/remoteproc/qcom_q6v5_adsp.c
- drivers/remoteproc/qcom_q6v5_mss.c
- drivers/remoteproc/qcom_q6v5_pas.c
- drivers/s390/block/dasd_3990_erp.c
- drivers/s390/block/dasd_eckd.c
- drivers/s390/char/raw3270.c
- drivers/s390/char/vmlogrdr.c
- drivers/s390/cio/chp.c
- drivers/s390/cio/cio.c
- drivers/s390/cio/cio.h
- drivers/s390/cio/cmf.c
- drivers/s390/cio/device.c
- drivers/s390/cio/device_fsm.c
- drivers/s390/cio/device_ops.c
- drivers/s390/cio/vfio_ccw_fsm.c
- drivers/s390/crypto/vfio_ap_ops.c
- drivers/scsi/Kconfig
- drivers/scsi/fnic/fnic.h
- drivers/scsi/fnic/fnic_isr.c
- drivers/scsi/fnic/fnic_main.c
- drivers/scsi/leapraid/leapraid_func.h
- drivers/scsi/leapraid/leapraid_os.c
- drivers/scsi/libiscsi_tcp.c
- drivers/scsi/megaraid/megaraid_sas_base.c
- drivers/scsi/pm8001/pm8001_init.c
- drivers/scsi/qla2xxx/qla_os.c
- drivers/scsi/scsi.c
- drivers/scsi/scsi_devinfo.c
- drivers/scsi/sd_zbc.c
- drivers/soc/samsung/exynos-pmu.c
- drivers/soc/tegra/fuse/tegra-apbmisc.c
- drivers/soc/tegra/pmc.c
- drivers/soundwire/cadence_master.c
- drivers/soundwire/dmi-quirks.c
- drivers/spi/spi-fsl-qspi.c
- drivers/spi/spi-qpic-snand.c
- drivers/spi/spi-virtio.c
- drivers/spi/spi-zynqmp-gqspi.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/thermal/gov_step_wise.c
- drivers/ufs/core/ufshcd.c
- drivers/ufs/host/ufshcd-pltfrm.c
- drivers/watchdog/da9062_wdt.c
- drivers/watchdog/da9063_wdt.c
- drivers/watchdog/digicolor_wdt.c
- drivers/watchdog/msc313e_wdt.c
- drivers/watchdog/rtd119x_wdt.c
- drivers/watchdog/rzv2h_wdt.c
- drivers/watchdog/sp5100_tco.c
- drivers/watchdog/starfive-wdt.c
- fs/9p/vfs_addr.c
- fs/autofs/inode.c
- fs/binfmt_misc_bpf.c
- fs/bpf_fs_kfuncs.c
- fs/btrfs/dev-replace.c
- fs/btrfs/disk-io.c
- fs/btrfs/file.c
- fs/btrfs/free-space-tree.c
- fs/btrfs/inode.c
- fs/btrfs/super.c
- fs/btrfs/tree-checker.c
- fs/btrfs/verity.c
- fs/btrfs/volumes.c
- fs/btrfs/zoned.c
- fs/dax.c
- fs/dcache.c
- fs/debugfs/inode.c
- fs/exec.c
- fs/fs-writeback.c
- fs/inode.c
- fs/isofs/dir.c
- fs/isofs/namei.c
- fs/kernfs/mount.c
- fs/namespace.c
- fs/netfs/buffered_read.c
- fs/netfs/objects.c
- fs/netfs/read_collect.c
- fs/netfs/rolling_buffer.c
- fs/nfsd/export.c
- fs/ntfs/attrib.c
- fs/ntfs/attrib.h
- fs/ntfs/attrlist.c
- fs/ntfs/attrlist.h
- fs/ntfs/compress.c
- fs/ntfs/file.c
- fs/ntfs/inode.c
- fs/ntfs/mft.c
- fs/ntfs/mft.h
- fs/ntfs/namei.c
- fs/ntfs/super.c
- fs/ntfs/volume.h
- fs/ntfs3/inode.c
- fs/ocfs2/namei.c
- fs/ocfs2/xattr.c
- fs/ocfs2/xattr.h
- fs/overlayfs/overlayfs.h
- fs/smb/client/cached_dir.c
- fs/smb/client/cifssmb.c
- fs/smb/client/connect.c
- fs/smb/client/dfs_cache.c
- fs/smb/client/dir.c
- fs/smb/client/file.c
- fs/smb/client/misc.c
- fs/smb/client/reparse.c
- fs/smb/client/reparse.h
- fs/smb/client/sess.c
- fs/smb/client/smb2inode.c
- fs/smb/client/smb2misc.c
- fs/smb/client/smb2ops.c
- fs/smb/client/smb2pdu.c
- fs/smb/client/smb2pdu.h
- fs/smb/client/trace.h
- fs/smb/client/transport.c
- fs/smb/server/connection.c
- fs/smb/server/connection.h
- fs/smb/server/mgmt/user_session.c
- fs/smb/server/mgmt/user_session.h
- fs/smb/server/proc.c
- fs/smb/server/server.c
- fs/smb/server/smb2pdu.c
- fs/smb/server/smb2pdu.h
- fs/smb/server/stats.h
- fs/squashfs/xz_wrapper.c
- fs/super.c
- fs/xfs/libxfs/xfs_ag.h
- fs/xfs/libxfs/xfs_alloc.c
- fs/xfs/libxfs/xfs_attr_leaf.c
- fs/xfs/libxfs/xfs_errortag.h
- fs/xfs/libxfs/xfs_exchmaps.c
- fs/xfs/libxfs/xfs_format.h
- fs/xfs/libxfs/xfs_inode_buf.c
- fs/xfs/libxfs/xfs_metafile.c
- fs/xfs/libxfs/xfs_rtrefcount_btree.c
- fs/xfs/scrub/agheader_repair.c
- fs/xfs/scrub/alloc_repair.c
- fs/xfs/scrub/bitmap.c
- fs/xfs/scrub/dir.c
- fs/xfs/scrub/dirtree.c
- fs/xfs/scrub/findparent.c
- fs/xfs/scrub/health.c
- fs/xfs/scrub/inode.c
- fs/xfs/scrub/inode_repair.c
- fs/xfs/scrub/newbt.c
- fs/xfs/scrub/orphanage.c
- fs/xfs/scrub/reap.c
- fs/xfs/scrub/repair.c
- fs/xfs/scrub/rmap.c
- fs/xfs/scrub/rmap_repair.c
- fs/xfs/scrub/scrub.h
- fs/xfs/scrub/trace.h
- fs/xfs/xfs_bmap_item.c
- fs/xfs/xfs_dquot.c
- fs/xfs/xfs_exchrange.c
- fs/xfs/xfs_healthmon.c
- fs/xfs/xfs_icache.c
- fs/xfs/xfs_inode.c
- fs/xfs/xfs_log_cil.c
- fs/xfs/xfs_log_recover.c
- fs/xfs/xfs_platform.h
- fs/xfs/xfs_qm.c
- fs/xfs/xfs_refcount_item.c
- fs/xfs/xfs_reflink.h
modified .get_maintainer.ignore
| @@ -4,8 +4,6 @@ Alyssa Rosenzweig <alyssa@rosenzweig.io> | |||
| 4 | 4 | Askar Safin <safinaskar@gmail.com> | |
| 5 | 5 | Christoph Hellwig <hch@lst.de> | |
| 6 | 6 | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | |
| 7 | - | Johannes Berg <johannes.berg@intel.com> | |
| 8 | - | Johannes Berg <johannes@sipsolutions.net> | |
| 9 | 7 | Marc Gonzalez <marc.w.gonzalez@free.fr> | |
| 10 | 8 | Nathan Chancellor <nathan@kernel.org> | |
| 11 | 9 | Ralf Baechle <ralf@linux-mips.org> | |
modified .mailmap
| @@ -211,8 +211,7 @@ Christophe Leroy <chleroy@kernel.org> <christophe.leroy@c-s.fr> | |||
| 211 | 211 | Christophe Leroy <chleroy@kernel.org> <christophe.leroy@csgroup.eu> | |
| 212 | 212 | Christophe Leroy <chleroy@kernel.org> <christophe.leroy2@cs-soprasteria.com> | |
| 213 | 213 | Christophe Ricard <christophe.ricard@gmail.com> | |
| 214 | - | Christopher Obbard <chris.obbard@oss.qualcomm.com> <chris.obbard@collabora.com> | |
| 215 | - | Christopher Obbard <chris.obbard@oss.qualcomm.com> <christopher.obbard@linaro.org> | |
| 214 | + | Christopher Obbard <christopher.obbard@linaro.org> <chris.obbard@collabora.com> | |
| 216 | 215 | Christoph Hellwig <hch@lst.de> | |
| 217 | 216 | Christoph Manszewski <c.manszewski@gmail.com> <christoph.manszewski@intel.com> | |
| 218 | 217 | Christoph Paasch <cpaasch@openai.com> <christoph.paasch@gmail.com> | |
| @@ -223,7 +222,6 @@ Chuck Lever <cel@kernel.org> <chuck.lever@oracle.com> | |||
| 223 | 222 | Chuck Lever <cel@kernel.org> <cel@netapp.com> | |
| 224 | 223 | Chuck Lever <cel@kernel.org> <cel@citi.umich.edu> | |
| 225 | 224 | Claudiu Beznea <claudiu.beznea@tuxon.dev> <claudiu.beznea@microchip.com> | |
| 226 | - | Coiby Xu <coiby.xu@gmail.com> <coxu@redhat.com> | |
| 227 | 225 | Colin Ian King <colin.i.king@gmail.com> <colin.king@canonical.com> | |
| 228 | 226 | Corey Minyard <minyard@acm.org> | |
| 229 | 227 | Damian Hobson-Garcia <dhobsong@igel.co.jp> | |
| @@ -355,8 +353,6 @@ Hans Verkuil <hverkuil@kernel.org> <hverkuil-cisco@xs4all.nl> | |||
| 355 | 353 | Hans Verkuil <hverkuil@kernel.org> <hansverk@cisco.com> | |
| 356 | 354 | Hans Verkuil <hverkuil@kernel.org> <hans.verkuil@cisco.com> | |
| 357 | 355 | Hao Ge <hao.ge@linux.dev> <gehao@kylinos.cn> | |
| 358 | - | Haowen Bai <baihaowen88@gmail.com> <baihaowen@meizu.com> | |
| 359 | - | Haowen Bai <baihaowen88@gmail.com> <calvin.bai@ugreen.com> | |
| 360 | 356 | Harry Yoo <harry.yoo@oracle.com> <42.hyeyoo@gmail.com> | |
| 361 | 357 | Harry Yoo <harry@kernel.org> <harry.yoo@oracle.com> | |
| 362 | 358 | Heiko Carstens <hca@linux.ibm.com> <h.carstens@de.ibm.com> | |
| @@ -484,7 +480,6 @@ Juha Yrjola <juha.yrjola@nokia.com> | |||
| 484 | 480 | Juha Yrjola <juha.yrjola@solidboot.com> | |
| 485 | 481 | Julien Thierry <julien.thierry.kdev@gmail.com> <julien.thierry@arm.com> | |
| 486 | 482 | Justin Iurman <justin.iurman@gmail.com> <justin.iurman@uliege.be> | |
| 487 | - | Imre Kaloz <kaloz@kernel.org> <kaloz@openwrt.org> | |
| 488 | 483 | Ira Weiny <iweiny@kernel.org> <ira.weiny@intel.com> | |
| 489 | 484 | Iskren Chernev <me@iskren.info> <iskren.chernev@gmail.com> | |
| 490 | 485 | Kalle Valo <kvalo@kernel.org> <kvalo@codeaurora.org> | |
| @@ -978,7 +973,6 @@ Vladimir Davydov <vdavydov.dev@gmail.com> <vdavydov@virtuozzo.com> | |||
| 978 | 973 | Vlastimil Babka <vbabka@kernel.org> <vbabka@suse.cz> | |
| 979 | 974 | WangYuli <wangyuli@aosc.io> <wangyl5933@chinaunicom.cn> | |
| 980 | 975 | WangYuli <wangyuli@aosc.io> <wangyuli@deepin.org> | |
| 981 | - | Wei Wang <weiwan@google.com> <weibunny@fb.com> | |
| 982 | 976 | Weiwen Hu <huweiwen@linux.alibaba.com> <sehuww@mail.scut.edu.cn> | |
| 983 | 977 | WeiXiong Liao <gmpy.liaowx@gmail.com> <liaoweixiong@allwinnertech.com> | |
| 984 | 978 | Wen Gong <quic_wgong@quicinc.com> <wgong@codeaurora.org> | |
| @@ -986,8 +980,6 @@ Wesley Cheng <quic_wcheng@quicinc.com> <wcheng@codeaurora.org> | |||
| 986 | 980 | Will Deacon <will@kernel.org> <will.deacon@arm.com> | |
| 987 | 981 | Wolfram Sang <wsa@kernel.org> <w.sang@pengutronix.de> | |
| 988 | 982 | Wolfram Sang <wsa@kernel.org> <wsa@the-dreams.de> | |
| 989 | - | Xu Xin <xu.xin@linux.dev> <xu.xin16@zte.com.cn> | |
| 990 | - | Xu Xin <xu.xin@linux.dev> xu xin <cgel.zte@gmail.com> | |
| 991 | 983 | Yakir Yang <kuankuan.y@gmail.com> <ykk@rock-chips.com> | |
| 992 | 984 | Yanteng Si <si.yanteng@linux.dev> <siyanteng@loongson.cn> | |
| 993 | 985 | Ying Huang <huang.ying.caritas@gmail.com> <ying.huang@intel.com> | |
modified Documentation/ABI/testing/sysfs-devices-platform-trackpoint
| @@ -5,7 +5,7 @@ Contact: linux-input@vger.kernel.org | |||
| 5 | 5 | Description: | |
| 6 | 6 | (RW) Trackpoint sensitivity. | |
| 7 | 7 | ||
| 8 | - | What: /sys/devices/platform/i8042/.../inertia | |
| 8 | + | What: /sys/devices/platform/i8042/.../intertia | |
| 9 | 9 | Date: Aug, 2005 | |
| 10 | 10 | KernelVersion: 2.6.14 | |
| 11 | 11 | Contact: linux-input@vger.kernel.org | |
modified Documentation/admin-guide/kernel-parameters.txt
| @@ -589,9 +589,6 @@ Kernel parameters | |||
| 589 | 589 | arm64.nosve [ARM64] Unconditionally disable Scalable Vector | |
| 590 | 590 | Extension support | |
| 591 | 591 | ||
| 592 | - | arm64.nowfxt [ARM64] Unconditionally disable Wait For Event with | |
| 593 | - | Timeout and Wait For Interrupt with Timeout support | |
| 594 | - | ||
| 595 | 592 | ataflop= [HW,M68k] | |
| 596 | 593 | ||
| 597 | 594 | atarimouse= [HW,MOUSE] Atari Mouse | |
| @@ -3494,7 +3491,7 @@ Kernel parameters | |||
| 3494 | 3491 | ||
| 3495 | 3492 | * SATA link speed limit: 1.5Gbps or 3.0Gbps. | |
| 3496 | 3493 | ||
| 3497 | - | * Transfer mode: pio[0-6], mwdma[0-4] and udma[0-7]. | |
| 3494 | + | * Transfer mode: pio[0-7], mwdma[0-4] and udma[0-7]. | |
| 3498 | 3495 | udma[/][16,25,33,44,66,100,133] notation is also | |
| 3499 | 3496 | allowed. | |
| 3500 | 3497 | ||
| @@ -3512,7 +3509,7 @@ Kernel parameters | |||
| 3512 | 3509 | ||
| 3513 | 3510 | * [no]ncqtrim: Enable or disable queued DSM TRIM. | |
| 3514 | 3511 | ||
| 3515 | - | * [no]ncqati: Enable or disable NCQ on ATI chipsets. | |
| 3512 | + | * [no]ncqati: Enable or disable NCQ trim on ATI chipset. | |
| 3516 | 3513 | ||
| 3517 | 3514 | * [no]trim: Enable or disable (unqueued) TRIM. | |
| 3518 | 3515 | ||
| @@ -3543,9 +3540,11 @@ Kernel parameters | |||
| 3543 | 3540 | ||
| 3544 | 3541 | * max_sec_128: Set transfer size limit to 128 sectors. | |
| 3545 | 3542 | ||
| 3546 | - | * max_sec_1024: Set transfer size limit to 1024 sectors. | |
| 3543 | + | * max_sec_1024: Set or clear transfer size limit to | |
| 3544 | + | 1024 sectors. | |
| 3547 | 3545 | ||
| 3548 | - | * max_sec_lba48: Set transfer size limit to 65535 sectors. | |
| 3546 | + | * max_sec_lba48: Set or clear transfer size limit to | |
| 3547 | + | 65535 sectors. | |
| 3549 | 3548 | ||
| 3550 | 3549 | * external: Mark port as external (hotplug-capable). | |
| 3551 | 3550 | ||
modified Documentation/arch/arm64/booting.rst
| @@ -465,7 +465,6 @@ Before jumping into the kernel, the following conditions must be met: | |||
| 465 | 465 | - HDFGWTR2_EL2.nPMICNTR_EL0 (bit 2) must be initialised to 0b1. | |
| 466 | 466 | - HDFGWTR2_EL2.nPMICFILTR_EL0 (bit 3) must be initialised to 0b1. | |
| 467 | 467 | - HDFGWTR2_EL2.nPMUACR_EL1 (bit 4) must be initialised to 0b1. | |
| 468 | - | - HDFGWTR2_EL2.nPMZR_EL0 (bit 21) must be initialised to 0b1. | |
| 469 | 468 | ||
| 470 | 469 | For CPUs with SPE data source filtering (FEAT_SPE_FDS): | |
| 471 | 470 | ||
modified Documentation/arch/arm64/memory-tagging-extension.rst
| @@ -208,10 +208,11 @@ will use the corresponding aligned address. | |||
| 208 | 208 | tracer's space cannot be accessed or does not have valid tags. | |
| 209 | 209 | - ``-EPERM`` - the specified process cannot be traced. | |
| 210 | 210 | - ``-EIO`` - the tracee's address range cannot be accessed (e.g. invalid | |
| 211 | - | address) or does not have valid tags (not mapped with the ``PROT_MTE`` | |
| 212 | - | flag) and no tags copied. ``iov_len`` not updated. | |
| 211 | + | address) and no tags copied. ``iov_len`` not updated. | |
| 213 | 212 | - ``-EFAULT`` - fault on accessing the tracer's memory (``struct iovec`` | |
| 214 | 213 | or ``iov_base`` buffer) and no tags copied. ``iov_len`` not updated. | |
| 214 | + | - ``-EOPNOTSUPP`` - the tracee's address does not have valid tags (never | |
| 215 | + | mapped with the ``PROT_MTE`` flag). ``iov_len`` not updated. | |
| 215 | 216 | ||
| 216 | 217 | **Note**: There are no transient errors for the requests above, so user | |
| 217 | 218 | programs should not retry in case of a non-zero system call return. | |
modified Documentation/arch/s390/pci.rst
| @@ -67,7 +67,7 @@ Entries specific to zPCI functions and entries that hold zPCI information. | |||
| 67 | 67 | ||
| 68 | 68 | A physical function that currently supports a virtual function cannot be | |
| 69 | 69 | powered off until all virtual functions are removed with: | |
| 70 | - | echo 0 > /sys/bus/pci/devices/DDDD:BB:dd.f/sriov_numvfs | |
| 70 | + | echo 0 > /sys/bus/pci/devices/DDDD:BB:dd.f/sriov_numvf | |
| 71 | 71 | ||
| 72 | 72 | * /sys/bus/pci/devices/DDDD:BB:dd.f/: | |
| 73 | 73 | ||
modified Documentation/bpf/kfuncs.rst
| @@ -486,16 +486,6 @@ Example usage in BPF program: | |||
| 486 | 486 | /* note that the last argument is omitted */ | |
| 487 | 487 | bpf_task_work_schedule_signal(task, &work->tw, &arrmap, task_work_callback); | |
| 488 | 488 | ||
| 489 | - | 2.5.10 KF_PERFMON flag | |
| 490 | - | ---------------------- | |
| 491 | - | ||
| 492 | - | The KF_PERFMON flag is used for kfuncs that can expose kernel memory or kernel | |
| 493 | - | addresses to the BPF program, for example by reading through a pointer that the | |
| 494 | - | verifier does not check. Calling such a kfunc requires CAP_PERFMON, or | |
| 495 | - | CAP_SYS_ADMIN, in the same way that the equivalent BPF helpers are gated in | |
| 496 | - | bpf_base_func_proto(). A program loaded with CAP_BPF alone is rejected at load | |
| 497 | - | time. | |
| 498 | - | ||
| 499 | 489 | 2.6 Registering the kfuncs | |
| 500 | 490 | -------------------------- | |
| 501 | 491 | ||
modified Documentation/devicetree/bindings/display/msm/qcom,qcs8300-mdss.yaml
| @@ -150,7 +150,7 @@ examples: | |||
| 150 | 150 | reg = <0>; | |
| 151 | 151 | ||
| 152 | 152 | dpu_intf0_out: endpoint { | |
| 153 | - | remote-endpoint = <&mdss_dp0_in>; | |
| 153 | + | remote-endpoint = <&mdss_dp0_in>; | |
| 154 | 154 | }; | |
| 155 | 155 | }; | |
| 156 | 156 | ||
| @@ -352,9 +352,9 @@ examples: | |||
| 352 | 352 | }; | |
| 353 | 353 | ||
| 354 | 354 | port@1 { | |
| 355 | - | reg = <1>; | |
| 355 | + | reg = <1>; | |
| 356 | 356 | ||
| 357 | - | mdss_dp_out: endpoint { }; | |
| 357 | + | mdss_dp_out: endpoint { }; | |
| 358 | 358 | }; | |
| 359 | 359 | }; | |
| 360 | 360 | ||
modified Documentation/devicetree/bindings/display/msm/qcom,sar2130p-mdss.yaml
| @@ -248,9 +248,9 @@ examples: | |||
| 248 | 248 | remote-endpoint = <&usb_dp_qmpphy_dp_in>; | |
| 249 | 249 | }; | |
| 250 | 250 | }; | |
| 251 | - | }; | |
| 251 | + | }; | |
| 252 | 252 | ||
| 253 | - | dp_opp_table: opp-table { | |
| 253 | + | dp_opp_table: opp-table { | |
| 254 | 254 | compatible = "operating-points-v2"; | |
| 255 | 255 | ||
| 256 | 256 | opp-162000000 { | |
modified Documentation/devicetree/bindings/display/msm/qcom,sm6150-dpu.yaml
| @@ -81,7 +81,7 @@ examples: | |||
| 81 | 81 | port@1 { | |
| 82 | 82 | reg = <1>; | |
| 83 | 83 | dpu_intf1_out: endpoint { | |
| 84 | - | remote-endpoint = <&mdss_dsi0_in>; | |
| 84 | + | remote-endpoint = <&mdss_dsi0_in>; | |
| 85 | 85 | }; | |
| 86 | 86 | }; | |
| 87 | 87 | }; | |
| @@ -90,18 +90,18 @@ examples: | |||
| 90 | 90 | compatible = "operating-points-v2"; | |
| 91 | 91 | ||
| 92 | 92 | opp-19200000 { | |
| 93 | - | opp-hz = /bits/ 64 <19200000>; | |
| 94 | - | required-opps = <&rpmhpd_opp_low_svs>; | |
| 93 | + | opp-hz = /bits/ 64 <19200000>; | |
| 94 | + | required-opps = <&rpmhpd_opp_low_svs>; | |
| 95 | 95 | }; | |
| 96 | 96 | ||
| 97 | 97 | opp-25600000 { | |
| 98 | - | opp-hz = /bits/ 64 <25600000>; | |
| 99 | - | required-opps = <&rpmhpd_opp_svs>; | |
| 98 | + | opp-hz = /bits/ 64 <25600000>; | |
| 99 | + | required-opps = <&rpmhpd_opp_svs>; | |
| 100 | 100 | }; | |
| 101 | 101 | ||
| 102 | 102 | opp-307200000 { | |
| 103 | - | opp-hz = /bits/ 64 <307200000>; | |
| 104 | - | required-opps = <&rpmhpd_opp_nom>; | |
| 103 | + | opp-hz = /bits/ 64 <307200000>; | |
| 104 | + | required-opps = <&rpmhpd_opp_nom>; | |
| 105 | 105 | }; | |
| 106 | 106 | }; | |
| 107 | 107 | }; | |
modified Documentation/devicetree/bindings/display/msm/qcom,sm8350-mdss.yaml
| @@ -223,7 +223,7 @@ examples: | |||
| 223 | 223 | phys = <&mdss_dsi0_phy>; | |
| 224 | 224 | ||
| 225 | 225 | ports { | |
| 226 | - | #address-cells = <1>; | |
| 226 | + | #address-cells = <1>; | |
| 227 | 227 | #size-cells = <0>; | |
| 228 | 228 | ||
| 229 | 229 | port@0 { | |
modified Documentation/devicetree/bindings/display/msm/qcom,x1e80100-mdss.yaml
| @@ -208,47 +208,47 @@ examples: | |||
| 208 | 208 | #sound-dai-cells = <0>; | |
| 209 | 209 | ||
| 210 | 210 | ports { | |
| 211 | - | #address-cells = <1>; | |
| 212 | - | #size-cells = <0>; | |
| 211 | + | #address-cells = <1>; | |
| 212 | + | #size-cells = <0>; | |
| 213 | 213 | ||
| 214 | - | port@0 { | |
| 215 | - | reg = <0>; | |
| 214 | + | port@0 { | |
| 215 | + | reg = <0>; | |
| 216 | 216 | ||
| 217 | - | mdss_dp0_in: endpoint { | |
| 218 | - | remote-endpoint = <&mdss_intf0_out>; | |
| 219 | - | }; | |
| 220 | - | }; | |
| 217 | + | mdss_dp0_in: endpoint { | |
| 218 | + | remote-endpoint = <&mdss_intf0_out>; | |
| 219 | + | }; | |
| 220 | + | }; | |
| 221 | 221 | ||
| 222 | - | port@1 { | |
| 223 | - | reg = <1>; | |
| 222 | + | port@1 { | |
| 223 | + | reg = <1>; | |
| 224 | 224 | ||
| 225 | - | mdss_dp0_out: endpoint { | |
| 226 | - | }; | |
| 227 | - | }; | |
| 225 | + | mdss_dp0_out: endpoint { | |
| 226 | + | }; | |
| 227 | + | }; | |
| 228 | 228 | }; | |
| 229 | 229 | ||
| 230 | 230 | mdss_dp0_opp_table: opp-table { | |
| 231 | - | compatible = "operating-points-v2"; | |
| 232 | - | ||
| 233 | - | opp-160000000 { | |
| 234 | - | opp-hz = /bits/ 64 <160000000>; | |
| 235 | - | required-opps = <&rpmhpd_opp_low_svs>; | |
| 236 | - | }; | |
| 237 | - | ||
| 238 | - | opp-270000000 { | |
| 239 | - | opp-hz = /bits/ 64 <270000000>; | |
| 240 | - | required-opps = <&rpmhpd_opp_svs>; | |
| 241 | - | }; | |
| 242 | - | ||
| 243 | - | opp-540000000 { | |
| 244 | - | opp-hz = /bits/ 64 <540000000>; | |
| 245 | - | required-opps = <&rpmhpd_opp_svs_l1>; | |
| 246 | - | }; | |
| 247 | - | ||
| 248 | - | opp-810000000 { | |
| 249 | - | opp-hz = /bits/ 64 <810000000>; | |
| 250 | - | required-opps = <&rpmhpd_opp_nom>; | |
| 251 | - | }; | |
| 231 | + | compatible = "operating-points-v2"; | |
| 232 | + | ||
| 233 | + | opp-160000000 { | |
| 234 | + | opp-hz = /bits/ 64 <160000000>; | |
| 235 | + | required-opps = <&rpmhpd_opp_low_svs>; | |
| 236 | + | }; | |
| 237 | + | ||
| 238 | + | opp-270000000 { | |
| 239 | + | opp-hz = /bits/ 64 <270000000>; | |
| 240 | + | required-opps = <&rpmhpd_opp_svs>; | |
| 241 | + | }; | |
| 242 | + | ||
| 243 | + | opp-540000000 { | |
| 244 | + | opp-hz = /bits/ 64 <540000000>; | |
| 245 | + | required-opps = <&rpmhpd_opp_svs_l1>; | |
| 246 | + | }; | |
| 247 | + | ||
| 248 | + | opp-810000000 { | |
| 249 | + | opp-hz = /bits/ 64 <810000000>; | |
| 250 | + | required-opps = <&rpmhpd_opp_nom>; | |
| 251 | + | }; | |
| 252 | 252 | }; | |
| 253 | 253 | }; | |
| 254 | 254 | }; | |
modified Documentation/devicetree/bindings/input/mediatek,mt6779-keypad.yaml
| @@ -26,7 +26,6 @@ properties: | |||
| 26 | 26 | - const: mediatek,mt6779-keypad | |
| 27 | 27 | - items: | |
| 28 | 28 | - enum: | |
| 29 | - | - mediatek,mt6572-keypad | |
| 30 | 29 | - mediatek,mt6873-keypad | |
| 31 | 30 | - mediatek,mt8183-keypad | |
| 32 | 31 | - mediatek,mt8365-keypad | |
modified Documentation/devicetree/bindings/pinctrl/qcom,nord-tlmm.yaml
| @@ -67,7 +67,7 @@ $defs: | |||
| 67 | 67 | Specify the alternative function to be configured for the specified | |
| 68 | 68 | pins. | |
| 69 | 69 | ||
| 70 | - | enum: [ gpio, aoss_cti, atest_char, atest_usb20, atest_usb21, | |
| 70 | + | enum: [ aoss_cti, atest_char, atest_usb20, atest_usb21, | |
| 71 | 71 | aud_intfc0_clk, aud_intfc0_data, aud_intfc0_ws, | |
| 72 | 72 | aud_intfc10_clk, aud_intfc10_data, aud_intfc10_ws, | |
| 73 | 73 | aud_intfc1_clk, aud_intfc1_data, aud_intfc1_ws, | |
| @@ -98,10 +98,9 @@ $defs: | |||
| 98 | 98 | pcie3_clk_req_n, phase_flag, pll_bist_sync, pll_clk_aux, | |
| 99 | 99 | prng_rosc0, prng_rosc1, pwrbrk_i_n, qdss, qdss_cti, qspi, | |
| 100 | 100 | qup0_se0, qup0_se1, qup0_se2, qup0_se3, qup0_se4, qup0_se5, | |
| 101 | - | qup1_se0, qup1_se1, qup1_se2_01, qup1_se2_23, qup1_se3_01, | |
| 102 | - | qup1_se3_23, qup1_se4, qup1_se5, | |
| 101 | + | qup1_se0, qup1_se1, qup1_se3, qup1_se2, qup1_se4, qup1_se5, | |
| 103 | 102 | qup1_se6, qup2_se0, qup2_se1, qup2_se2, qup2_se3, qup2_se4, | |
| 104 | - | qup2_se5, qup2_se6, qup3_se0_mira, qup3_se0_mirb, | |
| 103 | + | qup2_se5, qup2_se6, | |
| 105 | 104 | sailss_ospi, sdc4_clk, sdc4_cmd, sdc4_data, smb_alert, | |
| 106 | 105 | smb_alert_n, smb_clk, smb_dat, tb_trig_sdc4, tmess_prng0, | |
| 107 | 106 | tmess_prng1, tsc_timer, tsense_pwm, usb0_hs, | |
modified Documentation/hwmon/cgbc-hwmon.rst
| @@ -28,44 +28,34 @@ system. | |||
| 28 | 28 | Name Description | |
| 29 | 29 | ============= ====================== | |
| 30 | 30 | temp1_input CPU temperature | |
| 31 | - | temp2_input Case temperature | |
| 31 | + | temp2_input Box temperature | |
| 32 | 32 | temp3_input Ambient temperature | |
| 33 | - | temp4_input CPU Board temperature | |
| 34 | - | temp5_input Carrier Board temperature | |
| 35 | - | temp6_input System Chipset temperature | |
| 36 | - | temp7_input Video Controller/Board temperature | |
| 33 | + | temp4_input Board temperature | |
| 34 | + | temp5_input Carrier temperature | |
| 35 | + | temp6_input Chipset temperature | |
| 36 | + | temp7_input Video temperature | |
| 37 | 37 | temp8_input Other temperature | |
| 38 | - | temp9_input Top DIMM 0 temperature | |
| 39 | - | temp10_input Bottom DIMM 0 temperature | |
| 40 | - | temp11_input Alternate Board temperature | |
| 41 | - | temp12_input Top DIMM 1 temperature | |
| 42 | - | temp13_input Top DIMM 2 temperature | |
| 43 | - | temp14_input Top DIMM 3 temperature | |
| 44 | - | temp15_input Top DIMM 4 temperature | |
| 45 | - | temp16_input Top DIMM 5 temperature | |
| 46 | - | temp17_input Top DIMM 6 temperature | |
| 47 | - | temp18_input Top DIMM 7 temperature | |
| 48 | - | temp19_input Bottom DIMM 1 temperature | |
| 49 | - | in0_input CPU Core voltage | |
| 38 | + | temp9_input TOPDIM temperature | |
| 39 | + | temp10_input BOTTOMDIM temperature | |
| 40 | + | in0_input CPU voltage | |
| 50 | 41 | in1_input DC Runtime voltage | |
| 51 | 42 | in2_input DC Standby voltage | |
| 52 | 43 | in3_input CMOS Battery voltage | |
| 53 | - | in4_input Battery Supply voltage | |
| 44 | + | in4_input Battery voltage | |
| 54 | 45 | in5_input AC voltage | |
| 55 | 46 | in6_input Other voltage | |
| 56 | - | in7_input 5V Runtime voltage | |
| 47 | + | in7_input 5V voltage | |
| 57 | 48 | in8_input 5V Standby voltage | |
| 58 | - | in9_input 3V3 Runtime voltage | |
| 49 | + | in9_input 3V3 voltage | |
| 59 | 50 | in10_input 3V3 Standby voltage | |
| 60 | 51 | in11_input VCore A voltage | |
| 61 | 52 | in12_input VCore B voltage | |
| 62 | - | in13_input 12V Runtime voltage | |
| 63 | - | in14_input 12V Standby voltage | |
| 64 | - | curr1_input DC Runtime current | |
| 65 | - | curr2_input 5V Runtime current | |
| 66 | - | curr3_input 12V Runtime current | |
| 53 | + | in13_input 12V voltage | |
| 54 | + | curr1_input DC current | |
| 55 | + | curr2_input 5V current | |
| 56 | + | curr3_input 12V current | |
| 67 | 57 | fan1_input CPU fan | |
| 68 | - | fan2_input Case fan | |
| 58 | + | fan2_input Box fan | |
| 69 | 59 | fan3_input Ambient fan | |
| 70 | 60 | fan4_input Chiptset fan | |
| 71 | 61 | fan5_input Video fan | |
modified Documentation/netlink/specs/netdev.yaml
| @@ -851,8 +851,6 @@ operations: | |||
| 851 | 851 | name: bind-tx | |
| 852 | 852 | doc: Bind dmabuf to netdev for TX | |
| 853 | 853 | attribute-set: dmabuf | |
| 854 | - | # Intentionally unprivileged (no admin-perm / uns-admin-perm); see | |
| 855 | - | # comment above netdev_nl_bind_tx_doit(). | |
| 856 | 854 | do: | |
| 857 | 855 | request: | |
| 858 | 856 | attributes: | |
modified Documentation/netlink/specs/rt-neigh.yaml
| @@ -341,9 +341,6 @@ attribute-sets: | |||
| 341 | 341 | - | |
| 342 | 342 | name: interval-probe-time-ms | |
| 343 | 343 | type: u64 | |
| 344 | - | checks: | |
| 345 | - | min: 1 | |
| 346 | - | max: 86400000 | |
| 347 | 344 | ||
| 348 | 345 | operations: | |
| 349 | 346 | enum-model: directional | |
modified Documentation/networking/ip-sysctl.rst
| @@ -248,7 +248,7 @@ neigh/default/unres_qlen - INTEGER | |||
| 248 | 248 | ||
| 249 | 249 | neigh/default/interval_probe_time_ms - INTEGER | |
| 250 | 250 | The probe interval for neighbor entries with NTF_MANAGED flag, | |
| 251 | - | the min value is 1, and the max value is 86400000 (1 day). | |
| 251 | + | the min value is 1. | |
| 252 | 252 | ||
| 253 | 253 | Default: 5000 | |
| 254 | 254 | ||
| @@ -874,8 +874,6 @@ tcp_rmem - vector of 3 INTEGERs: min, default, max | |||
| 874 | 874 | case this value is ignored. | |
| 875 | 875 | Default: between 131072 and 32MB, depending on RAM size. | |
| 876 | 876 | ||
| 877 | - | Each of the three values cannot be set below 4096. | |
| 878 | - | ||
| 879 | 877 | tcp_sack - BOOLEAN | |
| 880 | 878 | Enable select acknowledgments (SACKS). | |
| 881 | 879 | ||
modified Documentation/trace/events-landlock.rst
| @@ -6,7 +6,7 @@ Landlock Trace Events | |||
| 6 | 6 | ===================== | |
| 7 | 7 | ||
| 8 | 8 | :Author: Mickaël Salaün | |
| 9 | - | :Date: September 2026 | |
| 9 | + | :Date: August 2026 | |
| 10 | 10 | ||
| 11 | 11 | Landlock emits trace events for sandbox lifecycle operations and access | |
| 12 | 12 | denials. These events can be consumed by ftrace (for human-readable | |
| @@ -31,8 +31,8 @@ Landlock trace events are organized in four categories: | |||
| 31 | 31 | **Syscall events** are emitted during Landlock system calls: | |
| 32 | 32 | ||
| 33 | 33 | - ``landlock_create_ruleset``: a new ruleset is created | |
| 34 | - | - ``landlock_add_rule_path_beneath``: a filesystem rule is added to a ruleset | |
| 35 | - | - ``landlock_add_rule_net_port``: a network port rule is added to a ruleset | |
| 34 | + | - ``landlock_add_rule_fs``: a filesystem rule is added to a ruleset | |
| 35 | + | - ``landlock_add_rule_net``: a network port rule is added to a ruleset | |
| 36 | 36 | - ``landlock_create_domain``: a new domain is created from a ruleset | |
| 37 | 37 | - ``landlock_enforce_domain``: a domain is enforced on a thread | |
| 38 | 38 | ||
| @@ -47,8 +47,8 @@ Landlock trace events are organized in four categories: | |||
| 47 | 47 | ||
| 48 | 48 | **Rule evaluation events** are emitted during rule matching: | |
| 49 | 49 | ||
| 50 | - | - ``landlock_check_rule_inode``: an inode-keyed rule is evaluated | |
| 51 | - | - ``landlock_check_rule_net_port``: a network-port-keyed rule is evaluated | |
| 50 | + | - ``landlock_check_rule_fs``: a filesystem rule is evaluated | |
| 51 | + | - ``landlock_check_rule_net``: a network port rule is evaluated | |
| 52 | 52 | ||
| 53 | 53 | **Lifecycle events**: | |
| 54 | 54 | ||
| @@ -141,10 +141,10 @@ in some field formats: | |||
| 141 | 141 | treated as untrusted input and escaped in the trace text output so it | |
| 142 | 142 | cannot inject field separators or control characters. | |
| 143 | 143 | ||
| 144 | - | - **Other party's domain**: A scope or ptrace denial compares the subject's | |
| 145 | - | denying domain (``domain=``), which is the enforcing domain and not | |
| 146 | - | necessarily the current task's domain, with the other party's domain. | |
| 147 | - | These tracepoints also report the other party's domain as a scalar ID: | |
| 144 | + | - **Other party's domain**: A scope or ptrace denial compares the | |
| 145 | + | subject's denying domain (``domain=``, always the enforcing domain and | |
| 146 | + | never the current task) with the other party's domain, so these | |
| 147 | + | tracepoints also report the other party's domain as a scalar ID: | |
| 148 | 148 | ``tracee_domain=`` (ptrace), ``target_domain=`` (signal), and | |
| 149 | 149 | ``peer_domain=`` (abstract unix socket). It is ``0`` when the other | |
| 150 | 150 | party is unsandboxed, and otherwise a domain ID that a consumer resolves | |
| @@ -189,7 +189,7 @@ rather than the caller's, so correlate those to the syscall by domain ID. | |||
| 189 | 189 | Interpreting check_rule events | |
| 190 | 190 | ============================== | |
| 191 | 191 | ||
| 192 | - | The ``check_rule_inode`` and ``check_rule_net_port`` events expose the per-layer | |
| 192 | + | The ``check_rule_fs`` and ``check_rule_net`` events expose the per-layer | |
| 193 | 193 | rule evaluation, which is useful for understanding *why* a specific | |
| 194 | 194 | access is allowed or denied. | |
| 195 | 195 | ||
| @@ -231,10 +231,9 @@ contribution, not the final decision: | |||
| 231 | 231 | through another matching rule, or the right is denied and appears in the | |
| 232 | 232 | ``blockers=`` field of the corresponding ``deny_access`` event. | |
| 233 | 233 | ||
| 234 | - | For an access check that a consumer can delimit, aggregate the ``grants=`` | |
| 235 | - | groups of all matching ``check_rule`` events. These events do not carry a | |
| 236 | - | request ID; use their execution context and generic tracepoints to separate | |
| 237 | - | concurrent or successive checks of the same object. | |
| 234 | + | To reconstruct the decision for an object, aggregate the ``grants=`` | |
| 235 | + | groups of all ``check_rule`` events emitted for that object during the | |
| 236 | + | check. | |
| 238 | 237 | ||
| 239 | 238 | .. note:: | |
| 240 | 239 | ||
| @@ -245,31 +244,29 @@ concurrent or successive checks of the same object. | |||
| 245 | 244 | ||
| 246 | 245 | For example, a program sandboxed with read and execute access to the | |
| 247 | 246 | whole filesystem reads ``/etc/passwd``; both the ``execve()`` and the | |
| 248 | - | read match the rule covering ``/`` (inode 2), so ``check_rule_inode`` fires | |
| 247 | + | read match the rule covering ``/`` (inode 2), so ``check_rule_fs`` fires | |
| 249 | 248 | with the requested rights intersected against what that rule grants. | |
| 250 | 249 | The ``access_request=`` mask includes ``truncate`` because the file-open hook | |
| 251 | 250 | evaluates that optional right alongside the required access, but the | |
| 252 | 251 | rule does not grant it, so ``truncate`` never appears in ``grants=``:: | |
| 253 | 252 | ||
| 254 | - | cat-127 [...] landlock_check_rule_inode: domain=1e40cb56f access_request=execute|read_file|truncate dev=0:17 ino=2 grants={execute|read_file} | |
| 255 | - | cat-127 [...] landlock_check_rule_inode: domain=1e40cb56f access_request=read_file|truncate dev=0:17 ino=2 grants={read_file} | |
| 253 | + | cat-127 [...] landlock_check_rule_fs: domain=1e40cb56f access_request=execute|read_file|truncate dev=0:17 ino=2 grants={execute|read_file} | |
| 254 | + | cat-127 [...] landlock_check_rule_fs: domain=1e40cb56f access_request=read_file|truncate dev=0:17 ino=2 grants={read_file} | |
| 256 | 255 | ||
| 257 | 256 | The ``[...]`` replaces the ftrace CPU, flags, and timestamp columns. A | |
| 258 | 257 | single ``grants=`` group means the enforcing domain has one layer. With | |
| 259 | 258 | two nested sandboxes that each grant the same rights, the rule spans both | |
| 260 | 259 | layers, so ``grants=`` has one group per layer:: | |
| 261 | 260 | ||
| 262 | - | cat-128 [...] landlock_check_rule_inode: domain=184788b52 access_request=execute|read_file|truncate dev=0:17 ino=2 grants={execute|read_file,execute|read_file} | |
| 263 | - | cat-128 [...] landlock_check_rule_inode: domain=184788b52 access_request=read_file|truncate dev=0:17 ino=2 grants={read_file,read_file} | |
| 261 | + | cat-128 [...] landlock_check_rule_fs: domain=184788b52 access_request=execute|read_file|truncate dev=0:17 ino=2 grants={execute|read_file,execute|read_file} | |
| 262 | + | cat-128 [...] landlock_check_rule_fs: domain=184788b52 access_request=read_file|truncate dev=0:17 ino=2 grants={read_file,read_file} | |
| 264 | 263 | ||
| 265 | 264 | eBPF access | |
| 266 | 265 | =========== | |
| 267 | 266 | ||
| 268 | - | BTF-enabled raw tracepoint programs attached through libbpf | |
| 269 | - | ``SEC("tp_btf/...")`` sections receive typed callback arguments. The | |
| 270 | - | event prototypes in `Event reference`_ document their argument layouts. | |
| 271 | - | The arguments include both standard kernel objects and Landlock-internal | |
| 272 | - | objects: | |
| 267 | + | eBPF programs attached via ``BPF_RAW_TRACEPOINT`` can access the | |
| 268 | + | tracepoint arguments directly through BTF. The arguments include both | |
| 269 | + | standard kernel objects and Landlock-internal objects: | |
| 273 | 270 | ||
| 274 | 271 | - Standard kernel objects (``struct task_struct``, ``struct sock``, | |
| 275 | 272 | ``struct path``, ``struct dentry``) can be used with existing BPF | |
| @@ -280,7 +277,7 @@ objects: | |||
| 280 | 277 | Internal struct layouts may change between kernel versions; use CO-RE | |
| 281 | 278 | for field relocation. | |
| 282 | 279 | ||
| 283 | - | A stateful eBPF program attached before sandbox construction can maintain | |
| 280 | + | A stateful eBPF program observes the full event stream and maintains | |
| 284 | 281 | per-domain state in BPF maps: | |
| 285 | 282 | ||
| 286 | 283 | 1. On ``landlock_create_domain``: record the domain ID and parent (the | |
| @@ -296,10 +293,7 @@ per-domain state in BPF maps: | |||
| 296 | 293 | final statistics. | |
| 297 | 294 | ||
| 298 | 295 | This approach requires no kernel modification and no Landlock-specific | |
| 299 | - | BPF helpers. Landlock IDs serve as correlation keys within one boot. | |
| 300 | - | Records exported through tracing or BPF buffers can be lost, and records | |
| 301 | - | from different CPUs are not globally ordered, so consumers must detect and | |
| 302 | - | reconcile incomplete state. | |
| 296 | + | BPF helpers. The Landlock IDs serve as correlation keys across events. | |
| 303 | 297 | ||
| 304 | 298 | Audit filtering equivalence | |
| 305 | 299 | =========================== | |
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 | |
| @@ -5454,7 +5454,6 @@ F: include/linux/brcmphy.h | |||
| 5454 | 5454 | BROADCOM GENET ETHERNET DRIVER | |
| 5455 | 5455 | M: Doug Berger <opendmb@gmail.com> | |
| 5456 | 5456 | M: Florian Fainelli <florian.fainelli@broadcom.com> | |
| 5457 | - | M: Nicolai Buchwitz <nb@tipi-net.de> | |
| 5458 | 5457 | R: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com> | |
| 5459 | 5458 | L: netdev@vger.kernel.org | |
| 5460 | 5459 | S: Maintained | |
| @@ -8012,6 +8011,7 @@ F: include/uapi/drm/ivpu_accel.h | |||
| 8012 | 8011 | ||
| 8013 | 8012 | DRM ACCEL DRIVER FOR ROCKCHIP NPU | |
| 8014 | 8013 | M: Tomeu Vizoso <tomeu@tomeuvizoso.net> | |
| 8014 | + | R: Heiko Stuebner <heiko@sntech.de> | |
| 8015 | 8015 | L: dri-devel@lists.freedesktop.org | |
| 8016 | 8016 | S: Supported | |
| 8017 | 8017 | T: git https://gitlab.freedesktop.org/drm/misc/kernel.git | |
| @@ -8574,7 +8574,7 @@ F: Documentation/devicetree/bindings/display/panel/synaptics,r63353.yaml | |||
| 8574 | 8574 | F: drivers/gpu/drm/panel/panel-synaptics-r63353.c | |
| 8575 | 8575 | ||
| 8576 | 8576 | DRM DRIVER FOR SYNOPSYS DESIGNWARE DISPLAYPORT BRIDGE | |
| 8577 | - | M: Andy Yan <andy.yan@rock-chips.com> | |
| 8577 | + | M: Andy Yan <andyshrk@163.com> | |
| 8578 | 8578 | S: Maintained | |
| 8579 | 8579 | T: git https://gitlab.freedesktop.org/drm/misc/kernel.git | |
| 8580 | 8580 | F: Documentation/devicetree/bindings/display/rockchip/rockchip,dw-dp.yaml | |
| @@ -8927,7 +8927,7 @@ F: include/linux/platform_data/shmob_drm.h | |||
| 8927 | 8927 | DRM DRIVERS FOR ROCKCHIP | |
| 8928 | 8928 | M: Sandy Huang <hjc@rock-chips.com> | |
| 8929 | 8929 | M: Heiko Stübner <heiko@sntech.de> | |
| 8930 | - | M: Andy Yan <andy.yan@rock-chips.com> | |
| 8930 | + | M: Andy Yan <andyshrk@163.com> | |
| 8931 | 8931 | L: dri-devel@lists.freedesktop.org | |
| 8932 | 8932 | L: linux-rockchip@lists.infradead.org | |
| 8933 | 8933 | S: Maintained | |
| @@ -9325,7 +9325,6 @@ F: Documentation/devicetree/bindings/interrupt-controller/econet,en751221-intc.y | |||
| 9325 | 9325 | F: Documentation/devicetree/bindings/mips/econet.yaml | |
| 9326 | 9326 | F: Documentation/devicetree/bindings/timer/econet,en751221-timer.yaml | |
| 9327 | 9327 | F: arch/mips/boot/dts/econet/ | |
| 9328 | - | F: arch/mips/configs/econet_en751221_defconfig | |
| 9329 | 9328 | F: arch/mips/econet/ | |
| 9330 | 9329 | F: drivers/clocksource/timer-econet-en751221.c | |
| 9331 | 9330 | F: drivers/irqchip/irq-econet-en751221.c | |
| @@ -12882,7 +12881,7 @@ S: Maintained | |||
| 12882 | 12881 | F: drivers/power/supply/ip5xxx_power.c | |
| 12883 | 12882 | ||
| 12884 | 12883 | INNOSILICON HDMI BRIDGE DRIVER | |
| 12885 | - | M: Andy Yan <andy.yan@rock-chips.com> | |
| 12884 | + | M: Andy Yan <andyshrk@163.com> | |
| 12886 | 12885 | L: dri-devel@lists.freedesktop.org | |
| 12887 | 12886 | S: Maintained | |
| 12888 | 12887 | T: git https://gitlab.freedesktop.org/drm/misc/kernel.git | |
| @@ -14906,7 +14905,7 @@ M: Damien Le Moal <dlemoal@kernel.org> | |||
| 14906 | 14905 | M: Niklas Cassel <cassel@kernel.org> | |
| 14907 | 14906 | L: linux-ide@vger.kernel.org | |
| 14908 | 14907 | S: Maintained | |
| 14909 | - | T: git git://git.kernel.org/pub/scm/linux/kernel/git/libata/linux.git for-next | |
| 14908 | + | T: git git://git.kernel.org/pub/scm/linux/kernel/git/libata/linux.git | |
| 14910 | 14909 | F: Documentation/ABI/testing/sysfs-ata | |
| 14911 | 14910 | F: Documentation/devicetree/bindings/ata/ | |
| 14912 | 14911 | F: drivers/ata/ | |
| @@ -17033,8 +17032,8 @@ MEMBLOCK AND MEMORY MANAGEMENT INITIALIZATION | |||
| 17033 | 17032 | M: Mike Rapoport <rppt@kernel.org> | |
| 17034 | 17033 | L: linux-mm@kvack.org | |
| 17035 | 17034 | S: Maintained | |
| 17036 | - | T: git git://git.kernel.org/pub/scm/linux/kernel/git/mm/memblock.git for-next | |
| 17037 | - | T: git git://git.kernel.org/pub/scm/linux/kernel/git/mm/memblock.git fixes | |
| 17035 | + | T: git git://git.kernel.org/pub/scm/linux/kernel/git/rppt/memblock.git for-next | |
| 17036 | + | T: git git://git.kernel.org/pub/scm/linux/kernel/git/rppt/memblock.git fixes | |
| 17038 | 17037 | F: Documentation/core-api/boot-time-mm.rst | |
| 17039 | 17038 | F: include/linux/kho/abi/memblock.h | |
| 17040 | 17039 | F: include/linux/memblock.h | |
| @@ -17195,7 +17194,7 @@ F: tools/testing/selftests/mm/gup_test.c | |||
| 17195 | 17194 | MEMORY MANAGEMENT - KSM (Kernel Samepage Merging) | |
| 17196 | 17195 | M: Andrew Morton <akpm@linux-foundation.org> | |
| 17197 | 17196 | M: David Hildenbrand <david@kernel.org> | |
| 17198 | - | R: Xu Xin <xu.xin@linux.dev> | |
| 17197 | + | R: Xu Xin <xu.xin16@zte.com.cn> | |
| 17199 | 17198 | R: Chengming Zhou <chengming.zhou@linux.dev> | |
| 17200 | 17199 | L: linux-mm@kvack.org | |
| 17201 | 17200 | S: Maintained | |
| @@ -17243,8 +17242,6 @@ R: Barry Song <baohua@kernel.org> | |||
| 17243 | 17242 | R: Axel Rasmussen <axelrasmussen@google.com> | |
| 17244 | 17243 | R: Yuanchu Xie <yuanchu@google.com> | |
| 17245 | 17244 | R: Wei Xu <weixugc@google.com> | |
| 17246 | - | R: Baoquan He <baoquan.he@linux.dev> | |
| 17247 | - | R: Baolin Wang <baolin.wang@linux.alibaba.com> | |
| 17248 | 17245 | L: linux-mm@kvack.org | |
| 17249 | 17246 | S: Maintained | |
| 17250 | 17247 | W: http://www.linux-mm.org | |
modified Makefile
| @@ -2,7 +2,7 @@ | |||
| 2 | 2 | VERSION = 7 | |
| 3 | 3 | PATCHLEVEL = 3 | |
| 4 | 4 | SUBLEVEL = 0 | |
| 5 | - | EXTRAVERSION = -rc5 | |
| 5 | + | EXTRAVERSION = -rc3 | |
| 6 | 6 | NAME = Baby Opossum Posse | |
| 7 | 7 | ||
| 8 | 8 | # *DOCUMENTATION* | |
modified arch/arm/mach-socfpga/Kconfig
| @@ -16,7 +16,7 @@ menuconfig ARCH_INTEL_SOCFPGA | |||
| 16 | 16 | select ARM_ERRATA_775420 | |
| 17 | 17 | select PL310_ERRATA_588369 | |
| 18 | 18 | select PL310_ERRATA_727915 | |
| 19 | - | select PL310_ERRATA_753970 | |
| 19 | + | select PL310_ERRATA_753970 if PL310 | |
| 20 | 20 | select PL310_ERRATA_769419 | |
| 21 | 21 | select RESET_CONTROLLER | |
| 22 | 22 | ||
modified arch/arm64/boot/dts/altera/socfpga_stratix10_socdk.dtsi mode 100644 → 100755
No content changes.
modified arch/arm64/boot/dts/altera/socfpga_stratix10_socdk_emmc.dts mode 100644 → 100755
No content changes.
modified arch/arm64/boot/dts/amlogic/amlogic-t7-a311d2-an400.dts
| @@ -33,7 +33,7 @@ | |||
| 33 | 33 | }; | |
| 34 | 34 | ||
| 35 | 35 | &uart_a { | |
| 36 | - | clocks = <&xtal>, <&clkc_periphs CLKID_SYS_UART_A>, <&xtal>; | |
| 36 | + | clocks = <&xtal>, <&xtal>, <&xtal>; | |
| 37 | 37 | clock-names = "xtal", "pclk", "baud"; | |
| 38 | 38 | status = "okay"; | |
| 39 | 39 | }; | |
modified arch/arm64/boot/dts/amlogic/amlogic-t7-a311d2-khadas-vim4.dts
| @@ -71,6 +71,7 @@ | |||
| 71 | 71 | vin-supply = <&vddao_3v3>; | |
| 72 | 72 | gpio = <&gpio GPIOD_11 GPIO_ACTIVE_LOW>; | |
| 73 | 73 | regulator-boot-on; | |
| 74 | + | regulator-always-on; | |
| 74 | 75 | }; | |
| 75 | 76 | ||
| 76 | 77 | sdio_pwrseq: sdio-pwrseq { | |
| @@ -104,66 +105,6 @@ | |||
| 104 | 105 | enable-active-high; | |
| 105 | 106 | }; | |
| 106 | 107 | ||
| 107 | - | vdd_ddr: regulator-vddddr { | |
| 108 | - | /* | |
| 109 | - | * SY8003ADFC Regulator. | |
| 110 | - | */ | |
| 111 | - | compatible = "pwm-regulator"; | |
| 112 | - | regulator-name = "VDDDDR"; | |
| 113 | - | regulator-min-microvolt = <690000>; | |
| 114 | - | regulator-max-microvolt = <890000>; | |
| 115 | - | pwm-supply = <&dc_in>; | |
| 116 | - | pwms = <&pwm_ao_gh 0 1500 0>; | |
| 117 | - | pwm-dutycycle-range = <100 0>; | |
| 118 | - | regulator-boot-on; | |
| 119 | - | regulator-always-on; | |
| 120 | - | }; | |
| 121 | - | ||
| 122 | - | vdd_ee: regulator-vddee { | |
| 123 | - | /* | |
| 124 | - | * MP8756GD Regulator. | |
| 125 | - | */ | |
| 126 | - | compatible = "pwm-regulator"; | |
| 127 | - | regulator-name = "VDDEE"; | |
| 128 | - | regulator-min-microvolt = <700000>; | |
| 129 | - | regulator-max-microvolt = <922000>; | |
| 130 | - | pwm-supply = <&dc_in>; | |
| 131 | - | pwms = <&pwm_ao_ab 0 1500 0>; | |
| 132 | - | pwm-dutycycle-range = <100 0>; | |
| 133 | - | regulator-boot-on; | |
| 134 | - | regulator-always-on; | |
| 135 | - | }; | |
| 136 | - | ||
| 137 | - | vdd_gpu: regulator-vddgpu { | |
| 138 | - | /* | |
| 139 | - | * SY8003ADFC Regulator. | |
| 140 | - | */ | |
| 141 | - | compatible = "pwm-regulator"; | |
| 142 | - | regulator-name = "VDDGPU"; | |
| 143 | - | regulator-min-microvolt = <700000>; | |
| 144 | - | regulator-max-microvolt = <922000>; | |
| 145 | - | pwm-supply = <&dc_in>; | |
| 146 | - | pwms = <&pwm_ao_ef 0 1500 0>; | |
| 147 | - | pwm-dutycycle-range = <100 0>; | |
| 148 | - | regulator-boot-on; | |
| 149 | - | regulator-always-on; | |
| 150 | - | }; | |
| 151 | - | ||
| 152 | - | vdd_npu: regulator-vddnpu { | |
| 153 | - | /* | |
| 154 | - | * SY8003ADFC Regulator. | |
| 155 | - | */ | |
| 156 | - | compatible = "pwm-regulator"; | |
| 157 | - | regulator-name = "VDDNPU"; | |
| 158 | - | regulator-min-microvolt = <733000>; | |
| 159 | - | regulator-max-microvolt = <933000>; | |
| 160 | - | pwm-supply = <&dc_in>; | |
| 161 | - | pwms = <&pwm_ao_ef 1 1500 0>; | |
| 162 | - | pwm-dutycycle-range = <100 0>; | |
| 163 | - | regulator-boot-on; | |
| 164 | - | regulator-always-on; | |
| 165 | - | }; | |
| 166 | - | ||
| 167 | 108 | vddao_1v8: regulator-vddao-1v8 { | |
| 168 | 109 | compatible = "regulator-fixed"; | |
| 169 | 110 | regulator-name = "VDDAO_1V8"; | |
| @@ -182,36 +123,6 @@ | |||
| 182 | 123 | regulator-always-on; | |
| 183 | 124 | }; | |
| 184 | 125 | ||
| 185 | - | vddcpu_a: regulator-vddcpu-a { | |
| 186 | - | /* | |
| 187 | - | * MP8756GD Regulator. | |
| 188 | - | */ | |
| 189 | - | compatible = "pwm-regulator"; | |
| 190 | - | regulator-name = "VDDCPU_A"; | |
| 191 | - | regulator-min-microvolt = <689000>; | |
| 192 | - | regulator-max-microvolt = <1049000>; | |
| 193 | - | pwm-supply = <&dc_in>; | |
| 194 | - | pwms = <&pwm_ao_cd 1 1500 0>; | |
| 195 | - | pwm-dutycycle-range = <100 0>; | |
| 196 | - | regulator-boot-on; | |
| 197 | - | regulator-always-on; | |
| 198 | - | }; | |
| 199 | - | ||
| 200 | - | vddcpu_b: regulator-vddcpu-b { | |
| 201 | - | /* | |
| 202 | - | * MP8756GD Regulator. | |
| 203 | - | */ | |
| 204 | - | compatible = "pwm-regulator"; | |
| 205 | - | regulator-name = "VDDCPU_B"; | |
| 206 | - | regulator-min-microvolt = <689000>; | |
| 207 | - | regulator-max-microvolt = <1049000>; | |
| 208 | - | pwm-supply = <&dc_in>; | |
| 209 | - | pwms = <&pwm_ao_ab 1 1500 0>; | |
| 210 | - | pwm-dutycycle-range = <100 0>; | |
| 211 | - | regulator-boot-on; | |
| 212 | - | regulator-always-on; | |
| 213 | - | }; | |
| 214 | - | ||
| 215 | 126 | vddio_1v8: regulator-vddio-1v8 { | |
| 216 | 127 | compatible = "regulator-fixed"; | |
| 217 | 128 | regulator-name = "VDDIO_1V8"; | |
| @@ -262,27 +173,9 @@ | |||
| 262 | 173 | pinctrl-names = "default"; | |
| 263 | 174 | }; | |
| 264 | 175 | ||
| 265 | - | &pwm_ao_ab { | |
| 266 | - | status = "okay"; | |
| 267 | - | pinctrl-0 = <&pwm_ao_a_pins>, <&pwm_ao_b_pins>; | |
| 268 | - | pinctrl-names = "default"; | |
| 269 | - | }; | |
| 270 | - | ||
| 271 | 176 | &pwm_ao_cd { | |
| 272 | 177 | status = "okay"; | |
| 273 | - | pinctrl-0 = <&pwm_ao_c_d_pins>, <&pwm_ao_d_pins>; | |
| 274 | - | pinctrl-names = "default"; | |
| 275 | - | }; | |
| 276 | - | ||
| 277 | - | &pwm_ao_ef { | |
| 278 | - | status = "okay"; | |
| 279 | - | pinctrl-0 = <&pwm_ao_e_pins>, <&pwm_ao_f_pins>; | |
| 280 | - | pinctrl-names = "default"; | |
| 281 | - | }; | |
| 282 | - | ||
| 283 | - | &pwm_ao_gh { | |
| 284 | - | status = "okay"; | |
| 285 | - | pinctrl-0 = <&pwm_ao_g_e_pins>; | |
| 178 | + | pinctrl-0 = <&pwm_ao_c_d_pins>; | |
| 286 | 179 | pinctrl-names = "default"; | |
| 287 | 180 | }; | |
| 288 | 181 | ||
| @@ -373,6 +266,6 @@ | |||
| 373 | 266 | ||
| 374 | 267 | &uart_a { | |
| 375 | 268 | status = "okay"; | |
| 376 | - | clocks = <&xtal>, <&clkc_periphs CLKID_SYS_UART_A>, <&xtal>; | |
| 269 | + | clocks = <&xtal>, <&xtal>, <&xtal>; | |
| 377 | 270 | clock-names = "xtal", "pclk", "baud"; | |
| 378 | 271 | }; | |
modified arch/arm64/boot/dts/amlogic/amlogic-t7.dtsi
| @@ -458,25 +458,9 @@ | |||
| 458 | 458 | }; | |
| 459 | 459 | }; | |
| 460 | 460 | ||
| 461 | - | pwm_ao_g_d11_pins: pwm-ao-g-d11 { | |
| 461 | + | pwm_ao_g_pins: pwm-ao-g { | |
| 462 | 462 | mux { | |
| 463 | - | groups = "pwm_ao_g_d11"; | |
| 464 | - | function = "pwm_ao_g"; | |
| 465 | - | bias-disable; | |
| 466 | - | }; | |
| 467 | - | }; | |
| 468 | - | ||
| 469 | - | pwm_ao_g_d7_pins: pwm-ao-g-d7 { | |
| 470 | - | mux { | |
| 471 | - | groups = "pwm_ao_g_d7"; | |
| 472 | - | function = "pwm_ao_g"; | |
| 473 | - | bias-disable; | |
| 474 | - | }; | |
| 475 | - | }; | |
| 476 | - | ||
| 477 | - | pwm_ao_g_e_pins: pwm-ao-g-e { | |
| 478 | - | mux { | |
| 479 | - | groups = "pwm_ao_g_e"; | |
| 463 | + | groups = "pwm_ao_g"; | |
| 480 | 464 | function = "pwm_ao_g"; | |
| 481 | 465 | bias-disable; | |
| 482 | 466 | }; | |
| @@ -490,17 +474,9 @@ | |||
| 490 | 474 | }; | |
| 491 | 475 | }; | |
| 492 | 476 | ||
| 493 | - | pwm_ao_h_d5_pins: pwm-ao-h-d5 { | |
| 477 | + | pwm_ao_h_pins: pwm-ao-h { | |
| 494 | 478 | mux { | |
| 495 | - | groups = "pwm_ao_h_d5"; | |
| 496 | - | function = "pwm_ao_h"; | |
| 497 | - | bias-disable; | |
| 498 | - | }; | |
| 499 | - | }; | |
| 500 | - | ||
| 501 | - | pwm_ao_h_d10_pins: pwm-ao-h-d10 { | |
| 502 | - | mux { | |
| 503 | - | groups = "pwm_ao_h_d10"; | |
| 479 | + | groups = "pwm_ao_h"; | |
| 504 | 480 | function = "pwm_ao_h"; | |
| 505 | 481 | bias-disable; | |
| 506 | 482 | }; | |
| @@ -546,17 +522,9 @@ | |||
| 546 | 522 | }; | |
| 547 | 523 | }; | |
| 548 | 524 | ||
| 549 | - | pwm_vs_y_pins: pwm-vs-y { | |
| 550 | - | mux { | |
| 551 | - | groups = "pwm_vs_y"; | |
| 552 | - | function = "pwm_vs"; | |
| 553 | - | bias-disable; | |
| 554 | - | }; | |
| 555 | - | }; | |
| 556 | - | ||
| 557 | - | pwm_vs_h_pins: pwm-vs-h { | |
| 525 | + | pwm_vs_pins: pwm-vs { | |
| 558 | 526 | mux { | |
| 559 | - | groups = "pwm_vs_h"; | |
| 527 | + | groups = "pwm_vs"; | |
| 560 | 528 | function = "pwm_vs"; | |
| 561 | 529 | bias-disable; | |
| 562 | 530 | }; | |
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/boot/dts/renesas/r8a779f0.dtsi
| @@ -901,7 +901,6 @@ | |||
| 901 | 901 | clocks = <&cpg CPG_MOD 1514>, <&ufs30_clk>; | |
| 902 | 902 | clock-names = "fck", "ref_clk"; | |
| 903 | 903 | freq-table-hz = <200000000 200000000>, <38400000 38400000>; | |
| 904 | - | lanes-per-direction = <1>; | |
| 905 | 904 | power-domains = <&sysc R8A779F0_PD_ALWAYS_ON>; | |
| 906 | 905 | resets = <&cpg 1514>; | |
| 907 | 906 | status = "disabled"; | |
modified arch/arm64/boot/dts/renesas/r9a09g047.dtsi
| @@ -1913,28 +1913,23 @@ | |||
| 1913 | 1913 | ||
| 1914 | 1914 | mtl_tx_setup0: tx-queues-config { | |
| 1915 | 1915 | snps,tx-queues-to-use = <4>; | |
| 1916 | - | snps,tx-sched-wrr; | |
| 1917 | 1916 | ||
| 1918 | 1917 | queue0 { | |
| 1919 | - | snps,weight = <0x10>; | |
| 1920 | 1918 | snps,dcb-algorithm; | |
| 1921 | 1919 | snps,priority = <0x1>; | |
| 1922 | 1920 | }; | |
| 1923 | 1921 | ||
| 1924 | 1922 | queue1 { | |
| 1925 | - | snps,weight = <0x12>; | |
| 1926 | 1923 | snps,dcb-algorithm; | |
| 1927 | 1924 | snps,priority = <0x2>; | |
| 1928 | 1925 | }; | |
| 1929 | 1926 | ||
| 1930 | 1927 | queue2 { | |
| 1931 | - | snps,weight = <0x14>; | |
| 1932 | 1928 | snps,dcb-algorithm; | |
| 1933 | 1929 | snps,priority = <0x4>; | |
| 1934 | 1930 | }; | |
| 1935 | 1931 | ||
| 1936 | 1932 | queue3 { | |
| 1937 | - | snps,weight = <0x18>; | |
| 1938 | 1933 | snps,dcb-algorithm; | |
| 1939 | 1934 | snps,priority = <0x8>; | |
| 1940 | 1935 | }; | |
| @@ -2018,28 +2013,23 @@ | |||
| 2018 | 2013 | ||
| 2019 | 2014 | mtl_tx_setup1: tx-queues-config { | |
| 2020 | 2015 | snps,tx-queues-to-use = <4>; | |
| 2021 | - | snps,tx-sched-wrr; | |
| 2022 | 2016 | ||
| 2023 | 2017 | queue0 { | |
| 2024 | - | snps,weight = <0x10>; | |
| 2025 | 2018 | snps,dcb-algorithm; | |
| 2026 | 2019 | snps,priority = <0x1>; | |
| 2027 | 2020 | }; | |
| 2028 | 2021 | ||
| 2029 | 2022 | queue1 { | |
| 2030 | - | snps,weight = <0x12>; | |
| 2031 | 2023 | snps,dcb-algorithm; | |
| 2032 | 2024 | snps,priority = <0x2>; | |
| 2033 | 2025 | }; | |
| 2034 | 2026 | ||
| 2035 | 2027 | queue2 { | |
| 2036 | - | snps,weight = <0x14>; | |
| 2037 | 2028 | snps,dcb-algorithm; | |
| 2038 | 2029 | snps,priority = <0x4>; | |
| 2039 | 2030 | }; | |
| 2040 | 2031 | ||
| 2041 | 2032 | queue3 { | |
| 2042 | - | snps,weight = <0x18>; | |
| 2043 | 2033 | snps,dcb-algorithm; | |
| 2044 | 2034 | snps,priority = <0x8>; | |
| 2045 | 2035 | }; | |
modified arch/arm64/boot/dts/renesas/r9a09g056.dtsi
| @@ -1585,28 +1585,23 @@ | |||
| 1585 | 1585 | ||
| 1586 | 1586 | mtl_tx_setup0: tx-queues-config { | |
| 1587 | 1587 | snps,tx-queues-to-use = <4>; | |
| 1588 | - | snps,tx-sched-wrr; | |
| 1589 | 1588 | ||
| 1590 | 1589 | queue0 { | |
| 1591 | - | snps,weight = <0x10>; | |
| 1592 | 1590 | snps,dcb-algorithm; | |
| 1593 | 1591 | snps,priority = <0x1>; | |
| 1594 | 1592 | }; | |
| 1595 | 1593 | ||
| 1596 | 1594 | queue1 { | |
| 1597 | - | snps,weight = <0x12>; | |
| 1598 | 1595 | snps,dcb-algorithm; | |
| 1599 | 1596 | snps,priority = <0x2>; | |
| 1600 | 1597 | }; | |
| 1601 | 1598 | ||
| 1602 | 1599 | queue2 { | |
| 1603 | - | snps,weight = <0x14>; | |
| 1604 | 1600 | snps,dcb-algorithm; | |
| 1605 | 1601 | snps,priority = <0x4>; | |
| 1606 | 1602 | }; | |
| 1607 | 1603 | ||
| 1608 | 1604 | queue3 { | |
| 1609 | - | snps,weight = <0x18>; | |
| 1610 | 1605 | snps,dcb-algorithm; | |
| 1611 | 1606 | snps,priority = <0x8>; | |
| 1612 | 1607 | }; | |
| @@ -1691,28 +1686,23 @@ | |||
| 1691 | 1686 | ||
| 1692 | 1687 | mtl_tx_setup1: tx-queues-config { | |
| 1693 | 1688 | snps,tx-queues-to-use = <4>; | |
| 1694 | - | snps,tx-sched-wrr; | |
| 1695 | 1689 | ||
| 1696 | 1690 | queue0 { | |
| 1697 | - | snps,weight = <0x10>; | |
| 1698 | 1691 | snps,dcb-algorithm; | |
| 1699 | 1692 | snps,priority = <0x1>; | |
| 1700 | 1693 | }; | |
| 1701 | 1694 | ||
| 1702 | 1695 | queue1 { | |
| 1703 | - | snps,weight = <0x12>; | |
| 1704 | 1696 | snps,dcb-algorithm; | |
| 1705 | 1697 | snps,priority = <0x2>; | |
| 1706 | 1698 | }; | |
| 1707 | 1699 | ||
| 1708 | 1700 | queue2 { | |
| 1709 | - | snps,weight = <0x14>; | |
| 1710 | 1701 | snps,dcb-algorithm; | |
| 1711 | 1702 | snps,priority = <0x4>; | |
| 1712 | 1703 | }; | |
| 1713 | 1704 | ||
| 1714 | 1705 | queue3 { | |
| 1715 | - | snps,weight = <0x18>; | |
| 1716 | 1706 | snps,dcb-algorithm; | |
| 1717 | 1707 | snps,priority = <0x8>; | |
| 1718 | 1708 | }; | |
modified arch/arm64/boot/dts/renesas/r9a09g057.dtsi
| @@ -1715,28 +1715,23 @@ | |||
| 1715 | 1715 | ||
| 1716 | 1716 | mtl_tx_setup0: tx-queues-config { | |
| 1717 | 1717 | snps,tx-queues-to-use = <4>; | |
| 1718 | - | snps,tx-sched-wrr; | |
| 1719 | 1718 | ||
| 1720 | 1719 | queue0 { | |
| 1721 | - | snps,weight = <0x10>; | |
| 1722 | 1720 | snps,dcb-algorithm; | |
| 1723 | 1721 | snps,priority = <0x1>; | |
| 1724 | 1722 | }; | |
| 1725 | 1723 | ||
| 1726 | 1724 | queue1 { | |
| 1727 | - | snps,weight = <0x12>; | |
| 1728 | 1725 | snps,dcb-algorithm; | |
| 1729 | 1726 | snps,priority = <0x2>; | |
| 1730 | 1727 | }; | |
| 1731 | 1728 | ||
| 1732 | 1729 | queue2 { | |
| 1733 | - | snps,weight = <0x14>; | |
| 1734 | 1730 | snps,dcb-algorithm; | |
| 1735 | 1731 | snps,priority = <0x4>; | |
| 1736 | 1732 | }; | |
| 1737 | 1733 | ||
| 1738 | 1734 | queue3 { | |
| 1739 | - | snps,weight = <0x18>; | |
| 1740 | 1735 | snps,dcb-algorithm; | |
| 1741 | 1736 | snps,priority = <0x8>; | |
| 1742 | 1737 | }; | |
| @@ -1821,28 +1816,23 @@ | |||
| 1821 | 1816 | ||
| 1822 | 1817 | mtl_tx_setup1: tx-queues-config { | |
| 1823 | 1818 | snps,tx-queues-to-use = <4>; | |
| 1824 | - | snps,tx-sched-wrr; | |
| 1825 | 1819 | ||
| 1826 | 1820 | queue0 { | |
| 1827 | - | snps,weight = <0x10>; | |
| 1828 | 1821 | snps,dcb-algorithm; | |
| 1829 | 1822 | snps,priority = <0x1>; | |
| 1830 | 1823 | }; | |
| 1831 | 1824 | ||
| 1832 | 1825 | queue1 { | |
| 1833 | - | snps,weight = <0x12>; | |
| 1834 | 1826 | snps,dcb-algorithm; | |
| 1835 | 1827 | snps,priority = <0x2>; | |
| 1836 | 1828 | }; | |
| 1837 | 1829 | ||
| 1838 | 1830 | queue2 { | |
| 1839 | - | snps,weight = <0x14>; | |
| 1840 | 1831 | snps,dcb-algorithm; | |
| 1841 | 1832 | snps,priority = <0x4>; | |
| 1842 | 1833 | }; | |
| 1843 | 1834 | ||
| 1844 | 1835 | queue3 { | |
| 1845 | - | snps,weight = <0x18>; | |
| 1846 | 1836 | snps,dcb-algorithm; | |
| 1847 | 1837 | snps,priority = <0x8>; | |
| 1848 | 1838 | }; | |
modified arch/arm64/boot/dts/renesas/r9a09g077.dtsi
| @@ -642,45 +642,36 @@ | |||
| 642 | 642 | ||
| 643 | 643 | mtl_tx_setup0: tx-queues-config { | |
| 644 | 644 | snps,tx-queues-to-use = <8>; | |
| 645 | - | snps,tx-sched-wrr; | |
| 646 | 645 | ||
| 647 | 646 | queue0 { | |
| 648 | - | snps,weight = <0x10>; | |
| 649 | 647 | snps,dcb-algorithm; | |
| 650 | 648 | }; | |
| 651 | 649 | ||
| 652 | 650 | queue1 { | |
| 653 | - | snps,weight = <0x11>; | |
| 654 | 651 | snps,dcb-algorithm; | |
| 655 | 652 | }; | |
| 656 | 653 | ||
| 657 | 654 | queue2 { | |
| 658 | - | snps,weight = <0x12>; | |
| 659 | 655 | snps,dcb-algorithm; | |
| 660 | 656 | }; | |
| 661 | 657 | ||
| 662 | 658 | queue3 { | |
| 663 | - | snps,weight = <0x13>; | |
| 664 | 659 | snps,dcb-algorithm; | |
| 665 | 660 | }; | |
| 666 | 661 | ||
| 667 | 662 | queue4 { | |
| 668 | - | snps,weight = <0x14>; | |
| 669 | 663 | snps,dcb-algorithm; | |
| 670 | 664 | }; | |
| 671 | 665 | ||
| 672 | 666 | queue5 { | |
| 673 | - | snps,weight = <0x15>; | |
| 674 | 667 | snps,dcb-algorithm; | |
| 675 | 668 | }; | |
| 676 | 669 | ||
| 677 | 670 | queue6 { | |
| 678 | - | snps,weight = <0x16>; | |
| 679 | 671 | snps,dcb-algorithm; | |
| 680 | 672 | }; | |
| 681 | 673 | ||
| 682 | 674 | queue7 { | |
| 683 | - | snps,weight = <0x17>; | |
| 684 | 675 | snps,dcb-algorithm; | |
| 685 | 676 | }; | |
| 686 | 677 | }; | |
| @@ -797,45 +788,36 @@ | |||
| 797 | 788 | ||
| 798 | 789 | mtl_tx_setup1: tx-queues-config { | |
| 799 | 790 | snps,tx-queues-to-use = <8>; | |
| 800 | - | snps,tx-sched-wrr; | |
| 801 | 791 | ||
| 802 | 792 | queue0 { | |
| 803 | - | snps,weight = <0x10>; | |
| 804 | 793 | snps,dcb-algorithm; | |
| 805 | 794 | }; | |
| 806 | 795 | ||
| 807 | 796 | queue1 { | |
| 808 | - | snps,weight = <0x11>; | |
| 809 | 797 | snps,dcb-algorithm; | |
| 810 | 798 | }; | |
| 811 | 799 | ||
| 812 | 800 | queue2 { | |
| 813 | - | snps,weight = <0x12>; | |
| 814 | 801 | snps,dcb-algorithm; | |
| 815 | 802 | }; | |
| 816 | 803 | ||
| 817 | 804 | queue3 { | |
| 818 | - | snps,weight = <0x13>; | |
| 819 | 805 | snps,dcb-algorithm; | |
| 820 | 806 | }; | |
| 821 | 807 | ||
| 822 | 808 | queue4 { | |
| 823 | - | snps,weight = <0x14>; | |
| 824 | 809 | snps,dcb-algorithm; | |
| 825 | 810 | }; | |
| 826 | 811 | ||
| 827 | 812 | queue5 { | |
| 828 | - | snps,weight = <0x15>; | |
| 829 | 813 | snps,dcb-algorithm; | |
| 830 | 814 | }; | |
| 831 | 815 | ||
| 832 | 816 | queue6 { | |
| 833 | - | snps,weight = <0x16>; | |
| 834 | 817 | snps,dcb-algorithm; | |
| 835 | 818 | }; | |
| 836 | 819 | ||
| 837 | 820 | queue7 { | |
| 838 | - | snps,weight = <0x17>; | |
| 839 | 821 | snps,dcb-algorithm; | |
| 840 | 822 | }; | |
| 841 | 823 | }; | |
| @@ -952,45 +934,36 @@ | |||
| 952 | 934 | ||
| 953 | 935 | mtl_tx_setup2: tx-queues-config { | |
| 954 | 936 | snps,tx-queues-to-use = <8>; | |
| 955 | - | snps,tx-sched-wrr; | |
| 956 | 937 | ||
| 957 | 938 | queue0 { | |
| 958 | - | snps,weight = <0x10>; | |
| 959 | 939 | snps,dcb-algorithm; | |
| 960 | 940 | }; | |
| 961 | 941 | ||
| 962 | 942 | queue1 { | |
| 963 | - | snps,weight = <0x11>; | |
| 964 | 943 | snps,dcb-algorithm; | |
| 965 | 944 | }; | |
| 966 | 945 | ||
| 967 | 946 | queue2 { | |
| 968 | - | snps,weight = <0x12>; | |
| 969 | 947 | snps,dcb-algorithm; | |
| 970 | 948 | }; | |
| 971 | 949 | ||
| 972 | 950 | queue3 { | |
| 973 | - | snps,weight = <0x13>; | |
| 974 | 951 | snps,dcb-algorithm; | |
| 975 | 952 | }; | |
| 976 | 953 | ||
| 977 | 954 | queue4 { | |
| 978 | - | snps,weight = <0x14>; | |
| 979 | 955 | snps,dcb-algorithm; | |
| 980 | 956 | }; | |
| 981 | 957 | ||
| 982 | 958 | queue5 { | |
| 983 | - | snps,weight = <0x15>; | |
| 984 | 959 | snps,dcb-algorithm; | |
| 985 | 960 | }; | |
| 986 | 961 | ||
| 987 | 962 | queue6 { | |
| 988 | - | snps,weight = <0x16>; | |
| 989 | 963 | snps,dcb-algorithm; | |
| 990 | 964 | }; | |
| 991 | 965 | ||
| 992 | 966 | queue7 { | |
| 993 | - | snps,weight = <0x17>; | |
| 994 | 967 | snps,dcb-algorithm; | |
| 995 | 968 | }; | |
| 996 | 969 | }; | |
modified arch/arm64/boot/dts/renesas/r9a09g087.dtsi
| @@ -643,45 +643,36 @@ | |||
| 643 | 643 | ||
| 644 | 644 | mtl_tx_setup0: tx-queues-config { | |
| 645 | 645 | snps,tx-queues-to-use = <8>; | |
| 646 | - | snps,tx-sched-wrr; | |
| 647 | 646 | ||
| 648 | 647 | queue0 { | |
| 649 | - | snps,weight = <0x10>; | |
| 650 | 648 | snps,dcb-algorithm; | |
| 651 | 649 | }; | |
| 652 | 650 | ||
| 653 | 651 | queue1 { | |
| 654 | - | snps,weight = <0x11>; | |
| 655 | 652 | snps,dcb-algorithm; | |
| 656 | 653 | }; | |
| 657 | 654 | ||
| 658 | 655 | queue2 { | |
| 659 | - | snps,weight = <0x12>; | |
| 660 | 656 | snps,dcb-algorithm; | |
| 661 | 657 | }; | |
| 662 | 658 | ||
| 663 | 659 | queue3 { | |
| 664 | - | snps,weight = <0x13>; | |
| 665 | 660 | snps,dcb-algorithm; | |
| 666 | 661 | }; | |
| 667 | 662 | ||
| 668 | 663 | queue4 { | |
| 669 | - | snps,weight = <0x14>; | |
| 670 | 664 | snps,dcb-algorithm; | |
| 671 | 665 | }; | |
| 672 | 666 | ||
| 673 | 667 | queue5 { | |
| 674 | - | snps,weight = <0x15>; | |
| 675 | 668 | snps,dcb-algorithm; | |
| 676 | 669 | }; | |
| 677 | 670 | ||
| 678 | 671 | queue6 { | |
| 679 | - | snps,weight = <0x16>; | |
| 680 | 672 | snps,dcb-algorithm; | |
| 681 | 673 | }; | |
| 682 | 674 | ||
| 683 | 675 | queue7 { | |
| 684 | - | snps,weight = <0x17>; | |
| 685 | 676 | snps,dcb-algorithm; | |
| 686 | 677 | }; | |
| 687 | 678 | }; | |
| @@ -799,45 +790,36 @@ | |||
| 799 | 790 | ||
| 800 | 791 | mtl_tx_setup1: tx-queues-config { | |
| 801 | 792 | snps,tx-queues-to-use = <8>; | |
| 802 | - | snps,tx-sched-wrr; | |
| 803 | 793 | ||
| 804 | 794 | queue0 { | |
| 805 | - | snps,weight = <0x10>; | |
| 806 | 795 | snps,dcb-algorithm; | |
| 807 | 796 | }; | |
| 808 | 797 | ||
| 809 | 798 | queue1 { | |
| 810 | - | snps,weight = <0x11>; | |
| 811 | 799 | snps,dcb-algorithm; | |
| 812 | 800 | }; | |
| 813 | 801 | ||
| 814 | 802 | queue2 { | |
| 815 | - | snps,weight = <0x12>; | |
| 816 | 803 | snps,dcb-algorithm; | |
| 817 | 804 | }; | |
| 818 | 805 | ||
| 819 | 806 | queue3 { | |
| 820 | - | snps,weight = <0x13>; | |
| 821 | 807 | snps,dcb-algorithm; | |
| 822 | 808 | }; | |
| 823 | 809 | ||
| 824 | 810 | queue4 { | |
| 825 | - | snps,weight = <0x14>; | |
| 826 | 811 | snps,dcb-algorithm; | |
| 827 | 812 | }; | |
| 828 | 813 | ||
| 829 | 814 | queue5 { | |
| 830 | - | snps,weight = <0x15>; | |
| 831 | 815 | snps,dcb-algorithm; | |
| 832 | 816 | }; | |
| 833 | 817 | ||
| 834 | 818 | queue6 { | |
| 835 | - | snps,weight = <0x16>; | |
| 836 | 819 | snps,dcb-algorithm; | |
| 837 | 820 | }; | |
| 838 | 821 | ||
| 839 | 822 | queue7 { | |
| 840 | - | snps,weight = <0x17>; | |
| 841 | 823 | snps,dcb-algorithm; | |
| 842 | 824 | }; | |
| 843 | 825 | }; | |
| @@ -955,45 +937,36 @@ | |||
| 955 | 937 | ||
| 956 | 938 | mtl_tx_setup2: tx-queues-config { | |
| 957 | 939 | snps,tx-queues-to-use = <8>; | |
| 958 | - | snps,tx-sched-wrr; | |
| 959 | 940 | ||
| 960 | 941 | queue0 { | |
| 961 | - | snps,weight = <0x10>; | |
| 962 | 942 | snps,dcb-algorithm; | |
| 963 | 943 | }; | |
| 964 | 944 | ||
| 965 | 945 | queue1 { | |
| 966 | - | snps,weight = <0x11>; | |
| 967 | 946 | snps,dcb-algorithm; | |
| 968 | 947 | }; | |
| 969 | 948 | ||
| 970 | 949 | queue2 { | |
| 971 | - | snps,weight = <0x12>; | |
| 972 | 950 | snps,dcb-algorithm; | |
| 973 | 951 | }; | |
| 974 | 952 | ||
| 975 | 953 | queue3 { | |
| 976 | - | snps,weight = <0x13>; | |
| 977 | 954 | snps,dcb-algorithm; | |
| 978 | 955 | }; | |
| 979 | 956 | ||
| 980 | 957 | queue4 { | |
| 981 | - | snps,weight = <0x14>; | |
| 982 | 958 | snps,dcb-algorithm; | |
| 983 | 959 | }; | |
| 984 | 960 | ||
| 985 | 961 | queue5 { | |
| 986 | - | snps,weight = <0x15>; | |
| 987 | 962 | snps,dcb-algorithm; | |
| 988 | 963 | }; | |
| 989 | 964 | ||
| 990 | 965 | queue6 { | |
| 991 | - | snps,weight = <0x16>; | |
| 992 | 966 | snps,dcb-algorithm; | |
| 993 | 967 | }; | |
| 994 | 968 | ||
| 995 | 969 | queue7 { | |
| 996 | - | snps,weight = <0x17>; | |
| 997 | 970 | snps,dcb-algorithm; | |
| 998 | 971 | }; | |
| 999 | 972 | }; | |
modified arch/arm64/include/asm/el2_setup.h
| @@ -418,7 +418,6 @@ | |||
| 418 | 418 | b.lt .Lskip_fgt2_\@ | |
| 419 | 419 | ||
| 420 | 420 | mov x0, xzr | |
| 421 | - | mov x2, xzr | |
| 422 | 421 | mrs x1, id_aa64dfr0_el1 | |
| 423 | 422 | ubfx x1, x1, #ID_AA64DFR0_EL1_PMUVer_SHIFT, #4 | |
| 424 | 423 | cmp x1, #ID_AA64DFR0_EL1_PMUVer_V3P9 | |
| @@ -427,11 +426,6 @@ | |||
| 427 | 426 | orr x0, x0, #HDFGRTR2_EL2_nPMICNTR_EL0 | |
| 428 | 427 | orr x0, x0, #HDFGRTR2_EL2_nPMICFILTR_EL0 | |
| 429 | 428 | orr x0, x0, #HDFGRTR2_EL2_nPMUACR_EL1 | |
| 430 | - | orr x2, x2, #HDFGWTR2_EL2_nPMICNTR_EL0 | |
| 431 | - | orr x2, x2, #HDFGWTR2_EL2_nPMICFILTR_EL0 | |
| 432 | - | orr x2, x2, #HDFGWTR2_EL2_nPMUACR_EL1 | |
| 433 | - | /* PMZR_EL0 is write-only, so it has no read trap to disable */ | |
| 434 | - | orr x2, x2, #HDFGWTR2_EL2_nPMZR_EL0 | |
| 435 | 429 | .Lskip_pmuv3p9_\@: | |
| 436 | 430 | /* If SPE is implemented, */ | |
| 437 | 431 | __spe_vers_imp .Lskip_spefds_\@, ID_AA64DFR0_EL1_PMSVer_IMP, x1 | |
| @@ -442,11 +436,10 @@ | |||
| 442 | 436 | cbz x1, .Lskip_spefds_\@ | |
| 443 | 437 | /* disable traps of PMSDSFR to EL2. */ | |
| 444 | 438 | orr x0, x0, #HDFGRTR2_EL2_nPMSDSFR_EL1 | |
| 445 | - | orr x2, x2, #HDFGWTR2_EL2_nPMSDSFR_EL1 | |
| 446 | 439 | ||
| 447 | 440 | .Lskip_spefds_\@: | |
| 448 | 441 | msr_s SYS_HDFGRTR2_EL2, x0 | |
| 449 | - | msr_s SYS_HDFGWTR2_EL2, x2 | |
| 442 | + | msr_s SYS_HDFGWTR2_EL2, x0 | |
| 450 | 443 | msr_s SYS_HFGRTR2_EL2, xzr | |
| 451 | 444 | msr_s SYS_HFGWTR2_EL2, xzr | |
| 452 | 445 | msr_s SYS_HFGITR2_EL2, xzr | |
modified arch/arm64/include/asm/io.h
| @@ -280,8 +280,7 @@ static inline void __iomem *ioremap_prot(phys_addr_t phys, size_t size, | |||
| 280 | 280 | pgprot_t prot; | |
| 281 | 281 | ptval_t user_prot_val = pgprot_val(user_prot); | |
| 282 | 282 | ||
| 283 | - | /* Reject PROT_NONE and exec-only */ | |
| 284 | - | if (!(user_prot_val & PTE_USER)) | |
| 283 | + | if (WARN_ON_ONCE(!(user_prot_val & PTE_USER))) | |
| 285 | 284 | return NULL; | |
| 286 | 285 | ||
| 287 | 286 | prot = __pgprot_modify(PAGE_KERNEL, PTE_ATTRINDX_MASK, | |
modified arch/arm64/include/asm/kvm_host.h
| @@ -322,7 +322,7 @@ struct kvm_arch { | |||
| 322 | 322 | * Stage 2 paging state for VMs with nested S2 using a virtual | |
| 323 | 323 | * VMID. | |
| 324 | 324 | */ | |
| 325 | - | struct kvm_s2_mmu **nested_mmus; | |
| 325 | + | struct kvm_s2_mmu *nested_mmus; | |
| 326 | 326 | size_t nested_mmus_size; | |
| 327 | 327 | int nested_mmus_next; | |
| 328 | 328 | ||
modified arch/arm64/include/asm/kvm_nested.h
| @@ -66,8 +66,7 @@ static inline u64 translate_ttbr0_el2_to_ttbr0_el1(u64 ttbr0) | |||
| 66 | 66 | ||
| 67 | 67 | extern bool forward_smc_trap(struct kvm_vcpu *vcpu); | |
| 68 | 68 | extern bool forward_debug_exception(struct kvm_vcpu *vcpu); | |
| 69 | - | extern int kvm_init_nested(struct kvm *kvm); | |
| 70 | - | extern void kvm_destroy_nested(struct kvm *kvm); | |
| 69 | + | extern void kvm_init_nested(struct kvm *kvm); | |
| 71 | 70 | extern int kvm_vcpu_init_nested(struct kvm_vcpu *vcpu); | |
| 72 | 71 | extern void kvm_init_nested_s2_mmu(struct kvm_s2_mmu *mmu); | |
| 73 | 72 | extern struct kvm_s2_mmu *lookup_s2_mmu(struct kvm_vcpu *vcpu); | |
modified arch/arm64/include/asm/kvm_pkvm.h
| @@ -65,7 +65,8 @@ static inline bool kvm_pkvm_ioctl_allowed(struct kvm *kvm, unsigned int ioctl) | |||
| 65 | 65 | int r; | |
| 66 | 66 | ||
| 67 | 67 | r = kvm_get_cap_for_kvm_ioctl(ioctl, &ext); | |
| 68 | - | if (r < 0) | |
| 68 | + | ||
| 69 | + | if (WARN_ON_ONCE(r < 0)) | |
| 69 | 70 | return false; | |
| 70 | 71 | ||
| 71 | 72 | return kvm_pkvm_ext_allowed(kvm, ext); | |
modified arch/arm64/include/asm/percpu.h
| @@ -77,7 +77,7 @@ __percpu_##name##_case_##sz(void *ptr, unsigned long val) \ | |||
| 77 | 77 | " stxr" #sfx "\t%w[loop], %" #w "[tmp], %[ptr]\n" \ | |
| 78 | 78 | " cbnz %w[loop], 1b", \ | |
| 79 | 79 | /* LSE atomics */ \ | |
| 80 | - | #op_lse #sfx "\t%" #w "[val], %" #w "[tmp], %[ptr]\n" \ | |
| 80 | + | #op_lse "\t%" #w "[val], %" #w "[tmp], %[ptr]\n" \ | |
| 81 | 81 | __nops(3)) \ | |
| 82 | 82 | : [loop] "=&r" (loop), [tmp] "=&r" (tmp), \ | |
| 83 | 83 | [ptr] "+Q"(*(u##sz *)ptr) \ | |
| @@ -98,7 +98,7 @@ __percpu_##name##_return_case_##sz(void *ptr, unsigned long val) \ | |||
| 98 | 98 | " stxr" #sfx "\t%w[loop], %" #w "[ret], %[ptr]\n" \ | |
| 99 | 99 | " cbnz %w[loop], 1b", \ | |
| 100 | 100 | /* LSE atomics */ \ | |
| 101 | - | #op_lse #sfx "\t%" #w "[val], %" #w "[ret], %[ptr]\n" \ | |
| 101 | + | #op_lse "\t%" #w "[val], %" #w "[ret], %[ptr]\n" \ | |
| 102 | 102 | #op_llsc "\t%" #w "[ret], %" #w "[ret], %" #w "[val]\n" \ | |
| 103 | 103 | __nops(2)) \ | |
| 104 | 104 | : [loop] "=&r" (loop), [ret] "=&r" (ret), \ | |
| @@ -179,13 +179,13 @@ PERCPU_RET_OP(add, add, ldadd) | |||
| 179 | 179 | _pcp_protect_return(__percpu_read_64, pcp) | |
| 180 | 180 | ||
| 181 | 181 | #define this_cpu_write_1(pcp, val) \ | |
| 182 | - | _pcp_protect(__percpu_write_8, pcp, (unsigned long)(val)) | |
| 182 | + | _pcp_protect(__percpu_write_8, pcp, (unsigned long)val) | |
| 183 | 183 | #define this_cpu_write_2(pcp, val) \ | |
| 184 | - | _pcp_protect(__percpu_write_16, pcp, (unsigned long)(val)) | |
| 184 | + | _pcp_protect(__percpu_write_16, pcp, (unsigned long)val) | |
| 185 | 185 | #define this_cpu_write_4(pcp, val) \ | |
| 186 | - | _pcp_protect(__percpu_write_32, pcp, (unsigned long)(val)) | |
| 186 | + | _pcp_protect(__percpu_write_32, pcp, (unsigned long)val) | |
| 187 | 187 | #define this_cpu_write_8(pcp, val) \ | |
| 188 | - | _pcp_protect(__percpu_write_64, pcp, (unsigned long)(val)) | |
| 188 | + | _pcp_protect(__percpu_write_64, pcp, (unsigned long)val) | |
| 189 | 189 | ||
| 190 | 190 | #define this_cpu_add_1(pcp, val) \ | |
| 191 | 191 | _pcp_protect(__percpu_add_case_8, pcp, val) | |
| @@ -206,13 +206,13 @@ PERCPU_RET_OP(add, add, ldadd) | |||
| 206 | 206 | _pcp_protect_return(__percpu_add_return_case_64, pcp, val) | |
| 207 | 207 | ||
| 208 | 208 | #define this_cpu_and_1(pcp, val) \ | |
| 209 | - | _pcp_protect(__percpu_andnot_case_8, pcp, ~(u8)(val)) | |
| 209 | + | _pcp_protect(__percpu_andnot_case_8, pcp, ~val) | |
| 210 | 210 | #define this_cpu_and_2(pcp, val) \ | |
| 211 | - | _pcp_protect(__percpu_andnot_case_16, pcp, ~(u16)(val)) | |
| 211 | + | _pcp_protect(__percpu_andnot_case_16, pcp, ~val) | |
| 212 | 212 | #define this_cpu_and_4(pcp, val) \ | |
| 213 | - | _pcp_protect(__percpu_andnot_case_32, pcp, ~(u32)(val)) | |
| 213 | + | _pcp_protect(__percpu_andnot_case_32, pcp, ~val) | |
| 214 | 214 | #define this_cpu_and_8(pcp, val) \ | |
| 215 | - | _pcp_protect(__percpu_andnot_case_64, pcp, ~(u64)(val)) | |
| 215 | + | _pcp_protect(__percpu_andnot_case_64, pcp, ~val) | |
| 216 | 216 | ||
| 217 | 217 | #define this_cpu_or_1(pcp, val) \ | |
| 218 | 218 | _pcp_protect(__percpu_or_case_8, pcp, val) | |
modified arch/arm64/kernel/cpu_errata.c
| @@ -28,21 +28,18 @@ bool cpu_errata_set_target_impl(u64 num, void *impl_cpus) | |||
| 28 | 28 | return true; | |
| 29 | 29 | } | |
| 30 | 30 | ||
| 31 | - | static inline bool __is_midr_in_range(u32 midr, struct midr_range const *range) | |
| 32 | - | { | |
| 33 | - | return midr_is_cpu_model_range(midr, range->model, | |
| 34 | - | range->rv_min, range->rv_max); | |
| 35 | - | } | |
| 36 | - | ||
| 37 | 31 | static inline bool is_midr_in_range(struct midr_range const *range) | |
| 38 | 32 | { | |
| 39 | 33 | int i; | |
| 40 | 34 | ||
| 41 | 35 | if (!target_impl_cpu_num) | |
| 42 | - | return __is_midr_in_range(read_cpuid_id(), range); | |
| 36 | + | return midr_is_cpu_model_range(read_cpuid_id(), range->model, | |
| 37 | + | range->rv_min, range->rv_max); | |
| 43 | 38 | ||
| 44 | 39 | for (i = 0; i < target_impl_cpu_num; i++) { | |
| 45 | - | if (__is_midr_in_range(target_impl_cpus[i].midr, range)) | |
| 40 | + | if (midr_is_cpu_model_range(target_impl_cpus[i].midr, | |
| 41 | + | range->model, | |
| 42 | + | range->rv_min, range->rv_max)) | |
| 46 | 43 | return true; | |
| 47 | 44 | } | |
| 48 | 45 | return false; | |
| @@ -62,7 +59,7 @@ __is_affected_midr_range(const struct arm64_cpu_capabilities *entry, | |||
| 62 | 59 | u32 midr, u32 revidr) | |
| 63 | 60 | { | |
| 64 | 61 | const struct arm64_midr_revidr *fix; | |
| 65 | - | if (!__is_midr_in_range(midr, &entry->midr_range)) | |
| 62 | + | if (!is_midr_in_range(&entry->midr_range)) | |
| 66 | 63 | return false; | |
| 67 | 64 | ||
| 68 | 65 | midr &= MIDR_REVISION_MASK | MIDR_VARIANT_MASK; | |
modified arch/arm64/kernel/hibernate-asm.S
| @@ -89,8 +89,6 @@ alternative_insn "dc cvau, x4", "dc civac, x4", ARM64_WORKAROUND_CLEAN_CACHE | |||
| 89 | 89 | isb | |
| 90 | 90 | ||
| 91 | 91 | cbz x24, 3f /* Do we need to re-initialise EL2? */ | |
| 92 | - | mov x1, x24 | |
| 93 | - | mov x0, #HVC_SET_VECTORS | |
| 94 | 92 | hvc #0 | |
| 95 | 93 | 3: ret | |
| 96 | 94 | SYM_CODE_END(swsusp_arch_suspend_exit) | |
modified arch/arm64/kernel/hibernate.c
| @@ -423,8 +423,8 @@ int __nocfi swsusp_arch_resume(void) | |||
| 423 | 423 | * Create a second copy of just the linear map, and use this when | |
| 424 | 424 | * restoring. | |
| 425 | 425 | */ | |
| 426 | - | rc = trans_pgd_create_copy(&trans_info, &tmp_pg_dir, | |
| 427 | - | _PAGE_OFFSET(vabits_actual), PAGE_END); | |
| 426 | + | rc = trans_pgd_create_copy(&trans_info, &tmp_pg_dir, PAGE_OFFSET, | |
| 427 | + | PAGE_END); | |
| 428 | 428 | if (rc) | |
| 429 | 429 | return rc; | |
| 430 | 430 | ||
modified arch/arm64/kernel/mte.c
| @@ -476,7 +476,7 @@ static int __access_remote_tags(struct mm_struct *mm, unsigned long addr, | |||
| 476 | 476 | * was never mapped with PROT_MTE. | |
| 477 | 477 | */ | |
| 478 | 478 | if (!(vma->vm_flags & VM_MTE)) { | |
| 479 | - | err = -EIO; | |
| 479 | + | err = -EOPNOTSUPP; | |
| 480 | 480 | put_page(page); | |
| 481 | 481 | break; | |
| 482 | 482 | } | |
modified arch/arm64/kernel/pi/idreg-override.c
| @@ -186,7 +186,6 @@ static const struct ftr_set_desc isar2 __prel64_initconst = { | |||
| 186 | 186 | .name = "id_aa64isar2", | |
| 187 | 187 | .override = &id_aa64isar2_override, | |
| 188 | 188 | .fields = { | |
| 189 | - | FIELD("wfxt", ID_AA64ISAR2_EL1_WFxT_SHIFT, NULL), | |
| 190 | 189 | FIELD("gpa3", ID_AA64ISAR2_EL1_GPA3_SHIFT, NULL), | |
| 191 | 190 | FIELD("apa3", ID_AA64ISAR2_EL1_APA3_SHIFT, NULL), | |
| 192 | 191 | FIELD("mops", ID_AA64ISAR2_EL1_MOPS_SHIFT, NULL), | |
| @@ -255,7 +254,6 @@ static const struct { | |||
| 255 | 254 | "id_aa64isar1.api=0 id_aa64isar1.apa=0 " | |
| 256 | 255 | "id_aa64isar2.gpa3=0 id_aa64isar2.apa3=0" }, | |
| 257 | 256 | { "arm64.nomops", "id_aa64isar2.mops=0" }, | |
| 258 | - | { "arm64.nowfxt", "id_aa64isar2.wfxt=0" }, | |
| 259 | 257 | { "arm64.nomte", "id_aa64pfr1.mte=0" }, | |
| 260 | 258 | { "nokaslr", "arm64_sw.nokaslr=1" }, | |
| 261 | 259 | { "rodata=off", "arm64_sw.rodataoff=1" }, | |
modified arch/arm64/kvm/arm.c
| @@ -236,6 +236,8 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type) | |||
| 236 | 236 | mutex_unlock(&kvm->lock); | |
| 237 | 237 | #endif | |
| 238 | 238 | ||
| 239 | + | kvm_init_nested(kvm); | |
| 240 | + | ||
| 239 | 241 | ret = kvm_share_hyp(kvm, kvm + 1); | |
| 240 | 242 | if (ret) | |
| 241 | 243 | return ret; | |
| @@ -250,10 +252,6 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type) | |||
| 250 | 252 | if (ret) | |
| 251 | 253 | goto err_free_cpumask; | |
| 252 | 254 | ||
| 253 | - | ret = kvm_init_nested(kvm); | |
| 254 | - | if (ret) | |
| 255 | - | goto err_uninit_mmu; | |
| 256 | - | ||
| 257 | 255 | if (is_protected_kvm_enabled()) { | |
| 258 | 256 | /* | |
| 259 | 257 | * If any failures occur after this is successful, make sure to | |
| @@ -282,7 +280,6 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type) | |||
| 282 | 280 | ||
| 283 | 281 | err_uninit_mmu: | |
| 284 | 282 | kvm_uninit_stage2_mmu(kvm); | |
| 285 | - | kvm_destroy_nested(kvm); | |
| 286 | 283 | err_free_cpumask: | |
| 287 | 284 | free_cpumask_var(kvm->arch.supported_cpus); | |
| 288 | 285 | err_unshare_kvm: | |
| @@ -340,7 +337,6 @@ void kvm_arch_destroy_vm(struct kvm *kvm) | |||
| 340 | 337 | ||
| 341 | 338 | kvm_unshare_hyp(kvm, kvm + 1); | |
| 342 | 339 | ||
| 343 | - | kvm_destroy_nested(kvm); | |
| 344 | 340 | kvm_arm_teardown_hypercalls(kvm); | |
| 345 | 341 | } | |
| 346 | 342 | ||
| @@ -1133,7 +1129,7 @@ static int kvm_vcpu_suspend(struct kvm_vcpu *vcpu) | |||
| 1133 | 1129 | static int check_vcpu_requests(struct kvm_vcpu *vcpu) | |
| 1134 | 1130 | { | |
| 1135 | 1131 | if (kvm_request_pending(vcpu)) { | |
| 1136 | - | if (kvm_test_request(KVM_REQ_VM_DEAD, vcpu)) | |
| 1132 | + | if (kvm_check_request(KVM_REQ_VM_DEAD, vcpu)) | |
| 1137 | 1133 | return -EIO; | |
| 1138 | 1134 | ||
| 1139 | 1135 | if (kvm_check_request(KVM_REQ_SLEEP, vcpu)) | |
modified arch/arm64/kvm/emulate-nested.c
| @@ -1445,7 +1445,7 @@ static const struct encoding_to_trap_config encoding_to_fgt[] __initconst = { | |||
| 1445 | 1445 | SR_FGT(OP_AT_S1E1A, HFGITR, ATS1E1A, 1), | |
| 1446 | 1446 | SR_FGT(OP_COSP_RCTX, HFGITR, COSPRCTX, 1), | |
| 1447 | 1447 | SR_FGT(OP_GCSPUSHX, HFGITR, nGCSEPP, 0), | |
| 1448 | - | SR_FGT(OP_GCSPOPCX, HFGITR, nGCSEPP, 0), | |
| 1448 | + | SR_FGT(OP_GCSPOPX, HFGITR, nGCSEPP, 0), | |
| 1449 | 1449 | SR_FGT(OP_GCSPUSHM, HFGITR, nGCSPUSHM_EL1, 0), | |
| 1450 | 1450 | SR_FGT(OP_BRB_IALL, HFGITR, nBRBIALL, 0), | |
| 1451 | 1451 | SR_FGT(OP_BRB_INJ, HFGITR, nBRBINJ, 0), | |
modified arch/arm64/kvm/hyp/include/nvhe/mem_protect.h
| @@ -52,10 +52,8 @@ int __pkvm_host_test_clear_young_guest(u64 gfn, u64 nr_pages, bool mkold, struct | |||
| 52 | 52 | int __pkvm_host_mkyoung_guest(u64 gfn, struct pkvm_hyp_vcpu *vcpu); | |
| 53 | 53 | ||
| 54 | 54 | bool addr_is_memory(phys_addr_t phys); | |
| 55 | - | bool addr_is_hyp_text(phys_addr_t phys); | |
| 56 | 55 | int host_stage2_idmap_locked(phys_addr_t addr, u64 size, enum kvm_pgtable_prot prot); | |
| 57 | 56 | int host_stage2_set_owner_locked(phys_addr_t addr, u64 size, u8 owner_id); | |
| 58 | - | bool host_stage2_pte_is_hyp_owned(kvm_pte_t pte); | |
| 59 | 57 | int kvm_host_prepare_stage2(void *pgt_pool_base); | |
| 60 | 58 | int kvm_guest_prepare_stage2(struct pkvm_hyp_vm *vm, void *pgd); | |
| 61 | 59 | void kvm_guest_destroy_stage2(struct pkvm_hyp_vm *vm); | |
modified arch/arm64/kvm/hyp/include/nvhe/mm.h
| @@ -29,7 +29,6 @@ int __pkvm_create_private_mapping(phys_addr_t phys, size_t size, | |||
| 29 | 29 | enum kvm_pgtable_prot prot, | |
| 30 | 30 | unsigned long *haddr); | |
| 31 | 31 | int pkvm_create_stack(phys_addr_t phys, unsigned long *haddr); | |
| 32 | - | int pkvm_check_host_ownership(void); | |
| 33 | 32 | int pkvm_alloc_private_va_range(size_t size, unsigned long *haddr); | |
| 34 | 33 | ||
| 35 | 34 | #endif /* __KVM_HYP_MM_H */ | |
modified arch/arm64/kvm/hyp/nvhe/mem_protect.c
| @@ -450,14 +450,6 @@ bool addr_is_memory(phys_addr_t phys) | |||
| 450 | 450 | return !!find_mem_range(phys, &range); | |
| 451 | 451 | } | |
| 452 | 452 | ||
| 453 | - | bool addr_is_hyp_text(phys_addr_t phys) | |
| 454 | - | { | |
| 455 | - | phys_addr_t start = ALIGN_DOWN(__hyp_pa(__hyp_text_start), PAGE_SIZE); | |
| 456 | - | phys_addr_t end = PAGE_ALIGN(__hyp_pa(__hyp_text_end)); | |
| 457 | - | ||
| 458 | - | return phys >= start && phys < end; | |
| 459 | - | } | |
| 460 | - | ||
| 461 | 453 | static bool is_in_mem_range(u64 addr, struct kvm_mem_range *range) | |
| 462 | 454 | { | |
| 463 | 455 | return range->start <= addr && addr < range->end; | |
| @@ -641,18 +633,6 @@ int host_stage2_set_owner_locked(phys_addr_t addr, u64 size, u8 owner_id) | |||
| 641 | 633 | return ret; | |
| 642 | 634 | } | |
| 643 | 635 | ||
| 644 | - | bool host_stage2_pte_is_hyp_owned(kvm_pte_t pte) | |
| 645 | - | { | |
| 646 | - | if (kvm_pte_valid(pte)) | |
| 647 | - | return false; | |
| 648 | - | ||
| 649 | - | if (FIELD_GET(KVM_INVALID_PTE_TYPE_MASK, pte) != | |
| 650 | - | KVM_HOST_INVALID_PTE_TYPE_DONATION) | |
| 651 | - | return false; | |
| 652 | - | ||
| 653 | - | return FIELD_GET(KVM_HOST_DONATION_PTE_OWNER_MASK, pte) == PKVM_ID_HYP; | |
| 654 | - | } | |
| 655 | - | ||
| 656 | 636 | #define KVM_HOST_PTE_OWNER_GUEST_HANDLE_MASK GENMASK(15, 0) | |
| 657 | 637 | /* We need 40 bits for the GFN to cover a 52-bit IPA with 4k pages and LPA2 */ | |
| 658 | 638 | #define KVM_HOST_PTE_OWNER_GUEST_GFN_MASK GENMASK(55, 16) | |
modified arch/arm64/kvm/hyp/nvhe/mm.c
| @@ -25,7 +25,6 @@ struct memblock_region hyp_memory[HYP_MEMBLOCK_REGIONS]; | |||
| 25 | 25 | unsigned int hyp_memblock_nr; | |
| 26 | 26 | ||
| 27 | 27 | static u64 __io_map_base; | |
| 28 | - | static u64 __io_map_next; | |
| 29 | 28 | ||
| 30 | 29 | struct hyp_fixmap_slot { | |
| 31 | 30 | u64 addr; | |
| @@ -51,7 +50,7 @@ static int __pkvm_alloc_private_va_range(unsigned long start, size_t size) | |||
| 51 | 50 | ||
| 52 | 51 | hyp_assert_lock_held(&pkvm_pgd_lock); | |
| 53 | 52 | ||
| 54 | - | if (!start || start < __io_map_next) | |
| 53 | + | if (!start || start < __io_map_base) | |
| 55 | 54 | return -EINVAL; | |
| 56 | 55 | ||
| 57 | 56 | /* The allocated size is always a multiple of PAGE_SIZE */ | |
| @@ -61,7 +60,7 @@ static int __pkvm_alloc_private_va_range(unsigned long start, size_t size) | |||
| 61 | 60 | if (cur > __hyp_vmemmap) | |
| 62 | 61 | return -ENOMEM; | |
| 63 | 62 | ||
| 64 | - | __io_map_next = cur; | |
| 63 | + | __io_map_base = cur; | |
| 65 | 64 | ||
| 66 | 65 | return 0; | |
| 67 | 66 | } | |
| @@ -71,7 +70,7 @@ static int __pkvm_alloc_private_va_range(unsigned long start, size_t size) | |||
| 71 | 70 | * @size: The size of the VA range to reserve. | |
| 72 | 71 | * @haddr: The hypervisor virtual start address of the allocation. | |
| 73 | 72 | * | |
| 74 | - | * The private virtual address (VA) range is allocated above __io_map_next | |
| 73 | + | * The private virtual address (VA) range is allocated above __io_map_base | |
| 75 | 74 | * and aligned based on the order of @size. | |
| 76 | 75 | * | |
| 77 | 76 | * Return: 0 on success or negative error code on failure. | |
| @@ -82,7 +81,7 @@ int pkvm_alloc_private_va_range(size_t size, unsigned long *haddr) | |||
| 82 | 81 | int ret; | |
| 83 | 82 | ||
| 84 | 83 | hyp_spin_lock(&pkvm_pgd_lock); | |
| 85 | - | addr = __io_map_next; | |
| 84 | + | addr = __io_map_base; | |
| 86 | 85 | ret = __pkvm_alloc_private_va_range(addr, size); | |
| 87 | 86 | hyp_spin_unlock(&pkvm_pgd_lock); | |
| 88 | 87 | ||
| @@ -342,7 +341,7 @@ static int create_fixblock(void) | |||
| 342 | 341 | return -EINVAL; | |
| 343 | 342 | ||
| 344 | 343 | hyp_spin_lock(&pkvm_pgd_lock); | |
| 345 | - | addr = ALIGN(__io_map_next, PMD_SIZE); | |
| 344 | + | addr = ALIGN(__io_map_base, PMD_SIZE); | |
| 346 | 345 | ret = __pkvm_alloc_private_va_range(addr, PMD_SIZE); | |
| 347 | 346 | if (ret) | |
| 348 | 347 | goto unlock; | |
| @@ -427,7 +426,6 @@ int hyp_create_idmap(u32 hyp_va_bits) | |||
| 427 | 426 | */ | |
| 428 | 427 | __io_map_base = start & BIT(hyp_va_bits - 2); | |
| 429 | 428 | __io_map_base ^= BIT(hyp_va_bits - 2); | |
| 430 | - | __io_map_next = __io_map_base; | |
| 431 | 429 | __hyp_vmemmap = __io_map_base | BIT(hyp_va_bits - 3); | |
| 432 | 430 | ||
| 433 | 431 | return __pkvm_create_mappings(start, end - start, start, PAGE_HYP_EXEC); | |
| @@ -435,19 +433,19 @@ int hyp_create_idmap(u32 hyp_va_bits) | |||
| 435 | 433 | ||
| 436 | 434 | int pkvm_create_stack(phys_addr_t phys, unsigned long *haddr) | |
| 437 | 435 | { | |
| 438 | - | unsigned long addr, prev_next; | |
| 436 | + | unsigned long addr, prev_base; | |
| 439 | 437 | size_t size; | |
| 440 | 438 | int ret; | |
| 441 | 439 | ||
| 442 | 440 | hyp_spin_lock(&pkvm_pgd_lock); | |
| 443 | 441 | ||
| 444 | - | prev_next = __io_map_next; | |
| 442 | + | prev_base = __io_map_base; | |
| 445 | 443 | /* | |
| 446 | 444 | * Efficient stack verification using the NVHE_STACK_SHIFT bit implies | |
| 447 | 445 | * an alignment of our allocation on the order of the size. | |
| 448 | 446 | */ | |
| 449 | 447 | size = NVHE_STACK_SIZE * 2; | |
| 450 | - | addr = ALIGN(__io_map_next, size); | |
| 448 | + | addr = ALIGN(__io_map_base, size); | |
| 451 | 449 | ||
| 452 | 450 | ret = __pkvm_alloc_private_va_range(addr, size); | |
| 453 | 451 | if (!ret) { | |
| @@ -463,7 +461,7 @@ int pkvm_create_stack(phys_addr_t phys, unsigned long *haddr) | |||
| 463 | 461 | ret = kvm_pgtable_hyp_map(&pkvm_pgtable, addr + NVHE_STACK_SIZE, | |
| 464 | 462 | NVHE_STACK_SIZE, phys, PAGE_HYP); | |
| 465 | 463 | if (ret) | |
| 466 | - | __io_map_next = prev_next; | |
| 464 | + | __io_map_base = prev_base; | |
| 467 | 465 | } | |
| 468 | 466 | hyp_spin_unlock(&pkvm_pgd_lock); | |
| 469 | 467 | ||
| @@ -472,65 +470,6 @@ int pkvm_create_stack(phys_addr_t phys, unsigned long *haddr) | |||
| 472 | 470 | return ret; | |
| 473 | 471 | } | |
| 474 | 472 | ||
| 475 | - | static int check_page_ownership(phys_addr_t phys) | |
| 476 | - | { | |
| 477 | - | kvm_pte_t pte; | |
| 478 | - | bool host_ok; | |
| 479 | - | int ret; | |
| 480 | - | ||
| 481 | - | if (addr_is_memory(phys)) { | |
| 482 | - | struct hyp_page *page = hyp_phys_to_page(phys); | |
| 483 | - | ||
| 484 | - | if (get_hyp_state(page) != PKVM_PAGE_OWNED || | |
| 485 | - | get_host_state(page) != PKVM_NOPAGE) | |
| 486 | - | return -EPERM; | |
| 487 | - | } | |
| 488 | - | ||
| 489 | - | ret = kvm_pgtable_get_leaf(&host_mmu.pgt, phys, &pte, NULL); | |
| 490 | - | if (ret) | |
| 491 | - | return ret; | |
| 492 | - | ||
| 493 | - | /* Hyp text may stay host-readable, see fix_host_ownership_walker(). */ | |
| 494 | - | if (kvm_pte_valid(pte) && addr_is_hyp_text(phys)) | |
| 495 | - | host_ok = !(kvm_pgtable_stage2_pte_prot(pte) & KVM_PGTABLE_PROT_W); | |
| 496 | - | else | |
| 497 | - | host_ok = host_stage2_pte_is_hyp_owned(pte); | |
| 498 | - | ||
| 499 | - | return host_ok ? 0 : -EPERM; | |
| 500 | - | } | |
| 501 | - | ||
| 502 | - | static int check_host_ownership_walker(const struct kvm_pgtable_visit_ctx *ctx, | |
| 503 | - | enum kvm_pgtable_walk_flags visit) | |
| 504 | - | { | |
| 505 | - | phys_addr_t phys, end; | |
| 506 | - | int ret; | |
| 507 | - | ||
| 508 | - | if (!kvm_pte_valid(ctx->old)) | |
| 509 | - | return 0; | |
| 510 | - | ||
| 511 | - | phys = kvm_pte_to_phys(ctx->old); | |
| 512 | - | end = phys + kvm_granule_size(ctx->level); | |
| 513 | - | for (; phys < end; phys += PAGE_SIZE) { | |
| 514 | - | ret = check_page_ownership(phys); | |
| 515 | - | if (ret) | |
| 516 | - | return ret; | |
| 517 | - | } | |
| 518 | - | ||
| 519 | - | return 0; | |
| 520 | - | } | |
| 521 | - | ||
| 522 | - | int pkvm_check_host_ownership(void) | |
| 523 | - | { | |
| 524 | - | struct kvm_pgtable_walker walker = { | |
| 525 | - | .cb = check_host_ownership_walker, | |
| 526 | - | .flags = KVM_PGTABLE_WALK_LEAF, | |
| 527 | - | }; | |
| 528 | - | ||
| 529 | - | /* The private range and the vmemmap share one quarter of the VA space. */ | |
| 530 | - | return kvm_pgtable_walk(&pkvm_pgtable, __io_map_base, | |
| 531 | - | BIT(pkvm_pgtable.ia_bits - 2), &walker); | |
| 532 | - | } | |
| 533 | - | ||
| 534 | 473 | static void *admit_host_page(void *arg) | |
| 535 | 474 | { | |
| 536 | 475 | struct kvm_hyp_memcache *host_mc = arg; | |
modified arch/arm64/kvm/hyp/nvhe/pkvm.c
| @@ -360,7 +360,7 @@ static void pkvm_init_features_from_host(struct pkvm_hyp_vm *hyp_vm, const struc | |||
| 360 | 360 | if (test_bit(KVM_ARCH_FLAG_WRITABLE_IMP_ID_REGS, &host_arch_flags)) | |
| 361 | 361 | hyp_vm->kvm.arch.midr_el1 = host_kvm->arch.midr_el1; | |
| 362 | 362 | ||
| 363 | - | goto out; | |
| 363 | + | return; | |
| 364 | 364 | } | |
| 365 | 365 | ||
| 366 | 366 | if (kvm_pkvm_ext_allowed(kvm, KVM_CAP_ARM_MTE)) | |
| @@ -379,14 +379,13 @@ static void pkvm_init_features_from_host(struct pkvm_hyp_vm *hyp_vm, const struc | |||
| 379 | 379 | if (kvm_pkvm_ext_allowed(kvm, KVM_CAP_ARM_PTRAUTH_GENERIC)) | |
| 380 | 380 | set_bit(KVM_ARM_VCPU_PTRAUTH_GENERIC, allowed_features); | |
| 381 | 381 | ||
| 382 | - | if (kvm_pkvm_ext_allowed(kvm, KVM_CAP_ARM_SVE)) | |
| 382 | + | if (kvm_pkvm_ext_allowed(kvm, KVM_CAP_ARM_SVE)) { | |
| 383 | 383 | set_bit(KVM_ARM_VCPU_SVE, allowed_features); | |
| 384 | + | kvm->arch.flags |= host_arch_flags & BIT(KVM_ARCH_FLAG_GUEST_HAS_SVE); | |
| 385 | + | } | |
| 384 | 386 | ||
| 385 | 387 | bitmap_and(kvm->arch.vcpu_features, host_kvm->arch.vcpu_features, | |
| 386 | 388 | allowed_features, KVM_VCPU_MAX_FEATURES); | |
| 387 | - | out: | |
| 388 | - | __assign_bit(KVM_ARCH_FLAG_GUEST_HAS_SVE, &kvm->arch.flags, | |
| 389 | - | kvm_vcpu_has_feature(kvm, KVM_ARM_VCPU_SVE)); | |
| 390 | 389 | } | |
| 391 | 390 | ||
| 392 | 391 | static void unpin_host_vcpu(struct kvm_vcpu *host_vcpu) | |
| @@ -399,10 +398,10 @@ static void unpin_host_sve_state(struct pkvm_hyp_vcpu *hyp_vcpu) | |||
| 399 | 398 | { | |
| 400 | 399 | void *sve_state; | |
| 401 | 400 | ||
| 402 | - | sve_state = hyp_vcpu->vcpu.arch.sve_state; | |
| 403 | - | if (!sve_state) | |
| 401 | + | if (!vcpu_has_feature(&hyp_vcpu->vcpu, KVM_ARM_VCPU_SVE)) | |
| 404 | 402 | return; | |
| 405 | 403 | ||
| 404 | + | sve_state = hyp_vcpu->vcpu.arch.sve_state; | |
| 406 | 405 | hyp_unpin_shared_mem(sve_state, | |
| 407 | 406 | sve_state + vcpu_sve_state_size(&hyp_vcpu->vcpu)); | |
| 408 | 407 | } | |
| @@ -451,7 +450,7 @@ static int pkvm_vcpu_init_sve(struct pkvm_hyp_vcpu *hyp_vcpu, struct kvm_vcpu *h | |||
| 451 | 450 | unsigned int sve_max_vl; | |
| 452 | 451 | size_t sve_state_size; | |
| 453 | 452 | void *sve_state; | |
| 454 | - | int ret; | |
| 453 | + | int ret = 0; | |
| 455 | 454 | ||
| 456 | 455 | if (!vcpu_has_feature(vcpu, KVM_ARM_VCPU_SVE)) { | |
| 457 | 456 | vcpu_clear_flag(vcpu, VCPU_SVE_FINALIZED); | |
| @@ -460,21 +459,25 @@ static int pkvm_vcpu_init_sve(struct pkvm_hyp_vcpu *hyp_vcpu, struct kvm_vcpu *h | |||
| 460 | 459 | ||
| 461 | 460 | /* Limit guest vector length to the maximum supported by the host. */ | |
| 462 | 461 | sve_max_vl = min(READ_ONCE(host_vcpu->arch.sve_max_vl), kvm_host_sve_max_vl); | |
| 462 | + | sve_state_size = sve_state_size_from_vl(sve_max_vl); | |
| 463 | 463 | sve_state = kern_hyp_va(READ_ONCE(host_vcpu->arch.sve_state)); | |
| 464 | 464 | ||
| 465 | - | if (!sve_vl_valid(sve_max_vl) || !sve_state) | |
| 466 | - | return -EINVAL; | |
| 467 | - | ||
| 468 | - | sve_state_size = sve_state_size_from_vl(sve_max_vl); | |
| 465 | + | if (!sve_state || !sve_state_size) { | |
| 466 | + | ret = -EINVAL; | |
| 467 | + | goto err; | |
| 468 | + | } | |
| 469 | 469 | ||
| 470 | 470 | ret = hyp_pin_shared_mem(sve_state, sve_state + sve_state_size); | |
| 471 | 471 | if (ret) | |
| 472 | - | return ret; | |
| 472 | + | goto err; | |
| 473 | 473 | ||
| 474 | 474 | vcpu->arch.sve_state = sve_state; | |
| 475 | 475 | vcpu->arch.sve_max_vl = sve_max_vl; | |
| 476 | 476 | ||
| 477 | 477 | return 0; | |
| 478 | + | err: | |
| 479 | + | clear_bit(KVM_ARM_VCPU_SVE, vcpu->kvm->arch.vcpu_features); | |
| 480 | + | return ret; | |
| 478 | 481 | } | |
| 479 | 482 | ||
| 480 | 483 | static int vm_copy_id_regs(struct pkvm_hyp_vcpu *hyp_vcpu) | |
modified arch/arm64/kvm/hyp/nvhe/setup.c
| @@ -217,7 +217,7 @@ static int fix_host_ownership_walker(const struct kvm_pgtable_visit_ctx *ctx, | |||
| 217 | 217 | case PKVM_PAGE_OWNED: | |
| 218 | 218 | set_hyp_state(page, PKVM_PAGE_OWNED); | |
| 219 | 219 | /* hyp text is RO in the host stage-2 to be inspected on panic. */ | |
| 220 | - | if (addr_is_hyp_text(phys)) { | |
| 220 | + | if (prot == PAGE_HYP_EXEC) { | |
| 221 | 221 | set_host_state(page, PKVM_NOPAGE); | |
| 222 | 222 | return host_stage2_idmap_locked(phys, PAGE_SIZE, KVM_PGTABLE_PROT_R); | |
| 223 | 223 | } else { | |
| @@ -269,16 +269,6 @@ static int fix_host_ownership(void) | |||
| 269 | 269 | return ret; | |
| 270 | 270 | } | |
| 271 | 271 | ||
| 272 | - | /* The stacks sit in the private VA range, not the linear map. */ | |
| 273 | - | for (i = 0; i < hyp_nr_cpus; i++) { | |
| 274 | - | struct kvm_nvhe_init_params *params = per_cpu_ptr(&kvm_init_params, i); | |
| 275 | - | u64 start = params->stack_hyp_va - NVHE_STACK_SIZE; | |
| 276 | - | ||
| 277 | - | ret = kvm_pgtable_walk(&pkvm_pgtable, start, NVHE_STACK_SIZE, &walker); | |
| 278 | - | if (ret) | |
| 279 | - | return ret; | |
| 280 | - | } | |
| 281 | - | ||
| 282 | 272 | return 0; | |
| 283 | 273 | } | |
| 284 | 274 | ||
| @@ -334,10 +324,6 @@ void __noreturn __pkvm_init_finalise(void) | |||
| 334 | 324 | if (ret) | |
| 335 | 325 | goto out; | |
| 336 | 326 | ||
| 337 | - | ret = pkvm_check_host_ownership(); | |
| 338 | - | if (ret) | |
| 339 | - | goto out; | |
| 340 | - | ||
| 341 | 327 | ret = hyp_ffa_init(ffa_proxy_pages); | |
| 342 | 328 | if (ret) | |
| 343 | 329 | goto out; | |
modified arch/arm64/kvm/hypercalls.c
| @@ -185,8 +185,7 @@ static int kvm_smccc_set_filter(struct kvm *kvm, struct kvm_smccc_filter __user | |||
| 185 | 185 | start = filter.base; | |
| 186 | 186 | end = start + filter.nr_functions - 1; | |
| 187 | 187 | ||
| 188 | - | if (!filter.nr_functions || end < start || | |
| 189 | - | filter.action >= NR_SMCCC_FILTER_ACTIONS) | |
| 188 | + | if (end < start || filter.action >= NR_SMCCC_FILTER_ACTIONS) | |
| 190 | 189 | return -EINVAL; | |
| 191 | 190 | ||
| 192 | 191 | mutex_lock(&kvm->arch.config_lock); | |
modified arch/arm64/kvm/mmu.c
| @@ -59,36 +59,27 @@ static phys_addr_t stage2_range_addr_end(phys_addr_t addr, phys_addr_t end) | |||
| 59 | 59 | * long will also starve other vCPUs. We have to also make sure that the page | |
| 60 | 60 | * tables are not freed while we released the lock. | |
| 61 | 61 | */ | |
| 62 | - | static int stage2_apply_range(struct kvm_s2_mmu *mmu, phys_addr_t start, | |
| 62 | + | static int stage2_apply_range(struct kvm_s2_mmu *mmu, phys_addr_t addr, | |
| 63 | 63 | phys_addr_t end, | |
| 64 | 64 | int (*fn)(struct kvm_pgtable *, u64, u64), | |
| 65 | 65 | bool resched) | |
| 66 | 66 | { | |
| 67 | 67 | struct kvm *kvm = kvm_s2_mmu_to_kvm(mmu); | |
| 68 | - | bool lock_dropped = false; | |
| 69 | - | phys_addr_t addr = start; | |
| 70 | 68 | int ret; | |
| 71 | 69 | u64 next; | |
| 72 | 70 | ||
| 73 | 71 | do { | |
| 74 | 72 | struct kvm_pgtable *pgt = mmu->pgt; | |
| 75 | - | /* | |
| 76 | - | * We may be raced on PGT teardown when we release the | |
| 77 | - | * kvm->mmu_lock. That's fine as the PGT is legitimately no | |
| 78 | - | * longer present. | |
| 79 | - | */ | |
| 80 | 73 | if (!pgt) | |
| 81 | - | return lock_dropped ? 0 : -EINVAL; | |
| 74 | + | return -EINVAL; | |
| 82 | 75 | ||
| 83 | 76 | next = stage2_range_addr_end(addr, end); | |
| 84 | 77 | ret = fn(pgt, addr, next - addr); | |
| 85 | 78 | if (ret) | |
| 86 | 79 | break; | |
| 87 | 80 | ||
| 88 | - | if (resched && next != end) { | |
| 81 | + | if (resched && next != end) | |
| 89 | 82 | cond_resched_rwlock_write(&kvm->mmu_lock); | |
| 90 | - | lock_dropped = true; | |
| 91 | - | } | |
| 92 | 83 | } while (addr = next, addr != end); | |
| 93 | 84 | ||
| 94 | 85 | return ret; | |
modified arch/arm64/kvm/nested.c
| @@ -45,24 +45,11 @@ struct vncr_tlb { | |||
| 45 | 45 | */ | |
| 46 | 46 | #define S2_MMU_PER_VCPU 2 | |
| 47 | 47 | ||
| 48 | - | int kvm_init_nested(struct kvm *kvm) | |
| 48 | + | void kvm_init_nested(struct kvm *kvm) | |
| 49 | 49 | { | |
| 50 | - | kvm->arch.nested_mmus = kvmalloc_objs(struct kvm_s2_mmu *, | |
| 51 | - | KVM_MAX_VCPUS * S2_MMU_PER_VCPU, | |
| 52 | - | GFP_KERNEL_ACCOUNT); | |
| 50 | + | kvm->arch.nested_mmus = NULL; | |
| 53 | 51 | kvm->arch.nested_mmus_size = 0; | |
| 54 | 52 | atomic_set(&kvm->arch.vncr_tlb_count, 0); | |
| 55 | - | ||
| 56 | - | return kvm->arch.nested_mmus ? 0 : -ENOMEM; | |
| 57 | - | } | |
| 58 | - | ||
| 59 | - | void kvm_destroy_nested(struct kvm *kvm) | |
| 60 | - | { | |
| 61 | - | for (int i = 0; i < kvm->arch.nested_mmus_size; i+= S2_MMU_PER_VCPU) | |
| 62 | - | kvfree(kvm->arch.nested_mmus[i]); | |
| 63 | - | ||
| 64 | - | kvm->arch.nested_mmus_size = 0; | |
| 65 | - | kvfree(kvm->arch.nested_mmus); | |
| 66 | 53 | } | |
| 67 | 54 | ||
| 68 | 55 | static int init_nested_s2_mmu(struct kvm *kvm, struct kvm_s2_mmu *mmu) | |
| @@ -83,9 +70,8 @@ static int init_nested_s2_mmu(struct kvm *kvm, struct kvm_s2_mmu *mmu) | |||
| 83 | 70 | int kvm_vcpu_init_nested(struct kvm_vcpu *vcpu) | |
| 84 | 71 | { | |
| 85 | 72 | struct kvm *kvm = vcpu->kvm; | |
| 86 | - | int num_mmus; | |
| 87 | - | ||
| 88 | - | lockdep_assert_held(&kvm->arch.config_lock); | |
| 73 | + | struct kvm_s2_mmu *tmp; | |
| 74 | + | int num_mmus, ret = 0; | |
| 89 | 75 | ||
| 90 | 76 | if (test_bit(KVM_ARM_VCPU_HAS_EL2_E2H0, kvm->arch.vcpu_features) && | |
| 91 | 77 | !cpus_have_final_cap(ARM64_HAS_HCR_NV1)) | |
| @@ -98,40 +84,51 @@ int kvm_vcpu_init_nested(struct kvm_vcpu *vcpu) | |||
| 98 | 84 | if (!vcpu->arch.ctxt.vncr_array) | |
| 99 | 85 | return -ENOMEM; | |
| 100 | 86 | ||
| 87 | + | /* | |
| 88 | + | * Let's treat memory allocation failures as benign: If we fail to | |
| 89 | + | * allocate anything, return an error and keep the allocated array | |
| 90 | + | * alive. Userspace may try to recover by initializing the vcpu | |
| 91 | + | * again, and there is no reason to affect the whole VM for this. | |
| 92 | + | */ | |
| 101 | 93 | num_mmus = atomic_read(&kvm->online_vcpus) * S2_MMU_PER_VCPU; | |
| 102 | 94 | ||
| 103 | 95 | if (num_mmus > kvm->arch.nested_mmus_size) { | |
| 104 | - | struct kvm_s2_mmu *tmp; | |
| 105 | - | int i, ret = 0; | |
| 106 | - | ||
| 107 | - | tmp = kvzalloc_objs(*tmp, S2_MMU_PER_VCPU, GFP_KERNEL_ACCOUNT); | |
| 96 | + | tmp = kvzalloc_objs(*tmp, num_mmus, GFP_KERNEL_ACCOUNT); | |
| 108 | 97 | if (!tmp) | |
| 109 | - | ret = -ENOMEM; | |
| 98 | + | return -ENOMEM; | |
| 110 | 99 | ||
| 111 | - | for (i = 0; !ret && i < S2_MMU_PER_VCPU; i++) { | |
| 112 | - | ret = init_nested_s2_mmu(kvm, &tmp[i]); | |
| 113 | - | if (ret) | |
| 114 | - | break; | |
| 115 | - | } | |
| 100 | + | write_lock(&kvm->mmu_lock); | |
| 116 | 101 | ||
| 117 | - | if (ret) { | |
| 118 | - | while (--i >= 0) | |
| 119 | - | kvm_free_stage2_pgd(&tmp[i]); | |
| 102 | + | if (kvm->arch.nested_mmus_size) { | |
| 103 | + | memcpy(tmp, kvm->arch.nested_mmus, | |
| 104 | + | size_mul(sizeof(*tmp), kvm->arch.nested_mmus_size)); | |
| 120 | 105 | ||
| 121 | - | kvfree(tmp); | |
| 122 | - | free_page((unsigned long)vcpu->arch.ctxt.vncr_array); | |
| 123 | - | vcpu->arch.ctxt.vncr_array = NULL; | |
| 124 | - | return ret; | |
| 106 | + | for (int i = 0; i < kvm->arch.nested_mmus_size; i++) | |
| 107 | + | tmp[i].pgt->mmu = &tmp[i]; | |
| 125 | 108 | } | |
| 126 | 109 | ||
| 127 | - | guard(write_lock)(&kvm->mmu_lock); | |
| 110 | + | swap(kvm->arch.nested_mmus, tmp); | |
| 111 | + | ||
| 112 | + | write_unlock(&kvm->mmu_lock); | |
| 113 | + | ||
| 114 | + | kvfree(tmp); | |
| 115 | + | } | |
| 116 | + | ||
| 117 | + | for (int i = kvm->arch.nested_mmus_size; !ret && i < num_mmus; i++) | |
| 118 | + | ret = init_nested_s2_mmu(kvm, &kvm->arch.nested_mmus[i]); | |
| 128 | 119 | ||
| 129 | - | for (i = 0; i < S2_MMU_PER_VCPU; i++) | |
| 130 | - | kvm->arch.nested_mmus[i + kvm->arch.nested_mmus_size] = &tmp[i]; | |
| 120 | + | if (ret) { | |
| 121 | + | for (int i = kvm->arch.nested_mmus_size; i < num_mmus; i++) | |
| 122 | + | kvm_free_stage2_pgd(&kvm->arch.nested_mmus[i]); | |
| 131 | 123 | ||
| 132 | - | kvm->arch.nested_mmus_size += S2_MMU_PER_VCPU; | |
| 124 | + | free_page((unsigned long)vcpu->arch.ctxt.vncr_array); | |
| 125 | + | vcpu->arch.ctxt.vncr_array = NULL; | |
| 126 | + | ||
| 127 | + | return ret; | |
| 133 | 128 | } | |
| 134 | 129 | ||
| 130 | + | kvm->arch.nested_mmus_size = num_mmus; | |
| 131 | + | ||
| 135 | 132 | return 0; | |
| 136 | 133 | } | |
| 137 | 134 | ||
| @@ -745,7 +742,7 @@ void kvm_s2_mmu_iterate_by_vmid(struct kvm *kvm, u16 vmid, | |||
| 745 | 742 | write_lock(&kvm->mmu_lock); | |
| 746 | 743 | ||
| 747 | 744 | for (int i = 0; i < kvm->arch.nested_mmus_size; i++) { | |
| 748 | - | struct kvm_s2_mmu *mmu = kvm->arch.nested_mmus[i]; | |
| 745 | + | struct kvm_s2_mmu *mmu = &kvm->arch.nested_mmus[i]; | |
| 749 | 746 | ||
| 750 | 747 | if (!kvm_s2_mmu_valid(mmu)) | |
| 751 | 748 | continue; | |
| @@ -787,7 +784,7 @@ struct kvm_s2_mmu *lookup_s2_mmu(struct kvm_vcpu *vcpu) | |||
| 787 | 784 | * if S2 translation is disabled. | |
| 788 | 785 | */ | |
| 789 | 786 | for (int i = 0; i < kvm->arch.nested_mmus_size; i++) { | |
| 790 | - | struct kvm_s2_mmu *mmu = kvm->arch.nested_mmus[i]; | |
| 787 | + | struct kvm_s2_mmu *mmu = &kvm->arch.nested_mmus[i]; | |
| 791 | 788 | ||
| 792 | 789 | if (!kvm_s2_mmu_valid(mmu)) | |
| 793 | 790 | continue; | |
| @@ -826,7 +823,7 @@ static struct kvm_s2_mmu *get_s2_mmu_nested(struct kvm_vcpu *vcpu) | |||
| 826 | 823 | for (i = kvm->arch.nested_mmus_next; | |
| 827 | 824 | i < (kvm->arch.nested_mmus_size + kvm->arch.nested_mmus_next); | |
| 828 | 825 | i++) { | |
| 829 | - | s2_mmu = kvm->arch.nested_mmus[i % kvm->arch.nested_mmus_size]; | |
| 826 | + | s2_mmu = &kvm->arch.nested_mmus[i % kvm->arch.nested_mmus_size]; | |
| 830 | 827 | ||
| 831 | 828 | if (atomic_read(&s2_mmu->refcnt) == 0) | |
| 832 | 829 | break; | |
| @@ -1263,17 +1260,6 @@ void kvm_handle_s1e2_tlbi(struct kvm_vcpu *vcpu, u32 inst, u64 val) | |||
| 1263 | 1260 | invalidate_vncr_va(vcpu->kvm, &scope); | |
| 1264 | 1261 | } | |
| 1265 | 1262 | ||
| 1266 | - | static void kvm_invalidate_vncr_ipa_all(struct kvm *kvm) | |
| 1267 | - | { | |
| 1268 | - | struct kvm_pgtable *pgt = kvm->arch.mmu.pgt; | |
| 1269 | - | ||
| 1270 | - | lockdep_assert_held_write(&kvm->mmu_lock); | |
| 1271 | - | ||
| 1272 | - | /* if the mmu lock was dropped, pgt teardown may have raced. */ | |
| 1273 | - | if (pgt) | |
| 1274 | - | kvm_invalidate_vncr_ipa(kvm, 0, BIT(pgt->ia_bits)); | |
| 1275 | - | } | |
| 1276 | - | ||
| 1277 | 1263 | void kvm_nested_s2_wp(struct kvm *kvm) | |
| 1278 | 1264 | { | |
| 1279 | 1265 | int i; | |
| @@ -1284,13 +1270,13 @@ void kvm_nested_s2_wp(struct kvm *kvm) | |||
| 1284 | 1270 | return; | |
| 1285 | 1271 | ||
| 1286 | 1272 | for (i = 0; i < kvm->arch.nested_mmus_size; i++) { | |
| 1287 | - | struct kvm_s2_mmu *mmu = kvm->arch.nested_mmus[i]; | |
| 1273 | + | struct kvm_s2_mmu *mmu = &kvm->arch.nested_mmus[i]; | |
| 1288 | 1274 | ||
| 1289 | 1275 | if (kvm_s2_mmu_valid(mmu)) | |
| 1290 | 1276 | kvm_stage2_wp_range(mmu, 0, kvm_phys_size(mmu)); | |
| 1291 | 1277 | } | |
| 1292 | 1278 | ||
| 1293 | - | kvm_invalidate_vncr_ipa_all(kvm); | |
| 1279 | + | kvm_invalidate_vncr_ipa(kvm, 0, BIT(kvm->arch.mmu.pgt->ia_bits)); | |
| 1294 | 1280 | } | |
| 1295 | 1281 | ||
| 1296 | 1282 | void kvm_nested_s2_unmap(struct kvm *kvm, bool may_block) | |
| @@ -1303,13 +1289,13 @@ void kvm_nested_s2_unmap(struct kvm *kvm, bool may_block) | |||
| 1303 | 1289 | return; | |
| 1304 | 1290 | ||
| 1305 | 1291 | for (i = 0; i < kvm->arch.nested_mmus_size; i++) { | |
| 1306 | - | struct kvm_s2_mmu *mmu = kvm->arch.nested_mmus[i]; | |
| 1292 | + | struct kvm_s2_mmu *mmu = &kvm->arch.nested_mmus[i]; | |
| 1307 | 1293 | ||
| 1308 | 1294 | if (kvm_s2_mmu_valid(mmu)) | |
| 1309 | 1295 | kvm_stage2_unmap_range(mmu, 0, kvm_phys_size(mmu), may_block); | |
| 1310 | 1296 | } | |
| 1311 | 1297 | ||
| 1312 | - | kvm_invalidate_vncr_ipa_all(kvm); | |
| 1298 | + | kvm_invalidate_vncr_ipa(kvm, 0, BIT(kvm->arch.mmu.pgt->ia_bits)); | |
| 1313 | 1299 | } | |
| 1314 | 1300 | ||
| 1315 | 1301 | void kvm_nested_s2_flush(struct kvm *kvm) | |
| @@ -1322,7 +1308,7 @@ void kvm_nested_s2_flush(struct kvm *kvm) | |||
| 1322 | 1308 | return; | |
| 1323 | 1309 | ||
| 1324 | 1310 | for (i = 0; i < kvm->arch.nested_mmus_size; i++) { | |
| 1325 | - | struct kvm_s2_mmu *mmu = kvm->arch.nested_mmus[i]; | |
| 1311 | + | struct kvm_s2_mmu *mmu = &kvm->arch.nested_mmus[i]; | |
| 1326 | 1312 | ||
| 1327 | 1313 | if (kvm_s2_mmu_valid(mmu)) | |
| 1328 | 1314 | kvm_stage2_flush_range(mmu, 0, kvm_phys_size(mmu)); | |
| @@ -1331,12 +1317,17 @@ void kvm_nested_s2_flush(struct kvm *kvm) | |||
| 1331 | 1317 | ||
| 1332 | 1318 | void kvm_arch_flush_shadow_all(struct kvm *kvm) | |
| 1333 | 1319 | { | |
| 1334 | - | for (int i = 0; i < kvm->arch.nested_mmus_size; i++) { | |
| 1335 | - | struct kvm_s2_mmu *mmu = kvm->arch.nested_mmus[i]; | |
| 1320 | + | int i; | |
| 1321 | + | ||
| 1322 | + | for (i = 0; i < kvm->arch.nested_mmus_size; i++) { | |
| 1323 | + | struct kvm_s2_mmu *mmu = &kvm->arch.nested_mmus[i]; | |
| 1336 | 1324 | ||
| 1337 | 1325 | if (!WARN_ON(atomic_read(&mmu->refcnt))) | |
| 1338 | 1326 | kvm_free_stage2_pgd(mmu); | |
| 1339 | 1327 | } | |
| 1328 | + | kvfree(kvm->arch.nested_mmus); | |
| 1329 | + | kvm->arch.nested_mmus = NULL; | |
| 1330 | + | kvm->arch.nested_mmus_size = 0; | |
| 1340 | 1331 | kvm_uninit_stage2_mmu(kvm); | |
| 1341 | 1332 | } | |
| 1342 | 1333 | ||
modified arch/arm64/kvm/sys_regs.c
| @@ -926,7 +926,6 @@ static u64 *demux_wb_reg(struct kvm_vcpu *vcpu, const struct sys_reg_desc *rd) | |||
| 926 | 926 | struct kvm_guest_debug_arch *dbg = &vcpu->arch.vcpu_debug_state; | |
| 927 | 927 | ||
| 928 | 928 | switch (rd->Op2) { | |
| 929 | - | case 0b001: | |
| 930 | 929 | case 0b100: | |
| 931 | 930 | return &dbg->dbg_bvr[rd->CRm]; | |
| 932 | 931 | case 0b101: | |
modified arch/arm64/kvm/vgic/vgic-its.c
| @@ -1658,7 +1658,7 @@ static void vgic_mmio_write_its_baser(struct kvm *kvm, | |||
| 1658 | 1658 | unsigned long val) | |
| 1659 | 1659 | { | |
| 1660 | 1660 | const struct vgic_its_abi *abi = vgic_its_get_abi(its); | |
| 1661 | - | u64 old, entry_size, table_type; | |
| 1661 | + | u64 entry_size, table_type; | |
| 1662 | 1662 | u64 reg, *regptr, clearbits = 0; | |
| 1663 | 1663 | ||
| 1664 | 1664 | /* When GITS_CTLR.Enable is 1, we ignore write accesses. */ | |
| @@ -1681,9 +1681,7 @@ static void vgic_mmio_write_its_baser(struct kvm *kvm, | |||
| 1681 | 1681 | return; | |
| 1682 | 1682 | } | |
| 1683 | 1683 | ||
| 1684 | - | old = *regptr; | |
| 1685 | - | ||
| 1686 | - | reg = update_64bit_reg(old, addr & 7, len, val); | |
| 1684 | + | reg = update_64bit_reg(*regptr, addr & 7, len, val); | |
| 1687 | 1685 | reg &= ~GITS_BASER_RO_MASK; | |
| 1688 | 1686 | reg &= ~clearbits; | |
| 1689 | 1687 | ||
| @@ -1693,8 +1691,7 @@ static void vgic_mmio_write_its_baser(struct kvm *kvm, | |||
| 1693 | 1691 | ||
| 1694 | 1692 | *regptr = reg; | |
| 1695 | 1693 | ||
| 1696 | - | /* The ITS driver rewrites an unchanged GITS_BASER<n> on resume. */ | |
| 1697 | - | if (reg != old) { | |
| 1694 | + | if (!(reg & GITS_BASER_VALID)) { | |
| 1698 | 1695 | /* Take the its_lock to prevent a race with a save/restore */ | |
| 1699 | 1696 | mutex_lock(&its->its_lock); | |
| 1700 | 1697 | switch (table_type) { | |
| @@ -1705,8 +1702,6 @@ static void vgic_mmio_write_its_baser(struct kvm *kvm, | |||
| 1705 | 1702 | vgic_its_free_collection_list(kvm, its); | |
| 1706 | 1703 | break; | |
| 1707 | 1704 | } | |
| 1708 | - | /* A concurrent injection may have cached a translation. */ | |
| 1709 | - | vgic_its_invalidate_cache(its); | |
| 1710 | 1705 | mutex_unlock(&its->its_lock); | |
| 1711 | 1706 | } | |
| 1712 | 1707 | } | |
| @@ -2024,22 +2019,18 @@ out: | |||
| 2024 | 2019 | return ret; | |
| 2025 | 2020 | } | |
| 2026 | 2021 | ||
| 2027 | - | static u32 compute_next_devid_offset(struct vgic_its *its, u64 baser, | |
| 2022 | + | static u32 compute_next_devid_offset(struct list_head *h, | |
| 2028 | 2023 | struct its_device *dev) | |
| 2029 | 2024 | { | |
| 2030 | - | struct its_device *next = dev; | |
| 2025 | + | struct its_device *next; | |
| 2026 | + | u32 next_offset; | |
| 2031 | 2027 | ||
| 2032 | - | /* | |
| 2033 | - | * Point at the next device vgic_its_save_device_tables() saves. It | |
| 2034 | - | * sorts device_list first, so the subtraction cannot underflow. | |
| 2035 | - | */ | |
| 2036 | - | list_for_each_entry_continue(next, &its->device_list, dev_list) { | |
| 2037 | - | if (vgic_its_check_id(its, baser, next->device_id, NULL)) | |
| 2038 | - | return min_t(u32, next->device_id - dev->device_id, | |
| 2039 | - | VITS_DTE_MAX_DEVID_OFFSET); | |
| 2040 | - | } | |
| 2028 | + | if (list_is_last(&dev->dev_list, h)) | |
| 2029 | + | return 0; | |
| 2030 | + | next = list_next_entry(dev, dev_list); | |
| 2031 | + | next_offset = next->device_id - dev->device_id; | |
| 2041 | 2032 | ||
| 2042 | - | return 0; | |
| 2033 | + | return min_t(u32, next_offset, VITS_DTE_MAX_DEVID_OFFSET); | |
| 2043 | 2034 | } | |
| 2044 | 2035 | ||
| 2045 | 2036 | static u32 compute_next_eventid_offset(struct list_head *h, struct its_ite *ite) | |
| @@ -2280,18 +2271,17 @@ static int vgic_its_restore_itt(struct vgic_its *its, struct its_device *dev) | |||
| 2280 | 2271 | * vgic_its_save_dte - Save a device table entry at a given GPA | |
| 2281 | 2272 | * | |
| 2282 | 2273 | * @its: ITS handle | |
| 2283 | - | * @baser: GITS_BASER<dev> the caller is saving against | |
| 2284 | 2274 | * @dev: ITS device | |
| 2285 | 2275 | * @ptr: GPA | |
| 2286 | 2276 | */ | |
| 2287 | - | static int vgic_its_save_dte(struct vgic_its *its, u64 baser, | |
| 2288 | - | struct its_device *dev, gpa_t ptr) | |
| 2277 | + | static int vgic_its_save_dte(struct vgic_its *its, struct its_device *dev, | |
| 2278 | + | gpa_t ptr) | |
| 2289 | 2279 | { | |
| 2290 | 2280 | u64 val, itt_addr_field; | |
| 2291 | 2281 | u32 next_offset; | |
| 2292 | 2282 | ||
| 2293 | 2283 | itt_addr_field = dev->itt_addr >> 8; | |
| 2294 | - | next_offset = compute_next_devid_offset(its, baser, dev); | |
| 2284 | + | next_offset = compute_next_devid_offset(&its->device_list, dev); | |
| 2295 | 2285 | val = (1ULL << KVM_ITS_DTE_VALID_SHIFT | | |
| 2296 | 2286 | ((u64)next_offset << KVM_ITS_DTE_NEXT_SHIFT) | | |
| 2297 | 2287 | (itt_addr_field << KVM_ITS_DTE_ITTADDR_SHIFT) | | |
| @@ -2390,16 +2380,15 @@ static int vgic_its_save_device_tables(struct vgic_its *its) | |||
| 2390 | 2380 | int ret; | |
| 2391 | 2381 | gpa_t eaddr; | |
| 2392 | 2382 | ||
| 2393 | - | /* Don't fail a save that userspace must be able to issue. */ | |
| 2394 | 2383 | if (!vgic_its_check_id(its, baser, | |
| 2395 | 2384 | dev->device_id, &eaddr)) | |
| 2396 | - | continue; | |
| 2385 | + | return -EINVAL; | |
| 2397 | 2386 | ||
| 2398 | 2387 | ret = vgic_its_save_itt(its, dev); | |
| 2399 | 2388 | if (ret) | |
| 2400 | 2389 | return ret; | |
| 2401 | 2390 | ||
| 2402 | - | ret = vgic_its_save_dte(its, baser, dev, eaddr); | |
| 2391 | + | ret = vgic_its_save_dte(its, dev, eaddr); | |
| 2403 | 2392 | if (ret) | |
| 2404 | 2393 | return ret; | |
| 2405 | 2394 | } | |
| @@ -2552,6 +2541,9 @@ static int vgic_its_save_collection_table(struct vgic_its *its) | |||
| 2552 | 2541 | max_size = GITS_BASER_NR_PAGES(baser) * SZ_64K; | |
| 2553 | 2542 | ||
| 2554 | 2543 | list_for_each_entry(collection, &its->collection_list, coll_list) { | |
| 2544 | + | if (!vgic_its_check_id(its, baser, collection->collection_id, NULL)) | |
| 2545 | + | return -EINVAL; | |
| 2546 | + | ||
| 2555 | 2547 | ret = vgic_its_save_cte(its, collection, gpa); | |
| 2556 | 2548 | if (ret) | |
| 2557 | 2549 | return ret; | |
modified arch/arm64/net/bpf_jit_comp.c
| @@ -600,8 +600,6 @@ static int build_prologue(struct jit_ctx *ctx, bool ebpf_from_cbpf) | |||
| 600 | 600 | * 12 registers are on the stack | |
| 601 | 601 | */ | |
| 602 | 602 | emit(A64_SUB_I(1, A64_SP, A64_FP, 96), ctx); | |
| 603 | - | /* The callback may use its own BPF stack, set up fp for it. */ | |
| 604 | - | ctx->fp_used = true; | |
| 605 | 603 | } | |
| 606 | 604 | ||
| 607 | 605 | /* Stack must be multiples of 16B */ | |
modified arch/mips/Kconfig
| @@ -396,7 +396,10 @@ config ECONET | |||
| 396 | 396 | bool "EcoNet MIPS family" | |
| 397 | 397 | select BOOT_RAW | |
| 398 | 398 | select DEBUG_ZBOOT if DEBUG_KERNEL | |
| 399 | + | select EARLY_PRINTK_8250 | |
| 399 | 400 | select ECONET_EN751221_TIMER | |
| 401 | + | select SERIAL_8250 | |
| 402 | + | select SERIAL_OF_PLATFORM | |
| 400 | 403 | select SYS_SUPPORTS_BIG_ENDIAN | |
| 401 | 404 | select SYS_HAS_CPU_MIPS32_R1 | |
| 402 | 405 | select SYS_HAS_CPU_MIPS32_R2 | |
| @@ -658,7 +661,6 @@ config EYEQ | |||
| 658 | 661 | select USB_UHCI_BIG_ENDIAN_MMIO if CPU_BIG_ENDIAN | |
| 659 | 662 | select USE_OF | |
| 660 | 663 | select HOTPLUG_PARALLEL if HOTPLUG_CPU | |
| 661 | - | select WEAK_REORDERING_BEYOND_LLSC | |
| 662 | 664 | help | |
| 663 | 665 | Select this to build a kernel supporting EyeQ SoC from Mobileye. | |
| 664 | 666 | ||
modified arch/mips/cavium-octeon/octeon-platform.c
| @@ -18,7 +18,7 @@ | |||
| 18 | 18 | #include <asm/octeon/octeon.h> | |
| 19 | 19 | #include <asm/octeon/cvmx-helper-board.h> | |
| 20 | 20 | ||
| 21 | - | #if IS_ENABLED(CONFIG_USB) | |
| 21 | + | #ifdef CONFIG_USB | |
| 22 | 22 | #include <linux/usb/ehci_def.h> | |
| 23 | 23 | #include <linux/usb/ehci_pdriver.h> | |
| 24 | 24 | #include <linux/usb/ohci_pdriver.h> | |
| @@ -1080,7 +1080,7 @@ end_led: | |||
| 1080 | 1080 | ; | |
| 1081 | 1081 | } | |
| 1082 | 1082 | ||
| 1083 | - | #if IS_ENABLED(CONFIG_USB) | |
| 1083 | + | #ifdef CONFIG_USB | |
| 1084 | 1084 | /* OHCI/UHCI USB */ | |
| 1085 | 1085 | alias_prop = fdt_getprop(initial_boot_params, aliases, | |
| 1086 | 1086 | "uctl", NULL); | |
deleted arch/mips/configs/econet_en751221_defconfig mode 100644
| @@ -1,264 +0,0 @@ | |||
| 1 | - | # CONFIG_LOCALVERSION_AUTO is not set | |
| 2 | - | CONFIG_KERNEL_XZ=y | |
| 3 | - | CONFIG_SYSVIPC=y | |
| 4 | - | CONFIG_POSIX_MQUEUE=y | |
| 5 | - | # CONFIG_CROSS_MEMORY_ATTACH is not set | |
| 6 | - | CONFIG_HIGH_RES_TIMERS=y | |
| 7 | - | CONFIG_BPF_SYSCALL=y | |
| 8 | - | CONFIG_BPF_JIT=y | |
| 9 | - | CONFIG_PREEMPT=y | |
| 10 | - | CONFIG_CGROUPS=y | |
| 11 | - | CONFIG_MEMCG=y | |
| 12 | - | CONFIG_BLK_CGROUP=y | |
| 13 | - | CONFIG_CGROUP_SCHED=y | |
| 14 | - | CONFIG_CFS_BANDWIDTH=y | |
| 15 | - | CONFIG_RT_GROUP_SCHED=y | |
| 16 | - | CONFIG_CGROUP_PIDS=y | |
| 17 | - | CONFIG_CGROUP_RDMA=y | |
| 18 | - | CONFIG_CPUSETS=y | |
| 19 | - | CONFIG_CGROUP_CPUACCT=y | |
| 20 | - | CONFIG_CGROUP_BPF=y | |
| 21 | - | CONFIG_NAMESPACES=y | |
| 22 | - | # CONFIG_TIME_NS is not set | |
| 23 | - | CONFIG_USER_NS=y | |
| 24 | - | CONFIG_BLK_DEV_INITRD=y | |
| 25 | - | # CONFIG_RD_GZIP is not set | |
| 26 | - | # CONFIG_RD_BZIP2 is not set | |
| 27 | - | # CONFIG_RD_LZMA is not set | |
| 28 | - | # CONFIG_RD_XZ is not set | |
| 29 | - | # CONFIG_RD_LZO is not set | |
| 30 | - | # CONFIG_RD_LZ4 is not set | |
| 31 | - | # CONFIG_RD_ZSTD is not set | |
| 32 | - | # CONFIG_INITRAMFS_PRESERVE_MTIME is not set | |
| 33 | - | CONFIG_LD_DEAD_CODE_DATA_ELIMINATION=y | |
| 34 | - | CONFIG_EXPERT=y | |
| 35 | - | # CONFIG_SGETMASK_SYSCALL is not set | |
| 36 | - | # CONFIG_IO_URING is not set | |
| 37 | - | # CONFIG_RSEQ is not set | |
| 38 | - | # CONFIG_CACHESTAT_SYSCALL is not set | |
| 39 | - | CONFIG_ECONET=y | |
| 40 | - | CONFIG_CPU_MIPS32_R2=y | |
| 41 | - | CONFIG_ZBOOT_LOAD_ADDRESS=0x80020000 | |
| 42 | - | CONFIG_ARCH_FORCE_MAX_ORDER=11 | |
| 43 | - | # CONFIG_MIPS_FP_SUPPORT is not set | |
| 44 | - | CONFIG_NR_CPUS=2 | |
| 45 | - | CONFIG_HZ_100=y | |
| 46 | - | CONFIG_MIPS_RAW_APPENDED_DTB=y | |
| 47 | - | # CONFIG_SCHED_SMT is not set | |
| 48 | - | CONFIG_JUMP_LABEL=y | |
| 49 | - | # CONFIG_STACKPROTECTOR_STRONG is not set | |
| 50 | - | # CONFIG_GCC_PLUGINS is not set | |
| 51 | - | CONFIG_MODULES=y | |
| 52 | - | CONFIG_MODULE_UNLOAD=y | |
| 53 | - | # CONFIG_BLOCK_LEGACY_AUTOLOAD is not set | |
| 54 | - | CONFIG_BLK_DEV_THROTTLING=y | |
| 55 | - | # CONFIG_BLK_DEBUG_FS is not set | |
| 56 | - | CONFIG_PARTITION_ADVANCED=y | |
| 57 | - | CONFIG_OF_PARTITION=y | |
| 58 | - | # CONFIG_MQ_IOSCHED_DEADLINE is not set | |
| 59 | - | # CONFIG_MQ_IOSCHED_KYBER is not set | |
| 60 | - | # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set | |
| 61 | - | CONFIG_SLAB_FREELIST_RANDOM=y | |
| 62 | - | CONFIG_SLAB_FREELIST_HARDENED=y | |
| 63 | - | # CONFIG_COMPAT_BRK is not set | |
| 64 | - | CONFIG_LRU_GEN=y | |
| 65 | - | CONFIG_LRU_GEN_ENABLED=y | |
| 66 | - | CONFIG_NET=y | |
| 67 | - | CONFIG_PACKET=y | |
| 68 | - | CONFIG_UNIX=y | |
| 69 | - | CONFIG_INET=y | |
| 70 | - | CONFIG_IP_MULTICAST=y | |
| 71 | - | CONFIG_IP_ADVANCED_ROUTER=y | |
| 72 | - | CONFIG_IP_MULTIPLE_TABLES=y | |
| 73 | - | CONFIG_IP_ROUTE_MULTIPATH=y | |
| 74 | - | CONFIG_IP_ROUTE_VERBOSE=y | |
| 75 | - | CONFIG_IP_MROUTE=y | |
| 76 | - | CONFIG_IP_MROUTE_MULTIPLE_TABLES=y | |
| 77 | - | CONFIG_IP_PIMSM_V1=y | |
| 78 | - | CONFIG_IP_PIMSM_V2=y | |
| 79 | - | CONFIG_SYN_COOKIES=y | |
| 80 | - | # CONFIG_INET_DIAG is not set | |
| 81 | - | CONFIG_TCP_CONG_ADVANCED=y | |
| 82 | - | # CONFIG_TCP_CONG_BIC is not set | |
| 83 | - | # CONFIG_TCP_CONG_WESTWOOD is not set | |
| 84 | - | # CONFIG_TCP_CONG_HTCP is not set | |
| 85 | - | # CONFIG_IPV6_SIT is not set | |
| 86 | - | CONFIG_IPV6_SUBTREES=y | |
| 87 | - | CONFIG_IPV6_MROUTE=y | |
| 88 | - | CONFIG_IPV6_MROUTE_MULTIPLE_TABLES=y | |
| 89 | - | CONFIG_IPV6_PIMSM_V2=y | |
| 90 | - | CONFIG_IPV6_SEG6_LWTUNNEL=y | |
| 91 | - | CONFIG_MPTCP=y | |
| 92 | - | CONFIG_NETFILTER=y | |
| 93 | - | # CONFIG_NETFILTER_EGRESS is not set | |
| 94 | - | CONFIG_NF_CONNTRACK=m | |
| 95 | - | CONFIG_NF_CONNTRACK_MARK=y | |
| 96 | - | CONFIG_NF_CONNTRACK_ZONES=y | |
| 97 | - | CONFIG_NF_CONNTRACK_PROCFS=y | |
| 98 | - | CONFIG_NF_CONNTRACK_TIMEOUT=y | |
| 99 | - | # CONFIG_NF_CT_PROTO_SCTP is not set | |
| 100 | - | CONFIG_NF_TABLES=m | |
| 101 | - | CONFIG_NF_TABLES_INET=y | |
| 102 | - | CONFIG_NF_TABLES_NETDEV=y | |
| 103 | - | CONFIG_NFT_NUMGEN=m | |
| 104 | - | CONFIG_NFT_CT=m | |
| 105 | - | CONFIG_NFT_FLOW_OFFLOAD=m | |
| 106 | - | CONFIG_NFT_LOG=m | |
| 107 | - | CONFIG_NFT_LIMIT=m | |
| 108 | - | CONFIG_NFT_MASQ=m | |
| 109 | - | CONFIG_NFT_REDIR=m | |
| 110 | - | CONFIG_NFT_NAT=m | |
| 111 | - | CONFIG_NFT_QUOTA=m | |
| 112 | - | CONFIG_NFT_REJECT=m | |
| 113 | - | CONFIG_NFT_HASH=m | |
| 114 | - | CONFIG_NFT_FIB_INET=m | |
| 115 | - | CONFIG_NF_FLOW_TABLE_INET=m | |
| 116 | - | CONFIG_NF_FLOW_TABLE=m | |
| 117 | - | CONFIG_NFT_FIB_IPV4=m | |
| 118 | - | CONFIG_NF_TABLES_ARP=y | |
| 119 | - | CONFIG_NF_LOG_IPV4=m | |
| 120 | - | CONFIG_NFT_FIB_IPV6=m | |
| 121 | - | CONFIG_NF_LOG_IPV6=m | |
| 122 | - | CONFIG_NF_TABLES_BRIDGE=m | |
| 123 | - | CONFIG_BRIDGE=y | |
| 124 | - | CONFIG_BRIDGE_VLAN_FILTERING=y | |
| 125 | - | CONFIG_VLAN_8021Q=y | |
| 126 | - | CONFIG_NET_SCHED=y | |
| 127 | - | CONFIG_NET_SCH_FQ_CODEL=y | |
| 128 | - | CONFIG_NET_SCH_DEFAULT=y | |
| 129 | - | CONFIG_DEFAULT_FQ_CODEL=y | |
| 130 | - | CONFIG_NET_SWITCHDEV=y | |
| 131 | - | CONFIG_NET_L3_MASTER_DEV=y | |
| 132 | - | CONFIG_RFKILL=y | |
| 133 | - | # CONFIG_LWTUNNEL_BPF is not set | |
| 134 | - | CONFIG_PCI=y | |
| 135 | - | CONFIG_PCIEPORTBUS=y | |
| 136 | - | CONFIG_PCIEAER=y | |
| 137 | - | # CONFIG_PCIEASPM is not set | |
| 138 | - | CONFIG_PCI_MSI=y | |
| 139 | - | # CONFIG_VGA_ARB is not set | |
| 140 | - | CONFIG_PCIE_MEDIATEK=y | |
| 141 | - | CONFIG_MTD=y | |
| 142 | - | CONFIG_MTD_BLOCK=y | |
| 143 | - | CONFIG_MTD_CFI=y | |
| 144 | - | CONFIG_MTD_CFI_INTELEXT=y | |
| 145 | - | CONFIG_MTD_CFI_AMDSTD=y | |
| 146 | - | CONFIG_MTD_COMPLEX_MAPPINGS=y | |
| 147 | - | CONFIG_MTD_SPI_NAND=y | |
| 148 | - | CONFIG_MTD_UBI=y | |
| 149 | - | CONFIG_MTD_UBI_BEB_LIMIT=13 | |
| 150 | - | CONFIG_MTD_UBI_BLOCK=y | |
| 151 | - | CONFIG_NETDEVICES=y | |
| 152 | - | # CONFIG_NET_VENDOR_ASIX is not set | |
| 153 | - | # CONFIG_NET_VENDOR_ENGLEDER is not set | |
| 154 | - | # CONFIG_NET_VENDOR_FUNGIBLE is not set | |
| 155 | - | # CONFIG_NET_VENDOR_LITEX is not set | |
| 156 | - | # CONFIG_NET_VENDOR_MICROSOFT is not set | |
| 157 | - | # CONFIG_NET_VENDOR_VERTEXCOM is not set | |
| 158 | - | # CONFIG_NET_VENDOR_WANGXUN is not set | |
| 159 | - | CONFIG_PPP=m | |
| 160 | - | CONFIG_PPP_FILTER=y | |
| 161 | - | CONFIG_PPP_MULTILINK=y | |
| 162 | - | CONFIG_PPPOE=m | |
| 163 | - | CONFIG_PPP_ASYNC=m | |
| 164 | - | # CONFIG_WLAN_VENDOR_ADMTEK is not set | |
| 165 | - | # CONFIG_WLAN_VENDOR_ATH is not set | |
| 166 | - | # CONFIG_WLAN_VENDOR_ATMEL is not set | |
| 167 | - | # CONFIG_WLAN_VENDOR_BROADCOM is not set | |
| 168 | - | # CONFIG_WLAN_VENDOR_INTEL is not set | |
| 169 | - | # CONFIG_WLAN_VENDOR_INTERSIL is not set | |
| 170 | - | # CONFIG_WLAN_VENDOR_MARVELL is not set | |
| 171 | - | # CONFIG_WLAN_VENDOR_MEDIATEK is not set | |
| 172 | - | # CONFIG_WLAN_VENDOR_MICROCHIP is not set | |
| 173 | - | # CONFIG_WLAN_VENDOR_PURELIFI is not set | |
| 174 | - | # CONFIG_WLAN_VENDOR_RALINK is not set | |
| 175 | - | # CONFIG_WLAN_VENDOR_REALTEK is not set | |
| 176 | - | # CONFIG_WLAN_VENDOR_RSI is not set | |
| 177 | - | # CONFIG_WLAN_VENDOR_SILABS is not set | |
| 178 | - | # CONFIG_WLAN_VENDOR_ST is not set | |
| 179 | - | # CONFIG_WLAN_VENDOR_TI is not set | |
| 180 | - | # CONFIG_WLAN_VENDOR_ZYDAS is not set | |
| 181 | - | # CONFIG_WLAN_VENDOR_QUANTENNA is not set | |
| 182 | - | # CONFIG_INPUT is not set | |
| 183 | - | # CONFIG_SERIO is not set | |
| 184 | - | # CONFIG_VT is not set | |
| 185 | - | # CONFIG_LEGACY_PTYS is not set | |
| 186 | - | # CONFIG_LEGACY_TIOCSTI is not set | |
| 187 | - | CONFIG_SERIAL_8250=y | |
| 188 | - | CONFIG_SERIAL_8250_CONSOLE=y | |
| 189 | - | CONFIG_SERIAL_OF_PLATFORM=y | |
| 190 | - | # CONFIG_HW_RANDOM is not set | |
| 191 | - | # CONFIG_DEVMEM is not set | |
| 192 | - | CONFIG_SPI=y | |
| 193 | - | # CONFIG_PTP_1588_CLOCK is not set | |
| 194 | - | CONFIG_GPIOLIB=y | |
| 195 | - | # CONFIG_HWMON is not set | |
| 196 | - | CONFIG_WATCHDOG=y | |
| 197 | - | CONFIG_MFD_SYSCON=y | |
| 198 | - | # CONFIG_USB_PCI is not set | |
| 199 | - | CONFIG_NEW_LEDS=y | |
| 200 | - | CONFIG_LEDS_CLASS=y | |
| 201 | - | CONFIG_LEDS_CLASS_MULTICOLOR=y | |
| 202 | - | CONFIG_LEDS_GPIO=m | |
| 203 | - | CONFIG_LEDS_TRIGGERS=y | |
| 204 | - | CONFIG_LEDS_TRIGGER_TIMER=y | |
| 205 | - | CONFIG_LEDS_TRIGGER_HEARTBEAT=y | |
| 206 | - | CONFIG_LEDS_TRIGGER_DEFAULT_ON=y | |
| 207 | - | CONFIG_LEDS_TRIGGER_NETDEV=y | |
| 208 | - | CONFIG_STAGING=y | |
| 209 | - | # CONFIG_MIPS_PLATFORM_DEVICES is not set | |
| 210 | - | CONFIG_COMMON_CLK_EN7523=y | |
| 211 | - | # CONFIG_IOMMU_SUPPORT is not set | |
| 212 | - | CONFIG_RESET_CONTROLLER=y | |
| 213 | - | CONFIG_PHY_ECONET_PCIE=y | |
| 214 | - | # CONFIG_DNOTIFY is not set | |
| 215 | - | CONFIG_FANOTIFY=y | |
| 216 | - | CONFIG_OVERLAY_FS=y | |
| 217 | - | # CONFIG_OVERLAY_FS_REDIRECT_ALWAYS_FOLLOW is not set | |
| 218 | - | # CONFIG_PROC_PAGE_MONITOR is not set | |
| 219 | - | CONFIG_TMPFS=y | |
| 220 | - | CONFIG_TMPFS_POSIX_ACL=y | |
| 221 | - | CONFIG_JFFS2_FS=y | |
| 222 | - | CONFIG_JFFS2_SUMMARY=y | |
| 223 | - | CONFIG_JFFS2_FS_XATTR=y | |
| 224 | - | CONFIG_JFFS2_COMPRESSION_OPTIONS=y | |
| 225 | - | CONFIG_UBIFS_FS=y | |
| 226 | - | CONFIG_SQUASHFS=y | |
| 227 | - | CONFIG_SQUASHFS_FILE_DIRECT=y | |
| 228 | - | CONFIG_SQUASHFS_COMPILE_DECOMP_MULTI_PERCPU=y | |
| 229 | - | # CONFIG_SQUASHFS_ZLIB is not set | |
| 230 | - | CONFIG_SQUASHFS_XZ=y | |
| 231 | - | CONFIG_SQUASHFS_EMBEDDED=y | |
| 232 | - | CONFIG_KEYS=y | |
| 233 | - | CONFIG_INIT_STACK_NONE=y | |
| 234 | - | CONFIG_FORTIFY_SOURCE=y | |
| 235 | - | CONFIG_HARDENED_USERCOPY=y | |
| 236 | - | CONFIG_LIST_HARDENED=y | |
| 237 | - | CONFIG_CRYPTO_NULL=y | |
| 238 | - | CONFIG_CRYPTO_AES=y | |
| 239 | - | CONFIG_CRYPTO_CCM=y | |
| 240 | - | CONFIG_CRYPTO_GCM=y | |
| 241 | - | # CONFIG_CRYPTO_HW is not set | |
| 242 | - | # CONFIG_XZ_DEC_X86 is not set | |
| 243 | - | # CONFIG_XZ_DEC_POWERPC is not set | |
| 244 | - | # CONFIG_XZ_DEC_ARM is not set | |
| 245 | - | # CONFIG_XZ_DEC_ARMTHUMB is not set | |
| 246 | - | # CONFIG_XZ_DEC_ARM64 is not set | |
| 247 | - | # CONFIG_XZ_DEC_SPARC is not set | |
| 248 | - | # CONFIG_XZ_DEC_RISCV is not set | |
| 249 | - | CONFIG_PRINTK_TIME=y | |
| 250 | - | # CONFIG_DEBUG_MISC is not set | |
| 251 | - | CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=y | |
| 252 | - | CONFIG_DEBUG_INFO_REDUCED=y | |
| 253 | - | CONFIG_FRAME_WARN=1024 | |
| 254 | - | CONFIG_STRIP_ASM_SYMS=y | |
| 255 | - | CONFIG_MAGIC_SYSRQ=y | |
| 256 | - | # CONFIG_MAGIC_SYSRQ_SERIAL is not set | |
| 257 | - | CONFIG_DEBUG_FS=y | |
| 258 | - | # CONFIG_SLUB_DEBUG is not set | |
| 259 | - | CONFIG_SCHED_STACK_END_CHECK=y | |
| 260 | - | CONFIG_PANIC_ON_OOPS=y | |
| 261 | - | CONFIG_PANIC_TIMEOUT=1 | |
| 262 | - | CONFIG_RCU_CPU_STALL_TIMEOUT=60 | |
| 263 | - | # CONFIG_RCU_TRACE is not set | |
| 264 | - | # CONFIG_FTRACE is not set | |
modified arch/mips/net/bpf_jit_comp32.c
| @@ -1111,7 +1111,7 @@ static void emit_jmp_i64(struct jit_context *ctx, | |||
| 1111 | 1111 | emit(ctx, xor, tmp, lo(dst), tmp); | |
| 1112 | 1112 | } | |
| 1113 | 1113 | if (imm < 0) { /* Compare sign extension */ | |
| 1114 | - | emit(ctx, addiu, MIPS_R_T9, hi(dst), 1); | |
| 1114 | + | emit(ctx, addu, MIPS_R_T9, hi(dst), 1); | |
| 1115 | 1115 | emit(ctx, or, tmp, tmp, MIPS_R_T9); | |
| 1116 | 1116 | } else { /* Compare zero extension */ | |
| 1117 | 1117 | emit(ctx, or, tmp, tmp, hi(dst)); | |
modified arch/mips/net/bpf_jit_comp64.c
| @@ -305,7 +305,8 @@ static void emit_bswap_r64(struct jit_context *ctx, u8 dst, u32 width) | |||
| 305 | 305 | case 16: | |
| 306 | 306 | emit_sext(ctx, dst, dst); | |
| 307 | 307 | emit_bswap_r(ctx, dst, width); | |
| 308 | - | emit_zext(ctx, dst); | |
| 308 | + | if (cpu_has_mips64r2 || cpu_has_mips64r6) | |
| 309 | + | emit_zext(ctx, dst); | |
| 309 | 310 | break; | |
| 310 | 311 | } | |
| 311 | 312 | clobber_reg(ctx, dst); | |
added arch/parisc/include/asm/compat_ucontext.h mode 100644
| @@ -0,0 +1,18 @@ | |||
| 1 | + | /* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | + | #ifndef _ASM_PARISC_COMPAT_UCONTEXT_H | |
| 3 | + | #define _ASM_PARISC_COMPAT_UCONTEXT_H | |
| 4 | + | ||
| 5 | + | #include <linux/compat.h> | |
| 6 | + | ||
| 7 | + | /* 32-bit ucontext as seen from an 64-bit kernel */ | |
| 8 | + | struct compat_ucontext { | |
| 9 | + | compat_uint_t uc_flags; | |
| 10 | + | compat_uptr_t uc_link; | |
| 11 | + | compat_stack_t uc_stack; /* struct compat_sigaltstack (12 bytes)*/ | |
| 12 | + | /* FIXME: Pad out to get uc_mcontext to start at an 8-byte aligned boundary */ | |
| 13 | + | compat_uint_t pad[1]; | |
| 14 | + | struct compat_sigcontext uc_mcontext; | |
| 15 | + | compat_sigset_t uc_sigmask; /* mask last for extensibility */ | |
| 16 | + | }; | |
| 17 | + | ||
| 18 | + | #endif /* !_ASM_PARISC_COMPAT_UCONTEXT_H */ | |
modified arch/parisc/include/asm/thread_info.h
| @@ -24,7 +24,7 @@ struct thread_info { | |||
| 24 | 24 | ||
| 25 | 25 | /* thread information allocation */ | |
| 26 | 26 | ||
| 27 | - | #if defined(CONFIG_IRQSTACKS) && !defined(CONFIG_64BIT) | |
| 27 | + | #ifdef CONFIG_IRQSTACKS | |
| 28 | 28 | #define THREAD_SIZE_ORDER 2 /* PA-RISC requires at least 16k stack */ | |
| 29 | 29 | #else | |
| 30 | 30 | #define THREAD_SIZE_ORDER 3 /* PA-RISC requires at least 32k stack */ | |
modified arch/parisc/kernel/setup.c
| @@ -132,18 +132,6 @@ void __init setup_arch(char **cmdline_p) | |||
| 132 | 132 | parisc_cache_init(); | |
| 133 | 133 | paging_init(); | |
| 134 | 134 | ||
| 135 | - | /* | |
| 136 | - | * Parse early parameters before mm_core_init_early() runs. | |
| 137 | - | * Several early_param() handlers only record data that is consumed | |
| 138 | - | * from there - for example hugepages=, hugepagesz=, | |
| 139 | - | * default_hugepagesz=, hugetlb_cma= and hugetlb_free_vmemmap= - so | |
| 140 | - | * the generic parse_early_param() call in start_kernel() is too late | |
| 141 | - | * for them. jump_label_init() must come first, since early param | |
| 142 | - | * handlers may enable or disable static keys. | |
| 143 | - | */ | |
| 144 | - | jump_label_init(); | |
| 145 | - | parse_early_param(); | |
| 146 | - | ||
| 147 | 135 | #ifdef CONFIG_PA11 | |
| 148 | 136 | dma_ops_init(); | |
| 149 | 137 | #endif | |
modified arch/parisc/kernel/unwind.c
| @@ -14,7 +14,6 @@ | |||
| 14 | 14 | #include <linux/sched.h> | |
| 15 | 15 | #include <linux/slab.h> | |
| 16 | 16 | #include <linux/sort.h> | |
| 17 | - | #include <linux/bsearch.h> | |
| 18 | 17 | #include <linux/sched/task_stack.h> | |
| 19 | 18 | ||
| 20 | 19 | #include <linux/uaccess.h> | |
| @@ -50,23 +49,27 @@ static DEFINE_SPINLOCK(unwind_lock); | |||
| 50 | 49 | static struct unwind_table kernel_unwind_table __ro_after_init; | |
| 51 | 50 | static LIST_HEAD(unwind_tables); | |
| 52 | 51 | ||
| 53 | - | static int cmp_unwind_entry(const void *key, const void *elt) | |
| 54 | - | { | |
| 55 | - | unsigned long addr = (unsigned long)key; | |
| 56 | - | const struct unwind_table_entry *e = elt; | |
| 57 | - | ||
| 58 | - | if (addr < e->region_start) | |
| 59 | - | return -1; | |
| 60 | - | if (addr > e->region_end) | |
| 61 | - | return 1; | |
| 62 | - | return 0; | |
| 63 | - | } | |
| 64 | - | ||
| 65 | 52 | static inline const struct unwind_table_entry * | |
| 66 | 53 | find_unwind_entry_in_table(const struct unwind_table *table, unsigned long addr) | |
| 67 | 54 | { | |
| 68 | - | return bsearch((void *)addr, table->table, table->length, | |
| 69 | - | sizeof(*table->table), cmp_unwind_entry); | |
| 55 | + | const struct unwind_table_entry *e = NULL; | |
| 56 | + | unsigned long lo, hi, mid; | |
| 57 | + | ||
| 58 | + | lo = 0; | |
| 59 | + | hi = table->length - 1; | |
| 60 | + | ||
| 61 | + | while (lo <= hi) { | |
| 62 | + | mid = (hi - lo) / 2 + lo; | |
| 63 | + | e = &table->table[mid]; | |
| 64 | + | if (addr < e->region_start) | |
| 65 | + | hi = mid - 1; | |
| 66 | + | else if (addr > e->region_end) | |
| 67 | + | lo = mid + 1; | |
| 68 | + | else | |
| 69 | + | return e; | |
| 70 | + | } | |
| 71 | + | ||
| 72 | + | return NULL; | |
| 70 | 73 | } | |
| 71 | 74 | ||
| 72 | 75 | static const struct unwind_table_entry * | |
modified arch/powerpc/kernel/iommu.c
| @@ -1076,7 +1076,7 @@ int iommu_tce_check_ioba(unsigned long page_shift, | |||
| 1076 | 1076 | if (ioba < offset) | |
| 1077 | 1077 | return -EINVAL; | |
| 1078 | 1078 | ||
| 1079 | - | if ((ioba + npages < ioba) || (ioba - offset + npages > size)) | |
| 1079 | + | if ((ioba + 1) > (offset + size)) | |
| 1080 | 1080 | return -EINVAL; | |
| 1081 | 1081 | ||
| 1082 | 1082 | return 0; | |
modified arch/powerpc/kvm/book3s_hv_nested.c
| @@ -1204,10 +1204,8 @@ static void kvmhv_emulate_tlbie_all_lpid(struct kvm_vcpu *vcpu, int ric) | |||
| 1204 | 1204 | ||
| 1205 | 1205 | spin_lock(&kvm->mmu_lock); | |
| 1206 | 1206 | idr_for_each_entry(&kvm->arch.kvm_nested_guest_idr, gp, lpid) { | |
| 1207 | - | ++gp->refcnt; | |
| 1208 | 1207 | spin_unlock(&kvm->mmu_lock); | |
| 1209 | 1208 | kvmhv_emulate_tlbie_lpid(vcpu, gp, ric); | |
| 1210 | - | kvmhv_put_nested(gp); | |
| 1211 | 1209 | spin_lock(&kvm->mmu_lock); | |
| 1212 | 1210 | } | |
| 1213 | 1211 | spin_unlock(&kvm->mmu_lock); | |
modified arch/powerpc/kvm/book3s_hv_uvmem.c
| @@ -779,11 +779,8 @@ static int kvmppc_svm_page_in(struct vm_area_struct *vma, | |||
| 779 | 779 | if (spage) { | |
| 780 | 780 | ret = uv_page_in(kvm->arch.lpid, pfn << page_shift, | |
| 781 | 781 | gpa, 0, page_shift); | |
| 782 | - | if (ret) { | |
| 783 | - | unlock_page(dpage); | |
| 784 | - | put_page(dpage); | |
| 782 | + | if (ret) | |
| 785 | 783 | goto out_finalize; | |
| 786 | - | } | |
| 787 | 784 | } | |
| 788 | 785 | } | |
| 789 | 786 | ||
modified arch/riscv/boot/dts/microchip/mpfs-beaglev-fire.dts
| @@ -90,6 +90,10 @@ | |||
| 90 | 90 | }; | |
| 91 | 91 | ||
| 92 | 92 | &gpio0 { | |
| 93 | + | interrupts = <13>, <14>, <15>, <16>, | |
| 94 | + | <17>, <18>, <19>, <20>, | |
| 95 | + | <21>, <22>, <23>, <24>, | |
| 96 | + | <25>, <26>; | |
| 93 | 97 | ngpios = <14>; | |
| 94 | 98 | gpio-line-names = "", "", "", "", "", "", "", | |
| 95 | 99 | "", "", "", "", "", "SD_CARD_CS", "USER_BUTTON"; | |
| @@ -97,6 +101,12 @@ | |||
| 97 | 101 | }; | |
| 98 | 102 | ||
| 99 | 103 | &gpio1 { | |
| 104 | + | interrupts = <27>, <28>, <29>, <30>, | |
| 105 | + | <31>, <32>, <33>, <34>, | |
| 106 | + | <35>, <36>, <37>, <38>, | |
| 107 | + | <39>, <40>, <41>, <42>, | |
| 108 | + | <43>, <44>, <45>, <46>, | |
| 109 | + | <47>, <48>, <49>, <50>; | |
| 100 | 110 | ngpios = <24>; | |
| 101 | 111 | gpio-line-names = "", "", "", "", "", "", "", "", "", "", | |
| 102 | 112 | "", "", "", "", "", "", "", "", "", "", | |
| @@ -105,6 +115,14 @@ | |||
| 105 | 115 | }; | |
| 106 | 116 | ||
| 107 | 117 | &gpio2 { | |
| 118 | + | interrupts = <53>, <53>, <53>, <53>, | |
| 119 | + | <53>, <53>, <53>, <53>, | |
| 120 | + | <53>, <53>, <53>, <53>, | |
| 121 | + | <53>, <53>, <53>, <53>, | |
| 122 | + | <53>, <53>, <53>, <53>, | |
| 123 | + | <53>, <53>, <53>, <53>, | |
| 124 | + | <53>, <53>, <53>, <53>, | |
| 125 | + | <53>, <53>, <53>, <53>; | |
| 108 | 126 | ngpios = <32>; | |
| 109 | 127 | gpio-line-names = "P8_PIN3_USER_LED_0", "P8_PIN4_USER_LED_1", "P8_PIN5_USER_LED_2", | |
| 110 | 128 | "P8_PIN6_USER_LED_3", "P8_PIN7_USER_LED_4", "P8_PIN8_USER_LED_5", | |
modified arch/riscv/include/asm/csr.h
| @@ -188,24 +188,12 @@ | |||
| 188 | 188 | #define HGATP_MODE_SHIFT HGATP32_MODE_SHIFT | |
| 189 | 189 | #endif | |
| 190 | 190 | ||
| 191 | - | /* | |
| 192 | - | * VSIP & HVIP relation | |
| 193 | - | * | |
| 194 | - | * The bit positions are same between VSIP and HVIP for interrupt | |
| 195 | - | * numbers 13-63, where there's a shift for the SSI, STI and SEI. | |
| 196 | - | */ | |
| 191 | + | /* VSIP & HVIP relation */ | |
| 197 | 192 | #define VSIP_TO_HVIP_SHIFT (IRQ_VS_SOFT - IRQ_S_SOFT) | |
| 198 | - | #define VSIP_BIAS_MASK ((_AC(1, UL) << IRQ_S_SOFT) | \ | |
| 193 | + | #define VSIP_VALID_MASK ((_AC(1, UL) << IRQ_S_SOFT) | \ | |
| 199 | 194 | (_AC(1, UL) << IRQ_S_TIMER) | \ | |
| 200 | - | (_AC(1, UL) << IRQ_S_EXT)) | |
| 201 | - | #define VSIP_NO_BIAS_MASK (_AC(1, UL) << IRQ_PMU_OVF) | |
| 202 | - | #define VSIP_VALID_MASK (VSIP_BIAS_MASK | VSIP_NO_BIAS_MASK) | |
| 203 | - | #define vsip_to_hvip(_vsip) ((((_vsip) & VSIP_BIAS_MASK) << \ | |
| 204 | - | VSIP_TO_HVIP_SHIFT) | \ | |
| 205 | - | ((_vsip) & VSIP_NO_BIAS_MASK)) | |
| 206 | - | #define hvip_to_vsip(_hvip) ((((_hvip) >> VSIP_TO_HVIP_SHIFT) & \ | |
| 207 | - | VSIP_BIAS_MASK) | \ | |
| 208 | - | ((_hvip) & VSIP_NO_BIAS_MASK)) | |
| 195 | + | (_AC(1, UL) << IRQ_S_EXT) | \ | |
| 196 | + | (_AC(1, UL) << IRQ_PMU_OVF)) | |
| 209 | 197 | ||
| 210 | 198 | /* AIA CSR bits */ | |
| 211 | 199 | #define TOPI_IID_SHIFT 16 | |
modified arch/riscv/kvm/aia_imsic.c
| @@ -965,14 +965,9 @@ int kvm_riscv_aia_imsic_rw_attr(struct kvm *kvm, unsigned long type, | |||
| 965 | 965 | if (!vcpu) | |
| 966 | 966 | return -ENODEV; | |
| 967 | 967 | ||
| 968 | - | if (mutex_lock_killable(&vcpu->mutex)) | |
| 969 | - | return -EINTR; | |
| 970 | - | ||
| 971 | 968 | imsic = vcpu->arch.aia_context.imsic_state; | |
| 972 | - | if (!imsic) { | |
| 973 | - | rc = -ENODEV; | |
| 974 | - | goto out_unlock; | |
| 975 | - | } | |
| 969 | + | if (!imsic) | |
| 970 | + | return -ENODEV; | |
| 976 | 971 | isel = KVM_DEV_RISCV_AIA_IMSIC_GET_ISEL(type); | |
| 977 | 972 | ||
| 978 | 973 | read_lock_irqsave(&imsic->vsfile_lock, flags); | |
| @@ -996,8 +991,6 @@ int kvm_riscv_aia_imsic_rw_attr(struct kvm *kvm, unsigned long type, | |||
| 996 | 991 | rc = imsic_vsfile_rw(vsfile_hgei, vsfile_cpu, imsic->nr_eix, | |
| 997 | 992 | isel, write, val); | |
| 998 | 993 | ||
| 999 | - | out_unlock: | |
| 1000 | - | mutex_unlock(&vcpu->mutex); | |
| 1001 | 994 | return rc; | |
| 1002 | 995 | } | |
| 1003 | 996 | ||
modified arch/riscv/kvm/mmu.c
| @@ -627,7 +627,6 @@ int kvm_riscv_mmu_map(struct kvm_vcpu *vcpu, struct kvm_memory_slot *memslot, | |||
| 627 | 627 | int ret; | |
| 628 | 628 | kvm_pfn_t hfn; | |
| 629 | 629 | bool is_hugetlb; | |
| 630 | - | bool unused = false; | |
| 631 | 630 | bool writable; | |
| 632 | 631 | unsigned int vma_pageshift; | |
| 633 | 632 | gfn_t gfn = gpa >> PAGE_SHIFT; | |
| @@ -708,8 +707,6 @@ int kvm_riscv_mmu_map(struct kvm_vcpu *vcpu, struct kvm_memory_slot *memslot, | |||
| 708 | 707 | vma_pageshift, current); | |
| 709 | 708 | return 0; | |
| 710 | 709 | } | |
| 711 | - | if (is_sigpending_pfn(hfn)) | |
| 712 | - | return -EINTR; | |
| 713 | 710 | if (is_error_noslot_pfn(hfn)) | |
| 714 | 711 | return -EFAULT; | |
| 715 | 712 | ||
| @@ -722,10 +719,8 @@ int kvm_riscv_mmu_map(struct kvm_vcpu *vcpu, struct kvm_memory_slot *memslot, | |||
| 722 | 719 | ||
| 723 | 720 | write_lock(&kvm->mmu_lock); | |
| 724 | 721 | ||
| 725 | - | if (mmu_invalidate_retry(kvm, mmu_seq)) { | |
| 726 | - | unused = true; | |
| 722 | + | if (mmu_invalidate_retry(kvm, mmu_seq)) | |
| 727 | 723 | goto out_unlock; | |
| 728 | - | } | |
| 729 | 724 | ||
| 730 | 725 | /* | |
| 731 | 726 | * Check if we are backed by a THP and thus use block mapping if | |
| @@ -748,8 +743,7 @@ int kvm_riscv_mmu_map(struct kvm_vcpu *vcpu, struct kvm_memory_slot *memslot, | |||
| 748 | 743 | kvm_err("Failed to map in G-stage\n"); | |
| 749 | 744 | ||
| 750 | 745 | out_unlock: | |
| 751 | - | kvm_release_faultin_page(kvm, page, | |
| 752 | - | unused || (ret && ret != -EEXIST), writable); | |
| 746 | + | kvm_release_faultin_page(kvm, page, ret && ret != -EEXIST, writable); | |
| 753 | 747 | write_unlock(&kvm->mmu_lock); | |
| 754 | 748 | return ret; | |
| 755 | 749 | } | |
modified arch/riscv/kvm/nacl.c
| @@ -42,24 +42,12 @@ again: | |||
| 42 | 42 | } | |
| 43 | 43 | } | |
| 44 | 44 | ||
| 45 | - | /* | |
| 46 | - | * Per SBI v3.0 section 15.1.2, the Page_Number and Page_Count | |
| 47 | - | * words must be updated before the Config word with its Pending | |
| 48 | - | * bit set. WRITE_ONCE() stops the compiler from reordering the | |
| 49 | - | * stores and smp_wmb() makes the parameter words globally | |
| 50 | - | * visible to the SBI implementation (or NACL hardware) before | |
| 51 | - | * the Pending bit is set. | |
| 52 | - | */ | |
| 45 | + | entp = shmem + SBI_NACL_SHMEM_HFENCE_ENTRY_CONFIG(i); | |
| 46 | + | *entp = cpu_to_lelong(control); | |
| 53 | 47 | entp = shmem + SBI_NACL_SHMEM_HFENCE_ENTRY_PNUM(i); | |
| 54 | - | WRITE_ONCE(*entp, cpu_to_lelong(page_num)); | |
| 48 | + | *entp = cpu_to_lelong(page_num); | |
| 55 | 49 | entp = shmem + SBI_NACL_SHMEM_HFENCE_ENTRY_PCOUNT(i); | |
| 56 | - | WRITE_ONCE(*entp, cpu_to_lelong(page_count)); | |
| 57 | - | ||
| 58 | - | /* Ensure the parameter words are visible before the Pending bit */ | |
| 59 | - | smp_wmb(); | |
| 60 | - | ||
| 61 | - | entp = shmem + SBI_NACL_SHMEM_HFENCE_ENTRY_CONFIG(i); | |
| 62 | - | WRITE_ONCE(*entp, cpu_to_lelong(control)); | |
| 50 | + | *entp = cpu_to_lelong(page_count); | |
| 63 | 51 | } | |
| 64 | 52 | ||
| 65 | 53 | int kvm_riscv_nacl_enable(void) | |
modified arch/riscv/kvm/vcpu.c
| @@ -491,7 +491,8 @@ bool kvm_riscv_vcpu_has_interrupts(struct kvm_vcpu *vcpu, u64 mask) | |||
| 491 | 491 | bool ret; | |
| 492 | 492 | ||
| 493 | 493 | raw_spin_lock_irqsave(&vcpu->arch.irqs_pending_lock, flags); | |
| 494 | - | ie = vsip_to_hvip(vcpu->arch.guest_csr.vsie) & (unsigned long)mask; | |
| 494 | + | ie = ((vcpu->arch.guest_csr.vsie & VSIP_VALID_MASK) | |
| 495 | + | << VSIP_TO_HVIP_SHIFT) & (unsigned long)mask; | |
| 495 | 496 | ie |= vcpu->arch.guest_csr.vsie & ~IRQ_LOCAL_MASK & | |
| 496 | 497 | (unsigned long)mask; | |
| 497 | 498 | ret = vcpu->arch.irqs_pending[0] & ie; | |
modified arch/riscv/kvm/vcpu_exit.c
| @@ -283,7 +283,7 @@ int kvm_riscv_vcpu_exit(struct kvm_vcpu *vcpu, struct kvm_run *run, | |||
| 283 | 283 | } | |
| 284 | 284 | ||
| 285 | 285 | /* Print details in-case of error */ | |
| 286 | - | if (ret < 0 && ret != -EINTR) { | |
| 286 | + | if (ret < 0) { | |
| 287 | 287 | kvm_err("VCPU exit error %d\n", ret); | |
| 288 | 288 | kvm_err("SEPC=0x%lx SSTATUS=0x%lx HSTATUS=0x%lx\n", | |
| 289 | 289 | vcpu->arch.guest_context.sepc, | |
modified arch/riscv/kvm/vcpu_onereg.c
| @@ -272,7 +272,7 @@ static int kvm_riscv_vcpu_general_get_csr(struct kvm_vcpu *vcpu, | |||
| 272 | 272 | ||
| 273 | 273 | if (reg_num == KVM_REG_RISCV_CSR_REG(sip)) { | |
| 274 | 274 | kvm_riscv_vcpu_flush_interrupts(vcpu); | |
| 275 | - | *out_val = hvip_to_vsip(csr->hvip); | |
| 275 | + | *out_val = (csr->hvip >> VSIP_TO_HVIP_SHIFT) & VSIP_VALID_MASK; | |
| 276 | 276 | *out_val |= csr->hvip & ~IRQ_LOCAL_MASK; | |
| 277 | 277 | } else | |
| 278 | 278 | *out_val = ((unsigned long *)csr)[reg_num]; | |
| @@ -293,8 +293,10 @@ static int kvm_riscv_vcpu_general_set_csr(struct kvm_vcpu *vcpu, | |||
| 293 | 293 | ||
| 294 | 294 | reg_num = array_index_nospec(reg_num, regs_max); | |
| 295 | 295 | ||
| 296 | - | if (reg_num == KVM_REG_RISCV_CSR_REG(sip)) | |
| 297 | - | reg_val = vsip_to_hvip(reg_val); | |
| 296 | + | if (reg_num == KVM_REG_RISCV_CSR_REG(sip)) { | |
| 297 | + | reg_val &= VSIP_VALID_MASK; | |
| 298 | + | reg_val <<= VSIP_TO_HVIP_SHIFT; | |
| 299 | + | } | |
| 298 | 300 | ||
| 299 | 301 | ((unsigned long *)csr)[reg_num] = reg_val; | |
| 300 | 302 | ||
modified arch/riscv/kvm/vcpu_pmu.c
| @@ -270,13 +270,12 @@ static int pmu_ctr_read(struct kvm_vcpu *vcpu, unsigned long cidx, | |||
| 270 | 270 | return -EINVAL; | |
| 271 | 271 | ||
| 272 | 272 | pmc->counter_val = kvpmu->fw_event[fevent_code].value; | |
| 273 | - | *out_val = pmc->counter_val; | |
| 274 | 273 | } else if (pmc->perf_event) { | |
| 275 | - | *out_val = pmc->counter_val + | |
| 276 | - | perf_event_read_value(pmc->perf_event, &enabled, &running); | |
| 274 | + | pmc->counter_val += perf_event_read_value(pmc->perf_event, &enabled, &running); | |
| 277 | 275 | } else { | |
| 278 | 276 | return -EINVAL; | |
| 279 | 277 | } | |
| 278 | + | *out_val = pmc->counter_val; | |
| 280 | 279 | ||
| 281 | 280 | return 0; | |
| 282 | 281 | } | |
| @@ -455,14 +454,6 @@ int kvm_riscv_vcpu_pmu_snapshot_set_shmem(struct kvm_vcpu *vcpu, unsigned long s | |||
| 455 | 454 | } | |
| 456 | 455 | } | |
| 457 | 456 | ||
| 458 | - | /* | |
| 459 | - | * Clear any previously installed snapshot area to avoid leaking | |
| 460 | - | * the old sdata and to keep sdata/snapshot_addr consistent if | |
| 461 | - | * the re-install fails below. | |
| 462 | - | */ | |
| 463 | - | if (kvpmu->snapshot_addr != INVALID_GPA) | |
| 464 | - | kvm_pmu_clear_snapshot_area(vcpu); | |
| 465 | - | ||
| 466 | 457 | kvpmu->sdata = kzalloc(snapshot_area_size, GFP_ATOMIC | __GFP_ACCOUNT); | |
| 467 | 458 | if (!kvpmu->sdata) { | |
| 468 | 459 | sbiret = SBI_ERR_FAILURE; | |
| @@ -654,6 +645,7 @@ int kvm_riscv_vcpu_pmu_ctr_stop(struct kvm_vcpu *vcpu, unsigned long ctr_base, | |||
| 654 | 645 | { | |
| 655 | 646 | struct kvm_pmu *kvpmu = vcpu_to_pmu(vcpu); | |
| 656 | 647 | int i, pmc_index, sbiret = 0; | |
| 648 | + | u64 enabled, running; | |
| 657 | 649 | struct kvm_pmc *pmc; | |
| 658 | 650 | int fevent_code; | |
| 659 | 651 | bool snap_flag_set = flags & SBI_PMU_STOP_FLAG_TAKE_SNAPSHOT; | |
| @@ -683,19 +675,14 @@ int kvm_riscv_vcpu_pmu_ctr_stop(struct kvm_vcpu *vcpu, unsigned long ctr_base, | |||
| 683 | 675 | goto out; | |
| 684 | 676 | } | |
| 685 | 677 | ||
| 686 | - | if (!kvpmu->fw_event[fevent_code].started) { | |
| 678 | + | if (!kvpmu->fw_event[fevent_code].started) | |
| 687 | 679 | sbiret = SBI_ERR_ALREADY_STOPPED; | |
| 688 | - | } else { | |
| 689 | - | kvpmu->fw_event[fevent_code].started = false; | |
| 690 | - | pmc->counter_val = kvpmu->fw_event[fevent_code].value; | |
| 691 | - | } | |
| 680 | + | ||
| 681 | + | kvpmu->fw_event[fevent_code].started = false; | |
| 692 | 682 | } else if (pmc->perf_event) { | |
| 693 | 683 | if (pmc->started) { | |
| 694 | - | /* | |
| 695 | - | * Stop the counter and fold the live count into counter_val. | |
| 696 | - | * Reset the event value to avoid redundant accumulation. | |
| 697 | - | */ | |
| 698 | - | pmc->counter_val += perf_event_pause(pmc->perf_event, true); | |
| 684 | + | /* Stop counting the counter */ | |
| 685 | + | perf_event_disable(pmc->perf_event); | |
| 699 | 686 | pmc->started = false; | |
| 700 | 687 | } else { | |
| 701 | 688 | sbiret = SBI_ERR_ALREADY_STOPPED; | |
| @@ -709,6 +696,11 @@ int kvm_riscv_vcpu_pmu_ctr_stop(struct kvm_vcpu *vcpu, unsigned long ctr_base, | |||
| 709 | 696 | } | |
| 710 | 697 | ||
| 711 | 698 | if (snap_flag_set && !sbiret) { | |
| 699 | + | if (pmc->cinfo.type == SBI_PMU_CTR_TYPE_FW) | |
| 700 | + | pmc->counter_val = kvpmu->fw_event[fevent_code].value; | |
| 701 | + | else if (pmc->perf_event) | |
| 702 | + | pmc->counter_val += perf_event_read_value(pmc->perf_event, | |
| 703 | + | &enabled, &running); | |
| 712 | 704 | /* | |
| 713 | 705 | * The counter and overflow indices in the snapshot region are w.r.to | |
| 714 | 706 | * cbase. Modify the set bit in the counter mask instead of the pmc_index | |
| @@ -735,10 +727,9 @@ int kvm_riscv_vcpu_pmu_ctr_stop(struct kvm_vcpu *vcpu, unsigned long ctr_base, | |||
| 735 | 727 | } | |
| 736 | 728 | } | |
| 737 | 729 | ||
| 738 | - | if (shmem_needs_update && | |
| 739 | - | kvm_vcpu_write_guest(vcpu, kvpmu->snapshot_addr, kvpmu->sdata, | |
| 740 | - | sizeof(struct riscv_pmu_snapshot_data))) | |
| 741 | - | sbiret = SBI_ERR_FAILURE; | |
| 730 | + | if (shmem_needs_update) | |
| 731 | + | kvm_vcpu_write_guest(vcpu, kvpmu->snapshot_addr, kvpmu->sdata, | |
| 732 | + | sizeof(struct riscv_pmu_snapshot_data)); | |
| 742 | 733 | ||
| 743 | 734 | out: | |
| 744 | 735 | retdata->err_val = sbiret; | |
modified arch/riscv/kvm/vcpu_sbi_hsm.c
| @@ -95,9 +95,9 @@ static int kvm_sbi_ext_hsm_handler(struct kvm_vcpu *vcpu, struct kvm_run *run, | |||
| 95 | 95 | ret = kvm_sbi_hsm_vcpu_get_status(vcpu); | |
| 96 | 96 | if (ret >= 0) { | |
| 97 | 97 | retdata->out_val = ret; | |
| 98 | - | ret = 0; | |
| 98 | + | retdata->err_val = 0; | |
| 99 | 99 | } | |
| 100 | - | break; | |
| 100 | + | return 0; | |
| 101 | 101 | case SBI_EXT_HSM_HART_SUSPEND: | |
| 102 | 102 | switch (lower_32_bits(cp->a0)) { | |
| 103 | 103 | case SBI_HSM_SUSPEND_RET_DEFAULT: | |
modified arch/riscv/kvm/vcpu_timer.c
| @@ -61,13 +61,10 @@ static enum hrtimer_restart kvm_riscv_vcpu_hrtimer_expired(struct hrtimer *h) | |||
| 61 | 61 | ||
| 62 | 62 | static int kvm_riscv_vcpu_timer_cancel(struct kvm_vcpu_timer *t) | |
| 63 | 63 | { | |
| 64 | - | if (!t->init_done) | |
| 64 | + | if (!t->init_done || !t->next_set) | |
| 65 | 65 | return -EINVAL; | |
| 66 | 66 | ||
| 67 | 67 | hrtimer_cancel(&t->hrt); | |
| 68 | - | ||
| 69 | - | if (!t->next_set) | |
| 70 | - | return -EINVAL; | |
| 71 | 68 | t->next_set = false; | |
| 72 | 69 | ||
| 73 | 70 | return 0; | |
modified arch/s390/crypto/hmac_s390.c
| @@ -150,10 +150,7 @@ static int hash_data(const u8 *in, unsigned int inlen, | |||
| 150 | 150 | ||
| 151 | 151 | #undef PARAM_INIT | |
| 152 | 152 | ||
| 153 | - | if (final) | |
| 154 | - | cpacf_klmd(func, ¶m, in, inlen); | |
| 155 | - | else | |
| 156 | - | cpacf_kimd(func, ¶m, in, inlen); | |
| 153 | + | cpacf_klmd(func, ¶m, in, inlen); | |
| 157 | 154 | ||
| 158 | 155 | memcpy(digest, ¶m, digestsize); | |
| 159 | 156 | ||
modified arch/s390/include/asm/debug.h
| @@ -460,11 +460,7 @@ static int VNAME(var, active_entries)[EARLY_AREAS] __initdata | |||
| 460 | 460 | #define __REGISTER_STATIC_DEBUG_INFO(var, name, pages, areas, view) \ | |
| 461 | 461 | static int __init VNAME(var, reg)(void) \ | |
| 462 | 462 | { \ | |
| 463 | - | int rc; \ | |
| 464 | - | \ | |
| 465 | - | rc = debug_register_static(&var, (pages), (areas)); \ | |
| 466 | - | if (rc) \ | |
| 467 | - | return rc; \ | |
| 463 | + | debug_register_static(&var, (pages), (areas)); \ | |
| 468 | 464 | debug_register_view(&var, (view)); \ | |
| 469 | 465 | return 0; \ | |
| 470 | 466 | } \ | |
| @@ -497,7 +493,7 @@ static debug_info_t __refdata var = \ | |||
| 497 | 493 | static debug_info_t __used __section(".s390dbf_info") *VNAME(var, info) = &var; \ | |
| 498 | 494 | __REGISTER_STATIC_DEBUG_INFO(var, name, pages, nr_areas, view) | |
| 499 | 495 | ||
| 500 | - | int debug_register_static(debug_info_t *id, int pages_per_area, int nr_areas); | |
| 496 | + | void debug_register_static(debug_info_t *id, int pages_per_area, int nr_areas); | |
| 501 | 497 | ||
| 502 | 498 | #endif /* MODULE */ | |
| 503 | 499 | ||
modified arch/s390/kernel/debug.c
| @@ -434,8 +434,7 @@ static debug_info_t *debug_info_copy(debug_info_t *in, int mode) | |||
| 434 | 434 | debug_info_free(rc); | |
| 435 | 435 | } while (1); | |
| 436 | 436 | ||
| 437 | - | /* debug_register_static() failure leaves areas NULL, bounds intact */ | |
| 438 | - | if (mode == NO_AREAS || !in->areas) | |
| 437 | + | if (mode == NO_AREAS) | |
| 439 | 438 | goto out; | |
| 440 | 439 | ||
| 441 | 440 | for (i = 0; i < in->nr_areas; i++) { | |
| @@ -824,9 +823,6 @@ ssize_t debug_dump(debug_info_t *id, struct debug_view *view, | |||
| 824 | 823 | file_private_info_t *p_info; | |
| 825 | 824 | size_t size, offset = 0; | |
| 826 | 825 | ||
| 827 | - | if (!id) | |
| 828 | - | return -EINVAL; | |
| 829 | - | ||
| 830 | 826 | /* Need space for '\0' byte */ | |
| 831 | 827 | if (buf_size < 1) | |
| 832 | 828 | return 0; | |
| @@ -954,12 +950,8 @@ EXPORT_SYMBOL(debug_register); | |||
| 954 | 950 | * | |
| 955 | 951 | * Note: This function is called automatically via an initcall generated by | |
| 956 | 952 | * DEFINE_STATIC_DEBUG_INFO. | |
| 957 | - | * | |
| 958 | - | * Return: | |
| 959 | - | * - 0 on success | |
| 960 | - | * - negative error code on failure | |
| 961 | 953 | */ | |
| 962 | - | int debug_register_static(debug_info_t *id, int pages_per_area, int nr_areas) | |
| 954 | + | void debug_register_static(debug_info_t *id, int pages_per_area, int nr_areas) | |
| 963 | 955 | { | |
| 964 | 956 | unsigned long flags; | |
| 965 | 957 | debug_info_t *copy; | |
| @@ -967,7 +959,7 @@ int debug_register_static(debug_info_t *id, int pages_per_area, int nr_areas) | |||
| 967 | 959 | if (!initialized) { | |
| 968 | 960 | pr_err("Tried to register debug feature %s too early\n", | |
| 969 | 961 | id->name); | |
| 970 | - | return -EINVAL; | |
| 962 | + | return; | |
| 971 | 963 | } | |
| 972 | 964 | ||
| 973 | 965 | debug_get_param(id->name, &id->level, &pages_per_area, false); | |
| @@ -983,7 +975,7 @@ int debug_register_static(debug_info_t *id, int pages_per_area, int nr_areas) | |||
| 983 | 975 | id->active_entries = NULL; | |
| 984 | 976 | raw_spin_unlock_irqrestore(&id->lock, flags); | |
| 985 | 977 | ||
| 986 | - | return -ENOMEM; | |
| 978 | + | return; | |
| 987 | 979 | } | |
| 988 | 980 | ||
| 989 | 981 | /* Replace static trace area with dynamic copy. */ | |
| @@ -1001,8 +993,6 @@ int debug_register_static(debug_info_t *id, int pages_per_area, int nr_areas) | |||
| 1001 | 993 | mutex_lock(&debug_mutex); | |
| 1002 | 994 | _debug_register(id); | |
| 1003 | 995 | mutex_unlock(&debug_mutex); | |
| 1004 | - | ||
| 1005 | - | return 0; | |
| 1006 | 996 | } | |
| 1007 | 997 | ||
| 1008 | 998 | /* Remove debugfs entries. */ | |
modified arch/s390/kernel/uv.c
| @@ -825,7 +825,7 @@ static int find_secret_in_page(const u8 secret_id[UV_SECRET_ID_LEN], | |||
| 825 | 825 | { | |
| 826 | 826 | u16 i; | |
| 827 | 827 | ||
| 828 | - | for (i = 0; i < list->num_secr_stored; i++) { | |
| 828 | + | for (i = 0; i < list->total_num_secrets; i++) { | |
| 829 | 829 | if (memcmp(secret_id, list->secrets[i].id, UV_SECRET_ID_LEN) == 0) { | |
| 830 | 830 | *secret = list->secrets[i].hdr; | |
| 831 | 831 | return 0; | |
| @@ -846,14 +846,11 @@ int uv_find_secret(const u8 secret_id[UV_SECRET_ID_LEN], | |||
| 846 | 846 | struct uv_secret_list *list, | |
| 847 | 847 | struct uv_secret_list_item_hdr *secret) | |
| 848 | 848 | { | |
| 849 | - | u16 start_idx; | |
| 849 | + | u16 start_idx = 0; | |
| 850 | 850 | u16 list_rc; | |
| 851 | 851 | int ret; | |
| 852 | 852 | ||
| 853 | - | list->next_secret_idx = 0; | |
| 854 | - | ||
| 855 | 853 | do { | |
| 856 | - | start_idx = list->next_secret_idx; | |
| 857 | 854 | uv_list_secrets(list, start_idx, &list_rc, NULL); | |
| 858 | 855 | if (list_rc != UVC_RC_EXECUTED && list_rc != UVC_RC_MORE_DATA) { | |
| 859 | 856 | if (list_rc == UVC_RC_INV_CMD) | |
| @@ -864,6 +861,7 @@ int uv_find_secret(const u8 secret_id[UV_SECRET_ID_LEN], | |||
| 864 | 861 | ret = find_secret_in_page(secret_id, list, secret); | |
| 865 | 862 | if (ret == 0) | |
| 866 | 863 | return ret; | |
| 864 | + | start_idx = list->next_secret_idx; | |
| 867 | 865 | } while (list_rc == UVC_RC_MORE_DATA && start_idx < list->next_secret_idx); | |
| 868 | 866 | ||
| 869 | 867 | return -ENOENT; | |
modified arch/s390/kvm/gmap/dat.c
| @@ -621,20 +621,17 @@ int dat_get_storage_key(union asce asce, gfn_t gfn, union skey *skey) | |||
| 621 | 621 | union pte *ptep; | |
| 622 | 622 | int rc; | |
| 623 | 623 | ||
| 624 | - | again: | |
| 625 | 624 | skey->skey = 0; | |
| 626 | 625 | rc = dat_entry_walk(NULL, gfn, asce, DAT_WALK_ANY, TABLE_TYPE_PAGE_TABLE, &crstep, &ptep); | |
| 627 | 626 | if (rc) | |
| 628 | 627 | return rc; | |
| 629 | 628 | ||
| 630 | 629 | if (!ptep) { | |
| 631 | - | union crste crste = READ_ONCE(*crstep); | |
| 630 | + | union crste crste; | |
| 632 | 631 | ||
| 633 | - | if (!crste_leaf(crste) && !crste.h.i) | |
| 634 | - | goto again; | |
| 635 | - | if (!crste.s.fc1.pr) | |
| 632 | + | crste = READ_ONCE(*crstep); | |
| 633 | + | if (!crste.h.fc || !crste.s.fc1.pr) | |
| 636 | 634 | return 0; | |
| 637 | - | ||
| 638 | 635 | skey->skey = page_get_storage_key(large_crste_to_phys(crste, gfn)); | |
| 639 | 636 | return 0; | |
| 640 | 637 | } | |
| @@ -665,20 +662,13 @@ int dat_set_storage_key(struct kvm_s390_mmu_cache *mc, union asce asce, gfn_t gf | |||
| 665 | 662 | union pte *ptep; | |
| 666 | 663 | int rc; | |
| 667 | 664 | ||
| 668 | - | again: | |
| 669 | 665 | rc = dat_entry_walk(mc, gfn, asce, DAT_WALK_LEAF_ALLOC, TABLE_TYPE_PAGE_TABLE, | |
| 670 | 666 | &crstep, &ptep); | |
| 671 | 667 | if (rc) | |
| 672 | 668 | return rc; | |
| 673 | 669 | ||
| 674 | 670 | if (!ptep) { | |
| 675 | - | union crste crste = READ_ONCE(*crstep); | |
| 676 | - | ||
| 677 | - | /* A large page has been split concurrently, try again */ | |
| 678 | - | if (!crste_leaf(crste)) | |
| 679 | - | goto again; | |
| 680 | - | ||
| 681 | - | page_set_storage_key(large_crste_to_phys(crste, gfn), skey.skey, !nq); | |
| 671 | + | page_set_storage_key(large_crste_to_phys(*crstep, gfn), skey.skey, !nq); | |
| 682 | 672 | return 0; | |
| 683 | 673 | } | |
| 684 | 674 | ||
| @@ -728,22 +718,15 @@ int dat_cond_set_storage_key(struct kvm_s390_mmu_cache *mmc, union asce asce, gf | |||
| 728 | 718 | union pte *ptep; | |
| 729 | 719 | int rc; | |
| 730 | 720 | ||
| 731 | - | again: | |
| 732 | 721 | rc = dat_entry_walk(mmc, gfn, asce, DAT_WALK_LEAF_ALLOC, TABLE_TYPE_PAGE_TABLE, | |
| 733 | 722 | &crstep, &ptep); | |
| 734 | 723 | if (rc) | |
| 735 | 724 | return rc; | |
| 736 | 725 | ||
| 737 | 726 | if (!ptep) { | |
| 738 | - | union crste crste = READ_ONCE(*crstep); | |
| 739 | - | ||
| 740 | - | /* A large page has been split concurrently, try again */ | |
| 741 | - | if (!crste_leaf(crste)) | |
| 742 | - | goto again; | |
| 743 | 727 | if (!oldkey) | |
| 744 | 728 | oldkey = &prev; | |
| 745 | - | ||
| 746 | - | return page_cond_set_storage_key(large_crste_to_phys(crste, gfn), skey, oldkey, | |
| 729 | + | return page_cond_set_storage_key(large_crste_to_phys(*crstep, gfn), skey, oldkey, | |
| 747 | 730 | nq, mr, mc); | |
| 748 | 731 | } | |
| 749 | 732 | ||
| @@ -785,7 +768,7 @@ int dat_reset_reference_bit(union asce asce, gfn_t gfn, union skey *skey) | |||
| 785 | 768 | int rc; | |
| 786 | 769 | ||
| 787 | 770 | skey->skey = 0; | |
| 788 | - | again: | |
| 771 | + | ||
| 789 | 772 | rc = dat_entry_walk(NULL, gfn, asce, DAT_WALK_ANY, TABLE_TYPE_PAGE_TABLE, &crstep, &ptep); | |
| 790 | 773 | if (rc) | |
| 791 | 774 | return rc; | |
| @@ -793,12 +776,9 @@ again: | |||
| 793 | 776 | if (!ptep) { | |
| 794 | 777 | union crste crste = READ_ONCE(*crstep); | |
| 795 | 778 | ||
| 796 | - | /* A large page has been split concurrently, try again */ | |
| 797 | - | if (!crste_leaf(crste) && !crste.h.i) | |
| 798 | - | goto again; | |
| 799 | - | if (!crste.s.fc1.pr) | |
| 779 | + | if (!crste.h.fc || !crste.s.fc1.pr) | |
| 800 | 780 | return 0; | |
| 801 | - | skey->skey = page_reset_referenced(large_crste_to_phys(crste, gfn)) << 1; | |
| 781 | + | skey->skey = page_reset_referenced(large_crste_to_phys(*crstep, gfn)) << 1; | |
| 802 | 782 | return 0; | |
| 803 | 783 | } | |
| 804 | 784 | old = pgste_get_lock(ptep); | |
| @@ -866,12 +846,19 @@ long dat_reset_skeys(union asce asce, gfn_t start) | |||
| 866 | 846 | } | |
| 867 | 847 | #endif /* KVM_S390_MANAGES_S390_GUEST */ | |
| 868 | 848 | ||
| 849 | + | struct slot_priv { | |
| 850 | + | unsigned long token; | |
| 851 | + | struct kvm_s390_mmu_cache *mc; | |
| 852 | + | }; | |
| 853 | + | ||
| 869 | 854 | static long _dat_slot_pte(union pte *ptep, gfn_t gfn, gfn_t next, struct dat_walk *walk) | |
| 870 | 855 | { | |
| 856 | + | struct slot_priv *p = walk->priv; | |
| 857 | + | union crste dummy = { .val = p->token }; | |
| 871 | 858 | union pte new_pte, pte = READ_ONCE(*ptep); | |
| 872 | 859 | union pgste pgste; | |
| 873 | 860 | ||
| 874 | - | new_pte = walk->priv ? _PTE_EMPTY : _PTE_TOK(_DAT_TOKEN_PIC, PGM_ADDRESSING); | |
| 861 | + | new_pte = _PTE_TOK(dummy.tok.type, dummy.tok.par); | |
| 875 | 862 | ||
| 876 | 863 | /* Table entry already in the desired state. */ | |
| 877 | 864 | if (pte.val == new_pte.val) | |
| @@ -888,9 +875,10 @@ static long _dat_slot_pte(union pte *ptep, gfn_t gfn, gfn_t next, struct dat_wal | |||
| 888 | 875 | static long _dat_slot_crste(union crste *crstep, gfn_t gfn, gfn_t next, struct dat_walk *walk) | |
| 889 | 876 | { | |
| 890 | 877 | union crste new_crste, crste = READ_ONCE(*crstep); | |
| 891 | - | struct kvm_s390_mmu_cache *mc = walk->priv; | |
| 878 | + | struct slot_priv *p = walk->priv; | |
| 892 | 879 | ||
| 893 | - | new_crste = mc ? _CRSTE_EMPTY(crste.h.tt) : _CRSTE_HOLE(crste.h.tt); | |
| 880 | + | new_crste.val = p->token; | |
| 881 | + | new_crste.h.tt = crste.h.tt; | |
| 894 | 882 | ||
| 895 | 883 | /* Table entry already in the desired state. */ | |
| 896 | 884 | if (crste.val == new_crste.val) | |
| @@ -914,10 +902,7 @@ static long _dat_slot_crste(union crste *crstep, gfn_t gfn, gfn_t next, struct d | |||
| 914 | 902 | if (!crste.h.fc && !crste.h.i) | |
| 915 | 903 | return 0; | |
| 916 | 904 | /* Split (install a lower level table), and handle things there. */ | |
| 917 | - | if (mc) | |
| 918 | - | return dat_split_crste(mc, crstep, gfn, walk->asce, false); | |
| 919 | - | /* A large page should never cross memslots boundaries */ | |
| 920 | - | return -EINVAL; | |
| 905 | + | return dat_split_crste(p->mc, crstep, gfn, walk->asce, false); | |
| 921 | 906 | } | |
| 922 | 907 | ||
| 923 | 908 | static const struct dat_walk_ops dat_slot_ops = { | |
| @@ -925,10 +910,16 @@ static const struct dat_walk_ops dat_slot_ops = { | |||
| 925 | 910 | .crste_ops = { _dat_slot_crste, _dat_slot_crste, _dat_slot_crste, _dat_slot_crste, }, | |
| 926 | 911 | }; | |
| 927 | 912 | ||
| 928 | - | int dat_set_slot(struct kvm_s390_mmu_cache *mc, union asce asce, gfn_t start, gfn_t end) | |
| 913 | + | int dat_set_slot(struct kvm_s390_mmu_cache *mc, union asce asce, gfn_t start, gfn_t end, | |
| 914 | + | u16 type, u16 param) | |
| 929 | 915 | { | |
| 916 | + | struct slot_priv priv = { | |
| 917 | + | .token = _CRSTE_TOK(0, type, param).val, | |
| 918 | + | .mc = mc, | |
| 919 | + | }; | |
| 920 | + | ||
| 930 | 921 | return _dat_walk_gfn_range(start, end, asce, &dat_slot_ops, | |
| 931 | - | DAT_WALK_IGN_HOLES | DAT_WALK_ANY, mc); | |
| 922 | + | DAT_WALK_IGN_HOLES | DAT_WALK_ANY, &priv); | |
| 932 | 923 | } | |
| 933 | 924 | ||
| 934 | 925 | static void pgste_set_unlock_multiple(union pte *first, int n, union pgste *pgstes) | |
modified arch/s390/kvm/gmap/dat.h
| @@ -547,7 +547,8 @@ long dat_reset_skeys(union asce asce, gfn_t start); | |||
| 547 | 547 | unsigned long dat_get_ptval(struct page_table *table, struct ptval_param param); | |
| 548 | 548 | void dat_set_ptval(struct page_table *table, struct ptval_param param, unsigned long val); | |
| 549 | 549 | ||
| 550 | - | int dat_set_slot(struct kvm_s390_mmu_cache *mc, union asce asce, gfn_t start, gfn_t end); | |
| 550 | + | int dat_set_slot(struct kvm_s390_mmu_cache *mc, union asce asce, gfn_t start, gfn_t end, | |
| 551 | + | u16 type, u16 param); | |
| 551 | 552 | ||
| 552 | 553 | #if KVM_S390_MANAGES_S390_GUEST | |
| 553 | 554 | int dat_set_prefix_notif_bit(union asce asce, gfn_t gfn); | |
| @@ -972,15 +973,16 @@ static inline int get_level(union crste *crstep, union pte *ptep) | |||
| 972 | 973 | return ptep ? TABLE_TYPE_PAGE_TABLE : crstep->h.tt; | |
| 973 | 974 | } | |
| 974 | 975 | ||
| 975 | - | static inline int dat_delete_slot(union asce asce, gfn_t start, unsigned long npages) | |
| 976 | + | static inline int dat_delete_slot(struct kvm_s390_mmu_cache *mc, union asce asce, gfn_t start, | |
| 977 | + | unsigned long npages) | |
| 976 | 978 | { | |
| 977 | - | return dat_set_slot(NULL, asce, start, start + npages); | |
| 979 | + | return dat_set_slot(mc, asce, start, start + npages, _DAT_TOKEN_PIC, PGM_ADDRESSING); | |
| 978 | 980 | } | |
| 979 | 981 | ||
| 980 | 982 | static inline int dat_create_slot(struct kvm_s390_mmu_cache *mc, union asce asce, gfn_t start, | |
| 981 | 983 | unsigned long npages) | |
| 982 | 984 | { | |
| 983 | - | return dat_set_slot(mc, asce, start, start + npages); | |
| 985 | + | return dat_set_slot(mc, asce, start, start + npages, _DAT_TOKEN_NONE, 0); | |
| 984 | 986 | } | |
| 985 | 987 | ||
| 986 | 988 | static inline bool crste_is_ucas(union crste crste) | |
modified arch/s390/kvm/gmap/gmap.c
| @@ -994,13 +994,11 @@ static long _destroy_pages_pte(union pte *ptep, gfn_t gfn, gfn_t next, struct da | |||
| 994 | 994 | static long _destroy_pages_crste(union crste *crstep, gfn_t gfn, gfn_t next, struct dat_walk *walk) | |
| 995 | 995 | { | |
| 996 | 996 | phys_addr_t origin, cur, end; | |
| 997 | - | union crste crste; | |
| 998 | 997 | ||
| 999 | - | crste = READ_ONCE(*crstep); | |
| 1000 | - | if (!crste.h.fc || !crste.s.fc1.pr) | |
| 998 | + | if (!crstep->h.fc || !crstep->s.fc1.pr) | |
| 1001 | 999 | return 0; | |
| 1002 | 1000 | ||
| 1003 | - | origin = crste_origin_large(crste); | |
| 1001 | + | origin = crste_origin_large(*crstep); | |
| 1004 | 1002 | cur = ((max(gfn, walk->start) - gfn) << PAGE_SHIFT) + origin; | |
| 1005 | 1003 | end = ((min(next, walk->end) - gfn) << PAGE_SHIFT) + origin; | |
| 1006 | 1004 | for ( ; cur < end; cur += PAGE_SIZE) | |
modified arch/s390/kvm/gmap/kvm_mmu.c
| @@ -47,9 +47,6 @@ int s390_kvm_mmu_prepare_memory_region(struct kvm *kvm, | |||
| 47 | 47 | struct kvm_memory_slot *new, | |
| 48 | 48 | enum kvm_mr_change change) | |
| 49 | 49 | { | |
| 50 | - | struct kvm_s390_mmu_cache *mc __free(kvm_s390_mmu_cache) = NULL; | |
| 51 | - | int rc = 0; | |
| 52 | - | ||
| 53 | 50 | if (kvm_is_ucontrol(kvm) && new && new->id < KVM_USER_MEM_SLOTS) | |
| 54 | 51 | return -EINVAL; | |
| 55 | 52 | ||
| @@ -64,10 +61,6 @@ int s390_kvm_mmu_prepare_memory_region(struct kvm *kvm, | |||
| 64 | 61 | * and munmap() stuff in this slot after doing this call at any | |
| 65 | 62 | * time. | |
| 66 | 63 | */ | |
| 67 | - | if (change != KVM_MR_MOVE && change != KVM_MR_CREATE) { | |
| 68 | - | WARN(1, "Unknown KVM MR CHANGE: %d\n", change); | |
| 69 | - | return -EINVAL; | |
| 70 | - | } | |
| 71 | 64 | if (new->userspace_addr & ~PAGE_MASK) | |
| 72 | 65 | return -EINVAL; | |
| 73 | 66 | if ((new->base_gfn + new->npages) * PAGE_SIZE > kvm->arch.mem_limit) | |
| @@ -76,41 +69,65 @@ int s390_kvm_mmu_prepare_memory_region(struct kvm *kvm, | |||
| 76 | 69 | return -EINVAL; | |
| 77 | 70 | } | |
| 78 | 71 | ||
| 79 | - | if (kvm->arch.migration_mode) { | |
| 80 | - | /* | |
| 81 | - | * Turn off migration mode when: | |
| 82 | - | * - userspace creates a new memslot with dirty logging off, | |
| 83 | - | * - userspace modifies an existing memslot (MOVE or FLAGS_ONLY) | |
| 84 | - | * and dirty logging is turned off. | |
| 85 | - | * Migration mode expects dirty page logging being enabled to | |
| 86 | - | * store its dirty bitmap. | |
| 87 | - | */ | |
| 88 | - | if (change != KVM_MR_DELETE && | |
| 89 | - | !(new->flags & KVM_MEM_LOG_DIRTY_PAGES)) | |
| 90 | - | WARN(kvm_s390_vm_stop_migration(kvm), | |
| 91 | - | "Failed to stop migration mode"); | |
| 92 | - | } | |
| 72 | + | if (!kvm_s390_is_migration_mode(kvm)) | |
| 73 | + | return 0; | |
| 74 | + | ||
| 75 | + | /* | |
| 76 | + | * Turn off migration mode when: | |
| 77 | + | * - userspace creates a new memslot with dirty logging off, | |
| 78 | + | * - userspace modifies an existing memslot (MOVE or FLAGS_ONLY) and | |
| 79 | + | * dirty logging is turned off. | |
| 80 | + | * Migration mode expects dirty page logging being enabled to store | |
| 81 | + | * its dirty bitmap. | |
| 82 | + | */ | |
| 83 | + | if (change != KVM_MR_DELETE && | |
| 84 | + | !(new->flags & KVM_MEM_LOG_DIRTY_PAGES)) | |
| 85 | + | WARN(kvm_s390_vm_stop_migration(kvm), | |
| 86 | + | "Failed to stop migration mode"); | |
| 87 | + | ||
| 88 | + | return 0; | |
| 89 | + | } | |
| 90 | + | ||
| 91 | + | void s390_kvm_mmu_commit_memory_region(struct kvm *kvm, | |
| 92 | + | struct kvm_memory_slot *old, | |
| 93 | + | const struct kvm_memory_slot *new, | |
| 94 | + | enum kvm_mr_change change) | |
| 95 | + | { | |
| 96 | + | struct kvm_s390_mmu_cache *mc __free(kvm_s390_mmu_cache) = NULL; | |
| 97 | + | int rc = 0; | |
| 98 | + | ||
| 99 | + | guard(mutex)(&kvm->slots_arch_lock); | |
| 93 | 100 | ||
| 94 | 101 | if (change == KVM_MR_FLAGS_ONLY) | |
| 95 | - | return 0; | |
| 96 | - | if (change != KVM_MR_DELETE) { | |
| 97 | - | /* Enough capacity to add a new memslot */ | |
| 98 | - | mc = kvm_s390_new_mmu_cache(); | |
| 99 | - | if (!mc) | |
| 100 | - | return -ENOMEM; | |
| 102 | + | return; | |
| 103 | + | ||
| 104 | + | mc = kvm_s390_new_mmu_cache(); | |
| 105 | + | if (!mc) { | |
| 106 | + | rc = -ENOMEM; | |
| 107 | + | goto out; | |
| 101 | 108 | } | |
| 109 | + | ||
| 102 | 110 | scoped_guard(write_lock, &kvm->mmu_lock) { | |
| 103 | 111 | kvm_s390_update_cmma_dirty(kvm, old); | |
| 104 | - | if (change == KVM_MR_DELETE || change == KVM_MR_MOVE) | |
| 105 | - | rc = dat_delete_slot(kvm->arch.gmap->asce, old->base_gfn, old->npages); | |
| 106 | - | if (!rc && (change == KVM_MR_MOVE || change == KVM_MR_CREATE)) | |
| 112 | + | switch (change) { | |
| 113 | + | case KVM_MR_DELETE: | |
| 114 | + | rc = dat_delete_slot(mc, kvm->arch.gmap->asce, old->base_gfn, old->npages); | |
| 115 | + | break; | |
| 116 | + | case KVM_MR_MOVE: | |
| 117 | + | rc = dat_delete_slot(mc, kvm->arch.gmap->asce, old->base_gfn, old->npages); | |
| 118 | + | if (rc) | |
| 119 | + | break; | |
| 120 | + | fallthrough; | |
| 121 | + | case KVM_MR_CREATE: | |
| 107 | 122 | rc = dat_create_slot(mc, kvm->arch.gmap->asce, new->base_gfn, new->npages); | |
| 123 | + | break; | |
| 124 | + | case KVM_MR_FLAGS_ONLY: | |
| 125 | + | break; | |
| 126 | + | default: | |
| 127 | + | WARN(1, "Unknown KVM MR CHANGE: %d\n", change); | |
| 128 | + | } | |
| 108 | 129 | } | |
| 109 | - | /* | |
| 110 | - | * Can only be triggered if dat_{create,delete}_slot() found an | |
| 111 | - | * internal inconsistency or if the mmu cache ran out of memory; | |
| 112 | - | * both should be impossible. | |
| 113 | - | */ | |
| 114 | - | KVM_BUG_ON(rc, kvm); | |
| 115 | - | return rc; | |
| 130 | + | out: | |
| 131 | + | if (rc) | |
| 132 | + | pr_warn("failed to commit memory region\n"); | |
| 116 | 133 | } | |
modified arch/s390/kvm/gmap/kvm_mmu.h
| @@ -10,5 +10,9 @@ int s390_kvm_mmu_prepare_memory_region(struct kvm *kvm, | |||
| 10 | 10 | const struct kvm_memory_slot *old, | |
| 11 | 11 | struct kvm_memory_slot *new, | |
| 12 | 12 | enum kvm_mr_change change); | |
| 13 | + | void s390_kvm_mmu_commit_memory_region(struct kvm *kvm, | |
| 14 | + | struct kvm_memory_slot *old, | |
| 15 | + | const struct kvm_memory_slot *new, | |
| 16 | + | enum kvm_mr_change change); | |
| 13 | 17 | ||
| 14 | 18 | #endif /* ARCH_KVM_GMAP_KVM_MMU_H */ | |
modified arch/s390/kvm/s390/gaccess.c
| @@ -1589,25 +1589,12 @@ static inline int ___gaccess_shadow_fault(struct kvm_vcpu *vcpu, struct gmap *sg | |||
| 1589 | 1589 | parent = READ_ONCE(sg->parent); | |
| 1590 | 1590 | if (!parent) | |
| 1591 | 1591 | return -EAGAIN; | |
| 1592 | - | retry: | |
| 1593 | 1592 | scoped_guard(spinlock, &parent->children_lock) { | |
| 1594 | 1593 | if (READ_ONCE(sg->parent) != parent) | |
| 1595 | 1594 | return -EAGAIN; | |
| 1596 | 1595 | sg->invalidated = false; | |
| 1597 | 1596 | rc = _gaccess_do_shadow(vcpu->arch.mc, sg, saddr, walk); | |
| 1598 | 1597 | } | |
| 1599 | - | if (rc == -ENOENT) { | |
| 1600 | - | struct kvm_memory_slot *slot; | |
| 1601 | - | struct guest_fault *entries; | |
| 1602 | - | ||
| 1603 | - | entries = get_entries(walk); | |
| 1604 | - | slot = kvm_vcpu_gfn_to_memslot(vcpu, entries[LEVEL_MEM].gfn); | |
| 1605 | - | if (!slot) | |
| 1606 | - | return PGM_ADDRESSING; | |
| 1607 | - | rc = gmap_link(vcpu->arch.mc, parent, entries + LEVEL_MEM, slot); | |
| 1608 | - | if (!rc) | |
| 1609 | - | goto retry; | |
| 1610 | - | } | |
| 1611 | 1598 | if (!rc) | |
| 1612 | 1599 | kvm_s390_release_faultin_array(vcpu->kvm, walk->raw_entries, false); | |
| 1613 | 1600 | return rc; | |
modified arch/s390/kvm/s390/interrupt.c
| @@ -2984,58 +2984,61 @@ static int adapter_indicators_set(struct kvm *kvm, | |||
| 2984 | 2984 | struct s390_io_adapter *adapter, | |
| 2985 | 2985 | struct kvm_s390_adapter_int *adapter_int) | |
| 2986 | 2986 | { | |
| 2987 | - | struct s390_map_info *ind_info, *summary_info; | |
| 2988 | - | struct page *ind_page, *summary_page; | |
| 2989 | 2987 | unsigned long bit; | |
| 2990 | - | int summary_set; | |
| 2988 | + | int summary_set, idx; | |
| 2989 | + | struct s390_map_info *ind_info, *summary_info; | |
| 2991 | 2990 | void *map; | |
| 2991 | + | struct page *ind_page, *summary_page; | |
| 2992 | + | unsigned long flags; | |
| 2992 | 2993 | ||
| 2993 | 2994 | ind_page = NULL; | |
| 2994 | 2995 | ||
| 2995 | - | scoped_guard(spinlock_irqsave, &adapter->maps_lock) { | |
| 2996 | - | ind_info = get_map_info(adapter, adapter_int->ind_addr); | |
| 2997 | - | if (ind_info) { | |
| 2998 | - | map = page_address(ind_info->page); | |
| 2999 | - | bit = get_ind_bit(ind_info->addr, adapter_int->ind_offset, adapter->swap); | |
| 3000 | - | set_bit(bit, map); | |
| 3001 | - | } | |
| 3002 | - | } | |
| 2996 | + | spin_lock_irqsave(&adapter->maps_lock, flags); | |
| 2997 | + | ind_info = get_map_info(adapter, adapter_int->ind_addr); | |
| 3003 | 2998 | if (!ind_info) { | |
| 2999 | + | spin_unlock_irqrestore(&adapter->maps_lock, flags); | |
| 3004 | 3000 | ind_page = pin_map_page(kvm, adapter_int->ind_addr, 0); | |
| 3005 | 3001 | if (!ind_page) | |
| 3006 | 3002 | return -1; | |
| 3003 | + | idx = srcu_read_lock(&kvm->srcu); | |
| 3007 | 3004 | map = page_address(ind_page); | |
| 3008 | 3005 | bit = get_ind_bit(adapter_int->ind_addr, | |
| 3009 | 3006 | adapter_int->ind_offset, adapter->swap); | |
| 3010 | 3007 | set_bit(bit, map); | |
| 3008 | + | mark_page_dirty(kvm, adapter_int->ind_gaddr >> PAGE_SHIFT); | |
| 3011 | 3009 | set_page_dirty_lock(ind_page); | |
| 3010 | + | srcu_read_unlock(&kvm->srcu, idx); | |
| 3012 | 3011 | unpin_user_page(ind_page); | |
| 3012 | + | } else { | |
| 3013 | + | map = page_address(ind_info->page); | |
| 3014 | + | bit = get_ind_bit(ind_info->addr, adapter_int->ind_offset, adapter->swap); | |
| 3015 | + | set_bit(bit, map); | |
| 3016 | + | spin_unlock_irqrestore(&adapter->maps_lock, flags); | |
| 3013 | 3017 | } | |
| 3014 | - | scoped_guard(srcu, &kvm->srcu) | |
| 3015 | - | mark_page_dirty(kvm, gpa_to_gfn(adapter_int->ind_gaddr)); | |
| 3016 | 3018 | ||
| 3017 | - | scoped_guard(spinlock_irqsave, &adapter->maps_lock) { | |
| 3018 | - | summary_info = get_map_info(adapter, adapter_int->summary_addr); | |
| 3019 | - | if (summary_info) { | |
| 3020 | - | map = page_address(summary_info->page); | |
| 3021 | - | bit = get_ind_bit(summary_info->addr, adapter_int->summary_offset, | |
| 3022 | - | adapter->swap); | |
| 3023 | - | summary_set = test_and_set_bit(bit, map); | |
| 3024 | - | } | |
| 3025 | - | } | |
| 3019 | + | spin_lock_irqsave(&adapter->maps_lock, flags); | |
| 3020 | + | summary_info = get_map_info(adapter, adapter_int->summary_addr); | |
| 3026 | 3021 | if (!summary_info) { | |
| 3022 | + | spin_unlock_irqrestore(&adapter->maps_lock, flags); | |
| 3027 | 3023 | summary_page = pin_map_page(kvm, adapter_int->summary_addr, 0); | |
| 3028 | 3024 | if (!summary_page) | |
| 3029 | 3025 | return -1; | |
| 3026 | + | idx = srcu_read_lock(&kvm->srcu); | |
| 3030 | 3027 | map = page_address(summary_page); | |
| 3031 | 3028 | bit = get_ind_bit(adapter_int->summary_addr, | |
| 3032 | 3029 | adapter_int->summary_offset, adapter->swap); | |
| 3033 | 3030 | summary_set = test_and_set_bit(bit, map); | |
| 3031 | + | mark_page_dirty(kvm, adapter_int->summary_gaddr >> PAGE_SHIFT); | |
| 3034 | 3032 | set_page_dirty_lock(summary_page); | |
| 3033 | + | srcu_read_unlock(&kvm->srcu, idx); | |
| 3035 | 3034 | unpin_user_page(summary_page); | |
| 3035 | + | } else { | |
| 3036 | + | map = page_address(summary_info->page); | |
| 3037 | + | bit = get_ind_bit(summary_info->addr, adapter_int->summary_offset, | |
| 3038 | + | adapter->swap); | |
| 3039 | + | summary_set = test_and_set_bit(bit, map); | |
| 3040 | + | spin_unlock_irqrestore(&adapter->maps_lock, flags); | |
| 3036 | 3041 | } | |
| 3037 | - | scoped_guard(srcu, &kvm->srcu) | |
| 3038 | - | mark_page_dirty(kvm, gpa_to_gfn(adapter_int->summary_gaddr)); | |
| 3039 | 3042 | ||
| 3040 | 3043 | return summary_set ? 0 : 1; | |
| 3041 | 3044 | } | |
| @@ -3045,29 +3048,26 @@ static int adapter_indicators_set_fast(struct kvm *kvm, | |||
| 3045 | 3048 | struct kvm_s390_adapter_int *adapter_int, | |
| 3046 | 3049 | int setbit) | |
| 3047 | 3050 | { | |
| 3048 | - | struct s390_map_info *ind_info, *summary_info; | |
| 3049 | 3051 | unsigned long bit; | |
| 3050 | 3052 | int summary_set; | |
| 3053 | + | struct s390_map_info *ind_info, *summary_info; | |
| 3051 | 3054 | void *map; | |
| 3052 | 3055 | ||
| 3053 | - | guard(srcu)(&kvm->srcu); | |
| 3054 | - | guard(spinlock)(&adapter->maps_lock); | |
| 3055 | - | ||
| 3056 | + | spin_lock(&adapter->maps_lock); | |
| 3056 | 3057 | ind_info = get_map_info(adapter, adapter_int->ind_addr); | |
| 3057 | - | if (!ind_info) | |
| 3058 | + | if (!ind_info) { | |
| 3059 | + | spin_unlock(&adapter->maps_lock); | |
| 3058 | 3060 | return -EWOULDBLOCK; | |
| 3059 | - | ||
| 3061 | + | } | |
| 3060 | 3062 | map = page_address(ind_info->page); | |
| 3061 | 3063 | bit = get_ind_bit(ind_info->addr, adapter_int->ind_offset, adapter->swap); | |
| 3062 | - | if (setbit) { | |
| 3064 | + | if (setbit) | |
| 3063 | 3065 | set_bit(bit, map); | |
| 3064 | - | mark_page_dirty(kvm, gpa_to_gfn(adapter_int->ind_gaddr)); | |
| 3065 | - | } | |
| 3066 | - | ||
| 3067 | 3066 | summary_info = get_map_info(adapter, adapter_int->summary_addr); | |
| 3068 | - | if (!summary_info) | |
| 3067 | + | if (!summary_info) { | |
| 3068 | + | spin_unlock(&adapter->maps_lock); | |
| 3069 | 3069 | return -EWOULDBLOCK; | |
| 3070 | - | ||
| 3070 | + | } | |
| 3071 | 3071 | map = page_address(summary_info->page); | |
| 3072 | 3072 | bit = get_ind_bit(summary_info->addr, adapter_int->summary_offset, | |
| 3073 | 3073 | adapter->swap); | |
| @@ -3077,8 +3077,7 @@ static int adapter_indicators_set_fast(struct kvm *kvm, | |||
| 3077 | 3077 | summary_set = test_and_set_bit(bit, map); | |
| 3078 | 3078 | else | |
| 3079 | 3079 | summary_set = test_and_clear_bit(bit, map); | |
| 3080 | - | mark_page_dirty(kvm, gpa_to_gfn(adapter_int->summary_gaddr)); | |
| 3081 | - | ||
| 3080 | + | spin_unlock(&adapter->maps_lock); | |
| 3082 | 3081 | return summary_set ? 0 : 1; | |
| 3083 | 3082 | } | |
| 3084 | 3083 | ||
| @@ -3229,9 +3228,9 @@ int kvm_s390_set_irq_state(struct kvm_vcpu *vcpu, void __user *irqstate, int len | |||
| 3229 | 3228 | break; | |
| 3230 | 3229 | } | |
| 3231 | 3230 | } | |
| 3231 | + | ||
| 3232 | 3232 | if (storestatus) { | |
| 3233 | - | scoped_guard(srcu, &vcpu->kvm->srcu) | |
| 3234 | - | n = kvm_s390_store_status_unloaded(vcpu, KVM_S390_STORE_STATUS_NOADDR); | |
| 3233 | + | n = kvm_s390_store_status_unloaded(vcpu, KVM_S390_STORE_STATUS_NOADDR); | |
| 3235 | 3234 | return r ? r : n; | |
| 3236 | 3235 | } | |
| 3237 | 3236 | ||
modified arch/s390/kvm/s390/s390.c
| @@ -5766,7 +5766,7 @@ static long cmma_d_count_pte(union pte *ptep, gfn_t gfn, gfn_t next, struct dat_ | |||
| 5766 | 5766 | return 0; | |
| 5767 | 5767 | } | |
| 5768 | 5768 | ||
| 5769 | - | void kvm_s390_update_cmma_dirty(struct kvm *kvm, const struct kvm_memory_slot *old) | |
| 5769 | + | void kvm_s390_update_cmma_dirty(struct kvm *kvm, struct kvm_memory_slot *old) | |
| 5770 | 5770 | { | |
| 5771 | 5771 | const struct dat_walk_ops ops = { .pte_entry = cmma_d_count_pte, }; | |
| 5772 | 5772 | ||
| @@ -5781,6 +5781,7 @@ void kvm_arch_commit_memory_region(struct kvm *kvm, struct kvm_memory_slot *old, | |||
| 5781 | 5781 | const struct kvm_memory_slot *new, | |
| 5782 | 5782 | enum kvm_mr_change change) | |
| 5783 | 5783 | { | |
| 5784 | + | s390_kvm_mmu_commit_memory_region(kvm, old, new, change); | |
| 5784 | 5785 | } | |
| 5785 | 5786 | ||
| 5786 | 5787 | /** | |
modified arch/s390/kvm/s390/s390.h
| @@ -472,7 +472,7 @@ int __kvm_s390_mprotect_many(struct gmap *gmap, gpa_t gpa, u8 npages, unsigned i | |||
| 472 | 472 | unsigned long bits); | |
| 473 | 473 | ||
| 474 | 474 | bool kvm_arch_setup_async_pf(struct kvm_vcpu *vcpu); | |
| 475 | - | void kvm_s390_update_cmma_dirty(struct kvm *kvm, const struct kvm_memory_slot *old); | |
| 475 | + | void kvm_s390_update_cmma_dirty(struct kvm *kvm, struct kvm_memory_slot *old); | |
| 476 | 476 | int kvm_s390_vm_stop_migration(struct kvm *kvm); | |
| 477 | 477 | ||
| 478 | 478 | ||
modified arch/s390/pci/pci_event.c
| @@ -226,7 +226,6 @@ static pci_ers_result_t zpci_event_attempt_error_recovery(struct pci_dev *pdev, | |||
| 226 | 226 | device_lock(&pdev->dev); | |
| 227 | 227 | if (pdev->error_state == pci_channel_io_perm_failure) { | |
| 228 | 228 | ers_res = PCI_ERS_RESULT_DISCONNECT; | |
| 229 | - | status_str = "skipped (permanent failure)"; | |
| 230 | 229 | goto out_unlock; | |
| 231 | 230 | } | |
| 232 | 231 | pdev->error_state = pci_channel_io_frozen; | |
| @@ -298,8 +297,8 @@ static pci_ers_result_t zpci_event_attempt_error_recovery(struct pci_dev *pdev, | |||
| 298 | 297 | driver->err_handler->resume(pdev); | |
| 299 | 298 | pci_uevent_ers(pdev, PCI_ERS_RESULT_RECOVERED); | |
| 300 | 299 | out_unlock: | |
| 301 | - | zpci_report_status(zdev, pdev, "recovery", status_str); | |
| 302 | 300 | device_unlock(&pdev->dev); | |
| 301 | + | zpci_report_status(zdev, "recovery", status_str); | |
| 303 | 302 | ||
| 304 | 303 | return ers_res; | |
| 305 | 304 | } | |
| @@ -362,10 +361,8 @@ static void __zpci_event_error(struct zpci_ccdf_err *ccdf) | |||
| 362 | 361 | ||
| 363 | 362 | __zpci_event_print_error(pdev, ccdf); | |
| 364 | 363 | ||
| 365 | - | if (!pdev) { | |
| 366 | - | zpci_report_status(zdev, NULL, "error event", "no pdev bound"); | |
| 364 | + | if (!pdev) | |
| 367 | 365 | goto no_pdev; | |
| 368 | - | } | |
| 369 | 366 | ||
| 370 | 367 | switch (ccdf->pec) { | |
| 371 | 368 | case 0x002a: /* Error event concerns FMB */ | |
modified arch/s390/pci/pci_report.c
| @@ -87,23 +87,9 @@ static struct debug_view debug_log_view = { | |||
| 87 | 87 | NULL | |
| 88 | 88 | }; | |
| 89 | 89 | ||
| 90 | - | static ssize_t zpci_report_pdev(struct pci_dev *pdev, char *buf, size_t size) | |
| 91 | - | { | |
| 92 | - | struct pci_driver *driver; | |
| 93 | - | const char *start = buf; | |
| 94 | - | char *end = buf + size; | |
| 95 | - | ||
| 96 | - | device_lock_assert(&pdev->dev); | |
| 97 | - | buf += scnprintf(buf, end - buf, "state: %s\n", zpci_state_str(pdev->error_state)); | |
| 98 | - | driver = to_pci_driver(pdev->dev.driver); | |
| 99 | - | buf += scnprintf(buf, end - buf, "driver: %s\n", (driver) ? driver->name : "n/a"); | |
| 100 | - | return buf - start; | |
| 101 | - | } | |
| 102 | - | ||
| 103 | 90 | /** | |
| 104 | 91 | * zpci_report_status - Report the status of operations on a PCI device | |
| 105 | - | * @zdev: The zPCI device for which to report status | |
| 106 | - | * @pdev: The PCI device associated with the zdev if any, NULL otherwise | |
| 92 | + | * @zdev: The PCI device for which to report status | |
| 107 | 93 | * @operation: A string representing the operation reported | |
| 108 | 94 | * @status: A string representing the status of the operation | |
| 109 | 95 | * | |
| @@ -117,14 +103,15 @@ static ssize_t zpci_report_pdev(struct pci_dev *pdev, char *buf, size_t size) | |||
| 117 | 103 | * | |
| 118 | 104 | * Return: 0 on success an error code < 0 otherwise. | |
| 119 | 105 | */ | |
| 120 | - | int zpci_report_status(struct zpci_dev *zdev, struct pci_dev *pdev, | |
| 121 | - | const char *operation, const char *status) | |
| 106 | + | int zpci_report_status(struct zpci_dev *zdev, const char *operation, const char *status) | |
| 122 | 107 | { | |
| 123 | 108 | struct zpci_report_error *report; | |
| 109 | + | struct pci_driver *driver = NULL; | |
| 110 | + | struct pci_dev *pdev = NULL; | |
| 124 | 111 | char *buf, *end; | |
| 125 | 112 | int ret; | |
| 126 | 113 | ||
| 127 | - | if (!zdev) | |
| 114 | + | if (!zdev || !zdev->zbus) | |
| 128 | 115 | return -ENODEV; | |
| 129 | 116 | ||
| 130 | 117 | /* Protected virtualization hosts get nothing from us */ | |
| @@ -134,13 +121,18 @@ int zpci_report_status(struct zpci_dev *zdev, struct pci_dev *pdev, | |||
| 134 | 121 | report = (void *)get_zeroed_page(GFP_KERNEL); | |
| 135 | 122 | if (!report) | |
| 136 | 123 | return -ENOMEM; | |
| 124 | + | if (zdev->zbus->bus) | |
| 125 | + | pdev = pci_get_slot(zdev->zbus->bus, zdev->devfn); | |
| 126 | + | if (pdev) | |
| 127 | + | driver = to_pci_driver(pdev->dev.driver); | |
| 137 | 128 | ||
| 138 | 129 | buf = report->data.log_data; | |
| 139 | 130 | end = report->data.log_data + ZPCI_REPORT_DATA_SIZE; | |
| 140 | 131 | buf += scnprintf(buf, end - buf, "report: %s\n", operation); | |
| 141 | 132 | buf += scnprintf(buf, end - buf, "status: %s\n", status); | |
| 142 | - | if (pdev) | |
| 143 | - | buf += zpci_report_pdev(pdev, buf, end - buf); | |
| 133 | + | buf += scnprintf(buf, end - buf, "state: %s\n", | |
| 134 | + | (pdev) ? zpci_state_str(pdev->error_state) : "n/a"); | |
| 135 | + | buf += scnprintf(buf, end - buf, "driver: %s\n", (driver) ? driver->name : "n/a"); | |
| 144 | 136 | ret = debug_dump(pci_debug_msg_id, &debug_log_view, buf, end - buf, true); | |
| 145 | 137 | if (ret < 0) | |
| 146 | 138 | pr_err("Reading PCI debug messages failed with code %d\n", ret); | |
modified arch/s390/pci/pci_report.h
| @@ -8,11 +8,9 @@ | |||
| 8 | 8 | */ | |
| 9 | 9 | #ifndef __S390_PCI_REPORT_H | |
| 10 | 10 | #define __S390_PCI_REPORT_H | |
| 11 | - | #include <linux/pci.h> | |
| 12 | 11 | ||
| 13 | 12 | struct zpci_dev; | |
| 14 | 13 | ||
| 15 | - | int zpci_report_status(struct zpci_dev *zdev, struct pci_dev *pdev, | |
| 16 | - | const char *operation, const char *status); | |
| 14 | + | int zpci_report_status(struct zpci_dev *zdev, const char *operation, const char *status); | |
| 17 | 15 | ||
| 18 | 16 | #endif /* __S390_PCI_REPORT_H */ | |
modified arch/x86/Kconfig.cpu
| @@ -204,21 +204,10 @@ config CC_HAS_MARCH_NATIVE | |||
| 204 | 204 | # usage warnings that only appear wth '-march=native'. | |
| 205 | 205 | depends on CC_IS_GCC || CLANG_VERSION >= 190100 | |
| 206 | 206 | ||
| 207 | - | config RUSTC_HAS_APXF | |
| 208 | - | # The kernel isn't ready for in-kernel APX instructions. Without | |
| 209 | - | # explicit frontend gating of APX, the backend may emit those | |
| 210 | - | # instructions in native builds. | |
| 211 | - | # | |
| 212 | - | # Rust 1.88 added the `apxf` feature option, but versions before 1.93 | |
| 213 | - | # emit an `apxf` target attribute that only LLVM 23+ can interpret. | |
| 214 | - | def_bool (RUSTC_VERSION >= 108800 && RUSTC_LLVM_MAJOR_VERSION >= 23) || \ | |
| 215 | - | RUSTC_VERSION >= 109300 | |
| 216 | - | ||
| 217 | 207 | config X86_NATIVE_CPU | |
| 218 | 208 | bool "Build and optimize for local/native CPU" | |
| 219 | 209 | depends on X86_64 | |
| 220 | 210 | depends on CC_HAS_MARCH_NATIVE | |
| 221 | - | depends on !RUST || RUSTC_HAS_APXF | |
| 222 | 211 | help | |
| 223 | 212 | Optimize for the current CPU used to compile the kernel. | |
| 224 | 213 | Use this option if you intend to build the kernel for your | |
modified arch/x86/Makefile
| @@ -161,11 +161,6 @@ else | |||
| 161 | 161 | ||
| 162 | 162 | ifdef CONFIG_X86_NATIVE_CPU | |
| 163 | 163 | KBUILD_CFLAGS += -march=native | |
| 164 | - | # Prevent the compiler from generating EGPR use. The kernel is | |
| 165 | - | # not yet prepared for general in-kernel use. | |
| 166 | - | KBUILD_CFLAGS += $(call cc-option,-mno-apx-features=egpr) | |
| 167 | - | ||
| 168 | - | # generate_rust_target.rs handles Rust APX gating. | |
| 169 | 164 | KBUILD_RUSTFLAGS += -Ctarget-cpu=native | |
| 170 | 165 | else | |
| 171 | 166 | KBUILD_CFLAGS += -march=x86-64 -mtune=generic | |
modified arch/x86/coco/sev/svsm.c
| @@ -74,14 +74,6 @@ int svsm_perform_call_protocol(struct svsm_call *call) | |||
| 74 | 74 | ||
| 75 | 75 | flags = native_local_irq_save(); | |
| 76 | 76 | ||
| 77 | - | /* | |
| 78 | - | * 'caa' is a per-CPU variable. To avoid using a stale or incorrect | |
| 79 | - | * 'caa' if the task is preempted or migrated to another CPU after it | |
| 80 | - | * is fetched, always fetch 'caa' and then issue the SVSM call with | |
| 81 | - | * interrupts disabled. This ensures the correct 'caa' is used. | |
| 82 | - | */ | |
| 83 | - | call->caa = svsm_get_caa(); | |
| 84 | - | ||
| 85 | 77 | ghcb = __sev_get_ghcb(&state); | |
| 86 | 78 | ||
| 87 | 79 | do { | |
| @@ -329,6 +321,7 @@ int snp_svsm_vtpm_send_command(u8 *buffer) | |||
| 329 | 321 | { | |
| 330 | 322 | struct svsm_call call = {}; | |
| 331 | 323 | ||
| 324 | + | call.caa = svsm_get_caa(); | |
| 332 | 325 | call.rax = SVSM_VTPM_CALL(SVSM_VTPM_CMD); | |
| 333 | 326 | call.rcx = __pa(buffer); | |
| 334 | 327 | ||
| @@ -352,6 +345,7 @@ bool snp_svsm_vtpm_probe(void) | |||
| 352 | 345 | if (!snp_vmpl) | |
| 353 | 346 | return false; | |
| 354 | 347 | ||
| 348 | + | call.caa = svsm_get_caa(); | |
| 355 | 349 | call.rax = SVSM_VTPM_CALL(SVSM_VTPM_QUERY); | |
| 356 | 350 | ||
| 357 | 351 | if (svsm_perform_call_protocol(&call)) | |
modified arch/x86/entry/entry_fred.c
| @@ -10,7 +10,6 @@ | |||
| 10 | 10 | #include <asm/desc.h> | |
| 11 | 11 | #include <asm/fred.h> | |
| 12 | 12 | #include <asm/idtentry.h> | |
| 13 | - | #include <asm/processor-flags.h> | |
| 14 | 13 | #include <asm/syscall.h> | |
| 15 | 14 | #include <asm/trapnr.h> | |
| 16 | 15 | #include <asm/traps.h> | |
| @@ -72,15 +71,7 @@ static noinstr void fred_intx(struct pt_regs *regs) | |||
| 72 | 71 | #endif | |
| 73 | 72 | ||
| 74 | 73 | default: | |
| 75 | - | /* | |
| 76 | - | * Reconstruct the #GP fault state that IDT delivery would produce. | |
| 77 | - | * Clear the software event flag so ERETU with TF set does not trap | |
| 78 | - | * before the resumed instruction. See prevent_single_step_upon_eretu(). | |
| 79 | - | */ | |
| 80 | - | regs->ip -= regs->fred_ss.insnlen; | |
| 81 | - | regs->flags |= X86_EFLAGS_RF; | |
| 82 | - | regs->fred_ss.swevent = 0; | |
| 83 | - | return exc_general_protection(regs, (regs->fred_ss.vector << 3) | 2); | |
| 74 | + | return exc_general_protection(regs, 0); | |
| 84 | 75 | } | |
| 85 | 76 | } | |
| 86 | 77 | ||
modified arch/x86/events/amd/brs.c
| @@ -343,10 +343,11 @@ void amd_brs_drain(void) | |||
| 343 | 343 | if (!amd_brs_match_plm(event, from, to)) | |
| 344 | 344 | continue; | |
| 345 | 345 | ||
| 346 | - | br[nr] = (struct perf_branch_entry){ | |
| 347 | - | .from = from, | |
| 348 | - | .to = to, | |
| 349 | - | }; | |
| 346 | + | perf_clear_branch_entry_bitfields(br+nr); | |
| 347 | + | ||
| 348 | + | br[nr].from = from; | |
| 349 | + | br[nr].to = to; | |
| 350 | + | ||
| 350 | 351 | nr++; | |
| 351 | 352 | } | |
| 352 | 353 | empty: | |
modified arch/x86/events/amd/lbr.c
| @@ -184,6 +184,13 @@ void amd_pmu_lbr_read(void) | |||
| 184 | 184 | entry.to.split.reserved) | |
| 185 | 185 | continue; | |
| 186 | 186 | ||
| 187 | + | perf_clear_branch_entry_bitfields(br + out); | |
| 188 | + | ||
| 189 | + | br[out].from = sign_ext_branch_ip(entry.from.split.ip); | |
| 190 | + | br[out].to = sign_ext_branch_ip(entry.to.split.ip); | |
| 191 | + | br[out].mispred = entry.from.split.mispredict; | |
| 192 | + | br[out].predicted = !br[out].mispred; | |
| 193 | + | ||
| 187 | 194 | /* | |
| 188 | 195 | * Set branch speculation information using the status of | |
| 189 | 196 | * the valid and spec bits. | |
| @@ -201,14 +208,7 @@ void amd_pmu_lbr_read(void) | |||
| 201 | 208 | * speculative and took the correct path | |
| 202 | 209 | */ | |
| 203 | 210 | idx = (entry.to.split.valid << 1) | entry.to.split.spec; | |
| 204 | - | ||
| 205 | - | br[out] = (struct perf_branch_entry){ | |
| 206 | - | .from = sign_ext_branch_ip(entry.from.split.ip), | |
| 207 | - | .to = sign_ext_branch_ip(entry.to.split.ip), | |
| 208 | - | .mispred = entry.from.split.mispredict, | |
| 209 | - | .predicted = !entry.from.split.mispredict, | |
| 210 | - | .spec = lbr_spec_map[idx], | |
| 211 | - | }; | |
| 211 | + | br[out].spec = lbr_spec_map[idx]; | |
| 212 | 212 | out++; | |
| 213 | 213 | } | |
| 214 | 214 | ||
modified arch/x86/events/intel/core.c
| @@ -506,8 +506,6 @@ static struct event_constraint intel_pnc_event_constraints[] = { | |||
| 506 | 506 | INTEL_EVENT_CONSTRAINT(0xce, 0x1), | |
| 507 | 507 | ||
| 508 | 508 | INTEL_UEVENT_CONSTRAINT(0x01b1, 0x8), | |
| 509 | - | INTEL_UEVENT_CONSTRAINT(0x01b2, 0xf), | |
| 510 | - | INTEL_UEVENT_CONSTRAINT(0x02b2, 0xf), | |
| 511 | 509 | INTEL_UEVENT_CONSTRAINT(0x0847, 0xf), | |
| 512 | 510 | INTEL_UEVENT_CONSTRAINT(0x0446, 0xf), | |
| 513 | 511 | INTEL_UEVENT_CONSTRAINT(0x0846, 0xf), | |
| @@ -522,14 +520,6 @@ static struct extra_reg intel_pnc_extra_regs[] __read_mostly = { | |||
| 522 | 520 | INTEL_UEVENT_EXTRA_REG(0x022a, MSR_OMR_1, 0x40ffffff0000ffffull, OMR_1), | |
| 523 | 521 | INTEL_UEVENT_EXTRA_REG(0x042a, MSR_OMR_2, 0x40ffffff0000ffffull, OMR_2), | |
| 524 | 522 | INTEL_UEVENT_EXTRA_REG(0x082a, MSR_OMR_3, 0x40ffffff0000ffffull, OMR_3), | |
| 525 | - | INTEL_UEVENT_EXTRA_REG(0x014f, MSR_OMR_0, 0x40ffffff0000ffffull, OMR_0), | |
| 526 | - | INTEL_UEVENT_EXTRA_REG(0x024f, MSR_OMR_1, 0x40ffffff0000ffffull, OMR_1), | |
| 527 | - | INTEL_UEVENT_EXTRA_REG(0x044f, MSR_OMR_2, 0x40ffffff0000ffffull, OMR_2), | |
| 528 | - | INTEL_UEVENT_EXTRA_REG(0x084f, MSR_OMR_3, 0x40ffffff0000ffffull, OMR_3), | |
| 529 | - | INTEL_UEVENT_EXTRA_REG(0x01d6, MSR_OMR_0, 0x40ffffff0000ffffull, OMR_0), | |
| 530 | - | INTEL_UEVENT_EXTRA_REG(0x02d6, MSR_OMR_1, 0x40ffffff0000ffffull, OMR_1), | |
| 531 | - | INTEL_UEVENT_EXTRA_REG(0x04d6, MSR_OMR_2, 0x40ffffff0000ffffull, OMR_2), | |
| 532 | - | INTEL_UEVENT_EXTRA_REG(0x08d6, MSR_OMR_3, 0x40ffffff0000ffffull, OMR_3), | |
| 533 | 523 | INTEL_UEVENT_PEBS_LDLAT_EXTRA_REG(0x01cd), | |
| 534 | 524 | INTEL_UEVENT_EXTRA_REG(0x02c6, MSR_PEBS_FRONTEND, 0x9, FE), | |
| 535 | 525 | INTEL_UEVENT_EXTRA_REG(0x03c6, MSR_PEBS_FRONTEND, 0x7fff1f, FE), | |
| @@ -5302,15 +5292,12 @@ static struct perf_guest_switch_msr *intel_guest_get_msrs(int *nr, void *data) | |||
| 5302 | 5292 | struct kvm_pmu *kvm_pmu = (struct kvm_pmu *)data; | |
| 5303 | 5293 | u64 intel_ctrl = hybrid(cpuc->pmu, intel_ctrl); | |
| 5304 | 5294 | u64 pebs_mask = cpuc->pebs_enabled & x86_pmu.pebs_capable; | |
| 5305 | - | u64 guest_pebs_mask; | |
| 5306 | - | int global_ctrl; | |
| 5295 | + | int global_ctrl, pebs_enable; | |
| 5307 | 5296 | ||
| 5308 | 5297 | /* | |
| 5309 | 5298 | * In addition to obeying exclude_guest/exclude_host, remove bits being | |
| 5310 | 5299 | * used for PEBS when running a guest, because PEBS writes to virtual | |
| 5311 | - | * addresses (not physical addresses). If the guest wants to utilize | |
| 5312 | - | * PEBS, and PEBS can be safely enabled in the guest, bits for the guest's | |
| 5313 | - | * PEBS-enabled counters will be OR'd back in as appropriate. | |
| 5300 | + | * addresses (not physical addresses). | |
| 5314 | 5301 | */ | |
| 5315 | 5302 | *nr = 0; | |
| 5316 | 5303 | global_ctrl = (*nr)++; | |
| @@ -5340,68 +5327,41 @@ static struct perf_guest_switch_msr *intel_guest_get_msrs(int *nr, void *data) | |||
| 5340 | 5327 | return arr; | |
| 5341 | 5328 | } | |
| 5342 | 5329 | ||
| 5343 | - | /* | |
| 5344 | - | * If the CPU doesn't support PEBS in the guest, then there's nothing | |
| 5345 | - | * more to do as disabling PMCs via PERF_GLOBAL_CTRL is sufficient on | |
| 5346 | - | * CPUs with guest/host isolation. | |
| 5347 | - | */ | |
| 5348 | - | if (!x86_pmu.pebs_ept) | |
| 5330 | + | if (!kvm_pmu || !x86_pmu.pebs_ept) | |
| 5349 | 5331 | return arr; | |
| 5350 | 5332 | ||
| 5351 | - | /* | |
| 5352 | - | * Restrict guest PEBS events to counters that (a) perf supports, (b) | |
| 5353 | - | * the guest wants to use for PEBS, (c) are not excluded from counting | |
| 5354 | - | * in the guest, and (d) _are_ excluded from counting in the host. | |
| 5355 | - | */ | |
| 5356 | - | guest_pebs_mask = pebs_mask & intel_ctrl & kvm_pmu->pebs_enable & | |
| 5357 | - | ~cpuc->intel_ctrl_host_mask & | |
| 5358 | - | cpuc->intel_ctrl_guest_mask; | |
| 5359 | - | ||
| 5360 | - | /* | |
| 5361 | - | * Disable counters where the guest PMC is different than the host PMC | |
| 5362 | - | * being used on behalf of the guest, as the PEBS record includes | |
| 5363 | - | * PERF_GLOBAL_STATUS, i.e. the guest will see overflow status for the | |
| 5364 | - | * wrong counter(s). | |
| 5365 | - | */ | |
| 5366 | - | guest_pebs_mask &= ~kvm_pmu->host_cross_mapped_mask; | |
| 5367 | - | ||
| 5368 | - | /* | |
| 5369 | - | * FIXME: Allow guest and host usage of PEBS events to co-exist instead | |
| 5370 | - | * of disabling guest PEBS entirely if the host is using PEBS. | |
| 5371 | - | * What exactly goes wrong if guest and host are using PEBS is | |
| 5372 | - | * unknown. | |
| 5373 | - | */ | |
| 5374 | - | if (pebs_mask & ~cpuc->intel_ctrl_guest_mask) | |
| 5375 | - | guest_pebs_mask = 0; | |
| 5376 | - | ||
| 5377 | - | /* | |
| 5378 | - | * Context switch DS_AREA and PEBS_DATA_CFG if and only if PEBS will be | |
| 5379 | - | * active in the guest; if no records will be generated while the guest | |
| 5380 | - | * is running, then simply keep the host values resident in hardware. | |
| 5381 | - | */ | |
| 5382 | 5333 | arr[(*nr)++] = (struct perf_guest_switch_msr){ | |
| 5383 | 5334 | .msr = MSR_IA32_DS_AREA, | |
| 5384 | 5335 | .host = (unsigned long)cpuc->ds, | |
| 5385 | - | .guest = guest_pebs_mask ? kvm_pmu->ds_area : (unsigned long)cpuc->ds, | |
| 5336 | + | .guest = kvm_pmu->ds_area, | |
| 5386 | 5337 | }; | |
| 5387 | 5338 | ||
| 5388 | 5339 | if (x86_pmu.intel_cap.pebs_baseline) { | |
| 5389 | 5340 | arr[(*nr)++] = (struct perf_guest_switch_msr){ | |
| 5390 | 5341 | .msr = MSR_PEBS_DATA_CFG, | |
| 5391 | 5342 | .host = cpuc->active_pebs_data_cfg, | |
| 5392 | - | .guest = guest_pebs_mask ? kvm_pmu->pebs_data_cfg : | |
| 5393 | - | cpuc->active_pebs_data_cfg, | |
| 5343 | + | .guest = kvm_pmu->pebs_data_cfg, | |
| 5394 | 5344 | }; | |
| 5395 | 5345 | } | |
| 5396 | 5346 | ||
| 5397 | - | /* | |
| 5398 | - | * Do NOT mess with PEBS_ENABLED. As above, disabling counters via | |
| 5399 | - | * PERF_GLOBAL_CTRL is sufficient, and loading a stale PEBS_ENABLED, | |
| 5400 | - | * e.g. on VM-Exit, can put the system in a bad state. Simply enable | |
| 5401 | - | * counters in PERF_GLOBAL_CTRL, as perf load PEBS_ENABLED with the | |
| 5402 | - | * full value, i.e. perf *also* relies on PERF_GLOBAL_CTRL. | |
| 5403 | - | */ | |
| 5404 | - | arr[global_ctrl].guest |= guest_pebs_mask; | |
| 5347 | + | pebs_enable = (*nr)++; | |
| 5348 | + | arr[pebs_enable] = (struct perf_guest_switch_msr){ | |
| 5349 | + | .msr = MSR_IA32_PEBS_ENABLE, | |
| 5350 | + | .host = cpuc->pebs_enabled & ~cpuc->intel_ctrl_guest_mask, | |
| 5351 | + | .guest = pebs_mask & ~cpuc->intel_ctrl_host_mask & kvm_pmu->pebs_enable, | |
| 5352 | + | }; | |
| 5353 | + | ||
| 5354 | + | if (arr[pebs_enable].host) { | |
| 5355 | + | /* Disable guest PEBS if host PEBS is enabled. */ | |
| 5356 | + | arr[pebs_enable].guest = 0; | |
| 5357 | + | } else { | |
| 5358 | + | /* Disable guest PEBS thoroughly for cross-mapped PEBS counters. */ | |
| 5359 | + | arr[pebs_enable].guest &= ~kvm_pmu->host_cross_mapped_mask; | |
| 5360 | + | arr[global_ctrl].guest &= ~kvm_pmu->host_cross_mapped_mask; | |
| 5361 | + | /* Set hw GLOBAL_CTRL bits for PEBS counter when it runs for guest */ | |
| 5362 | + | arr[global_ctrl].guest |= arr[pebs_enable].guest; | |
| 5363 | + | } | |
| 5364 | + | ||
| 5405 | 5365 | return arr; | |
| 5406 | 5366 | } | |
| 5407 | 5367 | ||
| @@ -6601,8 +6561,6 @@ static void intel_pmu_filter(struct pmu *pmu, int cpu, bool *ret) | |||
| 6601 | 6561 | ||
| 6602 | 6562 | PMU_FORMAT_ATTR(offcore_rsp, "config1:0-63"); | |
| 6603 | 6563 | ||
| 6604 | - | PMU_FORMAT_ATTR(offmodule_rsp, "config1:0-63"); | |
| 6605 | - | ||
| 6606 | 6564 | PMU_FORMAT_ATTR(ldlat, "config1:0-15"); | |
| 6607 | 6565 | ||
| 6608 | 6566 | PMU_FORMAT_ATTR(frontend, "config1:0-23"); | |
| @@ -6651,20 +6609,6 @@ static struct attribute *skl_format_attr[] = { | |||
| 6651 | 6609 | NULL, | |
| 6652 | 6610 | }; | |
| 6653 | 6611 | ||
| 6654 | - | static struct attribute *pnc_format_attr_rtm[] = { | |
| 6655 | - | &format_attr_in_tx.attr, | |
| 6656 | - | &format_attr_in_tx_cp.attr, | |
| 6657 | - | &format_attr_offmodule_rsp.attr, | |
| 6658 | - | &format_attr_ldlat.attr, | |
| 6659 | - | NULL | |
| 6660 | - | }; | |
| 6661 | - | ||
| 6662 | - | static struct attribute *pnc_format_attr[] = { | |
| 6663 | - | &format_attr_offmodule_rsp.attr, | |
| 6664 | - | &format_attr_ldlat.attr, | |
| 6665 | - | NULL | |
| 6666 | - | }; | |
| 6667 | - | ||
| 6668 | 6612 | static __initconst const struct x86_pmu core_pmu = { | |
| 6669 | 6613 | .name = "core", | |
| 6670 | 6614 | .handle_irq = x86_pmu_handle_irq, | |
| @@ -7530,7 +7474,6 @@ static struct attribute *adl_hybrid_tsx_attrs[] = { | |||
| 7530 | 7474 | FORMAT_ATTR_HYBRID(in_tx, hybrid_big); | |
| 7531 | 7475 | FORMAT_ATTR_HYBRID(in_tx_cp, hybrid_big); | |
| 7532 | 7476 | FORMAT_ATTR_HYBRID(offcore_rsp, hybrid_big_small_tiny); | |
| 7533 | - | FORMAT_ATTR_HYBRID(offmodule_rsp, hybrid_big_small_tiny); | |
| 7534 | 7477 | FORMAT_ATTR_HYBRID(ldlat, hybrid_big_small_tiny); | |
| 7535 | 7478 | FORMAT_ATTR_HYBRID(frontend, hybrid_big); | |
| 7536 | 7479 | ||
| @@ -7569,23 +7512,6 @@ static struct attribute *mtl_hybrid_extra_attr[] = { | |||
| 7569 | 7512 | NULL | |
| 7570 | 7513 | }; | |
| 7571 | 7514 | ||
| 7572 | - | static struct attribute *nvl_hybrid_extra_attr_rtm[] = { | |
| 7573 | - | ADL_HYBRID_RTM_FORMAT_ATTR, | |
| 7574 | - | FORMAT_HYBRID_PTR(offmodule_rsp), | |
| 7575 | - | FORMAT_HYBRID_PTR(ldlat), | |
| 7576 | - | FORMAT_HYBRID_PTR(frontend), | |
| 7577 | - | FORMAT_HYBRID_PTR(snoop_rsp), | |
| 7578 | - | NULL | |
| 7579 | - | }; | |
| 7580 | - | ||
| 7581 | - | static struct attribute *nvl_hybrid_extra_attr[] = { | |
| 7582 | - | FORMAT_HYBRID_PTR(offmodule_rsp), | |
| 7583 | - | FORMAT_HYBRID_PTR(ldlat), | |
| 7584 | - | FORMAT_HYBRID_PTR(frontend), | |
| 7585 | - | FORMAT_HYBRID_PTR(snoop_rsp), | |
| 7586 | - | NULL | |
| 7587 | - | }; | |
| 7588 | - | ||
| 7589 | 7515 | static bool is_attr_for_this_pmu(struct kobject *kobj, struct attribute *attr) | |
| 7590 | 7516 | { | |
| 7591 | 7517 | struct device *dev = kobj_to_dev(kobj); | |
| @@ -8623,8 +8549,6 @@ __init int intel_pmu_init(void) | |||
| 8623 | 8549 | case INTEL_DIAMONDRAPIDS_X: | |
| 8624 | 8550 | intel_pmu_init_pnc(NULL); | |
| 8625 | 8551 | x86_pmu.pebs_latency_data = pnc_latency_data; | |
| 8626 | - | extra_attr = boot_cpu_has(X86_FEATURE_RTM) ? | |
| 8627 | - | pnc_format_attr_rtm : pnc_format_attr; | |
| 8628 | 8552 | ||
| 8629 | 8553 | pr_cont("Panthercove events, "); | |
| 8630 | 8554 | name = "panthercove"; | |
| @@ -8633,12 +8557,13 @@ __init int intel_pmu_init(void) | |||
| 8633 | 8557 | glc_common: | |
| 8634 | 8558 | intel_pmu_init_glc(NULL); | |
| 8635 | 8559 | intel_pmu_pebs_data_source_skl(true); | |
| 8636 | - | extra_attr = boot_cpu_has(X86_FEATURE_RTM) ? | |
| 8637 | - | hsw_format_attr : nhm_format_attr; | |
| 8560 | + | ||
| 8638 | 8561 | glc_base: | |
| 8639 | 8562 | x86_pmu.pebs_ept = 1; | |
| 8640 | 8563 | x86_pmu.hw_config = hsw_hw_config; | |
| 8641 | 8564 | x86_pmu.get_event_constraints = glc_get_event_constraints; | |
| 8565 | + | extra_attr = boot_cpu_has(X86_FEATURE_RTM) ? | |
| 8566 | + | hsw_format_attr : nhm_format_attr; | |
| 8642 | 8567 | extra_skl_attr = skl_format_attr; | |
| 8643 | 8568 | mem_attr = glc_events_attrs; | |
| 8644 | 8569 | td_attr = glc_td_events_attrs; | |
| @@ -8860,7 +8785,7 @@ __init int intel_pmu_init(void) | |||
| 8860 | 8785 | mem_attr = mtl_hybrid_mem_attrs; | |
| 8861 | 8786 | tsx_attr = adl_hybrid_tsx_attrs; | |
| 8862 | 8787 | extra_attr = boot_cpu_has(X86_FEATURE_RTM) ? | |
| 8863 | - | nvl_hybrid_extra_attr_rtm : nvl_hybrid_extra_attr; | |
| 8788 | + | mtl_hybrid_extra_attr_rtm : mtl_hybrid_extra_attr; | |
| 8864 | 8789 | ||
| 8865 | 8790 | /* Initialize big core specific PerfMon capabilities.*/ | |
| 8866 | 8791 | pmu = &x86_pmu.hybrid_pmu[X86_HYBRID_PMU_CORE_IDX]; | |
| @@ -8869,6 +8794,8 @@ __init int intel_pmu_init(void) | |||
| 8869 | 8794 | /* Initialize Atom core specific PerfMon capabilities.*/ | |
| 8870 | 8795 | pmu = &x86_pmu.hybrid_pmu[X86_HYBRID_PMU_ATOM_IDX]; | |
| 8871 | 8796 | intel_pmu_init_arw(&pmu->pmu); | |
| 8797 | + | ||
| 8798 | + | intel_pmu_pebs_data_source_lnl(); | |
| 8872 | 8799 | break; | |
| 8873 | 8800 | ||
| 8874 | 8801 | default: | |
modified arch/x86/events/intel/ds.c
| @@ -277,8 +277,8 @@ static u64 pnc_pebs_l2_hit_data_source[PNC_PEBS_DATA_SOURCE_MAX] = { | |||
| 277 | 277 | 0, /* 0x06: Reserved */ | |
| 278 | 278 | OP_LH | P(LVL, L2) | LEVEL(L2) | P(SNOOP, HIT), /* 0x07: L2 Hit Snoop HIT */ | |
| 279 | 279 | OP_LH | P(LVL, L2) | LEVEL(L2) | P(SNOOP, HITM), /* 0x08: L2 Hit Snoop Hit Modified */ | |
| 280 | - | OP_LH | P(LVL, L2) | LEVEL(L2) | P(SNOOP, NONE), /* 0x09: Prefetch Promotion */ | |
| 281 | - | OP_LH | P(LVL, L2) | LEVEL(L2) | P(SNOOP, NONE), /* 0x0a: Cross Core Prefetch Promotion */ | |
| 280 | + | OP_LH | P(LVL, L2) | LEVEL(L2) | P(SNOOP, MISS), /* 0x09: Prefetch Promotion */ | |
| 281 | + | OP_LH | P(LVL, L2) | LEVEL(L2) | P(SNOOP, MISS), /* 0x0a: Cross Core Prefetch Promotion */ | |
| 282 | 282 | 0, /* 0x0b: Reserved */ | |
| 283 | 283 | 0, /* 0x0c: Reserved */ | |
| 284 | 284 | 0, /* 0x0d: Reserved */ | |
| @@ -455,7 +455,6 @@ static inline void pebs_set_tlb_lock(u64 *val, bool tlb, bool lock) | |||
| 455 | 455 | static u64 __grt_latency_data(struct perf_event *event, u64 status, | |
| 456 | 456 | u8 dse, bool tlb, bool lock, bool blk) | |
| 457 | 457 | { | |
| 458 | - | union perf_mem_data_src src; | |
| 459 | 458 | u64 val; | |
| 460 | 459 | ||
| 461 | 460 | WARN_ON_ONCE(is_hybrid() && | |
| @@ -471,16 +470,7 @@ static u64 __grt_latency_data(struct perf_event *event, u64 status, | |||
| 471 | 470 | else | |
| 472 | 471 | val |= P(BLK, NA); | |
| 473 | 472 | ||
| 474 | - | src.val = val; | |
| 475 | - | ||
| 476 | - | if (event->hw.flags & | |
| 477 | - | (PERF_X86_EVENT_PEBS_LDLAT | PERF_X86_EVENT_PEBS_LD_HSW)) | |
| 478 | - | src.mem_op = P(OP, LOAD); | |
| 479 | - | if (event->hw.flags & | |
| 480 | - | (PERF_X86_EVENT_PEBS_STLAT | PERF_X86_EVENT_PEBS_ST_HSW)) | |
| 481 | - | src.mem_op = P(OP, STORE); | |
| 482 | - | ||
| 483 | - | return src.val; | |
| 473 | + | return val; | |
| 484 | 474 | } | |
| 485 | 475 | ||
| 486 | 476 | u64 grt_latency_data(struct perf_event *event, u64 status) | |
| @@ -538,11 +528,7 @@ static u64 arw_latency_data(struct perf_event *event, u64 status) | |||
| 538 | 528 | val |= P(BLK, NA); | |
| 539 | 529 | ||
| 540 | 530 | src.val = val; | |
| 541 | - | if (event->hw.flags & | |
| 542 | - | (PERF_X86_EVENT_PEBS_LDLAT | PERF_X86_EVENT_PEBS_LD_HSW)) | |
| 543 | - | src.mem_op = P(OP, LOAD); | |
| 544 | - | if (event->hw.flags & | |
| 545 | - | (PERF_X86_EVENT_PEBS_STLAT | PERF_X86_EVENT_PEBS_ST_HSW)) | |
| 531 | + | if (event->hw.flags & PERF_X86_EVENT_PEBS_ST_HSW) | |
| 546 | 532 | src.mem_op = P(OP, STORE); | |
| 547 | 533 | ||
| 548 | 534 | return src.val; | |
| @@ -577,11 +563,7 @@ static u64 lnc_latency_data(struct perf_event *event, u64 status) | |||
| 577 | 563 | val |= P(BLK, NA); | |
| 578 | 564 | ||
| 579 | 565 | src.val = val; | |
| 580 | - | if (event->hw.flags & | |
| 581 | - | (PERF_X86_EVENT_PEBS_LDLAT | PERF_X86_EVENT_PEBS_LD_HSW)) | |
| 582 | - | src.mem_op = P(OP, LOAD); | |
| 583 | - | if (event->hw.flags & | |
| 584 | - | (PERF_X86_EVENT_PEBS_STLAT | PERF_X86_EVENT_PEBS_ST_HSW)) | |
| 566 | + | if (event->hw.flags & PERF_X86_EVENT_PEBS_ST_HSW) | |
| 585 | 567 | src.mem_op = P(OP, STORE); | |
| 586 | 568 | ||
| 587 | 569 | return src.val; | |
| @@ -639,11 +621,7 @@ u64 pnc_latency_data(struct perf_event *event, u64 status) | |||
| 639 | 621 | val |= P(BLK, NA); | |
| 640 | 622 | ||
| 641 | 623 | src.val = val; | |
| 642 | - | if (event->hw.flags & | |
| 643 | - | (PERF_X86_EVENT_PEBS_LDLAT | PERF_X86_EVENT_PEBS_LD_HSW)) | |
| 644 | - | src.mem_op = P(OP, LOAD); | |
| 645 | - | if (event->hw.flags & | |
| 646 | - | (PERF_X86_EVENT_PEBS_STLAT | PERF_X86_EVENT_PEBS_ST_HSW)) | |
| 624 | + | if (event->hw.flags & PERF_X86_EVENT_PEBS_ST_HSW) | |
| 647 | 625 | src.mem_op = P(OP, STORE); | |
| 648 | 626 | ||
| 649 | 627 | return src.val; | |
| @@ -1313,22 +1291,22 @@ struct event_constraint intel_glm_pebs_event_constraints[] = { | |||
| 1313 | 1291 | ||
| 1314 | 1292 | struct event_constraint intel_grt_pebs_event_constraints[] = { | |
| 1315 | 1293 | /* Allow all events as PEBS with no flags */ | |
| 1316 | - | INTEL_HYBRID_LDLAT_CONSTRAINT(0x5d0, 0x3), | |
| 1317 | - | INTEL_HYBRID_STLAT_CONSTRAINT(0x6d0, 0x3f), | |
| 1294 | + | INTEL_HYBRID_LAT_CONSTRAINT(0x5d0, 0x3), | |
| 1295 | + | INTEL_HYBRID_LAT_CONSTRAINT(0x6d0, 0x3f), | |
| 1318 | 1296 | EVENT_CONSTRAINT_END | |
| 1319 | 1297 | }; | |
| 1320 | 1298 | ||
| 1321 | 1299 | struct event_constraint intel_cmt_pebs_event_constraints[] = { | |
| 1322 | 1300 | /* Allow all events as PEBS with no flags */ | |
| 1323 | - | INTEL_HYBRID_LDLAT_CONSTRAINT(0x5d0, 0x3), | |
| 1324 | - | INTEL_HYBRID_STLAT_CONSTRAINT(0x6d0, 0xff), | |
| 1301 | + | INTEL_HYBRID_LAT_CONSTRAINT(0x5d0, 0x3), | |
| 1302 | + | INTEL_HYBRID_LAT_CONSTRAINT(0x6d0, 0xff), | |
| 1325 | 1303 | EVENT_CONSTRAINT_END | |
| 1326 | 1304 | }; | |
| 1327 | 1305 | ||
| 1328 | 1306 | struct event_constraint intel_dkt_pebs_event_constraints[] = { | |
| 1329 | 1307 | /* Allow all events as PEBS with no flags */ | |
| 1330 | - | INTEL_HYBRID_LDLAT_CONSTRAINT(0x5d0, 0xff), | |
| 1331 | - | INTEL_HYBRID_STLAT_CONSTRAINT(0x6d0, 0xff), | |
| 1308 | + | INTEL_HYBRID_LAT_CONSTRAINT(0x5d0, 0xff), | |
| 1309 | + | INTEL_HYBRID_LAT_CONSTRAINT(0x6d0, 0xff), | |
| 1332 | 1310 | EVENT_CONSTRAINT_END | |
| 1333 | 1311 | }; | |
| 1334 | 1312 | ||
| @@ -1518,8 +1496,24 @@ struct event_constraint intel_lnc_pebs_event_constraints[] = { | |||
| 1518 | 1496 | INTEL_FLAGS_UEVENT_CONSTRAINT(0x012a, 0x1), /* OCR.* events */ | |
| 1519 | 1497 | INTEL_FLAGS_UEVENT_CONSTRAINT(0x012b, 0x1), /* OCR.* events */ | |
| 1520 | 1498 | ||
| 1499 | + | INTEL_FLAGS_UEVENT_CONSTRAINT(0x04a4, 0x1), /* TOPDOWN.BAD_SPEC_SLOTS */ | |
| 1500 | + | INTEL_FLAGS_UEVENT_CONSTRAINT(0x08a4, 0x1), /* TOPDOWN.BR_MISPREDICT_SLOTS */ | |
| 1501 | + | INTEL_FLAGS_UEVENT_CONSTRAINT(0x10a4, 0x8), /* TOPDOWN.MEMORY_BOUND_SLOTS */ | |
| 1502 | + | ||
| 1521 | 1503 | INTEL_HYBRID_LDLAT_CONSTRAINT(0x1cd, 0x3fc), | |
| 1522 | 1504 | INTEL_HYBRID_STLAT_CONSTRAINT(0x2cd, 0x3), | |
| 1505 | + | INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_LD(0x11d0, 0xf), /* MEM_INST_RETIRED.STLB_MISS_LOADS */ | |
| 1506 | + | INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_ST(0x12d0, 0xf), /* MEM_INST_RETIRED.STLB_MISS_STORES */ | |
| 1507 | + | INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_LD(0x21d0, 0xf), /* MEM_INST_RETIRED.LOCK_LOADS */ | |
| 1508 | + | INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_LD(0x41d0, 0xf), /* MEM_INST_RETIRED.SPLIT_LOADS */ | |
| 1509 | + | INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_ST(0x42d0, 0xf), /* MEM_INST_RETIRED.SPLIT_STORES */ | |
| 1510 | + | INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_LD(0x81d0, 0xf), /* MEM_INST_RETIRED.ALL_LOADS */ | |
| 1511 | + | INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_ST(0x82d0, 0xf), /* MEM_INST_RETIRED.ALL_STORES */ | |
| 1512 | + | INTEL_FLAGS_UEVENT_CONSTRAINT(0x87d0, 0x3ff), /* MEM_INST_RETIRED.ANY */ | |
| 1513 | + | ||
| 1514 | + | INTEL_FLAGS_EVENT_CONSTRAINT_DATALA_LD_RANGE(0xd1, 0xd4, 0xf), | |
| 1515 | + | ||
| 1516 | + | INTEL_FLAGS_EVENT_CONSTRAINT(0xd0, 0xf), | |
| 1523 | 1517 | ||
| 1524 | 1518 | /* | |
| 1525 | 1519 | * Everything else is handled by PMU_FL_PEBS_ALL, because we | |
| @@ -1532,6 +1526,18 @@ struct event_constraint intel_lnc_pebs_event_constraints[] = { | |||
| 1532 | 1526 | struct event_constraint intel_pnc_pebs_event_constraints[] = { | |
| 1533 | 1527 | INTEL_HYBRID_LDLAT_CONSTRAINT(0x1cd, 0xfc), | |
| 1534 | 1528 | INTEL_HYBRID_STLAT_CONSTRAINT(0x2cd, 0x3), | |
| 1529 | + | INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_LD(0x11d0, 0xf), /* MEM_INST_RETIRED.STLB_MISS_LOADS */ | |
| 1530 | + | INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_ST(0x12d0, 0xf), /* MEM_INST_RETIRED.STLB_MISS_STORES */ | |
| 1531 | + | INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_LD(0x21d0, 0xf), /* MEM_INST_RETIRED.LOCK_LOADS */ | |
| 1532 | + | INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_LD(0x41d0, 0xf), /* MEM_INST_RETIRED.SPLIT_LOADS */ | |
| 1533 | + | INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_ST(0x42d0, 0xf), /* MEM_INST_RETIRED.SPLIT_STORES */ | |
| 1534 | + | INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_LD(0x81d0, 0xf), /* MEM_INST_RETIRED.ALL_LOADS */ | |
| 1535 | + | INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_ST(0x82d0, 0xf), /* MEM_INST_RETIRED.ALL_STORES */ | |
| 1536 | + | ||
| 1537 | + | INTEL_FLAGS_EVENT_CONSTRAINT_DATALA_LD_RANGE(0xd1, 0xd4, 0xf), | |
| 1538 | + | ||
| 1539 | + | INTEL_FLAGS_EVENT_CONSTRAINT(0xd0, 0xf), | |
| 1540 | + | INTEL_FLAGS_EVENT_CONSTRAINT(0xd6, 0xf), | |
| 1535 | 1541 | ||
| 1536 | 1542 | /* | |
| 1537 | 1543 | * Everything else is handled by PMU_FL_PEBS_ALL, because we | |
modified arch/x86/events/intel/lbr.c
| @@ -756,10 +756,10 @@ void intel_pmu_lbr_read_32(struct cpu_hw_events *cpuc) | |||
| 756 | 756 | ||
| 757 | 757 | rdmsrq(x86_pmu.lbr_from + lbr_idx, msr_lastbranch.lbr); | |
| 758 | 758 | ||
| 759 | - | *br = (struct perf_branch_entry){ | |
| 760 | - | .from = msr_lastbranch.from, | |
| 761 | - | .to = msr_lastbranch.to, | |
| 762 | - | }; | |
| 759 | + | perf_clear_branch_entry_bitfields(br); | |
| 760 | + | ||
| 761 | + | br->from = msr_lastbranch.from; | |
| 762 | + | br->to = msr_lastbranch.to; | |
| 763 | 763 | br++; | |
| 764 | 764 | } | |
| 765 | 765 | cpuc->lbr_stack.nr = i; | |
| @@ -847,15 +847,14 @@ void intel_pmu_lbr_read_64(struct cpu_hw_events *cpuc) | |||
| 847 | 847 | if (abort && x86_pmu.lbr_double_abort && out > 0) | |
| 848 | 848 | out--; | |
| 849 | 849 | ||
| 850 | - | br[out] = (struct perf_branch_entry){ | |
| 851 | - | .from = from, | |
| 852 | - | .to = to, | |
| 853 | - | .mispred = mis, | |
| 854 | - | .predicted = pred, | |
| 855 | - | .in_tx = in_tx, | |
| 856 | - | .abort = abort, | |
| 857 | - | .cycles = cycles, | |
| 858 | - | }; | |
| 850 | + | perf_clear_branch_entry_bitfields(br+out); | |
| 851 | + | br[out].from = from; | |
| 852 | + | br[out].to = to; | |
| 853 | + | br[out].mispred = mis; | |
| 854 | + | br[out].predicted = pred; | |
| 855 | + | br[out].in_tx = in_tx; | |
| 856 | + | br[out].abort = abort; | |
| 857 | + | br[out].cycles = cycles; | |
| 859 | 858 | out++; | |
| 860 | 859 | } | |
| 861 | 860 | cpuc->lbr_stack.nr = out; | |
| @@ -906,7 +905,6 @@ static void intel_pmu_store_lbr(struct cpu_hw_events *cpuc, | |||
| 906 | 905 | struct perf_branch_entry *e; | |
| 907 | 906 | struct lbr_entry *lbr; | |
| 908 | 907 | u64 from, to, info; | |
| 909 | - | bool mispred; | |
| 910 | 908 | int i; | |
| 911 | 909 | ||
| 912 | 910 | for (i = 0; i < x86_pmu.lbr_nr; i++) { | |
| @@ -923,27 +921,24 @@ static void intel_pmu_store_lbr(struct cpu_hw_events *cpuc, | |||
| 923 | 921 | to = rdlbr_to(i, lbr); | |
| 924 | 922 | info = rdlbr_info(i, lbr); | |
| 925 | 923 | ||
| 926 | - | mispred = get_lbr_mispred(info); | |
| 927 | - | ||
| 928 | - | *e = (struct perf_branch_entry){ | |
| 929 | - | .from = from, | |
| 930 | - | .to = to, | |
| 931 | - | .mispred = mispred, | |
| 932 | - | .predicted = !mispred, | |
| 933 | - | .in_tx = !!(info & LBR_INFO_IN_TX), | |
| 934 | - | .abort = !!(info & LBR_INFO_ABORT), | |
| 935 | - | .cycles = get_lbr_cycles(info), | |
| 936 | - | .type = get_lbr_br_type(info), | |
| 937 | - | /* | |
| 938 | - | * Leverage the reserved field of | |
| 939 | - | * cpuc->lbr_entries[i] to temporarily store the | |
| 940 | - | * branch counters information. The later code will | |
| 941 | - | * decide what content can be disclosed to the perf | |
| 942 | - | * tool. Pleae see intel_pmu_lbr_counters_reorder(). | |
| 943 | - | */ | |
| 944 | - | .reserved = (info >> LBR_INFO_BR_CNTR_OFFSET) & | |
| 945 | - | LBR_INFO_BR_CNTR_FULL_MASK, | |
| 946 | - | }; | |
| 924 | + | perf_clear_branch_entry_bitfields(e); | |
| 925 | + | ||
| 926 | + | e->from = from; | |
| 927 | + | e->to = to; | |
| 928 | + | e->mispred = get_lbr_mispred(info); | |
| 929 | + | e->predicted = !e->mispred; | |
| 930 | + | e->in_tx = !!(info & LBR_INFO_IN_TX); | |
| 931 | + | e->abort = !!(info & LBR_INFO_ABORT); | |
| 932 | + | e->cycles = get_lbr_cycles(info); | |
| 933 | + | e->type = get_lbr_br_type(info); | |
| 934 | + | ||
| 935 | + | /* | |
| 936 | + | * Leverage the reserved field of cpuc->lbr_entries[i] to | |
| 937 | + | * temporarily store the branch counters information. | |
| 938 | + | * The later code will decide what content can be disclosed | |
| 939 | + | * to the perf tool. Pleae see intel_pmu_lbr_counters_reorder(). | |
| 940 | + | */ | |
| 941 | + | e->reserved = (info >> LBR_INFO_BR_CNTR_OFFSET) & LBR_INFO_BR_CNTR_FULL_MASK; | |
| 947 | 942 | } | |
| 948 | 943 | ||
| 949 | 944 | cpuc->lbr_stack.nr = i; | |
modified arch/x86/events/perf_event.h
| @@ -517,6 +517,10 @@ struct cpu_hw_events { | |||
| 517 | 517 | __EVENT_CONSTRAINT(c, n, INTEL_ARCH_EVENT_MASK|X86_ALL_EVENT_FLAGS, \ | |
| 518 | 518 | HWEIGHT(n), 0, PERF_X86_EVENT_PEBS_ST) | |
| 519 | 519 | ||
| 520 | + | #define INTEL_HYBRID_LAT_CONSTRAINT(c, n) \ | |
| 521 | + | __EVENT_CONSTRAINT(c, n, INTEL_ARCH_EVENT_MASK|X86_ALL_EVENT_FLAGS, \ | |
| 522 | + | HWEIGHT(n), 0, PERF_X86_EVENT_PEBS_LAT_HYBRID) | |
| 523 | + | ||
| 520 | 524 | #define INTEL_HYBRID_LDLAT_CONSTRAINT(c, n) \ | |
| 521 | 525 | __EVENT_CONSTRAINT(c, n, INTEL_ARCH_EVENT_MASK|X86_ALL_EVENT_FLAGS, \ | |
| 522 | 526 | HWEIGHT(n), 0, PERF_X86_EVENT_PEBS_LAT_HYBRID|PERF_X86_EVENT_PEBS_LD_HSW) | |
modified arch/x86/include/asm/div64.h
| @@ -111,7 +111,7 @@ static inline u64 mul_u64_add_u64_div_u64(u64 rax, u64 mul, u64 add, u64 div) | |||
| 111 | 111 | ||
| 112 | 112 | if (!statically_true(!add)) | |
| 113 | 113 | asm ("addq %[add], %[lo]; adcq $0, %[hi]" : | |
| 114 | - | [lo] "+r" (rax), [hi] "+r" (rdx) : [add] "erm" (add)); | |
| 114 | + | [lo] "+r" (rax), [hi] "+r" (rdx) : [add] "irm" (add)); | |
| 115 | 115 | ||
| 116 | 116 | asm ("divq %[div]" : "+a" (rax), "+d" (rdx) : [div] "rm" (div)); | |
| 117 | 117 | ||
modified arch/x86/include/asm/pgtable.h
| @@ -806,7 +806,7 @@ static inline pmd_t pmd_modify(pmd_t pmd, pgprot_t newprot) | |||
| 806 | 806 | pmdval_t val = pmd_val(pmd), oldval = val; | |
| 807 | 807 | pmd_t pmd_result; | |
| 808 | 808 | ||
| 809 | - | val &= _HPAGE_CHG_MASK; | |
| 809 | + | val &= (_HPAGE_CHG_MASK & ~_PAGE_DIRTY); | |
| 810 | 810 | val |= check_pgprot(newprot) & ~_HPAGE_CHG_MASK; | |
| 811 | 811 | val = flip_protnone_guard(oldval, val, PHYSICAL_PMD_PAGE_MASK); | |
| 812 | 812 | ||
modified arch/x86/include/asm/text-patching.h
| @@ -164,9 +164,9 @@ unsigned long int3_emulate_pop(struct pt_regs *regs) | |||
| 164 | 164 | } | |
| 165 | 165 | ||
| 166 | 166 | static __always_inline | |
| 167 | - | void int3_emulate_call(struct pt_regs *regs, unsigned long ip, unsigned long func) | |
| 167 | + | void int3_emulate_call(struct pt_regs *regs, unsigned long func) | |
| 168 | 168 | { | |
| 169 | - | int3_emulate_push(regs, ip); | |
| 169 | + | int3_emulate_push(regs, regs->ip - INT3_INSN_SIZE + CALL_INSN_SIZE); | |
| 170 | 170 | int3_emulate_jmp(regs, func); | |
| 171 | 171 | } | |
| 172 | 172 | ||
modified arch/x86/kernel/alternative.c
| @@ -6,9 +6,6 @@ | |||
| 6 | 6 | #include <linux/vmalloc.h> | |
| 7 | 7 | #include <linux/memory.h> | |
| 8 | 8 | #include <linux/execmem.h> | |
| 9 | - | #include <linux/cleanup.h> | |
| 10 | - | #include <linux/kgdb.h> | |
| 11 | - | #include <linux/mmap_lock.h> | |
| 12 | 9 | ||
| 13 | 10 | #include <asm/text-patching.h> | |
| 14 | 11 | #include <asm/insn.h> | |
| @@ -1201,41 +1198,6 @@ static bool cfi_debug __ro_after_init; | |||
| 1201 | 1198 | bool cfi_bhi __ro_after_init = false; | |
| 1202 | 1199 | #endif | |
| 1203 | 1200 | ||
| 1204 | - | #ifdef CONFIG_FINEIBT | |
| 1205 | - | /* | |
| 1206 | - | * <fineibt_preamble_start>: | |
| 1207 | - | * 0: f3 0f 1e fa endbr64 | |
| 1208 | - | * 4: 2d 78 56 34 12 sub $0x12345678, %eax | |
| 1209 | - | * 9: 2e 0f 85 03 00 00 00 jne,pn 13 <fineibt_preamble_start+0x13> | |
| 1210 | - | * 10: 0f 1f 40 d6 nopl -0x2a(%rax) | |
| 1211 | - | * | |
| 1212 | - | * Note that the JNE target is the 0xD6 byte inside the NOPL, this decodes as | |
| 1213 | - | * UDB on x86_64 and raises #UD. | |
| 1214 | - | */ | |
| 1215 | - | asm( ".pushsection .rodata \n" | |
| 1216 | - | "fineibt_preamble_start: \n" | |
| 1217 | - | " endbr64 \n" | |
| 1218 | - | " subl $0x12345678, %eax \n" | |
| 1219 | - | "fineibt_preamble_bhi: \n" | |
| 1220 | - | " cs jne.d32 fineibt_preamble_start+0x13 \n" | |
| 1221 | - | "#fineibt_func: \n" | |
| 1222 | - | " nopl -42(%rax) \n" | |
| 1223 | - | "fineibt_preamble_end: \n" | |
| 1224 | - | ".popsection\n" | |
| 1225 | - | ); | |
| 1226 | - | ||
| 1227 | - | extern u8 fineibt_preamble_start[]; | |
| 1228 | - | extern u8 fineibt_preamble_bhi[]; | |
| 1229 | - | extern u8 fineibt_preamble_end[]; | |
| 1230 | - | ||
| 1231 | - | #define fineibt_preamble_size (fineibt_preamble_end - fineibt_preamble_start) | |
| 1232 | - | #define fineibt_preamble_bhi (fineibt_preamble_bhi - fineibt_preamble_start) | |
| 1233 | - | #define fineibt_preamble_ud 0x13 | |
| 1234 | - | #define fineibt_preamble_hash 5 | |
| 1235 | - | ||
| 1236 | - | #define fineibt_prefix_size (fineibt_preamble_size - ENDBR_INSN_SIZE) | |
| 1237 | - | #endif /* CONFIG_FINEIBT */ | |
| 1238 | - | ||
| 1239 | 1201 | #ifdef CONFIG_CFI | |
| 1240 | 1202 | u32 cfi_get_func_hash(void *func) | |
| 1241 | 1203 | { | |
| @@ -1243,11 +1205,9 @@ u32 cfi_get_func_hash(void *func) | |||
| 1243 | 1205 | ||
| 1244 | 1206 | func -= cfi_get_offset(); | |
| 1245 | 1207 | switch (cfi_mode) { | |
| 1246 | - | #ifdef CONFIG_FINEIBT | |
| 1247 | 1208 | case CFI_FINEIBT: | |
| 1248 | - | func += fineibt_preamble_hash; | |
| 1209 | + | func += 7; | |
| 1249 | 1210 | break; | |
| 1250 | - | #endif | |
| 1251 | 1211 | case CFI_KCFI: | |
| 1252 | 1212 | func += 1; | |
| 1253 | 1213 | break; | |
| @@ -1403,6 +1363,39 @@ early_param("cfi", cfi_parse_cmdline); | |||
| 1403 | 1363 | * anyway. | |
| 1404 | 1364 | */ | |
| 1405 | 1365 | ||
| 1366 | + | /* | |
| 1367 | + | * <fineibt_preamble_start>: | |
| 1368 | + | * 0: f3 0f 1e fa endbr64 | |
| 1369 | + | * 4: 2d 78 56 34 12 sub $0x12345678, %eax | |
| 1370 | + | * 9: 2e 0f 85 03 00 00 00 jne,pn 13 <fineibt_preamble_start+0x13> | |
| 1371 | + | * 10: 0f 1f 40 d6 nopl -0x2a(%rax) | |
| 1372 | + | * | |
| 1373 | + | * Note that the JNE target is the 0xD6 byte inside the NOPL, this decodes as | |
| 1374 | + | * UDB on x86_64 and raises #UD. | |
| 1375 | + | */ | |
| 1376 | + | asm( ".pushsection .rodata \n" | |
| 1377 | + | "fineibt_preamble_start: \n" | |
| 1378 | + | " endbr64 \n" | |
| 1379 | + | " subl $0x12345678, %eax \n" | |
| 1380 | + | "fineibt_preamble_bhi: \n" | |
| 1381 | + | " cs jne.d32 fineibt_preamble_start+0x13 \n" | |
| 1382 | + | "#fineibt_func: \n" | |
| 1383 | + | " nopl -42(%rax) \n" | |
| 1384 | + | "fineibt_preamble_end: \n" | |
| 1385 | + | ".popsection\n" | |
| 1386 | + | ); | |
| 1387 | + | ||
| 1388 | + | extern u8 fineibt_preamble_start[]; | |
| 1389 | + | extern u8 fineibt_preamble_bhi[]; | |
| 1390 | + | extern u8 fineibt_preamble_end[]; | |
| 1391 | + | ||
| 1392 | + | #define fineibt_preamble_size (fineibt_preamble_end - fineibt_preamble_start) | |
| 1393 | + | #define fineibt_preamble_bhi (fineibt_preamble_bhi - fineibt_preamble_start) | |
| 1394 | + | #define fineibt_preamble_ud 0x13 | |
| 1395 | + | #define fineibt_preamble_hash 5 | |
| 1396 | + | ||
| 1397 | + | #define fineibt_prefix_size (fineibt_preamble_size - ENDBR_INSN_SIZE) | |
| 1398 | + | ||
| 1406 | 1399 | /* | |
| 1407 | 1400 | * <fineibt_caller_start>: | |
| 1408 | 1401 | * 0: b8 78 56 34 12 mov $0x12345678, %eax | |
| @@ -2176,7 +2169,6 @@ int3_exception_notify(struct notifier_block *self, unsigned long val, void *data | |||
| 2176 | 2169 | unsigned long selftest = (unsigned long)&int3_selftest_asm; | |
| 2177 | 2170 | struct die_args *args = data; | |
| 2178 | 2171 | struct pt_regs *regs = args->regs; | |
| 2179 | - | unsigned long ip; | |
| 2180 | 2172 | ||
| 2181 | 2173 | OPTIMIZER_HIDE_VAR(selftest); | |
| 2182 | 2174 | ||
| @@ -2189,8 +2181,7 @@ int3_exception_notify(struct notifier_block *self, unsigned long val, void *data | |||
| 2189 | 2181 | if (regs->ip - INT3_INSN_SIZE != selftest) | |
| 2190 | 2182 | return NOTIFY_DONE; | |
| 2191 | 2183 | ||
| 2192 | - | ip = regs->ip - INT3_INSN_SIZE + CALL_INSN_SIZE; | |
| 2193 | - | int3_emulate_call(regs, ip, (unsigned long)&int3_selftest_callee); | |
| 2184 | + | int3_emulate_call(regs, (unsigned long)&int3_selftest_callee); | |
| 2194 | 2185 | return NOTIFY_STOP; | |
| 2195 | 2186 | } | |
| 2196 | 2187 | ||
| @@ -2381,38 +2372,6 @@ static void text_poke_memset(void *dst, const void *src, size_t len) | |||
| 2381 | 2372 | ||
| 2382 | 2373 | typedef void text_poke_f(void *dst, const void *src, size_t len); | |
| 2383 | 2374 | ||
| 2384 | - | static void __poke_vmalloc_pages(struct page **pages, void *addr, | |
| 2385 | - | bool cross_page_boundary) | |
| 2386 | - | { | |
| 2387 | - | pages[0] = vmalloc_to_page(addr); | |
| 2388 | - | if (cross_page_boundary) | |
| 2389 | - | pages[1] = vmalloc_to_page(addr + PAGE_SIZE); | |
| 2390 | - | } | |
| 2391 | - | ||
| 2392 | - | static void poke_vmalloc_pages(struct page **pages, void *addr, | |
| 2393 | - | bool cross_page_boundary) | |
| 2394 | - | { | |
| 2395 | - | if (in_dbg_master()) { | |
| 2396 | - | /* | |
| 2397 | - | * If called from kgdb cannot sleep, but all other CPUs stopped | |
| 2398 | - | * anyway so safe to proceed without locks | |
| 2399 | - | */ | |
| 2400 | - | __poke_vmalloc_pages(pages, addr, cross_page_boundary); | |
| 2401 | - | } else { | |
| 2402 | - | /* | |
| 2403 | - | * execmem ROX ranges are shared between modules and can be | |
| 2404 | - | * collapsed to huge PMD entries, and this collapse can happen | |
| 2405 | - | * concurrently with a racing set_memory_rox(). | |
| 2406 | - | * | |
| 2407 | - | * Prevent vmalloc_to_page() from racing by acquiring an | |
| 2408 | - | * init_mm read lock which pairs with the init_mm write lock in | |
| 2409 | - | * cpa_collapse_large_pages(). | |
| 2410 | - | */ | |
| 2411 | - | guard(mmap_read_lock)(&init_mm); | |
| 2412 | - | __poke_vmalloc_pages(pages, addr, cross_page_boundary); | |
| 2413 | - | } | |
| 2414 | - | } | |
| 2415 | - | ||
| 2416 | 2375 | static void *__text_poke(text_poke_f func, void *addr, const void *src, size_t len) | |
| 2417 | 2376 | { | |
| 2418 | 2377 | bool cross_page_boundary = offset_in_page(addr) + len > PAGE_SIZE; | |
| @@ -2430,7 +2389,9 @@ static void *__text_poke(text_poke_f func, void *addr, const void *src, size_t l | |||
| 2430 | 2389 | BUG_ON(!after_bootmem); | |
| 2431 | 2390 | ||
| 2432 | 2391 | if (!core_kernel_text((unsigned long)addr)) { | |
| 2433 | - | poke_vmalloc_pages(pages, addr, cross_page_boundary); | |
| 2392 | + | pages[0] = vmalloc_to_page(addr); | |
| 2393 | + | if (cross_page_boundary) | |
| 2394 | + | pages[1] = vmalloc_to_page(addr + PAGE_SIZE); | |
| 2434 | 2395 | } else { | |
| 2435 | 2396 | pages[0] = virt_to_page(addr); | |
| 2436 | 2397 | WARN_ON(!PageReserved(pages[0])); | |
| @@ -2760,7 +2721,7 @@ noinstr int smp_text_poke_int3_handler(struct pt_regs *regs) | |||
| 2760 | 2721 | break; | |
| 2761 | 2722 | ||
| 2762 | 2723 | case CALL_INSN_OPCODE: | |
| 2763 | - | int3_emulate_call(regs, (long)ip, (long)ip + tpl->disp); | |
| 2724 | + | int3_emulate_call(regs, (long)ip + tpl->disp); | |
| 2764 | 2725 | break; | |
| 2765 | 2726 | ||
| 2766 | 2727 | case JMP32_INSN_OPCODE: | |
modified arch/x86/kernel/amd_node.c
| @@ -251,7 +251,7 @@ __setup("amd_smn_debugfs_enable", amd_smn_enable_dfs); | |||
| 251 | 251 | static int __init amd_smn_init(void) | |
| 252 | 252 | { | |
| 253 | 253 | u16 count, num_roots, roots_per_node, node, num_nodes; | |
| 254 | - | struct pci_dev *root __free(pci_dev_put) = NULL; | |
| 254 | + | struct pci_dev *root; | |
| 255 | 255 | ||
| 256 | 256 | if (!cpu_feature_enabled(X86_FEATURE_ZEN)) | |
| 257 | 257 | return 0; | |
| @@ -262,6 +262,7 @@ static int __init amd_smn_init(void) | |||
| 262 | 262 | return 0; | |
| 263 | 263 | ||
| 264 | 264 | num_roots = 0; | |
| 265 | + | root = NULL; | |
| 265 | 266 | while ((root = get_next_root(root))) { | |
| 266 | 267 | pci_dbg(root, "Reserving PCI config space\n"); | |
| 267 | 268 | ||
| @@ -298,13 +299,14 @@ static int __init amd_smn_init(void) | |||
| 298 | 299 | ||
| 299 | 300 | count = 0; | |
| 300 | 301 | node = 0; | |
| 302 | + | root = NULL; | |
| 301 | 303 | while (node < num_nodes && (root = get_next_root(root))) { | |
| 302 | 304 | /* Use one root for each node and skip the rest. */ | |
| 303 | 305 | if (count++ % roots_per_node) | |
| 304 | 306 | continue; | |
| 305 | 307 | ||
| 306 | 308 | pci_dbg(root, "is root for AMD node %u\n", node); | |
| 307 | - | amd_roots[node++] = pci_dev_get(root); | |
| 309 | + | amd_roots[node++] = root; | |
| 308 | 310 | } | |
| 309 | 311 | ||
| 310 | 312 | if (enable_dfs) { | |
modified arch/x86/kernel/cpu/mce/core.c
| @@ -2108,9 +2108,6 @@ bool filter_mce(struct mce *m) | |||
| 2108 | 2108 | static __always_inline void exc_machine_check_kernel(struct pt_regs *regs) | |
| 2109 | 2109 | { | |
| 2110 | 2110 | irqentry_state_t irq_state; | |
| 2111 | - | unsigned long dr7; | |
| 2112 | - | ||
| 2113 | - | dr7 = local_db_save(); | |
| 2114 | 2111 | ||
| 2115 | 2112 | WARN_ON_ONCE(user_mode(regs)); | |
| 2116 | 2113 | ||
| @@ -2119,26 +2116,20 @@ static __always_inline void exc_machine_check_kernel(struct pt_regs *regs) | |||
| 2119 | 2116 | * mce_check_crashing_cpu() for details. | |
| 2120 | 2117 | */ | |
| 2121 | 2118 | if (mca_cfg.initialized && mce_check_crashing_cpu()) | |
| 2122 | - | goto out; | |
| 2119 | + | return; | |
| 2123 | 2120 | ||
| 2124 | 2121 | irq_state = irqentry_nmi_enter(regs); | |
| 2125 | 2122 | ||
| 2126 | 2123 | do_machine_check(regs); | |
| 2127 | 2124 | ||
| 2128 | 2125 | irqentry_nmi_exit(regs, irq_state); | |
| 2129 | - | out: | |
| 2130 | - | local_db_restore(dr7); | |
| 2131 | 2126 | } | |
| 2132 | 2127 | ||
| 2133 | 2128 | static __always_inline void exc_machine_check_user(struct pt_regs *regs) | |
| 2134 | 2129 | { | |
| 2135 | - | unsigned long dr7; | |
| 2136 | - | ||
| 2137 | 2130 | irqentry_enter_from_user_mode(regs); | |
| 2138 | 2131 | ||
| 2139 | - | dr7 = local_db_save(); | |
| 2140 | 2132 | do_machine_check(regs); | |
| 2141 | - | local_db_restore(dr7); | |
| 2142 | 2133 | ||
| 2143 | 2134 | irqentry_exit_to_user_mode(regs); | |
| 2144 | 2135 | } | |
| @@ -2147,13 +2138,21 @@ static __always_inline void exc_machine_check_user(struct pt_regs *regs) | |||
| 2147 | 2138 | /* MCE hit kernel mode */ | |
| 2148 | 2139 | DEFINE_IDTENTRY_MCE(exc_machine_check) | |
| 2149 | 2140 | { | |
| 2141 | + | unsigned long dr7; | |
| 2142 | + | ||
| 2143 | + | dr7 = local_db_save(); | |
| 2150 | 2144 | exc_machine_check_kernel(regs); | |
| 2145 | + | local_db_restore(dr7); | |
| 2151 | 2146 | } | |
| 2152 | 2147 | ||
| 2153 | 2148 | /* The user mode variant. */ | |
| 2154 | 2149 | DEFINE_IDTENTRY_MCE_USER(exc_machine_check) | |
| 2155 | 2150 | { | |
| 2151 | + | unsigned long dr7; | |
| 2152 | + | ||
| 2153 | + | dr7 = local_db_save(); | |
| 2156 | 2154 | exc_machine_check_user(regs); | |
| 2155 | + | local_db_restore(dr7); | |
| 2157 | 2156 | } | |
| 2158 | 2157 | ||
| 2159 | 2158 | #ifdef CONFIG_X86_FRED | |
| @@ -2170,20 +2169,28 @@ DEFINE_IDTENTRY_MCE_USER(exc_machine_check) | |||
| 2170 | 2169 | */ | |
| 2171 | 2170 | DEFINE_FREDENTRY_MCE(exc_machine_check) | |
| 2172 | 2171 | { | |
| 2172 | + | unsigned long dr7; | |
| 2173 | + | ||
| 2174 | + | dr7 = local_db_save(); | |
| 2173 | 2175 | if (user_mode(regs)) | |
| 2174 | 2176 | exc_machine_check_user(regs); | |
| 2175 | 2177 | else | |
| 2176 | 2178 | exc_machine_check_kernel(regs); | |
| 2179 | + | local_db_restore(dr7); | |
| 2177 | 2180 | } | |
| 2178 | 2181 | #endif | |
| 2179 | 2182 | #else | |
| 2180 | 2183 | /* 32bit unified entry point */ | |
| 2181 | 2184 | DEFINE_IDTENTRY_RAW(exc_machine_check) | |
| 2182 | 2185 | { | |
| 2186 | + | unsigned long dr7; | |
| 2187 | + | ||
| 2188 | + | dr7 = local_db_save(); | |
| 2183 | 2189 | if (user_mode(regs)) | |
| 2184 | 2190 | exc_machine_check_user(regs); | |
| 2185 | 2191 | else | |
| 2186 | 2192 | exc_machine_check_kernel(regs); | |
| 2193 | + | local_db_restore(dr7); | |
| 2187 | 2194 | } | |
| 2188 | 2195 | #endif | |
| 2189 | 2196 | ||
modified arch/x86/kernel/cpu/microcode/intel.c
| @@ -309,26 +309,6 @@ static void save_microcode_patch(struct microcode_intel *patch) | |||
| 309 | 309 | pr_err("Unable to allocate microcode memory size: %u\n", size); | |
| 310 | 310 | } | |
| 311 | 311 | ||
| 312 | - | static bool revision_is_safe(struct cpu_signature *sig, u32 rev) | |
| 313 | - | { | |
| 314 | - | u32 vfm = IFM(x86_family(sig->sig), x86_model(sig->sig)); | |
| 315 | - | ||
| 316 | - | /* | |
| 317 | - | * Erratum GNR98 can cause #MCs if "jumping over" revision 0x1000405. | |
| 318 | - | * Avoid the jumps. | |
| 319 | - | */ | |
| 320 | - | if (vfm == INTEL_GRANITERAPIDS_X && | |
| 321 | - | x86_stepping(sig->sig) == 1 && | |
| 322 | - | sig->pf & 0x95 && | |
| 323 | - | sig->rev < 0x1000405 && | |
| 324 | - | rev > 0x1000405) { | |
| 325 | - | pr_err_once("Erratum GNR98: skipping revision 0x%x.\n", rev); | |
| 326 | - | return false; | |
| 327 | - | } | |
| 328 | - | ||
| 329 | - | return true; | |
| 330 | - | } | |
| 331 | - | ||
| 332 | 312 | /* Scan blob for microcode matching the boot CPUs family, model, stepping */ | |
| 333 | 313 | static __init struct microcode_intel *scan_microcode(void *data, size_t size, | |
| 334 | 314 | struct ucode_cpu_info *uci, | |
| @@ -350,9 +330,6 @@ static __init struct microcode_intel *scan_microcode(void *data, size_t size, | |||
| 350 | 330 | if (!intel_find_matching_signature(data, &uci->cpu_sig)) | |
| 351 | 331 | continue; | |
| 352 | 332 | ||
| 353 | - | if (!revision_is_safe(&uci->cpu_sig, mc_header->rev)) | |
| 354 | - | continue; | |
| 355 | - | ||
| 356 | 333 | /* | |
| 357 | 334 | * For saving the early microcode, find the matching revision which | |
| 358 | 335 | * was loaded on the BSP. | |
| @@ -901,9 +878,6 @@ static enum ucode_state parse_microcode_blobs(int cpu, struct iov_iter *iter) | |||
| 901 | 878 | if (!intel_find_matching_signature(mc, &uci->cpu_sig)) | |
| 902 | 879 | continue; | |
| 903 | 880 | ||
| 904 | - | if (!revision_is_safe(&uci->cpu_sig, mc_header.rev)) | |
| 905 | - | continue; | |
| 906 | - | ||
| 907 | 881 | is_safe = ucode_validate_minrev(&mc_header); | |
| 908 | 882 | if (force_minrev && !is_safe) | |
| 909 | 883 | continue; | |
modified arch/x86/kernel/kprobes/core.c
| @@ -510,9 +510,10 @@ NOKPROBE_SYMBOL(kprobe_emulate_ret); | |||
| 510 | 510 | ||
| 511 | 511 | static void kprobe_emulate_call(struct kprobe *p, struct pt_regs *regs) | |
| 512 | 512 | { | |
| 513 | - | unsigned long ip = regs->ip - INT3_INSN_SIZE + p->ainsn.size; | |
| 513 | + | unsigned long func = regs->ip - INT3_INSN_SIZE + p->ainsn.size; | |
| 514 | 514 | ||
| 515 | - | int3_emulate_call(regs, ip, ip + p->ainsn.rel32); | |
| 515 | + | func += p->ainsn.rel32; | |
| 516 | + | int3_emulate_call(regs, func); | |
| 516 | 517 | } | |
| 517 | 518 | NOKPROBE_SYMBOL(kprobe_emulate_call); | |
| 518 | 519 | ||
modified arch/x86/kvm/mmu/mmu.c
| @@ -5058,7 +5058,7 @@ static int kvm_tdp_page_prefault(struct kvm_vcpu *vcpu, gpa_t gpa, | |||
| 5058 | 5058 | if (signal_pending(current)) | |
| 5059 | 5059 | return -EINTR; | |
| 5060 | 5060 | ||
| 5061 | - | if (kvm_test_request(KVM_REQ_VM_DEAD, vcpu)) | |
| 5061 | + | if (kvm_check_request(KVM_REQ_VM_DEAD, vcpu)) | |
| 5062 | 5062 | return -EIO; | |
| 5063 | 5063 | ||
| 5064 | 5064 | cond_resched(); | |
modified arch/x86/kvm/pmu.c
| @@ -823,6 +823,14 @@ void kvm_pmu_deliver_pmi(struct kvm_vcpu *vcpu) | |||
| 823 | 823 | ||
| 824 | 824 | bool kvm_pmu_is_valid_msr(struct kvm_vcpu *vcpu, u32 msr) | |
| 825 | 825 | { | |
| 826 | + | switch (msr) { | |
| 827 | + | case MSR_CORE_PERF_GLOBAL_STATUS: | |
| 828 | + | case MSR_CORE_PERF_GLOBAL_CTRL: | |
| 829 | + | case MSR_CORE_PERF_GLOBAL_OVF_CTRL: | |
| 830 | + | return kvm_pmu_has_perf_global_ctrl(vcpu_to_pmu(vcpu)); | |
| 831 | + | default: | |
| 832 | + | break; | |
| 833 | + | } | |
| 826 | 834 | return kvm_pmu_call(msr_idx_to_pmc)(vcpu, msr) || | |
| 827 | 835 | kvm_pmu_call(is_valid_msr)(vcpu, msr); | |
| 828 | 836 | } | |
modified arch/x86/kvm/svm/nested.c
| @@ -2125,8 +2125,13 @@ static bool svm_get_nested_state_pages(struct kvm_vcpu *vcpu) | |||
| 2125 | 2125 | return false; | |
| 2126 | 2126 | } | |
| 2127 | 2127 | ||
| 2128 | - | if (!nested_svm_merge_msrpm(vcpu)) | |
| 2128 | + | if (!nested_svm_merge_msrpm(vcpu)) { | |
| 2129 | + | vcpu->run->exit_reason = KVM_EXIT_INTERNAL_ERROR; | |
| 2130 | + | vcpu->run->internal.suberror = | |
| 2131 | + | KVM_INTERNAL_ERROR_EMULATION; | |
| 2132 | + | vcpu->run->internal.ndata = 0; | |
| 2129 | 2133 | return false; | |
| 2134 | + | } | |
| 2130 | 2135 | ||
| 2131 | 2136 | if (kvm_hv_verify_vp_assist(vcpu)) | |
| 2132 | 2137 | return false; | |
modified arch/x86/kvm/svm/sev.c
| @@ -2048,12 +2048,6 @@ static void sev_migrate_from(struct kvm *dst_kvm, struct kvm *src_kvm) | |||
| 2048 | 2048 | src->pages_locked = 0; | |
| 2049 | 2049 | src->es_active = false; | |
| 2050 | 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 | - | ||
| 2057 | 2051 | list_cut_before(&dst->regions_list, &src->regions_list, &src->regions_list); | |
| 2058 | 2052 | ||
| 2059 | 2053 | mutex_lock(&sev_mirror_lock); | |
| @@ -2193,10 +2187,6 @@ int sev_vm_move_enc_context_from(struct kvm *kvm, unsigned int source_fd) | |||
| 2193 | 2187 | * the set of CPUs from the source. If a CPU was used to run a vCPU in | |
| 2194 | 2188 | * the source VM but is never used for the destination VM, then the CPU | |
| 2195 | 2189 | * can only have cached memory that was accessible to the source VM. | |
| 2196 | - | * Furthermore, KVM *must* perform cache maintenance on the source VM, | |
| 2197 | - | * as the source VM may have access to memory that the destination VM | |
| 2198 | - | * does not, i.e. KVM could skip flushes if memory is reclaimed from | |
| 2199 | - | * the old VM but not the new VM. | |
| 2200 | 2190 | */ | |
| 2201 | 2191 | if (!zalloc_cpumask_var(&dst_sev->have_run_cpus, GFP_KERNEL_ACCOUNT)) { | |
| 2202 | 2192 | ret = -ENOMEM; | |
| @@ -2990,17 +2980,13 @@ void sev_vm_destroy(struct kvm *kvm) | |||
| 2990 | 2980 | struct list_head *head = &sev->regions_list; | |
| 2991 | 2981 | struct list_head *pos, *q; | |
| 2992 | 2982 | ||
| 2993 | - | /* | |
| 2994 | - | * Free the mask even if the VM is not *currently* an SEV VM, as it may | |
| 2995 | - | * have been an SEV VM prior to intra-host migration. | |
| 2996 | - | */ | |
| 2997 | - | free_cpumask_var(sev->have_run_cpus); | |
| 2998 | - | ||
| 2999 | 2983 | if (!sev_guest(kvm)) | |
| 3000 | 2984 | return; | |
| 3001 | 2985 | ||
| 3002 | 2986 | WARN_ON(!list_empty(&sev->mirror_vms)); | |
| 3003 | 2987 | ||
| 2988 | + | free_cpumask_var(sev->have_run_cpus); | |
| 2989 | + | ||
| 3004 | 2990 | /* | |
| 3005 | 2991 | * If this is a mirror VM, remove it from the owner's list of a mirrors | |
| 3006 | 2992 | * and skip ASID cleanup (the ASID is tied to the lifetime of the owner). | |
modified arch/x86/kvm/vmx/nested.c
| @@ -3465,6 +3465,10 @@ static bool nested_get_vmcs12_pages(struct kvm_vcpu *vcpu) | |||
| 3465 | 3465 | } else { | |
| 3466 | 3466 | pr_debug_ratelimited("%s: no backing for APIC-access address in vmcs12\n", | |
| 3467 | 3467 | __func__); | |
| 3468 | + | vcpu->run->exit_reason = KVM_EXIT_INTERNAL_ERROR; | |
| 3469 | + | vcpu->run->internal.suberror = | |
| 3470 | + | KVM_INTERNAL_ERROR_EMULATION; | |
| 3471 | + | vcpu->run->internal.ndata = 0; | |
| 3468 | 3472 | return false; | |
| 3469 | 3473 | } | |
| 3470 | 3474 | } | |
| @@ -3535,6 +3539,11 @@ static bool vmx_get_nested_state_pages(struct kvm_vcpu *vcpu) | |||
| 3535 | 3539 | if (!nested_get_evmcs_page(vcpu)) { | |
| 3536 | 3540 | pr_debug_ratelimited("%s: enlightened vmptrld failed\n", | |
| 3537 | 3541 | __func__); | |
| 3542 | + | vcpu->run->exit_reason = KVM_EXIT_INTERNAL_ERROR; | |
| 3543 | + | vcpu->run->internal.suberror = | |
| 3544 | + | KVM_INTERNAL_ERROR_EMULATION; | |
| 3545 | + | vcpu->run->internal.ndata = 0; | |
| 3546 | + | ||
| 3538 | 3547 | return false; | |
| 3539 | 3548 | } | |
| 3540 | 3549 | #endif | |
| @@ -3906,12 +3915,8 @@ static int nested_vmx_run(struct kvm_vcpu *vcpu, bool launch) | |||
| 3906 | 3915 | ||
| 3907 | 3916 | vmentry_failed: | |
| 3908 | 3917 | vcpu->arch.nested_run_pending = 0; | |
| 3909 | - | if (status == NVMX_VMENTRY_KVM_INTERNAL_ERROR) { | |
| 3910 | - | vcpu->run->exit_reason = KVM_EXIT_INTERNAL_ERROR; | |
| 3911 | - | vcpu->run->internal.suberror = KVM_INTERNAL_ERROR_EMULATION; | |
| 3912 | - | vcpu->run->internal.ndata = 0; | |
| 3918 | + | if (status == NVMX_VMENTRY_KVM_INTERNAL_ERROR) | |
| 3913 | 3919 | return 0; | |
| 3914 | - | } | |
| 3915 | 3920 | if (status == NVMX_VMENTRY_VMEXIT) | |
| 3916 | 3921 | return 1; | |
| 3917 | 3922 | WARN_ON_ONCE(status != NVMX_VMENTRY_VMFAIL); | |
modified arch/x86/kvm/vmx/pmu_intel.c
| @@ -187,9 +187,6 @@ static bool intel_is_valid_msr(struct kvm_vcpu *vcpu, u32 msr) | |||
| 187 | 187 | int ret; | |
| 188 | 188 | ||
| 189 | 189 | switch (msr) { | |
| 190 | - | case MSR_CORE_PERF_GLOBAL_STATUS: | |
| 191 | - | case MSR_CORE_PERF_GLOBAL_CTRL: | |
| 192 | - | case MSR_CORE_PERF_GLOBAL_OVF_CTRL: | |
| 193 | 190 | case MSR_CORE_PERF_FIXED_CTR_CTRL: | |
| 194 | 191 | return kvm_pmu_has_perf_global_ctrl(pmu); | |
| 195 | 192 | case MSR_IA32_PEBS_ENABLE: | |
modified arch/x86/kvm/vmx/tdx.c
| @@ -1995,7 +1995,7 @@ static int tdx_handle_ept_violation(struct kvm_vcpu *vcpu) | |||
| 1995 | 1995 | if (kvm_vcpu_has_events(vcpu) || signal_pending(current)) | |
| 1996 | 1996 | break; | |
| 1997 | 1997 | ||
| 1998 | - | if (kvm_test_request(KVM_REQ_VM_DEAD, vcpu)) { | |
| 1998 | + | if (kvm_check_request(KVM_REQ_VM_DEAD, vcpu)) { | |
| 1999 | 1999 | ret = -EIO; | |
| 2000 | 2000 | break; | |
| 2001 | 2001 | } | |
modified arch/x86/kvm/x86.c
| @@ -8060,7 +8060,7 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu) | |||
| 8060 | 8060 | bool req_immediate_exit = false; | |
| 8061 | 8061 | ||
| 8062 | 8062 | if (kvm_request_pending(vcpu)) { | |
| 8063 | - | if (kvm_test_request(KVM_REQ_VM_DEAD, vcpu)) { | |
| 8063 | + | if (kvm_check_request(KVM_REQ_VM_DEAD, vcpu)) { | |
| 8064 | 8064 | r = -EIO; | |
| 8065 | 8065 | goto out; | |
| 8066 | 8066 | } | |
| @@ -8072,10 +8072,6 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu) | |||
| 8072 | 8072 | ||
| 8073 | 8073 | if (kvm_check_request(KVM_REQ_GET_NESTED_STATE_PAGES, vcpu)) { | |
| 8074 | 8074 | if (unlikely(!kvm_nested_call(get_nested_state_pages)(vcpu))) { | |
| 8075 | - | vcpu->run->exit_reason = KVM_EXIT_INTERNAL_ERROR; | |
| 8076 | - | vcpu->run->internal.suberror = KVM_INTERNAL_ERROR_EMULATION; | |
| 8077 | - | vcpu->run->internal.ndata = 0; | |
| 8078 | - | kvm_make_request(KVM_REQ_GET_NESTED_STATE_PAGES, vcpu); | |
| 8079 | 8075 | r = 0; | |
| 8080 | 8076 | goto out; | |
| 8081 | 8077 | } | |
modified arch/x86/mm/mem_encrypt.c
| @@ -13,7 +13,6 @@ | |||
| 13 | 13 | #include <linux/cc_platform.h> | |
| 14 | 14 | #include <linux/mem_encrypt.h> | |
| 15 | 15 | #include <linux/virtio_anchor.h> | |
| 16 | - | #include <linux/iommu-dma.h> | |
| 17 | 16 | ||
| 18 | 17 | #include <asm/sev.h> | |
| 19 | 18 | ||
| @@ -31,7 +30,7 @@ bool force_dma_unencrypted(struct device *dev) | |||
| 31 | 30 | * device does not support DMA to addresses that include the | |
| 32 | 31 | * encryption mask. | |
| 33 | 32 | */ | |
| 34 | - | if (cc_platform_has(CC_ATTR_HOST_MEM_ENCRYPT) && !use_dma_iommu(dev)) { | |
| 33 | + | if (cc_platform_has(CC_ATTR_HOST_MEM_ENCRYPT)) { | |
| 35 | 34 | u64 dma_enc_mask = DMA_BIT_MASK(__ffs64(sme_me_mask)); | |
| 36 | 35 | u64 dma_dev_mask = min_not_zero(dev->coherent_dma_mask, | |
| 37 | 36 | dev->bus_dma_limit); | |
modified arch/x86/mm/pat/set_memory.c
| @@ -22,7 +22,6 @@ | |||
| 22 | 22 | #include <linux/cc_platform.h> | |
| 23 | 23 | #include <linux/set_memory.h> | |
| 24 | 24 | #include <linux/memregion.h> | |
| 25 | - | #include <linux/cleanup.h> | |
| 26 | 25 | ||
| 27 | 26 | #include <asm/e820/api.h> | |
| 28 | 27 | #include <asm/processor.h> | |
| @@ -50,8 +49,7 @@ struct cpa_data { | |||
| 50 | 49 | unsigned int flags; | |
| 51 | 50 | unsigned int force_split : 1, | |
| 52 | 51 | force_static_prot : 1, | |
| 53 | - | force_flush_all : 1, | |
| 54 | - | init_mm_read_locked : 1; | |
| 52 | + | force_flush_all : 1; | |
| 55 | 53 | struct page **pages; | |
| 56 | 54 | }; | |
| 57 | 55 | ||
| @@ -411,7 +409,7 @@ static void __cpa_flush_tlb(void *data) | |||
| 411 | 409 | ||
| 412 | 410 | static int collapse_large_pages(unsigned long addr, struct list_head *pgtables); | |
| 413 | 411 | ||
| 414 | - | static void __cpa_collapse_large_pages(struct cpa_data *cpa) | |
| 412 | + | static void cpa_collapse_large_pages(struct cpa_data *cpa) | |
| 415 | 413 | { | |
| 416 | 414 | unsigned long start, addr, end; | |
| 417 | 415 | struct ptdesc *ptdesc, *tmp; | |
| @@ -441,30 +439,10 @@ static void __cpa_collapse_large_pages(struct cpa_data *cpa) | |||
| 441 | 439 | ||
| 442 | 440 | list_for_each_entry_safe(ptdesc, tmp, &pgtables, pt_list) { | |
| 443 | 441 | list_del(&ptdesc->pt_list); | |
| 444 | - | /* | |
| 445 | - | * Only early alloc'd direct map should not be flagged PG_table | |
| 446 | - | * here and those shouldn't be collapsed. However be abundantly | |
| 447 | - | * cautious and handle the !PG_table case too. | |
| 448 | - | */ | |
| 449 | - | if (PageTable((ptdesc_page(ptdesc)))) | |
| 450 | - | pagetable_dtor_free(ptdesc); | |
| 451 | - | else | |
| 452 | - | pagetable_free(ptdesc); | |
| 442 | + | pagetable_free(ptdesc); | |
| 453 | 443 | } | |
| 454 | 444 | } | |
| 455 | 445 | ||
| 456 | - | static void cpa_collapse_large_pages(struct cpa_data *cpa) | |
| 457 | - | { | |
| 458 | - | /* | |
| 459 | - | * Take the mmap write lock on init_mm to: | |
| 460 | - | * - Avoid a use-after-free if raced by ptdump (which takes its own | |
| 461 | - | * write lock on init_mm). | |
| 462 | - | * - Serialise concurrent CPA walkers. | |
| 463 | - | */ | |
| 464 | - | scoped_guard(mmap_write_lock, &init_mm) | |
| 465 | - | __cpa_collapse_large_pages(cpa); | |
| 466 | - | } | |
| 467 | - | ||
| 468 | 446 | static void cpa_flush(struct cpa_data *cpa, int cache) | |
| 469 | 447 | { | |
| 470 | 448 | unsigned int i; | |
| @@ -1142,10 +1120,11 @@ set: | |||
| 1142 | 1120 | ||
| 1143 | 1121 | static int | |
| 1144 | 1122 | __split_large_page(struct cpa_data *cpa, pte_t *kpte, unsigned long address, | |
| 1145 | - | pte_t *pbase) | |
| 1123 | + | struct ptdesc *ptdesc) | |
| 1146 | 1124 | { | |
| 1147 | 1125 | unsigned long lpaddr, lpinc, ref_pfn, pfn, pfninc = 1; | |
| 1148 | - | struct page *base = virt_to_page(pbase); | |
| 1126 | + | struct page *base = ptdesc_page(ptdesc); | |
| 1127 | + | pte_t *pbase = (pte_t *)page_address(base); | |
| 1149 | 1128 | unsigned int i, level; | |
| 1150 | 1129 | pgprot_t ref_prot; | |
| 1151 | 1130 | bool nx, rw; | |
| @@ -1245,20 +1224,16 @@ __split_large_page(struct cpa_data *cpa, pte_t *kpte, unsigned long address, | |||
| 1245 | 1224 | static int split_large_page(struct cpa_data *cpa, pte_t *kpte, | |
| 1246 | 1225 | unsigned long address) | |
| 1247 | 1226 | { | |
| 1248 | - | pte_t *pte; | |
| 1227 | + | struct ptdesc *ptdesc; | |
| 1249 | 1228 | ||
| 1250 | 1229 | spin_unlock(&cpa_lock); | |
| 1251 | - | if (cpa->init_mm_read_locked) | |
| 1252 | - | mmap_read_unlock(&init_mm); | |
| 1253 | - | pte = pte_alloc_one_kernel(&init_mm); | |
| 1254 | - | if (cpa->init_mm_read_locked) | |
| 1255 | - | mmap_read_lock(&init_mm); | |
| 1230 | + | ptdesc = pagetable_alloc(GFP_KERNEL, 0); | |
| 1256 | 1231 | spin_lock(&cpa_lock); | |
| 1257 | - | if (!pte) | |
| 1232 | + | if (!ptdesc) | |
| 1258 | 1233 | return -ENOMEM; | |
| 1259 | 1234 | ||
| 1260 | - | if (__split_large_page(cpa, kpte, address, pte)) | |
| 1261 | - | pte_free_kernel(&init_mm, pte); | |
| 1235 | + | if (__split_large_page(cpa, kpte, address, ptdesc)) | |
| 1236 | + | pagetable_free(ptdesc); | |
| 1262 | 1237 | ||
| 1263 | 1238 | return 0; | |
| 1264 | 1239 | } | |
| @@ -2146,11 +2121,7 @@ static int change_page_attr_set_clr(unsigned long *addr, int numpages, | |||
| 2146 | 2121 | cpa.curpage = 0; | |
| 2147 | 2122 | cpa.force_split = force_split; | |
| 2148 | 2123 | ||
| 2149 | - | /* Avoid race with concurrent CPA collapse. */ | |
| 2150 | - | cpa.init_mm_read_locked = true; | |
| 2151 | - | scoped_guard(mmap_read_lock, &init_mm) | |
| 2152 | - | ret = __change_page_attr_set_clr(&cpa, 1); | |
| 2153 | - | cpa.init_mm_read_locked = false; | |
| 2124 | + | ret = __change_page_attr_set_clr(&cpa, 1); | |
| 2154 | 2125 | ||
| 2155 | 2126 | /* | |
| 2156 | 2127 | * Check whether we really changed something: | |
modified arch/x86/pci/fixup.c
| @@ -886,105 +886,6 @@ static void quirk_clear_strap_no_soft_reset_dev2_f0(struct pci_dev *dev) | |||
| 886 | 886 | } | |
| 887 | 887 | } | |
| 888 | 888 | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, 0x15b8, quirk_clear_strap_no_soft_reset_dev2_f0); | |
| 889 | - | ||
| 890 | - | /* | |
| 891 | - | * Enhanced atomic operations can cause corruption with 64-bit DMA | |
| 892 | - | * on these devices. | |
| 893 | - | */ | |
| 894 | - | #define RX_ENH_ATOMIC_EN BIT(8) | |
| 895 | - | ||
| 896 | - | static const u32 nbio_7_7_pcie_smn_addrs[] = { | |
| 897 | - | 0x111401d0, | |
| 898 | - | 0x111411d0, | |
| 899 | - | 0x111421d0, | |
| 900 | - | 0x111431d0, | |
| 901 | - | 0x111441d0, | |
| 902 | - | 0x112401d0, | |
| 903 | - | 0x112411d0, | |
| 904 | - | 0x112421d0, | |
| 905 | - | 0x112431d0, | |
| 906 | - | 0x112441d0, | |
| 907 | - | 0x112451d0, | |
| 908 | - | 0x113401d0, | |
| 909 | - | 0x114401d0, | |
| 910 | - | }; | |
| 911 | - | ||
| 912 | - | static const u32 nbio_7_11_pcie_smn_addrs[] = { | |
| 913 | - | 0x112401d0, | |
| 914 | - | 0x112411d0, | |
| 915 | - | 0x112421d0, | |
| 916 | - | 0x112431d0, | |
| 917 | - | 0x112441d0, | |
| 918 | - | 0x112451d0, | |
| 919 | - | 0x113401d0, | |
| 920 | - | 0x113411d0, | |
| 921 | - | 0x113421d0, | |
| 922 | - | 0x113431d0, | |
| 923 | - | 0x113441d0, | |
| 924 | - | 0x113451d0, | |
| 925 | - | }; | |
| 926 | - | ||
| 927 | - | static void quirk_amd_nbio_enhanced_atomic(struct pci_dev *host_bridge, | |
| 928 | - | const u32 *smn_addrs, | |
| 929 | - | size_t nr_smn_addrs) | |
| 930 | - | { | |
| 931 | - | bool changed = false; | |
| 932 | - | size_t i; | |
| 933 | - | u32 data; | |
| 934 | - | int ret; | |
| 935 | - | ||
| 936 | - | for (i = 0; i < nr_smn_addrs; i++) { | |
| 937 | - | ret = amd_smn_read(0, smn_addrs[i], &data); | |
| 938 | - | if (ret) | |
| 939 | - | continue; | |
| 940 | - | if (!(data & RX_ENH_ATOMIC_EN)) | |
| 941 | - | continue; | |
| 942 | - | data = data & ~RX_ENH_ATOMIC_EN; | |
| 943 | - | ret = amd_smn_write(0, smn_addrs[i], data); | |
| 944 | - | if (ret) | |
| 945 | - | continue; | |
| 946 | - | if (changed) | |
| 947 | - | continue; | |
| 948 | - | ret = amd_smn_read(0, smn_addrs[i], &data); | |
| 949 | - | if (ret) | |
| 950 | - | continue; | |
| 951 | - | if (data & RX_ENH_ATOMIC_EN) | |
| 952 | - | continue; | |
| 953 | - | changed = true; | |
| 954 | - | } | |
| 955 | - | ||
| 956 | - | if (changed) | |
| 957 | - | pci_info(host_bridge, "enhanced atomics disabled\n"); | |
| 958 | - | } | |
| 959 | - | ||
| 960 | - | static void quirk_amd_nbio_7_7_disable_enhanced_atomic(struct pci_dev *dev) | |
| 961 | - | { | |
| 962 | - | quirk_amd_nbio_enhanced_atomic(dev, nbio_7_7_pcie_smn_addrs, | |
| 963 | - | ARRAY_SIZE(nbio_7_7_pcie_smn_addrs)); | |
| 964 | - | } | |
| 965 | - | ||
| 966 | - | static void quirk_amd_nbio_7_11_disable_enhanced_atomic(struct pci_dev *dev) | |
| 967 | - | { | |
| 968 | - | quirk_amd_nbio_enhanced_atomic(dev, nbio_7_11_pcie_smn_addrs, | |
| 969 | - | ARRAY_SIZE(nbio_7_11_pcie_smn_addrs)); | |
| 970 | - | } | |
| 971 | - | ||
| 972 | - | /* Phoenix, Hawk Point (NBIO 7.7) */ | |
| 973 | - | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, 0x14E8, | |
| 974 | - | quirk_amd_nbio_7_7_disable_enhanced_atomic); | |
| 975 | - | DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_AMD, 0x14E8, | |
| 976 | - | quirk_amd_nbio_7_7_disable_enhanced_atomic); | |
| 977 | - | ||
| 978 | - | /* Strix, Krackan, Strix Halo (NBIO 7.11) */ | |
| 979 | - | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, 0x1507, | |
| 980 | - | quirk_amd_nbio_7_11_disable_enhanced_atomic); | |
| 981 | - | DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_AMD, 0x1507, | |
| 982 | - | quirk_amd_nbio_7_11_disable_enhanced_atomic); | |
| 983 | - | DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, 0x1122, | |
| 984 | - | quirk_amd_nbio_7_11_disable_enhanced_atomic); | |
| 985 | - | DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_AMD, 0x1122, | |
| 986 | - | quirk_amd_nbio_7_11_disable_enhanced_atomic); | |
| 987 | - | ||
| 988 | 889 | #endif | |
| 989 | 890 | ||
| 990 | 891 | /* | |
modified block/blk-zoned.c
| @@ -2018,17 +2018,12 @@ static int disk_revalidate_zone_resources(struct gendisk *disk, | |||
| 2018 | 2018 | struct blk_revalidate_zone_args *args) | |
| 2019 | 2019 | { | |
| 2020 | 2020 | struct queue_limits *lim = &disk->queue->limits; | |
| 2021 | - | unsigned long long nr_zones; | |
| 2022 | 2021 | unsigned int pool_size; | |
| 2023 | 2022 | int ret = 0; | |
| 2024 | 2023 | ||
| 2025 | 2024 | args->disk = disk; | |
| 2026 | - | nr_zones = DIV_ROUND_UP_ULL(get_capacity(disk), lim->chunk_sectors); | |
| 2027 | - | if (nr_zones > UINT_MAX) { | |
| 2028 | - | pr_warn("%s: Too many zones (%llu)\n", disk->disk_name, nr_zones); | |
| 2029 | - | return -EINVAL; | |
| 2030 | - | } | |
| 2031 | - | args->nr_zones = nr_zones; | |
| 2025 | + | args->nr_zones = | |
| 2026 | + | DIV_ROUND_UP_ULL(get_capacity(disk), lim->chunk_sectors); | |
| 2032 | 2027 | ||
| 2033 | 2028 | /* Cached zone conditions: 1 byte per zone */ | |
| 2034 | 2029 | args->zones_cond = kzalloc(args->nr_zones, GFP_NOIO); | |
| @@ -2136,12 +2131,6 @@ static int blk_revalidate_zone_cond(struct blk_zone *zone, unsigned int idx, | |||
| 2136 | 2131 | { | |
| 2137 | 2132 | enum blk_zone_cond cond = zone->cond; | |
| 2138 | 2133 | ||
| 2139 | - | if (idx >= args->nr_zones) { | |
| 2140 | - | pr_warn("%s: Zone report index %u exceeds zone count %u\n", | |
| 2141 | - | args->disk->disk_name, idx, args->nr_zones); | |
| 2142 | - | return -EINVAL; | |
| 2143 | - | } | |
| 2144 | - | ||
| 2145 | 2134 | /* Check that the zone condition is consistent with the zone type. */ | |
| 2146 | 2135 | switch (cond) { | |
| 2147 | 2136 | case BLK_ZONE_COND_NOT_WP: | |
modified drivers/accel/amdxdna/Kconfig
| @@ -6,6 +6,7 @@ config DRM_ACCEL_AMDXDNA | |||
| 6 | 6 | depends on DRM_ACCEL | |
| 7 | 7 | depends on PCI && HAS_IOMEM | |
| 8 | 8 | depends on X86_64 | |
| 9 | + | depends on AMD_PMF || !AMD_PMF | |
| 9 | 10 | select DRM_SCHED | |
| 10 | 11 | select DRM_GEM_SHMEM_HELPER | |
| 11 | 12 | select FW_LOADER | |
modified drivers/accel/rocket/rocket_device.c
| @@ -31,6 +31,8 @@ struct rocket_device *rocket_device_init(struct platform_device *pdev, | |||
| 31 | 31 | if (of_device_is_available(core_node)) | |
| 32 | 32 | num_cores++; | |
| 33 | 33 | ||
| 34 | + | rdev->max_cores = num_cores; | |
| 35 | + | ||
| 34 | 36 | rdev->cores = devm_kcalloc(dev, num_cores, sizeof(*rdev->cores), GFP_KERNEL); | |
| 35 | 37 | if (!rdev->cores) | |
| 36 | 38 | return ERR_PTR(-ENOMEM); | |
modified drivers/accel/rocket/rocket_device.h
| @@ -19,6 +19,7 @@ struct rocket_device { | |||
| 19 | 19 | ||
| 20 | 20 | struct rocket_core *cores; | |
| 21 | 21 | unsigned int num_cores; | |
| 22 | + | unsigned int max_cores; | |
| 22 | 23 | }; | |
| 23 | 24 | ||
| 24 | 25 | struct rocket_device *rocket_device_init(struct platform_device *pdev, | |
modified drivers/accel/rocket/rocket_drv.c
| @@ -165,8 +165,11 @@ static int rocket_probe(struct platform_device *pdev) | |||
| 165 | 165 | /* First core probing, initialize DRM device. */ | |
| 166 | 166 | rdev = rocket_device_init(drm_dev, &rocket_drm_driver); | |
| 167 | 167 | if (IS_ERR(rdev)) { | |
| 168 | + | int err = PTR_ERR(rdev); | |
| 169 | + | ||
| 168 | 170 | dev_err(&pdev->dev, "failed to initialize rocket device\n"); | |
| 169 | - | return PTR_ERR(rdev); | |
| 171 | + | rdev = NULL; | |
| 172 | + | return err; | |
| 170 | 173 | } | |
| 171 | 174 | } | |
| 172 | 175 | ||
| @@ -223,7 +226,7 @@ static int find_core_for_dev(struct device *dev) | |||
| 223 | 226 | { | |
| 224 | 227 | struct rocket_device *rdev = dev_get_drvdata(dev); | |
| 225 | 228 | ||
| 226 | - | for (unsigned int core = 0; core < rdev->num_cores; core++) { | |
| 229 | + | for (unsigned int core = 0; core < rdev->max_cores; core++) { | |
| 227 | 230 | if (dev == rdev->cores[core].dev) | |
| 228 | 231 | return core; | |
| 229 | 232 | } | |
modified drivers/accel/rocket/rocket_job.c
| @@ -283,7 +283,7 @@ static struct rocket_core *sched_to_core(struct rocket_device *rdev, | |||
| 283 | 283 | { | |
| 284 | 284 | unsigned int core; | |
| 285 | 285 | ||
| 286 | - | for (core = 0; core < rdev->num_cores; core++) { | |
| 286 | + | for (core = 0; core < rdev->max_cores; core++) { | |
| 287 | 287 | if (&rdev->cores[core].sched == sched) | |
| 288 | 288 | return &rdev->cores[core]; | |
| 289 | 289 | } | |
modified drivers/ata/libahci.c
| @@ -744,28 +744,15 @@ void ahci_start_fis_rx(struct ata_port *ap) | |||
| 744 | 744 | struct ahci_port_priv *pp = ap->private_data; | |
| 745 | 745 | u32 tmp; | |
| 746 | 746 | ||
| 747 | - | /* | |
| 748 | - | * On HBAs that only support 32-bit addressing PxCLBU is read only '0'. | |
| 749 | - | * When applying the AHCI_HFLAG_32BIT_ONLY quirk, PxCLBU is RW, and the | |
| 750 | - | * reset value is Implementation Specific, so we need to clear it to 0. | |
| 751 | - | */ | |
| 747 | + | /* set FIS registers */ | |
| 752 | 748 | if (hpriv->cap & HOST_CAP_64) | |
| 753 | 749 | writel((pp->cmd_slot_dma >> 16) >> 16, | |
| 754 | 750 | port_mmio + PORT_LST_ADDR_HI); | |
| 755 | - | else if (hpriv->flags & AHCI_HFLAG_32BIT_ONLY) | |
| 756 | - | writel(0, port_mmio + PORT_LST_ADDR_HI); | |
| 757 | 751 | writel(pp->cmd_slot_dma & 0xffffffff, port_mmio + PORT_LST_ADDR); | |
| 758 | 752 | ||
| 759 | - | /* | |
| 760 | - | * On HBAs that only support 32-bit addressing PxFBU is read only '0'. | |
| 761 | - | * When applying the AHCI_HFLAG_32BIT_ONLY quirk, PxFBU is RW, and the | |
| 762 | - | * reset value is Implementation Specific, so we need to clear it to 0. | |
| 763 | - | */ | |
| 764 | 753 | if (hpriv->cap & HOST_CAP_64) | |
| 765 | 754 | writel((pp->rx_fis_dma >> 16) >> 16, | |
| 766 | 755 | port_mmio + PORT_FIS_ADDR_HI); | |
| 767 | - | else if (hpriv->flags & AHCI_HFLAG_32BIT_ONLY) | |
| 768 | - | writel(0, port_mmio + PORT_FIS_ADDR_HI); | |
| 769 | 756 | writel(pp->rx_fis_dma & 0xffffffff, port_mmio + PORT_FIS_ADDR); | |
| 770 | 757 | ||
| 771 | 758 | /* enable FIS reception */ | |
modified drivers/ata/libahci_platform.c
| @@ -620,10 +620,10 @@ struct ahci_host_priv *ahci_platform_get_resources(struct platform_device *pdev, | |||
| 620 | 620 | of_platform_device_create(child, NULL, NULL); | |
| 621 | 621 | ||
| 622 | 622 | port_dev = of_find_device_by_node(child); | |
| 623 | + | ||
| 623 | 624 | if (port_dev) { | |
| 624 | 625 | rc = ahci_platform_get_regulator(hpriv, port, | |
| 625 | 626 | &port_dev->dev); | |
| 626 | - | put_device(&port_dev->dev); | |
| 627 | 627 | if (rc == -EPROBE_DEFER) | |
| 628 | 628 | goto err_out; | |
| 629 | 629 | } | |
modified drivers/ata/libata-core.c
| @@ -2972,10 +2972,9 @@ static void ata_dev_config_lpm(struct ata_device *dev) | |||
| 2972 | 2972 | (dev->id[ATA_ID_SATA_CAPABILITY] & 0xe) == 0x2) | |
| 2973 | 2973 | dev->quirks |= ATA_QUIRK_NOLPM; | |
| 2974 | 2974 | ||
| 2975 | - | /* ATI and AMD specific quirk */ | |
| 2976 | - | if ((dev->quirks & ATA_QUIRK_NO_LPM_ON_ATI_AND_AMD) && | |
| 2977 | - | (ata_dev_check_adapter(dev, PCI_VENDOR_ID_ATI) || | |
| 2978 | - | ata_dev_check_adapter(dev, PCI_VENDOR_ID_AMD))) | |
| 2975 | + | /* ATI specific quirk */ | |
| 2976 | + | if ((dev->quirks & ATA_QUIRK_NO_LPM_ON_ATI) && | |
| 2977 | + | ata_dev_check_adapter(dev, PCI_VENDOR_ID_ATI)) | |
| 2979 | 2978 | dev->quirks |= ATA_QUIRK_NOLPM; | |
| 2980 | 2979 | } | |
| 2981 | 2980 | ||
| @@ -4137,7 +4136,7 @@ static const char * const ata_quirk_names[] = { | |||
| 4137 | 4136 | [__ATA_QUIRK_MAX_SEC] = "maxsec", | |
| 4138 | 4137 | [__ATA_QUIRK_MAX_TRIM_128M] = "maxtrim128m", | |
| 4139 | 4138 | [__ATA_QUIRK_NO_NCQ_ON_ATI] = "noncqonati", | |
| 4140 | - | [__ATA_QUIRK_NO_LPM_ON_ATI_AND_AMD] = "nolpmonatiandamd", | |
| 4139 | + | [__ATA_QUIRK_NO_LPM_ON_ATI] = "nolpmonati", | |
| 4141 | 4140 | [__ATA_QUIRK_NO_ID_DEV_LOG] = "noiddevlog", | |
| 4142 | 4141 | [__ATA_QUIRK_NO_LOG_DIR] = "nologdir", | |
| 4143 | 4142 | [__ATA_QUIRK_NO_FUA] = "nofua", | |
| @@ -4421,15 +4420,15 @@ static const struct ata_dev_quirks_entry __ata_dev_quirks[] = { | |||
| 4421 | 4420 | { "Samsung SSD 860*", NULL, ATA_QUIRK_NO_NCQ_TRIM | | |
| 4422 | 4421 | ATA_QUIRK_ZERO_AFTER_TRIM | | |
| 4423 | 4422 | ATA_QUIRK_NO_NCQ_ON_ATI | | |
| 4424 | - | ATA_QUIRK_NO_LPM_ON_ATI_AND_AMD }, | |
| 4423 | + | ATA_QUIRK_NO_LPM_ON_ATI }, | |
| 4425 | 4424 | { "Samsung SSD 870*", NULL, ATA_QUIRK_NO_NCQ_TRIM | | |
| 4426 | 4425 | ATA_QUIRK_ZERO_AFTER_TRIM | | |
| 4427 | 4426 | ATA_QUIRK_NO_NCQ_ON_ATI | | |
| 4428 | - | ATA_QUIRK_NO_LPM_ON_ATI_AND_AMD }, | |
| 4427 | + | ATA_QUIRK_NO_LPM_ON_ATI }, | |
| 4429 | 4428 | { "SAMSUNG*MZ7LH*", NULL, ATA_QUIRK_NO_NCQ_TRIM | | |
| 4430 | 4429 | ATA_QUIRK_ZERO_AFTER_TRIM | | |
| 4431 | 4430 | ATA_QUIRK_NO_NCQ_ON_ATI | | |
| 4432 | - | ATA_QUIRK_NO_LPM_ON_ATI_AND_AMD }, | |
| 4431 | + | ATA_QUIRK_NO_LPM_ON_ATI }, | |
| 4433 | 4432 | { "FCCT*M500*", NULL, ATA_QUIRK_NO_NCQ_TRIM | | |
| 4434 | 4433 | ATA_QUIRK_ZERO_AFTER_TRIM }, | |
| 4435 | 4434 | ||
modified drivers/ata/libata-scsi.c
| @@ -261,18 +261,12 @@ static void ata_scsi_set_passthru_sense_fields(struct ata_queued_cmd *qc) | |||
| 261 | 261 | ||
| 262 | 262 | /* descriptor format */ | |
| 263 | 263 | len = sb[7]; | |
| 264 | - | desc = (char *)scsi_sense_desc_find(sb, SCSI_SENSE_BUFFERSIZE, 9); | |
| 264 | + | desc = (char *)scsi_sense_desc_find(sb, len + 8, 9); | |
| 265 | 265 | if (!desc) { | |
| 266 | - | /* | |
| 267 | - | * The descriptor is written at sb[8 + len] and is 14 | |
| 268 | - | * bytes long, so it needs len + 22 bytes of buffer. | |
| 269 | - | */ | |
| 270 | - | if (len + 22 > SCSI_SENSE_BUFFERSIZE) | |
| 266 | + | if (SCSI_SENSE_BUFFERSIZE < len + 14) | |
| 271 | 267 | return; | |
| 272 | 268 | sb[7] = len + 14; | |
| 273 | 269 | desc = sb + 8 + len; | |
| 274 | - | } else if (desc - sb > SCSI_SENSE_BUFFERSIZE - 14) { | |
| 275 | - | return; | |
| 276 | 270 | } | |
| 277 | 271 | desc[0] = 9; | |
| 278 | 272 | desc[1] = 12; | |
| @@ -2303,9 +2297,10 @@ static unsigned int ata_scsiop_inq_89(struct ata_device *dev, | |||
| 2303 | 2297 | * logical block, so it can hold at most sector_size / 512 pages. | |
| 2304 | 2298 | * | |
| 2305 | 2299 | * Return: the maximum number of 512-byte pages a single translated WRITE SAME | |
| 2306 | - | * command may send to @dev, that is the smaller of MAX PAGES PER DSM COMMAND | |
| 2307 | - | * (IDENTIFY DEVICE word 105, when the device reports a non-zero limit) and | |
| 2308 | - | * the logical sector size expressed in 512-byte pages; never less than one. | |
| 2300 | + | * command may send to @dev (never less than one), that is the smaller of: | |
| 2301 | + | * - MAX PAGES PER DSM COMMAND (IDENTIFY DEVICE word 105), when the device | |
| 2302 | + | * reports a non-zero limit; and | |
| 2303 | + | * - the logical sector size expressed in 512-byte pages (see above). | |
| 2309 | 2304 | */ | |
| 2310 | 2305 | static unsigned int ata_dsm_trim_pages(struct ata_device *dev) | |
| 2311 | 2306 | { | |
modified drivers/base/cacheinfo.c
| @@ -1040,10 +1040,9 @@ static int cacheinfo_cpu_online(unsigned int cpu) | |||
| 1040 | 1040 | rc = cache_add_dev(cpu); | |
| 1041 | 1041 | if (rc) | |
| 1042 | 1042 | goto err; | |
| 1043 | - | if (cpu_map_shared_cache(true, cpu, &cpu_map)) { | |
| 1043 | + | if (cpu_map_shared_cache(true, cpu, &cpu_map)) | |
| 1044 | 1044 | update_per_cpu_data_slice_size(true, cpu, cpu_map); | |
| 1045 | - | sched_update_llc_bytes(cpu_map); | |
| 1046 | - | } | |
| 1045 | + | sched_update_llc_bytes(cpu); | |
| 1047 | 1046 | return 0; | |
| 1048 | 1047 | err: | |
| 1049 | 1048 | free_cache_attributes(cpu); | |
| @@ -1060,10 +1059,10 @@ static int cacheinfo_cpu_pre_down(unsigned int cpu) | |||
| 1060 | 1059 | cpu_cache_sysfs_exit(cpu); | |
| 1061 | 1060 | ||
| 1062 | 1061 | free_cache_attributes(cpu); | |
| 1063 | - | if (nr_shared > 1) { | |
| 1062 | + | if (nr_shared > 1) | |
| 1064 | 1063 | update_per_cpu_data_slice_size(false, cpu, cpu_map); | |
| 1065 | - | sched_update_llc_bytes(cpu_map); | |
| 1066 | - | } | |
| 1064 | + | ||
| 1065 | + | sched_update_llc_bytes(cpu); | |
| 1067 | 1066 | ||
| 1068 | 1067 | return 0; | |
| 1069 | 1068 | } | |
modified drivers/bluetooth/btintel_pcie.c
| @@ -404,12 +404,6 @@ static int btintel_pcie_send_sync(struct btintel_pcie_data *data, | |||
| 404 | 404 | if (tfd_index > txq->count) | |
| 405 | 405 | return -ERANGE; | |
| 406 | 406 | ||
| 407 | - | if (skb->len > BTINTEL_PCIE_BUFFER_SIZE - BTINTEL_PCIE_HCI_TYPE_LEN) { | |
| 408 | - | bt_dev_err(hdev, "TX skb too large (%u > %u)", skb->len, | |
| 409 | - | BTINTEL_PCIE_BUFFER_SIZE - BTINTEL_PCIE_HCI_TYPE_LEN); | |
| 410 | - | return -EMSGSIZE; | |
| 411 | - | } | |
| 412 | - | ||
| 413 | 407 | /* Firmware raises alive interrupt on HCI_OP_RESET or | |
| 414 | 408 | * BTINTEL_HCI_OP_RESET | |
| 415 | 409 | */ | |
| @@ -508,7 +502,7 @@ static int btintel_pcie_submit_rx(struct btintel_pcie_data *data) | |||
| 508 | 502 | ||
| 509 | 503 | frbd_index = data->ia.tr_hia[BTINTEL_PCIE_RXQ_NUM]; | |
| 510 | 504 | ||
| 511 | - | if (frbd_index >= rxq->count) | |
| 505 | + | if (frbd_index > rxq->count) | |
| 512 | 506 | return -ERANGE; | |
| 513 | 507 | ||
| 514 | 508 | /* Prepare for RX submit. It updates the FRBD with the address of DMA | |
| @@ -1099,11 +1093,6 @@ static void btintel_pcie_msix_tx_handle(struct btintel_pcie_data *data) | |||
| 1099 | 1093 | ||
| 1100 | 1094 | txq = &data->txq; | |
| 1101 | 1095 | ||
| 1102 | - | if (cr_hia >= txq->count) { | |
| 1103 | - | bt_dev_err(data->hdev, "TXQ: invalid cr_hia %u", cr_hia); | |
| 1104 | - | return; | |
| 1105 | - | } | |
| 1106 | - | ||
| 1107 | 1096 | while (cr_tia != cr_hia) { | |
| 1108 | 1097 | data->tx_wait_done = true; | |
| 1109 | 1098 | wake_up(&data->tx_wait_q); | |
| @@ -1655,11 +1644,6 @@ static void btintel_pcie_msix_rx_handle(struct btintel_pcie_data *data) | |||
| 1655 | 1644 | ||
| 1656 | 1645 | rxq = &data->rxq; | |
| 1657 | 1646 | ||
| 1658 | - | if (cr_hia >= rxq->count) { | |
| 1659 | - | bt_dev_err(hdev, "RXQ: invalid cr_hia %u", cr_hia); | |
| 1660 | - | return; | |
| 1661 | - | } | |
| 1662 | - | ||
| 1663 | 1647 | /* The firmware sends multiple CD in a single MSI-X and it needs to | |
| 1664 | 1648 | * process all received CDs in this interrupt. | |
| 1665 | 1649 | */ | |
| @@ -1667,12 +1651,6 @@ static void btintel_pcie_msix_rx_handle(struct btintel_pcie_data *data) | |||
| 1667 | 1651 | urbd1 = &rxq->urbd1s[cr_tia]; | |
| 1668 | 1652 | ipc_print_urbd1(data->hdev, urbd1, cr_tia); | |
| 1669 | 1653 | ||
| 1670 | - | if (urbd1->frbd_tag >= rxq->count) { | |
| 1671 | - | bt_dev_err(hdev, "RXQ: invalid frbd_tag %u", | |
| 1672 | - | urbd1->frbd_tag); | |
| 1673 | - | return; | |
| 1674 | - | } | |
| 1675 | - | ||
| 1676 | 1654 | buf = &rxq->bufs[urbd1->frbd_tag]; | |
| 1677 | 1655 | if (!buf) { | |
| 1678 | 1656 | bt_dev_err(hdev, "RXQ: failed to get the DMA buffer for %d", | |
modified drivers/bluetooth/btmtk.c
| @@ -721,12 +721,7 @@ static int btmtk_usb_hci_wmt_sync(struct hci_dev *hdev, | |||
| 721 | 721 | case BTMTK_WMT_FUNC_CTRL: | |
| 722 | 722 | if (!skb_pull_data(data->evt_skb, | |
| 723 | 723 | sizeof(wmt_evt_funcc->status))) { | |
| 724 | - | /* A plain enable/disable request is acked with just | |
| 725 | - | * the WMT header and no trailing status word; the | |
| 726 | - | * result is carried in the header's own flag byte. | |
| 727 | - | */ | |
| 728 | - | status = wmt_evt->whdr.flag ? BTMTK_WMT_ON_UNDONE : | |
| 729 | - | BTMTK_WMT_ON_DONE; | |
| 724 | + | status = BTMTK_WMT_ON_UNDONE; | |
| 730 | 725 | break; | |
| 731 | 726 | } | |
| 732 | 727 | ||
modified drivers/bluetooth/btmtksdio.c
| @@ -217,14 +217,7 @@ static int mtk_hci_wmt_sync(struct hci_dev *hdev, | |||
| 217 | 217 | } | |
| 218 | 218 | ||
| 219 | 219 | /* Parse and handle the return WMT event */ | |
| 220 | - | wmt_evt = skb_pull_data(bdev->evt_skb, sizeof(*wmt_evt)); | |
| 221 | - | if (!wmt_evt) { | |
| 222 | - | bt_dev_err(hdev, "WMT event too short (%u bytes)", | |
| 223 | - | bdev->evt_skb->len); | |
| 224 | - | err = -EINVAL; | |
| 225 | - | goto err_free_skb; | |
| 226 | - | } | |
| 227 | - | ||
| 220 | + | wmt_evt = (struct btmtk_hci_wmt_evt *)bdev->evt_skb->data; | |
| 228 | 221 | if (wmt_evt->whdr.op != hdr->op) { | |
| 229 | 222 | bt_dev_err(hdev, "Wrong op received %d expected %d", | |
| 230 | 223 | wmt_evt->whdr.op, hdr->op); | |
| @@ -240,17 +233,6 @@ static int mtk_hci_wmt_sync(struct hci_dev *hdev, | |||
| 240 | 233 | status = BTMTK_WMT_PATCH_DONE; | |
| 241 | 234 | break; | |
| 242 | 235 | case BTMTK_WMT_FUNC_CTRL: | |
| 243 | - | if (!skb_pull_data(bdev->evt_skb, | |
| 244 | - | sizeof(wmt_evt_funcc->status))) { | |
| 245 | - | /* A plain enable/disable request is acked with just | |
| 246 | - | * the WMT header and no trailing status word; the | |
| 247 | - | * result is carried in the header's own flag byte. | |
| 248 | - | */ | |
| 249 | - | status = wmt_evt->whdr.flag ? BTMTK_WMT_ON_UNDONE : | |
| 250 | - | BTMTK_WMT_ON_DONE; | |
| 251 | - | break; | |
| 252 | - | } | |
| 253 | - | ||
| 254 | 236 | wmt_evt_funcc = (struct btmtk_hci_wmt_evt_funcc *)wmt_evt; | |
| 255 | 237 | if (be16_to_cpu(wmt_evt_funcc->status) == 0x404) | |
| 256 | 238 | status = BTMTK_WMT_ON_DONE; | |
| @@ -1262,8 +1244,10 @@ static int btmtksdio_shutdown(struct hci_dev *hdev) | |||
| 1262 | 1244 | wmt_params.status = NULL; | |
| 1263 | 1245 | ||
| 1264 | 1246 | err = mtk_hci_wmt_sync(hdev, &wmt_params); | |
| 1265 | - | if (err < 0) | |
| 1247 | + | if (err < 0) { | |
| 1266 | 1248 | bt_dev_err(hdev, "Failed to send wmt func ctrl (%d)", err); | |
| 1249 | + | return err; | |
| 1250 | + | } | |
| 1267 | 1251 | ||
| 1268 | 1252 | ignore_wmt_cmd: | |
| 1269 | 1253 | pm_runtime_put_noidle(bdev->dev); | |
modified drivers/bluetooth/btmtkuart.c
| @@ -151,14 +151,7 @@ static int mtk_hci_wmt_sync(struct hci_dev *hdev, | |||
| 151 | 151 | } | |
| 152 | 152 | ||
| 153 | 153 | /* Parse and handle the return WMT event */ | |
| 154 | - | wmt_evt = skb_pull_data(bdev->evt_skb, sizeof(*wmt_evt)); | |
| 155 | - | if (!wmt_evt) { | |
| 156 | - | bt_dev_err(hdev, "WMT event too short (%u bytes)", | |
| 157 | - | bdev->evt_skb->len); | |
| 158 | - | err = -EINVAL; | |
| 159 | - | goto err_free_wc; | |
| 160 | - | } | |
| 161 | - | ||
| 154 | + | wmt_evt = (struct btmtk_hci_wmt_evt *)bdev->evt_skb->data; | |
| 162 | 155 | if (wmt_evt->whdr.op != hdr->op) { | |
| 163 | 156 | bt_dev_err(hdev, "Wrong op received %d expected %d", | |
| 164 | 157 | wmt_evt->whdr.op, hdr->op); | |
| @@ -174,17 +167,6 @@ static int mtk_hci_wmt_sync(struct hci_dev *hdev, | |||
| 174 | 167 | status = BTMTK_WMT_PATCH_DONE; | |
| 175 | 168 | break; | |
| 176 | 169 | case BTMTK_WMT_FUNC_CTRL: | |
| 177 | - | if (!skb_pull_data(bdev->evt_skb, | |
| 178 | - | sizeof(wmt_evt_funcc->status))) { | |
| 179 | - | /* A plain enable/disable request is acked with just | |
| 180 | - | * the WMT header and no trailing status word; the | |
| 181 | - | * result is carried in the header's own flag byte. | |
| 182 | - | */ | |
| 183 | - | status = wmt_evt->whdr.flag ? BTMTK_WMT_ON_UNDONE : | |
| 184 | - | BTMTK_WMT_ON_DONE; | |
| 185 | - | break; | |
| 186 | - | } | |
| 187 | - | ||
| 188 | 170 | wmt_evt_funcc = (struct btmtk_hci_wmt_evt_funcc *)wmt_evt; | |
| 189 | 171 | if (be16_to_cpu(wmt_evt_funcc->status) == 0x404) | |
| 190 | 172 | status = BTMTK_WMT_ON_DONE; | |
modified drivers/bluetooth/btnxpuart.c
| @@ -1388,11 +1388,9 @@ static int nxp_process_fw_dump(struct hci_dev *hdev, struct sk_buff *skb) | |||
| 1388 | 1388 | msecs_to_jiffies(20000)); | |
| 1389 | 1389 | } | |
| 1390 | 1390 | ||
| 1391 | - | if (IS_ENABLED(CONFIG_DEV_COREDUMP)) { | |
| 1392 | - | err = hci_devcd_append(hdev, skb_clone(skb, GFP_ATOMIC)); | |
| 1393 | - | if (err < 0) | |
| 1394 | - | goto free_skb; | |
| 1395 | - | } | |
| 1391 | + | err = hci_devcd_append(hdev, skb_clone(skb, GFP_ATOMIC)); | |
| 1392 | + | if (err < 0) | |
| 1393 | + | goto free_skb; | |
| 1396 | 1394 | ||
| 1397 | 1395 | if (buf_len == 0) { | |
| 1398 | 1396 | bt_dev_warn(hdev, "==== FW dump complete ==="); | |
modified drivers/bluetooth/btusb.c
| @@ -71,15 +71,6 @@ static struct usb_driver btusb_driver; | |||
| 71 | 71 | #define BTUSB_BROKEN_EXT_SCAN BIT(29) | |
| 72 | 72 | ||
| 73 | 73 | static const struct usb_device_id btusb_table[] = { | |
| 74 | - | /* | |
| 75 | - | * NXP IW610 (0471:0215): the composite device reports Bluetooth | |
| 76 | - | * class at the whole-device level, so the generic entry below | |
| 77 | - | * would also match this WiFi vendor interface. Ignore it here | |
| 78 | - | * first so mwifiex-nxp can bind it instead. | |
| 79 | - | */ | |
| 80 | - | { USB_DEVICE_AND_INTERFACE_INFO(0x0471, 0x0215, 0xff, 0xff, 0xff), | |
| 81 | - | .driver_info = BTUSB_IGNORE }, | |
| 82 | - | ||
| 83 | 74 | /* Generic Bluetooth USB device */ | |
| 84 | 75 | { USB_DEVICE_INFO(0xe0, 0x01, 0x01) }, | |
| 85 | 76 | ||
| @@ -486,14 +477,6 @@ static const struct usb_device_id quirks_table[] = { | |||
| 486 | 477 | { USB_DEVICE(0x1286, 0x2046), .driver_info = BTUSB_MARVELL }, | |
| 487 | 478 | { USB_DEVICE(0x1286, 0x204e), .driver_info = BTUSB_MARVELL }, | |
| 488 | 479 | ||
| 489 | - | /* | |
| 490 | - | * NXP IW610 BT interfaces (Marvell-lineage silicon, same quirk as | |
| 491 | - | * the 0x1286 entries above). Scoped to the BT interface class, | |
| 492 | - | * not just VID/PID -- see the btusb_table entry above. | |
| 493 | - | */ | |
| 494 | - | { USB_DEVICE_AND_INTERFACE_INFO(0x0471, 0x0215, 0xe0, 0x01, 0x01), | |
| 495 | - | .driver_info = BTUSB_MARVELL }, | |
| 496 | - | ||
| 497 | 480 | /* Intel Bluetooth devices */ | |
| 498 | 481 | { USB_DEVICE(0x8087, 0x0025), .driver_info = BTUSB_INTEL_COMBINED }, | |
| 499 | 482 | { USB_DEVICE(0x8087, 0x0026), .driver_info = BTUSB_INTEL_COMBINED }, | |
modified drivers/bluetooth/hci_qca.c
| @@ -2228,8 +2228,8 @@ static void qca_power_off(struct hci_uart *hu) | |||
| 2228 | 2228 | bool sw_ctrl_state; | |
| 2229 | 2229 | struct qca_power *power; | |
| 2230 | 2230 | ||
| 2231 | - | /* From this point we go into power off state. But serial port may | |
| 2232 | - | * still be open, stop queueing the IBS data and flush all the buffered | |
| 2231 | + | /* From this point we go into power off state. But serial port is | |
| 2232 | + | * still open, stop queueing the IBS data and flush all the buffered | |
| 2233 | 2233 | * data in skb's. | |
| 2234 | 2234 | */ | |
| 2235 | 2235 | spin_lock_irqsave(&qca->hci_ibs_lock, flags); | |
| @@ -2251,14 +2251,8 @@ static void qca_power_off(struct hci_uart *hu) | |||
| 2251 | 2251 | case QCA_WCN3990: | |
| 2252 | 2252 | case QCA_WCN3991: | |
| 2253 | 2253 | case QCA_WCN3998: | |
| 2254 | - | /* Both of these write to the serial port which may have | |
| 2255 | - | * already been closed by hci_uart_close(), which closes | |
| 2256 | - | * the port if HCI_QUIRK_NON_PERSISTENT_SETUP is set. | |
| 2257 | - | */ | |
| 2258 | - | if (test_bit(HCI_UART_PROTO_READY, &hu->flags)) { | |
| 2259 | - | host_set_baudrate(hu, 2400); | |
| 2260 | - | qca_send_power_pulse(hu, false); | |
| 2261 | - | } | |
| 2254 | + | host_set_baudrate(hu, 2400); | |
| 2255 | + | qca_send_power_pulse(hu, false); | |
| 2262 | 2256 | break; | |
| 2263 | 2257 | default: | |
| 2264 | 2258 | break; | |
modified drivers/clk/clk-scpi.c
| @@ -73,7 +73,7 @@ static unsigned long scpi_dvfs_recalc_rate(struct clk_hw *hw, | |||
| 73 | 73 | int idx = clk->scpi_ops->dvfs_get_idx(clk->id); | |
| 74 | 74 | const struct scpi_opp *opp; | |
| 75 | 75 | ||
| 76 | - | if (idx < 0 || idx >= clk->info->count) | |
| 76 | + | if (idx < 0) | |
| 77 | 77 | return 0; | |
| 78 | 78 | ||
| 79 | 79 | opp = clk->info->opps + idx; | |
| @@ -272,15 +272,10 @@ static int scpi_clocks_probe(struct platform_device *pdev) | |||
| 272 | 272 | if (match->data != &scpi_dvfs_ops) | |
| 273 | 273 | continue; | |
| 274 | 274 | /* Add the virtual cpufreq device if it's DVFS clock provider */ | |
| 275 | - | if (cpufreq_dev) | |
| 276 | - | continue; | |
| 277 | 275 | cpufreq_dev = platform_device_register_simple("scpi-cpufreq", | |
| 278 | - | PLATFORM_DEVID_NONE, | |
| 279 | - | NULL, 0); | |
| 280 | - | if (IS_ERR(cpufreq_dev)) { | |
| 276 | + | -1, NULL, 0); | |
| 277 | + | if (IS_ERR(cpufreq_dev)) | |
| 281 | 278 | pr_warn("unable to register cpufreq device"); | |
| 282 | - | cpufreq_dev = NULL; | |
| 283 | - | } | |
| 284 | 279 | } | |
| 285 | 280 | return 0; | |
| 286 | 281 | } | |
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/crypto/caam/jr.c
| @@ -583,29 +583,12 @@ static int caam_jr_probe(struct platform_device *pdev) | |||
| 583 | 583 | struct caam_drv_private_jr *jrpriv; | |
| 584 | 584 | static int total_jobrs; | |
| 585 | 585 | void __iomem *ctrl; | |
| 586 | - | struct resource *r; | |
| 587 | 586 | int error; | |
| 588 | 587 | int irq; | |
| 589 | 588 | ||
| 590 | - | /* | |
| 591 | - | * The job rings live inside the register window of their parent | |
| 592 | - | * fsl,sec-v4.0 node, which caam_probe() already reserves (and maps) | |
| 593 | - | * via devm_of_iomap(). A requested region that overlaps that | |
| 594 | - | * reservation, e.g. from devm_platform_ioremap_resource(), would | |
| 595 | - | * therefore fail with -EBUSY, so map the registers without claiming | |
| 596 | - | * the region here. | |
| 597 | - | */ | |
| 598 | - | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); | |
| 599 | - | if (!r) { | |
| 600 | - | dev_err(&pdev->dev, "platform_get_resource() failed\n"); | |
| 601 | - | return -EINVAL; | |
| 602 | - | } | |
| 603 | - | ||
| 604 | - | ctrl = devm_ioremap(&pdev->dev, r->start, resource_size(r)); | |
| 605 | - | if (!ctrl) { | |
| 606 | - | dev_err(&pdev->dev, "devm_ioremap() failed\n"); | |
| 607 | - | return -ENOMEM; | |
| 608 | - | } | |
| 589 | + | ctrl = devm_platform_ioremap_resource(pdev, 0); | |
| 590 | + | if (IS_ERR(ctrl)) | |
| 591 | + | return PTR_ERR(ctrl); | |
| 609 | 592 | ||
| 610 | 593 | irq = platform_get_irq(pdev, 0); | |
| 611 | 594 | if (irq < 0) | |
modified drivers/dma-buf/Kconfig
| @@ -43,7 +43,7 @@ config UDMABUF | |||
| 43 | 43 | config DMABUF_DEBUG | |
| 44 | 44 | bool "DMA-BUF debug checks" | |
| 45 | 45 | depends on DMA_SHARED_BUFFER | |
| 46 | - | default y if DEBUG_KERNEL | |
| 46 | + | default y if DEBUG | |
| 47 | 47 | help | |
| 48 | 48 | This option enables additional checks for DMA-BUF importers and | |
| 49 | 49 | exporters. Specifically it validates that importers do not peek at the | |
modified drivers/dma/dmaengine.c
| @@ -428,18 +428,11 @@ static void dma_device_release(struct kref *ref) | |||
| 428 | 428 | ||
| 429 | 429 | list_del_rcu(&device->global_node); | |
| 430 | 430 | dma_channel_rebalance(); | |
| 431 | - | synchronize_rcu(); | |
| 432 | 431 | ||
| 433 | 432 | if (device->device_release) | |
| 434 | 433 | device->device_release(device); | |
| 435 | 434 | } | |
| 436 | 435 | ||
| 437 | - | static int __must_check dma_device_get(struct dma_device *device) | |
| 438 | - | { | |
| 439 | - | lockdep_assert_held(&dma_list_mutex); | |
| 440 | - | return kref_get_unless_zero(&device->ref); | |
| 441 | - | } | |
| 442 | - | ||
| 443 | 436 | static void dma_device_put(struct dma_device *device) | |
| 444 | 437 | { | |
| 445 | 438 | lockdep_assert_held(&dma_list_mutex); | |
| @@ -467,7 +460,8 @@ static int dma_chan_get(struct dma_chan *chan) | |||
| 467 | 460 | if (!try_module_get(owner)) | |
| 468 | 461 | return -ENODEV; | |
| 469 | 462 | ||
| 470 | - | if (!dma_device_get(chan->device)) { | |
| 463 | + | ret = kref_get_unless_zero(&chan->device->ref); | |
| 464 | + | if (!ret) { | |
| 471 | 465 | ret = -ENODEV; | |
| 472 | 466 | goto module_put_out; | |
| 473 | 467 | } | |
| @@ -501,13 +495,10 @@ module_put_out: | |||
| 501 | 495 | */ | |
| 502 | 496 | static void dma_chan_put(struct dma_chan *chan) | |
| 503 | 497 | { | |
| 504 | - | struct module *owner; | |
| 505 | - | ||
| 506 | 498 | /* This channel is not in use, bail out */ | |
| 507 | 499 | if (!chan->client_count) | |
| 508 | 500 | return; | |
| 509 | 501 | ||
| 510 | - | owner = dma_chan_to_owner(chan); | |
| 511 | 502 | chan->client_count--; | |
| 512 | 503 | ||
| 513 | 504 | /* This channel is not in use anymore, free it */ | |
| @@ -524,10 +515,8 @@ static void dma_chan_put(struct dma_chan *chan) | |||
| 524 | 515 | chan->route_data = NULL; | |
| 525 | 516 | } | |
| 526 | 517 | ||
| 527 | - | /* This channel is not in use anymore, drop the device ref */ | |
| 528 | - | if (!chan->client_count) | |
| 529 | - | dma_device_put(chan->device); | |
| 530 | - | module_put(owner); | |
| 518 | + | dma_device_put(chan->device); | |
| 519 | + | module_put(dma_chan_to_owner(chan)); | |
| 531 | 520 | } | |
| 532 | 521 | ||
| 533 | 522 | enum dma_status dma_sync_wait(struct dma_chan *chan, dma_cookie_t cookie) | |
modified drivers/dma/mmp_pdma.c
| @@ -52,6 +52,7 @@ | |||
| 52 | 52 | #define DCSR_EORINTR BIT(9) /* The end of Receive */ | |
| 53 | 53 | ||
| 54 | 54 | #define DRCMR_BASE 0x0100 | |
| 55 | + | #define DRCMR_EXT_BASE_K3 0x1000 | |
| 55 | 56 | #define DRCMR_EXT_BASE_DEFAULT 0x1100 | |
| 56 | 57 | #define DRCMR_REQ_LIMIT 64 | |
| 57 | 58 | #define DRCMR_MAPVLD BIT(7) /* Map Valid (read / write) */ | |
| @@ -712,7 +713,7 @@ mmp_pdma_prep_slave_sg(struct dma_chan *dchan, struct scatterlist *sgl, | |||
| 712 | 713 | ||
| 713 | 714 | for_each_sg(sgl, sg, sg_len, i) { | |
| 714 | 715 | addr = sg_dma_address(sg); | |
| 715 | - | avail = sg_dma_len(sg); | |
| 716 | + | avail = sg_dma_len(sgl); | |
| 716 | 717 | ||
| 717 | 718 | do { | |
| 718 | 719 | len = min_t(size_t, avail, PDMA_MAX_DESC_BYTES); | |
| @@ -1218,7 +1219,7 @@ static const struct mmp_pdma_ops spacemit_k3_pdma_ops = { | |||
| 1218 | 1219 | .get_desc_dst_addr = get_desc_dst_addr_64, | |
| 1219 | 1220 | .run_bits = (DCSR_RUN | DCSR_LPAEEN | DCSR_EORIRQEN | DCSR_EORSTOPEN), | |
| 1220 | 1221 | .dma_width = 64, | |
| 1221 | - | .drcmr_ext_base = DRCMR_EXT_BASE_DEFAULT, | |
| 1222 | + | .drcmr_ext_base = DRCMR_EXT_BASE_K3, | |
| 1222 | 1223 | }; | |
| 1223 | 1224 | ||
| 1224 | 1225 | static const struct of_device_id mmp_pdma_dt_ids[] = { | |
modified drivers/dma/pxa_dma.c
| @@ -744,7 +744,6 @@ pxad_alloc_desc(struct pxad_chan *chan, unsigned int nb_hw_desc) | |||
| 744 | 744 | sw_desc = kzalloc_flex(*sw_desc, hw_desc, nb_hw_desc, GFP_NOWAIT); | |
| 745 | 745 | if (!sw_desc) | |
| 746 | 746 | return NULL; | |
| 747 | - | sw_desc->nb_desc = nb_hw_desc; | |
| 748 | 747 | sw_desc->desc_pool = chan->desc_pool; | |
| 749 | 748 | ||
| 750 | 749 | for (i = 0; i < nb_hw_desc; i++) { | |
| @@ -753,10 +752,10 @@ pxad_alloc_desc(struct pxad_chan *chan, unsigned int nb_hw_desc) | |||
| 753 | 752 | dev_err(&chan->vc.chan.dev->device, | |
| 754 | 753 | "%s(): Couldn't allocate the %dth hw_desc from dma_pool %p\n", | |
| 755 | 754 | __func__, i, sw_desc->desc_pool); | |
| 756 | - | sw_desc->nb_desc = i; | |
| 757 | 755 | goto err; | |
| 758 | 756 | } | |
| 759 | 757 | ||
| 758 | + | sw_desc->nb_desc++; | |
| 760 | 759 | sw_desc->hw_desc[i] = desc; | |
| 761 | 760 | ||
| 762 | 761 | if (i == 0) | |
modified drivers/dma/sprd-dma.c
| @@ -1212,7 +1212,7 @@ static int sprd_dma_probe(struct platform_device *pdev) | |||
| 1212 | 1212 | ||
| 1213 | 1213 | ret = pm_runtime_get_sync(&pdev->dev); | |
| 1214 | 1214 | if (ret < 0) | |
| 1215 | - | goto err_register; | |
| 1215 | + | goto err_rpm; | |
| 1216 | 1216 | ||
| 1217 | 1217 | ret = dma_async_device_register(&sdev->dma_dev); | |
| 1218 | 1218 | if (ret < 0) { | |
| @@ -1234,6 +1234,7 @@ err_of_register: | |||
| 1234 | 1234 | err_register: | |
| 1235 | 1235 | pm_runtime_put_noidle(&pdev->dev); | |
| 1236 | 1236 | pm_runtime_disable(&pdev->dev); | |
| 1237 | + | err_rpm: | |
| 1237 | 1238 | sprd_dma_disable(sdev); | |
| 1238 | 1239 | return ret; | |
| 1239 | 1240 | } | |
modified drivers/dma/sun6i-dma.c
| @@ -354,10 +354,8 @@ static size_t sun6i_get_chan_size(struct sun6i_pchan *pchan) | |||
| 354 | 354 | size_t bytes; | |
| 355 | 355 | dma_addr_t pos; | |
| 356 | 356 | ||
| 357 | - | do { | |
| 358 | - | pos = readl(pchan->base + DMA_CHAN_LLI_ADDR); | |
| 359 | - | bytes = readl(pchan->base + DMA_CHAN_CUR_CNT); | |
| 360 | - | } while (pos != readl(pchan->base + DMA_CHAN_LLI_ADDR)); | |
| 357 | + | pos = readl(pchan->base + DMA_CHAN_LLI_ADDR); | |
| 358 | + | bytes = readl(pchan->base + DMA_CHAN_CUR_CNT); | |
| 361 | 359 | ||
| 362 | 360 | if (pos == LLI_LAST_ITEM) | |
| 363 | 361 | return bytes; | |
| @@ -981,6 +979,7 @@ static enum dma_status sun6i_dma_tx_status(struct dma_chan *chan, | |||
| 981 | 979 | struct sun6i_pchan *pchan = vchan->phy; | |
| 982 | 980 | struct sun6i_dma_lli *lli; | |
| 983 | 981 | struct virt_dma_desc *vd; | |
| 982 | + | struct sun6i_desc *txd; | |
| 984 | 983 | enum dma_status ret; | |
| 985 | 984 | unsigned long flags; | |
| 986 | 985 | size_t bytes = 0; | |
| @@ -992,9 +991,9 @@ static enum dma_status sun6i_dma_tx_status(struct dma_chan *chan, | |||
| 992 | 991 | spin_lock_irqsave(&vchan->vc.lock, flags); | |
| 993 | 992 | ||
| 994 | 993 | vd = vchan_find_desc(&vchan->vc, cookie); | |
| 994 | + | txd = to_sun6i_desc(&vd->tx); | |
| 995 | 995 | ||
| 996 | 996 | if (vd) { | |
| 997 | - | struct sun6i_desc *txd = to_sun6i_desc(&vd->tx); | |
| 998 | 997 | for (lli = txd->v_lli; lli != NULL; lli = lli->v_lli_next) | |
| 999 | 998 | bytes += lli->len; | |
| 1000 | 999 | } else if (!pchan || !pchan->desc) { | |
modified drivers/dma/ti/k3-udma-glue.c
| @@ -1243,9 +1243,8 @@ void k3_udma_glue_release_rx_chn(struct k3_udma_glue_rx_channel *rx_chn) | |||
| 1243 | 1243 | rx_chn->psil_paired = false; | |
| 1244 | 1244 | } | |
| 1245 | 1245 | ||
| 1246 | - | if (rx_chn->flows) | |
| 1247 | - | for (i = 0; i < rx_chn->flow_num; i++) | |
| 1248 | - | k3_udma_glue_release_rx_flow(rx_chn, i); | |
| 1246 | + | for (i = 0; i < rx_chn->flow_num; i++) | |
| 1247 | + | k3_udma_glue_release_rx_flow(rx_chn, i); | |
| 1249 | 1248 | ||
| 1250 | 1249 | if (xudma_rflow_is_gp(rx_chn->common.udmax, rx_chn->flow_id_base)) | |
| 1251 | 1250 | xudma_free_gp_rflow_range(rx_chn->common.udmax, | |
modified drivers/dma/xilinx/xilinx_dma.c
| @@ -756,25 +756,15 @@ xilinx_aximcdma_alloc_tx_segment(struct xilinx_dma_chan *chan) | |||
| 756 | 756 | return segment; | |
| 757 | 757 | } | |
| 758 | 758 | ||
| 759 | - | static void xilinx_dma_clean_hw_desc(struct xilinx_dma_chan *chan, | |
| 760 | - | struct xilinx_axidma_tx_segment *segment) | |
| 759 | + | static void xilinx_dma_clean_hw_desc(struct xilinx_axidma_desc_hw *hw) | |
| 761 | 760 | { | |
| 762 | - | dma_addr_t next; | |
| 763 | - | u32 i; | |
| 761 | + | u32 next_desc = hw->next_desc; | |
| 762 | + | u32 next_desc_msb = hw->next_desc_msb; | |
| 764 | 763 | ||
| 765 | - | /* | |
| 766 | - | * Restore the buffer descriptor's next descriptor pointer to the value | |
| 767 | - | * set up in xilinx_dma_alloc_chan_resources(). Otherwise using the DMA | |
| 768 | - | * in cyclic mode leaves the next descriptor pointer altered and | |
| 769 | - | * prevents subsequent non-cyclic transfers. | |
| 770 | - | */ | |
| 771 | - | i = segment - chan->seg_v; | |
| 772 | - | next = chan->seg_p + | |
| 773 | - | sizeof(*chan->seg_v) * ((i + 1) % XILINX_DMA_NUM_DESCS); | |
| 764 | + | memset(hw, 0, sizeof(struct xilinx_axidma_desc_hw)); | |
| 774 | 765 | ||
| 775 | - | memset(&segment->hw, 0, sizeof(segment->hw)); | |
| 776 | - | segment->hw.next_desc = lower_32_bits(next); | |
| 777 | - | segment->hw.next_desc_msb = upper_32_bits(next); | |
| 766 | + | hw->next_desc = next_desc; | |
| 767 | + | hw->next_desc_msb = next_desc_msb; | |
| 778 | 768 | } | |
| 779 | 769 | ||
| 780 | 770 | static void xilinx_mcdma_clean_hw_desc(struct xilinx_aximcdma_desc_hw *hw) | |
| @@ -796,7 +786,7 @@ static void xilinx_mcdma_clean_hw_desc(struct xilinx_aximcdma_desc_hw *hw) | |||
| 796 | 786 | static void xilinx_dma_free_tx_segment(struct xilinx_dma_chan *chan, | |
| 797 | 787 | struct xilinx_axidma_tx_segment *segment) | |
| 798 | 788 | { | |
| 799 | - | xilinx_dma_clean_hw_desc(chan, segment); | |
| 789 | + | xilinx_dma_clean_hw_desc(&segment->hw); | |
| 800 | 790 | ||
| 801 | 791 | list_add_tail(&segment->node, &chan->free_seg_list); | |
| 802 | 792 | } | |
| @@ -930,9 +920,9 @@ static void xilinx_dma_free_descriptors(struct xilinx_dma_chan *chan) | |||
| 930 | 920 | ||
| 931 | 921 | spin_lock_irqsave(&chan->lock, flags); | |
| 932 | 922 | ||
| 923 | + | xilinx_dma_free_desc_list(chan, &chan->pending_list); | |
| 933 | 924 | xilinx_dma_free_desc_list(chan, &chan->done_list); | |
| 934 | 925 | xilinx_dma_free_desc_list(chan, &chan->active_list); | |
| 935 | - | xilinx_dma_free_desc_list(chan, &chan->pending_list); | |
| 936 | 926 | ||
| 937 | 927 | spin_unlock_irqrestore(&chan->lock, flags); | |
| 938 | 928 | } | |
modified drivers/dpll/dpll_netlink.c
| @@ -1202,7 +1202,6 @@ dpll_pin_ref_sync_state_set(struct dpll_pin *pin, | |||
| 1202 | 1202 | const enum dpll_pin_state state, | |
| 1203 | 1203 | struct netlink_ext_ack *extack) | |
| 1204 | 1204 | { | |
| 1205 | - | void *pin_priv, *ref_sync_pin_priv; | |
| 1206 | 1205 | const struct dpll_pin_ops *ops; | |
| 1207 | 1206 | enum dpll_pin_state old_state; | |
| 1208 | 1207 | struct dpll_pin *ref_sync_pin; | |
| @@ -1210,7 +1209,8 @@ dpll_pin_ref_sync_state_set(struct dpll_pin *pin, | |||
| 1210 | 1209 | struct dpll_device *dpll; | |
| 1211 | 1210 | int ret; | |
| 1212 | 1211 | ||
| 1213 | - | ref_sync_pin = xa_load(&pin->ref_sync_pins, ref_sync_pin_idx); | |
| 1212 | + | ref_sync_pin = xa_find(&pin->ref_sync_pins, &ref_sync_pin_idx, | |
| 1213 | + | ULONG_MAX, XA_PRESENT); | |
| 1214 | 1214 | if (!ref_sync_pin) { | |
| 1215 | 1215 | NL_SET_ERR_MSG(extack, "reference sync pin not found"); | |
| 1216 | 1216 | return -EINVAL; | |
| @@ -1230,15 +1230,9 @@ dpll_pin_ref_sync_state_set(struct dpll_pin *pin, | |||
| 1230 | 1230 | return -EOPNOTSUPP; | |
| 1231 | 1231 | } | |
| 1232 | 1232 | dpll = ref->dpll; | |
| 1233 | - | pin_priv = dpll_pin_on_dpll_priv(dpll, pin); | |
| 1234 | - | ref_sync_pin_priv = dpll_pin_on_dpll_priv(dpll, ref_sync_pin); | |
| 1235 | - | /* Pin may have been unregistered from this dpll already */ | |
| 1236 | - | if (!ref_sync_pin_priv) { | |
| 1237 | - | NL_SET_ERR_MSG(extack, | |
| 1238 | - | "reference sync pin not registered with the dpll"); | |
| 1239 | - | return -ENODEV; | |
| 1240 | - | } | |
| 1241 | - | ret = ops->ref_sync_get(pin, pin_priv, ref_sync_pin, ref_sync_pin_priv, | |
| 1233 | + | ret = ops->ref_sync_get(pin, dpll_pin_on_dpll_priv(dpll, pin), | |
| 1234 | + | ref_sync_pin, | |
| 1235 | + | dpll_pin_on_dpll_priv(dpll, ref_sync_pin), | |
| 1242 | 1236 | &old_state, extack); | |
| 1243 | 1237 | if (ret) { | |
| 1244 | 1238 | NL_SET_ERR_MSG(extack, "unable to get old reference sync state"); | |
| @@ -1247,7 +1241,9 @@ dpll_pin_ref_sync_state_set(struct dpll_pin *pin, | |||
| 1247 | 1241 | if (state == old_state) | |
| 1248 | 1242 | return 0; | |
| 1249 | 1243 | ||
| 1250 | - | ret = ops->ref_sync_set(pin, pin_priv, ref_sync_pin, ref_sync_pin_priv, | |
| 1244 | + | ret = ops->ref_sync_set(pin, dpll_pin_on_dpll_priv(dpll, pin), | |
| 1245 | + | ref_sync_pin, | |
| 1246 | + | dpll_pin_on_dpll_priv(dpll, ref_sync_pin), | |
| 1251 | 1247 | state, extack); | |
| 1252 | 1248 | if (ret) { | |
| 1253 | 1249 | NL_SET_ERR_MSG_FMT(extack, | |
modified drivers/firewire/core-cdev.c
| @@ -1397,10 +1397,8 @@ static void iso_resource_auto_work(struct work_struct *work) | |||
| 1397 | 1397 | } else { | |
| 1398 | 1398 | // Transit from allocation to reallocation, except if the client requested | |
| 1399 | 1399 | // deallocation in the meantime. | |
| 1400 | - | scoped_guard(spinlock_irq, &client->lock) { | |
| 1401 | - | if (r->todo == ISO_RES_AUTO_ALLOC) | |
| 1402 | - | r->todo = ISO_RES_AUTO_REALLOC; | |
| 1403 | - | } | |
| 1400 | + | scoped_guard(spinlock_irq, &client->lock) | |
| 1401 | + | r->todo = ISO_RES_AUTO_REALLOC; | |
| 1404 | 1402 | ||
| 1405 | 1403 | if (channel >= 0) | |
| 1406 | 1404 | r->params.channels_mask = BIT_ULL(channel); | |
modified drivers/firmware/arm_ffa/driver.c
| @@ -2225,7 +2225,6 @@ static void ffa_remove(struct platform_device *pdev) | |||
| 2225 | 2225 | static struct platform_driver ffa_driver = { | |
| 2226 | 2226 | .probe = ffa_probe, | |
| 2227 | 2227 | .remove = ffa_remove, | |
| 2228 | - | .shutdown = ffa_remove, | |
| 2229 | 2228 | .driver = { | |
| 2230 | 2229 | .name = FFA_PLATFORM_NAME, | |
| 2231 | 2230 | }, | |
modified drivers/firmware/arm_scmi/driver.c
| @@ -477,7 +477,7 @@ void *scmi_notification_instance_data_get(const struct scmi_handle *handle) | |||
| 477 | 477 | * - exactly 'next_token' may be NOT available so pick xfer_id >= next_token | |
| 478 | 478 | * using find_next_zero_bit() starting from candidate next_token bit | |
| 479 | 479 | * | |
| 480 | - | * - all tokens ahead up to (MSG_TOKEN_ID_MASK - 1) are used in-flight but we | |
| 480 | + | * - all tokens ahead upto (MSG_TOKEN_ID_MASK - 1) are used in-flight but we | |
| 481 | 481 | * are plenty of free tokens at start, so try a second pass using | |
| 482 | 482 | * find_next_zero_bit() and starting from 0. | |
| 483 | 483 | * | |
modified drivers/firmware/arm_scpi.c
| @@ -631,8 +631,8 @@ static struct scpi_dvfs_info *scpi_dvfs_get_info(u8 domain) | |||
| 631 | 631 | if (ret) | |
| 632 | 632 | return ERR_PTR(ret); | |
| 633 | 633 | ||
| 634 | - | if (!buf.opp_count || buf.opp_count > MAX_DVFS_OPPS) | |
| 635 | - | return ERR_PTR(-EINVAL); | |
| 634 | + | if (!buf.opp_count) | |
| 635 | + | return ERR_PTR(-ENOENT); | |
| 636 | 636 | ||
| 637 | 637 | info = kmalloc_obj(*info); | |
| 638 | 638 | if (!info) | |
| @@ -661,15 +661,12 @@ static struct scpi_dvfs_info *scpi_dvfs_get_info(u8 domain) | |||
| 661 | 661 | static int scpi_dev_domain_id(struct device *dev) | |
| 662 | 662 | { | |
| 663 | 663 | struct of_phandle_args clkspec; | |
| 664 | - | int domain; | |
| 665 | 664 | ||
| 666 | 665 | if (of_parse_phandle_with_args(dev->of_node, "clocks", "#clock-cells", | |
| 667 | 666 | 0, &clkspec)) | |
| 668 | 667 | return -EINVAL; | |
| 669 | 668 | ||
| 670 | - | domain = clkspec.args[0]; | |
| 671 | - | of_node_put(clkspec.np); | |
| 672 | - | return domain; | |
| 669 | + | return clkspec.args[0]; | |
| 673 | 670 | } | |
| 674 | 671 | ||
| 675 | 672 | static struct scpi_dvfs_info *scpi_dvfs_info(struct device *dev) | |
modified drivers/gpio/gpio-arizona.c
| @@ -115,12 +115,8 @@ static int arizona_gpio_direction_out(struct gpio_chip *chip, | |||
| 115 | 115 | if (value) | |
| 116 | 116 | value = ARIZONA_GPN_LVL; | |
| 117 | 117 | ||
| 118 | - | ret = regmap_update_bits(arizona->regmap, ARIZONA_GPIO1_CTRL + offset, | |
| 119 | - | ARIZONA_GPN_DIR | ARIZONA_GPN_LVL, value); | |
| 120 | - | if (ret < 0 && (val & ARIZONA_GPN_DIR) && persistent) | |
| 121 | - | pm_runtime_put_autosuspend(chip->parent); | |
| 122 | - | ||
| 123 | - | return ret; | |
| 118 | + | return regmap_update_bits(arizona->regmap, ARIZONA_GPIO1_CTRL + offset, | |
| 119 | + | ARIZONA_GPN_DIR | ARIZONA_GPN_LVL, value); | |
| 124 | 120 | } | |
| 125 | 121 | ||
| 126 | 122 | static int arizona_gpio_set(struct gpio_chip *chip, unsigned int offset, | |
modified drivers/gpio/gpio-mvebu.c
| @@ -1034,8 +1034,6 @@ static int mvebu_gpio_suspend(struct platform_device *pdev, pm_message_t state) | |||
| 1034 | 1034 | static int mvebu_gpio_resume(struct platform_device *pdev) | |
| 1035 | 1035 | { | |
| 1036 | 1036 | struct mvebu_gpio_chip *mvchip = platform_get_drvdata(pdev); | |
| 1037 | - | u32 edge_cache = ~0U, level_cache = ~0U; | |
| 1038 | - | unsigned long flags; | |
| 1039 | 1037 | int i; | |
| 1040 | 1038 | ||
| 1041 | 1039 | regmap_write(mvchip->regs, GPIO_OUT_OFF + mvchip->offset, | |
| @@ -1047,51 +1045,32 @@ static int mvebu_gpio_resume(struct platform_device *pdev) | |||
| 1047 | 1045 | regmap_write(mvchip->regs, GPIO_IN_POL_OFF + mvchip->offset, | |
| 1048 | 1046 | mvchip->in_pol_reg); | |
| 1049 | 1047 | ||
| 1050 | - | /* | |
| 1051 | - | * genirq skips mask_irq() for a line it already considers masked, so | |
| 1052 | - | * unmasking one behind its back leaves an asserted level line that | |
| 1053 | - | * nobody masks. Restore only bits the irqchip cache still has set. | |
| 1054 | - | * | |
| 1055 | - | * Snapshot the caches under the raw spinlock, but release it before | |
| 1056 | - | * the regmap writes below: regmap_write() takes a sleepable lock on | |
| 1057 | - | * PREEMPT_RT. | |
| 1058 | - | */ | |
| 1059 | - | if (mvchip->domain) { | |
| 1060 | - | struct irq_chip_generic *gc; | |
| 1061 | - | ||
| 1062 | - | gc = irq_get_domain_generic_chip(mvchip->domain, 0); | |
| 1063 | - | raw_spin_lock_irqsave(&gc->lock, flags); | |
| 1064 | - | level_cache = gc->chip_types[0].mask_cache_priv; | |
| 1065 | - | edge_cache = gc->chip_types[1].mask_cache_priv; | |
| 1066 | - | raw_spin_unlock_irqrestore(&gc->lock, flags); | |
| 1067 | - | } | |
| 1068 | - | ||
| 1069 | 1048 | switch (mvchip->soc_variant) { | |
| 1070 | 1049 | case MVEBU_GPIO_SOC_VARIANT_ORION: | |
| 1071 | 1050 | case MVEBU_GPIO_SOC_VARIANT_A8K: | |
| 1072 | 1051 | regmap_write(mvchip->regs, GPIO_EDGE_MASK_OFF + mvchip->offset, | |
| 1073 | - | mvchip->edge_mask_regs[0] & edge_cache); | |
| 1052 | + | mvchip->edge_mask_regs[0]); | |
| 1074 | 1053 | regmap_write(mvchip->regs, GPIO_LEVEL_MASK_OFF + mvchip->offset, | |
| 1075 | - | mvchip->level_mask_regs[0] & level_cache); | |
| 1054 | + | mvchip->level_mask_regs[0]); | |
| 1076 | 1055 | break; | |
| 1077 | 1056 | case MVEBU_GPIO_SOC_VARIANT_MV78200: | |
| 1078 | 1057 | for (i = 0; i < 2; i++) { | |
| 1079 | 1058 | regmap_write(mvchip->regs, | |
| 1080 | 1059 | GPIO_EDGE_MASK_MV78200_OFF(i), | |
| 1081 | - | mvchip->edge_mask_regs[i] & edge_cache); | |
| 1060 | + | mvchip->edge_mask_regs[i]); | |
| 1082 | 1061 | regmap_write(mvchip->regs, | |
| 1083 | 1062 | GPIO_LEVEL_MASK_MV78200_OFF(i), | |
| 1084 | - | mvchip->level_mask_regs[i] & level_cache); | |
| 1063 | + | mvchip->level_mask_regs[i]); | |
| 1085 | 1064 | } | |
| 1086 | 1065 | break; | |
| 1087 | 1066 | case MVEBU_GPIO_SOC_VARIANT_ARMADAXP: | |
| 1088 | 1067 | for (i = 0; i < 4; i++) { | |
| 1089 | 1068 | regmap_write(mvchip->regs, | |
| 1090 | 1069 | GPIO_EDGE_MASK_ARMADAXP_OFF(i), | |
| 1091 | - | mvchip->edge_mask_regs[i] & edge_cache); | |
| 1070 | + | mvchip->edge_mask_regs[i]); | |
| 1092 | 1071 | regmap_write(mvchip->regs, | |
| 1093 | 1072 | GPIO_LEVEL_MASK_ARMADAXP_OFF(i), | |
| 1094 | - | mvchip->level_mask_regs[i] & level_cache); | |
| 1073 | + | mvchip->level_mask_regs[i]); | |
| 1095 | 1074 | } | |
| 1096 | 1075 | break; | |
| 1097 | 1076 | default: | |
modified drivers/gpio/gpio-tps65219.c
| @@ -79,7 +79,7 @@ static int tps65219_gpio_get(struct gpio_chip *gc, unsigned int offset) | |||
| 79 | 79 | if (ret) | |
| 80 | 80 | return ret; | |
| 81 | 81 | ||
| 82 | - | ret = !!(val & TPS65219_MFP_GPIO_STATUS_MASK); | |
| 82 | + | ret = !!(val & BIT(TPS65219_MFP_GPIO_STATUS_MASK)); | |
| 83 | 83 | dev_warn(dev, "GPIO%d = %d, MULTI_DEVICE_ENABLE, not a standard GPIO\n", offset, ret); | |
| 84 | 84 | ||
| 85 | 85 | /* | |
| @@ -87,7 +87,7 @@ static int tps65219_gpio_get(struct gpio_chip *gc, unsigned int offset) | |||
| 87 | 87 | * status bit. | |
| 88 | 88 | */ | |
| 89 | 89 | ||
| 90 | - | if (gc->get_direction(gc, offset) == GPIO_LINE_DIRECTION_OUT) | |
| 90 | + | if (tps65219_gpio_get_direction(gc, offset) == GPIO_LINE_DIRECTION_OUT) | |
| 91 | 91 | return -ENOTSUPP; | |
| 92 | 92 | ||
| 93 | 93 | return ret; | |
| @@ -158,10 +158,8 @@ static int tps65214_gpio_change_direction(struct gpio_chip *gc, unsigned int off | |||
| 158 | 158 | if (ret) | |
| 159 | 159 | dev_err(dev, "GPIO%d configured as VSEL, not GPIO\n", offset); | |
| 160 | 160 | ||
| 161 | - | val = direction == GPIO_LINE_DIRECTION_OUT ? | |
| 162 | - | TPS65214_GPIO0_DIR_MASK : 0; | |
| 163 | 161 | ret = regmap_update_bits(gpio->tps->regmap, TPS65219_REG_GENERAL_CONFIG, | |
| 164 | - | TPS65214_GPIO0_DIR_MASK, val); | |
| 162 | + | TPS65214_GPIO0_DIR_MASK, direction); | |
| 165 | 163 | if (ret) | |
| 166 | 164 | dev_err(dev, "Fail to change direction to %u for GPIO%d.\n", direction, offset); | |
| 167 | 165 | ||
| @@ -178,7 +176,7 @@ static int tps65219_gpio_direction_input(struct gpio_chip *gc, unsigned int offs | |||
| 178 | 176 | return -ENOTSUPP; | |
| 179 | 177 | } | |
| 180 | 178 | ||
| 181 | - | if (gc->get_direction(gc, offset) == GPIO_LINE_DIRECTION_IN) | |
| 179 | + | if (tps65219_gpio_get_direction(gc, offset) == GPIO_LINE_DIRECTION_IN) | |
| 182 | 180 | return 0; | |
| 183 | 181 | ||
| 184 | 182 | return gpio->change_dir(gc, offset, GPIO_LINE_DIRECTION_IN); | |
| @@ -192,7 +190,7 @@ static int tps65219_gpio_direction_output(struct gpio_chip *gc, unsigned int off | |||
| 192 | 190 | if (offset != TPS6521X_GPIO0_IDX) | |
| 193 | 191 | return 0; | |
| 194 | 192 | ||
| 195 | - | if (gc->get_direction(gc, offset) == GPIO_LINE_DIRECTION_OUT) | |
| 193 | + | if (tps65219_gpio_get_direction(gc, offset) == GPIO_LINE_DIRECTION_OUT) | |
| 196 | 194 | return 0; | |
| 197 | 195 | ||
| 198 | 196 | return gpio->change_dir(gc, offset, GPIO_LINE_DIRECTION_OUT); | |
modified drivers/gpio/gpio-virtuser.c
| @@ -692,8 +692,7 @@ static int gpio_virtuser_interrupts_set(void *data, u64 val) | |||
| 692 | 692 | atomic_set(&ld->irq, irq); | |
| 693 | 693 | } else { | |
| 694 | 694 | irq = atomic_xchg(&ld->irq, 0); | |
| 695 | - | if (irq) | |
| 696 | - | free_irq(irq, ld); | |
| 695 | + | free_irq(irq, ld); | |
| 697 | 696 | } | |
| 698 | 697 | ||
| 699 | 698 | return 0; | |
modified drivers/gpio/gpio-zynq.c
| @@ -798,7 +798,15 @@ static int zynq_gpio_runtime_resume(struct device *dev) | |||
| 798 | 798 | ||
| 799 | 799 | static int zynq_gpio_request(struct gpio_chip *chip, unsigned int offset) | |
| 800 | 800 | { | |
| 801 | - | return pm_runtime_resume_and_get(chip->parent); | |
| 801 | + | int ret; | |
| 802 | + | ||
| 803 | + | ret = pm_runtime_get_sync(chip->parent); | |
| 804 | + | ||
| 805 | + | /* | |
| 806 | + | * If the device is already active pm_runtime_get() will return 1 on | |
| 807 | + | * success, but gpio_request still needs to return 0. | |
| 808 | + | */ | |
| 809 | + | return ret < 0 ? ret : 0; | |
| 802 | 810 | } | |
| 803 | 811 | ||
| 804 | 812 | static void zynq_gpio_free(struct gpio_chip *chip, unsigned int offset) | |
modified drivers/gpio/gpiolib-cdev.c
| @@ -2172,19 +2172,18 @@ static void gpio_v2_line_info_changed_to_v1( | |||
| 2172 | 2172 | ||
| 2173 | 2173 | #endif /* CONFIG_GPIO_CDEV_V1 */ | |
| 2174 | 2174 | ||
| 2175 | - | static int gpio_desc_to_lineinfo(struct gpio_desc *desc, | |
| 2176 | - | struct gpio_v2_line_info *info, bool atomic) | |
| 2175 | + | static void gpio_desc_to_lineinfo(struct gpio_desc *desc, | |
| 2176 | + | struct gpio_v2_line_info *info, bool atomic) | |
| 2177 | 2177 | { | |
| 2178 | 2178 | u32 debounce_period_us; | |
| 2179 | 2179 | unsigned long dflags; | |
| 2180 | 2180 | const char *label; | |
| 2181 | 2181 | ||
| 2182 | - | memset(info, 0, sizeof(*info)); | |
| 2183 | - | ||
| 2184 | 2182 | CLASS(gpio_chip_guard, guard)(desc); | |
| 2185 | 2183 | if (!guard.gc) | |
| 2186 | - | return -ENODEV; | |
| 2184 | + | return; | |
| 2187 | 2185 | ||
| 2186 | + | memset(info, 0, sizeof(*info)); | |
| 2188 | 2187 | info->offset = gpiod_hwgpio(desc); | |
| 2189 | 2188 | ||
| 2190 | 2189 | if (desc->name) | |
| @@ -2259,8 +2258,6 @@ static int gpio_desc_to_lineinfo(struct gpio_desc *desc, | |||
| 2259 | 2258 | debounce_period_us; | |
| 2260 | 2259 | info->num_attrs++; | |
| 2261 | 2260 | } | |
| 2262 | - | ||
| 2263 | - | return 0; | |
| 2264 | 2261 | } | |
| 2265 | 2262 | ||
| 2266 | 2263 | struct gpio_chardev_data { | |
| @@ -2312,7 +2309,6 @@ static int lineinfo_get_v1(struct gpio_chardev_data *cdev, void __user *ip, | |||
| 2312 | 2309 | struct gpio_desc *desc; | |
| 2313 | 2310 | struct gpioline_info lineinfo; | |
| 2314 | 2311 | struct gpio_v2_line_info lineinfo_v2; | |
| 2315 | - | int ret; | |
| 2316 | 2312 | ||
| 2317 | 2313 | if (copy_from_user(&lineinfo, ip, sizeof(lineinfo))) | |
| 2318 | 2314 | return -EFAULT; | |
| @@ -2330,10 +2326,7 @@ static int lineinfo_get_v1(struct gpio_chardev_data *cdev, void __user *ip, | |||
| 2330 | 2326 | return -EBUSY; | |
| 2331 | 2327 | } | |
| 2332 | 2328 | ||
| 2333 | - | ret = gpio_desc_to_lineinfo(desc, &lineinfo_v2, false); | |
| 2334 | - | if (ret) | |
| 2335 | - | return ret; | |
| 2336 | - | ||
| 2329 | + | gpio_desc_to_lineinfo(desc, &lineinfo_v2, false); | |
| 2337 | 2330 | gpio_v2_line_info_to_v1(&lineinfo_v2, &lineinfo); | |
| 2338 | 2331 | ||
| 2339 | 2332 | if (copy_to_user(ip, &lineinfo, sizeof(lineinfo))) { | |
| @@ -2351,7 +2344,6 @@ static int lineinfo_get(struct gpio_chardev_data *cdev, void __user *ip, | |||
| 2351 | 2344 | { | |
| 2352 | 2345 | struct gpio_desc *desc; | |
| 2353 | 2346 | struct gpio_v2_line_info lineinfo; | |
| 2354 | - | int ret; | |
| 2355 | 2347 | ||
| 2356 | 2348 | if (copy_from_user(&lineinfo, ip, sizeof(lineinfo))) | |
| 2357 | 2349 | return -EFAULT; | |
| @@ -2371,10 +2363,7 @@ static int lineinfo_get(struct gpio_chardev_data *cdev, void __user *ip, | |||
| 2371 | 2363 | if (test_and_set_bit(lineinfo.offset, cdev->watched_lines)) | |
| 2372 | 2364 | return -EBUSY; | |
| 2373 | 2365 | } | |
| 2374 | - | ||
| 2375 | - | ret = gpio_desc_to_lineinfo(desc, &lineinfo, false); | |
| 2376 | - | if (ret) | |
| 2377 | - | return ret; | |
| 2366 | + | gpio_desc_to_lineinfo(desc, &lineinfo, false); | |
| 2378 | 2367 | ||
| 2379 | 2368 | if (copy_to_user(ip, &lineinfo, sizeof(lineinfo))) { | |
| 2380 | 2369 | if (watch) | |
| @@ -2500,7 +2489,6 @@ static int lineinfo_changed_notify(struct notifier_block *nb, | |||
| 2500 | 2489 | struct lineinfo_changed_ctx *ctx; | |
| 2501 | 2490 | struct gpio_desc *desc = data; | |
| 2502 | 2491 | struct file *fp; | |
| 2503 | - | int ret; | |
| 2504 | 2492 | ||
| 2505 | 2493 | if (!test_bit(gpiod_hwgpio(desc), cdev->watched_lines)) | |
| 2506 | 2494 | return NOTIFY_DONE; | |
| @@ -2531,13 +2519,7 @@ static int lineinfo_changed_notify(struct notifier_block *nb, | |||
| 2531 | 2519 | ||
| 2532 | 2520 | ctx->chg.event_type = action; | |
| 2533 | 2521 | ctx->chg.timestamp_ns = ktime_get_ns(); | |
| 2534 | - | ||
| 2535 | - | ret = gpio_desc_to_lineinfo(desc, &ctx->chg.info, true); | |
| 2536 | - | if (ret) { | |
| 2537 | - | fput(fp); | |
| 2538 | - | return NOTIFY_DONE; | |
| 2539 | - | } | |
| 2540 | - | ||
| 2522 | + | gpio_desc_to_lineinfo(desc, &ctx->chg.info, true); | |
| 2541 | 2523 | /* Keep the GPIO device alive until we emit the event. */ | |
| 2542 | 2524 | ctx->gdev = gpio_device_get(desc->gdev); | |
| 2543 | 2525 | ctx->cdev = cdev; | |
modified drivers/gpio/gpiolib-of.c
| @@ -788,13 +788,13 @@ static int of_gpio_notify(struct notifier_block *nb, unsigned long action, | |||
| 788 | 788 | if (!of_property_read_bool(rd->dn, "gpio-hog")) | |
| 789 | 789 | return NOTIFY_DONE; /* not for us */ | |
| 790 | 790 | ||
| 791 | + | if (of_node_test_and_set_flag(rd->dn, OF_POPULATED)) | |
| 792 | + | return NOTIFY_DONE; | |
| 793 | + | ||
| 791 | 794 | gdev = of_find_gpio_device_by_node(rd->dn->parent); | |
| 792 | 795 | if (!gdev) | |
| 793 | 796 | return NOTIFY_DONE; /* not for us */ | |
| 794 | 797 | ||
| 795 | - | if (of_node_test_and_set_flag(rd->dn, OF_POPULATED)) | |
| 796 | - | return NOTIFY_DONE; | |
| 797 | - | ||
| 798 | 798 | ret = gpiochip_add_hog(gpio_device_get_chip(gdev), of_fwnode_handle(rd->dn)); | |
| 799 | 799 | if (ret < 0) { | |
| 800 | 800 | pr_err("%s: failed to add hogs for %pOF\n", __func__, | |
modified drivers/gpio/gpiolib.c
| @@ -1029,13 +1029,6 @@ int gpiochip_add_hog(struct gpio_chip *gc, struct fwnode_handle *fwnode) | |||
| 1029 | 1029 | ret = of_gpiochip_get_lflags(gc, &gpiospec, &lflags); | |
| 1030 | 1030 | if (ret) | |
| 1031 | 1031 | return ret; | |
| 1032 | - | ||
| 1033 | - | /* | |
| 1034 | - | * If no line-name property is present, fall back to the OF | |
| 1035 | - | * node name as in the previous implementation. | |
| 1036 | - | */ | |
| 1037 | - | if (!name) | |
| 1038 | - | name = to_of_node(fwnode)->name; | |
| 1039 | 1032 | } else { | |
| 1040 | 1033 | /* | |
| 1041 | 1034 | * GPIO_ACTIVE_LOW is currently the only lookup flag | |
modified drivers/gpu/drm/amd/amdgpu/amdgpu.h
| @@ -621,9 +621,6 @@ enum amdgpu_enforce_isolation_mode { | |||
| 621 | 621 | struct amdgpu_device { | |
| 622 | 622 | struct device *dev; | |
| 623 | 623 | struct pci_dev *pdev; | |
| 624 | - | /* The two ends of the physical PCIe link outside the device. */ | |
| 625 | - | struct pci_dev *link_dev; | |
| 626 | - | struct pci_dev *link_partner; | |
| 627 | 624 | struct drm_device ddev; | |
| 628 | 625 | ||
| 629 | 626 | #ifdef CONFIG_DRM_AMD_ACP | |
modified drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c
| @@ -1167,10 +1167,8 @@ int amdgpu_acpi_enumerate_xcc(void) | |||
| 1167 | 1167 | } | |
| 1168 | 1168 | ||
| 1169 | 1169 | xcc_info = kzalloc_obj(struct amdgpu_acpi_xcc_info); | |
| 1170 | - | if (!xcc_info) { | |
| 1171 | - | acpi_dev_put(acpi_dev); | |
| 1170 | + | if (!xcc_info) | |
| 1172 | 1171 | return -ENOMEM; | |
| 1173 | - | } | |
| 1174 | 1172 | ||
| 1175 | 1173 | INIT_LIST_HEAD(&xcc_info->list); | |
| 1176 | 1174 | xcc_info->handle = acpi_device_handle(acpi_dev); | |
modified drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
| @@ -330,7 +330,7 @@ void amdgpu_amdkfd_clear_kfd_mapping(struct amdgpu_device *adev) | |||
| 330 | 330 | struct kfd_dev *kfd = adev->kfd.dev; | |
| 331 | 331 | unsigned int i; | |
| 332 | 332 | ||
| 333 | - | if (!kfd || !kfd->init_complete) | |
| 333 | + | if (!kfd) | |
| 334 | 334 | return; | |
| 335 | 335 | ||
| 336 | 336 | for (i = 0; i < kfd->num_nodes; i++) { | |
modified drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
| @@ -1780,10 +1780,8 @@ static int amdgpu_debugfs_test_ib_show(struct seq_file *m, void *unused) | |||
| 1780 | 1780 | ||
| 1781 | 1781 | /* Avoid accidently unparking the sched thread during GPU reset */ | |
| 1782 | 1782 | r = down_write_killable(&adev->reset_domain->sem); | |
| 1783 | - | if (r) { | |
| 1784 | - | pm_runtime_put_autosuspend(dev->dev); | |
| 1783 | + | if (r) | |
| 1785 | 1784 | return r; | |
| 1786 | - | } | |
| 1787 | 1785 | ||
| 1788 | 1786 | /* hold on the scheduler */ | |
| 1789 | 1787 | for (i = 0; i < AMDGPU_MAX_RINGS; i++) { | |
modified drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
| @@ -1954,17 +1954,18 @@ static void amdgpu_uid_fini(struct amdgpu_device *adev) | |||
| 1954 | 1954 | adev->uid_info = NULL; | |
| 1955 | 1955 | } | |
| 1956 | 1956 | ||
| 1957 | - | static void amdgpu_device_init_pcie_links(struct amdgpu_device *adev) | |
| 1957 | + | static struct pci_dev *amdgpu_device_find_parent(struct amdgpu_device *adev) | |
| 1958 | 1958 | { | |
| 1959 | - | adev->link_dev = adev->pdev; | |
| 1960 | - | adev->link_partner = pci_upstream_bridge(adev->link_dev); | |
| 1959 | + | struct pci_dev *parent = adev->pdev; | |
| 1961 | 1960 | ||
| 1962 | - | /* Skip upstream/downstream switches internal to the dGPU. */ | |
| 1963 | - | while (adev->link_partner && | |
| 1964 | - | adev->link_partner->vendor == PCI_VENDOR_ID_ATI) { | |
| 1965 | - | adev->link_dev = adev->link_partner; | |
| 1966 | - | adev->link_partner = pci_upstream_bridge(adev->link_dev); | |
| 1961 | + | /* skip upstream/downstream switches internal to dGPU */ | |
| 1962 | + | while ((parent = pci_upstream_bridge(parent))) { | |
| 1963 | + | if (parent->vendor == PCI_VENDOR_ID_ATI) | |
| 1964 | + | continue; | |
| 1965 | + | break; | |
| 1967 | 1966 | } | |
| 1967 | + | ||
| 1968 | + | return parent; | |
| 1968 | 1969 | } | |
| 1969 | 1970 | ||
| 1970 | 1971 | /** | |
| @@ -1980,6 +1981,7 @@ static void amdgpu_device_init_pcie_links(struct amdgpu_device *adev) | |||
| 1980 | 1981 | static int amdgpu_device_ip_early_init(struct amdgpu_device *adev) | |
| 1981 | 1982 | { | |
| 1982 | 1983 | struct amdgpu_ip_block *ip_block; | |
| 1984 | + | struct pci_dev *parent; | |
| 1983 | 1985 | bool total, skip_bios, early_full_gpu_access = false; | |
| 1984 | 1986 | uint32_t bios_flags; | |
| 1985 | 1987 | int i, r; | |
| @@ -2075,9 +2077,10 @@ static int amdgpu_device_ip_early_init(struct amdgpu_device *adev) | |||
| 2075 | 2077 | !dev_is_removable(&adev->pdev->dev)) | |
| 2076 | 2078 | adev->flags |= AMD_IS_PX; | |
| 2077 | 2079 | ||
| 2078 | - | if (!(adev->flags & AMD_IS_APU)) | |
| 2079 | - | adev->has_pr3 = adev->link_partner && | |
| 2080 | - | pci_pr3_present(adev->link_partner); | |
| 2080 | + | if (!(adev->flags & AMD_IS_APU)) { | |
| 2081 | + | parent = amdgpu_device_find_parent(adev); | |
| 2082 | + | adev->has_pr3 = parent ? pci_pr3_present(parent) : false; | |
| 2083 | + | } | |
| 2081 | 2084 | ||
| 2082 | 2085 | adev->pm.pp_feature = amdgpu_pp_feature_mask; | |
| 2083 | 2086 | if (amdgpu_sriov_vf(adev) || sched_policy == KFD_SCHED_POLICY_NO_HWS) | |
| @@ -3773,7 +3776,6 @@ int amdgpu_device_init(struct amdgpu_device *adev, | |||
| 3773 | 3776 | ||
| 3774 | 3777 | adev->shutdown = false; | |
| 3775 | 3778 | adev->flags = flags; | |
| 3776 | - | amdgpu_device_init_pcie_links(adev); | |
| 3777 | 3779 | ||
| 3778 | 3780 | if (amdgpu_force_asic_type >= 0 && amdgpu_force_asic_type < CHIP_LAST) | |
| 3779 | 3781 | adev->asic_type = amdgpu_force_asic_type; | |
| @@ -4335,7 +4337,7 @@ void amdgpu_device_fini_hw(struct amdgpu_device *adev) | |||
| 4335 | 4337 | ||
| 4336 | 4338 | void amdgpu_device_fini_sw(struct amdgpu_device *adev) | |
| 4337 | 4339 | { | |
| 4338 | - | int i; | |
| 4340 | + | int i, idx; | |
| 4339 | 4341 | bool px; | |
| 4340 | 4342 | ||
| 4341 | 4343 | amdgpu_device_ip_fini(adev); | |
| @@ -4377,9 +4379,11 @@ void amdgpu_device_fini_sw(struct amdgpu_device *adev) | |||
| 4377 | 4379 | if ((adev->pdev->class >> 8) == PCI_CLASS_DISPLAY_VGA) | |
| 4378 | 4380 | vga_client_unregister(adev->pdev); | |
| 4379 | 4381 | ||
| 4380 | - | if (adev->rmmio) { | |
| 4382 | + | if (drm_dev_enter(adev_to_drm(adev), &idx)) { | |
| 4383 | + | ||
| 4381 | 4384 | iounmap(adev->rmmio); | |
| 4382 | 4385 | adev->rmmio = NULL; | |
| 4386 | + | drm_dev_exit(idx); | |
| 4383 | 4387 | } | |
| 4384 | 4388 | ||
| 4385 | 4389 | if (IS_ENABLED(CONFIG_PERF_EVENTS)) | |
| @@ -5868,9 +5872,11 @@ static void amdgpu_device_partner_bandwidth(struct amdgpu_device *adev, | |||
| 5868 | 5872 | *width = PCIE_LNK_WIDTH_UNKNOWN; | |
| 5869 | 5873 | ||
| 5870 | 5874 | if (amdgpu_device_pcie_dynamic_switching_supported(adev)) { | |
| 5871 | - | if (adev->link_partner) { | |
| 5872 | - | *speed = pcie_get_speed_cap(adev->link_partner); | |
| 5873 | - | *width = pcie_get_width_cap(adev->link_partner); | |
| 5875 | + | struct pci_dev *parent = amdgpu_device_find_parent(adev); | |
| 5876 | + | ||
| 5877 | + | if (parent) { | |
| 5878 | + | *speed = pcie_get_speed_cap(parent); | |
| 5879 | + | *width = pcie_get_width_cap(parent); | |
| 5874 | 5880 | } | |
| 5875 | 5881 | } else { | |
| 5876 | 5882 | /* use the current speeds rather than max if switching is not supported */ | |
| @@ -5892,11 +5898,21 @@ static void amdgpu_device_gpu_bandwidth(struct amdgpu_device *adev, | |||
| 5892 | 5898 | enum pci_bus_speed *speed, | |
| 5893 | 5899 | enum pcie_link_width *width) | |
| 5894 | 5900 | { | |
| 5901 | + | struct pci_dev *parent = adev->pdev; | |
| 5902 | + | ||
| 5895 | 5903 | if (!speed || !width) | |
| 5896 | 5904 | return; | |
| 5897 | 5905 | ||
| 5898 | - | *speed = pcie_get_speed_cap(adev->link_dev); | |
| 5899 | - | *width = pcie_get_width_cap(adev->link_dev); | |
| 5906 | + | /* use the device itself */ | |
| 5907 | + | *speed = pcie_get_speed_cap(adev->pdev); | |
| 5908 | + | *width = pcie_get_width_cap(adev->pdev); | |
| 5909 | + | ||
| 5910 | + | /* use the link outside the device */ | |
| 5911 | + | parent = amdgpu_device_find_parent(adev); | |
| 5912 | + | if (parent) { | |
| 5913 | + | *speed = pcie_get_speed_cap(parent); | |
| 5914 | + | *width = pcie_get_width_cap(parent); | |
| 5915 | + | } | |
| 5900 | 5916 | } | |
| 5901 | 5917 | ||
| 5902 | 5918 | /** | |
modified drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c
| @@ -43,7 +43,6 @@ | |||
| 43 | 43 | #include <linux/dma-buf.h> | |
| 44 | 44 | #include <linux/dma-fence-array.h> | |
| 45 | 45 | #include <linux/pci-p2pdma.h> | |
| 46 | - | #include <linux/pm_runtime.h> | |
| 47 | 46 | ||
| 48 | 47 | static const struct dma_buf_attach_ops amdgpu_dma_buf_attach_ops; | |
| 49 | 48 | ||
| @@ -101,54 +100,15 @@ static int amdgpu_dma_buf_attach(struct dma_buf *dmabuf, | |||
| 101 | 100 | pci_p2pdma_distance(adev->pdev, attach->dev, false) < 0) | |
| 102 | 101 | attach->peer2peer = false; | |
| 103 | 102 | ||
| 104 | - | /* | |
| 105 | - | * Only allow P2P while the exporter is active, and keep it active | |
| 106 | - | * until detach. With runtime PM disabled take a plain reference so | |
| 107 | - | * the put in detach stays balanced. | |
| 108 | - | */ | |
| 109 | - | if (attach->peer2peer) { | |
| 110 | - | struct device *dev = adev_to_drm(adev)->dev; | |
| 111 | - | int ret = pm_runtime_get_if_active(dev); | |
| 112 | - | ||
| 113 | - | if (!ret) | |
| 114 | - | attach->peer2peer = false; | |
| 115 | - | else if (ret < 0) | |
| 116 | - | pm_runtime_get_noresume(dev); | |
| 117 | - | } | |
| 118 | - | ||
| 119 | 103 | r = dma_resv_lock(bo->tbo.base.resv, NULL); | |
| 120 | 104 | if (r) | |
| 121 | - | goto err_pm_put; | |
| 105 | + | return r; | |
| 122 | 106 | ||
| 123 | 107 | amdgpu_vm_bo_update_shared(bo); | |
| 124 | 108 | ||
| 125 | 109 | dma_resv_unlock(bo->tbo.base.resv); | |
| 126 | 110 | ||
| 127 | 111 | return 0; | |
| 128 | - | ||
| 129 | - | err_pm_put: | |
| 130 | - | if (attach->peer2peer) | |
| 131 | - | pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); | |
| 132 | - | return r; | |
| 133 | - | } | |
| 134 | - | ||
| 135 | - | /** | |
| 136 | - | * amdgpu_dma_buf_detach - &dma_buf_ops.detach implementation | |
| 137 | - | * | |
| 138 | - | * @dmabuf: DMA-buf where we remove the attachment from | |
| 139 | - | * @attach: the attachment to remove | |
| 140 | - | * | |
| 141 | - | * Drop the runtime PM reference taken in amdgpu_dma_buf_attach(). | |
| 142 | - | */ | |
| 143 | - | static void amdgpu_dma_buf_detach(struct dma_buf *dmabuf, | |
| 144 | - | struct dma_buf_attachment *attach) | |
| 145 | - | { | |
| 146 | - | struct drm_gem_object *obj = dmabuf->priv; | |
| 147 | - | struct amdgpu_bo *bo = gem_to_amdgpu_bo(obj); | |
| 148 | - | struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev); | |
| 149 | - | ||
| 150 | - | if (attach->peer2peer) | |
| 151 | - | pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); | |
| 152 | 112 | } | |
| 153 | 113 | ||
| 154 | 114 | /** | |
| @@ -390,7 +350,6 @@ static void amdgpu_dma_buf_vunmap(struct dma_buf *dma_buf, struct iosys_map *map | |||
| 390 | 350 | ||
| 391 | 351 | const struct dma_buf_ops amdgpu_dmabuf_ops = { | |
| 392 | 352 | .attach = amdgpu_dma_buf_attach, | |
| 393 | - | .detach = amdgpu_dma_buf_detach, | |
| 394 | 353 | .pin = amdgpu_dma_buf_pin, | |
| 395 | 354 | .unpin = amdgpu_dma_buf_unpin, | |
| 396 | 355 | .map_dma_buf = amdgpu_dma_buf_map, | |
modified drivers/gpu/drm/amd/amdgpu/amdgpu_eviction_fence.c
| @@ -68,9 +68,6 @@ amdgpu_eviction_fence_suspend_worker(struct work_struct *work) | |||
| 68 | 68 | ||
| 69 | 69 | mutex_lock(&uq_mgr->userq_mutex); | |
| 70 | 70 | ||
| 71 | - | /* Fence waits are not allowed in a fence signalling critical section. */ | |
| 72 | - | amdgpu_userq_wait_for_signal(uq_mgr); | |
| 73 | - | ||
| 74 | 71 | /* | |
| 75 | 72 | * This is intentionally after taking the userq_mutex since we do | |
| 76 | 73 | * allocate memory while holding this lock, but only after ensuring that | |
modified drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
| @@ -254,6 +254,7 @@ int amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring *ring, | |||
| 254 | 254 | ring->adev = adev; | |
| 255 | 255 | ring->num_hw_submission = sched_hw_submission; | |
| 256 | 256 | ring->sched_score = sched_score; | |
| 257 | + | ring->vmid_wait = dma_fence_get_stub(); | |
| 257 | 258 | ||
| 258 | 259 | ring->idx = adev->num_rings++; | |
| 259 | 260 | adev->rings[ring->idx] = ring; | |
| @@ -373,7 +374,6 @@ int amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring *ring, | |||
| 373 | 374 | ||
| 374 | 375 | ring->max_dw = max_dw; | |
| 375 | 376 | ring->hw_prio = hw_prio; | |
| 376 | - | ring->vmid_wait = dma_fence_get_stub(); | |
| 377 | 377 | ||
| 378 | 378 | if (!ring->no_scheduler && ring->funcs->type < AMDGPU_HW_IP_NUM) { | |
| 379 | 379 | hw_ip = ring->funcs->type; | |
modified drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
| @@ -184,27 +184,27 @@ static void amdgpu_userq_hang_detect_work(struct work_struct *work) | |||
| 184 | 184 | void amdgpu_userq_start_hang_detect_work(struct amdgpu_usermode_queue *queue) | |
| 185 | 185 | { | |
| 186 | 186 | struct amdgpu_device *adev; | |
| 187 | - | unsigned long timeout_jiffies; | |
| 187 | + | unsigned long timeout_ms; | |
| 188 | 188 | ||
| 189 | 189 | adev = queue->userq_mgr->adev; | |
| 190 | 190 | /* Determine timeout based on queue type */ | |
| 191 | 191 | switch (queue->queue_type) { | |
| 192 | 192 | case AMDGPU_RING_TYPE_GFX: | |
| 193 | - | timeout_jiffies = adev->gfx_timeout; | |
| 193 | + | timeout_ms = adev->gfx_timeout; | |
| 194 | 194 | break; | |
| 195 | 195 | case AMDGPU_RING_TYPE_COMPUTE: | |
| 196 | - | timeout_jiffies = adev->compute_timeout; | |
| 196 | + | timeout_ms = adev->compute_timeout; | |
| 197 | 197 | break; | |
| 198 | 198 | case AMDGPU_RING_TYPE_SDMA: | |
| 199 | - | timeout_jiffies = adev->sdma_timeout; | |
| 199 | + | timeout_ms = adev->sdma_timeout; | |
| 200 | 200 | break; | |
| 201 | 201 | default: | |
| 202 | - | timeout_jiffies = adev->gfx_timeout; | |
| 202 | + | timeout_ms = adev->gfx_timeout; | |
| 203 | 203 | break; | |
| 204 | 204 | } | |
| 205 | 205 | ||
| 206 | 206 | queue_delayed_work(adev->reset_domain->wq, &queue->hang_detect_work, | |
| 207 | - | timeout_jiffies); | |
| 207 | + | msecs_to_jiffies(timeout_ms)); | |
| 208 | 208 | } | |
| 209 | 209 | ||
| 210 | 210 | void amdgpu_userq_process_fence_irq(struct amdgpu_device *adev, u32 doorbell) | |
| @@ -1272,7 +1272,7 @@ amdgpu_userq_evict_all(struct amdgpu_userq_mgr *uq_mgr) | |||
| 1272 | 1272 | return ret; | |
| 1273 | 1273 | } | |
| 1274 | 1274 | ||
| 1275 | - | void | |
| 1275 | + | static void | |
| 1276 | 1276 | amdgpu_userq_wait_for_signal(struct amdgpu_userq_mgr *uq_mgr) | |
| 1277 | 1277 | { | |
| 1278 | 1278 | struct amdgpu_usermode_queue *queue; | |
| @@ -1291,6 +1291,8 @@ amdgpu_userq_wait_for_signal(struct amdgpu_userq_mgr *uq_mgr) | |||
| 1291 | 1291 | void | |
| 1292 | 1292 | amdgpu_userq_evict(struct amdgpu_userq_mgr *uq_mgr) | |
| 1293 | 1293 | { | |
| 1294 | + | /* Wait for any pending userqueue fence work to finish */ | |
| 1295 | + | amdgpu_userq_wait_for_signal(uq_mgr); | |
| 1294 | 1296 | amdgpu_userq_evict_all(uq_mgr); | |
| 1295 | 1297 | } | |
| 1296 | 1298 | ||
modified drivers/gpu/drm/amd/amdgpu/amdgpu_userq.h
| @@ -162,7 +162,6 @@ void amdgpu_userq_mgr_cancel_reset_work(struct amdgpu_device *adev); | |||
| 162 | 162 | void amdgpu_userq_mgr_cancel_resume(struct amdgpu_userq_mgr *userq_mgr); | |
| 163 | 163 | void amdgpu_userq_mgr_fini(struct amdgpu_userq_mgr *userq_mgr); | |
| 164 | 164 | ||
| 165 | - | void amdgpu_userq_wait_for_signal(struct amdgpu_userq_mgr *uq_mgr); | |
| 166 | 165 | void amdgpu_userq_evict(struct amdgpu_userq_mgr *uq_mgr); | |
| 167 | 166 | ||
| 168 | 167 | void amdgpu_userq_ensure_ev_fence(struct amdgpu_userq_mgr *userq_mgr, | |
modified drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
| @@ -2678,7 +2678,6 @@ error_free_root: | |||
| 2678 | 2678 | amdgpu_bo_unref(&root_bo); | |
| 2679 | 2679 | ||
| 2680 | 2680 | error_free_delayed: | |
| 2681 | - | dma_fence_put(vm->last_update); | |
| 2682 | 2681 | dma_fence_put(vm->last_tlb_flush); | |
| 2683 | 2682 | dma_fence_put(vm->last_unlocked); | |
| 2684 | 2683 | ttm_lru_bulk_move_fini(&adev->mman.bdev, &vm->lru_bulk_move); | |
modified drivers/gpu/drm/amd/amdgpu/nbio_v7_9.c
| @@ -535,7 +535,7 @@ static void nbio_v7_9_handle_ras_controller_intr_no_bifring(struct amdgpu_device | |||
| 535 | 535 | RAS_CNTLR_INTERRUPT_CLEAR, 1); | |
| 536 | 536 | WREG32_SOC15(NBIO, 0, regBIF_BX0_BIF_DOORBELL_INT_CNTL, bif_doorbell_intr_cntl); | |
| 537 | 537 | ||
| 538 | - | if (ras && !ras->disable_ras_err_cnt_harvest && obj) { | |
| 538 | + | if (!ras->disable_ras_err_cnt_harvest) { | |
| 539 | 539 | /* | |
| 540 | 540 | * clear error status after ras_controller_intr | |
| 541 | 541 | * according to hw team and count ue number | |
modified drivers/gpu/drm/amd/amdgpu/vcn_v4_0_3.c
| @@ -1689,8 +1689,7 @@ static int vcn_v4_0_3_reset_jpeg_pre_helper(struct amdgpu_device *adev, int inst | |||
| 1689 | 1689 | /* if Jobs are still pending after timeout, | |
| 1690 | 1690 | * We'll handle them in the bottom helper | |
| 1691 | 1691 | */ | |
| 1692 | - | amdgpu_fence_wait_polling(ring, wait_seq, | |
| 1693 | - | jiffies_to_usecs(adev->video_timeout)); | |
| 1692 | + | amdgpu_fence_wait_polling(ring, wait_seq, adev->video_timeout); | |
| 1694 | 1693 | } | |
| 1695 | 1694 | ||
| 1696 | 1695 | return 0; | |
modified drivers/gpu/drm/amd/amdgpu/vcn_v5_0_1.c
| @@ -1335,8 +1335,7 @@ static int vcn_v5_0_1_reset_jpeg_pre_helper(struct amdgpu_device *adev, int inst | |||
| 1335 | 1335 | /* if Jobs are still pending after timeout, | |
| 1336 | 1336 | * We'll handle them in the bottom helper | |
| 1337 | 1337 | */ | |
| 1338 | - | amdgpu_fence_wait_polling(ring, wait_seq, | |
| 1339 | - | jiffies_to_usecs(adev->video_timeout)); | |
| 1338 | + | amdgpu_fence_wait_polling(ring, wait_seq, adev->video_timeout); | |
| 1340 | 1339 | } | |
| 1341 | 1340 | ||
| 1342 | 1341 | return 0; | |
modified drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
| @@ -35,7 +35,6 @@ | |||
| 35 | 35 | #include <linux/time.h> | |
| 36 | 36 | #include <linux/mm.h> | |
| 37 | 37 | #include <linux/mman.h> | |
| 38 | - | #include <linux/pseudo_fs.h> | |
| 39 | 38 | #include <linux/ptrace.h> | |
| 40 | 39 | #include <linux/dma-buf.h> | |
| 41 | 40 | #include <linux/processor.h> | |
| @@ -71,54 +70,18 @@ static const struct class kfd_class = { | |||
| 71 | 70 | }; | |
| 72 | 71 | ||
| 73 | 72 | /* | |
| 74 | - | * Private pseudo-filesystem for KFD, Provides a stable, module-owned | |
| 75 | - | * inode whose address_space is the unmap target for all /dev/kfd | |
| 76 | - | * openers during GPU reset. | |
| 73 | + | * Cache the address space of the chardev on first open so that the reset | |
| 74 | + | * path can drop all userspace mappings of doorbell and MMIO ranges via | |
| 75 | + | * unmap_mapping_range(). | |
| 77 | 76 | */ | |
| 78 | - | static struct vfsmount *kfd_fs_mnt; | |
| 79 | - | static int kfd_fs_cnt; | |
| 80 | - | ||
| 81 | - | static int kfd_fs_init_fs_context(struct fs_context *fc) | |
| 82 | - | { | |
| 83 | - | return init_pseudo(fc, 0x4b464400 /* "KFD" */) ? 0 : -ENOMEM; | |
| 84 | - | } | |
| 85 | - | ||
| 86 | - | static struct file_system_type kfd_fs_type = { | |
| 87 | - | .name = "kfd", | |
| 88 | - | .init_fs_context = kfd_fs_init_fs_context, | |
| 89 | - | .kill_sb = kill_anon_super, | |
| 90 | - | }; | |
| 91 | - | ||
| 92 | - | static struct inode *kfd_fs_inode_new(void) | |
| 93 | - | { | |
| 94 | - | struct inode *inode; | |
| 95 | - | int r; | |
| 96 | - | ||
| 97 | - | r = simple_pin_fs(&kfd_fs_type, &kfd_fs_mnt, &kfd_fs_cnt); | |
| 98 | - | if (r < 0) | |
| 99 | - | return ERR_PTR(r); | |
| 100 | - | ||
| 101 | - | inode = alloc_anon_inode(kfd_fs_mnt->mnt_sb); | |
| 102 | - | if (IS_ERR(inode)) | |
| 103 | - | simple_release_fs(&kfd_fs_mnt, &kfd_fs_cnt); | |
| 104 | - | ||
| 105 | - | return inode; | |
| 106 | - | } | |
| 107 | - | ||
| 108 | - | static void kfd_fs_inode_free(struct inode *inode) | |
| 109 | - | { | |
| 110 | - | if (inode) { | |
| 111 | - | iput(inode); | |
| 112 | - | simple_release_fs(&kfd_fs_mnt, &kfd_fs_cnt); | |
| 113 | - | } | |
| 114 | - | } | |
| 115 | - | ||
| 116 | - | static struct inode *kfd_anon_inode; | |
| 77 | + | static struct address_space *kfd_dev_mapping; | |
| 117 | 78 | ||
| 118 | 79 | void kfd_dev_unmap_mapping_range(loff_t const holebegin, loff_t const holelen) | |
| 119 | 80 | { | |
| 120 | - | if (kfd_anon_inode) | |
| 121 | - | unmap_mapping_range(kfd_anon_inode->i_mapping, holebegin, holelen, 1); | |
| 81 | + | struct address_space *mapping = READ_ONCE(kfd_dev_mapping); | |
| 82 | + | ||
| 83 | + | if (mapping) | |
| 84 | + | unmap_mapping_range(mapping, holebegin, holelen, 1); | |
| 122 | 85 | } | |
| 123 | 86 | ||
| 124 | 87 | static inline struct kfd_process_device *kfd_lock_pdd_by_id(struct kfd_process *p, __u32 gpu_id) | |
| @@ -144,13 +107,6 @@ int kfd_chardev_init(void) | |||
| 144 | 107 | { | |
| 145 | 108 | int err = 0; | |
| 146 | 109 | ||
| 147 | - | kfd_anon_inode = kfd_fs_inode_new(); | |
| 148 | - | if (IS_ERR(kfd_anon_inode)) { | |
| 149 | - | err = PTR_ERR(kfd_anon_inode); | |
| 150 | - | kfd_anon_inode = NULL; | |
| 151 | - | return err; | |
| 152 | - | } | |
| 153 | - | ||
| 154 | 110 | kfd_char_dev_major = register_chrdev(0, kfd_dev_name, &kfd_fops); | |
| 155 | 111 | err = kfd_char_dev_major; | |
| 156 | 112 | if (err < 0) | |
| @@ -174,8 +130,6 @@ err_device_create: | |||
| 174 | 130 | err_class_create: | |
| 175 | 131 | unregister_chrdev(kfd_char_dev_major, kfd_dev_name); | |
| 176 | 132 | err_register_chrdev: | |
| 177 | - | kfd_fs_inode_free(kfd_anon_inode); | |
| 178 | - | kfd_anon_inode = NULL; | |
| 179 | 133 | return err; | |
| 180 | 134 | } | |
| 181 | 135 | ||
| @@ -184,8 +138,6 @@ void kfd_chardev_exit(void) | |||
| 184 | 138 | device_destroy(&kfd_class, MKDEV(kfd_char_dev_major, 0)); | |
| 185 | 139 | class_unregister(&kfd_class); | |
| 186 | 140 | unregister_chrdev(kfd_char_dev_major, kfd_dev_name); | |
| 187 | - | kfd_fs_inode_free(kfd_anon_inode); | |
| 188 | - | kfd_anon_inode = NULL; | |
| 189 | 141 | kfd_device = NULL; | |
| 190 | 142 | } | |
| 191 | 143 | ||
| @@ -198,7 +150,12 @@ static int kfd_open(struct inode *inode, struct file *filep) | |||
| 198 | 150 | if (iminor(inode) != 0) | |
| 199 | 151 | return -ENODEV; | |
| 200 | 152 | ||
| 201 | - | filep->f_mapping = kfd_anon_inode->i_mapping; | |
| 153 | + | /* | |
| 154 | + | * /dev/kfd is a single chardev so all opens share one inode. Cache | |
| 155 | + | * its address_space on the first open for use by the reset path. | |
| 156 | + | */ | |
| 157 | + | if (!READ_ONCE(kfd_dev_mapping)) | |
| 158 | + | cmpxchg(&kfd_dev_mapping, NULL, inode->i_mapping); | |
| 202 | 159 | ||
| 203 | 160 | is_32bit_user_mode = in_compat_syscall(); | |
| 204 | 161 | ||
modified drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
| @@ -770,12 +770,10 @@ static int create_queue_nocpsch(struct device_queue_manager *dqm, | |||
| 770 | 770 | mqd_mgr = dqm->mqd_mgrs[get_mqd_type_from_queue_type( | |
| 771 | 771 | q->properties.type)]; | |
| 772 | 772 | if (qd && !mqd_mgr->restore_mqd) { | |
| 773 | - | pr_debug("restore_mqd not implemented for queue type %d\n", | |
| 774 | - | q->properties.type); | |
| 773 | + | pr_debug("restore_mqd not implemented for this GPU\n"); | |
| 775 | 774 | retval = -EOPNOTSUPP; | |
| 776 | 775 | goto deallocate_vmid; | |
| 777 | 776 | } | |
| 778 | - | ||
| 779 | 777 | if (q->properties.type == KFD_QUEUE_TYPE_COMPUTE) { | |
| 780 | 778 | retval = allocate_hqd(dqm, q); | |
| 781 | 779 | if (retval) | |
| @@ -2252,8 +2250,7 @@ static int create_queue_cpsch(struct device_queue_manager *dqm, struct queue *q, | |||
| 2252 | 2250 | mqd_mgr = dqm->mqd_mgrs[get_mqd_type_from_queue_type( | |
| 2253 | 2251 | q->properties.type)]; | |
| 2254 | 2252 | if (qd && !mqd_mgr->restore_mqd) { | |
| 2255 | - | pr_debug("restore_mqd not implemented for queue type %d\n", | |
| 2256 | - | q->properties.type); | |
| 2253 | + | pr_debug("restore_mqd not implemented for this GPU\n"); | |
| 2257 | 2254 | retval = -EOPNOTSUPP; | |
| 2258 | 2255 | goto out_deallocate_doorbell; | |
| 2259 | 2256 | } | |
modified drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v10.c
| @@ -204,7 +204,7 @@ static void update_mqd(struct mqd_manager *mm, void *mqd, | |||
| 204 | 204 | * is safe, giving a maximum field value of 0xA. | |
| 205 | 205 | */ | |
| 206 | 206 | m->cp_hqd_eop_control = q->eop_ring_buffer_size ? min(0xA, | |
| 207 | - | ffs(q->eop_ring_buffer_size / sizeof(unsigned int) / 4)) : 0; | |
| 207 | + | ffs(q->eop_ring_buffer_size / sizeof(unsigned int)) - 1 - 1) : 0; | |
| 208 | 208 | m->cp_hqd_eop_base_addr_lo = | |
| 209 | 209 | lower_32_bits(q->eop_ring_buffer_address >> 8); | |
| 210 | 210 | m->cp_hqd_eop_base_addr_hi = | |
modified drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v11.c
| @@ -242,7 +242,7 @@ static void update_mqd(struct mqd_manager *mm, void *mqd, | |||
| 242 | 242 | * is safe, giving a maximum field value of 0xA. | |
| 243 | 243 | */ | |
| 244 | 244 | m->cp_hqd_eop_control = q->eop_ring_buffer_size ? min(0xA, | |
| 245 | - | ffs(q->eop_ring_buffer_size / sizeof(unsigned int) / 4)) : 0; | |
| 245 | + | ffs(q->eop_ring_buffer_size / sizeof(unsigned int)) - 1 - 1) : 0; | |
| 246 | 246 | m->cp_hqd_eop_base_addr_lo = | |
| 247 | 247 | lower_32_bits(q->eop_ring_buffer_address >> 8); | |
| 248 | 248 | m->cp_hqd_eop_base_addr_hi = | |
modified drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v12.c
| @@ -217,7 +217,7 @@ static void update_mqd(struct mqd_manager *mm, void *mqd, | |||
| 217 | 217 | * is safe, giving a maximum field value of 0xA. | |
| 218 | 218 | */ | |
| 219 | 219 | m->cp_hqd_eop_control = q->eop_ring_buffer_size ? min(0xA, | |
| 220 | - | ffs(q->eop_ring_buffer_size / sizeof(unsigned int) / 4)) : 0; | |
| 220 | + | ffs(q->eop_ring_buffer_size / sizeof(unsigned int)) - 1 - 1) : 0; | |
| 221 | 221 | m->cp_hqd_eop_base_addr_lo = | |
| 222 | 222 | lower_32_bits(q->eop_ring_buffer_address >> 8); | |
| 223 | 223 | m->cp_hqd_eop_base_addr_hi = | |
| @@ -380,63 +380,6 @@ static int debugfs_show_mqd_sdma(struct seq_file *m, void *data) | |||
| 380 | 380 | ||
| 381 | 381 | #endif | |
| 382 | 382 | ||
| 383 | - | static void restore_mqd(struct mqd_manager *mm, void **mqd, | |
| 384 | - | struct kfd_mem_obj *mqd_mem_obj, uint64_t *gart_addr, | |
| 385 | - | struct queue_properties *qp, const void *mqd_src, | |
| 386 | - | const void *ctl_stack_src, const u32 ctl_stack_size) | |
| 387 | - | { | |
| 388 | - | u64 addr; | |
| 389 | - | struct v12_compute_mqd *m; | |
| 390 | - | ||
| 391 | - | m = (struct v12_compute_mqd *)mqd_mem_obj->cpu_ptr; | |
| 392 | - | addr = mqd_mem_obj->gpu_addr; | |
| 393 | - | ||
| 394 | - | memset(m, 0, AMDGPU_MQD_SIZE_ALIGN(mm->mqd_size)); | |
| 395 | - | memcpy(m, mqd_src, sizeof(*m)); | |
| 396 | - | ||
| 397 | - | /* Update MQD base address to the newly allocated location */ | |
| 398 | - | m->cp_mqd_base_addr_lo = lower_32_bits(addr); | |
| 399 | - | m->cp_mqd_base_addr_hi = upper_32_bits(addr); | |
| 400 | - | ||
| 401 | - | m->cp_hqd_pq_doorbell_control &= | |
| 402 | - | ~CP_HQD_PQ_DOORBELL_CONTROL__DOORBELL_OFFSET_MASK; | |
| 403 | - | m->cp_hqd_pq_doorbell_control |= | |
| 404 | - | qp->doorbell_off << CP_HQD_PQ_DOORBELL_CONTROL__DOORBELL_OFFSET__SHIFT; | |
| 405 | - | pr_debug("cp_hqd_pq_doorbell_control 0x%x\n", m->cp_hqd_pq_doorbell_control); | |
| 406 | - | ||
| 407 | - | *mqd = m; | |
| 408 | - | if (gart_addr) | |
| 409 | - | *gart_addr = addr; | |
| 410 | - | ||
| 411 | - | qp->is_active = 0; | |
| 412 | - | } | |
| 413 | - | ||
| 414 | - | static void restore_mqd_sdma(struct mqd_manager *mm, void **mqd, | |
| 415 | - | struct kfd_mem_obj *mqd_mem_obj, uint64_t *gart_addr, | |
| 416 | - | struct queue_properties *qp, | |
| 417 | - | const void *mqd_src, | |
| 418 | - | const void *ctl_stack_src, | |
| 419 | - | const u32 ctl_stack_size) | |
| 420 | - | { | |
| 421 | - | u64 addr; | |
| 422 | - | struct v12_sdma_mqd *m; | |
| 423 | - | ||
| 424 | - | m = (struct v12_sdma_mqd *)mqd_mem_obj->cpu_ptr; | |
| 425 | - | addr = mqd_mem_obj->gpu_addr; | |
| 426 | - | ||
| 427 | - | memset(m, 0, AMDGPU_MQD_SIZE_ALIGN(mm->mqd_size)); | |
| 428 | - | memcpy(m, mqd_src, sizeof(*m)); | |
| 429 | - | ||
| 430 | - | m->sdmax_rlcx_doorbell_offset = | |
| 431 | - | qp->doorbell_off << SDMA0_QUEUE0_DOORBELL_OFFSET__OFFSET__SHIFT; | |
| 432 | - | ||
| 433 | - | *mqd = m; | |
| 434 | - | if (gart_addr) | |
| 435 | - | *gart_addr = addr; | |
| 436 | - | ||
| 437 | - | qp->is_active = 0; | |
| 438 | - | } | |
| 439 | - | ||
| 440 | 383 | struct mqd_manager *mqd_manager_init_v12(enum KFD_MQD_TYPE type, | |
| 441 | 384 | struct kfd_node *dev) | |
| 442 | 385 | { | |
| @@ -464,7 +407,6 @@ struct mqd_manager *mqd_manager_init_v12(enum KFD_MQD_TYPE type, | |||
| 464 | 407 | mqd->mqd_size = sizeof(struct v12_compute_mqd); | |
| 465 | 408 | mqd->get_wave_state = get_wave_state; | |
| 466 | 409 | mqd->mqd_stride = kfd_mqd_stride; | |
| 467 | - | mqd->restore_mqd = restore_mqd; | |
| 468 | 410 | #if defined(CONFIG_DEBUG_FS) | |
| 469 | 411 | mqd->debugfs_show_mqd = debugfs_show_mqd; | |
| 470 | 412 | #endif | |
| @@ -511,7 +453,6 @@ struct mqd_manager *mqd_manager_init_v12(enum KFD_MQD_TYPE type, | |||
| 511 | 453 | mqd->is_occupied = kfd_is_occupied_sdma; | |
| 512 | 454 | mqd->mqd_size = sizeof(struct v12_sdma_mqd); | |
| 513 | 455 | mqd->mqd_stride = kfd_mqd_stride; | |
| 514 | - | mqd->restore_mqd = restore_mqd_sdma; | |
| 515 | 456 | #if defined(CONFIG_DEBUG_FS) | |
| 516 | 457 | mqd->debugfs_show_mqd = debugfs_show_mqd_sdma; | |
| 517 | 458 | #endif | |
modified drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v12_1.c
| @@ -295,7 +295,7 @@ static void update_mqd(struct mqd_manager *mm, void *mqd, | |||
| 295 | 295 | * is safe, giving a maximum field value of 0xA. | |
| 296 | 296 | */ | |
| 297 | 297 | m->cp_hqd_eop_control = q->eop_ring_buffer_size ? min(0xA, | |
| 298 | - | ffs(q->eop_ring_buffer_size / sizeof(unsigned int) / 4)) : 0; | |
| 298 | + | ffs(q->eop_ring_buffer_size / sizeof(unsigned int)) - 1 - 1) : 0; | |
| 299 | 299 | m->cp_hqd_eop_base_addr_lo = | |
| 300 | 300 | lower_32_bits(q->eop_ring_buffer_address >> 8); | |
| 301 | 301 | m->cp_hqd_eop_base_addr_hi = | |
| @@ -641,72 +641,6 @@ static int debugfs_show_mqd_sdma(struct seq_file *m, void *data) | |||
| 641 | 641 | ||
| 642 | 642 | #endif | |
| 643 | 643 | ||
| 644 | - | static void restore_mqd_v12_1(struct mqd_manager *mm, void **mqd, | |
| 645 | - | struct kfd_mem_obj *mqd_mem_obj, uint64_t *gart_addr, | |
| 646 | - | struct queue_properties *qp, const void *mqd_src, | |
| 647 | - | const void *ctl_stack_src, const u32 ctl_stack_size) | |
| 648 | - | { | |
| 649 | - | u64 addr; | |
| 650 | - | struct v12_1_compute_mqd *m; | |
| 651 | - | ||
| 652 | - | /* | |
| 653 | - | * GFX12.1 is multi-XCC capable but this restore handles XCC0 only. | |
| 654 | - | * Multi-XCC CRIU restore is currently unreachable because | |
| 655 | - | * kfd_criu_restore_queue() validates against unscaled mqd_size. | |
| 656 | - | */ | |
| 657 | - | if (NUM_XCC(mm->dev->xcc_mask) > 1) | |
| 658 | - | pr_warn_once("GFX12.1 multi-XCC CRIU restore not fully supported\n"); | |
| 659 | - | ||
| 660 | - | m = (struct v12_1_compute_mqd *)mqd_mem_obj->cpu_ptr; | |
| 661 | - | addr = mqd_mem_obj->gpu_addr; | |
| 662 | - | ||
| 663 | - | memset(m, 0, AMDGPU_MQD_SIZE_ALIGN(mm->mqd_size) * | |
| 664 | - | NUM_XCC(mm->dev->xcc_mask)); | |
| 665 | - | memcpy(m, mqd_src, sizeof(*m)); | |
| 666 | - | ||
| 667 | - | /* Update MQD base address to the newly allocated location */ | |
| 668 | - | m->cp_mqd_base_addr_lo = lower_32_bits(addr); | |
| 669 | - | m->cp_mqd_base_addr_hi = upper_32_bits(addr); | |
| 670 | - | ||
| 671 | - | m->cp_hqd_pq_doorbell_control &= | |
| 672 | - | ~CP_HQD_PQ_DOORBELL_CONTROL__DOORBELL_OFFSET_MASK; | |
| 673 | - | m->cp_hqd_pq_doorbell_control |= | |
| 674 | - | qp->doorbell_off << CP_HQD_PQ_DOORBELL_CONTROL__DOORBELL_OFFSET__SHIFT; | |
| 675 | - | pr_debug("cp_hqd_pq_doorbell_control 0x%x\n", m->cp_hqd_pq_doorbell_control); | |
| 676 | - | ||
| 677 | - | *mqd = m; | |
| 678 | - | if (gart_addr) | |
| 679 | - | *gart_addr = addr; | |
| 680 | - | ||
| 681 | - | qp->is_active = 0; | |
| 682 | - | } | |
| 683 | - | ||
| 684 | - | static void restore_mqd_sdma_v12_1(struct mqd_manager *mm, void **mqd, | |
| 685 | - | struct kfd_mem_obj *mqd_mem_obj, uint64_t *gart_addr, | |
| 686 | - | struct queue_properties *qp, | |
| 687 | - | const void *mqd_src, | |
| 688 | - | const void *ctl_stack_src, | |
| 689 | - | const u32 ctl_stack_size) | |
| 690 | - | { | |
| 691 | - | u64 addr; | |
| 692 | - | struct v12_sdma_mqd *m; | |
| 693 | - | ||
| 694 | - | m = (struct v12_sdma_mqd *)mqd_mem_obj->cpu_ptr; | |
| 695 | - | addr = mqd_mem_obj->gpu_addr; | |
| 696 | - | ||
| 697 | - | memset(m, 0, AMDGPU_MQD_SIZE_ALIGN(mm->mqd_size)); | |
| 698 | - | memcpy(m, mqd_src, sizeof(*m)); | |
| 699 | - | ||
| 700 | - | m->sdmax_rlcx_doorbell_offset = | |
| 701 | - | qp->doorbell_off << SDMA0_SDMA_QUEUE0_DOORBELL_OFFSET__OFFSET__SHIFT; | |
| 702 | - | ||
| 703 | - | *mqd = m; | |
| 704 | - | if (gart_addr) | |
| 705 | - | *gart_addr = addr; | |
| 706 | - | ||
| 707 | - | qp->is_active = 0; | |
| 708 | - | } | |
| 709 | - | ||
| 710 | 644 | struct mqd_manager *mqd_manager_init_v12_1(enum KFD_MQD_TYPE type, | |
| 711 | 645 | struct kfd_node *dev) | |
| 712 | 646 | { | |
| @@ -734,7 +668,6 @@ struct mqd_manager *mqd_manager_init_v12_1(enum KFD_MQD_TYPE type, | |||
| 734 | 668 | mqd->mqd_size = sizeof(struct v12_1_compute_mqd); | |
| 735 | 669 | mqd->get_wave_state = get_wave_state_v12_1; | |
| 736 | 670 | mqd->mqd_stride = kfd_mqd_stride; | |
| 737 | - | mqd->restore_mqd = restore_mqd_v12_1; | |
| 738 | 671 | #if defined(CONFIG_DEBUG_FS) | |
| 739 | 672 | mqd->debugfs_show_mqd = debugfs_show_mqd; | |
| 740 | 673 | #endif | |
| @@ -781,7 +714,6 @@ struct mqd_manager *mqd_manager_init_v12_1(enum KFD_MQD_TYPE type, | |||
| 781 | 714 | mqd->is_occupied = kfd_is_occupied_sdma; | |
| 782 | 715 | mqd->mqd_size = sizeof(struct v12_sdma_mqd); | |
| 783 | 716 | mqd->mqd_stride = kfd_mqd_stride; | |
| 784 | - | mqd->restore_mqd = restore_mqd_sdma_v12_1; | |
| 785 | 717 | #if defined(CONFIG_DEBUG_FS) | |
| 786 | 718 | mqd->debugfs_show_mqd = debugfs_show_mqd_sdma; | |
| 787 | 719 | #endif | |
modified drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_v9.c
| @@ -285,10 +285,6 @@ static void update_mqd(struct mqd_manager *mm, void *mqd, | |||
| 285 | 285 | 1 << CP_HQD_IB_CONTROL__IB_EXE_DISABLE__SHIFT; | |
| 286 | 286 | ||
| 287 | 287 | /* | |
| 288 | - | * The lowest 6 bits of eop_control store the EOP ring size. If | |
| 289 | - | * their value is X, the ring size is 2^(X + 1) dwords, or | |
| 290 | - | * 2^(X + 3) bytes. | |
| 291 | - | * | |
| 292 | 288 | * HW does not clamp this field correctly. Maximum EOP queue size | |
| 293 | 289 | * is constrained by per-SE EOP done signal count, which is 8-bit. | |
| 294 | 290 | * Limit is 0xFF EOP entries (= 0x7F8 dwords). CP will not submit | |
| @@ -300,7 +296,7 @@ static void update_mqd(struct mqd_manager *mm, void *mqd, | |||
| 300 | 296 | * | |
| 301 | 297 | */ | |
| 302 | 298 | m->cp_hqd_eop_control = q->eop_ring_buffer_size ? | |
| 303 | - | min(0xA, order_base_2(q->eop_ring_buffer_size / 8)) : 0; | |
| 299 | + | min(0xA, order_base_2(q->eop_ring_buffer_size / 4) - 1) : 0; | |
| 304 | 300 | ||
| 305 | 301 | m->cp_hqd_eop_base_addr_lo = | |
| 306 | 302 | lower_32_bits(q->eop_ring_buffer_address >> 8); | |
modified drivers/gpu/drm/amd/amdkfd/kfd_mqd_manager_vi.c
| @@ -208,9 +208,6 @@ static void __update_mqd(struct mqd_manager *mm, void *mqd, | |||
| 208 | 208 | mtype << CP_HQD_IB_CONTROL__MTYPE__SHIFT; | |
| 209 | 209 | ||
| 210 | 210 | /* | |
| 211 | - | * The lowest 6 bits of eop_control store the EOP ring size. If | |
| 212 | - | * their value is X, the ring size is 2^(X + 1) dwords, or | |
| 213 | - | * 2^(X + 3) bytes. | |
| 214 | 211 | * HW does not clamp this field correctly. Maximum EOP queue size | |
| 215 | 212 | * is constrained by per-SE EOP done signal count, which is 8-bit. | |
| 216 | 213 | * Limit is 0xFF EOP entries (= 0x7F8 dwords). CP will not submit | |
| @@ -218,7 +215,7 @@ static void __update_mqd(struct mqd_manager *mm, void *mqd, | |||
| 218 | 215 | * is safe, giving a maximum field value of 0xA. | |
| 219 | 216 | */ | |
| 220 | 217 | m->cp_hqd_eop_control |= q->eop_ring_buffer_size ? min(0xA, | |
| 221 | - | order_base_2(q->eop_ring_buffer_size / 8)) : 0; | |
| 218 | + | order_base_2(q->eop_ring_buffer_size / 4) - 1) : 0; | |
| 222 | 219 | m->cp_hqd_eop_base_addr_lo = | |
| 223 | 220 | lower_32_bits(q->eop_ring_buffer_address >> 8); | |
| 224 | 221 | m->cp_hqd_eop_base_addr_hi = | |
modified drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
| @@ -1420,7 +1420,7 @@ static void dm_gpureset_toggle_interrupts(struct amdgpu_device *adev, | |||
| 1420 | 1420 | if (acrtc && state->stream_status[i].plane_count != 0 && | |
| 1421 | 1421 | amdgpu_ip_version(adev, DCE_HWIP, 0) == 0) { | |
| 1422 | 1422 | irq_source = IRQ_TYPE_PFLIP + acrtc->otg_inst; | |
| 1423 | - | rc = amdgpu_dm_irq_set(adev, irq_source, enable) ? 0 : -EBUSY; | |
| 1423 | + | rc = dc_interrupt_set(adev->dm.dc, irq_source, enable) ? 0 : -EBUSY; | |
| 1424 | 1424 | if (rc) | |
| 1425 | 1425 | drm_warn(adev_to_drm(adev), "Failed to %s pflip interrupts\n", | |
| 1426 | 1426 | enable ? "enable" : "disable"); | |
| @@ -1444,7 +1444,7 @@ static void dm_gpureset_toggle_interrupts(struct amdgpu_device *adev, | |||
| 1444 | 1444 | /* During gpu-reset we disable and then enable vblank irq, so | |
| 1445 | 1445 | * don't use amdgpu_irq_get/put() to avoid refcount change. | |
| 1446 | 1446 | */ | |
| 1447 | - | if (!amdgpu_dm_irq_set(adev, irq_source, enable)) | |
| 1447 | + | if (!dc_interrupt_set(adev->dm.dc, irq_source, enable)) | |
| 1448 | 1448 | drm_warn(adev_to_drm(adev), "Failed to %sable vblank interrupt\n", enable ? "en" : "dis"); | |
| 1449 | 1449 | ||
| 1450 | 1450 | } else if (acrtc && state->stream_status[i].plane_count != 0) { | |
| @@ -5583,10 +5583,8 @@ static int dm_update_crtc_state(struct amdgpu_display_manager *dm, | |||
| 5583 | 5583 | ||
| 5584 | 5584 | skip_modeset: | |
| 5585 | 5585 | /* Release extra reference */ | |
| 5586 | - | if (new_stream) { | |
| 5586 | + | if (new_stream) | |
| 5587 | 5587 | dc_stream_release(new_stream); | |
| 5588 | - | new_stream = NULL; | |
| 5589 | - | } | |
| 5590 | 5588 | new_stream = NULL; | |
| 5591 | 5589 | ||
| 5592 | 5590 | /* | |
modified drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
| @@ -552,18 +552,6 @@ struct amdgpu_display_manager { | |||
| 552 | 552 | struct common_irq_params | |
| 553 | 553 | vupdate_params[DC_IRQ_SOURCE_VUPDATE6 - DC_IRQ_SOURCE_VUPDATE1 + 1]; | |
| 554 | 554 | ||
| 555 | - | /** | |
| 556 | - | * @irq_reg_lock: | |
| 557 | - | * | |
| 558 | - | * Serializes the read-modify-writes of the HW interrupt control | |
| 559 | - | * registers. Several interrupt sources share one register - e.g. the | |
| 560 | - | * enable and clear bits of both VSTARTUP (vblank) and VUPDATE_NO_LOCK | |
| 561 | - | * live in OTG_GLOBAL_SYNC_STATUS. Therefore, enabling one source must | |
| 562 | - | * not race with acking another. Held only across amdgpu_dm_irq_set() | |
| 563 | - | * and amdgpu_dm_irq_ack(). | |
| 564 | - | */ | |
| 565 | - | spinlock_t irq_reg_lock; | |
| 566 | - | ||
| 567 | 555 | /** | |
| 568 | 556 | * @dmub_trace_params: | |
| 569 | 557 | * | |
modified drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c
| @@ -31,7 +31,6 @@ | |||
| 31 | 31 | #include "amdgpu_dm_psr.h" | |
| 32 | 32 | #include "amdgpu_dm_replay.h" | |
| 33 | 33 | #include "amdgpu_dm_crtc.h" | |
| 34 | - | #include "amdgpu_dm_irq.h" | |
| 35 | 34 | #include "amdgpu_dm_plane.h" | |
| 36 | 35 | #include "amdgpu_dm_trace.h" | |
| 37 | 36 | #include "amdgpu_dm_debugfs.h" | |
| @@ -92,7 +91,7 @@ int amdgpu_dm_crtc_set_vupdate_irq(struct drm_crtc *crtc, bool enable) | |||
| 92 | 91 | ||
| 93 | 92 | irq_source = IRQ_TYPE_VUPDATE + acrtc->otg_inst; | |
| 94 | 93 | ||
| 95 | - | rc = amdgpu_dm_irq_set(adev, irq_source, enable) ? 0 : -EBUSY; | |
| 94 | + | rc = dc_interrupt_set(adev->dm.dc, irq_source, enable) ? 0 : -EBUSY; | |
| 96 | 95 | ||
| 97 | 96 | DRM_DEBUG_VBL("crtc %d - vupdate irq %sabling: r=%d\n", | |
| 98 | 97 | acrtc->crtc_id, enable ? "en" : "dis", rc); | |
modified drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
| @@ -1439,13 +1439,12 @@ void dm_helpers_free_gpu_mem( | |||
| 1439 | 1439 | ||
| 1440 | 1440 | bool dm_helpers_dmub_outbox_interrupt_control(struct dc_context *ctx, bool enable) | |
| 1441 | 1441 | { | |
| 1442 | - | struct amdgpu_device *adev = ctx->driver_context; | |
| 1443 | 1442 | enum dc_irq_source irq_source; | |
| 1444 | 1443 | bool ret; | |
| 1445 | 1444 | ||
| 1446 | 1445 | irq_source = DC_IRQ_SOURCE_DMCUB_OUTBOX; | |
| 1447 | 1446 | ||
| 1448 | - | ret = amdgpu_dm_irq_set(adev, irq_source, enable); | |
| 1447 | + | ret = dc_interrupt_set(ctx->dc, irq_source, enable); | |
| 1449 | 1448 | ||
| 1450 | 1449 | DRM_DEBUG_DRIVER("Dmub trace irq %sabling: r=%d\n", | |
| 1451 | 1450 | enable ? "en" : "dis", ret); | |
modified drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_irq.c
| @@ -396,7 +396,6 @@ int amdgpu_dm_irq_init(struct amdgpu_device *adev) | |||
| 396 | 396 | DRM_DEBUG_KMS("DM_IRQ\n"); | |
| 397 | 397 | ||
| 398 | 398 | spin_lock_init(&adev->dm.irq_handler_list_table_lock); | |
| 399 | - | spin_lock_init(&adev->dm.irq_reg_lock); | |
| 400 | 399 | ||
| 401 | 400 | adev->dm.irq_wq = alloc_workqueue("amdgpu_dm_irq", | |
| 402 | 401 | WQ_UNBOUND | WQ_HIGHPRI, 0); | |
| @@ -531,7 +530,7 @@ void amdgpu_dm_irq_suspend(struct amdgpu_device *adev) | |||
| 531 | 530 | */ | |
| 532 | 531 | for (src = DC_IRQ_SOURCE_HPD1; src <= DC_IRQ_SOURCE_HPD6RX; src++) { | |
| 533 | 532 | hnd_list_l = &adev->dm.irq_handler_list_low_tab[src]; | |
| 534 | - | amdgpu_dm_irq_set(adev, src, false); | |
| 533 | + | dc_interrupt_set(adev->dm.dc, src, false); | |
| 535 | 534 | ||
| 536 | 535 | DM_IRQ_TABLE_UNLOCK(adev, irq_table_flags); | |
| 537 | 536 | ||
| @@ -569,7 +568,7 @@ void amdgpu_dm_irq_resume_early(struct amdgpu_device *adev) | |||
| 569 | 568 | hnd_list_l = &adev->dm.irq_handler_list_low_tab[src]; | |
| 570 | 569 | hnd_list_h = &adev->dm.irq_handler_list_high_tab[src]; | |
| 571 | 570 | if (!list_empty(hnd_list_l) || !list_empty(hnd_list_h)) | |
| 572 | - | amdgpu_dm_irq_set(adev, src, true); | |
| 571 | + | dc_interrupt_set(adev->dm.dc, src, true); | |
| 573 | 572 | } | |
| 574 | 573 | ||
| 575 | 574 | DM_IRQ_TABLE_UNLOCK(adev, irq_table_flags); | |
| @@ -595,7 +594,7 @@ void amdgpu_dm_irq_resume_late(struct amdgpu_device *adev) | |||
| 595 | 594 | hnd_list_l = &adev->dm.irq_handler_list_low_tab[src]; | |
| 596 | 595 | hnd_list_h = &adev->dm.irq_handler_list_high_tab[src]; | |
| 597 | 596 | if (!list_empty(hnd_list_l) || !list_empty(hnd_list_h)) | |
| 598 | - | amdgpu_dm_irq_set(adev, src, true); | |
| 597 | + | dc_interrupt_set(adev->dm.dc, src, true); | |
| 599 | 598 | } | |
| 600 | 599 | ||
| 601 | 600 | DM_IRQ_TABLE_UNLOCK(adev, irq_table_flags); | |
| @@ -691,23 +690,6 @@ STATIC_IFN_KUNIT void amdgpu_dm_irq_immediate_work(struct amdgpu_device *adev, | |||
| 691 | 690 | } | |
| 692 | 691 | EXPORT_IF_KUNIT(amdgpu_dm_irq_immediate_work); | |
| 693 | 692 | ||
| 694 | - | bool amdgpu_dm_irq_set(struct amdgpu_device *adev, enum dc_irq_source src, | |
| 695 | - | bool enable) | |
| 696 | - | { | |
| 697 | - | guard(spinlock_irqsave)(&adev->dm.irq_reg_lock); | |
| 698 | - | ||
| 699 | - | return dc_interrupt_set(adev->dm.dc, src, enable); | |
| 700 | - | } | |
| 701 | - | EXPORT_IF_KUNIT(amdgpu_dm_irq_set); | |
| 702 | - | ||
| 703 | - | void amdgpu_dm_irq_ack(struct amdgpu_device *adev, enum dc_irq_source src) | |
| 704 | - | { | |
| 705 | - | guard(spinlock_irqsave)(&adev->dm.irq_reg_lock); | |
| 706 | - | ||
| 707 | - | dc_interrupt_ack(adev->dm.dc, src); | |
| 708 | - | } | |
| 709 | - | EXPORT_IF_KUNIT(amdgpu_dm_irq_ack); | |
| 710 | - | ||
| 711 | 693 | /** | |
| 712 | 694 | * amdgpu_dm_irq_handler - Generic DM IRQ handler | |
| 713 | 695 | * @adev: amdgpu base driver device containing the DM device | |
| @@ -728,7 +710,7 @@ STATIC_IFN_KUNIT int amdgpu_dm_irq_handler(struct amdgpu_device *adev, | |||
| 728 | 710 | entry->src_id, | |
| 729 | 711 | entry->src_data[0]); | |
| 730 | 712 | ||
| 731 | - | amdgpu_dm_irq_ack(adev, src); | |
| 713 | + | dc_interrupt_ack(adev->dm.dc, src); | |
| 732 | 714 | ||
| 733 | 715 | /* Call high irq work immediately */ | |
| 734 | 716 | amdgpu_dm_irq_immediate_work(adev, src); | |
| @@ -768,7 +750,7 @@ STATIC_IFN_KUNIT int amdgpu_dm_set_hpd_irq_state(struct amdgpu_device *adev, | |||
| 768 | 750 | enum dc_irq_source src = amdgpu_dm_hpd_to_dal_irq_source(type); | |
| 769 | 751 | bool st = (state == AMDGPU_IRQ_STATE_ENABLE); | |
| 770 | 752 | ||
| 771 | - | amdgpu_dm_irq_set(adev, src, st); | |
| 753 | + | dc_interrupt_set(adev->dm.dc, src, st); | |
| 772 | 754 | return 0; | |
| 773 | 755 | } | |
| 774 | 756 | EXPORT_IF_KUNIT(amdgpu_dm_set_hpd_irq_state); | |
| @@ -803,7 +785,7 @@ static inline int dm_irq_state(struct amdgpu_device *adev, | |||
| 803 | 785 | if (dc && dc->caps.ips_support && dc->idle_optimizations_allowed) | |
| 804 | 786 | dc_allow_idle_optimizations(dc, false); | |
| 805 | 787 | ||
| 806 | - | amdgpu_dm_irq_set(adev, irq_source, st); | |
| 788 | + | dc_interrupt_set(adev->dm.dc, irq_source, st); | |
| 807 | 789 | return 0; | |
| 808 | 790 | } | |
| 809 | 791 | ||
| @@ -860,7 +842,7 @@ STATIC_IFN_KUNIT int amdgpu_dm_set_dmub_outbox_irq_state(struct amdgpu_device *a | |||
| 860 | 842 | enum dc_irq_source irq_source = DC_IRQ_SOURCE_DMCUB_OUTBOX; | |
| 861 | 843 | bool st = (state == AMDGPU_IRQ_STATE_ENABLE); | |
| 862 | 844 | ||
| 863 | - | amdgpu_dm_irq_set(adev, irq_source, st); | |
| 845 | + | dc_interrupt_set(adev->dm.dc, irq_source, st); | |
| 864 | 846 | return 0; | |
| 865 | 847 | } | |
| 866 | 848 | EXPORT_IF_KUNIT(amdgpu_dm_set_dmub_outbox_irq_state); | |
| @@ -888,7 +870,7 @@ STATIC_IFN_KUNIT int amdgpu_dm_set_dmub_trace_irq_state(struct amdgpu_device *ad | |||
| 888 | 870 | enum dc_irq_source irq_source = DC_IRQ_SOURCE_DMCUB_OUTBOX0; | |
| 889 | 871 | bool st = (state == AMDGPU_IRQ_STATE_ENABLE); | |
| 890 | 872 | ||
| 891 | - | amdgpu_dm_irq_set(adev, irq_source, st); | |
| 873 | + | dc_interrupt_set(adev->dm.dc, irq_source, st); | |
| 892 | 874 | return 0; | |
| 893 | 875 | } | |
| 894 | 876 | EXPORT_IF_KUNIT(amdgpu_dm_set_dmub_trace_irq_state); | |
| @@ -955,7 +937,9 @@ EXPORT_IF_KUNIT(amdgpu_dm_set_irq_funcs); | |||
| 955 | 937 | ||
| 956 | 938 | void amdgpu_dm_outbox_init(struct amdgpu_device *adev) | |
| 957 | 939 | { | |
| 958 | - | amdgpu_dm_irq_set(adev, DC_IRQ_SOURCE_DMCUB_OUTBOX, true); | |
| 940 | + | dc_interrupt_set(adev->dm.dc, | |
| 941 | + | DC_IRQ_SOURCE_DMCUB_OUTBOX, | |
| 942 | + | true); | |
| 959 | 943 | } | |
| 960 | 944 | EXPORT_IF_KUNIT(amdgpu_dm_outbox_init); | |
| 961 | 945 | ||
| @@ -978,7 +962,7 @@ void amdgpu_dm_hpd_init(struct amdgpu_device *adev) | |||
| 978 | 962 | ||
| 979 | 963 | /* First, clear all hpd and hpdrx interrupts */ | |
| 980 | 964 | for (i = DC_IRQ_SOURCE_HPD1; i <= DC_IRQ_SOURCE_HPD6RX; i++) { | |
| 981 | - | if (!amdgpu_dm_irq_set(adev, i, false)) | |
| 965 | + | if (!dc_interrupt_set(adev->dm.dc, i, false)) | |
| 982 | 966 | drm_err(dev, "Failed to clear hpd(rx) source=%d on init\n", | |
| 983 | 967 | i); | |
| 984 | 968 | } | |
| @@ -1007,7 +991,7 @@ void amdgpu_dm_hpd_init(struct amdgpu_device *adev) | |||
| 1007 | 991 | * of dm. Note that only hpd interrupt types are registered with | |
| 1008 | 992 | * base driver; hpd_rx types aren't. IOW, amdgpu_irq_get/put on | |
| 1009 | 993 | * hpd_rx isn't available. DM currently controls hpd_rx | |
| 1010 | - | * explicitly with amdgpu_dm_irq_set() | |
| 994 | + | * explicitly with dc_interrupt_set() | |
| 1011 | 995 | */ | |
| 1012 | 996 | if (dc_link->irq_source_hpd != DC_IRQ_SOURCE_INVALID) { | |
| 1013 | 997 | irq_type = dc_link->irq_source_hpd - DC_IRQ_SOURCE_HPD1; | |
| @@ -1016,21 +1000,23 @@ void amdgpu_dm_hpd_init(struct amdgpu_device *adev) | |||
| 1016 | 1000 | * and what bios reports as the # of connectors with hpd | |
| 1017 | 1001 | * sources. Since the # of hpd source types registered | |
| 1018 | 1002 | * with base driver == mode_info.num_hpd, we have to | |
| 1019 | - | * fallback to amdgpu_dm_irq_set for the remaining types. | |
| 1003 | + | * fallback to dc_interrupt_set for the remaining types. | |
| 1020 | 1004 | */ | |
| 1021 | 1005 | if (irq_type < adev->mode_info.num_hpd) { | |
| 1022 | 1006 | if (amdgpu_irq_get(adev, &adev->hpd_irq, irq_type)) | |
| 1023 | 1007 | drm_err(dev, "DM_IRQ: Failed get HPD for source=%d)!\n", | |
| 1024 | 1008 | dc_link->irq_source_hpd); | |
| 1025 | 1009 | } else { | |
| 1026 | - | amdgpu_dm_irq_set(adev, dc_link->irq_source_hpd, | |
| 1027 | - | true); | |
| 1010 | + | dc_interrupt_set(adev->dm.dc, | |
| 1011 | + | dc_link->irq_source_hpd, | |
| 1012 | + | true); | |
| 1028 | 1013 | } | |
| 1029 | 1014 | } | |
| 1030 | 1015 | ||
| 1031 | 1016 | if (dc_link->irq_source_hpd_rx != DC_IRQ_SOURCE_INVALID) { | |
| 1032 | - | amdgpu_dm_irq_set(adev, dc_link->irq_source_hpd_rx, | |
| 1033 | - | true); | |
| 1017 | + | dc_interrupt_set(adev->dm.dc, | |
| 1018 | + | dc_link->irq_source_hpd_rx, | |
| 1019 | + | true); | |
| 1034 | 1020 | } | |
| 1035 | 1021 | } | |
| 1036 | 1022 | drm_connector_list_iter_end(&iter); | |
| @@ -1075,14 +1061,16 @@ void amdgpu_dm_hpd_fini(struct amdgpu_device *adev) | |||
| 1075 | 1061 | drm_err(dev, "DM_IRQ: Failed put HPD for source=%d!\n", | |
| 1076 | 1062 | dc_link->irq_source_hpd); | |
| 1077 | 1063 | } else { | |
| 1078 | - | amdgpu_dm_irq_set(adev, dc_link->irq_source_hpd, | |
| 1079 | - | false); | |
| 1064 | + | dc_interrupt_set(adev->dm.dc, | |
| 1065 | + | dc_link->irq_source_hpd, | |
| 1066 | + | false); | |
| 1080 | 1067 | } | |
| 1081 | 1068 | } | |
| 1082 | 1069 | ||
| 1083 | 1070 | if (dc_link->irq_source_hpd_rx != DC_IRQ_SOURCE_INVALID) { | |
| 1084 | - | amdgpu_dm_irq_set(adev, dc_link->irq_source_hpd_rx, | |
| 1085 | - | false); | |
| 1071 | + | dc_interrupt_set(adev->dm.dc, | |
| 1072 | + | dc_link->irq_source_hpd_rx, | |
| 1073 | + | false); | |
| 1086 | 1074 | } | |
| 1087 | 1075 | } | |
| 1088 | 1076 | drm_connector_list_iter_end(&iter); | |
modified drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_irq.h
| @@ -89,34 +89,6 @@ void amdgpu_dm_irq_unregister_interrupt(struct amdgpu_device *adev, | |||
| 89 | 89 | enum dc_irq_source irq_source, | |
| 90 | 90 | void *ih_index); | |
| 91 | 91 | ||
| 92 | - | /** | |
| 93 | - | * amdgpu_dm_irq_set - enable or disable a DC interrupt source. | |
| 94 | - | * | |
| 95 | - | * @adev: AMD DRM device | |
| 96 | - | * @src: DC interrupt source to toggle | |
| 97 | - | * @enable: true to enable the source, false to disable it | |
| 98 | - | * | |
| 99 | - | * DM-wide replacement for dc_interrupt_set(). As locking is DM's | |
| 100 | - | * responsibility, this is a thin wrapper serializes the underlying | |
| 101 | - | * read-modify-write against the other interrupt sources sharing HW control | |
| 102 | - | * registers with @src, so DM must never call dc_interrupt_set() directly. | |
| 103 | - | * | |
| 104 | - | * Returns: true if the source was toggled. | |
| 105 | - | */ | |
| 106 | - | bool amdgpu_dm_irq_set(struct amdgpu_device *adev, enum dc_irq_source src, | |
| 107 | - | bool enable); | |
| 108 | - | ||
| 109 | - | /** | |
| 110 | - | * amdgpu_dm_irq_ack - acknowledge a DC interrupt source. | |
| 111 | - | * | |
| 112 | - | * @adev: AMD DRM device | |
| 113 | - | * @src: DC interrupt source to acknowledge | |
| 114 | - | * | |
| 115 | - | * DM-wide replacement for dc_interrupt_ack(), serialized the same way as | |
| 116 | - | * amdgpu_dm_irq_set(). | |
| 117 | - | */ | |
| 118 | - | void amdgpu_dm_irq_ack(struct amdgpu_device *adev, enum dc_irq_source src); | |
| 119 | - | ||
| 120 | 92 | void amdgpu_dm_set_irq_funcs(struct amdgpu_device *adev); | |
| 121 | 93 | ||
| 122 | 94 | void amdgpu_dm_outbox_init(struct amdgpu_device *adev); | |
modified drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_crtc_test.c
| @@ -436,7 +436,7 @@ static void dm_test_crtc_set_vupdate_irq_no_otg(struct kunit *test) | |||
| 436 | 436 | * dm_test_crtc_set_vupdate_irq_dc_busy - Test vupdate irq when DC rejects request | |
| 437 | 437 | * @test: The KUnit test context | |
| 438 | 438 | * | |
| 439 | - | * With an OTG instance assigned but no DC attached, amdgpu_dm_irq_set() returns | |
| 439 | + | * With an OTG instance assigned but no DC attached, dc_interrupt_set() returns | |
| 440 | 440 | * false and the function must report the request as busy (-EBUSY). | |
| 441 | 441 | */ | |
| 442 | 442 | static void dm_test_crtc_set_vupdate_irq_dc_busy(struct kunit *test) | |
| @@ -453,12 +453,12 @@ static void dm_test_crtc_set_vupdate_irq_dc_busy(struct kunit *test) | |||
| 453 | 453 | acrtc->base.dev = &adev->ddev; | |
| 454 | 454 | acrtc->otg_inst = 0; | |
| 455 | 455 | ||
| 456 | - | /* adev->dm.dc is NULL, so amdgpu_dm_irq_set() returns false. */ | |
| 456 | + | /* adev->dm.dc is NULL, so dc_interrupt_set() returns false. */ | |
| 457 | 457 | KUNIT_EXPECT_EQ(test, | |
| 458 | 458 | amdgpu_dm_crtc_set_vupdate_irq(&acrtc->base, true), -EBUSY); | |
| 459 | 459 | } | |
| 460 | 460 | ||
| 461 | - | /* Per-source funcs let amdgpu_dm_irq_set() succeed without register access. */ | |
| 461 | + | /* Per-source funcs let dc_interrupt_set() succeed without register access. */ | |
| 462 | 462 | static bool dm_test_vupdate_irq_src_set(struct irq_service *irq_service, | |
| 463 | 463 | const struct irq_source_info *info, | |
| 464 | 464 | bool enable) | |
| @@ -477,7 +477,7 @@ static struct irq_source_info_funcs dm_test_vupdate_irq_src_funcs = { | |||
| 477 | 477 | .ack = dm_test_vupdate_irq_src_ack, | |
| 478 | 478 | }; | |
| 479 | 479 | ||
| 480 | - | /* A .set that fails so amdgpu_dm_irq_set() reports the source as busy. */ | |
| 480 | + | /* A .set that fails so dc_interrupt_set() reports the source as busy. */ | |
| 481 | 481 | static bool dm_test_vupdate_irq_src_set_busy(struct irq_service *irq_service, | |
| 482 | 482 | const struct irq_source_info *info, | |
| 483 | 483 | bool enable) | |
| @@ -519,9 +519,7 @@ static void dm_test_crtc_set_vupdate_irq_enable(struct kunit *test) | |||
| 519 | 519 | irqs = kunit_kzalloc(test, sizeof(*irqs), GFP_KERNEL); | |
| 520 | 520 | KUNIT_ASSERT_NOT_ERR_OR_NULL(test, irqs); | |
| 521 | 521 | ||
| 522 | - | /* | |
| 523 | - | * Populate the per-source info table so amdgpu_dm_irq_set() succeeds. | |
| 524 | - | */ | |
| 522 | + | /* Populate the per-source info table so dc_interrupt_set() succeeds. */ | |
| 525 | 523 | info = kunit_kzalloc(test, sizeof(*info) * DAL_IRQ_SOURCES_NUMBER, | |
| 526 | 524 | GFP_KERNEL); | |
| 527 | 525 | KUNIT_ASSERT_NOT_ERR_OR_NULL(test, info); | |
| @@ -1020,9 +1018,7 @@ static void dm_test_crtc_enable_vblank_vupdate_busy(struct kunit *test) | |||
| 1020 | 1018 | irqs = kunit_kzalloc(test, sizeof(*irqs), GFP_KERNEL); | |
| 1021 | 1019 | KUNIT_ASSERT_NOT_ERR_OR_NULL(test, irqs); | |
| 1022 | 1020 | ||
| 1023 | - | /* | |
| 1024 | - | * Per-source .set fails so amdgpu_dm_irq_set() reports the source busy. | |
| 1025 | - | */ | |
| 1021 | + | /* Per-source .set fails so dc_interrupt_set() reports the source busy. */ | |
| 1026 | 1022 | info = kunit_kzalloc(test, sizeof(*info) * DAL_IRQ_SOURCES_NUMBER, | |
| 1027 | 1023 | GFP_KERNEL); | |
| 1028 | 1024 | KUNIT_ASSERT_NOT_ERR_OR_NULL(test, info); | |
modified drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_helpers_test.c
| @@ -2442,21 +2442,17 @@ static void dm_test_is_dp_sink_present_null_priv(struct kunit *test) | |||
| 2442 | 2442 | * dm_test_dmub_outbox_interrupt_control_null_dc - Test outbox irq control with NULL dc | |
| 2443 | 2443 | * @test: The KUnit test context | |
| 2444 | 2444 | * | |
| 2445 | - | * amdgpu_dm_irq_set() is NULL-safe and returns false when dc is NULL, so the | |
| 2445 | + | * dc_interrupt_set() is NULL-safe and returns false when dc is NULL, so the | |
| 2446 | 2446 | * helper returns false without touching real interrupt hardware. | |
| 2447 | 2447 | */ | |
| 2448 | 2448 | static void dm_test_dmub_outbox_interrupt_control_null_dc(struct kunit *test) | |
| 2449 | 2449 | { | |
| 2450 | - | struct amdgpu_device *adev; | |
| 2451 | 2450 | struct dc_context *ctx; | |
| 2452 | 2451 | ||
| 2453 | - | adev = kunit_kzalloc(test, sizeof(*adev), GFP_KERNEL); | |
| 2454 | - | KUNIT_ASSERT_NOT_NULL(test, adev); | |
| 2455 | 2452 | ctx = kunit_kzalloc(test, sizeof(*ctx), GFP_KERNEL); | |
| 2456 | 2453 | KUNIT_ASSERT_NOT_NULL(test, ctx); | |
| 2457 | - | ctx->driver_context = adev; | |
| 2458 | 2454 | ||
| 2459 | - | /* adev->dm.dc is NULL → amdgpu_dm_irq_set returns false */ | |
| 2455 | + | /* ctx->dc is NULL → dc_interrupt_set returns false */ | |
| 2460 | 2456 | KUNIT_EXPECT_FALSE(test, dm_helpers_dmub_outbox_interrupt_control(ctx, true)); | |
| 2461 | 2457 | KUNIT_EXPECT_FALSE(test, dm_helpers_dmub_outbox_interrupt_control(ctx, false)); | |
| 2462 | 2458 | } | |
modified drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_irq_test.c
| @@ -268,7 +268,7 @@ static bool dm_test_irq_src_ack(struct irq_service *irq_service, | |||
| 268 | 268 | return true; | |
| 269 | 269 | } | |
| 270 | 270 | ||
| 271 | - | /* Per-source funcs let amdgpu_dm_irq_set() succeed without register access. */ | |
| 271 | + | /* Per-source funcs let dc_interrupt_set() succeed without register access. */ | |
| 272 | 272 | static struct irq_source_info_funcs dm_test_irq_src_funcs = { | |
| 273 | 273 | .set = dm_test_irq_src_set, | |
| 274 | 274 | .ack = dm_test_irq_src_ack, | |
| @@ -290,7 +290,7 @@ static struct dc *dm_test_alloc_dc_with_irq_service(struct kunit *test, | |||
| 290 | 290 | KUNIT_ASSERT_NOT_ERR_OR_NULL(test, irqs); | |
| 291 | 291 | ||
| 292 | 292 | /* | |
| 293 | - | * Populate the per-source info table so amdgpu_dm_irq_set()/_ack() | |
| 293 | + | * Populate the per-source info table so dc_interrupt_set()/_ack() | |
| 294 | 294 | * succeed without touching hardware registers. | |
| 295 | 295 | */ | |
| 296 | 296 | info = kunit_kzalloc(test, sizeof(*info) * DAL_IRQ_SOURCES_NUMBER, | |
| @@ -1227,7 +1227,7 @@ static void dm_test_irq_suspend_empty(struct kunit *test) | |||
| 1227 | 1227 | KUNIT_ASSERT_EQ(test, amdgpu_dm_irq_init(adev), 0); | |
| 1228 | 1228 | ||
| 1229 | 1229 | /* | |
| 1230 | - | * With no registered handlers the amdgpu_dm_irq_set() calls are | |
| 1230 | + | * With no registered handlers the HW dc_interrupt_set() calls are | |
| 1231 | 1231 | * skipped, so suspend must complete without touching the (absent) DC. | |
| 1232 | 1232 | */ | |
| 1233 | 1233 | amdgpu_dm_irq_suspend(adev); | |
| @@ -1275,11 +1275,11 @@ static void dm_test_irq_resume_late_empty(struct kunit *test) | |||
| 1275 | 1275 | } | |
| 1276 | 1276 | ||
| 1277 | 1277 | /** | |
| 1278 | - | * dm_test_irq_suspend_registered - Test suspend reaches the irq set path | |
| 1278 | + | * dm_test_irq_suspend_registered - Test suspend reaches the dc_interrupt_set path | |
| 1279 | 1279 | * @test: The KUnit test context | |
| 1280 | 1280 | * | |
| 1281 | 1281 | * Registers a low-context HPD handler so the handler list is non-empty, | |
| 1282 | - | * forcing amdgpu_dm_irq_suspend() to call amdgpu_dm_irq_set() (NULL-safe with | |
| 1282 | + | * forcing amdgpu_dm_irq_suspend() to call dc_interrupt_set() (NULL-safe with | |
| 1283 | 1283 | * no DC) and flush_work() on the registered handler. | |
| 1284 | 1284 | */ | |
| 1285 | 1285 | static void dm_test_irq_suspend_registered(struct kunit *test) | |
| @@ -1330,11 +1330,11 @@ static void dm_test_irq_suspend_disables_polling(struct kunit *test) | |||
| 1330 | 1330 | } | |
| 1331 | 1331 | ||
| 1332 | 1332 | /** | |
| 1333 | - | * dm_test_irq_resume_early_registered - Test early resume reaches irq set | |
| 1333 | + | * dm_test_irq_resume_early_registered - Test early resume reaches dc_interrupt_set | |
| 1334 | 1334 | * @test: The KUnit test context | |
| 1335 | 1335 | * | |
| 1336 | 1336 | * Registers a low-context HPD RX handler so early resume calls | |
| 1337 | - | * amdgpu_dm_irq_set() for the short-pulse interrupt source. | |
| 1337 | + | * dc_interrupt_set() for the short-pulse interrupt source. | |
| 1338 | 1338 | */ | |
| 1339 | 1339 | static void dm_test_irq_resume_early_registered(struct kunit *test) | |
| 1340 | 1340 | { | |
| @@ -1358,10 +1358,10 @@ static void dm_test_irq_resume_early_registered(struct kunit *test) | |||
| 1358 | 1358 | } | |
| 1359 | 1359 | ||
| 1360 | 1360 | /** | |
| 1361 | - | * dm_test_irq_resume_late_registered - Test late resume reaches irq set | |
| 1361 | + | * dm_test_irq_resume_late_registered - Test late resume reaches dc_interrupt_set | |
| 1362 | 1362 | * @test: The KUnit test context | |
| 1363 | 1363 | * | |
| 1364 | - | * Registers a low-context HPD handler so late resume calls amdgpu_dm_irq_set() | |
| 1364 | + | * Registers a low-context HPD handler so late resume calls dc_interrupt_set() | |
| 1365 | 1365 | * for the HPD interrupt source. | |
| 1366 | 1366 | */ | |
| 1367 | 1367 | static void dm_test_irq_resume_late_registered(struct kunit *test) | |
| @@ -1592,7 +1592,7 @@ static void dm_test_set_crtc_irq_state_enable(struct kunit *test) | |||
| 1592 | 1592 | ||
| 1593 | 1593 | /* | |
| 1594 | 1594 | * otg_inst >= 0 computes the irq source and reaches the NULL-safe | |
| 1595 | - | * amdgpu_dm_irq_set(); the ips_support branch is skipped (dc == NULL). | |
| 1595 | + | * dc_interrupt_set(); the ips_support branch is skipped (dc == NULL). | |
| 1596 | 1596 | */ | |
| 1597 | 1597 | acrtc->otg_inst = 3; | |
| 1598 | 1598 | adev->mode_info.crtcs[0] = acrtc; | |
| @@ -1671,8 +1671,8 @@ static void dm_test_set_vupdate_irq_state_enable(struct kunit *test) | |||
| 1671 | 1671 | * | |
| 1672 | 1672 | * With a non-NULL DC that advertises IPS support and currently allows idle | |
| 1673 | 1673 | * optimizations, dm_irq_state() must call dc_allow_idle_optimizations() before | |
| 1674 | - | * amdgpu_dm_irq_set(). disable_idle_power_optimizations makes that call a safe | |
| 1675 | - | * early return, and per-source stub funcs let amdgpu_dm_irq_set() succeed. | |
| 1674 | + | * dc_interrupt_set(). disable_idle_power_optimizations makes that call a safe | |
| 1675 | + | * early return, and per-source stub funcs let dc_interrupt_set() succeed. | |
| 1676 | 1676 | */ | |
| 1677 | 1677 | static void dm_test_set_crtc_irq_state_allows_idle(struct kunit *test) | |
| 1678 | 1678 | { | |
| @@ -1891,7 +1891,7 @@ static void dm_test_set_hpd_irq_state_null_dc(struct kunit *test) | |||
| 1891 | 1891 | adev = kunit_kzalloc(test, sizeof(*adev), GFP_KERNEL); | |
| 1892 | 1892 | KUNIT_ASSERT_NOT_ERR_OR_NULL(test, adev); | |
| 1893 | 1893 | ||
| 1894 | - | /* amdgpu_dm_irq_set() is a no-op when dc is NULL, so both states | |
| 1894 | + | /* dc_interrupt_set() is a no-op when dc is NULL, so both states | |
| 1895 | 1895 | * return 0 without dereferencing the (absent) DC. | |
| 1896 | 1896 | */ | |
| 1897 | 1897 | KUNIT_EXPECT_EQ(test, amdgpu_dm_set_hpd_irq_state(adev, NULL, AMDGPU_HPD_1, | |
| @@ -1951,7 +1951,7 @@ static void dm_test_outbox_init_null_dc(struct kunit *test) | |||
| 1951 | 1951 | adev = kunit_kzalloc(test, sizeof(*adev), GFP_KERNEL); | |
| 1952 | 1952 | KUNIT_ASSERT_NOT_ERR_OR_NULL(test, adev); | |
| 1953 | 1953 | ||
| 1954 | - | /* Single amdgpu_dm_irq_set() call must be skipped when dc is NULL. */ | |
| 1954 | + | /* Single dc_interrupt_set() call must be skipped when dc is NULL. */ | |
| 1955 | 1955 | amdgpu_dm_outbox_init(adev); | |
| 1956 | 1956 | } | |
| 1957 | 1957 | ||
| @@ -1969,7 +1969,7 @@ static void dm_test_hpd_init_empty_connectors(struct kunit *test) | |||
| 1969 | 1969 | ||
| 1970 | 1970 | /* | |
| 1971 | 1971 | * With an empty connector list the per-connector loop is skipped and | |
| 1972 | - | * the initial clear loop relies on amdgpu_dm_irq_set() being a no-op | |
| 1972 | + | * the initial clear loop relies on dc_interrupt_set() being a no-op | |
| 1973 | 1973 | * for a NULL dc, so init must complete without touching the DC. | |
| 1974 | 1974 | */ | |
| 1975 | 1975 | amdgpu_dm_hpd_init(adev); | |
| @@ -2004,7 +2004,7 @@ static void dm_test_hpd_init_fini_with_connectors(struct kunit *test) | |||
| 2004 | 2004 | ||
| 2005 | 2005 | /* | |
| 2006 | 2006 | * num_hpd = 0 forces irq_type >= num_hpd so the loop takes the HW | |
| 2007 | - | * fallback (amdgpu_dm_irq_set()) instead of amdgpu_irq_get(); with a | |
| 2007 | + | * fallback (dc_interrupt_set()) instead of amdgpu_irq_get(); with a | |
| 2008 | 2008 | * NULL dc that fallback is a safe no-op. | |
| 2009 | 2009 | */ | |
| 2010 | 2010 | adev->mode_info.num_hpd = 0; | |
| @@ -2090,7 +2090,7 @@ static void dm_test_hpd_init_fini_irq_ref(struct kunit *test) | |||
| 2090 | 2090 | /* | |
| 2091 | 2091 | * num_hpd >= 1 makes irq_type (0) < num_hpd, so the loop takes the | |
| 2092 | 2092 | * amdgpu_irq_get()/amdgpu_irq_put() branch instead of the | |
| 2093 | - | * amdgpu_dm_irq_set() fallback. The mock device has irq.installed == | |
| 2093 | + | * dc_interrupt_set() fallback. The mock device has irq.installed == | |
| 2094 | 2094 | * false, so both calls fail early with -ENOENT (logging an error) | |
| 2095 | 2095 | * without touching the base-driver irq state. | |
| 2096 | 2096 | */ | |
modified drivers/gpu/drm/amd/display/dc/dml/Makefile
| @@ -29,14 +29,14 @@ dml_ccflags := $(CC_FLAGS_FPU) | |||
| 29 | 29 | dml_rcflags := $(CC_FLAGS_NO_FPU) | |
| 30 | 30 | ||
| 31 | 31 | ifneq ($(CONFIG_FRAME_WARN),0) | |
| 32 | - | ifeq ($(filter y,$(CONFIG_KASAN)$(CONFIG_KCSAN)$(CONFIG_UBSAN)),y) | |
| 32 | + | ifeq ($(filter y,$(CONFIG_KASAN)$(CONFIG_KCSAN)),y) | |
| 33 | 33 | ifeq ($(CONFIG_CC_IS_CLANG)$(CONFIG_COMPILE_TEST),yy) | |
| 34 | 34 | frame_warn_limit := 4096 | |
| 35 | 35 | else | |
| 36 | 36 | frame_warn_limit := 3072 | |
| 37 | 37 | endif | |
| 38 | 38 | else | |
| 39 | - | frame_warn_limit := 3072 | |
| 39 | + | frame_warn_limit := 2048 | |
| 40 | 40 | endif | |
| 41 | 41 | ||
| 42 | 42 | ifeq ($(call test-lt, $(CONFIG_FRAME_WARN), $(frame_warn_limit)),y) | |
modified drivers/gpu/drm/amd/display/dc/dml2_0/Makefile
| @@ -28,14 +28,14 @@ dml2_ccflags := $(CC_FLAGS_FPU) | |||
| 28 | 28 | dml2_rcflags := $(CC_FLAGS_NO_FPU) | |
| 29 | 29 | ||
| 30 | 30 | ifneq ($(CONFIG_FRAME_WARN),0) | |
| 31 | - | ifeq ($(filter y,$(CONFIG_KASAN)$(CONFIG_KCSAN)$(CONFIG_UBSAN)),y) | |
| 31 | + | ifeq ($(filter y,$(CONFIG_KASAN)$(CONFIG_KCSAN)),y) | |
| 32 | 32 | ifeq ($(CONFIG_CC_IS_CLANG)$(CONFIG_COMPILE_TEST),yy) | |
| 33 | 33 | frame_warn_limit := 4096 | |
| 34 | 34 | else | |
| 35 | 35 | frame_warn_limit := 3072 | |
| 36 | 36 | endif | |
| 37 | 37 | else | |
| 38 | - | frame_warn_limit := 3072 | |
| 38 | + | frame_warn_limit := 2056 | |
| 39 | 39 | endif | |
| 40 | 40 | ||
| 41 | 41 | ifeq ($(call test-lt, $(CONFIG_FRAME_WARN), $(frame_warn_limit)),y) | |
modified drivers/gpu/drm/amd/display/dc/hwss/dcn30/dcn30_hwseq.c
| @@ -1064,12 +1064,10 @@ bool dcn30_apply_idle_power_optimizations(struct dc *dc, bool enable) | |||
| 1064 | 1064 | */ | |
| 1065 | 1065 | unsigned int denom = refresh_hz * 6528; | |
| 1066 | 1066 | unsigned int stutter_period = dc->current_state->perf_params.stutter_period_us; | |
| 1067 | - | uint64_t num = (1000000LL + 2 * stutter_period * refresh_hz) * | |
| 1068 | - | (100LL + dc->debug.mall_additional_timer_percent); | |
| 1069 | - | uint64_t tmr_ticks; | |
| 1070 | 1067 | ||
| 1071 | - | tmr_ticks = div_u64(num + denom - 1, denom); | |
| 1072 | - | tmr_delay = tmr_ticks > 64 ? (uint32_t)(tmr_ticks - 64) : 0; | |
| 1068 | + | tmr_delay = (uint32_t)(div_u64(((1000000LL + 2 * stutter_period * refresh_hz) * | |
| 1069 | + | (100LL + dc->debug.mall_additional_timer_percent) + denom - 1), | |
| 1070 | + | denom) - 64LL); | |
| 1073 | 1071 | ||
| 1074 | 1072 | /* In some cases the stutter period is really big (tiny modes) in these | |
| 1075 | 1073 | * cases MALL cant be enabled, So skip these cases to avoid a ASSERT() | |
| @@ -1091,8 +1089,9 @@ bool dcn30_apply_idle_power_optimizations(struct dc *dc, bool enable) | |||
| 1091 | 1089 | } | |
| 1092 | 1090 | ||
| 1093 | 1091 | denom *= 2; | |
| 1094 | - | tmr_ticks = div_u64(num + denom - 1, denom); | |
| 1095 | - | tmr_delay = tmr_ticks > 64 ? (uint32_t)(tmr_ticks - 64) : 0; | |
| 1092 | + | tmr_delay = (uint32_t)(div_u64(((1000000LL + 2 * stutter_period * refresh_hz) * | |
| 1093 | + | (100LL + dc->debug.mall_additional_timer_percent) + denom - 1), | |
| 1094 | + | denom) - 64LL); | |
| 1096 | 1095 | } | |
| 1097 | 1096 | ||
| 1098 | 1097 | /* Copy HW cursor */ | |
modified drivers/gpu/drm/amd/display/dc/hwss/dcn50/dcn50_hwseq.c
| @@ -67,8 +67,7 @@ static void dcn50_initialize_min_clocks(struct dc *dc) | |||
| 67 | 67 | * audio corruption. Read current DISPCLK from DENTIST and request the same | |
| 68 | 68 | * freq to ensure that the timing is valid and unchanged. | |
| 69 | 69 | */ | |
| 70 | - | if (dc->clk_mgr->funcs->get_dispclk_from_dentist) | |
| 71 | - | clocks->dispclk_khz = dc->clk_mgr->funcs->get_dispclk_from_dentist(dc->clk_mgr); | |
| 70 | + | clocks->dispclk_khz = dc->clk_mgr->funcs->get_dispclk_from_dentist(dc->clk_mgr); | |
| 72 | 71 | } | |
| 73 | 72 | clocks->ref_dtbclk_khz = dc->clk_mgr->bw_params->clk_table.entries[0].dtbclk_mhz * 1000; | |
| 74 | 73 | clocks->fclk_p_state_change_support = true; | |
| @@ -640,8 +639,7 @@ void dcn50_init_hw(struct dc *dc) | |||
| 640 | 639 | dc->res_pool->hubbub->funcs->allow_self_refresh_control(dc->res_pool->hubbub, | |
| 641 | 640 | !dc->res_pool->hubbub->ctx->dc->debug.disable_stutter); | |
| 642 | 641 | ||
| 643 | - | if (dc->clk_mgr && dc->clk_mgr->funcs) | |
| 644 | - | dcn50_initialize_min_clocks(dc); | |
| 642 | + | dcn50_initialize_min_clocks(dc); | |
| 645 | 643 | ||
| 646 | 644 | /* On HW init, allow idle optimizations after pipes have been turned off. | |
| 647 | 645 | * | |
modified drivers/gpu/drm/amd/display/dc/hwss/dcn60/dcn60_hwseq.c
| @@ -643,8 +643,7 @@ void dcn60_init_hw(struct dc *dc) | |||
| 643 | 643 | dc->res_pool->hubbub->funcs->allow_self_refresh_control(dc->res_pool->hubbub, | |
| 644 | 644 | !dc->res_pool->hubbub->ctx->dc->debug.disable_stutter); | |
| 645 | 645 | ||
| 646 | - | if (dc->clk_mgr && dc->clk_mgr->funcs) | |
| 647 | - | dcn401_initialize_min_clocks(dc); | |
| 646 | + | dcn401_initialize_min_clocks(dc); | |
| 648 | 647 | ||
| 649 | 648 | /* On HW init, allow idle optimizations after pipes have been turned off. | |
| 650 | 649 | * | |
| @@ -1002,7 +1001,6 @@ static void dcn60_build_hubbub_perfmon_sequence( | |||
| 1002 | 1001 | /** | |
| 1003 | 1002 | * dcn60_update_probe_status - Set the valid flag on a latched probe result. | |
| 1004 | 1003 | * @status: result sink whose u was written by the GET BLS step during execute | |
| 1005 | - | * @probe: current probe state used to determine measurement type and validity | |
| 1006 | 1004 | */ | |
| 1007 | 1005 | static void dcn60_update_probe_status(struct dc_probe_status *status) | |
| 1008 | 1006 | { | |
| @@ -1026,7 +1024,6 @@ static void dcn60_update_probe_status(struct dc_probe_status *status) | |||
| 1026 | 1024 | /** | |
| 1027 | 1025 | * is_probe_measurement_type_for_hubbub - Returns true if the probe type is | |
| 1028 | 1026 | * served by the hubbub perfmon block on DCN60. | |
| 1029 | - | * @type: the probe measurement type to classify | |
| 1030 | 1027 | */ | |
| 1031 | 1028 | static bool is_probe_measurement_type_for_hubbub(enum dc_probe_type type) | |
| 1032 | 1029 | { | |
modified drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c
| @@ -2142,7 +2142,6 @@ static void smu_v14_0_2_init_msg_ctl(struct smu_context *smu) | |||
| 2142 | 2142 | static ssize_t smu_v14_0_2_get_gpu_metrics(struct smu_context *smu, | |
| 2143 | 2143 | void **table) | |
| 2144 | 2144 | { | |
| 2145 | - | uint32_t mp1_ver = amdgpu_ip_version(smu->adev, MP1_HWIP, 0); | |
| 2146 | 2145 | struct gpu_metrics_v1_3 *gpu_metrics = | |
| 2147 | 2146 | (struct gpu_metrics_v1_3 *)smu_driver_table_ptr( | |
| 2148 | 2147 | smu, SMU_DRIVER_TABLE_GPU_METRICS); | |
| @@ -2172,8 +2171,6 @@ static ssize_t smu_v14_0_2_get_gpu_metrics(struct smu_context *smu, | |||
| 2172 | 2171 | metrics->Vcn1ActivityPercentage); | |
| 2173 | 2172 | ||
| 2174 | 2173 | gpu_metrics->average_socket_power = metrics->AverageSocketPower; | |
| 2175 | - | if (mp1_ver == IP_VERSION(14, 0, 3) && smu->smc_fw_version >= 0x00685000) | |
| 2176 | - | gpu_metrics->energy_accumulator = metrics->EnergyAccumulator; | |
| 2177 | 2174 | ||
| 2178 | 2175 | if (metrics->AverageGfxActivity <= SMU_14_0_2_BUSY_THRESHOLD) | |
| 2179 | 2176 | gpu_metrics->average_gfxclk_frequency = metrics->AverageGfxclkFrequencyPostDs; | |
modified drivers/gpu/drm/aspeed/aspeed_gfx_drv.c
| @@ -189,13 +189,12 @@ 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(drm->dev, NULL); | |
| 192 | + | priv->clk = devm_clk_get_enabled(drm->dev, NULL); | |
| 193 | 193 | if (IS_ERR(priv->clk)) { | |
| 194 | 194 | dev_err(&pdev->dev, | |
| 195 | - | "missing or invalid clk device tree entry"); | |
| 195 | + | "failed to get and enable clock\n"); | |
| 196 | 196 | return PTR_ERR(priv->clk); | |
| 197 | 197 | } | |
| 198 | - | clk_prepare_enable(priv->clk); | |
| 199 | 198 | ||
| 200 | 199 | /* Sanitize control registers */ | |
| 201 | 200 | 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)) | |
| 139 | - | return PTR_ERR(hdmi); | |
| 138 | + | if (IS_ERR(hdmi->dw_hdmi)) | |
| 139 | + | return PTR_ERR(hdmi->dw_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 dw_hdmi *hdmi = platform_get_drvdata(pdev); | |
| 148 | + | struct th1520_hdmi *hdmi = platform_get_drvdata(pdev); | |
| 149 | 149 | ||
| 150 | - | dw_hdmi_remove(hdmi); | |
| 150 | + | dw_hdmi_remove(hdmi->dw_hdmi); | |
| 151 | 151 | } | |
| 152 | 152 | ||
| 153 | 153 | static const struct of_device_id th1520_dw_hdmi_of_table[] = { | |
modified drivers/gpu/drm/ci/xfails/msm-apq8016-fails.txt
| @@ -7,10 +7,3 @@ kms_hdmi_inject@inject-4k,Fail | |||
| 7 | 7 | kms_lease@lease-uevent,Fail | |
| 8 | 8 | msm/msm_mapping@memptrs,Fail | |
| 9 | 9 | msm/msm_mapping@ring,Fail | |
| 10 | - | ||
| 11 | - | # Started failing with v7.3-rc2 backmerge | |
| 12 | - | # https://gitlab.freedesktop.org/drm/msm/-/work_items/104 | |
| 13 | - | kms_cursor_legacy@single-move,Fail | |
| 14 | - | kms_cursor_legacy@torture-bo,Fail | |
| 15 | - | kms_cursor_legacy@forked-bo,Fail | |
| 16 | - | kms_cursor_legacy@torture-move,Fail | |
modified drivers/gpu/drm/display/drm_dp_helper.c
| @@ -4634,7 +4634,9 @@ 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 | - | drm_edp_backlight_enable(bl->aux, &bl->info, brightness); | |
| 4637 | + | ret = drm_edp_backlight_enable(bl->aux, &bl->info, brightness); | |
| 4638 | + | if (ret) | |
| 4639 | + | return ret; | |
| 4638 | 4640 | bl->enabled = true; | |
| 4639 | 4641 | return 0; | |
| 4640 | 4642 | } | |
modified drivers/gpu/drm/drm_bridge.c
| @@ -454,8 +454,10 @@ 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); | |
| 457 | 458 | if (!list_empty(&bridge->list)) | |
| 458 | 459 | list_del_init(&bridge->list); | |
| 460 | + | mutex_unlock(&bridge_lock); | |
| 459 | 461 | ||
| 460 | 462 | mutex_init(&bridge->hpd_state_mutex); | |
| 461 | 463 | mutex_init(&bridge->hpd_mutex); | |
| @@ -593,8 +595,10 @@ int drm_bridge_attach(struct drm_encoder *encoder, struct drm_bridge *bridge, | |||
| 593 | 595 | if (!bridge->container) | |
| 594 | 596 | DRM_WARN("DRM bridge corrupted or not allocated by devm_drm_bridge_alloc()\n"); | |
| 595 | 597 | ||
| 596 | - | if (list_empty(&bridge->list)) | |
| 597 | - | DRM_WARN("Missing drm_bridge_add() before attach\n"); | |
| 598 | + | scoped_guard(mutex, &bridge_lock) { | |
| 599 | + | if (list_empty(&bridge->list)) | |
| 600 | + | DRM_WARN("Missing drm_bridge_add() before attach\n"); | |
| 601 | + | } | |
| 598 | 602 | ||
| 599 | 603 | drm_bridge_get(bridge); | |
| 600 | 604 | ||
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 | - | if (ret == -EAGAIN) { | |
| 1728 | - | fb_helper->deferred_setup = true; | |
| 1727 | + | /* modesets are probed but fb_helper->fb isn't; defer restore too */ | |
| 1728 | + | fb_helper->deferred_setup = true; | |
| 1729 | + | if (ret == -EAGAIN) | |
| 1729 | 1730 | 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,6 +507,7 @@ 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; | |
| 510 | 511 | } | |
| 511 | 512 | ||
| 512 | 513 | /* | |
modified drivers/gpu/drm/i915/display/intel_cursor.c
| @@ -530,14 +530,18 @@ static int i9xx_check_cursor(struct intel_crtc_state *crtc_state, | |||
| 530 | 530 | } | |
| 531 | 531 | ||
| 532 | 532 | static void i9xx_cursor_disable_sel_fetch_arm(struct intel_dsb *dsb, | |
| 533 | - | struct intel_plane *plane, | |
| 534 | - | const struct intel_crtc_state *crtc_state) | |
| 533 | + | struct intel_plane *plane) | |
| 535 | 534 | { | |
| 536 | 535 | struct intel_display *display = to_intel_display(plane); | |
| 537 | 536 | enum pipe pipe = plane->pipe; | |
| 538 | 537 | ||
| 539 | - | if (!crtc_state->enable_psr2_sel_fetch && | |
| 540 | - | !crtc_state->clear_psr2_sel_fetch) | |
| 538 | + | /* | |
| 539 | + | * Clear this whenever the hardware has selective fetch, not just when | |
| 540 | + | * the current state uses it. The cursor may have been enabled with | |
| 541 | + | * selective fetch earlier and had its enable bit orphaned when the | |
| 542 | + | * feature was switched off. | |
| 543 | + | */ | |
| 544 | + | if (!HAS_PSR2_SEL_FETCH(display)) | |
| 541 | 545 | return; | |
| 542 | 546 | ||
| 543 | 547 | intel_de_write_dsb(display, dsb, SEL_FETCH_CUR_CTL(pipe), 0); | |
| @@ -570,10 +574,8 @@ static void i9xx_cursor_update_sel_fetch_arm(struct intel_dsb *dsb, | |||
| 570 | 574 | struct intel_display *display = to_intel_display(plane); | |
| 571 | 575 | enum pipe pipe = plane->pipe; | |
| 572 | 576 | ||
| 573 | - | if (!crtc_state->enable_psr2_sel_fetch) { | |
| 574 | - | i9xx_cursor_disable_sel_fetch_arm(dsb, plane, crtc_state); | |
| 577 | + | if (!crtc_state->enable_psr2_sel_fetch) | |
| 575 | 578 | return; | |
| 576 | - | } | |
| 577 | 579 | ||
| 578 | 580 | if (drm_rect_height(&plane_state->psr2_sel_fetch_area) > 0) { | |
| 579 | 581 | if (crtc_state->enable_psr2_su_region_et) { | |
| @@ -589,7 +591,7 @@ static void i9xx_cursor_update_sel_fetch_arm(struct intel_dsb *dsb, | |||
| 589 | 591 | if (crtc_state->enable_psr2_su_region_et) | |
| 590 | 592 | wa_16021440873(dsb, plane, crtc_state, plane_state); | |
| 591 | 593 | else | |
| 592 | - | i9xx_cursor_disable_sel_fetch_arm(dsb, plane, crtc_state); | |
| 594 | + | i9xx_cursor_disable_sel_fetch_arm(dsb, plane); | |
| 593 | 595 | } | |
| 594 | 596 | } | |
| 595 | 597 | ||
| @@ -698,7 +700,7 @@ static void i9xx_cursor_update_arm(struct intel_dsb *dsb, | |||
| 698 | 700 | if (plane_state) | |
| 699 | 701 | i9xx_cursor_update_sel_fetch_arm(dsb, plane, crtc_state, plane_state); | |
| 700 | 702 | else | |
| 701 | - | i9xx_cursor_disable_sel_fetch_arm(dsb, plane, crtc_state); | |
| 703 | + | i9xx_cursor_disable_sel_fetch_arm(dsb, plane); | |
| 702 | 704 | ||
| 703 | 705 | if (plane->cursor.base != base || | |
| 704 | 706 | plane->cursor.size != fbc_ctl || | |
modified drivers/gpu/drm/i915/display/intel_display_types.h
| @@ -1187,8 +1187,6 @@ struct intel_crtc_state { | |||
| 1187 | 1187 | bool has_sel_update; | |
| 1188 | 1188 | bool enable_psr2_sel_fetch; | |
| 1189 | 1189 | bool enable_psr2_su_region_et; | |
| 1190 | - | /* Drop the stale selective fetch enable bits as selective fetch is turned off */ | |
| 1191 | - | bool clear_psr2_sel_fetch; | |
| 1192 | 1190 | bool req_psr2_sdp_prior_scanline; | |
| 1193 | 1191 | bool has_panel_replay; | |
| 1194 | 1192 | bool link_off_after_as_sdp_when_pr_active; | |
modified drivers/gpu/drm/i915/display/intel_dp_link_caps.c
| @@ -3,8 +3,6 @@ | |||
| 3 | 3 | * Copyright © 2026 Intel Corporation | |
| 4 | 4 | */ | |
| 5 | 5 | ||
| 6 | - | #include <kunit/visibility.h> | |
| 7 | - | ||
| 8 | 6 | #include <linux/bitops.h> | |
| 9 | 7 | #include <linux/debugfs.h> | |
| 10 | 8 | #include <linux/log2.h> | |
| @@ -428,15 +426,12 @@ calc_allowed_config_filter(struct intel_dp_link_caps *link_caps, | |||
| 428 | 426 | const struct intel_dp_link_config *forced_params) | |
| 429 | 427 | { | |
| 430 | 428 | struct intel_dp_link_caps_filter allowed_configs = INTEL_DP_LINK_CAPS_FILTER_NONE; | |
| 431 | - | struct intel_display *display = to_intel_display(link_caps->dp); | |
| 432 | 429 | struct intel_dp_link_caps_order order = bw_desc_config_order(); | |
| 433 | 430 | struct intel_dp_link_caps_iter iter; | |
| 434 | 431 | struct intel_dp_link_config config; | |
| 435 | 432 | ||
| 436 | 433 | iter_start(&iter, link_caps, order, enabled_configs); | |
| 437 | 434 | for_each_dp_link_config(&iter, &config) { | |
| 438 | - | int config_idx; | |
| 439 | - | ||
| 440 | 435 | if (forced_params->rate && | |
| 441 | 436 | forced_params->rate != config.rate) | |
| 442 | 437 | continue; | |
| @@ -451,11 +446,7 @@ calc_allowed_config_filter(struct intel_dp_link_caps *link_caps, | |||
| 451 | 446 | if (config.lane_count > max_limits->lane_count) | |
| 452 | 447 | continue; | |
| 453 | 448 | ||
| 454 | - | config_idx = iter_pos_to_idx(link_caps, order, iter.pos); | |
| 455 | - | if (drm_WARN_ON(display->drm, config_idx < 0)) | |
| 456 | - | continue; | |
| 457 | - | ||
| 458 | - | allowed_configs.config_mask |= BIT(config_idx); | |
| 449 | + | allowed_configs.config_mask |= BIT(iter_pos_to_idx(link_caps, order, iter.pos)); | |
| 459 | 450 | } | |
| 460 | 451 | intel_dp_link_caps_iter_end(&iter); | |
| 461 | 452 | ||
| @@ -1304,14 +1295,14 @@ void intel_dp_link_caps_cleanup(struct intel_dp_link_caps *link_caps) | |||
| 1304 | 1295 | const struct intel_dp_link_caps_test_ops i915_display_dp_link_caps_test_ops = { | |
| 1305 | 1296 | INTEL_DP_LINK_CAPS_TEST_OPS_INIT | |
| 1306 | 1297 | }; | |
| 1307 | - | EXPORT_SYMBOL_IF_KUNIT(i915_display_dp_link_caps_test_ops); | |
| 1298 | + | EXPORT_SYMBOL(i915_display_dp_link_caps_test_ops); | |
| 1308 | 1299 | ||
| 1309 | 1300 | #else | |
| 1310 | 1301 | ||
| 1311 | 1302 | const struct intel_dp_link_caps_test_ops intel_display_dp_link_caps_test_ops = { | |
| 1312 | 1303 | INTEL_DP_LINK_CAPS_TEST_OPS_INIT | |
| 1313 | 1304 | }; | |
| 1314 | - | EXPORT_SYMBOL_IF_KUNIT(intel_display_dp_link_caps_test_ops); | |
| 1305 | + | EXPORT_SYMBOL(intel_display_dp_link_caps_test_ops); | |
| 1315 | 1306 | ||
| 1316 | 1307 | #endif /* I915 */ | |
| 1317 | 1308 | ||
modified drivers/gpu/drm/i915/display/intel_dp_link_training.c
| @@ -2825,14 +2825,14 @@ void intel_dp_link_training_cleanup(struct intel_dp_link_training *link_training | |||
| 2825 | 2825 | const struct intel_dp_link_training_test_ops i915_display_dp_link_training_test_ops = { | |
| 2826 | 2826 | INTEL_DP_LINK_TRAINING_TEST_OPS_INIT | |
| 2827 | 2827 | }; | |
| 2828 | - | EXPORT_SYMBOL_IF_KUNIT(i915_display_dp_link_training_test_ops); | |
| 2828 | + | EXPORT_SYMBOL(i915_display_dp_link_training_test_ops); | |
| 2829 | 2829 | ||
| 2830 | 2830 | #else | |
| 2831 | 2831 | ||
| 2832 | 2832 | const struct intel_dp_link_training_test_ops intel_display_dp_link_training_test_ops = { | |
| 2833 | 2833 | INTEL_DP_LINK_TRAINING_TEST_OPS_INIT | |
| 2834 | 2834 | }; | |
| 2835 | - | EXPORT_SYMBOL_IF_KUNIT(intel_display_dp_link_training_test_ops); | |
| 2835 | + | EXPORT_SYMBOL(intel_display_dp_link_training_test_ops); | |
| 2836 | 2836 | ||
| 2837 | 2837 | #endif /* I915 */ | |
| 2838 | 2838 | ||
modified drivers/gpu/drm/i915/display/intel_dp_mst.c
| @@ -852,8 +852,7 @@ static u8 get_pipes_downstream_of_mst_port(struct intel_atomic_state *state, | |||
| 852 | 852 | if (&connector->mst.dp->mst.mgr != mst_mgr) | |
| 853 | 853 | continue; | |
| 854 | 854 | ||
| 855 | - | if (parent_port && | |
| 856 | - | connector->mst.port != parent_port && | |
| 855 | + | if (connector->mst.port != parent_port && | |
| 857 | 856 | !drm_dp_mst_port_downstream_of_parent(mst_mgr, | |
| 858 | 857 | connector->mst.port, | |
| 859 | 858 | parent_port)) | |
| @@ -2168,27 +2167,6 @@ bool intel_dp_mst_crtc_needs_modeset(struct intel_atomic_state *state, | |||
| 2168 | 2167 | return false; | |
| 2169 | 2168 | } | |
| 2170 | 2169 | ||
| 2171 | - | bool intel_dp_mst_stream_disconnected(struct intel_atomic_state *state, | |
| 2172 | - | const struct intel_crtc *crtc) | |
| 2173 | - | { | |
| 2174 | - | struct intel_connector *connector; | |
| 2175 | - | ||
| 2176 | - | connector = get_connector_in_state_for_crtc(state, crtc); | |
| 2177 | - | if (!connector) | |
| 2178 | - | return false; | |
| 2179 | - | ||
| 2180 | - | if (!connector->mst.dp) | |
| 2181 | - | return false; | |
| 2182 | - | ||
| 2183 | - | if (!connector->mst.dp->mst.mgr.mst_state) | |
| 2184 | - | return true; | |
| 2185 | - | ||
| 2186 | - | if (drm_connector_is_unregistered(&connector->base)) | |
| 2187 | - | return true; | |
| 2188 | - | ||
| 2189 | - | return false; | |
| 2190 | - | } | |
| 2191 | - | ||
| 2192 | 2170 | /** | |
| 2193 | 2171 | * intel_dp_mst_prepare_probe - Prepare an MST link for topology probing | |
| 2194 | 2172 | * @intel_dp: DP port object | |
modified drivers/gpu/drm/i915/display/intel_dp_mst.h
| @@ -28,8 +28,6 @@ int intel_dp_mst_atomic_check_link(struct intel_atomic_state *state, | |||
| 28 | 28 | struct intel_link_bw_limits *limits); | |
| 29 | 29 | bool intel_dp_mst_crtc_needs_modeset(struct intel_atomic_state *state, | |
| 30 | 30 | struct intel_crtc *crtc); | |
| 31 | - | bool intel_dp_mst_stream_disconnected(struct intel_atomic_state *state, | |
| 32 | - | const struct intel_crtc *crtc); | |
| 33 | 31 | void intel_dp_mst_prepare_probe(struct intel_dp *intel_dp); | |
| 34 | 32 | bool intel_dp_mst_verify_dpcd_state(struct intel_dp *intel_dp); | |
| 35 | 33 | ||
modified drivers/gpu/drm/i915/display/intel_link_bw.c
| @@ -64,8 +64,7 @@ void intel_link_bw_init_limits(struct intel_atomic_state *state, | |||
| 64 | 64 | intel_atomic_get_new_crtc_state(state, crtc); | |
| 65 | 65 | int forced_bpp_x16 = get_forced_link_bpp_x16(state, crtc); | |
| 66 | 66 | ||
| 67 | - | if ((state->base.duplicated && crtc_state) || | |
| 68 | - | intel_dp_mst_stream_disconnected(state, crtc)) { | |
| 67 | + | if (state->base.duplicated && crtc_state) { | |
| 69 | 68 | limits->max_bpp_x16[pipe] = crtc_state->max_link_bpp_x16; | |
| 70 | 69 | if (intel_dsc_enabled_on_link(crtc_state)) | |
| 71 | 70 | limits->link_dsc_pipes |= BIT(pipe); | |
modified drivers/gpu/drm/i915/display/intel_psr.c
| @@ -2883,8 +2883,6 @@ int intel_psr2_sel_fetch_update(struct intel_atomic_state *state, | |||
| 2883 | 2883 | struct intel_crtc *crtc) | |
| 2884 | 2884 | { | |
| 2885 | 2885 | struct intel_display *display = to_intel_display(state); | |
| 2886 | - | const struct intel_crtc_state *old_crtc_state = | |
| 2887 | - | intel_atomic_get_old_crtc_state(state, crtc); | |
| 2888 | 2886 | struct intel_crtc_state *crtc_state = intel_atomic_get_new_crtc_state(state, crtc); | |
| 2889 | 2887 | struct intel_plane_state *new_plane_state, *old_plane_state; | |
| 2890 | 2888 | struct intel_plane *plane; | |
| @@ -2897,19 +2895,6 @@ int intel_psr2_sel_fetch_update(struct intel_atomic_state *state, | |||
| 2897 | 2895 | bool full_update = false, su_area_changed; | |
| 2898 | 2896 | int i, ret; | |
| 2899 | 2897 | ||
| 2900 | - | /* | |
| 2901 | - | * Selective fetch is not always usable, for instance it is dropped | |
| 2902 | - | * while pipe CRC is active. The planes keep their selective fetch | |
| 2903 | - | * enable bit set in hardware over that, and a plane disabled while | |
| 2904 | - | * selective fetch is off never gets the bit cleared. Once selective | |
| 2905 | - | * fetch comes back the hardware would resume fetching for a plane that | |
| 2906 | - | * is no longer enabled and keep its DDB range reserved, so have the | |
| 2907 | - | * plane update drop the bit for every plane of the pipe as selective | |
| 2908 | - | * fetch is turned off. | |
| 2909 | - | */ | |
| 2910 | - | crtc_state->clear_psr2_sel_fetch = old_crtc_state->enable_psr2_sel_fetch && | |
| 2911 | - | !crtc_state->enable_psr2_sel_fetch; | |
| 2912 | - | ||
| 2913 | 2898 | if (!crtc_state->enable_psr2_sel_fetch) | |
| 2914 | 2899 | return 0; | |
| 2915 | 2900 | ||
modified drivers/gpu/drm/i915/display/intel_quirks.c
| @@ -257,9 +257,6 @@ static struct intel_quirk intel_quirks[] = { | |||
| 257 | 257 | /* Dell XPS 13 7390 2-in-1 */ | |
| 258 | 258 | { 0x8a52, 0x1028, 0x08b0, quirk_edp_limit_rate_hbr2 }, | |
| 259 | 259 | ||
| 260 | - | /* HP Pavilion Plus Laptop 14-ew1xxx */ | |
| 261 | - | { 0x7d55, 0x103c, 0x8c31, quirk_edp_limit_rate_hbr2 }, | |
| 262 | - | ||
| 263 | 260 | /* Xiaomi Book Pro 14 2026 */ | |
| 264 | 261 | { 0xb081, 0x1d72, 0x2424, quirk_disable_psr2 }, | |
| 265 | 262 | }; | |
modified drivers/gpu/drm/i915/display/skl_universal_plane.c
| @@ -879,14 +879,18 @@ skl_plane_disable_arm(struct intel_dsb *dsb, | |||
| 879 | 879 | } | |
| 880 | 880 | ||
| 881 | 881 | static void icl_plane_disable_sel_fetch_arm(struct intel_dsb *dsb, | |
| 882 | - | struct intel_plane *plane, | |
| 883 | - | const struct intel_crtc_state *crtc_state) | |
| 882 | + | struct intel_plane *plane) | |
| 884 | 883 | { | |
| 885 | 884 | struct intel_display *display = to_intel_display(plane); | |
| 886 | 885 | enum pipe pipe = plane->pipe; | |
| 887 | 886 | ||
| 888 | - | if (!crtc_state->enable_psr2_sel_fetch && | |
| 889 | - | !crtc_state->clear_psr2_sel_fetch) | |
| 887 | + | /* | |
| 888 | + | * Clear this whenever the hardware has selective fetch, not just when | |
| 889 | + | * the current state uses it. The plane may have been enabled with | |
| 890 | + | * selective fetch earlier and had its enable bit orphaned when the | |
| 891 | + | * feature was switched off. | |
| 892 | + | */ | |
| 893 | + | if (!HAS_PSR2_SEL_FETCH(display)) | |
| 890 | 894 | return; | |
| 891 | 895 | ||
| 892 | 896 | intel_de_write_dsb(display, dsb, SEL_FETCH_PLANE_CTL(pipe, plane->id), 0); | |
| @@ -922,7 +926,7 @@ icl_plane_disable_arm(struct intel_dsb *dsb, | |||
| 922 | 926 | ||
| 923 | 927 | skl_write_plane_wm(dsb, plane, crtc_state); | |
| 924 | 928 | ||
| 925 | - | icl_plane_disable_sel_fetch_arm(dsb, plane, crtc_state); | |
| 929 | + | icl_plane_disable_sel_fetch_arm(dsb, plane); | |
| 926 | 930 | ||
| 927 | 931 | if (plane_has_normalizer(plane)) | |
| 928 | 932 | intel_de_write_dsb(display, dsb, | |
| @@ -1635,12 +1639,14 @@ static void icl_plane_update_sel_fetch_arm(struct intel_dsb *dsb, | |||
| 1635 | 1639 | struct intel_display *display = to_intel_display(plane); | |
| 1636 | 1640 | enum pipe pipe = plane->pipe; | |
| 1637 | 1641 | ||
| 1638 | - | if (crtc_state->enable_psr2_sel_fetch && | |
| 1639 | - | drm_rect_height(&plane_state->psr2_sel_fetch_area) > 0) | |
| 1642 | + | if (!crtc_state->enable_psr2_sel_fetch) | |
| 1643 | + | return; | |
| 1644 | + | ||
| 1645 | + | if (drm_rect_height(&plane_state->psr2_sel_fetch_area) > 0) | |
| 1640 | 1646 | intel_de_write_dsb(display, dsb, SEL_FETCH_PLANE_CTL(pipe, plane->id), | |
| 1641 | 1647 | SEL_FETCH_PLANE_CTL_ENABLE); | |
| 1642 | 1648 | else | |
| 1643 | - | icl_plane_disable_sel_fetch_arm(dsb, plane, crtc_state); | |
| 1649 | + | icl_plane_disable_sel_fetch_arm(dsb, plane); | |
| 1644 | 1650 | } | |
| 1645 | 1651 | ||
| 1646 | 1652 | static void | |
modified drivers/gpu/drm/i915/gem/i915_gem_object.c
| @@ -89,7 +89,6 @@ struct drm_i915_gem_object *i915_gem_object_alloc(void) | |||
| 89 | 89 | ||
| 90 | 90 | void i915_gem_object_free(struct drm_i915_gem_object *obj) | |
| 91 | 91 | { | |
| 92 | - | dma_resv_fini(&obj->base._resv); | |
| 93 | 92 | return kmem_cache_free(slab_objects, obj); | |
| 94 | 93 | } | |
| 95 | 94 | ||
| @@ -145,6 +144,7 @@ void __i915_gem_object_fini(struct drm_i915_gem_object *obj) | |||
| 145 | 144 | { | |
| 146 | 145 | mutex_destroy(&obj->mm.get_page.lock); | |
| 147 | 146 | mutex_destroy(&obj->mm.get_dma_page.lock); | |
| 147 | + | dma_resv_fini(&obj->base._resv); | |
| 148 | 148 | } | |
| 149 | 149 | ||
| 150 | 150 | /** | |
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: Start offset of the requested device-virtual memory mapping. | |
| 2340 | + | * @sgt_offset: Offset into @sgt of the start of the requested 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,7 +2350,6 @@ 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; | |
| 2354 | 2353 | int err; | |
| 2355 | 2354 | ||
| 2356 | 2355 | struct pvr_mmu_op_context *op_ctx = kzalloc_obj(*op_ctx); | |
| @@ -2365,18 +2364,18 @@ pvr_mmu_op_context_create(struct pvr_mmu_context *ctx, struct sg_table *sgt, | |||
| 2365 | 2364 | ||
| 2366 | 2365 | if (size) { | |
| 2367 | 2366 | /* | |
| 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. | |
| 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. | |
| 2373 | 2371 | */ | |
| 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; | |
| 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; | |
| 2380 | 2379 | ||
| 2381 | 2380 | /* | |
| 2382 | 2381 | * Alloc and push page table entries until we have enough of | |
modified drivers/gpu/drm/imagination/pvr_vm.c
| @@ -418,6 +418,8 @@ 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; | |
| 421 | 423 | struct pvr_vm_bind_op *ctx = op_ctx; | |
| 422 | 424 | u64 va_start = 0, va_range = 0; | |
| 423 | 425 | int err; | |
| @@ -433,14 +435,12 @@ pvr_vm_gpuva_remap(struct drm_gpuva_op *op, void *op_ctx) | |||
| 433 | 435 | drm_gpuva_remap(&ctx->prev_va->base, &ctx->next_va->base, &op->remap); | |
| 434 | 436 | ||
| 435 | 437 | if (op->remap.prev) { | |
| 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); | |
| 438 | + | drm_gpuva_link(&ctx->prev_va->base, vm_bo); | |
| 438 | 439 | ctx->prev_va = NULL; | |
| 439 | 440 | } | |
| 440 | 441 | ||
| 441 | 442 | if (op->remap.next) { | |
| 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); | |
| 443 | + | drm_gpuva_link(&ctx->next_va->base, vm_bo); | |
| 444 | 444 | ctx->next_va = NULL; | |
| 445 | 445 | } | |
| 446 | 446 | ||
modified drivers/gpu/drm/msm/Makefile
| @@ -177,6 +177,7 @@ quiet_cmd_headergen = GENHDR $@ | |||
| 177 | 177 | cmd_headergen = mkdir -p $(obj)/generated && $(PYTHON3) $(src)/registers/gen_header.py \ | |
| 178 | 178 | $(headergen-opts) --rnn $(src)/registers --xml $< c-defines > $@ | |
| 179 | 179 | ||
| 180 | + | # TODO how to do this for a2xx/a5xx which have different .xml arg? | |
| 180 | 181 | quiet_cmd_headergen_json = GENHDRJSN $@ | |
| 181 | 182 | cmd_headergen_json = mkdir -p $(obj)/generated && $(PYTHON3) $(src)/registers/gen_header.py \ | |
| 182 | 183 | $(headergen-opts) --rnn $(src)/registers --xml $(filter %.xml,$^) perfcntrs --json $< > $@ | |
modified drivers/gpu/drm/msm/adreno/a6xx_gmu.c
| @@ -320,7 +320,7 @@ static int a6xx_gmu_start(struct a6xx_gmu *gmu) | |||
| 320 | 320 | gmu_write(gmu, REG_A6XX_GMU_CM3_SYSRESET, 0); | |
| 321 | 321 | ||
| 322 | 322 | ret = gmu_poll_timeout(gmu, REG_A6XX_GMU_CM3_FW_INIT_RESULT, val, | |
| 323 | - | (val & mask) == reset_val, 100, 100000); | |
| 323 | + | (val & mask) == reset_val, 100, 10000); | |
| 324 | 324 | ||
| 325 | 325 | if (ret) | |
| 326 | 326 | DRM_DEV_ERROR(gmu->dev, "GMU firmware initialization timed out\n"); | |
modified drivers/gpu/drm/msm/adreno/a6xx_gpu.c
| @@ -23,15 +23,9 @@ static u64 a6xx_gmu_get_timestamp(struct msm_gpu *gpu) | |||
| 23 | 23 | u64 count_hi, count_lo, temp; | |
| 24 | 24 | ||
| 25 | 25 | do { | |
| 26 | - | if (adreno_is_a750_family(adreno_gpu)) { | |
| 27 | - | count_hi = gmu_read(&a6xx_gpu->gmu, REG_A7XX_GMU_CX_AO_COUNTER_H); | |
| 28 | - | count_lo = gmu_read(&a6xx_gpu->gmu, REG_A7XX_GMU_CX_AO_COUNTER_L); | |
| 29 | - | temp = gmu_read(&a6xx_gpu->gmu, REG_A7XX_GMU_CX_AO_COUNTER_H); | |
| 30 | - | } else { | |
| 31 | - | count_hi = gmu_read(&a6xx_gpu->gmu, REG_A6XX_GMU_ALWAYS_ON_COUNTER_H); | |
| 32 | - | count_lo = gmu_read(&a6xx_gpu->gmu, REG_A6XX_GMU_ALWAYS_ON_COUNTER_L); | |
| 33 | - | temp = gmu_read(&a6xx_gpu->gmu, REG_A6XX_GMU_ALWAYS_ON_COUNTER_H); | |
| 34 | - | } | |
| 26 | + | count_hi = gmu_read(&a6xx_gpu->gmu, REG_A6XX_GMU_ALWAYS_ON_COUNTER_H); | |
| 27 | + | count_lo = gmu_read(&a6xx_gpu->gmu, REG_A6XX_GMU_ALWAYS_ON_COUNTER_L); | |
| 28 | + | temp = gmu_read(&a6xx_gpu->gmu, REG_A6XX_GMU_ALWAYS_ON_COUNTER_H); | |
| 35 | 29 | } while (unlikely(count_hi != temp)); | |
| 36 | 30 | ||
| 37 | 31 | return (count_hi << 32) | count_lo; | |
modified drivers/gpu/drm/msm/adreno/adreno_device.c
| @@ -25,7 +25,7 @@ MODULE_PARM_DESC(disable_acd, "Forcefully disable GPU ACD"); | |||
| 25 | 25 | module_param_unsafe(disable_acd, bool, 0400); | |
| 26 | 26 | ||
| 27 | 27 | static bool skip_gpu; | |
| 28 | - | MODULE_PARM_DESC(skip_gpu, "Disable GPU driver register (0=enable GPU driver register (default), 1=skip GPU driver register"); | |
| 28 | + | MODULE_PARM_DESC(no_gpu, "Disable GPU driver register (0=enable GPU driver register (default), 1=skip GPU driver register"); | |
| 29 | 29 | module_param(skip_gpu, bool, 0400); | |
| 30 | 30 | ||
| 31 | 31 | extern const struct adreno_gpulist a2xx_gpulist; | |
modified drivers/gpu/drm/msm/adreno/adreno_gpu.c
| @@ -52,12 +52,6 @@ static int zap_shader_load_mdt(struct msm_gpu *gpu, const char *fwname, | |||
| 52 | 52 | return -ENODEV; | |
| 53 | 53 | } | |
| 54 | 54 | ||
| 55 | - | /* We need PAS to be able to load the firmware */ | |
| 56 | - | if (!qcom_pas_is_available()) { | |
| 57 | - | DRM_DEV_ERROR(dev, "PAS is not available\n"); | |
| 58 | - | return -EPROBE_DEFER; | |
| 59 | - | } | |
| 60 | - | ||
| 61 | 55 | ret = of_reserved_mem_region_to_resource(np, 0, &r); | |
| 62 | 56 | if (ret) { | |
| 63 | 57 | zap_available = false; | |
| @@ -176,11 +170,18 @@ out: | |||
| 176 | 170 | int adreno_zap_shader_load(struct msm_gpu *gpu, u32 pasid) | |
| 177 | 171 | { | |
| 178 | 172 | struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu); | |
| 173 | + | struct platform_device *pdev = gpu->pdev; | |
| 179 | 174 | ||
| 180 | 175 | /* Short cut if we determine the zap shader isn't available/needed */ | |
| 181 | 176 | if (!zap_available) | |
| 182 | 177 | return -ENODEV; | |
| 183 | 178 | ||
| 179 | + | /* We need PAS to be able to load the firmware */ | |
| 180 | + | if (!qcom_pas_is_available()) { | |
| 181 | + | DRM_DEV_ERROR(&pdev->dev, "PAS is not available\n"); | |
| 182 | + | return -EPROBE_DEFER; | |
| 183 | + | } | |
| 184 | + | ||
| 184 | 185 | return zap_shader_load_mdt(gpu, adreno_gpu->info->zapfw, pasid); | |
| 185 | 186 | } | |
| 186 | 187 | ||
| @@ -1261,8 +1262,6 @@ void adreno_gpu_cleanup(struct adreno_gpu *adreno_gpu) | |||
| 1261 | 1262 | for (i = 0; i < ARRAY_SIZE(adreno_gpu->info->fw); i++) | |
| 1262 | 1263 | release_firmware(adreno_gpu->fw[i]); | |
| 1263 | 1264 | ||
| 1264 | - | pm_runtime_dont_use_autosuspend(&gpu->pdev->dev); | |
| 1265 | - | ||
| 1266 | 1265 | if (priv && pm_runtime_enabled(&priv->gpu_pdev->dev)) | |
| 1267 | 1266 | pm_runtime_disable(&priv->gpu_pdev->dev); | |
| 1268 | 1267 | ||
modified drivers/gpu/drm/msm/disp/dpu1/dpu_hw_ctl.c
| @@ -118,7 +118,6 @@ static inline void dpu_hw_ctl_clear_pending_flush(struct dpu_hw_ctl *ctx) | |||
| 118 | 118 | ctx->pending_intf_flush_mask = 0; | |
| 119 | 119 | ctx->pending_wb_flush_mask = 0; | |
| 120 | 120 | ctx->pending_cwb_flush_mask = 0; | |
| 121 | - | ctx->pending_periph_flush_mask = 0; | |
| 122 | 121 | ctx->pending_merge_3d_flush_mask = 0; | |
| 123 | 122 | ctx->pending_dsc_flush_mask = 0; | |
| 124 | 123 | ctx->pending_cdm_flush_mask = 0; | |
modified drivers/gpu/drm/msm/dp/dp_display.c
| @@ -756,7 +756,6 @@ enum drm_mode_status msm_dp_display_mode_valid(struct msm_dp *dp, | |||
| 756 | 756 | struct msm_dp_link_info *link_info; | |
| 757 | 757 | u32 mode_rate_khz = 0, supported_rate_khz = 0, mode_bpp = 0; | |
| 758 | 758 | int mode_pclk_khz = mode->clock; | |
| 759 | - | int link_pclk_khz; | |
| 760 | 759 | bool is_yuv_420; | |
| 761 | 760 | ||
| 762 | 761 | if (!dp || !mode_pclk_khz || !dp->connector) { | |
| @@ -776,8 +775,6 @@ enum drm_mode_status msm_dp_display_mode_valid(struct msm_dp *dp, | |||
| 776 | 775 | if (is_yuv_420 && !msm_dp_display->panel->vsc_sdp_supported) | |
| 777 | 776 | return MODE_NO_420; | |
| 778 | 777 | ||
| 779 | - | link_pclk_khz = is_yuv_420 ? mode_pclk_khz / 2 : mode_pclk_khz; | |
| 780 | - | ||
| 781 | 778 | if (is_yuv_420 || msm_dp_display->wide_bus_supported) | |
| 782 | 779 | mode_pclk_khz /= 2; | |
| 783 | 780 | ||
| @@ -789,9 +786,9 @@ enum drm_mode_status msm_dp_display_mode_valid(struct msm_dp *dp, | |||
| 789 | 786 | mode_bpp = default_bpp; | |
| 790 | 787 | ||
| 791 | 788 | mode_bpp = msm_dp_panel_get_mode_bpp(msm_dp_display->panel, | |
| 792 | - | mode_bpp, link_pclk_khz); | |
| 789 | + | mode_bpp, mode_pclk_khz); | |
| 793 | 790 | ||
| 794 | - | mode_rate_khz = link_pclk_khz * mode_bpp; | |
| 791 | + | mode_rate_khz = mode_pclk_khz * mode_bpp; | |
| 795 | 792 | supported_rate_khz = link_info->num_lanes * link_info->rate * 8; | |
| 796 | 793 | ||
| 797 | 794 | if (mode_rate_khz > supported_rate_khz) | |
| @@ -1461,20 +1458,6 @@ void msm_dp_display_atomic_disable(struct msm_dp *dp) | |||
| 1461 | 1458 | ||
| 1462 | 1459 | msm_dp_display = container_of(dp, struct msm_dp_display_private, msm_dp_display); | |
| 1463 | 1460 | ||
| 1464 | - | /* | |
| 1465 | - | * If .atomic_enable() bailed out - link training failure is the common | |
| 1466 | - | * case - the mainlink was never brought up and ->power_on stayed false. | |
| 1467 | - | * Driving the PUSH_IDLE pattern into a controller that was never | |
| 1468 | - | * enabled times out, and .atomic_post_disable() then drops the | |
| 1469 | - | * controller's runtime-PM reference without tearing the PHY back down, | |
| 1470 | - | * because msm_dp_display_disable() returns early on !power_on. On | |
| 1471 | - | * glymur (Snapdragon X2 Elite) that combination is answered by a | |
| 1472 | - | * TrustZone-level SOCCP/ADSP force-stop and a silent SoC reset. | |
| 1473 | - | * There is nothing to push idle, so leave it alone. | |
| 1474 | - | */ | |
| 1475 | - | if (!dp->power_on) | |
| 1476 | - | return; | |
| 1477 | - | ||
| 1478 | 1461 | msm_dp_ctrl_push_idle(msm_dp_display->ctrl); | |
| 1479 | 1462 | } | |
| 1480 | 1463 | ||
modified drivers/gpu/drm/msm/dsi/dsi_host.c
| @@ -129,7 +129,7 @@ struct msm_dsi_host { | |||
| 129 | 129 | struct clk *dsi_pll_pixel_clk; | |
| 130 | 130 | ||
| 131 | 131 | unsigned long byte_clk_rate; | |
| 132 | - | bool byte_intf_clk_div_2; | |
| 132 | + | unsigned long byte_intf_clk_rate; | |
| 133 | 133 | unsigned long pixel_clk_rate; | |
| 134 | 134 | unsigned long esc_clk_rate; | |
| 135 | 135 | ||
| @@ -382,20 +382,8 @@ int msm_dsi_runtime_resume(struct device *dev) | |||
| 382 | 382 | ||
| 383 | 383 | int dsi_link_clk_set_rate_6g(struct msm_dsi_host *msm_host) | |
| 384 | 384 | { | |
| 385 | - | unsigned long byte_intf_clk_rate; | |
| 386 | - | long rounded_byte_clk_rate; | |
| 387 | 385 | int ret; | |
| 388 | 386 | ||
| 389 | - | rounded_byte_clk_rate = clk_round_rate(msm_host->byte_clk, | |
| 390 | - | msm_host->byte_clk_rate); | |
| 391 | - | if (rounded_byte_clk_rate < 0) { | |
| 392 | - | pr_err("%s: failed to round byte clock rate, %ld\n", | |
| 393 | - | __func__, rounded_byte_clk_rate); | |
| 394 | - | return rounded_byte_clk_rate; | |
| 395 | - | } | |
| 396 | - | ||
| 397 | - | msm_host->byte_clk_rate = rounded_byte_clk_rate; | |
| 398 | - | ||
| 399 | 387 | DBG("Set clk rates: pclk=%lu, byteclk=%lu", | |
| 400 | 388 | msm_host->pixel_clk_rate, msm_host->byte_clk_rate); | |
| 401 | 389 | ||
| @@ -413,11 +401,7 @@ int dsi_link_clk_set_rate_6g(struct msm_dsi_host *msm_host) | |||
| 413 | 401 | } | |
| 414 | 402 | ||
| 415 | 403 | if (msm_host->byte_intf_clk) { | |
| 416 | - | byte_intf_clk_rate = msm_host->byte_clk_rate; | |
| 417 | - | if (msm_host->byte_intf_clk_div_2) | |
| 418 | - | byte_intf_clk_rate /= 2; | |
| 419 | - | ||
| 420 | - | ret = clk_set_rate(msm_host->byte_intf_clk, byte_intf_clk_rate); | |
| 404 | + | ret = clk_set_rate(msm_host->byte_intf_clk, msm_host->byte_intf_clk_rate); | |
| 421 | 405 | if (ret) { | |
| 422 | 406 | pr_err("%s: Failed to set rate byte intf clk, %d\n", | |
| 423 | 407 | __func__, ret); | |
| @@ -685,12 +669,24 @@ static void dsi_calc_pclk(struct msm_dsi_host *msm_host, bool is_bonded_dsi) | |||
| 685 | 669 | ||
| 686 | 670 | int dsi_calc_clk_rate_6g(struct msm_dsi_host *msm_host, bool is_bonded_dsi) | |
| 687 | 671 | { | |
| 672 | + | long rounded_byte_clk_rate; | |
| 673 | + | ||
| 688 | 674 | if (!msm_host->mode) { | |
| 689 | 675 | pr_err("%s: mode not set\n", __func__); | |
| 690 | 676 | return -EINVAL; | |
| 691 | 677 | } | |
| 692 | 678 | ||
| 693 | 679 | dsi_calc_pclk(msm_host, is_bonded_dsi); | |
| 680 | + | ||
| 681 | + | rounded_byte_clk_rate = clk_round_rate(msm_host->byte_clk, | |
| 682 | + | msm_host->byte_clk_rate); | |
| 683 | + | if (rounded_byte_clk_rate < 0) { | |
| 684 | + | pr_err("%s: failed to round byte clock rate, %ld\n", | |
| 685 | + | __func__, rounded_byte_clk_rate); | |
| 686 | + | return rounded_byte_clk_rate; | |
| 687 | + | } | |
| 688 | + | ||
| 689 | + | msm_host->byte_clk_rate = rounded_byte_clk_rate; | |
| 694 | 690 | msm_host->esc_clk_rate = clk_get_rate(msm_host->esc_clk); | |
| 695 | 691 | return 0; | |
| 696 | 692 | } | |
| @@ -2499,7 +2495,9 @@ int msm_dsi_host_power_on(struct mipi_dsi_host *host, | |||
| 2499 | 2495 | goto unlock_ret; | |
| 2500 | 2496 | } | |
| 2501 | 2497 | ||
| 2502 | - | msm_host->byte_intf_clk_div_2 = phy_shared_timings->byte_intf_clk_div_2; | |
| 2498 | + | msm_host->byte_intf_clk_rate = msm_host->byte_clk_rate; | |
| 2499 | + | if (phy_shared_timings->byte_intf_clk_div_2) | |
| 2500 | + | msm_host->byte_intf_clk_rate /= 2; | |
| 2503 | 2501 | ||
| 2504 | 2502 | msm_dsi_sfpb_config(msm_host, true); | |
| 2505 | 2503 | ||
modified drivers/gpu/drm/msm/hdmi/hdmi_phy.c
| @@ -168,13 +168,13 @@ static int msm_hdmi_phy_probe(struct platform_device *pdev) | |||
| 168 | 168 | ||
| 169 | 169 | ret = msm_hdmi_phy_resource_enable(phy); | |
| 170 | 170 | if (ret) | |
| 171 | - | goto err_pm_disable; | |
| 171 | + | return ret; | |
| 172 | 172 | ||
| 173 | 173 | ret = msm_hdmi_phy_pll_init(pdev, phy->cfg->type); | |
| 174 | 174 | if (ret) { | |
| 175 | 175 | DRM_DEV_ERROR(dev, "couldn't init PLL\n"); | |
| 176 | 176 | msm_hdmi_phy_resource_disable(phy); | |
| 177 | - | goto err_pm_disable; | |
| 177 | + | return ret; | |
| 178 | 178 | } | |
| 179 | 179 | ||
| 180 | 180 | msm_hdmi_phy_resource_disable(phy); | |
| @@ -182,10 +182,6 @@ static int msm_hdmi_phy_probe(struct platform_device *pdev) | |||
| 182 | 182 | platform_set_drvdata(pdev, phy); | |
| 183 | 183 | ||
| 184 | 184 | return 0; | |
| 185 | - | ||
| 186 | - | err_pm_disable: | |
| 187 | - | pm_runtime_disable(dev); | |
| 188 | - | return ret; | |
| 189 | 185 | } | |
| 190 | 186 | ||
| 191 | 187 | static void msm_hdmi_phy_remove(struct platform_device *pdev) | |
modified drivers/gpu/drm/msm/msm_drv.c
| @@ -55,7 +55,7 @@ MODULE_PARM_DESC(modeset, "Use kernel modesetting [KMS] (1=on (default), 0=disab | |||
| 55 | 55 | module_param(modeset, bool, 0600); | |
| 56 | 56 | ||
| 57 | 57 | static bool separate_gpu_kms; | |
| 58 | - | MODULE_PARM_DESC(separate_gpu_kms, "Use separate DRM device for the GPU (0=single DRM device for both GPU and display (default), 1=two DRM devices)"); | |
| 58 | + | MODULE_PARM_DESC(separate_gpu_drm, "Use separate DRM device for the GPU (0=single DRM device for both GPU and display (default), 1=two DRM devices)"); | |
| 59 | 59 | module_param(separate_gpu_kms, bool, 0400); | |
| 60 | 60 | ||
| 61 | 61 | DECLARE_FAULT_ATTR(fail_gem_alloc); | |
modified drivers/gpu/drm/msm/msm_fbdev.c
| @@ -155,7 +155,6 @@ int msm_fbdev_driver_fbdev_probe(struct drm_fb_helper *helper, | |||
| 155 | 155 | helper->fb = buffer->fb; | |
| 156 | 156 | ||
| 157 | 157 | fbi->fbops = &msm_fb_ops; | |
| 158 | - | fbi->flags |= FBINFO_VIRTFB; /* system memory */ | |
| 159 | 158 | ||
| 160 | 159 | drm_fb_helper_fill_info(fbi, helper, sizes); | |
| 161 | 160 | ||
modified drivers/gpu/drm/msm/msm_gem.h
| @@ -68,9 +68,6 @@ struct msm_gem_vm { | |||
| 68 | 68 | /** @base: Inherit from drm_gpuvm. */ | |
| 69 | 69 | struct drm_gpuvm base; | |
| 70 | 70 | ||
| 71 | - | /** @rcu: RCU-delayed free so an exported sched fence->sched stays valid. */ | |
| 72 | - | struct rcu_head rcu; | |
| 73 | - | ||
| 74 | 71 | /** | |
| 75 | 72 | * @sched: Scheduler used for asynchronous VM_BIND request. | |
| 76 | 73 | * | |
modified drivers/gpu/drm/msm/msm_gem_vma.c
| @@ -166,7 +166,7 @@ msm_gem_vm_free(struct drm_gpuvm *gpuvm) | |||
| 166 | 166 | dma_fence_put(vm->last_fence); | |
| 167 | 167 | put_pid(vm->pid); | |
| 168 | 168 | kfree(vm->log); | |
| 169 | - | kfree_rcu(vm, rcu); | |
| 169 | + | kfree(vm); | |
| 170 | 170 | } | |
| 171 | 171 | ||
| 172 | 172 | /** | |
modified drivers/gpu/drm/msm/msm_ringbuffer.c
| @@ -140,5 +140,5 @@ void msm_ringbuffer_destroy(struct msm_ringbuffer *ring) | |||
| 140 | 140 | ||
| 141 | 141 | msm_gem_kernel_put(ring->bo, ring->gpu->vm); | |
| 142 | 142 | ||
| 143 | - | kfree_rcu(ring, rcu); | |
| 143 | + | kfree(ring); | |
| 144 | 144 | } | |
modified drivers/gpu/drm/msm/msm_ringbuffer.h
| @@ -55,7 +55,6 @@ struct msm_ringbuffer { | |||
| 55 | 55 | /* | |
| 56 | 56 | * The job scheduler for this ring. | |
| 57 | 57 | */ | |
| 58 | - | struct rcu_head rcu; | |
| 59 | 58 | struct drm_gpu_scheduler sched; | |
| 60 | 59 | bool sched_initialized; | |
| 61 | 60 | ||
modified drivers/gpu/drm/msm/registers/adreno/a6xx_gmu.xml
| @@ -141,8 +141,6 @@ xsi:schemaLocation="https://gitlab.freedesktop.org/freedreno/ rules-fd.xsd"> | |||
| 141 | 141 | <reg32 offset="0x1f9f0" name="GMU_BOOT_KMD_LM_HANDSHAKE"/> | |
| 142 | 142 | <reg32 offset="0x1f957" name="GMU_LLM_GLM_SLEEP_CTRL"/> | |
| 143 | 143 | <reg32 offset="0x1f958" name="GMU_LLM_GLM_SLEEP_STATUS"/> | |
| 144 | - | <reg32 offset="0x1f880" name="GMU_CX_AO_COUNTER_L" variants="A7XX"/> | |
| 145 | - | <reg32 offset="0x1f881" name="GMU_CX_AO_COUNTER_H" variants="A7XX"/> | |
| 146 | 144 | <reg32 offset="0x1f888" name="GMU_ALWAYS_ON_COUNTER_L" variants="A6XX-A7XX"/> | |
| 147 | 145 | <reg32 offset="0x1f840" name="GMU_ALWAYS_ON_COUNTER_L" variants="A8XX-"/> | |
| 148 | 146 | <reg32 offset="0x1f889" name="GMU_ALWAYS_ON_COUNTER_H" variants="A6XX-A7XX"/> | |
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_NVDEC) { | |
| 491 | + | if (engine == NV_DEVICE_HOST_RUNLIST_ENGINES_GR) { | |
| 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) { | |
| 204 | + | if (!gsp || !gsp->rm) { | |
| 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,6 +3674,9 @@ 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 | + | ||
| 3677 | 3680 | group = kzalloc_obj(*group); | |
| 3678 | 3681 | if (!group) | |
| 3679 | 3682 | return -ENOMEM; | |
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 = kmalloc_objs(struct list_head, new_size); | |
| 207 | + | new_list = kvmalloc_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 | - | kfree(vc4->bo_cache.size_list); | |
| 227 | + | kvfree(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,6 +1052,7 @@ 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); | |
| 1055 | 1056 | ||
| 1056 | 1057 | for (i = 0; i < vc4->num_labels; i++) { | |
| 1057 | 1058 | if (vc4->bo_labels[i].num_allocated) { | |
modified drivers/gpu/drm/vc4/vc4_drv.c
| @@ -360,8 +360,11 @@ 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) | |
| 363 | + | if (ret) { | |
| 364 | + | if (firmware) | |
| 365 | + | rpi_firmware_put(firmware); | |
| 364 | 366 | goto err; | |
| 367 | + | } | |
| 365 | 368 | ||
| 366 | 369 | if (firmware) { | |
| 367 | 370 | 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); | |
| 1054 | + | int vc4_v3d_get_bin_slot(struct vc4_dev *vc4, long timeout); | |
| 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,11 +877,17 @@ 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. */ | |
| 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 | + | */ | |
| 881 | 884 | spin_lock_irqsave(&vc4->job_lock, irqflags); | |
| 882 | 885 | vc4->bin_alloc_used &= ~exec->bin_slots; | |
| 883 | 886 | spin_unlock_irqrestore(&vc4->job_lock, irqflags); | |
| 884 | 887 | ||
| 888 | + | /* Let anyone waiting on the binner pool retry. */ | |
| 889 | + | wake_up_all(&vc4->job_wait_queue); | |
| 890 | + | ||
| 885 | 891 | /* Release the reference on the binner BO if needed. */ | |
| 886 | 892 | if (exec->bin_bo_used) | |
| 887 | 893 | vc4_v3d_bin_bo_put(vc4); | |
modified drivers/gpu/drm/vc4/vc4_hdmi.c
| @@ -894,7 +894,7 @@ static void vc4_hdmi_encoder_post_crtc_disable(struct drm_encoder *encoder, | |||
| 894 | 894 | ||
| 895 | 895 | spin_lock_irqsave(&vc4_hdmi->hw_lock, flags); | |
| 896 | 896 | ||
| 897 | - | HDMI_WRITE(HDMI_RAM_PACKET_CONFIG, 0); | |
| 897 | + | HDMI_WRITE(HDMI_RAM_PACKET_CONFIG, VC4_HDMI_RAM_PACKET_ENABLE); | |
| 898 | 898 | ||
| 899 | 899 | HDMI_WRITE(HDMI_VID_CTL, HDMI_READ(HDMI_VID_CTL) | VC4_HD_VID_CTL_CLRRGB); | |
| 900 | 900 | ||
| @@ -1663,9 +1663,6 @@ static void vc4_hdmi_encoder_post_crtc_enable(struct drm_encoder *encoder, | |||
| 1663 | 1663 | WARN_ONCE(ret, "Timeout waiting for " | |
| 1664 | 1664 | "VC4_HDMI_SCHEDULER_CONTROL_HDMI_ACTIVE\n"); | |
| 1665 | 1665 | } else { | |
| 1666 | - | HDMI_WRITE(HDMI_RAM_PACKET_CONFIG, | |
| 1667 | - | HDMI_READ(HDMI_RAM_PACKET_CONFIG) & | |
| 1668 | - | ~(VC4_HDMI_RAM_PACKET_ENABLE)); | |
| 1669 | 1666 | HDMI_WRITE(HDMI_SCHEDULER_CONTROL, | |
| 1670 | 1667 | HDMI_READ(HDMI_SCHEDULER_CONTROL) & | |
| 1671 | 1668 | ~VC4_HDMI_SCHEDULER_CONTROL_MODE_HDMI); | |
| @@ -1684,9 +1681,6 @@ static void vc4_hdmi_encoder_post_crtc_enable(struct drm_encoder *encoder, | |||
| 1684 | 1681 | WARN_ON(!(HDMI_READ(HDMI_SCHEDULER_CONTROL) & | |
| 1685 | 1682 | VC4_HDMI_SCHEDULER_CONTROL_HDMI_ACTIVE)); | |
| 1686 | 1683 | ||
| 1687 | - | HDMI_WRITE(HDMI_RAM_PACKET_CONFIG, | |
| 1688 | - | VC4_HDMI_RAM_PACKET_ENABLE); | |
| 1689 | - | ||
| 1690 | 1684 | spin_unlock_irqrestore(&vc4_hdmi->hw_lock, flags); | |
| 1691 | 1685 | vc4_hdmi->packet_ram_enabled = true; | |
| 1692 | 1686 | ||
| @@ -3143,6 +3137,11 @@ static int vc5_hdmi_init_resources(struct drm_device *drm, | |||
| 3143 | 3137 | static int vc4_hdmi_runtime_suspend(struct device *dev) | |
| 3144 | 3138 | { | |
| 3145 | 3139 | struct vc4_hdmi *vc4_hdmi = dev_get_drvdata(dev); | |
| 3140 | + | unsigned long flags; | |
| 3141 | + | ||
| 3142 | + | spin_lock_irqsave(&vc4_hdmi->hw_lock, flags); | |
| 3143 | + | HDMI_WRITE(HDMI_RAM_PACKET_CONFIG, 0); | |
| 3144 | + | spin_unlock_irqrestore(&vc4_hdmi->hw_lock, flags); | |
| 3146 | 3145 | ||
| 3147 | 3146 | clk_disable_unprepare(vc4_hdmi->audio_clock); | |
| 3148 | 3147 | clk_disable_unprepare(vc4_hdmi->hsm_clock); | |
| @@ -3153,9 +3152,8 @@ static int vc4_hdmi_runtime_suspend(struct device *dev) | |||
| 3153 | 3152 | static int vc4_hdmi_runtime_resume(struct device *dev) | |
| 3154 | 3153 | { | |
| 3155 | 3154 | struct vc4_hdmi *vc4_hdmi = dev_get_drvdata(dev); | |
| 3156 | - | unsigned long __maybe_unused flags; | |
| 3155 | + | unsigned long rate, flags; | |
| 3157 | 3156 | u32 __maybe_unused value; | |
| 3158 | - | unsigned long rate; | |
| 3159 | 3157 | int ret; | |
| 3160 | 3158 | ||
| 3161 | 3159 | ret = clk_prepare_enable(vc4_hdmi->hsm_clock); | |
| @@ -3201,6 +3199,10 @@ static int vc4_hdmi_runtime_resume(struct device *dev) | |||
| 3201 | 3199 | } | |
| 3202 | 3200 | #endif | |
| 3203 | 3201 | ||
| 3202 | + | spin_lock_irqsave(&vc4_hdmi->hw_lock, flags); | |
| 3203 | + | HDMI_WRITE(HDMI_RAM_PACKET_CONFIG, VC4_HDMI_RAM_PACKET_ENABLE); | |
| 3204 | + | spin_unlock_irqrestore(&vc4_hdmi->hw_lock, flags); | |
| 3205 | + | ||
| 3204 | 3206 | return 0; | |
| 3205 | 3207 | ||
| 3206 | 3208 | err_disable_clk: | |
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); | |
| 77 | + | bin_bo_slot = vc4_v3d_get_bin_slot(vc4, msecs_to_jiffies(500)); | |
| 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,6 +165,10 @@ 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 | + | ||
| 168 | 172 | list_move_tail(&exec->head, &vc4->job_done_list); | |
| 169 | 173 | ||
| 170 | 174 | nextbin = vc4_first_bin_job(vc4); | |
| @@ -276,7 +280,7 @@ vc4_irq_disable(struct drm_device *dev) | |||
| 276 | 280 | V3D_WRITE(V3D_INTCTL, V3D_DRIVER_IRQS); | |
| 277 | 281 | ||
| 278 | 282 | /* Finish any interrupt handler still in flight. */ | |
| 279 | - | synchronize_irq(vc4->irq); | |
| 283 | + | disable_irq(vc4->irq); | |
| 280 | 284 | ||
| 281 | 285 | cancel_work_sync(&vc4->overflow_mem_work); | |
| 282 | 286 | } | |
| @@ -284,7 +288,6 @@ vc4_irq_disable(struct drm_device *dev) | |||
| 284 | 288 | int vc4_irq_install(struct drm_device *dev, int irq) | |
| 285 | 289 | { | |
| 286 | 290 | struct vc4_dev *vc4 = to_vc4_dev(dev); | |
| 287 | - | int ret; | |
| 288 | 291 | ||
| 289 | 292 | if (WARN_ON_ONCE(vc4->gen > VC4_GEN_4)) | |
| 290 | 293 | return -ENODEV; | |
| @@ -298,19 +301,8 @@ int vc4_irq_install(struct drm_device *dev, int irq) | |||
| 298 | 301 | init_waitqueue_head(&vc4->job_wait_queue); | |
| 299 | 302 | INIT_WORK(&vc4->overflow_mem_work, vc4_overflow_mem_work); | |
| 300 | 303 | ||
| 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; | |
| 304 | + | return devm_request_irq(dev->dev, irq, vc4_irq, IRQF_NO_AUTOEN, | |
| 305 | + | dev_name(dev->dev), dev); | |
| 314 | 306 | } | |
| 315 | 307 | ||
| 316 | 308 | void vc4_irq_uninstall(struct drm_device *dev) | |
modified drivers/gpu/drm/vc4/vc4_v3d.c
| @@ -9,6 +9,7 @@ | |||
| 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> | |
| 12 | 13 | ||
| 13 | 14 | #include <drm/drm_print.h> | |
| 14 | 15 | ||
| @@ -172,46 +173,42 @@ static void vc4_v3d_init_hw(struct drm_device *dev) | |||
| 172 | 173 | V3D_WRITE(V3D_VPMBASE, 0); | |
| 173 | 174 | } | |
| 174 | 175 | ||
| 175 | - | int vc4_v3d_get_bin_slot(struct vc4_dev *vc4) | |
| 176 | + | static int bin_slot_try_alloc(struct vc4_dev *vc4) | |
| 176 | 177 | { | |
| 177 | - | struct drm_device *dev = &vc4->base; | |
| 178 | - | unsigned long irqflags; | |
| 179 | 178 | int slot; | |
| 180 | - | uint64_t seqno = 0; | |
| 181 | - | struct vc4_exec_info *exec; | |
| 182 | 179 | ||
| 183 | - | if (WARN_ON_ONCE(vc4->gen > VC4_GEN_4)) | |
| 184 | - | return -ENODEV; | |
| 180 | + | guard(spinlock_irqsave)(&vc4->job_lock); | |
| 185 | 181 | ||
| 186 | - | try_again: | |
| 187 | - | spin_lock_irqsave(&vc4->job_lock, irqflags); | |
| 188 | 182 | slot = ffs(~vc4->bin_alloc_used); | |
| 189 | 183 | if (slot != 0) { | |
| 190 | 184 | /* Switch from ffs() bit index to a 0-based index. */ | |
| 191 | 185 | slot--; | |
| 192 | 186 | vc4->bin_alloc_used |= BIT(slot); | |
| 193 | - | spin_unlock_irqrestore(&vc4->job_lock, irqflags); | |
| 194 | - | return slot; | |
| 187 | + | } else { | |
| 188 | + | slot = -ENOMEM; | |
| 195 | 189 | } | |
| 196 | 190 | ||
| 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); | |
| 191 | + | return slot; | |
| 192 | + | } | |
| 204 | 193 | ||
| 205 | - | if (seqno) { | |
| 206 | - | int ret = vc4_wait_for_seqno(dev, seqno, ~0ull, true); | |
| 194 | + | int vc4_v3d_get_bin_slot(struct vc4_dev *vc4, long timeout) | |
| 195 | + | { | |
| 196 | + | int slot; | |
| 197 | + | long ret; | |
| 207 | 198 | ||
| 208 | - | if (ret == 0) | |
| 209 | - | goto try_again; | |
| 199 | + | if (WARN_ON_ONCE(vc4->gen > VC4_GEN_4)) | |
| 200 | + | return -ENODEV; | |
| 210 | 201 | ||
| 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) | |
| 211 | 207 | return ret; | |
| 212 | - | } | |
| 208 | + | if (ret == 0) | |
| 209 | + | return -ENOMEM; | |
| 213 | 210 | ||
| 214 | - | return -ENOMEM; | |
| 211 | + | return slot; | |
| 215 | 212 | } | |
| 216 | 213 | ||
| 217 | 214 | /* | |
| @@ -396,6 +393,7 @@ static int vc4_v3d_runtime_resume(struct device *dev) | |||
| 396 | 393 | vc4_v3d_init_hw(&vc4->base); | |
| 397 | 394 | ||
| 398 | 395 | vc4_irq_enable(&vc4->base); | |
| 396 | + | enable_irq(vc4->irq); | |
| 399 | 397 | ||
| 400 | 398 | return 0; | |
| 401 | 399 | } | |
| @@ -452,6 +450,12 @@ static int vc4_v3d_bind(struct device *dev, struct device *master, void *data) | |||
| 452 | 450 | return ret; | |
| 453 | 451 | vc4->irq = ret; | |
| 454 | 452 | ||
| 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 | + | ||
| 455 | 459 | ret = devm_pm_runtime_enable(dev); | |
| 456 | 460 | if (ret) | |
| 457 | 461 | return ret; | |
| @@ -473,12 +477,6 @@ static int vc4_v3d_bind(struct device *dev, struct device *master, void *data) | |||
| 473 | 477 | V3D_WRITE(V3D_BPOA, 0); | |
| 474 | 478 | V3D_WRITE(V3D_BPOS, 0); | |
| 475 | 479 | ||
| 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 | - | ||
| 482 | 480 | pm_runtime_use_autosuspend(dev); | |
| 483 | 481 | pm_runtime_set_autosuspend_delay(dev, 40); /* a little over 2 frames. */ | |
| 484 | 482 | pm_runtime_put_autosuspend(dev); | |
| @@ -497,8 +495,15 @@ static void vc4_v3d_unbind(struct device *dev, struct device *master, | |||
| 497 | 495 | struct drm_device *drm = data; | |
| 498 | 496 | struct vc4_dev *vc4 = to_vc4_dev(drm); | |
| 499 | 497 | ||
| 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 | + | ||
| 500 | 502 | vc4_irq_uninstall(drm); | |
| 501 | 503 | ||
| 504 | + | /* Flush rather than cancel, so queued completions release their jobs. */ | |
| 505 | + | flush_work(&vc4->job_done_work); | |
| 506 | + | ||
| 502 | 507 | /* Disable the binner's overflow memory address, so the next | |
| 503 | 508 | * driver probe (if any) doesn't try to reuse our old | |
| 504 | 509 | * 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); | |
| 405 | + | bin_slot = vc4_v3d_get_bin_slot(vc4, MAX_SCHEDULE_TIMEOUT); | |
| 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/virtio/virtgpu_plane.c
| @@ -589,7 +589,6 @@ struct drm_plane *virtio_gpu_plane_init(struct virtio_gpu_device *vgdev, | |||
| 589 | 589 | struct drm_plane *plane; | |
| 590 | 590 | const uint32_t *formats; | |
| 591 | 591 | int nformats; | |
| 592 | - | int ret; | |
| 593 | 592 | ||
| 594 | 593 | if (type == DRM_PLANE_TYPE_CURSOR) { | |
| 595 | 594 | formats = virtio_gpu_cursor_formats; | |
| @@ -615,17 +614,5 @@ struct drm_plane *virtio_gpu_plane_init(struct virtio_gpu_device *vgdev, | |||
| 615 | 614 | drm_plane_create_blend_mode_property(plane, | |
| 616 | 615 | BIT(DRM_MODE_BLEND_PREMULTI)); | |
| 617 | 616 | ||
| 618 | - | if (type == DRM_PLANE_TYPE_CURSOR) { | |
| 619 | - | /* | |
| 620 | - | * The cursor plane exposes a format with an alpha channel, | |
| 621 | - | * which requires a blend mode property. The host blends | |
| 622 | - | * premultiplied alpha, matching the property's default. | |
| 623 | - | */ | |
| 624 | - | ret = drm_plane_create_blend_mode_property(plane, | |
| 625 | - | BIT(DRM_MODE_BLEND_PREMULTI)); | |
| 626 | - | if (ret) | |
| 627 | - | return ERR_PTR(ret); | |
| 628 | - | } | |
| 629 | - | ||
| 630 | 617 | return plane; | |
| 631 | 618 | } | |
modified drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c
| @@ -324,6 +324,7 @@ 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; | |
| 327 | 328 | void *virtual; | |
| 328 | 329 | bool is_iomem; | |
| 329 | 330 | struct vmw_dma_cmd { | |
| @@ -335,6 +336,8 @@ void vmw_kms_cursor_snoop(struct vmw_surface *srf, | |||
| 335 | 336 | vmw_surface_get_desc(VMW_CURSOR_SNOOP_FORMAT); | |
| 336 | 337 | const u32 image_pitch = VMW_CURSOR_SNOOP_WIDTH * desc->pitchBytesPerBlock; | |
| 337 | 338 | ||
| 339 | + | BUILD_BUG_ON(sizeof(*srf->snooper.image) != desc->pitchBytesPerBlock); | |
| 340 | + | ||
| 338 | 341 | cmd = container_of(header, struct vmw_dma_cmd, header); | |
| 339 | 342 | ||
| 340 | 343 | /* No snooper installed, nothing to copy */ | |
| @@ -372,8 +375,19 @@ void vmw_kms_cursor_snoop(struct vmw_surface *srf, | |||
| 372 | 375 | return; | |
| 373 | 376 | } | |
| 374 | 377 | ||
| 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 | + | ||
| 375 | 389 | kmap_offset = cmd->dma.guest.ptr.offset >> PAGE_SHIFT; | |
| 376 | - | kmap_num = (VMW_CURSOR_SNOOP_HEIGHT * image_pitch) >> PAGE_SHIFT; | |
| 390 | + | kmap_num = PFN_UP(src_extent); | |
| 377 | 391 | ||
| 378 | 392 | ret = ttm_bo_reserve(bo, true, false, NULL); | |
| 379 | 393 | if (unlikely(ret != 0)) { | |
| @@ -387,14 +401,16 @@ void vmw_kms_cursor_snoop(struct vmw_surface *srf, | |||
| 387 | 401 | ||
| 388 | 402 | virtual = ttm_kmap_obj_virtual(&map, &is_iomem); | |
| 389 | 403 | ||
| 390 | - | if (box->w == VMW_CURSOR_SNOOP_WIDTH && cmd->dma.guest.pitch == image_pitch) { | |
| 404 | + | if (box->w == VMW_CURSOR_SNOOP_WIDTH && | |
| 405 | + | box->h == VMW_CURSOR_SNOOP_HEIGHT && | |
| 406 | + | cmd->dma.guest.pitch == image_pitch) { | |
| 391 | 407 | memcpy(srf->snooper.image, virtual, | |
| 392 | 408 | VMW_CURSOR_SNOOP_HEIGHT * image_pitch); | |
| 393 | 409 | } else { | |
| 394 | - | /* Image is unsigned pointer. */ | |
| 410 | + | /* The destination stride is in pixels. */ | |
| 395 | 411 | for (i = 0; i < box->h; i++) | |
| 396 | - | memcpy(srf->snooper.image + i * image_pitch, | |
| 397 | - | virtual + i * cmd->dma.guest.pitch, | |
| 412 | + | memcpy(srf->snooper.image + i * VMW_CURSOR_SNOOP_WIDTH, | |
| 413 | + | virtual + (size_t)i * cmd->dma.guest.pitch, | |
| 398 | 414 | box->w * desc->pitchBytesPerBlock); | |
| 399 | 415 | } | |
| 400 | 416 | srf->snooper.id++; | |
modified drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
| @@ -20,10 +20,18 @@ | |||
| 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> | |
| 23 | 24 | ||
| 24 | 25 | void vmw_du_init(struct vmw_display_unit *du) | |
| 25 | 26 | { | |
| 26 | 27 | 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)); | |
| 27 | 35 | } | |
| 28 | 36 | ||
| 29 | 37 | void vmw_du_cleanup(struct vmw_display_unit *du) | |
modified drivers/gpu/drm/xe/regs/xe_gt_regs.h
| @@ -651,7 +651,6 @@ | |||
| 651 | 651 | #define MEM_THERMAL_MASK REG_BIT(2) | |
| 652 | 652 | #define VR_THERMAL_MASK REG_BIT(3) | |
| 653 | 653 | #define ICCMAX_MASK REG_BIT(4) | |
| 654 | - | #define PWRBRK_MASK REG_BIT(5) | |
| 655 | 654 | #define SOC_AVG_THERMAL_MASK REG_BIT(6) | |
| 656 | 655 | #define FASTVMODE_MASK REG_BIT(7) | |
| 657 | 656 | #define PSYS_PL1_MASK REG_BIT(12) | |
modified drivers/gpu/drm/xe/xe_bo.c
| @@ -1037,13 +1037,6 @@ static int xe_bo_move(struct ttm_buffer_object *ttm_bo, bool evict, | |||
| 1037 | 1037 | } else { | |
| 1038 | 1038 | drm_dbg(&xe->drm, "Evict system allocator BO failed=%pe\n", | |
| 1039 | 1039 | ERR_PTR(ret)); | |
| 1040 | - | /* | |
| 1041 | - | * The semantic we want upon SVM eviction failure | |
| 1042 | - | * because of racing access is keep walking for | |
| 1043 | - | * eviction, which is -ENOSPC. | |
| 1044 | - | */ | |
| 1045 | - | if (ret == -EBUSY) | |
| 1046 | - | ret = -ENOSPC; | |
| 1047 | 1040 | } | |
| 1048 | 1041 | ||
| 1049 | 1042 | goto out; | |
modified drivers/gpu/drm/xe/xe_bo.h
| @@ -9,8 +9,6 @@ | |||
| 9 | 9 | #include <drm/drm_prime.h> | |
| 10 | 10 | #include <drm/ttm/ttm_tt.h> | |
| 11 | 11 | ||
| 12 | - | #include <xen/xen.h> | |
| 13 | - | ||
| 14 | 12 | #include "xe_bo_types.h" | |
| 15 | 13 | #include "xe_ggtt.h" | |
| 16 | 14 | #include "xe_macros.h" | |
| @@ -577,23 +575,6 @@ static inline unsigned int xe_sg_segment_size(struct device *dev) | |||
| 577 | 575 | struct scatterlist __maybe_unused sg; | |
| 578 | 576 | size_t max = BIT_ULL(sizeof(sg.length) * 8) - 1; | |
| 579 | 577 | ||
| 580 | - | /* | |
| 581 | - | * For Xen PV guests pages aren't contiguous in DMA (machine) address | |
| 582 | - | * space. The DMA API takes care of that both in dma_alloc_* (by | |
| 583 | - | * calling into the hypervisor to make the pages contiguous) and in | |
| 584 | - | * dma_map_* (by bounce buffering). But xe (like i915, see commit | |
| 585 | - | * 78a07fe777c4) ignores the coherency aspects of the DMA API and thus | |
| 586 | - | * can't cope with bounce buffering actually happening, so add a hack | |
| 587 | - | * here to force small allocations and mappings when running in PV | |
| 588 | - | * mode on Xen. | |
| 589 | - | * | |
| 590 | - | * Note this will still break if bounce buffering is required for other | |
| 591 | - | * reasons, like confidential computing hypervisors or PCIe root ports | |
| 592 | - | * with addressing limitations. | |
| 593 | - | */ | |
| 594 | - | if (xen_pv_domain()) | |
| 595 | - | return PAGE_SIZE; | |
| 596 | - | ||
| 597 | 578 | max = min_t(size_t, max, dma_max_mapping_size(dev)); | |
| 598 | 579 | ||
| 599 | 580 | /* | |
modified drivers/gpu/drm/xe/xe_gt_throttle.c
| @@ -39,7 +39,7 @@ | |||
| 39 | 39 | * - ``reason_mem_thermal``: Memory thermal | |
| 40 | 40 | * - ``reason_vr_thermal``: VR thermal | |
| 41 | 41 | * - ``reason_iccmax``: ICCMAX | |
| 42 | - | * - ``reason_pwrbrk``: Power brake | |
| 42 | + | * - ``reason_ratl``: RATL thermal algorithm | |
| 43 | 43 | * - ``reason_soc_avg_thermal``: SoC average temp | |
| 44 | 44 | * - ``reason_fastvmode``: VR is hitting FastVMode | |
| 45 | 45 | * - ``reason_psys_pl1``: PSYS PL1 | |
| @@ -200,7 +200,6 @@ static THROTTLE_ATTR_RO(reason_psys_pl1, PSYS_PL1_MASK); | |||
| 200 | 200 | static THROTTLE_ATTR_RO(reason_psys_pl2, PSYS_PL2_MASK); | |
| 201 | 201 | static THROTTLE_ATTR_RO(reason_p0_freq, P0_FREQ_MASK); | |
| 202 | 202 | static THROTTLE_ATTR_RO(reason_psys_crit, PSYS_CRIT_MASK); | |
| 203 | - | static THROTTLE_ATTR_RO(reason_pwrbrk, PWRBRK_MASK); | |
| 204 | 203 | ||
| 205 | 204 | static struct attribute *cri_throttle_attrs[] = { | |
| 206 | 205 | /* Common */ | |
| @@ -210,12 +209,12 @@ static struct attribute *cri_throttle_attrs[] = { | |||
| 210 | 209 | &attr_reason_pl2.attr.attr, | |
| 211 | 210 | &attr_reason_pl4.attr.attr, | |
| 212 | 211 | &attr_reason_prochot.attr.attr, | |
| 212 | + | &attr_reason_ratl.attr.attr, | |
| 213 | 213 | /* CRI */ | |
| 214 | 214 | &attr_reason_vr_thermal.attr.attr, | |
| 215 | 215 | &attr_reason_soc_thermal.attr.attr, | |
| 216 | 216 | &attr_reason_mem_thermal.attr.attr, | |
| 217 | 217 | &attr_reason_iccmax.attr.attr, | |
| 218 | - | &attr_reason_pwrbrk.attr.attr, | |
| 219 | 218 | &attr_reason_soc_avg_thermal.attr.attr, | |
| 220 | 219 | &attr_reason_fastvmode.attr.attr, | |
| 221 | 220 | &attr_reason_psys_pl1.attr.attr, | |
modified drivers/gpu/drm/xe/xe_guc_ads.c
| @@ -864,7 +864,7 @@ static unsigned int guc_mmio_regset_write(struct xe_guc_ads *ads, | |||
| 864 | 864 | } | |
| 865 | 865 | } | |
| 866 | 866 | ||
| 867 | - | if (XE_GT_WA(hwe->gt, 16023105232) || XE_GT_WA(hwe->gt, 14025941587)) | |
| 867 | + | if (XE_GT_WA(hwe->gt, 16023105232)) | |
| 868 | 868 | guc_mmio_regset_write_one(ads, regset_map, | |
| 869 | 869 | RING_IDLEDLY(hwe->mmio_base), | |
| 870 | 870 | count++); | |
modified drivers/gpu/drm/xe/xe_hw_engine.c
| @@ -585,102 +585,28 @@ static void hw_engine_init_early(struct xe_gt *gt, struct xe_hw_engine *hwe, | |||
| 585 | 585 | xe_reg_whitelist_process_engine(hwe); | |
| 586 | 586 | } | |
| 587 | 587 | ||
| 588 | - | static u32 idledly_floor_ticks(u32 idledly_ns, u32 idledly_units_ps) | |
| 589 | - | { | |
| 590 | - | return DIV_ROUND_DOWN_ULL((u64)idledly_ns * 1000, idledly_units_ps); | |
| 591 | - | } | |
| 592 | - | ||
| 593 | 588 | static void adjust_idledly(struct xe_hw_engine *hwe) | |
| 594 | 589 | { | |
| 595 | 590 | struct xe_gt *gt = hwe->gt; | |
| 596 | - | u32 idledly, idledly_hw, idledly_reg_val, maxcnt; | |
| 591 | + | u32 idledly, maxcnt; | |
| 597 | 592 | u32 idledly_units_ps = 8 * gt->info.timestamp_base; | |
| 598 | 593 | u32 maxcnt_units_ns = 640; | |
| 599 | - | bool inhibit_switch = false; | |
| 600 | - | bool wa_applied = false; | |
| 601 | - | bool clamped_below_maxcnt = false; | |
| 602 | - | ||
| 603 | - | if ((!IS_SRIOV_VF(gt_to_xe(gt)) && XE_GT_WA(gt, 16023105232)) || | |
| 604 | - | XE_GT_WA(gt, 14025941587)) { | |
| 605 | - | u32 mincnt_idledly_ns = 5000; | |
| 606 | - | ||
| 607 | - | /* xe_gt_clock_init() warns and zeroes timestamp_base on unknown crystal clock. */ | |
| 608 | - | if (!idledly_units_ps) | |
| 609 | - | return; | |
| 594 | + | bool inhibit_switch = 0; | |
| 610 | 595 | ||
| 611 | - | idledly_reg_val = xe_mmio_read32(>->mmio, RING_IDLEDLY(hwe->mmio_base)); | |
| 596 | + | if (!IS_SRIOV_VF(gt_to_xe(hwe->gt)) && XE_GT_WA(gt, 16023105232)) { | |
| 597 | + | idledly = xe_mmio_read32(>->mmio, RING_IDLEDLY(hwe->mmio_base)); | |
| 612 | 598 | maxcnt = xe_mmio_read32(>->mmio, RING_PWRCTX_MAXCNT(hwe->mmio_base)); | |
| 613 | 599 | ||
| 614 | - | inhibit_switch = idledly_reg_val & INHIBIT_SWITCH_UNTIL_PREEMPTED; | |
| 615 | - | idledly = REG_FIELD_GET(IDLE_DELAY, idledly_reg_val); | |
| 616 | - | idledly = DIV_ROUND_CLOSEST_ULL((u64)idledly * idledly_units_ps, 1000); | |
| 617 | - | idledly_hw = idledly; | |
| 600 | + | inhibit_switch = idledly & INHIBIT_SWITCH_UNTIL_PREEMPTED; | |
| 601 | + | idledly = REG_FIELD_GET(IDLE_DELAY, idledly); | |
| 602 | + | idledly = DIV_ROUND_CLOSEST(idledly * idledly_units_ps, 1000); | |
| 618 | 603 | maxcnt = REG_FIELD_GET(IDLE_WAIT_TIME, maxcnt); | |
| 619 | 604 | maxcnt *= maxcnt_units_ns; | |
| 620 | 605 | ||
| 621 | - | /* | |
| 622 | - | * Wa_14025941587 is applied before Wa_16023105232, which takes | |
| 623 | - | * priority if the two ever conflict (not expected in practice). | |
| 624 | - | */ | |
| 625 | - | if (XE_GT_WA(gt, 14025941587) && | |
| 626 | - | idledly < mincnt_idledly_ns) { | |
| 627 | - | idledly = mincnt_idledly_ns; | |
| 628 | - | wa_applied = true; | |
| 629 | - | } | |
| 630 | - | ||
| 631 | - | if (XE_GT_WA(gt, 16023105232)) { | |
| 632 | - | /* Clear the inhibit switch without disturbing a valid delay. */ | |
| 633 | - | if (inhibit_switch) { | |
| 634 | - | idledly_reg_val &= ~INHIBIT_SWITCH_UNTIL_PREEMPTED; | |
| 635 | - | wa_applied = true; | |
| 636 | - | } | |
| 637 | - | ||
| 638 | - | /* Warn only on the value read from hardware. */ | |
| 639 | - | xe_gt_WARN_ON(gt, idledly_hw >= maxcnt); | |
| 640 | - | ||
| 641 | - | if (idledly >= maxcnt) { | |
| 642 | - | /* maxcnt may be 0 if IDLE_WAIT_TIME is unprogrammed. */ | |
| 643 | - | idledly = maxcnt ? maxcnt - 1 : 0; | |
| 644 | - | clamped_below_maxcnt = true; | |
| 645 | - | wa_applied = true; | |
| 646 | - | } | |
| 647 | - | } | |
| 648 | - | ||
| 649 | - | if (wa_applied) { | |
| 650 | - | u32 idledly_ticks; | |
| 651 | - | ||
| 652 | - | /* | |
| 653 | - | * Wa_16023105232 requires idledly < maxcnt, so floor | |
| 654 | - | * that clamp; otherwise round up to guarantee the | |
| 655 | - | * Wa_14025941587 minimum survives tick quantization. | |
| 656 | - | */ | |
| 657 | - | if (clamped_below_maxcnt) | |
| 658 | - | idledly_ticks = idledly_floor_ticks(idledly, idledly_units_ps); | |
| 659 | - | else | |
| 660 | - | idledly_ticks = DIV_ROUND_UP_ULL((u64)idledly * 1000, | |
| 661 | - | idledly_units_ps); | |
| 662 | - | ||
| 663 | - | /* | |
| 664 | - | * Tick quantization can still push the rounded-up value | |
| 665 | - | * to/above maxcnt; re-floor here so Wa_16023105232 keeps | |
| 666 | - | * priority even in that case. | |
| 667 | - | */ | |
| 668 | - | if (!clamped_below_maxcnt && XE_GT_WA(gt, 16023105232) && | |
| 669 | - | (u64)idledly_ticks * idledly_units_ps >= (u64)maxcnt * 1000) { | |
| 670 | - | xe_gt_dbg(gt, "idledly %s: %u ticks would exceed maxcnt=%u, so flooring\n", | |
| 671 | - | hwe->name, idledly_ticks, maxcnt); | |
| 672 | - | idledly = maxcnt ? maxcnt - 1 : 0; | |
| 673 | - | idledly_ticks = idledly_floor_ticks(idledly, idledly_units_ps); | |
| 674 | - | } | |
| 675 | - | ||
| 676 | - | idledly_reg_val &= ~IDLE_DELAY; | |
| 677 | - | idledly_reg_val |= REG_FIELD_PREP(IDLE_DELAY, idledly_ticks); | |
| 678 | - | xe_gt_dbg(gt, "idledly %s: set %u max=%u inh=%u ts=%u\n", | |
| 679 | - | hwe->name, idledly, maxcnt, | |
| 680 | - | !!inhibit_switch, gt->info.timestamp_base); | |
| 681 | - | xe_mmio_write32(>->mmio, | |
| 682 | - | RING_IDLEDLY(hwe->mmio_base), | |
| 683 | - | idledly_reg_val); | |
| 606 | + | if (xe_gt_WARN_ON(gt, idledly >= maxcnt || inhibit_switch)) { | |
| 607 | + | idledly = DIV_ROUND_CLOSEST(((maxcnt - 1) * 1000), | |
| 608 | + | idledly_units_ps); | |
| 609 | + | xe_mmio_write32(>->mmio, RING_IDLEDLY(hwe->mmio_base), idledly); | |
| 684 | 610 | } | |
| 685 | 611 | } | |
| 686 | 612 | } | |
modified drivers/gpu/drm/xe/xe_i2c.c
| @@ -318,10 +318,8 @@ void xe_i2c_pm_resume(struct xe_device *xe, bool d3cold) | |||
| 318 | 318 | static void xe_i2c_remove(void *data) | |
| 319 | 319 | { | |
| 320 | 320 | struct xe_i2c *i2c = data; | |
| 321 | - | struct xe_device *xe = tile_to_xe(i2c->mmio->tile); | |
| 322 | 321 | unsigned int i; | |
| 323 | 322 | ||
| 324 | - | xe_i2c_irq_reset(xe); | |
| 325 | 323 | xe_amc_exit(i2c); | |
| 326 | 324 | ||
| 327 | 325 | for (i = 0; i < XE_I2C_MAX_CLIENTS; i++) { | |
| @@ -331,7 +329,6 @@ static void xe_i2c_remove(void *data) | |||
| 331 | 329 | ||
| 332 | 330 | bus_unregister_notifier(&i2c_bus_type, &i2c->bus_notifier); | |
| 333 | 331 | xe_i2c_unregister_adapter(i2c); | |
| 334 | - | xe->i2c = NULL; | |
| 335 | 332 | } | |
| 336 | 333 | ||
| 337 | 334 | /** | |
modified drivers/gpu/drm/xe/xe_mmio_gem.c
| @@ -5,9 +5,9 @@ | |||
| 5 | 5 | ||
| 6 | 6 | #include "xe_mmio_gem.h" | |
| 7 | 7 | ||
| 8 | - | #include <linux/dma-resv.h> | |
| 9 | 8 | #include <drm/drm_drv.h> | |
| 10 | 9 | #include <drm/drm_gem.h> | |
| 10 | + | #include <drm/drm_managed.h> | |
| 11 | 11 | ||
| 12 | 12 | #include "xe_device_types.h" | |
| 13 | 13 | ||
| @@ -37,24 +37,12 @@ static vm_fault_t xe_mmio_gem_vm_fault(struct vm_fault *); | |||
| 37 | 37 | struct xe_mmio_gem { | |
| 38 | 38 | struct drm_gem_object base; | |
| 39 | 39 | phys_addr_t phys_addr; | |
| 40 | - | struct page *dummy_page; /* protected by the GEM's dma_resv */ | |
| 41 | - | bool destroyed; /* protected by the GEM's dma_resv */ | |
| 42 | 40 | }; | |
| 43 | 41 | ||
| 44 | - | static int xe_mmio_gem_vm_may_split(struct vm_area_struct *area, unsigned long addr) | |
| 45 | - | { | |
| 46 | - | /* | |
| 47 | - | * Forbid splitting. Together with VM_DONTEXPAND, this keeps the VMA | |
| 48 | - | * matching the GEM object exactly. | |
| 49 | - | */ | |
| 50 | - | return -EINVAL; | |
| 51 | - | } | |
| 52 | - | ||
| 53 | 42 | static const struct vm_operations_struct vm_ops = { | |
| 54 | 43 | .open = drm_gem_vm_open, | |
| 55 | 44 | .close = drm_gem_vm_close, | |
| 56 | 45 | .fault = xe_mmio_gem_vm_fault, | |
| 57 | - | .may_split = xe_mmio_gem_vm_may_split, | |
| 58 | 46 | }; | |
| 59 | 47 | ||
| 60 | 48 | static const struct drm_gem_object_funcs xe_mmio_gem_funcs = { | |
| @@ -133,8 +121,6 @@ static void xe_mmio_gem_free(struct drm_gem_object *base) | |||
| 133 | 121 | { | |
| 134 | 122 | struct xe_mmio_gem *obj = to_xe_mmio_gem(base); | |
| 135 | 123 | ||
| 136 | - | if (obj->dummy_page) | |
| 137 | - | __free_page(obj->dummy_page); | |
| 138 | 124 | drm_gem_object_release(base); | |
| 139 | 125 | kfree(obj); | |
| 140 | 126 | } | |
| @@ -142,31 +128,15 @@ static void xe_mmio_gem_free(struct drm_gem_object *base) | |||
| 142 | 128 | /** | |
| 143 | 129 | * xe_mmio_gem_destroy - Destroy the GEM object that exposes an MMIO region | |
| 144 | 130 | * @gem: the GEM object to destroy | |
| 145 | - | * @file: DRM file descriptor previously passed to xe_mmio_gem_create() | |
| 146 | 131 | * | |
| 147 | 132 | * This function releases resources associated with the GEM object created by | |
| 148 | 133 | * xe_mmio_gem_create(). | |
| 149 | 134 | * | |
| 150 | 135 | * See: "Exposing MMIO regions to userspace" | |
| 151 | 136 | */ | |
| 152 | - | void xe_mmio_gem_destroy(struct xe_mmio_gem *gem, struct drm_file *file) | |
| 137 | + | void xe_mmio_gem_destroy(struct xe_mmio_gem *gem) | |
| 153 | 138 | { | |
| 154 | - | struct drm_gem_object *base = &gem->base; | |
| 155 | - | struct drm_device *dev = base->dev; | |
| 156 | - | ||
| 157 | - | drm_vma_node_revoke(&base->vma_node, file); | |
| 158 | - | ||
| 159 | - | dma_resv_lock(base->resv, NULL); | |
| 160 | - | gem->destroyed = true; | |
| 161 | - | dma_resv_unlock(base->resv); | |
| 162 | - | /* | |
| 163 | - | * Setting 'destroyed' under lock takes care of the subsequent faults. | |
| 164 | - | * Zap the existing PTEs to cut off access to the real MMIO through | |
| 165 | - | * currently mapped pages. | |
| 166 | - | */ | |
| 167 | - | drm_vma_node_unmap(&base->vma_node, dev->anon_inode->i_mapping); | |
| 168 | - | ||
| 169 | - | drm_gem_object_put(base); | |
| 139 | + | xe_mmio_gem_free(&gem->base); | |
| 170 | 140 | } | |
| 171 | 141 | ||
| 172 | 142 | static int xe_mmio_gem_mmap(struct drm_gem_object *base, struct vm_area_struct *vma) | |
| @@ -177,6 +147,8 @@ static int xe_mmio_gem_mmap(struct drm_gem_object *base, struct vm_area_struct * | |||
| 177 | 147 | if ((vma->vm_flags & VM_SHARED) == 0) | |
| 178 | 148 | return -EINVAL; | |
| 179 | 149 | ||
| 150 | + | /* Set vm_pgoff (used as a fake buffer offset by DRM) to 0 */ | |
| 151 | + | vma->vm_pgoff = 0; | |
| 180 | 152 | vma->vm_page_prot = pgprot_noncached(vma_get_page_prot(vma)); | |
| 181 | 153 | vm_flags_set(vma, VM_IO | VM_PFNMAP | VM_DONTEXPAND | VM_DONTDUMP | | |
| 182 | 154 | VM_DONTCOPY | VM_NORESERVE); | |
| @@ -185,47 +157,51 @@ static int xe_mmio_gem_mmap(struct drm_gem_object *base, struct vm_area_struct * | |||
| 185 | 157 | return 0; | |
| 186 | 158 | } | |
| 187 | 159 | ||
| 188 | - | static int alloc_dummy_page_if_needed(struct drm_gem_object *base) | |
| 160 | + | static void xe_mmio_gem_release_dummy_page(struct drm_device *dev, void *res) | |
| 189 | 161 | { | |
| 190 | - | struct xe_mmio_gem *obj = to_xe_mmio_gem(base); | |
| 191 | - | ||
| 192 | - | dma_resv_assert_held(base->resv); | |
| 193 | - | if (!obj->dummy_page) | |
| 194 | - | obj->dummy_page = alloc_page(GFP_KERNEL | __GFP_ZERO); | |
| 195 | - | ||
| 196 | - | return obj->dummy_page ? 0 : -ENOMEM; | |
| 162 | + | __free_page((struct page *)res); | |
| 197 | 163 | } | |
| 198 | 164 | ||
| 199 | - | static vm_fault_t xe_mmio_gem_vm_fault_dummy_page(struct vm_fault *vmf) | |
| 165 | + | static vm_fault_t xe_mmio_gem_vm_fault_dummy_page(struct vm_area_struct *vma) | |
| 200 | 166 | { | |
| 201 | - | struct vm_area_struct *vma = vmf->vma; | |
| 202 | 167 | struct drm_gem_object *base = vma->vm_private_data; | |
| 203 | - | struct xe_mmio_gem *obj = to_xe_mmio_gem(base); | |
| 168 | + | struct drm_device *dev = base->dev; | |
| 169 | + | vm_fault_t ret = VM_FAULT_NOPAGE; | |
| 170 | + | struct page *page; | |
| 204 | 171 | unsigned long pfn; | |
| 172 | + | unsigned long i; | |
| 205 | 173 | ||
| 206 | - | if (alloc_dummy_page_if_needed(base)) | |
| 174 | + | page = alloc_page(GFP_KERNEL | __GFP_ZERO); | |
| 175 | + | if (!page) | |
| 207 | 176 | return VM_FAULT_OOM; | |
| 208 | 177 | ||
| 209 | - | pfn = page_to_pfn(obj->dummy_page); | |
| 178 | + | if (drmm_add_action_or_reset(dev, xe_mmio_gem_release_dummy_page, page)) | |
| 179 | + | return VM_FAULT_OOM; | |
| 180 | + | ||
| 181 | + | pfn = page_to_pfn(page); | |
| 182 | + | ||
| 183 | + | /* Map the entire VMA to the same dummy page */ | |
| 184 | + | for (i = 0; i < base->size; i += PAGE_SIZE) { | |
| 185 | + | unsigned long addr = vma->vm_start + i; | |
| 186 | + | ||
| 187 | + | ret = vmf_insert_pfn(vma, addr, pfn); | |
| 188 | + | if (ret & VM_FAULT_ERROR) | |
| 189 | + | break; | |
| 190 | + | } | |
| 210 | 191 | ||
| 211 | - | return vmf_insert_pfn_prot(vma, vmf->address, pfn, | |
| 212 | - | vm_get_page_prot(vma->vm_flags)); | |
| 192 | + | return ret; | |
| 213 | 193 | } | |
| 214 | 194 | ||
| 215 | - | static vm_fault_t xe_mmio_gem_vm_fault_locked(struct vm_fault *vmf) | |
| 195 | + | static vm_fault_t xe_mmio_gem_vm_fault(struct vm_fault *vmf) | |
| 216 | 196 | { | |
| 217 | 197 | struct vm_area_struct *vma = vmf->vma; | |
| 218 | 198 | struct drm_gem_object *base = vma->vm_private_data; | |
| 219 | 199 | struct xe_mmio_gem *obj = to_xe_mmio_gem(base); | |
| 220 | 200 | struct drm_device *dev = base->dev; | |
| 221 | 201 | vm_fault_t ret = VM_FAULT_NOPAGE; | |
| 222 | - | unsigned long addr, pfn; | |
| 202 | + | unsigned long i; | |
| 223 | 203 | int idx; | |
| 224 | 204 | ||
| 225 | - | dma_resv_assert_held(base->resv); | |
| 226 | - | if (obj->destroyed) | |
| 227 | - | return VM_FAULT_SIGBUS; | |
| 228 | - | ||
| 229 | 205 | if (!drm_dev_enter(dev, &idx)) { | |
| 230 | 206 | /* | |
| 231 | 207 | * Provide a dummy page to avoid SIGBUS for events such as hot-unplug. | |
| @@ -233,30 +209,18 @@ static vm_fault_t xe_mmio_gem_vm_fault_locked(struct vm_fault *vmf) | |||
| 233 | 209 | * It is assumed the userspace will receive the notification via some | |
| 234 | 210 | * other channel (e.g. drm uevent). | |
| 235 | 211 | */ | |
| 236 | - | return xe_mmio_gem_vm_fault_dummy_page(vmf); | |
| 212 | + | return xe_mmio_gem_vm_fault_dummy_page(vma); | |
| 237 | 213 | } | |
| 238 | 214 | ||
| 239 | - | pfn = PHYS_PFN(obj->phys_addr); | |
| 240 | - | for (addr = vma->vm_start; addr < vma->vm_end; addr += PAGE_SIZE) { | |
| 241 | - | ret = vmf_insert_pfn(vma, addr, pfn); | |
| 215 | + | for (i = 0; i < base->size; i += PAGE_SIZE) { | |
| 216 | + | unsigned long addr = vma->vm_start + i; | |
| 217 | + | unsigned long phys_addr = obj->phys_addr + i; | |
| 218 | + | ||
| 219 | + | ret = vmf_insert_pfn(vma, addr, PHYS_PFN(phys_addr)); | |
| 242 | 220 | if (ret & VM_FAULT_ERROR) | |
| 243 | 221 | break; | |
| 244 | - | ||
| 245 | - | pfn++; | |
| 246 | 222 | } | |
| 247 | 223 | ||
| 248 | 224 | drm_dev_exit(idx); | |
| 249 | 225 | return ret; | |
| 250 | 226 | } | |
| 251 | - | ||
| 252 | - | static vm_fault_t xe_mmio_gem_vm_fault(struct vm_fault *vmf) | |
| 253 | - | { | |
| 254 | - | struct vm_area_struct *vma = vmf->vma; | |
| 255 | - | struct drm_gem_object *base = vma->vm_private_data; | |
| 256 | - | vm_fault_t ret; | |
| 257 | - | ||
| 258 | - | dma_resv_lock(base->resv, NULL); | |
| 259 | - | ret = xe_mmio_gem_vm_fault_locked(vmf); | |
| 260 | - | dma_resv_unlock(base->resv); | |
| 261 | - | return ret; | |
| 262 | - | } | |
modified drivers/gpu/drm/xe/xe_mmio_gem.h
| @@ -15,6 +15,6 @@ struct xe_mmio_gem; | |||
| 15 | 15 | struct xe_mmio_gem *xe_mmio_gem_create(struct xe_device *xe, struct drm_file *file, | |
| 16 | 16 | phys_addr_t phys_addr, size_t size); | |
| 17 | 17 | u64 xe_mmio_gem_mmap_offset(struct xe_mmio_gem *gem); | |
| 18 | - | void xe_mmio_gem_destroy(struct xe_mmio_gem *gem, struct drm_file *file); | |
| 18 | + | void xe_mmio_gem_destroy(struct xe_mmio_gem *gem); | |
| 19 | 19 | ||
| 20 | 20 | #endif /* _XE_MMIO_GEM_H_ */ | |
modified drivers/gpu/drm/xe/xe_shrinker.c
| @@ -54,40 +54,13 @@ xe_shrinker_mod_pages(struct xe_shrinker *shrinker, long shrinkable, long purgea | |||
| 54 | 54 | write_unlock(&shrinker->lock); | |
| 55 | 55 | } | |
| 56 | 56 | ||
| 57 | - | static bool __xe_shrinker_runtime_pm_get(struct xe_shrinker *shrinker) | |
| 58 | - | { | |
| 59 | - | struct xe_device *xe = shrinker->xe; | |
| 60 | - | ||
| 61 | - | if (xe_pm_runtime_get_if_active(xe)) | |
| 62 | - | return true; | |
| 63 | - | ||
| 64 | - | if (xe_rpm_reclaim_safe(xe) && !ttm_bo_shrink_avoid_wait()) { | |
| 65 | - | xe_pm_runtime_get(xe); | |
| 66 | - | return true; | |
| 67 | - | } | |
| 68 | - | ||
| 69 | - | queue_work(xe->unordered_wq, &shrinker->pm_worker); | |
| 70 | - | ||
| 71 | - | return false; | |
| 72 | - | } | |
| 73 | - | ||
| 74 | - | static void xe_shrinker_runtime_pm_put(struct xe_shrinker *shrinker, bool runtime_pm) | |
| 75 | - | { | |
| 76 | - | if (runtime_pm) | |
| 77 | - | xe_pm_runtime_put(shrinker->xe); | |
| 78 | - | } | |
| 79 | - | ||
| 80 | - | static int __xe_shrinker_walk(struct xe_shrinker *shrinker, | |
| 57 | + | static s64 __xe_shrinker_walk(struct xe_device *xe, | |
| 81 | 58 | struct ttm_operation_ctx *ctx, | |
| 82 | 59 | const struct xe_bo_shrink_flags flags, | |
| 83 | - | unsigned long to_scan, unsigned long *scanned, | |
| 84 | - | unsigned long *freed) | |
| 60 | + | unsigned long to_scan, unsigned long *scanned) | |
| 85 | 61 | { | |
| 86 | - | struct xe_device *xe = shrinker->xe; | |
| 87 | 62 | unsigned int mem_type; | |
| 88 | - | bool rpm = false; | |
| 89 | - | int ret = 0; | |
| 90 | - | s64 lret; | |
| 63 | + | s64 freed = 0, lret; | |
| 91 | 64 | ||
| 92 | 65 | for (mem_type = XE_PL_SYSTEM; mem_type <= XE_PL_TT; ++mem_type) { | |
| 93 | 66 | struct ttm_resource_manager *man = ttm_manager_type(&xe->ttm, mem_type); | |
| @@ -101,35 +74,23 @@ static int __xe_shrinker_walk(struct xe_shrinker *shrinker, | |||
| 101 | 74 | if (!man || !man->use_tt) | |
| 102 | 75 | continue; | |
| 103 | 76 | ||
| 104 | - | if (mem_type != XE_PL_SYSTEM && !rpm && | |
| 105 | - | xe_device_is_l2_flush_optimized(xe)) { | |
| 106 | - | if (!__xe_shrinker_runtime_pm_get(shrinker)) | |
| 107 | - | break; | |
| 108 | - | rpm = true; | |
| 109 | - | } | |
| 110 | - | ||
| 111 | 77 | ttm_bo_lru_for_each_reserved_guarded(&curs, man, &arg, ttm_bo) { | |
| 112 | 78 | if (!ttm_bo_shrink_suitable(ttm_bo, ctx)) | |
| 113 | 79 | continue; | |
| 114 | 80 | ||
| 115 | 81 | lret = xe_bo_shrink(ctx, ttm_bo, flags, scanned); | |
| 116 | - | if (lret < 0) { | |
| 117 | - | ret = lret; | |
| 118 | - | goto out; | |
| 119 | - | } | |
| 82 | + | if (lret < 0) | |
| 83 | + | return lret; | |
| 120 | 84 | ||
| 121 | - | *freed += lret; | |
| 85 | + | freed += lret; | |
| 122 | 86 | if (*scanned >= to_scan) | |
| 123 | - | goto out; | |
| 87 | + | break; | |
| 124 | 88 | } | |
| 125 | 89 | /* Trylocks should never error, just fail. */ | |
| 126 | 90 | xe_assert(xe, !IS_ERR(ttm_bo)); | |
| 127 | 91 | } | |
| 128 | 92 | ||
| 129 | - | out: | |
| 130 | - | xe_shrinker_runtime_pm_put(shrinker, rpm); | |
| 131 | - | ||
| 132 | - | return ret; | |
| 93 | + | return freed; | |
| 133 | 94 | } | |
| 134 | 95 | ||
| 135 | 96 | /* | |
| @@ -138,36 +99,40 @@ out: | |||
| 138 | 99 | * add writeback. This avoids stalls and explicit writebacks with light or | |
| 139 | 100 | * moderate memory pressure. | |
| 140 | 101 | */ | |
| 141 | - | static int xe_shrinker_walk(struct xe_shrinker *shrinker, | |
| 102 | + | static s64 xe_shrinker_walk(struct xe_device *xe, | |
| 142 | 103 | struct ttm_operation_ctx *ctx, | |
| 143 | 104 | const struct xe_bo_shrink_flags flags, | |
| 144 | - | unsigned long to_scan, unsigned long *scanned, | |
| 145 | - | unsigned long *freed) | |
| 105 | + | unsigned long to_scan, unsigned long *scanned) | |
| 146 | 106 | { | |
| 147 | 107 | bool no_wait_gpu = true; | |
| 148 | 108 | struct xe_bo_shrink_flags save_flags = flags; | |
| 149 | - | int ret; | |
| 109 | + | s64 lret, freed; | |
| 150 | 110 | ||
| 151 | 111 | swap(no_wait_gpu, ctx->no_wait_gpu); | |
| 152 | 112 | save_flags.writeback = false; | |
| 153 | - | ret = __xe_shrinker_walk(shrinker, ctx, save_flags, to_scan, scanned, | |
| 154 | - | freed); | |
| 113 | + | lret = __xe_shrinker_walk(xe, ctx, save_flags, to_scan, scanned); | |
| 155 | 114 | swap(no_wait_gpu, ctx->no_wait_gpu); | |
| 156 | - | if (ret || *scanned >= to_scan) | |
| 157 | - | return ret; | |
| 115 | + | if (lret < 0 || *scanned >= to_scan) | |
| 116 | + | return lret; | |
| 158 | 117 | ||
| 118 | + | freed = lret; | |
| 159 | 119 | if (!ctx->no_wait_gpu) { | |
| 160 | - | ret = __xe_shrinker_walk(shrinker, ctx, save_flags, to_scan, scanned, | |
| 161 | - | freed); | |
| 162 | - | if (ret || *scanned >= to_scan) | |
| 163 | - | return ret; | |
| 120 | + | lret = __xe_shrinker_walk(xe, ctx, save_flags, to_scan, scanned); | |
| 121 | + | if (lret < 0) | |
| 122 | + | return lret; | |
| 123 | + | freed += lret; | |
| 124 | + | if (*scanned >= to_scan) | |
| 125 | + | return freed; | |
| 164 | 126 | } | |
| 165 | 127 | ||
| 166 | - | if (flags.writeback) | |
| 167 | - | ret = __xe_shrinker_walk(shrinker, ctx, flags, to_scan, scanned, | |
| 168 | - | freed); | |
| 128 | + | if (flags.writeback) { | |
| 129 | + | lret = __xe_shrinker_walk(xe, ctx, flags, to_scan, scanned); | |
| 130 | + | if (lret < 0) | |
| 131 | + | return lret; | |
| 132 | + | freed += lret; | |
| 133 | + | } | |
| 169 | 134 | ||
| 170 | - | return ret; | |
| 135 | + | return freed; | |
| 171 | 136 | } | |
| 172 | 137 | ||
| 173 | 138 | static unsigned long | |
| @@ -215,7 +180,22 @@ static bool xe_shrinker_runtime_pm_get(struct xe_shrinker *shrinker, bool force, | |||
| 215 | 180 | return false; | |
| 216 | 181 | } | |
| 217 | 182 | ||
| 218 | - | return __xe_shrinker_runtime_pm_get(shrinker); | |
| 183 | + | if (!xe_pm_runtime_get_if_active(xe)) { | |
| 184 | + | if (xe_rpm_reclaim_safe(xe) && !ttm_bo_shrink_avoid_wait()) { | |
| 185 | + | xe_pm_runtime_get(xe); | |
| 186 | + | return true; | |
| 187 | + | } | |
| 188 | + | queue_work(xe->unordered_wq, &shrinker->pm_worker); | |
| 189 | + | return false; | |
| 190 | + | } | |
| 191 | + | ||
| 192 | + | return true; | |
| 193 | + | } | |
| 194 | + | ||
| 195 | + | static void xe_shrinker_runtime_pm_put(struct xe_shrinker *shrinker, bool runtime_pm) | |
| 196 | + | { | |
| 197 | + | if (runtime_pm) | |
| 198 | + | xe_pm_runtime_put(shrinker->xe); | |
| 219 | 199 | } | |
| 220 | 200 | ||
| 221 | 201 | static unsigned long xe_shrinker_scan(struct shrinker *shrink, struct shrink_control *sc) | |
| @@ -234,6 +214,7 @@ static unsigned long xe_shrinker_scan(struct shrinker *shrink, struct shrink_con | |||
| 234 | 214 | bool runtime_pm; | |
| 235 | 215 | bool purgeable; | |
| 236 | 216 | bool can_backup = !!(sc->gfp_mask & __GFP_FS); | |
| 217 | + | s64 lret; | |
| 237 | 218 | ||
| 238 | 219 | nr_to_scan = sc->nr_to_scan; | |
| 239 | 220 | ||
| @@ -244,9 +225,12 @@ static unsigned long xe_shrinker_scan(struct shrinker *shrink, struct shrink_con | |||
| 244 | 225 | /* Might need runtime PM. Try to wake early if it looks like it. */ | |
| 245 | 226 | runtime_pm = xe_shrinker_runtime_pm_get(shrinker, false, nr_to_scan, can_backup); | |
| 246 | 227 | ||
| 247 | - | if (purgeable && nr_scanned < nr_to_scan) | |
| 248 | - | xe_shrinker_walk(shrinker, &ctx, shrink_flags, | |
| 249 | - | nr_to_scan, &nr_scanned, &freed); | |
| 228 | + | if (purgeable && nr_scanned < nr_to_scan) { | |
| 229 | + | lret = xe_shrinker_walk(shrinker->xe, &ctx, shrink_flags, | |
| 230 | + | nr_to_scan, &nr_scanned); | |
| 231 | + | if (lret >= 0) | |
| 232 | + | freed += lret; | |
| 233 | + | } | |
| 250 | 234 | ||
| 251 | 235 | sc->nr_scanned = nr_scanned; | |
| 252 | 236 | if (nr_scanned >= nr_to_scan || !can_backup) | |
| @@ -258,8 +242,10 @@ static unsigned long xe_shrinker_scan(struct shrinker *shrink, struct shrink_con | |||
| 258 | 242 | ||
| 259 | 243 | shrink_flags.purge = false; | |
| 260 | 244 | ||
| 261 | - | xe_shrinker_walk(shrinker, &ctx, shrink_flags, | |
| 262 | - | nr_to_scan, &nr_scanned, &freed); | |
| 245 | + | lret = xe_shrinker_walk(shrinker->xe, &ctx, shrink_flags, | |
| 246 | + | nr_to_scan, &nr_scanned); | |
| 247 | + | if (lret >= 0) | |
| 248 | + | freed += lret; | |
| 263 | 249 | ||
| 264 | 250 | sc->nr_scanned = nr_scanned; | |
| 265 | 251 | out: | |
modified drivers/gpu/drm/xe/xe_tlb_inval.c
| @@ -280,8 +280,7 @@ static void xe_tlb_inval_fence_prep(struct xe_tlb_inval_fence *fence) | |||
| 280 | 280 | xe_tlb_inval_fence_signal_unlocked((__fence)); \ | |
| 281 | 281 | mutex_unlock(&(__tlb_inval)->seqno_lock); \ | |
| 282 | 282 | \ | |
| 283 | - | /* Undelivered: fence already signalled, report done */ \ | |
| 284 | - | (__ret == -ECANCELED || __ret == -ENOTRECOVERABLE) ? 0 : __ret; \ | |
| 283 | + | __ret == -ECANCELED ? 0 : __ret; \ | |
| 285 | 284 | }) | |
| 286 | 285 | ||
| 287 | 286 | /** | |
modified drivers/gpu/drm/xe/xe_vm.c
| @@ -1947,13 +1947,21 @@ void xe_vm_close_and_put(struct xe_vm *vm) | |||
| 1947 | 1947 | vma->gpuva.flags |= XE_VMA_DESTROYED; | |
| 1948 | 1948 | } | |
| 1949 | 1949 | ||
| 1950 | + | /* | |
| 1951 | + | * All vm operations will add shared fences to resv. | |
| 1952 | + | * The only exception is eviction for a shared object, | |
| 1953 | + | * but even so, the unbind when evicted would still | |
| 1954 | + | * install a fence to resv. Hence it's safe to | |
| 1955 | + | * destroy the pagetables immediately. | |
| 1956 | + | */ | |
| 1957 | + | xe_vm_free_scratch(vm); | |
| 1958 | + | xe_vm_pt_destroy(vm); | |
| 1950 | 1959 | xe_vm_unlock(vm); | |
| 1951 | 1960 | ||
| 1952 | 1961 | /* | |
| 1953 | - | * Unlink and destroy all contested external-BO VMAs before destroying | |
| 1954 | - | * the page tables. Otherwise, concurrent eviction holding only bo->resv | |
| 1955 | - | * can walk the BO's VMAs and attempt to invalidate/zap page tables that | |
| 1956 | - | * have already been freed. | |
| 1962 | + | * VM is now dead, cannot re-add nodes to vm->vmas if it's NULL | |
| 1963 | + | * Since we hold a refcount to the bo, we can remove and free | |
| 1964 | + | * the members safely without locking. | |
| 1957 | 1965 | */ | |
| 1958 | 1966 | list_for_each_entry_safe(vma, next_vma, &contested, | |
| 1959 | 1967 | combined_links.destroy) { | |
| @@ -1961,11 +1969,6 @@ void xe_vm_close_and_put(struct xe_vm *vm) | |||
| 1961 | 1969 | xe_vma_destroy_unlocked(vma); | |
| 1962 | 1970 | } | |
| 1963 | 1971 | ||
| 1964 | - | xe_vm_lock(vm, false); | |
| 1965 | - | xe_vm_free_scratch(vm); | |
| 1966 | - | xe_vm_pt_destroy(vm); | |
| 1967 | - | xe_vm_unlock(vm); | |
| 1968 | - | ||
| 1969 | 1972 | xe_svm_fini(vm); | |
| 1970 | 1973 | ||
| 1971 | 1974 | up_write(&vm->lock); | |
modified drivers/gpu/drm/xe/xe_wa_oob.rules
| @@ -72,5 +72,3 @@ | |||
| 72 | 72 | 16029897822 MEDIA_VERSION(3500) | |
| 73 | 73 | GRAPHICS_VERSION(3510) | |
| 74 | 74 | 14027054324 GRAPHICS_VERSION(3511) | |
| 75 | - | 14025941587 GRAPHICS_VERSION_RANGE(2001, 3511), FUNC(xe_rtp_match_not_sriov_vf) | |
| 76 | - | MEDIA_VERSION_RANGE(1301, 3503), FUNC(xe_rtp_match_not_sriov_vf) | |
modified drivers/hid/Kconfig
| @@ -1210,8 +1210,7 @@ config HID_STEELSERIES | |||
| 1210 | 1210 | depends on USB_HID | |
| 1211 | 1211 | help | |
| 1212 | 1212 | Support for Steelseries SRW-S1 steering wheel, and the Steelseries | |
| 1213 | - | Arctis 1 Wireless for XBox, Arctis 7 (2018), Arctis 9, and Arctis | |
| 1214 | - | Nova headsets. | |
| 1213 | + | Arctis 1 Wireless for XBox headset. | |
| 1215 | 1214 | ||
| 1216 | 1215 | config HID_SUNPLUS | |
| 1217 | 1216 | tristate "Sunplus wireless desktop" | |
modified drivers/hid/amd-sfh-hid/amd_sfh_common.h
| @@ -13,15 +13,11 @@ | |||
| 13 | 13 | #include <linux/auxiliary_bus.h> | |
| 14 | 14 | #include <linux/mutex.h> | |
| 15 | 15 | #include <linux/pci.h> | |
| 16 | - | #include <linux/sizes.h> | |
| 17 | 16 | #include "amd_sfh_hid.h" | |
| 18 | 17 | ||
| 19 | 18 | #define PCI_DEVICE_ID_AMD_MP2 0x15E4 | |
| 20 | 19 | #define PCI_DEVICE_ID_AMD_MP2_1_1 0x164A | |
| 21 | 20 | ||
| 22 | - | /* The BAR 2 size must cover the highest register offset (0x10958) */ | |
| 23 | - | #define AMD_SFH_MIN_BAR_SIZE SZ_128K | |
| 24 | - | ||
| 25 | 21 | #define AMD_C2P_MSG(regno) (0x10500 + ((regno) * 4)) | |
| 26 | 22 | #define AMD_P2C_MSG(regno) (0x10680 + ((regno) * 4)) | |
| 27 | 23 | ||
modified drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
| @@ -497,16 +497,6 @@ static int amd_mp2_pci_probe(struct pci_dev *pdev, const struct pci_device_id *i | |||
| 497 | 497 | if (rc) | |
| 498 | 498 | return rc; | |
| 499 | 499 | ||
| 500 | - | if (!(pci_resource_flags(pdev, 2) & IORESOURCE_MEM)) { | |
| 501 | - | dev_err(&pdev->dev, "BAR 2 is not IORESOURCE_MEM\n"); | |
| 502 | - | return -ENODEV; | |
| 503 | - | } | |
| 504 | - | ||
| 505 | - | if (pci_resource_len(pdev, 2) < AMD_SFH_MIN_BAR_SIZE) { | |
| 506 | - | dev_err(&pdev->dev, "BAR 2 is too small\n"); | |
| 507 | - | return -EINVAL; | |
| 508 | - | } | |
| 509 | - | ||
| 510 | 500 | rc = pcim_iomap_regions(pdev, BIT(2), DRIVER_NAME); | |
| 511 | 501 | if (rc) | |
| 512 | 502 | return rc; | |
modified drivers/hid/bpf/hid_bpf_dispatch.c
| @@ -359,7 +359,7 @@ hid_bpf_release_context(struct hid_bpf_ctx *ctx) | |||
| 359 | 359 | ||
| 360 | 360 | static int | |
| 361 | 361 | __hid_bpf_hw_check_params(struct hid_bpf_ctx *ctx, __u8 *buf, size_t *buf__sz, | |
| 362 | - | enum hid_report_type rtype, bool hw_request) | |
| 362 | + | enum hid_report_type rtype) | |
| 363 | 363 | { | |
| 364 | 364 | struct hid_report_enum *report_enum; | |
| 365 | 365 | struct hid_report *report; | |
| @@ -388,10 +388,6 @@ __hid_bpf_hw_check_params(struct hid_bpf_ctx *ctx, __u8 *buf, size_t *buf__sz, | |||
| 388 | 388 | ||
| 389 | 389 | report_len = hid_report_len(report); | |
| 390 | 390 | ||
| 391 | - | /* unnumbered reports need to have a report ID reserved in the first byte */ | |
| 392 | - | if (hw_request && report_enum->numbered == 0) | |
| 393 | - | report_len += 1; | |
| 394 | - | ||
| 395 | 391 | if (*buf__sz > report_len) | |
| 396 | 392 | *buf__sz = report_len; | |
| 397 | 393 | ||
| @@ -424,7 +420,7 @@ hid_bpf_hw_request(struct hid_bpf_ctx *ctx, __u8 *buf, size_t buf__sz, | |||
| 424 | 420 | return -EDEADLOCK; | |
| 425 | 421 | ||
| 426 | 422 | /* check arguments */ | |
| 427 | - | ret = __hid_bpf_hw_check_params(ctx, buf, &size, rtype, true); | |
| 423 | + | ret = __hid_bpf_hw_check_params(ctx, buf, &size, rtype); | |
| 428 | 424 | if (ret) | |
| 429 | 425 | return ret; | |
| 430 | 426 | ||
| @@ -484,7 +480,7 @@ hid_bpf_hw_output_report(struct hid_bpf_ctx *ctx, __u8 *buf, size_t buf__sz) | |||
| 484 | 480 | return -EDEADLOCK; | |
| 485 | 481 | ||
| 486 | 482 | /* check arguments */ | |
| 487 | - | ret = __hid_bpf_hw_check_params(ctx, buf, &size, HID_OUTPUT_REPORT, true); | |
| 483 | + | ret = __hid_bpf_hw_check_params(ctx, buf, &size, HID_OUTPUT_REPORT); | |
| 488 | 484 | if (ret) | |
| 489 | 485 | return ret; | |
| 490 | 486 | ||
| @@ -510,7 +506,7 @@ __hid_bpf_input_report(struct hid_bpf_ctx *ctx, enum hid_report_type type, u8 *b | |||
| 510 | 506 | return -EDEADLOCK; | |
| 511 | 507 | ||
| 512 | 508 | /* check arguments */ | |
| 513 | - | ret = __hid_bpf_hw_check_params(ctx, buf, &size, type, false); | |
| 509 | + | ret = __hid_bpf_hw_check_params(ctx, buf, &size, type); | |
| 514 | 510 | if (ret) | |
| 515 | 511 | return ret; | |
| 516 | 512 | ||
modified drivers/hid/hid-alps.c
| @@ -407,8 +407,6 @@ static int u1_raw_event(struct alps_dev *hdata, u8 *data, int size) | |||
| 407 | 407 | return 1; | |
| 408 | 408 | ||
| 409 | 409 | case U1_SP_ABSOLUTE_REPORT_ID: | |
| 410 | - | if (!hdata->input2) | |
| 411 | - | return 0; | |
| 412 | 410 | sp_x = get_unaligned_le16(data+2); | |
| 413 | 411 | sp_y = get_unaligned_le16(data+4); | |
| 414 | 412 | ||
| @@ -740,6 +738,7 @@ static int alps_input_configured(struct hid_device *hdev, struct hid_input *hi) | |||
| 740 | 738 | goto exit; | |
| 741 | 739 | } | |
| 742 | 740 | ||
| 741 | + | data->input2 = input2; | |
| 743 | 742 | input2->phys = input->phys; | |
| 744 | 743 | input2->name = "DualPoint Stick"; | |
| 745 | 744 | input2->id.bustype = BUS_I2C; | |
| @@ -763,12 +762,11 @@ static int alps_input_configured(struct hid_device *hdev, struct hid_input *hi) | |||
| 763 | 762 | __set_bit(INPUT_PROP_POINTER, input2->propbit); | |
| 764 | 763 | __set_bit(INPUT_PROP_POINTING_STICK, input2->propbit); | |
| 765 | 764 | ||
| 766 | - | if (input_register_device(input2)) { | |
| 765 | + | if (input_register_device(data->input2)) { | |
| 767 | 766 | input_free_device(input2); | |
| 768 | 767 | ret = -ENOENT; | |
| 769 | 768 | goto exit; | |
| 770 | 769 | } | |
| 771 | - | data->input2 = input2; | |
| 772 | 770 | } | |
| 773 | 771 | ||
| 774 | 772 | exit: | |
| @@ -825,24 +823,6 @@ static int alps_probe(struct hid_device *hdev, const struct hid_device_id *id) | |||
| 825 | 823 | return 0; | |
| 826 | 824 | } | |
| 827 | 825 | ||
| 828 | - | static void alps_remove(struct hid_device *hdev) | |
| 829 | - | { | |
| 830 | - | struct alps_dev *data = hid_get_drvdata(hdev); | |
| 831 | - | ||
| 832 | - | /* | |
| 833 | - | * input2 ("DualPoint Stick") is allocated separately and is not | |
| 834 | - | * tracked in hdev->inputs, so the default remove path | |
| 835 | - | * (hid_hw_stop -> hidinput_disconnect) does not unregister it. | |
| 836 | - | * | |
| 837 | - | * Stop the device first so that no URB callback can touch input2 | |
| 838 | - | * while it is being unregistered, then drop it explicitly. | |
| 839 | - | */ | |
| 840 | - | hid_hw_stop(hdev); | |
| 841 | - | ||
| 842 | - | if (data->input2) | |
| 843 | - | input_unregister_device(data->input2); | |
| 844 | - | } | |
| 845 | - | ||
| 846 | 826 | static const struct hid_device_id alps_id[] = { | |
| 847 | 827 | { HID_DEVICE(HID_BUS_ANY, HID_GROUP_ANY, | |
| 848 | 828 | USB_VENDOR_ID_ALPS_JP, HID_DEVICE_ID_ALPS_U1_DUAL) }, | |
| @@ -865,7 +845,6 @@ static struct hid_driver alps_driver = { | |||
| 865 | 845 | .input_configured = alps_input_configured, | |
| 866 | 846 | .resume = pm_ptr(alps_post_resume), | |
| 867 | 847 | .reset_resume = pm_ptr(alps_post_reset), | |
| 868 | - | .remove = alps_remove, | |
| 869 | 848 | }; | |
| 870 | 849 | ||
| 871 | 850 | module_hid_driver(alps_driver); | |
modified drivers/hid/hid-corsair-void.c
| @@ -51,23 +51,20 @@ | |||
| 51 | 51 | /* Receiver report information: (ID 102) */ | |
| 52 | 52 | /* -------------------------------------------------------------------------- */ | |
| 53 | 53 | /* | |
| 54 | - | * When queried, the receiver responds with 5 bytes to describe the firmware | |
| 55 | - | * The first byte is the ID, then 2 bytes for the receiver, then 2 for the headset | |
| 54 | + | * When queried, the recevier responds with 4 bytes to describe the firmware | |
| 55 | + | * The first 2 bytes are for the receiver, the second 2 are the headset | |
| 56 | 56 | * The headset firmware version will be 0 if no headset is connected | |
| 57 | 57 | * | |
| 58 | - | * 0: Report ID | |
| 59 | - | * 102 for the firmware packet | |
| 60 | - | * | |
| 61 | - | * 1: Receiver firmware major version | |
| 58 | + | * 0: Recevier firmware major version | |
| 62 | 59 | * Major version of the receiver's firmware | |
| 63 | 60 | * | |
| 64 | - | * 2: Receiver firmware minor version | |
| 61 | + | * 1: Recevier firmware minor version | |
| 65 | 62 | * Minor version of the receiver's firmware | |
| 66 | 63 | * | |
| 67 | - | * 3: Headset firmware major version | |
| 64 | + | * 2: Headset firmware major version | |
| 68 | 65 | * Major version of the headset's firmware | |
| 69 | 66 | * | |
| 70 | - | * 4: Headset firmware minor version | |
| 67 | + | * 3: Headset firmware minor version | |
| 71 | 68 | * Minor version of the headset's firmware | |
| 72 | 69 | */ | |
| 73 | 70 | /* -------------------------------------------------------------------------- */ | |
modified drivers/hid/hid-elecom.c
| @@ -79,7 +79,7 @@ static const __u8 *elecom_report_fixup(struct hid_device *hdev, __u8 *rdesc, | |||
| 79 | 79 | case USB_DEVICE_ID_ELECOM_M_XT3URBK_00FB: | |
| 80 | 80 | case USB_DEVICE_ID_ELECOM_M_XT3URBK_018F: | |
| 81 | 81 | case USB_DEVICE_ID_ELECOM_M_XT3DRBK_00FC: | |
| 82 | - | case USB_DEVICE_ID_ELECOM_M_XT4DRBK_00FD: | |
| 82 | + | case USB_DEVICE_ID_ELECOM_M_XT4DRBK: | |
| 83 | 83 | /* | |
| 84 | 84 | * Report descriptor format: | |
| 85 | 85 | * 12: button bit count | |
| @@ -104,7 +104,6 @@ static const __u8 *elecom_report_fixup(struct hid_device *hdev, __u8 *rdesc, | |||
| 104 | 104 | mouse_button_fixup(hdev, rdesc, *rsize, 12, 30, 14, 20, 8); | |
| 105 | 105 | break; | |
| 106 | 106 | case USB_DEVICE_ID_ELECOM_M_XT3DRBK_018C: | |
| 107 | - | case USB_DEVICE_ID_ELECOM_M_XT4DRBK_018E: | |
| 108 | 107 | /* | |
| 109 | 108 | * Report descriptor format: | |
| 110 | 109 | * 22: button bit count | |
| @@ -149,8 +148,7 @@ static const struct hid_device_id elecom_devices[] = { | |||
| 149 | 148 | { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_XT3URBK_018F) }, | |
| 150 | 149 | { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_XT3DRBK_00FC) }, | |
| 151 | 150 | { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_XT3DRBK_018C) }, | |
| 152 | - | { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_XT4DRBK_00FD) }, | |
| 153 | - | { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_XT4DRBK_018E) }, | |
| 151 | + | { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_XT4DRBK) }, | |
| 154 | 152 | { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_DT1URBK) }, | |
| 155 | 153 | { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_DT1DRBK) }, | |
| 156 | 154 | { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_DT2DRBK) }, | |
modified drivers/hid/hid-ids.h
| @@ -477,8 +477,7 @@ | |||
| 477 | 477 | #define USB_DEVICE_ID_ELECOM_M_XT3URBK_018F 0x018f | |
| 478 | 478 | #define USB_DEVICE_ID_ELECOM_M_XT3DRBK_00FC 0x00fc | |
| 479 | 479 | #define USB_DEVICE_ID_ELECOM_M_XT3DRBK_018C 0x018c | |
| 480 | - | #define USB_DEVICE_ID_ELECOM_M_XT4DRBK_00FD 0x00fd | |
| 481 | - | #define USB_DEVICE_ID_ELECOM_M_XT4DRBK_018E 0x018e | |
| 480 | + | #define USB_DEVICE_ID_ELECOM_M_XT4DRBK 0x00fd | |
| 482 | 481 | #define USB_DEVICE_ID_ELECOM_M_DT1URBK 0x00fe | |
| 483 | 482 | #define USB_DEVICE_ID_ELECOM_M_DT1DRBK 0x00ff | |
| 484 | 483 | #define USB_DEVICE_ID_ELECOM_M_DT2DRBK 0x018d | |
| @@ -766,7 +765,6 @@ | |||
| 766 | 765 | #define I2C_DEVICE_ID_ITE_LENOVO_LEGION_Y720 0x837a | |
| 767 | 766 | #define USB_DEVICE_ID_ITE_LENOVO_YOGA900 0x8396 | |
| 768 | 767 | #define I2C_DEVICE_ID_ITE_LENOVO_YOGA_SLIM_7X_KEYBOARD 0x8987 | |
| 769 | - | #define I2C_DEVICE_ID_ITE_LENOVO_YOGA_SLIM_7X_G11_KEYBOARD 0x83db | |
| 770 | 768 | #define USB_DEVICE_ID_ITE8595 0x8595 | |
| 771 | 769 | #define USB_DEVICE_ID_ITE_MEDION_E1239T 0xce50 | |
| 772 | 770 | ||
| @@ -1298,9 +1296,6 @@ | |||
| 1298 | 1296 | #define USB_DEVICE_ID_SAMSUNG_WIRELESS_UNIVERSAL_KBD 0xa006 | |
| 1299 | 1297 | #define USB_DEVICE_ID_SAMSUNG_WIRELESS_MULTI_HOGP_KBD 0xa064 | |
| 1300 | 1298 | ||
| 1301 | - | #define USB_VENDOR_ID_SDINNOVATION 0x36ae | |
| 1302 | - | #define USB_DEVICE_ID_SDINNOVATION_GAMING_KBD 0xfeab | |
| 1303 | - | ||
| 1304 | 1299 | #define USB_VENDOR_ID_SEMICO 0x1a2c | |
| 1305 | 1300 | #define USB_DEVICE_ID_SEMICO_USB_KEYKOARD 0x0023 | |
| 1306 | 1301 | #define USB_DEVICE_ID_SEMICO_USB_KEYKOARD2 0x0027 | |
| @@ -1400,7 +1395,6 @@ | |||
| 1400 | 1395 | #define USB_VENDOR_ID_STEELSERIES 0x1038 | |
| 1401 | 1396 | #define USB_DEVICE_ID_STEELSERIES_SRWS1 0x1410 | |
| 1402 | 1397 | #define USB_DEVICE_ID_STEELSERIES_ARCTIS_1_X 0x12b6 | |
| 1403 | - | #define USB_DEVICE_ID_STEELSERIES_ARCTIS_7_2018 0x12ad | |
| 1404 | 1398 | #define USB_DEVICE_ID_STEELSERIES_ARCTIS_9 0x12c2 | |
| 1405 | 1399 | #define USB_DEVICE_ID_STEELSERIES_ARCTIS_NOVA_5_X 0x2253 | |
| 1406 | 1400 | #define USB_DEVICE_ID_STEELSERIES_ARCTIS_NOVA_7 0x2202 | |
modified drivers/hid/hid-logitech-hidpp.c
| @@ -4924,8 +4924,6 @@ static const struct hid_device_id hidpp_devices[] = { | |||
| 4924 | 4924 | HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC08D) }, | |
| 4925 | 4925 | { /* Logitech G502 X Plus Wireless Gaming Mouse over USB */ | |
| 4926 | 4926 | HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC095) }, | |
| 4927 | - | { /* Logitech G502 X Lightspeed Wireless Gaming Mouse over USB */ | |
| 4928 | - | HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC098) }, | |
| 4929 | 4927 | { /* Logitech G703 Gaming Mouse over USB */ | |
| 4930 | 4928 | HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, 0xC087) }, | |
| 4931 | 4929 | { /* Logitech G703 Hero Gaming Mouse over USB */ | |
modified drivers/hid/hid-multitouch.c
| @@ -79,7 +79,6 @@ MODULE_LICENSE("GPL"); | |||
| 79 | 79 | #define MT_QUIRK_APPLE_TOUCHBAR BIT(23) | |
| 80 | 80 | #define MT_QUIRK_YOGABOOK9I BIT(24) | |
| 81 | 81 | #define MT_QUIRK_KEEP_LATENCY_ON_CLOSE BIT(25) | |
| 82 | - | #define MT_QUIRK_IGNORE_FEATURE_ID_MISMATCH BIT(26) | |
| 83 | 82 | ||
| 84 | 83 | #define MT_INPUTMODE_TOUCHSCREEN 0x02 | |
| 85 | 84 | #define MT_INPUTMODE_TOUCHPAD 0x03 | |
| @@ -236,7 +235,6 @@ static void mt_post_parse(struct mt_device *td, struct mt_application *app); | |||
| 236 | 235 | #define MT_CLS_APPLE_TOUCHBAR 0x0114 | |
| 237 | 236 | #define MT_CLS_YOGABOOK9I 0x0115 | |
| 238 | 237 | #define MT_CLS_EGALAX_P80H84 0x0116 | |
| 239 | - | #define MT_CLS_ASUS_ROG_Z13_FOLIO 0x0117 | |
| 240 | 238 | #define MT_CLS_SIS 0x0457 | |
| 241 | 239 | ||
| 242 | 240 | #define MT_DEFAULT_MAXCONTACT 10 | |
| @@ -407,16 +405,6 @@ static const struct mt_class mt_classes[] = { | |||
| 407 | 405 | .quirks = MT_QUIRK_ALWAYS_VALID | | |
| 408 | 406 | MT_QUIRK_CONTACT_CNT_ACCURATE | | |
| 409 | 407 | MT_QUIRK_ASUS_CUSTOM_UP }, | |
| 410 | - | { .name = MT_CLS_ASUS_ROG_Z13_FOLIO, | |
| 411 | - | .quirks = MT_QUIRK_ALWAYS_VALID | | |
| 412 | - | MT_QUIRK_IGNORE_DUPLICATES | | |
| 413 | - | MT_QUIRK_HOVERING | | |
| 414 | - | MT_QUIRK_CONTACT_CNT_ACCURATE | | |
| 415 | - | MT_QUIRK_STICKY_FINGERS | | |
| 416 | - | MT_QUIRK_WIN8_PTP_BUTTONS | | |
| 417 | - | MT_QUIRK_CONFIDENCE | | |
| 418 | - | MT_QUIRK_IGNORE_FEATURE_ID_MISMATCH, | |
| 419 | - | .export_all_inputs = true }, | |
| 420 | 408 | { .name = MT_CLS_VTL, | |
| 421 | 409 | .quirks = MT_QUIRK_ALWAYS_VALID | | |
| 422 | 410 | MT_QUIRK_CONTACT_CNT_ACCURATE | | |
| @@ -519,7 +507,6 @@ static const struct attribute_group mt_attribute_group = { | |||
| 519 | 507 | ||
| 520 | 508 | static void mt_get_feature(struct hid_device *hdev, struct hid_report *report) | |
| 521 | 509 | { | |
| 522 | - | struct mt_device *td = hid_get_drvdata(hdev); | |
| 523 | 510 | int ret; | |
| 524 | 511 | u32 size = hid_report_len(report); | |
| 525 | 512 | u8 *buf; | |
| @@ -541,14 +528,8 @@ static void mt_get_feature(struct hid_device *hdev, struct hid_report *report) | |||
| 541 | 528 | dev_warn(&hdev->dev, "failed to fetch feature %d\n", | |
| 542 | 529 | report->id); | |
| 543 | 530 | } else { | |
| 544 | - | /* | |
| 545 | - | * The report ID in the request and the response should match. | |
| 546 | - | * Some firmware (e.g. the ASUS ROG Z13 Folio | |
| 547 | - | * touchpad) returns a mismatched ID on this specific fetch; | |
| 548 | - | * tolerate it only for devices explicitly flagged as such. | |
| 549 | - | */ | |
| 550 | - | if (report->id != buf[0] && | |
| 551 | - | !(td->mtclass.quirks & MT_QUIRK_IGNORE_FEATURE_ID_MISMATCH)) { | |
| 531 | + | /* The report ID in the request and the response should match */ | |
| 532 | + | if (report->id != buf[0]) { | |
| 552 | 533 | hid_err(hdev, "Returned feature report did not match the request\n"); | |
| 553 | 534 | goto free; | |
| 554 | 535 | } | |
| @@ -2734,12 +2715,6 @@ static const struct hid_device_id mt_devices[] = { | |||
| 2734 | 2715 | HID_DEVICE(BUS_I2C, HID_GROUP_MULTITOUCH_WIN_8, | |
| 2735 | 2716 | I2C_VENDOR_ID_HANTICK, I2C_PRODUCT_ID_HANTICK_5288) }, | |
| 2736 | 2717 | ||
| 2737 | - | /* Asus ROG Flow Z13 (2025) GZ302EA keyboard-cover touchpad */ | |
| 2738 | - | { .driver_data = MT_CLS_ASUS_ROG_Z13_FOLIO, | |
| 2739 | - | HID_DEVICE(BUS_USB, HID_GROUP_MULTITOUCH_WIN_8, | |
| 2740 | - | USB_VENDOR_ID_ASUSTEK, | |
| 2741 | - | USB_DEVICE_ID_ASUSTEK_ROG_Z13_FOLIO) }, | |
| 2742 | - | ||
| 2743 | 2718 | /* Generic MT device */ | |
| 2744 | 2719 | { HID_DEVICE(HID_BUS_ANY, HID_GROUP_MULTITOUCH, HID_ANY_ID, HID_ANY_ID) }, | |
| 2745 | 2720 | ||
modified drivers/hid/hid-oxp.c
| @@ -1552,9 +1552,9 @@ static int oxp_hid_probe(struct hid_device *hdev, | |||
| 1552 | 1552 | ||
| 1553 | 1553 | static void oxp_hid_remove(struct hid_device *hdev) | |
| 1554 | 1554 | { | |
| 1555 | - | cancel_delayed_work_sync(&drvdata.oxp_rgb_queue); | |
| 1556 | - | cancel_delayed_work_sync(&drvdata.oxp_btn_queue); | |
| 1557 | - | cancel_delayed_work_sync(&drvdata.oxp_mcu_init); | |
| 1555 | + | cancel_delayed_work(&drvdata.oxp_rgb_queue); | |
| 1556 | + | cancel_delayed_work(&drvdata.oxp_btn_queue); | |
| 1557 | + | cancel_delayed_work(&drvdata.oxp_mcu_init); | |
| 1558 | 1558 | hid_hw_close(hdev); | |
| 1559 | 1559 | hid_hw_stop(hdev); | |
| 1560 | 1560 | } | |
modified drivers/hid/hid-quirks.c
| @@ -186,7 +186,6 @@ static const struct hid_device_id hid_quirks[] = { | |||
| 186 | 186 | { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_X52_2), HID_QUIRK_INCREMENT_USAGE_ON_DUPLICATE }, | |
| 187 | 187 | { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_X52_PRO), HID_QUIRK_INCREMENT_USAGE_ON_DUPLICATE }, | |
| 188 | 188 | { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_X65), HID_QUIRK_INCREMENT_USAGE_ON_DUPLICATE }, | |
| 189 | - | { HID_USB_DEVICE(USB_VENDOR_ID_SDINNOVATION, USB_DEVICE_ID_SDINNOVATION_GAMING_KBD), HID_QUIRK_ALWAYS_POLL }, | |
| 190 | 189 | { HID_USB_DEVICE(USB_VENDOR_ID_SEMICO, USB_DEVICE_ID_SEMICO_USB_KEYKOARD2), HID_QUIRK_NO_INIT_REPORTS }, | |
| 191 | 190 | { HID_USB_DEVICE(USB_VENDOR_ID_SEMICO, USB_DEVICE_ID_SEMICO_USB_KEYKOARD), HID_QUIRK_NO_INIT_REPORTS }, | |
| 192 | 191 | { HID_USB_DEVICE(USB_VENDOR_ID_SENNHEISER, USB_DEVICE_ID_SENNHEISER_BTD500USB), HID_QUIRK_NOGET }, | |
| @@ -426,14 +425,13 @@ static const struct hid_device_id hid_have_special_driver[] = { | |||
| 426 | 425 | #endif | |
| 427 | 426 | #if IS_ENABLED(CONFIG_HID_ELECOM) | |
| 428 | 427 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_BM084) }, | |
| 429 | - | { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_XGL20DLBK) }, | |
| 428 | + | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_XGL20DLBK) }, | |
| 430 | 429 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_HT1MRBK_01AC) }, | |
| 431 | 430 | { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_XT3URBK_00FB) }, | |
| 432 | 431 | { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_XT3URBK_018F) }, | |
| 433 | 432 | { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_XT3DRBK_00FC) }, | |
| 434 | 433 | { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_XT3DRBK_018C) }, | |
| 435 | - | { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_XT4DRBK_00FD) }, | |
| 436 | - | { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_XT4DRBK_018E) }, | |
| 434 | + | { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_XT4DRBK) }, | |
| 437 | 435 | { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_DT1URBK) }, | |
| 438 | 436 | { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_DT1DRBK) }, | |
| 439 | 437 | { HID_USB_DEVICE(USB_VENDOR_ID_ELECOM, USB_DEVICE_ID_ELECOM_M_DT2DRBK) }, | |
| @@ -753,7 +751,6 @@ static const struct hid_device_id hid_have_special_driver[] = { | |||
| 753 | 751 | #if IS_ENABLED(CONFIG_HID_STEELSERIES) | |
| 754 | 752 | { HID_USB_DEVICE(USB_VENDOR_ID_STEELSERIES, USB_DEVICE_ID_STEELSERIES_SRWS1) }, | |
| 755 | 753 | { HID_USB_DEVICE(USB_VENDOR_ID_STEELSERIES, USB_DEVICE_ID_STEELSERIES_ARCTIS_1_X) }, | |
| 756 | - | { HID_USB_DEVICE(USB_VENDOR_ID_STEELSERIES, USB_DEVICE_ID_STEELSERIES_ARCTIS_7_2018) }, | |
| 757 | 754 | { HID_USB_DEVICE(USB_VENDOR_ID_STEELSERIES, USB_DEVICE_ID_STEELSERIES_ARCTIS_9) }, | |
| 758 | 755 | { HID_USB_DEVICE(USB_VENDOR_ID_STEELSERIES, USB_DEVICE_ID_STEELSERIES_ARCTIS_NOVA_5_X) }, | |
| 759 | 756 | { HID_USB_DEVICE(USB_VENDOR_ID_STEELSERIES, USB_DEVICE_ID_STEELSERIES_ARCTIS_NOVA_7) }, | |
modified drivers/hid/hid-roccat.c
| @@ -344,6 +344,8 @@ int roccat_connect(const struct class *klass, struct hid_device *hid, int report | |||
| 344 | 344 | return temp; | |
| 345 | 345 | } | |
| 346 | 346 | ||
| 347 | + | mutex_unlock(&devices_lock); | |
| 348 | + | ||
| 347 | 349 | init_waitqueue_head(&device->wait); | |
| 348 | 350 | INIT_LIST_HEAD(&device->readers); | |
| 349 | 351 | mutex_init(&device->readers_lock); | |
| @@ -354,7 +356,6 @@ int roccat_connect(const struct class *klass, struct hid_device *hid, int report | |||
| 354 | 356 | device->cbuf_end = 0; | |
| 355 | 357 | device->report_size = report_size; | |
| 356 | 358 | ||
| 357 | - | mutex_unlock(&devices_lock); | |
| 358 | 359 | return minor; | |
| 359 | 360 | } | |
| 360 | 361 | EXPORT_SYMBOL_GPL(roccat_connect); | |
| @@ -368,12 +369,15 @@ void roccat_disconnect(int minor) | |||
| 368 | 369 | ||
| 369 | 370 | mutex_lock(&devices_lock); | |
| 370 | 371 | device = devices[minor]; | |
| 372 | + | mutex_unlock(&devices_lock); | |
| 371 | 373 | ||
| 372 | 374 | device->exist = 0; /* TODO exist maybe not needed */ | |
| 373 | 375 | ||
| 374 | 376 | device_destroy(device->dev->class, MKDEV(roccat_major, minor)); | |
| 375 | 377 | ||
| 378 | + | mutex_lock(&devices_lock); | |
| 376 | 379 | devices[minor] = NULL; | |
| 380 | + | mutex_unlock(&devices_lock); | |
| 377 | 381 | ||
| 378 | 382 | if (device->open) { | |
| 379 | 383 | hid_hw_close(device->hid); | |
| @@ -381,8 +385,6 @@ void roccat_disconnect(int minor) | |||
| 381 | 385 | } else { | |
| 382 | 386 | roccat_free_device(device); | |
| 383 | 387 | } | |
| 384 | - | ||
| 385 | - | mutex_unlock(&devices_lock); | |
| 386 | 388 | } | |
| 387 | 389 | EXPORT_SYMBOL_GPL(roccat_disconnect); | |
| 388 | 390 | ||
modified drivers/hid/hid-steelseries-arctis.c
| @@ -101,19 +101,6 @@ static int steelseries_arctis_1_request_status(struct hid_device *hdev) | |||
| 101 | 101 | return steelseries_send_output_report(hdev, data, sizeof(data)); | |
| 102 | 102 | } | |
| 103 | 103 | ||
| 104 | - | static int steelseries_arctis_7_2018_request_status(struct hid_device *hdev) | |
| 105 | - | { | |
| 106 | - | const u8 connection[] = { 0x06, 0x14 }; | |
| 107 | - | const u8 battery[] = { 0x06, 0x18 }; | |
| 108 | - | int ret; | |
| 109 | - | ||
| 110 | - | ret = steelseries_send_output_report(hdev, connection, sizeof(connection)); | |
| 111 | - | if (ret) | |
| 112 | - | return ret; | |
| 113 | - | ||
| 114 | - | return steelseries_send_output_report(hdev, battery, sizeof(battery)); | |
| 115 | - | } | |
| 116 | - | ||
| 117 | 104 | static int steelseries_arctis_9_request_status(struct hid_device *hdev) | |
| 118 | 105 | { | |
| 119 | 106 | const u8 data[] = { 0x00, 0x20 }; | |
| @@ -165,27 +152,6 @@ static void steelseries_arctis_1_parse_status(struct steelseries_device *sd, | |||
| 165 | 152 | sd->battery_capacity = data[3]; | |
| 166 | 153 | } | |
| 167 | 154 | ||
| 168 | - | static void steelseries_arctis_7_2018_parse_status(struct steelseries_device *sd, | |
| 169 | - | u8 *data, int size) | |
| 170 | - | { | |
| 171 | - | if (size < 3 || data[0] != 0x06) | |
| 172 | - | return; | |
| 173 | - | ||
| 174 | - | switch (data[1]) { | |
| 175 | - | case 0x14: | |
| 176 | - | /* 0x03 means that the headset is connected to the transmitter. */ | |
| 177 | - | sd->headset_connected = data[2] == 0x03; | |
| 178 | - | break; | |
| 179 | - | case 0x18: | |
| 180 | - | if (!sd->headset_connected) | |
| 181 | - | break; | |
| 182 | - | ||
| 183 | - | /* The Arctis 7 sometimes overreports battery. Cap to 100. */ | |
| 184 | - | sd->battery_capacity = steelseries_map_capacity(data[2], 0, 100); | |
| 185 | - | break; | |
| 186 | - | } | |
| 187 | - | } | |
| 188 | - | ||
| 189 | 155 | static void steelseries_arctis_9_parse_status(struct steelseries_device *sd, | |
| 190 | 156 | u8 *data, int size) | |
| 191 | 157 | { | |
| @@ -266,13 +232,6 @@ static const struct steelseries_device_info arctis_1_info = { | |||
| 266 | 232 | .parse_status = steelseries_arctis_1_parse_status, | |
| 267 | 233 | }; | |
| 268 | 234 | ||
| 269 | - | static const struct steelseries_device_info arctis_7_2018_info = { | |
| 270 | - | .sync_interface = 5, | |
| 271 | - | .capabilities = SS_CAP_BATTERY, | |
| 272 | - | .request_status = steelseries_arctis_7_2018_request_status, | |
| 273 | - | .parse_status = steelseries_arctis_7_2018_parse_status, | |
| 274 | - | }; | |
| 275 | - | ||
| 276 | 235 | static const struct steelseries_device_info arctis_9_info = { | |
| 277 | 236 | .sync_interface = 0, | |
| 278 | 237 | .capabilities = SS_CAP_BATTERY, | |
| @@ -694,9 +653,6 @@ static const struct hid_device_id steelseries_arctis_devices[] = { | |||
| 694 | 653 | { HID_USB_DEVICE(USB_VENDOR_ID_STEELSERIES, | |
| 695 | 654 | USB_DEVICE_ID_STEELSERIES_ARCTIS_1_X), | |
| 696 | 655 | .driver_data = (unsigned long)&arctis_1_info }, | |
| 697 | - | { HID_USB_DEVICE(USB_VENDOR_ID_STEELSERIES, | |
| 698 | - | USB_DEVICE_ID_STEELSERIES_ARCTIS_7_2018), | |
| 699 | - | .driver_data = (unsigned long)&arctis_7_2018_info }, | |
| 700 | 656 | { HID_USB_DEVICE(USB_VENDOR_ID_STEELSERIES, | |
| 701 | 657 | USB_DEVICE_ID_STEELSERIES_ARCTIS_9), | |
| 702 | 658 | .driver_data = (unsigned long)&arctis_9_info }, | |
modified drivers/hid/hid-winwing.c
| @@ -315,8 +315,7 @@ static void winwing_haptic_rumble_cb(struct work_struct *work) | |||
| 315 | 315 | static int winwing_play_effect(struct input_dev *dev, void *context, | |
| 316 | 316 | struct ff_effect *effect) | |
| 317 | 317 | { | |
| 318 | - | struct hid_device *hdev = input_get_drvdata(dev); | |
| 319 | - | struct winwing_drv_data *data = hid_get_drvdata(hdev); | |
| 318 | + | struct winwing_drv_data *data = (struct winwing_drv_data *) context; | |
| 320 | 319 | ||
| 321 | 320 | if (effect->type != FF_RUMBLE) | |
| 322 | 321 | return 0; | |
| @@ -343,12 +342,7 @@ static int winwing_init_ff(struct hid_device *hdev, struct hid_input *hidinput) | |||
| 343 | 342 | ||
| 344 | 343 | input_set_capability(hidinput->input, EV_FF, FF_RUMBLE); | |
| 345 | 344 | ||
| 346 | - | /* | |
| 347 | - | * input_ff_create_memless() takes ownership of the context pointer | |
| 348 | - | * and frees it on teardown; do not hand it the devm-managed drvdata. | |
| 349 | - | * winwing_play_effect() fetches it from the input device instead. | |
| 350 | - | */ | |
| 351 | - | return input_ff_create_memless(hidinput->input, NULL, | |
| 345 | + | return input_ff_create_memless(hidinput->input, data, | |
| 352 | 346 | winwing_play_effect); | |
| 353 | 347 | } | |
| 354 | 348 | ||
modified drivers/hid/i2c-hid/i2c-hid-core.c
| @@ -123,10 +123,8 @@ static const struct i2c_hid_quirks { | |||
| 123 | 123 | __u32 quirks; | |
| 124 | 124 | } i2c_hid_quirks[] = { | |
| 125 | 125 | { I2C_VENDOR_ID_HANTICK, I2C_PRODUCT_ID_HANTICK_5288, | |
| 126 | - | I2C_HID_QUIRK_NO_IRQ_AFTER_RESET | I2C_HID_QUIRK_BAD_INPUT_SIZE }, | |
| 127 | - | { I2C_VENDOR_ID_ITE, I2C_DEVICE_ID_ITE_VOYO_WINPAD_A15, | |
| 128 | 126 | I2C_HID_QUIRK_NO_IRQ_AFTER_RESET }, | |
| 129 | - | { USB_VENDOR_ID_ITE, I2C_DEVICE_ID_ITE_LENOVO_YOGA_SLIM_7X_G11_KEYBOARD, | |
| 127 | + | { I2C_VENDOR_ID_ITE, I2C_DEVICE_ID_ITE_VOYO_WINPAD_A15, | |
| 130 | 128 | I2C_HID_QUIRK_NO_IRQ_AFTER_RESET }, | |
| 131 | 129 | { I2C_VENDOR_ID_RAYDIUM, I2C_PRODUCT_ID_RAYDIUM_3118, | |
| 132 | 130 | I2C_HID_QUIRK_NO_IRQ_AFTER_RESET }, | |
modified drivers/hid/wacom_sys.c
| @@ -113,9 +113,8 @@ static int wacom_wac_pen_serial_enforce(struct hid_device *hdev, | |||
| 113 | 113 | ||
| 114 | 114 | /* Queue events which have invalid tool type or serial number */ | |
| 115 | 115 | for (i = 0; i < report->maxfield; i++) { | |
| 116 | - | struct hid_field *field = report->field[i]; | |
| 117 | - | ||
| 118 | - | for (j = 0; j < field->report_count; j++) { | |
| 116 | + | for (j = 0; j < report->field[i]->maxusage; j++) { | |
| 117 | + | struct hid_field *field = report->field[i]; | |
| 119 | 118 | struct hid_usage *usage = &field->usage[j]; | |
| 120 | 119 | unsigned int equivalent_usage = wacom_equivalent_usage(usage->hid); | |
| 121 | 120 | unsigned int offset; | |
modified drivers/hwmon/cgbc-hwmon.c
| @@ -41,60 +41,45 @@ enum cgbc_sensor_types { | |||
| 41 | 41 | ||
| 42 | 42 | static const char * const cgbc_hwmon_labels_temp[] = { | |
| 43 | 43 | "CPU Temperature", | |
| 44 | - | "Case Temperature", | |
| 44 | + | "Box Temperature", | |
| 45 | 45 | "Ambient Temperature", | |
| 46 | - | "CPU Board Temperature", | |
| 47 | - | "Carrier Board Temperature", | |
| 48 | - | "System Chipset Temperature", | |
| 49 | - | "Video Controller/Board Temperature", | |
| 46 | + | "Board Temperature", | |
| 47 | + | "Carrier Temperature", | |
| 48 | + | "Chipset Temperature", | |
| 49 | + | "Video Temperature", | |
| 50 | 50 | "Other Temperature", | |
| 51 | - | "Top DIMM 0 Temperature", | |
| 52 | - | "Bottom DIMM 0 Temperature", | |
| 53 | - | "Alternate Board Temperature", | |
| 54 | - | "Top DIMM 1 Temperature", | |
| 55 | - | "Top DIMM 2 Temperature", | |
| 56 | - | "Top DIMM 3 Temperature", | |
| 57 | - | "Top DIMM 4 Temperature", | |
| 58 | - | "Top DIMM 5 Temperature", | |
| 59 | - | "Top DIMM 6 Temperature", | |
| 60 | - | "Top DIMM 7 Temperature", | |
| 61 | - | "Bottom DIMM 1 Temperature", | |
| 51 | + | "TOPDIM Temperature", | |
| 52 | + | "BOTTOMDIM Temperature", | |
| 62 | 53 | }; | |
| 63 | 54 | ||
| 64 | - | static const char * const cgbc_hwmon_labels_in[] = { | |
| 65 | - | "CPU Core Voltage", | |
| 66 | - | "DC Runtime Voltage", | |
| 67 | - | "DC Standby Voltage", | |
| 68 | - | "CMOS Battery Voltage", | |
| 69 | - | "Battery Supply Voltage", | |
| 70 | - | "AC Voltage", | |
| 71 | - | "Other Voltage", | |
| 72 | - | "5V Runtime Voltage", | |
| 73 | - | "5V Standby Voltage", | |
| 74 | - | "3V3 Runtime Voltage", | |
| 75 | - | "3V3 Standby Voltage", | |
| 76 | - | "VCore A Voltage", | |
| 77 | - | "VCore B Voltage", | |
| 78 | - | "12V Runtime Voltage", | |
| 79 | - | "12V Standby Voltage", | |
| 80 | - | }; | |
| 81 | - | ||
| 82 | - | /* | |
| 83 | - | * Current sensors are a bit special, they don't have consecutive IDs like | |
| 84 | - | * other types of sensors. So they need to be defined explicitly. | |
| 85 | - | */ | |
| 86 | 55 | static const struct { | |
| 56 | + | enum hwmon_sensor_types type; | |
| 87 | 57 | const char *label; | |
| 88 | - | int id; | |
| 89 | - | } cgbc_hwmon_labels_curr[] = { | |
| 90 | - | { "DC Runtime Current", 0x12 }, | |
| 91 | - | { "5V Runtime Current", 0x18 }, | |
| 92 | - | { "12V Runtime Current", 0x1E }, | |
| 58 | + | } cgbc_hwmon_labels_in[] = { | |
| 59 | + | { hwmon_in, "CPU Voltage" }, | |
| 60 | + | { hwmon_in, "DC Runtime Voltage" }, | |
| 61 | + | { hwmon_in, "DC Standby Voltage" }, | |
| 62 | + | { hwmon_in, "CMOS Battery Voltage" }, | |
| 63 | + | { hwmon_in, "Battery Voltage" }, | |
| 64 | + | { hwmon_in, "AC Voltage" }, | |
| 65 | + | { hwmon_in, "Other Voltage" }, | |
| 66 | + | { hwmon_in, "5V Voltage" }, | |
| 67 | + | { hwmon_in, "5V Standby Voltage" }, | |
| 68 | + | { hwmon_in, "3V3 Voltage" }, | |
| 69 | + | { hwmon_in, "3V3 Standby Voltage" }, | |
| 70 | + | { hwmon_in, "VCore A Voltage" }, | |
| 71 | + | { hwmon_in, "VCore B Voltage" }, | |
| 72 | + | { hwmon_in, "12V Voltage" }, | |
| 73 | + | { hwmon_curr, "DC Current" }, | |
| 74 | + | { hwmon_curr, "5V Current" }, | |
| 75 | + | { hwmon_curr, "12V Current" }, | |
| 93 | 76 | }; | |
| 94 | 77 | ||
| 78 | + | #define CGBC_HWMON_NB_IN_SENSORS 14 | |
| 79 | + | ||
| 95 | 80 | static const char * const cgbc_hwmon_labels_fan[] = { | |
| 96 | 81 | "CPU Fan", | |
| 97 | - | "Case Fan", | |
| 82 | + | "Box Fan", | |
| 98 | 83 | "Ambient Fan", | |
| 99 | 84 | "Chipset Fan", | |
| 100 | 85 | "Video Fan", | |
| @@ -129,8 +114,7 @@ static int cgbc_hwmon_probe_sensors(struct device *dev, struct cgbc_hwmon_data * | |||
| 129 | 114 | ||
| 130 | 115 | for (i = 0; i < nb_sensors; i++) { | |
| 131 | 116 | enum cgbc_sensor_types type; | |
| 132 | - | unsigned int channel, id; | |
| 133 | - | int j; | |
| 117 | + | unsigned int channel; | |
| 134 | 118 | ||
| 135 | 119 | /* | |
| 136 | 120 | * No need to request data for the first sensor. | |
| @@ -144,49 +128,32 @@ static int cgbc_hwmon_probe_sensors(struct device *dev, struct cgbc_hwmon_data * | |||
| 144 | 128 | } | |
| 145 | 129 | ||
| 146 | 130 | type = FIELD_GET(CGBC_HWMON_TYPE_MASK, data[1]); | |
| 147 | - | id = FIELD_GET(CGBC_HWMON_ID_MASK, data[1]); | |
| 148 | - | channel = id - 1; | |
| 131 | + | channel = FIELD_GET(CGBC_HWMON_ID_MASK, data[1]) - 1; | |
| 149 | 132 | ||
| 150 | 133 | if (type == CGBC_HWMON_TYPE_TEMP && channel < ARRAY_SIZE(cgbc_hwmon_labels_temp)) { | |
| 151 | 134 | sensor->type = hwmon_temp; | |
| 152 | 135 | sensor->label = cgbc_hwmon_labels_temp[channel]; | |
| 153 | - | } else if (type == CGBC_HWMON_TYPE_IN) { | |
| 136 | + | } else if (type == CGBC_HWMON_TYPE_IN && | |
| 137 | + | channel < ARRAY_SIZE(cgbc_hwmon_labels_in)) { | |
| 154 | 138 | /* | |
| 155 | 139 | * The Board Controller doesn't differentiate current and voltage sensors. | |
| 156 | - | * First check if it is a current sensor. | |
| 140 | + | * Get the sensor type from cgbc_hwmon_labels_in[channel].type instead. | |
| 157 | 141 | */ | |
| 158 | - | for (j = 0; j < ARRAY_SIZE(cgbc_hwmon_labels_curr); j++) { | |
| 159 | - | if (id == cgbc_hwmon_labels_curr[j].id) { | |
| 160 | - | sensor->type = hwmon_curr; | |
| 161 | - | sensor->label = cgbc_hwmon_labels_curr[j].label; | |
| 162 | - | channel = j; | |
| 163 | - | } | |
| 164 | - | } | |
| 165 | - | ||
| 166 | - | /* If it's not a current sensor, it may be a voltage sensor. */ | |
| 167 | - | if (!sensor->label && channel < ARRAY_SIZE(cgbc_hwmon_labels_in)) { | |
| 168 | - | sensor->type = hwmon_in; | |
| 169 | - | sensor->label = cgbc_hwmon_labels_in[channel]; | |
| 170 | - | } | |
| 142 | + | sensor->type = cgbc_hwmon_labels_in[channel].type; | |
| 143 | + | sensor->label = cgbc_hwmon_labels_in[channel].label; | |
| 171 | 144 | } else if (type == CGBC_HWMON_TYPE_FAN && | |
| 172 | 145 | channel < ARRAY_SIZE(cgbc_hwmon_labels_fan)) { | |
| 173 | 146 | sensor->type = hwmon_fan; | |
| 174 | 147 | sensor->label = cgbc_hwmon_labels_fan[channel]; | |
| 175 | - | } | |
| 176 | - | ||
| 177 | - | if (!sensor->label) { | |
| 178 | - | dev_warn(dev, "Board Controller returned an unknown sensor (bc_type=%d, bc_id=%d), ignore it", | |
| 179 | - | type, id); | |
| 148 | + | } else { | |
| 149 | + | dev_warn(dev, "Board Controller returned an unknown sensor (type=%d, channel=%d), ignore it", | |
| 150 | + | type, channel); | |
| 180 | 151 | continue; | |
| 181 | 152 | } | |
| 182 | 153 | ||
| 183 | 154 | sensor->active = FIELD_GET(CGBC_HWMON_ACTIVE_BIT, data[1]); | |
| 184 | 155 | sensor->channel = channel; | |
| 185 | 156 | sensor->index = i; | |
| 186 | - | ||
| 187 | - | dev_dbg(dev, "Found sensor: bc_type=%d, bc_id=%d, hwmon_type=%d, hwmon_channel=%d, hwmon_label='%s', active=%d\n", | |
| 188 | - | type, id, sensor->type, sensor->channel, sensor->label, sensor->active); | |
| 189 | - | ||
| 190 | 157 | sensor++; | |
| 191 | 158 | hwmon->nb_sensors++; | |
| 192 | 159 | } | |
| @@ -200,6 +167,14 @@ static struct cgbc_hwmon_sensor *cgbc_hwmon_find_sensor(struct cgbc_hwmon_data * | |||
| 200 | 167 | struct cgbc_hwmon_sensor *sensor = NULL; | |
| 201 | 168 | int i; | |
| 202 | 169 | ||
| 170 | + | /* | |
| 171 | + | * The Board Controller doesn't differentiate current and voltage sensors. | |
| 172 | + | * The channel value (from the Board Controller point of view) shall be computed for current | |
| 173 | + | * sensors. | |
| 174 | + | */ | |
| 175 | + | if (type == hwmon_curr) | |
| 176 | + | channel += CGBC_HWMON_NB_IN_SENSORS; | |
| 177 | + | ||
| 203 | 178 | for (i = 0; i < hwmon->nb_sensors; i++) { | |
| 204 | 179 | if (hwmon->sensors[i].type == type && hwmon->sensors[i].channel == channel) { | |
| 205 | 180 | sensor = &hwmon->sensors[i]; | |
| @@ -265,12 +240,7 @@ static const struct hwmon_channel_info * const cgbc_hwmon_info[] = { | |||
| 265 | 240 | HWMON_T_INPUT | HWMON_T_LABEL, HWMON_T_INPUT | HWMON_T_LABEL, | |
| 266 | 241 | HWMON_T_INPUT | HWMON_T_LABEL, HWMON_T_INPUT | HWMON_T_LABEL, | |
| 267 | 242 | HWMON_T_INPUT | HWMON_T_LABEL, HWMON_T_INPUT | HWMON_T_LABEL, | |
| 268 | - | HWMON_T_INPUT | HWMON_T_LABEL, HWMON_T_INPUT | HWMON_T_LABEL, | |
| 269 | - | HWMON_T_INPUT | HWMON_T_LABEL, HWMON_T_INPUT | HWMON_T_LABEL, | |
| 270 | - | HWMON_T_INPUT | HWMON_T_LABEL, HWMON_T_INPUT | HWMON_T_LABEL, | |
| 271 | - | HWMON_T_INPUT | HWMON_T_LABEL, HWMON_T_INPUT | HWMON_T_LABEL, | |
| 272 | - | HWMON_T_INPUT | HWMON_T_LABEL, HWMON_T_INPUT | HWMON_T_LABEL, | |
| 273 | - | HWMON_T_INPUT | HWMON_T_LABEL), | |
| 243 | + | HWMON_T_INPUT | HWMON_T_LABEL, HWMON_T_INPUT | HWMON_T_LABEL), | |
| 274 | 244 | HWMON_CHANNEL_INFO(in, | |
| 275 | 245 | HWMON_I_INPUT | HWMON_I_LABEL, HWMON_I_INPUT | HWMON_I_LABEL, | |
| 276 | 246 | HWMON_I_INPUT | HWMON_I_LABEL, HWMON_I_INPUT | HWMON_I_LABEL, | |
| @@ -278,8 +248,7 @@ static const struct hwmon_channel_info * const cgbc_hwmon_info[] = { | |||
| 278 | 248 | HWMON_I_INPUT | HWMON_I_LABEL, HWMON_I_INPUT | HWMON_I_LABEL, | |
| 279 | 249 | HWMON_I_INPUT | HWMON_I_LABEL, HWMON_I_INPUT | HWMON_I_LABEL, | |
| 280 | 250 | HWMON_I_INPUT | HWMON_I_LABEL, HWMON_I_INPUT | HWMON_I_LABEL, | |
| 281 | - | HWMON_I_INPUT | HWMON_I_LABEL, HWMON_I_INPUT | HWMON_I_LABEL, | |
| 282 | - | HWMON_I_INPUT | HWMON_I_LABEL), | |
| 251 | + | HWMON_I_INPUT | HWMON_I_LABEL, HWMON_I_INPUT | HWMON_I_LABEL), | |
| 283 | 252 | HWMON_CHANNEL_INFO(curr, | |
| 284 | 253 | HWMON_C_INPUT | HWMON_C_LABEL, HWMON_C_INPUT | HWMON_C_LABEL, | |
| 285 | 254 | HWMON_C_INPUT | HWMON_C_LABEL), | |
modified drivers/hwmon/gpio-fan.c
| @@ -68,7 +68,7 @@ static irqreturn_t fan_alarm_irq_handler(int irq, void *dev_id) | |||
| 68 | 68 | ||
| 69 | 69 | schedule_work(&fan_data->alarm_work); | |
| 70 | 70 | ||
| 71 | - | return IRQ_HANDLED; | |
| 71 | + | return IRQ_NONE; | |
| 72 | 72 | } | |
| 73 | 73 | ||
| 74 | 74 | static ssize_t fan1_alarm_show(struct device *dev, | |
| @@ -103,7 +103,7 @@ static int fan_alarm_init(struct gpio_fan_data *fan_data) | |||
| 103 | 103 | ||
| 104 | 104 | irq_set_irq_type(alarm_irq, IRQ_TYPE_EDGE_BOTH); | |
| 105 | 105 | return devm_request_irq(dev, alarm_irq, fan_alarm_irq_handler, | |
| 106 | - | 0, "GPIO fan alarm", fan_data); | |
| 106 | + | IRQF_SHARED, "GPIO fan alarm", fan_data); | |
| 107 | 107 | } | |
| 108 | 108 | ||
| 109 | 109 | /* | |
modified drivers/hwmon/hp-wmi-sensors.c
| @@ -526,12 +526,14 @@ static int check_wobj(const union acpi_object *wobj, | |||
| 526 | 526 | for (prop = 0; prop <= last_prop; prop++) { | |
| 527 | 527 | type = elements[prop].type; | |
| 528 | 528 | valid_type = property_map[prop]; | |
| 529 | - | if (type == ACPI_TYPE_BUFFER && | |
| 530 | - | is_raw_wmi_string(elements[prop].buffer.pointer, | |
| 531 | - | elements[prop].buffer.length)) | |
| 532 | - | type = ACPI_TYPE_STRING; | |
| 533 | - | if (type != valid_type) | |
| 529 | + | if (type != valid_type) { | |
| 530 | + | if (type == ACPI_TYPE_BUFFER && | |
| 531 | + | valid_type == ACPI_TYPE_STRING && | |
| 532 | + | is_raw_wmi_string(elements[prop].buffer.pointer, | |
| 533 | + | elements[prop].buffer.length)) | |
| 534 | + | continue; | |
| 534 | 535 | return -EINVAL; | |
| 536 | + | } | |
| 535 | 537 | } | |
| 536 | 538 | ||
| 537 | 539 | return 0; | |
| @@ -577,7 +579,6 @@ static int check_numeric_sensor_wobj(const union acpi_object *wobj, | |||
| 577 | 579 | int prop = HP_WMI_PROPERTY_NAME; | |
| 578 | 580 | acpi_object_type valid_type; | |
| 579 | 581 | union acpi_object *elements; | |
| 580 | - | union acpi_object *element; | |
| 581 | 582 | u32 elem_count; | |
| 582 | 583 | int last_prop; | |
| 583 | 584 | bool is_new; | |
| @@ -601,20 +602,13 @@ static int check_numeric_sensor_wobj(const union acpi_object *wobj, | |||
| 601 | 602 | elem_count > HP_WMI_MAX_PROPERTIES) | |
| 602 | 603 | return -EINVAL; | |
| 603 | 604 | ||
| 604 | - | element = &elements[HP_WMI_PROPERTY_SIZE]; | |
| 605 | - | type = element->type; | |
| 605 | + | type = elements[HP_WMI_PROPERTY_SIZE].type; | |
| 606 | 606 | switch (type) { | |
| 607 | 607 | case ACPI_TYPE_INTEGER: | |
| 608 | 608 | is_new = true; | |
| 609 | 609 | last_prop = HP_WMI_PROPERTY_RATE_UNITS; | |
| 610 | 610 | break; | |
| 611 | 611 | ||
| 612 | - | case ACPI_TYPE_BUFFER: | |
| 613 | - | if (!is_raw_wmi_string(element->buffer.pointer, | |
| 614 | - | element->buffer.length)) | |
| 615 | - | return -EINVAL; | |
| 616 | - | fallthrough; | |
| 617 | - | ||
| 618 | 612 | case ACPI_TYPE_STRING: | |
| 619 | 613 | is_new = false; | |
| 620 | 614 | last_prop = HP_WMI_PROPERTY_CURRENT_READING; | |
| @@ -637,10 +631,6 @@ static int check_numeric_sensor_wobj(const union acpi_object *wobj, | |||
| 637 | 631 | for (i = 0; i < elem_count && prop <= last_prop; i++, prop++) { | |
| 638 | 632 | type = elements[i].type; | |
| 639 | 633 | valid_type = hp_wmi_property_map[prop]; | |
| 640 | - | if (type == ACPI_TYPE_BUFFER && | |
| 641 | - | is_raw_wmi_string(elements[i].buffer.pointer, | |
| 642 | - | elements[i].buffer.length)) | |
| 643 | - | type = ACPI_TYPE_STRING; | |
| 644 | 634 | if (type != valid_type) | |
| 645 | 635 | return -EINVAL; | |
| 646 | 636 | ||
| @@ -661,10 +651,6 @@ static int check_numeric_sensor_wobj(const union acpi_object *wobj, | |||
| 661 | 651 | /* PossibleStates[0] has already been type-checked. */ | |
| 662 | 652 | for (j = 0; i + 1 < elem_count && j + 1 < count; j++) { | |
| 663 | 653 | type = elements[++i].type; | |
| 664 | - | if (type == ACPI_TYPE_BUFFER && | |
| 665 | - | is_raw_wmi_string(elements[i].buffer.pointer, | |
| 666 | - | elements[i].buffer.length)) | |
| 667 | - | type = ACPI_TYPE_STRING; | |
| 668 | 654 | if (type != valid_type) | |
| 669 | 655 | return -EINVAL; | |
| 670 | 656 | } | |
| @@ -1261,9 +1247,7 @@ static int fungible_show(struct seq_file *seqf, enum hp_wmi_property prop) | |||
| 1261 | 1247 | break; | |
| 1262 | 1248 | ||
| 1263 | 1249 | case HP_WMI_PROPERTY_CURRENT_STATE: | |
| 1264 | - | mutex_lock(&state->lock); | |
| 1265 | 1250 | seq_printf(seqf, "%s\n", nsensor->current_state); | |
| 1266 | - | mutex_unlock(&state->lock); | |
| 1267 | 1251 | break; | |
| 1268 | 1252 | ||
| 1269 | 1253 | case HP_WMI_PROPERTY_UNIT_MODIFIER: | |
modified drivers/hwmon/k10temp.c
| @@ -523,7 +523,7 @@ static int k10temp_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
| 523 | 523 | } | |
| 524 | 524 | } else if (boot_cpu_data.x86 == 0x1a) { | |
| 525 | 525 | switch (boot_cpu_data.x86_model) { | |
| 526 | - | case 0x00 ... 0x1f: /* Zen5 Turin */ | |
| 526 | + | case 0x00 ... 0x2f: /* Zen5 Turin */ | |
| 527 | 527 | data->ccd_offset = 0x1F0; | |
| 528 | 528 | k10temp_get_ccd_support(data, 16); | |
| 529 | 529 | break; | |
modified drivers/hwmon/pmbus/pmbus.h
| @@ -242,7 +242,6 @@ enum pmbus_regs { | |||
| 242 | 242 | /* | |
| 243 | 243 | * OPERATION | |
| 244 | 244 | */ | |
| 245 | - | #define PB_OPERATION_CONTROL_V_SRC GENMASK(5, 4) | |
| 246 | 245 | #define PB_OPERATION_CONTROL_ON BIT(7) | |
| 247 | 246 | ||
| 248 | 247 | /* | |
| @@ -387,7 +386,7 @@ enum pmbus_sensor_classes { | |||
| 387 | 386 | }; | |
| 388 | 387 | ||
| 389 | 388 | #define PMBUS_PAGES 32 /* Per PMBus specification */ | |
| 390 | - | #define PMBUS_PHASES 16 /* Maximum number of phases per page */ | |
| 389 | + | #define PMBUS_PHASES 10 /* Maximum number of phases per page */ | |
| 391 | 390 | ||
| 392 | 391 | /* Functionality bit mask */ | |
| 393 | 392 | #define PMBUS_HAVE_VIN BIT(0) | |
modified drivers/hwmon/pmbus/tps53679.c
| @@ -187,7 +187,7 @@ static int tps53676_identify(struct i2c_client *client, | |||
| 187 | 187 | return -EIO; | |
| 188 | 188 | for (i = 0; i < 2 * TPS53676_MAX_PHASES; i += 2) { | |
| 189 | 189 | if (buf[i + 1] & 0x80) { | |
| 190 | - | if (buf[i] & BIT(4)) | |
| 190 | + | if (buf[i] & 0x08) | |
| 191 | 191 | phases_b++; | |
| 192 | 192 | else | |
| 193 | 193 | phases_a++; | |
| @@ -200,15 +200,6 @@ static int tps53676_identify(struct i2c_client *client, | |||
| 200 | 200 | if (phases_b > 0) { | |
| 201 | 201 | info->pages = 2; | |
| 202 | 202 | info->phases[1] = phases_b; | |
| 203 | - | } else { | |
| 204 | - | /* | |
| 205 | - | * pmbus_set_page() does not update the PAGE register on | |
| 206 | - | * single-page devices, so select page 0 explicitly in case | |
| 207 | - | * the boot firmware left the device on another page. | |
| 208 | - | */ | |
| 209 | - | ret = i2c_smbus_write_byte_data(client, PMBUS_PAGE, 0); | |
| 210 | - | if (ret < 0) | |
| 211 | - | return ret; | |
| 212 | 203 | } | |
| 213 | 204 | return 0; | |
| 214 | 205 | } | |
modified drivers/hwmon/pwm-fan.c
| @@ -483,6 +483,7 @@ static void pwm_fan_cleanup(void *__ctx) | |||
| 483 | 483 | { | |
| 484 | 484 | struct pwm_fan_ctx *ctx = __ctx; | |
| 485 | 485 | ||
| 486 | + | timer_delete_sync(&ctx->rpm_timer); | |
| 486 | 487 | if (ctx->pwm_shutdown) { | |
| 487 | 488 | ctx->enable_mode = pwm_enable_reg_enable; | |
| 488 | 489 | __set_pwm(ctx, ctx->pwm_shutdown); | |
| @@ -493,13 +494,6 @@ static void pwm_fan_cleanup(void *__ctx) | |||
| 493 | 494 | } | |
| 494 | 495 | } | |
| 495 | 496 | ||
| 496 | - | static void pwm_fan_timer_cleanup(void *__ctx) | |
| 497 | - | { | |
| 498 | - | struct pwm_fan_ctx *ctx = __ctx; | |
| 499 | - | ||
| 500 | - | timer_shutdown_sync(&ctx->rpm_timer); | |
| 501 | - | } | |
| 502 | - | ||
| 503 | 497 | static int pwm_fan_probe(struct platform_device *pdev) | |
| 504 | 498 | { | |
| 505 | 499 | struct thermal_cooling_device *cdev; | |
| @@ -650,10 +644,6 @@ static int pwm_fan_probe(struct platform_device *pdev) | |||
| 650 | 644 | } | |
| 651 | 645 | ||
| 652 | 646 | if (ctx->tach_count > 0) { | |
| 653 | - | ret = devm_add_action_or_reset(dev, pwm_fan_timer_cleanup, ctx); | |
| 654 | - | if (ret) | |
| 655 | - | return ret; | |
| 656 | - | ||
| 657 | 647 | ctx->sample_start = ktime_get(); | |
| 658 | 648 | mod_timer(&ctx->rpm_timer, jiffies + HZ); | |
| 659 | 649 | ||
| @@ -710,7 +700,6 @@ static void pwm_fan_shutdown(struct platform_device *pdev) | |||
| 710 | 700 | { | |
| 711 | 701 | struct pwm_fan_ctx *ctx = platform_get_drvdata(pdev); | |
| 712 | 702 | ||
| 713 | - | pwm_fan_timer_cleanup(ctx); | |
| 714 | 703 | pwm_fan_cleanup(ctx); | |
| 715 | 704 | } | |
| 716 | 705 | ||
modified drivers/hwmon/w83791d.c
| @@ -1415,7 +1415,6 @@ static void w83791d_remove(struct i2c_client *client) | |||
| 1415 | 1415 | struct w83791d_data *data = i2c_get_clientdata(client); | |
| 1416 | 1416 | ||
| 1417 | 1417 | hwmon_device_unregister(data->hwmon_dev); | |
| 1418 | - | sysfs_remove_group(&client->dev.kobj, &w83791d_group_fanpwm45); | |
| 1419 | 1418 | sysfs_remove_group(&client->dev.kobj, &w83791d_group); | |
| 1420 | 1419 | } | |
| 1421 | 1420 | ||
modified drivers/hwmon/w83793.c
| @@ -1928,9 +1928,7 @@ exit_remove: | |||
| 1928 | 1928 | for (i = 0; i < ARRAY_SIZE(w83793_temp); i++) | |
| 1929 | 1929 | device_remove_file(dev, &w83793_temp[i].dev_attr); | |
| 1930 | 1930 | free_mem: | |
| 1931 | - | mutex_lock(&watchdog_data_mutex); | |
| 1932 | - | kref_put(&data->kref, w83793_release_resources); | |
| 1933 | - | mutex_unlock(&watchdog_data_mutex); | |
| 1931 | + | kfree(data); | |
| 1934 | 1932 | exit: | |
| 1935 | 1933 | return err; | |
| 1936 | 1934 | } | |
modified drivers/i2c/busses/i2c-at91-core.c
| @@ -255,7 +255,6 @@ static int at91_twi_probe(struct platform_device *pdev) | |||
| 255 | 255 | if (rc) { | |
| 256 | 256 | pm_runtime_disable(dev->dev); | |
| 257 | 257 | pm_runtime_set_suspended(dev->dev); | |
| 258 | - | at91_twi_dma_release(dev); | |
| 259 | 258 | ||
| 260 | 259 | return rc; | |
| 261 | 260 | } | |
| @@ -271,8 +270,6 @@ static void at91_twi_remove(struct platform_device *pdev) | |||
| 271 | 270 | ||
| 272 | 271 | i2c_del_adapter(&dev->adapter); | |
| 273 | 272 | ||
| 274 | - | at91_twi_dma_release(dev); | |
| 275 | - | ||
| 276 | 273 | pm_runtime_disable(dev->dev); | |
| 277 | 274 | pm_runtime_set_suspended(dev->dev); | |
| 278 | 275 | } | |
modified drivers/i2c/busses/i2c-at91-master.c
| @@ -817,21 +817,11 @@ static int at91_twi_configure_dma(struct at91_twi_dev *dev, u32 phy_addr) | |||
| 817 | 817 | error: | |
| 818 | 818 | if (ret != -EPROBE_DEFER) | |
| 819 | 819 | dev_info(dev->dev, "can't get DMA channel, continue without DMA support\n"); | |
| 820 | - | at91_twi_dma_release(dev); | |
| 821 | - | return ret; | |
| 822 | - | } | |
| 823 | - | ||
| 824 | - | void at91_twi_dma_release(struct at91_twi_dev *dev) | |
| 825 | - | { | |
| 826 | - | struct at91_twi_dma *dma = &dev->dma; | |
| 827 | - | ||
| 828 | 820 | if (dma->chan_rx) | |
| 829 | 821 | dma_release_channel(dma->chan_rx); | |
| 830 | 822 | if (dma->chan_tx) | |
| 831 | 823 | dma_release_channel(dma->chan_tx); | |
| 832 | - | dma->chan_rx = NULL; | |
| 833 | - | dma->chan_tx = NULL; | |
| 834 | - | dev->use_dma = false; | |
| 824 | + | return ret; | |
| 835 | 825 | } | |
| 836 | 826 | ||
| 837 | 827 | static int at91_init_twi_recovery_gpio(struct platform_device *pdev, | |
modified drivers/i2c/busses/i2c-at91.h
| @@ -172,7 +172,6 @@ void at91_twi_irq_restore(struct at91_twi_dev *dev); | |||
| 172 | 172 | void at91_init_twi_bus(struct at91_twi_dev *dev); | |
| 173 | 173 | ||
| 174 | 174 | void at91_init_twi_bus_master(struct at91_twi_dev *dev); | |
| 175 | - | void at91_twi_dma_release(struct at91_twi_dev *dev); | |
| 176 | 175 | int at91_twi_probe_master(struct platform_device *pdev, u32 phy_addr, | |
| 177 | 176 | struct at91_twi_dev *dev); | |
| 178 | 177 | ||
modified drivers/i2c/busses/i2c-imx.c
| @@ -1880,8 +1880,6 @@ static int i2c_imx_probe(struct platform_device *pdev) | |||
| 1880 | 1880 | ||
| 1881 | 1881 | clk_notifier_unregister: | |
| 1882 | 1882 | clk_notifier_unregister(i2c_imx->clk, &i2c_imx->clk_change_nb); | |
| 1883 | - | if (i2c_imx->dma) | |
| 1884 | - | i2c_imx_dma_free(i2c_imx); | |
| 1885 | 1883 | free_irq(irq, i2c_imx); | |
| 1886 | 1884 | rpm_disable: | |
| 1887 | 1885 | pm_runtime_put_noidle(&pdev->dev); | |
| @@ -1922,7 +1920,6 @@ static void i2c_imx_remove(struct platform_device *pdev) | |||
| 1922 | 1920 | ||
| 1923 | 1921 | pm_runtime_put_noidle(&pdev->dev); | |
| 1924 | 1922 | pm_runtime_disable(&pdev->dev); | |
| 1925 | - | pm_runtime_dont_use_autosuspend(&pdev->dev); | |
| 1926 | 1923 | } | |
| 1927 | 1924 | ||
| 1928 | 1925 | static int i2c_imx_runtime_suspend(struct device *dev) | |
modified drivers/i2c/busses/i2c-qcom-cci.c
| @@ -497,14 +497,10 @@ static const struct dev_pm_ops qcom_cci_pm = { | |||
| 497 | 497 | SET_RUNTIME_PM_OPS(cci_suspend_runtime, cci_resume_runtime, NULL) | |
| 498 | 498 | }; | |
| 499 | 499 | ||
| 500 | - | static void cci_put_of_node(void *data) | |
| 501 | - | { | |
| 502 | - | of_node_put(data); | |
| 503 | - | } | |
| 504 | - | ||
| 505 | 500 | static int cci_probe(struct platform_device *pdev) | |
| 506 | 501 | { | |
| 507 | 502 | struct device *dev = &pdev->dev; | |
| 503 | + | struct device_node *child; | |
| 508 | 504 | struct resource *r; | |
| 509 | 505 | struct cci *cci; | |
| 510 | 506 | int ret, i; | |
| @@ -520,7 +516,7 @@ static int cci_probe(struct platform_device *pdev) | |||
| 520 | 516 | if (!cci->data) | |
| 521 | 517 | return -ENOENT; | |
| 522 | 518 | ||
| 523 | - | for_each_available_child_of_node_scoped(dev->of_node, child) { | |
| 519 | + | for_each_available_child_of_node(dev->of_node, child) { | |
| 524 | 520 | struct cci_master *master; | |
| 525 | 521 | u32 idx; | |
| 526 | 522 | ||
| @@ -541,9 +537,6 @@ static int cci_probe(struct platform_device *pdev) | |||
| 541 | 537 | master->adap.algo = &cci_algo; | |
| 542 | 538 | master->adap.dev.parent = dev; | |
| 543 | 539 | master->adap.dev.of_node = of_node_get(child); | |
| 544 | - | ret = devm_add_action_or_reset(dev, cci_put_of_node, child); | |
| 545 | - | if (ret) | |
| 546 | - | return ret; | |
| 547 | 540 | master->master = idx; | |
| 548 | 541 | master->cci = cci; | |
| 549 | 542 | ||
| @@ -613,8 +606,10 @@ static int cci_probe(struct platform_device *pdev) | |||
| 613 | 606 | continue; | |
| 614 | 607 | ||
| 615 | 608 | ret = i2c_add_adapter(&cci->master[i].adap); | |
| 616 | - | if (ret < 0) | |
| 609 | + | if (ret < 0) { | |
| 610 | + | of_node_put(cci->master[i].adap.dev.of_node); | |
| 617 | 611 | goto error_i2c; | |
| 612 | + | } | |
| 618 | 613 | } | |
| 619 | 614 | ||
| 620 | 615 | return 0; | |
| @@ -622,8 +617,10 @@ static int cci_probe(struct platform_device *pdev) | |||
| 622 | 617 | error_i2c: | |
| 623 | 618 | ||
| 624 | 619 | for (--i ; i >= 0; i--) { | |
| 625 | - | if (cci->master[i].cci) | |
| 620 | + | if (cci->master[i].cci) { | |
| 626 | 621 | i2c_del_adapter(&cci->master[i].adap); | |
| 622 | + | of_node_put(cci->master[i].adap.dev.of_node); | |
| 623 | + | } | |
| 627 | 624 | } | |
| 628 | 625 | disable_clocks: | |
| 629 | 626 | cci_disable_clocks(cci); | |
| @@ -639,6 +636,7 @@ static void cci_remove(struct platform_device *pdev) | |||
| 639 | 636 | for (i = 0; i < cci->data->num_masters; i++) { | |
| 640 | 637 | if (cci->master[i].cci) { | |
| 641 | 638 | i2c_del_adapter(&cci->master[i].adap); | |
| 639 | + | of_node_put(cci->master[i].adap.dev.of_node); | |
| 642 | 640 | cci_halt(cci, i); | |
| 643 | 641 | } | |
| 644 | 642 | } | |
modified drivers/i2c/busses/i2c-qcom-geni.c
| @@ -82,9 +82,6 @@ enum geni_i2c_err_code { | |||
| 82 | 82 | #define XFER_TIMEOUT HZ | |
| 83 | 83 | #define RST_TIMEOUT HZ | |
| 84 | 84 | ||
| 85 | - | #define GENI_SE_CLK_32MHZ (32 * HZ_PER_MHZ) | |
| 86 | - | #define GENI_SE_CLK_19P2MHZ 19200000UL | |
| 87 | - | ||
| 88 | 85 | struct geni_i2c_desc { | |
| 89 | 86 | bool no_dma_support; | |
| 90 | 87 | unsigned int tx_fifo_depth; | |
| @@ -130,7 +127,6 @@ struct geni_i2c_dev { | |||
| 130 | 127 | spinlock_t lock; | |
| 131 | 128 | u32 clk_freq_out; | |
| 132 | 129 | const struct geni_i2c_clk_fld *clk_fld; | |
| 133 | - | u32 clk_idx; | |
| 134 | 130 | void *dma_buf; | |
| 135 | 131 | size_t xfer_len; | |
| 136 | 132 | dma_addr_t dma_addr; | |
| @@ -201,44 +197,19 @@ static const struct geni_i2c_clk_fld geni_i2c_clk_map_32mhz[] = { | |||
| 201 | 197 | static int geni_i2c_clk_map_idx(struct geni_i2c_dev *gi2c) | |
| 202 | 198 | { | |
| 203 | 199 | const struct geni_i2c_clk_fld *itr; | |
| 204 | - | unsigned long res_freq; | |
| 205 | 200 | ||
| 206 | - | /* | |
| 207 | - | * Frequency counter tables are calibrated for a specific source | |
| 208 | - | * clock frequency and are not valid for any multiple of it | |
| 209 | - | * (e.g. 64 MHz, 128 MHz). | |
| 210 | - | * Use exact=true and verify res_freq matches req_freq literally | |
| 211 | - | * to reject harmonics: a 64 MHz clock that divides evenly to | |
| 212 | - | * 32 MHz would pass exact matching but produce double the intended | |
| 213 | - | * I2C frequency with these counter values. | |
| 214 | - | */ | |
| 215 | - | if (!geni_se_clk_freq_match(&gi2c->se, GENI_SE_CLK_32MHZ, | |
| 216 | - | &gi2c->clk_idx, &res_freq, true) && | |
| 217 | - | res_freq == GENI_SE_CLK_32MHZ) { | |
| 201 | + | if (clk_get_rate(gi2c->se.clk) == 32 * HZ_PER_MHZ) | |
| 218 | 202 | itr = geni_i2c_clk_map_32mhz; | |
| 219 | - | } else if (!geni_se_clk_freq_match(&gi2c->se, GENI_SE_CLK_19P2MHZ, | |
| 220 | - | &gi2c->clk_idx, &res_freq, true) && | |
| 221 | - | res_freq == GENI_SE_CLK_19P2MHZ) { | |
| 203 | + | else | |
| 222 | 204 | itr = geni_i2c_clk_map_19p2mhz; | |
| 223 | - | } else { | |
| 224 | - | dev_err(gi2c->se.dev, | |
| 225 | - | "Unsupported SE source clock: must be exactly 32 MHz or 19.2 MHz\n"); | |
| 226 | - | return -EINVAL; | |
| 227 | - | } | |
| 228 | 205 | ||
| 229 | 206 | while (itr->clk_freq_out != 0) { | |
| 230 | 207 | if (itr->clk_freq_out == gi2c->clk_freq_out) { | |
| 231 | 208 | gi2c->clk_fld = itr; | |
| 232 | - | dev_dbg(gi2c->se.dev, | |
| 233 | - | "I2C clk selected: freq: %u Hz, clk_idx: %u\n", | |
| 234 | - | gi2c->clk_freq_out, gi2c->clk_idx); | |
| 235 | 209 | return 0; | |
| 236 | 210 | } | |
| 237 | 211 | itr++; | |
| 238 | 212 | } | |
| 239 | - | ||
| 240 | - | dev_err(gi2c->se.dev, "Unsupported I2C output frequency %u Hz\n", gi2c->clk_freq_out); | |
| 241 | - | ||
| 242 | 213 | return -EINVAL; | |
| 243 | 214 | } | |
| 244 | 215 | ||
| @@ -248,7 +219,7 @@ static int qcom_geni_i2c_conf(struct geni_se *se, unsigned long freq) | |||
| 248 | 219 | const struct geni_i2c_clk_fld *itr = gi2c->clk_fld; | |
| 249 | 220 | u32 val; | |
| 250 | 221 | ||
| 251 | - | writel_relaxed(gi2c->clk_idx, gi2c->se.base + SE_GENI_CLK_SEL); | |
| 222 | + | writel_relaxed(0, gi2c->se.base + SE_GENI_CLK_SEL); | |
| 252 | 223 | ||
| 253 | 224 | val = (itr->clk_div << CLK_DIV_SHFT) | SER_CLK_EN; | |
| 254 | 225 | writel_relaxed(val, gi2c->se.base + GENI_SER_M_CLK_CFG); | |
| @@ -1140,7 +1111,8 @@ static int geni_i2c_resources_init(struct geni_se *se) | |||
| 1140 | 1111 | ||
| 1141 | 1112 | ret = geni_i2c_clk_map_idx(gi2c); | |
| 1142 | 1113 | if (ret) | |
| 1143 | - | return ret; | |
| 1114 | + | return dev_err_probe(gi2c->se.dev, ret, "Invalid clk frequency %d Hz\n", | |
| 1115 | + | gi2c->clk_freq_out); | |
| 1144 | 1116 | ||
| 1145 | 1117 | return geni_icc_set_bw_ab(&gi2c->se, GENI_DEFAULT_BW, GENI_DEFAULT_BW, | |
| 1146 | 1118 | Bps_to_icc(gi2c->clk_freq_out)); | |
| @@ -1217,10 +1189,8 @@ static int geni_i2c_probe(struct platform_device *pdev) | |||
| 1217 | 1189 | return ret; | |
| 1218 | 1190 | ||
| 1219 | 1191 | ret = i2c_add_adapter(&gi2c->adap); | |
| 1220 | - | if (ret) { | |
| 1221 | - | release_gpi_dma(gi2c); | |
| 1192 | + | if (ret) | |
| 1222 | 1193 | return dev_err_probe(dev, ret, "Error adding i2c adapter\n"); | |
| 1223 | - | } | |
| 1224 | 1194 | ||
| 1225 | 1195 | dev_dbg(dev, "Geni-I2C adaptor successfully added\n"); | |
| 1226 | 1196 | ||
modified drivers/i2c/i2c-atr.c
| @@ -855,7 +855,6 @@ int i2c_atr_add_adapter(struct i2c_atr *atr, struct i2c_atr_adap_desc *desc) | |||
| 855 | 855 | ||
| 856 | 856 | ret = i2c_add_adapter(&chan->adap); | |
| 857 | 857 | if (ret) { | |
| 858 | - | atr->adapter[chan_id] = NULL; | |
| 859 | 858 | dev_err(dev, "failed to add atr-adapter %u (error=%d)\n", | |
| 860 | 859 | chan_id, ret); | |
| 861 | 860 | goto err_free_alias_pool; | |
modified drivers/infiniband/core/iwpm_util.c
| @@ -314,6 +314,10 @@ struct iwpm_nlmsg_request *iwpm_get_nlmsg_request(__u32 nlmsg_seq, | |||
| 314 | 314 | if (!nlmsg_request) | |
| 315 | 315 | return NULL; | |
| 316 | 316 | ||
| 317 | + | spin_lock_irqsave(&iwpm_nlmsg_req_lock, flags); | |
| 318 | + | list_add_tail(&nlmsg_request->inprocess_list, &iwpm_nlmsg_req_list); | |
| 319 | + | spin_unlock_irqrestore(&iwpm_nlmsg_req_lock, flags); | |
| 320 | + | ||
| 317 | 321 | kref_init(&nlmsg_request->kref); | |
| 318 | 322 | kref_get(&nlmsg_request->kref); | |
| 319 | 323 | nlmsg_request->nlmsg_seq = nlmsg_seq; | |
| @@ -322,11 +326,6 @@ struct iwpm_nlmsg_request *iwpm_get_nlmsg_request(__u32 nlmsg_seq, | |||
| 322 | 326 | nlmsg_request->err_code = 0; | |
| 323 | 327 | sema_init(&nlmsg_request->sem, 1); | |
| 324 | 328 | down(&nlmsg_request->sem); | |
| 325 | - | ||
| 326 | - | spin_lock_irqsave(&iwpm_nlmsg_req_lock, flags); | |
| 327 | - | list_add_tail(&nlmsg_request->inprocess_list, &iwpm_nlmsg_req_list); | |
| 328 | - | spin_unlock_irqrestore(&iwpm_nlmsg_req_lock, flags); | |
| 329 | - | ||
| 330 | 329 | return nlmsg_request; | |
| 331 | 330 | } | |
| 332 | 331 | ||
modified drivers/infiniband/core/mad.c
| @@ -2059,8 +2059,6 @@ static void ib_mad_complete_recv(struct ib_mad_agent_private *mad_agent_priv, | |||
| 2059 | 2059 | int ret; | |
| 2060 | 2060 | ||
| 2061 | 2061 | INIT_LIST_HEAD(&mad_recv_wc->rmpp_list); | |
| 2062 | - | list_add(&mad_recv_wc->recv_buf.list, &mad_recv_wc->rmpp_list); | |
| 2063 | - | ||
| 2064 | 2062 | ret = ib_mad_enforce_security(mad_agent_priv, | |
| 2065 | 2063 | mad_recv_wc->wc->pkey_index); | |
| 2066 | 2064 | if (ret) { | |
| @@ -2069,6 +2067,7 @@ static void ib_mad_complete_recv(struct ib_mad_agent_private *mad_agent_priv, | |||
| 2069 | 2067 | return; | |
| 2070 | 2068 | } | |
| 2071 | 2069 | ||
| 2070 | + | list_add(&mad_recv_wc->recv_buf.list, &mad_recv_wc->rmpp_list); | |
| 2072 | 2071 | if (is_kernel_rmpp_data_response(mad_agent_priv, mad_recv_wc)) { | |
| 2073 | 2072 | spin_lock_irqsave(&mad_agent_priv->lock, flags); | |
| 2074 | 2073 | mad_send_wr = ib_find_send_mad(mad_agent_priv, mad_recv_wc); | |
modified drivers/infiniband/core/rdma_core.c
| @@ -69,6 +69,7 @@ void ib_uverbs_release_file(struct kref *ref) | |||
| 69 | 69 | ||
| 70 | 70 | if (file->disassociate_page) | |
| 71 | 71 | __free_pages(file->disassociate_page, 0); | |
| 72 | + | mutex_destroy(&file->disassociation_lock); | |
| 72 | 73 | mutex_destroy(&file->umap_lock); | |
| 73 | 74 | mutex_destroy(&file->ucontext_lock); | |
| 74 | 75 | kfree(file); | |
modified drivers/infiniband/core/ucma.c
| @@ -1556,10 +1556,9 @@ static ssize_t ucma_process_join(struct ucma_file *file, | |||
| 1556 | 1556 | mutex_lock(&ctx->mutex); | |
| 1557 | 1557 | ret = rdma_join_multicast(ctx->cm_id, (struct sockaddr *)&mc->addr, | |
| 1558 | 1558 | join_state, mc); | |
| 1559 | - | if (ret) { | |
| 1560 | - | mutex_unlock(&ctx->mutex); | |
| 1559 | + | mutex_unlock(&ctx->mutex); | |
| 1560 | + | if (ret) | |
| 1561 | 1561 | goto err_xa_erase; | |
| 1562 | - | } | |
| 1563 | 1562 | ||
| 1564 | 1563 | resp.id = mc->id; | |
| 1565 | 1564 | if (copy_to_user(u64_to_user_ptr(cmd->response), | |
| @@ -1567,7 +1566,6 @@ static ssize_t ucma_process_join(struct ucma_file *file, | |||
| 1567 | 1566 | ret = -EFAULT; | |
| 1568 | 1567 | goto err_leave_multicast; | |
| 1569 | 1568 | } | |
| 1570 | - | mutex_unlock(&ctx->mutex); | |
| 1571 | 1569 | ||
| 1572 | 1570 | xa_store(&multicast_table, mc->id, mc, 0); | |
| 1573 | 1571 | ||
| @@ -1575,6 +1573,7 @@ static ssize_t ucma_process_join(struct ucma_file *file, | |||
| 1575 | 1573 | return 0; | |
| 1576 | 1574 | ||
| 1577 | 1575 | err_leave_multicast: | |
| 1576 | + | mutex_lock(&ctx->mutex); | |
| 1578 | 1577 | rdma_leave_multicast(ctx->cm_id, (struct sockaddr *) &mc->addr); | |
| 1579 | 1578 | mutex_unlock(&ctx->mutex); | |
| 1580 | 1579 | ucma_cleanup_mc_events(mc); | |
modified drivers/infiniband/core/uverbs_flow.c
| @@ -26,7 +26,6 @@ out: | |||
| 26 | 26 | return resources; | |
| 27 | 27 | ||
| 28 | 28 | err: | |
| 29 | - | kfree(resources->collection); | |
| 30 | 29 | kfree(resources->counters); | |
| 31 | 30 | kfree(resources); | |
| 32 | 31 | ||
modified drivers/infiniband/core/uverbs_main.c
| @@ -644,15 +644,12 @@ static int ib_uverbs_mmap(struct file *filp, struct vm_area_struct *vma) | |||
| 644 | 644 | goto out; | |
| 645 | 645 | } | |
| 646 | 646 | ||
| 647 | - | if (!down_read_trylock(&file->hw_destroy_rwsem)) { | |
| 648 | - | ret = -EIO; | |
| 649 | - | goto out; | |
| 650 | - | } | |
| 647 | + | mutex_lock(&file->disassociation_lock); | |
| 651 | 648 | ||
| 652 | 649 | vma->vm_ops = &rdma_umap_ops; | |
| 653 | 650 | ret = ucontext->device->ops.mmap(ucontext, vma); | |
| 654 | 651 | ||
| 655 | - | up_read(&file->hw_destroy_rwsem); | |
| 652 | + | mutex_unlock(&file->disassociation_lock); | |
| 656 | 653 | out: | |
| 657 | 654 | srcu_read_unlock(&file->device->disassociate_srcu, srcu_key); | |
| 658 | 655 | return ret; | |
| @@ -674,6 +671,7 @@ static void rdma_umap_open(struct vm_area_struct *vma) | |||
| 674 | 671 | /* We are racing with disassociation */ | |
| 675 | 672 | if (!down_read_trylock(&ufile->hw_destroy_rwsem)) | |
| 676 | 673 | goto out_zap; | |
| 674 | + | mutex_lock(&ufile->disassociation_lock); | |
| 677 | 675 | ||
| 678 | 676 | /* | |
| 679 | 677 | * Disassociation already completed, the VMA should already be zapped. | |
| @@ -686,10 +684,12 @@ static void rdma_umap_open(struct vm_area_struct *vma) | |||
| 686 | 684 | goto out_unlock; | |
| 687 | 685 | rdma_umap_priv_init(priv, vma, opriv->entry); | |
| 688 | 686 | ||
| 687 | + | mutex_unlock(&ufile->disassociation_lock); | |
| 689 | 688 | up_read(&ufile->hw_destroy_rwsem); | |
| 690 | 689 | return; | |
| 691 | 690 | ||
| 692 | 691 | out_unlock: | |
| 692 | + | mutex_unlock(&ufile->disassociation_lock); | |
| 693 | 693 | up_read(&ufile->hw_destroy_rwsem); | |
| 694 | 694 | out_zap: | |
| 695 | 695 | /* | |
| @@ -773,7 +773,7 @@ void uverbs_user_mmap_disassociate(struct ib_uverbs_file *ufile) | |||
| 773 | 773 | { | |
| 774 | 774 | struct rdma_umap_priv *priv, *next_priv; | |
| 775 | 775 | ||
| 776 | - | lockdep_assert_held_write(&ufile->hw_destroy_rwsem); | |
| 776 | + | mutex_lock(&ufile->disassociation_lock); | |
| 777 | 777 | ||
| 778 | 778 | while (1) { | |
| 779 | 779 | struct mm_struct *mm = NULL; | |
| @@ -799,8 +799,10 @@ void uverbs_user_mmap_disassociate(struct ib_uverbs_file *ufile) | |||
| 799 | 799 | break; | |
| 800 | 800 | } | |
| 801 | 801 | mutex_unlock(&ufile->umap_lock); | |
| 802 | - | if (!mm) | |
| 802 | + | if (!mm) { | |
| 803 | + | mutex_unlock(&ufile->disassociation_lock); | |
| 803 | 804 | return; | |
| 805 | + | } | |
| 804 | 806 | ||
| 805 | 807 | /* | |
| 806 | 808 | * The umap_lock is nested under mmap_lock since it used within | |
| @@ -830,6 +832,8 @@ void uverbs_user_mmap_disassociate(struct ib_uverbs_file *ufile) | |||
| 830 | 832 | mmap_read_unlock(mm); | |
| 831 | 833 | mmput(mm); | |
| 832 | 834 | } | |
| 835 | + | ||
| 836 | + | mutex_unlock(&ufile->disassociation_lock); | |
| 833 | 837 | } | |
| 834 | 838 | ||
| 835 | 839 | /** | |
| @@ -847,11 +851,8 @@ void rdma_user_mmap_disassociate(struct ib_device *device) | |||
| 847 | 851 | ||
| 848 | 852 | mutex_lock(&uverbs_dev->lists_mutex); | |
| 849 | 853 | list_for_each_entry(ufile, &uverbs_dev->uverbs_file_list, list) { | |
| 850 | - | if (ufile->ucontext) { | |
| 851 | - | down_write(&ufile->hw_destroy_rwsem); | |
| 854 | + | if (ufile->ucontext) | |
| 852 | 855 | uverbs_user_mmap_disassociate(ufile); | |
| 853 | - | up_write(&ufile->hw_destroy_rwsem); | |
| 854 | - | } | |
| 855 | 856 | } | |
| 856 | 857 | mutex_unlock(&uverbs_dev->lists_mutex); | |
| 857 | 858 | } | |
| @@ -926,6 +927,8 @@ static int ib_uverbs_open(struct inode *inode, struct file *filp) | |||
| 926 | 927 | mutex_init(&file->umap_lock); | |
| 927 | 928 | INIT_LIST_HEAD(&file->umaps); | |
| 928 | 929 | ||
| 930 | + | mutex_init(&file->disassociation_lock); | |
| 931 | + | ||
| 929 | 932 | filp->private_data = file; | |
| 930 | 933 | list_add_tail(&file->list, &dev->uverbs_file_list); | |
| 931 | 934 | mutex_unlock(&dev->lists_mutex); | |
modified drivers/infiniband/core/verbs.c
| @@ -2058,13 +2058,11 @@ int ib_get_eth_speed(struct ib_device *dev, u32 port_num, u16 *speed, u8 *width) | |||
| 2058 | 2058 | return -ENODEV; | |
| 2059 | 2059 | ||
| 2060 | 2060 | rtnl_lock(); | |
| 2061 | - | if (READ_ONCE(netdev->reg_state) != NETREG_REGISTERED) { | |
| 2062 | - | dev_put(netdev); | |
| 2063 | - | rtnl_unlock(); | |
| 2064 | - | return -ENODEV; | |
| 2065 | - | } | |
| 2066 | - | ||
| 2067 | 2061 | rc = __ethtool_get_link_ksettings(netdev, &lksettings); | |
| 2062 | + | rtnl_unlock(); | |
| 2063 | + | ||
| 2064 | + | dev_put(netdev); | |
| 2065 | + | ||
| 2068 | 2066 | if (!rc && lksettings.base.speed != (u32)SPEED_UNKNOWN) { | |
| 2069 | 2067 | netdev_speed = lksettings.base.speed; | |
| 2070 | 2068 | } else { | |
| @@ -2073,8 +2071,6 @@ int ib_get_eth_speed(struct ib_device *dev, u32 port_num, u16 *speed, u8 *width) | |||
| 2073 | 2071 | pr_warn("%s speed is unknown, defaulting to %u\n", | |
| 2074 | 2072 | netdev->name, netdev_speed); | |
| 2075 | 2073 | } | |
| 2076 | - | dev_put(netdev); | |
| 2077 | - | rtnl_unlock(); | |
| 2078 | 2074 | ||
| 2079 | 2075 | ib_get_width_and_speed(netdev_speed, lksettings.lanes, | |
| 2080 | 2076 | speed, width); | |
modified drivers/infiniband/hw/bnxt_re/main.c
| @@ -356,13 +356,9 @@ static int bnxt_re_update_qp1_tos_dscp(struct bnxt_re_dev *rdev) | |||
| 356 | 356 | return bnxt_qplib_modify_qp(&rdev->qplib_res, &qp->qplib_qp); | |
| 357 | 357 | } | |
| 358 | 358 | ||
| 359 | - | static int bnxt_re_init_dcb_wq(struct bnxt_re_dev *rdev) | |
| 359 | + | static void bnxt_re_init_dcb_wq(struct bnxt_re_dev *rdev) | |
| 360 | 360 | { | |
| 361 | 361 | rdev->dcb_wq = create_singlethread_workqueue("bnxt_re_dcb_wq"); | |
| 362 | - | if (!rdev->dcb_wq) | |
| 363 | - | return -ENOMEM; | |
| 364 | - | ||
| 365 | - | return 0; | |
| 366 | 362 | } | |
| 367 | 363 | ||
| 368 | 364 | static void bnxt_re_uninit_dcb_wq(struct bnxt_re_dev *rdev) | |
| @@ -2343,9 +2339,7 @@ static int bnxt_re_dev_init(struct bnxt_re_dev *rdev, u8 op_type) | |||
| 2343 | 2339 | } | |
| 2344 | 2340 | bnxt_re_debugfs_add_pdev(rdev); | |
| 2345 | 2341 | ||
| 2346 | - | rc = bnxt_re_init_dcb_wq(rdev); | |
| 2347 | - | if (rc) | |
| 2348 | - | goto fail; | |
| 2342 | + | bnxt_re_init_dcb_wq(rdev); | |
| 2349 | 2343 | bnxt_re_net_register_async_event(rdev); | |
| 2350 | 2344 | ||
| 2351 | 2345 | if (!rdev->is_virtfn) | |
modified drivers/infiniband/hw/bnxt_re/uapi.c
| @@ -462,6 +462,7 @@ static int UVERBS_HANDLER(BNXT_RE_METHOD_DBR_ALLOC)(struct uverbs_attr_bundle *a | |||
| 462 | 462 | uobj->object = obj; | |
| 463 | 463 | uverbs_finalize_uobj_create(attrs, BNXT_RE_ALLOC_DBR_HANDLE); | |
| 464 | 464 | ||
| 465 | + | dbr.umdbr = dpi->umdbr; | |
| 465 | 466 | dbr.dpi = dpi->dpi; | |
| 466 | 467 | ret = uverbs_copy_to_struct_or_zero(attrs, BNXT_RE_ALLOC_DBR_ATTR, | |
| 467 | 468 | &dbr, sizeof(dbr)); | |
| @@ -524,6 +525,7 @@ static int UVERBS_HANDLER(BNXT_RE_METHOD_GET_DEFAULT_DBR)(struct uverbs_attr_bun | |||
| 524 | 525 | return PTR_ERR(ib_uctx); | |
| 525 | 526 | ||
| 526 | 527 | uctx = container_of(ib_uctx, struct bnxt_re_ucontext, ib_uctx); | |
| 528 | + | dpi.umdbr = uctx->dpi.umdbr; | |
| 527 | 529 | dpi.dpi = uctx->dpi.dpi; | |
| 528 | 530 | ||
| 529 | 531 | ret = uverbs_copy_to_struct_or_zero(attrs, BNXT_RE_DEFAULT_DBR_ATTR, | |
| @@ -541,7 +543,7 @@ DECLARE_UVERBS_NAMED_METHOD(BNXT_RE_METHOD_DBR_ALLOC, | |||
| 541 | 543 | UA_MANDATORY), | |
| 542 | 544 | UVERBS_ATTR_PTR_OUT(BNXT_RE_ALLOC_DBR_ATTR, | |
| 543 | 545 | UVERBS_ATTR_STRUCT(struct bnxt_re_db_region, | |
| 544 | - | reserved2), | |
| 546 | + | umdbr), | |
| 545 | 547 | UA_MANDATORY), | |
| 546 | 548 | UVERBS_ATTR_PTR_OUT(BNXT_RE_ALLOC_DBR_OFFSET, | |
| 547 | 549 | UVERBS_ATTR_TYPE(u64), | |
| @@ -561,7 +563,7 @@ DECLARE_UVERBS_NAMED_OBJECT(BNXT_RE_OBJECT_DBR, | |||
| 561 | 563 | DECLARE_UVERBS_NAMED_METHOD(BNXT_RE_METHOD_GET_DEFAULT_DBR, | |
| 562 | 564 | UVERBS_ATTR_PTR_OUT(BNXT_RE_DEFAULT_DBR_ATTR, | |
| 563 | 565 | UVERBS_ATTR_STRUCT(struct bnxt_re_db_region, | |
| 564 | - | reserved2), | |
| 566 | + | umdbr), | |
| 565 | 567 | UA_MANDATORY)); | |
| 566 | 568 | ||
| 567 | 569 | DECLARE_UVERBS_GLOBAL_METHODS(BNXT_RE_OBJECT_DEFAULT_DBR, | |
modified drivers/infiniband/hw/efa/efa_com.c
| @@ -850,7 +850,7 @@ int efa_com_admin_init(struct efa_com_dev *edev, | |||
| 850 | 850 | ||
| 851 | 851 | aq->dmadev = edev->dmadev; | |
| 852 | 852 | aq->efa_dev = edev->efa_dev; | |
| 853 | - | efa_com_set_admin_polling_mode(edev, true); | |
| 853 | + | set_bit(EFA_AQ_STATE_POLLING_BIT, &aq->state); | |
| 854 | 854 | ||
| 855 | 855 | sema_init(&aq->avail_cmds, aq->depth); | |
| 856 | 856 | ||
| @@ -868,6 +868,8 @@ int efa_com_admin_init(struct efa_com_dev *edev, | |||
| 868 | 868 | if (err) | |
| 869 | 869 | goto err_destroy_sq; | |
| 870 | 870 | ||
| 871 | + | efa_com_set_admin_polling_mode(edev, false); | |
| 872 | + | ||
| 871 | 873 | err = efa_com_admin_init_aenq(edev, aenq_handlers); | |
| 872 | 874 | if (err) | |
| 873 | 875 | goto err_destroy_cq; | |
| @@ -1252,7 +1254,7 @@ static void efa_com_destroy_eq(struct efa_com_dev *edev, | |||
| 1252 | 1254 | err); | |
| 1253 | 1255 | } | |
| 1254 | 1256 | ||
| 1255 | - | void efa_com_arm_eq(struct efa_com_dev *edev, struct efa_com_eq *eeq) | |
| 1257 | + | static void efa_com_arm_eq(struct efa_com_dev *edev, struct efa_com_eq *eeq) | |
| 1256 | 1258 | { | |
| 1257 | 1259 | u32 val = 0; | |
| 1258 | 1260 | ||
| @@ -1341,6 +1343,7 @@ int efa_com_eq_init(struct efa_com_dev *edev, struct efa_com_eq *eeq, | |||
| 1341 | 1343 | eeq->phase = 1; | |
| 1342 | 1344 | eeq->depth = params.depth; | |
| 1343 | 1345 | eeq->cb = cb; | |
| 1346 | + | efa_com_arm_eq(edev, eeq); | |
| 1344 | 1347 | ||
| 1345 | 1348 | return 0; | |
| 1346 | 1349 | ||
modified drivers/infiniband/hw/efa/efa_com.h
| @@ -169,7 +169,6 @@ int efa_com_admin_init(struct efa_com_dev *edev, | |||
| 169 | 169 | void efa_com_admin_destroy(struct efa_com_dev *edev); | |
| 170 | 170 | int efa_com_eq_init(struct efa_com_dev *edev, struct efa_com_eq *eeq, | |
| 171 | 171 | efa_eqe_handler cb, u16 depth, u8 msix_vec); | |
| 172 | - | void efa_com_arm_eq(struct efa_com_dev *edev, struct efa_com_eq *eeq); | |
| 173 | 172 | void efa_com_eq_destroy(struct efa_com_dev *edev, struct efa_com_eq *eeq); | |
| 174 | 173 | int efa_com_dev_reset(struct efa_com_dev *edev, | |
| 175 | 174 | enum efa_regs_reset_reason_types reset_reason); | |
modified drivers/infiniband/hw/efa/efa_main.c
| @@ -302,30 +302,28 @@ static void efa_set_host_info(struct efa_dev *dev) | |||
| 302 | 302 | ||
| 303 | 303 | static void efa_destroy_eq(struct efa_dev *dev, struct efa_eq *eq) | |
| 304 | 304 | { | |
| 305 | - | efa_free_irq(dev, &eq->irq); | |
| 306 | 305 | efa_com_eq_destroy(&dev->edev, &eq->eeq); | |
| 306 | + | efa_free_irq(dev, &eq->irq); | |
| 307 | 307 | } | |
| 308 | 308 | ||
| 309 | 309 | static int efa_create_eq(struct efa_dev *dev, struct efa_eq *eq, u32 msix_vec) | |
| 310 | 310 | { | |
| 311 | 311 | int err; | |
| 312 | 312 | ||
| 313 | - | err = efa_com_eq_init(&dev->edev, &eq->eeq, efa_process_eqe, | |
| 314 | - | dev->dev_attr.max_eq_depth, msix_vec); | |
| 315 | - | if (err) | |
| 316 | - | return err; | |
| 317 | - | ||
| 318 | 313 | efa_setup_comp_irq(dev, eq, msix_vec); | |
| 319 | 314 | err = efa_request_irq(dev, &eq->irq); | |
| 320 | 315 | if (err) | |
| 321 | - | goto err_destroy_eq; | |
| 316 | + | return err; | |
| 322 | 317 | ||
| 323 | - | efa_com_arm_eq(&dev->edev, &eq->eeq); | |
| 318 | + | err = efa_com_eq_init(&dev->edev, &eq->eeq, efa_process_eqe, | |
| 319 | + | dev->dev_attr.max_eq_depth, msix_vec); | |
| 320 | + | if (err) | |
| 321 | + | goto err_free_comp_irq; | |
| 324 | 322 | ||
| 325 | 323 | return 0; | |
| 326 | 324 | ||
| 327 | - | err_destroy_eq: | |
| 328 | - | efa_com_eq_destroy(&dev->edev, &eq->eeq); | |
| 325 | + | err_free_comp_irq: | |
| 326 | + | efa_free_irq(dev, &eq->irq); | |
| 329 | 327 | return err; | |
| 330 | 328 | } | |
| 331 | 329 | ||
| @@ -621,21 +619,18 @@ static struct efa_dev *efa_probe_device(struct pci_dev *pdev) | |||
| 621 | 619 | edev->aq.msix_vector_idx = dev->admin_msix_vector_idx; | |
| 622 | 620 | edev->aenq.msix_vector_idx = dev->admin_msix_vector_idx; | |
| 623 | 621 | ||
| 624 | - | err = efa_com_admin_init(edev, &aenq_handlers); | |
| 622 | + | err = efa_set_mgmnt_irq(dev); | |
| 625 | 623 | if (err) | |
| 626 | 624 | goto err_disable_msix; | |
| 627 | 625 | ||
| 628 | - | err = efa_set_mgmnt_irq(dev); | |
| 626 | + | err = efa_com_admin_init(edev, &aenq_handlers); | |
| 629 | 627 | if (err) | |
| 630 | - | goto err_destroy_admin; | |
| 631 | - | ||
| 632 | - | efa_com_set_admin_polling_mode(edev, false); | |
| 628 | + | goto err_free_mgmnt_irq; | |
| 633 | 629 | ||
| 634 | 630 | return dev; | |
| 635 | 631 | ||
| 636 | - | err_destroy_admin: | |
| 637 | - | efa_com_dev_reset(edev, EFA_REGS_RESET_INIT_ERR); | |
| 638 | - | efa_com_admin_destroy(edev); | |
| 632 | + | err_free_mgmnt_irq: | |
| 633 | + | efa_free_irq(dev, &dev->admin_irq); | |
| 639 | 634 | err_disable_msix: | |
| 640 | 635 | efa_disable_msix(dev); | |
| 641 | 636 | err_reg_read_destroy: | |
| @@ -659,8 +654,8 @@ static void efa_remove_device(struct pci_dev *pdev, | |||
| 659 | 654 | ||
| 660 | 655 | edev = &dev->edev; | |
| 661 | 656 | efa_com_dev_reset(edev, reset_reason); | |
| 662 | - | efa_free_irq(dev, &dev->admin_irq); | |
| 663 | 657 | efa_com_admin_destroy(edev); | |
| 658 | + | efa_free_irq(dev, &dev->admin_irq); | |
| 664 | 659 | efa_disable_msix(dev); | |
| 665 | 660 | efa_com_mmio_reg_read_destroy(edev); | |
| 666 | 661 | devm_iounmap(&pdev->dev, edev->reg_bar); | |
modified drivers/infiniband/hw/erdma/erdma_main.c
| @@ -572,8 +572,8 @@ static int erdma_ib_device_add(struct pci_dev *pdev) | |||
| 572 | 572 | INIT_LIST_HEAD(&dev->cep_list); | |
| 573 | 573 | ||
| 574 | 574 | spin_lock_init(&dev->lock); | |
| 575 | - | xa_init_flags(&dev->qp_xa, XA_FLAGS_ALLOC1 | XA_FLAGS_LOCK_IRQ); | |
| 576 | - | xa_init_flags(&dev->cq_xa, XA_FLAGS_ALLOC1 | XA_FLAGS_LOCK_IRQ); | |
| 575 | + | xa_init_flags(&dev->qp_xa, XA_FLAGS_ALLOC1); | |
| 576 | + | xa_init_flags(&dev->cq_xa, XA_FLAGS_ALLOC1); | |
| 577 | 577 | dev->next_alloc_cqn = 1; | |
| 578 | 578 | dev->next_alloc_qpn = 1; | |
| 579 | 579 | ||
modified drivers/infiniband/hw/erdma/erdma_verbs.c
| @@ -1021,15 +1021,15 @@ int erdma_create_qp(struct ib_qp *ibqp, struct ib_qp_init_attr *attrs, | |||
| 1021 | 1021 | init_completion(&qp->safe_free); | |
| 1022 | 1022 | ||
| 1023 | 1023 | if (qp->ibqp.qp_type == IB_QPT_GSI) { | |
| 1024 | - | old_entry = xa_store_irq(&dev->qp_xa, 1, qp, GFP_KERNEL); | |
| 1024 | + | old_entry = xa_store(&dev->qp_xa, 1, qp, GFP_KERNEL); | |
| 1025 | 1025 | if (xa_is_err(old_entry)) | |
| 1026 | 1026 | ret = xa_err(old_entry); | |
| 1027 | 1027 | else | |
| 1028 | 1028 | qp->ibqp.qp_num = 1; | |
| 1029 | 1029 | } else { | |
| 1030 | - | ret = xa_alloc_cyclic_irq(&dev->qp_xa, &qp->ibqp.qp_num, qp, | |
| 1031 | - | XA_LIMIT(1, dev->attrs.max_qp - 1), | |
| 1032 | - | &dev->next_alloc_qpn, GFP_KERNEL); | |
| 1030 | + | ret = xa_alloc_cyclic(&dev->qp_xa, &qp->ibqp.qp_num, qp, | |
| 1031 | + | XA_LIMIT(1, dev->attrs.max_qp - 1), | |
| 1032 | + | &dev->next_alloc_qpn, GFP_KERNEL); | |
| 1033 | 1033 | } | |
| 1034 | 1034 | ||
| 1035 | 1035 | if (ret < 0) { | |
| @@ -1089,7 +1089,7 @@ err_out_cmd: | |||
| 1089 | 1089 | else | |
| 1090 | 1090 | free_kernel_qp(qp); | |
| 1091 | 1091 | err_out_xa: | |
| 1092 | - | xa_erase_irq(&dev->qp_xa, QP_ID(qp)); | |
| 1092 | + | xa_erase(&dev->qp_xa, QP_ID(qp)); | |
| 1093 | 1093 | err_out: | |
| 1094 | 1094 | return ret; | |
| 1095 | 1095 | } | |
| @@ -1993,9 +1993,9 @@ int erdma_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr, | |||
| 1993 | 1993 | refcount_set(&cq->refcount, 1); | |
| 1994 | 1994 | init_completion(&cq->free); | |
| 1995 | 1995 | ||
| 1996 | - | ret = xa_alloc_cyclic_irq(&dev->cq_xa, &cq->cqn, cq, | |
| 1997 | - | XA_LIMIT(1, dev->attrs.max_cq - 1), | |
| 1998 | - | &dev->next_alloc_cqn, GFP_KERNEL); | |
| 1996 | + | ret = xa_alloc_cyclic(&dev->cq_xa, &cq->cqn, cq, | |
| 1997 | + | XA_LIMIT(1, dev->attrs.max_cq - 1), | |
| 1998 | + | &dev->next_alloc_cqn, GFP_KERNEL); | |
| 1999 | 1999 | if (ret < 0) | |
| 2000 | 2000 | return ret; | |
| 2001 | 2001 | ||
| @@ -2041,7 +2041,7 @@ err_free_res: | |||
| 2041 | 2041 | } | |
| 2042 | 2042 | ||
| 2043 | 2043 | err_out_xa: | |
| 2044 | - | xa_erase_irq(&dev->cq_xa, cq->cqn); | |
| 2044 | + | xa_erase(&dev->cq_xa, cq->cqn); | |
| 2045 | 2045 | ||
| 2046 | 2046 | return ret; | |
| 2047 | 2047 | } | |
modified drivers/infiniband/hw/hfi1/file_ops.c
| @@ -326,7 +326,6 @@ static int hfi1_file_mmap(struct file *fp, struct vm_area_struct *vma) | |||
| 326 | 326 | void *memvirt = NULL; | |
| 327 | 327 | dma_addr_t memdma = 0; | |
| 328 | 328 | u8 subctxt, mapio = 0, vmf = 0, type; | |
| 329 | - | size_t memdmalen = 0; | |
| 330 | 329 | ssize_t memlen = 0; | |
| 331 | 330 | int ret = 0; | |
| 332 | 331 | u16 ctxt; | |
| @@ -372,9 +371,7 @@ static int hfi1_file_mmap(struct file *fp, struct vm_area_struct *vma) | |||
| 372 | 371 | mapio = 1; | |
| 373 | 372 | break; | |
| 374 | 373 | case PIO_CRED: { | |
| 375 | - | struct credit_return_base *cr = &dd->cr_base[uctxt->sc->node]; | |
| 376 | 374 | u64 cr_page_offset; | |
| 377 | - | ||
| 378 | 375 | if (flags & VM_WRITE) { | |
| 379 | 376 | ret = -EPERM; | |
| 380 | 377 | goto done; | |
| @@ -384,18 +381,11 @@ static int hfi1_file_mmap(struct file *fp, struct vm_area_struct *vma) | |||
| 384 | 381 | * second or third page allocated for credit returns (if number | |
| 385 | 382 | * of enabled contexts > 64 and 128 respectively). | |
| 386 | 383 | */ | |
| 387 | - | cr_page_offset = ((u64)uctxt->sc->hw_free - (u64)cr->va) & | |
| 388 | - | PAGE_MASK; | |
| 389 | - | /* | |
| 390 | - | * dma_mmap_coherent() describes the whole coherent buffer and | |
| 391 | - | * selects the page within it with vma->vm_pgoff, so pass the | |
| 392 | - | * base of the allocation and its length and let vm_pgoff pick | |
| 393 | - | * the page. | |
| 394 | - | */ | |
| 395 | - | vma->vm_pgoff = cr_page_offset >> PAGE_SHIFT; | |
| 396 | - | memvirt = cr->va; | |
| 397 | - | memdma = cr->dma; | |
| 398 | - | memdmalen = TXE_NUM_CONTEXTS * sizeof(struct credit_return); | |
| 384 | + | cr_page_offset = ((u64)uctxt->sc->hw_free - | |
| 385 | + | (u64)dd->cr_base[uctxt->numa_id].va) & | |
| 386 | + | PAGE_MASK; | |
| 387 | + | memvirt = dd->cr_base[uctxt->numa_id].va + cr_page_offset; | |
| 388 | + | memdma = dd->cr_base[uctxt->numa_id].dma + cr_page_offset; | |
| 399 | 389 | memlen = PAGE_SIZE; | |
| 400 | 390 | flags &= ~VM_MAYWRITE; | |
| 401 | 391 | flags |= VM_DONTCOPY | VM_DONTEXPAND; | |
| @@ -577,8 +567,7 @@ static int hfi1_file_mmap(struct file *fp, struct vm_area_struct *vma) | |||
| 577 | 567 | ret = 0; | |
| 578 | 568 | } else if (memdma) { | |
| 579 | 569 | ret = dma_mmap_coherent(&dd->pcidev->dev, vma, | |
| 580 | - | memvirt, memdma, | |
| 581 | - | memdmalen ? memdmalen : memlen); | |
| 570 | + | memvirt, memdma, memlen); | |
| 582 | 571 | } else if (mapio) { | |
| 583 | 572 | ret = io_remap_pfn_range(vma, vma->vm_start, | |
| 584 | 573 | PFN_DOWN(memaddr), | |
modified drivers/infiniband/hw/irdma/verbs.c
| @@ -4281,7 +4281,7 @@ static int irdma_post_send(struct ib_qp *ibqp, | |||
| 4281 | 4281 | stag_info.total_len = iwmr->ibmr.length; | |
| 4282 | 4282 | stag_info.reg_addr_pa = *palloc->level1.addr; | |
| 4283 | 4283 | stag_info.first_pm_pbl_index = palloc->level1.idx; | |
| 4284 | - | stag_info.local_fence = true; | |
| 4284 | + | stag_info.local_fence = ib_wr->send_flags & IB_SEND_FENCE; | |
| 4285 | 4285 | if (iwmr->npages > IRDMA_MIN_PAGES_PER_FMR) | |
| 4286 | 4286 | stag_info.chunk_size = 1; | |
| 4287 | 4287 | err = irdma_sc_mr_fast_register(&iwqp->sc_qp, &stag_info, | |
modified drivers/infiniband/hw/mlx4/sysfs.c
| @@ -751,13 +751,11 @@ err_add: | |||
| 751 | 751 | kobject_put(p); | |
| 752 | 752 | } | |
| 753 | 753 | kobject_put(dev->dev_ports_parent[slave]); | |
| 754 | - | dev->dev_ports_parent[slave] = NULL; | |
| 755 | 754 | ||
| 756 | 755 | err_ports: | |
| 757 | 756 | kobject_put(dev->pkeys.device_parent[slave]); | |
| 758 | 757 | /* extra put for the device_parent create_and_add */ | |
| 759 | 758 | kobject_put(dev->pkeys.device_parent[slave]); | |
| 760 | - | dev->pkeys.device_parent[slave] = NULL; | |
| 761 | 759 | ||
| 762 | 760 | fail_dev: | |
| 763 | 761 | kobject_put(dev->iov_parent); | |
| @@ -787,8 +785,6 @@ static void unregister_pkey_tree(struct mlx4_ib_dev *device) | |||
| 787 | 785 | return; | |
| 788 | 786 | ||
| 789 | 787 | for (slave = device->dev->persist->num_vfs; slave >= 0; --slave) { | |
| 790 | - | if (!device->pkeys.device_parent[slave]) | |
| 791 | - | continue; | |
| 792 | 788 | list_for_each_entry_safe(p, t, | |
| 793 | 789 | &device->pkeys.pkey_port_list[slave], | |
| 794 | 790 | entry) { | |
modified drivers/infiniband/hw/mlx5/main.c
| @@ -1683,8 +1683,11 @@ static int mlx5_ib_query_port_speed_rep(struct mlx5_ib_dev *dev, u32 port_num, | |||
| 1683 | 1683 | struct mlx5_core_dev *mdev; | |
| 1684 | 1684 | u16 op_mod; | |
| 1685 | 1685 | ||
| 1686 | - | if (!dev->port[port_num - 1].rep) | |
| 1687 | - | return -ENODEV; | |
| 1686 | + | if (!dev->port[port_num - 1].rep) { | |
| 1687 | + | mlx5_ib_warn(dev, "Representor doesn't exist for port %u\n", | |
| 1688 | + | port_num); | |
| 1689 | + | return -EINVAL; | |
| 1690 | + | } | |
| 1688 | 1691 | ||
| 1689 | 1692 | rep = dev->port[port_num - 1].rep; | |
| 1690 | 1693 | mdev = mlx5_eswitch_get_core_dev(rep->esw); | |
modified drivers/infiniband/sw/rxe/rxe_mcast.c
| @@ -175,9 +175,7 @@ struct rxe_mcg *rxe_lookup_mcg(struct rxe_dev *rxe, union ib_gid *mgid) | |||
| 175 | 175 | * @mgid: multicast address as a gid | |
| 176 | 176 | * @mcg: new mcg object | |
| 177 | 177 | * | |
| 178 | - | * Initializes the mcg fields. The mcg is private and not yet visible in | |
| 179 | - | * mcg_tree, so this may run without rxe->mcg_lock; __rxe_publish_mcg() | |
| 180 | - | * makes it visible under the lock once it is ready. | |
| 178 | + | * Context: caller should hold rxe->mcg lock | |
| 181 | 179 | */ | |
| 182 | 180 | static void __rxe_init_mcg(struct rxe_dev *rxe, union ib_gid *mgid, | |
| 183 | 181 | struct rxe_mcg *mcg) | |
| @@ -186,22 +184,13 @@ static void __rxe_init_mcg(struct rxe_dev *rxe, union ib_gid *mgid, | |||
| 186 | 184 | memcpy(&mcg->mgid, mgid, sizeof(mcg->mgid)); | |
| 187 | 185 | INIT_LIST_HEAD(&mcg->qp_list); | |
| 188 | 186 | mcg->rxe = rxe; | |
| 189 | - | } | |
| 190 | 187 | ||
| 191 | - | /** | |
| 192 | - | * __rxe_publish_mcg - make a fully initialized mcg visible in mcg_tree | |
| 193 | - | * @mcg: the mcg object | |
| 194 | - | * | |
| 195 | - | * Context: caller must hold rxe->mcg_lock and a reference on mcg | |
| 196 | - | */ | |
| 197 | - | static void __rxe_publish_mcg(struct rxe_mcg *mcg) | |
| 198 | - | { | |
| 199 | - | /* caller holds a ref on mcg but that will be dropped when mcg goes | |
| 200 | - | * out of scope. We need to take a ref on the pointer that will be | |
| 201 | - | * saved in the red-black tree by __rxe_insert_mcg and used to lookup | |
| 202 | - | * mcg from mgid later. Inserting mcg makes it visible to outside so | |
| 203 | - | * this is done last after the object is ready and the multicast | |
| 204 | - | * address has been programmed. | |
| 188 | + | /* caller holds a ref on mcg but that will be | |
| 189 | + | * dropped when mcg goes out of scope. We need to take a ref | |
| 190 | + | * on the pointer that will be saved in the red-black tree | |
| 191 | + | * by __rxe_insert_mcg and used to lookup mcg from mgid later. | |
| 192 | + | * Inserting mcg makes it visible to outside so this should | |
| 193 | + | * be done last after the object is ready. | |
| 205 | 194 | */ | |
| 206 | 195 | kref_get(&mcg->ref_cnt); | |
| 207 | 196 | __rxe_insert_mcg(mcg); | |
| @@ -239,37 +228,26 @@ static struct rxe_mcg *rxe_get_mcg(struct rxe_dev *rxe, union ib_gid *mgid) | |||
| 239 | 228 | err = -ENOMEM; | |
| 240 | 229 | goto err_dec; | |
| 241 | 230 | } | |
| 242 | - | __rxe_init_mcg(rxe, mgid, mcg); | |
| 243 | - | ||
| 244 | - | /* program the multicast address while mcg is still private, before | |
| 245 | - | * it is inserted into mcg_tree. dev_mc_add() may sleep so this must | |
| 246 | - | * run outside mcg_lock. On failure mcg was never published, so a | |
| 247 | - | * plain free is correct and the tree is untouched. | |
| 248 | - | */ | |
| 249 | - | err = rxe_mcast_add(rxe, mgid); | |
| 250 | - | if (err) { | |
| 251 | - | kfree(mcg); | |
| 252 | - | goto err_dec; | |
| 253 | - | } | |
| 254 | 231 | ||
| 255 | 232 | spin_lock_bh(&rxe->mcg_lock); | |
| 256 | - | /* re-check to see if someone else just added it while we were adding | |
| 257 | - | * the multicast address; if so use theirs and drop ours | |
| 258 | - | */ | |
| 233 | + | /* re-check to see if someone else just added it */ | |
| 259 | 234 | tmp = __rxe_lookup_mcg(rxe, mgid); | |
| 260 | 235 | if (tmp) { | |
| 261 | 236 | spin_unlock_bh(&rxe->mcg_lock); | |
| 262 | - | rxe_mcast_del(rxe, mgid); | |
| 263 | 237 | atomic_dec(&rxe->mcg_num); | |
| 264 | 238 | kfree(mcg); | |
| 265 | 239 | return tmp; | |
| 266 | 240 | } | |
| 267 | 241 | ||
| 268 | - | __rxe_publish_mcg(mcg); | |
| 242 | + | __rxe_init_mcg(rxe, mgid, mcg); | |
| 269 | 243 | spin_unlock_bh(&rxe->mcg_lock); | |
| 270 | 244 | ||
| 271 | - | return mcg; | |
| 245 | + | /* add mcast address outside of lock */ | |
| 246 | + | err = rxe_mcast_add(rxe, mgid); | |
| 247 | + | if (!err) | |
| 248 | + | return mcg; | |
| 272 | 249 | ||
| 250 | + | kfree(mcg); | |
| 273 | 251 | err_dec: | |
| 274 | 252 | atomic_dec(&rxe->mcg_num); | |
| 275 | 253 | return ERR_PTR(err); | |
modified drivers/infiniband/sw/rxe/rxe_mr.c
| @@ -33,8 +33,7 @@ int mr_check_range(struct rxe_mr *mr, u64 iova, size_t length) | |||
| 33 | 33 | case IB_MR_TYPE_USER: | |
| 34 | 34 | case IB_MR_TYPE_MEM_REG: | |
| 35 | 35 | if (iova < mr->ibmr.iova || | |
| 36 | - | length > mr->ibmr.length || | |
| 37 | - | iova - mr->ibmr.iova > mr->ibmr.length - length) { | |
| 36 | + | iova + length > mr->ibmr.iova + mr->ibmr.length) { | |
| 38 | 37 | rxe_dbg_mr(mr, "iova/length out of range\n"); | |
| 39 | 38 | return -EINVAL; | |
| 40 | 39 | } | |
modified drivers/infiniband/sw/rxe/rxe_odp.c
| @@ -120,23 +120,19 @@ int rxe_odp_mr_init_user(struct rxe_dev *rxe, u64 start, u64 length, | |||
| 120 | 120 | } | |
| 121 | 121 | ||
| 122 | 122 | static inline bool rxe_check_pagefault(struct ib_umem_odp *umem_odp, u64 iova, | |
| 123 | - | int length, bool write) | |
| 123 | + | int length) | |
| 124 | 124 | { | |
| 125 | 125 | bool need_fault = false; | |
| 126 | - | u64 access = HMM_PFN_VALID; | |
| 127 | 126 | u64 addr; | |
| 128 | 127 | int idx; | |
| 129 | 128 | ||
| 130 | - | if (write) | |
| 131 | - | access |= HMM_PFN_WRITE; | |
| 132 | - | ||
| 133 | 129 | addr = iova & (~(BIT(umem_odp->page_shift) - 1)); | |
| 134 | 130 | ||
| 135 | 131 | /* Skim through all pages that are to be accessed. */ | |
| 136 | 132 | while (addr < iova + length) { | |
| 137 | 133 | idx = (addr - ib_umem_start(umem_odp)) >> umem_odp->page_shift; | |
| 138 | 134 | ||
| 139 | - | if ((umem_odp->map.pfn_list[idx] & access) != access) { | |
| 135 | + | if (!(umem_odp->map.pfn_list[idx] & HMM_PFN_VALID)) { | |
| 140 | 136 | need_fault = true; | |
| 141 | 137 | break; | |
| 142 | 138 | } | |
| @@ -159,7 +155,6 @@ static unsigned long rxe_odp_iova_to_page_offset(struct ib_umem_odp *umem_odp, u | |||
| 159 | 155 | static int rxe_odp_map_range_and_lock(struct rxe_mr *mr, u64 iova, int length, u32 flags) | |
| 160 | 156 | { | |
| 161 | 157 | struct ib_umem_odp *umem_odp = to_ib_umem_odp(mr->umem); | |
| 162 | - | bool write = !(flags & RXE_PAGEFAULT_RDONLY); | |
| 163 | 158 | bool need_fault; | |
| 164 | 159 | int err; | |
| 165 | 160 | ||
| @@ -168,7 +163,7 @@ static int rxe_odp_map_range_and_lock(struct rxe_mr *mr, u64 iova, int length, u | |||
| 168 | 163 | ||
| 169 | 164 | mutex_lock(&umem_odp->umem_mutex); | |
| 170 | 165 | ||
| 171 | - | need_fault = rxe_check_pagefault(umem_odp, iova, length, write); | |
| 166 | + | need_fault = rxe_check_pagefault(umem_odp, iova, length); | |
| 172 | 167 | if (need_fault) { | |
| 173 | 168 | mutex_unlock(&umem_odp->umem_mutex); | |
| 174 | 169 | ||
| @@ -178,7 +173,7 @@ static int rxe_odp_map_range_and_lock(struct rxe_mr *mr, u64 iova, int length, u | |||
| 178 | 173 | if (err < 0) | |
| 179 | 174 | return err; | |
| 180 | 175 | ||
| 181 | - | need_fault = rxe_check_pagefault(umem_odp, iova, length, write); | |
| 176 | + | need_fault = rxe_check_pagefault(umem_odp, iova, length); | |
| 182 | 177 | if (need_fault) { | |
| 183 | 178 | mutex_unlock(&umem_odp->umem_mutex); | |
| 184 | 179 | return -EFAULT; | |
| @@ -340,9 +335,8 @@ int rxe_odp_flush_pmem_iova(struct rxe_mr *mr, u64 iova, | |||
| 340 | 335 | int err; | |
| 341 | 336 | u8 *va; | |
| 342 | 337 | ||
| 343 | - | /* A flush never modifies memory; read-only access suffices. */ | |
| 344 | 338 | err = rxe_odp_map_range_and_lock(mr, iova, length, | |
| 345 | - | RXE_PAGEFAULT_RDONLY); | |
| 339 | + | RXE_PAGEFAULT_DEFAULT); | |
| 346 | 340 | if (err) | |
| 347 | 341 | return err; | |
| 348 | 342 | ||
modified drivers/infiniband/sw/rxe/rxe_verbs.c
| @@ -1331,20 +1331,19 @@ static struct ib_mr *rxe_rereg_user_mr(struct ib_mr *ibmr, int flags, | |||
| 1331 | 1331 | if (err) | |
| 1332 | 1332 | return ERR_PTR(err); | |
| 1333 | 1333 | ||
| 1334 | - | if ((flags & IB_MR_REREG_ACCESS) && | |
| 1335 | - | (access & ~RXE_ACCESS_SUPPORTED_MR)) { | |
| 1336 | - | rxe_err_mr(mr, "access = %#x not supported\n", access); | |
| 1337 | - | return ERR_PTR(-EOPNOTSUPP); | |
| 1338 | - | } | |
| 1339 | - | ||
| 1340 | 1334 | if (flags & IB_MR_REREG_PD) { | |
| 1341 | 1335 | rxe_put(old_pd); | |
| 1342 | 1336 | rxe_get(pd); | |
| 1343 | 1337 | mr->ibmr.pd = ibpd; | |
| 1344 | 1338 | } | |
| 1345 | 1339 | ||
| 1346 | - | if (flags & IB_MR_REREG_ACCESS) | |
| 1340 | + | if (flags & IB_MR_REREG_ACCESS) { | |
| 1341 | + | if (access & ~RXE_ACCESS_SUPPORTED_MR) { | |
| 1342 | + | rxe_err_mr(mr, "access = %#x not supported\n", access); | |
| 1343 | + | return ERR_PTR(-EOPNOTSUPP); | |
| 1344 | + | } | |
| 1347 | 1345 | mr->access = access; | |
| 1346 | + | } | |
| 1348 | 1347 | ||
| 1349 | 1348 | return NULL; | |
| 1350 | 1349 | } | |
modified drivers/infiniband/sw/siw/siw_cm.c
| @@ -1719,12 +1719,9 @@ int siw_accept(struct iw_cm_id *id, struct iw_cm_conn_param *params) | |||
| 1719 | 1719 | SIW_QP_ATTR_STATE | SIW_QP_ATTR_LLP_HANDLE | | |
| 1720 | 1720 | SIW_QP_ATTR_ORD | SIW_QP_ATTR_IRD | | |
| 1721 | 1721 | SIW_QP_ATTR_MPA); | |
| 1722 | - | if (rv) { | |
| 1723 | - | qp->cep = NULL; | |
| 1724 | - | siw_cep_put(cep); | |
| 1725 | - | goto error_unlock; | |
| 1726 | - | } | |
| 1727 | 1722 | up_write(&qp->state_lock); | |
| 1723 | + | if (rv) | |
| 1724 | + | goto error; | |
| 1728 | 1725 | ||
| 1729 | 1726 | siw_dbg_cep(cep, "[QP %u]: send mpa reply, %d byte pdata\n", | |
| 1730 | 1727 | qp_id(qp), params->private_data_len); | |
modified drivers/infiniband/sw/siw/siw_qp_rx.c
| @@ -1079,7 +1079,7 @@ static int siw_get_hdr(struct siw_rx_stream *srx) | |||
| 1079 | 1079 | if (iwarp_pktinfo[opcode].hdr_len > sizeof(struct iwarp_ctrl_tagged)) { | |
| 1080 | 1080 | int hdrlen = iwarp_pktinfo[opcode].hdr_len; | |
| 1081 | 1081 | ||
| 1082 | - | bytes = min_t(int, hdrlen - srx->fpdu_part_rcvd, srx->skb_new); | |
| 1082 | + | bytes = min_t(int, hdrlen - MIN_DDP_HDR, srx->skb_new); | |
| 1083 | 1083 | ||
| 1084 | 1084 | skb_copy_bits(skb, srx->skb_offset, | |
| 1085 | 1085 | (char *)c_hdr + srx->fpdu_part_rcvd, bytes); | |
modified drivers/infiniband/ulp/ipoib/ipoib.h
| @@ -87,7 +87,6 @@ enum { | |||
| 87 | 87 | IPOIB_FLAG_INITIALIZED = 1, | |
| 88 | 88 | IPOIB_FLAG_ADMIN_UP = 2, | |
| 89 | 89 | IPOIB_PKEY_ASSIGNED = 3, | |
| 90 | - | IPOIB_FLAG_MCAST_FLUSH = 4, | |
| 91 | 90 | IPOIB_FLAG_SUBINTERFACE = 5, | |
| 92 | 91 | IPOIB_STOP_REAPER = 7, | |
| 93 | 92 | IPOIB_FLAG_ADMIN_CM = 9, | |
| @@ -415,12 +414,6 @@ struct ipoib_dev_priv { | |||
| 415 | 414 | const struct net_device_ops *rn_ops; | |
| 416 | 415 | }; | |
| 417 | 416 | ||
| 418 | - | static inline bool ipoib_mcast_allowed(struct ipoib_dev_priv *priv) | |
| 419 | - | { | |
| 420 | - | return test_bit(IPOIB_FLAG_OPER_UP, &priv->flags) && | |
| 421 | - | !test_bit(IPOIB_FLAG_MCAST_FLUSH, &priv->flags); | |
| 422 | - | } | |
| 423 | - | ||
| 424 | 417 | struct ipoib_ah { | |
| 425 | 418 | struct net_device *dev; | |
| 426 | 419 | struct ib_ah *ah; | |
modified drivers/infiniband/ulp/ipoib/ipoib_ib.c
| @@ -1227,19 +1227,17 @@ static void __ipoib_ib_dev_flush(struct ipoib_dev_priv *priv, | |||
| 1227 | 1227 | } | |
| 1228 | 1228 | ||
| 1229 | 1229 | if (level == IPOIB_FLUSH_LIGHT) { | |
| 1230 | + | int oper_up; | |
| 1230 | 1231 | ipoib_mark_paths_invalid(dev); | |
| 1231 | - | /* Set MCAST_FLUSH to prevent races between: | |
| 1232 | + | /* Set IPoIB operation as down to prevent races between: | |
| 1232 | 1233 | * the flush flow which leaves MCG and on the fly joins | |
| 1233 | 1234 | * which can happen during that time. mcast restart task | |
| 1234 | 1235 | * should deal with join requests we missed. | |
| 1235 | - | * | |
| 1236 | - | * Do not clear OPER_UP for this; restoring it races with | |
| 1237 | - | * ipoib_ib_dev_down() and can leave OPER_UP set after the | |
| 1238 | - | * device is down. | |
| 1239 | 1236 | */ | |
| 1240 | - | set_bit(IPOIB_FLAG_MCAST_FLUSH, &priv->flags); | |
| 1237 | + | oper_up = test_and_clear_bit(IPOIB_FLAG_OPER_UP, &priv->flags); | |
| 1241 | 1238 | ipoib_mcast_dev_flush(dev); | |
| 1242 | - | clear_bit(IPOIB_FLAG_MCAST_FLUSH, &priv->flags); | |
| 1239 | + | if (oper_up) | |
| 1240 | + | set_bit(IPOIB_FLAG_OPER_UP, &priv->flags); | |
| 1243 | 1241 | ipoib_reap_dead_ahs(priv); | |
| 1244 | 1242 | } | |
| 1245 | 1243 | ||
modified drivers/infiniband/ulp/ipoib/ipoib_multicast.c
| @@ -74,7 +74,7 @@ static void __ipoib_mcast_schedule_join_thread(struct ipoib_dev_priv *priv, | |||
| 74 | 74 | struct ipoib_mcast *mcast, | |
| 75 | 75 | bool delay) | |
| 76 | 76 | { | |
| 77 | - | if (!ipoib_mcast_allowed(priv)) | |
| 77 | + | if (!test_bit(IPOIB_FLAG_OPER_UP, &priv->flags)) | |
| 78 | 78 | return; | |
| 79 | 79 | ||
| 80 | 80 | /* | |
| @@ -469,7 +469,7 @@ static int ipoib_mcast_join(struct net_device *dev, struct ipoib_mcast *mcast) | |||
| 469 | 469 | int ret = 0; | |
| 470 | 470 | ||
| 471 | 471 | if (!priv->broadcast || | |
| 472 | - | !ipoib_mcast_allowed(priv)) | |
| 472 | + | !test_bit(IPOIB_FLAG_OPER_UP, &priv->flags)) | |
| 473 | 473 | return -EINVAL; | |
| 474 | 474 | ||
| 475 | 475 | init_completion(&mcast->done); | |
| @@ -555,7 +555,7 @@ void ipoib_mcast_join_task(struct work_struct *work) | |||
| 555 | 555 | unsigned long delay_until = 0; | |
| 556 | 556 | struct ipoib_mcast *mcast = NULL; | |
| 557 | 557 | ||
| 558 | - | if (!ipoib_mcast_allowed(priv)) | |
| 558 | + | if (!test_bit(IPOIB_FLAG_OPER_UP, &priv->flags)) | |
| 559 | 559 | return; | |
| 560 | 560 | ||
| 561 | 561 | if (ib_query_port(priv->ca, priv->port, &port_attr)) { | |
| @@ -577,7 +577,7 @@ void ipoib_mcast_join_task(struct work_struct *work) | |||
| 577 | 577 | netif_addr_unlock_bh(dev); | |
| 578 | 578 | ||
| 579 | 579 | spin_lock_irq(&priv->lock); | |
| 580 | - | if (!ipoib_mcast_allowed(priv)) | |
| 580 | + | if (!test_bit(IPOIB_FLAG_OPER_UP, &priv->flags)) | |
| 581 | 581 | goto out; | |
| 582 | 582 | ||
| 583 | 583 | if (!priv->broadcast) { | |
| @@ -749,7 +749,7 @@ void ipoib_mcast_send(struct net_device *dev, u8 *daddr, struct sk_buff *skb) | |||
| 749 | 749 | ||
| 750 | 750 | spin_lock_irqsave(&priv->lock, flags); | |
| 751 | 751 | ||
| 752 | - | if (!ipoib_mcast_allowed(priv) || | |
| 752 | + | if (!test_bit(IPOIB_FLAG_OPER_UP, &priv->flags) || | |
| 753 | 753 | !priv->broadcast || | |
| 754 | 754 | !test_bit(IPOIB_MCAST_FLAG_ATTACHED, &priv->broadcast->flags)) { | |
| 755 | 755 | ++dev->stats.tx_dropped; | |
| @@ -871,7 +871,7 @@ void ipoib_mcast_restart_task(struct work_struct *work) | |||
| 871 | 871 | LIST_HEAD(remove_list); | |
| 872 | 872 | struct ib_sa_mcmember_rec rec; | |
| 873 | 873 | ||
| 874 | - | if (!ipoib_mcast_allowed(priv)) | |
| 874 | + | if (!test_bit(IPOIB_FLAG_OPER_UP, &priv->flags)) | |
| 875 | 875 | /* | |
| 876 | 876 | * shortcut...on shutdown flush is called next, just | |
| 877 | 877 | * let it do all the work | |
| @@ -965,9 +965,9 @@ void ipoib_mcast_restart_task(struct work_struct *work) | |||
| 965 | 965 | ipoib_mcast_remove_list(&remove_list); | |
| 966 | 966 | ||
| 967 | 967 | /* | |
| 968 | - | * Double check that we are still up and not flushing | |
| 968 | + | * Double check that we are still up | |
| 969 | 969 | */ | |
| 970 | - | if (ipoib_mcast_allowed(priv)) { | |
| 970 | + | if (test_bit(IPOIB_FLAG_OPER_UP, &priv->flags)) { | |
| 971 | 971 | spin_lock_irq(&priv->lock); | |
| 972 | 972 | __ipoib_mcast_schedule_join_thread(priv, NULL, 0); | |
| 973 | 973 | spin_unlock_irq(&priv->lock); | |
modified drivers/infiniband/ulp/iser/iser_initiator.c
| @@ -598,8 +598,11 @@ static int iser_check_remote_inv(struct iser_conn *iser_conn, struct ib_wc *wc, | |||
| 598 | 598 | iser_dbg("conn %p: remote invalidation for rkey %#x\n", | |
| 599 | 599 | iser_conn, rkey); | |
| 600 | 600 | ||
| 601 | - | if (unlikely(!iser_conn->snd_w_inv)) | |
| 602 | - | goto bad_inv; | |
| 601 | + | if (unlikely(!iser_conn->snd_w_inv)) { | |
| 602 | + | iser_err("conn %p: unexpected remote invalidation, terminating connection\n", | |
| 603 | + | iser_conn); | |
| 604 | + | return -EPROTO; | |
| 605 | + | } | |
| 603 | 606 | ||
| 604 | 607 | task = iscsi_itt_to_ctask(iser_conn->iscsi_conn, hdr->itt); | |
| 605 | 608 | if (likely(task)) { | |
| @@ -608,16 +611,12 @@ static int iser_check_remote_inv(struct iser_conn *iser_conn, struct ib_wc *wc, | |||
| 608 | 611 | ||
| 609 | 612 | if (iser_task->dir[ISER_DIR_IN]) { | |
| 610 | 613 | desc = iser_task->rdma_reg[ISER_DIR_IN].desc; | |
| 611 | - | if (unlikely(!desc)) | |
| 612 | - | goto bad_inv; | |
| 613 | 614 | if (unlikely(iser_inv_desc(desc, rkey))) | |
| 614 | 615 | return -EINVAL; | |
| 615 | 616 | } | |
| 616 | 617 | ||
| 617 | 618 | if (iser_task->dir[ISER_DIR_OUT]) { | |
| 618 | 619 | desc = iser_task->rdma_reg[ISER_DIR_OUT].desc; | |
| 619 | - | if (unlikely(!desc)) | |
| 620 | - | goto bad_inv; | |
| 621 | 620 | if (unlikely(iser_inv_desc(desc, rkey))) | |
| 622 | 621 | return -EINVAL; | |
| 623 | 622 | } | |
| @@ -628,11 +627,6 @@ static int iser_check_remote_inv(struct iser_conn *iser_conn, struct ib_wc *wc, | |||
| 628 | 627 | } | |
| 629 | 628 | ||
| 630 | 629 | return 0; | |
| 631 | - | ||
| 632 | - | bad_inv: | |
| 633 | - | iser_err("conn %p: unexpected remote invalidation, terminating connection\n", | |
| 634 | - | iser_conn); | |
| 635 | - | return -EPROTO; | |
| 636 | 630 | } | |
| 637 | 631 | ||
| 638 | 632 | ||
modified drivers/infiniband/ulp/isert/ib_isert.c
| @@ -21,7 +21,6 @@ | |||
| 21 | 21 | #include <target/target_core_fabric.h> | |
| 22 | 22 | #include <target/iscsi/iscsi_transport.h> | |
| 23 | 23 | #include <linux/semaphore.h> | |
| 24 | - | #include <linux/wait_bit.h> | |
| 25 | 24 | ||
| 26 | 25 | #include "ib_isert.h" | |
| 27 | 26 | ||
| @@ -311,7 +310,6 @@ isert_init_conn(struct isert_conn *isert_conn) | |||
| 311 | 310 | init_completion(&isert_conn->login_req_comp); | |
| 312 | 311 | init_waitqueue_head(&isert_conn->rem_wait); | |
| 313 | 312 | kref_init(&isert_conn->kref); | |
| 314 | - | atomic_set(&isert_conn->ctrl_comp_cnt, 0); | |
| 315 | 313 | mutex_init(&isert_conn->mutex); | |
| 316 | 314 | INIT_WORK(&isert_conn->release_work, isert_release_work); | |
| 317 | 315 | } | |
| @@ -1696,8 +1694,6 @@ isert_do_control_comp(struct work_struct *work) | |||
| 1696 | 1694 | struct isert_conn *isert_conn = isert_cmd->conn; | |
| 1697 | 1695 | struct ib_device *ib_dev = isert_conn->cm_id->device; | |
| 1698 | 1696 | struct iscsit_cmd *cmd = isert_cmd->iscsit_cmd; | |
| 1699 | - | /* The switch below may free isert_cmd. */ | |
| 1700 | - | bool counted = isert_cmd->ctrl_counted; | |
| 1701 | 1697 | ||
| 1702 | 1698 | isert_dbg("Cmd %p i_state %d\n", isert_cmd, cmd->i_state); | |
| 1703 | 1699 | ||
| @@ -1719,14 +1715,6 @@ isert_do_control_comp(struct work_struct *work) | |||
| 1719 | 1715 | dump_stack(); | |
| 1720 | 1716 | break; | |
| 1721 | 1717 | } | |
| 1722 | - | ||
| 1723 | - | /* | |
| 1724 | - | * The count is what keeps isert_conn alive, so drop it last. The wait | |
| 1725 | - | * queue lives in the global hash table, not in isert_conn, so this is | |
| 1726 | - | * safe even if the waiter has already freed the connection. | |
| 1727 | - | */ | |
| 1728 | - | if (counted && atomic_dec_and_test(&isert_conn->ctrl_comp_cnt)) | |
| 1729 | - | wake_up_var(&isert_conn->ctrl_comp_cnt); | |
| 1730 | 1718 | } | |
| 1731 | 1719 | ||
| 1732 | 1720 | static void | |
| @@ -1770,12 +1758,6 @@ isert_send_done(struct ib_cq *cq, struct ib_wc *wc) | |||
| 1770 | 1758 | case ISTATE_SEND_TEXTRSP: | |
| 1771 | 1759 | isert_unmap_tx_desc(tx_desc, ib_dev); | |
| 1772 | 1760 | ||
| 1773 | - | /* Paired with the wait in isert_wait_conn(). */ | |
| 1774 | - | isert_cmd->ctrl_counted = | |
| 1775 | - | isert_cmd->iscsit_cmd->i_state != ISTATE_SEND_LOGOUTRSP; | |
| 1776 | - | if (isert_cmd->ctrl_counted) | |
| 1777 | - | atomic_inc(&isert_conn->ctrl_comp_cnt); | |
| 1778 | - | ||
| 1779 | 1761 | INIT_WORK(&isert_cmd->comp_work, isert_do_control_comp); | |
| 1780 | 1762 | queue_work(isert_comp_wq, &isert_cmd->comp_work); | |
| 1781 | 1763 | return; | |
| @@ -2620,10 +2602,6 @@ static void isert_wait_conn(struct iscsit_conn *conn) | |||
| 2620 | 2602 | isert_wait4cmds(conn); | |
| 2621 | 2603 | isert_wait4logout(isert_conn); | |
| 2622 | 2604 | ||
| 2623 | - | /* Paired with the count taken in isert_send_done(). */ | |
| 2624 | - | wait_var_event(&isert_conn->ctrl_comp_cnt, | |
| 2625 | - | !atomic_read(&isert_conn->ctrl_comp_cnt)); | |
| 2626 | - | ||
| 2627 | 2605 | queue_work(isert_release_wq, &isert_conn->release_work); | |
| 2628 | 2606 | } | |
| 2629 | 2607 | ||
modified drivers/infiniband/ulp/isert/ib_isert.h
| @@ -153,7 +153,6 @@ struct isert_cmd { | |||
| 153 | 153 | struct work_struct comp_work; | |
| 154 | 154 | struct scatterlist sg; | |
| 155 | 155 | bool ctx_init_done; | |
| 156 | - | bool ctrl_counted; | |
| 157 | 156 | }; | |
| 158 | 157 | ||
| 159 | 158 | static inline struct isert_cmd *tx_desc_to_cmd(struct iser_tx_desc *desc) | |
| @@ -188,7 +187,6 @@ struct isert_conn { | |||
| 188 | 187 | struct mutex mutex; | |
| 189 | 188 | struct kref kref; | |
| 190 | 189 | struct work_struct release_work; | |
| 191 | - | atomic_t ctrl_comp_cnt; | |
| 192 | 190 | bool logout_posted; | |
| 193 | 191 | bool snd_w_inv; | |
| 194 | 192 | wait_queue_head_t rem_wait; | |
modified drivers/infiniband/ulp/rtrs/rtrs-clt-trace.h
| @@ -55,7 +55,7 @@ DECLARE_EVENT_CLASS(rtrs_clt_conn_class, | |||
| 55 | 55 | __entry->max_reconnect_attempts = clt->max_reconnect_attempts; | |
| 56 | 56 | __entry->fail_cnt = clt_path->stats->reconnects.fail_cnt; | |
| 57 | 57 | __entry->success_cnt = clt_path->stats->reconnects.successful_cnt; | |
| 58 | - | strscpy(__entry->sessname, kobject_name(&clt_path->kobj) ?: "", NAME_MAX); | |
| 58 | + | memcpy(__entry->sessname, kobject_name(&clt_path->kobj), NAME_MAX); | |
| 59 | 59 | ), | |
| 60 | 60 | ||
| 61 | 61 | TP_printk("RTRS-CLT: sess='%s' state=%s attempts='%d' max-attempts='%d' fail='%d' success='%d'", | |
modified drivers/infiniband/ulp/rtrs/rtrs-clt.c
| @@ -1732,8 +1732,6 @@ static void destroy_con_cq_qp(struct rtrs_clt_con *con) | |||
| 1732 | 1732 | /* | |
| 1733 | 1733 | * Be careful here: destroy_con_cq_qp() can be called even | |
| 1734 | 1734 | * create_con_cq_qp() failed, see comments there. | |
| 1735 | - | * Caller must set con->destroyed under this lock first so a | |
| 1736 | - | * racing ADDR_RESOLVED cannot ib_cq_pool_get() after we PUT/SKIP. | |
| 1737 | 1735 | */ | |
| 1738 | 1736 | lockdep_assert_held(&con->con_mutex); | |
| 1739 | 1737 | rtrs_cq_qp_destroy(&con->c); | |
| @@ -1768,10 +1766,6 @@ static int rtrs_rdma_addr_resolved(struct rtrs_clt_con *con) | |||
| 1768 | 1766 | int err; | |
| 1769 | 1767 | ||
| 1770 | 1768 | mutex_lock(&con->con_mutex); | |
| 1771 | - | if (con->destroyed) { | |
| 1772 | - | mutex_unlock(&con->con_mutex); | |
| 1773 | - | return -ECONNABORTED; | |
| 1774 | - | } | |
| 1775 | 1769 | err = create_con_cq_qp(con); | |
| 1776 | 1770 | mutex_unlock(&con->con_mutex); | |
| 1777 | 1771 | if (err) { | |
| @@ -2227,7 +2221,6 @@ static void rtrs_clt_stop_and_destroy_conns(struct rtrs_clt_path *clt_path) | |||
| 2227 | 2221 | break; | |
| 2228 | 2222 | con = to_clt_con(clt_path->s.con[cid]); | |
| 2229 | 2223 | mutex_lock(&con->con_mutex); | |
| 2230 | - | con->destroyed = true; | |
| 2231 | 2224 | destroy_con_cq_qp(con); | |
| 2232 | 2225 | mutex_unlock(&con->con_mutex); | |
| 2233 | 2226 | destroy_cm(con); | |
| @@ -2394,7 +2387,6 @@ destroy: | |||
| 2394 | 2387 | if (con->c.cm_id) { | |
| 2395 | 2388 | stop_cm(con); | |
| 2396 | 2389 | mutex_lock(&con->con_mutex); | |
| 2397 | - | con->destroyed = true; | |
| 2398 | 2390 | destroy_con_cq_qp(con); | |
| 2399 | 2391 | mutex_unlock(&con->con_mutex); | |
| 2400 | 2392 | destroy_cm(con); | |
modified drivers/infiniband/ulp/rtrs/rtrs-clt.h
| @@ -75,8 +75,6 @@ struct rtrs_clt_con { | |||
| 75 | 75 | unsigned int cpu; | |
| 76 | 76 | struct mutex con_mutex; | |
| 77 | 77 | int cm_err; | |
| 78 | - | /* Set under con_mutex before CQ/QP teardown. */ | |
| 79 | - | bool destroyed; | |
| 80 | 78 | }; | |
| 81 | 79 | ||
| 82 | 80 | /** | |
modified drivers/infiniband/ulp/rtrs/rtrs-srv-trace.h
| @@ -61,7 +61,7 @@ TRACE_EVENT(send_io_resp_imm, | |||
| 61 | 61 | __entry->msg_id = id->msg_id; | |
| 62 | 62 | __entry->wr_cnt = atomic_read(&con->c.wr_cnt); | |
| 63 | 63 | __entry->signal_interval = s->signal_interval; | |
| 64 | - | strscpy(__entry->sessname, kobject_name(&srv_path->kobj) ?: "", NAME_MAX); | |
| 64 | + | memcpy(__entry->sessname, kobject_name(&srv_path->kobj), NAME_MAX); | |
| 65 | 65 | ), | |
| 66 | 66 | ||
| 67 | 67 | TP_printk("sess='%s' state='%s' dir=%s err='%d' inval='%d' glob-inval='%d' msgid='%u' wrcnt='%d' sig-interval='%u'", | |
modified drivers/infiniband/ulp/srp/ib_srp.c
| @@ -1038,20 +1038,15 @@ static void srp_del_scsi_host_attr(struct Scsi_Host *shost) | |||
| 1038 | 1038 | ||
| 1039 | 1039 | static void srp_remove_target(struct srp_target_port *target) | |
| 1040 | 1040 | { | |
| 1041 | - | struct scsi_device *sdev; | |
| 1042 | 1041 | struct srp_rdma_ch *ch; | |
| 1043 | 1042 | int i; | |
| 1044 | 1043 | ||
| 1045 | 1044 | WARN_ON_ONCE(target->state != SRP_TARGET_REMOVED); | |
| 1046 | 1045 | ||
| 1047 | 1046 | srp_del_scsi_host_attr(target->scsi_host); | |
| 1048 | - | /* | |
| 1049 | - | * Remove all logical units. This must happen before the | |
| 1050 | - | * srp_disconnect_target() call because scsi_remove_device() may trigger | |
| 1051 | - | * submission of SCSI commands. See also sd_shutdown(). | |
| 1052 | - | */ | |
| 1053 | - | shost_for_each_device(sdev, target->scsi_host) | |
| 1054 | - | scsi_remove_device(sdev); | |
| 1047 | + | srp_rport_get(target->rport); | |
| 1048 | + | srp_remove_host(target->scsi_host); | |
| 1049 | + | scsi_remove_host(target->scsi_host); | |
| 1055 | 1050 | srp_stop_rport_timers(target->rport); | |
| 1056 | 1051 | srp_disconnect_target(target); | |
| 1057 | 1052 | kobj_ns_drop(KOBJ_NS_TYPE_NET, to_ns_common(target->net)); | |
| @@ -1060,8 +1055,7 @@ static void srp_remove_target(struct srp_target_port *target) | |||
| 1060 | 1055 | srp_free_ch_ib(target, ch); | |
| 1061 | 1056 | } | |
| 1062 | 1057 | cancel_work_sync(&target->tl_err_work); | |
| 1063 | - | srp_remove_host(target->scsi_host); | |
| 1064 | - | scsi_remove_host(target->scsi_host); | |
| 1058 | + | srp_rport_put(target->rport); | |
| 1065 | 1059 | kfree(target->ch); | |
| 1066 | 1060 | target->ch = NULL; | |
| 1067 | 1061 | ||
modified drivers/input/evdev.c
| @@ -1229,8 +1229,6 @@ static long evdev_do_ioctl(struct file *file, unsigned int cmd, | |||
| 1229 | 1229 | ||
| 1230 | 1230 | t = _IOC_NR(cmd) & ABS_MAX; | |
| 1231 | 1231 | ||
| 1232 | - | memset(&abs, 0, sizeof(abs)); | |
| 1233 | - | ||
| 1234 | 1232 | if (copy_from_user(&abs, p, min_t(size_t, | |
| 1235 | 1233 | size, sizeof(struct input_absinfo)))) | |
| 1236 | 1234 | return -EFAULT; | |
modified drivers/input/input-compat.c
| @@ -76,8 +76,6 @@ int input_ff_effect_from_user(const char __user *buffer, size_t size, | |||
| 76 | 76 | */ | |
| 77 | 77 | compat_effect = (struct ff_effect_compat *)effect; | |
| 78 | 78 | ||
| 79 | - | memset(effect, 0, sizeof(*effect)); | |
| 80 | - | ||
| 81 | 79 | if (copy_from_user(compat_effect, buffer, | |
| 82 | 80 | sizeof(struct ff_effect_compat))) | |
| 83 | 81 | return -EFAULT; | |
modified drivers/input/joystick/xpad.c
| @@ -215,7 +215,7 @@ static const struct xpad_device { | |||
| 215 | 215 | { 0x0e6f, 0x0139, "Afterglow Prismatic Wired Controller", 0, XTYPE_XBOXONE }, | |
| 216 | 216 | { 0x0e6f, 0x013a, "PDP Xbox One Controller", 0, XTYPE_XBOXONE }, | |
| 217 | 217 | { 0x0e6f, 0x0146, "Rock Candy Wired Controller for Xbox One", 0, XTYPE_XBOXONE }, | |
| 218 | - | { 0x0e6f, 0x0147, "PDP Marvel Xbox 360 Controller", 0, XTYPE_XBOX360 }, | |
| 218 | + | { 0x0e6f, 0x0147, "PDP Marvel Xbox One Controller", 0, XTYPE_XBOXONE }, | |
| 219 | 219 | { 0x0e6f, 0x015c, "PDP Xbox One Arcade Stick", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOXONE }, | |
| 220 | 220 | { 0x0e6f, 0x015d, "PDP Mirror's Edge Official Wired Controller for Xbox One", 0, XTYPE_XBOXONE }, | |
| 221 | 221 | { 0x0e6f, 0x0161, "PDP Xbox One Controller", 0, XTYPE_XBOXONE }, | |
| @@ -227,7 +227,6 @@ static const struct xpad_device { | |||
| 227 | 227 | { 0x0e6f, 0x0213, "Afterglow Gamepad for Xbox 360", 0, XTYPE_XBOX360 }, | |
| 228 | 228 | { 0x0e6f, 0x021f, "Rock Candy Gamepad for Xbox 360", 0, XTYPE_XBOX360 }, | |
| 229 | 229 | { 0x0e6f, 0x0246, "Rock Candy Gamepad for Xbox One 2015", 0, XTYPE_XBOXONE }, | |
| 230 | - | { 0x0e6f, 0x024c, "PDP Victrix Pro BFG Wired Controller for Xbox", 0, XTYPE_XBOXONE }, | |
| 231 | 230 | { 0x0e6f, 0x02a0, "PDP Xbox One Controller", 0, XTYPE_XBOXONE }, | |
| 232 | 231 | { 0x0e6f, 0x02a1, "PDP Xbox One Controller", 0, XTYPE_XBOXONE }, | |
| 233 | 232 | { 0x0e6f, 0x02a2, "PDP Wired Controller for Xbox One - Crimson Red", 0, XTYPE_XBOXONE }, | |
| @@ -293,12 +292,6 @@ static const struct xpad_device { | |||
| 293 | 292 | { 0x1689, 0xfd00, "Razer Onza Tournament Edition", 0, XTYPE_XBOX360 }, | |
| 294 | 293 | { 0x1689, 0xfd01, "Razer Onza Classic Edition", 0, XTYPE_XBOX360 }, | |
| 295 | 294 | { 0x1689, 0xfe00, "Razer Sabertooth", 0, XTYPE_XBOX360 }, | |
| 296 | - | { 0x16d0, 0x1103, "Azeron Cyro", 0, XTYPE_XBOX360 }, | |
| 297 | - | { 0x16d0, 0x113c, "Azeron Cyborg", 0, XTYPE_XBOX360 }, | |
| 298 | - | { 0x16d0, 0x1192, "Azeron Classic/Compact", 0, XTYPE_XBOX360 }, | |
| 299 | - | { 0x16d0, 0x1212, "Azeron Cyro Lefty", 0, XTYPE_XBOX360 }, | |
| 300 | - | { 0x16d0, 0x12f7, "Azeron Cyborg II", 0, XTYPE_XBOX360 }, | |
| 301 | - | { 0x16d0, 0x13ea, "Azeron Keyzen", 0, XTYPE_XBOX360 }, | |
| 302 | 295 | { 0x17ef, 0x6182, "Lenovo Legion Controller for Windows", 0, XTYPE_XBOX360 }, | |
| 303 | 296 | { 0x1949, 0x041a, "Amazon Game Controller", 0, XTYPE_XBOX360 }, | |
| 304 | 297 | { 0x1a86, 0xe310, "Legion Go S", 0, XTYPE_XBOX360 }, | |
| @@ -541,7 +534,6 @@ static const struct usb_device_id xpad_table[] = { | |||
| 541 | 534 | XPAD_XBOX360_VENDOR(0x15e4), /* Numark Xbox 360 controllers */ | |
| 542 | 535 | XPAD_XBOX360_VENDOR(0x162e), /* Joytech Xbox 360 controllers */ | |
| 543 | 536 | XPAD_XBOX360_VENDOR(0x1689), /* Razer Onza */ | |
| 544 | - | XPAD_XBOX360_VENDOR(0x16d0), /* Azeron controllers */ | |
| 545 | 537 | XPAD_XBOX360_VENDOR(0x17ef), /* Lenovo */ | |
| 546 | 538 | XPAD_XBOX360_VENDOR(0x1949), /* Amazon controllers */ | |
| 547 | 539 | XPAD_XBOX360_VENDOR(0x1a86), /* Nanjing Qinheng Microelectronics (WCH) */ | |
modified drivers/input/keyboard/adp5588-keys.c
| @@ -446,6 +446,12 @@ static int adp5588_gpio_add(struct adp5588_kpad *kpad) | |||
| 446 | 446 | ||
| 447 | 447 | mutex_init(&kpad->gpio_lock); | |
| 448 | 448 | ||
| 449 | + | error = devm_gpiochip_add_data(dev, &kpad->gc, kpad); | |
| 450 | + | if (error) { | |
| 451 | + | dev_err(dev, "gpiochip_add failed: %d\n", error); | |
| 452 | + | return error; | |
| 453 | + | } | |
| 454 | + | ||
| 449 | 455 | for (i = 0; i <= ADP5588_BANK(ADP5588_MAXGPIO); i++) { | |
| 450 | 456 | kpad->dat_out[i] = adp5588_read(kpad->client, | |
| 451 | 457 | GPIO_DAT_OUT1 + i); | |
| @@ -453,12 +459,6 @@ static int adp5588_gpio_add(struct adp5588_kpad *kpad) | |||
| 453 | 459 | kpad->pull_dis[i] = adp5588_read(kpad->client, GPIO_PULL1 + i); | |
| 454 | 460 | } | |
| 455 | 461 | ||
| 456 | - | error = devm_gpiochip_add_data(dev, &kpad->gc, kpad); | |
| 457 | - | if (error) { | |
| 458 | - | dev_err(dev, "gpiochip_add failed: %d\n", error); | |
| 459 | - | return error; | |
| 460 | - | } | |
| 461 | - | ||
| 462 | 462 | return 0; | |
| 463 | 463 | } | |
| 464 | 464 | ||
modified drivers/input/keyboard/atkbd.c
| @@ -1946,14 +1946,6 @@ static const struct dmi_system_id atkbd_dmi_quirk_table[] __initconst = { | |||
| 1946 | 1946 | }, | |
| 1947 | 1947 | .callback = atkbd_deactivate_fixup, | |
| 1948 | 1948 | }, | |
| 1949 | - | { | |
| 1950 | - | /* Xiaomi Redmi Book Pro 16 2026 (TM2425) */ | |
| 1951 | - | .matches = { | |
| 1952 | - | DMI_MATCH(DMI_SYS_VENDOR, "XIAOMI"), | |
| 1953 | - | DMI_MATCH(DMI_PRODUCT_NAME, "REDMI Book Pro 16 2026"), | |
| 1954 | - | }, | |
| 1955 | - | .callback = atkbd_deactivate_fixup, | |
| 1956 | - | }, | |
| 1957 | 1949 | { } | |
| 1958 | 1950 | }; | |
| 1959 | 1951 | ||
modified drivers/input/mouse/synaptics.c
| @@ -1838,14 +1838,6 @@ static int synaptics_setup_intertouch(struct psmouse *psmouse, | |||
| 1838 | 1838 | ||
| 1839 | 1839 | return -ENXIO; | |
| 1840 | 1840 | } | |
| 1841 | - | ||
| 1842 | - | /* Disable intertouch on known-broken board revisions */ | |
| 1843 | - | if (info->board_id == 2722) { | |
| 1844 | - | psmouse_info(psmouse, | |
| 1845 | - | "Disabling intertouch for board id %u\n", | |
| 1846 | - | info->board_id); | |
| 1847 | - | return -ENXIO; | |
| 1848 | - | } | |
| 1849 | 1841 | } | |
| 1850 | 1842 | ||
| 1851 | 1843 | psmouse_info(psmouse, "Trying to set up SMBus access\n"); | |
modified drivers/input/rmi4/rmi_driver.c
| @@ -991,15 +991,6 @@ int rmi_driver_suspend(struct rmi_device *rmi_dev, bool enable_wake) | |||
| 991 | 991 | { | |
| 992 | 992 | int retval; | |
| 993 | 993 | ||
| 994 | - | /* | |
| 995 | - | * Transport driver will try to suspend RMI device even if physical | |
| 996 | - | * driver did not bind to the RMI device, because transport device | |
| 997 | - | * (I2C, SPI) is fully registered and operational. Exit early if | |
| 998 | - | * there is no driver data attached to the RMI device. | |
| 999 | - | */ | |
| 1000 | - | if (!dev_get_drvdata(&rmi_dev->dev)) | |
| 1001 | - | return 0; | |
| 1002 | - | ||
| 1003 | 994 | retval = rmi_suspend_functions(rmi_dev); | |
| 1004 | 995 | if (retval) | |
| 1005 | 996 | dev_warn(&rmi_dev->dev, "Failed to suspend functions: %d\n", | |
| @@ -1014,10 +1005,6 @@ int rmi_driver_resume(struct rmi_device *rmi_dev, bool clear_wake) | |||
| 1014 | 1005 | { | |
| 1015 | 1006 | int retval; | |
| 1016 | 1007 | ||
| 1017 | - | /* Skip if not fully bound to RMI driver */ | |
| 1018 | - | if (!dev_get_drvdata(&rmi_dev->dev)) | |
| 1019 | - | return 0; | |
| 1020 | - | ||
| 1021 | 1008 | rmi_enable_irq(rmi_dev, clear_wake); | |
| 1022 | 1009 | ||
| 1023 | 1010 | retval = rmi_resume_functions(rmi_dev); | |
modified drivers/input/rmi4/rmi_smbus.c
| @@ -140,7 +140,7 @@ static int rmi_smb_write_block(struct rmi_transport_dev *xport, u16 rmiaddr, | |||
| 140 | 140 | u8 commandcode; | |
| 141 | 141 | struct rmi_smb_xport *rmi_smb = | |
| 142 | 142 | container_of(xport, struct rmi_smb_xport, xport); | |
| 143 | - | size_t cur_len = len; | |
| 143 | + | int cur_len = (int)len; | |
| 144 | 144 | ||
| 145 | 145 | mutex_lock(&rmi_smb->page_mutex); | |
| 146 | 146 | ||
| @@ -148,7 +148,7 @@ static int rmi_smb_write_block(struct rmi_transport_dev *xport, u16 rmiaddr, | |||
| 148 | 148 | /* | |
| 149 | 149 | * break into 32 bytes chunks to write get command code | |
| 150 | 150 | */ | |
| 151 | - | int block_len = min_t(size_t, cur_len, SMB_MAX_COUNT); | |
| 151 | + | int block_len = min_t(int, len, SMB_MAX_COUNT); | |
| 152 | 152 | ||
| 153 | 153 | retval = rmi_smb_get_command_code(xport, rmiaddr, block_len, | |
| 154 | 154 | false, &commandcode); | |
| @@ -161,9 +161,9 @@ static int rmi_smb_write_block(struct rmi_transport_dev *xport, u16 rmiaddr, | |||
| 161 | 161 | goto exit; | |
| 162 | 162 | ||
| 163 | 163 | /* prepare to write next block of bytes */ | |
| 164 | - | cur_len -= block_len; | |
| 165 | - | databuff += block_len; | |
| 166 | - | rmiaddr += block_len; | |
| 164 | + | cur_len -= SMB_MAX_COUNT; | |
| 165 | + | databuff += SMB_MAX_COUNT; | |
| 166 | + | rmiaddr += SMB_MAX_COUNT; | |
| 167 | 167 | } | |
| 168 | 168 | exit: | |
| 169 | 169 | mutex_unlock(&rmi_smb->page_mutex); | |
modified drivers/input/serio/hp_sdc.c
| @@ -981,7 +981,7 @@ static void hp_sdc_exit(void) | |||
| 981 | 981 | free_irq(hp_sdc.irq, &hp_sdc); | |
| 982 | 982 | write_unlock_irq(&hp_sdc.lock); | |
| 983 | 983 | ||
| 984 | - | timer_shutdown_sync(&hp_sdc.kicker); | |
| 984 | + | timer_delete_sync(&hp_sdc.kicker); | |
| 985 | 985 | ||
| 986 | 986 | tasklet_kill(&hp_sdc.task); | |
| 987 | 987 | ||
modified drivers/input/serio/i8042-acpipnpio.h
| @@ -259,13 +259,6 @@ static const struct dmi_system_id i8042_dmi_quirk_table[] __initconst = { | |||
| 259 | 259 | }, | |
| 260 | 260 | .driver_data = (void *)(SERIO_QUIRK_RESET_ALWAYS) | |
| 261 | 261 | }, | |
| 262 | - | { | |
| 263 | - | .matches = { | |
| 264 | - | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), | |
| 265 | - | DMI_MATCH(DMI_PRODUCT_NAME, "Aspire AG15-42P"), | |
| 266 | - | }, | |
| 267 | - | .driver_data = (void *)(SERIO_QUIRK_RESET_ALWAYS) | |
| 268 | - | }, | |
| 269 | 262 | { | |
| 270 | 263 | .matches = { | |
| 271 | 264 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), | |
modified drivers/input/touchscreen/cyttsp5.c
| @@ -710,7 +710,6 @@ static irqreturn_t cyttsp5_handle_irq(int irq, void *handle) | |||
| 710 | 710 | size = 2; | |
| 711 | 711 | } else { | |
| 712 | 712 | report_id = ts->input_buf[2]; | |
| 713 | - | size = min(size, CY_MAX_INPUT); | |
| 714 | 713 | } | |
| 715 | 714 | ||
| 716 | 715 | switch (report_id) { | |
modified drivers/input/touchscreen/eeti_ts.c
| @@ -276,7 +276,6 @@ static const struct of_device_id of_eeti_ts_match[] = { | |||
| 276 | 276 | { .compatible = "eeti,exc3000-i2c", }, | |
| 277 | 277 | { } | |
| 278 | 278 | }; | |
| 279 | - | MODULE_DEVICE_TABLE(of, of_eeti_ts_match); | |
| 280 | 279 | #endif | |
| 281 | 280 | ||
| 282 | 281 | static struct i2c_driver eeti_ts_driver = { | |
modified drivers/input/touchscreen/tsc2007_core.c
| @@ -221,6 +221,7 @@ static int tsc2007_get_pendown_state_gpio(struct device *dev) | |||
| 221 | 221 | static int tsc2007_probe_properties(struct device *dev, struct tsc2007 *ts) | |
| 222 | 222 | { | |
| 223 | 223 | u32 val32; | |
| 224 | + | u64 val64; | |
| 224 | 225 | ||
| 225 | 226 | if (!device_property_read_u32(dev, "ti,max-rt", &val32)) | |
| 226 | 227 | ts->max_rt = val32; | |
| @@ -236,8 +237,8 @@ static int tsc2007_probe_properties(struct device *dev, struct tsc2007 *ts) | |||
| 236 | 237 | if (!device_property_read_u32(dev, "ti,fuzzz", &val32)) | |
| 237 | 238 | ts->fuzzz = val32; | |
| 238 | 239 | ||
| 239 | - | if (!device_property_read_u32(dev, "ti,poll-period", &val32)) | |
| 240 | - | ts->poll_period = msecs_to_jiffies(val32); | |
| 240 | + | if (!device_property_read_u64(dev, "ti,poll-period", &val64)) | |
| 241 | + | ts->poll_period = msecs_to_jiffies(val64); | |
| 241 | 242 | else | |
| 242 | 243 | ts->poll_period = msecs_to_jiffies(1); | |
| 243 | 244 | ||
modified drivers/memstick/core/ms_block.c
| @@ -2204,8 +2204,6 @@ static void msb_remove(struct memstick_dev *card) | |||
| 2204 | 2204 | msb_data_clear(msb); | |
| 2205 | 2205 | mutex_unlock(&msb_disk_lock); | |
| 2206 | 2206 | ||
| 2207 | - | destroy_workqueue(msb->io_queue); | |
| 2208 | - | ||
| 2209 | 2207 | put_disk(msb->disk); | |
| 2210 | 2208 | memstick_set_drvdata(card, NULL); | |
| 2211 | 2209 | } | |
modified drivers/mmc/core/bus.c
| @@ -417,8 +417,8 @@ void mmc_remove_card(struct mmc_card *card) | |||
| 417 | 417 | mmc_hostname(card->host), card->rca); | |
| 418 | 418 | } | |
| 419 | 419 | device_del(&card->dev); | |
| 420 | + | of_node_put(card->dev.of_node); | |
| 420 | 421 | } | |
| 421 | - | of_node_put(card->dev.of_node); | |
| 422 | 422 | ||
| 423 | 423 | if (host->cqe_enabled) { | |
| 424 | 424 | host->cqe_ops->cqe_disable(host); | |
modified drivers/mmc/core/host.c
| @@ -698,7 +698,6 @@ EXPORT_SYMBOL(mmc_remove_host); | |||
| 698 | 698 | void mmc_free_host(struct mmc_host *host) | |
| 699 | 699 | { | |
| 700 | 700 | cancel_delayed_work_sync(&host->detect); | |
| 701 | - | cancel_work_sync(&host->sdio_irq_work); | |
| 702 | 701 | mmc_pwrseq_free(host); | |
| 703 | 702 | put_device(&host->class_dev); | |
| 704 | 703 | } | |
modified drivers/mmc/core/sdio_uart.c
| @@ -104,9 +104,6 @@ static int sdio_uart_add_port(struct sdio_uart_port *port) | |||
| 104 | 104 | } | |
| 105 | 105 | spin_unlock(&sdio_uart_table_lock); | |
| 106 | 106 | ||
| 107 | - | if (ret) | |
| 108 | - | kfifo_free(&port->xmit_fifo); | |
| 109 | - | ||
| 110 | 107 | return ret; | |
| 111 | 108 | } | |
| 112 | 109 | ||
modified drivers/mmc/host/mmc_hsq.c
| @@ -7,7 +7,6 @@ | |||
| 7 | 7 | * Author: Baolin Wang <baolin.wang@linaro.org> | |
| 8 | 8 | */ | |
| 9 | 9 | ||
| 10 | - | #include <linux/devm-helpers.h> | |
| 11 | 10 | #include <linux/mmc/card.h> | |
| 12 | 11 | #include <linux/mmc/host.h> | |
| 13 | 12 | #include <linux/module.h> | |
| @@ -346,7 +345,6 @@ static const struct mmc_cqe_ops mmc_hsq_ops = { | |||
| 346 | 345 | ||
| 347 | 346 | int mmc_hsq_init(struct mmc_hsq *hsq, struct mmc_host *mmc) | |
| 348 | 347 | { | |
| 349 | - | int ret; | |
| 350 | 348 | int i; | |
| 351 | 349 | hsq->num_slots = HSQ_NUM_SLOTS; | |
| 352 | 350 | hsq->next_tag = HSQ_INVALID_TAG; | |
| @@ -365,11 +363,7 @@ int mmc_hsq_init(struct mmc_hsq *hsq, struct mmc_host *mmc) | |||
| 365 | 363 | for (i = 0; i < HSQ_NUM_SLOTS; i++) | |
| 366 | 364 | hsq->tag_slot[i] = HSQ_INVALID_TAG; | |
| 367 | 365 | ||
| 368 | - | ret = devm_work_autocancel(mmc_dev(mmc), &hsq->retry_work, | |
| 369 | - | mmc_hsq_retry_handler); | |
| 370 | - | if (ret) | |
| 371 | - | return ret; | |
| 372 | - | ||
| 366 | + | INIT_WORK(&hsq->retry_work, mmc_hsq_retry_handler); | |
| 373 | 367 | spin_lock_init(&hsq->lock); | |
| 374 | 368 | init_waitqueue_head(&hsq->wait_queue); | |
| 375 | 369 | ||
modified drivers/mmc/host/mmc_spi.c
| @@ -952,7 +952,6 @@ crc_recover: | |||
| 952 | 952 | status = mmc_spi_command_send(host, mrq, &stop, 0); | |
| 953 | 953 | crc_retry--; | |
| 954 | 954 | mrq->data->error = 0; | |
| 955 | - | mrq->data->bytes_xfered = 0; | |
| 956 | 955 | goto crc_recover; | |
| 957 | 956 | } | |
| 958 | 957 | ||
modified drivers/mmc/host/mmci.c
| @@ -2511,9 +2511,6 @@ static void mmci_remove(struct amba_device *dev) | |||
| 2511 | 2511 | writel(0, host->base + MMCICOMMAND); | |
| 2512 | 2512 | writel(0, host->base + MMCIDATACTRL); | |
| 2513 | 2513 | ||
| 2514 | - | if (variant->busy_detect) | |
| 2515 | - | disable_delayed_work_sync(&host->ux500_busy_timeout_work); | |
| 2516 | - | ||
| 2517 | 2514 | mmci_dma_release(host); | |
| 2518 | 2515 | clk_disable_unprepare(host->clk); | |
| 2519 | 2516 | } | |
modified drivers/mmc/host/mxcmmc.c
| @@ -1173,10 +1173,6 @@ static void mxcmci_remove(struct platform_device *pdev) | |||
| 1173 | 1173 | ||
| 1174 | 1174 | mmc_remove_host(mmc); | |
| 1175 | 1175 | ||
| 1176 | - | devm_free_irq(&pdev->dev, platform_get_irq(pdev, 0), host); | |
| 1177 | - | cancel_work_sync(&host->datawork); | |
| 1178 | - | timer_delete_sync(&host->watchdog); | |
| 1179 | - | ||
| 1180 | 1176 | if (host->pdata && host->pdata->exit) | |
| 1181 | 1177 | host->pdata->exit(&pdev->dev, mmc); | |
| 1182 | 1178 | ||
modified drivers/mmc/host/rtsx_pci_sdmmc.c
| @@ -1425,11 +1425,6 @@ static void realtek_init_host(struct realtek_pci_sdmmc *host) | |||
| 1425 | 1425 | mmc->caps = mmc->caps | MMC_CAP_AGGRESSIVE_PM; | |
| 1426 | 1426 | mmc->caps2 = MMC_CAP2_NO_PRESCAN_POWERUP | MMC_CAP2_FULL_PWR_CYCLE | | |
| 1427 | 1427 | MMC_CAP2_NO_SDIO; | |
| 1428 | - | ||
| 1429 | - | if (pcr->pci->device == 0x522a && | |
| 1430 | - | pcr->pci->subsystem_vendor == PCI_VENDOR_ID_LENOVO && | |
| 1431 | - | pcr->pci->subsystem_device == 0x504a) | |
| 1432 | - | mmc->caps2 |= MMC_CAP2_NO_WRITE_PROTECT; | |
| 1433 | 1428 | mmc->max_current_330 = 400; | |
| 1434 | 1429 | mmc->max_current_180 = 800; | |
| 1435 | 1430 | mmc->ops = &realtek_pci_sdmmc_ops; | |
modified drivers/mmc/host/sdhci-of-aspeed.c
| @@ -560,14 +560,12 @@ static int aspeed_sdc_probe(struct platform_device *pdev) | |||
| 560 | 560 | cpdev = of_platform_device_create(child, NULL, &pdev->dev); | |
| 561 | 561 | if (!cpdev) { | |
| 562 | 562 | ret = -ENODEV; | |
| 563 | - | goto err_children; | |
| 563 | + | goto err_clk; | |
| 564 | 564 | } | |
| 565 | 565 | } | |
| 566 | 566 | ||
| 567 | 567 | return 0; | |
| 568 | 568 | ||
| 569 | - | err_children: | |
| 570 | - | device_for_each_child_reverse(&pdev->dev, NULL, of_platform_device_destroy); | |
| 571 | 569 | err_clk: | |
| 572 | 570 | clk_disable_unprepare(sdc->clk); | |
| 573 | 571 | return ret; | |
| @@ -577,7 +575,6 @@ static void aspeed_sdc_remove(struct platform_device *pdev) | |||
| 577 | 575 | { | |
| 578 | 576 | struct aspeed_sdc *sdc = dev_get_drvdata(&pdev->dev); | |
| 579 | 577 | ||
| 580 | - | device_for_each_child_reverse(&pdev->dev, NULL, of_platform_device_destroy); | |
| 581 | 578 | clk_disable_unprepare(sdc->clk); | |
| 582 | 579 | } | |
| 583 | 580 | ||
modified drivers/mmc/host/sdhci_am654.c
| @@ -126,7 +126,7 @@ static const struct timing_data td[] = { | |||
| 126 | 126 | NULL, | |
| 127 | 127 | MMC_CAP_UHS_SDR104}, | |
| 128 | 128 | [MMC_TIMING_UHS_DDR50] = {"ti,otap-del-sel-ddr50", | |
| 129 | - | "ti,itap-del-sel-ddr50", | |
| 129 | + | NULL, | |
| 130 | 130 | MMC_CAP_UHS_DDR50}, | |
| 131 | 131 | [MMC_TIMING_MMC_DDR52] = {"ti,otap-del-sel-ddr52", | |
| 132 | 132 | "ti,itap-del-sel-ddr52", | |
| @@ -144,8 +144,6 @@ struct sdhci_am654_data { | |||
| 144 | 144 | u32 otap_del_sel[ARRAY_SIZE(td)]; | |
| 145 | 145 | u32 itap_del_sel[ARRAY_SIZE(td)]; | |
| 146 | 146 | u32 itap_del_ena[ARRAY_SIZE(td)]; | |
| 147 | - | u32 itap_del_sel_dt_ddr50; | |
| 148 | - | u32 itap_del_ena_dt_ddr50; | |
| 149 | 147 | int clkbuf_sel; | |
| 150 | 148 | int trm_icp; | |
| 151 | 149 | int drv_strength; | |
| @@ -153,6 +151,7 @@ struct sdhci_am654_data { | |||
| 153 | 151 | u32 flags; | |
| 154 | 152 | u32 quirks; | |
| 155 | 153 | bool dll_enable; | |
| 154 | + | u32 tuning_loop; | |
| 156 | 155 | ||
| 157 | 156 | #define SDHCI_AM654_QUIRK_FORCE_CDTEST BIT(0) | |
| 158 | 157 | #define SDHCI_AM654_QUIRK_SUPPRESS_V1P8_ENA BIT(1) | |
| @@ -444,13 +443,15 @@ static int sdhci_am654_execute_tuning(struct mmc_host *mmc, u32 opcode) | |||
| 444 | 443 | struct sdhci_host *host = mmc_priv(mmc); | |
| 445 | 444 | int err = sdhci_execute_tuning(mmc, opcode); | |
| 446 | 445 | ||
| 446 | + | if (err) | |
| 447 | + | return err; | |
| 447 | 448 | /* | |
| 448 | 449 | * Tuning data remains in the buffer after tuning. | |
| 449 | 450 | * Do a command and data reset to get rid of it | |
| 450 | 451 | */ | |
| 451 | 452 | sdhci_reset(host, SDHCI_RESET_CMD | SDHCI_RESET_DATA); | |
| 452 | 453 | ||
| 453 | - | return err; | |
| 454 | + | return 0; | |
| 454 | 455 | } | |
| 455 | 456 | ||
| 456 | 457 | static u32 sdhci_am654_cqhci_irq(struct sdhci_host *host, u32 intmask) | |
| @@ -529,6 +530,7 @@ static int sdhci_am654_do_tuning(struct sdhci_host *host, | |||
| 529 | 530 | { | |
| 530 | 531 | struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); | |
| 531 | 532 | struct sdhci_am654_data *sdhci_am654 = sdhci_pltfm_priv(pltfm_host); | |
| 533 | + | unsigned char timing = host->mmc->ios.timing; | |
| 532 | 534 | struct window fail_window[ITAPDLY_LENGTH]; | |
| 533 | 535 | struct device *dev = mmc_dev(host->mmc); | |
| 534 | 536 | u8 curr_pass, itap; | |
| @@ -537,8 +539,11 @@ static int sdhci_am654_do_tuning(struct sdhci_host *host, | |||
| 537 | 539 | ||
| 538 | 540 | memset(fail_window, 0, sizeof(fail_window)); | |
| 539 | 541 | ||
| 542 | + | /* Enable ITAPDLY */ | |
| 543 | + | sdhci_am654->itap_del_ena[timing] = 0x1; | |
| 544 | + | ||
| 540 | 545 | for (itap = 0; itap < ITAPDLY_LENGTH; itap++) { | |
| 541 | - | sdhci_am654_write_itapdly(sdhci_am654, itap, 0x1); | |
| 546 | + | sdhci_am654_write_itapdly(sdhci_am654, itap, sdhci_am654->itap_del_ena[timing]); | |
| 542 | 547 | ||
| 543 | 548 | curr_pass = !mmc_send_tuning(host->mmc, opcode, NULL); | |
| 544 | 549 | ||
| @@ -571,36 +576,20 @@ static int sdhci_am654_platform_execute_tuning(struct sdhci_host *host, | |||
| 571 | 576 | struct sdhci_am654_data *sdhci_am654 = sdhci_pltfm_priv(pltfm_host); | |
| 572 | 577 | unsigned char timing = host->mmc->ios.timing; | |
| 573 | 578 | struct device *dev = mmc_dev(host->mmc); | |
| 574 | - | unsigned int tuning_loop = 0; | |
| 575 | 579 | int itapdly; | |
| 576 | 580 | ||
| 577 | 581 | do { | |
| 578 | 582 | itapdly = sdhci_am654_do_tuning(host, opcode); | |
| 579 | 583 | if (itapdly >= 0) | |
| 580 | 584 | break; | |
| 581 | - | } while (++tuning_loop < RETRY_TUNING_MAX); | |
| 585 | + | } while (++sdhci_am654->tuning_loop < RETRY_TUNING_MAX); | |
| 582 | 586 | ||
| 583 | 587 | if (itapdly < 0) { | |
| 584 | - | if (timing == MMC_TIMING_UHS_DDR50) { | |
| 585 | - | dev_dbg(dev, "Failed DDR50 tuning, fallback to DT ITAP\n"); | |
| 586 | - | sdhci_am654->itap_del_sel[timing] = sdhci_am654->itap_del_sel_dt_ddr50; | |
| 587 | - | sdhci_am654->itap_del_ena[timing] = sdhci_am654->itap_del_ena_dt_ddr50; | |
| 588 | - | } else { | |
| 589 | - | dev_err(dev, "Failed to find itapdly, fail tuning\n"); | |
| 590 | - | sdhci_am654->itap_del_ena[timing] = 0; | |
| 591 | - | sdhci_am654->itap_del_sel[timing] = 0; | |
| 592 | - | } | |
| 593 | - | ||
| 594 | - | sdhci_am654_write_itapdly(sdhci_am654, | |
| 595 | - | sdhci_am654->itap_del_sel[timing], | |
| 596 | - | sdhci_am654->itap_del_ena[timing]); | |
| 588 | + | dev_err(dev, "Failed to find itapdly, fail tuning\n"); | |
| 597 | 589 | return -1; | |
| 598 | 590 | } | |
| 599 | 591 | ||
| 600 | 592 | dev_dbg(dev, "Passed tuning, final itapdly=%d\n", itapdly); | |
| 601 | - | ||
| 602 | - | /* Enable ITAPDLY */ | |
| 603 | - | sdhci_am654->itap_del_ena[timing] = 0x1; | |
| 604 | 593 | sdhci_am654_write_itapdly(sdhci_am654, itapdly, sdhci_am654->itap_del_ena[timing]); | |
| 605 | 594 | /* Save ITAPDLY */ | |
| 606 | 595 | sdhci_am654->itap_del_sel[timing] = itapdly; | |
| @@ -769,11 +758,6 @@ static int sdhci_am654_get_otap_delay(struct sdhci_host *host, | |||
| 769 | 758 | } | |
| 770 | 759 | } | |
| 771 | 760 | ||
| 772 | - | sdhci_am654->itap_del_sel_dt_ddr50 = | |
| 773 | - | sdhci_am654->itap_del_sel[MMC_TIMING_UHS_DDR50]; | |
| 774 | - | sdhci_am654->itap_del_ena_dt_ddr50 = | |
| 775 | - | sdhci_am654->itap_del_ena[MMC_TIMING_UHS_DDR50]; | |
| 776 | - | ||
| 777 | 761 | return 0; | |
| 778 | 762 | } | |
| 779 | 763 | ||
| @@ -822,6 +806,9 @@ static int sdhci_am654_init(struct sdhci_host *host) | |||
| 822 | 806 | regmap_update_bits(sdhci_am654->base, CTL_CFG_3, TUNINGFORSDR50_MASK, | |
| 823 | 807 | TUNINGFORSDR50_MASK); | |
| 824 | 808 | ||
| 809 | + | /* Use to re-execute tuning */ | |
| 810 | + | sdhci_am654->tuning_loop = 0; | |
| 811 | + | ||
| 825 | 812 | ret = sdhci_setup_host(host); | |
| 826 | 813 | if (ret) | |
| 827 | 814 | return ret; | |
modified drivers/mmc/host/sh_mmcif.c
| @@ -1461,7 +1461,6 @@ static int sh_mmcif_probe(struct platform_device *pdev) | |||
| 1461 | 1461 | host->pd = pdev; | |
| 1462 | 1462 | ||
| 1463 | 1463 | spin_lock_init(&host->lock); | |
| 1464 | - | mutex_init(&host->thread_lock); | |
| 1465 | 1464 | ||
| 1466 | 1465 | mmc->ops = &sh_mmcif_ops; | |
| 1467 | 1466 | sh_mmcif_init_ocr(host); | |
| @@ -1516,6 +1515,8 @@ static int sh_mmcif_probe(struct platform_device *pdev) | |||
| 1516 | 1515 | goto err_clk; | |
| 1517 | 1516 | } | |
| 1518 | 1517 | ||
| 1518 | + | mutex_init(&host->thread_lock); | |
| 1519 | + | ||
| 1519 | 1520 | ret = mmc_add_host(mmc); | |
| 1520 | 1521 | if (ret < 0) | |
| 1521 | 1522 | goto err_clk; | |
modified drivers/net/bonding/bond_main.c
| @@ -490,7 +490,7 @@ static int bond_ipsec_add_sa(struct net_device *bond_dev, | |||
| 490 | 490 | !real_dev->xfrmdev_ops->xdo_dev_state_add || | |
| 491 | 491 | netif_is_bond_master(real_dev)) { | |
| 492 | 492 | NL_SET_ERR_MSG_MOD(extack, "Slave does not support ipsec offload"); | |
| 493 | - | err = -EOPNOTSUPP; | |
| 493 | + | err = -EINVAL; | |
| 494 | 494 | goto out; | |
| 495 | 495 | } | |
| 496 | 496 | ||
modified drivers/net/dsa/mt7530-mdio.c
| @@ -227,17 +227,15 @@ mt7530_remove(struct mdio_device *mdiodev) | |||
| 227 | 227 | if (!priv) | |
| 228 | 228 | return; | |
| 229 | 229 | ||
| 230 | - | if (priv->id == ID_MT7530) { | |
| 231 | - | ret = regulator_disable(priv->core_pwr); | |
| 232 | - | if (ret < 0) | |
| 233 | - | dev_err(priv->dev, | |
| 234 | - | "Failed to disable core power: %d\n", ret); | |
| 235 | - | ||
| 236 | - | ret = regulator_disable(priv->io_pwr); | |
| 237 | - | if (ret < 0) | |
| 238 | - | dev_err(priv->dev, "Failed to disable io pwr: %d\n", | |
| 239 | - | ret); | |
| 240 | - | } | |
| 230 | + | ret = regulator_disable(priv->core_pwr); | |
| 231 | + | if (ret < 0) | |
| 232 | + | dev_err(priv->dev, | |
| 233 | + | "Failed to disable core power: %d\n", ret); | |
| 234 | + | ||
| 235 | + | ret = regulator_disable(priv->io_pwr); | |
| 236 | + | if (ret < 0) | |
| 237 | + | dev_err(priv->dev, "Failed to disable io pwr: %d\n", | |
| 238 | + | ret); | |
| 241 | 239 | ||
| 242 | 240 | mt7530_remove_common(priv); | |
| 243 | 241 | ||
modified drivers/net/dsa/mt7530.c
| @@ -3593,6 +3593,9 @@ EXPORT_SYMBOL_GPL(mt7530_probe_common); | |||
| 3593 | 3593 | void | |
| 3594 | 3594 | mt7530_remove_common(struct mt7530_priv *priv) | |
| 3595 | 3595 | { | |
| 3596 | + | if (priv->irq_domain) | |
| 3597 | + | mt7530_free_mdio_irq(priv); | |
| 3598 | + | ||
| 3596 | 3599 | dsa_unregister_switch(priv->ds); | |
| 3597 | 3600 | ||
| 3598 | 3601 | mutex_destroy(&priv->reg_mutex); | |
modified drivers/net/dsa/mv88e6xxx/chip.c
| @@ -5639,68 +5639,6 @@ static const struct mv88e6xxx_ops mv88e6390x_ops = { | |||
| 5639 | 5639 | .pcs_ops = &mv88e6390_pcs_ops, | |
| 5640 | 5640 | }; | |
| 5641 | 5641 | ||
| 5642 | - | static const struct mv88e6xxx_ops mv88e6191x_ops = { | |
| 5643 | - | /* MV88E6XXX_FAMILY_6393 without AVB and PTP: 6191X and 6193X */ | |
| 5644 | - | .irl_init_all = mv88e6390_g2_irl_init_all, | |
| 5645 | - | .get_eeprom = mv88e6xxx_g2_get_eeprom8, | |
| 5646 | - | .set_eeprom = mv88e6xxx_g2_set_eeprom8, | |
| 5647 | - | .set_switch_mac = mv88e6xxx_g2_set_switch_mac, | |
| 5648 | - | .phy_read = mv88e6xxx_g2_smi_phy_read_c22, | |
| 5649 | - | .phy_write = mv88e6xxx_g2_smi_phy_write_c22, | |
| 5650 | - | .phy_read_c45 = mv88e6xxx_g2_smi_phy_read_c45, | |
| 5651 | - | .phy_write_c45 = mv88e6xxx_g2_smi_phy_write_c45, | |
| 5652 | - | .port_set_link = mv88e6xxx_port_set_link, | |
| 5653 | - | .port_sync_link = mv88e6xxx_port_sync_link, | |
| 5654 | - | .port_set_rgmii_delay = mv88e6390_port_set_rgmii_delay, | |
| 5655 | - | .port_set_speed_duplex = mv88e6393x_port_set_speed_duplex, | |
| 5656 | - | .port_tag_remap = mv88e6390_port_tag_remap, | |
| 5657 | - | .port_set_policy = mv88e6393x_port_set_policy, | |
| 5658 | - | .port_set_frame_mode = mv88e6351_port_set_frame_mode, | |
| 5659 | - | .port_set_ucast_flood = mv88e6352_port_set_ucast_flood, | |
| 5660 | - | .port_set_mcast_flood = mv88e6352_port_set_mcast_flood, | |
| 5661 | - | .port_set_ether_type = mv88e6393x_port_set_ether_type, | |
| 5662 | - | .port_set_jumbo_size = mv88e6165_port_set_jumbo_size, | |
| 5663 | - | .port_egress_rate_limiting = mv88e6097_port_egress_rate_limiting, | |
| 5664 | - | .port_pause_limit = mv88e6390_port_pause_limit, | |
| 5665 | - | .port_disable_learn_limit = mv88e6xxx_port_disable_learn_limit, | |
| 5666 | - | .port_disable_pri_override = mv88e6xxx_port_disable_pri_override, | |
| 5667 | - | .port_get_cmode = mv88e6352_port_get_cmode, | |
| 5668 | - | .port_set_cmode = mv88e6393x_port_set_cmode, | |
| 5669 | - | .port_setup_message_port = mv88e6xxx_setup_message_port, | |
| 5670 | - | .port_set_upstream_port = mv88e6393x_port_set_upstream_port, | |
| 5671 | - | .port_enable_tcam = mv88e6xxx_port_enable_tcam, | |
| 5672 | - | .stats_snapshot = mv88e6390_g1_stats_snapshot, | |
| 5673 | - | .stats_set_histogram = mv88e6390_g1_stats_set_histogram, | |
| 5674 | - | .stats_get_sset_count = mv88e6320_stats_get_sset_count, | |
| 5675 | - | .stats_get_strings = mv88e6320_stats_get_strings, | |
| 5676 | - | .stats_get_stat = mv88e6390_stats_get_stat, | |
| 5677 | - | /* .set_cpu_port is missing because this family does not support a global | |
| 5678 | - | * CPU port, only per port CPU port which is set via | |
| 5679 | - | * .port_set_upstream_port method. | |
| 5680 | - | */ | |
| 5681 | - | .set_egress_port = mv88e6393x_set_egress_port, | |
| 5682 | - | .watchdog_ops = &mv88e6393x_watchdog_ops, | |
| 5683 | - | .mgmt_rsvd2cpu = mv88e6393x_port_mgmt_rsvd2cpu, | |
| 5684 | - | .pot_clear = mv88e6xxx_g2_pot_clear, | |
| 5685 | - | .hardware_reset_pre = mv88e6xxx_g2_eeprom_wait, | |
| 5686 | - | .hardware_reset_post = mv88e6xxx_g2_eeprom_wait, | |
| 5687 | - | .reset = mv88e6352_g1_reset, | |
| 5688 | - | .rmu_disable = mv88e6390_g1_rmu_disable, | |
| 5689 | - | .atu_get_hash = mv88e6165_g1_atu_get_hash, | |
| 5690 | - | .atu_set_hash = mv88e6165_g1_atu_set_hash, | |
| 5691 | - | .vtu_getnext = mv88e6390_g1_vtu_getnext, | |
| 5692 | - | .vtu_loadpurge = mv88e6390_g1_vtu_loadpurge, | |
| 5693 | - | .stu_getnext = mv88e6390_g1_stu_getnext, | |
| 5694 | - | .stu_loadpurge = mv88e6390_g1_stu_loadpurge, | |
| 5695 | - | .serdes_get_lane = mv88e6393x_serdes_get_lane, | |
| 5696 | - | .serdes_irq_mapping = mv88e6390_serdes_irq_mapping, | |
| 5697 | - | /* TODO: serdes stats */ | |
| 5698 | - | .gpio_ops = &mv88e6352_gpio_ops, | |
| 5699 | - | .phylink_get_caps = mv88e6393x_phylink_get_caps, | |
| 5700 | - | .pcs_ops = &mv88e6393x_pcs_ops, | |
| 5701 | - | .tcam_ops = &mv88e6393_tcam_ops, | |
| 5702 | - | }; | |
| 5703 | - | ||
| 5704 | 5642 | static const struct mv88e6xxx_ops mv88e6393x_ops = { | |
| 5705 | 5643 | /* MV88E6XXX_FAMILY_6393 */ | |
| 5706 | 5644 | .irl_init_all = mv88e6390_g2_irl_init_all, | |
| @@ -6225,7 +6163,8 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = { | |||
| 6225 | 6163 | .atu_move_port_mask = 0x1f, | |
| 6226 | 6164 | .pvt = true, | |
| 6227 | 6165 | .multi_chip = true, | |
| 6228 | - | .ops = &mv88e6191x_ops, | |
| 6166 | + | .ptp_support = true, | |
| 6167 | + | .ops = &mv88e6393x_ops, | |
| 6229 | 6168 | }, | |
| 6230 | 6169 | ||
| 6231 | 6170 | [MV88E6193X] = { | |
| @@ -6251,7 +6190,8 @@ static const struct mv88e6xxx_info mv88e6xxx_table[] = { | |||
| 6251 | 6190 | .atu_move_port_mask = 0x1f, | |
| 6252 | 6191 | .pvt = true, | |
| 6253 | 6192 | .multi_chip = true, | |
| 6254 | - | .ops = &mv88e6191x_ops, | |
| 6193 | + | .ptp_support = true, | |
| 6194 | + | .ops = &mv88e6393x_ops, | |
| 6255 | 6195 | }, | |
| 6256 | 6196 | ||
| 6257 | 6197 | [MV88E6220] = { | |
modified drivers/net/dsa/mxl862xx/mxl862xx.c
| @@ -685,22 +685,10 @@ static int mxl862xx_setup(struct dsa_switch *ds) | |||
| 685 | 685 | if (ret) | |
| 686 | 686 | return ret; | |
| 687 | 687 | ||
| 688 | - | ret = mxl862xx_setup_mdio(ds); | |
| 689 | - | if (ret) | |
| 690 | - | return ret; | |
| 691 | - | ||
| 692 | 688 | schedule_delayed_work(&priv->stats_work, | |
| 693 | 689 | MXL862XX_STATS_POLL_INTERVAL); | |
| 694 | 690 | ||
| 695 | - | return 0; | |
| 696 | - | } | |
| 697 | - | ||
| 698 | - | static void mxl862xx_teardown(struct dsa_switch *ds) | |
| 699 | - | { | |
| 700 | - | struct mxl862xx_priv *priv = ds->priv; | |
| 701 | - | ||
| 702 | - | set_bit(MXL862XX_FLAG_WORK_STOPPED, &priv->flags); | |
| 703 | - | disable_delayed_work_sync(&priv->stats_work); | |
| 691 | + | return mxl862xx_setup_mdio(ds); | |
| 704 | 692 | } | |
| 705 | 693 | ||
| 706 | 694 | static int mxl862xx_port_state(struct dsa_switch *ds, int port, bool enable) | |
| @@ -2059,7 +2047,9 @@ static void mxl862xx_get_stats64(struct dsa_switch *ds, int port, | |||
| 2059 | 2047 | ||
| 2060 | 2048 | spin_unlock_bh(&priv->ports[port].stats_lock); | |
| 2061 | 2049 | ||
| 2062 | - | /* Trigger a fresh poll so the next read sees up-to-date counters. */ | |
| 2050 | + | /* Trigger a fresh poll so the next read sees up-to-date counters. | |
| 2051 | + | * No-op if the work is already pending, running, or teardown started. | |
| 2052 | + | */ | |
| 2063 | 2053 | if (!test_bit(MXL862XX_FLAG_WORK_STOPPED, &priv->flags)) | |
| 2064 | 2054 | schedule_delayed_work(&priv->stats_work, 0); | |
| 2065 | 2055 | } | |
| @@ -2067,7 +2057,6 @@ static void mxl862xx_get_stats64(struct dsa_switch *ds, int port, | |||
| 2067 | 2057 | static const struct dsa_switch_ops mxl862xx_switch_ops = { | |
| 2068 | 2058 | .get_tag_protocol = mxl862xx_get_tag_protocol, | |
| 2069 | 2059 | .setup = mxl862xx_setup, | |
| 2070 | - | .teardown = mxl862xx_teardown, | |
| 2071 | 2060 | .port_setup = mxl862xx_port_setup, | |
| 2072 | 2061 | .port_teardown = mxl862xx_port_teardown, | |
| 2073 | 2062 | .phylink_get_caps = mxl862xx_phylink_get_caps, | |
| @@ -2142,6 +2131,7 @@ static int mxl862xx_probe(struct mdio_device *mdiodev) | |||
| 2142 | 2131 | err = dsa_register_switch(ds); | |
| 2143 | 2132 | if (err) { | |
| 2144 | 2133 | set_bit(MXL862XX_FLAG_WORK_STOPPED, &priv->flags); | |
| 2134 | + | cancel_delayed_work_sync(&priv->stats_work); | |
| 2145 | 2135 | mxl862xx_host_shutdown(priv); | |
| 2146 | 2136 | for (i = 0; i < MXL862XX_MAX_PORTS; i++) | |
| 2147 | 2137 | cancel_work_sync(&priv->ports[i].host_flood_work); | |
| @@ -2162,6 +2152,7 @@ static void mxl862xx_remove(struct mdio_device *mdiodev) | |||
| 2162 | 2152 | priv = ds->priv; | |
| 2163 | 2153 | ||
| 2164 | 2154 | set_bit(MXL862XX_FLAG_WORK_STOPPED, &priv->flags); | |
| 2155 | + | cancel_delayed_work_sync(&priv->stats_work); | |
| 2165 | 2156 | ||
| 2166 | 2157 | dsa_unregister_switch(ds); | |
| 2167 | 2158 | ||
| @@ -2190,7 +2181,7 @@ static void mxl862xx_shutdown(struct mdio_device *mdiodev) | |||
| 2190 | 2181 | dsa_switch_shutdown(ds); | |
| 2191 | 2182 | ||
| 2192 | 2183 | set_bit(MXL862XX_FLAG_WORK_STOPPED, &priv->flags); | |
| 2193 | - | disable_delayed_work_sync(&priv->stats_work); | |
| 2184 | + | cancel_delayed_work_sync(&priv->stats_work); | |
| 2194 | 2185 | ||
| 2195 | 2186 | mxl862xx_host_shutdown(priv); | |
| 2196 | 2187 | ||
modified drivers/net/ethernet/airoha/airoha_npu.c
| @@ -5,7 +5,6 @@ | |||
| 5 | 5 | */ | |
| 6 | 6 | ||
| 7 | 7 | #include <linux/devcoredump.h> | |
| 8 | - | #include <linux/devm-helpers.h> | |
| 9 | 8 | #include <linux/firmware.h> | |
| 10 | 9 | #include <linux/platform_device.h> | |
| 11 | 10 | #include <linux/of_net.h> | |
| @@ -752,15 +751,12 @@ static int airoha_npu_probe(struct platform_device *pdev) | |||
| 752 | 751 | if (irq < 0) | |
| 753 | 752 | return irq; | |
| 754 | 753 | ||
| 755 | - | err = devm_work_autocancel(dev, &core->wdt_work, | |
| 756 | - | airoha_npu_wdt_work); | |
| 757 | - | if (err) | |
| 758 | - | return err; | |
| 759 | - | ||
| 760 | 754 | err = devm_request_irq(dev, irq, airoha_npu_wdt_handler, | |
| 761 | 755 | IRQF_SHARED, "airoha-npu-wdt", core); | |
| 762 | 756 | if (err) | |
| 763 | 757 | return err; | |
| 758 | + | ||
| 759 | + | INIT_WORK(&core->wdt_work, airoha_npu_wdt_work); | |
| 764 | 760 | } | |
| 765 | 761 | ||
| 766 | 762 | /* wlan IRQ lines */ | |
| @@ -807,8 +803,18 @@ static int airoha_npu_probe(struct platform_device *pdev) | |||
| 807 | 803 | return 0; | |
| 808 | 804 | } | |
| 809 | 805 | ||
| 806 | + | static void airoha_npu_remove(struct platform_device *pdev) | |
| 807 | + | { | |
| 808 | + | struct airoha_npu *npu = platform_get_drvdata(pdev); | |
| 809 | + | int i; | |
| 810 | + | ||
| 811 | + | for (i = 0; i < ARRAY_SIZE(npu->cores); i++) | |
| 812 | + | cancel_work_sync(&npu->cores[i].wdt_work); | |
| 813 | + | } | |
| 814 | + | ||
| 810 | 815 | static struct platform_driver airoha_npu_driver = { | |
| 811 | 816 | .probe = airoha_npu_probe, | |
| 817 | + | .remove = airoha_npu_remove, | |
| 812 | 818 | .driver = { | |
| 813 | 819 | .name = "airoha-npu", | |
| 814 | 820 | .of_match_table = of_airoha_npu_match, | |
modified drivers/net/ethernet/amazon/ena/ena_netdev.c
| @@ -4122,8 +4122,6 @@ err_worker_destroy: | |||
| 4122 | 4122 | err_device_destroy: | |
| 4123 | 4123 | ena_com_delete_host_info(ena_dev); | |
| 4124 | 4124 | ena_com_admin_destroy(ena_dev); | |
| 4125 | - | ena_phc_destroy(adapter); | |
| 4126 | - | ena_com_mmio_reg_read_request_destroy(ena_dev); | |
| 4127 | 4125 | ena_devlink_destroy: | |
| 4128 | 4126 | ena_devlink_free(devlink); | |
| 4129 | 4127 | err_metrics_destroy: | |
modified drivers/net/ethernet/atheros/atl1c/atl1c_main.c
| @@ -1602,9 +1602,6 @@ static int atl1c_clean_tx(struct napi_struct *napi, int budget) | |||
| 1602 | 1602 | AT_READ_REGW(&adapter->hw, atl1c_qregs[tpd_ring->num].tpd_cons, | |
| 1603 | 1603 | &hw_next_to_clean); | |
| 1604 | 1604 | ||
| 1605 | - | if (unlikely(hw_next_to_clean >= tpd_ring->count)) | |
| 1606 | - | hw_next_to_clean = next_to_clean; | |
| 1607 | - | ||
| 1608 | 1605 | while (next_to_clean != hw_next_to_clean) { | |
| 1609 | 1606 | buffer_info = &tpd_ring->buffer_info[next_to_clean]; | |
| 1610 | 1607 | if (buffer_info->skb) { | |
modified drivers/net/ethernet/atheros/atl1e/atl1e_main.c
| @@ -1234,9 +1234,6 @@ static bool atl1e_clean_tx_irq(struct atl1e_adapter *adapter) | |||
| 1234 | 1234 | u16 hw_next_to_clean = AT_READ_REGW(&adapter->hw, REG_TPD_CONS_IDX); | |
| 1235 | 1235 | u16 next_to_clean = atomic_read(&tx_ring->next_to_clean); | |
| 1236 | 1236 | ||
| 1237 | - | if (unlikely(hw_next_to_clean >= tx_ring->count)) | |
| 1238 | - | hw_next_to_clean = next_to_clean; | |
| 1239 | - | ||
| 1240 | 1237 | while (next_to_clean != hw_next_to_clean) { | |
| 1241 | 1238 | tx_buffer = &tx_ring->tx_buffer[next_to_clean]; | |
| 1242 | 1239 | if (tx_buffer->dma) { | |
modified drivers/net/ethernet/atheros/atlx/atl1.c
| @@ -2066,9 +2066,6 @@ static int atl1_intr_tx(struct atl1_adapter *adapter) | |||
| 2066 | 2066 | sw_tpd_next_to_clean = atomic_read(&tpd_ring->next_to_clean); | |
| 2067 | 2067 | cmb_tpd_next_to_clean = le16_to_cpu(adapter->cmb.cmb->tpd_cons_idx); | |
| 2068 | 2068 | ||
| 2069 | - | if (unlikely(cmb_tpd_next_to_clean >= tpd_ring->count)) | |
| 2070 | - | cmb_tpd_next_to_clean = sw_tpd_next_to_clean; | |
| 2071 | - | ||
| 2072 | 2069 | while (cmb_tpd_next_to_clean != sw_tpd_next_to_clean) { | |
| 2073 | 2070 | buffer_info = &tpd_ring->buffer_info[sw_tpd_next_to_clean]; | |
| 2074 | 2071 | if (buffer_info->dma) { | |
modified drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
| @@ -5733,8 +5733,7 @@ const struct ethtool_ops bnxt_ethtool_ops = { | |||
| 5733 | 5733 | .op_needs_rtnl = ETHTOOL_OP_NEEDS_RTNL_SCHANNELS | | |
| 5734 | 5734 | ETHTOOL_OP_NEEDS_RTNL_SRINGPARAM | | |
| 5735 | 5735 | ETHTOOL_OP_NEEDS_RTNL_SCOALESCE | | |
| 5736 | - | ETHTOOL_OP_NEEDS_RTNL_RSS | | |
| 5737 | - | ETHTOOL_OP_NEEDS_RTNL_TEST, | |
| 5736 | + | ETHTOOL_OP_NEEDS_RTNL_RSS, | |
| 5738 | 5737 | .supported_coalesce_params = ETHTOOL_COALESCE_USECS | | |
| 5739 | 5738 | ETHTOOL_COALESCE_MAX_FRAMES | | |
| 5740 | 5739 | ETHTOOL_COALESCE_USECS_IRQ | | |
modified drivers/net/ethernet/broadcom/genet/bcmgenet.c
| @@ -749,17 +749,8 @@ static void bcmgenet_hfb_init(struct bcmgenet_priv *priv) | |||
| 749 | 749 | INIT_LIST_HEAD(&priv->rxnfc_rules[i].list); | |
| 750 | 750 | priv->rxnfc_rules[i].state = BCMGENET_RXNFC_STATE_UNUSED; | |
| 751 | 751 | } | |
| 752 | - | } | |
| 753 | - | ||
| 754 | - | static void bcmgenet_hfb_restore(struct bcmgenet_priv *priv) | |
| 755 | - | { | |
| 756 | - | struct bcmgenet_rxnfc_rule *rule; | |
| 757 | 752 | ||
| 758 | 753 | bcmgenet_hfb_clear(priv); | |
| 759 | - | ||
| 760 | - | list_for_each_entry(rule, &priv->rxnfc_list, list) | |
| 761 | - | if (rule->state != BCMGENET_RXNFC_STATE_UNUSED) | |
| 762 | - | bcmgenet_hfb_create_rxnfc_filter(priv, rule); | |
| 763 | 754 | } | |
| 764 | 755 | ||
| 765 | 756 | static int bcmgenet_begin(struct net_device *dev) | |
| @@ -852,8 +843,7 @@ static int bcmgenet_get_coalesce(struct net_device *dev, | |||
| 852 | 843 | ec->rx_max_coalesced_frames = | |
| 853 | 844 | bcmgenet_rdma_ring_readl(priv, 0, DMA_MBUF_DONE_THRESH); | |
| 854 | 845 | ec->rx_coalesce_usecs = | |
| 855 | - | (bcmgenet_rdma_readl(priv, DMA_RING0_TIMEOUT) & | |
| 856 | - | DMA_TIMEOUT_MASK) * 8192 / 1000; | |
| 846 | + | bcmgenet_rdma_readl(priv, DMA_RING0_TIMEOUT) * 8192 / 1000; | |
| 857 | 847 | ||
| 858 | 848 | for (i = 0; i <= priv->hw_params->rx_queues; i++) { | |
| 859 | 849 | ring = &priv->rx_rings[i]; | |
| @@ -1347,8 +1337,9 @@ static void bcmgenet_get_ethtool_stats(struct net_device *dev, | |||
| 1347 | 1337 | p = (char *)&stats64; | |
| 1348 | 1338 | ||
| 1349 | 1339 | p += s->stat_offset; | |
| 1350 | - | if (s->stat_sizeof == sizeof(u64)) | |
| 1351 | - | data[i] = *(u64 *)p; | |
| 1340 | + | if (sizeof(unsigned long) != sizeof(u32) && | |
| 1341 | + | s->stat_sizeof == sizeof(unsigned long)) | |
| 1342 | + | data[i] = *(unsigned long *)p; | |
| 1352 | 1343 | else | |
| 1353 | 1344 | data[i] = *(u32 *)p; | |
| 1354 | 1345 | } | |
| @@ -1763,12 +1754,13 @@ static int bcmgenet_power_up(struct bcmgenet_priv *priv, | |||
| 1763 | 1754 | int ret = 0; | |
| 1764 | 1755 | u32 reg; | |
| 1765 | 1756 | ||
| 1757 | + | if (!bcmgenet_has_ext(priv)) | |
| 1758 | + | return ret; | |
| 1759 | + | ||
| 1760 | + | reg = bcmgenet_ext_readl(priv, EXT_EXT_PWR_MGMT); | |
| 1761 | + | ||
| 1766 | 1762 | switch (mode) { | |
| 1767 | 1763 | case GENET_POWER_PASSIVE: | |
| 1768 | - | if (!bcmgenet_has_ext(priv)) | |
| 1769 | - | break; | |
| 1770 | - | ||
| 1771 | - | reg = bcmgenet_ext_readl(priv, EXT_EXT_PWR_MGMT); | |
| 1772 | 1764 | reg &= ~(EXT_PWR_DOWN_DLL | EXT_PWR_DOWN_BIAS | | |
| 1773 | 1765 | EXT_ENERGY_DET_MASK); | |
| 1774 | 1766 | if (GENET_IS_V5(priv) && !bcmgenet_has_ephy_16nm(priv)) { | |
| @@ -1792,12 +1784,8 @@ static int bcmgenet_power_up(struct bcmgenet_priv *priv, | |||
| 1792 | 1784 | break; | |
| 1793 | 1785 | ||
| 1794 | 1786 | case GENET_POWER_CABLE_SENSE: | |
| 1795 | - | if (!bcmgenet_has_ext(priv)) | |
| 1796 | - | break; | |
| 1797 | - | ||
| 1798 | 1787 | /* enable APD */ | |
| 1799 | 1788 | if (!GENET_IS_V5(priv)) { | |
| 1800 | - | reg = bcmgenet_ext_readl(priv, EXT_EXT_PWR_MGMT); | |
| 1801 | 1789 | reg |= EXT_PWR_DN_EN_LD; | |
| 1802 | 1790 | bcmgenet_ext_writel(priv, reg, EXT_EXT_PWR_MGMT); | |
| 1803 | 1791 | } | |
| @@ -3388,8 +3376,8 @@ static int bcmgenet_open(struct net_device *dev) | |||
| 3388 | 3376 | ||
| 3389 | 3377 | bcmgenet_set_hw_addr(priv, dev->dev_addr); | |
| 3390 | 3378 | ||
| 3391 | - | /* Restore the filters, the MAC was reset above */ | |
| 3392 | - | bcmgenet_hfb_restore(priv); | |
| 3379 | + | /* HFB init */ | |
| 3380 | + | bcmgenet_hfb_init(priv); | |
| 3393 | 3381 | ||
| 3394 | 3382 | /* Reinitialize TDMA and RDMA and SW housekeeping */ | |
| 3395 | 3383 | ret = bcmgenet_init_dma(priv, true); | |
| @@ -3444,8 +3432,6 @@ static void bcmgenet_netif_stop(struct net_device *dev, bool stop_phy) | |||
| 3444 | 3432 | { | |
| 3445 | 3433 | struct bcmgenet_priv *priv = netdev_priv(dev); | |
| 3446 | 3434 | ||
| 3447 | - | /* Stop completion polling before it can wake a stopped queue */ | |
| 3448 | - | bcmgenet_disable_tx_napi(priv); | |
| 3449 | 3435 | netif_tx_disable(dev); | |
| 3450 | 3436 | ||
| 3451 | 3437 | /* Disable MAC receive */ | |
| @@ -3460,6 +3446,7 @@ static void bcmgenet_netif_stop(struct net_device *dev, bool stop_phy) | |||
| 3460 | 3446 | /* Disable MAC transmit. TX DMA disabled must be done before this */ | |
| 3461 | 3447 | umac_enable_set(priv, CMD_TX_EN, false); | |
| 3462 | 3448 | ||
| 3449 | + | bcmgenet_disable_tx_napi(priv); | |
| 3463 | 3450 | bcmgenet_disable_rx_napi(priv); | |
| 3464 | 3451 | bcmgenet_intr_disable(priv); | |
| 3465 | 3452 | ||
| @@ -3636,9 +3623,6 @@ static int bcmgenet_set_mac_addr(struct net_device *dev, void *p) | |||
| 3636 | 3623 | if (netif_running(dev)) | |
| 3637 | 3624 | return -EBUSY; | |
| 3638 | 3625 | ||
| 3639 | - | if (!is_valid_ether_addr(addr->sa_data)) | |
| 3640 | - | return -EADDRNOTAVAIL; | |
| 3641 | - | ||
| 3642 | 3626 | eth_hw_addr_set(dev, addr->sa_data); | |
| 3643 | 3627 | ||
| 3644 | 3628 | return 0; | |
| @@ -4091,7 +4075,6 @@ static int bcmgenet_probe(struct platform_device *pdev) | |||
| 4091 | 4075 | ||
| 4092 | 4076 | /* Mii wait queue */ | |
| 4093 | 4077 | init_waitqueue_head(&priv->wq); | |
| 4094 | - | bcmgenet_hfb_init(priv); | |
| 4095 | 4078 | INIT_WORK(&priv->bcmgenet_irq_work, bcmgenet_irq_task); | |
| 4096 | 4079 | ||
| 4097 | 4080 | priv->clk_wol = devm_clk_get_optional(&priv->pdev->dev, "enet-wol"); | |
| @@ -4142,10 +4125,10 @@ static int bcmgenet_probe(struct platform_device *pdev) | |||
| 4142 | 4125 | priv->rx_rings[i].rx_max_coalesced_frames = 1; | |
| 4143 | 4126 | ||
| 4144 | 4127 | /* Initialize u64 stats seq counter for 32bit machines */ | |
| 4145 | - | for (i = 0; i <= GENET_MAX_MQ_CNT; i++) { | |
| 4128 | + | for (i = 0; i <= priv->hw_params->rx_queues; i++) | |
| 4146 | 4129 | u64_stats_init(&priv->rx_rings[i].stats64.syncp); | |
| 4130 | + | for (i = 0; i <= priv->hw_params->tx_queues; i++) | |
| 4147 | 4131 | u64_stats_init(&priv->tx_rings[i].stats64.syncp); | |
| 4148 | - | } | |
| 4149 | 4132 | ||
| 4150 | 4133 | /* libphy will determine the link state */ | |
| 4151 | 4134 | netif_carrier_off(dev); | |
| @@ -4289,7 +4272,10 @@ static int bcmgenet_resume(struct device *d) | |||
| 4289 | 4272 | bcmgenet_set_hw_addr(priv, dev->dev_addr); | |
| 4290 | 4273 | ||
| 4291 | 4274 | /* Restore hardware filters */ | |
| 4292 | - | bcmgenet_hfb_restore(priv); | |
| 4275 | + | bcmgenet_hfb_clear(priv); | |
| 4276 | + | list_for_each_entry(rule, &priv->rxnfc_list, list) | |
| 4277 | + | if (rule->state != BCMGENET_RXNFC_STATE_UNUSED) | |
| 4278 | + | bcmgenet_hfb_create_rxnfc_filter(priv, rule); | |
| 4293 | 4279 | ||
| 4294 | 4280 | /* Reinitialize TDMA and RDMA and SW housekeeping */ | |
| 4295 | 4281 | ret = bcmgenet_init_dma(priv, false); | |
| @@ -4327,8 +4313,6 @@ static int bcmgenet_suspend(struct device *d) | |||
| 4327 | 4313 | netif_device_detach(dev); | |
| 4328 | 4314 | ||
| 4329 | 4315 | if (device_may_wakeup(d) && priv->wolopts) { | |
| 4330 | - | /* Stop completion polling before it can wake a stopped queue */ | |
| 4331 | - | bcmgenet_disable_tx_napi(priv); | |
| 4332 | 4316 | netif_tx_disable(dev); | |
| 4333 | 4317 | ||
| 4334 | 4318 | /* Suspend non-wake Rx data flows */ | |
| @@ -4357,6 +4341,7 @@ static int bcmgenet_suspend(struct device *d) | |||
| 4357 | 4341 | netdev_warn(priv->dev, | |
| 4358 | 4342 | "Timed out while disabling TX DMA\n"); | |
| 4359 | 4343 | ||
| 4344 | + | bcmgenet_disable_tx_napi(priv); | |
| 4360 | 4345 | bcmgenet_disable_rx_napi(priv); | |
| 4361 | 4346 | disable_irq(priv->irq1); | |
| 4362 | 4347 | bcmgenet_tx_reclaim_all(dev); | |
modified drivers/net/ethernet/broadcom/tg3.c
| @@ -17915,14 +17915,11 @@ static int tg3_init_one(struct pci_dev *pdev, | |||
| 17915 | 17915 | ||
| 17916 | 17916 | err = tg3_get_device_address(tp, addr); | |
| 17917 | 17917 | if (err) { | |
| 17918 | - | dev_warn_probe(&pdev->dev, err, | |
| 17919 | - | "Could not obtain a valid ethernet address\n"); | |
| 17920 | - | if (err == -EPROBE_DEFER) | |
| 17921 | - | goto err_out_apeunmap; | |
| 17922 | - | eth_hw_addr_random(dev); | |
| 17923 | - | } else { | |
| 17924 | - | eth_hw_addr_set(dev, addr); | |
| 17918 | + | dev_err(&pdev->dev, | |
| 17919 | + | "Could not obtain valid ethernet address, aborting\n"); | |
| 17920 | + | goto err_out_apeunmap; | |
| 17925 | 17921 | } | |
| 17922 | + | eth_hw_addr_set(dev, addr); | |
| 17926 | 17923 | ||
| 17927 | 17924 | intmbx = MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW; | |
| 17928 | 17925 | rcvmbx = MAILBOX_RCVRET_CON_IDX_0 + TG3_64BIT_REG_LOW; | |
| @@ -18050,10 +18047,6 @@ static int tg3_init_one(struct pci_dev *pdev, | |||
| 18050 | 18047 | return 0; | |
| 18051 | 18048 | ||
| 18052 | 18049 | err_out_apeunmap: | |
| 18053 | - | if (tg3_flag(tp, USE_PHYLIB)) | |
| 18054 | - | tg3_phy_fini(tp); | |
| 18055 | - | tg3_mdio_fini(tp); | |
| 18056 | - | ||
| 18057 | 18050 | if (tp->aperegs) { | |
| 18058 | 18051 | iounmap(tp->aperegs); | |
| 18059 | 18052 | tp->aperegs = NULL; | |
modified drivers/net/ethernet/brocade/bna/bnad.c
| @@ -2571,22 +2571,6 @@ bnad_ioceth_disable(struct bnad *bnad) | |||
| 2571 | 2571 | return err; | |
| 2572 | 2572 | } | |
| 2573 | 2573 | ||
| 2574 | - | /* | |
| 2575 | - | * The IOC timers rearm one another, so deleting one cannot stop a | |
| 2576 | - | * sibling callback from arming it again. Shut them down so a later | |
| 2577 | - | * mod_timer() is ignored. | |
| 2578 | - | */ | |
| 2579 | - | static void | |
| 2580 | - | bnad_ioc_timers_shutdown(struct bnad *bnad) | |
| 2581 | - | { | |
| 2582 | - | struct bfa_ioc *ioc = &bnad->bna.ioceth.ioc; | |
| 2583 | - | ||
| 2584 | - | timer_shutdown_sync(&ioc->ioc_timer); | |
| 2585 | - | timer_shutdown_sync(&ioc->sem_timer); | |
| 2586 | - | timer_shutdown_sync(&ioc->hb_timer); | |
| 2587 | - | timer_shutdown_sync(&ioc->iocpf_timer); | |
| 2588 | - | } | |
| 2589 | - | ||
| 2590 | 2574 | static int | |
| 2591 | 2575 | bnad_ioceth_enable(struct bnad *bnad) | |
| 2592 | 2576 | { | |
| @@ -3743,7 +3727,9 @@ probe_uninit: | |||
| 3743 | 3727 | bnad_res_free(bnad, &bnad->mod_res_info[0], BNA_MOD_RES_T_MAX); | |
| 3744 | 3728 | disable_ioceth: | |
| 3745 | 3729 | bnad_ioceth_disable(bnad); | |
| 3746 | - | bnad_ioc_timers_shutdown(bnad); | |
| 3730 | + | timer_delete_sync(&bnad->bna.ioceth.ioc.ioc_timer); | |
| 3731 | + | timer_delete_sync(&bnad->bna.ioceth.ioc.sem_timer); | |
| 3732 | + | timer_delete_sync(&bnad->bna.ioceth.ioc.hb_timer); | |
| 3747 | 3733 | spin_lock_irqsave(&bnad->bna_lock, flags); | |
| 3748 | 3734 | bna_uninit(bna); | |
| 3749 | 3735 | spin_unlock_irqrestore(&bnad->bna_lock, flags); | |
| @@ -3784,7 +3770,9 @@ bnad_pci_remove(struct pci_dev *pdev) | |||
| 3784 | 3770 | ||
| 3785 | 3771 | mutex_lock(&bnad->conf_mutex); | |
| 3786 | 3772 | bnad_ioceth_disable(bnad); | |
| 3787 | - | bnad_ioc_timers_shutdown(bnad); | |
| 3773 | + | timer_delete_sync(&bnad->bna.ioceth.ioc.ioc_timer); | |
| 3774 | + | timer_delete_sync(&bnad->bna.ioceth.ioc.sem_timer); | |
| 3775 | + | timer_delete_sync(&bnad->bna.ioceth.ioc.hb_timer); | |
| 3788 | 3776 | spin_lock_irqsave(&bnad->bna_lock, flags); | |
| 3789 | 3777 | bna_uninit(bna); | |
| 3790 | 3778 | spin_unlock_irqrestore(&bnad->bna_lock, flags); | |
modified drivers/net/ethernet/cadence/macb_main.c
| @@ -2749,24 +2749,14 @@ static int macb_alloc(struct macb *bp) | |||
| 2749 | 2749 | ||
| 2750 | 2750 | size = bp->num_queues * macb_tx_ring_size_per_queue(bp); | |
| 2751 | 2751 | tx = dma_alloc_coherent(dev, size, &tx_dma, GFP_KERNEL); | |
| 2752 | - | if (!tx) | |
| 2753 | - | goto out_err; | |
| 2754 | - | /* Record the buffer so that the error path frees it. */ | |
| 2755 | - | bp->queues[0].tx_ring = tx; | |
| 2756 | - | bp->queues[0].tx_ring_dma = tx_dma; | |
| 2757 | - | if (upper_32_bits(tx_dma) != upper_32_bits(tx_dma + size - 1)) | |
| 2752 | + | if (!tx || upper_32_bits(tx_dma) != upper_32_bits(tx_dma + size - 1)) | |
| 2758 | 2753 | goto out_err; | |
| 2759 | 2754 | netdev_dbg(bp->netdev, "Allocated %zu bytes for %u TX rings at %08lx (mapped %p)\n", | |
| 2760 | 2755 | size, bp->num_queues, (unsigned long)tx_dma, tx); | |
| 2761 | 2756 | ||
| 2762 | 2757 | size = bp->num_queues * macb_rx_ring_size_per_queue(bp); | |
| 2763 | 2758 | rx = dma_alloc_coherent(dev, size, &rx_dma, GFP_KERNEL); | |
| 2764 | - | if (!rx) | |
| 2765 | - | goto out_err; | |
| 2766 | - | /* Record the buffer so that the error path frees it. */ | |
| 2767 | - | bp->queues[0].rx_ring = rx; | |
| 2768 | - | bp->queues[0].rx_ring_dma = rx_dma; | |
| 2769 | - | if (upper_32_bits(rx_dma) != upper_32_bits(rx_dma + size - 1)) | |
| 2759 | + | if (!rx || upper_32_bits(rx_dma) != upper_32_bits(rx_dma + size - 1)) | |
| 2770 | 2760 | goto out_err; | |
| 2771 | 2761 | netdev_dbg(bp->netdev, "Allocated %zu bytes for %u RX rings at %08lx (mapped %p)\n", | |
| 2772 | 2762 | size, bp->num_queues, (unsigned long)rx_dma, rx); | |
modified drivers/net/ethernet/cadence/macb_ptp.c
| @@ -50,12 +50,7 @@ static int gem_tsu_get_time(struct ptp_clock_info *ptp, struct timespec64 *ts, | |||
| 50 | 50 | ||
| 51 | 51 | spin_lock_irqsave(&bp->tsu_clk_lock, flags); | |
| 52 | 52 | ptp_read_system_prets(sts); | |
| 53 | - | /* explicit barriers are needed because gem_readl() is relaxed */ | |
| 54 | - | if (sts) | |
| 55 | - | rmb(); | |
| 56 | 53 | first = gem_readl(bp, TN); | |
| 57 | - | if (sts) | |
| 58 | - | rmb(); | |
| 59 | 54 | ptp_read_system_postts(sts); | |
| 60 | 55 | secl = gem_readl(bp, TSL); | |
| 61 | 56 | sech = gem_readl(bp, TSH); | |
| @@ -67,11 +62,7 @@ static int gem_tsu_get_time(struct ptp_clock_info *ptp, struct timespec64 *ts, | |||
| 67 | 62 | * (assume all done within 1s) | |
| 68 | 63 | */ | |
| 69 | 64 | ptp_read_system_prets(sts); | |
| 70 | - | if (sts) | |
| 71 | - | rmb(); | |
| 72 | 65 | ts->tv_nsec = gem_readl(bp, TN); | |
| 73 | - | if (sts) | |
| 74 | - | rmb(); | |
| 75 | 66 | ptp_read_system_postts(sts); | |
| 76 | 67 | secl = gem_readl(bp, TSL); | |
| 77 | 68 | sech = gem_readl(bp, TSH); | |
modified drivers/net/ethernet/cortina/gemini.c
| @@ -1798,7 +1798,7 @@ static irqreturn_t gmac_irq(int irq, void *data) | |||
| 1798 | 1798 | ||
| 1799 | 1799 | if (val & (GMAC0_RX_OVERRUN_INT_BIT << (netdev->dev_id * 8))) { | |
| 1800 | 1800 | spin_lock(&geth->irq_lock); | |
| 1801 | - | writel(GMAC0_RX_OVERRUN_INT_BIT << (netdev->dev_id * 8), | |
| 1801 | + | writel(GMAC0_RXDERR_INT_BIT << (netdev->dev_id * 8), | |
| 1802 | 1802 | geth->base + GLOBAL_INTERRUPT_STATUS_4_REG); | |
| 1803 | 1803 | u64_stats_update_begin(&port->ir_stats_syncp); | |
| 1804 | 1804 | ++port->stats.rx_fifo_errors; | |
modified drivers/net/ethernet/freescale/fman/fman.c
| @@ -2734,7 +2734,6 @@ static struct fman *read_dts_node(struct platform_device *of_dev) | |||
| 2734 | 2734 | } | |
| 2735 | 2735 | ||
| 2736 | 2736 | clk_rate = clk_get_rate(clk); | |
| 2737 | - | clk_put(clk); | |
| 2738 | 2737 | if (!clk_rate) { | |
| 2739 | 2738 | err = -EINVAL; | |
| 2740 | 2739 | dev_err(&of_dev->dev, "%s: Failed to determine FM%d clock rate\n", | |
modified drivers/net/ethernet/google/gve/gve_desc_dqo.h
| @@ -14,11 +14,6 @@ | |||
| 14 | 14 | #define GVE_TX_MAX_HDR_SIZE_DQO 255 | |
| 15 | 15 | #define GVE_TX_MIN_TSO_MSS_DQO 88 | |
| 16 | 16 | ||
| 17 | - | /* HW limit. This also has to fit in the 14 bits of the mss field of | |
| 18 | - | * struct gve_tx_tso_context_desc_dqo. | |
| 19 | - | */ | |
| 20 | - | #define GVE_TX_MAX_TSO_MSS_DQO 9728 | |
| 21 | - | ||
| 22 | 17 | #ifndef __LITTLE_ENDIAN_BITFIELD | |
| 23 | 18 | #error "Only little endian supported" | |
| 24 | 19 | #endif | |
modified drivers/net/ethernet/google/gve/gve_tx_dqo.c
| @@ -577,18 +577,15 @@ static int gve_prep_tso(struct sk_buff *skb) | |||
| 577 | 577 | int header_len; | |
| 578 | 578 | int err; | |
| 579 | 579 | ||
| 580 | - | /* Note: HW requires the total length of the TSO to be <= 262143, | |
| 581 | - | * this is enforced by netif_set_tso_max_size(). | |
| 580 | + | /* Note: HW requires MSS (gso_size) to be <= 9728 and the total length | |
| 581 | + | * of the TSO to be <= 262143. | |
| 582 | 582 | * | |
| 583 | - | * MSS (gso_size) can not be trusted: packets forwarded from a tap or | |
| 584 | - | * injected by a packet socket can carry an arbitrary value, while the | |
| 585 | - | * mss field of the TSO context descriptor is only 14 bits wide. | |
| 586 | - | * | |
| 587 | - | * A too big MSS is dropped here instead of being rejected from | |
| 588 | - | * gve_features_check_dqo(), because software segmentation would | |
| 589 | - | * produce packets larger than the device can send. | |
| 583 | + | * However, we don't validate these because: | |
| 584 | + | * - Hypervisor enforces a limit of 9K MTU | |
| 585 | + | * - Kernel will not produce a TSO larger than 64k | |
| 590 | 586 | */ | |
| 591 | - | if (unlikely(shinfo->gso_size > GVE_TX_MAX_TSO_MSS_DQO)) | |
| 587 | + | ||
| 588 | + | if (unlikely(shinfo->gso_size < GVE_TX_MIN_TSO_MSS_DQO)) | |
| 592 | 589 | return -1; | |
| 593 | 590 | ||
| 594 | 591 | /* Needed because we will modify header. */ | |
| @@ -921,22 +918,13 @@ static bool gve_can_send_tso(const struct sk_buff *skb) | |||
| 921 | 918 | { | |
| 922 | 919 | const int max_bufs_per_seg = GVE_TX_MAX_DATA_DESCS - 1; | |
| 923 | 920 | const struct skb_shared_info *shinfo = skb_shinfo(skb); | |
| 921 | + | const int header_len = skb_tcp_all_headers(skb); | |
| 924 | 922 | const int gso_size = shinfo->gso_size; | |
| 925 | 923 | int cur_seg_num_bufs; | |
| 926 | 924 | int prev_frag_size; | |
| 927 | 925 | int cur_seg_size; | |
| 928 | - | int header_len; | |
| 929 | 926 | int i; | |
| 930 | 927 | ||
| 931 | - | if (unlikely(gso_size < GVE_TX_MIN_TSO_MSS_DQO)) | |
| 932 | - | return false; | |
| 933 | - | ||
| 934 | - | /* Must match the header length programmed by gve_prep_tso(). */ | |
| 935 | - | if (skb_is_gso_tcp(skb)) | |
| 936 | - | header_len = skb_tcp_all_headers(skb); | |
| 937 | - | else | |
| 938 | - | header_len = skb_transport_offset(skb) + sizeof(struct udphdr); | |
| 939 | - | ||
| 940 | 928 | cur_seg_size = skb_headlen(skb) - header_len; | |
| 941 | 929 | prev_frag_size = skb_headlen(skb); | |
| 942 | 930 | cur_seg_num_bufs = cur_seg_size > 0; | |
| @@ -978,17 +966,7 @@ netdev_features_t gve_features_check_dqo(struct sk_buff *skb, | |||
| 978 | 966 | struct net_device *dev, | |
| 979 | 967 | netdev_features_t features) | |
| 980 | 968 | { | |
| 981 | - | if (!skb_is_gso(skb)) | |
| 982 | - | return features; | |
| 983 | - | ||
| 984 | - | /* Keep the GSO bits for a too big MSS, so that gve_prep_tso() drops | |
| 985 | - | * the packet: software segmentation would give packets larger than | |
| 986 | - | * the device can send. | |
| 987 | - | */ | |
| 988 | - | if (skb_shinfo(skb)->gso_size > GVE_TX_MAX_TSO_MSS_DQO) | |
| 989 | - | return features; | |
| 990 | - | ||
| 991 | - | if (!gve_can_send_tso(skb)) | |
| 969 | + | if (skb_is_gso(skb) && !gve_can_send_tso(skb)) | |
| 992 | 970 | return features & ~NETIF_F_GSO_MASK; | |
| 993 | 971 | ||
| 994 | 972 | return features; | |
modified drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c
| @@ -793,7 +793,6 @@ static int hns_mac_register_phy(struct hns_mac_cb *mac_cb) | |||
| 793 | 793 | dev_err(mac_cb->dev, | |
| 794 | 794 | "mac%d mdio is NULL, dsaf will probe again later\n", | |
| 795 | 795 | mac_cb->mac_id); | |
| 796 | - | put_device(&pdev->dev); | |
| 797 | 796 | return -EPROBE_DEFER; | |
| 798 | 797 | } | |
| 799 | 798 | ||
| @@ -802,8 +801,6 @@ static int hns_mac_register_phy(struct hns_mac_cb *mac_cb) | |||
| 802 | 801 | dev_dbg(mac_cb->dev, "mac%d register phy addr:%d\n", | |
| 803 | 802 | mac_cb->mac_id, addr); | |
| 804 | 803 | ||
| 805 | - | put_device(&pdev->dev); | |
| 806 | - | ||
| 807 | 804 | return rc; | |
| 808 | 805 | } | |
| 809 | 806 | ||
modified drivers/net/ethernet/ibm/emac/core.c
| @@ -3044,15 +3044,6 @@ static int emac_probe(struct platform_device *ofdev) | |||
| 3044 | 3044 | if (err) | |
| 3045 | 3045 | goto err_gone; | |
| 3046 | 3046 | ||
| 3047 | - | if (emac_phy_supports_gige(dev->phy_mode)) { | |
| 3048 | - | ndev->netdev_ops = &emac_gige_netdev_ops; | |
| 3049 | - | dev->commac.ops = &emac_commac_sg_ops; | |
| 3050 | - | } else { | |
| 3051 | - | ndev->netdev_ops = &emac_netdev_ops; | |
| 3052 | - | dev->commac.ops = &emac_commac_ops; | |
| 3053 | - | } | |
| 3054 | - | ndev->ethtool_ops = &emac_ethtool_ops; | |
| 3055 | - | ||
| 3056 | 3047 | dev->emacp = devm_platform_ioremap_resource(ofdev, 0); | |
| 3057 | 3048 | if (IS_ERR(dev->emacp)) { | |
| 3058 | 3049 | err = PTR_ERR(dev->emacp); | |
| @@ -3085,6 +3076,7 @@ static int emac_probe(struct platform_device *ofdev) | |||
| 3085 | 3076 | dev->mdio_instance = platform_get_drvdata(dev->mdio_dev); | |
| 3086 | 3077 | ||
| 3087 | 3078 | /* Register with MAL */ | |
| 3079 | + | dev->commac.ops = &emac_commac_ops; | |
| 3088 | 3080 | dev->commac.dev = dev; | |
| 3089 | 3081 | dev->commac.tx_chan_mask = MAL_CHAN_MASK(dev->mal_tx_chan); | |
| 3090 | 3082 | dev->commac.rx_chan_mask = MAL_CHAN_MASK(dev->mal_rx_chan); | |
| @@ -3152,6 +3144,12 @@ static int emac_probe(struct platform_device *ofdev) | |||
| 3152 | 3144 | ndev->features |= ndev->hw_features | NETIF_F_RXCSUM; | |
| 3153 | 3145 | } | |
| 3154 | 3146 | ndev->watchdog_timeo = 5 * HZ; | |
| 3147 | + | if (emac_phy_supports_gige(dev->phy_mode)) { | |
| 3148 | + | ndev->netdev_ops = &emac_gige_netdev_ops; | |
| 3149 | + | dev->commac.ops = &emac_commac_sg_ops; | |
| 3150 | + | } else | |
| 3151 | + | ndev->netdev_ops = &emac_netdev_ops; | |
| 3152 | + | ndev->ethtool_ops = &emac_ethtool_ops; | |
| 3155 | 3153 | ||
| 3156 | 3154 | /* MTU range: 46 - 1500 or whatever is in OF */ | |
| 3157 | 3155 | ndev->min_mtu = EMAC_MIN_MTU; | |
modified drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
| @@ -5086,8 +5086,7 @@ static int mvpp2_change_mtu(struct net_device *dev, int mtu) | |||
| 5086 | 5086 | netdev_warn(dev, "mtu %d too high, switching to shared buffers", mtu); | |
| 5087 | 5087 | mvpp2_bm_switch_buffers(priv, false); | |
| 5088 | 5088 | } | |
| 5089 | - | } else if (priv->hw_version >= MVPP22 && | |
| 5090 | - | mvpp2_get_nrxqs(priv) * 2 <= MVPP2_BM_MAX_POOLS) { | |
| 5089 | + | } else { | |
| 5091 | 5090 | bool jumbo = false; | |
| 5092 | 5091 | int i; | |
| 5093 | 5092 | ||
modified drivers/net/ethernet/marvell/octeontx2/af/common.h
| @@ -7,10 +7,6 @@ | |||
| 7 | 7 | #ifndef COMMON_H | |
| 8 | 8 | #define COMMON_H | |
| 9 | 9 | ||
| 10 | - | #include <linux/dma-mapping.h> | |
| 11 | - | #include <linux/gfp.h> | |
| 12 | - | #include <linux/mm.h> | |
| 13 | - | ||
| 14 | 10 | #include "rvu_struct.h" | |
| 15 | 11 | ||
| 16 | 12 | #define OTX2_ALIGN 128 /* Align to cacheline */ | |
| @@ -48,33 +44,6 @@ struct qmem { | |||
| 48 | 44 | u32 qsize; | |
| 49 | 45 | }; | |
| 50 | 46 | ||
| 51 | - | static inline void *otx2_dma_alloc_coherent(struct device *dev, size_t size, | |
| 52 | - | dma_addr_t *dma_handle) | |
| 53 | - | { | |
| 54 | - | dma_addr_t dma_addr; | |
| 55 | - | void *vaddr; | |
| 56 | - | ||
| 57 | - | vaddr = kzalloc(size, GFP_KERNEL); | |
| 58 | - | if (!vaddr) | |
| 59 | - | return NULL; | |
| 60 | - | ||
| 61 | - | dma_addr = dma_map_single(dev, vaddr, size, DMA_BIDIRECTIONAL); | |
| 62 | - | if (dma_mapping_error(dev, dma_addr)) { | |
| 63 | - | kfree(vaddr); | |
| 64 | - | return NULL; | |
| 65 | - | } | |
| 66 | - | ||
| 67 | - | *dma_handle = dma_addr; | |
| 68 | - | return vaddr; | |
| 69 | - | } | |
| 70 | - | ||
| 71 | - | static inline void otx2_dma_free_coherent(struct device *dev, size_t size, | |
| 72 | - | void *vaddr, dma_addr_t dma_handle) | |
| 73 | - | { | |
| 74 | - | dma_unmap_single(dev, dma_handle, size, DMA_BIDIRECTIONAL); | |
| 75 | - | kfree(vaddr); | |
| 76 | - | } | |
| 77 | - | ||
| 78 | 47 | static inline int qmem_alloc(struct device *dev, struct qmem **q, | |
| 79 | 48 | int qsize, int entry_sz) | |
| 80 | 49 | { | |
| @@ -91,11 +60,8 @@ static inline int qmem_alloc(struct device *dev, struct qmem **q, | |||
| 91 | 60 | ||
| 92 | 61 | qmem->entry_sz = entry_sz; | |
| 93 | 62 | qmem->alloc_sz = (qsize * entry_sz) + OTX2_ALIGN; | |
| 94 | - | ||
| 95 | - | if (get_order(PAGE_ALIGN(qmem->alloc_sz)) > MAX_PAGE_ORDER) | |
| 96 | - | return -ENOMEM; | |
| 97 | - | ||
| 98 | - | qmem->base = otx2_dma_alloc_coherent(dev, qmem->alloc_sz, &qmem->iova); | |
| 63 | + | qmem->base = dma_alloc_attrs(dev, qmem->alloc_sz, &qmem->iova, | |
| 64 | + | GFP_KERNEL, DMA_ATTR_FORCE_CONTIGUOUS); | |
| 99 | 65 | if (!qmem->base) | |
| 100 | 66 | return -ENOMEM; | |
| 101 | 67 | ||
| @@ -114,9 +80,10 @@ static inline void qmem_free(struct device *dev, struct qmem *qmem) | |||
| 114 | 80 | return; | |
| 115 | 81 | ||
| 116 | 82 | if (qmem->base) | |
| 117 | - | otx2_dma_free_coherent(dev, qmem->alloc_sz, | |
| 118 | - | qmem->base - qmem->align, | |
| 119 | - | qmem->iova - qmem->align); | |
| 83 | + | dma_free_attrs(dev, qmem->alloc_sz, | |
| 84 | + | qmem->base - qmem->align, | |
| 85 | + | qmem->iova - qmem->align, | |
| 86 | + | DMA_ATTR_FORCE_CONTIGUOUS); | |
| 120 | 87 | devm_kfree(dev, qmem); | |
| 121 | 88 | } | |
| 122 | 89 | ||
modified drivers/net/ethernet/marvell/octeontx2/af/rvu_debugfs.c
| @@ -714,72 +714,110 @@ static int get_max_column_width(struct rvu *rvu) | |||
| 714 | 714 | } | |
| 715 | 715 | ||
| 716 | 716 | /* Dumps current provisioning status of all RVU block LFs */ | |
| 717 | - | static int rvu_dbg_rsrc_attach_status(struct seq_file *filp, void *unused) | |
| 717 | + | static ssize_t rvu_dbg_rsrc_attach_status(struct file *filp, | |
| 718 | + | char __user *buffer, | |
| 719 | + | size_t count, loff_t *ppos) | |
| 718 | 720 | { | |
| 719 | - | struct rvu *rvu = filp->private; | |
| 720 | - | int index, pf, vf, pcifunc; | |
| 721 | + | int index, off = 0, flag = 0, len = 0, i = 0; | |
| 722 | + | struct rvu *rvu = filp->private_data; | |
| 723 | + | int bytes_not_copied = 0; | |
| 721 | 724 | struct rvu_block block; | |
| 725 | + | int pf, vf, pcifunc; | |
| 726 | + | int buf_size = 2048; | |
| 722 | 727 | int lf_str_size; | |
| 723 | 728 | char *lfs; | |
| 729 | + | char *buf; | |
| 730 | + | ||
| 731 | + | /* don't allow partial reads */ | |
| 732 | + | if (*ppos != 0) | |
| 733 | + | return 0; | |
| 734 | + | ||
| 735 | + | buf = kzalloc(buf_size, GFP_KERNEL); | |
| 736 | + | if (!buf) | |
| 737 | + | return -ENOMEM; | |
| 724 | 738 | ||
| 739 | + | /* Get the maximum width of a column */ | |
| 725 | 740 | lf_str_size = get_max_column_width(rvu); | |
| 726 | - | if (lf_str_size < 0) | |
| 727 | - | return lf_str_size; | |
| 728 | 741 | ||
| 729 | 742 | lfs = kzalloc(lf_str_size, GFP_KERNEL); | |
| 730 | - | if (!lfs) | |
| 743 | + | if (!lfs) { | |
| 744 | + | kfree(buf); | |
| 731 | 745 | return -ENOMEM; | |
| 732 | - | ||
| 733 | - | seq_printf(filp, "%-*s", lf_str_size, "pcifunc"); | |
| 746 | + | } | |
| 747 | + | off += scnprintf(&buf[off], buf_size - 1 - off, "%-*s", lf_str_size, | |
| 748 | + | "pcifunc"); | |
| 734 | 749 | for (index = 0; index < BLK_COUNT; index++) | |
| 735 | - | if (strlen(rvu->hw->block[index].name)) | |
| 736 | - | seq_printf(filp, "%-*s", lf_str_size, | |
| 737 | - | rvu->hw->block[index].name); | |
| 750 | + | if (strlen(rvu->hw->block[index].name)) { | |
| 751 | + | off += scnprintf(&buf[off], buf_size - 1 - off, | |
| 752 | + | "%-*s", lf_str_size, | |
| 753 | + | rvu->hw->block[index].name); | |
| 754 | + | } | |
| 755 | + | ||
| 756 | + | off += scnprintf(&buf[off], buf_size - 1 - off, "\n"); | |
| 757 | + | bytes_not_copied = copy_to_user(buffer + (i * off), buf, off); | |
| 758 | + | if (bytes_not_copied) | |
| 759 | + | goto out; | |
| 738 | 760 | ||
| 739 | - | seq_putc(filp, '\n'); | |
| 761 | + | i++; | |
| 762 | + | *ppos += off; | |
| 740 | 763 | for (pf = 0; pf < rvu->hw->total_pfs; pf++) { | |
| 741 | 764 | for (vf = 0; vf <= rvu->hw->total_vfs; vf++) { | |
| 765 | + | off = 0; | |
| 766 | + | flag = 0; | |
| 742 | 767 | pcifunc = rvu_make_pcifunc(rvu->pdev, pf, vf); | |
| 743 | 768 | if (!pcifunc) | |
| 744 | 769 | continue; | |
| 745 | 770 | ||
| 746 | - | for (index = 0; index < BLK_COUNT; index++) { | |
| 747 | - | block = rvu->hw->block[index]; | |
| 748 | - | if (!strlen(block.name)) | |
| 749 | - | continue; | |
| 750 | - | lfs[0] = '\0'; | |
| 751 | - | get_lf_str_list(&block, pcifunc, lfs); | |
| 752 | - | if (strlen(lfs)) | |
| 753 | - | break; | |
| 754 | - | } | |
| 755 | - | if (index == BLK_COUNT) | |
| 756 | - | continue; | |
| 757 | - | ||
| 758 | - | if (vf) | |
| 771 | + | if (vf) { | |
| 759 | 772 | sprintf(lfs, "PF%d:VF%d", pf, vf - 1); | |
| 760 | - | else | |
| 773 | + | off = scnprintf(&buf[off], | |
| 774 | + | buf_size - 1 - off, | |
| 775 | + | "%-*s", lf_str_size, lfs); | |
| 776 | + | } else { | |
| 761 | 777 | sprintf(lfs, "PF%d", pf); | |
| 762 | - | seq_printf(filp, "%-*s", lf_str_size, lfs); | |
| 778 | + | off = scnprintf(&buf[off], | |
| 779 | + | buf_size - 1 - off, | |
| 780 | + | "%-*s", lf_str_size, lfs); | |
| 781 | + | } | |
| 763 | 782 | ||
| 764 | 783 | for (index = 0; index < BLK_COUNT; index++) { | |
| 765 | 784 | block = rvu->hw->block[index]; | |
| 766 | 785 | if (!strlen(block.name)) | |
| 767 | 786 | continue; | |
| 768 | - | ||
| 769 | - | lfs[0] = '\0'; | |
| 787 | + | len = 0; | |
| 788 | + | lfs[len] = '\0'; | |
| 770 | 789 | get_lf_str_list(&block, pcifunc, lfs); | |
| 771 | - | seq_printf(filp, "%-*s", lf_str_size, lfs); | |
| 790 | + | if (strlen(lfs)) | |
| 791 | + | flag = 1; | |
| 792 | + | ||
| 793 | + | off += scnprintf(&buf[off], buf_size - 1 - off, | |
| 794 | + | "%-*s", lf_str_size, lfs); | |
| 795 | + | } | |
| 796 | + | if (flag) { | |
| 797 | + | off += scnprintf(&buf[off], | |
| 798 | + | buf_size - 1 - off, "\n"); | |
| 799 | + | bytes_not_copied = copy_to_user(buffer + | |
| 800 | + | (i * off), | |
| 801 | + | buf, off); | |
| 802 | + | if (bytes_not_copied) | |
| 803 | + | goto out; | |
| 804 | + | ||
| 805 | + | i++; | |
| 806 | + | *ppos += off; | |
| 772 | 807 | } | |
| 773 | - | seq_putc(filp, '\n'); | |
| 774 | 808 | } | |
| 775 | 809 | } | |
| 776 | 810 | ||
| 811 | + | out: | |
| 777 | 812 | kfree(lfs); | |
| 813 | + | kfree(buf); | |
| 814 | + | if (bytes_not_copied) | |
| 815 | + | return -EFAULT; | |
| 778 | 816 | ||
| 779 | - | return 0; | |
| 817 | + | return *ppos; | |
| 780 | 818 | } | |
| 781 | 819 | ||
| 782 | - | RVU_DEBUG_SEQ_FOPS(rsrc_status, rsrc_attach_status, NULL); | |
| 820 | + | RVU_DEBUG_FOPS(rsrc_status, rsrc_attach_status, NULL); | |
| 783 | 821 | ||
| 784 | 822 | static int rvu_dbg_rvu_pf_cgx_map_display(struct seq_file *filp, void *unused) | |
| 785 | 823 | { | |
modified drivers/net/ethernet/mediatek/mtk_eth_soc.c
| @@ -4509,10 +4509,6 @@ static int mtk_unreg_dev(struct mtk_eth *eth) | |||
| 4509 | 4509 | mac = netdev_priv(eth->netdev[i]); | |
| 4510 | 4510 | if (MTK_HAS_CAPS(eth->soc->caps, MTK_QDMA)) | |
| 4511 | 4511 | unregister_netdevice_notifier(&mac->device_notifier); | |
| 4512 | - | ||
| 4513 | - | if (eth->netdev[i]->reg_state != NETREG_REGISTERED) | |
| 4514 | - | continue; | |
| 4515 | - | ||
| 4516 | 4512 | unregister_netdev(eth->netdev[i]); | |
| 4517 | 4513 | } | |
| 4518 | 4514 | ||
| @@ -5348,7 +5344,7 @@ static int mtk_probe(struct platform_device *pdev) | |||
| 5348 | 5344 | err = register_netdev(eth->netdev[i]); | |
| 5349 | 5345 | if (err) { | |
| 5350 | 5346 | dev_err(eth->dev, "error bringing up device\n"); | |
| 5351 | - | goto err_unreg_netdev; | |
| 5347 | + | goto err_deinit_ppe; | |
| 5352 | 5348 | } else | |
| 5353 | 5349 | netif_info(eth, probe, eth->netdev[i], | |
| 5354 | 5350 | "mediatek frame engine at 0x%08lx, irq %d\n", | |
modified drivers/net/ethernet/mellanox/mlx5/core/en/rep/bridge.c
| @@ -85,16 +85,9 @@ mlx5_esw_bridge_lower_rep_vport_num_vhca_id_get(struct net_device *dev, struct m | |||
| 85 | 85 | struct net_device *lower_dev; | |
| 86 | 86 | struct list_head *iter; | |
| 87 | 87 | ||
| 88 | - | if (netif_is_lag_master(dev) || mlx5e_eswitch_rep(dev)) { | |
| 89 | - | struct net_device *rep; | |
| 90 | - | ||
| 91 | - | rep = mlx5_esw_bridge_rep_vport_num_vhca_id_get(dev, esw, vport_num, | |
| 92 | - | esw_owner_vhca_id); | |
| 93 | - | if (rep && !mlx5_esw_bridge_port_exists(*vport_num, *esw_owner_vhca_id, | |
| 94 | - | esw->br_offloads)) | |
| 95 | - | return NULL; | |
| 96 | - | return rep; | |
| 97 | - | } | |
| 88 | + | if (netif_is_lag_master(dev) || mlx5e_eswitch_rep(dev)) | |
| 89 | + | return mlx5_esw_bridge_rep_vport_num_vhca_id_get(dev, esw, vport_num, | |
| 90 | + | esw_owner_vhca_id); | |
| 98 | 91 | ||
| 99 | 92 | netdev_for_each_lower_dev(dev, lower_dev, iter) { | |
| 100 | 93 | struct net_device *rep; | |
| @@ -111,28 +104,6 @@ mlx5_esw_bridge_lower_rep_vport_num_vhca_id_get(struct net_device *dev, struct m | |||
| 111 | 104 | return NULL; | |
| 112 | 105 | } | |
| 113 | 106 | ||
| 114 | - | static bool mlx5_esw_bridge_rep_port_lookup(struct net_device *dev, | |
| 115 | - | struct mlx5_esw_bridge_offloads *br_offloads, | |
| 116 | - | u16 *vport_num, u16 *esw_owner_vhca_id) | |
| 117 | - | { | |
| 118 | - | if (!mlx5_esw_bridge_rep_vport_num_vhca_id_get(dev, br_offloads->esw, vport_num, | |
| 119 | - | esw_owner_vhca_id)) | |
| 120 | - | return false; | |
| 121 | - | ||
| 122 | - | return mlx5_esw_bridge_port_exists(*vport_num, *esw_owner_vhca_id, br_offloads); | |
| 123 | - | } | |
| 124 | - | ||
| 125 | - | static bool mlx5_esw_bridge_lower_rep_port_lookup(struct net_device *dev, | |
| 126 | - | struct mlx5_esw_bridge_offloads *br_offloads, | |
| 127 | - | u16 *vport_num, u16 *esw_owner_vhca_id) | |
| 128 | - | { | |
| 129 | - | if (!mlx5_esw_bridge_lower_rep_vport_num_vhca_id_get(dev, br_offloads->esw, vport_num, | |
| 130 | - | esw_owner_vhca_id)) | |
| 131 | - | return false; | |
| 132 | - | ||
| 133 | - | return mlx5_esw_bridge_port_exists(*vport_num, *esw_owner_vhca_id, br_offloads); | |
| 134 | - | } | |
| 135 | - | ||
| 136 | 107 | static bool mlx5_esw_bridge_is_local(struct net_device *dev, struct net_device *rep, | |
| 137 | 108 | struct mlx5_eswitch *esw) | |
| 138 | 109 | { | |
| @@ -247,7 +218,8 @@ mlx5_esw_bridge_port_obj_add(struct net_device *dev, | |||
| 247 | 218 | u16 vport_num, esw_owner_vhca_id; | |
| 248 | 219 | int err; | |
| 249 | 220 | ||
| 250 | - | if (!mlx5_esw_bridge_rep_port_lookup(dev, br_offloads, &vport_num, &esw_owner_vhca_id)) | |
| 221 | + | if (!mlx5_esw_bridge_rep_vport_num_vhca_id_get(dev, br_offloads->esw, &vport_num, | |
| 222 | + | &esw_owner_vhca_id)) | |
| 251 | 223 | return 0; | |
| 252 | 224 | ||
| 253 | 225 | port_obj_info->handled = true; | |
| @@ -279,7 +251,8 @@ mlx5_esw_bridge_port_obj_del(struct net_device *dev, | |||
| 279 | 251 | const struct switchdev_obj_port_mdb *mdb; | |
| 280 | 252 | u16 vport_num, esw_owner_vhca_id; | |
| 281 | 253 | ||
| 282 | - | if (!mlx5_esw_bridge_rep_port_lookup(dev, br_offloads, &vport_num, &esw_owner_vhca_id)) | |
| 254 | + | if (!mlx5_esw_bridge_rep_vport_num_vhca_id_get(dev, br_offloads->esw, &vport_num, | |
| 255 | + | &esw_owner_vhca_id)) | |
| 283 | 256 | return 0; | |
| 284 | 257 | ||
| 285 | 258 | port_obj_info->handled = true; | |
| @@ -310,8 +283,8 @@ mlx5_esw_bridge_port_obj_attr_set(struct net_device *dev, | |||
| 310 | 283 | u16 vport_num, esw_owner_vhca_id; | |
| 311 | 284 | int err = 0; | |
| 312 | 285 | ||
| 313 | - | if (!mlx5_esw_bridge_lower_rep_port_lookup(dev, br_offloads, &vport_num, | |
| 314 | - | &esw_owner_vhca_id)) | |
| 286 | + | if (!mlx5_esw_bridge_lower_rep_vport_num_vhca_id_get(dev, br_offloads->esw, &vport_num, | |
| 287 | + | &esw_owner_vhca_id)) | |
| 315 | 288 | return 0; | |
| 316 | 289 | ||
| 317 | 290 | port_attr_info->handled = true; | |
modified drivers/net/ethernet/mellanox/mlx5/core/en/tc_ct.c
| @@ -1082,9 +1082,6 @@ mlx5_tc_ct_shared_counter_get(struct mlx5_tc_ct_priv *ct_priv, | |||
| 1082 | 1082 | ||
| 1083 | 1083 | spin_unlock_bh(&ct_priv->ht_lock); | |
| 1084 | 1084 | ||
| 1085 | - | if (rev_entry) | |
| 1086 | - | mlx5_tc_ct_entry_put(rev_entry); | |
| 1087 | - | ||
| 1088 | 1085 | create_counter: | |
| 1089 | 1086 | ||
| 1090 | 1087 | shared_counter = mlx5_tc_ct_counter_create(ct_priv); | |
modified drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_fs.c
| @@ -1564,14 +1564,14 @@ static void setup_fte_addr6(struct mlx5_flow_spec *spec, | |||
| 1564 | 1564 | memcpy(MLX5_ADDR_OF(fte_match_param, spec->match_value, | |
| 1565 | 1565 | outer_headers.src_ipv4_src_ipv6.ipv6_layout.ipv6), saddr, 16); | |
| 1566 | 1566 | memcpy(MLX5_ADDR_OF(fte_match_param, spec->match_criteria, | |
| 1567 | - | outer_headers.src_ipv4_src_ipv6.ipv6_layout.ipv6), smask, 16); | |
| 1567 | + | outer_headers.src_ipv4_src_ipv6.ipv6_layout.ipv6), dmask, 16); | |
| 1568 | 1568 | } | |
| 1569 | 1569 | ||
| 1570 | 1570 | if (!addr6_all_zero(daddr)) { | |
| 1571 | 1571 | memcpy(MLX5_ADDR_OF(fte_match_param, spec->match_value, | |
| 1572 | 1572 | outer_headers.dst_ipv4_dst_ipv6.ipv6_layout.ipv6), daddr, 16); | |
| 1573 | 1573 | memcpy(MLX5_ADDR_OF(fte_match_param, spec->match_criteria, | |
| 1574 | - | outer_headers.dst_ipv4_dst_ipv6.ipv6_layout.ipv6), dmask, 16); | |
| 1574 | + | outer_headers.dst_ipv4_dst_ipv6.ipv6_layout.ipv6), smask, 16); | |
| 1575 | 1575 | } | |
| 1576 | 1576 | } | |
| 1577 | 1577 | ||
modified drivers/net/ethernet/mellanox/mlx5/core/en_accel/macsec.c
| @@ -1724,8 +1724,6 @@ void mlx5e_macsec_build_netdev(struct mlx5e_priv *priv) | |||
| 1724 | 1724 | mlx5_core_dbg(priv->mdev, "mlx5e: MACsec acceleration enabled\n"); | |
| 1725 | 1725 | netdev->macsec_ops = &macsec_offload_ops; | |
| 1726 | 1726 | netdev->features |= NETIF_F_HW_MACSEC; | |
| 1727 | - | netdev->hw_features |= NETIF_F_HW_MACSEC; | |
| 1728 | - | netdev->vlan_features |= NETIF_F_HW_MACSEC; | |
| 1729 | 1727 | netif_keep_dst(netdev); | |
| 1730 | 1728 | } | |
| 1731 | 1729 | ||
modified drivers/net/ethernet/mellanox/mlx5/core/en_main.c
| @@ -5851,6 +5851,7 @@ static void mlx5e_build_nic_netdev(struct net_device *netdev) | |||
| 5851 | 5851 | ||
| 5852 | 5852 | netdev->vlan_features |= NETIF_F_SG; | |
| 5853 | 5853 | netdev->vlan_features |= NETIF_F_HW_CSUM; | |
| 5854 | + | netdev->vlan_features |= NETIF_F_HW_MACSEC; | |
| 5854 | 5855 | netdev->vlan_features |= NETIF_F_GRO; | |
| 5855 | 5856 | netdev->vlan_features |= NETIF_F_TSO; | |
| 5856 | 5857 | netdev->vlan_features |= NETIF_F_TSO6; | |
modified drivers/net/ethernet/mellanox/mlx5/core/esw/bridge.c
| @@ -1649,8 +1649,10 @@ int mlx5_esw_bridge_vport_unlink(struct net_device *br_netdev, u16 vport_num, | |||
| 1649 | 1649 | int err; | |
| 1650 | 1650 | ||
| 1651 | 1651 | port = mlx5_esw_bridge_port_lookup(vport_num, esw_owner_vhca_id, br_offloads); | |
| 1652 | - | if (!port) | |
| 1653 | - | return 0; | |
| 1652 | + | if (!port) { | |
| 1653 | + | NL_SET_ERR_MSG_MOD(extack, "Port is not attached to any bridge"); | |
| 1654 | + | return -EINVAL; | |
| 1655 | + | } | |
| 1654 | 1656 | if (port->bridge->ifindex != br_netdev->ifindex) { | |
| 1655 | 1657 | NL_SET_ERR_MSG_MOD(extack, "Port is attached to another bridge"); | |
| 1656 | 1658 | return -EINVAL; | |
| @@ -1680,19 +1682,10 @@ int mlx5_esw_bridge_vport_peer_unlink(struct net_device *br_netdev, u16 vport_nu | |||
| 1680 | 1682 | struct mlx5_esw_bridge_offloads *br_offloads, | |
| 1681 | 1683 | struct netlink_ext_ack *extack) | |
| 1682 | 1684 | { | |
| 1683 | - | if (!MLX5_CAP_ESW(br_offloads->esw->dev, merged_eswitch)) | |
| 1684 | - | return 0; | |
| 1685 | - | ||
| 1686 | 1685 | return mlx5_esw_bridge_vport_unlink(br_netdev, vport_num, esw_owner_vhca_id, br_offloads, | |
| 1687 | 1686 | extack); | |
| 1688 | 1687 | } | |
| 1689 | 1688 | ||
| 1690 | - | bool mlx5_esw_bridge_port_exists(u16 vport_num, u16 esw_owner_vhca_id, | |
| 1691 | - | struct mlx5_esw_bridge_offloads *br_offloads) | |
| 1692 | - | { | |
| 1693 | - | return mlx5_esw_bridge_port_lookup(vport_num, esw_owner_vhca_id, br_offloads); | |
| 1694 | - | } | |
| 1695 | - | ||
| 1696 | 1689 | int mlx5_esw_bridge_port_vlan_add(u16 vport_num, u16 esw_owner_vhca_id, u16 vid, u16 flags, | |
| 1697 | 1690 | struct mlx5_esw_bridge_offloads *br_offloads, | |
| 1698 | 1691 | struct netlink_ext_ack *extack) | |
modified drivers/net/ethernet/mellanox/mlx5/core/esw/bridge.h
| @@ -80,8 +80,6 @@ int mlx5_esw_bridge_vlan_proto_set(u16 vport_num, u16 esw_owner_vhca_id, u16 pro | |||
| 80 | 80 | struct mlx5_esw_bridge_offloads *br_offloads); | |
| 81 | 81 | int mlx5_esw_bridge_mcast_set(u16 vport_num, u16 esw_owner_vhca_id, bool enable, | |
| 82 | 82 | struct mlx5_esw_bridge_offloads *br_offloads); | |
| 83 | - | bool mlx5_esw_bridge_port_exists(u16 vport_num, u16 esw_owner_vhca_id, | |
| 84 | - | struct mlx5_esw_bridge_offloads *br_offloads); | |
| 85 | 83 | int mlx5_esw_bridge_port_vlan_add(u16 vport_num, u16 esw_owner_vhca_id, u16 vid, u16 flags, | |
| 86 | 84 | struct mlx5_esw_bridge_offloads *br_offloads, | |
| 87 | 85 | struct netlink_ext_ack *extack); | |
modified drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c
| @@ -1266,45 +1266,25 @@ void mlx5_lag_remove_devices(struct mlx5_lag *ldev) | |||
| 1266 | 1266 | mlx5_lag_remove_devices_filter(ldev, MLX5_LAG_FILTER_PORTS); | |
| 1267 | 1267 | } | |
| 1268 | 1268 | ||
| 1269 | - | static int mlx5_lag_reload_ib_reps_idx(struct mlx5_lag *ldev, int idx, | |
| 1270 | - | u32 flags) | |
| 1271 | - | { | |
| 1272 | - | struct lag_func *pf = mlx5_lag_pf(ldev, idx); | |
| 1273 | - | struct mlx5_eswitch *esw; | |
| 1274 | - | int ret; | |
| 1275 | - | ||
| 1276 | - | if (pf->dev->priv.flags & flags) | |
| 1277 | - | return 0; | |
| 1278 | - | ||
| 1279 | - | esw = pf->dev->priv.eswitch; | |
| 1280 | - | mlx5_esw_reps_block(esw); | |
| 1281 | - | ret = mlx5_eswitch_reload_ib_reps(esw); | |
| 1282 | - | mlx5_esw_reps_unblock(esw); | |
| 1283 | - | ||
| 1284 | - | return ret; | |
| 1285 | - | } | |
| 1286 | - | ||
| 1287 | 1269 | static int mlx5_lag_reload_ib_reps_unlocked(struct mlx5_lag *ldev, u32 flags, | |
| 1288 | 1270 | u32 filter, bool cont_on_fail) | |
| 1289 | 1271 | { | |
| 1290 | - | int master_idx = mlx5_lag_get_dev_index_by_seq_filter(ldev, MLX5_LAG_P1, | |
| 1291 | - | filter); | |
| 1272 | + | struct lag_func *pf; | |
| 1292 | 1273 | int ret; | |
| 1293 | 1274 | int i; | |
| 1294 | 1275 | ||
| 1295 | - | if (master_idx < 0) | |
| 1296 | - | return -EINVAL; | |
| 1297 | - | ||
| 1298 | - | ret = mlx5_lag_reload_ib_reps_idx(ldev, master_idx, flags); | |
| 1299 | - | if (ret && !cont_on_fail) | |
| 1300 | - | return ret; | |
| 1301 | - | ||
| 1302 | 1276 | mlx5_lag_for_each(i, 0, ldev, filter) { | |
| 1303 | - | if (i == master_idx) | |
| 1304 | - | continue; | |
| 1305 | - | ret = mlx5_lag_reload_ib_reps_idx(ldev, i, flags); | |
| 1306 | - | if (ret && !cont_on_fail) | |
| 1307 | - | return ret; | |
| 1277 | + | pf = mlx5_lag_pf(ldev, i); | |
| 1278 | + | if (!(pf->dev->priv.flags & flags)) { | |
| 1279 | + | struct mlx5_eswitch *esw; | |
| 1280 | + | ||
| 1281 | + | esw = pf->dev->priv.eswitch; | |
| 1282 | + | mlx5_esw_reps_block(esw); | |
| 1283 | + | ret = mlx5_eswitch_reload_ib_reps(esw); | |
| 1284 | + | mlx5_esw_reps_unblock(esw); | |
| 1285 | + | if (ret && !cont_on_fail) | |
| 1286 | + | return ret; | |
| 1287 | + | } | |
| 1308 | 1288 | } | |
| 1309 | 1289 | ||
| 1310 | 1290 | return 0; | |
modified drivers/net/ethernet/mellanox/mlx5/core/lib/devcom.c
| @@ -37,7 +37,6 @@ struct mlx5_devcom_comp { | |||
| 37 | 37 | struct mlx5_devcom_key key; | |
| 38 | 38 | mlx5_devcom_event_handler_t handler; | |
| 39 | 39 | struct kref ref; | |
| 40 | - | int nr_devs; | |
| 41 | 40 | bool ready; | |
| 42 | 41 | struct rw_semaphore sem; | |
| 43 | 42 | struct lock_class_key lock_key; | |
| @@ -171,7 +170,6 @@ devcom_alloc_comp_dev(struct mlx5_devcom_dev *devc, | |||
| 171 | 170 | ||
| 172 | 171 | down_write(&comp->sem); | |
| 173 | 172 | list_add_tail(&devcom->list, &comp->comp_dev_list_head); | |
| 174 | - | WRITE_ONCE(comp->nr_devs, comp->nr_devs + 1); | |
| 175 | 173 | up_write(&comp->sem); | |
| 176 | 174 | ||
| 177 | 175 | return devcom; | |
| @@ -184,7 +182,6 @@ devcom_free_comp_dev(struct mlx5_devcom_comp_dev *devcom) | |||
| 184 | 182 | ||
| 185 | 183 | down_write(&comp->sem); | |
| 186 | 184 | list_del(&devcom->list); | |
| 187 | - | WRITE_ONCE(comp->nr_devs, comp->nr_devs - 1); | |
| 188 | 185 | up_write(&comp->sem); | |
| 189 | 186 | ||
| 190 | 187 | kref_put(&devcom->devc->ref, mlx5_devcom_dev_release); | |
| @@ -287,7 +284,7 @@ int mlx5_devcom_comp_get_size(struct mlx5_devcom_comp_dev *devcom) | |||
| 287 | 284 | { | |
| 288 | 285 | struct mlx5_devcom_comp *comp = devcom->comp; | |
| 289 | 286 | ||
| 290 | - | return READ_ONCE(comp->nr_devs); | |
| 287 | + | return kref_read(&comp->ref); | |
| 291 | 288 | } | |
| 292 | 289 | ||
| 293 | 290 | int mlx5_devcom_locked_send_event(struct mlx5_devcom_comp_dev *devcom, | |
modified drivers/net/ethernet/meta/fbnic/fbnic_csr.h
| @@ -974,7 +974,6 @@ enum { | |||
| 974 | 974 | /* PUL User Registers */ | |
| 975 | 975 | #define FBNIC_CSR_START_PUL_USER 0x31000 /* CSR section delimiter */ | |
| 976 | 976 | #define FBNIC_PUL_OB_TLP_HDR_AW_CFG 0x3103d /* 0xc40f4 */ | |
| 977 | - | #define FBNIC_PUL_OB_TLP_HDR_AW_CFG_FLUSH_MODE CSR_BIT(20) | |
| 978 | 977 | #define FBNIC_PUL_OB_TLP_HDR_AW_CFG_FLUSH CSR_BIT(19) | |
| 979 | 978 | #define FBNIC_PUL_OB_TLP_HDR_AW_CFG_BME CSR_BIT(18) | |
| 980 | 979 | #define FBNIC_PUL_OB_TLP_HDR_AW_CFG_RDE_ATTR CSR_GENMASK(17, 15) | |
| @@ -1216,10 +1215,6 @@ enum { | |||
| 1216 | 1215 | #define FBNIC_IPC_MBX_DESC_LEN_MASK DESC_GENMASK(63, 48) | |
| 1217 | 1216 | #define FBNIC_IPC_MBX_DESC_EOM DESC_BIT(46) | |
| 1218 | 1217 | #define FBNIC_IPC_MBX_DESC_ADDR_MASK DESC_GENMASK(45, 3) | |
| 1219 | - | /* Set with FW_CMPL when the FW completed a descriptor without successfully | |
| 1220 | - | * processing it (e.g. a mailbox DMA error); the completion has no valid data. | |
| 1221 | - | */ | |
| 1222 | - | #define FBNIC_IPC_MBX_DESC_FW_ERR DESC_BIT(2) | |
| 1223 | 1218 | #define FBNIC_IPC_MBX_DESC_FW_CMPL DESC_BIT(1) | |
| 1224 | 1219 | #define FBNIC_IPC_MBX_DESC_HOST_CMPL DESC_BIT(0) | |
| 1225 | 1220 | ||
modified drivers/net/ethernet/meta/fbnic/fbnic_debugfs.c
| @@ -539,8 +539,8 @@ static void fbnic_dbg_fw_mbx_display(struct seq_file *s, | |||
| 539 | 539 | /* Generate header */ | |
| 540 | 540 | seq_puts(s, mbx_idx == FBNIC_IPC_MBX_RX_IDX ? "Rx\n" : "Tx\n"); | |
| 541 | 541 | ||
| 542 | - | seq_printf(s, "Rdy: %d Head: %d Tail: %d resp_error: %llu\n", | |
| 543 | - | mbx->ready, mbx->head, mbx->tail, mbx->resp_error); | |
| 542 | + | seq_printf(s, "Rdy: %d Head: %d Tail: %d\n", | |
| 543 | + | mbx->ready, mbx->head, mbx->tail); | |
| 544 | 544 | ||
| 545 | 545 | snprintf(hdr, sizeof(hdr), "%3s %-4s %s %-12s %s %-3s %-16s\n", | |
| 546 | 546 | "Idx", "Len", "E", "Addr", "F", "H", "Raw"); | |
modified drivers/net/ethernet/meta/fbnic/fbnic_ethtool.c
| @@ -313,11 +313,6 @@ fbnic_get_ringparam(struct net_device *netdev, struct ethtool_ringparam *ring, | |||
| 313 | 313 | kernel_ring->hds_thresh = fbn->hds_thresh; | |
| 314 | 314 | } | |
| 315 | 315 | ||
| 316 | - | static u32 fbnic_ring_size_pow2(u32 size) | |
| 317 | - | { | |
| 318 | - | return size ? roundup_pow_of_two(size) : 0; | |
| 319 | - | } | |
| 320 | - | ||
| 321 | 316 | static void fbnic_set_rings(struct fbnic_net *fbn, | |
| 322 | 317 | struct ethtool_ringparam *ring, | |
| 323 | 318 | struct kernel_ethtool_ringparam *kernel_ring) | |
| @@ -339,10 +334,10 @@ fbnic_set_ringparam(struct net_device *netdev, struct ethtool_ringparam *ring, | |||
| 339 | 334 | struct fbnic_net *clone; | |
| 340 | 335 | int err; | |
| 341 | 336 | ||
| 342 | - | ring->rx_pending = fbnic_ring_size_pow2(ring->rx_pending); | |
| 343 | - | ring->rx_mini_pending = fbnic_ring_size_pow2(ring->rx_mini_pending); | |
| 344 | - | ring->rx_jumbo_pending = fbnic_ring_size_pow2(ring->rx_jumbo_pending); | |
| 345 | - | ring->tx_pending = fbnic_ring_size_pow2(ring->tx_pending); | |
| 337 | + | ring->rx_pending = roundup_pow_of_two(ring->rx_pending); | |
| 338 | + | ring->rx_mini_pending = roundup_pow_of_two(ring->rx_mini_pending); | |
| 339 | + | ring->rx_jumbo_pending = roundup_pow_of_two(ring->rx_jumbo_pending); | |
| 340 | + | ring->tx_pending = roundup_pow_of_two(ring->tx_pending); | |
| 346 | 341 | ||
| 347 | 342 | /* These are absolute minimums allowing the device and driver to operate | |
| 348 | 343 | * but not necessarily guarantee reasonable performance. Settings below | |
| @@ -2030,8 +2025,7 @@ static const struct ethtool_ops fbnic_ethtool_ops = { | |||
| 2030 | 2025 | ETHTOOL_OP_NEEDS_RTNL_SPAUSEPARAM | | |
| 2031 | 2026 | ETHTOOL_OP_NEEDS_RTNL_SCHANNELS | | |
| 2032 | 2027 | ETHTOOL_OP_NEEDS_RTNL_SRINGPARAM | | |
| 2033 | - | ETHTOOL_OP_NEEDS_RTNL_GLINK | | |
| 2034 | - | ETHTOOL_OP_NEEDS_RTNL_TEST, | |
| 2028 | + | ETHTOOL_OP_NEEDS_RTNL_GLINK, | |
| 2035 | 2029 | .get_drvinfo = fbnic_get_drvinfo, | |
| 2036 | 2030 | .get_regs_len = fbnic_get_regs_len, | |
| 2037 | 2031 | .get_regs = fbnic_get_regs, | |
modified drivers/net/ethernet/meta/fbnic/fbnic_fw.c
| @@ -60,15 +60,8 @@ static void fbnic_mbx_reset_desc_ring(struct fbnic_dev *fbd, int mbx_idx) | |||
| 60 | 60 | */ | |
| 61 | 61 | switch (mbx_idx) { | |
| 62 | 62 | case FBNIC_IPC_MBX_RX_IDX: | |
| 63 | - | /* Clearing BME blocks the device from writing to the host | |
| 64 | - | * but leaves the requests parked in the write pipeline. The | |
| 65 | - | * write path only clears outstanding requests when both FLUSH | |
| 66 | - | * and FLUSH_MODE are set; FLUSH_MODE lets them drain without | |
| 67 | - | * landing on the host. | |
| 68 | - | */ | |
| 69 | 63 | wr32(fbd, FBNIC_PUL_OB_TLP_HDR_AW_CFG, | |
| 70 | - | FBNIC_PUL_OB_TLP_HDR_AW_CFG_FLUSH | | |
| 71 | - | FBNIC_PUL_OB_TLP_HDR_AW_CFG_FLUSH_MODE); | |
| 64 | + | FBNIC_PUL_OB_TLP_HDR_AW_CFG_FLUSH); | |
| 72 | 65 | break; | |
| 73 | 66 | case FBNIC_IPC_MBX_TX_IDX: | |
| 74 | 67 | wr32(fbd, FBNIC_PUL_OB_TLP_HDR_AR_CFG, | |
| @@ -292,12 +285,6 @@ static void fbnic_mbx_process_tx_msgs(struct fbnic_dev *fbd) | |||
| 292 | 285 | if (!(desc & FBNIC_IPC_MBX_DESC_FW_CMPL)) | |
| 293 | 286 | break; | |
| 294 | 287 | ||
| 295 | - | if (desc & FBNIC_IPC_MBX_DESC_FW_ERR) { | |
| 296 | - | tx_mbx->resp_error++; | |
| 297 | - | dev_warn_ratelimited(fbd->dev, | |
| 298 | - | "FW completed a Tx mailbox request with an error\n"); | |
| 299 | - | } | |
| 300 | - | ||
| 301 | 288 | fbnic_mbx_unmap_and_free_msg(fbd, FBNIC_IPC_MBX_TX_IDX, head); | |
| 302 | 289 | ||
| 303 | 290 | head++; | |
| @@ -1679,13 +1666,6 @@ static void fbnic_mbx_process_rx_msgs(struct fbnic_dev *fbd) | |||
| 1679 | 1666 | if (!(desc & FBNIC_IPC_MBX_DESC_FW_CMPL)) | |
| 1680 | 1667 | break; | |
| 1681 | 1668 | ||
| 1682 | - | if (desc & FBNIC_IPC_MBX_DESC_FW_ERR) { | |
| 1683 | - | rx_mbx->resp_error++; | |
| 1684 | - | dev_warn_ratelimited(fbd->dev, | |
| 1685 | - | "FW reported an error on an Rx mailbox message; dropping\n"); | |
| 1686 | - | goto next_page; | |
| 1687 | - | } | |
| 1688 | - | ||
| 1689 | 1669 | dma_sync_single_for_cpu(fbd->dev, rx_mbx->buf_info[head].addr, | |
| 1690 | 1670 | FBNIC_RX_PAGE_SIZE, DMA_FROM_DEVICE); | |
| 1691 | 1671 | ||
| @@ -1753,9 +1733,7 @@ void fbnic_mbx_poll(struct fbnic_dev *fbd) | |||
| 1753 | 1733 | int fbnic_mbx_poll_tx_ready(struct fbnic_dev *fbd) | |
| 1754 | 1734 | { | |
| 1755 | 1735 | struct fbnic_fw_mbx *tx_mbx = &fbd->mbx[FBNIC_IPC_MBX_TX_IDX]; | |
| 1756 | - | struct fbnic_fw_mbx *rx_mbx = &fbd->mbx[FBNIC_IPC_MBX_RX_IDX]; | |
| 1757 | 1736 | unsigned long timeout = jiffies + 10 * HZ + 1; | |
| 1758 | - | u64 tx_resp_error, rx_resp_error; | |
| 1759 | 1737 | int err, i; | |
| 1760 | 1738 | ||
| 1761 | 1739 | do { | |
| @@ -1786,9 +1764,6 @@ int fbnic_mbx_poll_tx_ready(struct fbnic_dev *fbd) | |||
| 1786 | 1764 | * mgmt.version once we get the actual version from the firmware | |
| 1787 | 1765 | * in the capabilities request message. | |
| 1788 | 1766 | */ | |
| 1789 | - | send_cap_req: | |
| 1790 | - | tx_resp_error = tx_mbx->resp_error; | |
| 1791 | - | rx_resp_error = rx_mbx->resp_error; | |
| 1792 | 1767 | err = fbnic_fw_xmit_simple_msg(fbd, FBNIC_TLV_MSG_ID_HOST_CAP_REQ); | |
| 1793 | 1768 | if (err) | |
| 1794 | 1769 | goto clean_mbx; | |
| @@ -1806,27 +1781,9 @@ send_cap_req: | |||
| 1806 | 1781 | msleep(20); | |
| 1807 | 1782 | fbnic_mbx_poll(fbd); | |
| 1808 | 1783 | ||
| 1809 | - | /* A valid capabilities response ends the poll. Check it | |
| 1810 | - | * before the FW_ERR retry below so a response parsed in the | |
| 1811 | - | * same poll as an unrelated FW_ERR is not discarded. | |
| 1812 | - | */ | |
| 1813 | - | if (fbd->fw_cap.running.mgmt.version >= MIN_FW_VER_CODE) | |
| 1814 | - | break; | |
| 1815 | - | ||
| 1816 | 1784 | /* set err, but wait till mgmt.version check to report it */ | |
| 1817 | - | if (!time_is_after_jiffies(timeout)) { | |
| 1785 | + | if (!time_is_after_jiffies(timeout)) | |
| 1818 | 1786 | err = -ETIMEDOUT; | |
| 1819 | - | continue; | |
| 1820 | - | } | |
| 1821 | - | ||
| 1822 | - | /* The FW can flag our capabilities request (Tx) or its | |
| 1823 | - | * response (Rx) with FW_ERR, in which case it produced no | |
| 1824 | - | * usable response. The ring is not wedged, so re-issue the | |
| 1825 | - | * request instead of spinning until the timeout. | |
| 1826 | - | */ | |
| 1827 | - | if (tx_mbx->resp_error != tx_resp_error || | |
| 1828 | - | rx_mbx->resp_error != rx_resp_error) | |
| 1829 | - | goto send_cap_req; | |
| 1830 | 1787 | } | |
| 1831 | 1788 | ||
| 1832 | 1789 | return 0; | |
modified drivers/net/ethernet/meta/fbnic/fbnic_fw.h
| @@ -13,7 +13,6 @@ struct fbnic_tlv_msg; | |||
| 13 | 13 | ||
| 14 | 14 | struct fbnic_fw_mbx { | |
| 15 | 15 | u8 ready, head, tail; | |
| 16 | - | u64 resp_error; | |
| 17 | 16 | struct { | |
| 18 | 17 | struct fbnic_tlv_msg *msg; | |
| 19 | 18 | dma_addr_t addr; | |
modified drivers/net/ethernet/meta/fbnic/fbnic_pci.c
| @@ -434,7 +434,6 @@ static int fbnic_pm_suspend(struct device *dev) | |||
| 434 | 434 | { | |
| 435 | 435 | struct fbnic_dev *fbd = dev_get_drvdata(dev); | |
| 436 | 436 | struct net_device *netdev = fbd->netdev; | |
| 437 | - | struct fbnic_net *fbn; | |
| 438 | 437 | ||
| 439 | 438 | if (fbnic_init_failure(fbd)) | |
| 440 | 439 | goto null_uc_addr; | |
| @@ -442,16 +441,11 @@ static int fbnic_pm_suspend(struct device *dev) | |||
| 442 | 441 | rtnl_lock(); | |
| 443 | 442 | netdev_lock(netdev); | |
| 444 | 443 | ||
| 445 | - | fbn = netdev_priv(netdev); | |
| 446 | - | ||
| 447 | 444 | netif_device_detach(netdev); | |
| 448 | 445 | ||
| 449 | 446 | if (netif_running(netdev)) | |
| 450 | 447 | netdev->netdev_ops->ndo_stop(netdev); | |
| 451 | 448 | ||
| 452 | - | /* The IRQs are about to be freed, so drop the napi vector count */ | |
| 453 | - | fbn->num_napi = 0; | |
| 454 | - | ||
| 455 | 449 | netdev_unlock(netdev); | |
| 456 | 450 | rtnl_unlock(); | |
| 457 | 451 | ||
| @@ -514,20 +508,16 @@ static int __fbnic_pm_resume(struct device *dev) | |||
| 514 | 508 | if (fbnic_init_failure(fbd)) | |
| 515 | 509 | return 0; | |
| 516 | 510 | ||
| 517 | - | rtnl_lock(); | |
| 518 | - | netdev_lock(netdev); | |
| 519 | - | ||
| 520 | 511 | fbn = netdev_priv(netdev); | |
| 521 | 512 | ||
| 522 | 513 | /* Reset the queues if needed */ | |
| 523 | 514 | fbnic_reset_queues(fbn, fbn->num_tx_queues, fbn->num_rx_queues); | |
| 524 | 515 | ||
| 525 | - | if (netif_running(netdev)) { | |
| 516 | + | rtnl_lock(); | |
| 517 | + | netdev_lock(netdev); | |
| 518 | + | ||
| 519 | + | if (netif_running(netdev)) | |
| 526 | 520 | err = __fbnic_open(fbn); | |
| 527 | - | /* On failure the vectors are freed, so drop the count */ | |
| 528 | - | if (err) | |
| 529 | - | fbn->num_napi = 0; | |
| 530 | - | } | |
| 531 | 521 | ||
| 532 | 522 | netdev_unlock(netdev); | |
| 533 | 523 | rtnl_unlock(); | |
modified drivers/net/ethernet/meta/fbnic/fbnic_txrx.c
| @@ -7,7 +7,6 @@ | |||
| 7 | 7 | #include <linux/iopoll.h> | |
| 8 | 8 | #include <linux/pci.h> | |
| 9 | 9 | #include <net/netdev_queues.h> | |
| 10 | - | #include <net/netdev_rx_queue.h> | |
| 11 | 10 | #include <net/page_pool/helpers.h> | |
| 12 | 11 | #include <net/tcp.h> | |
| 13 | 12 | #include <net/xdp.h> | |
| @@ -312,29 +311,6 @@ fbnic_rx_csum(u64 rcd, struct sk_buff *skb, struct fbnic_ring *rcq, | |||
| 312 | 311 | } | |
| 313 | 312 | } | |
| 314 | 313 | ||
| 315 | - | static void fbnic_tx_doorbell(struct fbnic_ring *ring, __le64 *meta) | |
| 316 | - | { | |
| 317 | - | *meta |= cpu_to_le64(FBNIC_TWD_FLAG_REQ_COMPLETION); | |
| 318 | - | ring->deferred_meta = -1; | |
| 319 | - | ||
| 320 | - | /* Force DMA writes to flush before writing to tail */ | |
| 321 | - | dma_wmb(); | |
| 322 | - | ||
| 323 | - | writel(ring->tail, ring->doorbell); | |
| 324 | - | } | |
| 325 | - | ||
| 326 | - | /* Packets handed to us with xmit_more set are left in the ring without a | |
| 327 | - | * doorbell, and without a completion request, in the expectation that the | |
| 328 | - | * packet ending the burst will ring for all of them. If that packet gets | |
| 329 | - | * dropped instead we have to ring here, otherwise the descriptors sit in | |
| 330 | - | * the ring until the next transmit, which may never come. | |
| 331 | - | */ | |
| 332 | - | static void fbnic_tx_flush_doorbell(struct fbnic_ring *ring) | |
| 333 | - | { | |
| 334 | - | if (ring->deferred_meta >= 0) | |
| 335 | - | fbnic_tx_doorbell(ring, &ring->desc[ring->deferred_meta]); | |
| 336 | - | } | |
| 337 | - | ||
| 338 | 314 | static bool | |
| 339 | 315 | fbnic_tx_map(struct fbnic_ring *ring, struct sk_buff *skb, __le64 *meta) | |
| 340 | 316 | { | |
| @@ -402,10 +378,14 @@ fbnic_tx_map(struct fbnic_ring *ring, struct sk_buff *skb, __le64 *meta) | |||
| 402 | 378 | /* Verify there is room for another packet */ | |
| 403 | 379 | fbnic_maybe_stop_tx(skb->dev, ring, FBNIC_MAX_SKB_DESC); | |
| 404 | 380 | ||
| 405 | - | if (fbnic_tx_sent_queue(skb, ring)) | |
| 406 | - | fbnic_tx_doorbell(ring, meta); | |
| 407 | - | else | |
| 408 | - | ring->deferred_meta = meta - ring->desc; | |
| 381 | + | if (fbnic_tx_sent_queue(skb, ring)) { | |
| 382 | + | *meta |= cpu_to_le64(FBNIC_TWD_FLAG_REQ_COMPLETION); | |
| 383 | + | ||
| 384 | + | /* Force DMA writes to flush before writing to tail */ | |
| 385 | + | dma_wmb(); | |
| 386 | + | ||
| 387 | + | writel(tail, ring->doorbell); | |
| 388 | + | } | |
| 409 | 389 | ||
| 410 | 390 | return false; | |
| 411 | 391 | dma_error: | |
| @@ -445,10 +425,8 @@ fbnic_xmit_frame_ring(struct sk_buff *skb, struct fbnic_ring *ring) | |||
| 445 | 425 | * otherwise try next time | |
| 446 | 426 | */ | |
| 447 | 427 | desc_needed = skb_shinfo(skb)->nr_frags + 10; | |
| 448 | - | if (fbnic_maybe_stop_tx(skb->dev, ring, desc_needed)) { | |
| 449 | - | fbnic_tx_flush_doorbell(ring); | |
| 428 | + | if (fbnic_maybe_stop_tx(skb->dev, ring, desc_needed)) | |
| 450 | 429 | return NETDEV_TX_BUSY; | |
| 451 | - | } | |
| 452 | 430 | ||
| 453 | 431 | *meta = cpu_to_le64(FBNIC_TWD_FLAG_DEST_MAC); | |
| 454 | 432 | ||
| @@ -469,8 +447,6 @@ fbnic_xmit_frame_ring(struct sk_buff *skb, struct fbnic_ring *ring) | |||
| 469 | 447 | err_free: | |
| 470 | 448 | dev_kfree_skb_any(skb); | |
| 471 | 449 | err_count: | |
| 472 | - | fbnic_tx_flush_doorbell(ring); | |
| 473 | - | ||
| 474 | 450 | u64_stats_update_begin(&ring->stats.syncp); | |
| 475 | 451 | ring->stats.dropped++; | |
| 476 | 452 | u64_stats_update_end(&ring->stats.syncp); | |
| @@ -1623,7 +1599,7 @@ fbnic_alloc_qt_page_pools(struct fbnic_net *fbn, struct fbnic_q_triad *qt, | |||
| 1623 | 1599 | return 0; | |
| 1624 | 1600 | ||
| 1625 | 1601 | err_destroy_sub0: | |
| 1626 | - | page_pool_destroy(qt->sub0.page_pool); | |
| 1602 | + | page_pool_destroy(pp); | |
| 1627 | 1603 | return PTR_ERR(pp); | |
| 1628 | 1604 | } | |
| 1629 | 1605 | ||
| @@ -1792,7 +1768,7 @@ int fbnic_alloc_napi_vectors(struct fbnic_net *fbn) | |||
| 1792 | 1768 | int err; | |
| 1793 | 1769 | ||
| 1794 | 1770 | /* Allocate 1 Tx queue per napi vector */ | |
| 1795 | - | if (num_napi <= FBNIC_MAX_TXQS && num_napi == num_tx + num_rx) { | |
| 1771 | + | if (num_napi < FBNIC_MAX_TXQS && num_napi == num_tx + num_rx) { | |
| 1796 | 1772 | while (num_tx) { | |
| 1797 | 1773 | err = fbnic_alloc_napi_vector(fbd, fbn, | |
| 1798 | 1774 | num_napi, v_idx, | |
| @@ -2515,7 +2491,6 @@ static void fbnic_enable_twq0(struct fbnic_ring *twq) | |||
| 2515 | 2491 | fbnic_ring_wr32(twq, FBNIC_QUEUE_TWQ0_CTL, FBNIC_QUEUE_TWQ_CTL_RESET); | |
| 2516 | 2492 | twq->tail = 0; | |
| 2517 | 2493 | twq->head = 0; | |
| 2518 | - | twq->deferred_meta = -1; | |
| 2519 | 2494 | ||
| 2520 | 2495 | /* Store descriptor ring address and size */ | |
| 2521 | 2496 | fbnic_ring_wr32(twq, FBNIC_QUEUE_TWQ0_BAL, lower_32_bits(twq->dma)); | |
| @@ -2854,17 +2829,6 @@ void fbnic_napi_depletion_check(struct net_device *netdev) | |||
| 2854 | 2829 | fbnic_wrfl(fbd); | |
| 2855 | 2830 | } | |
| 2856 | 2831 | ||
| 2857 | - | /* Returns the napi vector servicing an Rx queue, or NULL if the datapath | |
| 2858 | - | * is torn down. The association is published by fbnic_set_netif_napi() | |
| 2859 | - | * and cleared by fbnic_reset_netif_napi(), both under the instance lock. | |
| 2860 | - | */ | |
| 2861 | - | static struct fbnic_napi_vector *fbnic_rxq_nv(struct net_device *dev, int idx) | |
| 2862 | - | { | |
| 2863 | - | struct napi_struct *napi = __netif_get_rx_queue(dev, idx)->napi; | |
| 2864 | - | ||
| 2865 | - | return napi ? container_of(napi, struct fbnic_napi_vector, napi) : NULL; | |
| 2866 | - | } | |
| 2867 | - | ||
| 2868 | 2832 | static int fbnic_queue_mem_alloc(struct net_device *dev, | |
| 2869 | 2833 | struct netdev_queue_config *qcfg, | |
| 2870 | 2834 | void *qmem, int idx) | |
| @@ -2877,16 +2841,8 @@ static int fbnic_queue_mem_alloc(struct net_device *dev, | |||
| 2877 | 2841 | if (!netif_running(dev)) | |
| 2878 | 2842 | return fbnic_alloc_qt_page_pools(fbn, qt, idx); | |
| 2879 | 2843 | ||
| 2880 | - | /* A failed PCIe recovery or resume can leave the datapath torn down | |
| 2881 | - | * while netif_running() is still true. This ndo runs before | |
| 2882 | - | * netdev_rx_queue_restart() checks netif_running(), so bail out | |
| 2883 | - | * rather than touching rings and vectors that are already freed. | |
| 2884 | - | */ | |
| 2885 | - | nv = fbnic_rxq_nv(dev, idx); | |
| 2886 | - | if (!nv) | |
| 2887 | - | return -ENETDOWN; | |
| 2888 | - | ||
| 2889 | 2844 | real = container_of(fbn->rx[idx], struct fbnic_q_triad, cmpl); | |
| 2845 | + | nv = fbn->napi[idx % fbn->num_napi]; | |
| 2890 | 2846 | ||
| 2891 | 2847 | fbnic_ring_init(&qt->sub0, real->sub0.doorbell, real->sub0.q_idx, | |
| 2892 | 2848 | real->sub0.flags); | |
| @@ -2937,7 +2893,7 @@ static int fbnic_queue_start(struct net_device *dev, | |||
| 2937 | 2893 | struct fbnic_q_triad *real; | |
| 2938 | 2894 | ||
| 2939 | 2895 | real = container_of(fbn->rx[idx], struct fbnic_q_triad, cmpl); | |
| 2940 | - | nv = fbnic_rxq_nv(dev, idx); | |
| 2896 | + | nv = fbn->napi[idx % fbn->num_napi]; | |
| 2941 | 2897 | ||
| 2942 | 2898 | fbnic_aggregate_ring_bdq_counters(fbn, &real->sub0); | |
| 2943 | 2899 | fbnic_aggregate_ring_bdq_counters(fbn, &real->sub1); | |
| @@ -2959,7 +2915,7 @@ static int fbnic_queue_stop(struct net_device *dev, void *qmem, int idx) | |||
| 2959 | 2915 | int err; | |
| 2960 | 2916 | ||
| 2961 | 2917 | real = container_of(fbn->rx[idx], struct fbnic_q_triad, cmpl); | |
| 2962 | - | nv = fbnic_rxq_nv(dev, idx); | |
| 2918 | + | nv = fbn->napi[idx % fbn->num_napi]; | |
| 2963 | 2919 | fbnic_dbg_nv_exit(nv); | |
| 2964 | 2920 | ||
| 2965 | 2921 | napi_disable_locked(&nv->napi); | |
modified drivers/net/ethernet/meta/fbnic/fbnic_txrx.h
| @@ -128,14 +128,9 @@ struct fbnic_ring { | |||
| 128 | 128 | /* Rx BDQs only */ | |
| 129 | 129 | struct page_pool *page_pool; | |
| 130 | 130 | ||
| 131 | - | /* TWQ0 only, index of the meta descriptor of the last packet | |
| 132 | - | * placed in the ring without ringing the doorbell, -1 if the | |
| 133 | - | * doorbell is in sync with the tail. | |
| 134 | - | */ | |
| 135 | - | s32 deferred_meta; | |
| 136 | - | ||
| 137 | - | /* TCQ only, used to cache the head for TWQ1 if | |
| 131 | + | /* Deferred_head is used to cache the head for TWQ1 if | |
| 138 | 132 | * an attempt is made to clean TWQ1 with zero napi_budget. | |
| 133 | + | * We do not use it for any other ring. | |
| 139 | 134 | */ | |
| 140 | 135 | s32 deferred_head; | |
| 141 | 136 | }; | |
modified drivers/net/ethernet/microchip/lan743x_main.c
| @@ -2604,7 +2604,7 @@ process_extension: | |||
| 2604 | 2604 | rx->adapter->netdev); | |
| 2605 | 2605 | if (rx->adapter->netdev->features & NETIF_F_RXCSUM) { | |
| 2606 | 2606 | if (!is_ice && !is_tce && !is_icsm) | |
| 2607 | - | rx->skb_head->ip_summed = CHECKSUM_UNNECESSARY; | |
| 2607 | + | skb->ip_summed = CHECKSUM_UNNECESSARY; | |
| 2608 | 2608 | } | |
| 2609 | 2609 | netdev_dbg(netdev, "sending %d byte frame to OS", | |
| 2610 | 2610 | rx->skb_head->len); | |
modified drivers/net/ethernet/netronome/nfp/crypto/ipsec.c
| @@ -625,12 +625,11 @@ int nfp_net_ipsec_rx(struct nfp_meta_parsed *meta, struct sk_buff *skb) | |||
| 625 | 625 | ||
| 626 | 626 | xa_lock(&nn->xa_ipsec); | |
| 627 | 627 | x = xa_load(&nn->xa_ipsec, saidx); | |
| 628 | - | if (x) | |
| 629 | - | xfrm_state_hold(x); | |
| 630 | 628 | xa_unlock(&nn->xa_ipsec); | |
| 631 | 629 | if (!x) | |
| 632 | 630 | return -EINVAL; | |
| 633 | 631 | ||
| 632 | + | xfrm_state_hold(x); | |
| 634 | 633 | sp->xvec[sp->len++] = x; | |
| 635 | 634 | sp->olen++; | |
| 636 | 635 | xo = xfrm_offload(skb); | |
modified drivers/net/ethernet/sfc/efx.c
| @@ -904,10 +904,6 @@ static const struct pci_device_id efx_pci_table[] = { | |||
| 904 | 904 | .driver_data = (unsigned long)&efx_x4_nic_type}, | |
| 905 | 905 | {PCI_DEVICE(PCI_VENDOR_ID_SOLARFLARE, 0x2c03), /* X4 PF (FF only) */ | |
| 906 | 906 | .driver_data = (unsigned long)&efx_x4_nic_type}, | |
| 907 | - | {PCI_DEVICE(PCI_VENDOR_ID_SOLARFLARE, 0x8c03), /* X4D PF (FF/LL) */ | |
| 908 | - | .driver_data = (unsigned long)&efx_x4_nic_type}, | |
| 909 | - | {PCI_DEVICE(PCI_VENDOR_ID_SOLARFLARE, 0xac03), /* X4D PF (FF only) */ | |
| 910 | - | .driver_data = (unsigned long)&efx_x4_nic_type}, | |
| 911 | 907 | {0} /* end of list */ | |
| 912 | 908 | }; | |
| 913 | 909 | ||
modified drivers/net/ethernet/socionext/netsec.c
| @@ -2149,7 +2149,6 @@ pm_disable: | |||
| 2149 | 2149 | pm_runtime_put_sync(&pdev->dev); | |
| 2150 | 2150 | pm_runtime_disable(&pdev->dev); | |
| 2151 | 2151 | free_ndev: | |
| 2152 | - | of_node_put(priv->phy_np); | |
| 2153 | 2152 | free_netdev(ndev); | |
| 2154 | 2153 | dev_err(&pdev->dev, "init failed\n"); | |
| 2155 | 2154 | ||
| @@ -2167,7 +2166,6 @@ static void netsec_remove(struct platform_device *pdev) | |||
| 2167 | 2166 | netif_napi_del(&priv->napi); | |
| 2168 | 2167 | ||
| 2169 | 2168 | pm_runtime_disable(&pdev->dev); | |
| 2170 | - | of_node_put(priv->phy_np); | |
| 2171 | 2169 | free_netdev(priv->ndev); | |
| 2172 | 2170 | } | |
| 2173 | 2171 | ||
modified drivers/net/ethernet/spacemit/k1_emac.c
| @@ -803,9 +803,6 @@ err_free_skb: | |||
| 803 | 803 | while (i != head) { | |
| 804 | 804 | emac_free_tx_buf(priv, i); | |
| 805 | 805 | ||
| 806 | - | tx_desc_addr = &((struct emac_desc *)tx_ring->desc_addr)[i]; | |
| 807 | - | memset(tx_desc_addr, 0, sizeof(*tx_desc_addr)); | |
| 808 | - | ||
| 809 | 806 | if (++i == tx_ring->total_cnt) | |
| 810 | 807 | i = 0; | |
| 811 | 808 | } | |
modified drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
| @@ -1162,11 +1162,8 @@ static int gmac_clk_enable(struct rk_priv_data *bsp_priv, bool enable) | |||
| 1162 | 1162 | return ret; | |
| 1163 | 1163 | ||
| 1164 | 1164 | ret = clk_prepare_enable(bsp_priv->clk_phy); | |
| 1165 | - | if (ret) { | |
| 1166 | - | clk_bulk_disable_unprepare(bsp_priv->num_clks, | |
| 1167 | - | bsp_priv->clks); | |
| 1165 | + | if (ret) | |
| 1168 | 1166 | return ret; | |
| 1169 | - | } | |
| 1170 | 1167 | ||
| 1171 | 1168 | rk_configure_io_clksel(bsp_priv); | |
| 1172 | 1169 | rk_ungate_rmii_clock(bsp_priv); | |
modified drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
| @@ -474,11 +474,11 @@ static void dwmac4_set_sarc(struct dma_desc *p, u32 sarc_type) | |||
| 474 | 474 | sarc_type)); | |
| 475 | 475 | } | |
| 476 | 476 | ||
| 477 | - | static int set_16kib_bfsize(int len) | |
| 477 | + | static int set_16kib_bfsize(int mtu) | |
| 478 | 478 | { | |
| 479 | 479 | int ret = 0; | |
| 480 | 480 | ||
| 481 | - | if (unlikely(len > BUF_SIZE_8KiB)) | |
| 481 | + | if (unlikely(mtu >= BUF_SIZE_8KiB)) | |
| 482 | 482 | ret = BUF_SIZE_16KiB; | |
| 483 | 483 | return ret; | |
| 484 | 484 | } | |
modified drivers/net/ethernet/stmicro/stmmac/hwif.h
| @@ -494,7 +494,7 @@ struct stmmac_ops { | |||
| 494 | 494 | #define stmmac_set_arp_offload(__priv, __args...) \ | |
| 495 | 495 | stmmac_do_void_callback(__priv, mac, set_arp_offload, __args) | |
| 496 | 496 | #define stmmac_fpe_map_preemption_class(__priv, __args...) \ | |
| 497 | - | stmmac_do_callback(__priv, mac, fpe_map_preemption_class, __args) | |
| 497 | + | stmmac_do_void_callback(__priv, mac, fpe_map_preemption_class, __args) | |
| 498 | 498 | ||
| 499 | 499 | /* PTP and HW Timer helpers */ | |
| 500 | 500 | struct stmmac_hwtimestamp { | |
| @@ -540,7 +540,7 @@ struct stmmac_mode_ops { | |||
| 540 | 540 | bool (*is_jumbo_frm)(unsigned int len, bool enh_desc); | |
| 541 | 541 | int (*jumbo_frm)(struct stmmac_tx_queue *tx_q, struct sk_buff *skb, | |
| 542 | 542 | int csum); | |
| 543 | - | int (*set_16kib_bfsize)(int len); | |
| 543 | + | int (*set_16kib_bfsize)(int mtu); | |
| 544 | 544 | void (*init_desc3)(struct dma_desc *p); | |
| 545 | 545 | void (*refill_desc3)(struct stmmac_rx_queue *rx_q, struct dma_desc *p); | |
| 546 | 546 | void (*clean_desc3)(struct stmmac_tx_queue *tx_q, struct dma_desc *p); | |
modified drivers/net/ethernet/stmicro/stmmac/ring_mode.c
| @@ -124,10 +124,10 @@ static void clean_desc3(struct stmmac_tx_queue *tx_q, struct dma_desc *p) | |||
| 124 | 124 | p->des3 = 0; | |
| 125 | 125 | } | |
| 126 | 126 | ||
| 127 | - | static int set_16kib_bfsize(int len) | |
| 127 | + | static int set_16kib_bfsize(int mtu) | |
| 128 | 128 | { | |
| 129 | 129 | int ret = 0; | |
| 130 | - | if (unlikely(len > BUF_SIZE_8KiB)) | |
| 130 | + | if (unlikely(mtu > BUF_SIZE_8KiB)) | |
| 131 | 131 | ret = BUF_SIZE_16KiB; | |
| 132 | 132 | return ret; | |
| 133 | 133 | } | |
modified drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
| @@ -1016,6 +1016,8 @@ static int stmmac_get_ts_info(struct net_device *dev, | |||
| 1016 | 1016 | ||
| 1017 | 1017 | if (priv->ptp_clock) | |
| 1018 | 1018 | info->phc_index = ptp_clock_index(priv->ptp_clock); | |
| 1019 | + | else | |
| 1020 | + | info->phc_index = 0; | |
| 1019 | 1021 | ||
| 1020 | 1022 | info->tx_types = (1 << HWTSTAMP_TX_OFF) | (1 << HWTSTAMP_TX_ON); | |
| 1021 | 1023 | ||
modified drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
| @@ -1536,17 +1536,17 @@ static unsigned int stmmac_rx_offset(struct stmmac_priv *priv) | |||
| 1536 | 1536 | return NET_SKB_PAD + NET_IP_ALIGN; | |
| 1537 | 1537 | } | |
| 1538 | 1538 | ||
| 1539 | - | static int stmmac_set_bfsize(int len) | |
| 1539 | + | static int stmmac_set_bfsize(int mtu) | |
| 1540 | 1540 | { | |
| 1541 | 1541 | int ret; | |
| 1542 | 1542 | ||
| 1543 | - | if (len > BUF_SIZE_8KiB) | |
| 1543 | + | if (mtu >= BUF_SIZE_8KiB) | |
| 1544 | 1544 | ret = BUF_SIZE_16KiB; | |
| 1545 | - | else if (len > BUF_SIZE_4KiB) | |
| 1545 | + | else if (mtu >= BUF_SIZE_4KiB) | |
| 1546 | 1546 | ret = BUF_SIZE_8KiB; | |
| 1547 | - | else if (len > BUF_SIZE_2KiB) | |
| 1547 | + | else if (mtu >= BUF_SIZE_2KiB) | |
| 1548 | 1548 | ret = BUF_SIZE_4KiB; | |
| 1549 | - | else if (len > DEFAULT_BUFSIZE) | |
| 1549 | + | else if (mtu > DEFAULT_BUFSIZE) | |
| 1550 | 1550 | ret = BUF_SIZE_2KiB; | |
| 1551 | 1551 | else | |
| 1552 | 1552 | ret = DEFAULT_BUFSIZE; | |
| @@ -4063,7 +4063,7 @@ static struct stmmac_dma_conf * | |||
| 4063 | 4063 | stmmac_setup_dma_desc(struct stmmac_priv *priv, unsigned int mtu) | |
| 4064 | 4064 | { | |
| 4065 | 4065 | struct stmmac_dma_conf *dma_conf; | |
| 4066 | - | int bfsize, len, ret; | |
| 4066 | + | int bfsize, ret; | |
| 4067 | 4067 | u8 chan; | |
| 4068 | 4068 | ||
| 4069 | 4069 | dma_conf = kzalloc_obj(*dma_conf); | |
| @@ -4073,15 +4073,13 @@ stmmac_setup_dma_desc(struct stmmac_priv *priv, unsigned int mtu) | |||
| 4073 | 4073 | return ERR_PTR(-ENOMEM); | |
| 4074 | 4074 | } | |
| 4075 | 4075 | ||
| 4076 | - | len = mtu + ETH_HLEN + 2 * VLAN_HLEN + ETH_FCS_LEN; | |
| 4077 | - | ||
| 4078 | - | /* Returns 0 or BUF_SIZE_16KiB if len > 8KiB and dwmac4 or ring mode */ | |
| 4079 | - | bfsize = stmmac_set_16kib_bfsize(priv, len); | |
| 4076 | + | /* Returns 0 or BUF_SIZE_16KiB if mtu > 8KiB and dwmac4 or ring mode */ | |
| 4077 | + | bfsize = stmmac_set_16kib_bfsize(priv, mtu); | |
| 4080 | 4078 | if (bfsize < 0) | |
| 4081 | 4079 | bfsize = 0; | |
| 4082 | 4080 | ||
| 4083 | 4081 | if (bfsize < BUF_SIZE_16KiB) | |
| 4084 | - | bfsize = stmmac_set_bfsize(len); | |
| 4082 | + | bfsize = stmmac_set_bfsize(mtu); | |
| 4085 | 4083 | ||
| 4086 | 4084 | dma_conf->dma_buf_sz = bfsize; | |
| 4087 | 4085 | /* Chose the tx/rx size from the already defined one in the | |
| @@ -4515,16 +4513,16 @@ static int stmmac_tso_get_num_desc(struct stmmac_tx_queue *tx_q, | |||
| 4515 | 4513 | */ | |
| 4516 | 4514 | static netdev_tx_t stmmac_tso_xmit(struct sk_buff *skb, struct net_device *dev) | |
| 4517 | 4515 | { | |
| 4518 | - | unsigned int first_entry, entry, tx_packets, proto_hdr_len; | |
| 4519 | 4516 | struct dma_desc *desc, *first, *mss_desc = NULL; | |
| 4520 | 4517 | struct stmmac_priv *priv = netdev_priv(dev); | |
| 4518 | + | unsigned int first_entry, entry, tx_packets; | |
| 4521 | 4519 | struct stmmac_txq_stats *txq_stats; | |
| 4522 | 4520 | int i, first_tx, nfrags, ndesc; | |
| 4523 | 4521 | struct stmmac_tx_queue *tx_q; | |
| 4524 | 4522 | bool set_ic, is_last_segment; | |
| 4525 | 4523 | u32 pay_len, mss, queue; | |
| 4524 | + | u8 proto_hdr_len, hdr; | |
| 4526 | 4525 | dma_addr_t des; | |
| 4527 | - | u8 hdr; | |
| 4528 | 4526 | ||
| 4529 | 4527 | nfrags = skb_shinfo(skb)->nr_frags; | |
| 4530 | 4528 | queue = skb_get_queue_mapping(skb); | |
| @@ -4572,7 +4570,7 @@ static netdev_tx_t stmmac_tso_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 4572 | 4570 | } | |
| 4573 | 4571 | ||
| 4574 | 4572 | if (netif_msg_tx_queued(priv)) { | |
| 4575 | - | pr_info("%s: hdrlen %d, hdr_len %u, pay_len %d, mss %d\n", | |
| 4573 | + | pr_info("%s: hdrlen %d, hdr_len %d, pay_len %d, mss %d\n", | |
| 4576 | 4574 | __func__, hdr, proto_hdr_len, pay_len, mss); | |
| 4577 | 4575 | pr_info("\tskb->len %d, skb->data_len %d\n", skb->len, | |
| 4578 | 4576 | skb->data_len); | |
| @@ -5889,7 +5887,6 @@ read_again: | |||
| 5889 | 5887 | if (!skb) { | |
| 5890 | 5888 | page_pool_recycle_direct(rx_q->page_pool, | |
| 5891 | 5889 | buf->page); | |
| 5892 | - | buf->page = NULL; | |
| 5893 | 5890 | rx_dropped++; | |
| 5894 | 5891 | count++; | |
| 5895 | 5892 | goto drain_data; | |
modified drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c
| @@ -12,7 +12,6 @@ | |||
| 12 | 12 | #include <linux/ethtool.h> | |
| 13 | 13 | #include <linux/ip.h> | |
| 14 | 14 | #include <linux/udp.h> | |
| 15 | - | #include <net/dsa.h> | |
| 16 | 15 | #include <net/pkt_cls.h> | |
| 17 | 16 | #include <net/pkt_sched.h> | |
| 18 | 17 | #include <net/tcp.h> | |
| @@ -30,7 +29,6 @@ struct stmmachdr { | |||
| 30 | 29 | sizeof(struct stmmachdr)) | |
| 31 | 30 | #define STMMAC_TEST_PKT_MAGIC 0xdeadcafecafedeadULL | |
| 32 | 31 | #define STMMAC_LB_TIMEOUT msecs_to_jiffies(200) | |
| 33 | - | #define STMMAC_SFT_MAX_LPI (5 * USEC_PER_SEC) | |
| 34 | 32 | ||
| 35 | 33 | struct stmmac_packet_attrs { | |
| 36 | 34 | int vlan; | |
| @@ -239,10 +237,6 @@ struct stmmac_test_priv { | |||
| 239 | 237 | struct stmmac_packet_attrs *packet; | |
| 240 | 238 | struct packet_type pt; | |
| 241 | 239 | struct completion comp; | |
| 242 | - | __be16 packet_type; | |
| 243 | - | int (*func)(struct sk_buff *skb, struct net_device *ndev, | |
| 244 | - | struct packet_type *pt, struct net_device *orig_ndev); | |
| 245 | - | bool capture_all; | |
| 246 | 240 | int double_vlan; | |
| 247 | 241 | int vlan_id; | |
| 248 | 242 | int ok; | |
| @@ -322,52 +316,6 @@ out: | |||
| 322 | 316 | return 0; | |
| 323 | 317 | } | |
| 324 | 318 | ||
| 325 | - | static int stmmac_sft_filter(struct sk_buff *skb, struct net_device *ndev, | |
| 326 | - | struct packet_type *pt, | |
| 327 | - | struct net_device *orig_ndev) | |
| 328 | - | { | |
| 329 | - | struct stmmac_test_priv *tpriv = pt->af_packet_priv; | |
| 330 | - | struct ethhdr *hdr = eth_hdr(skb); | |
| 331 | - | int ret = 0; | |
| 332 | - | ||
| 333 | - | if (hdr->h_proto == tpriv->packet_type) { | |
| 334 | - | struct sk_buff *nskb = skb_clone(skb, GFP_ATOMIC); | |
| 335 | - | ||
| 336 | - | if (nskb) | |
| 337 | - | ret = tpriv->func(nskb, ndev, pt, orig_ndev); | |
| 338 | - | } | |
| 339 | - | ||
| 340 | - | kfree_skb(skb); | |
| 341 | - | return ret; | |
| 342 | - | } | |
| 343 | - | ||
| 344 | - | static void stmmac_sft_add_pack(struct packet_type *pt) | |
| 345 | - | { | |
| 346 | - | struct stmmac_test_priv *tpriv = pt->af_packet_priv; | |
| 347 | - | ||
| 348 | - | if (netdev_uses_dsa(tpriv->pt.dev) || tpriv->capture_all) { | |
| 349 | - | tpriv->packet_type = tpriv->pt.type; | |
| 350 | - | tpriv->func = tpriv->pt.func; | |
| 351 | - | ||
| 352 | - | /* DSA conduit will report ETH_P_XDSA, so our packet handler | |
| 353 | - | * won't match. Let's register a ETH_P_ALL match and filter | |
| 354 | - | * manually in stmmac_sft_filter. This is also useful for | |
| 355 | - | * VLAN tests, to capture packets otherwise marked as | |
| 356 | - | * OTHERHOST. | |
| 357 | - | */ | |
| 358 | - | tpriv->pt.type = htons(ETH_P_ALL); | |
| 359 | - | tpriv->pt.func = stmmac_sft_filter; | |
| 360 | - | tpriv->pt.ignore_outgoing = true; | |
| 361 | - | } | |
| 362 | - | ||
| 363 | - | dev_add_pack(pt); | |
| 364 | - | } | |
| 365 | - | ||
| 366 | - | static void stmmac_sft_remove_pack(struct packet_type *pt) | |
| 367 | - | { | |
| 368 | - | dev_remove_pack(pt); | |
| 369 | - | } | |
| 370 | - | ||
| 371 | 319 | static int __stmmac_test_loopback(struct stmmac_priv *priv, | |
| 372 | 320 | struct stmmac_packet_attrs *attr) | |
| 373 | 321 | { | |
| @@ -389,7 +337,7 @@ static int __stmmac_test_loopback(struct stmmac_priv *priv, | |||
| 389 | 337 | tpriv->packet = attr; | |
| 390 | 338 | ||
| 391 | 339 | if (!attr->dont_wait) | |
| 392 | - | stmmac_sft_add_pack(&tpriv->pt); | |
| 340 | + | dev_add_pack(&tpriv->pt); | |
| 393 | 341 | ||
| 394 | 342 | skb = stmmac_test_get_udp_skb(priv, attr); | |
| 395 | 343 | if (!skb) { | |
| @@ -412,7 +360,7 @@ static int __stmmac_test_loopback(struct stmmac_priv *priv, | |||
| 412 | 360 | ||
| 413 | 361 | cleanup: | |
| 414 | 362 | if (!attr->dont_wait) | |
| 415 | - | stmmac_sft_remove_pack(&tpriv->pt); | |
| 363 | + | dev_remove_pack(&tpriv->pt); | |
| 416 | 364 | kfree(tpriv); | |
| 417 | 365 | return ret; | |
| 418 | 366 | } | |
| @@ -466,16 +414,12 @@ static int stmmac_test_mmc(struct stmmac_priv *priv) | |||
| 466 | 414 | static int stmmac_test_eee(struct stmmac_priv *priv) | |
| 467 | 415 | { | |
| 468 | 416 | struct stmmac_extra_stats *initial, *final; | |
| 469 | - | unsigned long timeout, max_duration; | |
| 417 | + | int retries = 10; | |
| 470 | 418 | int ret; | |
| 471 | 419 | ||
| 472 | 420 | if (!priv->dma_cap.eee || !priv->eee_active) | |
| 473 | 421 | return -EOPNOTSUPP; | |
| 474 | 422 | ||
| 475 | - | /* Bail out if the configured LPI timer is too long */ | |
| 476 | - | if (priv->tx_lpi_timer > STMMAC_SFT_MAX_LPI) | |
| 477 | - | return -EOPNOTSUPP; | |
| 478 | - | ||
| 479 | 423 | initial = kzalloc_obj(*initial); | |
| 480 | 424 | if (!initial) | |
| 481 | 425 | return -ENOMEM; | |
| @@ -486,21 +430,14 @@ static int stmmac_test_eee(struct stmmac_priv *priv) | |||
| 486 | 430 | goto out_free_initial; | |
| 487 | 431 | } | |
| 488 | 432 | ||
| 489 | - | /* Snapshot stats, we want to count the in_lpi events. We may enter | |
| 490 | - | * LPI just after the packet was sent. | |
| 491 | - | */ | |
| 492 | 433 | memcpy(initial, &priv->xstats, sizeof(*initial)); | |
| 493 | 434 | ||
| 494 | - | /* Send a frame, then wait to enter LPI */ | |
| 495 | 435 | ret = stmmac_test_mac_loopback(priv); | |
| 496 | 436 | if (ret) | |
| 497 | 437 | goto out_free_final; | |
| 498 | 438 | ||
| 499 | - | max_duration = usecs_to_jiffies(2 * priv->tx_lpi_timer); | |
| 500 | - | ||
| 501 | 439 | /* We have no traffic in the line so, sooner or later it will go LPI */ | |
| 502 | - | timeout = jiffies + max_duration; | |
| 503 | - | while (!time_after(jiffies, timeout)) { | |
| 440 | + | while (--retries) { | |
| 504 | 441 | memcpy(final, &priv->xstats, sizeof(*final)); | |
| 505 | 442 | ||
| 506 | 443 | if (final->irq_tx_path_in_lpi_mode_n > | |
| @@ -509,38 +446,20 @@ static int stmmac_test_eee(struct stmmac_priv *priv) | |||
| 509 | 446 | msleep(100); | |
| 510 | 447 | } | |
| 511 | 448 | ||
| 512 | - | memcpy(final, &priv->xstats, sizeof(*final)); | |
| 513 | - | if (final->irq_tx_path_in_lpi_mode_n <= | |
| 514 | - | initial->irq_tx_path_in_lpi_mode_n) { | |
| 449 | + | if (!retries) { | |
| 515 | 450 | ret = -ETIMEDOUT; | |
| 516 | 451 | goto out_free_final; | |
| 517 | 452 | } | |
| 518 | 453 | ||
| 519 | - | /* Re-snapshot, as we want to measure exit_lpi events. We should be | |
| 520 | - | * in LPI right now. | |
| 521 | - | */ | |
| 522 | - | memcpy(initial, &priv->xstats, sizeof(*initial)); | |
| 523 | - | ||
| 524 | - | /* TX something so we go out of LPI */ | |
| 525 | - | ret = stmmac_test_mac_loopback(priv); | |
| 526 | - | if (ret) | |
| 454 | + | if (final->irq_tx_path_in_lpi_mode_n <= | |
| 455 | + | initial->irq_tx_path_in_lpi_mode_n) { | |
| 456 | + | ret = -EINVAL; | |
| 527 | 457 | goto out_free_final; | |
| 528 | - | ||
| 529 | - | /* Wait for the exit LPI interrupt */ | |
| 530 | - | timeout = jiffies + max_duration; | |
| 531 | - | while (!time_after(jiffies, timeout)) { | |
| 532 | - | memcpy(final, &priv->xstats, sizeof(*final)); | |
| 533 | - | ||
| 534 | - | if (final->irq_tx_path_exit_lpi_mode_n > | |
| 535 | - | initial->irq_tx_path_exit_lpi_mode_n) | |
| 536 | - | break; | |
| 537 | - | msleep(100); | |
| 538 | 458 | } | |
| 539 | 459 | ||
| 540 | - | memcpy(final, &priv->xstats, sizeof(*final)); | |
| 541 | 460 | if (final->irq_tx_path_exit_lpi_mode_n <= | |
| 542 | 461 | initial->irq_tx_path_exit_lpi_mode_n) { | |
| 543 | - | ret = -ETIMEDOUT; | |
| 462 | + | ret = -EINVAL; | |
| 544 | 463 | goto out_free_final; | |
| 545 | 464 | } | |
| 546 | 465 | ||
| @@ -848,7 +767,7 @@ static int stmmac_test_flowctrl(struct stmmac_priv *priv) | |||
| 848 | 767 | tpriv->pt.func = stmmac_test_flowctrl_validate; | |
| 849 | 768 | tpriv->pt.dev = priv->dev; | |
| 850 | 769 | tpriv->pt.af_packet_priv = tpriv; | |
| 851 | - | stmmac_sft_add_pack(&tpriv->pt); | |
| 770 | + | dev_add_pack(&tpriv->pt); | |
| 852 | 771 | ||
| 853 | 772 | /* Compute minimum number of packets to make FIFO full */ | |
| 854 | 773 | pkt_count = rx_fifo_size; | |
| @@ -904,7 +823,7 @@ static int stmmac_test_flowctrl(struct stmmac_priv *priv) | |||
| 904 | 823 | cleanup: | |
| 905 | 824 | dev_mc_del(priv->dev, paddr); | |
| 906 | 825 | dev_set_promiscuity(priv->dev, -1); | |
| 907 | - | stmmac_sft_remove_pack(&tpriv->pt); | |
| 826 | + | dev_remove_pack(&tpriv->pt); | |
| 908 | 827 | kfree(tpriv); | |
| 909 | 828 | return ret; | |
| 910 | 829 | } | |
| @@ -946,11 +865,6 @@ static int stmmac_test_vlan_validate(struct sk_buff *skb, | |||
| 946 | 865 | goto out; | |
| 947 | 866 | if (skb_headlen(skb) < (STMMAC_TEST_PKT_SIZE - ETH_HLEN)) | |
| 948 | 867 | goto out; | |
| 949 | - | ||
| 950 | - | ehdr = (struct ethhdr *)skb_mac_header(skb); | |
| 951 | - | if (!ether_addr_equal_unaligned(ehdr->h_dest, tpriv->packet->dst)) | |
| 952 | - | goto out; | |
| 953 | - | ||
| 954 | 868 | if (tpriv->vlan_id) { | |
| 955 | 869 | if (skb->vlan_proto != htons(proto)) | |
| 956 | 870 | goto out; | |
| @@ -962,6 +876,10 @@ static int stmmac_test_vlan_validate(struct sk_buff *skb, | |||
| 962 | 876 | } | |
| 963 | 877 | } | |
| 964 | 878 | ||
| 879 | + | ehdr = (struct ethhdr *)skb_mac_header(skb); | |
| 880 | + | if (!ether_addr_equal_unaligned(ehdr->h_dest, tpriv->packet->dst)) | |
| 881 | + | goto out; | |
| 882 | + | ||
| 965 | 883 | ihdr = ip_hdr(skb); | |
| 966 | 884 | if (tpriv->double_vlan) | |
| 967 | 885 | ihdr = (struct iphdr *)(skb_network_header(skb) + 4); | |
| @@ -1003,7 +921,6 @@ static int __stmmac_test_vlanfilt(struct stmmac_priv *priv) | |||
| 1003 | 921 | tpriv->pt.dev = priv->dev; | |
| 1004 | 922 | tpriv->pt.af_packet_priv = tpriv; | |
| 1005 | 923 | tpriv->packet = &attr; | |
| 1006 | - | tpriv->capture_all = true; | |
| 1007 | 924 | ||
| 1008 | 925 | /* | |
| 1009 | 926 | * As we use HASH filtering, false positives may appear. This is a | |
| @@ -1011,20 +928,18 @@ static int __stmmac_test_vlanfilt(struct stmmac_priv *priv) | |||
| 1011 | 928 | * HASH values. | |
| 1012 | 929 | */ | |
| 1013 | 930 | tpriv->vlan_id = 0x123; | |
| 931 | + | dev_add_pack(&tpriv->pt); | |
| 1014 | 932 | ||
| 1015 | 933 | ret = vlan_vid_add(priv->dev, htons(ETH_P_8021Q), tpriv->vlan_id); | |
| 1016 | 934 | if (ret) | |
| 1017 | 935 | goto cleanup; | |
| 1018 | 936 | ||
| 1019 | - | attr.vlan = 1; | |
| 1020 | - | attr.dst = priv->dev->dev_addr; | |
| 1021 | - | attr.sport = 9; | |
| 1022 | - | attr.dport = 9; | |
| 1023 | - | ||
| 1024 | - | stmmac_sft_add_pack(&tpriv->pt); | |
| 1025 | - | ||
| 1026 | 937 | for (i = 0; i < 4; i++) { | |
| 938 | + | attr.vlan = 1; | |
| 1027 | 939 | attr.vlan_id_out = tpriv->vlan_id + i; | |
| 940 | + | attr.dst = priv->dev->dev_addr; | |
| 941 | + | attr.sport = 9; | |
| 942 | + | attr.dport = 9; | |
| 1028 | 943 | ||
| 1029 | 944 | skb = stmmac_test_get_udp_skb(priv, &attr); | |
| 1030 | 945 | if (!skb) { | |
| @@ -1051,9 +966,9 @@ static int __stmmac_test_vlanfilt(struct stmmac_priv *priv) | |||
| 1051 | 966 | } | |
| 1052 | 967 | ||
| 1053 | 968 | vlan_del: | |
| 1054 | - | stmmac_sft_remove_pack(&tpriv->pt); | |
| 1055 | 969 | vlan_vid_del(priv->dev, htons(ETH_P_8021Q), tpriv->vlan_id); | |
| 1056 | 970 | cleanup: | |
| 971 | + | dev_remove_pack(&tpriv->pt); | |
| 1057 | 972 | kfree(tpriv); | |
| 1058 | 973 | return ret; | |
| 1059 | 974 | } | |
| @@ -1100,7 +1015,6 @@ static int __stmmac_test_dvlanfilt(struct stmmac_priv *priv) | |||
| 1100 | 1015 | tpriv->pt.dev = priv->dev; | |
| 1101 | 1016 | tpriv->pt.af_packet_priv = tpriv; | |
| 1102 | 1017 | tpriv->packet = &attr; | |
| 1103 | - | tpriv->capture_all = true; | |
| 1104 | 1018 | ||
| 1105 | 1019 | /* | |
| 1106 | 1020 | * As we use HASH filtering, false positives may appear. This is a | |
| @@ -1108,20 +1022,18 @@ static int __stmmac_test_dvlanfilt(struct stmmac_priv *priv) | |||
| 1108 | 1022 | * HASH values. | |
| 1109 | 1023 | */ | |
| 1110 | 1024 | tpriv->vlan_id = 0x123; | |
| 1025 | + | dev_add_pack(&tpriv->pt); | |
| 1111 | 1026 | ||
| 1112 | 1027 | ret = vlan_vid_add(priv->dev, htons(ETH_P_8021AD), tpriv->vlan_id); | |
| 1113 | 1028 | if (ret) | |
| 1114 | 1029 | goto cleanup; | |
| 1115 | 1030 | ||
| 1116 | - | attr.vlan = 2; | |
| 1117 | - | attr.dst = priv->dev->dev_addr; | |
| 1118 | - | attr.sport = 9; | |
| 1119 | - | attr.dport = 9; | |
| 1120 | - | ||
| 1121 | - | stmmac_sft_add_pack(&tpriv->pt); | |
| 1122 | - | ||
| 1123 | 1031 | for (i = 0; i < 4; i++) { | |
| 1032 | + | attr.vlan = 2; | |
| 1124 | 1033 | attr.vlan_id_out = tpriv->vlan_id + i; | |
| 1034 | + | attr.dst = priv->dev->dev_addr; | |
| 1035 | + | attr.sport = 9; | |
| 1036 | + | attr.dport = 9; | |
| 1125 | 1037 | ||
| 1126 | 1038 | skb = stmmac_test_get_udp_skb(priv, &attr); | |
| 1127 | 1039 | if (!skb) { | |
| @@ -1148,9 +1060,9 @@ static int __stmmac_test_dvlanfilt(struct stmmac_priv *priv) | |||
| 1148 | 1060 | } | |
| 1149 | 1061 | ||
| 1150 | 1062 | vlan_del: | |
| 1151 | - | stmmac_sft_remove_pack(&tpriv->pt); | |
| 1152 | 1063 | vlan_vid_del(priv->dev, htons(ETH_P_8021AD), tpriv->vlan_id); | |
| 1153 | 1064 | cleanup: | |
| 1065 | + | dev_remove_pack(&tpriv->pt); | |
| 1154 | 1066 | kfree(tpriv); | |
| 1155 | 1067 | return ret; | |
| 1156 | 1068 | } | |
| @@ -1381,7 +1293,7 @@ static int stmmac_test_vlanoff_common(struct stmmac_priv *priv, bool svlan) | |||
| 1381 | 1293 | tpriv->pt.af_packet_priv = tpriv; | |
| 1382 | 1294 | tpriv->packet = &attr; | |
| 1383 | 1295 | tpriv->vlan_id = 0x123; | |
| 1384 | - | tpriv->capture_all = true; | |
| 1296 | + | dev_add_pack(&tpriv->pt); | |
| 1385 | 1297 | ||
| 1386 | 1298 | ret = vlan_vid_add(priv->dev, htons(proto), tpriv->vlan_id); | |
| 1387 | 1299 | if (ret) | |
| @@ -1389,8 +1301,6 @@ static int stmmac_test_vlanoff_common(struct stmmac_priv *priv, bool svlan) | |||
| 1389 | 1301 | ||
| 1390 | 1302 | attr.dst = priv->dev->dev_addr; | |
| 1391 | 1303 | ||
| 1392 | - | stmmac_sft_add_pack(&tpriv->pt); | |
| 1393 | - | ||
| 1394 | 1304 | skb = stmmac_test_get_udp_skb(priv, &attr); | |
| 1395 | 1305 | if (!skb) { | |
| 1396 | 1306 | ret = -ENOMEM; | |
| @@ -1408,9 +1318,9 @@ static int stmmac_test_vlanoff_common(struct stmmac_priv *priv, bool svlan) | |||
| 1408 | 1318 | ret = tpriv->ok ? 0 : -ETIMEDOUT; | |
| 1409 | 1319 | ||
| 1410 | 1320 | vlan_del: | |
| 1411 | - | stmmac_sft_remove_pack(&tpriv->pt); | |
| 1412 | 1321 | vlan_vid_del(priv->dev, htons(proto), tpriv->vlan_id); | |
| 1413 | 1322 | cleanup: | |
| 1323 | + | dev_remove_pack(&tpriv->pt); | |
| 1414 | 1324 | kfree(tpriv); | |
| 1415 | 1325 | return ret; | |
| 1416 | 1326 | } | |
| @@ -1422,7 +1332,7 @@ static int stmmac_test_vlanoff(struct stmmac_priv *priv) | |||
| 1422 | 1332 | ||
| 1423 | 1333 | static int stmmac_test_svlanoff(struct stmmac_priv *priv) | |
| 1424 | 1334 | { | |
| 1425 | - | if (!(priv->dev->features & NETIF_F_HW_VLAN_STAG_TX)) | |
| 1335 | + | if (!priv->dma_cap.dvlan) | |
| 1426 | 1336 | return -EOPNOTSUPP; | |
| 1427 | 1337 | return stmmac_test_vlanoff_common(priv, true); | |
| 1428 | 1338 | } | |
| @@ -1789,9 +1699,6 @@ static int __stmmac_test_jumbo(struct stmmac_priv *priv, u16 queue) | |||
| 1789 | 1699 | struct stmmac_packet_attrs attr = { }; | |
| 1790 | 1700 | int size = priv->dma_conf.dma_buf_sz; | |
| 1791 | 1701 | ||
| 1792 | - | if (!dwmac_is_xmac(priv->plat->core_type)) | |
| 1793 | - | size -= NET_IP_ALIGN; | |
| 1794 | - | ||
| 1795 | 1702 | attr.dst = priv->dev->dev_addr; | |
| 1796 | 1703 | attr.max_size = size - ETH_FCS_LEN; | |
| 1797 | 1704 | attr.queue_mapping = queue; | |
modified drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
| @@ -970,7 +970,7 @@ static int tc_taprio_configure(struct stmmac_priv *priv, | |||
| 970 | 970 | struct netlink_ext_ack *extack = qopt->mqprio.extack; | |
| 971 | 971 | struct timespec64 time, current_time, qopt_time; | |
| 972 | 972 | ktime_t current_time_ns; | |
| 973 | - | int err, i, ret = 0; | |
| 973 | + | int i, ret = 0; | |
| 974 | 974 | u64 ctr; | |
| 975 | 975 | ||
| 976 | 976 | if (qopt->base_time < 0) | |
| @@ -1120,9 +1120,9 @@ disable: | |||
| 1120 | 1120 | mutex_unlock(&priv->est_lock); | |
| 1121 | 1121 | } | |
| 1122 | 1122 | ||
| 1123 | - | err = stmmac_fpe_map_preemption_class(priv, priv->dev, extack, 0); | |
| 1123 | + | stmmac_fpe_map_preemption_class(priv, priv->dev, extack, 0); | |
| 1124 | 1124 | ||
| 1125 | - | return qopt->cmd == TAPRIO_CMD_DESTROY ? err : ret; | |
| 1125 | + | return ret; | |
| 1126 | 1126 | } | |
| 1127 | 1127 | ||
| 1128 | 1128 | static void tc_taprio_stats(struct stmmac_priv *priv, | |
| @@ -1237,99 +1237,58 @@ static int tc_query_caps(struct stmmac_priv *priv, | |||
| 1237 | 1237 | } | |
| 1238 | 1238 | } | |
| 1239 | 1239 | ||
| 1240 | - | static int stmmac_set_ndev_tcs(struct net_device *ndev, u8 ntc, | |
| 1241 | - | struct netdev_tc_txq *tc_to_txq) | |
| 1242 | - | { | |
| 1243 | - | int i, err; | |
| 1244 | - | ||
| 1245 | - | netdev_reset_tc(ndev); | |
| 1246 | - | if (!ntc) | |
| 1247 | - | return 0; | |
| 1248 | - | ||
| 1249 | - | err = netdev_set_num_tc(ndev, ntc); | |
| 1250 | - | if (err) | |
| 1251 | - | return err; | |
| 1252 | - | ||
| 1253 | - | for (i = 0; i < ntc; i++) { | |
| 1254 | - | u16 count, offset; | |
| 1255 | - | ||
| 1256 | - | count = tc_to_txq[i].count; | |
| 1257 | - | offset = tc_to_txq[i].offset; | |
| 1258 | - | netdev_set_tc_queue(ndev, i, count, offset); | |
| 1259 | - | } | |
| 1260 | - | ||
| 1261 | - | return 0; | |
| 1262 | - | } | |
| 1263 | - | ||
| 1264 | - | static int stmmac_reset_tc_mqprio(struct net_device *ndev, | |
| 1265 | - | struct netlink_ext_ack *extack) | |
| 1240 | + | static void stmmac_reset_tc_mqprio(struct net_device *ndev, | |
| 1241 | + | struct netlink_ext_ack *extack) | |
| 1266 | 1242 | { | |
| 1267 | 1243 | struct stmmac_priv *priv = netdev_priv(ndev); | |
| 1268 | 1244 | ||
| 1269 | 1245 | netdev_reset_tc(ndev); | |
| 1270 | 1246 | netif_set_real_num_tx_queues(ndev, priv->plat->tx_queues_to_use); | |
| 1271 | - | ||
| 1272 | - | return stmmac_fpe_map_preemption_class(priv, ndev, extack, 0); | |
| 1247 | + | stmmac_fpe_map_preemption_class(priv, ndev, extack, 0); | |
| 1273 | 1248 | } | |
| 1274 | 1249 | ||
| 1275 | 1250 | static int tc_setup_dwmac510_mqprio(struct stmmac_priv *priv, | |
| 1276 | 1251 | struct tc_mqprio_qopt_offload *mqprio) | |
| 1277 | 1252 | { | |
| 1278 | - | unsigned int ndev_num_tx_queues, num_tx_queues = 0; | |
| 1279 | - | struct netdev_tc_txq ndev_tc_to_txq[TC_MAX_QUEUE]; | |
| 1280 | - | struct netdev_tc_txq tc_to_txq[TC_MAX_QUEUE] = {}; | |
| 1281 | 1253 | struct netlink_ext_ack *extack = mqprio->extack; | |
| 1282 | 1254 | struct tc_mqprio_qopt *qopt = &mqprio->qopt; | |
| 1255 | + | u32 offset, count, num_stack_tx_queues = 0; | |
| 1283 | 1256 | struct net_device *ndev = priv->dev; | |
| 1284 | - | u8 ndev_prio_tc_map[TC_BITMASK + 1]; | |
| 1285 | - | int i, err, ndev_ntc; | |
| 1286 | - | ||
| 1287 | - | if (!qopt->num_tc) | |
| 1288 | - | return stmmac_reset_tc_mqprio(ndev, extack); | |
| 1289 | - | ||
| 1290 | - | if (qopt->num_tc > ARRAY_SIZE(tc_to_txq)) | |
| 1291 | - | return -EINVAL; | |
| 1257 | + | u32 num_tc = qopt->num_tc; | |
| 1258 | + | int err; | |
| 1292 | 1259 | ||
| 1293 | - | /* save current tc values for reset */ | |
| 1294 | - | ndev_ntc = netdev_get_num_tc(ndev); | |
| 1295 | - | for (i = 0; i < ARRAY_SIZE(ndev->tc_to_txq); i++) | |
| 1296 | - | ndev_tc_to_txq[i].combined = | |
| 1297 | - | READ_ONCE(ndev->tc_to_txq[i].combined); | |
| 1298 | - | for (i = 0; i < ARRAY_SIZE(ndev_prio_tc_map); i++) | |
| 1299 | - | ndev_prio_tc_map[i] = READ_ONCE(ndev->prio_tc_map[i]); | |
| 1300 | - | ||
| 1301 | - | for (i = 0; i < qopt->num_tc; i++) { | |
| 1302 | - | tc_to_txq[i] = (struct netdev_tc_txq) { | |
| 1303 | - | .count = qopt->count[i], | |
| 1304 | - | .offset = qopt->offset[i], | |
| 1305 | - | }; | |
| 1306 | - | num_tx_queues += qopt->count[i]; | |
| 1260 | + | if (!num_tc) { | |
| 1261 | + | stmmac_reset_tc_mqprio(ndev, extack); | |
| 1262 | + | return 0; | |
| 1307 | 1263 | } | |
| 1308 | 1264 | ||
| 1309 | - | err = stmmac_set_ndev_tcs(ndev, qopt->num_tc, tc_to_txq); | |
| 1265 | + | err = netdev_set_num_tc(ndev, num_tc); | |
| 1310 | 1266 | if (err) | |
| 1311 | - | goto error_reset_tc; | |
| 1267 | + | return err; | |
| 1268 | + | ||
| 1269 | + | for (u32 tc = 0; tc < num_tc; tc++) { | |
| 1270 | + | offset = qopt->offset[tc]; | |
| 1271 | + | count = qopt->count[tc]; | |
| 1272 | + | num_stack_tx_queues += count; | |
| 1273 | + | ||
| 1274 | + | err = netdev_set_tc_queue(ndev, tc, count, offset); | |
| 1275 | + | if (err) | |
| 1276 | + | goto err_reset_tc; | |
| 1277 | + | } | |
| 1312 | 1278 | ||
| 1313 | - | ndev_num_tx_queues = ndev->real_num_tx_queues; | |
| 1314 | - | err = netif_set_real_num_tx_queues(ndev, num_tx_queues); | |
| 1279 | + | err = netif_set_real_num_tx_queues(ndev, num_stack_tx_queues); | |
| 1315 | 1280 | if (err) | |
| 1316 | - | goto error_reset_tc; | |
| 1281 | + | goto err_reset_tc; | |
| 1317 | 1282 | ||
| 1318 | 1283 | err = stmmac_fpe_map_preemption_class(priv, ndev, extack, | |
| 1319 | 1284 | mqprio->preemptible_tcs); | |
| 1320 | 1285 | if (err) | |
| 1321 | - | goto error_reset_num_tx_queues; | |
| 1286 | + | goto err_reset_tc; | |
| 1322 | 1287 | ||
| 1323 | 1288 | return 0; | |
| 1324 | 1289 | ||
| 1325 | - | error_reset_num_tx_queues: | |
| 1326 | - | if (netif_set_real_num_tx_queues(ndev, ndev_num_tx_queues)) | |
| 1327 | - | netdev_warn(ndev, "Failed to restore %u TX queues\n", | |
| 1328 | - | ndev_num_tx_queues); | |
| 1329 | - | error_reset_tc: | |
| 1330 | - | stmmac_set_ndev_tcs(ndev, ndev_ntc, ndev_tc_to_txq); | |
| 1331 | - | for (i = 0; i < ARRAY_SIZE(ndev_prio_tc_map); i++) | |
| 1332 | - | netdev_set_prio_tc_map(ndev, i, ndev_prio_tc_map[i]); | |
| 1290 | + | err_reset_tc: | |
| 1291 | + | stmmac_reset_tc_mqprio(ndev, extack); | |
| 1333 | 1292 | ||
| 1334 | 1293 | return err; | |
| 1335 | 1294 | } | |
modified drivers/net/ethernet/ti/netcp_core.c
| @@ -2225,7 +2225,7 @@ static int netcp_probe(struct platform_device *pdev) | |||
| 2225 | 2225 | return -ENOMEM; | |
| 2226 | 2226 | ||
| 2227 | 2227 | pm_runtime_enable(&pdev->dev); | |
| 2228 | - | ret = pm_runtime_resume_and_get(&pdev->dev); | |
| 2228 | + | ret = pm_runtime_get_sync(&pdev->dev); | |
| 2229 | 2229 | if (ret < 0) { | |
| 2230 | 2230 | dev_err(dev, "Failed to enable NETCP power-domain\n"); | |
| 2231 | 2231 | pm_runtime_disable(&pdev->dev); | |
modified drivers/net/ethernet/wangxun/libwx/wx_hw.c
| @@ -2518,7 +2518,6 @@ int wx_sw_init(struct wx *wx) | |||
| 2518 | 2518 | } | |
| 2519 | 2519 | ||
| 2520 | 2520 | spin_lock_init(&wx->hw_stats_lock); | |
| 2521 | - | spin_lock_init(&wx->ptp_tx_lock); | |
| 2522 | 2521 | mutex_init(&wx->reset_lock); | |
| 2523 | 2522 | bitmap_zero(wx->state, WX_STATE_NBITS); | |
| 2524 | 2523 | bitmap_zero(wx->flags, WX_PF_FLAGS_NBITS); | |
modified drivers/net/ethernet/wangxun/libwx/wx_lib.c
| @@ -1200,11 +1200,9 @@ dma_error: | |||
| 1200 | 1200 | i--; | |
| 1201 | 1201 | } | |
| 1202 | 1202 | ||
| 1203 | - | /* first->skb is released by the caller, which keeps a reference on it | |
| 1204 | - | * until the PTP cleanup has compared it against wx->ptp_tx_skb. That | |
| 1205 | - | * prevents the address from being reused by a newer request while the | |
| 1206 | - | * comparison is pending. | |
| 1207 | - | */ | |
| 1203 | + | dev_kfree_skb_any(first->skb); | |
| 1204 | + | first->skb = NULL; | |
| 1205 | + | ||
| 1208 | 1206 | tx_ring->next_to_use = i; | |
| 1209 | 1207 | ||
| 1210 | 1208 | return -ENOMEM; | |
| @@ -1651,11 +1649,9 @@ static netdev_tx_t wx_xmit_frame_ring(struct sk_buff *skb, | |||
| 1651 | 1649 | ||
| 1652 | 1650 | if (unlikely(skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) && | |
| 1653 | 1651 | wx->ptp_clock) { | |
| 1654 | - | unsigned long flags; | |
| 1655 | - | ||
| 1656 | - | spin_lock_irqsave(&wx->ptp_tx_lock, flags); | |
| 1657 | 1652 | if (wx->tstamp_config.tx_type == HWTSTAMP_TX_ON && | |
| 1658 | - | !test_and_set_bit(WX_STATE_PTP_TX_IN_PROGRESS, wx->state)) { | |
| 1653 | + | !test_and_set_bit_lock(WX_STATE_PTP_TX_IN_PROGRESS, | |
| 1654 | + | wx->state)) { | |
| 1659 | 1655 | skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS; | |
| 1660 | 1656 | tx_flags |= WX_TX_FLAGS_TSTAMP; | |
| 1661 | 1657 | wx->ptp_tx_skb = skb_get(skb); | |
| @@ -1663,7 +1659,6 @@ static netdev_tx_t wx_xmit_frame_ring(struct sk_buff *skb, | |||
| 1663 | 1659 | } else { | |
| 1664 | 1660 | wx->tx_hwtstamp_skipped++; | |
| 1665 | 1661 | } | |
| 1666 | - | spin_unlock_irqrestore(&wx->ptp_tx_lock, flags); | |
| 1667 | 1662 | } | |
| 1668 | 1663 | ||
| 1669 | 1664 | /* record initial flags and protocol */ | |
| @@ -1682,35 +1677,19 @@ static netdev_tx_t wx_xmit_frame_ring(struct sk_buff *skb, | |||
| 1682 | 1677 | wx->atr(tx_ring, first, ptype); | |
| 1683 | 1678 | ||
| 1684 | 1679 | if (wx_tx_map(tx_ring, first, hdr_len)) | |
| 1685 | - | goto out_drop; | |
| 1680 | + | goto cleanup_tx_tstamp; | |
| 1686 | 1681 | ||
| 1687 | 1682 | return NETDEV_TX_OK; | |
| 1688 | 1683 | out_drop: | |
| 1689 | - | /* The frame never reached the hardware, so no timestamp will ever be | |
| 1690 | - | * reported for it and the request has to be cancelled. The slot is | |
| 1691 | - | * shared, though: wx_ptp_clear_tx_timestamp() or wx_ptp_tx_hang() may | |
| 1692 | - | * have dropped our request already, and a transmit on another queue | |
| 1693 | - | * can have claimed the slot since. Only cancel it while it is still | |
| 1694 | - | * ours, otherwise we would free somebody else's skb and release their | |
| 1695 | - | * in-progress bit. | |
| 1696 | - | */ | |
| 1697 | - | if (unlikely(tx_flags & WX_TX_FLAGS_TSTAMP)) { | |
| 1698 | - | struct sk_buff *ptp_tx_skb = NULL; | |
| 1699 | - | unsigned long flags; | |
| 1700 | - | ||
| 1701 | - | spin_lock_irqsave(&wx->ptp_tx_lock, flags); | |
| 1702 | - | if (wx->ptp_tx_skb == skb) { | |
| 1703 | - | ptp_tx_skb = wx->ptp_tx_skb; | |
| 1704 | - | wx->ptp_tx_skb = NULL; | |
| 1705 | - | clear_bit(WX_STATE_PTP_TX_IN_PROGRESS, wx->state); | |
| 1706 | - | wx->tx_hwtstamp_errors++; | |
| 1707 | - | } | |
| 1708 | - | spin_unlock_irqrestore(&wx->ptp_tx_lock, flags); | |
| 1709 | - | ||
| 1710 | - | dev_kfree_skb_any(ptp_tx_skb); | |
| 1711 | - | } | |
| 1712 | 1684 | dev_kfree_skb_any(first->skb); | |
| 1713 | 1685 | first->skb = NULL; | |
| 1686 | + | cleanup_tx_tstamp: | |
| 1687 | + | if (unlikely(tx_flags & WX_TX_FLAGS_TSTAMP)) { | |
| 1688 | + | dev_kfree_skb_any(wx->ptp_tx_skb); | |
| 1689 | + | wx->ptp_tx_skb = NULL; | |
| 1690 | + | wx->tx_hwtstamp_errors++; | |
| 1691 | + | clear_bit_unlock(WX_STATE_PTP_TX_IN_PROGRESS, wx->state); | |
| 1692 | + | } | |
| 1714 | 1693 | ||
| 1715 | 1694 | return NETDEV_TX_OK; | |
| 1716 | 1695 | } | |
modified drivers/net/ethernet/wangxun/libwx/wx_ptp.c
| @@ -129,34 +129,6 @@ static int wx_ptp_settime64(struct ptp_clock_info *ptp, | |||
| 129 | 129 | return 0; | |
| 130 | 130 | } | |
| 131 | 131 | ||
| 132 | - | /** | |
| 133 | - | * __wx_ptp_detach_tx_skb - detach the skb tracking the Tx timestamp request | |
| 134 | - | * @wx: the private board structure | |
| 135 | - | * | |
| 136 | - | * Detach the skb of the outstanding request and release the in-progress bit, | |
| 137 | - | * so that a new request can be submitted. | |
| 138 | - | * | |
| 139 | - | * This performs no register access. Callers that need a timestamp the hardware | |
| 140 | - | * may have left latched must unlatch it themselves, while the device is known | |
| 141 | - | * to be alive. wx_ptp_quiesce() runs during PCIe error recovery, where MMIO is | |
| 142 | - | * not reliable, and therefore deliberately skips the unlatch. | |
| 143 | - | * | |
| 144 | - | * Context: Expects wx->ptp_tx_lock to be held by the caller. | |
| 145 | - | * Return: the detached skb, or NULL if no request was outstanding. The caller | |
| 146 | - | * owns the returned reference and must release it once the lock is dropped. | |
| 147 | - | */ | |
| 148 | - | static struct sk_buff *__wx_ptp_detach_tx_skb(struct wx *wx) | |
| 149 | - | { | |
| 150 | - | struct sk_buff *skb = wx->ptp_tx_skb; | |
| 151 | - | ||
| 152 | - | lockdep_assert_held(&wx->ptp_tx_lock); | |
| 153 | - | ||
| 154 | - | wx->ptp_tx_skb = NULL; | |
| 155 | - | clear_bit(WX_STATE_PTP_TX_IN_PROGRESS, wx->state); | |
| 156 | - | ||
| 157 | - | return skb; | |
| 158 | - | } | |
| 159 | - | ||
| 160 | 132 | /** | |
| 161 | 133 | * wx_ptp_clear_tx_timestamp - utility function to clear Tx timestamp state | |
| 162 | 134 | * @wx: the private board structure | |
| @@ -167,16 +139,12 @@ static struct sk_buff *__wx_ptp_detach_tx_skb(struct wx *wx) | |||
| 167 | 139 | */ | |
| 168 | 140 | static void wx_ptp_clear_tx_timestamp(struct wx *wx) | |
| 169 | 141 | { | |
| 170 | - | struct sk_buff *skb; | |
| 171 | - | unsigned long flags; | |
| 172 | - | ||
| 173 | - | spin_lock_irqsave(&wx->ptp_tx_lock, flags); | |
| 174 | - | /* Unlatch a timestamp the hardware may have left pending. */ | |
| 175 | 142 | rd32ptp(wx, WX_TSC_1588_STMPH); | |
| 176 | - | skb = __wx_ptp_detach_tx_skb(wx); | |
| 177 | - | spin_unlock_irqrestore(&wx->ptp_tx_lock, flags); | |
| 178 | - | ||
| 179 | - | dev_kfree_skb_any(skb); | |
| 143 | + | if (wx->ptp_tx_skb) { | |
| 144 | + | dev_kfree_skb_any(wx->ptp_tx_skb); | |
| 145 | + | wx->ptp_tx_skb = NULL; | |
| 146 | + | } | |
| 147 | + | clear_bit_unlock(WX_STATE_PTP_TX_IN_PROGRESS, wx->state); | |
| 180 | 148 | } | |
| 181 | 149 | ||
| 182 | 150 | /** | |
| @@ -207,54 +175,49 @@ static void wx_ptp_convert_to_hwtstamp(struct wx *wx, | |||
| 207 | 175 | } | |
| 208 | 176 | ||
| 209 | 177 | /** | |
| 210 | - | * wx_ptp_tx_hwtstamp_work - check for a pending Tx time stamp | |
| 178 | + | * wx_ptp_tx_hwtstamp - utility function which checks for TX time stamp | |
| 211 | 179 | * @wx: the private board struct | |
| 212 | 180 | * | |
| 213 | - | * If a Tx timestamp request is outstanding and the hardware has latched a | |
| 214 | - | * valid value, we convert it into the timecounter ns value, then store that | |
| 215 | - | * result into the shhwtstamps structure which is passed up the network stack. | |
| 216 | - | * | |
| 217 | - | * Return: 0 when there is nothing left to poll for, -1 when the timestamp is | |
| 218 | - | * not available yet and the caller should poll again. | |
| 181 | + | * if the timestamp is valid, we convert it into the timecounter ns | |
| 182 | + | * value, then store that result into the shhwtstamps structure which | |
| 183 | + | * is passed up the network stack | |
| 219 | 184 | */ | |
| 220 | - | static int wx_ptp_tx_hwtstamp_work(struct wx *wx) | |
| 185 | + | static void wx_ptp_tx_hwtstamp(struct wx *wx) | |
| 221 | 186 | { | |
| 222 | 187 | struct skb_shared_hwtstamps shhwtstamps; | |
| 223 | - | unsigned long flags; | |
| 224 | - | struct sk_buff *skb; | |
| 225 | - | u32 tsynctxctl; | |
| 188 | + | struct sk_buff *skb = wx->ptp_tx_skb; | |
| 226 | 189 | u64 regval = 0; | |
| 227 | 190 | ||
| 228 | - | spin_lock_irqsave(&wx->ptp_tx_lock, flags); | |
| 191 | + | regval |= (u64)rd32ptp(wx, WX_TSC_1588_STMPL); | |
| 192 | + | regval |= (u64)rd32ptp(wx, WX_TSC_1588_STMPH) << 32; | |
| 193 | + | ||
| 194 | + | wx_ptp_convert_to_hwtstamp(wx, &shhwtstamps, regval); | |
| 195 | + | ||
| 196 | + | wx->ptp_tx_skb = NULL; | |
| 197 | + | clear_bit_unlock(WX_STATE_PTP_TX_IN_PROGRESS, wx->state); | |
| 198 | + | skb_tstamp_tx(skb, &shhwtstamps); | |
| 199 | + | dev_kfree_skb_any(skb); | |
| 200 | + | wx->tx_hwtstamp_pkts++; | |
| 201 | + | } | |
| 202 | + | ||
| 203 | + | static int wx_ptp_tx_hwtstamp_work(struct wx *wx) | |
| 204 | + | { | |
| 205 | + | u32 tsynctxctl; | |
| 229 | 206 | ||
| 230 | 207 | /* we have to have a valid skb to poll for a timestamp */ | |
| 231 | 208 | if (!wx->ptp_tx_skb) { | |
| 232 | - | rd32ptp(wx, WX_TSC_1588_STMPH); | |
| 233 | - | __wx_ptp_detach_tx_skb(wx); | |
| 234 | - | spin_unlock_irqrestore(&wx->ptp_tx_lock, flags); | |
| 209 | + | wx_ptp_clear_tx_timestamp(wx); | |
| 235 | 210 | return 0; | |
| 236 | 211 | } | |
| 237 | 212 | ||
| 238 | 213 | /* stop polling once we have a valid timestamp */ | |
| 239 | 214 | tsynctxctl = rd32ptp(wx, WX_TSC_1588_CTL); | |
| 240 | - | if (!(tsynctxctl & WX_TSC_1588_CTL_VALID)) { | |
| 241 | - | spin_unlock_irqrestore(&wx->ptp_tx_lock, flags); | |
| 242 | - | return -1; | |
| 215 | + | if (tsynctxctl & WX_TSC_1588_CTL_VALID) { | |
| 216 | + | wx_ptp_tx_hwtstamp(wx); | |
| 217 | + | return 0; | |
| 243 | 218 | } | |
| 244 | 219 | ||
| 245 | - | regval |= (u64)rd32ptp(wx, WX_TSC_1588_STMPL); | |
| 246 | - | regval |= (u64)rd32ptp(wx, WX_TSC_1588_STMPH) << 32; | |
| 247 | - | skb = wx->ptp_tx_skb; | |
| 248 | - | wx->ptp_tx_skb = NULL; | |
| 249 | - | clear_bit(WX_STATE_PTP_TX_IN_PROGRESS, wx->state); | |
| 250 | - | spin_unlock_irqrestore(&wx->ptp_tx_lock, flags); | |
| 251 | - | ||
| 252 | - | wx_ptp_convert_to_hwtstamp(wx, &shhwtstamps, regval); | |
| 253 | - | skb_tstamp_tx(skb, &shhwtstamps); | |
| 254 | - | dev_kfree_skb_any(skb); | |
| 255 | - | wx->tx_hwtstamp_pkts++; | |
| 256 | - | ||
| 257 | - | return 0; | |
| 220 | + | return -1; | |
| 258 | 221 | } | |
| 259 | 222 | ||
| 260 | 223 | /** | |
| @@ -333,29 +296,24 @@ static void wx_ptp_rx_hang(struct wx *wx) | |||
| 333 | 296 | */ | |
| 334 | 297 | static void wx_ptp_tx_hang(struct wx *wx) | |
| 335 | 298 | { | |
| 336 | - | struct sk_buff *skb = NULL; | |
| 337 | - | unsigned long flags; | |
| 299 | + | bool timeout = time_is_before_jiffies(wx->ptp_tx_start + | |
| 300 | + | WX_PTP_TX_TIMEOUT); | |
| 301 | + | ||
| 302 | + | if (!wx->ptp_tx_skb) | |
| 303 | + | return; | |
| 338 | 304 | ||
| 339 | - | spin_lock_irqsave(&wx->ptp_tx_lock, flags); | |
| 305 | + | if (!test_bit(WX_STATE_PTP_TX_IN_PROGRESS, wx->state)) | |
| 306 | + | return; | |
| 340 | 307 | ||
| 341 | 308 | /* If we haven't received a timestamp within the timeout, it is | |
| 342 | 309 | * reasonable to assume that it will never occur, so we can unlock the | |
| 343 | 310 | * timestamp bit when this occurs. | |
| 344 | 311 | */ | |
| 345 | - | if (wx->ptp_tx_skb && | |
| 346 | - | test_bit(WX_STATE_PTP_TX_IN_PROGRESS, wx->state) && | |
| 347 | - | time_is_before_jiffies(wx->ptp_tx_start + WX_PTP_TX_TIMEOUT)) { | |
| 348 | - | rd32ptp(wx, WX_TSC_1588_STMPH); | |
| 349 | - | skb = __wx_ptp_detach_tx_skb(wx); | |
| 312 | + | if (timeout) { | |
| 313 | + | wx_ptp_clear_tx_timestamp(wx); | |
| 314 | + | wx->tx_hwtstamp_timeouts++; | |
| 315 | + | dev_warn(&wx->pdev->dev, "clearing Tx timestamp hang\n"); | |
| 350 | 316 | } | |
| 351 | - | spin_unlock_irqrestore(&wx->ptp_tx_lock, flags); | |
| 352 | - | ||
| 353 | - | if (!skb) | |
| 354 | - | return; | |
| 355 | - | ||
| 356 | - | dev_kfree_skb_any(skb); | |
| 357 | - | wx->tx_hwtstamp_timeouts++; | |
| 358 | - | dev_warn(&wx->pdev->dev, "clearing Tx timestamp hang\n"); | |
| 359 | 317 | } | |
| 360 | 318 | ||
| 361 | 319 | static long wx_ptp_do_aux_work(struct ptp_clock_info *ptp) | |
| @@ -883,9 +841,6 @@ EXPORT_SYMBOL(wx_ptp_stop); | |||
| 883 | 841 | ||
| 884 | 842 | void wx_ptp_quiesce(struct wx *wx) | |
| 885 | 843 | { | |
| 886 | - | struct sk_buff *skb; | |
| 887 | - | unsigned long flags; | |
| 888 | - | ||
| 889 | 844 | if (!test_and_clear_bit(WX_STATE_PTP_RUNNING, wx->state)) | |
| 890 | 845 | return; | |
| 891 | 846 | ||
| @@ -894,14 +849,11 @@ void wx_ptp_quiesce(struct wx *wx) | |||
| 894 | 849 | if (wx->ptp_clock) | |
| 895 | 850 | ptp_cancel_worker_sync(wx->ptp_clock); | |
| 896 | 851 | ||
| 897 | - | /* Drop a pending Tx timestamp request. Do not touch the registers | |
| 898 | - | * here: quiesce runs during PCIe error recovery, where the device may | |
| 899 | - | * already be gone and MMIO is not reliable. | |
| 900 | - | */ | |
| 901 | - | spin_lock_irqsave(&wx->ptp_tx_lock, flags); | |
| 902 | - | skb = __wx_ptp_detach_tx_skb(wx); | |
| 903 | - | spin_unlock_irqrestore(&wx->ptp_tx_lock, flags); | |
| 904 | - | dev_kfree_skb_any(skb); | |
| 852 | + | if (wx->ptp_tx_skb) { | |
| 853 | + | dev_kfree_skb_any(wx->ptp_tx_skb); | |
| 854 | + | wx->ptp_tx_skb = NULL; | |
| 855 | + | } | |
| 856 | + | clear_bit_unlock(WX_STATE_PTP_TX_IN_PROGRESS, wx->state); | |
| 905 | 857 | ||
| 906 | 858 | if (wx->ptp_clock) { | |
| 907 | 859 | ptp_clock_unregister(wx->ptp_clock); | |
modified drivers/net/ethernet/wangxun/libwx/wx_type.h
| @@ -1430,8 +1430,6 @@ struct wx { | |||
| 1430 | 1430 | unsigned long last_overflow_check; | |
| 1431 | 1431 | unsigned long last_rx_ptp_check; | |
| 1432 | 1432 | unsigned long ptp_tx_start; | |
| 1433 | - | /* protects ptp_tx_skb, ptp_tx_start and the in-progress state bit */ | |
| 1434 | - | spinlock_t ptp_tx_lock; | |
| 1435 | 1433 | seqlock_t hw_tc_lock; /* seqlock for ptp */ | |
| 1436 | 1434 | struct cyclecounter hw_cc; | |
| 1437 | 1435 | struct timecounter hw_tc; | |
modified drivers/net/ethernet/wangxun/txgbe/txgbe_fdir.c
| @@ -591,24 +591,15 @@ static void txgbe_fdir_filter_restore(struct wx *wx) | |||
| 591 | 591 | queue = TXGBE_RDB_FDIR_DROP_QUEUE; | |
| 592 | 592 | } else { | |
| 593 | 593 | u32 ring = ethtool_get_flow_spec_ring(filter->action); | |
| 594 | - | u8 vf = ethtool_get_flow_spec_ring_vf(filter->action); | |
| 595 | 594 | ||
| 596 | - | if (!vf && ring >= wx->num_rx_queues) { | |
| 595 | + | if (ring >= wx->num_rx_queues) { | |
| 597 | 596 | wx_err(wx, "FDIR restore failed, ring:%u\n", | |
| 598 | 597 | ring); | |
| 599 | 598 | continue; | |
| 600 | - | } else if (vf && (vf > wx->num_vfs || | |
| 601 | - | ring >= wx->num_rx_queues_per_pool)) { | |
| 602 | - | wx_err(wx, "FDIR restore failed, vf:%u, ring:%u\n", | |
| 603 | - | vf, ring); | |
| 604 | - | continue; | |
| 605 | 599 | } | |
| 606 | 600 | ||
| 607 | 601 | /* Map the ring onto the absolute queue index */ | |
| 608 | - | if (!vf) | |
| 609 | - | queue = wx->rx_ring[ring]->reg_idx; | |
| 610 | - | else | |
| 611 | - | queue = ((vf - 1) * wx->num_rx_queues_per_pool) + ring; | |
| 602 | + | queue = wx->rx_ring[ring]->reg_idx; | |
| 612 | 603 | } | |
| 613 | 604 | ||
| 614 | 605 | ret = txgbe_fdir_write_perfect_filter(wx, | |
modified drivers/net/fddi/skfp/skfddi.c
| @@ -928,8 +928,7 @@ static int skfp_ctl_set_mac_address(struct net_device *dev, void *addr) | |||
| 928 | 928 | ||
| 929 | 929 | dev_addr_set(dev, p_sockaddr->sa_data); | |
| 930 | 930 | spin_lock_irqsave(&bp->DriverLock, Flags); | |
| 931 | - | if (netif_running(dev)) | |
| 932 | - | ResetAdapter(smc); | |
| 931 | + | ResetAdapter(smc); | |
| 933 | 932 | spin_unlock_irqrestore(&bp->DriverLock, Flags); | |
| 934 | 933 | ||
| 935 | 934 | return 0; /* always return zero */ | |
modified drivers/net/macsec.c
| @@ -3539,22 +3539,6 @@ static int macsec_dev_init(struct net_device *dev) | |||
| 3539 | 3539 | if (err) | |
| 3540 | 3540 | return err; | |
| 3541 | 3541 | ||
| 3542 | - | err = -ENOMEM; | |
| 3543 | - | macsec->stats = netdev_alloc_pcpu_stats(struct pcpu_secy_stats); | |
| 3544 | - | if (!macsec->stats) | |
| 3545 | - | goto destroy_gro_cells; | |
| 3546 | - | ||
| 3547 | - | macsec->secy.tx_sc.stats = | |
| 3548 | - | netdev_alloc_pcpu_stats(struct pcpu_tx_sc_stats); | |
| 3549 | - | if (!macsec->secy.tx_sc.stats) | |
| 3550 | - | goto free_secy_stats; | |
| 3551 | - | ||
| 3552 | - | macsec->secy.tx_sc.md_dst = metadata_dst_alloc(0, METADATA_MACSEC, | |
| 3553 | - | GFP_KERNEL); | |
| 3554 | - | if (!macsec->secy.tx_sc.md_dst) | |
| 3555 | - | goto free_tx_sc_stats; | |
| 3556 | - | macsec->secy.tx_sc.md_dst->u.macsec_info.sci = macsec->secy.sci; | |
| 3557 | - | ||
| 3558 | 3542 | macsec_inherit_tso_max(dev); | |
| 3559 | 3543 | ||
| 3560 | 3544 | dev->hw_features = real_dev->hw_features & MACSEC_OFFLOAD_FEATURES; | |
| @@ -3567,6 +3551,8 @@ static int macsec_dev_init(struct net_device *dev) | |||
| 3567 | 3551 | ||
| 3568 | 3552 | macsec_set_head_tail_room(dev); | |
| 3569 | 3553 | ||
| 3554 | + | if (is_zero_ether_addr(dev->dev_addr)) | |
| 3555 | + | eth_hw_addr_inherit(dev, real_dev); | |
| 3570 | 3556 | if (is_zero_ether_addr(dev->broadcast)) | |
| 3571 | 3557 | memcpy(dev->broadcast, real_dev->broadcast, dev->addr_len); | |
| 3572 | 3558 | ||
| @@ -3574,14 +3560,6 @@ static int macsec_dev_init(struct net_device *dev) | |||
| 3574 | 3560 | netdev_hold(real_dev, &macsec->dev_tracker, GFP_KERNEL); | |
| 3575 | 3561 | ||
| 3576 | 3562 | return 0; | |
| 3577 | - | ||
| 3578 | - | free_tx_sc_stats: | |
| 3579 | - | free_percpu(macsec->secy.tx_sc.stats); | |
| 3580 | - | free_secy_stats: | |
| 3581 | - | free_percpu(macsec->stats); | |
| 3582 | - | destroy_gro_cells: | |
| 3583 | - | gro_cells_destroy(&macsec->gro_cells); | |
| 3584 | - | return err; | |
| 3585 | 3563 | } | |
| 3586 | 3564 | ||
| 3587 | 3565 | static void macsec_dev_uninit(struct net_device *dev) | |
| @@ -4138,11 +4116,26 @@ static sci_t dev_to_sci(struct net_device *dev, __be16 port) | |||
| 4138 | 4116 | return make_sci(dev->dev_addr, port); | |
| 4139 | 4117 | } | |
| 4140 | 4118 | ||
| 4141 | - | static void macsec_init_secy(struct net_device *dev, sci_t sci, u8 icv_len) | |
| 4119 | + | static int macsec_add_dev(struct net_device *dev, sci_t sci, u8 icv_len) | |
| 4142 | 4120 | { | |
| 4143 | 4121 | struct macsec_dev *macsec = macsec_priv(dev); | |
| 4144 | 4122 | struct macsec_secy *secy = &macsec->secy; | |
| 4145 | 4123 | ||
| 4124 | + | macsec->stats = netdev_alloc_pcpu_stats(struct pcpu_secy_stats); | |
| 4125 | + | if (!macsec->stats) | |
| 4126 | + | return -ENOMEM; | |
| 4127 | + | ||
| 4128 | + | secy->tx_sc.stats = netdev_alloc_pcpu_stats(struct pcpu_tx_sc_stats); | |
| 4129 | + | if (!secy->tx_sc.stats) | |
| 4130 | + | return -ENOMEM; | |
| 4131 | + | ||
| 4132 | + | secy->tx_sc.md_dst = metadata_dst_alloc(0, METADATA_MACSEC, GFP_KERNEL); | |
| 4133 | + | if (!secy->tx_sc.md_dst) | |
| 4134 | + | /* macsec and secy percpu stats will be freed when unregistering | |
| 4135 | + | * net_device in macsec_free_netdev() | |
| 4136 | + | */ | |
| 4137 | + | return -ENOMEM; | |
| 4138 | + | ||
| 4146 | 4139 | if (sci == MACSEC_UNDEF_SCI) | |
| 4147 | 4140 | sci = dev_to_sci(dev, MACSEC_PORT_ES); | |
| 4148 | 4141 | ||
| @@ -4156,12 +4149,15 @@ static void macsec_init_secy(struct net_device *dev, sci_t sci, u8 icv_len) | |||
| 4156 | 4149 | secy->xpn = DEFAULT_XPN; | |
| 4157 | 4150 | ||
| 4158 | 4151 | secy->sci = sci; | |
| 4152 | + | secy->tx_sc.md_dst->u.macsec_info.sci = sci; | |
| 4159 | 4153 | secy->tx_sc.active = true; | |
| 4160 | 4154 | secy->tx_sc.encoding_sa = DEFAULT_ENCODING_SA; | |
| 4161 | 4155 | secy->tx_sc.encrypt = DEFAULT_ENCRYPT; | |
| 4162 | 4156 | secy->tx_sc.send_sci = DEFAULT_SEND_SCI; | |
| 4163 | 4157 | secy->tx_sc.end_station = false; | |
| 4164 | 4158 | secy->tx_sc.scb = false; | |
| 4159 | + | ||
| 4160 | + | return 0; | |
| 4165 | 4161 | } | |
| 4166 | 4162 | ||
| 4167 | 4163 | static struct lock_class_key macsec_netdev_addr_lock_key; | |
| @@ -4224,24 +4220,6 @@ static int macsec_newlink(struct net_device *dev, | |||
| 4224 | 4220 | if (rx_handler && rx_handler != macsec_handle_frame) | |
| 4225 | 4221 | return -EBUSY; | |
| 4226 | 4222 | ||
| 4227 | - | if (is_zero_ether_addr(dev->dev_addr)) | |
| 4228 | - | eth_hw_addr_inherit(dev, real_dev); | |
| 4229 | - | ||
| 4230 | - | if (data && data[IFLA_MACSEC_SCI]) | |
| 4231 | - | sci = nla_get_sci(data[IFLA_MACSEC_SCI]); | |
| 4232 | - | else if (data && data[IFLA_MACSEC_PORT]) | |
| 4233 | - | sci = dev_to_sci(dev, nla_get_be16(data[IFLA_MACSEC_PORT])); | |
| 4234 | - | else | |
| 4235 | - | sci = dev_to_sci(dev, MACSEC_PORT_ES); | |
| 4236 | - | ||
| 4237 | - | /* Registration can notify listeners before returning. */ | |
| 4238 | - | macsec_init_secy(dev, sci, icv_len); | |
| 4239 | - | if (data) { | |
| 4240 | - | err = macsec_changelink_common(dev, data); | |
| 4241 | - | if (err) | |
| 4242 | - | return err; | |
| 4243 | - | } | |
| 4244 | - | ||
| 4245 | 4223 | err = register_netdevice(dev); | |
| 4246 | 4224 | if (err < 0) | |
| 4247 | 4225 | return err; | |
| @@ -4254,11 +4232,31 @@ static int macsec_newlink(struct net_device *dev, | |||
| 4254 | 4232 | if (err < 0) | |
| 4255 | 4233 | goto unregister; | |
| 4256 | 4234 | ||
| 4235 | + | /* need to be already registered so that ->init has run and | |
| 4236 | + | * the MAC addr is set | |
| 4237 | + | */ | |
| 4238 | + | if (data && data[IFLA_MACSEC_SCI]) | |
| 4239 | + | sci = nla_get_sci(data[IFLA_MACSEC_SCI]); | |
| 4240 | + | else if (data && data[IFLA_MACSEC_PORT]) | |
| 4241 | + | sci = dev_to_sci(dev, nla_get_be16(data[IFLA_MACSEC_PORT])); | |
| 4242 | + | else | |
| 4243 | + | sci = dev_to_sci(dev, MACSEC_PORT_ES); | |
| 4244 | + | ||
| 4257 | 4245 | if (rx_handler && sci_exists(real_dev, sci)) { | |
| 4258 | 4246 | err = -EBUSY; | |
| 4259 | 4247 | goto unlink; | |
| 4260 | 4248 | } | |
| 4261 | 4249 | ||
| 4250 | + | err = macsec_add_dev(dev, sci, icv_len); | |
| 4251 | + | if (err) | |
| 4252 | + | goto unlink; | |
| 4253 | + | ||
| 4254 | + | if (data) { | |
| 4255 | + | err = macsec_changelink_common(dev, data); | |
| 4256 | + | if (err) | |
| 4257 | + | goto del_dev; | |
| 4258 | + | } | |
| 4259 | + | ||
| 4262 | 4260 | /* If h/w offloading is available, propagate to the device */ | |
| 4263 | 4261 | if (macsec_is_offloaded(macsec)) { | |
| 4264 | 4262 | const struct macsec_ops *ops; | |
modified drivers/net/mdio/mdio-realtek-rtl9300.c
| @@ -88,8 +88,6 @@ | |||
| 88 | 88 | #define RTL9310_SMI_INDRT_ACCESS_BC_PHYID_CTRL 0x0c14 | |
| 89 | 89 | #define RTL9310_BC_PORT_ID GENMASK(10, 5) | |
| 90 | 90 | #define RTL9310_SMI_INDRT_ACCESS_CTRL_1 0x0c04 | |
| 91 | - | #define RTL9310_SMI_INDRT_EXT_PAGE GENMASK(8, 0) | |
| 92 | - | #define RTL9310_SMI_INDRT_EXT_PAGE_NO_CHANGE 0x1ff | |
| 93 | 91 | #define RTL9310_SMI_INDRT_ACCESS_CTRL_2_LOW 0x0c08 | |
| 94 | 92 | #define RTL9310_SMI_INDRT_ACCESS_CTRL_2_HIGH 0x0c0c | |
| 95 | 93 | #define RTL9310_SMI_INDRT_ACCESS_CTRL_3 0x0c10 /* I/O fields flipped */ | |
| @@ -327,8 +325,6 @@ static int otto_emdio_9310_read_c22(struct mii_bus *bus, int port, int regnum, u | |||
| 327 | 325 | .broadcast = FIELD_PREP(RTL9310_BC_PORT_ID, port), | |
| 328 | 326 | .c22_data = FIELD_PREP(RTL9310_PHY_CTRL_REG_ADDR, regnum) | | |
| 329 | 327 | FIELD_PREP(RTL9310_PHY_CTRL_MAIN_PAGE, RAW_PAGE(priv)), | |
| 330 | - | .ext_page = FIELD_PREP(RTL9310_SMI_INDRT_EXT_PAGE, | |
| 331 | - | RTL9310_SMI_INDRT_EXT_PAGE_NO_CHANGE), | |
| 332 | 328 | }; | |
| 333 | 329 | ||
| 334 | 330 | return otto_emdio_read_cmd(bus, RTL9310_PHY_CTRL_TYPE_C22, &cmd_data, | |
| @@ -341,8 +337,6 @@ static int otto_emdio_9310_write_c22(struct mii_bus *bus, int port, int regnum, | |||
| 341 | 337 | struct otto_emdio_cmd_regs cmd_data = { | |
| 342 | 338 | .c22_data = FIELD_PREP(RTL9310_PHY_CTRL_REG_ADDR, regnum) | | |
| 343 | 339 | FIELD_PREP(RTL9310_PHY_CTRL_MAIN_PAGE, RAW_PAGE(priv)), | |
| 344 | - | .ext_page = FIELD_PREP(RTL9310_SMI_INDRT_EXT_PAGE, | |
| 345 | - | RTL9310_SMI_INDRT_EXT_PAGE_NO_CHANGE), | |
| 346 | 340 | .io_data = FIELD_PREP(RTL9310_PHY_CTRL_INDATA, value), | |
| 347 | 341 | .port_mask_high = (u32)(BIT_ULL(port) >> 32), | |
| 348 | 342 | .port_mask_low = (u32)(BIT_ULL(port)), | |
modified drivers/net/ovpn/netlink.c
| @@ -100,8 +100,6 @@ static bool ovpn_nl_attr_sockaddr_remote(struct nlattr **attrs, | |||
| 100 | 100 | struct sockaddr_in6 *sin6; | |
| 101 | 101 | struct sockaddr_in *sin; | |
| 102 | 102 | struct in6_addr *in6; | |
| 103 | - | struct nlattr *scope; | |
| 104 | - | u32 scope_id = 0; | |
| 105 | 103 | __be16 port = 0; | |
| 106 | 104 | __be32 *in; | |
| 107 | 105 | ||
| @@ -116,9 +114,6 @@ static bool ovpn_nl_attr_sockaddr_remote(struct nlattr **attrs, | |||
| 116 | 114 | } else if (attrs[OVPN_A_PEER_REMOTE_IPV6]) { | |
| 117 | 115 | ss->ss_family = AF_INET6; | |
| 118 | 116 | in6 = nla_data(attrs[OVPN_A_PEER_REMOTE_IPV6]); | |
| 119 | - | scope = attrs[OVPN_A_PEER_REMOTE_IPV6_SCOPE_ID]; | |
| 120 | - | if (scope) | |
| 121 | - | scope_id = nla_get_u32(scope); | |
| 122 | 117 | } else { | |
| 123 | 118 | return false; | |
| 124 | 119 | } | |
| @@ -131,7 +126,6 @@ static bool ovpn_nl_attr_sockaddr_remote(struct nlattr **attrs, | |||
| 131 | 126 | if (!ipv6_addr_v4mapped(in6)) { | |
| 132 | 127 | sin6 = (struct sockaddr_in6 *)ss; | |
| 133 | 128 | sin6->sin6_port = port; | |
| 134 | - | sin6->sin6_scope_id = scope_id; | |
| 135 | 129 | memcpy(&sin6->sin6_addr, in6, sizeof(*in6)); | |
| 136 | 130 | break; | |
| 137 | 131 | } | |
| @@ -185,39 +179,6 @@ static sa_family_t ovpn_nl_family_get(struct nlattr *addr4, | |||
| 185 | 179 | return AF_UNSPEC; | |
| 186 | 180 | } | |
| 187 | 181 | ||
| 188 | - | static int ovpn_nl_peer_check_vpn_addrs(const struct in_addr *addr4, | |
| 189 | - | const struct in6_addr *addr6, | |
| 190 | - | struct genl_info *info) | |
| 191 | - | { | |
| 192 | - | int addr6_type; | |
| 193 | - | ||
| 194 | - | if (addr4->s_addr == htonl(INADDR_ANY) && ipv6_addr_any(addr6)) { | |
| 195 | - | NL_SET_ERR_MSG_MOD(info->extack, | |
| 196 | - | "at least one VPN IP must be configured in MP mode"); | |
| 197 | - | return -EINVAL; | |
| 198 | - | } | |
| 199 | - | ||
| 200 | - | if (ipv4_is_multicast(addr4->s_addr) || ipv4_is_lbcast(addr4->s_addr) || | |
| 201 | - | ipv4_is_loopback(addr4->s_addr)) { | |
| 202 | - | NL_SET_ERR_MSG_MOD(info->extack, | |
| 203 | - | "VPN IPv4 address must be valid unicast or any"); | |
| 204 | - | return -EADDRNOTAVAIL; | |
| 205 | - | } | |
| 206 | - | ||
| 207 | - | if (!ipv6_addr_any(addr6)) { | |
| 208 | - | addr6_type = ipv6_addr_type(addr6); | |
| 209 | - | ||
| 210 | - | if (!(addr6_type & IPV6_ADDR_UNICAST) || | |
| 211 | - | (addr6_type & (IPV6_ADDR_LOOPBACK | IPV6_ADDR_COMPATv4))) { | |
| 212 | - | NL_SET_ERR_MSG_MOD(info->extack, | |
| 213 | - | "VPN IPv6 address must be valid unicast or any"); | |
| 214 | - | return -EADDRNOTAVAIL; | |
| 215 | - | } | |
| 216 | - | } | |
| 217 | - | ||
| 218 | - | return 0; | |
| 219 | - | } | |
| 220 | - | ||
| 221 | 182 | static int ovpn_nl_peer_precheck(struct ovpn_priv *ovpn, | |
| 222 | 183 | struct genl_info *info, | |
| 223 | 184 | struct nlattr **attrs) | |
| @@ -385,10 +346,8 @@ err_unlock: | |||
| 385 | 346 | ||
| 386 | 347 | int ovpn_nl_peer_new_doit(struct sk_buff *skb, struct genl_info *info) | |
| 387 | 348 | { | |
| 388 | - | struct in_addr vpn_addr4 = { .s_addr = htonl(INADDR_ANY) }; | |
| 389 | - | struct in6_addr vpn_addr6 = IN6ADDR_ANY_INIT; | |
| 390 | - | struct ovpn_priv *ovpn = info->user_ptr[0]; | |
| 391 | 349 | struct nlattr *attrs[OVPN_A_PEER_MAX + 1]; | |
| 350 | + | struct ovpn_priv *ovpn = info->user_ptr[0]; | |
| 392 | 351 | struct ovpn_socket *ovpn_sock; | |
| 393 | 352 | struct socket *sock = NULL; | |
| 394 | 353 | struct ovpn_peer *peer; | |
| @@ -412,18 +371,11 @@ int ovpn_nl_peer_new_doit(struct sk_buff *skb, struct genl_info *info) | |||
| 412 | 371 | return -EINVAL; | |
| 413 | 372 | ||
| 414 | 373 | /* in MP mode VPN IPs are required for selecting the right peer */ | |
| 415 | - | if (ovpn->mode == OVPN_MODE_MP) { | |
| 416 | - | if (attrs[OVPN_A_PEER_VPN_IPV4]) | |
| 417 | - | vpn_addr4.s_addr = | |
| 418 | - | nla_get_in_addr(attrs[OVPN_A_PEER_VPN_IPV4]); | |
| 419 | - | if (attrs[OVPN_A_PEER_VPN_IPV6]) | |
| 420 | - | vpn_addr6 = | |
| 421 | - | nla_get_in6_addr(attrs[OVPN_A_PEER_VPN_IPV6]); | |
| 422 | - | ||
| 423 | - | ret = ovpn_nl_peer_check_vpn_addrs(&vpn_addr4, &vpn_addr6, | |
| 424 | - | info); | |
| 425 | - | if (ret < 0) | |
| 426 | - | return ret; | |
| 374 | + | if (ovpn->mode == OVPN_MODE_MP && !attrs[OVPN_A_PEER_VPN_IPV4] && | |
| 375 | + | !attrs[OVPN_A_PEER_VPN_IPV6]) { | |
| 376 | + | NL_SET_ERR_MSG_FMT_MOD(info->extack, | |
| 377 | + | "VPN IP must be provided in MP mode"); | |
| 378 | + | return -EINVAL; | |
| 427 | 379 | } | |
| 428 | 380 | ||
| 429 | 381 | peer_id = nla_get_u32(attrs[OVPN_A_PEER_ID]); | |
| @@ -522,10 +474,8 @@ peer_release: | |||
| 522 | 474 | ||
| 523 | 475 | int ovpn_nl_peer_set_doit(struct sk_buff *skb, struct genl_info *info) | |
| 524 | 476 | { | |
| 525 | - | struct ovpn_priv *ovpn = info->user_ptr[0]; | |
| 526 | 477 | struct nlattr *attrs[OVPN_A_PEER_MAX + 1]; | |
| 527 | - | struct in6_addr vpn_addr6; | |
| 528 | - | struct in_addr vpn_addr4; | |
| 478 | + | struct ovpn_priv *ovpn = info->user_ptr[0]; | |
| 529 | 479 | struct ovpn_socket *sock; | |
| 530 | 480 | struct ovpn_peer *peer; | |
| 531 | 481 | u32 peer_id; | |
| @@ -572,58 +522,28 @@ int ovpn_nl_peer_set_doit(struct sk_buff *skb, struct genl_info *info) | |||
| 572 | 522 | rcu_read_unlock(); | |
| 573 | 523 | ||
| 574 | 524 | spin_lock_bh(&ovpn->lock); | |
| 575 | - | ||
| 576 | - | vpn_addr4 = peer->vpn_addrs.ipv4; | |
| 577 | - | vpn_addr6 = peer->vpn_addrs.ipv6; | |
| 578 | - | ||
| 579 | - | /* reject peer with conflicting VPN address */ | |
| 580 | - | if (attrs[OVPN_A_PEER_VPN_IPV4]) { | |
| 581 | - | vpn_addr4.s_addr = nla_get_in_addr(attrs[OVPN_A_PEER_VPN_IPV4]); | |
| 582 | - | if (ovpn_peer_vpn_addr_conflict4(ovpn, peer, &vpn_addr4)) | |
| 583 | - | goto addr_conflict; | |
| 584 | - | } | |
| 585 | - | if (attrs[OVPN_A_PEER_VPN_IPV6]) { | |
| 586 | - | vpn_addr6 = nla_get_in6_addr(attrs[OVPN_A_PEER_VPN_IPV6]); | |
| 587 | - | if (ovpn_peer_vpn_addr_conflict6(ovpn, peer, &vpn_addr6)) | |
| 588 | - | goto addr_conflict; | |
| 589 | - | } | |
| 590 | - | ||
| 591 | - | /* in MP mode VPN IPs are required for selecting the right peer */ | |
| 592 | - | if (ovpn->mode == OVPN_MODE_MP) { | |
| 593 | - | ret = ovpn_nl_peer_check_vpn_addrs(&vpn_addr4, &vpn_addr6, | |
| 594 | - | info); | |
| 595 | - | if (ret < 0) | |
| 596 | - | goto unlock; | |
| 597 | - | } | |
| 598 | - | ||
| 599 | 525 | ret = ovpn_nl_peer_modify(peer, info, attrs); | |
| 600 | - | if (ret < 0) | |
| 601 | - | goto unlock; | |
| 526 | + | if (ret < 0) { | |
| 527 | + | spin_unlock_bh(&ovpn->lock); | |
| 528 | + | ovpn_peer_put(peer); | |
| 529 | + | return ret; | |
| 530 | + | } | |
| 602 | 531 | ||
| 603 | 532 | /* ret == 1 means that VPN IPv4/6 has been modified and rehashing | |
| 604 | 533 | * is required | |
| 605 | 534 | */ | |
| 606 | - | if (ret > 0) { | |
| 535 | + | if (ret > 0) | |
| 607 | 536 | ovpn_peer_hash_vpn_ip(peer); | |
| 608 | - | ret = 0; | |
| 609 | - | } | |
| 610 | 537 | /* if the remote endpoint was updated, the by_transp_addr hash bucket | |
| 611 | 538 | * also needs to be refreshed, otherwise incoming packets from the new | |
| 612 | 539 | * remote address would fail the lockless lookup | |
| 613 | 540 | */ | |
| 614 | 541 | if (attrs[OVPN_A_PEER_REMOTE_IPV4] || attrs[OVPN_A_PEER_REMOTE_IPV6]) | |
| 615 | 542 | ovpn_peer_hash_transp_addr(peer); | |
| 616 | - | ||
| 617 | - | unlock: | |
| 618 | 543 | spin_unlock_bh(&ovpn->lock); | |
| 619 | 544 | ovpn_peer_put(peer); | |
| 620 | 545 | ||
| 621 | - | return ret; | |
| 622 | - | addr_conflict: | |
| 623 | - | NL_SET_ERR_MSG_FMT_MOD(info->extack, | |
| 624 | - | "VPN IP is already assigned to another peer"); | |
| 625 | - | ret = -EADDRINUSE; | |
| 626 | - | goto unlock; | |
| 546 | + | return 0; | |
| 627 | 547 | } | |
| 628 | 548 | ||
| 629 | 549 | static int ovpn_nl_send_peer(struct sk_buff *skb, const struct genl_info *info, | |
modified drivers/net/ovpn/peer.c
| @@ -113,7 +113,6 @@ struct ovpn_peer *ovpn_peer_new(struct ovpn_priv *ovpn, u32 id) | |||
| 113 | 113 | RCU_INIT_POINTER(peer->bind, NULL); | |
| 114 | 114 | ovpn_crypto_state_init(&peer->crypto); | |
| 115 | 115 | spin_lock_init(&peer->lock); | |
| 116 | - | seqcount_spinlock_init(&peer->route_key_seq, &peer->lock); | |
| 117 | 116 | kref_init(&peer->refcount); | |
| 118 | 117 | ovpn_peer_stats_init(&peer->vpn_stats); | |
| 119 | 118 | ovpn_peer_stats_init(&peer->link_stats); | |
| @@ -200,12 +199,13 @@ static void __ovpn_peer_hash_transp_addr(struct ovpn_peer *peer, | |||
| 200 | 199 | */ | |
| 201 | 200 | void ovpn_peer_endpoints_update(struct ovpn_peer *peer, struct sk_buff *skb) | |
| 202 | 201 | { | |
| 203 | - | const void *local_ip = NULL; | |
| 204 | 202 | struct sockaddr_storage ss; | |
| 205 | 203 | struct sockaddr_in6 *sa6; | |
| 204 | + | bool reset_cache = false; | |
| 206 | 205 | struct sockaddr_in *sa; | |
| 207 | 206 | struct ovpn_bind *bind; | |
| 208 | - | bool floated = false; | |
| 207 | + | const void *local_ip; | |
| 208 | + | size_t salen = 0; | |
| 209 | 209 | ||
| 210 | 210 | spin_lock_bh(&peer->lock); | |
| 211 | 211 | bind = rcu_dereference_protected(peer->bind, | |
| @@ -232,7 +232,8 @@ void ovpn_peer_endpoints_update(struct ovpn_peer *peer, struct sk_buff *skb) | |||
| 232 | 232 | .sin_addr.s_addr = ip_hdr(skb)->saddr, | |
| 233 | 233 | .sin_port = udp_hdr(skb)->source, | |
| 234 | 234 | }; | |
| 235 | - | floated = true; | |
| 235 | + | salen = sizeof(*sa); | |
| 236 | + | reset_cache = true; | |
| 236 | 237 | break; | |
| 237 | 238 | } | |
| 238 | 239 | ||
| @@ -244,12 +245,10 @@ void ovpn_peer_endpoints_update(struct ovpn_peer *peer, struct sk_buff *skb) | |||
| 244 | 245 | netdev_name(peer->ovpn->dev), | |
| 245 | 246 | peer->id, &bind->local.ipv4.s_addr, | |
| 246 | 247 | &ip_hdr(skb)->daddr); | |
| 247 | - | local_ip = &ip_hdr(skb)->daddr; | |
| 248 | - | memcpy(&ss, &bind->remote, sizeof(struct sockaddr_in)); | |
| 249 | - | break; | |
| 248 | + | bind->local.ipv4.s_addr = ip_hdr(skb)->daddr; | |
| 249 | + | reset_cache = true; | |
| 250 | 250 | } | |
| 251 | - | /* nothing changed */ | |
| 252 | - | goto unlock; | |
| 251 | + | break; | |
| 253 | 252 | case htons(ETH_P_IPV6): | |
| 254 | 253 | /* float check */ | |
| 255 | 254 | if (unlikely(!ovpn_bind_skb_src_match(bind, skb))) { | |
| @@ -271,7 +270,8 @@ void ovpn_peer_endpoints_update(struct ovpn_peer *peer, struct sk_buff *skb) | |||
| 271 | 270 | ipv6_iface_scope_id(&ipv6_hdr(skb)->saddr, | |
| 272 | 271 | skb->skb_iif), | |
| 273 | 272 | }; | |
| 274 | - | floated = true; | |
| 273 | + | salen = sizeof(*sa6); | |
| 274 | + | reset_cache = true; | |
| 275 | 275 | break; | |
| 276 | 276 | } | |
| 277 | 277 | ||
| @@ -284,30 +284,26 @@ void ovpn_peer_endpoints_update(struct ovpn_peer *peer, struct sk_buff *skb) | |||
| 284 | 284 | netdev_name(peer->ovpn->dev), | |
| 285 | 285 | peer->id, &bind->local.ipv6, | |
| 286 | 286 | &ipv6_hdr(skb)->daddr); | |
| 287 | - | local_ip = &ipv6_hdr(skb)->daddr; | |
| 288 | - | memcpy(&ss, &bind->remote, sizeof(struct sockaddr_in6)); | |
| 289 | - | break; | |
| 287 | + | bind->local.ipv6 = ipv6_hdr(skb)->daddr; | |
| 288 | + | reset_cache = true; | |
| 290 | 289 | } | |
| 291 | - | /* nothing changed */ | |
| 292 | - | goto unlock; | |
| 290 | + | break; | |
| 293 | 291 | default: | |
| 294 | 292 | goto unlock; | |
| 295 | 293 | } | |
| 296 | 294 | ||
| 295 | + | if (unlikely(reset_cache)) | |
| 296 | + | dst_cache_reset(&peer->dst_cache); | |
| 297 | + | ||
| 298 | + | /* if the peer did not float, we can bail out now */ | |
| 299 | + | if (likely(!salen)) | |
| 300 | + | goto unlock; | |
| 301 | + | ||
| 297 | 302 | if (unlikely(ovpn_peer_reset_sockaddr(peer, | |
| 298 | 303 | (struct sockaddr_storage *)&ss, | |
| 299 | 304 | local_ip) < 0)) | |
| 300 | 305 | goto unlock; | |
| 301 | 306 | ||
| 302 | - | /* reset the cache only after a successful bind update to avoid useless | |
| 303 | - | * cache misses on concurrent TX | |
| 304 | - | */ | |
| 305 | - | dst_cache_reset(&peer->dst_cache); | |
| 306 | - | ||
| 307 | - | /* if only the local address changed, bail out now */ | |
| 308 | - | if (!floated) | |
| 309 | - | goto unlock; | |
| 310 | - | ||
| 311 | 307 | net_dbg_ratelimited("%s: peer %d floated to %pIScp", | |
| 312 | 308 | netdev_name(peer->ovpn->dev), peer->id, &ss); | |
| 313 | 309 | ||
| @@ -488,7 +484,7 @@ begin: | |||
| 488 | 484 | * Return: the peer if found or NULL otherwise | |
| 489 | 485 | */ | |
| 490 | 486 | static struct ovpn_peer *ovpn_peer_get_by_vpn_addr6(struct ovpn_priv *ovpn, | |
| 491 | - | const struct in6_addr *addr) | |
| 487 | + | struct in6_addr *addr) | |
| 492 | 488 | { | |
| 493 | 489 | struct hlist_nulls_head *nhead; | |
| 494 | 490 | struct hlist_nulls_node *ntmp; | |
| @@ -513,64 +509,6 @@ begin: | |||
| 513 | 509 | return NULL; | |
| 514 | 510 | } | |
| 515 | 511 | ||
| 516 | - | /** | |
| 517 | - | * ovpn_peer_vpn_addr_conflict4 - check if the VPN v4 address is already in use | |
| 518 | - | * @ovpn: the openvpn instance to search | |
| 519 | - | * @peer: peer being added or updated, or NULL | |
| 520 | - | * @addr: VPN IPv4 address to check | |
| 521 | - | * | |
| 522 | - | * Check whether @addr is already assigned to another peer. @peer is ignored | |
| 523 | - | * when found, allowing peer updates that keep an existing address. | |
| 524 | - | * Unspecified addresses are ignored. | |
| 525 | - | * | |
| 526 | - | * Note: the caller must hold @ovpn->lock. | |
| 527 | - | * | |
| 528 | - | * Return: true on conflict, false otherwise. | |
| 529 | - | */ | |
| 530 | - | bool ovpn_peer_vpn_addr_conflict4(struct ovpn_priv *ovpn, | |
| 531 | - | const struct ovpn_peer *peer, | |
| 532 | - | const struct in_addr *addr) | |
| 533 | - | { | |
| 534 | - | struct ovpn_peer *tmp = NULL; | |
| 535 | - | ||
| 536 | - | lockdep_assert_held(&ovpn->lock); | |
| 537 | - | ||
| 538 | - | /* we don't hash INADDR_ANY, no conflict in that case */ | |
| 539 | - | if (addr->s_addr != htonl(INADDR_ANY)) | |
| 540 | - | tmp = ovpn_peer_get_by_vpn_addr4(ovpn, addr->s_addr); | |
| 541 | - | ||
| 542 | - | return tmp && tmp != peer; | |
| 543 | - | } | |
| 544 | - | ||
| 545 | - | /** | |
| 546 | - | * ovpn_peer_vpn_addr_conflict6 - check if the VPN v6 address is already in use | |
| 547 | - | * @ovpn: the openvpn instance to search | |
| 548 | - | * @peer: peer being added or updated, or NULL | |
| 549 | - | * @addr: VPN IPv6 address to check | |
| 550 | - | * | |
| 551 | - | * Check whether @addr is already assigned to another peer. @peer is ignored | |
| 552 | - | * when found, allowing peer updates that keep an existing address. | |
| 553 | - | * Unspecified addresses are ignored. | |
| 554 | - | * | |
| 555 | - | * Note: the caller must hold @ovpn->lock. | |
| 556 | - | * | |
| 557 | - | * Return: true on conflict, false otherwise. | |
| 558 | - | */ | |
| 559 | - | bool ovpn_peer_vpn_addr_conflict6(struct ovpn_priv *ovpn, | |
| 560 | - | const struct ovpn_peer *peer, | |
| 561 | - | const struct in6_addr *addr) | |
| 562 | - | { | |
| 563 | - | struct ovpn_peer *tmp = NULL; | |
| 564 | - | ||
| 565 | - | lockdep_assert_held(&ovpn->lock); | |
| 566 | - | ||
| 567 | - | /* we don't hash ::, no conflict in that case */ | |
| 568 | - | if (!ipv6_addr_any(addr)) | |
| 569 | - | tmp = ovpn_peer_get_by_vpn_addr6(ovpn, addr); | |
| 570 | - | ||
| 571 | - | return tmp && tmp != peer; | |
| 572 | - | } | |
| 573 | - | ||
| 574 | 512 | /** | |
| 575 | 513 | * ovpn_peer_transp_match - check if sockaddr and peer binding match | |
| 576 | 514 | * @peer: the peer to get the binding from | |
| @@ -1052,11 +990,10 @@ void ovpn_peer_hash_vpn_ip(struct ovpn_peer *peer) | |||
| 1052 | 990 | if (hlist_unhashed(&peer->hash_entry_id)) | |
| 1053 | 991 | return; | |
| 1054 | 992 | ||
| 1055 | - | /* remove potential old hashing */ | |
| 1056 | - | hlist_nulls_del_init_rcu(&peer->hash_entry_addr4); | |
| 1057 | - | hlist_nulls_del_init_rcu(&peer->hash_entry_addr6); | |
| 1058 | - | ||
| 1059 | 993 | if (peer->vpn_addrs.ipv4.s_addr != htonl(INADDR_ANY)) { | |
| 994 | + | /* remove potential old hashing */ | |
| 995 | + | hlist_nulls_del_init_rcu(&peer->hash_entry_addr4); | |
| 996 | + | ||
| 1060 | 997 | nhead = ovpn_get_hash_head(peer->ovpn->peers->by_vpn_addr4, | |
| 1061 | 998 | &peer->vpn_addrs.ipv4, | |
| 1062 | 999 | sizeof(peer->vpn_addrs.ipv4)); | |
| @@ -1064,6 +1001,9 @@ void ovpn_peer_hash_vpn_ip(struct ovpn_peer *peer) | |||
| 1064 | 1001 | } | |
| 1065 | 1002 | ||
| 1066 | 1003 | if (!ipv6_addr_any(&peer->vpn_addrs.ipv6)) { | |
| 1004 | + | /* remove potential old hashing */ | |
| 1005 | + | hlist_nulls_del_init_rcu(&peer->hash_entry_addr6); | |
| 1006 | + | ||
| 1067 | 1007 | nhead = ovpn_get_hash_head(peer->ovpn->peers->by_vpn_addr6, | |
| 1068 | 1008 | &peer->vpn_addrs.ipv6, | |
| 1069 | 1009 | sizeof(peer->vpn_addrs.ipv6)); | |
| @@ -1098,13 +1038,6 @@ static int ovpn_peer_add_mp(struct ovpn_priv *ovpn, struct ovpn_peer *peer) | |||
| 1098 | 1038 | goto out; | |
| 1099 | 1039 | } | |
| 1100 | 1040 | ||
| 1101 | - | /* reject peer with conflicting VPN address */ | |
| 1102 | - | if (ovpn_peer_vpn_addr_conflict4(ovpn, NULL, &peer->vpn_addrs.ipv4) || | |
| 1103 | - | ovpn_peer_vpn_addr_conflict6(ovpn, NULL, &peer->vpn_addrs.ipv6)) { | |
| 1104 | - | ret = -EADDRINUSE; | |
| 1105 | - | goto out; | |
| 1106 | - | } | |
| 1107 | - | ||
| 1108 | 1041 | bind = rcu_dereference_protected(peer->bind, true); | |
| 1109 | 1042 | /* peers connected via TCP have bind == NULL */ | |
| 1110 | 1043 | if (bind) { | |
modified drivers/net/ovpn/peer.h
| @@ -10,7 +10,6 @@ | |||
| 10 | 10 | #ifndef _NET_OVPN_OVPNPEER_H_ | |
| 11 | 11 | #define _NET_OVPN_OVPNPEER_H_ | |
| 12 | 12 | ||
| 13 | - | #include <linux/seqlock.h> | |
| 14 | 13 | #include <net/dst_cache.h> | |
| 15 | 14 | #include <net/strparser.h> | |
| 16 | 15 | ||
| @@ -18,16 +17,6 @@ | |||
| 18 | 17 | #include "socket.h" | |
| 19 | 18 | #include "stats.h" | |
| 20 | 19 | ||
| 21 | - | /** | |
| 22 | - | * struct ovpn_route_key - route key used for the peer dst cache | |
| 23 | - | * @mark: fwmark used for route lookup | |
| 24 | - | * @sport: UDP source port used for route lookup | |
| 25 | - | */ | |
| 26 | - | struct ovpn_route_key { | |
| 27 | - | u32 mark; | |
| 28 | - | __be16 sport; | |
| 29 | - | }; | |
| 30 | - | ||
| 31 | 20 | /** | |
| 32 | 21 | * struct ovpn_peer - the main remote peer object | |
| 33 | 22 | * @ovpn: main openvpn instance this peer belongs to | |
| @@ -56,8 +45,6 @@ struct ovpn_route_key { | |||
| 56 | 45 | * @tcp.sk_cb.ops: pointer to the original prot_ops object (TCP only) | |
| 57 | 46 | * @crypto: the crypto configuration (ciphers, keys, etc..) | |
| 58 | 47 | * @dst_cache: cache for dst_entry used to send to peer | |
| 59 | - | * @route_key: route key matching the current dst cache contents | |
| 60 | - | * @route_key_seq: seqcount protecting lockless route_key reads | |
| 61 | 48 | * @bind: remote peer binding | |
| 62 | 49 | * @keepalive_interval: seconds after which a new keepalive should be sent | |
| 63 | 50 | * @keepalive_xmit_exp: future timestamp when next keepalive should be sent | |
| @@ -68,7 +55,7 @@ struct ovpn_route_key { | |||
| 68 | 55 | * @vpn_stats: per-peer in-VPN TX/RX stats | |
| 69 | 56 | * @link_stats: per-peer link/transport TX/RX stats | |
| 70 | 57 | * @delete_reason: why peer was deleted (i.e. timeout, transport error, ..) | |
| 71 | - | * @lock: protects binding to peer (bind), route_key and keepalive* fields | |
| 58 | + | * @lock: protects binding to peer (bind) and keepalive* fields | |
| 72 | 59 | * @refcount: reference counter | |
| 73 | 60 | * @rcu: used to free peer in an RCU safe way | |
| 74 | 61 | * @release_entry: entry for the socket release list | |
| @@ -112,8 +99,6 @@ struct ovpn_peer { | |||
| 112 | 99 | } tcp; | |
| 113 | 100 | struct ovpn_crypto_state crypto; | |
| 114 | 101 | struct dst_cache dst_cache; | |
| 115 | - | struct ovpn_route_key route_key; | |
| 116 | - | seqcount_spinlock_t route_key_seq; | |
| 117 | 102 | struct ovpn_bind __rcu *bind; | |
| 118 | 103 | unsigned long keepalive_interval; | |
| 119 | 104 | unsigned long keepalive_xmit_exp; | |
| @@ -124,7 +109,7 @@ struct ovpn_peer { | |||
| 124 | 109 | struct ovpn_peer_stats vpn_stats; | |
| 125 | 110 | struct ovpn_peer_stats link_stats; | |
| 126 | 111 | enum ovpn_del_peer_reason delete_reason; | |
| 127 | - | spinlock_t lock; /* protects bind, route_key and keepalive* */ | |
| 112 | + | spinlock_t lock; /* protects bind and keepalive* */ | |
| 128 | 113 | struct kref refcount; | |
| 129 | 114 | struct rcu_head rcu; | |
| 130 | 115 | struct llist_node release_entry; | |
| @@ -164,12 +149,6 @@ struct ovpn_peer *ovpn_peer_get_by_transp_addr(struct ovpn_priv *ovpn, | |||
| 164 | 149 | struct ovpn_peer *ovpn_peer_get_by_id(struct ovpn_priv *ovpn, u32 peer_id); | |
| 165 | 150 | struct ovpn_peer *ovpn_peer_get_by_dst(struct ovpn_priv *ovpn, | |
| 166 | 151 | struct sk_buff *skb); | |
| 167 | - | bool ovpn_peer_vpn_addr_conflict4(struct ovpn_priv *ovpn, | |
| 168 | - | const struct ovpn_peer *peer, | |
| 169 | - | const struct in_addr *addr); | |
| 170 | - | bool ovpn_peer_vpn_addr_conflict6(struct ovpn_priv *ovpn, | |
| 171 | - | const struct ovpn_peer *peer, | |
| 172 | - | const struct in6_addr *addr); | |
| 173 | 152 | void ovpn_peer_hash_vpn_ip(struct ovpn_peer *peer); | |
| 174 | 153 | void ovpn_peer_hash_transp_addr(struct ovpn_peer *peer); | |
| 175 | 154 | bool ovpn_peer_check_by_src(struct ovpn_priv *ovpn, struct sk_buff *skb, | |
modified drivers/net/ovpn/udp.c
| @@ -131,77 +131,6 @@ drop_noovpn: | |||
| 131 | 131 | return 0; | |
| 132 | 132 | } | |
| 133 | 133 | ||
| 134 | - | static bool ovpn_route_key_equal(const struct ovpn_route_key *a, | |
| 135 | - | const struct ovpn_route_key *b) | |
| 136 | - | { | |
| 137 | - | return a->mark == b->mark && a->sport == b->sport; | |
| 138 | - | } | |
| 139 | - | ||
| 140 | - | /** | |
| 141 | - | * ovpn_dst_cache_check_key - reset peer dst cache after key changes | |
| 142 | - | * @peer: the peer owning the dst cache | |
| 143 | - | * @cache: the cache that might need to be reset | |
| 144 | - | * @key: the route key for the packet being transmitted | |
| 145 | - | * | |
| 146 | - | * Reset the peer dst cache if it was populated for a different route key. | |
| 147 | - | */ | |
| 148 | - | static void ovpn_dst_cache_check_key(struct ovpn_peer *peer, | |
| 149 | - | struct dst_cache *cache, | |
| 150 | - | const struct ovpn_route_key *key) | |
| 151 | - | { | |
| 152 | - | struct ovpn_route_key old_key; | |
| 153 | - | unsigned int seq; | |
| 154 | - | ||
| 155 | - | /* snapshot the saved key before deciding whether the cache matches */ | |
| 156 | - | do { | |
| 157 | - | seq = read_seqcount_begin(&peer->route_key_seq); | |
| 158 | - | old_key = peer->route_key; | |
| 159 | - | } while (read_seqcount_retry(&peer->route_key_seq, seq)); | |
| 160 | - | ||
| 161 | - | /* nothing changed: the current cache can be reused */ | |
| 162 | - | if (likely(ovpn_route_key_equal(&old_key, key))) | |
| 163 | - | return; | |
| 164 | - | ||
| 165 | - | /* recheck under lock because another path may have updated the key */ | |
| 166 | - | spin_lock_bh(&peer->lock); | |
| 167 | - | if (!ovpn_route_key_equal(&peer->route_key, key)) { | |
| 168 | - | write_seqcount_begin(&peer->route_key_seq); | |
| 169 | - | peer->route_key = *key; | |
| 170 | - | dst_cache_reset(cache); | |
| 171 | - | write_seqcount_end(&peer->route_key_seq); | |
| 172 | - | } | |
| 173 | - | spin_unlock_bh(&peer->lock); | |
| 174 | - | } | |
| 175 | - | ||
| 176 | - | /** | |
| 177 | - | * ovpn_dst_cache_current - check whether a route lookup matches peer state | |
| 178 | - | * @peer: the peer owning the bind and dst cache | |
| 179 | - | * @bind: the RCU bind used for the route lookup | |
| 180 | - | * @key: the route key used for the route lookup | |
| 181 | - | * | |
| 182 | - | * Check that @bind is still the current peer bind and that @key still matches | |
| 183 | - | * the peer route key. The caller must hold @peer->lock. The TX path keeps | |
| 184 | - | * @bind inside an RCU read-side critical section, so pointer identity is enough | |
| 185 | - | * to detect whether the bind was replaced while the route lookup was running. | |
| 186 | - | * | |
| 187 | - | * Return: true if the lookup result still matches the current peer state and | |
| 188 | - | * may update the dst cache or replace the bind. | |
| 189 | - | */ | |
| 190 | - | static bool ovpn_dst_cache_current(const struct ovpn_peer *peer, | |
| 191 | - | const struct ovpn_bind *bind, | |
| 192 | - | const struct ovpn_route_key *key) | |
| 193 | - | { | |
| 194 | - | const struct ovpn_bind *curr_bind; | |
| 195 | - | ||
| 196 | - | lockdep_assert_held(&peer->lock); | |
| 197 | - | ||
| 198 | - | curr_bind = rcu_dereference_protected(peer->bind, | |
| 199 | - | lockdep_is_held(&peer->lock)); | |
| 200 | - | ||
| 201 | - | return curr_bind == bind && | |
| 202 | - | ovpn_route_key_equal(key, &peer->route_key); | |
| 203 | - | } | |
| 204 | - | ||
| 205 | 134 | /** | |
| 206 | 135 | * ovpn_udp4_output - send IPv4 packet over udp socket | |
| 207 | 136 | * @peer: the destination peer | |
| @@ -209,26 +138,21 @@ static bool ovpn_dst_cache_current(const struct ovpn_peer *peer, | |||
| 209 | 138 | * @cache: dst cache | |
| 210 | 139 | * @sk: the socket to send the packet over | |
| 211 | 140 | * @skb: the packet to send | |
| 212 | - | * @key: the route key snapshot used for cache validation and flow lookup | |
| 213 | 141 | * | |
| 214 | 142 | * Return: 0 on success or a negative error code otherwise | |
| 215 | 143 | */ | |
| 216 | 144 | static int ovpn_udp4_output(struct ovpn_peer *peer, struct ovpn_bind *bind, | |
| 217 | 145 | struct dst_cache *cache, struct sock *sk, | |
| 218 | - | struct sk_buff *skb, | |
| 219 | - | const struct ovpn_route_key *key) | |
| 146 | + | struct sk_buff *skb) | |
| 220 | 147 | { | |
| 221 | - | struct sockaddr_storage remote; | |
| 222 | - | struct in_addr local = {}; | |
| 223 | - | bool reset_local = false; | |
| 224 | 148 | struct rtable *rt; | |
| 225 | 149 | struct flowi4 fl = { | |
| 226 | 150 | .saddr = bind->local.ipv4.s_addr, | |
| 227 | 151 | .daddr = bind->remote.in4.sin_addr.s_addr, | |
| 228 | - | .fl4_sport = key->sport, | |
| 152 | + | .fl4_sport = inet_sk(sk)->inet_sport, | |
| 229 | 153 | .fl4_dport = bind->remote.in4.sin_port, | |
| 230 | 154 | .flowi4_proto = sk->sk_protocol, | |
| 231 | - | .flowi4_mark = key->mark, | |
| 155 | + | .flowi4_mark = sk->sk_mark, | |
| 232 | 156 | }; | |
| 233 | 157 | int ret; | |
| 234 | 158 | ||
| @@ -237,19 +161,26 @@ static int ovpn_udp4_output(struct ovpn_peer *peer, struct ovpn_bind *bind, | |||
| 237 | 161 | if (rt) | |
| 238 | 162 | goto transmit; | |
| 239 | 163 | ||
| 240 | - | if (fl.saddr && unlikely(!inet_confirm_addr(sock_net(sk), NULL, 0, | |
| 241 | - | fl.saddr, RT_SCOPE_HOST))) { | |
| 242 | - | /* The learned local address is not usable anymore. | |
| 243 | - | * Retry with source address autoselection. | |
| 164 | + | if (unlikely(!inet_confirm_addr(sock_net(sk), NULL, 0, fl.saddr, | |
| 165 | + | RT_SCOPE_HOST))) { | |
| 166 | + | /* we may end up here when the cached address is not usable | |
| 167 | + | * anymore. In this case we reset address/cache and perform a | |
| 168 | + | * new look up | |
| 244 | 169 | */ | |
| 245 | 170 | fl.saddr = 0; | |
| 246 | - | reset_local = true; | |
| 171 | + | spin_lock_bh(&peer->lock); | |
| 172 | + | bind->local.ipv4.s_addr = 0; | |
| 173 | + | spin_unlock_bh(&peer->lock); | |
| 174 | + | dst_cache_reset(cache); | |
| 247 | 175 | } | |
| 248 | 176 | ||
| 249 | 177 | rt = ip_route_output_flow(sock_net(sk), &fl, sk); | |
| 250 | 178 | if (IS_ERR(rt) && PTR_ERR(rt) == -EINVAL) { | |
| 251 | 179 | fl.saddr = 0; | |
| 252 | - | reset_local = true; | |
| 180 | + | spin_lock_bh(&peer->lock); | |
| 181 | + | bind->local.ipv4.s_addr = 0; | |
| 182 | + | spin_unlock_bh(&peer->lock); | |
| 183 | + | dst_cache_reset(cache); | |
| 253 | 184 | ||
| 254 | 185 | rt = ip_route_output_flow(sock_net(sk), &fl, sk); | |
| 255 | 186 | } | |
| @@ -262,30 +193,7 @@ static int ovpn_udp4_output(struct ovpn_peer *peer, struct ovpn_bind *bind, | |||
| 262 | 193 | ret); | |
| 263 | 194 | goto err; | |
| 264 | 195 | } | |
| 265 | - | ||
| 266 | - | /* avoid storing a stale cache or local address */ | |
| 267 | - | spin_lock_bh(&peer->lock); | |
| 268 | - | if (likely(ovpn_dst_cache_current(peer, bind, key))) { | |
| 269 | - | if (!reset_local) { | |
| 270 | - | dst_cache_set_ip4(cache, &rt->dst, fl.saddr); | |
| 271 | - | spin_unlock_bh(&peer->lock); | |
| 272 | - | goto transmit; | |
| 273 | - | } | |
| 274 | - | ||
| 275 | - | /* invalidate per-CPU dst entries that may still carry | |
| 276 | - | * the stale source | |
| 277 | - | */ | |
| 278 | - | dst_cache_reset(cache); | |
| 279 | - | ||
| 280 | - | /* preserve the current remote */ | |
| 281 | - | memcpy(&remote, &bind->remote, sizeof(struct sockaddr_in)); | |
| 282 | - | /* The current packet already has a valid wildcard-source route. | |
| 283 | - | * If replacing the bind fails, leave the stale local in place; | |
| 284 | - | * a later cache miss will retry the repair. | |
| 285 | - | */ | |
| 286 | - | ovpn_peer_reset_sockaddr(peer, &remote, &local); | |
| 287 | - | } | |
| 288 | - | spin_unlock_bh(&peer->lock); | |
| 196 | + | dst_cache_set_ip4(cache, &rt->dst, fl.saddr); | |
| 289 | 197 | ||
| 290 | 198 | transmit: | |
| 291 | 199 | udp_tunnel_xmit_skb(rt, sk, skb, fl.saddr, fl.daddr, 0, | |
| @@ -305,28 +213,23 @@ err: | |||
| 305 | 213 | * @cache: dst cache | |
| 306 | 214 | * @sk: the socket to send the packet over | |
| 307 | 215 | * @skb: the packet to send | |
| 308 | - | * @key: the route key snapshot used for cache validation and flow lookup | |
| 309 | 216 | * | |
| 310 | 217 | * Return: 0 on success or a negative error code otherwise | |
| 311 | 218 | */ | |
| 312 | 219 | static int ovpn_udp6_output(struct ovpn_peer *peer, struct ovpn_bind *bind, | |
| 313 | 220 | struct dst_cache *cache, struct sock *sk, | |
| 314 | - | struct sk_buff *skb, | |
| 315 | - | const struct ovpn_route_key *key) | |
| 221 | + | struct sk_buff *skb) | |
| 316 | 222 | { | |
| 317 | - | struct in6_addr local = in6addr_any; | |
| 318 | - | struct sockaddr_storage remote; | |
| 319 | - | bool reset_local = false; | |
| 320 | 223 | struct dst_entry *dst; | |
| 321 | 224 | int ret; | |
| 322 | 225 | ||
| 323 | 226 | struct flowi6 fl = { | |
| 324 | 227 | .saddr = bind->local.ipv6, | |
| 325 | 228 | .daddr = bind->remote.in6.sin6_addr, | |
| 326 | - | .fl6_sport = key->sport, | |
| 229 | + | .fl6_sport = inet_sk(sk)->inet_sport, | |
| 327 | 230 | .fl6_dport = bind->remote.in6.sin6_port, | |
| 328 | 231 | .flowi6_proto = sk->sk_protocol, | |
| 329 | - | .flowi6_mark = key->mark, | |
| 232 | + | .flowi6_mark = sk->sk_mark, | |
| 330 | 233 | .flowi6_oif = bind->remote.in6.sin6_scope_id, | |
| 331 | 234 | }; | |
| 332 | 235 | ||
| @@ -335,13 +238,16 @@ static int ovpn_udp6_output(struct ovpn_peer *peer, struct ovpn_bind *bind, | |||
| 335 | 238 | if (dst) | |
| 336 | 239 | goto transmit; | |
| 337 | 240 | ||
| 338 | - | if (!ipv6_addr_any(&fl.saddr) && | |
| 339 | - | unlikely(!ipv6_chk_addr(sock_net(sk), &fl.saddr, NULL, 0))) { | |
| 340 | - | /* The learned local address is not usable anymore. | |
| 341 | - | * Retry with source address autoselection. | |
| 241 | + | if (unlikely(!ipv6_chk_addr(sock_net(sk), &fl.saddr, NULL, 0))) { | |
| 242 | + | /* we may end up here when the cached address is not usable | |
| 243 | + | * anymore. In this case we reset address/cache and perform a | |
| 244 | + | * new look up | |
| 342 | 245 | */ | |
| 343 | 246 | fl.saddr = in6addr_any; | |
| 344 | - | reset_local = true; | |
| 247 | + | spin_lock_bh(&peer->lock); | |
| 248 | + | bind->local.ipv6 = in6addr_any; | |
| 249 | + | spin_unlock_bh(&peer->lock); | |
| 250 | + | dst_cache_reset(cache); | |
| 345 | 251 | } | |
| 346 | 252 | ||
| 347 | 253 | dst = ip6_dst_lookup_flow(sock_net(sk), sk, &fl, NULL); | |
| @@ -352,30 +258,7 @@ static int ovpn_udp6_output(struct ovpn_peer *peer, struct ovpn_bind *bind, | |||
| 352 | 258 | &bind->remote.in6, ret); | |
| 353 | 259 | goto err; | |
| 354 | 260 | } | |
| 355 | - | ||
| 356 | - | /* avoid storing a stale cache or local address */ | |
| 357 | - | spin_lock_bh(&peer->lock); | |
| 358 | - | if (likely(ovpn_dst_cache_current(peer, bind, key))) { | |
| 359 | - | if (!reset_local) { | |
| 360 | - | dst_cache_set_ip6(cache, dst, &fl.saddr); | |
| 361 | - | spin_unlock_bh(&peer->lock); | |
| 362 | - | goto transmit; | |
| 363 | - | } | |
| 364 | - | ||
| 365 | - | /* invalidate per-CPU dst entries that may still carry | |
| 366 | - | * the stale source | |
| 367 | - | */ | |
| 368 | - | dst_cache_reset(cache); | |
| 369 | - | ||
| 370 | - | /* preserve the current remote */ | |
| 371 | - | memcpy(&remote, &bind->remote, sizeof(struct sockaddr_in6)); | |
| 372 | - | /* The current packet already has a valid wildcard-source route. | |
| 373 | - | * If replacing the bind fails, leave the stale local in place; | |
| 374 | - | * a later cache miss will retry the repair. | |
| 375 | - | */ | |
| 376 | - | ovpn_peer_reset_sockaddr(peer, &remote, &local); | |
| 377 | - | } | |
| 378 | - | spin_unlock_bh(&peer->lock); | |
| 261 | + | dst_cache_set_ip6(cache, dst, &fl.saddr); | |
| 379 | 262 | ||
| 380 | 263 | transmit: | |
| 381 | 264 | /* user IPv6 packets may be larger than the transport interface | |
| @@ -404,7 +287,6 @@ err: | |||
| 404 | 287 | * @cache: dst cache | |
| 405 | 288 | * @sk: the socket to send the packet over | |
| 406 | 289 | * @skb: the packet to send | |
| 407 | - | * @key: route key snapshot used for cache validation and flow lookup | |
| 408 | 290 | * | |
| 409 | 291 | * rcu_read_lock should be held on entry. | |
| 410 | 292 | * On return, the skb is consumed. | |
| @@ -412,8 +294,7 @@ err: | |||
| 412 | 294 | * Return: 0 on success or a negative error code otherwise | |
| 413 | 295 | */ | |
| 414 | 296 | static int ovpn_udp_output(struct ovpn_peer *peer, struct dst_cache *cache, | |
| 415 | - | struct sock *sk, struct sk_buff *skb, | |
| 416 | - | struct ovpn_route_key *key) | |
| 297 | + | struct sock *sk, struct sk_buff *skb) | |
| 417 | 298 | { | |
| 418 | 299 | struct ovpn_bind *bind; | |
| 419 | 300 | int ret; | |
| @@ -433,11 +314,11 @@ static int ovpn_udp_output(struct ovpn_peer *peer, struct dst_cache *cache, | |||
| 433 | 314 | ||
| 434 | 315 | switch (bind->remote.in4.sin_family) { | |
| 435 | 316 | case AF_INET: | |
| 436 | - | ret = ovpn_udp4_output(peer, bind, cache, sk, skb, key); | |
| 317 | + | ret = ovpn_udp4_output(peer, bind, cache, sk, skb); | |
| 437 | 318 | break; | |
| 438 | 319 | #if IS_ENABLED(CONFIG_IPV6) | |
| 439 | 320 | case AF_INET6: | |
| 440 | - | ret = ovpn_udp6_output(peer, bind, cache, sk, skb, key); | |
| 321 | + | ret = ovpn_udp6_output(peer, bind, cache, sk, skb); | |
| 441 | 322 | break; | |
| 442 | 323 | #endif | |
| 443 | 324 | default: | |
| @@ -459,21 +340,15 @@ out: | |||
| 459 | 340 | void ovpn_udp_send_skb(struct ovpn_peer *peer, struct sock *sk, | |
| 460 | 341 | struct sk_buff *skb) | |
| 461 | 342 | { | |
| 462 | - | struct ovpn_route_key key = { | |
| 463 | - | .mark = READ_ONCE(sk->sk_mark), | |
| 464 | - | .sport = READ_ONCE(inet_sk(sk)->inet_sport), | |
| 465 | - | }; | |
| 466 | 343 | int ret; | |
| 467 | 344 | ||
| 468 | 345 | skb->dev = peer->ovpn->dev; | |
| 469 | - | skb->mark = key.mark; | |
| 346 | + | skb->mark = READ_ONCE(sk->sk_mark); | |
| 470 | 347 | /* no checksum performed at this layer */ | |
| 471 | 348 | skb->ip_summed = CHECKSUM_NONE; | |
| 472 | 349 | ||
| 473 | - | ovpn_dst_cache_check_key(peer, &peer->dst_cache, &key); | |
| 474 | - | ||
| 475 | 350 | /* crypto layer -> transport (UDP) */ | |
| 476 | - | ret = ovpn_udp_output(peer, &peer->dst_cache, sk, skb, &key); | |
| 351 | + | ret = ovpn_udp_output(peer, &peer->dst_cache, sk, skb); | |
| 477 | 352 | if (unlikely(ret < 0)) | |
| 478 | 353 | kfree_skb(skb); | |
| 479 | 354 | } | |
modified drivers/net/pcs/pcs-rzn1-miic.c
| @@ -683,8 +683,7 @@ static int miic_parse_dt(struct miic *miic, u32 *mode_cfg) | |||
| 683 | 683 | if (!dt_val) | |
| 684 | 684 | return -ENOMEM; | |
| 685 | 685 | ||
| 686 | - | memset(dt_val, MIIC_MODCTRL_CONF_NONE, | |
| 687 | - | sizeof(*dt_val) * miic->of_data->conf_conv_count); | |
| 686 | + | memset(dt_val, MIIC_MODCTRL_CONF_NONE, sizeof(*dt_val)); | |
| 688 | 687 | ||
| 689 | 688 | if (of_property_read_u32(np, "renesas,miic-switch-portin", &conf) == 0) | |
| 690 | 689 | dt_val[0] = conf; | |
modified drivers/net/pcs/pcs-xpcs.c
| @@ -1545,10 +1545,8 @@ static int xpcs_init_clks(struct dw_xpcs *xpcs) | |||
| 1545 | 1545 | return dev_err_probe(dev, ret, "Failed to get clocks\n"); | |
| 1546 | 1546 | ||
| 1547 | 1547 | ret = clk_bulk_prepare_enable(DW_XPCS_NUM_CLKS, xpcs->clks); | |
| 1548 | - | if (ret) { | |
| 1549 | - | clk_bulk_put(DW_XPCS_NUM_CLKS, xpcs->clks); | |
| 1548 | + | if (ret) | |
| 1550 | 1549 | return dev_err_probe(dev, ret, "Failed to enable clocks\n"); | |
| 1551 | - | } | |
| 1552 | 1550 | ||
| 1553 | 1551 | return 0; | |
| 1554 | 1552 | } | |
modified drivers/net/phy/intel-xway.c
| @@ -16,11 +16,6 @@ | |||
| 16 | 16 | #define XWAY_MDIO_ISTAT 0x1A /* interrupt status */ | |
| 17 | 17 | #define XWAY_MDIO_LED 0x1B /* led control */ | |
| 18 | 18 | ||
| 19 | - | #define XWAY_MDIO_GCTRL_TM_MASK GENMASK(15, 13) | |
| 20 | - | #define XWAY_MDIO_GCTRL_TM(mode) FIELD_PREP(XWAY_MDIO_GCTRL_TM_MASK, (mode)) | |
| 21 | - | #define XWAY_MDIO_GCTRL_TM_NOP XWAY_MDIO_GCTRL_TM(0) /* Normal operation */ | |
| 22 | - | #define XWAY_MDIO_GCTRL_TM_CDIAG XWAY_MDIO_GCTRL_TM(6) /* Cable diagnostics */ | |
| 23 | - | ||
| 24 | 19 | #define XWAY_MDIO_ERRCNT_SEL GENMASK(11, 8) | |
| 25 | 20 | #define XWAY_MDIO_ERRCNT_COUNT GENMASK(7, 0) | |
| 26 | 21 | #define XWAY_MDIO_ERRCNT_SEL_RXERR 0 | |
| @@ -331,28 +326,6 @@ static int xway_gphy_probe(struct phy_device *phydev) | |||
| 331 | 326 | return 0; | |
| 332 | 327 | } | |
| 333 | 328 | ||
| 334 | - | static int xway_11g_int_config_init(struct phy_device *phydev) | |
| 335 | - | { | |
| 336 | - | int err; | |
| 337 | - | ||
| 338 | - | /* An issue has been sporadically observed after device power-on on the | |
| 339 | - | * first link-up attempt in 100BASE-TX mode resulting in either the | |
| 340 | - | * link-up taking a long time, or failing to link-up altogether. | |
| 341 | - | * | |
| 342 | - | * Workaround: | |
| 343 | - | * After power-on, enable Cable Diagnostic Mode for all ports and | |
| 344 | - | * disable it. | |
| 345 | - | */ | |
| 346 | - | err = phy_modify(phydev, MII_CTRL1000, XWAY_MDIO_GCTRL_TM_MASK, XWAY_MDIO_GCTRL_TM_CDIAG); | |
| 347 | - | if (err) | |
| 348 | - | return err; | |
| 349 | - | err = phy_modify(phydev, MII_CTRL1000, XWAY_MDIO_GCTRL_TM_MASK, XWAY_MDIO_GCTRL_TM_NOP); | |
| 350 | - | if (err) | |
| 351 | - | return err; | |
| 352 | - | ||
| 353 | - | return xway_gphy_config_init(phydev); | |
| 354 | - | } | |
| 355 | - | ||
| 356 | 329 | static int xway_gphy14_config_aneg(struct phy_device *phydev) | |
| 357 | 330 | { | |
| 358 | 331 | int reg, err; | |
| @@ -762,7 +735,7 @@ static struct phy_driver xway_gphy[] = { | |||
| 762 | 735 | .phy_id_mask = 0xffffffff, | |
| 763 | 736 | .name = "Intel XWAY PHY11G (xRX v1.2 integrated)", | |
| 764 | 737 | /* PHY_GBIT_FEATURES */ | |
| 765 | - | .config_init = xway_11g_int_config_init, | |
| 738 | + | .config_init = xway_gphy_config_init, | |
| 766 | 739 | .probe = xway_gphy_probe, | |
| 767 | 740 | .handle_interrupt = xway_gphy_handle_interrupt, | |
| 768 | 741 | .config_intr = xway_gphy_config_intr, | |
modified drivers/net/phy/mediatek/mtk-phy-lib.c
| @@ -156,27 +156,20 @@ int mtk_phy_led_hw_ctrl_get(struct phy_device *phydev, u8 index, | |||
| 156 | 156 | if (!rules) | |
| 157 | 157 | return 0; | |
| 158 | 158 | ||
| 159 | - | /* TRIGGER_NETDEV_LINK must not be reported together with any of the | |
| 160 | - | * per-speed rules, the netdev trigger rejects that combination. | |
| 161 | - | * on_set holds every speed this LED can indicate and is what | |
| 162 | - | * mtk_phy_led_hw_ctrl_set() programs for TRIGGER_NETDEV_LINK, so | |
| 163 | - | * report the speed independent rule only when they are all on. | |
| 164 | - | */ | |
| 165 | - | if ((on & on_set) == on_set) { | |
| 159 | + | if (on & on_set) | |
| 166 | 160 | *rules |= BIT(TRIGGER_NETDEV_LINK); | |
| 167 | - | } else { | |
| 168 | - | if (on & MTK_PHY_LED_ON_LINK10) | |
| 169 | - | *rules |= BIT(TRIGGER_NETDEV_LINK_10); | |
| 170 | 161 | ||
| 171 | - | if (on & MTK_PHY_LED_ON_LINK100) | |
| 172 | - | *rules |= BIT(TRIGGER_NETDEV_LINK_100); | |
| 162 | + | if (on & MTK_PHY_LED_ON_LINK10) | |
| 163 | + | *rules |= BIT(TRIGGER_NETDEV_LINK_10); | |
| 173 | 164 | ||
| 174 | - | if (on & MTK_PHY_LED_ON_LINK1000) | |
| 175 | - | *rules |= BIT(TRIGGER_NETDEV_LINK_1000); | |
| 165 | + | if (on & MTK_PHY_LED_ON_LINK100) | |
| 166 | + | *rules |= BIT(TRIGGER_NETDEV_LINK_100); | |
| 176 | 167 | ||
| 177 | - | if (on & MTK_PHY_LED_ON_LINK2500) | |
| 178 | - | *rules |= BIT(TRIGGER_NETDEV_LINK_2500); | |
| 179 | - | } | |
| 168 | + | if (on & MTK_PHY_LED_ON_LINK1000) | |
| 169 | + | *rules |= BIT(TRIGGER_NETDEV_LINK_1000); | |
| 170 | + | ||
| 171 | + | if (on & MTK_PHY_LED_ON_LINK2500) | |
| 172 | + | *rules |= BIT(TRIGGER_NETDEV_LINK_2500); | |
| 180 | 173 | ||
| 181 | 174 | if (on & MTK_PHY_LED_ON_FDX) | |
| 182 | 175 | *rules |= BIT(TRIGGER_NETDEV_FULL_DUPLEX); | |
modified drivers/net/phy/micrel.c
| @@ -6344,7 +6344,6 @@ static int lanphy_write_reg_data(struct phy_device *phydev, | |||
| 6344 | 6344 | data->val); | |
| 6345 | 6345 | if (ret) | |
| 6346 | 6346 | break; | |
| 6347 | - | data++; | |
| 6348 | 6347 | } | |
| 6349 | 6348 | ||
| 6350 | 6349 | return ret; | |
modified drivers/net/phy/phylink.c
| @@ -2129,6 +2129,7 @@ static int phylink_bringup_phy(struct phylink *pl, struct phy_device *phy, | |||
| 2129 | 2129 | mutex_lock(&pl->phydev_mutex); | |
| 2130 | 2130 | mutex_lock(&phy->lock); | |
| 2131 | 2131 | mutex_lock(&pl->state_mutex); | |
| 2132 | + | pl->phydev = phy; | |
| 2132 | 2133 | pl->phy_state.interface = interface; | |
| 2133 | 2134 | pl->phy_state.pause = MLO_PAUSE_NONE; | |
| 2134 | 2135 | pl->phy_state.speed = SPEED_UNKNOWN; | |
| @@ -2195,25 +2196,10 @@ static int phylink_bringup_phy(struct phylink *pl, struct phy_device *phy, | |||
| 2195 | 2196 | ret = 0; | |
| 2196 | 2197 | } | |
| 2197 | 2198 | ||
| 2198 | - | if (ret) | |
| 2199 | - | return ret; | |
| 2200 | - | ||
| 2201 | - | /* Nothing below can fail, so the PHY can be recorded now. Doing it | |
| 2202 | - | * here rather than above keeps a failed bringup from leaving | |
| 2203 | - | * pl->phydev pointing at a PHY the caller is about to detach. | |
| 2204 | - | */ | |
| 2205 | - | mutex_lock(&pl->phydev_mutex); | |
| 2206 | - | mutex_lock(&phy->lock); | |
| 2207 | - | mutex_lock(&pl->state_mutex); | |
| 2208 | - | pl->phydev = phy; | |
| 2209 | - | mutex_unlock(&pl->state_mutex); | |
| 2210 | - | mutex_unlock(&phy->lock); | |
| 2211 | - | mutex_unlock(&pl->phydev_mutex); | |
| 2212 | - | ||
| 2213 | - | if (phy_interrupt_is_valid(phy)) | |
| 2199 | + | if (ret == 0 && phy_interrupt_is_valid(phy)) | |
| 2214 | 2200 | phy_request_interrupt(phy); | |
| 2215 | 2201 | ||
| 2216 | - | return 0; | |
| 2202 | + | return ret; | |
| 2217 | 2203 | } | |
| 2218 | 2204 | ||
| 2219 | 2205 | static int phylink_attach_phy(struct phylink *pl, struct phy_device *phy, | |
modified drivers/net/usb/catc.c
| @@ -233,26 +233,17 @@ static void catc_rx_done(struct urb *urb) | |||
| 233 | 233 | } | |
| 234 | 234 | ||
| 235 | 235 | do { | |
| 236 | - | int remaining = urb->actual_length - | |
| 237 | - | (pkt_start - (u8 *)urb->transfer_buffer); | |
| 238 | - | ||
| 239 | - | if (!catc->is_f5u011) { | |
| 240 | - | if (remaining < pkt_offset) { | |
| 236 | + | if(!catc->is_f5u011) { | |
| 237 | + | pkt_len = le16_to_cpup((__le16*)pkt_start); | |
| 238 | + | if (pkt_len > urb->actual_length) { | |
| 241 | 239 | catc->netdev->stats.rx_length_errors++; | |
| 242 | 240 | catc->netdev->stats.rx_errors++; | |
| 243 | 241 | break; | |
| 244 | 242 | } | |
| 245 | - | pkt_len = le16_to_cpup((__le16 *)pkt_start); | |
| 246 | 243 | } else { | |
| 247 | 244 | pkt_len = urb->actual_length; | |
| 248 | 245 | } | |
| 249 | 246 | ||
| 250 | - | if (pkt_len < ETH_HLEN || pkt_len + pkt_offset > remaining) { | |
| 251 | - | catc->netdev->stats.rx_length_errors++; | |
| 252 | - | catc->netdev->stats.rx_errors++; | |
| 253 | - | break; | |
| 254 | - | } | |
| 255 | - | ||
| 256 | 247 | if (!(skb = dev_alloc_skb(pkt_len))) | |
| 257 | 248 | return; | |
| 258 | 249 | ||
modified drivers/net/usb/cdc_mbim.c
| @@ -635,11 +635,6 @@ static const struct usb_device_id mbim_devs[] = { | |||
| 635 | 635 | .driver_info = (unsigned long)&cdc_mbim_info, | |
| 636 | 636 | }, | |
| 637 | 637 | ||
| 638 | - | /* MeiG Smart SRM821 ZLP conformance */ | |
| 639 | - | { USB_DEVICE_AND_INTERFACE_INFO(0x2dee, 0x4d53, USB_CLASS_COMM, USB_CDC_SUBCLASS_MBIM, USB_CDC_PROTO_NONE), | |
| 640 | - | .driver_info = (unsigned long)&cdc_mbim_info, | |
| 641 | - | }, | |
| 642 | - | ||
| 643 | 638 | /* Some Huawei devices, ME906s-158 (12d1:15c1) and E3372 | |
| 644 | 639 | * (12d1:157d), are known to fail unless the NDP is placed | |
| 645 | 640 | * after the IP packets. Applying the quirk to all Huawei | |
modified drivers/net/usb/lan78xx.c
| @@ -5239,12 +5239,10 @@ static bool lan78xx_submit_deferred_urbs(struct lan78xx_net *dev) | |||
| 5239 | 5239 | !netif_carrier_ok(dev->net) || | |
| 5240 | 5240 | pipe_halted) { | |
| 5241 | 5241 | lan78xx_release_tx_buf(dev, skb); | |
| 5242 | - | usb_put_urb(urb); | |
| 5243 | 5242 | continue; | |
| 5244 | 5243 | } | |
| 5245 | 5244 | ||
| 5246 | 5245 | ret = usb_submit_urb(urb, GFP_ATOMIC); | |
| 5247 | - | usb_put_urb(urb); | |
| 5248 | 5246 | ||
| 5249 | 5247 | if (ret == 0) { | |
| 5250 | 5248 | netif_trans_update(dev->net); | |
modified drivers/net/usb/qmi_wwan.c
| @@ -1086,7 +1086,6 @@ static const struct usb_device_id products[] = { | |||
| 1086 | 1086 | {QMI_MATCH_FF_FF_FF(0x2c7c, 0x0125)}, /* Quectel EC25, EC20 R2.0 Mini PCIe */ | |
| 1087 | 1087 | {QMI_MATCH_FF_FF_FF(0x2c7c, 0x013d)}, /* Quectel RG660QB */ | |
| 1088 | 1088 | {QMI_MATCH_FF_FF_FF(0x2c7c, 0x0306)}, /* Quectel EP06/EG06/EM06 */ | |
| 1089 | - | {QMI_MATCH_FF_FF_FF(0x2c7c, 0x030b)}, /* Quectel EM060K/EG120K-EA */ | |
| 1090 | 1089 | {QMI_MATCH_FF_FF_FF(0x2c7c, 0x0512)}, /* Quectel EG12/EM12 */ | |
| 1091 | 1090 | {QMI_MATCH_FF_FF_FF(0x2c7c, 0x0620)}, /* Quectel EM160R-GL */ | |
| 1092 | 1091 | {QMI_MATCH_FF_FF_FF(0x2c7c, 0x0800)}, /* Quectel RM500Q-GL */ | |
modified drivers/net/usb/sr9700.c
| @@ -355,8 +355,7 @@ static int sr9700_rx_fixup(struct usbnet *dev, struct sk_buff *skb) | |||
| 355 | 355 | /* ignore the CRC length */ | |
| 356 | 356 | len = (skb->data[1] | (skb->data[2] << 8)) - 4; | |
| 357 | 357 | ||
| 358 | - | if (len > ETH_FRAME_LEN || len < 0 || | |
| 359 | - | len > skb->len - SR_RX_OVERHEAD) | |
| 358 | + | if (len > ETH_FRAME_LEN || len > skb->len || len < 0) | |
| 360 | 359 | return 0; | |
| 361 | 360 | ||
| 362 | 361 | /* the last packet of current skb */ | |
modified drivers/net/veth.c
| @@ -1054,7 +1054,6 @@ static int __veth_napi_enable_range(struct net_device *dev, int start, int end) | |||
| 1054 | 1054 | for (i = start; i < end; i++) { | |
| 1055 | 1055 | struct veth_rq *rq = &priv->rq[i]; | |
| 1056 | 1056 | ||
| 1057 | - | rcu_assign_pointer(rq->xdp_prog, priv->_xdp_prog); | |
| 1058 | 1057 | napi_enable(&rq->xdp_napi); | |
| 1059 | 1058 | rcu_assign_pointer(priv->rq[i].napi, &priv->rq[i].xdp_napi); | |
| 1060 | 1059 | } | |
| @@ -1089,7 +1088,6 @@ static void veth_napi_del_range(struct net_device *dev, int start, int end) | |||
| 1089 | 1088 | ||
| 1090 | 1089 | rcu_assign_pointer(priv->rq[i].napi, NULL); | |
| 1091 | 1090 | napi_disable(&rq->xdp_napi); | |
| 1092 | - | rcu_assign_pointer(rq->xdp_prog, NULL); | |
| 1093 | 1091 | __netif_napi_del(&rq->xdp_napi); | |
| 1094 | 1092 | } | |
| 1095 | 1093 | synchronize_net(); | |
modified drivers/net/virtio_net.c
| @@ -3349,14 +3349,6 @@ static netdev_tx_t start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 3349 | 3349 | else | |
| 3350 | 3350 | virtqueue_disable_cb(sq->vq); | |
| 3351 | 3351 | ||
| 3352 | - | if (!use_napi && | |
| 3353 | - | unlikely(skb_orphan_frags(skb, GFP_ATOMIC))) { | |
| 3354 | - | DEV_STATS_INC(dev, tx_dropped); | |
| 3355 | - | dev_kfree_skb_any(skb); | |
| 3356 | - | kick = !xmit_more || netif_xmit_stopped(txq); | |
| 3357 | - | goto kick_vq; | |
| 3358 | - | } | |
| 3359 | - | ||
| 3360 | 3352 | /* timestamp packet in software */ | |
| 3361 | 3353 | skb_tx_timestamp(skb); | |
| 3362 | 3354 | ||
| @@ -3389,7 +3381,6 @@ static netdev_tx_t start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
| 3389 | 3381 | ||
| 3390 | 3382 | kick = use_napi ? __netdev_tx_sent_queue(txq, skb->len, xmit_more) : | |
| 3391 | 3383 | !xmit_more || netif_xmit_stopped(txq); | |
| 3392 | - | kick_vq: | |
| 3393 | 3384 | if (kick) { | |
| 3394 | 3385 | if (virtqueue_kick_prepare(sq->vq) && virtqueue_notify(sq->vq)) { | |
| 3395 | 3386 | u64_stats_update_begin(&sq->stats.syncp); | |
modified drivers/net/vrf.c
| @@ -1175,6 +1175,8 @@ static int vrf_prepare_mac_header(struct sk_buff *skb, | |||
| 1175 | 1175 | skb->protocol = eth->h_proto; | |
| 1176 | 1176 | skb->pkt_type = PACKET_HOST; | |
| 1177 | 1177 | ||
| 1178 | + | skb_postpush_rcsum(skb, skb->data, ETH_HLEN); | |
| 1179 | + | ||
| 1178 | 1180 | skb_pull_inline(skb, ETH_HLEN); | |
| 1179 | 1181 | ||
| 1180 | 1182 | return 0; | |
modified drivers/net/vxlan/vxlan_core.c
| @@ -1958,15 +1958,13 @@ static struct sk_buff *vxlan_na_create(struct sk_buff *request, | |||
| 1958 | 1958 | struct ipv6hdr *pip6; | |
| 1959 | 1959 | u8 *daddr; | |
| 1960 | 1960 | int na_olen = 8; /* opt hdr + ETH_ALEN for target */ | |
| 1961 | - | int headroom; | |
| 1962 | 1961 | int ns_olen; | |
| 1963 | 1962 | int i, len; | |
| 1964 | 1963 | ||
| 1965 | 1964 | if (dev == NULL || !pskb_may_pull(request, request->len)) | |
| 1966 | 1965 | return NULL; | |
| 1967 | 1966 | ||
| 1968 | - | headroom = LL_RESERVED_SPACE(dev); | |
| 1969 | - | len = headroom + sizeof(struct ipv6hdr) + | |
| 1967 | + | len = LL_RESERVED_SPACE(dev) + sizeof(struct ipv6hdr) + | |
| 1970 | 1968 | sizeof(*na) + na_olen + dev->needed_tailroom; | |
| 1971 | 1969 | reply = alloc_skb(len, GFP_ATOMIC); | |
| 1972 | 1970 | if (reply == NULL) | |
| @@ -1974,7 +1972,7 @@ static struct sk_buff *vxlan_na_create(struct sk_buff *request, | |||
| 1974 | 1972 | ||
| 1975 | 1973 | reply->protocol = htons(ETH_P_IPV6); | |
| 1976 | 1974 | reply->dev = dev; | |
| 1977 | - | skb_reserve(reply, headroom); | |
| 1975 | + | skb_reserve(reply, LL_RESERVED_SPACE(request->dev)); | |
| 1978 | 1976 | skb_push(reply, sizeof(struct ethhdr)); | |
| 1979 | 1977 | skb_reset_mac_header(reply); | |
| 1980 | 1978 | ||
modified drivers/net/wireless/ath/ath11k/mac.c
| @@ -873,22 +873,6 @@ static int ath11k_mac_set_kickout(struct ath11k_vif *arvif) | |||
| 873 | 873 | return 0; | |
| 874 | 874 | } | |
| 875 | 875 | ||
| 876 | - | static void ath11k_mac_station_cleanup(struct ieee80211_sta *sta) | |
| 877 | - | { | |
| 878 | - | struct ath11k_sta *arsta; | |
| 879 | - | ||
| 880 | - | if (!sta) | |
| 881 | - | return; | |
| 882 | - | ||
| 883 | - | arsta = ath11k_sta_to_arsta(sta); | |
| 884 | - | ||
| 885 | - | kfree(arsta->tx_stats); | |
| 886 | - | arsta->tx_stats = NULL; | |
| 887 | - | ||
| 888 | - | kfree(arsta->rx_stats); | |
| 889 | - | arsta->rx_stats = NULL; | |
| 890 | - | } | |
| 891 | - | ||
| 892 | 876 | void ath11k_mac_peer_cleanup_all(struct ath11k *ar) | |
| 893 | 877 | { | |
| 894 | 878 | struct ath11k_peer *peer, *tmp; | |
| @@ -901,7 +885,6 @@ void ath11k_mac_peer_cleanup_all(struct ath11k *ar) | |||
| 901 | 885 | list_for_each_entry_safe(peer, tmp, &ab->peers, list) { | |
| 902 | 886 | ath11k_peer_rx_tid_cleanup(ar, peer); | |
| 903 | 887 | ath11k_peer_rhash_delete(ab, peer); | |
| 904 | - | ath11k_mac_station_cleanup(peer->sta); | |
| 905 | 888 | list_del(&peer->list); | |
| 906 | 889 | kfree(peer); | |
| 907 | 890 | } | |
| @@ -9909,6 +9892,7 @@ static int ath11k_mac_station_remove(struct ath11k *ar, | |||
| 9909 | 9892 | { | |
| 9910 | 9893 | struct ath11k_base *ab = ar->ab; | |
| 9911 | 9894 | struct ath11k_vif *arvif = ath11k_vif_to_arvif(vif); | |
| 9895 | + | struct ath11k_sta *arsta = ath11k_sta_to_arsta(sta); | |
| 9912 | 9896 | int ret; | |
| 9913 | 9897 | ||
| 9914 | 9898 | if (ab->hw_params.vdev_start_delay && | |
| @@ -9932,7 +9916,12 @@ static int ath11k_mac_station_remove(struct ath11k *ar, | |||
| 9932 | 9916 | sta->addr, arvif->vdev_id); | |
| 9933 | 9917 | ||
| 9934 | 9918 | ath11k_mac_dec_num_stations(arvif, sta); | |
| 9935 | - | ath11k_mac_station_cleanup(sta); | |
| 9919 | + | ||
| 9920 | + | kfree(arsta->tx_stats); | |
| 9921 | + | arsta->tx_stats = NULL; | |
| 9922 | + | ||
| 9923 | + | kfree(arsta->rx_stats); | |
| 9924 | + | arsta->rx_stats = NULL; | |
| 9936 | 9925 | ||
| 9937 | 9926 | return ret; | |
| 9938 | 9927 | } | |
modified drivers/net/wireless/ath/ath12k/wifi7/ahb.c
| @@ -15,6 +15,21 @@ | |||
| 15 | 15 | #include "dp.h" | |
| 16 | 16 | #include "core.h" | |
| 17 | 17 | ||
| 18 | + | /* | |
| 19 | + | * Node name to UserPD ID mapping | |
| 20 | + | * | |
| 21 | + | * The io_start field is used for additional validation when the reg | |
| 22 | + | * property is present in the device tree. If io_start is 0, only | |
| 23 | + | * node_name matching is performed. | |
| 24 | + | * | |
| 25 | + | * For platforms where not all WiFi nodes have a 'reg' property, set | |
| 26 | + | * io_start to 0 for those entries. The driver will match purely by | |
| 27 | + | * node name in such cases. | |
| 28 | + | */ | |
| 29 | + | static const struct ath12k_ahb_userpd_map ath12k_wifi7_ahb_userpd_map[] = { | |
| 30 | + | { .io_start = 0x0c000000, .node_name = "wifi", .upd_id = ATH12K_AHB_USERPD_ID_0 }, | |
| 31 | + | }; | |
| 32 | + | ||
| 18 | 33 | static const struct ath12k_ahb_desc ath12k_wifi7_ahb_desc[] = { | |
| 19 | 34 | [ATH12K_HW_IPQ5332_HW10] = { | |
| 20 | 35 | .hw_rev = ATH12K_HW_IPQ5332_HW10, | |
| @@ -40,6 +55,40 @@ static const struct of_device_id ath12k_wifi7_ahb_of_match[] = { | |||
| 40 | 55 | ||
| 41 | 56 | MODULE_DEVICE_TABLE(of, ath12k_wifi7_ahb_of_match); | |
| 42 | 57 | ||
| 58 | + | /* | |
| 59 | + | * ath12k_wifi7_ahb_get_userpd_id - Resolve UserPD ID from DT properties | |
| 60 | + | * @ab: ath12k base structure | |
| 61 | + | * | |
| 62 | + | * Returns: UserPD ID (1-based) on success, 0 on failure | |
| 63 | + | * | |
| 64 | + | * Resolution logic: | |
| 65 | + | * 1. If reg property exist in DT, get userpd_id from io_start | |
| 66 | + | * 2. If reg property is absent, get userpd_id from DT node name | |
| 67 | + | * 3. Return 0 if no match found (probe will fail) | |
| 68 | + | */ | |
| 69 | + | static u32 ath12k_wifi7_ahb_get_userpd_id(struct ath12k_base *ab) | |
| 70 | + | { | |
| 71 | + | const struct ath12k_ahb_userpd_map *map; | |
| 72 | + | struct resource *res; | |
| 73 | + | size_t i; | |
| 74 | + | ||
| 75 | + | res = platform_get_resource(ab->pdev, IORESOURCE_MEM, 0); | |
| 76 | + | ||
| 77 | + | for (i = 0; i < ARRAY_SIZE(ath12k_wifi7_ahb_userpd_map); i++) { | |
| 78 | + | map = &ath12k_wifi7_ahb_userpd_map[i]; | |
| 79 | + | ||
| 80 | + | if (res) { | |
| 81 | + | if (map->io_start && map->io_start == res->start) | |
| 82 | + | return map->upd_id; | |
| 83 | + | } else if (map->node_name && | |
| 84 | + | of_node_name_eq(ab->dev->of_node, map->node_name)) { | |
| 85 | + | return map->upd_id; | |
| 86 | + | } | |
| 87 | + | } | |
| 88 | + | ||
| 89 | + | return 0; | |
| 90 | + | } | |
| 91 | + | ||
| 43 | 92 | static int ath12k_wifi7_ahb_probe(struct platform_device *pdev) | |
| 44 | 93 | { | |
| 45 | 94 | const struct ath12k_ahb_desc *desc; | |
| @@ -57,7 +106,7 @@ static int ath12k_wifi7_ahb_probe(struct platform_device *pdev) | |||
| 57 | 106 | ab->hw_rev = desc->hw_rev; | |
| 58 | 107 | ab->hif.ops = desc->ops; | |
| 59 | 108 | ab_ahb->scm_auth_enabled = desc->auth_enabled; | |
| 60 | - | ab_ahb->userpd_id = ATH12K_AHB_USERPD_ID_0; | |
| 109 | + | ab_ahb->userpd_id = ath12k_wifi7_ahb_get_userpd_id(ab); | |
| 61 | 110 | if (!ab_ahb->userpd_id) | |
| 62 | 111 | return -EOPNOTSUPP; | |
| 63 | 112 | ||
modified drivers/net/wireless/ath/wcn36xx/dxe.c
| @@ -1055,7 +1055,7 @@ void wcn36xx_dxe_deinit(struct wcn36xx *wcn) | |||
| 1055 | 1055 | ||
| 1056 | 1056 | free_irq(wcn->tx_irq, wcn); | |
| 1057 | 1057 | free_irq(wcn->rx_irq, wcn); | |
| 1058 | - | timer_shutdown_sync(&wcn->tx_ack_timer); | |
| 1058 | + | timer_delete(&wcn->tx_ack_timer); | |
| 1059 | 1059 | ||
| 1060 | 1060 | if (wcn->tx_ack_skb) { | |
| 1061 | 1061 | ieee80211_tx_status_irqsafe(wcn->hw, wcn->tx_ack_skb); | |
modified drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c
| @@ -555,8 +555,6 @@ void brcmf_txfinalize(struct brcmf_if *ifp, struct sk_buff *txp, bool success) | |||
| 555 | 555 | ||
| 556 | 556 | if (type == ETH_P_PAE) { | |
| 557 | 557 | atomic_dec(&ifp->pend_8021x_cnt); | |
| 558 | - | /* Order the decrement before waitqueue_active() */ | |
| 559 | - | smp_mb__after_atomic(); | |
| 560 | 558 | if (waitqueue_active(&ifp->pend_8021x_wait)) | |
| 561 | 559 | wake_up(&ifp->pend_8021x_wait); | |
| 562 | 560 | } | |
modified drivers/net/wireless/broadcom/brcm80211/brcmfmac/cyw/core.c
| @@ -198,7 +198,7 @@ brcmf_cyw_external_auth(struct wiphy *wiphy, struct net_device *dev, | |||
| 198 | 198 | { | |
| 199 | 199 | struct brcmf_if *ifp; | |
| 200 | 200 | struct brcmf_pub *drvr; | |
| 201 | - | struct brcmf_auth_req_status_le auth_status = {}; | |
| 201 | + | struct brcmf_auth_req_status_le auth_status; | |
| 202 | 202 | int ret = 0; | |
| 203 | 203 | ||
| 204 | 204 | brcmf_dbg(TRACE, "Enter\n"); | |
| @@ -206,9 +206,6 @@ brcmf_cyw_external_auth(struct wiphy *wiphy, struct net_device *dev, | |||
| 206 | 206 | ifp = netdev_priv(dev); | |
| 207 | 207 | drvr = ifp->drvr; | |
| 208 | 208 | if (params->status == WLAN_STATUS_SUCCESS) { | |
| 209 | - | if (params->pmkid) | |
| 210 | - | memcpy(auth_status.pmkid, params->pmkid, | |
| 211 | - | WLAN_PMKID_LEN); | |
| 212 | 209 | auth_status.flags = cpu_to_le16(BRCMF_EXTAUTH_SUCCESS); | |
| 213 | 210 | } else { | |
| 214 | 211 | bphy_err(drvr, "External authentication failed: status=%d\n", | |
modified drivers/net/wireless/broadcom/brcm80211/brcmsmac/mac80211_if.c
| @@ -1571,10 +1571,6 @@ void brcms_free_timer(struct brcms_timer *t) | |||
| 1571 | 1571 | ||
| 1572 | 1572 | /* delete the timer in case it is active */ | |
| 1573 | 1573 | brcms_del_timer(t); | |
| 1574 | - | /* Ensure the callback has finished before freeing the timer | |
| 1575 | - | * structure, since brcms_del_timer() uses non-synchronous cancel. | |
| 1576 | - | */ | |
| 1577 | - | cancel_delayed_work_sync(&t->dly_wrk); | |
| 1578 | 1574 | ||
| 1579 | 1575 | if (wl->timers == t) { | |
| 1580 | 1576 | wl->timers = wl->timers->next; | |
modified drivers/net/wireless/intel/ipw2x00/ipw2100.c
| @@ -2712,9 +2712,7 @@ static void __ipw2100_rx_process(struct ipw2100_priv *priv) | |||
| 2712 | 2712 | break; | |
| 2713 | 2713 | } | |
| 2714 | 2714 | #endif | |
| 2715 | - | if (sq->drv[i].frame_size < | |
| 2716 | - | sizeof(struct libipw_hdr_3addr) || | |
| 2717 | - | sq->drv[i].frame_size > IPW_RX_NIC_BUFFER_LENGTH) | |
| 2715 | + | if (stats.len < sizeof(struct libipw_hdr_3addr)) | |
| 2718 | 2716 | break; | |
| 2719 | 2717 | switch (WLAN_FC_GET_TYPE(le16_to_cpu(u->rx_data.header.frame_ctl))) { | |
| 2720 | 2718 | case IEEE80211_FTYPE_MGMT: | |
modified drivers/net/wireless/intel/ipw2x00/ipw2200.c
| @@ -8322,15 +8322,6 @@ static void ipw_rx(struct ipw_priv *priv) | |||
| 8322 | 8322 | break; | |
| 8323 | 8323 | } | |
| 8324 | 8324 | ||
| 8325 | - | if (unlikely(le16_to_cpu(pkt->u.frame.length) > | |
| 8326 | - | IPW_RX_BUF_SIZE - | |
| 8327 | - | IPW_RX_FRAME_SIZE)) { | |
| 8328 | - | IPW_DEBUG_DROP("Received oversized packet. Dropping.\n"); | |
| 8329 | - | priv->net_dev->stats.rx_errors++; | |
| 8330 | - | priv->wstats.discard.misc++; | |
| 8331 | - | break; | |
| 8332 | - | } | |
| 8333 | - | ||
| 8334 | 8325 | switch (WLAN_FC_GET_TYPE | |
| 8335 | 8326 | (le16_to_cpu(header->frame_ctl))) { | |
| 8336 | 8327 | ||
modified drivers/net/wireless/intel/ipw2x00/libipw_crypto_tkip.c
| @@ -474,16 +474,14 @@ static int libipw_michael_mic_verify(struct sk_buff *skb, int keyidx, | |||
| 474 | 474 | int hdr_len, void *priv) | |
| 475 | 475 | { | |
| 476 | 476 | struct libipw_tkip_data *tkey = priv; | |
| 477 | - | u8 mic[MICHAEL_MIC_LEN]; | |
| 477 | + | u8 mic[8]; | |
| 478 | 478 | ||
| 479 | - | if (!tkey->key_set || skb->len < hdr_len + MICHAEL_MIC_LEN) | |
| 479 | + | if (!tkey->key_set) | |
| 480 | 480 | return -1; | |
| 481 | 481 | ||
| 482 | 482 | michael_mic(&tkey->key[24], (struct ieee80211_hdr *)skb->data, | |
| 483 | - | skb->data + hdr_len, | |
| 484 | - | skb->len - MICHAEL_MIC_LEN - hdr_len, mic); | |
| 485 | - | if (memcmp(mic, skb->data + skb->len - MICHAEL_MIC_LEN, | |
| 486 | - | MICHAEL_MIC_LEN) != 0) { | |
| 483 | + | skb->data + hdr_len, skb->len - 8 - hdr_len, mic); | |
| 484 | + | if (memcmp(mic, skb->data + skb->len - 8, 8) != 0) { | |
| 487 | 485 | struct ieee80211_hdr *hdr; | |
| 488 | 486 | hdr = (struct ieee80211_hdr *)skb->data; | |
| 489 | 487 | printk(KERN_DEBUG "%s: Michael MIC verification failed for " | |
| @@ -501,7 +499,7 @@ static int libipw_michael_mic_verify(struct sk_buff *skb, int keyidx, | |||
| 501 | 499 | tkey->rx_iv32 = tkey->rx_iv32_new; | |
| 502 | 500 | tkey->rx_iv16 = tkey->rx_iv16_new; | |
| 503 | 501 | ||
| 504 | - | skb_trim(skb, skb->len - MICHAEL_MIC_LEN); | |
| 502 | + | skb_trim(skb, skb->len - 8); | |
| 505 | 503 | ||
| 506 | 504 | return 0; | |
| 507 | 505 | } | |
modified drivers/net/wireless/intel/ipw2x00/libipw_rx.c
| @@ -1209,9 +1209,6 @@ static int libipw_handle_assoc_resp(struct libipw_device *ieee, struct libipw_as | |||
| 1209 | 1209 | struct libipw_network *network = &network_resp; | |
| 1210 | 1210 | struct net_device *dev = ieee->dev; | |
| 1211 | 1211 | ||
| 1212 | - | if (stats->len < sizeof(*frame)) | |
| 1213 | - | return 1; | |
| 1214 | - | ||
| 1215 | 1212 | network->flags = 0; | |
| 1216 | 1213 | network->qos_data.active = 0; | |
| 1217 | 1214 | network->qos_data.supported = 0; | |
| @@ -1424,9 +1421,6 @@ static void libipw_process_probe_response(struct libipw_device | |||
| 1424 | 1421 | #endif | |
| 1425 | 1422 | unsigned long flags; | |
| 1426 | 1423 | ||
| 1427 | - | if (stats->len < sizeof(*beacon)) | |
| 1428 | - | return; | |
| 1429 | - | ||
| 1430 | 1424 | LIBIPW_DEBUG_SCAN("'%*pE' (%pM): %c%c%c%c %c%c%c%c-%c%c%c%c %c%c%c%c\n", | |
| 1431 | 1425 | info_element->len, info_element->data, | |
| 1432 | 1426 | beacon->header.addr3, | |
modified drivers/net/wireless/intel/iwlegacy/common.c
| @@ -2326,7 +2326,7 @@ il_dealloc_bcast_stations(struct il_priv *il) | |||
| 2326 | 2326 | if (!(il->stations[i].used & IL_STA_BCAST)) | |
| 2327 | 2327 | continue; | |
| 2328 | 2328 | ||
| 2329 | - | il->stations[i].used = 0; | |
| 2329 | + | il->stations[i].used &= ~IL_STA_UCODE_ACTIVE; | |
| 2330 | 2330 | il->num_stations--; | |
| 2331 | 2331 | if (WARN_ON(il->num_stations < 0)) | |
| 2332 | 2332 | il->num_stations = 0; | |
modified drivers/net/wireless/intersil/p54/eeprom.c
| @@ -414,22 +414,17 @@ free: | |||
| 414 | 414 | } | |
| 415 | 415 | ||
| 416 | 416 | static int p54_convert_rev0(struct ieee80211_hw *dev, | |
| 417 | - | struct pda_pa_curve_data *curve_data, size_t len) | |
| 417 | + | struct pda_pa_curve_data *curve_data) | |
| 418 | 418 | { | |
| 419 | 419 | struct p54_common *priv = dev->priv; | |
| 420 | 420 | struct p54_pa_curve_data_sample *dst; | |
| 421 | 421 | struct pda_pa_curve_data_sample_rev0 *src; | |
| 422 | - | size_t needed = curve_data->channels * | |
| 423 | - | (sizeof(*src) * curve_data->points_per_channel + 2); | |
| 424 | 422 | size_t cd_len = sizeof(*curve_data) + | |
| 425 | 423 | (curve_data->points_per_channel*sizeof(*dst) + 2) * | |
| 426 | 424 | curve_data->channels; | |
| 427 | 425 | unsigned int i, j; | |
| 428 | 426 | void *source, *target; | |
| 429 | 427 | ||
| 430 | - | if (len < sizeof(*curve_data) + needed) | |
| 431 | - | return -EINVAL; | |
| 432 | - | ||
| 433 | 428 | priv->curve_data = kmalloc(sizeof(*priv->curve_data) + cd_len, | |
| 434 | 429 | GFP_KERNEL); | |
| 435 | 430 | if (!priv->curve_data) | |
| @@ -471,22 +466,17 @@ static int p54_convert_rev0(struct ieee80211_hw *dev, | |||
| 471 | 466 | } | |
| 472 | 467 | ||
| 473 | 468 | static int p54_convert_rev1(struct ieee80211_hw *dev, | |
| 474 | - | struct pda_pa_curve_data *curve_data, size_t len) | |
| 469 | + | struct pda_pa_curve_data *curve_data) | |
| 475 | 470 | { | |
| 476 | 471 | struct p54_common *priv = dev->priv; | |
| 477 | 472 | struct p54_pa_curve_data_sample *dst; | |
| 478 | 473 | struct pda_pa_curve_data_sample_rev1 *src; | |
| 479 | - | size_t needed = curve_data->channels * | |
| 480 | - | (sizeof(*src) * curve_data->points_per_channel + 3); | |
| 481 | 474 | size_t cd_len = sizeof(*curve_data) + | |
| 482 | 475 | (curve_data->points_per_channel*sizeof(*dst) + 2) * | |
| 483 | 476 | curve_data->channels; | |
| 484 | 477 | unsigned int i, j; | |
| 485 | 478 | void *source, *target; | |
| 486 | 479 | ||
| 487 | - | if (len < sizeof(*curve_data) + needed) | |
| 488 | - | return -EINVAL; | |
| 489 | - | ||
| 490 | 480 | priv->curve_data = kzalloc(cd_len + sizeof(*priv->curve_data), | |
| 491 | 481 | GFP_KERNEL); | |
| 492 | 482 | if (!priv->curve_data) | |
| @@ -773,7 +763,6 @@ int p54_parse_eeprom(struct ieee80211_hw *dev, void *eeprom, int len) | |||
| 773 | 763 | case PDR_PRISM_PA_CAL_CURVE_DATA: { | |
| 774 | 764 | struct pda_pa_curve_data *curve_data = | |
| 775 | 765 | (struct pda_pa_curve_data *)entry->data; | |
| 776 | - | ||
| 777 | 766 | if (data_len < sizeof(*curve_data)) { | |
| 778 | 767 | err = -EINVAL; | |
| 779 | 768 | goto err; | |
| @@ -781,10 +770,10 @@ int p54_parse_eeprom(struct ieee80211_hw *dev, void *eeprom, int len) | |||
| 781 | 770 | ||
| 782 | 771 | switch (curve_data->cal_method_rev) { | |
| 783 | 772 | case 0: | |
| 784 | - | err = p54_convert_rev0(dev, curve_data, data_len); | |
| 773 | + | err = p54_convert_rev0(dev, curve_data); | |
| 785 | 774 | break; | |
| 786 | 775 | case 1: | |
| 787 | - | err = p54_convert_rev1(dev, curve_data, data_len); | |
| 776 | + | err = p54_convert_rev1(dev, curve_data); | |
| 788 | 777 | break; | |
| 789 | 778 | default: | |
| 790 | 779 | wiphy_err(dev->wiphy, | |
| @@ -812,8 +801,7 @@ int p54_parse_eeprom(struct ieee80211_hw *dev, void *eeprom, int len) | |||
| 812 | 801 | break; | |
| 813 | 802 | case PDR_INTERFACE_LIST: | |
| 814 | 803 | tmp = entry->data; | |
| 815 | - | while ((u8 *)tmp + sizeof(struct exp_if) <= | |
| 816 | - | entry->data + data_len) { | |
| 804 | + | while ((u8 *)tmp < entry->data + data_len) { | |
| 817 | 805 | struct exp_if *exp_if = tmp; | |
| 818 | 806 | if (exp_if->if_id == cpu_to_le16(IF_ID_ISL39000)) | |
| 819 | 807 | synth = le16_to_cpu(exp_if->variant); | |
modified drivers/net/wireless/marvell/libertas_tf/main.c
| @@ -173,8 +173,8 @@ static int lbtf_init_adapter(struct lbtf_private *priv) | |||
| 173 | 173 | static void lbtf_free_adapter(struct lbtf_private *priv) | |
| 174 | 174 | { | |
| 175 | 175 | lbtf_deb_enter(LBTF_DEB_MAIN); | |
| 176 | - | timer_delete_sync(&priv->command_timer); | |
| 177 | 176 | lbtf_free_cmd_buffer(priv); | |
| 177 | + | timer_delete_sync(&priv->command_timer); | |
| 178 | 178 | lbtf_deb_leave(LBTF_DEB_MAIN); | |
| 179 | 179 | } | |
| 180 | 180 | ||
modified drivers/net/wireless/marvell/mwifiex/cfg80211.c
| @@ -4277,7 +4277,6 @@ mwifiex_cfg80211_authenticate(struct wiphy *wiphy, | |||
| 4277 | 4277 | struct mwifiex_adapter *adapter = priv->adapter; | |
| 4278 | 4278 | struct sk_buff *skb; | |
| 4279 | 4279 | u16 pkt_len, auth_alg; | |
| 4280 | - | size_t frame_len; | |
| 4281 | 4280 | int ret; | |
| 4282 | 4281 | struct mwifiex_ieee80211_mgmt *mgmt; | |
| 4283 | 4282 | struct mwifiex_txinfo *tx_info; | |
| @@ -4350,17 +4349,10 @@ mwifiex_cfg80211_authenticate(struct wiphy *wiphy, | |||
| 4350 | 4349 | ||
| 4351 | 4350 | mwifiex_cancel_scan(adapter); | |
| 4352 | 4351 | ||
| 4353 | - | frame_len = req->ie_len + req->auth_data_len + | |
| 4352 | + | pkt_len = (u16)req->ie_len + req->auth_data_len + | |
| 4354 | 4353 | MWIFIEX_MGMT_HEADER_LEN + MWIFIEX_AUTH_BODY_LEN; | |
| 4355 | 4354 | if (req->auth_data_len >= 4) | |
| 4356 | - | frame_len -= 4; | |
| 4357 | - | ||
| 4358 | - | if (frame_len > U16_MAX) { | |
| 4359 | - | mwifiex_dbg(priv->adapter, ERROR, | |
| 4360 | - | "auth frame too long: %zu bytes\n", frame_len); | |
| 4361 | - | return -EINVAL; | |
| 4362 | - | } | |
| 4363 | - | pkt_len = frame_len; | |
| 4355 | + | pkt_len -= 4; | |
| 4364 | 4356 | ||
| 4365 | 4357 | skb = dev_alloc_skb(MWIFIEX_MIN_DATA_HEADER_LEN + | |
| 4366 | 4358 | MWIFIEX_MGMT_FRAME_HEADER_SIZE + | |
modified drivers/net/wireless/marvell/mwifiex/pcie.c
| @@ -3068,7 +3068,7 @@ static int mwifiex_pcie_request_irq(struct mwifiex_adapter *adapter) | |||
| 3068 | 3068 | ret); | |
| 3069 | 3069 | for (j = 0; j < i; j++) | |
| 3070 | 3070 | free_irq(card->msix_entries[j].vector, | |
| 3071 | - | &card->msix_ctx[j]); | |
| 3071 | + | &card->msix_ctx[i]); | |
| 3072 | 3072 | pci_disable_msix(pdev); | |
| 3073 | 3073 | } else { | |
| 3074 | 3074 | mwifiex_dbg(adapter, MSG, "MSIx enabled!"); | |
modified drivers/net/wireless/marvell/mwifiex/scan.c
| @@ -104,24 +104,12 @@ has_vendor_hdr(struct ieee_types_vendor_specific *ie, u8 key) | |||
| 104 | 104 | * a given oui in PTK. | |
| 105 | 105 | */ | |
| 106 | 106 | static u8 | |
| 107 | - | mwifiex_search_oui_in_ie(struct ie_body *iebody, u8 *oui, int ie_len) | |
| 107 | + | mwifiex_search_oui_in_ie(struct ie_body *iebody, u8 *oui) | |
| 108 | 108 | { | |
| 109 | - | const size_t ptk_body_offset = offsetof(struct ie_body, ptk_body); | |
| 110 | 109 | u8 count; | |
| 111 | 110 | ||
| 112 | - | /* ie_len is the number of bytes available at iebody. Keep it signed | |
| 113 | - | * and reject a negative (underflowed) length before the unsigned | |
| 114 | - | * comparisons below, so a small or zero IE length cannot wrap. | |
| 115 | - | */ | |
| 116 | - | if (ie_len < 0 || (size_t)ie_len < ptk_body_offset) | |
| 117 | - | return MWIFIEX_OUI_NOT_PRESENT; | |
| 118 | - | ||
| 119 | 111 | count = iebody->ptk_cnt[0]; | |
| 120 | 112 | ||
| 121 | - | /* Reject an OUI count whose list would run past the element. */ | |
| 122 | - | if (ptk_body_offset + count * sizeof(iebody->ptk_body) > (size_t)ie_len) | |
| 123 | - | return MWIFIEX_OUI_NOT_PRESENT; | |
| 124 | - | ||
| 125 | 113 | /* There could be multiple OUIs for PTK hence | |
| 126 | 114 | 1) Take the length. | |
| 127 | 115 | 2) Check all the OUIs for AES. | |
| @@ -155,14 +143,11 @@ mwifiex_is_rsn_oui_present(struct mwifiex_bssdescriptor *bss_desc, u32 cipher) | |||
| 155 | 143 | u8 ret = MWIFIEX_OUI_NOT_PRESENT; | |
| 156 | 144 | ||
| 157 | 145 | if (has_ieee_hdr(bss_desc->bcn_rsn_ie, WLAN_EID_RSN)) { | |
| 158 | - | int ie_len = (int)bss_desc->bcn_rsn_ie->ieee_hdr.len - | |
| 159 | - | RSN_GTK_OUI_OFFSET; | |
| 160 | - | ||
| 161 | 146 | iebody = (struct ie_body *) | |
| 162 | 147 | (((u8 *) bss_desc->bcn_rsn_ie->data) + | |
| 163 | 148 | RSN_GTK_OUI_OFFSET); | |
| 164 | 149 | oui = &mwifiex_rsn_oui[cipher][0]; | |
| 165 | - | ret = mwifiex_search_oui_in_ie(iebody, oui, ie_len); | |
| 150 | + | ret = mwifiex_search_oui_in_ie(iebody, oui); | |
| 166 | 151 | if (ret) | |
| 167 | 152 | return ret; | |
| 168 | 153 | } | |
| @@ -184,14 +169,10 @@ mwifiex_is_wpa_oui_present(struct mwifiex_bssdescriptor *bss_desc, u32 cipher) | |||
| 184 | 169 | u8 ret = MWIFIEX_OUI_NOT_PRESENT; | |
| 185 | 170 | ||
| 186 | 171 | if (has_vendor_hdr(bss_desc->bcn_wpa_ie, WLAN_EID_VENDOR_SPECIFIC)) { | |
| 187 | - | int ie_len = (int)bss_desc->bcn_wpa_ie->vend_hdr.len - | |
| 188 | - | (int)sizeof(bss_desc->bcn_wpa_ie->vend_hdr.oui) - | |
| 189 | - | WPA_GTK_OUI_OFFSET; | |
| 190 | - | ||
| 191 | 172 | iebody = (struct ie_body *)((u8 *)bss_desc->bcn_wpa_ie->data + | |
| 192 | 173 | WPA_GTK_OUI_OFFSET); | |
| 193 | 174 | oui = &mwifiex_wpa_oui[cipher][0]; | |
| 194 | - | ret = mwifiex_search_oui_in_ie(iebody, oui, ie_len); | |
| 175 | + | ret = mwifiex_search_oui_in_ie(iebody, oui); | |
| 195 | 176 | if (ret) | |
| 196 | 177 | return ret; | |
| 197 | 178 | } | |
| @@ -2115,7 +2096,6 @@ int mwifiex_ret_802_11_scan(struct mwifiex_private *priv, | |||
| 2115 | 2096 | u32 bytes_left; | |
| 2116 | 2097 | u32 idx; | |
| 2117 | 2098 | u32 tlv_buf_size; | |
| 2118 | - | size_t fixed_size; | |
| 2119 | 2099 | struct mwifiex_ie_types_chan_band_list_param_set *chan_band_tlv; | |
| 2120 | 2100 | struct chan_band_param_set *chan_band; | |
| 2121 | 2101 | u8 is_bgscan_resp; | |
| @@ -2131,14 +2111,6 @@ int mwifiex_ret_802_11_scan(struct mwifiex_private *priv, | |||
| 2131 | 2111 | else | |
| 2132 | 2112 | scan_rsp = &resp->params.scan_resp; | |
| 2133 | 2113 | ||
| 2134 | - | scan_resp_size = le16_to_cpu(resp->size); | |
| 2135 | - | fixed_size = scan_rsp->bss_desc_and_tlv_buffer - (u8 *)resp; | |
| 2136 | - | if (scan_resp_size < fixed_size) { | |
| 2137 | - | mwifiex_dbg(adapter, ERROR, | |
| 2138 | - | "SCAN_RESP: response is too short\n"); | |
| 2139 | - | ret = -1; | |
| 2140 | - | goto check_next_scan; | |
| 2141 | - | } | |
| 2142 | 2114 | ||
| 2143 | 2115 | if (scan_rsp->number_of_sets > MWIFIEX_MAX_AP) { | |
| 2144 | 2116 | mwifiex_dbg(adapter, ERROR, | |
| @@ -2156,6 +2128,8 @@ int mwifiex_ret_802_11_scan(struct mwifiex_private *priv, | |||
| 2156 | 2128 | "info: SCAN_RESP: bss_descript_size %d\n", | |
| 2157 | 2129 | bytes_left); | |
| 2158 | 2130 | ||
| 2131 | + | scan_resp_size = le16_to_cpu(resp->size); | |
| 2132 | + | ||
| 2159 | 2133 | mwifiex_dbg(adapter, INFO, | |
| 2160 | 2134 | "info: SCAN_RESP: returned %d APs before parsing\n", | |
| 2161 | 2135 | scan_rsp->number_of_sets); | |
| @@ -2163,17 +2137,15 @@ int mwifiex_ret_802_11_scan(struct mwifiex_private *priv, | |||
| 2163 | 2137 | bss_info = scan_rsp->bss_desc_and_tlv_buffer; | |
| 2164 | 2138 | ||
| 2165 | 2139 | /* | |
| 2166 | - | * The TLV buffer follows the command-specific fixed fields and the BSS | |
| 2167 | - | * descriptions. Background-scan responses have an additional fixed | |
| 2168 | - | * field before scan_rsp, which is included in fixed_size. | |
| 2140 | + | * The size of the TLV buffer is equal to the entire command response | |
| 2141 | + | * size (scan_resp_size) minus the fixed fields (sizeof()'s), the | |
| 2142 | + | * BSS Descriptions (bss_descript_size as bytesLef) and the command | |
| 2143 | + | * response header (S_DS_GEN) | |
| 2169 | 2144 | */ | |
| 2170 | - | if (bytes_left > scan_resp_size - fixed_size) { | |
| 2171 | - | mwifiex_dbg(adapter, ERROR, | |
| 2172 | - | "SCAN_RESP: BSS data exceeds response\n"); | |
| 2173 | - | ret = -1; | |
| 2174 | - | goto check_next_scan; | |
| 2175 | - | } | |
| 2176 | - | tlv_buf_size = scan_resp_size - fixed_size - bytes_left; | |
| 2145 | + | tlv_buf_size = scan_resp_size - (bytes_left | |
| 2146 | + | + sizeof(scan_rsp->bss_descript_size) | |
| 2147 | + | + sizeof(scan_rsp->number_of_sets) | |
| 2148 | + | + S_DS_GEN); | |
| 2177 | 2149 | ||
| 2178 | 2150 | tlv_data = (struct mwifiex_ie_types_data *) (scan_rsp-> | |
| 2179 | 2151 | bss_desc_and_tlv_buffer + | |
modified drivers/net/wireless/marvell/mwifiex/util.c
| @@ -317,16 +317,10 @@ mwifiex_parse_mgmt_packet(struct mwifiex_private *priv, u8 *payload, u16 len, | |||
| 317 | 317 | ||
| 318 | 318 | switch (stype) { | |
| 319 | 319 | case IEEE80211_STYPE_ACTION: | |
| 320 | - | if (len < sizeof(*ieee_hdr) + 1) | |
| 321 | - | return -1; | |
| 322 | - | ||
| 323 | - | category = *(payload + sizeof(*ieee_hdr)); | |
| 320 | + | category = *(payload + sizeof(struct ieee80211_hdr)); | |
| 324 | 321 | switch (category) { | |
| 325 | 322 | case WLAN_CATEGORY_PUBLIC: | |
| 326 | - | if (len < sizeof(*ieee_hdr) + 2) | |
| 327 | - | return -1; | |
| 328 | - | ||
| 329 | - | action_code = *(payload + sizeof(*ieee_hdr) | |
| 323 | + | action_code = *(payload + sizeof(struct ieee80211_hdr) | |
| 330 | 324 | + 1); | |
| 331 | 325 | if (action_code == WLAN_PUB_ACTION_TDLS_DISCOVER_RES) { | |
| 332 | 326 | addr2 = ieee_hdr->addr2; | |
modified drivers/net/wireless/microchip/wilc1000/cfg80211.c
| @@ -1058,13 +1058,6 @@ void wilc_wfi_p2p_rx(struct wilc_vif *vif, u8 *buff, u32 size) | |||
| 1058 | 1058 | if (!ieee80211_is_public_action((struct ieee80211_hdr *)buff, size)) | |
| 1059 | 1059 | goto out_rx_mgmt; | |
| 1060 | 1060 | ||
| 1061 | - | /* ieee80211_is_public_action() only validates up to the category | |
| 1062 | - | * byte, so reject frames too short for the P2P public action header | |
| 1063 | - | * before dereferencing it or computing size - ie_offset. | |
| 1064 | - | */ | |
| 1065 | - | if (size < ie_offset) | |
| 1066 | - | goto out_rx_mgmt; | |
| 1067 | - | ||
| 1068 | 1061 | d = (struct wilc_p2p_pub_act_frame *)(&mgmt->u.action); | |
| 1069 | 1062 | if (d->oui_subtype != GO_NEG_REQ && d->oui_subtype != GO_NEG_RSP && | |
| 1070 | 1063 | d->oui_subtype != P2P_INV_REQ && d->oui_subtype != P2P_INV_RSP) | |
| @@ -1207,13 +1200,6 @@ static int mgmt_tx(struct wiphy *wiphy, | |||
| 1207 | 1200 | goto out_set_timeout; | |
| 1208 | 1201 | } | |
| 1209 | 1202 | ||
| 1210 | - | /* ieee80211_is_public_action() only validates up to the category | |
| 1211 | - | * byte, so reject frames too short for the P2P public action header | |
| 1212 | - | * before dereferencing it or computing len - ie_offset. | |
| 1213 | - | */ | |
| 1214 | - | if (len < ie_offset) | |
| 1215 | - | goto out_set_timeout; | |
| 1216 | - | ||
| 1217 | 1203 | d = (struct wilc_p2p_pub_act_frame *)(&mgmt->u.action); | |
| 1218 | 1204 | if (d->oui_type != WLAN_OUI_TYPE_WFA_P2P || | |
| 1219 | 1205 | d->oui_subtype != GO_NEG_CONF) { | |
modified drivers/net/wireless/microchip/wilc1000/wlan.c
| @@ -1197,15 +1197,6 @@ static void wilc_wlan_handle_isr_ext(struct wilc *wilc, u32 int_status) | |||
| 1197 | 1197 | if (size <= 0) | |
| 1198 | 1198 | return; | |
| 1199 | 1199 | ||
| 1200 | - | /* A size exceeding the RX buffer is bogus; drop the transfer | |
| 1201 | - | * instead of overflowing the buffer. | |
| 1202 | - | */ | |
| 1203 | - | if (size > WILC_RX_BUFF_SIZE) { | |
| 1204 | - | wilc->hif_func->hif_clear_int_ext(wilc, | |
| 1205 | - | DATA_INT_CLR | ENABLE_RX_VMM); | |
| 1206 | - | return; | |
| 1207 | - | } | |
| 1208 | - | ||
| 1209 | 1200 | if (WILC_RX_BUFF_SIZE - offset < size) | |
| 1210 | 1201 | offset = 0; | |
| 1211 | 1202 | ||
modified drivers/net/wireless/rsi/rsi_91x_mgmt.c
| @@ -852,6 +852,8 @@ int rsi_hal_load_key(struct rsi_common *common, | |||
| 852 | 852 | memcpy(set_key->tx_mic_key, &data[16], 8); | |
| 853 | 853 | memcpy(set_key->rx_mic_key, &data[24], 8); | |
| 854 | 854 | } | |
| 855 | + | } else { | |
| 856 | + | memset(&set_key[FRAME_DESC_SZ], 0, frame_len - FRAME_DESC_SZ); | |
| 855 | 857 | } | |
| 856 | 858 | ||
| 857 | 859 | skb_put(skb, frame_len); | |
modified drivers/net/wireless/ti/wlcore/main.c
| @@ -3724,8 +3724,10 @@ void wlcore_regdomain_config(struct wl1271 *wl) | |||
| 3724 | 3724 | goto out; | |
| 3725 | 3725 | ||
| 3726 | 3726 | ret = wlcore_cmd_regdomain_config_locked(wl); | |
| 3727 | - | if (ret < 0) | |
| 3727 | + | if (ret < 0) { | |
| 3728 | 3728 | wl12xx_queue_recovery_work(wl); | |
| 3729 | + | goto out; | |
| 3730 | + | } | |
| 3729 | 3731 | ||
| 3730 | 3732 | pm_runtime_put_autosuspend(wl->dev); | |
| 3731 | 3733 | out: | |
modified drivers/net/wireless/virtual/mac80211_hwsim_main.c
| @@ -2327,12 +2327,7 @@ static void mac80211_hwsim_stop(struct ieee80211_hw *hw, bool suspend) | |||
| 2327 | 2327 | struct sk_buff *skb; | |
| 2328 | 2328 | int i; | |
| 2329 | 2329 | ||
| 2330 | - | /* | |
| 2331 | - | * Serialise against wmediumd userspace, so no more frames | |
| 2332 | - | * can be handed to mac80211 after this returns. | |
| 2333 | - | */ | |
| 2334 | - | scoped_guard(mutex, &data->mutex) | |
| 2335 | - | data->started = false; | |
| 2330 | + | data->started = false; | |
| 2336 | 2331 | ||
| 2337 | 2332 | for (i = 0; i < ARRAY_SIZE(data->link_data); i++) | |
| 2338 | 2333 | hrtimer_cancel(&data->link_data[i].beacon_timer); | |
| @@ -6510,12 +6505,12 @@ static int hwsim_cloned_frame_received_nl(struct sk_buff *skb_2, | |||
| 6510 | 6505 | ||
| 6511 | 6506 | if (frame_data_len < sizeof(struct ieee80211_hdr_3addr) || | |
| 6512 | 6507 | frame_data_len > IEEE80211_MAX_DATA_LEN) | |
| 6513 | - | goto out; | |
| 6508 | + | goto err; | |
| 6514 | 6509 | ||
| 6515 | 6510 | /* Allocate new skb here */ | |
| 6516 | 6511 | skb = alloc_skb(frame_data_len, GFP_KERNEL); | |
| 6517 | 6512 | if (skb == NULL) | |
| 6518 | - | goto out; | |
| 6513 | + | goto err; | |
| 6519 | 6514 | ||
| 6520 | 6515 | /* Copy the data */ | |
| 6521 | 6516 | skb_put_data(skb, frame_data, frame_data_len); | |
| @@ -6540,17 +6535,10 @@ static int hwsim_cloned_frame_received_nl(struct sk_buff *skb_2, | |||
| 6540 | 6535 | goto out; | |
| 6541 | 6536 | } | |
| 6542 | 6537 | ||
| 6543 | - | /* | |
| 6544 | - | * Serialise against mac80211_hwsim_stop() - mac80211 doesn't allow | |
| 6545 | - | * frames reported while the HW is down, hence the ->started check | |
| 6546 | - | * must be under mutex. | |
| 6547 | - | */ | |
| 6548 | - | mutex_lock(&data2->mutex); | |
| 6549 | - | ||
| 6550 | 6538 | /* check if radio is configured properly */ | |
| 6551 | 6539 | ||
| 6552 | 6540 | if ((data2->idle && !data2->tmp_chan) || !data2->started) | |
| 6553 | - | goto out_unlock; | |
| 6541 | + | goto out; | |
| 6554 | 6542 | ||
| 6555 | 6543 | /* A frame is received from user space */ | |
| 6556 | 6544 | memset(&rx_status, 0, sizeof(rx_status)); | |
| @@ -6569,18 +6557,22 @@ static int hwsim_cloned_frame_received_nl(struct sk_buff *skb_2, | |||
| 6569 | 6557 | iter_data.channel = ieee80211_get_channel(data2->hw->wiphy, | |
| 6570 | 6558 | rx_status.freq); | |
| 6571 | 6559 | if (!iter_data.channel) | |
| 6572 | - | goto out_unlock; | |
| 6560 | + | goto out; | |
| 6573 | 6561 | rx_status.band = iter_data.channel->band; | |
| 6574 | 6562 | ||
| 6563 | + | mutex_lock(&data2->mutex); | |
| 6575 | 6564 | if (!hwsim_chans_compat(iter_data.channel, channel)) { | |
| 6576 | 6565 | ieee80211_iterate_active_interfaces_atomic( | |
| 6577 | 6566 | data2->hw, IEEE80211_IFACE_ITER_NORMAL, | |
| 6578 | 6567 | mac80211_hwsim_tx_iter, &iter_data); | |
| 6579 | - | if (!iter_data.receive) | |
| 6580 | - | goto out_unlock; | |
| 6568 | + | if (!iter_data.receive) { | |
| 6569 | + | mutex_unlock(&data2->mutex); | |
| 6570 | + | goto out; | |
| 6571 | + | } | |
| 6581 | 6572 | } | |
| 6573 | + | mutex_unlock(&data2->mutex); | |
| 6582 | 6574 | } else if (!channel) { | |
| 6583 | - | goto out_unlock; | |
| 6575 | + | goto out; | |
| 6584 | 6576 | } else { | |
| 6585 | 6577 | rx_status.freq = channel->center_freq; | |
| 6586 | 6578 | rx_status.band = channel->band; | |
| @@ -6588,7 +6580,7 @@ static int hwsim_cloned_frame_received_nl(struct sk_buff *skb_2, | |||
| 6588 | 6580 | ||
| 6589 | 6581 | rx_status.rate_idx = nla_get_u32(info->attrs[HWSIM_ATTR_RX_RATE]); | |
| 6590 | 6582 | if (rx_status.rate_idx >= data2->hw->wiphy->bands[rx_status.band]->n_bitrates) | |
| 6591 | - | goto out_unlock; | |
| 6583 | + | goto out; | |
| 6592 | 6584 | rx_status.signal = nla_get_u32(info->attrs[HWSIM_ATTR_SIGNAL]); | |
| 6593 | 6585 | ||
| 6594 | 6586 | hdr = (void *)skb->data; | |
| @@ -6598,11 +6590,10 @@ static int hwsim_cloned_frame_received_nl(struct sk_buff *skb_2, | |||
| 6598 | 6590 | rx_status.boottime_ns = ktime_get_boottime_ns(); | |
| 6599 | 6591 | ||
| 6600 | 6592 | mac80211_hwsim_rx(data2, &rx_status, skb); | |
| 6601 | - | mutex_unlock(&data2->mutex); | |
| 6602 | 6593 | ||
| 6603 | 6594 | return 0; | |
| 6604 | - | out_unlock: | |
| 6605 | - | mutex_unlock(&data2->mutex); | |
| 6595 | + | err: | |
| 6596 | + | pr_debug("mac80211_hwsim: error occurred in %s\n", __func__); | |
| 6606 | 6597 | out: | |
| 6607 | 6598 | dev_kfree_skb(skb); | |
| 6608 | 6599 | return -EINVAL; | |
modified drivers/net/wireless/virtual/virt_wifi.c
| @@ -434,7 +434,6 @@ static netdev_tx_t virt_wifi_start_xmit(struct sk_buff *skb, | |||
| 434 | 434 | priv->tx_packets++; | |
| 435 | 435 | if (!priv->is_connected) { | |
| 436 | 436 | priv->tx_failed++; | |
| 437 | - | dev_kfree_skb_any(skb); | |
| 438 | 437 | return NET_XMIT_DROP; | |
| 439 | 438 | } | |
| 440 | 439 | ||
| @@ -558,6 +557,7 @@ static int virt_wifi_newlink(struct net_device *dev, | |||
| 558 | 557 | } | |
| 559 | 558 | ||
| 560 | 559 | eth_hw_addr_inherit(dev, priv->lowerdev); | |
| 560 | + | netif_stacked_transfer_operstate(priv->lowerdev, dev); | |
| 561 | 561 | ||
| 562 | 562 | dev->ieee80211_ptr = kzalloc_obj(*dev->ieee80211_ptr); | |
| 563 | 563 | ||
| @@ -583,8 +583,6 @@ static int virt_wifi_newlink(struct net_device *dev, | |||
| 583 | 583 | goto unregister_netdev; | |
| 584 | 584 | } | |
| 585 | 585 | ||
| 586 | - | netif_stacked_transfer_operstate(priv->lowerdev, dev); | |
| 587 | - | ||
| 588 | 586 | dev->priv_destructor = virt_wifi_net_device_destructor; | |
| 589 | 587 | priv->being_deleted = false; | |
| 590 | 588 | priv->is_connected = false; | |
modified drivers/net/wwan/mhi_wwan_mbim.c
| @@ -251,14 +251,6 @@ static int mbim_rx_verify_ndp16(struct sk_buff *skb, struct usb_cdc_ncm_ndp16 *n | |||
| 251 | 251 | return ret; | |
| 252 | 252 | } | |
| 253 | 253 | ||
| 254 | - | static void mhi_mbim_rx_drop(struct mhi_mbim_link *link, struct sk_buff *skb) | |
| 255 | - | { | |
| 256 | - | dev_kfree_skb_any(skb); | |
| 257 | - | u64_stats_update_begin(&link->rx_syncp); | |
| 258 | - | u64_stats_inc(&link->rx_errors); | |
| 259 | - | u64_stats_update_end(&link->rx_syncp); | |
| 260 | - | } | |
| 261 | - | ||
| 262 | 254 | static void mhi_mbim_rx(struct mhi_mbim_context *mbim, struct sk_buff *skb) | |
| 263 | 255 | { | |
| 264 | 256 | int ndpoffset; | |
| @@ -328,10 +320,7 @@ static void mhi_mbim_rx(struct mhi_mbim_context *mbim, struct sk_buff *skb) | |||
| 328 | 320 | continue; | |
| 329 | 321 | ||
| 330 | 322 | skb_put(skbn, dgram_len); | |
| 331 | - | if (skb_copy_bits(skb, dgram_offset, skbn->data, dgram_len)) { | |
| 332 | - | mhi_mbim_rx_drop(link, skbn); | |
| 333 | - | continue; | |
| 334 | - | } | |
| 323 | + | skb_copy_bits(skb, dgram_offset, skbn->data, dgram_len); | |
| 335 | 324 | ||
| 336 | 325 | switch (skbn->data[0] & 0xf0) { | |
| 337 | 326 | case 0x40: | |
| @@ -343,7 +332,10 @@ static void mhi_mbim_rx(struct mhi_mbim_context *mbim, struct sk_buff *skb) | |||
| 343 | 332 | default: | |
| 344 | 333 | net_err_ratelimited("%s: unknown protocol\n", | |
| 345 | 334 | link->ndev->name); | |
| 346 | - | mhi_mbim_rx_drop(link, skbn); | |
| 335 | + | dev_kfree_skb_any(skbn); | |
| 336 | + | u64_stats_update_begin(&link->rx_syncp); | |
| 337 | + | u64_stats_inc(&link->rx_errors); | |
| 338 | + | u64_stats_update_end(&link->rx_syncp); | |
| 347 | 339 | continue; | |
| 348 | 340 | } | |
| 349 | 341 | ||
| @@ -357,13 +349,9 @@ static void mhi_mbim_rx(struct mhi_mbim_context *mbim, struct sk_buff *skb) | |||
| 357 | 349 | unlock: | |
| 358 | 350 | rcu_read_unlock(); | |
| 359 | 351 | next_ndp: | |
| 360 | - | /* Other NDP to process? The offsets must advance, or a | |
| 361 | - | * self-referencing NDP keeps the loop spinning forever. | |
| 362 | - | */ | |
| 363 | - | n = (int)le16_to_cpu(ndp16.wNextNdpIndex); | |
| 364 | - | if (n > ndpoffset) | |
| 365 | - | ndpoffset = n; | |
| 366 | - | else | |
| 352 | + | /* Other NDP to process? */ | |
| 353 | + | ndpoffset = (int)le16_to_cpu(ndp16.wNextNdpIndex); | |
| 354 | + | if (!ndpoffset) | |
| 367 | 355 | break; | |
| 368 | 356 | } | |
| 369 | 357 | ||
modified drivers/net/wwan/t7xx/t7xx_netdev.c
| @@ -420,10 +420,6 @@ static void t7xx_ccmni_recv_skb(struct t7xx_ccmni_ctrl *ccmni_ctlb, struct sk_bu | |||
| 420 | 420 | ||
| 421 | 421 | skb_cb = T7XX_SKB_CB(skb); | |
| 422 | 422 | netif_id = skb_cb->netif_idx; | |
| 423 | - | if (netif_id >= NIC_DEV_MAX) { | |
| 424 | - | dev_kfree_skb(skb); | |
| 425 | - | return; | |
| 426 | - | } | |
| 427 | 423 | ccmni = READ_ONCE(ccmni_ctlb->ccmni_inst[netif_id]); | |
| 428 | 424 | if (!ccmni) { | |
| 429 | 425 | dev_kfree_skb(skb); | |
modified drivers/nfc/microread/microread.c
| @@ -251,9 +251,9 @@ static int microread_start_poll(struct nfc_hci_dev *hdev, | |||
| 251 | 251 | param[1] |= (1 << 1); | |
| 252 | 252 | ||
| 253 | 253 | if ((im_protocols | tm_protocols) & NFC_PROTO_NFC_DEP_MASK) { | |
| 254 | - | nfc_get_local_general_bytes(hdev->ndev, hdev->gb, | |
| 255 | - | sizeof(hdev->gb), &hdev->gb_len); | |
| 256 | - | if (hdev->gb_len == 0) { | |
| 254 | + | hdev->gb = nfc_get_local_general_bytes(hdev->ndev, | |
| 255 | + | &hdev->gb_len); | |
| 256 | + | if (hdev->gb == NULL || hdev->gb_len == 0) { | |
| 257 | 257 | im_protocols &= ~NFC_PROTO_NFC_DEP_MASK; | |
| 258 | 258 | tm_protocols &= ~NFC_PROTO_NFC_DEP_MASK; | |
| 259 | 259 | } | |
modified drivers/nfc/nfcmrvl/fw_dnld.c
| @@ -263,14 +263,9 @@ static int process_state_fw_dnld(struct nfcmrvl_private *priv, | |||
| 263 | 263 | * B8..N: payload | |
| 264 | 264 | */ | |
| 265 | 265 | ||
| 266 | - | if (skb->len != NCI_DATA_HDR_SIZE + 5) { | |
| 267 | - | nfc_err(priv->dev, "bad command"); | |
| 268 | - | return -EINVAL; | |
| 269 | - | } | |
| 270 | - | ||
| 271 | - | /* Remove NCI header */ | |
| 272 | - | skb_pull(skb, NCI_DATA_HDR_SIZE); | |
| 273 | - | if (skb->data[0] != HELPER_CMD_PACKET_FORMAT) { | |
| 266 | + | /* Remove NCI HDR */ | |
| 267 | + | skb_pull(skb, 3); | |
| 268 | + | if (skb->data[0] != HELPER_CMD_PACKET_FORMAT || skb->len != 5) { | |
| 274 | 269 | nfc_err(priv->dev, "bad command"); | |
| 275 | 270 | return -EINVAL; | |
| 276 | 271 | } | |
modified drivers/nfc/pn533/pn533.c
| @@ -1357,11 +1357,10 @@ static int pn533_poll_dep(struct nfc_dev *nfc_dev) | |||
| 1357 | 1357 | u8 *next, nfcid3[NFC_NFCID3_MAXSIZE]; | |
| 1358 | 1358 | u8 passive_data[PASSIVE_DATA_LEN] = {0x00, 0xff, 0xff, 0x00, 0x3}; | |
| 1359 | 1359 | ||
| 1360 | - | if (!dev->gb_len) { | |
| 1361 | - | nfc_get_local_general_bytes(nfc_dev, dev->gb, | |
| 1362 | - | sizeof(dev->gb), | |
| 1363 | - | &dev->gb_len); | |
| 1364 | - | if (!dev->gb_len) { | |
| 1360 | + | if (!dev->gb) { | |
| 1361 | + | dev->gb = nfc_get_local_general_bytes(nfc_dev, &dev->gb_len); | |
| 1362 | + | ||
| 1363 | + | if (!dev->gb || !dev->gb_len) { | |
| 1365 | 1364 | dev->poll_dep = 0; | |
| 1366 | 1365 | queue_work(dev->wq, &dev->rf_work); | |
| 1367 | 1366 | } | |
| @@ -1659,9 +1658,8 @@ static int pn533_start_poll(struct nfc_dev *nfc_dev, | |||
| 1659 | 1658 | } | |
| 1660 | 1659 | ||
| 1661 | 1660 | if (tm_protocols) { | |
| 1662 | - | nfc_get_local_general_bytes(nfc_dev, dev->gb, | |
| 1663 | - | sizeof(dev->gb), &dev->gb_len); | |
| 1664 | - | if (dev->gb_len == 0) | |
| 1661 | + | dev->gb = nfc_get_local_general_bytes(nfc_dev, &dev->gb_len); | |
| 1662 | + | if (dev->gb == NULL) | |
| 1665 | 1663 | tm_protocols = 0; | |
| 1666 | 1664 | } | |
| 1667 | 1665 | ||
modified drivers/nfc/pn533/pn533.h
| @@ -6,8 +6,6 @@ | |||
| 6 | 6 | * Copyright (C) 2012-2013 Tieto Poland | |
| 7 | 7 | */ | |
| 8 | 8 | ||
| 9 | - | #include <net/nfc/nfc.h> | |
| 10 | - | ||
| 11 | 9 | #define PN533_DEVICE_STD 0x1 | |
| 12 | 10 | #define PN533_DEVICE_PASORI 0x2 | |
| 13 | 11 | #define PN533_DEVICE_ACR122U 0x3 | |
| @@ -168,7 +166,7 @@ struct pn533 { | |||
| 168 | 166 | struct timer_list listen_timer; | |
| 169 | 167 | int cancel_listen; | |
| 170 | 168 | ||
| 171 | - | u8 gb[NFC_MAX_GT_LEN]; | |
| 169 | + | u8 *gb; | |
| 172 | 170 | size_t gb_len; | |
| 173 | 171 | ||
| 174 | 172 | u8 tgt_available_prots; | |
modified drivers/nfc/pn533/usb.c
| @@ -319,9 +319,7 @@ static bool pn533_acr122_is_rx_frame_valid(void *_frame, struct pn533 *dev) | |||
| 319 | 319 | if (frame->ccid.type != 0x83) | |
| 320 | 320 | return false; | |
| 321 | 321 | ||
| 322 | - | if (frame->ccid.datalen < 2 || | |
| 323 | - | frame->ccid.datalen > PN533_ACR122_FRAME_MAX_PAYLOAD_LEN + | |
| 324 | - | PN533_ACR122_RX_FRAME_TAIL_LEN) | |
| 322 | + | if (!frame->ccid.datalen) | |
| 325 | 323 | return false; | |
| 326 | 324 | ||
| 327 | 325 | if (frame->data[frame->ccid.datalen - 2] == 0x63) | |
modified drivers/nfc/pn544/pn544.c
| @@ -377,9 +377,10 @@ static int pn544_hci_start_poll(struct nfc_hci_dev *hdev, | |||
| 377 | 377 | return r; | |
| 378 | 378 | ||
| 379 | 379 | if ((im_protocols | tm_protocols) & NFC_PROTO_NFC_DEP_MASK) { | |
| 380 | - | nfc_get_local_general_bytes(hdev->ndev, hdev->gb, | |
| 381 | - | sizeof(hdev->gb), &hdev->gb_len); | |
| 382 | - | if (hdev->gb_len == 0) { | |
| 380 | + | hdev->gb = nfc_get_local_general_bytes(hdev->ndev, | |
| 381 | + | &hdev->gb_len); | |
| 382 | + | pr_debug("generate local bytes %p\n", hdev->gb); | |
| 383 | + | if (hdev->gb == NULL || hdev->gb_len == 0) { | |
| 383 | 384 | im_protocols &= ~NFC_PROTO_NFC_DEP_MASK; | |
| 384 | 385 | tm_protocols &= ~NFC_PROTO_NFC_DEP_MASK; | |
| 385 | 386 | } | |
modified drivers/nfc/port100.c
| @@ -636,13 +636,6 @@ static void port100_recv_response(struct urb *urb) | |||
| 636 | 636 | ||
| 637 | 637 | in_frame = dev->in_urb->transfer_buffer; | |
| 638 | 638 | ||
| 639 | - | if (urb->actual_length < PORT100_FRAME_HEADER_LEN || | |
| 640 | - | urb->actual_length < port100_rx_frame_size(in_frame)) { | |
| 641 | - | nfc_err(&dev->interface->dev, "Received a truncated frame\n"); | |
| 642 | - | cmd->status = -EIO; | |
| 643 | - | goto sched_wq; | |
| 644 | - | } | |
| 645 | - | ||
| 646 | 639 | if (!port100_rx_frame_is_valid(in_frame)) { | |
| 647 | 640 | nfc_err(&dev->interface->dev, "Received an invalid frame\n"); | |
| 648 | 641 | cmd->status = -EIO; | |
modified drivers/nfc/st21nfca/core.c
| @@ -351,10 +351,10 @@ static int st21nfca_hci_start_poll(struct nfc_hci_dev *hdev, | |||
| 351 | 351 | if (r < 0) | |
| 352 | 352 | return r; | |
| 353 | 353 | } else { | |
| 354 | - | nfc_get_local_general_bytes(hdev->ndev, hdev->gb, | |
| 355 | - | sizeof(hdev->gb), | |
| 356 | - | &hdev->gb_len); | |
| 357 | - | if (hdev->gb_len == 0) { | |
| 354 | + | hdev->gb = nfc_get_local_general_bytes(hdev->ndev, | |
| 355 | + | &hdev->gb_len); | |
| 356 | + | ||
| 357 | + | if (hdev->gb == NULL || hdev->gb_len == 0) { | |
| 358 | 358 | im_protocols &= ~NFC_PROTO_NFC_DEP_MASK; | |
| 359 | 359 | tm_protocols &= ~NFC_PROTO_NFC_DEP_MASK; | |
| 360 | 360 | } | |
| @@ -577,7 +577,9 @@ static int st21nfca_get_iso15693_inventory(struct nfc_hci_dev *hdev, | |||
| 577 | 577 | if (r < 0) | |
| 578 | 578 | goto exit; | |
| 579 | 579 | ||
| 580 | - | if (!skb_pull(inventory_skb, 2) || inventory_skb->len < 2 || | |
| 580 | + | skb_pull(inventory_skb, 2); | |
| 581 | + | ||
| 582 | + | if (inventory_skb->len == 0 || | |
| 581 | 583 | inventory_skb->len > NFC_ISO15693_UID_MAXSIZE) { | |
| 582 | 584 | r = -EPROTO; | |
| 583 | 585 | goto exit; | |
modified drivers/nfc/st21nfca/i2c.c
| @@ -289,36 +289,27 @@ static int check_crc(u8 *buf, int buflen) | |||
| 289 | 289 | */ | |
| 290 | 290 | static int st21nfca_hci_i2c_repack(struct sk_buff *skb) | |
| 291 | 291 | { | |
| 292 | - | int read, write, r, size; | |
| 292 | + | int i, j, r, size; | |
| 293 | 293 | ||
| 294 | - | if (skb->len < ST21NFCA_FRAME_HEADROOM || | |
| 295 | - | !IS_START_OF_FRAME(skb->data)) | |
| 294 | + | if (skb->len < 1 || (skb->len > 1 && skb->data[1] != 0)) | |
| 296 | 295 | return -EBADMSG; | |
| 297 | 296 | ||
| 298 | 297 | size = get_frame_size(skb->data, skb->len); | |
| 299 | 298 | if (size > 0) { | |
| 300 | - | if (size < ST21NFCA_FRAME_HEADROOM + 2) | |
| 301 | - | return -EBADMSG; | |
| 302 | - | ||
| 303 | 299 | skb_trim(skb, size); | |
| 304 | 300 | /* remove ST21NFCA byte stuffing for upper layer */ | |
| 305 | - | for (read = 1, write = 1; read < skb->len;) { | |
| 306 | - | if (skb->data[read] == | |
| 301 | + | for (i = 1, j = 0; i < skb->len; i++) { | |
| 302 | + | if (skb->data[i + j] == | |
| 307 | 303 | (u8) ST21NFCA_ESCAPE_BYTE_STUFFING) { | |
| 308 | - | if (read + 1 == skb->len) | |
| 309 | - | return -EBADMSG; | |
| 310 | - | ||
| 311 | - | skb->data[write++] = skb->data[read + 1] | |
| 312 | - | | ST21NFCA_BYTE_STUFFING_MASK; | |
| 313 | - | read += 2; | |
| 314 | - | } else { | |
| 315 | - | skb->data[write++] = skb->data[read++]; | |
| 304 | + | skb->data[i] = skb->data[i + j + 1] | |
| 305 | + | | ST21NFCA_BYTE_STUFFING_MASK; | |
| 306 | + | i++; | |
| 307 | + | j++; | |
| 316 | 308 | } | |
| 309 | + | skb->data[i] = skb->data[i + j]; | |
| 317 | 310 | } | |
| 318 | 311 | /* remove byte stuffing useless byte */ | |
| 319 | - | skb_trim(skb, write); | |
| 320 | - | if (skb->len < ST21NFCA_FRAME_HEADROOM + 2) | |
| 321 | - | return -EBADMSG; | |
| 312 | + | skb_trim(skb, i - j); | |
| 322 | 313 | /* remove ST21NFCA_SOF_EOF from head */ | |
| 323 | 314 | skb_pull(skb, 1); | |
| 324 | 315 | ||
modified drivers/nfc/trf7970a.c
| @@ -1997,10 +1997,8 @@ static int trf7970a_startup(struct trf7970a *trf) | |||
| 1997 | 1997 | return ret; | |
| 1998 | 1998 | ||
| 1999 | 1999 | ret = trf7970a_update_rx_gain_reduction(trf); | |
| 2000 | - | if (ret) { | |
| 2001 | - | trf7970a_power_down(trf); | |
| 2000 | + | if (ret) | |
| 2002 | 2001 | return ret; | |
| 2003 | - | } | |
| 2004 | 2002 | ||
| 2005 | 2003 | pm_runtime_set_active(trf->dev); | |
| 2006 | 2004 | pm_runtime_enable(trf->dev); | |
modified drivers/nfc/virtual_ncidev.c
| @@ -195,8 +195,7 @@ static const struct file_operations virtual_ncidev_fops = { | |||
| 195 | 195 | .write = virtual_ncidev_write, | |
| 196 | 196 | .open = virtual_ncidev_open, | |
| 197 | 197 | .release = virtual_ncidev_close, | |
| 198 | - | .unlocked_ioctl = virtual_ncidev_ioctl, | |
| 199 | - | .compat_ioctl = compat_ptr_ioctl, | |
| 198 | + | .unlocked_ioctl = virtual_ncidev_ioctl | |
| 200 | 199 | }; | |
| 201 | 200 | ||
| 202 | 201 | static struct miscdevice miscdev = { | |
modified drivers/pci/controller/dwc/pci-imx6.c
| @@ -1394,6 +1394,12 @@ static int imx_pcie_host_init(struct dw_pcie_rp *pp) | |||
| 1394 | 1394 | } | |
| 1395 | 1395 | } | |
| 1396 | 1396 | ||
| 1397 | + | ret = imx_pcie_clk_enable(imx_pcie); | |
| 1398 | + | if (ret) { | |
| 1399 | + | dev_err(dev, "unable to enable pcie clocks: %d\n", ret); | |
| 1400 | + | goto err_pwrctrl_power_off; | |
| 1401 | + | } | |
| 1402 | + | ||
| 1397 | 1403 | if (pp->bridge && imx_check_flag(imx_pcie, IMX_PCIE_FLAG_HAS_LUT)) { | |
| 1398 | 1404 | pp->bridge->enable_device = imx_pcie_enable_device; | |
| 1399 | 1405 | pp->bridge->disable_device = imx_pcie_disable_device; | |
| @@ -1409,12 +1415,6 @@ static int imx_pcie_host_init(struct dw_pcie_rp *pp) | |||
| 1409 | 1415 | ||
| 1410 | 1416 | imx_pcie_configure_type(imx_pcie); | |
| 1411 | 1417 | ||
| 1412 | - | ret = imx_pcie_clk_enable(imx_pcie); | |
| 1413 | - | if (ret) { | |
| 1414 | - | dev_err(dev, "unable to enable pcie clocks: %d\n", ret); | |
| 1415 | - | goto err_pwrctrl_power_off; | |
| 1416 | - | } | |
| 1417 | - | ||
| 1418 | 1418 | if (imx_pcie->phy) { | |
| 1419 | 1419 | ret = phy_init(imx_pcie->phy); | |
| 1420 | 1420 | if (ret) { | |
modified drivers/pci/of_property.c
| @@ -95,13 +95,9 @@ static int of_pci_prop_bus_range(struct pci_dev *pdev, | |||
| 95 | 95 | struct of_changeset *ocs, | |
| 96 | 96 | struct device_node *np) | |
| 97 | 97 | { | |
| 98 | - | u32 bus_range[2]; | |
| 98 | + | u32 bus_range[] = { pdev->subordinate->busn_res.start, | |
| 99 | + | pdev->subordinate->busn_res.end }; | |
| 99 | 100 | ||
| 100 | - | if (!pdev->subordinate) | |
| 101 | - | return 0; | |
| 102 | - | ||
| 103 | - | bus_range[0] = pdev->subordinate->busn_res.start; | |
| 104 | - | bus_range[1] = pdev->subordinate->busn_res.end; | |
| 105 | 101 | return of_changeset_add_prop_u32_array(ocs, np, "bus-range", bus_range, | |
| 106 | 102 | ARRAY_SIZE(bus_range)); | |
| 107 | 103 | } | |
| @@ -224,9 +220,6 @@ static int of_pci_prop_intr_map(struct pci_dev *pdev, struct of_changeset *ocs, | |||
| 224 | 220 | int ret; | |
| 225 | 221 | u8 pin; | |
| 226 | 222 | ||
| 227 | - | if (!pdev->subordinate) | |
| 228 | - | return 0; | |
| 229 | - | ||
| 230 | 223 | pnode = pci_device_to_OF_node(pdev->bus->self); | |
| 231 | 224 | if (!pnode) | |
| 232 | 225 | pnode = pci_bus_to_OF_node(pdev->bus); | |
modified drivers/pci/setup-bus.c
| @@ -2380,7 +2380,6 @@ int pci_do_resource_release_and_resize(struct pci_dev *pdev, int resno, int size | |||
| 2380 | 2380 | struct resource *res = pci_resource_n(pdev, resno); | |
| 2381 | 2381 | struct pci_dev_resource *dev_res; | |
| 2382 | 2382 | struct pci_bus *bus = pdev->bus; | |
| 2383 | - | struct pci_dev *bridge = pci_upstream_bridge(pdev); | |
| 2384 | 2383 | struct resource *b_win, *r; | |
| 2385 | 2384 | LIST_HEAD(saved); | |
| 2386 | 2385 | unsigned int i; | |
| @@ -2398,8 +2397,6 @@ int pci_do_resource_release_and_resize(struct pci_dev *pdev, int resno, int size | |||
| 2398 | 2397 | if (ret) | |
| 2399 | 2398 | return ret; | |
| 2400 | 2399 | ||
| 2401 | - | down_read(&pci_bus_sem); | |
| 2402 | - | ||
| 2403 | 2400 | pci_dev_for_each_resource(pdev, r, i) { | |
| 2404 | 2401 | if (i >= PCI_BRIDGE_RESOURCES) | |
| 2405 | 2402 | break; | |
| @@ -2418,21 +2415,13 @@ int pci_do_resource_release_and_resize(struct pci_dev *pdev, int resno, int size | |||
| 2418 | 2415 | ||
| 2419 | 2416 | pci_resize_resource_set_size(pdev, resno, size); | |
| 2420 | 2417 | ||
| 2421 | - | if (bridge) { | |
| 2422 | - | ret = pbus_reassign_bridge_resources(bus, res, &saved); | |
| 2423 | - | if (ret) | |
| 2424 | - | goto restore; | |
| 2425 | - | } else { | |
| 2426 | - | /* No bridge window to adjust; let the core reassign the bus. */ | |
| 2427 | - | pci_bus_assign_resources(bus); | |
| 2418 | + | if (!bus->self) | |
| 2419 | + | goto out; | |
| 2428 | 2420 | ||
| 2429 | - | list_for_each_entry(dev_res, &saved, list) { | |
| 2430 | - | if (!resource_assigned(dev_res->res)) { | |
| 2431 | - | ret = -ENOSPC; | |
| 2432 | - | goto restore; | |
| 2433 | - | } | |
| 2434 | - | } | |
| 2435 | - | } | |
| 2421 | + | down_read(&pci_bus_sem); | |
| 2422 | + | ret = pbus_reassign_bridge_resources(bus, res, &saved); | |
| 2423 | + | if (ret) | |
| 2424 | + | goto restore; | |
| 2436 | 2425 | ||
| 2437 | 2426 | out: | |
| 2438 | 2427 | up_read(&pci_bus_sem); | |
modified drivers/perf/arm-cmn.c
| @@ -305,9 +305,9 @@ enum cmn_filter_select { | |||
| 305 | 305 | SEL_NONE, | |
| 306 | 306 | SEL_OCCUP1_ID, | |
| 307 | 307 | SEL_CLASS_OCCUP_ID, | |
| 308 | + | SEL_CBUSY_SNTHROTTLE_SEL, | |
| 308 | 309 | SEL_HBT_LBT_SEL, | |
| 309 | 310 | SEL_SN_HOME_SEL, | |
| 310 | - | SEL_CBUSY_SNTHROTTLE_SEL, | |
| 311 | 311 | SEL_SNP_VC_SEL, | |
| 312 | 312 | SEL_ENHANCED_HBT_LBT_SEL, | |
| 313 | 313 | SEL_EVICT_STATE_SEL, | |
| @@ -978,14 +978,10 @@ static umode_t arm_cmn_event_attr_is_visible(struct kobject *kobj, | |||
| 978 | 978 | _CMN_EVENT_HNS(_model, _name##_all, _event, _sel, 0), \ | |
| 979 | 979 | _CMN_EVENT_HNS(_model, _name##_hbt, _event, _sel, 1), \ | |
| 980 | 980 | _CMN_EVENT_HNS(_model, _name##_lbt, _event, _sel, 2) | |
| 981 | - | #define _CMN_EVENT_HNS_EVICT(_model, _name, _event, _fsel1, f1) \ | |
| 982 | - | _CMN_EVENT_HNS(_model, _name##_all, _event, _fsel1, f1, SEL_EVICT_STATE_SEL, 0), \ | |
| 983 | - | _CMN_EVENT_HNS(_model, _name##_eu, _event, _fsel1, f1, SEL_EVICT_STATE_SEL, 1), \ | |
| 984 | - | _CMN_EVENT_HNS(_model, _name##_en, _event, _fsel1, f1, SEL_EVICT_STATE_SEL, 2), \ | |
| 985 | - | _CMN_EVENT_HNS(_model, _name##_su, _event, _fsel1, f1, SEL_EVICT_STATE_SEL, 3), \ | |
| 986 | - | _CMN_EVENT_HNS(_model, _name##_sn, _event, _fsel1, f1, SEL_EVICT_STATE_SEL, 4), \ | |
| 987 | - | _CMN_EVENT_HNS(_model, _name##_mu, _event, _fsel1, f1, SEL_EVICT_STATE_SEL, 5), \ | |
| 988 | - | _CMN_EVENT_HNS(_model, _name##_mn, _event, _fsel1, f1, SEL_EVICT_STATE_SEL, 6) | |
| 981 | + | #define _CMN_EVENT_HNS_HBT2(_model, _name, _event, _fsel1, f1) \ | |
| 982 | + | _CMN_EVENT_HNS(_model, _name##_all, _event, _fsel1, f1, SEL_HBT_LBT_SEL, 0), \ | |
| 983 | + | _CMN_EVENT_HNS(_model, _name##_hbt, _event, _fsel1, f1, SEL_HBT_LBT_SEL, 1), \ | |
| 984 | + | _CMN_EVENT_HNS(_model, _name##_lbt, _event, _fsel1, f1, SEL_HBT_LBT_SEL, 2) | |
| 989 | 985 | ||
| 990 | 986 | #define CMN_EVENT_HNS_OCC(_model, _name, _event) \ | |
| 991 | 987 | CMN_EVENT_HN_OCC(_model, hns_##_name, CMN_TYPE_HNS, _event), \ | |
| @@ -1018,9 +1014,13 @@ static umode_t arm_cmn_event_attr_is_visible(struct kobject *kobj, | |||
| 1018 | 1014 | _CMN_EVENT_HNS(CMNS3R2, _name##_ccglcn, _event, SEL_ENHANCED_HBT_LBT_SEL, 5), \ | |
| 1019 | 1015 | _CMN_EVENT_HNS(CMNS3R2, _name##_ccgrn, _event, SEL_ENHANCED_HBT_LBT_SEL, 6) | |
| 1020 | 1016 | #define CMN_EVENT_HNS_EVICT(_model, _name, _event) \ | |
| 1021 | - | _CMN_EVENT_HNS_EVICT(_model, _name##_all, _event, SEL_HBT_LBT_SEL, 0), \ | |
| 1022 | - | _CMN_EVENT_HNS_EVICT(_model, _name##_hbt, _event, SEL_HBT_LBT_SEL, 1), \ | |
| 1023 | - | _CMN_EVENT_HNS_EVICT(_model, _name##_lbt, _event, SEL_HBT_LBT_SEL, 2) | |
| 1017 | + | _CMN_EVENT_HNS_HBT2(_model, _name##_all, _event, SEL_EVICT_STATE_SEL, 0), \ | |
| 1018 | + | _CMN_EVENT_HNS_HBT2(_model, _name##_eu, _event, SEL_EVICT_STATE_SEL, 1), \ | |
| 1019 | + | _CMN_EVENT_HNS_HBT2(_model, _name##_en, _event, SEL_EVICT_STATE_SEL, 2), \ | |
| 1020 | + | _CMN_EVENT_HNS_HBT2(_model, _name##_su, _event, SEL_EVICT_STATE_SEL, 3), \ | |
| 1021 | + | _CMN_EVENT_HNS_HBT2(_model, _name##_sn, _event, SEL_EVICT_STATE_SEL, 4), \ | |
| 1022 | + | _CMN_EVENT_HNS_HBT2(_model, _name##_mu, _event, SEL_EVICT_STATE_SEL, 5), \ | |
| 1023 | + | _CMN_EVENT_HNS_HBT2(_model, _name##_mn, _event, SEL_EVICT_STATE_SEL, 6) | |
| 1024 | 1024 | ||
| 1025 | 1025 | #define CMN_EVENT_HNSR0_HBT(_name, _event) \ | |
| 1026 | 1026 | _CMN_EVENT_HNS_HBT(CMN700 | CMNS3R01, _name, _event, SEL_HBT_LBT_SEL) | |
| @@ -1582,14 +1582,13 @@ static void arm_cmn_claim_wp_idx(struct arm_cmn_dtm *dtm, | |||
| 1582 | 1582 | ||
| 1583 | 1583 | static u32 arm_cmn_wp_config(struct perf_event *event, int wp_idx) | |
| 1584 | 1584 | { | |
| 1585 | - | struct arm_cmn *cmn = to_cmn(event->pmu); | |
| 1586 | 1585 | u32 config; | |
| 1587 | 1586 | u32 dev = CMN_EVENT_WP_DEV_SEL(event); | |
| 1588 | 1587 | u32 chn = CMN_EVENT_WP_CHN_SEL(event); | |
| 1589 | 1588 | u32 grp = CMN_EVENT_WP_GRP(event); | |
| 1590 | 1589 | u32 exc = CMN_EVENT_WP_EXCLUSIVE(event); | |
| 1591 | 1590 | u32 combine = CMN_EVENT_WP_COMBINE(event); | |
| 1592 | - | bool is_cmn600 = cmn->part == PART_CMN600; | |
| 1591 | + | bool is_cmn600 = to_cmn(event->pmu)->part == PART_CMN600; | |
| 1593 | 1592 | ||
| 1594 | 1593 | /* CMN-600 supports only primary and secondary matching groups */ | |
| 1595 | 1594 | if (is_cmn600) | |
| @@ -1597,11 +1596,8 @@ static u32 arm_cmn_wp_config(struct perf_event *event, int wp_idx) | |||
| 1597 | 1596 | ||
| 1598 | 1597 | config = FIELD_PREP(CMN_DTM_WPn_CONFIG_WP_DEV_SEL, dev) | | |
| 1599 | 1598 | FIELD_PREP(CMN_DTM_WPn_CONFIG_WP_CHN_SEL, chn) | | |
| 1600 | - | FIELD_PREP(CMN_DTM_WPn_CONFIG_WP_GRP, grp); | |
| 1601 | - | ||
| 1602 | - | if (!cmn->multi_dtm) | |
| 1603 | - | config |= FIELD_PREP(CMN_DTM_WPn_CONFIG_WP_DEV_SEL2, dev >> 1); | |
| 1604 | - | ||
| 1599 | + | FIELD_PREP(CMN_DTM_WPn_CONFIG_WP_GRP, grp) | | |
| 1600 | + | FIELD_PREP(CMN_DTM_WPn_CONFIG_WP_DEV_SEL2, dev >> 1); | |
| 1605 | 1601 | if (exc) | |
| 1606 | 1602 | config |= is_cmn600 ? CMN600_WPn_CONFIG_WP_EXCLUSIVE : | |
| 1607 | 1603 | CMN_DTM_WPn_CONFIG_WP_EXCLUSIVE; | |
| @@ -1860,12 +1856,10 @@ static void arm_cmn_val_add_event(struct arm_cmn *cmn, struct arm_cmn_val *val, | |||
| 1860 | 1856 | ||
| 1861 | 1857 | val->dtm_count[dtm]++; | |
| 1862 | 1858 | ||
| 1863 | - | if (sel == SEL_EVICT_STATE_SEL) { | |
| 1864 | - | val->filter[dtm][sel] = CMN_EVENT_FILTER2(event) + 1; | |
| 1865 | - | sel = SEL_HBT_LBT_SEL; | |
| 1866 | - | } | |
| 1867 | 1859 | if (sel) | |
| 1868 | 1860 | val->filter[dtm][sel] = CMN_EVENT_FILTER(event) + 1; | |
| 1861 | + | if (sel == SEL_EVICT_STATE_SEL) | |
| 1862 | + | val->filter[dtm][SEL_HBT_LBT_SEL] = CMN_EVENT_FILTER2(event) + 1; | |
| 1869 | 1863 | ||
| 1870 | 1864 | if (type != CMN_TYPE_WP) | |
| 1871 | 1865 | continue; | |
| @@ -1916,17 +1910,14 @@ static int arm_cmn_validate_group(struct arm_cmn *cmn, struct perf_event *event) | |||
| 1916 | 1910 | if (val->dtm_count[dtm] == CMN_DTM_NUM_COUNTERS) | |
| 1917 | 1911 | goto done; | |
| 1918 | 1912 | ||
| 1919 | - | if (sel == SEL_EVICT_STATE_SEL) { | |
| 1920 | - | if (val->filter[dtm][sel] && | |
| 1921 | - | val->filter[dtm][sel] != CMN_EVENT_FILTER2(event) + 1) | |
| 1922 | - | goto done; | |
| 1923 | - | sel = SEL_HBT_LBT_SEL; | |
| 1924 | - | } | |
| 1925 | - | ||
| 1926 | 1913 | if (sel && val->filter[dtm][sel] && | |
| 1927 | 1914 | val->filter[dtm][sel] != CMN_EVENT_FILTER(event) + 1) | |
| 1928 | 1915 | goto done; | |
| 1929 | 1916 | ||
| 1917 | + | if (sel == SEL_EVICT_STATE_SEL && val->filter[dtm][SEL_HBT_LBT_SEL] && | |
| 1918 | + | val->filter[dtm][SEL_HBT_LBT_SEL] != CMN_EVENT_FILTER2(event) + 1) | |
| 1919 | + | goto done; | |
| 1920 | + | ||
| 1930 | 1921 | if (type != CMN_TYPE_WP) | |
| 1931 | 1922 | continue; | |
| 1932 | 1923 | ||
| @@ -1955,7 +1946,7 @@ static enum cmn_filter_select arm_cmn_event_filter(const struct arm_cmn *cmn, | |||
| 1955 | 1946 | for (int i = 0; i < ARRAY_SIZE(arm_cmn_event_attrs) - 1; i++) { | |
| 1956 | 1947 | e = container_of(arm_cmn_event_attrs[i], typeof(*e), attr.attr); | |
| 1957 | 1948 | if (e->model & model && e->type == type && e->eventid == eventid) | |
| 1958 | - | return e->filter[1].sel ?: e->filter[0].sel; | |
| 1949 | + | return e->filter[0].sel; | |
| 1959 | 1950 | } | |
| 1960 | 1951 | return SEL_NONE; | |
| 1961 | 1952 | } | |
| @@ -2086,21 +2077,16 @@ static void arm_cmn_event_clear(struct arm_cmn *cmn, struct perf_event *event, | |||
| 2086 | 2077 | static int arm_cmn_set_event_filter(struct arm_cmn_node *dn, struct perf_event *event) | |
| 2087 | 2078 | { | |
| 2088 | 2079 | enum cmn_filter_select fsel = to_cmn_hw(event)->filter_sel; | |
| 2089 | - | bool evict_state = fsel == SEL_EVICT_STATE_SEL; | |
| 2090 | 2080 | int ret = 0; | |
| 2091 | 2081 | ||
| 2092 | - | if (evict_state) { | |
| 2093 | - | ret = arm_cmn_set_event_sel_hi(dn, fsel, CMN_EVENT_FILTER2(event)); | |
| 2094 | - | if (ret) | |
| 2095 | - | return ret; | |
| 2096 | - | fsel = SEL_HBT_LBT_SEL; | |
| 2097 | - | } | |
| 2098 | 2082 | if (fsel) | |
| 2099 | 2083 | ret = arm_cmn_set_event_sel_hi(dn, fsel, CMN_EVENT_FILTER(event)); | |
| 2100 | 2084 | ||
| 2101 | - | if (ret && evict_state) | |
| 2102 | - | dn->filter[SEL_EVICT_STATE_SEL].count--; | |
| 2103 | - | ||
| 2085 | + | if (fsel == SEL_EVICT_STATE_SEL && !ret) { | |
| 2086 | + | ret = arm_cmn_set_event_sel_hi(dn, SEL_HBT_LBT_SEL, CMN_EVENT_FILTER2(event)); | |
| 2087 | + | if (ret) | |
| 2088 | + | dn->filter[fsel].count--; | |
| 2089 | + | } | |
| 2104 | 2090 | return ret; | |
| 2105 | 2091 | } | |
| 2106 | 2092 | ||
modified drivers/perf/arm_brbe.c
| @@ -604,7 +604,7 @@ static bool perf_entry_from_brbe_regset(int index, struct perf_branch_entry *ent | |||
| 604 | 604 | return false; | |
| 605 | 605 | ||
| 606 | 606 | brbinf = bregs.brbinf; | |
| 607 | - | *entry = (struct perf_branch_entry){ }; | |
| 607 | + | perf_clear_branch_entry_bitfields(entry); | |
| 608 | 608 | if (brbe_record_is_complete(brbinf)) { | |
| 609 | 609 | entry->from = bregs.brbsrc; | |
| 610 | 610 | entry->to = bregs.brbtgt; | |
modified drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c
| @@ -36,7 +36,7 @@ mtk_phy_tmds_clk_ratio(struct mtk_hdmi_phy *hdmi_phy, bool enable) | |||
| 36 | 36 | * clock bit ratio 1:40, under 3.4Gbps, clock bit ratio 1:10 | |
| 37 | 37 | */ | |
| 38 | 38 | if (enable) | |
| 39 | - | mtk_phy_update_field(regs + HDMI20_CLK_CFG, REG_TXC_DIV, VAL_TXC_DIV4); | |
| 39 | + | mtk_phy_update_field(regs + HDMI20_CLK_CFG, REG_TXC_DIV, 3); | |
| 40 | 40 | else | |
| 41 | 41 | mtk_phy_clear_bits(regs + HDMI20_CLK_CFG, REG_TXC_DIV); | |
| 42 | 42 | } | |
| @@ -290,7 +290,7 @@ static int mtk_hdmi_pll_calc(struct mtk_hdmi_phy *hdmi_phy, struct clk_hw *hw, | |||
| 290 | 290 | posdiv2 = 1; | |
| 291 | 291 | ||
| 292 | 292 | /* Digital clk divider, max /32 */ | |
| 293 | - | digital_div = div64_u64(ns_hdmipll_ck, posdiv1 * posdiv2 * pixel_clk); | |
| 293 | + | digital_div = div_u64(ns_hdmipll_ck, posdiv1 * posdiv2 * pixel_clk); | |
| 294 | 294 | if (!(digital_div <= 32 && digital_div >= 1)) | |
| 295 | 295 | return -EINVAL; | |
| 296 | 296 | ||
modified drivers/phy/mediatek/phy-mtk-hdmi-mt8195.h
| @@ -17,9 +17,6 @@ | |||
| 17 | 17 | ||
| 18 | 18 | #define HDMI20_CLK_CFG 0x70 | |
| 19 | 19 | #define REG_TXC_DIV GENMASK(31, 30) | |
| 20 | - | #define VAL_TXC_DIV2 1 | |
| 21 | - | #define VAL_TXC_DIV4 2 | |
| 22 | - | #define VAL_TXC_DIV8 3 | |
| 23 | 20 | ||
| 24 | 21 | #define HDMI_1_CFG_0 0x00 | |
| 25 | 22 | #define RG_HDMITX21_DRV_IBIAS_CLK GENMASK(10, 5) | |
modified drivers/phy/renesas/phy-rcar-gen3-usb2.c
| @@ -27,7 +27,6 @@ | |||
| 27 | 27 | #include <linux/reset.h> | |
| 28 | 28 | #include <linux/string.h> | |
| 29 | 29 | #include <linux/usb/of.h> | |
| 30 | - | #include <linux/wait.h> | |
| 31 | 30 | #include <linux/workqueue.h> | |
| 32 | 31 | ||
| 33 | 32 | /******* USB2.0 Host registers (original offset is +0x200) *******/ | |
| @@ -107,13 +106,6 @@ | |||
| 107 | 106 | /* RZ/G2L specific */ | |
| 108 | 107 | #define USB2_LINECTRL1_USB2_IDMON BIT(0) | |
| 109 | 108 | ||
| 110 | - | /* | |
| 111 | - | * The OTG initialization is expected to finish in 20ms. Choose a large enough | |
| 112 | - | * timeout to avoid waiters exit prematurely the waiting section under heavy | |
| 113 | - | * CPU load. | |
| 114 | - | */ | |
| 115 | - | #define USB2_OTG_INIT_TIMEOUT msecs_to_jiffies(120) | |
| 116 | - | ||
| 117 | 109 | #define NUM_OF_PHYS 4 | |
| 118 | 110 | enum rcar_gen3_phy_index { | |
| 119 | 111 | PHY_INDEX_BOTH_HC, | |
| @@ -146,20 +138,12 @@ struct rcar_gen3_chan { | |||
| 146 | 138 | struct rcar_gen3_phy rphys[NUM_OF_PHYS]; | |
| 147 | 139 | struct regulator *vbus; | |
| 148 | 140 | struct work_struct work; | |
| 149 | - | wait_queue_head_t otg_init_done; | |
| 150 | 141 | spinlock_t lock; /* protects access to hardware and driver data structure. */ | |
| 151 | 142 | enum usb_dr_mode dr_mode; | |
| 152 | 143 | bool extcon_host; | |
| 153 | 144 | bool is_otg_channel; | |
| 154 | 145 | bool uses_otg_pins; | |
| 155 | 146 | bool otg_internal_reg; | |
| 156 | - | /* | |
| 157 | - | * The OTG can be initialized only once and needs to release the spinlock | |
| 158 | - | * and wait for 20 ms due to hardware constraints. If a thread executes | |
| 159 | - | * PHY configuration code while the OTG PHY is waiting for the 20 ms, the | |
| 160 | - | * thread will have to wait for the OTG PHY initialization to complete. | |
| 161 | - | */ | |
| 162 | - | bool otg_initializing; | |
| 163 | 147 | }; | |
| 164 | 148 | ||
| 165 | 149 | struct rcar_gen3_phy_drv_data { | |
| @@ -408,58 +392,26 @@ static ssize_t role_store(struct device *dev, struct device_attribute *attr, | |||
| 408 | 392 | struct rcar_gen3_chan *ch = dev_get_drvdata(dev); | |
| 409 | 393 | bool is_b_device; | |
| 410 | 394 | enum phy_mode cur_mode, new_mode; | |
| 411 | - | int retries = NUM_OF_PHYS; | |
| 412 | - | unsigned long flags; | |
| 413 | - | int ret = -EIO; | |
| 414 | - | ||
| 415 | - | spin_lock_irqsave(&ch->lock, flags); | |
| 416 | - | ||
| 417 | - | if (!ch->is_otg_channel) | |
| 418 | - | goto unlock; | |
| 419 | 395 | ||
| 420 | - | while (retries-- && ch->otg_initializing) { | |
| 421 | - | spin_unlock_irqrestore(&ch->lock, flags); | |
| 422 | - | ||
| 423 | - | ret = wait_event_timeout(ch->otg_init_done, !ch->otg_initializing, | |
| 424 | - | USB2_OTG_INIT_TIMEOUT); | |
| 425 | - | ret = ret ? 0 : -ETIMEDOUT; | |
| 426 | - | if (ret && !retries) | |
| 427 | - | goto exit; | |
| 428 | - | ||
| 429 | - | spin_lock_irqsave(&ch->lock, flags); | |
| 430 | - | } | |
| 431 | - | ||
| 432 | - | /* If another thread started a new initialization just return -EBUSY. */ | |
| 433 | - | if (ch->otg_initializing) { | |
| 434 | - | ret = -EBUSY; | |
| 435 | - | goto unlock; | |
| 436 | - | } else { | |
| 437 | - | ret = 0; | |
| 438 | - | } | |
| 396 | + | guard(spinlock_irqsave)(&ch->lock); | |
| 439 | 397 | ||
| 440 | - | if (!rcar_gen3_is_any_otg_rphy_initialized(ch)) { | |
| 441 | - | ret = -EIO; | |
| 442 | - | goto unlock; | |
| 443 | - | } | |
| 398 | + | if (!ch->is_otg_channel || !rcar_gen3_is_any_otg_rphy_initialized(ch)) | |
| 399 | + | return -EIO; | |
| 444 | 400 | ||
| 445 | - | if (sysfs_streq(buf, "host")) { | |
| 401 | + | if (sysfs_streq(buf, "host")) | |
| 446 | 402 | new_mode = PHY_MODE_USB_HOST; | |
| 447 | - | } else if (sysfs_streq(buf, "peripheral")) { | |
| 403 | + | else if (sysfs_streq(buf, "peripheral")) | |
| 448 | 404 | new_mode = PHY_MODE_USB_DEVICE; | |
| 449 | - | } else { | |
| 450 | - | ret = -EINVAL; | |
| 451 | - | goto unlock; | |
| 452 | - | } | |
| 405 | + | else | |
| 406 | + | return -EINVAL; | |
| 453 | 407 | ||
| 454 | 408 | /* is_b_device: true is B-Device. false is A-Device. */ | |
| 455 | 409 | is_b_device = rcar_gen3_check_id(ch); | |
| 456 | 410 | cur_mode = rcar_gen3_get_phy_mode(ch); | |
| 457 | 411 | ||
| 458 | 412 | /* If current and new mode is the same, this returns the error */ | |
| 459 | - | if (cur_mode == new_mode) { | |
| 460 | - | ret = -EINVAL; | |
| 461 | - | goto unlock; | |
| 462 | - | } | |
| 413 | + | if (cur_mode == new_mode) | |
| 414 | + | return -EINVAL; | |
| 463 | 415 | ||
| 464 | 416 | if (new_mode == PHY_MODE_USB_HOST) { /* And is_host must be false */ | |
| 465 | 417 | if (!is_b_device) /* A-Peripheral */ | |
| @@ -473,10 +425,7 @@ static ssize_t role_store(struct device *dev, struct device_attribute *attr, | |||
| 473 | 425 | rcar_gen3_init_for_peri(ch); | |
| 474 | 426 | } | |
| 475 | 427 | ||
| 476 | - | unlock: | |
| 477 | - | spin_unlock_irqrestore(&ch->lock, flags); | |
| 478 | - | exit: | |
| 479 | - | return ret ?: count; | |
| 428 | + | return count; | |
| 480 | 429 | } | |
| 481 | 430 | ||
| 482 | 431 | static ssize_t role_show(struct device *dev, struct device_attribute *attr, | |
| @@ -492,11 +441,14 @@ static ssize_t role_show(struct device *dev, struct device_attribute *attr, | |||
| 492 | 441 | } | |
| 493 | 442 | static DEVICE_ATTR_RW(role); | |
| 494 | 443 | ||
| 495 | - | static void rcar_gen3_init_otg_phase0(struct rcar_gen3_chan *ch) | |
| 444 | + | static void rcar_gen3_init_otg(struct rcar_gen3_chan *ch) | |
| 496 | 445 | { | |
| 497 | 446 | void __iomem *usb2_base = ch->base; | |
| 498 | 447 | u32 val; | |
| 499 | 448 | ||
| 449 | + | if (!ch->is_otg_channel || rcar_gen3_is_any_otg_rphy_initialized(ch)) | |
| 450 | + | return; | |
| 451 | + | ||
| 500 | 452 | /* Should not use functions of read-modify-write a register */ | |
| 501 | 453 | val = readl(usb2_base + USB2_LINECTRL1); | |
| 502 | 454 | val = (val & ~USB2_LINECTRL1_DP_RPD) | USB2_LINECTRL1_DPRPD_EN | | |
| @@ -519,11 +471,7 @@ static void rcar_gen3_init_otg_phase0(struct rcar_gen3_chan *ch) | |||
| 519 | 471 | writel(val | USB2_ADPCTRL_IDPULLUP, usb2_base + USB2_ADPCTRL); | |
| 520 | 472 | } | |
| 521 | 473 | } | |
| 522 | - | } | |
| 523 | - | ||
| 524 | - | static void rcar_gen3_init_otg_phase1(struct rcar_gen3_chan *ch) | |
| 525 | - | { | |
| 526 | - | void __iomem *usb2_base = ch->base; | |
| 474 | + | mdelay(20); | |
| 527 | 475 | ||
| 528 | 476 | writel(0xffffffff, usb2_base + USB2_OBINTSTA); | |
| 529 | 477 | writel(ch->phy_data->obint_enable_bits, usb2_base + USB2_OBINTEN); | |
| @@ -554,7 +502,6 @@ static irqreturn_t rcar_gen3_phy_usb2_irq(int irq, void *_ch) | |||
| 554 | 502 | void __iomem *usb2_base = ch->base; | |
| 555 | 503 | struct device *dev = ch->dev; | |
| 556 | 504 | irqreturn_t ret = IRQ_NONE; | |
| 557 | - | unsigned long flags; | |
| 558 | 505 | u32 status; | |
| 559 | 506 | ||
| 560 | 507 | pm_runtime_get_noresume(dev); | |
| @@ -562,102 +509,33 @@ static irqreturn_t rcar_gen3_phy_usb2_irq(int irq, void *_ch) | |||
| 562 | 509 | if (pm_runtime_suspended(dev)) | |
| 563 | 510 | goto rpm_put; | |
| 564 | 511 | ||
| 565 | - | spin_lock_irqsave(&ch->lock, flags); | |
| 566 | - | ||
| 567 | - | status = readl(usb2_base + USB2_OBINTSTA); | |
| 568 | - | if (status & ch->phy_data->obint_enable_bits) { | |
| 569 | - | dev_vdbg(dev, "%s: %08x\n", __func__, status); | |
| 570 | - | if (ch->phy_data->vblvl_ctrl) | |
| 571 | - | writel(USB2_OBINTSTA_CLEAR, usb2_base + USB2_OBINTSTA); | |
| 572 | - | else | |
| 573 | - | writel(ch->phy_data->obint_enable_bits, usb2_base + USB2_OBINTSTA); | |
| 574 | - | ||
| 575 | - | ret = IRQ_HANDLED; | |
| 576 | - | ||
| 577 | - | /* This should not happen! */ | |
| 578 | - | if (ch->otg_initializing) | |
| 579 | - | goto unlock; | |
| 580 | - | ||
| 581 | - | rcar_gen3_device_recognition(ch); | |
| 582 | - | rcar_gen3_configure_vblvl_ctrl(ch); | |
| 512 | + | scoped_guard(spinlock, &ch->lock) { | |
| 513 | + | status = readl(usb2_base + USB2_OBINTSTA); | |
| 514 | + | if (status & ch->phy_data->obint_enable_bits) { | |
| 515 | + | dev_vdbg(dev, "%s: %08x\n", __func__, status); | |
| 516 | + | if (ch->phy_data->vblvl_ctrl) | |
| 517 | + | writel(USB2_OBINTSTA_CLEAR, usb2_base + USB2_OBINTSTA); | |
| 518 | + | else | |
| 519 | + | writel(ch->phy_data->obint_enable_bits, usb2_base + USB2_OBINTSTA); | |
| 520 | + | rcar_gen3_device_recognition(ch); | |
| 521 | + | rcar_gen3_configure_vblvl_ctrl(ch); | |
| 522 | + | ret = IRQ_HANDLED; | |
| 523 | + | } | |
| 583 | 524 | } | |
| 584 | 525 | ||
| 585 | - | unlock: | |
| 586 | - | spin_unlock_irqrestore(&ch->lock, flags); | |
| 587 | 526 | rpm_put: | |
| 588 | 527 | pm_runtime_put_noidle(dev); | |
| 589 | 528 | return ret; | |
| 590 | 529 | } | |
| 591 | 530 | ||
| 592 | - | static void rcar_gen3_phy_usb2_irqs_mask_all(struct rcar_gen3_chan *channel, | |
| 593 | - | u32 *masked_irqs_bits) | |
| 594 | - | { | |
| 595 | - | u32 val, bitmask = USB2_INT_ENABLE_UCOM_INTEN; | |
| 596 | - | void __iomem *usb2_base = channel->base; | |
| 597 | - | ||
| 598 | - | for (unsigned int i = 0; i < NUM_OF_PHYS; i++) | |
| 599 | - | bitmask |= channel->rphys[i].int_enable_bits; | |
| 600 | - | ||
| 601 | - | val = readl(usb2_base + USB2_INT_ENABLE); | |
| 602 | - | *masked_irqs_bits = val & bitmask; | |
| 603 | - | val &= ~bitmask; | |
| 604 | - | writel(val, usb2_base + USB2_INT_ENABLE); | |
| 605 | - | ||
| 606 | - | /* | |
| 607 | - | * Don't report channel->phy_data->obint_enable_bits IRQs. These are | |
| 608 | - | * unmasked anyway in rcar_gen3_init_otg_phase1(). | |
| 609 | - | */ | |
| 610 | - | val = readl(usb2_base + USB2_OBINTEN); | |
| 611 | - | val &= ~channel->phy_data->obint_enable_bits; | |
| 612 | - | writel(val, usb2_base + USB2_OBINTEN); | |
| 613 | - | } | |
| 614 | - | ||
| 615 | - | static void rcar_gen3_phy_usb2_irqs_unmask(struct rcar_gen3_chan *channel, | |
| 616 | - | u32 irqs_bits) | |
| 617 | - | { | |
| 618 | - | u32 val, bitmask = USB2_INT_ENABLE_UCOM_INTEN; | |
| 619 | - | void __iomem *usb2_base = channel->base; | |
| 620 | - | ||
| 621 | - | for (unsigned int i = 0; i < NUM_OF_PHYS; i++) | |
| 622 | - | bitmask |= channel->rphys[i].int_enable_bits; | |
| 623 | - | ||
| 624 | - | val = readl(usb2_base + USB2_INT_ENABLE); | |
| 625 | - | val &= ~bitmask; | |
| 626 | - | val |= irqs_bits; | |
| 627 | - | writel(val, usb2_base + USB2_INT_ENABLE); | |
| 628 | - | } | |
| 629 | - | ||
| 630 | 531 | static int rcar_gen3_phy_usb2_init(struct phy *p) | |
| 631 | 532 | { | |
| 632 | 533 | struct rcar_gen3_phy *rphy = phy_get_drvdata(p); | |
| 633 | 534 | struct rcar_gen3_chan *channel = rphy->ch; | |
| 634 | 535 | void __iomem *usb2_base = channel->base; | |
| 635 | - | int retries = NUM_OF_PHYS; | |
| 636 | - | unsigned long flags; | |
| 637 | 536 | u32 val; | |
| 638 | - | int ret; | |
| 639 | - | ||
| 640 | - | spin_lock_irqsave(&channel->lock, flags); | |
| 641 | 537 | ||
| 642 | - | while (retries-- && channel->otg_initializing) { | |
| 643 | - | spin_unlock_irqrestore(&channel->lock, flags); | |
| 644 | - | ||
| 645 | - | ret = wait_event_timeout(channel->otg_init_done, !channel->otg_initializing, | |
| 646 | - | USB2_OTG_INIT_TIMEOUT); | |
| 647 | - | ret = ret ? 0 : -ETIMEDOUT; | |
| 648 | - | if (ret && !retries) | |
| 649 | - | return ret; | |
| 650 | - | ||
| 651 | - | spin_lock_irqsave(&channel->lock, flags); | |
| 652 | - | } | |
| 653 | - | ||
| 654 | - | /* If another thread started a new initialization just return -EBUSY. */ | |
| 655 | - | if (channel->otg_initializing) { | |
| 656 | - | ret = -EBUSY; | |
| 657 | - | goto unlock; | |
| 658 | - | } else { | |
| 659 | - | ret = 0; | |
| 660 | - | } | |
| 538 | + | guard(spinlock_irqsave)(&channel->lock); | |
| 661 | 539 | ||
| 662 | 540 | /* Initialize USB2 part */ | |
| 663 | 541 | val = readl(usb2_base + USB2_INT_ENABLE); | |
| @@ -670,23 +548,8 @@ static int rcar_gen3_phy_usb2_init(struct phy *p) | |||
| 670 | 548 | } | |
| 671 | 549 | ||
| 672 | 550 | /* Initialize otg part (only if we initialize a PHY with IRQs). */ | |
| 673 | - | if (rphy->int_enable_bits && channel->is_otg_channel && | |
| 674 | - | !rcar_gen3_is_any_otg_rphy_initialized(channel)) { | |
| 675 | - | u32 masked_irq_bits = 0; | |
| 676 | - | ||
| 677 | - | rcar_gen3_init_otg_phase0(channel); | |
| 678 | - | rcar_gen3_phy_usb2_irqs_mask_all(channel, &masked_irq_bits); | |
| 679 | - | channel->otg_initializing = true; | |
| 680 | - | spin_unlock_irqrestore(&channel->lock, flags); | |
| 681 | - | ||
| 682 | - | fsleep(20000); | |
| 683 | - | ||
| 684 | - | spin_lock_irqsave(&channel->lock, flags); | |
| 685 | - | rcar_gen3_phy_usb2_irqs_unmask(channel, masked_irq_bits); | |
| 686 | - | rcar_gen3_init_otg_phase1(channel); | |
| 687 | - | channel->otg_initializing = false; | |
| 688 | - | wake_up_all(&channel->otg_init_done); | |
| 689 | - | } | |
| 551 | + | if (rphy->int_enable_bits) | |
| 552 | + | rcar_gen3_init_otg(channel); | |
| 690 | 553 | ||
| 691 | 554 | if (channel->phy_data->vblvl_ctrl) { | |
| 692 | 555 | /* SIDDQ mode release */ | |
| @@ -705,10 +568,7 @@ static int rcar_gen3_phy_usb2_init(struct phy *p) | |||
| 705 | 568 | ||
| 706 | 569 | rphy->initialized = true; | |
| 707 | 570 | ||
| 708 | - | unlock: | |
| 709 | - | spin_unlock_irqrestore(&channel->lock, flags); | |
| 710 | - | ||
| 711 | - | return ret; | |
| 571 | + | return 0; | |
| 712 | 572 | } | |
| 713 | 573 | ||
| 714 | 574 | static int rcar_gen3_phy_usb2_exit(struct phy *p) | |
| @@ -716,32 +576,9 @@ static int rcar_gen3_phy_usb2_exit(struct phy *p) | |||
| 716 | 576 | struct rcar_gen3_phy *rphy = phy_get_drvdata(p); | |
| 717 | 577 | struct rcar_gen3_chan *channel = rphy->ch; | |
| 718 | 578 | void __iomem *usb2_base = channel->base; | |
| 719 | - | int retries = NUM_OF_PHYS; | |
| 720 | - | unsigned long flags; | |
| 721 | 579 | u32 val; | |
| 722 | - | int ret; | |
| 723 | - | ||
| 724 | - | spin_lock_irqsave(&channel->lock, flags); | |
| 725 | - | ||
| 726 | - | while (retries-- && channel->otg_initializing) { | |
| 727 | - | spin_unlock_irqrestore(&channel->lock, flags); | |
| 728 | - | ||
| 729 | - | ret = wait_event_timeout(channel->otg_init_done, !channel->otg_initializing, | |
| 730 | - | USB2_OTG_INIT_TIMEOUT); | |
| 731 | - | ret = ret ? 0 : -ETIMEDOUT; | |
| 732 | - | if (ret && !retries) | |
| 733 | - | return ret; | |
| 734 | - | ||
| 735 | - | spin_lock_irqsave(&channel->lock, flags); | |
| 736 | - | } | |
| 737 | 580 | ||
| 738 | - | /* If another thread started a new initialization just return -EBUSY. */ | |
| 739 | - | if (channel->otg_initializing) { | |
| 740 | - | ret = -EBUSY; | |
| 741 | - | goto unlock; | |
| 742 | - | } else { | |
| 743 | - | ret = 0; | |
| 744 | - | } | |
| 581 | + | guard(spinlock_irqsave)(&channel->lock); | |
| 745 | 582 | ||
| 746 | 583 | rphy->initialized = false; | |
| 747 | 584 | ||
| @@ -751,9 +588,7 @@ static int rcar_gen3_phy_usb2_exit(struct phy *p) | |||
| 751 | 588 | val &= ~USB2_INT_ENABLE_UCOM_INTEN; | |
| 752 | 589 | writel(val, usb2_base + USB2_INT_ENABLE); | |
| 753 | 590 | ||
| 754 | - | unlock: | |
| 755 | - | spin_unlock_irqrestore(&channel->lock, flags); | |
| 756 | - | return ret; | |
| 591 | + | return 0; | |
| 757 | 592 | } | |
| 758 | 593 | ||
| 759 | 594 | static int rcar_gen3_phy_usb2_power_on(struct phy *p) | |
| @@ -761,10 +596,8 @@ static int rcar_gen3_phy_usb2_power_on(struct phy *p) | |||
| 761 | 596 | struct rcar_gen3_phy *rphy = phy_get_drvdata(p); | |
| 762 | 597 | struct rcar_gen3_chan *channel = rphy->ch; | |
| 763 | 598 | void __iomem *usb2_base = channel->base; | |
| 764 | - | int retries = NUM_OF_PHYS; | |
| 765 | - | unsigned long flags; | |
| 766 | 599 | u32 val; | |
| 767 | - | int ret; | |
| 600 | + | int ret = 0; | |
| 768 | 601 | ||
| 769 | 602 | if (channel->vbus && !channel->otg_internal_reg) { | |
| 770 | 603 | ret = regulator_enable(channel->vbus); | |
| @@ -772,27 +605,7 @@ static int rcar_gen3_phy_usb2_power_on(struct phy *p) | |||
| 772 | 605 | return ret; | |
| 773 | 606 | } | |
| 774 | 607 | ||
| 775 | - | spin_lock_irqsave(&channel->lock, flags); | |
| 776 | - | ||
| 777 | - | while (retries-- && channel->otg_initializing) { | |
| 778 | - | spin_unlock_irqrestore(&channel->lock, flags); | |
| 779 | - | ||
| 780 | - | ret = wait_event_timeout(channel->otg_init_done, !channel->otg_initializing, | |
| 781 | - | USB2_OTG_INIT_TIMEOUT); | |
| 782 | - | ret = ret ? 0 : -ETIMEDOUT; | |
| 783 | - | if (ret && !retries) | |
| 784 | - | goto disable_regulator; | |
| 785 | - | ||
| 786 | - | spin_lock_irqsave(&channel->lock, flags); | |
| 787 | - | } | |
| 788 | - | ||
| 789 | - | /* If another thread started a new initialization just return -EBUSY. */ | |
| 790 | - | if (channel->otg_initializing) { | |
| 791 | - | ret = -EBUSY; | |
| 792 | - | goto unlock; | |
| 793 | - | } else { | |
| 794 | - | ret = 0; | |
| 795 | - | } | |
| 608 | + | guard(spinlock_irqsave)(&channel->lock); | |
| 796 | 609 | ||
| 797 | 610 | if (!rcar_gen3_are_all_rphys_power_off(channel)) | |
| 798 | 611 | goto out; | |
| @@ -807,59 +620,27 @@ out: | |||
| 807 | 620 | /* The powered flag should be set for any other phys anyway */ | |
| 808 | 621 | rphy->powered = true; | |
| 809 | 622 | ||
| 810 | - | unlock: | |
| 811 | - | spin_unlock_irqrestore(&channel->lock, flags); | |
| 812 | - | ||
| 813 | - | disable_regulator: | |
| 814 | - | if (ret && channel->vbus && !channel->otg_internal_reg) | |
| 815 | - | regulator_disable(channel->vbus); | |
| 816 | - | ||
| 817 | - | return ret; | |
| 623 | + | return 0; | |
| 818 | 624 | } | |
| 819 | 625 | ||
| 820 | 626 | static int rcar_gen3_phy_usb2_power_off(struct phy *p) | |
| 821 | 627 | { | |
| 822 | 628 | struct rcar_gen3_phy *rphy = phy_get_drvdata(p); | |
| 823 | 629 | struct rcar_gen3_chan *channel = rphy->ch; | |
| 824 | - | int retries = NUM_OF_PHYS; | |
| 825 | - | unsigned long flags; | |
| 826 | - | int ret; | |
| 827 | - | ||
| 828 | - | spin_lock_irqsave(&channel->lock, flags); | |
| 829 | - | ||
| 830 | - | while (retries-- && channel->otg_initializing) { | |
| 831 | - | spin_unlock_irqrestore(&channel->lock, flags); | |
| 832 | - | ||
| 833 | - | ret = wait_event_timeout(channel->otg_init_done, !channel->otg_initializing, | |
| 834 | - | USB2_OTG_INIT_TIMEOUT); | |
| 835 | - | ret = ret ? 0 : -ETIMEDOUT; | |
| 836 | - | if (ret && !retries) | |
| 837 | - | return ret; | |
| 838 | - | ||
| 839 | - | spin_lock_irqsave(&channel->lock, flags); | |
| 840 | - | } | |
| 841 | - | ||
| 842 | - | /* If another thread started a new initialization just return -EBUSY. */ | |
| 843 | - | if (channel->otg_initializing) { | |
| 844 | - | ret = -EBUSY; | |
| 845 | - | goto unlock; | |
| 846 | - | } else { | |
| 847 | - | ret = 0; | |
| 848 | - | } | |
| 630 | + | int ret = 0; | |
| 849 | 631 | ||
| 850 | - | rphy->powered = false; | |
| 632 | + | scoped_guard(spinlock_irqsave, &channel->lock) { | |
| 633 | + | rphy->powered = false; | |
| 851 | 634 | ||
| 852 | - | if (rcar_gen3_are_all_rphys_power_off(channel)) { | |
| 853 | - | u32 val = readl(channel->base + USB2_USBCTR); | |
| 635 | + | if (rcar_gen3_are_all_rphys_power_off(channel)) { | |
| 636 | + | u32 val = readl(channel->base + USB2_USBCTR); | |
| 854 | 637 | ||
| 855 | - | val |= USB2_USBCTR_PLL_RST; | |
| 856 | - | writel(val, channel->base + USB2_USBCTR); | |
| 638 | + | val |= USB2_USBCTR_PLL_RST; | |
| 639 | + | writel(val, channel->base + USB2_USBCTR); | |
| 640 | + | } | |
| 857 | 641 | } | |
| 858 | 642 | ||
| 859 | - | unlock: | |
| 860 | - | spin_unlock_irqrestore(&channel->lock, flags); | |
| 861 | - | ||
| 862 | - | if (!ret && channel->vbus && !channel->otg_internal_reg) | |
| 643 | + | if (channel->vbus && !channel->otg_internal_reg) | |
| 863 | 644 | ret = regulator_disable(channel->vbus); | |
| 864 | 645 | ||
| 865 | 646 | return ret; | |
| @@ -1241,7 +1022,6 @@ static int rcar_gen3_phy_usb2_probe(struct platform_device *pdev) | |||
| 1241 | 1022 | return ret; | |
| 1242 | 1023 | ||
| 1243 | 1024 | spin_lock_init(&channel->lock); | |
| 1244 | - | init_waitqueue_head(&channel->otg_init_done); | |
| 1245 | 1025 | for (i = 0; i < NUM_OF_PHYS; i++) { | |
| 1246 | 1026 | channel->rphys[i].phy = devm_phy_create(dev, NULL, | |
| 1247 | 1027 | channel->phy_data->phy_usb2_ops); | |
modified drivers/pinctrl/meson/pinctrl-meson-s4.c
| @@ -854,7 +854,7 @@ static const char * const i2c1_groups[] = { | |||
| 854 | 854 | static const char * const i2c2_groups[] = { | |
| 855 | 855 | "i2c2_sda_d", "i2c2_scl_d", | |
| 856 | 856 | "i2c2_sda_h8", "i2c2_scl_h9", | |
| 857 | - | "i2c2_sda_h0", "i2c2_scl_h1", | |
| 857 | + | "i2c2_sda_h0", "i2c2_scl_h1l," | |
| 858 | 858 | }; | |
| 859 | 859 | ||
| 860 | 860 | static const char * const i2c3_groups[] = { | |
modified drivers/pinctrl/microchip/pinctrl-mpfs-mssio.c
| @@ -86,7 +86,7 @@ static struct mpfs_pinctrl_bank_voltage mpfs_pinctrl_bank_voltages[8] = { | |||
| 86 | 86 | { .uv = 1800000, .val = 4 }, | |
| 87 | 87 | { .uv = 2500000, .val = 6 }, | |
| 88 | 88 | { .uv = 3300000, .val = 8 }, | |
| 89 | - | { .uv = 0, .val = 0xf }, // pin unused | |
| 89 | + | { .uv = 0, .val = 0x3f }, // pin unused | |
| 90 | 90 | }; | |
| 91 | 91 | ||
| 92 | 92 | static int mpfs_pinctrl_get_drive_strength_ma(u32 drive_strength) | |
| @@ -156,10 +156,10 @@ static void mpfs_pinctrl_set_bank_voltage(struct mpfs_pinctrl *pctrl, unsigned i | |||
| 156 | 156 | u32 val = FIELD_PREP(MPFS_PINCTRL_BANK_VOLTAGE_MASK, bank_voltage); | |
| 157 | 157 | ||
| 158 | 158 | if (pin < MPFS_PINCTRL_BANK2_START) | |
| 159 | - | regmap_update_bits(pctrl->sysreg_regmap, MPFS_PINCTRL_MSSIO_BANK4_CFG_CR, | |
| 159 | + | regmap_assign_bits(pctrl->sysreg_regmap, MPFS_PINCTRL_MSSIO_BANK4_CFG_CR, | |
| 160 | 160 | MPFS_PINCTRL_BANK_VOLTAGE_MASK, val); | |
| 161 | 161 | else | |
| 162 | - | regmap_update_bits(pctrl->sysreg_regmap, MPFS_PINCTRL_MSSIO_BANK2_CFG_CR, | |
| 162 | + | regmap_assign_bits(pctrl->sysreg_regmap, MPFS_PINCTRL_MSSIO_BANK2_CFG_CR, | |
| 163 | 163 | MPFS_PINCTRL_BANK_VOLTAGE_MASK, val); | |
| 164 | 164 | } | |
| 165 | 165 | ||
modified drivers/pinctrl/pinctrl-generic.c
| @@ -3,10 +3,8 @@ | |||
| 3 | 3 | #define pr_fmt(fmt) "generic pinconfig core: " fmt | |
| 4 | 4 | ||
| 5 | 5 | #include <linux/array_size.h> | |
| 6 | - | #include <linux/cleanup.h> | |
| 7 | 6 | #include <linux/device.h> | |
| 8 | 7 | #include <linux/module.h> | |
| 9 | - | #include <linux/mutex.h> | |
| 10 | 8 | #include <linux/of.h> | |
| 11 | 9 | #include <linux/slab.h> | |
| 12 | 10 | ||
| @@ -198,8 +196,6 @@ static int pinctrl_generic_dt_node_to_map(struct pinctrl_dev *pctldev, | |||
| 198 | 196 | int ngroups = 0; | |
| 199 | 197 | int ret; | |
| 200 | 198 | ||
| 201 | - | guard(mutex)(&pctldev->mutex); | |
| 202 | - | ||
| 203 | 199 | *maps = NULL; | |
| 204 | 200 | *num_maps = 0; | |
| 205 | 201 | ||
modified drivers/pinctrl/pinctrl-single.c
| @@ -1628,8 +1628,7 @@ static int pcs_irq_init_chained_handler(struct pcs_device *pcs, | |||
| 1628 | 1628 | &pcs_irqdomain_ops, | |
| 1629 | 1629 | pcs_soc); | |
| 1630 | 1630 | if (!pcs->domain) { | |
| 1631 | - | pcs_irq_free(pcs); | |
| 1632 | - | pcs_soc->irq = -1; | |
| 1631 | + | irq_set_chained_handler(pcs_soc->irq, NULL); | |
| 1633 | 1632 | return -EINVAL; | |
| 1634 | 1633 | } | |
| 1635 | 1634 | ||
modified drivers/pinctrl/qcom/pinctrl-ipq5210.c
| @@ -867,7 +867,6 @@ static const struct of_device_id ipq5210_tlmm_of_match[] = { | |||
| 867 | 867 | { .compatible = "qcom,ipq5210-tlmm", }, | |
| 868 | 868 | { }, | |
| 869 | 869 | }; | |
| 870 | - | MODULE_DEVICE_TABLE(of, ipq5210_tlmm_of_match); | |
| 871 | 870 | ||
| 872 | 871 | static int ipq5210_tlmm_probe(struct platform_device *pdev) | |
| 873 | 872 | { | |
modified drivers/pinctrl/qcom/pinctrl-nord.c
| @@ -570,10 +570,8 @@ enum nord_functions { | |||
| 570 | 570 | msm_mux_qup0_se5, | |
| 571 | 571 | msm_mux_qup1_se0, | |
| 572 | 572 | msm_mux_qup1_se1, | |
| 573 | - | msm_mux_qup1_se2_01, | |
| 574 | - | msm_mux_qup1_se2_23, | |
| 575 | - | msm_mux_qup1_se3_01, | |
| 576 | - | msm_mux_qup1_se3_23, | |
| 573 | + | msm_mux_qup1_se2, | |
| 574 | + | msm_mux_qup1_se3, | |
| 577 | 575 | msm_mux_qup1_se4, | |
| 578 | 576 | msm_mux_qup1_se5, | |
| 579 | 577 | msm_mux_qup1_se6, | |
| @@ -1154,19 +1152,11 @@ static const char *const qup1_se1_groups[] = { | |||
| 1154 | 1152 | "gpio123", "gpio124", "gpio125", "gpio126", | |
| 1155 | 1153 | }; | |
| 1156 | 1154 | ||
| 1157 | - | static const char *const qup1_se2_01_groups[] = { | |
| 1158 | - | "gpio127", "gpio128", | |
| 1155 | + | static const char *const qup1_se2_groups[] = { | |
| 1156 | + | "gpio127", "gpio128", "gpio129", "gpio130", | |
| 1159 | 1157 | }; | |
| 1160 | 1158 | ||
| 1161 | - | static const char *const qup1_se2_23_groups[] = { | |
| 1162 | - | "gpio127", "gpio128", | |
| 1163 | - | }; | |
| 1164 | - | ||
| 1165 | - | static const char *const qup1_se3_01_groups[] = { | |
| 1166 | - | "gpio129", "gpio130", | |
| 1167 | - | }; | |
| 1168 | - | ||
| 1169 | - | static const char *const qup1_se3_23_groups[] = { | |
| 1159 | + | static const char *const qup1_se3_groups[] = { | |
| 1170 | 1160 | "gpio129", "gpio130", | |
| 1171 | 1161 | }; | |
| 1172 | 1162 | ||
| @@ -1438,10 +1428,8 @@ static const struct pinfunction nord_functions[] = { | |||
| 1438 | 1428 | MSM_PIN_FUNCTION(qup0_se5), | |
| 1439 | 1429 | MSM_PIN_FUNCTION(qup1_se0), | |
| 1440 | 1430 | MSM_PIN_FUNCTION(qup1_se1), | |
| 1441 | - | MSM_PIN_FUNCTION(qup1_se2_01), | |
| 1442 | - | MSM_PIN_FUNCTION(qup1_se2_23), | |
| 1443 | - | MSM_PIN_FUNCTION(qup1_se3_01), | |
| 1444 | - | MSM_PIN_FUNCTION(qup1_se3_23), | |
| 1431 | + | MSM_PIN_FUNCTION(qup1_se2), | |
| 1432 | + | MSM_PIN_FUNCTION(qup1_se3), | |
| 1445 | 1433 | MSM_PIN_FUNCTION(qup1_se4), | |
| 1446 | 1434 | MSM_PIN_FUNCTION(qup1_se5), | |
| 1447 | 1435 | MSM_PIN_FUNCTION(qup1_se6), | |
| @@ -1645,13 +1633,13 @@ static const struct msm_pingroup nord_groups[] = { | |||
| 1645 | 1633 | _, _, _, _, _, _, _), | |
| 1646 | 1634 | [126] = PINGROUP(126, qup1_se1, qup1_se0, ccu_i2c_scl, mdp1_vsync_out, | |
| 1647 | 1635 | _, atest_usb20, ddr_pxi, _, _, _, _), | |
| 1648 | - | [127] = PINGROUP(127, qup1_se2_23, qup1_se2_01, _, atest_usb21, ddr_pxi, | |
| 1636 | + | [127] = PINGROUP(127, qup1_se2, qup1_se2, _, atest_usb21, ddr_pxi, | |
| 1649 | 1637 | _, _, _, _, _, _), | |
| 1650 | - | [128] = PINGROUP(128, qup1_se2_23, qup1_se2_01, _, atest_usb20, ddr_pxi, | |
| 1638 | + | [128] = PINGROUP(128, qup1_se2, qup1_se2, _, atest_usb20, ddr_pxi, | |
| 1651 | 1639 | _, _, _, _, _, _), | |
| 1652 | - | [129] = PINGROUP(129, qup1_se3_23, qup1_se3_01, ccu_i2c_sda, mdp1_vsync_out, | |
| 1640 | + | [129] = PINGROUP(129, qup1_se3, qup1_se3, ccu_i2c_sda, mdp1_vsync_out, | |
| 1653 | 1641 | _, atest_usb21, ddr_pxi, _, _, _, _), | |
| 1654 | - | [130] = PINGROUP(130, qup1_se3_23, qup1_se3_01, ccu_i2c_scl, mdp1_vsync_out, | |
| 1642 | + | [130] = PINGROUP(130, qup1_se3, qup1_se3, ccu_i2c_scl, mdp1_vsync_out, | |
| 1655 | 1643 | _, atest_usb20, ddr_pxi, _, _, _, _), | |
| 1656 | 1644 | [131] = PINGROUP(131, qup1_se4, qup1_se6, ccu_i2c_sda, mdp1_vsync_out, | |
| 1657 | 1645 | _, atest_usb21, ddr_pxi, _, _, _, _), | |
modified drivers/pinctrl/sunxi/pinctrl-sun55i-a523-r.c
| @@ -26,7 +26,7 @@ static const u8 a523_r_irq_bank_muxes[SUNXI_PINCTRL_MAX_BANKS] = | |||
| 26 | 26 | static struct sunxi_pinctrl_desc a523_r_pinctrl_data = { | |
| 27 | 27 | .irq_banks = ARRAY_SIZE(a523_r_irq_bank_map), | |
| 28 | 28 | .irq_bank_map = a523_r_irq_bank_map, | |
| 29 | - | .io_bias_cfg_variant = BIAS_VOLTAGE_PIO_POW_MODE_CTL_INV, | |
| 29 | + | .io_bias_cfg_variant = BIAS_VOLTAGE_PIO_POW_MODE_SEL, | |
| 30 | 30 | .pin_base = PL_BASE, | |
| 31 | 31 | }; | |
| 32 | 32 | ||
modified drivers/pinctrl/sunxi/pinctrl-sun55i-a523.c
| @@ -26,7 +26,7 @@ static const u8 a523_irq_bank_muxes[SUNXI_PINCTRL_MAX_BANKS] = | |||
| 26 | 26 | static struct sunxi_pinctrl_desc a523_pinctrl_data = { | |
| 27 | 27 | .irq_banks = ARRAY_SIZE(a523_irq_bank_map), | |
| 28 | 28 | .irq_bank_map = a523_irq_bank_map, | |
| 29 | - | .io_bias_cfg_variant = BIAS_VOLTAGE_PIO_POW_MODE_CTL_INV, | |
| 29 | + | .io_bias_cfg_variant = BIAS_VOLTAGE_PIO_POW_MODE_SEL, | |
| 30 | 30 | }; | |
| 31 | 31 | ||
| 32 | 32 | static int a523_pinctrl_probe(struct platform_device *pdev) | |
modified drivers/pinctrl/sunxi/pinctrl-sunxi.c
| @@ -728,7 +728,6 @@ static int sunxi_pinctrl_set_io_bias_cfg(struct sunxi_pinctrl *pctl, | |||
| 728 | 728 | { | |
| 729 | 729 | unsigned short bank; | |
| 730 | 730 | unsigned long flags; | |
| 731 | - | bool inverted = false; | |
| 732 | 731 | u32 val, reg; | |
| 733 | 732 | int uV; | |
| 734 | 733 | ||
| @@ -767,9 +766,6 @@ static int sunxi_pinctrl_set_io_bias_cfg(struct sunxi_pinctrl *pctl, | |||
| 767 | 766 | reg &= ~IO_BIAS_MASK; | |
| 768 | 767 | writel(reg | val, pctl->membase + sunxi_grp_config_reg(pin)); | |
| 769 | 768 | return 0; | |
| 770 | - | case BIAS_VOLTAGE_PIO_POW_MODE_CTL_INV: | |
| 771 | - | inverted = true; | |
| 772 | - | fallthrough; | |
| 773 | 769 | case BIAS_VOLTAGE_PIO_POW_MODE_CTL: | |
| 774 | 770 | val = uV > 1800000 && uV <= 2500000 ? BIT(bank) : 0; | |
| 775 | 771 | ||
| @@ -784,8 +780,6 @@ static int sunxi_pinctrl_set_io_bias_cfg(struct sunxi_pinctrl *pctl, | |||
| 784 | 780 | fallthrough; | |
| 785 | 781 | case BIAS_VOLTAGE_PIO_POW_MODE_SEL: | |
| 786 | 782 | val = uV <= 1800000 ? 1 : 0; | |
| 787 | - | if (inverted) | |
| 788 | - | val = !val; | |
| 789 | 783 | ||
| 790 | 784 | raw_spin_lock_irqsave(&pctl->lock, flags); | |
| 791 | 785 | reg = readl(pctl->membase + pctl->pow_mod_sel_offset); | |
| @@ -843,21 +837,6 @@ static void sunxi_pmx_set(struct pinctrl_dev *pctldev, | |||
| 843 | 837 | writel((readl(pctl->membase + reg) & ~mask) | config << shift, | |
| 844 | 838 | pctl->membase + reg); | |
| 845 | 839 | ||
| 846 | - | /* | |
| 847 | - | * A pin muxed to gpio_out directly through a pinmux node bypasses | |
| 848 | - | * sunxi_pinctrl_gpio_set() and drives whatever its output latch | |
| 849 | - | * holds. Now that the pin is in output mode the data register | |
| 850 | - | * reads back the latch, so refresh the shadow to keep such pins | |
| 851 | - | * driving their pre-existing level. | |
| 852 | - | */ | |
| 853 | - | if (config == SUN4I_FUNC_OUTPUT) { | |
| 854 | - | u32 *shadow = &pctl->dat_shadow[pin / PINS_PER_BANK]; | |
| 855 | - | ||
| 856 | - | sunxi_data_reg(pctl, pin, ®, &shift, &mask); | |
| 857 | - | *shadow = (*shadow & ~mask) | | |
| 858 | - | (readl(pctl->membase + reg) & mask); | |
| 859 | - | } | |
| 860 | - | ||
| 861 | 840 | raw_spin_unlock_irqrestore(&pctl->lock, flags); | |
| 862 | 841 | } | |
| 863 | 842 | ||
| @@ -1038,29 +1017,21 @@ static int sunxi_pinctrl_gpio_set(struct gpio_chip *chip, unsigned int offset, | |||
| 1038 | 1017 | int value) | |
| 1039 | 1018 | { | |
| 1040 | 1019 | struct sunxi_pinctrl *pctl = gpiochip_get_data(chip); | |
| 1041 | - | u32 *shadow = &pctl->dat_shadow[offset / PINS_PER_BANK]; | |
| 1042 | - | u32 reg, shift, mask; | |
| 1020 | + | u32 reg, shift, mask, val; | |
| 1043 | 1021 | unsigned long flags; | |
| 1044 | 1022 | ||
| 1045 | 1023 | sunxi_data_reg(pctl, offset, ®, &shift, &mask); | |
| 1046 | 1024 | ||
| 1047 | 1025 | raw_spin_lock_irqsave(&pctl->lock, flags); | |
| 1048 | 1026 | ||
| 1049 | - | /* | |
| 1050 | - | * Reading the data register returns the pin level, not the output | |
| 1051 | - | * latch, for pins muxed as inputs. A read-modify-write based on | |
| 1052 | - | * the register would therefore corrupt the latches of input-muxed | |
| 1053 | - | * pins in the same bank (e.g. an emulated open-drain I2C line | |
| 1054 | - | * released high), making them drive the wrong level once switched | |
| 1055 | - | * to output. Base the read-modify-write on a shadow copy of the | |
| 1056 | - | * latches instead. | |
| 1057 | - | */ | |
| 1027 | + | val = readl(pctl->membase + reg); | |
| 1028 | + | ||
| 1058 | 1029 | if (value) | |
| 1059 | - | *shadow |= mask; | |
| 1030 | + | val |= mask; | |
| 1060 | 1031 | else | |
| 1061 | - | *shadow &= ~mask; | |
| 1032 | + | val &= ~mask; | |
| 1062 | 1033 | ||
| 1063 | - | writel(*shadow, pctl->membase + reg); | |
| 1034 | + | writel(val, pctl->membase + reg); | |
| 1064 | 1035 | ||
| 1065 | 1036 | raw_spin_unlock_irqrestore(&pctl->lock, flags); | |
| 1066 | 1037 | ||
| @@ -1601,7 +1572,7 @@ int sunxi_pinctrl_init_with_flags(struct platform_device *pdev, | |||
| 1601 | 1572 | struct pinctrl_pin_desc *pins; | |
| 1602 | 1573 | struct sunxi_pinctrl *pctl; | |
| 1603 | 1574 | struct pinmux_ops *pmxops; | |
| 1604 | - | int i, ret, last_pin, pin_idx, nbanks; | |
| 1575 | + | int i, ret, last_pin, pin_idx; | |
| 1605 | 1576 | struct clk *clk; | |
| 1606 | 1577 | ||
| 1607 | 1578 | pctl = devm_kzalloc(&pdev->dev, sizeof(*pctl), GFP_KERNEL); | |
| @@ -1639,37 +1610,6 @@ int sunxi_pinctrl_init_with_flags(struct platform_device *pdev, | |||
| 1639 | 1610 | if (!pctl->irq_array) | |
| 1640 | 1611 | return -ENOMEM; | |
| 1641 | 1612 | ||
| 1642 | - | /* | |
| 1643 | - | * The bus clock has to be enabled before the pinctrl device | |
| 1644 | - | * registers, as the pin hogs claimed from there access registers. | |
| 1645 | - | */ | |
| 1646 | - | ret = of_clk_get_parent_count(node); | |
| 1647 | - | clk = devm_clk_get_enabled(&pdev->dev, ret == 1 ? NULL : "apb"); | |
| 1648 | - | if (IS_ERR(clk)) | |
| 1649 | - | return PTR_ERR(clk); | |
| 1650 | - | ||
| 1651 | - | /* | |
| 1652 | - | * Seed the output latch shadow from the hardware so pins the | |
| 1653 | - | * bootloader left in output mode keep their state; see | |
| 1654 | - | * sunxi_pinctrl_gpio_set() for why a shadow is needed. This must | |
| 1655 | - | * happen before the pinctrl device registers, as pin hogs can mux | |
| 1656 | - | * pins to gpio_out and thereby update the shadow. | |
| 1657 | - | */ | |
| 1658 | - | last_pin = pctl->desc->pins[pctl->desc->npins - 1].pin.number; | |
| 1659 | - | nbanks = DIV_ROUND_UP(last_pin + 1 - pctl->desc->pin_base, | |
| 1660 | - | PINS_PER_BANK); | |
| 1661 | - | pctl->dat_shadow = devm_kcalloc(&pdev->dev, nbanks, | |
| 1662 | - | sizeof(*pctl->dat_shadow), GFP_KERNEL); | |
| 1663 | - | if (!pctl->dat_shadow) | |
| 1664 | - | return -ENOMEM; | |
| 1665 | - | ||
| 1666 | - | for (i = 0; i < nbanks; i++) { | |
| 1667 | - | u32 reg, shift, mask; | |
| 1668 | - | ||
| 1669 | - | sunxi_data_reg(pctl, i * PINS_PER_BANK, ®, &shift, &mask); | |
| 1670 | - | pctl->dat_shadow[i] = readl(pctl->membase + reg); | |
| 1671 | - | } | |
| 1672 | - | ||
| 1673 | 1613 | ret = sunxi_pinctrl_build_state(pdev); | |
| 1674 | 1614 | if (ret) { | |
| 1675 | 1615 | dev_err(&pdev->dev, "dt probe failed: %d\n", ret); | |
| @@ -1725,6 +1665,7 @@ int sunxi_pinctrl_init_with_flags(struct platform_device *pdev, | |||
| 1725 | 1665 | if (!pctl->chip) | |
| 1726 | 1666 | return -ENOMEM; | |
| 1727 | 1667 | ||
| 1668 | + | last_pin = pctl->desc->pins[pctl->desc->npins - 1].pin.number; | |
| 1728 | 1669 | pctl->chip->owner = THIS_MODULE; | |
| 1729 | 1670 | pctl->chip->request = gpiochip_generic_request; | |
| 1730 | 1671 | pctl->chip->free = gpiochip_generic_free; | |
| @@ -1758,6 +1699,13 @@ int sunxi_pinctrl_init_with_flags(struct platform_device *pdev, | |||
| 1758 | 1699 | goto gpiochip_error; | |
| 1759 | 1700 | } | |
| 1760 | 1701 | ||
| 1702 | + | ret = of_clk_get_parent_count(node); | |
| 1703 | + | clk = devm_clk_get_enabled(&pdev->dev, ret == 1 ? NULL : "apb"); | |
| 1704 | + | if (IS_ERR(clk)) { | |
| 1705 | + | ret = PTR_ERR(clk); | |
| 1706 | + | goto gpiochip_error; | |
| 1707 | + | } | |
| 1708 | + | ||
| 1761 | 1709 | pctl->irq = devm_kcalloc(&pdev->dev, | |
| 1762 | 1710 | pctl->desc->irq_banks, | |
| 1763 | 1711 | sizeof(*pctl->irq), | |
modified drivers/pinctrl/sunxi/pinctrl-sunxi.h
| @@ -85,7 +85,6 @@ | |||
| 85 | 85 | #define IO_BIAS_MASK GENMASK(3, 0) | |
| 86 | 86 | ||
| 87 | 87 | #define SUN4I_FUNC_INPUT 0 | |
| 88 | - | #define SUN4I_FUNC_OUTPUT 1 | |
| 89 | 88 | #define SUN4I_FUNC_IRQ 6 | |
| 90 | 89 | #define SUN4I_FUNC_DISABLED_OLD 7 | |
| 91 | 90 | #define SUN4I_FUNC_DISABLED_NEW 15 | |
| @@ -117,10 +116,8 @@ enum sunxi_desc_bias_voltage { | |||
| 117 | 116 | * Bias voltage is set through PIO_POW_MOD_SEL_REG | |
| 118 | 117 | * and PIO_POW_MOD_CTL_REG register, as seen on | |
| 119 | 118 | * A100 and D1 SoC, for example. | |
| 120 | - | * Some SoCs invert the encoding for 1.8V vs. 3.3V. | |
| 121 | 119 | */ | |
| 122 | 120 | BIAS_VOLTAGE_PIO_POW_MODE_CTL, | |
| 123 | - | BIAS_VOLTAGE_PIO_POW_MODE_CTL_INV, | |
| 124 | 121 | }; | |
| 125 | 122 | ||
| 126 | 123 | struct sunxi_desc_function { | |
| @@ -178,12 +175,6 @@ struct sunxi_pinctrl { | |||
| 178 | 175 | int *irq; | |
| 179 | 176 | unsigned *irq_array; | |
| 180 | 177 | raw_spinlock_t lock; | |
| 181 | - | /* | |
| 182 | - | * Output latch shadow, one word per bank. Seeded lockless at | |
| 183 | - | * probe before the pinctrl device registers, protected by @lock | |
| 184 | - | * afterwards. | |
| 185 | - | */ | |
| 186 | - | u32 *dat_shadow; | |
| 187 | 178 | struct pinctrl_dev *pctl_dev; | |
| 188 | 179 | unsigned long flags; | |
| 189 | 180 | u32 bank_mem_size; | |
modified drivers/pinctrl/tegra/pinctrl-tegra238.c
| @@ -1744,57 +1744,57 @@ static const char * const tegra238_functions[] = { | |||
| 1744 | 1744 | #define drive_sdmmc1_dat0_pu2 DRV_PINGROUP_ENTRY_Y(0x8034, 28, 2, 30, 2, -1, -1, -1, -1, 0) | |
| 1745 | 1745 | #define drive_ufs0_rst_n_pv1 DRV_PINGROUP_ENTRY_Y(0x11004, 12, 5, 24, 5, -1, -1, -1, -1, 0) | |
| 1746 | 1746 | #define drive_ufs0_ref_clk_pv0 DRV_PINGROUP_ENTRY_Y(0x1100c, 12, 5, 24, 5, -1, -1, -1, -1, 0) | |
| 1747 | - | #define drive_batt_oc_paa4 DRV_PINGROUP_ENTRY_Y(0x1024, 12, 5, 20, 5, -1, -1, -1, -1, 0) | |
| 1748 | - | #define drive_bootv_ctl_n_paa0 DRV_PINGROUP_ENTRY_Y(0x102c, 12, 5, 20, 5, -1, -1, -1, -1, 0) | |
| 1749 | - | #define drive_vcomp_alert_paa2 DRV_PINGROUP_ENTRY_Y(0x105c, 12, 5, 20, 5, -1, -1, -1, -1, 0) | |
| 1750 | - | #define drive_hdmi_cec_pbb0 DRV_PINGROUP_ENTRY_Y(0x1064, 12, 5, 20, 5, -1, -1, -1, -1, 0) | |
| 1751 | - | #define drive_touch_clk_pdd3 DRV_PINGROUP_ENTRY_Y(0x106c, 12, 5, 20, 5, -1, -1, -1, -1, 0) | |
| 1752 | - | #define drive_uart3_rx_pcc6 DRV_PINGROUP_ENTRY_Y(0x1074, 12, 5, 20, 5, -1, -1, -1, -1, 0) | |
| 1753 | - | #define drive_uart3_tx_pcc5 DRV_PINGROUP_ENTRY_Y(0x107c, 12, 5, 20, 5, -1, -1, -1, -1, 0) | |
| 1754 | - | #define drive_gen8_i2c_sda_pdd2 DRV_PINGROUP_ENTRY_Y(0x1084, 12, 5, 20, 5, -1, -1, -1, -1, 0) | |
| 1755 | - | #define drive_gen8_i2c_scl_pdd1 DRV_PINGROUP_ENTRY_Y(0x108c, 12, 5, 20, 5, -1, -1, -1, -1, 0) | |
| 1756 | - | #define drive_spi2_mosi_pcc2 DRV_PINGROUP_ENTRY_Y(0x1094, 12, 5, 20, 5, -1, -1, -1, -1, 0) | |
| 1757 | - | #define drive_gen2_i2c_scl_pcc7 DRV_PINGROUP_ENTRY_Y(0x109c, 12, 5, 20, 5, -1, -1, -1, -1, 0) | |
| 1758 | - | #define drive_spi2_cs0_pcc3 DRV_PINGROUP_ENTRY_Y(0x10a4, 12, 5, 20, 5, -1, -1, -1, -1, 0) | |
| 1759 | - | #define drive_gen2_i2c_sda_pdd0 DRV_PINGROUP_ENTRY_Y(0x10ac, 12, 5, 20, 5, -1, -1, -1, -1, 0) | |
| 1760 | - | #define drive_spi2_sck_pcc0 DRV_PINGROUP_ENTRY_Y(0x10b4, 12, 5, 20, 5, -1, -1, -1, -1, 0) | |
| 1761 | - | #define drive_spi2_miso_pcc1 DRV_PINGROUP_ENTRY_Y(0x10bc, 12, 5, 20, 5, -1, -1, -1, -1, 0) | |
| 1762 | - | #define drive_soc_gpio49_pee2 DRV_PINGROUP_ENTRY_Y(0x10c4, 12, 5, 20, 5, -1, -1, -1, -1, 0) | |
| 1763 | - | #define drive_soc_gpio50_pee4 DRV_PINGROUP_ENTRY_Y(0x10cc, 12, 5, 20, 5, -1, -1, -1, -1, 0) | |
| 1764 | - | #define drive_soc_gpio82_pee3 DRV_PINGROUP_ENTRY_Y(0x10d4, 12, 5, 20, 5, -1, -1, -1, -1, 0) | |
| 1765 | - | #define drive_soc_gpio71_pff2 DRV_PINGROUP_ENTRY_Y(0x10dc, 12, 5, 20, 5, -1, -1, -1, -1, 0) | |
| 1766 | - | #define drive_soc_gpio76_pff7 DRV_PINGROUP_ENTRY_Y(0x10e4, 12, 5, 20, 5, -1, -1, -1, -1, 0) | |
| 1767 | - | #define drive_soc_gpio74_pff5 DRV_PINGROUP_ENTRY_Y(0x10ec, 12, 5, 20, 5, -1, -1, -1, -1, 0) | |
| 1768 | - | #define drive_soc_gpio00_paa1 DRV_PINGROUP_ENTRY_Y(0x10f4, 12, 5, 20, 5, -1, -1, -1, -1, 0) | |
| 1769 | - | #define drive_soc_gpio19_pdd6 DRV_PINGROUP_ENTRY_Y(0x10fc, 12, 5, 20, 5, -1, -1, -1, -1, 0) | |
| 1770 | - | #define drive_soc_gpio86_phh3 DRV_PINGROUP_ENTRY_Y(0x1104, 12, 5, 20, 5, -1, -1, -1, -1, 0) | |
| 1771 | - | #define drive_soc_gpio72_pff3 DRV_PINGROUP_ENTRY_Y(0x110c, 12, 5, 20, 5, -1, -1, -1, -1, 0) | |
| 1772 | - | #define drive_soc_gpio77_pgg0 DRV_PINGROUP_ENTRY_Y(0x1114, 12, 5, 20, 5, -1, -1, -1, -1, 0) | |
| 1773 | - | #define drive_soc_gpio80_pff6 DRV_PINGROUP_ENTRY_Y(0x111c, 12, 5, 20, 5, -1, -1, -1, -1, 0) | |
| 1774 | - | #define drive_soc_gpio84_pgg1 DRV_PINGROUP_ENTRY_Y(0x1124, 12, 5, 20, 5, -1, -1, -1, -1, 0) | |
| 1775 | - | #define drive_soc_gpio83_pee5 DRV_PINGROUP_ENTRY_Y(0x112c, 12, 5, 20, 5, -1, -1, -1, -1, 0) | |
| 1776 | - | #define drive_soc_gpio73_pff4 DRV_PINGROUP_ENTRY_Y(0x1134, 12, 5, 20, 5, -1, -1, -1, -1, 0) | |
| 1777 | - | #define drive_soc_gpio70_pff1 DRV_PINGROUP_ENTRY_Y(0x113c, 12, 5, 20, 5, -1, -1, -1, -1, 0) | |
| 1778 | - | #define drive_soc_gpio04_paa5 DRV_PINGROUP_ENTRY_Y(0x1144, 12, 5, 20, 5, -1, -1, -1, -1, 0) | |
| 1779 | - | #define drive_soc_gpio85_pgg6 DRV_PINGROUP_ENTRY_Y(0x114c, 12, 5, 20, 5, -1, -1, -1, -1, 0) | |
| 1780 | - | #define drive_soc_gpio69_pff0 DRV_PINGROUP_ENTRY_Y(0x1154, 12, 5, 20, 5, -1, -1, -1, -1, 0) | |
| 1781 | - | #define drive_soc_gpio25_paa6 DRV_PINGROUP_ENTRY_Y(0x115c, 12, 5, 20, 5, -1, -1, -1, -1, 0) | |
| 1782 | - | #define drive_soc_gpio26_paa7 DRV_PINGROUP_ENTRY_Y(0x1164, 12, 5, 20, 5, -1, -1, -1, -1, 0) | |
| 1783 | - | #define drive_uart5_tx_pgg7 DRV_PINGROUP_ENTRY_Y(0x116c, 12, 5, 20, 5, -1, -1, -1, -1, 0) | |
| 1784 | - | #define drive_uart5_rx_phh0 DRV_PINGROUP_ENTRY_Y(0x1174, 12, 5, 20, 5, -1, -1, -1, -1, 0) | |
| 1785 | - | #define drive_uart2_tx_pgg2 DRV_PINGROUP_ENTRY_Y(0x117c, 12, 5, 20, 5, -1, -1, -1, -1, 0) | |
| 1786 | - | #define drive_uart2_rx_pgg3 DRV_PINGROUP_ENTRY_Y(0x1184, 12, 5, 20, 5, -1, -1, -1, -1, 0) | |
| 1787 | - | #define drive_uart2_cts_pgg5 DRV_PINGROUP_ENTRY_Y(0x118c, 12, 5, 20, 5, -1, -1, -1, -1, 0) | |
| 1788 | - | #define drive_uart2_rts_pgg4 DRV_PINGROUP_ENTRY_Y(0x1194, 12, 5, 20, 5, -1, -1, -1, -1, 0) | |
| 1789 | - | #define drive_uart5_cts_phh2 DRV_PINGROUP_ENTRY_Y(0x119c, 12, 5, 20, 5, -1, -1, -1, -1, 0) | |
| 1790 | - | #define drive_uart5_rts_phh1 DRV_PINGROUP_ENTRY_Y(0x11a4, 12, 5, 20, 5, -1, -1, -1, -1, 0) | |
| 1791 | - | #define drive_pwm7_pee1 DRV_PINGROUP_ENTRY_Y(0x11ac, 12, 5, 20, 5, -1, -1, -1, -1, 0) | |
| 1792 | - | #define drive_pwm2_pdd7 DRV_PINGROUP_ENTRY_Y(0x11b4, 12, 5, 20, 5, -1, -1, -1, -1, 0) | |
| 1793 | - | #define drive_pwm3_pee0 DRV_PINGROUP_ENTRY_Y(0x11bc, 12, 5, 20, 5, -1, -1, -1, -1, 0) | |
| 1794 | - | #define drive_pwm1_paa3 DRV_PINGROUP_ENTRY_Y(0x11c4, 12, 5, 20, 5, -1, -1, -1, -1, 0) | |
| 1795 | - | #define drive_spi2_cs1_pcc4 DRV_PINGROUP_ENTRY_Y(0x11cc, 12, 5, 20, 5, -1, -1, -1, -1, 0) | |
| 1796 | - | #define drive_dmic1_clk_pdd4 DRV_PINGROUP_ENTRY_Y(0x11d4, 12, 5, 20, 5, -1, -1, -1, -1, 0) | |
| 1797 | - | #define drive_dmic1_dat_pdd5 DRV_PINGROUP_ENTRY_Y(0x11dc, 12, 5, 20, 5, -1, -1, -1, -1, 0) | |
| 1747 | + | #define drive_batt_oc_paa4 DRV_PINGROUP_ENTRY_Y(0x1024, 12, 5, 20, 5, -1, -1, -1, -1, 1) | |
| 1748 | + | #define drive_bootv_ctl_n_paa0 DRV_PINGROUP_ENTRY_Y(0x102c, 12, 5, 20, 5, -1, -1, -1, -1, 1) | |
| 1749 | + | #define drive_vcomp_alert_paa2 DRV_PINGROUP_ENTRY_Y(0x105c, 12, 5, 20, 5, -1, -1, -1, -1, 1) | |
| 1750 | + | #define drive_hdmi_cec_pbb0 DRV_PINGROUP_ENTRY_Y(0x1064, 12, 5, 20, 5, -1, -1, -1, -1, 1) | |
| 1751 | + | #define drive_touch_clk_pdd3 DRV_PINGROUP_ENTRY_Y(0x106c, 12, 5, 20, 5, -1, -1, -1, -1, 1) | |
| 1752 | + | #define drive_uart3_rx_pcc6 DRV_PINGROUP_ENTRY_Y(0x1074, 12, 5, 20, 5, -1, -1, -1, -1, 1) | |
| 1753 | + | #define drive_uart3_tx_pcc5 DRV_PINGROUP_ENTRY_Y(0x107c, 12, 5, 20, 5, -1, -1, -1, -1, 1) | |
| 1754 | + | #define drive_gen8_i2c_sda_pdd2 DRV_PINGROUP_ENTRY_Y(0x1084, 12, 5, 20, 5, -1, -1, -1, -1, 1) | |
| 1755 | + | #define drive_gen8_i2c_scl_pdd1 DRV_PINGROUP_ENTRY_Y(0x108c, 12, 5, 20, 5, -1, -1, -1, -1, 1) | |
| 1756 | + | #define drive_spi2_mosi_pcc2 DRV_PINGROUP_ENTRY_Y(0x1094, 12, 5, 20, 5, -1, -1, -1, -1, 1) | |
| 1757 | + | #define drive_gen2_i2c_scl_pcc7 DRV_PINGROUP_ENTRY_Y(0x109c, 12, 5, 20, 5, -1, -1, -1, -1, 1) | |
| 1758 | + | #define drive_spi2_cs0_pcc3 DRV_PINGROUP_ENTRY_Y(0x10a4, 12, 5, 20, 5, -1, -1, -1, -1, 1) | |
| 1759 | + | #define drive_gen2_i2c_sda_pdd0 DRV_PINGROUP_ENTRY_Y(0x10ac, 12, 5, 20, 5, -1, -1, -1, -1, 1) | |
| 1760 | + | #define drive_spi2_sck_pcc0 DRV_PINGROUP_ENTRY_Y(0x10b4, 12, 5, 20, 5, -1, -1, -1, -1, 1) | |
| 1761 | + | #define drive_spi2_miso_pcc1 DRV_PINGROUP_ENTRY_Y(0x10bc, 12, 5, 20, 5, -1, -1, -1, -1, 1) | |
| 1762 | + | #define drive_soc_gpio49_pee2 DRV_PINGROUP_ENTRY_Y(0x10c4, 12, 5, 20, 5, -1, -1, -1, -1, 1) | |
| 1763 | + | #define drive_soc_gpio50_pee4 DRV_PINGROUP_ENTRY_Y(0x10cc, 12, 5, 20, 5, -1, -1, -1, -1, 1) | |
| 1764 | + | #define drive_soc_gpio82_pee3 DRV_PINGROUP_ENTRY_Y(0x10d4, 12, 5, 20, 5, -1, -1, -1, -1, 1) | |
| 1765 | + | #define drive_soc_gpio71_pff2 DRV_PINGROUP_ENTRY_Y(0x10dc, 12, 5, 20, 5, -1, -1, -1, -1, 1) | |
| 1766 | + | #define drive_soc_gpio76_pff7 DRV_PINGROUP_ENTRY_Y(0x10e4, 12, 5, 20, 5, -1, -1, -1, -1, 1) | |
| 1767 | + | #define drive_soc_gpio74_pff5 DRV_PINGROUP_ENTRY_Y(0x10ec, 12, 5, 20, 5, -1, -1, -1, -1, 1) | |
| 1768 | + | #define drive_soc_gpio00_paa1 DRV_PINGROUP_ENTRY_Y(0x10f4, 12, 5, 20, 5, -1, -1, -1, -1, 1) | |
| 1769 | + | #define drive_soc_gpio19_pdd6 DRV_PINGROUP_ENTRY_Y(0x10fc, 12, 5, 20, 5, -1, -1, -1, -1, 1) | |
| 1770 | + | #define drive_soc_gpio86_phh3 DRV_PINGROUP_ENTRY_Y(0x1104, 12, 5, 20, 5, -1, -1, -1, -1, 1) | |
| 1771 | + | #define drive_soc_gpio72_pff3 DRV_PINGROUP_ENTRY_Y(0x110c, 12, 5, 20, 5, -1, -1, -1, -1, 1) | |
| 1772 | + | #define drive_soc_gpio77_pgg0 DRV_PINGROUP_ENTRY_Y(0x1114, 12, 5, 20, 5, -1, -1, -1, -1, 1) | |
| 1773 | + | #define drive_soc_gpio80_pff6 DRV_PINGROUP_ENTRY_Y(0x111c, 12, 5, 20, 5, -1, -1, -1, -1, 1) | |
| 1774 | + | #define drive_soc_gpio84_pgg1 DRV_PINGROUP_ENTRY_Y(0x1124, 12, 5, 20, 5, -1, -1, -1, -1, 1) | |
| 1775 | + | #define drive_soc_gpio83_pee5 DRV_PINGROUP_ENTRY_Y(0x112c, 12, 5, 20, 5, -1, -1, -1, -1, 1) | |
| 1776 | + | #define drive_soc_gpio73_pff4 DRV_PINGROUP_ENTRY_Y(0x1134, 12, 5, 20, 5, -1, -1, -1, -1, 1) | |
| 1777 | + | #define drive_soc_gpio70_pff1 DRV_PINGROUP_ENTRY_Y(0x113c, 12, 5, 20, 5, -1, -1, -1, -1, 1) | |
| 1778 | + | #define drive_soc_gpio04_paa5 DRV_PINGROUP_ENTRY_Y(0x1144, 12, 5, 20, 5, -1, -1, -1, -1, 1) | |
| 1779 | + | #define drive_soc_gpio85_pgg6 DRV_PINGROUP_ENTRY_Y(0x114c, 12, 5, 20, 5, -1, -1, -1, -1, 1) | |
| 1780 | + | #define drive_soc_gpio69_pff0 DRV_PINGROUP_ENTRY_Y(0x1154, 12, 5, 20, 5, -1, -1, -1, -1, 1) | |
| 1781 | + | #define drive_soc_gpio25_paa6 DRV_PINGROUP_ENTRY_Y(0x115c, 12, 5, 20, 5, -1, -1, -1, -1, 1) | |
| 1782 | + | #define drive_soc_gpio26_paa7 DRV_PINGROUP_ENTRY_Y(0x1164, 12, 5, 20, 5, -1, -1, -1, -1, 1) | |
| 1783 | + | #define drive_uart5_tx_pgg7 DRV_PINGROUP_ENTRY_Y(0x116c, 12, 5, 20, 5, -1, -1, -1, -1, 1) | |
| 1784 | + | #define drive_uart5_rx_phh0 DRV_PINGROUP_ENTRY_Y(0x1174, 12, 5, 20, 5, -1, -1, -1, -1, 1) | |
| 1785 | + | #define drive_uart2_tx_pgg2 DRV_PINGROUP_ENTRY_Y(0x117c, 12, 5, 20, 5, -1, -1, -1, -1, 1) | |
| 1786 | + | #define drive_uart2_rx_pgg3 DRV_PINGROUP_ENTRY_Y(0x1184, 12, 5, 20, 5, -1, -1, -1, -1, 1) | |
| 1787 | + | #define drive_uart2_cts_pgg5 DRV_PINGROUP_ENTRY_Y(0x118c, 12, 5, 20, 5, -1, -1, -1, -1, 1) | |
| 1788 | + | #define drive_uart2_rts_pgg4 DRV_PINGROUP_ENTRY_Y(0x1194, 12, 5, 20, 5, -1, -1, -1, -1, 1) | |
| 1789 | + | #define drive_uart5_cts_phh2 DRV_PINGROUP_ENTRY_Y(0x119c, 12, 5, 20, 5, -1, -1, -1, -1, 1) | |
| 1790 | + | #define drive_uart5_rts_phh1 DRV_PINGROUP_ENTRY_Y(0x11a4, 12, 5, 20, 5, -1, -1, -1, -1, 1) | |
| 1791 | + | #define drive_pwm7_pee1 DRV_PINGROUP_ENTRY_Y(0x11ac, 12, 5, 20, 5, -1, -1, -1, -1, 1) | |
| 1792 | + | #define drive_pwm2_pdd7 DRV_PINGROUP_ENTRY_Y(0x11b4, 12, 5, 20, 5, -1, -1, -1, -1, 1) | |
| 1793 | + | #define drive_pwm3_pee0 DRV_PINGROUP_ENTRY_Y(0x11bc, 12, 5, 20, 5, -1, -1, -1, -1, 1) | |
| 1794 | + | #define drive_pwm1_paa3 DRV_PINGROUP_ENTRY_Y(0x11c4, 12, 5, 20, 5, -1, -1, -1, -1, 1) | |
| 1795 | + | #define drive_spi2_cs1_pcc4 DRV_PINGROUP_ENTRY_Y(0x11cc, 12, 5, 20, 5, -1, -1, -1, -1, 1) | |
| 1796 | + | #define drive_dmic1_clk_pdd4 DRV_PINGROUP_ENTRY_Y(0x11d4, 12, 5, 20, 5, -1, -1, -1, -1, 1) | |
| 1797 | + | #define drive_dmic1_dat_pdd5 DRV_PINGROUP_ENTRY_Y(0x11dc, 12, 5, 20, 5, -1, -1, -1, -1, 1) | |
| 1798 | 1798 | ||
| 1799 | 1799 | #define drive_sdmmc1_comp DRV_PINGROUP_ENTRY_N | |
| 1800 | 1800 | ||
| @@ -1961,57 +1961,57 @@ static const struct tegra_pingroup tegra238_groups[] = { | |||
| 1961 | 1961 | }; | |
| 1962 | 1962 | ||
| 1963 | 1963 | static const struct tegra_pingroup tegra238_aon_groups[] = { | |
| 1964 | - | PINGROUP(bootv_ctl_n_paa0, RSVD0, RSVD1, RSVD2, RSVD3, 0x1028, 0, Y, -1, 7, 6, 8, -1, 10, 12), | |
| 1965 | - | PINGROUP(soc_gpio00_paa1, RSVD0, RSVD1, RSVD2, RSVD3, 0x10f0, 0, Y, 5, 7, 6, 8, -1, 10, 12), | |
| 1966 | - | PINGROUP(vcomp_alert_paa2, SOC_THERM_OC1, RSVD1, RSVD2, RSVD3, 0x1058, 0, Y, 5, 7, 6, 8, -1, 10, 12), | |
| 1967 | - | PINGROUP(pwm1_paa3, GP_PWM1, RSVD1, RSVD2, RSVD3, 0x11c0, 0, Y, 5, 7, 6, 8, -1, 10, 12), | |
| 1968 | - | PINGROUP(batt_oc_paa4, SOC_THERM_OC2, RSVD1, RSVD2, RSVD3, 0x1020, 0, Y, 5, 7, 6, 8, -1, 10, 12), | |
| 1969 | - | PINGROUP(soc_gpio04_paa5, RSVD0, RSVD1, RSVD2, RSVD3, 0x1140, 0, Y, 5, 7, 6, 8, -1, 10, 12), | |
| 1970 | - | PINGROUP(soc_gpio25_paa6, RSVD0, RSVD1, RSVD2, RSVD3, 0x1158, 0, Y, -1, 7, 6, 8, -1, 10, 12), | |
| 1971 | - | PINGROUP(soc_gpio26_paa7, RSVD0, SOC_THERM_OC3, RSVD2, RSVD3, 0x1160, 0, Y, -1, 7, 6, 8, -1, 10, 12), | |
| 1972 | - | PINGROUP(hdmi_cec_pbb0, HDMI_CEC, RSVD1, RSVD2, RSVD3, 0x1060, 0, Y, 5, 7, 6, 8, -1, 10, 12), | |
| 1973 | - | PINGROUP(spi2_sck_pcc0, SPI2_SCK, RSVD1, RSVD2, RSVD3, 0x10b0, 0, Y, -1, 7, 6, 8, -1, 10, 12), | |
| 1974 | - | PINGROUP(spi2_miso_pcc1, SPI2_DIN, RSVD1, RSVD2, RSVD3, 0x10b8, 0, Y, -1, 7, 6, 8, -1, 10, 12), | |
| 1975 | - | PINGROUP(spi2_mosi_pcc2, SPI2_DOUT, RSVD1, RSVD2, RSVD3, 0x1090, 0, Y, -1, 7, 6, 8, -1, 10, 12), | |
| 1976 | - | PINGROUP(spi2_cs0_pcc3, SPI2_CS0, RSVD1, RSVD2, RSVD3, 0x10a0, 0, Y, -1, 7, 6, 8, -1, 10, 12), | |
| 1977 | - | PINGROUP(spi2_cs1_pcc4, SPI2_CS1, RSVD1, RSVD2, RSVD3, 0x11c8, 0, Y, -1, 7, 6, 8, -1, 10, 12), | |
| 1978 | - | PINGROUP(uart3_tx_pcc5, UARTC_TXD, RSVD1, RSVD2, RSVD3, 0x1078, 0, Y, 5, 7, 6, 8, -1, 10, 12), | |
| 1979 | - | PINGROUP(uart3_rx_pcc6, UARTC_RXD, RSVD1, RSVD2, RSVD3, 0x1070, 0, Y, 5, 7, 6, 8, -1, 10, 12), | |
| 1980 | - | PINGROUP(gen2_i2c_scl_pcc7, I2C2_CLK, RSVD1, RSVD2, RSVD3, 0x1098, 0, Y, 5, 7, 6, 8, -1, 10, 12), | |
| 1981 | - | PINGROUP(gen2_i2c_sda_pdd0, I2C2_DAT, RSVD1, RSVD2, RSVD3, 0x10a8, 0, Y, 5, 7, 6, 8, -1, 10, 12), | |
| 1982 | - | PINGROUP(gen8_i2c_scl_pdd1, I2C8_CLK, RSVD1, RSVD2, RSVD3, 0x1088, 0, Y, 5, 7, 6, 8, -1, 10, 12), | |
| 1983 | - | PINGROUP(gen8_i2c_sda_pdd2, I2C8_DAT, RSVD1, RSVD2, RSVD3, 0x1080, 0, Y, 5, 7, 6, 8, -1, 10, 12), | |
| 1984 | - | PINGROUP(touch_clk_pdd3, GP_PWM4, TOUCH_CLK, RSVD2, RSVD3, 0x1068, 0, Y, 5, 7, 6, 8, -1, 10, 12), | |
| 1985 | - | PINGROUP(dmic1_clk_pdd4, DMIC1_CLK, RSVD1, DMIC5_CLK, RSVD3, 0x11d0, 0, Y, -1, 7, 6, 8, -1, 10, 12), | |
| 1986 | - | PINGROUP(dmic1_dat_pdd5, DMIC1_DAT, RSVD1, DMIC5_DAT, RSVD3, 0x11d8, 0, Y, -1, 7, 6, 8, -1, 10, 12), | |
| 1987 | - | PINGROUP(soc_gpio19_pdd6, RSVD0, WDT_RESET_OUTB, RSVD2, RSVD3, 0x10f8, 0, Y, -1, 7, 6, 8, -1, 10, 12), | |
| 1988 | - | PINGROUP(soc_gpio49_pee2, RSVD0, RSVD1, RSVD2, RSVD3, 0x10c0, 0, Y, -1, 7, 6, 8, -1, 10, 12), | |
| 1989 | - | PINGROUP(soc_gpio50_pee4, RSVD0, RSVD1, RSVD2, RSVD3, 0x10c8, 0, Y, -1, 7, 6, 8, -1, 10, 12), | |
| 1990 | - | PINGROUP(soc_gpio82_pee3, RSVD0, RSVD1, RSVD2, RSVD3, 0x10d0, 0, Y, -1, 7, 6, 8, -1, 10, 12), | |
| 1991 | - | PINGROUP(soc_gpio71_pff2, PPC_MODE_1, RSVD1, RSVD2, RSVD3, 0x10d8, 0, Y, 5, 7, 6, 8, -1, 10, 12), | |
| 1992 | - | PINGROUP(soc_gpio76_pff7, RSVD0, RSVD1, TSC_EDGE_OUT0, TSC_EDGE_OUT0A, 0x10e0, 0, Y, -1, 7, 6, 8, -1, 10, 12), | |
| 1993 | - | PINGROUP(soc_gpio74_pff5, PPC_READY, PPC_I2C_DAT, RSVD2, RSVD3, 0x10e8, 0, Y, 5, 7, 6, 8, -1, 10, 12), | |
| 1994 | - | PINGROUP(soc_gpio86_phh3, RSVD0, SPI5_CS1, TSC_EDGE_OUT3, TSC_EDGE_OUT0D, 0x1100, 0, Y, 5, 7, 6, 8, -1, 10, 12), | |
| 1995 | - | PINGROUP(soc_gpio72_pff3, PPC_MODE_2, RSVD1, RSVD2, RSVD3, 0x1108, 0, Y, 5, 7, 6, 8, -1, 10, 12), | |
| 1996 | - | PINGROUP(soc_gpio77_pgg0, RSVD0, RSVD1, TSC_EDGE_OUT1, TSC_EDGE_OUT0B, 0x1110, 0, Y, -1, 7, 6, 8, -1, 10, 12), | |
| 1997 | - | PINGROUP(soc_gpio80_pff6, RSVD0, PPC_RST_N, RSVD2, RSVD3, 0x1118, 0, Y, 5, 7, 6, 8, -1, 10, 12), | |
| 1998 | - | PINGROUP(soc_gpio84_pgg1, RSVD0, RSVD1, TSC_EDGE_OUT2, TSC_EDGE_OUT0C, 0x1120, 0, Y, -1, 7, 6, 8, -1, 10, 12), | |
| 1999 | - | PINGROUP(soc_gpio83_pee5, RSVD0, RSVD1, RSVD2, RSVD3, 0x1128, 0, Y, -1, 7, 6, 8, -1, 10, 12), | |
| 2000 | - | PINGROUP(soc_gpio73_pff4, PPC_CC, PPC_I2C_CLK, RSVD2, RSVD3, 0x1130, 0, Y, 5, 7, 6, 8, -1, 10, 12), | |
| 2001 | - | PINGROUP(soc_gpio70_pff1, PPC_MODE_0, RSVD1, RSVD2, RSVD3, 0x1138, 0, Y, 5, 7, 6, 8, -1, 10, 12), | |
| 2002 | - | PINGROUP(soc_gpio85_pgg6, RSVD0, SPI4_CS1, RSVD2, RSVD3, 0x1148, 0, Y, 5, 7, 6, 8, -1, 10, 12), | |
| 2003 | - | PINGROUP(soc_gpio69_pff0, PPC_INT_N, RSVD1, RSVD2, RSVD3, 0x1150, 0, Y, 5, 7, 6, 8, -1, 10, 12), | |
| 2004 | - | PINGROUP(uart5_tx_pgg7, UARTE_TXD, SPI5_SCK, RSVD2, RSVD3, 0x1168, 0, Y, 5, 7, 6, 8, -1, 10, 12), | |
| 2005 | - | PINGROUP(uart5_rx_phh0, UARTE_RXD, SPI5_MISO, RSVD2, RSVD3, 0x1170, 0, Y, 5, 7, 6, 8, -1, 10, 12), | |
| 2006 | - | PINGROUP(uart2_tx_pgg2, UARTB_TXD, SPI4_SCK, RSVD2, RSVD3, 0x1178, 0, Y, 5, 7, 6, 8, -1, 10, 12), | |
| 2007 | - | PINGROUP(uart2_rx_pgg3, UARTB_RXD, SPI4_MISO, RSVD2, RSVD3, 0x1180, 0, Y, 5, 7, 6, 8, -1, 10, 12), | |
| 2008 | - | PINGROUP(uart2_cts_pgg5, UARTB_CTS, SPI4_CS0, RSVD2, RSVD3, 0x1188, 0, Y, 5, 7, 6, 8, -1, 10, 12), | |
| 2009 | - | PINGROUP(uart2_rts_pgg4, UARTB_RTS, SPI4_MOSI, RSVD2, RSVD3, 0x1190, 0, Y, 5, 7, 6, 8, -1, 10, 12), | |
| 2010 | - | PINGROUP(uart5_cts_phh2, UARTE_CTS, SPI5_CS0, RSVD2, RSVD3, 0x1198, 0, Y, 5, 7, 6, 8, -1, 10, 12), | |
| 2011 | - | PINGROUP(uart5_rts_phh1, UARTE_RTS, SPI5_MOSI, RSVD2, RSVD3, 0x11a0, 0, Y, 5, 7, 6, 8, -1, 10, 12), | |
| 2012 | - | PINGROUP(pwm2_pdd7, GP_PWM2, LED_BLINK, RSVD2, RSVD3, 0x11b0, 0, Y, 5, 7, 6, 8, -1, 10, 12), | |
| 2013 | - | PINGROUP(pwm3_pee0, GP_PWM3, RSVD1, RSVD2, RSVD3, 0x11b8, 0, Y, 5, 7, 6, 8, -1, 10, 12), | |
| 2014 | - | PINGROUP(pwm7_pee1, GP_PWM7, RSVD1, RSVD2, RSVD3, 0x11a8, 0, Y, 5, 7, 6, 8, -1, 10, 12), | |
| 1964 | + | PINGROUP(bootv_ctl_n_paa0, RSVD0, RSVD1, RSVD2, RSVD3, 0x1028, 1, Y, -1, 7, 6, 8, -1, 10, 12), | |
| 1965 | + | PINGROUP(soc_gpio00_paa1, RSVD0, RSVD1, RSVD2, RSVD3, 0x10f0, 1, Y, 5, 7, 6, 8, -1, 10, 12), | |
| 1966 | + | PINGROUP(vcomp_alert_paa2, SOC_THERM_OC1, RSVD1, RSVD2, RSVD3, 0x1058, 1, Y, 5, 7, 6, 8, -1, 10, 12), | |
| 1967 | + | PINGROUP(pwm1_paa3, GP_PWM1, RSVD1, RSVD2, RSVD3, 0x11c0, 1, Y, 5, 7, 6, 8, -1, 10, 12), | |
| 1968 | + | PINGROUP(batt_oc_paa4, SOC_THERM_OC2, RSVD1, RSVD2, RSVD3, 0x1020, 1, Y, 5, 7, 6, 8, -1, 10, 12), | |
| 1969 | + | PINGROUP(soc_gpio04_paa5, RSVD0, RSVD1, RSVD2, RSVD3, 0x1140, 1, Y, 5, 7, 6, 8, -1, 10, 12), | |
| 1970 | + | PINGROUP(soc_gpio25_paa6, RSVD0, RSVD1, RSVD2, RSVD3, 0x1158, 1, Y, -1, 7, 6, 8, -1, 10, 12), | |
| 1971 | + | PINGROUP(soc_gpio26_paa7, RSVD0, SOC_THERM_OC3, RSVD2, RSVD3, 0x1160, 1, Y, -1, 7, 6, 8, -1, 10, 12), | |
| 1972 | + | PINGROUP(hdmi_cec_pbb0, HDMI_CEC, RSVD1, RSVD2, RSVD3, 0x1060, 1, Y, 5, 7, 6, 8, -1, 10, 12), | |
| 1973 | + | PINGROUP(spi2_sck_pcc0, SPI2_SCK, RSVD1, RSVD2, RSVD3, 0x10b0, 1, Y, -1, 7, 6, 8, -1, 10, 12), | |
| 1974 | + | PINGROUP(spi2_miso_pcc1, SPI2_DIN, RSVD1, RSVD2, RSVD3, 0x10b8, 1, Y, -1, 7, 6, 8, -1, 10, 12), | |
| 1975 | + | PINGROUP(spi2_mosi_pcc2, SPI2_DOUT, RSVD1, RSVD2, RSVD3, 0x1090, 1, Y, -1, 7, 6, 8, -1, 10, 12), | |
| 1976 | + | PINGROUP(spi2_cs0_pcc3, SPI2_CS0, RSVD1, RSVD2, RSVD3, 0x10a0, 1, Y, -1, 7, 6, 8, -1, 10, 12), | |
| 1977 | + | PINGROUP(spi2_cs1_pcc4, SPI2_CS1, RSVD1, RSVD2, RSVD3, 0x11c8, 1, Y, -1, 7, 6, 8, -1, 10, 12), | |
| 1978 | + | PINGROUP(uart3_tx_pcc5, UARTC_TXD, RSVD1, RSVD2, RSVD3, 0x1078, 1, Y, 5, 7, 6, 8, -1, 10, 12), | |
| 1979 | + | PINGROUP(uart3_rx_pcc6, UARTC_RXD, RSVD1, RSVD2, RSVD3, 0x1070, 1, Y, 5, 7, 6, 8, -1, 10, 12), | |
| 1980 | + | PINGROUP(gen2_i2c_scl_pcc7, I2C2_CLK, RSVD1, RSVD2, RSVD3, 0x1098, 1, Y, 5, 7, 6, 8, -1, 10, 12), | |
| 1981 | + | PINGROUP(gen2_i2c_sda_pdd0, I2C2_DAT, RSVD1, RSVD2, RSVD3, 0x10a8, 1, Y, 5, 7, 6, 8, -1, 10, 12), | |
| 1982 | + | PINGROUP(gen8_i2c_scl_pdd1, I2C8_CLK, RSVD1, RSVD2, RSVD3, 0x1088, 1, Y, 5, 7, 6, 8, -1, 10, 12), | |
| 1983 | + | PINGROUP(gen8_i2c_sda_pdd2, I2C8_DAT, RSVD1, RSVD2, RSVD3, 0x1080, 1, Y, 5, 7, 6, 8, -1, 10, 12), | |
| 1984 | + | PINGROUP(touch_clk_pdd3, GP_PWM4, TOUCH_CLK, RSVD2, RSVD3, 0x1068, 1, Y, 5, 7, 6, 8, -1, 10, 12), | |
| 1985 | + | PINGROUP(dmic1_clk_pdd4, DMIC1_CLK, RSVD1, DMIC5_CLK, RSVD3, 0x11d0, 1, Y, -1, 7, 6, 8, -1, 10, 12), | |
| 1986 | + | PINGROUP(dmic1_dat_pdd5, DMIC1_DAT, RSVD1, DMIC5_DAT, RSVD3, 0x11d8, 1, Y, -1, 7, 6, 8, -1, 10, 12), | |
| 1987 | + | PINGROUP(soc_gpio19_pdd6, RSVD0, WDT_RESET_OUTB, RSVD2, RSVD3, 0x10f8, 1, Y, -1, 7, 6, 8, -1, 10, 12), | |
| 1988 | + | PINGROUP(soc_gpio49_pee2, RSVD0, RSVD1, RSVD2, RSVD3, 0x10c0, 1, Y, -1, 7, 6, 8, -1, 10, 12), | |
| 1989 | + | PINGROUP(soc_gpio50_pee4, RSVD0, RSVD1, RSVD2, RSVD3, 0x10c8, 1, Y, -1, 7, 6, 8, -1, 10, 12), | |
| 1990 | + | PINGROUP(soc_gpio82_pee3, RSVD0, RSVD1, RSVD2, RSVD3, 0x10d0, 1, Y, -1, 7, 6, 8, -1, 10, 12), | |
| 1991 | + | PINGROUP(soc_gpio71_pff2, PPC_MODE_1, RSVD1, RSVD2, RSVD3, 0x10d8, 1, Y, 5, 7, 6, 8, -1, 10, 12), | |
| 1992 | + | PINGROUP(soc_gpio76_pff7, RSVD0, RSVD1, TSC_EDGE_OUT0, TSC_EDGE_OUT0A, 0x10e0, 1, Y, -1, 7, 6, 8, -1, 10, 12), | |
| 1993 | + | PINGROUP(soc_gpio74_pff5, PPC_READY, PPC_I2C_DAT, RSVD2, RSVD3, 0x10e8, 1, Y, 5, 7, 6, 8, -1, 10, 12), | |
| 1994 | + | PINGROUP(soc_gpio86_phh3, RSVD0, SPI5_CS1, TSC_EDGE_OUT3, TSC_EDGE_OUT0D, 0x1100, 1, Y, 5, 7, 6, 8, -1, 10, 12), | |
| 1995 | + | PINGROUP(soc_gpio72_pff3, PPC_MODE_2, RSVD1, RSVD2, RSVD3, 0x1108, 1, Y, 5, 7, 6, 8, -1, 10, 12), | |
| 1996 | + | PINGROUP(soc_gpio77_pgg0, RSVD0, RSVD1, TSC_EDGE_OUT1, TSC_EDGE_OUT0B, 0x1110, 1, Y, -1, 7, 6, 8, -1, 10, 12), | |
| 1997 | + | PINGROUP(soc_gpio80_pff6, RSVD0, PPC_RST_N, RSVD2, RSVD3, 0x1118, 1, Y, 5, 7, 6, 8, -1, 10, 12), | |
| 1998 | + | PINGROUP(soc_gpio84_pgg1, RSVD0, RSVD1, TSC_EDGE_OUT2, TSC_EDGE_OUT0C, 0x1120, 1, Y, -1, 7, 6, 8, -1, 10, 12), | |
| 1999 | + | PINGROUP(soc_gpio83_pee5, RSVD0, RSVD1, RSVD2, RSVD3, 0x1128, 1, Y, -1, 7, 6, 8, -1, 10, 12), | |
| 2000 | + | PINGROUP(soc_gpio73_pff4, PPC_CC, PPC_I2C_CLK, RSVD2, RSVD3, 0x1130, 1, Y, 5, 7, 6, 8, -1, 10, 12), | |
| 2001 | + | PINGROUP(soc_gpio70_pff1, PPC_MODE_0, RSVD1, RSVD2, RSVD3, 0x1138, 1, Y, 5, 7, 6, 8, -1, 10, 12), | |
| 2002 | + | PINGROUP(soc_gpio85_pgg6, RSVD0, SPI4_CS1, RSVD2, RSVD3, 0x1148, 1, Y, 5, 7, 6, 8, -1, 10, 12), | |
| 2003 | + | PINGROUP(soc_gpio69_pff0, PPC_INT_N, RSVD1, RSVD2, RSVD3, 0x1150, 1, Y, 5, 7, 6, 8, -1, 10, 12), | |
| 2004 | + | PINGROUP(uart5_tx_pgg7, UARTE_TXD, SPI5_SCK, RSVD2, RSVD3, 0x1168, 1, Y, 5, 7, 6, 8, -1, 10, 12), | |
| 2005 | + | PINGROUP(uart5_rx_phh0, UARTE_RXD, SPI5_MISO, RSVD2, RSVD3, 0x1170, 1, Y, 5, 7, 6, 8, -1, 10, 12), | |
| 2006 | + | PINGROUP(uart2_tx_pgg2, UARTB_TXD, SPI4_SCK, RSVD2, RSVD3, 0x1178, 1, Y, 5, 7, 6, 8, -1, 10, 12), | |
| 2007 | + | PINGROUP(uart2_rx_pgg3, UARTB_RXD, SPI4_MISO, RSVD2, RSVD3, 0x1180, 1, Y, 5, 7, 6, 8, -1, 10, 12), | |
| 2008 | + | PINGROUP(uart2_cts_pgg5, UARTB_CTS, SPI4_CS0, RSVD2, RSVD3, 0x1188, 1, Y, 5, 7, 6, 8, -1, 10, 12), | |
| 2009 | + | PINGROUP(uart2_rts_pgg4, UARTB_RTS, SPI4_MOSI, RSVD2, RSVD3, 0x1190, 1, Y, 5, 7, 6, 8, -1, 10, 12), | |
| 2010 | + | PINGROUP(uart5_cts_phh2, UARTE_CTS, SPI5_CS0, RSVD2, RSVD3, 0x1198, 1, Y, 5, 7, 6, 8, -1, 10, 12), | |
| 2011 | + | PINGROUP(uart5_rts_phh1, UARTE_RTS, SPI5_MOSI, RSVD2, RSVD3, 0x11a0, 1, Y, 5, 7, 6, 8, -1, 10, 12), | |
| 2012 | + | PINGROUP(pwm2_pdd7, GP_PWM2, LED_BLINK, RSVD2, RSVD3, 0x11b0, 1, Y, 5, 7, 6, 8, -1, 10, 12), | |
| 2013 | + | PINGROUP(pwm3_pee0, GP_PWM3, RSVD1, RSVD2, RSVD3, 0x11b8, 1, Y, 5, 7, 6, 8, -1, 10, 12), | |
| 2014 | + | PINGROUP(pwm7_pee1, GP_PWM7, RSVD1, RSVD2, RSVD3, 0x11a8, 1, Y, 5, 7, 6, 8, -1, 10, 12), | |
| 2015 | 2015 | }; | |
| 2016 | 2016 | ||
| 2017 | 2017 | static const struct tegra_pinctrl_soc_data tegra238_pinctrl_aon = { | |
modified drivers/power/sequencing/Kconfig
| @@ -29,8 +29,7 @@ config POWER_SEQUENCING_QCOM_WCN | |||
| 29 | 29 | ||
| 30 | 30 | config POWER_SEQUENCING_TH1520_GPU | |
| 31 | 31 | tristate "T-HEAD TH1520 GPU power sequencing driver" | |
| 32 | - | depends on ARCH_THEAD || COMPILE_TEST | |
| 33 | - | select AUXILIARY_BUS | |
| 32 | + | depends on (ARCH_THEAD && AUXILIARY_BUS) || COMPILE_TEST | |
| 34 | 33 | help | |
| 35 | 34 | Say Y here to enable the power sequencing driver for the TH1520 SoC | |
| 36 | 35 | GPU. This driver handles the complex clock and reset sequence | |
modified drivers/power/sequencing/core.c
| @@ -101,7 +101,6 @@ static struct pwrseq_unit *pwrseq_unit_new(const struct pwrseq_unit_data *data) | |||
| 101 | 101 | } | |
| 102 | 102 | ||
| 103 | 103 | kref_init(&unit->ref); | |
| 104 | - | INIT_LIST_HEAD(&unit->list); | |
| 105 | 104 | INIT_LIST_HEAD(&unit->deps); | |
| 106 | 105 | unit->enable = data->enable; | |
| 107 | 106 | unit->disable = data->disable; | |
| @@ -505,6 +504,10 @@ pwrseq_device_register(const struct pwrseq_config *config) | |||
| 505 | 504 | */ | |
| 506 | 505 | device_initialize(&pwrseq->dev); | |
| 507 | 506 | ||
| 507 | + | ret = dev_set_name(&pwrseq->dev, "pwrseq.%d", pwrseq->id); | |
| 508 | + | if (ret) | |
| 509 | + | goto err_put_pwrseq; | |
| 510 | + | ||
| 508 | 511 | pwrseq->owner = config->owner ?: THIS_MODULE; | |
| 509 | 512 | pwrseq->match = config->match; | |
| 510 | 513 | ||
| @@ -513,10 +516,6 @@ pwrseq_device_register(const struct pwrseq_config *config) | |||
| 513 | 516 | INIT_LIST_HEAD(&pwrseq->targets); | |
| 514 | 517 | INIT_LIST_HEAD(&pwrseq->units); | |
| 515 | 518 | ||
| 516 | - | ret = dev_set_name(&pwrseq->dev, "pwrseq.%d", pwrseq->id); | |
| 517 | - | if (ret) | |
| 518 | - | goto err_put_pwrseq; | |
| 519 | - | ||
| 520 | 519 | ret = pwrseq_setup_targets(config->targets, pwrseq); | |
| 521 | 520 | if (ret) | |
| 522 | 521 | goto err_put_pwrseq; | |
| @@ -913,8 +912,6 @@ int pwrseq_enable(struct pwrseq_desc *desc) | |||
| 913 | 912 | if (!ret) | |
| 914 | 913 | desc->powered_on = true; | |
| 915 | 914 | } | |
| 916 | - | if (ret) | |
| 917 | - | return ret; | |
| 918 | 915 | ||
| 919 | 916 | if (target->post_enable) { | |
| 920 | 917 | ret = target->post_enable(pwrseq); | |
modified drivers/remoteproc/qcom_q6v5_adsp.c
| @@ -104,7 +104,6 @@ struct qcom_adsp { | |||
| 104 | 104 | struct completion stop_done; | |
| 105 | 105 | ||
| 106 | 106 | phys_addr_t mem_phys; | |
| 107 | - | unsigned long iova; | |
| 108 | 107 | phys_addr_t mem_reloc; | |
| 109 | 108 | void __iomem *mem_region; | |
| 110 | 109 | size_t mem_size; | |
| @@ -334,7 +333,7 @@ static void adsp_unmap_carveout(struct rproc *rproc) | |||
| 334 | 333 | struct qcom_adsp *adsp = rproc->priv; | |
| 335 | 334 | ||
| 336 | 335 | if (adsp->has_iommu) | |
| 337 | - | iommu_unmap(rproc->domain, adsp->iova, adsp->mem_size); | |
| 336 | + | iommu_unmap(rproc->domain, adsp->mem_phys, adsp->mem_size); | |
| 338 | 337 | } | |
| 339 | 338 | ||
| 340 | 339 | static int adsp_map_carveout(struct rproc *rproc) | |
| @@ -342,6 +341,7 @@ static int adsp_map_carveout(struct rproc *rproc) | |||
| 342 | 341 | struct qcom_adsp *adsp = rproc->priv; | |
| 343 | 342 | struct of_phandle_args args; | |
| 344 | 343 | long long sid; | |
| 344 | + | unsigned long iova; | |
| 345 | 345 | int ret; | |
| 346 | 346 | ||
| 347 | 347 | if (!adsp->has_iommu) | |
| @@ -358,9 +358,9 @@ static int adsp_map_carveout(struct rproc *rproc) | |||
| 358 | 358 | of_node_put(args.np); | |
| 359 | 359 | ||
| 360 | 360 | /* Add SID configuration for ADSP Firmware to SMMU */ | |
| 361 | - | adsp->iova = adsp->mem_phys | (sid << 32); | |
| 361 | + | iova = adsp->mem_phys | (sid << 32); | |
| 362 | 362 | ||
| 363 | - | ret = iommu_map(rproc->domain, adsp->iova, adsp->mem_phys, | |
| 363 | + | ret = iommu_map(rproc->domain, iova, adsp->mem_phys, | |
| 364 | 364 | adsp->mem_size, IOMMU_READ | IOMMU_WRITE, | |
| 365 | 365 | GFP_KERNEL); | |
| 366 | 366 | if (ret) { | |
modified drivers/remoteproc/qcom_q6v5_mss.c
| @@ -2079,16 +2079,7 @@ static int q6v5_probe(struct platform_device *pdev) | |||
| 2079 | 2079 | if (!desc) | |
| 2080 | 2080 | return -EINVAL; | |
| 2081 | 2081 | ||
| 2082 | - | /* | |
| 2083 | - | * Memory protection is done through qcom_scm_assign_mem(), which needs | |
| 2084 | - | * SCM but not PAS. Only the memory setup path issues PAS calls, so | |
| 2085 | - | * requiring PAS for every need_mem_protection platform prevents the | |
| 2086 | - | * modem from probing at all on TZ firmware that offers no PAS. | |
| 2087 | - | */ | |
| 2088 | - | if (desc->need_mem_protection && !qcom_scm_is_available()) | |
| 2089 | - | return -EPROBE_DEFER; | |
| 2090 | - | ||
| 2091 | - | if (desc->need_pas_mem_setup && !qcom_pas_is_available()) | |
| 2082 | + | if (desc->need_mem_protection && !qcom_pas_is_available()) | |
| 2092 | 2083 | return -EPROBE_DEFER; | |
| 2093 | 2084 | ||
| 2094 | 2085 | mba_image = desc->hexagon_mba_image; | |
modified drivers/remoteproc/qcom_q6v5_pas.c
| @@ -405,7 +405,6 @@ static int qcom_pas_stop(struct rproc *rproc) | |||
| 405 | 405 | { | |
| 406 | 406 | struct qcom_pas *pas = rproc->priv; | |
| 407 | 407 | int handover; | |
| 408 | - | int dtb_ret; | |
| 409 | 408 | int ret; | |
| 410 | 409 | ||
| 411 | 410 | ret = qcom_q6v5_request_stop(&pas->q6v5, pas->sysmon); | |
| @@ -420,12 +419,9 @@ static int qcom_pas_stop(struct rproc *rproc) | |||
| 420 | 419 | dev_err(pas->dev, "failed to shutdown: %d\n", ret); | |
| 421 | 420 | ||
| 422 | 421 | if (pas->dtb_pas_id) { | |
| 423 | - | dtb_ret = qcom_pas_shutdown(pas->dtb_pas_id); | |
| 424 | - | if (dtb_ret) | |
| 425 | - | dev_err(pas->dev, "failed to shutdown dtb: %d\n", dtb_ret); | |
| 426 | - | ||
| 427 | - | if (!ret && dtb_ret) | |
| 428 | - | ret = dtb_ret; | |
| 422 | + | ret = qcom_pas_shutdown(pas->dtb_pas_id); | |
| 423 | + | if (ret) | |
| 424 | + | dev_err(pas->dev, "failed to shutdown dtb: %d\n", ret); | |
| 429 | 425 | ||
| 430 | 426 | qcom_pas_unmap_carveout(rproc, pas->dtb_mem_phys, pas->dtb_mem_size); | |
| 431 | 427 | } | |
| @@ -528,6 +524,7 @@ static int qcom_pas_attach(struct rproc *rproc) | |||
| 528 | 524 | int ret; | |
| 529 | 525 | ||
| 530 | 526 | pas->q6v5.handover_issued = true; | |
| 527 | + | enable_irq(pas->q6v5.handover_irq); | |
| 531 | 528 | ||
| 532 | 529 | pas->q6v5.running = true; | |
| 533 | 530 | ret = irq_get_irqchip_state(pas->q6v5.fatal_irq, | |
| @@ -573,6 +570,7 @@ unroll_attach: | |||
| 573 | 570 | pas->rproc->state = RPROC_OFFLINE; | |
| 574 | 571 | ret = -EINVAL; | |
| 575 | 572 | disable_running: | |
| 573 | + | disable_irq(pas->q6v5.handover_irq); | |
| 576 | 574 | pas->q6v5.running = false; | |
| 577 | 575 | ||
| 578 | 576 | return ret; | |
modified drivers/s390/block/dasd_3990_erp.c
| @@ -103,7 +103,7 @@ dasd_3990_erp_int_req(struct dasd_ccw_req * erp) | |||
| 103 | 103 | ||
| 104 | 104 | /* first time set initial retry counter and erp_function */ | |
| 105 | 105 | /* and retry once without blocking queue */ | |
| 106 | - | /* (this enables easier enqueuing of the cqr) */ | |
| 106 | + | /* (this enables easier enqueing of the cqr) */ | |
| 107 | 107 | if (erp->function != dasd_3990_erp_int_req) { | |
| 108 | 108 | ||
| 109 | 109 | erp->retries = 256; | |
| @@ -302,7 +302,7 @@ dasd_3990_erp_action_4(struct dasd_ccw_req * erp, char *sense) | |||
| 302 | 302 | ||
| 303 | 303 | /* first time set initial retry counter and erp_function */ | |
| 304 | 304 | /* and retry once without waiting for state change pending */ | |
| 305 | - | /* interrupt (this enables easier enqueuing of the cqr) */ | |
| 305 | + | /* interrupt (this enables easier enqueing of the cqr) */ | |
| 306 | 306 | if (erp->function != dasd_3990_erp_action_4) { | |
| 307 | 307 | ||
| 308 | 308 | DBF_DEV_EVENT(DBF_INFO, device, "%s", | |
| @@ -1078,7 +1078,7 @@ dasd_3990_erp_bus_out(struct dasd_ccw_req * erp) | |||
| 1078 | 1078 | ||
| 1079 | 1079 | /* first time set initial retry counter and erp_function */ | |
| 1080 | 1080 | /* and retry once without blocking queue */ | |
| 1081 | - | /* (this enables easier enqueuing of the cqr) */ | |
| 1081 | + | /* (this enables easier enqueing of the cqr) */ | |
| 1082 | 1082 | if (erp->function != dasd_3990_erp_bus_out) { | |
| 1083 | 1083 | erp->retries = 256; | |
| 1084 | 1084 | erp->function = dasd_3990_erp_bus_out; | |
modified drivers/s390/block/dasd_eckd.c
| @@ -2060,7 +2060,7 @@ dasd_eckd_psf_ssc(struct dasd_device *device, int enable_pav, | |||
| 2060 | 2060 | } | |
| 2061 | 2061 | ||
| 2062 | 2062 | /* | |
| 2063 | - | * Valid storage server of current device. | |
| 2063 | + | * Valide storage server of current device. | |
| 2064 | 2064 | */ | |
| 2065 | 2065 | static int dasd_eckd_validate_server(struct dasd_device *device, | |
| 2066 | 2066 | unsigned long flags) | |
| @@ -5672,7 +5672,7 @@ static struct dasd_ccw_req *dasd_eckd_build_cp_raw(struct dasd_device *startdev, | |||
| 5672 | 5672 | char *dst; | |
| 5673 | 5673 | ||
| 5674 | 5674 | /* | |
| 5675 | - | * raw track access needs to be multiple of 64k and on 64k boundary | |
| 5675 | + | * raw track access needs to be mutiple of 64k and on 64k boundary | |
| 5676 | 5676 | * For read requests we can fix an incorrect alignment by padding | |
| 5677 | 5677 | * the request with dummy pages. | |
| 5678 | 5678 | */ | |
modified drivers/s390/char/raw3270.c
| @@ -420,7 +420,7 @@ struct raw3270_ua { /* Query Reply structure for Usable Area */ | |||
| 420 | 420 | char flags0; | |
| 421 | 421 | char flags1; | |
| 422 | 422 | short w; /* Width of usable area */ | |
| 423 | - | short h; /* Height of usavle area */ | |
| 423 | + | short h; /* Heigth of usavle area */ | |
| 424 | 424 | char units; /* 0x00:in; 0x01:mm */ | |
| 425 | 425 | int xr; | |
| 426 | 426 | int yr; | |
modified drivers/s390/char/vmlogrdr.c
| @@ -444,7 +444,7 @@ static int vmlogrdr_receive_data(struct vmlogrdr_priv_t *priv) | |||
| 444 | 444 | spin_unlock_bh(&priv->priv_lock); | |
| 445 | 445 | /* An rc of 5 indicates that the record was bigger than | |
| 446 | 446 | * the buffer, which is OK for us. A 9 indicates that the | |
| 447 | - | * record was purged before we could receive it. | |
| 447 | + | * record was purged befor we could receive it. | |
| 448 | 448 | */ | |
| 449 | 449 | if (rc == 5) | |
| 450 | 450 | rc = 0; | |
modified drivers/s390/cio/chp.c
| @@ -78,9 +78,6 @@ u8 chp_get_sch_opm(struct subchannel *sch) | |||
| 78 | 78 | int opm; | |
| 79 | 79 | int i; | |
| 80 | 80 | ||
| 81 | - | if (!sch->schib.pmcw.dnv) | |
| 82 | - | return 0; | |
| 83 | - | ||
| 84 | 81 | opm = 0; | |
| 85 | 82 | chp_id_init(&chpid); | |
| 86 | 83 | for (i = 0; i < 8; i++) { | |
modified drivers/s390/cio/cio.c
| @@ -453,8 +453,7 @@ EXPORT_SYMBOL_GPL(cio_commit_config); | |||
| 453 | 453 | /** | |
| 454 | 454 | * cio_update_schib - Perform stsch and update schib if subchannel is valid. | |
| 455 | 455 | * @sch: subchannel on which to perform stsch | |
| 456 | - | * Return zero on success, -ENODEV if the subchannel is not operational, | |
| 457 | - | * -EACCES if the subchannel has no valid device. | |
| 456 | + | * Return zero on success, -ENODEV otherwise. | |
| 458 | 457 | */ | |
| 459 | 458 | int cio_update_schib(struct subchannel *sch) | |
| 460 | 459 | { | |
| @@ -463,13 +462,11 @@ int cio_update_schib(struct subchannel *sch) | |||
| 463 | 462 | if (stsch(sch->schid, &schib)) | |
| 464 | 463 | return -ENODEV; | |
| 465 | 464 | ||
| 466 | - | if (!css_sch_is_valid(&schib)) { | |
| 467 | - | memset(&sch->schib, 0, sizeof(sch->schib)); | |
| 468 | - | return -EACCES; | |
| 469 | - | } | |
| 470 | - | ||
| 471 | 465 | memcpy(&sch->schib, &schib, sizeof(schib)); | |
| 472 | 466 | ||
| 467 | + | if (!css_sch_is_valid(&schib)) | |
| 468 | + | return -EACCES; | |
| 469 | + | ||
| 473 | 470 | return 0; | |
| 474 | 471 | } | |
| 475 | 472 | EXPORT_SYMBOL_GPL(cio_update_schib); | |
modified drivers/s390/cio/cio.h
| @@ -7,7 +7,6 @@ | |||
| 7 | 7 | #include <linux/mod_devicetable.h> | |
| 8 | 8 | #include <asm/chpid.h> | |
| 9 | 9 | #include <asm/cio.h> | |
| 10 | - | #include <asm/dma-types.h> | |
| 11 | 10 | #include <asm/fcx.h> | |
| 12 | 11 | #include <asm/schid.h> | |
| 13 | 12 | #include <asm/tpi.h> | |
| @@ -50,7 +49,7 @@ struct pmcw { | |||
| 50 | 49 | ||
| 51 | 50 | /* Target SCHIB configuration. */ | |
| 52 | 51 | struct schib_config { | |
| 53 | - | dma64_t mba; | |
| 52 | + | u64 mba; | |
| 54 | 53 | u32 intparm; | |
| 55 | 54 | u16 mbi; | |
| 56 | 55 | u32 isc:3; | |
| @@ -67,7 +66,7 @@ struct schib_config { | |||
| 67 | 66 | struct schib { | |
| 68 | 67 | struct pmcw pmcw; /* path management control word */ | |
| 69 | 68 | union scsw scsw; /* subchannel status word */ | |
| 70 | - | dma64_t mba; /* measurement block address */ | |
| 69 | + | __u64 mba; /* measurement block address */ | |
| 71 | 70 | __u8 mda[4]; /* model dependent area */ | |
| 72 | 71 | } __attribute__ ((packed,aligned(4))); | |
| 73 | 72 | ||
modified drivers/s390/cio/cmf.c
| @@ -183,7 +183,7 @@ static int set_schib(struct ccw_device *cdev, u32 mme, int mbfc, | |||
| 183 | 183 | sch->config.mbfc = mbfc; | |
| 184 | 184 | /* address can be either a block address or a block index */ | |
| 185 | 185 | if (mbfc) | |
| 186 | - | sch->config.mba = address ? virt_to_dma64((void *)address) : 0; | |
| 186 | + | sch->config.mba = address; | |
| 187 | 187 | else | |
| 188 | 188 | sch->config.mbi = address; | |
| 189 | 189 | ||
modified drivers/s390/cio/device.c
| @@ -922,7 +922,7 @@ static int ccw_device_move_to_sch(struct ccw_device *cdev, | |||
| 922 | 922 | ||
| 923 | 923 | if (!sch_is_pseudo_sch(old_sch)) { | |
| 924 | 924 | spin_lock_irq(&old_sch->lock); | |
| 925 | - | old_enabled = old_sch->schib.pmcw.dnv && old_sch->schib.pmcw.ena; | |
| 925 | + | old_enabled = old_sch->schib.pmcw.ena; | |
| 926 | 926 | rc = 0; | |
| 927 | 927 | if (old_enabled) | |
| 928 | 928 | rc = cio_disable_subchannel(old_sch); | |
| @@ -941,7 +941,7 @@ static int ccw_device_move_to_sch(struct ccw_device *cdev, | |||
| 941 | 941 | CIO_MSG_EVENT(0, "device_move(0.%x.%04x,0.%x.%04x)=%d\n", | |
| 942 | 942 | cdev->private->dev_id.ssid, | |
| 943 | 943 | cdev->private->dev_id.devno, sch->schid.ssid, | |
| 944 | - | sch->schid.sch_no, rc); | |
| 944 | + | sch->schib.pmcw.dev, rc); | |
| 945 | 945 | if (old_enabled) { | |
| 946 | 946 | /* Try to re-enable the old subchannel. */ | |
| 947 | 947 | spin_lock_irq(&old_sch->lock); | |
| @@ -1207,7 +1207,7 @@ static void io_subchannel_quiesce(struct subchannel *sch) | |||
| 1207 | 1207 | cdev = sch_get_cdev(sch); | |
| 1208 | 1208 | if (cio_is_console(sch->schid)) | |
| 1209 | 1209 | goto out_unlock; | |
| 1210 | - | if (!sch->schib.pmcw.dnv || !sch->schib.pmcw.ena) | |
| 1210 | + | if (!sch->schib.pmcw.ena) | |
| 1211 | 1211 | goto out_unlock; | |
| 1212 | 1212 | ret = cio_disable_subchannel(sch); | |
| 1213 | 1213 | if (ret != -EBUSY) | |
| @@ -1254,8 +1254,7 @@ static int recovery_check(struct device *dev, void *data) | |||
| 1254 | 1254 | switch (cdev->private->state) { | |
| 1255 | 1255 | case DEV_STATE_ONLINE: | |
| 1256 | 1256 | sch = to_subchannel(cdev->dev.parent); | |
| 1257 | - | if (sch->schib.pmcw.dnv && | |
| 1258 | - | (sch->schib.pmcw.pam & sch->opm) == sch->vpm) | |
| 1257 | + | if ((sch->schib.pmcw.pam & sch->opm) == sch->vpm) | |
| 1259 | 1258 | break; | |
| 1260 | 1259 | fallthrough; | |
| 1261 | 1260 | case DEV_STATE_DISCONNECTED: | |
modified drivers/s390/cio/device_fsm.c
| @@ -170,9 +170,6 @@ __recover_lost_chpids(struct subchannel *sch, int old_lpm) | |||
| 170 | 170 | int mask, i; | |
| 171 | 171 | struct chp_id chpid; | |
| 172 | 172 | ||
| 173 | - | if (!sch->schib.pmcw.dnv) | |
| 174 | - | return; | |
| 175 | - | ||
| 176 | 173 | chp_id_init(&chpid); | |
| 177 | 174 | for (i = 0; i<8; i++) { | |
| 178 | 175 | mask = 0x80 >> i; | |
modified drivers/s390/cio/device_ops.c
| @@ -142,8 +142,6 @@ int ccw_device_clear(struct ccw_device *cdev, unsigned long intparm) | |||
| 142 | 142 | if (!cdev || !cdev->dev.parent) | |
| 143 | 143 | return -ENODEV; | |
| 144 | 144 | sch = to_subchannel(cdev->dev.parent); | |
| 145 | - | if (!sch->schib.pmcw.dnv) | |
| 146 | - | return -ENODEV; | |
| 147 | 145 | if (!sch->schib.pmcw.ena) | |
| 148 | 146 | return -EINVAL; | |
| 149 | 147 | if (cdev->private->state == DEV_STATE_NOT_OPER) | |
| @@ -200,8 +198,6 @@ int ccw_device_start_timeout_key(struct ccw_device *cdev, struct ccw1 *cpa, | |||
| 200 | 198 | if (!cdev || !cdev->dev.parent) | |
| 201 | 199 | return -ENODEV; | |
| 202 | 200 | sch = to_subchannel(cdev->dev.parent); | |
| 203 | - | if (!sch->schib.pmcw.dnv) | |
| 204 | - | return -ENODEV; | |
| 205 | 201 | if (!sch->schib.pmcw.ena) | |
| 206 | 202 | return -EINVAL; | |
| 207 | 203 | if (cdev->private->state == DEV_STATE_NOT_OPER) | |
| @@ -383,8 +379,6 @@ int ccw_device_halt(struct ccw_device *cdev, unsigned long intparm) | |||
| 383 | 379 | if (!cdev || !cdev->dev.parent) | |
| 384 | 380 | return -ENODEV; | |
| 385 | 381 | sch = to_subchannel(cdev->dev.parent); | |
| 386 | - | if (!sch->schib.pmcw.dnv) | |
| 387 | - | return -ENODEV; | |
| 388 | 382 | if (!sch->schib.pmcw.ena) | |
| 389 | 383 | return -EINVAL; | |
| 390 | 384 | if (cdev->private->state == DEV_STATE_NOT_OPER) | |
| @@ -419,8 +413,6 @@ int ccw_device_resume(struct ccw_device *cdev) | |||
| 419 | 413 | if (!cdev || !cdev->dev.parent) | |
| 420 | 414 | return -ENODEV; | |
| 421 | 415 | sch = to_subchannel(cdev->dev.parent); | |
| 422 | - | if (!sch->schib.pmcw.dnv) | |
| 423 | - | return -ENODEV; | |
| 424 | 416 | if (!sch->schib.pmcw.ena) | |
| 425 | 417 | return -EINVAL; | |
| 426 | 418 | if (cdev->private->state == DEV_STATE_NOT_OPER) | |
| @@ -490,8 +482,6 @@ struct channel_path_desc_fmt0 *ccw_device_get_chp_desc(struct ccw_device *cdev, | |||
| 490 | 482 | struct chp_id chpid; | |
| 491 | 483 | ||
| 492 | 484 | sch = to_subchannel(cdev->dev.parent); | |
| 493 | - | if (!sch->schib.pmcw.dnv) | |
| 494 | - | return NULL; | |
| 495 | 485 | chp_id_init(&chpid); | |
| 496 | 486 | chpid.id = sch->schib.pmcw.chpid[chp_idx]; | |
| 497 | 487 | return chp_get_chp_desc(chpid); | |
| @@ -512,13 +502,9 @@ u8 *ccw_device_get_util_str(struct ccw_device *cdev, int chp_idx) | |||
| 512 | 502 | struct chp_id chpid; | |
| 513 | 503 | u8 *util_str; | |
| 514 | 504 | ||
| 515 | - | if (!sch->schib.pmcw.dnv) | |
| 516 | - | return NULL; | |
| 517 | 505 | chp_id_init(&chpid); | |
| 518 | 506 | chpid.id = sch->schib.pmcw.chpid[chp_idx]; | |
| 519 | 507 | chp = chpid_to_chp(chpid); | |
| 520 | - | if (!chp) | |
| 521 | - | return NULL; | |
| 522 | 508 | ||
| 523 | 509 | util_str = kmalloc(sizeof(chp->desc_fmt3.util_str), GFP_KERNEL); | |
| 524 | 510 | if (!util_str) | |
| @@ -562,8 +548,6 @@ int ccw_device_tm_start_timeout_key(struct ccw_device *cdev, struct tcw *tcw, | |||
| 562 | 548 | int rc; | |
| 563 | 549 | ||
| 564 | 550 | sch = to_subchannel(cdev->dev.parent); | |
| 565 | - | if (!sch->schib.pmcw.dnv) | |
| 566 | - | return -ENODEV; | |
| 567 | 551 | if (!sch->schib.pmcw.ena) | |
| 568 | 552 | return -EINVAL; | |
| 569 | 553 | if (cdev->private->state == DEV_STATE_VERIFY) { | |
| @@ -668,9 +652,6 @@ int ccw_device_get_mdc(struct ccw_device *cdev, u8 mask) | |||
| 668 | 652 | struct chp_id chpid; | |
| 669 | 653 | int mdc = 0, i; | |
| 670 | 654 | ||
| 671 | - | if (!sch->schib.pmcw.dnv) | |
| 672 | - | return 0; | |
| 673 | - | ||
| 674 | 655 | /* Adjust requested path mask to excluded varied off paths. */ | |
| 675 | 656 | if (mask) | |
| 676 | 657 | mask &= sch->lpm; | |
| @@ -713,8 +694,6 @@ int ccw_device_tm_intrg(struct ccw_device *cdev) | |||
| 713 | 694 | { | |
| 714 | 695 | struct subchannel *sch = to_subchannel(cdev->dev.parent); | |
| 715 | 696 | ||
| 716 | - | if (!sch->schib.pmcw.dnv) | |
| 717 | - | return -ENODEV; | |
| 718 | 697 | if (!sch->schib.pmcw.ena) | |
| 719 | 698 | return -EINVAL; | |
| 720 | 699 | if (cdev->private->state != DEV_STATE_ONLINE) | |
| @@ -807,8 +786,6 @@ int ccw_device_get_chpid(struct ccw_device *cdev, int chp_idx, u8 *chpid) | |||
| 807 | 786 | ||
| 808 | 787 | if ((chp_idx < 0) || (chp_idx > 7)) | |
| 809 | 788 | return -EINVAL; | |
| 810 | - | if (!sch->schib.pmcw.dnv) | |
| 811 | - | return -ENODEV; | |
| 812 | 789 | mask = 0x80 >> chp_idx; | |
| 813 | 790 | if (!(sch->schib.pmcw.pim & mask)) | |
| 814 | 791 | return -ENODEV; | |
modified drivers/s390/cio/vfio_ccw_fsm.c
| @@ -399,7 +399,7 @@ static void fsm_close(struct vfio_ccw_private *private, | |||
| 399 | 399 | ||
| 400 | 400 | spin_lock_irq(&sch->lock); | |
| 401 | 401 | ||
| 402 | - | if (!sch->schib.pmcw.dnv || !sch->schib.pmcw.ena) | |
| 402 | + | if (!sch->schib.pmcw.ena) | |
| 403 | 403 | goto err_unlock; | |
| 404 | 404 | ||
| 405 | 405 | ret = cio_disable_subchannel(sch); | |
modified drivers/s390/crypto/vfio_ap_ops.c
| @@ -277,9 +277,9 @@ static void vfio_ap_free_aqic_resources(struct vfio_ap_queue *q) | |||
| 277 | 277 | { | |
| 278 | 278 | if (!q) | |
| 279 | 279 | return; | |
| 280 | - | if (q->saved_isc != VFIO_AP_ISC_INVALID) { | |
| 281 | - | if (!WARN_ON(!q->matrix_mdev) && q->matrix_mdev->kvm) | |
| 282 | - | kvm_s390_gisc_unregister(q->matrix_mdev->kvm, q->saved_isc); | |
| 280 | + | if (q->saved_isc != VFIO_AP_ISC_INVALID && | |
| 281 | + | !WARN_ON(!(q->matrix_mdev && q->matrix_mdev->kvm))) { | |
| 282 | + | kvm_s390_gisc_unregister(q->matrix_mdev->kvm, q->saved_isc); | |
| 283 | 283 | q->saved_isc = VFIO_AP_ISC_INVALID; | |
| 284 | 284 | } | |
| 285 | 285 | if (q->saved_iova && !WARN_ON(!q->matrix_mdev)) { | |
| @@ -1935,8 +1935,6 @@ static int apq_status_check(int apqn, struct ap_queue_status *status) | |||
| 1935 | 1935 | * a value indicating a reset needs to be performed again. | |
| 1936 | 1936 | */ | |
| 1937 | 1937 | return -EAGAIN; | |
| 1938 | - | case AP_RESPONSE_Q_NOT_AVAIL: | |
| 1939 | - | return -ENODEV; | |
| 1940 | 1938 | default: | |
| 1941 | 1939 | WARN(true, | |
| 1942 | 1940 | "failed to verify reset of queue %02x.%04x: TAPQ rc=%u\n", | |
| @@ -1963,10 +1961,6 @@ static void apq_reset_check(struct work_struct *reset_work) | |||
| 1963 | 1961 | ret = apq_status_check(q->apqn, &status); | |
| 1964 | 1962 | if (ret == -EIO) | |
| 1965 | 1963 | return; | |
| 1966 | - | if (ret == -ENODEV) { | |
| 1967 | - | vfio_ap_free_aqic_resources(q); | |
| 1968 | - | return; | |
| 1969 | - | } | |
| 1970 | 1964 | if (ret == -EBUSY) { | |
| 1971 | 1965 | pr_notice_ratelimited(WAIT_MSG, elapsed, | |
| 1972 | 1966 | AP_QID_CARD(q->apqn), | |
| @@ -2010,7 +2004,6 @@ static void vfio_ap_mdev_reset_queue(struct vfio_ap_queue *q) | |||
| 2010 | 2004 | break; | |
| 2011 | 2005 | case AP_RESPONSE_DECONFIGURED: | |
| 2012 | 2006 | case AP_RESPONSE_CHECKSTOPPED: | |
| 2013 | - | case AP_RESPONSE_Q_NOT_AVAIL: | |
| 2014 | 2007 | vfio_ap_free_aqic_resources(q); | |
| 2015 | 2008 | break; | |
| 2016 | 2009 | default: | |
| @@ -2535,15 +2528,12 @@ void vfio_ap_mdev_remove_queue(struct ap_device *apdev) | |||
| 2535 | 2528 | /* | |
| 2536 | 2529 | * If the queue is not in the host's AP configuration, then resetting | |
| 2537 | 2530 | * it will fail with response code 01, (APQN not valid); so, let's make | |
| 2538 | - | * sure it is in the host's config. If it is not, free the KVM GISC | |
| 2539 | - | * resources. | |
| 2531 | + | * sure it is in the host's config. | |
| 2540 | 2532 | */ | |
| 2541 | 2533 | if (test_bit_inv(apid, (unsigned long *)matrix_dev->info.apm) && | |
| 2542 | 2534 | test_bit_inv(apqi, (unsigned long *)matrix_dev->info.aqm)) { | |
| 2543 | 2535 | vfio_ap_mdev_reset_queue(q); | |
| 2544 | 2536 | flush_work(&q->reset_work); | |
| 2545 | - | } else { | |
| 2546 | - | vfio_ap_free_aqic_resources(q); | |
| 2547 | 2537 | } | |
| 2548 | 2538 | ||
| 2549 | 2539 | done: | |
modified drivers/scsi/Kconfig
| @@ -753,7 +753,6 @@ config SCSI_IBMVFC | |||
| 753 | 753 | tristate "IBM Virtual FC support" | |
| 754 | 754 | depends on PPC_PSERIES && SCSI | |
| 755 | 755 | depends on SCSI_FC_ATTRS | |
| 756 | - | depends on NVME_FC || NVME_FC=n | |
| 757 | 756 | help | |
| 758 | 757 | This is the IBM POWER Virtual FC Client | |
| 759 | 758 | ||
modified drivers/scsi/fnic/fnic.h
| @@ -31,7 +31,7 @@ | |||
| 31 | 31 | ||
| 32 | 32 | #define DRV_NAME "fnic" | |
| 33 | 33 | #define DRV_DESCRIPTION "Cisco FCoE HBA Driver" | |
| 34 | - | #define DRV_VERSION "1.9.0.1" | |
| 34 | + | #define DRV_VERSION "1.9.0.0" | |
| 35 | 35 | #define PFX DRV_NAME ": " | |
| 36 | 36 | #define DFX DRV_NAME "%d: " | |
| 37 | 37 | ||
modified drivers/scsi/fnic/fnic_isr.c
| @@ -245,14 +245,7 @@ int fnic_set_intr_mode_msix(struct fnic *fnic) | |||
| 245 | 245 | unsigned int m = ARRAY_SIZE(fnic->wq); | |
| 246 | 246 | unsigned int o = ARRAY_SIZE(fnic->hw_copy_wq); | |
| 247 | 247 | unsigned int min_irqs = n + m + 1 + 1; /*rq, raw wq, wq, err*/ | |
| 248 | - | /* | |
| 249 | - | * Make driver critical vectors unmanaged, or else it can get tied | |
| 250 | - | * to an offline CPU. This can happen when hyper-threading is off. | |
| 251 | - | */ | |
| 252 | - | struct irq_affinity affd = { | |
| 253 | - | .pre_vectors = n + m + 1, /* rq, raw wq, 1 ioq */ | |
| 254 | - | .post_vectors = 1, /* err */ | |
| 255 | - | }; | |
| 248 | + | ||
| 256 | 249 | /* | |
| 257 | 250 | * We need n RQs, m WQs, o Copy WQs, n+m+o CQs, and n+m+o+1 INTRs | |
| 258 | 251 | * (last INTR is used for WQ/RQ errors and notification area) | |
| @@ -270,8 +263,8 @@ int fnic_set_intr_mode_msix(struct fnic *fnic) | |||
| 270 | 263 | int vec_count = 0; | |
| 271 | 264 | int vecs = fnic->rq_count + fnic->raw_wq_count + fnic->wq_copy_count + 1; | |
| 272 | 265 | ||
| 273 | - | vec_count = pci_alloc_irq_vectors_affinity(fnic->pdev, min_irqs, | |
| 274 | - | vecs, PCI_IRQ_MSIX|PCI_IRQ_AFFINITY, &affd); | |
| 266 | + | vec_count = pci_alloc_irq_vectors(fnic->pdev, min_irqs, vecs, | |
| 267 | + | PCI_IRQ_MSIX | PCI_IRQ_AFFINITY); | |
| 275 | 268 | FNIC_ISR_DBG(KERN_INFO, fnic, | |
| 276 | 269 | "allocated %d MSI-X vectors\n", | |
| 277 | 270 | vec_count); | |
modified drivers/scsi/fnic/fnic_main.c
| @@ -744,19 +744,8 @@ out_free_ioreq_tables: | |||
| 744 | 744 | return ret; | |
| 745 | 745 | } | |
| 746 | 746 | ||
| 747 | - | static void fnic_mq_init_queue_map(struct fnic *fnic, | |
| 748 | - | struct blk_mq_queue_map *qmap) | |
| 749 | - | { | |
| 750 | - | unsigned int cpu; | |
| 751 | - | ||
| 752 | - | for_each_possible_cpu(cpu) | |
| 753 | - | qmap->mq_map[cpu] = 0; | |
| 754 | - | } | |
| 755 | - | ||
| 756 | 747 | void fnic_mq_map_queues_cpus(struct Scsi_Host *host) | |
| 757 | 748 | { | |
| 758 | - | const struct cpumask *mask; | |
| 759 | - | unsigned int queue, cpu; | |
| 760 | 749 | struct fnic *fnic = *((struct fnic **) shost_priv(host)); | |
| 761 | 750 | struct pci_dev *l_pdev = fnic->pdev; | |
| 762 | 751 | int intr_mode = fnic->config.intr_mode; | |
| @@ -777,35 +766,7 @@ void fnic_mq_map_queues_cpus(struct Scsi_Host *host) | |||
| 777 | 766 | return; | |
| 778 | 767 | } | |
| 779 | 768 | ||
| 780 | - | fnic_mq_init_queue_map(fnic, qmap); | |
| 781 | - | ||
| 782 | - | /* | |
| 783 | - | * Setup CPU to Queue mapping for all managed MSI-X IRQs. | |
| 784 | - | * Q0 is driver critical and non-managed, hence start from Q1. | |
| 785 | - | */ | |
| 786 | - | for (queue = 1; queue < qmap->nr_queues; queue++) { | |
| 787 | - | int irq_num = pci_irq_vector(fnic->pdev, | |
| 788 | - | queue + FNIC_PCI_OFFSET); | |
| 789 | - | ||
| 790 | - | if (irq_num < 0) | |
| 791 | - | continue; | |
| 792 | - | ||
| 793 | - | mask = pci_irq_get_affinity(fnic->pdev, | |
| 794 | - | queue + FNIC_PCI_OFFSET); | |
| 795 | - | if (!mask) { | |
| 796 | - | shost_printk(KERN_ERR, host, | |
| 797 | - | "failed to get irq_affinity map for queue:%d\n", irq_num); | |
| 798 | - | continue; | |
| 799 | - | } | |
| 800 | - | FNIC_MAIN_DBG(KERN_INFO, fnic, | |
| 801 | - | "got irq_affinity map for %d:\n", irq_num); | |
| 802 | - | for_each_cpu(cpu, mask) { | |
| 803 | - | qmap->mq_map[cpu] = qmap->queue_offset + queue; | |
| 804 | - | FNIC_MAIN_DBG(KERN_INFO, fnic, | |
| 805 | - | "[Q%d] cpu:%d <=> irq:%d\n", | |
| 806 | - | queue, cpu, irq_num); | |
| 807 | - | } | |
| 808 | - | } | |
| 769 | + | blk_mq_map_hw_queues(qmap, &l_pdev->dev, FNIC_PCI_OFFSET); | |
| 809 | 770 | } | |
| 810 | 771 | ||
| 811 | 772 | static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |
modified drivers/scsi/leapraid/leapraid_func.h
| @@ -554,6 +554,7 @@ struct leapraid_fw_evt_work { | |||
| 554 | 554 | /** | |
| 555 | 555 | * struct leapraid_fw_evt_struct - Firmware event handling structure | |
| 556 | 556 | * | |
| 557 | + | * @fw_evt_name: Name of the firmware event. | |
| 557 | 558 | * @fw_evt_thread: Workqueue used for processing firmware events. | |
| 558 | 559 | * @fw_evt_lock: Spinlock protecting access to the firmware event list. | |
| 559 | 560 | * @fw_evt_list: Linked list of pending firmware events. | |
| @@ -564,6 +565,7 @@ struct leapraid_fw_evt_work { | |||
| 564 | 565 | */ | |
| 565 | 566 | struct leapraid_fw_evt_struct { | |
| 566 | 567 | u32 leapraid_evt_masks[4]; | |
| 568 | + | char fw_evt_name[48]; | |
| 567 | 569 | struct workqueue_struct *fw_evt_thread; | |
| 568 | 570 | spinlock_t fw_evt_lock; /* protects firmware event */ | |
| 569 | 571 | struct list_head fw_evt_list; | |
modified drivers/scsi/leapraid/leapraid_os.c
| @@ -2054,10 +2054,12 @@ static int leapraid_probe(struct pci_dev *pdev, const struct pci_device_id *id) | |||
| 2054 | 2054 | shost->transportt = leapraid_transport_template; | |
| 2055 | 2055 | shost->unique_id = adapter->adapter_attr.id; | |
| 2056 | 2056 | ||
| 2057 | + | snprintf(adapter->fw_evt_s.fw_evt_name, | |
| 2058 | + | sizeof(adapter->fw_evt_s.fw_evt_name), | |
| 2059 | + | "fw_event_%s%d", LEAPRAID_DRIVER_NAME, | |
| 2060 | + | adapter->adapter_attr.id); | |
| 2057 | 2061 | adapter->fw_evt_s.fw_evt_thread = | |
| 2058 | - | alloc_ordered_workqueue("fw_event_%s%d", 0, | |
| 2059 | - | LEAPRAID_DRIVER_NAME, | |
| 2060 | - | adapter->adapter_attr.id); | |
| 2062 | + | alloc_ordered_workqueue(adapter->fw_evt_s.fw_evt_name, 0); | |
| 2061 | 2063 | if (!adapter->fw_evt_s.fw_evt_thread) { | |
| 2062 | 2064 | dev_err(&adapter->pdev->dev, | |
| 2063 | 2065 | "%s: Failed to create fw event workqueue\n", __func__); | |
modified drivers/scsi/libiscsi_tcp.c
| @@ -480,9 +480,6 @@ static int iscsi_tcp_data_in(struct iscsi_conn *conn, struct iscsi_task *task) | |||
| 480 | 480 | int datasn = be32_to_cpu(rhdr->datasn); | |
| 481 | 481 | unsigned total_in_length = task->sc->sdb.length; | |
| 482 | 482 | ||
| 483 | - | if (task->sc->sc_data_direction != DMA_FROM_DEVICE) | |
| 484 | - | return ISCSI_ERR_PROTO; | |
| 485 | - | ||
| 486 | 483 | /* | |
| 487 | 484 | * lib iscsi will update this in the completion handling if there | |
| 488 | 485 | * is status. | |
modified drivers/scsi/megaraid/megaraid_sas_base.c
| @@ -7886,9 +7886,7 @@ megasas_resume(struct device *dev) | |||
| 7886 | 7886 | goto fail_init_mfi; | |
| 7887 | 7887 | } | |
| 7888 | 7888 | ||
| 7889 | - | scoped_guard(mutex, &instance->reset_mutex) | |
| 7890 | - | rval = megasas_get_ctrl_info(instance); | |
| 7891 | - | if (rval != DCMD_SUCCESS) | |
| 7889 | + | if (megasas_get_ctrl_info(instance) != DCMD_SUCCESS) | |
| 7892 | 7890 | goto fail_init_mfi; | |
| 7893 | 7891 | ||
| 7894 | 7892 | tasklet_init(&instance->isr_tasklet, instance->instancet->tasklet, | |
modified drivers/scsi/pm8001/pm8001_init.c
| @@ -58,15 +58,15 @@ MODULE_PARM_DESC(link_rate, "Enable link rate.\n" | |||
| 58 | 58 | ||
| 59 | 59 | bool pm8001_use_msix = true; | |
| 60 | 60 | module_param_named(use_msix, pm8001_use_msix, bool, 0444); | |
| 61 | - | MODULE_PARM_DESC(use_msix, "Use MSIX interrupts. Default: true"); | |
| 61 | + | MODULE_PARM_DESC(zoned, "Use MSIX interrupts. Default: true"); | |
| 62 | 62 | ||
| 63 | 63 | static bool pm8001_use_tasklet = true; | |
| 64 | 64 | module_param_named(use_tasklet, pm8001_use_tasklet, bool, 0444); | |
| 65 | - | MODULE_PARM_DESC(use_tasklet, "Use tasklets for interrupt handling. Default: true"); | |
| 65 | + | MODULE_PARM_DESC(zoned, "Use MSIX interrupts. Default: true"); | |
| 66 | 66 | ||
| 67 | 67 | static bool pm8001_read_wwn = true; | |
| 68 | 68 | module_param_named(read_wwn, pm8001_read_wwn, bool, 0444); | |
| 69 | - | MODULE_PARM_DESC(read_wwn, "Get WWN from the controller. Default: true"); | |
| 69 | + | MODULE_PARM_DESC(zoned, "Get WWN from the controller. Default: true"); | |
| 70 | 70 | ||
| 71 | 71 | uint pcs_event_log_severity = 0x03; | |
| 72 | 72 | module_param(pcs_event_log_severity, int, 0644); | |
modified drivers/scsi/qla2xxx/qla_os.c
| @@ -352,7 +352,7 @@ MODULE_PARM_DESC(ql2xnvme_queues, | |||
| 352 | 352 | ||
| 353 | 353 | int ql2xfc2target = 1; | |
| 354 | 354 | module_param(ql2xfc2target, int, 0444); | |
| 355 | - | MODULE_PARM_DESC(ql2xfc2target, | |
| 355 | + | MODULE_PARM_DESC(qla2xfc2target, | |
| 356 | 356 | "Enables FC2 Target support. " | |
| 357 | 357 | "0 - FC2 Target support is disabled. " | |
| 358 | 358 | "1 - FC2 Target support is enabled (default)."); | |
modified drivers/scsi/scsi.c
| @@ -727,7 +727,6 @@ int scsi_cdl_enable(struct scsi_device *sdev, bool enable) | |||
| 727 | 727 | struct scsi_mode_data data; | |
| 728 | 728 | struct scsi_sense_hdr sshdr; | |
| 729 | 729 | char *buf_data; | |
| 730 | - | size_t avail, offset; | |
| 731 | 730 | int len; | |
| 732 | 731 | ||
| 733 | 732 | ret = scsi_mode_sense(sdev, 0x08, 0x0a, 0xf2, buf, sizeof(buf), | |
| @@ -736,24 +735,11 @@ int scsi_cdl_enable(struct scsi_device *sdev, bool enable) | |||
| 736 | 735 | return -EINVAL; | |
| 737 | 736 | ||
| 738 | 737 | /* Enable or disable CDL using the ATA feature page */ | |
| 739 | - | avail = min_t(size_t, data.length, sizeof(buf)); | |
| 740 | - | if (data.header_length > avail) | |
| 741 | - | return -EINVAL; | |
| 742 | - | ||
| 743 | - | offset = data.header_length; | |
| 744 | - | avail -= data.header_length; | |
| 745 | - | ||
| 746 | - | if (data.block_descriptor_length > avail) | |
| 747 | - | return -EINVAL; | |
| 748 | - | ||
| 749 | - | offset += data.block_descriptor_length; | |
| 750 | - | avail -= data.block_descriptor_length; | |
| 751 | - | ||
| 752 | - | if (avail < 5) | |
| 753 | - | return -EINVAL; | |
| 754 | - | ||
| 755 | - | buf_data = buf + offset; | |
| 756 | - | len = avail; | |
| 738 | + | len = min_t(size_t, sizeof(buf), | |
| 739 | + | data.length - data.header_length - | |
| 740 | + | data.block_descriptor_length); | |
| 741 | + | buf_data = buf + data.header_length + | |
| 742 | + | data.block_descriptor_length; | |
| 757 | 743 | ||
| 758 | 744 | /* | |
| 759 | 745 | * If we want to enable CDL and CDL is already enabled on the | |
modified drivers/scsi/scsi_devinfo.c
| @@ -161,7 +161,7 @@ static struct { | |||
| 161 | 161 | {"DGC", "DISK", NULL, BLIST_SPARSELUN}, /* EMC CLARiiON, no storage on LUN 0 */ | |
| 162 | 162 | {"EMC", "Invista", "*", BLIST_SPARSELUN | BLIST_LARGELUN}, | |
| 163 | 163 | {"EMC", "SYMMETRIX", NULL, BLIST_SPARSELUN | BLIST_LARGELUN | | |
| 164 | - | BLIST_REPORTLUN2 | BLIST_RETRY_ITF | BLIST_SKIP_IO_HINTS}, | |
| 164 | + | BLIST_REPORTLUN2 | BLIST_RETRY_ITF}, | |
| 165 | 165 | {"EMULEX", "MD21/S2 ESDI", NULL, BLIST_SINGLELUN}, | |
| 166 | 166 | {"easyRAID", "16P", NULL, BLIST_NOREPORTLUN}, | |
| 167 | 167 | {"easyRAID", "X6P", NULL, BLIST_NOREPORTLUN}, | |
modified drivers/scsi/sd_zbc.c
| @@ -589,7 +589,7 @@ int sd_zbc_revalidate_zones(struct scsi_disk *sdkp) | |||
| 589 | 589 | int sd_zbc_read_zones(struct scsi_disk *sdkp, struct queue_limits *lim, | |
| 590 | 590 | u8 buf[SD_BUF_SIZE]) | |
| 591 | 591 | { | |
| 592 | - | u64 nr_zones; | |
| 592 | + | unsigned int nr_zones; | |
| 593 | 593 | u32 zone_blocks = 0; | |
| 594 | 594 | int ret; | |
| 595 | 595 | ||
| @@ -621,12 +621,6 @@ int sd_zbc_read_zones(struct scsi_disk *sdkp, struct queue_limits *lim, | |||
| 621 | 621 | goto err; | |
| 622 | 622 | ||
| 623 | 623 | nr_zones = round_up(sdkp->capacity, zone_blocks) >> ilog2(zone_blocks); | |
| 624 | - | if (nr_zones > INT_MAX) { | |
| 625 | - | sd_printk(KERN_ERR, sdkp, "Too many zones (%llu)\n", | |
| 626 | - | nr_zones); | |
| 627 | - | ret = -EINVAL; | |
| 628 | - | goto err; | |
| 629 | - | } | |
| 630 | 624 | sdkp->early_zone_info.nr_zones = nr_zones; | |
| 631 | 625 | sdkp->early_zone_info.zone_blocks = zone_blocks; | |
| 632 | 626 | ||
modified drivers/soc/samsung/exynos-pmu.c
| @@ -409,12 +409,13 @@ static struct notifier_block exynos_cpupm_reboot_nb = { | |||
| 409 | 409 | ||
| 410 | 410 | static int setup_cpuhp_and_cpuidle(struct device *dev) | |
| 411 | 411 | { | |
| 412 | - | struct device_node *intr_gen_node __free(device_node) = | |
| 413 | - | of_parse_phandle(dev->of_node, "google,pmu-intr-gen-syscon", 0); | |
| 412 | + | struct device_node *intr_gen_node; | |
| 414 | 413 | struct resource intrgen_res; | |
| 415 | 414 | void __iomem *virt_addr; | |
| 416 | 415 | int ret, cpu; | |
| 417 | 416 | ||
| 417 | + | intr_gen_node = of_parse_phandle(dev->of_node, | |
| 418 | + | "google,pmu-intr-gen-syscon", 0); | |
| 418 | 419 | if (!intr_gen_node) { | |
| 419 | 420 | /* | |
| 420 | 421 | * To maintain support for older DTs that didn't specify syscon | |
| @@ -430,6 +431,8 @@ static int setup_cpuhp_and_cpuidle(struct device *dev) | |||
| 430 | 431 | * syscon provided regmap. | |
| 431 | 432 | */ | |
| 432 | 433 | ret = of_address_to_resource(intr_gen_node, 0, &intrgen_res); | |
| 434 | + | of_node_put(intr_gen_node); | |
| 435 | + | ||
| 433 | 436 | virt_addr = devm_ioremap(dev, intrgen_res.start, | |
| 434 | 437 | resource_size(&intrgen_res)); | |
| 435 | 438 | if (!virt_addr) | |
modified drivers/soc/tegra/fuse/tegra-apbmisc.c
| @@ -309,7 +309,7 @@ void tegra_acpi_init_apbmisc(void) | |||
| 309 | 309 | ||
| 310 | 310 | ret = acpi_dev_get_memory_resources(adev, &resource_list); | |
| 311 | 311 | if (ret < 0) { | |
| 312 | - | pr_err("failed to get APBMISC memory resources\n"); | |
| 312 | + | pr_err("failed to get APBMISC memory resources"); | |
| 313 | 313 | goto out_put_acpi_dev; | |
| 314 | 314 | } | |
| 315 | 315 | ||
modified drivers/soc/tegra/pmc.c
| @@ -3151,7 +3151,6 @@ static int tegra_pmc_probe(struct platform_device *pdev) | |||
| 3151 | 3151 | ||
| 3152 | 3152 | #if defined(CONFIG_ARM) | |
| 3153 | 3153 | mutex_lock(&early_pmc->powergates_lock); | |
| 3154 | - | early_pmc->rate = pmc->rate; | |
| 3155 | 3154 | iounmap(early_pmc->base); | |
| 3156 | 3155 | early_pmc->base = pmc->base; | |
| 3157 | 3156 | mutex_unlock(&early_pmc->powergates_lock); | |
modified drivers/soundwire/cadence_master.c
| @@ -1701,13 +1701,6 @@ int sdw_cdns_clock_stop(struct sdw_cdns *cdns, bool block_wake) | |||
| 1701 | 1701 | return 0; | |
| 1702 | 1702 | } | |
| 1703 | 1703 | ||
| 1704 | - | /* | |
| 1705 | - | * wait for any in-flight peripheral event handling to complete before stopping the clock. | |
| 1706 | - | * No need to disable peripheral interrupts before canceling the work, as the peripheral | |
| 1707 | - | * interrupts are already masked before the work is scheduled. | |
| 1708 | - | */ | |
| 1709 | - | cancel_work_sync(&cdns->work); | |
| 1710 | - | ||
| 1711 | 1704 | /* | |
| 1712 | 1705 | * Before entering clock stop we mask the Slave | |
| 1713 | 1706 | * interrupts. This helps avoid having to deal with e.g. a | |
modified drivers/soundwire/dmi-quirks.c
| @@ -200,13 +200,6 @@ static const struct dmi_system_id adr_remap_quirk_table[] = { | |||
| 200 | 200 | }, | |
| 201 | 201 | .driver_data = (void *)ghost_realtek, | |
| 202 | 202 | }, | |
| 203 | - | { | |
| 204 | - | .matches = { | |
| 205 | - | DMI_MATCH(DMI_SYS_VENDOR, "ASUS"), | |
| 206 | - | DMI_MATCH(DMI_BOARD_NAME, "GX651AX"), | |
| 207 | - | }, | |
| 208 | - | .driver_data = (void *)ghost_realtek, | |
| 209 | - | }, | |
| 210 | 203 | { | |
| 211 | 204 | .matches = { | |
| 212 | 205 | DMI_MATCH(DMI_SYS_VENDOR, "ASUS"), | |
modified drivers/spi/spi-fsl-qspi.c
| @@ -289,7 +289,6 @@ struct fsl_qspi { | |||
| 289 | 289 | struct pm_qos_request pm_qos_req; | |
| 290 | 290 | struct device *dev; | |
| 291 | 291 | int selected; | |
| 292 | - | u32 selected_freq; | |
| 293 | 292 | u32 memmap_phy; | |
| 294 | 293 | }; | |
| 295 | 294 | ||
| @@ -552,8 +551,7 @@ static void fsl_qspi_select_mem(struct fsl_qspi *q, struct spi_device *spi, | |||
| 552 | 551 | unsigned long rate = op->max_freq; | |
| 553 | 552 | int ret; | |
| 554 | 553 | ||
| 555 | - | if (q->selected == spi_get_chipselect(spi, 0) && | |
| 556 | - | q->selected_freq == op->max_freq) | |
| 554 | + | if (q->selected == spi_get_chipselect(spi, 0)) | |
| 557 | 555 | return; | |
| 558 | 556 | ||
| 559 | 557 | if (needs_4x_clock(q)) | |
| @@ -573,7 +571,6 @@ static void fsl_qspi_select_mem(struct fsl_qspi *q, struct spi_device *spi, | |||
| 573 | 571 | } | |
| 574 | 572 | ||
| 575 | 573 | q->selected = spi_get_chipselect(spi, 0); | |
| 576 | - | q->selected_freq = op->max_freq; | |
| 577 | 574 | ||
| 578 | 575 | fsl_qspi_invalidate(q); | |
| 579 | 576 | } | |
modified drivers/spi/spi-qpic-snand.c
| @@ -765,6 +765,8 @@ static int qcom_spi_read_cw_raw(struct qcom_nand_controller *snandc, u8 *data_bu | |||
| 765 | 765 | ||
| 766 | 766 | qcom_write_reg_dma(snandc, &snandc->regs->addr0, NAND_ADDR0, 2, 0); | |
| 767 | 767 | qcom_write_reg_dma(snandc, &snandc->regs->cfg0, NAND_DEV0_CFG0, 3, 0); | |
| 768 | + | qcom_write_reg_dma(snandc, &snandc->regs->ecc_buf_cfg, NAND_EBI2_ECC_BUF_CFG, 1, 0); | |
| 769 | + | ||
| 768 | 770 | qcom_write_reg_dma(snandc, &snandc->regs->erased_cw_detect_cfg_clr, | |
| 769 | 771 | NAND_ERASED_CW_DETECT_CFG, 1, 0); | |
| 770 | 772 | qcom_write_reg_dma(snandc, &snandc->regs->erased_cw_detect_cfg_set, | |
| @@ -1102,6 +1104,8 @@ static void qcom_spi_config_page_write(struct qcom_nand_controller *snandc) | |||
| 1102 | 1104 | { | |
| 1103 | 1105 | qcom_write_reg_dma(snandc, &snandc->regs->addr0, NAND_ADDR0, 2, 0); | |
| 1104 | 1106 | qcom_write_reg_dma(snandc, &snandc->regs->cfg0, NAND_DEV0_CFG0, 3, 0); | |
| 1107 | + | qcom_write_reg_dma(snandc, &snandc->regs->ecc_buf_cfg, NAND_EBI2_ECC_BUF_CFG, | |
| 1108 | + | 1, NAND_BAM_NEXT_SGL); | |
| 1105 | 1109 | } | |
| 1106 | 1110 | ||
| 1107 | 1111 | static void qcom_spi_config_cw_write(struct qcom_nand_controller *snandc) | |
modified drivers/spi/spi-virtio.c
| @@ -168,7 +168,7 @@ static int virtio_spi_transfer_one(struct spi_controller *ctrl, | |||
| 168 | 168 | ||
| 169 | 169 | /* Fill struct spi_transfer_head */ | |
| 170 | 170 | th->chip_select_id = spi_get_chipselect(spi, 0); | |
| 171 | - | th->bits_per_word = xfer->bits_per_word; | |
| 171 | + | th->bits_per_word = spi->bits_per_word; | |
| 172 | 172 | th->cs_change = xfer->cs_change; | |
| 173 | 173 | th->tx_nbits = xfer->tx_nbits; | |
| 174 | 174 | th->rx_nbits = xfer->rx_nbits; | |
modified drivers/spi/spi-zynqmp-gqspi.c
| @@ -1373,45 +1373,11 @@ static void zynqmp_qspi_remove(struct platform_device *pdev) | |||
| 1373 | 1373 | clk_disable_unprepare(xqspi->pclk); | |
| 1374 | 1374 | } | |
| 1375 | 1375 | ||
| 1376 | - | static void zynqmp_qspi_shutdown(struct platform_device *pdev) | |
| 1377 | - | { | |
| 1378 | - | struct zynqmp_qspi *xqspi = platform_get_drvdata(pdev); | |
| 1379 | - | int ret; | |
| 1380 | - | ||
| 1381 | - | /* | |
| 1382 | - | * Stop the queue and reject any later transfer first, so the write | |
| 1383 | - | * below cannot cut into a message that is still being executed. | |
| 1384 | - | * Unlike ->suspend this cannot abort on error: a controller left | |
| 1385 | - | * mastering the bus is worse than a truncated transfer. | |
| 1386 | - | */ | |
| 1387 | - | ret = spi_controller_suspend(xqspi->ctlr); | |
| 1388 | - | if (ret) | |
| 1389 | - | dev_warn(&pdev->dev, "could not stop the queue: %d\n", ret); | |
| 1390 | - | ||
| 1391 | - | /* | |
| 1392 | - | * Only a runtime suspended controller can be left alone: its clocks | |
| 1393 | - | * are gated, so it cannot be mastering the bus, and its registers | |
| 1394 | - | * must not be accessed either. Any other answer means it may be | |
| 1395 | - | * running and has to be stopped. In particular, on a kernel built | |
| 1396 | - | * without runtime PM this returns -EINVAL, and there the clocks | |
| 1397 | - | * enabled in probe() are never gated at all. | |
| 1398 | - | */ | |
| 1399 | - | ret = pm_runtime_get_if_in_use(&pdev->dev); | |
| 1400 | - | if (!ret) | |
| 1401 | - | return; | |
| 1402 | - | ||
| 1403 | - | zynqmp_gqspi_write(xqspi, GQSPI_EN_OFST, 0x0); | |
| 1404 | - | ||
| 1405 | - | if (ret > 0) | |
| 1406 | - | pm_runtime_put_noidle(&pdev->dev); | |
| 1407 | - | } | |
| 1408 | - | ||
| 1409 | 1376 | MODULE_DEVICE_TABLE(of, zynqmp_qspi_of_match); | |
| 1410 | 1377 | ||
| 1411 | 1378 | static struct platform_driver zynqmp_qspi_driver = { | |
| 1412 | 1379 | .probe = zynqmp_qspi_probe, | |
| 1413 | 1380 | .remove = zynqmp_qspi_remove, | |
| 1414 | - | .shutdown = zynqmp_qspi_shutdown, | |
| 1415 | 1381 | .driver = { | |
| 1416 | 1382 | .name = "zynqmp-qspi", | |
| 1417 | 1383 | .of_match_table = zynqmp_qspi_of_match, | |
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/thermal/gov_step_wise.c
| @@ -65,12 +65,14 @@ static unsigned long get_target_state(struct thermal_instance *instance, | |||
| 65 | 65 | min(instance->lower + 1, instance->upper), | |
| 66 | 66 | instance->upper); | |
| 67 | 67 | } else if (trend == THERMAL_TREND_DROPPING) { | |
| 68 | + | if (cur_state <= instance->lower) | |
| 69 | + | return THERMAL_NO_TARGET; | |
| 70 | + | ||
| 68 | 71 | /* | |
| 69 | - | * If 'throttle' is false, no mitigation is necessary and | |
| 70 | - | * passive polling is already deactivated, so clear this | |
| 71 | - | * instance state by returning THERMAL_NO_TARGET. | |
| 72 | + | * If 'throttle' is false, no mitigation is necessary, so | |
| 73 | + | * request the lower state for this instance. | |
| 72 | 74 | */ | |
| 73 | - | return THERMAL_NO_TARGET; | |
| 75 | + | return instance->lower; | |
| 74 | 76 | } | |
| 75 | 77 | ||
| 76 | 78 | return instance->target; | |
modified drivers/ufs/core/ufshcd.c
| @@ -6817,17 +6817,11 @@ static void ufshcd_err_handling_prepare(struct ufs_hba *hba) | |||
| 6817 | 6817 | } | |
| 6818 | 6818 | /* Wait for ongoing ufshcd_queuecommand() calls to finish. */ | |
| 6819 | 6819 | blk_mq_quiesce_tagset(&hba->host->tag_set); | |
| 6820 | - | /* | |
| 6821 | - | * Internal commands are submitted on the pseudo SCSI device. Let them | |
| 6822 | - | * through so that the error handler can recover the link. | |
| 6823 | - | */ | |
| 6824 | - | blk_mq_unquiesce_queue(hba->host->pseudo_sdev->request_queue); | |
| 6825 | 6820 | cancel_work_sync(&hba->eeh_work); | |
| 6826 | 6821 | } | |
| 6827 | 6822 | ||
| 6828 | 6823 | static void ufshcd_err_handling_unprepare(struct ufs_hba *hba) | |
| 6829 | 6824 | { | |
| 6830 | - | blk_mq_quiesce_queue_nowait(hba->host->pseudo_sdev->request_queue); | |
| 6831 | 6825 | blk_mq_unquiesce_tagset(&hba->host->tag_set); | |
| 6832 | 6826 | ufshcd_release(hba); | |
| 6833 | 6827 | if (ufshcd_is_clkscaling_supported(hba)) | |
modified drivers/ufs/host/ufshcd-pltfrm.c
| @@ -206,11 +206,7 @@ static void ufshcd_init_lanes_per_dir(struct ufs_hba *hba) | |||
| 206 | 206 | dev_dbg(hba->dev, | |
| 207 | 207 | "%s: failed to read lanes-per-direction, ret=%d\n", | |
| 208 | 208 | __func__, ret); | |
| 209 | - | /* Old R-Car S4 DTBs lack "lanes-per-direction = <1>" */ | |
| 210 | - | if (of_device_is_compatible(dev->of_node, "renesas,r8a779f0-ufs")) | |
| 211 | - | hba->lanes_per_direction = 1; | |
| 212 | - | else | |
| 213 | - | hba->lanes_per_direction = UFSHCD_DEFAULT_LANES_PER_DIRECTION; | |
| 209 | + | hba->lanes_per_direction = UFSHCD_DEFAULT_LANES_PER_DIRECTION; | |
| 214 | 210 | } | |
| 215 | 211 | } | |
| 216 | 212 | ||
modified drivers/watchdog/da9062_wdt.c
| @@ -256,7 +256,7 @@ static int __maybe_unused da9062_wdt_suspend(struct device *dev) | |||
| 256 | 256 | if (!wdt->use_sw_pm) | |
| 257 | 257 | return 0; | |
| 258 | 258 | ||
| 259 | - | if (watchdog_active(wdd) || watchdog_hw_running(wdd)) | |
| 259 | + | if (watchdog_active(wdd)) | |
| 260 | 260 | return da9062_wdt_stop(wdd); | |
| 261 | 261 | ||
| 262 | 262 | return 0; | |
| @@ -270,7 +270,7 @@ static int __maybe_unused da9062_wdt_resume(struct device *dev) | |||
| 270 | 270 | if (!wdt->use_sw_pm) | |
| 271 | 271 | return 0; | |
| 272 | 272 | ||
| 273 | - | if (watchdog_active(wdd) || watchdog_hw_running(wdd)) | |
| 273 | + | if (watchdog_active(wdd)) | |
| 274 | 274 | return da9062_wdt_start(wdd); | |
| 275 | 275 | ||
| 276 | 276 | return 0; | |
modified drivers/watchdog/da9063_wdt.c
| @@ -271,7 +271,7 @@ static int da9063_wdt_suspend(struct device *dev) | |||
| 271 | 271 | if (!da9063->use_sw_pm) | |
| 272 | 272 | return 0; | |
| 273 | 273 | ||
| 274 | - | if (watchdog_active(wdd) || watchdog_hw_running(wdd)) | |
| 274 | + | if (watchdog_active(wdd)) | |
| 275 | 275 | return da9063_wdt_stop(wdd); | |
| 276 | 276 | ||
| 277 | 277 | return 0; | |
| @@ -285,7 +285,7 @@ static int da9063_wdt_resume(struct device *dev) | |||
| 285 | 285 | if (!da9063->use_sw_pm) | |
| 286 | 286 | return 0; | |
| 287 | 287 | ||
| 288 | - | if (watchdog_active(wdd) || watchdog_hw_running(wdd)) | |
| 288 | + | if (watchdog_active(wdd)) | |
| 289 | 289 | return da9063_wdt_start(wdd); | |
| 290 | 290 | ||
| 291 | 291 | return 0; | |
modified drivers/watchdog/digicolor_wdt.c
| @@ -25,7 +25,6 @@ struct dc_wdt { | |||
| 25 | 25 | void __iomem *base; | |
| 26 | 26 | struct clk *clk; | |
| 27 | 27 | spinlock_t lock; | |
| 28 | - | unsigned long rate; | |
| 29 | 28 | }; | |
| 30 | 29 | ||
| 31 | 30 | static unsigned timeout; | |
| @@ -62,7 +61,7 @@ static int dc_wdt_start(struct watchdog_device *wdog) | |||
| 62 | 61 | { | |
| 63 | 62 | struct dc_wdt *wdt = watchdog_get_drvdata(wdog); | |
| 64 | 63 | ||
| 65 | - | dc_wdt_set(wdt, wdog->timeout * wdt->rate); | |
| 64 | + | dc_wdt_set(wdt, wdog->timeout * clk_get_rate(wdt->clk)); | |
| 66 | 65 | ||
| 67 | 66 | return 0; | |
| 68 | 67 | } | |
| @@ -80,7 +79,7 @@ static int dc_wdt_set_timeout(struct watchdog_device *wdog, unsigned int t) | |||
| 80 | 79 | { | |
| 81 | 80 | struct dc_wdt *wdt = watchdog_get_drvdata(wdog); | |
| 82 | 81 | ||
| 83 | - | dc_wdt_set(wdt, t * wdt->rate); | |
| 82 | + | dc_wdt_set(wdt, t * clk_get_rate(wdt->clk)); | |
| 84 | 83 | wdog->timeout = t; | |
| 85 | 84 | ||
| 86 | 85 | return 0; | |
| @@ -91,7 +90,7 @@ static unsigned int dc_wdt_get_timeleft(struct watchdog_device *wdog) | |||
| 91 | 90 | struct dc_wdt *wdt = watchdog_get_drvdata(wdog); | |
| 92 | 91 | uint32_t count = readl_relaxed(wdt->base + TIMER_A_COUNT); | |
| 93 | 92 | ||
| 94 | - | return count / wdt->rate; | |
| 93 | + | return count / clk_get_rate(wdt->clk); | |
| 95 | 94 | } | |
| 96 | 95 | ||
| 97 | 96 | static const struct watchdog_ops dc_wdt_ops = { | |
| @@ -131,11 +130,7 @@ static int dc_wdt_probe(struct platform_device *pdev) | |||
| 131 | 130 | wdt->clk = devm_clk_get(dev, NULL); | |
| 132 | 131 | if (IS_ERR(wdt->clk)) | |
| 133 | 132 | return PTR_ERR(wdt->clk); | |
| 134 | - | ||
| 135 | - | wdt->rate = clk_get_rate(wdt->clk); | |
| 136 | - | if (!wdt->rate) | |
| 137 | - | return -EINVAL; | |
| 138 | - | dc_wdt_wdd.max_timeout = U32_MAX / wdt->rate; | |
| 133 | + | dc_wdt_wdd.max_timeout = U32_MAX / clk_get_rate(wdt->clk); | |
| 139 | 134 | dc_wdt_wdd.timeout = dc_wdt_wdd.max_timeout; | |
| 140 | 135 | dc_wdt_wdd.parent = dev; | |
| 141 | 136 | ||
modified drivers/watchdog/msc313e_wdt.c
| @@ -46,9 +46,6 @@ static void msc313e_wdt_set_hw_timeout(struct msc313e_wdt_priv *priv, | |||
| 46 | 46 | { | |
| 47 | 47 | u32 t = timeout * clk_get_rate(priv->clk); | |
| 48 | 48 | ||
| 49 | - | /* Clear before to prevent premature reset during non-atomic updates. */ | |
| 50 | - | writew(1, priv->base + REG_WDT_CLR); | |
| 51 | - | ||
| 52 | 49 | writew(t & 0xffff, priv->base + REG_WDT_MAX_PRD_L); | |
| 53 | 50 | writew((t >> 16) & 0xffff, priv->base + REG_WDT_MAX_PRD_H); | |
| 54 | 51 | writew(1, priv->base + REG_WDT_CLR); | |
| @@ -79,9 +76,6 @@ static int msc313e_wdt_stop(struct watchdog_device *wdev) | |||
| 79 | 76 | { | |
| 80 | 77 | struct msc313e_wdt_priv *priv = watchdog_get_drvdata(wdev); | |
| 81 | 78 | ||
| 82 | - | /* Clear before to prevent premature reset during non-atomic updates. */ | |
| 83 | - | writew(1, priv->base + REG_WDT_CLR); | |
| 84 | - | ||
| 85 | 79 | writew(0, priv->base + REG_WDT_MAX_PRD_L); | |
| 86 | 80 | writew(0, priv->base + REG_WDT_MAX_PRD_H); | |
| 87 | 81 | writew(0, priv->base + REG_WDT_CLR); | |
| @@ -197,15 +191,11 @@ static int __maybe_unused msc313e_wdt_suspend(struct device *dev) | |||
| 197 | 191 | static int __maybe_unused msc313e_wdt_resume(struct device *dev) | |
| 198 | 192 | { | |
| 199 | 193 | struct msc313e_wdt_priv *priv = dev_get_drvdata(dev); | |
| 200 | - | int ret = 0; | |
| 201 | 194 | ||
| 202 | - | if (watchdog_active(&priv->wdev) || watchdog_hw_running(&priv->wdev)) { | |
| 203 | - | ret = msc313e_wdt_start(&priv->wdev); | |
| 204 | - | if (ret) | |
| 205 | - | dev_err(dev, "Failed to restart watchdog (err=%d)\n", ret); | |
| 206 | - | } | |
| 195 | + | if (watchdog_active(&priv->wdev) || watchdog_hw_running(&priv->wdev)) | |
| 196 | + | msc313e_wdt_start(&priv->wdev); | |
| 207 | 197 | ||
| 208 | - | return ret; | |
| 198 | + | return 0; | |
| 209 | 199 | } | |
| 210 | 200 | ||
| 211 | 201 | static SIMPLE_DEV_PM_OPS(msc313e_wdt_pm_ops, msc313e_wdt_suspend, msc313e_wdt_resume); | |
modified drivers/watchdog/rtd119x_wdt.c
| @@ -98,7 +98,6 @@ static int rtd119x_wdt_probe(struct platform_device *pdev) | |||
| 98 | 98 | { | |
| 99 | 99 | struct device *dev = &pdev->dev; | |
| 100 | 100 | struct rtd119x_watchdog_device *data; | |
| 101 | - | unsigned long rate; | |
| 102 | 101 | ||
| 103 | 102 | data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); | |
| 104 | 103 | if (!data) | |
| @@ -112,14 +111,10 @@ static int rtd119x_wdt_probe(struct platform_device *pdev) | |||
| 112 | 111 | if (IS_ERR(data->clk)) | |
| 113 | 112 | return PTR_ERR(data->clk); | |
| 114 | 113 | ||
| 115 | - | rate = clk_get_rate(data->clk); | |
| 116 | - | if (!rate) | |
| 117 | - | return -EINVAL; | |
| 118 | - | ||
| 119 | 114 | data->wdt_dev.info = &rtd119x_wdt_info; | |
| 120 | 115 | data->wdt_dev.ops = &rtd119x_wdt_ops; | |
| 121 | 116 | data->wdt_dev.timeout = 120; | |
| 122 | - | data->wdt_dev.max_timeout = 0xffffffff / rate; | |
| 117 | + | data->wdt_dev.max_timeout = 0xffffffff / clk_get_rate(data->clk); | |
| 123 | 118 | data->wdt_dev.min_timeout = 1; | |
| 124 | 119 | data->wdt_dev.parent = dev; | |
| 125 | 120 | ||
modified drivers/watchdog/rzv2h_wdt.c
| @@ -278,7 +278,6 @@ static int rzv2h_wdt_probe(struct platform_device *pdev) | |||
| 278 | 278 | struct device *dev = &pdev->dev; | |
| 279 | 279 | struct rzv2h_wdt_priv *priv; | |
| 280 | 280 | struct clk *count_clk; | |
| 281 | - | unsigned long rate; | |
| 282 | 281 | int ret; | |
| 283 | 282 | ||
| 284 | 283 | priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); | |
| @@ -315,12 +314,8 @@ static int rzv2h_wdt_probe(struct platform_device *pdev) | |||
| 315 | 314 | return dev_err_probe(dev, -EINVAL, "Invalid count source\n"); | |
| 316 | 315 | } | |
| 317 | 316 | ||
| 318 | - | rate = clk_get_rate(count_clk); | |
| 319 | - | if (!rate) | |
| 320 | - | return dev_err_probe(dev, -EINVAL, "Invalid clock rate\n"); | |
| 321 | - | ||
| 322 | 317 | priv->wdev.max_hw_heartbeat_ms = (MILLI * priv->of_data->timeout_cycles * | |
| 323 | - | priv->of_data->cks_div) / rate; | |
| 318 | + | priv->of_data->cks_div) / clk_get_rate(count_clk); | |
| 324 | 319 | dev_dbg(dev, "max hw timeout of %dms\n", priv->wdev.max_hw_heartbeat_ms); | |
| 325 | 320 | ||
| 326 | 321 | ret = devm_pm_runtime_enable(dev); | |
modified drivers/watchdog/sp5100_tco.c
| @@ -605,10 +605,8 @@ static int __init sp5100_tco_init(void) | |||
| 605 | 605 | pr_info("SP5100/SB800 TCO WatchDog Timer Driver\n"); | |
| 606 | 606 | ||
| 607 | 607 | err = platform_driver_register(&sp5100_tco_driver); | |
| 608 | - | if (err) { | |
| 609 | - | pci_dev_put(sp5100_tco_pci); | |
| 608 | + | if (err) | |
| 610 | 609 | return err; | |
| 611 | - | } | |
| 612 | 610 | ||
| 613 | 611 | sp5100_tco_platform_device = | |
| 614 | 612 | platform_device_register_simple(TCO_DRIVER_NAME, -1, NULL, 0); | |
| @@ -621,7 +619,6 @@ static int __init sp5100_tco_init(void) | |||
| 621 | 619 | ||
| 622 | 620 | unreg_platform_driver: | |
| 623 | 621 | platform_driver_unregister(&sp5100_tco_driver); | |
| 624 | - | pci_dev_put(sp5100_tco_pci); | |
| 625 | 622 | return err; | |
| 626 | 623 | } | |
| 627 | 624 | ||
| @@ -629,7 +626,6 @@ static void __exit sp5100_tco_exit(void) | |||
| 629 | 626 | { | |
| 630 | 627 | platform_device_unregister(sp5100_tco_platform_device); | |
| 631 | 628 | platform_driver_unregister(&sp5100_tco_driver); | |
| 632 | - | pci_dev_put(sp5100_tco_pci); | |
| 633 | 629 | } | |
| 634 | 630 | ||
| 635 | 631 | module_init(sp5100_tco_init); | |
modified drivers/watchdog/starfive-wdt.c
| @@ -371,7 +371,7 @@ static void starfive_wdt_stop(struct starfive_wdt *wdt) | |||
| 371 | 371 | static int starfive_wdt_pm_start(struct watchdog_device *wdd) | |
| 372 | 372 | { | |
| 373 | 373 | struct starfive_wdt *wdt = watchdog_get_drvdata(wdd); | |
| 374 | - | int ret = pm_runtime_resume_and_get(wdd->parent); | |
| 374 | + | int ret = pm_runtime_get_sync(wdd->parent); | |
| 375 | 375 | ||
| 376 | 376 | if (ret < 0) | |
| 377 | 377 | return ret; | |
modified fs/9p/vfs_addr.c
| @@ -54,37 +54,11 @@ static void v9fs_begin_writeback(struct netfs_io_request *wreq) | |||
| 54 | 54 | static void v9fs_issue_write(struct netfs_io_subrequest *subreq) | |
| 55 | 55 | { | |
| 56 | 56 | struct p9_fid *fid = subreq->rreq->netfs_priv; | |
| 57 | - | struct inode *inode = subreq->rreq->inode; | |
| 58 | - | struct netfs_inode *ictx = netfs_inode(inode); | |
| 59 | 57 | int err, len; | |
| 60 | 58 | ||
| 61 | 59 | len = p9_client_write(fid, subreq->start, &subreq->io_iter, &err); | |
| 62 | - | if (len > 0) { | |
| 63 | - | uoff_t end = subreq->start + len, i_size, remote, zp; | |
| 64 | - | bool set = false; | |
| 65 | - | ||
| 66 | - | spin_lock(&inode->i_lock); | |
| 67 | - | ||
| 68 | - | /* We can read the sizes directly as we hold i_lock. */ | |
| 69 | - | i_size = inode->i_size; | |
| 70 | - | remote = ictx->_remote_i_size; | |
| 71 | - | zp = ictx->_zero_point; | |
| 72 | - | ||
| 73 | - | if (end > i_size) { | |
| 74 | - | i_size = end; | |
| 75 | - | set = true; | |
| 76 | - | } | |
| 77 | - | if (end > remote) { | |
| 78 | - | remote = end; | |
| 79 | - | set = true; | |
| 80 | - | } | |
| 81 | - | ||
| 82 | - | if (set) | |
| 83 | - | netfs_write_sizes(inode, i_size, remote, zp); | |
| 84 | - | spin_unlock(&inode->i_lock); | |
| 85 | - | ||
| 60 | + | if (len > 0) | |
| 86 | 61 | __set_bit(NETFS_SREQ_MADE_PROGRESS, &subreq->flags); | |
| 87 | - | } | |
| 88 | 62 | netfs_write_subrequest_terminated(subreq, len ?: err); | |
| 89 | 63 | } | |
| 90 | 64 | ||
modified fs/autofs/inode.c
| @@ -51,10 +51,6 @@ void autofs_kill_sb(struct super_block *sb) | |||
| 51 | 51 | if (sbi) { | |
| 52 | 52 | /* Free wait queues, close pipe */ | |
| 53 | 53 | autofs_catatonic_mode(sbi); | |
| 54 | - | if (sbi->pipe) { | |
| 55 | - | fput(sbi->pipe); | |
| 56 | - | sbi->pipe = NULL; | |
| 57 | - | } | |
| 58 | 54 | put_pid(sbi->oz_pgrp); | |
| 59 | 55 | } | |
| 60 | 56 | ||
modified fs/binfmt_misc_bpf.c
| @@ -141,6 +141,8 @@ __bpf_kfunc int bpf_binprm_set_interp(struct linux_binprm *bprm, | |||
| 141 | 141 | len = strnlen(path, path__sz); | |
| 142 | 142 | if (len == path__sz) | |
| 143 | 143 | return -EINVAL; | |
| 144 | + | if (path[0] != '/') | |
| 145 | + | return -EINVAL; | |
| 144 | 146 | if (len >= PATH_MAX) | |
| 145 | 147 | return -ENAMETOOLONG; | |
| 146 | 148 | ||
| @@ -148,15 +150,6 @@ __bpf_kfunc int bpf_binprm_set_interp(struct linux_binprm *bprm, | |||
| 148 | 150 | if (!interp) | |
| 149 | 151 | return -ENOMEM; | |
| 150 | 152 | ||
| 151 | - | /* | |
| 152 | - | * The program may pass memory that is written to while this runs, | |
| 153 | - | * so check the private copy and not the buffer it was made from. | |
| 154 | - | */ | |
| 155 | - | if (interp[0] != '/') { | |
| 156 | - | kfree(interp); | |
| 157 | - | return -EINVAL; | |
| 158 | - | } | |
| 159 | - | ||
| 160 | 153 | bm_bpf_stage_selection(bprm, interp, NULL); | |
| 161 | 154 | return 0; | |
| 162 | 155 | } | |
| @@ -183,7 +176,6 @@ __bpf_kfunc int bpf_binprm_select_interp(struct linux_binprm *bprm, | |||
| 183 | 176 | const char *name, size_t name__sz) | |
| 184 | 177 | { | |
| 185 | 178 | const struct binfmt_misc_interp *interp; | |
| 186 | - | char buf[BINFMT_MISC_INTERP_NAME_MAX + 1]; | |
| 187 | 179 | size_t len; | |
| 188 | 180 | char *path; | |
| 189 | 181 | ||
| @@ -192,20 +184,8 @@ __bpf_kfunc int bpf_binprm_select_interp(struct linux_binprm *bprm, | |||
| 192 | 184 | len = strnlen(name, name__sz); | |
| 193 | 185 | if (len == name__sz || !len) | |
| 194 | 186 | return -EINVAL; | |
| 195 | - | /* No entry binds a longer name, so it cannot be found. */ | |
| 196 | - | if (len > BINFMT_MISC_INTERP_NAME_MAX) | |
| 197 | - | return -ENOENT; | |
| 198 | - | ||
| 199 | - | /* | |
| 200 | - | * The program may pass memory that is written to while this runs, | |
| 201 | - | * so look the name up in a private copy and check that instead. | |
| 202 | - | */ | |
| 203 | - | memcpy(buf, name, len); | |
| 204 | - | buf[len] = '\0'; | |
| 205 | - | if (!buf[0]) | |
| 206 | - | return -EINVAL; | |
| 207 | 187 | ||
| 208 | - | interp = binfmt_misc_find_interp(bprm->bpf_interps, buf); | |
| 188 | + | interp = binfmt_misc_find_interp(bprm->bpf_interps, name); | |
| 209 | 189 | if (!interp) | |
| 210 | 190 | return -ENOENT; | |
| 211 | 191 | ||
| @@ -248,15 +228,6 @@ __bpf_kfunc int bpf_binprm_set_interp_arg(struct linux_binprm *bprm, | |||
| 248 | 228 | if (!val) | |
| 249 | 229 | return -ENOMEM; | |
| 250 | 230 | ||
| 251 | - | /* | |
| 252 | - | * The program may pass memory that is written to while this runs, | |
| 253 | - | * so check the private copy and not the buffer it was made from. | |
| 254 | - | */ | |
| 255 | - | if (!val[0]) { | |
| 256 | - | kfree(val); | |
| 257 | - | return -EINVAL; | |
| 258 | - | } | |
| 259 | - | ||
| 260 | 231 | kfree(bprm->bpf_interp_arg); | |
| 261 | 232 | bprm->bpf_interp_arg = val; | |
| 262 | 233 | return 0; | |
modified fs/bpf_fs_kfuncs.c
| @@ -472,6 +472,10 @@ BTF_ID(func, bpf_lsm_inode_rmdir) | |||
| 472 | 472 | BTF_ID(func, bpf_lsm_inode_setattr) | |
| 473 | 473 | BTF_ID(func, bpf_lsm_inode_setxattr) | |
| 474 | 474 | BTF_ID(func, bpf_lsm_inode_unlink) | |
| 475 | + | #ifdef CONFIG_SECURITY_PATH | |
| 476 | + | BTF_ID(func, bpf_lsm_path_unlink) | |
| 477 | + | BTF_ID(func, bpf_lsm_path_rmdir) | |
| 478 | + | #endif /* CONFIG_SECURITY_PATH */ | |
| 475 | 479 | BTF_SET_END(d_inode_locked_hooks) | |
| 476 | 480 | ||
| 477 | 481 | bool bpf_lsm_has_d_inode_locked(const struct bpf_prog *prog) | |
modified fs/btrfs/dev-replace.c
| @@ -494,7 +494,6 @@ static int mark_block_group_to_copy(struct btrfs_fs_info *fs_info, | |||
| 494 | 494 | path->reada = READA_FORWARD; | |
| 495 | 495 | path->search_commit_root = true; | |
| 496 | 496 | path->skip_locking = true; | |
| 497 | - | path->need_commit_sem = true; | |
| 498 | 497 | ||
| 499 | 498 | key.objectid = src_dev->devid; | |
| 500 | 499 | key.type = BTRFS_DEV_EXTENT_KEY; | |
modified fs/btrfs/disk-io.c
| @@ -2357,10 +2357,6 @@ static int validate_sys_chunk_array(const struct btrfs_fs_info *fs_info, | |||
| 2357 | 2357 | key.type, cur); | |
| 2358 | 2358 | return -EUCLEAN; | |
| 2359 | 2359 | } | |
| 2360 | - | ||
| 2361 | - | if (unlikely(cur + sizeof(*chunk) > sys_array_size)) | |
| 2362 | - | goto short_read; | |
| 2363 | - | ||
| 2364 | 2360 | chunk = (struct btrfs_chunk *)(sb->sys_chunk_array + cur); | |
| 2365 | 2361 | num_stripes = btrfs_stack_chunk_num_stripes(chunk); | |
| 2366 | 2362 | if (unlikely(cur + btrfs_chunk_item_size(num_stripes) > sys_array_size)) | |
modified fs/btrfs/file.c
| @@ -2509,10 +2509,8 @@ int btrfs_replace_file_extents(struct btrfs_inode *inode, | |||
| 2509 | 2509 | inode_set_ctime_current(&inode->vfs_inode)); | |
| 2510 | 2510 | ||
| 2511 | 2511 | ret = btrfs_update_inode(trans, inode); | |
| 2512 | - | if (unlikely(ret)) { | |
| 2513 | - | btrfs_abort_transaction(trans, ret); | |
| 2512 | + | if (ret) | |
| 2514 | 2513 | break; | |
| 2515 | - | } | |
| 2516 | 2514 | ||
| 2517 | 2515 | btrfs_end_transaction(trans); | |
| 2518 | 2516 | btrfs_btree_balance_dirty(fs_info); | |
modified fs/btrfs/free-space-tree.c
| @@ -1353,7 +1353,7 @@ int btrfs_rebuild_free_space_tree(struct btrfs_fs_info *fs_info) | |||
| 1353 | 1353 | if (unlikely(ret)) { | |
| 1354 | 1354 | btrfs_abort_transaction(trans, ret); | |
| 1355 | 1355 | btrfs_end_transaction(trans); | |
| 1356 | - | goto out_clear; | |
| 1356 | + | return ret; | |
| 1357 | 1357 | } | |
| 1358 | 1358 | ||
| 1359 | 1359 | node = rb_first_cached(&fs_info->block_group_cache_tree); | |
| @@ -1371,16 +1371,14 @@ int btrfs_rebuild_free_space_tree(struct btrfs_fs_info *fs_info) | |||
| 1371 | 1371 | if (unlikely(ret)) { | |
| 1372 | 1372 | btrfs_abort_transaction(trans, ret); | |
| 1373 | 1373 | btrfs_end_transaction(trans); | |
| 1374 | - | goto out_clear; | |
| 1374 | + | return ret; | |
| 1375 | 1375 | } | |
| 1376 | 1376 | next: | |
| 1377 | 1377 | if (btrfs_should_end_transaction(trans)) { | |
| 1378 | 1378 | btrfs_end_transaction(trans); | |
| 1379 | 1379 | trans = btrfs_start_transaction(free_space_root, 1); | |
| 1380 | - | if (IS_ERR(trans)) { | |
| 1381 | - | ret = PTR_ERR(trans); | |
| 1382 | - | goto out_clear; | |
| 1383 | - | } | |
| 1380 | + | if (IS_ERR(trans)) | |
| 1381 | + | return PTR_ERR(trans); | |
| 1384 | 1382 | } | |
| 1385 | 1383 | node = rb_next(node); | |
| 1386 | 1384 | } | |
| @@ -1392,10 +1390,6 @@ next: | |||
| 1392 | 1390 | ret = btrfs_commit_transaction(trans); | |
| 1393 | 1391 | clear_bit(BTRFS_FS_FREE_SPACE_TREE_UNTRUSTED, &fs_info->flags); | |
| 1394 | 1392 | return ret; | |
| 1395 | - | ||
| 1396 | - | out_clear: | |
| 1397 | - | clear_bit(BTRFS_FS_CREATING_FREE_SPACE_TREE, &fs_info->flags); | |
| 1398 | - | return ret; | |
| 1399 | 1393 | } | |
| 1400 | 1394 | ||
| 1401 | 1395 | static int __add_block_group_free_space(struct btrfs_trans_handle *trans, | |
modified fs/btrfs/inode.c
| @@ -2339,27 +2339,12 @@ static int run_delalloc_inline(struct btrfs_inode *inode, struct folio *locked_f | |||
| 2339 | 2339 | } else if (inode->prop_compress) { | |
| 2340 | 2340 | compress_type = inode->prop_compress; | |
| 2341 | 2341 | } | |
| 2342 | - | /* | |
| 2343 | - | * We need to pass blocksize and not i_size, otherwise we can't | |
| 2344 | - | * create compressed inline extents for data smaller than sector | |
| 2345 | - | * size with lzo. | |
| 2346 | - | */ | |
| 2347 | 2342 | cb = btrfs_compress_bio(inode, 0, blocksize, compress_type, compress_level, 0); | |
| 2348 | 2343 | if (IS_ERR(cb)) { | |
| 2349 | 2344 | cb = NULL; | |
| 2350 | 2345 | /* Just fall back to non-compressed case. */ | |
| 2351 | 2346 | } else { | |
| 2352 | 2347 | compressed_size = cb->bbio.bio.bi_iter.bi_size; | |
| 2353 | - | /* | |
| 2354 | - | * If we did not save space, it's pointless and wasteful | |
| 2355 | - | * to have an inline compressed extent, so fallback to | |
| 2356 | - | * an uncompressed inline extent. | |
| 2357 | - | */ | |
| 2358 | - | if (compressed_size >= i_size) { | |
| 2359 | - | cleanup_compressed_bio(cb); | |
| 2360 | - | cb = NULL; | |
| 2361 | - | compressed_size = 0; | |
| 2362 | - | } | |
| 2363 | 2348 | } | |
| 2364 | 2349 | } | |
| 2365 | 2350 | if (!can_cow_file_range_inline(inode, 0, i_size, compressed_size)) { | |
| @@ -3892,8 +3877,7 @@ int btrfs_orphan_cleanup(struct btrfs_root *root) | |||
| 3892 | 3877 | if (ret) | |
| 3893 | 3878 | goto out; | |
| 3894 | 3879 | } | |
| 3895 | - | /* Only deletes the orphan. */ | |
| 3896 | - | trans = btrfs_start_transaction_fallback_global_rsv(root, 1); | |
| 3880 | + | trans = btrfs_start_transaction(root, 1); | |
| 3897 | 3881 | if (IS_ERR(trans)) { | |
| 3898 | 3882 | ret = PTR_ERR(trans); | |
| 3899 | 3883 | goto out; | |
modified fs/btrfs/super.c
| @@ -1836,12 +1836,8 @@ static int btrfs_statfs(struct dentry *dentry, struct kstatfs *buf) | |||
| 1836 | 1836 | f_fsid.val[0] ^= btrfs_root_id(BTRFS_I(d_inode(dentry))->root) >> 32; | |
| 1837 | 1837 | f_fsid.val[1] ^= btrfs_root_id(BTRFS_I(d_inode(dentry))->root); | |
| 1838 | 1838 | ||
| 1839 | - | /* | |
| 1840 | - | * Hash dev_t to avoid f_fsid collisions with cloned filesystems. | |
| 1841 | - | * Only do this when a clone is present so the original filesystem | |
| 1842 | - | * (mounted first) maintains backward-compatible f_fsid behavior. | |
| 1843 | - | */ | |
| 1844 | - | if (fs_info->fs_devices->temp_fsid) { | |
| 1839 | + | /* Hash dev_t to avoid f_fsid collision with cloned filesystems. */ | |
| 1840 | + | if (fs_info->fs_devices->total_devices == 1) { | |
| 1845 | 1841 | __kernel_fsid_t dev_fsid = | |
| 1846 | 1842 | u64_to_fsid(huge_encode_dev(fs_info->fs_devices->latest_dev->bdev->bd_dev)); | |
| 1847 | 1843 | ||
modified fs/btrfs/tree-checker.c
| @@ -2129,7 +2129,7 @@ static int check_dev_extent_item(const struct extent_buffer *leaf, | |||
| 2129 | 2129 | sectorsize))) { | |
| 2130 | 2130 | generic_err(leaf, slot, | |
| 2131 | 2131 | "invalid dev extent chunk offset, has %llu not aligned to %u", | |
| 2132 | - | btrfs_dev_extent_chunk_offset(leaf, de), | |
| 2132 | + | btrfs_dev_extent_chunk_objectid(leaf, de), | |
| 2133 | 2133 | sectorsize); | |
| 2134 | 2134 | return -EUCLEAN; | |
| 2135 | 2135 | } | |
| @@ -2306,7 +2306,7 @@ static int check_free_space_extent(struct extent_buffer *leaf, struct btrfs_key | |||
| 2306 | 2306 | ||
| 2307 | 2307 | if (unlikely(btrfs_item_size(leaf, slot) != 0)) { | |
| 2308 | 2308 | generic_err(leaf, slot, | |
| 2309 | - | "invalid item size for free space extent, has %u expect 0", | |
| 2309 | + | "invalid item size for free space info, has %u expect 0", | |
| 2310 | 2310 | btrfs_item_size(leaf, slot)); | |
| 2311 | 2311 | return -EUCLEAN; | |
| 2312 | 2312 | } | |
modified fs/btrfs/verity.c
| @@ -93,20 +93,6 @@ static loff_t merkle_file_pos(const struct inode *inode) | |||
| 93 | 93 | return rounded; | |
| 94 | 94 | } | |
| 95 | 95 | ||
| 96 | - | /* | |
| 97 | - | * Start a transaction for removing verity items or the verity orphan. | |
| 98 | - | * | |
| 99 | - | * Like unlink, this only deletes items and frees space in the end, so the | |
| 100 | - | * reservation may come from the global reserve when the filesystem is full | |
| 101 | - | * (-ENOSPC) and is not subject to the qgroup limit (-EDQUOT). Otherwise a | |
| 102 | - | * failed enable could never be cleaned up in either situation. | |
| 103 | - | */ | |
| 104 | - | static struct btrfs_trans_handle *start_verity_cleanup_trans(struct btrfs_root *root, | |
| 105 | - | unsigned int num_items) | |
| 106 | - | { | |
| 107 | - | return btrfs_start_transaction_fallback_global_rsv(root, num_items); | |
| 108 | - | } | |
| 109 | - | ||
| 110 | 96 | /* | |
| 111 | 97 | * Drop all the items for this inode with this key_type. | |
| 112 | 98 | * | |
| @@ -134,7 +120,7 @@ static int drop_verity_items(struct btrfs_inode *inode, u8 key_type) | |||
| 134 | 120 | ||
| 135 | 121 | while (1) { | |
| 136 | 122 | /* 1 for the item being dropped */ | |
| 137 | - | trans = start_verity_cleanup_trans(root, 1); | |
| 123 | + | trans = btrfs_start_transaction(root, 1); | |
| 138 | 124 | if (IS_ERR(trans)) | |
| 139 | 125 | return PTR_ERR(trans); | |
| 140 | 126 | ||
| @@ -480,7 +466,7 @@ static int rollback_verity(struct btrfs_inode *inode) | |||
| 480 | 466 | * 1 for updating the inode flag | |
| 481 | 467 | * 1 for deleting the orphan | |
| 482 | 468 | */ | |
| 483 | - | trans = start_verity_cleanup_trans(root, 2); | |
| 469 | + | trans = btrfs_start_transaction(root, 2); | |
| 484 | 470 | if (IS_ERR(trans)) { | |
| 485 | 471 | ret = PTR_ERR(trans); | |
| 486 | 472 | trans = NULL; | |
modified fs/btrfs/volumes.c
| @@ -749,36 +749,6 @@ const u8 *btrfs_sb_fsid_ptr(const struct btrfs_super_block *sb) | |||
| 749 | 749 | return has_metadata_uuid ? sb->metadata_uuid : sb->fsid; | |
| 750 | 750 | } | |
| 751 | 751 | ||
| 752 | - | static bool should_rename_device(const struct btrfs_device *dev) | |
| 753 | - | { | |
| 754 | - | bool ret; | |
| 755 | - | const char *old_name; | |
| 756 | - | ||
| 757 | - | rcu_read_lock(); | |
| 758 | - | old_name = rcu_dereference(dev->name); | |
| 759 | - | /* | |
| 760 | - | * For systems booted without an initramfs, the rootfs has the device | |
| 761 | - | * name "/dev/root". | |
| 762 | - | * | |
| 763 | - | * Although using btrfs without an initramfs is not recommended (if a | |
| 764 | - | * new device is added to the rootfs, the system can no longer boot, as | |
| 765 | - | * there is no way to register all devices), there is still a minority | |
| 766 | - | * of users doing this. | |
| 767 | - | * | |
| 768 | - | * And after the system is up, a later device scan on the real block | |
| 769 | - | * device file will never get this device's name updated, as the | |
| 770 | - | * device->devt is still the same. | |
| 771 | - | * | |
| 772 | - | * Here we add one and only one exception for "/dev/root", to allow the | |
| 773 | - | * device name to be updated even if the new path points to the same | |
| 774 | - | * block device. | |
| 775 | - | */ | |
| 776 | - | ret = (strcmp(old_name, "/dev/root") == 0); | |
| 777 | - | rcu_read_unlock(); | |
| 778 | - | ||
| 779 | - | return ret; | |
| 780 | - | } | |
| 781 | - | ||
| 782 | 752 | /* | |
| 783 | 753 | * Add new device to list of registered devices | |
| 784 | 754 | * | |
| @@ -899,8 +869,7 @@ static noinline struct btrfs_device *device_list_add(const char *path, | |||
| 899 | 869 | MAJOR(path_devt), MINOR(path_devt), | |
| 900 | 870 | current->comm, task_pid_nr(current)); | |
| 901 | 871 | ||
| 902 | - | } else if (!device->name || device->devt != path_devt || | |
| 903 | - | should_rename_device(device)) { | |
| 872 | + | } else if (!device->name || device->devt != path_devt) { | |
| 904 | 873 | const char *old_name; | |
| 905 | 874 | ||
| 906 | 875 | /* | |
modified fs/btrfs/zoned.c
| @@ -2688,11 +2688,6 @@ bool btrfs_can_activate_zone(struct btrfs_fs_devices *fs_devices, u64 flags) | |||
| 2688 | 2688 | ||
| 2689 | 2689 | switch (flags & BTRFS_BLOCK_GROUP_PROFILE_MASK) { | |
| 2690 | 2690 | case 0: /* single */ | |
| 2691 | - | case BTRFS_BLOCK_GROUP_RAID0: | |
| 2692 | - | case BTRFS_BLOCK_GROUP_RAID1: | |
| 2693 | - | case BTRFS_BLOCK_GROUP_RAID1C3: | |
| 2694 | - | case BTRFS_BLOCK_GROUP_RAID1C4: | |
| 2695 | - | case BTRFS_BLOCK_GROUP_RAID10: | |
| 2696 | 2691 | ret = (atomic_read(&zinfo->active_zones_left) >= (1 + reserved)); | |
| 2697 | 2692 | break; | |
| 2698 | 2693 | case BTRFS_BLOCK_GROUP_DUP: | |
modified fs/dax.c
| @@ -480,12 +480,11 @@ static void dax_associate_entry(void *entry, struct address_space *mapping, | |||
| 480 | 480 | unsigned long address, bool shared) | |
| 481 | 481 | { | |
| 482 | 482 | unsigned long size = dax_entry_size(entry), index; | |
| 483 | - | struct folio *folio; | |
| 483 | + | struct folio *folio = dax_to_folio(entry); | |
| 484 | 484 | ||
| 485 | 485 | if (dax_is_zero_entry(entry) || dax_is_empty_entry(entry)) | |
| 486 | 486 | return; | |
| 487 | 487 | ||
| 488 | - | folio = dax_to_folio(entry); | |
| 489 | 488 | index = linear_page_index(vma, address & ~(size - 1)); | |
| 490 | 489 | if (shared && (folio->mapping || dax_folio_is_shared(folio))) { | |
| 491 | 490 | if (folio->mapping) | |
| @@ -506,23 +505,21 @@ static void dax_associate_entry(void *entry, struct address_space *mapping, | |||
| 506 | 505 | static void dax_disassociate_entry(void *entry, struct address_space *mapping, | |
| 507 | 506 | bool trunc) | |
| 508 | 507 | { | |
| 509 | - | struct folio *folio; | |
| 508 | + | struct folio *folio = dax_to_folio(entry); | |
| 510 | 509 | ||
| 511 | 510 | if (dax_is_zero_entry(entry) || dax_is_empty_entry(entry)) | |
| 512 | 511 | return; | |
| 513 | 512 | ||
| 514 | - | folio = dax_to_folio(entry); | |
| 515 | 513 | dax_folio_put(folio); | |
| 516 | 514 | } | |
| 517 | 515 | ||
| 518 | 516 | static struct page *dax_busy_page(void *entry) | |
| 519 | 517 | { | |
| 520 | - | struct folio *folio; | |
| 518 | + | struct folio *folio = dax_to_folio(entry); | |
| 521 | 519 | ||
| 522 | 520 | if (dax_is_zero_entry(entry) || dax_is_empty_entry(entry)) | |
| 523 | 521 | return NULL; | |
| 524 | 522 | ||
| 525 | - | folio = dax_to_folio(entry); | |
| 526 | 523 | if (folio_ref_count(folio) - folio_mapcount(folio)) | |
| 527 | 524 | return &folio->page; | |
| 528 | 525 | else | |
modified fs/dcache.c
| @@ -1916,10 +1916,6 @@ static struct dentry *__d_alloc(struct super_block *sb, const struct qstr *name) | |||
| 1916 | 1916 | * be overwriting an internal NUL character | |
| 1917 | 1917 | */ | |
| 1918 | 1918 | dentry->d_shortname.string[DNAME_INLINE_LEN-1] = 0; | |
| 1919 | - | ||
| 1920 | - | /* Racy __d_lookup_rcu() walk may read past the NUL; harmless */ | |
| 1921 | - | kmsan_unpoison_memory(dentry->d_shortname.string, DNAME_INLINE_LEN); | |
| 1922 | - | ||
| 1923 | 1919 | if (unlikely(!name)) { | |
| 1924 | 1920 | name = &slash_name; | |
| 1925 | 1921 | dname = dentry->d_shortname.string; | |
modified fs/debugfs/inode.c
| @@ -368,9 +368,6 @@ static struct dentry *debugfs_start_creating(const char *name, | |||
| 368 | 368 | if (!debugfs_enabled) | |
| 369 | 369 | return ERR_PTR(-EPERM); | |
| 370 | 370 | ||
| 371 | - | if (IS_ERR(parent)) | |
| 372 | - | return parent; | |
| 373 | - | ||
| 374 | 371 | if (!debugfs_initialized()) { | |
| 375 | 372 | pr_err("Unable to create file '%s', debugfs is not initialized yet\n", | |
| 376 | 373 | name); | |
| @@ -379,6 +376,9 @@ static struct dentry *debugfs_start_creating(const char *name, | |||
| 379 | 376 | ||
| 380 | 377 | pr_debug("creating file '%s'\n", name); | |
| 381 | 378 | ||
| 379 | + | if (IS_ERR(parent)) | |
| 380 | + | return parent; | |
| 381 | + | ||
| 382 | 382 | error = simple_pin_fs(&debug_fs_type, &debugfs_mount, | |
| 383 | 383 | &debugfs_mount_count); | |
| 384 | 384 | if (error) { | |
modified fs/exec.c
| @@ -882,7 +882,6 @@ static int exec_mmap(struct linux_binprm *bprm) | |||
| 882 | 882 | active_mm = tsk->active_mm; | |
| 883 | 883 | tsk->active_mm = mm; | |
| 884 | 884 | tsk->mm = mm; | |
| 885 | - | sched_cache_exec_mmap(tsk, mm); | |
| 886 | 885 | mm_init_cid(mm, tsk); | |
| 887 | 886 | exec_state = task_exec_state_replace(tsk, exec_state); | |
| 888 | 887 | /* | |
| @@ -1116,17 +1115,6 @@ static struct file *bprm_identity_file(const struct linux_binprm *bprm) | |||
| 1116 | 1115 | return bprm->file; | |
| 1117 | 1116 | } | |
| 1118 | 1117 | ||
| 1119 | - | static void posixtimer_exec(struct task_struct *me) | |
| 1120 | - | { | |
| 1121 | - | #ifdef CONFIG_POSIX_TIMERS | |
| 1122 | - | spin_lock_irq(&me->sighand->siglock); | |
| 1123 | - | posix_cpu_timers_exit(me); | |
| 1124 | - | spin_unlock_irq(&me->sighand->siglock); | |
| 1125 | - | exit_itimers(me); | |
| 1126 | - | flush_itimer_signals(); | |
| 1127 | - | #endif | |
| 1128 | - | } | |
| 1129 | - | ||
| 1130 | 1118 | /* | |
| 1131 | 1119 | * Calling this is the point of no return. None of the failures will be | |
| 1132 | 1120 | * seen by userspace since either the process is already taking a fatal | |
| @@ -1164,16 +1152,6 @@ int begin_new_exec(struct linux_binprm * bprm) | |||
| 1164 | 1152 | retval = de_thread(me); | |
| 1165 | 1153 | if (retval) | |
| 1166 | 1154 | goto out; | |
| 1167 | - | ||
| 1168 | - | /* | |
| 1169 | - | * This must be done here to ensure that POSIX CPU timers which were | |
| 1170 | - | * armed on the current task are dequeued from me::posix_cputimers. | |
| 1171 | - | * Otherwise in case of a TID switch the deletion of the related POSIX | |
| 1172 | - | * timer would not remove an enqueued timer because the TID lookup | |
| 1173 | - | * of the old TID fails. | |
| 1174 | - | */ | |
| 1175 | - | posixtimer_exec(me); | |
| 1176 | - | ||
| 1177 | 1155 | /* see the comment in check_unsafe_exec() */ | |
| 1178 | 1156 | current->fs->in_exec = 0; | |
| 1179 | 1157 | /* | |
| @@ -1228,6 +1206,14 @@ int begin_new_exec(struct linux_binprm * bprm) | |||
| 1228 | 1206 | if (retval) | |
| 1229 | 1207 | goto out_unlock; | |
| 1230 | 1208 | ||
| 1209 | + | #ifdef CONFIG_POSIX_TIMERS | |
| 1210 | + | spin_lock_irq(&me->sighand->siglock); | |
| 1211 | + | posix_cpu_timers_exit(me); | |
| 1212 | + | spin_unlock_irq(&me->sighand->siglock); | |
| 1213 | + | exit_itimers(me); | |
| 1214 | + | flush_itimer_signals(); | |
| 1215 | + | #endif | |
| 1216 | + | ||
| 1231 | 1217 | /* | |
| 1232 | 1218 | * Make the signal table private. | |
| 1233 | 1219 | */ | |
modified fs/fs-writeback.c
| @@ -727,34 +727,19 @@ static bool isw_prepare_wbs_switch(struct bdi_writeback *new_wb, | |||
| 727 | 727 | struct inode_switch_wbs_context *isw, | |
| 728 | 728 | struct list_head *list, int *nr) | |
| 729 | 729 | { | |
| 730 | - | struct inode *inode, *tmp; | |
| 731 | - | LIST_HEAD(scanned); | |
| 732 | - | bool full = false; | |
| 733 | - | ||
| 734 | - | /* | |
| 735 | - | * Walk from the oldest end and move scanned inodes to the newest | |
| 736 | - | * end, so the next scan resumes at unscanned inodes instead of | |
| 737 | - | * re-walking an ever-growing run of prepared and skipped ones. | |
| 738 | - | * For b_dirty_time this keeps the oldest unscanned inode at the | |
| 739 | - | * end move_expired_inodes() picks from; b_attached is unordered. | |
| 740 | - | */ | |
| 741 | - | list_for_each_entry_safe_reverse(inode, tmp, list, i_io_list) { | |
| 742 | - | list_move(&inode->i_io_list, &scanned); | |
| 730 | + | struct inode *inode; | |
| 743 | 731 | ||
| 732 | + | list_for_each_entry(inode, list, i_io_list) { | |
| 744 | 733 | if (!inode_prepare_wbs_switch(inode, new_wb)) | |
| 745 | 734 | continue; | |
| 746 | 735 | ||
| 747 | 736 | isw->inodes[*nr] = inode; | |
| 748 | 737 | (*nr)++; | |
| 749 | 738 | ||
| 750 | - | if (*nr >= WB_MAX_INODES_PER_ISW - 1) { | |
| 751 | - | full = true; | |
| 752 | - | break; | |
| 753 | - | } | |
| 739 | + | if (*nr >= WB_MAX_INODES_PER_ISW - 1) | |
| 740 | + | return true; | |
| 754 | 741 | } | |
| 755 | - | list_splice(&scanned, list); | |
| 756 | - | ||
| 757 | - | return full; | |
| 742 | + | return false; | |
| 758 | 743 | } | |
| 759 | 744 | ||
| 760 | 745 | /** | |
modified fs/inode.c
| @@ -880,6 +880,7 @@ void evict_inodes(struct super_block *sb) | |||
| 880 | 880 | struct inode *inode; | |
| 881 | 881 | LIST_HEAD(dispose); | |
| 882 | 882 | ||
| 883 | + | again: | |
| 883 | 884 | spin_lock(&sb->s_inode_list_lock); | |
| 884 | 885 | list_for_each_entry(inode, &sb->s_inodes, i_sb_list) { | |
| 885 | 886 | if (icount_read_once(inode)) | |
| @@ -898,19 +899,19 @@ void evict_inodes(struct super_block *sb) | |||
| 898 | 899 | inode_state_set(inode, I_FREEING); | |
| 899 | 900 | inode_lru_list_del(inode); | |
| 900 | 901 | spin_unlock(&inode->i_lock); | |
| 902 | + | list_add(&inode->i_lru, &dispose); | |
| 901 | 903 | ||
| 902 | 904 | /* | |
| 903 | - | * Keep this inode out of dispose so it stays on s_inodes while | |
| 904 | - | * the list lock is dropped. I_FREEING prevents new references | |
| 905 | - | * and leaves eviction to us, so we can resume the walk from it. | |
| 905 | + | * We can have a ton of inodes to evict at unmount time given | |
| 906 | + | * enough memory, check to see if we need to go to sleep for a | |
| 907 | + | * bit so we don't livelock. | |
| 906 | 908 | */ | |
| 907 | 909 | if (need_resched()) { | |
| 908 | 910 | spin_unlock(&sb->s_inode_list_lock); | |
| 909 | 911 | cond_resched(); | |
| 910 | 912 | dispose_list(&dispose); | |
| 911 | - | spin_lock(&sb->s_inode_list_lock); | |
| 913 | + | goto again; | |
| 912 | 914 | } | |
| 913 | - | list_add(&inode->i_lru, &dispose); | |
| 914 | 915 | } | |
| 915 | 916 | spin_unlock(&sb->s_inode_list_lock); | |
| 916 | 917 | ||
modified fs/isofs/dir.c
| @@ -110,21 +110,25 @@ static int do_isofs_readdir(struct inode *inode, struct file *file, | |||
| 110 | 110 | return 0; | |
| 111 | 111 | } | |
| 112 | 112 | ||
| 113 | - | de = (struct iso_directory_record *)(bh->b_data + offset); | |
| 113 | + | de = (struct iso_directory_record *) (bh->b_data + offset); | |
| 114 | + | ||
| 115 | + | de_len = *(unsigned char *)de; | |
| 116 | + | ||
| 114 | 117 | /* | |
| 115 | - | * If we are at the end of a block (or at its zero-padded | |
| 116 | - | * tail), move on to the next CDROM sector. If we are at the | |
| 117 | - | * end of the directory, we'll abort the while loop. | |
| 118 | + | * If the length byte is zero, we should move on to the next | |
| 119 | + | * CDROM sector. If we are at the end of the directory, we | |
| 120 | + | * kick out of the while loop. | |
| 118 | 121 | */ | |
| 119 | - | if (offset >= bufsize || de->length[0] == 0) { | |
| 122 | + | ||
| 123 | + | if (de_len == 0) { | |
| 120 | 124 | brelse(bh); | |
| 121 | 125 | bh = NULL; | |
| 122 | - | block++; | |
| 123 | - | ctx->pos = (loff_t)block << bufbits; | |
| 126 | + | ctx->pos = (ctx->pos + ISOFS_BLOCK_SIZE) & ~(ISOFS_BLOCK_SIZE - 1); | |
| 127 | + | block = ctx->pos >> bufbits; | |
| 124 | 128 | offset = 0; | |
| 125 | 129 | continue; | |
| 126 | 130 | } | |
| 127 | - | de_len = de->length[0]; | |
| 131 | + | ||
| 128 | 132 | block_saved = block; | |
| 129 | 133 | offset_saved = offset; | |
| 130 | 134 | offset += de_len; | |
modified fs/isofs/namei.c
| @@ -74,20 +74,18 @@ isofs_find_entry(struct inode *dir, struct dentry *dentry, | |||
| 74 | 74 | return 0; | |
| 75 | 75 | } | |
| 76 | 76 | ||
| 77 | - | de = (struct iso_directory_record *)(bh->b_data + offset); | |
| 78 | - | /* | |
| 79 | - | * If we are at the end of the block or at its zero-padded | |
| 80 | - | * tail, move to the next block. | |
| 81 | - | */ | |
| 82 | - | if (offset >= bufsize || de->length[0] == 0) { | |
| 77 | + | de = (struct iso_directory_record *) (bh->b_data + offset); | |
| 78 | + | ||
| 79 | + | de_len = *(unsigned char *) de; | |
| 80 | + | if (!de_len) { | |
| 83 | 81 | brelse(bh); | |
| 84 | 82 | bh = NULL; | |
| 85 | - | block++; | |
| 86 | - | f_pos = block << bufbits; | |
| 83 | + | f_pos = (f_pos + ISOFS_BLOCK_SIZE) & ~(ISOFS_BLOCK_SIZE - 1); | |
| 84 | + | block = f_pos >> bufbits; | |
| 87 | 85 | offset = 0; | |
| 88 | 86 | continue; | |
| 89 | 87 | } | |
| 90 | - | de_len = de->length[0]; | |
| 88 | + | ||
| 91 | 89 | block_saved = bh->b_blocknr; | |
| 92 | 90 | offset_saved = offset; | |
| 93 | 91 | offset += de_len; | |
modified fs/kernfs/mount.c
| @@ -434,8 +434,8 @@ void kernfs_kill_sb(struct super_block *sb) | |||
| 434 | 434 | up_write(&root->kernfs_supers_rwsem); | |
| 435 | 435 | ||
| 436 | 436 | /* | |
| 437 | - | * Mark the superblock dead so sget_fc() can't find it, | |
| 438 | - | * before freeing kernfs_super_info. | |
| 437 | + | * Remove the superblock from fs_supers/s_instances | |
| 438 | + | * so we can't find it, before freeing kernfs_super_info. | |
| 439 | 439 | */ | |
| 440 | 440 | kill_anon_super(sb); | |
| 441 | 441 | kfree(info); | |
modified fs/namespace.c
| @@ -6184,21 +6184,6 @@ struct mnt_namespace init_mnt_ns = { | |||
| 6184 | 6184 | .poll = __WAIT_QUEUE_HEAD_INITIALIZER(init_mnt_ns.poll), | |
| 6185 | 6185 | }; | |
| 6186 | 6186 | ||
| 6187 | - | static void __init mount_rootfs_on_nullfs(struct vfsmount *mnt, | |
| 6188 | - | struct vfsmount *nullfs_mnt) | |
| 6189 | - | { | |
| 6190 | - | struct path root = { | |
| 6191 | - | .mnt = nullfs_mnt, | |
| 6192 | - | .dentry = nullfs_mnt->mnt_root, | |
| 6193 | - | }; | |
| 6194 | - | ||
| 6195 | - | LOCK_MOUNT_EXACT(mp, &root); | |
| 6196 | - | if (unlikely(IS_ERR(mp.parent))) | |
| 6197 | - | panic("VFS: Failed to mount rootfs on nullfs"); | |
| 6198 | - | scoped_guard(mount_writer) | |
| 6199 | - | attach_mnt(real_mount(mnt), mp.parent, mp.mp); | |
| 6200 | - | } | |
| 6201 | - | ||
| 6202 | 6187 | static void __init init_mount_tree(void) | |
| 6203 | 6188 | { | |
| 6204 | 6189 | struct vfsmount *mnt, *nullfs_mnt; | |
| @@ -6230,7 +6215,15 @@ static void __init init_mount_tree(void) | |||
| 6230 | 6215 | mnt_root = real_mount(nullfs_mnt); | |
| 6231 | 6216 | init_mnt_ns.root = mnt_root; | |
| 6232 | 6217 | ||
| 6233 | - | mount_rootfs_on_nullfs(mnt, nullfs_mnt); | |
| 6218 | + | /* Mount mutable rootfs on top of nullfs. */ | |
| 6219 | + | root.mnt = nullfs_mnt; | |
| 6220 | + | root.dentry = nullfs_mnt->mnt_root; | |
| 6221 | + | ||
| 6222 | + | LOCK_MOUNT_EXACT(mp, &root); | |
| 6223 | + | if (unlikely(IS_ERR(mp.parent))) | |
| 6224 | + | panic("VFS: Failed to mount rootfs on nullfs"); | |
| 6225 | + | scoped_guard(mount_writer) | |
| 6226 | + | attach_mnt(real_mount(mnt), mp.parent, mp.mp); | |
| 6234 | 6227 | ||
| 6235 | 6228 | pr_info("VFS: Finished mounting rootfs on nullfs\n"); | |
| 6236 | 6229 | ||
| @@ -6301,7 +6294,7 @@ void put_mnt_ns(struct mnt_namespace *ns) | |||
| 6301 | 6294 | guard(namespace_excl)(); | |
| 6302 | 6295 | emptied_ns = ns; | |
| 6303 | 6296 | guard(mount_writer)(); | |
| 6304 | - | umount_tree(ns->root, 0); | |
| 6297 | + | umount_tree(ns->root, UMOUNT_CONNECTED); | |
| 6305 | 6298 | } | |
| 6306 | 6299 | ||
| 6307 | 6300 | struct vfsmount *kern_mount(struct file_system_type *type) | |
modified fs/netfs/buffered_read.c
| @@ -482,14 +482,15 @@ static int netfs_read_gaps(struct file *file, struct folio *folio) | |||
| 482 | 482 | struct netfs_group *group = netfs_folio_group(folio); | |
| 483 | 483 | struct netfs_folio *finfo = netfs_folio_info(folio); | |
| 484 | 484 | struct netfs_inode *ctx = netfs_inode(mapping->host); | |
| 485 | - | struct bio_vec *bvec = NULL; | |
| 485 | + | struct folio *sink = NULL; | |
| 486 | + | struct bio_vec *bvec; | |
| 486 | 487 | unsigned int from = finfo->dirty_offset; | |
| 487 | 488 | unsigned int to = from + finfo->dirty_len; | |
| 488 | - | unsigned int off = 0; | |
| 489 | + | unsigned int off = 0, i = 0; | |
| 489 | 490 | size_t flen = folio_size(folio); | |
| 490 | 491 | size_t nr_bvec = flen / PAGE_SIZE + 2; | |
| 491 | 492 | size_t part; | |
| 492 | - | int ret, i = 0, sink_from = -1, sink_to = -1; | |
| 493 | + | int ret; | |
| 493 | 494 | ||
| 494 | 495 | _enter("%lx", folio->index); | |
| 495 | 496 | ||
| @@ -514,23 +515,24 @@ static int netfs_read_gaps(struct file *file, struct folio *folio) | |||
| 514 | 515 | if (!bvec) | |
| 515 | 516 | goto discard; | |
| 516 | 517 | ||
| 518 | + | sink = folio_alloc(GFP_KERNEL, 0); | |
| 519 | + | if (!sink) { | |
| 520 | + | kfree(bvec); | |
| 521 | + | goto discard; | |
| 522 | + | } | |
| 523 | + | ||
| 517 | 524 | trace_netfs_folio(folio, netfs_folio_trace_read_gaps); | |
| 518 | 525 | ||
| 526 | + | rreq->direct_bv = bvec; | |
| 527 | + | rreq->direct_bv_count = nr_bvec; | |
| 519 | 528 | if (from > 0) { | |
| 520 | 529 | bvec_set_folio(&bvec[i++], folio, from, 0); | |
| 521 | 530 | off = from; | |
| 522 | 531 | } | |
| 523 | - | sink_from = i; | |
| 524 | 532 | while (off < to) { | |
| 525 | - | struct folio *sink = folio_alloc(GFP_KERNEL, 0); | |
| 526 | - | ||
| 527 | - | if (!sink) | |
| 528 | - | goto discard; | |
| 529 | 533 | part = min_t(size_t, to - off, PAGE_SIZE); | |
| 530 | - | bvec_set_folio(&bvec[i], sink, part, 0); | |
| 534 | + | bvec_set_folio(&bvec[i++], sink, part, 0); | |
| 531 | 535 | off += part; | |
| 532 | - | sink_to = i; | |
| 533 | - | i++; | |
| 534 | 536 | } | |
| 535 | 537 | if (to < flen) | |
| 536 | 538 | bvec_set_folio(&bvec[i++], folio, flen - to, to); | |
| @@ -551,10 +553,8 @@ static int netfs_read_gaps(struct file *file, struct folio *folio) | |||
| 551 | 553 | folio_mark_uptodate(folio); | |
| 552 | 554 | } | |
| 553 | 555 | ||
| 554 | - | if (sink_to >= 0) | |
| 555 | - | for (; sink_from <= sink_to; sink_from++) | |
| 556 | - | folio_put(bvec_folio(&bvec[sink_from])); | |
| 557 | - | kfree(bvec); | |
| 556 | + | if (sink) | |
| 557 | + | folio_put(sink); | |
| 558 | 558 | folio_unlock(folio); | |
| 559 | 559 | netfs_put_request(rreq, netfs_rreq_trace_put_return); | |
| 560 | 560 | return ret < 0 ? ret : 0; | |
| @@ -563,10 +563,6 @@ discard: | |||
| 563 | 563 | netfs_put_failed_request(rreq); | |
| 564 | 564 | alloc_error: | |
| 565 | 565 | folio_unlock(folio); | |
| 566 | - | if (sink_to >= 0) | |
| 567 | - | for (; sink_from <= sink_to; sink_from++) | |
| 568 | - | folio_put(bvec_folio(&bvec[sink_from])); | |
| 569 | - | kfree(bvec); | |
| 570 | 566 | return ret; | |
| 571 | 567 | } | |
| 572 | 568 | ||
modified fs/netfs/objects.c
| @@ -34,7 +34,7 @@ struct netfs_io_request *netfs_alloc_request(struct address_space *mapping, | |||
| 34 | 34 | ||
| 35 | 35 | rreq = mempool_alloc(mempool, gfp); | |
| 36 | 36 | } else { | |
| 37 | - | rreq = mempool_alloc_noreserve(mempool, gfp); | |
| 37 | + | rreq = mempool->alloc(gfp, mempool->pool_data); | |
| 38 | 38 | if (!rreq) | |
| 39 | 39 | return ERR_PTR(-ENOMEM); | |
| 40 | 40 | } | |
| @@ -214,7 +214,7 @@ struct netfs_io_subrequest *netfs_alloc_subrequest(struct netfs_io_request *rreq | |||
| 214 | 214 | struct kmem_cache *cache = mempool->pool_data; | |
| 215 | 215 | ||
| 216 | 216 | if (rreq->gfp == GFP_KERNEL) | |
| 217 | - | subreq = mempool_alloc_noreserve(mempool, rreq->gfp); | |
| 217 | + | subreq = mempool->alloc(rreq->gfp, mempool->pool_data); | |
| 218 | 218 | else | |
| 219 | 219 | subreq = mempool_alloc(mempool, rreq->gfp); | |
| 220 | 220 | if (!subreq) | |
modified fs/netfs/read_collect.c
| @@ -435,11 +435,6 @@ static void netfs_rreq_assess_single(struct netfs_io_request *rreq) | |||
| 435 | 435 | netfs_single_mark_inode_dirty(rreq->inode); | |
| 436 | 436 | } | |
| 437 | 437 | ||
| 438 | - | /* To do DIO, the cache has to round the size up, so we need to undo | |
| 439 | - | * the rounding. | |
| 440 | - | */ | |
| 441 | - | rreq->transferred = min(rreq->transferred, rreq->i_size); | |
| 442 | - | ||
| 443 | 438 | if (rreq->iocb) { | |
| 444 | 439 | rreq->iocb->ki_pos += rreq->transferred; | |
| 445 | 440 | if (rreq->iocb->ki_complete) { | |
modified fs/netfs/rolling_buffer.c
| @@ -29,7 +29,7 @@ struct folio_queue *netfs_folioq_alloc(unsigned int rreq_id, gfp_t gfp, | |||
| 29 | 29 | struct folio_queue *fq; | |
| 30 | 30 | ||
| 31 | 31 | if (gfp == GFP_KERNEL) | |
| 32 | - | fq = mempool_alloc_noreserve(&netfs_folioq_pool, gfp); | |
| 32 | + | fq = netfs_folioq_pool.alloc(gfp, netfs_folioq_pool.pool_data); | |
| 33 | 33 | else | |
| 34 | 34 | fq = mempool_alloc(&netfs_folioq_pool, gfp); | |
| 35 | 35 | if (fq) { | |
modified fs/nfsd/export.c
| @@ -1005,8 +1005,7 @@ static int nfsd_nl_parse_one_export(struct cache_detail *cd, | |||
| 1005 | 1005 | goto out_uuid; | |
| 1006 | 1006 | err = 0; | |
| 1007 | 1007 | ||
| 1008 | - | if (exp.ex_flags & NFSEXP_PNFS) | |
| 1009 | - | nfsd4_setup_layout_type(&exp); | |
| 1008 | + | nfsd4_setup_layout_type(&exp); | |
| 1010 | 1009 | } | |
| 1011 | 1010 | ||
| 1012 | 1011 | expp = svc_export_lookup(&exp); | |
modified fs/ntfs/attrib.c
| @@ -2917,7 +2917,7 @@ retry: | |||
| 2917 | 2917 | ||
| 2918 | 2918 | attr_ni = NULL; | |
| 2919 | 2919 | /* Allocate new extent. */ | |
| 2920 | - | err = ntfs_mft_record_alloc(ni->vol, 0, &attr_ni, ni, NULL, -1); | |
| 2920 | + | err = ntfs_mft_record_alloc(ni->vol, 0, &attr_ni, ni, NULL); | |
| 2921 | 2921 | if (err) { | |
| 2922 | 2922 | ntfs_error(sb, "Failed to allocate extent record"); | |
| 2923 | 2923 | goto err_out; | |
| @@ -3550,7 +3550,7 @@ int ntfs_attr_record_move_away(struct ntfs_attr_search_ctx *ctx, int extra) | |||
| 3550 | 3550 | * new extent and move attribute to it. | |
| 3551 | 3551 | */ | |
| 3552 | 3552 | ni = NULL; | |
| 3553 | - | err = ntfs_mft_record_alloc(base_ni->vol, 0, &ni, base_ni, NULL, -1); | |
| 3553 | + | err = ntfs_mft_record_alloc(base_ni->vol, 0, &ni, base_ni, NULL); | |
| 3554 | 3554 | if (err) { | |
| 3555 | 3555 | ntfs_error(sb, "Couldn't allocate MFT record, err : %d", err); | |
| 3556 | 3556 | return err; | |
| @@ -3574,8 +3574,7 @@ int ntfs_attr_record_move_away(struct ntfs_attr_search_ctx *ctx, int extra) | |||
| 3574 | 3574 | * update allocated and compressed size. | |
| 3575 | 3575 | */ | |
| 3576 | 3576 | static int ntfs_attr_update_meta(struct attr_record *a, struct ntfs_inode *ni, | |
| 3577 | - | struct mft_record *m, struct ntfs_attr_search_ctx *ctx, | |
| 3578 | - | struct ntfs_inode *locked_ni, bool defer_attrlist) | |
| 3577 | + | struct mft_record *m, struct ntfs_attr_search_ctx *ctx) | |
| 3579 | 3578 | { | |
| 3580 | 3579 | int sparse, err = 0; | |
| 3581 | 3580 | struct ntfs_inode *base_ni; | |
| @@ -3611,8 +3610,6 @@ static int ntfs_attr_update_meta(struct attr_record *a, struct ntfs_inode *ni, | |||
| 3611 | 3610 | le16_to_cpu(a->data.non_resident.mapping_pairs_offset) == 8) && | |
| 3612 | 3611 | !(le32_to_cpu(m->bytes_allocated) - le32_to_cpu(m->bytes_in_use))) { | |
| 3613 | 3612 | ||
| 3614 | - | if (defer_attrlist) | |
| 3615 | - | return -ENOSPC; | |
| 3616 | 3613 | if (!NInoAttrList(base_ni)) { | |
| 3617 | 3614 | err = ntfs_inode_add_attrlist(base_ni); | |
| 3618 | 3615 | if (err) | |
| @@ -3626,7 +3623,7 @@ static int ntfs_attr_update_meta(struct attr_record *a, struct ntfs_inode *ni, | |||
| 3626 | 3623 | goto out; | |
| 3627 | 3624 | } | |
| 3628 | 3625 | ||
| 3629 | - | err = ntfs_attrlist_update_locked(base_ni, locked_ni); | |
| 3626 | + | err = ntfs_attrlist_update(base_ni); | |
| 3630 | 3627 | if (err) | |
| 3631 | 3628 | goto out; | |
| 3632 | 3629 | err = -EAGAIN; | |
| @@ -3706,8 +3703,6 @@ out: | |||
| 3706 | 3703 | * ntfs_attr_update_mapping_pairs - update mapping pairs for ntfs attribute | |
| 3707 | 3704 | * @ni: non-resident ntfs inode for which we need update | |
| 3708 | 3705 | * @from_vcn: update runlist starting this VCN | |
| 3709 | - | * @locked_ni: inode whose runlist write lock is already held | |
| 3710 | - | * @defer_attrlist: return -ENOSPC instead of updating an attribute list | |
| 3711 | 3706 | * | |
| 3712 | 3707 | * Build mapping pairs from @na->rl and write them to the disk. Also, this | |
| 3713 | 3708 | * function updates sparse bit, allocated and compressed size (allocates/frees | |
| @@ -3717,10 +3712,7 @@ out: | |||
| 3717 | 3712 | * call to this function. Vice-versa @na->compressed_size will be calculated and | |
| 3718 | 3713 | * set to correct value during this function. | |
| 3719 | 3714 | */ | |
| 3720 | - | static int __ntfs_attr_update_mapping_pairs(struct ntfs_inode *ni, | |
| 3721 | - | s64 from_vcn, | |
| 3722 | - | struct ntfs_inode *locked_ni, | |
| 3723 | - | bool defer_attrlist) | |
| 3715 | + | int ntfs_attr_update_mapping_pairs(struct ntfs_inode *ni, s64 from_vcn) | |
| 3724 | 3716 | { | |
| 3725 | 3717 | struct ntfs_attr_search_ctx *ctx; | |
| 3726 | 3718 | struct ntfs_inode *base_ni; | |
| @@ -3812,8 +3804,7 @@ retry: | |||
| 3812 | 3804 | continue; | |
| 3813 | 3805 | } | |
| 3814 | 3806 | ||
| 3815 | - | err = ntfs_attr_update_meta(a, ni, m, ctx, locked_ni, | |
| 3816 | - | defer_attrlist); | |
| 3807 | + | err = ntfs_attr_update_meta(a, ni, m, ctx); | |
| 3817 | 3808 | if (err < 0) { | |
| 3818 | 3809 | if (err == -EAGAIN) { | |
| 3819 | 3810 | ntfs_attr_put_search_ctx(ctx); | |
| @@ -3853,28 +3844,18 @@ retry: | |||
| 3853 | 3844 | */ | |
| 3854 | 3845 | if (ni->type == AT_ATTRIBUTE_LIST) { | |
| 3855 | 3846 | ntfs_attr_put_search_ctx(ctx); | |
| 3856 | - | ctx = NULL; | |
| 3857 | - | if (locked_ni == ni || defer_attrlist) { | |
| 3858 | - | err = -ENOSPC; | |
| 3859 | - | goto put_err_out; | |
| 3847 | + | if (ntfs_inode_free_space(base_ni, mp_size - | |
| 3848 | + | cur_max_mp_size)) { | |
| 3849 | + | ntfs_debug("Attribute list is too big. Defragment the volume\n"); | |
| 3850 | + | return -ENOSPC; | |
| 3860 | 3851 | } | |
| 3861 | - | err = ntfs_inode_free_space(base_ni, mp_size - | |
| 3862 | - | cur_max_mp_size); | |
| 3863 | - | if (err) | |
| 3864 | - | return err; | |
| 3865 | - | err = ntfs_attrlist_update_locked( | |
| 3866 | - | base_ni, locked_ni); | |
| 3867 | - | if (err) | |
| 3868 | - | return err; | |
| 3852 | + | if (ntfs_attrlist_update(base_ni)) | |
| 3853 | + | return -EIO; | |
| 3869 | 3854 | goto retry; | |
| 3870 | 3855 | } | |
| 3871 | 3856 | ||
| 3872 | 3857 | /* Add attribute list if it isn't present, and retry. */ | |
| 3873 | 3858 | if (!NInoAttrList(base_ni)) { | |
| 3874 | - | if (defer_attrlist) { | |
| 3875 | - | err = -ENOSPC; | |
| 3876 | - | goto put_err_out; | |
| 3877 | - | } | |
| 3878 | 3859 | ntfs_attr_put_search_ctx(ctx); | |
| 3879 | 3860 | if (ntfs_inode_add_attrlist(base_ni)) { | |
| 3880 | 3861 | ntfs_error(sb, "Can not add attrlist"); | |
| @@ -3902,21 +3883,13 @@ retry: | |||
| 3902 | 3883 | } | |
| 3903 | 3884 | } | |
| 3904 | 3885 | ||
| 3905 | - | if (defer_attrlist && | |
| 3906 | - | (ctx->ntfs_ino->nr_extents == -1 || | |
| 3907 | - | NInoAttrList(ctx->ntfs_ino)) && | |
| 3908 | - | ctx->attr->type != AT_ATTRIBUTE_LIST) { | |
| 3909 | - | err = -ENOSPC; | |
| 3910 | - | goto put_err_out; | |
| 3911 | - | } | |
| 3912 | - | ||
| 3913 | 3886 | /* Update lowest vcn. */ | |
| 3914 | 3887 | a->data.non_resident.lowest_vcn = cpu_to_le64(stop_vcn); | |
| 3915 | 3888 | mark_mft_record_dirty(ctx->ntfs_ino); | |
| 3916 | 3889 | if ((ctx->ntfs_ino->nr_extents == -1 || NInoAttrList(ctx->ntfs_ino)) && | |
| 3917 | 3890 | ctx->attr->type != AT_ATTRIBUTE_LIST) { | |
| 3918 | 3891 | ctx->al_entry->lowest_vcn = cpu_to_le64(stop_vcn); | |
| 3919 | - | err = ntfs_attrlist_update_locked(base_ni, locked_ni); | |
| 3892 | + | err = ntfs_attrlist_update(base_ni); | |
| 3920 | 3893 | if (err) | |
| 3921 | 3894 | goto put_err_out; | |
| 3922 | 3895 | } | |
| @@ -4003,10 +3976,7 @@ retry: | |||
| 4003 | 3976 | unsigned int de_cnt = 0; | |
| 4004 | 3977 | ||
| 4005 | 3978 | /* Allocate new mft record. */ | |
| 4006 | - | err = ntfs_mft_record_alloc(ni->vol, 0, &ext_ni, base_ni, NULL, | |
| 4007 | - | base_ni->mft_no == FILE_MFT && | |
| 4008 | - | ni->type == AT_DATA && | |
| 4009 | - | ni->name == AT_UNNAMED ? stop_vcn : -1); | |
| 3979 | + | err = ntfs_mft_record_alloc(ni->vol, 0, &ext_ni, base_ni, NULL); | |
| 4010 | 3980 | if (err) { | |
| 4011 | 3981 | ntfs_error(sb, "Failed to allocate extent record"); | |
| 4012 | 3982 | goto put_err_out; | |
| @@ -4091,19 +4061,6 @@ put_err_out: | |||
| 4091 | 4061 | return err; | |
| 4092 | 4062 | } | |
| 4093 | 4063 | ||
| 4094 | - | int ntfs_attr_update_mapping_pairs_locked(struct ntfs_inode *ni, | |
| 4095 | - | s64 from_vcn, | |
| 4096 | - | struct ntfs_inode *locked_ni) | |
| 4097 | - | { | |
| 4098 | - | return __ntfs_attr_update_mapping_pairs(ni, from_vcn, locked_ni, | |
| 4099 | - | false); | |
| 4100 | - | } | |
| 4101 | - | ||
| 4102 | - | int ntfs_attr_update_mapping_pairs(struct ntfs_inode *ni, s64 from_vcn) | |
| 4103 | - | { | |
| 4104 | - | return ntfs_attr_update_mapping_pairs_locked(ni, from_vcn, NULL); | |
| 4105 | - | } | |
| 4106 | - | ||
| 4107 | 4064 | /* | |
| 4108 | 4065 | * ntfs_attr_make_resident - convert a non-resident to a resident attribute | |
| 4109 | 4066 | * @ni: open ntfs attribute to make resident | |
| @@ -4237,9 +4194,7 @@ static int ntfs_attr_make_resident(struct ntfs_inode *ni, struct ntfs_attr_searc | |||
| 4237 | 4194 | * | |
| 4238 | 4195 | * Reduce the size of a non-resident, open ntfs attribute @na to @newsize bytes. | |
| 4239 | 4196 | */ | |
| 4240 | - | static int ntfs_non_resident_attr_shrink(struct ntfs_inode *ni, | |
| 4241 | - | const s64 newsize, | |
| 4242 | - | struct ntfs_inode *locked_ni) | |
| 4197 | + | static int ntfs_non_resident_attr_shrink(struct ntfs_inode *ni, const s64 newsize) | |
| 4243 | 4198 | { | |
| 4244 | 4199 | struct ntfs_volume *vol; | |
| 4245 | 4200 | struct ntfs_attr_search_ctx *ctx; | |
| @@ -4247,7 +4202,6 @@ static int ntfs_non_resident_attr_shrink(struct ntfs_inode *ni, | |||
| 4247 | 4202 | s64 nr_freed_clusters; | |
| 4248 | 4203 | int err; | |
| 4249 | 4204 | struct ntfs_inode *base_ni; | |
| 4250 | - | bool runlist_locked = locked_ni == ni; | |
| 4251 | 4205 | ||
| 4252 | 4206 | ntfs_debug("Inode 0x%llx attr 0x%x new size %lld\n", | |
| 4253 | 4207 | (unsigned long long)ni->mft_no, ni->type, (long long)newsize); | |
| @@ -4293,24 +4247,18 @@ static int ntfs_non_resident_attr_shrink(struct ntfs_inode *ni, | |||
| 4293 | 4247 | * clusters if there is a change. | |
| 4294 | 4248 | */ | |
| 4295 | 4249 | if (ntfs_bytes_to_cluster(vol, ni->allocated_size) != first_free_vcn) { | |
| 4296 | - | /* | |
| 4297 | - | * ntfs_cluster_free() and ntfs_rl_truncate_nolock() | |
| 4298 | - | * both require this lock. | |
| 4299 | - | */ | |
| 4300 | - | if (!runlist_locked) | |
| 4301 | - | down_write(&ni->runlist.lock); | |
| 4250 | + | struct ntfs_attr_search_ctx *ctx; | |
| 4302 | 4251 | ||
| 4303 | 4252 | err = ntfs_attr_map_whole_runlist(ni); | |
| 4304 | 4253 | if (err) { | |
| 4305 | 4254 | ntfs_debug("Eeek! ntfs_attr_map_whole_runlist failed.\n"); | |
| 4306 | - | goto unlock_runlist; | |
| 4255 | + | return err; | |
| 4307 | 4256 | } | |
| 4308 | 4257 | ||
| 4309 | 4258 | ctx = ntfs_attr_get_search_ctx(ni, NULL); | |
| 4310 | 4259 | if (!ctx) { | |
| 4311 | 4260 | ntfs_error(vol->sb, "%s: Failed to get search context", __func__); | |
| 4312 | - | err = -ENOMEM; | |
| 4313 | - | goto unlock_runlist; | |
| 4261 | + | return -ENOMEM; | |
| 4314 | 4262 | } | |
| 4315 | 4263 | ||
| 4316 | 4264 | /* Deallocate all clusters starting with the first free one. */ | |
| @@ -4318,8 +4266,7 @@ static int ntfs_non_resident_attr_shrink(struct ntfs_inode *ni, | |||
| 4318 | 4266 | if (nr_freed_clusters < 0) { | |
| 4319 | 4267 | ntfs_debug("Eeek! Freeing of clusters failed. Aborting...\n"); | |
| 4320 | 4268 | ntfs_attr_put_search_ctx(ctx); | |
| 4321 | - | err = (int)nr_freed_clusters; | |
| 4322 | - | goto unlock_runlist; | |
| 4269 | + | return (int)nr_freed_clusters; | |
| 4323 | 4270 | } | |
| 4324 | 4271 | ntfs_attr_put_search_ctx(ctx); | |
| 4325 | 4272 | ||
| @@ -4332,8 +4279,7 @@ static int ntfs_non_resident_attr_shrink(struct ntfs_inode *ni, | |||
| 4332 | 4279 | kvfree(ni->runlist.rl); | |
| 4333 | 4280 | ni->runlist.rl = NULL; | |
| 4334 | 4281 | ntfs_error(vol->sb, "Eeek! Run list truncation failed.\n"); | |
| 4335 | - | err = -EIO; | |
| 4336 | - | goto unlock_runlist; | |
| 4282 | + | return -EIO; | |
| 4337 | 4283 | } | |
| 4338 | 4284 | ||
| 4339 | 4285 | /* Prepare to mapping pairs update. */ | |
| @@ -4349,13 +4295,11 @@ static int ntfs_non_resident_attr_shrink(struct ntfs_inode *ni, | |||
| 4349 | 4295 | VFS_I(base_ni)->i_blocks = ni->allocated_size >> 9; | |
| 4350 | 4296 | ||
| 4351 | 4297 | /* Write mapping pairs for new runlist. */ | |
| 4352 | - | err = ntfs_attr_update_mapping_pairs_locked(ni, 0, ni); | |
| 4298 | + | err = ntfs_attr_update_mapping_pairs(ni, 0 /*first_free_vcn*/); | |
| 4353 | 4299 | if (err) { | |
| 4354 | 4300 | ntfs_debug("Eeek! Mapping pairs update failed. Leaving inconstant metadata. Run chkdsk.\n"); | |
| 4355 | - | goto unlock_runlist; | |
| 4301 | + | return err; | |
| 4356 | 4302 | } | |
| 4357 | - | if (!runlist_locked) | |
| 4358 | - | up_write(&ni->runlist.lock); | |
| 4359 | 4303 | } | |
| 4360 | 4304 | ||
| 4361 | 4305 | /* Get the first attribute record. */ | |
| @@ -4397,11 +4341,7 @@ static int ntfs_non_resident_attr_shrink(struct ntfs_inode *ni, | |||
| 4397 | 4341 | ||
| 4398 | 4342 | /* If the attribute now has zero size, make it resident. */ | |
| 4399 | 4343 | if (!newsize && !NInoEncrypted(ni) && !NInoCompressed(ni)) { | |
| 4400 | - | if (!runlist_locked) | |
| 4401 | - | down_write(&ni->runlist.lock); | |
| 4402 | 4344 | err = ntfs_attr_make_resident(ni, ctx); | |
| 4403 | - | if (!runlist_locked) | |
| 4404 | - | up_write(&ni->runlist.lock); | |
| 4405 | 4345 | if (err) { | |
| 4406 | 4346 | /* If couldn't make resident, just continue. */ | |
| 4407 | 4347 | if (err != -EPERM) | |
| @@ -4418,11 +4358,6 @@ static int ntfs_non_resident_attr_shrink(struct ntfs_inode *ni, | |||
| 4418 | 4358 | put_err_out: | |
| 4419 | 4359 | ntfs_attr_put_search_ctx(ctx); | |
| 4420 | 4360 | return err; | |
| 4421 | - | ||
| 4422 | - | unlock_runlist: | |
| 4423 | - | if (!runlist_locked) | |
| 4424 | - | up_write(&ni->runlist.lock); | |
| 4425 | - | return err; | |
| 4426 | 4361 | } | |
| 4427 | 4362 | ||
| 4428 | 4363 | /* | |
| @@ -4431,14 +4366,13 @@ unlock_runlist: | |||
| 4431 | 4366 | * @prealloc_size: preallocation size (in bytes) to which to expand the attribute | |
| 4432 | 4367 | * @newsize: new size (in bytes) to which to expand the attribute | |
| 4433 | 4368 | * @holes: how to create a hole if expanding | |
| 4434 | - | * @locked_ni: inode whose runlist lock is already held | |
| 4369 | + | * @need_lock: whether mrec lock is needed or not | |
| 4435 | 4370 | * | |
| 4436 | 4371 | * Expand the size of a non-resident, open ntfs attribute @na to @newsize bytes, | |
| 4437 | 4372 | * by allocating new clusters. | |
| 4438 | 4373 | */ | |
| 4439 | 4374 | static int ntfs_non_resident_attr_expand(struct ntfs_inode *ni, const s64 newsize, | |
| 4440 | - | const s64 prealloc_size, unsigned int holes, | |
| 4441 | - | struct ntfs_inode *locked_ni) | |
| 4375 | + | const s64 prealloc_size, unsigned int holes, bool need_lock) | |
| 4442 | 4376 | { | |
| 4443 | 4377 | s64 lcn_seek_from; | |
| 4444 | 4378 | s64 first_free_vcn; | |
| @@ -4585,39 +4519,13 @@ static int ntfs_non_resident_attr_expand(struct ntfs_inode *ni, const s64 newsiz | |||
| 4585 | 4519 | ntfs_bytes_to_cluster(vol, ni->allocated_size), | |
| 4586 | 4520 | first_free_vcn - | |
| 4587 | 4521 | ntfs_bytes_to_cluster(vol, ni->allocated_size), | |
| 4588 | - | lcn_seek_from, DATA_ZONE, false, | |
| 4589 | - | ni->type == AT_ATTRIBUTE_LIST, false); | |
| 4522 | + | lcn_seek_from, DATA_ZONE, false, false, false); | |
| 4590 | 4523 | if (IS_ERR(rl)) { | |
| 4591 | 4524 | ntfs_debug("Cluster allocation failed (%lld)", | |
| 4592 | 4525 | (long long)first_free_vcn - | |
| 4593 | 4526 | ntfs_bytes_to_cluster(vol, ni->allocated_size)); | |
| 4594 | 4527 | return PTR_ERR(rl); | |
| 4595 | 4528 | } | |
| 4596 | - | /* | |
| 4597 | - | * A contiguous ATTRIBUTE_LIST allocation keeps its mapping | |
| 4598 | - | * pairs small enough to fit in the base MFT record. The | |
| 4599 | - | * allocator can return a short run when contiguity was | |
| 4600 | - | * requested, so discard it and retry normally if necessary. | |
| 4601 | - | */ | |
| 4602 | - | if (ni->type == AT_ATTRIBUTE_LIST && | |
| 4603 | - | (rl->vcn != ntfs_bytes_to_cluster(vol, | |
| 4604 | - | ni->allocated_size) || | |
| 4605 | - | rl->length != first_free_vcn - | |
| 4606 | - | ntfs_bytes_to_cluster(vol, ni->allocated_size) || | |
| 4607 | - | rl[1].length)) { | |
| 4608 | - | ntfs_cluster_free_from_rl(vol, rl); | |
| 4609 | - | kvfree(rl); | |
| 4610 | - | rl = ntfs_cluster_alloc(vol, | |
| 4611 | - | ntfs_bytes_to_cluster(vol, | |
| 4612 | - | ni->allocated_size), | |
| 4613 | - | first_free_vcn - | |
| 4614 | - | ntfs_bytes_to_cluster(vol, | |
| 4615 | - | ni->allocated_size), | |
| 4616 | - | lcn_seek_from, DATA_ZONE, false, | |
| 4617 | - | false, false); | |
| 4618 | - | if (IS_ERR(rl)) | |
| 4619 | - | return PTR_ERR(rl); | |
| 4620 | - | } | |
| 4621 | 4529 | } | |
| 4622 | 4530 | ||
| 4623 | 4531 | if (!NInoCompressed(ni)) { | |
| @@ -4636,8 +4544,7 @@ static int ntfs_non_resident_attr_expand(struct ntfs_inode *ni, const s64 newsiz | |||
| 4636 | 4544 | ||
| 4637 | 4545 | /* Prepare to mapping pairs update. */ | |
| 4638 | 4546 | ni->allocated_size = ntfs_cluster_to_bytes(vol, first_free_vcn); | |
| 4639 | - | err = ntfs_attr_update_mapping_pairs_locked( | |
| 4640 | - | ni, 0, locked_ni); | |
| 4547 | + | err = ntfs_attr_update_mapping_pairs(ni, 0); | |
| 4641 | 4548 | if (err) { | |
| 4642 | 4549 | ntfs_debug("Mapping pairs update failed"); | |
| 4643 | 4550 | goto rollback; | |
| @@ -4681,11 +4588,11 @@ rollback: | |||
| 4681 | 4588 | ntfs_debug("Leaking clusters"); | |
| 4682 | 4589 | ||
| 4683 | 4590 | /* Now, truncate the runlist itself. */ | |
| 4684 | - | if (ni != locked_ni) | |
| 4591 | + | if (need_lock) | |
| 4685 | 4592 | down_write(&ni->runlist.lock); | |
| 4686 | 4593 | err2 = ntfs_rl_truncate_nolock(vol, &ni->runlist, | |
| 4687 | 4594 | ntfs_bytes_to_cluster(vol, org_alloc_size)); | |
| 4688 | - | if (ni != locked_ni) | |
| 4595 | + | if (need_lock) | |
| 4689 | 4596 | up_write(&ni->runlist.lock); | |
| 4690 | 4597 | if (err2) { | |
| 4691 | 4598 | /* | |
| @@ -4699,11 +4606,11 @@ rollback: | |||
| 4699 | 4606 | /* Prepare to mapping pairs update. */ | |
| 4700 | 4607 | ni->allocated_size = org_alloc_size; | |
| 4701 | 4608 | /* Restore mapping pairs. */ | |
| 4702 | - | if (ni != locked_ni) | |
| 4609 | + | if (need_lock) | |
| 4703 | 4610 | down_read(&ni->runlist.lock); | |
| 4704 | - | if (__ntfs_attr_update_mapping_pairs(ni, 0, locked_ni, true)) | |
| 4611 | + | if (ntfs_attr_update_mapping_pairs(ni, 0)) | |
| 4705 | 4612 | ntfs_error(sb, "Failed to restore old mapping pairs"); | |
| 4706 | - | if (ni != locked_ni) | |
| 4613 | + | if (need_lock) | |
| 4707 | 4614 | up_read(&ni->runlist.lock); | |
| 4708 | 4615 | ||
| 4709 | 4616 | if (NInoSparse(ni) || NInoCompressed(ni)) { | |
| @@ -4808,8 +4715,7 @@ attr_resize_again: | |||
| 4808 | 4715 | mark_mft_record_dirty(ctx->ntfs_ino); | |
| 4809 | 4716 | ntfs_attr_put_search_ctx(ctx); | |
| 4810 | 4717 | /* Resize non-resident attribute */ | |
| 4811 | - | return ntfs_non_resident_attr_expand( | |
| 4812 | - | attr_ni, newsize, prealloc_size, holes, NULL); | |
| 4718 | + | return ntfs_non_resident_attr_expand(attr_ni, newsize, prealloc_size, holes, true); | |
| 4813 | 4719 | } else if (err != -ENOSPC && err != -EPERM) { | |
| 4814 | 4720 | ntfs_error(sb, "Failed to make attribute non-resident"); | |
| 4815 | 4721 | goto put_err_out; | |
| @@ -4930,7 +4836,7 @@ attr_resize_again: | |||
| 4930 | 4836 | } | |
| 4931 | 4837 | ||
| 4932 | 4838 | /* Allocate new mft record. */ | |
| 4933 | - | err = ntfs_mft_record_alloc(base_ni->vol, 0, &ext_ni, base_ni, NULL, -1); | |
| 4839 | + | err = ntfs_mft_record_alloc(base_ni->vol, 0, &ext_ni, base_ni, NULL); | |
| 4934 | 4840 | if (err) { | |
| 4935 | 4841 | ntfs_error(sb, "Couldn't allocate MFT record"); | |
| 4936 | 4842 | goto put_err_out; | |
| @@ -4984,14 +4890,13 @@ int __ntfs_attr_truncate_vfs(struct ntfs_inode *ni, const s64 newsize, | |||
| 4984 | 4890 | if (NInoNonResident(ni)) { | |
| 4985 | 4891 | if (newsize > i_size) { | |
| 4986 | 4892 | down_write(&ni->runlist.lock); | |
| 4987 | - | err = ntfs_non_resident_attr_expand( | |
| 4988 | - | ni, newsize, 0, | |
| 4989 | - | NVolDisableSparse(ni->vol) ? | |
| 4990 | - | HOLES_NO : HOLES_OK, ni); | |
| 4893 | + | err = ntfs_non_resident_attr_expand(ni, newsize, 0, | |
| 4894 | + | NVolDisableSparse(ni->vol) ? | |
| 4895 | + | HOLES_NO : HOLES_OK, | |
| 4896 | + | false); | |
| 4991 | 4897 | up_write(&ni->runlist.lock); | |
| 4992 | 4898 | } else | |
| 4993 | - | err = ntfs_non_resident_attr_shrink( | |
| 4994 | - | ni, newsize, NULL); | |
| 4899 | + | err = ntfs_non_resident_attr_shrink(ni, newsize); | |
| 4995 | 4900 | } else | |
| 4996 | 4901 | err = ntfs_resident_attr_resize(ni, newsize, 0, | |
| 4997 | 4902 | NVolDisableSparse(ni->vol) ? | |
| @@ -5000,9 +4905,7 @@ int __ntfs_attr_truncate_vfs(struct ntfs_inode *ni, const s64 newsize, | |||
| 5000 | 4905 | return err; | |
| 5001 | 4906 | } | |
| 5002 | 4907 | ||
| 5003 | - | int ntfs_attr_expand_locked(struct ntfs_inode *ni, const s64 newsize, | |
| 5004 | - | const s64 prealloc_size, | |
| 5005 | - | struct ntfs_inode *locked_ni) | |
| 4908 | + | int ntfs_attr_expand(struct ntfs_inode *ni, const s64 newsize, const s64 prealloc_size) | |
| 5006 | 4909 | { | |
| 5007 | 4910 | int err = 0; | |
| 5008 | 4911 | ||
| @@ -5015,8 +4918,7 @@ int ntfs_attr_expand_locked(struct ntfs_inode *ni, const s64 newsize, | |||
| 5015 | 4918 | ntfs_debug("Entering for inode 0x%llx, attr 0x%x, size %lld\n", | |
| 5016 | 4919 | (unsigned long long)ni->mft_no, ni->type, newsize); | |
| 5017 | 4920 | ||
| 5018 | - | if (ni->data_size == newsize && | |
| 5019 | - | (!prealloc_size || prealloc_size <= ni->allocated_size)) { | |
| 4921 | + | if (ni->data_size == newsize) { | |
| 5020 | 4922 | ntfs_debug("Size is already ok\n"); | |
| 5021 | 4923 | return 0; | |
| 5022 | 4924 | } | |
| @@ -5031,11 +4933,10 @@ int ntfs_attr_expand_locked(struct ntfs_inode *ni, const s64 newsize, | |||
| 5031 | 4933 | } | |
| 5032 | 4934 | ||
| 5033 | 4935 | if (NInoNonResident(ni)) { | |
| 5034 | - | if (newsize > ni->data_size || prealloc_size > ni->allocated_size) | |
| 5035 | - | err = ntfs_non_resident_attr_expand( | |
| 5036 | - | ni, newsize, prealloc_size, | |
| 5037 | - | NVolDisableSparse(ni->vol) ? | |
| 5038 | - | HOLES_NO : HOLES_OK, locked_ni); | |
| 4936 | + | if (newsize > ni->data_size) | |
| 4937 | + | err = ntfs_non_resident_attr_expand(ni, newsize, prealloc_size, | |
| 4938 | + | NVolDisableSparse(ni->vol) ? | |
| 4939 | + | HOLES_NO : HOLES_OK, true); | |
| 5039 | 4940 | } else | |
| 5040 | 4941 | err = ntfs_resident_attr_resize(ni, newsize, prealloc_size, | |
| 5041 | 4942 | NVolDisableSparse(ni->vol) ? | |
| @@ -5046,12 +4947,6 @@ int ntfs_attr_expand_locked(struct ntfs_inode *ni, const s64 newsize, | |||
| 5046 | 4947 | return err; | |
| 5047 | 4948 | } | |
| 5048 | 4949 | ||
| 5049 | - | int ntfs_attr_expand(struct ntfs_inode *ni, const s64 newsize, | |
| 5050 | - | const s64 prealloc_size) | |
| 5051 | - | { | |
| 5052 | - | return ntfs_attr_expand_locked(ni, newsize, prealloc_size, NULL); | |
| 5053 | - | } | |
| 5054 | - | ||
| 5055 | 4950 | /* | |
| 5056 | 4951 | * ntfs_attr_truncate_i - resize an ntfs attribute | |
| 5057 | 4952 | * @ni: open ntfs inode to resize | |
| @@ -5064,9 +4959,7 @@ int ntfs_attr_expand(struct ntfs_inode *ni, const s64 newsize, | |||
| 5064 | 4959 | * newly allocated space is marked as not initialised and no real allocation | |
| 5065 | 4960 | * on disk is performed. | |
| 5066 | 4961 | */ | |
| 5067 | - | int ntfs_attr_truncate_i_locked(struct ntfs_inode *ni, const s64 newsize, | |
| 5068 | - | unsigned int holes, | |
| 5069 | - | struct ntfs_inode *locked_ni) | |
| 4962 | + | int ntfs_attr_truncate_i(struct ntfs_inode *ni, const s64 newsize, unsigned int holes) | |
| 5070 | 4963 | { | |
| 5071 | 4964 | int err; | |
| 5072 | 4965 | ||
| @@ -5100,23 +4993,15 @@ int ntfs_attr_truncate_i_locked(struct ntfs_inode *ni, const s64 newsize, | |||
| 5100 | 4993 | ||
| 5101 | 4994 | if (NInoNonResident(ni)) { | |
| 5102 | 4995 | if (newsize > ni->data_size) | |
| 5103 | - | err = ntfs_non_resident_attr_expand( | |
| 5104 | - | ni, newsize, 0, holes, locked_ni); | |
| 4996 | + | err = ntfs_non_resident_attr_expand(ni, newsize, 0, holes, true); | |
| 5105 | 4997 | else | |
| 5106 | - | err = ntfs_non_resident_attr_shrink( | |
| 5107 | - | ni, newsize, locked_ni); | |
| 4998 | + | err = ntfs_non_resident_attr_shrink(ni, newsize); | |
| 5108 | 4999 | } else | |
| 5109 | 5000 | err = ntfs_resident_attr_resize(ni, newsize, 0, holes); | |
| 5110 | 5001 | ntfs_debug("Return status %d\n", err); | |
| 5111 | 5002 | return err; | |
| 5112 | 5003 | } | |
| 5113 | 5004 | ||
| 5114 | - | int ntfs_attr_truncate_i(struct ntfs_inode *ni, const s64 newsize, | |
| 5115 | - | unsigned int holes) | |
| 5116 | - | { | |
| 5117 | - | return ntfs_attr_truncate_i_locked(ni, newsize, holes, NULL); | |
| 5118 | - | } | |
| 5119 | - | ||
| 5120 | 5005 | /* | |
| 5121 | 5006 | * Resize an attribute, creating a hole if relevant | |
| 5122 | 5007 | */ | |
| @@ -5134,11 +5019,10 @@ int ntfs_attr_map_cluster(struct ntfs_inode *ni, s64 vcn_start, s64 *lcn_start, | |||
| 5134 | 5019 | struct ntfs_volume *vol = ni->vol; | |
| 5135 | 5020 | struct ntfs_attr_search_ctx *ctx; | |
| 5136 | 5021 | struct runlist_element *rl, *rlc; | |
| 5137 | - | struct runlist_element *old_rl = NULL; | |
| 5138 | 5022 | s64 vcn = vcn_start, lcn, clu_count; | |
| 5139 | 5023 | s64 lcn_seek_from = -1; | |
| 5140 | 5024 | int err = 0; | |
| 5141 | - | size_t new_rl_count, old_rl_count; | |
| 5025 | + | size_t new_rl_count; | |
| 5142 | 5026 | ||
| 5143 | 5027 | err = ntfs_attr_map_whole_runlist(ni); | |
| 5144 | 5028 | if (err) | |
| @@ -5231,19 +5115,6 @@ int ntfs_attr_map_cluster(struct ntfs_inode *ni, s64 vcn_start, s64 *lcn_start, | |||
| 5231 | 5115 | WARN_ON(rlc->vcn != vcn); | |
| 5232 | 5116 | lcn = rlc->lcn; | |
| 5233 | 5117 | clu_count = rlc->length; | |
| 5234 | - | old_rl_count = ni->runlist.count; | |
| 5235 | - | old_rl = kmemdup(ni->runlist.rl, | |
| 5236 | - | old_rl_count * sizeof(*old_rl), GFP_NOFS); | |
| 5237 | - | if (!old_rl) { | |
| 5238 | - | err = -ENOMEM; | |
| 5239 | - | if (ntfs_cluster_free_from_rl(vol, rlc)) { | |
| 5240 | - | ntfs_error(vol->sb, | |
| 5241 | - | "Failed to free cluster allocation after runlist backup failure."); | |
| 5242 | - | NVolSetErrors(vol); | |
| 5243 | - | } | |
| 5244 | - | kvfree(rlc); | |
| 5245 | - | goto out; | |
| 5246 | - | } | |
| 5247 | 5118 | ||
| 5248 | 5119 | rl = ntfs_runlists_merge(&ni->runlist, rlc, 0, &new_rl_count); | |
| 5249 | 5120 | if (IS_ERR(rl)) { | |
| @@ -5267,32 +5138,15 @@ int ntfs_attr_map_cluster(struct ntfs_inode *ni, s64 vcn_start, s64 *lcn_start, | |||
| 5267 | 5138 | ||
| 5268 | 5139 | if (update_mp) { | |
| 5269 | 5140 | ntfs_attr_reinit_search_ctx(ctx); | |
| 5270 | - | err = ntfs_attr_update_mapping_pairs_locked(ni, 0, ni); | |
| 5141 | + | err = ntfs_attr_update_mapping_pairs(ni, 0); | |
| 5271 | 5142 | if (err) { | |
| 5272 | 5143 | int err2; | |
| 5273 | 5144 | ||
| 5274 | 5145 | err2 = ntfs_cluster_free(ni, vcn, clu_count, ctx); | |
| 5275 | - | if (err2 < 0 || err2 != clu_count) { | |
| 5276 | - | ntfs_error(vol->sb, | |
| 5277 | - | "Failed to free cluster allocation. Leaving inconsistent metadata.\n"); | |
| 5278 | - | NVolSetErrors(vol); | |
| 5279 | - | goto out; | |
| 5280 | - | } | |
| 5281 | - | ||
| 5282 | - | /* | |
| 5283 | - | * Restore the runlist before repairing the on-disk | |
| 5284 | - | * mapping pairs. | |
| 5285 | - | */ | |
| 5286 | - | kvfree(ni->runlist.rl); | |
| 5287 | - | ni->runlist.rl = old_rl; | |
| 5288 | - | ni->runlist.count = old_rl_count; | |
| 5289 | - | old_rl = NULL; | |
| 5290 | - | if (ntfs_attr_update_mapping_pairs_locked( | |
| 5291 | - | ni, 0, ni)) { | |
| 5146 | + | if (err2 < 0) | |
| 5292 | 5147 | ntfs_error(vol->sb, | |
| 5293 | - | "Failed to restore mapping pairs after allocation rollback.\n"); | |
| 5294 | - | NVolSetErrors(vol); | |
| 5295 | - | } | |
| 5148 | + | "Failed to free cluster allocation. Leaving inconstant metadata.\n"); | |
| 5149 | + | goto out; | |
| 5296 | 5150 | } | |
| 5297 | 5151 | } else { | |
| 5298 | 5152 | VFS_I(ni)->i_blocks += clu_count << (vol->cluster_size_bits - 9); | |
| @@ -5304,7 +5158,6 @@ int ntfs_attr_map_cluster(struct ntfs_inode *ni, s64 vcn_start, s64 *lcn_start, | |||
| 5304 | 5158 | *lcn_count = clu_count; | |
| 5305 | 5159 | *balloc = true; | |
| 5306 | 5160 | out: | |
| 5307 | - | kvfree(old_rl); | |
| 5308 | 5161 | ntfs_attr_put_search_ctx(ctx); | |
| 5309 | 5162 | return err; | |
| 5310 | 5163 | } | |
| @@ -5548,7 +5401,7 @@ int ntfs_non_resident_attr_insert_range(struct ntfs_inode *ni, s64 start_vcn, s6 | |||
| 5548 | 5401 | ni->data_size += ntfs_cluster_to_bytes(vol, len); | |
| 5549 | 5402 | if (ntfs_cluster_to_bytes(vol, start_vcn) < ni->initialized_size) | |
| 5550 | 5403 | ni->initialized_size += ntfs_cluster_to_bytes(vol, len); | |
| 5551 | - | ret = ntfs_attr_update_mapping_pairs_locked(ni, 0, ni); | |
| 5404 | + | ret = ntfs_attr_update_mapping_pairs(ni, 0); | |
| 5552 | 5405 | up_write(&ni->runlist.lock); | |
| 5553 | 5406 | if (ret) | |
| 5554 | 5407 | return ret; | |
| @@ -5633,7 +5486,7 @@ int ntfs_non_resident_attr_collapse_range(struct ntfs_inode *ni, s64 start_vcn, | |||
| 5633 | 5486 | } | |
| 5634 | 5487 | ||
| 5635 | 5488 | if (ni->allocated_size > 0) { | |
| 5636 | - | ret = ntfs_attr_update_mapping_pairs_locked(ni, 0, ni); | |
| 5489 | + | ret = ntfs_attr_update_mapping_pairs(ni, 0); | |
| 5637 | 5490 | if (ret) { | |
| 5638 | 5491 | up_write(&ni->runlist.lock); | |
| 5639 | 5492 | goto out_rl; | |
| @@ -5711,7 +5564,7 @@ int ntfs_non_resident_attr_punch_hole(struct ntfs_inode *ni, s64 start_vcn, s64 | |||
| 5711 | 5564 | ni->runlist.rl = rl; | |
| 5712 | 5565 | ni->runlist.count = new_rl_count; | |
| 5713 | 5566 | ||
| 5714 | - | ret = ntfs_attr_update_mapping_pairs_locked(ni, 0, ni); | |
| 5567 | + | ret = ntfs_attr_update_mapping_pairs(ni, 0); | |
| 5715 | 5568 | up_write(&ni->runlist.lock); | |
| 5716 | 5569 | if (ret) { | |
| 5717 | 5570 | kvfree(punch_rl); | |
| @@ -5887,7 +5740,7 @@ int ntfs_attr_fallocate(struct ntfs_inode *ni, loff_t start, loff_t byte_len, bo | |||
| 5887 | 5740 | if (NInoRunlistDirty(ni)) { | |
| 5888 | 5741 | mutex_lock_nested(&ni->mrec_lock, NTFS_INODE_MUTEX_NORMAL); | |
| 5889 | 5742 | down_write(&ni->runlist.lock); | |
| 5890 | - | err = ntfs_attr_update_mapping_pairs_locked(ni, 0, ni); | |
| 5743 | + | err = ntfs_attr_update_mapping_pairs(ni, 0); | |
| 5891 | 5744 | if (err) | |
| 5892 | 5745 | ntfs_error(ni->vol->sb, "Updating mapping pairs failed"); | |
| 5893 | 5746 | else | |
modified fs/ntfs/attrib.h
| @@ -112,13 +112,7 @@ int ntfs_non_resident_attr_punch_hole(struct ntfs_inode *ni, s64 start_vcn, s64 | |||
| 112 | 112 | int __ntfs_attr_truncate_vfs(struct ntfs_inode *ni, const s64 newsize, | |
| 113 | 113 | const s64 i_size); | |
| 114 | 114 | int ntfs_attr_expand(struct ntfs_inode *ni, const s64 newsize, const s64 prealloc_size); | |
| 115 | - | int ntfs_attr_expand_locked(struct ntfs_inode *ni, const s64 newsize, | |
| 116 | - | const s64 prealloc_size, | |
| 117 | - | struct ntfs_inode *locked_ni); | |
| 118 | 115 | int ntfs_attr_truncate_i(struct ntfs_inode *ni, const s64 newsize, unsigned int holes); | |
| 119 | - | int ntfs_attr_truncate_i_locked(struct ntfs_inode *ni, const s64 newsize, | |
| 120 | - | unsigned int holes, | |
| 121 | - | struct ntfs_inode *locked_ni); | |
| 122 | 116 | int ntfs_attr_truncate(struct ntfs_inode *ni, const s64 newsize); | |
| 123 | 117 | int ntfs_attr_rm(struct ntfs_inode *ni); | |
| 124 | 118 | int ntfs_attr_exist(struct ntfs_inode *ni, const __le32 type, __le16 *name, | |
| @@ -139,9 +133,6 @@ int ntfs_resident_attr_record_add(struct ntfs_inode *ni, __le32 type, | |||
| 139 | 133 | __le16 *name, u8 name_len, u8 *val, u32 size, | |
| 140 | 134 | __le16 flags); | |
| 141 | 135 | int ntfs_attr_update_mapping_pairs(struct ntfs_inode *ni, s64 from_vcn); | |
| 142 | - | int ntfs_attr_update_mapping_pairs_locked(struct ntfs_inode *ni, | |
| 143 | - | s64 from_vcn, | |
| 144 | - | struct ntfs_inode *locked_ni); | |
| 145 | 136 | struct runlist_element *ntfs_attr_vcn_to_rl(struct ntfs_inode *ni, s64 vcn, s64 *lcn); | |
| 146 | 137 | ||
| 147 | 138 | /* | |
modified fs/ntfs/attrlist.c
| @@ -12,9 +12,6 @@ | |||
| 12 | 12 | #include "mft.h" | |
| 13 | 13 | #include "attrib.h" | |
| 14 | 14 | #include "attrlist.h" | |
| 15 | - | #include "lcnalloc.h" | |
| 16 | - | ||
| 17 | - | #define NTFS_MAX_ATTR_LIST_SIZE (256 * 1024) | |
| 18 | 15 | ||
| 19 | 16 | /* | |
| 20 | 17 | * ntfs_attrlist_need - check whether inode need attribute list | |
| @@ -54,155 +51,11 @@ int ntfs_attrlist_need(struct ntfs_inode *ni) | |||
| 54 | 51 | return 0; | |
| 55 | 52 | } | |
| 56 | 53 | ||
| 57 | - | /* | |
| 58 | - | * Repack the $MFT/$ATTRIBUTE_LIST data into one run. | |
| 59 | - | * | |
| 60 | - | * The mapping pairs for an $ATTRIBUTE_LIST must remain in the base MFT | |
| 61 | - | * record. Once that record has no room left, extending a fragmented list | |
| 62 | - | * can require one more mapping-pairs byte than the record can hold. There | |
| 63 | - | * is no attribute that can legally be moved out in that state: $STANDARD_ | |
| 64 | - | * INFORMATION, $ATTRIBUTE_LIST, and the first $MFT/$DATA extent all have to | |
| 65 | - | * stay in the base record. Move the list data to one contiguous run. The | |
| 66 | - | * caller supplies the minimum allocation size so a recovery can use the | |
| 67 | - | * smallest useful run while normal updates can still request the maximum | |
| 68 | - | * legal list size as a reserve. | |
| 69 | - | */ | |
| 70 | - | static int ntfs_attrlist_repack(struct inode *attr_vi, | |
| 71 | - | struct ntfs_inode *attr_ni, s64 min_alloc_size, | |
| 72 | - | struct ntfs_inode *locked_ni) | |
| 73 | - | { | |
| 74 | - | struct ntfs_volume *vol = attr_ni->vol; | |
| 75 | - | struct runlist_element *old_rl, *new_rl; | |
| 76 | - | u8 *data = NULL; | |
| 77 | - | s64 data_size, alloc_size, nr_clusters, written; | |
| 78 | - | s64 old_alloc_size; | |
| 79 | - | size_t old_rl_count, new_rl_count; | |
| 80 | - | unsigned long flags; | |
| 81 | - | int err, restore_err; | |
| 82 | - | if (attr_ni->mft_no != FILE_MFT || !NInoNonResident(attr_ni) || | |
| 83 | - | min_alloc_size < 0) | |
| 84 | - | return -EINVAL; | |
| 85 | - | /* The buffered I/O below can reacquire the attribute runlist lock. */ | |
| 86 | - | if (attr_ni == locked_ni) | |
| 87 | - | return -ENOSPC; | |
| 88 | - | ||
| 89 | - | err = ntfs_attr_map_whole_runlist(attr_ni); | |
| 90 | - | if (err) | |
| 91 | - | return err; | |
| 92 | - | ||
| 93 | - | data_size = attr_ni->data_size; | |
| 94 | - | if (data_size < 0) | |
| 95 | - | return -EIO; | |
| 96 | - | ||
| 97 | - | if (data_size) { | |
| 98 | - | data = kvmalloc(data_size, GFP_NOFS); | |
| 99 | - | if (!data) | |
| 100 | - | return -ENOMEM; | |
| 101 | - | ||
| 102 | - | written = ntfs_inode_attr_pread(attr_vi, 0, data_size, data); | |
| 103 | - | if (written != data_size) { | |
| 104 | - | err = written < 0 ? (int)written : -EIO; | |
| 105 | - | goto out_free_data; | |
| 106 | - | } | |
| 107 | - | } | |
| 108 | - | ||
| 109 | - | old_alloc_size = attr_ni->allocated_size; | |
| 110 | - | alloc_size = max_t(s64, old_alloc_size, min_alloc_size); | |
| 111 | - | nr_clusters = ntfs_bytes_to_cluster(vol, | |
| 112 | - | alloc_size + vol->cluster_size - 1); | |
| 113 | - | if (nr_clusters <= 0) { | |
| 114 | - | err = -EFBIG; | |
| 115 | - | goto out_free_data; | |
| 116 | - | } | |
| 117 | - | ||
| 118 | - | /* A single run keeps the mapping pairs at the minimum size. */ | |
| 119 | - | new_rl = ntfs_cluster_alloc(vol, 0, nr_clusters, -1, DATA_ZONE, | |
| 120 | - | true, true, false); | |
| 121 | - | if (IS_ERR(new_rl)) { | |
| 122 | - | err = PTR_ERR(new_rl); | |
| 123 | - | goto out_free_data; | |
| 124 | - | } | |
| 125 | - | ||
| 126 | - | new_rl_count = 0; | |
| 127 | - | if (new_rl->vcn == 0 && new_rl->length == nr_clusters && | |
| 128 | - | !new_rl[1].length) | |
| 129 | - | new_rl_count = 2; | |
| 130 | - | ||
| 131 | - | if (new_rl_count != 2) { | |
| 132 | - | ntfs_cluster_free_from_rl(vol, new_rl); | |
| 133 | - | kvfree(new_rl); | |
| 134 | - | err = -ENOSPC; | |
| 135 | - | goto out_free_data; | |
| 136 | - | } | |
| 137 | - | old_rl = attr_ni->runlist.rl; | |
| 138 | - | old_rl_count = attr_ni->runlist.count; | |
| 139 | - | down_write(&attr_ni->runlist.lock); | |
| 140 | - | attr_ni->runlist.rl = new_rl; | |
| 141 | - | attr_ni->runlist.count = new_rl_count; | |
| 142 | - | up_write(&attr_ni->runlist.lock); | |
| 143 | - | ||
| 144 | - | write_lock_irqsave(&attr_ni->size_lock, flags); | |
| 145 | - | attr_ni->allocated_size = ntfs_cluster_to_bytes(vol, nr_clusters); | |
| 146 | - | write_unlock_irqrestore(&attr_ni->size_lock, flags); | |
| 147 | - | ||
| 148 | - | /* Populate the replacement extent before publishing its mapping pairs. */ | |
| 149 | - | if (data_size) { | |
| 150 | - | written = ntfs_inode_attr_pwrite(attr_vi, 0, data_size, data, true); | |
| 151 | - | if (written != data_size) { | |
| 152 | - | err = written < 0 ? (int)written : -EIO; | |
| 153 | - | goto restore_old_runlist; | |
| 154 | - | } | |
| 155 | - | } | |
| 156 | - | ||
| 157 | - | err = ntfs_attr_update_mapping_pairs_locked(attr_ni, 0, locked_ni); | |
| 158 | - | if (err) | |
| 159 | - | goto restore_old_runlist; | |
| 160 | - | ||
| 161 | - | /* The new mapping is now authoritative; release the old data runs. */ | |
| 162 | - | if (ntfs_cluster_free_from_rl(vol, old_rl)) { | |
| 163 | - | ntfs_error(vol->sb, | |
| 164 | - | "Failed to free old ATTRIBUTE_LIST extent: inode %#llx", | |
| 165 | - | (long long)attr_ni->mft_no); | |
| 166 | - | NVolSetErrors(vol); | |
| 167 | - | } | |
| 168 | - | kvfree(old_rl); | |
| 169 | - | kvfree(data); | |
| 170 | - | return 0; | |
| 171 | - | ||
| 172 | - | restore_old_runlist: | |
| 173 | - | down_write(&attr_ni->runlist.lock); | |
| 174 | - | attr_ni->runlist.rl = old_rl; | |
| 175 | - | attr_ni->runlist.count = old_rl_count; | |
| 176 | - | up_write(&attr_ni->runlist.lock); | |
| 177 | - | ||
| 178 | - | write_lock_irqsave(&attr_ni->size_lock, flags); | |
| 179 | - | attr_ni->allocated_size = old_alloc_size; | |
| 180 | - | write_unlock_irqrestore(&attr_ni->size_lock, flags); | |
| 181 | - | ||
| 182 | - | restore_err = ntfs_attr_update_mapping_pairs_locked( | |
| 183 | - | attr_ni, 0, locked_ni); | |
| 184 | - | if (restore_err) { | |
| 185 | - | ntfs_error(vol->sb, "Failed to restore ATTRIBUTE_LIST mapping pairs (%d)", | |
| 186 | - | restore_err); | |
| 187 | - | NVolSetErrors(vol); | |
| 188 | - | } | |
| 189 | - | ||
| 190 | - | ntfs_cluster_free_from_rl(vol, new_rl); | |
| 191 | - | kvfree(new_rl); | |
| 192 | - | err = err ? err : restore_err; | |
| 193 | - | ||
| 194 | - | out_free_data: | |
| 195 | - | kvfree(data); | |
| 196 | - | return err; | |
| 197 | - | } | |
| 198 | - | ||
| 199 | - | int ntfs_attrlist_update_locked(struct ntfs_inode *base_ni, | |
| 200 | - | struct ntfs_inode *locked_ni) | |
| 54 | + | int ntfs_attrlist_update(struct ntfs_inode *base_ni) | |
| 201 | 55 | { | |
| 202 | 56 | struct inode *attr_vi; | |
| 203 | 57 | struct ntfs_inode *attr_ni; | |
| 204 | - | s64 written; | |
| 205 | - | int err, retry_err; | |
| 58 | + | int err; | |
| 206 | 59 | ||
| 207 | 60 | /* | |
| 208 | 61 | * generic_shutdown_super() clears SB_ACTIVE before evicting cached | |
| @@ -219,66 +72,23 @@ int ntfs_attrlist_update_locked(struct ntfs_inode *base_ni, | |||
| 219 | 72 | return err; | |
| 220 | 73 | } | |
| 221 | 74 | attr_ni = NTFS_I(attr_vi); | |
| 222 | - | /* Truncation and page-cache writes can reacquire this runlist lock. */ | |
| 223 | - | if (attr_ni == locked_ni) { | |
| 224 | - | iput(attr_vi); | |
| 225 | - | return -ENOSPC; | |
| 226 | - | } | |
| 227 | 75 | ||
| 228 | - | err = ntfs_attr_truncate_i_locked( | |
| 229 | - | attr_ni, base_ni->attr_list_size, HOLES_NO, locked_ni); | |
| 230 | - | if (err == -ENOSPC && attr_ni->mft_no == FILE_MFT && | |
| 231 | - | NInoNonResident(attr_ni)) { | |
| 232 | - | retry_err = ntfs_attrlist_repack(attr_vi, attr_ni, | |
| 233 | - | base_ni->attr_list_size, locked_ni); | |
| 234 | - | if (retry_err) { | |
| 235 | - | ntfs_error(base_ni->vol->sb, "Failed to repack attribute list"); | |
| 76 | + | err = ntfs_attr_truncate_i(attr_ni, base_ni->attr_list_size, HOLES_NO); | |
| 77 | + | if (err == -ENOSPC && attr_ni->mft_no == FILE_MFT) { | |
| 78 | + | err = ntfs_attr_truncate(attr_ni, 0); | |
| 79 | + | if (err || ntfs_attr_truncate_i(attr_ni, base_ni->attr_list_size, HOLES_NO) != 0) { | |
| 236 | 80 | iput(attr_vi); | |
| 237 | - | return retry_err; | |
| 238 | - | } | |
| 239 | - | ||
| 240 | - | retry_err = ntfs_attr_truncate_i_locked( | |
| 241 | - | attr_ni, base_ni->attr_list_size, | |
| 242 | - | HOLES_NO, locked_ni); | |
| 243 | - | if (retry_err) { | |
| 244 | 81 | ntfs_error(base_ni->vol->sb, | |
| 245 | - | "Failed to resize attribute list after repack"); | |
| 246 | - | iput(attr_vi); | |
| 247 | - | return retry_err; | |
| 82 | + | "Failed to truncate attribute list of inode %#llx", | |
| 83 | + | (long long)base_ni->mft_no); | |
| 84 | + | return -EIO; | |
| 248 | 85 | } | |
| 249 | 86 | } else if (err) { | |
| 250 | 87 | iput(attr_vi); | |
| 251 | 88 | ntfs_error(base_ni->vol->sb, | |
| 252 | 89 | "Failed to truncate attribute list of inode %#llx", | |
| 253 | 90 | (long long)base_ni->mft_no); | |
| 254 | - | return err; | |
| 255 | - | } | |
| 256 | - | ||
| 257 | - | /* | |
| 258 | - | * Reserve the maximum legal list size while the MFT metadata area is | |
| 259 | - | * still easy to allocate contiguously. This prevents a later list entry | |
| 260 | - | * from needing another mapping-pairs byte in the full base MFT record. | |
| 261 | - | * Failure to obtain the optional reserve must not reject the current | |
| 262 | - | * metadata update; the repack retry above remains available if needed. | |
| 263 | - | */ | |
| 264 | - | if (base_ni->mft_no == FILE_MFT && NInoNonResident(attr_ni) && | |
| 265 | - | attr_ni->allocated_size < NTFS_MAX_ATTR_LIST_SIZE) { | |
| 266 | - | retry_err = ntfs_attr_expand_locked( | |
| 267 | - | attr_ni, base_ni->attr_list_size, | |
| 268 | - | NTFS_MAX_ATTR_LIST_SIZE, locked_ni); | |
| 269 | - | if (retry_err == -ENOSPC) { | |
| 270 | - | retry_err = ntfs_attrlist_repack( | |
| 271 | - | attr_vi, attr_ni, | |
| 272 | - | NTFS_MAX_ATTR_LIST_SIZE, locked_ni); | |
| 273 | - | if (retry_err == -ENOSPC) | |
| 274 | - | retry_err = 0; | |
| 275 | - | } | |
| 276 | - | if (retry_err) { | |
| 277 | - | ntfs_error(base_ni->vol->sb, | |
| 278 | - | "Failed to reserve attribute list space"); | |
| 279 | - | iput(attr_vi); | |
| 280 | - | return retry_err; | |
| 281 | - | } | |
| 91 | + | return -EIO; | |
| 282 | 92 | } | |
| 283 | 93 | ||
| 284 | 94 | i_size_write(attr_vi, base_ni->attr_list_size); | |
| @@ -286,15 +96,14 @@ int ntfs_attrlist_update_locked(struct ntfs_inode *base_ni, | |||
| 286 | 96 | if (NInoNonResident(attr_ni) && !NInoAttrListNonResident(base_ni)) | |
| 287 | 97 | NInoSetAttrListNonResident(base_ni); | |
| 288 | 98 | ||
| 289 | - | written = ntfs_inode_attr_pwrite(attr_vi, 0, base_ni->attr_list_size, | |
| 290 | - | base_ni->attr_list, false); | |
| 291 | - | if (written != base_ni->attr_list_size) { | |
| 292 | - | err = written < 0 ? (int)written : -EIO; | |
| 99 | + | if (ntfs_inode_attr_pwrite(attr_vi, 0, base_ni->attr_list_size, | |
| 100 | + | base_ni->attr_list, false) != | |
| 101 | + | base_ni->attr_list_size) { | |
| 293 | 102 | iput(attr_vi); | |
| 294 | 103 | ntfs_error(base_ni->vol->sb, | |
| 295 | 104 | "Failed to write attribute list of inode %#llx", | |
| 296 | 105 | (long long)base_ni->mft_no); | |
| 297 | - | return err; | |
| 106 | + | return -EIO; | |
| 298 | 107 | } | |
| 299 | 108 | ||
| 300 | 109 | NInoSetAttrListDirty(base_ni); | |
| @@ -302,11 +111,6 @@ int ntfs_attrlist_update_locked(struct ntfs_inode *base_ni, | |||
| 302 | 111 | return 0; | |
| 303 | 112 | } | |
| 304 | 113 | ||
| 305 | - | int ntfs_attrlist_update(struct ntfs_inode *base_ni) | |
| 306 | - | { | |
| 307 | - | return ntfs_attrlist_update_locked(base_ni, NULL); | |
| 308 | - | } | |
| 309 | - | ||
| 310 | 114 | /* | |
| 311 | 115 | * ntfs_attrlist_entry_add - add an attribute list attribute entry | |
| 312 | 116 | * @ni: opened ntfs inode, which contains that attribute | |
modified fs/ntfs/attrlist.h
| @@ -16,7 +16,5 @@ int ntfs_attrlist_need(struct ntfs_inode *ni); | |||
| 16 | 16 | int ntfs_attrlist_entry_add(struct ntfs_inode *ni, struct attr_record *attr); | |
| 17 | 17 | int ntfs_attrlist_entry_rm(struct ntfs_attr_search_ctx *ctx); | |
| 18 | 18 | int ntfs_attrlist_update(struct ntfs_inode *base_ni); | |
| 19 | - | int ntfs_attrlist_update_locked(struct ntfs_inode *base_ni, | |
| 20 | - | struct ntfs_inode *locked_ni); | |
| 21 | 19 | ||
| 22 | 20 | #endif /* defined _NTFS_ATTRLIST_H */ | |
modified fs/ntfs/compress.c
| @@ -1450,7 +1450,7 @@ static int ntfs_write_cb(struct ntfs_inode *ni, loff_t pos, struct page **pages, | |||
| 1450 | 1450 | ni->runlist.rl = rl; | |
| 1451 | 1451 | rlc = NULL; | |
| 1452 | 1452 | ||
| 1453 | - | err = ntfs_attr_update_mapping_pairs_locked(ni, 0, ni); | |
| 1453 | + | err = ntfs_attr_update_mapping_pairs(ni, 0); | |
| 1454 | 1454 | up_write(&ni->runlist.lock); | |
| 1455 | 1455 | if (err) | |
| 1456 | 1456 | err = -EIO; | |
modified fs/ntfs/file.c
| @@ -111,8 +111,7 @@ static int ntfs_trim_prealloc(struct inode *vi) | |||
| 111 | 111 | ntfs_error(vol->sb, "Preallocated block rollback failed"); | |
| 112 | 112 | } else { | |
| 113 | 113 | ni->allocated_size = ntfs_cluster_to_bytes(vol, vcn_tr); | |
| 114 | - | err = ntfs_attr_update_mapping_pairs_locked( | |
| 115 | - | ni, 0, ni); | |
| 114 | + | err = ntfs_attr_update_mapping_pairs(ni, 0); | |
| 116 | 115 | if (err) | |
| 117 | 116 | ntfs_error(vol->sb, | |
| 118 | 117 | "Failed to rollback mapping pairs for prealloc"); | |
modified fs/ntfs/inode.c
| @@ -170,19 +170,17 @@ struct inode *ntfs_iget(struct super_block *sb, u64 mft_no) | |||
| 170 | 170 | /* If this is a freshly allocated inode, need to read it now. */ | |
| 171 | 171 | if (inode_state_read_once(vi) & I_NEW) { | |
| 172 | 172 | err = ntfs_read_locked_inode(vi); | |
| 173 | - | if (err) { | |
| 174 | - | remove_inode_hash(vi); | |
| 175 | - | discard_new_inode(vi); | |
| 176 | - | } else | |
| 177 | - | unlock_new_inode(vi); | |
| 173 | + | unlock_new_inode(vi); | |
| 178 | 174 | } | |
| 179 | 175 | /* | |
| 180 | 176 | * There is no point in keeping bad inodes around. This also | |
| 181 | 177 | * simplifies things in that we never need to check for bad inodes | |
| 182 | 178 | * elsewhere. | |
| 183 | 179 | */ | |
| 184 | - | if (unlikely(err)) | |
| 180 | + | if (unlikely(err)) { | |
| 181 | + | iput(vi); | |
| 185 | 182 | vi = ERR_PTR(err); | |
| 183 | + | } | |
| 186 | 184 | return vi; | |
| 187 | 185 | } | |
| 188 | 186 | ||
| @@ -233,19 +231,17 @@ struct inode *ntfs_attr_iget(struct inode *base_vi, __le32 type, | |||
| 233 | 231 | /* If this is a freshly allocated inode, need to read it now. */ | |
| 234 | 232 | if (inode_state_read_once(vi) & I_NEW) { | |
| 235 | 233 | err = ntfs_read_locked_attr_inode(base_vi, vi); | |
| 236 | - | if (err) { | |
| 237 | - | remove_inode_hash(vi); | |
| 238 | - | discard_new_inode(vi); | |
| 239 | - | } else | |
| 240 | - | unlock_new_inode(vi); | |
| 234 | + | unlock_new_inode(vi); | |
| 241 | 235 | } | |
| 242 | 236 | /* | |
| 243 | 237 | * There is no point in keeping bad attribute inodes around. This also | |
| 244 | 238 | * simplifies things in that we never need to check for bad attribute | |
| 245 | 239 | * inodes elsewhere. | |
| 246 | 240 | */ | |
| 247 | - | if (unlikely(err)) | |
| 241 | + | if (unlikely(err)) { | |
| 242 | + | iput(vi); | |
| 248 | 243 | vi = ERR_PTR(err); | |
| 244 | + | } | |
| 249 | 245 | return vi; | |
| 250 | 246 | } | |
| 251 | 247 | ||
| @@ -290,19 +286,17 @@ struct inode *ntfs_index_iget(struct inode *base_vi, __le16 *name, | |||
| 290 | 286 | /* If this is a freshly allocated inode, need to read it now. */ | |
| 291 | 287 | if (inode_state_read_once(vi) & I_NEW) { | |
| 292 | 288 | err = ntfs_read_locked_index_inode(base_vi, vi); | |
| 293 | - | if (err) { | |
| 294 | - | remove_inode_hash(vi); | |
| 295 | - | discard_new_inode(vi); | |
| 296 | - | } else | |
| 297 | - | unlock_new_inode(vi); | |
| 289 | + | unlock_new_inode(vi); | |
| 298 | 290 | } | |
| 299 | 291 | /* | |
| 300 | 292 | * There is no point in keeping bad index inodes around. This also | |
| 301 | 293 | * simplifies things in that we never need to check for bad index | |
| 302 | 294 | * inodes elsewhere. | |
| 303 | 295 | */ | |
| 304 | - | if (unlikely(err)) | |
| 296 | + | if (unlikely(err)) { | |
| 297 | + | iput(vi); | |
| 305 | 298 | vi = ERR_PTR(err); | |
| 299 | + | } | |
| 306 | 300 | return vi; | |
| 307 | 301 | } | |
| 308 | 302 | ||
| @@ -1247,8 +1241,7 @@ unm_err_out: | |||
| 1247 | 1241 | if (m) | |
| 1248 | 1242 | unmap_mft_record(ni); | |
| 1249 | 1243 | err_out: | |
| 1250 | - | if (err != -EOPNOTSUPP && err != -ENOMEM && | |
| 1251 | - | err != -EINTR && err != -ERESTARTSYS && vol_err == true) { | |
| 1244 | + | if (err != -EOPNOTSUPP && err != -ENOMEM && vol_err == true) { | |
| 1252 | 1245 | ntfs_error(vol->sb, | |
| 1253 | 1246 | "Failed with error code %i. Marking corrupt inode 0x%llx as bad. Run chkdsk.", | |
| 1254 | 1247 | err, ni->mft_no); | |
| @@ -1474,13 +1467,12 @@ unm_err_out: | |||
| 1474 | 1467 | ntfs_attr_put_search_ctx(ctx); | |
| 1475 | 1468 | unmap_mft_record(base_ni); | |
| 1476 | 1469 | err_out: | |
| 1477 | - | if (err != -ENOENT && err != -EINTR && err != -ERESTARTSYS) | |
| 1470 | + | if (err != -ENOENT) | |
| 1478 | 1471 | ntfs_error(vol->sb, | |
| 1479 | 1472 | "Failed with error code %i while reading attribute inode (mft_no 0x%llx, type 0x%x, name_len %i). Marking corrupt inode and base inode 0x%llx as bad. Run chkdsk.", | |
| 1480 | 1473 | err, ni->mft_no, ni->type, ni->name_len, | |
| 1481 | 1474 | base_ni->mft_no); | |
| 1482 | - | if (err != -ENOENT && err != -ENOMEM && | |
| 1483 | - | err != -EINTR && err != -ERESTARTSYS) | |
| 1475 | + | if (err != -ENOENT && err != -ENOMEM) | |
| 1484 | 1476 | NVolSetErrors(vol); | |
| 1485 | 1477 | return err; | |
| 1486 | 1478 | } | |
| @@ -1684,9 +1676,8 @@ static int ntfs_read_locked_index_inode(struct inode *base_vi, struct inode *vi) | |||
| 1684 | 1676 | /* Get the index bitmap attribute inode. */ | |
| 1685 | 1677 | bvi = ntfs_attr_iget(base_vi, AT_BITMAP, ni->name, ni->name_len); | |
| 1686 | 1678 | if (IS_ERR(bvi)) { | |
| 1679 | + | ntfs_error(vi->i_sb, "Failed to get bitmap attribute."); | |
| 1687 | 1680 | err = PTR_ERR(bvi); | |
| 1688 | - | if (err != -EINTR && err != -ERESTARTSYS) | |
| 1689 | - | ntfs_error(vi->i_sb, "Failed to get bitmap attribute."); | |
| 1690 | 1681 | goto unm_err_out; | |
| 1691 | 1682 | } | |
| 1692 | 1683 | bni = NTFS_I(bvi); | |
| @@ -1730,12 +1721,10 @@ unm_err_out: | |||
| 1730 | 1721 | if (m) | |
| 1731 | 1722 | unmap_mft_record(base_ni); | |
| 1732 | 1723 | err_out: | |
| 1733 | - | if (err != -EINTR && err != -ERESTARTSYS) | |
| 1734 | - | ntfs_error(vi->i_sb, | |
| 1735 | - | "Failed with error code %i while reading index inode (mft_no 0x%llx, name_len %i.", | |
| 1736 | - | err, ni->mft_no, ni->name_len); | |
| 1737 | - | if (err != -EOPNOTSUPP && err != -ENOMEM && | |
| 1738 | - | err != -EINTR && err != -ERESTARTSYS) | |
| 1724 | + | ntfs_error(vi->i_sb, | |
| 1725 | + | "Failed with error code %i while reading index inode (mft_no 0x%llx, name_len %i.", | |
| 1726 | + | err, ni->mft_no, ni->name_len); | |
| 1727 | + | if (err != -EOPNOTSUPP && err != -ENOMEM) | |
| 1739 | 1728 | NVolSetErrors(vol); | |
| 1740 | 1729 | return err; | |
| 1741 | 1730 | } | |
| @@ -2783,7 +2772,7 @@ int __ntfs_write_inode(struct inode *vi, int sync) | |||
| 2783 | 2772 | ||
| 2784 | 2773 | if (NInoNonResident(ni) && NInoRunlistDirty(ni)) { | |
| 2785 | 2774 | down_write(&ni->runlist.lock); | |
| 2786 | - | err = ntfs_attr_update_mapping_pairs_locked(ni, 0, ni); | |
| 2775 | + | err = ntfs_attr_update_mapping_pairs(ni, 0); | |
| 2787 | 2776 | if (!err) | |
| 2788 | 2777 | NInoClearRunlistDirty(ni); | |
| 2789 | 2778 | up_write(&ni->runlist.lock); | |
| @@ -3724,7 +3713,7 @@ static s64 __ntfs_inode_non_resident_attr_pwrite(struct inode *vi, | |||
| 3724 | 3713 | FGP_CREAT | FGP_LOCK, | |
| 3725 | 3714 | mapping_gfp_mask(mapping)); | |
| 3726 | 3715 | if (IS_ERR(folio)) { | |
| 3727 | - | ret = PTR_ERR(folio); | |
| 3716 | + | ret = -ENOMEM; | |
| 3728 | 3717 | break; | |
| 3729 | 3718 | } | |
| 3730 | 3719 | } else { | |
| @@ -3756,7 +3745,6 @@ static s64 __ntfs_inode_non_resident_attr_pwrite(struct inode *vi, | |||
| 3756 | 3745 | u64 rl_length = 0; | |
| 3757 | 3746 | s64 vcn; | |
| 3758 | 3747 | struct runlist_element *rl; | |
| 3759 | - | int bio_err; | |
| 3760 | 3748 | ||
| 3761 | 3749 | lcn_count = max_t(s64, 1, ntfs_bytes_to_cluster(vol, attr_len)); | |
| 3762 | 3750 | vcn = ntfs_pidx_to_cluster(vol, folio->index); | |
| @@ -3799,15 +3787,8 @@ static s64 __ntfs_inode_non_resident_attr_pwrite(struct inode *vi, | |||
| 3799 | 3787 | goto err_unlock_folio; | |
| 3800 | 3788 | } | |
| 3801 | 3789 | ||
| 3802 | - | bio_err = submit_bio_wait(bio); | |
| 3790 | + | submit_bio_wait(bio); | |
| 3803 | 3791 | bio_put(bio); | |
| 3804 | - | if (bio_err) { | |
| 3805 | - | ntfs_error(vi->i_sb, | |
| 3806 | - | "Synchronous attribute write failed (%d)", | |
| 3807 | - | bio_err); | |
| 3808 | - | ret = bio_err; | |
| 3809 | - | goto err_unlock_folio; | |
| 3810 | - | } | |
| 3811 | 3792 | vcn += rl_length; | |
| 3812 | 3793 | offset += length; | |
| 3813 | 3794 | } while (lcn_count != 0); | |
modified fs/ntfs/mft.c
| @@ -213,8 +213,7 @@ struct mft_record *map_mft_record(struct ntfs_inode *ni) | |||
| 213 | 213 | return m; | |
| 214 | 214 | ||
| 215 | 215 | atomic_dec(&ni->count); | |
| 216 | - | if (PTR_ERR(m) != -EINTR && PTR_ERR(m) != -ERESTARTSYS) | |
| 217 | - | ntfs_error(ni->vol->sb, "Failed with error code %lu.", -PTR_ERR(m)); | |
| 216 | + | ntfs_error(ni->vol->sb, "Failed with error code %lu.", -PTR_ERR(m)); | |
| 218 | 217 | return m; | |
| 219 | 218 | } | |
| 220 | 219 | ||
| @@ -463,7 +462,7 @@ int ntfs_sync_mft_mirror(struct ntfs_volume *vol, const u64 mft_no, | |||
| 463 | 462 | { | |
| 464 | 463 | u8 *kmirr; | |
| 465 | 464 | struct folio *folio; | |
| 466 | - | unsigned int folio_ofs; | |
| 465 | + | unsigned int folio_ofs, lcn_folio_off = 0; | |
| 467 | 466 | int err = 0; | |
| 468 | 467 | struct bio *bio; | |
| 469 | 468 | ||
| @@ -493,11 +492,15 @@ int ntfs_sync_mft_mirror(struct ntfs_volume *vol, const u64 mft_no, | |||
| 493 | 492 | memcpy(kmirr, m, vol->mft_record_size); | |
| 494 | 493 | kunmap_local(kmirr); | |
| 495 | 494 | ||
| 495 | + | if (vol->cluster_size_bits > PAGE_SHIFT) { | |
| 496 | + | lcn_folio_off = folio->index << PAGE_SHIFT; | |
| 497 | + | lcn_folio_off &= vol->cluster_size_mask; | |
| 498 | + | } | |
| 499 | + | ||
| 496 | 500 | bio = bio_alloc(vol->sb->s_bdev, 1, REQ_OP_WRITE, GFP_NOIO); | |
| 497 | 501 | bio->bi_iter.bi_sector = | |
| 498 | 502 | ntfs_bytes_to_bio_sector(NTFS_CLU_TO_B(vol, vol->mftmirr_lcn) + | |
| 499 | - | ((u64)folio->index << PAGE_SHIFT) + | |
| 500 | - | folio_ofs); | |
| 503 | + | lcn_folio_off + folio_ofs); | |
| 501 | 504 | ||
| 502 | 505 | if (bio_add_folio(bio, folio, vol->mft_record_size, folio_ofs)) | |
| 503 | 506 | err = submit_bio_wait(bio); | |
| @@ -838,126 +841,12 @@ static bool ntfs_may_write_mft_record(struct ntfs_volume *vol, const u64 mft_no, | |||
| 838 | 841 | ||
| 839 | 842 | static const char *es = " Leaving inconsistent metadata. Unmount and run chkdsk."; | |
| 840 | 843 | ||
| 841 | - | #define FIRST_NORMAL_MFT_RECORD 24 | |
| 842 | - | #define MFT_RECORD_RESERVE 4 | |
| 844 | + | #define RESERVED_MFT_RECORDS 64 | |
| 843 | 845 | ||
| 844 | 846 | /* | |
| 845 | - | * Records 12-15 are marked in use by Windows but normally have no name | |
| 846 | - | * and no links. Keep them as the last bootstrap option when a volume | |
| 847 | - | * mounted without an in-memory tail reserve needs its first $MFT metadata | |
| 848 | - | * extent. | |
| 849 | - | */ | |
| 850 | - | static bool mft_reserved_is_free(struct ntfs_volume *vol, | |
| 851 | - | struct ntfs_inode *mft_ni, s64 mft_no) | |
| 852 | - | { | |
| 853 | - | struct attr_record *a; | |
| 854 | - | struct mft_record *m; | |
| 855 | - | struct folio *folio; | |
| 856 | - | void *mapped; | |
| 857 | - | pgoff_t index = NTFS_MFT_NR_TO_PIDX(vol, mft_no); | |
| 858 | - | unsigned int ofs = NTFS_MFT_NR_TO_POFS(vol, mft_no); | |
| 859 | - | u32 attrs_offset, bytes_in_use; | |
| 860 | - | bool available = false, have_std = false; | |
| 861 | - | int i; | |
| 862 | - | ||
| 863 | - | for (i = 0; i < mft_ni->nr_extents; i++) { | |
| 864 | - | if (mft_ni->ext.extent_ntfs_inos[i] && | |
| 865 | - | mft_ni->ext.extent_ntfs_inos[i]->mft_no == mft_no) | |
| 866 | - | return false; | |
| 867 | - | } | |
| 868 | - | m = kmalloc(vol->mft_record_size, GFP_NOFS); | |
| 869 | - | if (!m) | |
| 870 | - | return false; | |
| 871 | - | ||
| 872 | - | folio = read_mapping_folio(vol->mft_ino->i_mapping, index, NULL); | |
| 873 | - | if (IS_ERR(folio)) | |
| 874 | - | goto free_m; | |
| 875 | - | ||
| 876 | - | folio_lock(folio); | |
| 877 | - | mapped = kmap_local_folio(folio, 0); | |
| 878 | - | memcpy(m, (u8 *)mapped + ofs, vol->mft_record_size); | |
| 879 | - | kunmap_local(mapped); | |
| 880 | - | folio_unlock(folio); | |
| 881 | - | folio_put(folio); | |
| 882 | - | if (post_read_mst_fixup((struct ntfs_record *)m, vol->mft_record_size)) | |
| 883 | - | goto free_m; | |
| 884 | - | ||
| 885 | - | if (!ntfs_is_mft_record(m->magic) || | |
| 886 | - | !(m->flags & MFT_RECORD_IN_USE) || m->base_mft_record || | |
| 887 | - | m->link_count) | |
| 888 | - | goto out; | |
| 889 | - | ||
| 890 | - | attrs_offset = le16_to_cpu(m->attrs_offset); | |
| 891 | - | bytes_in_use = le32_to_cpu(m->bytes_in_use); | |
| 892 | - | if (attrs_offset > bytes_in_use || bytes_in_use > vol->mft_record_size || | |
| 893 | - | bytes_in_use - attrs_offset < sizeof(a->type)) | |
| 894 | - | goto out; | |
| 895 | - | ||
| 896 | - | for (a = (struct attr_record *)((u8 *)m + attrs_offset); | |
| 897 | - | (u8 *)a + sizeof(a->type) <= (u8 *)m + bytes_in_use;) { | |
| 898 | - | u32 len; | |
| 899 | - | ||
| 900 | - | if (a->type == AT_END) { | |
| 901 | - | if ((u8 *)a + sizeof(a->type) + sizeof(a->length) > | |
| 902 | - | (u8 *)m + bytes_in_use) | |
| 903 | - | break; | |
| 904 | - | /* Also accept a record emptied by an earlier bootstrap. */ | |
| 905 | - | available = have_std || | |
| 906 | - | (u8 *)a == (u8 *)m + attrs_offset; | |
| 907 | - | break; | |
| 908 | - | } | |
| 909 | - | if (a->type == AT_FILE_NAME) | |
| 910 | - | break; | |
| 911 | - | len = le32_to_cpu(a->length); | |
| 912 | - | if (len < offsetof(struct attr_record, data) || | |
| 913 | - | (u8 *)a + len > (u8 *)m + bytes_in_use) | |
| 914 | - | break; | |
| 915 | - | if (a->type == AT_STANDARD_INFORMATION) { | |
| 916 | - | u32 value_len, value_ofs; | |
| 917 | - | ||
| 918 | - | if (have_std || a->non_resident || | |
| 919 | - | len < offsetof(struct attr_record, | |
| 920 | - | data.resident.reserved) + 1) | |
| 921 | - | break; | |
| 922 | - | value_len = le32_to_cpu(a->data.resident.value_length); | |
| 923 | - | value_ofs = le16_to_cpu(a->data.resident.value_offset); | |
| 924 | - | if (value_ofs > len || value_len > len - value_ofs) | |
| 925 | - | break; | |
| 926 | - | have_std = true; | |
| 927 | - | } | |
| 928 | - | a = (struct attr_record *)((u8 *)a + len); | |
| 929 | - | } | |
| 930 | - | out: | |
| 931 | - | kfree(m); | |
| 932 | - | return available; | |
| 933 | - | free_m: | |
| 934 | - | kfree(m); | |
| 935 | - | return false; | |
| 936 | - | } | |
| 937 | - | ||
| 938 | - | static s64 mft_reserve_end(const u8 *buf, s64 buf_start, s64 buf_end, | |
| 939 | - | s64 start, s64 pass_end, s64 initialized_mft_records) | |
| 940 | - | { | |
| 941 | - | s64 end = start + 1; | |
| 942 | - | s64 limit = min_t(s64, start + MFT_RECORD_RESERVE, pass_end); | |
| 943 | - | ||
| 944 | - | if (limit > initialized_mft_records) | |
| 945 | - | limit = initialized_mft_records; | |
| 946 | - | if (limit > buf_end) | |
| 947 | - | limit = buf_end; | |
| 948 | - | while (end < limit && | |
| 949 | - | !(buf[(end - buf_start) >> 3] & | |
| 950 | - | (1 << ((end - buf_start) & 7)))) | |
| 951 | - | end++; | |
| 952 | - | return end; | |
| 953 | - | } | |
| 954 | - | ||
| 955 | - | /* | |
| 956 | - | * mft_bitmap_alloc_free_rec - find and allocate a free MFT record | |
| 847 | + | * ntfs_mft_bitmap_find_and_alloc_free_rec_nolock - see name | |
| 957 | 848 | * @vol: volume on which to search for a free mft record | |
| 958 | 849 | * @base_ni: open base inode if allocating an extent mft record or NULL | |
| 959 | - | * @max_mft_no: first record which must not be allocated, or -1 | |
| 960 | - | * @new_reserve_end: if not NULL, end of a free run starting after the result | |
| 961 | 850 | * | |
| 962 | 851 | * Search for a free mft record in the mft bitmap attribute on the ntfs volume | |
| 963 | 852 | * @vol. | |
| @@ -973,12 +862,10 @@ static s64 mft_reserve_end(const u8 *buf, s64 buf_start, s64 buf_end, | |||
| 973 | 862 | * | |
| 974 | 863 | * Locking: Caller must hold vol->mftbmp_lock for writing. | |
| 975 | 864 | */ | |
| 976 | - | static s64 mft_bitmap_alloc_free_rec(struct ntfs_volume *vol, | |
| 977 | - | struct ntfs_inode *base_ni, | |
| 978 | - | s64 max_mft_no, s64 *new_reserve_end) | |
| 865 | + | static s64 ntfs_mft_bitmap_find_and_alloc_free_rec_nolock(struct ntfs_volume *vol, | |
| 866 | + | struct ntfs_inode *base_ni) | |
| 979 | 867 | { | |
| 980 | 868 | s64 pass_end, ll, data_pos, pass_start, ofs, bit; | |
| 981 | - | s64 initialized_mft_records; | |
| 982 | 869 | unsigned long flags; | |
| 983 | 870 | struct address_space *mftbmp_mapping; | |
| 984 | 871 | u8 *buf = NULL, *byte; | |
| @@ -995,36 +882,30 @@ static s64 mft_bitmap_alloc_free_rec(struct ntfs_volume *vol, | |||
| 995 | 882 | read_lock_irqsave(&NTFS_I(vol->mft_ino)->size_lock, flags); | |
| 996 | 883 | pass_end = NTFS_I(vol->mft_ino)->allocated_size >> | |
| 997 | 884 | vol->mft_record_size_bits; | |
| 998 | - | initialized_mft_records = NTFS_I(vol->mft_ino)->initialized_size >> | |
| 999 | - | vol->mft_record_size_bits; | |
| 1000 | 885 | read_unlock_irqrestore(&NTFS_I(vol->mft_ino)->size_lock, flags); | |
| 1001 | 886 | read_lock_irqsave(&NTFS_I(vol->mftbmp_ino)->size_lock, flags); | |
| 1002 | 887 | ll = NTFS_I(vol->mftbmp_ino)->initialized_size << 3; | |
| 1003 | 888 | read_unlock_irqrestore(&NTFS_I(vol->mftbmp_ino)->size_lock, flags); | |
| 1004 | 889 | if (pass_end > ll) | |
| 1005 | 890 | pass_end = ll; | |
| 1006 | - | if (max_mft_no >= 0 && pass_end > max_mft_no) | |
| 1007 | - | pass_end = max_mft_no; | |
| 1008 | - | if (base_ni && base_ni->mft_no == FILE_MFT) { | |
| 1009 | - | data_pos = FILE_first_user; | |
| 891 | + | pass = 1; | |
| 892 | + | if (!base_ni) | |
| 893 | + | data_pos = vol->mft_data_pos; | |
| 894 | + | else | |
| 895 | + | data_pos = base_ni->mft_no + 1; | |
| 896 | + | if (data_pos < RESERVED_MFT_RECORDS) | |
| 897 | + | data_pos = RESERVED_MFT_RECORDS; | |
| 898 | + | if (data_pos >= pass_end) { | |
| 899 | + | data_pos = RESERVED_MFT_RECORDS; | |
| 1010 | 900 | pass = 2; | |
| 901 | + | /* This happens on a freshly formatted volume. */ | |
| 1011 | 902 | if (data_pos >= pass_end) | |
| 1012 | 903 | return -ENOSPC; | |
| 1013 | - | } else { | |
| 1014 | - | pass = 1; | |
| 1015 | - | if (!base_ni) | |
| 1016 | - | data_pos = vol->mft_data_pos; | |
| 1017 | - | else | |
| 1018 | - | data_pos = base_ni->mft_no + 1; | |
| 1019 | - | if (data_pos < FIRST_NORMAL_MFT_RECORD) | |
| 1020 | - | data_pos = FIRST_NORMAL_MFT_RECORD; | |
| 1021 | - | if (data_pos >= pass_end) { | |
| 1022 | - | data_pos = FIRST_NORMAL_MFT_RECORD; | |
| 1023 | - | pass = 2; | |
| 1024 | - | /* This happens on a freshly formatted volume. */ | |
| 1025 | - | if (data_pos >= pass_end) | |
| 1026 | - | return -ENOSPC; | |
| 1027 | - | } | |
| 904 | + | } | |
| 905 | + | ||
| 906 | + | if (base_ni && base_ni->mft_no == FILE_MFT) { | |
| 907 | + | data_pos = 0; | |
| 908 | + | pass = 2; | |
| 1028 | 909 | } | |
| 1029 | 910 | ||
| 1030 | 911 | pass_start = data_pos; | |
| @@ -1059,28 +940,38 @@ static s64 mft_bitmap_alloc_free_rec(struct ntfs_volume *vol, | |||
| 1059 | 940 | size, data_pos, bit); | |
| 1060 | 941 | for (; bit < size && data_pos + bit < pass_end; | |
| 1061 | 942 | bit &= ~7ull, bit += 8) { | |
| 943 | + | /* | |
| 944 | + | * If we're extending $MFT and running out of the first | |
| 945 | + | * mft record (base record) then give up searching since | |
| 946 | + | * no guarantee that the found record will be accessible. | |
| 947 | + | */ | |
| 948 | + | if (base_ni && base_ni->mft_no == FILE_MFT && bit > 400) { | |
| 949 | + | folio_unlock(folio); | |
| 950 | + | kunmap_local(buf); | |
| 951 | + | folio_put(folio); | |
| 952 | + | return -ENOSPC; | |
| 953 | + | } | |
| 954 | + | ||
| 1062 | 955 | byte = buf + (bit >> 3); | |
| 1063 | 956 | if (*byte == 0xff) | |
| 1064 | 957 | continue; | |
| 1065 | - | b = bit & 7; | |
| 1066 | - | for (; b < 8; b++) { | |
| 1067 | - | if (*byte & (1 << b)) | |
| 1068 | - | continue; | |
| 958 | + | b = ffz((unsigned long)*byte); | |
| 959 | + | if (b < 8 && b >= (bit & 7)) { | |
| 1069 | 960 | ll = data_pos + (bit & ~7ull) + b; | |
| 1070 | - | if (ll >= pass_end) | |
| 1071 | - | break; | |
| 1072 | - | /* Keep the dynamic tail reserve for $MFT metadata. */ | |
| 1073 | - | if ((!base_ni || base_ni->mft_no != FILE_MFT) && | |
| 1074 | - | ll >= vol->mft_record_reserve_pos && | |
| 1075 | - | ll < vol->mft_record_reserve_end) | |
| 1076 | - | continue; | |
| 1077 | 961 | if (unlikely(ll >= (1ll << 32))) { | |
| 1078 | 962 | folio_unlock(folio); | |
| 1079 | 963 | kunmap_local(buf); | |
| 1080 | 964 | folio_put(folio); | |
| 1081 | 965 | return -ENOSPC; | |
| 1082 | 966 | } | |
| 1083 | - | goto found; | |
| 967 | + | *byte |= 1 << b; | |
| 968 | + | folio_mark_dirty(folio); | |
| 969 | + | folio_unlock(folio); | |
| 970 | + | kunmap_local(buf); | |
| 971 | + | folio_put(folio); | |
| 972 | + | ntfs_debug("Done. (Found and allocated mft record 0x%llx.)", | |
| 973 | + | ll); | |
| 974 | + | return ll; | |
| 1084 | 975 | } | |
| 1085 | 976 | } | |
| 1086 | 977 | ntfs_debug("After inner for loop: size 0x%x, data_pos 0x%llx, bit 0x%llx", | |
| @@ -1103,8 +994,7 @@ static s64 mft_bitmap_alloc_free_rec(struct ntfs_volume *vol, | |||
| 1103 | 994 | * part of the zone which we omitted earlier. | |
| 1104 | 995 | */ | |
| 1105 | 996 | pass_end = pass_start; | |
| 1106 | - | data_pos = FIRST_NORMAL_MFT_RECORD; | |
| 1107 | - | pass_start = FIRST_NORMAL_MFT_RECORD; | |
| 997 | + | data_pos = pass_start = RESERVED_MFT_RECORDS; | |
| 1108 | 998 | ntfs_debug("pass %i, pass_start 0x%llx, pass_end 0x%llx.", | |
| 1109 | 999 | pass, pass_start, pass_end); | |
| 1110 | 1000 | if (data_pos >= pass_end) | |
| @@ -1114,22 +1004,9 @@ static s64 mft_bitmap_alloc_free_rec(struct ntfs_volume *vol, | |||
| 1114 | 1004 | /* No free mft records in currently initialized mft bitmap. */ | |
| 1115 | 1005 | ntfs_debug("Done. (No free mft records left in currently initialized mft bitmap.)"); | |
| 1116 | 1006 | return -ENOSPC; | |
| 1117 | - | found: | |
| 1118 | - | if (new_reserve_end) | |
| 1119 | - | *new_reserve_end = mft_reserve_end(buf, data_pos, | |
| 1120 | - | data_pos + size, ll, pass_end, | |
| 1121 | - | initialized_mft_records); | |
| 1122 | - | *byte |= 1 << b; | |
| 1123 | - | folio_mark_dirty(folio); | |
| 1124 | - | folio_unlock(folio); | |
| 1125 | - | kunmap_local(buf); | |
| 1126 | - | folio_put(folio); | |
| 1127 | - | ntfs_debug("Done. (Found and allocated mft record 0x%llx.)", ll); | |
| 1128 | - | return ll; | |
| 1129 | 1007 | } | |
| 1130 | 1008 | ||
| 1131 | - | static int ntfs_mft_attr_extend(struct ntfs_inode *ni, | |
| 1132 | - | struct ntfs_inode *locked_ni) | |
| 1009 | + | static int ntfs_mft_attr_extend(struct ntfs_inode *ni) | |
| 1133 | 1010 | { | |
| 1134 | 1011 | int ret = 0; | |
| 1135 | 1012 | struct ntfs_inode *base_ni; | |
| @@ -1150,7 +1027,7 @@ static int ntfs_mft_attr_extend(struct ntfs_inode *ni, | |||
| 1150 | 1027 | } | |
| 1151 | 1028 | } | |
| 1152 | 1029 | ||
| 1153 | - | ret = ntfs_attr_update_mapping_pairs_locked(ni, 0, locked_ni); | |
| 1030 | + | ret = ntfs_attr_update_mapping_pairs(ni, 0); | |
| 1154 | 1031 | if (ret) | |
| 1155 | 1032 | pr_err("MP update failed\n"); | |
| 1156 | 1033 | ||
| @@ -1338,7 +1215,7 @@ static int ntfs_mft_bitmap_extend_allocation_nolock(struct ntfs_volume *vol) | |||
| 1338 | 1215 | ret = ntfs_attr_record_resize(ctx->mrec, a, mp_size + | |
| 1339 | 1216 | le16_to_cpu(a->data.non_resident.mapping_pairs_offset)); | |
| 1340 | 1217 | if (unlikely(ret)) { | |
| 1341 | - | ret = ntfs_mft_attr_extend(mftbmp_ni, mftbmp_ni); | |
| 1218 | + | ret = ntfs_mft_attr_extend(mftbmp_ni); | |
| 1342 | 1219 | if (!ret) | |
| 1343 | 1220 | goto extended_ok; | |
| 1344 | 1221 | if (ret != -EAGAIN) | |
| @@ -1449,9 +1326,7 @@ undo_alloc: | |||
| 1449 | 1326 | NVolSetErrors(vol); | |
| 1450 | 1327 | } | |
| 1451 | 1328 | mark_mft_record_dirty(ctx->ntfs_ino); | |
| 1452 | - | } else if (status.mp_extended && | |
| 1453 | - | ntfs_attr_update_mapping_pairs_locked(mftbmp_ni, 0, | |
| 1454 | - | mftbmp_ni)) { | |
| 1329 | + | } else if (status.mp_extended && ntfs_attr_update_mapping_pairs(mftbmp_ni, 0)) { | |
| 1455 | 1330 | ntfs_error(vol->sb, "Failed to restore mapping pairs.%s", es); | |
| 1456 | 1331 | NVolSetErrors(vol); | |
| 1457 | 1332 | } | |
| @@ -1539,6 +1414,7 @@ static int ntfs_mft_bitmap_extend_initialized_nolock(struct ntfs_volume *vol) | |||
| 1539 | 1414 | ret = ntfs_attr_set(mftbmp_ni, old_initialized_size, 8, 0); | |
| 1540 | 1415 | if (likely(!ret)) { | |
| 1541 | 1416 | ntfs_debug("Done. (Wrote eight initialized bytes to mft bitmap."); | |
| 1417 | + | ntfs_inc_free_mft_records(vol, 8 * 8); | |
| 1542 | 1418 | return 0; | |
| 1543 | 1419 | } | |
| 1544 | 1420 | ntfs_error(vol->sb, "Failed to write to mft bitmap."); | |
| @@ -1595,9 +1471,8 @@ err_out: | |||
| 1595 | 1471 | * @vol: volume on which to extend the mft data attribute | |
| 1596 | 1472 | * | |
| 1597 | 1473 | * Extend the mft data attribute on the ntfs volume @vol by 16 mft records | |
| 1598 | - | * worth of clusters or if not enough space for this by two mft records worth | |
| 1599 | - | * of clusters. Keeping at least two new records breaks the recursion between | |
| 1600 | - | * extending $MFT and allocating a record for a new $MFT attribute extent. | |
| 1474 | + | * worth of clusters or if not enough space for this by one mft record worth | |
| 1475 | + | * of clusters. | |
| 1601 | 1476 | * | |
| 1602 | 1477 | * Note: Only changes allocated_size, i.e. does not touch initialized_size or | |
| 1603 | 1478 | * data_size. | |
| @@ -1651,8 +1526,10 @@ static int ntfs_mft_data_extend_allocation_nolock(struct ntfs_volume *vol) | |||
| 1651 | 1526 | } | |
| 1652 | 1527 | lcn = rl->lcn + rl->length; | |
| 1653 | 1528 | ntfs_debug("Last lcn of mft data attribute is 0x%llx.", lcn); | |
| 1654 | - | /* Keep room for the allocating record and at least one MFT reserve. */ | |
| 1655 | - | min_nr = DIV_ROUND_UP_ULL((u64)vol->mft_record_size * 2, vol->cluster_size); | |
| 1529 | + | /* Minimum allocation is one mft record worth of clusters. */ | |
| 1530 | + | min_nr = NTFS_B_TO_CLU(vol, vol->mft_record_size); | |
| 1531 | + | if (!min_nr) | |
| 1532 | + | min_nr = 1; | |
| 1656 | 1533 | /* Want to allocate 16 mft records worth of clusters. */ | |
| 1657 | 1534 | nr = vol->mft_record_size << 4 >> vol->cluster_size_bits; | |
| 1658 | 1535 | if (!nr) | |
| @@ -1776,7 +1653,7 @@ static int ntfs_mft_data_extend_allocation_nolock(struct ntfs_volume *vol) | |||
| 1776 | 1653 | ret = ntfs_attr_record_resize(ctx->mrec, a, mp_size + | |
| 1777 | 1654 | le16_to_cpu(a->data.non_resident.mapping_pairs_offset)); | |
| 1778 | 1655 | if (unlikely(ret)) { | |
| 1779 | - | ret = ntfs_mft_attr_extend(mft_ni, NULL); | |
| 1656 | + | ret = ntfs_mft_attr_extend(mft_ni); | |
| 1780 | 1657 | if (!ret) | |
| 1781 | 1658 | goto extended_ok; | |
| 1782 | 1659 | if (ret != -EAGAIN) | |
| @@ -2051,7 +1928,6 @@ static int ntfs_mft_record_format(const struct ntfs_volume *vol, const s64 mft_n | |||
| 2051 | 1928 | * @ni: [OUT] on success, set to the allocated ntfs inode | |
| 2052 | 1929 | * @base_ni: [IN] open base inode if allocating an extent mft record or NULL | |
| 2053 | 1930 | * @ni_mrec: [OUT] on successful return this is the mapped mft record | |
| 2054 | - | * @mft_data_vcn: [IN] lowest VCN of a new $MFT/$DATA extent, or -1 | |
| 2055 | 1931 | * | |
| 2056 | 1932 | * Allocate an mft record in $MFT/$DATA of an open ntfs volume @vol. | |
| 2057 | 1933 | * | |
| @@ -2079,23 +1955,30 @@ static int ntfs_mft_record_format(const struct ntfs_volume *vol, const s64 mft_n | |||
| 2079 | 1955 | * optimize this we start scanning at the place specified by @base_ni or if | |
| 2080 | 1956 | * @base_ni is NULL we start where we last stopped and we perform wrap around | |
| 2081 | 1957 | * when we reach the end. Note, we do not try to allocate mft records below | |
| 2082 | - | * number 24 because numbers 0 to 15 are the defined system files and records | |
| 2083 | - | * 16 to 23 are kept for metadata compatibility. Records reserved dynamically | |
| 2084 | - | * at the initialized MFT tail are skipped by normal allocation and consumed by | |
| 2085 | - | * $MFT metadata extent allocation. | |
| 1958 | + | * number 64 because numbers 0 to 15 are the defined system files anyway and 16 | |
| 1959 | + | * to 64 are special in that they are used for storing extension mft records | |
| 1960 | + | * for the $DATA attribute of $MFT. This is required to avoid the possibility | |
| 1961 | + | * of creating a runlist with a circular dependency which once written to disk | |
| 1962 | + | * can never be read in again. Windows will only use records 16 to 24 for | |
| 1963 | + | * normal files if the volume is completely out of space. We never use them | |
| 1964 | + | * which means that when the volume is really out of space we cannot create any | |
| 1965 | + | * more files while Windows can still create up to 8 small files. We can start | |
| 1966 | + | * doing this at some later time, it does not matter much for now. | |
| 2086 | 1967 | * | |
| 2087 | 1968 | * When scanning the mft bitmap, we only search up to the last allocated mft | |
| 2088 | - | * record. If there are no free records left in the range 24 to number of | |
| 1969 | + | * record. If there are no free records left in the range 64 to number of | |
| 2089 | 1970 | * allocated mft records, then we extend the $MFT/$DATA attribute in order to | |
| 2090 | 1971 | * create free mft records. We extend the allocated size of $MFT/$DATA by 16 | |
| 2091 | 1972 | * records at a time or one cluster, if cluster size is above 16kiB. If there | |
| 2092 | - | * is not sufficient space to do this, we try to extend by two mft records or | |
| 2093 | - | * one cluster, if a cluster already contains at least two mft records. | |
| 1973 | + | * is not sufficient space to do this, we try to extend by a single mft record | |
| 1974 | + | * or one cluster, if cluster size is above the mft record size. | |
| 2094 | 1975 | * | |
| 2095 | - | * When extending the initialized MFT tail, we also initialize up to four | |
| 2096 | - | * additional records and reserve them in memory for future $MFT metadata | |
| 2097 | - | * extents. If there are less than 24 mft records, records are initialized | |
| 2098 | - | * until record 24, which is the first record used for normal files. | |
| 1976 | + | * No matter how many mft records we allocate, we initialize only the first | |
| 1977 | + | * allocated mft record, incrementing mft data size and initialized size | |
| 1978 | + | * accordingly, open an struct ntfs_inode for it and return it to the caller, unless | |
| 1979 | + | * there are less than 64 mft records, in which case we allocate and initialize | |
| 1980 | + | * mft records until we reach record 64 which we consider as the first free mft | |
| 1981 | + | * record for use by normal files. | |
| 2099 | 1982 | * | |
| 2100 | 1983 | * If during any stage we overflow the initialized data in the mft bitmap, we | |
| 2101 | 1984 | * extend the initialized size (and data size) by 8 bytes, allocating another | |
| @@ -2131,13 +2014,9 @@ static int ntfs_mft_record_format(const struct ntfs_volume *vol, const s64 mft_n | |||
| 2131 | 2014 | */ | |
| 2132 | 2015 | int ntfs_mft_record_alloc(struct ntfs_volume *vol, const int mode, | |
| 2133 | 2016 | struct ntfs_inode **ni, struct ntfs_inode *base_ni, | |
| 2134 | - | struct mft_record **ni_mrec, const s64 mft_data_vcn) | |
| 2017 | + | struct mft_record **ni_mrec) | |
| 2135 | 2018 | { | |
| 2136 | 2019 | s64 ll, bit, old_data_initialized, old_data_size; | |
| 2137 | - | s64 nr_new_mft_records = 0; | |
| 2138 | - | s64 max_mft_no = -1, reserve_start = -1, reserve_end = -1; | |
| 2139 | - | s64 candidate_reserve_end = -1; | |
| 2140 | - | s64 *reserve_endp; | |
| 2141 | 2020 | unsigned long flags; | |
| 2142 | 2021 | struct folio *folio; | |
| 2143 | 2022 | struct ntfs_inode *mft_ni, *mftbmp_ni; | |
| @@ -2148,9 +2027,7 @@ int ntfs_mft_record_alloc(struct ntfs_volume *vol, const int mode, | |||
| 2148 | 2027 | unsigned int ofs; | |
| 2149 | 2028 | int err; | |
| 2150 | 2029 | __le16 seq_no, usn; | |
| 2151 | - | bool record_formatted = false, from_reserve = false, tail_alloc = false; | |
| 2152 | - | bool reserve_created = false; | |
| 2153 | - | bool forced_reserved_record = false; | |
| 2030 | + | bool record_formatted = false; | |
| 2154 | 2031 | unsigned int memalloc_flags; | |
| 2155 | 2032 | ||
| 2156 | 2033 | if (base_ni && *ni) | |
| @@ -2159,21 +2036,6 @@ int ntfs_mft_record_alloc(struct ntfs_volume *vol, const int mode, | |||
| 2159 | 2036 | /* @mode and @base_ni are mutually exclusive. */ | |
| 2160 | 2037 | if (mode && base_ni) | |
| 2161 | 2038 | return -EINVAL; | |
| 2162 | - | if (mft_data_vcn >= 0 && | |
| 2163 | - | (!base_ni || base_ni->mft_no != FILE_MFT)) | |
| 2164 | - | return -EINVAL; | |
| 2165 | - | if (mft_data_vcn >= 0) { | |
| 2166 | - | u64 vbo; | |
| 2167 | - | ||
| 2168 | - | if ((u64)mft_data_vcn > (U64_MAX >> vol->cluster_size_bits)) | |
| 2169 | - | return -EOVERFLOW; | |
| 2170 | - | vbo = (u64)mft_data_vcn << vol->cluster_size_bits; | |
| 2171 | - | /* | |
| 2172 | - | * The whole extent record must be reachable without this | |
| 2173 | - | * extent, including when an MFT record spans multiple clusters. | |
| 2174 | - | */ | |
| 2175 | - | max_mft_no = vbo >> vol->mft_record_size_bits; | |
| 2176 | - | } | |
| 2177 | 2039 | ||
| 2178 | 2040 | if (base_ni) | |
| 2179 | 2041 | ntfs_debug("Entering (allocating an extent mft record for base mft record 0x%llx).", | |
| @@ -2188,39 +2050,10 @@ int ntfs_mft_record_alloc(struct ntfs_volume *vol, const int mode, | |||
| 2188 | 2050 | mutex_lock(&mft_ni->mrec_lock); | |
| 2189 | 2051 | mftbmp_ni = NTFS_I(vol->mftbmp_ino); | |
| 2190 | 2052 | search_free_rec: | |
| 2191 | - | from_reserve = false; | |
| 2192 | - | reserve_created = false; | |
| 2193 | - | candidate_reserve_end = -1; | |
| 2194 | 2053 | if (!base_ni || base_ni->mft_no != FILE_MFT) | |
| 2195 | 2054 | down_write(&vol->mftbmp_lock); | |
| 2196 | - | if (base_ni && base_ni->mft_no == FILE_MFT && | |
| 2197 | - | vol->mft_record_reserve_pos < vol->mft_record_reserve_end && | |
| 2198 | - | (max_mft_no < 0 || vol->mft_record_reserve_pos < max_mft_no)) { | |
| 2199 | - | bit = vol->mft_record_reserve_pos; | |
| 2200 | - | err = ntfs_bitmap_set_bit(vol->mftbmp_ino, bit); | |
| 2201 | - | if (unlikely(err)) { | |
| 2202 | - | ntfs_error(vol->sb, | |
| 2203 | - | "Failed to allocate reserved MFT record 0x%llx.", | |
| 2204 | - | bit); | |
| 2205 | - | goto err_out; | |
| 2206 | - | } | |
| 2207 | - | vol->mft_record_reserve_pos++; | |
| 2208 | - | from_reserve = true; | |
| 2209 | - | ntfs_debug("Allocated MFT metadata record 0x%llx from tail reserve.", | |
| 2210 | - | bit); | |
| 2211 | - | goto have_alloc_rec; | |
| 2212 | - | } | |
| 2213 | - | reserve_endp = vol->mft_record_reserve_pos >= | |
| 2214 | - | vol->mft_record_reserve_end ? &candidate_reserve_end : NULL; | |
| 2215 | - | bit = mft_bitmap_alloc_free_rec(vol, base_ni, max_mft_no, reserve_endp); | |
| 2055 | + | bit = ntfs_mft_bitmap_find_and_alloc_free_rec_nolock(vol, base_ni); | |
| 2216 | 2056 | if (bit >= 0) { | |
| 2217 | - | if (candidate_reserve_end > bit + 1) { | |
| 2218 | - | vol->mft_record_reserve_pos = bit + 1; | |
| 2219 | - | vol->mft_record_reserve_end = candidate_reserve_end; | |
| 2220 | - | reserve_created = true; | |
| 2221 | - | ntfs_debug("Reserved free MFT records [0x%llx, 0x%llx) for metadata.", | |
| 2222 | - | bit + 1, candidate_reserve_end); | |
| 2223 | - | } | |
| 2224 | 2057 | ntfs_debug("Found and allocated free record (#1), bit 0x%llx.", | |
| 2225 | 2058 | (long long)bit); | |
| 2226 | 2059 | goto have_alloc_rec; | |
| @@ -2235,24 +2068,6 @@ search_free_rec: | |||
| 2235 | 2068 | } | |
| 2236 | 2069 | ||
| 2237 | 2070 | if (base_ni && base_ni->mft_no == FILE_MFT) { | |
| 2238 | - | static const u8 bootstrap_records[] = { | |
| 2239 | - | FILE_reserved15, FILE_reserved12, FILE_reserved13, | |
| 2240 | - | FILE_reserved14, | |
| 2241 | - | }; | |
| 2242 | - | int i; | |
| 2243 | - | ||
| 2244 | - | for (i = 0; i < ARRAY_SIZE(bootstrap_records); i++) { | |
| 2245 | - | if (max_mft_no >= 0 && bootstrap_records[i] >= max_mft_no) | |
| 2246 | - | continue; | |
| 2247 | - | if (!mft_reserved_is_free(vol, mft_ni, | |
| 2248 | - | bootstrap_records[i])) | |
| 2249 | - | continue; | |
| 2250 | - | bit = bootstrap_records[i]; | |
| 2251 | - | forced_reserved_record = true; | |
| 2252 | - | ntfs_debug("Using reserved MFT record %lld to bootstrap metadata extension.", | |
| 2253 | - | bit); | |
| 2254 | - | goto have_alloc_rec; | |
| 2255 | - | } | |
| 2256 | 2071 | memalloc_nofs_restore(memalloc_flags); | |
| 2257 | 2072 | return bit; | |
| 2258 | 2073 | } | |
| @@ -2272,10 +2087,10 @@ search_free_rec: | |||
| 2272 | 2087 | old_data_initialized = mftbmp_ni->initialized_size; | |
| 2273 | 2088 | read_unlock_irqrestore(&mftbmp_ni->size_lock, flags); | |
| 2274 | 2089 | if (old_data_initialized << 3 > ll && | |
| 2275 | - | old_data_initialized << 3 > FIRST_NORMAL_MFT_RECORD) { | |
| 2090 | + | old_data_initialized > RESERVED_MFT_RECORDS / 8) { | |
| 2276 | 2091 | bit = ll; | |
| 2277 | - | if (bit < FIRST_NORMAL_MFT_RECORD) | |
| 2278 | - | bit = FIRST_NORMAL_MFT_RECORD; | |
| 2092 | + | if (bit < RESERVED_MFT_RECORDS) | |
| 2093 | + | bit = RESERVED_MFT_RECORDS; | |
| 2279 | 2094 | if (unlikely(bit >= (1ll << 32))) | |
| 2280 | 2095 | goto max_err_out; | |
| 2281 | 2096 | ntfs_debug("Found free record (#2), bit 0x%llx.", | |
| @@ -2361,11 +2176,6 @@ have_alloc_rec: | |||
| 2361 | 2176 | read_lock_irqsave(&mft_ni->size_lock, flags); | |
| 2362 | 2177 | old_data_initialized = mft_ni->initialized_size; | |
| 2363 | 2178 | read_unlock_irqrestore(&mft_ni->size_lock, flags); | |
| 2364 | - | tail_alloc = (!base_ni || base_ni->mft_no != FILE_MFT) && | |
| 2365 | - | bit >= (old_data_initialized >> vol->mft_record_size_bits) && | |
| 2366 | - | vol->mft_record_reserve_pos >= vol->mft_record_reserve_end; | |
| 2367 | - | if (tail_alloc) | |
| 2368 | - | ll = (bit + 2) << vol->mft_record_size_bits; | |
| 2369 | 2179 | if (ll <= old_data_initialized) { | |
| 2370 | 2180 | ntfs_debug("Allocated mft record already initialized."); | |
| 2371 | 2181 | goto mft_rec_already_initialized; | |
| @@ -2398,29 +2208,6 @@ have_alloc_rec: | |||
| 2398 | 2208 | mft_ni->initialized_size); | |
| 2399 | 2209 | } | |
| 2400 | 2210 | read_unlock_irqrestore(&mft_ni->size_lock, flags); | |
| 2401 | - | if (tail_alloc) { | |
| 2402 | - | s64 bitmap_records; | |
| 2403 | - | ||
| 2404 | - | read_lock_irqsave(&mft_ni->size_lock, flags); | |
| 2405 | - | reserve_end = mft_ni->allocated_size >> | |
| 2406 | - | vol->mft_record_size_bits; | |
| 2407 | - | read_unlock_irqrestore(&mft_ni->size_lock, flags); | |
| 2408 | - | read_lock_irqsave(&mftbmp_ni->size_lock, flags); | |
| 2409 | - | bitmap_records = mftbmp_ni->initialized_size << 3; | |
| 2410 | - | read_unlock_irqrestore(&mftbmp_ni->size_lock, flags); | |
| 2411 | - | if (reserve_end > bitmap_records) | |
| 2412 | - | reserve_end = bitmap_records; | |
| 2413 | - | if (reserve_end > bit + 1 + MFT_RECORD_RESERVE) | |
| 2414 | - | reserve_end = bit + 1 + MFT_RECORD_RESERVE; | |
| 2415 | - | reserve_start = bit + 1; | |
| 2416 | - | if (reserve_end > reserve_start) { | |
| 2417 | - | ll = reserve_end << vol->mft_record_size_bits; | |
| 2418 | - | } else { | |
| 2419 | - | reserve_start = -1; | |
| 2420 | - | reserve_end = -1; | |
| 2421 | - | ll = (bit + 1) << vol->mft_record_size_bits; | |
| 2422 | - | } | |
| 2423 | - | } | |
| 2424 | 2211 | } else if (ll > mft_ni->allocated_size) { | |
| 2425 | 2212 | err = -ENOSPC; | |
| 2426 | 2213 | goto undo_mftbmp_alloc_nolock; | |
| @@ -2489,25 +2276,14 @@ have_alloc_rec: | |||
| 2489 | 2276 | mark_mft_record_dirty(ctx->ntfs_ino); | |
| 2490 | 2277 | ntfs_attr_put_search_ctx(ctx); | |
| 2491 | 2278 | unmap_mft_record(mft_ni); | |
| 2492 | - | if (reserve_start >= 0 && reserve_end > reserve_start) { | |
| 2493 | - | vol->mft_record_reserve_pos = reserve_start; | |
| 2494 | - | vol->mft_record_reserve_end = reserve_end; | |
| 2495 | - | ntfs_debug("Reserved MFT records [0x%llx, 0x%llx) for metadata.", | |
| 2496 | - | reserve_start, reserve_end); | |
| 2497 | - | } | |
| 2498 | 2279 | read_lock_irqsave(&mft_ni->size_lock, flags); | |
| 2499 | 2280 | ntfs_debug("Status of mft data after mft record initialization: allocated_size 0x%llx, data_size 0x%llx, initialized_size 0x%llx.", | |
| 2500 | 2281 | mft_ni->allocated_size, i_size_read(vol->mft_ino), | |
| 2501 | 2282 | mft_ni->initialized_size); | |
| 2502 | 2283 | WARN_ON(i_size_read(vol->mft_ino) > mft_ni->allocated_size); | |
| 2503 | 2284 | WARN_ON(mft_ni->initialized_size > i_size_read(vol->mft_ino)); | |
| 2504 | - | nr_new_mft_records = (i_size_read(vol->mft_ino) - old_data_size) >> | |
| 2505 | - | vol->mft_record_size_bits; | |
| 2506 | 2285 | read_unlock_irqrestore(&mft_ni->size_lock, flags); | |
| 2507 | 2286 | mft_rec_already_initialized: | |
| 2508 | - | /* Account for newly visible MFT records before dropping the lock. */ | |
| 2509 | - | if (nr_new_mft_records > 0) | |
| 2510 | - | ntfs_inc_free_mft_records(vol, nr_new_mft_records); | |
| 2511 | 2287 | /* | |
| 2512 | 2288 | * We can finally drop the mft bitmap lock as the mft data attribute | |
| 2513 | 2289 | * has been fully updated. The only disparity left is that the | |
| @@ -2539,8 +2315,8 @@ mft_rec_already_initialized: | |||
| 2539 | 2315 | /* If we just formatted the mft record no need to do it again. */ | |
| 2540 | 2316 | if (!record_formatted) { | |
| 2541 | 2317 | /* Sanity check that the mft record is really not in use. */ | |
| 2542 | - | if (!forced_reserved_record && ntfs_is_file_record(m->magic) && | |
| 2543 | - | (m->flags & MFT_RECORD_IN_USE)) { | |
| 2318 | + | if (ntfs_is_file_record(m->magic) && | |
| 2319 | + | (m->flags & MFT_RECORD_IN_USE)) { | |
| 2544 | 2320 | ntfs_warning(vol->sb, | |
| 2545 | 2321 | "Mft record 0x%llx was marked free in mft bitmap but is marked used itself. Unmount and run chkdsk.", | |
| 2546 | 2322 | bit); | |
| @@ -2613,13 +2389,9 @@ mft_rec_already_initialized: | |||
| 2613 | 2389 | ntfs_error(vol->sb, "Failed to map allocated extent mft record 0x%llx.", | |
| 2614 | 2390 | bit); | |
| 2615 | 2391 | err = PTR_ERR(m_tmp); | |
| 2616 | - | if (forced_reserved_record) { | |
| 2617 | - | m->base_mft_record = 0; | |
| 2618 | - | m->flags |= MFT_RECORD_IN_USE; | |
| 2619 | - | } else { | |
| 2620 | - | /* Set the mft record itself not in use. */ | |
| 2621 | - | m->flags &= cpu_to_le16(~le16_to_cpu(MFT_RECORD_IN_USE)); | |
| 2622 | - | } | |
| 2392 | + | /* Set the mft record itself not in use. */ | |
| 2393 | + | m->flags &= cpu_to_le16( | |
| 2394 | + | ~le16_to_cpu(MFT_RECORD_IN_USE)); | |
| 2623 | 2395 | /* Make sure the mft record is written out to disk. */ | |
| 2624 | 2396 | ntfs_mft_mark_dirty(folio); | |
| 2625 | 2397 | folio_unlock(folio); | |
| @@ -2691,8 +2463,7 @@ mft_rec_already_initialized: | |||
| 2691 | 2463 | (*ni)->mft_no = bit; | |
| 2692 | 2464 | if (ni_mrec) | |
| 2693 | 2465 | *ni_mrec = (*ni)->mrec; | |
| 2694 | - | if (!forced_reserved_record) | |
| 2695 | - | ntfs_dec_free_mft_records(vol, 1); | |
| 2466 | + | ntfs_dec_free_mft_records(vol, 1); | |
| 2696 | 2467 | return 0; | |
| 2697 | 2468 | undo_data_init: | |
| 2698 | 2469 | write_lock_irqsave(&mft_ni->size_lock, flags); | |
| @@ -2704,13 +2475,10 @@ undo_mftbmp_alloc: | |||
| 2704 | 2475 | if (!base_ni || base_ni->mft_no != FILE_MFT) | |
| 2705 | 2476 | down_write(&vol->mftbmp_lock); | |
| 2706 | 2477 | undo_mftbmp_alloc_nolock: | |
| 2707 | - | if (!forced_reserved_record && ntfs_bitmap_clear_bit(vol->mftbmp_ino, bit)) { | |
| 2478 | + | if (ntfs_bitmap_clear_bit(vol->mftbmp_ino, bit)) { | |
| 2708 | 2479 | ntfs_error(vol->sb, "Failed to clear bit in mft bitmap.%s", es); | |
| 2709 | 2480 | NVolSetErrors(vol); | |
| 2710 | 2481 | } | |
| 2711 | - | if ((from_reserve || reserve_created) && | |
| 2712 | - | vol->mft_record_reserve_pos == bit + 1) | |
| 2713 | - | vol->mft_record_reserve_pos = bit; | |
| 2714 | 2482 | if (!base_ni || base_ni->mft_no != FILE_MFT) | |
| 2715 | 2483 | up_write(&vol->mftbmp_lock); | |
| 2716 | 2484 | err_out: | |
| @@ -2746,11 +2514,9 @@ int ntfs_mft_record_free(struct ntfs_volume *vol, struct ntfs_inode *ni) | |||
| 2746 | 2514 | int err; | |
| 2747 | 2515 | u16 seq_no; | |
| 2748 | 2516 | __le16 old_seq_no; | |
| 2749 | - | __le64 old_base_mft_record; | |
| 2750 | 2517 | struct mft_record *ni_mrec; | |
| 2751 | 2518 | unsigned int memalloc_flags; | |
| 2752 | 2519 | struct ntfs_inode *base_ni; | |
| 2753 | - | bool keep_reserved; | |
| 2754 | 2520 | ||
| 2755 | 2521 | if (!vol || !ni) | |
| 2756 | 2522 | return -EINVAL; | |
| @@ -2763,23 +2529,9 @@ int ntfs_mft_record_free(struct ntfs_volume *vol, struct ntfs_inode *ni) | |||
| 2763 | 2529 | ||
| 2764 | 2530 | /* Cache the mft reference for later. */ | |
| 2765 | 2531 | mft_no = ni->mft_no; | |
| 2766 | - | if (likely(ni->nr_extents >= 0)) | |
| 2767 | - | base_ni = ni; | |
| 2768 | - | else | |
| 2769 | - | base_ni = ni->ext.base_ntfs_ino; | |
| 2770 | - | keep_reserved = mft_no >= FILE_reserved12 && | |
| 2771 | - | mft_no <= FILE_reserved15 && | |
| 2772 | - | base_ni->mft_no == FILE_MFT; | |
| 2773 | - | ||
| 2774 | - | old_base_mft_record = ni_mrec->base_mft_record; | |
| 2775 | - | if (keep_reserved) { | |
| 2776 | - | /* Restore the special, unnamed form used by reserved records. */ | |
| 2777 | - | ni_mrec->base_mft_record = 0; | |
| 2778 | - | ni_mrec->flags |= MFT_RECORD_IN_USE; | |
| 2779 | - | } else { | |
| 2780 | - | /* Mark the mft record as not in use. */ | |
| 2781 | - | ni_mrec->flags &= ~MFT_RECORD_IN_USE; | |
| 2782 | - | } | |
| 2532 | + | ||
| 2533 | + | /* Mark the mft record as not in use. */ | |
| 2534 | + | ni_mrec->flags &= ~MFT_RECORD_IN_USE; | |
| 2783 | 2535 | ||
| 2784 | 2536 | /* Increment the sequence number, skipping zero, if it is not zero. */ | |
| 2785 | 2537 | old_seq_no = ni_mrec->sequence_number; | |
| @@ -2808,28 +2560,24 @@ int ntfs_mft_record_free(struct ntfs_volume *vol, struct ntfs_inode *ni) | |||
| 2808 | 2560 | if (err) | |
| 2809 | 2561 | goto sync_rollback; | |
| 2810 | 2562 | ||
| 2811 | - | if (keep_reserved) { | |
| 2812 | - | unmap_mft_record(ni); | |
| 2813 | - | return 0; | |
| 2814 | - | } | |
| 2563 | + | if (likely(ni->nr_extents >= 0)) | |
| 2564 | + | base_ni = ni; | |
| 2565 | + | else | |
| 2566 | + | base_ni = ni->ext.base_ntfs_ino; | |
| 2815 | 2567 | ||
| 2816 | 2568 | /* Clear the bit in the $MFT/$BITMAP corresponding to this record. */ | |
| 2817 | 2569 | memalloc_flags = memalloc_nofs_save(); | |
| 2818 | 2570 | if (base_ni->mft_no != FILE_MFT) | |
| 2819 | 2571 | down_write(&vol->mftbmp_lock); | |
| 2820 | 2572 | err = ntfs_bitmap_clear_bit(vol->mftbmp_ino, mft_no); | |
| 2821 | - | if (!err) | |
| 2822 | - | ntfs_inc_free_mft_records(vol, 1); | |
| 2823 | - | if (!err && base_ni->mft_no == FILE_MFT && | |
| 2824 | - | mft_no + 1 == vol->mft_record_reserve_pos && | |
| 2825 | - | mft_no < vol->mft_record_reserve_end) | |
| 2826 | - | vol->mft_record_reserve_pos = mft_no; | |
| 2827 | 2573 | if (base_ni->mft_no != FILE_MFT) | |
| 2828 | 2574 | up_write(&vol->mftbmp_lock); | |
| 2829 | 2575 | memalloc_nofs_restore(memalloc_flags); | |
| 2830 | 2576 | if (err) | |
| 2831 | 2577 | goto bitmap_rollback; | |
| 2578 | + | ||
| 2832 | 2579 | unmap_mft_record(ni); | |
| 2580 | + | ntfs_inc_free_mft_records(vol, 1); | |
| 2833 | 2581 | return 0; | |
| 2834 | 2582 | ||
| 2835 | 2583 | /* Rollback what we did... */ | |
| @@ -2847,7 +2595,6 @@ sync_rollback: | |||
| 2847 | 2595 | "Eeek! Rollback failed in %s. Leaving inconsistent metadata!\n", __func__); | |
| 2848 | 2596 | ni_mrec->flags |= MFT_RECORD_IN_USE; | |
| 2849 | 2597 | ni_mrec->sequence_number = old_seq_no; | |
| 2850 | - | ni_mrec->base_mft_record = old_base_mft_record; | |
| 2851 | 2598 | NInoSetDirty(ni); | |
| 2852 | 2599 | write_mft_record(ni, ni_mrec, 0); | |
| 2853 | 2600 | unmap_mft_record(ni); | |
modified fs/ntfs/mft.h
| @@ -78,7 +78,7 @@ static inline int write_mft_record(struct ntfs_inode *ni, struct mft_record *m, | |||
| 78 | 78 | ||
| 79 | 79 | int ntfs_mft_record_alloc(struct ntfs_volume *vol, const int mode, | |
| 80 | 80 | struct ntfs_inode **ni, struct ntfs_inode *base_ni, | |
| 81 | - | struct mft_record **ni_mrec, const s64 mft_data_vcn); | |
| 81 | + | struct mft_record **ni_mrec); | |
| 82 | 82 | int ntfs_mft_record_free(struct ntfs_volume *vol, struct ntfs_inode *ni); | |
| 83 | 83 | int ntfs_mft_records_write(const struct ntfs_volume *vol, const u64 mref, | |
| 84 | 84 | const s64 count, struct mft_record *b); | |
modified fs/ntfs/namei.c
| @@ -480,7 +480,7 @@ static struct ntfs_inode *__ntfs_create(struct mnt_idmap *idmap, struct inode *d | |||
| 480 | 480 | mark_inode_dirty(dir); | |
| 481 | 481 | ||
| 482 | 482 | err = ntfs_mft_record_alloc(dir_ni->vol, mode, &ni, NULL, | |
| 483 | - | &ni_mrec, -1); | |
| 483 | + | &ni_mrec); | |
| 484 | 484 | if (err) { | |
| 485 | 485 | iput(vi); | |
| 486 | 486 | return ERR_PTR(err); | |
modified fs/ntfs/super.c
| @@ -2064,7 +2064,8 @@ static unsigned long __get_nr_free_mft_records(struct ntfs_volume *vol, | |||
| 2064 | 2064 | /* If errors occurred we may well have gone below zero, fix this. */ | |
| 2065 | 2065 | if (nr_free < 0) | |
| 2066 | 2066 | nr_free = 0; | |
| 2067 | - | atomic64_set(&vol->free_mft_records, nr_free); | |
| 2067 | + | else | |
| 2068 | + | atomic64_set(&vol->free_mft_records, nr_free); | |
| 2068 | 2069 | ||
| 2069 | 2070 | ntfs_debug("Exiting."); | |
| 2070 | 2071 | return nr_free; | |
| @@ -2130,14 +2131,7 @@ static int ntfs_statfs(struct dentry *dentry, struct kstatfs *sfs) | |||
| 2130 | 2131 | read_unlock_irqrestore(&mft_ni->size_lock, flags); | |
| 2131 | 2132 | ||
| 2132 | 2133 | /* Free inodes in fs (based on current total count). */ | |
| 2133 | - | size = atomic64_read(&vol->free_mft_records); | |
| 2134 | - | if (unlikely(size < 0 || size > (s64)sfs->f_files)) | |
| 2135 | - | ntfs_warning(vol->sb, "Invalid free MFT record count %lld.", size); | |
| 2136 | - | if (size < 0) | |
| 2137 | - | size = 0; | |
| 2138 | - | else if (size > (s64)sfs->f_files) | |
| 2139 | - | size = sfs->f_files; | |
| 2140 | - | sfs->f_ffree = size; | |
| 2134 | + | sfs->f_ffree = atomic64_read(&vol->free_mft_records); | |
| 2141 | 2135 | ||
| 2142 | 2136 | /* | |
| 2143 | 2137 | * File system id. This is extremely *nix flavour dependent and even | |
modified fs/ntfs/volume.h
| @@ -55,10 +55,6 @@ | |||
| 55 | 55 | * @attrdef_size: Size of the attribute definition table in bytes. | |
| 56 | 56 | * @attrdef: Table of attribute definitions. Obtained from FILE_AttrDef. | |
| 57 | 57 | * @mft_data_pos: Mft record number at which to allocate the next mft record. | |
| 58 | - | * @mft_record_reserve_pos: First record in the in-memory MFT metadata reserve | |
| 59 | - | * (protected by mftbmp_lock). | |
| 60 | - | * @mft_record_reserve_end: First record beyond the MFT metadata reserve | |
| 61 | - | * (protected by mftbmp_lock). | |
| 62 | 58 | * @mft_zone_start: First cluster of the mft zone. | |
| 63 | 59 | * @mft_zone_end: First cluster beyond the mft zone. | |
| 64 | 60 | * @mft_zone_pos: Current position in the mft zone. | |
| @@ -123,8 +119,6 @@ struct ntfs_volume { | |||
| 123 | 119 | s32 attrdef_size; | |
| 124 | 120 | struct attr_def *attrdef; | |
| 125 | 121 | s64 mft_data_pos; | |
| 126 | - | s64 mft_record_reserve_pos; | |
| 127 | - | s64 mft_record_reserve_end; | |
| 128 | 122 | s64 mft_zone_start; | |
| 129 | 123 | s64 mft_zone_end; | |
| 130 | 124 | s64 mft_zone_pos; | |
| @@ -258,11 +252,17 @@ static inline void ntfs_dec_free_clusters(struct ntfs_volume *vol, s64 nr) | |||
| 258 | 252 | ||
| 259 | 253 | static inline void ntfs_inc_free_mft_records(struct ntfs_volume *vol, s64 nr) | |
| 260 | 254 | { | |
| 255 | + | if (!NVolFreeClusterKnown(vol)) | |
| 256 | + | return; | |
| 257 | + | ||
| 261 | 258 | atomic64_add(nr, &vol->free_mft_records); | |
| 262 | 259 | } | |
| 263 | 260 | ||
| 264 | 261 | static inline void ntfs_dec_free_mft_records(struct ntfs_volume *vol, s64 nr) | |
| 265 | 262 | { | |
| 263 | + | if (!NVolFreeClusterKnown(vol)) | |
| 264 | + | return; | |
| 265 | + | ||
| 266 | 266 | atomic64_sub(nr, &vol->free_mft_records); | |
| 267 | 267 | } | |
| 268 | 268 | ||
modified fs/ntfs3/inode.c
| @@ -1866,10 +1866,10 @@ int ntfs_create_inode(struct mnt_idmap *idmap, struct inode *dir, | |||
| 1866 | 1866 | goto out6; | |
| 1867 | 1867 | ||
| 1868 | 1868 | /* | |
| 1869 | - | * Call 'd_instantiate_new' after inode->i_op is set | |
| 1869 | + | * Call 'd_instantiate' after inode->i_op is set | |
| 1870 | 1870 | * but before finish_open. | |
| 1871 | 1871 | */ | |
| 1872 | - | d_instantiate_new(dentry, inode); | |
| 1872 | + | d_instantiate(dentry, inode); | |
| 1873 | 1873 | ||
| 1874 | 1874 | /* Set original time. inode times (i_ctime) may be changed in ntfs_init_acl. */ | |
| 1875 | 1875 | inode_set_atime_to_ts(inode, ni->i_crtime); | |
| @@ -1917,6 +1917,9 @@ out1: | |||
| 1917 | 1917 | if (!fnd) | |
| 1918 | 1918 | ni_unlock(dir_ni); | |
| 1919 | 1919 | ||
| 1920 | + | if (!err) | |
| 1921 | + | unlock_new_inode(inode); | |
| 1922 | + | ||
| 1920 | 1923 | return err; | |
| 1921 | 1924 | } | |
| 1922 | 1925 | ||
modified fs/ocfs2/namei.c
| @@ -336,8 +336,13 @@ static int ocfs2_mknod(struct mnt_idmap *idmap, | |||
| 336 | 336 | goto leave; | |
| 337 | 337 | ||
| 338 | 338 | /* calculate meta data/clusters for setting security and acl xattr */ | |
| 339 | - | ocfs2_calc_xattr_init(dir, mode, &si, &want_clusters, &xattr_credits, | |
| 340 | - | &want_meta, &acl_state); | |
| 339 | + | status = ocfs2_calc_xattr_init(dir, mode, &si, &want_clusters, | |
| 340 | + | &xattr_credits, &want_meta, | |
| 341 | + | &acl_state); | |
| 342 | + | if (status < 0) { | |
| 343 | + | mlog_errno(status); | |
| 344 | + | goto leave; | |
| 345 | + | } | |
| 341 | 346 | ||
| 342 | 347 | /* Reserve a cluster if creating an extent based directory. */ | |
| 343 | 348 | if (S_ISDIR(mode) && !ocfs2_supports_inline_data(osb)) { | |
modified fs/ocfs2/xattr.c
| @@ -635,11 +635,12 @@ int ocfs2_calc_security_init(struct inode *dir, | |||
| 635 | 635 | return ret; | |
| 636 | 636 | } | |
| 637 | 637 | ||
| 638 | - | void ocfs2_calc_xattr_init(struct inode *dir, umode_t mode, | |
| 639 | - | struct ocfs2_security_xattr_info *si, | |
| 640 | - | int *want_clusters, int *xattr_credits, | |
| 641 | - | int *want_meta, struct ocfs2_acl_state *acl_state) | |
| 638 | + | int ocfs2_calc_xattr_init(struct inode *dir, umode_t mode, | |
| 639 | + | struct ocfs2_security_xattr_info *si, | |
| 640 | + | int *want_clusters, int *xattr_credits, | |
| 641 | + | int *want_meta, struct ocfs2_acl_state *acl_state) | |
| 642 | 642 | { | |
| 643 | + | int ret = 0; | |
| 643 | 644 | struct ocfs2_super *osb = OCFS2_SB(dir->i_sb); | |
| 644 | 645 | int s_size = 0, a_size = 0, acl_len = 0, new_clusters; | |
| 645 | 646 | ||
| @@ -661,7 +662,7 @@ void ocfs2_calc_xattr_init(struct inode *dir, umode_t mode, | |||
| 661 | 662 | } | |
| 662 | 663 | ||
| 663 | 664 | if (!(s_size + a_size)) | |
| 664 | - | return; | |
| 665 | + | return ret; | |
| 665 | 666 | ||
| 666 | 667 | /* | |
| 667 | 668 | * The max space of security xattr taken inline is | |
| @@ -727,6 +728,8 @@ void ocfs2_calc_xattr_init(struct inode *dir, umode_t mode, | |||
| 727 | 728 | } | |
| 728 | 729 | } | |
| 729 | 730 | } | |
| 731 | + | ||
| 732 | + | return ret; | |
| 730 | 733 | } | |
| 731 | 734 | ||
| 732 | 735 | static int ocfs2_xattr_extend_allocation(struct inode *inode, | |
modified fs/ocfs2/xattr.h
| @@ -59,10 +59,10 @@ int ocfs2_calc_security_init(struct inode *, | |||
| 59 | 59 | int *, int *, struct ocfs2_alloc_context **); | |
| 60 | 60 | ||
| 61 | 61 | struct ocfs2_acl_state; | |
| 62 | - | void ocfs2_calc_xattr_init(struct inode *dir, umode_t mode, | |
| 63 | - | struct ocfs2_security_xattr_info *si, | |
| 64 | - | int *want_clusters, int *xattr_credits, | |
| 65 | - | int *want_meta, struct ocfs2_acl_state *acl_state); | |
| 62 | + | int ocfs2_calc_xattr_init(struct inode *dir, umode_t mode, | |
| 63 | + | struct ocfs2_security_xattr_info *si, | |
| 64 | + | int *want_clusters, int *xattr_credits, | |
| 65 | + | int *want_meta, struct ocfs2_acl_state *acl_state); | |
| 66 | 66 | ||
| 67 | 67 | /* | |
| 68 | 68 | * xattrs can live inside an inode, as part of an external xattr block, | |
modified fs/overlayfs/overlayfs.h
| @@ -254,10 +254,8 @@ static inline struct dentry *ovl_do_mkdir(struct ovl_fs *ofs, | |||
| 254 | 254 | { | |
| 255 | 255 | struct dentry *ret; | |
| 256 | 256 | ||
| 257 | - | /* vfs_mkdir() drops @dentry on failure and may replace it on success */ | |
| 258 | - | pr_debug("mkdir(%pd2, 0%o)\n", dentry, mode); | |
| 259 | 257 | ret = vfs_mkdir(ovl_upper_mnt_idmap(ofs), dir, dentry, mode, NULL); | |
| 260 | - | pr_debug("...mkdir = %i\n", PTR_ERR_OR_ZERO(ret)); | |
| 258 | + | pr_debug("mkdir(%pd2, 0%o) = %i\n", dentry, mode, PTR_ERR_OR_ZERO(ret)); | |
| 261 | 259 | return ret; | |
| 262 | 260 | } | |
| 263 | 261 | ||
modified fs/smb/client/cached_dir.c
| @@ -8,7 +8,6 @@ | |||
| 8 | 8 | #include <linux/namei.h> | |
| 9 | 9 | #include "cifsglob.h" | |
| 10 | 10 | #include "cifsproto.h" | |
| 11 | - | #include "../common/smb2status.h" | |
| 12 | 11 | #include "cifs_debug.h" | |
| 13 | 12 | #include "smb2proto.h" | |
| 14 | 13 | #include "cached_dir.h" | |
| @@ -324,37 +323,25 @@ replay_again: | |||
| 324 | 323 | rc = compound_send_recv(xid, ses, server, | |
| 325 | 324 | flags, 2, rqst, | |
| 326 | 325 | resp_buftype, rsp_iov); | |
| 327 | - | if (rc == -EREMCHG) { | |
| 328 | - | tcon->need_reconnect = true; | |
| 329 | - | pr_warn_once("server share %s deleted\n", | |
| 330 | - | tcon->tree_name); | |
| 331 | - | } | |
| 332 | - | ||
| 333 | - | if (!rsp_iov[0].iov_base || rsp_iov[0].iov_len < sizeof(*o_rsp)) { | |
| 334 | - | if (!rc) | |
| 335 | - | rc = -EIO; | |
| 326 | + | if (rc) { | |
| 327 | + | if (rc == -EREMCHG) { | |
| 328 | + | tcon->need_reconnect = true; | |
| 329 | + | pr_warn_once("server share %s deleted\n", | |
| 330 | + | tcon->tree_name); | |
| 331 | + | } | |
| 336 | 332 | goto oshr_free; | |
| 337 | 333 | } | |
| 334 | + | cfid->is_open = true; | |
| 338 | 335 | ||
| 339 | - | o_rsp = (struct smb2_create_rsp *)rsp_iov[0].iov_base; | |
| 340 | - | if (o_rsp->hdr.Status != STATUS_SUCCESS) { | |
| 341 | - | if (!rc) | |
| 342 | - | rc = -EIO; | |
| 343 | - | goto oshr_free; | |
| 344 | - | } | |
| 336 | + | spin_lock(&cfids->cfid_list_lock); | |
| 345 | 337 | ||
| 338 | + | o_rsp = (struct smb2_create_rsp *)rsp_iov[0].iov_base; | |
| 346 | 339 | oparms.fid->persistent_fid = o_rsp->PersistentFileId; | |
| 347 | 340 | oparms.fid->volatile_fid = o_rsp->VolatileFileId; | |
| 348 | 341 | #ifdef CONFIG_CIFS_DEBUG2 | |
| 349 | 342 | oparms.fid->mid = le64_to_cpu(o_rsp->hdr.MessageId); | |
| 350 | 343 | #endif /* CIFS_DEBUG2 */ | |
| 351 | - | cfid->is_open = true; | |
| 352 | - | atomic_inc(&tcon->num_remote_opens); | |
| 353 | 344 | ||
| 354 | - | if (rc) | |
| 355 | - | goto oshr_free; | |
| 356 | - | ||
| 357 | - | spin_lock(&cfids->cfid_list_lock); | |
| 358 | 345 | ||
| 359 | 346 | if (o_rsp->OplockLevel != SMB2_OPLOCK_LEVEL_LEASE) { | |
| 360 | 347 | spin_unlock(&cfids->cfid_list_lock); | |
| @@ -421,6 +408,7 @@ out: | |||
| 421 | 408 | close_cached_dir(cfid); | |
| 422 | 409 | } else { | |
| 423 | 410 | *ret_cfid = cfid; | |
| 411 | + | atomic_inc(&tcon->num_remote_opens); | |
| 424 | 412 | } | |
| 425 | 413 | kfree(utf16_path); | |
| 426 | 414 | ||
modified fs/smb/client/cifssmb.c
| @@ -3080,7 +3080,7 @@ int cifs_query_reparse_point(const unsigned int xid, | |||
| 3080 | 3080 | ||
| 3081 | 3081 | end = 2 + get_bcc(&io_rsp->hdr) + (__u8 *)&io_rsp->ByteCount; | |
| 3082 | 3082 | start = (__u8 *)&io_rsp->hdr.Protocol + data_offset; | |
| 3083 | - | if (start >= end || (size_t)(end - start) < sizeof(*buf)) { | |
| 3083 | + | if (start >= end) { | |
| 3084 | 3084 | rc = smb_EIO2(smb_eio_trace_qreparse_data_area, | |
| 3085 | 3085 | (unsigned long)start - (unsigned long)io_rsp, | |
| 3086 | 3086 | (unsigned long)end - (unsigned long)io_rsp); | |
modified fs/smb/client/connect.c
| @@ -174,8 +174,6 @@ cifs_signal_cifsd_for_reconnect(struct TCP_Server_Info *server, | |||
| 174 | 174 | nserver = ses->chans[i].server; | |
| 175 | 175 | if (!nserver) | |
| 176 | 176 | continue; | |
| 177 | - | if (!list_empty(&nserver->rlist)) | |
| 178 | - | continue; | |
| 179 | 177 | nserver->srv_count++; | |
| 180 | 178 | list_add(&nserver->rlist, &reco); | |
| 181 | 179 | } | |
| @@ -184,15 +182,11 @@ cifs_signal_cifsd_for_reconnect(struct TCP_Server_Info *server, | |||
| 184 | 182 | } | |
| 185 | 183 | } | |
| 186 | 184 | ||
| 187 | - | spin_lock(&cifs_tcp_ses_lock); | |
| 188 | 185 | list_for_each_entry_safe(server, nserver, &reco, rlist) { | |
| 189 | 186 | list_del_init(&server->rlist); | |
| 190 | 187 | set_need_reco(server); | |
| 191 | - | spin_unlock(&cifs_tcp_ses_lock); | |
| 192 | 188 | cifs_put_tcp_session(server, 0); | |
| 193 | - | spin_lock(&cifs_tcp_ses_lock); | |
| 194 | 189 | } | |
| 195 | - | spin_unlock(&cifs_tcp_ses_lock); | |
| 196 | 190 | } | |
| 197 | 191 | ||
| 198 | 192 | /* | |
| @@ -1073,7 +1067,6 @@ clean_demultiplex_info(struct TCP_Server_Info *server) | |||
| 1073 | 1067 | spin_unlock(&server->srv_lock); | |
| 1074 | 1068 | ||
| 1075 | 1069 | cancel_delayed_work_sync(&server->echo); | |
| 1076 | - | cancel_delayed_work_sync(&server->reconnect); | |
| 1077 | 1070 | ||
| 1078 | 1071 | spin_lock(&server->srv_lock); | |
| 1079 | 1072 | server->tcpStatus = CifsExiting; | |
| @@ -1830,7 +1823,6 @@ cifs_get_tcp_session(struct smb3_fs_context *ctx, | |||
| 1830 | 1823 | spin_lock_init(&tcp_ses->mid_counter_lock); | |
| 1831 | 1824 | INIT_LIST_HEAD(&tcp_ses->tcp_ses_list); | |
| 1832 | 1825 | INIT_LIST_HEAD(&tcp_ses->smb_ses_list); | |
| 1833 | - | INIT_LIST_HEAD(&tcp_ses->rlist); | |
| 1834 | 1826 | INIT_DELAYED_WORK(&tcp_ses->echo, cifs_echo_request); | |
| 1835 | 1827 | INIT_DELAYED_WORK(&tcp_ses->reconnect, smb2_reconnect_server); | |
| 1836 | 1828 | mutex_init(&tcp_ses->reconnect_mutex); | |
| @@ -1934,7 +1926,6 @@ out_err: | |||
| 1934 | 1926 | kfree(tcp_ses->leaf_fullpath); | |
| 1935 | 1927 | if (tcp_ses->ssocket) | |
| 1936 | 1928 | sock_release(tcp_ses->ssocket); | |
| 1937 | - | smbd_destroy(tcp_ses); | |
| 1938 | 1929 | kfree(tcp_ses); | |
| 1939 | 1930 | } | |
| 1940 | 1931 | return ERR_PTR(rc); | |
modified fs/smb/client/dfs_cache.c
| @@ -798,13 +798,13 @@ static int get_targets(struct cache_entry *ce, struct dfs_cache_tgt_list *tl) | |||
| 798 | 798 | INIT_LIST_HEAD(head); | |
| 799 | 799 | ||
| 800 | 800 | list_for_each_entry(t, &ce->tlist, list) { | |
| 801 | - | it = kzalloc_obj(*it, GFP_KERNEL); | |
| 801 | + | it = kzalloc_obj(*it, GFP_ATOMIC); | |
| 802 | 802 | if (!it) { | |
| 803 | 803 | rc = -ENOMEM; | |
| 804 | 804 | goto err_free_it; | |
| 805 | 805 | } | |
| 806 | 806 | ||
| 807 | - | it->it_name = kstrdup(t->name, GFP_KERNEL); | |
| 807 | + | it->it_name = kstrdup(t->name, GFP_ATOMIC); | |
| 808 | 808 | if (!it->it_name) { | |
| 809 | 809 | kfree(it); | |
| 810 | 810 | rc = -ENOMEM; | |
modified fs/smb/client/dir.c
| @@ -199,7 +199,7 @@ static int __cifs_do_create(struct inode *dir, struct dentry *direntry, | |||
| 199 | 199 | struct tcon_link *tlink, unsigned int oflags, | |
| 200 | 200 | umode_t mode, __u32 *oplock, struct cifs_fid *fid, | |
| 201 | 201 | struct cifs_open_info_data *buf, | |
| 202 | - | struct inode **inode, bool *opened) | |
| 202 | + | struct inode **inode) | |
| 203 | 203 | { | |
| 204 | 204 | int rc = -ENOENT; | |
| 205 | 205 | int create_options = CREATE_NOT_DIR; | |
| @@ -216,7 +216,6 @@ static int __cifs_do_create(struct inode *dir, struct dentry *direntry, | |||
| 216 | 216 | __le32 lease_flags = 0; | |
| 217 | 217 | ||
| 218 | 218 | *inode = NULL; | |
| 219 | - | *opened = false; | |
| 220 | 219 | *oplock = 0; | |
| 221 | 220 | if (tcon->ses->server->oplocks) | |
| 222 | 221 | *oplock = REQ_OPLOCK; | |
| @@ -233,7 +232,6 @@ static int __cifs_do_create(struct inode *dir, struct dentry *direntry, | |||
| 233 | 232 | oflags, oplock, &fid->netfid, xid); | |
| 234 | 233 | switch (rc) { | |
| 235 | 234 | case 0: | |
| 236 | - | *opened = true; | |
| 237 | 235 | if (newinode == NULL) { | |
| 238 | 236 | /* query inode info */ | |
| 239 | 237 | goto cifs_create_get_file_info; | |
| @@ -255,9 +253,11 @@ static int __cifs_do_create(struct inode *dir, struct dentry *direntry, | |||
| 255 | 253 | /* | |
| 256 | 254 | * The server may allow us to open things like | |
| 257 | 255 | * FIFOs, but the client isn't set up to deal | |
| 258 | - | * with that. Keep the handle until the caller | |
| 259 | - | * can finish the lookup. | |
| 256 | + | * with that. If it's not a regular file, just | |
| 257 | + | * close it and proceed as if it were a normal | |
| 258 | + | * lookup. | |
| 260 | 259 | */ | |
| 260 | + | CIFSSMBClose(xid, tcon, fid->netfid); | |
| 261 | 261 | goto cifs_create_get_file_info; | |
| 262 | 262 | } | |
| 263 | 263 | /* success, no need to query */ | |
| @@ -384,7 +384,6 @@ retry_open: | |||
| 384 | 384 | } | |
| 385 | 385 | return rc; | |
| 386 | 386 | } | |
| 387 | - | *opened = true; | |
| 388 | 387 | if (rdwr_for_fscache == 2) | |
| 389 | 388 | cifs_invalidate_cache(dir, FSCACHE_INVAL_DIO_WRITE); | |
| 390 | 389 | ||
| @@ -476,7 +475,7 @@ cifs_create_set_dentry: | |||
| 476 | 475 | return rc; | |
| 477 | 476 | ||
| 478 | 477 | out_err: | |
| 479 | - | if (*opened && server->ops->close) | |
| 478 | + | if (server->ops->close) | |
| 480 | 479 | server->ops->close(xid, tcon, fid); | |
| 481 | 480 | if (newinode) | |
| 482 | 481 | iput(newinode); | |
| @@ -488,7 +487,7 @@ static int cifs_do_create(struct inode *dir, struct dentry *direntry, | |||
| 488 | 487 | unsigned int oflags, umode_t mode, | |
| 489 | 488 | __u32 *oplock, struct cifs_fid *fid, | |
| 490 | 489 | struct cifs_open_info_data *buf, | |
| 491 | - | struct inode **inode, bool *opened) | |
| 490 | + | struct inode **inode) | |
| 492 | 491 | { | |
| 493 | 492 | void *page = alloc_dentry_path(); | |
| 494 | 493 | const char *full_path; | |
| @@ -497,11 +496,10 @@ static int cifs_do_create(struct inode *dir, struct dentry *direntry, | |||
| 497 | 496 | full_path = build_path_from_dentry(direntry, page); | |
| 498 | 497 | if (IS_ERR(full_path)) { | |
| 499 | 498 | rc = PTR_ERR(full_path); | |
| 500 | - | *opened = false; | |
| 501 | 499 | } else { | |
| 502 | 500 | rc = __cifs_do_create(dir, direntry, full_path, xid, | |
| 503 | 501 | tlink, oflags, mode, oplock, | |
| 504 | - | fid, buf, inode, opened); | |
| 502 | + | fid, buf, inode); | |
| 505 | 503 | } | |
| 506 | 504 | free_dentry_path(page); | |
| 507 | 505 | return rc; | |
| @@ -531,8 +529,6 @@ int cifs_atomic_open(struct inode *dir, struct dentry *direntry, | |||
| 531 | 529 | struct inode *inode; | |
| 532 | 530 | unsigned int xid; | |
| 533 | 531 | __u32 oplock; | |
| 534 | - | bool is_regular; | |
| 535 | - | bool opened; | |
| 536 | 532 | int rc; | |
| 537 | 533 | ||
| 538 | 534 | if (unlikely(cifs_forced_shutdown(cifs_sb))) | |
| @@ -585,26 +581,12 @@ int cifs_atomic_open(struct inode *dir, struct dentry *direntry, | |||
| 585 | 581 | cifs_add_pending_open(&fid, tlink, &open); | |
| 586 | 582 | ||
| 587 | 583 | rc = cifs_do_create(dir, direntry, xid, tlink, oflags, mode, | |
| 588 | - | &oplock, &fid, &buf, &inode, &opened); | |
| 584 | + | &oplock, &fid, &buf, &inode); | |
| 589 | 585 | if (rc) { | |
| 590 | 586 | cifs_del_pending_open(&open); | |
| 591 | 587 | goto out; | |
| 592 | 588 | } | |
| 593 | 589 | ||
| 594 | - | is_regular = S_ISREG(inode->i_mode); | |
| 595 | - | if (!is_regular || !opened) { | |
| 596 | - | if (opened && server->ops->close) | |
| 597 | - | server->ops->close(xid, tcon, &fid); | |
| 598 | - | cifs_del_pending_open(&open); | |
| 599 | - | if (S_ISLNK(inode->i_mode) && | |
| 600 | - | (oflags & (O_NOFOLLOW | __O_REGULAR)) == | |
| 601 | - | (O_NOFOLLOW | __O_REGULAR) && !(oflags & O_EXCL)) { | |
| 602 | - | iput(inode); | |
| 603 | - | rc = -ELOOP; | |
| 604 | - | goto out; | |
| 605 | - | } | |
| 606 | - | } | |
| 607 | - | ||
| 608 | 590 | if (d_in_lookup(direntry)) { | |
| 609 | 591 | alias = d_splice_alias(inode, direntry); | |
| 610 | 592 | if (!IS_ERR_OR_NULL(alias)) | |
| @@ -613,15 +595,9 @@ int cifs_atomic_open(struct inode *dir, struct dentry *direntry, | |||
| 613 | 595 | d_instantiate(direntry, inode); | |
| 614 | 596 | } | |
| 615 | 597 | ||
| 616 | - | if (is_regular && opened && | |
| 617 | - | (oflags & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL)) | |
| 598 | + | if ((oflags & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL)) | |
| 618 | 599 | file->f_mode |= FMODE_CREATED; | |
| 619 | 600 | ||
| 620 | - | if (!is_regular || !opened) { | |
| 621 | - | rc = finish_no_open(file, NULL); | |
| 622 | - | goto out; | |
| 623 | - | } | |
| 624 | - | ||
| 625 | 601 | rc = finish_open(file, direntry, generic_file_open); | |
| 626 | 602 | if (rc) { | |
| 627 | 603 | if (server->ops->close) | |
| @@ -684,7 +660,6 @@ int cifs_create(struct mnt_idmap *idmap, struct inode *dir, | |||
| 684 | 660 | struct inode *inode; | |
| 685 | 661 | struct cifs_fid fid; | |
| 686 | 662 | __u32 oplock; | |
| 687 | - | bool opened; | |
| 688 | 663 | struct cifs_open_info_data buf = {}; | |
| 689 | 664 | ||
| 690 | 665 | cifs_dbg(FYI, "cifs_create parent inode = 0x%p name is: %pd and dentry = 0x%p\n", | |
| @@ -707,10 +682,10 @@ int cifs_create(struct mnt_idmap *idmap, struct inode *dir, | |||
| 707 | 682 | server->ops->new_lease_key(&fid); | |
| 708 | 683 | ||
| 709 | 684 | rc = cifs_do_create(dir, direntry, xid, tlink, oflags, | |
| 710 | - | mode, &oplock, &fid, &buf, &inode, &opened); | |
| 685 | + | mode, &oplock, &fid, &buf, &inode); | |
| 711 | 686 | if (!rc) { | |
| 712 | 687 | d_instantiate(direntry, inode); | |
| 713 | - | if (opened && server->ops->close) | |
| 688 | + | if (server->ops->close) | |
| 714 | 689 | server->ops->close(xid, tcon, &fid); | |
| 715 | 690 | } | |
| 716 | 691 | ||
| @@ -1103,7 +1078,6 @@ int cifs_tmpfile(struct mnt_idmap *idmap, struct inode *dir, | |||
| 1103 | 1078 | struct inode *inode; | |
| 1104 | 1079 | unsigned int xid; | |
| 1105 | 1080 | __u32 oplock; | |
| 1106 | - | bool opened; | |
| 1107 | 1081 | int namelen; | |
| 1108 | 1082 | int rc; | |
| 1109 | 1083 | ||
| @@ -1142,7 +1116,7 @@ int cifs_tmpfile(struct mnt_idmap *idmap, struct inode *dir, | |||
| 1142 | 1116 | namelen = scnprintf(name, namesize, CIFS_TMPNAME_PREFIX "%x", | |
| 1143 | 1117 | atomic_inc_return(&cifs_tmpcounter)); | |
| 1144 | 1118 | rc = __cifs_do_create(dir, dentry, path, xid, tlink, oflags, | |
| 1145 | - | mode, &oplock, &fid, NULL, &inode, &opened); | |
| 1119 | + | mode, &oplock, &fid, NULL, &inode); | |
| 1146 | 1120 | if (!rc) { | |
| 1147 | 1121 | rc = d_mark_tmpfile_name(file, &QSTR_LEN(name, namelen)); | |
| 1148 | 1122 | if (rc) { | |
modified fs/smb/client/file.c
| @@ -3354,8 +3354,8 @@ void cifs_oplock_break(struct work_struct *work) | |||
| 3354 | 3354 | wait_on_bit(&cinode->flags, CIFS_INODE_PENDING_WRITERS, | |
| 3355 | 3355 | TASK_UNINTERRUPTIBLE); | |
| 3356 | 3356 | ||
| 3357 | - | tlink = cifs_get_tlink(cfile->tlink); | |
| 3358 | - | if (IS_ERR_OR_NULL(tlink)) { | |
| 3357 | + | tlink = cifs_sb_tlink(cifs_sb); | |
| 3358 | + | if (IS_ERR(tlink)) { | |
| 3359 | 3359 | /* drop the reference taken when the break was queued */ | |
| 3360 | 3360 | _cifsFileInfo_put(cfile, false /* do not wait for ourself */, false); | |
| 3361 | 3361 | goto out; | |
modified fs/smb/client/misc.c
| @@ -788,11 +788,7 @@ parse_dfs_referrals(struct get_dfs_referral_rsp *rsp, u32 rsp_size, | |||
| 788 | 788 | node->ref_flag = le16_to_cpu(ref->ReferralEntryFlags); | |
| 789 | 789 | ||
| 790 | 790 | /* copy DfsPath */ | |
| 791 | - | if (le16_to_cpu(ref->DfsPathOffset) < sizeof(*ref) || | |
| 792 | - | le16_to_cpu(ref->DfsPathOffset) > data_end - (char *)ref) { | |
| 793 | - | cifs_dbg(VFS, "%s: DfsPathOffset %u out of range [%zu, %td]\n", | |
| 794 | - | __func__, le16_to_cpu(ref->DfsPathOffset), | |
| 795 | - | sizeof(*ref), data_end - (char *)ref); | |
| 791 | + | if (le16_to_cpu(ref->DfsPathOffset) > data_end - (char *)ref) { | |
| 796 | 792 | rc = -EINVAL; | |
| 797 | 793 | goto parse_DFS_referrals_exit; | |
| 798 | 794 | } | |
| @@ -806,11 +802,7 @@ parse_dfs_referrals(struct get_dfs_referral_rsp *rsp, u32 rsp_size, | |||
| 806 | 802 | } | |
| 807 | 803 | ||
| 808 | 804 | /* copy link target UNC */ | |
| 809 | - | if (le16_to_cpu(ref->NetworkAddressOffset) < sizeof(*ref) || | |
| 810 | - | le16_to_cpu(ref->NetworkAddressOffset) > data_end - (char *)ref) { | |
| 811 | - | cifs_dbg(VFS, "%s: NetworkAddressOffset %u out of range [%zu, %td]\n", | |
| 812 | - | __func__, le16_to_cpu(ref->NetworkAddressOffset), | |
| 813 | - | sizeof(*ref), data_end - (char *)ref); | |
| 805 | + | if (le16_to_cpu(ref->NetworkAddressOffset) > data_end - (char *)ref) { | |
| 814 | 806 | rc = -EINVAL; | |
| 815 | 807 | goto parse_DFS_referrals_exit; | |
| 816 | 808 | } | |
modified fs/smb/client/reparse.c
| @@ -3,7 +3,6 @@ | |||
| 3 | 3 | * Copyright (c) 2024 Paulo Alcantara <pc@manguebit.com> | |
| 4 | 4 | */ | |
| 5 | 5 | ||
| 6 | - | #include <linux/ctype.h> | |
| 7 | 6 | #include <linux/fs.h> | |
| 8 | 7 | #include <linux/stat.h> | |
| 9 | 8 | #include <linux/slab.h> | |
| @@ -160,24 +159,15 @@ static int create_native_symlink(const unsigned int xid, struct inode *inode, | |||
| 160 | 159 | convert_delimiter(sym, sep); | |
| 161 | 160 | ||
| 162 | 161 | /* | |
| 163 | - | * Absolute NT symlinks must retain the leading backslash, "\\??\\" | |
| 164 | - | * prefix and drive-letter colon. cifs_convert_path_to_utf16() strips | |
| 165 | - | * the leading backslash and maps '?' and ':', so temporarily mask | |
| 166 | - | * these characters with '_' and restore them after conversion. | |
| 167 | - | * | |
| 168 | - | * When symlinkroot is unset, sym comes directly from the caller. | |
| 169 | - | * Validate the complete "\\??\\X:" prefix before using fixed offsets | |
| 170 | - | * or subtracting the NT prefix length below. Require an ASCII drive | |
| 171 | - | * letter so the prefix occupies six characters in UTF-16 too. | |
| 162 | + | * For absolute NT symlinks it is required to pass also leading | |
| 163 | + | * backslash and to not mangle NT object prefix "\\??\\" and not to | |
| 164 | + | * mangle colon in drive letter. But cifs_convert_path_to_utf16() | |
| 165 | + | * removes leading backslash and replaces '?' and ':'. So temporary | |
| 166 | + | * mask these characters in NT object prefix by '_' and then change | |
| 167 | + | * them back. | |
| 172 | 168 | */ | |
| 173 | - | if (!(sbflags & CIFS_MOUNT_POSIX_PATHS) && symname[0] == '/') { | |
| 174 | - | if (!strstarts(sym, "\\??\\") || !isascii(sym[4]) || | |
| 175 | - | !isalpha(sym[4]) || sym[5] != ':') { | |
| 176 | - | rc = -EINVAL; | |
| 177 | - | goto out; | |
| 178 | - | } | |
| 169 | + | if (!(sbflags & CIFS_MOUNT_POSIX_PATHS) && symname[0] == '/') | |
| 179 | 170 | sym[0] = sym[1] = sym[2] = sym[5] = '_'; | |
| 180 | - | } | |
| 181 | 171 | ||
| 182 | 172 | /* | |
| 183 | 173 | * On a POSIX paths mount the symlink target is stored verbatim, so | |
| @@ -1149,30 +1139,29 @@ static bool wsl_to_fattr(struct cifs_open_info_data *data, | |||
| 1149 | 1139 | u32 tag, struct cifs_fattr *fattr) | |
| 1150 | 1140 | { | |
| 1151 | 1141 | unsigned int sbflags = cifs_sb_flags(cifs_sb); | |
| 1152 | - | kuid_t uid = cifs_sb->ctx->linux_uid; | |
| 1153 | - | kgid_t gid = cifs_sb->ctx->linux_gid; | |
| 1154 | 1142 | struct smb2_file_full_ea_info *ea; | |
| 1155 | 1143 | bool have_xattr_dev = false; | |
| 1156 | - | dev_t rdev = 0; | |
| 1157 | - | umode_t mode; | |
| 1158 | 1144 | u32 next = 0; | |
| 1159 | 1145 | ||
| 1160 | - | mode = fattr->cf_mode & ~S_IFMT; | |
| 1146 | + | fattr->cf_uid = cifs_sb->ctx->linux_uid; | |
| 1147 | + | fattr->cf_gid = cifs_sb->ctx->linux_gid; | |
| 1148 | + | ||
| 1149 | + | fattr->cf_mode &= ~S_IFMT; | |
| 1161 | 1150 | switch (tag) { | |
| 1162 | 1151 | case IO_REPARSE_TAG_LX_SYMLINK: | |
| 1163 | - | mode |= S_IFLNK; | |
| 1152 | + | fattr->cf_mode |= S_IFLNK; | |
| 1164 | 1153 | break; | |
| 1165 | 1154 | case IO_REPARSE_TAG_LX_FIFO: | |
| 1166 | - | mode |= S_IFIFO; | |
| 1155 | + | fattr->cf_mode |= S_IFIFO; | |
| 1167 | 1156 | break; | |
| 1168 | 1157 | case IO_REPARSE_TAG_AF_UNIX: | |
| 1169 | - | mode |= S_IFSOCK; | |
| 1158 | + | fattr->cf_mode |= S_IFSOCK; | |
| 1170 | 1159 | break; | |
| 1171 | 1160 | case IO_REPARSE_TAG_LX_CHR: | |
| 1172 | - | mode |= S_IFCHR; | |
| 1161 | + | fattr->cf_mode |= S_IFCHR; | |
| 1173 | 1162 | break; | |
| 1174 | 1163 | case IO_REPARSE_TAG_LX_BLK: | |
| 1175 | - | mode |= S_IFBLK; | |
| 1164 | + | fattr->cf_mode |= S_IFBLK; | |
| 1176 | 1165 | break; | |
| 1177 | 1166 | } | |
| 1178 | 1167 | ||
| @@ -1196,29 +1185,26 @@ static bool wsl_to_fattr(struct cifs_open_info_data *data, | |||
| 1196 | 1185 | ||
| 1197 | 1186 | if (!strncmp(name, SMB2_WSL_XATTR_UID, nlen)) { | |
| 1198 | 1187 | if (!(sbflags & CIFS_MOUNT_OVERR_UID)) | |
| 1199 | - | uid = wsl_make_kuid(cifs_sb, v); | |
| 1188 | + | fattr->cf_uid = wsl_make_kuid(cifs_sb, v); | |
| 1200 | 1189 | } else if (!strncmp(name, SMB2_WSL_XATTR_GID, nlen)) { | |
| 1201 | 1190 | if (!(sbflags & CIFS_MOUNT_OVERR_GID)) | |
| 1202 | - | gid = wsl_make_kgid(cifs_sb, v); | |
| 1191 | + | fattr->cf_gid = wsl_make_kgid(cifs_sb, v); | |
| 1203 | 1192 | } else if (!strncmp(name, SMB2_WSL_XATTR_MODE, nlen)) { | |
| 1204 | 1193 | /* File type in reparse point tag and in xattr mode must match. */ | |
| 1205 | - | if (S_DT(mode) != S_DT(get_unaligned_le32(v))) | |
| 1194 | + | if (S_DT(fattr->cf_mode) != S_DT(le32_to_cpu(*(__le32 *)v))) | |
| 1206 | 1195 | return false; | |
| 1207 | - | mode = get_unaligned_le32(v); | |
| 1196 | + | fattr->cf_mode = (umode_t)le32_to_cpu(*(__le32 *)v); | |
| 1208 | 1197 | } else if (!strncmp(name, SMB2_WSL_XATTR_DEV, nlen)) { | |
| 1209 | - | rdev = reparse_mkdev(v); | |
| 1198 | + | fattr->cf_rdev = reparse_mkdev(v); | |
| 1210 | 1199 | have_xattr_dev = true; | |
| 1211 | 1200 | } | |
| 1212 | 1201 | } while (next); | |
| 1213 | 1202 | out: | |
| 1203 | + | ||
| 1214 | 1204 | /* Major and minor numbers for char and block devices are mandatory. */ | |
| 1215 | 1205 | if (!have_xattr_dev && (tag == IO_REPARSE_TAG_LX_CHR || tag == IO_REPARSE_TAG_LX_BLK)) | |
| 1216 | 1206 | return false; | |
| 1217 | 1207 | ||
| 1218 | - | fattr->cf_uid = uid; | |
| 1219 | - | fattr->cf_gid = gid; | |
| 1220 | - | fattr->cf_mode = mode; | |
| 1221 | - | fattr->cf_rdev = rdev; | |
| 1222 | 1208 | return true; | |
| 1223 | 1209 | } | |
| 1224 | 1210 | ||
modified fs/smb/client/reparse.h
| @@ -9,7 +9,6 @@ | |||
| 9 | 9 | #include <linux/fs.h> | |
| 10 | 10 | #include <linux/stat.h> | |
| 11 | 11 | #include <linux/uidgid.h> | |
| 12 | - | #include <linux/unaligned.h> | |
| 13 | 12 | #include "fs_context.h" | |
| 14 | 13 | #include "cifsglob.h" | |
| 15 | 14 | #include "../common/smbfsctl.h" | |
| @@ -24,7 +23,7 @@ | |||
| 24 | 23 | ||
| 25 | 24 | static inline dev_t reparse_mkdev(void *ptr) | |
| 26 | 25 | { | |
| 27 | - | u64 v = get_unaligned_le64(ptr); | |
| 26 | + | u64 v = le64_to_cpu(*(__le64 *)ptr); | |
| 28 | 27 | ||
| 29 | 28 | return MKDEV(v & 0xffffffff, v >> 32); | |
| 30 | 29 | } | |
| @@ -32,7 +31,7 @@ static inline dev_t reparse_mkdev(void *ptr) | |||
| 32 | 31 | static inline kuid_t wsl_make_kuid(struct cifs_sb_info *cifs_sb, | |
| 33 | 32 | void *ptr) | |
| 34 | 33 | { | |
| 35 | - | u32 uid = get_unaligned_le32(ptr); | |
| 34 | + | u32 uid = le32_to_cpu(*(__le32 *)ptr); | |
| 36 | 35 | ||
| 37 | 36 | if (cifs_sb_flags(cifs_sb) & CIFS_MOUNT_OVERR_UID) | |
| 38 | 37 | return cifs_sb->ctx->linux_uid; | |
| @@ -42,7 +41,7 @@ static inline kuid_t wsl_make_kuid(struct cifs_sb_info *cifs_sb, | |||
| 42 | 41 | static inline kgid_t wsl_make_kgid(struct cifs_sb_info *cifs_sb, | |
| 43 | 42 | void *ptr) | |
| 44 | 43 | { | |
| 45 | - | u32 gid = get_unaligned_le32(ptr); | |
| 44 | + | u32 gid = le32_to_cpu(*(__le32 *)ptr); | |
| 46 | 45 | ||
| 47 | 46 | if (cifs_sb_flags(cifs_sb) & CIFS_MOUNT_OVERR_GID) | |
| 48 | 47 | return cifs_sb->ctx->linux_gid; | |
modified fs/smb/client/sess.c
| @@ -149,9 +149,9 @@ int cifs_try_adding_channels(struct cifs_ses *ses) | |||
| 149 | 149 | int old_chan_count, new_chan_count; | |
| 150 | 150 | int left; | |
| 151 | 151 | int rc = 0; | |
| 152 | - | int tries = 0, attempts; | |
| 152 | + | int tries = 0; | |
| 153 | 153 | size_t iface_weight = 0, iface_min_speed = 0; | |
| 154 | - | struct cifs_server_iface *iface = NULL, *candidate = NULL; | |
| 154 | + | struct cifs_server_iface *iface = NULL, *niface = NULL; | |
| 155 | 155 | struct cifs_server_iface *last_iface = NULL; | |
| 156 | 156 | ||
| 157 | 157 | spin_lock(&ses->chan_lock); | |
| @@ -197,89 +197,67 @@ int cifs_try_adding_channels(struct cifs_ses *ses) | |||
| 197 | 197 | break; | |
| 198 | 198 | } | |
| 199 | 199 | ||
| 200 | + | if (!iface) | |
| 201 | + | iface = list_first_entry(&ses->iface_list, struct cifs_server_iface, | |
| 202 | + | iface_head); | |
| 200 | 203 | last_iface = list_last_entry(&ses->iface_list, struct cifs_server_iface, | |
| 201 | 204 | iface_head); | |
| 202 | 205 | iface_min_speed = last_iface->speed; | |
| 203 | - | spin_unlock(&ses->iface_lock); | |
| 204 | 206 | ||
| 205 | - | attempts = 0; | |
| 206 | - | while (left > 0) { | |
| 207 | - | spin_lock(&ses->iface_lock); | |
| 207 | + | list_for_each_entry_safe_from(iface, niface, &ses->iface_list, | |
| 208 | + | iface_head) { | |
| 209 | + | /* do not mix rdma and non-rdma interfaces */ | |
| 210 | + | if (iface->rdma_capable != ses->server->rdma) | |
| 211 | + | continue; | |
| 208 | 212 | ||
| 209 | - | /* | |
| 210 | - | * iface_lock must be dropped while opening a channel, | |
| 211 | - | * and a concurrent interface refresh may remove and | |
| 212 | - | * free entries during that window, so no list entry | |
| 213 | - | * may be kept across it without a reference. Scan | |
| 214 | - | * the list from the beginning each time and only pass | |
| 215 | - | * a referenced candidate to cifs_ses_add_channel(); | |
| 216 | - | * weight_fulfilled tracks the progress so that no | |
| 217 | - | * iface is selected beyond its weight. | |
| 218 | - | */ | |
| 219 | - | candidate = NULL; | |
| 220 | - | list_for_each_entry(iface, &ses->iface_list, iface_head) { | |
| 221 | - | /* do not mix rdma and non-rdma interfaces */ | |
| 222 | - | if (iface->rdma_capable != ses->server->rdma) | |
| 223 | - | continue; | |
| 224 | - | ||
| 225 | - | /* skip ifaces that are unusable */ | |
| 226 | - | if (!iface->is_active || | |
| 227 | - | (is_ses_using_iface(ses, iface) && | |
| 228 | - | !iface->rss_capable)) | |
| 229 | - | continue; | |
| 230 | - | ||
| 231 | - | /* check if we already allocated enough channels */ | |
| 232 | - | iface_weight = iface->speed / iface_min_speed; | |
| 233 | - | ||
| 234 | - | if (iface->weight_fulfilled >= iface_weight) | |
| 235 | - | continue; | |
| 236 | - | ||
| 237 | - | /* take ref before unlock */ | |
| 238 | - | kref_get(&iface->refcount); | |
| 239 | - | candidate = iface; | |
| 240 | - | break; | |
| 241 | - | } | |
| 213 | + | /* skip ifaces that are unusable */ | |
| 214 | + | if (!iface->is_active || | |
| 215 | + | (is_ses_using_iface(ses, iface) && | |
| 216 | + | !iface->rss_capable)) | |
| 217 | + | continue; | |
| 242 | 218 | ||
| 243 | - | if (!candidate) { | |
| 244 | - | /* no usable iface. reset weight_fulfilled and start over */ | |
| 245 | - | list_for_each_entry(iface, &ses->iface_list, iface_head) | |
| 246 | - | iface->weight_fulfilled = 0; | |
| 247 | - | spin_unlock(&ses->iface_lock); | |
| 248 | - | break; | |
| 249 | - | } | |
| 219 | + | /* check if we already allocated enough channels */ | |
| 220 | + | iface_weight = iface->speed / iface_min_speed; | |
| 250 | 221 | ||
| 251 | - | attempts++; | |
| 252 | - | if (attempts > 3 * ses->chan_max) { | |
| 253 | - | kref_put(&candidate->refcount, release_iface); | |
| 254 | - | spin_unlock(&ses->iface_lock); | |
| 255 | - | break; | |
| 256 | - | } | |
| 222 | + | if (iface->weight_fulfilled >= iface_weight) | |
| 223 | + | continue; | |
| 224 | + | ||
| 225 | + | /* take ref before unlock */ | |
| 226 | + | kref_get(&iface->refcount); | |
| 257 | 227 | ||
| 258 | 228 | spin_unlock(&ses->iface_lock); | |
| 259 | - | rc = cifs_ses_add_channel(ses, candidate); | |
| 229 | + | rc = cifs_ses_add_channel(ses, iface); | |
| 260 | 230 | spin_lock(&ses->iface_lock); | |
| 261 | 231 | ||
| 262 | 232 | if (rc) { | |
| 263 | 233 | cifs_dbg(VFS, "failed to open extra channel on iface:%pIS rc=%d\n", | |
| 264 | - | &candidate->sockaddr, | |
| 234 | + | &iface->sockaddr, | |
| 265 | 235 | rc); | |
| 266 | 236 | /* failure to add chan should increase weight */ | |
| 267 | - | candidate->weight_fulfilled++; | |
| 268 | - | kref_put(&candidate->refcount, release_iface); | |
| 269 | - | spin_unlock(&ses->iface_lock); | |
| 237 | + | iface->weight_fulfilled++; | |
| 238 | + | kref_put(&iface->refcount, release_iface); | |
| 270 | 239 | continue; | |
| 271 | 240 | } | |
| 272 | 241 | ||
| 273 | - | candidate->num_channels++; | |
| 274 | - | candidate->weight_fulfilled++; | |
| 242 | + | iface->num_channels++; | |
| 243 | + | iface->weight_fulfilled++; | |
| 275 | 244 | cifs_info("successfully opened new channel on iface:%pIS\n", | |
| 276 | - | &candidate->sockaddr); | |
| 277 | - | spin_unlock(&ses->iface_lock); | |
| 278 | - | ||
| 279 | - | left--; | |
| 280 | - | new_chan_count++; | |
| 245 | + | &iface->sockaddr); | |
| 281 | 246 | break; | |
| 282 | 247 | } | |
| 248 | + | ||
| 249 | + | /* reached end of list. reset weight_fulfilled and start over */ | |
| 250 | + | if (list_entry_is_head(iface, &ses->iface_list, iface_head)) { | |
| 251 | + | list_for_each_entry(iface, &ses->iface_list, iface_head) | |
| 252 | + | iface->weight_fulfilled = 0; | |
| 253 | + | spin_unlock(&ses->iface_lock); | |
| 254 | + | iface = NULL; | |
| 255 | + | continue; | |
| 256 | + | } | |
| 257 | + | spin_unlock(&ses->iface_lock); | |
| 258 | + | ||
| 259 | + | left--; | |
| 260 | + | new_chan_count++; | |
| 283 | 261 | } | |
| 284 | 262 | ||
| 285 | 263 | return new_chan_count - old_chan_count; | |
modified fs/smb/client/smb2inode.c
| @@ -77,17 +77,6 @@ static int parse_posix_sids(struct cifs_open_info_data *data, | |||
| 77 | 77 | ||
| 78 | 78 | sidsbuf = (u8 *)qi + le16_to_cpu(qi->OutputBufferOffset) + qi_len; | |
| 79 | 79 | sidsbuf_end = sidsbuf + out_len - qi_len; | |
| 80 | - | if (sidsbuf_end < sidsbuf) { | |
| 81 | - | cifs_dbg(VFS, "%s: server-supplied out_len %u caused pointer wraparound\n", | |
| 82 | - | __func__, out_len); | |
| 83 | - | return -EINVAL; | |
| 84 | - | } | |
| 85 | - | if (sidsbuf_end > (u8 *)rsp_iov->iov_base + rsp_iov->iov_len) { | |
| 86 | - | cifs_dbg(VFS, "%s: server-supplied out_len %u overruns iov by %td bytes\n", | |
| 87 | - | __func__, out_len, | |
| 88 | - | sidsbuf_end - ((u8 *)rsp_iov->iov_base + rsp_iov->iov_len)); | |
| 89 | - | return -EINVAL; | |
| 90 | - | } | |
| 91 | 80 | ||
| 92 | 81 | owner_len = posix_info_sid_size(sidsbuf, sidsbuf_end); | |
| 93 | 82 | if (owner_len == -1) | |
| @@ -598,10 +587,8 @@ finished: | |||
| 598 | 587 | /* smb2_parse_contexts() fills idata->fi.IndexNumber */ | |
| 599 | 588 | rc = smb2_parse_contexts(server, &rsp_iov[0], &oparms->fid->epoch, | |
| 600 | 589 | oparms->fid->lease_key, &oplock, &idata->fi, NULL); | |
| 601 | - | if (rc) { | |
| 590 | + | if (rc) | |
| 602 | 591 | cifs_dbg(VFS, "rc: %d parsing context of compound op\n", rc); | |
| 603 | - | tmp_rc = rc; | |
| 604 | - | } | |
| 605 | 592 | } | |
| 606 | 593 | ||
| 607 | 594 | for (i = 0; i < num_cmds; i++) { | |
| @@ -1123,7 +1110,7 @@ smb2_unlink(const unsigned int xid, struct cifs_tcon *tcon, const char *name, | |||
| 1123 | 1110 | struct kvec close_iov; | |
| 1124 | 1111 | int resp_buftype[2]; | |
| 1125 | 1112 | struct cifs_fid fid; | |
| 1126 | - | int flags = CIFS_CP_CREATE_CLOSE_OP; | |
| 1113 | + | int flags = 0; | |
| 1127 | 1114 | __u8 oplock; | |
| 1128 | 1115 | int rc; | |
| 1129 | 1116 | ||
modified fs/smb/client/smb2misc.c
| @@ -85,36 +85,6 @@ static const __le16 smb2_rsp_struct_sizes[NUMBER_OF_SMB2_COMMANDS] = { | |||
| 85 | 85 | /* SMB2_OPLOCK_BREAK */ cpu_to_le16(24) | |
| 86 | 86 | }; | |
| 87 | 87 | ||
| 88 | - | /* | |
| 89 | - | * Minimum received PDU size for commands whose response carries a | |
| 90 | - | * variable-length data area. A non-zero entry marks the command as | |
| 91 | - | * having one, and gives the length smb2_check_message() requires | |
| 92 | - | * before smb2_get_data_area_len() reads the offset and length fields | |
| 93 | - | * out of the fixed response struct. | |
| 94 | - | */ | |
| 95 | - | static const size_t smb2_min_pdu_len[NUMBER_OF_SMB2_COMMANDS] = { | |
| 96 | - | /* SMB2_NEGOTIATE */ sizeof(struct smb2_negotiate_rsp), | |
| 97 | - | /* SMB2_SESSION_SETUP */ sizeof(struct smb2_sess_setup_rsp), | |
| 98 | - | /* SMB2_LOGOFF */ 0, | |
| 99 | - | /* SMB2_TREE_CONNECT */ 0, | |
| 100 | - | /* SMB2_TREE_DISCONNECT */ 0, | |
| 101 | - | /* SMB2_CREATE */ sizeof(struct smb2_create_rsp), | |
| 102 | - | /* SMB2_CLOSE */ 0, | |
| 103 | - | /* SMB2_FLUSH */ 0, | |
| 104 | - | /* SMB2_READ */ sizeof(struct smb2_read_rsp), | |
| 105 | - | /* SMB2_WRITE */ 0, | |
| 106 | - | /* SMB2_LOCK */ 0, | |
| 107 | - | /* SMB2_IOCTL */ sizeof(struct smb2_ioctl_rsp), | |
| 108 | - | /* SMB2_CANCEL */ 0, | |
| 109 | - | /* SMB2_ECHO */ 0, | |
| 110 | - | /* SMB2_QUERY_DIRECTORY */ sizeof(struct smb2_query_directory_rsp), | |
| 111 | - | /* SMB2_CHANGE_NOTIFY */ sizeof(struct smb2_change_notify_rsp), | |
| 112 | - | /* SMB2_QUERY_INFO */ sizeof(struct smb2_query_info_rsp), | |
| 113 | - | /* SMB2_SET_INFO */ 0, | |
| 114 | - | /* SMB2_OPLOCK_BREAK */ 0, | |
| 115 | - | }; | |
| 116 | - | ||
| 117 | - | #define smb2_has_data_area(cmd) (smb2_min_pdu_len[cmd] != 0) | |
| 118 | 88 | #define SMB311_NEGPROT_BASE_SIZE (sizeof(struct smb2_hdr) + sizeof(struct smb2_negotiate_rsp)) | |
| 119 | 89 | ||
| 120 | 90 | static __u32 get_neg_ctxt_len(struct smb2_hdr *hdr, __u32 len, | |
| @@ -263,16 +233,6 @@ smb2_check_message(char *buf, unsigned int pdu_len, unsigned int len, | |||
| 263 | 233 | } | |
| 264 | 234 | } | |
| 265 | 235 | ||
| 266 | - | if ((shdr->Status == STATUS_SUCCESS || | |
| 267 | - | shdr->Status == STATUS_MORE_PROCESSING_REQUIRED || | |
| 268 | - | pdu->StructureSize2 != SMB2_ERROR_STRUCTURE_SIZE2_LE) && | |
| 269 | - | smb2_has_data_area(command) && | |
| 270 | - | len < smb2_min_pdu_len[command]) { | |
| 271 | - | cifs_server_dbg(VFS, "SMB2 command %d response too short: %u < %zu\n", | |
| 272 | - | command, len, smb2_min_pdu_len[command]); | |
| 273 | - | return 1; | |
| 274 | - | } | |
| 275 | - | ||
| 276 | 236 | have_data = false; | |
| 277 | 237 | data_area_overlap = false; | |
| 278 | 238 | calc_len = __smb2_calc_size(buf, &have_data, &data_area_overlap); | |
| @@ -338,6 +298,33 @@ smb2_check_message(char *buf, unsigned int pdu_len, unsigned int len, | |||
| 338 | 298 | return 0; | |
| 339 | 299 | } | |
| 340 | 300 | ||
| 301 | + | /* | |
| 302 | + | * The size of the variable area depends on the offset and length fields | |
| 303 | + | * located in different fields for various SMB2 responses. SMB2 responses | |
| 304 | + | * with no variable length info, show an offset of zero for the offset field. | |
| 305 | + | */ | |
| 306 | + | static const bool has_smb2_data_area[NUMBER_OF_SMB2_COMMANDS] = { | |
| 307 | + | /* SMB2_NEGOTIATE */ true, | |
| 308 | + | /* SMB2_SESSION_SETUP */ true, | |
| 309 | + | /* SMB2_LOGOFF */ false, | |
| 310 | + | /* SMB2_TREE_CONNECT */ false, | |
| 311 | + | /* SMB2_TREE_DISCONNECT */ false, | |
| 312 | + | /* SMB2_CREATE */ true, | |
| 313 | + | /* SMB2_CLOSE */ false, | |
| 314 | + | /* SMB2_FLUSH */ false, | |
| 315 | + | /* SMB2_READ */ true, | |
| 316 | + | /* SMB2_WRITE */ false, | |
| 317 | + | /* SMB2_LOCK */ false, | |
| 318 | + | /* SMB2_IOCTL */ true, | |
| 319 | + | /* SMB2_CANCEL */ false, /* BB CHECK this not listed in documentation */ | |
| 320 | + | /* SMB2_ECHO */ false, | |
| 321 | + | /* SMB2_QUERY_DIRECTORY */ true, | |
| 322 | + | /* SMB2_CHANGE_NOTIFY */ true, | |
| 323 | + | /* SMB2_QUERY_INFO */ true, | |
| 324 | + | /* SMB2_SET_INFO */ false, | |
| 325 | + | /* SMB2_OPLOCK_BREAK */ false | |
| 326 | + | }; | |
| 327 | + | ||
| 341 | 328 | /* | |
| 342 | 329 | * Returns the pointer to the beginning of the data area. Length of the data | |
| 343 | 330 | * area and the offset to it (from the beginning of the smb are also returned. | |
| @@ -464,7 +451,7 @@ __smb2_calc_size(void *buf, bool *have_data, bool *data_area_overlap) | |||
| 464 | 451 | */ | |
| 465 | 452 | len += le16_to_cpu(pdu->StructureSize2); | |
| 466 | 453 | ||
| 467 | - | if (!smb2_has_data_area(le16_to_cpu(shdr->Command))) | |
| 454 | + | if (has_smb2_data_area[le16_to_cpu(shdr->Command)] == false) | |
| 468 | 455 | goto calc_size_exit; | |
| 469 | 456 | ||
| 470 | 457 | smb2_get_data_area_len(&offset, &data_length, shdr); | |
| @@ -834,8 +821,7 @@ smb2_cancelled_close_fid(struct work_struct *work) | |||
| 834 | 821 | */ | |
| 835 | 822 | static int | |
| 836 | 823 | __smb2_handle_cancelled_cmd(struct cifs_tcon *tcon, __u16 cmd, __u64 mid, | |
| 837 | - | __u64 persistent_fid, __u64 volatile_fid, | |
| 838 | - | bool account_remote_open) | |
| 824 | + | __u64 persistent_fid, __u64 volatile_fid) | |
| 839 | 825 | { | |
| 840 | 826 | struct close_cancelled_open *cancelled; | |
| 841 | 827 | ||
| @@ -849,8 +835,6 @@ __smb2_handle_cancelled_cmd(struct cifs_tcon *tcon, __u16 cmd, __u64 mid, | |||
| 849 | 835 | cancelled->cmd = cmd; | |
| 850 | 836 | cancelled->mid = mid; | |
| 851 | 837 | INIT_WORK(&cancelled->work, smb2_cancelled_close_fid); | |
| 852 | - | if (account_remote_open) | |
| 853 | - | atomic_inc(&tcon->num_remote_opens); | |
| 854 | 838 | WARN_ON(queue_work(cifsiod_wq, &cancelled->work) == false); | |
| 855 | 839 | ||
| 856 | 840 | return 0; | |
| @@ -887,7 +871,7 @@ smb2_handle_cancelled_close(struct cifs_tcon *tcon, __u64 persistent_fid, | |||
| 887 | 871 | spin_unlock(&tcon->tc_lock); | |
| 888 | 872 | ||
| 889 | 873 | rc = __smb2_handle_cancelled_cmd(tcon, SMB2_CLOSE_HE, 0, | |
| 890 | - | persistent_fid, volatile_fid, false); | |
| 874 | + | persistent_fid, volatile_fid); | |
| 891 | 875 | if (rc) | |
| 892 | 876 | cifs_put_tcon(tcon, netfs_trace_tcon_ref_put_cancelled_close); | |
| 893 | 877 | ||
| @@ -915,7 +899,7 @@ smb2_handle_cancelled_mid(struct mid_q_entry *mid, struct TCP_Server_Info *serve | |||
| 915 | 899 | le16_to_cpu(hdr->Command), | |
| 916 | 900 | le64_to_cpu(hdr->MessageId), | |
| 917 | 901 | rsp->PersistentFileId, | |
| 918 | - | rsp->VolatileFileId, true); | |
| 902 | + | rsp->VolatileFileId); | |
| 919 | 903 | if (rc) | |
| 920 | 904 | cifs_put_tcon(tcon, netfs_trace_tcon_ref_put_cancelled_mid); | |
| 921 | 905 | ||
modified fs/smb/client/smb2ops.c
| @@ -785,9 +785,9 @@ next_iface: | |||
| 785 | 785 | break; | |
| 786 | 786 | } | |
| 787 | 787 | /* Validate that Next doesn't point beyond the buffer */ | |
| 788 | - | if (next < sizeof(*p) || next > bytes_left) { | |
| 789 | - | cifs_dbg(VFS, "%s: invalid Next pointer %zu out of range [%zu, %zd]\n", | |
| 790 | - | __func__, next, sizeof(*p), bytes_left); | |
| 788 | + | if (next > bytes_left) { | |
| 789 | + | cifs_dbg(VFS, "%s: invalid Next pointer %zu > %zd\n", | |
| 790 | + | __func__, next, bytes_left); | |
| 791 | 791 | rc = -EINVAL; | |
| 792 | 792 | goto out; | |
| 793 | 793 | } | |
| @@ -1053,9 +1053,8 @@ move_smb2_ea_to_cifs(char *dst, size_t dst_size, | |||
| 1053 | 1053 | char *name, *value; | |
| 1054 | 1054 | size_t buf_size = dst_size; | |
| 1055 | 1055 | size_t name_len, value_len, user_name_len; | |
| 1056 | - | u32 next_off; | |
| 1057 | 1056 | ||
| 1058 | - | while (src_size >= sizeof(*src)) { | |
| 1057 | + | while (src_size > 0) { | |
| 1059 | 1058 | name_len = (size_t)src->ea_name_length; | |
| 1060 | 1059 | value_len = (size_t)le16_to_cpu(src->ea_value_length); | |
| 1061 | 1060 | ||
| @@ -1111,22 +1110,14 @@ move_smb2_ea_to_cifs(char *dst, size_t dst_size, | |||
| 1111 | 1110 | if (!src->next_entry_offset) | |
| 1112 | 1111 | break; | |
| 1113 | 1112 | ||
| 1114 | - | next_off = le32_to_cpu(src->next_entry_offset); | |
| 1115 | - | if (next_off < sizeof(*src) || src_size < next_off) { | |
| 1116 | - | cifs_dbg(FYI, "EA next_entry_offset %u out of range [%zu, %zu]\n", | |
| 1117 | - | next_off, sizeof(*src), src_size); | |
| 1118 | - | rc = smb_EIO2(smb_eio_trace_ea_next_offset, | |
| 1119 | - | next_off, src_size); | |
| 1120 | - | goto out; | |
| 1121 | - | } | |
| 1122 | - | src_size -= next_off; | |
| 1123 | - | src = (void *)((char *)src + next_off); | |
| 1124 | - | if (src_size > 0 && src_size < sizeof(*src)) { | |
| 1125 | - | cifs_dbg(FYI, "EA next_entry_offset %u left truncated entry (%zu bytes)\n", | |
| 1126 | - | next_off, src_size); | |
| 1127 | - | rc = smb_EIO2(smb_eio_trace_ea_next_offset, next_off, src_size); | |
| 1128 | - | goto out; | |
| 1113 | + | if (src_size < le32_to_cpu(src->next_entry_offset)) { | |
| 1114 | + | /* stop before overrun buffer */ | |
| 1115 | + | rc = -ERANGE; | |
| 1116 | + | break; | |
| 1129 | 1117 | } | |
| 1118 | + | src_size -= le32_to_cpu(src->next_entry_offset); | |
| 1119 | + | src = (void *)((char *)src + | |
| 1120 | + | le32_to_cpu(src->next_entry_offset)); | |
| 1130 | 1121 | } | |
| 1131 | 1122 | ||
| 1132 | 1123 | /* didn't find the named attribute */ | |
| @@ -2463,14 +2454,8 @@ smb3_enum_snapshots(const unsigned int xid, struct cifs_tcon *tcon, | |||
| 2463 | 2454 | * and retry the ioctl again with larger array size sufficient | |
| 2464 | 2455 | * to hold all of the snapshot GMT tokens on the second try. | |
| 2465 | 2456 | */ | |
| 2466 | - | if (snapshot_in.snapshot_array_size < GMT_TOKEN_SIZE) { | |
| 2467 | - | if (ret_data_len < sizeof(struct smb_snapshot_array)) { | |
| 2468 | - | rc = -EIO; | |
| 2469 | - | kfree(retbuf); | |
| 2470 | - | return rc; | |
| 2471 | - | } | |
| 2457 | + | if (snapshot_in.snapshot_array_size < GMT_TOKEN_SIZE) | |
| 2472 | 2458 | ret_data_len = sizeof(struct smb_snapshot_array); | |
| 2473 | - | } | |
| 2474 | 2459 | ||
| 2475 | 2460 | /* | |
| 2476 | 2461 | * We return struct SRV_SNAPSHOT_ARRAY, followed by | |
| @@ -4572,37 +4557,25 @@ smb3_create_lease_buf(u8 *lease_key, u8 oplock, u8 *parent_lease_key, __le32 fla | |||
| 4572 | 4557 | static __u8 | |
| 4573 | 4558 | smb2_parse_lease_buf(void *buf, __u16 *epoch, char *lease_key) | |
| 4574 | 4559 | { | |
| 4575 | - | struct create_context *cc = buf; | |
| 4576 | - | struct lease_context lc; | |
| 4560 | + | struct create_lease *lc = (struct create_lease *)buf; | |
| 4577 | 4561 | ||
| 4578 | 4562 | *epoch = 0; /* not used */ | |
| 4579 | - | if (le32_to_cpu(cc->DataLength) != sizeof(lc)) | |
| 4580 | - | return 0; | |
| 4581 | - | ||
| 4582 | - | memcpy(&lc, (u8 *)cc + le16_to_cpu(cc->DataOffset), sizeof(lc)); | |
| 4583 | - | if (lc.LeaseFlags & SMB2_LEASE_FLAG_BREAK_IN_PROGRESS_LE) | |
| 4563 | + | if (lc->lcontext.LeaseFlags & SMB2_LEASE_FLAG_BREAK_IN_PROGRESS_LE) | |
| 4584 | 4564 | return SMB2_OPLOCK_LEVEL_NOCHANGE; | |
| 4585 | - | return le32_to_cpu(lc.LeaseState); | |
| 4565 | + | return le32_to_cpu(lc->lcontext.LeaseState); | |
| 4586 | 4566 | } | |
| 4587 | 4567 | ||
| 4588 | 4568 | static __u8 | |
| 4589 | 4569 | smb3_parse_lease_buf(void *buf, __u16 *epoch, char *lease_key) | |
| 4590 | 4570 | { | |
| 4591 | - | struct create_context *cc = buf; | |
| 4592 | - | struct lease_context_v2 lc; | |
| 4571 | + | struct create_lease_v2 *lc = (struct create_lease_v2 *)buf; | |
| 4593 | 4572 | ||
| 4594 | - | if (le32_to_cpu(cc->DataLength) != sizeof(lc)) { | |
| 4595 | - | *epoch = 0; | |
| 4596 | - | return 0; | |
| 4597 | - | } | |
| 4598 | - | ||
| 4599 | - | memcpy(&lc, (u8 *)cc + le16_to_cpu(cc->DataOffset), sizeof(lc)); | |
| 4600 | - | *epoch = le16_to_cpu(lc.Epoch); | |
| 4601 | - | if (lc.LeaseFlags & SMB2_LEASE_FLAG_BREAK_IN_PROGRESS_LE) | |
| 4573 | + | *epoch = le16_to_cpu(lc->lcontext.Epoch); | |
| 4574 | + | if (lc->lcontext.LeaseFlags & SMB2_LEASE_FLAG_BREAK_IN_PROGRESS_LE) | |
| 4602 | 4575 | return SMB2_OPLOCK_LEVEL_NOCHANGE; | |
| 4603 | 4576 | if (lease_key) | |
| 4604 | - | memcpy(lease_key, lc.LeaseKey, SMB2_LEASE_KEY_SIZE); | |
| 4605 | - | return le32_to_cpu(lc.LeaseState); | |
| 4577 | + | memcpy(lease_key, &lc->lcontext.LeaseKey, SMB2_LEASE_KEY_SIZE); | |
| 4578 | + | return le32_to_cpu(lc->lcontext.LeaseState); | |
| 4606 | 4579 | } | |
| 4607 | 4580 | ||
| 4608 | 4581 | static unsigned int | |
| @@ -5392,13 +5365,11 @@ receive_encrypted_standard(struct TCP_Server_Info *server, | |||
| 5392 | 5365 | length = decrypt_raw_data(server, buf, buf_size, NULL, false); | |
| 5393 | 5366 | if (length) | |
| 5394 | 5367 | return length; | |
| 5395 | - | pdu_length = buf_size; | |
| 5396 | 5368 | ||
| 5397 | 5369 | next_is_large = server->large_buf; | |
| 5398 | 5370 | one_more: | |
| 5399 | 5371 | shdr = (struct smb2_hdr *)buf; | |
| 5400 | 5372 | next_cmd = le32_to_cpu(shdr->NextCommand); | |
| 5401 | - | server->total_read = next_cmd ? next_cmd : pdu_length; | |
| 5402 | 5373 | ||
| 5403 | 5374 | if (*num_mids >= MAX_COMPOUND) { | |
| 5404 | 5375 | cifs_server_dbg(VFS, "too many PDUs in compound\n"); | |
| @@ -5406,15 +5377,8 @@ one_more: | |||
| 5406 | 5377 | } | |
| 5407 | 5378 | ||
| 5408 | 5379 | if (next_cmd) { | |
| 5409 | - | if (next_cmd < MID_HEADER_SIZE(server) || | |
| 5410 | - | next_cmd > pdu_length || | |
| 5411 | - | pdu_length - next_cmd < MID_HEADER_SIZE(server)) { | |
| 5412 | - | unsigned int max_next = pdu_length > (unsigned int)MID_HEADER_SIZE(server) ? | |
| 5413 | - | pdu_length - (unsigned int)MID_HEADER_SIZE(server) : 0; | |
| 5414 | - | cifs_server_dbg(VFS, "invalid NextCommand offset %u out of range [%zu, %u]\n", | |
| 5415 | - | next_cmd, MID_HEADER_SIZE(server), max_next); | |
| 5380 | + | if (WARN_ON_ONCE(next_cmd > pdu_length)) | |
| 5416 | 5381 | return -1; | |
| 5417 | - | } | |
| 5418 | 5382 | if (next_is_large) | |
| 5419 | 5383 | next_buffer = (char *)cifs_buf_get(); | |
| 5420 | 5384 | else | |
| @@ -5450,7 +5414,6 @@ one_more: | |||
| 5450 | 5414 | server->bigbuf = buf = next_buffer; | |
| 5451 | 5415 | else | |
| 5452 | 5416 | server->smallbuf = buf = next_buffer; | |
| 5453 | - | next_buffer = NULL; | |
| 5454 | 5417 | goto one_more; | |
| 5455 | 5418 | } else if (ret != 0) { | |
| 5456 | 5419 | /* | |
modified fs/smb/client/smb2pdu.c
| @@ -189,19 +189,18 @@ cifs_chan_skip_or_disable(struct cifs_ses *ses, | |||
| 189 | 189 | spin_unlock(&ses->chan_lock); | |
| 190 | 190 | ||
| 191 | 191 | /* | |
| 192 | - | * signal the channel and its primary server to | |
| 193 | - | * reconnect before dropping the above reference of | |
| 194 | - | * server by channel, which is done without holding | |
| 195 | - | * chan_lock as cifs_put_tcp_session takes a higher | |
| 196 | - | * lock i.e. cifs_tcp_ses_lock | |
| 192 | + | * the above reference of server by channel | |
| 193 | + | * needs to be dropped without holding chan_lock | |
| 194 | + | * as cifs_put_tcp_session takes a higher lock | |
| 195 | + | * i.e. cifs_tcp_ses_lock | |
| 197 | 196 | */ | |
| 197 | + | cifs_put_tcp_session(server, from_reconnect); | |
| 198 | + | ||
| 198 | 199 | cifs_signal_cifsd_for_reconnect(server, false); | |
| 199 | 200 | ||
| 200 | 201 | /* mark primary server as needing reconnect */ | |
| 201 | 202 | pserver = server->primary_server; | |
| 202 | 203 | cifs_signal_cifsd_for_reconnect(pserver, false); | |
| 203 | - | ||
| 204 | - | cifs_put_tcp_session(server, from_reconnect); | |
| 205 | 204 | skip_terminate: | |
| 206 | 205 | return -EHOSTDOWN; | |
| 207 | 206 | } | |
| @@ -2379,32 +2378,23 @@ create_reconnect_durable_buf(struct cifs_fid *fid) | |||
| 2379 | 2378 | static void | |
| 2380 | 2379 | parse_query_id_ctxt(struct create_context *cc, struct smb2_file_all_info *buf) | |
| 2381 | 2380 | { | |
| 2382 | - | u16 doff = le16_to_cpu(cc->DataOffset); | |
| 2383 | - | u32 dlen = le32_to_cpu(cc->DataLength); | |
| 2384 | - | u8 *beg; | |
| 2381 | + | struct create_disk_id_rsp *pdisk_id = (struct create_disk_id_rsp *)cc; | |
| 2385 | 2382 | ||
| 2386 | - | if (dlen < sizeof(__le64)) | |
| 2387 | - | return; | |
| 2388 | - | ||
| 2389 | - | beg = (u8 *)cc + doff; | |
| 2390 | - | memcpy(&buf->IndexNumber, beg, sizeof(__le64)); | |
| 2391 | - | cifs_dbg(FYI, "parse query id context 0x%llx\n", | |
| 2392 | - | le64_to_cpu(buf->IndexNumber)); | |
| 2383 | + | cifs_dbg(FYI, "parse query id context 0x%llx 0x%llx\n", | |
| 2384 | + | pdisk_id->DiskFileId, pdisk_id->VolumeId); | |
| 2385 | + | buf->IndexNumber = pdisk_id->DiskFileId; | |
| 2393 | 2386 | } | |
| 2394 | 2387 | ||
| 2395 | 2388 | static void | |
| 2396 | 2389 | parse_posix_ctxt(struct create_context *cc, struct smb2_file_all_info *info, | |
| 2397 | 2390 | struct create_posix_rsp *posix) | |
| 2398 | 2391 | { | |
| 2399 | - | u8 *beg = (u8 *)cc + le16_to_cpu(cc->DataOffset); | |
| 2400 | - | u32 dlen = le32_to_cpu(cc->DataLength); | |
| 2401 | - | u8 *end = beg + dlen; | |
| 2402 | 2392 | int sid_len; | |
| 2393 | + | u8 *beg = (u8 *)cc + le16_to_cpu(cc->DataOffset); | |
| 2394 | + | u8 *end = beg + le32_to_cpu(cc->DataLength); | |
| 2403 | 2395 | u8 *sid; | |
| 2404 | 2396 | ||
| 2405 | 2397 | memset(posix, 0, sizeof(*posix)); | |
| 2406 | - | if (dlen < 3 * sizeof(__le32)) | |
| 2407 | - | return; | |
| 2408 | 2398 | ||
| 2409 | 2399 | posix->nlink = get_unaligned_le32(beg); | |
| 2410 | 2400 | posix->reparse_tag = get_unaligned_le32(beg + 4); | |
| @@ -2440,7 +2430,6 @@ int smb2_parse_contexts(struct TCP_Server_Info *server, | |||
| 2440 | 2430 | struct smb2_create_rsp *rsp = rsp_iov->iov_base; | |
| 2441 | 2431 | struct create_context *cc; | |
| 2442 | 2432 | size_t rem, off, len; | |
| 2443 | - | size_t cc_len; | |
| 2444 | 2433 | size_t doff, dlen; | |
| 2445 | 2434 | size_t noff, nlen; | |
| 2446 | 2435 | char *name; | |
| @@ -2463,41 +2452,29 @@ int smb2_parse_contexts(struct TCP_Server_Info *server, | |||
| 2463 | 2452 | buf->IndexNumber = 0; | |
| 2464 | 2453 | ||
| 2465 | 2454 | while (rem >= sizeof(*cc)) { | |
| 2466 | - | off = le32_to_cpu(cc->Next); | |
| 2467 | - | if (off) { | |
| 2468 | - | if ((off & 0x7) || off >= rem || off < sizeof(*cc)) | |
| 2469 | - | return -EINVAL; | |
| 2470 | - | cc_len = off; | |
| 2471 | - | } else { | |
| 2472 | - | cc_len = rem; | |
| 2473 | - | } | |
| 2474 | - | ||
| 2475 | 2455 | doff = le16_to_cpu(cc->DataOffset); | |
| 2476 | 2456 | dlen = le32_to_cpu(cc->DataLength); | |
| 2477 | - | if (doff < sizeof(*cc) || | |
| 2478 | - | check_add_overflow(doff, dlen, &len) || len > cc_len) | |
| 2457 | + | if (check_add_overflow(doff, dlen, &len) || len > rem) | |
| 2479 | 2458 | return -EINVAL; | |
| 2480 | 2459 | ||
| 2481 | 2460 | noff = le16_to_cpu(cc->NameOffset); | |
| 2482 | 2461 | nlen = le16_to_cpu(cc->NameLength); | |
| 2483 | - | if (noff < sizeof(*cc) || | |
| 2484 | - | check_add_overflow(noff, nlen, &len) || len > cc_len || | |
| 2485 | - | (dlen && len > doff)) | |
| 2462 | + | if (noff + nlen > doff) | |
| 2486 | 2463 | return -EINVAL; | |
| 2487 | 2464 | ||
| 2488 | 2465 | name = (char *)cc + noff; | |
| 2489 | 2466 | switch (nlen) { | |
| 2490 | 2467 | case 4: | |
| 2491 | - | if (dlen && !strncmp(name, SMB2_CREATE_REQUEST_LEASE, 4)) { | |
| 2468 | + | if (!strncmp(name, SMB2_CREATE_REQUEST_LEASE, 4)) { | |
| 2492 | 2469 | *oplock = server->ops->parse_lease_buf(cc, epoch, | |
| 2493 | 2470 | lease_key); | |
| 2494 | - | } else if (dlen && buf && | |
| 2471 | + | } else if (buf && | |
| 2495 | 2472 | !strncmp(name, SMB2_CREATE_QUERY_ON_DISK_ID, 4)) { | |
| 2496 | 2473 | parse_query_id_ctxt(cc, buf); | |
| 2497 | 2474 | } | |
| 2498 | 2475 | break; | |
| 2499 | 2476 | case 16: | |
| 2500 | - | if (dlen && posix && !memcmp(name, smb3_create_tag_posix, 16)) | |
| 2477 | + | if (posix && !memcmp(name, smb3_create_tag_posix, 16)) | |
| 2501 | 2478 | parse_posix_ctxt(cc, buf, posix); | |
| 2502 | 2479 | break; | |
| 2503 | 2480 | default: | |
| @@ -2509,18 +2486,13 @@ int smb2_parse_contexts(struct TCP_Server_Info *server, | |||
| 2509 | 2486 | } | |
| 2510 | 2487 | ||
| 2511 | 2488 | off = le32_to_cpu(cc->Next); | |
| 2512 | - | if (!off) { | |
| 2513 | - | rem = 0; | |
| 2489 | + | if (!off) | |
| 2514 | 2490 | break; | |
| 2515 | - | } | |
| 2516 | 2491 | if (check_sub_overflow(rem, off, &rem)) | |
| 2517 | 2492 | return -EINVAL; | |
| 2518 | 2493 | cc = (struct create_context *)((u8 *)cc + off); | |
| 2519 | 2494 | } | |
| 2520 | 2495 | ||
| 2521 | - | if (rem) | |
| 2522 | - | return -EINVAL; | |
| 2523 | - | ||
| 2524 | 2496 | if (rsp->OplockLevel != SMB2_OPLOCK_LEVEL_LEASE) | |
| 2525 | 2497 | *oplock = rsp->OplockLevel; | |
| 2526 | 2498 | ||
| @@ -3416,9 +3388,6 @@ replay_again: | |||
| 3416 | 3388 | ||
| 3417 | 3389 | rc = smb2_parse_contexts(server, &rsp_iov, &oparms->fid->epoch, | |
| 3418 | 3390 | oparms->fid->lease_key, oplock, file_info, posix); | |
| 3419 | - | if (rc) | |
| 3420 | - | SMB2_close(xid, tcon, oparms->fid->persistent_fid, | |
| 3421 | - | oparms->fid->volatile_fid); | |
| 3422 | 3391 | ||
| 3423 | 3392 | trace_smb3_open_done(xid, rsp->PersistentFileId, tcon->tid, ses->Suid, | |
| 3424 | 3393 | oparms->create_options, oparms->desired_access, | |
modified fs/smb/client/smb2pdu.h
| @@ -224,7 +224,8 @@ struct smb2_file_id_extd_directory_info { | |||
| 224 | 224 | extern char smb2_padding[7]; | |
| 225 | 225 | ||
| 226 | 226 | /* | |
| 227 | - | * See POSIX-SMB2 2.1.3.2.1 | |
| 227 | + | * See POSIX-SMB2 2.2.14.2.16 | |
| 228 | + | * Link: https://gitlab.com/samba-team/smb3-posix-spec/-/blob/master/smb3_posix_extensions.md | |
| 228 | 229 | */ | |
| 229 | 230 | struct create_posix_rsp { | |
| 230 | 231 | u32 nlink; | |
| @@ -237,7 +238,6 @@ struct create_posix_rsp { | |||
| 237 | 238 | #define SMB2_QUERY_DIRECTORY_IOV_SIZE 2 | |
| 238 | 239 | ||
| 239 | 240 | /* | |
| 240 | - | * See POSIX-FSCC 2.2.1 | |
| 241 | 241 | * SMB2-only POSIX info level for query dir | |
| 242 | 242 | * | |
| 243 | 243 | * See posix_info_sid_size(), posix_info_extra_size() and | |
| @@ -256,17 +256,13 @@ struct smb2_posix_info { | |||
| 256 | 256 | __le64 Inode; | |
| 257 | 257 | __le32 DeviceId; | |
| 258 | 258 | __le32 Zero; | |
| 259 | - | /* | |
| 260 | - | * Beginning of POSIX Create Context Response | |
| 261 | - | * See POSIX-SMB2 2.1.3.2.1 | |
| 262 | - | */ | |
| 259 | + | /* beginning of POSIX Create Context Response */ | |
| 263 | 260 | __le32 HardLinks; | |
| 264 | 261 | __le32 ReparseTag; | |
| 265 | 262 | __le32 Mode; | |
| 266 | 263 | /* | |
| 267 | 264 | * var sized owner SID | |
| 268 | 265 | * var sized group SID | |
| 269 | - | * End of POSIX Create Context Response | |
| 270 | 266 | * le32 filenamelength | |
| 271 | 267 | * u8 filename[] | |
| 272 | 268 | */ | |
modified fs/smb/client/trace.h
| @@ -27,7 +27,6 @@ | |||
| 27 | 27 | EM(smb_eio_trace_copychunk_overcopy_c, "copychunk_overcopy_c") \ | |
| 28 | 28 | EM(smb_eio_trace_create_rsp_too_small, "create_rsp_too_small") \ | |
| 29 | 29 | EM(smb_eio_trace_dfsref_no_rsp, "dfsref_no_rsp") \ | |
| 30 | - | EM(smb_eio_trace_ea_next_offset, "ea_next_offset") \ | |
| 31 | 30 | EM(smb_eio_trace_ea_overrun, "ea_overrun") \ | |
| 32 | 31 | EM(smb_eio_trace_extract_will_pin, "extract_will_pin") \ | |
| 33 | 32 | EM(smb_eio_trace_forced_shutdown, "forced_shutdown") \ | |
modified fs/smb/client/transport.c
| @@ -805,18 +805,6 @@ cifs_cancelled_callback(struct TCP_Server_Info *server, struct mid_q_entry *mid) | |||
| 805 | 805 | release_mid(server, mid); | |
| 806 | 806 | } | |
| 807 | 807 | ||
| 808 | - | static void | |
| 809 | - | cifs_mark_compound_mids_cancelled(struct mid_q_entry **mid, int count) | |
| 810 | - | { | |
| 811 | - | int i; | |
| 812 | - | ||
| 813 | - | for (i = 0; i < count; i++) { | |
| 814 | - | spin_lock(&mid[i]->mid_lock); | |
| 815 | - | mid[i]->wait_cancelled = true; | |
| 816 | - | spin_unlock(&mid[i]->mid_lock); | |
| 817 | - | } | |
| 818 | - | } | |
| 819 | - | ||
| 820 | 808 | /* | |
| 821 | 809 | * cifs_pick_channel - pick an eligible channel for network operations | |
| 822 | 810 | * | |
| @@ -877,7 +865,6 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses, | |||
| 877 | 865 | int *resp_buf_type, struct kvec *resp_iov) | |
| 878 | 866 | { | |
| 879 | 867 | int i, j, optype, rc = 0; | |
| 880 | - | int num_processed = 0; | |
| 881 | 868 | struct mid_q_entry *mid[MAX_COMPOUND]; | |
| 882 | 869 | bool cancelled_mid[MAX_COMPOUND] = {false}; | |
| 883 | 870 | struct cifs_credits credits[MAX_COMPOUND] = { | |
| @@ -978,10 +965,6 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses, | |||
| 978 | 965 | if (rc < 0) { | |
| 979 | 966 | revert_current_mid(server, num_rqst); | |
| 980 | 967 | server->sequence_number -= 2; | |
| 981 | - | for (i = 0; i < num_rqst; i++) { | |
| 982 | - | delete_mid(server, mid[i]); | |
| 983 | - | cancelled_mid[i] = true; | |
| 984 | - | } | |
| 985 | 968 | } | |
| 986 | 969 | ||
| 987 | 970 | cifs_server_unlock(server); | |
| @@ -1028,14 +1011,6 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses, | |||
| 1028 | 1011 | break; | |
| 1029 | 1012 | } | |
| 1030 | 1013 | if (rc != 0) { | |
| 1031 | - | /* | |
| 1032 | - | * A completed CREATE earlier in the compound chain may have | |
| 1033 | - | * opened a remote handle even though a later wait was | |
| 1034 | - | * interrupted. Mark it cancelled so __release_mid() invokes | |
| 1035 | - | * the existing unmatched-open cleanup. | |
| 1036 | - | */ | |
| 1037 | - | cifs_mark_compound_mids_cancelled(mid, i); | |
| 1038 | - | ||
| 1039 | 1014 | for (; i < num_rqst; i++) { | |
| 1040 | 1015 | cifs_server_dbg(FYI, "Cancelling wait for mid %llu cmd: %d\n", | |
| 1041 | 1016 | mid[i]->mid, le16_to_cpu(mid[i]->command)); | |
| @@ -1058,14 +1033,6 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses, | |||
| 1058 | 1033 | ||
| 1059 | 1034 | rc = cifs_sync_mid_result(mid[i], server); | |
| 1060 | 1035 | if (rc != 0) { | |
| 1061 | - | /* | |
| 1062 | - | * A previous CREATE may have completed before this | |
| 1063 | - | * response failed. Mark it cancelled so its remote | |
| 1064 | - | * handle is closed when the mid is released. | |
| 1065 | - | */ | |
| 1066 | - | cifs_mark_compound_mids_cancelled(mid, i); | |
| 1067 | - | /* Keep their response buffers for cancelled-mid cleanup. */ | |
| 1068 | - | num_processed = 0; | |
| 1069 | 1036 | /* mark this mid as cancelled to not free it below */ | |
| 1070 | 1037 | cancelled_mid[i] = true; | |
| 1071 | 1038 | goto out; | |
| @@ -1075,24 +1042,13 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses, | |||
| 1075 | 1042 | mid[i]->mid_state != MID_RESPONSE_READY) { | |
| 1076 | 1043 | rc = smb_EIO1(smb_eio_trace_rx_mid_unready, mid[i]->mid_state); | |
| 1077 | 1044 | cifs_dbg(FYI, "Bad MID state?\n"); | |
| 1078 | - | cifs_mark_compound_mids_cancelled(mid, i); | |
| 1079 | - | num_processed = 0; | |
| 1080 | 1045 | goto out; | |
| 1081 | 1046 | } | |
| 1082 | 1047 | ||
| 1083 | 1048 | rc = server->ops->check_receive(mid[i], server, | |
| 1084 | 1049 | flags & CIFS_LOG_ERROR); | |
| 1085 | - | num_processed = i + 1; | |
| 1086 | - | } | |
| 1087 | 1050 | ||
| 1088 | - | out: | |
| 1089 | - | /* | |
| 1090 | - | * Delay moving response buffers out of their mids until response | |
| 1091 | - | * synchronization completes. This lets cancelled-mid cleanup inspect | |
| 1092 | - | * an earlier CREATE response if a later MID fails. | |
| 1093 | - | */ | |
| 1094 | - | if (resp_iov) { | |
| 1095 | - | for (i = 0; i < num_processed; i++) { | |
| 1051 | + | if (resp_iov) { | |
| 1096 | 1052 | buf = (char *)mid[i]->resp_buf; | |
| 1097 | 1053 | resp_iov[i].iov_base = buf; | |
| 1098 | 1054 | resp_iov[i].iov_len = mid[i]->resp_buf_size; | |
| @@ -1111,22 +1067,21 @@ out: | |||
| 1111 | 1067 | /* | |
| 1112 | 1068 | * Compounding is never used during session establish. | |
| 1113 | 1069 | */ | |
| 1114 | - | if (num_processed == num_rqst) { | |
| 1115 | - | spin_lock(&ses->ses_lock); | |
| 1116 | - | if ((ses->ses_status == SES_NEW) || (optype & CIFS_NEG_OP) || (optype & CIFS_SESS_OP)) { | |
| 1117 | - | struct kvec iov = { | |
| 1118 | - | .iov_base = resp_iov[0].iov_base, | |
| 1119 | - | .iov_len = resp_iov[0].iov_len | |
| 1120 | - | }; | |
| 1121 | - | spin_unlock(&ses->ses_lock); | |
| 1122 | - | cifs_server_lock(server); | |
| 1123 | - | smb311_update_preauth_hash(ses, server, &iov, 1); | |
| 1124 | - | cifs_server_unlock(server); | |
| 1125 | - | spin_lock(&ses->ses_lock); | |
| 1126 | - | } | |
| 1070 | + | spin_lock(&ses->ses_lock); | |
| 1071 | + | if ((ses->ses_status == SES_NEW) || (optype & CIFS_NEG_OP) || (optype & CIFS_SESS_OP)) { | |
| 1072 | + | struct kvec iov = { | |
| 1073 | + | .iov_base = resp_iov[0].iov_base, | |
| 1074 | + | .iov_len = resp_iov[0].iov_len | |
| 1075 | + | }; | |
| 1127 | 1076 | spin_unlock(&ses->ses_lock); | |
| 1077 | + | cifs_server_lock(server); | |
| 1078 | + | smb311_update_preauth_hash(ses, server, &iov, 1); | |
| 1079 | + | cifs_server_unlock(server); | |
| 1080 | + | spin_lock(&ses->ses_lock); | |
| 1128 | 1081 | } | |
| 1082 | + | spin_unlock(&ses->ses_lock); | |
| 1129 | 1083 | ||
| 1084 | + | out: | |
| 1130 | 1085 | /* | |
| 1131 | 1086 | * This will dequeue all mids. After this it is important that the | |
| 1132 | 1087 | * demultiplex_thread will not process any of these mids any further. | |
modified fs/smb/server/connection.c
| @@ -22,8 +22,6 @@ | |||
| 22 | 22 | static DEFINE_MUTEX(init_lock); | |
| 23 | 23 | ||
| 24 | 24 | static struct ksmbd_conn_ops default_conn_ops; | |
| 25 | - | static struct delayed_work session_expiration_work; | |
| 26 | - | static bool stopping_session_expiration_work; | |
| 27 | 25 | ||
| 28 | 26 | DEFINE_HASHTABLE(conn_list, CONN_HASH_BITS); | |
| 29 | 27 | DECLARE_RWSEM(conn_list_lock); | |
| @@ -160,28 +158,18 @@ static void delete_proc_clients(void) {} | |||
| 160 | 158 | ||
| 161 | 159 | static struct workqueue_struct *ksmbd_conn_wq; | |
| 162 | 160 | ||
| 163 | - | static void ksmbd_session_expiration_worker(struct work_struct *work); | |
| 164 | - | ||
| 165 | 161 | int ksmbd_conn_wq_init(void) | |
| 166 | 162 | { | |
| 167 | 163 | ksmbd_conn_wq = alloc_workqueue("ksmbd-conn-release", | |
| 168 | 164 | WQ_UNBOUND | WQ_MEM_RECLAIM, 0); | |
| 169 | 165 | if (!ksmbd_conn_wq) | |
| 170 | 166 | return -ENOMEM; | |
| 171 | - | ||
| 172 | - | WRITE_ONCE(stopping_session_expiration_work, false); | |
| 173 | - | INIT_DELAYED_WORK(&session_expiration_work, | |
| 174 | - | ksmbd_session_expiration_worker); | |
| 175 | - | queue_delayed_work(ksmbd_conn_wq, &session_expiration_work, | |
| 176 | - | KSMBD_SESSION_EXPIRATION_INTERVAL); | |
| 177 | 167 | return 0; | |
| 178 | 168 | } | |
| 179 | 169 | ||
| 180 | 170 | void ksmbd_conn_wq_destroy(void) | |
| 181 | 171 | { | |
| 182 | 172 | if (ksmbd_conn_wq) { | |
| 183 | - | WRITE_ONCE(stopping_session_expiration_work, true); | |
| 184 | - | cancel_delayed_work_sync(&session_expiration_work); | |
| 185 | 173 | destroy_workqueue(ksmbd_conn_wq); | |
| 186 | 174 | ksmbd_conn_wq = NULL; | |
| 187 | 175 | } | |
| @@ -291,7 +279,6 @@ struct ksmbd_conn *ksmbd_conn_alloc(void) | |||
| 291 | 279 | return NULL; | |
| 292 | 280 | ||
| 293 | 281 | conn->need_neg = true; | |
| 294 | - | conn->creation_time = jiffies; | |
| 295 | 282 | ksmbd_conn_set_new(conn); | |
| 296 | 283 | conn->local_nls = load_nls("utf8"); | |
| 297 | 284 | if (!conn->local_nls) | |
| @@ -601,20 +588,6 @@ bool ksmbd_conn_alive(struct ksmbd_conn *conn) | |||
| 601 | 588 | if (kthread_should_stop()) | |
| 602 | 589 | return false; | |
| 603 | 590 | ||
| 604 | - | /* | |
| 605 | - | * Stale connections that have not completed NEGOTIATE and SESSION_SETUP | |
| 606 | - | * must be disconnected. Do not race a request that is currently | |
| 607 | - | * completing authentication. | |
| 608 | - | */ | |
| 609 | - | if (!atomic_read(&conn->req_running) && | |
| 610 | - | time_after(jiffies, conn->creation_time + | |
| 611 | - | KSMBD_UNAUTHENTICATED_CONN_TIMEOUT) && | |
| 612 | - | (READ_ONCE(conn->need_neg) || | |
| 613 | - | !ksmbd_conn_has_valid_or_expired_session(conn))) { | |
| 614 | - | ksmbd_debug(CONN, "Connection setup timed out\n"); | |
| 615 | - | return false; | |
| 616 | - | } | |
| 617 | - | ||
| 618 | 591 | if (atomic_read(&conn->stats.open_files_count) > 0) | |
| 619 | 592 | return true; | |
| 620 | 593 | ||
| @@ -632,51 +605,6 @@ bool ksmbd_conn_alive(struct ksmbd_conn *conn) | |||
| 632 | 605 | return true; | |
| 633 | 606 | } | |
| 634 | 607 | ||
| 635 | - | static void ksmbd_session_expiration_worker(struct work_struct *work) | |
| 636 | - | { | |
| 637 | - | struct ksmbd_conn *conn, *target; | |
| 638 | - | int bkt; | |
| 639 | - | ||
| 640 | - | if (!ksmbd_server_running()) | |
| 641 | - | goto reschedule; | |
| 642 | - | ||
| 643 | - | ksmbd_expire_sessions(); | |
| 644 | - | ||
| 645 | - | /* | |
| 646 | - | * An old connection without a Valid or Expired session must be | |
| 647 | - | * disconnected. Process one connection at a time without holding | |
| 648 | - | * conn_list_lock across transport shutdown. | |
| 649 | - | */ | |
| 650 | - | again: | |
| 651 | - | target = NULL; | |
| 652 | - | down_read(&conn_list_lock); | |
| 653 | - | hash_for_each(conn_list, bkt, conn, hlist) { | |
| 654 | - | if (ksmbd_conn_exiting(conn) || ksmbd_conn_releasing(conn) || | |
| 655 | - | atomic_read(&conn->req_running) || | |
| 656 | - | time_before_eq(jiffies, conn->creation_time + | |
| 657 | - | KSMBD_UNAUTHENTICATED_CONN_TIMEOUT) || | |
| 658 | - | (!READ_ONCE(conn->need_neg) && | |
| 659 | - | ksmbd_conn_has_valid_or_expired_session(conn))) | |
| 660 | - | continue; | |
| 661 | - | ||
| 662 | - | target = ksmbd_conn_get(conn); | |
| 663 | - | break; | |
| 664 | - | } | |
| 665 | - | up_read(&conn_list_lock); | |
| 666 | - | ||
| 667 | - | if (target) { | |
| 668 | - | ksmbd_debug(CONN, "Connection setup timed out\n"); | |
| 669 | - | ksmbd_conn_abort(target); | |
| 670 | - | ksmbd_conn_put(target); | |
| 671 | - | goto again; | |
| 672 | - | } | |
| 673 | - | ||
| 674 | - | reschedule: | |
| 675 | - | if (!READ_ONCE(stopping_session_expiration_work)) | |
| 676 | - | queue_delayed_work(ksmbd_conn_wq, &session_expiration_work, | |
| 677 | - | KSMBD_SESSION_EXPIRATION_INTERVAL); | |
| 678 | - | } | |
| 679 | - | ||
| 680 | 608 | /* "+2" for BCC field (ByteCount, 2 bytes) */ | |
| 681 | 609 | #define SMB1_MIN_SUPPORTED_PDU_SIZE (sizeof(struct smb_hdr) + 2) | |
| 682 | 610 | #define SMB2_MIN_SUPPORTED_PDU_SIZE (sizeof(struct smb2_pdu)) | |
modified fs/smb/server/connection.h
| @@ -77,7 +77,6 @@ struct ksmbd_conn { | |||
| 77 | 77 | struct rw_semaphore session_lock; | |
| 78 | 78 | /* smb session 1 per user */ | |
| 79 | 79 | struct xarray sessions; | |
| 80 | - | unsigned long creation_time; | |
| 81 | 80 | unsigned long last_active; | |
| 82 | 81 | /* How many request are running currently */ | |
| 83 | 82 | atomic_t req_running; | |
| @@ -193,8 +192,6 @@ struct ksmbd_transport { | |||
| 193 | 192 | ||
| 194 | 193 | #define KSMBD_TCP_RECV_TIMEOUT (7 * HZ) | |
| 195 | 194 | #define KSMBD_TCP_SEND_TIMEOUT (5 * HZ) | |
| 196 | - | #define KSMBD_SESSION_EXPIRATION_INTERVAL (5 * HZ) | |
| 197 | - | #define KSMBD_UNAUTHENTICATED_CONN_TIMEOUT (45 * HZ) | |
| 198 | 195 | #define KSMBD_TCP_PEER_SOCKADDR(c) ((struct sockaddr *)&((c)->peer_addr)) | |
| 199 | 196 | ||
| 200 | 197 | #define CONN_HASH_BITS 12 | |
modified fs/smb/server/mgmt/user_session.c
| @@ -22,7 +22,6 @@ | |||
| 22 | 22 | static DEFINE_IDA(session_ida); | |
| 23 | 23 | ||
| 24 | 24 | #define SESSION_HASH_BITS 12 | |
| 25 | - | #define KSMBD_MAX_PENDING_SESSIONS 1 | |
| 26 | 25 | static DEFINE_HASHTABLE(sessions_table, SESSION_HASH_BITS); | |
| 27 | 26 | static DECLARE_RWSEM(sessions_table_lock); | |
| 28 | 27 | ||
| @@ -433,31 +432,26 @@ struct ksmbd_session *__session_lookup(unsigned long long id) | |||
| 433 | 432 | return NULL; | |
| 434 | 433 | } | |
| 435 | 434 | ||
| 436 | - | static bool ksmbd_too_many_session_setups(struct ksmbd_conn *conn) | |
| 435 | + | static void ksmbd_expire_session(struct ksmbd_conn *conn) | |
| 437 | 436 | { | |
| 438 | 437 | unsigned long id; | |
| 439 | 438 | struct ksmbd_session *sess; | |
| 440 | - | unsigned int pending = 0; | |
| 441 | 439 | ||
| 442 | 440 | down_write(&sessions_table_lock); | |
| 443 | 441 | down_write(&conn->session_lock); | |
| 444 | 442 | xa_for_each(&conn->sessions, id, sess) { | |
| 445 | - | if (READ_ONCE(sess->state) != SMB2_SESSION_IN_PROGRESS) | |
| 446 | - | continue; | |
| 447 | - | ||
| 448 | 443 | if (atomic_read(&sess->refcnt) <= 1 && | |
| 449 | - | time_after(jiffies, sess->last_active + | |
| 450 | - | KSMBD_UNAUTHENTICATED_CONN_TIMEOUT)) { | |
| 444 | + | (sess->state != SMB2_SESSION_VALID || | |
| 445 | + | time_after(jiffies, | |
| 446 | + | sess->last_active + SMB2_SESSION_TIMEOUT))) { | |
| 451 | 447 | xa_erase(&conn->sessions, sess->id); | |
| 452 | 448 | ksmbd_session_remove_from_table(sess); | |
| 453 | 449 | ksmbd_session_destroy(sess); | |
| 454 | 450 | continue; | |
| 455 | 451 | } | |
| 456 | - | pending++; | |
| 457 | 452 | } | |
| 458 | 453 | up_write(&conn->session_lock); | |
| 459 | 454 | up_write(&sessions_table_lock); | |
| 460 | - | return pending >= KSMBD_MAX_PENDING_SESSIONS; | |
| 461 | 455 | } | |
| 462 | 456 | ||
| 463 | 457 | int ksmbd_session_register(struct ksmbd_conn *conn, | |
| @@ -467,12 +461,9 @@ int ksmbd_session_register(struct ksmbd_conn *conn, | |||
| 467 | 461 | ||
| 468 | 462 | sess->dialect = conn->dialect; | |
| 469 | 463 | memcpy(sess->ClientGUID, conn->ClientGUID, SMB2_CLIENT_GUID_SIZE); | |
| 470 | - | /* Bound abandoned SessionId-zero authentication exchanges. */ | |
| 471 | - | if (ksmbd_too_many_session_setups(conn)) | |
| 472 | - | ret = -ENOSPC; | |
| 473 | - | else | |
| 474 | - | ret = xa_err(xa_store(&conn->sessions, sess->id, sess, | |
| 475 | - | KSMBD_DEFAULT_GFP)); | |
| 464 | + | ksmbd_expire_session(conn); | |
| 465 | + | ret = xa_err(xa_store(&conn->sessions, sess->id, sess, | |
| 466 | + | KSMBD_DEFAULT_GFP)); | |
| 476 | 467 | if (ret) { | |
| 477 | 468 | down_write(&sessions_table_lock); | |
| 478 | 469 | ksmbd_session_remove_from_table(sess); | |
| @@ -483,105 +474,6 @@ int ksmbd_session_register(struct ksmbd_conn *conn, | |||
| 483 | 474 | return ret; | |
| 484 | 475 | } | |
| 485 | 476 | ||
| 486 | - | void ksmbd_session_unregister(struct ksmbd_conn *conn, | |
| 487 | - | struct ksmbd_session *sess) | |
| 488 | - | { | |
| 489 | - | struct ksmbd_conn *session_conns[KSMBD_MAX_CHANNELS]; | |
| 490 | - | struct channel *chann; | |
| 491 | - | unsigned long index; | |
| 492 | - | unsigned int nr_conns = 0, i; | |
| 493 | - | bool removed = false; | |
| 494 | - | ||
| 495 | - | down_write(&sessions_table_lock); | |
| 496 | - | if (!hlist_unhashed(&sess->hlist)) { | |
| 497 | - | /* Keep each channel connection stable under sessions_table_lock. */ | |
| 498 | - | down_read(&sess->chann_lock); | |
| 499 | - | xa_for_each(&sess->ksmbd_chann_list, index, chann) { | |
| 500 | - | if (nr_conns == ARRAY_SIZE(session_conns)) | |
| 501 | - | break; | |
| 502 | - | session_conns[nr_conns++] = chann->conn; | |
| 503 | - | } | |
| 504 | - | up_read(&sess->chann_lock); | |
| 505 | - | ||
| 506 | - | ksmbd_session_remove_from_table(sess); | |
| 507 | - | removed = true; | |
| 508 | - | } | |
| 509 | - | ||
| 510 | - | down_write(&conn->session_lock); | |
| 511 | - | if (xa_load(&conn->sessions, sess->id) == sess) | |
| 512 | - | xa_erase(&conn->sessions, sess->id); | |
| 513 | - | up_write(&conn->session_lock); | |
| 514 | - | for (i = 0; i < nr_conns; i++) { | |
| 515 | - | if (session_conns[i] == conn) | |
| 516 | - | continue; | |
| 517 | - | down_write(&session_conns[i]->session_lock); | |
| 518 | - | if (xa_load(&session_conns[i]->sessions, sess->id) == sess) | |
| 519 | - | xa_erase(&session_conns[i]->sessions, sess->id); | |
| 520 | - | up_write(&session_conns[i]->session_lock); | |
| 521 | - | } | |
| 522 | - | up_write(&sessions_table_lock); | |
| 523 | - | ||
| 524 | - | if (removed) | |
| 525 | - | ksmbd_user_session_put(sess); | |
| 526 | - | } | |
| 527 | - | ||
| 528 | - | bool ksmbd_conn_has_valid_or_expired_session(struct ksmbd_conn *conn) | |
| 529 | - | { | |
| 530 | - | struct ksmbd_session *sess; | |
| 531 | - | unsigned long id; | |
| 532 | - | int state, bkt; | |
| 533 | - | bool found = false; | |
| 534 | - | ||
| 535 | - | down_read(&conn->session_lock); | |
| 536 | - | xa_for_each(&conn->sessions, id, sess) { | |
| 537 | - | state = READ_ONCE(sess->state); | |
| 538 | - | if (state == SMB2_SESSION_VALID || | |
| 539 | - | state == SMB2_SESSION_EXPIRED) { | |
| 540 | - | found = true; | |
| 541 | - | break; | |
| 542 | - | } | |
| 543 | - | } | |
| 544 | - | up_read(&conn->session_lock); | |
| 545 | - | if (found) | |
| 546 | - | return true; | |
| 547 | - | ||
| 548 | - | /* A session bound through SMB3 multichannel is not in conn->sessions. */ | |
| 549 | - | down_read(&sessions_table_lock); | |
| 550 | - | hash_for_each(sessions_table, bkt, sess, hlist) { | |
| 551 | - | state = READ_ONCE(sess->state); | |
| 552 | - | if (state != SMB2_SESSION_VALID && | |
| 553 | - | state != SMB2_SESSION_EXPIRED) | |
| 554 | - | continue; | |
| 555 | - | ||
| 556 | - | down_read(&sess->chann_lock); | |
| 557 | - | found = xa_load(&sess->ksmbd_chann_list, (long)conn); | |
| 558 | - | up_read(&sess->chann_lock); | |
| 559 | - | if (found) | |
| 560 | - | break; | |
| 561 | - | } | |
| 562 | - | up_read(&sessions_table_lock); | |
| 563 | - | return found; | |
| 564 | - | } | |
| 565 | - | ||
| 566 | - | void ksmbd_expire_sessions(void) | |
| 567 | - | { | |
| 568 | - | struct ksmbd_session *sess; | |
| 569 | - | u64 now = ktime_get_real_seconds(); | |
| 570 | - | int bkt; | |
| 571 | - | ||
| 572 | - | down_read(&sessions_table_lock); | |
| 573 | - | hash_for_each(sessions_table, bkt, sess, hlist) { | |
| 574 | - | if (READ_ONCE(sess->state) != SMB2_SESSION_VALID || | |
| 575 | - | !sess->kerberos_expiry || now < sess->kerberos_expiry) | |
| 576 | - | continue; | |
| 577 | - | ||
| 578 | - | if (cmpxchg(&sess->state, SMB2_SESSION_VALID, | |
| 579 | - | SMB2_SESSION_EXPIRED) == SMB2_SESSION_VALID) | |
| 580 | - | ksmbd_counter_inc(KSMBD_COUNTER_SESSION_TIMEOUTS); | |
| 581 | - | } | |
| 582 | - | up_read(&sessions_table_lock); | |
| 583 | - | } | |
| 584 | - | ||
| 585 | 477 | static int ksmbd_chann_del(struct ksmbd_conn *conn, struct ksmbd_session *sess) | |
| 586 | 478 | { | |
| 587 | 479 | struct channel *chann; | |
| @@ -596,7 +488,7 @@ static int ksmbd_chann_del(struct ksmbd_conn *conn, struct ksmbd_session *sess) | |||
| 596 | 488 | return 0; | |
| 597 | 489 | } | |
| 598 | 490 | ||
| 599 | - | void ksmbd_conn_sessions_cleanup(struct ksmbd_conn *conn) | |
| 491 | + | void ksmbd_sessions_deregister(struct ksmbd_conn *conn) | |
| 600 | 492 | { | |
| 601 | 493 | struct ksmbd_session *sess; | |
| 602 | 494 | unsigned long id; | |
modified fs/smb/server/mgmt/user_session.h
| @@ -72,8 +72,6 @@ struct ksmbd_session { | |||
| 72 | 72 | struct rw_semaphore rpc_lock; | |
| 73 | 73 | }; | |
| 74 | 74 | ||
| 75 | - | #define KSMBD_MAX_CHANNELS 32 | |
| 76 | - | ||
| 77 | 75 | static inline int test_session_flag(struct ksmbd_session *sess, int bit) | |
| 78 | 76 | { | |
| 79 | 77 | return sess->flags & bit; | |
| @@ -100,11 +98,7 @@ bool is_ksmbd_session_in_connection(struct ksmbd_conn *conn, | |||
| 100 | 98 | unsigned long long id); | |
| 101 | 99 | int ksmbd_session_register(struct ksmbd_conn *conn, | |
| 102 | 100 | struct ksmbd_session *sess); | |
| 103 | - | void ksmbd_session_unregister(struct ksmbd_conn *conn, | |
| 104 | - | struct ksmbd_session *sess); | |
| 105 | - | void ksmbd_conn_sessions_cleanup(struct ksmbd_conn *conn); | |
| 106 | - | bool ksmbd_conn_has_valid_or_expired_session(struct ksmbd_conn *conn); | |
| 107 | - | void ksmbd_expire_sessions(void); | |
| 101 | + | void ksmbd_sessions_deregister(struct ksmbd_conn *conn); | |
| 108 | 102 | struct ksmbd_session *__session_lookup(unsigned long long id); | |
| 109 | 103 | struct ksmbd_session *ksmbd_session_lookup_all(struct ksmbd_conn *conn, | |
| 110 | 104 | unsigned long long id); | |
modified fs/smb/server/proc.c
| @@ -178,8 +178,6 @@ static int proc_show_ksmbd_stats(struct seq_file *m, void *v) | |||
| 178 | 178 | proc_show_runtime_totals(m); | |
| 179 | 179 | seq_printf(m, "sessions:\t%lld\n", | |
| 180 | 180 | ksmbd_counter_sum(KSMBD_COUNTER_SESSIONS)); | |
| 181 | - | seq_printf(m, "session_timeouts:\t%lld\n", | |
| 182 | - | ksmbd_counter_sum(KSMBD_COUNTER_SESSION_TIMEOUTS)); | |
| 183 | 181 | seq_printf(m, "tree_connects:\t%lld\n", | |
| 184 | 182 | ksmbd_counter_sum(KSMBD_COUNTER_TREE_CONNS)); | |
| 185 | 183 | seq_printf(m, "requests:\t%lld\n", | |
modified fs/smb/server/server.c
| @@ -414,7 +414,7 @@ static int ksmbd_server_process_request(struct ksmbd_conn *conn) | |||
| 414 | 414 | ||
| 415 | 415 | static int ksmbd_server_terminate_conn(struct ksmbd_conn *conn) | |
| 416 | 416 | { | |
| 417 | - | ksmbd_conn_sessions_cleanup(conn); | |
| 417 | + | ksmbd_sessions_deregister(conn); | |
| 418 | 418 | destroy_lease_table(conn); | |
| 419 | 419 | return 0; | |
| 420 | 420 | } | |
modified fs/smb/server/smb2pdu.c
| @@ -85,6 +85,8 @@ struct channel *lookup_chann_list(struct ksmbd_session *sess, struct ksmbd_conn | |||
| 85 | 85 | return chann; | |
| 86 | 86 | } | |
| 87 | 87 | ||
| 88 | + | #define KSMBD_MAX_CHANNELS 32 | |
| 89 | + | ||
| 88 | 90 | static int register_session_channel(struct ksmbd_session *sess, | |
| 89 | 91 | struct ksmbd_conn *conn, | |
| 90 | 92 | const char *sess_key) | |
| @@ -931,14 +933,8 @@ static bool smb2_session_expired_cmd_allowed(struct ksmbd_work *work, | |||
| 931 | 933 | ||
| 932 | 934 | static bool smb2_session_kerberos_expired(struct ksmbd_session *sess) | |
| 933 | 935 | { | |
| 934 | - | if (!sess->kerberos_expiry || | |
| 935 | - | ktime_get_real_seconds() < sess->kerberos_expiry) | |
| 936 | - | return false; | |
| 937 | - | ||
| 938 | - | if (cmpxchg(&sess->state, SMB2_SESSION_VALID, | |
| 939 | - | SMB2_SESSION_EXPIRED) == SMB2_SESSION_VALID) | |
| 940 | - | ksmbd_counter_inc(KSMBD_COUNTER_SESSION_TIMEOUTS); | |
| 941 | - | return true; | |
| 936 | + | return sess->kerberos_expiry && | |
| 937 | + | ktime_get_real_seconds() >= sess->kerberos_expiry; | |
| 942 | 938 | } | |
| 943 | 939 | ||
| 944 | 940 | /** | |
| @@ -973,8 +969,9 @@ int smb2_check_user_session(struct ksmbd_work *work) | |||
| 973 | 969 | if (!work->next_smb2_rcv_hdr_off && sess_id) | |
| 974 | 970 | work->sess = ksmbd_session_lookup_all_states(conn, sess_id); | |
| 975 | 971 | if (work->sess) { | |
| 976 | - | if (!smb2_session_kerberos_expired(work->sess) && | |
| 977 | - | work->sess->state != SMB2_SESSION_VALID) { | |
| 972 | + | if (smb2_session_kerberos_expired(work->sess)) { | |
| 973 | + | work->sess->state = SMB2_SESSION_EXPIRED; | |
| 974 | + | } else if (work->sess->state != SMB2_SESSION_VALID) { | |
| 978 | 975 | ksmbd_user_session_put(work->sess); | |
| 979 | 976 | work->sess = NULL; | |
| 980 | 977 | } | |
| @@ -999,7 +996,8 @@ int smb2_check_user_session(struct ksmbd_work *work) | |||
| 999 | 996 | sess_id, work->sess->id); | |
| 1000 | 997 | return -EINVAL; | |
| 1001 | 998 | } | |
| 1002 | - | smb2_session_kerberos_expired(work->sess); | |
| 999 | + | if (smb2_session_kerberos_expired(work->sess)) | |
| 1000 | + | work->sess->state = SMB2_SESSION_EXPIRED; | |
| 1003 | 1001 | if (work->sess->state != SMB2_SESSION_VALID) { | |
| 1004 | 1002 | pr_err("compound request on a non-valid session (state %d)\n", | |
| 1005 | 1003 | work->sess->state); | |
| @@ -1016,6 +1014,7 @@ int smb2_check_user_session(struct ksmbd_work *work) | |||
| 1016 | 1014 | work->sess = ksmbd_session_lookup_all_states(conn, sess_id); | |
| 1017 | 1015 | if (work->sess) { | |
| 1018 | 1016 | if (smb2_session_kerberos_expired(work->sess)) { | |
| 1017 | + | work->sess->state = SMB2_SESSION_EXPIRED; | |
| 1019 | 1018 | return smb2_session_expired_cmd_allowed(work, cmd) ? | |
| 1020 | 1019 | 1 : -EKEYEXPIRED; | |
| 1021 | 1020 | } | |
| @@ -2437,7 +2436,7 @@ int smb2_sess_setup(struct ksmbd_work *work) | |||
| 2437 | 2436 | struct ksmbd_conn *conn = work->conn; | |
| 2438 | 2437 | struct smb2_sess_setup_req *req; | |
| 2439 | 2438 | struct smb2_sess_setup_rsp *rsp; | |
| 2440 | - | struct ksmbd_session *sess = NULL; | |
| 2439 | + | struct ksmbd_session *sess; | |
| 2441 | 2440 | struct negotiate_message *negblob; | |
| 2442 | 2441 | unsigned int negblob_len, negblob_off; | |
| 2443 | 2442 | int rc = 0; | |
| @@ -2593,9 +2592,6 @@ int smb2_sess_setup(struct ksmbd_work *work) | |||
| 2593 | 2592 | goto out_err; | |
| 2594 | 2593 | } | |
| 2595 | 2594 | ||
| 2596 | - | if (work->session_setup_reauth) | |
| 2597 | - | WRITE_ONCE(sess->state, SMB2_SESSION_IN_PROGRESS); | |
| 2598 | - | ||
| 2599 | 2595 | conn->binding = false; | |
| 2600 | 2596 | } | |
| 2601 | 2597 | work->sess = sess; | |
| @@ -2707,14 +2703,6 @@ out_err: | |||
| 2707 | 2703 | } | |
| 2708 | 2704 | ||
| 2709 | 2705 | if (rc < 0) { | |
| 2710 | - | bool setup_in_progress = sess && | |
| 2711 | - | READ_ONCE(sess->state) == SMB2_SESSION_IN_PROGRESS && | |
| 2712 | - | !(req->Flags & SMB2_SESSION_REQ_FLAG_BINDING); | |
| 2713 | - | ||
| 2714 | - | /* Authentication errors must not leave the new session published. */ | |
| 2715 | - | if (setup_in_progress) | |
| 2716 | - | ksmbd_session_unregister(conn, sess); | |
| 2717 | - | ||
| 2718 | 2706 | if (sess && conn->dialect == SMB311_PROT_ID && | |
| 2719 | 2707 | (req->Flags & SMB2_SESSION_REQ_FLAG_BINDING)) { | |
| 2720 | 2708 | struct preauth_session *preauth_sess; | |
| @@ -2748,8 +2736,7 @@ out_err: | |||
| 2748 | 2736 | * For binding requests, session belongs to another | |
| 2749 | 2737 | * connection. Do not expire it. | |
| 2750 | 2738 | */ | |
| 2751 | - | if (!(req->Flags & SMB2_SESSION_REQ_FLAG_BINDING) && | |
| 2752 | - | !setup_in_progress) { | |
| 2739 | + | if (!(req->Flags & SMB2_SESSION_REQ_FLAG_BINDING)) { | |
| 2753 | 2740 | sess->last_active = jiffies; | |
| 2754 | 2741 | sess->kerberos_expiry = 0; | |
| 2755 | 2742 | sess->state = SMB2_SESSION_EXPIRED; | |
| @@ -6275,18 +6262,21 @@ err_out2: | |||
| 6275 | 6262 | * @reqOutputBufferLength: max buffer length expected in command response | |
| 6276 | 6263 | * @fixed_len: minimum fixed response length | |
| 6277 | 6264 | * @rsp: query info response buffer contains output buffer length | |
| 6265 | + | * @rsp_org: base response buffer pointer in case of chained response | |
| 6278 | 6266 | * | |
| 6279 | 6267 | * Return: 0 on success, otherwise error | |
| 6280 | 6268 | */ | |
| 6281 | 6269 | static int buffer_check_err(int reqOutputBufferLength, | |
| 6282 | 6270 | unsigned int fixed_len, | |
| 6283 | - | struct smb2_query_info_rsp *rsp) | |
| 6271 | + | struct smb2_query_info_rsp *rsp, | |
| 6272 | + | void *rsp_org) | |
| 6284 | 6273 | { | |
| 6285 | 6274 | unsigned int output_len = le32_to_cpu(rsp->OutputBufferLength); | |
| 6286 | 6275 | ||
| 6287 | 6276 | if (reqOutputBufferLength < fixed_len) { | |
| 6288 | 6277 | pr_err("Invalid Buffer Size Requested\n"); | |
| 6289 | 6278 | rsp->hdr.Status = STATUS_INFO_LENGTH_MISMATCH; | |
| 6279 | + | *(__be32 *)rsp_org = cpu_to_be32(sizeof(struct smb2_hdr)); | |
| 6290 | 6280 | return -EINVAL; | |
| 6291 | 6281 | } | |
| 6292 | 6282 | ||
| @@ -6297,7 +6287,8 @@ static int buffer_check_err(int reqOutputBufferLength, | |||
| 6297 | 6287 | return 0; | |
| 6298 | 6288 | } | |
| 6299 | 6289 | ||
| 6300 | - | static void get_standard_info_pipe(struct smb2_query_info_rsp *rsp) | |
| 6290 | + | static void get_standard_info_pipe(struct smb2_query_info_rsp *rsp, | |
| 6291 | + | void *rsp_org) | |
| 6301 | 6292 | { | |
| 6302 | 6293 | struct smb2_file_standard_info *sinfo; | |
| 6303 | 6294 | ||
| @@ -6312,7 +6303,8 @@ static void get_standard_info_pipe(struct smb2_query_info_rsp *rsp) | |||
| 6312 | 6303 | cpu_to_le32(sizeof(struct smb2_file_standard_info)); | |
| 6313 | 6304 | } | |
| 6314 | 6305 | ||
| 6315 | - | static void get_internal_info_pipe(struct smb2_query_info_rsp *rsp, u64 num) | |
| 6306 | + | static void get_internal_info_pipe(struct smb2_query_info_rsp *rsp, u64 num, | |
| 6307 | + | void *rsp_org) | |
| 6316 | 6308 | { | |
| 6317 | 6309 | struct smb2_file_internal_info *file_info; | |
| 6318 | 6310 | ||
| @@ -6326,7 +6318,8 @@ static void get_internal_info_pipe(struct smb2_query_info_rsp *rsp, u64 num) | |||
| 6326 | 6318 | ||
| 6327 | 6319 | static int smb2_get_info_file_pipe(struct ksmbd_session *sess, | |
| 6328 | 6320 | struct smb2_query_info_req *req, | |
| 6329 | - | struct smb2_query_info_rsp *rsp) | |
| 6321 | + | struct smb2_query_info_rsp *rsp, | |
| 6322 | + | void *rsp_org) | |
| 6330 | 6323 | { | |
| 6331 | 6324 | u64 id; | |
| 6332 | 6325 | int rc; | |
| @@ -6351,16 +6344,16 @@ static int smb2_get_info_file_pipe(struct ksmbd_session *sess, | |||
| 6351 | 6344 | ||
| 6352 | 6345 | switch (req->FileInfoClass) { | |
| 6353 | 6346 | case FILE_STANDARD_INFORMATION: | |
| 6354 | - | get_standard_info_pipe(rsp); | |
| 6347 | + | get_standard_info_pipe(rsp, rsp_org); | |
| 6355 | 6348 | rc = buffer_check_err(le32_to_cpu(req->OutputBufferLength), | |
| 6356 | 6349 | le32_to_cpu(rsp->OutputBufferLength), | |
| 6357 | - | rsp); | |
| 6350 | + | rsp, rsp_org); | |
| 6358 | 6351 | break; | |
| 6359 | 6352 | case FILE_INTERNAL_INFORMATION: | |
| 6360 | - | get_internal_info_pipe(rsp, id); | |
| 6353 | + | get_internal_info_pipe(rsp, id, rsp_org); | |
| 6361 | 6354 | rc = buffer_check_err(le32_to_cpu(req->OutputBufferLength), | |
| 6362 | 6355 | le32_to_cpu(rsp->OutputBufferLength), | |
| 6363 | - | rsp); | |
| 6356 | + | rsp, rsp_org); | |
| 6364 | 6357 | break; | |
| 6365 | 6358 | default: | |
| 6366 | 6359 | ksmbd_debug(SMB, "smb2_info_file_pipe for %u not supported\n", | |
| @@ -7196,7 +7189,8 @@ static int smb2_get_info_file(struct ksmbd_work *work, | |||
| 7196 | 7189 | if (test_share_config_flag(work->tcon->share_conf, | |
| 7197 | 7190 | KSMBD_SHARE_FLAG_PIPE)) { | |
| 7198 | 7191 | /* smb2 info file called for pipe */ | |
| 7199 | - | rc = smb2_get_info_file_pipe(work->sess, req, rsp); | |
| 7192 | + | rc = smb2_get_info_file_pipe(work->sess, req, rsp, | |
| 7193 | + | work->response_buf); | |
| 7200 | 7194 | goto iov_pin_out; | |
| 7201 | 7195 | } | |
| 7202 | 7196 | ||
| @@ -7305,16 +7299,13 @@ static int smb2_get_info_file(struct ksmbd_work *work, | |||
| 7305 | 7299 | case FILE_ALTERNATE_NAME_INFORMATION: | |
| 7306 | 7300 | fixed_len = FILE_ALTERNATE_NAME_INFORMATION_SIZE; | |
| 7307 | 7301 | break; | |
| 7308 | - | case FILE_NORMALIZED_NAME_INFORMATION: | |
| 7309 | - | fixed_len = FILE_NORMALIZED_NAME_INFORMATION_SIZE; | |
| 7310 | - | break; | |
| 7311 | 7302 | case FILE_STREAM_INFORMATION: | |
| 7312 | 7303 | fixed_len = FILE_STREAM_INFORMATION_SIZE; | |
| 7313 | 7304 | break; | |
| 7314 | 7305 | } | |
| 7315 | 7306 | rc = buffer_check_err(le32_to_cpu(req->OutputBufferLength), | |
| 7316 | 7307 | fixed_len, | |
| 7317 | - | rsp); | |
| 7308 | + | rsp, work->response_buf); | |
| 7318 | 7309 | } | |
| 7319 | 7310 | ksmbd_fd_put(work, fp); | |
| 7320 | 7311 | ||
| @@ -7585,7 +7576,7 @@ static int smb2_get_info_filesystem(struct ksmbd_work *work, | |||
| 7585 | 7576 | } | |
| 7586 | 7577 | rc = buffer_check_err(le32_to_cpu(req->OutputBufferLength), | |
| 7587 | 7578 | fixed_len, | |
| 7588 | - | rsp); | |
| 7579 | + | rsp, work->response_buf); | |
| 7589 | 7580 | path_put(&path); | |
| 7590 | 7581 | ||
| 7591 | 7582 | if (!rc) | |
| @@ -7699,7 +7690,7 @@ release_acl: | |||
| 7699 | 7690 | rsp->OutputBufferLength = cpu_to_le32(secdesclen); | |
| 7700 | 7691 | rc = buffer_check_err(le32_to_cpu(req->OutputBufferLength), | |
| 7701 | 7692 | le32_to_cpu(rsp->OutputBufferLength), | |
| 7702 | - | rsp); | |
| 7693 | + | rsp, work->response_buf); | |
| 7703 | 7694 | if (rc) | |
| 7704 | 7695 | goto err_out; | |
| 7705 | 7696 | ||
modified fs/smb/server/smb2pdu.h
| @@ -61,6 +61,8 @@ struct preauth_integrity_info { | |||
| 61 | 61 | #define SMB2_SESSION_IN_PROGRESS BIT(0) | |
| 62 | 62 | #define SMB2_SESSION_VALID BIT(1) | |
| 63 | 63 | ||
| 64 | + | #define SMB2_SESSION_TIMEOUT (10 * HZ) | |
| 65 | + | ||
| 64 | 66 | /* Apple Defined Contexts */ | |
| 65 | 67 | #define SMB2_CREATE_AAPL "AAPL" | |
| 66 | 68 | ||
| @@ -212,7 +214,6 @@ struct file_sparse { | |||
| 212 | 214 | #define FILE_ALLOCATION_INFORMATION_SIZE 19 | |
| 213 | 215 | #define FILE_END_OF_FILE_INFORMATION_SIZE 20 | |
| 214 | 216 | #define FILE_ALTERNATE_NAME_INFORMATION_SIZE 8 | |
| 215 | - | #define FILE_NORMALIZED_NAME_INFORMATION_SIZE 8 | |
| 216 | 217 | #define FILE_STREAM_INFORMATION_SIZE 32 | |
| 217 | 218 | #define FILE_PIPE_INFORMATION_SIZE 23 | |
| 218 | 219 | #define FILE_PIPE_LOCAL_INFORMATION_SIZE 24 | |
modified fs/smb/server/stats.h
| @@ -15,7 +15,6 @@ | |||
| 15 | 15 | ||
| 16 | 16 | enum { | |
| 17 | 17 | KSMBD_COUNTER_SESSIONS = 0, | |
| 18 | - | KSMBD_COUNTER_SESSION_TIMEOUTS, | |
| 19 | 18 | KSMBD_COUNTER_TREE_CONNS, | |
| 20 | 19 | KSMBD_COUNTER_REQUESTS, | |
| 21 | 20 | KSMBD_COUNTER_STATUS_SUCCESS, | |
modified fs/squashfs/xz_wrapper.c
| @@ -57,10 +57,10 @@ static void *squashfs_xz_comp_opts(struct squashfs_sb_info *msblk, | |||
| 57 | 57 | ||
| 58 | 58 | opts->dict_size = le32_to_cpu(comp_opts->dictionary_size); | |
| 59 | 59 | ||
| 60 | - | /* the dictionary size should be positive and 2^n or 2^n+2^(n+1) */ | |
| 60 | + | /* the dictionary size should be 2^n or 2^n+2^(n+1) */ | |
| 61 | 61 | n = ffs(opts->dict_size) - 1; | |
| 62 | - | if (opts->dict_size <= 0 || (opts->dict_size != (1 << n) && | |
| 63 | - | opts->dict_size != (1 << n) + (1 << (n + 1)))) { | |
| 62 | + | if (opts->dict_size != (1 << n) && opts->dict_size != (1 << n) + | |
| 63 | + | (1 << (n + 1))) { | |
| 64 | 64 | err = -EIO; | |
| 65 | 65 | goto out; | |
| 66 | 66 | } | |
modified fs/super.c
| @@ -171,6 +171,19 @@ static void super_wake(struct super_block *sb, unsigned int flag) | |||
| 171 | 171 | wake_up_var(&sb->s_flags); | |
| 172 | 172 | } | |
| 173 | 173 | ||
| 174 | + | /* | |
| 175 | + | * The s_op->nr_cached_objects hooks (used for example by btrfs and xfs) | |
| 176 | + | * operate on filesystem-global state and ignore sc->memcg. Driving them | |
| 177 | + | * from per-memcg shrink_slab_memcg() invocations only burns CPU walking | |
| 178 | + | * per-cpu counters and queueing duplicate work: the actual reclaim happens on | |
| 179 | + | * the global path (kswapd or root direct reclaim) regardless. Restrict them | |
| 180 | + | * to that path. | |
| 181 | + | */ | |
| 182 | + | static inline bool super_fs_objects_eligible(struct shrink_control *sc) | |
| 183 | + | { | |
| 184 | + | return !sc->memcg || mem_cgroup_is_root(sc->memcg); | |
| 185 | + | } | |
| 186 | + | ||
| 174 | 187 | /* | |
| 175 | 188 | * One thing we have to be careful of with a per-sb shrinker is that we don't | |
| 176 | 189 | * drop the last active reference to the superblock from within the shrinker. | |
| @@ -200,7 +213,7 @@ static unsigned long super_cache_scan(struct shrinker *shrink, | |||
| 200 | 213 | if (!super_trylock_shared(sb)) | |
| 201 | 214 | return SHRINK_STOP; | |
| 202 | 215 | ||
| 203 | - | if (sb->s_op->nr_cached_objects) | |
| 216 | + | if (sb->s_op->nr_cached_objects && super_fs_objects_eligible(sc)) | |
| 204 | 217 | fs_objects = sb->s_op->nr_cached_objects(sb, sc); | |
| 205 | 218 | ||
| 206 | 219 | inodes = list_lru_shrink_count(&sb->s_inode_lru, sc); | |
| @@ -261,7 +274,8 @@ static unsigned long super_cache_count(struct shrinker *shrink, | |||
| 261 | 274 | return 0; | |
| 262 | 275 | smp_rmb(); | |
| 263 | 276 | ||
| 264 | - | if (sb->s_op && sb->s_op->nr_cached_objects) | |
| 277 | + | if (sb->s_op && sb->s_op->nr_cached_objects && | |
| 278 | + | super_fs_objects_eligible(sc)) | |
| 265 | 279 | total_objects = sb->s_op->nr_cached_objects(sb, sc); | |
| 266 | 280 | ||
| 267 | 281 | total_objects += list_lru_shrink_count(&sb->s_dentry_lru, sc); | |
| @@ -419,19 +433,15 @@ fail: | |||
| 419 | 433 | void put_super(struct super_block *s) | |
| 420 | 434 | { | |
| 421 | 435 | if (refcount_dec_and_test(&s->s_passive)) { | |
| 422 | - | struct file_system_type *type = s->s_type; | |
| 423 | 436 | ||
| 424 | 437 | spin_lock(&sb_lock); | |
| 425 | 438 | list_del_init(&s->s_list); | |
| 426 | - | hlist_del_init(&s->s_instances); | |
| 427 | 439 | spin_unlock(&sb_lock); | |
| 428 | 440 | ||
| 429 | 441 | WARN_ON(s->s_dentry_lru.node); | |
| 430 | 442 | WARN_ON(s->s_inode_lru.node); | |
| 431 | 443 | WARN_ON(s->s_mounts); | |
| 432 | 444 | call_rcu(&s->rcu, destroy_super_rcu); | |
| 433 | - | /* The unlink above may touch type->fs_supers, so drop it last. */ | |
| 434 | - | put_filesystem(type); | |
| 435 | 445 | } | |
| 436 | 446 | } | |
| 437 | 447 | ||
| @@ -548,6 +558,17 @@ static void kill_super_notify(struct super_block *sb) | |||
| 548 | 558 | if (sb->s_flags & SB_DEAD) | |
| 549 | 559 | return; | |
| 550 | 560 | ||
| 561 | + | /* | |
| 562 | + | * Remove it from @fs_supers so it isn't found by new | |
| 563 | + | * sget_fc() walkers anymore. Any concurrent mounter still | |
| 564 | + | * managing to grab a temporary reference is guaranteed to | |
| 565 | + | * already see SB_DYING and will wait until we notify them about | |
| 566 | + | * SB_DEAD. | |
| 567 | + | */ | |
| 568 | + | spin_lock(&sb_lock); | |
| 569 | + | hlist_del_init(&sb->s_instances); | |
| 570 | + | spin_unlock(&sb_lock); | |
| 571 | + | ||
| 551 | 572 | /* Drop sget_fc()'s claim; a never-registered entry stays with the sb. */ | |
| 552 | 573 | if (sb->s_super_dev->sd_dev) { | |
| 553 | 574 | super_dev_put(sb->s_super_dev); | |
| @@ -556,15 +577,11 @@ static void kill_super_notify(struct super_block *sb) | |||
| 556 | 577 | ||
| 557 | 578 | /* | |
| 558 | 579 | * Let concurrent mounts know that this thing is really dead. | |
| 559 | - | * sget_fc() skips SB_DEAD superblocks and calls test() under | |
| 560 | - | * sb_lock, so set it under sb_lock: once we return no test() | |
| 561 | - | * runs on this superblock anymore and none will start. Everyone | |
| 562 | - | * else already saw SB_DYING and either discarded the superblock | |
| 563 | - | * or waits for SB_DEAD. | |
| 580 | + | * We don't need @sb->s_umount here as every concurrent caller | |
| 581 | + | * will see SB_DYING and either discard the superblock or wait | |
| 582 | + | * for SB_DEAD. | |
| 564 | 583 | */ | |
| 565 | - | spin_lock(&sb_lock); | |
| 566 | 584 | super_wake(sb, SB_DEAD); | |
| 567 | - | spin_unlock(&sb_lock); | |
| 568 | 585 | } | |
| 569 | 586 | ||
| 570 | 587 | /** | |
| @@ -591,6 +608,7 @@ void deactivate_locked_super(struct super_block *s) | |||
| 591 | 608 | list_lru_destroy(&s->s_dentry_lru); | |
| 592 | 609 | list_lru_destroy(&s->s_inode_lru); | |
| 593 | 610 | ||
| 611 | + | put_filesystem(fs); | |
| 594 | 612 | put_super(s); | |
| 595 | 613 | } else { | |
| 596 | 614 | super_unlock_excl(s); | |
| @@ -777,12 +795,12 @@ void generic_shutdown_super(struct super_block *sb) | |||
| 777 | 795 | } | |
| 778 | 796 | /* | |
| 779 | 797 | * Broadcast to everyone that grabbed a temporary reference to this | |
| 780 | - | * superblock that it is dying. Every walker of @fs_supers outside | |
| 781 | - | * of sget_fc() will now discard this superblock and treat it as | |
| 782 | - | * dead. | |
| 798 | + | * superblock before we removed it from @fs_supers that the superblock | |
| 799 | + | * is dying. Every walker of @fs_supers outside of sget_fc() will now | |
| 800 | + | * discard this superblock and treat it as dead. | |
| 783 | 801 | * | |
| 784 | - | * sget_fc() keeps finding the superblock until SB_DEAD is set, so | |
| 785 | - | * a concurrent mounter waits until we passed sb->kill_sb(). | |
| 802 | + | * We leave the superblock on @fs_supers so it can be found by | |
| 803 | + | * sget_fc() until we passed sb->kill_sb(). | |
| 786 | 804 | */ | |
| 787 | 805 | super_wake(sb, SB_DYING); | |
| 788 | 806 | super_unlock_excl(sb); | |
| @@ -861,9 +879,6 @@ retry: | |||
| 861 | 879 | spin_lock(&sb_lock); | |
| 862 | 880 | if (test) { | |
| 863 | 881 | hlist_for_each_entry(old, &fc->fs_type->fs_supers, s_instances) { | |
| 864 | - | /* Only unlinked at the last passive reference. */ | |
| 865 | - | if (super_flags(old, SB_DEAD)) | |
| 866 | - | continue; | |
| 867 | 882 | if (test(old, fc)) | |
| 868 | 883 | goto share_extant_sb; | |
| 869 | 884 | } | |
modified fs/xfs/libxfs/xfs_ag.h
| @@ -207,7 +207,7 @@ xfs_perag_next( | |||
| 207 | 207 | } | |
| 208 | 208 | ||
| 209 | 209 | /* | |
| 210 | - | * Per-ag geometry information and validation | |
| 210 | + | * Per-ag geometry infomation and validation | |
| 211 | 211 | */ | |
| 212 | 212 | xfs_agblock_t xfs_ag_block_count(struct xfs_mount *mp, xfs_agnumber_t agno); | |
| 213 | 213 | void xfs_agino_range(struct xfs_mount *mp, xfs_agnumber_t agno, | |
modified fs/xfs/libxfs/xfs_alloc.c
| @@ -3487,7 +3487,7 @@ xfs_alloc_read_agf( | |||
| 3487 | 3487 | } | |
| 3488 | 3488 | ||
| 3489 | 3489 | /* | |
| 3490 | - | * Pre-process allocation arguments to set initial state that we don't require | |
| 3490 | + | * Pre-proces allocation arguments to set initial state that we don't require | |
| 3491 | 3491 | * callers to set up correctly, as well as bounds check the allocation args | |
| 3492 | 3492 | * that are set up. | |
| 3493 | 3493 | */ | |
| @@ -3608,7 +3608,7 @@ xfs_alloc_vextent_finish( | |||
| 3608 | 3608 | * ABBA AGF deadlocks because a future allocation attempt in this | |
| 3609 | 3609 | * transaction may attempt to lock a lower number AGF. | |
| 3610 | 3610 | * | |
| 3611 | - | * We can't release the AGF until the transaction is committed, so at | |
| 3611 | + | * We can't release the AGF until the transaction is commited, so at | |
| 3612 | 3612 | * this point we must update the "first allocation" tracker to point at | |
| 3613 | 3613 | * this AG if the tracker is empty or points to a lower AG. This allows | |
| 3614 | 3614 | * the next allocation attempt to be modified appropriately to avoid | |
modified fs/xfs/libxfs/xfs_attr_leaf.c
| @@ -1715,7 +1715,7 @@ xfs_attr3_leaf_add_work( | |||
| 1715 | 1715 | /* | |
| 1716 | 1716 | * This freemap entry starts at the old end of the | |
| 1717 | 1717 | * leaf entry array, so we need to adjust its base | |
| 1718 | - | * upward to accommodate the larger array. | |
| 1718 | + | * upward to accomodate the larger array. | |
| 1719 | 1719 | */ | |
| 1720 | 1720 | diff = sizeof(struct xfs_attr_leaf_entry); | |
| 1721 | 1721 | } else if (ichdr->freemap[i].size > 0 && | |
modified fs/xfs/libxfs/xfs_errortag.h
| @@ -83,7 +83,7 @@ | |||
| 83 | 83 | #define XFS_RANDOM_DEFAULT 100 | |
| 84 | 84 | ||
| 85 | 85 | /* | |
| 86 | - | * Table of error injection knobs. The parameters to the XFS_ERRTAG macro are: | |
| 86 | + | * Table of errror injection knobs. The parameters to the XFS_ERRTAG macro are: | |
| 87 | 87 | * 1. The XFS_ERRTAG_ flag but without the prefix; | |
| 88 | 88 | * 2. The name of the sysfs knob; and | |
| 89 | 89 | * 3. The default value for the knob. | |
modified fs/xfs/libxfs/xfs_exchmaps.c
| @@ -395,7 +395,7 @@ xfs_exchmaps_one_step( | |||
| 395 | 395 | /* | |
| 396 | 396 | * Re-add both mappings. We exchange the file offsets between the two | |
| 397 | 397 | * maps and add the opposite map, which has the effect of filling the | |
| 398 | - | * logical offsets we just unmapped, but with the physical mapping | |
| 398 | + | * logical offsets we just unmapped, but with with the physical mapping | |
| 399 | 399 | * information exchanged. | |
| 400 | 400 | */ | |
| 401 | 401 | swap(irec1->br_startoff, irec2->br_startoff); | |
| @@ -959,6 +959,16 @@ xmi_can_exchange_reflink_flags( | |||
| 959 | 959 | { | |
| 960 | 960 | struct xfs_mount *mp = req->ip1->i_mount; | |
| 961 | 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 | + | ||
| 962 | 972 | /* | |
| 963 | 973 | * The INO1_WRITTEN optimization can skip exchanging hole and | |
| 964 | 974 | * unwritten mappings, which means we cannot guarantee that all | |
modified fs/xfs/libxfs/xfs_format.h
| @@ -1051,7 +1051,7 @@ enum xfs_dinode_fmt { | |||
| 1051 | 1051 | * block is 1KB in size. | |
| 1052 | 1052 | * | |
| 1053 | 1053 | * With XFS_MAX_EXTCNT_DATA_FORK_SMALL representing maximum extent count and | |
| 1054 | - | * with 1KB sized blocks, a file can reach up to, | |
| 1054 | + | * with 1KB sized blocks, a file can reach upto, | |
| 1055 | 1055 | * 1KB * (2^31) = 2TB | |
| 1056 | 1056 | * | |
| 1057 | 1057 | * This is much larger than the theoretical maximum size of a directory | |
modified fs/xfs/libxfs/xfs_inode_buf.c
| @@ -626,7 +626,7 @@ xfs_dinode_verify( | |||
| 626 | 626 | * have di_nlink track the link count, even if the actual filesystem | |
| 627 | 627 | * only supported V1 inodes (i.e. di_onlink). When writing out the | |
| 628 | 628 | * ondisk inode, it would set both the ondisk di_nlink and di_onlink to | |
| 629 | - | * the incore di_nlink value, which is why we cannot check for | |
| 629 | + | * the the incore di_nlink value, which is why we cannot check for | |
| 630 | 630 | * di_nlink==0 on a V1 inode. V2/3 inodes would get written out with | |
| 631 | 631 | * di_onlink==0, so we can check that. | |
| 632 | 632 | */ | |
modified fs/xfs/libxfs/xfs_metafile.c
| @@ -297,14 +297,14 @@ xfs_metafile_resv_init( | |||
| 297 | 297 | goto out_unlock; | |
| 298 | 298 | ||
| 299 | 299 | /* | |
| 300 | - | * Space taken by metadata btrees are accounted on-disk as used space. | |
| 301 | - | * We therefore only hide the space that is reserved but not used by | |
| 302 | - | * the trees. | |
| 300 | + | * Space taken by the per-AG metadata btrees are accounted on-disk as | |
| 301 | + | * used space. We therefore only hide the space that is reserved but | |
| 302 | + | * not used by the trees. | |
| 303 | 303 | */ | |
| 304 | 304 | if (used > target) | |
| 305 | 305 | target = used; | |
| 306 | 306 | else if (target > dblocks_avail) | |
| 307 | - | target = max(dblocks_avail, used); | |
| 307 | + | target = dblocks_avail; | |
| 308 | 308 | hidden_space = target - used; | |
| 309 | 309 | ||
| 310 | 310 | error = xfs_dec_fdblocks(mp, hidden_space, true); | |
modified fs/xfs/libxfs/xfs_rtrefcount_btree.c
| @@ -617,7 +617,7 @@ xfs_rtrefcountbt_from_disk( | |||
| 617 | 617 | fpp = xfs_rtrefcount_droot_ptr_addr(dblock, 1, maxrecs); | |
| 618 | 618 | tpp = xfs_rtrefcount_broot_ptr_addr(mp, rblock, 1, rblocklen); | |
| 619 | 619 | numrecs = be16_to_cpu(dblock->bb_numrecs); | |
| 620 | - | memcpy(tkp, fkp, sizeof(*fkp) * numrecs); | |
| 620 | + | memcpy(tkp, fkp, 2 * sizeof(*fkp) * numrecs); | |
| 621 | 621 | memcpy(tpp, fpp, sizeof(*fpp) * numrecs); | |
| 622 | 622 | } else { | |
| 623 | 623 | frp = xfs_rtrefcount_droot_rec_addr(dblock, 1); | |
| @@ -703,7 +703,7 @@ xfs_rtrefcountbt_to_disk( | |||
| 703 | 703 | fpp = xfs_rtrefcount_broot_ptr_addr(mp, rblock, 1, rblocklen); | |
| 704 | 704 | tpp = xfs_rtrefcount_droot_ptr_addr(dblock, 1, maxrecs); | |
| 705 | 705 | numrecs = be16_to_cpu(rblock->bb_numrecs); | |
| 706 | - | memcpy(tkp, fkp, sizeof(*fkp) * numrecs); | |
| 706 | + | memcpy(tkp, fkp, 2 * sizeof(*fkp) * numrecs); | |
| 707 | 707 | memcpy(tpp, fpp, sizeof(*fpp) * numrecs); | |
| 708 | 708 | } else { | |
| 709 | 709 | frp = xfs_rtrefcount_rec_addr(rblock, 1); | |
modified fs/xfs/scrub/agheader_repair.c
| @@ -1369,7 +1369,7 @@ xrep_iunlink_mark_ondisk( | |||
| 1369 | 1369 | ||
| 1370 | 1370 | /* | |
| 1371 | 1371 | * Walk an iunlink bucket's inode list. For each inode that should be on this | |
| 1372 | - | * chain, clear its entry in iunlink_bmp because it's ok and we don't need | |
| 1372 | + | * chain, clear its entry in in iunlink_bmp because it's ok and we don't need | |
| 1373 | 1373 | * to touch it further. | |
| 1374 | 1374 | */ | |
| 1375 | 1375 | STATIC int | |
modified fs/xfs/scrub/alloc_repair.c
| @@ -338,7 +338,7 @@ xrep_cntbt_extent_cmp( | |||
| 338 | 338 | } | |
| 339 | 339 | ||
| 340 | 340 | /* | |
| 341 | - | * Sort the free extents by length so that we can put the records into the | |
| 341 | + | * Sort the free extents by length so so that we can put the records into the | |
| 342 | 342 | * cntbt in the correct order. Don't let userspace kill us if we're resorting | |
| 343 | 343 | * after allocating btree blocks. | |
| 344 | 344 | */ | |
modified fs/xfs/scrub/bitmap.c
| @@ -122,8 +122,8 @@ xbitmap64_set( | |||
| 122 | 122 | uint64_t start, | |
| 123 | 123 | uint64_t len) | |
| 124 | 124 | { | |
| 125 | - | struct xbitmap64_node *left = NULL; | |
| 126 | - | struct xbitmap64_node *right = NULL; | |
| 125 | + | struct xbitmap64_node *left; | |
| 126 | + | struct xbitmap64_node *right; | |
| 127 | 127 | uint64_t last = start + len - 1; | |
| 128 | 128 | int error; | |
| 129 | 129 | ||
| @@ -131,7 +131,6 @@ xbitmap64_set( | |||
| 131 | 131 | left = xbitmap64_tree_iter_first(&bitmap->xb_root, start, last); | |
| 132 | 132 | if (left && left->bn_start <= start && left->bn_last >= last) | |
| 133 | 133 | return 0; | |
| 134 | - | left = NULL; | |
| 135 | 134 | ||
| 136 | 135 | /* Clear out everything in the range we want to set. */ | |
| 137 | 136 | error = xbitmap64_clear(bitmap, start, len); | |
| @@ -139,15 +138,11 @@ xbitmap64_set( | |||
| 139 | 138 | return error; | |
| 140 | 139 | ||
| 141 | 140 | /* Do we have a left-adjacent extent? */ | |
| 142 | - | if (start > 0) | |
| 143 | - | left = xbitmap64_tree_iter_first(&bitmap->xb_root, start - 1, | |
| 144 | - | start - 1); | |
| 141 | + | left = xbitmap64_tree_iter_first(&bitmap->xb_root, start - 1, start - 1); | |
| 145 | 142 | ASSERT(!left || left->bn_last + 1 == start); | |
| 146 | 143 | ||
| 147 | 144 | /* Do we have a right-adjacent extent? */ | |
| 148 | - | if (last < U64_MAX) | |
| 149 | - | right = xbitmap64_tree_iter_first(&bitmap->xb_root, last + 1, | |
| 150 | - | last + 1); | |
| 145 | + | right = xbitmap64_tree_iter_first(&bitmap->xb_root, last + 1, last + 1); | |
| 151 | 146 | ASSERT(!right || right->bn_start == last + 1); | |
| 152 | 147 | ||
| 153 | 148 | if (left && right) { | |
| @@ -402,8 +397,8 @@ xbitmap32_set( | |||
| 402 | 397 | uint32_t start, | |
| 403 | 398 | uint32_t len) | |
| 404 | 399 | { | |
| 405 | - | struct xbitmap32_node *left = NULL; | |
| 406 | - | struct xbitmap32_node *right = NULL; | |
| 400 | + | struct xbitmap32_node *left; | |
| 401 | + | struct xbitmap32_node *right; | |
| 407 | 402 | uint32_t last = start + len - 1; | |
| 408 | 403 | int error; | |
| 409 | 404 | ||
| @@ -411,7 +406,6 @@ xbitmap32_set( | |||
| 411 | 406 | left = xbitmap32_tree_iter_first(&bitmap->xb_root, start, last); | |
| 412 | 407 | if (left && left->bn_start <= start && left->bn_last >= last) | |
| 413 | 408 | return 0; | |
| 414 | - | left = NULL; | |
| 415 | 409 | ||
| 416 | 410 | /* Clear out everything in the range we want to set. */ | |
| 417 | 411 | error = xbitmap32_clear(bitmap, start, len); | |
| @@ -419,15 +413,11 @@ xbitmap32_set( | |||
| 419 | 413 | return error; | |
| 420 | 414 | ||
| 421 | 415 | /* Do we have a left-adjacent extent? */ | |
| 422 | - | if (start > 0) | |
| 423 | - | left = xbitmap32_tree_iter_first(&bitmap->xb_root, start - 1, | |
| 424 | - | start - 1); | |
| 416 | + | left = xbitmap32_tree_iter_first(&bitmap->xb_root, start - 1, start - 1); | |
| 425 | 417 | ASSERT(!left || left->bn_last + 1 == start); | |
| 426 | 418 | ||
| 427 | 419 | /* Do we have a right-adjacent extent? */ | |
| 428 | - | if (last < U32_MAX) | |
| 429 | - | right = xbitmap32_tree_iter_first(&bitmap->xb_root, last + 1, | |
| 430 | - | last + 1); | |
| 420 | + | right = xbitmap32_tree_iter_first(&bitmap->xb_root, last + 1, last + 1); | |
| 431 | 421 | ASSERT(!right || right->bn_start == last + 1); | |
| 432 | 422 | ||
| 433 | 423 | if (left && right) { | |
modified fs/xfs/scrub/dir.c
| @@ -492,7 +492,7 @@ xchk_directory_data_bestfree( | |||
| 492 | 492 | goto out; | |
| 493 | 493 | xchk_buffer_recheck(sc, bp); | |
| 494 | 494 | ||
| 495 | - | if (!is_block && xfs_has_crc(sc->mp)) { | |
| 495 | + | if (xfs_has_crc(sc->mp)) { | |
| 496 | 496 | struct xfs_dir3_data_hdr *hdr3 = bp->b_addr; | |
| 497 | 497 | ||
| 498 | 498 | if (hdr3->pad) | |
modified fs/xfs/scrub/dirtree.c
| @@ -1021,7 +1021,7 @@ out: | |||
| 1021 | 1021 | return error; | |
| 1022 | 1022 | } | |
| 1023 | 1023 | ||
| 1024 | - | /* Does the directory targeted by this scrub have no parents? */ | |
| 1024 | + | /* Does the directory targetted by this scrub have no parents? */ | |
| 1025 | 1025 | bool | |
| 1026 | 1026 | xchk_dirtree_parentless(const struct xchk_dirtree *dl) | |
| 1027 | 1027 | { | |
modified fs/xfs/scrub/findparent.c
| @@ -473,9 +473,6 @@ xrep_findparent_from_dcache( | |||
| 473 | 473 | pip = igrab(d_inode(parent)); | |
| 474 | 474 | dput(parent); | |
| 475 | 475 | ||
| 476 | - | if (!pip) | |
| 477 | - | goto out_dput; | |
| 478 | - | ||
| 479 | 476 | if (S_ISDIR(pip->i_mode)) { | |
| 480 | 477 | ret = pip->i_ino; | |
| 481 | 478 | trace_xrep_findparent_from_dcache(sc->ip, ret); | |
modified fs/xfs/scrub/health.c
| @@ -202,9 +202,9 @@ xchk_update_health( | |||
| 202 | 202 | * there's no sick flag defined for it, so we branch here ahead of the | |
| 203 | 203 | * mask check. | |
| 204 | 204 | */ | |
| 205 | - | if (sc->sm->sm_type == XFS_SCRUB_TYPE_HEALTHY) { | |
| 206 | - | if (!(sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)) | |
| 207 | - | xchk_mark_all_healthy(sc->mp); | |
| 205 | + | if (sc->sm->sm_type == XFS_SCRUB_TYPE_HEALTHY && | |
| 206 | + | !(sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)) { | |
| 207 | + | xchk_mark_all_healthy(sc->mp); | |
| 208 | 208 | return; | |
| 209 | 209 | } | |
| 210 | 210 | ||
modified fs/xfs/scrub/inode.c
| @@ -607,7 +607,7 @@ xchk_dinode( | |||
| 607 | 607 | } | |
| 608 | 608 | ||
| 609 | 609 | /* di_forkoff */ | |
| 610 | - | if (dip->di_forkoff >= (XFS_LITINO(mp) >> 3)) | |
| 610 | + | if (XFS_DFORK_BOFF(dip) >= mp->m_sb.sb_inodesize) | |
| 611 | 611 | xchk_ino_set_corrupt(sc, ino); | |
| 612 | 612 | if (naextents != 0 && dip->di_forkoff == 0) | |
| 613 | 613 | xchk_ino_set_corrupt(sc, ino); | |
modified fs/xfs/scrub/inode_repair.c
| @@ -1702,7 +1702,7 @@ xrep_inode_blockcounts( | |||
| 1702 | 1702 | &acount); | |
| 1703 | 1703 | if (error) | |
| 1704 | 1704 | return error; | |
| 1705 | - | if (acount >= sc->mp->m_sb.sb_dblocks) | |
| 1705 | + | if (count >= sc->mp->m_sb.sb_dblocks) | |
| 1706 | 1706 | return -EFSCORRUPTED; | |
| 1707 | 1707 | error = xrep_ino_ensure_extent_count(sc, XFS_ATTR_FORK, | |
| 1708 | 1708 | nextents); | |
modified fs/xfs/scrub/newbt.c
| @@ -193,11 +193,9 @@ xrep_newbt_add_blocks( | |||
| 193 | 193 | struct xrep_newbt_resv *resv; | |
| 194 | 194 | int error; | |
| 195 | 195 | ||
| 196 | - | /* | |
| 197 | - | * We have no way to clean up the allocated space *and* return an | |
| 198 | - | * ENOMEM if we fail to allocate this control structure. | |
| 199 | - | */ | |
| 200 | - | resv = kmalloc_obj(struct xrep_newbt_resv, GFP_KERNEL | __GFP_NOFAIL); | |
| 196 | + | resv = kmalloc_obj(struct xrep_newbt_resv, XCHK_GFP_FLAGS); | |
| 197 | + | if (!resv) | |
| 198 | + | return -ENOMEM; | |
| 201 | 199 | ||
| 202 | 200 | INIT_LIST_HEAD(&resv->list); | |
| 203 | 201 | resv->agbno = XFS_FSB_TO_AGBNO(mp, args->fsbno); | |
modified fs/xfs/scrub/orphanage.c
| @@ -192,16 +192,12 @@ xrep_orphanage_create( | |||
| 192 | 192 | /* Make sure the orphanage is owned by root. */ | |
| 193 | 193 | error = xrep_chown_orphanage(sc, XFS_I(orphanage_inode)); | |
| 194 | 194 | if (error) | |
| 195 | - | goto out_rele_orphanage; | |
| 195 | + | goto out_dput_orphanage; | |
| 196 | 196 | ||
| 197 | 197 | /* Stash the reference for later and bail out. */ | |
| 198 | 198 | sc->orphanage = XFS_I(orphanage_inode); | |
| 199 | 199 | sc->orphanage_ilock_flags = 0; | |
| 200 | - | orphanage_inode = NULL; | |
| 201 | 200 | ||
| 202 | - | out_rele_orphanage: | |
| 203 | - | if (orphanage_inode) | |
| 204 | - | xchk_irele(sc, XFS_I(orphanage_inode)); | |
| 205 | 201 | out_dput_orphanage: | |
| 206 | 202 | end_creating(orphanage_dentry); | |
| 207 | 203 | out_dput_root: | |
modified fs/xfs/scrub/reap.c
| @@ -172,7 +172,7 @@ static inline bool xreap_is_dirty(const struct xreap_state *rs) | |||
| 172 | 172 | } | |
| 173 | 173 | ||
| 174 | 174 | /* | |
| 175 | - | * Decide if we need to roll the transaction to clear out the log | |
| 175 | + | * Decide if we need to roll the transaction to clear out the the log | |
| 176 | 176 | * reservation that we allocated to buffer invalidations. | |
| 177 | 177 | */ | |
| 178 | 178 | static inline bool xreap_want_binval_roll(const struct xreap_state *rs) | |
modified fs/xfs/scrub/repair.c
| @@ -399,7 +399,6 @@ xrep_calc_rtgroup_resblks( | |||
| 399 | 399 | struct xfs_mount *mp = sc->mp; | |
| 400 | 400 | struct xfs_scrub_metadata *sm = sc->sm; | |
| 401 | 401 | uint64_t usedlen; | |
| 402 | - | xfs_extlen_t refcbt_sz = 0; | |
| 403 | 402 | xfs_extlen_t rmapbt_sz = 0; | |
| 404 | 403 | ||
| 405 | 404 | if (!(sm->sm_flags & XFS_SCRUB_IFLAG_REPAIR)) | |
| @@ -412,27 +411,13 @@ xrep_calc_rtgroup_resblks( | |||
| 412 | 411 | usedlen = xfs_rtbxlen_to_blen(mp, xfs_rtgroup_extents(mp, sm->sm_agno)); | |
| 413 | 412 | ASSERT(usedlen <= XFS_MAX_RGBLOCKS); | |
| 414 | 413 | ||
| 415 | - | if (xfs_has_reflink(mp)) | |
| 416 | - | refcbt_sz = xfs_rtrefcountbt_calc_size(mp, usedlen); | |
| 417 | - | ||
| 418 | 414 | if (xfs_has_rmapbt(mp)) | |
| 419 | 415 | rmapbt_sz = xfs_rtrmapbt_calc_size(mp, usedlen); | |
| 420 | 416 | ||
| 421 | - | /* | |
| 422 | - | * Guess how many blocks we need to rebuild the rmapbt. For | |
| 423 | - | * non-reflink filesystems we can't have more records than used blocks. | |
| 424 | - | * However, with reflink it's possible to have more than one rmap | |
| 425 | - | * record per rtgroup block. We don't know how many rmaps there could | |
| 426 | - | * be in the rtgroup, so we start off with what we hope is an generous | |
| 427 | - | * over-estimation. | |
| 428 | - | */ | |
| 429 | - | if (refcbt_sz > 0 && rmapbt_sz > 0) | |
| 430 | - | rmapbt_sz *= 2; | |
| 431 | - | ||
| 432 | 417 | trace_xrep_calc_rtgroup_resblks_btsize(mp, sm->sm_agno, usedlen, | |
| 433 | - | rmapbt_sz, refcbt_sz); | |
| 418 | + | rmapbt_sz); | |
| 434 | 419 | ||
| 435 | - | return max(rmapbt_sz, refcbt_sz); | |
| 420 | + | return rmapbt_sz; | |
| 436 | 421 | } | |
| 437 | 422 | #endif /* CONFIG_XFS_RT */ | |
| 438 | 423 | ||
modified fs/xfs/scrub/rmap.c
| @@ -493,18 +493,11 @@ out: | |||
| 493 | 493 | * If there's an error, set XFAIL and disable the bitmap | |
| 494 | 494 | * cross-referencing checks, but proceed with the scrub anyway. | |
| 495 | 495 | */ | |
| 496 | - | if (error) { | |
| 497 | - | if (!xchk_btree_xref_process_error(sc, sc->sa.rmap_cur, | |
| 498 | - | sc->sa.rmap_cur->bc_nlevels - 1, &error)) { | |
| 499 | - | /* only set incomplete if we didn't set xfail */ | |
| 500 | - | if (error) | |
| 501 | - | xchk_set_incomplete(sc); | |
| 502 | - | } | |
| 503 | - | ||
| 504 | - | return 0; | |
| 505 | - | } | |
| 506 | - | ||
| 507 | - | cr->bitmaps_complete = true; | |
| 496 | + | if (error) | |
| 497 | + | xchk_btree_xref_process_error(sc, sc->sa.rmap_cur, | |
| 498 | + | sc->sa.rmap_cur->bc_nlevels - 1, &error); | |
| 499 | + | else | |
| 500 | + | cr->bitmaps_complete = true; | |
| 508 | 501 | return 0; | |
| 509 | 502 | } | |
| 510 | 503 | ||
| @@ -574,8 +567,7 @@ xchk_rmapbt( | |||
| 574 | 567 | if (error) | |
| 575 | 568 | goto out; | |
| 576 | 569 | ||
| 577 | - | if (cr->bitmaps_complete) | |
| 578 | - | xchk_rmapbt_check_bitmaps(sc, cr); | |
| 570 | + | xchk_rmapbt_check_bitmaps(sc, cr); | |
| 579 | 571 | ||
| 580 | 572 | out: | |
| 581 | 573 | xagb_bitmap_destroy(&cr->refcbt_owned); | |
modified fs/xfs/scrub/rmap_repair.c
| @@ -1109,7 +1109,6 @@ xrep_rmap_try_reserve( | |||
| 1109 | 1109 | return error; | |
| 1110 | 1110 | ||
| 1111 | 1111 | error = xfs_agfl_walk(sc->mp, agf, agfl_bp, xrep_rmap_walk_agfl, &ra); | |
| 1112 | - | xfs_trans_brelse(sc->tp, agfl_bp); | |
| 1113 | 1112 | if (error) | |
| 1114 | 1113 | return error; | |
| 1115 | 1114 | ||
modified fs/xfs/scrub/scrub.h
| @@ -40,7 +40,7 @@ static inline int xchk_maybe_relax(struct xchk_relax *widget) | |||
| 40 | 40 | return 0; | |
| 41 | 41 | widget->resched_nr = 0; | |
| 42 | 42 | ||
| 43 | - | if (unlikely(time_after_eq(jiffies, widget->next_resched))) { | |
| 43 | + | if (unlikely(widget->next_resched <= jiffies)) { | |
| 44 | 44 | cond_resched(); | |
| 45 | 45 | widget->next_resched = XCHK_RELAX_NEXT; | |
| 46 | 46 | } | |
modified fs/xfs/scrub/trace.h
| @@ -2376,29 +2376,25 @@ TRACE_EVENT(xrep_calc_ag_resblks_btsize, | |||
| 2376 | 2376 | #ifdef CONFIG_XFS_RT | |
| 2377 | 2377 | TRACE_EVENT(xrep_calc_rtgroup_resblks_btsize, | |
| 2378 | 2378 | TP_PROTO(struct xfs_mount *mp, xfs_rgnumber_t rgno, | |
| 2379 | - | xfs_rgblock_t usedlen, xfs_rgblock_t rmapbt_sz, | |
| 2380 | - | xfs_rgblock_t refcbt_sz), | |
| 2381 | - | TP_ARGS(mp, rgno, usedlen, rmapbt_sz, refcbt_sz), | |
| 2379 | + | xfs_rgblock_t usedlen, xfs_rgblock_t rmapbt_sz), | |
| 2380 | + | TP_ARGS(mp, rgno, usedlen, rmapbt_sz), | |
| 2382 | 2381 | TP_STRUCT__entry( | |
| 2383 | 2382 | __field(dev_t, dev) | |
| 2384 | 2383 | __field(xfs_rgnumber_t, rgno) | |
| 2385 | 2384 | __field(xfs_rgblock_t, usedlen) | |
| 2386 | 2385 | __field(xfs_rgblock_t, rmapbt_sz) | |
| 2387 | - | __field(xfs_rgblock_t, refcbt_sz) | |
| 2388 | 2386 | ), | |
| 2389 | 2387 | TP_fast_assign( | |
| 2390 | 2388 | __entry->dev = mp->m_super->s_dev; | |
| 2391 | 2389 | __entry->rgno = rgno; | |
| 2392 | 2390 | __entry->usedlen = usedlen; | |
| 2393 | 2391 | __entry->rmapbt_sz = rmapbt_sz; | |
| 2394 | - | __entry->refcbt_sz = refcbt_sz; | |
| 2395 | 2392 | ), | |
| 2396 | - | TP_printk("dev %d:%d rgno 0x%x usedlen %u rmapbt %u refcountbt %u", | |
| 2393 | + | TP_printk("dev %d:%d rgno 0x%x usedlen %u rmapbt %u", | |
| 2397 | 2394 | MAJOR(__entry->dev), MINOR(__entry->dev), | |
| 2398 | 2395 | __entry->rgno, | |
| 2399 | 2396 | __entry->usedlen, | |
| 2400 | - | __entry->rmapbt_sz, | |
| 2401 | - | __entry->refcbt_sz) | |
| 2397 | + | __entry->rmapbt_sz) | |
| 2402 | 2398 | ); | |
| 2403 | 2399 | #endif /* CONFIG_XFS_RT */ | |
| 2404 | 2400 | ||
modified fs/xfs/xfs_bmap_item.c
| @@ -339,7 +339,7 @@ xfs_bmap_update_get_group( | |||
| 339 | 339 | ||
| 340 | 340 | /* | |
| 341 | 341 | * Bump the intent count on behalf of the deferred rmap and refcount | |
| 342 | - | * intent items that we can queue when we finish this bmap work. | |
| 342 | + | * intent items that that we can queue when we finish this bmap work. | |
| 343 | 343 | * This new intent item will bump the intent count before the bmap | |
| 344 | 344 | * intent drops the intent count, ensuring that the intent count | |
| 345 | 345 | * remains nonzero across the transaction roll. | |
modified fs/xfs/xfs_dquot.c
| @@ -139,14 +139,10 @@ xfs_qm_adjust_dqlimits( | |||
| 139 | 139 | dq->q_ino.softlimit = defq->ino.soft; | |
| 140 | 140 | if (!dq->q_ino.hardlimit) | |
| 141 | 141 | dq->q_ino.hardlimit = defq->ino.hard; | |
| 142 | - | if (!dq->q_rtb.softlimit) { | |
| 142 | + | if (!dq->q_rtb.softlimit) | |
| 143 | 143 | dq->q_rtb.softlimit = defq->rtb.soft; | |
| 144 | - | prealloc = 1; | |
| 145 | - | } | |
| 146 | - | if (!dq->q_rtb.hardlimit) { | |
| 144 | + | if (!dq->q_rtb.hardlimit) | |
| 147 | 145 | dq->q_rtb.hardlimit = defq->rtb.hard; | |
| 148 | - | prealloc = 1; | |
| 149 | - | } | |
| 150 | 146 | ||
| 151 | 147 | if (prealloc) | |
| 152 | 148 | xfs_dquot_set_prealloc_limits(dq); | |
modified fs/xfs/xfs_exchrange.c
| @@ -633,9 +633,6 @@ xfs_exchrange_prep( | |||
| 633 | 633 | if (error) | |
| 634 | 634 | return error; | |
| 635 | 635 | ||
| 636 | - | if (fxr->flags & XFS_EXCHANGE_RANGE_DRY_RUN) | |
| 637 | - | return 0; | |
| 638 | - | ||
| 639 | 636 | trace_xfs_exchrange_flush(fxr, ip1, ip2); | |
| 640 | 637 | ||
| 641 | 638 | /* Flush the relevant ranges of both files. */ | |
| @@ -712,11 +709,9 @@ xfs_exchrange_contents( | |||
| 712 | 709 | * other file write would do. This may involve turning on support for | |
| 713 | 710 | * logged xattrs if either file has security capabilities. | |
| 714 | 711 | */ | |
| 715 | - | if (!(fxr->flags & XFS_EXCHANGE_RANGE_DRY_RUN)) { | |
| 716 | - | error = xfs_exchange_range_finish(fxr); | |
| 717 | - | if (error) | |
| 718 | - | goto out_unlock; | |
| 719 | - | } | |
| 712 | + | error = xfs_exchange_range_finish(fxr); | |
| 713 | + | if (error) | |
| 714 | + | goto out_unlock; | |
| 720 | 715 | ||
| 721 | 716 | out_unlock: | |
| 722 | 717 | xfs_iunlock2_io_mmap(ip1, ip2); | |
| @@ -907,7 +902,7 @@ xfs_ioc_commit_range( | |||
| 907 | 902 | ||
| 908 | 903 | if (copy_from_user(&args, argp, sizeof(args))) | |
| 909 | 904 | return -EFAULT; | |
| 910 | - | if (args.pad || (args.flags & ~XFS_EXCHANGE_RANGE_ALL_FLAGS)) | |
| 905 | + | if (args.flags & ~XFS_EXCHANGE_RANGE_ALL_FLAGS) | |
| 911 | 906 | return -EINVAL; | |
| 912 | 907 | if (kern_f->magic != XCR_FRESH_MAGIC) | |
| 913 | 908 | return -EBUSY; | |
modified fs/xfs/xfs_healthmon.c
| @@ -247,9 +247,7 @@ xfs_healthmon_merge_events( | |||
| 247 | 247 | case XFS_HEALTHMON_DIOWRITE: | |
| 248 | 248 | case XFS_HEALTHMON_DATALOST: | |
| 249 | 249 | /* logically adjacent file ranges can merge */ | |
| 250 | - | if (existing->fino != new->fino || | |
| 251 | - | existing->fgen != new->fgen || | |
| 252 | - | existing->error != new->error) | |
| 250 | + | if (existing->fino != new->fino || existing->fgen != new->fgen) | |
| 253 | 251 | return false; | |
| 254 | 252 | ||
| 255 | 253 | if (existing->fpos + existing->flen == new->fpos) { | |
modified fs/xfs/xfs_icache.c
| @@ -1653,7 +1653,7 @@ xfs_blockgc_free_dquots( | |||
| 1653 | 1653 | do_work = true; | |
| 1654 | 1654 | } | |
| 1655 | 1655 | ||
| 1656 | - | if (XFS_IS_GQUOTA_ENFORCED(mp) && gdqp && xfs_dquot_lowsp(gdqp)) { | |
| 1656 | + | if (XFS_IS_UQUOTA_ENFORCED(mp) && gdqp && xfs_dquot_lowsp(gdqp)) { | |
| 1657 | 1657 | icw.icw_gid = make_kgid(mp->m_super->s_user_ns, gdqp->q_id); | |
| 1658 | 1658 | icw.icw_flags |= XFS_ICWALK_FLAG_GID; | |
| 1659 | 1659 | do_work = true; | |
modified fs/xfs/xfs_inode.c
| @@ -2669,7 +2669,7 @@ xfs_irele( | |||
| 2669 | 2669 | } | |
| 2670 | 2670 | ||
| 2671 | 2671 | /* | |
| 2672 | - | * Ensure all committed transactions touching the inode are written to the log. | |
| 2672 | + | * Ensure all commited transactions touching the inode are written to the log. | |
| 2673 | 2673 | */ | |
| 2674 | 2674 | int | |
| 2675 | 2675 | xfs_log_force_inode( | |
modified fs/xfs/xfs_log_cil.c
| @@ -1370,7 +1370,7 @@ xlog_cil_cleanup_whiteouts( | |||
| 1370 | 1370 | * allocation context. However, we do not want to block on memory reclaim | |
| 1371 | 1371 | * recursing back into the filesystem because this push may have been triggered | |
| 1372 | 1372 | * by memory reclaim itself. Hence we really need to run under full GFP_NOFS | |
| 1373 | - | * constraints here. | |
| 1373 | + | * contraints here. | |
| 1374 | 1374 | */ | |
| 1375 | 1375 | static void | |
| 1376 | 1376 | xlog_cil_push_work( | |
modified fs/xfs/xfs_log_recover.c
| @@ -2736,13 +2736,12 @@ xlog_recover_iunlink_bucket( | |||
| 2736 | 2736 | { | |
| 2737 | 2737 | struct xfs_mount *mp = pag_mount(pag); | |
| 2738 | 2738 | struct xfs_inode *prev_ip = NULL; | |
| 2739 | + | struct xfs_inode *ip; | |
| 2739 | 2740 | xfs_agino_t prev_agino, agino; | |
| 2740 | 2741 | int error = 0; | |
| 2741 | 2742 | ||
| 2742 | 2743 | agino = be32_to_cpu(agi->agi_unlinked[bucket]); | |
| 2743 | 2744 | while (agino != NULLAGINO) { | |
| 2744 | - | struct xfs_inode *ip; | |
| 2745 | - | ||
| 2746 | 2745 | error = xfs_iget(mp, NULL, xfs_agino_to_ino(pag, agino), 0, 0, | |
| 2747 | 2746 | &ip); | |
| 2748 | 2747 | if (error) | |
| @@ -2751,11 +2750,11 @@ xlog_recover_iunlink_bucket( | |||
| 2751 | 2750 | ASSERT(VFS_I(ip)->i_nlink == 0); | |
| 2752 | 2751 | ASSERT(VFS_I(ip)->i_mode != 0); | |
| 2753 | 2752 | xfs_iflags_clear(ip, XFS_IRECOVERY); | |
| 2753 | + | agino = ip->i_next_unlinked; | |
| 2754 | 2754 | ||
| 2755 | 2755 | if (prev_ip) { | |
| 2756 | 2756 | ip->i_prev_unlinked = prev_agino; | |
| 2757 | 2757 | xfs_irele(prev_ip); | |
| 2758 | - | prev_ip = NULL; | |
| 2759 | 2758 | ||
| 2760 | 2759 | /* | |
| 2761 | 2760 | * Ensure the inode is removed from the unlinked list | |
| @@ -2767,20 +2766,18 @@ xlog_recover_iunlink_bucket( | |||
| 2767 | 2766 | * complete. | |
| 2768 | 2767 | */ | |
| 2769 | 2768 | error = xfs_inodegc_flush(mp); | |
| 2770 | - | if (error) { | |
| 2771 | - | xfs_irele(ip); | |
| 2772 | - | return error; | |
| 2773 | - | } | |
| 2769 | + | if (error) | |
| 2770 | + | break; | |
| 2774 | 2771 | } | |
| 2775 | 2772 | ||
| 2776 | 2773 | prev_agino = agino; | |
| 2777 | - | agino = ip->i_next_unlinked; | |
| 2778 | 2774 | prev_ip = ip; | |
| 2779 | 2775 | } | |
| 2780 | 2776 | ||
| 2781 | 2777 | if (prev_ip) { | |
| 2782 | 2778 | int error2; | |
| 2783 | 2779 | ||
| 2780 | + | ip->i_prev_unlinked = prev_agino; | |
| 2784 | 2781 | xfs_irele(prev_ip); | |
| 2785 | 2782 | ||
| 2786 | 2783 | error2 = xfs_inodegc_flush(mp); | |
modified fs/xfs/xfs_platform.h
| @@ -153,7 +153,7 @@ static inline void delay(long ticks) | |||
| 153 | 153 | /* | |
| 154 | 154 | * XFS wrapper structure for sysfs support. It depends on external data | |
| 155 | 155 | * structures and is embedded in various internal data structures to implement | |
| 156 | - | * the XFS sysfs object hierarchy. Define it here for broad access throughout | |
| 156 | + | * the XFS sysfs object heirarchy. Define it here for broad access throughout | |
| 157 | 157 | * the codebase. | |
| 158 | 158 | */ | |
| 159 | 159 | struct xfs_kobj { | |
modified fs/xfs/xfs_qm.c
| @@ -1432,22 +1432,16 @@ xfs_qm_flush_one( | |||
| 1432 | 1432 | ||
| 1433 | 1433 | error = xfs_dquot_use_attached_buf(dqp, &bp); | |
| 1434 | 1434 | if (error) | |
| 1435 | - | goto out_dqflock; | |
| 1435 | + | goto out_unlock; | |
| 1436 | 1436 | if (!bp) { | |
| 1437 | 1437 | error = -EFSCORRUPTED; | |
| 1438 | - | goto out_dqflock; | |
| 1438 | + | goto out_unlock; | |
| 1439 | 1439 | } | |
| 1440 | 1440 | ||
| 1441 | 1441 | error = xfs_qm_dqflush(dqp, bp); | |
| 1442 | 1442 | if (!error) | |
| 1443 | 1443 | xfs_buf_delwri_queue(bp, buffer_list); | |
| 1444 | 1444 | xfs_buf_relse(bp); | |
| 1445 | - | mutex_unlock(&dqp->q_qlock); | |
| 1446 | - | xfs_qm_dqrele(dqp); | |
| 1447 | - | return error; | |
| 1448 | - | ||
| 1449 | - | out_dqflock: | |
| 1450 | - | xfs_dqfunlock(dqp); | |
| 1451 | 1445 | out_unlock: | |
| 1452 | 1446 | mutex_unlock(&dqp->q_qlock); | |
| 1453 | 1447 | xfs_qm_dqrele(dqp); | |
modified fs/xfs/xfs_refcount_item.c
| @@ -508,7 +508,6 @@ xfs_refcount_recover_work( | |||
| 508 | 508 | struct xfs_cui_log_item *cuip = CUI_ITEM(lip); | |
| 509 | 509 | struct xfs_trans *tp; | |
| 510 | 510 | struct xfs_mount *mp = lip->li_log->l_mp; | |
| 511 | - | unsigned int dblocks; | |
| 512 | 511 | bool isrt = xfs_cui_item_isrt(lip); | |
| 513 | 512 | int i; | |
| 514 | 513 | int error = 0; | |
| @@ -544,11 +543,8 @@ xfs_refcount_recover_work( | |||
| 544 | 543 | * full btree split on either end of the refcount range. | |
| 545 | 544 | */ | |
| 546 | 545 | resv = xlog_recover_resv(&M_RES(mp)->tr_itruncate); | |
| 547 | - | if (isrt) | |
| 548 | - | dblocks = mp->m_rtrefc_maxlevels * 2; | |
| 549 | - | else | |
| 550 | - | dblocks = mp->m_refc_maxlevels * 2; | |
| 551 | - | error = xfs_trans_alloc(mp, &resv, dblocks, 0, XFS_TRANS_RESERVE, &tp); | |
| 546 | + | error = xfs_trans_alloc(mp, &resv, mp->m_refc_maxlevels * 2, 0, | |
| 547 | + | XFS_TRANS_RESERVE, &tp); | |
| 552 | 548 | if (error) | |
| 553 | 549 | return error; | |
| 554 | 550 | ||
modified fs/xfs/xfs_reflink.h
| @@ -48,6 +48,9 @@ extern int xfs_reflink_end_cow(struct xfs_inode *ip, xfs_off_t offset, | |||
| 48 | 48 | int xfs_reflink_end_atomic_cow(struct xfs_inode *ip, xfs_off_t offset, | |
| 49 | 49 | xfs_off_t count); | |
| 50 | 50 | extern int xfs_reflink_recover_cow(struct xfs_mount *mp); | |
| 51 | + | extern loff_t xfs_reflink_remap_range(struct file *file_in, loff_t pos_in, | |
| 52 | + | struct file *file_out, loff_t pos_out, loff_t len, | |
| 53 | + | unsigned int remap_flags); | |
| 51 | 54 | extern int xfs_reflink_inode_has_shared_extents(struct xfs_trans *tp, | |
| 52 | 55 | struct xfs_inode *ip, bool *has_shared); | |
| 53 | 56 | extern int xfs_reflink_clear_inode_flag(struct xfs_inode *ip, | |
This diff is too large to show in full - only the first part is shown.