Compare
4db45fc1da3d62d0fa6e8f1e457ae92e8741ed07..8ee2a09a1dbb257c9e828ad2497f8e4832dfb142
scsi: libiscsi: Reject a negative task index from parse_pdu_itt
A transport that implements parse_pdu_itt hands libiscsi an index taken
from the PDU, and both lookups bound it from above only:
if (i >= session->cmds_max)
i and cmds_max are both int, so a negative index passes and
session->cmds[i] is read from before the array.
be2iscsi produces one. beiscsi_parse_pdu() assigns the raw tag,
*index = (int)itt;
and beiscsi_complete_pdu() forwards an unsolicited NOP-In from the
hardware async ring without replacing its ITT, so the value is the
target's. It also reports the session's own age rather than the one in
the tag, which leaves the age comparison in iscsi_verify_itt() with
nothing to reject.
Bound the index from below in both lookups.
Fixes: bfead3b2cb46 ("[SCSI] be2iscsi: Adding msix and mcc_rings V3")
Cc: stable@vger.kernel.org
Reviewed-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Yehyeong Lee <yhlee@isslab.korea.ac.kr>
Link: https://patch.msgid.link/20261007015842.634893-2-yhlee@isslab.korea.ac.kr
Signed-off-by: Martin K. Petersen (Oracle) <mkp@kernel.org>
Yehyeong Lee <yhlee@isslab.korea.ac.kr> · 2026-10-07 01:58 UTC · committed by Martin K. Petersen (Oracle)
649 files changed,
+3445
−7730
- .get_maintainer.ignore
- .mailmap
- CREDITS
- Documentation/ABI/testing/ima_policy
- Documentation/ABI/testing/sysfs-class-firmware
- Documentation/ABI/testing/sysfs-devices-platform-trackpoint
- Documentation/ABI/testing/sysfs-fs-erofs
- Documentation/admin-guide/cgroup-v1/memory.rst
- Documentation/admin-guide/cgroup-v2.rst
- Documentation/admin-guide/ext4.rst
- Documentation/admin-guide/kernel-parameters.txt
- Documentation/admin-guide/sysctl/kernel.rst
- Documentation/arch/arm64/booting.rst
- Documentation/arch/arm64/memory-tagging-extension.rst
- Documentation/arch/arm64/silicon-errata.rst
- Documentation/arch/riscv/hwprobe.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/iio/adc/rockchip-saradc.yaml
- Documentation/devicetree/bindings/input/mediatek,mt6779-keypad.yaml
- Documentation/devicetree/bindings/pinctrl/qcom,nord-tlmm.yaml
- Documentation/devicetree/bindings/regulator/fcs,fan53555.yaml
- Documentation/devicetree/bindings/riscv/cpus.yaml
- Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.yaml
- Documentation/fault-injection/nvme-fault-injection.rst
- Documentation/filesystems/netfs_library.rst
- Documentation/filesystems/propagate_umount.txt
- Documentation/filesystems/sharedsubtree.rst
- Documentation/hwmon/cgbc-hwmon.rst
- Documentation/hwmon/gpd-fan.rst
- Documentation/hwmon/hwmon-kernel-api.rst
- Documentation/netlink/specs/conntrack.yaml
- Documentation/netlink/specs/netdev.yaml
- Documentation/netlink/specs/rt-link.yaml
- Documentation/netlink/specs/rt-neigh.yaml
- Documentation/networking/ip-sysctl.rst
- Documentation/networking/strparser.rst
- Documentation/scheduler/sched-ext.rst
- Documentation/trace/events-landlock.rst
- Documentation/translations/zh_CN/arch/riscv/patch-acceptance.rst
- Documentation/translations/zh_CN/core-api/irq/irq-domain.rst
- MAINTAINERS
- Makefile
- arch/arc/Kconfig
- arch/arc/include/asm/atomic64-arcv2.h
- arch/arc/include/asm/cmpxchg.h
- arch/arc/kernel/setup.c
- arch/arc/kernel/smp.c
- arch/arm/mach-socfpga/Kconfig
- arch/arm64/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/crypto/aes-neonbs-glue.c
- arch/arm64/include/asm/cpu.h
- arch/arm64/include/asm/cpufeature.h
- 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/Makefile
- arch/arm64/kernel/cpu_errata.c
- arch/arm64/kernel/cpufeature.c
- arch/arm64/kernel/cpuinfo.c
- arch/arm64/kernel/hibernate-asm.S
- arch/arm64/kernel/hibernate.c
- arch/arm64/kernel/machine_kexec.c
- arch/arm64/kernel/mte.c
- arch/arm64/kernel/pi/idreg-override.c
- arch/arm64/kernel/signal.c
- arch/arm64/kernel/topology.c
- arch/arm64/kernel/vdso/Makefile
- 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/include/nvhe/pkvm.h
- arch/arm64/kvm/hyp/nvhe/hyp-main.c
- 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-init.c
- arch/arm64/kvm/vgic/vgic-its.c
- arch/arm64/kvm/vgic/vgic-v2.c
- arch/arm64/kvm/vgic/vgic-v3.c
- arch/arm64/kvm/vgic/vgic.c
- arch/arm64/mm/fault.c
- arch/arm64/mm/mmu.c
- arch/arm64/net/bpf_jit_comp.c
- arch/arm64/tools/cpucaps
- arch/arm64/tools/sysreg
- arch/loongarch/Kconfig
- arch/loongarch/include/asm/kvm_dmsintc.h
- arch/loongarch/include/asm/kvm_eiointc.h
- arch/loongarch/include/asm/kvm_host.h
- arch/loongarch/include/asm/kvm_ipi.h
- arch/loongarch/include/asm/kvm_pch_pic.h
- arch/loongarch/kernel/kprobes.c
- arch/loongarch/kernel/rethook_trampoline.S
- arch/loongarch/kernel/smp.c
- arch/loongarch/kernel/vmlinux.lds.S
- arch/loongarch/kvm/intc/dmsintc.c
- arch/loongarch/kvm/intc/eiointc.c
- arch/loongarch/kvm/intc/ipi.c
- arch/loongarch/kvm/intc/pch_pic.c
- arch/loongarch/kvm/main.c
- arch/loongarch/kvm/mmu.c
- arch/loongarch/kvm/vcpu.c
- arch/loongarch/kvm/vm.c
- arch/loongarch/net/bpf_jit.c
- arch/loongarch/vdso/Makefile
- arch/mips/Kconfig
- arch/mips/bcm47xx/buttons.c
- 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/include/asm/entry-common.h
- arch/powerpc/kernel/eeh_driver.c
- arch/powerpc/kernel/interrupt.c
- arch/powerpc/kernel/iommu.c
- arch/powerpc/kernel/prom.c
- arch/powerpc/kernel/rtas_pci.c
- arch/powerpc/kernel/syscall.c
- arch/powerpc/kernel/vdso/Makefile
- arch/powerpc/kexec/elf_64.c
- arch/powerpc/kexec/file_load_64.c
- arch/powerpc/kvm/book3s_hv.c
- arch/powerpc/kvm/book3s_hv_nested.c
- arch/powerpc/kvm/book3s_hv_uvmem.c
- arch/powerpc/net/bpf_jit_comp.c
- arch/powerpc/perf/imc-pmu.c
- arch/powerpc/platforms/pasemi/setup.c
- arch/powerpc/platforms/powernv/pci-ioda.c
- arch/powerpc/platforms/ps3/repository.c
- arch/powerpc/platforms/pseries/htmdump.c
- arch/powerpc/platforms/pseries/pci.c
- arch/powerpc/sysdev/xive/common.c
- arch/riscv/Kconfig
- arch/riscv/Kconfig.errata
- arch/riscv/Kconfig.socs
- arch/riscv/errata/sifive/errata.c
- arch/riscv/include/asm/bug.h
- arch/riscv/include/asm/cpufeature.h
- arch/riscv/include/asm/csr.h
- arch/riscv/include/asm/errata_list_vendors.h
- arch/riscv/include/asm/futex.h
- arch/riscv/include/asm/insn-def.h
- arch/riscv/include/asm/scs.h
- arch/riscv/include/asm/switch_to.h
- arch/riscv/include/asm/vector.h
- arch/riscv/include/uapi/asm/vendor/mips.h
- arch/riscv/kernel/cpufeature.c
- arch/riscv/kernel/entry.S
- arch/riscv/kernel/patch.c
- arch/riscv/kernel/process.c
- arch/riscv/kernel/ptrace.c
- arch/riscv/kernel/setup.c
- arch/riscv/kernel/smpboot.c
- arch/riscv/kernel/suspend.c
- arch/riscv/kernel/sys_hwprobe.c
- arch/riscv/kernel/usercfi.c
- arch/riscv/kernel/vdso/Makefile
- arch/riscv/kvm/aia_device.c
- 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/riscv/lib/strnlen.S
- arch/riscv/lib/uaccess.S
- arch/riscv/mm/extable.c
- arch/riscv/mm/init.c
- arch/riscv/net/bpf_jit_comp64.c
- arch/s390/boot/alternative.c
- arch/s390/boot/ipl_parm.c
- arch/s390/boot/physmem_info.c
- arch/s390/crypto/Makefile
- arch/s390/crypto/aes_s390.c
- arch/s390/crypto/hmac_s390.c
- arch/s390/crypto/paes_s390.c
- arch/s390/crypto/phmac_s390.c
- arch/s390/include/asm/cpacf.h
- arch/s390/include/asm/debug.h
- arch/s390/include/asm/pai.h
- arch/s390/include/asm/processor.h
- arch/s390/include/asm/smp.h
- arch/s390/kernel/debug.c
- arch/s390/kernel/diag/diag324.c
- arch/s390/kernel/ipl.c
- arch/s390/kernel/perf_pai.c
- arch/s390/kernel/smp.c
- arch/s390/kernel/topology.c
- arch/s390/kernel/uv.c
- arch/s390/kernel/vdso/Makefile
- arch/s390/kernel/vtime.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/mm/pgalloc.c
- arch/s390/net/bpf_jit_comp.c
- arch/s390/pci/pci_event.c
- arch/s390/pci/pci_report.c
- arch/s390/pci/pci_report.h
- arch/s390/pci/pci_sysfs.c
- arch/um/drivers/vector_transports.c
- arch/x86/Kconfig.cpu
- arch/x86/Makefile
- arch/x86/coco/sev/svsm.c
- arch/x86/crypto/aesni-intel_glue.c
- arch/x86/crypto/aria-aesni-avx2-asm_64.S
- arch/x86/crypto/aria-gfni-avx512-asm_64.S
- arch/x86/entry/entry_fred.c
- arch/x86/entry/vdso/vdso64/Makefile
- 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/cpufeatures.h
- arch/x86/include/asm/div64.h
- arch/x86/include/asm/pgtable.h
- arch/x86/include/asm/text-patching.h
- arch/x86/include/asm/tlb.h
- arch/x86/include/uapi/asm/ptrace-abi.h
- arch/x86/kernel/alternative.c
- arch/x86/kernel/amd_node.c
- arch/x86/kernel/cpu/amd.c
- arch/x86/kernel/cpu/mce/amd.c
- arch/x86/kernel/cpu/mce/core.c
- arch/x86/kernel/cpu/microcode/intel.c
- arch/x86/kernel/itmt.c
- arch/x86/kernel/kprobes/core.c
- arch/x86/kernel/sys_x86_64.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/svm/svm.c
- arch/x86/kvm/svm/svm.h
- 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/mm/pgtable.c
- arch/x86/net/bpf_jit_comp.c
- arch/x86/pci/fixup.c
- arch/x86/um/asm/ptrace.h
- arch/x86/um/ptrace_32.c
- block/bio.c
- block/blk-cgroup.c
- block/blk-mq.c
- block/fops.c
- block/genhd.c
- block/mq-deadline.c
- crypto/aes.c
- drivers/accel/amdxdna/aie2_message.c
- drivers/accel/amdxdna/amdxdna_ctx.c
- drivers/accel/amdxdna/amdxdna_ctx.h
- drivers/accel/amdxdna/amdxdna_gem.c
- drivers/accel/ethosu/ethosu_device.h
- drivers/accel/ethosu/ethosu_drv.c
- drivers/accel/ethosu/ethosu_gem.c
- drivers/accel/ethosu/ethosu_job.c
- drivers/accel/ivpu/ivpu_drv.c
- drivers/accel/ivpu/ivpu_drv.h
- drivers/accel/ivpu/ivpu_fw_log.c
- drivers/accel/ivpu/ivpu_gem.h
- drivers/accel/ivpu/ivpu_ipc.c
- drivers/accel/ivpu/ivpu_job.c
- drivers/accel/ivpu/ivpu_mmu.c
- drivers/accel/ivpu/ivpu_pm.c
- drivers/accel/qaic/qaic_control.c
- drivers/accel/rocket/rocket_job.c
- drivers/accessibility/braille/braille_console.c
- drivers/acpi/irq.c
- drivers/acpi/scan.c
- drivers/android/binder.c
- drivers/android/binder/node.rs
- drivers/android/binder/node/wrapper.rs
- drivers/android/binder/rust_binderfs.c
- drivers/android/binder/thread.rs
- drivers/android/binderfs.c
- drivers/ata/ahci.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/base/property.c
- drivers/base/test/Kconfig
- drivers/base/test/property-entry-test.c
- drivers/block/drbd/drbd_nl_gen.c
- drivers/block/loop.c
- drivers/block/sunvdc.c
- drivers/block/ublk_drv.c
- drivers/block/virtio_blk.c
- drivers/block/zloop.c
- drivers/block/zram/backend_lz4.c
- drivers/bluetooth/btintel.c
- drivers/bluetooth/btintel_pcie.c
- drivers/bluetooth/btmtk.c
- drivers/bluetooth/btmtk.h
- drivers/bluetooth/btmtksdio.c
- drivers/bluetooth/btmtkuart.c
- drivers/bluetooth/btnxpuart.c
- drivers/bluetooth/btqcomsmd.c
- drivers/bluetooth/btrtl.c
- drivers/bluetooth/btusb.c
- drivers/bluetooth/hci_mrvl.c
- drivers/bluetooth/hci_qca.c
- drivers/char/mem.c
- drivers/char/tpm/tpm-interface.c
- drivers/char/tpm/tpm2-cmd.c
- drivers/char/tpm/tpm2-sessions.c
- drivers/char/virtio_console.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/clk/spacemit/ccu-k3.c
- drivers/clk/ti/composite.c
- drivers/clk/ti/mux.c
- drivers/cpufreq/amd-pstate.c
- drivers/cpufreq/cpufreq.c
- drivers/cpufreq/intel_pstate.c
- drivers/cpuidle/cpuidle-psci.c
- drivers/cpuidle/dt_idle_genpd.c
- drivers/crypto/caam/jr.c
- drivers/crypto/inside-secure/eip93/eip93-common.c
- drivers/crypto/intel/qat/qat_common/qat_comp_algs.c
- drivers/crypto/ti/dthev2-aes.c
- drivers/devfreq/hisi_uncore_freq.c
- drivers/dibs/dibs_main.c
- drivers/dma-buf/Kconfig
- drivers/dma-buf/dma-buf-mapping.c
- drivers/dma-buf/dma-buf.c
- drivers/dma-buf/dma-fence.c
- drivers/dma-buf/dma-heap.c
- drivers/dma-buf/st-dma-fence.c
- drivers/dma-buf/udmabuf.c
- 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/switchtec_dma.c
- drivers/dma/ti/k3-udma-glue.c
- drivers/dma/xilinx/xilinx_dma.c
- drivers/dpll/dpll_netlink.c
- drivers/edac/al_mc_edac.c
- drivers/edac/altera_edac.c
- drivers/edac/altera_edac.h
- drivers/edac/amd64_edac.c
- drivers/edac/aspeed_edac.c
- drivers/edac/debugfs.c
- drivers/edac/edac_device.c
- drivers/edac/edac_device_sysfs.c
- drivers/edac/edac_mc_sysfs.c
- drivers/edac/edac_module.h
- drivers/edac/highbank_mc_edac.c
- drivers/edac/ie31200_edac.c
- drivers/edac/igen6_edac.c
- drivers/edac/thunderx_edac.c
- drivers/edac/versalnet_edac.c
- drivers/edac/xgene_edac.c
- drivers/firewire/core-cdev.c
- drivers/firmware/arm_ffa/driver.c
- drivers/firmware/arm_scmi/driver.c
- drivers/firmware/arm_scpi.c
- drivers/firmware/qcom/qcom_tzmem.c
- drivers/firmware/ti_sci.c
- drivers/fpga/dfl-afu-dma-region.c
- drivers/gpio/gpio-aggregator.c
- drivers/gpio/gpio-arizona.c
- drivers/gpio/gpio-exar.c
- drivers/gpio/gpio-mpsse.c
- drivers/gpio/gpio-mvebu.c
- drivers/gpio/gpio-sim.c
- drivers/gpio/gpio-tps65219.c
- drivers/gpio/gpio-virtuser.c
- drivers/gpio/gpio-xilinx.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/buddy.c
- drivers/gpu/drm/adp/Kconfig
- drivers/gpu/drm/amd/amdgpu/amdgpu.h
- drivers/gpu/drm/amd/amdgpu/amdgpu_acp.c
- 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_dev_coredump.c
- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
- drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
- drivers/gpu/drm/amd/amdgpu/amdgpu_dma_buf.c
- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
- drivers/gpu/drm/amd/amdgpu/amdgpu_eviction_fence.c
- drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
- drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
- drivers/gpu/drm/amd/amdgpu/amdgpu_lockdep.c
- drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c
- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
- drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c
- drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c
- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
- drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c
- drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c
- drivers/gpu/drm/amd/amdgpu/amdgpu_userq.h
- drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c
- drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
- drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
- drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c
- drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c
- drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
- drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c
- drivers/gpu/drm/amd/amdgpu/gmc_v12_1.c
- drivers/gpu/drm/amd/amdgpu/mes_userqueue.c
- drivers/gpu/drm/amd/amdgpu/nbio_v7_9.c
- drivers/gpu/drm/amd/amdgpu/sdma_v7_1.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/amdgpu/vi.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/amdkfd/kfd_priv.h
- drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
- drivers/gpu/drm/amd/amdkfd/kfd_svm.c
- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_backlight.c
- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c
- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c
- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.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/amdgpu_dm_mst_types.c
- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c
- drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_connector_test.c
- drivers/gpu/drm/amd/display/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/amdgpu_dm/tests/amdgpu_dm_plane_test.c
- drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_test.c
- drivers/gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c
- drivers/gpu/drm/amd/display/dc/clk_mgr/dcn60/dcn60_clk_mgr.c
- drivers/gpu/drm/amd/display/dc/core/dc.c
- drivers/gpu/drm/amd/display/dc/core/dc_resource.c
- drivers/gpu/drm/amd/display/dc/core/dc_surface.c
- drivers/gpu/drm/amd/display/dc/dc.h
- drivers/gpu/drm/amd/display/dc/dccg/dcn42/dcn42_dccg.c
- drivers/gpu/drm/amd/display/dc/dccg/dcn60/dcn60_dccg.c
- drivers/gpu/drm/amd/display/dc/dcn30/dcn30_cm_common.c
- drivers/gpu/drm/amd/display/dc/dml/Makefile
- drivers/gpu/drm/amd/display/dc/dml2_0/Makefile
- drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_dcn5_funcs_mode_programming.c
- drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_core/dml2_core_shared_types.h
- drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_pmo/dml2_pmo_dcn6_stage_optimizers.c
- drivers/gpu/drm/amd/display/dc/dml2_0/dml2_translation_helper.c
- drivers/gpu/drm/amd/display/dc/gpio/hw_ddc.c
- 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/display/dc/irq/dcn42/irq_service_dcn42.c
- drivers/gpu/drm/amd/display/dc/irq/dcn60/irq_service_dcn60.c
- drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_dpia_bw.c
- drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.c
- drivers/gpu/drm/amd/display/dc/pg/dcn42/dcn42_pg_cntl.c
- drivers/gpu/drm/amd/display/dc/resource/dce60/dce60_resource.c
- drivers/gpu/drm/amd/display/dc/resource/dce80/dce80_resource.c
- drivers/gpu/drm/amd/display/dc/resource/dcn30/dcn30_resource.c
- drivers/gpu/drm/amd/display/dc/resource/dcn302/dcn302_resource.c
- drivers/gpu/drm/amd/display/dc/resource/dcn303/dcn303_resource.c
- drivers/gpu/drm/amd/display/dc/resource/dcn31/dcn31_resource.c
- drivers/gpu/drm/amd/display/dc/resource/dcn314/dcn314_resource.c
- drivers/gpu/drm/amd/display/dc/resource/dcn315/dcn315_resource.c
- drivers/gpu/drm/amd/display/dc/resource/dcn316/dcn316_resource.c
- drivers/gpu/drm/amd/display/dc/resource/dcn32/dcn32_resource.c
- drivers/gpu/drm/amd/display/dc/resource/dcn321/dcn321_resource.c
- drivers/gpu/drm/amd/display/dc/resource/dcn35/dcn35_resource.c
- drivers/gpu/drm/amd/display/dc/resource/dcn351/dcn351_resource.c
- drivers/gpu/drm/amd/display/dc/resource/dcn36/dcn36_resource.c
- drivers/gpu/drm/amd/display/dc/resource/dcn401/dcn401_resource.c
- drivers/gpu/drm/amd/display/dc/resource/dcn42/dcn42_resource.c
- drivers/gpu/drm/amd/display/dc/resource/dcn42b/dcn42b_resource.c
- drivers/gpu/drm/amd/display/dc/resource/dcn60/dcn60_resource.c
- drivers/gpu/drm/amd/display/modules/power/power.c
- drivers/gpu/drm/amd/display/modules/power/power_abm.c
- drivers/gpu/drm/amd/pm/amdgpu_dpm.c
- drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c
- drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c
- drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
- drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c
- drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_2_ppt.c
- drivers/gpu/drm/amd/pm/swsmu/smu15/smu_v15_0_8_ppt.c
- drivers/gpu/drm/amd/ras/core/cmd.c
- drivers/gpu/drm/aspeed/aspeed_gfx_drv.c
- drivers/gpu/drm/ast/ast_cursor.c
- drivers/gpu/drm/bridge/samsung-dsim.c
- drivers/gpu/drm/bridge/tc358768.c
- drivers/gpu/drm/bridge/th1520-dw-hdmi.c
- drivers/gpu/drm/bridge/ti-sn65dsi83.c
- drivers/gpu/drm/ci/xfails/msm-apq8016-fails.txt
- drivers/gpu/drm/clients/drm_fbdev_client.c
- drivers/gpu/drm/display/drm_dp_helper.c
- drivers/gpu/drm/drm_atomic_state_helper.c
- drivers/gpu/drm/drm_atomic_uapi.c
- drivers/gpu/drm/drm_bridge.c
- drivers/gpu/drm/drm_exec.c
- drivers/gpu/drm/drm_fb_helper.c
- drivers/gpu/drm/drm_pagemap.c
- drivers/gpu/drm/drm_panic_qr.rs
- drivers/gpu/drm/drm_prime.c
- drivers/gpu/drm/drm_syncobj.c
- drivers/gpu/drm/gud/gud_connector.c
- drivers/gpu/drm/gud/gud_drv.c
- drivers/gpu/drm/gud/gud_pipe.c
- drivers/gpu/drm/i915/display/intel_cdclk.c
- drivers/gpu/drm/i915/display/intel_cursor.c
- drivers/gpu/drm/i915/display/intel_cx0_phy.c
- drivers/gpu/drm/i915/display/intel_ddi.c
- drivers/gpu/drm/i915/display/intel_ddi.h
- drivers/gpu/drm/i915/display/intel_display_params.c
- drivers/gpu/drm/i915/display/intel_display_params.h
- drivers/gpu/drm/i915/display/intel_display_types.h
- drivers/gpu/drm/i915/display/intel_dp.c
- 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_lt_phy.c
- drivers/gpu/drm/i915/display/intel_psr.c
- drivers/gpu/drm/i915/display/intel_quirks.c
- drivers/gpu/drm/i915/display/intel_vrr.c
- drivers/gpu/drm/i915/display/skl_universal_plane.c
- drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
- drivers/gpu/drm/i915/gem/i915_gem_object.c
- drivers/gpu/drm/i915/gt/intel_rps.c
- drivers/gpu/drm/i915/i915_pci.c
- drivers/gpu/drm/i915/i915_query.c
- drivers/gpu/drm/imagination/pvr_free_list.c
- drivers/gpu/drm/imagination/pvr_mmu.c
- drivers/gpu/drm/imagination/pvr_mmu.h
- drivers/gpu/drm/imagination/pvr_vm.c
- drivers/gpu/drm/logicvc/Kconfig
- drivers/gpu/drm/loongson/lsdc_plane.c
- drivers/gpu/drm/mediatek/mtk_drm_drv.c
- drivers/gpu/drm/mediatek/mtk_hdmi_ddc_v2.c
- drivers/gpu/drm/mediatek/mtk_hdmi_regs_v2.h
- drivers/gpu/drm/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/include/nvif/cl0080.h
- drivers/gpu/drm/nouveau/include/nvif/device.h
- drivers/gpu/drm/nouveau/include/nvkm/engine/disp.h
- drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h
- drivers/gpu/drm/nouveau/nouveau_abi16.c
- drivers/gpu/drm/nouveau/nouveau_bo.c
- drivers/gpu/drm/nouveau/nouveau_chan.c
- drivers/gpu/drm/nouveau/nouveau_connector.c
- drivers/gpu/drm/nouveau/nouveau_dmem.c
- drivers/gpu/drm/nouveau/nouveau_drm.c
- drivers/gpu/drm/nouveau/nouveau_gem.c
- drivers/gpu/drm/nouveau/nouveau_sched.c
- drivers/gpu/drm/nouveau/nouveau_sched.h
- drivers/gpu/drm/nouveau/nouveau_sgdma.c
- drivers/gpu/drm/nouveau/nouveau_uvmm.c
- drivers/gpu/drm/nouveau/nvif/device.c
- drivers/gpu/drm/nouveau/nvif/vmm.c
- drivers/gpu/drm/nouveau/nvkm/engine/device/base.c
- drivers/gpu/drm/nouveau/nvkm/engine/device/ctrl.c
- drivers/gpu/drm/nouveau/nvkm/engine/device/user.c
- drivers/gpu/drm/nouveau/nvkm/engine/disp/Kbuild
- drivers/gpu/drm/nouveau/nvkm/engine/disp/ga102.c
- drivers/gpu/drm/nouveau/nvkm/engine/disp/gb202.c
- drivers/gpu/drm/nouveau/nvkm/engine/disp/head.h
- drivers/gpu/drm/nouveau/nvkm/engine/disp/ior.h
- drivers/gpu/drm/nouveau/nvkm/engine/disp/priv.h
- drivers/gpu/drm/nouveau/nvkm/engine/disp/tu102.c
- drivers/gpu/drm/nouveau/nvkm/engine/disp/uoutp.c
- drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c
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
| @@ -19,8 +19,7 @@ Abhinav Kumar <quic_abhinavk@quicinc.com> <abhinavk@codeaurora.org> | |||
| 19 | 19 | Ahmad Masri <quic_amasri@quicinc.com> <amasri@codeaurora.org> | |
| 20 | 20 | Adam Oldham <oldhamca@gmail.com> | |
| 21 | 21 | Adam Radford <aradford@gmail.com> | |
| 22 | - | Aditya Garg <aditya.garg@linux.dev> <gargaditya08@live.com> | |
| 23 | - | Aditya Garg <aditya.garg@linux.dev> <gargaditya08@proton.me> | |
| 22 | + | Aditya Garg <gargaditya08@proton.me> <gargaditya08@live.com> | |
| 24 | 23 | Adriana Reus <adi.reus@gmail.com> <adriana.reus@intel.com> | |
| 25 | 24 | Adrian Bunk <bunk@stusta.de> | |
| 26 | 25 | Ajay Kaher <ajay.kaher@broadcom.com> <akaher@vmware.com> | |
| @@ -101,7 +100,6 @@ Andy Chiu <andybnac@gmail.com> <andy.chiu@sifive.com> | |||
| 101 | 100 | Andy Chiu <andybnac@gmail.com> <taochiu@synology.com> | |
| 102 | 101 | Andy Shevchenko <andy@kernel.org> <andy@smile.org.ua> | |
| 103 | 102 | Andy Shevchenko <andy@kernel.org> <ext-andriy.shevchenko@nokia.com> | |
| 104 | - | Andy Yan <andyshrk@163.com> <andy.yan@rock-chips.com> | |
| 105 | 103 | Anilkumar Kolli <quic_akolli@quicinc.com> <akolli@codeaurora.org> | |
| 106 | 104 | Anirudh Ghayal <quic_aghayal@quicinc.com> <aghayal@codeaurora.org> | |
| 107 | 105 | Antoine Tenart <atenart@kernel.org> <antoine.tenart@bootlin.com> | |
| @@ -212,8 +210,7 @@ Christophe Leroy <chleroy@kernel.org> <christophe.leroy@c-s.fr> | |||
| 212 | 210 | Christophe Leroy <chleroy@kernel.org> <christophe.leroy@csgroup.eu> | |
| 213 | 211 | Christophe Leroy <chleroy@kernel.org> <christophe.leroy2@cs-soprasteria.com> | |
| 214 | 212 | Christophe Ricard <christophe.ricard@gmail.com> | |
| 215 | - | Christopher Obbard <chris.obbard@oss.qualcomm.com> <chris.obbard@collabora.com> | |
| 216 | - | Christopher Obbard <chris.obbard@oss.qualcomm.com> <christopher.obbard@linaro.org> | |
| 213 | + | Christopher Obbard <christopher.obbard@linaro.org> <chris.obbard@collabora.com> | |
| 217 | 214 | Christoph Hellwig <hch@lst.de> | |
| 218 | 215 | Christoph Manszewski <c.manszewski@gmail.com> <christoph.manszewski@intel.com> | |
| 219 | 216 | Christoph Paasch <cpaasch@openai.com> <christoph.paasch@gmail.com> | |
| @@ -224,7 +221,6 @@ Chuck Lever <cel@kernel.org> <chuck.lever@oracle.com> | |||
| 224 | 221 | Chuck Lever <cel@kernel.org> <cel@netapp.com> | |
| 225 | 222 | Chuck Lever <cel@kernel.org> <cel@citi.umich.edu> | |
| 226 | 223 | Claudiu Beznea <claudiu.beznea@tuxon.dev> <claudiu.beznea@microchip.com> | |
| 227 | - | Coiby Xu <coiby.xu@gmail.com> <coxu@redhat.com> | |
| 228 | 224 | Colin Ian King <colin.i.king@gmail.com> <colin.king@canonical.com> | |
| 229 | 225 | Corey Minyard <minyard@acm.org> | |
| 230 | 226 | Damian Hobson-Garcia <dhobsong@igel.co.jp> | |
| @@ -287,8 +283,6 @@ Ed L. Cashin <ecashin@coraid.com> | |||
| 287 | 283 | Elliot Berman <quic_eberman@quicinc.com> <eberman@codeaurora.org> | |
| 288 | 284 | Enric Balletbo i Serra <eballetbo@kernel.org> <enric.balletbo@collabora.com> | |
| 289 | 285 | Enric Balletbo i Serra <eballetbo@kernel.org> <eballetbo@iseebcn.com> | |
| 290 | - | Eric Dumazet <edumazet@kernel.org> <edumazet@google.com> | |
| 291 | - | Eric Dumazet <edumazet@kernel.org> <eric.dumazet@gmail.com> | |
| 292 | 286 | Erik Kaneda <erik.kaneda@intel.com> <erik.schmauss@intel.com> | |
| 293 | 287 | Ethan Carter Edwards <ethan@ethancedwards.com> Ethan Edwards <ethancarteredwards@gmail.com> | |
| 294 | 288 | Eugen Hristev <ehristev@kernel.org> <eugen.hristev@microchip.com> | |
| @@ -358,8 +352,6 @@ Hans Verkuil <hverkuil@kernel.org> <hverkuil-cisco@xs4all.nl> | |||
| 358 | 352 | Hans Verkuil <hverkuil@kernel.org> <hansverk@cisco.com> | |
| 359 | 353 | Hans Verkuil <hverkuil@kernel.org> <hans.verkuil@cisco.com> | |
| 360 | 354 | Hao Ge <hao.ge@linux.dev> <gehao@kylinos.cn> | |
| 361 | - | Haowen Bai <baihaowen88@gmail.com> <baihaowen@meizu.com> | |
| 362 | - | Haowen Bai <baihaowen88@gmail.com> <calvin.bai@ugreen.com> | |
| 363 | 355 | Harry Yoo <harry.yoo@oracle.com> <42.hyeyoo@gmail.com> | |
| 364 | 356 | Harry Yoo <harry@kernel.org> <harry.yoo@oracle.com> | |
| 365 | 357 | Heiko Carstens <hca@linux.ibm.com> <h.carstens@de.ibm.com> | |
| @@ -428,7 +420,6 @@ Jens Axboe <axboe@kernel.dk> <axboe@suse.de> | |||
| 428 | 420 | Jens Axboe <axboe@kernel.dk> <jens.axboe@oracle.com> | |
| 429 | 421 | Jens Axboe <axboe@kernel.dk> <axboe@fb.com> | |
| 430 | 422 | Jens Axboe <axboe@kernel.dk> <axboe@meta.com> | |
| 431 | - | Jens Axboe <axboe@kernel.dk> <axboe@anthropic.com> | |
| 432 | 423 | Jens Osterkamp <Jens.Osterkamp@de.ibm.com> | |
| 433 | 424 | Jens Wiklander <jenswi@kernel.org> <jens.wiklander@linaro.org> | |
| 434 | 425 | Jernej Skrabec <jernej.skrabec@gmail.com> <jernej.skrabec@siol.net> | |
| @@ -462,8 +453,7 @@ Johan Hovold <johan@kernel.org> <jhovold@gmail.com> | |||
| 462 | 453 | Johan Hovold <johan@kernel.org> <johan@hovoldconsulting.com> | |
| 463 | 454 | John Crispin <john@phrozen.org> <blogic@openwrt.org> | |
| 464 | 455 | John Fastabend <john.fastabend@gmail.com> <john.r.fastabend@intel.com> | |
| 465 | - | John Garry <john.garry@linux.dev> <john.garry@huawei.com> | |
| 466 | - | John Garry <john.garry@linux.dev> <john.g.garry@oracle.com> | |
| 456 | + | John Garry <john.g.garry@oracle.com> <john.garry@huawei.com> | |
| 467 | 457 | John Keeping <john@keeping.me.uk> <john@metanate.com> | |
| 468 | 458 | John Moon <john@jmoon.dev> <quic_johmoo@quicinc.com> | |
| 469 | 459 | John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de> | |
| @@ -488,7 +478,6 @@ Juha Yrjola <juha.yrjola@nokia.com> | |||
| 488 | 478 | Juha Yrjola <juha.yrjola@solidboot.com> | |
| 489 | 479 | Julien Thierry <julien.thierry.kdev@gmail.com> <julien.thierry@arm.com> | |
| 490 | 480 | Justin Iurman <justin.iurman@gmail.com> <justin.iurman@uliege.be> | |
| 491 | - | Imre Kaloz <kaloz@kernel.org> <kaloz@openwrt.org> | |
| 492 | 481 | Ira Weiny <iweiny@kernel.org> <ira.weiny@intel.com> | |
| 493 | 482 | Iskren Chernev <me@iskren.info> <iskren.chernev@gmail.com> | |
| 494 | 483 | Kalle Valo <kvalo@kernel.org> <kvalo@codeaurora.org> | |
| @@ -561,9 +550,6 @@ Li Yang <leoyang.li@nxp.com> <leo@zh-kernel.org> | |||
| 561 | 550 | Lior David <quic_liord@quicinc.com> <liord@codeaurora.org> | |
| 562 | 551 | Loic Poulain <loic.poulain@oss.qualcomm.com> <loic.poulain@linaro.org> | |
| 563 | 552 | Loic Poulain <loic.poulain@oss.qualcomm.com> <loic.poulain@intel.com> | |
| 564 | - | Lorenzo Bianconi <lorenzo@kernel.org> <lorenzo.bianconi@redhat.com> | |
| 565 | - | Lorenzo Bianconi <lorenzo@kernel.org> <lorenzo.bianconi@st.com> | |
| 566 | - | Lorenzo Bianconi <lorenzo@kernel.org> <lorenzo.bianconi83@gmail.com> | |
| 567 | 553 | Lorenzo Pieralisi <lpieralisi@kernel.org> <lorenzo.pieralisi@arm.com> | |
| 568 | 554 | Lorenzo Stoakes <ljs@kernel.org> <lstoakes@gmail.com> | |
| 569 | 555 | Lorenzo Stoakes <ljs@kernel.org> <lorenzo.stoakes@oracle.com> | |
| @@ -713,7 +699,6 @@ Oliver Hartkopp <socketcan@hartkopp.net> <oliver.hartkopp@volkswagen.de> | |||
| 713 | 699 | Oliver Hartkopp <socketcan@hartkopp.net> <oliver@hartkopp.net> | |
| 714 | 700 | Oliver Upton <oupton@kernel.org> <oupton@google.com> | |
| 715 | 701 | Oliver Upton <oupton@kernel.org> <oliver.upton@linux.dev> | |
| 716 | - | Ondrej Mosnáček <omosnacek@gmail.com> <omosnace@redhat.com> | |
| 717 | 702 | Ondřej Jirman <megi@xff.cz> <megous@megous.com> | |
| 718 | 703 | Oza Pawandeep <quic_poza@quicinc.com> <poza@codeaurora.org> | |
| 719 | 704 | Pali Rohár <pali@kernel.org> <pali.rohar@gmail.com> | |
| @@ -913,8 +898,7 @@ Thomas Graf <tgraf@suug.ch> | |||
| 913 | 898 | Thomas Gleixner <tglx@kernel.org> <tglx@linutronix.de> | |
| 914 | 899 | Thomas Körper <socketcan@esd.eu> <thomas.koerper@esd.eu> | |
| 915 | 900 | Thomas Pedersen <twp@codeaurora.org> | |
| 916 | - | Thorsten Blum <blum@kernel.org> <thorsten.blum@toblux.com> | |
| 917 | - | Thorsten Blum <blum@kernel.org> <thorsten.blum@linux.dev> | |
| 901 | + | Thorsten Blum <thorsten.blum@linux.dev> <thorsten.blum@toblux.com> | |
| 918 | 902 | Tiezhu Yang <yangtiezhu@loongson.cn> <kernelpatch@126.com> | |
| 919 | 903 | Tingwei Zhang <quic_tingwei@quicinc.com> <tingwei@codeaurora.org> | |
| 920 | 904 | Tirupathi Reddy <quic_tirupath@quicinc.com> <tirupath@codeaurora.org> | |
| @@ -982,7 +966,6 @@ Vladimir Davydov <vdavydov.dev@gmail.com> <vdavydov@virtuozzo.com> | |||
| 982 | 966 | Vlastimil Babka <vbabka@kernel.org> <vbabka@suse.cz> | |
| 983 | 967 | WangYuli <wangyuli@aosc.io> <wangyl5933@chinaunicom.cn> | |
| 984 | 968 | WangYuli <wangyuli@aosc.io> <wangyuli@deepin.org> | |
| 985 | - | Wei Wang <weiwan@google.com> <weibunny@fb.com> | |
| 986 | 969 | Weiwen Hu <huweiwen@linux.alibaba.com> <sehuww@mail.scut.edu.cn> | |
| 987 | 970 | WeiXiong Liao <gmpy.liaowx@gmail.com> <liaoweixiong@allwinnertech.com> | |
| 988 | 971 | Wen Gong <quic_wgong@quicinc.com> <wgong@codeaurora.org> | |
| @@ -990,8 +973,6 @@ Wesley Cheng <quic_wcheng@quicinc.com> <wcheng@codeaurora.org> | |||
| 990 | 973 | Will Deacon <will@kernel.org> <will.deacon@arm.com> | |
| 991 | 974 | Wolfram Sang <wsa@kernel.org> <w.sang@pengutronix.de> | |
| 992 | 975 | Wolfram Sang <wsa@kernel.org> <wsa@the-dreams.de> | |
| 993 | - | Xu Xin <xu.xin@linux.dev> <xu.xin16@zte.com.cn> | |
| 994 | - | Xu Xin <xu.xin@linux.dev> xu xin <cgel.zte@gmail.com> | |
| 995 | 976 | Yakir Yang <kuankuan.y@gmail.com> <ykk@rock-chips.com> | |
| 996 | 977 | Yanteng Si <si.yanteng@linux.dev> <siyanteng@loongson.cn> | |
| 997 | 978 | Ying Huang <huang.ying.caritas@gmail.com> <ying.huang@intel.com> | |
modified CREDITS
| @@ -1512,10 +1512,6 @@ N: Andy Gross | |||
| 1512 | 1512 | E: agross@kernel.org | |
| 1513 | 1513 | D: Qualcomm SoC subsystem and drivers | |
| 1514 | 1514 | ||
| 1515 | - | N: Mark Gross | |
| 1516 | - | E: markgross@kernel.org | |
| 1517 | - | D: x86/mellanox platform maintenance and various x86 specific drivers | |
| 1518 | - | ||
| 1519 | 1515 | N: Grant Grundler | |
| 1520 | 1516 | E: grantgrundler@gmail.com | |
| 1521 | 1517 | W: http://obmouse.sourceforge.net/ | |
| @@ -4309,10 +4305,6 @@ N: Juergen Weigert | |||
| 4309 | 4305 | E: jnweiger@immd4.informatik.uni-erlangen.de | |
| 4310 | 4306 | D: The Linux Support Team Erlangen | |
| 4311 | 4307 | ||
| 4312 | - | N: Russ Weight | |
| 4313 | - | E: russ.weight@gmail.com | |
| 4314 | - | D: Added support for Firmware Upload to the Firmware Loader | |
| 4315 | - | ||
| 4316 | 4308 | N: David Weinehall | |
| 4317 | 4309 | E: tao@acc.umu.se | |
| 4318 | 4310 | P: 1024D/DC47CA16 7ACE 0FB0 7A74 F994 9B36 E1D1 D14E 8526 DC47 CA16 | |
modified Documentation/ABI/testing/ima_policy
| @@ -108,9 +108,6 @@ Description: | |||
| 108 | 108 | # NSFS_MAGIC | |
| 109 | 109 | dont_measure fsmagic=0x6e736673 | |
| 110 | 110 | dont_appraise fsmagic=0x6e736673 | |
| 111 | - | # CONFIGFS_MAGIC | |
| 112 | - | dont_measure fsmagic=0x62656570 | |
| 113 | - | dont_appraise fsmagic=0x62656570 | |
| 114 | 111 | ||
| 115 | 112 | measure func=BPRM_CHECK | |
| 116 | 113 | measure func=FILE_MMAP mask=MAY_EXEC | |
modified Documentation/ABI/testing/sysfs-class-firmware
| @@ -1,7 +1,7 @@ | |||
| 1 | 1 | What: /sys/class/firmware/.../data | |
| 2 | 2 | Date: July 2022 | |
| 3 | 3 | KernelVersion: 5.19 | |
| 4 | - | Contact: driver-core@lists.linux.dev | |
| 4 | + | Contact: Russ Weight <russ.weight@linux.dev> | |
| 5 | 5 | Description: The data sysfs file is used for firmware-fallback and for | |
| 6 | 6 | firmware uploads. Cat a firmware image to this sysfs file | |
| 7 | 7 | after you echo 1 to the loading sysfs file. When the firmware | |
| @@ -13,7 +13,7 @@ Description: The data sysfs file is used for firmware-fallback and for | |||
| 13 | 13 | What: /sys/class/firmware/.../cancel | |
| 14 | 14 | Date: July 2022 | |
| 15 | 15 | KernelVersion: 5.19 | |
| 16 | - | Contact: driver-core@lists.linux.dev | |
| 16 | + | Contact: Russ Weight <russ.weight@linux.dev> | |
| 17 | 17 | Description: Write-only. For firmware uploads, write a "1" to this file to | |
| 18 | 18 | request that the transfer of firmware data to the lower-level | |
| 19 | 19 | device be canceled. This request will be rejected (EBUSY) if | |
| @@ -23,7 +23,7 @@ Description: Write-only. For firmware uploads, write a "1" to this file to | |||
| 23 | 23 | What: /sys/class/firmware/.../error | |
| 24 | 24 | Date: July 2022 | |
| 25 | 25 | KernelVersion: 5.19 | |
| 26 | - | Contact: driver-core@lists.linux.dev | |
| 26 | + | Contact: Russ Weight <russ.weight@linux.dev> | |
| 27 | 27 | Description: Read-only. Returns a string describing a failed firmware | |
| 28 | 28 | upload. This string will be in the form of <STATUS>:<ERROR>, | |
| 29 | 29 | where <STATUS> will be one of the status strings described | |
| @@ -37,7 +37,7 @@ Description: Read-only. Returns a string describing a failed firmware | |||
| 37 | 37 | What: /sys/class/firmware/.../loading | |
| 38 | 38 | Date: July 2022 | |
| 39 | 39 | KernelVersion: 5.19 | |
| 40 | - | Contact: driver-core@lists.linux.dev | |
| 40 | + | Contact: Russ Weight <russ.weight@linux.dev> | |
| 41 | 41 | Description: The loading sysfs file is used for both firmware-fallback and | |
| 42 | 42 | for firmware uploads. Echo 1 onto the loading file to indicate | |
| 43 | 43 | you are writing a firmware file to the data sysfs node. Echo | |
| @@ -49,7 +49,7 @@ Description: The loading sysfs file is used for both firmware-fallback and | |||
| 49 | 49 | What: /sys/class/firmware/.../remaining_size | |
| 50 | 50 | Date: July 2022 | |
| 51 | 51 | KernelVersion: 5.19 | |
| 52 | - | Contact: driver-core@lists.linux.dev | |
| 52 | + | Contact: Russ Weight <russ.weight@linux.dev> | |
| 53 | 53 | Description: Read-only. For firmware upload, this file contains the size | |
| 54 | 54 | of the firmware data that remains to be transferred to the | |
| 55 | 55 | lower-level device driver. The size value is initialized to | |
| @@ -62,7 +62,7 @@ Description: Read-only. For firmware upload, this file contains the size | |||
| 62 | 62 | What: /sys/class/firmware/.../status | |
| 63 | 63 | Date: July 2022 | |
| 64 | 64 | KernelVersion: 5.19 | |
| 65 | - | Contact: driver-core@lists.linux.dev | |
| 65 | + | Contact: Russ Weight <russ.weight@linux.dev> | |
| 66 | 66 | Description: Read-only. Returns a string describing the current status of | |
| 67 | 67 | a firmware upload. The string will be one of the following: | |
| 68 | 68 | idle, "receiving", "preparing", "transferring", "programming". | |
| @@ -70,7 +70,7 @@ Description: Read-only. Returns a string describing the current status of | |||
| 70 | 70 | What: /sys/class/firmware/.../timeout | |
| 71 | 71 | Date: July 2022 | |
| 72 | 72 | KernelVersion: 5.19 | |
| 73 | - | Contact: driver-core@lists.linux.dev | |
| 73 | + | Contact: Russ Weight <russ.weight@linux.dev> | |
| 74 | 74 | Description: This file supports the timeout mechanism for firmware | |
| 75 | 75 | fallback. This file has no affect on firmware uploads. For | |
| 76 | 76 | more information on timeouts please see the documentation | |
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/ABI/testing/sysfs-fs-erofs
| @@ -5,7 +5,7 @@ Description: Shows all enabled kernel features. | |||
| 5 | 5 | Supported features: | |
| 6 | 6 | compr_cfgs, big_pcluster, chunked_file, device_table, | |
| 7 | 7 | compr_head2, sb_chksum, ztailpacking, dedupe, fragments, | |
| 8 | - | xattr_prefixes, 48bit, metabox. | |
| 8 | + | 48bit, metabox. | |
| 9 | 9 | ||
| 10 | 10 | What: /sys/fs/erofs/<disk>/sync_decompress | |
| 11 | 11 | Date: November 2021 | |
modified Documentation/admin-guide/cgroup-v1/memory.rst
| @@ -47,6 +47,7 @@ Features: | |||
| 47 | 47 | - pages are linked to per-memcg LRU exclusively, and there is no global LRU. | |
| 48 | 48 | - optionally, memory+swap usage can be accounted and limited. | |
| 49 | 49 | - hierarchical accounting | |
| 50 | + | - soft limit | |
| 50 | 51 | - moving (recharging) account at moving a task is selectable. | |
| 51 | 52 | - usage threshold notifier | |
| 52 | 53 | - memory pressure notifier | |
| @@ -75,9 +76,10 @@ Brief summary of control files. | |||
| 75 | 76 | memory.memsw.failcnt show the number of memory+Swap hits limits | |
| 76 | 77 | memory.max_usage_in_bytes show max memory usage recorded | |
| 77 | 78 | memory.memsw.max_usage_in_bytes show max memory+Swap usage recorded | |
| 78 | - | memory.soft_limit_in_bytes This knob is deprecated and has no effect. | |
| 79 | - | Writes are ignored and reads always | |
| 80 | - | return the maximum value. | |
| 79 | + | memory.soft_limit_in_bytes set/show soft limit of memory usage | |
| 80 | + | This knob is not available on CONFIG_PREEMPT_RT systems. | |
| 81 | + | This knob is deprecated and shouldn't be | |
| 82 | + | used. | |
| 81 | 83 | memory.stat show various statistics | |
| 82 | 84 | memory.use_hierarchy set/show hierarchical account enabled | |
| 83 | 85 | This knob is deprecated and shouldn't be | |
| @@ -338,6 +340,9 @@ memory.kmem.usage_in_bytes, or in a separate counter when it makes sense. | |||
| 338 | 340 | The main "kmem" counter is fed into the main counter, so kmem charges will | |
| 339 | 341 | also be visible from the user counter. | |
| 340 | 342 | ||
| 343 | + | Currently no soft limit is implemented for kernel memory. It is future work | |
| 344 | + | to trigger slab reclaim when those limits are reached. | |
| 345 | + | ||
| 341 | 346 | 2.7.1 Current Kernel Memory resources accounted | |
| 342 | 347 | ----------------------------------------------- | |
| 343 | 348 | ||
| @@ -705,10 +710,42 @@ For compatibility reasons writing 1 to memory.use_hierarchy will always pass:: | |||
| 705 | 710 | ||
| 706 | 711 | THIS IS DEPRECATED! | |
| 707 | 712 | ||
| 708 | - | Writing to memory.soft_limit_in_bytes has no effect and reading it will | |
| 709 | - | always return the maximum value. | |
| 713 | + | Soft limits allow for greater sharing of memory. The idea behind soft limits | |
| 714 | + | is to allow control groups to use as much of the memory as needed, provided | |
| 715 | + | ||
| 716 | + | a. There is no memory contention | |
| 717 | + | b. They do not exceed their hard limit | |
| 718 | + | ||
| 719 | + | When the system detects memory contention or low memory, control groups | |
| 720 | + | are pushed back to their soft limits. If the soft limit of each control | |
| 721 | + | group is very high, they are pushed back as much as possible to make | |
| 722 | + | sure that one control group does not starve the others of memory. | |
| 723 | + | ||
| 724 | + | Please note that soft limits is a best-effort feature; it comes with | |
| 725 | + | no guarantees, but it does its best to make sure that when memory is | |
| 726 | + | heavily contended for, memory is allocated based on the soft limit | |
| 727 | + | hints/setup. Currently soft limit based reclaim is set up such that | |
| 728 | + | it gets invoked from balance_pgdat (kswapd). | |
| 729 | + | ||
| 730 | + | 7.1 Interface | |
| 731 | + | ------------- | |
| 732 | + | ||
| 733 | + | Soft limits can be setup by using the following commands (in this example we | |
| 734 | + | assume a soft limit of 256 MiB):: | |
| 735 | + | ||
| 736 | + | # echo 256M > memory.soft_limit_in_bytes | |
| 737 | + | ||
| 738 | + | If we want to change this to 1G, we can at any time use:: | |
| 710 | 739 | ||
| 711 | - | Use memory.low and memory.min in cgroup v2 instead. | |
| 740 | + | # echo 1G > memory.soft_limit_in_bytes | |
| 741 | + | ||
| 742 | + | .. note:: | |
| 743 | + | Soft limits take effect over a long period of time, since they involve | |
| 744 | + | reclaiming memory for balancing between memory cgroups | |
| 745 | + | ||
| 746 | + | .. note:: | |
| 747 | + | It is recommended to set the soft limit always below the hard limit, | |
| 748 | + | otherwise the hard limit will take precedence. | |
| 712 | 749 | ||
| 713 | 750 | .. _cgroup-v1-memory-move-charges: | |
| 714 | 751 | ||
modified Documentation/admin-guide/cgroup-v2.rst
| @@ -1130,9 +1130,9 @@ policy and the underlying scheduler. From the point of view of the cpu controlle | |||
| 1130 | 1130 | processes can be categorized as follows: | |
| 1131 | 1131 | ||
| 1132 | 1132 | * Processes under the fair-class scheduler | |
| 1133 | - | * Processes under a BPF scheduler with the corresponding ``cgroup_set_*`` callback | |
| 1133 | + | * Processes under a BPF scheduler with the ``cgroup_set_weight`` callback | |
| 1134 | 1134 | * Everything else: ``SCHED_{FIFO,RR,DEADLINE}`` and processes under a BPF scheduler | |
| 1135 | - | without the corresponding ``cgroup_set_*`` callback | |
| 1135 | + | without the ``cgroup_set_weight`` callback | |
| 1136 | 1136 | ||
| 1137 | 1137 | For details on when a process is under the fair-class scheduler or a BPF scheduler, | |
| 1138 | 1138 | check out :ref:`Documentation/scheduler/sched-ext.rst <sched-ext>`. | |
| @@ -1223,9 +1223,7 @@ will be referred to. All time durations are in microseconds. | |||
| 1223 | 1223 | $PERIOD duration. "max" for $MAX indicates no limit. If only | |
| 1224 | 1224 | one number is written, $MAX is updated. | |
| 1225 | 1225 | ||
| 1226 | - | This file affects only processes under the fair-class scheduler and a BPF | |
| 1227 | - | scheduler with the ``cgroup_set_bandwidth`` callback depending on what | |
| 1228 | - | the callback actually does. | |
| 1226 | + | This file affects only processes under the fair-class scheduler. | |
| 1229 | 1227 | ||
| 1230 | 1228 | cpu.max.burst | |
| 1231 | 1229 | A read-write single value file which exists on non-root | |
| @@ -1233,9 +1231,7 @@ will be referred to. All time durations are in microseconds. | |||
| 1233 | 1231 | ||
| 1234 | 1232 | The burst in the range [0, $MAX]. | |
| 1235 | 1233 | ||
| 1236 | - | This file affects only processes under the fair-class scheduler and a BPF | |
| 1237 | - | scheduler with the ``cgroup_set_bandwidth`` callback depending on what | |
| 1238 | - | the callback actually does. | |
| 1234 | + | This file affects only processes under the fair-class scheduler. | |
| 1239 | 1235 | ||
| 1240 | 1236 | cpu.pressure | |
| 1241 | 1237 | A read-write nested-keyed file. | |
| @@ -1287,9 +1283,7 @@ will be referred to. All time durations are in microseconds. | |||
| 1287 | 1283 | own relative priorities, but the cgroup itself will be treated as | |
| 1288 | 1284 | very low priority relative to its peers. | |
| 1289 | 1285 | ||
| 1290 | - | This file affects only processes under the fair-class scheduler and a BPF | |
| 1291 | - | scheduler with the ``cgroup_set_idle`` callback depending on what the | |
| 1292 | - | callback actually does. | |
| 1286 | + | This file affects only processes under the fair-class scheduler. | |
| 1293 | 1287 | ||
| 1294 | 1288 | Memory | |
| 1295 | 1289 | ------ | |
| @@ -3070,7 +3064,7 @@ resources (res_a and res_b) are registered then: | |||
| 3070 | 3064 | change in this file generates a file modified event. All fields in | |
| 3071 | 3065 | this file are hierarchical. | |
| 3072 | 3066 | ||
| 3073 | - | <res>.max | |
| 3067 | + | max | |
| 3074 | 3068 | The number of times the cgroup's resource usage was | |
| 3075 | 3069 | about to go over the max boundary. | |
| 3076 | 3070 | ||
modified Documentation/admin-guide/ext4.rst
| @@ -172,8 +172,7 @@ When mounting an ext4 filesystem, the following option are accepted: | |||
| 172 | 172 | data=journal | |
| 173 | 173 | All data are committed into the journal prior to being written into the | |
| 174 | 174 | main file system. Enabling this mode will disable delayed allocation | |
| 175 | - | and O_DIRECT support. This feature is deprecated and support | |
| 176 | - | will be removed in January 2028. | |
| 175 | + | and O_DIRECT support. | |
| 177 | 176 | ||
| 178 | 177 | data=ordered (*) | |
| 179 | 178 | All data are forced directly out to the main file system prior to its | |
| @@ -419,8 +418,7 @@ There are 3 different data modes: | |||
| 419 | 418 | consistent state. This mode is the slowest except when data needs to be read | |
| 420 | 419 | from and written to disk at the same time where it outperforms all others | |
| 421 | 420 | modes. Enabling this mode will disable delayed allocation and O_DIRECT | |
| 422 | - | support. The data=journal feature is deprecated and support will be | |
| 423 | - | removed in January 2028. | |
| 421 | + | support. | |
| 424 | 422 | ||
| 425 | 423 | /proc entries | |
| 426 | 424 | ============= | |
modified Documentation/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 | ||
| @@ -4988,6 +4987,18 @@ Kernel parameters | |||
| 4988 | 4987 | Set to non-zero if a chip is present that snoops speed | |
| 4989 | 4988 | changes. Disabled by default. | |
| 4990 | 4989 | ||
| 4990 | + | pata_legacy.ht6560a= [HW,LIBATA] | |
| 4991 | + | Format: <int> | |
| 4992 | + | Set to 1, 2, or 3 for HT 6560A on the primary channel, | |
| 4993 | + | the secondary channel, or both channels respectively. | |
| 4994 | + | Disabled by default. | |
| 4995 | + | ||
| 4996 | + | pata_legacy.ht6560b= [HW,LIBATA] | |
| 4997 | + | Format: <int> | |
| 4998 | + | Set to 1, 2, or 3 for HT 6560B on the primary channel, | |
| 4999 | + | the secondary channel, or both channels respectively. | |
| 5000 | + | Disabled by default. | |
| 5001 | + | ||
| 4991 | 5002 | pata_legacy.iordy_mask= [HW,LIBATA] | |
| 4992 | 5003 | Format: <int> | |
| 4993 | 5004 | IORDY enable mask. Set individual bits to allow IORDY | |
| @@ -5000,6 +5011,18 @@ Kernel parameters | |||
| 5000 | 5011 | with the sequence. By default IORDY is allowed across | |
| 5001 | 5012 | all channels. | |
| 5002 | 5013 | ||
| 5014 | + | pata_legacy.opti82c46x= [HW,LIBATA] | |
| 5015 | + | Format: <int> | |
| 5016 | + | Set to 1, 2, or 3 for Opti 82c611A on the primary | |
| 5017 | + | channel, the secondary channel, or both channels | |
| 5018 | + | respectively. Disabled by default. | |
| 5019 | + | ||
| 5020 | + | pata_legacy.opti82c611a= [HW,LIBATA] | |
| 5021 | + | Format: <int> | |
| 5022 | + | Set to 1, 2, or 3 for Opti 82c465MV on the primary | |
| 5023 | + | channel, the secondary channel, or both channels | |
| 5024 | + | respectively. Disabled by default. | |
| 5025 | + | ||
| 5003 | 5026 | pata_legacy.pio_mask= [HW,LIBATA] | |
| 5004 | 5027 | Format: <int> | |
| 5005 | 5028 | PIO mode mask for autospeed devices. Set individual | |
| @@ -5023,6 +5046,19 @@ Kernel parameters | |||
| 5023 | 5046 | the first port in the list above (0x1f0), and so on. | |
| 5024 | 5047 | By default all supported ports are probed. | |
| 5025 | 5048 | ||
| 5049 | + | pata_legacy.qdi= [HW,LIBATA] | |
| 5050 | + | Format: <int> | |
| 5051 | + | Set to non-zero to probe QDI controllers. By default | |
| 5052 | + | set to 1 if CONFIG_PATA_QDI_MODULE, 0 otherwise. | |
| 5053 | + | ||
| 5054 | + | pata_legacy.winbond= [HW,LIBATA] | |
| 5055 | + | Format: <int> | |
| 5056 | + | Set to non-zero to probe Winbond controllers. Use | |
| 5057 | + | the standard I/O port (0x130) if 1, otherwise the | |
| 5058 | + | value given is the I/O port to use (typically 0x1b0). | |
| 5059 | + | By default set to 1 if CONFIG_PATA_WINBOND_VLB_MODULE, | |
| 5060 | + | 0 otherwise. | |
| 5061 | + | ||
| 5026 | 5062 | pata_platform.pio_mask= [HW,LIBATA] | |
| 5027 | 5063 | Format: <int> | |
| 5028 | 5064 | Supported PIO mode mask. Set individual bits to allow | |
modified Documentation/admin-guide/sysctl/kernel.rst
| @@ -1416,7 +1416,7 @@ Controls whether userspace may arm Syscall User Dispatch via | |||
| 1416 | 1416 | == =================================================================== | |
| 1417 | 1417 | ||
| 1418 | 1418 | Only present when the kernel is built with ``CONFIG_SYSCALL_USER_DISPATCH`` | |
| 1419 | - | and ``CONFIG_SYSCTL``. | |
| 1419 | + | and ``CONFIG_PROC_SYSCTL``. | |
| 1420 | 1420 | ||
| 1421 | 1421 | ||
| 1422 | 1422 | sysctl_writes_strict | |
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/arm64/silicon-errata.rst
| @@ -174,8 +174,6 @@ stable kernels. | |||
| 174 | 174 | +----------------+-----------------+-----------------+-----------------------------+ | |
| 175 | 175 | | ARM | Cortex-A725 | #3456106 | ARM64_ERRATUM_3194386 | | |
| 176 | 176 | +----------------+-----------------+-----------------+-----------------------------+ | |
| 177 | - | | ARM | Cortex-A725 | #3821522 | ARM64_ERRATUM_3821522 | | |
| 178 | - | +----------------+-----------------+-----------------+-----------------------------+ | |
| 179 | 177 | | ARM | Cortex-X1 | #1502854 | N/A | | |
| 180 | 178 | +----------------+-----------------+-----------------+-----------------------------+ | |
| 181 | 179 | | ARM | Cortex-X1 | #3324344 | ARM64_ERRATUM_3194386 | | |
modified Documentation/arch/riscv/hwprobe.rst
| @@ -155,8 +155,7 @@ The following keys are defined: | |||
| 155 | 155 | defined in version 1.0 of the RISC-V Cryptography Extensions Volume II. | |
| 156 | 156 | ||
| 157 | 157 | * :c:macro:`RISCV_HWPROBE_EXT_ZFH`: The Zfh extension version 1.0 is supported | |
| 158 | - | as defined in the RISC-V ISA manual. Zfh is a superset of Zfhmin, so | |
| 159 | - | RISCV_HWPROBE_EXT_ZFHMIN is reported whenever RISCV_HWPROBE_EXT_ZFH is. | |
| 158 | + | as defined in the RISC-V ISA manual. | |
| 160 | 159 | ||
| 161 | 160 | * :c:macro:`RISCV_HWPROBE_EXT_ZFHMIN`: The Zfhmin extension version 1.0 is | |
| 162 | 161 | supported as defined in the RISC-V ISA manual. | |
| @@ -165,9 +164,8 @@ The following keys are defined: | |||
| 165 | 164 | is supported as defined in the RISC-V ISA manual. | |
| 166 | 165 | ||
| 167 | 166 | * :c:macro:`RISCV_HWPROBE_EXT_ZVFH`: The Zvfh extension is supported as | |
| 168 | - | defined in the RISC-V Vector manual starting from commit e2ccd0548d6c | |
| 169 | - | ("Remove draft warnings from Zvfh[min]"). Zvfh is a superset of Zvfhmin, | |
| 170 | - | so RISCV_HWPROBE_EXT_ZVFHMIN is reported whenever RISCV_HWPROBE_EXT_ZVFH is. | |
| 167 | + | defined in the RISC-V Vector manual starting from commit e2ccd0548d6c | |
| 168 | + | ("Remove draft warnings from Zvfh[min]"). | |
| 171 | 169 | ||
| 172 | 170 | * :c:macro:`RISCV_HWPROBE_EXT_ZVFHMIN`: The Zvfhmin extension is supported as | |
| 173 | 171 | defined in the RISC-V Vector manual starting from commit e2ccd0548d6c | |
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/iio/adc/rockchip-saradc.yaml
| @@ -12,19 +12,19 @@ maintainers: | |||
| 12 | 12 | properties: | |
| 13 | 13 | compatible: | |
| 14 | 14 | oneOf: | |
| 15 | - | - enum: | |
| 16 | - | - rockchip,saradc | |
| 17 | - | - rockchip,rk3066-tsadc | |
| 18 | - | - rockchip,rk3399-saradc | |
| 19 | - | - rockchip,rk3528-saradc | |
| 20 | - | - rockchip,rk3562-saradc | |
| 21 | - | - rockchip,rk3588-saradc | |
| 22 | - | - rockchip,rv1106-saradc | |
| 15 | + | - const: rockchip,saradc | |
| 16 | + | - const: rockchip,rk3066-tsadc | |
| 17 | + | - const: rockchip,rk3399-saradc | |
| 18 | + | - const: rockchip,rk3528-saradc | |
| 23 | 19 | - items: | |
| 24 | 20 | - const: rockchip,rk3506-saradc | |
| 25 | 21 | - const: rockchip,rk3528-saradc | |
| 22 | + | - const: rockchip,rk3562-saradc | |
| 23 | + | - const: rockchip,rk3588-saradc | |
| 26 | 24 | - items: | |
| 27 | - | - const: rockchip,rk3576-saradc | |
| 25 | + | - enum: | |
| 26 | + | - rockchip,rk3576-saradc | |
| 27 | + | - rockchip,rv1106-saradc | |
| 28 | 28 | - const: rockchip,rk3588-saradc | |
| 29 | 29 | - items: | |
| 30 | 30 | - enum: | |
modified Documentation/devicetree/bindings/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/devicetree/bindings/regulator/fcs,fan53555.yaml
| @@ -23,7 +23,6 @@ properties: | |||
| 23 | 23 | - silergy,syr827 | |
| 24 | 24 | - silergy,syr828 | |
| 25 | 25 | - tcs,tcs4525 | |
| 26 | - | - tcs,tcs4526 | |
| 27 | 26 | - items: | |
| 28 | 27 | - const: rockchip,rk8601 | |
| 29 | 28 | - const: rockchip,rk8600 | |
modified Documentation/devicetree/bindings/riscv/cpus.yaml
| @@ -117,8 +117,8 @@ properties: | |||
| 117 | 117 | $ref: /schemas/types.yaml#/definitions/uint32 | |
| 118 | 118 | description: | |
| 119 | 119 | VLEN/8, the vector register length in bytes. This property is required on | |
| 120 | - | thead systems where the vector register length is not identical on all | |
| 121 | - | harts, or the vlenb CSR is not available. | |
| 120 | + | thead systems where the vector register length is not identical on all harts, or | |
| 121 | + | the vlenb CSR is not available. | |
| 122 | 122 | ||
| 123 | 123 | # RISC-V has multiple properties for cache op block sizes as the sizes | |
| 124 | 124 | # differ between individual CBO extensions | |
| @@ -151,8 +151,8 @@ anyOf: | |||
| 151 | 151 | - riscv,isa-base | |
| 152 | 152 | ||
| 153 | 153 | dependencies: | |
| 154 | - | riscv,isa-base: ["riscv,isa-extensions"] | |
| 155 | - | riscv,isa-extensions: ["riscv,isa-base"] | |
| 154 | + | riscv,isa-base: [ "riscv,isa-extensions" ] | |
| 155 | + | riscv,isa-extensions: [ "riscv,isa-base" ] | |
| 156 | 156 | ||
| 157 | 157 | required: | |
| 158 | 158 | - interrupt-controller | |
modified Documentation/devicetree/bindings/spi/snps,dw-apb-ssi.yaml
| @@ -44,21 +44,6 @@ allOf: | |||
| 44 | 44 | else: | |
| 45 | 45 | properties: | |
| 46 | 46 | starfive,sfc-filter-syscon: false | |
| 47 | - | - if: | |
| 48 | - | properties: | |
| 49 | - | compatible: | |
| 50 | - | contains: | |
| 51 | - | const: ultrarisc,dp1000-spi | |
| 52 | - | then: | |
| 53 | - | properties: | |
| 54 | - | reg: | |
| 55 | - | maxItems: 1 | |
| 56 | - | clocks: | |
| 57 | - | minItems: 2 | |
| 58 | - | clock-names: | |
| 59 | - | minItems: 2 | |
| 60 | - | required: | |
| 61 | - | - clock-names | |
| 62 | 47 | ||
| 63 | 48 | properties: | |
| 64 | 49 | compatible: | |
| @@ -77,9 +62,7 @@ properties: | |||
| 77 | 62 | - mscc,ocelot-spi | |
| 78 | 63 | - mscc,jaguar2-spi | |
| 79 | 64 | - sophgo,sg2042-spi | |
| 80 | - | - syna,sl2610-spi | |
| 81 | 65 | - thead,th1520-spi | |
| 82 | - | - ultrarisc,dp1000-spi | |
| 83 | 66 | - const: snps,dw-apb-ssi | |
| 84 | 67 | - description: Vendor controllers compatible with v1.01a | |
| 85 | 68 | items: | |
modified Documentation/fault-injection/nvme-fault-injection.rst
| @@ -176,68 +176,3 @@ Message from dmesg:: | |||
| 176 | 176 | secondary_startup_64+0xa4/0xb0 | |
| 177 | 177 | nvme nvme0: Could not set queue count (16385) | |
| 178 | 178 | nvme nvme0: IO queues not created | |
| 179 | - | ||
| 180 | - | Example 4: Inject an error into the first write command | |
| 181 | - | ------------------------------------------------------- | |
| 182 | - | ||
| 183 | - | :: | |
| 184 | - | ||
| 185 | - | echo 0x01 > /sys/kernel/debug/nvme0n1/fault_inject/opcode | |
| 186 | - | echo 1 > /sys/kernel/debug/nvme0n1/fault_inject/times | |
| 187 | - | echo 100 > /sys/kernel/debug/nvme0n1/fault_inject/probability | |
| 188 | - | dd if=/dev/zero of=/dev/nvme0n1 oflag=direct bs=512 count=1 | |
| 189 | - | ||
| 190 | - | Expected Result:: | |
| 191 | - | ||
| 192 | - | The first write command sent to nvme0n1 fails | |
| 193 | - | ||
| 194 | - | Message from dmesg:: | |
| 195 | - | ||
| 196 | - | FAULT_INJECTION: forcing a failure. | |
| 197 | - | name fault_inject, interval 1, probability 100, space 0, times 1 | |
| 198 | - | CPU: 4 UID: 0 PID: 0 Comm: swapper/4 Not tainted 7.1.0+ #5 PREEMPT(full) | |
| 199 | - | Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-20240910_120124-localhost 04/01/2014 | |
| 200 | - | Call Trace: | |
| 201 | - | <IRQ> | |
| 202 | - | dump_stack_lvl+0x6e/0xa0 | |
| 203 | - | dump_stack+0x10/0x16 | |
| 204 | - | should_fail_ex+0x461/0x510 | |
| 205 | - | should_fail+0xb/0x20 | |
| 206 | - | nvme_should_fail+0x11b/0x240 [nvme_core] | |
| 207 | - | nvme_poll_cq+0x6ad/0xb30 [nvme] | |
| 208 | - | nvme_irq+0x84/0xe0 [nvme] | |
| 209 | - | ? __pfx_nvme_irq+0x10/0x10 [nvme] | |
| 210 | - | ? rcu_core+0xa40/0xa90 | |
| 211 | - | ? __pfx_sched_balance_softirq+0x10/0x10 | |
| 212 | - | ? debug_smp_processor_id+0x17/0x20 | |
| 213 | - | ? rcu_is_watching+0x13/0xa0 | |
| 214 | - | __handle_irq_event_percpu+0x396/0x610 | |
| 215 | - | handle_irq_event_percpu+0xf/0x90 | |
| 216 | - | handle_irq_event+0xab/0x110 | |
| 217 | - | handle_edge_irq+0x1a3/0x210 | |
| 218 | - | __common_interrupt+0xff/0x170 | |
| 219 | - | common_interrupt+0x90/0xc0 | |
| 220 | - | </IRQ> | |
| 221 | - | <TASK> | |
| 222 | - | asm_common_interrupt+0x27/0x40 | |
| 223 | - | RIP: 0010:pv_native_safe_halt+0x13/0x20 | |
| 224 | - | Code: 1f 84 00 00 00 00 00 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 8b 05 0a 2a 58 01 85 c0 7e 07 0f 00 2d ff cc 0d 00 fb f4 <c3> cc 0 | |
| 225 | - | RSP: 0018:ffff888100a67e40 EFLAGS: 00000242 | |
| 226 | - | RAX: 0000000000000001 RBX: ffff888100a49c40 RCX: ffffed102b6c645b | |
| 227 | - | RDX: ffffed102b6c645b RSI: ffffffff82a0d3c0 RDI: ffffffff81428b9b | |
| 228 | - | RBP: ffff888100a67e48 R08: ffffed102b6c645b R09: 0000000000000004 | |
| 229 | - | R10: ffffed102b6c645a R11: 0000000000000001 R12: 0000000000000000 | |
| 230 | - | R13: 0000000000000000 R14: ffffed1020149388 R15: dffffc0000000000 | |
| 231 | - | ? do_idle+0x19b/0x2c0 | |
| 232 | - | ? default_idle+0x9/0x20 | |
| 233 | - | arch_cpu_idle+0x9/0x10 | |
| 234 | - | default_idle_call+0x6b/0xa0 | |
| 235 | - | do_idle+0x19b/0x2c0 | |
| 236 | - | ? __pfx_do_idle+0x10/0x10 | |
| 237 | - | ? complete_with_flags+0x63/0x70 | |
| 238 | - | cpu_startup_entry+0x55/0x60 | |
| 239 | - | start_secondary+0x1df/0x1e0 | |
| 240 | - | common_startup_64+0x13e/0x158 | |
| 241 | - | </TASK> | |
| 242 | - | nvme0n1: Write(0x1) @ LBA 0, 1 blocks, Invalid Command Opcode (sct 0x0 / sc 0x1) DNR | |
| 243 | - | operation not supported error, dev nvme0n1, sector 0 op 0x1:(WRITE) flags 0x8800 phys_seg 1 prio class 2 | |
modified Documentation/filesystems/netfs_library.rst
| @@ -451,32 +451,6 @@ one. | |||
| 451 | 451 | The inode should be marked ``NETFS_ICTX_SINGLE_NO_UPLOAD`` if this API is to be | |
| 452 | 452 | used. The writeback function requires the buffer to be of ITER_FOLIOQ type. | |
| 453 | 453 | ||
| 454 | - | Clearing Stale Post-EOF Pagecache | |
| 455 | - | --------------------------------- | |
| 456 | - | ||
| 457 | - | When a file is extended, data left in the pagecache past the old EOF by a write | |
| 458 | - | through an mmap must not be exposed as file content. Netfslib clears this on | |
| 459 | - | its own write paths, and exports a helper so a filesystem can do the same from | |
| 460 | - | a resize path (truncate, setattr, fallocate and the like) that holds the | |
| 461 | - | inode's ``i_rwsem`` exclusively across the whole resize:: | |
| 462 | - | ||
| 463 | - | void netfs_clear_stale_post_isize(struct inode *inode, uoff_t from, | |
| 464 | - | uoff_t to); | |
| 465 | - | ||
| 466 | - | This zeroes any such data within the ``[from, to)`` hole to be made, where | |
| 467 | - | @from is the old EOF and @to is the new one, and the caller must have already | |
| 468 | - | updated ``i_size`` to @to before calling it. Only the folio straddling @from | |
| 469 | - | can hold data written past the EOF through an mmap, as pages wholly beyond the | |
| 470 | - | EOF can't be faulted in, so the zeroing is limited to that folio. The folio is | |
| 471 | - | zeroed rather than dropped so that a concurrent extending write can't lose | |
| 472 | - | data. | |
| 473 | - | ||
| 474 | - | This overlaps with ``pagecache_isize_extended()`` but can't reuse it: that | |
| 475 | - | helper is keyed on a sub-page block size and is a no-op when the block size is | |
| 476 | - | ``>= PAGE_SIZE`` (as on network filesystems), and it doesn't wait for | |
| 477 | - | writeback. As both address the same problem, a change to one should probably | |
| 478 | - | be reflected in the other to keep them in sync. | |
| 479 | - | ||
| 480 | 454 | High-Level VM API | |
| 481 | 455 | ================== | |
| 482 | 456 | ||
modified Documentation/filesystems/propagate_umount.txt
| @@ -32,12 +32,12 @@ of set. They can be reparented to the place where the bottom of | |||
| 32 | 32 | stack is attached to a mount that will survive. NOTE: doing that | |
| 33 | 33 | will violate a constraint on having no more than one mount with | |
| 34 | 34 | the same parent/mountpoint pair; however, the caller (umount_tree()) | |
| 35 | - | will immediately remedy that - it detaches every element of the set | |
| 36 | - | from its parent. Since all conflicts created by reparenting have | |
| 37 | - | common parent *not* in the set and one side of the conflict (bottom | |
| 38 | - | of the stack of overmounts) is in the set, it will be resolved. | |
| 39 | - | However, we rely upon umount_tree() doing that pretty much immediately | |
| 40 | - | after the call of propagate_umount(). | |
| 35 | + | will immediately remedy that - it may keep unmounted element attached | |
| 36 | + | to parent, but only if the parent itself is unmounted. Since all | |
| 37 | + | conflicts created by reparenting have common parent *not* in the | |
| 38 | + | set and one side of the conflict (bottom of the stack of overmounts) | |
| 39 | + | is in the set, it will be resolved. However, we rely upon umount_tree() | |
| 40 | + | doing that pretty much immediately after the call of propagate_umount(). | |
| 41 | 41 | ||
| 42 | 42 | Algorithm is based on two statements: | |
| 43 | 43 | 1) for any set S, there is a maximal non-shifting subset of S | |
modified Documentation/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/hwmon/gpd-fan.rst
| @@ -67,7 +67,7 @@ pwm1_enable | |||
| 67 | 67 | at full speed. Write "1" to set to manual, write "2" to let the EC control | |
| 68 | 68 | decide fan speed. Read this attribute to see current status. | |
| 69 | 69 | ||
| 70 | - | NB: In consideration of the safety of the device, when setting to manual mode, | |
| 70 | + | NB:In consideration of the safety of the device, when setting to manual mode, | |
| 71 | 71 | the pwm speed will be set to the maximum value (255) by default. You can set | |
| 72 | 72 | a different value by writing pwm1 later. | |
| 73 | 73 | ||
modified Documentation/hwmon/hwmon-kernel-api.rst
| @@ -42,9 +42,6 @@ register/unregister functions:: | |||
| 42 | 42 | ||
| 43 | 43 | char *devm_hwmon_sanitize_name(struct device *dev, const char *name); | |
| 44 | 44 | ||
| 45 | - | int hwmon_notify_event(struct device *dev, enum hwmon_sensor_types type, | |
| 46 | - | u32 attr, int channel); | |
| 47 | - | ||
| 48 | 45 | void hwmon_lock(struct device *dev); | |
| 49 | 46 | void hwmon_unlock(struct device *dev); | |
| 50 | 47 | ||
| @@ -93,18 +90,6 @@ implemented in the driver, or debugfs functions, hwmon_lock() and hwmon_unlock() | |||
| 93 | 90 | can be used to ensure that calls to those functions are serialized. Those | |
| 94 | 91 | functions also support guard() and scoped_guard() variants. | |
| 95 | 92 | ||
| 96 | - | Drivers can call hwmon_notify_event() to notify userspace and the thermal | |
| 97 | - | subsystem when a hardware monitoring event (such as an alarm or a fault | |
| 98 | - | condition) occurs or clears. The parameters are the hwmon device, the sensor | |
| 99 | - | type, the attribute identifier associated with the event (such as | |
| 100 | - | hwmon_temp_max_alarm or hwmon_fan_fault), and the sensor channel number. | |
| 101 | - | hwmon_notify_event() generates a sysfs event (calling sysfs_notify()) and a | |
| 102 | - | udev event with the attribute name passed in the NAME environment property | |
| 103 | - | (e.g., "NAME=temp1_max_alarm"). If the event is for a temperature sensor and | |
| 104 | - | the sensor is attached to a thermal zone, it also notifies the thermal | |
| 105 | - | subsystem to update the thermal zone. hwmon_notify_event() returns 0 on | |
| 106 | - | success or a negative error code on failure. | |
| 107 | - | ||
| 108 | 93 | Using devm_hwmon_device_register_with_info() | |
| 109 | 94 | -------------------------------------------- | |
| 110 | 95 | ||
modified Documentation/netlink/specs/conntrack.yaml
| @@ -360,17 +360,6 @@ attribute-sets: | |||
| 360 | 360 | name: tsoff | |
| 361 | 361 | type: u32 | |
| 362 | 362 | byte-order: big-endian | |
| 363 | - | - | |
| 364 | - | name: filter-attrs | |
| 365 | - | attributes: | |
| 366 | - | - | |
| 367 | - | name: orig-flags | |
| 368 | - | type: u32 | |
| 369 | - | doc: bitmask of tuple fields to filter on, original direction | |
| 370 | - | - | |
| 371 | - | name: reply-flags | |
| 372 | - | type: u32 | |
| 373 | - | doc: bitmask of tuple fields to filter on, reply direction | |
| 374 | 363 | - | |
| 375 | 364 | name: conntrack-attrs | |
| 376 | 365 | attributes: | |
| @@ -477,7 +466,7 @@ attribute-sets: | |||
| 477 | 466 | - | |
| 478 | 467 | name: filter | |
| 479 | 468 | type: nest | |
| 480 | - | nested-attributes: filter-attrs | |
| 469 | + | nested-attributes: tuple-attrs | |
| 481 | 470 | - | |
| 482 | 471 | name: status-mask | |
| 483 | 472 | type: u32 | |
| @@ -602,14 +591,10 @@ operations: | |||
| 602 | 591 | request: | |
| 603 | 592 | value: 0x101 | |
| 604 | 593 | attributes: | |
| 605 | - | - tuple-orig | |
| 606 | - | - tuple-reply | |
| 607 | - | - status | |
| 608 | 594 | - mark | |
| 609 | - | - zone | |
| 610 | - | - mark-mask | |
| 611 | 595 | - filter | |
| 612 | - | - status-mask | |
| 596 | + | - status | |
| 597 | + | - zone | |
| 613 | 598 | reply: | |
| 614 | 599 | value: 0x100 | |
| 615 | 600 | attributes: | |
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-link.yaml
| @@ -898,8 +898,6 @@ attribute-sets: | |||
| 898 | 898 | - | |
| 899 | 899 | name: txqlen | |
| 900 | 900 | type: u32 | |
| 901 | - | checks: | |
| 902 | - | max: 32767 | |
| 903 | 901 | - | |
| 904 | 902 | name: map | |
| 905 | 903 | type: binary | |
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/networking/strparser.rst
| @@ -77,7 +77,7 @@ Functions | |||
| 77 | 77 | ||
| 78 | 78 | strp_done is called to release any resources held by the stream | |
| 79 | 79 | parser instance. This must be called after the stream processor | |
| 80 | - | has been stopped. The socket lock must not be held. | |
| 80 | + | has been stopped. | |
| 81 | 81 | ||
| 82 | 82 | :: | |
| 83 | 83 | ||
modified Documentation/scheduler/sched-ext.rst
| @@ -230,7 +230,7 @@ optional. The following modified excerpt is from | |||
| 230 | 230 | ||
| 231 | 231 | void BPF_STRUCT_OPS(simple_exit, struct scx_exit_info *ei) | |
| 232 | 232 | { | |
| 233 | - | exit_type = ei->kind; | |
| 233 | + | exit_type = ei->type; | |
| 234 | 234 | } | |
| 235 | 235 | ||
| 236 | 236 | SEC(".struct_ops") | |
| @@ -242,21 +242,6 @@ optional. The following modified excerpt is from | |||
| 242 | 242 | .name = "simple", | |
| 243 | 243 | }; | |
| 244 | 244 | ||
| 245 | - | Scheduler-Dependent Knobs | |
| 246 | - | ------------------------- | |
| 247 | - | ||
| 248 | - | The fair-class scheduler enforces CPU controller settings such as | |
| 249 | - | ``cpu.max``, ``cpu.weight`` and ``cpu.idle``. For sched_ext tasks, the | |
| 250 | - | scheduler core communicates these settings to the BPF scheduler | |
| 251 | - | through ``ops.cgroup_init()`` and reports subsequent changes through | |
| 252 | - | the corresponding ``ops.cgroup_set_*()`` callbacks. Similarly, per-task | |
| 253 | - | nice changes are converted to weights and reported through | |
| 254 | - | ``ops.set_weight()``. | |
| 255 | - | ||
| 256 | - | Each BPF scheduler is responsible for implementing the scheduling | |
| 257 | - | semantics of these settings and may choose to ignore them. Consult the | |
| 258 | - | loaded scheduler's documentation before relying on these controls. | |
| 259 | - | ||
| 260 | 245 | Dispatch Queues | |
| 261 | 246 | --------------- | |
| 262 | 247 | ||
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 Documentation/translations/zh_CN/arch/riscv/patch-acceptance.rst
| @@ -15,41 +15,19 @@ arch/riscv 开发者维护指南 | |||
| 15 | 15 | ||
| 16 | 16 | 概述 | |
| 17 | 17 | ---- | |
| 18 | - | RISC-V 指令集体系结构是公开开发的: | |
| 18 | + | RISC-V指令集体系结构是公开开发的: | |
| 19 | 19 | 正在进行的草案可供所有人查看和测试实现。新模块或者扩展草案可能会在开发过程中发 | |
| 20 | - | 生更改 --- 有时以不兼容的方式对以前的草案进行更改。这种灵活性可能会给 RISC-V | |
| 21 | - | Linux 维护者带来挑战。Linux 维护者不赞成频繁的变更,且 Linux 开发过程更喜欢经过 | |
| 22 | - | 良好检查和测试的代码,而不是试验代码。我们希望推广同样的规则到即将被内核合并的 | |
| 23 | - | RISC-V 相关代码。 | |
| 24 | - | ||
| 25 | - | Patchwork | |
| 26 | - | --------- | |
| 27 | - | ||
| 28 | - | RISC-V 有一个 patchwork 实例,可以在那里查看补丁的状态: | |
| 29 | - | ||
| 30 | - | https://patchwork.kernel.org/project/linux-riscv/list/ | |
| 31 | - | ||
| 32 | - | 如果你的补丁不在默认视图中出现,那么 RISC-V 维护者很有可能已要求修改,或者希望 | |
| 33 | - | 将其应用到另一个代码树上。 | |
| 34 | - | ||
| 35 | - | 自动化流程会在该 patchwork 实例上运行,在每个补丁到达时立刻对其进行构建/测试。 | |
| 36 | - | 自动化流程会根据补丁是否被识别为修复,选用 RISC-V `for-next` 或 `fixes` 分支 | |
| 37 | - | 当前的 HEAD;若上述均应用失败,则使用 RISC-V `master` 分支。补丁系列被应用到的具 | |
| 38 | - | 体提交将标注在 patchwork 上。任何检查未通过的补丁通常不会被应用,并且在大多数情 | |
| 39 | - | 况下将需要重新提交。 | |
| 20 | + | 生更改---有时以不兼容的方式对以前的草案进行更改。这种灵活性可能会给RISC-V Linux | |
| 21 | + | 维护者带来挑战。Linux开发过程更喜欢经过良好检查和测试的代码,而不是试验代码。我 | |
| 22 | + | 们希望推广同样的规则到即将被内核合并的RISC-V相关代码。 | |
| 40 | 23 | ||
| 41 | 24 | 附加的提交检查单 | |
| 42 | 25 | ---------------- | |
| 43 | - | 我们仅接受针对新模块或扩展的补丁,前提是这些模块或扩展的规范被列为未来不太可能发 | |
| 44 | - | 生不兼容的变更。对于来自 RISC-V 基金会的规范,这意味着“已冻结”或“已批准”,对于 | |
| 45 | - | UEFI 论坛的规范,这意味着已发布的 ECR。(开发者当然可以维护自己的 Linux 内核树, | |
| 46 | - | 其中包含他们所需的任何扩展草案的代码。) | |
| 47 | - | ||
| 48 | - | 此外,RISC-V 规范允许实现者创建自己的自定义扩展。这些自定义扩展不需要通过 RISC-V | |
| 49 | - | 基金会的任何审核或批准流程。为了避免因添加实现者特定的 RISC-V 扩展带来的维护复杂 | |
| 50 | - | 性和对性能的潜在影响,我们将只考虑符合以下任一条件的扩展补丁: | |
| 51 | - | ||
| 52 | - | - 已由 RISC-V 基金会正式冻结或批准 | |
| 53 | - | - 已按照标准 Linux 惯例,在广泛可用的硬件中实现 | |
| 54 | - | ||
| 55 | - | (实现者当然可以维护自己的 Linux 内核树,其中包含他们所需的任何自定义扩展的代码。) | |
| 26 | + | 我们仅接受相关标准已经被RISC-V基金会标准为“已批准”或“已冻结”的扩展或模块的补丁。 | |
| 27 | + | (开发者当然可以维护自己的Linux内核树,其中包含所需代码扩展草案的代码。) | |
| 28 | + | ||
| 29 | + | 此外,RISC-V规范允许爱好者创建自己的自定义扩展。这些自定义拓展不需要通过RISC-V | |
| 30 | + | 基金会的任何审核或批准。为了避免将爱好者一些特别的RISC-V拓展添加进内核代码带来 | |
| 31 | + | 的维护复杂性和对性能的潜在影响,我们将只接受RISC-V基金会正式冻结或批准的的扩展 | |
| 32 | + | 补丁。(开发者当然可以维护自己的Linux内核树,其中包含他们想要的任何自定义扩展 | |
| 33 | + | 的代码。) | |
modified Documentation/translations/zh_CN/core-api/irq/irq-domain.rst
| @@ -90,6 +90,10 @@ irq_domain映射的类型 | |||
| 90 | 90 | 映射的优点是固定时间查找IRQ号,而且irq_descs只分配给在用的IRQ。 缺点是该表 | |
| 91 | 91 | 必须尽可能大的hwirq号。 | |
| 92 | 92 | ||
| 93 | + | irq_domain_add_linear()和irq_domain_create_linear()在功能上是等价的, | |
| 94 | + | 除了第一个参数不同--前者接受一个Open Firmware特定的 'struct device_node' 而 | |
| 95 | + | 后者接受一个更通用的抽象 'struct fwnode_handle' 。 | |
| 96 | + | ||
| 93 | 97 | 大多数驱动应该使用线性映射 | |
| 94 | 98 | ||
| 95 | 99 | 树状映射 | |
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 | |
| @@ -4512,7 +4512,7 @@ AYANEO PLATFORM EC DRIVER | |||
| 4512 | 4512 | M: Antheas Kapenekakis <lkml@antheas.dev> | |
| 4513 | 4513 | L: platform-driver-x86@vger.kernel.org | |
| 4514 | 4514 | S: Maintained | |
| 4515 | - | F: Documentation/ABI/testing/sysfs-platform-ayaneo-ec | |
| 4515 | + | F: Documentation/ABI/testing/sysfs-platform-ayaneo | |
| 4516 | 4516 | F: drivers/platform/x86/ayaneo-ec.c | |
| 4517 | 4517 | ||
| 4518 | 4518 | AZ6007 DVB DRIVER | |
| @@ -5143,7 +5143,6 @@ L: netdev@vger.kernel.org | |||
| 5143 | 5143 | L: openwrt-devel@lists.openwrt.org (subscribers-only) | |
| 5144 | 5144 | S: Supported | |
| 5145 | 5145 | F: Documentation/devicetree/bindings/net/dsa/brcm,b53.yaml | |
| 5146 | - | F: Documentation/networking/dsa/b53.rst | |
| 5147 | 5146 | F: drivers/net/dsa/b53/* | |
| 5148 | 5147 | F: drivers/net/dsa/bcm_sf2* | |
| 5149 | 5148 | F: include/linux/dsa/brcm.h | |
| @@ -5455,7 +5454,6 @@ F: include/linux/brcmphy.h | |||
| 5455 | 5454 | BROADCOM GENET ETHERNET DRIVER | |
| 5456 | 5455 | M: Doug Berger <opendmb@gmail.com> | |
| 5457 | 5456 | M: Florian Fainelli <florian.fainelli@broadcom.com> | |
| 5458 | - | M: Nicolai Buchwitz <nb@tipi-net.de> | |
| 5459 | 5457 | R: Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com> | |
| 5460 | 5458 | L: netdev@vger.kernel.org | |
| 5461 | 5459 | S: Maintained | |
| @@ -5673,8 +5671,8 @@ W: http://bu3sch.de/btgpio.php | |||
| 5673 | 5671 | F: drivers/gpio/gpio-bt8xx.c | |
| 5674 | 5672 | ||
| 5675 | 5673 | BTRFS FILE SYSTEM | |
| 5674 | + | M: Chris Mason <clm@fb.com> | |
| 5676 | 5675 | M: David Sterba <dsterba@suse.com> | |
| 5677 | - | R: Chris Mason <mason@kernel.org> | |
| 5678 | 5676 | L: linux-btrfs@vger.kernel.org | |
| 5679 | 5677 | S: Maintained | |
| 5680 | 5678 | W: https://btrfs.readthedocs.io | |
| @@ -8041,7 +8039,7 @@ F: drivers/gpu/drm/sun4i/sun8i* | |||
| 8041 | 8039 | ||
| 8042 | 8040 | DRM DRIVER FOR APPLE TOUCH BARS | |
| 8043 | 8041 | M: Aun-Ali Zaidi <admin@kodeit.net> | |
| 8044 | - | M: Aditya Garg <aditya.garg@linux.dev> | |
| 8042 | + | M: Aditya Garg <gargaditya08@proton.me> | |
| 8045 | 8043 | L: dri-devel@lists.freedesktop.org | |
| 8046 | 8044 | S: Maintained | |
| 8047 | 8045 | T: git https://gitlab.freedesktop.org/drm/misc/kernel.git | |
| @@ -9326,7 +9324,6 @@ F: Documentation/devicetree/bindings/interrupt-controller/econet,en751221-intc.y | |||
| 9326 | 9324 | F: Documentation/devicetree/bindings/mips/econet.yaml | |
| 9327 | 9325 | F: Documentation/devicetree/bindings/timer/econet,en751221-timer.yaml | |
| 9328 | 9326 | F: arch/mips/boot/dts/econet/ | |
| 9329 | - | F: arch/mips/configs/econet_en751221_defconfig | |
| 9330 | 9327 | F: arch/mips/econet/ | |
| 9331 | 9328 | F: drivers/clocksource/timer-econet-en751221.c | |
| 9332 | 9329 | F: drivers/irqchip/irq-econet-en751221.c | |
| @@ -9390,8 +9387,9 @@ S: Maintained | |||
| 9390 | 9387 | F: drivers/edac/octeon_edac* | |
| 9391 | 9388 | ||
| 9392 | 9389 | EDAC-CAVIUM THUNDERX | |
| 9390 | + | M: Robert Richter <rric@kernel.org> | |
| 9393 | 9391 | L: linux-edac@vger.kernel.org | |
| 9394 | - | S: Orphan | |
| 9392 | + | S: Odd Fixes | |
| 9395 | 9393 | F: drivers/edac/thunderx_edac* | |
| 9396 | 9394 | ||
| 9397 | 9395 | EDAC-CORE | |
| @@ -9418,8 +9416,9 @@ S: Supported | |||
| 9418 | 9416 | F: drivers/edac/dmc520_edac.c | |
| 9419 | 9417 | ||
| 9420 | 9418 | EDAC-E752X | |
| 9419 | + | M: Mark Gross <markgross@kernel.org> | |
| 9421 | 9420 | L: linux-edac@vger.kernel.org | |
| 9422 | - | S: Orphan | |
| 9421 | + | S: Maintained | |
| 9423 | 9422 | F: drivers/edac/e752x_edac.c | |
| 9424 | 9423 | ||
| 9425 | 9424 | EDAC-E7XXX | |
| @@ -9494,8 +9493,9 @@ S: Maintained | |||
| 9494 | 9493 | F: drivers/edac/igen6_edac.c | |
| 9495 | 9494 | ||
| 9496 | 9495 | EDAC-MPC85XX | |
| 9496 | + | M: Johannes Thumshirn <morbidrsa@gmail.com> | |
| 9497 | 9497 | L: linux-edac@vger.kernel.org | |
| 9498 | - | S: Orphan | |
| 9498 | + | S: Maintained | |
| 9499 | 9499 | F: drivers/edac/mpc85xx_edac.[ch] | |
| 9500 | 9500 | ||
| 9501 | 9501 | EDAC-NPCM | |
| @@ -9861,7 +9861,7 @@ L: linux-ext4@vger.kernel.org | |||
| 9861 | 9861 | S: Maintained | |
| 9862 | 9862 | W: http://ext4.wiki.kernel.org | |
| 9863 | 9863 | Q: http://patchwork.ozlabs.org/project/linux-ext4/list/ | |
| 9864 | - | T: git git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git dev | |
| 9864 | + | T: git git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git | |
| 9865 | 9865 | F: Documentation/filesystems/ext4/ | |
| 9866 | 9866 | F: fs/ext4/ | |
| 9867 | 9867 | F: include/trace/events/ext4.h | |
| @@ -10193,6 +10193,7 @@ F: include/linux/arm_ffa.h | |||
| 10193 | 10193 | ||
| 10194 | 10194 | FIRMWARE LOADER (request_firmware) | |
| 10195 | 10195 | M: Luis Chamberlain <mcgrof@kernel.org> | |
| 10196 | + | M: Russ Weight <russ.weight@linux.dev> | |
| 10196 | 10197 | M: Danilo Krummrich <dakr@kernel.org> | |
| 10197 | 10198 | L: driver-core@lists.linux.dev | |
| 10198 | 10199 | S: Maintained | |
| @@ -12223,7 +12224,7 @@ F: drivers/tty/hvc/ | |||
| 12223 | 12224 | ||
| 12224 | 12225 | HUNG TASK DETECTOR | |
| 12225 | 12226 | M: Andrew Morton <akpm@linux-foundation.org> | |
| 12226 | - | M: Lance Yang <lance.yang@linux.dev> | |
| 12227 | + | R: Lance Yang <lance.yang@linux.dev> | |
| 12227 | 12228 | R: Masami Hiramatsu <mhiramat@kernel.org> | |
| 12228 | 12229 | R: Petr Mladek <pmladek@suse.com> | |
| 12229 | 12230 | L: linux-kernel@vger.kernel.org | |
| @@ -13282,6 +13283,7 @@ F: drivers/crypto/intel/keembay/ocs-aes.h | |||
| 13282 | 13283 | ||
| 13283 | 13284 | INTEL KEEM BAY OCS ECC CRYPTO DRIVER | |
| 13284 | 13285 | M: Prabhjot Khurana <prabhjot.khurana@intel.com> | |
| 13286 | + | M: Mark Gross <mgross@linux.intel.com> | |
| 13285 | 13287 | S: Maintained | |
| 13286 | 13288 | F: Documentation/devicetree/bindings/crypto/intel,keembay-ocs-ecc.yaml | |
| 13287 | 13289 | F: drivers/crypto/intel/keembay/Kconfig | |
| @@ -14238,6 +14240,8 @@ F: tools/testing/selftests/ | |||
| 14238 | 14240 | KERNEL SMB3 SERVER (KSMBD) | |
| 14239 | 14241 | M: Namjae Jeon <linkinjeon@kernel.org> | |
| 14240 | 14242 | M: Namjae Jeon <linkinjeon@samba.org> | |
| 14243 | + | M: Steve French <smfrench@gmail.com> | |
| 14244 | + | M: Steve French <sfrench@samba.org> | |
| 14241 | 14245 | R: Sergey Senozhatsky <senozhatsky@chromium.org> | |
| 14242 | 14246 | R: Tom Talpey <tom@talpey.com> | |
| 14243 | 14247 | R: ChenXiaoSong <chenxiaosong@chenxiaosong.com> | |
| @@ -14907,7 +14911,7 @@ M: Damien Le Moal <dlemoal@kernel.org> | |||
| 14907 | 14911 | M: Niklas Cassel <cassel@kernel.org> | |
| 14908 | 14912 | L: linux-ide@vger.kernel.org | |
| 14909 | 14913 | S: Maintained | |
| 14910 | - | T: git git://git.kernel.org/pub/scm/linux/kernel/git/libata/linux.git for-next | |
| 14914 | + | T: git git://git.kernel.org/pub/scm/linux/kernel/git/libata/linux.git | |
| 14911 | 14915 | F: Documentation/ABI/testing/sysfs-ata | |
| 14912 | 14916 | F: Documentation/devicetree/bindings/ata/ | |
| 14913 | 14917 | F: drivers/ata/ | |
| @@ -15023,8 +15027,6 @@ M: Madhavan Srinivasan <maddy@linux.ibm.com> | |||
| 15023 | 15027 | R: Michael Ellerman <mpe@ellerman.id.au> | |
| 15024 | 15028 | R: Nicholas Piggin <npiggin@gmail.com> | |
| 15025 | 15029 | R: Christophe Leroy (CS GROUP) <chleroy@kernel.org> | |
| 15026 | - | R: Ritesh Harjani (IBM) <ritesh.list@gmail.com> | |
| 15027 | - | R: Shrikanth Hegde <sshegde@linux.ibm.com> | |
| 15028 | 15030 | L: linuxppc-dev@lists.ozlabs.org | |
| 15029 | 15031 | S: Supported | |
| 15030 | 15032 | W: https://github.com/linuxppc/wiki/wiki | |
| @@ -17034,8 +17036,8 @@ MEMBLOCK AND MEMORY MANAGEMENT INITIALIZATION | |||
| 17034 | 17036 | M: Mike Rapoport <rppt@kernel.org> | |
| 17035 | 17037 | L: linux-mm@kvack.org | |
| 17036 | 17038 | S: Maintained | |
| 17037 | - | T: git git://git.kernel.org/pub/scm/linux/kernel/git/mm/memblock.git for-next | |
| 17038 | - | T: git git://git.kernel.org/pub/scm/linux/kernel/git/mm/memblock.git fixes | |
| 17039 | + | T: git git://git.kernel.org/pub/scm/linux/kernel/git/rppt/memblock.git for-next | |
| 17040 | + | T: git git://git.kernel.org/pub/scm/linux/kernel/git/rppt/memblock.git fixes | |
| 17039 | 17041 | F: Documentation/core-api/boot-time-mm.rst | |
| 17040 | 17042 | F: include/linux/kho/abi/memblock.h | |
| 17041 | 17043 | F: include/linux/memblock.h | |
| @@ -17196,7 +17198,7 @@ F: tools/testing/selftests/mm/gup_test.c | |||
| 17196 | 17198 | MEMORY MANAGEMENT - KSM (Kernel Samepage Merging) | |
| 17197 | 17199 | M: Andrew Morton <akpm@linux-foundation.org> | |
| 17198 | 17200 | M: David Hildenbrand <david@kernel.org> | |
| 17199 | - | R: Xu Xin <xu.xin@linux.dev> | |
| 17201 | + | R: Xu Xin <xu.xin16@zte.com.cn> | |
| 17200 | 17202 | R: Chengming Zhou <chengming.zhou@linux.dev> | |
| 17201 | 17203 | L: linux-mm@kvack.org | |
| 17202 | 17204 | S: Maintained | |
| @@ -17210,6 +17212,31 @@ F: include/trace/events/ksm.h | |||
| 17210 | 17212 | F: mm/ksm.c | |
| 17211 | 17213 | F: mm/mm_slot.h | |
| 17212 | 17214 | ||
| 17215 | + | MEMORY MANAGEMENT - MEMORY POLICY AND MIGRATION | |
| 17216 | + | M: Andrew Morton <akpm@linux-foundation.org> | |
| 17217 | + | M: David Hildenbrand <david@kernel.org> | |
| 17218 | + | R: Zi Yan <ziy@nvidia.com> | |
| 17219 | + | R: Matthew Brost <matthew.brost@intel.com> | |
| 17220 | + | R: Joshua Hahn <joshua.hahnjy@gmail.com> | |
| 17221 | + | R: Rakie Kim <rakie.kim@sk.com> | |
| 17222 | + | R: Byungchul Park <byungchul@sk.com> | |
| 17223 | + | R: Gregory Price <gourry@gourry.net> | |
| 17224 | + | R: Ying Huang <ying.huang@linux.alibaba.com> | |
| 17225 | + | R: Alistair Popple <apopple@nvidia.com> | |
| 17226 | + | L: linux-mm@kvack.org | |
| 17227 | + | S: Maintained | |
| 17228 | + | W: http://www.linux-mm.org | |
| 17229 | + | T: git git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm | |
| 17230 | + | F: Documentation/ABI/testing/sysfs-kernel-mm-mempolicy | |
| 17231 | + | F: Documentation/ABI/testing/sysfs-kernel-mm-mempolicy-weighted-interleave | |
| 17232 | + | F: include/linux/mempolicy.h | |
| 17233 | + | F: include/uapi/linux/mempolicy.h | |
| 17234 | + | F: include/linux/migrate.h | |
| 17235 | + | F: include/linux/migrate_mode.h | |
| 17236 | + | F: mm/mempolicy.c | |
| 17237 | + | F: mm/migrate.c | |
| 17238 | + | F: mm/migrate_device.c | |
| 17239 | + | ||
| 17213 | 17240 | MEMORY MANAGEMENT - MGLRU (MULTI-GEN LRU) | |
| 17214 | 17241 | M: Andrew Morton <akpm@linux-foundation.org> | |
| 17215 | 17242 | R: Kairui Song <kasong@tencent.com> | |
| @@ -17219,8 +17246,6 @@ R: Barry Song <baohua@kernel.org> | |||
| 17219 | 17246 | R: Axel Rasmussen <axelrasmussen@google.com> | |
| 17220 | 17247 | R: Yuanchu Xie <yuanchu@google.com> | |
| 17221 | 17248 | R: Wei Xu <weixugc@google.com> | |
| 17222 | - | R: Baoquan He <baoquan.he@linux.dev> | |
| 17223 | - | R: Baolin Wang <baolin.wang@linux.alibaba.com> | |
| 17224 | 17249 | L: linux-mm@kvack.org | |
| 17225 | 17250 | S: Maintained | |
| 17226 | 17251 | W: http://www.linux-mm.org | |
| @@ -17232,25 +17257,6 @@ F: include/linux/mmzone.h | |||
| 17232 | 17257 | F: mm/vmscan.c | |
| 17233 | 17258 | F: mm/workingset.c | |
| 17234 | 17259 | ||
| 17235 | - | MEMORY MANAGEMENT - MIGRATION | |
| 17236 | - | M: Andrew Morton <akpm@linux-foundation.org> | |
| 17237 | - | M: David Hildenbrand <david@kernel.org> | |
| 17238 | - | R: Zi Yan <ziy@nvidia.com> | |
| 17239 | - | R: Matthew Brost <matthew.brost@intel.com> | |
| 17240 | - | R: Joshua Hahn <joshua.hahnjy@gmail.com> | |
| 17241 | - | R: Byungchul Park <byungchul@sk.com> | |
| 17242 | - | R: Gregory Price <gourry@gourry.net> | |
| 17243 | - | R: Ying Huang <ying.huang@linux.alibaba.com> | |
| 17244 | - | R: Alistair Popple <apopple@nvidia.com> | |
| 17245 | - | L: linux-mm@kvack.org | |
| 17246 | - | S: Maintained | |
| 17247 | - | W: http://www.linux-mm.org | |
| 17248 | - | T: git git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm | |
| 17249 | - | F: include/linux/migrate.h | |
| 17250 | - | F: include/linux/migrate_mode.h | |
| 17251 | - | F: mm/migrate.c | |
| 17252 | - | F: mm/migrate_device.c | |
| 17253 | - | ||
| 17254 | 17260 | MEMORY MANAGEMENT - MISC | |
| 17255 | 17261 | M: Andrew Morton <akpm@linux-foundation.org> | |
| 17256 | 17262 | M: David Hildenbrand <david@kernel.org> | |
| @@ -17266,6 +17272,7 @@ W: http://www.linux-mm.org | |||
| 17266 | 17272 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm | |
| 17267 | 17273 | F: Documentation/ABI/testing/sysfs-kernel-mm | |
| 17268 | 17274 | F: Documentation/ABI/testing/sysfs-kernel-mm-cma | |
| 17275 | + | F: Documentation/ABI/testing/sysfs-kernel-mm-memory-tiers | |
| 17269 | 17276 | F: Documentation/ABI/testing/sysfs-kernel-mm-numa | |
| 17270 | 17277 | F: Documentation/admin-guide/mm/ | |
| 17271 | 17278 | F: Documentation/mm/ | |
| @@ -17273,6 +17280,7 @@ F: drivers/char/mem.c | |||
| 17273 | 17280 | F: include/linux/cma.h | |
| 17274 | 17281 | F: include/linux/dmapool.h | |
| 17275 | 17282 | F: include/linux/ioremap.h | |
| 17283 | + | F: include/linux/memory-tiers.h | |
| 17276 | 17284 | F: include/linux/page_idle.h | |
| 17277 | 17285 | F: mm/backing-dev.c | |
| 17278 | 17286 | F: mm/cma.c | |
| @@ -17284,6 +17292,7 @@ F: mm/early_ioremap.c | |||
| 17284 | 17292 | F: mm/fadvise.c | |
| 17285 | 17293 | F: mm/ioremap.c | |
| 17286 | 17294 | F: mm/mapping_dirty_helpers.c | |
| 17295 | + | F: mm/memory-tiers.c | |
| 17287 | 17296 | F: mm/page_idle.c | |
| 17288 | 17297 | F: mm/pgalloc-track.h | |
| 17289 | 17298 | F: mm/process_vm_access.c | |
| @@ -17300,27 +17309,6 @@ F: mm/numa.c | |||
| 17300 | 17309 | F: mm/numa_emulation.c | |
| 17301 | 17310 | F: mm/numa_memblks.c | |
| 17302 | 17311 | ||
| 17303 | - | MEMORY MANAGEMENT - NUMA PLACEMENT | |
| 17304 | - | M: Andrew Morton <akpm@linux-foundation.org> | |
| 17305 | - | M: David Hildenbrand <david@kernel.org> | |
| 17306 | - | M: Gregory Price <gourry@gourry.net> | |
| 17307 | - | R: Zi Yan <ziy@nvidia.com> | |
| 17308 | - | R: Joshua Hahn <joshua.hahnjy@gmail.com> | |
| 17309 | - | R: Rakie Kim <rakie.kim@sk.com> | |
| 17310 | - | R: Ying Huang <ying.huang@linux.alibaba.com> | |
| 17311 | - | L: linux-mm@kvack.org | |
| 17312 | - | S: Maintained | |
| 17313 | - | W: http://www.linux-mm.org | |
| 17314 | - | T: git git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm | |
| 17315 | - | F: Documentation/ABI/testing/sysfs-kernel-mm-memory-tiers | |
| 17316 | - | F: Documentation/ABI/testing/sysfs-kernel-mm-mempolicy | |
| 17317 | - | F: Documentation/ABI/testing/sysfs-kernel-mm-mempolicy-weighted-interleave | |
| 17318 | - | F: include/linux/memory-tiers.h | |
| 17319 | - | F: include/linux/mempolicy.h | |
| 17320 | - | F: include/uapi/linux/mempolicy.h | |
| 17321 | - | F: mm/memory-tiers.c | |
| 17322 | - | F: mm/mempolicy.c | |
| 17323 | - | ||
| 17324 | 17312 | MEMORY MANAGEMENT - OOM KILLER | |
| 17325 | 17313 | M: Michal Hocko <mhocko@suse.com> | |
| 17326 | 17314 | R: David Rientjes <rientjes@google.com> | |
| @@ -17428,6 +17416,7 @@ F: mm/swapfile.c | |||
| 17428 | 17416 | MEMORY MANAGEMENT - THP (TRANSPARENT HUGE PAGE) | |
| 17429 | 17417 | M: Andrew Morton <akpm@linux-foundation.org> | |
| 17430 | 17418 | M: David Hildenbrand <david@kernel.org> | |
| 17419 | + | M: Lorenzo Stoakes <ljs@kernel.org> | |
| 17431 | 17420 | R: Zi Yan <ziy@nvidia.com> | |
| 17432 | 17421 | R: Baolin Wang <baolin.wang@linux.alibaba.com> | |
| 17433 | 17422 | R: Liam R. Howlett <liam@infradead.org> | |
| @@ -17437,7 +17426,6 @@ R: Dev Jain <dev.jain@arm.com> | |||
| 17437 | 17426 | R: Barry Song <baohua@kernel.org> | |
| 17438 | 17427 | R: Lance Yang <lance.yang@linux.dev> | |
| 17439 | 17428 | R: Usama Arif <usama.arif@linux.dev> | |
| 17440 | - | R: Kiryl Shutsemau <kas@kernel.org> | |
| 17441 | 17429 | L: linux-mm@kvack.org | |
| 17442 | 17430 | S: Maintained | |
| 17443 | 17431 | W: http://www.linux-mm.org | |
| @@ -17710,7 +17698,7 @@ F: Documentation/devicetree/bindings/serial/atmel,at91-usart.yaml | |||
| 17710 | 17698 | F: drivers/spi/spi-at91-usart.c | |
| 17711 | 17699 | ||
| 17712 | 17700 | MICROCHIP ATSHA204A DRIVER | |
| 17713 | - | M: Thorsten Blum <blum@kernel.org> | |
| 17701 | + | M: Thorsten Blum <thorsten.blum@linux.dev> | |
| 17714 | 17702 | L: linux-crypto@vger.kernel.org | |
| 17715 | 17703 | S: Maintained | |
| 17716 | 17704 | F: drivers/crypto/atmel-sha204a.c | |
| @@ -17734,7 +17722,7 @@ F: Documentation/devicetree/bindings/media/microchip,csi2dc.yaml | |||
| 17734 | 17722 | F: drivers/media/platform/microchip/microchip-csi2dc.c | |
| 17735 | 17723 | ||
| 17736 | 17724 | MICROCHIP ECC DRIVER | |
| 17737 | - | M: Thorsten Blum <blum@kernel.org> | |
| 17725 | + | M: Thorsten Blum <thorsten.blum@linux.dev> | |
| 17738 | 17726 | L: linux-crypto@vger.kernel.org | |
| 17739 | 17727 | S: Maintained | |
| 17740 | 17728 | F: drivers/crypto/atmel-ecc.c | |
| @@ -18898,7 +18886,7 @@ F: net/core/drop_monitor.c | |||
| 18898 | 18886 | NETWORKING DRIVERS | |
| 18899 | 18887 | M: Andrew Lunn <andrew+netdev@lunn.ch> | |
| 18900 | 18888 | M: "David S. Miller" <davem@davemloft.net> | |
| 18901 | - | M: Eric Dumazet <edumazet@kernel.org> | |
| 18889 | + | M: Eric Dumazet <edumazet@google.com> | |
| 18902 | 18890 | M: Jakub Kicinski <kuba@kernel.org> | |
| 18903 | 18891 | M: Paolo Abeni <pabeni@redhat.com> | |
| 18904 | 18892 | L: netdev@vger.kernel.org | |
| @@ -19015,7 +19003,7 @@ K: struct\s+phy_port|phy_port_ | |||
| 19015 | 19003 | ||
| 19016 | 19004 | NETWORKING [GENERAL] | |
| 19017 | 19005 | M: "David S. Miller" <davem@davemloft.net> | |
| 19018 | - | M: Eric Dumazet <edumazet@kernel.org> | |
| 19006 | + | M: Eric Dumazet <edumazet@google.com> | |
| 19019 | 19007 | M: Jakub Kicinski <kuba@kernel.org> | |
| 19020 | 19008 | M: Paolo Abeni <pabeni@redhat.com> | |
| 19021 | 19009 | R: Simon Horman <horms@kernel.org> | |
| @@ -19241,7 +19229,7 @@ F: net/ipv6/seg6* | |||
| 19241 | 19229 | F: tools/testing/selftests/net/srv6* | |
| 19242 | 19230 | ||
| 19243 | 19231 | NETWORKING [TCP] | |
| 19244 | - | M: Eric Dumazet <edumazet@kernel.org> | |
| 19232 | + | M: Eric Dumazet <edumazet@google.com> | |
| 19245 | 19233 | M: Neal Cardwell <ncardwell@google.com> | |
| 19246 | 19234 | R: Kuniyuki Iwashima <kuniyu@google.com> | |
| 19247 | 19235 | L: netdev@vger.kernel.org | |
| @@ -19274,7 +19262,7 @@ F: net/tls/ | |||
| 19274 | 19262 | F: tools/testing/selftests/net/tls.c | |
| 19275 | 19263 | ||
| 19276 | 19264 | NETWORKING [SOCKETS] | |
| 19277 | - | M: Eric Dumazet <edumazet@kernel.org> | |
| 19265 | + | M: Eric Dumazet <edumazet@google.com> | |
| 19278 | 19266 | M: Kuniyuki Iwashima <kuniyu@google.com> | |
| 19279 | 19267 | M: Paolo Abeni <pabeni@redhat.com> | |
| 19280 | 19268 | M: Willem de Bruijn <willemb@google.com> | |
| @@ -19581,7 +19569,7 @@ F: include/linux/platform_data/x86/nvidia-wmi-ec-backlight.h | |||
| 19581 | 19569 | ||
| 19582 | 19570 | NVM EXPRESS DRIVER | |
| 19583 | 19571 | M: Keith Busch <kbusch@kernel.org> | |
| 19584 | - | M: Jens Axboe <axboe@kernel.dk> | |
| 19572 | + | M: Jens Axboe <axboe@fb.com> | |
| 19585 | 19573 | M: Christoph Hellwig <hch@lst.de> | |
| 19586 | 19574 | M: Sagi Grimberg <sagi@grimberg.me> | |
| 19587 | 19575 | L: linux-nvme@lists.infradead.org | |
| @@ -20570,7 +20558,6 @@ ORACLE CLUSTER FILESYSTEM 2 (OCFS2) | |||
| 20570 | 20558 | M: Mark Fasheh <mark@fasheh.com> | |
| 20571 | 20559 | M: Joel Becker <jlbec@evilplan.org> | |
| 20572 | 20560 | M: Joseph Qi <joseph.qi@linux.alibaba.com> | |
| 20573 | - | R: Heming Zhao <heming.zhao@suse.com> | |
| 20574 | 20561 | L: ocfs2-devel@lists.linux.dev | |
| 20575 | 20562 | S: Supported | |
| 20576 | 20563 | W: http://ocfs2.wiki.kernel.org | |
| @@ -24489,11 +24476,6 @@ R: Marc Murphy <marc.murphy@sancloud.com> | |||
| 24489 | 24476 | S: Supported | |
| 24490 | 24477 | F: arch/arm/boot/dts/ti/omap/am335x-sancloud* | |
| 24491 | 24478 | ||
| 24492 | - | SB1250-DUART BROADCOM SOC SERIAL DRIVER | |
| 24493 | - | M: "Maciej W. Rozycki" <macro@orcam.me.uk> | |
| 24494 | - | S: Maintained | |
| 24495 | - | F: drivers/tty/serial/sb1250-duart.c | |
| 24496 | - | ||
| 24497 | 24479 | SBOM | |
| 24498 | 24480 | M: Luis Augenstein <luis.augenstein@tngtech.com> | |
| 24499 | 24481 | M: Maximilian Huber <maximilian.huber@tngtech.com> | |
| @@ -24796,7 +24778,7 @@ K: \bsecurity_[a-z_0-9]\+\b | |||
| 24796 | 24778 | SELINUX SECURITY MODULE | |
| 24797 | 24779 | M: Paul Moore <paul@paul-moore.com> | |
| 24798 | 24780 | M: Stephen Smalley <stephen.smalley.work@gmail.com> | |
| 24799 | - | R: Ondrej Mosnáček <omosnacek@gmail.com> | |
| 24781 | + | R: Ondrej Mosnacek <omosnace@redhat.com> | |
| 24800 | 24782 | L: selinux@vger.kernel.org | |
| 24801 | 24783 | S: Supported | |
| 24802 | 24784 | W: https://github.com/SELinuxProject | |
| @@ -25204,7 +25186,7 @@ R: David Rientjes <rientjes@google.com> | |||
| 25204 | 25186 | R: Roman Gushchin <roman.gushchin@linux.dev> | |
| 25205 | 25187 | L: linux-mm@kvack.org | |
| 25206 | 25188 | S: Maintained | |
| 25207 | - | T: git git://git.kernel.org/pub/scm/linux/kernel/git/mm/slab.git | |
| 25189 | + | T: git git://git.kernel.org/pub/scm/linux/kernel/git/vbabka/slab.git | |
| 25208 | 25190 | F: Documentation/admin-guide/mm/slab.rst | |
| 25209 | 25191 | F: Documentation/mm/slab.rst | |
| 25210 | 25192 | F: include/linux/mempool.h | |
| @@ -25254,9 +25236,10 @@ F: Documentation/admin-guide/LSM/Smack.rst | |||
| 25254 | 25236 | F: security/smack/ | |
| 25255 | 25237 | ||
| 25256 | 25238 | SMBDIRECT (RDMA Stream Transport with Read/Write-Offload, MS-SMBD) | |
| 25239 | + | M: Steve French <smfrench@gmail.com> | |
| 25240 | + | M: Steve French <sfrench@samba.org> | |
| 25257 | 25241 | M: Namjae Jeon <linkinjeon@kernel.org> | |
| 25258 | 25242 | M: Namjae Jeon <linkinjeon@samba.org> | |
| 25259 | - | M: Paulo Alcantara <pc@manguebit.org> | |
| 25260 | 25243 | R: Stefan Metzmacher <metze@samba.org> | |
| 25261 | 25244 | R: Tom Talpey <tom@talpey.com> | |
| 25262 | 25245 | L: linux-cifs@vger.kernel.org | |
| @@ -25359,8 +25342,8 @@ F: Documentation/networking/timestamping.rst | |||
| 25359 | 25342 | F: include/linux/net_tstamp.h | |
| 25360 | 25343 | F: include/uapi/linux/net_tstamp.h | |
| 25361 | 25344 | F: tools/testing/selftests/bpf/*/net_timestamping* | |
| 25362 | - | F: tools/testing/selftests/drivers/net/so_txtime.* | |
| 25363 | 25345 | F: tools/testing/selftests/net/*timestamp* | |
| 25346 | + | F: tools/testing/selftests/net/so_txtime.c | |
| 25364 | 25347 | ||
| 25365 | 25348 | SOEKRIS NET48XX LED SUPPORT | |
| 25366 | 25349 | M: Chris Boot <bootc@bootc.net> | |
| @@ -25427,7 +25410,7 @@ F: drivers/md/md* | |||
| 25427 | 25410 | F: drivers/md/raid* | |
| 25428 | 25411 | F: include/linux/raid/ | |
| 25429 | 25412 | F: include/uapi/linux/raid/ | |
| 25430 | - | F: lib/raid/ | |
| 25413 | + | F: lib/raid/raid6/ | |
| 25431 | 25414 | ||
| 25432 | 25415 | SOLIDRUN CLEARFOG SUPPORT | |
| 25433 | 25416 | M: Russell King <linux@armlinux.org.uk> | |
| @@ -26971,7 +26954,8 @@ S: Maintained | |||
| 26971 | 26954 | F: drivers/net/ethernet/tehuti/tn40* | |
| 26972 | 26955 | ||
| 26973 | 26956 | TELECOM CLOCK DRIVER FOR MCPL0010 | |
| 26974 | - | S: Orphan | |
| 26957 | + | M: Mark Gross <markgross@kernel.org> | |
| 26958 | + | S: Supported | |
| 26975 | 26959 | F: drivers/char/tlclk.c | |
| 26976 | 26960 | ||
| 26977 | 26961 | TEMPO SEMICONDUCTOR DRIVERS | |
| @@ -28632,6 +28616,7 @@ L: iommu@lists.linux.dev | |||
| 28632 | 28616 | S: Maintained | |
| 28633 | 28617 | F: Documentation/devicetree/bindings/iommu/verisilicon,iommu.yaml | |
| 28634 | 28618 | F: drivers/iommu/vsi-iommu.c | |
| 28619 | + | F: include/linux/vsi-iommu.h | |
| 28635 | 28620 | ||
| 28636 | 28621 | VF610 NAND DRIVER | |
| 28637 | 28622 | M: Stefan Agner <stefan@agner.ch> | |
| @@ -28891,8 +28876,8 @@ F: include/uapi/linux/virtio_console.h | |||
| 28891 | 28876 | VIRTIO CORE | |
| 28892 | 28877 | M: "Michael S. Tsirkin" <mst@redhat.com> | |
| 28893 | 28878 | M: Jason Wang <jasowangio@gmail.com> | |
| 28894 | - | M: Eugenio Pérez <eperezma@redhat.com> | |
| 28895 | 28879 | R: Xuan Zhuo <xuanzhuo@linux.alibaba.com> | |
| 28880 | + | R: Eugenio Pérez <eperezma@redhat.com> | |
| 28896 | 28881 | L: virtualization@lists.linux.dev | |
| 28897 | 28882 | S: Maintained | |
| 28898 | 28883 | F: Documentation/ABI/testing/sysfs-bus-vdpa | |
| @@ -28969,7 +28954,7 @@ F: include/uapi/linux/virtio_gpu.h | |||
| 28969 | 28954 | VIRTIO HOST (VHOST) | |
| 28970 | 28955 | M: "Michael S. Tsirkin" <mst@redhat.com> | |
| 28971 | 28956 | M: Jason Wang <jasowangio@gmail.com> | |
| 28972 | - | M: Eugenio Pérez <eperezma@redhat.com> | |
| 28957 | + | R: Eugenio Pérez <eperezma@redhat.com> | |
| 28973 | 28958 | L: kvm@vger.kernel.org | |
| 28974 | 28959 | L: virtualization@lists.linux.dev | |
| 28975 | 28960 | L: netdev@vger.kernel.org | |
| @@ -29024,8 +29009,8 @@ F: include/uapi/linux/virtio_mem.h | |||
| 29024 | 29009 | VIRTIO NET DRIVER | |
| 29025 | 29010 | M: "Michael S. Tsirkin" <mst@redhat.com> | |
| 29026 | 29011 | M: Jason Wang <jasowangio@gmail.com> | |
| 29027 | - | M: Eugenio Pérez <eperezma@redhat.com> | |
| 29028 | 29012 | R: Xuan Zhuo <xuanzhuo@linux.alibaba.com> | |
| 29013 | + | R: Eugenio Pérez <eperezma@redhat.com> | |
| 29029 | 29014 | L: netdev@vger.kernel.org | |
| 29030 | 29015 | L: virtualization@lists.linux.dev | |
| 29031 | 29016 | S: Maintained | |
| @@ -29041,13 +29026,6 @@ S: Maintained | |||
| 29041 | 29026 | F: drivers/nvdimm/nd_virtio.c | |
| 29042 | 29027 | F: drivers/nvdimm/virtio_pmem.c | |
| 29043 | 29028 | ||
| 29044 | - | VIRTIO RNG DRIVER | |
| 29045 | - | M: Laurent Vivier <lvivier@redhat.com> | |
| 29046 | - | L: virtualization@lists.linux.dev | |
| 29047 | - | S: Maintained | |
| 29048 | - | F: drivers/char/hw_random/virtio-rng.c | |
| 29049 | - | F: include/uapi/linux/virtio_rng.h | |
| 29050 | - | ||
| 29051 | 29029 | VIRTIO RTC DRIVER | |
| 29052 | 29030 | M: Peter Hilber <peter.hilber@oss.qualcomm.com> | |
| 29053 | 29031 | L: virtualization@lists.linux.dev | |
| @@ -29379,7 +29357,7 @@ M: Guenter Roeck <linux@roeck-us.net> | |||
| 29379 | 29357 | L: linux-watchdog@vger.kernel.org | |
| 29380 | 29358 | S: Maintained | |
| 29381 | 29359 | W: http://www.linux-watchdog.org/ | |
| 29382 | - | T: git git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git | |
| 29360 | + | T: git git://www.linux-watchdog.org/linux-watchdog.git | |
| 29383 | 29361 | F: Documentation/devicetree/bindings/watchdog/ | |
| 29384 | 29362 | F: Documentation/watchdog/ | |
| 29385 | 29363 | F: drivers/watchdog/ | |
| @@ -29959,14 +29937,12 @@ F: include/uapi/linux/xilinx-v4l2-controls.h | |||
| 29959 | 29937 | XILINX VERSAL EDAC DRIVER | |
| 29960 | 29938 | M: Shubhrajyoti Datta <shubhrajyoti.datta@amd.com> | |
| 29961 | 29939 | M: Sai Krishna Potthuri <sai.krishna.potthuri@amd.com> | |
| 29962 | - | R: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com> | |
| 29963 | 29940 | S: Maintained | |
| 29964 | 29941 | F: Documentation/devicetree/bindings/memory-controllers/xlnx,versal-ddrmc-edac.yaml | |
| 29965 | 29942 | F: drivers/edac/versal_edac.c | |
| 29966 | 29943 | ||
| 29967 | 29944 | XILINX VERSALNET EDAC DRIVER | |
| 29968 | 29945 | M: Shubhrajyoti Datta <shubhrajyoti.datta@amd.com> | |
| 29969 | - | R: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com> | |
| 29970 | 29946 | S: Maintained | |
| 29971 | 29947 | F: Documentation/devicetree/bindings/memory-controllers/xlnx,versal-net-ddrmc5.yaml | |
| 29972 | 29948 | F: drivers/edac/versalnet_edac.c | |
| @@ -30012,7 +29988,6 @@ F: include/dt-bindings/dma/xlnx-zynqmp-dpdma.h | |||
| 30012 | 29988 | XILINX ZYNQMP OCM EDAC DRIVER | |
| 30013 | 29989 | M: Shubhrajyoti Datta <shubhrajyoti.datta@amd.com> | |
| 30014 | 29990 | M: Sai Krishna Potthuri <sai.krishna.potthuri@amd.com> | |
| 30015 | - | R: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com> | |
| 30016 | 29991 | S: Maintained | |
| 30017 | 29992 | F: Documentation/devicetree/bindings/memory-controllers/xlnx,zynqmp-ocmc-1.0.yaml | |
| 30018 | 29993 | F: drivers/edac/zynqmp_edac.c | |
modified Makefile
| @@ -2,7 +2,7 @@ | |||
| 2 | 2 | VERSION = 7 | |
| 3 | 3 | PATCHLEVEL = 3 | |
| 4 | 4 | SUBLEVEL = 0 | |
| 5 | - | EXTRAVERSION = -rc7 | |
| 5 | + | EXTRAVERSION = -rc1 | |
| 6 | 6 | NAME = Baby Opossum Posse | |
| 7 | 7 | ||
| 8 | 8 | # *DOCUMENTATION* | |
modified arch/arc/Kconfig
| @@ -331,9 +331,13 @@ config ARC_FPU_SAVE_RESTORE | |||
| 331 | 331 | for floating point exceptions and rounding modes. These are | |
| 332 | 332 | preserved across task context switch when enabled. | |
| 333 | 333 | ||
| 334 | + | config ARC_CANT_LLSC | |
| 335 | + | def_bool n | |
| 336 | + | ||
| 334 | 337 | config ARC_HAS_LLSC | |
| 335 | 338 | bool "Insn: LLOCK/SCOND (efficient atomic ops)" | |
| 336 | 339 | default y | |
| 340 | + | depends on !ARC_CANT_LLSC | |
| 337 | 341 | ||
| 338 | 342 | if ISA_ARCV2 | |
| 339 | 343 | ||
modified arch/arc/include/asm/atomic64-arcv2.h
| @@ -156,12 +156,6 @@ static inline u64 __arch_cmpxchg64_relaxed(volatile void *ptr, u64 old, u64 new) | |||
| 156 | 156 | } | |
| 157 | 157 | #define arch_cmpxchg64_relaxed __arch_cmpxchg64_relaxed | |
| 158 | 158 | ||
| 159 | - | static inline s64 arch_atomic64_cmpxchg_relaxed(atomic64_t *v, s64 old, s64 new) | |
| 160 | - | { | |
| 161 | - | return arch_cmpxchg64_relaxed(&v->counter, old, new); | |
| 162 | - | } | |
| 163 | - | #define arch_atomic64_cmpxchg_relaxed arch_atomic64_cmpxchg_relaxed | |
| 164 | - | ||
| 165 | 159 | static inline s64 arch_atomic64_xchg(atomic64_t *ptr, s64 new) | |
| 166 | 160 | { | |
| 167 | 161 | s64 prev; | |
modified arch/arc/include/asm/cmpxchg.h
| @@ -46,7 +46,7 @@ | |||
| 46 | 46 | __typeof__(*(ptr)) _n_ = (new); \ | |
| 47 | 47 | __typeof__(*(ptr)) _prev_; \ | |
| 48 | 48 | \ | |
| 49 | - | switch (sizeof(*(_p_))) { \ | |
| 49 | + | switch(sizeof((_p_))) { \ | |
| 50 | 50 | case 1: \ | |
| 51 | 51 | _prev_ = (__typeof__(*(ptr)))cmpxchg_emu_u8((volatile u8 *__force)_p_, (uintptr_t)_o_, (uintptr_t)_n_); \ | |
| 52 | 52 | break; \ | |
| @@ -102,7 +102,7 @@ | |||
| 102 | 102 | __typeof__(ptr) _p_ = (ptr); \ | |
| 103 | 103 | __typeof__(*(ptr)) _val_ = (val); \ | |
| 104 | 104 | \ | |
| 105 | - | switch (sizeof(*(_p_))) { \ | |
| 105 | + | switch(sizeof(*(_p_))) { \ | |
| 106 | 106 | case 4: \ | |
| 107 | 107 | _val_ = __arch_xchg(_p_, _val_); \ | |
| 108 | 108 | break; \ | |
modified arch/arc/kernel/setup.c
| @@ -593,7 +593,6 @@ static int show_cpuinfo(struct seq_file *m, void *v) | |||
| 593 | 593 | cpu_id); | |
| 594 | 594 | } else { | |
| 595 | 595 | freq = clk_get_rate(cpu_clk); | |
| 596 | - | clk_put(cpu_clk); | |
| 597 | 596 | } | |
| 598 | 597 | if (freq) | |
| 599 | 598 | seq_printf(m, "CPU speed\t: %lu.%02lu Mhz\n", | |
modified arch/arc/kernel/smp.c
| @@ -12,6 +12,7 @@ | |||
| 12 | 12 | #include <linux/spinlock.h> | |
| 13 | 13 | #include <linux/sched/mm.h> | |
| 14 | 14 | #include <linux/interrupt.h> | |
| 15 | + | #include <linux/profile.h> | |
| 15 | 16 | #include <linux/mm.h> | |
| 16 | 17 | #include <linux/cpu.h> | |
| 17 | 18 | #include <linux/irq.h> | |
modified arch/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/Kconfig
| @@ -1040,17 +1040,9 @@ config ARM64_ERRATUM_1902691 | |||
| 1040 | 1040 | ||
| 1041 | 1041 | If unsure, say Y. | |
| 1042 | 1042 | ||
| 1043 | - | config ARM64_WORKAROUND_BROKEN_AMU_CONSTCNT | |
| 1044 | - | bool | |
| 1045 | - | # Targeting errata affecting AMEVCNTR01, the AMU constant counter. | |
| 1046 | - | # On affected CPUs the counter may not increment at the expected rate, | |
| 1047 | - | # making it unreliable. As a result, AMU users should treat it as | |
| 1048 | - | # unavailable rather than relying on misleading counter values. | |
| 1049 | - | ||
| 1050 | 1043 | config ARM64_ERRATUM_2457168 | |
| 1051 | 1044 | bool "Cortex-A510: 2457168: workaround for AMEVCNTR01 incrementing incorrectly" | |
| 1052 | 1045 | depends on ARM64_AMU_EXTN | |
| 1053 | - | select ARM64_WORKAROUND_BROKEN_AMU_CONSTCNT | |
| 1054 | 1046 | default y | |
| 1055 | 1047 | help | |
| 1056 | 1048 | This option adds the workaround for ARM Cortex-A510 erratum 2457168. | |
| @@ -1081,28 +1073,6 @@ config ARM64_ERRATUM_2645198 | |||
| 1081 | 1073 | ||
| 1082 | 1074 | If unsure, say Y. | |
| 1083 | 1075 | ||
| 1084 | - | config ARM64_ERRATUM_3821522 | |
| 1085 | - | bool "Cortex-A725: 3821522: workaround for possible CNT_CYCLES increment error due to WFE/WFI" | |
| 1086 | - | depends on ARM64_AMU_EXTN | |
| 1087 | - | select ARM64_WORKAROUND_BROKEN_AMU_CONSTCNT | |
| 1088 | - | default y | |
| 1089 | - | help | |
| 1090 | - | This option adds the workaround for ARM Cortex-A725 erratum 3821522. | |
| 1091 | - | ||
| 1092 | - | On affected A725 cores, the CNT_CYCLES event may incur a significant | |
| 1093 | - | increment error when entering and subsequently exiting WFx. | |
| 1094 | - | As a result, the CNT_CYCLES may diverge from the system counter | |
| 1095 | - | frequency at which it is expected to increment. | |
| 1096 | - | This renders the AMU counter AMEVCNTR01, that implements CNT_CYCLES, | |
| 1097 | - | being unreliable and unsuitable for use. | |
| 1098 | - | ||
| 1099 | - | Since there is no hardware workaround, reads of the affected CNT_CYCLES | |
| 1100 | - | counter return 0 in the relevant paths. This causes users of the counter | |
| 1101 | - | to treat it as unavailable and is functionally equivalent to firmware | |
| 1102 | - | disabling the affected counter. | |
| 1103 | - | ||
| 1104 | - | If unsure, say Y. | |
| 1105 | - | ||
| 1106 | 1076 | config ARM64_WORKAROUND_SPECULATIVE_UNPRIV_LOAD | |
| 1107 | 1077 | bool | |
| 1108 | 1078 | ||
modified arch/arm64/boot/dts/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/crypto/aes-neonbs-glue.c
| @@ -66,7 +66,7 @@ static int aesbs_setkey(struct crypto_skcipher *tfm, const u8 *in_key, | |||
| 66 | 66 | struct crypto_aes_ctx *rk; | |
| 67 | 67 | int err; | |
| 68 | 68 | ||
| 69 | - | rk = kmalloc_obj(*rk); | |
| 69 | + | rk = kmalloc(sizeof(*rk), GFP_KERNEL); | |
| 70 | 70 | if (!rk) | |
| 71 | 71 | return -ENOMEM; | |
| 72 | 72 | ||
| @@ -128,7 +128,7 @@ static int aesbs_cbc_ctr_setkey(struct crypto_skcipher *tfm, const u8 *in_key, | |||
| 128 | 128 | struct crypto_aes_ctx *rk; | |
| 129 | 129 | int err; | |
| 130 | 130 | ||
| 131 | - | rk = kmalloc_obj(*rk); | |
| 131 | + | rk = kmalloc(sizeof(*rk), GFP_KERNEL); | |
| 132 | 132 | if (!rk) | |
| 133 | 133 | return -ENOMEM; | |
| 134 | 134 | ||
modified arch/arm64/include/asm/cpu.h
| @@ -78,6 +78,5 @@ void __init cpuinfo_store_boot_cpu(void); | |||
| 78 | 78 | void __init init_cpu_features(struct cpuinfo_arm64 *info); | |
| 79 | 79 | void update_cpu_features(int cpu, struct cpuinfo_arm64 *info, | |
| 80 | 80 | struct cpuinfo_arm64 *boot); | |
| 81 | - | bool gmid_el1_accessible(const struct cpuinfo_arm64 *info); | |
| 82 | 81 | ||
| 83 | 82 | #endif /* __ASM_CPU_H */ | |
modified arch/arm64/include/asm/cpufeature.h
| @@ -627,6 +627,13 @@ static inline bool id_aa64pfr1_mpamfrac(u64 pfr1) | |||
| 627 | 627 | return val > 0; | |
| 628 | 628 | } | |
| 629 | 629 | ||
| 630 | + | static inline bool id_aa64pfr1_mte(u64 pfr1) | |
| 631 | + | { | |
| 632 | + | u32 val = cpuid_feature_extract_unsigned_field(pfr1, ID_AA64PFR1_EL1_MTE_SHIFT); | |
| 633 | + | ||
| 634 | + | return val >= ID_AA64PFR1_EL1_MTE_MTE2; | |
| 635 | + | } | |
| 636 | + | ||
| 630 | 637 | void __init setup_boot_cpu_features(void); | |
| 631 | 638 | void __init setup_system_features(void); | |
| 632 | 639 | void __init setup_user_features(void); | |
modified arch/arm64/include/asm/el2_setup.h
| @@ -418,21 +418,14 @@ | |||
| 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 | - | cmp x1, #ID_AA64DFR0_EL1_PMUVer_IMP_DEF | |
| 425 | - | ccmp x1, #ID_AA64DFR0_EL1_PMUVer_V3P9, #8, ne | |
| 426 | - | b.lt .Lskip_pmuv3p9_\@ // Skip if < PMUv3p9 or IMP_DEF | |
| 423 | + | cmp x1, #ID_AA64DFR0_EL1_PMUVer_V3P9 | |
| 424 | + | b.lt .Lskip_pmuv3p9_\@ | |
| 427 | 425 | ||
| 428 | 426 | orr x0, x0, #HDFGRTR2_EL2_nPMICNTR_EL0 | |
| 429 | 427 | orr x0, x0, #HDFGRTR2_EL2_nPMICFILTR_EL0 | |
| 430 | 428 | orr x0, x0, #HDFGRTR2_EL2_nPMUACR_EL1 | |
| 431 | - | orr x2, x2, #HDFGWTR2_EL2_nPMICNTR_EL0 | |
| 432 | - | orr x2, x2, #HDFGWTR2_EL2_nPMICFILTR_EL0 | |
| 433 | - | orr x2, x2, #HDFGWTR2_EL2_nPMUACR_EL1 | |
| 434 | - | /* PMZR_EL0 is write-only, so it has no read trap to disable */ | |
| 435 | - | orr x2, x2, #HDFGWTR2_EL2_nPMZR_EL0 | |
| 436 | 429 | .Lskip_pmuv3p9_\@: | |
| 437 | 430 | /* If SPE is implemented, */ | |
| 438 | 431 | __spe_vers_imp .Lskip_spefds_\@, ID_AA64DFR0_EL1_PMSVer_IMP, x1 | |
| @@ -443,11 +436,10 @@ | |||
| 443 | 436 | cbz x1, .Lskip_spefds_\@ | |
| 444 | 437 | /* disable traps of PMSDSFR to EL2. */ | |
| 445 | 438 | orr x0, x0, #HDFGRTR2_EL2_nPMSDSFR_EL1 | |
| 446 | - | orr x2, x2, #HDFGWTR2_EL2_nPMSDSFR_EL1 | |
| 447 | 439 | ||
| 448 | 440 | .Lskip_spefds_\@: | |
| 449 | 441 | msr_s SYS_HDFGRTR2_EL2, x0 | |
| 450 | - | msr_s SYS_HDFGWTR2_EL2, x2 | |
| 442 | + | msr_s SYS_HDFGWTR2_EL2, x0 | |
| 451 | 443 | msr_s SYS_HFGRTR2_EL2, xzr | |
| 452 | 444 | msr_s SYS_HFGWTR2_EL2, xzr | |
| 453 | 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/Makefile
| @@ -25,9 +25,6 @@ KASAN_SANITIZE_stacktrace.o := n | |||
| 25 | 25 | KCOV_INSTRUMENT_entry-common.o := n | |
| 26 | 26 | KCOV_INSTRUMENT_idle.o := n | |
| 27 | 27 | ||
| 28 | - | # Softirq stack switching can run outside interrupt context. | |
| 29 | - | KCOV_INSTRUMENT_irq.o := n | |
| 30 | - | ||
| 31 | 28 | # Object file lists. | |
| 32 | 29 | obj-y := debug-monitors.o entry.o irq.o fpsimd.o \ | |
| 33 | 30 | entry-common.o process.o ptrace.o \ | |
modified arch/arm64/kernel/cpu_errata.c
| @@ -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; | |
| @@ -85,7 +82,7 @@ is_affected_midr_range(const struct arm64_cpu_capabilities *entry, int scope) | |||
| 85 | 82 | ||
| 86 | 83 | for (i = 0; i < target_impl_cpu_num; i++) { | |
| 87 | 84 | if (__is_affected_midr_range(entry, target_impl_cpus[i].midr, | |
| 88 | - | target_impl_cpus[i].revidr)) | |
| 85 | + | target_impl_cpus[i].midr)) | |
| 89 | 86 | return true; | |
| 90 | 87 | } | |
| 91 | 88 | return false; | |
| @@ -384,20 +381,6 @@ static const struct arm64_cpu_capabilities arm64_repeat_tlbi_list[] = { | |||
| 384 | 381 | }; | |
| 385 | 382 | #endif | |
| 386 | 383 | ||
| 387 | - | #ifdef CONFIG_ARM64_WORKAROUND_BROKEN_AMU_CONSTCNT | |
| 388 | - | static const struct midr_range workaround_amu_constcnt_list[] = { | |
| 389 | - | #ifdef CONFIG_ARM64_ERRATUM_2457168 | |
| 390 | - | /* Cortex-A510 r0p0-r1p1 */ | |
| 391 | - | MIDR_RANGE(MIDR_CORTEX_A510, 0, 0, 1, 1), | |
| 392 | - | #endif | |
| 393 | - | #ifdef CONFIG_ARM64_ERRATUM_3821522 | |
| 394 | - | /* Cortex-A725 r0p0 - r0p2 */ | |
| 395 | - | MIDR_RANGE(MIDR_CORTEX_A725, 0, 0, 0, 2), | |
| 396 | - | #endif | |
| 397 | - | {} | |
| 398 | - | }; | |
| 399 | - | #endif /* CONFIG_ARM64_WORKAROUND_BROKEN_AMU_CONSTCNT */ | |
| 400 | - | ||
| 401 | 384 | #ifdef CONFIG_CAVIUM_ERRATUM_23154 | |
| 402 | 385 | static const struct midr_range cavium_erratum_23154_cpus[] = { | |
| 403 | 386 | MIDR_ALL_VERSIONS(MIDR_THUNDERX), | |
| @@ -933,12 +916,14 @@ const struct arm64_cpu_capabilities arm64_errata[] = { | |||
| 933 | 916 | ERRATA_MIDR_REV_RANGE(MIDR_CORTEX_A510, 0, 0, 2) | |
| 934 | 917 | }, | |
| 935 | 918 | #endif | |
| 936 | - | #ifdef CONFIG_ARM64_WORKAROUND_BROKEN_AMU_CONSTCNT | |
| 919 | + | #ifdef CONFIG_ARM64_ERRATUM_2457168 | |
| 937 | 920 | { | |
| 938 | - | .desc = "Broken AMU AMEVCNTR01 (const counter)", | |
| 939 | - | .capability = ARM64_WORKAROUND_BROKEN_AMU_CONSTCNT, | |
| 921 | + | .desc = "ARM erratum 2457168", | |
| 922 | + | .capability = ARM64_WORKAROUND_2457168, | |
| 940 | 923 | .type = ARM64_CPUCAP_WEAK_LOCAL_CPU_FEATURE, | |
| 941 | - | CAP_MIDR_RANGE_LIST(workaround_amu_constcnt_list) | |
| 924 | + | ||
| 925 | + | /* Cortex-A510 r0p0-r1p1 */ | |
| 926 | + | CAP_MIDR_RANGE(MIDR_CORTEX_A510, 0, 0, 1, 1) | |
| 942 | 927 | }, | |
| 943 | 928 | #endif | |
| 944 | 929 | #ifdef CONFIG_ARM64_ERRATUM_2038923 | |
modified arch/arm64/kernel/cpufeature.c
| @@ -1178,33 +1178,6 @@ static bool detect_ftr_has_mpam(void) | |||
| 1178 | 1178 | return id_aa64pfr0_mpam(pfr0) || id_aa64pfr1_mpamfrac(pfr1); | |
| 1179 | 1179 | } | |
| 1180 | 1180 | ||
| 1181 | - | bool gmid_el1_accessible(const struct cpuinfo_arm64 *info) | |
| 1182 | - | { | |
| 1183 | - | const struct arm64_ftr_bits *ftrp; | |
| 1184 | - | s64 mte, ovr; | |
| 1185 | - | u64 ftr_mask; | |
| 1186 | - | ||
| 1187 | - | /* No ID register reflects CONFIG_ARM64_MTE. */ | |
| 1188 | - | if (!IS_ENABLED(CONFIG_ARM64_MTE)) | |
| 1189 | - | return false; | |
| 1190 | - | ||
| 1191 | - | for (ftrp = ftr_id_aa64pfr1; ftrp->width; ftrp++) { | |
| 1192 | - | if (ftrp->shift == ID_AA64PFR1_EL1_MTE_SHIFT) | |
| 1193 | - | break; | |
| 1194 | - | } | |
| 1195 | - | ||
| 1196 | - | ftr_mask = arm64_ftr_mask(ftrp); | |
| 1197 | - | mte = arm64_ftr_value(ftrp, info->reg_id_aa64pfr1); | |
| 1198 | - | ||
| 1199 | - | /* The boot CPU runs before init_cpu_ftr_reg() strips unsafe overrides. */ | |
| 1200 | - | if ((id_aa64pfr1_override.mask & ftr_mask) == ftr_mask) { | |
| 1201 | - | ovr = arm64_ftr_value(ftrp, id_aa64pfr1_override.val); | |
| 1202 | - | mte = arm64_ftr_safe_value(ftrp, ovr, mte); | |
| 1203 | - | } | |
| 1204 | - | ||
| 1205 | - | return mte >= ID_AA64PFR1_EL1_MTE_MTE2; | |
| 1206 | - | } | |
| 1207 | - | ||
| 1208 | 1181 | void __init init_cpu_features(struct cpuinfo_arm64 *info) | |
| 1209 | 1182 | { | |
| 1210 | 1183 | /* Before we start using the tables, make sure it is sorted */ | |
| @@ -1257,7 +1230,7 @@ void __init init_cpu_features(struct cpuinfo_arm64 *info) | |||
| 1257 | 1230 | init_cpu_ftr_reg(SYS_MPAMIDR_EL1, info->reg_mpamidr); | |
| 1258 | 1231 | } | |
| 1259 | 1232 | ||
| 1260 | - | if (gmid_el1_accessible(info)) | |
| 1233 | + | if (id_aa64pfr1_mte(info->reg_id_aa64pfr1)) | |
| 1261 | 1234 | init_cpu_ftr_reg(SYS_GMID_EL1, info->reg_gmid); | |
| 1262 | 1235 | } | |
| 1263 | 1236 | ||
| @@ -1519,9 +1492,11 @@ void update_cpu_features(int cpu, | |||
| 1519 | 1492 | * they read/write depends on the GMID_EL1.BS field. Check that the | |
| 1520 | 1493 | * value is the same on all CPUs. | |
| 1521 | 1494 | */ | |
| 1522 | - | if (gmid_el1_accessible(info)) | |
| 1495 | + | if (IS_ENABLED(CONFIG_ARM64_MTE) && | |
| 1496 | + | id_aa64pfr1_mte(info->reg_id_aa64pfr1)) { | |
| 1523 | 1497 | taint |= check_update_ftr_reg(SYS_GMID_EL1, cpu, | |
| 1524 | 1498 | info->reg_gmid, boot->reg_gmid); | |
| 1499 | + | } | |
| 1525 | 1500 | ||
| 1526 | 1501 | /* | |
| 1527 | 1502 | * If we don't have AArch32 at all then skip the checks entirely | |
| @@ -2089,7 +2064,7 @@ static void cpu_amu_enable(struct arm64_cpu_capabilities const *cap) | |||
| 2089 | 2064 | cpumask_set_cpu(smp_processor_id(), &amu_cpus); | |
| 2090 | 2065 | ||
| 2091 | 2066 | /* 0 reference values signal broken/disabled counters */ | |
| 2092 | - | if (!this_cpu_has_cap(ARM64_WORKAROUND_BROKEN_AMU_CONSTCNT)) | |
| 2067 | + | if (!this_cpu_has_cap(ARM64_WORKAROUND_2457168)) | |
| 2093 | 2068 | update_freq_counters_refs(); | |
| 2094 | 2069 | } | |
| 2095 | 2070 | } | |
modified arch/arm64/kernel/cpuinfo.c
| @@ -502,7 +502,7 @@ static void __cpuinfo_store_cpu(struct cpuinfo_arm64 *info) | |||
| 502 | 502 | info->reg_id_aa64smfr0 = read_cpuid(ID_AA64SMFR0_EL1); | |
| 503 | 503 | info->reg_id_aa64fpfr0 = read_cpuid(ID_AA64FPFR0_EL1); | |
| 504 | 504 | ||
| 505 | - | if (gmid_el1_accessible(info)) | |
| 505 | + | if (id_aa64pfr1_mte(info->reg_id_aa64pfr1)) | |
| 506 | 506 | info->reg_gmid = read_cpuid(GMID_EL1); | |
| 507 | 507 | ||
| 508 | 508 | if (id_aa64pfr0_32bit_el0(info->reg_id_aa64pfr0)) | |
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/machine_kexec.c
| @@ -129,8 +129,7 @@ int machine_kexec_post_load(struct kimage *kimage) | |||
| 129 | 129 | } | |
| 130 | 130 | ||
| 131 | 131 | /* Create a copy of the linear map */ | |
| 132 | - | rc = trans_pgd_create_copy(&info, &trans_pgd, | |
| 133 | - | _PAGE_OFFSET(vabits_actual), PAGE_END); | |
| 132 | + | rc = trans_pgd_create_copy(&info, &trans_pgd, PAGE_OFFSET, PAGE_END); | |
| 134 | 133 | if (rc) | |
| 135 | 134 | return rc; | |
| 136 | 135 | kimage->arch.ttbr1 = __pa(trans_pgd); | |
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/kernel/signal.c
| @@ -433,7 +433,6 @@ static int restore_sve_fpsimd_context(struct user_ctxs *user) | |||
| 433 | 433 | unsigned int vl, vq; | |
| 434 | 434 | struct user_fpsimd_state fpsimd; | |
| 435 | 435 | u16 user_vl, flags; | |
| 436 | - | bool fpsimd_only; | |
| 437 | 436 | bool sm; | |
| 438 | 437 | ||
| 439 | 438 | if (user->sve_size < sizeof(*user->sve)) | |
| @@ -444,33 +443,19 @@ static int restore_sve_fpsimd_context(struct user_ctxs *user) | |||
| 444 | 443 | if (err) | |
| 445 | 444 | return err; | |
| 446 | 445 | ||
| 447 | - | fpsimd_only = (user->sve_size == sizeof(*user->sve)); | |
| 448 | 446 | sm = flags & SVE_SIG_FLAG_SM; | |
| 449 | - | ||
| 450 | 447 | if (sm) { | |
| 451 | 448 | if (!system_supports_sme()) | |
| 452 | 449 | return -EINVAL; | |
| 453 | 450 | ||
| 454 | - | /* | |
| 455 | - | * Streaming SVE state is always preserved with an SVE payload. | |
| 456 | - | * Only accept streaming state which has an SVE payload. | |
| 457 | - | */ | |
| 458 | - | if (fpsimd_only) | |
| 459 | - | return -EINVAL; | |
| 460 | - | ||
| 461 | 451 | vl = task_get_sme_vl(current); | |
| 462 | 452 | } else { | |
| 463 | 453 | /* | |
| 464 | - | * Non-streaming SVE state may be preserved without an SVE | |
| 465 | - | * payload, in which case all state is saved in the FPSIMD | |
| 466 | - | * context. | |
| 467 | - | * | |
| 468 | - | * On SME-only systems, non-streaming (FPSIMD-only) state is | |
| 469 | - | * always preserved without an SVE payload, and with VL==0. On | |
| 470 | - | * such systems, only accept non-streaming state without an SVE | |
| 471 | - | * payload. | |
| 454 | + | * A SME only system use SVE for streaming mode so can | |
| 455 | + | * have a SVE formatted context with a zero VL and no | |
| 456 | + | * payload data. | |
| 472 | 457 | */ | |
| 473 | - | if (!system_supports_sve() && !fpsimd_only) | |
| 458 | + | if (!system_supports_sve() && !system_supports_sme()) | |
| 474 | 459 | return -EINVAL; | |
| 475 | 460 | ||
| 476 | 461 | vl = task_get_sve_vl(current); | |
| @@ -479,7 +464,16 @@ static int restore_sve_fpsimd_context(struct user_ctxs *user) | |||
| 479 | 464 | if (user_vl != vl) | |
| 480 | 465 | return -EINVAL; | |
| 481 | 466 | ||
| 482 | - | if (fpsimd_only) | |
| 467 | + | /* | |
| 468 | + | * Non-streaming SVE state may be preserved without an SVE payload, in | |
| 469 | + | * which case the SVE context only has a header with VL==0, and all | |
| 470 | + | * state can be restored from the FPSIMD context. | |
| 471 | + | * | |
| 472 | + | * Streaming SVE state is always preserved with an SVE payload. For | |
| 473 | + | * consistency and robustness, reject restoring streaming SVE state | |
| 474 | + | * without an SVE payload. | |
| 475 | + | */ | |
| 476 | + | if (!sm && user->sve_size == sizeof(*user->sve)) | |
| 483 | 477 | return restore_fpsimd_context(user); | |
| 484 | 478 | ||
| 485 | 479 | vq = sve_vq_from_vl(vl); | |
modified arch/arm64/kernel/topology.c
| @@ -186,6 +186,7 @@ int arch_freq_get_on_cpu(int cpu) | |||
| 186 | 186 | struct amu_cntr_sample *amu_sample; | |
| 187 | 187 | unsigned int start_cpu = cpu; | |
| 188 | 188 | unsigned long last_update; | |
| 189 | + | unsigned int freq = 0; | |
| 189 | 190 | u64 scale; | |
| 190 | 191 | ||
| 191 | 192 | if (!amu_fie_cpu_supported(cpu) || !arch_scale_freq_ref(cpu)) | |
| @@ -244,8 +245,9 @@ int arch_freq_get_on_cpu(int cpu) | |||
| 244 | 245 | * (see amu_scale_freq_tick for details) | |
| 245 | 246 | */ | |
| 246 | 247 | scale = arch_scale_freq_capacity(cpu); | |
| 247 | - | ||
| 248 | - | return (scale * arch_scale_freq_ref(cpu)) >> SCHED_CAPACITY_SHIFT; | |
| 248 | + | freq = scale * arch_scale_freq_ref(cpu); | |
| 249 | + | freq >>= SCHED_CAPACITY_SHIFT; | |
| 250 | + | return freq; | |
| 249 | 251 | } | |
| 250 | 252 | ||
| 251 | 253 | static void amu_fie_setup(const struct cpumask *cpus) | |
| @@ -395,13 +397,12 @@ static void cpu_read_corecnt(void *val) | |||
| 395 | 397 | static void cpu_read_constcnt(void *val) | |
| 396 | 398 | { | |
| 397 | 399 | /* | |
| 398 | - | * Return 0 if the current CPU is affected by a HW erratum. | |
| 399 | - | * A value of 0 is also returned if the current CPU does not | |
| 400 | - | * support AMUs or if the counter is disabled. A return | |
| 401 | - | * value of 0 at counter read is properly handled as an error | |
| 402 | - | * case by the users of the counter. | |
| 400 | + | * Return 0 if the current CPU is affected by erratum 2457168. A value | |
| 401 | + | * of 0 is also returned if the current CPU does not support AMUs or if | |
| 402 | + | * the counter is disabled. A return value of 0 at counter read is | |
| 403 | + | * properly handled as an error case by the users of the counter. | |
| 403 | 404 | */ | |
| 404 | - | *(u64 *)val = this_cpu_has_cap(ARM64_WORKAROUND_BROKEN_AMU_CONSTCNT) ? | |
| 405 | + | *(u64 *)val = this_cpu_has_cap(ARM64_WORKAROUND_2457168) ? | |
| 405 | 406 | 0UL : read_constcnt(); | |
| 406 | 407 | } | |
| 407 | 408 | ||
| @@ -462,9 +463,8 @@ static void amu_read_core_const_ctrs(void *val) | |||
| 462 | 463 | ||
| 463 | 464 | /* | |
| 464 | 465 | * cpu_read_constcnt() incurs slight latency due to the | |
| 465 | - | * ARM64_WORKAROUND_BROKEN_AMU_CONSTCNT check. | |
| 466 | - | * Read it first to minimize the sampling skew between the const | |
| 467 | - | * and core counters. | |
| 466 | + | * ARM64_WORKAROUND_2457168 check. Read it first to minimize | |
| 467 | + | * the sampling skew between the const and core counters. | |
| 468 | 468 | */ | |
| 469 | 469 | cpu_read_constcnt(&ctrs->constcnt); | |
| 470 | 470 | cpu_read_corecnt(&ctrs->corecnt); | |
modified arch/arm64/kernel/vdso/Makefile
| @@ -41,7 +41,7 @@ CC_FLAGS_REMOVE_VDSO := $(CC_FLAGS_FTRACE) -Os $(CC_FLAGS_SCS) \ | |||
| 41 | 41 | $(CC_FLAGS_LTO) $(CC_FLAGS_CFI) \ | |
| 42 | 42 | -Wmissing-prototypes -Wmissing-declarations | |
| 43 | 43 | ||
| 44 | - | CC_FLAGS_ADD_VDSO := -O2 -mcmodel=tiny -fasynchronous-unwind-tables $(CONFIG_CC_OPT_INLINE_MEMSET) | |
| 44 | + | CC_FLAGS_ADD_VDSO := -O2 -mcmodel=tiny -fasynchronous-unwind-tables | |
| 45 | 45 | ||
| 46 | 46 | CFLAGS_REMOVE_vgettimeofday.o = $(CC_FLAGS_REMOVE_VDSO) | |
| 47 | 47 | CFLAGS_REMOVE_vgetrandom.o = $(CC_FLAGS_REMOVE_VDSO) | |
modified arch/arm64/kvm/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), | |
| @@ -2386,6 +2386,9 @@ int __init populate_nv_trap_config(void) | |||
| 2386 | 2386 | print_nv_trap_error(fgt, "FGT bit is reserved", ret); | |
| 2387 | 2387 | } | |
| 2388 | 2388 | ||
| 2389 | + | if (!cpus_have_final_cap(ARM64_HAS_FGT)) | |
| 2390 | + | continue; | |
| 2391 | + | ||
| 2389 | 2392 | prev = xa_store(&sr_forward_xa, enc, | |
| 2390 | 2393 | xa_mk_value(tc.val), GFP_KERNEL); | |
| 2391 | 2394 | ||
modified arch/arm64/kvm/hyp/include/nvhe/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/include/nvhe/pkvm.h
| @@ -12,15 +12,6 @@ | |||
| 12 | 12 | #include <nvhe/gfp.h> | |
| 13 | 13 | #include <nvhe/spinlock.h> | |
| 14 | 14 | ||
| 15 | - | /* | |
| 16 | - | * HCR_EL2 bits EL2 takes from the host on each entry, per VM type. The rest | |
| 17 | - | * are EL2's own and nothing the host sets there reaches the guest. | |
| 18 | - | */ | |
| 19 | - | #define PKVM_HCR_EL2_HOST_PVM (HCR_EL2_TWI | HCR_EL2_TWE | HCR_EL2_VSE) | |
| 20 | - | #define PKVM_HCR_EL2_HOST_NPVM (PKVM_HCR_EL2_HOST_PVM | HCR_EL2_VI | HCR_EL2_VF | \ | |
| 21 | - | HCR_EL2_TVM | HCR_EL2_TID2 | HCR_EL2_TID4 | \ | |
| 22 | - | HCR_EL2_TID5 | HCR_EL2_TTLBOS) | |
| 23 | - | ||
| 24 | 15 | /* | |
| 25 | 16 | * Holds the relevant data for maintaining the vcpu state completely at hyp. | |
| 26 | 17 | */ | |
modified arch/arm64/kvm/hyp/nvhe/hyp-main.c
| @@ -216,7 +216,6 @@ static void sync_debug_state(struct pkvm_hyp_vcpu *hyp_vcpu) | |||
| 216 | 216 | static void flush_hyp_vcpu(struct pkvm_hyp_vcpu *hyp_vcpu) | |
| 217 | 217 | { | |
| 218 | 218 | struct kvm_vcpu *host_vcpu = hyp_vcpu->host_vcpu; | |
| 219 | - | u64 host_hcr_mask = PKVM_HCR_EL2_HOST_PVM; | |
| 220 | 219 | ||
| 221 | 220 | fpsimd_sve_flush(); | |
| 222 | 221 | flush_debug_state(hyp_vcpu); | |
| @@ -229,7 +228,6 @@ static void flush_hyp_vcpu(struct pkvm_hyp_vcpu *hyp_vcpu) | |||
| 229 | 228 | if (!pkvm_hyp_vcpu_is_protected(hyp_vcpu)) { | |
| 230 | 229 | if (vcpu_get_flag(host_vcpu, PKVM_HOST_STATE_DIRTY)) | |
| 231 | 230 | flush_hyp_vcpu_state(hyp_vcpu); | |
| 232 | - | host_hcr_mask = PKVM_HCR_EL2_HOST_NPVM; | |
| 233 | 231 | } else { | |
| 234 | 232 | hyp_vcpu->vcpu.arch.ctxt = host_vcpu->arch.ctxt; | |
| 235 | 233 | } | |
| @@ -243,8 +241,9 @@ static void flush_hyp_vcpu(struct pkvm_hyp_vcpu *hyp_vcpu) | |||
| 243 | 241 | * trap-control bit, so it must flow to the hyp vCPU alongside TWI/TWE | |
| 244 | 242 | * for the vSError to be delivered. sync_hyp_vcpu() reflects it back. | |
| 245 | 243 | */ | |
| 246 | - | hyp_vcpu->vcpu.arch.hcr_el2 &= ~host_hcr_mask; | |
| 247 | - | hyp_vcpu->vcpu.arch.hcr_el2 |= READ_ONCE(host_vcpu->arch.hcr_el2) & host_hcr_mask; | |
| 244 | + | hyp_vcpu->vcpu.arch.hcr_el2 &= ~(HCR_TWI | HCR_TWE | HCR_VSE); | |
| 245 | + | hyp_vcpu->vcpu.arch.hcr_el2 |= READ_ONCE(host_vcpu->arch.hcr_el2) & | |
| 246 | + | (HCR_TWI | HCR_TWE | HCR_VSE); | |
| 248 | 247 | ||
| 249 | 248 | hyp_vcpu->vcpu.arch.iflags = host_vcpu->arch.iflags; | |
| 250 | 249 | ||
modified arch/arm64/kvm/hyp/nvhe/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
| @@ -30,7 +30,6 @@ unsigned int kvm_host_sve_max_vl; | |||
| 30 | 30 | */ | |
| 31 | 31 | static DEFINE_PER_CPU(struct pkvm_hyp_vcpu *, loaded_hyp_vcpu); | |
| 32 | 32 | ||
| 33 | - | /* The PKVM_HCR_EL2_HOST_{PVM,NPVM} bits of this value come from the host on each entry. */ | |
| 34 | 33 | static void pkvm_vcpu_reset_hcr(struct kvm_vcpu *vcpu) | |
| 35 | 34 | { | |
| 36 | 35 | vcpu->arch.hcr_el2 = HCR_GUEST_FLAGS; | |
| @@ -48,17 +47,18 @@ static void pkvm_vcpu_reset_hcr(struct kvm_vcpu *vcpu) | |||
| 48 | 47 | if (cpus_have_final_cap(ARM64_HAS_STAGE2_FWB)) | |
| 49 | 48 | vcpu->arch.hcr_el2 |= HCR_FWB; | |
| 50 | 49 | ||
| 51 | - | /* | |
| 52 | - | * Without AArch32 EL1, leave RW set and let the entry fail with an | |
| 53 | - | * illegal exception return: the *32_EL2 registers EL2 would otherwise | |
| 54 | - | * switch are UNDEFINED there. | |
| 55 | - | */ | |
| 56 | - | if (vcpu_has_feature(vcpu, KVM_ARM_VCPU_EL1_32BIT) && | |
| 57 | - | cpus_have_final_cap(ARM64_HAS_32BIT_EL1)) | |
| 58 | - | vcpu->arch.hcr_el2 &= ~HCR_EL2_RW; | |
| 50 | + | if (cpus_have_final_cap(ARM64_HAS_EVT) && | |
| 51 | + | !cpus_have_final_cap(ARM64_MISMATCHED_CACHE_TYPE) && | |
| 52 | + | kvm_read_vm_id_reg(vcpu->kvm, SYS_CTR_EL0) == read_cpuid(CTR_EL0)) | |
| 53 | + | vcpu->arch.hcr_el2 |= HCR_TID4; | |
| 54 | + | else | |
| 55 | + | vcpu->arch.hcr_el2 |= HCR_TID2; | |
| 59 | 56 | ||
| 60 | 57 | if (vcpu_has_ptrauth(vcpu)) | |
| 61 | 58 | vcpu->arch.hcr_el2 |= (HCR_API | HCR_APK); | |
| 59 | + | ||
| 60 | + | if (kvm_has_mte(vcpu->kvm)) | |
| 61 | + | vcpu->arch.hcr_el2 |= HCR_ATA; | |
| 62 | 62 | } | |
| 63 | 63 | ||
| 64 | 64 | static void pvm_init_traps_hcr(struct kvm_vcpu *vcpu) | |
| @@ -76,13 +76,6 @@ static void pvm_init_traps_hcr(struct kvm_vcpu *vcpu) | |||
| 76 | 76 | */ | |
| 77 | 77 | val |= HCR_TACR | HCR_TIDCP | HCR_TID3 | HCR_TID1; | |
| 78 | 78 | ||
| 79 | - | if (cpus_have_final_cap(ARM64_HAS_EVT) && | |
| 80 | - | !cpus_have_final_cap(ARM64_MISMATCHED_CACHE_TYPE) && | |
| 81 | - | kvm_read_vm_id_reg(kvm, SYS_CTR_EL0) == read_cpuid(CTR_EL0)) | |
| 82 | - | val |= HCR_EL2_TID4; | |
| 83 | - | else | |
| 84 | - | val |= HCR_EL2_TID2; | |
| 85 | - | ||
| 86 | 79 | if (!kvm_has_feat(kvm, ID_AA64PFR0_EL1, RAS, IMP)) { | |
| 87 | 80 | val |= HCR_TERR | HCR_TEA; | |
| 88 | 81 | val &= ~(HCR_FIEN); | |
| @@ -367,7 +360,7 @@ static void pkvm_init_features_from_host(struct pkvm_hyp_vm *hyp_vm, const struc | |||
| 367 | 360 | if (test_bit(KVM_ARCH_FLAG_WRITABLE_IMP_ID_REGS, &host_arch_flags)) | |
| 368 | 361 | hyp_vm->kvm.arch.midr_el1 = host_kvm->arch.midr_el1; | |
| 369 | 362 | ||
| 370 | - | goto out; | |
| 363 | + | return; | |
| 371 | 364 | } | |
| 372 | 365 | ||
| 373 | 366 | if (kvm_pkvm_ext_allowed(kvm, KVM_CAP_ARM_MTE)) | |
| @@ -386,14 +379,13 @@ static void pkvm_init_features_from_host(struct pkvm_hyp_vm *hyp_vm, const struc | |||
| 386 | 379 | if (kvm_pkvm_ext_allowed(kvm, KVM_CAP_ARM_PTRAUTH_GENERIC)) | |
| 387 | 380 | set_bit(KVM_ARM_VCPU_PTRAUTH_GENERIC, allowed_features); | |
| 388 | 381 | ||
| 389 | - | if (kvm_pkvm_ext_allowed(kvm, KVM_CAP_ARM_SVE)) | |
| 382 | + | if (kvm_pkvm_ext_allowed(kvm, KVM_CAP_ARM_SVE)) { | |
| 390 | 383 | set_bit(KVM_ARM_VCPU_SVE, allowed_features); | |
| 384 | + | kvm->arch.flags |= host_arch_flags & BIT(KVM_ARCH_FLAG_GUEST_HAS_SVE); | |
| 385 | + | } | |
| 391 | 386 | ||
| 392 | 387 | bitmap_and(kvm->arch.vcpu_features, host_kvm->arch.vcpu_features, | |
| 393 | 388 | allowed_features, KVM_VCPU_MAX_FEATURES); | |
| 394 | - | out: | |
| 395 | - | __assign_bit(KVM_ARCH_FLAG_GUEST_HAS_SVE, &kvm->arch.flags, | |
| 396 | - | kvm_vcpu_has_feature(kvm, KVM_ARM_VCPU_SVE)); | |
| 397 | 389 | } | |
| 398 | 390 | ||
| 399 | 391 | static void unpin_host_vcpu(struct kvm_vcpu *host_vcpu) | |
| @@ -406,10 +398,10 @@ static void unpin_host_sve_state(struct pkvm_hyp_vcpu *hyp_vcpu) | |||
| 406 | 398 | { | |
| 407 | 399 | void *sve_state; | |
| 408 | 400 | ||
| 409 | - | sve_state = hyp_vcpu->vcpu.arch.sve_state; | |
| 410 | - | if (!sve_state) | |
| 401 | + | if (!vcpu_has_feature(&hyp_vcpu->vcpu, KVM_ARM_VCPU_SVE)) | |
| 411 | 402 | return; | |
| 412 | 403 | ||
| 404 | + | sve_state = hyp_vcpu->vcpu.arch.sve_state; | |
| 413 | 405 | hyp_unpin_shared_mem(sve_state, | |
| 414 | 406 | sve_state + vcpu_sve_state_size(&hyp_vcpu->vcpu)); | |
| 415 | 407 | } | |
| @@ -458,7 +450,7 @@ static int pkvm_vcpu_init_sve(struct pkvm_hyp_vcpu *hyp_vcpu, struct kvm_vcpu *h | |||
| 458 | 450 | unsigned int sve_max_vl; | |
| 459 | 451 | size_t sve_state_size; | |
| 460 | 452 | void *sve_state; | |
| 461 | - | int ret; | |
| 453 | + | int ret = 0; | |
| 462 | 454 | ||
| 463 | 455 | if (!vcpu_has_feature(vcpu, KVM_ARM_VCPU_SVE)) { | |
| 464 | 456 | vcpu_clear_flag(vcpu, VCPU_SVE_FINALIZED); | |
| @@ -467,21 +459,25 @@ static int pkvm_vcpu_init_sve(struct pkvm_hyp_vcpu *hyp_vcpu, struct kvm_vcpu *h | |||
| 467 | 459 | ||
| 468 | 460 | /* Limit guest vector length to the maximum supported by the host. */ | |
| 469 | 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); | |
| 470 | 463 | sve_state = kern_hyp_va(READ_ONCE(host_vcpu->arch.sve_state)); | |
| 471 | 464 | ||
| 472 | - | if (!sve_vl_valid(sve_max_vl) || !sve_state) | |
| 473 | - | return -EINVAL; | |
| 474 | - | ||
| 475 | - | 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 | + | } | |
| 476 | 469 | ||
| 477 | 470 | ret = hyp_pin_shared_mem(sve_state, sve_state + sve_state_size); | |
| 478 | 471 | if (ret) | |
| 479 | - | return ret; | |
| 472 | + | goto err; | |
| 480 | 473 | ||
| 481 | 474 | vcpu->arch.sve_state = sve_state; | |
| 482 | 475 | vcpu->arch.sve_max_vl = sve_max_vl; | |
| 483 | 476 | ||
| 484 | 477 | return 0; | |
| 478 | + | err: | |
| 479 | + | clear_bit(KVM_ARM_VCPU_SVE, vcpu->kvm->arch.vcpu_features); | |
| 480 | + | return ret; | |
| 485 | 481 | } | |
| 486 | 482 | ||
| 487 | 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; | |
| @@ -1468,11 +1459,32 @@ transparent_hugepage_adjust(struct kvm *kvm, struct kvm_memory_slot *memslot, | |||
| 1468 | 1459 | return PAGE_SIZE; | |
| 1469 | 1460 | } | |
| 1470 | 1461 | ||
| 1471 | - | static int get_vma_page_shift(struct vm_area_struct *vma) | |
| 1462 | + | static int get_vma_page_shift(struct vm_area_struct *vma, unsigned long hva) | |
| 1472 | 1463 | { | |
| 1473 | - | if (is_vm_hugetlb_page(vma)) | |
| 1464 | + | unsigned long pa; | |
| 1465 | + | ||
| 1466 | + | if (is_vm_hugetlb_page(vma) && !(vma->vm_flags & VM_PFNMAP)) | |
| 1474 | 1467 | return huge_page_shift(hstate_vma(vma)); | |
| 1475 | 1468 | ||
| 1469 | + | if (!(vma->vm_flags & VM_PFNMAP)) | |
| 1470 | + | return PAGE_SHIFT; | |
| 1471 | + | ||
| 1472 | + | VM_BUG_ON(is_vm_hugetlb_page(vma)); | |
| 1473 | + | ||
| 1474 | + | pa = (vma->vm_pgoff << PAGE_SHIFT) + (hva - vma->vm_start); | |
| 1475 | + | ||
| 1476 | + | #ifndef __PAGETABLE_PMD_FOLDED | |
| 1477 | + | if ((hva & (PUD_SIZE - 1)) == (pa & (PUD_SIZE - 1)) && | |
| 1478 | + | ALIGN_DOWN(hva, PUD_SIZE) >= vma->vm_start && | |
| 1479 | + | ALIGN(hva, PUD_SIZE) <= vma->vm_end) | |
| 1480 | + | return PUD_SHIFT; | |
| 1481 | + | #endif | |
| 1482 | + | ||
| 1483 | + | if ((hva & (PMD_SIZE - 1)) == (pa & (PMD_SIZE - 1)) && | |
| 1484 | + | ALIGN_DOWN(hva, PMD_SIZE) >= vma->vm_start && | |
| 1485 | + | ALIGN(hva, PMD_SIZE) <= vma->vm_end) | |
| 1486 | + | return PMD_SHIFT; | |
| 1487 | + | ||
| 1476 | 1488 | return PAGE_SHIFT; | |
| 1477 | 1489 | } | |
| 1478 | 1490 | ||
| @@ -1773,7 +1785,7 @@ static short kvm_s2_resolve_vma_size(const struct kvm_s2_fault_desc *s2fd, | |||
| 1773 | 1785 | vma_shift = PAGE_SHIFT; | |
| 1774 | 1786 | } else { | |
| 1775 | 1787 | s2vi->max_map_size = PUD_SIZE; | |
| 1776 | - | vma_shift = get_vma_page_shift(vma); | |
| 1788 | + | vma_shift = get_vma_page_shift(vma, s2fd->hva); | |
| 1777 | 1789 | } | |
| 1778 | 1790 | ||
| 1779 | 1791 | switch (vma_shift) { | |
| @@ -1931,6 +1943,16 @@ static int kvm_s2_fault_pin_pfn(const struct kvm_s2_fault_desc *s2fd, | |||
| 1931 | 1943 | return -EFAULT; | |
| 1932 | 1944 | } | |
| 1933 | 1945 | } else { | |
| 1946 | + | /* | |
| 1947 | + | * If the page was identified as device early by looking at | |
| 1948 | + | * the VMA flags, vma_pagesize is already representing the | |
| 1949 | + | * largest quantity we can map. If instead it was mapped | |
| 1950 | + | * via __kvm_faultin_pfn(), vma_pagesize is set to PAGE_SIZE | |
| 1951 | + | * and must not be upgraded. | |
| 1952 | + | * | |
| 1953 | + | * In both cases, we don't let transparent_hugepage_adjust() | |
| 1954 | + | * change things at the last minute. | |
| 1955 | + | */ | |
| 1934 | 1956 | s2vi->map_non_cacheable = true; | |
| 1935 | 1957 | } | |
| 1936 | 1958 | ||
| @@ -2020,10 +2042,10 @@ static int kvm_s2_fault_map(const struct kvm_s2_fault_desc *s2fd, | |||
| 2020 | 2042 | ||
| 2021 | 2043 | /* | |
| 2022 | 2044 | * If we are not forced to use page mapping, check if we are | |
| 2023 | - | * backed by a huge stage-1 mapping and thus use block mapping if | |
| 2024 | - | * possible. | |
| 2045 | + | * backed by a THP and thus use block mapping if possible. | |
| 2025 | 2046 | */ | |
| 2026 | - | if (mapping_size == PAGE_SIZE && s2vi->max_map_size != PAGE_SIZE) { | |
| 2047 | + | if (mapping_size == PAGE_SIZE && | |
| 2048 | + | !(s2vi->max_map_size == PAGE_SIZE || s2vi->map_non_cacheable)) { | |
| 2027 | 2049 | if (perm_fault_granule > PAGE_SIZE) { | |
| 2028 | 2050 | mapping_size = perm_fault_granule; | |
| 2029 | 2051 | } else { | |
| @@ -2104,6 +2126,10 @@ static int user_mem_abort(const struct kvm_s2_fault_desc *s2fd) | |||
| 2104 | 2126 | return ret; | |
| 2105 | 2127 | } | |
| 2106 | 2128 | ||
| 2129 | + | /* | |
| 2130 | + | * Let's check if we will get back a huge page backed by hugetlbfs, or | |
| 2131 | + | * get block mapping for device MMIO region. | |
| 2132 | + | */ | |
| 2107 | 2133 | ret = kvm_s2_fault_pin_pfn(s2fd, &s2vi); | |
| 2108 | 2134 | if (ret != 1) | |
| 2109 | 2135 | 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 = kvcalloc(num_mmus, sizeof(*tmp), 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-init.c
| @@ -97,9 +97,6 @@ int kvm_vgic_create(struct kvm *kvm, u32 type) | |||
| 97 | 97 | /* | |
| 98 | 98 | * - Acquiring the vCPU mutex for every *online* vCPU to prevent | |
| 99 | 99 | * concurrent vCPU ioctls for vCPUs already visible to userspace. | |
| 100 | - | * This also ensures KVM isn't in the middle of creating a vCPU, | |
| 101 | - | * i.e. that there are no vCPUs that have been created but aren't | |
| 102 | - | * yet fully online. | |
| 103 | 100 | */ | |
| 104 | 101 | ret = -EBUSY; | |
| 105 | 102 | if (kvm_trylock_all_vcpus(kvm)) | |
| @@ -108,11 +105,18 @@ int kvm_vgic_create(struct kvm *kvm, u32 type) | |||
| 108 | 105 | /* | |
| 109 | 106 | * - Taking the config_lock which protects VGIC data structures such | |
| 110 | 107 | * as the per-vCPU arrays of private IRQs (SGIs, PPIs). | |
| 108 | + | */ | |
| 109 | + | mutex_lock(&kvm->arch.config_lock); | |
| 110 | + | ||
| 111 | + | /* | |
| 112 | + | * - Bailing on the entire thing if a vCPU is in the middle of creation, | |
| 113 | + | * dropped the kvm->lock, but hasn't reached kvm_arch_vcpu_create(). | |
| 111 | 114 | * | |
| 112 | 115 | * The whole combination of this guarantees that no vCPU can get into | |
| 113 | 116 | * KVM with a VGIC configuration inconsistent with the VM's VGIC. | |
| 114 | 117 | */ | |
| 115 | - | mutex_lock(&kvm->arch.config_lock); | |
| 118 | + | if (kvm->created_vcpus != atomic_read(&kvm->online_vcpus)) | |
| 119 | + | goto out_unlock; | |
| 116 | 120 | ||
| 117 | 121 | if (irqchip_in_kernel(kvm)) { | |
| 118 | 122 | ret = -EEXIST; | |
modified arch/arm64/kvm/vgic/vgic-its.c
| @@ -319,16 +319,12 @@ static int update_lpi_config(struct kvm *kvm, struct vgic_irq *irq, | |||
| 319 | 319 | return ret; | |
| 320 | 320 | } | |
| 321 | 321 | ||
| 322 | - | static int update_affinity(struct vgic_irq *irq, | |
| 323 | - | struct kvm_vcpu *from_vcpu, struct kvm_vcpu *vcpu) | |
| 322 | + | static int update_affinity(struct vgic_irq *irq, struct kvm_vcpu *vcpu) | |
| 324 | 323 | { | |
| 325 | 324 | struct its_vlpi_map map; | |
| 326 | 325 | int ret; | |
| 327 | 326 | ||
| 328 | 327 | guard(raw_spinlock_irqsave)(&irq->irq_lock); | |
| 329 | - | if (from_vcpu && irq->target_vcpu != from_vcpu) | |
| 330 | - | return 0; | |
| 331 | - | ||
| 332 | 328 | irq->target_vcpu = vcpu; | |
| 333 | 329 | ||
| 334 | 330 | if (!irq->hw) | |
| @@ -366,7 +362,7 @@ static void update_affinity_ite(struct kvm *kvm, struct its_ite *ite) | |||
| 366 | 362 | return; | |
| 367 | 363 | ||
| 368 | 364 | vcpu = collection_to_vcpu(kvm, ite->collection); | |
| 369 | - | update_affinity(ite->irq, NULL, vcpu); | |
| 365 | + | update_affinity(ite->irq, vcpu); | |
| 370 | 366 | } | |
| 371 | 367 | ||
| 372 | 368 | /* | |
| @@ -860,7 +856,7 @@ static int vgic_its_cmd_handle_movi(struct kvm *kvm, struct vgic_its *its, | |||
| 860 | 856 | ||
| 861 | 857 | vgic_its_invalidate_cache(its); | |
| 862 | 858 | ||
| 863 | - | return update_affinity(ite->irq, NULL, vcpu); | |
| 859 | + | return update_affinity(ite->irq, vcpu); | |
| 864 | 860 | } | |
| 865 | 861 | ||
| 866 | 862 | static bool __is_visible_gfn_locked(struct vgic_its *its, gpa_t gpa) | |
| @@ -1387,7 +1383,7 @@ static int vgic_its_cmd_handle_movall(struct kvm *kvm, struct vgic_its *its, | |||
| 1387 | 1383 | if (!irq) | |
| 1388 | 1384 | continue; | |
| 1389 | 1385 | ||
| 1390 | - | update_affinity(irq, vcpu1, vcpu2); | |
| 1386 | + | update_affinity(irq, vcpu2); | |
| 1391 | 1387 | ||
| 1392 | 1388 | vgic_put_irq(kvm, irq); | |
| 1393 | 1389 | } | |
| @@ -1662,7 +1658,7 @@ static void vgic_mmio_write_its_baser(struct kvm *kvm, | |||
| 1662 | 1658 | unsigned long val) | |
| 1663 | 1659 | { | |
| 1664 | 1660 | const struct vgic_its_abi *abi = vgic_its_get_abi(its); | |
| 1665 | - | u64 old, entry_size, table_type; | |
| 1661 | + | u64 entry_size, table_type; | |
| 1666 | 1662 | u64 reg, *regptr, clearbits = 0; | |
| 1667 | 1663 | ||
| 1668 | 1664 | /* When GITS_CTLR.Enable is 1, we ignore write accesses. */ | |
| @@ -1685,9 +1681,7 @@ static void vgic_mmio_write_its_baser(struct kvm *kvm, | |||
| 1685 | 1681 | return; | |
| 1686 | 1682 | } | |
| 1687 | 1683 | ||
| 1688 | - | old = *regptr; | |
| 1689 | - | ||
| 1690 | - | reg = update_64bit_reg(old, addr & 7, len, val); | |
| 1684 | + | reg = update_64bit_reg(*regptr, addr & 7, len, val); | |
| 1691 | 1685 | reg &= ~GITS_BASER_RO_MASK; | |
| 1692 | 1686 | reg &= ~clearbits; | |
| 1693 | 1687 | ||
| @@ -1697,8 +1691,7 @@ static void vgic_mmio_write_its_baser(struct kvm *kvm, | |||
| 1697 | 1691 | ||
| 1698 | 1692 | *regptr = reg; | |
| 1699 | 1693 | ||
| 1700 | - | /* The ITS driver rewrites an unchanged GITS_BASER<n> on resume. */ | |
| 1701 | - | if (reg != old) { | |
| 1694 | + | if (!(reg & GITS_BASER_VALID)) { | |
| 1702 | 1695 | /* Take the its_lock to prevent a race with a save/restore */ | |
| 1703 | 1696 | mutex_lock(&its->its_lock); | |
| 1704 | 1697 | switch (table_type) { | |
| @@ -1709,8 +1702,6 @@ static void vgic_mmio_write_its_baser(struct kvm *kvm, | |||
| 1709 | 1702 | vgic_its_free_collection_list(kvm, its); | |
| 1710 | 1703 | break; | |
| 1711 | 1704 | } | |
| 1712 | - | /* A concurrent injection may have cached a translation. */ | |
| 1713 | - | vgic_its_invalidate_cache(its); | |
| 1714 | 1705 | mutex_unlock(&its->its_lock); | |
| 1715 | 1706 | } | |
| 1716 | 1707 | } | |
| @@ -2028,22 +2019,18 @@ out: | |||
| 2028 | 2019 | return ret; | |
| 2029 | 2020 | } | |
| 2030 | 2021 | ||
| 2031 | - | static u32 compute_next_devid_offset(struct vgic_its *its, u64 baser, | |
| 2022 | + | static u32 compute_next_devid_offset(struct list_head *h, | |
| 2032 | 2023 | struct its_device *dev) | |
| 2033 | 2024 | { | |
| 2034 | - | struct its_device *next = dev; | |
| 2025 | + | struct its_device *next; | |
| 2026 | + | u32 next_offset; | |
| 2035 | 2027 | ||
| 2036 | - | /* | |
| 2037 | - | * Point at the next device vgic_its_save_device_tables() saves. It | |
| 2038 | - | * sorts device_list first, so the subtraction cannot underflow. | |
| 2039 | - | */ | |
| 2040 | - | list_for_each_entry_continue(next, &its->device_list, dev_list) { | |
| 2041 | - | if (vgic_its_check_id(its, baser, next->device_id, NULL)) | |
| 2042 | - | return min_t(u32, next->device_id - dev->device_id, | |
| 2043 | - | VITS_DTE_MAX_DEVID_OFFSET); | |
| 2044 | - | } | |
| 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; | |
| 2045 | 2032 | ||
| 2046 | - | return 0; | |
| 2033 | + | return min_t(u32, next_offset, VITS_DTE_MAX_DEVID_OFFSET); | |
| 2047 | 2034 | } | |
| 2048 | 2035 | ||
| 2049 | 2036 | static u32 compute_next_eventid_offset(struct list_head *h, struct its_ite *ite) | |
| @@ -2284,18 +2271,17 @@ static int vgic_its_restore_itt(struct vgic_its *its, struct its_device *dev) | |||
| 2284 | 2271 | * vgic_its_save_dte - Save a device table entry at a given GPA | |
| 2285 | 2272 | * | |
| 2286 | 2273 | * @its: ITS handle | |
| 2287 | - | * @baser: GITS_BASER<dev> the caller is saving against | |
| 2288 | 2274 | * @dev: ITS device | |
| 2289 | 2275 | * @ptr: GPA | |
| 2290 | 2276 | */ | |
| 2291 | - | static int vgic_its_save_dte(struct vgic_its *its, u64 baser, | |
| 2292 | - | 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) | |
| 2293 | 2279 | { | |
| 2294 | 2280 | u64 val, itt_addr_field; | |
| 2295 | 2281 | u32 next_offset; | |
| 2296 | 2282 | ||
| 2297 | 2283 | itt_addr_field = dev->itt_addr >> 8; | |
| 2298 | - | next_offset = compute_next_devid_offset(its, baser, dev); | |
| 2284 | + | next_offset = compute_next_devid_offset(&its->device_list, dev); | |
| 2299 | 2285 | val = (1ULL << KVM_ITS_DTE_VALID_SHIFT | | |
| 2300 | 2286 | ((u64)next_offset << KVM_ITS_DTE_NEXT_SHIFT) | | |
| 2301 | 2287 | (itt_addr_field << KVM_ITS_DTE_ITTADDR_SHIFT) | | |
| @@ -2394,16 +2380,15 @@ static int vgic_its_save_device_tables(struct vgic_its *its) | |||
| 2394 | 2380 | int ret; | |
| 2395 | 2381 | gpa_t eaddr; | |
| 2396 | 2382 | ||
| 2397 | - | /* Don't fail a save that userspace must be able to issue. */ | |
| 2398 | 2383 | if (!vgic_its_check_id(its, baser, | |
| 2399 | 2384 | dev->device_id, &eaddr)) | |
| 2400 | - | continue; | |
| 2385 | + | return -EINVAL; | |
| 2401 | 2386 | ||
| 2402 | 2387 | ret = vgic_its_save_itt(its, dev); | |
| 2403 | 2388 | if (ret) | |
| 2404 | 2389 | return ret; | |
| 2405 | 2390 | ||
| 2406 | - | ret = vgic_its_save_dte(its, baser, dev, eaddr); | |
| 2391 | + | ret = vgic_its_save_dte(its, dev, eaddr); | |
| 2407 | 2392 | if (ret) | |
| 2408 | 2393 | return ret; | |
| 2409 | 2394 | } | |
| @@ -2556,6 +2541,9 @@ static int vgic_its_save_collection_table(struct vgic_its *its) | |||
| 2556 | 2541 | max_size = GITS_BASER_NR_PAGES(baser) * SZ_64K; | |
| 2557 | 2542 | ||
| 2558 | 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 | + | ||
| 2559 | 2547 | ret = vgic_its_save_cte(its, collection, gpa); | |
| 2560 | 2548 | if (ret) | |
| 2561 | 2549 | return ret; | |
modified arch/arm64/kvm/vgic/vgic-v2.c
| @@ -122,10 +122,6 @@ void vgic_v2_fold_lr_state(struct kvm_vcpu *vcpu) | |||
| 122 | 122 | for (int lr = 0; lr < vgic_cpu->vgic_v2.used_lrs; lr++) | |
| 123 | 123 | vgic_v2_fold_lr(vcpu, cpuif->vgic_lr[lr]); | |
| 124 | 124 | ||
| 125 | - | cpuif->used_lrs = 0; | |
| 126 | - | if (!irq) | |
| 127 | - | return; | |
| 128 | - | ||
| 129 | 125 | /* See the GICv3 equivalent for the EOIcount handling rationale */ | |
| 130 | 126 | list_for_each_entry_continue(irq, &vgic_cpu->ap_list_head, ap_list) { | |
| 131 | 127 | u32 lr; | |
| @@ -148,6 +144,8 @@ void vgic_v2_fold_lr_state(struct kvm_vcpu *vcpu) | |||
| 148 | 144 | vgic_v2_fold_lr(vcpu, lr); | |
| 149 | 145 | eoicount--; | |
| 150 | 146 | } | |
| 147 | + | ||
| 148 | + | cpuif->used_lrs = 0; | |
| 151 | 149 | } | |
| 152 | 150 | ||
| 153 | 151 | void vgic_v2_deactivate(struct kvm_vcpu *vcpu, u32 val) | |
modified arch/arm64/kvm/vgic/vgic-v3.c
| @@ -155,10 +155,6 @@ void vgic_v3_fold_lr_state(struct kvm_vcpu *vcpu) | |||
| 155 | 155 | for (int lr = 0; lr < cpuif->used_lrs; lr++) | |
| 156 | 156 | vgic_v3_fold_lr(vcpu, cpuif->vgic_lr[lr]); | |
| 157 | 157 | ||
| 158 | - | cpuif->used_lrs = 0; | |
| 159 | - | if (!irq) | |
| 160 | - | return; | |
| 161 | - | ||
| 162 | 158 | /* | |
| 163 | 159 | * EOIMode=0: use EOIcount to emulate deactivation. We are | |
| 164 | 160 | * guaranteed to deactivate in reverse order of the activation, so | |
| @@ -192,6 +188,8 @@ void vgic_v3_fold_lr_state(struct kvm_vcpu *vcpu) | |||
| 192 | 188 | vgic_v3_fold_lr(vcpu, lr); | |
| 193 | 189 | eoicount--; | |
| 194 | 190 | } | |
| 191 | + | ||
| 192 | + | cpuif->used_lrs = 0; | |
| 195 | 193 | } | |
| 196 | 194 | ||
| 197 | 195 | void vgic_v3_deactivate(struct kvm_vcpu *vcpu, u64 val) | |
modified arch/arm64/kvm/vgic/vgic.c
| @@ -853,17 +853,6 @@ retry: | |||
| 853 | 853 | goto retry; | |
| 854 | 854 | } | |
| 855 | 855 | ||
| 856 | - | /* | |
| 857 | - | * Fix the last_lr_irq refcount which was obtained while | |
| 858 | - | * populating the LRs. This can also result in the LPI being | |
| 859 | - | * deleted. | |
| 860 | - | */ | |
| 861 | - | irq = *host_data_ptr(last_lr_irq); | |
| 862 | - | if (irq) { | |
| 863 | - | deleted_lpis |= vgic_put_irq_norelease(vcpu->kvm, irq); | |
| 864 | - | *host_data_ptr(last_lr_irq) = NULL; | |
| 865 | - | } | |
| 866 | - | ||
| 867 | 856 | raw_spin_unlock(&vgic_cpu->ap_list_lock); | |
| 868 | 857 | ||
| 869 | 858 | if (unlikely(deleted_lpis)) | |
| @@ -877,6 +866,9 @@ static void vgic_fold_state(struct kvm_vcpu *vcpu) | |||
| 877 | 866 | return; | |
| 878 | 867 | } | |
| 879 | 868 | ||
| 869 | + | if (!*host_data_ptr(last_lr_irq)) | |
| 870 | + | return; | |
| 871 | + | ||
| 880 | 872 | if (kvm_vgic_global_state.type == VGIC_V2) | |
| 881 | 873 | vgic_v2_fold_lr_state(vcpu); | |
| 882 | 874 | else | |
| @@ -1029,14 +1021,11 @@ static void vgic_flush_lr_state(struct kvm_vcpu *vcpu) | |||
| 1029 | 1021 | scoped_guard(raw_spinlock, &irq->irq_lock) { | |
| 1030 | 1022 | if (likely(vgic_target_oracle(irq) == vcpu)) { | |
| 1031 | 1023 | vgic_populate_lr(vcpu, irq, count++); | |
| 1032 | - | if (count == kvm_vgic_global_state.nr_lr) { | |
| 1033 | - | vgic_get_irq_ref(irq); | |
| 1034 | - | *host_data_ptr(last_lr_irq) = irq; | |
| 1035 | - | } | |
| 1024 | + | *host_data_ptr(last_lr_irq) = irq; | |
| 1036 | 1025 | } | |
| 1037 | 1026 | } | |
| 1038 | 1027 | ||
| 1039 | - | if (*host_data_ptr(last_lr_irq)) | |
| 1028 | + | if (count == kvm_vgic_global_state.nr_lr) | |
| 1040 | 1029 | break; | |
| 1041 | 1030 | } | |
| 1042 | 1031 | ||
modified arch/arm64/mm/fault.c
| @@ -16,7 +16,6 @@ | |||
| 16 | 16 | #include <linux/mm.h> | |
| 17 | 17 | #include <linux/hardirq.h> | |
| 18 | 18 | #include <linux/init.h> | |
| 19 | - | #include <linux/irqflags.h> | |
| 20 | 19 | #include <linux/kasan.h> | |
| 21 | 20 | #include <linux/kprobes.h> | |
| 22 | 21 | #include <linux/uaccess.h> | |
| @@ -155,9 +154,6 @@ static void show_pte(unsigned long addr) | |||
| 155 | 154 | pr_alert("%s pgtable: %luk pages, %llu-bit VAs, pgdp=%016lx\n", | |
| 156 | 155 | mm == &init_mm ? "swapper" : "user", PAGE_SIZE / SZ_1K, | |
| 157 | 156 | vabits_actual, mm_to_pgd_phys(mm)); | |
| 158 | - | ||
| 159 | - | guard(irqsave)(); | |
| 160 | - | ||
| 161 | 157 | pgdp = pgd_offset(mm, addr); | |
| 162 | 158 | pgd = READ_ONCE(*pgdp); | |
| 163 | 159 | pr_alert("[%016lx] pgd=%016llx", addr, pgd_val(pgd)); | |
| @@ -171,25 +167,25 @@ static void show_pte(unsigned long addr) | |||
| 171 | 167 | if (pgd_none(pgd) || pgd_bad(pgd)) | |
| 172 | 168 | break; | |
| 173 | 169 | ||
| 174 | - | p4dp = p4d_offset_lockless(pgdp, pgd, addr); | |
| 170 | + | p4dp = p4d_offset(pgdp, addr); | |
| 175 | 171 | p4d = READ_ONCE(*p4dp); | |
| 176 | 172 | pr_cont(", p4d=%016llx", p4d_val(p4d)); | |
| 177 | 173 | if (p4d_none(p4d) || p4d_bad(p4d)) | |
| 178 | 174 | break; | |
| 179 | 175 | ||
| 180 | - | pudp = pud_offset_lockless(p4dp, p4d, addr); | |
| 176 | + | pudp = pud_offset(p4dp, addr); | |
| 181 | 177 | pud = READ_ONCE(*pudp); | |
| 182 | 178 | pr_cont(", pud=%016llx", pud_val(pud)); | |
| 183 | 179 | if (pud_none(pud) || pud_bad(pud)) | |
| 184 | 180 | break; | |
| 185 | 181 | ||
| 186 | - | pmdp = pmd_offset_lockless(pudp, pud, addr); | |
| 182 | + | pmdp = pmd_offset(pudp, addr); | |
| 187 | 183 | pmd = READ_ONCE(*pmdp); | |
| 188 | 184 | pr_cont(", pmd=%016llx", pmd_val(pmd)); | |
| 189 | 185 | if (pmd_none(pmd) || pmd_bad(pmd)) | |
| 190 | 186 | break; | |
| 191 | 187 | ||
| 192 | - | ptep = pte_offset_map(&pmd, addr); | |
| 188 | + | ptep = pte_offset_map(pmdp, addr); | |
| 193 | 189 | if (!ptep) | |
| 194 | 190 | break; | |
| 195 | 191 | ||
modified arch/arm64/mm/mmu.c
| @@ -2295,7 +2295,7 @@ pte_t modify_prot_start_ptes(struct vm_area_struct *vma, unsigned long addr, | |||
| 2295 | 2295 | * in cases where cpu is affected with errata #2645198. | |
| 2296 | 2296 | */ | |
| 2297 | 2297 | if (pte_accessible(vma->vm_mm, pte) && pte_user_exec(pte)) | |
| 2298 | - | __flush_tlb_range(vma, addr, addr + nr * PAGE_SIZE, | |
| 2298 | + | __flush_tlb_range(vma, addr, nr * PAGE_SIZE, | |
| 2299 | 2299 | PAGE_SIZE, 3, TLBF_NOWALKCACHE); | |
| 2300 | 2300 | } | |
| 2301 | 2301 | ||
modified arch/arm64/net/bpf_jit_comp.c
| @@ -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 */ | |
| @@ -2418,11 +2416,10 @@ bool bpf_jit_supports_subprog_tailcalls(void) | |||
| 2418 | 2416 | return true; | |
| 2419 | 2417 | } | |
| 2420 | 2418 | ||
| 2421 | - | static void invoke_bpf_prog(struct jit_ctx *ctx, struct bpf_tramp_image *im, | |
| 2422 | - | struct bpf_tramp_node *node, int bargs_off, | |
| 2423 | - | int retval_off, int run_ctx_off, bool save_ret) | |
| 2419 | + | static void invoke_bpf_prog(struct jit_ctx *ctx, struct bpf_tramp_node *node, | |
| 2420 | + | int bargs_off, int retval_off, int run_ctx_off, | |
| 2421 | + | bool save_ret) | |
| 2424 | 2422 | { | |
| 2425 | - | void *skip; | |
| 2426 | 2423 | __le32 *branch; | |
| 2427 | 2424 | u64 enter_prog; | |
| 2428 | 2425 | u64 exit_prog; | |
| @@ -2432,10 +2429,6 @@ static void invoke_bpf_prog(struct jit_ctx *ctx, struct bpf_tramp_image *im, | |||
| 2432 | 2429 | enter_prog = (u64)bpf_trampoline_enter(p); | |
| 2433 | 2430 | exit_prog = (u64)bpf_trampoline_exit(p); | |
| 2434 | 2431 | ||
| 2435 | - | /* nop, patched to skip this prog when it is detached */ | |
| 2436 | - | skip = ctx->ro_image + ctx->idx; | |
| 2437 | - | emit(A64_NOP, ctx); | |
| 2438 | - | ||
| 2439 | 2432 | if (node->cookie == 0) { | |
| 2440 | 2433 | /* if cookie is zero, one instruction is enough to store it */ | |
| 2441 | 2434 | emit(A64_STR64I(A64_ZR, A64_SP, run_ctx_off + cookie_off), ctx); | |
| @@ -2488,13 +2481,11 @@ static void invoke_bpf_prog(struct jit_ctx *ctx, struct bpf_tramp_image *im, | |||
| 2488 | 2481 | emit(A64_ADD_I(1, A64_R(2), A64_SP, run_ctx_off), ctx); | |
| 2489 | 2482 | ||
| 2490 | 2483 | emit_call(exit_prog, ctx); | |
| 2491 | - | ||
| 2492 | - | bpf_tramp_image_add_skip(im, p, skip, ctx->ro_image + ctx->idx); | |
| 2493 | 2484 | } | |
| 2494 | 2485 | ||
| 2495 | - | static void invoke_bpf_mod_ret(struct jit_ctx *ctx, struct bpf_tramp_image *im, | |
| 2496 | - | struct bpf_tramp_nodes *tn, int bargs_off, | |
| 2497 | - | int retval_off, int run_ctx_off, __le32 **branches) | |
| 2486 | + | static void invoke_bpf_mod_ret(struct jit_ctx *ctx, struct bpf_tramp_nodes *tn, | |
| 2487 | + | int bargs_off, int retval_off, int run_ctx_off, | |
| 2488 | + | __le32 **branches) | |
| 2498 | 2489 | { | |
| 2499 | 2490 | int i; | |
| 2500 | 2491 | ||
| @@ -2503,7 +2494,7 @@ static void invoke_bpf_mod_ret(struct jit_ctx *ctx, struct bpf_tramp_image *im, | |||
| 2503 | 2494 | */ | |
| 2504 | 2495 | emit(A64_STR64I(A64_ZR, A64_SP, retval_off), ctx); | |
| 2505 | 2496 | for (i = 0; i < tn->nr_nodes; i++) { | |
| 2506 | - | invoke_bpf_prog(ctx, im, tn->nodes[i], bargs_off, retval_off, | |
| 2497 | + | invoke_bpf_prog(ctx, tn->nodes[i], bargs_off, retval_off, | |
| 2507 | 2498 | run_ctx_off, true); | |
| 2508 | 2499 | /* if (*(u64 *)(sp + retval_off) != 0) | |
| 2509 | 2500 | * goto do_fexit; | |
| @@ -2889,7 +2880,7 @@ static int prepare_trampoline(struct jit_ctx *ctx, struct bpf_tramp_image *im, | |||
| 2889 | 2880 | store_func_meta(ctx, meta, func_meta_off); | |
| 2890 | 2881 | cookie_bargs_off--; | |
| 2891 | 2882 | } | |
| 2892 | - | invoke_bpf_prog(ctx, im, fentry->nodes[i], bargs_off, | |
| 2883 | + | invoke_bpf_prog(ctx, fentry->nodes[i], bargs_off, | |
| 2893 | 2884 | retval_off, run_ctx_off, | |
| 2894 | 2885 | flags & BPF_TRAMP_F_RET_FENTRY_RET); | |
| 2895 | 2886 | } | |
| @@ -2900,7 +2891,7 @@ static int prepare_trampoline(struct jit_ctx *ctx, struct bpf_tramp_image *im, | |||
| 2900 | 2891 | if (!branches) | |
| 2901 | 2892 | return -ENOMEM; | |
| 2902 | 2893 | ||
| 2903 | - | invoke_bpf_mod_ret(ctx, im, fmod_ret, bargs_off, retval_off, | |
| 2894 | + | invoke_bpf_mod_ret(ctx, fmod_ret, bargs_off, retval_off, | |
| 2904 | 2895 | run_ctx_off, branches); | |
| 2905 | 2896 | } | |
| 2906 | 2897 | ||
| @@ -2913,6 +2904,9 @@ static int prepare_trampoline(struct jit_ctx *ctx, struct bpf_tramp_image *im, | |||
| 2913 | 2904 | emit(A64_RET(A64_R(10)), ctx); | |
| 2914 | 2905 | /* store return value */ | |
| 2915 | 2906 | emit(A64_STR64I(A64_R(0), A64_SP, retval_off), ctx); | |
| 2907 | + | /* reserve a nop for bpf_tramp_image_put */ | |
| 2908 | + | im->ip_after_call = ctx->ro_image + ctx->idx; | |
| 2909 | + | emit(A64_NOP, ctx); | |
| 2916 | 2910 | } | |
| 2917 | 2911 | ||
| 2918 | 2912 | /* update the branches saved in invoke_bpf_mod_ret with cbnz */ | |
| @@ -2934,11 +2928,12 @@ static int prepare_trampoline(struct jit_ctx *ctx, struct bpf_tramp_image *im, | |||
| 2934 | 2928 | store_func_meta(ctx, meta, func_meta_off); | |
| 2935 | 2929 | cookie_bargs_off--; | |
| 2936 | 2930 | } | |
| 2937 | - | invoke_bpf_prog(ctx, im, fexit->nodes[i], bargs_off, retval_off, | |
| 2931 | + | invoke_bpf_prog(ctx, fexit->nodes[i], bargs_off, retval_off, | |
| 2938 | 2932 | run_ctx_off, false); | |
| 2939 | 2933 | } | |
| 2940 | 2934 | ||
| 2941 | 2935 | if (flags & BPF_TRAMP_F_CALL_ORIG) { | |
| 2936 | + | im->ip_epilogue = ctx->ro_image + ctx->idx; | |
| 2942 | 2937 | /* for the first pass, assume the worst case */ | |
| 2943 | 2938 | if (!ctx->image) | |
| 2944 | 2939 | ctx->idx += 4; | |
| @@ -2997,7 +2992,7 @@ int arch_bpf_trampoline_size(const struct btf_func_model *m, u32 flags, | |||
| 2997 | 2992 | .image = NULL, | |
| 2998 | 2993 | .idx = 0, | |
| 2999 | 2994 | }; | |
| 3000 | - | struct bpf_tramp_image im = {}; | |
| 2995 | + | struct bpf_tramp_image im; | |
| 3001 | 2996 | struct arg_aux aaux; | |
| 3002 | 2997 | int ret; | |
| 3003 | 2998 | ||
| @@ -3284,10 +3279,6 @@ int bpf_arch_text_poke(void *ip, enum bpf_text_poke_type old_t, | |||
| 3284 | 3279 | * longer reachable, since bpf_tramp_image_put() function already | |
| 3285 | 3280 | * uses percpu_ref and task-based rcu to do the sync, no need to call | |
| 3286 | 3281 | * the sync version here, see bpf_tramp_image_put() for details. | |
| 3287 | - | * | |
| 3288 | - | * 3. when a detached prog is patched out of a trampoline, a CPU that | |
| 3289 | - | * still executes the old nop calls the prog before it went through | |
| 3290 | - | * a quiescent state, and the prog is freed after grace periods. | |
| 3291 | 3282 | */ | |
| 3292 | 3283 | ret = aarch64_insn_patch_text_nosync(ip, new_insn); | |
| 3293 | 3284 | out: | |
modified arch/arm64/tools/cpucaps
| @@ -105,6 +105,7 @@ WORKAROUND_1902691 | |||
| 105 | 105 | WORKAROUND_2038923 | |
| 106 | 106 | WORKAROUND_2064142 | |
| 107 | 107 | WORKAROUND_2077057 | |
| 108 | + | WORKAROUND_2457168 | |
| 108 | 109 | WORKAROUND_2645198 | |
| 109 | 110 | WORKAROUND_2658417 | |
| 110 | 111 | WORKAROUND_4193714 | |
| @@ -131,4 +132,3 @@ WORKAROUND_REPEAT_TLBI_SYNC | |||
| 131 | 132 | WORKAROUND_SPECULATIVE_AT | |
| 132 | 133 | WORKAROUND_SPECULATIVE_SSBS | |
| 133 | 134 | WORKAROUND_SPECULATIVE_UNPRIV_LOAD | |
| 134 | - | WORKAROUND_BROKEN_AMU_CONSTCNT | |
modified arch/arm64/tools/sysreg
| @@ -3761,9 +3761,7 @@ Sysreg ICC_CR0_EL1 3 1 12 0 1 | |||
| 3761 | 3761 | Res0 63:39 | |
| 3762 | 3762 | Field 38 PID | |
| 3763 | 3763 | Field 37:32 IPPT | |
| 3764 | - | Res0 31:3 | |
| 3765 | - | Field 2 LINK_IDLE | |
| 3766 | - | Field 1 LINK | |
| 3764 | + | Res0 31:1 | |
| 3767 | 3765 | Field 0 EN | |
| 3768 | 3766 | EndSysreg | |
| 3769 | 3767 | ||
modified arch/loongarch/Kconfig
| @@ -175,7 +175,7 @@ config LOONGARCH | |||
| 175 | 175 | select HAVE_RELIABLE_STACKTRACE if UNWINDER_ORC | |
| 176 | 176 | select HAVE_RETHOOK | |
| 177 | 177 | select HAVE_RSEQ | |
| 178 | - | select HAVE_RUST if !KASAN | |
| 178 | + | select HAVE_RUST | |
| 179 | 179 | select HAVE_SAMPLE_FTRACE_DIRECT | |
| 180 | 180 | select HAVE_SAMPLE_FTRACE_DIRECT_MULTI | |
| 181 | 181 | select HAVE_SETUP_PER_CPU_AREA if NUMA | |
modified arch/loongarch/include/asm/kvm_dmsintc.h
| @@ -20,7 +20,6 @@ struct dmsintc_state { | |||
| 20 | 20 | }; | |
| 21 | 21 | ||
| 22 | 22 | int kvm_loongarch_register_dmsintc_device(void); | |
| 23 | - | void kvm_loongarch_unregister_dmsintc_device(void); | |
| 24 | 23 | void dmsintc_inject_irq(struct kvm_vcpu *vcpu); | |
| 25 | 24 | int dmsintc_set_irq(struct kvm *kvm, u64 addr, int data, int level); | |
| 26 | 25 | int dmsintc_deliver_msi_to_vcpu(struct kvm *kvm, struct kvm_vcpu *vcpu, u32 vector, int level); | |
modified arch/loongarch/include/asm/kvm_eiointc.h
| @@ -79,7 +79,6 @@ struct loongarch_eiointc { | |||
| 79 | 79 | }; | |
| 80 | 80 | ||
| 81 | 81 | int kvm_loongarch_register_eiointc_device(void); | |
| 82 | - | void kvm_loongarch_unregister_eiointc_device(void); | |
| 83 | 82 | void eiointc_set_irq(struct loongarch_eiointc *s, int irq, int level); | |
| 84 | 83 | ||
| 85 | 84 | #endif /* __ASM_KVM_EIOINTC_H */ | |
modified arch/loongarch/include/asm/kvm_host.h
| @@ -125,7 +125,6 @@ struct kvm_arch { | |||
| 125 | 125 | unsigned int pte_shifts[MAX_PGTABLE_LEVELS]; | |
| 126 | 126 | unsigned int root_level; | |
| 127 | 127 | spinlock_t phyid_map_lock; | |
| 128 | - | spinlock_t pv_setting_lock; | |
| 129 | 128 | struct kvm_phyid_map *phyid_map; | |
| 130 | 129 | /* Enabled PV features */ | |
| 131 | 130 | unsigned long pv_features; | |
| @@ -351,6 +350,7 @@ static inline void kvm_arch_vcpu_block_finish(struct kvm_vcpu *vcpu) {} | |||
| 351 | 350 | static inline void kvm_arch_free_memslot(struct kvm *kvm, struct kvm_memory_slot *slot) {} | |
| 352 | 351 | void kvm_check_vpid(struct kvm_vcpu *vcpu); | |
| 353 | 352 | enum hrtimer_restart kvm_swtimer_wakeup(struct hrtimer *timer); | |
| 353 | + | void kvm_arch_flush_remote_tlbs_memslot(struct kvm *kvm, const struct kvm_memory_slot *memslot); | |
| 354 | 354 | void kvm_init_vmcs(struct kvm *kvm); | |
| 355 | 355 | void kvm_exc_entry(void); | |
| 356 | 356 | int kvm_enter_guest(struct kvm_run *run, struct kvm_vcpu *vcpu); | |
modified arch/loongarch/include/asm/kvm_ipi.h
| @@ -41,6 +41,5 @@ struct ipi_state { | |||
| 41 | 41 | #define IOCSR_ANY_SEND 0x158 | |
| 42 | 42 | ||
| 43 | 43 | int kvm_loongarch_register_ipi_device(void); | |
| 44 | - | void kvm_loongarch_unregister_ipi_device(void); | |
| 45 | 44 | ||
| 46 | 45 | #endif | |
modified arch/loongarch/include/asm/kvm_pch_pic.h
| @@ -70,7 +70,6 @@ struct loongarch_pch_pic { | |||
| 70 | 70 | ||
| 71 | 71 | struct kvm_kernel_irq_routing_entry; | |
| 72 | 72 | int kvm_loongarch_register_pch_pic_device(void); | |
| 73 | - | void kvm_loongarch_unregister_pch_pic_device(void); | |
| 74 | 73 | void pch_pic_set_irq(struct loongarch_pch_pic *s, int irq, int level); | |
| 75 | 74 | int pch_msi_set_irq(struct kvm *kvm, struct kvm_kernel_irq_routing_entry *e, int level); | |
| 76 | 75 | ||
modified arch/loongarch/kernel/kprobes.c
| @@ -275,9 +275,6 @@ bool kprobe_singlestep_handler(struct pt_regs *regs) | |||
| 275 | 275 | struct kprobe_ctlblk *kcb = get_kprobe_ctlblk(); | |
| 276 | 276 | unsigned long addr = instruction_pointer(regs); | |
| 277 | 277 | ||
| 278 | - | if (!cur) | |
| 279 | - | return false; | |
| 280 | - | ||
| 281 | 278 | if (cur && (kcb->kprobe_status & (KPROBE_HIT_SS | KPROBE_REENTER)) && | |
| 282 | 279 | ((unsigned long)&cur->ainsn.insn[1] == addr)) { | |
| 283 | 280 | restore_local_irqflag(kcb, regs); | |
modified arch/loongarch/kernel/rethook_trampoline.S
| @@ -24,6 +24,7 @@ | |||
| 24 | 24 | cfi_st t6, PT_R18 | |
| 25 | 25 | cfi_st t7, PT_R19 | |
| 26 | 26 | cfi_st t8, PT_R20 | |
| 27 | + | cfi_st u0, PT_R21 | |
| 27 | 28 | cfi_st fp, PT_R22 | |
| 28 | 29 | cfi_st s0, PT_R23 | |
| 29 | 30 | cfi_st s1, PT_R24 | |
| @@ -58,6 +59,7 @@ | |||
| 58 | 59 | cfi_ld t6, PT_R18 | |
| 59 | 60 | cfi_ld t7, PT_R19 | |
| 60 | 61 | cfi_ld t8, PT_R20 | |
| 62 | + | cfi_ld u0, PT_R21 | |
| 61 | 63 | cfi_ld fp, PT_R22 | |
| 62 | 64 | cfi_ld s0, PT_R23 | |
| 63 | 65 | cfi_ld s1, PT_R24 | |
modified arch/loongarch/kernel/smp.c
| @@ -14,6 +14,7 @@ | |||
| 14 | 14 | #include <linux/init.h> | |
| 15 | 15 | #include <linux/interrupt.h> | |
| 16 | 16 | #include <linux/irq_work.h> | |
| 17 | + | #include <linux/profile.h> | |
| 17 | 18 | #include <linux/seq_file.h> | |
| 18 | 19 | #include <linux/smp.h> | |
| 19 | 20 | #include <linux/threads.h> | |
| @@ -715,6 +716,13 @@ void smp_send_stop(void) | |||
| 715 | 716 | smp_call_function(stop_this_cpu, NULL, 0); | |
| 716 | 717 | } | |
| 717 | 718 | ||
| 719 | + | #ifdef CONFIG_PROFILING | |
| 720 | + | int setup_profiling_timer(unsigned int multiplier) | |
| 721 | + | { | |
| 722 | + | return 0; | |
| 723 | + | } | |
| 724 | + | #endif | |
| 725 | + | ||
| 718 | 726 | static void flush_tlb_all_ipi(void *info) | |
| 719 | 727 | { | |
| 720 | 728 | local_flush_tlb_all(); | |
modified arch/loongarch/kernel/vmlinux.lds.S
| @@ -23,7 +23,7 @@ | |||
| 23 | 23 | #include "image-vars.h" | |
| 24 | 24 | ||
| 25 | 25 | /* | |
| 26 | - | * Max available Page Size is 64K, so we set SectionAlignment | |
| 26 | + | * Max avaliable Page Size is 64K, so we set SectionAlignment | |
| 27 | 27 | * field of EFI application to 64K. | |
| 28 | 28 | */ | |
| 29 | 29 | PECOFF_FILE_ALIGN = 0x200; | |
modified arch/loongarch/kvm/intc/dmsintc.c
| @@ -149,7 +149,7 @@ static int kvm_dmsintc_create(struct kvm_device *dev, u32 type) | |||
| 149 | 149 | return -EINVAL; | |
| 150 | 150 | } | |
| 151 | 151 | ||
| 152 | - | s = kzalloc_obj(struct loongarch_dmsintc); | |
| 152 | + | s = kzalloc(sizeof(struct loongarch_dmsintc), GFP_KERNEL); | |
| 153 | 153 | if (!s) | |
| 154 | 154 | return -ENOMEM; | |
| 155 | 155 | ||
| @@ -180,8 +180,3 @@ int kvm_loongarch_register_dmsintc_device(void) | |||
| 180 | 180 | { | |
| 181 | 181 | return kvm_register_device_ops(&kvm_dmsintc_dev_ops, KVM_DEV_TYPE_LOONGARCH_DMSINTC); | |
| 182 | 182 | } | |
| 183 | - | ||
| 184 | - | void kvm_loongarch_unregister_dmsintc_device(void) | |
| 185 | - | { | |
| 186 | - | kvm_unregister_device_ops(KVM_DEV_TYPE_LOONGARCH_DMSINTC); | |
| 187 | - | } | |
modified arch/loongarch/kvm/intc/eiointc.c
| @@ -695,8 +695,3 @@ int kvm_loongarch_register_eiointc_device(void) | |||
| 695 | 695 | { | |
| 696 | 696 | return kvm_register_device_ops(&kvm_eiointc_dev_ops, KVM_DEV_TYPE_LOONGARCH_EIOINTC); | |
| 697 | 697 | } | |
| 698 | - | ||
| 699 | - | void kvm_loongarch_unregister_eiointc_device(void) | |
| 700 | - | { | |
| 701 | - | kvm_unregister_device_ops(KVM_DEV_TYPE_LOONGARCH_EIOINTC); | |
| 702 | - | } | |
modified arch/loongarch/kvm/intc/ipi.c
| @@ -463,8 +463,3 @@ int kvm_loongarch_register_ipi_device(void) | |||
| 463 | 463 | { | |
| 464 | 464 | return kvm_register_device_ops(&kvm_ipi_dev_ops, KVM_DEV_TYPE_LOONGARCH_IPI); | |
| 465 | 465 | } | |
| 466 | - | ||
| 467 | - | void kvm_loongarch_unregister_ipi_device(void) | |
| 468 | - | { | |
| 469 | - | kvm_unregister_device_ops(KVM_DEV_TYPE_LOONGARCH_IPI); | |
| 470 | - | } | |
modified arch/loongarch/kvm/intc/pch_pic.c
| @@ -78,9 +78,6 @@ int pch_msi_set_irq(struct kvm *kvm, struct kvm_kernel_irq_routing_entry *e, int | |||
| 78 | 78 | return dmsintc_set_irq(kvm, msg_addr, e->msi.data, level); | |
| 79 | 79 | } | |
| 80 | 80 | ||
| 81 | - | if (e->msi.data >= EIOINTC_IRQS) | |
| 82 | - | return -EINVAL; | |
| 83 | - | ||
| 84 | 81 | eiointc_set_irq(kvm->arch.eiointc, e->msi.data, level); | |
| 85 | 82 | ||
| 86 | 83 | return 0; | |
| @@ -503,8 +500,3 @@ int kvm_loongarch_register_pch_pic_device(void) | |||
| 503 | 500 | { | |
| 504 | 501 | return kvm_register_device_ops(&kvm_pch_pic_dev_ops, KVM_DEV_TYPE_LOONGARCH_PCHPIC); | |
| 505 | 502 | } | |
| 506 | - | ||
| 507 | - | void kvm_loongarch_unregister_pch_pic_device(void) | |
| 508 | - | { | |
| 509 | - | kvm_unregister_device_ops(KVM_DEV_TYPE_LOONGARCH_PCHPIC); | |
| 510 | - | } | |
modified arch/loongarch/kvm/main.c
| @@ -385,52 +385,27 @@ static int kvm_loongarch_env_init(void) | |||
| 385 | 385 | /* Register LoongArch IPI interrupt controller interface. */ | |
| 386 | 386 | ret = kvm_loongarch_register_ipi_device(); | |
| 387 | 387 | if (ret) | |
| 388 | - | goto err_env; | |
| 388 | + | return ret; | |
| 389 | 389 | ||
| 390 | 390 | /* Register LoongArch EIOINTC interrupt controller interface. */ | |
| 391 | 391 | ret = kvm_loongarch_register_eiointc_device(); | |
| 392 | 392 | if (ret) | |
| 393 | - | goto err_ipi; | |
| 393 | + | return ret; | |
| 394 | 394 | ||
| 395 | 395 | /* Register LoongArch PCH-PIC interrupt controller interface. */ | |
| 396 | 396 | ret = kvm_loongarch_register_pch_pic_device(); | |
| 397 | 397 | if (ret) | |
| 398 | - | goto err_eiointc; | |
| 398 | + | return ret; | |
| 399 | 399 | ||
| 400 | 400 | /* Register LoongArch DMSINTC interrupt contrroller interface */ | |
| 401 | - | if (cpu_has_msgint) { | |
| 401 | + | if (cpu_has_msgint) | |
| 402 | 402 | ret = kvm_loongarch_register_dmsintc_device(); | |
| 403 | - | if (ret) | |
| 404 | - | goto err_pch_pic; | |
| 405 | - | } | |
| 406 | - | ||
| 407 | - | return 0; | |
| 408 | - | ||
| 409 | - | err_pch_pic: | |
| 410 | - | kvm_loongarch_unregister_pch_pic_device(); | |
| 411 | - | err_eiointc: | |
| 412 | - | kvm_loongarch_unregister_eiointc_device(); | |
| 413 | - | err_ipi: | |
| 414 | - | kvm_loongarch_unregister_ipi_device(); | |
| 415 | - | err_env: | |
| 416 | - | kvm_unregister_perf_callbacks(); | |
| 417 | - | kfree(kvm_loongarch_ops); | |
| 418 | - | kvm_loongarch_ops = NULL; | |
| 419 | - | free_percpu(vmcs); | |
| 420 | - | vmcs = NULL; | |
| 421 | 403 | ||
| 422 | 404 | return ret; | |
| 423 | 405 | } | |
| 424 | 406 | ||
| 425 | 407 | static void kvm_loongarch_env_exit(void) | |
| 426 | 408 | { | |
| 427 | - | if (cpu_has_msgint) | |
| 428 | - | kvm_loongarch_unregister_dmsintc_device(); | |
| 429 | - | ||
| 430 | - | kvm_loongarch_unregister_pch_pic_device(); | |
| 431 | - | kvm_loongarch_unregister_eiointc_device(); | |
| 432 | - | kvm_loongarch_unregister_ipi_device(); | |
| 433 | - | ||
| 434 | 409 | if (vmcs) | |
| 435 | 410 | free_percpu(vmcs); | |
| 436 | 411 | ||
| @@ -453,11 +428,7 @@ static int kvm_loongarch_init(void) | |||
| 453 | 428 | if (r) | |
| 454 | 429 | return r; | |
| 455 | 430 | ||
| 456 | - | r = kvm_init(sizeof(struct kvm_vcpu), 0, THIS_MODULE); | |
| 457 | - | if (r) | |
| 458 | - | kvm_loongarch_env_exit(); | |
| 459 | - | ||
| 460 | - | return r; | |
| 431 | + | return kvm_init(sizeof(struct kvm_vcpu), 0, THIS_MODULE); | |
| 461 | 432 | } | |
| 462 | 433 | ||
| 463 | 434 | static void kvm_loongarch_exit(void) | |
modified arch/loongarch/kvm/mmu.c
| @@ -383,16 +383,6 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm, const struct kvm_memory_slot | |||
| 383 | 383 | hva_t hva_start; | |
| 384 | 384 | size_t size, gpa_offset, hva_offset; | |
| 385 | 385 | ||
| 386 | - | /* | |
| 387 | - | * The generic code allocates a fresh, zeroed memslot for every change, | |
| 388 | - | * so the arch flags computed below must be carried over when only the | |
| 389 | - | * userspace flags change, e.g. when dirty logging is toggled. | |
| 390 | - | */ | |
| 391 | - | if (change == KVM_MR_FLAGS_ONLY) { | |
| 392 | - | new->arch = old->arch; | |
| 393 | - | return 0; | |
| 394 | - | } | |
| 395 | - | ||
| 396 | 386 | if ((change != KVM_MR_MOVE) && (change != KVM_MR_CREATE)) | |
| 397 | 387 | return 0; | |
| 398 | 388 | /* | |
| @@ -949,3 +939,9 @@ int kvm_handle_mm_fault(struct kvm_vcpu *vcpu, unsigned long gpa, bool write, in | |||
| 949 | 939 | void kvm_arch_sync_dirty_log(struct kvm *kvm, struct kvm_memory_slot *memslot) | |
| 950 | 940 | { | |
| 951 | 941 | } | |
| 942 | + | ||
| 943 | + | void kvm_arch_flush_remote_tlbs_memslot(struct kvm *kvm, | |
| 944 | + | const struct kvm_memory_slot *memslot) | |
| 945 | + | { | |
| 946 | + | kvm_flush_remote_tlbs(kvm); | |
| 947 | + | } | |
modified arch/loongarch/kvm/vcpu.c
| @@ -1165,14 +1165,10 @@ static int kvm_loongarch_cpucfg_set_attr(struct kvm_vcpu *vcpu, | |||
| 1165 | 1165 | return -EINVAL; | |
| 1166 | 1166 | ||
| 1167 | 1167 | /* All vCPUs need set the same PV features */ | |
| 1168 | - | spin_lock(&kvm->arch.pv_setting_lock); | |
| 1169 | 1168 | if ((kvm->arch.pv_features & LOONGARCH_PV_FEAT_UPDATED) | |
| 1170 | - | && ((kvm->arch.pv_features & valid) != val)) { | |
| 1171 | - | spin_unlock(&kvm->arch.pv_setting_lock); | |
| 1169 | + | && ((kvm->arch.pv_features & valid) != val)) | |
| 1172 | 1170 | return -EINVAL; | |
| 1173 | - | } | |
| 1174 | 1171 | kvm->arch.pv_features = val | LOONGARCH_PV_FEAT_UPDATED; | |
| 1175 | - | spin_unlock(&kvm->arch.pv_setting_lock); | |
| 1176 | 1172 | return 0; | |
| 1177 | 1173 | default: | |
| 1178 | 1174 | return -ENXIO; | |
modified arch/loongarch/kvm/vm.c
| @@ -76,7 +76,6 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type) | |||
| 76 | 76 | return -ENOMEM; | |
| 77 | 77 | } | |
| 78 | 78 | spin_lock_init(&kvm->arch.phyid_map_lock); | |
| 79 | - | spin_lock_init(&kvm->arch.pv_setting_lock); | |
| 80 | 79 | ||
| 81 | 80 | kvm_init_vmcs(kvm); | |
| 82 | 81 | kvm_vm_init_features(kvm); | |
modified arch/loongarch/net/bpf_jit.c
| @@ -717,7 +717,7 @@ static int build_insn(const struct bpf_insn *insn, struct jit_ctx *ctx, bool ext | |||
| 717 | 717 | move_reg(ctx, t1, src); | |
| 718 | 718 | emit_zext_32(ctx, t1, true); | |
| 719 | 719 | move_imm(ctx, dst, (ctx->user_vm_start >> 32) << 32, false); | |
| 720 | - | emit_insn(ctx, beq, t1, LOONGARCH_GPR_ZERO, 2); | |
| 720 | + | emit_insn(ctx, beq, t1, LOONGARCH_GPR_ZERO, 1); | |
| 721 | 721 | emit_insn(ctx, or, t1, dst, t1); | |
| 722 | 722 | move_reg(ctx, dst, t1); | |
| 723 | 723 | break; | |
| @@ -1578,24 +1578,6 @@ void *bpf_arch_text_copy(void *dst, void *src, size_t len) | |||
| 1578 | 1578 | return ret ? ERR_PTR(-EINVAL) : dst; | |
| 1579 | 1579 | } | |
| 1580 | 1580 | ||
| 1581 | - | int arch_bpf_trampoline_skip(void *nop, void *target) | |
| 1582 | - | { | |
| 1583 | - | u32 old_insn = INSN_NOP; | |
| 1584 | - | u32 new_insn = larch_insn_gen_b((unsigned long)nop, (unsigned long)target); | |
| 1585 | - | int ret; | |
| 1586 | - | ||
| 1587 | - | if (memcmp(nop, &old_insn, LOONGARCH_INSN_SIZE)) | |
| 1588 | - | return -EFAULT; | |
| 1589 | - | ||
| 1590 | - | cpus_read_lock(); | |
| 1591 | - | mutex_lock(&text_mutex); | |
| 1592 | - | ret = larch_insn_text_copy(nop, &new_insn, LOONGARCH_INSN_SIZE); | |
| 1593 | - | mutex_unlock(&text_mutex); | |
| 1594 | - | cpus_read_unlock(); | |
| 1595 | - | ||
| 1596 | - | return ret; | |
| 1597 | - | } | |
| 1598 | - | ||
| 1599 | 1581 | int bpf_arch_text_poke(void *ip, enum bpf_text_poke_type old_t, | |
| 1600 | 1582 | enum bpf_text_poke_type new_t, void *old_addr, | |
| 1601 | 1583 | void *new_addr) | |
| @@ -1714,18 +1696,13 @@ static void restore_stk_args(struct jit_ctx *ctx, int nr_stk_args, int args_off, | |||
| 1714 | 1696 | } | |
| 1715 | 1697 | } | |
| 1716 | 1698 | ||
| 1717 | - | static int invoke_bpf_prog(struct jit_ctx *ctx, struct bpf_tramp_image *im, | |
| 1718 | - | struct bpf_tramp_node *n, int args_off, int retval_off, | |
| 1719 | - | int run_ctx_off, bool save_ret) | |
| 1699 | + | static int invoke_bpf_prog(struct jit_ctx *ctx, struct bpf_tramp_node *n, | |
| 1700 | + | int args_off, int retval_off, int run_ctx_off, bool save_ret) | |
| 1720 | 1701 | { | |
| 1721 | 1702 | int ret; | |
| 1722 | 1703 | u32 *branch; | |
| 1723 | 1704 | struct bpf_prog *p = n->link->prog; | |
| 1724 | 1705 | int cookie_off = offsetof(struct bpf_tramp_run_ctx, bpf_cookie); | |
| 1725 | - | void *skip = ctx->ro_image + ctx->idx; | |
| 1726 | - | ||
| 1727 | - | /* nop, patched to a b over this prog when it is detached */ | |
| 1728 | - | emit_insn(ctx, nop); | |
| 1729 | 1706 | ||
| 1730 | 1707 | if (n->cookie) | |
| 1731 | 1708 | emit_store_stack_imm64(ctx, LOONGARCH_GPR_T1, | |
| @@ -1778,17 +1755,13 @@ static int invoke_bpf_prog(struct jit_ctx *ctx, struct bpf_tramp_image *im, | |||
| 1778 | 1755 | /* arg3: &run_ctx */ | |
| 1779 | 1756 | emit_insn(ctx, addid, LOONGARCH_GPR_A2, LOONGARCH_GPR_FP, -run_ctx_off); | |
| 1780 | 1757 | ret = emit_call(ctx, (const u64)bpf_trampoline_exit(p)); | |
| 1781 | - | if (ret) | |
| 1782 | - | return ret; | |
| 1783 | 1758 | ||
| 1784 | - | bpf_tramp_image_add_skip(im, p, skip, ctx->ro_image + ctx->idx); | |
| 1785 | - | return 0; | |
| 1759 | + | return ret; | |
| 1786 | 1760 | } | |
| 1787 | 1761 | ||
| 1788 | - | static int invoke_bpf(struct jit_ctx *ctx, struct bpf_tramp_image *im, | |
| 1789 | - | struct bpf_tramp_nodes *tn, int args_off, int retval_off, | |
| 1790 | - | int run_ctx_off, int func_meta_off, bool save_ret, | |
| 1791 | - | u64 func_meta, int cookie_off) | |
| 1762 | + | static int invoke_bpf(struct jit_ctx *ctx, struct bpf_tramp_nodes *tn, | |
| 1763 | + | int args_off, int retval_off, int run_ctx_off, | |
| 1764 | + | int func_meta_off, bool save_ret, u64 func_meta, int cookie_off) | |
| 1792 | 1765 | { | |
| 1793 | 1766 | int i, cur_cookie = (cookie_off - args_off) / 8; | |
| 1794 | 1767 | ||
| @@ -1801,8 +1774,7 @@ static int invoke_bpf(struct jit_ctx *ctx, struct bpf_tramp_image *im, | |||
| 1801 | 1774 | emit_store_stack_imm64(ctx, LOONGARCH_GPR_T1, -func_meta_off, meta); | |
| 1802 | 1775 | cur_cookie--; | |
| 1803 | 1776 | } | |
| 1804 | - | err = invoke_bpf_prog(ctx, im, tn->nodes[i], args_off, retval_off, | |
| 1805 | - | run_ctx_off, save_ret); | |
| 1777 | + | err = invoke_bpf_prog(ctx, tn->nodes[i], args_off, retval_off, run_ctx_off, save_ret); | |
| 1806 | 1778 | if (err) | |
| 1807 | 1779 | return err; | |
| 1808 | 1780 | } | |
| @@ -2045,7 +2017,7 @@ static int __arch_prepare_bpf_trampoline(struct jit_ctx *ctx, struct bpf_tramp_i | |||
| 2045 | 2017 | } | |
| 2046 | 2018 | ||
| 2047 | 2019 | if (fentry->nr_nodes) { | |
| 2048 | - | ret = invoke_bpf(ctx, im, fentry, args_off, retval_off, run_ctx_off, func_meta_off, | |
| 2020 | + | ret = invoke_bpf(ctx, fentry, args_off, retval_off, run_ctx_off, func_meta_off, | |
| 2049 | 2021 | flags & BPF_TRAMP_F_RET_FENTRY_RET, func_meta, cookie_off); | |
| 2050 | 2022 | if (ret) | |
| 2051 | 2023 | return ret; | |
| @@ -2057,7 +2029,7 @@ static int __arch_prepare_bpf_trampoline(struct jit_ctx *ctx, struct bpf_tramp_i | |||
| 2057 | 2029 | ||
| 2058 | 2030 | emit_insn(ctx, std, LOONGARCH_GPR_ZERO, LOONGARCH_GPR_FP, -retval_off); | |
| 2059 | 2031 | for (i = 0; i < fmod_ret->nr_nodes; i++) { | |
| 2060 | - | ret = invoke_bpf_prog(ctx, im, fmod_ret->nodes[i], | |
| 2032 | + | ret = invoke_bpf_prog(ctx, fmod_ret->nodes[i], | |
| 2061 | 2033 | args_off, retval_off, run_ctx_off, true); | |
| 2062 | 2034 | if (ret) | |
| 2063 | 2035 | goto out; | |
| @@ -2079,6 +2051,10 @@ static int __arch_prepare_bpf_trampoline(struct jit_ctx *ctx, struct bpf_tramp_i | |||
| 2079 | 2051 | goto out; | |
| 2080 | 2052 | emit_insn(ctx, std, LOONGARCH_GPR_A0, LOONGARCH_GPR_FP, -retval_off); | |
| 2081 | 2053 | emit_insn(ctx, std, regmap[BPF_REG_0], LOONGARCH_GPR_FP, -(retval_off - 8)); | |
| 2054 | + | im->ip_after_call = ctx->ro_image + ctx->idx; | |
| 2055 | + | /* Reserve space for the move_imm + jirl instruction */ | |
| 2056 | + | for (i = 0; i < LOONGARCH_LONG_JUMP_NINSNS; i++) | |
| 2057 | + | emit_insn(ctx, nop); | |
| 2082 | 2058 | } | |
| 2083 | 2059 | ||
| 2084 | 2060 | for (i = 0; ctx->image && i < fmod_ret->nr_nodes; i++) { | |
| @@ -2092,13 +2068,14 @@ static int __arch_prepare_bpf_trampoline(struct jit_ctx *ctx, struct bpf_tramp_i | |||
| 2092 | 2068 | emit_store_stack_imm64(ctx, LOONGARCH_GPR_T1, -func_meta_off, func_meta); | |
| 2093 | 2069 | ||
| 2094 | 2070 | if (fexit->nr_nodes) { | |
| 2095 | - | ret = invoke_bpf(ctx, im, fexit, args_off, retval_off, run_ctx_off, | |
| 2071 | + | ret = invoke_bpf(ctx, fexit, args_off, retval_off, run_ctx_off, | |
| 2096 | 2072 | func_meta_off, false, func_meta, cookie_off); | |
| 2097 | 2073 | if (ret) | |
| 2098 | 2074 | goto out; | |
| 2099 | 2075 | } | |
| 2100 | 2076 | ||
| 2101 | 2077 | if (flags & BPF_TRAMP_F_CALL_ORIG) { | |
| 2078 | + | im->ip_epilogue = ctx->ro_image + ctx->idx; | |
| 2102 | 2079 | move_addr(ctx, LOONGARCH_GPR_A0, (const u64)im); | |
| 2103 | 2080 | ret = emit_call(ctx, (const u64)__bpf_tramp_exit); | |
| 2104 | 2081 | if (ret) | |
| @@ -2200,8 +2177,11 @@ int arch_bpf_trampoline_size(const struct btf_func_model *m, u32 flags, | |||
| 2200 | 2177 | struct bpf_tramp_nodes *tnodes, void *func_addr) | |
| 2201 | 2178 | { | |
| 2202 | 2179 | int ret; | |
| 2203 | - | struct jit_ctx ctx = {}; | |
| 2204 | - | struct bpf_tramp_image im = {}; | |
| 2180 | + | struct jit_ctx ctx; | |
| 2181 | + | struct bpf_tramp_image im; | |
| 2182 | + | ||
| 2183 | + | ctx.image = NULL; | |
| 2184 | + | ctx.idx = 0; | |
| 2205 | 2185 | ||
| 2206 | 2186 | ret = __arch_prepare_bpf_trampoline(&ctx, &im, m, tnodes, func_addr, flags); | |
| 2207 | 2187 | ||
modified arch/loongarch/vdso/Makefile
| @@ -16,7 +16,6 @@ ccflags-vdso := \ | |||
| 16 | 16 | $(filter -m64,$(KBUILD_CFLAGS)) \ | |
| 17 | 17 | $(filter -march=%,$(KBUILD_CFLAGS)) \ | |
| 18 | 18 | $(filter -m%-float,$(KBUILD_CFLAGS)) \ | |
| 19 | - | $(CONFIG_CC_OPT_INLINE_MEMSET) \ | |
| 20 | 19 | $(CLANG_FLAGS) \ | |
| 21 | 20 | -D__VDSO__ | |
| 22 | 21 | ||
modified arch/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/include/asm/entry-common.h
| @@ -222,6 +222,8 @@ static inline void arch_interrupt_enter_prepare(struct pt_regs *regs) | |||
| 222 | 222 | ||
| 223 | 223 | if (user_mode(regs)) { | |
| 224 | 224 | kuap_lock(); | |
| 225 | + | account_cpu_user_entry(); | |
| 226 | + | account_stolen_time(); | |
| 225 | 227 | } else { | |
| 226 | 228 | kuap_save_and_lock(regs); | |
| 227 | 229 | /* | |
| @@ -268,7 +270,7 @@ static inline void arch_interrupt_exit_prepare(struct pt_regs *regs) | |||
| 268 | 270 | } | |
| 269 | 271 | ||
| 270 | 272 | /* irqentry_exit expects to be called with interrupts disabled */ | |
| 271 | - | hard_irq_disable(); | |
| 273 | + | local_irq_disable(); | |
| 272 | 274 | } | |
| 273 | 275 | ||
| 274 | 276 | static inline void arch_interrupt_async_enter_prepare(struct pt_regs *regs) | |
| @@ -513,14 +515,8 @@ static inline void arch_exit_to_user_mode_prepare(struct pt_regs *regs, | |||
| 513 | 515 | #ifdef CONFIG_PPC_TRANSACTIONAL_MEM | |
| 514 | 516 | local_paca->tm_scratch = regs->msr; | |
| 515 | 517 | #endif | |
| 516 | - | /* | |
| 517 | - | * Do not restore KUAP here. Generic entry might treat this as the last | |
| 518 | - | * arch step before userspace but PowerPC still has kernel work after | |
| 519 | - | * irqentry_exit()/syscall_exit_to_user_mode() i.e. in | |
| 520 | - | * interrupt_exit_user_prepare() / syscall_exit_prepare() may enable | |
| 521 | - | * IRQs and retry. Those functions restore KUAP immediately before rfi, | |
| 522 | - | * which is where it should belong. | |
| 523 | - | */ | |
| 518 | + | /* Restore user access locks last */ | |
| 519 | + | kuap_user_restore(regs); | |
| 524 | 520 | } | |
| 525 | 521 | ||
| 526 | 522 | #define arch_exit_to_user_mode_prepare arch_exit_to_user_mode_prepare | |
modified arch/powerpc/kernel/eeh_driver.c
| @@ -533,7 +533,9 @@ static void eeh_rmv_device(struct eeh_dev *edev, void *userdata) | |||
| 533 | 533 | if (rmv_data) | |
| 534 | 534 | list_add(&edev->rmv_entry, &rmv_data->removed_vf_list); | |
| 535 | 535 | } else { | |
| 536 | + | pci_lock_rescan_remove(); | |
| 536 | 537 | pci_stop_and_remove_bus_device(dev); | |
| 538 | + | pci_unlock_rescan_remove(); | |
| 537 | 539 | } | |
| 538 | 540 | } | |
| 539 | 541 | ||
modified arch/powerpc/kernel/interrupt.c
| @@ -175,7 +175,7 @@ again: | |||
| 175 | 175 | current_thread_info()->exit_flags &= ~_TIF_RESTOREALL; | |
| 176 | 176 | regs->exit_result |= ret; | |
| 177 | 177 | ||
| 178 | - | return regs->exit_result; | |
| 178 | + | return ret; | |
| 179 | 179 | } | |
| 180 | 180 | #endif | |
| 181 | 181 | ||
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/kernel/prom.c
| @@ -824,6 +824,7 @@ void __init early_init_devtree(void *params) | |||
| 824 | 824 | fadump_append_bootargs(); | |
| 825 | 825 | ||
| 826 | 826 | /* Scan memory nodes and rebuild MEMBLOCKs */ | |
| 827 | + | early_init_dt_scan_root(); | |
| 827 | 828 | early_init_dt_scan_memory_ppc(); | |
| 828 | 829 | ||
| 829 | 830 | /* | |
modified arch/powerpc/kernel/rtas_pci.c
| @@ -54,10 +54,6 @@ int rtas_pci_dn_read_config(struct pci_dn *pdn, int where, int size, u32 *val) | |||
| 54 | 54 | if (!config_access_valid(pdn, where)) | |
| 55 | 55 | return PCIBIOS_BAD_REGISTER_NUMBER; | |
| 56 | 56 | #ifdef CONFIG_EEH | |
| 57 | - | if (pdn->edev && | |
| 58 | - | (pdn->edev->mode & EEH_DEV_REMOVED)) | |
| 59 | - | return PCIBIOS_DEVICE_NOT_FOUND; | |
| 60 | - | ||
| 61 | 57 | if (pdn->edev && pdn->edev->pe && | |
| 62 | 58 | (pdn->edev->pe->state & EEH_PE_CFG_BLOCKED)) | |
| 63 | 59 | return PCIBIOS_SET_FAILED; | |
| @@ -109,10 +105,6 @@ int rtas_pci_dn_write_config(struct pci_dn *pdn, int where, int size, u32 val) | |||
| 109 | 105 | if (!config_access_valid(pdn, where)) | |
| 110 | 106 | return PCIBIOS_BAD_REGISTER_NUMBER; | |
| 111 | 107 | #ifdef CONFIG_EEH | |
| 112 | - | if (pdn->edev && | |
| 113 | - | (pdn->edev->mode & EEH_DEV_REMOVED)) | |
| 114 | - | return PCIBIOS_DEVICE_NOT_FOUND; | |
| 115 | - | ||
| 116 | 108 | if (pdn->edev && pdn->edev->pe && | |
| 117 | 109 | (pdn->edev->pe->state & EEH_PE_CFG_BLOCKED)) | |
| 118 | 110 | return PCIBIOS_SET_FAILED; | |
modified arch/powerpc/kernel/syscall.c
| @@ -18,10 +18,8 @@ notrace long system_call_exception(struct pt_regs *regs, unsigned long r0) | |||
| 18 | 18 | long ret; | |
| 19 | 19 | syscall_fn f; | |
| 20 | 20 | ||
| 21 | - | if (unlikely(!syscall_enter_from_user_mode_randomize_stack(regs, &r0))) { | |
| 22 | - | clear_thread_flag(TIF_SYSCALL_RET); | |
| 21 | + | if (unlikely(!syscall_enter_from_user_mode_randomize_stack(regs, &r0))) | |
| 23 | 22 | return syscall_get_error(current, regs); | |
| 24 | - | } | |
| 25 | 23 | ||
| 26 | 24 | if (unlikely(test_and_clear_thread_flag(TIF_SYSCALL_RET))) | |
| 27 | 25 | return syscall_get_error(current, regs); | |
modified arch/powerpc/kernel/vdso/Makefile
| @@ -43,7 +43,6 @@ ccflags-y := -fno-common -fno-builtin -DBUILD_VDSO | |||
| 43 | 43 | ccflags-y += $(DISABLE_LATENT_ENTROPY_PLUGIN) | |
| 44 | 44 | ccflags-y += $(call cc-option, -fno-stack-protector) | |
| 45 | 45 | ccflags-y += -DDISABLE_BRANCH_PROFILING | |
| 46 | - | ccflags-y += $(CONFIG_CC_OPT_INLINE_MEMSET) | |
| 47 | 46 | ccflags-y += -ffreestanding -fasynchronous-unwind-tables | |
| 48 | 47 | ccflags-remove-y := $(CC_FLAGS_FTRACE) | |
| 49 | 48 | ldflags-y := -Wl,--hash-style=both -nostdlib -shared -z noexecstack $(CLANG_FLAGS) | |
modified arch/powerpc/kexec/elf_64.c
| @@ -94,8 +94,6 @@ static void *elf64_load(struct kimage *image, char *kernel_buf, | |||
| 94 | 94 | cmdline = modified_cmdline; | |
| 95 | 95 | } | |
| 96 | 96 | ||
| 97 | - | kexec_dprintk("Command line: %s", cmdline ? cmdline : ""); | |
| 98 | - | ||
| 99 | 97 | if (initrd != NULL) { | |
| 100 | 98 | kbuf.buffer = initrd; | |
| 101 | 99 | kbuf.bufsz = kbuf.memsz = initrd_len; | |
modified arch/powerpc/kexec/file_load_64.c
| @@ -57,7 +57,7 @@ int arch_check_excluded_range(struct kimage *image, unsigned long start, | |||
| 57 | 57 | ||
| 58 | 58 | emem = image->arch.exclude_ranges; | |
| 59 | 59 | for (i = 0; i < emem->nr_ranges; i++) | |
| 60 | - | if (start <= emem->ranges[i].end && end >= emem->ranges[i].start) | |
| 60 | + | if (start < emem->ranges[i].end && end > emem->ranges[i].start) | |
| 61 | 61 | return 1; | |
| 62 | 62 | ||
| 63 | 63 | return 0; | |
| @@ -113,7 +113,7 @@ static int add_usable_mem(struct umem_info *um_info, u64 base, u64 end) | |||
| 113 | 113 | loc_end = um_info->ranges[i].end; | |
| 114 | 114 | if (loc_base >= base && loc_end <= end) | |
| 115 | 115 | add = true; | |
| 116 | - | else if (base <= loc_end && end >= loc_base) { | |
| 116 | + | else if (base < loc_end && end > loc_base) { | |
| 117 | 117 | if (loc_base < base) | |
| 118 | 118 | loc_base = base; | |
| 119 | 119 | if (loc_end > end) | |
| @@ -377,12 +377,16 @@ static int load_backup_segment(struct kimage *image, struct kexec_buf *kbuf) | |||
| 377 | 377 | static unsigned int kdump_extra_elfcorehdr_size(struct crash_mem *cmem) | |
| 378 | 378 | { | |
| 379 | 379 | #if defined(CONFIG_CRASH_HOTPLUG) && defined(CONFIG_MEMORY_HOTPLUG) | |
| 380 | + | unsigned int extra_sz = 0; | |
| 381 | + | ||
| 380 | 382 | if (CONFIG_CRASH_MAX_MEMORY_RANGES > (unsigned int)PN_XNUM) | |
| 381 | 383 | pr_warn("Number of Phdrs %u exceeds max\n", CONFIG_CRASH_MAX_MEMORY_RANGES); | |
| 382 | 384 | else if (cmem->nr_ranges >= CONFIG_CRASH_MAX_MEMORY_RANGES) | |
| 383 | 385 | pr_warn("Configured crash mem ranges may not be enough\n"); | |
| 384 | 386 | else | |
| 385 | - | return (CONFIG_CRASH_MAX_MEMORY_RANGES - cmem->nr_ranges) * sizeof(Elf64_Phdr); | |
| 387 | + | extra_sz = (CONFIG_CRASH_MAX_MEMORY_RANGES - cmem->nr_ranges) * sizeof(Elf64_Phdr); | |
| 388 | + | ||
| 389 | + | return extra_sz; | |
| 386 | 390 | #endif | |
| 387 | 391 | return 0; | |
| 388 | 392 | } | |
modified arch/powerpc/kvm/book3s_hv.c
| @@ -3058,6 +3058,7 @@ static int kvmppc_core_vcpu_create_hv(struct kvm_vcpu *vcpu) | |||
| 3058 | 3058 | ||
| 3059 | 3059 | init_waitqueue_head(&vcpu->arch.cpu_run); | |
| 3060 | 3060 | ||
| 3061 | + | mutex_lock(&kvm->lock); | |
| 3061 | 3062 | vcore = NULL; | |
| 3062 | 3063 | err = -EINVAL; | |
| 3063 | 3064 | if (cpu_has_feature(CPU_FTR_ARCH_300)) { | |
| @@ -3090,6 +3091,7 @@ static int kvmppc_core_vcpu_create_hv(struct kvm_vcpu *vcpu) | |||
| 3090 | 3091 | mutex_unlock(&kvm->arch.mmu_setup_lock); | |
| 3091 | 3092 | } | |
| 3092 | 3093 | } | |
| 3094 | + | mutex_unlock(&kvm->lock); | |
| 3093 | 3095 | ||
| 3094 | 3096 | if (!vcore) | |
| 3095 | 3097 | return err; | |
| @@ -6138,12 +6140,12 @@ static int kvmppc_irq_bypass_add_producer_hv(struct irq_bypass_consumer *cons, | |||
| 6138 | 6140 | struct kvm_kernel_irqfd *irqfd = | |
| 6139 | 6141 | container_of(cons, struct kvm_kernel_irqfd, consumer); | |
| 6140 | 6142 | ||
| 6143 | + | irqfd->producer = prod; | |
| 6144 | + | ||
| 6141 | 6145 | ret = kvmppc_set_passthru_irq(irqfd->kvm, prod->irq, irqfd->gsi); | |
| 6142 | 6146 | if (ret) | |
| 6143 | 6147 | pr_info("kvmppc_set_passthru_irq (irq %d, gsi %d) fails: %d\n", | |
| 6144 | 6148 | prod->irq, irqfd->gsi, ret); | |
| 6145 | - | else | |
| 6146 | - | irqfd->producer = prod; | |
| 6147 | 6149 | ||
| 6148 | 6150 | return ret; | |
| 6149 | 6151 | } | |
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/powerpc/net/bpf_jit_comp.c
| @@ -602,18 +602,14 @@ int arch_protect_bpf_trampoline(void *image, unsigned int size) | |||
| 602 | 602 | } | |
| 603 | 603 | ||
| 604 | 604 | static int invoke_bpf_prog(u32 *image, u32 *ro_image, struct codegen_context *ctx, | |
| 605 | - | struct bpf_tramp_image *im, struct bpf_tramp_node *n, | |
| 606 | - | int regs_off, int retval_off, int run_ctx_off, bool save_ret) | |
| 605 | + | struct bpf_tramp_node *n, int regs_off, int retval_off, | |
| 606 | + | int run_ctx_off, bool save_ret) | |
| 607 | 607 | { | |
| 608 | 608 | struct bpf_prog *p = n->link->prog; | |
| 609 | 609 | ppc_inst_t branch_insn; | |
| 610 | - | u32 jmp_idx, skip_idx; | |
| 610 | + | u32 jmp_idx; | |
| 611 | 611 | int ret = 0; | |
| 612 | 612 | ||
| 613 | - | /* nop, patched to skip this prog when it is detached */ | |
| 614 | - | skip_idx = ctx->idx; | |
| 615 | - | EMIT(PPC_RAW_NOP()); | |
| 616 | - | ||
| 617 | 613 | /* Save cookie */ | |
| 618 | 614 | if (IS_ENABLED(CONFIG_PPC64)) { | |
| 619 | 615 | PPC_LI64(_R3, n->cookie); | |
| @@ -683,17 +679,13 @@ static int invoke_bpf_prog(u32 *image, u32 *ro_image, struct codegen_context *ct | |||
| 683 | 679 | EMIT(PPC_RAW_ADDI(_R5, _R1, run_ctx_off)); | |
| 684 | 680 | ret = bpf_jit_emit_func_call_rel(image, ro_image, ctx, | |
| 685 | 681 | (unsigned long)bpf_trampoline_exit(p)); | |
| 686 | - | if (ret) | |
| 687 | - | return ret; | |
| 688 | 682 | ||
| 689 | - | if (ro_image) /* image is NULL for dummy pass */ | |
| 690 | - | bpf_tramp_image_add_skip(im, p, &ro_image[skip_idx], &ro_image[ctx->idx]); | |
| 691 | - | return 0; | |
| 683 | + | return ret; | |
| 692 | 684 | } | |
| 693 | 685 | ||
| 694 | 686 | static int invoke_bpf_mod_ret(u32 *image, u32 *ro_image, struct codegen_context *ctx, | |
| 695 | - | struct bpf_tramp_image *im, struct bpf_tramp_nodes *tn, | |
| 696 | - | int regs_off, int retval_off, int run_ctx_off, u32 *branches) | |
| 687 | + | struct bpf_tramp_nodes *tn, int regs_off, int retval_off, | |
| 688 | + | int run_ctx_off, u32 *branches) | |
| 697 | 689 | { | |
| 698 | 690 | int i; | |
| 699 | 691 | ||
| @@ -704,8 +696,8 @@ static int invoke_bpf_mod_ret(u32 *image, u32 *ro_image, struct codegen_context | |||
| 704 | 696 | EMIT(PPC_RAW_LI(_R3, 0)); | |
| 705 | 697 | EMIT(PPC_RAW_STL(_R3, _R1, retval_off)); | |
| 706 | 698 | for (i = 0; i < tn->nr_nodes; i++) { | |
| 707 | - | if (invoke_bpf_prog(image, ro_image, ctx, im, tn->nodes[i], regs_off, | |
| 708 | - | retval_off, run_ctx_off, true)) | |
| 699 | + | if (invoke_bpf_prog(image, ro_image, ctx, tn->nodes[i], regs_off, retval_off, | |
| 700 | + | run_ctx_off, true)) | |
| 709 | 701 | return -EINVAL; | |
| 710 | 702 | ||
| 711 | 703 | /* | |
| @@ -1051,8 +1043,8 @@ static int __arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *rw_im | |||
| 1051 | 1043 | cookie_ctx_off--; | |
| 1052 | 1044 | } | |
| 1053 | 1045 | ||
| 1054 | - | if (invoke_bpf_prog(image, ro_image, ctx, im, fentry->nodes[i], regs_off, | |
| 1055 | - | retval_off, run_ctx_off, flags & BPF_TRAMP_F_RET_FENTRY_RET)) | |
| 1046 | + | if (invoke_bpf_prog(image, ro_image, ctx, fentry->nodes[i], regs_off, retval_off, | |
| 1047 | + | run_ctx_off, flags & BPF_TRAMP_F_RET_FENTRY_RET)) | |
| 1056 | 1048 | return -EINVAL; | |
| 1057 | 1049 | } | |
| 1058 | 1050 | ||
| @@ -1061,7 +1053,7 @@ static int __arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *rw_im | |||
| 1061 | 1053 | if (!branches) | |
| 1062 | 1054 | return -ENOMEM; | |
| 1063 | 1055 | ||
| 1064 | - | if (invoke_bpf_mod_ret(image, ro_image, ctx, im, fmod_ret, regs_off, retval_off, | |
| 1056 | + | if (invoke_bpf_mod_ret(image, ro_image, ctx, fmod_ret, regs_off, retval_off, | |
| 1065 | 1057 | run_ctx_off, branches)) { | |
| 1066 | 1058 | ret = -EINVAL; | |
| 1067 | 1059 | goto cleanup; | |
| @@ -1098,6 +1090,11 @@ static int __arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *rw_im | |||
| 1098 | 1090 | /* Restore updated tail_call_cnt */ | |
| 1099 | 1091 | if (flags & BPF_TRAMP_F_TAIL_CALL_CTX) | |
| 1100 | 1092 | bpf_trampoline_restore_tail_call_cnt(image, ctx, bpf_frame_size, r4_off); | |
| 1093 | + | ||
| 1094 | + | /* Reserve space to patch branch instruction to skip fexit progs */ | |
| 1095 | + | if (ro_image) /* image is NULL for dummy pass */ | |
| 1096 | + | im->ip_after_call = &((u32 *)ro_image)[ctx->idx]; | |
| 1097 | + | EMIT(PPC_RAW_NOP()); | |
| 1101 | 1098 | } | |
| 1102 | 1099 | ||
| 1103 | 1100 | /* Update branches saved in invoke_bpf_mod_ret with address of do_fexit */ | |
| @@ -1126,14 +1123,16 @@ static int __arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *rw_im | |||
| 1126 | 1123 | cookie_ctx_off--; | |
| 1127 | 1124 | } | |
| 1128 | 1125 | ||
| 1129 | - | if (invoke_bpf_prog(image, ro_image, ctx, im, fexit->nodes[i], regs_off, | |
| 1130 | - | retval_off, run_ctx_off, false)) { | |
| 1126 | + | if (invoke_bpf_prog(image, ro_image, ctx, fexit->nodes[i], regs_off, retval_off, | |
| 1127 | + | run_ctx_off, false)) { | |
| 1131 | 1128 | ret = -EINVAL; | |
| 1132 | 1129 | goto cleanup; | |
| 1133 | 1130 | } | |
| 1134 | 1131 | } | |
| 1135 | 1132 | ||
| 1136 | 1133 | if (flags & BPF_TRAMP_F_CALL_ORIG) { | |
| 1134 | + | if (ro_image) /* image is NULL for dummy pass */ | |
| 1135 | + | im->ip_epilogue = &((u32 *)ro_image)[ctx->idx]; | |
| 1137 | 1136 | PPC_LI_ADDR(_R3, im); | |
| 1138 | 1137 | ret = bpf_jit_emit_func_call_rel(image, ro_image, ctx, | |
| 1139 | 1138 | (unsigned long)__bpf_tramp_exit); | |
| @@ -1193,7 +1192,7 @@ cleanup: | |||
| 1193 | 1192 | int arch_bpf_trampoline_size(const struct btf_func_model *m, u32 flags, | |
| 1194 | 1193 | struct bpf_tramp_nodes *tnodes, void *func_addr) | |
| 1195 | 1194 | { | |
| 1196 | - | struct bpf_tramp_image im = {}; | |
| 1195 | + | struct bpf_tramp_image im; | |
| 1197 | 1196 | int ret; | |
| 1198 | 1197 | ||
| 1199 | 1198 | ret = __arch_prepare_bpf_trampoline(&im, NULL, NULL, NULL, m, flags, tnodes, func_addr); | |
| @@ -1321,7 +1320,7 @@ int bpf_arch_text_poke(void *ip, enum bpf_text_poke_type old_t, | |||
| 1321 | 1320 | ||
| 1322 | 1321 | /* | |
| 1323 | 1322 | * If we are not poking at bpf prog entry, then we are simply patching in/out | |
| 1324 | - | * an unconditional branch instruction in a trampoline image | |
| 1323 | + | * an unconditional branch instruction at im->ip_after_call | |
| 1325 | 1324 | */ | |
| 1326 | 1325 | if (offset) { | |
| 1327 | 1326 | if (old_t == BPF_MOD_CALL || new_t == BPF_MOD_CALL) { | |
modified arch/powerpc/perf/imc-pmu.c
| @@ -1275,8 +1275,6 @@ static int trace_imc_prepare_sample(struct trace_imc_data *mem, | |||
| 1275 | 1275 | struct perf_event_header *header, | |
| 1276 | 1276 | struct perf_event *event) | |
| 1277 | 1277 | { | |
| 1278 | - | u16 misc = 0; | |
| 1279 | - | ||
| 1280 | 1278 | /* Sanity checks for a valid record */ | |
| 1281 | 1279 | if (be64_to_cpu(READ_ONCE(mem->tb1)) > *prev_tb) | |
| 1282 | 1280 | *prev_tb = be64_to_cpu(READ_ONCE(mem->tb1)); | |
| @@ -1291,19 +1289,23 @@ static int trace_imc_prepare_sample(struct trace_imc_data *mem, | |||
| 1291 | 1289 | data->ip = be64_to_cpu(READ_ONCE(mem->ip)); | |
| 1292 | 1290 | data->period = event->hw.last_period; | |
| 1293 | 1291 | ||
| 1292 | + | header->type = PERF_RECORD_SAMPLE; | |
| 1293 | + | header->size = sizeof(*header) + event->header_size; | |
| 1294 | + | header->misc = 0; | |
| 1295 | + | ||
| 1294 | 1296 | if (cpu_has_feature(CPU_FTR_ARCH_31)) { | |
| 1295 | 1297 | switch (IMC_TRACE_RECORD_VAL_HVPR(be64_to_cpu(READ_ONCE(mem->val)))) { | |
| 1296 | 1298 | case 0:/* when MSR HV and PR not set in the trace-record */ | |
| 1297 | - | misc |= PERF_RECORD_MISC_GUEST_KERNEL; | |
| 1299 | + | header->misc |= PERF_RECORD_MISC_GUEST_KERNEL; | |
| 1298 | 1300 | break; | |
| 1299 | 1301 | case 1: /* MSR HV is 0 and PR is 1 */ | |
| 1300 | - | misc |= PERF_RECORD_MISC_GUEST_USER; | |
| 1302 | + | header->misc |= PERF_RECORD_MISC_GUEST_USER; | |
| 1301 | 1303 | break; | |
| 1302 | 1304 | case 2: /* MSR HV is 1 and PR is 0 */ | |
| 1303 | - | misc |= PERF_RECORD_MISC_KERNEL; | |
| 1305 | + | header->misc |= PERF_RECORD_MISC_KERNEL; | |
| 1304 | 1306 | break; | |
| 1305 | 1307 | case 3: /* MSR HV is 1 and PR is 1 */ | |
| 1306 | - | misc |= PERF_RECORD_MISC_USER; | |
| 1308 | + | header->misc |= PERF_RECORD_MISC_USER; | |
| 1307 | 1309 | break; | |
| 1308 | 1310 | default: | |
| 1309 | 1311 | pr_info("IMC: Unable to set the flag based on MSR bits\n"); | |
| @@ -1311,14 +1313,11 @@ static int trace_imc_prepare_sample(struct trace_imc_data *mem, | |||
| 1311 | 1313 | } | |
| 1312 | 1314 | } else { | |
| 1313 | 1315 | if (is_kernel_addr(data->ip)) | |
| 1314 | - | misc |= PERF_RECORD_MISC_KERNEL; | |
| 1316 | + | header->misc |= PERF_RECORD_MISC_KERNEL; | |
| 1315 | 1317 | else | |
| 1316 | - | misc |= PERF_RECORD_MISC_USER; | |
| 1318 | + | header->misc |= PERF_RECORD_MISC_USER; | |
| 1317 | 1319 | } | |
| 1318 | - | perf_event_header__init(header, data, | |
| 1319 | - | PERF_RECORD_SAMPLE, misc, | |
| 1320 | - | sizeof(*header) + event->header_size, | |
| 1321 | - | event); | |
| 1320 | + | perf_event_header__init_id(header, data, event); | |
| 1322 | 1321 | ||
| 1323 | 1322 | return 0; | |
| 1324 | 1323 | } | |
modified arch/powerpc/platforms/pasemi/setup.c
| @@ -165,8 +165,6 @@ static int __init pas_setup_mce_regs(void) | |||
| 165 | 165 | while (dev && reg < MAX_MCE_REGS) { | |
| 166 | 166 | mce_regs[reg].name = kasprintf(GFP_KERNEL, | |
| 167 | 167 | "mc%d_mcdebug_errsta", reg); | |
| 168 | - | if (!mce_regs[reg].name) | |
| 169 | - | return -ENOMEM; | |
| 170 | 168 | mce_regs[reg].addr = pasemi_pci_getcfgaddr(dev, 0x730); | |
| 171 | 169 | dev = pci_get_device(PCI_VENDOR_ID_PASEMI, 0xa00a, dev); | |
| 172 | 170 | reg++; | |
modified arch/powerpc/platforms/powernv/pci-ioda.c
| @@ -1623,13 +1623,15 @@ int64_t pnv_opal_pci_msi_eoi(struct irq_data *d) | |||
| 1623 | 1623 | return opal_pci_msi_eoi(phb->opal_id, d->parent_data->hwirq); | |
| 1624 | 1624 | } | |
| 1625 | 1625 | ||
| 1626 | + | static struct irq_chip pnv_pci_msi_irq_chip; | |
| 1627 | + | ||
| 1626 | 1628 | /* | |
| 1627 | 1629 | * Returns true iff chip is something that we could call | |
| 1628 | 1630 | * pnv_opal_pci_msi_eoi for. | |
| 1629 | 1631 | */ | |
| 1630 | 1632 | bool is_pnv_opal_msi(struct irq_chip *chip) | |
| 1631 | 1633 | { | |
| 1632 | - | return chip && chip->name && str_has_prefix(chip->name, "PNV-"); | |
| 1634 | + | return chip == &pnv_pci_msi_irq_chip; | |
| 1633 | 1635 | } | |
| 1634 | 1636 | EXPORT_SYMBOL_GPL(is_pnv_opal_msi); | |
| 1635 | 1637 | ||
| @@ -1726,7 +1728,7 @@ static const struct msi_parent_ops pnv_msi_parent_ops = { | |||
| 1726 | 1728 | .chip_flags = MSI_CHIP_FLAG_SET_EOI, | |
| 1727 | 1729 | .bus_select_token = DOMAIN_BUS_NEXUS, | |
| 1728 | 1730 | .bus_select_mask = MATCH_PCI_MSI, | |
| 1729 | - | .prefix = "PNV-", /* Note: is_pnv_opal_msi() uses this */ | |
| 1731 | + | .prefix = "PNV-", | |
| 1730 | 1732 | .init_dev_msi_info = pnv_init_dev_msi_info, | |
| 1731 | 1733 | }; | |
| 1732 | 1734 | ||
modified arch/powerpc/platforms/ps3/repository.c
| @@ -6,8 +6,6 @@ | |||
| 6 | 6 | * Copyright 2006 Sony Corp. | |
| 7 | 7 | */ | |
| 8 | 8 | ||
| 9 | - | #include <linux/minmax.h> | |
| 10 | - | ||
| 11 | 9 | #include <asm/lv1call.h> | |
| 12 | 10 | ||
| 13 | 11 | #include "platform.h" | |
| @@ -76,9 +74,8 @@ static void _dump_node(unsigned int lpar_id, u64 n1, u64 n2, u64 n3, u64 n4, | |||
| 76 | 74 | static u64 make_first_field(const char *text, u64 index) | |
| 77 | 75 | { | |
| 78 | 76 | u64 n = 0; | |
| 79 | - | size_t len = min(strlen(text), sizeof(n)); | |
| 80 | 77 | ||
| 81 | - | memcpy(&n, text, len); | |
| 78 | + | memcpy((char *)&n, text, strnlen(text, sizeof(n))); | |
| 82 | 79 | return PS3_VENDOR_ID_NONE + (n >> 32) + index; | |
| 83 | 80 | } | |
| 84 | 81 | ||
modified arch/powerpc/platforms/pseries/htmdump.c
| @@ -527,28 +527,28 @@ static int htmdump_init_debugfs(void) | |||
| 527 | 527 | htm_status_buf = kmalloc(PAGE_SIZE, GFP_KERNEL); | |
| 528 | 528 | if (!htm_status_buf) { | |
| 529 | 529 | pr_err("Failed to allocate htmstatus buf\n"); | |
| 530 | - | goto htm_status_buf_err; | |
| 530 | + | return -ENOMEM; | |
| 531 | 531 | } | |
| 532 | 532 | ||
| 533 | 533 | /* Debugfs interface file to present System Processor Configuration */ | |
| 534 | 534 | htm_info_buf = kmalloc(PAGE_SIZE, GFP_KERNEL); | |
| 535 | 535 | if (!htm_info_buf) { | |
| 536 | 536 | pr_err("Failed to allocate htm info buf\n"); | |
| 537 | - | goto htm_info_buf_err; | |
| 537 | + | return -ENOMEM; | |
| 538 | 538 | } | |
| 539 | 539 | ||
| 540 | 540 | /* Debugfs interface file to present HTM capabilities */ | |
| 541 | 541 | htm_caps_buf = kmalloc(PAGE_SIZE, GFP_KERNEL); | |
| 542 | 542 | if (!htm_caps_buf) { | |
| 543 | 543 | pr_err("Failed to allocate htm caps buf\n"); | |
| 544 | - | goto htm_caps_buf_err; | |
| 544 | + | return -ENOMEM; | |
| 545 | 545 | } | |
| 546 | 546 | ||
| 547 | 547 | /* Memory to present HTM system memory configuration */ | |
| 548 | 548 | htm_mem_buf = kmalloc(PAGE_SIZE, GFP_KERNEL); | |
| 549 | 549 | if (!htm_mem_buf) { | |
| 550 | 550 | pr_err("Failed to allocate htm mem buf\n"); | |
| 551 | - | goto htm_mem_buf_err; | |
| 551 | + | return -ENOMEM; | |
| 552 | 552 | } | |
| 553 | 553 | ||
| 554 | 554 | debugfs_create_file("htmstatus", 0400, htmdump_debugfs_dir, htm_status_buf, &htmstatus_fops); | |
| @@ -557,17 +557,6 @@ static int htmdump_init_debugfs(void) | |||
| 557 | 557 | debugfs_create_file("htmsystem_mem", 0400, htmdump_debugfs_dir, htm_mem_buf, &htmsystem_mem_fops); | |
| 558 | 558 | ||
| 559 | 559 | return 0; | |
| 560 | - | ||
| 561 | - | htm_mem_buf_err: | |
| 562 | - | kfree(htm_caps_buf); | |
| 563 | - | htm_caps_buf_err: | |
| 564 | - | kfree(htm_info_buf); | |
| 565 | - | htm_info_buf_err: | |
| 566 | - | kfree(htm_status_buf); | |
| 567 | - | htm_status_buf_err: | |
| 568 | - | debugfs_remove_recursive(htmdump_debugfs_dir); | |
| 569 | - | kfree(htm_buf); | |
| 570 | - | return -ENOMEM; | |
| 571 | 560 | } | |
| 572 | 561 | ||
| 573 | 562 | static int __init htmdump_init(void) | |
modified arch/powerpc/platforms/pseries/pci.c
| @@ -132,14 +132,11 @@ static int pseries_pci_sriov_enable(struct pci_dev *pdev, u16 num_vfs) | |||
| 132 | 132 | ||
| 133 | 133 | /* First integer stores max config */ | |
| 134 | 134 | max_config_vfs = of_read_number(&max_vfs[0], 1); | |
| 135 | - | if (max_config_vfs < num_vfs) { | |
| 136 | - | dev_err(&pdev->dev, "Num VFs %x > %x Configurable VFs\n", | |
| 137 | - | num_vfs, max_config_vfs); | |
| 138 | - | return -EINVAL; | |
| 139 | - | } | |
| 140 | - | if (num_vfs > MAX_VFS_FOR_MAP_PE) { | |
| 141 | - | dev_err(&pdev->dev, "Num VFs %x > %x PE mapping limit\n", | |
| 142 | - | num_vfs, MAX_VFS_FOR_MAP_PE); | |
| 135 | + | if (max_config_vfs < num_vfs || num_vfs > MAX_VFS_FOR_MAP_PE) { | |
| 136 | + | dev_err(&pdev->dev, | |
| 137 | + | "Num VFs %x > %x Configurable VFs\n", | |
| 138 | + | num_vfs, (num_vfs > MAX_VFS_FOR_MAP_PE) ? | |
| 139 | + | MAX_VFS_FOR_MAP_PE : max_config_vfs); | |
| 143 | 140 | return -EINVAL; | |
| 144 | 141 | } | |
| 145 | 142 | ||
modified arch/powerpc/sysdev/xive/common.c
| @@ -1134,7 +1134,7 @@ static int __init xive_init_ipis(void) | |||
| 1134 | 1134 | if (!ipi_domain) | |
| 1135 | 1135 | goto out_free_fwnode; | |
| 1136 | 1136 | ||
| 1137 | - | xive_ipis = kzalloc_objs(*xive_ipis, nr_node_ids); | |
| 1137 | + | xive_ipis = kzalloc_objs(*xive_ipis, nr_node_ids, GFP_KERNEL); | |
| 1138 | 1138 | if (!xive_ipis) | |
| 1139 | 1139 | goto out_free_domain; | |
| 1140 | 1140 | ||
modified arch/riscv/Kconfig
| @@ -326,7 +326,7 @@ config STACKTRACE_SUPPORT | |||
| 326 | 326 | config GENERIC_BUG | |
| 327 | 327 | def_bool y | |
| 328 | 328 | depends on BUG | |
| 329 | - | select GENERIC_BUG_RELATIVE_POINTERS | |
| 329 | + | select GENERIC_BUG_RELATIVE_POINTERS if 64BIT | |
| 330 | 330 | ||
| 331 | 331 | config GENERIC_BUG_RELATIVE_POINTERS | |
| 332 | 332 | bool | |
| @@ -453,10 +453,9 @@ config SMP | |||
| 453 | 453 | config NR_CPUS | |
| 454 | 454 | int "Maximum number of CPUs (2-512)" | |
| 455 | 455 | depends on SMP | |
| 456 | - | range 2 512 if !RISCV_SBI_V01 && 64BIT | |
| 457 | - | range 2 128 if !RISCV_SBI_V01 && 32BIT | |
| 458 | - | range 2 64 if RISCV_SBI_V01 && 64BIT | |
| 456 | + | range 2 512 if !RISCV_SBI_V01 | |
| 459 | 457 | range 2 32 if RISCV_SBI_V01 && 32BIT | |
| 458 | + | range 2 64 if RISCV_SBI_V01 && 64BIT | |
| 460 | 459 | default "32" if 32BIT | |
| 461 | 460 | default "64" if RISCV_SBI_V01 && 64BIT | |
| 462 | 461 | default "256" if !RISCV_SBI_V01 && 64BIT | |
modified arch/riscv/Kconfig.errata
| @@ -46,7 +46,7 @@ config ERRATA_MIPS_P8700_PAUSE_OPCODE | |||
| 46 | 46 | ||
| 47 | 47 | config ERRATA_SIFIVE | |
| 48 | 48 | bool "SiFive errata" | |
| 49 | - | depends on RISCV_ALTERNATIVE && 64BIT | |
| 49 | + | depends on RISCV_ALTERNATIVE | |
| 50 | 50 | help | |
| 51 | 51 | All SiFive errata Kconfig depend on this Kconfig. Disabling | |
| 52 | 52 | this Kconfig will disable all SiFive errata. Please say "Y" | |
| @@ -96,20 +96,6 @@ config ERRATA_STARFIVE_JH7100 | |||
| 96 | 96 | Say "Y" if you want to support the BeagleV Starlight and/or | |
| 97 | 97 | StarFive VisionFive V1 boards. | |
| 98 | 98 | ||
| 99 | - | config ERRATA_SIFIVE_MAL_9092 | |
| 100 | - | bool "Apply SiFive HLV/HLVX/HSV fence errata" | |
| 101 | - | depends on ERRATA_SIFIVE && 64BIT | |
| 102 | - | default y | |
| 103 | - | help | |
| 104 | - | This will apply the SiFive MAL-9092 errata to add fence.rw | |
| 105 | - | instructions around all HLV/HLVX/HSV instructions. | |
| 106 | - | ||
| 107 | - | Note: HSTATUS.HU is cleared during KVM initialization. If future | |
| 108 | - | changes enable HSTATUS.HU to allow hypervisor instructions in | |
| 109 | - | U-mode, additional errata handling may be required. | |
| 110 | - | ||
| 111 | - | If you don't know what to do here, say "Y". | |
| 112 | - | ||
| 113 | 99 | config ERRATA_THEAD | |
| 114 | 100 | bool "T-HEAD errata" | |
| 115 | 101 | depends on RISCV_ALTERNATIVE | |
| @@ -160,7 +146,6 @@ config ERRATA_THEAD_PMU | |||
| 160 | 146 | config ERRATA_THEAD_GHOSTWRITE | |
| 161 | 147 | bool "Apply T-Head Ghostwrite errata" | |
| 162 | 148 | depends on ERRATA_THEAD && RISCV_ISA_XTHEADVECTOR | |
| 163 | - | select RISCV_ALTERNATIVE_EARLY | |
| 164 | 149 | default y | |
| 165 | 150 | help | |
| 166 | 151 | The T-Head C9xx cores have a vulnerability in the xtheadvector | |
modified arch/riscv/Kconfig.socs
| @@ -34,7 +34,6 @@ config ARCH_RENESAS | |||
| 34 | 34 | config ARCH_SIFIVE | |
| 35 | 35 | bool "SiFive SoCs" | |
| 36 | 36 | select ERRATA_SIFIVE | |
| 37 | - | depends on 64BIT | |
| 38 | 37 | help | |
| 39 | 38 | This enables support for SiFive SoC platform hardware. | |
| 40 | 39 | ||
modified arch/riscv/errata/sifive/errata.c
| @@ -51,22 +51,6 @@ static bool errata_cip_1200_check_func(unsigned long arch_id, unsigned long imp | |||
| 51 | 51 | return true; | |
| 52 | 52 | } | |
| 53 | 53 | ||
| 54 | - | static bool errata_mal_9092_check_func(unsigned long arch_id, unsigned long impid) | |
| 55 | - | { | |
| 56 | - | /* | |
| 57 | - | * Affected cores: | |
| 58 | - | * Architecture ID: 0x8000000000000109 | |
| 59 | - | * Implementation ID: 0x19251031, 0x19251217, 0x19260320 | |
| 60 | - | */ | |
| 61 | - | ||
| 62 | - | if (arch_id != 0x8000000000000109) | |
| 63 | - | return false; | |
| 64 | - | if (impid != 0x19251031 && impid != 0x19251217 && impid != 0x19260320) | |
| 65 | - | return false; | |
| 66 | - | ||
| 67 | - | return true; | |
| 68 | - | } | |
| 69 | - | ||
| 70 | 54 | static struct errata_info_t errata_list[ERRATA_SIFIVE_NUMBER] = { | |
| 71 | 55 | { | |
| 72 | 56 | .name = "cip-453", | |
| @@ -76,10 +60,6 @@ static struct errata_info_t errata_list[ERRATA_SIFIVE_NUMBER] = { | |||
| 76 | 60 | .name = "cip-1200", | |
| 77 | 61 | .check_func = errata_cip_1200_check_func | |
| 78 | 62 | }, | |
| 79 | - | { | |
| 80 | - | .name = "mal-9092", | |
| 81 | - | .check_func = errata_mal_9092_check_func | |
| 82 | - | }, | |
| 83 | 63 | }; | |
| 84 | 64 | ||
| 85 | 65 | static u32 __init_or_module sifive_errata_probe(unsigned long archid, | |
modified arch/riscv/include/asm/bug.h
| @@ -29,8 +29,13 @@ | |||
| 29 | 29 | ||
| 30 | 30 | typedef u32 bug_insn_t; | |
| 31 | 31 | ||
| 32 | + | #ifdef CONFIG_GENERIC_BUG_RELATIVE_POINTERS | |
| 32 | 33 | #define __BUG_ENTRY_ADDR RISCV_INT " 1b - ." | |
| 33 | 34 | #define __BUG_ENTRY_FILE(file) RISCV_INT " " file " - ." | |
| 35 | + | #else | |
| 36 | + | #define __BUG_ENTRY_ADDR RISCV_PTR " 1b" | |
| 37 | + | #define __BUG_ENTRY_FILE(file) RISCV_PTR " " file | |
| 38 | + | #endif | |
| 34 | 39 | ||
| 35 | 40 | #ifdef CONFIG_DEBUG_BUGVERBOSE | |
| 36 | 41 | #define __BUG_ENTRY(file, line, flags) \ | |
modified arch/riscv/include/asm/cpufeature.h
| @@ -40,8 +40,6 @@ extern u32 thead_vlenb_of; | |||
| 40 | 40 | ||
| 41 | 41 | void __init riscv_user_isa_enable(void); | |
| 42 | 42 | ||
| 43 | - | void riscv_clear_hypervisor_csr(void); | |
| 44 | - | ||
| 45 | 43 | #define _RISCV_ISA_EXT_DATA(_name, _id, _subset_exts, _subset_exts_size, _validate) { \ | |
| 46 | 44 | .name = #_name, \ | |
| 47 | 45 | .property = #_name, \ | |
modified arch/riscv/include/asm/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/include/asm/errata_list_vendors.h
| @@ -11,8 +11,7 @@ | |||
| 11 | 11 | #ifdef CONFIG_ERRATA_SIFIVE | |
| 12 | 12 | #define ERRATA_SIFIVE_CIP_453 0 | |
| 13 | 13 | #define ERRATA_SIFIVE_CIP_1200 1 | |
| 14 | - | #define ERRATA_SIFIVE_MAL_9092 2 | |
| 15 | - | #define ERRATA_SIFIVE_NUMBER 3 | |
| 14 | + | #define ERRATA_SIFIVE_NUMBER 2 | |
| 16 | 15 | #endif | |
| 17 | 16 | ||
| 18 | 17 | #ifdef CONFIG_ERRATA_THEAD | |
modified arch/riscv/include/asm/futex.h
| @@ -40,7 +40,6 @@ arch_futex_atomic_op_inuser(int op, int oparg, int *oval, u32 __user *uaddr) | |||
| 40 | 40 | ||
| 41 | 41 | if (!access_ok(uaddr, sizeof(u32))) | |
| 42 | 42 | return -EFAULT; | |
| 43 | - | uaddr = untagged_addr(uaddr); | |
| 44 | 43 | ||
| 45 | 44 | switch (op) { | |
| 46 | 45 | case FUTEX_OP_SET: | |
| @@ -83,7 +82,6 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, | |||
| 83 | 82 | ||
| 84 | 83 | if (!access_ok(uaddr, sizeof(u32))) | |
| 85 | 84 | return -EFAULT; | |
| 86 | - | uaddr = untagged_addr(uaddr); | |
| 87 | 85 | ||
| 88 | 86 | __enable_user_access(); | |
| 89 | 87 | __asm__ __volatile__ ( | |
modified arch/riscv/include/asm/insn-def.h
| @@ -192,28 +192,18 @@ | |||
| 192 | 192 | INSN_R(OPCODE_SYSTEM, FUNC3(0), FUNC7(49), \ | |
| 193 | 193 | __RD(0), RS1(gaddr), RS2(vmid)) | |
| 194 | 194 | ||
| 195 | - | #define ALT_SIFIVE_MAL_9092_FENCE \ | |
| 196 | - | ALTERNATIVE("nop", "fence rw, rw", SIFIVE_VENDOR_ID, \ | |
| 197 | - | ERRATA_SIFIVE_MAL_9092, CONFIG_ERRATA_SIFIVE_MAL_9092) | |
| 198 | - | ||
| 199 | 195 | #define HLVX_HU(dest, addr) \ | |
| 200 | - | ALT_SIFIVE_MAL_9092_FENCE "\n" \ | |
| 201 | 196 | INSN_R(OPCODE_SYSTEM, FUNC3(4), FUNC7(50), \ | |
| 202 | - | RD(dest), RS1(addr), __RS2(3)) "\n" \ | |
| 203 | - | ALT_SIFIVE_MAL_9092_FENCE | |
| 197 | + | RD(dest), RS1(addr), __RS2(3)) | |
| 204 | 198 | ||
| 205 | 199 | #define HLV_W(dest, addr) \ | |
| 206 | - | ALT_SIFIVE_MAL_9092_FENCE "\n" \ | |
| 207 | 200 | INSN_R(OPCODE_SYSTEM, FUNC3(4), FUNC7(52), \ | |
| 208 | - | RD(dest), RS1(addr), __RS2(0)) "\n" \ | |
| 209 | - | ALT_SIFIVE_MAL_9092_FENCE | |
| 201 | + | RD(dest), RS1(addr), __RS2(0)) | |
| 210 | 202 | ||
| 211 | 203 | #ifdef CONFIG_64BIT | |
| 212 | 204 | #define HLV_D(dest, addr) \ | |
| 213 | - | ALT_SIFIVE_MAL_9092_FENCE "\n" \ | |
| 214 | 205 | INSN_R(OPCODE_SYSTEM, FUNC3(4), FUNC7(54), \ | |
| 215 | - | RD(dest), RS1(addr), __RS2(0)) "\n" \ | |
| 216 | - | ALT_SIFIVE_MAL_9092_FENCE | |
| 206 | + | RD(dest), RS1(addr), __RS2(0)) | |
| 217 | 207 | #else | |
| 218 | 208 | #define HLV_D(dest, addr) \ | |
| 219 | 209 | __ASM_STR(.error "hlv.d requires 64-bit support") | |
modified arch/riscv/include/asm/scs.h
| @@ -4,7 +4,6 @@ | |||
| 4 | 4 | ||
| 5 | 5 | #ifdef __ASSEMBLER__ | |
| 6 | 6 | #include <asm/asm-offsets.h> | |
| 7 | - | #include <asm/csr.h> | |
| 8 | 7 | ||
| 9 | 8 | #ifdef CONFIG_SHADOW_CALL_STACK | |
| 10 | 9 | ||
| @@ -23,17 +22,9 @@ | |||
| 23 | 22 | REG_L gp, TASK_TI_SCS_SP(tp) | |
| 24 | 23 | .endm | |
| 25 | 24 | ||
| 26 | - | /* | |
| 27 | - | * Load task_scs_sp(current) to gp, but only when the trap came from U-mode. | |
| 28 | - | * The source privilege level is taken from the saved sstatus.SPP bit (written | |
| 29 | - | * by hardware on trap entry), not by comparing tp. tp is a user-writable | |
| 30 | - | * register, so gating the shadow call stack reload on it let a user task that | |
| 31 | - | * set tp == ¤t skip the reload and run the kernel with an attacker | |
| 32 | - | * controlled gp (the shadow call stack pointer). | |
| 33 | - | */ | |
| 34 | - | .macro scs_load_current_if_from_user status, tmp | |
| 35 | - | andi \tmp, \status, SR_SPP | |
| 36 | - | bnez \tmp, _skip_scs | |
| 25 | + | /* Load task_scs_sp(current) to gp, but only if tp has changed. */ | |
| 26 | + | .macro scs_load_current_if_task_changed prev | |
| 27 | + | beq \prev, tp, _skip_scs | |
| 37 | 28 | scs_load_current | |
| 38 | 29 | _skip_scs: | |
| 39 | 30 | .endm | |
| @@ -51,7 +42,7 @@ _skip_scs: | |||
| 51 | 42 | .endm | |
| 52 | 43 | .macro scs_load_current | |
| 53 | 44 | .endm | |
| 54 | - | .macro scs_load_current_if_from_user status, tmp | |
| 45 | + | .macro scs_load_current_if_task_changed prev | |
| 55 | 46 | .endm | |
| 56 | 47 | .macro scs_save_current | |
| 57 | 48 | .endm | |
modified arch/riscv/include/asm/switch_to.h
| @@ -61,8 +61,8 @@ static inline void __switch_to_fpu(struct task_struct *prev, | |||
| 61 | 61 | ||
| 62 | 62 | static __always_inline bool has_fpu(void) | |
| 63 | 63 | { | |
| 64 | - | /* D extension depends on F, so checking D alone is sufficient. */ | |
| 65 | - | return riscv_has_extension_likely(RISCV_ISA_EXT_D); | |
| 64 | + | return riscv_has_extension_likely(RISCV_ISA_EXT_F) || | |
| 65 | + | riscv_has_extension_likely(RISCV_ISA_EXT_D); | |
| 66 | 66 | } | |
| 67 | 67 | #else | |
| 68 | 68 | static __always_inline bool has_fpu(void) { return false; } | |
modified arch/riscv/include/asm/vector.h
| @@ -137,8 +137,8 @@ static __always_inline void __vstate_csr_save(struct __riscv_v_ext_state *dest) | |||
| 137 | 137 | "csrr %0, " __stringify(CSR_VSTART) "\n\t" | |
| 138 | 138 | "csrr %1, " __stringify(CSR_VTYPE) "\n\t" | |
| 139 | 139 | "csrr %2, " __stringify(CSR_VL) "\n\t" | |
| 140 | - | : "=r" (dest->vstart), "=r" (dest->vtype), "=r" (dest->vl) | |
| 141 | - | : :); | |
| 140 | + | : "=r" (dest->vstart), "=r" (dest->vtype), "=r" (dest->vl), | |
| 141 | + | "=r" (dest->vcsr) : :); | |
| 142 | 142 | ||
| 143 | 143 | if (has_xtheadvector()) { | |
| 144 | 144 | unsigned long status; | |
| @@ -230,7 +230,7 @@ static inline void __riscv_v_vstate_save(struct __riscv_v_ext_state *save_to, | |||
| 230 | 230 | "add %1, %1, %0\n\t" | |
| 231 | 231 | "vse8.v v24, (%1)\n\t" | |
| 232 | 232 | ".option pop\n\t" | |
| 233 | - | : "=&r" (vl), "+r" (datap) : : "memory"); | |
| 233 | + | : "=&r" (vl) : "r" (datap) : "memory"); | |
| 234 | 234 | } | |
| 235 | 235 | riscv_v_disable(); | |
| 236 | 236 | } | |
| @@ -266,7 +266,7 @@ static inline void __riscv_v_vstate_restore(struct __riscv_v_ext_state *restore_ | |||
| 266 | 266 | "add %1, %1, %0\n\t" | |
| 267 | 267 | "vle8.v v24, (%1)\n\t" | |
| 268 | 268 | ".option pop\n\t" | |
| 269 | - | : "=&r" (vl), "+r" (datap) : : "memory"); | |
| 269 | + | : "=&r" (vl) : "r" (datap) : "memory"); | |
| 270 | 270 | } | |
| 271 | 271 | __vstate_csr_restore(restore_from); | |
| 272 | 272 | riscv_v_disable(); | |
modified arch/riscv/include/uapi/asm/vendor/mips.h
| @@ -1,5 +1,3 @@ | |||
| 1 | 1 | /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ | |
| 2 | 2 | ||
| 3 | - | #include <linux/const.h> | |
| 4 | - | ||
| 5 | - | #define RISCV_HWPROBE_VENDOR_EXT_XMIPSEXECTL _BITULL(0) | |
| 3 | + | #define RISCV_HWPROBE_VENDOR_EXT_XMIPSEXECTL BIT(0) | |
modified arch/riscv/kernel/cpufeature.c
| @@ -412,19 +412,6 @@ static const unsigned int riscv_zvbb_exts[] = { | |||
| 412 | 412 | RISCV_ISA_EXT_ZVKB | |
| 413 | 413 | }; | |
| 414 | 414 | ||
| 415 | - | /* | |
| 416 | - | * The RISC-V ISA manual specifies that Zfh implies Zfhmin and Zvfh implies | |
| 417 | - | * Zvfhmin. Report the implied subset extensions whenever the supersets are | |
| 418 | - | * detected (see https://github.com/riscv/riscv-isa-manual/pull/3070). | |
| 419 | - | */ | |
| 420 | - | static const unsigned int riscv_zfh_exts[] = { | |
| 421 | - | RISCV_ISA_EXT_ZFHMIN | |
| 422 | - | }; | |
| 423 | - | ||
| 424 | - | static const unsigned int riscv_zvfh_exts[] = { | |
| 425 | - | RISCV_ISA_EXT_ZVFHMIN | |
| 426 | - | }; | |
| 427 | - | ||
| 428 | 415 | #define RISCV_ISA_EXT_ZVE64F_IMPLY_LIST \ | |
| 429 | 416 | RISCV_ISA_EXT_ZVE64X, \ | |
| 430 | 417 | RISCV_ISA_EXT_ZVE32F, \ | |
| @@ -563,8 +550,7 @@ const struct riscv_isa_ext_data riscv_isa_ext[] = { | |||
| 563 | 550 | __RISCV_ISA_EXT_DATA(zawrs, RISCV_ISA_EXT_ZAWRS), | |
| 564 | 551 | __RISCV_ISA_EXT_DATA_VALIDATE(zfa, RISCV_ISA_EXT_ZFA, riscv_ext_f_depends), | |
| 565 | 552 | __RISCV_ISA_EXT_DATA_VALIDATE(zfbfmin, RISCV_ISA_EXT_ZFBFMIN, riscv_ext_f_depends), | |
| 566 | - | __RISCV_ISA_EXT_SUPERSET_VALIDATE(zfh, RISCV_ISA_EXT_ZFH, | |
| 567 | - | riscv_zfh_exts, riscv_ext_f_depends), | |
| 553 | + | __RISCV_ISA_EXT_DATA_VALIDATE(zfh, RISCV_ISA_EXT_ZFH, riscv_ext_f_depends), | |
| 568 | 554 | __RISCV_ISA_EXT_DATA_VALIDATE(zfhmin, RISCV_ISA_EXT_ZFHMIN, riscv_ext_f_depends), | |
| 569 | 555 | __RISCV_ISA_EXT_DATA(zca, RISCV_ISA_EXT_ZCA), | |
| 570 | 556 | __RISCV_ISA_EXT_DATA_VALIDATE(zcb, RISCV_ISA_EXT_ZCB, riscv_ext_zca_depends), | |
| @@ -600,9 +586,7 @@ const struct riscv_isa_ext_data riscv_isa_ext[] = { | |||
| 600 | 586 | __RISCV_ISA_EXT_SUPERSET_VALIDATE(zve64x, RISCV_ISA_EXT_ZVE64X, riscv_zve64x_exts, riscv_ext_vector_x_validate), | |
| 601 | 587 | __RISCV_ISA_EXT_DATA_VALIDATE(zvfbfmin, RISCV_ISA_EXT_ZVFBFMIN, riscv_vector_f_validate), | |
| 602 | 588 | __RISCV_ISA_EXT_DATA_VALIDATE(zvfbfwma, RISCV_ISA_EXT_ZVFBFWMA, riscv_ext_zvfbfwma_validate), | |
| 603 | - | __RISCV_ISA_EXT_SUPERSET_VALIDATE(zvfh, RISCV_ISA_EXT_ZVFH, | |
| 604 | - | riscv_zvfh_exts, | |
| 605 | - | riscv_ext_vector_float_validate), | |
| 589 | + | __RISCV_ISA_EXT_DATA(zvfh, RISCV_ISA_EXT_ZVFH), | |
| 606 | 590 | __RISCV_ISA_EXT_DATA(zvfhmin, RISCV_ISA_EXT_ZVFHMIN), | |
| 607 | 591 | __RISCV_ISA_EXT_DATA_VALIDATE(zvkb, RISCV_ISA_EXT_ZVKB, riscv_ext_vector_crypto_validate), | |
| 608 | 592 | __RISCV_ISA_EXT_DATA_VALIDATE(zvkg, RISCV_ISA_EXT_ZVKG, riscv_ext_vector_crypto_validate), | |
| @@ -1233,18 +1217,6 @@ void __init riscv_user_isa_enable(void) | |||
| 1233 | 1217 | pr_warn("Zicbop disabled as it is unavailable on some harts\n"); | |
| 1234 | 1218 | } | |
| 1235 | 1219 | ||
| 1236 | - | void riscv_clear_hypervisor_csr(void) | |
| 1237 | - | { | |
| 1238 | - | if (!riscv_has_extension_unlikely(RISCV_ISA_EXT_H)) | |
| 1239 | - | return; | |
| 1240 | - | ||
| 1241 | - | /* | |
| 1242 | - | * Clear HSTATUS.HU to restrict hypervisor instructions to HS-mode. | |
| 1243 | - | * This prevents user-mode from executing HLV/HSV instructions. | |
| 1244 | - | */ | |
| 1245 | - | csr_clear(CSR_HSTATUS, HSTATUS_HU); | |
| 1246 | - | } | |
| 1247 | - | ||
| 1248 | 1220 | #ifdef CONFIG_RISCV_ALTERNATIVE | |
| 1249 | 1221 | /* | |
| 1250 | 1222 | * Alternative patch sites consider 48 bits when determining when to patch | |
modified arch/riscv/kernel/entry.S
| @@ -208,7 +208,7 @@ SYM_CODE_START(handle_exception) | |||
| 208 | 208 | load_global_pointer | |
| 209 | 209 | ||
| 210 | 210 | /* Load the kernel shadow call stack pointer if coming from userspace */ | |
| 211 | - | scs_load_current_if_from_user s1, s5 | |
| 211 | + | scs_load_current_if_task_changed s5 | |
| 212 | 212 | ||
| 213 | 213 | #ifdef CONFIG_RISCV_ISA_V_PREEMPTIVE | |
| 214 | 214 | move a0, sp | |
modified arch/riscv/kernel/patch.c
| @@ -45,10 +45,8 @@ static __always_inline void *patch_map(void *addr, const unsigned int fixmap) | |||
| 45 | 45 | phys_addr_t phys; | |
| 46 | 46 | ||
| 47 | 47 | if (core_kernel_text(uintaddr) || is_kernel_exittext(uintaddr)) { | |
| 48 | - | if (!IS_ENABLED(CONFIG_STRICT_KERNEL_RWX)) | |
| 49 | - | return addr; | |
| 50 | 48 | phys = __pa_symbol(addr); | |
| 51 | - | } else if (IS_ENABLED(CONFIG_EXECMEM)) { | |
| 49 | + | } else if (IS_ENABLED(CONFIG_STRICT_MODULE_RWX)) { | |
| 52 | 50 | struct page *page = vmalloc_to_page(addr); | |
| 53 | 51 | ||
| 54 | 52 | BUG_ON(!page); | |
modified arch/riscv/kernel/process.c
| @@ -349,8 +349,10 @@ long set_tagged_addr_ctrl(struct task_struct *task, unsigned long arg) | |||
| 349 | 349 | if (arg & PR_TAGGED_ADDR_ENABLE && (tagged_addr_disabled || !pmlen)) | |
| 350 | 350 | return -EINVAL; | |
| 351 | 351 | ||
| 352 | - | if (!(arg & PR_TAGGED_ADDR_ENABLE)) | |
| 352 | + | if (!(arg & PR_TAGGED_ADDR_ENABLE)) { | |
| 353 | 353 | pmlen = PMLEN_0; | |
| 354 | + | pmm = ENVCFG_PMM_PMLEN_0; | |
| 355 | + | } | |
| 354 | 356 | ||
| 355 | 357 | if (mmap_write_lock_killable(mm)) | |
| 356 | 358 | return -EINTR; | |
modified arch/riscv/kernel/ptrace.c
| @@ -230,7 +230,6 @@ static int riscv_vr_set(struct task_struct *target, | |||
| 230 | 230 | return -ENODATA; | |
| 231 | 231 | ||
| 232 | 232 | /* Copy rest of the vstate except datap */ | |
| 233 | - | memset(&ptrace_vstate, 0, sizeof(ptrace_vstate)); | |
| 234 | 233 | ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &ptrace_vstate, 0, | |
| 235 | 234 | sizeof(struct __riscv_v_regset_state)); | |
| 236 | 235 | if (unlikely(ret)) | |
| @@ -300,9 +299,6 @@ static int riscv_cfi_get(struct task_struct *target, | |||
| 300 | 299 | struct user_cfi_state user_cfi; | |
| 301 | 300 | struct pt_regs *regs; | |
| 302 | 301 | ||
| 303 | - | if (!is_user_lpad_enabled() && !is_user_shstk_enabled()) | |
| 304 | - | return -EINVAL; | |
| 305 | - | ||
| 306 | 302 | memset(&user_cfi, 0, sizeof(user_cfi)); | |
| 307 | 303 | regs = task_pt_regs(target); | |
| 308 | 304 | ||
| @@ -341,12 +337,8 @@ static int riscv_cfi_set(struct task_struct *target, | |||
| 341 | 337 | struct user_cfi_state user_cfi; | |
| 342 | 338 | struct pt_regs *regs; | |
| 343 | 339 | ||
| 344 | - | if (!is_user_lpad_enabled() && !is_user_shstk_enabled()) | |
| 345 | - | return -EINVAL; | |
| 346 | - | ||
| 347 | 340 | regs = task_pt_regs(target); | |
| 348 | 341 | ||
| 349 | - | memset(&user_cfi, 0, sizeof(user_cfi)); | |
| 350 | 342 | ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &user_cfi, 0, -1); | |
| 351 | 343 | if (ret) | |
| 352 | 344 | return ret; | |
modified arch/riscv/kernel/setup.c
| @@ -366,8 +366,6 @@ void __init setup_arch(char **cmdline_p) | |||
| 366 | 366 | ||
| 367 | 367 | if (!IS_ENABLED(CONFIG_RISCV_ISA_ZBB) || !riscv_isa_extension_available(NULL, ZBB)) | |
| 368 | 368 | static_branch_disable(&efficient_ffs_key); | |
| 369 | - | ||
| 370 | - | riscv_clear_hypervisor_csr(); | |
| 371 | 369 | } | |
| 372 | 370 | ||
| 373 | 371 | bool arch_cpu_is_hotpluggable(int cpu) | |
modified arch/riscv/kernel/smpboot.c
| @@ -244,8 +244,6 @@ asmlinkage __visible void smp_callin(void) | |||
| 244 | 244 | ||
| 245 | 245 | numa_add_cpu(curr_cpuid); | |
| 246 | 246 | ||
| 247 | - | riscv_clear_hypervisor_csr(); | |
| 248 | - | ||
| 249 | 247 | pr_debug("CPU%u: Booted secondary hartid %lu\n", curr_cpuid, | |
| 250 | 248 | cpuid_to_hartid_map(curr_cpuid)); | |
| 251 | 249 | ||
modified arch/riscv/kernel/suspend.c
| @@ -43,8 +43,6 @@ void suspend_save_csrs(struct suspend_context *context) | |||
| 43 | 43 | ||
| 44 | 44 | void suspend_restore_csrs(struct suspend_context *context) | |
| 45 | 45 | { | |
| 46 | - | riscv_clear_hypervisor_csr(); | |
| 47 | - | ||
| 48 | 46 | csr_write(CSR_SCRATCH, 0); | |
| 49 | 47 | if (riscv_has_extension_unlikely(RISCV_ISA_EXT_XLINUXENVCFG)) | |
| 50 | 48 | csr_write(CSR_ENVCFG, context->envcfg); | |
modified arch/riscv/kernel/sys_hwprobe.c
| @@ -297,8 +297,6 @@ static u64 hwprobe_vec_misaligned(const struct cpumask *cpus) | |||
| 297 | 297 | static void hwprobe_one_pair(struct riscv_hwprobe *pair, | |
| 298 | 298 | const struct cpumask *cpus) | |
| 299 | 299 | { | |
| 300 | - | pair->value = 0; | |
| 301 | - | ||
| 302 | 300 | switch (pair->key) { | |
| 303 | 301 | case RISCV_HWPROBE_KEY_MVENDORID: | |
| 304 | 302 | case RISCV_HWPROBE_KEY_MARCHID: | |
| @@ -333,14 +331,17 @@ static void hwprobe_one_pair(struct riscv_hwprobe *pair, | |||
| 333 | 331 | break; | |
| 334 | 332 | ||
| 335 | 333 | case RISCV_HWPROBE_KEY_ZICBOZ_BLOCK_SIZE: | |
| 334 | + | pair->value = 0; | |
| 336 | 335 | if (hwprobe_ext0_has(cpus, RISCV_HWPROBE_EXT_ZICBOZ)) | |
| 337 | 336 | pair->value = riscv_cboz_block_size; | |
| 338 | 337 | break; | |
| 339 | 338 | case RISCV_HWPROBE_KEY_ZICBOM_BLOCK_SIZE: | |
| 339 | + | pair->value = 0; | |
| 340 | 340 | if (hwprobe_ext0_has(cpus, RISCV_HWPROBE_EXT_ZICBOM)) | |
| 341 | 341 | pair->value = riscv_cbom_block_size; | |
| 342 | 342 | break; | |
| 343 | 343 | case RISCV_HWPROBE_KEY_ZICBOP_BLOCK_SIZE: | |
| 344 | + | pair->value = 0; | |
| 344 | 345 | if (hwprobe_ext0_has(cpus, RISCV_HWPROBE_EXT_ZICBOP)) | |
| 345 | 346 | pair->value = riscv_cbop_block_size; | |
| 346 | 347 | break; | |
modified arch/riscv/kernel/usercfi.c
| @@ -525,8 +525,9 @@ static int __init setup_global_riscv_enable(char *str) | |||
| 525 | 525 | ||
| 526 | 526 | if (riscv_nousercfi) | |
| 527 | 527 | pr_info("RISC-V user CFI disabled via cmdline - shadow stack status : %s, landing pad status : %s\n", | |
| 528 | - | str_disabled_enabled(riscv_nousercfi & CMDLINE_DISABLE_RISCV_USERCFI_BCFI), | |
| 529 | - | str_disabled_enabled(riscv_nousercfi & CMDLINE_DISABLE_RISCV_USERCFI_FCFI)); | |
| 528 | + | (riscv_nousercfi & CMDLINE_DISABLE_RISCV_USERCFI_BCFI) ? "disabled" : | |
| 529 | + | "enabled", (riscv_nousercfi & CMDLINE_DISABLE_RISCV_USERCFI_FCFI) ? | |
| 530 | + | "disabled" : "enabled"); | |
| 530 | 531 | ||
| 531 | 532 | return 1; | |
| 532 | 533 | } | |
modified arch/riscv/kernel/vdso/Makefile
| @@ -36,7 +36,6 @@ endif | |||
| 36 | 36 | ccflags-y := -fno-stack-protector | |
| 37 | 37 | ccflags-y += -DDISABLE_BRANCH_PROFILING | |
| 38 | 38 | ccflags-y += -fno-builtin | |
| 39 | - | ccflags-y += $(CONFIG_CC_OPT_INLINE_MEMSET) | |
| 40 | 39 | ccflags-y += $(KBUILD_BASE_ISA)$(CFI_MARCH) | |
| 41 | 40 | ccflags-y += $(CFI_FULL) | |
| 42 | 41 | asflags-y += $(KBUILD_BASE_ISA)$(CFI_MARCH) | |
modified arch/riscv/kvm/aia_device.c
| @@ -237,7 +237,7 @@ static int aia_init(struct kvm *kvm) | |||
| 237 | 237 | return -EBUSY; | |
| 238 | 238 | ||
| 239 | 239 | /* We might be in the middle of creating a VCPU? */ | |
| 240 | - | if (kvm_is_vcpu_creation_in_progress(kvm)) | |
| 240 | + | if (kvm->created_vcpus != atomic_read(&kvm->online_vcpus)) | |
| 241 | 241 | return -EBUSY; | |
| 242 | 242 | ||
| 243 | 243 | /* Number of sources should be less than or equals number of IDs */ | |
modified arch/riscv/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; | |
| @@ -512,8 +503,8 @@ int kvm_riscv_vcpu_pmu_event_info(struct kvm_vcpu *vcpu, unsigned long saddr_low | |||
| 512 | 503 | } | |
| 513 | 504 | } | |
| 514 | 505 | ||
| 515 | - | einfo = kvzalloc_objs(*einfo, num_events, | |
| 516 | - | GFP_KERNEL_ACCOUNT | __GFP_NOWARN); | |
| 506 | + | einfo = kvcalloc(num_events, sizeof(*einfo), | |
| 507 | + | GFP_KERNEL_ACCOUNT | __GFP_NOWARN); | |
| 517 | 508 | if (!einfo) { | |
| 518 | 509 | ret = SBI_ERR_FAILURE; | |
| 519 | 510 | goto out; | |
| @@ -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/riscv/lib/strnlen.S
| @@ -87,25 +87,9 @@ strnlen_zbb: | |||
| 87 | 87 | * Aligned boundary. Use the address of the last valid byte | |
| 88 | 88 | * (s + count - 1) to avoid loading a word past the count | |
| 89 | 89 | * boundary in the loop below. count == 0 is handled above. | |
| 90 | - | * | |
| 91 | - | * Saturate the boundary when s + count would wrap around (very | |
| 92 | - | * large counts, e.g. SIZE_MAX passed by FORTIFY strcat/strlcat | |
| 93 | - | * with a destination whose size is unknown at compile time). | |
| 94 | - | * Without this, the wrapped boundary lands before s and the | |
| 95 | - | * pre-loop guard below always exits, returning a truncated | |
| 96 | - | * length. | |
| 97 | - | * | |
| 98 | - | * Clamping the increment to ~s (== SIZE_MAX - s) keeps the | |
| 99 | - | * computation branchless and wrap-free: | |
| 100 | - | * | |
| 101 | - | * s + min(count - 1, ~s) == saturating_add(s, count - 1) | |
| 102 | - | * | |
| 103 | - | * Saturating makes the scan equivalent to strlen(). | |
| 104 | 90 | */ | |
| 105 | - | addi t4, a1, -1 /* count - 1 */ | |
| 106 | - | not t1, a0 /* SIZE_MAX - s */ | |
| 107 | - | minu t4, t4, t1 /* clamp, so s + t4 can never wrap */ | |
| 108 | - | add t4, a0, t4 /* saturated s + count - 1 */ | |
| 91 | + | add t4, a0, a1 | |
| 92 | + | addi t4, t4, -1 | |
| 109 | 93 | andi t4, t4, -SZREG | |
| 110 | 94 | ||
| 111 | 95 | /* Get the first word. */ | |
modified arch/riscv/lib/uaccess.S
| @@ -76,7 +76,6 @@ SYM_FUNC_START(fallback_scalar_usercopy_sum_enabled) | |||
| 76 | 76 | li a3, 9*SZREG-1 /* size must >= (word_copy stride + SZREG-1) */ | |
| 77 | 77 | bltu a2, a3, .Lbyte_copy_tail | |
| 78 | 78 | ||
| 79 | - | #if !defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) | |
| 80 | 79 | /* | |
| 81 | 80 | * Copy first bytes until dst is aligned to word boundary. | |
| 82 | 81 | * a0 - start of dst | |
| @@ -104,7 +103,7 @@ SYM_FUNC_START(fallback_scalar_usercopy_sum_enabled) | |||
| 104 | 103 | /* a1 - start of src */ | |
| 105 | 104 | andi a3, a1, SZREG-1 | |
| 106 | 105 | bnez a3, .Lshift_copy | |
| 107 | - | #endif | |
| 106 | + | ||
| 108 | 107 | .Lword_copy: | |
| 109 | 108 | /* | |
| 110 | 109 | * Both src and dst are aligned, unrolled word copy | |
| @@ -138,7 +137,6 @@ SYM_FUNC_START(fallback_scalar_usercopy_sum_enabled) | |||
| 138 | 137 | addi t0, t0, 8*SZREG /* revert to original value */ | |
| 139 | 138 | j .Lbyte_copy_tail | |
| 140 | 139 | ||
| 141 | - | #if !defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) | |
| 142 | 140 | .Lshift_copy: | |
| 143 | 141 | ||
| 144 | 142 | /* | |
| @@ -191,7 +189,6 @@ SYM_FUNC_START(fallback_scalar_usercopy_sum_enabled) | |||
| 191 | 189 | ||
| 192 | 190 | /* Revert src to original unaligned value */ | |
| 193 | 191 | add a1, a1, a3 | |
| 194 | - | #endif | |
| 195 | 192 | ||
| 196 | 193 | .Lbyte_copy_tail: | |
| 197 | 194 | /* | |
modified arch/riscv/mm/extable.c
| @@ -68,8 +68,8 @@ ex_handler_load_unaligned_zeropad(const struct exception_table_entry *ex, | |||
| 68 | 68 | ||
| 69 | 69 | addr = regs_get_gpr(regs, reg_addr * sizeof(unsigned long)); | |
| 70 | 70 | ||
| 71 | - | offset = addr & (sizeof(data) - 1); | |
| 72 | - | addr &= ~(sizeof(data) - 1); | |
| 71 | + | offset = addr & 0x7UL; | |
| 72 | + | addr &= ~0x7UL; | |
| 73 | 73 | ||
| 74 | 74 | data = *(unsigned long *)addr >> (offset * 8); | |
| 75 | 75 | ||
modified arch/riscv/mm/init.c
| @@ -1465,9 +1465,7 @@ struct execmem_info __init *execmem_arch_setup(void) | |||
| 1465 | 1465 | [EXECMEM_KPROBES] = { | |
| 1466 | 1466 | .start = VMALLOC_START, | |
| 1467 | 1467 | .end = VMALLOC_END, | |
| 1468 | - | .pgprot = IS_ENABLED(CONFIG_STRICT_MODULE_RWX) ? | |
| 1469 | - | PAGE_KERNEL_READ_EXEC : | |
| 1470 | - | PAGE_KERNEL_EXEC, | |
| 1468 | + | .pgprot = PAGE_KERNEL_READ_EXEC, | |
| 1471 | 1469 | .alignment = 1, | |
| 1472 | 1470 | }, | |
| 1473 | 1471 | [EXECMEM_BPF] = { | |
modified arch/riscv/net/bpf_jit_comp64.c
| @@ -822,24 +822,6 @@ static int gen_jump_or_nops(void *target, void *ip, u32 *insns, bool is_call) | |||
| 822 | 822 | return emit_jump_and_link(is_call ? RV_REG_T0 : RV_REG_ZERO, rvoff, false, &ctx); | |
| 823 | 823 | } | |
| 824 | 824 | ||
| 825 | - | int arch_bpf_trampoline_skip(void *nop, void *target) | |
| 826 | - | { | |
| 827 | - | u32 old_insn = rv_nop(); | |
| 828 | - | u32 new_insn = rv_jal(RV_REG_ZERO, (target - nop) >> 1); | |
| 829 | - | int ret; | |
| 830 | - | ||
| 831 | - | if (memcmp(nop, &old_insn, sizeof(old_insn))) | |
| 832 | - | return -EFAULT; | |
| 833 | - | ||
| 834 | - | cpus_read_lock(); | |
| 835 | - | mutex_lock(&text_mutex); | |
| 836 | - | ret = patch_text(nop, &new_insn, sizeof(new_insn)); | |
| 837 | - | mutex_unlock(&text_mutex); | |
| 838 | - | cpus_read_unlock(); | |
| 839 | - | ||
| 840 | - | return ret; | |
| 841 | - | } | |
| 842 | - | ||
| 843 | 825 | int bpf_arch_text_poke(void *ip, enum bpf_text_poke_type old_t, | |
| 844 | 826 | enum bpf_text_poke_type new_t, void *old_addr, | |
| 845 | 827 | void *new_addr) | |
| @@ -922,17 +904,12 @@ static void emit_store_stack_imm64(u8 reg, int stack_off, u64 imm64, | |||
| 922 | 904 | emit_sd(RV_REG_FP, stack_off, reg, ctx); | |
| 923 | 905 | } | |
| 924 | 906 | ||
| 925 | - | static int invoke_bpf_prog(struct bpf_tramp_image *im, struct bpf_tramp_node *node, | |
| 926 | - | int args_off, int retval_off, int run_ctx_off, bool save_ret, | |
| 927 | - | struct rv_jit_context *ctx) | |
| 907 | + | static int invoke_bpf_prog(struct bpf_tramp_node *node, int args_off, int retval_off, | |
| 908 | + | int run_ctx_off, bool save_ret, struct rv_jit_context *ctx) | |
| 928 | 909 | { | |
| 929 | 910 | int ret, branch_off; | |
| 930 | 911 | struct bpf_prog *p = node->link->prog; | |
| 931 | 912 | int cookie_off = offsetof(struct bpf_tramp_run_ctx, bpf_cookie); | |
| 932 | - | void *skip = ctx->ro_insns + ctx->ninsns; | |
| 933 | - | ||
| 934 | - | /* nop, patched to a jal over this prog when it is detached */ | |
| 935 | - | emit(rv_nop(), ctx); | |
| 936 | 913 | ||
| 937 | 914 | if (node->cookie) | |
| 938 | 915 | emit_store_stack_imm64(RV_REG_T1, -run_ctx_off + cookie_off, node->cookie, ctx); | |
| @@ -985,17 +962,13 @@ static int invoke_bpf_prog(struct bpf_tramp_image *im, struct bpf_tramp_node *no | |||
| 985 | 962 | /* arg3: &run_ctx */ | |
| 986 | 963 | emit_addi(RV_REG_A2, RV_REG_FP, -run_ctx_off, ctx); | |
| 987 | 964 | ret = emit_call((const u64)bpf_trampoline_exit(p), true, ctx); | |
| 988 | - | if (ret) | |
| 989 | - | return ret; | |
| 990 | 965 | ||
| 991 | - | bpf_tramp_image_add_skip(im, p, skip, ctx->ro_insns + ctx->ninsns); | |
| 992 | - | return 0; | |
| 966 | + | return ret; | |
| 993 | 967 | } | |
| 994 | 968 | ||
| 995 | - | static int invoke_bpf(struct bpf_tramp_image *im, struct bpf_tramp_nodes *tn, | |
| 996 | - | int args_off, int retval_off, int run_ctx_off, int func_meta_off, | |
| 997 | - | bool save_ret, u64 func_meta, int cookie_off, | |
| 998 | - | struct rv_jit_context *ctx) | |
| 969 | + | static int invoke_bpf(struct bpf_tramp_nodes *tn, int args_off, int retval_off, | |
| 970 | + | int run_ctx_off, int func_meta_off, bool save_ret, u64 func_meta, | |
| 971 | + | int cookie_off, struct rv_jit_context *ctx) | |
| 999 | 972 | { | |
| 1000 | 973 | int i, cur_cookie = (cookie_off - args_off) / 8; | |
| 1001 | 974 | ||
| @@ -1008,8 +981,8 @@ static int invoke_bpf(struct bpf_tramp_image *im, struct bpf_tramp_nodes *tn, | |||
| 1008 | 981 | emit_store_stack_imm64(RV_REG_T1, -func_meta_off, meta, ctx); | |
| 1009 | 982 | cur_cookie--; | |
| 1010 | 983 | } | |
| 1011 | - | err = invoke_bpf_prog(im, tn->nodes[i], args_off, retval_off, | |
| 1012 | - | run_ctx_off, save_ret, ctx); | |
| 984 | + | err = invoke_bpf_prog(tn->nodes[i], args_off, retval_off, run_ctx_off, | |
| 985 | + | save_ret, ctx); | |
| 1013 | 986 | if (err) | |
| 1014 | 987 | return err; | |
| 1015 | 988 | } | |
| @@ -1197,7 +1170,7 @@ static int __arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, | |||
| 1197 | 1170 | } | |
| 1198 | 1171 | ||
| 1199 | 1172 | if (fentry->nr_nodes) { | |
| 1200 | - | ret = invoke_bpf(im, fentry, args_off, retval_off, run_ctx_off, func_meta_off, | |
| 1173 | + | ret = invoke_bpf(fentry, args_off, retval_off, run_ctx_off, func_meta_off, | |
| 1201 | 1174 | flags & BPF_TRAMP_F_RET_FENTRY_RET, func_meta, cookie_off, ctx); | |
| 1202 | 1175 | if (ret) | |
| 1203 | 1176 | return ret; | |
| @@ -1211,7 +1184,7 @@ static int __arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, | |||
| 1211 | 1184 | /* cleanup to avoid garbage return value confusion */ | |
| 1212 | 1185 | emit_sd(RV_REG_FP, -retval_off, RV_REG_ZERO, ctx); | |
| 1213 | 1186 | for (i = 0; i < fmod_ret->nr_nodes; i++) { | |
| 1214 | - | ret = invoke_bpf_prog(im, fmod_ret->nodes[i], args_off, retval_off, | |
| 1187 | + | ret = invoke_bpf_prog(fmod_ret->nodes[i], args_off, retval_off, | |
| 1215 | 1188 | run_ctx_off, true, ctx); | |
| 1216 | 1189 | if (ret) | |
| 1217 | 1190 | goto out; | |
| @@ -1238,6 +1211,10 @@ static int __arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, | |||
| 1238 | 1211 | emit_sd(RV_REG_FP, -tcc_off, RV_REG_TCC, ctx); | |
| 1239 | 1212 | emit_sd(RV_REG_FP, -retval_off, RV_REG_A0, ctx); | |
| 1240 | 1213 | emit_sd(RV_REG_FP, -(retval_off - 8), regmap[BPF_REG_0], ctx); | |
| 1214 | + | im->ip_after_call = ctx->ro_insns + ctx->ninsns; | |
| 1215 | + | /* 2 nops reserved for auipc+jalr pair */ | |
| 1216 | + | emit(rv_nop(), ctx); | |
| 1217 | + | emit(rv_nop(), ctx); | |
| 1241 | 1218 | } | |
| 1242 | 1219 | ||
| 1243 | 1220 | /* update branches saved in invoke_bpf_mod_ret with bnez */ | |
| @@ -1253,13 +1230,14 @@ static int __arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, | |||
| 1253 | 1230 | emit_store_stack_imm64(RV_REG_T1, -func_meta_off, func_meta, ctx); | |
| 1254 | 1231 | ||
| 1255 | 1232 | if (fexit->nr_nodes) { | |
| 1256 | - | ret = invoke_bpf(im, fexit, args_off, retval_off, run_ctx_off, func_meta_off, | |
| 1233 | + | ret = invoke_bpf(fexit, args_off, retval_off, run_ctx_off, func_meta_off, | |
| 1257 | 1234 | false, func_meta, cookie_off, ctx); | |
| 1258 | 1235 | if (ret) | |
| 1259 | 1236 | goto out; | |
| 1260 | 1237 | } | |
| 1261 | 1238 | ||
| 1262 | 1239 | if (flags & BPF_TRAMP_F_CALL_ORIG) { | |
| 1240 | + | im->ip_epilogue = ctx->ro_insns + ctx->ninsns; | |
| 1263 | 1241 | emit_imm(RV_REG_A0, ctx->insns ? (const s64)im : RV_MAX_COUNT_IMM, ctx); | |
| 1264 | 1242 | ret = emit_call((const u64)__bpf_tramp_exit, true, ctx); | |
| 1265 | 1243 | if (ret) | |
| @@ -1321,7 +1299,7 @@ out: | |||
| 1321 | 1299 | int arch_bpf_trampoline_size(const struct btf_func_model *m, u32 flags, | |
| 1322 | 1300 | struct bpf_tramp_nodes *tnodes, void *func_addr) | |
| 1323 | 1301 | { | |
| 1324 | - | struct bpf_tramp_image im = {}; | |
| 1302 | + | struct bpf_tramp_image im; | |
| 1325 | 1303 | struct rv_jit_context ctx; | |
| 1326 | 1304 | int ret; | |
| 1327 | 1305 | ||
| @@ -2150,15 +2128,7 @@ bool bpf_jit_supports_ptr_xchg(void) | |||
| 2150 | 2128 | ||
| 2151 | 2129 | bool bpf_jit_supports_arena(void) | |
| 2152 | 2130 | { | |
| 2153 | - | /* | |
| 2154 | - | * The arena range tree uses kmalloc_nolock(), which needs | |
| 2155 | - | * cmpxchg128, provided by ZACAS on riscv. | |
| 2156 | - | */ | |
| 2157 | - | #ifdef system_has_cmpxchg128 | |
| 2158 | - | return system_has_cmpxchg128(); | |
| 2159 | - | #else | |
| 2160 | - | return false; | |
| 2161 | - | #endif | |
| 2131 | + | return true; | |
| 2162 | 2132 | } | |
| 2163 | 2133 | ||
| 2164 | 2134 | bool bpf_jit_supports_insn(struct bpf_insn *insn, bool in_arena) | |
modified arch/s390/boot/alternative.c
| @@ -45,12 +45,11 @@ static void alt_debug_modify(int type, unsigned int nr, bool clear) | |||
| 45 | 45 | ||
| 46 | 46 | static char *alt_debug_parse(int type, char *str) | |
| 47 | 47 | { | |
| 48 | - | unsigned long val, endval, limit; | |
| 48 | + | unsigned long val, endval; | |
| 49 | 49 | char *endp; | |
| 50 | 50 | bool clear; | |
| 51 | 51 | int i; | |
| 52 | 52 | ||
| 53 | - | limit = type == ALT_TYPE_FACILITY ? MAX_FACILITY_BIT : MAX_MFEATURE_BIT; | |
| 54 | 53 | if (*str == ':') { | |
| 55 | 54 | str++; | |
| 56 | 55 | } else { | |
| @@ -74,7 +73,7 @@ static char *alt_debug_parse(int type, char *str) | |||
| 74 | 73 | if (str == endp) | |
| 75 | 74 | break; | |
| 76 | 75 | str = endp; | |
| 77 | - | while (val <= endval && val < limit) { | |
| 76 | + | while (val <= endval) { | |
| 78 | 77 | alt_debug_modify(type, val, clear); | |
| 79 | 78 | val++; | |
| 80 | 79 | } | |
modified arch/s390/boot/ipl_parm.c
| @@ -23,7 +23,6 @@ struct parmarea parmarea __section(".parmarea") = { | |||
| 23 | 23 | }; | |
| 24 | 24 | ||
| 25 | 25 | char __bootdata(early_command_line)[COMMAND_LINE_SIZE]; | |
| 26 | - | static char command_line_buf[COMMAND_LINE_SIZE]; | |
| 27 | 26 | ||
| 28 | 27 | unsigned int __bootdata_preserved(zlib_dfltcc_support) = ZLIB_DFLTCC_FULL; | |
| 29 | 28 | struct ipl_parameter_block __bootdata_preserved(ipl_block); | |
| @@ -136,29 +135,31 @@ out: | |||
| 136 | 135 | ||
| 137 | 136 | static void append_ipl_block_parm(void) | |
| 138 | 137 | { | |
| 139 | - | size_t len, extra = 0; | |
| 140 | - | char *delim; | |
| 138 | + | char *parm, *delim; | |
| 139 | + | size_t len, rc = 0; | |
| 141 | 140 | ||
| 142 | 141 | len = strlen(early_command_line); | |
| 143 | - | delim = early_command_line + len; /* '\0' character position */ | |
| 142 | + | ||
| 143 | + | delim = early_command_line + len; /* '\0' character position */ | |
| 144 | + | parm = early_command_line + len + 1; /* append right after '\0' */ | |
| 144 | 145 | ||
| 145 | 146 | switch (ipl_block.pb0_hdr.pbt) { | |
| 146 | 147 | case IPL_PBT_CCW: | |
| 147 | - | extra = ipl_block_get_ascii_vmparm(command_line_buf, sizeof(command_line_buf), &ipl_block); | |
| 148 | + | rc = ipl_block_get_ascii_vmparm( | |
| 149 | + | parm, COMMAND_LINE_SIZE - len - 1, &ipl_block); | |
| 148 | 150 | break; | |
| 149 | 151 | case IPL_PBT_FCP: | |
| 150 | 152 | case IPL_PBT_NVME: | |
| 151 | 153 | case IPL_PBT_ECKD: | |
| 152 | - | extra = ipl_block_get_ascii_scpdata(command_line_buf, sizeof(command_line_buf), &ipl_block); | |
| 154 | + | rc = ipl_block_get_ascii_scpdata( | |
| 155 | + | parm, COMMAND_LINE_SIZE - len - 1, &ipl_block); | |
| 153 | 156 | break; | |
| 154 | 157 | } | |
| 155 | - | if (extra) { | |
| 156 | - | if (command_line_buf[0] == '=') { | |
| 157 | - | memmove(early_command_line, command_line_buf + 1, extra); | |
| 158 | - | } else if (len < COMMAND_LINE_SIZE - 2) { | |
| 158 | + | if (rc) { | |
| 159 | + | if (*parm == '=') | |
| 160 | + | memmove(early_command_line, parm + 1, rc); | |
| 161 | + | else | |
| 159 | 162 | *delim = ' '; /* replace '\0' with space */ | |
| 160 | - | sized_strscpy(delim + 1, command_line_buf, COMMAND_LINE_SIZE - len - 1); | |
| 161 | - | } | |
| 162 | 163 | } | |
| 163 | 164 | } | |
| 164 | 165 | ||
| @@ -230,7 +231,7 @@ static void modify_fac_list(char *str) | |||
| 230 | 231 | if (str == endp) | |
| 231 | 232 | break; | |
| 232 | 233 | str = endp; | |
| 233 | - | while (val <= endval && val < MAX_FACILITY_BIT) { | |
| 234 | + | while (val <= endval) { | |
| 234 | 235 | modify_facility(val, clear); | |
| 235 | 236 | val++; | |
| 236 | 237 | } | |
| @@ -244,6 +245,7 @@ static void modify_fac_list(char *str) | |||
| 244 | 245 | check_cleared_facilities(); | |
| 245 | 246 | } | |
| 246 | 247 | ||
| 248 | + | static char command_line_buf[COMMAND_LINE_SIZE]; | |
| 247 | 249 | void parse_boot_command_line(void) | |
| 248 | 250 | { | |
| 249 | 251 | char *param, *val; | |
modified arch/s390/boot/physmem_info.c
| @@ -141,7 +141,7 @@ static int tprot(unsigned long addr) | |||
| 141 | 141 | ||
| 142 | 142 | static unsigned long search_mem_end(void) | |
| 143 | 143 | { | |
| 144 | - | unsigned long range = 1UL << (MAX_PHYSMEM_BITS - 20); /* in 1MB blocks */ | |
| 144 | + | unsigned long range = 1 << (MAX_PHYSMEM_BITS - 20); /* in 1MB blocks */ | |
| 145 | 145 | unsigned long offset = 0; | |
| 146 | 146 | unsigned long pivot; | |
| 147 | 147 | ||
modified arch/s390/crypto/Makefile
| @@ -3,8 +3,6 @@ | |||
| 3 | 3 | # Cryptographic API | |
| 4 | 4 | # | |
| 5 | 5 | ||
| 6 | - | CONTEXT_ANALYSIS := y | |
| 7 | - | ||
| 8 | 6 | obj-$(CONFIG_CRYPTO_AES_S390) += aes_s390.o | |
| 9 | 7 | obj-$(CONFIG_CRYPTO_PAES_S390) += paes_s390.o | |
| 10 | 8 | obj-$(CONFIG_S390_PRNG) += prng.o | |
modified arch/s390/crypto/aes_s390.c
| @@ -26,14 +26,14 @@ | |||
| 26 | 26 | #include <linux/module.h> | |
| 27 | 27 | #include <linux/cpufeature.h> | |
| 28 | 28 | #include <linux/init.h> | |
| 29 | + | #include <linux/mutex.h> | |
| 29 | 30 | #include <linux/fips.h> | |
| 30 | - | #include <linux/semaphore.h> | |
| 31 | 31 | #include <linux/string.h> | |
| 32 | 32 | #include <crypto/xts.h> | |
| 33 | 33 | #include <asm/cpacf.h> | |
| 34 | 34 | ||
| 35 | 35 | static u8 *ctrblk; | |
| 36 | - | static DEFINE_SEMAPHORE(ctrblk_sem, 1); | |
| 36 | + | static DEFINE_MUTEX(ctrblk_lock); | |
| 37 | 37 | ||
| 38 | 38 | static cpacf_mask_t km_functions, kmc_functions, kmctr_functions, | |
| 39 | 39 | kma_functions; | |
| @@ -129,7 +129,7 @@ static int ecb_aes_crypt(struct skcipher_request *req, unsigned long modifier) | |||
| 129 | 129 | return fallback_skcipher_crypt(sctx, req, modifier); | |
| 130 | 130 | ||
| 131 | 131 | ret = skcipher_walk_virt(&walk, req, false); | |
| 132 | - | while (!ret && ((nbytes = walk.nbytes) != 0)) { | |
| 132 | + | while ((nbytes = walk.nbytes) != 0) { | |
| 133 | 133 | /* only use complete blocks */ | |
| 134 | 134 | n = nbytes & ~(AES_BLOCK_SIZE - 1); | |
| 135 | 135 | cpacf_km(sctx->fc | modifier, sctx->key, | |
| @@ -233,7 +233,7 @@ static int cbc_aes_crypt(struct skcipher_request *req, unsigned long modifier) | |||
| 233 | 233 | return ret; | |
| 234 | 234 | memcpy(param.iv, walk.iv, AES_BLOCK_SIZE); | |
| 235 | 235 | memcpy(param.key, sctx->key, sctx->key_len); | |
| 236 | - | while (!ret && ((nbytes = walk.nbytes) != 0)) { | |
| 236 | + | while ((nbytes = walk.nbytes) != 0) { | |
| 237 | 237 | /* only use complete blocks */ | |
| 238 | 238 | n = nbytes & ~(AES_BLOCK_SIZE - 1); | |
| 239 | 239 | cpacf_kmc(sctx->fc | modifier, ¶m, | |
| @@ -359,7 +359,7 @@ static int xts_aes_crypt(struct skcipher_request *req, unsigned long modifier) | |||
| 359 | 359 | memcpy(xts_param.key + offset, xts_ctx->key, xts_ctx->key_len); | |
| 360 | 360 | memcpy(xts_param.init, pcc_param.xts, 16); | |
| 361 | 361 | ||
| 362 | - | while (!ret && ((nbytes = walk.nbytes) != 0)) { | |
| 362 | + | while ((nbytes = walk.nbytes) != 0) { | |
| 363 | 363 | /* only use complete blocks */ | |
| 364 | 364 | n = nbytes & ~(AES_BLOCK_SIZE - 1); | |
| 365 | 365 | cpacf_km(xts_ctx->fc | modifier, xts_param.key + offset, | |
| @@ -487,7 +487,7 @@ static int fullxts_aes_crypt(struct skcipher_request *req, unsigned long modifi | |||
| 487 | 487 | memcpy(fxts_param.tweak, req->iv, AES_BLOCK_SIZE); | |
| 488 | 488 | fxts_param.nap[0] = 0x01; /* initial alpha power (1, little-endian) */ | |
| 489 | 489 | ||
| 490 | - | while (!ret && ((nbytes = walk.nbytes) != 0)) { | |
| 490 | + | while ((nbytes = walk.nbytes) != 0) { | |
| 491 | 491 | /* only use complete blocks */ | |
| 492 | 492 | n = nbytes & ~(AES_BLOCK_SIZE - 1); | |
| 493 | 493 | cpacf_km(xts_ctx->fc | modifier, fxts_param.key + offset, | |
| @@ -562,64 +562,48 @@ static unsigned int __ctrblk_init(u8 *ctrptr, u8 *iv, unsigned int nbytes) | |||
| 562 | 562 | return n; | |
| 563 | 563 | } | |
| 564 | 564 | ||
| 565 | - | static int __ctr_aes_crypt(struct s390_aes_ctx *sctx, | |
| 566 | - | struct skcipher_walk *walk, bool locked) | |
| 567 | - | { | |
| 568 | - | unsigned int n, nbytes; | |
| 569 | - | int ret = 0; | |
| 570 | - | u8 *ctrptr; | |
| 571 | - | ||
| 572 | - | while (!ret && ((nbytes = walk->nbytes) >= AES_BLOCK_SIZE)) { | |
| 573 | - | n = AES_BLOCK_SIZE; | |
| 574 | - | if (nbytes >= 2 * AES_BLOCK_SIZE && locked) | |
| 575 | - | n = __ctrblk_init(ctrblk, walk->iv, nbytes); | |
| 576 | - | ctrptr = (n > AES_BLOCK_SIZE) ? ctrblk : walk->iv; | |
| 577 | - | cpacf_kmctr(sctx->fc, sctx->key, walk->dst.virt.addr, | |
| 578 | - | walk->src.virt.addr, n, ctrptr); | |
| 579 | - | if (ctrptr == ctrblk) | |
| 580 | - | memcpy(walk->iv, ctrptr + n - AES_BLOCK_SIZE, | |
| 581 | - | AES_BLOCK_SIZE); | |
| 582 | - | crypto_inc(walk->iv, AES_BLOCK_SIZE); | |
| 583 | - | ret = skcipher_walk_done(walk, nbytes - n); | |
| 584 | - | } | |
| 585 | - | ||
| 586 | - | return ret; | |
| 587 | - | } | |
| 588 | - | ||
| 589 | 565 | static int ctr_aes_crypt(struct skcipher_request *req) | |
| 590 | 566 | { | |
| 591 | 567 | struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req); | |
| 592 | 568 | struct s390_aes_ctx *sctx = crypto_skcipher_ctx(tfm); | |
| 569 | + | u8 buf[AES_BLOCK_SIZE], *ctrptr; | |
| 593 | 570 | struct skcipher_walk walk; | |
| 594 | - | u8 buf[AES_BLOCK_SIZE]; | |
| 595 | - | int ret; | |
| 571 | + | unsigned int n, nbytes; | |
| 572 | + | int ret, locked; | |
| 596 | 573 | ||
| 597 | 574 | if (unlikely(!sctx->fc)) | |
| 598 | 575 | return fallback_skcipher_crypt(sctx, req, 0); | |
| 599 | 576 | ||
| 577 | + | locked = mutex_trylock(&ctrblk_lock); | |
| 578 | + | ||
| 600 | 579 | ret = skcipher_walk_virt(&walk, req, false); | |
| 601 | - | if (ret) | |
| 602 | - | return ret; | |
| 580 | + | while ((nbytes = walk.nbytes) >= AES_BLOCK_SIZE) { | |
| 581 | + | n = AES_BLOCK_SIZE; | |
| 603 | 582 | ||
| 604 | - | if (down_trylock(&ctrblk_sem) == 0) { | |
| 605 | - | ret = __ctr_aes_crypt(sctx, &walk, true); | |
| 606 | - | up(&ctrblk_sem); | |
| 607 | - | } else { | |
| 608 | - | ret = __ctr_aes_crypt(sctx, &walk, false); | |
| 583 | + | if (nbytes >= 2*AES_BLOCK_SIZE && locked) | |
| 584 | + | n = __ctrblk_init(ctrblk, walk.iv, nbytes); | |
| 585 | + | ctrptr = (n > AES_BLOCK_SIZE) ? ctrblk : walk.iv; | |
| 586 | + | cpacf_kmctr(sctx->fc, sctx->key, walk.dst.virt.addr, | |
| 587 | + | walk.src.virt.addr, n, ctrptr); | |
| 588 | + | if (ctrptr == ctrblk) | |
| 589 | + | memcpy(walk.iv, ctrptr + n - AES_BLOCK_SIZE, | |
| 590 | + | AES_BLOCK_SIZE); | |
| 591 | + | crypto_inc(walk.iv, AES_BLOCK_SIZE); | |
| 592 | + | ret = skcipher_walk_done(&walk, nbytes - n); | |
| 609 | 593 | } | |
| 610 | - | ||
| 594 | + | if (locked) | |
| 595 | + | mutex_unlock(&ctrblk_lock); | |
| 611 | 596 | /* | |
| 612 | 597 | * final block may be < AES_BLOCK_SIZE, copy only nbytes | |
| 613 | 598 | */ | |
| 614 | - | if (!ret && walk.nbytes > 0) { | |
| 599 | + | if (nbytes) { | |
| 615 | 600 | memset(buf, 0, AES_BLOCK_SIZE); | |
| 616 | - | memcpy(buf, walk.src.virt.addr, walk.nbytes); | |
| 601 | + | memcpy(buf, walk.src.virt.addr, nbytes); | |
| 617 | 602 | cpacf_kmctr(sctx->fc, sctx->key, buf, buf, | |
| 618 | 603 | AES_BLOCK_SIZE, walk.iv); | |
| 619 | - | memcpy(walk.dst.virt.addr, buf, walk.nbytes); | |
| 604 | + | memcpy(walk.dst.virt.addr, buf, nbytes); | |
| 620 | 605 | crypto_inc(walk.iv, AES_BLOCK_SIZE); | |
| 621 | 606 | ret = skcipher_walk_done(&walk, 0); | |
| 622 | - | memzero_explicit(buf, sizeof(buf)); | |
| 623 | 607 | } | |
| 624 | 608 | ||
| 625 | 609 | return ret; | |
| @@ -911,14 +895,10 @@ static int gcm_aes_crypt(struct aead_request *req, unsigned int flags) | |||
| 911 | 895 | gw_in.ptr, aad_bytes); | |
| 912 | 896 | ||
| 913 | 897 | n = aad_bytes + pc_bytes; | |
| 914 | - | if (gcm_in_walk_done(&gw_in, n) != n) { | |
| 915 | - | ret = -ENOMEM; | |
| 916 | - | goto out; | |
| 917 | - | } | |
| 918 | - | if (gcm_out_walk_done(&gw_out, n) != n) { | |
| 919 | - | ret = -ENOMEM; | |
| 920 | - | goto out; | |
| 921 | - | } | |
| 898 | + | if (gcm_in_walk_done(&gw_in, n) != n) | |
| 899 | + | return -ENOMEM; | |
| 900 | + | if (gcm_out_walk_done(&gw_out, n) != n) | |
| 901 | + | return -ENOMEM; | |
| 922 | 902 | aadlen -= aad_bytes; | |
| 923 | 903 | pclen -= pc_bytes; | |
| 924 | 904 | } while (aadlen + pclen > 0); | |
| @@ -930,10 +910,7 @@ static int gcm_aes_crypt(struct aead_request *req, unsigned int flags) | |||
| 930 | 910 | } else | |
| 931 | 911 | scatterwalk_map_and_copy(param.t, req->dst, len, taglen, 1); | |
| 932 | 912 | ||
| 933 | - | out: | |
| 934 | 913 | memzero_explicit(¶m, sizeof(param)); | |
| 935 | - | memzero_explicit(gw_in.buf, sizeof(gw_in.buf)); | |
| 936 | - | memzero_explicit(gw_out.buf, sizeof(gw_out.buf)); | |
| 937 | 914 | return ret; | |
| 938 | 915 | } | |
| 939 | 916 | ||
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/crypto/paes_s390.c
| @@ -19,7 +19,7 @@ | |||
| 19 | 19 | #include <linux/init.h> | |
| 20 | 20 | #include <linux/miscdevice.h> | |
| 21 | 21 | #include <linux/module.h> | |
| 22 | - | #include <linux/semaphore.h> | |
| 22 | + | #include <linux/mutex.h> | |
| 23 | 23 | #include <linux/spinlock.h> | |
| 24 | 24 | #include <crypto/aes.h> | |
| 25 | 25 | #include <crypto/algapi.h> | |
| @@ -45,7 +45,7 @@ module_param_named(clrkey, pkey_clrkey_allowed, bool, 0444); | |||
| 45 | 45 | MODULE_PARM_DESC(clrkey, "Allow clear key material (default N)"); | |
| 46 | 46 | ||
| 47 | 47 | static u8 *ctrblk; | |
| 48 | - | static DEFINE_SEMAPHORE(ctrblk_sem, 1); | |
| 48 | + | static DEFINE_MUTEX(ctrblk_lock); | |
| 49 | 49 | ||
| 50 | 50 | static cpacf_mask_t km_functions, kmc_functions, kmctr_functions; | |
| 51 | 51 | ||
| @@ -220,10 +220,6 @@ static inline int convert_key(const u8 *key, unsigned int keylen, | |||
| 220 | 220 | xflags); | |
| 221 | 221 | } | |
| 222 | 222 | ||
| 223 | - | /* But finally map -EBUSY to -EIO to indicate an IO failure */ | |
| 224 | - | if (rc == -EBUSY) | |
| 225 | - | rc = -EIO; | |
| 226 | - | ||
| 227 | 223 | out: | |
| 228 | 224 | pr_debug("rc=%d\n", rc); | |
| 229 | 225 | return rc; | |
| @@ -436,11 +432,8 @@ static int ecb_paes_do_crypt(struct s390_paes_ctx *ctx, | |||
| 436 | 432 | n = nbytes & ~(AES_BLOCK_SIZE - 1); | |
| 437 | 433 | k = cpacf_km(ctx->fc | req_ctx->modifier, param, | |
| 438 | 434 | walk->dst.virt.addr, walk->src.virt.addr, n); | |
| 439 | - | if (k) { | |
| 435 | + | if (k) | |
| 440 | 436 | rc = skcipher_walk_done(walk, nbytes - k); | |
| 441 | - | if (rc) | |
| 442 | - | goto out; | |
| 443 | - | } | |
| 444 | 437 | if (k < n) { | |
| 445 | 438 | if (!maysleep) { | |
| 446 | 439 | rc = -EKEYEXPIRED; | |
| @@ -467,7 +460,6 @@ static int ecb_paes_crypt(struct skcipher_request *req, unsigned long modifier) | |||
| 467 | 460 | struct s390_paes_ctx *ctx = crypto_skcipher_ctx(tfm); | |
| 468 | 461 | struct skcipher_walk *walk = &req_ctx->walk; | |
| 469 | 462 | bool tested = crypto_skcipher_tested(tfm); | |
| 470 | - | bool cleanup = true; | |
| 471 | 463 | int rc; | |
| 472 | 464 | ||
| 473 | 465 | /* | |
| @@ -499,17 +491,15 @@ static int ecb_paes_crypt(struct skcipher_request *req, unsigned long modifier) | |||
| 499 | 491 | if (rc == 0 || rc == -EKEYEXPIRED) { | |
| 500 | 492 | atomic_inc(&ctx->via_engine_ctr); | |
| 501 | 493 | rc = crypto_transfer_skcipher_request_to_engine(paes_crypto_engine, req); | |
| 502 | - | if (rc == -EINPROGRESS || rc == -EBUSY) | |
| 503 | - | cleanup = false; | |
| 504 | - | else | |
| 494 | + | if (rc != -EINPROGRESS) | |
| 505 | 495 | atomic_dec(&ctx->via_engine_ctr); | |
| 506 | 496 | } | |
| 507 | 497 | ||
| 508 | - | if (cleanup && walk->nbytes) | |
| 498 | + | if (rc != -EINPROGRESS) | |
| 509 | 499 | skcipher_walk_done(walk, rc); | |
| 510 | 500 | ||
| 511 | 501 | out: | |
| 512 | - | if (cleanup) | |
| 502 | + | if (rc != -EINPROGRESS) | |
| 513 | 503 | memzero_explicit(&req_ctx->param, sizeof(req_ctx->param)); | |
| 514 | 504 | pr_debug("rc=%d\n", rc); | |
| 515 | 505 | return rc; | |
| @@ -559,7 +549,7 @@ static int ecb_paes_do_one_request(struct crypto_engine *engine, void *areq) | |||
| 559 | 549 | rc = ecb_paes_do_crypt(ctx, req_ctx, tested, true); | |
| 560 | 550 | if (rc == -EKEYEXPIRED) { | |
| 561 | 551 | return pkey_handle_expired(); | |
| 562 | - | } else if (rc && walk->nbytes) { | |
| 552 | + | } else if (rc) { | |
| 563 | 553 | skcipher_walk_done(walk, rc); | |
| 564 | 554 | } | |
| 565 | 555 | ||
| @@ -569,7 +559,7 @@ static int ecb_paes_do_one_request(struct crypto_engine *engine, void *areq) | |||
| 569 | 559 | atomic_dec(&ctx->via_engine_ctr); | |
| 570 | 560 | crypto_finalize_skcipher_request(engine, req, rc); | |
| 571 | 561 | local_bh_enable(); | |
| 572 | - | return 0; | |
| 562 | + | return rc; | |
| 573 | 563 | } | |
| 574 | 564 | ||
| 575 | 565 | static struct skcipher_engine_alg ecb_paes_alg = { | |
| @@ -577,7 +567,6 @@ static struct skcipher_engine_alg ecb_paes_alg = { | |||
| 577 | 567 | .base.cra_name = "ecb(paes)", | |
| 578 | 568 | .base.cra_driver_name = "ecb-paes-s390", | |
| 579 | 569 | .base.cra_priority = 401, /* combo: aes + ecb + 1 */ | |
| 580 | - | .base.cra_flags = CRYPTO_ALG_ASYNC | CRYPTO_ALG_NO_FALLBACK, | |
| 581 | 570 | .base.cra_blocksize = AES_BLOCK_SIZE, | |
| 582 | 571 | .base.cra_ctxsize = sizeof(struct s390_paes_ctx), | |
| 583 | 572 | .base.cra_module = THIS_MODULE, | |
| @@ -701,8 +690,6 @@ static int cbc_paes_do_crypt(struct s390_paes_ctx *ctx, | |||
| 701 | 690 | if (k) { | |
| 702 | 691 | memcpy(walk->iv, param->iv, AES_BLOCK_SIZE); | |
| 703 | 692 | rc = skcipher_walk_done(walk, nbytes - k); | |
| 704 | - | if (rc) | |
| 705 | - | goto out; | |
| 706 | 693 | } | |
| 707 | 694 | if (k < n) { | |
| 708 | 695 | if (!maysleep) { | |
| @@ -730,7 +717,6 @@ static int cbc_paes_crypt(struct skcipher_request *req, unsigned long modifier) | |||
| 730 | 717 | struct s390_paes_ctx *ctx = crypto_skcipher_ctx(tfm); | |
| 731 | 718 | struct skcipher_walk *walk = &req_ctx->walk; | |
| 732 | 719 | bool tested = crypto_skcipher_tested(tfm); | |
| 733 | - | bool cleanup = true; | |
| 734 | 720 | int rc; | |
| 735 | 721 | ||
| 736 | 722 | /* | |
| @@ -762,17 +748,15 @@ static int cbc_paes_crypt(struct skcipher_request *req, unsigned long modifier) | |||
| 762 | 748 | if (rc == 0 || rc == -EKEYEXPIRED) { | |
| 763 | 749 | atomic_inc(&ctx->via_engine_ctr); | |
| 764 | 750 | rc = crypto_transfer_skcipher_request_to_engine(paes_crypto_engine, req); | |
| 765 | - | if (rc == -EINPROGRESS || rc == -EBUSY) | |
| 766 | - | cleanup = false; | |
| 767 | - | else | |
| 751 | + | if (rc != -EINPROGRESS) | |
| 768 | 752 | atomic_dec(&ctx->via_engine_ctr); | |
| 769 | 753 | } | |
| 770 | 754 | ||
| 771 | - | if (cleanup && walk->nbytes) | |
| 755 | + | if (rc != -EINPROGRESS) | |
| 772 | 756 | skcipher_walk_done(walk, rc); | |
| 773 | 757 | ||
| 774 | 758 | out: | |
| 775 | - | if (cleanup) | |
| 759 | + | if (rc != -EINPROGRESS) | |
| 776 | 760 | memzero_explicit(&req_ctx->param, sizeof(req_ctx->param)); | |
| 777 | 761 | pr_debug("rc=%d\n", rc); | |
| 778 | 762 | return rc; | |
| @@ -822,7 +806,7 @@ static int cbc_paes_do_one_request(struct crypto_engine *engine, void *areq) | |||
| 822 | 806 | rc = cbc_paes_do_crypt(ctx, req_ctx, tested, true); | |
| 823 | 807 | if (rc == -EKEYEXPIRED) { | |
| 824 | 808 | return pkey_handle_expired(); | |
| 825 | - | } else if (rc && walk->nbytes) { | |
| 809 | + | } else if (rc) { | |
| 826 | 810 | skcipher_walk_done(walk, rc); | |
| 827 | 811 | } | |
| 828 | 812 | ||
| @@ -832,7 +816,7 @@ static int cbc_paes_do_one_request(struct crypto_engine *engine, void *areq) | |||
| 832 | 816 | atomic_dec(&ctx->via_engine_ctr); | |
| 833 | 817 | crypto_finalize_skcipher_request(engine, req, rc); | |
| 834 | 818 | local_bh_enable(); | |
| 835 | - | return 0; | |
| 819 | + | return rc; | |
| 836 | 820 | } | |
| 837 | 821 | ||
| 838 | 822 | static struct skcipher_engine_alg cbc_paes_alg = { | |
| @@ -840,7 +824,6 @@ static struct skcipher_engine_alg cbc_paes_alg = { | |||
| 840 | 824 | .base.cra_name = "cbc(paes)", | |
| 841 | 825 | .base.cra_driver_name = "cbc-paes-s390", | |
| 842 | 826 | .base.cra_priority = 402, /* cbc-paes-s390 + 1 */ | |
| 843 | - | .base.cra_flags = CRYPTO_ALG_ASYNC | CRYPTO_ALG_NO_FALLBACK, | |
| 844 | 827 | .base.cra_blocksize = AES_BLOCK_SIZE, | |
| 845 | 828 | .base.cra_ctxsize = sizeof(struct s390_paes_ctx), | |
| 846 | 829 | .base.cra_module = THIS_MODULE, | |
| @@ -931,14 +914,41 @@ static inline unsigned int __ctrblk_init(u8 *ctrptr, u8 *iv, unsigned int nbytes | |||
| 931 | 914 | return n; | |
| 932 | 915 | } | |
| 933 | 916 | ||
| 934 | - | static int __ctr_paes_do_crypt(struct s390_paes_ctx *ctx, | |
| 935 | - | struct ctr_param *param, | |
| 936 | - | struct skcipher_walk *walk, | |
| 937 | - | bool tested, bool maysleep, bool locked) | |
| 917 | + | static int ctr_paes_do_crypt(struct s390_paes_ctx *ctx, | |
| 918 | + | struct s390_pctr_req_ctx *req_ctx, | |
| 919 | + | bool tested, bool maysleep) | |
| 938 | 920 | { | |
| 921 | + | struct ctr_param *param = &req_ctx->param; | |
| 922 | + | struct skcipher_walk *walk = &req_ctx->walk; | |
| 923 | + | u8 buf[AES_BLOCK_SIZE], *ctrptr; | |
| 939 | 924 | unsigned int nbytes, n, k; | |
| 940 | - | u8 *ctrptr; | |
| 941 | - | int rc = 0; | |
| 925 | + | int pk_state, locked, rc = 0; | |
| 926 | + | ||
| 927 | + | if (!req_ctx->param_init_done) { | |
| 928 | + | /* fetch and check protected key state */ | |
| 929 | + | spin_lock_bh(&ctx->pk_lock); | |
| 930 | + | pk_state = ctx->pk_state; | |
| 931 | + | switch (pk_state) { | |
| 932 | + | case PK_STATE_NO_KEY: | |
| 933 | + | rc = -ENOKEY; | |
| 934 | + | break; | |
| 935 | + | case PK_STATE_CONVERT_IN_PROGRESS: | |
| 936 | + | rc = -EKEYEXPIRED; | |
| 937 | + | break; | |
| 938 | + | case PK_STATE_VALID: | |
| 939 | + | memcpy(param->key, ctx->pk.protkey, sizeof(param->key)); | |
| 940 | + | req_ctx->param_init_done = true; | |
| 941 | + | break; | |
| 942 | + | default: | |
| 943 | + | rc = pk_state < 0 ? pk_state : -EIO; | |
| 944 | + | break; | |
| 945 | + | } | |
| 946 | + | spin_unlock_bh(&ctx->pk_lock); | |
| 947 | + | } | |
| 948 | + | if (rc) | |
| 949 | + | goto out; | |
| 950 | + | ||
| 951 | + | locked = mutex_trylock(&ctrblk_lock); | |
| 942 | 952 | ||
| 943 | 953 | /* | |
| 944 | 954 | * Note that in case of partial processing or failure the walk | |
| @@ -958,71 +968,32 @@ static int __ctr_paes_do_crypt(struct s390_paes_ctx *ctx, | |||
| 958 | 968 | AES_BLOCK_SIZE); | |
| 959 | 969 | crypto_inc(walk->iv, AES_BLOCK_SIZE); | |
| 960 | 970 | rc = skcipher_walk_done(walk, nbytes - k); | |
| 961 | - | if (rc) | |
| 962 | - | goto out; | |
| 963 | 971 | } | |
| 964 | 972 | if (k < n) { | |
| 965 | 973 | if (!maysleep) { | |
| 974 | + | if (locked) | |
| 975 | + | mutex_unlock(&ctrblk_lock); | |
| 966 | 976 | rc = -EKEYEXPIRED; | |
| 967 | 977 | goto out; | |
| 968 | 978 | } | |
| 969 | 979 | rc = paes_convert_key(ctx, tested); | |
| 970 | - | if (rc) | |
| 980 | + | if (rc) { | |
| 981 | + | if (locked) | |
| 982 | + | mutex_unlock(&ctrblk_lock); | |
| 971 | 983 | goto out; | |
| 984 | + | } | |
| 972 | 985 | spin_lock_bh(&ctx->pk_lock); | |
| 973 | 986 | memcpy(param->key, ctx->pk.protkey, sizeof(param->key)); | |
| 974 | 987 | spin_unlock_bh(&ctx->pk_lock); | |
| 975 | 988 | } | |
| 976 | 989 | } | |
| 977 | - | ||
| 978 | - | out: | |
| 979 | - | return rc; | |
| 980 | - | } | |
| 981 | - | ||
| 982 | - | static int ctr_paes_do_crypt(struct s390_paes_ctx *ctx, | |
| 983 | - | struct s390_pctr_req_ctx *req_ctx, | |
| 984 | - | bool tested, bool maysleep) | |
| 985 | - | { | |
| 986 | - | struct ctr_param *param = &req_ctx->param; | |
| 987 | - | struct skcipher_walk *walk = &req_ctx->walk; | |
| 988 | - | u8 buf[AES_BLOCK_SIZE]; | |
| 989 | - | int pk_state, rc = 0; | |
| 990 | - | ||
| 991 | - | if (!req_ctx->param_init_done) { | |
| 992 | - | /* fetch and check protected key state */ | |
| 993 | - | spin_lock_bh(&ctx->pk_lock); | |
| 994 | - | pk_state = ctx->pk_state; | |
| 995 | - | switch (pk_state) { | |
| 996 | - | case PK_STATE_NO_KEY: | |
| 997 | - | rc = -ENOKEY; | |
| 998 | - | break; | |
| 999 | - | case PK_STATE_CONVERT_IN_PROGRESS: | |
| 1000 | - | rc = -EKEYEXPIRED; | |
| 1001 | - | break; | |
| 1002 | - | case PK_STATE_VALID: | |
| 1003 | - | memcpy(param->key, ctx->pk.protkey, sizeof(param->key)); | |
| 1004 | - | req_ctx->param_init_done = true; | |
| 1005 | - | break; | |
| 1006 | - | default: | |
| 1007 | - | rc = pk_state < 0 ? pk_state : -EIO; | |
| 1008 | - | break; | |
| 1009 | - | } | |
| 1010 | - | spin_unlock_bh(&ctx->pk_lock); | |
| 1011 | - | } | |
| 1012 | - | if (rc) | |
| 1013 | - | goto out; | |
| 1014 | - | ||
| 1015 | - | if (down_trylock(&ctrblk_sem) == 0) { | |
| 1016 | - | rc = __ctr_paes_do_crypt(ctx, param, walk, tested, maysleep, true); | |
| 1017 | - | up(&ctrblk_sem); | |
| 1018 | - | } else { | |
| 1019 | - | rc = __ctr_paes_do_crypt(ctx, param, walk, tested, maysleep, false); | |
| 1020 | - | } | |
| 990 | + | if (locked) | |
| 991 | + | mutex_unlock(&ctrblk_lock); | |
| 1021 | 992 | ||
| 1022 | 993 | /* final block may be < AES_BLOCK_SIZE, copy only nbytes */ | |
| 1023 | - | if (!rc && walk->nbytes > 0) { | |
| 994 | + | if (nbytes) { | |
| 1024 | 995 | memset(buf, 0, AES_BLOCK_SIZE); | |
| 1025 | - | memcpy(buf, walk->src.virt.addr, walk->nbytes); | |
| 996 | + | memcpy(buf, walk->src.virt.addr, nbytes); | |
| 1026 | 997 | while (1) { | |
| 1027 | 998 | if (cpacf_kmctr(ctx->fc, param, buf, | |
| 1028 | 999 | buf, AES_BLOCK_SIZE, | |
| @@ -1039,13 +1010,12 @@ static int ctr_paes_do_crypt(struct s390_paes_ctx *ctx, | |||
| 1039 | 1010 | memcpy(param->key, ctx->pk.protkey, sizeof(param->key)); | |
| 1040 | 1011 | spin_unlock_bh(&ctx->pk_lock); | |
| 1041 | 1012 | } | |
| 1042 | - | memcpy(walk->dst.virt.addr, buf, walk->nbytes); | |
| 1013 | + | memcpy(walk->dst.virt.addr, buf, nbytes); | |
| 1043 | 1014 | crypto_inc(walk->iv, AES_BLOCK_SIZE); | |
| 1044 | 1015 | rc = skcipher_walk_done(walk, 0); | |
| 1045 | 1016 | } | |
| 1046 | 1017 | ||
| 1047 | 1018 | out: | |
| 1048 | - | memzero_explicit(buf, sizeof(buf)); | |
| 1049 | 1019 | pr_debug("rc=%d\n", rc); | |
| 1050 | 1020 | return rc; | |
| 1051 | 1021 | } | |
| @@ -1057,7 +1027,6 @@ static int ctr_paes_crypt(struct skcipher_request *req) | |||
| 1057 | 1027 | struct s390_paes_ctx *ctx = crypto_skcipher_ctx(tfm); | |
| 1058 | 1028 | struct skcipher_walk *walk = &req_ctx->walk; | |
| 1059 | 1029 | bool tested = crypto_skcipher_tested(tfm); | |
| 1060 | - | bool cleanup = true; | |
| 1061 | 1030 | int rc; | |
| 1062 | 1031 | ||
| 1063 | 1032 | /* | |
| @@ -1088,17 +1057,15 @@ static int ctr_paes_crypt(struct skcipher_request *req) | |||
| 1088 | 1057 | if (rc == 0 || rc == -EKEYEXPIRED) { | |
| 1089 | 1058 | atomic_inc(&ctx->via_engine_ctr); | |
| 1090 | 1059 | rc = crypto_transfer_skcipher_request_to_engine(paes_crypto_engine, req); | |
| 1091 | - | if (rc == -EINPROGRESS || rc == -EBUSY) | |
| 1092 | - | cleanup = false; | |
| 1093 | - | else | |
| 1060 | + | if (rc != -EINPROGRESS) | |
| 1094 | 1061 | atomic_dec(&ctx->via_engine_ctr); | |
| 1095 | 1062 | } | |
| 1096 | 1063 | ||
| 1097 | - | if (cleanup && walk->nbytes) | |
| 1064 | + | if (rc != -EINPROGRESS) | |
| 1098 | 1065 | skcipher_walk_done(walk, rc); | |
| 1099 | 1066 | ||
| 1100 | 1067 | out: | |
| 1101 | - | if (cleanup) | |
| 1068 | + | if (rc != -EINPROGRESS) | |
| 1102 | 1069 | memzero_explicit(&req_ctx->param, sizeof(req_ctx->param)); | |
| 1103 | 1070 | pr_debug("rc=%d\n", rc); | |
| 1104 | 1071 | return rc; | |
| @@ -1138,7 +1105,7 @@ static int ctr_paes_do_one_request(struct crypto_engine *engine, void *areq) | |||
| 1138 | 1105 | rc = ctr_paes_do_crypt(ctx, req_ctx, tested, true); | |
| 1139 | 1106 | if (rc == -EKEYEXPIRED) { | |
| 1140 | 1107 | return pkey_handle_expired(); | |
| 1141 | - | } else if (rc && walk->nbytes) { | |
| 1108 | + | } else if (rc) { | |
| 1142 | 1109 | skcipher_walk_done(walk, rc); | |
| 1143 | 1110 | } | |
| 1144 | 1111 | ||
| @@ -1148,7 +1115,7 @@ static int ctr_paes_do_one_request(struct crypto_engine *engine, void *areq) | |||
| 1148 | 1115 | atomic_dec(&ctx->via_engine_ctr); | |
| 1149 | 1116 | crypto_finalize_skcipher_request(engine, req, rc); | |
| 1150 | 1117 | local_bh_enable(); | |
| 1151 | - | return 0; | |
| 1118 | + | return rc; | |
| 1152 | 1119 | } | |
| 1153 | 1120 | ||
| 1154 | 1121 | static struct skcipher_engine_alg ctr_paes_alg = { | |
| @@ -1156,7 +1123,6 @@ static struct skcipher_engine_alg ctr_paes_alg = { | |||
| 1156 | 1123 | .base.cra_name = "ctr(paes)", | |
| 1157 | 1124 | .base.cra_driver_name = "ctr-paes-s390", | |
| 1158 | 1125 | .base.cra_priority = 402, /* ecb-paes-s390 + 1 */ | |
| 1159 | - | .base.cra_flags = CRYPTO_ALG_ASYNC | CRYPTO_ALG_NO_FALLBACK, | |
| 1160 | 1126 | .base.cra_blocksize = 1, | |
| 1161 | 1127 | .base.cra_ctxsize = sizeof(struct s390_paes_ctx), | |
| 1162 | 1128 | .base.cra_module = THIS_MODULE, | |
| @@ -1317,11 +1283,8 @@ static int xts_paes_do_crypt_fullkey(struct s390_pxts_ctx *ctx, | |||
| 1317 | 1283 | n = nbytes & ~(AES_BLOCK_SIZE - 1); | |
| 1318 | 1284 | k = cpacf_km(ctx->fc | req_ctx->modifier, param->key + offset, | |
| 1319 | 1285 | walk->dst.virt.addr, walk->src.virt.addr, n); | |
| 1320 | - | if (k) { | |
| 1286 | + | if (k) | |
| 1321 | 1287 | rc = skcipher_walk_done(walk, nbytes - k); | |
| 1322 | - | if (rc) | |
| 1323 | - | goto out; | |
| 1324 | - | } | |
| 1325 | 1288 | if (k < n) { | |
| 1326 | 1289 | if (!maysleep) { | |
| 1327 | 1290 | rc = -EKEYEXPIRED; | |
| @@ -1374,7 +1337,7 @@ static inline int __xts_2keys_prep_param(struct s390_pxts_ctx *ctx, | |||
| 1374 | 1337 | memcpy(param->init, pcc_param.xts, 16); | |
| 1375 | 1338 | } | |
| 1376 | 1339 | ||
| 1377 | - | memzero_explicit(&pcc_param, sizeof(pcc_param)); | |
| 1340 | + | memzero_explicit(pcc_param.key, sizeof(pcc_param.key)); | |
| 1378 | 1341 | return rc; | |
| 1379 | 1342 | } | |
| 1380 | 1343 | ||
| @@ -1414,11 +1377,8 @@ static int xts_paes_do_crypt_2keys(struct s390_pxts_ctx *ctx, | |||
| 1414 | 1377 | n = nbytes & ~(AES_BLOCK_SIZE - 1); | |
| 1415 | 1378 | k = cpacf_km(ctx->fc | req_ctx->modifier, param->key + offset, | |
| 1416 | 1379 | walk->dst.virt.addr, walk->src.virt.addr, n); | |
| 1417 | - | if (k) { | |
| 1380 | + | if (k) | |
| 1418 | 1381 | rc = skcipher_walk_done(walk, nbytes - k); | |
| 1419 | - | if (rc) | |
| 1420 | - | goto out; | |
| 1421 | - | } | |
| 1422 | 1382 | if (k < n) { | |
| 1423 | 1383 | if (!maysleep) { | |
| 1424 | 1384 | rc = -EKEYEXPIRED; | |
| @@ -1490,7 +1450,6 @@ static inline int xts_paes_crypt(struct skcipher_request *req, unsigned long mod | |||
| 1490 | 1450 | struct s390_pxts_ctx *ctx = crypto_skcipher_ctx(tfm); | |
| 1491 | 1451 | struct skcipher_walk *walk = &req_ctx->walk; | |
| 1492 | 1452 | bool tested = crypto_skcipher_tested(tfm); | |
| 1493 | - | bool cleanup = true; | |
| 1494 | 1453 | int rc; | |
| 1495 | 1454 | ||
| 1496 | 1455 | /* | |
| @@ -1522,17 +1481,15 @@ static inline int xts_paes_crypt(struct skcipher_request *req, unsigned long mod | |||
| 1522 | 1481 | if (rc == 0 || rc == -EKEYEXPIRED) { | |
| 1523 | 1482 | atomic_inc(&ctx->via_engine_ctr); | |
| 1524 | 1483 | rc = crypto_transfer_skcipher_request_to_engine(paes_crypto_engine, req); | |
| 1525 | - | if (rc == -EINPROGRESS || rc == -EBUSY) | |
| 1526 | - | cleanup = false; | |
| 1527 | - | else | |
| 1484 | + | if (rc != -EINPROGRESS) | |
| 1528 | 1485 | atomic_dec(&ctx->via_engine_ctr); | |
| 1529 | 1486 | } | |
| 1530 | 1487 | ||
| 1531 | - | if (cleanup && walk->nbytes) | |
| 1488 | + | if (rc != -EINPROGRESS) | |
| 1532 | 1489 | skcipher_walk_done(walk, rc); | |
| 1533 | 1490 | ||
| 1534 | 1491 | out: | |
| 1535 | - | if (cleanup) | |
| 1492 | + | if (rc != -EINPROGRESS) | |
| 1536 | 1493 | memzero_explicit(&req_ctx->param, sizeof(req_ctx->param)); | |
| 1537 | 1494 | pr_debug("rc=%d\n", rc); | |
| 1538 | 1495 | return rc; | |
| @@ -1582,7 +1539,7 @@ static int xts_paes_do_one_request(struct crypto_engine *engine, void *areq) | |||
| 1582 | 1539 | rc = xts_paes_do_crypt(ctx, req_ctx, tested, true); | |
| 1583 | 1540 | if (rc == -EKEYEXPIRED) { | |
| 1584 | 1541 | return pkey_handle_expired(); | |
| 1585 | - | } else if (rc && walk->nbytes) { | |
| 1542 | + | } else if (rc) { | |
| 1586 | 1543 | skcipher_walk_done(walk, rc); | |
| 1587 | 1544 | } | |
| 1588 | 1545 | ||
| @@ -1592,7 +1549,7 @@ static int xts_paes_do_one_request(struct crypto_engine *engine, void *areq) | |||
| 1592 | 1549 | atomic_dec(&ctx->via_engine_ctr); | |
| 1593 | 1550 | crypto_finalize_skcipher_request(engine, req, rc); | |
| 1594 | 1551 | local_bh_enable(); | |
| 1595 | - | return 0; | |
| 1552 | + | return rc; | |
| 1596 | 1553 | } | |
| 1597 | 1554 | ||
| 1598 | 1555 | static struct skcipher_engine_alg xts_paes_alg = { | |
| @@ -1600,7 +1557,6 @@ static struct skcipher_engine_alg xts_paes_alg = { | |||
| 1600 | 1557 | .base.cra_name = "xts(paes)", | |
| 1601 | 1558 | .base.cra_driver_name = "xts-paes-s390", | |
| 1602 | 1559 | .base.cra_priority = 402, /* ecb-paes-s390 + 1 */ | |
| 1603 | - | .base.cra_flags = CRYPTO_ALG_ASYNC | CRYPTO_ALG_NO_FALLBACK, | |
| 1604 | 1560 | .base.cra_blocksize = AES_BLOCK_SIZE, | |
| 1605 | 1561 | .base.cra_ctxsize = sizeof(struct s390_pxts_ctx), | |
| 1606 | 1562 | .base.cra_module = THIS_MODULE, | |
modified arch/s390/crypto/phmac_s390.c
| @@ -62,10 +62,8 @@ static inline int hwh_prepare(struct ahash_request *req, | |||
| 62 | 62 | */ | |
| 63 | 63 | static inline int hwh_advance(struct hash_walk_helper *hwh, int n) | |
| 64 | 64 | { | |
| 65 | - | if (n < 0) { | |
| 66 | - | hwh->walkbytes = n; | |
| 65 | + | if (n < 0) | |
| 67 | 66 | return crypto_hash_walk_done(&hwh->walk, n); | |
| 68 | - | } | |
| 69 | 67 | ||
| 70 | 68 | hwh->walkbytes -= n; | |
| 71 | 69 | hwh->walkaddr += n; | |
| @@ -341,10 +339,6 @@ static inline int convert_key(const u8 *key, unsigned int keylen, | |||
| 341 | 339 | xflags); | |
| 342 | 340 | } | |
| 343 | 341 | ||
| 344 | - | /* But finally map -EBUSY to -EIO to indicate an IO failure */ | |
| 345 | - | if (rc == -EBUSY) | |
| 346 | - | rc = -EIO; | |
| 347 | - | ||
| 348 | 342 | out: | |
| 349 | 343 | pr_debug("rc=%d\n", rc); | |
| 350 | 344 | return rc; | |
| @@ -612,7 +606,6 @@ static int phmac_update(struct ahash_request *req) | |||
| 612 | 606 | struct phmac_tfm_ctx *tfm_ctx = crypto_ahash_ctx(tfm); | |
| 613 | 607 | struct kmac_sha2_ctx *kmac_ctx = &req_ctx->kmac_ctx; | |
| 614 | 608 | struct hash_walk_helper *hwh = &req_ctx->hwh; | |
| 615 | - | bool cleanup = true; | |
| 616 | 609 | int rc; | |
| 617 | 610 | ||
| 618 | 611 | /* prep the walk in the request context */ | |
| @@ -636,15 +629,12 @@ static int phmac_update(struct ahash_request *req) | |||
| 636 | 629 | req_ctx->async_op = OP_UPDATE; | |
| 637 | 630 | atomic_inc(&tfm_ctx->via_engine_ctr); | |
| 638 | 631 | rc = crypto_transfer_hash_request_to_engine(phmac_crypto_engine, req); | |
| 639 | - | if (rc == -EINPROGRESS || rc == -EBUSY) | |
| 640 | - | cleanup = false; | |
| 641 | - | else | |
| 632 | + | if (rc != -EINPROGRESS) | |
| 642 | 633 | atomic_dec(&tfm_ctx->via_engine_ctr); | |
| 643 | 634 | } | |
| 644 | 635 | ||
| 645 | - | if (cleanup) { | |
| 646 | - | if (hwh->walkbytes > 0) | |
| 647 | - | hwh_advance(hwh, rc); | |
| 636 | + | if (rc != -EINPROGRESS) { | |
| 637 | + | hwh_advance(hwh, rc); | |
| 648 | 638 | memzero_explicit(kmac_ctx, sizeof(*kmac_ctx)); | |
| 649 | 639 | } | |
| 650 | 640 | ||
| @@ -659,7 +649,6 @@ static int phmac_final(struct ahash_request *req) | |||
| 659 | 649 | struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); | |
| 660 | 650 | struct phmac_tfm_ctx *tfm_ctx = crypto_ahash_ctx(tfm); | |
| 661 | 651 | struct kmac_sha2_ctx *kmac_ctx = &req_ctx->kmac_ctx; | |
| 662 | - | bool cleanup = true; | |
| 663 | 652 | int rc = 0; | |
| 664 | 653 | ||
| 665 | 654 | /* Try synchronous operation if no active engine usage */ | |
| @@ -678,14 +667,12 @@ static int phmac_final(struct ahash_request *req) | |||
| 678 | 667 | req_ctx->async_op = OP_FINAL; | |
| 679 | 668 | atomic_inc(&tfm_ctx->via_engine_ctr); | |
| 680 | 669 | rc = crypto_transfer_hash_request_to_engine(phmac_crypto_engine, req); | |
| 681 | - | if (rc == -EINPROGRESS || rc == -EBUSY) | |
| 682 | - | cleanup = false; | |
| 683 | - | else | |
| 670 | + | if (rc != -EINPROGRESS) | |
| 684 | 671 | atomic_dec(&tfm_ctx->via_engine_ctr); | |
| 685 | 672 | } | |
| 686 | 673 | ||
| 687 | 674 | out: | |
| 688 | - | if (cleanup) | |
| 675 | + | if (rc != -EINPROGRESS) | |
| 689 | 676 | memzero_explicit(kmac_ctx, sizeof(*kmac_ctx)); | |
| 690 | 677 | pr_debug("rc=%d\n", rc); | |
| 691 | 678 | return rc; | |
| @@ -698,7 +685,6 @@ static int phmac_finup(struct ahash_request *req) | |||
| 698 | 685 | struct phmac_tfm_ctx *tfm_ctx = crypto_ahash_ctx(tfm); | |
| 699 | 686 | struct kmac_sha2_ctx *kmac_ctx = &req_ctx->kmac_ctx; | |
| 700 | 687 | struct hash_walk_helper *hwh = &req_ctx->hwh; | |
| 701 | - | bool cleanup = true; | |
| 702 | 688 | int rc; | |
| 703 | 689 | ||
| 704 | 690 | /* prep the walk in the request context */ | |
| @@ -730,17 +716,15 @@ static int phmac_finup(struct ahash_request *req) | |||
| 730 | 716 | /* req->async_op has been set to either OP_FINUP or OP_FINAL */ | |
| 731 | 717 | atomic_inc(&tfm_ctx->via_engine_ctr); | |
| 732 | 718 | rc = crypto_transfer_hash_request_to_engine(phmac_crypto_engine, req); | |
| 733 | - | if (rc == -EINPROGRESS || rc == -EBUSY) | |
| 734 | - | cleanup = false; | |
| 735 | - | else | |
| 719 | + | if (rc != -EINPROGRESS) | |
| 736 | 720 | atomic_dec(&tfm_ctx->via_engine_ctr); | |
| 737 | 721 | } | |
| 738 | 722 | ||
| 739 | - | if (cleanup && hwh->walkbytes > 0) | |
| 723 | + | if (rc != -EINPROGRESS) | |
| 740 | 724 | hwh_advance(hwh, rc); | |
| 741 | 725 | ||
| 742 | 726 | out: | |
| 743 | - | if (cleanup) | |
| 727 | + | if (rc != -EINPROGRESS) | |
| 744 | 728 | memzero_explicit(kmac_ctx, sizeof(*kmac_ctx)); | |
| 745 | 729 | pr_debug("rc=%d\n", rc); | |
| 746 | 730 | return rc; | |
| @@ -930,7 +914,7 @@ out: | |||
| 930 | 914 | atomic_dec(&tfm_ctx->via_engine_ctr); | |
| 931 | 915 | crypto_finalize_hash_request(engine, req, rc); | |
| 932 | 916 | local_bh_enable(); | |
| 933 | - | return 0; | |
| 917 | + | return rc; | |
| 934 | 918 | } | |
| 935 | 919 | ||
| 936 | 920 | #define S390_ASYNC_PHMAC_ALG(x) \ | |
modified arch/s390/include/asm/cpacf.h
| @@ -301,7 +301,6 @@ static __always_inline void __cpacf_query(unsigned int opcode, | |||
| 301 | 301 | cpacf_mask_t *mask) | |
| 302 | 302 | { | |
| 303 | 303 | __cpacf_query_insn(opcode, mask, CPACF_FC_QUERY); | |
| 304 | - | kmsan_unpoison_memory(mask, sizeof(*mask)); | |
| 305 | 304 | } | |
| 306 | 305 | ||
| 307 | 306 | static __always_inline int __cpacf_check_opcode(unsigned int opcode) | |
| @@ -371,7 +370,6 @@ static __always_inline int cpacf_query_func(unsigned int opcode, | |||
| 371 | 370 | static __always_inline void __cpacf_qai(unsigned int opcode, cpacf_qai_t *qai) | |
| 372 | 371 | { | |
| 373 | 372 | __cpacf_query_insn(opcode, qai, CPACF_FC_QUERY_AUTH_INFO); | |
| 374 | - | kmsan_unpoison_memory(qai, sizeof(*qai)); | |
| 375 | 373 | } | |
| 376 | 374 | ||
| 377 | 375 | /** | |
| @@ -424,7 +422,6 @@ static inline int cpacf_km(unsigned long func, void *param, | |||
| 424 | 422 | [opc] "i" (CPACF_KM) | |
| 425 | 423 | : "cc", "memory", "0", "1"); | |
| 426 | 424 | ||
| 427 | - | kmsan_unpoison_memory(dest, src_len - s.odd); | |
| 428 | 425 | return src_len - s.odd; | |
| 429 | 426 | } | |
| 430 | 427 | ||
| @@ -457,7 +454,6 @@ static inline int cpacf_kmc(unsigned long func, void *param, | |||
| 457 | 454 | [opc] "i" (CPACF_KMC) | |
| 458 | 455 | : "cc", "memory", "0", "1"); | |
| 459 | 456 | ||
| 460 | - | kmsan_unpoison_memory(dest, src_len - s.odd); | |
| 461 | 457 | return src_len - s.odd; | |
| 462 | 458 | } | |
| 463 | 459 | ||
| @@ -591,7 +587,6 @@ static inline int cpacf_kmctr(unsigned long func, void *param, u8 *dest, | |||
| 591 | 587 | [opc] "i" (CPACF_KMCTR) | |
| 592 | 588 | : "cc", "memory", "0", "1"); | |
| 593 | 589 | ||
| 594 | - | kmsan_unpoison_memory(dest, src_len - s.odd); | |
| 595 | 590 | return src_len - s.odd; | |
| 596 | 591 | } | |
| 597 | 592 | ||
| @@ -624,7 +619,6 @@ static inline void cpacf_prno(unsigned long func, void *param, | |||
| 624 | 619 | : [fc] "d" (func), [pba] "d" ((unsigned long)param), | |
| 625 | 620 | [seed] "d" (s.pair), [opc] "i" (CPACF_PRNO) | |
| 626 | 621 | : "cc", "memory", "0", "1"); | |
| 627 | - | kmsan_unpoison_memory(dest, dest_len); | |
| 628 | 622 | } | |
| 629 | 623 | ||
| 630 | 624 | /** | |
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/include/asm/pai.h
| @@ -76,6 +76,7 @@ static __always_inline void pai_kernel_exit(struct pt_regs *regs) | |||
| 76 | 76 | } | |
| 77 | 77 | ||
| 78 | 78 | #define PAI_SAVE_AREA(x) ((x)->hw.event_base) | |
| 79 | + | #define PAI_CPU_MASK(x) ((x)->hw.addr_filters) | |
| 79 | 80 | #define PAI_PMU_IDX(x) ((x)->hw.last_tag) | |
| 80 | 81 | #define PAI_SWLIST(x) (&(x)->hw.tp_list) | |
| 81 | 82 | ||
modified arch/s390/include/asm/processor.h
| @@ -46,6 +46,7 @@ struct pcpu { | |||
| 46 | 46 | unsigned long ec_mask; /* bit mask for ec_xxx functions */ | |
| 47 | 47 | unsigned long ec_clk; /* sigp timestamp for ec_xxx */ | |
| 48 | 48 | unsigned long flags; /* per CPU flags */ | |
| 49 | + | unsigned long capacity; /* cpu capacity for scheduler */ | |
| 49 | 50 | signed char state; /* physical cpu state */ | |
| 50 | 51 | signed char polarization; /* physical polarization */ | |
| 51 | 52 | u16 address; /* physical cpu address */ | |
modified arch/s390/include/asm/smp.h
| @@ -30,7 +30,7 @@ static __always_inline unsigned int raw_smp_processor_id(void) | |||
| 30 | 30 | return cpu; | |
| 31 | 31 | } | |
| 32 | 32 | ||
| 33 | - | #define arch_scale_cpu_capacity topology_get_cpu_scale | |
| 33 | + | #define arch_scale_cpu_capacity smp_cpu_get_capacity | |
| 34 | 34 | ||
| 35 | 35 | extern struct mutex smp_cpu_state_mutex; | |
| 36 | 36 | extern unsigned int smp_cpu_mt_shift; | |
| @@ -53,7 +53,9 @@ extern void smp_save_dump_secondary_cpus(void); | |||
| 53 | 53 | extern void smp_yield_cpu(int cpu); | |
| 54 | 54 | extern void smp_cpu_set_polarization(int cpu, int val); | |
| 55 | 55 | extern int smp_cpu_get_polarization(int cpu); | |
| 56 | + | extern void smp_cpu_set_capacity(int cpu, unsigned long val); | |
| 56 | 57 | extern void smp_set_core_capacity(int cpu, unsigned long val); | |
| 58 | + | extern unsigned long smp_cpu_get_capacity(int cpu); | |
| 57 | 59 | extern int smp_cpu_get_cpu_address(int cpu); | |
| 58 | 60 | extern void smp_fill_possible_mask(void); | |
| 59 | 61 | extern void smp_detect_cpus(void); | |
modified arch/s390/kernel/debug.c
| @@ -182,7 +182,7 @@ static struct debug_param_t { | |||
| 182 | 182 | static int debug_param_num; | |
| 183 | 183 | ||
| 184 | 184 | /* functions */ | |
| 185 | - | static void debug_get_param(const char *name, int *level, int *pages, bool quiet) | |
| 185 | + | static void debug_get_param(const char *name, int *level, int *pages) | |
| 186 | 186 | { | |
| 187 | 187 | struct debug_param_t *p; | |
| 188 | 188 | int i; | |
| @@ -192,13 +192,11 @@ static void debug_get_param(const char *name, int *level, int *pages, bool quiet | |||
| 192 | 192 | if (!glob_match(p->name, name)) | |
| 193 | 193 | continue; | |
| 194 | 194 | if (level && p->level != PARAM_UNSET) { | |
| 195 | - | if (!quiet) | |
| 196 | - | pr_info("%s: override level to %d\n", name, p->level); | |
| 195 | + | pr_info("%s: override level to %d\n", name, p->level); | |
| 197 | 196 | *level = p->level; | |
| 198 | 197 | } | |
| 199 | 198 | if (pages && p->pages != PARAM_UNSET) { | |
| 200 | - | if (!quiet) | |
| 201 | - | pr_info("%s: override pages to %d\n", name, p->pages); | |
| 199 | + | pr_info("%s: override pages to %d\n", name, p->pages); | |
| 202 | 200 | *pages = p->pages; | |
| 203 | 201 | } | |
| 204 | 202 | } | |
| @@ -253,7 +251,7 @@ static int __init s390dbf_parse(char *arg) | |||
| 253 | 251 | * regular memory allocations are possible. | |
| 254 | 252 | */ | |
| 255 | 253 | for (i = 0, id = __s390dbf_info; &id[i] < __s390dbf_info_end; i++) | |
| 256 | - | debug_get_param(id[i]->name, &id[i]->level, NULL, false); | |
| 254 | + | debug_get_param(id[i]->name, &id[i]->level, NULL); | |
| 257 | 255 | ||
| 258 | 256 | return rc; | |
| 259 | 257 | } | |
| @@ -397,7 +395,7 @@ static debug_info_t *debug_info_create(const char *name, int pages_per_area, | |||
| 397 | 395 | int level = DEBUG_DEFAULT_LEVEL; | |
| 398 | 396 | debug_info_t *rc; | |
| 399 | 397 | ||
| 400 | - | debug_get_param(name, &level, &pages_per_area, false); | |
| 398 | + | debug_get_param(name, &level, &pages_per_area); | |
| 401 | 399 | rc = debug_info_alloc(name, pages_per_area, nr_areas, buf_size, level, ALL_AREAS); | |
| 402 | 400 | if (!rc) | |
| 403 | 401 | goto out; | |
| @@ -434,8 +432,7 @@ static debug_info_t *debug_info_copy(debug_info_t *in, int mode) | |||
| 434 | 432 | debug_info_free(rc); | |
| 435 | 433 | } while (1); | |
| 436 | 434 | ||
| 437 | - | /* debug_register_static() failure leaves areas NULL, bounds intact */ | |
| 438 | - | if (mode == NO_AREAS || !in->areas) | |
| 435 | + | if (mode == NO_AREAS) | |
| 439 | 436 | goto out; | |
| 440 | 437 | ||
| 441 | 438 | for (i = 0; i < in->nr_areas; i++) { | |
| @@ -824,9 +821,6 @@ ssize_t debug_dump(debug_info_t *id, struct debug_view *view, | |||
| 824 | 821 | file_private_info_t *p_info; | |
| 825 | 822 | size_t size, offset = 0; | |
| 826 | 823 | ||
| 827 | - | if (!id) | |
| 828 | - | return -EINVAL; | |
| 829 | - | ||
| 830 | 824 | /* Need space for '\0' byte */ | |
| 831 | 825 | if (buf_size < 1) | |
| 832 | 826 | return 0; | |
| @@ -954,12 +948,8 @@ EXPORT_SYMBOL(debug_register); | |||
| 954 | 948 | * | |
| 955 | 949 | * Note: This function is called automatically via an initcall generated by | |
| 956 | 950 | * DEFINE_STATIC_DEBUG_INFO. | |
| 957 | - | * | |
| 958 | - | * Return: | |
| 959 | - | * - 0 on success | |
| 960 | - | * - negative error code on failure | |
| 961 | 951 | */ | |
| 962 | - | int debug_register_static(debug_info_t *id, int pages_per_area, int nr_areas) | |
| 952 | + | void debug_register_static(debug_info_t *id, int pages_per_area, int nr_areas) | |
| 963 | 953 | { | |
| 964 | 954 | unsigned long flags; | |
| 965 | 955 | debug_info_t *copy; | |
| @@ -967,10 +957,10 @@ int debug_register_static(debug_info_t *id, int pages_per_area, int nr_areas) | |||
| 967 | 957 | if (!initialized) { | |
| 968 | 958 | pr_err("Tried to register debug feature %s too early\n", | |
| 969 | 959 | id->name); | |
| 970 | - | return -EINVAL; | |
| 960 | + | return; | |
| 971 | 961 | } | |
| 972 | 962 | ||
| 973 | - | debug_get_param(id->name, &id->level, &pages_per_area, false); | |
| 963 | + | debug_get_param(id->name, &id->level, &pages_per_area); | |
| 974 | 964 | copy = debug_info_alloc("", pages_per_area, nr_areas, id->buf_size, | |
| 975 | 965 | id->level, ALL_AREAS); | |
| 976 | 966 | if (!copy) { | |
| @@ -983,7 +973,7 @@ int debug_register_static(debug_info_t *id, int pages_per_area, int nr_areas) | |||
| 983 | 973 | id->active_entries = NULL; | |
| 984 | 974 | raw_spin_unlock_irqrestore(&id->lock, flags); | |
| 985 | 975 | ||
| 986 | - | return -ENOMEM; | |
| 976 | + | return; | |
| 987 | 977 | } | |
| 988 | 978 | ||
| 989 | 979 | /* Replace static trace area with dynamic copy. */ | |
| @@ -1001,8 +991,6 @@ int debug_register_static(debug_info_t *id, int pages_per_area, int nr_areas) | |||
| 1001 | 991 | mutex_lock(&debug_mutex); | |
| 1002 | 992 | _debug_register(id); | |
| 1003 | 993 | mutex_unlock(&debug_mutex); | |
| 1004 | - | ||
| 1005 | - | return 0; | |
| 1006 | 994 | } | |
| 1007 | 995 | ||
| 1008 | 996 | /* Remove debugfs entries. */ | |
| @@ -1086,6 +1074,9 @@ static void _debug_set_level(debug_info_t *id, int new_level) | |||
| 1086 | 1074 | { | |
| 1087 | 1075 | unsigned long flags; | |
| 1088 | 1076 | ||
| 1077 | + | if (!id) | |
| 1078 | + | return; | |
| 1079 | + | ||
| 1089 | 1080 | if (new_level == DEBUG_OFF_LEVEL) { | |
| 1090 | 1081 | pr_info("%s: switched off\n", id->name); | |
| 1091 | 1082 | } else if ((new_level > DEBUG_MAX_LEVEL) || (new_level < 0)) { | |
| @@ -1110,14 +1101,8 @@ static void _debug_set_level(debug_info_t *id, int new_level) | |||
| 1110 | 1101 | */ | |
| 1111 | 1102 | void debug_set_level(debug_info_t *id, int new_level) | |
| 1112 | 1103 | { | |
| 1113 | - | if (!id) | |
| 1114 | - | return; | |
| 1115 | - | ||
| 1116 | - | /* | |
| 1117 | - | * Level specified via kernel parameter takes precedence. The override | |
| 1118 | - | * was already announced during registration, so stay quiet here. | |
| 1119 | - | */ | |
| 1120 | - | debug_get_param(id->name, &new_level, NULL, true); | |
| 1104 | + | /* Level specified via kernel parameter takes precedence */ | |
| 1105 | + | debug_get_param(id->name, &new_level, NULL); | |
| 1121 | 1106 | ||
| 1122 | 1107 | _debug_set_level(id, new_level); | |
| 1123 | 1108 | } | |
| @@ -1293,7 +1278,7 @@ void debug_set_critical(void) | |||
| 1293 | 1278 | debug_entry_t *debug_event_common(debug_info_t *id, int level, const void *buf, | |
| 1294 | 1279 | int len) | |
| 1295 | 1280 | { | |
| 1296 | - | debug_entry_t *active = NULL; | |
| 1281 | + | debug_entry_t *active; | |
| 1297 | 1282 | unsigned long flags; | |
| 1298 | 1283 | ||
| 1299 | 1284 | if (!debug_active || !id->areas) | |
| @@ -1304,8 +1289,6 @@ debug_entry_t *debug_event_common(debug_info_t *id, int level, const void *buf, | |||
| 1304 | 1289 | } else { | |
| 1305 | 1290 | raw_spin_lock_irqsave(&id->lock, flags); | |
| 1306 | 1291 | } | |
| 1307 | - | if (!id->areas) | |
| 1308 | - | goto out; | |
| 1309 | 1292 | do { | |
| 1310 | 1293 | active = get_active_entry(id); | |
| 1311 | 1294 | memcpy(DEBUG_DATA(active), buf, min(len, id->buf_size)); | |
| @@ -1315,7 +1298,7 @@ debug_entry_t *debug_event_common(debug_info_t *id, int level, const void *buf, | |||
| 1315 | 1298 | len -= id->buf_size; | |
| 1316 | 1299 | buf += id->buf_size; | |
| 1317 | 1300 | } while (len > 0); | |
| 1318 | - | out: | |
| 1301 | + | ||
| 1319 | 1302 | raw_spin_unlock_irqrestore(&id->lock, flags); | |
| 1320 | 1303 | return active; | |
| 1321 | 1304 | } | |
| @@ -1328,7 +1311,7 @@ EXPORT_SYMBOL(debug_event_common); | |||
| 1328 | 1311 | debug_entry_t *debug_exception_common(debug_info_t *id, int level, | |
| 1329 | 1312 | const void *buf, int len) | |
| 1330 | 1313 | { | |
| 1331 | - | debug_entry_t *active = NULL; | |
| 1314 | + | debug_entry_t *active; | |
| 1332 | 1315 | unsigned long flags; | |
| 1333 | 1316 | ||
| 1334 | 1317 | if (!debug_active || !id->areas) | |
| @@ -1339,8 +1322,6 @@ debug_entry_t *debug_exception_common(debug_info_t *id, int level, | |||
| 1339 | 1322 | } else { | |
| 1340 | 1323 | raw_spin_lock_irqsave(&id->lock, flags); | |
| 1341 | 1324 | } | |
| 1342 | - | if (!id->areas) | |
| 1343 | - | goto out; | |
| 1344 | 1325 | do { | |
| 1345 | 1326 | active = get_active_entry(id); | |
| 1346 | 1327 | memcpy(DEBUG_DATA(active), buf, min(len, id->buf_size)); | |
| @@ -1350,7 +1331,7 @@ debug_entry_t *debug_exception_common(debug_info_t *id, int level, | |||
| 1350 | 1331 | len -= id->buf_size; | |
| 1351 | 1332 | buf += id->buf_size; | |
| 1352 | 1333 | } while (len > 0); | |
| 1353 | - | out: | |
| 1334 | + | ||
| 1354 | 1335 | raw_spin_unlock_irqrestore(&id->lock, flags); | |
| 1355 | 1336 | return active; | |
| 1356 | 1337 | } | |
| @@ -1376,7 +1357,7 @@ static inline int debug_count_numargs(char *string) | |||
| 1376 | 1357 | debug_entry_t *__debug_sprintf_event(debug_info_t *id, int level, char *string, ...) | |
| 1377 | 1358 | { | |
| 1378 | 1359 | debug_sprintf_entry_t *curr_event; | |
| 1379 | - | debug_entry_t *active = NULL; | |
| 1360 | + | debug_entry_t *active; | |
| 1380 | 1361 | unsigned long flags; | |
| 1381 | 1362 | int numargs, idx; | |
| 1382 | 1363 | va_list ap; | |
| @@ -1391,8 +1372,6 @@ debug_entry_t *__debug_sprintf_event(debug_info_t *id, int level, char *string, | |||
| 1391 | 1372 | } else { | |
| 1392 | 1373 | raw_spin_lock_irqsave(&id->lock, flags); | |
| 1393 | 1374 | } | |
| 1394 | - | if (!id->areas) | |
| 1395 | - | goto out; | |
| 1396 | 1375 | active = get_active_entry(id); | |
| 1397 | 1376 | curr_event = (debug_sprintf_entry_t *) DEBUG_DATA(active); | |
| 1398 | 1377 | va_start(ap, string); | |
| @@ -1401,7 +1380,6 @@ debug_entry_t *__debug_sprintf_event(debug_info_t *id, int level, char *string, | |||
| 1401 | 1380 | curr_event->args[idx] = va_arg(ap, long); | |
| 1402 | 1381 | va_end(ap); | |
| 1403 | 1382 | debug_finish_entry(id, active, level, 0); | |
| 1404 | - | out: | |
| 1405 | 1383 | raw_spin_unlock_irqrestore(&id->lock, flags); | |
| 1406 | 1384 | ||
| 1407 | 1385 | return active; | |
| @@ -1414,7 +1392,7 @@ EXPORT_SYMBOL(__debug_sprintf_event); | |||
| 1414 | 1392 | debug_entry_t *__debug_sprintf_exception(debug_info_t *id, int level, char *string, ...) | |
| 1415 | 1393 | { | |
| 1416 | 1394 | debug_sprintf_entry_t *curr_event; | |
| 1417 | - | debug_entry_t *active = NULL; | |
| 1395 | + | debug_entry_t *active; | |
| 1418 | 1396 | unsigned long flags; | |
| 1419 | 1397 | int numargs, idx; | |
| 1420 | 1398 | va_list ap; | |
| @@ -1430,8 +1408,6 @@ debug_entry_t *__debug_sprintf_exception(debug_info_t *id, int level, char *stri | |||
| 1430 | 1408 | } else { | |
| 1431 | 1409 | raw_spin_lock_irqsave(&id->lock, flags); | |
| 1432 | 1410 | } | |
| 1433 | - | if (!id->areas) | |
| 1434 | - | goto out; | |
| 1435 | 1411 | active = get_active_entry(id); | |
| 1436 | 1412 | curr_event = (debug_sprintf_entry_t *)DEBUG_DATA(active); | |
| 1437 | 1413 | va_start(ap, string); | |
| @@ -1440,7 +1416,6 @@ debug_entry_t *__debug_sprintf_exception(debug_info_t *id, int level, char *stri | |||
| 1440 | 1416 | curr_event->args[idx] = va_arg(ap, long); | |
| 1441 | 1417 | va_end(ap); | |
| 1442 | 1418 | debug_finish_entry(id, active, level, 1); | |
| 1443 | - | out: | |
| 1444 | 1419 | raw_spin_unlock_irqrestore(&id->lock, flags); | |
| 1445 | 1420 | ||
| 1446 | 1421 | return active; | |
| @@ -1683,11 +1658,9 @@ static void debug_flush(debug_info_t *id, int area) | |||
| 1683 | 1658 | unsigned long flags; | |
| 1684 | 1659 | int i, j; | |
| 1685 | 1660 | ||
| 1686 | - | if (!id) | |
| 1661 | + | if (!id || !id->areas) | |
| 1687 | 1662 | return; | |
| 1688 | 1663 | raw_spin_lock_irqsave(&id->lock, flags); | |
| 1689 | - | if (!id->areas) | |
| 1690 | - | goto out; | |
| 1691 | 1664 | if (area == DEBUG_FLUSH_ALL) { | |
| 1692 | 1665 | id->active_area = 0; | |
| 1693 | 1666 | memset(id->active_entries, 0, id->nr_areas * sizeof(int)); | |
| @@ -1702,7 +1675,6 @@ static void debug_flush(debug_info_t *id, int area) | |||
| 1702 | 1675 | for (i = 0; i < id->pages_per_area; i++) | |
| 1703 | 1676 | memset(id->areas[area][i], 0, PAGE_SIZE); | |
| 1704 | 1677 | } | |
| 1705 | - | out: | |
| 1706 | 1678 | raw_spin_unlock_irqrestore(&id->lock, flags); | |
| 1707 | 1679 | } | |
| 1708 | 1680 | ||
modified arch/s390/kernel/diag/diag324.c
| @@ -182,7 +182,8 @@ long diag324_pibbuf(unsigned long arg) | |||
| 182 | 182 | goto out; | |
| 183 | 183 | rc = copy_to_user((void __user *)address, data->pib, data->pib->len); | |
| 184 | 184 | rc |= put_user(data->sequence, &udata->sequence); | |
| 185 | - | rc = rc ? -EFAULT : data->rc; | |
| 185 | + | if (rc) | |
| 186 | + | rc = -EFAULT; | |
| 186 | 187 | out: | |
| 187 | 188 | mutex_unlock(&pibmutex); | |
| 188 | 189 | return rc; | |
modified arch/s390/kernel/ipl.c
| @@ -1157,8 +1157,6 @@ static struct attribute_group reipl_nss_attr_group = { | |||
| 1157 | 1157 | ||
| 1158 | 1158 | void set_os_info_reipl_block(void) | |
| 1159 | 1159 | { | |
| 1160 | - | if (!reipl_block_actual) | |
| 1161 | - | return; | |
| 1162 | 1160 | os_info_entry_add_data(OS_INFO_REIPL_BLOCK, reipl_block_actual, | |
| 1163 | 1161 | reipl_block_actual->hdr.len); | |
| 1164 | 1162 | } | |
| @@ -1929,8 +1927,7 @@ static struct shutdown_action __refdata dump_action = { | |||
| 1929 | 1927 | static void dump_reipl_run(struct shutdown_trigger *trigger) | |
| 1930 | 1928 | { | |
| 1931 | 1929 | struct lowcore *abs_lc; | |
| 1932 | - | unsigned long ipib = 0; | |
| 1933 | - | unsigned int csum = 0; | |
| 1930 | + | unsigned int csum; | |
| 1934 | 1931 | ||
| 1935 | 1932 | /* | |
| 1936 | 1933 | * Set REIPL_CLEAR flag in os_info flags entry indicating | |
| @@ -1946,12 +1943,9 @@ static void dump_reipl_run(struct shutdown_trigger *trigger) | |||
| 1946 | 1943 | reipl_type == IPL_TYPE_UNKNOWN) | |
| 1947 | 1944 | os_info_flags |= OS_INFO_FLAG_REIPL_CLEAR; | |
| 1948 | 1945 | os_info_entry_add_data(OS_INFO_FLAGS_ENTRY, &os_info_flags, sizeof(os_info_flags)); | |
| 1949 | - | if (reipl_block_actual) { | |
| 1950 | - | ipib = __pa(reipl_block_actual); | |
| 1951 | - | csum = (__force unsigned int)cksm(reipl_block_actual, reipl_block_actual->hdr.len, 0); | |
| 1952 | - | } | |
| 1946 | + | csum = (__force unsigned int)cksm(reipl_block_actual, reipl_block_actual->hdr.len, 0); | |
| 1953 | 1947 | abs_lc = get_abs_lowcore(); | |
| 1954 | - | abs_lc->ipib = ipib; | |
| 1948 | + | abs_lc->ipib = __pa(reipl_block_actual); | |
| 1955 | 1949 | abs_lc->ipib_checksum = csum; | |
| 1956 | 1950 | put_abs_lowcore(abs_lc); | |
| 1957 | 1951 | dump_run(trigger); | |
modified arch/s390/kernel/perf_pai.c
| @@ -67,7 +67,6 @@ struct pai_mapptr { | |||
| 67 | 67 | ||
| 68 | 68 | static struct pai_root { /* Anchor to per CPU data */ | |
| 69 | 69 | refcount_t refcnt; /* Overall active events */ | |
| 70 | - | atomic_t tskctx; /* Overall per-task events */ | |
| 71 | 70 | struct pai_mapptr __percpu *mapptr; | |
| 72 | 71 | } pai_root[PAI_PMU_MAX]; | |
| 73 | 72 | ||
| @@ -94,15 +93,14 @@ struct pai_pmu { /* Define PAI PMU characteristics */ | |||
| 94 | 93 | static struct pai_pmu pai_pmu[]; /* Forward declaration */ | |
| 95 | 94 | ||
| 96 | 95 | /* Free per CPU data when the last event is removed. */ | |
| 97 | - | static void pai_root_free(int idx, int tasks) | |
| 96 | + | static void pai_root_free(int idx) | |
| 98 | 97 | { | |
| 99 | - | if (refcount_sub_and_test(tasks, &pai_root[idx].refcnt)) { | |
| 98 | + | if (refcount_dec_and_test(&pai_root[idx].refcnt)) { | |
| 100 | 99 | free_percpu(pai_root[idx].mapptr); | |
| 101 | 100 | pai_root[idx].mapptr = NULL; | |
| 102 | 101 | } | |
| 103 | - | debug_sprintf_event(paidbg, 5, "%s root[%d].refcount %d tskctx %d\n", | |
| 104 | - | __func__, idx, refcount_read(&pai_root[idx].refcnt), | |
| 105 | - | atomic_read(&pai_root[idx].tskctx)); | |
| 102 | + | debug_sprintf_event(paidbg, 5, "%s root[%d].refcount %d\n", __func__, | |
| 103 | + | idx, refcount_read(&pai_root[idx].refcnt)); | |
| 106 | 104 | } | |
| 107 | 105 | ||
| 108 | 106 | /* | |
| @@ -139,54 +137,40 @@ static void pai_free(struct pai_mapptr *mp) | |||
| 139 | 137 | mp->mapptr = NULL; | |
| 140 | 138 | } | |
| 141 | 139 | ||
| 142 | - | /* Called under mutex_lock */ | |
| 143 | - | static void pai_event_destroy_cpu(int idx, int cpu, bool hotplug) | |
| 140 | + | /* Adjust usage counters and remove allocated memory when all users are | |
| 141 | + | * gone. | |
| 142 | + | */ | |
| 143 | + | static void pai_event_destroy_cpu(struct perf_event *event, int cpu) | |
| 144 | 144 | { | |
| 145 | - | struct pai_mapptr *mp; | |
| 146 | - | struct pai_map *cpump; | |
| 147 | - | int tasks = 1; | |
| 148 | - | ||
| 149 | - | /* Check reference count and return when all gone. | |
| 150 | - | * 1. An event is installed on online CPU X. | |
| 151 | - | * 2. CPU x is offlined and the per-CPU data is removed. | |
| 152 | - | * 3. Event is destroyed via close system call. | |
| 153 | - | */ | |
| 154 | - | if (!refcount_read(&pai_root[idx].refcnt)) | |
| 155 | - | return; /* No events at all */ | |
| 156 | - | mp = per_cpu_ptr(pai_root[idx].mapptr, cpu); | |
| 157 | - | if (!mp || !mp->mapptr) /* No events on that CPU */ | |
| 158 | - | return; | |
| 159 | - | ||
| 160 | - | /* When hotplug is true, invocation is from CPU hotplug callback. | |
| 161 | - | * Delete per-CPU resource and adjust refcnt when per-task events | |
| 162 | - | * are currently active. This can be more than one. | |
| 163 | - | * In this case adjust counters. | |
| 164 | - | */ | |
| 165 | - | if (hotplug) | |
| 166 | - | tasks = atomic_read(&pai_root[idx].tskctx); | |
| 145 | + | int idx = PAI_PMU_IDX(event); | |
| 146 | + | struct pai_mapptr *mp = per_cpu_ptr(pai_root[idx].mapptr, cpu); | |
| 147 | + | struct pai_map *cpump = mp->mapptr; | |
| 167 | 148 | ||
| 168 | - | cpump = mp->mapptr; | |
| 169 | - | if (refcount_sub_and_test(tasks, &cpump->refcnt)) | |
| 149 | + | mutex_lock(&pai_reserve_mutex); | |
| 150 | + | debug_sprintf_event(paidbg, 5, "%s event %#llx idx %d cpu %d users %d " | |
| 151 | + | "refcnt %u\n", __func__, event->attr.config, idx, | |
| 152 | + | event->cpu, cpump->active_events, | |
| 153 | + | refcount_read(&cpump->refcnt)); | |
| 154 | + | if (refcount_dec_and_test(&cpump->refcnt)) | |
| 170 | 155 | pai_free(mp); | |
| 171 | - | pai_root_free(idx, tasks); | |
| 156 | + | pai_root_free(idx); | |
| 157 | + | mutex_unlock(&pai_reserve_mutex); | |
| 172 | 158 | } | |
| 173 | 159 | ||
| 174 | 160 | static void pai_event_destroy(struct perf_event *event) | |
| 175 | 161 | { | |
| 176 | - | int cpu = 0, idx = PAI_PMU_IDX(event); | |
| 162 | + | int cpu; | |
| 177 | 163 | ||
| 178 | 164 | free_page(PAI_SAVE_AREA(event)); | |
| 179 | - | cpus_read_lock(); | |
| 180 | - | mutex_lock(&pai_reserve_mutex); | |
| 181 | 165 | if (event->cpu == -1) { | |
| 182 | - | atomic_dec(&pai_root[idx].tskctx); | |
| 183 | - | for_each_online_cpu(cpu) | |
| 184 | - | pai_event_destroy_cpu(idx, cpu, false); | |
| 166 | + | struct cpumask *mask = PAI_CPU_MASK(event); | |
| 167 | + | ||
| 168 | + | for_each_cpu(cpu, mask) | |
| 169 | + | pai_event_destroy_cpu(event, cpu); | |
| 170 | + | kfree(mask); | |
| 185 | 171 | } else { | |
| 186 | - | pai_event_destroy_cpu(idx, event->cpu, false); | |
| 172 | + | pai_event_destroy_cpu(event, event->cpu); | |
| 187 | 173 | } | |
| 188 | - | mutex_unlock(&pai_reserve_mutex); | |
| 189 | - | cpus_read_unlock(); | |
| 190 | 174 | } | |
| 191 | 175 | ||
| 192 | 176 | static void paicrypt_event_destroy(struct perf_event *event) | |
| @@ -250,30 +234,25 @@ static u64 paicrypt_getall(struct perf_event *event) | |||
| 250 | 234 | return sum; | |
| 251 | 235 | } | |
| 252 | 236 | ||
| 253 | - | /* Called under mutex_lock */ | |
| 254 | - | static int pai_alloc_cpu(int idx, int cpu, bool hotplug) | |
| 237 | + | /* Check concurrent access of counting and sampling for crypto events. | |
| 238 | + | * This function is called in process context and it is save to block. | |
| 239 | + | * When the event initialization functions fails, no other call back will | |
| 240 | + | * be invoked. | |
| 241 | + | * | |
| 242 | + | * Allocate the memory for the event. | |
| 243 | + | */ | |
| 244 | + | static int pai_alloc_cpu(struct perf_event *event, int cpu) | |
| 255 | 245 | { | |
| 246 | + | int rc, idx = PAI_PMU_IDX(event); | |
| 256 | 247 | struct pai_map *cpump = NULL; | |
| 257 | 248 | bool need_paiext_cb = false; | |
| 258 | 249 | struct pai_mapptr *mp; | |
| 259 | - | int tasks = 1, rc = 0; | |
| 260 | - | ||
| 261 | - | /* When hotplug is true, invocation is from CPU hotplug callback. | |
| 262 | - | * Allocate per-CPU resource when per-task events are currently active. | |
| 263 | - | * This can be more than one. In this case adjust all reference | |
| 264 | - | * counters. Otherwise return, this ensures memory is only allocated | |
| 265 | - | * when needed. | |
| 266 | - | */ | |
| 267 | - | if (hotplug) { | |
| 268 | - | tasks = atomic_read(&pai_root[idx].tskctx); | |
| 269 | - | if (!tasks) | |
| 270 | - | goto out; | |
| 271 | - | } | |
| 272 | 250 | ||
| 251 | + | mutex_lock(&pai_reserve_mutex); | |
| 273 | 252 | /* Allocate root node */ | |
| 274 | 253 | rc = pai_root_alloc(idx); | |
| 275 | 254 | if (rc) | |
| 276 | - | goto out; | |
| 255 | + | goto unlock; | |
| 277 | 256 | ||
| 278 | 257 | /* Allocate node for this event */ | |
| 279 | 258 | mp = per_cpu_ptr(pai_root[idx].mapptr, cpu); | |
| @@ -317,45 +296,28 @@ static int pai_alloc_cpu(int idx, int cpu, bool hotplug) | |||
| 317 | 296 | goto undo; | |
| 318 | 297 | } | |
| 319 | 298 | INIT_LIST_HEAD(&cpump->syswide_list); | |
| 320 | - | refcount_set(&cpump->refcnt, tasks); | |
| 299 | + | refcount_set(&cpump->refcnt, 1); | |
| 321 | 300 | rc = 0; | |
| 322 | 301 | } else { | |
| 323 | - | refcount_add(tasks, &cpump->refcnt); | |
| 302 | + | refcount_inc(&cpump->refcnt); | |
| 324 | 303 | } | |
| 325 | - | /* If tasks is greater than 1, we are called from CPU hotplug path | |
| 326 | - | * and need to adjust the pai_root[idx].refcnt by the number of | |
| 327 | - | * per-process events. Function pai_root_alloc(idx) already | |
| 328 | - | * incremented by one. Adjust for the rest. | |
| 329 | - | */ | |
| 330 | - | if (tasks > 1) | |
| 331 | - | refcount_add(tasks - 1, &pai_root[idx].refcnt); | |
| 332 | 304 | ||
| 333 | 305 | undo: | |
| 334 | 306 | if (rc) { | |
| 335 | 307 | /* Error in allocation of event, decrement anchor. Since | |
| 336 | 308 | * the event in not created, its destroy() function is never | |
| 337 | 309 | * invoked. Adjust the reference counter for the anchor. | |
| 338 | - | * The failure happened in the case of variable | |
| 339 | - | * cpump == NULL branch above. The pai_root[XXX].refcnt has | |
| 340 | - | * been incremented by one. Then the per-CPU allocation | |
| 341 | - | * failed, so decrement it by one, regardless of tasks. | |
| 342 | 310 | */ | |
| 343 | - | pai_root_free(idx, 1); | |
| 311 | + | pai_root_free(idx); | |
| 344 | 312 | } | |
| 345 | - | out: | |
| 313 | + | unlock: | |
| 314 | + | mutex_unlock(&pai_reserve_mutex); | |
| 346 | 315 | /* If rc is non-zero, no increment of counter/sampler was done. */ | |
| 347 | 316 | return rc; | |
| 348 | 317 | } | |
| 349 | 318 | ||
| 350 | - | /* Check concurrent access of counting and sampling for PAI events. | |
| 351 | - | * This function is called in process context and it is safe to block. | |
| 352 | - | * When the event initialization functions fails, no other call back will | |
| 353 | - | * be invoked. | |
| 354 | - | * Called under mutex_lock. | |
| 355 | - | */ | |
| 356 | 319 | static int pai_alloc(struct perf_event *event) | |
| 357 | 320 | { | |
| 358 | - | int idx = PAI_PMU_IDX(event); | |
| 359 | 321 | struct cpumask *maskptr; | |
| 360 | 322 | int cpu, rc = -ENOMEM; | |
| 361 | 323 | ||
| @@ -364,20 +326,24 @@ static int pai_alloc(struct perf_event *event) | |||
| 364 | 326 | goto out; | |
| 365 | 327 | ||
| 366 | 328 | for_each_online_cpu(cpu) { | |
| 367 | - | rc = pai_alloc_cpu(idx, cpu, false); | |
| 329 | + | rc = pai_alloc_cpu(event, cpu); | |
| 368 | 330 | if (rc) { | |
| 369 | 331 | for_each_cpu(cpu, maskptr) | |
| 370 | - | pai_event_destroy_cpu(idx, cpu, false); | |
| 371 | - | goto undo; | |
| 332 | + | pai_event_destroy_cpu(event, cpu); | |
| 333 | + | kfree(maskptr); | |
| 334 | + | goto out; | |
| 372 | 335 | } | |
| 373 | 336 | cpumask_set_cpu(cpu, maskptr); | |
| 374 | 337 | } | |
| 375 | 338 | ||
| 339 | + | /* | |
| 340 | + | * On error all cpumask are freed and all events have been destroyed. | |
| 341 | + | * Save of which CPUs data structures have been allocated for. | |
| 342 | + | * Release them in pai_event_destroy call back function | |
| 343 | + | * for this event. | |
| 344 | + | */ | |
| 345 | + | PAI_CPU_MASK(event) = maskptr; | |
| 376 | 346 | rc = 0; | |
| 377 | - | /* Trace per-task events for CPU hotplug. */ | |
| 378 | - | atomic_inc(&pai_root[idx].tskctx); | |
| 379 | - | undo: | |
| 380 | - | kfree(maskptr); | |
| 381 | 347 | out: | |
| 382 | 348 | return rc; | |
| 383 | 349 | } | |
| @@ -425,14 +391,10 @@ static int pai_event_init(struct perf_event *event, int idx) | |||
| 425 | 391 | } | |
| 426 | 392 | } | |
| 427 | 393 | ||
| 428 | - | cpus_read_lock(); | |
| 429 | - | mutex_lock(&pai_reserve_mutex); | |
| 430 | 394 | if (event->cpu >= 0) | |
| 431 | - | rc = pai_alloc_cpu(idx, event->cpu, false); | |
| 395 | + | rc = pai_alloc_cpu(event, event->cpu); | |
| 432 | 396 | else | |
| 433 | 397 | rc = pai_alloc(event); | |
| 434 | - | mutex_unlock(&pai_reserve_mutex); | |
| 435 | - | cpus_read_unlock(); | |
| 436 | 398 | if (rc) { | |
| 437 | 399 | free_page(PAI_SAVE_AREA(event)); | |
| 438 | 400 | goto out; | |
| @@ -502,7 +464,6 @@ static void pai_start(struct perf_event *event, int flags, | |||
| 502 | 464 | cpump->event = event; | |
| 503 | 465 | } | |
| 504 | 466 | } | |
| 505 | - | event->hw.state &= ~PERF_HES_STOPPED; | |
| 506 | 467 | } | |
| 507 | 468 | ||
| 508 | 469 | static void paicrypt_start(struct perf_event *event, int flags) | |
| @@ -549,13 +510,6 @@ static void pai_stop(struct perf_event *event, int flags) | |||
| 549 | 510 | struct pai_mapptr *mp = this_cpu_ptr(pai_root[idx].mapptr); | |
| 550 | 511 | struct pai_map *cpump = mp->mapptr; | |
| 551 | 512 | ||
| 552 | - | /* Cope with multiple invocations: | |
| 553 | - | * 1. perf_event_throttle() --> PMU->stop() | |
| 554 | - | * 2. task schedules out --> PMU->stop() | |
| 555 | - | * Check for event already stopped. | |
| 556 | - | */ | |
| 557 | - | if (event->hw.state & PERF_HES_STOPPED) | |
| 558 | - | return; | |
| 559 | 513 | if (!event->attr.sample_period) { /* Counting */ | |
| 560 | 514 | pai_pmu[idx].pmu->read(event); | |
| 561 | 515 | } else { /* Sampling */ | |
| @@ -718,9 +672,9 @@ static void pai_have_samples(int idx) | |||
| 718 | 672 | { | |
| 719 | 673 | struct pai_mapptr *mp = this_cpu_ptr(pai_root[idx].mapptr); | |
| 720 | 674 | struct pai_map *cpump = mp->mapptr; | |
| 721 | - | struct perf_event *event, *e2; | |
| 675 | + | struct perf_event *event; | |
| 722 | 676 | ||
| 723 | - | list_for_each_entry_safe(event, e2, &cpump->syswide_list, hw.tp_list) | |
| 677 | + | list_for_each_entry(event, &cpump->syswide_list, hw.tp_list) | |
| 724 | 678 | pai_have_sample(event, cpump); | |
| 725 | 679 | } | |
| 726 | 680 | ||
| @@ -737,17 +691,6 @@ static void paicrypt_sched_task(struct perf_event_pmu_context *pmu_ctx, | |||
| 737 | 691 | pai_have_samples(PAI_PMU_CRYPTO); | |
| 738 | 692 | } | |
| 739 | 693 | ||
| 740 | - | /* Prevent ioctl(fd, PERF_EVENT_IOC_PERIOD, ...) call. | |
| 741 | - | * It sets perf_event::event_limit to a positive value and causes | |
| 742 | - | * perf_event_overflow() to invoke pai_stop() call back function when | |
| 743 | - | * perf_event::event_limit hits zero. This is not supported because the | |
| 744 | - | * sample events CRYPTO_ALL and NNPA_ALL are always taken at schedule out | |
| 745 | - | * of a task. | |
| 746 | - | */ | |
| 747 | - | static int pai_check_period(struct perf_event *event, u64 value) | |
| 748 | - | { | |
| 749 | - | return -EINVAL; | |
| 750 | - | } | |
| 751 | 694 | /* ============================= paiext ====================================*/ | |
| 752 | 695 | ||
| 753 | 696 | static void paiext_event_destroy(struct perf_event *event) | |
| @@ -861,7 +804,6 @@ static struct pmu paicrypt = { | |||
| 861 | 804 | .stop = paicrypt_stop, | |
| 862 | 805 | .read = paicrypt_read, | |
| 863 | 806 | .sched_task = paicrypt_sched_task, | |
| 864 | - | .check_period = pai_check_period, | |
| 865 | 807 | .attr_groups = paicrypt_attr_groups | |
| 866 | 808 | }; | |
| 867 | 809 | ||
| @@ -1073,7 +1015,6 @@ static struct pmu paiext = { | |||
| 1073 | 1015 | .stop = paiext_stop, | |
| 1074 | 1016 | .read = paiext_read, | |
| 1075 | 1017 | .sched_task = paiext_sched_task, | |
| 1076 | - | .check_period = pai_check_period, | |
| 1077 | 1018 | .attr_groups = paiext_attr_groups, | |
| 1078 | 1019 | }; | |
| 1079 | 1020 | ||
| @@ -1277,61 +1218,23 @@ static int __init paipmu_setup(void) | |||
| 1277 | 1218 | return install_ok; | |
| 1278 | 1219 | } | |
| 1279 | 1220 | ||
| 1280 | - | static int pai_online_cpu(unsigned int cpu) | |
| 1281 | - | { | |
| 1282 | - | int rc; | |
| 1283 | - | ||
| 1284 | - | mutex_lock(&pai_reserve_mutex); | |
| 1285 | - | rc = pai_alloc_cpu(PAI_PMU_CRYPTO, cpu, true); | |
| 1286 | - | if (rc) | |
| 1287 | - | goto out; | |
| 1288 | - | rc = pai_alloc_cpu(PAI_PMU_EXT, cpu, true); | |
| 1289 | - | if (rc) | |
| 1290 | - | pai_event_destroy_cpu(PAI_PMU_CRYPTO, cpu, true); | |
| 1291 | - | out: | |
| 1292 | - | mutex_unlock(&pai_reserve_mutex); | |
| 1293 | - | return rc; | |
| 1294 | - | } | |
| 1295 | - | ||
| 1296 | - | static int pai_offline_cpu(unsigned int cpu) | |
| 1297 | - | { | |
| 1298 | - | mutex_lock(&pai_reserve_mutex); | |
| 1299 | - | pai_event_destroy_cpu(PAI_PMU_CRYPTO, cpu, true); | |
| 1300 | - | pai_event_destroy_cpu(PAI_PMU_EXT, cpu, true); | |
| 1301 | - | mutex_unlock(&pai_reserve_mutex); | |
| 1302 | - | return 0; | |
| 1303 | - | } | |
| 1304 | - | ||
| 1305 | 1221 | static int __init pai_init(void) | |
| 1306 | 1222 | { | |
| 1307 | - | int state, rc; | |
| 1308 | - | ||
| 1309 | 1223 | /* Setup s390dbf facility */ | |
| 1310 | - | paidbg = debug_register("pai", 1, 1, 128); | |
| 1224 | + | paidbg = debug_register("pai", 32, 256, 128); | |
| 1311 | 1225 | if (!paidbg) { | |
| 1312 | 1226 | pr_err("Registration of s390dbf pai failed\n"); | |
| 1313 | 1227 | return -ENOMEM; | |
| 1314 | 1228 | } | |
| 1315 | 1229 | debug_register_view(paidbg, &debug_sprintf_view); | |
| 1316 | 1230 | ||
| 1317 | - | /* CPUHP_BP_PREPARE_DYN --> before CPU is brought online */ | |
| 1318 | - | state = cpuhp_setup_state(CPUHP_BP_PREPARE_DYN, "perf/pai:prepare", | |
| 1319 | - | pai_online_cpu, pai_offline_cpu); | |
| 1320 | - | rc = state < 0 ? state : 0; | |
| 1321 | - | if (rc < 0) | |
| 1322 | - | goto out_debug; | |
| 1323 | - | ||
| 1324 | - | rc = -ENODEV; | |
| 1325 | - | if (!paipmu_setup()) | |
| 1326 | - | goto out_cpuhp; | |
| 1231 | + | if (!paipmu_setup()) { | |
| 1232 | + | /* No PMU registration, no need for debug buffer */ | |
| 1233 | + | debug_unregister_view(paidbg, &debug_sprintf_view); | |
| 1234 | + | debug_unregister(paidbg); | |
| 1235 | + | return -ENODEV; | |
| 1236 | + | } | |
| 1327 | 1237 | return 0; | |
| 1328 | - | ||
| 1329 | - | out_cpuhp: | |
| 1330 | - | cpuhp_remove_state(state); | |
| 1331 | - | out_debug: | |
| 1332 | - | debug_unregister_view(paidbg, &debug_sprintf_view); | |
| 1333 | - | debug_unregister(paidbg); | |
| 1334 | - | return rc; | |
| 1335 | 1238 | } | |
| 1336 | 1239 | ||
| 1337 | 1240 | device_initcall(pai_init); | |
modified arch/s390/kernel/smp.c
| @@ -659,13 +659,23 @@ int smp_cpu_get_polarization(int cpu) | |||
| 659 | 659 | return per_cpu(pcpu_devices, cpu).polarization; | |
| 660 | 660 | } | |
| 661 | 661 | ||
| 662 | + | void smp_cpu_set_capacity(int cpu, unsigned long val) | |
| 663 | + | { | |
| 664 | + | per_cpu(pcpu_devices, cpu).capacity = val; | |
| 665 | + | } | |
| 666 | + | ||
| 667 | + | unsigned long smp_cpu_get_capacity(int cpu) | |
| 668 | + | { | |
| 669 | + | return per_cpu(pcpu_devices, cpu).capacity; | |
| 670 | + | } | |
| 671 | + | ||
| 662 | 672 | void smp_set_core_capacity(int cpu, unsigned long val) | |
| 663 | 673 | { | |
| 664 | 674 | int i; | |
| 665 | 675 | ||
| 666 | 676 | cpu = smp_get_base_cpu(cpu); | |
| 667 | 677 | for (i = cpu; (i <= cpu + smp_cpu_mtid) && (i < nr_cpu_ids); i++) | |
| 668 | - | topology_set_cpu_scale(i, val); | |
| 678 | + | smp_cpu_set_capacity(i, val); | |
| 669 | 679 | } | |
| 670 | 680 | ||
| 671 | 681 | int smp_cpu_get_cpu_address(int cpu) | |
| @@ -717,7 +727,7 @@ static int smp_add_core(struct sclp_core_entry *core, cpumask_t *avail, | |||
| 717 | 727 | else | |
| 718 | 728 | pcpu->state = CPU_STATE_STANDBY; | |
| 719 | 729 | smp_cpu_set_polarization(cpu, POLARIZATION_UNKNOWN); | |
| 720 | - | topology_set_cpu_scale(cpu, CPU_CAPACITY_HIGH); | |
| 730 | + | smp_cpu_set_capacity(cpu, CPU_CAPACITY_HIGH); | |
| 721 | 731 | set_cpu_present(cpu, true); | |
| 722 | 732 | if (!early && arch_register_cpu(cpu)) | |
| 723 | 733 | set_cpu_present(cpu, false); | |
| @@ -957,7 +967,7 @@ void __init smp_prepare_boot_cpu(void) | |||
| 957 | 967 | ipl_pcpu->state = CPU_STATE_CONFIGURED; | |
| 958 | 968 | lc->pcpu = (unsigned long)ipl_pcpu; | |
| 959 | 969 | smp_cpu_set_polarization(0, POLARIZATION_UNKNOWN); | |
| 960 | - | topology_set_cpu_scale(0, CPU_CAPACITY_HIGH); | |
| 970 | + | smp_cpu_set_capacity(0, CPU_CAPACITY_HIGH); | |
| 961 | 971 | } | |
| 962 | 972 | ||
| 963 | 973 | void __init smp_setup_processor_id(void) | |
modified arch/s390/kernel/topology.c
| @@ -147,7 +147,7 @@ static void add_cpus_to_mask(struct topology_core *tl_core, | |||
| 147 | 147 | cpumask_set_cpu(cpu, &book->mask); | |
| 148 | 148 | cpumask_set_cpu(cpu, &socket->mask); | |
| 149 | 149 | smp_cpu_set_polarization(cpu, tl_core->pp); | |
| 150 | - | topology_set_cpu_scale(cpu, CPU_CAPACITY_HIGH); | |
| 150 | + | smp_cpu_set_capacity(cpu, CPU_CAPACITY_HIGH); | |
| 151 | 151 | } | |
| 152 | 152 | } | |
| 153 | 153 | } | |
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/kernel/vdso/Makefile
| @@ -29,7 +29,6 @@ KBUILD_CFLAGS_VDSO := $(filter-out -munaligned-symbols,$(KBUILD_CFLAGS_VDSO)) | |||
| 29 | 29 | KBUILD_CFLAGS_VDSO := $(filter-out -fno-asynchronous-unwind-tables,$(KBUILD_CFLAGS_VDSO)) | |
| 30 | 30 | KBUILD_CFLAGS_VDSO += -fPIC -fno-common -fno-builtin -fasynchronous-unwind-tables | |
| 31 | 31 | KBUILD_CFLAGS_VDSO += -fno-stack-protector $(DISABLE_KSTACK_ERASE) | |
| 32 | - | KBUILD_CFLAGS_VDSO += $(CONFIG_CC_OPT_INLINE_MEMSET) | |
| 33 | 32 | ldflags-y := -shared -soname=linux-vdso.so.1 \ | |
| 34 | 33 | --hash-style=both --build-id=sha1 \ | |
| 35 | 34 | $(call ld-option, --eh-frame-hdr) -T | |
modified arch/s390/kernel/vtime.c
| @@ -32,7 +32,7 @@ static atomic64_t virt_timer_elapsed; | |||
| 32 | 32 | DEFINE_PER_CPU(u64, mt_cycles[8]); | |
| 33 | 33 | static DEFINE_PER_CPU(u64, mt_scaling_mult) = { 1 }; | |
| 34 | 34 | static DEFINE_PER_CPU(u64, mt_scaling_div) = { 1 }; | |
| 35 | - | static DEFINE_PER_CPU(unsigned long, mt_scaling_jiffies); | |
| 35 | + | static DEFINE_PER_CPU(u64, mt_scaling_jiffies); | |
| 36 | 36 | ||
| 37 | 37 | static inline void set_vtimer(u64 expires) | |
| 38 | 38 | { | |
| @@ -81,7 +81,7 @@ static void update_mt_scaling(void) | |||
| 81 | 81 | memcpy(cycles_old, cycles_new, | |
| 82 | 82 | sizeof(u64) * (smp_cpu_mtid + 1)); | |
| 83 | 83 | } | |
| 84 | - | __this_cpu_write(mt_scaling_jiffies, jiffies); | |
| 84 | + | __this_cpu_write(mt_scaling_jiffies, jiffies_64); | |
| 85 | 85 | } | |
| 86 | 86 | ||
| 87 | 87 | static inline u64 update_tsk_timer(unsigned long *tsk_vtime, u64 new) | |
| @@ -144,7 +144,7 @@ static int do_account_vtime(struct task_struct *tsk) | |||
| 144 | 144 | lc->system_timer += timer; | |
| 145 | 145 | ||
| 146 | 146 | /* Update MT utilization calculation */ | |
| 147 | - | if (smp_cpu_mtid && time_after(jiffies, __this_cpu_read(mt_scaling_jiffies))) | |
| 147 | + | if (smp_cpu_mtid && time_after64(jiffies_64, __this_cpu_read(mt_scaling_jiffies))) | |
| 148 | 148 | update_mt_scaling(); | |
| 149 | 149 | ||
| 150 | 150 | /* Calculate cputime delta */ | |
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
| @@ -2168,7 +2168,7 @@ static int kvm_s390_get_skeys(struct kvm *kvm, struct kvm_s390_skeys *args) | |||
| 2168 | 2168 | if (args->count < 1 || args->count > KVM_S390_SKEYS_MAX) | |
| 2169 | 2169 | return -EINVAL; | |
| 2170 | 2170 | ||
| 2171 | - | keys = kvmalloc_objs(*keys, args->count, GFP_KERNEL_ACCOUNT); | |
| 2171 | + | keys = kvmalloc_array(args->count, sizeof(*keys), GFP_KERNEL_ACCOUNT); | |
| 2172 | 2172 | if (!keys) | |
| 2173 | 2173 | return -ENOMEM; | |
| 2174 | 2174 | ||
| @@ -2205,7 +2205,7 @@ static int kvm_s390_set_skeys(struct kvm *kvm, struct kvm_s390_skeys *args) | |||
| 2205 | 2205 | if (args->count < 1 || args->count > KVM_S390_SKEYS_MAX) | |
| 2206 | 2206 | return -EINVAL; | |
| 2207 | 2207 | ||
| 2208 | - | keys = kvmalloc_objs(*keys, args->count, GFP_KERNEL_ACCOUNT); | |
| 2208 | + | keys = kvmalloc_array(args->count, sizeof(*keys), GFP_KERNEL_ACCOUNT); | |
| 2209 | 2209 | if (!keys) | |
| 2210 | 2210 | return -ENOMEM; | |
| 2211 | 2211 | ||
| @@ -3579,11 +3579,12 @@ void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu) | |||
| 3579 | 3579 | ||
| 3580 | 3580 | void kvm_arch_vcpu_postcreate(struct kvm_vcpu *vcpu) | |
| 3581 | 3581 | { | |
| 3582 | + | mutex_lock(&vcpu->kvm->lock); | |
| 3582 | 3583 | preempt_disable(); | |
| 3583 | 3584 | vcpu->arch.sie_block->epoch = vcpu->kvm->arch.epoch; | |
| 3584 | 3585 | vcpu->arch.sie_block->epdx = vcpu->kvm->arch.epdx; | |
| 3585 | 3586 | preempt_enable(); | |
| 3586 | - | ||
| 3587 | + | mutex_unlock(&vcpu->kvm->lock); | |
| 3587 | 3588 | if (!kvm_is_ucontrol(vcpu->kvm)) { | |
| 3588 | 3589 | vcpu->arch.gmap = vcpu->kvm->arch.gmap; | |
| 3589 | 3590 | sca_add_vcpu(vcpu); | |
| @@ -3756,11 +3757,13 @@ static int kvm_s390_vcpu_setup(struct kvm_vcpu *vcpu) | |||
| 3756 | 3757 | ||
| 3757 | 3758 | kvm_s390_vcpu_pci_setup(vcpu); | |
| 3758 | 3759 | ||
| 3760 | + | mutex_lock(&vcpu->kvm->lock); | |
| 3759 | 3761 | if (kvm_s390_pv_is_protected(vcpu->kvm)) { | |
| 3760 | 3762 | rc = kvm_s390_pv_create_cpu(vcpu, &uvrc, &uvrrc); | |
| 3761 | 3763 | if (rc) | |
| 3762 | 3764 | kvm_s390_vcpu_unsetup_cmma(vcpu); | |
| 3763 | 3765 | } | |
| 3766 | + | mutex_unlock(&vcpu->kvm->lock); | |
| 3764 | 3767 | ||
| 3765 | 3768 | return rc; | |
| 3766 | 3769 | } | |
| @@ -5763,7 +5766,7 @@ static long cmma_d_count_pte(union pte *ptep, gfn_t gfn, gfn_t next, struct dat_ | |||
| 5763 | 5766 | return 0; | |
| 5764 | 5767 | } | |
| 5765 | 5768 | ||
| 5766 | - | 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) | |
| 5767 | 5770 | { | |
| 5768 | 5771 | const struct dat_walk_ops ops = { .pte_entry = cmma_d_count_pte, }; | |
| 5769 | 5772 | ||
| @@ -5778,6 +5781,7 @@ void kvm_arch_commit_memory_region(struct kvm *kvm, struct kvm_memory_slot *old, | |||
| 5778 | 5781 | const struct kvm_memory_slot *new, | |
| 5779 | 5782 | enum kvm_mr_change change) | |
| 5780 | 5783 | { | |
| 5784 | + | s390_kvm_mmu_commit_memory_region(kvm, old, new, change); | |
| 5781 | 5785 | } | |
| 5782 | 5786 | ||
| 5783 | 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/mm/pgalloc.c
| @@ -55,46 +55,63 @@ static void __crst_table_upgrade(void *arg) | |||
| 55 | 55 | ||
| 56 | 56 | int crst_table_upgrade(struct mm_struct *mm, unsigned long end) | |
| 57 | 57 | { | |
| 58 | - | unsigned long *table, *pgd; | |
| 59 | - | int rc, notify; | |
| 58 | + | unsigned long *pgd = NULL, *p4d = NULL, *__pgd; | |
| 59 | + | unsigned long asce_limit = mm->context.asce_limit; | |
| 60 | 60 | ||
| 61 | 61 | mmap_assert_write_locked(mm); | |
| 62 | + | ||
| 62 | 63 | /* upgrade should only happen from 3 to 4, 3 to 5, or 4 to 5 levels */ | |
| 63 | - | VM_BUG_ON(mm->context.asce_limit < _REGION2_SIZE); | |
| 64 | - | rc = 0; | |
| 65 | - | notify = 0; | |
| 66 | - | while (mm->context.asce_limit < end) { | |
| 67 | - | table = crst_table_alloc(mm); | |
| 68 | - | if (!table) { | |
| 69 | - | rc = -ENOMEM; | |
| 70 | - | break; | |
| 71 | - | } | |
| 72 | - | spin_lock_bh(&mm->page_table_lock); | |
| 73 | - | pgd = (unsigned long *)mm->pgd; | |
| 74 | - | if (mm->context.asce_limit == _REGION2_SIZE) { | |
| 75 | - | crst_table_init(table, _REGION2_ENTRY_EMPTY); | |
| 76 | - | p4d_populate(mm, (p4d_t *)table, (pud_t *)pgd); | |
| 77 | - | pagetable_p4d_ctor(virt_to_ptdesc(table)); | |
| 78 | - | mm->pgd = (pgd_t *)table; | |
| 79 | - | mm->context.asce_limit = _REGION1_SIZE; | |
| 80 | - | mm->context.asce = __pa(mm->pgd) | _ASCE_TABLE_LENGTH | | |
| 81 | - | _ASCE_USER_BITS | _ASCE_TYPE_REGION2; | |
| 82 | - | mm_inc_nr_puds(mm); | |
| 83 | - | } else { | |
| 84 | - | crst_table_init(table, _REGION1_ENTRY_EMPTY); | |
| 85 | - | pgd_populate(mm, (pgd_t *)table, (p4d_t *)pgd); | |
| 86 | - | pagetable_pgd_ctor(virt_to_ptdesc(table)); | |
| 87 | - | mm->pgd = (pgd_t *)table; | |
| 88 | - | mm->context.asce_limit = TASK_SIZE_MAX; | |
| 89 | - | mm->context.asce = __pa(mm->pgd) | _ASCE_TABLE_LENGTH | | |
| 90 | - | _ASCE_USER_BITS | _ASCE_TYPE_REGION1; | |
| 91 | - | } | |
| 92 | - | notify = 1; | |
| 93 | - | spin_unlock_bh(&mm->page_table_lock); | |
| 64 | + | VM_BUG_ON(asce_limit < _REGION2_SIZE); | |
| 65 | + | ||
| 66 | + | if (end <= asce_limit) | |
| 67 | + | return 0; | |
| 68 | + | ||
| 69 | + | if (asce_limit == _REGION2_SIZE) { | |
| 70 | + | p4d = crst_table_alloc(mm); | |
| 71 | + | if (unlikely(!p4d)) | |
| 72 | + | goto err_p4d; | |
| 73 | + | crst_table_init(p4d, _REGION2_ENTRY_EMPTY); | |
| 74 | + | pagetable_p4d_ctor(virt_to_ptdesc(p4d)); | |
| 75 | + | } | |
| 76 | + | if (end > _REGION1_SIZE) { | |
| 77 | + | pgd = crst_table_alloc(mm); | |
| 78 | + | if (unlikely(!pgd)) | |
| 79 | + | goto err_pgd; | |
| 80 | + | crst_table_init(pgd, _REGION1_ENTRY_EMPTY); | |
| 81 | + | pagetable_pgd_ctor(virt_to_ptdesc(pgd)); | |
| 82 | + | } | |
| 83 | + | ||
| 84 | + | spin_lock_bh(&mm->page_table_lock); | |
| 85 | + | ||
| 86 | + | if (p4d) { | |
| 87 | + | __pgd = (unsigned long *) mm->pgd; | |
| 88 | + | p4d_populate(mm, (p4d_t *) p4d, (pud_t *) __pgd); | |
| 89 | + | mm->pgd = (pgd_t *) p4d; | |
| 90 | + | mm->context.asce_limit = _REGION1_SIZE; | |
| 91 | + | mm->context.asce = __pa(mm->pgd) | _ASCE_TABLE_LENGTH | | |
| 92 | + | _ASCE_USER_BITS | _ASCE_TYPE_REGION2; | |
| 93 | + | mm_inc_nr_puds(mm); | |
| 94 | 94 | } | |
| 95 | - | if (notify) | |
| 96 | - | on_each_cpu(__crst_table_upgrade, mm, 0); | |
| 97 | - | return rc; | |
| 95 | + | if (pgd) { | |
| 96 | + | __pgd = (unsigned long *) mm->pgd; | |
| 97 | + | pgd_populate(mm, (pgd_t *) pgd, (p4d_t *) __pgd); | |
| 98 | + | mm->pgd = (pgd_t *) pgd; | |
| 99 | + | mm->context.asce_limit = TASK_SIZE_MAX; | |
| 100 | + | mm->context.asce = __pa(mm->pgd) | _ASCE_TABLE_LENGTH | | |
| 101 | + | _ASCE_USER_BITS | _ASCE_TYPE_REGION1; | |
| 102 | + | } | |
| 103 | + | ||
| 104 | + | spin_unlock_bh(&mm->page_table_lock); | |
| 105 | + | ||
| 106 | + | on_each_cpu(__crst_table_upgrade, mm, 0); | |
| 107 | + | ||
| 108 | + | return 0; | |
| 109 | + | ||
| 110 | + | err_pgd: | |
| 111 | + | pagetable_dtor(virt_to_ptdesc(p4d)); | |
| 112 | + | crst_table_free(mm, p4d); | |
| 113 | + | err_p4d: | |
| 114 | + | return -ENOMEM; | |
| 98 | 115 | } | |
| 99 | 116 | ||
| 100 | 117 | unsigned long *page_table_alloc_noprof(struct mm_struct *mm) | |
modified arch/s390/net/bpf_jit_comp.c
| @@ -2566,8 +2566,6 @@ struct bpf_tramp_jit { | |||
| 2566 | 2566 | int r14_off; /* Offset of saved %r14, has to be at the | |
| 2567 | 2567 | * bottom */ | |
| 2568 | 2568 | int do_fexit; /* do_fexit: label */ | |
| 2569 | - | int skip[BPF_MAX_TRAMP_LINKS]; /* skip: labels after each prog */ | |
| 2570 | - | int nr_progs; | |
| 2571 | 2569 | }; | |
| 2572 | 2570 | ||
| 2573 | 2571 | static void load_imm64(struct bpf_jit *jit, int dst_reg, u64 val) | |
| @@ -2586,7 +2584,6 @@ static void emit_store_stack_imm64(struct bpf_jit *jit, int tmp_reg, int stack_o | |||
| 2586 | 2584 | } | |
| 2587 | 2585 | ||
| 2588 | 2586 | static int invoke_bpf_prog(struct bpf_tramp_jit *tjit, | |
| 2589 | - | struct bpf_tramp_image *im, | |
| 2590 | 2587 | const struct btf_func_model *m, | |
| 2591 | 2588 | struct bpf_tramp_node *node, bool save_ret) | |
| 2592 | 2589 | { | |
| @@ -2594,20 +2591,8 @@ static int invoke_bpf_prog(struct bpf_tramp_jit *tjit, | |||
| 2594 | 2591 | int cookie_off = tjit->run_ctx_off + | |
| 2595 | 2592 | offsetof(struct bpf_tramp_run_ctx, bpf_cookie); | |
| 2596 | 2593 | struct bpf_prog *p = node->link->prog; | |
| 2597 | - | void *skip = jit->prg_buf + jit->prg; | |
| 2598 | - | int idx = tjit->nr_progs++; | |
| 2599 | 2594 | int patch; | |
| 2600 | 2595 | ||
| 2601 | - | if (idx >= ARRAY_SIZE(tjit->skip)) | |
| 2602 | - | return -E2BIG; | |
| 2603 | - | ||
| 2604 | - | /* | |
| 2605 | - | * nop, patched to skip this prog when it is detached | |
| 2606 | - | */ | |
| 2607 | - | ||
| 2608 | - | /* brcl 0,skip */ | |
| 2609 | - | EMIT6_PCREL_RILC(0xc0040000, 0, tjit->skip[idx]); | |
| 2610 | - | ||
| 2611 | 2596 | /* | |
| 2612 | 2597 | * run_ctx.cookie = node->cookie; | |
| 2613 | 2598 | */ | |
| @@ -2667,15 +2652,10 @@ static int invoke_bpf_prog(struct bpf_tramp_jit *tjit, | |||
| 2667 | 2652 | /* brasl %r14,__bpf_prog_exit */ | |
| 2668 | 2653 | EMIT6_PCREL_RILB_PTR(0xc0050000, REG_14, bpf_trampoline_exit(p)); | |
| 2669 | 2654 | ||
| 2670 | - | /* skip: */ | |
| 2671 | - | tjit->skip[idx] = jit->prg; | |
| 2672 | - | bpf_tramp_image_add_skip(im, p, skip, jit->prg_buf + jit->prg); | |
| 2673 | - | ||
| 2674 | 2655 | return 0; | |
| 2675 | 2656 | } | |
| 2676 | 2657 | ||
| 2677 | 2658 | static int invoke_bpf(struct bpf_tramp_jit *tjit, | |
| 2678 | - | struct bpf_tramp_image *im, | |
| 2679 | 2659 | const struct btf_func_model *m, | |
| 2680 | 2660 | struct bpf_tramp_nodes *tn, bool save_ret, | |
| 2681 | 2661 | u64 func_meta, int cookie_off) | |
| @@ -2690,7 +2670,7 @@ static int invoke_bpf(struct bpf_tramp_jit *tjit, | |||
| 2690 | 2670 | emit_store_stack_imm64(jit, REG_0, tjit->func_meta_off, meta); | |
| 2691 | 2671 | cur_cookie--; | |
| 2692 | 2672 | } | |
| 2693 | - | if (invoke_bpf_prog(tjit, im, m, tn->nodes[i], save_ret)) | |
| 2673 | + | if (invoke_bpf_prog(tjit, m, tn->nodes[i], save_ret)) | |
| 2694 | 2674 | return -EINVAL; | |
| 2695 | 2675 | } | |
| 2696 | 2676 | ||
| @@ -2732,11 +2712,6 @@ static int __arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, | |||
| 2732 | 2712 | u64 func_meta; | |
| 2733 | 2713 | int i, j; | |
| 2734 | 2714 | ||
| 2735 | - | /* The skip labels are taken from the previous pass. */ | |
| 2736 | - | tjit->nr_progs = 0; | |
| 2737 | - | if (im) | |
| 2738 | - | im->nr_skips = 0; | |
| 2739 | - | ||
| 2740 | 2715 | /* Support as many stack arguments as "mvc" instruction can handle. */ | |
| 2741 | 2716 | nr_reg_args = min_t(int, m->nr_args, MAX_NR_REG_ARGS); | |
| 2742 | 2717 | nr_stack_args = m->nr_args - nr_reg_args; | |
| @@ -2900,7 +2875,7 @@ static int __arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, | |||
| 2900 | 2875 | emit_store_stack_imm64(jit, REG_0, tjit->retval_off, 0); | |
| 2901 | 2876 | } | |
| 2902 | 2877 | ||
| 2903 | - | if (invoke_bpf(tjit, im, m, fentry, flags & BPF_TRAMP_F_RET_FENTRY_RET, | |
| 2878 | + | if (invoke_bpf(tjit, m, fentry, flags & BPF_TRAMP_F_RET_FENTRY_RET, | |
| 2904 | 2879 | func_meta, cookie_off)) | |
| 2905 | 2880 | return -EINVAL; | |
| 2906 | 2881 | ||
| @@ -2914,7 +2889,7 @@ static int __arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, | |||
| 2914 | 2889 | 0xf000 | tjit->retval_off); | |
| 2915 | 2890 | ||
| 2916 | 2891 | for (i = 0; i < fmod_ret->nr_nodes; i++) { | |
| 2917 | - | if (invoke_bpf_prog(tjit, im, m, fmod_ret->nodes[i], true)) | |
| 2892 | + | if (invoke_bpf_prog(tjit, m, fmod_ret->nodes[i], true)) | |
| 2918 | 2893 | return -EINVAL; | |
| 2919 | 2894 | ||
| 2920 | 2895 | /* | |
| @@ -2968,6 +2943,15 @@ static int __arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, | |||
| 2968 | 2943 | /* mvc tccnt_off(%r15),tail_call_cnt(4,%r15) */ | |
| 2969 | 2944 | _EMIT6(0xd203f000 | tjit->tccnt_off, | |
| 2970 | 2945 | 0xf000 | offsetof(struct prog_frame, tail_call_cnt)); | |
| 2946 | + | ||
| 2947 | + | im->ip_after_call = jit->prg_buf + jit->prg; | |
| 2948 | + | ||
| 2949 | + | /* | |
| 2950 | + | * The following nop will be patched by bpf_tramp_image_put(). | |
| 2951 | + | */ | |
| 2952 | + | ||
| 2953 | + | /* brcl 0,im->ip_epilogue */ | |
| 2954 | + | EMIT6_PCREL_RILC(0xc0040000, 0, (u64)im->ip_epilogue); | |
| 2971 | 2955 | } | |
| 2972 | 2956 | ||
| 2973 | 2957 | /* Set the "is_return" flag for fsession. */ | |
| @@ -2978,10 +2962,12 @@ static int __arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, | |||
| 2978 | 2962 | ||
| 2979 | 2963 | /* do_fexit: */ | |
| 2980 | 2964 | tjit->do_fexit = jit->prg; | |
| 2981 | - | if (invoke_bpf(tjit, im, m, fexit, false, func_meta, cookie_off)) | |
| 2965 | + | if (invoke_bpf(tjit, m, fexit, false, func_meta, cookie_off)) | |
| 2982 | 2966 | return -EINVAL; | |
| 2983 | 2967 | ||
| 2984 | 2968 | if (flags & BPF_TRAMP_F_CALL_ORIG) { | |
| 2969 | + | im->ip_epilogue = jit->prg_buf + jit->prg; | |
| 2970 | + | ||
| 2985 | 2971 | /* | |
| 2986 | 2972 | * __bpf_tramp_exit(im); | |
| 2987 | 2973 | */ | |
| @@ -3030,7 +3016,7 @@ static int __arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, | |||
| 3030 | 3016 | int arch_bpf_trampoline_size(const struct btf_func_model *m, u32 flags, | |
| 3031 | 3017 | struct bpf_tramp_nodes *tnodes, void *orig_call) | |
| 3032 | 3018 | { | |
| 3033 | - | struct bpf_tramp_image im = {}; | |
| 3019 | + | struct bpf_tramp_image im; | |
| 3034 | 3020 | struct bpf_tramp_jit tjit; | |
| 3035 | 3021 | int ret; | |
| 3036 | 3022 | ||
modified arch/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/s390/pci/pci_sysfs.c
| @@ -153,9 +153,6 @@ static ssize_t report_error_write(struct file *filp, struct kobject *kobj, | |||
| 153 | 153 | if (off || (count < sizeof(*report))) | |
| 154 | 154 | return -EINVAL; | |
| 155 | 155 | ||
| 156 | - | if (count < (report->length + sizeof(*report))) | |
| 157 | - | return -EINVAL; | |
| 158 | - | ||
| 159 | 156 | ret = sclp_pci_report(report, zdev->fh, zdev->fid); | |
| 160 | 157 | ||
| 161 | 158 | return ret ? ret : count; | |
modified arch/um/drivers/vector_transports.c
| @@ -209,7 +209,6 @@ static int raw_verify_header( | |||
| 209 | 209 | if ((vheader->flags & VIRTIO_NET_HDR_F_DATA_VALID) > 0) | |
| 210 | 210 | return 1; | |
| 211 | 211 | ||
| 212 | - | skb_set_network_header(skb, ETH_HLEN); | |
| 213 | 212 | virtio_net_hdr_to_skb(skb, vheader, virtio_legacy_is_little_endian()); | |
| 214 | 213 | return 0; | |
| 215 | 214 | } | |
modified arch/x86/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/crypto/aesni-intel_glue.c
| @@ -1293,7 +1293,6 @@ static void gcm_process_assoc(const struct aes_gcm_key *key, u8 ghash_acc[16], | |||
| 1293 | 1293 | unsigned int len; | |
| 1294 | 1294 | const u8 *src = walk.addr; | |
| 1295 | 1295 | ||
| 1296 | - | assoclen -= orig_len_this_step; | |
| 1297 | 1296 | if (unlikely(pos)) { | |
| 1298 | 1297 | len = min(len_this_step, 16 - pos); | |
| 1299 | 1298 | memcpy(&buf[pos], src, len); | |
| @@ -1321,6 +1320,7 @@ next: | |||
| 1321 | 1320 | kernel_fpu_end(); | |
| 1322 | 1321 | kernel_fpu_begin(); | |
| 1323 | 1322 | } | |
| 1323 | + | assoclen -= orig_len_this_step; | |
| 1324 | 1324 | } | |
| 1325 | 1325 | if (unlikely(pos)) | |
| 1326 | 1326 | aes_gcm_aad_update(key, ghash_acc, buf, pos, flags); | |
modified arch/x86/crypto/aria-aesni-avx2-asm_64.S
| @@ -982,7 +982,6 @@ SYM_TYPED_FUNC_START(aria_aesni_avx2_encrypt_32way) | |||
| 982 | 982 | %ymm8, %ymm9, %ymm10, %ymm11, %ymm12, %ymm13, %ymm14, | |
| 983 | 983 | %ymm15, %rax); | |
| 984 | 984 | ||
| 985 | - | vzeroupper; | |
| 986 | 985 | FRAME_END | |
| 987 | 986 | RET; | |
| 988 | 987 | SYM_FUNC_END(aria_aesni_avx2_encrypt_32way) | |
| @@ -1008,7 +1007,6 @@ SYM_TYPED_FUNC_START(aria_aesni_avx2_decrypt_32way) | |||
| 1008 | 1007 | %ymm8, %ymm9, %ymm10, %ymm11, %ymm12, %ymm13, %ymm14, | |
| 1009 | 1008 | %ymm15, %rax); | |
| 1010 | 1009 | ||
| 1011 | - | vzeroupper; | |
| 1012 | 1010 | FRAME_END | |
| 1013 | 1011 | RET; | |
| 1014 | 1012 | SYM_FUNC_END(aria_aesni_avx2_decrypt_32way) | |
| @@ -1211,7 +1209,6 @@ SYM_TYPED_FUNC_START(aria_aesni_avx2_ctr_crypt_32way) | |||
| 1211 | 1209 | %ymm8, %ymm9, %ymm10, %ymm11, %ymm12, %ymm13, %ymm14, | |
| 1212 | 1210 | %ymm15, %r10); | |
| 1213 | 1211 | ||
| 1214 | - | vzeroupper; | |
| 1215 | 1212 | FRAME_END | |
| 1216 | 1213 | RET; | |
| 1217 | 1214 | SYM_FUNC_END(aria_aesni_avx2_ctr_crypt_32way) | |
| @@ -1362,7 +1359,6 @@ SYM_TYPED_FUNC_START(aria_aesni_avx2_gfni_encrypt_32way) | |||
| 1362 | 1359 | %ymm8, %ymm9, %ymm10, %ymm11, %ymm12, %ymm13, %ymm14, | |
| 1363 | 1360 | %ymm15, %rax); | |
| 1364 | 1361 | ||
| 1365 | - | vzeroupper; | |
| 1366 | 1362 | FRAME_END | |
| 1367 | 1363 | RET; | |
| 1368 | 1364 | SYM_FUNC_END(aria_aesni_avx2_gfni_encrypt_32way) | |
| @@ -1388,7 +1384,6 @@ SYM_TYPED_FUNC_START(aria_aesni_avx2_gfni_decrypt_32way) | |||
| 1388 | 1384 | %ymm8, %ymm9, %ymm10, %ymm11, %ymm12, %ymm13, %ymm14, | |
| 1389 | 1385 | %ymm15, %rax); | |
| 1390 | 1386 | ||
| 1391 | - | vzeroupper; | |
| 1392 | 1387 | FRAME_END | |
| 1393 | 1388 | RET; | |
| 1394 | 1389 | SYM_FUNC_END(aria_aesni_avx2_gfni_decrypt_32way) | |
| @@ -1433,7 +1428,6 @@ SYM_TYPED_FUNC_START(aria_aesni_avx2_gfni_ctr_crypt_32way) | |||
| 1433 | 1428 | %ymm8, %ymm9, %ymm10, %ymm11, %ymm12, %ymm13, %ymm14, | |
| 1434 | 1429 | %ymm15, %r10); | |
| 1435 | 1430 | ||
| 1436 | - | vzeroupper; | |
| 1437 | 1431 | FRAME_END | |
| 1438 | 1432 | RET; | |
| 1439 | 1433 | SYM_FUNC_END(aria_aesni_avx2_gfni_ctr_crypt_32way) | |
modified arch/x86/crypto/aria-gfni-avx512-asm_64.S
| @@ -800,7 +800,6 @@ SYM_TYPED_FUNC_START(aria_gfni_avx512_encrypt_64way) | |||
| 800 | 800 | %zmm9, %zmm8, %zmm11, %zmm10, %zmm12, %zmm13, %zmm14, | |
| 801 | 801 | %zmm15, %rax); | |
| 802 | 802 | ||
| 803 | - | vzeroupper; | |
| 804 | 803 | FRAME_END | |
| 805 | 804 | RET; | |
| 806 | 805 | SYM_FUNC_END(aria_gfni_avx512_encrypt_64way) | |
| @@ -826,7 +825,6 @@ SYM_TYPED_FUNC_START(aria_gfni_avx512_decrypt_64way) | |||
| 826 | 825 | %zmm9, %zmm8, %zmm11, %zmm10, %zmm12, %zmm13, %zmm14, | |
| 827 | 826 | %zmm15, %rax); | |
| 828 | 827 | ||
| 829 | - | vzeroupper; | |
| 830 | 828 | FRAME_END | |
| 831 | 829 | RET; | |
| 832 | 830 | SYM_FUNC_END(aria_gfni_avx512_decrypt_64way) | |
| @@ -968,7 +966,6 @@ SYM_TYPED_FUNC_START(aria_gfni_avx512_ctr_crypt_64way) | |||
| 968 | 966 | %zmm9, %zmm8, %zmm11, %zmm10, %zmm12, %zmm13, %zmm14, | |
| 969 | 967 | %zmm15, %r10); | |
| 970 | 968 | ||
| 971 | - | vzeroupper; | |
| 972 | 969 | FRAME_END | |
| 973 | 970 | RET; | |
| 974 | 971 | SYM_FUNC_END(aria_gfni_avx512_ctr_crypt_64way) | |
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/entry/vdso/vdso64/Makefile
| @@ -14,7 +14,7 @@ vobjs-$(CONFIG_X86_SGX) += vsgx.o | |||
| 14 | 14 | vobjs-$(CONFIG_FUTEX_ROBUST_UNLOCK) += vfutex.o | |
| 15 | 15 | ||
| 16 | 16 | # Compilation flags | |
| 17 | - | flags-y := -DBUILD_VDSO64 -m64 -mcmodel=small $(CONFIG_CC_OPT_INLINE_MEMSET) | |
| 17 | + | flags-y := -DBUILD_VDSO64 -m64 -mcmodel=small | |
| 18 | 18 | ||
| 19 | 19 | # The location of this include matters! | |
| 20 | 20 | include $(src)/../common/Makefile.include | |
modified arch/x86/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), | |
| @@ -3135,27 +3125,6 @@ static void intel_pmu_del_event(struct perf_event *event) | |||
| 3135 | 3125 | this_cpu_ptr(&cpu_hw_events)->n_late_setup--; | |
| 3136 | 3126 | } | |
| 3137 | 3127 | ||
| 3138 | - | int __intel_pmu_quiesce(void) | |
| 3139 | - | { | |
| 3140 | - | struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events); | |
| 3141 | - | int pmu_enabled = cpuc->enabled; | |
| 3142 | - | ||
| 3143 | - | cpuc->enabled = 0; | |
| 3144 | - | if (pmu_enabled) | |
| 3145 | - | intel_pmu_disable_all(); | |
| 3146 | - | ||
| 3147 | - | return pmu_enabled; | |
| 3148 | - | } | |
| 3149 | - | ||
| 3150 | - | void __intel_pmu_resume(int pmu_enabled) | |
| 3151 | - | { | |
| 3152 | - | struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events); | |
| 3153 | - | ||
| 3154 | - | cpuc->enabled = pmu_enabled; | |
| 3155 | - | if (pmu_enabled) | |
| 3156 | - | intel_pmu_enable_all(0); | |
| 3157 | - | } | |
| 3158 | - | ||
| 3159 | 3128 | static int icl_set_topdown_event_period(struct perf_event *event) | |
| 3160 | 3129 | { | |
| 3161 | 3130 | struct hw_perf_event *hwc = &event->hw; | |
| @@ -3347,13 +3316,16 @@ static void intel_pmu_read_event(struct perf_event *event) | |||
| 3347 | 3316 | if (event->hw.flags & (PERF_X86_EVENT_AUTO_RELOAD | PERF_X86_EVENT_TOPDOWN) || | |
| 3348 | 3317 | is_pebs_counter_event_group(event)) { | |
| 3349 | 3318 | struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events); | |
| 3350 | - | int pmu_enabled; | |
| 3319 | + | bool pmu_enabled = cpuc->enabled; | |
| 3351 | 3320 | ||
| 3352 | 3321 | /* Only need to call update_topdown_event() once for group read. */ | |
| 3353 | 3322 | if (is_metric_event(event) && (cpuc->txn_flags & PERF_PMU_TXN_READ)) | |
| 3354 | 3323 | return; | |
| 3355 | 3324 | ||
| 3356 | - | pmu_enabled = __intel_pmu_quiesce(); | |
| 3325 | + | cpuc->enabled = 0; | |
| 3326 | + | if (pmu_enabled) | |
| 3327 | + | intel_pmu_disable_all(); | |
| 3328 | + | ||
| 3357 | 3329 | /* | |
| 3358 | 3330 | * If the PEBS counters snapshotting is enabled, | |
| 3359 | 3331 | * the topdown event is available in PEBS records. | |
| @@ -3362,7 +3334,10 @@ static void intel_pmu_read_event(struct perf_event *event) | |||
| 3362 | 3334 | static_call(intel_pmu_update_topdown_event)(event, NULL); | |
| 3363 | 3335 | else | |
| 3364 | 3336 | intel_pmu_drain_pebs_buffer(); | |
| 3365 | - | __intel_pmu_resume(pmu_enabled); | |
| 3337 | + | ||
| 3338 | + | cpuc->enabled = pmu_enabled; | |
| 3339 | + | if (pmu_enabled) | |
| 3340 | + | intel_pmu_enable_all(0); | |
| 3366 | 3341 | ||
| 3367 | 3342 | return; | |
| 3368 | 3343 | } | |
| @@ -5302,15 +5277,12 @@ static struct perf_guest_switch_msr *intel_guest_get_msrs(int *nr, void *data) | |||
| 5302 | 5277 | struct kvm_pmu *kvm_pmu = (struct kvm_pmu *)data; | |
| 5303 | 5278 | u64 intel_ctrl = hybrid(cpuc->pmu, intel_ctrl); | |
| 5304 | 5279 | u64 pebs_mask = cpuc->pebs_enabled & x86_pmu.pebs_capable; | |
| 5305 | - | u64 guest_pebs_mask; | |
| 5306 | - | int global_ctrl; | |
| 5280 | + | int global_ctrl, pebs_enable; | |
| 5307 | 5281 | ||
| 5308 | 5282 | /* | |
| 5309 | 5283 | * In addition to obeying exclude_guest/exclude_host, remove bits being | |
| 5310 | 5284 | * 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. | |
| 5285 | + | * addresses (not physical addresses). | |
| 5314 | 5286 | */ | |
| 5315 | 5287 | *nr = 0; | |
| 5316 | 5288 | global_ctrl = (*nr)++; | |
| @@ -5340,68 +5312,41 @@ static struct perf_guest_switch_msr *intel_guest_get_msrs(int *nr, void *data) | |||
| 5340 | 5312 | return arr; | |
| 5341 | 5313 | } | |
| 5342 | 5314 | ||
| 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) | |
| 5315 | + | if (!kvm_pmu || !x86_pmu.pebs_ept) | |
| 5349 | 5316 | return arr; | |
| 5350 | 5317 | ||
| 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 | 5318 | arr[(*nr)++] = (struct perf_guest_switch_msr){ | |
| 5383 | 5319 | .msr = MSR_IA32_DS_AREA, | |
| 5384 | 5320 | .host = (unsigned long)cpuc->ds, | |
| 5385 | - | .guest = guest_pebs_mask ? kvm_pmu->ds_area : (unsigned long)cpuc->ds, | |
| 5321 | + | .guest = kvm_pmu->ds_area, | |
| 5386 | 5322 | }; | |
| 5387 | 5323 | ||
| 5388 | 5324 | if (x86_pmu.intel_cap.pebs_baseline) { | |
| 5389 | 5325 | arr[(*nr)++] = (struct perf_guest_switch_msr){ | |
| 5390 | 5326 | .msr = MSR_PEBS_DATA_CFG, | |
| 5391 | 5327 | .host = cpuc->active_pebs_data_cfg, | |
| 5392 | - | .guest = guest_pebs_mask ? kvm_pmu->pebs_data_cfg : | |
| 5393 | - | cpuc->active_pebs_data_cfg, | |
| 5328 | + | .guest = kvm_pmu->pebs_data_cfg, | |
| 5394 | 5329 | }; | |
| 5395 | 5330 | } | |
| 5396 | 5331 | ||
| 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; | |
| 5332 | + | pebs_enable = (*nr)++; | |
| 5333 | + | arr[pebs_enable] = (struct perf_guest_switch_msr){ | |
| 5334 | + | .msr = MSR_IA32_PEBS_ENABLE, | |
| 5335 | + | .host = cpuc->pebs_enabled & ~cpuc->intel_ctrl_guest_mask, | |
| 5336 | + | .guest = pebs_mask & ~cpuc->intel_ctrl_host_mask & kvm_pmu->pebs_enable, | |
| 5337 | + | }; | |
| 5338 | + | ||
| 5339 | + | if (arr[pebs_enable].host) { | |
| 5340 | + | /* Disable guest PEBS if host PEBS is enabled. */ | |
| 5341 | + | arr[pebs_enable].guest = 0; | |
| 5342 | + | } else { | |
| 5343 | + | /* Disable guest PEBS thoroughly for cross-mapped PEBS counters. */ | |
| 5344 | + | arr[pebs_enable].guest &= ~kvm_pmu->host_cross_mapped_mask; | |
| 5345 | + | arr[global_ctrl].guest &= ~kvm_pmu->host_cross_mapped_mask; | |
| 5346 | + | /* Set hw GLOBAL_CTRL bits for PEBS counter when it runs for guest */ | |
| 5347 | + | arr[global_ctrl].guest |= arr[pebs_enable].guest; | |
| 5348 | + | } | |
| 5349 | + | ||
| 5405 | 5350 | return arr; | |
| 5406 | 5351 | } | |
| 5407 | 5352 | ||
| @@ -6601,8 +6546,6 @@ static void intel_pmu_filter(struct pmu *pmu, int cpu, bool *ret) | |||
| 6601 | 6546 | ||
| 6602 | 6547 | PMU_FORMAT_ATTR(offcore_rsp, "config1:0-63"); | |
| 6603 | 6548 | ||
| 6604 | - | PMU_FORMAT_ATTR(offmodule_rsp, "config1:0-63"); | |
| 6605 | - | ||
| 6606 | 6549 | PMU_FORMAT_ATTR(ldlat, "config1:0-15"); | |
| 6607 | 6550 | ||
| 6608 | 6551 | PMU_FORMAT_ATTR(frontend, "config1:0-23"); | |
| @@ -6651,20 +6594,6 @@ static struct attribute *skl_format_attr[] = { | |||
| 6651 | 6594 | NULL, | |
| 6652 | 6595 | }; | |
| 6653 | 6596 | ||
| 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 | 6597 | static __initconst const struct x86_pmu core_pmu = { | |
| 6669 | 6598 | .name = "core", | |
| 6670 | 6599 | .handle_irq = x86_pmu_handle_irq, | |
| @@ -7530,7 +7459,6 @@ static struct attribute *adl_hybrid_tsx_attrs[] = { | |||
| 7530 | 7459 | FORMAT_ATTR_HYBRID(in_tx, hybrid_big); | |
| 7531 | 7460 | FORMAT_ATTR_HYBRID(in_tx_cp, hybrid_big); | |
| 7532 | 7461 | FORMAT_ATTR_HYBRID(offcore_rsp, hybrid_big_small_tiny); | |
| 7533 | - | FORMAT_ATTR_HYBRID(offmodule_rsp, hybrid_big_small_tiny); | |
| 7534 | 7462 | FORMAT_ATTR_HYBRID(ldlat, hybrid_big_small_tiny); | |
| 7535 | 7463 | FORMAT_ATTR_HYBRID(frontend, hybrid_big); | |
| 7536 | 7464 | ||
| @@ -7569,23 +7497,6 @@ static struct attribute *mtl_hybrid_extra_attr[] = { | |||
| 7569 | 7497 | NULL | |
| 7570 | 7498 | }; | |
| 7571 | 7499 | ||
| 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 | 7500 | static bool is_attr_for_this_pmu(struct kobject *kobj, struct attribute *attr) | |
| 7590 | 7501 | { | |
| 7591 | 7502 | struct device *dev = kobj_to_dev(kobj); | |
| @@ -8623,8 +8534,6 @@ __init int intel_pmu_init(void) | |||
| 8623 | 8534 | case INTEL_DIAMONDRAPIDS_X: | |
| 8624 | 8535 | intel_pmu_init_pnc(NULL); | |
| 8625 | 8536 | 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 | 8537 | ||
| 8629 | 8538 | pr_cont("Panthercove events, "); | |
| 8630 | 8539 | name = "panthercove"; | |
| @@ -8633,12 +8542,13 @@ __init int intel_pmu_init(void) | |||
| 8633 | 8542 | glc_common: | |
| 8634 | 8543 | intel_pmu_init_glc(NULL); | |
| 8635 | 8544 | intel_pmu_pebs_data_source_skl(true); | |
| 8636 | - | extra_attr = boot_cpu_has(X86_FEATURE_RTM) ? | |
| 8637 | - | hsw_format_attr : nhm_format_attr; | |
| 8545 | + | ||
| 8638 | 8546 | glc_base: | |
| 8639 | 8547 | x86_pmu.pebs_ept = 1; | |
| 8640 | 8548 | x86_pmu.hw_config = hsw_hw_config; | |
| 8641 | 8549 | x86_pmu.get_event_constraints = glc_get_event_constraints; | |
| 8550 | + | extra_attr = boot_cpu_has(X86_FEATURE_RTM) ? | |
| 8551 | + | hsw_format_attr : nhm_format_attr; | |
| 8642 | 8552 | extra_skl_attr = skl_format_attr; | |
| 8643 | 8553 | mem_attr = glc_events_attrs; | |
| 8644 | 8554 | td_attr = glc_td_events_attrs; | |
| @@ -8860,7 +8770,7 @@ __init int intel_pmu_init(void) | |||
| 8860 | 8770 | mem_attr = mtl_hybrid_mem_attrs; | |
| 8861 | 8771 | tsx_attr = adl_hybrid_tsx_attrs; | |
| 8862 | 8772 | extra_attr = boot_cpu_has(X86_FEATURE_RTM) ? | |
| 8863 | - | nvl_hybrid_extra_attr_rtm : nvl_hybrid_extra_attr; | |
| 8773 | + | mtl_hybrid_extra_attr_rtm : mtl_hybrid_extra_attr; | |
| 8864 | 8774 | ||
| 8865 | 8775 | /* Initialize big core specific PerfMon capabilities.*/ | |
| 8866 | 8776 | pmu = &x86_pmu.hybrid_pmu[X86_HYBRID_PMU_CORE_IDX]; | |
| @@ -8869,6 +8779,8 @@ __init int intel_pmu_init(void) | |||
| 8869 | 8779 | /* Initialize Atom core specific PerfMon capabilities.*/ | |
| 8870 | 8780 | pmu = &x86_pmu.hybrid_pmu[X86_HYBRID_PMU_ATOM_IDX]; | |
| 8871 | 8781 | intel_pmu_init_arw(&pmu->pmu); | |
| 8782 | + | ||
| 8783 | + | intel_pmu_pebs_data_source_lnl(); | |
| 8872 | 8784 | break; | |
| 8873 | 8785 | ||
| 8874 | 8786 | 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; | |
| @@ -1264,11 +1242,8 @@ unlock: | |||
| 1264 | 1242 | ||
| 1265 | 1243 | void intel_pmu_drain_pebs_buffer(void) | |
| 1266 | 1244 | { | |
| 1267 | - | struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events); | |
| 1268 | 1245 | struct perf_sample_data data; | |
| 1269 | 1246 | ||
| 1270 | - | WARN_ON_ONCE(cpuc->enabled); | |
| 1271 | - | ||
| 1272 | 1247 | static_call(x86_pmu_drain_pebs)(NULL, &data); | |
| 1273 | 1248 | } | |
| 1274 | 1249 | ||
| @@ -1313,22 +1288,22 @@ struct event_constraint intel_glm_pebs_event_constraints[] = { | |||
| 1313 | 1288 | ||
| 1314 | 1289 | struct event_constraint intel_grt_pebs_event_constraints[] = { | |
| 1315 | 1290 | /* Allow all events as PEBS with no flags */ | |
| 1316 | - | INTEL_HYBRID_LDLAT_CONSTRAINT(0x5d0, 0x3), | |
| 1317 | - | INTEL_HYBRID_STLAT_CONSTRAINT(0x6d0, 0x3f), | |
| 1291 | + | INTEL_HYBRID_LAT_CONSTRAINT(0x5d0, 0x3), | |
| 1292 | + | INTEL_HYBRID_LAT_CONSTRAINT(0x6d0, 0x3f), | |
| 1318 | 1293 | EVENT_CONSTRAINT_END | |
| 1319 | 1294 | }; | |
| 1320 | 1295 | ||
| 1321 | 1296 | struct event_constraint intel_cmt_pebs_event_constraints[] = { | |
| 1322 | 1297 | /* Allow all events as PEBS with no flags */ | |
| 1323 | - | INTEL_HYBRID_LDLAT_CONSTRAINT(0x5d0, 0x3), | |
| 1324 | - | INTEL_HYBRID_STLAT_CONSTRAINT(0x6d0, 0xff), | |
| 1298 | + | INTEL_HYBRID_LAT_CONSTRAINT(0x5d0, 0x3), | |
| 1299 | + | INTEL_HYBRID_LAT_CONSTRAINT(0x6d0, 0xff), | |
| 1325 | 1300 | EVENT_CONSTRAINT_END | |
| 1326 | 1301 | }; | |
| 1327 | 1302 | ||
| 1328 | 1303 | struct event_constraint intel_dkt_pebs_event_constraints[] = { | |
| 1329 | 1304 | /* Allow all events as PEBS with no flags */ | |
| 1330 | - | INTEL_HYBRID_LDLAT_CONSTRAINT(0x5d0, 0xff), | |
| 1331 | - | INTEL_HYBRID_STLAT_CONSTRAINT(0x6d0, 0xff), | |
| 1305 | + | INTEL_HYBRID_LAT_CONSTRAINT(0x5d0, 0xff), | |
| 1306 | + | INTEL_HYBRID_LAT_CONSTRAINT(0x6d0, 0xff), | |
| 1332 | 1307 | EVENT_CONSTRAINT_END | |
| 1333 | 1308 | }; | |
| 1334 | 1309 | ||
| @@ -1518,8 +1493,24 @@ struct event_constraint intel_lnc_pebs_event_constraints[] = { | |||
| 1518 | 1493 | INTEL_FLAGS_UEVENT_CONSTRAINT(0x012a, 0x1), /* OCR.* events */ | |
| 1519 | 1494 | INTEL_FLAGS_UEVENT_CONSTRAINT(0x012b, 0x1), /* OCR.* events */ | |
| 1520 | 1495 | ||
| 1496 | + | INTEL_FLAGS_UEVENT_CONSTRAINT(0x04a4, 0x1), /* TOPDOWN.BAD_SPEC_SLOTS */ | |
| 1497 | + | INTEL_FLAGS_UEVENT_CONSTRAINT(0x08a4, 0x1), /* TOPDOWN.BR_MISPREDICT_SLOTS */ | |
| 1498 | + | INTEL_FLAGS_UEVENT_CONSTRAINT(0x10a4, 0x8), /* TOPDOWN.MEMORY_BOUND_SLOTS */ | |
| 1499 | + | ||
| 1521 | 1500 | INTEL_HYBRID_LDLAT_CONSTRAINT(0x1cd, 0x3fc), | |
| 1522 | 1501 | INTEL_HYBRID_STLAT_CONSTRAINT(0x2cd, 0x3), | |
| 1502 | + | INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_LD(0x11d0, 0xf), /* MEM_INST_RETIRED.STLB_MISS_LOADS */ | |
| 1503 | + | INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_ST(0x12d0, 0xf), /* MEM_INST_RETIRED.STLB_MISS_STORES */ | |
| 1504 | + | INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_LD(0x21d0, 0xf), /* MEM_INST_RETIRED.LOCK_LOADS */ | |
| 1505 | + | INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_LD(0x41d0, 0xf), /* MEM_INST_RETIRED.SPLIT_LOADS */ | |
| 1506 | + | INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_ST(0x42d0, 0xf), /* MEM_INST_RETIRED.SPLIT_STORES */ | |
| 1507 | + | INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_LD(0x81d0, 0xf), /* MEM_INST_RETIRED.ALL_LOADS */ | |
| 1508 | + | INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_ST(0x82d0, 0xf), /* MEM_INST_RETIRED.ALL_STORES */ | |
| 1509 | + | INTEL_FLAGS_UEVENT_CONSTRAINT(0x87d0, 0x3ff), /* MEM_INST_RETIRED.ANY */ | |
| 1510 | + | ||
| 1511 | + | INTEL_FLAGS_EVENT_CONSTRAINT_DATALA_LD_RANGE(0xd1, 0xd4, 0xf), | |
| 1512 | + | ||
| 1513 | + | INTEL_FLAGS_EVENT_CONSTRAINT(0xd0, 0xf), | |
| 1523 | 1514 | ||
| 1524 | 1515 | /* | |
| 1525 | 1516 | * Everything else is handled by PMU_FL_PEBS_ALL, because we | |
| @@ -1532,6 +1523,18 @@ struct event_constraint intel_lnc_pebs_event_constraints[] = { | |||
| 1532 | 1523 | struct event_constraint intel_pnc_pebs_event_constraints[] = { | |
| 1533 | 1524 | INTEL_HYBRID_LDLAT_CONSTRAINT(0x1cd, 0xfc), | |
| 1534 | 1525 | INTEL_HYBRID_STLAT_CONSTRAINT(0x2cd, 0x3), | |
| 1526 | + | INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_LD(0x11d0, 0xf), /* MEM_INST_RETIRED.STLB_MISS_LOADS */ | |
| 1527 | + | INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_ST(0x12d0, 0xf), /* MEM_INST_RETIRED.STLB_MISS_STORES */ | |
| 1528 | + | INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_LD(0x21d0, 0xf), /* MEM_INST_RETIRED.LOCK_LOADS */ | |
| 1529 | + | INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_LD(0x41d0, 0xf), /* MEM_INST_RETIRED.SPLIT_LOADS */ | |
| 1530 | + | INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_ST(0x42d0, 0xf), /* MEM_INST_RETIRED.SPLIT_STORES */ | |
| 1531 | + | INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_LD(0x81d0, 0xf), /* MEM_INST_RETIRED.ALL_LOADS */ | |
| 1532 | + | INTEL_FLAGS_UEVENT_CONSTRAINT_DATALA_ST(0x82d0, 0xf), /* MEM_INST_RETIRED.ALL_STORES */ | |
| 1533 | + | ||
| 1534 | + | INTEL_FLAGS_EVENT_CONSTRAINT_DATALA_LD_RANGE(0xd1, 0xd4, 0xf), | |
| 1535 | + | ||
| 1536 | + | INTEL_FLAGS_EVENT_CONSTRAINT(0xd0, 0xf), | |
| 1537 | + | INTEL_FLAGS_EVENT_CONSTRAINT(0xd6, 0xf), | |
| 1535 | 1538 | ||
| 1536 | 1539 | /* | |
| 1537 | 1540 | * Everything else is handled by PMU_FL_PEBS_ALL, because we | |
| @@ -1861,11 +1864,8 @@ static void intel_pmu_pebs_via_pt_enable(struct perf_event *event) | |||
| 1861 | 1864 | static inline void intel_pmu_drain_large_pebs(struct cpu_hw_events *cpuc) | |
| 1862 | 1865 | { | |
| 1863 | 1866 | if (cpuc->n_pebs == cpuc->n_large_pebs && | |
| 1864 | - | cpuc->n_pebs != cpuc->n_pebs_via_pt) { | |
| 1865 | - | int enabled = __intel_pmu_quiesce(); | |
| 1867 | + | cpuc->n_pebs != cpuc->n_pebs_via_pt) | |
| 1866 | 1868 | intel_pmu_drain_pebs_buffer(); | |
| 1867 | - | __intel_pmu_resume(enabled); | |
| 1868 | - | } | |
| 1869 | 1869 | } | |
| 1870 | 1870 | ||
| 1871 | 1871 | static void __intel_pmu_pebs_enable(struct perf_event *event) | |
| @@ -2432,7 +2432,7 @@ static inline void __setup_pebs_basic_group(struct perf_event *event, | |||
| 2432 | 2432 | { | |
| 2433 | 2433 | /* The ip in basic is EventingIP */ | |
| 2434 | 2434 | set_linear_ip(regs, ip); | |
| 2435 | - | regs->flags |= PERF_EFLAGS_EXACT; | |
| 2435 | + | regs->flags = PERF_EFLAGS_EXACT; | |
| 2436 | 2436 | setup_pebs_time(event, data, tsc); | |
| 2437 | 2437 | ||
| 2438 | 2438 | if (sample_type & PERF_SAMPLE_WEIGHT_STRUCT) | |
| @@ -2444,17 +2444,9 @@ static inline void __setup_pebs_gpr_group(struct perf_event *event, | |||
| 2444 | 2444 | struct pebs_gprs *gprs, | |
| 2445 | 2445 | u64 sample_type) | |
| 2446 | 2446 | { | |
| 2447 | - | /* | |
| 2448 | - | * Update flags with PEBS data. PERF_EFLAGS_EXACT must be set | |
| 2449 | - | * in previous basic group handling. | |
| 2450 | - | */ | |
| 2451 | - | regs->flags = gprs->flags | PERF_EFLAGS_EXACT; | |
| 2452 | - | ||
| 2453 | 2447 | if (event->attr.precise_ip < 2) { | |
| 2454 | 2448 | set_linear_ip(regs, gprs->ip); | |
| 2455 | 2449 | regs->flags &= ~PERF_EFLAGS_EXACT; | |
| 2456 | - | } else if (regs->flags & X86_VM_MASK) { | |
| 2457 | - | regs->flags ^= (PERF_EFLAGS_VM | X86_VM_MASK); | |
| 2458 | 2450 | } | |
| 2459 | 2451 | ||
| 2460 | 2452 | if (sample_type & (PERF_SAMPLE_REGS_INTR | PERF_SAMPLE_REGS_USER)) | |
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) | |
| @@ -1634,9 +1638,6 @@ static __always_inline void __intel_pmu_lbr_disable(void) | |||
| 1634 | 1638 | wrmsrq(MSR_IA32_DEBUGCTLMSR, debugctl); | |
| 1635 | 1639 | } | |
| 1636 | 1640 | ||
| 1637 | - | extern int __intel_pmu_quiesce(void); | |
| 1638 | - | extern void __intel_pmu_resume(int pmu_enabled); | |
| 1639 | - | ||
| 1640 | 1641 | int intel_pmu_save_and_restart(struct perf_event *event); | |
| 1641 | 1642 | ||
| 1642 | 1643 | struct event_constraint * | |
modified arch/x86/include/asm/cpufeatures.h
| @@ -477,8 +477,6 @@ | |||
| 477 | 477 | #define X86_FEATURE_NO_NESTED_DATA_BP (20*32+ 0) /* No Nested Data Breakpoints */ | |
| 478 | 478 | #define X86_FEATURE_WRMSR_XX_BASE_NS (20*32+ 1) /* WRMSR to {FS,GS,KERNEL_GS}_BASE is non-serializing */ | |
| 479 | 479 | #define X86_FEATURE_LFENCE_RDTSC (20*32+ 2) /* LFENCE always serializing / synchronizes RDTSC */ | |
| 480 | - | ||
| 481 | - | #define X86_FEATURE_TLBSYNC_SFW_NO (20*32+ 4) /* TLBI Erratum #1718 fixed in microcode */ | |
| 482 | 480 | #define X86_FEATURE_VERW_CLEAR (20*32+ 5) /* The memory form of VERW mitigates TSA */ | |
| 483 | 481 | #define X86_FEATURE_NULL_SEL_CLR_BASE (20*32+ 6) /* Null Selector Clears Base */ | |
| 484 | 482 | ||
| @@ -589,5 +587,4 @@ | |||
| 589 | 587 | #define X86_BUG_TSA X86_BUG( 1*32+ 9) /* "tsa" CPU is affected by Transient Scheduler Attacks */ | |
| 590 | 588 | #define X86_BUG_VMSCAPE X86_BUG( 1*32+10) /* "vmscape" CPU is affected by VMSCAPE attacks from guests */ | |
| 591 | 589 | #define X86_BUG_SEAMRET_INVD_VMCS X86_BUG( 1*32+11) /* "seamret_invd_vmcs" SEAMRET from P-SEAMLDR clears the current VMCS */ | |
| 592 | - | #define X86_BUG_TLBI X86_BUG( 1*32+12) /* "tlbi" AMD TLBI Erratum #1718 */ | |
| 593 | 590 | #endif /* _ASM_X86_CPUFEATURES_H */ | |
modified arch/x86/include/asm/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/include/asm/tlb.h
| @@ -110,12 +110,6 @@ static inline void __tlbsync(void) | |||
| 110 | 110 | ||
| 111 | 111 | /* TLBSYNC: supported in binutils >= 0.36. */ | |
| 112 | 112 | asm volatile(".byte 0x0f, 0x01, 0xff" ::: "memory"); | |
| 113 | - | ||
| 114 | - | if (!static_cpu_has_bug(X86_BUG_TLBI)) | |
| 115 | - | return; | |
| 116 | - | ||
| 117 | - | /* TLBSYNC: supported in binutils >= 0.36. */ | |
| 118 | - | asm volatile(".byte 0x0f, 0x01, 0xff" ::: "memory"); | |
| 119 | 113 | } | |
| 120 | 114 | #else | |
| 121 | 115 | /* Some compilers (I'm looking at you clang!) simply can't do DCE */ | |
modified arch/x86/include/uapi/asm/ptrace-abi.h
| @@ -2,7 +2,6 @@ | |||
| 2 | 2 | #ifndef _ASM_X86_PTRACE_ABI_H | |
| 3 | 3 | #define _ASM_X86_PTRACE_ABI_H | |
| 4 | 4 | ||
| 5 | - | #if defined(__ASSEMBLER__) || defined(__FRAME_OFFSETS) | |
| 6 | 5 | #ifdef __i386__ | |
| 7 | 6 | ||
| 8 | 7 | #define EBX 0 | |
| @@ -26,6 +25,7 @@ | |||
| 26 | 25 | ||
| 27 | 26 | #else /* __i386__ */ | |
| 28 | 27 | ||
| 28 | + | #if defined(__ASSEMBLER__) || defined(__FRAME_OFFSETS) | |
| 29 | 29 | /* | |
| 30 | 30 | * C ABI says these regs are callee-preserved. They aren't saved on kernel entry | |
| 31 | 31 | * unless syscall needs a complete, fully filled "struct pt_regs". | |
| @@ -57,12 +57,12 @@ | |||
| 57 | 57 | #define EFLAGS 144 | |
| 58 | 58 | #define RSP 152 | |
| 59 | 59 | #define SS 160 | |
| 60 | + | #endif /* __ASSEMBLER__ */ | |
| 60 | 61 | ||
| 61 | 62 | /* top of stack page */ | |
| 62 | 63 | #define FRAME_SIZE 168 | |
| 63 | 64 | ||
| 64 | 65 | #endif /* !__i386__ */ | |
| 65 | - | #endif /* defined(__ASSEMBLER__) || defined(__FRAME_OFFSETS) */ | |
| 66 | 66 | ||
| 67 | 67 | /* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */ | |
| 68 | 68 | #define PTRACE_GETREGS 12 | |
modified arch/x86/kernel/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
| @@ -38,6 +38,7 @@ static struct pci_dev **amd_roots; | |||
| 38 | 38 | ||
| 39 | 39 | /* Protect the PCI config register pairs used for SMN. */ | |
| 40 | 40 | static DEFINE_MUTEX(smn_mutex); | |
| 41 | + | static bool smn_exclusive; | |
| 41 | 42 | ||
| 42 | 43 | #define SMN_INDEX_OFFSET 0x60 | |
| 43 | 44 | #define SMN_DATA_OFFSET 0x64 | |
| @@ -90,18 +91,13 @@ static int __amd_smn_rw(u8 i_off, u8 d_off, u16 node, u32 address, u32 *value, b | |||
| 90 | 91 | if (node >= amd_num_nodes()) | |
| 91 | 92 | return err; | |
| 92 | 93 | ||
| 93 | - | /* | |
| 94 | - | * Uninitialized amd_roots indicates pci_request_config_region_exclusive() | |
| 95 | - | * didn't run or failed and thus the kernel cannot rely on having | |
| 96 | - | * exclusive access to SMN registers so prevent that. | |
| 97 | - | */ | |
| 98 | - | if (!amd_roots) | |
| 99 | - | return err; | |
| 100 | - | ||
| 101 | 94 | root = amd_roots[node]; | |
| 102 | 95 | if (!root) | |
| 103 | 96 | return err; | |
| 104 | 97 | ||
| 98 | + | if (!smn_exclusive) | |
| 99 | + | return err; | |
| 100 | + | ||
| 105 | 101 | guard(mutex)(&smn_mutex); | |
| 106 | 102 | ||
| 107 | 103 | err = pci_write_config_dword(root, i_off, address); | |
| @@ -251,7 +247,7 @@ __setup("amd_smn_debugfs_enable", amd_smn_enable_dfs); | |||
| 251 | 247 | static int __init amd_smn_init(void) | |
| 252 | 248 | { | |
| 253 | 249 | u16 count, num_roots, roots_per_node, node, num_nodes; | |
| 254 | - | struct pci_dev *root __free(pci_dev_put) = NULL; | |
| 250 | + | struct pci_dev *root; | |
| 255 | 251 | ||
| 256 | 252 | if (!cpu_feature_enabled(X86_FEATURE_ZEN)) | |
| 257 | 253 | return 0; | |
| @@ -262,6 +258,7 @@ static int __init amd_smn_init(void) | |||
| 262 | 258 | return 0; | |
| 263 | 259 | ||
| 264 | 260 | num_roots = 0; | |
| 261 | + | root = NULL; | |
| 265 | 262 | while ((root = get_next_root(root))) { | |
| 266 | 263 | pci_dbg(root, "Reserving PCI config space\n"); | |
| 267 | 264 | ||
| @@ -290,21 +287,17 @@ static int __init amd_smn_init(void) | |||
| 290 | 287 | return -ENOMEM; | |
| 291 | 288 | ||
| 292 | 289 | roots_per_node = num_roots / num_nodes; | |
| 293 | - | if (!roots_per_node) { | |
| 294 | - | if (!cpu_feature_enabled(X86_FEATURE_HYPERVISOR)) | |
| 295 | - | pr_warn(FW_BUG "Error detecting roots per node.\n"); | |
| 296 | - | roots_per_node = 1; | |
| 297 | - | } | |
| 298 | 290 | ||
| 299 | 291 | count = 0; | |
| 300 | 292 | node = 0; | |
| 293 | + | root = NULL; | |
| 301 | 294 | while (node < num_nodes && (root = get_next_root(root))) { | |
| 302 | 295 | /* Use one root for each node and skip the rest. */ | |
| 303 | 296 | if (count++ % roots_per_node) | |
| 304 | 297 | continue; | |
| 305 | 298 | ||
| 306 | 299 | pci_dbg(root, "is root for AMD node %u\n", node); | |
| 307 | - | amd_roots[node++] = pci_dev_get(root); | |
| 300 | + | amd_roots[node++] = root; | |
| 308 | 301 | } | |
| 309 | 302 | ||
| 310 | 303 | if (enable_dfs) { | |
| @@ -315,6 +308,8 @@ static int __init amd_smn_init(void) | |||
| 315 | 308 | debugfs_create_file("value", 0600, debugfs_dir, NULL, &smn_value_fops); | |
| 316 | 309 | } | |
| 317 | 310 | ||
| 311 | + | smn_exclusive = true; | |
| 312 | + | ||
| 318 | 313 | return 0; | |
| 319 | 314 | } | |
| 320 | 315 | ||
modified arch/x86/kernel/cpu/amd.c
| @@ -1049,10 +1049,6 @@ static void init_amd_zen5(struct cpuinfo_x86 *c) | |||
| 1049 | 1049 | msr_clear_bit(MSR_AMD64_CPUID_FN_7, 18); | |
| 1050 | 1050 | pr_emerg_once("RDSEED32 is broken. Disabling the corresponding CPUID bit.\n"); | |
| 1051 | 1051 | } | |
| 1052 | - | ||
| 1053 | - | if (cpu_has(c, X86_FEATURE_INVLPGB) && | |
| 1054 | - | !cpu_has(c, X86_FEATURE_TLBSYNC_SFW_NO)) | |
| 1055 | - | set_cpu_bug(c, X86_BUG_TLBI); | |
| 1056 | 1052 | } | |
| 1057 | 1053 | ||
| 1058 | 1054 | static void init_amd(struct cpuinfo_x86 *c) | |
modified arch/x86/kernel/cpu/mce/amd.c
| @@ -865,7 +865,7 @@ static void amd_deferred_error_interrupt(void) | |||
| 865 | 865 | ||
| 866 | 866 | void mce_amd_handle_storm(unsigned int bank, bool on) | |
| 867 | 867 | { | |
| 868 | - | threshold_restart_bank(bank, !on); | |
| 868 | + | threshold_restart_bank(bank, on); | |
| 869 | 869 | } | |
| 870 | 870 | ||
| 871 | 871 | static void amd_reset_thr_limit(unsigned int bank) | |
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/itmt.c
| @@ -110,14 +110,18 @@ int sched_set_itmt_support(void) | |||
| 110 | 110 | arch_debugfs_dir, | |
| 111 | 111 | &sysctl_sched_itmt_enabled, | |
| 112 | 112 | &dfs_sched_itmt_fops); | |
| 113 | - | if (IS_ERR(dfs_sched_itmt)) | |
| 113 | + | if (IS_ERR_OR_NULL(dfs_sched_itmt)) { | |
| 114 | 114 | dfs_sched_itmt = NULL; | |
| 115 | + | return -ENOMEM; | |
| 116 | + | } | |
| 115 | 117 | ||
| 116 | 118 | dfs_sched_core_prio = debugfs_create_file("sched_core_priority", 0644, | |
| 117 | 119 | arch_debugfs_dir, NULL, | |
| 118 | 120 | &sched_core_priority_fops); | |
| 119 | - | if (IS_ERR(dfs_sched_core_prio)) | |
| 121 | + | if (IS_ERR_OR_NULL(dfs_sched_core_prio)) { | |
| 120 | 122 | dfs_sched_core_prio = NULL; | |
| 123 | + | return -ENOMEM; | |
| 124 | + | } | |
| 121 | 125 | ||
| 122 | 126 | sched_itmt_capable = true; | |
| 123 | 127 | ||
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/kernel/sys_x86_64.c
| @@ -50,16 +50,9 @@ static unsigned long get_align_mask(struct file *filp) | |||
| 50 | 50 | * value before calling vm_unmapped_area() or ORed directly to the | |
| 51 | 51 | * address. | |
| 52 | 52 | */ | |
| 53 | - | static unsigned long get_align_bits(struct file *filp) | |
| 53 | + | static unsigned long get_align_bits(void) | |
| 54 | 54 | { | |
| 55 | - | /* | |
| 56 | - | * va_align.bits is smaller than the huge page size and will | |
| 57 | - | * lead to misaligned huge pages. Ignore it for huge mappings. | |
| 58 | - | */ | |
| 59 | - | if (is_file_hugepages(filp)) | |
| 60 | - | return 0; | |
| 61 | - | ||
| 62 | - | return va_align.bits & get_align_mask(filp); | |
| 55 | + | return va_align.bits & get_align_mask(NULL); | |
| 63 | 56 | } | |
| 64 | 57 | ||
| 65 | 58 | static int __init control_va_addr_alignment(char *str) | |
| @@ -164,7 +157,7 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr, unsigned long len, | |||
| 164 | 157 | } | |
| 165 | 158 | if (filp) { | |
| 166 | 159 | info.align_mask = get_align_mask(filp); | |
| 167 | - | info.align_offset += get_align_bits(filp); | |
| 160 | + | info.align_offset += get_align_bits(); | |
| 168 | 161 | } | |
| 169 | 162 | ||
| 170 | 163 | return vm_unmapped_area(&info); | |
| @@ -229,7 +222,7 @@ get_unmapped_area: | |||
| 229 | 222 | ||
| 230 | 223 | if (filp) { | |
| 231 | 224 | info.align_mask = get_align_mask(filp); | |
| 232 | - | info.align_offset += get_align_bits(filp); | |
| 225 | + | info.align_offset += get_align_bits(); | |
| 233 | 226 | } | |
| 234 | 227 | addr = vm_unmapped_area(&info); | |
| 235 | 228 | if (!(addr & ~PAGE_MASK)) | |
modified arch/x86/kvm/mmu/mmu.c
| @@ -2512,12 +2512,6 @@ static void shadow_walk_init_using_root(struct kvm_shadow_walk_iterator *iterato | |||
| 2512 | 2512 | ||
| 2513 | 2513 | iterator->addr = addr; | |
| 2514 | 2514 | iterator->shadow_addr = root; | |
| 2515 | - | ||
| 2516 | - | if (WARN_ON_ONCE(!VALID_PAGE(root)) || kvm_mmu_is_dummy_root(root)) { | |
| 2517 | - | iterator->level = 0; | |
| 2518 | - | return; | |
| 2519 | - | } | |
| 2520 | - | ||
| 2521 | 2515 | iterator->level = vcpu->arch.mmu->root_role.level; | |
| 2522 | 2516 | ||
| 2523 | 2517 | if (iterator->level >= PT64_ROOT_4LEVEL && | |
| @@ -5064,7 +5058,7 @@ static int kvm_tdp_page_prefault(struct kvm_vcpu *vcpu, gpa_t gpa, | |||
| 5064 | 5058 | if (signal_pending(current)) | |
| 5065 | 5059 | return -EINTR; | |
| 5066 | 5060 | ||
| 5067 | - | if (kvm_test_request(KVM_REQ_VM_DEAD, vcpu)) | |
| 5061 | + | if (kvm_check_request(KVM_REQ_VM_DEAD, vcpu)) | |
| 5068 | 5062 | return -EIO; | |
| 5069 | 5063 | ||
| 5070 | 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
| @@ -488,20 +488,6 @@ static void snp_guest_req_cleanup(struct kvm *kvm) | |||
| 488 | 488 | sev->guest_resp_buf = NULL; | |
| 489 | 489 | } | |
| 490 | 490 | ||
| 491 | - | static int sev_alloc_have_run_cpus(struct kvm_sev_info *sev) | |
| 492 | - | { | |
| 493 | - | if (!zalloc_cpumask_var(&sev->have_run_cpus, GFP_KERNEL_ACCOUNT)) | |
| 494 | - | return -ENOMEM; | |
| 495 | - | ||
| 496 | - | return 0; | |
| 497 | - | } | |
| 498 | - | ||
| 499 | - | static void sev_free_have_run_cpus(struct kvm_sev_info *sev) | |
| 500 | - | { | |
| 501 | - | free_cpumask_var(sev->have_run_cpus); | |
| 502 | - | memset(&sev->have_run_cpus, 0, sizeof(sev->have_run_cpus)); | |
| 503 | - | } | |
| 504 | - | ||
| 505 | 491 | static int __sev_guest_init(struct kvm *kvm, struct kvm_sev_cmd *argp, | |
| 506 | 492 | struct kvm_sev_init *data, | |
| 507 | 493 | unsigned long vm_type) | |
| @@ -559,9 +545,10 @@ static int __sev_guest_init(struct kvm *kvm, struct kvm_sev_cmd *argp, | |||
| 559 | 545 | if (ret) | |
| 560 | 546 | goto e_free_asid; | |
| 561 | 547 | ||
| 562 | - | ret = sev_alloc_have_run_cpus(sev); | |
| 563 | - | if (ret) | |
| 548 | + | if (!zalloc_cpumask_var(&sev->have_run_cpus, GFP_KERNEL_ACCOUNT)) { | |
| 549 | + | ret = -ENOMEM; | |
| 564 | 550 | goto e_free_asid; | |
| 551 | + | } | |
| 565 | 552 | ||
| 566 | 553 | /* This needs to happen after SEV/SNP firmware initialization. */ | |
| 567 | 554 | if (snp_active) { | |
| @@ -579,7 +566,7 @@ static int __sev_guest_init(struct kvm *kvm, struct kvm_sev_cmd *argp, | |||
| 579 | 566 | return 0; | |
| 580 | 567 | ||
| 581 | 568 | e_free: | |
| 582 | - | sev_free_have_run_cpus(sev); | |
| 569 | + | free_cpumask_var(sev->have_run_cpus); | |
| 583 | 570 | e_free_asid: | |
| 584 | 571 | argp->error = init_args.error; | |
| 585 | 572 | sev_asid_free(sev); | |
| @@ -1138,6 +1125,9 @@ static int sev_launch_update_vmsa(struct kvm *kvm, struct kvm_sev_cmd *argp) | |||
| 1138 | 1125 | if (!sev_es_guest(kvm)) | |
| 1139 | 1126 | return -ENOTTY; | |
| 1140 | 1127 | ||
| 1128 | + | if (kvm_is_vcpu_creation_in_progress(kvm)) | |
| 1129 | + | return -EBUSY; | |
| 1130 | + | ||
| 1141 | 1131 | ret = kvm_lock_all_vcpus(kvm); | |
| 1142 | 1132 | if (ret) | |
| 1143 | 1133 | return ret; | |
| @@ -2045,13 +2035,6 @@ static void sev_migrate_from(struct kvm *dst_kvm, struct kvm *src_kvm) | |||
| 2045 | 2035 | struct kvm_sev_info *mirror; | |
| 2046 | 2036 | unsigned long i; | |
| 2047 | 2037 | ||
| 2048 | - | /* | |
| 2049 | - | * Do cache maintenance on the source VM *before* clearing "SEV active", | |
| 2050 | - | * as memory reclaim flows won't trigger cache maintenance on the VM | |
| 2051 | - | * once it's no longer an SEV VM. | |
| 2052 | - | */ | |
| 2053 | - | sev_writeback_caches(src_kvm); | |
| 2054 | - | ||
| 2055 | 2038 | dst->active = true; | |
| 2056 | 2039 | dst->asid = src->asid; | |
| 2057 | 2040 | dst->handle = src->handle; | |
| @@ -2132,6 +2115,10 @@ static int sev_check_source_vcpus(struct kvm *dst, struct kvm *src) | |||
| 2132 | 2115 | struct kvm_vcpu *src_vcpu; | |
| 2133 | 2116 | unsigned long i; | |
| 2134 | 2117 | ||
| 2118 | + | if (kvm_is_vcpu_creation_in_progress(src) || | |
| 2119 | + | kvm_is_vcpu_creation_in_progress(dst)) | |
| 2120 | + | return -EBUSY; | |
| 2121 | + | ||
| 2135 | 2122 | if (!sev_es_guest(src)) | |
| 2136 | 2123 | return 0; | |
| 2137 | 2124 | ||
| @@ -2200,14 +2187,11 @@ int sev_vm_move_enc_context_from(struct kvm *kvm, unsigned int source_fd) | |||
| 2200 | 2187 | * the set of CPUs from the source. If a CPU was used to run a vCPU in | |
| 2201 | 2188 | * the source VM but is never used for the destination VM, then the CPU | |
| 2202 | 2189 | * can only have cached memory that was accessible to the source VM. | |
| 2203 | - | * Furthermore, KVM *must* perform cache maintenance on the source VM, | |
| 2204 | - | * as the source VM may have access to memory that the destination VM | |
| 2205 | - | * does not, i.e. KVM could skip flushes if memory is reclaimed from | |
| 2206 | - | * the old VM but not the new VM. | |
| 2207 | 2190 | */ | |
| 2208 | - | ret = sev_alloc_have_run_cpus(dst_sev); | |
| 2209 | - | if (ret) | |
| 2191 | + | if (!zalloc_cpumask_var(&dst_sev->have_run_cpus, GFP_KERNEL_ACCOUNT)) { | |
| 2192 | + | ret = -ENOMEM; | |
| 2210 | 2193 | goto out_source_vcpu; | |
| 2194 | + | } | |
| 2211 | 2195 | ||
| 2212 | 2196 | sev_migrate_from(kvm, source_kvm); | |
| 2213 | 2197 | kvm_vm_dead(source_kvm); | |
| @@ -2526,6 +2510,9 @@ static int snp_launch_update_vmsa(struct kvm *kvm, struct kvm_sev_cmd *argp) | |||
| 2526 | 2510 | unsigned long i; | |
| 2527 | 2511 | int ret; | |
| 2528 | 2512 | ||
| 2513 | + | if (kvm_is_vcpu_creation_in_progress(kvm)) | |
| 2514 | + | return -EBUSY; | |
| 2515 | + | ||
| 2529 | 2516 | ret = kvm_lock_all_vcpus(kvm); | |
| 2530 | 2517 | if (ret) | |
| 2531 | 2518 | return ret; | |
| @@ -2901,9 +2888,10 @@ int sev_vm_copy_enc_context_from(struct kvm *kvm, unsigned int source_fd) | |||
| 2901 | 2888 | } | |
| 2902 | 2889 | ||
| 2903 | 2890 | mirror_sev = to_kvm_sev_info(kvm); | |
| 2904 | - | ret = sev_alloc_have_run_cpus(mirror_sev); | |
| 2905 | - | if (ret) | |
| 2891 | + | if (!zalloc_cpumask_var(&mirror_sev->have_run_cpus, GFP_KERNEL_ACCOUNT)) { | |
| 2892 | + | ret = -ENOMEM; | |
| 2906 | 2893 | goto e_unlock; | |
| 2894 | + | } | |
| 2907 | 2895 | ||
| 2908 | 2896 | /* | |
| 2909 | 2897 | * The mirror kvm holds an enc_context_owner ref so its asid can't | |
| @@ -2992,17 +2980,13 @@ void sev_vm_destroy(struct kvm *kvm) | |||
| 2992 | 2980 | struct list_head *head = &sev->regions_list; | |
| 2993 | 2981 | struct list_head *pos, *q; | |
| 2994 | 2982 | ||
| 2995 | - | /* | |
| 2996 | - | * Free the mask even if the VM is not *currently* an SEV VM, as it may | |
| 2997 | - | * have been an SEV VM prior to intra-host migration. | |
| 2998 | - | */ | |
| 2999 | - | sev_free_have_run_cpus(sev); | |
| 3000 | - | ||
| 3001 | 2983 | if (!sev_guest(kvm)) | |
| 3002 | 2984 | return; | |
| 3003 | 2985 | ||
| 3004 | 2986 | WARN_ON(!list_empty(&sev->mirror_vms)); | |
| 3005 | 2987 | ||
| 2988 | + | free_cpumask_var(sev->have_run_cpus); | |
| 2989 | + | ||
| 3006 | 2990 | /* | |
| 3007 | 2991 | * If this is a mirror VM, remove it from the owner's list of a mirrors | |
| 3008 | 2992 | * and skip ASID cleanup (the ASID is tied to the lifetime of the owner). | |
| @@ -3632,6 +3616,7 @@ int pre_sev_run(struct vcpu_svm *svm, int cpu) | |||
| 3632 | 3616 | ||
| 3633 | 3617 | sd->sev_vmcbs[asid] = svm->vmcb; | |
| 3634 | 3618 | svm->vmcb->control.tlb_ctl = TLB_CONTROL_FLUSH_ASID; | |
| 3619 | + | vmcb_mark_dirty(svm->vmcb, VMCB_ASID); | |
| 3635 | 3620 | return 0; | |
| 3636 | 3621 | } | |
| 3637 | 3622 | ||
modified arch/x86/kvm/svm/svm.c
| @@ -673,7 +673,16 @@ static void clr_dr_intercepts(struct vcpu_svm *svm) | |||
| 673 | 673 | ||
| 674 | 674 | static bool msr_write_intercepted(struct vcpu_svm *svm, u32 msr) | |
| 675 | 675 | { | |
| 676 | - | void *msrpm = __va(__sme_clr(svm->vmcb->control.msrpm_base_pa)); | |
| 676 | + | /* | |
| 677 | + | * For non-nested case: | |
| 678 | + | * If the L01 MSR bitmap does not intercept the MSR, then we need to | |
| 679 | + | * save it. | |
| 680 | + | * | |
| 681 | + | * For nested case: | |
| 682 | + | * If the L02 MSR bitmap does not intercept the MSR, then we need to | |
| 683 | + | * save it. | |
| 684 | + | */ | |
| 685 | + | void *msrpm = is_guest_mode(&svm->vcpu) ? svm->nested.msrpm : svm->msrpm; | |
| 677 | 686 | ||
| 678 | 687 | return svm_test_msr_bitmap_write(msrpm, msr); | |
| 679 | 688 | } | |
| @@ -1893,7 +1902,8 @@ static void new_asid(struct vcpu_svm *svm, struct svm_cpu_data *sd) | |||
| 1893 | 1902 | if (sd->next_asid > sd->max_asid) { | |
| 1894 | 1903 | ++sd->asid_generation; | |
| 1895 | 1904 | sd->next_asid = sd->min_asid; | |
| 1896 | - | sd->flush_all_asids = true; | |
| 1905 | + | svm->vmcb->control.tlb_ctl = TLB_CONTROL_FLUSH_ALL_ASID; | |
| 1906 | + | vmcb_mark_dirty(svm->vmcb, VMCB_ASID); | |
| 1897 | 1907 | } | |
| 1898 | 1908 | ||
| 1899 | 1909 | svm->current_vmcb->asid_generation = sd->asid_generation; | |
| @@ -4518,9 +4528,6 @@ static __no_kcsan fastpath_t svm_vcpu_run(struct kvm_vcpu *vcpu, u64 run_flags) | |||
| 4518 | 4528 | svm->vmcb->control.asid = svm->asid; | |
| 4519 | 4529 | vmcb_mark_dirty(svm->vmcb, VMCB_ASID); | |
| 4520 | 4530 | } | |
| 4521 | - | if (this_cpu_ptr(&svm_data)->flush_all_asids) | |
| 4522 | - | svm->vmcb->control.tlb_ctl = TLB_CONTROL_FLUSH_ALL_ASID; | |
| 4523 | - | ||
| 4524 | 4531 | svm->vmcb->save.cr2 = vcpu->arch.cr2; | |
| 4525 | 4532 | ||
| 4526 | 4533 | if (guest_cpu_cap_has(vcpu, X86_FEATURE_ERAPS) && | |
| @@ -4611,23 +4618,16 @@ static __no_kcsan fastpath_t svm_vcpu_run(struct kvm_vcpu *vcpu, u64 run_flags) | |||
| 4611 | 4618 | vcpu->arch.nested_run_pending = 0; | |
| 4612 | 4619 | } | |
| 4613 | 4620 | ||
| 4614 | - | if (!svm_is_vmrun_failure(svm->vmcb->control.exit_code)) { | |
| 4615 | - | this_cpu_ptr(&svm_data)->flush_all_asids = false; | |
| 4616 | - | svm->vmcb->control.tlb_ctl = TLB_CONTROL_DO_NOTHING; | |
| 4621 | + | svm->vmcb->control.tlb_ctl = TLB_CONTROL_DO_NOTHING; | |
| 4617 | 4622 | ||
| 4618 | - | /* | |
| 4619 | - | * Unconditionally mask off the CLEAR_RAP bit, the AND is just | |
| 4620 | - | * as cheap as the TEST+Jcc to avoid it. | |
| 4621 | - | */ | |
| 4622 | - | if (cpu_feature_enabled(X86_FEATURE_ERAPS)) | |
| 4623 | - | svm->vmcb->control.erap_ctl &= ~ERAP_CONTROL_CLEAR_RAP; | |
| 4624 | - | ||
| 4625 | - | vmcb_mark_all_clean(svm->vmcb); | |
| 4623 | + | /* | |
| 4624 | + | * Unconditionally mask off the CLEAR_RAP bit, the AND is just as cheap | |
| 4625 | + | * as the TEST+Jcc to avoid it. | |
| 4626 | + | */ | |
| 4627 | + | if (cpu_feature_enabled(X86_FEATURE_ERAPS)) | |
| 4628 | + | svm->vmcb->control.erap_ctl &= ~ERAP_CONTROL_CLEAR_RAP; | |
| 4626 | 4629 | ||
| 4627 | - | if (!msr_write_intercepted(svm, MSR_AMD64_PERF_CNTR_GLOBAL_CTL)) | |
| 4628 | - | rdmsrq(MSR_AMD64_PERF_CNTR_GLOBAL_CTL, | |
| 4629 | - | vcpu_to_pmu(vcpu)->global_ctrl); | |
| 4630 | - | } | |
| 4630 | + | vmcb_mark_all_clean(svm->vmcb); | |
| 4631 | 4631 | ||
| 4632 | 4632 | /* if exit due to PF check for async PF */ | |
| 4633 | 4633 | if (svm->vmcb->control.exit_code == SVM_EXIT_EXCP_BASE + PF_VECTOR) | |
| @@ -4636,6 +4636,9 @@ static __no_kcsan fastpath_t svm_vcpu_run(struct kvm_vcpu *vcpu, u64 run_flags) | |||
| 4636 | 4636 | ||
| 4637 | 4637 | kvm_clear_available_registers(vcpu, SVM_REGS_LAZY_LOAD_SET); | |
| 4638 | 4638 | ||
| 4639 | + | if (!msr_write_intercepted(svm, MSR_AMD64_PERF_CNTR_GLOBAL_CTL)) | |
| 4640 | + | rdmsrq(MSR_AMD64_PERF_CNTR_GLOBAL_CTL, vcpu_to_pmu(vcpu)->global_ctrl); | |
| 4641 | + | ||
| 4639 | 4642 | trace_kvm_exit(vcpu, KVM_ISA_SVM); | |
| 4640 | 4643 | ||
| 4641 | 4644 | svm_complete_interrupts(vcpu); | |
modified arch/x86/kvm/svm/svm.h
| @@ -376,7 +376,6 @@ struct svm_cpu_data { | |||
| 376 | 376 | u32 next_asid; | |
| 377 | 377 | u32 min_asid; | |
| 378 | 378 | ||
| 379 | - | bool flush_all_asids; | |
| 380 | 379 | bool bp_spec_reduce_set; | |
| 381 | 380 | ||
| 382 | 381 | struct vmcb *save_area; | |
modified arch/x86/kvm/vmx/nested.c
| @@ -1754,9 +1754,6 @@ static void copy_vmcs12_to_shadow(struct vcpu_vmx *vmx) | |||
| 1754 | 1754 | static void copy_enlightened_to_vmcs12(struct vcpu_vmx *vmx, u32 hv_clean_fields) | |
| 1755 | 1755 | { | |
| 1756 | 1756 | #ifdef CONFIG_KVM_HYPERV | |
| 1757 | - | const u64 runtime_controls = HV_VMX_ENLIGHTENED_CLEAN_FIELD_CONTROL_GRP1 | | |
| 1758 | - | HV_VMX_ENLIGHTENED_CLEAN_FIELD_CONTROL_GRP2 | | |
| 1759 | - | HV_VMX_ENLIGHTENED_CLEAN_FIELD_CONTROL_PROC; | |
| 1760 | 1757 | struct vmcs12 *vmcs12 = vmx->nested.cached_vmcs12; | |
| 1761 | 1758 | struct hv_enlightened_vmcs *evmcs = nested_vmx_evmcs(vmx); | |
| 1762 | 1759 | struct kvm_vcpu_hv *hv_vcpu = to_hv_vcpu(&vmx->vcpu); | |
| @@ -1765,9 +1762,6 @@ static void copy_enlightened_to_vmcs12(struct vcpu_vmx *vmx, u32 hv_clean_fields | |||
| 1765 | 1762 | vmcs12->tpr_threshold = evmcs->tpr_threshold; | |
| 1766 | 1763 | vmcs12->guest_rip = evmcs->guest_rip; | |
| 1767 | 1764 | ||
| 1768 | - | if ((hv_clean_fields & runtime_controls) != runtime_controls) | |
| 1769 | - | vmx->nested.force_msr_bitmap_recalc = true; | |
| 1770 | - | ||
| 1771 | 1765 | if (unlikely(!(hv_clean_fields & | |
| 1772 | 1766 | HV_VMX_ENLIGHTENED_CLEAN_FIELD_ENLIGHTENMENTSCONTROL))) { | |
| 1773 | 1767 | hv_vcpu->nested.pa_page_gpa = evmcs->partition_assist_page; | |
| @@ -3471,6 +3465,10 @@ static bool nested_get_vmcs12_pages(struct kvm_vcpu *vcpu) | |||
| 3471 | 3465 | } else { | |
| 3472 | 3466 | pr_debug_ratelimited("%s: no backing for APIC-access address in vmcs12\n", | |
| 3473 | 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; | |
| 3474 | 3472 | return false; | |
| 3475 | 3473 | } | |
| 3476 | 3474 | } | |
| @@ -3541,6 +3539,11 @@ static bool vmx_get_nested_state_pages(struct kvm_vcpu *vcpu) | |||
| 3541 | 3539 | if (!nested_get_evmcs_page(vcpu)) { | |
| 3542 | 3540 | pr_debug_ratelimited("%s: enlightened vmptrld failed\n", | |
| 3543 | 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 | + | ||
| 3544 | 3547 | return false; | |
| 3545 | 3548 | } | |
| 3546 | 3549 | #endif | |
| @@ -3912,12 +3915,8 @@ static int nested_vmx_run(struct kvm_vcpu *vcpu, bool launch) | |||
| 3912 | 3915 | ||
| 3913 | 3916 | vmentry_failed: | |
| 3914 | 3917 | vcpu->arch.nested_run_pending = 0; | |
| 3915 | - | if (status == NVMX_VMENTRY_KVM_INTERNAL_ERROR) { | |
| 3916 | - | vcpu->run->exit_reason = KVM_EXIT_INTERNAL_ERROR; | |
| 3917 | - | vcpu->run->internal.suberror = KVM_INTERNAL_ERROR_EMULATION; | |
| 3918 | - | vcpu->run->internal.ndata = 0; | |
| 3918 | + | if (status == NVMX_VMENTRY_KVM_INTERNAL_ERROR) | |
| 3919 | 3919 | return 0; | |
| 3920 | - | } | |
| 3921 | 3920 | if (status == NVMX_VMENTRY_VMEXIT) | |
| 3922 | 3921 | return 1; | |
| 3923 | 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 | } | |
| @@ -2728,6 +2728,11 @@ static tdx_vm_state_guard_t tdx_acquire_vm_state_locks(struct kvm *kvm) | |||
| 2728 | 2728 | ||
| 2729 | 2729 | mutex_lock(&kvm->lock); | |
| 2730 | 2730 | ||
| 2731 | + | if (kvm->created_vcpus != atomic_read(&kvm->online_vcpus)) { | |
| 2732 | + | r = -EBUSY; | |
| 2733 | + | goto out_err; | |
| 2734 | + | } | |
| 2735 | + | ||
| 2731 | 2736 | r = kvm_lock_all_vcpus(kvm); | |
| 2732 | 2737 | if (r) | |
| 2733 | 2738 | goto out_err; | |
modified arch/x86/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/mm/pgtable.c
| @@ -705,37 +705,47 @@ int pmd_clear_huge(pmd_t *pmd) | |||
| 705 | 705 | } | |
| 706 | 706 | ||
| 707 | 707 | #ifdef CONFIG_X86_64 | |
| 708 | - | /* | |
| 709 | - | * Given a PUD poitner, detach and free the pointed-to | |
| 710 | - | * PMD page and any PTE page children. The entire range | |
| 711 | - | * under the PUD must not have any valid translations | |
| 712 | - | * and the TLB must have already been flushed. | |
| 708 | + | /** | |
| 709 | + | * pud_free_pmd_page - Clear PUD entry and free PMD page | |
| 710 | + | * @pud: Pointer to a PUD | |
| 711 | + | * @addr: Virtual address associated with PUD | |
| 712 | + | * | |
| 713 | + | * Context: The PUD range has been unmapped and TLB purged. | |
| 714 | + | * Return: 1 if clearing the entry succeeded. 0 otherwise. | |
| 715 | + | * | |
| 716 | + | * NOTE: Callers must allow a single page allocation. | |
| 713 | 717 | */ | |
| 714 | 718 | int pud_free_pmd_page(pud_t *pud, unsigned long addr) | |
| 715 | 719 | { | |
| 720 | + | pmd_t *pmd, *pmd_sv; | |
| 716 | 721 | struct ptdesc *pt; | |
| 717 | - | pmd_t *pmd; | |
| 718 | 722 | int i; | |
| 719 | 723 | ||
| 720 | 724 | pmd = pud_pgtable(*pud); | |
| 725 | + | pmd_sv = (pmd_t *)__get_free_page(GFP_KERNEL); | |
| 726 | + | if (!pmd_sv) | |
| 727 | + | return 0; | |
| 728 | + | ||
| 729 | + | for (i = 0; i < PTRS_PER_PMD; i++) { | |
| 730 | + | pmd_sv[i] = pmd[i]; | |
| 731 | + | if (!pmd_none(pmd[i])) | |
| 732 | + | pmd_clear(&pmd[i]); | |
| 733 | + | } | |
| 721 | 734 | ||
| 722 | - | /* Detach the PMD page: */ | |
| 723 | 735 | pud_clear(pud); | |
| 724 | 736 | ||
| 725 | - | /* | |
| 726 | - | * PMD and all its descendents are unreachable | |
| 727 | - | * via normal page walks. Make them unreachable | |
| 728 | - | * in cached mid-level walks too: | |
| 729 | - | */ | |
| 737 | + | /* INVLPG to clear all paging-structure caches */ | |
| 730 | 738 | flush_tlb_kernel_range(addr, addr + PAGE_SIZE-1); | |
| 731 | 739 | ||
| 732 | 740 | for (i = 0; i < PTRS_PER_PMD; i++) { | |
| 733 | - | if (!pmd_none(pmd[i])) { | |
| 734 | - | pt = page_ptdesc(pmd_page(pmd[i])); | |
| 741 | + | if (!pmd_none(pmd_sv[i])) { | |
| 742 | + | pt = page_ptdesc(pmd_page(pmd_sv[i])); | |
| 735 | 743 | pagetable_dtor_free(pt); | |
| 736 | 744 | } | |
| 737 | 745 | } | |
| 738 | 746 | ||
| 747 | + | free_page((unsigned long)pmd_sv); | |
| 748 | + | ||
| 739 | 749 | pmd_free(&init_mm, pmd); | |
| 740 | 750 | ||
| 741 | 751 | return 1; | |
modified arch/x86/net/bpf_jit_comp.c
| @@ -13,7 +13,6 @@ | |||
| 13 | 13 | #include <linux/bpf_verifier.h> | |
| 14 | 14 | #include <linux/memory.h> | |
| 15 | 15 | #include <linux/sort.h> | |
| 16 | - | #include <linux/execmem.h> | |
| 17 | 16 | #include <asm/extable.h> | |
| 18 | 17 | #include <asm/ftrace.h> | |
| 19 | 18 | #include <asm/set_memory.h> | |
| @@ -3217,21 +3216,16 @@ static void restore_regs(const struct btf_func_model *m, u8 **prog, | |||
| 3217 | 3216 | } | |
| 3218 | 3217 | ||
| 3219 | 3218 | static int invoke_bpf_prog(const struct btf_func_model *m, u8 **pprog, | |
| 3220 | - | struct bpf_tramp_image *im, | |
| 3221 | 3219 | struct bpf_tramp_node *node, int stack_size, | |
| 3222 | 3220 | int run_ctx_off, bool save_ret, | |
| 3223 | 3221 | void *image, void *rw_image) | |
| 3224 | 3222 | { | |
| 3225 | 3223 | u8 *prog = *pprog; | |
| 3226 | - | u8 *jmp_insn, *skip; | |
| 3224 | + | u8 *jmp_insn; | |
| 3227 | 3225 | int ctx_cookie_off = offsetof(struct bpf_tramp_run_ctx, bpf_cookie); | |
| 3228 | 3226 | struct bpf_prog *p = node->link->prog; | |
| 3229 | 3227 | u64 cookie = node->cookie; | |
| 3230 | 3228 | ||
| 3231 | - | /* nop, patched to skip this prog when it is detached */ | |
| 3232 | - | skip = image + (prog - (u8 *)rw_image); | |
| 3233 | - | emit_nops(&prog, X86_PATCH_SIZE); | |
| 3234 | - | ||
| 3235 | 3229 | /* mov rdi, cookie */ | |
| 3236 | 3230 | emit_mov_imm64(&prog, BPF_REG_1, (long) cookie >> 32, (u32) (long) cookie); | |
| 3237 | 3231 | ||
| @@ -3306,8 +3300,6 @@ static int invoke_bpf_prog(const struct btf_func_model *m, u8 **pprog, | |||
| 3306 | 3300 | if (emit_rsb_call(&prog, bpf_trampoline_exit(p), image + (prog - (u8 *)rw_image))) | |
| 3307 | 3301 | return -EINVAL; | |
| 3308 | 3302 | ||
| 3309 | - | bpf_tramp_image_add_skip(im, p, skip, image + (prog - (u8 *)rw_image)); | |
| 3310 | - | ||
| 3311 | 3303 | *pprog = prog; | |
| 3312 | 3304 | return 0; | |
| 3313 | 3305 | } | |
| @@ -3339,7 +3331,6 @@ static int emit_cond_near_jump(u8 **pprog, void *func, void *ip, u8 jmp_cond) | |||
| 3339 | 3331 | } | |
| 3340 | 3332 | ||
| 3341 | 3333 | static int invoke_bpf(const struct btf_func_model *m, u8 **pprog, | |
| 3342 | - | struct bpf_tramp_image *im, | |
| 3343 | 3334 | struct bpf_tramp_nodes *tl, int stack_size, | |
| 3344 | 3335 | int run_ctx_off, int func_meta_off, bool save_ret, | |
| 3345 | 3336 | void *image, void *rw_image, u64 func_meta, | |
| @@ -3354,7 +3345,7 @@ static int invoke_bpf(const struct btf_func_model *m, u8 **pprog, | |||
| 3354 | 3345 | func_meta | (cur_cookie << BPF_TRAMP_COOKIE_INDEX_SHIFT)); | |
| 3355 | 3346 | cur_cookie--; | |
| 3356 | 3347 | } | |
| 3357 | - | if (invoke_bpf_prog(m, &prog, im, tl->nodes[i], stack_size, | |
| 3348 | + | if (invoke_bpf_prog(m, &prog, tl->nodes[i], stack_size, | |
| 3358 | 3349 | run_ctx_off, save_ret, image, rw_image)) | |
| 3359 | 3350 | return -EINVAL; | |
| 3360 | 3351 | } | |
| @@ -3363,7 +3354,6 @@ static int invoke_bpf(const struct btf_func_model *m, u8 **pprog, | |||
| 3363 | 3354 | } | |
| 3364 | 3355 | ||
| 3365 | 3356 | static int invoke_bpf_mod_ret(const struct btf_func_model *m, u8 **pprog, | |
| 3366 | - | struct bpf_tramp_image *im, | |
| 3367 | 3357 | struct bpf_tramp_nodes *tl, int stack_size, | |
| 3368 | 3358 | int run_ctx_off, u8 **branches, | |
| 3369 | 3359 | void *image, void *rw_image) | |
| @@ -3377,7 +3367,7 @@ static int invoke_bpf_mod_ret(const struct btf_func_model *m, u8 **pprog, | |||
| 3377 | 3367 | emit_mov_imm32(&prog, false, BPF_REG_0, 0); | |
| 3378 | 3368 | emit_stx(&prog, BPF_DW, BPF_REG_FP, BPF_REG_0, -8); | |
| 3379 | 3369 | for (i = 0; i < tl->nr_nodes; i++) { | |
| 3380 | - | if (invoke_bpf_prog(m, &prog, im, tl->nodes[i], stack_size, run_ctx_off, true, | |
| 3370 | + | if (invoke_bpf_prog(m, &prog, tl->nodes[i], stack_size, run_ctx_off, true, | |
| 3381 | 3371 | image, rw_image)) | |
| 3382 | 3372 | return -EINVAL; | |
| 3383 | 3373 | ||
| @@ -3649,7 +3639,7 @@ static int __arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *rw_im | |||
| 3649 | 3639 | } | |
| 3650 | 3640 | ||
| 3651 | 3641 | if (fentry->nr_nodes) { | |
| 3652 | - | if (invoke_bpf(m, &prog, im, fentry, regs_off, run_ctx_off, func_meta_off, | |
| 3642 | + | if (invoke_bpf(m, &prog, fentry, regs_off, run_ctx_off, func_meta_off, | |
| 3653 | 3643 | flags & BPF_TRAMP_F_RET_FENTRY_RET, image, rw_image, | |
| 3654 | 3644 | func_meta, cookie_off)) | |
| 3655 | 3645 | return -EINVAL; | |
| @@ -3661,7 +3651,7 @@ static int __arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *rw_im | |||
| 3661 | 3651 | if (!branches) | |
| 3662 | 3652 | return -ENOMEM; | |
| 3663 | 3653 | ||
| 3664 | - | if (invoke_bpf_mod_ret(m, &prog, im, fmod_ret, regs_off, | |
| 3654 | + | if (invoke_bpf_mod_ret(m, &prog, fmod_ret, regs_off, | |
| 3665 | 3655 | run_ctx_off, branches, image, rw_image)) { | |
| 3666 | 3656 | ret = -EINVAL; | |
| 3667 | 3657 | goto cleanup; | |
| @@ -3691,6 +3681,8 @@ static int __arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *rw_im | |||
| 3691 | 3681 | } | |
| 3692 | 3682 | /* remember return value in a stack for bpf prog to access */ | |
| 3693 | 3683 | emit_stx(&prog, BPF_DW, BPF_REG_FP, BPF_REG_0, -8); | |
| 3684 | + | im->ip_after_call = image + (prog - (u8 *)rw_image); | |
| 3685 | + | emit_nops(&prog, X86_PATCH_SIZE); | |
| 3694 | 3686 | } | |
| 3695 | 3687 | ||
| 3696 | 3688 | if (fmod_ret->nr_nodes) { | |
| @@ -3715,7 +3707,7 @@ static int __arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *rw_im | |||
| 3715 | 3707 | emit_store_stack_imm64(&prog, BPF_REG_0, -func_meta_off, func_meta); | |
| 3716 | 3708 | ||
| 3717 | 3709 | if (fexit->nr_nodes) { | |
| 3718 | - | if (invoke_bpf(m, &prog, im, fexit, regs_off, run_ctx_off, func_meta_off, | |
| 3710 | + | if (invoke_bpf(m, &prog, fexit, regs_off, run_ctx_off, func_meta_off, | |
| 3719 | 3711 | false, image, rw_image, func_meta, cookie_off)) { | |
| 3720 | 3712 | ret = -EINVAL; | |
| 3721 | 3713 | goto cleanup; | |
| @@ -3730,6 +3722,7 @@ static int __arch_prepare_bpf_trampoline(struct bpf_tramp_image *im, void *rw_im | |||
| 3730 | 3722 | * restored to R0. | |
| 3731 | 3723 | */ | |
| 3732 | 3724 | if (flags & BPF_TRAMP_F_CALL_ORIG) { | |
| 3725 | + | im->ip_epilogue = image + (prog - (u8 *)rw_image); | |
| 3733 | 3726 | /* arg1: mov rdi, im */ | |
| 3734 | 3727 | emit_mov_imm64(&prog, BPF_REG_1, (long) im >> 32, (u32) (long) im); | |
| 3735 | 3728 | if (emit_rsb_call(&prog, __bpf_tramp_exit, image + (prog - (u8 *)rw_image))) { | |
| @@ -3817,7 +3810,7 @@ out: | |||
| 3817 | 3810 | int arch_bpf_trampoline_size(const struct btf_func_model *m, u32 flags, | |
| 3818 | 3811 | struct bpf_tramp_nodes *tnodes, void *func_addr) | |
| 3819 | 3812 | { | |
| 3820 | - | struct bpf_tramp_image im = {}; | |
| 3813 | + | struct bpf_tramp_image im; | |
| 3821 | 3814 | void *image; | |
| 3822 | 3815 | int ret; | |
| 3823 | 3816 | ||
| @@ -3825,16 +3818,15 @@ int arch_bpf_trampoline_size(const struct btf_func_model *m, u32 flags, | |||
| 3825 | 3818 | * | |
| 3826 | 3819 | * We cannot use kvmalloc here, because we need image to be in | |
| 3827 | 3820 | * module memory range. | |
| 3828 | - | * Since it must be writable use execmem_alloc(EXECMEM_MODULE_DATA) | |
| 3829 | - | * that returns writable memory in the module address space. | |
| 3821 | + | * Since it must be writable use bpf_jit_alloc_exec_rw(). | |
| 3830 | 3822 | */ | |
| 3831 | - | image = execmem_alloc(EXECMEM_MODULE_DATA, PAGE_SIZE); | |
| 3823 | + | image = bpf_jit_alloc_exec_rw(PAGE_SIZE); | |
| 3832 | 3824 | if (!image) | |
| 3833 | 3825 | return -ENOMEM; | |
| 3834 | 3826 | ||
| 3835 | 3827 | ret = __arch_prepare_bpf_trampoline(&im, image, image + PAGE_SIZE, image, | |
| 3836 | 3828 | m, flags, tnodes, func_addr); | |
| 3837 | - | execmem_free(image); | |
| 3829 | + | bpf_jit_free_exec(image); | |
| 3838 | 3830 | return ret; | |
| 3839 | 3831 | } | |
| 3840 | 3832 | ||
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 arch/x86/um/asm/ptrace.h
| @@ -13,7 +13,9 @@ enum { | |||
| 13 | 13 | }; | |
| 14 | 14 | ||
| 15 | 15 | #include <linux/compiler.h> | |
| 16 | - | #define __FRAME_OFFSETS /* Needed to get the register macros */ | |
| 16 | + | #ifndef CONFIG_X86_32 | |
| 17 | + | #define __FRAME_OFFSETS /* Needed to get the R* macros */ | |
| 18 | + | #endif | |
| 17 | 19 | #include <asm/ptrace-generic.h> | |
| 18 | 20 | ||
| 19 | 21 | #define user_mode(r) UPT_IS_USER(&(r)->regs) | |
modified arch/x86/um/ptrace_32.c
| @@ -7,7 +7,6 @@ | |||
| 7 | 7 | #include <linux/sched.h> | |
| 8 | 8 | #include <linux/uaccess.h> | |
| 9 | 9 | #include <linux/regset.h> | |
| 10 | - | #define __FRAME_OFFSETS | |
| 11 | 10 | #include <asm/ptrace-abi.h> | |
| 12 | 11 | #include <registers.h> | |
| 13 | 12 | #include <skas.h> | |
modified block/bio.c
| @@ -859,7 +859,6 @@ static int __bio_clone(struct bio *bio, struct bio *bio_src, gfp_t gfp) | |||
| 859 | 859 | bio->bi_ioprio = bio_src->bi_ioprio; | |
| 860 | 860 | bio->bi_write_hint = bio_src->bi_write_hint; | |
| 861 | 861 | bio->bi_write_stream = bio_src->bi_write_stream; | |
| 862 | - | bio->bi_bvec_gap_bit = bio_src->bi_bvec_gap_bit; | |
| 863 | 862 | bio->bi_iter = bio_src->bi_iter; | |
| 864 | 863 | bio->bi_io_vec = bio_src->bi_io_vec; | |
| 865 | 864 | ||
| @@ -1973,14 +1972,6 @@ struct bio *bio_split(struct bio *bio, int sectors, | |||
| 1973 | 1972 | ||
| 1974 | 1973 | bio_advance(bio, split->bi_iter.bi_size); | |
| 1975 | 1974 | ||
| 1976 | - | /* | |
| 1977 | - | * The gap bit is set when splitting to limits and only applies to the | |
| 1978 | - | * front bio that was split off. The remaining bio will calcualte its | |
| 1979 | - | * gap value when it is subsequently split to limits, so it is safe to | |
| 1980 | - | * re-initialize the value back to 0. | |
| 1981 | - | */ | |
| 1982 | - | bio->bi_bvec_gap_bit = 0; | |
| 1983 | - | ||
| 1984 | 1975 | if (bio_flagged(bio, BIO_TRACE_COMPLETION)) | |
| 1985 | 1976 | bio_set_flag(split, BIO_TRACE_COMPLETION); | |
| 1986 | 1977 | ||
modified block/blk-cgroup.c
| @@ -2091,7 +2091,6 @@ static inline struct blkcg_gq *blkg_tryget_closest(struct bio *bio, | |||
| 2091 | 2091 | struct request_queue *q = bio->bi_bdev->bd_queue; | |
| 2092 | 2092 | struct blkcg *blkcg = css_to_blkcg(css); | |
| 2093 | 2093 | struct blkcg_gq *blkg; | |
| 2094 | - | unsigned long flags; | |
| 2095 | 2094 | ||
| 2096 | 2095 | rcu_read_lock(); | |
| 2097 | 2096 | blkg = blkg_lookup(blkcg, q); | |
| @@ -2106,11 +2105,11 @@ static inline struct blkcg_gq *blkg_tryget_closest(struct bio *bio, | |||
| 2106 | 2105 | * Fast path failed, we're probably issuing IO in this cgroup the first | |
| 2107 | 2106 | * time, hold lock to create new blkg. | |
| 2108 | 2107 | */ | |
| 2109 | - | spin_lock_irqsave(&q->queue_lock, flags); | |
| 2108 | + | spin_lock_irq(&q->queue_lock); | |
| 2110 | 2109 | blkg = blkg_lookup_create(blkcg, bio->bi_bdev->bd_disk); | |
| 2111 | 2110 | if (blkg) | |
| 2112 | 2111 | blkg = blkg_lookup_tryget(blkg); | |
| 2113 | - | spin_unlock_irqrestore(&q->queue_lock, flags); | |
| 2112 | + | spin_unlock_irq(&q->queue_lock); | |
| 2114 | 2113 | ||
| 2115 | 2114 | return blkg; | |
| 2116 | 2115 | } | |
modified block/blk-mq.c
| @@ -447,6 +447,16 @@ static struct request *blk_mq_rq_ctx_init(struct blk_mq_alloc_data *data, | |||
| 447 | 447 | WRITE_ONCE(rq->deadline, 0); | |
| 448 | 448 | req_ref_set(rq, 1); | |
| 449 | 449 | ||
| 450 | + | if (rq->rq_flags & RQF_USE_SCHED) { | |
| 451 | + | struct elevator_queue *e = data->q->elevator; | |
| 452 | + | ||
| 453 | + | INIT_HLIST_NODE(&rq->hash); | |
| 454 | + | RB_CLEAR_NODE(&rq->rb_node); | |
| 455 | + | ||
| 456 | + | if (e->type->ops.prepare_request) | |
| 457 | + | e->type->ops.prepare_request(rq); | |
| 458 | + | } | |
| 459 | + | ||
| 450 | 460 | return rq; | |
| 451 | 461 | } | |
| 452 | 462 | ||
| @@ -488,12 +498,6 @@ __blk_mq_alloc_requests_batch(struct blk_mq_alloc_data *data) | |||
| 488 | 498 | return rq_list_pop(data->cached_rqs); | |
| 489 | 499 | } | |
| 490 | 500 | ||
| 491 | - | static bool blk_op_bypass_sched(blk_opf_t opf) | |
| 492 | - | { | |
| 493 | - | return (opf & REQ_OP_MASK) == REQ_OP_FLUSH || | |
| 494 | - | blk_op_is_passthrough(opf); | |
| 495 | - | } | |
| 496 | - | ||
| 497 | 501 | static void blk_mq_limit_depth(struct blk_mq_alloc_data *data) | |
| 498 | 502 | { | |
| 499 | 503 | struct elevator_mq_ops *ops; | |
| @@ -514,10 +518,12 @@ static void blk_mq_limit_depth(struct blk_mq_alloc_data *data) | |||
| 514 | 518 | * Flush/passthrough requests are special and go directly to the | |
| 515 | 519 | * dispatch list, they are not subject to the async_depth limit. | |
| 516 | 520 | */ | |
| 517 | - | if (blk_op_bypass_sched(data->cmd_flags)) | |
| 521 | + | if ((data->cmd_flags & REQ_OP_MASK) == REQ_OP_FLUSH || | |
| 522 | + | blk_op_is_passthrough(data->cmd_flags)) | |
| 518 | 523 | return; | |
| 519 | 524 | ||
| 520 | 525 | WARN_ON_ONCE(data->flags & BLK_MQ_REQ_RESERVED); | |
| 526 | + | data->rq_flags |= RQF_USE_SCHED; | |
| 521 | 527 | ||
| 522 | 528 | /* | |
| 523 | 529 | * By default, sync requests have no limit, and async requests are | |
| @@ -528,29 +534,6 @@ static void blk_mq_limit_depth(struct blk_mq_alloc_data *data) | |||
| 528 | 534 | ops->limit_depth(data->cmd_flags, data); | |
| 529 | 535 | } | |
| 530 | 536 | ||
| 531 | - | /* | |
| 532 | - | * Finish initializing a request once it has been claimed for an operation. | |
| 533 | - | * Cached requests are allocated before that operation is known. | |
| 534 | - | */ | |
| 535 | - | static void blk_mq_rq_late_init(struct request *rq, u64 alloc_time_ns) | |
| 536 | - | { | |
| 537 | - | struct elevator_queue *e; | |
| 538 | - | ||
| 539 | - | blk_mq_rq_time_init(rq, alloc_time_ns); | |
| 540 | - | ||
| 541 | - | if (!(rq->rq_flags & RQF_SCHED_TAGS) || (rq->rq_flags & RQF_RESV) || | |
| 542 | - | blk_op_bypass_sched(rq->cmd_flags)) | |
| 543 | - | return; | |
| 544 | - | ||
| 545 | - | rq->rq_flags |= RQF_USE_SCHED; | |
| 546 | - | INIT_HLIST_NODE(&rq->hash); | |
| 547 | - | RB_CLEAR_NODE(&rq->rb_node); | |
| 548 | - | ||
| 549 | - | e = rq->q->elevator; | |
| 550 | - | if (e->type->ops.prepare_request) | |
| 551 | - | e->type->ops.prepare_request(rq); | |
| 552 | - | } | |
| 553 | - | ||
| 554 | 537 | static struct request *__blk_mq_alloc_requests(struct blk_mq_alloc_data *data) | |
| 555 | 538 | { | |
| 556 | 539 | struct request_queue *q = data->q; | |
| @@ -579,7 +562,7 @@ retry: | |||
| 579 | 562 | if (data->nr_tags > 1) { | |
| 580 | 563 | rq = __blk_mq_alloc_requests_batch(data); | |
| 581 | 564 | if (rq) { | |
| 582 | - | blk_mq_rq_late_init(rq, alloc_time_ns); | |
| 565 | + | blk_mq_rq_time_init(rq, alloc_time_ns); | |
| 583 | 566 | return rq; | |
| 584 | 567 | } | |
| 585 | 568 | data->nr_tags = 1; | |
| @@ -607,7 +590,7 @@ retry: | |||
| 607 | 590 | if (!(data->rq_flags & RQF_SCHED_TAGS)) | |
| 608 | 591 | blk_mq_inc_active_requests(data->hctx); | |
| 609 | 592 | rq = blk_mq_rq_ctx_init(data, blk_mq_tags_from_data(data), tag); | |
| 610 | - | blk_mq_rq_late_init(rq, alloc_time_ns); | |
| 593 | + | blk_mq_rq_time_init(rq, alloc_time_ns); | |
| 611 | 594 | return rq; | |
| 612 | 595 | } | |
| 613 | 596 | ||
| @@ -654,6 +637,8 @@ static struct request *blk_mq_alloc_cached_request(struct request_queue *q, | |||
| 654 | 637 | if (plug->nr_ios == 1) | |
| 655 | 638 | return NULL; | |
| 656 | 639 | rq = blk_mq_rq_cache_fill(q, plug, opf, flags); | |
| 640 | + | if (!rq) | |
| 641 | + | return NULL; | |
| 657 | 642 | } else { | |
| 658 | 643 | rq = rq_list_peek(&plug->cached_rqs); | |
| 659 | 644 | if (!rq || rq->q != q) | |
| @@ -661,13 +646,15 @@ static struct request *blk_mq_alloc_cached_request(struct request_queue *q, | |||
| 661 | 646 | ||
| 662 | 647 | if (blk_mq_get_hctx_type(opf) != rq->mq_hctx->type) | |
| 663 | 648 | return NULL; | |
| 649 | + | if (op_is_flush(rq->cmd_flags) != op_is_flush(opf)) | |
| 650 | + | return NULL; | |
| 664 | 651 | ||
| 665 | 652 | rq_list_pop(&plug->cached_rqs); | |
| 666 | - | rq->cmd_flags = opf; | |
| 667 | - | INIT_LIST_HEAD(&rq->queuelist); | |
| 668 | - | blk_mq_rq_late_init(rq, blk_time_get_ns()); | |
| 653 | + | blk_mq_rq_time_init(rq, blk_time_get_ns()); | |
| 669 | 654 | } | |
| 670 | 655 | ||
| 656 | + | rq->cmd_flags = opf; | |
| 657 | + | INIT_LIST_HEAD(&rq->queuelist); | |
| 671 | 658 | return rq; | |
| 672 | 659 | } | |
| 673 | 660 | ||
| @@ -779,7 +766,7 @@ struct request *blk_mq_alloc_request_hctx(struct request_queue *q, | |||
| 779 | 766 | if (!(data.rq_flags & RQF_SCHED_TAGS)) | |
| 780 | 767 | blk_mq_inc_active_requests(data.hctx); | |
| 781 | 768 | rq = blk_mq_rq_ctx_init(&data, blk_mq_tags_from_data(&data), tag); | |
| 782 | - | blk_mq_rq_late_init(rq, alloc_time_ns); | |
| 769 | + | blk_mq_rq_time_init(rq, alloc_time_ns); | |
| 783 | 770 | rq->__data_len = 0; | |
| 784 | 771 | rq->phys_gap_bit = 0; | |
| 785 | 772 | rq->__sector = (sector_t) -1; | |
| @@ -3073,6 +3060,8 @@ static struct request *blk_mq_get_cached_request(struct blk_plug *plug, | |||
| 3073 | 3060 | if (type != rq->mq_hctx->type && | |
| 3074 | 3061 | (type != HCTX_TYPE_READ || rq->mq_hctx->type != HCTX_TYPE_DEFAULT)) | |
| 3075 | 3062 | return NULL; | |
| 3063 | + | if (op_is_flush(rq->cmd_flags) != op_is_flush(opf)) | |
| 3064 | + | return NULL; | |
| 3076 | 3065 | rq_list_pop(&plug->cached_rqs); | |
| 3077 | 3066 | return rq; | |
| 3078 | 3067 | } | |
| @@ -3174,9 +3163,9 @@ void blk_mq_submit_bio(struct bio *bio) | |||
| 3174 | 3163 | new_request: | |
| 3175 | 3164 | if (rq) { | |
| 3176 | 3165 | rq_qos_throttle(rq->q, bio); | |
| 3166 | + | blk_mq_rq_time_init(rq, blk_time_get_ns()); | |
| 3177 | 3167 | rq->cmd_flags = bio->bi_opf; | |
| 3178 | 3168 | INIT_LIST_HEAD(&rq->queuelist); | |
| 3179 | - | blk_mq_rq_late_init(rq, blk_time_get_ns()); | |
| 3180 | 3169 | } else { | |
| 3181 | 3170 | rq = blk_mq_get_new_requests(q, plug, bio); | |
| 3182 | 3171 | if (unlikely(!rq)) { | |
modified block/fops.c
| @@ -402,11 +402,6 @@ static ssize_t blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter) | |||
| 402 | 402 | if (blkdev_dio_invalid(bdev, iocb, iter)) | |
| 403 | 403 | return -EINVAL; | |
| 404 | 404 | ||
| 405 | - | /* HIPRI needs private as bio; HAS_METADATA keeps it as uio_meta */ | |
| 406 | - | if ((iocb->ki_flags & IOCB_HIPRI) && | |
| 407 | - | (iocb->ki_flags & IOCB_HAS_METADATA)) | |
| 408 | - | return -EOPNOTSUPP; | |
| 409 | - | ||
| 410 | 405 | if (iov_iter_rw(iter) == WRITE) { | |
| 411 | 406 | u16 max_write_streams = bdev_max_write_streams(bdev); | |
| 412 | 407 | ||
modified block/genhd.c
| @@ -447,13 +447,6 @@ static int __add_disk(struct device *parent, struct gendisk *disk, | |||
| 447 | 447 | bdev_set_flag(disk->part0, BD_HAS_SUBMIT_BIO); | |
| 448 | 448 | } | |
| 449 | 449 | ||
| 450 | - | /* | |
| 451 | - | * We do not support partitions with zoned block devices, so do not try | |
| 452 | - | * to scan the partitions table. | |
| 453 | - | */ | |
| 454 | - | if (blk_queue_is_zoned(disk->queue)) | |
| 455 | - | disk->flags |= GENHD_FL_NO_PART; | |
| 456 | - | ||
| 457 | 450 | /* | |
| 458 | 451 | * If the driver provides an explicit major number it also must provide | |
| 459 | 452 | * the number of minors numbers supported, and those will be used to | |
modified block/mq-deadline.c
| @@ -685,7 +685,7 @@ static void dd_insert_requests(struct blk_mq_hw_ctx *hctx, | |||
| 685 | 685 | blk_mq_free_requests(&free); | |
| 686 | 686 | } | |
| 687 | 687 | ||
| 688 | - | /* Callback from inside blk_mq_rq_late_init(). */ | |
| 688 | + | /* Callback from inside blk_mq_rq_ctx_init(). */ | |
| 689 | 689 | static void dd_prepare_request(struct request *rq) | |
| 690 | 690 | { | |
| 691 | 691 | rq->elv.priv[0] = NULL; | |
modified crypto/aes.c
| @@ -637,18 +637,7 @@ static struct skcipher_alg skcipher_algs[] = { | |||
| 637 | 637 | .decrypt = crypto_aes_cbc_decrypt, | |
| 638 | 638 | }, | |
| 639 | 639 | #endif | |
| 640 | - | /* | |
| 641 | - | * Don't register library-based "cts(cbc(aes))" on architectures where | |
| 642 | - | * it might block a "better" implementation from being instantiated via | |
| 643 | - | * the "cts" template. These exclusions are temporary and will go away | |
| 644 | - | * as the arch-optimized AES code is migrated into the library. | |
| 645 | - | */ | |
| 646 | - | #if IS_ENABLED(CONFIG_CRYPTO_CTS) && \ | |
| 647 | - | !(IS_ENABLED(CONFIG_ARM) || \ | |
| 648 | - | IS_ENABLED(CONFIG_ARM64) || \ | |
| 649 | - | IS_ENABLED(CONFIG_PPC) || \ | |
| 650 | - | IS_ENABLED(CONFIG_S390) || \ | |
| 651 | - | IS_ENABLED(CONFIG_SPARC)) | |
| 640 | + | #if IS_ENABLED(CONFIG_CRYPTO_CTS) | |
| 652 | 641 | { | |
| 653 | 642 | .base.cra_name = "cts(cbc(aes))", | |
| 654 | 643 | .base.cra_driver_name = "cts-cbc-aes-lib", | |
| @@ -698,13 +687,7 @@ static struct skcipher_alg skcipher_algs[] = { | |||
| 698 | 687 | .decrypt = crypto_aes_xctr_crypt, | |
| 699 | 688 | }, | |
| 700 | 689 | #endif | |
| 701 | - | /* | |
| 702 | - | * Don't register library-based "xts(aes)" on architectures where it | |
| 703 | - | * might block a "better" implementation from being instantiated via the | |
| 704 | - | * "xts" template. This exclusion is temporary and will go away when | |
| 705 | - | * the library AES-XTS is optimized for SPARC. | |
| 706 | - | */ | |
| 707 | - | #if IS_ENABLED(CONFIG_CRYPTO_XTS) && !IS_ENABLED(CONFIG_SPARC) | |
| 690 | + | #if IS_ENABLED(CONFIG_CRYPTO_XTS) | |
| 708 | 691 | { | |
| 709 | 692 | .base.cra_name = "xts(aes)", | |
| 710 | 693 | .base.cra_driver_name = "xts-aes-lib", | |
| @@ -997,20 +980,7 @@ static __maybe_unused int crypto_aes_ccm_decrypt(struct aead_request *req) | |||
| 997 | 980 | } | |
| 998 | 981 | ||
| 999 | 982 | static struct aead_alg aead_algs[] = { | |
| 1000 | - | /* | |
| 1001 | - | * Don't register library-based "gcm(aes)" and "rfc4106(gcm(aes))" on | |
| 1002 | - | * architectures where they might block a "better" implementation from | |
| 1003 | - | * being instantiated via the "gcm" and "rfc4106" templates. These | |
| 1004 | - | * exclusions are temporary and will go away as the arch-optimized AES | |
| 1005 | - | * code is migrated into the library. | |
| 1006 | - | */ | |
| 1007 | - | #if IS_ENABLED(CONFIG_CRYPTO_GCM) && \ | |
| 1008 | - | !(IS_ENABLED(CONFIG_ARM) || \ | |
| 1009 | - | IS_ENABLED(CONFIG_ARM64) || \ | |
| 1010 | - | IS_ENABLED(CONFIG_PPC) || \ | |
| 1011 | - | IS_ENABLED(CONFIG_RISCV) || \ | |
| 1012 | - | IS_ENABLED(CONFIG_S390) || \ | |
| 1013 | - | IS_ENABLED(CONFIG_SPARC)) | |
| 983 | + | #if IS_ENABLED(CONFIG_CRYPTO_GCM) | |
| 1014 | 984 | { | |
| 1015 | 985 | .base.cra_name = "gcm(aes)", | |
| 1016 | 986 | .base.cra_driver_name = "gcm-aes-lib", | |
| @@ -1042,20 +1012,7 @@ static struct aead_alg aead_algs[] = { | |||
| 1042 | 1012 | .chunksize = AES_BLOCK_SIZE, | |
| 1043 | 1013 | }, | |
| 1044 | 1014 | #endif /* CONFIG_CRYPTO_GCM */ | |
| 1045 | - | /* | |
| 1046 | - | * Don't register library-based "ccm(aes)" on architectures where it | |
| 1047 | - | * might block a "better" implementation from being instantiated via the | |
| 1048 | - | * "ccm" template. These exclusions are temporary and will go away as | |
| 1049 | - | * the arch-optimized AES code is migrated into the library. | |
| 1050 | - | */ | |
| 1051 | - | #if IS_ENABLED(CONFIG_CRYPTO_CCM) && \ | |
| 1052 | - | !(IS_ENABLED(CONFIG_ARM) || \ | |
| 1053 | - | IS_ENABLED(CONFIG_ARM64) || \ | |
| 1054 | - | IS_ENABLED(CONFIG_PPC) || \ | |
| 1055 | - | IS_ENABLED(CONFIG_RISCV) || \ | |
| 1056 | - | IS_ENABLED(CONFIG_S390) || \ | |
| 1057 | - | IS_ENABLED(CONFIG_SPARC) || \ | |
| 1058 | - | IS_ENABLED(CONFIG_X86)) | |
| 1015 | + | #if IS_ENABLED(CONFIG_CRYPTO_CCM) | |
| 1059 | 1016 | { | |
| 1060 | 1017 | .base.cra_name = "ccm(aes)", | |
| 1061 | 1018 | .base.cra_driver_name = "ccm-aes-lib", | |
modified drivers/accel/amdxdna/aie2_message.c
| @@ -994,7 +994,7 @@ int aie2_cmdlist_multi_execbuf(struct amdxdna_hwctx *hwctx, | |||
| 994 | 994 | } | |
| 995 | 995 | ||
| 996 | 996 | ccnt = payload->command_count; | |
| 997 | - | if (!ccnt || payload_len < struct_size(payload, data, ccnt)) { | |
| 997 | + | if (payload_len < struct_size(payload, data, ccnt)) { | |
| 998 | 998 | XDNA_DBG(xdna, "Invalid command count %d", ccnt); | |
| 999 | 999 | return -EINVAL; | |
| 1000 | 1000 | } | |
modified drivers/accel/amdxdna/amdxdna_ctx.c
| @@ -183,10 +183,8 @@ int amdxdna_cmd_set_error(struct amdxdna_gem_obj *abo, | |||
| 183 | 183 | if (!abo) | |
| 184 | 184 | return -EINVAL; | |
| 185 | 185 | cmd = amdxdna_gem_vmap(abo); | |
| 186 | - | if (!cmd) { | |
| 187 | - | amdxdna_gem_put_obj(abo); | |
| 186 | + | if (!cmd) | |
| 188 | 187 | return -ENOMEM; | |
| 189 | - | } | |
| 190 | 188 | } | |
| 191 | 189 | ||
| 192 | 190 | memset(cmd->data, 0xff, abo->mem.size - sizeof(*cmd)); | |
modified drivers/accel/amdxdna/amdxdna_ctx.h
| @@ -55,7 +55,7 @@ struct amdxdna_cmd_chain { | |||
| 55 | 55 | u32 submit_index; | |
| 56 | 56 | u32 error_index; | |
| 57 | 57 | u32 reserved[3]; | |
| 58 | - | u64 data[]; | |
| 58 | + | u64 data[] __counted_by(command_count); | |
| 59 | 59 | }; | |
| 60 | 60 | ||
| 61 | 61 | /* | |
modified drivers/accel/amdxdna/amdxdna_gem.c
| @@ -1246,9 +1246,6 @@ static int amdxdna_flush_bo(struct amdxdna_gem_obj *abo, u64 offset, u64 size) | |||
| 1246 | 1246 | { | |
| 1247 | 1247 | u64 end; | |
| 1248 | 1248 | ||
| 1249 | - | if (is_import_bo(abo)) | |
| 1250 | - | return -EOPNOTSUPP; | |
| 1251 | - | ||
| 1252 | 1249 | if (offset >= abo->mem.size) | |
| 1253 | 1250 | return -EINVAL; | |
| 1254 | 1251 | ||
| @@ -1256,10 +1253,9 @@ static int amdxdna_flush_bo(struct amdxdna_gem_obj *abo, u64 offset, u64 size) | |||
| 1256 | 1253 | return -EINVAL; | |
| 1257 | 1254 | ||
| 1258 | 1255 | size = min(abo->mem.size, end) - offset; | |
| 1259 | - | if (!size) | |
| 1260 | - | return 0; | |
| 1261 | - | ||
| 1262 | - | if (amdxdna_gem_vmap(abo)) | |
| 1256 | + | if (is_import_bo(abo)) | |
| 1257 | + | drm_clflush_sg(abo->base.sgt); | |
| 1258 | + | else if (amdxdna_gem_vmap(abo)) | |
| 1263 | 1259 | drm_clflush_virt_range(amdxdna_gem_vmap(abo) + offset, size); | |
| 1264 | 1260 | else if (abo->base.pages) | |
| 1265 | 1261 | drm_clflush_pages(abo->base.pages, abo->mem.size >> PAGE_SHIFT); | |
modified drivers/accel/ethosu/ethosu_device.h
| @@ -87,7 +87,6 @@ struct gen_pool; | |||
| 87 | 87 | #define PMU_EV_TYPE_IDLE 0x20 | |
| 88 | 88 | ||
| 89 | 89 | enum ethosu_cmds { | |
| 90 | - | NPU_OP_STOP = 0x0, | |
| 91 | 90 | NPU_OP_CONV = 0x2, | |
| 92 | 91 | NPU_OP_DEPTHWISE = 0x3, | |
| 93 | 92 | NPU_OP_POOL = 0x5, | |
modified drivers/accel/ethosu/ethosu_drv.c
| @@ -281,6 +281,8 @@ static int ethosu_device_suspend(struct device *dev) | |||
| 281 | 281 | ||
| 282 | 282 | static int ethosu_sram_init(struct ethosu_device *ethosudev) | |
| 283 | 283 | { | |
| 284 | + | ethosudev->npu_info.sram_size = 0; | |
| 285 | + | ||
| 284 | 286 | ethosudev->srampool = of_gen_pool_get(ethosudev->base.dev->of_node, "sram", 0); | |
| 285 | 287 | if (!ethosudev->srampool) | |
| 286 | 288 | return 0; | |
| @@ -291,7 +293,6 @@ static int ethosu_sram_init(struct ethosu_device *ethosudev) | |||
| 291 | 293 | ethosudev->npu_info.sram_size, | |
| 292 | 294 | ðosudev->sramphys); | |
| 293 | 295 | if (!ethosudev->sram) { | |
| 294 | - | ethosudev->npu_info.sram_size = 0; | |
| 295 | 296 | dev_err(ethosudev->base.dev, "failed to allocate from SRAM pool\n"); | |
| 296 | 297 | return -ENOMEM; | |
| 297 | 298 | } | |
| @@ -355,8 +356,6 @@ static int ethosu_probe(struct platform_device *pdev) | |||
| 355 | 356 | dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(40)); | |
| 356 | 357 | ||
| 357 | 358 | ethosudev->regs = devm_platform_ioremap_resource(pdev, 0); | |
| 358 | - | if (IS_ERR(ethosudev->regs)) | |
| 359 | - | return PTR_ERR(ethosudev->regs); | |
| 360 | 359 | ethosudev->pmu_regs = ethosudev->regs; | |
| 361 | 360 | ||
| 362 | 361 | ethosudev->num_clks = devm_clk_bulk_get_all(&pdev->dev, ðosudev->clks); | |
modified drivers/accel/ethosu/ethosu_gem.c
| @@ -204,7 +204,7 @@ static u64 feat_matrix_length(struct ethosu_device *edev, | |||
| 204 | 204 | struct feat_matrix *fm, | |
| 205 | 205 | u32 x, u32 y, u32 c, bool ofm) | |
| 206 | 206 | { | |
| 207 | - | u32 element_size, storage = ethosu_is_u65(edev) ? 0 : fm->precision >> 14; | |
| 207 | + | u32 element_size, storage = fm->precision >> 14; | |
| 208 | 208 | int tile = 0; | |
| 209 | 209 | u64 addr; | |
| 210 | 210 | ||
| @@ -390,7 +390,6 @@ static int ethosu_gem_cmdstream_copy_and_validate(struct drm_device *ddev, | |||
| 390 | 390 | struct ethosu_validated_cmdstream_info __free(kfree) *info = kzalloc_obj(*info); | |
| 391 | 391 | struct ethosu_device *edev = to_ethosu_device(ddev); | |
| 392 | 392 | u32 *bocmds = bo->base.vaddr; | |
| 393 | - | bool ends_with_stop = false; | |
| 394 | 393 | struct cmd_state st; | |
| 395 | 394 | int i, ret; | |
| 396 | 395 | ||
| @@ -427,11 +426,6 @@ static int ethosu_gem_cmdstream_copy_and_validate(struct drm_device *ddev, | |||
| 427 | 426 | } | |
| 428 | 427 | ||
| 429 | 428 | switch (cmd) { | |
| 430 | - | case NPU_OP_STOP: | |
| 431 | - | if (i != size / 4 - 1) | |
| 432 | - | return -EINVAL; | |
| 433 | - | ends_with_stop = true; | |
| 434 | - | break; | |
| 435 | 429 | case NPU_OP_DMA_START: | |
| 436 | 430 | srclen = dma_length(info, &st.dma, &st.dma.src); | |
| 437 | 431 | dstlen = dma_length(info, &st.dma, &st.dma.dst); | |
| @@ -694,9 +688,6 @@ static int ethosu_gem_cmdstream_copy_and_validate(struct drm_device *ddev, | |||
| 694 | 688 | } | |
| 695 | 689 | } | |
| 696 | 690 | ||
| 697 | - | if (!ends_with_stop) | |
| 698 | - | return -EINVAL; | |
| 699 | - | ||
| 700 | 691 | for (i = 0; i < NPU_BASEP_REGION_MAX; i++) { | |
| 701 | 692 | if (!info->region_size[i]) | |
| 702 | 693 | continue; | |
modified drivers/accel/ethosu/ethosu_job.c
| @@ -154,13 +154,6 @@ static void ethosu_job_err_cleanup(struct ethosu_job *job) | |||
| 154 | 154 | ||
| 155 | 155 | drm_gem_object_put(job->cmd_bo); | |
| 156 | 156 | ||
| 157 | - | if (job->done_fence) { | |
| 158 | - | if (dma_fence_was_initialized(job->done_fence)) | |
| 159 | - | dma_fence_put(job->done_fence); | |
| 160 | - | else | |
| 161 | - | dma_fence_free(job->done_fence); | |
| 162 | - | } | |
| 163 | - | ||
| 164 | 157 | kfree(job); | |
| 165 | 158 | } | |
| 166 | 159 | ||
| @@ -171,6 +164,7 @@ static void ethosu_job_cleanup(struct kref *ref) | |||
| 171 | 164 | ||
| 172 | 165 | pm_runtime_put_autosuspend(job->dev->base.dev); | |
| 173 | 166 | ||
| 167 | + | dma_fence_put(job->done_fence); | |
| 174 | 168 | dma_fence_put(job->inference_done_fence); | |
| 175 | 169 | ||
| 176 | 170 | ethosu_job_err_cleanup(job); | |
| @@ -343,7 +337,7 @@ int ethosu_job_init(struct ethosu_device *edev) | |||
| 343 | 337 | ret = devm_request_threaded_irq(dev, edev->irq, | |
| 344 | 338 | ethosu_job_irq_handler, | |
| 345 | 339 | ethosu_job_irq_handler_thread, | |
| 346 | - | 0, KBUILD_MODNAME, | |
| 340 | + | IRQF_SHARED, KBUILD_MODNAME, | |
| 347 | 341 | edev); | |
| 348 | 342 | if (ret) { | |
| 349 | 343 | dev_err(dev, "failed to request irq\n"); | |
| @@ -374,10 +368,12 @@ int ethosu_job_open(struct ethosu_file_priv *ethosu_priv) | |||
| 374 | 368 | { | |
| 375 | 369 | struct ethosu_device *dev = ethosu_priv->edev; | |
| 376 | 370 | struct drm_gpu_scheduler *sched = &dev->sched; | |
| 371 | + | int ret; | |
| 377 | 372 | ||
| 378 | - | return drm_sched_entity_init(ðosu_priv->sched_entity, | |
| 379 | - | DRM_SCHED_PRIORITY_NORMAL, | |
| 380 | - | &sched, 1, NULL); | |
| 373 | + | ret = drm_sched_entity_init(ðosu_priv->sched_entity, | |
| 374 | + | DRM_SCHED_PRIORITY_NORMAL, | |
| 375 | + | &sched, 1, NULL); | |
| 376 | + | return WARN_ON(ret); | |
| 381 | 377 | } | |
| 382 | 378 | ||
| 383 | 379 | void ethosu_job_close(struct ethosu_file_priv *ethosu_priv) | |
| @@ -419,7 +415,7 @@ static int ethosu_ioctl_submit_job(struct drm_device *dev, struct drm_file *file | |||
| 419 | 415 | ejob->done_fence = kzalloc_obj(*ejob->done_fence); | |
| 420 | 416 | if (!ejob->done_fence) { | |
| 421 | 417 | ret = -ENOMEM; | |
| 422 | - | goto out_put_job; | |
| 418 | + | goto out_cleanup_job; | |
| 423 | 419 | } | |
| 424 | 420 | ||
| 425 | 421 | ret = drm_sched_job_init(&ejob->base, | |
| @@ -447,13 +443,13 @@ static int ethosu_ioctl_submit_job(struct drm_device *dev, struct drm_file *file | |||
| 447 | 443 | if (!cmd_info->region_size[i]) | |
| 448 | 444 | continue; | |
| 449 | 445 | if (i == ETHOSU_SRAM_REGION) { | |
| 450 | - | if (cmd_info->region_size[i] <= ejob->sram_size) | |
| 446 | + | if (cmd_info->region_size[i] <= edev->npu_info.sram_size) | |
| 451 | 447 | continue; | |
| 452 | 448 | ||
| 453 | 449 | dev_err(dev->dev, | |
| 454 | - | "cmd stream region %d size greater than job SRAM size (%llu > %u)\n", | |
| 450 | + | "cmd stream region %d size greater than SRAM size (%llu > %u)\n", | |
| 455 | 451 | i, cmd_info->region_size[i], | |
| 456 | - | ejob->sram_size); | |
| 452 | + | edev->npu_info.sram_size); | |
| 457 | 453 | ret = -EINVAL; | |
| 458 | 454 | goto out_cleanup_job; | |
| 459 | 455 | } | |
modified drivers/accel/ivpu/ivpu_drv.c
| @@ -515,7 +515,6 @@ void ivpu_prepare_for_reset(struct ivpu_device *vdev) | |||
| 515 | 515 | { | |
| 516 | 516 | ivpu_hw_irq_disable(vdev); | |
| 517 | 517 | disable_irq(vdev->irq); | |
| 518 | - | atomic_set(&vdev->job_timeout_detected, 0); | |
| 519 | 518 | flush_work(&vdev->irq_dct_work); | |
| 520 | 519 | flush_work(&vdev->context_abort_work); | |
| 521 | 520 | flush_work(&vdev->job_destroy_work); | |
| @@ -711,7 +710,7 @@ static int ivpu_dev_init(struct ivpu_device *vdev) | |||
| 711 | 710 | vdev->context_xa_limit.max = IVPU_USER_CONTEXT_MAX_SSID; | |
| 712 | 711 | atomic64_set(&vdev->unique_id_counter, 0); | |
| 713 | 712 | atomic_set(&vdev->job_timeout_counter, 0); | |
| 714 | - | atomic_set(&vdev->job_timeout_detected, 0); | |
| 713 | + | atomic_set(&vdev->faults_detected, 0); | |
| 715 | 714 | xa_init_flags(&vdev->context_xa, XA_FLAGS_ALLOC | XA_FLAGS_LOCK_IRQ); | |
| 716 | 715 | xa_init_flags(&vdev->submitted_jobs_xa, XA_FLAGS_ALLOC1); | |
| 717 | 716 | xa_init_flags(&vdev->db_xa, XA_FLAGS_ALLOC1); | |
modified drivers/accel/ivpu/ivpu_drv.h
| @@ -171,7 +171,7 @@ struct ivpu_device { | |||
| 171 | 171 | struct xarray submitted_jobs_xa; | |
| 172 | 172 | struct ivpu_ipc_consumer job_done_consumer; | |
| 173 | 173 | atomic_t job_timeout_counter; | |
| 174 | - | atomic_t job_timeout_detected; | |
| 174 | + | atomic_t faults_detected; | |
| 175 | 175 | ||
| 176 | 176 | atomic64_t unique_id_counter; | |
| 177 | 177 | ||
modified drivers/accel/ivpu/ivpu_fw_log.c
| @@ -26,17 +26,10 @@ MODULE_PARM_DESC(fw_log_level, | |||
| 26 | 26 | " error=" __stringify(IVPU_FW_LOG_ERROR) | |
| 27 | 27 | " fatal=" __stringify(IVPU_FW_LOG_FATAL)); | |
| 28 | 28 | ||
| 29 | - | struct ivpu_fw_log_desc { | |
| 30 | - | struct vpu_tracing_buffer_header *log; | |
| 31 | - | u32 header_size; | |
| 32 | - | u32 size; | |
| 33 | - | }; | |
| 34 | - | ||
| 35 | 29 | static int fw_log_from_bo(struct ivpu_device *vdev, struct ivpu_bo *bo, u32 *offset, | |
| 36 | - | struct ivpu_fw_log_desc *desc) | |
| 30 | + | struct vpu_tracing_buffer_header **out_log) | |
| 37 | 31 | { | |
| 38 | 32 | struct vpu_tracing_buffer_header *log; | |
| 39 | - | u32 header_size, size; | |
| 40 | 33 | ||
| 41 | 34 | if ((*offset + sizeof(*log)) > ivpu_bo_size(bo)) | |
| 42 | 35 | return -EINVAL; | |
| @@ -46,32 +39,26 @@ static int fw_log_from_bo(struct ivpu_device *vdev, struct ivpu_bo *bo, u32 *off | |||
| 46 | 39 | if (log->vpu_canary_start != VPU_TRACING_BUFFER_CANARY) | |
| 47 | 40 | return -EINVAL; | |
| 48 | 41 | ||
| 49 | - | header_size = READ_ONCE(log->header_size); | |
| 50 | - | size = READ_ONCE(log->size); | |
| 51 | - | ||
| 52 | - | if (header_size < sizeof(*log) || header_size > 1024) { | |
| 53 | - | ivpu_dbg(vdev, FW_BOOT, "Invalid header size 0x%x\n", header_size); | |
| 42 | + | if (log->header_size < sizeof(*log) || log->header_size > 1024) { | |
| 43 | + | ivpu_dbg(vdev, FW_BOOT, "Invalid header size 0x%x\n", log->header_size); | |
| 54 | 44 | return -EINVAL; | |
| 55 | 45 | } | |
| 56 | - | if ((char *)log + size > (char *)ivpu_bo_vaddr(bo) + ivpu_bo_size(bo)) { | |
| 57 | - | ivpu_dbg(vdev, FW_BOOT, "Invalid log size 0x%x\n", size); | |
| 46 | + | if (log->size < log->header_size) { | |
| 47 | + | ivpu_dbg(vdev, FW_BOOT, "Invalid log size 0x%x\n", log->size); | |
| 58 | 48 | return -EINVAL; | |
| 59 | 49 | } | |
| 60 | - | if (size < header_size) { | |
| 61 | - | ivpu_dbg(vdev, FW_BOOT, "Invalid log size 0x%x < header size 0x%x\n", | |
| 62 | - | size, header_size); | |
| 50 | + | if ((char *)log + log->size > (char *)ivpu_bo_vaddr(bo) + ivpu_bo_size(bo)) { | |
| 51 | + | ivpu_dbg(vdev, FW_BOOT, "Invalid log size 0x%x\n", log->size); | |
| 63 | 52 | return -EINVAL; | |
| 64 | 53 | } | |
| 65 | 54 | ||
| 66 | - | desc->log = log; | |
| 67 | - | desc->header_size = header_size; | |
| 68 | - | desc->size = size; | |
| 69 | - | *offset += size; | |
| 55 | + | *out_log = log; | |
| 56 | + | *offset += log->size; | |
| 70 | 57 | ||
| 71 | 58 | ivpu_dbg(vdev, FW_BOOT, | |
| 72 | - | "FW log name \"%.*s\", write offset 0x%x size 0x%x, wrap count %d, hdr version %d size %d format %d, alignment %d", | |
| 73 | - | (int)ARRAY_SIZE(log->name), log->name, log->write_index, size, log->wrap_count, | |
| 74 | - | log->header_version, header_size, log->format, log->alignment); | |
| 59 | + | "FW log name \"%s\", write offset 0x%x size 0x%x, wrap count %d, hdr version %d size %d format %d, alignment %d", | |
| 60 | + | log->name, log->write_index, log->size, log->wrap_count, log->header_version, | |
| 61 | + | log->header_size, log->format, log->alignment); | |
| 75 | 62 | ||
| 76 | 63 | return 0; | |
| 77 | 64 | } | |
| @@ -107,12 +94,11 @@ static void fw_log_print_lines(char *buffer, u32 size, struct drm_printer *p) | |||
| 107 | 94 | drm_printf(p, "%s", line); | |
| 108 | 95 | } | |
| 109 | 96 | ||
| 110 | - | static void fw_log_print_buffer(struct ivpu_fw_log_desc *desc, const char *prefix, | |
| 97 | + | static void fw_log_print_buffer(struct vpu_tracing_buffer_header *log, const char *prefix, | |
| 111 | 98 | bool only_new_msgs, struct drm_printer *p) | |
| 112 | 99 | { | |
| 113 | - | struct vpu_tracing_buffer_header *log = desc->log; | |
| 114 | - | char *log_data = (void *)log + desc->header_size; | |
| 115 | - | u32 data_size = desc->size - desc->header_size; | |
| 100 | + | char *log_data = (void *)log + log->header_size; | |
| 101 | + | u32 data_size = log->size - log->header_size; | |
| 116 | 102 | u32 log_start = only_new_msgs ? READ_ONCE(log->read_index) : 0; | |
| 117 | 103 | u32 log_end = READ_ONCE(log->write_index); | |
| 118 | 104 | ||
| @@ -123,8 +109,7 @@ static void fw_log_print_buffer(struct ivpu_fw_log_desc *desc, const char *prefi | |||
| 123 | 109 | ||
| 124 | 110 | if (log->wrap_count == log->read_wrap_count) { | |
| 125 | 111 | if (log_end <= log_start) { | |
| 126 | - | drm_printf(p, "==== %s \"%.*s\" log empty ====\n", prefix, | |
| 127 | - | (int)ARRAY_SIZE(log->name), log->name); | |
| 112 | + | drm_printf(p, "==== %s \"%s\" log empty ====\n", prefix, log->name); | |
| 128 | 113 | return; | |
| 129 | 114 | } | |
| 130 | 115 | } else if (log->wrap_count == log->read_wrap_count + 1) { | |
| @@ -134,8 +119,7 @@ static void fw_log_print_buffer(struct ivpu_fw_log_desc *desc, const char *prefi | |||
| 134 | 119 | log_start = log_end; | |
| 135 | 120 | } | |
| 136 | 121 | ||
| 137 | - | drm_printf(p, "==== %s \"%.*s\" log start ====\n", prefix, (int)ARRAY_SIZE(log->name), | |
| 138 | - | log->name); | |
| 122 | + | drm_printf(p, "==== %s \"%s\" log start ====\n", prefix, log->name); | |
| 139 | 123 | if (log_end > log_start) { | |
| 140 | 124 | fw_log_print_lines(log_data + log_start, log_end - log_start, p); | |
| 141 | 125 | } else { | |
| @@ -143,19 +127,18 @@ static void fw_log_print_buffer(struct ivpu_fw_log_desc *desc, const char *prefi | |||
| 143 | 127 | fw_log_print_lines(log_data, log_end, p); | |
| 144 | 128 | } | |
| 145 | 129 | drm_printf(p, "\n\x1b[0m"); /* add new line and clear formatting */ | |
| 146 | - | drm_printf(p, "==== %s \"%.*s\" log end ====\n", prefix, (int)ARRAY_SIZE(log->name), | |
| 147 | - | log->name); | |
| 130 | + | drm_printf(p, "==== %s \"%s\" log end ====\n", prefix, log->name); | |
| 148 | 131 | } | |
| 149 | 132 | ||
| 150 | 133 | static void | |
| 151 | 134 | fw_log_print_all_in_bo(struct ivpu_device *vdev, const char *name, | |
| 152 | 135 | struct ivpu_bo *bo, bool only_new_msgs, struct drm_printer *p) | |
| 153 | 136 | { | |
| 154 | - | struct ivpu_fw_log_desc desc; | |
| 137 | + | struct vpu_tracing_buffer_header *log; | |
| 155 | 138 | u32 next = 0; | |
| 156 | 139 | ||
| 157 | - | while (fw_log_from_bo(vdev, bo, &next, &desc) == 0) | |
| 158 | - | fw_log_print_buffer(&desc, name, only_new_msgs, p); | |
| 140 | + | while (fw_log_from_bo(vdev, bo, &next, &log) == 0) | |
| 141 | + | fw_log_print_buffer(log, name, only_new_msgs, p); | |
| 159 | 142 | } | |
| 160 | 143 | ||
| 161 | 144 | void ivpu_fw_log_print(struct ivpu_device *vdev, bool only_new_msgs, struct drm_printer *p) | |
| @@ -166,36 +149,36 @@ void ivpu_fw_log_print(struct ivpu_device *vdev, bool only_new_msgs, struct drm_ | |||
| 166 | 149 | ||
| 167 | 150 | void ivpu_fw_log_mark_read(struct ivpu_device *vdev) | |
| 168 | 151 | { | |
| 169 | - | struct ivpu_fw_log_desc desc; | |
| 152 | + | struct vpu_tracing_buffer_header *log; | |
| 170 | 153 | u32 next; | |
| 171 | 154 | ||
| 172 | 155 | next = 0; | |
| 173 | - | while (fw_log_from_bo(vdev, vdev->fw->mem_log_crit, &next, &desc) == 0) { | |
| 174 | - | desc.log->read_index = READ_ONCE(desc.log->write_index); | |
| 175 | - | desc.log->read_wrap_count = READ_ONCE(desc.log->wrap_count); | |
| 156 | + | while (fw_log_from_bo(vdev, vdev->fw->mem_log_crit, &next, &log) == 0) { | |
| 157 | + | log->read_index = READ_ONCE(log->write_index); | |
| 158 | + | log->read_wrap_count = READ_ONCE(log->wrap_count); | |
| 176 | 159 | } | |
| 177 | 160 | ||
| 178 | 161 | next = 0; | |
| 179 | - | while (fw_log_from_bo(vdev, vdev->fw->mem_log_verb, &next, &desc) == 0) { | |
| 180 | - | desc.log->read_index = READ_ONCE(desc.log->write_index); | |
| 181 | - | desc.log->read_wrap_count = READ_ONCE(desc.log->wrap_count); | |
| 162 | + | while (fw_log_from_bo(vdev, vdev->fw->mem_log_verb, &next, &log) == 0) { | |
| 163 | + | log->read_index = READ_ONCE(log->write_index); | |
| 164 | + | log->read_wrap_count = READ_ONCE(log->wrap_count); | |
| 182 | 165 | } | |
| 183 | 166 | } | |
| 184 | 167 | ||
| 185 | 168 | void ivpu_fw_log_reset(struct ivpu_device *vdev) | |
| 186 | 169 | { | |
| 187 | - | struct ivpu_fw_log_desc desc; | |
| 170 | + | struct vpu_tracing_buffer_header *log; | |
| 188 | 171 | u32 next; | |
| 189 | 172 | ||
| 190 | 173 | next = 0; | |
| 191 | - | while (fw_log_from_bo(vdev, vdev->fw->mem_log_crit, &next, &desc) == 0) { | |
| 192 | - | desc.log->read_index = 0; | |
| 193 | - | desc.log->read_wrap_count = 0; | |
| 174 | + | while (fw_log_from_bo(vdev, vdev->fw->mem_log_crit, &next, &log) == 0) { | |
| 175 | + | log->read_index = 0; | |
| 176 | + | log->read_wrap_count = 0; | |
| 194 | 177 | } | |
| 195 | 178 | ||
| 196 | 179 | next = 0; | |
| 197 | - | while (fw_log_from_bo(vdev, vdev->fw->mem_log_verb, &next, &desc) == 0) { | |
| 198 | - | desc.log->read_index = 0; | |
| 199 | - | desc.log->read_wrap_count = 0; | |
| 180 | + | while (fw_log_from_bo(vdev, vdev->fw->mem_log_verb, &next, &log) == 0) { | |
| 181 | + | log->read_index = 0; | |
| 182 | + | log->read_wrap_count = 0; | |
| 200 | 183 | } | |
| 201 | 184 | } | |
modified drivers/accel/ivpu/ivpu_gem.h
| @@ -87,23 +87,15 @@ static inline bool ivpu_bo_is_resident(struct ivpu_bo *bo) | |||
| 87 | 87 | return !!bo->base.pages; | |
| 88 | 88 | } | |
| 89 | 89 | ||
| 90 | - | static inline void *ivpu_to_cpu_addr(struct ivpu_bo *bo, u64 vpu_addr, u64 size) | |
| 90 | + | static inline void *ivpu_to_cpu_addr(struct ivpu_bo *bo, u32 vpu_addr) | |
| 91 | 91 | { | |
| 92 | - | u64 bo_size = ivpu_bo_size(bo); | |
| 93 | - | u64 offset; | |
| 94 | - | ||
| 95 | 92 | if (vpu_addr < bo->vpu_addr) | |
| 96 | 93 | return NULL; | |
| 97 | 94 | ||
| 98 | - | if (size > bo_size) | |
| 99 | - | return NULL; | |
| 100 | - | ||
| 101 | - | offset = vpu_addr - bo->vpu_addr; | |
| 102 | - | ||
| 103 | - | if (offset > bo_size - size) | |
| 95 | + | if (vpu_addr >= (bo->vpu_addr + ivpu_bo_size(bo))) | |
| 104 | 96 | return NULL; | |
| 105 | 97 | ||
| 106 | - | return ivpu_bo_vaddr(bo) + offset; | |
| 98 | + | return ivpu_bo_vaddr(bo) + (vpu_addr - bo->vpu_addr); | |
| 107 | 99 | } | |
| 108 | 100 | ||
| 109 | 101 | static inline u32 cpu_to_vpu_addr(struct ivpu_bo *bo, void *cpu_addr) | |
modified drivers/accel/ivpu/ivpu_ipc.c
| @@ -79,7 +79,7 @@ ivpu_ipc_tx_prepare(struct ivpu_device *vdev, struct ivpu_ipc_consumer *cons, | |||
| 79 | 79 | return -ENOMEM; | |
| 80 | 80 | } | |
| 81 | 81 | ||
| 82 | - | tx_buf = ivpu_to_cpu_addr(ipc->mem_tx, tx_buf_vpu_addr, sizeof(*tx_buf)); | |
| 82 | + | tx_buf = ivpu_to_cpu_addr(ipc->mem_tx, tx_buf_vpu_addr); | |
| 83 | 83 | if (drm_WARN_ON(&vdev->drm, !tx_buf)) { | |
| 84 | 84 | gen_pool_free(ipc->mm_tx, tx_buf_vpu_addr, sizeof(*tx_buf)); | |
| 85 | 85 | return -EIO; | |
| @@ -420,7 +420,7 @@ void ivpu_ipc_irq_handler(struct ivpu_device *vdev) | |||
| 420 | 420 | return; | |
| 421 | 421 | } | |
| 422 | 422 | ||
| 423 | - | ipc_hdr = ivpu_to_cpu_addr(ipc->mem_rx, vpu_addr, sizeof(*ipc_hdr)); | |
| 423 | + | ipc_hdr = ivpu_to_cpu_addr(ipc->mem_rx, vpu_addr); | |
| 424 | 424 | if (!ipc_hdr) { | |
| 425 | 425 | ivpu_warn_ratelimited(vdev, "IPC msg 0x%x out of range\n", vpu_addr); | |
| 426 | 426 | continue; | |
| @@ -429,8 +429,7 @@ void ivpu_ipc_irq_handler(struct ivpu_device *vdev) | |||
| 429 | 429 | ||
| 430 | 430 | jsm_msg = NULL; | |
| 431 | 431 | if (ipc_hdr->channel != IVPU_IPC_CHAN_BOOT_MSG) { | |
| 432 | - | jsm_msg = ivpu_to_cpu_addr(ipc->mem_rx, ipc_hdr->data_addr, | |
| 433 | - | sizeof(*jsm_msg)); | |
| 432 | + | jsm_msg = ivpu_to_cpu_addr(ipc->mem_rx, ipc_hdr->data_addr); | |
| 434 | 433 | if (!jsm_msg) { | |
| 435 | 434 | ivpu_warn_ratelimited(vdev, "JSM msg 0x%x out of range\n", | |
| 436 | 435 | ipc_hdr->data_addr); | |
modified drivers/accel/ivpu/ivpu_job.c
| @@ -621,6 +621,7 @@ bool ivpu_job_handle_engine_error(struct ivpu_device *vdev, u32 job_id, u32 job_ | |||
| 621 | 621 | * status and ensure both are handled in the same way | |
| 622 | 622 | */ | |
| 623 | 623 | job->file_priv->has_mmu_faults = true; | |
| 624 | + | atomic_set(&vdev->faults_detected, 1); | |
| 624 | 625 | queue_work(system_percpu_wq, &vdev->context_abort_work); | |
| 625 | 626 | return true; | |
| 626 | 627 | } | |
| @@ -1174,10 +1175,10 @@ static int reset_engine_and_mark_faulty_contexts(struct ivpu_device *vdev) | |||
| 1174 | 1175 | return ret; | |
| 1175 | 1176 | ||
| 1176 | 1177 | /* | |
| 1177 | - | * If job timeout is detected, read guilty context from engine reset, for other reasons | |
| 1178 | - | * faulty context is already known | |
| 1178 | + | * If faults are detected, ignore guilty contexts from engine reset as NPU may not be stuck | |
| 1179 | + | * and could return currently running good context and faulty contexts are already marked | |
| 1179 | 1180 | */ | |
| 1180 | - | if (atomic_cmpxchg(&vdev->job_timeout_detected, 1, 0) == 0) | |
| 1181 | + | if (atomic_cmpxchg(&vdev->faults_detected, 1, 0) == 1) | |
| 1181 | 1182 | return 0; | |
| 1182 | 1183 | ||
| 1183 | 1184 | num_impacted_contexts = resp.payload.engine_reset_done.num_impacted_contexts; | |
modified drivers/accel/ivpu/ivpu_mmu.c
| @@ -964,6 +964,7 @@ void ivpu_mmu_irq_evtq_handler(struct ivpu_device *vdev) | |||
| 964 | 964 | file_priv = xa_load(&vdev->context_xa, ssid); | |
| 965 | 965 | if (file_priv) { | |
| 966 | 966 | if (!READ_ONCE(file_priv->has_mmu_faults)) { | |
| 967 | + | atomic_set(&vdev->faults_detected, 1); | |
| 967 | 968 | ivpu_mmu_dump_event(vdev, event); | |
| 968 | 969 | WRITE_ONCE(file_priv->has_mmu_faults, true); | |
| 969 | 970 | } | |
modified drivers/accel/ivpu/ivpu_pm.c
| @@ -229,7 +229,6 @@ abort: | |||
| 229 | 229 | ||
| 230 | 230 | ivpu_jsm_state_dump(vdev); | |
| 231 | 231 | ivpu_dev_coredump(vdev); | |
| 232 | - | atomic_set(&vdev->job_timeout_detected, 1); | |
| 233 | 232 | queue_work(system_percpu_wq, &vdev->context_abort_work); | |
| 234 | 233 | } | |
| 235 | 234 | ||
modified drivers/accel/qaic/qaic_control.c
| @@ -963,13 +963,11 @@ static int decode_status(struct qaic_device *qdev, void *trans, struct manage_ms | |||
| 963 | 963 | ||
| 964 | 964 | static int decode_message(struct qaic_device *qdev, struct manage_msg *user_msg, | |
| 965 | 965 | struct wire_msg *msg, struct ioctl_resources *resources, | |
| 966 | - | struct qaic_user *usr, bool orphaned_deactivate) | |
| 966 | + | struct qaic_user *usr) | |
| 967 | 967 | { | |
| 968 | - | u32 msg_hdr_count = le32_to_cpu(msg->hdr.count); | |
| 969 | 968 | u32 msg_hdr_len = le32_to_cpu(msg->hdr.len); | |
| 970 | 969 | struct wire_trans_hdr *trans_hdr; | |
| 971 | 970 | u32 msg_len = 0; | |
| 972 | - | int trans_type; | |
| 973 | 971 | int ret; | |
| 974 | 972 | int i; | |
| 975 | 973 | ||
| @@ -977,12 +975,10 @@ static int decode_message(struct qaic_device *qdev, struct manage_msg *user_msg, | |||
| 977 | 975 | msg_hdr_len > QAIC_MANAGE_MAX_MSG_LENGTH) | |
| 978 | 976 | return -EINVAL; | |
| 979 | 977 | ||
| 980 | - | if (user_msg) { | |
| 981 | - | user_msg->len = 0; | |
| 982 | - | user_msg->count = msg_hdr_count; | |
| 983 | - | } | |
| 978 | + | user_msg->len = 0; | |
| 979 | + | user_msg->count = le32_to_cpu(msg->hdr.count); | |
| 984 | 980 | ||
| 985 | - | for (i = 0; i < msg_hdr_count; ++i) { | |
| 981 | + | for (i = 0; i < user_msg->count; ++i) { | |
| 986 | 982 | u32 hdr_len; | |
| 987 | 983 | ||
| 988 | 984 | if (msg_len > msg_hdr_len - sizeof(*trans_hdr)) | |
| @@ -994,20 +990,7 @@ static int decode_message(struct qaic_device *qdev, struct manage_msg *user_msg, | |||
| 994 | 990 | size_add(msg_len, hdr_len) > msg_hdr_len) | |
| 995 | 991 | return -EINVAL; | |
| 996 | 992 | ||
| 997 | - | trans_type = le32_to_cpu(trans_hdr->type); | |
| 998 | - | /* | |
| 999 | - | * orphaned_deactivate is the case where a deactivate response | |
| 1000 | - | * is received from the device after the user owning the DBC, | |
| 1001 | - | * and the message requesting deactivation, has gone away. | |
| 1002 | - | * In this case, only process QAIC_TRANS_DEACTIVATE_FROM_DEV | |
| 1003 | - | * transaction and skip the others. | |
| 1004 | - | */ | |
| 1005 | - | if (orphaned_deactivate && trans_type != QAIC_TRANS_DEACTIVATE_FROM_DEV) { | |
| 1006 | - | msg_len += hdr_len; | |
| 1007 | - | continue; | |
| 1008 | - | } | |
| 1009 | - | ||
| 1010 | - | switch (trans_type) { | |
| 993 | + | switch (le32_to_cpu(trans_hdr->type)) { | |
| 1011 | 994 | case QAIC_TRANS_PASSTHROUGH_FROM_DEV: | |
| 1012 | 995 | ret = decode_passthrough(qdev, trans_hdr, user_msg, &msg_len); | |
| 1013 | 996 | break; | |
| @@ -1298,7 +1281,7 @@ dma_xfer_continue: | |||
| 1298 | 1281 | goto dma_cont_failed; | |
| 1299 | 1282 | } | |
| 1300 | 1283 | ||
| 1301 | - | ret = decode_message(qdev, user_msg, rsp, &resources, usr, false); | |
| 1284 | + | ret = decode_message(qdev, user_msg, rsp, &resources, usr); | |
| 1302 | 1285 | ||
| 1303 | 1286 | dma_cont_failed: | |
| 1304 | 1287 | free_dbc_buf(qdev, &resources); | |
| @@ -1463,7 +1446,22 @@ static void resp_worker(struct work_struct *work) | |||
| 1463 | 1446 | * response to the QAIC_TRANS_TERMINATE_TO_DEV transaction, | |
| 1464 | 1447 | * otherwise, the user can issue an soc_reset to the device. | |
| 1465 | 1448 | */ | |
| 1466 | - | decode_message(qdev, NULL, msg, NULL, NULL, true); | |
| 1449 | + | u32 msg_count = le32_to_cpu(msg->hdr.count); | |
| 1450 | + | u32 msg_len = le32_to_cpu(msg->hdr.len); | |
| 1451 | + | u32 len = 0; | |
| 1452 | + | int j; | |
| 1453 | + | ||
| 1454 | + | for (j = 0; j < msg_count && len < msg_len; ++j) { | |
| 1455 | + | struct wire_trans_hdr *trans_hdr; | |
| 1456 | + | ||
| 1457 | + | trans_hdr = (struct wire_trans_hdr *)(msg->data + len); | |
| 1458 | + | if (le32_to_cpu(trans_hdr->type) == QAIC_TRANS_DEACTIVATE_FROM_DEV) { | |
| 1459 | + | if (decode_deactivate(qdev, trans_hdr, &len, NULL)) | |
| 1460 | + | len += le32_to_cpu(trans_hdr->len); | |
| 1461 | + | } else { | |
| 1462 | + | len += le32_to_cpu(trans_hdr->len); | |
| 1463 | + | } | |
| 1464 | + | } | |
| 1467 | 1465 | /* request must have timed out, drop packet */ | |
| 1468 | 1466 | kfree(msg); | |
| 1469 | 1467 | } | |
modified drivers/accel/rocket/rocket_job.c
| @@ -196,7 +196,7 @@ static int rocket_job_push(struct rocket_job *job) | |||
| 196 | 196 | if (check_add_overflow(job->in_bo_count, job->out_bo_count, &bo_count)) | |
| 197 | 197 | return -EINVAL; | |
| 198 | 198 | ||
| 199 | - | bos = kvmalloc_objs(*bos, bo_count); | |
| 199 | + | bos = kvmalloc_array(bo_count, sizeof(*bos), GFP_KERNEL); | |
| 200 | 200 | if (!bos) | |
| 201 | 201 | return -ENOMEM; | |
| 202 | 202 | memcpy(bos, job->in_bos, job->in_bo_count * sizeof(void *)); | |
modified drivers/accessibility/braille/braille_console.c
| @@ -62,50 +62,14 @@ static void braille_write(u16 *buf) | |||
| 62 | 62 | { | |
| 63 | 63 | static u16 lastwrite[WIDTH]; | |
| 64 | 64 | unsigned char data[1 + 1 + 2*WIDTH + 2 + 1], csum = 0, *c; | |
| 65 | - | struct nbcon_write_context wctxt = { }; | |
| 66 | - | unsigned long flags; | |
| 67 | 65 | u16 out; | |
| 68 | 66 | int i; | |
| 69 | 67 | ||
| 70 | 68 | if (!braille_co) | |
| 71 | 69 | return; | |
| 72 | 70 | ||
| 73 | - | /* | |
| 74 | - | * Braille console is not registered in console_list. Instead, it | |
| 75 | - | * is integrated with VT and shows what appears on the graphical | |
| 76 | - | * console under console_lock(). From this POV it is a legacy | |
| 77 | - | * console. But it calls serial console driver which might be | |
| 78 | - | * converted to the NBCON API. It is similar to | |
| 79 | - | * nbcon_legacy_emit_next_record() except that we should try | |
| 80 | - | * harder to get the lock. Otherwise, the Braille device won't show | |
| 81 | - | * everything what is displayed on the terminal. | |
| 82 | - | * | |
| 83 | - | * In short, simulate the original locking using NBCON API. | |
| 84 | - | */ | |
| 85 | - | if (braille_co->flags & CON_NBCON) { | |
| 86 | - | if (panic_on_this_cpu()) { | |
| 87 | - | /* | |
| 88 | - | * This should be good enough in practice. Most/all | |
| 89 | - | * serial console drivers have the atomic callback. | |
| 90 | - | */ | |
| 91 | - | if (!braille_co->write_atomic) | |
| 92 | - | return; | |
| 93 | - | ||
| 94 | - | local_irq_save(flags); | |
| 95 | - | /* NBCON API strictly requires the ownership. */ | |
| 96 | - | if (!nbcon_braille_try_acquire(braille_co, &wctxt)) { | |
| 97 | - | local_irq_restore(flags); | |
| 98 | - | return; | |
| 99 | - | } | |
| 100 | - | } else { | |
| 101 | - | braille_co->device_lock(braille_co, &flags); | |
| 102 | - | while (!nbcon_braille_try_acquire(braille_co, &wctxt)) | |
| 103 | - | cpu_relax(); | |
| 104 | - | } | |
| 105 | - | } | |
| 106 | - | ||
| 107 | 71 | if (!memcmp(lastwrite, buf, WIDTH * sizeof(*buf))) | |
| 108 | - | goto unlock_nbcon; | |
| 72 | + | return; | |
| 109 | 73 | memcpy(lastwrite, buf, WIDTH * sizeof(*buf)); | |
| 110 | 74 | ||
| 111 | 75 | #define SOH 1 | |
| @@ -138,24 +102,7 @@ static void braille_write(u16 *buf) | |||
| 138 | 102 | *c++ = csum; | |
| 139 | 103 | *c++ = ETX; | |
| 140 | 104 | ||
| 141 | - | if (braille_co->flags & CON_NBCON) { | |
| 142 | - | nbcon_write_context_set_buf(&wctxt, (char *)data, c - data); | |
| 143 | - | if (panic_on_this_cpu()) | |
| 144 | - | braille_co->write_atomic(braille_co, &wctxt); | |
| 145 | - | else | |
| 146 | - | braille_co->write_thread(braille_co, &wctxt); | |
| 147 | - | } else { | |
| 148 | - | braille_co->write(braille_co, data, c - data); | |
| 149 | - | } | |
| 150 | - | ||
| 151 | - | unlock_nbcon: | |
| 152 | - | if (braille_co->flags & CON_NBCON) { | |
| 153 | - | nbcon_braille_release(&wctxt); | |
| 154 | - | if (panic_on_this_cpu()) | |
| 155 | - | local_irq_restore(flags); | |
| 156 | - | else | |
| 157 | - | braille_co->device_unlock(braille_co, flags); | |
| 158 | - | } | |
| 105 | + | braille_co->write(braille_co, data, c - data); | |
| 159 | 106 | } | |
| 160 | 107 | ||
| 161 | 108 | /* Follow the VC cursor*/ | |
modified drivers/acpi/irq.c
| @@ -486,8 +486,7 @@ static u32 acpi_add_prt_dep(acpi_handle handle) | |||
| 486 | 486 | if (ACPI_FAILURE(status)) | |
| 487 | 487 | continue; | |
| 488 | 488 | dep_devices.count = 1; | |
| 489 | - | dep_devices.handles = kzalloc_objs(*dep_devices.handles, | |
| 490 | - | 1); | |
| 489 | + | dep_devices.handles = kcalloc(1, sizeof(*dep_devices.handles), GFP_KERNEL); | |
| 491 | 490 | if (!dep_devices.handles) { | |
| 492 | 491 | acpi_handle_err(handle, "failed to allocate memory\n"); | |
| 493 | 492 | continue; | |
| @@ -500,8 +499,7 @@ static u32 acpi_add_prt_dep(acpi_handle handle) | |||
| 500 | 499 | if (!gsi_handle) | |
| 501 | 500 | continue; | |
| 502 | 501 | dep_devices.count = 1; | |
| 503 | - | dep_devices.handles = kzalloc_objs(*dep_devices.handles, | |
| 504 | - | 1); | |
| 502 | + | dep_devices.handles = kcalloc(1, sizeof(*dep_devices.handles), GFP_KERNEL); | |
| 505 | 503 | if (!dep_devices.handles) { | |
| 506 | 504 | acpi_handle_err(handle, "failed to allocate memory\n"); | |
| 507 | 505 | continue; | |
| @@ -528,7 +526,7 @@ static u32 acpi_add_irq_dep(acpi_handle handle) | |||
| 528 | 526 | continue; | |
| 529 | 527 | ||
| 530 | 528 | dep_devices.count = 1; | |
| 531 | - | dep_devices.handles = kzalloc_objs(*dep_devices.handles, 1); | |
| 529 | + | dep_devices.handles = kcalloc(1, sizeof(*dep_devices.handles), GFP_KERNEL); | |
| 532 | 530 | if (!dep_devices.handles) { | |
| 533 | 531 | acpi_handle_err(handle, "failed to allocate memory\n"); | |
| 534 | 532 | continue; | |
modified drivers/acpi/scan.c
| @@ -28,7 +28,9 @@ | |||
| 28 | 28 | #include "internal.h" | |
| 29 | 29 | #include "sleep.h" | |
| 30 | 30 | ||
| 31 | + | #define ACPI_BUS_CLASS "system_bus" | |
| 31 | 32 | #define ACPI_BUS_HID "LNXSYBUS" | |
| 33 | + | #define ACPI_BUS_DEVICE_NAME "System Bus" | |
| 32 | 34 | ||
| 33 | 35 | #define INVALID_ACPI_HANDLE ((acpi_handle)ZERO_PAGE(0)) | |
| 34 | 36 | ||
| @@ -1448,6 +1450,8 @@ static void acpi_set_pnp_ids(acpi_handle handle, struct acpi_device_pnp *pnp, | |||
| 1448 | 1450 | acpi_object_is_system_bus(handle)) { | |
| 1449 | 1451 | /* \_SB, \_TZ, LNXSYBUS */ | |
| 1450 | 1452 | acpi_add_id(pnp, ACPI_BUS_HID); | |
| 1453 | + | strscpy(pnp->device_name, ACPI_BUS_DEVICE_NAME); | |
| 1454 | + | strscpy(pnp->device_class, ACPI_BUS_CLASS); | |
| 1451 | 1455 | } | |
| 1452 | 1456 | ||
| 1453 | 1457 | break; | |
modified drivers/android/binder.c
| @@ -2930,9 +2930,8 @@ static int binder_proc_transaction(struct binder_transaction *t, | |||
| 2930 | 2930 | t_outdated->buffer = NULL; | |
| 2931 | 2931 | buffer->transaction = NULL; | |
| 2932 | 2932 | trace_binder_transaction_update_buffer_release(buffer); | |
| 2933 | - | binder_release_entire_buffer(proc, NULL, buffer, true); | |
| 2933 | + | binder_release_entire_buffer(proc, NULL, buffer, false); | |
| 2934 | 2934 | binder_alloc_free_buf(&proc->alloc, buffer); | |
| 2935 | - | binder_free_txn_fixups(t_outdated); | |
| 2936 | 2935 | kfree(t_outdated); | |
| 2937 | 2936 | binder_stats_deleted(BINDER_STAT_TRANSACTION); | |
| 2938 | 2937 | } | |
modified drivers/android/binder/node.rs
| @@ -51,9 +51,9 @@ pub(crate) struct CouldNotDeliverCriticalIncrement; | |||
| 51 | 51 | /// about to drop the weak reference, then the strong increment could be processed after the | |
| 52 | 52 | /// other thread has already exited, which would be too late. | |
| 53 | 53 | /// | |
| 54 | - | /// Note that trying to create a `ListArc` to the node can succeed even if `has_pushed_node` is | |
| 54 | + | /// Note that trying to create a `ListArc` to the node can succeed even if `has_normal_push` is | |
| 55 | 55 | /// set. This is because another thread might just have popped the node from a todo list, but not | |
| 56 | - | /// yet called `do_work`. However, if `has_pushed_node` is false, then creating a `ListArc` should | |
| 56 | + | /// yet called `do_work`. However, if `has_normal_push` is false, then creating a `ListArc` should | |
| 57 | 57 | /// always succeed. | |
| 58 | 58 | /// | |
| 59 | 59 | /// Like the other fields in `NodeInner`, the delivery state is protected by the process lock. | |
| @@ -738,21 +738,7 @@ impl DeliverToRead for Node { | |||
| 738 | 738 | self.do_work_locked(writer, owner_inner) | |
| 739 | 739 | } | |
| 740 | 740 | ||
| 741 | - | fn cancel(self: DArc<Self>) { | |
| 742 | - | let _drop_outside_lock; | |
| 743 | - | let mut owner_inner = self.owner.inner.lock(); | |
| 744 | - | ||
| 745 | - | // We only do something on BINDER_THREAD_EXIT, not process exit. | |
| 746 | - | if owner_inner.is_dead { | |
| 747 | - | return; | |
| 748 | - | } | |
| 749 | - | ||
| 750 | - | // If BINDER_THREAD_EXIT is invoked on a thread with a pending node refcount update, we | |
| 751 | - | // should move ourselves to ensure the refcount update is still delivered. | |
| 752 | - | if let Some(node) = ListArc::try_from_arc_borrow(self.as_arc_borrow()) { | |
| 753 | - | _drop_outside_lock = owner_inner.push_work(&self.owner, node); | |
| 754 | - | } | |
| 755 | - | } | |
| 741 | + | fn cancel(self: DArc<Self>) {} | |
| 756 | 742 | ||
| 757 | 743 | fn should_sync_wakeup(&self) -> bool { | |
| 758 | 744 | false | |
modified drivers/android/binder/node/wrapper.rs
| @@ -57,39 +57,7 @@ impl DeliverToRead for NodeWrapper { | |||
| 57 | 57 | node.do_work_locked(writer, owner_inner) | |
| 58 | 58 | } | |
| 59 | 59 | ||
| 60 | - | fn cancel(self: DArc<Self>) { | |
| 61 | - | let _drop_outside_lock; | |
| 62 | - | let node = &self.node; | |
| 63 | - | let mut owner_inner = node.owner.inner.lock(); | |
| 64 | - | ||
| 65 | - | // We only do something on BINDER_THREAD_EXIT, not process exit. | |
| 66 | - | if owner_inner.is_dead { | |
| 67 | - | return; | |
| 68 | - | } | |
| 69 | - | ||
| 70 | - | // We transfer the responsibility of the node refcount update to the scheduled Node because | |
| 71 | - | // NodeWrapper has no way to re-create the ListArc. | |
| 72 | - | let inner = node.inner.access_mut(&mut owner_inner); | |
| 73 | - | ||
| 74 | - | let ds = &mut inner.delivery_state; | |
| 75 | - | assert!(ds.has_pushed_wrapper); | |
| 76 | - | assert!(ds.has_strong_zero2one); | |
| 77 | - | ds.has_pushed_wrapper = false; | |
| 78 | - | ||
| 79 | - | // We are changing the state to one where the Node is the strong zero2one update instead of | |
| 80 | - | // the wrapper. | |
| 81 | - | ds.has_weak_zero2one = false; | |
| 82 | - | ||
| 83 | - | if !ds.has_pushed_node { | |
| 84 | - | if let Some(node2) = ListArc::try_from_arc_borrow(node.as_arc_borrow()) { | |
| 85 | - | ds.has_pushed_node = true; | |
| 86 | - | _drop_outside_lock = owner_inner.push_work(&node.owner, node2); | |
| 87 | - | } else { | |
| 88 | - | // This can't actually happen. | |
| 89 | - | ds.has_strong_zero2one = false; | |
| 90 | - | } | |
| 91 | - | } | |
| 92 | - | } | |
| 60 | + | fn cancel(self: DArc<Self>) {} | |
| 93 | 61 | ||
| 94 | 62 | fn should_sync_wakeup(&self) -> bool { | |
| 95 | 63 | false | |
modified drivers/android/binder/rust_binderfs.c
| @@ -72,7 +72,6 @@ struct binder_features { | |||
| 72 | 72 | bool oneway_spam_detection; | |
| 73 | 73 | bool extended_error; | |
| 74 | 74 | bool freeze_notification; | |
| 75 | - | bool transaction_report; | |
| 76 | 75 | }; | |
| 77 | 76 | ||
| 78 | 77 | static const struct constant_table binderfs_param_stats[] = { | |
| @@ -90,7 +89,6 @@ static struct binder_features binder_features = { | |||
| 90 | 89 | .oneway_spam_detection = true, | |
| 91 | 90 | .extended_error = true, | |
| 92 | 91 | .freeze_notification = true, | |
| 93 | - | .transaction_report = true, | |
| 94 | 92 | }; | |
| 95 | 93 | ||
| 96 | 94 | static inline struct binderfs_info *BINDERFS_SB(const struct super_block *sb) | |
| @@ -568,12 +566,6 @@ static int init_binder_features(struct super_block *sb) | |||
| 568 | 566 | if (IS_ERR(dentry)) | |
| 569 | 567 | return PTR_ERR(dentry); | |
| 570 | 568 | ||
| 571 | - | dentry = rust_binderfs_create_file(dir, "transaction_report", | |
| 572 | - | &binder_features_fops, | |
| 573 | - | &binder_features.transaction_report); | |
| 574 | - | if (IS_ERR(dentry)) | |
| 575 | - | return PTR_ERR(dentry); | |
| 576 | - | ||
| 577 | 569 | return 0; | |
| 578 | 570 | } | |
| 579 | 571 | ||
modified drivers/android/binder/thread.rs
| @@ -686,12 +686,6 @@ impl Thread { | |||
| 686 | 686 | self.inner.lock().push_return_work(reply); | |
| 687 | 687 | } | |
| 688 | 688 | ||
| 689 | - | pub(crate) fn pop_work_even_if_deferred(&self) -> Option<DLArc<dyn DeliverToRead>> { | |
| 690 | - | let mut thread_inner = self.inner.lock(); | |
| 691 | - | thread_inner.process_work_list = true; | |
| 692 | - | thread_inner.pop_work() | |
| 693 | - | } | |
| 694 | - | ||
| 695 | 689 | fn translate_object( | |
| 696 | 690 | &self, | |
| 697 | 691 | obj_index: usize, | |
| @@ -1684,7 +1678,7 @@ impl Thread { | |||
| 1684 | 1678 | self.unwind_transaction_stack(); | |
| 1685 | 1679 | ||
| 1686 | 1680 | // Cancel all pending work items. | |
| 1687 | - | while let Some(work) = self.pop_work_even_if_deferred() { | |
| 1681 | + | while let Ok(Some(work)) = self.get_work_local(false) { | |
| 1688 | 1682 | work.into_arc().cancel(); | |
| 1689 | 1683 | } | |
| 1690 | 1684 | } | |
modified drivers/android/binderfs.c
| @@ -189,11 +189,12 @@ static int binderfs_binder_device_create(struct inode *ref_inode, | |||
| 189 | 189 | goto err; | |
| 190 | 190 | } | |
| 191 | 191 | inode->i_private = device; | |
| 192 | - | binder_add_device(device); | |
| 193 | 192 | d_make_persistent(dentry, inode); | |
| 194 | 193 | fsnotify_create(root->d_inode, dentry); | |
| 195 | 194 | simple_done_creating(dentry); | |
| 196 | 195 | ||
| 196 | + | binder_add_device(device); | |
| 197 | + | ||
| 197 | 198 | return 0; | |
| 198 | 199 | ||
| 199 | 200 | err: | |
modified drivers/ata/ahci.c
| @@ -2614,51 +2614,6 @@ static irqreturn_t ahci_thunderx_irq_handler(int irq, void *dev_instance) | |||
| 2614 | 2614 | } | |
| 2615 | 2615 | #endif | |
| 2616 | 2616 | ||
| 2617 | - | /* | |
| 2618 | - | * The Marvell 88SE6111/6121/6145 ("Thor") family stops reporting interrupts | |
| 2619 | - | * for a port when HOST_IRQ_STAT is cleared while PxIS still holds bits: PxIS | |
| 2620 | - | * keeps its content, HOST_IRQ_STAT reads back as 0, the port is never looked | |
| 2621 | - | * at again and the command in flight only ends in a timeout. On a 88SE6121 | |
| 2622 | - | * this makes every SATA-2 or SATA-3 disk fail to IDENTIFY, while SATA-1 disks | |
| 2623 | - | * happen to win the race often enough to work. | |
| 2624 | - | * | |
| 2625 | - | * Clearing the host status before servicing the ports avoids it. Marvell's | |
| 2626 | - | * own driver for these chips does the same and says so ("clear global before | |
| 2627 | - | * channel"), and ahci_xgene handles its broken edge latch the same way. The | |
| 2628 | - | * price is at most one spurious interrupt per valid one, which is why this is | |
| 2629 | - | * not the generic behaviour - see AHCI 1.1 section 10.6.2. | |
| 2630 | - | * | |
| 2631 | - | * Link: https://bugzilla.kernel.org/show_bug.cgi?id=216094 | |
| 2632 | - | */ | |
| 2633 | - | static irqreturn_t ahci_mv_irq_handler(int irq, void *dev_instance) | |
| 2634 | - | { | |
| 2635 | - | struct ata_host *host = dev_instance; | |
| 2636 | - | struct ahci_host_priv *hpriv = host->private_data; | |
| 2637 | - | void __iomem *mmio = hpriv->mmio; | |
| 2638 | - | unsigned int rc; | |
| 2639 | - | u32 irq_stat, irq_masked; | |
| 2640 | - | ||
| 2641 | - | irq_stat = readl(mmio + HOST_IRQ_STAT); | |
| 2642 | - | if (!irq_stat) | |
| 2643 | - | return IRQ_NONE; | |
| 2644 | - | ||
| 2645 | - | irq_masked = irq_stat & hpriv->port_map; | |
| 2646 | - | ||
| 2647 | - | spin_lock(&host->lock); | |
| 2648 | - | ||
| 2649 | - | /* | |
| 2650 | - | * Use the unmasked value to clear the interrupt, as a spurious pending | |
| 2651 | - | * event on a dummy port might cause a screaming IRQ. | |
| 2652 | - | */ | |
| 2653 | - | writel(irq_stat, mmio + HOST_IRQ_STAT); | |
| 2654 | - | ||
| 2655 | - | rc = ahci_handle_port_intr(host, irq_masked); | |
| 2656 | - | ||
| 2657 | - | spin_unlock(&host->lock); | |
| 2658 | - | ||
| 2659 | - | return IRQ_RETVAL(rc); | |
| 2660 | - | } | |
| 2661 | - | ||
| 2662 | 2617 | static void ahci_remap_check(struct pci_dev *pdev, int bar, | |
| 2663 | 2618 | struct ahci_host_priv *hpriv) | |
| 2664 | 2619 | { | |
| @@ -2962,10 +2917,6 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 2962 | 2917 | return -ENOMEM; | |
| 2963 | 2918 | hpriv->flags |= (unsigned long)pi.private_data; | |
| 2964 | 2919 | ||
| 2965 | - | /* the Marvell "Thor" family needs HOST_IRQ_STAT cleared first */ | |
| 2966 | - | if (board_id == board_ahci_mv) | |
| 2967 | - | hpriv->irq_handler = ahci_mv_irq_handler; | |
| 2968 | - | ||
| 2969 | 2920 | /* MCP65 revision A1 and A2 can't do MSI */ | |
| 2970 | 2921 | if (board_id == board_ahci_mcp65 && | |
| 2971 | 2922 | (pdev->revision == 0xa1 || pdev->revision == 0xa2)) | |
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 | { | |
| @@ -3059,15 +3054,10 @@ static void atapi_qc_complete(struct ata_queued_cmd *qc) | |||
| 3059 | 3054 | if (qc->cdb[0] == ALLOW_MEDIUM_REMOVAL && qc->dev->sdev) | |
| 3060 | 3055 | qc->dev->sdev->locked = 0; | |
| 3061 | 3056 | ||
| 3062 | - | /* | |
| 3063 | - | * Report CHECK CONDITION unless the command was terminated | |
| 3064 | - | * with a host byte set. Only set the status byte, so that the | |
| 3065 | - | * SCSI midlayer internal byte, which scsi_check_sense() may | |
| 3066 | - | * have set from the sense data, is preserved. | |
| 3067 | - | */ | |
| 3068 | - | if (get_host_byte(cmd) == DID_OK) | |
| 3069 | - | set_status_byte(cmd, SAM_STAT_CHECK_CONDITION); | |
| 3070 | - | ata_scsi_qc_done(qc, false, 0); | |
| 3057 | + | if (cmd->result) | |
| 3058 | + | ata_scsi_qc_done(qc, false, 0); | |
| 3059 | + | else | |
| 3060 | + | ata_scsi_qc_done(qc, true, SAM_STAT_CHECK_CONDITION); | |
| 3071 | 3061 | goto schedule_deferred; | |
| 3072 | 3062 | } | |
| 3073 | 3063 | ||
| @@ -4833,6 +4823,28 @@ ata_scsi_get_phys_element_status_xlat(struct ata_queued_cmd *qc) | |||
| 4833 | 4823 | return 0; | |
| 4834 | 4824 | } | |
| 4835 | 4825 | ||
| 4826 | + | static void ata_scsi_depop_ua_cap_changed_complete(struct ata_queued_cmd *qc) | |
| 4827 | + | { | |
| 4828 | + | struct scsi_cmnd *scmd = qc->scsicmd; | |
| 4829 | + | u8 *cdb = scmd->cmnd; | |
| 4830 | + | bool is_ata_passthru = cdb[0] == ATA_16 || cdb[0] == ATA_12; | |
| 4831 | + | bool is_success = qc->err_mask == 0; | |
| 4832 | + | ||
| 4833 | + | /* | |
| 4834 | + | * For successful non-passthrough commands, raise a UNIT ATTENTION with | |
| 4835 | + | * the additional sense code set to CAPACITY DATA HAS CHANGED to be | |
| 4836 | + | * raised. Note that this should be done only if the capacity has | |
| 4837 | + | * actually changed, which may not be the case if the element that was | |
| 4838 | + | * specified for depopulation was already depopulated, or we did not | |
| 4839 | + | * restore any removed element. But a capacity change unit attention is | |
| 4840 | + | * harmless, so always raise the unit attention. | |
| 4841 | + | */ | |
| 4842 | + | if (is_success && !is_ata_passthru) | |
| 4843 | + | ata_scsi_set_sense(qc->dev, scmd, UNIT_ATTENTION, | |
| 4844 | + | UA_CHANGED_ASC, CAPACITY_CHANGED_ASCQ); | |
| 4845 | + | ata_scsi_qc_complete(qc); | |
| 4846 | + | } | |
| 4847 | + | ||
| 4836 | 4848 | static unsigned int | |
| 4837 | 4849 | ata_scsi_remove_element_and_truncate_xlat(struct ata_queued_cmd *qc) | |
| 4838 | 4850 | { | |
| @@ -4872,6 +4884,7 @@ ata_scsi_remove_element_and_truncate_xlat(struct ata_queued_cmd *qc) | |||
| 4872 | 4884 | tf->flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE | ATA_TFLAG_LBA48; | |
| 4873 | 4885 | ||
| 4874 | 4886 | qc->flags |= ATA_QCFLAG_RESULT_TF; | |
| 4887 | + | qc->complete_fn = ata_scsi_depop_ua_cap_changed_complete; | |
| 4875 | 4888 | ||
| 4876 | 4889 | return 0; | |
| 4877 | 4890 | } | |
| @@ -4924,6 +4937,7 @@ ata_scsi_restore_elements_and_rebuild_xlat(struct ata_queued_cmd *qc) | |||
| 4924 | 4937 | tf->flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE | ATA_TFLAG_LBA48; | |
| 4925 | 4938 | ||
| 4926 | 4939 | qc->flags |= ATA_QCFLAG_RESULT_TF; | |
| 4940 | + | qc->complete_fn = ata_scsi_depop_ua_cap_changed_complete; | |
| 4927 | 4941 | ||
| 4928 | 4942 | return 0; | |
| 4929 | 4943 | } | |
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/base/property.c
| @@ -526,7 +526,7 @@ int fwnode_property_match_string(const struct fwnode_handle *fwnode, | |||
| 526 | 526 | if (nval == 0) | |
| 527 | 527 | return -ENODATA; | |
| 528 | 528 | ||
| 529 | - | const char **values __free(kfree) = kzalloc_objs(*values, nval); | |
| 529 | + | const char **values __free(kfree) = kcalloc(nval, sizeof(*values), GFP_KERNEL); | |
| 530 | 530 | if (!values) | |
| 531 | 531 | return -ENOMEM; | |
| 532 | 532 | ||
modified drivers/base/test/Kconfig
| @@ -17,6 +17,7 @@ config DM_KUNIT_TEST | |||
| 17 | 17 | config DRIVER_PE_KUNIT_TEST | |
| 18 | 18 | tristate "KUnit Tests for property entry API" if !KUNIT_ALL_TESTS | |
| 19 | 19 | depends on KUNIT | |
| 20 | + | select OF | |
| 20 | 21 | default KUNIT_ALL_TESTS | |
| 21 | 22 | ||
| 22 | 23 | config DRIVER_SWNODE_KUNIT_TEST | |
modified drivers/base/test/property-entry-test.c
| @@ -523,9 +523,6 @@ static void pe_test_child_iteration(struct kunit *test) | |||
| 523 | 523 | struct fwnode_handle *child; | |
| 524 | 524 | int error, i, num; | |
| 525 | 525 | ||
| 526 | - | if (!IS_ENABLED(CONFIG_OF)) | |
| 527 | - | kunit_skip(test, "requires CONFIG_OF"); | |
| 528 | - | ||
| 529 | 526 | static const struct software_node node = { .name = "sw" }; | |
| 530 | 527 | static const struct software_node node1 = { .name = "sw-1", .parent = &node}; | |
| 531 | 528 | static const struct software_node node2 = { .name = "sw-2", .parent = &node}; | |
modified drivers/block/drbd/drbd_nl_gen.c
| @@ -638,6 +638,10 @@ const struct genl_split_ops drbd_nl_ops[32] = { | |||
| 638 | 638 | }, | |
| 639 | 639 | }; | |
| 640 | 640 | ||
| 641 | + | static const struct genl_multicast_group drbd_nl_mcgrps[] = { | |
| 642 | + | [DRBD_NLGRP_EVENTS] = { "events", }, | |
| 643 | + | }; | |
| 644 | + | ||
| 641 | 645 | static int __drbd_cfg_context_from_attrs(struct drbd_cfg_context *s, | |
| 642 | 646 | struct nlattr ***ret_nested_attribute_table, | |
| 643 | 647 | struct genl_info *info) | |
| @@ -652,7 +656,7 @@ static int __drbd_cfg_context_from_attrs(struct drbd_cfg_context *s, | |||
| 652 | 656 | *ret_nested_attribute_table = NULL; | |
| 653 | 657 | if (!tla) | |
| 654 | 658 | return -ENOMSG; | |
| 655 | - | ntb = kzalloc_objs(*ntb, DRBD_A_DRBD_CFG_CONTEXT_CTX_PEER_ADDR + 1); | |
| 659 | + | ntb = kcalloc(DRBD_A_DRBD_CFG_CONTEXT_CTX_PEER_ADDR + 1, sizeof(*ntb), GFP_KERNEL); | |
| 656 | 660 | if (!ntb) | |
| 657 | 661 | return -ENOMEM; | |
| 658 | 662 | err = nla_parse_nested_deprecated(ntb, maxtype, tla, drbd_drbd_cfg_context_nl_policy, NULL); | |
| @@ -710,7 +714,7 @@ static int __disk_conf_from_attrs(struct disk_conf *s, | |||
| 710 | 714 | *ret_nested_attribute_table = NULL; | |
| 711 | 715 | if (!tla) | |
| 712 | 716 | return -ENOMSG; | |
| 713 | - | ntb = kzalloc_objs(*ntb, DRBD_A_DISK_CONF_DISABLE_WRITE_SAME + 1); | |
| 717 | + | ntb = kcalloc(DRBD_A_DISK_CONF_DISABLE_WRITE_SAME + 1, sizeof(*ntb), GFP_KERNEL); | |
| 714 | 718 | if (!ntb) | |
| 715 | 719 | return -ENOMEM; | |
| 716 | 720 | err = nla_parse_nested_deprecated(ntb, maxtype, tla, drbd_disk_conf_nl_policy, NULL); | |
| @@ -867,7 +871,7 @@ static int __res_opts_from_attrs(struct res_opts *s, | |||
| 867 | 871 | *ret_nested_attribute_table = NULL; | |
| 868 | 872 | if (!tla) | |
| 869 | 873 | return -ENOMSG; | |
| 870 | - | ntb = kzalloc_objs(*ntb, DRBD_A_RES_OPTS_ON_NO_DATA + 1); | |
| 874 | + | ntb = kcalloc(DRBD_A_RES_OPTS_ON_NO_DATA + 1, sizeof(*ntb), GFP_KERNEL); | |
| 871 | 875 | if (!ntb) | |
| 872 | 876 | return -ENOMEM; | |
| 873 | 877 | err = nla_parse_nested_deprecated(ntb, maxtype, tla, drbd_res_opts_nl_policy, NULL); | |
| @@ -917,7 +921,7 @@ static int __net_conf_from_attrs(struct net_conf *s, | |||
| 917 | 921 | *ret_nested_attribute_table = NULL; | |
| 918 | 922 | if (!tla) | |
| 919 | 923 | return -ENOMSG; | |
| 920 | - | ntb = kzalloc_objs(*ntb, DRBD_A_NET_CONF_SOCK_CHECK_TIMEO + 1); | |
| 924 | + | ntb = kcalloc(DRBD_A_NET_CONF_SOCK_CHECK_TIMEO + 1, sizeof(*ntb), GFP_KERNEL); | |
| 921 | 925 | if (!ntb) | |
| 922 | 926 | return -ENOMEM; | |
| 923 | 927 | err = nla_parse_nested_deprecated(ntb, maxtype, tla, drbd_net_conf_nl_policy, NULL); | |
| @@ -1083,7 +1087,7 @@ static int __set_role_parms_from_attrs(struct set_role_parms *s, | |||
| 1083 | 1087 | *ret_nested_attribute_table = NULL; | |
| 1084 | 1088 | if (!tla) | |
| 1085 | 1089 | return -ENOMSG; | |
| 1086 | - | ntb = kzalloc_objs(*ntb, DRBD_A_SET_ROLE_PARMS_ASSUME_UPTODATE + 1); | |
| 1090 | + | ntb = kcalloc(DRBD_A_SET_ROLE_PARMS_ASSUME_UPTODATE + 1, sizeof(*ntb), GFP_KERNEL); | |
| 1087 | 1091 | if (!ntb) | |
| 1088 | 1092 | return -ENOMEM; | |
| 1089 | 1093 | err = nla_parse_nested_deprecated(ntb, maxtype, tla, drbd_set_role_parms_nl_policy, NULL); | |
| @@ -1129,7 +1133,7 @@ static int __resize_parms_from_attrs(struct resize_parms *s, | |||
| 1129 | 1133 | *ret_nested_attribute_table = NULL; | |
| 1130 | 1134 | if (!tla) | |
| 1131 | 1135 | return -ENOMSG; | |
| 1132 | - | ntb = kzalloc_objs(*ntb, DRBD_A_RESIZE_PARMS_AL_STRIPE_SIZE + 1); | |
| 1136 | + | ntb = kcalloc(DRBD_A_RESIZE_PARMS_AL_STRIPE_SIZE + 1, sizeof(*ntb), GFP_KERNEL); | |
| 1133 | 1137 | if (!ntb) | |
| 1134 | 1138 | return -ENOMEM; | |
| 1135 | 1139 | err = nla_parse_nested_deprecated(ntb, maxtype, tla, drbd_resize_parms_nl_policy, NULL); | |
| @@ -1191,7 +1195,7 @@ static int __start_ov_parms_from_attrs(struct start_ov_parms *s, | |||
| 1191 | 1195 | *ret_nested_attribute_table = NULL; | |
| 1192 | 1196 | if (!tla) | |
| 1193 | 1197 | return -ENOMSG; | |
| 1194 | - | ntb = kzalloc_objs(*ntb, DRBD_A_START_OV_PARMS_OV_STOP_SECTOR + 1); | |
| 1198 | + | ntb = kcalloc(DRBD_A_START_OV_PARMS_OV_STOP_SECTOR + 1, sizeof(*ntb), GFP_KERNEL); | |
| 1195 | 1199 | if (!ntb) | |
| 1196 | 1200 | return -ENOMEM; | |
| 1197 | 1201 | err = nla_parse_nested_deprecated(ntb, maxtype, tla, drbd_start_ov_parms_nl_policy, NULL); | |
| @@ -1241,7 +1245,7 @@ static int __new_c_uuid_parms_from_attrs(struct new_c_uuid_parms *s, | |||
| 1241 | 1245 | *ret_nested_attribute_table = NULL; | |
| 1242 | 1246 | if (!tla) | |
| 1243 | 1247 | return -ENOMSG; | |
| 1244 | - | ntb = kzalloc_objs(*ntb, DRBD_A_NEW_C_UUID_PARMS_CLEAR_BM + 1); | |
| 1248 | + | ntb = kcalloc(DRBD_A_NEW_C_UUID_PARMS_CLEAR_BM + 1, sizeof(*ntb), GFP_KERNEL); | |
| 1245 | 1249 | if (!ntb) | |
| 1246 | 1250 | return -ENOMEM; | |
| 1247 | 1251 | err = nla_parse_nested_deprecated(ntb, maxtype, tla, drbd_new_c_uuid_parms_nl_policy, NULL); | |
| @@ -1287,7 +1291,7 @@ static int __disconnect_parms_from_attrs(struct disconnect_parms *s, | |||
| 1287 | 1291 | *ret_nested_attribute_table = NULL; | |
| 1288 | 1292 | if (!tla) | |
| 1289 | 1293 | return -ENOMSG; | |
| 1290 | - | ntb = kzalloc_objs(*ntb, DRBD_A_DISCONNECT_PARMS_FORCE_DISCONNECT + 1); | |
| 1294 | + | ntb = kcalloc(DRBD_A_DISCONNECT_PARMS_FORCE_DISCONNECT + 1, sizeof(*ntb), GFP_KERNEL); | |
| 1291 | 1295 | if (!ntb) | |
| 1292 | 1296 | return -ENOMEM; | |
| 1293 | 1297 | err = nla_parse_nested_deprecated(ntb, maxtype, tla, drbd_disconnect_parms_nl_policy, NULL); | |
| @@ -1333,7 +1337,7 @@ static int __detach_parms_from_attrs(struct detach_parms *s, | |||
| 1333 | 1337 | *ret_nested_attribute_table = NULL; | |
| 1334 | 1338 | if (!tla) | |
| 1335 | 1339 | return -ENOMSG; | |
| 1336 | - | ntb = kzalloc_objs(*ntb, DRBD_A_DETACH_PARMS_FORCE_DETACH + 1); | |
| 1340 | + | ntb = kcalloc(DRBD_A_DETACH_PARMS_FORCE_DETACH + 1, sizeof(*ntb), GFP_KERNEL); | |
| 1337 | 1341 | if (!ntb) | |
| 1338 | 1342 | return -ENOMEM; | |
| 1339 | 1343 | err = nla_parse_nested_deprecated(ntb, maxtype, tla, drbd_detach_parms_nl_policy, NULL); | |
| @@ -1379,7 +1383,7 @@ static int __resource_info_from_attrs(struct resource_info *s, | |||
| 1379 | 1383 | *ret_nested_attribute_table = NULL; | |
| 1380 | 1384 | if (!tla) | |
| 1381 | 1385 | return -ENOMSG; | |
| 1382 | - | ntb = kzalloc_objs(*ntb, DRBD_A_RESOURCE_INFO_RES_SUSP_FEN + 1); | |
| 1386 | + | ntb = kcalloc(DRBD_A_RESOURCE_INFO_RES_SUSP_FEN + 1, sizeof(*ntb), GFP_KERNEL); | |
| 1383 | 1387 | if (!ntb) | |
| 1384 | 1388 | return -ENOMEM; | |
| 1385 | 1389 | err = nla_parse_nested_deprecated(ntb, maxtype, tla, drbd_resource_info_nl_policy, NULL); | |
| @@ -1437,7 +1441,7 @@ static int __device_info_from_attrs(struct device_info *s, | |||
| 1437 | 1441 | *ret_nested_attribute_table = NULL; | |
| 1438 | 1442 | if (!tla) | |
| 1439 | 1443 | return -ENOMSG; | |
| 1440 | - | ntb = kzalloc_objs(*ntb, DRBD_A_DEVICE_INFO_DEV_DISK_STATE + 1); | |
| 1444 | + | ntb = kcalloc(DRBD_A_DEVICE_INFO_DEV_DISK_STATE + 1, sizeof(*ntb), GFP_KERNEL); | |
| 1441 | 1445 | if (!ntb) | |
| 1442 | 1446 | return -ENOMEM; | |
| 1443 | 1447 | err = nla_parse_nested_deprecated(ntb, maxtype, tla, drbd_device_info_nl_policy, NULL); | |
| @@ -1483,7 +1487,7 @@ static int __connection_info_from_attrs(struct connection_info *s, | |||
| 1483 | 1487 | *ret_nested_attribute_table = NULL; | |
| 1484 | 1488 | if (!tla) | |
| 1485 | 1489 | return -ENOMSG; | |
| 1486 | - | ntb = kzalloc_objs(*ntb, DRBD_A_CONNECTION_INFO_CONN_ROLE + 1); | |
| 1490 | + | ntb = kcalloc(DRBD_A_CONNECTION_INFO_CONN_ROLE + 1, sizeof(*ntb), GFP_KERNEL); | |
| 1487 | 1491 | if (!ntb) | |
| 1488 | 1492 | return -ENOMEM; | |
| 1489 | 1493 | err = nla_parse_nested_deprecated(ntb, maxtype, tla, drbd_connection_info_nl_policy, NULL); | |
| @@ -1533,8 +1537,7 @@ static int __peer_device_info_from_attrs(struct peer_device_info *s, | |||
| 1533 | 1537 | *ret_nested_attribute_table = NULL; | |
| 1534 | 1538 | if (!tla) | |
| 1535 | 1539 | return -ENOMSG; | |
| 1536 | - | ntb = kzalloc_objs(*ntb, | |
| 1537 | - | DRBD_A_PEER_DEVICE_INFO_PEER_RESYNC_SUSP_DEPENDENCY + 1); | |
| 1540 | + | ntb = kcalloc(DRBD_A_PEER_DEVICE_INFO_PEER_RESYNC_SUSP_DEPENDENCY + 1, sizeof(*ntb), GFP_KERNEL); | |
| 1538 | 1541 | if (!ntb) | |
| 1539 | 1542 | return -ENOMEM; | |
| 1540 | 1543 | err = nla_parse_nested_deprecated(ntb, maxtype, tla, drbd_peer_device_info_nl_policy, NULL); | |
| @@ -1596,8 +1599,7 @@ static int __resource_statistics_from_attrs(struct resource_statistics *s, | |||
| 1596 | 1599 | *ret_nested_attribute_table = NULL; | |
| 1597 | 1600 | if (!tla) | |
| 1598 | 1601 | return -ENOMSG; | |
| 1599 | - | ntb = kzalloc_objs(*ntb, | |
| 1600 | - | DRBD_A_RESOURCE_STATISTICS_RES_STAT_WRITE_ORDERING + 1); | |
| 1602 | + | ntb = kcalloc(DRBD_A_RESOURCE_STATISTICS_RES_STAT_WRITE_ORDERING + 1, sizeof(*ntb), GFP_KERNEL); | |
| 1601 | 1603 | if (!ntb) | |
| 1602 | 1604 | return -ENOMEM; | |
| 1603 | 1605 | err = nla_parse_nested_deprecated(ntb, maxtype, tla, drbd_resource_statistics_nl_policy, NULL); | |
| @@ -1643,7 +1645,7 @@ static int __device_statistics_from_attrs(struct device_statistics *s, | |||
| 1643 | 1645 | *ret_nested_attribute_table = NULL; | |
| 1644 | 1646 | if (!tla) | |
| 1645 | 1647 | return -ENOMSG; | |
| 1646 | - | ntb = kzalloc_objs(*ntb, DRBD_A_DEVICE_STATISTICS_HISTORY_UUIDS + 1); | |
| 1648 | + | ntb = kcalloc(DRBD_A_DEVICE_STATISTICS_HISTORY_UUIDS + 1, sizeof(*ntb), GFP_KERNEL); | |
| 1647 | 1649 | if (!ntb) | |
| 1648 | 1650 | return -ENOMEM; | |
| 1649 | 1651 | err = nla_parse_nested_deprecated(ntb, maxtype, tla, drbd_device_statistics_nl_policy, NULL); | |
| @@ -1741,8 +1743,7 @@ static int __connection_statistics_from_attrs(struct connection_statistics *s, | |||
| 1741 | 1743 | *ret_nested_attribute_table = NULL; | |
| 1742 | 1744 | if (!tla) | |
| 1743 | 1745 | return -ENOMSG; | |
| 1744 | - | ntb = kzalloc_objs(*ntb, | |
| 1745 | - | DRBD_A_CONNECTION_STATISTICS_CONN_CONGESTED + 1); | |
| 1746 | + | ntb = kcalloc(DRBD_A_CONNECTION_STATISTICS_CONN_CONGESTED + 1, sizeof(*ntb), GFP_KERNEL); | |
| 1746 | 1747 | if (!ntb) | |
| 1747 | 1748 | return -ENOMEM; | |
| 1748 | 1749 | err = nla_parse_nested_deprecated(ntb, maxtype, tla, drbd_connection_statistics_nl_policy, NULL); | |
| @@ -1788,8 +1789,7 @@ static int __peer_device_statistics_from_attrs(struct peer_device_statistics *s, | |||
| 1788 | 1789 | *ret_nested_attribute_table = NULL; | |
| 1789 | 1790 | if (!tla) | |
| 1790 | 1791 | return -ENOMSG; | |
| 1791 | - | ntb = kzalloc_objs(*ntb, | |
| 1792 | - | DRBD_A_PEER_DEVICE_STATISTICS_PEER_DEV_FLAGS + 1); | |
| 1792 | + | ntb = kcalloc(DRBD_A_PEER_DEVICE_STATISTICS_PEER_DEV_FLAGS + 1, sizeof(*ntb), GFP_KERNEL); | |
| 1793 | 1793 | if (!ntb) | |
| 1794 | 1794 | return -ENOMEM; | |
| 1795 | 1795 | err = nla_parse_nested_deprecated(ntb, maxtype, tla, drbd_peer_device_statistics_nl_policy, NULL); | |
modified drivers/block/loop.c
| @@ -458,14 +458,12 @@ static void loop_update_dio_alignment(struct loop_device *lo) | |||
| 458 | 458 | * Use the dio alignment of the file system if provided. The incomoing | |
| 459 | 459 | * request's bio_vec is forwarded to the backing file unchanged, so its | |
| 460 | 460 | * required memory alignment becomes the device's dma_alignment when | |
| 461 | - | * used for direct-io. The file system reports zeroed alignments if the | |
| 462 | - | * file can't be used for direct-io at all, so fall back to the block | |
| 463 | - | * device limits in that case. | |
| 461 | + | * used for direct-io. | |
| 464 | 462 | */ | |
| 465 | 463 | if (!vfs_getattr(&file->f_path, &st, STATX_DIOALIGN, 0) && | |
| 466 | - | (st.result_mask & STATX_DIOALIGN) && st.dio_mem_align) { | |
| 464 | + | (st.result_mask & STATX_DIOALIGN)) { | |
| 467 | 465 | lo->lo_min_dio_size = st.dio_offset_align; | |
| 468 | - | lo->lo_dio_mem_align = min(st.dio_mem_align - 1, PAGE_SIZE - 1); | |
| 466 | + | lo->lo_dio_mem_align = st.dio_mem_align - 1; | |
| 469 | 467 | return; | |
| 470 | 468 | } | |
| 471 | 469 | ||
modified drivers/block/sunvdc.c
| @@ -525,23 +525,6 @@ static int __send_request(struct request *req) | |||
| 525 | 525 | err = __vdc_tx_trigger(port); | |
| 526 | 526 | if (err < 0) { | |
| 527 | 527 | printk(KERN_ERR PFX "vdc_tx_trigger() failure, err=%d\n", err); | |
| 528 | - | /* | |
| 529 | - | * If the port was reset (-ENOTCONN), the dring and the | |
| 530 | - | * LDC channel including all of its mappings are already | |
| 531 | - | * torn down and reallocated - there is nothing to undo | |
| 532 | - | * and @desc must not be touched. | |
| 533 | - | * | |
| 534 | - | * For any other failure the descriptor was never handed | |
| 535 | - | * to the peer: unmap the cookies and free the descriptor | |
| 536 | - | * again, so that a later retry of the request does not | |
| 537 | - | * leak LDC map table entries. | |
| 538 | - | */ | |
| 539 | - | if (err != -ENOTCONN) { | |
| 540 | - | ldc_unmap(port->vio.lp, desc->cookies, | |
| 541 | - | desc->ncookies); | |
| 542 | - | desc->hdr.state = VIO_DESC_FREE; | |
| 543 | - | rqe->req = NULL; | |
| 544 | - | } | |
| 545 | 528 | } else { | |
| 546 | 529 | port->req_id++; | |
| 547 | 530 | dr->prod = vio_dring_next(dr, dr->prod); | |
| @@ -556,7 +539,6 @@ static blk_status_t vdc_queue_rq(struct blk_mq_hw_ctx *hctx, | |||
| 556 | 539 | struct vdc_port *port = hctx->queue->queuedata; | |
| 557 | 540 | struct vio_dring_state *dr; | |
| 558 | 541 | unsigned long flags; | |
| 559 | - | int ret; | |
| 560 | 542 | ||
| 561 | 543 | dr = &port->vio.drings[VIO_DRIVER_TX_RING]; | |
| 562 | 544 | ||
| @@ -578,13 +560,7 @@ static blk_status_t vdc_queue_rq(struct blk_mq_hw_ctx *hctx, | |||
| 578 | 560 | return BLK_STS_DEV_RESOURCE; | |
| 579 | 561 | } | |
| 580 | 562 | ||
| 581 | - | ret = __send_request(bd->rq); | |
| 582 | - | if (ret == -EAGAIN) { | |
| 583 | - | spin_unlock_irqrestore(&port->vio.lock, flags); | |
| 584 | - | /* already spun for 10msec, defer 10msec and retry */ | |
| 585 | - | blk_mq_delay_kick_requeue_list(hctx->queue, 10); | |
| 586 | - | return BLK_STS_DEV_RESOURCE; | |
| 587 | - | } else if (ret < 0) { | |
| 563 | + | if (__send_request(bd->rq) < 0) { | |
| 588 | 564 | spin_unlock_irqrestore(&port->vio.lock, flags); | |
| 589 | 565 | return BLK_STS_IOERR; | |
| 590 | 566 | } | |
modified drivers/block/ublk_drv.c
| @@ -2653,12 +2653,6 @@ static int ublk_ch_mmap(struct file *filp, struct vm_area_struct *vma) | |||
| 2653 | 2653 | if (vma->vm_flags & VM_WRITE) | |
| 2654 | 2654 | return -EPERM; | |
| 2655 | 2655 | ||
| 2656 | - | /* | |
| 2657 | - | * The per-queue command buffer is kernel-written ABI; prevent | |
| 2658 | - | * the daemon from upgrading to writable via mprotect(). | |
| 2659 | - | */ | |
| 2660 | - | vm_flags_clear(vma, VM_MAYWRITE); | |
| 2661 | - | ||
| 2662 | 2656 | end = UBLKSRV_CMD_BUF_OFFSET + ub->dev_info.nr_hw_queues * max_sz; | |
| 2663 | 2657 | if (phys_off < UBLKSRV_CMD_BUF_OFFSET || phys_off >= end) | |
| 2664 | 2658 | return -EINVAL; | |
| @@ -3030,7 +3024,6 @@ static void ublk_queue_reset_io_flags(struct ublk_queue *ubq) | |||
| 3030 | 3024 | ubq->canceling = false; | |
| 3031 | 3025 | spin_unlock(&ubq->cancel_lock); | |
| 3032 | 3026 | ubq->fail_io = false; | |
| 3033 | - | ubq->force_abort = false; | |
| 3034 | 3027 | } | |
| 3035 | 3028 | ||
| 3036 | 3029 | /* device can only be started after all IOs are ready */ | |
| @@ -5397,7 +5390,7 @@ static int __ublk_ctrl_reg_buf(struct ublk_device *ub, | |||
| 5397 | 5390 | page_to_pfn(pages[i + 1]) == pfn + (i - start) + 1) | |
| 5398 | 5391 | i++; | |
| 5399 | 5392 | ||
| 5400 | - | range = kzalloc_obj(*range); | |
| 5393 | + | range = kzalloc(sizeof(*range), GFP_KERNEL); | |
| 5401 | 5394 | if (!range) { | |
| 5402 | 5395 | ret = -ENOMEM; | |
| 5403 | 5396 | goto unwind; | |
| @@ -5460,7 +5453,7 @@ static int ublk_ctrl_reg_buf(struct ublk_device *ub, | |||
| 5460 | 5453 | nr_pages = buf_reg.len >> PAGE_SHIFT; | |
| 5461 | 5454 | ||
| 5462 | 5455 | /* Pin pages before any locks (may sleep) */ | |
| 5463 | - | pages = kvmalloc_objs(*pages, nr_pages); | |
| 5456 | + | pages = kvmalloc_array(nr_pages, sizeof(*pages), GFP_KERNEL); | |
| 5464 | 5457 | if (!pages) | |
| 5465 | 5458 | return -ENOMEM; | |
| 5466 | 5459 | ||
modified drivers/block/virtio_blk.c
| @@ -743,7 +743,6 @@ static int virtblk_read_zoned_limits(struct virtio_blk *vblk, | |||
| 743 | 743 | dev_warn(&vdev->dev, "zero write granularity reported\n"); | |
| 744 | 744 | return -ENODEV; | |
| 745 | 745 | } | |
| 746 | - | lim->zone_write_granularity = wg; | |
| 747 | 746 | lim->physical_block_size = wg; | |
| 748 | 747 | lim->io_min = wg; | |
| 749 | 748 | ||
modified drivers/block/zloop.c
| @@ -800,27 +800,6 @@ static void zloop_cmd_workfn(struct work_struct *work) | |||
| 800 | 800 | current->flags = orig_flags; | |
| 801 | 801 | } | |
| 802 | 802 | ||
| 803 | - | static void zloop_fill_zero_rq(struct request *rq, unsigned int zero_from) | |
| 804 | - | { | |
| 805 | - | struct req_iterator iter; | |
| 806 | - | struct bio_vec bv; | |
| 807 | - | unsigned int pos = 0; | |
| 808 | - | unsigned int end, off; | |
| 809 | - | ||
| 810 | - | rq_for_each_segment(bv, rq, iter) { | |
| 811 | - | end = pos + bv.bv_len; | |
| 812 | - | if (end > zero_from) { | |
| 813 | - | if (pos < zero_from) | |
| 814 | - | off = zero_from - pos; | |
| 815 | - | else | |
| 816 | - | off = 0; | |
| 817 | - | memzero_page(bv.bv_page, bv.bv_offset + off, | |
| 818 | - | bv.bv_len - off); | |
| 819 | - | } | |
| 820 | - | pos = end; | |
| 821 | - | } | |
| 822 | - | } | |
| 823 | - | ||
| 824 | 803 | static void zloop_complete_rq(struct request *rq) | |
| 825 | 804 | { | |
| 826 | 805 | struct zloop_cmd *cmd = blk_mq_rq_to_pdu(rq); | |
| @@ -835,9 +814,13 @@ static void zloop_complete_rq(struct request *rq) | |||
| 835 | 814 | pr_err("Zone %u: failed read sector %llu, %llu sectors\n", | |
| 836 | 815 | zone_no, cmd->sector, cmd->nr_sectors); | |
| 837 | 816 | ||
| 838 | - | /* Short read. Zero out the unread tail beyond cmd->ret. */ | |
| 839 | - | if (cmd->ret >= 0 && cmd->ret != blk_rq_bytes(rq)) | |
| 840 | - | zloop_fill_zero_rq(rq, cmd->ret); | |
| 817 | + | if (cmd->ret >= 0 && cmd->ret != blk_rq_bytes(rq)) { | |
| 818 | + | /* short read */ | |
| 819 | + | struct bio *bio; | |
| 820 | + | ||
| 821 | + | __rq_for_each_bio(bio, rq) | |
| 822 | + | zero_fill_bio(bio); | |
| 823 | + | } | |
| 841 | 824 | break; | |
| 842 | 825 | case REQ_OP_WRITE: | |
| 843 | 826 | case REQ_OP_ZONE_APPEND: | |
| @@ -1059,14 +1042,12 @@ static int zloop_get_block_size(struct zloop_device *zlo, | |||
| 1059 | 1042 | * Use the dio alignment of the file system if provided. The incoming | |
| 1060 | 1043 | * request's bio_vec is forwarded to the backing file unchanged, so its | |
| 1061 | 1044 | * required memory alignment becomes the device's dma_alignment when | |
| 1062 | - | * used for direct-io. The file system reports zeroed alignments if the | |
| 1063 | - | * file can't be used for direct-io at all, so fall back to the block | |
| 1064 | - | * device limits in that case. | |
| 1045 | + | * used for direct-io. | |
| 1065 | 1046 | */ | |
| 1066 | 1047 | if (!vfs_getattr(&zone->file->f_path, &st, STATX_DIOALIGN, 0) && | |
| 1067 | - | (st.result_mask & STATX_DIOALIGN) && st.dio_mem_align) { | |
| 1048 | + | (st.result_mask & STATX_DIOALIGN)) { | |
| 1068 | 1049 | zlo->block_size = st.dio_offset_align; | |
| 1069 | - | zlo->dio_mem_align = min(st.dio_mem_align - 1, PAGE_SIZE - 1); | |
| 1050 | + | zlo->dio_mem_align = st.dio_mem_align - 1; | |
| 1070 | 1051 | } else if (sb_bdev) { | |
| 1071 | 1052 | zlo->block_size = bdev_physical_block_size(sb_bdev); | |
| 1072 | 1053 | zlo->dio_mem_align = bdev_dma_alignment(sb_bdev); | |
modified drivers/block/zram/backend_lz4.c
| @@ -42,7 +42,7 @@ static int lz4_setup_params(struct zcomp_params *params) | |||
| 42 | 42 | if (!params->dict || !params->dict_sz) | |
| 43 | 43 | return 0; | |
| 44 | 44 | ||
| 45 | - | dict_stream = kzalloc_obj(*dict_stream); | |
| 45 | + | dict_stream = kzalloc_obj(*dict_stream, GFP_KERNEL); | |
| 46 | 46 | if (!dict_stream) | |
| 47 | 47 | return -ENOMEM; | |
| 48 | 48 | ||
modified drivers/bluetooth/btintel.c
| @@ -289,8 +289,7 @@ void btintel_hw_error(struct hci_dev *hdev, u8 code) | |||
| 289 | 289 | goto unlock; | |
| 290 | 290 | } | |
| 291 | 291 | ||
| 292 | - | bt_dev_err(hdev, "Exception info %.*s", (int)(skb->len - 1), | |
| 293 | - | (char *)(skb->data + 1)); | |
| 292 | + | bt_dev_err(hdev, "Exception info %s", (char *)(skb->data + 1)); | |
| 294 | 293 | ||
| 295 | 294 | kfree_skb(skb); | |
| 296 | 295 | ||
| @@ -409,16 +408,8 @@ int btintel_load_ddc_config(struct hci_dev *hdev, const char *ddc_name) | |||
| 409 | 408 | /* DDC file contains one or more DDC structure which has | |
| 410 | 409 | * Length (1 byte), DDC ID (2 bytes), and DDC value (Length - 2). | |
| 411 | 410 | */ | |
| 412 | - | while (fw->size > (size_t)(fw_ptr - fw->data)) { | |
| 413 | - | size_t remaining = fw->size - (fw_ptr - fw->data); | |
| 414 | - | unsigned int cmd_plen = fw_ptr[0] + 1U; | |
| 415 | - | ||
| 416 | - | if (cmd_plen < 3 || cmd_plen > U8_MAX || cmd_plen > remaining) { | |
| 417 | - | bt_dev_err(hdev, "Malformed DDC record (plen=%u, remaining=%zu)", | |
| 418 | - | cmd_plen, remaining); | |
| 419 | - | release_firmware(fw); | |
| 420 | - | return -EINVAL; | |
| 421 | - | } | |
| 411 | + | while (fw->size > fw_ptr - fw->data) { | |
| 412 | + | u8 cmd_plen = fw_ptr[0] + sizeof(u8); | |
| 422 | 413 | ||
| 423 | 414 | skb = __hci_cmd_sync(hdev, 0xfc8b, cmd_plen, fw_ptr, | |
| 424 | 415 | HCI_INIT_TIMEOUT); | |
| @@ -580,44 +571,12 @@ int btintel_version_info_tlv(struct hci_dev *hdev, | |||
| 580 | 571 | } | |
| 581 | 572 | EXPORT_SYMBOL_GPL(btintel_version_info_tlv); | |
| 582 | 573 | ||
| 583 | - | static u8 btintel_version_tlv_min_len(u8 type) | |
| 584 | - | { | |
| 585 | - | switch (type) { | |
| 586 | - | case INTEL_TLV_CNVI_TOP: | |
| 587 | - | case INTEL_TLV_CNVR_TOP: | |
| 588 | - | case INTEL_TLV_CNVI_BT: | |
| 589 | - | case INTEL_TLV_CNVR_BT: | |
| 590 | - | case INTEL_TLV_BUILD_NUM: | |
| 591 | - | case INTEL_TLV_GIT_SHA1: | |
| 592 | - | return sizeof(u32); | |
| 593 | - | case INTEL_TLV_DEV_REV_ID: | |
| 594 | - | case INTEL_TLV_TIME_STAMP: | |
| 595 | - | return sizeof(u16); | |
| 596 | - | case INTEL_TLV_IMAGE_TYPE: | |
| 597 | - | case INTEL_TLV_BUILD_TYPE: | |
| 598 | - | case INTEL_TLV_SECURE_BOOT: | |
| 599 | - | case INTEL_TLV_OTP_LOCK: | |
| 600 | - | case INTEL_TLV_API_LOCK: | |
| 601 | - | case INTEL_TLV_DEBUG_LOCK: | |
| 602 | - | case INTEL_TLV_LIMITED_CCE: | |
| 603 | - | case INTEL_TLV_SBE_TYPE: | |
| 604 | - | return sizeof(u8); | |
| 605 | - | case INTEL_TLV_MIN_FW: | |
| 606 | - | return 3; | |
| 607 | - | case INTEL_TLV_OTP_BDADDR: | |
| 608 | - | return sizeof(bdaddr_t); | |
| 609 | - | default: | |
| 610 | - | return 0; | |
| 611 | - | } | |
| 612 | - | } | |
| 613 | - | ||
| 614 | 574 | int btintel_parse_version_tlv(struct hci_dev *hdev, | |
| 615 | 575 | struct intel_version_tlv *version, | |
| 616 | 576 | struct sk_buff *skb) | |
| 617 | 577 | { | |
| 618 | 578 | /* Consume Command Complete Status field */ | |
| 619 | - | if (!skb_pull(skb, 1)) | |
| 620 | - | return -EINVAL; | |
| 579 | + | skb_pull(skb, 1); | |
| 621 | 580 | ||
| 622 | 581 | /* Event parameters contain multiple TLVs. Read each of them | |
| 623 | 582 | * and only keep the required data. Also, it use existing legacy | |
| @@ -637,9 +596,6 @@ int btintel_parse_version_tlv(struct hci_dev *hdev, | |||
| 637 | 596 | if (skb->len < tlv->len + sizeof(*tlv)) | |
| 638 | 597 | return -EINVAL; | |
| 639 | 598 | ||
| 640 | - | if (tlv->len < btintel_version_tlv_min_len(tlv->type)) | |
| 641 | - | return -EINVAL; | |
| 642 | - | ||
| 643 | 599 | switch (tlv->type) { | |
| 644 | 600 | case INTEL_TLV_CNVI_TOP: | |
| 645 | 601 | version->cnvi_top = get_unaligned_le32(tlv->val); | |
| @@ -711,7 +667,7 @@ int btintel_parse_version_tlv(struct hci_dev *hdev, | |||
| 711 | 667 | break; | |
| 712 | 668 | case INTEL_TLV_FW_ID: | |
| 713 | 669 | snprintf(version->fw_id, sizeof(version->fw_id), | |
| 714 | - | "%.*s", tlv->len, tlv->val); | |
| 670 | + | "%s", tlv->val); | |
| 715 | 671 | break; | |
| 716 | 672 | default: | |
| 717 | 673 | /* Ignore rest of information */ | |
| @@ -730,7 +686,6 @@ static int btintel_read_version_tlv(struct hci_dev *hdev, | |||
| 730 | 686 | { | |
| 731 | 687 | struct sk_buff *skb; | |
| 732 | 688 | const u8 param[1] = { 0xFF }; | |
| 733 | - | int err; | |
| 734 | 689 | ||
| 735 | 690 | if (!version) | |
| 736 | 691 | return -EINVAL; | |
| @@ -749,10 +704,10 @@ static int btintel_read_version_tlv(struct hci_dev *hdev, | |||
| 749 | 704 | return -EIO; | |
| 750 | 705 | } | |
| 751 | 706 | ||
| 752 | - | err = btintel_parse_version_tlv(hdev, version, skb); | |
| 707 | + | btintel_parse_version_tlv(hdev, version, skb); | |
| 753 | 708 | ||
| 754 | 709 | kfree_skb(skb); | |
| 755 | - | return err; | |
| 710 | + | return 0; | |
| 756 | 711 | } | |
| 757 | 712 | ||
| 758 | 713 | /* ------- REGMAP IBT SUPPORT ------- */ | |
modified drivers/bluetooth/btintel_pcie.c
| @@ -401,15 +401,9 @@ static int btintel_pcie_send_sync(struct btintel_pcie_data *data, | |||
| 401 | 401 | ||
| 402 | 402 | tfd_index = data->ia.tr_hia[BTINTEL_PCIE_TXQ_NUM]; | |
| 403 | 403 | ||
| 404 | - | if (tfd_index >= txq->count) | |
| 404 | + | if (tfd_index > txq->count) | |
| 405 | 405 | return -ERANGE; | |
| 406 | 406 | ||
| 407 | - | 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,18 +1093,13 @@ 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); | |
| 1110 | 1099 | ||
| 1111 | 1100 | urbd0 = &txq->urbd0s[cr_tia]; | |
| 1112 | 1101 | ||
| 1113 | - | if (urbd0->tfd_index >= txq->count) | |
| 1102 | + | if (urbd0->tfd_index > txq->count) | |
| 1114 | 1103 | return; | |
| 1115 | 1104 | ||
| 1116 | 1105 | cr_tia = (cr_tia + 1) % txq->count; | |
| @@ -1197,7 +1186,7 @@ static int btintel_pcie_recv_frame(struct btintel_pcie_data *data, | |||
| 1197 | 1186 | { | |
| 1198 | 1187 | int ret; | |
| 1199 | 1188 | u8 pkt_type; | |
| 1200 | - | u32 plen; | |
| 1189 | + | u16 plen; | |
| 1201 | 1190 | u32 pcie_pkt_type; | |
| 1202 | 1191 | void *pdata; | |
| 1203 | 1192 | struct hci_dev *hdev = data->hdev; | |
| @@ -1610,9 +1599,7 @@ static int btintel_pcie_submit_rx_work(struct btintel_pcie_data *data, u8 status | |||
| 1610 | 1599 | rfh_hdr = buf; | |
| 1611 | 1600 | ||
| 1612 | 1601 | len = rfh_hdr->packet_len; | |
| 1613 | - | if (len == 0 || len > BTINTEL_PCIE_BUFFER_SIZE - sizeof(*rfh_hdr)) { | |
| 1614 | - | bt_dev_err(data->hdev, "Invalid packet_len %d (max %zu)", len, | |
| 1615 | - | BTINTEL_PCIE_BUFFER_SIZE - sizeof(*rfh_hdr)); | |
| 1602 | + | if (len <= 0) { | |
| 1616 | 1603 | ret = -EINVAL; | |
| 1617 | 1604 | goto resubmit; | |
| 1618 | 1605 | } | |
| @@ -1655,11 +1642,6 @@ static void btintel_pcie_msix_rx_handle(struct btintel_pcie_data *data) | |||
| 1655 | 1642 | ||
| 1656 | 1643 | rxq = &data->rxq; | |
| 1657 | 1644 | ||
| 1658 | - | if (cr_hia >= rxq->count) { | |
| 1659 | - | bt_dev_err(hdev, "RXQ: invalid cr_hia %u", cr_hia); | |
| 1660 | - | return; | |
| 1661 | - | } | |
| 1662 | - | ||
| 1663 | 1645 | /* The firmware sends multiple CD in a single MSI-X and it needs to | |
| 1664 | 1646 | * process all received CDs in this interrupt. | |
| 1665 | 1647 | */ | |
| @@ -1667,12 +1649,6 @@ static void btintel_pcie_msix_rx_handle(struct btintel_pcie_data *data) | |||
| 1667 | 1649 | urbd1 = &rxq->urbd1s[cr_tia]; | |
| 1668 | 1650 | ipc_print_urbd1(data->hdev, urbd1, cr_tia); | |
| 1669 | 1651 | ||
| 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 | 1652 | buf = &rxq->bufs[urbd1->frbd_tag]; | |
| 1677 | 1653 | if (!buf) { | |
| 1678 | 1654 | bt_dev_err(hdev, "RXQ: failed to get the DMA buffer for %d", | |
| @@ -1720,9 +1696,6 @@ static irqreturn_t btintel_pcie_irq_msix_handler(int irq, void *dev_id) | |||
| 1720 | 1696 | ||
| 1721 | 1697 | if (unlikely(!(intr_fh | intr_hw))) { | |
| 1722 | 1698 | /* Ignore interrupt, inta == 0 */ | |
| 1723 | - | bt_warn_ratelimited("Bluetooth: btintel_pcie: Received spurious interrupt\n"); | |
| 1724 | - | btintel_pcie_wr_reg32(data, BTINTEL_PCIE_CSR_MSIX_AUTOMASK_ST, | |
| 1725 | - | BIT(entry->entry)); | |
| 1726 | 1699 | return IRQ_NONE; | |
| 1727 | 1700 | } | |
| 1728 | 1701 | ||
| @@ -1777,7 +1750,7 @@ static irqreturn_t btintel_pcie_irq_msix_handler(int irq, void *dev_id) | |||
| 1777 | 1750 | static int btintel_pcie_setup_irq(struct btintel_pcie_data *data) | |
| 1778 | 1751 | { | |
| 1779 | 1752 | int err; | |
| 1780 | - | int num_irqs, i, j; | |
| 1753 | + | int num_irqs, i; | |
| 1781 | 1754 | ||
| 1782 | 1755 | for (i = 0; i < BTINTEL_PCIE_MSIX_VEC_MAX; i++) | |
| 1783 | 1756 | data->msix_entries[i].entry = i; | |
| @@ -1806,10 +1779,6 @@ static int btintel_pcie_setup_irq(struct btintel_pcie_data *data) | |||
| 1806 | 1779 | KBUILD_MODNAME, | |
| 1807 | 1780 | msix_entry); | |
| 1808 | 1781 | if (err) { | |
| 1809 | - | for (j = 0; j < i; j++) | |
| 1810 | - | devm_free_irq(&data->pdev->dev, | |
| 1811 | - | data->msix_entries[j].vector, | |
| 1812 | - | &data->msix_entries[j]); | |
| 1813 | 1782 | pci_free_irq_vectors(data->pdev); | |
| 1814 | 1783 | data->alloc_vecs = 0; | |
| 1815 | 1784 | return err; | |
| @@ -1881,13 +1850,6 @@ static int btintel_pcie_config_pcie(struct pci_dev *pdev, | |||
| 1881 | 1850 | if (IS_ERR(data->base_addr)) | |
| 1882 | 1851 | return PTR_ERR(data->base_addr); | |
| 1883 | 1852 | ||
| 1884 | - | /* Do shared hardware reset to ensure a clean start before | |
| 1885 | - | * configuring interrupts. | |
| 1886 | - | */ | |
| 1887 | - | err = btintel_pcie_reset_bt(data); | |
| 1888 | - | if (err) | |
| 1889 | - | return err; | |
| 1890 | - | ||
| 1891 | 1853 | err = btintel_pcie_setup_irq(data); | |
| 1892 | 1854 | if (err) | |
| 1893 | 1855 | return err; | |
| @@ -2230,16 +2192,6 @@ static int btintel_pcie_send_frame(struct hci_dev *hdev, | |||
| 2230 | 2192 | if (test_bit(BTINTEL_PCIE_RECOVERY_IN_PROGRESS, &data->flags)) | |
| 2231 | 2193 | return -ENODEV; | |
| 2232 | 2194 | ||
| 2233 | - | /* Account for the 4-byte PCIe type header prepended before the | |
| 2234 | - | * DMA copy. Written as a subtraction to avoid wrap-around on | |
| 2235 | - | * attacker-controlled skb->len. | |
| 2236 | - | */ | |
| 2237 | - | if (skb->len > BTINTEL_PCIE_BUFFER_SIZE - BTINTEL_PCIE_HCI_TYPE_LEN) { | |
| 2238 | - | bt_dev_err(hdev, "Packet too large: %u > %u", skb->len, | |
| 2239 | - | BTINTEL_PCIE_BUFFER_SIZE - BTINTEL_PCIE_HCI_TYPE_LEN); | |
| 2240 | - | return -EMSGSIZE; | |
| 2241 | - | } | |
| 2242 | - | ||
| 2243 | 2195 | /* Due to the fw limitation, the type header of the packet should be | |
| 2244 | 2196 | * 4 bytes unlike 1 byte for UART. In UART, the firmware can read | |
| 2245 | 2197 | * the first byte to get the packet type and redirect the rest of data | |
| @@ -3149,7 +3101,7 @@ static void btintel_pcie_remove(struct pci_dev *pdev) | |||
| 3149 | 3101 | struct msix_entry *msix_entry; | |
| 3150 | 3102 | ||
| 3151 | 3103 | msix_entry = &data->msix_entries[i]; | |
| 3152 | - | devm_free_irq(&pdev->dev, msix_entry->vector, msix_entry); | |
| 3104 | + | free_irq(msix_entry->vector, msix_entry); | |
| 3153 | 3105 | } | |
| 3154 | 3106 | ||
| 3155 | 3107 | pci_free_irq_vectors(pdev); | |
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 | ||
| @@ -1379,6 +1374,16 @@ int btmtk_usb_setup(struct hci_dev *hdev) | |||
| 1379 | 1374 | break; | |
| 1380 | 1375 | case 0x7922: | |
| 1381 | 1376 | case 0x7925: | |
| 1377 | + | /* | |
| 1378 | + | * A remote wakeup could cause the device completely unresponsive, and | |
| 1379 | + | * recovering from such a state needs a power cycle. | |
| 1380 | + | * | |
| 1381 | + | * Since the remote wakeup capability is super broken, just disable it | |
| 1382 | + | * to get rid of the troubles. The device can still be autosuspended | |
| 1383 | + | * when the bluetooth interface is closed. | |
| 1384 | + | */ | |
| 1385 | + | device_set_wakeup_capable(&btmtk_data->udev->dev, false); | |
| 1386 | + | fallthrough; | |
| 1382 | 1387 | case 0x7961: | |
| 1383 | 1388 | case 0x7902: | |
| 1384 | 1389 | case 0x6639: | |
| @@ -1582,6 +1587,5 @@ MODULE_FIRMWARE(FIRMWARE_MT7663); | |||
| 1582 | 1587 | MODULE_FIRMWARE(FIRMWARE_MT7668); | |
| 1583 | 1588 | MODULE_FIRMWARE(FIRMWARE_MT7922); | |
| 1584 | 1589 | MODULE_FIRMWARE(FIRMWARE_MT7961); | |
| 1585 | - | MODULE_FIRMWARE(FIRMWARE_MT7920); | |
| 1586 | 1590 | MODULE_FIRMWARE(FIRMWARE_MT7925); | |
| 1587 | 1591 | MODULE_FIRMWARE(FIRMWARE_MT7927); | |
modified drivers/bluetooth/btmtk.h
| @@ -7,7 +7,6 @@ | |||
| 7 | 7 | #define FIRMWARE_MT7922 "mediatek/BT_RAM_CODE_MT7922_1_1_hdr.bin" | |
| 8 | 8 | #define FIRMWARE_MT7902 "mediatek/BT_RAM_CODE_MT7902_1_1_hdr.bin" | |
| 9 | 9 | #define FIRMWARE_MT7961 "mediatek/BT_RAM_CODE_MT7961_1_2_hdr.bin" | |
| 10 | - | #define FIRMWARE_MT7920 "mediatek/BT_RAM_CODE_MT7961_1a_2_hdr.bin" | |
| 11 | 10 | #define FIRMWARE_MT7925 "mediatek/mt7925/BT_RAM_CODE_MT7925_1_1_hdr.bin" | |
| 12 | 11 | #define FIRMWARE_MT7927 "mediatek/mt7927/BT_RAM_CODE_MT6639_2_1_hdr.bin" | |
| 13 | 12 | ||
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/btqcomsmd.c
| @@ -188,10 +188,7 @@ static int btqcomsmd_probe(struct platform_device *pdev) | |||
| 188 | 188 | return 0; | |
| 189 | 189 | ||
| 190 | 190 | hci_free_dev: | |
| 191 | - | rpmsg_destroy_ept(btq->cmd_channel); | |
| 192 | - | rpmsg_destroy_ept(btq->acl_channel); | |
| 193 | 191 | hci_free_dev(hdev); | |
| 194 | - | return ret; | |
| 195 | 192 | destroy_cmd_channel: | |
| 196 | 193 | rpmsg_destroy_ept(btq->cmd_channel); | |
| 197 | 194 | destroy_acl_channel: | |
| @@ -205,11 +202,10 @@ static void btqcomsmd_remove(struct platform_device *pdev) | |||
| 205 | 202 | struct btqcomsmd *btq = platform_get_drvdata(pdev); | |
| 206 | 203 | ||
| 207 | 204 | hci_unregister_dev(btq->hdev); | |
| 205 | + | hci_free_dev(btq->hdev); | |
| 208 | 206 | ||
| 209 | 207 | rpmsg_destroy_ept(btq->cmd_channel); | |
| 210 | 208 | rpmsg_destroy_ept(btq->acl_channel); | |
| 211 | - | ||
| 212 | - | hci_free_dev(btq->hdev); | |
| 213 | 209 | } | |
| 214 | 210 | ||
| 215 | 211 | static const struct of_device_id btqcomsmd_of_match[] = { | |
modified drivers/bluetooth/btrtl.c
| @@ -591,7 +591,7 @@ static int rtlbt_parse_firmware_v2(struct hci_dev *hdev, | |||
| 591 | 591 | * headers. | |
| 592 | 592 | */ | |
| 593 | 593 | if (!key_id) | |
| 594 | - | continue; | |
| 594 | + | break; | |
| 595 | 595 | rc = btrtl_parse_section(hdev, btrtl_dev, opcode, | |
| 596 | 596 | ptr, section_len); | |
| 597 | 597 | break; | |
| @@ -600,7 +600,8 @@ static int rtlbt_parse_firmware_v2(struct hci_dev *hdev, | |||
| 600 | 600 | ptr, section_len); | |
| 601 | 601 | break; | |
| 602 | 602 | default: | |
| 603 | - | continue; | |
| 603 | + | rc = 0; | |
| 604 | + | break; | |
| 604 | 605 | } | |
| 605 | 606 | if (rc < 0) { | |
| 606 | 607 | rtl_dev_err(hdev, "RTL: Parse section (%u) err %d", | |
modified drivers/bluetooth/btusb.c
| @@ -6,7 +6,6 @@ | |||
| 6 | 6 | * Copyright (C) 2005-2008 Marcel Holtmann <marcel@holtmann.org> | |
| 7 | 7 | */ | |
| 8 | 8 | ||
| 9 | - | #include <linux/cpufeature.h> | |
| 10 | 9 | #include <linux/dmi.h> | |
| 11 | 10 | #include <linux/module.h> | |
| 12 | 11 | #include <linux/usb.h> | |
| @@ -71,15 +70,6 @@ static struct usb_driver btusb_driver; | |||
| 71 | 70 | #define BTUSB_BROKEN_EXT_SCAN BIT(29) | |
| 72 | 71 | ||
| 73 | 72 | 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 | 73 | /* Generic Bluetooth USB device */ | |
| 84 | 74 | { USB_DEVICE_INFO(0xe0, 0x01, 0x01) }, | |
| 85 | 75 | ||
| @@ -486,14 +476,6 @@ static const struct usb_device_id quirks_table[] = { | |||
| 486 | 476 | { USB_DEVICE(0x1286, 0x2046), .driver_info = BTUSB_MARVELL }, | |
| 487 | 477 | { USB_DEVICE(0x1286, 0x204e), .driver_info = BTUSB_MARVELL }, | |
| 488 | 478 | ||
| 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 | 479 | /* Intel Bluetooth devices */ | |
| 498 | 480 | { USB_DEVICE(0x8087, 0x0025), .driver_info = BTUSB_INTEL_COMBINED }, | |
| 499 | 481 | { USB_DEVICE(0x8087, 0x0026), .driver_info = BTUSB_INTEL_COMBINED }, | |
| @@ -998,8 +980,6 @@ struct btqca_data { | |||
| 998 | 980 | #define BTUSB_USE_ALT3_FOR_WBS 15 | |
| 999 | 981 | #define BTUSB_ALT6_CONTINUOUS_TX 16 | |
| 1000 | 982 | #define BTUSB_HW_SSR_ACTIVE 17 | |
| 1001 | - | #define BTUSB_WAKEUP_BROKEN 18 | |
| 1002 | - | #define BTUSB_RESET 19 | |
| 1003 | 983 | ||
| 1004 | 984 | struct btusb_data { | |
| 1005 | 985 | struct hci_dev *hdev; | |
| @@ -1074,15 +1054,13 @@ static void btusb_reset(struct hci_dev *hdev) | |||
| 1074 | 1054 | int err; | |
| 1075 | 1055 | ||
| 1076 | 1056 | data = hci_get_drvdata(hdev); | |
| 1057 | + | /* This is not an unbalanced PM reference since the device will reset */ | |
| 1077 | 1058 | err = usb_autopm_get_interface(data->intf); | |
| 1078 | 1059 | if (err) { | |
| 1079 | 1060 | bt_dev_err(hdev, "Failed usb_autopm_get_interface: %d", err); | |
| 1080 | 1061 | return; | |
| 1081 | 1062 | } | |
| 1082 | 1063 | ||
| 1083 | - | if (test_and_set_bit(BTUSB_RESET, &data->flags)) | |
| 1084 | - | usb_autopm_put_interface_no_suspend(data->intf); | |
| 1085 | - | ||
| 1086 | 1064 | bt_dev_err(hdev, "Resetting usb device."); | |
| 1087 | 1065 | usb_queue_reset_device(data->intf); | |
| 1088 | 1066 | } | |
| @@ -2114,24 +2092,18 @@ static int btusb_close(struct hci_dev *hdev) | |||
| 2114 | 2092 | ||
| 2115 | 2093 | BT_DBG("%s", hdev->name); | |
| 2116 | 2094 | ||
| 2095 | + | cancel_delayed_work(&data->rx_work); | |
| 2117 | 2096 | cancel_work_sync(&data->work); | |
| 2118 | 2097 | cancel_work_sync(&data->waker); | |
| 2119 | 2098 | ||
| 2099 | + | skb_queue_purge(&data->acl_q); | |
| 2100 | + | ||
| 2120 | 2101 | clear_bit(BTUSB_ISOC_RUNNING, &data->flags); | |
| 2121 | 2102 | clear_bit(BTUSB_BULK_RUNNING, &data->flags); | |
| 2122 | 2103 | clear_bit(BTUSB_INTR_RUNNING, &data->flags); | |
| 2123 | 2104 | clear_bit(BTUSB_DIAG_RUNNING, &data->flags); | |
| 2124 | 2105 | ||
| 2125 | 2106 | btusb_stop_traffic(data); | |
| 2126 | - | ||
| 2127 | - | /* rx_work must only be canceled once the URBs that can rearm it are | |
| 2128 | - | * gone, and it must be canceled synchronously since btusb_disconnect() | |
| 2129 | - | * frees the btusb_data it dereferences right after hci_unregister_dev(). | |
| 2130 | - | */ | |
| 2131 | - | cancel_delayed_work_sync(&data->rx_work); | |
| 2132 | - | ||
| 2133 | - | skb_queue_purge(&data->acl_q); | |
| 2134 | - | ||
| 2135 | 2107 | btusb_free_frags(data); | |
| 2136 | 2108 | ||
| 2137 | 2109 | err = usb_autopm_get_interface(data->intf); | |
| @@ -2157,7 +2129,7 @@ static int btusb_flush(struct hci_dev *hdev) | |||
| 2157 | 2129 | ||
| 2158 | 2130 | BT_DBG("%s", hdev->name); | |
| 2159 | 2131 | ||
| 2160 | - | cancel_delayed_work_sync(&data->rx_work); | |
| 2132 | + | cancel_delayed_work(&data->rx_work); | |
| 2161 | 2133 | ||
| 2162 | 2134 | skb_queue_purge(&data->acl_q); | |
| 2163 | 2135 | ||
| @@ -2951,11 +2923,8 @@ static int btusb_mtk_reset(struct hci_dev *hdev, void *rst_data) | |||
| 2951 | 2923 | } | |
| 2952 | 2924 | ||
| 2953 | 2925 | err = usb_autopm_get_interface(data->intf); | |
| 2954 | - | if (err < 0) { | |
| 2955 | - | bt_dev_err(hdev, "Failed usb_autopm_get_interface: %d", err); | |
| 2956 | - | clear_bit(BTMTK_HW_RESET_ACTIVE, &btmtk_data->flags); | |
| 2926 | + | if (err < 0) | |
| 2957 | 2927 | return err; | |
| 2958 | - | } | |
| 2959 | 2928 | ||
| 2960 | 2929 | /* Release MediaTek ISO data interface */ | |
| 2961 | 2930 | btusb_mtk_release_iso_intf(hdev); | |
| @@ -2977,11 +2946,6 @@ static int btusb_mtk_reset(struct hci_dev *hdev, void *rst_data) | |||
| 2977 | 2946 | ||
| 2978 | 2947 | err = btmtk_usb_subsys_reset(hdev, btmtk_data->dev_id); | |
| 2979 | 2948 | ||
| 2980 | - | if (test_and_set_bit(BTUSB_RESET, &data->flags)) { | |
| 2981 | - | bt_dev_err(hdev, "last usb reset failed? Resetting again"); | |
| 2982 | - | usb_autopm_put_interface_no_suspend(data->intf); | |
| 2983 | - | } | |
| 2984 | - | ||
| 2985 | 2949 | usb_queue_reset_device(data->intf); | |
| 2986 | 2950 | clear_bit(BTMTK_HW_RESET_ACTIVE, &btmtk_data->flags); | |
| 2987 | 2951 | ||
| @@ -3005,25 +2969,10 @@ static int btusb_send_frame_mtk(struct hci_dev *hdev, struct sk_buff *skb) | |||
| 3005 | 2969 | } | |
| 3006 | 2970 | } | |
| 3007 | 2971 | ||
| 3008 | - | static inline bool platform_is_ryzen(void) | |
| 3009 | - | { | |
| 3010 | - | #ifdef CONFIG_X86 | |
| 3011 | - | return boot_cpu_has(X86_FEATURE_ZEN); | |
| 3012 | - | #else | |
| 3013 | - | return false; | |
| 3014 | - | #endif | |
| 3015 | - | } | |
| 3016 | - | ||
| 3017 | - | static inline bool is_direct_child_of_root_hub(struct usb_device *udev) | |
| 3018 | - | { | |
| 3019 | - | return udev->parent == udev->bus->root_hub; | |
| 3020 | - | } | |
| 3021 | - | ||
| 3022 | 2972 | static int btusb_mtk_setup(struct hci_dev *hdev) | |
| 3023 | 2973 | { | |
| 3024 | 2974 | struct btusb_data *data = hci_get_drvdata(hdev); | |
| 3025 | 2975 | struct btmtk_data *btmtk_data = hci_get_priv(hdev); | |
| 3026 | - | int err; | |
| 3027 | 2976 | ||
| 3028 | 2977 | /* MediaTek WMT vendor cmd requiring below USB resources to | |
| 3029 | 2978 | * complete the handshake. | |
| @@ -3040,40 +2989,7 @@ static int btusb_mtk_setup(struct hci_dev *hdev) | |||
| 3040 | 2989 | btusb_mtk_claim_iso_intf(data); | |
| 3041 | 2990 | } | |
| 3042 | 2991 | ||
| 3043 | - | err = btmtk_usb_setup(hdev); | |
| 3044 | - | if (err) | |
| 3045 | - | return err; | |
| 3046 | - | ||
| 3047 | - | switch (btmtk_data->dev_id) { | |
| 3048 | - | case 0x7922: | |
| 3049 | - | case 0x7925: | |
| 3050 | - | /* | |
| 3051 | - | * All reports seen to be relevant to Ryzen-based laptops. These | |
| 3052 | - | * NICs are usually used as OEM components thanks to some sort | |
| 3053 | - | * of reference designs. | |
| 3054 | - | * | |
| 3055 | - | * Their popularity on other platforms is unclear. While there | |
| 3056 | - | * is still a chance that the quirk may exist on other | |
| 3057 | - | * platforms, be cautious and only apply the quirk to direct | |
| 3058 | - | * children of Ryzen platforms's root hubs for the time being. | |
| 3059 | - | * | |
| 3060 | - | * In most cases the root hub is on the SoC or PCH, which needs | |
| 3061 | - | * the quirk. Unfortunately, this can't distinguish root hubs on | |
| 3062 | - | * PCIe add-in cards. Such roughness should be acceptable, as | |
| 3063 | - | * PCIe USB controller add-in cards are less commonly used | |
| 3064 | - | * nowadays. On the other hand, applying the quirk doesn't hurt | |
| 3065 | - | * any functionalities either, as the device can still be used | |
| 3066 | - | * as a wakeup source if desired. | |
| 3067 | - | * | |
| 3068 | - | * Theoretically, we could retrieve the root hub's PCI vendor ID | |
| 3069 | - | * with some hierarchy magic, but that's too intrusive... | |
| 3070 | - | */ | |
| 3071 | - | if (platform_is_ryzen() && is_direct_child_of_root_hub(data->udev)) | |
| 3072 | - | set_bit(BTUSB_WAKEUP_BROKEN, &data->flags); | |
| 3073 | - | break; | |
| 3074 | - | } | |
| 3075 | - | ||
| 3076 | - | return 0; | |
| 2992 | + | return btmtk_usb_setup(hdev); | |
| 3077 | 2993 | } | |
| 3078 | 2994 | ||
| 3079 | 2995 | static int btusb_mtk_shutdown(struct hci_dev *hdev) | |
| @@ -4624,9 +4540,6 @@ static void btusb_disconnect(struct usb_interface *intf) | |||
| 4624 | 4540 | if (data->reset_gpio) | |
| 4625 | 4541 | gpiod_put(data->reset_gpio); | |
| 4626 | 4542 | ||
| 4627 | - | if (test_and_clear_bit(BTUSB_RESET, &data->flags)) | |
| 4628 | - | usb_autopm_put_interface_no_suspend(data->intf); | |
| 4629 | - | ||
| 4630 | 4543 | if (intf == data->intf) { | |
| 4631 | 4544 | if (data->isoc) | |
| 4632 | 4545 | usb_driver_release_interface(&btusb_driver, data->isoc); | |
| @@ -4652,26 +4565,11 @@ static int btusb_suspend(struct usb_interface *intf, pm_message_t message) | |||
| 4652 | 4565 | ||
| 4653 | 4566 | BT_DBG("intf %p", intf); | |
| 4654 | 4567 | ||
| 4655 | - | /* | |
| 4656 | - | * It is reported that remote wakeup events could sometimes cause some | |
| 4657 | - | * adapters completely unresponsive. Resetting the xHCI root hub doesn't | |
| 4658 | - | * help at all, and recovering from such a state needs a power cycle. | |
| 4659 | - | * Since disabling remote wakeup simply causes the USB core to gate | |
| 4660 | - | * runtime autosuspend as well due to needs_remote_wakeup == 1, let's do | |
| 4661 | - | * this ourselves to make our life easier. The interface can be safely | |
| 4662 | - | * autosuspended as long as remote wakeup is disabled, i.e., after | |
| 4663 | - | * closing the HCI device. | |
| 4664 | - | * | |
| 4665 | - | * Don't auto-suspend if there are connections or discovery in progress. | |
| 4666 | - | * | |
| 4667 | - | * External suspend calls shall never fail. Specifically, a device with | |
| 4668 | - | * broken remote wakeup may still take the advantage of remote wakeup in | |
| 4669 | - | * order to wake up the system from sleep if userspace has enabled it as | |
| 4670 | - | * a wakeup source. | |
| 4568 | + | /* Don't auto-suspend if there are connections or discovery in | |
| 4569 | + | * progress; external suspend calls shall never fail. | |
| 4671 | 4570 | */ | |
| 4672 | 4571 | if (PMSG_IS_AUTO(message) && | |
| 4673 | - | ((test_bit(BTUSB_WAKEUP_BROKEN, &data->flags) && data->intf->needs_remote_wakeup) || | |
| 4674 | - | hci_conn_count(data->hdev) || hci_discovery_active(data->hdev))) | |
| 4572 | + | (hci_conn_count(data->hdev) || hci_discovery_active(data->hdev))) | |
| 4675 | 4573 | return -EBUSY; | |
| 4676 | 4574 | ||
| 4677 | 4575 | if (data->suspend_count++) | |
modified drivers/bluetooth/hci_mrvl.c
| @@ -307,8 +307,9 @@ static int mrvl_load_firmware(struct hci_dev *hdev, const char *name) | |||
| 307 | 307 | err = wait_on_bit_timeout(&mrvl->flags, STATE_FW_REQ_PENDING, | |
| 308 | 308 | TASK_INTERRUPTIBLE, | |
| 309 | 309 | msecs_to_jiffies(2000)); | |
| 310 | - | if (err == -EINTR) { | |
| 310 | + | if (err == 1) { | |
| 311 | 311 | bt_dev_err(hdev, "Firmware load interrupted"); | |
| 312 | + | err = -EINTR; | |
| 312 | 313 | break; | |
| 313 | 314 | } else if (err) { | |
| 314 | 315 | bt_dev_err(hdev, "Firmware request timeout"); | |
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/char/mem.c
| @@ -503,7 +503,7 @@ static int mmap_zero_prepare(struct vm_area_desc *desc) | |||
| 503 | 503 | #ifndef CONFIG_MMU | |
| 504 | 504 | return -ENOSYS; | |
| 505 | 505 | #endif | |
| 506 | - | if (vma_desc_test(desc, VMA_MAYSHARE_BIT)) | |
| 506 | + | if (vma_desc_test(desc, VMA_SHARED_BIT)) | |
| 507 | 507 | return shmem_zero_setup_desc(desc); | |
| 508 | 508 | ||
| 509 | 509 | /* | |
modified drivers/char/tpm/tpm-interface.c
| @@ -268,7 +268,7 @@ ssize_t tpm_transmit_cmd(struct tpm_chip *chip, struct tpm_buf *buf, | |||
| 268 | 268 | int err; | |
| 269 | 269 | ssize_t len; | |
| 270 | 270 | ||
| 271 | - | len = tpm_transmit(chip, buf->data, buf->capacity); | |
| 271 | + | len = tpm_transmit(chip, buf->data, PAGE_SIZE); | |
| 272 | 272 | if (len < 0) | |
| 273 | 273 | return len; | |
| 274 | 274 | ||
modified drivers/char/tpm/tpm2-cmd.c
| @@ -281,10 +281,8 @@ int tpm2_get_random(struct tpm_chip *chip, u8 *dest, size_t max) | |||
| 281 | 281 | } | |
| 282 | 282 | tpm_buf_append_u16(buf, num_bytes); | |
| 283 | 283 | err = tpm_buf_fill_hmac_session(chip, buf); | |
| 284 | - | if (err) { | |
| 285 | - | tpm2_end_auth_session(chip); | |
| 284 | + | if (err) | |
| 286 | 285 | return err; | |
| 287 | - | } | |
| 288 | 286 | ||
| 289 | 287 | err = tpm_transmit_cmd(chip, buf, | |
| 290 | 288 | offsetof(struct tpm2_get_random_out, | |
| @@ -307,7 +305,7 @@ int tpm2_get_random(struct tpm_chip *chip, u8 *dest, size_t max) | |||
| 307 | 305 | out = (struct tpm2_get_random_out *)&buf->data[offset]; | |
| 308 | 306 | recd = min_t(u32, be16_to_cpu(out->size), num_bytes); | |
| 309 | 307 | if (tpm_buf_length(buf) < | |
| 310 | - | offset + | |
| 308 | + | TPM_HEADER_SIZE + | |
| 311 | 309 | offsetof(struct tpm2_get_random_out, buffer) + | |
| 312 | 310 | recd) { | |
| 313 | 311 | tpm2_end_auth_session(chip); | |
modified drivers/char/tpm/tpm2-sessions.c
| @@ -975,7 +975,6 @@ static int tpm2_load_null(struct tpm_chip *chip, u32 *null_key) | |||
| 975 | 975 | /* Deduce from the name change TPM interference: */ | |
| 976 | 976 | dev_err(&chip->dev, "null key integrity check failed\n"); | |
| 977 | 977 | tpm2_flush_context(chip, tmp_null_key); | |
| 978 | - | rc = -ENODEV; | |
| 979 | 978 | ||
| 980 | 979 | err: | |
| 981 | 980 | if (rc) { | |
modified drivers/char/virtio_console.c
| @@ -426,7 +426,7 @@ static struct port_buffer *alloc_buf(struct virtio_device *vdev, size_t buf_size | |||
| 426 | 426 | * Allocate buffer and the sg list. The sg list array is allocated | |
| 427 | 427 | * directly after the port_buffer struct. | |
| 428 | 428 | */ | |
| 429 | - | buf = kmalloc_flex(*buf, sg, pages, gfp); | |
| 429 | + | buf = kmalloc_flex(*buf, sg, pages); | |
| 430 | 430 | if (!buf) | |
| 431 | 431 | goto fail; | |
| 432 | 432 | ||
| @@ -1964,28 +1964,13 @@ static const struct file_operations portdev_fops = { | |||
| 1964 | 1964 | static void remove_vqs(struct ports_device *portdev) | |
| 1965 | 1965 | { | |
| 1966 | 1966 | struct virtqueue *vq; | |
| 1967 | - | bool multiport = use_multiport(portdev); | |
| 1968 | 1967 | ||
| 1969 | 1968 | virtio_device_for_each_vq(portdev->vdev, vq) { | |
| 1970 | 1969 | struct port_buffer *buf; | |
| 1971 | - | unsigned int len; | |
| 1972 | 1970 | ||
| 1973 | - | /* | |
| 1974 | - | * c_ovq cookies are &portdev->cpkt, not port_buffer. | |
| 1975 | - | * Detach them but do not free_buf(). | |
| 1976 | - | */ | |
| 1977 | - | if (multiport && vq == portdev->c_ovq) { | |
| 1978 | - | spin_lock(&portdev->c_ovq_lock); | |
| 1979 | - | while (virtqueue_get_buf(vq, &len)) | |
| 1980 | - | ; | |
| 1981 | - | while (virtqueue_detach_unused_buf(vq)) | |
| 1982 | - | ; | |
| 1983 | - | spin_unlock(&portdev->c_ovq_lock); | |
| 1984 | - | } else { | |
| 1985 | - | flush_bufs(vq, true); | |
| 1986 | - | while ((buf = virtqueue_detach_unused_buf(vq))) | |
| 1987 | - | free_buf(buf, true); | |
| 1988 | - | } | |
| 1971 | + | flush_bufs(vq, true); | |
| 1972 | + | while ((buf = virtqueue_detach_unused_buf(vq))) | |
| 1973 | + | free_buf(buf, true); | |
| 1989 | 1974 | cond_resched(); | |
| 1990 | 1975 | } | |
| 1991 | 1976 | portdev->vdev->config->del_vqs(portdev->vdev); | |
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/clk/spacemit/ccu-k3.c
| @@ -30,87 +30,14 @@ static const struct ccu_pll_rate_tbl pll2_rate_tbl[] = { | |||
| 30 | 30 | }; | |
| 31 | 31 | ||
| 32 | 32 | static const struct ccu_pll_rate_tbl pll3_rate_tbl[] = { | |
| 33 | - | CCU_PLLA_RATE(1050000000UL, 0x0b2b3000, 0x00000000, 0xa0458080), | |
| 34 | - | CCU_PLLA_RATE(1100000000UL, 0x0b2d3555, 0x00005500, 0xa0458181), | |
| 35 | - | CCU_PLLA_RATE(1150000000UL, 0x0b2f3aaa, 0x0000ab00, 0xa0458181), | |
| 36 | - | CCU_PLLA_RATE(1200000000UL, 0x0b320000, 0x00000000, 0xa0458181), | |
| 37 | - | CCU_PLLA_RATE(1250000000UL, 0x0b340555, 0x00005500, 0xa0458181), | |
| 38 | - | CCU_PLLA_RATE(1300000000UL, 0x0b360aaa, 0x0000ab00, 0xa0458282), | |
| 39 | - | CCU_PLLA_RATE(1350000000UL, 0x0b381000, 0x00000000, 0xa0458282), | |
| 40 | - | CCU_PLLA_RATE(1400000000UL, 0x0b3a1555, 0x00005500, 0xa0458282), | |
| 41 | - | CCU_PLLA_RATE(1450000000UL, 0x0b3c1aaa, 0x0000ab00, 0xa0458383), | |
| 42 | - | CCU_PLLA_RATE(1500000000UL, 0x0b3e2000, 0x00000000, 0xa0458383), | |
| 43 | - | CCU_PLLA_RATE(1550000000UL, 0x0b402555, 0x00005500, 0xa0458383), | |
| 44 | - | CCU_PLLA_RATE(1600000000UL, 0x0b422aaa, 0x0000ab00, 0xa0458484), | |
| 45 | - | CCU_PLLA_RATE(1650000000UL, 0x0b443000, 0x00000000, 0xa0458484), | |
| 46 | - | CCU_PLLA_RATE(1700000000UL, 0x0b463555, 0x00005500, 0xa0458484), | |
| 47 | - | CCU_PLLA_RATE(1750000000UL, 0x0b483aaa, 0x0000ab00, 0xa0458585), | |
| 48 | - | CCU_PLLA_RATE(1800000000UL, 0x0b4b0000, 0x00000000, 0xa0458585), | |
| 49 | - | CCU_PLLA_RATE(1850000000UL, 0x0b4d0555, 0x00005500, 0xa0458585), | |
| 50 | - | CCU_PLLA_RATE(1900000000UL, 0x0b4f0aaa, 0x0000ab00, 0xa0458686), | |
| 51 | - | CCU_PLLA_RATE(1950000000UL, 0x0b511000, 0x00000000, 0xa0458686), | |
| 52 | - | CCU_PLLA_RATE(2000000000UL, 0x0b292aaa, 0x0000ab00, 0xa0558686), | |
| 53 | - | CCU_PLLA_RATE(2050000000UL, 0x0b2a2d55, 0x00005500, 0xa0558686), | |
| 54 | - | CCU_PLLA_RATE(2100000000UL, 0x0b2b3000, 0x00000000, 0xa0558787), | |
| 55 | - | CCU_PLLA_RATE(2150000000UL, 0x0b2c32aa, 0x0000ab00, 0xa0558787), | |
| 56 | 33 | CCU_PLLA_RATE(2200000000UL, 0x0b2d3555, 0x00005500, 0xa0558787), | |
| 57 | - | CCU_PLLA_RATE(2250000000UL, 0x0b2e3800, 0x00000000, 0xa0558888), | |
| 58 | - | CCU_PLLA_RATE(2300000000UL, 0x0b2f3aaa, 0x0000ab00, 0xa0558888), | |
| 59 | - | CCU_PLLA_RATE(2350000000UL, 0x0b303d55, 0x00005500, 0xa0558888), | |
| 60 | - | CCU_PLLA_RATE(2400000000UL, 0x0b320000, 0x00000000, 0xa0558989), | |
| 61 | 34 | }; | |
| 62 | 35 | ||
| 63 | 36 | static const struct ccu_pll_rate_tbl pll4_rate_tbl[] = { | |
| 64 | - | CCU_PLLA_RATE(1050000000UL, 0x0b2b3000, 0x00000000, 0xa0458080), | |
| 65 | - | CCU_PLLA_RATE(1100000000UL, 0x0b2d3555, 0x00005500, 0xa0458181), | |
| 66 | - | CCU_PLLA_RATE(1150000000UL, 0x0b2f3aaa, 0x0000ab00, 0xa0458181), | |
| 67 | - | CCU_PLLA_RATE(1200000000UL, 0x0b320000, 0x00000000, 0xa0458181), | |
| 68 | - | CCU_PLLA_RATE(1250000000UL, 0x0b340555, 0x00005500, 0xa0458181), | |
| 69 | - | CCU_PLLA_RATE(1300000000UL, 0x0b360aaa, 0x0000ab00, 0xa0458282), | |
| 70 | - | CCU_PLLA_RATE(1350000000UL, 0x0b381000, 0x00000000, 0xa0458282), | |
| 71 | - | CCU_PLLA_RATE(1400000000UL, 0x0b3a1555, 0x00005500, 0xa0458282), | |
| 72 | - | CCU_PLLA_RATE(1450000000UL, 0x0b3c1aaa, 0x0000ab00, 0xa0458383), | |
| 73 | - | CCU_PLLA_RATE(1500000000UL, 0x0b3e2000, 0x00000000, 0xa0458383), | |
| 74 | - | CCU_PLLA_RATE(1550000000UL, 0x0b402555, 0x00005500, 0xa0458383), | |
| 75 | - | CCU_PLLA_RATE(1600000000UL, 0x0b422aaa, 0x0000ab00, 0xa0458484), | |
| 76 | - | CCU_PLLA_RATE(1650000000UL, 0x0b443000, 0x00000000, 0xa0458484), | |
| 77 | - | CCU_PLLA_RATE(1700000000UL, 0x0b463555, 0x00005500, 0xa0458484), | |
| 78 | - | CCU_PLLA_RATE(1750000000UL, 0x0b483aaa, 0x0000ab00, 0xa0458585), | |
| 79 | - | CCU_PLLA_RATE(1800000000UL, 0x0b4b0000, 0x00000000, 0xa0458585), | |
| 80 | - | CCU_PLLA_RATE(1850000000UL, 0x0b4d0555, 0x00005500, 0xa0458585), | |
| 81 | - | CCU_PLLA_RATE(1900000000UL, 0x0b4f0aaa, 0x0000ab00, 0xa0458686), | |
| 82 | - | CCU_PLLA_RATE(1950000000UL, 0x0b511000, 0x00000000, 0xa0458686), | |
| 83 | - | CCU_PLLA_RATE(2000000000UL, 0x0b292aaa, 0x0000ab00, 0xa0558686), | |
| 84 | - | CCU_PLLA_RATE(2050000000UL, 0x0b2a2d55, 0x00005500, 0xa0558686), | |
| 85 | - | CCU_PLLA_RATE(2100000000UL, 0x0b2b3000, 0x00000000, 0xa0558787), | |
| 86 | - | CCU_PLLA_RATE(2150000000UL, 0x0b2c32aa, 0x0000ab00, 0xa0558787), | |
| 87 | 37 | CCU_PLLA_RATE(2200000000UL, 0x0b2d3555, 0x00005500, 0xa0558787), | |
| 88 | - | CCU_PLLA_RATE(2250000000UL, 0x0b2e3800, 0x00000000, 0xa0558888), | |
| 89 | - | CCU_PLLA_RATE(2300000000UL, 0x0b2f3aaa, 0x0000ab00, 0xa0558888), | |
| 90 | - | CCU_PLLA_RATE(2350000000UL, 0x0b303d55, 0x00005500, 0xa0558888), | |
| 91 | - | CCU_PLLA_RATE(2400000000UL, 0x0b320000, 0x00000000, 0xa0558989), | |
| 92 | 38 | }; | |
| 93 | 39 | ||
| 94 | 40 | static const struct ccu_pll_rate_tbl pll5_rate_tbl[] = { | |
| 95 | - | CCU_PLLA_RATE(1050000000UL, 0x0b2b3000, 0x00000000, 0xa0458080), | |
| 96 | - | CCU_PLLA_RATE(1100000000UL, 0x0b2d3555, 0x00005500, 0xa0458181), | |
| 97 | - | CCU_PLLA_RATE(1150000000UL, 0x0b2f3aaa, 0x0000ab00, 0xa0458181), | |
| 98 | - | CCU_PLLA_RATE(1200000000UL, 0x0b320000, 0x00000000, 0xa0458181), | |
| 99 | - | CCU_PLLA_RATE(1250000000UL, 0x0b340555, 0x00005500, 0xa0458181), | |
| 100 | - | CCU_PLLA_RATE(1300000000UL, 0x0b360aaa, 0x0000ab00, 0xa0458282), | |
| 101 | - | CCU_PLLA_RATE(1350000000UL, 0x0b381000, 0x00000000, 0xa0458282), | |
| 102 | - | CCU_PLLA_RATE(1400000000UL, 0x0b3a1555, 0x00005500, 0xa0458282), | |
| 103 | - | CCU_PLLA_RATE(1450000000UL, 0x0b3c1aaa, 0x0000ab00, 0xa0458383), | |
| 104 | - | CCU_PLLA_RATE(1500000000UL, 0x0b3e2000, 0x00000000, 0xa0458383), | |
| 105 | - | CCU_PLLA_RATE(1550000000UL, 0x0b402555, 0x00005500, 0xa0458383), | |
| 106 | - | CCU_PLLA_RATE(1600000000UL, 0x0b422aaa, 0x0000ab00, 0xa0458484), | |
| 107 | - | CCU_PLLA_RATE(1650000000UL, 0x0b443000, 0x00000000, 0xa0458484), | |
| 108 | - | CCU_PLLA_RATE(1700000000UL, 0x0b463555, 0x00005500, 0xa0458484), | |
| 109 | - | CCU_PLLA_RATE(1750000000UL, 0x0b483aaa, 0x0000ab00, 0xa0458585), | |
| 110 | - | CCU_PLLA_RATE(1800000000UL, 0x0b4b0000, 0x00000000, 0xa0458585), | |
| 111 | - | CCU_PLLA_RATE(1850000000UL, 0x0b4d0555, 0x00005500, 0xa0458585), | |
| 112 | - | CCU_PLLA_RATE(1900000000UL, 0x0b4f0aaa, 0x0000ab00, 0xa0458686), | |
| 113 | - | CCU_PLLA_RATE(1950000000UL, 0x0b511000, 0x00000000, 0xa0458686), | |
| 114 | 41 | CCU_PLLA_RATE(2000000000UL, 0x0b292aaa, 0x0000ab00, 0xa0558686), | |
| 115 | 42 | }; | |
| 116 | 43 | ||
| @@ -123,25 +50,6 @@ static const struct ccu_pll_rate_tbl pll7_rate_tbl[] = { | |||
| 123 | 50 | }; | |
| 124 | 51 | ||
| 125 | 52 | static const struct ccu_pll_rate_tbl pll8_rate_tbl[] = { | |
| 126 | - | CCU_PLLA_RATE(1050000000UL, 0x0b2b3000, 0x00000000, 0xa0458080), | |
| 127 | - | CCU_PLLA_RATE(1100000000UL, 0x0b2d3555, 0x00005500, 0xa0458181), | |
| 128 | - | CCU_PLLA_RATE(1150000000UL, 0x0b2f3aaa, 0x0000ab00, 0xa0458181), | |
| 129 | - | CCU_PLLA_RATE(1200000000UL, 0x0b320000, 0x00000000, 0xa0458181), | |
| 130 | - | CCU_PLLA_RATE(1250000000UL, 0x0b340555, 0x00005500, 0xa0458181), | |
| 131 | - | CCU_PLLA_RATE(1300000000UL, 0x0b360aaa, 0x0000ab00, 0xa0458282), | |
| 132 | - | CCU_PLLA_RATE(1350000000UL, 0x0b381000, 0x00000000, 0xa0458282), | |
| 133 | - | CCU_PLLA_RATE(1400000000UL, 0x0b3a1555, 0x00005500, 0xa0458282), | |
| 134 | - | CCU_PLLA_RATE(1450000000UL, 0x0b3c1aaa, 0x0000ab00, 0xa0458383), | |
| 135 | - | CCU_PLLA_RATE(1500000000UL, 0x0b3e2000, 0x00000000, 0xa0458383), | |
| 136 | - | CCU_PLLA_RATE(1550000000UL, 0x0b402555, 0x00005500, 0xa0458383), | |
| 137 | - | CCU_PLLA_RATE(1600000000UL, 0x0b422aaa, 0x0000ab00, 0xa0458484), | |
| 138 | - | CCU_PLLA_RATE(1650000000UL, 0x0b443000, 0x00000000, 0xa0458484), | |
| 139 | - | CCU_PLLA_RATE(1700000000UL, 0x0b463555, 0x00005500, 0xa0458484), | |
| 140 | - | CCU_PLLA_RATE(1750000000UL, 0x0b483aaa, 0x0000ab00, 0xa0458585), | |
| 141 | - | CCU_PLLA_RATE(1800000000UL, 0x0b4b0000, 0x00000000, 0xa0458585), | |
| 142 | - | CCU_PLLA_RATE(1850000000UL, 0x0b4d0555, 0x00005500, 0xa0458585), | |
| 143 | - | CCU_PLLA_RATE(1900000000UL, 0x0b4f0aaa, 0x0000ab00, 0xa0458686), | |
| 144 | - | CCU_PLLA_RATE(1950000000UL, 0x0b511000, 0x00000000, 0xa0458686), | |
| 145 | 53 | CCU_PLLA_RATE(2000000000UL, 0x0b292aaa, 0x0000ab00, 0xa0558686), | |
| 146 | 54 | }; | |
| 147 | 55 | ||
modified drivers/clk/ti/composite.c
| @@ -52,7 +52,7 @@ static const struct clk_ops ti_composite_gate_ops = { | |||
| 52 | 52 | ||
| 53 | 53 | struct component_clk { | |
| 54 | 54 | int num_parents; | |
| 55 | - | const char **parent_names; | |
| 55 | + | struct clk_parent_data *parent_data; | |
| 56 | 56 | struct device_node *node; | |
| 57 | 57 | int type; | |
| 58 | 58 | struct clk_hw *hw; | |
| @@ -116,7 +116,7 @@ static void __init _register_composite(void *user, | |||
| 116 | 116 | struct clk_hw_omap_comp *cclk = to_clk_hw_comp(hw); | |
| 117 | 117 | struct component_clk *comp; | |
| 118 | 118 | int num_parents = 0; | |
| 119 | - | const char **parent_names = NULL; | |
| 119 | + | struct clk_parent_data *parent_data = NULL; | |
| 120 | 120 | const char *name; | |
| 121 | 121 | int i; | |
| 122 | 122 | int ret; | |
| @@ -155,7 +155,7 @@ static void __init _register_composite(void *user, | |||
| 155 | 155 | continue; | |
| 156 | 156 | if (comp->num_parents) { | |
| 157 | 157 | num_parents = comp->num_parents; | |
| 158 | - | parent_names = comp->parent_names; | |
| 158 | + | parent_data = comp->parent_data; | |
| 159 | 159 | break; | |
| 160 | 160 | } | |
| 161 | 161 | } | |
| @@ -166,8 +166,8 @@ static void __init _register_composite(void *user, | |||
| 166 | 166 | } | |
| 167 | 167 | ||
| 168 | 168 | name = ti_dt_clk_name(node); | |
| 169 | - | clk = clk_register_composite(NULL, name, | |
| 170 | - | parent_names, num_parents, | |
| 169 | + | clk = clk_register_composite_pdata(NULL, name, | |
| 170 | + | parent_data, num_parents, | |
| 171 | 171 | _get_hw(cclk, CLK_COMPONENT_TYPE_MUX), | |
| 172 | 172 | &ti_clk_mux_ops, | |
| 173 | 173 | _get_hw(cclk, CLK_COMPONENT_TYPE_DIVIDER), | |
| @@ -190,7 +190,7 @@ cleanup: | |||
| 190 | 190 | if (!cclk->comp_clks[i]) | |
| 191 | 191 | continue; | |
| 192 | 192 | list_del(&cclk->comp_clks[i]->link); | |
| 193 | - | kfree(cclk->comp_clks[i]->parent_names); | |
| 193 | + | kfree(cclk->comp_clks[i]->parent_data); | |
| 194 | 194 | kfree(cclk->comp_clks[i]); | |
| 195 | 195 | } | |
| 196 | 196 | ||
| @@ -237,8 +237,9 @@ int __init ti_clk_add_component(struct device_node *node, struct clk_hw *hw, | |||
| 237 | 237 | int type) | |
| 238 | 238 | { | |
| 239 | 239 | unsigned int num_parents; | |
| 240 | - | const char **parent_names; | |
| 240 | + | struct clk_parent_data *parent_data; | |
| 241 | 241 | struct component_clk *clk; | |
| 242 | + | unsigned int i; | |
| 242 | 243 | ||
| 243 | 244 | num_parents = of_clk_get_parent_count(node); | |
| 244 | 245 | ||
| @@ -247,20 +248,21 @@ int __init ti_clk_add_component(struct device_node *node, struct clk_hw *hw, | |||
| 247 | 248 | return -EINVAL; | |
| 248 | 249 | } | |
| 249 | 250 | ||
| 250 | - | parent_names = kcalloc(num_parents, sizeof(char *), GFP_KERNEL); | |
| 251 | - | if (!parent_names) | |
| 251 | + | parent_data = kcalloc(num_parents, sizeof(*parent_data), GFP_KERNEL); | |
| 252 | + | if (!parent_data) | |
| 252 | 253 | return -ENOMEM; | |
| 253 | 254 | ||
| 254 | - | of_clk_parent_fill(node, parent_names, num_parents); | |
| 255 | + | for (i = 0; i < num_parents; i++) | |
| 256 | + | parent_data[i].index = i; | |
| 255 | 257 | ||
| 256 | 258 | clk = kzalloc_obj(*clk); | |
| 257 | 259 | if (!clk) { | |
| 258 | - | kfree(parent_names); | |
| 260 | + | kfree(parent_data); | |
| 259 | 261 | return -ENOMEM; | |
| 260 | 262 | } | |
| 261 | 263 | ||
| 262 | 264 | clk->num_parents = num_parents; | |
| 263 | - | clk->parent_names = parent_names; | |
| 265 | + | clk->parent_data = parent_data; | |
| 264 | 266 | clk->hw = hw; | |
| 265 | 267 | clk->node = node; | |
| 266 | 268 | clk->type = type; | |
modified drivers/clk/ti/mux.c
| @@ -181,7 +181,7 @@ static void of_mux_clk_setup(struct device_node *node) | |||
| 181 | 181 | pr_err("mux-clock %pOFn must have parents\n", node); | |
| 182 | 182 | return; | |
| 183 | 183 | } | |
| 184 | - | parent_data = kzalloc_objs(*parent_data, num_parents); | |
| 184 | + | parent_data = kcalloc(num_parents, sizeof(*parent_data), GFP_KERNEL); | |
| 185 | 185 | if (!parent_data) | |
| 186 | 186 | return; | |
| 187 | 187 | ||
modified drivers/cpufreq/amd-pstate.c
| @@ -1624,7 +1624,7 @@ static struct freq_attr **get_freq_attrs(void) | |||
| 1624 | 1624 | /* amd_pstate_{max_freq, lowest_nonlinear_freq, highest_perf} should always be visible */ | |
| 1625 | 1625 | BUG_ON(!count); | |
| 1626 | 1626 | ||
| 1627 | - | attrs = kzalloc_objs(struct freq_attr *, count + 1); | |
| 1627 | + | attrs = kcalloc(count + 1, sizeof(struct freq_attr *), GFP_KERNEL); | |
| 1628 | 1628 | if (!attrs) | |
| 1629 | 1629 | return ERR_PTR(-ENOMEM); | |
| 1630 | 1630 | ||
modified drivers/cpufreq/cpufreq.c
| @@ -1249,7 +1249,7 @@ static struct cpufreq_policy *cpufreq_policy_alloc(unsigned int cpu) | |||
| 1249 | 1249 | if (!policy) | |
| 1250 | 1250 | return NULL; | |
| 1251 | 1251 | ||
| 1252 | - | if (!zalloc_cpumask_var(&policy->cpus, GFP_KERNEL)) | |
| 1252 | + | if (!alloc_cpumask_var(&policy->cpus, GFP_KERNEL)) | |
| 1253 | 1253 | goto err_free_policy; | |
| 1254 | 1254 | ||
| 1255 | 1255 | if (!zalloc_cpumask_var(&policy->related_cpus, GFP_KERNEL)) | |
| @@ -1258,8 +1258,6 @@ static struct cpufreq_policy *cpufreq_policy_alloc(unsigned int cpu) | |||
| 1258 | 1258 | if (!zalloc_cpumask_var(&policy->real_cpus, GFP_KERNEL)) | |
| 1259 | 1259 | goto err_free_rcpumask; | |
| 1260 | 1260 | ||
| 1261 | - | init_rwsem(&policy->rwsem); | |
| 1262 | - | ||
| 1263 | 1261 | init_completion(&policy->kobj_unregister); | |
| 1264 | 1262 | ret = kobject_init_and_add(&policy->kobj, &ktype_cpufreq, | |
| 1265 | 1263 | cpufreq_global_kobject, "policy%u", cpu); | |
| @@ -1274,6 +1272,8 @@ static struct cpufreq_policy *cpufreq_policy_alloc(unsigned int cpu) | |||
| 1274 | 1272 | goto err_free_real_cpus; | |
| 1275 | 1273 | } | |
| 1276 | 1274 | ||
| 1275 | + | init_rwsem(&policy->rwsem); | |
| 1276 | + | ||
| 1277 | 1277 | freq_constraints_init(&policy->constraints); | |
| 1278 | 1278 | ||
| 1279 | 1279 | policy->nb_min.notifier_call = cpufreq_notifier_min; | |
| @@ -2590,8 +2590,8 @@ static void cpufreq_update_pressure(struct cpufreq_policy *policy) | |||
| 2590 | 2590 | ||
| 2591 | 2591 | cpu = cpumask_first(policy->related_cpus); | |
| 2592 | 2592 | max_freq = arch_scale_freq_ref(cpu); | |
| 2593 | - | if (!max_freq && cpufreq_driver->scale_freq_ref) | |
| 2594 | - | max_freq = cpufreq_driver->scale_freq_ref(policy); | |
| 2593 | + | if (!max_freq) | |
| 2594 | + | max_freq = policy->cpuinfo.max_freq; | |
| 2595 | 2595 | ||
| 2596 | 2596 | capped_freq = policy->max; | |
| 2597 | 2597 | ||
modified drivers/cpufreq/intel_pstate.c
| @@ -1135,14 +1135,6 @@ static bool hybrid_clear_max_perf_cpu(void) | |||
| 1135 | 1135 | return ret; | |
| 1136 | 1136 | } | |
| 1137 | 1137 | ||
| 1138 | - | static unsigned int intel_pstate_scale_freq_ref(struct cpufreq_policy *policy) | |
| 1139 | - | { | |
| 1140 | - | if (READ_ONCE(all_cpu_data[policy->cpu]->capacity_perf)) | |
| 1141 | - | return policy->cpuinfo.max_freq; | |
| 1142 | - | ||
| 1143 | - | return 0; | |
| 1144 | - | } | |
| 1145 | - | ||
| 1146 | 1138 | static void intel_pstate_update_freq_limits(struct cpudata *cpu) | |
| 1147 | 1139 | { | |
| 1148 | 1140 | int scaling = cpu->pstate.scaling; | |
| @@ -3096,7 +3088,6 @@ static struct cpufreq_driver intel_pstate = { | |||
| 3096 | 3088 | .offline = intel_pstate_cpu_offline, | |
| 3097 | 3089 | .online = intel_pstate_cpu_online, | |
| 3098 | 3090 | .update_limits = intel_pstate_update_limits, | |
| 3099 | - | .scale_freq_ref = intel_pstate_scale_freq_ref, | |
| 3100 | 3091 | .name = "intel_pstate", | |
| 3101 | 3092 | }; | |
| 3102 | 3093 | ||
| @@ -3420,7 +3411,6 @@ static struct cpufreq_driver intel_cpufreq = { | |||
| 3420 | 3411 | .suspend = intel_cpufreq_suspend, | |
| 3421 | 3412 | .resume = intel_pstate_resume, | |
| 3422 | 3413 | .update_limits = intel_pstate_update_limits, | |
| 3423 | - | .scale_freq_ref = intel_pstate_scale_freq_ref, | |
| 3424 | 3414 | .name = "intel_cpufreq", | |
| 3425 | 3415 | }; | |
| 3426 | 3416 | ||
modified drivers/cpuidle/cpuidle-psci.c
| @@ -16,7 +16,7 @@ | |||
| 16 | 16 | #include <linux/kernel.h> | |
| 17 | 17 | #include <linux/module.h> | |
| 18 | 18 | #include <linux/of.h> | |
| 19 | - | #include <linux/platform_device.h> | |
| 19 | + | #include <linux/device/faux.h> | |
| 20 | 20 | #include <linux/psci.h> | |
| 21 | 21 | #include <linux/pm_domain.h> | |
| 22 | 22 | #include <linux/pm_runtime.h> | |
| @@ -428,14 +428,14 @@ deinit: | |||
| 428 | 428 | * to register cpuidle driver then rollback to cancel all CPUs | |
| 429 | 429 | * registration. | |
| 430 | 430 | */ | |
| 431 | - | static int psci_cpuidle_probe(struct platform_device *pdev) | |
| 431 | + | static int psci_cpuidle_probe(struct faux_device *fdev) | |
| 432 | 432 | { | |
| 433 | 433 | int cpu, ret; | |
| 434 | 434 | struct cpuidle_driver *drv; | |
| 435 | 435 | struct cpuidle_device *dev; | |
| 436 | 436 | ||
| 437 | 437 | for_each_present_cpu(cpu) { | |
| 438 | - | ret = psci_idle_init_cpu(&pdev->dev, cpu); | |
| 438 | + | ret = psci_idle_init_cpu(&fdev->dev, cpu); | |
| 439 | 439 | if (ret) | |
| 440 | 440 | goto out_fail; | |
| 441 | 441 | } | |
| @@ -455,26 +455,36 @@ out_fail: | |||
| 455 | 455 | return ret; | |
| 456 | 456 | } | |
| 457 | 457 | ||
| 458 | - | static struct platform_driver psci_cpuidle_driver = { | |
| 458 | + | static struct faux_device_ops psci_cpuidle_ops = { | |
| 459 | 459 | .probe = psci_cpuidle_probe, | |
| 460 | - | .driver = { | |
| 461 | - | .name = "psci-cpuidle", | |
| 462 | - | }, | |
| 463 | 460 | }; | |
| 464 | 461 | ||
| 462 | + | static bool __init dt_idle_state_present(void) | |
| 463 | + | { | |
| 464 | + | struct device_node *cpu_node __free(device_node) = | |
| 465 | + | of_cpu_device_node_get(cpumask_first(cpu_possible_mask)); | |
| 466 | + | if (!cpu_node) | |
| 467 | + | return false; | |
| 468 | + | ||
| 469 | + | struct device_node *state_node __free(device_node) = | |
| 470 | + | of_get_cpu_state_node(cpu_node, 0); | |
| 471 | + | if (!state_node) | |
| 472 | + | return false; | |
| 473 | + | ||
| 474 | + | return !!of_match_node(psci_idle_state_match, state_node); | |
| 475 | + | } | |
| 476 | + | ||
| 465 | 477 | static int __init psci_idle_init(void) | |
| 466 | 478 | { | |
| 467 | - | struct platform_device *pdev; | |
| 468 | - | int ret; | |
| 479 | + | struct faux_device *fdev; | |
| 469 | 480 | ||
| 470 | - | ret = platform_driver_register(&psci_cpuidle_driver); | |
| 471 | - | if (ret) | |
| 472 | - | return ret; | |
| 481 | + | if (!dt_idle_state_present()) | |
| 482 | + | return 0; | |
| 473 | 483 | ||
| 474 | - | pdev = platform_device_register_simple("psci-cpuidle", -1, NULL, 0); | |
| 475 | - | if (IS_ERR(pdev)) { | |
| 476 | - | platform_driver_unregister(&psci_cpuidle_driver); | |
| 477 | - | return PTR_ERR(pdev); | |
| 484 | + | fdev = faux_device_create("psci-cpuidle", NULL, &psci_cpuidle_ops); | |
| 485 | + | if (!fdev) { | |
| 486 | + | pr_err("Failed to create psci-cpuidle device\n"); | |
| 487 | + | return -ENODEV; | |
| 478 | 488 | } | |
| 479 | 489 | ||
| 480 | 490 | return 0; | |
modified drivers/cpuidle/dt_idle_genpd.c
| @@ -99,7 +99,7 @@ struct generic_pm_domain *dt_idle_pd_alloc(struct device_node *np, | |||
| 99 | 99 | if (!pd) | |
| 100 | 100 | goto out; | |
| 101 | 101 | ||
| 102 | - | pd->name = kstrdup(kbasename(of_node_full_name(np)), GFP_KERNEL); | |
| 102 | + | pd->name = kasprintf(GFP_KERNEL, "%pOF", np); | |
| 103 | 103 | if (!pd->name) | |
| 104 | 104 | goto free_pd; | |
| 105 | 105 | ||
| @@ -112,6 +112,7 @@ struct generic_pm_domain *dt_idle_pd_alloc(struct device_node *np, | |||
| 112 | 112 | goto free_name; | |
| 113 | 113 | ||
| 114 | 114 | pd->free_states = pd_free_states; | |
| 115 | + | pd->name = kbasename(pd->name); | |
| 115 | 116 | pd->states = states; | |
| 116 | 117 | pd->state_count = state_count; | |
| 117 | 118 | ||
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/crypto/inside-secure/eip93/eip93-common.c
| @@ -533,7 +533,7 @@ int eip93_send_req(struct crypto_async_request *async, | |||
| 533 | 533 | ||
| 534 | 534 | memcpy(iv, reqiv, rctx->ivsize); | |
| 535 | 535 | ||
| 536 | - | rctx->sa_state = kzalloc_obj(*rctx->sa_state); | |
| 536 | + | rctx->sa_state = kzalloc(sizeof(*rctx->sa_state), GFP_KERNEL); | |
| 537 | 537 | if (!rctx->sa_state) | |
| 538 | 538 | return -ENOMEM; | |
| 539 | 539 | ||
| @@ -561,7 +561,8 @@ int eip93_send_req(struct crypto_async_request *async, | |||
| 561 | 561 | iv[3] = 0xffffffff; | |
| 562 | 562 | crypto_inc((u8 *)iv, AES_BLOCK_SIZE); | |
| 563 | 563 | ||
| 564 | - | rctx->sa_state_ctr = kzalloc_obj(*rctx->sa_state_ctr); | |
| 564 | + | rctx->sa_state_ctr = kzalloc(sizeof(*rctx->sa_state_ctr), | |
| 565 | + | GFP_KERNEL); | |
| 565 | 566 | if (!rctx->sa_state_ctr) { | |
| 566 | 567 | err = -ENOMEM; | |
| 567 | 568 | goto free_sa_state; | |
modified drivers/crypto/intel/qat/qat_common/qat_comp_algs.c
| @@ -59,7 +59,8 @@ static void *qat_zstd_alloc_scratch(void) | |||
| 59 | 59 | if (!scratch->literals) | |
| 60 | 60 | goto error; | |
| 61 | 61 | ||
| 62 | - | scratch->out_seqs = kvzalloc_objs(ZSTD_Sequence, QAT_MAX_SEQUENCES); | |
| 62 | + | scratch->out_seqs = kvcalloc(QAT_MAX_SEQUENCES, sizeof(ZSTD_Sequence), | |
| 63 | + | GFP_KERNEL); | |
| 63 | 64 | if (!scratch->out_seqs) | |
| 64 | 65 | goto error; | |
| 65 | 66 | ||
modified drivers/crypto/ti/dthev2-aes.c
| @@ -387,7 +387,7 @@ static int dthe_aes_run(struct crypto_engine *engine, void *areq) | |||
| 387 | 387 | src_nents++; | |
| 388 | 388 | dst_nents++; | |
| 389 | 389 | ||
| 390 | - | src = kmalloc_objs(*src, src_nents, GFP_ATOMIC); | |
| 390 | + | src = kmalloc_array(src_nents, sizeof(*src), GFP_ATOMIC); | |
| 391 | 391 | if (!src) { | |
| 392 | 392 | ret = -ENOMEM; | |
| 393 | 393 | goto aes_ctr_src_alloc_err; | |
| @@ -399,7 +399,7 @@ static int dthe_aes_run(struct crypto_engine *engine, void *areq) | |||
| 399 | 399 | sg_set_buf(sg, pad_buf, pad_size); | |
| 400 | 400 | ||
| 401 | 401 | if (diff_dst) { | |
| 402 | - | dst = kmalloc_objs(*dst, dst_nents, GFP_ATOMIC); | |
| 402 | + | dst = kmalloc_array(dst_nents, sizeof(*dst), GFP_ATOMIC); | |
| 403 | 403 | if (!dst) { | |
| 404 | 404 | ret = -ENOMEM; | |
| 405 | 405 | goto aes_ctr_dst_alloc_err; | |
| @@ -624,7 +624,7 @@ static struct scatterlist *dthe_aead_prep_aad(struct scatterlist *sg, | |||
| 624 | 624 | if (assoclen % AES_BLOCK_SIZE) | |
| 625 | 625 | aad_nents++; | |
| 626 | 626 | ||
| 627 | - | aad_sg = kmalloc_objs(struct scatterlist, aad_nents, GFP_ATOMIC); | |
| 627 | + | aad_sg = kmalloc_array(aad_nents, sizeof(struct scatterlist), GFP_ATOMIC); | |
| 628 | 628 | if (!aad_sg) | |
| 629 | 629 | return ERR_PTR(-ENOMEM); | |
| 630 | 630 | ||
| @@ -680,7 +680,7 @@ static struct scatterlist *dthe_aead_prep_crypt(struct scatterlist *sg, | |||
| 680 | 680 | if (cryptlen % AES_BLOCK_SIZE) | |
| 681 | 681 | crypt_nents++; | |
| 682 | 682 | ||
| 683 | - | crypt_sg = kmalloc_objs(struct scatterlist, crypt_nents, GFP_ATOMIC); | |
| 683 | + | crypt_sg = kmalloc_array(crypt_nents, sizeof(struct scatterlist), GFP_ATOMIC); | |
| 684 | 684 | if (!crypt_sg) { | |
| 685 | 685 | err = -ENOMEM; | |
| 686 | 686 | goto dthe_aead_prep_crypt_mem_err; | |
modified drivers/devfreq/hisi_uncore_freq.c
| @@ -474,7 +474,7 @@ static int hisi_uncore_mark_related_cpus(struct hisi_uncore_freq *uncore, | |||
| 474 | 474 | return -EINVAL; | |
| 475 | 475 | ||
| 476 | 476 | len = rc; | |
| 477 | - | u32 *num __free(kfree) = kzalloc_objs(*num, len); | |
| 477 | + | u32 *num __free(kfree) = kcalloc(len, sizeof(*num), GFP_KERNEL); | |
| 478 | 478 | if (!num) | |
| 479 | 479 | return -ENOMEM; | |
| 480 | 480 | ||
modified drivers/dibs/dibs_main.c
| @@ -251,19 +251,13 @@ static int __init dibs_init(void) | |||
| 251 | 251 | ||
| 252 | 252 | rc = class_register(&dibs_class); | |
| 253 | 253 | if (rc) | |
| 254 | - | goto err; | |
| 254 | + | return rc; | |
| 255 | 255 | ||
| 256 | 256 | rc = dibs_loopback_init(); | |
| 257 | 257 | if (rc) | |
| 258 | - | goto err_unregister; | |
| 258 | + | pr_err("%s fails with %d\n", __func__, rc); | |
| 259 | 259 | ||
| 260 | 260 | return rc; | |
| 261 | - | ||
| 262 | - | err_unregister: | |
| 263 | - | class_unregister(&dibs_class); | |
| 264 | - | err: | |
| 265 | - | pr_err("%s fails with %d\n", __func__, rc); | |
| 266 | - | return rc; | |
| 267 | 261 | } | |
| 268 | 262 | ||
| 269 | 263 | static void __exit dibs_exit(void) | |
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-buf/dma-buf-mapping.c
| @@ -5,18 +5,16 @@ | |||
| 5 | 5 | */ | |
| 6 | 6 | #include <linux/dma-buf-mapping.h> | |
| 7 | 7 | #include <linux/dma-resv.h> | |
| 8 | - | #include <linux/overflow.h> | |
| 9 | - | #include <linux/align.h> | |
| 10 | - | ||
| 11 | - | #define MAX_SG_ENT_SZ ALIGN_DOWN(UINT_MAX, PAGE_SIZE) | |
| 12 | 8 | ||
| 13 | 9 | static struct scatterlist *fill_sg_entry(struct scatterlist *sgl, size_t length, | |
| 14 | 10 | dma_addr_t addr) | |
| 15 | 11 | { | |
| 16 | - | size_t len; | |
| 12 | + | unsigned int len, nents; | |
| 13 | + | int i; | |
| 17 | 14 | ||
| 18 | - | while (length) { | |
| 19 | - | len = min(length, MAX_SG_ENT_SZ); | |
| 15 | + | nents = DIV_ROUND_UP(length, UINT_MAX); | |
| 16 | + | for (i = 0; i < nents; i++) { | |
| 17 | + | len = min_t(size_t, length, UINT_MAX); | |
| 20 | 18 | length -= len; | |
| 21 | 19 | /* | |
| 22 | 20 | * DMABUF abuses scatterlist to create a scatterlist | |
| @@ -26,10 +24,8 @@ static struct scatterlist *fill_sg_entry(struct scatterlist *sgl, size_t length, | |||
| 26 | 24 | * does not require the CPU list for mapping or unmapping. | |
| 27 | 25 | */ | |
| 28 | 26 | sg_set_page(sgl, NULL, 0, 0); | |
| 29 | - | sg_dma_address(sgl) = addr; | |
| 27 | + | sg_dma_address(sgl) = addr + (dma_addr_t)i * UINT_MAX; | |
| 30 | 28 | sg_dma_len(sgl) = len; | |
| 31 | - | addr += len; | |
| 32 | - | /* Unconditionally advance. On last segment, this becomes NULL */ | |
| 33 | 29 | sgl = sg_next(sgl); | |
| 34 | 30 | } | |
| 35 | 31 | ||
| @@ -44,19 +40,15 @@ static unsigned int calc_sg_nents(struct dma_iova_state *state, | |||
| 44 | 40 | size_t i; | |
| 45 | 41 | ||
| 46 | 42 | if (!state || !dma_use_iova(state)) { | |
| 47 | - | for (i = 0; i < nr_ranges; i++) { | |
| 48 | - | unsigned int added = DIV_ROUND_UP(phys_vec[i].len, MAX_SG_ENT_SZ); | |
| 49 | - | ||
| 50 | - | if (check_add_overflow(nents, added, &nents)) | |
| 51 | - | return 0; | |
| 52 | - | } | |
| 43 | + | for (i = 0; i < nr_ranges; i++) | |
| 44 | + | nents += DIV_ROUND_UP(phys_vec[i].len, UINT_MAX); | |
| 53 | 45 | } else { | |
| 54 | 46 | /* | |
| 55 | 47 | * In IOVA case, there is only one SG entry which spans | |
| 56 | 48 | * for whole IOVA address space, but we need to make sure | |
| 57 | 49 | * that it fits sg->length, maybe we need more. | |
| 58 | 50 | */ | |
| 59 | - | nents = DIV_ROUND_UP(size, MAX_SG_ENT_SZ); | |
| 51 | + | nents = DIV_ROUND_UP(size, UINT_MAX); | |
| 60 | 52 | } | |
| 61 | 53 | ||
| 62 | 54 | return nents; | |
| @@ -103,10 +95,9 @@ struct sg_table *dma_buf_phys_vec_to_sgt(struct dma_buf_attachment *attach, | |||
| 103 | 95 | size_t nr_ranges, size_t size, | |
| 104 | 96 | enum dma_data_direction dir) | |
| 105 | 97 | { | |
| 98 | + | unsigned int nents, mapped_len = 0; | |
| 106 | 99 | struct dma_buf_dma *dma; | |
| 107 | 100 | struct scatterlist *sgl; | |
| 108 | - | size_t mapped_len = 0; | |
| 109 | - | unsigned int nents; | |
| 110 | 101 | dma_addr_t addr; | |
| 111 | 102 | size_t i; | |
| 112 | 103 | int ret; | |
| @@ -142,8 +133,6 @@ struct sg_table *dma_buf_phys_vec_to_sgt(struct dma_buf_attachment *attach, | |||
| 142 | 133 | } | |
| 143 | 134 | ||
| 144 | 135 | nents = calc_sg_nents(dma->state, phys_vec, nr_ranges, size); | |
| 145 | - | ||
| 146 | - | /* sg_alloc_table will cleanly fail and return -EINVAL if nents == 0 */ | |
| 147 | 136 | ret = sg_alloc_table(&dma->sgt, nents, GFP_KERNEL | __GFP_ZERO); | |
| 148 | 137 | if (ret) | |
| 149 | 138 | goto err_free_state; | |
modified drivers/dma-buf/dma-buf.c
| @@ -803,26 +803,6 @@ int dma_buf_fd(struct dma_buf *dmabuf, int flags) | |||
| 803 | 803 | } | |
| 804 | 804 | EXPORT_SYMBOL_NS_GPL(dma_buf_fd, "DMA_BUF"); | |
| 805 | 805 | ||
| 806 | - | /** | |
| 807 | - | * dma_buf_fd_install - install a reserved fd for a dma-buf | |
| 808 | - | * @dmabuf: [in] pointer to dma_buf | |
| 809 | - | * @fd: [in] fd reserved with get_unused_fd_flags() | |
| 810 | - | * | |
| 811 | - | * Publishes a previously reserved fd into the caller's fd table. | |
| 812 | - | * Must only be called after all fallible work (e.g. copy_to_user) | |
| 813 | - | * has succeeded, as it cannot be undone safely once called. | |
| 814 | - | * | |
| 815 | - | * The caller is responsible for having emitted the trace event | |
| 816 | - | * (via dma_buf_fd() or get_unused_fd_flags() + this function) | |
| 817 | - | * before calling this. | |
| 818 | - | */ | |
| 819 | - | void dma_buf_fd_install(struct dma_buf *dmabuf, int fd) | |
| 820 | - | { | |
| 821 | - | DMA_BUF_TRACE(trace_dma_buf_fd, dmabuf, fd); | |
| 822 | - | fd_install(fd, dmabuf->file); | |
| 823 | - | } | |
| 824 | - | EXPORT_SYMBOL_NS_GPL(dma_buf_fd_install, "DMA_BUF"); | |
| 825 | - | ||
| 826 | 806 | /** | |
| 827 | 807 | * dma_buf_get - returns the struct dma_buf related to an fd | |
| 828 | 808 | * @fd: [in] fd associated with the struct dma_buf to be returned | |
modified drivers/dma-buf/dma-fence.c
| @@ -1170,12 +1170,7 @@ const char __rcu *dma_fence_driver_name(struct dma_fence *fence) | |||
| 1170 | 1170 | ||
| 1171 | 1171 | /* RCU protection is required for safe access to returned string */ | |
| 1172 | 1172 | ops = rcu_dereference(fence->ops); | |
| 1173 | - | ||
| 1174 | - | /* | |
| 1175 | - | * Make load ordering irrelevant by checking both signaled state and ops | |
| 1176 | - | * pointer and ops pointer is only set to NULL on newer implementations. | |
| 1177 | - | */ | |
| 1178 | - | if (!dma_fence_test_signaled_flag(fence) && ops) | |
| 1173 | + | if (ops) | |
| 1179 | 1174 | return (const char __rcu *)ops->get_driver_name(fence); | |
| 1180 | 1175 | else | |
| 1181 | 1176 | return (const char __rcu *)"detached-driver"; | |
| @@ -1208,12 +1203,7 @@ const char __rcu *dma_fence_timeline_name(struct dma_fence *fence) | |||
| 1208 | 1203 | ||
| 1209 | 1204 | /* RCU protection is required for safe access to returned string */ | |
| 1210 | 1205 | ops = rcu_dereference(fence->ops); | |
| 1211 | - | ||
| 1212 | - | /* | |
| 1213 | - | * Make load ordering irrelevant by checking both signaled state and ops | |
| 1214 | - | * pointer and ops pointer is only set to NULL on newer implementations. | |
| 1215 | - | */ | |
| 1216 | - | if (!dma_fence_test_signaled_flag(fence) && ops) | |
| 1206 | + | if (ops) | |
| 1217 | 1207 | return (const char __rcu *)ops->get_timeline_name(fence); | |
| 1218 | 1208 | else | |
| 1219 | 1209 | return (const char __rcu *)"signaled-timeline"; | |
modified drivers/dma-buf/dma-heap.c
| @@ -56,6 +56,33 @@ MODULE_PARM_DESC(mem_accounting, | |||
| 56 | 56 | "Enable cgroup-based memory accounting for dma-buf heap allocations (default=false)."); | |
| 57 | 57 | EXPORT_SYMBOL_NS_GPL(mem_accounting, "DMA_BUF_HEAP"); | |
| 58 | 58 | ||
| 59 | + | static int dma_heap_buffer_alloc(struct dma_heap *heap, size_t len, | |
| 60 | + | u32 fd_flags, | |
| 61 | + | u64 heap_flags) | |
| 62 | + | { | |
| 63 | + | struct dma_buf *dmabuf; | |
| 64 | + | int fd; | |
| 65 | + | ||
| 66 | + | /* | |
| 67 | + | * Allocations from all heaps have to begin | |
| 68 | + | * and end on page boundaries. | |
| 69 | + | */ | |
| 70 | + | len = PAGE_ALIGN(len); | |
| 71 | + | if (!len) | |
| 72 | + | return -EINVAL; | |
| 73 | + | ||
| 74 | + | dmabuf = heap->ops->allocate(heap, len, fd_flags, heap_flags); | |
| 75 | + | if (IS_ERR(dmabuf)) | |
| 76 | + | return PTR_ERR(dmabuf); | |
| 77 | + | ||
| 78 | + | fd = dma_buf_fd(dmabuf, fd_flags); | |
| 79 | + | if (fd < 0) { | |
| 80 | + | dma_buf_put(dmabuf); | |
| 81 | + | /* just return, as put will call release and that will free */ | |
| 82 | + | } | |
| 83 | + | return fd; | |
| 84 | + | } | |
| 85 | + | ||
| 59 | 86 | static int dma_heap_open(struct inode *inode, struct file *file) | |
| 60 | 87 | { | |
| 61 | 88 | struct dma_heap *heap; | |
| @@ -73,42 +100,30 @@ static int dma_heap_open(struct inode *inode, struct file *file) | |||
| 73 | 100 | return 0; | |
| 74 | 101 | } | |
| 75 | 102 | ||
| 76 | - | static struct dma_buf *dma_heap_ioctl_allocate(struct file *file, void *data) | |
| 103 | + | static long dma_heap_ioctl_allocate(struct file *file, void *data) | |
| 77 | 104 | { | |
| 78 | 105 | struct dma_heap_allocation_data *heap_allocation = data; | |
| 79 | 106 | struct dma_heap *heap = file->private_data; | |
| 80 | - | struct dma_buf *dmabuf; | |
| 81 | 107 | int fd; | |
| 82 | - | size_t len; | |
| 83 | 108 | ||
| 84 | 109 | if (heap_allocation->fd) | |
| 85 | - | return ERR_PTR(-EINVAL); | |
| 110 | + | return -EINVAL; | |
| 86 | 111 | ||
| 87 | 112 | if (heap_allocation->fd_flags & ~DMA_HEAP_VALID_FD_FLAGS) | |
| 88 | - | return ERR_PTR(-EINVAL); | |
| 113 | + | return -EINVAL; | |
| 89 | 114 | ||
| 90 | 115 | if (heap_allocation->heap_flags & ~DMA_HEAP_VALID_HEAP_FLAGS) | |
| 91 | - | return ERR_PTR(-EINVAL); | |
| 92 | - | ||
| 93 | - | len = PAGE_ALIGN(heap_allocation->len); | |
| 94 | - | if (!len) | |
| 95 | - | return ERR_PTR(-EINVAL); | |
| 96 | - | ||
| 97 | - | dmabuf = heap->ops->allocate(heap, len, heap_allocation->fd_flags, | |
| 98 | - | heap_allocation->heap_flags); | |
| 99 | - | ||
| 100 | - | if (IS_ERR(dmabuf)) | |
| 101 | - | return dmabuf; | |
| 116 | + | return -EINVAL; | |
| 102 | 117 | ||
| 103 | - | fd = get_unused_fd_flags(heap_allocation->fd_flags); | |
| 104 | - | if (fd < 0) { | |
| 105 | - | dma_buf_put(dmabuf); | |
| 106 | - | return ERR_PTR(fd); | |
| 107 | - | } | |
| 118 | + | fd = dma_heap_buffer_alloc(heap, heap_allocation->len, | |
| 119 | + | heap_allocation->fd_flags, | |
| 120 | + | heap_allocation->heap_flags); | |
| 121 | + | if (fd < 0) | |
| 122 | + | return fd; | |
| 108 | 123 | ||
| 109 | 124 | heap_allocation->fd = fd; | |
| 110 | 125 | ||
| 111 | - | return dmabuf; | |
| 126 | + | return 0; | |
| 112 | 127 | } | |
| 113 | 128 | ||
| 114 | 129 | static unsigned int dma_heap_ioctl_cmds[] = { | |
| @@ -124,8 +139,6 @@ static long dma_heap_ioctl(struct file *file, unsigned int ucmd, | |||
| 124 | 139 | unsigned int in_size, out_size, drv_size, ksize; | |
| 125 | 140 | int nr = _IOC_NR(ucmd); | |
| 126 | 141 | int ret = 0; | |
| 127 | - | int fd; | |
| 128 | - | struct dma_buf *dmabuf; | |
| 129 | 142 | ||
| 130 | 143 | if (nr >= ARRAY_SIZE(dma_heap_ioctl_cmds)) | |
| 131 | 144 | return -EINVAL; | |
| @@ -162,28 +175,15 @@ static long dma_heap_ioctl(struct file *file, unsigned int ucmd, | |||
| 162 | 175 | ||
| 163 | 176 | switch (kcmd) { | |
| 164 | 177 | case DMA_HEAP_IOCTL_ALLOC: | |
| 165 | - | dmabuf = dma_heap_ioctl_allocate(file, kdata); | |
| 166 | - | ||
| 167 | - | if (IS_ERR(dmabuf)) { | |
| 168 | - | ret = PTR_ERR(dmabuf); | |
| 169 | - | break; | |
| 170 | - | } | |
| 171 | - | ||
| 172 | - | fd = ((struct dma_heap_allocation_data *)kdata)->fd; | |
| 173 | - | if (copy_to_user((void __user *)arg, kdata, out_size) != 0) { | |
| 174 | - | put_unused_fd(fd); | |
| 175 | - | dma_buf_put(dmabuf); | |
| 176 | - | ret = -EFAULT; | |
| 177 | - | } else { | |
| 178 | - | dma_buf_fd_install(dmabuf, fd); | |
| 179 | - | } | |
| 180 | - | ||
| 178 | + | ret = dma_heap_ioctl_allocate(file, kdata); | |
| 181 | 179 | break; | |
| 182 | 180 | default: | |
| 183 | 181 | ret = -ENOTTY; | |
| 184 | 182 | goto err; | |
| 185 | 183 | } | |
| 186 | 184 | ||
| 185 | + | if (copy_to_user((void __user *)arg, kdata, out_size) != 0) | |
| 186 | + | ret = -EFAULT; | |
| 187 | 187 | err: | |
| 188 | 188 | if (kdata != stack_kdata) | |
| 189 | 189 | kfree(kdata); | |
modified drivers/dma-buf/st-dma-fence.c
| @@ -27,7 +27,7 @@ static struct dma_fence *mock_fence(void) | |||
| 27 | 27 | { | |
| 28 | 28 | struct dma_fence *f; | |
| 29 | 29 | ||
| 30 | - | f = kmalloc_obj(*f); | |
| 30 | + | f = kmalloc(sizeof(*f), GFP_KERNEL); | |
| 31 | 31 | if (!f) | |
| 32 | 32 | return NULL; | |
| 33 | 33 | ||
modified drivers/dma-buf/udmabuf.c
| @@ -359,7 +359,7 @@ static long udmabuf_create(struct miscdevice *device, | |||
| 359 | 359 | long ret = -EINVAL; | |
| 360 | 360 | u32 i, flags; | |
| 361 | 361 | ||
| 362 | - | ubuf = kzalloc_obj(*ubuf); | |
| 362 | + | ubuf = kzalloc(sizeof(*ubuf), GFP_KERNEL); | |
| 363 | 363 | if (!ubuf) | |
| 364 | 364 | return -ENOMEM; | |
| 365 | 365 | ||
| @@ -387,7 +387,7 @@ static long udmabuf_create(struct miscdevice *device, | |||
| 387 | 387 | if (ret) | |
| 388 | 388 | goto err; | |
| 389 | 389 | ||
| 390 | - | folios = kvmalloc_objs(*folios, max_nr_folios); | |
| 390 | + | folios = kvmalloc_array(max_nr_folios, sizeof(*folios), GFP_KERNEL); | |
| 391 | 391 | if (!folios) { | |
| 392 | 392 | ret = -ENOMEM; | |
| 393 | 393 | goto err; | |
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/switchtec_dma.c
| @@ -1056,7 +1056,7 @@ static int switchtec_dma_chan_init(struct switchtec_dma_dev *swdma_dev, | |||
| 1056 | 1056 | int se_buf_len, irq, rc; | |
| 1057 | 1057 | struct dma_chan *chan; | |
| 1058 | 1058 | ||
| 1059 | - | swdma_chan = kzalloc_obj(*swdma_chan); | |
| 1059 | + | swdma_chan = kzalloc_obj(*swdma_chan, GFP_KERNEL); | |
| 1060 | 1060 | if (!swdma_chan) | |
| 1061 | 1061 | return -ENOMEM; | |
| 1062 | 1062 | ||
| @@ -1162,7 +1162,8 @@ static int switchtec_dma_chans_enumerate(struct switchtec_dma_dev *swdma_dev, | |||
| 1162 | 1162 | struct dma_device *dma = &swdma_dev->dma_dev; | |
| 1163 | 1163 | int base, cnt, rc, i; | |
| 1164 | 1164 | ||
| 1165 | - | swdma_dev->swdma_chans = kzalloc_objs(*swdma_dev->swdma_chans, chan_cnt); | |
| 1165 | + | swdma_dev->swdma_chans = kcalloc(chan_cnt, sizeof(*swdma_dev->swdma_chans), | |
| 1166 | + | GFP_KERNEL); | |
| 1166 | 1167 | ||
| 1167 | 1168 | if (!swdma_dev->swdma_chans) | |
| 1168 | 1169 | return -ENOMEM; | |
| @@ -1221,7 +1222,7 @@ static int switchtec_dma_create(struct pci_dev *pdev) | |||
| 1221 | 1222 | /* | |
| 1222 | 1223 | * Create the switchtec dma device | |
| 1223 | 1224 | */ | |
| 1224 | - | swdma_dev = kzalloc_obj(*swdma_dev); | |
| 1225 | + | swdma_dev = kzalloc_obj(*swdma_dev, GFP_KERNEL); | |
| 1225 | 1226 | if (!swdma_dev) | |
| 1226 | 1227 | return -ENOMEM; | |
| 1227 | 1228 | ||
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/edac/al_mc_edac.c
| @@ -302,8 +302,12 @@ static int al_mc_edac_probe(struct platform_device *pdev) | |||
| 302 | 302 | IRQF_SHARED, | |
| 303 | 303 | pdev->name, | |
| 304 | 304 | pdev); | |
| 305 | - | if (ret != 0) | |
| 305 | + | if (ret != 0) { | |
| 306 | + | dev_err(&pdev->dev, | |
| 307 | + | "failed to request UE IRQ %d (%d)\n", | |
| 308 | + | al_mc->irq_ue, ret); | |
| 306 | 309 | return ret; | |
| 310 | + | } | |
| 307 | 311 | } | |
| 308 | 312 | ||
| 309 | 313 | if (al_mc->irq_ce > 0) { | |
| @@ -313,8 +317,12 @@ static int al_mc_edac_probe(struct platform_device *pdev) | |||
| 313 | 317 | IRQF_SHARED, | |
| 314 | 318 | pdev->name, | |
| 315 | 319 | pdev); | |
| 316 | - | if (ret != 0) | |
| 320 | + | if (ret != 0) { | |
| 321 | + | dev_err(&pdev->dev, | |
| 322 | + | "failed to request CE IRQ %d (%d)\n", | |
| 323 | + | al_mc->irq_ce, ret); | |
| 317 | 324 | return ret; | |
| 325 | + | } | |
| 318 | 326 | } | |
| 319 | 327 | ||
| 320 | 328 | return 0; | |
modified drivers/edac/altera_edac.c
| @@ -453,6 +453,15 @@ free: | |||
| 453 | 453 | return res; | |
| 454 | 454 | } | |
| 455 | 455 | ||
| 456 | + | static void altr_sdram_remove(struct platform_device *pdev) | |
| 457 | + | { | |
| 458 | + | struct mem_ctl_info *mci = platform_get_drvdata(pdev); | |
| 459 | + | ||
| 460 | + | edac_mc_del_mc(&pdev->dev); | |
| 461 | + | edac_mc_free(mci); | |
| 462 | + | platform_set_drvdata(pdev, NULL); | |
| 463 | + | } | |
| 464 | + | ||
| 456 | 465 | /* | |
| 457 | 466 | * If you want to suspend, need to disable EDAC by removing it | |
| 458 | 467 | * from the device tree or defconfig. | |
| @@ -472,13 +481,13 @@ static const struct dev_pm_ops altr_sdram_pm_ops = { | |||
| 472 | 481 | ||
| 473 | 482 | static struct platform_driver altr_sdram_edac_driver = { | |
| 474 | 483 | .probe = altr_sdram_probe, | |
| 484 | + | .remove = altr_sdram_remove, | |
| 475 | 485 | .driver = { | |
| 476 | 486 | .name = "altr_sdram_edac", | |
| 477 | 487 | #ifdef CONFIG_PM | |
| 478 | 488 | .pm = &altr_sdram_pm_ops, | |
| 479 | 489 | #endif | |
| 480 | 490 | .of_match_table = altr_sdram_ctrl_of_match, | |
| 481 | - | .suppress_bind_attrs = true, | |
| 482 | 491 | }, | |
| 483 | 492 | }; | |
| 484 | 493 | ||
| @@ -508,7 +517,6 @@ static struct platform_driver altr_edac_driver = { | |||
| 508 | 517 | .driver = { | |
| 509 | 518 | .name = "socfpga_ecc_manager", | |
| 510 | 519 | .of_match_table = altr_edac_of_match, | |
| 511 | - | .suppress_bind_attrs = true, | |
| 512 | 520 | }, | |
| 513 | 521 | }; | |
| 514 | 522 | module_platform_driver(altr_edac_driver); | |
| @@ -795,12 +803,22 @@ fail: | |||
| 795 | 803 | return res; | |
| 796 | 804 | } | |
| 797 | 805 | ||
| 806 | + | static void altr_edac_device_remove(struct platform_device *pdev) | |
| 807 | + | { | |
| 808 | + | struct edac_device_ctl_info *dci = platform_get_drvdata(pdev); | |
| 809 | + | struct altr_edac_device_dev *drvdata = dci->pvt_info; | |
| 810 | + | ||
| 811 | + | debugfs_remove_recursive(drvdata->debugfs_dir); | |
| 812 | + | edac_device_del_device(&pdev->dev); | |
| 813 | + | edac_device_free_ctl_info(dci); | |
| 814 | + | } | |
| 815 | + | ||
| 798 | 816 | static struct platform_driver altr_edac_device_driver = { | |
| 799 | 817 | .probe = altr_edac_device_probe, | |
| 818 | + | .remove = altr_edac_device_remove, | |
| 800 | 819 | .driver = { | |
| 801 | 820 | .name = "altr_edac_device", | |
| 802 | 821 | .of_match_table = altr_edac_device_of_match, | |
| 803 | - | .suppress_bind_attrs = true, | |
| 804 | 822 | }, | |
| 805 | 823 | }; | |
| 806 | 824 | module_platform_driver(altr_edac_device_driver); | |
| @@ -926,7 +944,7 @@ static int __maybe_unused altr_init_memory_port(void __iomem *ioaddr, int port) | |||
| 926 | 944 | return ret; | |
| 927 | 945 | } | |
| 928 | 946 | ||
| 929 | - | static int __maybe_unused | |
| 947 | + | static __init int __maybe_unused | |
| 930 | 948 | altr_init_a10_ecc_block(struct device_node *np, u32 irq_mask, | |
| 931 | 949 | u32 ecc_ctrl_en_mask, bool dual_port) | |
| 932 | 950 | { | |
| @@ -1001,7 +1019,7 @@ out: | |||
| 1001 | 1019 | ||
| 1002 | 1020 | static int validate_parent_available(struct device_node *np); | |
| 1003 | 1021 | static const struct of_device_id altr_edac_a10_device_of_match[]; | |
| 1004 | - | static int __maybe_unused altr_init_a10_ecc_device_type(char *compat) | |
| 1022 | + | static int __init __maybe_unused altr_init_a10_ecc_device_type(char *compat) | |
| 1005 | 1023 | { | |
| 1006 | 1024 | int irq; | |
| 1007 | 1025 | struct device_node *child, *np; | |
| @@ -1330,7 +1348,7 @@ static const struct edac_device_prv_data a10_l2ecc_data = { | |||
| 1330 | 1348 | ||
| 1331 | 1349 | #ifdef CONFIG_EDAC_ALTERA_ETHERNET | |
| 1332 | 1350 | ||
| 1333 | - | static int socfpga_init_ethernet_ecc(struct altr_edac_device_dev *dev) | |
| 1351 | + | static int __init socfpga_init_ethernet_ecc(struct altr_edac_device_dev *dev) | |
| 1334 | 1352 | { | |
| 1335 | 1353 | int ret; | |
| 1336 | 1354 | ||
| @@ -1360,7 +1378,7 @@ static const struct edac_device_prv_data a10_enetecc_data = { | |||
| 1360 | 1378 | ||
| 1361 | 1379 | #ifdef CONFIG_EDAC_ALTERA_NAND | |
| 1362 | 1380 | ||
| 1363 | - | static int socfpga_init_nand_ecc(struct altr_edac_device_dev *device) | |
| 1381 | + | static int __init socfpga_init_nand_ecc(struct altr_edac_device_dev *device) | |
| 1364 | 1382 | { | |
| 1365 | 1383 | int ret; | |
| 1366 | 1384 | ||
| @@ -1390,7 +1408,7 @@ static const struct edac_device_prv_data a10_nandecc_data = { | |||
| 1390 | 1408 | ||
| 1391 | 1409 | #ifdef CONFIG_EDAC_ALTERA_DMA | |
| 1392 | 1410 | ||
| 1393 | - | static int socfpga_init_dma_ecc(struct altr_edac_device_dev *device) | |
| 1411 | + | static int __init socfpga_init_dma_ecc(struct altr_edac_device_dev *device) | |
| 1394 | 1412 | { | |
| 1395 | 1413 | int ret; | |
| 1396 | 1414 | ||
| @@ -1420,7 +1438,7 @@ static const struct edac_device_prv_data a10_dmaecc_data = { | |||
| 1420 | 1438 | ||
| 1421 | 1439 | #ifdef CONFIG_EDAC_ALTERA_USB | |
| 1422 | 1440 | ||
| 1423 | - | static int socfpga_init_usb_ecc(struct altr_edac_device_dev *device) | |
| 1441 | + | static int __init socfpga_init_usb_ecc(struct altr_edac_device_dev *device) | |
| 1424 | 1442 | { | |
| 1425 | 1443 | int ret; | |
| 1426 | 1444 | ||
| @@ -1450,7 +1468,7 @@ static const struct edac_device_prv_data a10_usbecc_data = { | |||
| 1450 | 1468 | ||
| 1451 | 1469 | #ifdef CONFIG_EDAC_ALTERA_QSPI | |
| 1452 | 1470 | ||
| 1453 | - | static int socfpga_init_qspi_ecc(struct altr_edac_device_dev *device) | |
| 1471 | + | static int __init socfpga_init_qspi_ecc(struct altr_edac_device_dev *device) | |
| 1454 | 1472 | { | |
| 1455 | 1473 | int ret; | |
| 1456 | 1474 | ||
| @@ -1489,7 +1507,6 @@ static int altr_portb_setup(struct altr_edac_device_dev *device) | |||
| 1489 | 1507 | int edac_idx, rc; | |
| 1490 | 1508 | struct device_node *np; | |
| 1491 | 1509 | const struct edac_device_prv_data *prv = &a10_sdmmceccb_data; | |
| 1492 | - | bool is_s10 = device->edac->is_s10; | |
| 1493 | 1510 | ||
| 1494 | 1511 | rc = altr_check_ecc_deps(device); | |
| 1495 | 1512 | if (rc) | |
| @@ -1506,7 +1523,6 @@ static int altr_portb_setup(struct altr_edac_device_dev *device) | |||
| 1506 | 1523 | dci = edac_device_alloc_ctl_info(sizeof(*altdev), ecc_name, 1, | |
| 1507 | 1524 | ecc_name, 1, 0, edac_idx); | |
| 1508 | 1525 | if (!dci) { | |
| 1509 | - | of_node_put(np); | |
| 1510 | 1526 | edac_printk(KERN_ERR, EDAC_DEVICE, | |
| 1511 | 1527 | "%s: Unable to allocate PortB EDAC device\n", | |
| 1512 | 1528 | ecc_name); | |
| @@ -1517,11 +1533,8 @@ static int altr_portb_setup(struct altr_edac_device_dev *device) | |||
| 1517 | 1533 | altdev = dci->pvt_info; | |
| 1518 | 1534 | *altdev = *device; | |
| 1519 | 1535 | ||
| 1520 | - | if (!devres_open_group(device->edac->dev, altr_portb_setup, GFP_KERNEL)) { | |
| 1521 | - | edac_device_free_ctl_info(dci); | |
| 1522 | - | of_node_put(np); | |
| 1536 | + | if (!devres_open_group(&altdev->ddev, altr_portb_setup, GFP_KERNEL)) | |
| 1523 | 1537 | return -ENOMEM; | |
| 1524 | - | } | |
| 1525 | 1538 | ||
| 1526 | 1539 | /* Update PortB specific values */ | |
| 1527 | 1540 | altdev->edac_dev_name = ecc_name; | |
| @@ -1535,20 +1548,21 @@ static int altr_portb_setup(struct altr_edac_device_dev *device) | |||
| 1535 | 1548 | ||
| 1536 | 1549 | /* | |
| 1537 | 1550 | * Update the PortB IRQs - A10 has 4, S10 has 2, Index accordingly | |
| 1551 | + | * | |
| 1552 | + | * FIXME: Instead of ifdefs with different architectures the driver | |
| 1553 | + | * should properly use compatibles. | |
| 1538 | 1554 | */ | |
| 1539 | - | ||
| 1540 | - | /* Using compatibles to determine the IRQ Index */ | |
| 1541 | - | if (is_s10) | |
| 1542 | - | altdev->sb_irq = irq_of_parse_and_map(np, 1); | |
| 1543 | - | else | |
| 1544 | - | altdev->sb_irq = irq_of_parse_and_map(np, 2); | |
| 1545 | - | ||
| 1555 | + | #ifdef CONFIG_64BIT | |
| 1556 | + | altdev->sb_irq = irq_of_parse_and_map(np, 1); | |
| 1557 | + | #else | |
| 1558 | + | altdev->sb_irq = irq_of_parse_and_map(np, 2); | |
| 1559 | + | #endif | |
| 1546 | 1560 | if (!altdev->sb_irq) { | |
| 1547 | 1561 | edac_printk(KERN_ERR, EDAC_DEVICE, "Error PortB SBIRQ alloc\n"); | |
| 1548 | 1562 | rc = -ENODEV; | |
| 1549 | 1563 | goto err_release_group_1; | |
| 1550 | 1564 | } | |
| 1551 | - | rc = devm_request_irq(device->edac->dev, altdev->sb_irq, | |
| 1565 | + | rc = devm_request_irq(&altdev->ddev, altdev->sb_irq, | |
| 1552 | 1566 | prv->ecc_irq_handler, IRQF_TRIGGER_HIGH, | |
| 1553 | 1567 | ecc_name, altdev); | |
| 1554 | 1568 | if (rc) { | |
| @@ -1556,28 +1570,29 @@ static int altr_portb_setup(struct altr_edac_device_dev *device) | |||
| 1556 | 1570 | goto err_release_group_1; | |
| 1557 | 1571 | } | |
| 1558 | 1572 | ||
| 1559 | - | if (is_s10) { | |
| 1560 | - | /* Use IRQ to determine SError origin instead of assigning IRQ */ | |
| 1561 | - | rc = of_property_read_u32_index(np, "interrupts", 1, &altdev->db_irq); | |
| 1562 | - | if (rc) { | |
| 1563 | - | edac_printk(KERN_ERR, EDAC_DEVICE, "Error PortB DBIRQ alloc\n"); | |
| 1564 | - | goto err_release_group_1; | |
| 1565 | - | } | |
| 1566 | - | } else { | |
| 1567 | - | altdev->db_irq = irq_of_parse_and_map(np, 3); | |
| 1568 | - | if (!altdev->db_irq) { | |
| 1569 | - | edac_printk(KERN_ERR, EDAC_DEVICE, "Error PortB DBIRQ alloc\n"); | |
| 1570 | - | rc = -ENODEV; | |
| 1571 | - | goto err_release_group_1; | |
| 1572 | - | } | |
| 1573 | - | rc = devm_request_irq(device->edac->dev, altdev->db_irq, | |
| 1574 | - | prv->ecc_irq_handler, IRQF_TRIGGER_HIGH, | |
| 1575 | - | ecc_name, altdev); | |
| 1576 | - | if (rc) { | |
| 1577 | - | edac_printk(KERN_ERR, EDAC_DEVICE, "PortB DBERR IRQ error\n"); | |
| 1578 | - | goto err_release_group_1; | |
| 1579 | - | } | |
| 1573 | + | #ifdef CONFIG_64BIT | |
| 1574 | + | /* Use IRQ to determine SError origin instead of assigning IRQ */ | |
| 1575 | + | rc = of_property_read_u32_index(np, "interrupts", 1, &altdev->db_irq); | |
| 1576 | + | if (rc) { | |
| 1577 | + | edac_printk(KERN_ERR, EDAC_DEVICE, | |
| 1578 | + | "Error PortB DBIRQ alloc\n"); | |
| 1579 | + | goto err_release_group_1; | |
| 1580 | 1580 | } | |
| 1581 | + | #else | |
| 1582 | + | altdev->db_irq = irq_of_parse_and_map(np, 3); | |
| 1583 | + | if (!altdev->db_irq) { | |
| 1584 | + | edac_printk(KERN_ERR, EDAC_DEVICE, "Error PortB DBIRQ alloc\n"); | |
| 1585 | + | rc = -ENODEV; | |
| 1586 | + | goto err_release_group_1; | |
| 1587 | + | } | |
| 1588 | + | rc = devm_request_irq(&altdev->ddev, altdev->db_irq, | |
| 1589 | + | prv->ecc_irq_handler, IRQF_TRIGGER_HIGH, | |
| 1590 | + | ecc_name, altdev); | |
| 1591 | + | if (rc) { | |
| 1592 | + | edac_printk(KERN_ERR, EDAC_DEVICE, "PortB DBERR IRQ error\n"); | |
| 1593 | + | goto err_release_group_1; | |
| 1594 | + | } | |
| 1595 | + | #endif | |
| 1581 | 1596 | ||
| 1582 | 1597 | rc = edac_device_add_device(dci); | |
| 1583 | 1598 | if (rc) { | |
| @@ -1586,31 +1601,23 @@ static int altr_portb_setup(struct altr_edac_device_dev *device) | |||
| 1586 | 1601 | rc = -ENOMEM; | |
| 1587 | 1602 | goto err_release_group_1; | |
| 1588 | 1603 | } | |
| 1589 | - | of_node_put(np); | |
| 1590 | - | ||
| 1591 | 1604 | altr_create_edacdev_dbgfs(dci, prv); | |
| 1592 | 1605 | ||
| 1593 | 1606 | list_add(&altdev->next, &altdev->edac->a10_ecc_devices); | |
| 1594 | 1607 | ||
| 1595 | - | devres_remove_group(device->edac->dev, altr_portb_setup); | |
| 1608 | + | devres_remove_group(&altdev->ddev, altr_portb_setup); | |
| 1596 | 1609 | ||
| 1597 | 1610 | return 0; | |
| 1598 | 1611 | ||
| 1599 | 1612 | err_release_group_1: | |
| 1600 | - | /* | |
| 1601 | - | * Release the devres group first so the managed IRQs are | |
| 1602 | - | * unregistered before dci (which contains the IRQ handler's | |
| 1603 | - | * data via dci->pvt_info) is freed, avoiding a use-after-free. | |
| 1604 | - | */ | |
| 1605 | - | devres_release_group(device->edac->dev, altr_portb_setup); | |
| 1606 | 1613 | edac_device_free_ctl_info(dci); | |
| 1607 | - | of_node_put(np); | |
| 1614 | + | devres_release_group(&altdev->ddev, altr_portb_setup); | |
| 1608 | 1615 | edac_printk(KERN_ERR, EDAC_DEVICE, | |
| 1609 | 1616 | "%s:Error setting up EDAC device: %d\n", ecc_name, rc); | |
| 1610 | 1617 | return rc; | |
| 1611 | 1618 | } | |
| 1612 | 1619 | ||
| 1613 | - | static int socfpga_init_sdmmc_ecc(struct altr_edac_device_dev *device) | |
| 1620 | + | static int __init socfpga_init_sdmmc_ecc(struct altr_edac_device_dev *device) | |
| 1614 | 1621 | { | |
| 1615 | 1622 | int rc = -ENODEV; | |
| 1616 | 1623 | struct device_node *child; | |
| @@ -1632,7 +1639,7 @@ static int socfpga_init_sdmmc_ecc(struct altr_edac_device_dev *device) | |||
| 1632 | 1639 | goto exit; | |
| 1633 | 1640 | ||
| 1634 | 1641 | /* Setup portB */ | |
| 1635 | - | rc = altr_portb_setup(device); | |
| 1642 | + | return altr_portb_setup(device); | |
| 1636 | 1643 | ||
| 1637 | 1644 | exit: | |
| 1638 | 1645 | of_node_put(child); | |
| @@ -1967,29 +1974,29 @@ static int altr_edac_a10_device_add(struct altr_arria10_edac *edac, | |||
| 1967 | 1974 | goto err_release_group1; | |
| 1968 | 1975 | } | |
| 1969 | 1976 | ||
| 1970 | - | if (edac->is_s10) { | |
| 1971 | - | /* Use IRQ to determine SError origin instead of assigning IRQ */ | |
| 1972 | - | rc = of_property_read_u32_index(np, "interrupts", 0, &altdev->db_irq); | |
| 1973 | - | if (rc) { | |
| 1974 | - | edac_printk(KERN_ERR, EDAC_DEVICE, | |
| 1975 | - | "Unable to parse DB IRQ index\n"); | |
| 1976 | - | goto err_release_group1; | |
| 1977 | - | } | |
| 1978 | - | } else { | |
| 1979 | - | altdev->db_irq = irq_of_parse_and_map(np, 1); | |
| 1980 | - | if (!altdev->db_irq) { | |
| 1981 | - | edac_printk(KERN_ERR, EDAC_DEVICE, "Error allocating DBIRQ\n"); | |
| 1982 | - | rc = -ENODEV; | |
| 1983 | - | goto err_release_group1; | |
| 1984 | - | } | |
| 1985 | - | rc = devm_request_irq(edac->dev, altdev->db_irq, prv->ecc_irq_handler, | |
| 1986 | - | IRQF_TRIGGER_HIGH, | |
| 1987 | - | ecc_name, altdev); | |
| 1988 | - | if (rc) { | |
| 1989 | - | edac_printk(KERN_ERR, EDAC_DEVICE, "No DBERR IRQ resource\n"); | |
| 1990 | - | goto err_release_group1; | |
| 1991 | - | } | |
| 1977 | + | #ifdef CONFIG_64BIT | |
| 1978 | + | /* Use IRQ to determine SError origin instead of assigning IRQ */ | |
| 1979 | + | rc = of_property_read_u32_index(np, "interrupts", 0, &altdev->db_irq); | |
| 1980 | + | if (rc) { | |
| 1981 | + | edac_printk(KERN_ERR, EDAC_DEVICE, | |
| 1982 | + | "Unable to parse DB IRQ index\n"); | |
| 1983 | + | goto err_release_group1; | |
| 1984 | + | } | |
| 1985 | + | #else | |
| 1986 | + | altdev->db_irq = irq_of_parse_and_map(np, 1); | |
| 1987 | + | if (!altdev->db_irq) { | |
| 1988 | + | edac_printk(KERN_ERR, EDAC_DEVICE, "Error allocating DBIRQ\n"); | |
| 1989 | + | rc = -ENODEV; | |
| 1990 | + | goto err_release_group1; | |
| 1992 | 1991 | } | |
| 1992 | + | rc = devm_request_irq(edac->dev, altdev->db_irq, prv->ecc_irq_handler, | |
| 1993 | + | IRQF_TRIGGER_HIGH, | |
| 1994 | + | ecc_name, altdev); | |
| 1995 | + | if (rc) { | |
| 1996 | + | edac_printk(KERN_ERR, EDAC_DEVICE, "No DBERR IRQ resource\n"); | |
| 1997 | + | goto err_release_group1; | |
| 1998 | + | } | |
| 1999 | + | #endif | |
| 1993 | 2000 | ||
| 1994 | 2001 | rc = edac_device_add_device(dci); | |
| 1995 | 2002 | if (rc) { | |
| @@ -2007,17 +2014,9 @@ static int altr_edac_a10_device_add(struct altr_arria10_edac *edac, | |||
| 2007 | 2014 | return 0; | |
| 2008 | 2015 | ||
| 2009 | 2016 | err_release_group1: | |
| 2010 | - | /* | |
| 2011 | - | * Release the devres group first so the managed IRQs are | |
| 2012 | - | * unregistered before dci (which contains the IRQ handler's | |
| 2013 | - | * data via dci->pvt_info) is freed, avoiding a use-after-free. | |
| 2014 | - | */ | |
| 2015 | - | devres_release_group(edac->dev, NULL); | |
| 2016 | 2017 | edac_device_free_ctl_info(dci); | |
| 2017 | - | goto err_print; | |
| 2018 | 2018 | err_release_group: | |
| 2019 | 2019 | devres_release_group(edac->dev, NULL); | |
| 2020 | - | err_print: | |
| 2021 | 2020 | edac_printk(KERN_ERR, EDAC_DEVICE, | |
| 2022 | 2021 | "%s:Error setting up EDAC device: %d\n", ecc_name, rc); | |
| 2023 | 2022 | ||
| @@ -2060,6 +2059,7 @@ static const struct irq_domain_ops a10_eccmgr_ic_ops = { | |||
| 2060 | 2059 | /************** Stratix 10 EDAC Double Bit Error Handler ************/ | |
| 2061 | 2060 | #define to_a10edac(p, m) container_of(p, struct altr_arria10_edac, m) | |
| 2062 | 2061 | ||
| 2062 | + | #ifdef CONFIG_64BIT | |
| 2063 | 2063 | /* panic routine issues reboot on non-zero panic_timeout */ | |
| 2064 | 2064 | extern int panic_timeout; | |
| 2065 | 2065 | ||
| @@ -2106,6 +2106,7 @@ static int s10_edac_dberr_handler(struct notifier_block *this, | |||
| 2106 | 2106 | ||
| 2107 | 2107 | return NOTIFY_DONE; | |
| 2108 | 2108 | } | |
| 2109 | + | #endif | |
| 2109 | 2110 | ||
| 2110 | 2111 | /****************** Arria 10 EDAC Probe Function *********************/ | |
| 2111 | 2112 | static int altr_edac_a10_probe(struct platform_device *pdev) | |
| @@ -2121,8 +2122,6 @@ static int altr_edac_a10_probe(struct platform_device *pdev) | |||
| 2121 | 2122 | platform_set_drvdata(pdev, edac); | |
| 2122 | 2123 | INIT_LIST_HEAD(&edac->a10_ecc_devices); | |
| 2123 | 2124 | ||
| 2124 | - | edac->is_s10 = !!device_get_match_data(&pdev->dev); | |
| 2125 | - | ||
| 2126 | 2125 | edac->ecc_mgr_map = | |
| 2127 | 2126 | altr_sysmgr_regmap_lookup_by_phandle(pdev->dev.of_node, | |
| 2128 | 2127 | "altr,sysmgr-syscon"); | |
| @@ -2154,7 +2153,8 @@ static int altr_edac_a10_probe(struct platform_device *pdev) | |||
| 2154 | 2153 | irq_set_chained_handler_and_data(edac->sb_irq, | |
| 2155 | 2154 | altr_edac_a10_irq_handler, | |
| 2156 | 2155 | edac); | |
| 2157 | - | if (edac->is_s10) | |
| 2156 | + | ||
| 2157 | + | #ifdef CONFIG_64BIT | |
| 2158 | 2158 | { | |
| 2159 | 2159 | int dberror, err_addr; | |
| 2160 | 2160 | ||
| @@ -2177,14 +2177,15 @@ static int altr_edac_a10_probe(struct platform_device *pdev) | |||
| 2177 | 2177 | regmap_write(edac->ecc_mgr_map, | |
| 2178 | 2178 | S10_SYSMGR_UE_ADDR_OFST, 0); | |
| 2179 | 2179 | } | |
| 2180 | - | } else { | |
| 2181 | - | edac->db_irq = platform_get_irq(pdev, 1); | |
| 2182 | - | if (edac->db_irq < 0) | |
| 2183 | - | return edac->db_irq; | |
| 2184 | - | ||
| 2185 | - | irq_set_chained_handler_and_data(edac->db_irq, | |
| 2186 | - | altr_edac_a10_irq_handler, edac); | |
| 2187 | 2180 | } | |
| 2181 | + | #else | |
| 2182 | + | edac->db_irq = platform_get_irq(pdev, 1); | |
| 2183 | + | if (edac->db_irq < 0) | |
| 2184 | + | return edac->db_irq; | |
| 2185 | + | ||
| 2186 | + | irq_set_chained_handler_and_data(edac->db_irq, | |
| 2187 | + | altr_edac_a10_irq_handler, edac); | |
| 2188 | + | #endif | |
| 2188 | 2189 | ||
| 2189 | 2190 | for_each_child_of_node(pdev->dev.of_node, child) { | |
| 2190 | 2191 | if (!of_device_is_available(child)) | |
| @@ -2206,7 +2207,7 @@ static int altr_edac_a10_probe(struct platform_device *pdev) | |||
| 2206 | 2207 | ||
| 2207 | 2208 | static const struct of_device_id altr_edac_a10_of_match[] = { | |
| 2208 | 2209 | { .compatible = "altr,socfpga-a10-ecc-manager" }, | |
| 2209 | - | { .compatible = "altr,socfpga-s10-ecc-manager", .data = (void *)1 }, | |
| 2210 | + | { .compatible = "altr,socfpga-s10-ecc-manager" }, | |
| 2210 | 2211 | {}, | |
| 2211 | 2212 | }; | |
| 2212 | 2213 | MODULE_DEVICE_TABLE(of, altr_edac_a10_of_match); | |
| @@ -2216,7 +2217,6 @@ static struct platform_driver altr_edac_a10_driver = { | |||
| 2216 | 2217 | .driver = { | |
| 2217 | 2218 | .name = "socfpga_a10_ecc_manager", | |
| 2218 | 2219 | .of_match_table = altr_edac_a10_of_match, | |
| 2219 | - | .suppress_bind_attrs = true, | |
| 2220 | 2220 | }, | |
| 2221 | 2221 | }; | |
| 2222 | 2222 | module_platform_driver(altr_edac_a10_driver); | |
modified drivers/edac/altera_edac.h
| @@ -394,7 +394,6 @@ struct altr_arria10_edac { | |||
| 394 | 394 | struct irq_chip irq_chip; | |
| 395 | 395 | struct list_head a10_ecc_devices; | |
| 396 | 396 | struct notifier_block panic_notifier; | |
| 397 | - | bool is_s10; | |
| 398 | 397 | }; | |
| 399 | 398 | ||
| 400 | 399 | #endif /* #ifndef _ALTERA_EDAC_H */ | |
modified drivers/edac/amd64_edac.c
| @@ -2796,13 +2796,13 @@ static inline void decode_bus_error(int node_id, struct mce *m) | |||
| 2796 | 2796 | * the instance_id. For example, instance_id=0xYXXXXX where Y is the channel | |
| 2797 | 2797 | * number. | |
| 2798 | 2798 | * | |
| 2799 | - | * For DRAM ECC errors, the Chip Select number is given in bits [1:0] of | |
| 2799 | + | * For DRAM ECC errors, the Chip Select number is given in bits [2:0] of | |
| 2800 | 2800 | * the MCA_SYND[ErrorInformation] field. | |
| 2801 | 2801 | */ | |
| 2802 | 2802 | static void umc_get_err_info(struct mce *m, struct err_info *err) | |
| 2803 | 2803 | { | |
| 2804 | 2804 | err->channel = (m->ipid & GENMASK(31, 0)) >> 20; | |
| 2805 | - | err->csrow = m->synd & 0x3; | |
| 2805 | + | err->csrow = m->synd & 0x7; | |
| 2806 | 2806 | } | |
| 2807 | 2807 | ||
| 2808 | 2808 | static void decode_umc_error(int node_id, struct mce *m) | |
| @@ -4173,8 +4173,6 @@ static int __init amd64_edac_init(void) | |||
| 4173 | 4173 | goto err_pci; | |
| 4174 | 4174 | } | |
| 4175 | 4175 | ||
| 4176 | - | request_module_nowait("amd_atl"); | |
| 4177 | - | ||
| 4178 | 4176 | /* register stuff with EDAC MCE */ | |
| 4179 | 4177 | if (boot_cpu_data.x86 >= 0x17) { | |
| 4180 | 4178 | amd_register_ecc_decoder(decode_umc_error); | |
modified drivers/edac/aspeed_edac.c
| @@ -214,8 +214,10 @@ static int config_irq(void *ctx, struct platform_device *pdev) | |||
| 214 | 214 | ||
| 215 | 215 | rc = devm_request_irq(&pdev->dev, irq, mcr_isr, IRQF_TRIGGER_HIGH, | |
| 216 | 216 | DRV_NAME, ctx); | |
| 217 | - | if (rc) | |
| 217 | + | if (rc) { | |
| 218 | + | dev_err(&pdev->dev, "unable to request irq %d\n", irq); | |
| 218 | 219 | return rc; | |
| 220 | + | } | |
| 219 | 221 | ||
| 220 | 222 | /* enable interrupts */ | |
| 221 | 223 | regmap_update_bits(aspeed_regmap, ASPEED_MCR_INTR_CTRL, | |
modified drivers/edac/debugfs.c
| @@ -1,9 +1,50 @@ | |||
| 1 | 1 | // SPDX-License-Identifier: GPL-2.0-only | |
| 2 | 2 | ||
| 3 | + | #include <linux/string_choices.h> | |
| 4 | + | ||
| 3 | 5 | #include "edac_module.h" | |
| 4 | 6 | ||
| 5 | 7 | static struct dentry *edac_debugfs; | |
| 6 | 8 | ||
| 9 | + | static ssize_t edac_fake_inject_write(struct file *file, | |
| 10 | + | const char __user *data, | |
| 11 | + | size_t count, loff_t *ppos) | |
| 12 | + | { | |
| 13 | + | struct device *dev = file->private_data; | |
| 14 | + | struct mem_ctl_info *mci = to_mci(dev); | |
| 15 | + | static enum hw_event_mc_err_type type; | |
| 16 | + | u16 errcount = mci->fake_inject_count; | |
| 17 | + | ||
| 18 | + | if (!errcount) | |
| 19 | + | errcount = 1; | |
| 20 | + | ||
| 21 | + | type = mci->fake_inject_ue ? HW_EVENT_ERR_UNCORRECTED | |
| 22 | + | : HW_EVENT_ERR_CORRECTED; | |
| 23 | + | ||
| 24 | + | printk(KERN_DEBUG | |
| 25 | + | "Generating %d %s fake error%s to %d.%d.%d to test core handling. NOTE: this won't test the driver-specific decoding logic.\n", | |
| 26 | + | errcount, | |
| 27 | + | (type == HW_EVENT_ERR_UNCORRECTED) ? "UE" : "CE", | |
| 28 | + | str_plural(errcount), | |
| 29 | + | mci->fake_inject_layer[0], | |
| 30 | + | mci->fake_inject_layer[1], | |
| 31 | + | mci->fake_inject_layer[2] | |
| 32 | + | ); | |
| 33 | + | edac_mc_handle_error(type, mci, errcount, 0, 0, 0, | |
| 34 | + | mci->fake_inject_layer[0], | |
| 35 | + | mci->fake_inject_layer[1], | |
| 36 | + | mci->fake_inject_layer[2], | |
| 37 | + | "FAKE ERROR", "for EDAC testing only"); | |
| 38 | + | ||
| 39 | + | return count; | |
| 40 | + | } | |
| 41 | + | ||
| 42 | + | static const struct file_operations debug_fake_inject_fops = { | |
| 43 | + | .open = simple_open, | |
| 44 | + | .write = edac_fake_inject_write, | |
| 45 | + | .llseek = generic_file_llseek, | |
| 46 | + | }; | |
| 47 | + | ||
| 7 | 48 | void __init edac_debugfs_init(void) | |
| 8 | 49 | { | |
| 9 | 50 | edac_debugfs = debugfs_create_dir("edac", NULL); | |
| @@ -16,7 +57,29 @@ void edac_debugfs_exit(void) | |||
| 16 | 57 | ||
| 17 | 58 | void edac_create_debugfs_nodes(struct mem_ctl_info *mci) | |
| 18 | 59 | { | |
| 19 | - | mci->debugfs = debugfs_create_dir(mci->dev.kobj.name, edac_debugfs); | |
| 60 | + | struct dentry *parent; | |
| 61 | + | char name[80]; | |
| 62 | + | int i; | |
| 63 | + | ||
| 64 | + | parent = debugfs_create_dir(mci->dev.kobj.name, edac_debugfs); | |
| 65 | + | ||
| 66 | + | for (i = 0; i < mci->n_layers; i++) { | |
| 67 | + | sprintf(name, "fake_inject_%s", | |
| 68 | + | edac_layer_name[mci->layers[i].type]); | |
| 69 | + | debugfs_create_u8(name, S_IRUGO | S_IWUSR, parent, | |
| 70 | + | &mci->fake_inject_layer[i]); | |
| 71 | + | } | |
| 72 | + | ||
| 73 | + | debugfs_create_bool("fake_inject_ue", S_IRUGO | S_IWUSR, parent, | |
| 74 | + | &mci->fake_inject_ue); | |
| 75 | + | ||
| 76 | + | debugfs_create_u16("fake_inject_count", S_IRUGO | S_IWUSR, parent, | |
| 77 | + | &mci->fake_inject_count); | |
| 78 | + | ||
| 79 | + | debugfs_create_file("fake_inject", S_IWUSR, parent, &mci->dev, | |
| 80 | + | &debug_fake_inject_fops); | |
| 81 | + | ||
| 82 | + | mci->debugfs = parent; | |
| 20 | 83 | } | |
| 21 | 84 | ||
| 22 | 85 | /* Create a toplevel dir under EDAC's debugfs hierarchy */ | |
modified drivers/edac/edac_device.c
| @@ -342,10 +342,14 @@ static void edac_device_workq_teardown(struct edac_device_ctl_info *edac_dev) | |||
| 342 | 342 | } | |
| 343 | 343 | ||
| 344 | 344 | /* | |
| 345 | - | * Stop any outstanding workq queued up at this time because sleep time will | |
| 346 | - | * be reset. Then restart the workq on the new delay. | |
| 345 | + | * edac_device_reset_delay_period | |
| 346 | + | * | |
| 347 | + | * need to stop any outstanding workq queued up at this time | |
| 348 | + | * because we will be resetting the sleep time. | |
| 349 | + | * Then restart the workq on the new delay | |
| 347 | 350 | */ | |
| 348 | - | void edac_device_reset_delay_period(struct edac_device_ctl_info *edac_dev, unsigned int msec) | |
| 351 | + | void edac_device_reset_delay_period(struct edac_device_ctl_info *edac_dev, | |
| 352 | + | unsigned long msec) | |
| 349 | 353 | { | |
| 350 | 354 | edac_dev->poll_msec = msec; | |
| 351 | 355 | edac_dev->delay = msecs_to_jiffies(msec); | |
modified drivers/edac/edac_device_sysfs.c
| @@ -84,23 +84,18 @@ static ssize_t edac_device_ctl_poll_msec_show(struct edac_device_ctl_info | |||
| 84 | 84 | return sprintf(data, "%u\n", ctl_info->poll_msec); | |
| 85 | 85 | } | |
| 86 | 86 | ||
| 87 | - | static ssize_t edac_device_ctl_poll_msec_store(struct edac_device_ctl_info *ctl_info, | |
| 88 | - | const char *data, size_t count) | |
| 87 | + | static ssize_t edac_device_ctl_poll_msec_store(struct edac_device_ctl_info | |
| 88 | + | *ctl_info, const char *data, | |
| 89 | + | size_t count) | |
| 89 | 90 | { | |
| 90 | - | unsigned int value; | |
| 91 | - | int ret; | |
| 91 | + | unsigned long value; | |
| 92 | 92 | ||
| 93 | - | /* | |
| 94 | - | * Get the value, make sure it is non-zero, must be at least one millisecond | |
| 95 | - | * for the delay period between scans. | |
| 93 | + | /* get the value and enforce that it is non-zero, must be at least | |
| 94 | + | * one millisecond for the delay period, between scans | |
| 95 | + | * Then cancel last outstanding delay for the work request | |
| 96 | + | * and set a new one. | |
| 96 | 97 | */ | |
| 97 | - | ret = kstrtouint(data, 0, &value); | |
| 98 | - | if (ret < 0) | |
| 99 | - | return ret; | |
| 100 | - | ||
| 101 | - | if (value < 1) | |
| 102 | - | return -EINVAL; | |
| 103 | - | ||
| 98 | + | value = simple_strtoul(data, NULL, 0); | |
| 104 | 99 | edac_device_reset_delay_period(ctl_info, value); | |
| 105 | 100 | ||
| 106 | 101 | return count; | |
modified drivers/edac/edac_mc_sysfs.c
| @@ -129,7 +129,7 @@ static ssize_t dimmdev_location_show(struct device *dev, | |||
| 129 | 129 | ssize_t count; | |
| 130 | 130 | ||
| 131 | 131 | count = edac_dimm_info_location(dimm, data, PAGE_SIZE); | |
| 132 | - | count += sysfs_emit_at(data, count, "\n"); | |
| 132 | + | count += scnprintf(data + count, PAGE_SIZE - count, "\n"); | |
| 133 | 133 | ||
| 134 | 134 | return count; | |
| 135 | 135 | } | |
modified drivers/edac/edac_module.h
| @@ -52,7 +52,8 @@ bool edac_queue_work(struct delayed_work *work, unsigned long delay); | |||
| 52 | 52 | bool edac_stop_work(struct delayed_work *work); | |
| 53 | 53 | bool edac_mod_work(struct delayed_work *work, unsigned long delay); | |
| 54 | 54 | ||
| 55 | - | extern void edac_device_reset_delay_period(struct edac_device_ctl_info *edac_dev, unsigned int msec); | |
| 55 | + | extern void edac_device_reset_delay_period(struct edac_device_ctl_info | |
| 56 | + | *edac_dev, unsigned long msec); | |
| 56 | 57 | extern void edac_mc_reset_delay_period(unsigned long value); | |
| 57 | 58 | ||
| 58 | 59 | /* | |
modified drivers/edac/highbank_mc_edac.c
| @@ -235,8 +235,10 @@ static int highbank_mc_probe(struct platform_device *pdev) | |||
| 235 | 235 | irq = platform_get_irq(pdev, 0); | |
| 236 | 236 | res = devm_request_irq(&pdev->dev, irq, highbank_mc_err_handler, | |
| 237 | 237 | 0, dev_name(&pdev->dev), mci); | |
| 238 | - | if (res < 0) | |
| 238 | + | if (res < 0) { | |
| 239 | + | dev_err(&pdev->dev, "Unable to request irq %d\n", irq); | |
| 239 | 240 | goto err2; | |
| 241 | + | } | |
| 240 | 242 | ||
| 241 | 243 | devres_close_group(&pdev->dev, NULL); | |
| 242 | 244 | return 0; | |
modified drivers/edac/ie31200_edac.c
| @@ -416,23 +416,7 @@ static void populate_dimm_info(struct dimm_data *dd, u32 addr_decode, int dimm, | |||
| 416 | 416 | { | |
| 417 | 417 | dd->size = field_get(cfg->reg_mad_dimm_size_mask[dimm], addr_decode) * cfg->reg_mad_dimm_size_granularity; | |
| 418 | 418 | dd->ranks = field_get(cfg->reg_mad_dimm_rank_mask[dimm], addr_decode) + 1; | |
| 419 | - | ||
| 420 | - | switch (field_get(cfg->reg_mad_dimm_width_mask[dimm], addr_decode)) { | |
| 421 | - | case 0: | |
| 422 | - | dd->dtype = DEV_X8; | |
| 423 | - | break; | |
| 424 | - | case 1: | |
| 425 | - | dd->dtype = DEV_X16; | |
| 426 | - | break; | |
| 427 | - | case 2: | |
| 428 | - | dd->dtype = DEV_X32; | |
| 429 | - | break; | |
| 430 | - | case 3: | |
| 431 | - | dd->dtype = DEV_X64; | |
| 432 | - | break; | |
| 433 | - | default: | |
| 434 | - | dd->dtype = DEV_UNKNOWN; | |
| 435 | - | } | |
| 419 | + | dd->dtype = field_get(cfg->reg_mad_dimm_width_mask[dimm], addr_decode) + DEV_X8; | |
| 436 | 420 | } | |
| 437 | 421 | ||
| 438 | 422 | static void ie31200_get_dimm_config(struct mem_ctl_info *mci, void __iomem *window, | |
modified drivers/edac/igen6_edac.c
| @@ -42,8 +42,7 @@ | |||
| 42 | 42 | ||
| 43 | 43 | #define GET_BITFIELD(v, lo, hi) (((v) & GENMASK_ULL(hi, lo)) >> (lo)) | |
| 44 | 44 | ||
| 45 | - | /* Probing upper bound, not a hardware capability limit. */ | |
| 46 | - | #define MAX_IMC_TO_PROBE 8 | |
| 45 | + | #define NUM_IMC 2 /* Max memory controllers */ | |
| 47 | 46 | #define NUM_CHANNELS 2 /* Max channels */ | |
| 48 | 47 | #define NUM_DIMMS 2 /* Max DIMMs per channel */ | |
| 49 | 48 | ||
| @@ -123,43 +122,6 @@ | |||
| 123 | 122 | #define MEM_SLICE_HASH_MASK(v) (GET_BITFIELD(v, 6, 19) << 6) | |
| 124 | 123 | #define MEM_SLICE_HASH_LSB_MASK_BIT(v) GET_BITFIELD(v, 24, 26) | |
| 125 | 124 | ||
| 126 | - | /* | |
| 127 | - | * A slice represents a portion of memory space participating in an | |
| 128 | - | * interleave relationship within the memory hierarchy. | |
| 129 | - | * | |
| 130 | - | * It can represent in different levels such as: | |
| 131 | - | * | |
| 132 | - | * - a pair of memory controllers | |
| 133 | - | * - a memory controller | |
| 134 | - | * - a memory channel | |
| 135 | - | * - a memory sub-channel / DIMM | |
| 136 | - | * | |
| 137 | - | * +--------+ | |
| 138 | - | * | | | |
| 139 | - | * | Zone 1 | | |
| 140 | - | * | | | |
| 141 | - | * +--------+ +--------+ | |
| 142 | - | * | | | | | |
| 143 | - | * | | | | | |
| 144 | - | * | Zone 0 | | Zone 0 | | |
| 145 | - | * | | | | | |
| 146 | - | * | | | | | |
| 147 | - | * +--------+ +--------+ | |
| 148 | - | * | |
| 149 | - | * Slice L Slice S | |
| 150 | - | * | |
| 151 | - | * Memory space is divided into: | |
| 152 | - | * | |
| 153 | - | * - Zone 0 : Interleaved region | |
| 154 | - | * - Zone 1 : Non-interleaved region (upper part of the large slice). | |
| 155 | - | */ | |
| 156 | - | struct slice { | |
| 157 | - | /* Slice address. */ | |
| 158 | - | u64 addr; | |
| 159 | - | /* Slice that @addr belongs to. */ | |
| 160 | - | int id; | |
| 161 | - | }; | |
| 162 | - | ||
| 163 | 125 | struct igen6_imc { | |
| 164 | 126 | int mc; | |
| 165 | 127 | struct mem_ctl_info *mci; | |
| @@ -213,6 +175,8 @@ static struct res_config { | |||
| 213 | 175 | /* Set imc->dimm_{l_size,s_size,l_map}[chan]. */ | |
| 214 | 176 | void (*set_dimm_params)(struct igen6_imc *imc, int chan); | |
| 215 | 177 | bool (*ibecc_available)(struct pci_dev *pdev); | |
| 178 | + | /* Extract error address logged in IBECC */ | |
| 179 | + | u64 (*err_addr)(u64 ecclog); | |
| 216 | 180 | /* Convert error address logged in IBECC to system physical address */ | |
| 217 | 181 | u64 (*err_addr_to_sys_addr)(u64 eaddr, int mc); | |
| 218 | 182 | /* Convert error address logged in IBECC to integrated memory controller address */ | |
| @@ -220,11 +184,11 @@ static struct res_config { | |||
| 220 | 184 | } *res_cfg; | |
| 221 | 185 | ||
| 222 | 186 | static struct igen6_pvt { | |
| 187 | + | struct igen6_imc imc[NUM_IMC]; | |
| 223 | 188 | void __iomem *memss_pma_cr; | |
| 224 | 189 | u64 ms_hash; | |
| 225 | 190 | u64 ms_s_size; | |
| 226 | 191 | int ms_l_map; | |
| 227 | - | struct igen6_imc imc[]; | |
| 228 | 192 | } *igen6_pvt; | |
| 229 | 193 | ||
| 230 | 194 | /* The top of low usable DRAM */ | |
| @@ -261,8 +225,7 @@ static char ecclog_buf[ECCLOG_POOL_SIZE]; | |||
| 261 | 225 | static struct irq_work ecclog_irq_work; | |
| 262 | 226 | static struct work_struct ecclog_work; | |
| 263 | 227 | ||
| 264 | - | /* SoC compute die IDs with IBECC capability. */ | |
| 265 | - | /* Elkhart Lake */ | |
| 228 | + | /* Compute die IDs for Elkhart Lake with IBECC */ | |
| 266 | 229 | #define DID_EHL_SKU5 0x4514 | |
| 267 | 230 | #define DID_EHL_SKU6 0x4528 | |
| 268 | 231 | #define DID_EHL_SKU7 0x452a | |
| @@ -275,22 +238,22 @@ static struct work_struct ecclog_work; | |||
| 275 | 238 | #define DID_EHL_SKU14 0x4534 | |
| 276 | 239 | #define DID_EHL_SKU15 0x4536 | |
| 277 | 240 | ||
| 278 | - | /* ICL-NNPI */ | |
| 241 | + | /* Compute die IDs for ICL-NNPI with IBECC */ | |
| 279 | 242 | #define DID_ICL_SKU8 0x4581 | |
| 280 | 243 | #define DID_ICL_SKU10 0x4585 | |
| 281 | 244 | #define DID_ICL_SKU11 0x4589 | |
| 282 | 245 | #define DID_ICL_SKU12 0x458d | |
| 283 | 246 | ||
| 284 | - | /* Tiger Lake */ | |
| 247 | + | /* Compute die IDs for Tiger Lake with IBECC */ | |
| 285 | 248 | #define DID_TGL_SKU 0x9a14 | |
| 286 | 249 | ||
| 287 | - | /* Alder Lake */ | |
| 250 | + | /* Compute die IDs for Alder Lake with IBECC */ | |
| 288 | 251 | #define DID_ADL_SKU1 0x4601 | |
| 289 | 252 | #define DID_ADL_SKU2 0x4602 | |
| 290 | 253 | #define DID_ADL_SKU3 0x4621 | |
| 291 | 254 | #define DID_ADL_SKU4 0x4641 | |
| 292 | 255 | ||
| 293 | - | /* Alder Lake-N */ | |
| 256 | + | /* Compute die IDs for Alder Lake-N with IBECC */ | |
| 294 | 257 | #define DID_ADL_N_SKU1 0x4614 | |
| 295 | 258 | #define DID_ADL_N_SKU2 0x4617 | |
| 296 | 259 | #define DID_ADL_N_SKU3 0x461b | |
| @@ -304,38 +267,38 @@ static struct work_struct ecclog_work; | |||
| 304 | 267 | #define DID_ADL_N_SKU11 0x467c | |
| 305 | 268 | #define DID_ADL_N_SKU12 0x4632 | |
| 306 | 269 | ||
| 307 | - | /* Arizona Beach */ | |
| 270 | + | /* Compute die IDs for Arizona Beach with IBECC */ | |
| 308 | 271 | #define DID_AZB_SKU1 0x4676 | |
| 309 | 272 | ||
| 310 | - | /* Amston Lake */ | |
| 273 | + | /* Compute did IDs for Amston Lake with IBECC */ | |
| 311 | 274 | #define DID_ASL_SKU1 0x464a | |
| 312 | 275 | #define DID_ASL_SKU2 0x4646 | |
| 313 | 276 | #define DID_ASL_SKU3 0x4652 | |
| 314 | 277 | ||
| 315 | - | /* Raptor Lake-P */ | |
| 278 | + | /* Compute die IDs for Raptor Lake-P with IBECC */ | |
| 316 | 279 | #define DID_RPL_P_SKU1 0xa706 | |
| 317 | 280 | #define DID_RPL_P_SKU2 0xa707 | |
| 318 | 281 | #define DID_RPL_P_SKU3 0xa708 | |
| 319 | 282 | #define DID_RPL_P_SKU4 0xa716 | |
| 320 | 283 | #define DID_RPL_P_SKU5 0xa718 | |
| 321 | 284 | ||
| 322 | - | /* Meteor Lake-PS */ | |
| 285 | + | /* Compute die IDs for Meteor Lake-PS with IBECC */ | |
| 323 | 286 | #define DID_MTL_PS_SKU1 0x7d21 | |
| 324 | 287 | #define DID_MTL_PS_SKU2 0x7d22 | |
| 325 | 288 | #define DID_MTL_PS_SKU3 0x7d23 | |
| 326 | 289 | #define DID_MTL_PS_SKU4 0x7d24 | |
| 327 | 290 | ||
| 328 | - | /* Meteor Lake-P */ | |
| 291 | + | /* Compute die IDs for Meteor Lake-P with IBECC */ | |
| 329 | 292 | #define DID_MTL_P_SKU1 0x7d01 | |
| 330 | 293 | #define DID_MTL_P_SKU2 0x7d02 | |
| 331 | 294 | #define DID_MTL_P_SKU3 0x7d14 | |
| 332 | 295 | ||
| 333 | - | /* Arrow Lake-UH */ | |
| 296 | + | /* Compute die IDs for Arrow Lake-UH with IBECC */ | |
| 334 | 297 | #define DID_ARL_UH_SKU1 0x7d06 | |
| 335 | 298 | #define DID_ARL_UH_SKU2 0x7d20 | |
| 336 | 299 | #define DID_ARL_UH_SKU3 0x7d30 | |
| 337 | 300 | ||
| 338 | - | /* Panther Lake-H */ | |
| 301 | + | /* Compute die IDs for Panther Lake-H with IBECC */ | |
| 339 | 302 | #define DID_PTL_H_SKU1 0xb000 | |
| 340 | 303 | #define DID_PTL_H_SKU2 0xb001 | |
| 341 | 304 | #define DID_PTL_H_SKU3 0xb002 | |
| @@ -351,114 +314,15 @@ static struct work_struct ecclog_work; | |||
| 351 | 314 | #define DID_PTL_H_SKU13 0xb02a | |
| 352 | 315 | #define DID_PTL_H_SKU14 0xb00a | |
| 353 | 316 | ||
| 354 | - | /* Starfire */ | |
| 355 | - | #define DID_STF_SKU1 0xb02b | |
| 356 | - | ||
| 357 | - | /* Wildcat Lake */ | |
| 317 | + | /* Compute die IDs for Wildcat Lake with IBECC */ | |
| 358 | 318 | #define DID_WCL_SKU1 0xfd00 | |
| 359 | 319 | ||
| 360 | - | /* Nova Lake-H/HX */ | |
| 320 | + | /* Compute die IDs for Nova Lake-H/HX with IBECC */ | |
| 361 | 321 | #define DID_NVL_H_SKU1 0xd701 | |
| 362 | 322 | #define DID_NVL_H_SKU2 0xd702 | |
| 363 | 323 | #define DID_NVL_H_SKU3 0xd704 | |
| 364 | 324 | #define DID_NVL_H_SKU4 0xd705 | |
| 365 | 325 | ||
| 366 | - | /* Remove the interleave bit and shift upper part down to fill gap. */ | |
| 367 | - | static u64 squeeze_addr(u64 addr, int intlv_bit) | |
| 368 | - | { | |
| 369 | - | u64 slice_addr; | |
| 370 | - | ||
| 371 | - | slice_addr = GET_BITFIELD(addr, intlv_bit + 1, 63) << intlv_bit; | |
| 372 | - | slice_addr |= GET_BITFIELD(addr, 0, intlv_bit - 1); | |
| 373 | - | ||
| 374 | - | return slice_addr; | |
| 375 | - | } | |
| 376 | - | ||
| 377 | - | /* Shift the upper bits up and insert a zero at the @intlv_bit bit position. */ | |
| 378 | - | static u64 inflate_addr(u64 addr, int intlv_bit) | |
| 379 | - | { | |
| 380 | - | u64 inflated_addr; | |
| 381 | - | ||
| 382 | - | /* Insert a zero at @intlv_bit position. */ | |
| 383 | - | inflated_addr = GET_BITFIELD(addr, intlv_bit, 63) << (intlv_bit + 1); | |
| 384 | - | inflated_addr |= GET_BITFIELD(addr, 0, intlv_bit - 1); | |
| 385 | - | ||
| 386 | - | return inflated_addr; | |
| 387 | - | } | |
| 388 | - | ||
| 389 | - | static u64 compute_hash(u64 addr, u64 hash_mask, u64 hash_base, int intlv_bit) | |
| 390 | - | { | |
| 391 | - | u64 hash_addr; | |
| 392 | - | int i; | |
| 393 | - | ||
| 394 | - | /* | |
| 395 | - | * In hash mode, @intlv_bit is the lowest selected bit of @addr | |
| 396 | - | * to be XORed. While @mask may or may not include this @intlv_bit, | |
| 397 | - | * we enforce that @mask includes @intlv_bit to ensure @intlv_bit is | |
| 398 | - | * XORed exactly once. | |
| 399 | - | */ | |
| 400 | - | hash_mask |= BIT_ULL(intlv_bit); | |
| 401 | - | hash_addr = addr & hash_mask; | |
| 402 | - | ||
| 403 | - | for (i = 6; i < 20; i++) | |
| 404 | - | hash_base ^= (hash_addr >> i) & 1; | |
| 405 | - | ||
| 406 | - | return hash_base; | |
| 407 | - | } | |
| 408 | - | ||
| 409 | - | /* | |
| 410 | - | * Converts a higher-level address (system / IMC / channel) into a lower-level | |
| 411 | - | * slice address and identifier. | |
| 412 | - | */ | |
| 413 | - | static void translate_to_lower_level(u64 addr, u64 hash_mask, u64 hash_base, | |
| 414 | - | int intlv_bit, u64 s_size, int l_map, | |
| 415 | - | struct slice *slice) | |
| 416 | - | { | |
| 417 | - | /* In non-interleave zone. */ | |
| 418 | - | if (addr >= 2 * s_size) { | |
| 419 | - | slice->addr = addr - s_size; | |
| 420 | - | slice->id = l_map; | |
| 421 | - | return; | |
| 422 | - | } | |
| 423 | - | ||
| 424 | - | /* In interleave zone. */ | |
| 425 | - | slice->addr = squeeze_addr(addr, intlv_bit); | |
| 426 | - | ||
| 427 | - | /* Non-hash mode. */ | |
| 428 | - | if (!hash_mask) { | |
| 429 | - | slice->id = GET_BITFIELD(addr, intlv_bit, intlv_bit); | |
| 430 | - | return; | |
| 431 | - | } | |
| 432 | - | ||
| 433 | - | /* Hash mode. */ | |
| 434 | - | slice->id = compute_hash(addr, hash_mask, hash_base, intlv_bit); | |
| 435 | - | } | |
| 436 | - | ||
| 437 | - | /* Reconstruct address for upper memory hierarchy level. */ | |
| 438 | - | static u64 translate_to_upper_level(u64 addr, u64 hash_mask, u64 hash_base, | |
| 439 | - | int intlv_bit, u64 s_size) | |
| 440 | - | { | |
| 441 | - | u64 inflated_addr, hash_val; | |
| 442 | - | ||
| 443 | - | /* In non-interleave zone. */ | |
| 444 | - | if (addr >= s_size) | |
| 445 | - | return addr + s_size; | |
| 446 | - | ||
| 447 | - | /* | |
| 448 | - | * In interleave zone. | |
| 449 | - | * | |
| 450 | - | * Insert a zero at @intlv_bit position. | |
| 451 | - | */ | |
| 452 | - | inflated_addr = inflate_addr(addr, intlv_bit); | |
| 453 | - | ||
| 454 | - | /* | |
| 455 | - | * Reconstruct the removed interleave bit and use it to replace | |
| 456 | - | * the zero at @intlv_bit position. | |
| 457 | - | */ | |
| 458 | - | hash_val = compute_hash(inflated_addr, hash_mask, hash_base, intlv_bit); | |
| 459 | - | return inflated_addr | (hash_val << intlv_bit); | |
| 460 | - | } | |
| 461 | - | ||
| 462 | 326 | static int get_mchbar(struct pci_dev *pdev, u64 *mchbar) | |
| 463 | 327 | { | |
| 464 | 328 | union { | |
| @@ -490,46 +354,6 @@ static int get_mchbar(struct pci_dev *pdev, u64 *mchbar) | |||
| 490 | 354 | return 0; | |
| 491 | 355 | } | |
| 492 | 356 | ||
| 493 | - | /* Check whether the memory controller is absent. */ | |
| 494 | - | static bool imc_absent(void __iomem *window) | |
| 495 | - | { | |
| 496 | - | return readl(window + MAD_INTER_CHANNEL_OFFSET) == ~0; | |
| 497 | - | } | |
| 498 | - | ||
| 499 | - | /* Return MMIO base address of the memory controller if it's present, otherwise return NULL. */ | |
| 500 | - | static void __iomem *map_imc_window(u64 mchbar, int pmc) | |
| 501 | - | { | |
| 502 | - | void __iomem *window; | |
| 503 | - | ||
| 504 | - | window = ioremap(mchbar + pmc * MCHBAR_SIZE, MCHBAR_SIZE); | |
| 505 | - | if (!window) | |
| 506 | - | return NULL; | |
| 507 | - | ||
| 508 | - | if (imc_absent(window)) { | |
| 509 | - | iounmap(window); | |
| 510 | - | return NULL; | |
| 511 | - | } | |
| 512 | - | ||
| 513 | - | return window; | |
| 514 | - | } | |
| 515 | - | ||
| 516 | - | /* Return the number of present memory controllers. */ | |
| 517 | - | static int get_imc_num(u64 mchbar) | |
| 518 | - | { | |
| 519 | - | void __iomem *window; | |
| 520 | - | int lmc, pmc; | |
| 521 | - | ||
| 522 | - | for (lmc = 0, pmc = 0; pmc < MAX_IMC_TO_PROBE; pmc++) { | |
| 523 | - | window = map_imc_window(mchbar, pmc); | |
| 524 | - | if (window) { | |
| 525 | - | iounmap(window); | |
| 526 | - | lmc++; | |
| 527 | - | } | |
| 528 | - | } | |
| 529 | - | ||
| 530 | - | return lmc; | |
| 531 | - | } | |
| 532 | - | ||
| 533 | 357 | static bool ehl_ibecc_available(struct pci_dev *pdev) | |
| 534 | 358 | { | |
| 535 | 359 | u32 v; | |
| @@ -626,9 +450,21 @@ static u64 mem_addr_to_sys_addr(u64 maddr) | |||
| 626 | 450 | return maddr; | |
| 627 | 451 | } | |
| 628 | 452 | ||
| 453 | + | static u64 mem_slice_hash(u64 addr, u64 mask, u64 hash_init, int intlv_bit) | |
| 454 | + | { | |
| 455 | + | u64 hash_addr = addr & mask, hash = hash_init; | |
| 456 | + | u64 intlv = (addr >> intlv_bit) & 1; | |
| 457 | + | int i; | |
| 458 | + | ||
| 459 | + | for (i = 6; i < 20; i++) | |
| 460 | + | hash ^= (hash_addr >> i) & 1; | |
| 461 | + | ||
| 462 | + | return hash ^ intlv; | |
| 463 | + | } | |
| 464 | + | ||
| 629 | 465 | static u64 tgl_err_addr_to_mem_addr(u64 eaddr, int mc) | |
| 630 | 466 | { | |
| 631 | - | u64 mask, ms_s_size; | |
| 467 | + | u64 maddr, hash, mask, ms_s_size; | |
| 632 | 468 | int intlv_bit; | |
| 633 | 469 | u32 ms_hash; | |
| 634 | 470 | ||
| @@ -641,7 +477,12 @@ static u64 tgl_err_addr_to_mem_addr(u64 eaddr, int mc) | |||
| 641 | 477 | mask = MEM_SLICE_HASH_MASK(ms_hash); | |
| 642 | 478 | intlv_bit = MEM_SLICE_HASH_LSB_MASK_BIT(ms_hash) + 6; | |
| 643 | 479 | ||
| 644 | - | return translate_to_upper_level(eaddr, mask, mc, intlv_bit, ms_s_size); | |
| 480 | + | maddr = GET_BITFIELD(eaddr, intlv_bit, 63) << (intlv_bit + 1) | | |
| 481 | + | GET_BITFIELD(eaddr, 0, intlv_bit - 1); | |
| 482 | + | ||
| 483 | + | hash = mem_slice_hash(maddr, mask, mc, intlv_bit); | |
| 484 | + | ||
| 485 | + | return maddr | (hash << intlv_bit); | |
| 645 | 486 | } | |
| 646 | 487 | ||
| 647 | 488 | static u64 tgl_err_addr_to_sys_addr(u64 eaddr, int mc) | |
| @@ -663,9 +504,8 @@ static u64 adl_err_addr_to_sys_addr(u64 eaddr, int mc) | |||
| 663 | 504 | ||
| 664 | 505 | static u64 adl_err_addr_to_imc_addr(u64 eaddr, int mc) | |
| 665 | 506 | { | |
| 666 | - | u64 ms_s_size = igen6_pvt->ms_s_size; | |
| 507 | + | u64 imc_addr, ms_s_size = igen6_pvt->ms_s_size; | |
| 667 | 508 | struct igen6_imc *imc = &igen6_pvt->imc[mc]; | |
| 668 | - | struct slice slice; | |
| 669 | 509 | int intlv_bit; | |
| 670 | 510 | u32 mc_hash; | |
| 671 | 511 | ||
| @@ -676,8 +516,15 @@ static u64 adl_err_addr_to_imc_addr(u64 eaddr, int mc) | |||
| 676 | 516 | ||
| 677 | 517 | intlv_bit = MAC_MC_HASH_LSB(mc_hash) + 6; | |
| 678 | 518 | ||
| 679 | - | translate_to_lower_level(eaddr, 0, 0, intlv_bit, ms_s_size, 0, &slice); | |
| 680 | - | return slice.addr; | |
| 519 | + | imc_addr = GET_BITFIELD(eaddr, intlv_bit + 1, 63) << intlv_bit | | |
| 520 | + | GET_BITFIELD(eaddr, 0, intlv_bit - 1); | |
| 521 | + | ||
| 522 | + | return imc_addr; | |
| 523 | + | } | |
| 524 | + | ||
| 525 | + | static u64 rpl_p_err_addr(u64 ecclog) | |
| 526 | + | { | |
| 527 | + | return field_get(res_cfg->reg_eccerrlog_addr_mask, ecclog); | |
| 681 | 528 | } | |
| 682 | 529 | ||
| 683 | 530 | static enum mem_type ptl_h_get_mem_type(struct igen6_imc *imc) | |
| @@ -839,7 +686,6 @@ static struct res_config tgl_cfg = { | |||
| 839 | 686 | .err_addr_to_imc_addr = tgl_err_addr_to_imc_addr, | |
| 840 | 687 | }; | |
| 841 | 688 | ||
| 842 | - | /* Shared by Alder Lake, Alder Lake-N, Arizona Beach, Amston Lake, and Raptor Lake-P */ | |
| 843 | 689 | static struct res_config adl_cfg = { | |
| 844 | 690 | .machine_check = true, | |
| 845 | 691 | .num_imc = 2, | |
| @@ -855,6 +701,37 @@ static struct res_config adl_cfg = { | |||
| 855 | 701 | .err_addr_to_imc_addr = adl_err_addr_to_imc_addr, | |
| 856 | 702 | }; | |
| 857 | 703 | ||
| 704 | + | static struct res_config adl_n_cfg = { | |
| 705 | + | .machine_check = true, | |
| 706 | + | .num_imc = 1, | |
| 707 | + | .reg_mchbar_mask = GENMASK_ULL(41, 17), | |
| 708 | + | .reg_tom_mask = GENMASK_ULL(41, 20), | |
| 709 | + | .reg_touud_mask = GENMASK_ULL(41, 20), | |
| 710 | + | .reg_eccerrlog_addr_mask = GENMASK_ULL(45, 5), | |
| 711 | + | .imc_base = 0xd800, | |
| 712 | + | .ibecc_base = 0xd400, | |
| 713 | + | .ibecc_error_log_offset = 0x68, | |
| 714 | + | .ibecc_available = tgl_ibecc_available, | |
| 715 | + | .err_addr_to_sys_addr = adl_err_addr_to_sys_addr, | |
| 716 | + | .err_addr_to_imc_addr = adl_err_addr_to_imc_addr, | |
| 717 | + | }; | |
| 718 | + | ||
| 719 | + | static struct res_config rpl_p_cfg = { | |
| 720 | + | .machine_check = true, | |
| 721 | + | .num_imc = 2, | |
| 722 | + | .reg_mchbar_mask = GENMASK_ULL(41, 17), | |
| 723 | + | .reg_tom_mask = GENMASK_ULL(41, 20), | |
| 724 | + | .reg_touud_mask = GENMASK_ULL(41, 20), | |
| 725 | + | .reg_eccerrlog_addr_mask = GENMASK_ULL(45, 5), | |
| 726 | + | .imc_base = 0xd800, | |
| 727 | + | .ibecc_base = 0xd400, | |
| 728 | + | .ibecc_error_log_offset = 0x68, | |
| 729 | + | .ibecc_available = tgl_ibecc_available, | |
| 730 | + | .err_addr = rpl_p_err_addr, | |
| 731 | + | .err_addr_to_sys_addr = adl_err_addr_to_sys_addr, | |
| 732 | + | .err_addr_to_imc_addr = adl_err_addr_to_imc_addr, | |
| 733 | + | }; | |
| 734 | + | ||
| 858 | 735 | static struct res_config mtl_ps_cfg = { | |
| 859 | 736 | .machine_check = true, | |
| 860 | 737 | .num_imc = 2, | |
| @@ -872,7 +749,6 @@ static struct res_config mtl_ps_cfg = { | |||
| 872 | 749 | .err_addr_to_imc_addr = adl_err_addr_to_imc_addr, | |
| 873 | 750 | }; | |
| 874 | 751 | ||
| 875 | - | /* Shared by Meteor Lake-P, Arrow Lake-UH, and Wildcat Lake */ | |
| 876 | 752 | static struct res_config mtl_p_cfg = { | |
| 877 | 753 | .machine_check = true, | |
| 878 | 754 | .num_imc = 2, | |
| @@ -888,7 +764,6 @@ static struct res_config mtl_p_cfg = { | |||
| 888 | 764 | .err_addr_to_imc_addr = adl_err_addr_to_imc_addr, | |
| 889 | 765 | }; | |
| 890 | 766 | ||
| 891 | - | /* Shared by Panther Lake-H and Starfire */ | |
| 892 | 767 | static struct res_config ptl_h_cfg = { | |
| 893 | 768 | .machine_check = true, | |
| 894 | 769 | .num_imc = 2, | |
| @@ -919,6 +794,21 @@ static struct res_config ptl_h_cfg = { | |||
| 919 | 794 | .err_addr_to_imc_addr = adl_err_addr_to_imc_addr, | |
| 920 | 795 | }; | |
| 921 | 796 | ||
| 797 | + | static struct res_config wcl_cfg = { | |
| 798 | + | .machine_check = true, | |
| 799 | + | .num_imc = 1, | |
| 800 | + | .reg_mchbar_mask = GENMASK_ULL(41, 17), | |
| 801 | + | .reg_tom_mask = GENMASK_ULL(41, 20), | |
| 802 | + | .reg_touud_mask = GENMASK_ULL(41, 20), | |
| 803 | + | .reg_eccerrlog_addr_mask = GENMASK_ULL(38, 5), | |
| 804 | + | .imc_base = 0xd800, | |
| 805 | + | .ibecc_base = 0xd400, | |
| 806 | + | .ibecc_error_log_offset = 0x170, | |
| 807 | + | .ibecc_available = mtl_p_ibecc_available, | |
| 808 | + | .err_addr_to_sys_addr = adl_err_addr_to_sys_addr, | |
| 809 | + | .err_addr_to_imc_addr = adl_err_addr_to_imc_addr, | |
| 810 | + | }; | |
| 811 | + | ||
| 922 | 812 | static struct res_config nvl_h_cfg = { | |
| 923 | 813 | .machine_check = true, | |
| 924 | 814 | .num_imc = 2, | |
| @@ -971,27 +861,27 @@ static struct pci_device_id igen6_pci_tbl[] = { | |||
| 971 | 861 | { PCI_VDEVICE(INTEL, DID_ADL_SKU2), .driver_data = (kernel_ulong_t)&adl_cfg }, | |
| 972 | 862 | { PCI_VDEVICE(INTEL, DID_ADL_SKU3), .driver_data = (kernel_ulong_t)&adl_cfg }, | |
| 973 | 863 | { PCI_VDEVICE(INTEL, DID_ADL_SKU4), .driver_data = (kernel_ulong_t)&adl_cfg }, | |
| 974 | - | { PCI_VDEVICE(INTEL, DID_ADL_N_SKU1), .driver_data = (kernel_ulong_t)&adl_cfg }, | |
| 975 | - | { PCI_VDEVICE(INTEL, DID_ADL_N_SKU2), .driver_data = (kernel_ulong_t)&adl_cfg }, | |
| 976 | - | { PCI_VDEVICE(INTEL, DID_ADL_N_SKU3), .driver_data = (kernel_ulong_t)&adl_cfg }, | |
| 977 | - | { PCI_VDEVICE(INTEL, DID_ADL_N_SKU4), .driver_data = (kernel_ulong_t)&adl_cfg }, | |
| 978 | - | { PCI_VDEVICE(INTEL, DID_ADL_N_SKU5), .driver_data = (kernel_ulong_t)&adl_cfg }, | |
| 979 | - | { PCI_VDEVICE(INTEL, DID_ADL_N_SKU6), .driver_data = (kernel_ulong_t)&adl_cfg }, | |
| 980 | - | { PCI_VDEVICE(INTEL, DID_ADL_N_SKU7), .driver_data = (kernel_ulong_t)&adl_cfg }, | |
| 981 | - | { PCI_VDEVICE(INTEL, DID_ADL_N_SKU8), .driver_data = (kernel_ulong_t)&adl_cfg }, | |
| 982 | - | { PCI_VDEVICE(INTEL, DID_ADL_N_SKU9), .driver_data = (kernel_ulong_t)&adl_cfg }, | |
| 983 | - | { PCI_VDEVICE(INTEL, DID_ADL_N_SKU10), .driver_data = (kernel_ulong_t)&adl_cfg }, | |
| 984 | - | { PCI_VDEVICE(INTEL, DID_ADL_N_SKU11), .driver_data = (kernel_ulong_t)&adl_cfg }, | |
| 985 | - | { PCI_VDEVICE(INTEL, DID_ADL_N_SKU12), .driver_data = (kernel_ulong_t)&adl_cfg }, | |
| 986 | - | { PCI_VDEVICE(INTEL, DID_AZB_SKU1), .driver_data = (kernel_ulong_t)&adl_cfg }, | |
| 987 | - | { PCI_VDEVICE(INTEL, DID_ASL_SKU1), .driver_data = (kernel_ulong_t)&adl_cfg }, | |
| 988 | - | { PCI_VDEVICE(INTEL, DID_ASL_SKU2), .driver_data = (kernel_ulong_t)&adl_cfg }, | |
| 989 | - | { PCI_VDEVICE(INTEL, DID_ASL_SKU3), .driver_data = (kernel_ulong_t)&adl_cfg }, | |
| 990 | - | { PCI_VDEVICE(INTEL, DID_RPL_P_SKU1), .driver_data = (kernel_ulong_t)&adl_cfg }, | |
| 991 | - | { PCI_VDEVICE(INTEL, DID_RPL_P_SKU2), .driver_data = (kernel_ulong_t)&adl_cfg }, | |
| 992 | - | { PCI_VDEVICE(INTEL, DID_RPL_P_SKU3), .driver_data = (kernel_ulong_t)&adl_cfg }, | |
| 993 | - | { PCI_VDEVICE(INTEL, DID_RPL_P_SKU4), .driver_data = (kernel_ulong_t)&adl_cfg }, | |
| 994 | - | { PCI_VDEVICE(INTEL, DID_RPL_P_SKU5), .driver_data = (kernel_ulong_t)&adl_cfg }, | |
| 864 | + | { PCI_VDEVICE(INTEL, DID_ADL_N_SKU1), .driver_data = (kernel_ulong_t)&adl_n_cfg }, | |
| 865 | + | { PCI_VDEVICE(INTEL, DID_ADL_N_SKU2), .driver_data = (kernel_ulong_t)&adl_n_cfg }, | |
| 866 | + | { PCI_VDEVICE(INTEL, DID_ADL_N_SKU3), .driver_data = (kernel_ulong_t)&adl_n_cfg }, | |
| 867 | + | { PCI_VDEVICE(INTEL, DID_ADL_N_SKU4), .driver_data = (kernel_ulong_t)&adl_n_cfg }, | |
| 868 | + | { PCI_VDEVICE(INTEL, DID_ADL_N_SKU5), .driver_data = (kernel_ulong_t)&adl_n_cfg }, | |
| 869 | + | { PCI_VDEVICE(INTEL, DID_ADL_N_SKU6), .driver_data = (kernel_ulong_t)&adl_n_cfg }, | |
| 870 | + | { PCI_VDEVICE(INTEL, DID_ADL_N_SKU7), .driver_data = (kernel_ulong_t)&adl_n_cfg }, | |
| 871 | + | { PCI_VDEVICE(INTEL, DID_ADL_N_SKU8), .driver_data = (kernel_ulong_t)&adl_n_cfg }, | |
| 872 | + | { PCI_VDEVICE(INTEL, DID_ADL_N_SKU9), .driver_data = (kernel_ulong_t)&adl_n_cfg }, | |
| 873 | + | { PCI_VDEVICE(INTEL, DID_ADL_N_SKU10), .driver_data = (kernel_ulong_t)&adl_n_cfg }, | |
| 874 | + | { PCI_VDEVICE(INTEL, DID_ADL_N_SKU11), .driver_data = (kernel_ulong_t)&adl_n_cfg }, | |
| 875 | + | { PCI_VDEVICE(INTEL, DID_ADL_N_SKU12), .driver_data = (kernel_ulong_t)&adl_n_cfg }, | |
| 876 | + | { PCI_VDEVICE(INTEL, DID_AZB_SKU1), .driver_data = (kernel_ulong_t)&adl_n_cfg }, | |
| 877 | + | { PCI_VDEVICE(INTEL, DID_ASL_SKU1), .driver_data = (kernel_ulong_t)&adl_n_cfg }, | |
| 878 | + | { PCI_VDEVICE(INTEL, DID_ASL_SKU2), .driver_data = (kernel_ulong_t)&adl_n_cfg }, | |
| 879 | + | { PCI_VDEVICE(INTEL, DID_ASL_SKU3), .driver_data = (kernel_ulong_t)&adl_n_cfg }, | |
| 880 | + | { PCI_VDEVICE(INTEL, DID_RPL_P_SKU1), .driver_data = (kernel_ulong_t)&rpl_p_cfg }, | |
| 881 | + | { PCI_VDEVICE(INTEL, DID_RPL_P_SKU2), .driver_data = (kernel_ulong_t)&rpl_p_cfg }, | |
| 882 | + | { PCI_VDEVICE(INTEL, DID_RPL_P_SKU3), .driver_data = (kernel_ulong_t)&rpl_p_cfg }, | |
| 883 | + | { PCI_VDEVICE(INTEL, DID_RPL_P_SKU4), .driver_data = (kernel_ulong_t)&rpl_p_cfg }, | |
| 884 | + | { PCI_VDEVICE(INTEL, DID_RPL_P_SKU5), .driver_data = (kernel_ulong_t)&rpl_p_cfg }, | |
| 995 | 885 | { PCI_VDEVICE(INTEL, DID_MTL_PS_SKU1), .driver_data = (kernel_ulong_t)&mtl_ps_cfg }, | |
| 996 | 886 | { PCI_VDEVICE(INTEL, DID_MTL_PS_SKU2), .driver_data = (kernel_ulong_t)&mtl_ps_cfg }, | |
| 997 | 887 | { PCI_VDEVICE(INTEL, DID_MTL_PS_SKU3), .driver_data = (kernel_ulong_t)&mtl_ps_cfg }, | |
| @@ -1002,7 +892,6 @@ static struct pci_device_id igen6_pci_tbl[] = { | |||
| 1002 | 892 | { PCI_VDEVICE(INTEL, DID_ARL_UH_SKU1), .driver_data = (kernel_ulong_t)&mtl_p_cfg }, | |
| 1003 | 893 | { PCI_VDEVICE(INTEL, DID_ARL_UH_SKU2), .driver_data = (kernel_ulong_t)&mtl_p_cfg }, | |
| 1004 | 894 | { PCI_VDEVICE(INTEL, DID_ARL_UH_SKU3), .driver_data = (kernel_ulong_t)&mtl_p_cfg }, | |
| 1005 | - | { PCI_VDEVICE(INTEL, DID_WCL_SKU1), .driver_data = (kernel_ulong_t)&mtl_p_cfg }, | |
| 1006 | 895 | { PCI_VDEVICE(INTEL, DID_PTL_H_SKU1), .driver_data = (kernel_ulong_t)&ptl_h_cfg }, | |
| 1007 | 896 | { PCI_VDEVICE(INTEL, DID_PTL_H_SKU2), .driver_data = (kernel_ulong_t)&ptl_h_cfg }, | |
| 1008 | 897 | { PCI_VDEVICE(INTEL, DID_PTL_H_SKU3), .driver_data = (kernel_ulong_t)&ptl_h_cfg }, | |
| @@ -1017,7 +906,7 @@ static struct pci_device_id igen6_pci_tbl[] = { | |||
| 1017 | 906 | { PCI_VDEVICE(INTEL, DID_PTL_H_SKU12), .driver_data = (kernel_ulong_t)&ptl_h_cfg }, | |
| 1018 | 907 | { PCI_VDEVICE(INTEL, DID_PTL_H_SKU13), .driver_data = (kernel_ulong_t)&ptl_h_cfg }, | |
| 1019 | 908 | { PCI_VDEVICE(INTEL, DID_PTL_H_SKU14), .driver_data = (kernel_ulong_t)&ptl_h_cfg }, | |
| 1020 | - | { PCI_VDEVICE(INTEL, DID_STF_SKU1), .driver_data = (kernel_ulong_t)&ptl_h_cfg }, | |
| 909 | + | { PCI_VDEVICE(INTEL, DID_WCL_SKU1), .driver_data = (kernel_ulong_t)&wcl_cfg }, | |
| 1021 | 910 | { PCI_VDEVICE(INTEL, DID_NVL_H_SKU1), .driver_data = (kernel_ulong_t)&nvl_h_cfg }, | |
| 1022 | 911 | { PCI_VDEVICE(INTEL, DID_NVL_H_SKU2), .driver_data = (kernel_ulong_t)&nvl_h_cfg }, | |
| 1023 | 912 | { PCI_VDEVICE(INTEL, DID_NVL_H_SKU3), .driver_data = (kernel_ulong_t)&nvl_h_cfg }, | |
| @@ -1118,13 +1007,55 @@ static void set_dimm_params(struct igen6_imc *imc, int chan) | |||
| 1118 | 1007 | imc->dimm_s_size[chan] = MAD_DIMM_CH_DIMM_S_SIZE(val); | |
| 1119 | 1008 | } | |
| 1120 | 1009 | ||
| 1010 | + | static int decode_chan_idx(u64 addr, u64 mask, int intlv_bit) | |
| 1011 | + | { | |
| 1012 | + | u64 hash_addr = addr & mask, hash = 0; | |
| 1013 | + | u64 intlv = (addr >> intlv_bit) & 1; | |
| 1014 | + | int i; | |
| 1015 | + | ||
| 1016 | + | for (i = 6; i < 20; i++) | |
| 1017 | + | hash ^= (hash_addr >> i) & 1; | |
| 1018 | + | ||
| 1019 | + | return (int)hash ^ intlv; | |
| 1020 | + | } | |
| 1021 | + | ||
| 1022 | + | static u64 decode_channel_addr(u64 addr, int intlv_bit) | |
| 1023 | + | { | |
| 1024 | + | u64 channel_addr; | |
| 1025 | + | ||
| 1026 | + | /* Remove the interleave bit and shift upper part down to fill gap */ | |
| 1027 | + | channel_addr = GET_BITFIELD(addr, intlv_bit + 1, 63) << intlv_bit; | |
| 1028 | + | channel_addr |= GET_BITFIELD(addr, 0, intlv_bit - 1); | |
| 1029 | + | ||
| 1030 | + | return channel_addr; | |
| 1031 | + | } | |
| 1032 | + | ||
| 1033 | + | static void decode_addr(u64 addr, u32 hash, u64 s_size, int l_map, | |
| 1034 | + | int *idx, u64 *sub_addr) | |
| 1035 | + | { | |
| 1036 | + | int intlv_bit = CHANNEL_HASH_LSB_MASK_BIT(hash) + 6; | |
| 1037 | + | ||
| 1038 | + | if (addr > 2 * s_size) { | |
| 1039 | + | *sub_addr = addr - s_size; | |
| 1040 | + | *idx = l_map; | |
| 1041 | + | return; | |
| 1042 | + | } | |
| 1043 | + | ||
| 1044 | + | if (CHANNEL_HASH_MODE(hash)) { | |
| 1045 | + | *sub_addr = decode_channel_addr(addr, intlv_bit); | |
| 1046 | + | *idx = decode_chan_idx(addr, CHANNEL_HASH_MASK(hash), intlv_bit); | |
| 1047 | + | } else { | |
| 1048 | + | *sub_addr = decode_channel_addr(addr, 6); | |
| 1049 | + | *idx = GET_BITFIELD(addr, 6, 6); | |
| 1050 | + | } | |
| 1051 | + | } | |
| 1052 | + | ||
| 1121 | 1053 | static int igen6_decode(struct decoded_addr *res) | |
| 1122 | 1054 | { | |
| 1123 | 1055 | struct igen6_imc *imc = &igen6_pvt->imc[res->mc]; | |
| 1124 | - | u64 addr = res->imc_addr, s_size; | |
| 1125 | - | int intlv_bit, l_map; | |
| 1126 | - | u32 hash, hash_mask; | |
| 1127 | - | struct slice slice; | |
| 1056 | + | u64 addr = res->imc_addr, sub_addr, s_size; | |
| 1057 | + | int idx, l_map; | |
| 1058 | + | u32 hash; | |
| 1128 | 1059 | ||
| 1129 | 1060 | if (addr >= igen6_tom) { | |
| 1130 | 1061 | edac_dbg(0, "Address 0x%llx out of range\n", addr); | |
| @@ -1135,25 +1066,17 @@ static int igen6_decode(struct decoded_addr *res) | |||
| 1135 | 1066 | hash = readl(imc->window + CHANNEL_HASH_OFFSET); | |
| 1136 | 1067 | s_size = imc->ch_s_size; | |
| 1137 | 1068 | l_map = imc->ch_l_map; | |
| 1138 | - | hash_mask = CHANNEL_HASH_MODE(hash) ? CHANNEL_HASH_MASK(hash) : 0; | |
| 1139 | - | intlv_bit = CHANNEL_HASH_LSB_MASK_BIT(hash) + 6; | |
| 1140 | - | ||
| 1141 | - | translate_to_lower_level(addr, hash_mask, 0, intlv_bit, s_size, l_map, &slice); | |
| 1142 | - | ||
| 1143 | - | res->channel_idx = slice.id; | |
| 1144 | - | res->channel_addr = slice.addr; | |
| 1069 | + | decode_addr(addr, hash, s_size, l_map, &idx, &sub_addr); | |
| 1070 | + | res->channel_idx = idx; | |
| 1071 | + | res->channel_addr = sub_addr; | |
| 1145 | 1072 | ||
| 1146 | 1073 | /* Decode sub-channel/DIMM */ | |
| 1147 | 1074 | hash = readl(imc->window + CHANNEL_EHASH_OFFSET); | |
| 1148 | - | s_size = imc->dimm_s_size[res->channel_idx]; | |
| 1149 | - | l_map = imc->dimm_l_map[res->channel_idx]; | |
| 1150 | - | hash_mask = CHANNEL_HASH_MODE(hash) ? CHANNEL_HASH_MASK(hash) : 0; | |
| 1151 | - | intlv_bit = CHANNEL_HASH_LSB_MASK_BIT(hash) + 6; | |
| 1152 | - | ||
| 1153 | - | translate_to_lower_level(res->channel_addr, hash_mask, 0, intlv_bit, s_size, l_map, &slice); | |
| 1154 | - | ||
| 1155 | - | res->sub_channel_idx = slice.id; | |
| 1156 | - | res->sub_channel_addr = slice.addr; | |
| 1075 | + | s_size = imc->dimm_s_size[idx]; | |
| 1076 | + | l_map = imc->dimm_l_map[idx]; | |
| 1077 | + | decode_addr(res->channel_addr, hash, s_size, l_map, &idx, &sub_addr); | |
| 1078 | + | res->sub_channel_idx = idx; | |
| 1079 | + | res->sub_channel_addr = sub_addr; | |
| 1157 | 1080 | ||
| 1158 | 1081 | return 0; | |
| 1159 | 1082 | } | |
| @@ -1307,7 +1230,11 @@ static void ecclog_work_cb(struct work_struct *work) | |||
| 1307 | 1230 | ||
| 1308 | 1231 | llist_for_each_entry_safe(node, tmp, head, llnode) { | |
| 1309 | 1232 | memset(&res, 0, sizeof(res)); | |
| 1310 | - | eaddr = node->ecclog & res_cfg->reg_eccerrlog_addr_mask; | |
| 1233 | + | if (res_cfg->err_addr) | |
| 1234 | + | eaddr = res_cfg->err_addr(node->ecclog); | |
| 1235 | + | else | |
| 1236 | + | eaddr = node->ecclog & res_cfg->reg_eccerrlog_addr_mask; | |
| 1237 | + | ||
| 1311 | 1238 | res.mc = node->mc; | |
| 1312 | 1239 | res.sys_addr = res_cfg->err_addr_to_sys_addr(eaddr, res.mc); | |
| 1313 | 1240 | res.imc_addr = res_cfg->err_addr_to_imc_addr(eaddr, res.mc); | |
| @@ -1549,27 +1476,18 @@ static struct igen6_pvt *igen6_pvt_setup(struct pci_dev *pdev) | |||
| 1549 | 1476 | { | |
| 1550 | 1477 | void __iomem *memss_pma_cr; | |
| 1551 | 1478 | struct igen6_pvt *pvt; | |
| 1552 | - | int imc_num, rc; | |
| 1553 | 1479 | u64 mchbar; | |
| 1480 | + | int rc; | |
| 1554 | 1481 | ||
| 1555 | - | rc = get_mchbar(pdev, &mchbar); | |
| 1556 | - | if (rc) | |
| 1482 | + | pvt = kzalloc_obj(*igen6_pvt); | |
| 1483 | + | if (!pvt) | |
| 1557 | 1484 | return NULL; | |
| 1558 | 1485 | ||
| 1559 | - | imc_num = get_imc_num(mchbar); | |
| 1560 | - | if (!imc_num) { | |
| 1561 | - | igen6_printk(KERN_ERR, "No mc found.\n"); | |
| 1486 | + | rc = get_mchbar(pdev, &mchbar); | |
| 1487 | + | if (rc) { | |
| 1488 | + | kfree(pvt); | |
| 1562 | 1489 | return NULL; | |
| 1563 | 1490 | } | |
| 1564 | - | edac_dbg(2, "%d mcs found.\n", imc_num); | |
| 1565 | - | ||
| 1566 | - | /* Use the runtime detected IMC count. */ | |
| 1567 | - | if (res_cfg->num_imc != imc_num) | |
| 1568 | - | res_cfg->num_imc = imc_num; | |
| 1569 | - | ||
| 1570 | - | pvt = kzalloc_flex(*pvt, imc, imc_num); | |
| 1571 | - | if (!pvt) | |
| 1572 | - | return NULL; | |
| 1573 | 1491 | ||
| 1574 | 1492 | memss_pma_cr = ioremap(mchbar, MCHBAR_SIZE * 2); | |
| 1575 | 1493 | if (!memss_pma_cr) { | |
| @@ -1654,6 +1572,12 @@ static void igen6_check(struct mem_ctl_info *mci) | |||
| 1654 | 1572 | irq_work_queue(&ecclog_irq_work); | |
| 1655 | 1573 | } | |
| 1656 | 1574 | ||
| 1575 | + | /* Check whether the memory controller is absent. */ | |
| 1576 | + | static bool igen6_imc_absent(void __iomem *window) | |
| 1577 | + | { | |
| 1578 | + | return readl(window + MAD_INTER_CHANNEL_OFFSET) == ~0; | |
| 1579 | + | } | |
| 1580 | + | ||
| 1657 | 1581 | static void imc_release(struct device *dev) | |
| 1658 | 1582 | { | |
| 1659 | 1583 | /* Nothing to do, the 'imc' owns the 'dev' and will also release it. */ | |
| @@ -1765,15 +1689,26 @@ static int igen6_register_mcis(struct pci_dev *pdev, u64 mchbar) | |||
| 1765 | 1689 | { | |
| 1766 | 1690 | void __iomem *window; | |
| 1767 | 1691 | int lmc, pmc, rc; | |
| 1692 | + | u64 base; | |
| 1693 | + | ||
| 1694 | + | for (lmc = 0, pmc = 0; pmc < NUM_IMC; pmc++) { | |
| 1695 | + | base = mchbar + pmc * MCHBAR_SIZE; | |
| 1696 | + | window = ioremap(base, MCHBAR_SIZE); | |
| 1697 | + | if (!window) { | |
| 1698 | + | igen6_printk(KERN_ERR, "Failed to ioremap 0x%llx for mc%d\n", base, pmc); | |
| 1699 | + | rc = -ENOMEM; | |
| 1700 | + | goto out_unregister_mcis; | |
| 1701 | + | } | |
| 1768 | 1702 | ||
| 1769 | - | for (lmc = 0, pmc = 0; pmc < MAX_IMC_TO_PROBE; pmc++) { | |
| 1770 | - | window = map_imc_window(mchbar, pmc); | |
| 1771 | - | if (!window) | |
| 1703 | + | if (igen6_imc_absent(window)) { | |
| 1704 | + | iounmap(window); | |
| 1705 | + | edac_dbg(2, "Skip absent mc%d\n", pmc); | |
| 1772 | 1706 | continue; | |
| 1707 | + | } | |
| 1773 | 1708 | ||
| 1774 | 1709 | rc = igen6_register_mci(lmc, window, pdev); | |
| 1775 | 1710 | if (rc) | |
| 1776 | - | goto err_unregister; | |
| 1711 | + | goto out_iounmap; | |
| 1777 | 1712 | ||
| 1778 | 1713 | /* Done, if all present MCs are detected and registered. */ | |
| 1779 | 1714 | if (++lmc >= res_cfg->num_imc) | |
| @@ -1793,8 +1728,10 @@ static int igen6_register_mcis(struct pci_dev *pdev, u64 mchbar) | |||
| 1793 | 1728 | ||
| 1794 | 1729 | return 0; | |
| 1795 | 1730 | ||
| 1796 | - | err_unregister: | |
| 1731 | + | out_iounmap: | |
| 1797 | 1732 | iounmap(window); | |
| 1733 | + | ||
| 1734 | + | out_unregister_mcis: | |
| 1798 | 1735 | igen6_unregister_mcis(); | |
| 1799 | 1736 | ||
| 1800 | 1737 | return rc; | |
modified drivers/edac/thunderx_edac.c
| @@ -729,8 +729,10 @@ static int thunderx_lmc_probe(struct pci_dev *pdev, | |||
| 729 | 729 | thunderx_lmc_err_isr, | |
| 730 | 730 | thunderx_lmc_threaded_isr, 0, | |
| 731 | 731 | "[EDAC] ThunderX LMC", mci); | |
| 732 | - | if (ret) | |
| 732 | + | if (ret) { | |
| 733 | + | dev_err(&pdev->dev, "Cannot set ISR: %d\n", ret); | |
| 733 | 734 | goto err_free; | |
| 735 | + | } | |
| 734 | 736 | ||
| 735 | 737 | lmc->node = FIELD_GET(THUNDERX_NODE, pci_resource_start(pdev, 0)); | |
| 736 | 738 | ||
modified drivers/edac/versalnet_edac.c
| @@ -813,7 +813,7 @@ static int init_one_mc(struct mc_priv *priv, struct platform_device *pdev, int i | |||
| 813 | 813 | layers[1].is_virt_csrow = false; | |
| 814 | 814 | ||
| 815 | 815 | rc = -ENOMEM; | |
| 816 | - | dev = kzalloc_obj(*dev); | |
| 816 | + | dev = kzalloc(sizeof(*dev), GFP_KERNEL); | |
| 817 | 817 | if (!dev) | |
| 818 | 818 | return rc; | |
| 819 | 819 | ||
| @@ -953,7 +953,6 @@ static void mc_remove(struct platform_device *pdev) | |||
| 953 | 953 | remove_versalnet(priv); | |
| 954 | 954 | rproc_shutdown(priv->mcdi->r5_rproc); | |
| 955 | 955 | cdx_mcdi_finish(priv->mcdi); | |
| 956 | - | rproc_put(priv->mcdi->r5_rproc); | |
| 957 | 956 | kfree(priv->mcdi); | |
| 958 | 957 | } | |
| 959 | 958 | ||
modified drivers/edac/xgene_edac.c
| @@ -1924,8 +1924,11 @@ static int xgene_edac_probe(struct platform_device *pdev) | |||
| 1924 | 1924 | rc = devm_request_irq(&pdev->dev, irq, | |
| 1925 | 1925 | xgene_edac_isr, IRQF_SHARED, | |
| 1926 | 1926 | dev_name(&pdev->dev), edac); | |
| 1927 | - | if (rc) | |
| 1927 | + | if (rc) { | |
| 1928 | + | dev_err(&pdev->dev, | |
| 1929 | + | "Could not request IRQ %d\n", irq); | |
| 1928 | 1930 | goto out_err; | |
| 1931 | + | } | |
| 1929 | 1932 | } | |
| 1930 | 1933 | } | |
| 1931 | 1934 | ||
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 | * | |
| @@ -1792,7 +1792,7 @@ static void *scmi_iterator_init(const struct scmi_protocol_handle *ph, | |||
| 1792 | 1792 | { | |
| 1793 | 1793 | int ret; | |
| 1794 | 1794 | ||
| 1795 | - | struct scmi_iterator *i __free(kfree) = kzalloc_obj(*i); | |
| 1795 | + | struct scmi_iterator *i __free(kfree) = kzalloc(sizeof(*i), GFP_KERNEL); | |
| 1796 | 1796 | if (!i) | |
| 1797 | 1797 | return ERR_PTR(-ENOMEM); | |
| 1798 | 1798 | ||
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/firmware/qcom/qcom_tzmem.c
| @@ -169,7 +169,7 @@ static int qcom_tzmem_init_area(struct qcom_tzmem_area *area) | |||
| 169 | 169 | { | |
| 170 | 170 | int ret; | |
| 171 | 171 | ||
| 172 | - | u64 *handle __free(kfree) = kzalloc_obj(*handle); | |
| 172 | + | u64 *handle __free(kfree) = kzalloc(sizeof(*handle), GFP_KERNEL); | |
| 173 | 173 | if (!handle) | |
| 174 | 174 | return -ENOMEM; | |
| 175 | 175 | ||
| @@ -197,7 +197,8 @@ static int qcom_tzmem_pool_add_memory(struct qcom_tzmem_pool *pool, | |||
| 197 | 197 | { | |
| 198 | 198 | int ret; | |
| 199 | 199 | ||
| 200 | - | struct qcom_tzmem_area *area __free(kfree) = kzalloc_obj(*area, gfp); | |
| 200 | + | struct qcom_tzmem_area *area __free(kfree) = kzalloc(sizeof(*area), | |
| 201 | + | gfp); | |
| 201 | 202 | if (!area) | |
| 202 | 203 | return -ENOMEM; | |
| 203 | 204 | ||
| @@ -414,7 +415,8 @@ void *qcom_tzmem_alloc(struct qcom_tzmem_pool *pool, size_t size, gfp_t gfp) | |||
| 414 | 415 | ||
| 415 | 416 | size = PAGE_ALIGN(size); | |
| 416 | 417 | ||
| 417 | - | struct qcom_tzmem_chunk *chunk __free(kfree) = kzalloc_obj(*chunk, gfp); | |
| 418 | + | struct qcom_tzmem_chunk *chunk __free(kfree) = kzalloc(sizeof(*chunk), | |
| 419 | + | gfp); | |
| 418 | 420 | if (!chunk) | |
| 419 | 421 | return NULL; | |
| 420 | 422 | ||
modified drivers/firmware/ti_sci.c
| @@ -2386,7 +2386,7 @@ static int ti_sci_set_irq(const struct ti_sci_handle *handle, u32 valid_params, | |||
| 2386 | 2386 | if (ret || !(info->fw_caps & MSG_FLAG_CAPS_LPM_IRQ_CONTEXT_LOST)) | |
| 2387 | 2387 | goto end; | |
| 2388 | 2388 | ||
| 2389 | - | irq = kzalloc_obj(*irq); | |
| 2389 | + | irq = kzalloc_obj(*irq, GFP_KERNEL); | |
| 2390 | 2390 | if (!irq) { | |
| 2391 | 2391 | ti_sci_manage_irq(handle, valid_params, src_id, src_index, | |
| 2392 | 2392 | dst_id, dst_host_irq, ia_id, vint, | |
modified drivers/fpga/dfl-afu-dma-region.c
| @@ -316,7 +316,7 @@ int afu_dma_map_region(struct dfl_feature_dev_data *fdata, | |||
| 316 | 316 | if (user_addr + length < user_addr) | |
| 317 | 317 | return -EINVAL; | |
| 318 | 318 | ||
| 319 | - | region = kzalloc_obj(*region); | |
| 319 | + | region = kzalloc(sizeof(*region), GFP_KERNEL); | |
| 320 | 320 | if (!region) | |
| 321 | 321 | return -ENOMEM; | |
| 322 | 322 | ||
modified drivers/gpio/gpio-aggregator.c
| @@ -886,8 +886,8 @@ gpio_aggregator_make_device_sw_node(struct gpio_aggregator *aggr) | |||
| 886 | 886 | if (num_lines == 0) | |
| 887 | 887 | return NULL; | |
| 888 | 888 | ||
| 889 | - | const char **line_names __free(kfree) = kzalloc_objs(*line_names, | |
| 890 | - | num_lines); | |
| 889 | + | const char **line_names __free(kfree) = kcalloc( | |
| 890 | + | num_lines, sizeof(*line_names), GFP_KERNEL); | |
| 891 | 891 | if (!line_names) | |
| 892 | 892 | return ERR_PTR(-ENOMEM); | |
| 893 | 893 | ||
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-exar.c
| @@ -199,7 +199,6 @@ static int gpio_exar_probe(struct platform_device *pdev) | |||
| 199 | 199 | index = ida_alloc(&ida_index, GFP_KERNEL); | |
| 200 | 200 | if (index < 0) | |
| 201 | 201 | return index; | |
| 202 | - | exar_gpio->index = index; | |
| 203 | 202 | ||
| 204 | 203 | ret = devm_add_action_or_reset(dev, exar_devm_ida_free, exar_gpio); | |
| 205 | 204 | if (ret) | |
| @@ -215,6 +214,7 @@ static int gpio_exar_probe(struct platform_device *pdev) | |||
| 215 | 214 | exar_gpio->gpio_chip.set = exar_set_value; | |
| 216 | 215 | exar_gpio->gpio_chip.base = -1; | |
| 217 | 216 | exar_gpio->gpio_chip.ngpio = ngpios; | |
| 217 | + | exar_gpio->index = index; | |
| 218 | 218 | exar_gpio->first_pin = first_pin; | |
| 219 | 219 | ||
| 220 | 220 | ret = devm_gpiochip_add_data(dev, &exar_gpio->gpio_chip, exar_gpio); | |
modified drivers/gpio/gpio-mpsse.c
| @@ -10,7 +10,6 @@ | |||
| 10 | 10 | #include <linux/cleanup.h> | |
| 11 | 11 | #include <linux/gpio/driver.h> | |
| 12 | 12 | #include <linux/mutex.h> | |
| 13 | - | #include <linux/rcupdate.h> | |
| 14 | 13 | #include <linux/spinlock.h> | |
| 15 | 14 | #include <linux/usb.h> | |
| 16 | 15 | ||
| @@ -25,7 +24,6 @@ struct mpsse_priv { | |||
| 25 | 24 | raw_spinlock_t irq_spin; /* protects worker list */ | |
| 26 | 25 | atomic_t irq_type[16]; /* pin -> edge detection type */ | |
| 27 | 26 | atomic_t irq_enabled; | |
| 28 | - | atomic_t dying; /* no new workers after disconnect */ | |
| 29 | 27 | int id; | |
| 30 | 28 | ||
| 31 | 29 | u8 gpio_outputs[2]; /* Output states for GPIOs [L, H] */ | |
| @@ -48,7 +46,6 @@ struct mpsse_worker { | |||
| 48 | 46 | atomic_t cancelled; | |
| 49 | 47 | struct list_head list; /* linked list */ | |
| 50 | 48 | struct list_head destroy; /* teardown linked list */ | |
| 51 | - | struct rcu_head rcu; /* deferred free for dying path */ | |
| 52 | 49 | }; | |
| 53 | 50 | ||
| 54 | 51 | struct bulk_desc { | |
| @@ -521,31 +518,17 @@ static void gpio_mpsse_irq_enable(struct irq_data *irqd) | |||
| 521 | 518 | * Can't be devm because it uses a non-raw spinlock (illegal in | |
| 522 | 519 | * this context, where a raw spinlock is held by our caller) | |
| 523 | 520 | */ | |
| 524 | - | worker = kzalloc_obj(*worker, GFP_NOWAIT); | |
| 521 | + | worker = kzalloc(sizeof(*worker), GFP_NOWAIT); | |
| 525 | 522 | if (!worker) | |
| 526 | 523 | return; | |
| 527 | 524 | ||
| 528 | 525 | worker->priv = priv; | |
| 529 | 526 | INIT_LIST_HEAD(&worker->list); | |
| 530 | 527 | INIT_WORK(&worker->work, gpio_mpsse_poll); | |
| 528 | + | schedule_work(&worker->work); | |
| 531 | 529 | ||
| 532 | - | scoped_guard(raw_spinlock_irqsave, &priv->irq_spin) { | |
| 533 | - | if (atomic_read(&priv->dying)) { | |
| 534 | - | /* | |
| 535 | - | * Cannot kfree() here: this callback | |
| 536 | - | * runs with the IRQ descriptor's raw | |
| 537 | - | * spinlock held and kfree() may sleep | |
| 538 | - | * on PREEMPT_RT. The worker is not | |
| 539 | - | * yet published, so the deferred free | |
| 540 | - | * is unobservable. | |
| 541 | - | */ | |
| 542 | - | kfree_rcu(worker, rcu); | |
| 543 | - | return; | |
| 544 | - | } | |
| 545 | - | ||
| 530 | + | scoped_guard(raw_spinlock_irqsave, &priv->irq_spin) | |
| 546 | 531 | list_add(&worker->list, &priv->workers); | |
| 547 | - | schedule_work(&worker->work); | |
| 548 | - | } | |
| 549 | 532 | } | |
| 550 | 533 | } | |
| 551 | 534 | ||
| @@ -721,9 +704,6 @@ static void gpio_mpsse_disconnect(struct usb_interface *intf) | |||
| 721 | 704 | { | |
| 722 | 705 | struct mpsse_priv *priv = usb_get_intfdata(intf); | |
| 723 | 706 | ||
| 724 | - | scoped_guard(raw_spinlock_irqsave, &priv->irq_spin) | |
| 725 | - | atomic_set(&priv->dying, 1); | |
| 726 | - | ||
| 727 | 707 | /* | |
| 728 | 708 | * Lock prevents double-free of worker from here and the teardown | |
| 729 | 709 | * step at the beginning of gpio_mpsse_poll | |
modified drivers/gpio/gpio-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-sim.c
| @@ -790,7 +790,8 @@ gpio_sim_make_bank_swnode(struct gpio_sim_bank *bank, | |||
| 790 | 790 | ||
| 791 | 791 | line_names_size = gpio_sim_get_line_names_size(bank); | |
| 792 | 792 | if (line_names_size) { | |
| 793 | - | line_names = kzalloc_objs(*line_names, line_names_size); | |
| 793 | + | line_names = kcalloc(line_names_size, sizeof(*line_names), | |
| 794 | + | GFP_KERNEL); | |
| 794 | 795 | if (!line_names) | |
| 795 | 796 | return ERR_PTR(-ENOMEM); | |
| 796 | 797 | ||
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; | |
| @@ -1430,7 +1429,8 @@ gpio_virtuser_make_device_swnode(struct gpio_virtuser_device *dev) | |||
| 1430 | 1429 | memset(properties, 0, sizeof(properties)); | |
| 1431 | 1430 | ||
| 1432 | 1431 | num_ids = list_count_nodes(&dev->lookup_list); | |
| 1433 | - | char **ids __free(kfree) = kzalloc_objs(*ids, num_ids + 1); | |
| 1432 | + | char **ids __free(kfree) = kcalloc(num_ids + 1, sizeof(*ids), | |
| 1433 | + | GFP_KERNEL); | |
| 1434 | 1434 | if (!ids) | |
| 1435 | 1435 | return ERR_PTR(-ENOMEM); | |
| 1436 | 1436 | ||
modified drivers/gpio/gpio-xilinx.c
| @@ -271,7 +271,14 @@ static void xgpio_save_regs(struct xgpio_instance *chip) | |||
| 271 | 271 | ||
| 272 | 272 | static int xgpio_request(struct gpio_chip *chip, unsigned int offset) | |
| 273 | 273 | { | |
| 274 | - | return pm_runtime_resume_and_get(chip->parent); | |
| 274 | + | int ret; | |
| 275 | + | ||
| 276 | + | ret = pm_runtime_get_sync(chip->parent); | |
| 277 | + | /* | |
| 278 | + | * If the device is already active pm_runtime_get() will return 1 on | |
| 279 | + | * success, but gpio_request still needs to return 0. | |
| 280 | + | */ | |
| 281 | + | return ret < 0 ? ret : 0; | |
| 275 | 282 | } | |
| 276 | 283 | ||
| 277 | 284 | static void xgpio_free(struct gpio_chip *chip, unsigned int offset) | |
modified drivers/gpio/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; | |
| @@ -2671,7 +2653,7 @@ static int gpio_chrdev_open(struct inode *inode, struct file *file) | |||
| 2671 | 2653 | struct gpio_chardev_data *cdev; | |
| 2672 | 2654 | int ret = -ENOMEM; | |
| 2673 | 2655 | ||
| 2674 | - | cdev = kzalloc_obj(*cdev); | |
| 2656 | + | cdev = kzalloc(sizeof(*cdev), GFP_KERNEL); | |
| 2675 | 2657 | if (!cdev) | |
| 2676 | 2658 | return -ENOMEM; | |
| 2677 | 2659 | ||
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 | |
| @@ -1185,7 +1178,7 @@ int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data, | |||
| 1185 | 1178 | int base = 0; | |
| 1186 | 1179 | int ret; | |
| 1187 | 1180 | ||
| 1188 | - | gdev = kzalloc_obj(*gdev); | |
| 1181 | + | gdev = kzalloc(sizeof(*gdev), GFP_KERNEL); | |
| 1189 | 1182 | if (!gdev) | |
| 1190 | 1183 | return -ENOMEM; | |
| 1191 | 1184 | gc->gpiodev = gdev; | |
| @@ -1225,7 +1218,7 @@ int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data, | |||
| 1225 | 1218 | goto err_put_device; | |
| 1226 | 1219 | gdev->ngpio = gc->ngpio; | |
| 1227 | 1220 | ||
| 1228 | - | gdev->descs = kzalloc_objs(*gdev->descs, gc->ngpio); | |
| 1221 | + | gdev->descs = kcalloc(gc->ngpio, sizeof(*gdev->descs), GFP_KERNEL); | |
| 1229 | 1222 | if (!gdev->descs) { | |
| 1230 | 1223 | ret = -ENOMEM; | |
| 1231 | 1224 | goto err_put_device; | |
modified drivers/gpu/buddy.c
| @@ -411,13 +411,16 @@ int gpu_buddy_init(struct gpu_buddy *mm, u64 size, u64 chunk_size) | |||
| 411 | 411 | if (!mm->used_scoreboard) | |
| 412 | 412 | goto out_free_free_scoreboard; | |
| 413 | 413 | ||
| 414 | - | mm->free_trees = kmalloc_objs(*mm->free_trees, GPU_BUDDY_MAX_FREE_TREES); | |
| 414 | + | mm->free_trees = kmalloc_array(GPU_BUDDY_MAX_FREE_TREES, | |
| 415 | + | sizeof(*mm->free_trees), | |
| 416 | + | GFP_KERNEL); | |
| 415 | 417 | if (!mm->free_trees) | |
| 416 | 418 | goto out_free_used_scoreboard; | |
| 417 | 419 | ||
| 418 | 420 | for_each_free_tree(i) { | |
| 419 | - | mm->free_trees[i] = kmalloc_objs(struct rb_root, | |
| 420 | - | mm->max_order + 1); | |
| 421 | + | mm->free_trees[i] = kmalloc_array(mm->max_order + 1, | |
| 422 | + | sizeof(struct rb_root), | |
| 423 | + | GFP_KERNEL); | |
| 421 | 424 | if (!mm->free_trees[i]) | |
| 422 | 425 | goto out_free_tree; | |
| 423 | 426 | ||
| @@ -427,7 +430,9 @@ int gpu_buddy_init(struct gpu_buddy *mm, u64 size, u64 chunk_size) | |||
| 427 | 430 | ||
| 428 | 431 | mm->n_roots = hweight64(size); | |
| 429 | 432 | ||
| 430 | - | mm->roots = kmalloc_objs(struct gpu_buddy_block *, mm->n_roots); | |
| 433 | + | mm->roots = kmalloc_array(mm->n_roots, | |
| 434 | + | sizeof(struct gpu_buddy_block *), | |
| 435 | + | GFP_KERNEL); | |
| 431 | 436 | if (!mm->roots) | |
| 432 | 437 | goto out_free_tree; | |
| 433 | 438 | ||
modified drivers/gpu/drm/adp/Kconfig
| @@ -6,6 +6,7 @@ config DRM_ADP | |||
| 6 | 6 | select DRM_KMS_HELPER | |
| 7 | 7 | select DRM_BRIDGE_CONNECTOR | |
| 8 | 8 | select DRM_DISPLAY_HELPER | |
| 9 | + | select DRM_KMS_DMA_HELPER | |
| 9 | 10 | select DRM_GEM_DMA_HELPER | |
| 10 | 11 | select DRM_PANEL_BRIDGE | |
| 11 | 12 | select VIDEOMODE_HELPERS | |
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_acp.c
| @@ -318,7 +318,7 @@ static int acp_hw_init(struct amdgpu_ip_block *ip_block) | |||
| 318 | 318 | r = device_for_each_child(adev->acp.parent, &adev->acp.acp_genpd->gpd, | |
| 319 | 319 | acp_genpd_add_device); | |
| 320 | 320 | if (r) | |
| 321 | - | goto failure_remove_mfd; | |
| 321 | + | goto failure; | |
| 322 | 322 | break; | |
| 323 | 323 | } | |
| 324 | 324 | default: | |
| @@ -443,7 +443,7 @@ static int acp_hw_init(struct amdgpu_ip_block *ip_block) | |||
| 443 | 443 | r = device_for_each_child(adev->acp.parent, &adev->acp.acp_genpd->gpd, | |
| 444 | 444 | acp_genpd_add_device); | |
| 445 | 445 | if (r) | |
| 446 | - | goto failure_remove_mfd; | |
| 446 | + | goto failure; | |
| 447 | 447 | } | |
| 448 | 448 | ||
| 449 | 449 | /* Assert Soft reset of ACP */ | |
| @@ -461,7 +461,7 @@ static int acp_hw_init(struct amdgpu_ip_block *ip_block) | |||
| 461 | 461 | if (--count == 0) { | |
| 462 | 462 | dev_err(&adev->pdev->dev, "Failed to reset ACP\n"); | |
| 463 | 463 | r = -ETIMEDOUT; | |
| 464 | - | goto failure_remove_mfd; | |
| 464 | + | goto failure; | |
| 465 | 465 | } | |
| 466 | 466 | udelay(100); | |
| 467 | 467 | } | |
| @@ -479,7 +479,7 @@ static int acp_hw_init(struct amdgpu_ip_block *ip_block) | |||
| 479 | 479 | if (--count == 0) { | |
| 480 | 480 | dev_err(&adev->pdev->dev, "Failed to reset ACP\n"); | |
| 481 | 481 | r = -ETIMEDOUT; | |
| 482 | - | goto failure_remove_mfd; | |
| 482 | + | goto failure; | |
| 483 | 483 | } | |
| 484 | 484 | udelay(100); | |
| 485 | 485 | } | |
| @@ -489,11 +489,6 @@ static int acp_hw_init(struct amdgpu_ip_block *ip_block) | |||
| 489 | 489 | cgs_write_register(adev->acp.cgs_device, mmACP_SOFT_RESET, val); | |
| 490 | 490 | return 0; | |
| 491 | 491 | ||
| 492 | - | failure_remove_mfd: | |
| 493 | - | device_for_each_child(adev->acp.parent, NULL, | |
| 494 | - | acp_genpd_remove_device); | |
| 495 | - | mfd_remove_devices(adev->acp.parent); | |
| 496 | - | ||
| 497 | 492 | failure: | |
| 498 | 493 | kfree(adev->acp.i2s_pdata); | |
| 499 | 494 | kfree(adev->acp.acp_res); | |
modified drivers/gpu/drm/amd/amdgpu/amdgpu_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++) { | |
| @@ -598,18 +598,14 @@ int amdgpu_amdkfd_get_dmabuf_info(struct amdgpu_device *adev, int dma_buf_fd, | |||
| 598 | 598 | /* first get metadata_size by buffer = NULL */ | |
| 599 | 599 | r = amdgpu_bo_get_metadata(bo, NULL, 0, | |
| 600 | 600 | metadata_size, NULL); | |
| 601 | - | if (r) | |
| 602 | - | goto out_put; | |
| 603 | 601 | ||
| 604 | 602 | /* user buf_size is bigger than bo metadata_size | |
| 605 | 603 | * allocate a buf at kernel space and copy */ | |
| 606 | 604 | if (*metadata_size <= buffer_size) { | |
| 607 | 605 | *metadata_buffer = kzalloc(*metadata_size, GFP_KERNEL); | |
| 608 | 606 | ||
| 609 | - | if (!*metadata_buffer) { | |
| 610 | - | r = -ENOMEM; | |
| 611 | - | goto out_put; | |
| 612 | - | } | |
| 607 | + | if (!*metadata_buffer) | |
| 608 | + | return -ENOMEM; | |
| 613 | 609 | ||
| 614 | 610 | r = amdgpu_bo_get_metadata(bo, *metadata_buffer, *metadata_size, | |
| 615 | 611 | NULL, &metadata_flags); | |
modified drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
| @@ -121,20 +121,6 @@ static int amdgpu_debugfs_process_reg_op(bool read, struct file *f, | |||
| 121 | 121 | ||
| 122 | 122 | *pos &= (1UL << 22) - 1; | |
| 123 | 123 | ||
| 124 | - | if (size > PAGE_SIZE) | |
| 125 | - | return -EINVAL; | |
| 126 | - | ||
| 127 | - | /* | |
| 128 | - | * Access the user buffer only while none of the locks below are held: | |
| 129 | - | * a fault takes mmap_lock, and grbm_idx_mutex and srbm_mutex nest | |
| 130 | - | * inside it. | |
| 131 | - | */ | |
| 132 | - | u32 *data __free(kfree) = kmalloc(size, GFP_KERNEL); | |
| 133 | - | if (!data) | |
| 134 | - | return -ENOMEM; | |
| 135 | - | if (!read && copy_from_user(data, buf, size)) | |
| 136 | - | return -EFAULT; | |
| 137 | - | ||
| 138 | 124 | r = pm_runtime_get_sync(adev_to_drm(adev)->dev); | |
| 139 | 125 | if (r < 0) { | |
| 140 | 126 | pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); | |
| @@ -166,16 +152,28 @@ static int amdgpu_debugfs_process_reg_op(bool read, struct file *f, | |||
| 166 | 152 | mutex_lock(&adev->pm.mutex); | |
| 167 | 153 | ||
| 168 | 154 | while (size) { | |
| 169 | - | if (read) | |
| 170 | - | data[result >> 2] = RREG32(*pos >> 2); | |
| 171 | - | else | |
| 172 | - | amdgpu_mm_wreg_mmio_rlc(adev, *pos >> 2, data[result >> 2], 0); | |
| 155 | + | uint32_t value; | |
| 156 | + | ||
| 157 | + | if (read) { | |
| 158 | + | value = RREG32(*pos >> 2); | |
| 159 | + | r = put_user(value, (uint32_t *)buf); | |
| 160 | + | } else { | |
| 161 | + | r = get_user(value, (uint32_t *)buf); | |
| 162 | + | if (!r) | |
| 163 | + | amdgpu_mm_wreg_mmio_rlc(adev, *pos >> 2, value, 0); | |
| 164 | + | } | |
| 165 | + | if (r) { | |
| 166 | + | result = r; | |
| 167 | + | goto end; | |
| 168 | + | } | |
| 173 | 169 | ||
| 174 | 170 | result += 4; | |
| 171 | + | buf += 4; | |
| 175 | 172 | *pos += 4; | |
| 176 | 173 | size -= 4; | |
| 177 | 174 | } | |
| 178 | 175 | ||
| 176 | + | end: | |
| 179 | 177 | if (use_bank) { | |
| 180 | 178 | amdgpu_gfx_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff, 0); | |
| 181 | 179 | mutex_unlock(&adev->grbm_idx_mutex); | |
| @@ -190,10 +188,6 @@ static int amdgpu_debugfs_process_reg_op(bool read, struct file *f, | |||
| 190 | 188 | pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); | |
| 191 | 189 | ||
| 192 | 190 | amdgpu_virt_disable_access_debugfs(adev); | |
| 193 | - | ||
| 194 | - | if (read && copy_to_user(buf, data, result)) | |
| 195 | - | return -EFAULT; | |
| 196 | - | ||
| 197 | 191 | return result; | |
| 198 | 192 | } | |
| 199 | 193 | ||
| @@ -244,24 +238,11 @@ static ssize_t amdgpu_debugfs_regs2_op(struct file *f, char __user *buf, u32 off | |||
| 244 | 238 | struct amdgpu_device *adev = rd->adev; | |
| 245 | 239 | ssize_t result = 0; | |
| 246 | 240 | int r; | |
| 241 | + | uint32_t value; | |
| 247 | 242 | ||
| 248 | 243 | if (size & 0x3 || offset & 0x3) | |
| 249 | 244 | return -EINVAL; | |
| 250 | 245 | ||
| 251 | - | if (size > PAGE_SIZE) | |
| 252 | - | return -EINVAL; | |
| 253 | - | ||
| 254 | - | /* | |
| 255 | - | * Access the user buffer only while none of the locks below are held: | |
| 256 | - | * a fault takes mmap_lock, and grbm_idx_mutex and srbm_mutex nest | |
| 257 | - | * inside it. | |
| 258 | - | */ | |
| 259 | - | u32 *data __free(kfree) = kmalloc(size, GFP_KERNEL); | |
| 260 | - | if (!data) | |
| 261 | - | return -ENOMEM; | |
| 262 | - | if (write_en && copy_from_user(data, buf, size)) | |
| 263 | - | return -EFAULT; | |
| 264 | - | ||
| 265 | 246 | r = pm_runtime_get_sync(adev_to_drm(adev)->dev); | |
| 266 | 247 | if (r < 0) { | |
| 267 | 248 | pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); | |
| @@ -300,16 +281,24 @@ static ssize_t amdgpu_debugfs_regs2_op(struct file *f, char __user *buf, u32 off | |||
| 300 | 281 | mutex_lock(&adev->pm.mutex); | |
| 301 | 282 | ||
| 302 | 283 | while (size) { | |
| 303 | - | if (!write_en) | |
| 304 | - | data[result >> 2] = RREG32(offset >> 2); | |
| 305 | - | else | |
| 306 | - | amdgpu_mm_wreg_mmio_rlc(adev, offset >> 2, data[result >> 2], | |
| 307 | - | rd->id.xcc_id); | |
| 284 | + | if (!write_en) { | |
| 285 | + | value = RREG32(offset >> 2); | |
| 286 | + | r = put_user(value, (uint32_t *)buf); | |
| 287 | + | } else { | |
| 288 | + | r = get_user(value, (uint32_t *)buf); | |
| 289 | + | if (!r) | |
| 290 | + | amdgpu_mm_wreg_mmio_rlc(adev, offset >> 2, value, rd->id.xcc_id); | |
| 291 | + | } | |
| 292 | + | if (r) { | |
| 293 | + | result = r; | |
| 294 | + | goto end; | |
| 295 | + | } | |
| 308 | 296 | offset += 4; | |
| 309 | 297 | size -= 4; | |
| 310 | 298 | result += 4; | |
| 299 | + | buf += 4; | |
| 311 | 300 | } | |
| 312 | - | ||
| 301 | + | end: | |
| 313 | 302 | if (rd->id.use_grbm) { | |
| 314 | 303 | amdgpu_gfx_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff, rd->id.xcc_id); | |
| 315 | 304 | mutex_unlock(&adev->grbm_idx_mutex); | |
| @@ -328,10 +317,6 @@ static ssize_t amdgpu_debugfs_regs2_op(struct file *f, char __user *buf, u32 off | |||
| 328 | 317 | pm_runtime_put_autosuspend(adev_to_drm(adev)->dev); | |
| 329 | 318 | ||
| 330 | 319 | amdgpu_virt_disable_access_debugfs(adev); | |
| 331 | - | ||
| 332 | - | if (!write_en && copy_to_user(buf, data, result)) | |
| 333 | - | return -EFAULT; | |
| 334 | - | ||
| 335 | 320 | return result; | |
| 336 | 321 | } | |
| 337 | 322 | ||
| @@ -1795,10 +1780,8 @@ static int amdgpu_debugfs_test_ib_show(struct seq_file *m, void *unused) | |||
| 1795 | 1780 | ||
| 1796 | 1781 | /* Avoid accidently unparking the sched thread during GPU reset */ | |
| 1797 | 1782 | r = down_write_killable(&adev->reset_domain->sem); | |
| 1798 | - | if (r) { | |
| 1799 | - | pm_runtime_put_autosuspend(dev->dev); | |
| 1783 | + | if (r) | |
| 1800 | 1784 | return r; | |
| 1801 | - | } | |
| 1802 | 1785 | ||
| 1803 | 1786 | /* hold on the scheduler */ | |
| 1804 | 1787 | for (i = 0; i < AMDGPU_MAX_RINGS; i++) { | |
modified drivers/gpu/drm/amd/amdgpu/amdgpu_dev_coredump.c
| @@ -299,10 +299,10 @@ amdgpu_devcoredump_print_ibs(struct drm_printer *p, | |||
| 299 | 299 | amdgpu_res_first(abo->tbo.resource, offset, | |
| 300 | 300 | coredump->ibs[i].ib_size_dw * 4, &cursor); | |
| 301 | 301 | while (cursor.remaining) { | |
| 302 | - | amdgpu_device_mm_access(adev, cursor.start, | |
| 303 | - | &ib_content[off], cursor.size, | |
| 302 | + | amdgpu_device_mm_access(adev, cursor.start / 4, | |
| 303 | + | &ib_content[off], cursor.size / 4, | |
| 304 | 304 | false); | |
| 305 | - | off += cursor.size / 4; | |
| 305 | + | off += cursor.size; | |
| 306 | 306 | amdgpu_res_next(&cursor, cursor.size); | |
| 307 | 307 | } | |
| 308 | 308 | emit_content = true; | |
| @@ -603,8 +603,9 @@ void amdgpu_coredump(struct amdgpu_device *adev, bool skip_vram_check, | |||
| 603 | 603 | ring_count++; | |
| 604 | 604 | } | |
| 605 | 605 | if (ring_count) | |
| 606 | - | coredump->rings = kvzalloc_objs(struct amdgpu_coredump_ring, | |
| 607 | - | ring_count, GFP_NOWAIT); | |
| 606 | + | coredump->rings = kvcalloc(ring_count, | |
| 607 | + | sizeof(struct amdgpu_coredump_ring), | |
| 608 | + | GFP_NOWAIT); | |
| 608 | 609 | if (coredump->rings) { | |
| 609 | 610 | for (i = 0, idx = 0; i < adev->num_rings && idx < ring_count; i++) { | |
| 610 | 611 | struct amdgpu_coredump_ring *cdump_ring; | |
modified drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
| @@ -771,9 +771,6 @@ static int amdgpu_device_read_fb_via_bar0(struct amdgpu_device *adev, | |||
| 771 | 771 | if (!buf || !size) | |
| 772 | 772 | return -EINVAL; | |
| 773 | 773 | ||
| 774 | - | if (!amdgpu_sriov_vf(adev)) | |
| 775 | - | return -EINVAL; | |
| 776 | - | ||
| 777 | 774 | flags = pci_resource_flags(adev->pdev, 0); | |
| 778 | 775 | if ((flags & IORESOURCE_UNSET) || !(flags & IORESOURCE_MEM)) | |
| 779 | 776 | return -EINVAL; | |
| @@ -1954,17 +1951,18 @@ static void amdgpu_uid_fini(struct amdgpu_device *adev) | |||
| 1954 | 1951 | adev->uid_info = NULL; | |
| 1955 | 1952 | } | |
| 1956 | 1953 | ||
| 1957 | - | static void amdgpu_device_init_pcie_links(struct amdgpu_device *adev) | |
| 1954 | + | static struct pci_dev *amdgpu_device_find_parent(struct amdgpu_device *adev) | |
| 1958 | 1955 | { | |
| 1959 | - | adev->link_dev = adev->pdev; | |
| 1960 | - | adev->link_partner = pci_upstream_bridge(adev->link_dev); | |
| 1956 | + | struct pci_dev *parent = adev->pdev; | |
| 1961 | 1957 | ||
| 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); | |
| 1958 | + | /* skip upstream/downstream switches internal to dGPU */ | |
| 1959 | + | while ((parent = pci_upstream_bridge(parent))) { | |
| 1960 | + | if (parent->vendor == PCI_VENDOR_ID_ATI) | |
| 1961 | + | continue; | |
| 1962 | + | break; | |
| 1967 | 1963 | } | |
| 1964 | + | ||
| 1965 | + | return parent; | |
| 1968 | 1966 | } | |
| 1969 | 1967 | ||
| 1970 | 1968 | /** | |
| @@ -1980,6 +1978,7 @@ static void amdgpu_device_init_pcie_links(struct amdgpu_device *adev) | |||
| 1980 | 1978 | static int amdgpu_device_ip_early_init(struct amdgpu_device *adev) | |
| 1981 | 1979 | { | |
| 1982 | 1980 | struct amdgpu_ip_block *ip_block; | |
| 1981 | + | struct pci_dev *parent; | |
| 1983 | 1982 | bool total, skip_bios, early_full_gpu_access = false; | |
| 1984 | 1983 | uint32_t bios_flags; | |
| 1985 | 1984 | int i, r; | |
| @@ -2075,9 +2074,10 @@ static int amdgpu_device_ip_early_init(struct amdgpu_device *adev) | |||
| 2075 | 2074 | !dev_is_removable(&adev->pdev->dev)) | |
| 2076 | 2075 | adev->flags |= AMD_IS_PX; | |
| 2077 | 2076 | ||
| 2078 | - | if (!(adev->flags & AMD_IS_APU)) | |
| 2079 | - | adev->has_pr3 = adev->link_partner && | |
| 2080 | - | pci_pr3_present(adev->link_partner); | |
| 2077 | + | if (!(adev->flags & AMD_IS_APU)) { | |
| 2078 | + | parent = amdgpu_device_find_parent(adev); | |
| 2079 | + | adev->has_pr3 = parent ? pci_pr3_present(parent) : false; | |
| 2080 | + | } | |
| 2081 | 2081 | ||
| 2082 | 2082 | adev->pm.pp_feature = amdgpu_pp_feature_mask; | |
| 2083 | 2083 | if (amdgpu_sriov_vf(adev) || sched_policy == KFD_SCHED_POLICY_NO_HWS) | |
| @@ -3773,7 +3773,6 @@ int amdgpu_device_init(struct amdgpu_device *adev, | |||
| 3773 | 3773 | ||
| 3774 | 3774 | adev->shutdown = false; | |
| 3775 | 3775 | adev->flags = flags; | |
| 3776 | - | amdgpu_device_init_pcie_links(adev); | |
| 3777 | 3776 | ||
| 3778 | 3777 | if (amdgpu_force_asic_type >= 0 && amdgpu_force_asic_type < CHIP_LAST) | |
| 3779 | 3778 | adev->asic_type = amdgpu_force_asic_type; | |
| @@ -4335,7 +4334,7 @@ void amdgpu_device_fini_hw(struct amdgpu_device *adev) | |||
| 4335 | 4334 | ||
| 4336 | 4335 | void amdgpu_device_fini_sw(struct amdgpu_device *adev) | |
| 4337 | 4336 | { | |
| 4338 | - | int i; | |
| 4337 | + | int i, idx; | |
| 4339 | 4338 | bool px; | |
| 4340 | 4339 | ||
| 4341 | 4340 | amdgpu_device_ip_fini(adev); | |
| @@ -4377,9 +4376,11 @@ void amdgpu_device_fini_sw(struct amdgpu_device *adev) | |||
| 4377 | 4376 | if ((adev->pdev->class >> 8) == PCI_CLASS_DISPLAY_VGA) | |
| 4378 | 4377 | vga_client_unregister(adev->pdev); | |
| 4379 | 4378 | ||
| 4380 | - | if (adev->rmmio) { | |
| 4379 | + | if (drm_dev_enter(adev_to_drm(adev), &idx)) { | |
| 4380 | + | ||
| 4381 | 4381 | iounmap(adev->rmmio); | |
| 4382 | 4382 | adev->rmmio = NULL; | |
| 4383 | + | drm_dev_exit(idx); | |
| 4383 | 4384 | } | |
| 4384 | 4385 | ||
| 4385 | 4386 | if (IS_ENABLED(CONFIG_PERF_EVENTS)) | |
| @@ -5868,9 +5869,11 @@ static void amdgpu_device_partner_bandwidth(struct amdgpu_device *adev, | |||
| 5868 | 5869 | *width = PCIE_LNK_WIDTH_UNKNOWN; | |
| 5869 | 5870 | ||
| 5870 | 5871 | 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); | |
| 5872 | + | struct pci_dev *parent = amdgpu_device_find_parent(adev); | |
| 5873 | + | ||
| 5874 | + | if (parent) { | |
| 5875 | + | *speed = pcie_get_speed_cap(parent); | |
| 5876 | + | *width = pcie_get_width_cap(parent); | |
| 5874 | 5877 | } | |
| 5875 | 5878 | } else { | |
| 5876 | 5879 | /* use the current speeds rather than max if switching is not supported */ | |
| @@ -5892,11 +5895,21 @@ static void amdgpu_device_gpu_bandwidth(struct amdgpu_device *adev, | |||
| 5892 | 5895 | enum pci_bus_speed *speed, | |
| 5893 | 5896 | enum pcie_link_width *width) | |
| 5894 | 5897 | { | |
| 5898 | + | struct pci_dev *parent = adev->pdev; | |
| 5899 | + | ||
| 5895 | 5900 | if (!speed || !width) | |
| 5896 | 5901 | return; | |
| 5897 | 5902 | ||
| 5898 | - | *speed = pcie_get_speed_cap(adev->link_dev); | |
| 5899 | - | *width = pcie_get_width_cap(adev->link_dev); | |
| 5903 | + | /* use the device itself */ | |
| 5904 | + | *speed = pcie_get_speed_cap(adev->pdev); | |
| 5905 | + | *width = pcie_get_width_cap(adev->pdev); | |
| 5906 | + | ||
| 5907 | + | /* use the link outside the device */ | |
| 5908 | + | parent = amdgpu_device_find_parent(adev); | |
| 5909 | + | if (parent) { | |
| 5910 | + | *speed = pcie_get_speed_cap(parent); | |
| 5911 | + | *width = pcie_get_width_cap(parent); | |
| 5912 | + | } | |
| 5900 | 5913 | } | |
| 5901 | 5914 | ||
| 5902 | 5915 | /** | |
modified drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
| @@ -1325,8 +1325,6 @@ static int amdgpu_discovery_sysfs_ips(struct amdgpu_device *adev, | |||
| 1325 | 1325 | ip_hw_instance->kobj.kset = &ip_hw_id->hw_id_kset; | |
| 1326 | 1326 | res = kobject_add(&ip_hw_instance->kobj, NULL, | |
| 1327 | 1327 | "%d", ip_hw_instance->num_instance); | |
| 1328 | - | if (res) | |
| 1329 | - | kobject_put(&ip_hw_instance->kobj); | |
| 1330 | 1328 | next_ip: | |
| 1331 | 1329 | if (reg_base_64) | |
| 1332 | 1330 | ip_offset += struct_size(ip, base_address_64, | |
| @@ -1610,11 +1608,11 @@ int amdgpu_discovery_sysfs_early_init(struct amdgpu_device *adev, struct pci_dev | |||
| 1610 | 1608 | ||
| 1611 | 1609 | discovery_bin = adev->discovery.bin; | |
| 1612 | 1610 | ||
| 1613 | - | early_entry = kzalloc_obj(*early_entry); | |
| 1611 | + | early_entry = kzalloc(sizeof(*early_entry), GFP_KERNEL); | |
| 1614 | 1612 | if (!early_entry) | |
| 1615 | 1613 | return -ENOMEM; | |
| 1616 | 1614 | ||
| 1617 | - | ip_top = kzalloc_obj(*ip_top); | |
| 1615 | + | ip_top = kzalloc(sizeof(*ip_top), GFP_KERNEL); | |
| 1618 | 1616 | if (!ip_top) { | |
| 1619 | 1617 | kfree(early_entry); | |
| 1620 | 1618 | return -ENOMEM; | |
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_drv.c
| @@ -2664,14 +2664,6 @@ static int amdgpu_pmops_suspend_noirq(struct device *dev) | |||
| 2664 | 2664 | struct amdgpu_device *adev = drm_to_adev(drm_dev); | |
| 2665 | 2665 | int r; | |
| 2666 | 2666 | ||
| 2667 | - | /* | |
| 2668 | - | * A GPU parked by vga_switcheroo has no power and no PCIe link, so the | |
| 2669 | - | * ASIC reset below would fail and abort the whole noirq suspend phase. | |
| 2670 | - | * Bail out like amdgpu_device_prepare/suspend/resume() already do. | |
| 2671 | - | */ | |
| 2672 | - | if (drm_dev->switch_power_state == DRM_SWITCH_POWER_OFF) | |
| 2673 | - | return 0; | |
| 2674 | - | ||
| 2675 | 2667 | if (amdgpu_acpi_should_gpu_reset(adev)) { | |
| 2676 | 2668 | amdgpu_device_lock_reset_domain(adev->reset_domain); | |
| 2677 | 2669 | r = amdgpu_asic_reset(adev); | |
modified drivers/gpu/drm/amd/amdgpu/amdgpu_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_fence.c
| @@ -724,14 +724,8 @@ void amdgpu_ring_set_fence_errors_and_reemit(struct amdgpu_ring *ring, | |||
| 724 | 724 | bool is_guilty_fence; | |
| 725 | 725 | bool is_guilty_context; | |
| 726 | 726 | ||
| 727 | - | last_seq = amdgpu_fence_read(ring); | |
| 728 | - | seq = ring->fence_drv.sync_seq; | |
| 729 | - | ||
| 730 | - | /* Hardware completion can precede the interrupt which signals fences. */ | |
| 731 | - | if (last_seq == seq) { | |
| 732 | - | amdgpu_fence_process(ring); | |
| 733 | - | return; | |
| 734 | - | } | |
| 727 | + | last_seq = amdgpu_fence_read(ring) & ring->fence_drv.num_fences_mask; | |
| 728 | + | seq = ring->fence_drv.sync_seq & ring->fence_drv.num_fences_mask; | |
| 735 | 729 | ||
| 736 | 730 | /* If there is nothing to reemit, return early and set an error on the fence | |
| 737 | 731 | * if applicable. If all of the fences are siganlled, this will be a nop. | |
| @@ -739,9 +733,7 @@ void amdgpu_ring_set_fence_errors_and_reemit(struct amdgpu_ring *ring, | |||
| 739 | 733 | * we are skipping it on purpose. | |
| 740 | 734 | */ | |
| 741 | 735 | if (!ring->ring_backup_entries_to_copy) { | |
| 742 | - | if (guilty_fence) | |
| 743 | - | amdgpu_fence_driver_force_completion(ring, | |
| 744 | - | &guilty_fence->base); | |
| 736 | + | amdgpu_fence_driver_force_completion(ring, &guilty_fence->base); | |
| 745 | 737 | return; | |
| 746 | 738 | } | |
| 747 | 739 | ring->reemit = true; | |
| @@ -749,8 +741,9 @@ void amdgpu_ring_set_fence_errors_and_reemit(struct amdgpu_ring *ring, | |||
| 749 | 741 | spin_lock_irqsave(&ring->fence_drv.lock, flags); | |
| 750 | 742 | do { | |
| 751 | 743 | last_seq++; | |
| 744 | + | last_seq &= ring->fence_drv.num_fences_mask; | |
| 752 | 745 | ||
| 753 | - | ptr = &ring->fence_drv.fences[last_seq & ring->fence_drv.num_fences_mask]; | |
| 746 | + | ptr = &ring->fence_drv.fences[last_seq]; | |
| 754 | 747 | rcu_read_lock(); | |
| 755 | 748 | unprocessed = rcu_dereference(*ptr); | |
| 756 | 749 | ||
| @@ -807,24 +800,26 @@ void amdgpu_ring_backup_unprocessed_commands(struct amdgpu_ring *ring, | |||
| 807 | 800 | struct amdgpu_fence *fence; | |
| 808 | 801 | u32 seq, last_seq; | |
| 809 | 802 | ||
| 810 | - | last_seq = amdgpu_fence_read(ring); | |
| 811 | - | seq = ring->fence_drv.sync_seq; | |
| 803 | + | last_seq = amdgpu_fence_read(ring) & ring->fence_drv.num_fences_mask; | |
| 804 | + | seq = ring->fence_drv.sync_seq & ring->fence_drv.num_fences_mask; | |
| 812 | 805 | ring->ring_backup_entries_to_copy = 0; | |
| 813 | 806 | ||
| 814 | - | /* | |
| 815 | - | * Avoid replay loops for a repeated guilty fence. NULL identifies a | |
| 816 | - | * collateral ring, whose pending commands still need backup. | |
| 807 | + | /* if we've already seen this fence, return early. | |
| 808 | + | * ring->ring_backup_entries_to_copy is set to 0 so | |
| 809 | + | * the reemit helper will return early as well to | |
| 810 | + | * avoid getting stuck in a reemit loop. | |
| 817 | 811 | */ | |
| 818 | - | if (guilty_fence && ring->guilty_fence == guilty_fence) { | |
| 812 | + | if (ring->guilty_fence == guilty_fence) { | |
| 819 | 813 | ring->guilty_fence = NULL; | |
| 820 | 814 | return; | |
| 821 | 815 | } | |
| 822 | 816 | ring->guilty_fence = guilty_fence; | |
| 823 | 817 | ||
| 824 | - | while (last_seq != seq) { | |
| 818 | + | do { | |
| 825 | 819 | last_seq++; | |
| 820 | + | last_seq &= ring->fence_drv.num_fences_mask; | |
| 826 | 821 | ||
| 827 | - | ptr = &ring->fence_drv.fences[last_seq & ring->fence_drv.num_fences_mask]; | |
| 822 | + | ptr = &ring->fence_drv.fences[last_seq]; | |
| 828 | 823 | rcu_read_lock(); | |
| 829 | 824 | unprocessed = rcu_dereference(*ptr); | |
| 830 | 825 | ||
| @@ -834,7 +829,7 @@ void amdgpu_ring_backup_unprocessed_commands(struct amdgpu_ring *ring, | |||
| 834 | 829 | amdgpu_ring_backup_unprocessed_command(ring, fence); | |
| 835 | 830 | } | |
| 836 | 831 | rcu_read_unlock(); | |
| 837 | - | } | |
| 832 | + | } while (last_seq != seq); | |
| 838 | 833 | } | |
| 839 | 834 | ||
| 840 | 835 | struct amdgpu_fence * | |
modified drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c
| @@ -1080,17 +1080,20 @@ void amdgpu_gmc_init_vga_resv_regions(struct amdgpu_device *adev) | |||
| 1080 | 1080 | case CHIP_RENOIR: | |
| 1081 | 1081 | adev->mman.keep_stolen_vga_memory = true; | |
| 1082 | 1082 | break; | |
| 1083 | + | case CHIP_POLARIS10: | |
| 1084 | + | case CHIP_POLARIS11: | |
| 1085 | + | case CHIP_POLARIS12: | |
| 1086 | + | /* MacBookPros with switchable graphics put VRAM at 0 when | |
| 1087 | + | * the iGPU is enabled which results in cursor issues if | |
| 1088 | + | * the cursor ends up at 0. Reserve vram at 0 in that case. | |
| 1089 | + | */ | |
| 1090 | + | if (adev->gmc.vram_start == 0) | |
| 1091 | + | adev->mman.keep_stolen_vga_memory = true; | |
| 1092 | + | break; | |
| 1083 | 1093 | default: | |
| 1084 | 1094 | adev->mman.keep_stolen_vga_memory = false; | |
| 1085 | 1095 | break; | |
| 1086 | 1096 | } | |
| 1087 | - | /* MacBookPros with switchable graphics put VRAM at 0 when | |
| 1088 | - | * the iGPU is enabled which results in cursor issues if | |
| 1089 | - | * the cursor ends up at 0. Reserve vram at 0 in that case. | |
| 1090 | - | */ | |
| 1091 | - | if ((adev->pdev->subsystem_vendor == PCI_VENDOR_ID_APPLE) && | |
| 1092 | - | (adev->gmc.vram_start == 0)) | |
| 1093 | - | adev->mman.keep_stolen_vga_memory = true; | |
| 1094 | 1097 | ||
| 1095 | 1098 | if (amdgpu_sriov_vf(adev) || | |
| 1096 | 1099 | !amdgpu_device_has_display_hardware(adev)) { | |
modified drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
| @@ -30,7 +30,6 @@ | |||
| 30 | 30 | #include <drm/amdgpu_drm.h> | |
| 31 | 31 | #include <drm/drm_drv.h> | |
| 32 | 32 | #include <drm/drm_fb_helper.h> | |
| 33 | - | #include <drm/drm_vblank.h> | |
| 34 | 33 | #include "amdgpu_uvd.h" | |
| 35 | 34 | #include "amdgpu_vce.h" | |
| 36 | 35 | #include "atom.h" | |
| @@ -1661,9 +1660,6 @@ u32 amdgpu_get_vblank_counter_kms(struct drm_crtc *crtc) | |||
| 1661 | 1660 | DRM_ERROR("Invalid crtc %u\n", pipe); | |
| 1662 | 1661 | return -EINVAL; | |
| 1663 | 1662 | } | |
| 1664 | - | if (!down_read_trylock(&adev->reset_domain->sem)) | |
| 1665 | - | return drm_crtc_vblank_count(crtc); | |
| 1666 | - | ||
| 1667 | 1663 | ||
| 1668 | 1664 | /* The hw increments its frame counter at start of vsync, not at start | |
| 1669 | 1665 | * of vblank, as is required by DRM core vblank counter handling. | |
| @@ -1709,7 +1705,6 @@ u32 amdgpu_get_vblank_counter_kms(struct drm_crtc *crtc) | |||
| 1709 | 1705 | DRM_DEBUG_VBL("NULL mode info! Returned count may be wrong.\n"); | |
| 1710 | 1706 | } | |
| 1711 | 1707 | ||
| 1712 | - | up_read(&adev->reset_domain->sem); | |
| 1713 | 1708 | return count; | |
| 1714 | 1709 | } | |
| 1715 | 1710 | ||
modified drivers/gpu/drm/amd/amdgpu/amdgpu_lockdep.c
| @@ -98,7 +98,7 @@ int amdgpu_lockdep_init(void) | |||
| 98 | 98 | struct amdgpu_lockdep_dummy_locks *locks; | |
| 99 | 99 | unsigned long flags; | |
| 100 | 100 | ||
| 101 | - | locks = kzalloc_obj(*locks); | |
| 101 | + | locks = kzalloc(sizeof(*locks), GFP_KERNEL); | |
| 102 | 102 | if (!locks) | |
| 103 | 103 | return -ENOMEM; | |
| 104 | 104 | ||
modified drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c
| @@ -879,7 +879,7 @@ bool amdgpu_mes_queue_reset_by_mes_supported(struct amdgpu_device *adev) | |||
| 879 | 879 | ||
| 880 | 880 | return (ip_maj == 11 && mes_sched >= 0x8c) || | |
| 881 | 881 | ((ip_maj == 12 && ip_min == 0) && mes_sched >= 0x8d) || | |
| 882 | - | ((ip_maj == 12 && ip_min == 1) && mes_sched >= 0x7b); | |
| 882 | + | ((ip_maj == 12 && ip_min == 1) && mes_sched >= 0x73); | |
| 883 | 883 | } | |
| 884 | 884 | ||
| 885 | 885 | /* Fix me -- node_id is used to identify the correct MES instances in the future */ | |
modified drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
| @@ -1701,8 +1701,9 @@ u64 amdgpu_bo_print_info(int id, struct amdgpu_bo *bo, struct seq_file *m) | |||
| 1701 | 1701 | if (dma_resv_trylock(bo->tbo.base.resv)) { | |
| 1702 | 1702 | dma_resv_describe(bo->tbo.base.resv, m); | |
| 1703 | 1703 | dma_resv_unlock(bo->tbo.base.resv); | |
| 1704 | + | } else { | |
| 1705 | + | seq_puts(m, "\n"); | |
| 1704 | 1706 | } | |
| 1705 | - | seq_puts(m, "\n"); | |
| 1706 | 1707 | ||
| 1707 | 1708 | return size; | |
| 1708 | 1709 | } | |
modified drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
| @@ -396,12 +396,6 @@ static bool psp_get_runtime_db_entry(struct amdgpu_device *adev, | |||
| 396 | 396 | bool ret = false; | |
| 397 | 397 | int i; | |
| 398 | 398 | ||
| 399 | - | /* | |
| 400 | - | * Runtime DB is for dGPUs only. | |
| 401 | - | */ | |
| 402 | - | if (adev->flags & AMD_IS_APU) | |
| 403 | - | return false; | |
| 404 | - | ||
| 405 | 399 | if (amdgpu_ip_version(adev, MP0_HWIP, 0) == IP_VERSION(13, 0, 6) || | |
| 406 | 400 | amdgpu_ip_version(adev, MP0_HWIP, 0) == IP_VERSION(13, 0, 12) || | |
| 407 | 401 | amdgpu_ip_version(adev, MP0_HWIP, 0) == IP_VERSION(13, 0, 14) || | |
modified drivers/gpu/drm/amd/amdgpu/amdgpu_ras_eeprom.c
| @@ -1293,7 +1293,7 @@ amdgpu_ras_debugfs_table_read_uniras(struct amdgpu_device *adev, | |||
| 1293 | 1293 | return -ENOMEM; | |
| 1294 | 1294 | ||
| 1295 | 1295 | if (num_recs) { | |
| 1296 | - | records = kvzalloc_objs(*records, num_recs); | |
| 1296 | + | records = kvcalloc(num_recs, sizeof(*records), GFP_KERNEL); | |
| 1297 | 1297 | if (!records) { | |
| 1298 | 1298 | res = -ENOMEM; | |
| 1299 | 1299 | goto out; | |
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_ttm.c
| @@ -191,8 +191,6 @@ amdgpu_ttm_job_submit(struct amdgpu_device *adev, struct amdgpu_ttm_buffer_entit | |||
| 191 | 191 | * @tmz: if we should setup a TMZ enabled mapping | |
| 192 | 192 | * @size: in number of bytes to map, out number of bytes mapped | |
| 193 | 193 | * @addr: resulting address inside the MC address space | |
| 194 | - | * @vm_needs_flush: out, set true if a GART window was programmed (VMID 0 flush | |
| 195 | - | * needed) or false for a direct address | |
| 196 | 194 | * | |
| 197 | 195 | * Setup one of the GART windows to access a specific piece of memory or return | |
| 198 | 196 | * the physical address for local memory. | |
| @@ -202,8 +200,7 @@ static int amdgpu_ttm_map_buffer(struct amdgpu_ttm_buffer_entity *entity, | |||
| 202 | 200 | struct ttm_resource *mem, | |
| 203 | 201 | struct amdgpu_res_cursor *mm_cur, | |
| 204 | 202 | unsigned int window, | |
| 205 | - | bool tmz, uint64_t *size, uint64_t *addr, | |
| 206 | - | bool *vm_needs_flush) | |
| 203 | + | bool tmz, uint64_t *size, uint64_t *addr) | |
| 207 | 204 | { | |
| 208 | 205 | struct amdgpu_device *adev = amdgpu_ttm_adev(bo->bdev); | |
| 209 | 206 | unsigned int offset, num_pages, num_dw, num_bytes; | |
| @@ -224,12 +221,9 @@ static int amdgpu_ttm_map_buffer(struct amdgpu_ttm_buffer_entity *entity, | |||
| 224 | 221 | if (!tmz && mem->start != AMDGPU_BO_INVALID_OFFSET) { | |
| 225 | 222 | *addr = amdgpu_ttm_domain_start(adev, mem->mem_type) + | |
| 226 | 223 | mm_cur->start; | |
| 227 | - | *vm_needs_flush = false; | |
| 228 | 224 | return 0; | |
| 229 | 225 | } | |
| 230 | 226 | ||
| 231 | - | /* A GART window is programmed below, so its VMID 0 TLB needs a flush */ | |
| 232 | - | *vm_needs_flush = true; | |
| 233 | 227 | ||
| 234 | 228 | /* | |
| 235 | 229 | * If start begins at an offset inside the page, then adjust the size | |
| @@ -330,7 +324,6 @@ static int amdgpu_ttm_copy_mem_to_mem(struct amdgpu_device *adev, | |||
| 330 | 324 | while (src_mm.remaining) { | |
| 331 | 325 | uint64_t from, to, cur_size, tiling_flags; | |
| 332 | 326 | uint32_t num_type, data_format, max_com, write_compress_disable; | |
| 333 | - | bool src_vm_flush, dst_vm_flush; | |
| 334 | 327 | struct dma_fence *next; | |
| 335 | 328 | ||
| 336 | 329 | /* Never copy more than 256MiB at once to avoid a timeout */ | |
| @@ -338,12 +331,12 @@ static int amdgpu_ttm_copy_mem_to_mem(struct amdgpu_device *adev, | |||
| 338 | 331 | ||
| 339 | 332 | /* Map src to window 0 and dst to window 1. */ | |
| 340 | 333 | r = amdgpu_ttm_map_buffer(entity, src->bo, src->mem, &src_mm, | |
| 341 | - | 0, tmz, &cur_size, &from, &src_vm_flush); | |
| 334 | + | 0, tmz, &cur_size, &from); | |
| 342 | 335 | if (r) | |
| 343 | 336 | goto error; | |
| 344 | 337 | ||
| 345 | 338 | r = amdgpu_ttm_map_buffer(entity, dst->bo, dst->mem, &dst_mm, | |
| 346 | - | 1, tmz, &cur_size, &to, &dst_vm_flush); | |
| 339 | + | 1, tmz, &cur_size, &to); | |
| 347 | 340 | if (r) | |
| 348 | 341 | goto error; | |
| 349 | 342 | ||
| @@ -371,7 +364,7 @@ static int amdgpu_ttm_copy_mem_to_mem(struct amdgpu_device *adev, | |||
| 371 | 364 | } | |
| 372 | 365 | ||
| 373 | 366 | r = amdgpu_copy_buffer(adev, entity, from, to, cur_size, resv, | |
| 374 | - | &next, src_vm_flush || dst_vm_flush, copy_flags); | |
| 367 | + | &next, true, copy_flags); | |
| 375 | 368 | if (r) | |
| 376 | 369 | goto error; | |
| 377 | 370 | ||
| @@ -2342,7 +2335,7 @@ void amdgpu_ttm_fini(struct amdgpu_device *adev) | |||
| 2342 | 2335 | void amdgpu_ttm_enable_buffer_funcs(struct amdgpu_device *adev) | |
| 2343 | 2336 | { | |
| 2344 | 2337 | struct ttm_resource_manager *man = ttm_manager_type(&adev->mman.bdev, TTM_PL_VRAM); | |
| 2345 | - | u32 num_clear_entities, num_move_entities, sdma_ip_version; | |
| 2338 | + | u32 num_clear_entities, num_move_entities; | |
| 2346 | 2339 | int r, i, j; | |
| 2347 | 2340 | ||
| 2348 | 2341 | if (!adev->mman.initialized || amdgpu_in_reset(adev) || | |
| @@ -2367,15 +2360,10 @@ void amdgpu_ttm_enable_buffer_funcs(struct amdgpu_device *adev) | |||
| 2367 | 2360 | ||
| 2368 | 2361 | num_clear_entities = MIN(adev->mman.num_buffer_funcs_scheds, TTM_NUM_MOVE_FENCES); | |
| 2369 | 2362 | num_move_entities = MIN(adev->mman.num_buffer_funcs_scheds, TTM_NUM_MOVE_FENCES); | |
| 2370 | - | /* TODO: workaround for DCC corruption when moving BOs from multiple queues at | |
| 2371 | - | * the same time: use a single queue until the root cause is identified and fixed. | |
| 2372 | - | */ | |
| 2373 | - | sdma_ip_version = amdgpu_ip_version(adev, SDMA0_HWIP, 0); | |
| 2374 | - | if (sdma_ip_version == IP_VERSION(7, 0, 0) || sdma_ip_version == IP_VERSION(7, 0, 1)) | |
| 2375 | - | num_move_entities = 1; | |
| 2376 | 2363 | ||
| 2377 | - | adev->mman.clear_entities = kzalloc_objs(struct amdgpu_ttm_buffer_entity, | |
| 2378 | - | num_clear_entities); | |
| 2364 | + | adev->mman.clear_entities = kcalloc(num_clear_entities, | |
| 2365 | + | sizeof(struct amdgpu_ttm_buffer_entity), | |
| 2366 | + | GFP_KERNEL); | |
| 2379 | 2367 | atomic_set(&adev->mman.next_clear_entity, 0); | |
| 2380 | 2368 | if (!adev->mman.clear_entities) | |
| 2381 | 2369 | goto error_free_default_entity; | |
| @@ -2637,7 +2625,6 @@ int amdgpu_ttm_clear_buffer(struct amdgpu_ttm_buffer_entity *entity, | |||
| 2637 | 2625 | struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev); | |
| 2638 | 2626 | struct dma_fence *fence = NULL; | |
| 2639 | 2627 | struct amdgpu_res_cursor dst; | |
| 2640 | - | bool vm_needs_flush = false; | |
| 2641 | 2628 | int r; | |
| 2642 | 2629 | ||
| 2643 | 2630 | if (!entity) | |
| @@ -2659,13 +2646,13 @@ int amdgpu_ttm_clear_buffer(struct amdgpu_ttm_buffer_entity *entity, | |||
| 2659 | 2646 | cur_size = min(dst.size, 256ULL << 20); | |
| 2660 | 2647 | ||
| 2661 | 2648 | r = amdgpu_ttm_map_buffer(entity, &bo->tbo, bo->tbo.resource, &dst, | |
| 2662 | - | 0, false, &cur_size, &to, &vm_needs_flush); | |
| 2649 | + | 0, false, &cur_size, &to); | |
| 2663 | 2650 | if (r) | |
| 2664 | 2651 | goto error; | |
| 2665 | 2652 | ||
| 2666 | 2653 | r = amdgpu_ttm_fill_mem(adev, entity, | |
| 2667 | 2654 | 0, to, cur_size, resv, | |
| 2668 | - | &next, vm_needs_flush, k_job_id); | |
| 2655 | + | &next, true, k_job_id); | |
| 2669 | 2656 | if (r) | |
| 2670 | 2657 | goto error; | |
| 2671 | 2658 | ||
modified drivers/gpu/drm/amd/amdgpu/amdgpu_umc.c
| @@ -159,8 +159,8 @@ void amdgpu_umc_handle_bad_pages(struct amdgpu_device *adev, | |||
| 159 | 159 | adev->umc.ras->ecc_info_query_ras_error_address && | |
| 160 | 160 | adev->umc.max_ras_err_cnt_per_query) { | |
| 161 | 161 | err_data->err_addr = | |
| 162 | - | kzalloc_objs(struct eeprom_table_record, | |
| 163 | - | adev->umc.max_ras_err_cnt_per_query); | |
| 162 | + | kcalloc(adev->umc.max_ras_err_cnt_per_query, | |
| 163 | + | sizeof(struct eeprom_table_record), GFP_KERNEL); | |
| 164 | 164 | ||
| 165 | 165 | /* still call query_ras_error_address to clear error status | |
| 166 | 166 | * even NOMEM error is encountered | |
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) | |
| @@ -472,7 +472,6 @@ amdgpu_userq_get_doorbell_index(struct amdgpu_userq_mgr *uq_mgr, | |||
| 472 | 472 | u64 doorbell_index; | |
| 473 | 473 | struct drm_gem_object *gobj; | |
| 474 | 474 | struct amdgpu_userq_obj *db_obj = db_info->db_obj; | |
| 475 | - | struct amdgpu_bo *abo; | |
| 476 | 475 | int r, db_size; | |
| 477 | 476 | ||
| 478 | 477 | gobj = drm_gem_object_lookup(filp, db_info->doorbell_handle); | |
| @@ -481,17 +480,7 @@ amdgpu_userq_get_doorbell_index(struct amdgpu_userq_mgr *uq_mgr, | |||
| 481 | 480 | return -EINVAL; | |
| 482 | 481 | } | |
| 483 | 482 | ||
| 484 | - | /* | |
| 485 | - | * Pinning a regular BO into the doorbell domain would discard its | |
| 486 | - | * contents, possibly those of a buffer shared by another client. | |
| 487 | - | */ | |
| 488 | - | abo = gem_to_amdgpu_bo(gobj); | |
| 489 | - | if (!(abo->preferred_domains & AMDGPU_GEM_DOMAIN_DOORBELL)) { | |
| 490 | - | drm_gem_object_put(gobj); | |
| 491 | - | return -EINVAL; | |
| 492 | - | } | |
| 493 | - | ||
| 494 | - | db_obj->obj = amdgpu_bo_ref(abo); | |
| 483 | + | db_obj->obj = amdgpu_bo_ref(gem_to_amdgpu_bo(gobj)); | |
| 495 | 484 | drm_gem_object_put(gobj); | |
| 496 | 485 | ||
| 497 | 486 | r = amdgpu_bo_reserve(db_obj->obj, true); | |
| @@ -1283,7 +1272,7 @@ amdgpu_userq_evict_all(struct amdgpu_userq_mgr *uq_mgr) | |||
| 1283 | 1272 | return ret; | |
| 1284 | 1273 | } | |
| 1285 | 1274 | ||
| 1286 | - | void | |
| 1275 | + | static void | |
| 1287 | 1276 | amdgpu_userq_wait_for_signal(struct amdgpu_userq_mgr *uq_mgr) | |
| 1288 | 1277 | { | |
| 1289 | 1278 | struct amdgpu_usermode_queue *queue; | |
| @@ -1302,6 +1291,8 @@ amdgpu_userq_wait_for_signal(struct amdgpu_userq_mgr *uq_mgr) | |||
| 1302 | 1291 | void | |
| 1303 | 1292 | amdgpu_userq_evict(struct amdgpu_userq_mgr *uq_mgr) | |
| 1304 | 1293 | { | |
| 1294 | + | /* Wait for any pending userqueue fence work to finish */ | |
| 1295 | + | amdgpu_userq_wait_for_signal(uq_mgr); | |
| 1305 | 1296 | amdgpu_userq_evict_all(uq_mgr); | |
| 1306 | 1297 | } | |
| 1307 | 1298 | ||
| @@ -1553,7 +1544,7 @@ int amdgpu_userq_post_reset(struct amdgpu_device *adev, bool vram_lost) | |||
| 1553 | 1544 | struct amdgpu_usermode_queue *queue; | |
| 1554 | 1545 | const struct amdgpu_userq_funcs *userq_funcs; | |
| 1555 | 1546 | unsigned long queue_id; | |
| 1556 | - | int ret = 0, r; | |
| 1547 | + | int r = 0; | |
| 1557 | 1548 | ||
| 1558 | 1549 | xa_for_each(&adev->userq_doorbell_xa, queue_id, queue) { | |
| 1559 | 1550 | if (queue->state == AMDGPU_USERQ_STATE_HUNG && !vram_lost) { | |
| @@ -1564,7 +1555,6 @@ int amdgpu_userq_post_reset(struct amdgpu_device *adev, bool vram_lost) | |||
| 1564 | 1555 | r = userq_funcs->map(queue); | |
| 1565 | 1556 | if (r) { | |
| 1566 | 1557 | dev_err(adev->dev, "Failed to remap queue %ld\n", queue_id); | |
| 1567 | - | ret = r; | |
| 1568 | 1558 | continue; | |
| 1569 | 1559 | } | |
| 1570 | 1560 | trace_amdgpu_userq_state_changed(queue, AMDGPU_USERQ_STATE_MAPPED); | |
| @@ -1572,5 +1562,5 @@ int amdgpu_userq_post_reset(struct amdgpu_device *adev, bool vram_lost) | |||
| 1572 | 1562 | } | |
| 1573 | 1563 | } | |
| 1574 | 1564 | ||
| 1575 | - | return ret; | |
| 1565 | + | return r; | |
| 1576 | 1566 | } | |
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_userq_fence.c
| @@ -227,7 +227,7 @@ static int amdgpu_userq_fence_alloc(struct amdgpu_usermode_queue *userq, | |||
| 227 | 227 | struct amdgpu_userq_fence *userq_fence; | |
| 228 | 228 | void *entry; | |
| 229 | 229 | ||
| 230 | - | userq_fence = kmalloc_obj(*userq_fence); | |
| 230 | + | userq_fence = kmalloc(sizeof(*userq_fence), GFP_KERNEL); | |
| 231 | 231 | if (!userq_fence) | |
| 232 | 232 | return -ENOMEM; | |
| 233 | 233 | ||
| @@ -244,7 +244,9 @@ static int amdgpu_userq_fence_alloc(struct amdgpu_usermode_queue *userq, | |||
| 244 | 244 | } while (xas_retry(&xas, entry)); | |
| 245 | 245 | rcu_read_unlock(); | |
| 246 | 246 | ||
| 247 | - | userq_fence->fence_drv_array = kvmalloc_objs(fence_drv, xas.xa_index); | |
| 247 | + | userq_fence->fence_drv_array = kvmalloc_array(xas.xa_index, | |
| 248 | + | sizeof(fence_drv), | |
| 249 | + | GFP_KERNEL); | |
| 248 | 250 | if (!userq_fence->fence_drv_array) { | |
| 249 | 251 | mutex_unlock(&userq->fence_drv_lock); | |
| 250 | 252 | kfree(userq_fence); | |
modified drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
| @@ -316,8 +316,8 @@ static int amdgpu_virt_ras_realloc_eh_data_space(struct amdgpu_device *adev, | |||
| 316 | 316 | if (align_space > AMDGPU_VIRT_RAS_BAD_PAGE_TABLE_MAX_CAPACITY) | |
| 317 | 317 | return -ENOMEM; | |
| 318 | 318 | ||
| 319 | - | new_bps = kmalloc_objs(*data->bps, align_space); | |
| 320 | - | new_bo = kzalloc_objs(*data->bps_bo, align_space); | |
| 319 | + | new_bps = kmalloc_array(align_space, sizeof(*data->bps), GFP_KERNEL); | |
| 320 | + | new_bo = kcalloc(align_space, sizeof(*data->bps_bo), GFP_KERNEL); | |
| 321 | 321 | if (!new_bps || !new_bo) { | |
| 322 | 322 | kfree(new_bps); | |
| 323 | 323 | kfree(new_bo); | |
| @@ -355,7 +355,7 @@ static int amdgpu_virt_init_ras_err_handler_data(struct amdgpu_device *adev) | |||
| 355 | 355 | if (!bps) | |
| 356 | 356 | goto bps_failure; | |
| 357 | 357 | ||
| 358 | - | bps_bo = kzalloc_objs(*(*data)->bps_bo, align_space); | |
| 358 | + | bps_bo = kcalloc(align_space, sizeof(*(*data)->bps_bo), GFP_KERNEL); | |
| 359 | 359 | if (!bps_bo) | |
| 360 | 360 | goto bps_bo_failure; | |
| 361 | 361 | ||
modified drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
| @@ -2090,7 +2090,7 @@ int amdgpu_vm_bo_clear_mappings(struct amdgpu_device *adev, | |||
| 2090 | 2090 | after->start = eaddr + 1; | |
| 2091 | 2091 | after->last = tmp->last; | |
| 2092 | 2092 | after->offset = tmp->offset; | |
| 2093 | - | after->offset += (after->start - tmp->start) << AMDGPU_GPU_PAGE_SHIFT; | |
| 2093 | + | after->offset += (after->start - tmp->start) << PAGE_SHIFT; | |
| 2094 | 2094 | after->flags = tmp->flags; | |
| 2095 | 2095 | after->bo_va = tmp->bo_va; | |
| 2096 | 2096 | list_add(&after->list, &tmp->bo_va->invalids); | |
| @@ -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); | |
| @@ -3123,7 +3122,7 @@ static void amdgpu_debugfs_vm_bo_status_info(struct seq_file *m, | |||
| 3123 | 3122 | ||
| 3124 | 3123 | id = 0; | |
| 3125 | 3124 | seq_puts(m, "\tIdle BOs:\n"); | |
| 3126 | - | list_for_each_entry(base, &lists->idle, vm_status) { | |
| 3125 | + | list_for_each_entry(base, &lists->needs_update, vm_status) { | |
| 3127 | 3126 | if (!base->bo) | |
| 3128 | 3127 | continue; | |
| 3129 | 3128 | ||
modified drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c
| @@ -1651,10 +1651,10 @@ static int gfx_v11_0_sw_init(struct amdgpu_ip_block *ip_block) | |||
| 1651 | 1651 | case IP_VERSION(11, 0, 2): | |
| 1652 | 1652 | case IP_VERSION(11, 0, 3): | |
| 1653 | 1653 | if (!adev->gfx.disable_uq && | |
| 1654 | - | adev->gfx.me_fw_version >= 3090 && | |
| 1655 | - | adev->gfx.pfp_fw_version >= 3190 && | |
| 1656 | - | adev->gfx.mec_fw_version >= 3450 && | |
| 1657 | - | adev->mes.fw_version[0] >= 147) { | |
| 1654 | + | adev->gfx.me_fw_version >= 2420 && | |
| 1655 | + | adev->gfx.pfp_fw_version >= 2580 && | |
| 1656 | + | adev->gfx.mec_fw_version >= 2650 && | |
| 1657 | + | adev->mes.fw_version[0] >= 120) { | |
| 1658 | 1658 | adev->userq_funcs[AMDGPU_HW_IP_GFX] = &userq_mes_funcs; | |
| 1659 | 1659 | adev->userq_funcs[AMDGPU_HW_IP_COMPUTE] = &userq_mes_funcs; | |
| 1660 | 1660 | } | |
| @@ -3808,7 +3808,6 @@ static int gfx_v11_0_cp_gfx_resume(struct amdgpu_device *adev) | |||
| 3808 | 3808 | rb_bufsz = order_base_2(ring->ring_size / 8); | |
| 3809 | 3809 | tmp = REG_SET_FIELD(0, CP_RB0_CNTL, RB_BUFSZ, rb_bufsz); | |
| 3810 | 3810 | tmp = REG_SET_FIELD(tmp, CP_RB0_CNTL, RB_BLKSZ, rb_bufsz - 2); | |
| 3811 | - | tmp = REG_SET_FIELD(tmp, CP_RB0_CNTL, KMD_QUEUE, 1); | |
| 3812 | 3811 | WREG32_SOC15(GC, 0, regCP_RB0_CNTL, tmp); | |
| 3813 | 3812 | ||
| 3814 | 3813 | /* Initialize the ring buffer's write pointers */ | |
| @@ -4217,7 +4216,6 @@ static int gfx_v11_0_gfx_mqd_init(struct amdgpu_device *adev, void *m, | |||
| 4217 | 4216 | tmp = regCP_GFX_HQD_CNTL_DEFAULT; | |
| 4218 | 4217 | tmp = REG_SET_FIELD(tmp, CP_GFX_HQD_CNTL, RB_BUFSZ, rb_bufsz); | |
| 4219 | 4218 | tmp = REG_SET_FIELD(tmp, CP_GFX_HQD_CNTL, RB_BLKSZ, rb_bufsz - 2); | |
| 4220 | - | tmp = REG_SET_FIELD(tmp, CP_GFX_HQD_CNTL, KMD_QUEUE, prop->kernel_queue); | |
| 4221 | 4219 | #ifdef __BIG_ENDIAN | |
| 4222 | 4220 | tmp = REG_SET_FIELD(tmp, CP_GFX_HQD_CNTL, BUF_SWAP, 1); | |
| 4223 | 4221 | #endif | |
modified drivers/gpu/drm/amd/amdgpu/gfx_v12_0.c
| @@ -1436,10 +1436,10 @@ static int gfx_v12_0_sw_init(struct amdgpu_ip_block *ip_block) | |||
| 1436 | 1436 | case IP_VERSION(12, 0, 0): | |
| 1437 | 1437 | case IP_VERSION(12, 0, 1): | |
| 1438 | 1438 | if (!adev->gfx.disable_uq && | |
| 1439 | - | adev->gfx.me_fw_version >= 3090 && | |
| 1440 | - | adev->gfx.pfp_fw_version >= 3190 && | |
| 1441 | - | adev->gfx.mec_fw_version >= 3450 && | |
| 1442 | - | adev->mes.fw_version[0] >= 147) { | |
| 1439 | + | adev->gfx.me_fw_version >= 2780 && | |
| 1440 | + | adev->gfx.pfp_fw_version >= 2840 && | |
| 1441 | + | adev->gfx.mec_fw_version >= 3050 && | |
| 1442 | + | adev->mes.fw_version[0] >= 123) { | |
| 1443 | 1443 | adev->userq_funcs[AMDGPU_HW_IP_GFX] = &userq_mes_funcs; | |
| 1444 | 1444 | adev->userq_funcs[AMDGPU_HW_IP_COMPUTE] = &userq_mes_funcs; | |
| 1445 | 1445 | } | |
| @@ -2767,7 +2767,6 @@ static int gfx_v12_0_cp_gfx_resume(struct amdgpu_device *adev) | |||
| 2767 | 2767 | rb_bufsz = order_base_2(ring->ring_size / 8); | |
| 2768 | 2768 | tmp = REG_SET_FIELD(0, CP_RB0_CNTL, RB_BUFSZ, rb_bufsz); | |
| 2769 | 2769 | tmp = REG_SET_FIELD(tmp, CP_RB0_CNTL, RB_BLKSZ, rb_bufsz - 2); | |
| 2770 | - | tmp = REG_SET_FIELD(tmp, CP_RB0_CNTL, KMD_QUEUE, 1); | |
| 2771 | 2770 | WREG32_SOC15(GC, 0, regCP_RB0_CNTL, tmp); | |
| 2772 | 2771 | ||
| 2773 | 2772 | /* Initialize the ring buffer's write pointers */ | |
| @@ -3060,7 +3059,6 @@ static int gfx_v12_0_gfx_mqd_init(struct amdgpu_device *adev, void *m, | |||
| 3060 | 3059 | tmp = regCP_GFX_HQD_CNTL_DEFAULT; | |
| 3061 | 3060 | tmp = REG_SET_FIELD(tmp, CP_GFX_HQD_CNTL, RB_BUFSZ, rb_bufsz); | |
| 3062 | 3061 | tmp = REG_SET_FIELD(tmp, CP_GFX_HQD_CNTL, RB_BLKSZ, rb_bufsz - 2); | |
| 3063 | - | tmp = REG_SET_FIELD(tmp, CP_GFX_HQD_CNTL, KMD_QUEUE, prop->kernel_queue); | |
| 3064 | 3062 | #ifdef __BIG_ENDIAN | |
| 3065 | 3063 | tmp = REG_SET_FIELD(tmp, CP_GFX_HQD_CNTL, BUF_SWAP, 1); | |
| 3066 | 3064 | #endif | |
modified drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c
| @@ -322,14 +322,6 @@ static const u32 verde_rlc_save_restore_register_list[] = | |||
| 322 | 322 | 0x00000000 | |
| 323 | 323 | }; | |
| 324 | 324 | ||
| 325 | - | static void gfx_v6_0_free_microcode(struct amdgpu_device *adev) | |
| 326 | - | { | |
| 327 | - | amdgpu_ucode_release(&adev->gfx.pfp_fw); | |
| 328 | - | amdgpu_ucode_release(&adev->gfx.me_fw); | |
| 329 | - | amdgpu_ucode_release(&adev->gfx.ce_fw); | |
| 330 | - | amdgpu_ucode_release(&adev->gfx.rlc_fw); | |
| 331 | - | } | |
| 332 | - | ||
| 333 | 325 | static int gfx_v6_0_init_microcode(struct amdgpu_device *adev) | |
| 334 | 326 | { | |
| 335 | 327 | const char *chip_name; | |
| @@ -3257,7 +3249,6 @@ static int gfx_v6_0_sw_fini(struct amdgpu_ip_block *ip_block) | |||
| 3257 | 3249 | amdgpu_ring_fini(&adev->gfx.compute_ring[i]); | |
| 3258 | 3250 | ||
| 3259 | 3251 | amdgpu_gfx_rlc_fini(adev); | |
| 3260 | - | gfx_v6_0_free_microcode(adev); | |
| 3261 | 3252 | ||
| 3262 | 3253 | return 0; | |
| 3263 | 3254 | } | |
modified drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
| @@ -4546,11 +4546,9 @@ static int gfx_v8_0_mqd_init(struct amdgpu_ring *ring) | |||
| 4546 | 4546 | /* set static priority for a queue/ring */ | |
| 4547 | 4547 | gfx_v8_0_mqd_set_priority(ring, mqd); | |
| 4548 | 4548 | tmp = RREG32(mmCP_HQD_QUANTUM); | |
| 4549 | - | if (ring != &adev->gfx.kiq[0].ring) { | |
| 4550 | - | tmp = REG_SET_FIELD(tmp, CP_HQD_QUANTUM, QUANTUM_EN, 1); | |
| 4551 | - | tmp = REG_SET_FIELD(tmp, CP_HQD_QUANTUM, QUANTUM_SCALE, 1); | |
| 4552 | - | tmp = REG_SET_FIELD(tmp, CP_HQD_QUANTUM, QUANTUM_DURATION, 10); | |
| 4553 | - | } | |
| 4549 | + | tmp = REG_SET_FIELD(tmp, CP_HQD_QUANTUM, QUANTUM_EN, 1); | |
| 4550 | + | tmp = REG_SET_FIELD(tmp, CP_HQD_QUANTUM, QUANTUM_SCALE, 1); | |
| 4551 | + | tmp = REG_SET_FIELD(tmp, CP_HQD_QUANTUM, QUANTUM_DURATION, 10); | |
| 4554 | 4552 | mqd->cp_hqd_quantum = tmp; | |
| 4555 | 4553 | ||
| 4556 | 4554 | /* map_queues packet doesn't need activate the queue, | |
modified drivers/gpu/drm/amd/amdgpu/gmc_v12_0.c
| @@ -327,7 +327,7 @@ static void gmc_v12_0_flush_gpu_tlb(struct amdgpu_device *adev, uint32_t vmid, | |||
| 327 | 327 | return; | |
| 328 | 328 | } | |
| 329 | 329 | ||
| 330 | - | gmc_v12_0_flush_vm_hub(adev, vmid, vmhub, flush_type); | |
| 330 | + | gmc_v12_0_flush_vm_hub(adev, vmid, vmhub, 0); | |
| 331 | 331 | return; | |
| 332 | 332 | } | |
| 333 | 333 | ||
modified drivers/gpu/drm/amd/amdgpu/gmc_v12_1.c
| @@ -389,7 +389,7 @@ static void gmc_v12_1_flush_gpu_tlb(struct amdgpu_device *adev, uint32_t vmid, | |||
| 389 | 389 | return; | |
| 390 | 390 | } | |
| 391 | 391 | ||
| 392 | - | gmc_v12_1_flush_vm_hub(adev, vmid, vmhub, flush_type); | |
| 392 | + | gmc_v12_1_flush_vm_hub(adev, vmid, vmhub, 0); | |
| 393 | 393 | return; | |
| 394 | 394 | } | |
| 395 | 395 | ||
modified drivers/gpu/drm/amd/amdgpu/mes_userqueue.c
| @@ -361,7 +361,8 @@ static int mes_userq_mqd_create(struct amdgpu_usermode_queue *queue, | |||
| 361 | 361 | ||
| 362 | 362 | compute_mqd = memdup_user(u64_to_user_ptr(mqd_user->mqd), mqd_user->mqd_size); | |
| 363 | 363 | if (IS_ERR(compute_mqd)) { | |
| 364 | - | r = PTR_ERR(compute_mqd); | |
| 364 | + | DRM_ERROR("Failed to read user MQD\n"); | |
| 365 | + | r = -ENOMEM; | |
| 365 | 366 | goto free_mqd; | |
| 366 | 367 | } | |
| 367 | 368 | ||
| @@ -405,7 +406,8 @@ static int mes_userq_mqd_create(struct amdgpu_usermode_queue *queue, | |||
| 405 | 406 | ||
| 406 | 407 | mqd_gfx_v11 = memdup_user(u64_to_user_ptr(mqd_user->mqd), mqd_user->mqd_size); | |
| 407 | 408 | if (IS_ERR(mqd_gfx_v11)) { | |
| 408 | - | r = PTR_ERR(mqd_gfx_v11); | |
| 409 | + | DRM_ERROR("Failed to read user MQD\n"); | |
| 410 | + | r = -ENOMEM; | |
| 409 | 411 | goto free_mqd; | |
| 410 | 412 | } | |
| 411 | 413 | ||
| @@ -449,7 +451,8 @@ static int mes_userq_mqd_create(struct amdgpu_usermode_queue *queue, | |||
| 449 | 451 | ||
| 450 | 452 | mqd_sdma_v11 = memdup_user(u64_to_user_ptr(mqd_user->mqd), mqd_user->mqd_size); | |
| 451 | 453 | if (IS_ERR(mqd_sdma_v11)) { | |
| 452 | - | r = PTR_ERR(mqd_sdma_v11); | |
| 454 | + | DRM_ERROR("Failed to read sdma user MQD\n"); | |
| 455 | + | r = -ENOMEM; | |
| 453 | 456 | goto free_mqd; | |
| 454 | 457 | } | |
| 455 | 458 | ||
modified drivers/gpu/drm/amd/amdgpu/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/sdma_v7_1.c
| @@ -1339,6 +1339,10 @@ static int sdma_v7_1_sw_init(struct amdgpu_ip_block *ip_block) | |||
| 1339 | 1339 | else | |
| 1340 | 1340 | DRM_ERROR("Failed to allocated memory for SDMA IP Dump\n"); | |
| 1341 | 1341 | ||
| 1342 | + | #ifdef CONFIG_DRM_AMDGPU_NAVI3X_USERQ | |
| 1343 | + | adev->userq_funcs[AMDGPU_HW_IP_DMA] = &userq_mes_funcs; | |
| 1344 | + | #endif | |
| 1345 | + | ||
| 1342 | 1346 | return r; | |
| 1343 | 1347 | } | |
| 1344 | 1348 | ||
modified drivers/gpu/drm/amd/amdgpu/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/amdgpu/vi.c
| @@ -1397,7 +1397,6 @@ struct vi_reset_quirk { | |||
| 1397 | 1397 | static const struct vi_reset_quirk vi_reset_quirks[] = { | |
| 1398 | 1398 | { 0x67ef, PCI_VENDOR_ID_APPLE, 0x0190, 0xe3 }, /* Radeon Pro 555X */ | |
| 1399 | 1399 | { 0x67ef, PCI_VENDOR_ID_APPLE, 0x018f, 0xc2 }, /* Radeon Pro 560X */ | |
| 1400 | - | { 0x67ef, PCI_VENDOR_ID_APPLE, 0x017a, 0xc7 }, /* Radeon Pro 555 */ | |
| 1401 | 1400 | }; | |
| 1402 | 1401 | ||
| 1403 | 1402 | static bool vi_need_reset_on_init(struct amdgpu_device *adev) | |
modified drivers/gpu/drm/amd/amdkfd/kfd_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 | ||
| @@ -1964,13 +1921,13 @@ static int criu_checkpoint_devices(struct kfd_process *p, | |||
| 1964 | 1921 | struct kfd_criu_device_bucket *device_buckets = NULL; | |
| 1965 | 1922 | int ret = 0, i; | |
| 1966 | 1923 | ||
| 1967 | - | device_buckets = kvzalloc_objs(*device_buckets, num_devices); | |
| 1924 | + | device_buckets = kvcalloc(num_devices, sizeof(*device_buckets), GFP_KERNEL); | |
| 1968 | 1925 | if (!device_buckets) { | |
| 1969 | 1926 | ret = -ENOMEM; | |
| 1970 | 1927 | goto exit; | |
| 1971 | 1928 | } | |
| 1972 | 1929 | ||
| 1973 | - | device_priv = kvzalloc_objs(*device_priv, num_devices); | |
| 1930 | + | device_priv = kvcalloc(num_devices, sizeof(*device_priv), GFP_KERNEL); | |
| 1974 | 1931 | if (!device_priv) { | |
| 1975 | 1932 | ret = -ENOMEM; | |
| 1976 | 1933 | goto exit; | |
| @@ -2090,17 +2047,17 @@ static int criu_checkpoint_bos(struct kfd_process *p, | |||
| 2090 | 2047 | int ret = 0, pdd_index, bo_index = 0, id; | |
| 2091 | 2048 | void *mem; | |
| 2092 | 2049 | ||
| 2093 | - | bo_buckets = kvzalloc_objs(*bo_buckets, num_bos); | |
| 2050 | + | bo_buckets = kvcalloc(num_bos, sizeof(*bo_buckets), GFP_KERNEL); | |
| 2094 | 2051 | if (!bo_buckets) | |
| 2095 | 2052 | return -ENOMEM; | |
| 2096 | 2053 | ||
| 2097 | - | bo_privs = kvzalloc_objs(*bo_privs, num_bos); | |
| 2054 | + | bo_privs = kvcalloc(num_bos, sizeof(*bo_privs), GFP_KERNEL); | |
| 2098 | 2055 | if (!bo_privs) { | |
| 2099 | 2056 | ret = -ENOMEM; | |
| 2100 | 2057 | goto exit; | |
| 2101 | 2058 | } | |
| 2102 | 2059 | ||
| 2103 | - | files = kvzalloc_objs(struct file *, num_bos); | |
| 2060 | + | files = kvcalloc(num_bos, sizeof(struct file *), GFP_KERNEL); | |
| 2104 | 2061 | if (!files) { | |
| 2105 | 2062 | ret = -ENOMEM; | |
| 2106 | 2063 | goto exit; | |
| @@ -2631,7 +2588,7 @@ static int criu_restore_bos(struct kfd_process *p, | |||
| 2631 | 2588 | if (!bo_buckets) | |
| 2632 | 2589 | return -ENOMEM; | |
| 2633 | 2590 | ||
| 2634 | - | files = kvzalloc_objs(struct file *, args->num_bos); | |
| 2591 | + | files = kvcalloc(args->num_bos, sizeof(struct file *), GFP_KERNEL); | |
| 2635 | 2592 | if (!files) { | |
| 2636 | 2593 | ret = -ENOMEM; | |
| 2637 | 2594 | goto exit; | |
modified drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c
| @@ -572,32 +572,12 @@ static int allocate_doorbell(struct qcm_process_device *qpd, | |||
| 572 | 572 | * we need the physical sdma engine id in order to get the | |
| 573 | 573 | * correct doorbell offset. | |
| 574 | 574 | */ | |
| 575 | - | u32 engine_base = idx_offset[dev->node_id * | |
| 576 | - | get_num_all_sdma_engines(qpd->dqm) + | |
| 577 | - | q->properties.sdma_engine_id]; | |
| 578 | - | u32 valid_id; | |
| 579 | - | ||
| 580 | - | /* | |
| 581 | - | * With the aqua_vanjaram doorbell layout, a shader doorbell | |
| 582 | - | * write whose 32-byte block starts in the previous engine's | |
| 583 | - | * range rings that engine instead. Engine ranges are 10 | |
| 584 | - | * indices apart (sdma_doorbell_range = 20 dwords, halved for | |
| 585 | - | * 8-byte doorbells, in aqua_vanjaram_doorbell_index_init()), | |
| 586 | - | * which puts odd engines 2 indices into a shared block. | |
| 587 | - | * Aligning costs at most 2 indices, and 8 queues per engine use | |
| 588 | - | * only 4 of the 10, so the aligned base stays in range. The | |
| 589 | - | * 512-index mirror offset keeps the alignment. | |
| 590 | - | */ | |
| 591 | - | if (KFD_GC_VERSION(dev) == IP_VERSION(9, 4, 3) || | |
| 592 | - | KFD_GC_VERSION(dev) == IP_VERSION(9, 4, 4) || | |
| 593 | - | KFD_GC_VERSION(dev) == IP_VERSION(9, 5, 0)) | |
| 594 | - | engine_base = ALIGN(engine_base, | |
| 595 | - | KFD_SDMA_SHADER_DOORBELL_GRANULARITY); | |
| 596 | - | ||
| 597 | - | valid_id = engine_base + | |
| 598 | - | (q->properties.sdma_queue_id & 1) * | |
| 599 | - | KFD_QUEUE_DOORBELL_MIRROR_OFFSET + | |
| 600 | - | (q->properties.sdma_queue_id >> 1); | |
| 575 | + | uint32_t valid_id = idx_offset[qpd->dqm->dev->node_id * | |
| 576 | + | get_num_all_sdma_engines(qpd->dqm) + | |
| 577 | + | q->properties.sdma_engine_id] | |
| 578 | + | + (q->properties.sdma_queue_id & 1) | |
| 579 | + | * KFD_QUEUE_DOORBELL_MIRROR_OFFSET | |
| 580 | + | + (q->properties.sdma_queue_id >> 1); | |
| 601 | 581 | ||
| 602 | 582 | if (restore_id && *restore_id != valid_id) | |
| 603 | 583 | return -EINVAL; | |
| @@ -790,12 +770,10 @@ static int create_queue_nocpsch(struct device_queue_manager *dqm, | |||
| 790 | 770 | mqd_mgr = dqm->mqd_mgrs[get_mqd_type_from_queue_type( | |
| 791 | 771 | q->properties.type)]; | |
| 792 | 772 | if (qd && !mqd_mgr->restore_mqd) { | |
| 793 | - | pr_debug("restore_mqd not implemented for queue type %d\n", | |
| 794 | - | q->properties.type); | |
| 773 | + | pr_debug("restore_mqd not implemented for this GPU\n"); | |
| 795 | 774 | retval = -EOPNOTSUPP; | |
| 796 | 775 | goto deallocate_vmid; | |
| 797 | 776 | } | |
| 798 | - | ||
| 799 | 777 | if (q->properties.type == KFD_QUEUE_TYPE_COMPUTE) { | |
| 800 | 778 | retval = allocate_hqd(dqm, q); | |
| 801 | 779 | if (retval) | |
| @@ -1477,14 +1455,6 @@ static int evict_process_queues_cpsch(struct device_queue_manager *dqm, | |||
| 1477 | 1455 | dqm_evict_mqd_bo(dqm, q); | |
| 1478 | 1456 | } | |
| 1479 | 1457 | ||
| 1480 | - | /* | |
| 1481 | - | * Heavy-weight TLB flush after MES removes queues to ensure | |
| 1482 | - | * in-flight memory accesses complete before memory is freed/migrated. | |
| 1483 | - | * HWS does this automatically, MES does not. | |
| 1484 | - | */ | |
| 1485 | - | if (dqm->dev->kfd->shared_resources.enable_mes) | |
| 1486 | - | kfd_flush_tlb(pdd); | |
| 1487 | - | ||
| 1488 | 1458 | if (!dqm->dev->kfd->shared_resources.enable_mes) { | |
| 1489 | 1459 | pdd->last_evict_timestamp = get_jiffies_64(); | |
| 1490 | 1460 | retval = execute_queues_cpsch(dqm, | |
| @@ -2272,8 +2242,7 @@ static int create_queue_cpsch(struct device_queue_manager *dqm, struct queue *q, | |||
| 2272 | 2242 | mqd_mgr = dqm->mqd_mgrs[get_mqd_type_from_queue_type( | |
| 2273 | 2243 | q->properties.type)]; | |
| 2274 | 2244 | if (qd && !mqd_mgr->restore_mqd) { | |
| 2275 | - | pr_debug("restore_mqd not implemented for queue type %d\n", | |
| 2276 | - | q->properties.type); | |
| 2245 | + | pr_debug("restore_mqd not implemented for this GPU\n"); | |
| 2277 | 2246 | retval = -EOPNOTSUPP; | |
| 2278 | 2247 | goto out_deallocate_doorbell; | |
| 2279 | 2248 | } | |
| @@ -3777,11 +3746,8 @@ int suspend_queues(struct kfd_process *p, | |||
| 3777 | 3746 | if (!per_device_suspended) { | |
| 3778 | 3747 | dqm_unlock(dqm); | |
| 3779 | 3748 | mutex_unlock(&p->event_mutex); | |
| 3780 | - | if (total_suspended) { | |
| 3749 | + | if (total_suspended) | |
| 3781 | 3750 | amdgpu_amdkfd_debug_mem_fence(dqm->dev->adev); | |
| 3782 | - | /* Heavy-weight TLB flush after MES suspends queues */ | |
| 3783 | - | kfd_flush_tlb(pdd); | |
| 3784 | - | } | |
| 3785 | 3751 | continue; | |
| 3786 | 3752 | } | |
| 3787 | 3753 | ||
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/amdkfd/kfd_priv.h
| @@ -133,13 +133,6 @@ | |||
| 133 | 133 | */ | |
| 134 | 134 | #define KFD_QUEUE_DOORBELL_MIRROR_OFFSET 512 | |
| 135 | 135 | ||
| 136 | - | /* | |
| 137 | - | * On GC 9.4.3, 9.4.4 and 9.5.0, doorbell writes issued from shaders are | |
| 138 | - | * routed to an SDMA engine at 32-byte granularity, i.e. 4 indices with the | |
| 139 | - | * 8-byte SDMA doorbells used on SOC15. | |
| 140 | - | */ | |
| 141 | - | #define KFD_SDMA_SHADER_DOORBELL_GRANULARITY 4 | |
| 142 | - | ||
| 143 | 136 | /** | |
| 144 | 137 | * enum kfd_ioctl_flags - KFD ioctl flags | |
| 145 | 138 | * Various flags that can be set in &amdkfd_ioctl_desc.flags to control how | |
modified drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c
| @@ -1169,13 +1169,13 @@ int pqm_debugfs_mqds(struct seq_file *m, void *data) | |||
| 1169 | 1169 | mqd_mgr = q->device->dqm->mqd_mgrs[mqd_type]; | |
| 1170 | 1170 | size = mqd_mgr->mqd_stride(mqd_mgr, | |
| 1171 | 1171 | &q->properties); | |
| 1172 | + | } | |
| 1172 | 1173 | ||
| 1173 | - | for (xcc = 0; xcc < num_xccs; xcc++) { | |
| 1174 | - | mqd = q->mqd + size * xcc; | |
| 1175 | - | r = mqd_mgr->debugfs_show_mqd(m, mqd); | |
| 1176 | - | if (r != 0) | |
| 1177 | - | break; | |
| 1178 | - | } | |
| 1174 | + | for (xcc = 0; xcc < num_xccs; xcc++) { | |
| 1175 | + | mqd = q->mqd + size * xcc; | |
| 1176 | + | r = mqd_mgr->debugfs_show_mqd(m, mqd); | |
| 1177 | + | if (r != 0) | |
| 1178 | + | break; | |
| 1179 | 1179 | } | |
| 1180 | 1180 | } | |
| 1181 | 1181 | ||
modified drivers/gpu/drm/amd/amdkfd/kfd_svm.c
| @@ -1752,15 +1752,12 @@ static int svm_range_validate_and_map(struct mm_struct *mm, | |||
| 1752 | 1752 | } | |
| 1753 | 1753 | ||
| 1754 | 1754 | /* | |
| 1755 | - | * If prange with always mapped flag is not mapped or migrated | |
| 1756 | - | * yet, update mapping on GPUs with ACCESS attribute. Don't add | |
| 1757 | - | * them otherwise, ACCESS GPUs may be on different XGMI hives, | |
| 1758 | - | * that would force hmm_range_fault to migrate VRAM back to ram. | |
| 1755 | + | * If prange with always mapped flag, update mapping on GPUs with | |
| 1756 | + | * ACCESS attribute | |
| 1759 | 1757 | */ | |
| 1760 | - | if (bitmap_empty(ctx->bitmap, MAX_GPU_INSTANCE) && | |
| 1761 | - | prange->flags & KFD_IOCTL_SVM_FLAG_GPU_ALWAYS_MAPPED) | |
| 1762 | - | bitmap_copy(ctx->bitmap, prange->bitmap_access, | |
| 1763 | - | MAX_GPU_INSTANCE); | |
| 1758 | + | if (prange->flags & KFD_IOCTL_SVM_FLAG_GPU_ALWAYS_MAPPED) | |
| 1759 | + | bitmap_or(ctx->bitmap, ctx->bitmap, prange->bitmap_access, | |
| 1760 | + | MAX_GPU_INSTANCE); | |
| 1764 | 1761 | } else { | |
| 1765 | 1762 | bitmap_or(ctx->bitmap, prange->bitmap_access, | |
| 1766 | 1763 | prange->bitmap_aip, MAX_GPU_INSTANCE); | |
modified drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
| @@ -426,8 +426,6 @@ static int amdgpu_dm_init_power_module(struct amdgpu_display_manager *dm) | |||
| 426 | 426 | init_data[i].use_custom_backlight_caps = false; | |
| 427 | 427 | init_data[i].custom_backlight_caps_config_no = 0; | |
| 428 | 428 | init_data[i].use_linear_backlight_curve = false; | |
| 429 | - | if (amdgpu_dc_debug_mask & DC_DISABLE_CUSTOM_BRIGHTNESS_CURVE) | |
| 430 | - | init_data[i].use_linear_backlight_curve = true; | |
| 431 | 429 | init_data[i].def_varibright_enable = 0; | |
| 432 | 430 | init_data[i].varibright_level = 0; | |
| 433 | 431 | /* | |
| @@ -749,9 +747,9 @@ static int amdgpu_dm_init(struct amdgpu_device *adev) | |||
| 749 | 747 | } | |
| 750 | 748 | if (adev->dm.dc->caps.max_links > 0) { | |
| 751 | 749 | adev->dm.hdmi_frl_status_polling_wq = | |
| 752 | - | create_singlethread_workqueue("hdmi_frl_status_polling_wq"); | |
| 750 | + | create_singlethread_workqueue("hdmi_frl_status_polling_workqueue"); | |
| 753 | 751 | if (!adev->dm.hdmi_frl_status_polling_wq) | |
| 754 | - | drm_err(adev_to_drm(adev), "failed to initialize hdmi_frl_status_polling_wq\n"); | |
| 752 | + | drm_err(adev_to_drm(adev), "failed to initialize hdmi_frl_status_polling_workqueue\n"); | |
| 755 | 753 | } | |
| 756 | 754 | if (dc_is_dmub_outbox_supported(adev->dm.dc)) { | |
| 757 | 755 | init_completion(&adev->dm.dmub_aux_transfer_done); | |
| @@ -1422,7 +1420,7 @@ static void dm_gpureset_toggle_interrupts(struct amdgpu_device *adev, | |||
| 1422 | 1420 | if (acrtc && state->stream_status[i].plane_count != 0 && | |
| 1423 | 1421 | amdgpu_ip_version(adev, DCE_HWIP, 0) == 0) { | |
| 1424 | 1422 | irq_source = IRQ_TYPE_PFLIP + acrtc->otg_inst; | |
| 1425 | - | rc = amdgpu_dm_irq_set(adev, irq_source, enable) ? 0 : -EBUSY; | |
| 1423 | + | rc = dc_interrupt_set(adev->dm.dc, irq_source, enable) ? 0 : -EBUSY; | |
| 1426 | 1424 | if (rc) | |
| 1427 | 1425 | drm_warn(adev_to_drm(adev), "Failed to %s pflip interrupts\n", | |
| 1428 | 1426 | enable ? "enable" : "disable"); | |
| @@ -1446,7 +1444,7 @@ static void dm_gpureset_toggle_interrupts(struct amdgpu_device *adev, | |||
| 1446 | 1444 | /* During gpu-reset we disable and then enable vblank irq, so | |
| 1447 | 1445 | * don't use amdgpu_irq_get/put() to avoid refcount change. | |
| 1448 | 1446 | */ | |
| 1449 | - | if (!amdgpu_dm_irq_set(adev, irq_source, enable)) | |
| 1447 | + | if (!dc_interrupt_set(adev->dm.dc, irq_source, enable)) | |
| 1450 | 1448 | drm_warn(adev_to_drm(adev), "Failed to %sable vblank interrupt\n", enable ? "en" : "dis"); | |
| 1451 | 1449 | ||
| 1452 | 1450 | } else if (acrtc && state->stream_status[i].plane_count != 0) { | |
| @@ -1584,14 +1582,9 @@ static int dm_suspend(struct amdgpu_ip_block *ip_block) | |||
| 1584 | 1582 | dc_allow_idle_optimizations(adev->dm.dc, false); | |
| 1585 | 1583 | ||
| 1586 | 1584 | dm->cached_dc_state = dc_state_create_copy(dm->dc->current_state); | |
| 1587 | - | if (!dm->cached_dc_state) { | |
| 1588 | - | drm_err(adev_to_drm(adev), | |
| 1589 | - | "Failed to allocate cached DC state during suspend\n"); | |
| 1590 | - | mutex_unlock(&dm->dc_lock); | |
| 1591 | - | return -ENOMEM; | |
| 1592 | - | } | |
| 1593 | 1585 | ||
| 1594 | - | dm_gpureset_toggle_interrupts(adev, dm->cached_dc_state, false); | |
| 1586 | + | if (dm->cached_dc_state) | |
| 1587 | + | dm_gpureset_toggle_interrupts(adev, dm->cached_dc_state, false); | |
| 1595 | 1588 | ||
| 1596 | 1589 | res = amdgpu_dm_commit_zero_streams(dm->dc); | |
| 1597 | 1590 | if (res != DC_OK) { | |
| @@ -1979,10 +1972,6 @@ static int dm_resume(struct amdgpu_ip_block *ip_block) | |||
| 1979 | 1972 | /* On resume we need to rewrite the MSTM control bits to enable MST*/ | |
| 1980 | 1973 | s3_handle_mst(ddev, false); | |
| 1981 | 1974 | ||
| 1982 | - | /* Exit IPS before the detection loop's first AUX/DDC access. */ | |
| 1983 | - | scoped_guard(mutex, &dm->dc_lock) | |
| 1984 | - | dc_exit_ips_for_hw_access(dm->dc); | |
| 1985 | - | ||
| 1986 | 1975 | /* Do detection*/ | |
| 1987 | 1976 | drm_connector_list_iter_begin(ddev, &iter); | |
| 1988 | 1977 | drm_for_each_connector_iter(connector, &iter) { | |
| @@ -3708,13 +3697,6 @@ static void amdgpu_dm_enable_self_refresh(struct amdgpu_display_manager *dm, | |||
| 3708 | 3697 | struct amdgpu_dm_connector *aconn = | |
| 3709 | 3698 | (struct amdgpu_dm_connector *)acrtc_state->stream->dm_stream_context; | |
| 3710 | 3699 | ||
| 3711 | - | if (!acrtc_state->base.async_flip) { | |
| 3712 | - | amdgpu_dm_psr_set_event(dm, acrtc_state->stream, false, | |
| 3713 | - | psr_event_immediate_flip, false); | |
| 3714 | - | amdgpu_dm_replay_set_event(dm, acrtc_state->stream, false, | |
| 3715 | - | replay_event_immediate_flip, false); | |
| 3716 | - | } | |
| 3717 | - | ||
| 3718 | 3700 | /* Decrement skip count when SR is enabled and we're doing fast updates. */ | |
| 3719 | 3701 | if (acrtc_state->update_type == UPDATE_TYPE_FAST && | |
| 3720 | 3702 | (psr->psr_feature_enabled || pr->replay_feature_enabled)) { | |
| @@ -3897,7 +3879,7 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_commit *state, | |||
| 3897 | 3879 | continue; | |
| 3898 | 3880 | ||
| 3899 | 3881 | bundle->surface_updates[planes_count].surface = dc_plane; | |
| 3900 | - | if (new_pcrtc_state->color_mgmt_changed || new_plane_state->color_mgmt_changed) { | |
| 3882 | + | if (new_pcrtc_state->color_mgmt_changed) { | |
| 3901 | 3883 | bundle->surface_updates[planes_count].gamma = &dc_plane->gamma_correction; | |
| 3902 | 3884 | bundle->surface_updates[planes_count].in_transfer_func = &dc_plane->in_transfer_func; | |
| 3903 | 3885 | bundle->surface_updates[planes_count].gamut_remap_matrix = &dc_plane->gamut_remap_matrix; | |
| @@ -4125,18 +4107,6 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_commit *state, | |||
| 4125 | 4107 | spin_unlock_irqrestore(&pcrtc->dev->event_lock, flags); | |
| 4126 | 4108 | } | |
| 4127 | 4109 | mutex_lock(&dm->dc_lock); | |
| 4128 | - | /* | |
| 4129 | - | * Tearing (immediate) flips cannot work with panel self-refresh | |
| 4130 | - | * features. The event is cleared by | |
| 4131 | - | * amdgpu_dm_enable_self_refresh() once async flips stop. | |
| 4132 | - | */ | |
| 4133 | - | if (immediate_flip) { | |
| 4134 | - | dc_exit_ips_for_hw_access(dm->dc); | |
| 4135 | - | amdgpu_dm_psr_set_event(dm, acrtc_state->stream, true, | |
| 4136 | - | psr_event_immediate_flip, true); | |
| 4137 | - | amdgpu_dm_replay_set_event(dm, acrtc_state->stream, true, | |
| 4138 | - | replay_event_immediate_flip, true); | |
| 4139 | - | } | |
| 4140 | 4110 | update_planes_and_stream_adapter(dm->dc, | |
| 4141 | 4111 | acrtc_state->update_type, | |
| 4142 | 4112 | planes_count, | |
| @@ -5609,10 +5579,8 @@ static int dm_update_crtc_state(struct amdgpu_display_manager *dm, | |||
| 5609 | 5579 | ||
| 5610 | 5580 | skip_modeset: | |
| 5611 | 5581 | /* Release extra reference */ | |
| 5612 | - | if (new_stream) { | |
| 5582 | + | if (new_stream) | |
| 5613 | 5583 | dc_stream_release(new_stream); | |
| 5614 | - | new_stream = NULL; | |
| 5615 | - | } | |
| 5616 | 5584 | new_stream = NULL; | |
| 5617 | 5585 | ||
| 5618 | 5586 | /* | |
| @@ -5730,10 +5698,6 @@ static bool should_reset_plane(struct drm_atomic_commit *state, | |||
| 5730 | 5698 | if (new_crtc_state->color_mgmt_changed) | |
| 5731 | 5699 | return true; | |
| 5732 | 5700 | ||
| 5733 | - | /* Plane color pipeline or its colorop changes. */ | |
| 5734 | - | if (new_plane_state->color_mgmt_changed) | |
| 5735 | - | return true; | |
| 5736 | - | ||
| 5737 | 5701 | /* | |
| 5738 | 5702 | * On zpos change, planes need to be reordered by removing and re-adding | |
| 5739 | 5703 | * them one by one to the dc state, in order of descending zpos. | |
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_backlight.c
| @@ -39,7 +39,6 @@ | |||
| 39 | 39 | #include "modules/inc/mod_power.h" | |
| 40 | 40 | ||
| 41 | 41 | #include <linux/backlight.h> | |
| 42 | - | #include <linux/minmax.h> | |
| 43 | 42 | #include <linux/power_supply.h> | |
| 44 | 43 | #include <drm/drm_edid.h> | |
| 45 | 44 | #include <drm/drm_utils.h> | |
| @@ -119,68 +118,6 @@ static inline u32 scale_fw_to_input(int min, int max, u64 input) | |||
| 119 | 118 | return min + DIV_ROUND_CLOSEST_ULL(input * (max - min), AMDGPU_MAX_BL_LEVEL); | |
| 120 | 119 | } | |
| 121 | 120 | ||
| 122 | - | static u32 backlight_signal_to_luminance(const struct amdgpu_dm_backlight_caps *caps, | |
| 123 | - | u32 signal) | |
| 124 | - | { | |
| 125 | - | u32 lower_signal, upper_signal; | |
| 126 | - | u32 lower_lum, upper_lum; | |
| 127 | - | int i; | |
| 128 | - | ||
| 129 | - | if (!caps->data_points) | |
| 130 | - | return DIV_ROUND_CLOSEST(signal * 100, AMDGPU_MAX_BL_LEVEL); | |
| 131 | - | ||
| 132 | - | if (signal < caps->luminance_data[0].input_signal) { | |
| 133 | - | lower_signal = 0; | |
| 134 | - | lower_lum = 0; | |
| 135 | - | upper_signal = caps->luminance_data[0].input_signal; | |
| 136 | - | upper_lum = caps->luminance_data[0].luminance; | |
| 137 | - | } else if (signal >= | |
| 138 | - | caps->luminance_data[caps->data_points - 1].input_signal) { | |
| 139 | - | lower_signal = caps->luminance_data[caps->data_points - 1].input_signal; | |
| 140 | - | lower_lum = caps->luminance_data[caps->data_points - 1].luminance; | |
| 141 | - | upper_signal = caps->max_input_signal; | |
| 142 | - | upper_lum = 100; | |
| 143 | - | } else { | |
| 144 | - | for (i = 1; | |
| 145 | - | i < caps->data_points && | |
| 146 | - | signal > caps->luminance_data[i].input_signal; | |
| 147 | - | i++) | |
| 148 | - | ; | |
| 149 | - | ||
| 150 | - | lower_signal = caps->luminance_data[i - 1].input_signal; | |
| 151 | - | upper_signal = caps->luminance_data[i].input_signal; | |
| 152 | - | lower_lum = caps->luminance_data[i - 1].luminance; | |
| 153 | - | upper_lum = caps->luminance_data[i].luminance; | |
| 154 | - | } | |
| 155 | - | ||
| 156 | - | if (upper_signal == lower_signal) | |
| 157 | - | return upper_lum; | |
| 158 | - | ||
| 159 | - | return lower_lum + DIV_ROUND_CLOSEST((upper_lum - lower_lum) * | |
| 160 | - | (signal - lower_signal), | |
| 161 | - | upper_signal - lower_signal); | |
| 162 | - | } | |
| 163 | - | ||
| 164 | - | static u32 convert_brightness_to_millipercent(const struct amdgpu_dm_backlight_caps *caps, | |
| 165 | - | u32 user_brightness) | |
| 166 | - | { | |
| 167 | - | unsigned int min, max; | |
| 168 | - | u32 signal, luminance; | |
| 169 | - | ||
| 170 | - | if (!get_brightness_range(caps, &min, &max)) | |
| 171 | - | return DIV_ROUND_CLOSEST_ULL((u64)user_brightness * 100000, | |
| 172 | - | MAX_BACKLIGHT_LEVEL); | |
| 173 | - | ||
| 174 | - | user_brightness = clamp(user_brightness, min, max); | |
| 175 | - | if (amdgpu_dc_debug_mask & DC_DISABLE_CUSTOM_BRIGHTNESS_CURVE) | |
| 176 | - | return DIV_ROUND_CLOSEST_ULL((u64)user_brightness * 100000, max); | |
| 177 | - | ||
| 178 | - | signal = scale_input_to_fw(max, user_brightness); | |
| 179 | - | luminance = backlight_signal_to_luminance(caps, signal); | |
| 180 | - | ||
| 181 | - | return min_t(u32, luminance * 1000, 100000); | |
| 182 | - | } | |
| 183 | - | ||
| 184 | 121 | STATIC_IFN_KUNIT | |
| 185 | 122 | void convert_custom_brightness(const struct amdgpu_dm_backlight_caps *caps, | |
| 186 | 123 | unsigned int min, unsigned int max, | |
| @@ -323,10 +260,10 @@ void amdgpu_dm_backlight_set_level(struct amdgpu_display_manager *dm, | |||
| 323 | 260 | struct amdgpu_dm_backlight_caps *caps; | |
| 324 | 261 | struct dc_link *link; | |
| 325 | 262 | u32 brightness = 0; | |
| 326 | - | u32 millipercent = 0; | |
| 327 | 263 | bool rc = false, reallow_idle = false; | |
| 328 | 264 | struct drm_connector *connector; | |
| 329 | 265 | struct dc_stream_state *stream; | |
| 266 | + | unsigned int min, max; | |
| 330 | 267 | ||
| 331 | 268 | list_for_each_entry(connector, &dm->ddev->mode_config.connector_list, head) { | |
| 332 | 269 | struct amdgpu_dm_connector *aconnector = to_amdgpu_dm_connector(connector); | |
| @@ -349,21 +286,12 @@ void amdgpu_dm_backlight_set_level(struct amdgpu_display_manager *dm, | |||
| 349 | 286 | /* update scratch register */ | |
| 350 | 287 | if (bl_idx == 0) | |
| 351 | 288 | amdgpu_atombios_scratch_regs_set_backlight_level(dm->adev, dm->brightness[bl_idx]); | |
| 352 | - | ||
| 289 | + | brightness = convert_brightness_from_user(caps, dm->brightness[bl_idx]); | |
| 353 | 290 | link = (struct dc_link *)dm->backlight_link[bl_idx]; | |
| 354 | - | stream = dm_find_stream_with_link(dm, link); | |
| 355 | - | if (!stream) | |
| 356 | - | return; | |
| 357 | 291 | ||
| 358 | - | if (caps->aux_support) { | |
| 359 | - | brightness = convert_brightness_from_user(caps, dm->brightness[bl_idx]); | |
| 360 | - | /* Apply brightness quirk */ | |
| 361 | - | if (caps->brightness_mask) | |
| 362 | - | brightness |= caps->brightness_mask; | |
| 363 | - | } else { | |
| 364 | - | millipercent = convert_brightness_to_millipercent(caps, | |
| 365 | - | user_brightness); | |
| 366 | - | } | |
| 292 | + | /* Apply brightness quirk */ | |
| 293 | + | if (caps->brightness_mask) | |
| 294 | + | brightness |= caps->brightness_mask; | |
| 367 | 295 | ||
| 368 | 296 | if (trace_amdgpu_dm_brightness_enabled()) { | |
| 369 | 297 | trace_amdgpu_dm_brightness(__builtin_return_address(0), | |
| @@ -373,6 +301,10 @@ void amdgpu_dm_backlight_set_level(struct amdgpu_display_manager *dm, | |||
| 373 | 301 | power_supply_is_system_supplied() > 0); | |
| 374 | 302 | } | |
| 375 | 303 | ||
| 304 | + | stream = dm_find_stream_with_link(dm, link); | |
| 305 | + | if (!stream) | |
| 306 | + | return; | |
| 307 | + | ||
| 376 | 308 | mutex_lock(&dm->dc_lock); | |
| 377 | 309 | if (dm->dc->caps.ips_support && dm->dc->ctx->dmub_srv->idle_allowed) { | |
| 378 | 310 | dc_allow_idle_optimizations(dm->dc, false); | |
| @@ -384,8 +316,10 @@ void amdgpu_dm_backlight_set_level(struct amdgpu_display_manager *dm, | |||
| 384 | 316 | AUX_BL_DEFAULT_TRANSITION_TIME_MS, false, true); | |
| 385 | 317 | } else { | |
| 386 | 318 | /* power module uses millipercent */ | |
| 319 | + | get_brightness_range(caps, &min, &max); | |
| 320 | + | brightness = DIV_ROUND_CLOSEST(brightness * 100, (max - min)) * 1000; | |
| 387 | 321 | rc = mod_power_set_backlight_percent(dm->power_module, stream, | |
| 388 | - | millipercent, 0, false); | |
| 322 | + | brightness, 0, false); | |
| 389 | 323 | } | |
| 390 | 324 | ||
| 391 | 325 | /* | |
| @@ -600,12 +534,8 @@ void amdgpu_dm_update_connector_ext_caps(struct amdgpu_dm_connector *aconnector) | |||
| 600 | 534 | else if (!IS_ERR_OR_NULL(panel_backlight_quirk) && | |
| 601 | 535 | panel_backlight_quirk->force_pwm) | |
| 602 | 536 | caps->aux_support = false; | |
| 603 | - | if (caps->aux_support) { | |
| 604 | - | if (aconnector->dc_link->dpcd_caps.panel_luminance_control) | |
| 605 | - | aconnector->dc_link->backlight_control_type = BACKLIGHT_CONTROL_VESA_AUX; | |
| 606 | - | else | |
| 607 | - | aconnector->dc_link->backlight_control_type = BACKLIGHT_CONTROL_AMD_AUX; | |
| 608 | - | } | |
| 537 | + | if (caps->aux_support) | |
| 538 | + | aconnector->dc_link->backlight_control_type = BACKLIGHT_CONTROL_AMD_AUX; | |
| 609 | 539 | ||
| 610 | 540 | luminance_range = &conn_base->display_info.luminance_range; | |
| 611 | 541 | ||
modified drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c
| @@ -732,24 +732,6 @@ get_aspect_ratio(const struct drm_display_mode *mode_in) | |||
| 732 | 732 | } | |
| 733 | 733 | EXPORT_IF_KUNIT(get_aspect_ratio); | |
| 734 | 734 | ||
| 735 | - | /* | |
| 736 | - | * CTA-861 5.1: RGB video formats default to limited range except 640x480 (VIC 1). | |
| 737 | - | * With Broadcast RGB left at Automatic follow that default, as i915 does. | |
| 738 | - | */ | |
| 739 | - | static bool rgb_output_is_limited_range(const struct dc_crtc_timing *dc_crtc_timing, | |
| 740 | - | const struct drm_connector_state *connector_state) | |
| 741 | - | { | |
| 742 | - | switch (connector_state->hdmi.broadcast_rgb) { | |
| 743 | - | case DRM_HDMI_BROADCAST_RGB_FULL: | |
| 744 | - | return false; | |
| 745 | - | case DRM_HDMI_BROADCAST_RGB_LIMITED: | |
| 746 | - | return true; | |
| 747 | - | default: | |
| 748 | - | return connector_state->connector->display_info.is_hdmi && | |
| 749 | - | dc_crtc_timing->vic > 1; | |
| 750 | - | } | |
| 751 | - | } | |
| 752 | - | ||
| 753 | 735 | enum dc_color_space | |
| 754 | 736 | amdgpu_dm_get_output_color_space(const struct dc_crtc_timing *dc_crtc_timing, | |
| 755 | 737 | const struct drm_connector_state *connector_state) | |
| @@ -774,20 +756,16 @@ amdgpu_dm_get_output_color_space(const struct dc_crtc_timing *dc_crtc_timing, | |||
| 774 | 756 | break; | |
| 775 | 757 | case DRM_MODE_COLORIMETRY_BT2020_RGB: | |
| 776 | 758 | case DRM_MODE_COLORIMETRY_BT2020_YCC: | |
| 777 | - | if (dc_crtc_timing->pixel_encoding == PIXEL_ENCODING_RGB) { | |
| 778 | - | if (rgb_output_is_limited_range(dc_crtc_timing, connector_state)) | |
| 779 | - | color_space = COLOR_SPACE_2020_RGB_LIMITEDRANGE; | |
| 780 | - | else | |
| 781 | - | color_space = COLOR_SPACE_2020_RGB_FULLRANGE; | |
| 782 | - | } else { | |
| 759 | + | if (dc_crtc_timing->pixel_encoding == PIXEL_ENCODING_RGB) | |
| 760 | + | color_space = COLOR_SPACE_2020_RGB_FULLRANGE; | |
| 761 | + | else | |
| 783 | 762 | color_space = COLOR_SPACE_2020_YCBCR_LIMITED; | |
| 784 | - | } | |
| 785 | 763 | break; | |
| 786 | 764 | case DRM_MODE_COLORIMETRY_DEFAULT: /* ITU601 */ | |
| 787 | 765 | default: | |
| 788 | 766 | if (dc_crtc_timing->pixel_encoding == PIXEL_ENCODING_RGB) { | |
| 789 | 767 | color_space = COLOR_SPACE_SRGB; | |
| 790 | - | if (rgb_output_is_limited_range(dc_crtc_timing, connector_state)) | |
| 768 | + | if (connector_state->hdmi.broadcast_rgb == DRM_HDMI_BROADCAST_RGB_LIMITED) | |
| 791 | 769 | color_space = COLOR_SPACE_SRGB_LIMITED; | |
| 792 | 770 | /* | |
| 793 | 771 | * 27030khz is the separation point between HDTV and SDTV | |
| @@ -1012,15 +990,10 @@ decide_crtc_timing_for_drm_display_mode(struct drm_display_mode *drm_mode, | |||
| 1012 | 990 | const struct drm_display_mode *native_mode, | |
| 1013 | 991 | bool scale_enabled) | |
| 1014 | 992 | { | |
| 1015 | - | /* Inserted modes copy the native sync; a sink mode with equal totals may not */ | |
| 1016 | 993 | if (scale_enabled || ( | |
| 1017 | 994 | native_mode->clock == drm_mode->clock && | |
| 1018 | 995 | native_mode->htotal == drm_mode->htotal && | |
| 1019 | - | native_mode->vtotal == drm_mode->vtotal && | |
| 1020 | - | native_mode->hsync_start == drm_mode->hsync_start && | |
| 1021 | - | native_mode->hsync_end == drm_mode->hsync_end && | |
| 1022 | - | native_mode->vsync_start == drm_mode->vsync_start && | |
| 1023 | - | native_mode->vsync_end == drm_mode->vsync_end)) { | |
| 996 | + | native_mode->vtotal == drm_mode->vtotal)) { | |
| 1024 | 997 | if (native_mode->crtc_clock) | |
| 1025 | 998 | copy_crtc_timing_for_drm_display_mode(native_mode, drm_mode); | |
| 1026 | 999 | } else { | |
| @@ -2279,8 +2252,8 @@ amdgpu_dm_create_validate_stream_for_sink(struct drm_connector *connector, | |||
| 2279 | 2252 | * below gate which of these entries are actually attempted. | |
| 2280 | 2253 | */ | |
| 2281 | 2254 | static const enum dc_pixel_encoding encoding_order[] = { | |
| 2282 | - | PIXEL_ENCODING_RGB, | |
| 2283 | 2255 | PIXEL_ENCODING_YCBCR444, | |
| 2256 | + | PIXEL_ENCODING_RGB, | |
| 2284 | 2257 | PIXEL_ENCODING_YCBCR422, | |
| 2285 | 2258 | PIXEL_ENCODING_YCBCR420, | |
| 2286 | 2259 | }; | |
| @@ -3964,15 +3937,17 @@ void amdgpu_dm_update_freesync_caps(struct drm_connector *connector, | |||
| 3964 | 3937 | } | |
| 3965 | 3938 | ||
| 3966 | 3939 | /* Handle MCCS */ | |
| 3967 | - | if (do_mccs) { | |
| 3940 | + | if (do_mccs) | |
| 3968 | 3941 | dm_helpers_read_mccs_caps(adev->dm.dc->ctx, amdgpu_dm_connector->dc_link, sink); | |
| 3969 | 3942 | ||
| 3970 | - | if (sink->edid_caps.freesync_vcp_code && !sink->mccs_caps.freesync_supported) | |
| 3971 | - | freesync_capable = false; | |
| 3943 | + | if ((sink->sink_signal == SIGNAL_TYPE_HDMI_TYPE_A || | |
| 3944 | + | as_type == FREESYNC_TYPE_PCON_IN_WHITELIST) && | |
| 3945 | + | (!sink->edid_caps.freesync_vcp_code || | |
| 3946 | + | (sink->edid_caps.freesync_vcp_code && !sink->mccs_caps.freesync_supported))) | |
| 3947 | + | freesync_capable = false; | |
| 3972 | 3948 | ||
| 3973 | - | if (sink->mccs_caps.freesync_supported && freesync_capable) | |
| 3974 | - | dm_helpers_mccs_vcp_set(adev->dm.dc->ctx, amdgpu_dm_connector->dc_link, sink); | |
| 3975 | - | } | |
| 3949 | + | if (do_mccs && sink->mccs_caps.freesync_supported && freesync_capable) | |
| 3950 | + | dm_helpers_mccs_vcp_set(adev->dm.dc->ctx, amdgpu_dm_connector->dc_link, sink); | |
| 3976 | 3951 | ||
| 3977 | 3952 | update: | |
| 3978 | 3953 | if (dm_con_state) | |
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_debugfs.c
| @@ -196,6 +196,7 @@ static ssize_t dp_link_settings_read(struct file *f, char __user *buf, | |||
| 196 | 196 | char *rd_buf_ptr = NULL; | |
| 197 | 197 | const uint32_t rd_buf_size = 100; | |
| 198 | 198 | uint32_t result = 0; | |
| 199 | + | uint8_t str_len = 0; | |
| 199 | 200 | int r; | |
| 200 | 201 | ||
| 201 | 202 | if (*pos & 3 || size & 3) | |
| @@ -207,26 +208,29 @@ static ssize_t dp_link_settings_read(struct file *f, char __user *buf, | |||
| 207 | 208 | ||
| 208 | 209 | rd_buf_ptr = rd_buf; | |
| 209 | 210 | ||
| 210 | - | rd_buf_ptr += scnprintf(rd_buf_ptr, rd_buf_size - (rd_buf_ptr - rd_buf), | |
| 211 | - | "Current: %d 0x%x %d ", | |
| 211 | + | str_len = strlen("Current: %d 0x%x %d "); | |
| 212 | + | snprintf(rd_buf_ptr, str_len, "Current: %d 0x%x %d ", | |
| 212 | 213 | link->cur_link_settings.lane_count, | |
| 213 | 214 | link->cur_link_settings.link_rate, | |
| 214 | 215 | link->cur_link_settings.link_spread); | |
| 216 | + | rd_buf_ptr += str_len; | |
| 215 | 217 | ||
| 216 | - | rd_buf_ptr += scnprintf(rd_buf_ptr, rd_buf_size - (rd_buf_ptr - rd_buf), | |
| 217 | - | "Verified: %d 0x%x %d ", | |
| 218 | + | str_len = strlen("Verified: %d 0x%x %d "); | |
| 219 | + | snprintf(rd_buf_ptr, str_len, "Verified: %d 0x%x %d ", | |
| 218 | 220 | link->verified_link_cap.lane_count, | |
| 219 | 221 | link->verified_link_cap.link_rate, | |
| 220 | 222 | link->verified_link_cap.link_spread); | |
| 223 | + | rd_buf_ptr += str_len; | |
| 221 | 224 | ||
| 222 | - | rd_buf_ptr += scnprintf(rd_buf_ptr, rd_buf_size - (rd_buf_ptr - rd_buf), | |
| 223 | - | "Reported: %d 0x%x %d ", | |
| 225 | + | str_len = strlen("Reported: %d 0x%x %d "); | |
| 226 | + | snprintf(rd_buf_ptr, str_len, "Reported: %d 0x%x %d ", | |
| 224 | 227 | link->reported_link_cap.lane_count, | |
| 225 | 228 | link->reported_link_cap.link_rate, | |
| 226 | 229 | link->reported_link_cap.link_spread); | |
| 230 | + | rd_buf_ptr += str_len; | |
| 227 | 231 | ||
| 228 | - | rd_buf_ptr += scnprintf(rd_buf_ptr, rd_buf_size - (rd_buf_ptr - rd_buf), | |
| 229 | - | "Preferred: %d 0x%x %d\n", | |
| 232 | + | str_len = strlen("Preferred: %d 0x%x %d "); | |
| 233 | + | snprintf(rd_buf_ptr, str_len, "Preferred: %d 0x%x %d\n", | |
| 230 | 234 | link->preferred_link_setting.lane_count, | |
| 231 | 235 | link->preferred_link_setting.link_rate, | |
| 232 | 236 | link->preferred_link_setting.link_spread); | |
modified drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
| @@ -200,7 +200,6 @@ enum dc_edid_status dm_helpers_parse_edid_caps( | |||
| 200 | 200 | edid_caps->edid_hdmi = connector->display_info.is_hdmi; | |
| 201 | 201 | ||
| 202 | 202 | if (edid_caps->edid_hdmi) { | |
| 203 | - | edid_caps->qs_bit = connector->display_info.rgb_quant_range_selectable; | |
| 204 | 203 | populate_hdmi_info_from_connector(link->dc->config.enable_frl, &connector->display_info.hdmi, edid_caps); | |
| 205 | 204 | drm_dbg_driver(connector->dev, "%s: HDMI_FRL [%s] max_frl_rate %d\n", __func__, connector->name, edid_caps->max_frl_rate); | |
| 206 | 205 | if (edid_caps->frl_dsc_support) | |
| @@ -1203,10 +1202,9 @@ void populate_hdmi_info_from_connector(bool enable_frl, struct drm_hdmi_info *hd | |||
| 1203 | 1202 | edid_caps->max_frl_rate = get_max_frl_rate(hdmi->max_lanes, hdmi->max_frl_rate_per_lane); | |
| 1204 | 1203 | edid_caps->frl_dsc_support = hdmi->dsc_cap.v_1p2; | |
| 1205 | 1204 | if (edid_caps->frl_dsc_support) { | |
| 1206 | - | /* HF-VSDB DSC max bpc is cumulative: >=12 implies 10 and 8. */ | |
| 1207 | - | if (hdmi->dsc_cap.bpc_supported >= 10) | |
| 1205 | + | if (hdmi->dsc_cap.bpc_supported == 10) | |
| 1208 | 1206 | edid_caps->frl_dsc_10bpc = true; | |
| 1209 | - | if (hdmi->dsc_cap.bpc_supported >= 12) | |
| 1207 | + | else if (hdmi->dsc_cap.bpc_supported == 12) | |
| 1210 | 1208 | edid_caps->frl_dsc_12bpc = true; | |
| 1211 | 1209 | edid_caps->frl_dsc_all_bpp = hdmi->dsc_cap.all_bpp; | |
| 1212 | 1210 | edid_caps->frl_dsc_native_420 = hdmi->dsc_cap.native_420; | |
| @@ -1439,13 +1437,12 @@ void dm_helpers_free_gpu_mem( | |||
| 1439 | 1437 | ||
| 1440 | 1438 | bool dm_helpers_dmub_outbox_interrupt_control(struct dc_context *ctx, bool enable) | |
| 1441 | 1439 | { | |
| 1442 | - | struct amdgpu_device *adev = ctx->driver_context; | |
| 1443 | 1440 | enum dc_irq_source irq_source; | |
| 1444 | 1441 | bool ret; | |
| 1445 | 1442 | ||
| 1446 | 1443 | irq_source = DC_IRQ_SOURCE_DMCUB_OUTBOX; | |
| 1447 | 1444 | ||
| 1448 | - | ret = amdgpu_dm_irq_set(adev, irq_source, enable); | |
| 1445 | + | ret = dc_interrupt_set(ctx->dc, irq_source, enable); | |
| 1449 | 1446 | ||
| 1450 | 1447 | DRM_DEBUG_DRIVER("Dmub trace irq %sabling: r=%d\n", | |
| 1451 | 1448 | 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/amdgpu_dm_mst_types.c
| @@ -1231,8 +1231,7 @@ static bool get_conv_frl_bw(struct amdgpu_dm_connector *aconnector, | |||
| 1231 | 1231 | unsigned int max_sink_bw_in_kbps = 0; | |
| 1232 | 1232 | unsigned int dsc_max_sink_bw_in_kbps = 0; | |
| 1233 | 1233 | ||
| 1234 | - | if (aconnector->dc_sink && | |
| 1235 | - | aconnector->dc_link->dc->caps.dp_hdmi21_pcon_support && | |
| 1234 | + | if (aconnector->dc_link->dc->caps.dp_hdmi21_pcon_support && | |
| 1236 | 1235 | aconnector->mst_downstream_port_caps.bytes.byte0.bits.DWN_STRM_PORTX_TYPE == DOWN_STREAM_DETAILED_HDMI) { | |
| 1237 | 1236 | max_conv_bw_in_kbps = dc_link_bw_kbps_from_raw_frl_link_rate_data( | |
| 1238 | 1237 | aconnector->dc_link->dc, | |
| @@ -1997,9 +1996,6 @@ enum dc_status dm_dp_mst_is_port_support_mode( | |||
| 1997 | 1996 | struct dc_dsc_config_options dsc_options = {0}; | |
| 1998 | 1997 | uint32_t stream_kbps; | |
| 1999 | 1998 | ||
| 2000 | - | if (!aconnector->dc_sink) | |
| 2001 | - | return DC_FAIL_BANDWIDTH_VALIDATE; | |
| 2002 | - | ||
| 2003 | 1999 | /* DSC unnecessary case | |
| 2004 | 2000 | * Check if timing could be supported within end-to-end BW | |
| 2005 | 2001 | */ | |
modified drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c
| @@ -112,7 +112,25 @@ void amdgpu_dm_plane_fill_blending_from_plane_state(const struct drm_plane_state | |||
| 112 | 112 | ||
| 113 | 113 | if (plane_state->pixel_blend_mode == DRM_MODE_BLEND_PREMULTI || | |
| 114 | 114 | plane_state->pixel_blend_mode == DRM_MODE_BLEND_COVERAGE) { | |
| 115 | - | *per_pixel_alpha = plane_state->fb->format->has_alpha; | |
| 115 | + | static const uint32_t alpha_formats[] = { | |
| 116 | + | DRM_FORMAT_ARGB8888, | |
| 117 | + | DRM_FORMAT_RGBA8888, | |
| 118 | + | DRM_FORMAT_ABGR8888, | |
| 119 | + | DRM_FORMAT_ARGB2101010, | |
| 120 | + | DRM_FORMAT_ABGR2101010, | |
| 121 | + | DRM_FORMAT_ARGB16161616, | |
| 122 | + | DRM_FORMAT_ABGR16161616, | |
| 123 | + | DRM_FORMAT_ARGB16161616F, | |
| 124 | + | }; | |
| 125 | + | uint32_t format = plane_state->fb->format->format; | |
| 126 | + | unsigned int i; | |
| 127 | + | ||
| 128 | + | for (i = 0; i < ARRAY_SIZE(alpha_formats); ++i) { | |
| 129 | + | if (format == alpha_formats[i]) { | |
| 130 | + | *per_pixel_alpha = true; | |
| 131 | + | break; | |
| 132 | + | } | |
| 133 | + | } | |
| 116 | 134 | ||
| 117 | 135 | if (*per_pixel_alpha && plane_state->pixel_blend_mode == DRM_MODE_BLEND_COVERAGE) | |
| 118 | 136 | *pre_multiplied_alpha = false; | |
| @@ -2190,41 +2208,16 @@ int amdgpu_dm_plane_init(struct amdgpu_display_manager *dm, | |||
| 2190 | 2208 | if (res) | |
| 2191 | 2209 | return res; | |
| 2192 | 2210 | ||
| 2193 | - | /* Blend mode support varies on DCE generations according to HW caps | |
| 2194 | - | * and number of planes per CRTC. However, as current driver | |
| 2195 | - | * implementation only creates one primary and one cursor plane per | |
| 2196 | - | * CRTC for DCE (overlay is only created if | |
| 2197 | - | * DC_PLANE_TYPE_DCN_UNIVERSAL), the primary plane blend mode is | |
| 2198 | - | * ignored across DCE versions. Keep PREMULTI to avoid uAPI | |
| 2199 | - | * regressions: it was the default/mandatory mode for many years and, | |
| 2200 | - | * with no overlay plane, primary composes on top of a black | |
| 2201 | - | * background, where PREMULTI and PIXEL_NONE are equivalent. | |
| 2202 | - | */ | |
| 2203 | - | if (plane_cap && plane_cap->type != DC_PLANE_TYPE_DCN_UNIVERSAL) { | |
| 2204 | - | unsigned int blend_caps = BIT(DRM_MODE_BLEND_PIXEL_NONE) | | |
| 2205 | - | BIT(DRM_MODE_BLEND_PREMULTI); | |
| 2206 | - | ||
| 2207 | - | drm_plane_create_blend_mode_property(plane, blend_caps); | |
| 2208 | - | } else if ((plane->type == DRM_PLANE_TYPE_OVERLAY || | |
| 2209 | - | plane->type == DRM_PLANE_TYPE_PRIMARY) && | |
| 2210 | - | plane_cap && plane_cap->per_pixel_alpha) { | |
| 2211 | + | if (plane->type == DRM_PLANE_TYPE_OVERLAY && | |
| 2212 | + | plane_cap && plane_cap->per_pixel_alpha) { | |
| 2211 | 2213 | unsigned int blend_caps = BIT(DRM_MODE_BLEND_PIXEL_NONE) | | |
| 2212 | 2214 | BIT(DRM_MODE_BLEND_PREMULTI) | | |
| 2213 | 2215 | BIT(DRM_MODE_BLEND_COVERAGE); | |
| 2214 | 2216 | ||
| 2217 | + | drm_plane_create_alpha_property(plane); | |
| 2215 | 2218 | drm_plane_create_blend_mode_property(plane, blend_caps); | |
| 2216 | - | ||
| 2217 | - | if (plane->type == DRM_PLANE_TYPE_OVERLAY) | |
| 2218 | - | drm_plane_create_alpha_property(plane); | |
| 2219 | 2219 | } | |
| 2220 | 2220 | ||
| 2221 | - | /* Cursor color format is set to CURSOR_MODE_COLOR_PRE_MULTIPLIED_ALPHA | |
| 2222 | - | * by default, so only advertise DRM_MODE_BLEND_PREMULTI blend mode for | |
| 2223 | - | * this type of plane. | |
| 2224 | - | */ | |
| 2225 | - | if (plane->type == DRM_PLANE_TYPE_CURSOR) | |
| 2226 | - | drm_plane_create_blend_mode_property(plane, BIT(DRM_MODE_BLEND_PREMULTI)); | |
| 2227 | - | ||
| 2228 | 2221 | if (plane->type == DRM_PLANE_TYPE_PRIMARY) { | |
| 2229 | 2222 | /* | |
| 2230 | 2223 | * Allow OVERLAY planes to be used as underlays by assigning an | |
modified drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_connector_test.c
| @@ -409,9 +409,7 @@ static void dm_test_output_color_space_default_rgb_full(struct kunit *test) | |||
| 409 | 409 | { | |
| 410 | 410 | struct dc_crtc_timing timing = {}; | |
| 411 | 411 | struct drm_connector_state state = {}; | |
| 412 | - | struct drm_connector *connector = kunit_kzalloc(test, sizeof(*connector), GFP_KERNEL); | |
| 413 | 412 | ||
| 414 | - | state.connector = connector; | |
| 415 | 413 | timing.pixel_encoding = PIXEL_ENCODING_RGB; | |
| 416 | 414 | state.colorspace = DRM_MODE_COLORIMETRY_DEFAULT; | |
| 417 | 415 | state.hdmi.broadcast_rgb = DRM_HDMI_BROADCAST_RGB_AUTO; | |
| @@ -561,9 +559,7 @@ static void dm_test_output_color_space_bt2020_rgb(struct kunit *test) | |||
| 561 | 559 | { | |
| 562 | 560 | struct dc_crtc_timing timing = {}; | |
| 563 | 561 | struct drm_connector_state state = {}; | |
| 564 | - | struct drm_connector *connector = kunit_kzalloc(test, sizeof(*connector), GFP_KERNEL); | |
| 565 | 562 | ||
| 566 | - | state.connector = connector; | |
| 567 | 563 | timing.pixel_encoding = PIXEL_ENCODING_RGB; | |
| 568 | 564 | state.colorspace = DRM_MODE_COLORIMETRY_BT2020_RGB; | |
| 569 | 565 | ||
| @@ -571,127 +567,6 @@ static void dm_test_output_color_space_bt2020_rgb(struct kunit *test) | |||
| 571 | 567 | (int)COLOR_SPACE_2020_RGB_FULLRANGE); | |
| 572 | 568 | } | |
| 573 | 569 | ||
| 574 | - | /** | |
| 575 | - | * dm_test_output_color_space_bt2020_rgb_limited - Test limited BT.2020 RGB | |
| 576 | - | * @test: The KUnit test context | |
| 577 | - | */ | |
| 578 | - | static void dm_test_output_color_space_bt2020_rgb_limited(struct kunit *test) | |
| 579 | - | { | |
| 580 | - | struct dc_crtc_timing timing = {}; | |
| 581 | - | struct drm_connector_state state = {}; | |
| 582 | - | ||
| 583 | - | timing.pixel_encoding = PIXEL_ENCODING_RGB; | |
| 584 | - | state.colorspace = DRM_MODE_COLORIMETRY_BT2020_RGB; | |
| 585 | - | state.hdmi.broadcast_rgb = DRM_HDMI_BROADCAST_RGB_LIMITED; | |
| 586 | - | ||
| 587 | - | KUNIT_EXPECT_EQ(test, (int)amdgpu_dm_get_output_color_space(&timing, &state), | |
| 588 | - | (int)COLOR_SPACE_2020_RGB_LIMITEDRANGE); | |
| 589 | - | } | |
| 590 | - | ||
| 591 | - | /** | |
| 592 | - | * dm_test_output_color_space_default_rgb_auto_hdmi_cta - Automatic follows the CTA-861 default | |
| 593 | - | * @test: The KUnit test context | |
| 594 | - | */ | |
| 595 | - | static void dm_test_output_color_space_default_rgb_auto_hdmi_cta(struct kunit *test) | |
| 596 | - | { | |
| 597 | - | struct dc_crtc_timing timing = {}; | |
| 598 | - | struct drm_connector_state state = {}; | |
| 599 | - | struct drm_connector *connector = kunit_kzalloc(test, sizeof(*connector), GFP_KERNEL); | |
| 600 | - | ||
| 601 | - | connector->display_info.is_hdmi = true; | |
| 602 | - | timing.pixel_encoding = PIXEL_ENCODING_RGB; | |
| 603 | - | timing.vic = 32; | |
| 604 | - | state.connector = connector; | |
| 605 | - | state.colorspace = DRM_MODE_COLORIMETRY_DEFAULT; | |
| 606 | - | state.hdmi.broadcast_rgb = DRM_HDMI_BROADCAST_RGB_AUTO; | |
| 607 | - | ||
| 608 | - | KUNIT_EXPECT_EQ(test, (int)amdgpu_dm_get_output_color_space(&timing, &state), | |
| 609 | - | (int)COLOR_SPACE_SRGB_LIMITED); | |
| 610 | - | } | |
| 611 | - | ||
| 612 | - | /** | |
| 613 | - | * dm_test_output_color_space_default_rgb_auto_hdmi_vga - 640x480 (VIC 1) stays full range | |
| 614 | - | * @test: The KUnit test context | |
| 615 | - | */ | |
| 616 | - | static void dm_test_output_color_space_default_rgb_auto_hdmi_vga(struct kunit *test) | |
| 617 | - | { | |
| 618 | - | struct dc_crtc_timing timing = {}; | |
| 619 | - | struct drm_connector_state state = {}; | |
| 620 | - | struct drm_connector *connector = kunit_kzalloc(test, sizeof(*connector), GFP_KERNEL); | |
| 621 | - | ||
| 622 | - | connector->display_info.is_hdmi = true; | |
| 623 | - | timing.pixel_encoding = PIXEL_ENCODING_RGB; | |
| 624 | - | timing.vic = 1; | |
| 625 | - | state.connector = connector; | |
| 626 | - | state.colorspace = DRM_MODE_COLORIMETRY_DEFAULT; | |
| 627 | - | state.hdmi.broadcast_rgb = DRM_HDMI_BROADCAST_RGB_AUTO; | |
| 628 | - | ||
| 629 | - | KUNIT_EXPECT_EQ(test, (int)amdgpu_dm_get_output_color_space(&timing, &state), | |
| 630 | - | (int)COLOR_SPACE_SRGB); | |
| 631 | - | } | |
| 632 | - | ||
| 633 | - | /** | |
| 634 | - | * dm_test_output_color_space_default_rgb_auto_dp_cta - Automatic on a non-HDMI sink is full range | |
| 635 | - | * @test: The KUnit test context | |
| 636 | - | */ | |
| 637 | - | static void dm_test_output_color_space_default_rgb_auto_dp_cta(struct kunit *test) | |
| 638 | - | { | |
| 639 | - | struct dc_crtc_timing timing = {}; | |
| 640 | - | struct drm_connector_state state = {}; | |
| 641 | - | struct drm_connector *connector = kunit_kzalloc(test, sizeof(*connector), GFP_KERNEL); | |
| 642 | - | ||
| 643 | - | timing.pixel_encoding = PIXEL_ENCODING_RGB; | |
| 644 | - | timing.vic = 32; | |
| 645 | - | state.connector = connector; | |
| 646 | - | state.colorspace = DRM_MODE_COLORIMETRY_DEFAULT; | |
| 647 | - | state.hdmi.broadcast_rgb = DRM_HDMI_BROADCAST_RGB_AUTO; | |
| 648 | - | ||
| 649 | - | KUNIT_EXPECT_EQ(test, (int)amdgpu_dm_get_output_color_space(&timing, &state), | |
| 650 | - | (int)COLOR_SPACE_SRGB); | |
| 651 | - | } | |
| 652 | - | ||
| 653 | - | /** | |
| 654 | - | * dm_test_output_color_space_default_rgb_full_hdmi_cta - Full overrides the CTA-861 default | |
| 655 | - | * @test: The KUnit test context | |
| 656 | - | */ | |
| 657 | - | static void dm_test_output_color_space_default_rgb_full_hdmi_cta(struct kunit *test) | |
| 658 | - | { | |
| 659 | - | struct dc_crtc_timing timing = {}; | |
| 660 | - | struct drm_connector_state state = {}; | |
| 661 | - | struct drm_connector *connector = kunit_kzalloc(test, sizeof(*connector), GFP_KERNEL); | |
| 662 | - | ||
| 663 | - | connector->display_info.is_hdmi = true; | |
| 664 | - | timing.pixel_encoding = PIXEL_ENCODING_RGB; | |
| 665 | - | timing.vic = 32; | |
| 666 | - | state.connector = connector; | |
| 667 | - | state.colorspace = DRM_MODE_COLORIMETRY_DEFAULT; | |
| 668 | - | state.hdmi.broadcast_rgb = DRM_HDMI_BROADCAST_RGB_FULL; | |
| 669 | - | ||
| 670 | - | KUNIT_EXPECT_EQ(test, (int)amdgpu_dm_get_output_color_space(&timing, &state), | |
| 671 | - | (int)COLOR_SPACE_SRGB); | |
| 672 | - | } | |
| 673 | - | ||
| 674 | - | /** | |
| 675 | - | * dm_test_output_color_space_bt2020_rgb_auto_hdmi_cta - BT.2020 RGB follows the same default | |
| 676 | - | * @test: The KUnit test context | |
| 677 | - | */ | |
| 678 | - | static void dm_test_output_color_space_bt2020_rgb_auto_hdmi_cta(struct kunit *test) | |
| 679 | - | { | |
| 680 | - | struct dc_crtc_timing timing = {}; | |
| 681 | - | struct drm_connector_state state = {}; | |
| 682 | - | struct drm_connector *connector = kunit_kzalloc(test, sizeof(*connector), GFP_KERNEL); | |
| 683 | - | ||
| 684 | - | connector->display_info.is_hdmi = true; | |
| 685 | - | timing.pixel_encoding = PIXEL_ENCODING_RGB; | |
| 686 | - | timing.vic = 32; | |
| 687 | - | state.connector = connector; | |
| 688 | - | state.colorspace = DRM_MODE_COLORIMETRY_BT2020_RGB; | |
| 689 | - | state.hdmi.broadcast_rgb = DRM_HDMI_BROADCAST_RGB_AUTO; | |
| 690 | - | ||
| 691 | - | KUNIT_EXPECT_EQ(test, (int)amdgpu_dm_get_output_color_space(&timing, &state), | |
| 692 | - | (int)COLOR_SPACE_2020_RGB_LIMITEDRANGE); | |
| 693 | - | } | |
| 694 | - | ||
| 695 | 570 | /** | |
| 696 | 571 | * dm_test_output_color_space_bt2020_ycc - Test Output color space bt2020 ycc | |
| 697 | 572 | * @test: The KUnit test context | |
| @@ -755,9 +630,7 @@ static void dm_test_output_color_space_bt2020_ycc_rgb_encoding(struct kunit *tes | |||
| 755 | 630 | { | |
| 756 | 631 | struct dc_crtc_timing timing = {}; | |
| 757 | 632 | struct drm_connector_state state = {}; | |
| 758 | - | struct drm_connector *connector = kunit_kzalloc(test, sizeof(*connector), GFP_KERNEL); | |
| 759 | 633 | ||
| 760 | - | state.connector = connector; | |
| 761 | 634 | timing.pixel_encoding = PIXEL_ENCODING_RGB; | |
| 762 | 635 | state.colorspace = DRM_MODE_COLORIMETRY_BT2020_YCC; | |
| 763 | 636 | ||
| @@ -765,24 +638,6 @@ static void dm_test_output_color_space_bt2020_ycc_rgb_encoding(struct kunit *tes | |||
| 765 | 638 | (int)COLOR_SPACE_2020_RGB_FULLRANGE); | |
| 766 | 639 | } | |
| 767 | 640 | ||
| 768 | - | /** | |
| 769 | - | * dm_test_output_color_space_bt2020_ycc_rgb_encoding_limited - Test limited | |
| 770 | - | * BT.2020 RGB output selected through the BT.2020 YCC connector colorspace | |
| 771 | - | * @test: The KUnit test context | |
| 772 | - | */ | |
| 773 | - | static void dm_test_output_color_space_bt2020_ycc_rgb_encoding_limited(struct kunit *test) | |
| 774 | - | { | |
| 775 | - | struct dc_crtc_timing timing = {}; | |
| 776 | - | struct drm_connector_state state = {}; | |
| 777 | - | ||
| 778 | - | timing.pixel_encoding = PIXEL_ENCODING_RGB; | |
| 779 | - | state.colorspace = DRM_MODE_COLORIMETRY_BT2020_YCC; | |
| 780 | - | state.hdmi.broadcast_rgb = DRM_HDMI_BROADCAST_RGB_LIMITED; | |
| 781 | - | ||
| 782 | - | KUNIT_EXPECT_EQ(test, (int)amdgpu_dm_get_output_color_space(&timing, &state), | |
| 783 | - | (int)COLOR_SPACE_2020_RGB_LIMITEDRANGE); | |
| 784 | - | } | |
| 785 | - | ||
| 786 | 641 | /** | |
| 787 | 642 | * dm_test_output_color_space_bt2020_rgb_ycc_encoding - Test Output color space | |
| 788 | 643 | * bt2020 rgb with non-rgb pixel encoding falls back to limited ycbcr | |
| @@ -1572,46 +1427,6 @@ static void dm_test_decide_crtc_timing_no_crtc_clock(struct kunit *test) | |||
| 1572 | 1427 | KUNIT_EXPECT_EQ(test, drm_mode.crtc_hdisplay, 0); | |
| 1573 | 1428 | } | |
| 1574 | 1429 | ||
| 1575 | - | static void dm_test_decide_crtc_timing_sink_mode_same_totals(struct kunit *test) | |
| 1576 | - | { | |
| 1577 | - | struct drm_display_mode native_mode = { | |
| 1578 | - | DRM_MODE("3840x2160", DRM_MODE_TYPE_DRIVER, 594000, 3840, 4016, 4104, | |
| 1579 | - | 4400, 0, 2160, 2168, 2178, 2250, 0, | |
| 1580 | - | DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }; | |
| 1581 | - | struct drm_display_mode drm_mode = { | |
| 1582 | - | DRM_MODE("4096x2160", DRM_MODE_TYPE_DRIVER, 594000, 4096, 4184, 4272, | |
| 1583 | - | 4400, 0, 2160, 2168, 2178, 2250, 0, | |
| 1584 | - | DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }; | |
| 1585 | - | ||
| 1586 | - | drm_mode_set_crtcinfo(&native_mode, 0); | |
| 1587 | - | drm_mode_set_crtcinfo(&drm_mode, 0); | |
| 1588 | - | ||
| 1589 | - | decide_crtc_timing_for_drm_display_mode(&drm_mode, &native_mode, false); | |
| 1590 | - | ||
| 1591 | - | KUNIT_EXPECT_EQ(test, drm_mode.crtc_hdisplay, 4096); | |
| 1592 | - | KUNIT_EXPECT_EQ(test, drm_mode.crtc_hsync_start, 4184); | |
| 1593 | - | } | |
| 1594 | - | ||
| 1595 | - | static void dm_test_decide_crtc_timing_inserted_mode(struct kunit *test) | |
| 1596 | - | { | |
| 1597 | - | struct drm_display_mode native_mode = { | |
| 1598 | - | DRM_MODE("3840x2160", DRM_MODE_TYPE_DRIVER, 594000, 3840, 4016, 4104, | |
| 1599 | - | 4400, 0, 2160, 2168, 2178, 2250, 0, | |
| 1600 | - | DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) }; | |
| 1601 | - | struct drm_display_mode drm_mode; | |
| 1602 | - | ||
| 1603 | - | drm_mode_set_crtcinfo(&native_mode, 0); | |
| 1604 | - | drm_mode = native_mode; | |
| 1605 | - | drm_mode.hdisplay = 1920; | |
| 1606 | - | drm_mode.vdisplay = 1080; | |
| 1607 | - | drm_mode_set_crtcinfo(&drm_mode, 0); | |
| 1608 | - | ||
| 1609 | - | decide_crtc_timing_for_drm_display_mode(&drm_mode, &native_mode, false); | |
| 1610 | - | ||
| 1611 | - | KUNIT_EXPECT_EQ(test, drm_mode.crtc_hdisplay, 3840); | |
| 1612 | - | KUNIT_EXPECT_EQ(test, drm_mode.crtc_vdisplay, 2160); | |
| 1613 | - | } | |
| 1614 | - | ||
| 1615 | 1430 | /* Tests for amdgpu_dm_connector_funcs_reset() */ | |
| 1616 | 1431 | ||
| 1617 | 1432 | static const struct drm_connector_funcs dm_test_connector_funcs = { | |
| @@ -3575,7 +3390,6 @@ static struct dm_test_fill_ctx *dm_test_fill_ctx_alloc(struct kunit *test) | |||
| 3575 | 3390 | ||
| 3576 | 3391 | ctx->conn_state = drmm_kzalloc(ctx->drm, sizeof(*ctx->conn_state), GFP_KERNEL); | |
| 3577 | 3392 | KUNIT_ASSERT_NOT_NULL(test, ctx->conn_state); | |
| 3578 | - | ctx->conn_state->connector = &ctx->aconnector->base; | |
| 3579 | 3393 | ctx->stream = kunit_kzalloc(test, sizeof(*ctx->stream), GFP_KERNEL); | |
| 3580 | 3394 | KUNIT_ASSERT_NOT_NULL(test, ctx->stream); | |
| 3581 | 3395 | ctx->mode = kunit_kzalloc(test, sizeof(*ctx->mode), GFP_KERNEL); | |
| @@ -3969,7 +3783,6 @@ static struct dm_test_stream_ctx *dm_test_stream_ctx_alloc(struct kunit *test) | |||
| 3969 | 3783 | ||
| 3970 | 3784 | ctx->dm_state = kunit_kzalloc(test, sizeof(*ctx->dm_state), GFP_KERNEL); | |
| 3971 | 3785 | KUNIT_ASSERT_NOT_NULL(test, ctx->dm_state); | |
| 3972 | - | ctx->dm_state->base.connector = &ctx->aconnector->base; | |
| 3973 | 3786 | ctx->dm_state->scaling = RMX_OFF; | |
| 3974 | 3787 | ||
| 3975 | 3788 | ctx->mode = kunit_kzalloc(test, sizeof(*ctx->mode), GFP_KERNEL); | |
| @@ -4367,7 +4180,7 @@ dm_test_destroy_connector(struct kunit *test, struct drm_device *drm) | |||
| 4367 | 4180 | { | |
| 4368 | 4181 | struct amdgpu_dm_connector *aconnector; | |
| 4369 | 4182 | ||
| 4370 | - | aconnector = kzalloc_obj(*aconnector); | |
| 4183 | + | aconnector = kzalloc(sizeof(*aconnector), GFP_KERNEL); | |
| 4371 | 4184 | KUNIT_ASSERT_NOT_NULL(test, aconnector); | |
| 4372 | 4185 | ||
| 4373 | 4186 | KUNIT_ASSERT_EQ(test, | |
| @@ -5609,17 +5422,10 @@ static struct kunit_case amdgpu_dm_connector_tests[] = { | |||
| 5609 | 5422 | KUNIT_CASE(dm_test_output_color_space_bt709_y_only), | |
| 5610 | 5423 | KUNIT_CASE(dm_test_output_color_space_oprgb), | |
| 5611 | 5424 | KUNIT_CASE(dm_test_output_color_space_bt2020_rgb), | |
| 5612 | - | KUNIT_CASE(dm_test_output_color_space_bt2020_rgb_limited), | |
| 5613 | - | KUNIT_CASE(dm_test_output_color_space_default_rgb_auto_hdmi_cta), | |
| 5614 | - | KUNIT_CASE(dm_test_output_color_space_default_rgb_auto_hdmi_vga), | |
| 5615 | - | KUNIT_CASE(dm_test_output_color_space_default_rgb_auto_dp_cta), | |
| 5616 | - | KUNIT_CASE(dm_test_output_color_space_default_rgb_full_hdmi_cta), | |
| 5617 | - | KUNIT_CASE(dm_test_output_color_space_bt2020_rgb_auto_hdmi_cta), | |
| 5618 | 5425 | KUNIT_CASE(dm_test_output_color_space_bt2020_ycc), | |
| 5619 | 5426 | KUNIT_CASE(dm_test_output_color_space_default_ycbcr709_y_only), | |
| 5620 | 5427 | KUNIT_CASE(dm_test_output_color_space_default_ycbcr601), | |
| 5621 | 5428 | KUNIT_CASE(dm_test_output_color_space_bt2020_ycc_rgb_encoding), | |
| 5622 | - | KUNIT_CASE(dm_test_output_color_space_bt2020_ycc_rgb_encoding_limited), | |
| 5623 | 5429 | KUNIT_CASE(dm_test_output_color_space_bt2020_rgb_ycc_encoding), | |
| 5624 | 5430 | /* Tests for amdgpu_dm_convert_dc_color_depth_into_bpc */ | |
| 5625 | 5431 | KUNIT_CASE(dm_test_convert_color_depth_bpc_mappings), | |
| @@ -5675,8 +5481,6 @@ static struct kunit_case amdgpu_dm_connector_tests[] = { | |||
| 5675 | 5481 | KUNIT_CASE(dm_test_decide_crtc_timing_matching_mode), | |
| 5676 | 5482 | KUNIT_CASE(dm_test_decide_crtc_timing_no_copy), | |
| 5677 | 5483 | KUNIT_CASE(dm_test_decide_crtc_timing_no_crtc_clock), | |
| 5678 | - | KUNIT_CASE(dm_test_decide_crtc_timing_sink_mode_same_totals), | |
| 5679 | - | KUNIT_CASE(dm_test_decide_crtc_timing_inserted_mode), | |
| 5680 | 5484 | /* amdgpu_dm_connector_funcs_reset */ | |
| 5681 | 5485 | KUNIT_CASE(dm_test_funcs_reset_sets_defaults), | |
| 5682 | 5486 | KUNIT_CASE(dm_test_funcs_reset_edp_abm_level), | |
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); | |
| @@ -1449,7 +1445,7 @@ static void dm_test_crtc_destroy_state_no_stream(struct kunit *test) | |||
| 1449 | 1445 | struct dm_crtc_state *dm_state; | |
| 1450 | 1446 | ||
| 1451 | 1447 | /* destroy_state kfree()s the state, so use a plain (unmanaged) alloc. */ | |
| 1452 | - | dm_state = kzalloc_obj(*dm_state); | |
| 1448 | + | dm_state = kzalloc_obj(*dm_state, GFP_KERNEL); | |
| 1453 | 1449 | KUNIT_ASSERT_NOT_ERR_OR_NULL(test, dm_state); | |
| 1454 | 1450 | ||
| 1455 | 1451 | amdgpu_dm_crtc_destroy_state(NULL, &dm_state->base); | |
| @@ -1479,7 +1475,7 @@ static void dm_test_crtc_destroy_state_releases_stream(struct kunit *test) | |||
| 1479 | 1475 | kref_get(&stream->refcount); | |
| 1480 | 1476 | ||
| 1481 | 1477 | /* destroy_state kfree()s the state, so use a plain (unmanaged) alloc. */ | |
| 1482 | - | dm_state = kzalloc_obj(*dm_state); | |
| 1478 | + | dm_state = kzalloc_obj(*dm_state, GFP_KERNEL); | |
| 1483 | 1479 | KUNIT_ASSERT_NOT_ERR_OR_NULL(test, dm_state); | |
| 1484 | 1480 | dm_state->stream = stream; | |
| 1485 | 1481 | ||
| @@ -1573,7 +1569,7 @@ static void dm_test_crtc_handle_vblank_completes_cursor_only(struct kunit *test) | |||
| 1573 | 1569 | KUNIT_ASSERT_NOT_ERR_OR_NULL(test, acrtc); | |
| 1574 | 1570 | ||
| 1575 | 1571 | /* drm_crtc_send_vblank_event() consumes (kfree()s) the event. */ | |
| 1576 | - | event = kzalloc_obj(*event); | |
| 1572 | + | event = kzalloc_obj(*event, GFP_KERNEL); | |
| 1577 | 1573 | KUNIT_ASSERT_NOT_ERR_OR_NULL(test, event); | |
| 1578 | 1574 | ||
| 1579 | 1575 | acrtc->base.dev = &adev->ddev; | |
| @@ -1632,7 +1628,7 @@ dm_test_vblank_control_worker_setup(struct kunit *test, bool enable, | |||
| 1632 | 1628 | kref_get(&stream->refcount); | |
| 1633 | 1629 | ||
| 1634 | 1630 | /* Worker kfree()s the work item, so it must be a plain allocation. */ | |
| 1635 | - | work = kzalloc_obj(*work); | |
| 1631 | + | work = kzalloc_obj(*work, GFP_KERNEL); | |
| 1636 | 1632 | KUNIT_ASSERT_NOT_ERR_OR_NULL(test, work); | |
| 1637 | 1633 | work->dm = &adev->dm; | |
| 1638 | 1634 | work->acrtc = acrtc; | |
modified drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_helpers_test.c
| @@ -358,14 +358,12 @@ static void dm_test_parse_edid_caps_hdmi_frl(struct kunit *test) | |||
| 358 | 358 | ||
| 359 | 359 | /* Drive the HDMI/FRL branch */ | |
| 360 | 360 | connector->display_info.is_hdmi = true; | |
| 361 | - | connector->display_info.rgb_quant_range_selectable = true; | |
| 362 | 361 | connector->display_info.hdmi.scdc.supported = true; | |
| 363 | 362 | connector->display_info.hdmi.max_lanes = 4; | |
| 364 | 363 | connector->display_info.hdmi.max_frl_rate_per_lane = 12; | |
| 365 | 364 | ||
| 366 | 365 | KUNIT_EXPECT_EQ(test, dm_helpers_parse_edid_caps(link, dc_edid, edid_caps), EDID_OK); | |
| 367 | 366 | KUNIT_EXPECT_TRUE(test, edid_caps->edid_hdmi); | |
| 368 | - | KUNIT_EXPECT_EQ(test, edid_caps->qs_bit, 1); | |
| 369 | 367 | KUNIT_EXPECT_TRUE(test, edid_caps->scdc_present); | |
| 370 | 368 | /* max_lanes 4 + max_frl_rate_per_lane 12 -> rate index 6 */ | |
| 371 | 369 | KUNIT_EXPECT_EQ(test, edid_caps->max_frl_rate, 6); | |
| @@ -911,7 +909,7 @@ static void dm_test_populate_hdmi_frl_dsc_12bpc(struct kunit *test) | |||
| 911 | 909 | ||
| 912 | 910 | KUNIT_EXPECT_EQ(test, caps->max_frl_rate, 2); | |
| 913 | 911 | KUNIT_EXPECT_TRUE(test, caps->frl_dsc_support); | |
| 914 | - | KUNIT_EXPECT_TRUE(test, caps->frl_dsc_10bpc); | |
| 912 | + | KUNIT_EXPECT_FALSE(test, caps->frl_dsc_10bpc); | |
| 915 | 913 | KUNIT_EXPECT_TRUE(test, caps->frl_dsc_12bpc); | |
| 916 | 914 | KUNIT_EXPECT_EQ(test, caps->frl_dsc_max_slices, 7); | |
| 917 | 915 | KUNIT_EXPECT_EQ(test, caps->frl_dsc_max_frl_rate, 1); | |
| @@ -2442,21 +2440,17 @@ static void dm_test_is_dp_sink_present_null_priv(struct kunit *test) | |||
| 2442 | 2440 | * dm_test_dmub_outbox_interrupt_control_null_dc - Test outbox irq control with NULL dc | |
| 2443 | 2441 | * @test: The KUnit test context | |
| 2444 | 2442 | * | |
| 2445 | - | * amdgpu_dm_irq_set() is NULL-safe and returns false when dc is NULL, so the | |
| 2443 | + | * dc_interrupt_set() is NULL-safe and returns false when dc is NULL, so the | |
| 2446 | 2444 | * helper returns false without touching real interrupt hardware. | |
| 2447 | 2445 | */ | |
| 2448 | 2446 | static void dm_test_dmub_outbox_interrupt_control_null_dc(struct kunit *test) | |
| 2449 | 2447 | { | |
| 2450 | - | struct amdgpu_device *adev; | |
| 2451 | 2448 | struct dc_context *ctx; | |
| 2452 | 2449 | ||
| 2453 | - | adev = kunit_kzalloc(test, sizeof(*adev), GFP_KERNEL); | |
| 2454 | - | KUNIT_ASSERT_NOT_NULL(test, adev); | |
| 2455 | 2450 | ctx = kunit_kzalloc(test, sizeof(*ctx), GFP_KERNEL); | |
| 2456 | 2451 | KUNIT_ASSERT_NOT_NULL(test, ctx); | |
| 2457 | - | ctx->driver_context = adev; | |
| 2458 | 2452 | ||
| 2459 | - | /* adev->dm.dc is NULL → amdgpu_dm_irq_set returns false */ | |
| 2453 | + | /* ctx->dc is NULL → dc_interrupt_set returns false */ | |
| 2460 | 2454 | KUNIT_EXPECT_FALSE(test, dm_helpers_dmub_outbox_interrupt_control(ctx, true)); | |
| 2461 | 2455 | KUNIT_EXPECT_FALSE(test, dm_helpers_dmub_outbox_interrupt_control(ctx, false)); | |
| 2462 | 2456 | } | |
modified drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_irq_test.c
| @@ -103,7 +103,7 @@ static enum dc_status dm_test_dp_read_hpd_rx_irq_data_ok(struct dc_link *link, | |||
| 103 | 103 | */ | |
| 104 | 104 | static struct dc_sink *dm_test_sink_create(struct dc_link *link) | |
| 105 | 105 | { | |
| 106 | - | struct dc_sink *sink = kzalloc_obj(*sink); | |
| 106 | + | struct dc_sink *sink = kzalloc(sizeof(*sink), GFP_KERNEL); | |
| 107 | 107 | ||
| 108 | 108 | if (!sink) | |
| 109 | 109 | return NULL; | |
| @@ -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 | */ | |
| @@ -2131,7 +2131,7 @@ static void dm_test_hpd_rx_offload_work_no_connector(struct kunit *test) | |||
| 2131 | 2131 | offload_wq = kunit_kzalloc(test, sizeof(*offload_wq), GFP_KERNEL); | |
| 2132 | 2132 | KUNIT_ASSERT_NOT_ERR_OR_NULL(test, offload_wq); | |
| 2133 | 2133 | ||
| 2134 | - | offload_work = kzalloc_obj(*offload_work); | |
| 2134 | + | offload_work = kzalloc(sizeof(*offload_work), GFP_KERNEL); | |
| 2135 | 2135 | KUNIT_ASSERT_NOT_ERR_OR_NULL(test, offload_work); | |
| 2136 | 2136 | offload_work->offload_wq = offload_wq; | |
| 2137 | 2137 | offload_work->adev = adev; | |
| @@ -2177,7 +2177,7 @@ static void dm_test_hpd_rx_offload_work_no_connection(struct kunit *test) | |||
| 2177 | 2177 | link->dc = dc; | |
| 2178 | 2178 | aconn->dc_link = link; | |
| 2179 | 2179 | ||
| 2180 | - | offload_work = kzalloc_obj(*offload_work); | |
| 2180 | + | offload_work = kzalloc(sizeof(*offload_work), GFP_KERNEL); | |
| 2181 | 2181 | KUNIT_ASSERT_NOT_ERR_OR_NULL(test, offload_work); | |
| 2182 | 2182 | offload_work->offload_wq = offload_wq; | |
| 2183 | 2183 | offload_work->adev = adev; | |
| @@ -2244,7 +2244,7 @@ static void dm_test_hpd_rx_offload_work_automated_test(struct kunit *test) | |||
| 2244 | 2244 | link->connector_signal = SIGNAL_TYPE_DISPLAY_PORT; | |
| 2245 | 2245 | aconn->dc_link = link; | |
| 2246 | 2246 | ||
| 2247 | - | offload_work = kzalloc_obj(*offload_work); | |
| 2247 | + | offload_work = kzalloc(sizeof(*offload_work), GFP_KERNEL); | |
| 2248 | 2248 | KUNIT_ASSERT_NOT_ERR_OR_NULL(test, offload_work); | |
| 2249 | 2249 | offload_work->offload_wq = offload_wq; | |
| 2250 | 2250 | offload_work->adev = adev; | |
| @@ -2315,7 +2315,7 @@ static void dm_test_hpd_rx_offload_work_link_loss(struct kunit *test) | |||
| 2315 | 2315 | link->connector_signal = SIGNAL_TYPE_DISPLAY_PORT; | |
| 2316 | 2316 | aconn->dc_link = link; | |
| 2317 | 2317 | ||
| 2318 | - | offload_work = kzalloc_obj(*offload_work); | |
| 2318 | + | offload_work = kzalloc(sizeof(*offload_work), GFP_KERNEL); | |
| 2319 | 2319 | KUNIT_ASSERT_NOT_ERR_OR_NULL(test, offload_work); | |
| 2320 | 2320 | offload_work->offload_wq = offload_wq; | |
| 2321 | 2321 | offload_work->adev = adev; | |
| @@ -3452,9 +3452,9 @@ static void dm_test_handle_hpd_work_out_of_range(struct kunit *test) | |||
| 3452 | 3452 | struct amdgpu_device *adev; | |
| 3453 | 3453 | ||
| 3454 | 3454 | adev = dm_kunit_alloc_adev(test); | |
| 3455 | - | hpd_work = kzalloc_obj(*hpd_work); | |
| 3455 | + | hpd_work = kzalloc(sizeof(*hpd_work), GFP_KERNEL); | |
| 3456 | 3456 | KUNIT_ASSERT_NOT_ERR_OR_NULL(test, hpd_work); | |
| 3457 | - | hpd_work->dmub_notify = kzalloc_obj(*hpd_work->dmub_notify); | |
| 3457 | + | hpd_work->dmub_notify = kzalloc(sizeof(*hpd_work->dmub_notify), GFP_KERNEL); | |
| 3458 | 3458 | KUNIT_ASSERT_NOT_ERR_OR_NULL(test, hpd_work->dmub_notify); | |
| 3459 | 3459 | hpd_work->dmub_notify->type = | |
| 3460 | 3460 | (enum dmub_notification_type)ARRAY_SIZE(adev->dm.dmub_callback); | |
| @@ -3899,9 +3899,9 @@ static void dm_test_handle_vmin_vmax_update(struct kunit *test) | |||
| 3899 | 3899 | kref_get(&stream->refcount); | |
| 3900 | 3900 | ||
| 3901 | 3901 | /* The worker kfree()s both, so they must come from the slab. */ | |
| 3902 | - | work = kzalloc_obj(*work); | |
| 3902 | + | work = kzalloc(sizeof(*work), GFP_KERNEL); | |
| 3903 | 3903 | KUNIT_ASSERT_NOT_ERR_OR_NULL(test, work); | |
| 3904 | - | adjust = kzalloc_obj(*adjust); | |
| 3904 | + | adjust = kzalloc(sizeof(*adjust), GFP_KERNEL); | |
| 3905 | 3905 | KUNIT_ASSERT_NOT_ERR_OR_NULL(test, adjust); | |
| 3906 | 3906 | ||
| 3907 | 3907 | work->adev = adev; | |
modified drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_plane_test.c
| @@ -2945,7 +2945,7 @@ static void dm_test_plane_reset_initializes_state(struct kunit *test) | |||
| 2945 | 2945 | * destroy-existing-state path. The destroy hook frees this state, so it | |
| 2946 | 2946 | * must be a plain (non-KUnit-managed) allocation. | |
| 2947 | 2947 | */ | |
| 2948 | - | old_state = kzalloc_obj(*old_state); | |
| 2948 | + | old_state = kzalloc(sizeof(*old_state), GFP_KERNEL); | |
| 2949 | 2949 | KUNIT_ASSERT_NOT_NULL(test, old_state); | |
| 2950 | 2950 | plane->funcs = &dm_test_plane_reset_funcs; | |
| 2951 | 2951 | plane->state = &old_state->base; | |
| @@ -3018,7 +3018,7 @@ static void dm_test_plane_destroy_state_minimal(struct kunit *test) | |||
| 3018 | 3018 | KUNIT_ASSERT_NOT_NULL(test, plane); | |
| 3019 | 3019 | ||
| 3020 | 3020 | /* destroy_state frees the state itself, so use a plain allocation. */ | |
| 3021 | - | dm_plane_state = kzalloc_obj(*dm_plane_state); | |
| 3021 | + | dm_plane_state = kzalloc(sizeof(*dm_plane_state), GFP_KERNEL); | |
| 3022 | 3022 | KUNIT_ASSERT_NOT_NULL(test, dm_plane_state); | |
| 3023 | 3023 | ||
| 3024 | 3024 | amdgpu_dm_plane_drm_plane_destroy_state(plane, &dm_plane_state->base); | |
modified drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_test.c
| @@ -239,7 +239,7 @@ static void dm_test_atomic_destroy_state_no_context(struct kunit *test) | |||
| 239 | 239 | * Use kzalloc(), not kunit_kzalloc(): dm_atomic_destroy_state() frees | |
| 240 | 240 | * the state itself, so KUnit-managed memory would be double-freed. | |
| 241 | 241 | */ | |
| 242 | - | dm_state = kzalloc_obj(*dm_state); | |
| 242 | + | dm_state = kzalloc(sizeof(*dm_state), GFP_KERNEL); | |
| 243 | 243 | KUNIT_ASSERT_NOT_NULL(test, dm_state); | |
| 244 | 244 | ||
| 245 | 245 | /* context == NULL: dc_state_release() is skipped and the state is freed. */ | |
modified drivers/gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c
| @@ -377,7 +377,7 @@ struct clk_mgr *dc_clk_mgr_create(struct dc_context *ctx, struct pp_smu_funcs *p | |||
| 377 | 377 | } | |
| 378 | 378 | break; | |
| 379 | 379 | case AMDGPU_FAMILY_GC_11_5_4: { | |
| 380 | - | struct clk_mgr_dcn42 *clk_mgr = kzalloc_obj(*clk_mgr); | |
| 380 | + | struct clk_mgr_dcn42 *clk_mgr = kzalloc(sizeof(*clk_mgr), GFP_KERNEL); | |
| 381 | 381 | ||
| 382 | 382 | if (clk_mgr == NULL) { | |
| 383 | 383 | BREAK_TO_DEBUGGER(); | |
modified drivers/gpu/drm/amd/display/dc/clk_mgr/dcn60/dcn60_clk_mgr.c
| @@ -1595,7 +1595,7 @@ struct clk_mgr_internal *dcn60_clk_mgr_construct( | |||
| 1595 | 1595 | struct dccg *dccg) | |
| 1596 | 1596 | { | |
| 1597 | 1597 | struct clk_log_info log_info = {0}; | |
| 1598 | - | struct dcn60_clk_mgr *clk_mgr60 = kzalloc_obj(struct dcn60_clk_mgr); | |
| 1598 | + | struct dcn60_clk_mgr *clk_mgr60 = kzalloc(sizeof(struct dcn60_clk_mgr), GFP_KERNEL); | |
| 1599 | 1599 | struct clk_mgr_internal *clk_mgr; | |
| 1600 | 1600 | ||
| 1601 | 1601 | if (!clk_mgr60) | |
| @@ -1644,7 +1644,7 @@ struct clk_mgr_internal *dcn60_clk_mgr_construct( | |||
| 1644 | 1644 | ||
| 1645 | 1645 | clk_mgr->smu_present = false; | |
| 1646 | 1646 | ||
| 1647 | - | clk_mgr->base.bw_params = kzalloc_obj(*clk_mgr->base.bw_params); | |
| 1647 | + | clk_mgr->base.bw_params = kzalloc(sizeof(*clk_mgr->base.bw_params), GFP_KERNEL); | |
| 1648 | 1648 | if (!clk_mgr->base.bw_params) | |
| 1649 | 1649 | goto fail; | |
| 1650 | 1650 | ||
modified drivers/gpu/drm/amd/display/dc/core/dc.c
| @@ -914,7 +914,8 @@ static bool dc_construct_update_scratch_pool(struct dc *dc) | |||
| 914 | 914 | unsigned int i; | |
| 915 | 915 | ||
| 916 | 916 | for (i = 0; i < ARRAY_SIZE(dc->update_scratch_pool); i++) { | |
| 917 | - | dc->update_scratch_pool[i] = kzalloc_obj(struct dc_update_scratch_space); | |
| 917 | + | dc->update_scratch_pool[i] = kzalloc( | |
| 918 | + | sizeof(struct dc_update_scratch_space), GFP_KERNEL); | |
| 918 | 919 | if (!dc->update_scratch_pool[i]) | |
| 919 | 920 | return false; | |
| 920 | 921 | dc->update_scratch_in_use[i] = false; | |
| @@ -3198,7 +3199,6 @@ static struct dc_update_descriptor check_update_surfaces_for_stream( | |||
| 3198 | 3199 | } | |
| 3199 | 3200 | ||
| 3200 | 3201 | if ((stream_update->hdr_static_metadata && !stream_update->stream->use_dynamic_meta) || | |
| 3201 | - | stream_update->output_color_space || | |
| 3202 | 3202 | stream_update->vrr_infopacket || | |
| 3203 | 3203 | stream_update->vsc_infopacket || | |
| 3204 | 3204 | stream_update->vsp_infopacket || | |
| @@ -4189,7 +4189,6 @@ static void commit_planes_do_stream_update_sequence(struct dc *dc, | |||
| 4189 | 4189 | hwss_add_setup_periodic_interrupt(&seq_state, dc, pipe_ctx); | |
| 4190 | 4190 | ||
| 4191 | 4191 | if ((stream_update->hdr_static_metadata && !stream->use_dynamic_meta) || | |
| 4192 | - | stream_update->output_color_space || | |
| 4193 | 4192 | stream_update->vrr_infopacket || | |
| 4194 | 4193 | stream_update->vsc_infopacket || | |
| 4195 | 4194 | stream_update->vsp_infopacket || | |
| @@ -4372,7 +4371,6 @@ static void commit_planes_do_stream_update(struct dc *dc, | |||
| 4372 | 4371 | dc->hwss.setup_periodic_interrupt(dc, pipe_ctx); | |
| 4373 | 4372 | ||
| 4374 | 4373 | if ((stream_update->hdr_static_metadata && !stream->use_dynamic_meta) || | |
| 4375 | - | stream_update->output_color_space || | |
| 4376 | 4374 | stream_update->vrr_infopacket || | |
| 4377 | 4375 | stream_update->vsc_infopacket || | |
| 4378 | 4376 | stream_update->vsp_infopacket || | |
modified drivers/gpu/drm/amd/display/dc/core/dc_resource.c
| @@ -1797,11 +1797,7 @@ bool resource_can_pipe_disable_cursor(struct pipe_ctx *pipe_ctx) | |||
| 1797 | 1797 | * pipe-split, merge together per same height. | |
| 1798 | 1798 | */ | |
| 1799 | 1799 | for (split_pipe = pipe_ctx->top_pipe; split_pipe; | |
| 1800 | - | split_pipe = split_pipe->top_pipe) { | |
| 1801 | - | ||
| 1802 | - | if (split_pipe == test_pipe) | |
| 1803 | - | continue; | |
| 1804 | - | ||
| 1800 | + | split_pipe = split_pipe->top_pipe) | |
| 1805 | 1801 | if (split_pipe->plane_state->layer_index == test_pipe->plane_state->layer_index) { | |
| 1806 | 1802 | struct rect r2_half; | |
| 1807 | 1803 | ||
| @@ -1813,7 +1809,6 @@ bool resource_can_pipe_disable_cursor(struct pipe_ctx *pipe_ctx) | |||
| 1813 | 1809 | r2_bottom = min(r2_bottom, r2_half.y + r2_half.height); | |
| 1814 | 1810 | break; | |
| 1815 | 1811 | } | |
| 1816 | - | } | |
| 1817 | 1812 | ||
| 1818 | 1813 | if (r1.x >= r2.x && r1.y >= r2.y && r1_right <= r2_right && r1_bottom <= r2_bottom) | |
| 1819 | 1814 | return true; | |
modified drivers/gpu/drm/amd/display/dc/core/dc_surface.c
| @@ -290,7 +290,7 @@ static void dc_plane_cm_free(struct kref *kref) | |||
| 290 | 290 | ||
| 291 | 291 | struct dc_plane_cm *dc_plane_cm_create(void) | |
| 292 | 292 | { | |
| 293 | - | struct dc_plane_cm *cm = kvzalloc_obj(*cm); | |
| 293 | + | struct dc_plane_cm *cm = kvzalloc(sizeof(*cm), GFP_KERNEL); | |
| 294 | 294 | ||
| 295 | 295 | if (cm == NULL) | |
| 296 | 296 | goto alloc_fail; | |
modified drivers/gpu/drm/amd/display/dc/dc.h
| @@ -1905,7 +1905,6 @@ struct dc_scratch_space { | |||
| 1905 | 1905 | struct ddc_service *ddc; | |
| 1906 | 1906 | ||
| 1907 | 1907 | enum dp_panel_mode panel_mode; | |
| 1908 | - | bool panel_mode_initialized; | |
| 1909 | 1908 | bool aux_mode; | |
| 1910 | 1909 | ||
| 1911 | 1910 | /* Private to DC core */ | |
modified drivers/gpu/drm/amd/display/dc/dccg/dcn42/dcn42_dccg.c
| @@ -358,7 +358,7 @@ struct dccg *dccg42_create( | |||
| 358 | 358 | const struct dccg_shift *dccg_shift, | |
| 359 | 359 | const struct dccg_mask *dccg_mask) | |
| 360 | 360 | { | |
| 361 | - | struct dcn_dccg *dccg_dcn = kzalloc_obj(*dccg_dcn); | |
| 361 | + | struct dcn_dccg *dccg_dcn = kzalloc(sizeof(*dccg_dcn), GFP_KERNEL); | |
| 362 | 362 | struct dccg *base; | |
| 363 | 363 | ||
| 364 | 364 | if (dccg_dcn == NULL) { | |
modified drivers/gpu/drm/amd/display/dc/dccg/dcn60/dcn60_dccg.c
| @@ -167,7 +167,7 @@ struct dccg *dccg60_create( | |||
| 167 | 167 | const struct dccg_shift *dccg_shift, | |
| 168 | 168 | const struct dccg_mask *dccg_mask) | |
| 169 | 169 | { | |
| 170 | - | struct dcn_dccg *dccg_dcn = kzalloc_obj(*dccg_dcn); | |
| 170 | + | struct dcn_dccg *dccg_dcn = kzalloc(sizeof(*dccg_dcn), GFP_KERNEL); | |
| 171 | 171 | struct dccg *base; | |
| 172 | 172 | ||
| 173 | 173 | if (dccg_dcn == NULL) { | |
modified drivers/gpu/drm/amd/display/dc/dcn30/dcn30_cm_common.c
| @@ -320,8 +320,6 @@ static struct fixed31_32 interp_tf_pts(const struct fixed31_32 *output_tf_channe | |||
| 320 | 320 | return value; | |
| 321 | 321 | } | |
| 322 | 322 | ||
| 323 | - | #define NUM_DEGAMMA_REGIONS 9 | |
| 324 | - | ||
| 325 | 323 | bool cm3_helper_translate_curve_to_degamma_hw_format( | |
| 326 | 324 | const struct dc_transfer_func *output_tf, | |
| 327 | 325 | struct pwl_params *lut_params) | |
| @@ -345,15 +343,31 @@ bool cm3_helper_translate_curve_to_degamma_hw_format( | |||
| 345 | 343 | memset(lut_params, 0, sizeof(struct pwl_params)); | |
| 346 | 344 | memset(seg_distr, 0, sizeof(seg_distr)); | |
| 347 | 345 | ||
| 348 | - | /* 9 segments | |
| 349 | - | * segments are from 2^-9 to 2^0 | |
| 350 | - | */ | |
| 351 | - | seg_distr[0] = 0; // Since we only have one point in darkest region | |
| 352 | - | for (k = 1; k < NUM_DEGAMMA_REGIONS; k++) | |
| 353 | - | seg_distr[k] = k - 1; // 2^(k-1) points per region; halves as k decreases | |
| 346 | + | if (output_tf->tf == TRANSFER_FUNCTION_PQ || | |
| 347 | + | output_tf->tf == TRANSFER_FUNCTION_SRGB) { | |
| 348 | + | /* 9 segments | |
| 349 | + | * segments are from 2^-9 to 0 | |
| 350 | + | */ | |
| 351 | + | const uint8_t SEG_COUNT = 9; | |
| 352 | + | seg_distr[0] = 0; // Since we only have one point in darkest region | |
| 353 | + | for (k = 1; k < SEG_COUNT; k++) | |
| 354 | + | seg_distr[k] = k - 1; // 2^(k-1) points per region; halves as k decreases | |
| 355 | + | ||
| 356 | + | region_start = -SEG_COUNT; | |
| 357 | + | region_end = 0; | |
| 358 | + | } else { | |
| 359 | + | /* 12 segments | |
| 360 | + | * segments are from 2^-12 to 2^0 | |
| 361 | + | * There are less than 256 points, for optimization | |
| 362 | + | */ | |
| 363 | + | const uint8_t SEG_COUNT = 12; | |
| 354 | 364 | ||
| 355 | - | region_start = -NUM_DEGAMMA_REGIONS; | |
| 356 | - | region_end = 0; | |
| 365 | + | for (i = 0; i < SEG_COUNT; i++) | |
| 366 | + | seg_distr[i] = 4; | |
| 367 | + | ||
| 368 | + | region_start = -SEG_COUNT; | |
| 369 | + | region_end = 0; | |
| 370 | + | } | |
| 357 | 371 | ||
| 358 | 372 | for (i = region_end - region_start; i < MAX_REGIONS_NUMBER ; i++) | |
| 359 | 373 | seg_distr[i] = -1; | |
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 | - | ifneq ($(filter y,$(CONFIG_KASAN) $(CONFIG_KCSAN) $(CONFIG_UBSAN)),) | |
| 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 | - | ifneq ($(filter y,$(CONFIG_KASAN) $(CONFIG_KCSAN) $(CONFIG_UBSAN)),) | |
| 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/dml2_0/dml21/src/dml2_core/dml2_core_dcn5_funcs_mode_programming.c
| @@ -1128,8 +1128,8 @@ static bool dcn5_mode_programming(struct dml2_core_calcs_mode_programming_ex *in | |||
| 1128 | 1128 | CalculateWatermarks_params->USRRetrainingSupport = &mode_lib->mp.USRRetrainingSupport; | |
| 1129 | 1129 | CalculateWatermarks_params->temp_read_or_ppt_support = mode_lib->mp.temp_read_or_ppt_support; | |
| 1130 | 1130 | CalculateWatermarks_params->global_temp_read_or_ppt_supported = &mode_lib->mp.global_temp_read_or_ppt_supported; | |
| 1131 | - | CalculateWatermarks_params->VActiveLatencyHidingMargin = NULL; | |
| 1132 | - | CalculateWatermarks_params->VActiveLatencyHidingUs = NULL; | |
| 1131 | + | CalculateWatermarks_params->VActiveLatencyHidingMargin = 0; | |
| 1132 | + | CalculateWatermarks_params->VActiveLatencyHidingUs = 0; | |
| 1133 | 1133 | ||
| 1134 | 1134 | dcn5_calculate_watermarks_and_dram_speed_change_support(&mode_lib->scratch, CalculateWatermarks_params); | |
| 1135 | 1135 | ||
modified drivers/gpu/drm/amd/display/dc/dml2_0/dml21/src/dml2_pmo/dml2_pmo_dcn6_stage_optimizers.c
| @@ -1414,7 +1414,7 @@ static bool find_shift_for_valid_cache_id_assignment(const int *mcache_boundarie | |||
| 1414 | 1414 | success = true; | |
| 1415 | 1415 | for (pipe_index = 0; pipe_index < pipe_count; pipe_index++) { | |
| 1416 | 1416 | if (!calculate_first_second_splitting(mcache_boundaries, num_boundaries, *shift, | |
| 1417 | - | pipe_vp_startx[pipe_index], pipe_vp_endx[pipe_index], NULL, NULL)) { | |
| 1417 | + | pipe_vp_startx[pipe_index], pipe_vp_endx[pipe_index], 0, 0)) { | |
| 1418 | 1418 | success = false; | |
| 1419 | 1419 | break; | |
| 1420 | 1420 | } | |
modified drivers/gpu/drm/amd/display/dc/dml2_0/dml2_translation_helper.c
| @@ -301,7 +301,6 @@ void dml2_init_socbb_params(struct dml2_context *dml2, const struct dc *in_dc, s | |||
| 301 | 301 | out->smn_latency_us = 2; | |
| 302 | 302 | out->dispclk_dppclk_vco_speed_mhz = 3600; | |
| 303 | 303 | out->pct_ideal_dram_bw_after_urgent_pixel_only = 65.0; | |
| 304 | - | out->gpuvm_min_page_size_kbytes = 4; | |
| 305 | 304 | break; | |
| 306 | 305 | ||
| 307 | 306 | ||
modified drivers/gpu/drm/amd/display/dc/gpio/hw_ddc.c
| @@ -542,7 +542,7 @@ void dal_hw_ddc_init_i3cpad( | |||
| 542 | 542 | *hw_ddc = NULL; | |
| 543 | 543 | } | |
| 544 | 544 | ||
| 545 | - | *hw_ddc = kzalloc_obj(struct hw_ddc); | |
| 545 | + | *hw_ddc = kzalloc(sizeof(struct hw_ddc), GFP_KERNEL); | |
| 546 | 546 | if (!*hw_ddc) { | |
| 547 | 547 | ASSERT_CRITICAL(false); | |
| 548 | 548 | return; | |
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/display/dc/irq/dcn42/irq_service_dcn42.c
| @@ -405,7 +405,7 @@ static void dcn42_irq_construct(struct irq_service *irq_service, | |||
| 405 | 405 | ||
| 406 | 406 | struct irq_service *dal_irq_service_dcn42_create(struct irq_service_init_data *init_data) | |
| 407 | 407 | { | |
| 408 | - | struct irq_service *irq_service = kzalloc_obj(*irq_service); | |
| 408 | + | struct irq_service *irq_service = kzalloc(sizeof(*irq_service), GFP_KERNEL); | |
| 409 | 409 | ||
| 410 | 410 | if (!irq_service) | |
| 411 | 411 | return NULL; | |
modified drivers/gpu/drm/amd/display/dc/irq/dcn60/irq_service_dcn60.c
| @@ -406,7 +406,8 @@ static void dcn60_irq_construct( | |||
| 406 | 406 | struct irq_service *dal_irq_service_dcn60_create( | |
| 407 | 407 | struct irq_service_init_data *init_data) | |
| 408 | 408 | { | |
| 409 | - | struct irq_service *irq_service = kzalloc_obj(*irq_service); | |
| 409 | + | struct irq_service *irq_service = kzalloc(sizeof(*irq_service), | |
| 410 | + | GFP_KERNEL); | |
| 410 | 411 | ||
| 411 | 412 | if (!irq_service) | |
| 412 | 413 | return NULL; | |
modified drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_dpia_bw.c
| @@ -103,11 +103,6 @@ static int get_estimated_bw(struct dc_link *link) | |||
| 103 | 103 | { | |
| 104 | 104 | uint8_t bw_estimated_bw = 0; | |
| 105 | 105 | ||
| 106 | - | if (link->dpia_bw_alloc_config.bw_granularity == 0) { | |
| 107 | - | DC_LOG_ERROR("%s: BW granularity is zero!\n", __func__); | |
| 108 | - | return 0; | |
| 109 | - | } | |
| 110 | - | ||
| 111 | 106 | core_link_read_dpcd( | |
| 112 | 107 | link, | |
| 113 | 108 | ESTIMATED_BW, | |
modified drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.c
| @@ -93,7 +93,6 @@ void dp_set_panel_mode(struct dc_link *link, enum dp_panel_mode panel_mode) | |||
| 93 | 93 | } | |
| 94 | 94 | ||
| 95 | 95 | link->panel_mode = panel_mode; | |
| 96 | - | link->panel_mode_initialized = true; | |
| 97 | 96 | DC_LOG_DETECTION_DP_CAPS("%d eDP panel mode supported: %d, enabled: %d\n", | |
| 98 | 97 | link->link_index, | |
| 99 | 98 | link->dpcd_caps.panel_mode_edp, | |
| @@ -1298,8 +1297,7 @@ void edp_set_panel_assr(struct dc_link *link, struct pipe_ctx *pipe_ctx, | |||
| 1298 | 1297 | ||
| 1299 | 1298 | result = cp_psp->funcs.enable_assr(cp_psp->handle, link); | |
| 1300 | 1299 | ||
| 1301 | - | if (!result && link->panel_mode_initialized && | |
| 1302 | - | link->panel_mode != DP_PANEL_MODE_EDP) | |
| 1300 | + | if (!result && link->panel_mode != DP_PANEL_MODE_EDP) | |
| 1303 | 1301 | *panel_mode = DP_PANEL_MODE_DEFAULT; | |
| 1304 | 1302 | } | |
| 1305 | 1303 | } | |
modified drivers/gpu/drm/amd/display/dc/pg/dcn42/dcn42_pg_cntl.c
| @@ -615,7 +615,7 @@ struct pg_cntl *pg_cntl42_create( | |||
| 615 | 615 | const struct pg_cntl_shift *pg_cntl_shift, | |
| 616 | 616 | const struct pg_cntl_mask *pg_cntl_mask) | |
| 617 | 617 | { | |
| 618 | - | struct dcn_pg_cntl *pg_cntl_dcn = kzalloc_obj(*pg_cntl_dcn); | |
| 618 | + | struct dcn_pg_cntl *pg_cntl_dcn = kzalloc(sizeof(*pg_cntl_dcn), GFP_KERNEL); | |
| 619 | 619 | struct pg_cntl *base; | |
| 620 | 620 | ||
| 621 | 621 | if (pg_cntl_dcn == NULL) { | |
modified drivers/gpu/drm/amd/display/dc/resource/dce60/dce60_resource.c
| @@ -448,12 +448,6 @@ static const struct dce_abm_mask abm_mask = { | |||
| 448 | 448 | ABM_MASK_SH_LIST_DCE110(_MASK) | |
| 449 | 449 | }; | |
| 450 | 450 | ||
| 451 | - | static const struct dc_debug_options debug_defaults = { 0 }; | |
| 452 | - | ||
| 453 | - | static const struct dc_check_config config_defaults = { | |
| 454 | - | .enable_legacy_fast_update = true, | |
| 455 | - | }; | |
| 456 | - | ||
| 457 | 451 | #define CTX ctx | |
| 458 | 452 | #define REG(reg) mm ## reg | |
| 459 | 453 | ||
| @@ -943,8 +937,6 @@ static bool dce60_construct( | |||
| 943 | 937 | dc->caps.max_cursor_size = 64; | |
| 944 | 938 | dc->caps.dual_link_dvi = true; | |
| 945 | 939 | dc->caps.extended_aux_timeout_support = false; | |
| 946 | - | dc->debug = debug_defaults; | |
| 947 | - | dc->check_config = config_defaults; | |
| 948 | 940 | ||
| 949 | 941 | /************************************************* | |
| 950 | 942 | * Create resources * | |
| @@ -1142,8 +1134,6 @@ static bool dce61_construct( | |||
| 1142 | 1134 | dc->caps.i2c_speed_in_khz = 40; | |
| 1143 | 1135 | dc->caps.max_cursor_size = 64; | |
| 1144 | 1136 | dc->caps.is_apu = true; | |
| 1145 | - | dc->debug = debug_defaults; | |
| 1146 | - | dc->check_config = config_defaults; | |
| 1147 | 1137 | ||
| 1148 | 1138 | /************************************************* | |
| 1149 | 1139 | * Create resources * | |
| @@ -1341,8 +1331,7 @@ static bool dce64_construct( | |||
| 1341 | 1331 | dc->caps.max_downscale_ratio = 200; | |
| 1342 | 1332 | dc->caps.i2c_speed_in_khz = 40; | |
| 1343 | 1333 | dc->caps.max_cursor_size = 64; | |
| 1344 | - | dc->debug = debug_defaults; | |
| 1345 | - | dc->check_config = config_defaults; | |
| 1334 | + | dc->caps.is_apu = true; | |
| 1346 | 1335 | ||
| 1347 | 1336 | /************************************************* | |
| 1348 | 1337 | * Create resources * | |
modified drivers/gpu/drm/amd/display/dc/resource/dce80/dce80_resource.c
| @@ -1148,8 +1148,6 @@ static bool dce81_construct( | |||
| 1148 | 1148 | dc->caps.max_cursor_size = 128; | |
| 1149 | 1149 | dc->caps.min_horizontal_blanking_period = 80; | |
| 1150 | 1150 | dc->caps.is_apu = true; | |
| 1151 | - | dc->debug = debug_defaults; | |
| 1152 | - | dc->check_config = config_defaults; | |
| 1153 | 1151 | ||
| 1154 | 1152 | /************************************************* | |
| 1155 | 1153 | * Create resources * | |
modified drivers/gpu/drm/amd/display/dc/resource/dcn30/dcn30_resource.c
| @@ -1135,7 +1135,7 @@ static struct hpo_frl_stream_encoder *dcn30_hpo_frl_stream_encoder_create(enum e | |||
| 1135 | 1135 | } | |
| 1136 | 1136 | ||
| 1137 | 1137 | /* allocate HPO stream encoder and create VPG sub-block */ | |
| 1138 | - | hpo_enc3 = kzalloc_obj(struct dcn30_hpo_frl_stream_encoder); | |
| 1138 | + | hpo_enc3 = kzalloc(sizeof(struct dcn30_hpo_frl_stream_encoder), GFP_KERNEL); | |
| 1139 | 1139 | vpg = dcn30_vpg_create(ctx, vpg_inst); | |
| 1140 | 1140 | afmt = dcn30_afmt_create(ctx, afmt_inst); | |
| 1141 | 1141 | ||
| @@ -1166,7 +1166,7 @@ static struct hpo_frl_link_encoder *dcn30_hpo_frl_link_encoder_create(enum engin | |||
| 1166 | 1166 | ASSERT((eng_id == ENGINE_ID_HPO_0) || (eng_id == ENGINE_ID_HPO_1)); | |
| 1167 | 1167 | ||
| 1168 | 1168 | /* allocate HPO link encoder */ | |
| 1169 | - | hpo_enc3 = kzalloc_obj(struct dcn30_hpo_frl_link_encoder); | |
| 1169 | + | hpo_enc3 = kzalloc(sizeof(struct dcn30_hpo_frl_link_encoder), GFP_KERNEL); | |
| 1170 | 1170 | if (!hpo_enc3) | |
| 1171 | 1171 | return NULL; /* out of memory */ | |
| 1172 | 1172 | ||
modified drivers/gpu/drm/amd/display/dc/resource/dcn302/dcn302_resource.c
| @@ -492,7 +492,7 @@ static struct hpo_frl_stream_encoder *dcn302_hpo_frl_stream_encoder_create(enum | |||
| 492 | 492 | return NULL; | |
| 493 | 493 | ||
| 494 | 494 | /* allocate HPO stream encoder and create VPG sub-block */ | |
| 495 | - | hpo_enc3 = kzalloc_obj(struct dcn30_hpo_frl_stream_encoder); | |
| 495 | + | hpo_enc3 = kzalloc(sizeof(struct dcn30_hpo_frl_stream_encoder), GFP_KERNEL); | |
| 496 | 496 | vpg = dcn302_vpg_create(ctx, vpg_inst); | |
| 497 | 497 | afmt = dcn302_afmt_create(ctx, afmt_inst); | |
| 498 | 498 | ||
| @@ -531,7 +531,7 @@ static struct hpo_frl_link_encoder *dcn302_hpo_frl_link_encoder_create(enum engi | |||
| 531 | 531 | ASSERT((eng_id == ENGINE_ID_HPO_0) || (eng_id == ENGINE_ID_HPO_1)); | |
| 532 | 532 | ||
| 533 | 533 | /* allocate HPO link encoder */ | |
| 534 | - | hpo_enc3 = kzalloc_obj(struct dcn30_hpo_frl_link_encoder); | |
| 534 | + | hpo_enc3 = kzalloc(sizeof(struct dcn30_hpo_frl_link_encoder), GFP_KERNEL); | |
| 535 | 535 | if (!hpo_enc3) | |
| 536 | 536 | return NULL; /* out of memory */ | |
| 537 | 537 | ||
modified drivers/gpu/drm/amd/display/dc/resource/dcn303/dcn303_resource.c
| @@ -479,7 +479,7 @@ static struct hpo_frl_stream_encoder *dcn303_hpo_frl_stream_encoder_create(enum | |||
| 479 | 479 | return NULL; | |
| 480 | 480 | ||
| 481 | 481 | /* allocate HPO stream encoder and create VPG sub-block */ | |
| 482 | - | hpo_enc3 = kzalloc_obj(struct dcn30_hpo_frl_stream_encoder); | |
| 482 | + | hpo_enc3 = kzalloc(sizeof(struct dcn30_hpo_frl_stream_encoder), GFP_KERNEL); | |
| 483 | 483 | vpg = dcn303_vpg_create(ctx, vpg_inst); | |
| 484 | 484 | afmt = dcn303_afmt_create(ctx, afmt_inst); | |
| 485 | 485 | ||
| @@ -518,7 +518,7 @@ static struct hpo_frl_link_encoder *dcn303_hpo_frl_link_encoder_create(enum engi | |||
| 518 | 518 | ASSERT((eng_id == ENGINE_ID_HPO_0) || (eng_id == ENGINE_ID_HPO_1)); | |
| 519 | 519 | ||
| 520 | 520 | /* allocate HPO link encoder */ | |
| 521 | - | hpo_enc3 = kzalloc_obj(struct dcn30_hpo_frl_link_encoder); | |
| 521 | + | hpo_enc3 = kzalloc(sizeof(struct dcn30_hpo_frl_link_encoder), GFP_KERNEL); | |
| 522 | 522 | if (!hpo_enc3) | |
| 523 | 523 | return NULL; /* out of memory */ | |
| 524 | 524 | ||
modified drivers/gpu/drm/amd/display/dc/resource/dcn31/dcn31_resource.c
| @@ -1346,7 +1346,7 @@ static struct hpo_frl_stream_encoder *dcn31_hpo_frl_stream_encoder_create(enum e | |||
| 1346 | 1346 | } | |
| 1347 | 1347 | ||
| 1348 | 1348 | /* allocate HPO stream encoder and create VPG, AFMT sub-blocks */ | |
| 1349 | - | hpo_enc3 = kzalloc_obj(struct dcn30_hpo_frl_stream_encoder); | |
| 1349 | + | hpo_enc3 = kzalloc(sizeof(struct dcn30_hpo_frl_stream_encoder), GFP_KERNEL); | |
| 1350 | 1350 | vpg = dcn31_vpg_create(ctx, vpg_inst); | |
| 1351 | 1351 | afmt = dcn31_afmt_create(ctx, afmt_inst); | |
| 1352 | 1352 | ||
| @@ -1377,7 +1377,7 @@ static struct hpo_frl_link_encoder *dcn31_hpo_frl_link_encoder_create(enum engin | |||
| 1377 | 1377 | ASSERT((eng_id == ENGINE_ID_HPO_0) || (eng_id == ENGINE_ID_HPO_1)); | |
| 1378 | 1378 | ||
| 1379 | 1379 | /* allocate HPO link encoder */ | |
| 1380 | - | hpo_enc3 = kzalloc_obj(struct dcn30_hpo_frl_link_encoder); | |
| 1380 | + | hpo_enc3 = kzalloc(sizeof(struct dcn30_hpo_frl_link_encoder), GFP_KERNEL); | |
| 1381 | 1381 | if (!hpo_enc3) | |
| 1382 | 1382 | return NULL; /* out of memory */ | |
| 1383 | 1383 | ||
modified drivers/gpu/drm/amd/display/dc/resource/dcn314/dcn314_resource.c
| @@ -1404,7 +1404,7 @@ static struct hpo_frl_stream_encoder *dcn31_hpo_frl_stream_encoder_create(enum e | |||
| 1404 | 1404 | } | |
| 1405 | 1405 | ||
| 1406 | 1406 | /* allocate HPO stream encoder and create VPG, AFMT sub-blocks */ | |
| 1407 | - | hpo_enc3 = kzalloc_obj(struct dcn30_hpo_frl_stream_encoder); | |
| 1407 | + | hpo_enc3 = kzalloc(sizeof(struct dcn30_hpo_frl_stream_encoder), GFP_KERNEL); | |
| 1408 | 1408 | vpg = dcn31_vpg_create(ctx, vpg_inst); | |
| 1409 | 1409 | afmt = dcn31_afmt_create(ctx, afmt_inst); | |
| 1410 | 1410 | ||
| @@ -1436,7 +1436,7 @@ static struct hpo_frl_link_encoder *dcn31_hpo_frl_link_encoder_create(enum engin | |||
| 1436 | 1436 | ASSERT((eng_id == ENGINE_ID_HPO_0) || (eng_id == ENGINE_ID_HPO_1)); | |
| 1437 | 1437 | ||
| 1438 | 1438 | /* allocate HPO link encoder */ | |
| 1439 | - | hpo_enc3 = kzalloc_obj(struct dcn30_hpo_frl_link_encoder); | |
| 1439 | + | hpo_enc3 = kzalloc(sizeof(struct dcn30_hpo_frl_link_encoder), GFP_KERNEL); | |
| 1440 | 1440 | if (!hpo_enc3) | |
| 1441 | 1441 | return NULL; /* out of memory */ | |
| 1442 | 1442 | ||
modified drivers/gpu/drm/amd/display/dc/resource/dcn315/dcn315_resource.c
| @@ -1347,7 +1347,7 @@ static struct hpo_frl_stream_encoder *dcn31_hpo_frl_stream_encoder_create(enum e | |||
| 1347 | 1347 | } | |
| 1348 | 1348 | ||
| 1349 | 1349 | /* allocate HPO stream encoder and create VPG, AFMT sub-blocks */ | |
| 1350 | - | hpo_enc3 = kzalloc_obj(struct dcn30_hpo_frl_stream_encoder); | |
| 1350 | + | hpo_enc3 = kzalloc(sizeof(struct dcn30_hpo_frl_stream_encoder), GFP_KERNEL); | |
| 1351 | 1351 | vpg = dcn31_vpg_create(ctx, vpg_inst); | |
| 1352 | 1352 | afmt = dcn31_afmt_create(ctx, afmt_inst); | |
| 1353 | 1353 | ||
| @@ -1379,7 +1379,7 @@ static struct hpo_frl_link_encoder *dcn31_hpo_frl_link_encoder_create(enum engin | |||
| 1379 | 1379 | ASSERT((eng_id == ENGINE_ID_HPO_0) || (eng_id == ENGINE_ID_HPO_1)); | |
| 1380 | 1380 | ||
| 1381 | 1381 | /* allocate HPO link encoder */ | |
| 1382 | - | hpo_enc3 = kzalloc_obj(struct dcn30_hpo_frl_link_encoder); | |
| 1382 | + | hpo_enc3 = kzalloc(sizeof(struct dcn30_hpo_frl_link_encoder), GFP_KERNEL); | |
| 1383 | 1383 | if (!hpo_enc3) | |
| 1384 | 1384 | return NULL; /* out of memory */ | |
| 1385 | 1385 | ||
modified drivers/gpu/drm/amd/display/dc/resource/dcn316/dcn316_resource.c
| @@ -1340,7 +1340,7 @@ static struct hpo_frl_stream_encoder *dcn31_hpo_frl_stream_encoder_create(enum e | |||
| 1340 | 1340 | } | |
| 1341 | 1341 | ||
| 1342 | 1342 | /* allocate HPO stream encoder and create VPG, AFMT sub-blocks */ | |
| 1343 | - | hpo_enc3 = kzalloc_obj(struct dcn30_hpo_frl_stream_encoder); | |
| 1343 | + | hpo_enc3 = kzalloc(sizeof(struct dcn30_hpo_frl_stream_encoder), GFP_KERNEL); | |
| 1344 | 1344 | vpg = dcn31_vpg_create(ctx, vpg_inst); | |
| 1345 | 1345 | afmt = dcn31_afmt_create(ctx, afmt_inst); | |
| 1346 | 1346 | ||
| @@ -1372,7 +1372,7 @@ static struct hpo_frl_link_encoder *dcn31_hpo_frl_link_encoder_create(enum engin | |||
| 1372 | 1372 | ASSERT((eng_id == ENGINE_ID_HPO_0) || (eng_id == ENGINE_ID_HPO_1)); | |
| 1373 | 1373 | ||
| 1374 | 1374 | /* allocate HPO link encoder */ | |
| 1375 | - | hpo_enc3 = kzalloc_obj(struct dcn30_hpo_frl_link_encoder); | |
| 1375 | + | hpo_enc3 = kzalloc(sizeof(struct dcn30_hpo_frl_link_encoder), GFP_KERNEL); | |
| 1376 | 1376 | if (!hpo_enc3) | |
| 1377 | 1377 | return NULL; /* out of memory */ | |
| 1378 | 1378 | ||
modified drivers/gpu/drm/amd/display/dc/resource/dcn32/dcn32_resource.c
| @@ -1339,7 +1339,7 @@ static struct hpo_frl_stream_encoder *dcn32_hpo_frl_stream_encoder_create(enum e | |||
| 1339 | 1339 | } | |
| 1340 | 1340 | ||
| 1341 | 1341 | /* allocate HPO stream encoder and create VPG, AFMT sub-blocks */ | |
| 1342 | - | hpo_enc3 = kzalloc_obj(struct dcn30_hpo_frl_stream_encoder); | |
| 1342 | + | hpo_enc3 = kzalloc(sizeof(struct dcn30_hpo_frl_stream_encoder), GFP_KERNEL); | |
| 1343 | 1343 | vpg = dcn32_vpg_create(ctx, vpg_inst); | |
| 1344 | 1344 | afmt = dcn32_afmt_create(ctx, afmt_inst); | |
| 1345 | 1345 | ||
| @@ -1375,7 +1375,7 @@ static struct hpo_frl_link_encoder *dcn32_hpo_frl_link_encoder_create(enum engin | |||
| 1375 | 1375 | hpo_frl_link_encoder_reg_list(0); | |
| 1376 | 1376 | ||
| 1377 | 1377 | /* allocate HPO link encoder */ | |
| 1378 | - | hpo_enc3 = kzalloc_obj(struct dcn30_hpo_frl_link_encoder); | |
| 1378 | + | hpo_enc3 = kzalloc(sizeof(struct dcn30_hpo_frl_link_encoder), GFP_KERNEL); | |
| 1379 | 1379 | if (!hpo_enc3) | |
| 1380 | 1380 | return NULL; /* out of memory */ | |
| 1381 | 1381 | ||
modified drivers/gpu/drm/amd/display/dc/resource/dcn321/dcn321_resource.c
| @@ -1314,7 +1314,7 @@ static struct hpo_frl_stream_encoder *dcn321_hpo_frl_stream_encoder_create(enum | |||
| 1314 | 1314 | } | |
| 1315 | 1315 | ||
| 1316 | 1316 | /* allocate HPO stream encoder and create VPG, AFMT sub-blocks */ | |
| 1317 | - | hpo_enc3 = kzalloc_obj(struct dcn30_hpo_frl_stream_encoder); | |
| 1317 | + | hpo_enc3 = kzalloc(sizeof(struct dcn30_hpo_frl_stream_encoder), GFP_KERNEL); | |
| 1318 | 1318 | vpg = dcn321_vpg_create(ctx, vpg_inst); | |
| 1319 | 1319 | afmt = dcn321_afmt_create(ctx, afmt_inst); | |
| 1320 | 1320 | ||
| @@ -1350,7 +1350,7 @@ static struct hpo_frl_link_encoder *dcn321_hpo_frl_link_encoder_create(enum engi | |||
| 1350 | 1350 | hpo_frl_link_encoder_reg_list(0); | |
| 1351 | 1351 | ||
| 1352 | 1352 | /* allocate HPO link encoder */ | |
| 1353 | - | hpo_enc3 = kzalloc_obj(struct dcn30_hpo_frl_link_encoder); | |
| 1353 | + | hpo_enc3 = kzalloc(sizeof(struct dcn30_hpo_frl_link_encoder), GFP_KERNEL); | |
| 1354 | 1354 | if (!hpo_enc3) | |
| 1355 | 1355 | return NULL; /* out of memory */ | |
| 1356 | 1356 | ||
modified drivers/gpu/drm/amd/display/dc/resource/dcn35/dcn35_resource.c
| @@ -1398,7 +1398,7 @@ static struct hpo_frl_stream_encoder *dcn31_hpo_frl_stream_encoder_create( | |||
| 1398 | 1398 | return NULL; | |
| 1399 | 1399 | ||
| 1400 | 1400 | /* allocate HPO stream encoder and create VPG, AFMT sub-blocks */ | |
| 1401 | - | hpo_enc3 = kzalloc_obj(struct dcn30_hpo_frl_stream_encoder); | |
| 1401 | + | hpo_enc3 = kzalloc(sizeof(struct dcn30_hpo_frl_stream_encoder), GFP_KERNEL); | |
| 1402 | 1402 | vpg = dcn31_vpg_create(ctx, vpg_inst); | |
| 1403 | 1403 | afmt = dcn31_afmt_create(ctx, afmt_inst); | |
| 1404 | 1404 | ||
| @@ -1430,7 +1430,7 @@ static struct hpo_frl_link_encoder *dcn31_hpo_frl_link_encoder_create( | |||
| 1430 | 1430 | hpo_frl_link_encoder_reg_list(0); | |
| 1431 | 1431 | ||
| 1432 | 1432 | /* allocate HPO link encoder */ | |
| 1433 | - | hpo_enc3 = kzalloc_obj(struct dcn30_hpo_frl_link_encoder); | |
| 1433 | + | hpo_enc3 = kzalloc(sizeof(struct dcn30_hpo_frl_link_encoder), GFP_KERNEL); | |
| 1434 | 1434 | if (!hpo_enc3) | |
| 1435 | 1435 | return NULL; /* out of memory */ | |
| 1436 | 1436 | ||
modified drivers/gpu/drm/amd/display/dc/resource/dcn351/dcn351_resource.c
| @@ -1378,7 +1378,7 @@ static struct hpo_frl_stream_encoder *dcn31_hpo_frl_stream_encoder_create( | |||
| 1378 | 1378 | return NULL; | |
| 1379 | 1379 | ||
| 1380 | 1380 | /* allocate HPO stream encoder and create VPG, AFMT sub-blocks */ | |
| 1381 | - | hpo_enc3 = kzalloc_obj(struct dcn30_hpo_frl_stream_encoder); | |
| 1381 | + | hpo_enc3 = kzalloc(sizeof(struct dcn30_hpo_frl_stream_encoder), GFP_KERNEL); | |
| 1382 | 1382 | vpg = dcn31_vpg_create(ctx, vpg_inst); | |
| 1383 | 1383 | afmt = dcn31_afmt_create(ctx, afmt_inst); | |
| 1384 | 1384 | ||
| @@ -1410,7 +1410,7 @@ static struct hpo_frl_link_encoder *dcn31_hpo_frl_link_encoder_create( | |||
| 1410 | 1410 | hpo_frl_link_encoder_reg_list(0); | |
| 1411 | 1411 | ||
| 1412 | 1412 | /* allocate HPO link encoder */ | |
| 1413 | - | hpo_enc3 = kzalloc_obj(struct dcn30_hpo_frl_link_encoder); | |
| 1413 | + | hpo_enc3 = kzalloc(sizeof(struct dcn30_hpo_frl_link_encoder), GFP_KERNEL); | |
| 1414 | 1414 | if (!hpo_enc3) | |
| 1415 | 1415 | return NULL; /* out of memory */ | |
| 1416 | 1416 | ||
modified drivers/gpu/drm/amd/display/dc/resource/dcn36/dcn36_resource.c
| @@ -1385,7 +1385,7 @@ static struct hpo_frl_stream_encoder *dcn31_hpo_frl_stream_encoder_create( | |||
| 1385 | 1385 | return NULL; | |
| 1386 | 1386 | ||
| 1387 | 1387 | /* allocate HPO stream encoder and create VPG, AFMT sub-blocks */ | |
| 1388 | - | hpo_enc3 = kzalloc_obj(struct dcn30_hpo_frl_stream_encoder); | |
| 1388 | + | hpo_enc3 = kzalloc(sizeof(struct dcn30_hpo_frl_stream_encoder), GFP_KERNEL); | |
| 1389 | 1389 | vpg = dcn31_vpg_create(ctx, vpg_inst); | |
| 1390 | 1390 | afmt = dcn31_afmt_create(ctx, afmt_inst); | |
| 1391 | 1391 | ||
| @@ -1417,7 +1417,7 @@ static struct hpo_frl_link_encoder *dcn31_hpo_frl_link_encoder_create( | |||
| 1417 | 1417 | hpo_frl_link_encoder_reg_list(0); | |
| 1418 | 1418 | ||
| 1419 | 1419 | /* allocate HPO link encoder */ | |
| 1420 | - | hpo_enc3 = kzalloc_obj(struct dcn30_hpo_frl_link_encoder); | |
| 1420 | + | hpo_enc3 = kzalloc(sizeof(struct dcn30_hpo_frl_link_encoder), GFP_KERNEL); | |
| 1421 | 1421 | if (!hpo_enc3) | |
| 1422 | 1422 | return NULL; /* out of memory */ | |
| 1423 | 1423 | ||
modified drivers/gpu/drm/amd/display/dc/resource/dcn401/dcn401_resource.c
| @@ -1322,7 +1322,7 @@ static struct hpo_frl_stream_encoder *dcn401_hpo_frl_stream_encoder_create( | |||
| 1322 | 1322 | return NULL; | |
| 1323 | 1323 | ||
| 1324 | 1324 | /* allocate HPO stream encoder and create VPG, AFMT sub-blocks */ | |
| 1325 | - | hpo_enc401 = kzalloc_obj(struct dcn401_hpo_frl_stream_encoder); | |
| 1325 | + | hpo_enc401 = kzalloc(sizeof(struct dcn401_hpo_frl_stream_encoder), GFP_KERNEL); | |
| 1326 | 1326 | vpg = dcn401_vpg_create(ctx, vpg_inst); | |
| 1327 | 1327 | afmt = dcn401_afmt_create(ctx, afmt_inst); | |
| 1328 | 1328 | ||
| @@ -1353,7 +1353,7 @@ static struct hpo_frl_link_encoder *dcn401_hpo_frl_link_encoder_create( | |||
| 1353 | 1353 | hpo_frl_link_encoder_reg_list(0); | |
| 1354 | 1354 | ||
| 1355 | 1355 | /* allocate HPO link encoder */ | |
| 1356 | - | hpo_link_enc = kzalloc_obj(struct dcn30_hpo_frl_link_encoder); | |
| 1356 | + | hpo_link_enc = kzalloc(sizeof(struct dcn30_hpo_frl_link_encoder), GFP_KERNEL); | |
| 1357 | 1357 | if (!hpo_link_enc) | |
| 1358 | 1358 | return NULL; /* out of memory */ | |
| 1359 | 1359 | ||
modified drivers/gpu/drm/amd/display/dc/resource/dcn42/dcn42_resource.c
| @@ -818,7 +818,7 @@ static struct dce_aux *dcn42_aux_engine_create( | |||
| 818 | 818 | uint32_t inst) | |
| 819 | 819 | { | |
| 820 | 820 | struct aux_engine_dce110 *aux_engine = | |
| 821 | - | kzalloc_obj(struct aux_engine_dce110); | |
| 821 | + | kzalloc(sizeof(struct aux_engine_dce110), GFP_KERNEL); | |
| 822 | 822 | ||
| 823 | 823 | if (!aux_engine) | |
| 824 | 824 | return NULL; | |
| @@ -884,7 +884,7 @@ static struct dce_i2c_hw *dcn42_i2c_hw_create( | |||
| 884 | 884 | uint32_t inst) | |
| 885 | 885 | { | |
| 886 | 886 | struct dce_i2c_hw *dce_i2c_hw = | |
| 887 | - | kzalloc_obj(struct dce_i2c_hw); | |
| 887 | + | kzalloc(sizeof(struct dce_i2c_hw), GFP_KERNEL); | |
| 888 | 888 | ||
| 889 | 889 | if (!dce_i2c_hw) | |
| 890 | 890 | return NULL; | |
| @@ -910,7 +910,7 @@ static struct clock_source *dcn42_clock_source_create( | |||
| 910 | 910 | bool dp_clk_src) | |
| 911 | 911 | { | |
| 912 | 912 | struct dce110_clk_src *clk_src = | |
| 913 | - | kzalloc_obj(struct dce110_clk_src); | |
| 913 | + | kzalloc(sizeof(struct dce110_clk_src), GFP_KERNEL); | |
| 914 | 914 | ||
| 915 | 915 | if (!clk_src) | |
| 916 | 916 | return NULL; | |
| @@ -929,7 +929,8 @@ static struct hubbub *dcn42_hubbub_create(struct dc_context *ctx) | |||
| 929 | 929 | { | |
| 930 | 930 | int i; | |
| 931 | 931 | ||
| 932 | - | struct dcn20_hubbub *hubbub3 = kzalloc_obj(struct dcn20_hubbub); | |
| 932 | + | struct dcn20_hubbub *hubbub3 = kzalloc(sizeof(struct dcn20_hubbub), | |
| 933 | + | GFP_KERNEL); | |
| 933 | 934 | ||
| 934 | 935 | if (!hubbub3) | |
| 935 | 936 | return NULL; | |
| @@ -982,7 +983,7 @@ static struct hubp *dcn42_hubp_create( | |||
| 982 | 983 | uint32_t inst) | |
| 983 | 984 | { | |
| 984 | 985 | struct dcn20_hubp *hubp2 = | |
| 985 | - | kzalloc_obj(struct dcn20_hubp); | |
| 986 | + | kzalloc(sizeof(struct dcn20_hubp), GFP_KERNEL); | |
| 986 | 987 | ||
| 987 | 988 | if (!hubp2) | |
| 988 | 989 | return NULL; | |
| @@ -1024,7 +1025,7 @@ static struct dpp *dcn42_dpp_create( | |||
| 1024 | 1025 | uint32_t inst) | |
| 1025 | 1026 | { | |
| 1026 | 1027 | struct dcn42_dpp *dpp42 = | |
| 1027 | - | kzalloc_obj(struct dcn42_dpp); | |
| 1028 | + | kzalloc(sizeof(struct dcn42_dpp), GFP_KERNEL); | |
| 1028 | 1029 | ||
| 1029 | 1030 | if (!dpp42) | |
| 1030 | 1031 | return NULL; | |
| @@ -1050,7 +1051,8 @@ static struct mpc *dcn42_mpc_create( | |||
| 1050 | 1051 | int num_mpcc, | |
| 1051 | 1052 | int num_rmu) | |
| 1052 | 1053 | { | |
| 1053 | - | struct dcn42_mpc *mpc401 = kzalloc_obj(struct dcn42_mpc); | |
| 1054 | + | struct dcn42_mpc *mpc401 = kzalloc(sizeof(struct dcn42_mpc), | |
| 1055 | + | GFP_KERNEL); | |
| 1054 | 1056 | ||
| 1055 | 1057 | if (!mpc401) | |
| 1056 | 1058 | return NULL; | |
| @@ -1073,7 +1075,7 @@ static struct output_pixel_processor *dcn42_opp_create( | |||
| 1073 | 1075 | struct dc_context *ctx, uint32_t inst) | |
| 1074 | 1076 | { | |
| 1075 | 1077 | struct dcn20_opp *opp4 = | |
| 1076 | - | kzalloc_obj(struct dcn20_opp); | |
| 1078 | + | kzalloc(sizeof(struct dcn20_opp), GFP_KERNEL); | |
| 1077 | 1079 | ||
| 1078 | 1080 | if (!opp4) { | |
| 1079 | 1081 | BREAK_TO_DEBUGGER(); | |
| @@ -1096,7 +1098,7 @@ static struct timing_generator *dcn42_timing_generator_create( | |||
| 1096 | 1098 | uint32_t instance) | |
| 1097 | 1099 | { | |
| 1098 | 1100 | struct optc *tgn10 = | |
| 1099 | - | kzalloc_obj(struct optc); | |
| 1101 | + | kzalloc(sizeof(struct optc), GFP_KERNEL); | |
| 1100 | 1102 | ||
| 1101 | 1103 | if (!tgn10) | |
| 1102 | 1104 | return NULL; | |
| @@ -1134,7 +1136,7 @@ static struct link_encoder *dcn42_link_encoder_create( | |||
| 1134 | 1136 | const struct encoder_init_data *enc_init_data) | |
| 1135 | 1137 | { | |
| 1136 | 1138 | struct dcn20_link_encoder *enc20 = | |
| 1137 | - | kzalloc_obj(struct dcn20_link_encoder); | |
| 1139 | + | kzalloc(sizeof(struct dcn20_link_encoder), GFP_KERNEL); | |
| 1138 | 1140 | ||
| 1139 | 1141 | if (!enc20 || enc_init_data->hpd_source >= ARRAY_SIZE(link_enc_hpd_regs)) | |
| 1140 | 1142 | return NULL; | |
| @@ -1200,7 +1202,7 @@ static struct vpg *dcn42_vpg_create( | |||
| 1200 | 1202 | struct dc_context *ctx, | |
| 1201 | 1203 | uint32_t inst) | |
| 1202 | 1204 | { | |
| 1203 | - | struct dcn31_vpg *vpg4 = kzalloc_obj(struct dcn31_vpg); | |
| 1205 | + | struct dcn31_vpg *vpg4 = kzalloc(sizeof(struct dcn31_vpg), GFP_KERNEL); | |
| 1204 | 1206 | ||
| 1205 | 1207 | if (!vpg4) | |
| 1206 | 1208 | return NULL; | |
| @@ -1229,7 +1231,7 @@ static struct apg *dcn42_apg_create( | |||
| 1229 | 1231 | struct dc_context *ctx, | |
| 1230 | 1232 | uint32_t inst) | |
| 1231 | 1233 | { | |
| 1232 | - | struct dcn31_apg *apg31 = kzalloc_obj(struct dcn31_apg); | |
| 1234 | + | struct dcn31_apg *apg31 = kzalloc(sizeof(struct dcn31_apg), GFP_KERNEL); | |
| 1233 | 1235 | ||
| 1234 | 1236 | if (!apg31) | |
| 1235 | 1237 | return NULL; | |
| @@ -1273,7 +1275,7 @@ static struct stream_encoder *dcn42_stream_encoder_create( | |||
| 1273 | 1275 | } else | |
| 1274 | 1276 | return NULL; | |
| 1275 | 1277 | ||
| 1276 | - | enc1 = kzalloc_obj(struct dcn10_stream_encoder); | |
| 1278 | + | enc1 = kzalloc(sizeof(struct dcn10_stream_encoder), GFP_KERNEL); | |
| 1277 | 1279 | vpg = dcn42_vpg_create(ctx, vpg_inst); | |
| 1278 | 1280 | apg = dcn42_apg_create(ctx, apg_inst); | |
| 1279 | 1281 | ||
| @@ -1323,7 +1325,7 @@ static struct hpo_frl_stream_encoder *dcn42_hpo_frl_stream_encoder_create( | |||
| 1323 | 1325 | return NULL; | |
| 1324 | 1326 | ||
| 1325 | 1327 | /* allocate HPO stream encoder and create VPG sub-block */ | |
| 1326 | - | hpo_enc42 = kzalloc_obj(struct dcn42_hpo_frl_stream_encoder); | |
| 1328 | + | hpo_enc42 = kzalloc(sizeof(struct dcn42_hpo_frl_stream_encoder), GFP_KERNEL); | |
| 1327 | 1329 | vpg = dcn42_vpg_create(ctx, vpg_inst); | |
| 1328 | 1330 | apg = dcn42_apg_create(ctx, apg_inst); | |
| 1329 | 1331 | ||
| @@ -1355,7 +1357,7 @@ static struct hpo_frl_link_encoder *dcn42_hpo_frl_link_encoder_create( | |||
| 1355 | 1357 | hpo_frl_link_encoder_reg_list(0); | |
| 1356 | 1358 | ||
| 1357 | 1359 | /* allocate HPO link encoder */ | |
| 1358 | - | hpo_link_enc = kzalloc_obj(struct dcn30_hpo_frl_link_encoder); | |
| 1360 | + | hpo_link_enc = kzalloc(sizeof(struct dcn30_hpo_frl_link_encoder), GFP_KERNEL); | |
| 1359 | 1361 | if (!hpo_link_enc) | |
| 1360 | 1362 | return NULL; /* out of memory */ | |
| 1361 | 1363 | ||
| @@ -1397,7 +1399,7 @@ static struct hpo_dp_stream_encoder *dcn42_hpo_dp_stream_encoder_create( | |||
| 1397 | 1399 | apg_inst = hpo_dp_inst + 5; | |
| 1398 | 1400 | ||
| 1399 | 1401 | /* allocate HPO stream encoder and create VPG sub-block */ | |
| 1400 | - | hpo_dp_enc31 = kzalloc_obj(struct dcn31_hpo_dp_stream_encoder); | |
| 1402 | + | hpo_dp_enc31 = kzalloc(sizeof(struct dcn31_hpo_dp_stream_encoder), GFP_KERNEL); | |
| 1401 | 1403 | vpg = dcn42_vpg_create(ctx, vpg_inst); | |
| 1402 | 1404 | apg = dcn42_apg_create(ctx, apg_inst); | |
| 1403 | 1405 | ||
| @@ -1430,7 +1432,7 @@ static struct hpo_dp_link_encoder *dcn42_hpo_dp_link_encoder_create( | |||
| 1430 | 1432 | struct dcn31_hpo_dp_link_encoder *hpo_dp_enc31; | |
| 1431 | 1433 | ||
| 1432 | 1434 | /* allocate HPO link encoder */ | |
| 1433 | - | hpo_dp_enc31 = kzalloc_obj(struct dcn31_hpo_dp_link_encoder); | |
| 1435 | + | hpo_dp_enc31 = kzalloc(sizeof(struct dcn31_hpo_dp_link_encoder), GFP_KERNEL); | |
| 1434 | 1436 | if (!hpo_dp_enc31) | |
| 1435 | 1437 | return NULL; /* out of memory */ | |
| 1436 | 1438 | ||
| @@ -1451,7 +1453,7 @@ static struct hpo_dp_link_encoder *dcn42_hpo_dp_link_encoder_create( | |||
| 1451 | 1453 | static struct dce_hwseq *dcn42_hwseq_create( | |
| 1452 | 1454 | struct dc_context *ctx) | |
| 1453 | 1455 | { | |
| 1454 | - | struct dce_hwseq *hws = kzalloc_obj(struct dce_hwseq); | |
| 1456 | + | struct dce_hwseq *hws = kzalloc(sizeof(struct dce_hwseq), GFP_KERNEL); | |
| 1455 | 1457 | ||
| 1456 | 1458 | #undef REG_STRUCT | |
| 1457 | 1459 | #define REG_STRUCT hwseq_reg | |
| @@ -1725,7 +1727,8 @@ static bool dcn42_dwbc_create(struct dc_context *ctx, struct resource_pool *pool | |||
| 1725 | 1727 | uint32_t dwb_count = pool->res_cap->num_dwb; | |
| 1726 | 1728 | ||
| 1727 | 1729 | for (i = 0; i < dwb_count; i++) { | |
| 1728 | - | struct dcn30_dwbc *dwbc42 = kzalloc_obj(struct dcn30_dwbc); | |
| 1730 | + | struct dcn30_dwbc *dwbc42 = kzalloc(sizeof(struct dcn30_dwbc), | |
| 1731 | + | GFP_KERNEL); | |
| 1729 | 1732 | ||
| 1730 | 1733 | if (!dwbc42) { | |
| 1731 | 1734 | dm_error("DC: failed to create dwbc42!\n"); | |
| @@ -1761,7 +1764,8 @@ static bool dcn42_mmhubbub_create(struct dc_context *ctx, struct resource_pool * | |||
| 1761 | 1764 | uint32_t pipe_count = pool->res_cap->num_dwb; | |
| 1762 | 1765 | ||
| 1763 | 1766 | for (i = 0; i < pipe_count; i++) { | |
| 1764 | - | struct dcn30_mmhubbub *mcif_wb30 = kzalloc_obj(struct dcn30_mmhubbub); | |
| 1767 | + | struct dcn30_mmhubbub *mcif_wb30 = kzalloc(sizeof(struct dcn30_mmhubbub), | |
| 1768 | + | GFP_KERNEL); | |
| 1765 | 1769 | ||
| 1766 | 1770 | if (!mcif_wb30) { | |
| 1767 | 1771 | dm_error("DC: failed to create mcif_wb30!\n"); | |
| @@ -1789,7 +1793,7 @@ static struct display_stream_compressor *dcn42_dsc_create( | |||
| 1789 | 1793 | struct dc_context *ctx, uint32_t inst) | |
| 1790 | 1794 | { | |
| 1791 | 1795 | struct dcn401_dsc *dsc = | |
| 1792 | - | kzalloc_obj(struct dcn401_dsc); | |
| 1796 | + | kzalloc(sizeof(struct dcn401_dsc), GFP_KERNEL); | |
| 1793 | 1797 | ||
| 1794 | 1798 | if (!dsc) { | |
| 1795 | 1799 | BREAK_TO_DEBUGGER(); | |
| @@ -1886,7 +1890,7 @@ static struct link_encoder *dcn42_link_enc_create_minimal( | |||
| 1886 | 1890 | if ((unsigned int)(eng_id - ENGINE_ID_DIGA) >= ctx->dc->res_pool->res_cap->num_dig_link_enc) | |
| 1887 | 1891 | return NULL; | |
| 1888 | 1892 | ||
| 1889 | - | enc20 = kzalloc_obj(struct dcn20_link_encoder); | |
| 1893 | + | enc20 = kzalloc(sizeof(struct dcn20_link_encoder), GFP_KERNEL); | |
| 1890 | 1894 | if (!enc20) | |
| 1891 | 1895 | return NULL; | |
| 1892 | 1896 | ||
| @@ -2437,7 +2441,7 @@ struct resource_pool *dcn42_create_resource_pool( | |||
| 2437 | 2441 | struct dc *dc) | |
| 2438 | 2442 | { | |
| 2439 | 2443 | struct dcn42_resource_pool *pool = | |
| 2440 | - | kzalloc_obj(struct dcn42_resource_pool); | |
| 2444 | + | kzalloc(sizeof(struct dcn401_resource_pool), GFP_KERNEL); | |
| 2441 | 2445 | ||
| 2442 | 2446 | if (!pool) | |
| 2443 | 2447 | return NULL; | |
modified drivers/gpu/drm/amd/display/dc/resource/dcn42b/dcn42b_resource.c
| @@ -870,7 +870,7 @@ static struct dce_aux *dcn42b_aux_engine_create( | |||
| 870 | 870 | uint32_t inst) | |
| 871 | 871 | { | |
| 872 | 872 | struct aux_engine_dce110 *aux_engine = | |
| 873 | - | kzalloc_obj(struct aux_engine_dce110); | |
| 873 | + | kzalloc(sizeof(struct aux_engine_dce110), GFP_KERNEL); | |
| 874 | 874 | ||
| 875 | 875 | if (!aux_engine) | |
| 876 | 876 | return NULL; | |
| @@ -940,7 +940,7 @@ static struct dce_i2c_hw *dcn42b_i2c_hw_create( | |||
| 940 | 940 | uint32_t inst) | |
| 941 | 941 | { | |
| 942 | 942 | struct dce_i2c_hw *dce_i2c_hw = | |
| 943 | - | kzalloc_obj(struct dce_i2c_hw); | |
| 943 | + | kzalloc(sizeof(struct dce_i2c_hw), GFP_KERNEL); | |
| 944 | 944 | ||
| 945 | 945 | if (!dce_i2c_hw) | |
| 946 | 946 | return NULL; | |
| @@ -968,7 +968,7 @@ static struct clock_source *dcn42b_clock_source_create( | |||
| 968 | 968 | bool dp_clk_src) | |
| 969 | 969 | { | |
| 970 | 970 | struct dce110_clk_src *clk_src = | |
| 971 | - | kzalloc_obj(struct dce110_clk_src); | |
| 971 | + | kzalloc(sizeof(struct dce110_clk_src), GFP_KERNEL); | |
| 972 | 972 | ||
| 973 | 973 | if (!clk_src) | |
| 974 | 974 | return NULL; | |
| @@ -988,7 +988,8 @@ static struct hubbub *dcn42b_hubbub_create(struct dc_context *ctx) | |||
| 988 | 988 | { | |
| 989 | 989 | int i; | |
| 990 | 990 | ||
| 991 | - | struct dcn20_hubbub *hubbub3 = kzalloc_obj(struct dcn20_hubbub); | |
| 991 | + | struct dcn20_hubbub *hubbub3 = kzalloc(sizeof(struct dcn20_hubbub), | |
| 992 | + | GFP_KERNEL); | |
| 992 | 993 | ||
| 993 | 994 | if (!hubbub3) | |
| 994 | 995 | return NULL; | |
| @@ -1041,7 +1042,7 @@ static struct hubp *dcn42b_hubp_create( | |||
| 1041 | 1042 | uint32_t inst) | |
| 1042 | 1043 | { | |
| 1043 | 1044 | struct dcn20_hubp *hubp2 = | |
| 1044 | - | kzalloc_obj(struct dcn20_hubp); | |
| 1045 | + | kzalloc(sizeof(struct dcn20_hubp), GFP_KERNEL); | |
| 1045 | 1046 | ||
| 1046 | 1047 | if (!hubp2) | |
| 1047 | 1048 | return NULL; | |
| @@ -1083,7 +1084,7 @@ static struct dpp *dcn42b_dpp_create( | |||
| 1083 | 1084 | uint32_t inst) | |
| 1084 | 1085 | { | |
| 1085 | 1086 | struct dcn42_dpp *dpp42b = | |
| 1086 | - | kzalloc_obj(struct dcn42_dpp); | |
| 1087 | + | kzalloc(sizeof(struct dcn42_dpp), GFP_KERNEL); | |
| 1087 | 1088 | ||
| 1088 | 1089 | if (!dpp42b) | |
| 1089 | 1090 | return NULL; | |
| @@ -1109,7 +1110,8 @@ static struct mpc *dcn42b_mpc_create( | |||
| 1109 | 1110 | int num_mpcc, | |
| 1110 | 1111 | int num_rmu) | |
| 1111 | 1112 | { | |
| 1112 | - | struct dcn42_mpc *mpc42b = kzalloc_obj(struct dcn42_mpc); | |
| 1113 | + | struct dcn42_mpc *mpc42b = kzalloc(sizeof(struct dcn42_mpc), | |
| 1114 | + | GFP_KERNEL); | |
| 1113 | 1115 | ||
| 1114 | 1116 | if (!mpc42b) | |
| 1115 | 1117 | return NULL; | |
| @@ -1132,7 +1134,7 @@ static struct output_pixel_processor *dcn42b_opp_create( | |||
| 1132 | 1134 | struct dc_context *ctx, uint32_t inst) | |
| 1133 | 1135 | { | |
| 1134 | 1136 | struct dcn20_opp *opp4 = | |
| 1135 | - | kzalloc_obj(struct dcn20_opp); | |
| 1137 | + | kzalloc(sizeof(struct dcn20_opp), GFP_KERNEL); | |
| 1136 | 1138 | ||
| 1137 | 1139 | if (!opp4) { | |
| 1138 | 1140 | BREAK_TO_DEBUGGER(); | |
| @@ -1156,7 +1158,7 @@ static struct timing_generator *dcn42b_timing_generator_create( | |||
| 1156 | 1158 | uint32_t instance) | |
| 1157 | 1159 | { | |
| 1158 | 1160 | struct optc *tgn10 = | |
| 1159 | - | kzalloc_obj(struct optc); | |
| 1161 | + | kzalloc(sizeof(struct optc), GFP_KERNEL); | |
| 1160 | 1162 | ||
| 1161 | 1163 | if (!tgn10) | |
| 1162 | 1164 | return NULL; | |
| @@ -1194,7 +1196,7 @@ static struct link_encoder *dcn42b_link_encoder_create( | |||
| 1194 | 1196 | const struct encoder_init_data *enc_init_data) | |
| 1195 | 1197 | { | |
| 1196 | 1198 | struct dcn20_link_encoder *enc20 = | |
| 1197 | - | kzalloc_obj(struct dcn20_link_encoder); | |
| 1199 | + | kzalloc(sizeof(struct dcn20_link_encoder), GFP_KERNEL); | |
| 1198 | 1200 | ||
| 1199 | 1201 | if (!enc20 || enc_init_data->hpd_source >= ARRAY_SIZE(link_enc_hpd_regs)) | |
| 1200 | 1202 | return NULL; | |
| @@ -1269,7 +1271,7 @@ static struct vpg *dcn42b_vpg_create( | |||
| 1269 | 1271 | struct dc_context *ctx, | |
| 1270 | 1272 | uint32_t inst) | |
| 1271 | 1273 | { | |
| 1272 | - | struct dcn31_vpg *vpg4 = kzalloc_obj(struct dcn31_vpg); | |
| 1274 | + | struct dcn31_vpg *vpg4 = kzalloc(sizeof(struct dcn31_vpg), GFP_KERNEL); | |
| 1273 | 1275 | ||
| 1274 | 1276 | if (!vpg4) | |
| 1275 | 1277 | return NULL; | |
| @@ -1298,7 +1300,7 @@ static struct apg *dcn42b_apg_create( | |||
| 1298 | 1300 | struct dc_context *ctx, | |
| 1299 | 1301 | uint32_t inst) | |
| 1300 | 1302 | { | |
| 1301 | - | struct dcn31_apg *apg31 = kzalloc_obj(struct dcn31_apg); | |
| 1303 | + | struct dcn31_apg *apg31 = kzalloc(sizeof(struct dcn31_apg), GFP_KERNEL); | |
| 1302 | 1304 | ||
| 1303 | 1305 | if (!apg31) | |
| 1304 | 1306 | return NULL; | |
| @@ -1342,7 +1344,7 @@ static struct stream_encoder *dcn42b_stream_encoder_create( | |||
| 1342 | 1344 | } else | |
| 1343 | 1345 | return NULL; | |
| 1344 | 1346 | ||
| 1345 | - | enc1 = kzalloc_obj(struct dcn10_stream_encoder); | |
| 1347 | + | enc1 = kzalloc(sizeof(struct dcn10_stream_encoder), GFP_KERNEL); | |
| 1346 | 1348 | vpg = dcn42b_vpg_create(ctx, vpg_inst); | |
| 1347 | 1349 | apg = dcn42b_apg_create(ctx, apg_inst); | |
| 1348 | 1350 | ||
| @@ -1402,7 +1404,7 @@ static struct hpo_dp_stream_encoder *dcn42b_hpo_dp_stream_encoder_create( | |||
| 1402 | 1404 | apg_inst = hpo_dp_inst + 6; | |
| 1403 | 1405 | ||
| 1404 | 1406 | /* allocate HPO stream encoder and create VPG sub-block */ | |
| 1405 | - | hpo_dp_enc31 = kzalloc_obj(struct dcn31_hpo_dp_stream_encoder); | |
| 1407 | + | hpo_dp_enc31 = kzalloc(sizeof(struct dcn31_hpo_dp_stream_encoder), GFP_KERNEL); | |
| 1406 | 1408 | vpg = dcn42b_vpg_create(ctx, vpg_inst); | |
| 1407 | 1409 | apg = dcn42b_apg_create(ctx, apg_inst); | |
| 1408 | 1410 | ||
| @@ -1435,7 +1437,7 @@ static struct hpo_dp_link_encoder *dcn42b_hpo_dp_link_encoder_create( | |||
| 1435 | 1437 | struct dcn31_hpo_dp_link_encoder *hpo_dp_enc31; | |
| 1436 | 1438 | ||
| 1437 | 1439 | /* allocate HPO link encoder */ | |
| 1438 | - | hpo_dp_enc31 = kzalloc_obj(struct dcn31_hpo_dp_link_encoder); | |
| 1440 | + | hpo_dp_enc31 = kzalloc(sizeof(struct dcn31_hpo_dp_link_encoder), GFP_KERNEL); | |
| 1439 | 1441 | if (!hpo_dp_enc31) | |
| 1440 | 1442 | return NULL; /* out of memory */ | |
| 1441 | 1443 | ||
| @@ -1455,7 +1457,7 @@ static struct hpo_dp_link_encoder *dcn42b_hpo_dp_link_encoder_create( | |||
| 1455 | 1457 | static struct dce_hwseq *dcn42b_hwseq_create( | |
| 1456 | 1458 | struct dc_context *ctx) | |
| 1457 | 1459 | { | |
| 1458 | - | struct dce_hwseq *hws = kzalloc_obj(struct dce_hwseq); | |
| 1460 | + | struct dce_hwseq *hws = kzalloc(sizeof(struct dce_hwseq), GFP_KERNEL); | |
| 1459 | 1461 | ||
| 1460 | 1462 | #undef REG_STRUCT | |
| 1461 | 1463 | #define REG_STRUCT hwseq_reg | |
| @@ -1714,7 +1716,8 @@ static bool dcn42b_dwbc_create(struct dc_context *ctx, struct resource_pool *poo | |||
| 1714 | 1716 | uint32_t dwb_count = pool->res_cap->num_dwb; | |
| 1715 | 1717 | ||
| 1716 | 1718 | for (i = 0; i < dwb_count; i++) { | |
| 1717 | - | struct dcn30_dwbc *dwbc42 = kzalloc_obj(struct dcn30_dwbc); | |
| 1719 | + | struct dcn30_dwbc *dwbc42 = kzalloc(sizeof(struct dcn30_dwbc), | |
| 1720 | + | GFP_KERNEL); | |
| 1718 | 1721 | ||
| 1719 | 1722 | if (!dwbc42) { | |
| 1720 | 1723 | dm_error("DC: failed to create dwbc42!\n"); | |
| @@ -1750,7 +1753,8 @@ static bool dcn42b_mmhubbub_create(struct dc_context *ctx, struct resource_pool | |||
| 1750 | 1753 | uint32_t pipe_count = pool->res_cap->num_dwb; | |
| 1751 | 1754 | ||
| 1752 | 1755 | for (i = 0; i < pipe_count; i++) { | |
| 1753 | - | struct dcn30_mmhubbub *mcif_wb30 = kzalloc_obj(struct dcn30_mmhubbub); | |
| 1756 | + | struct dcn30_mmhubbub *mcif_wb30 = kzalloc(sizeof(struct dcn30_mmhubbub), | |
| 1757 | + | GFP_KERNEL); | |
| 1754 | 1758 | ||
| 1755 | 1759 | if (!mcif_wb30) { | |
| 1756 | 1760 | dm_error("DC: failed to create mcif_wb30!\n"); | |
| @@ -1778,7 +1782,7 @@ static struct display_stream_compressor *dcn42b_dsc_create( | |||
| 1778 | 1782 | struct dc_context *ctx, uint32_t inst) | |
| 1779 | 1783 | { | |
| 1780 | 1784 | struct dcn401_dsc *dsc = | |
| 1781 | - | kzalloc_obj(struct dcn401_dsc); | |
| 1785 | + | kzalloc(sizeof(struct dcn401_dsc), GFP_KERNEL); | |
| 1782 | 1786 | ||
| 1783 | 1787 | if (!dsc) { | |
| 1784 | 1788 | BREAK_TO_DEBUGGER(); | |
| @@ -1871,7 +1875,7 @@ static struct link_encoder *dcn42b_link_enc_create_minimal( | |||
| 1871 | 1875 | if ((unsigned int)(eng_id - ENGINE_ID_DIGA) >= ctx->dc->res_pool->res_cap->num_dig_link_enc) | |
| 1872 | 1876 | return NULL; | |
| 1873 | 1877 | ||
| 1874 | - | enc20 = kzalloc_obj(struct dcn20_link_encoder); | |
| 1878 | + | enc20 = kzalloc(sizeof(struct dcn20_link_encoder), GFP_KERNEL); | |
| 1875 | 1879 | if (!enc20) | |
| 1876 | 1880 | return NULL; | |
| 1877 | 1881 | ||
| @@ -2435,7 +2439,7 @@ struct resource_pool *dcn42b_create_resource_pool( | |||
| 2435 | 2439 | struct dc *dc) | |
| 2436 | 2440 | { | |
| 2437 | 2441 | struct dcn42b_resource_pool *pool = | |
| 2438 | - | kzalloc_obj(struct dcn42b_resource_pool); | |
| 2442 | + | kzalloc(sizeof(struct dcn42b_resource_pool), GFP_KERNEL); | |
| 2439 | 2443 | ||
| 2440 | 2444 | if (!pool) | |
| 2441 | 2445 | return NULL; | |
modified drivers/gpu/drm/amd/display/dc/resource/dcn60/dcn60_resource.c
| @@ -998,7 +998,7 @@ static struct dce_aux *dcn60_aux_engine_create( | |||
| 998 | 998 | uint32_t inst) | |
| 999 | 999 | { | |
| 1000 | 1000 | struct aux_engine_dce110 *aux_engine = | |
| 1001 | - | kzalloc_obj(struct aux_engine_dce110); | |
| 1001 | + | kzalloc(sizeof(struct aux_engine_dce110), GFP_KERNEL); | |
| 1002 | 1002 | ||
| 1003 | 1003 | if (!aux_engine) | |
| 1004 | 1004 | return NULL; | |
| @@ -1037,7 +1037,7 @@ static struct dce_i2c_hw *dcn60_i2c_hw_create( | |||
| 1037 | 1037 | uint32_t inst) | |
| 1038 | 1038 | { | |
| 1039 | 1039 | struct dce_i2c_hw *dce_i2c_hw = | |
| 1040 | - | kzalloc_obj(struct dce_i2c_hw); | |
| 1040 | + | kzalloc(sizeof(struct dce_i2c_hw), GFP_KERNEL); | |
| 1041 | 1041 | ||
| 1042 | 1042 | if (!dce_i2c_hw) | |
| 1043 | 1043 | return NULL; | |
| @@ -1061,7 +1061,7 @@ static struct clock_source *dcn60_clock_source_create( | |||
| 1061 | 1061 | bool dp_clk_src) | |
| 1062 | 1062 | { | |
| 1063 | 1063 | struct dce110_clk_src *clk_src = | |
| 1064 | - | kzalloc_obj(struct dce110_clk_src); | |
| 1064 | + | kzalloc(sizeof(struct dce110_clk_src), GFP_KERNEL); | |
| 1065 | 1065 | ||
| 1066 | 1066 | if (!clk_src) | |
| 1067 | 1067 | return NULL; | |
| @@ -1081,7 +1081,8 @@ static struct hubbub *dcn60_hubbub_create(struct dc_context *ctx) | |||
| 1081 | 1081 | { | |
| 1082 | 1082 | int i; | |
| 1083 | 1083 | ||
| 1084 | - | struct dcn20_hubbub *hubbub2 = kzalloc_obj(struct dcn20_hubbub); | |
| 1084 | + | struct dcn20_hubbub *hubbub2 = kzalloc(sizeof(struct dcn20_hubbub), | |
| 1085 | + | GFP_KERNEL); | |
| 1085 | 1086 | ||
| 1086 | 1087 | if (!hubbub2) | |
| 1087 | 1088 | return NULL; | |
| @@ -1135,7 +1136,7 @@ static struct hubp *dcn60_hubp_create( | |||
| 1135 | 1136 | uint32_t inst) | |
| 1136 | 1137 | { | |
| 1137 | 1138 | struct dcn20_hubp *hubp2 = | |
| 1138 | - | kzalloc_obj(struct dcn20_hubp); | |
| 1139 | + | kzalloc(sizeof(struct dcn20_hubp), GFP_KERNEL); | |
| 1139 | 1140 | ||
| 1140 | 1141 | if (!hubp2) | |
| 1141 | 1142 | return NULL; | |
| @@ -1167,7 +1168,7 @@ static struct dpp *dcn60_dpp_create( | |||
| 1167 | 1168 | uint32_t inst) | |
| 1168 | 1169 | { | |
| 1169 | 1170 | struct dcn60_dpp *dpp60 = | |
| 1170 | - | kzalloc_obj(struct dcn60_dpp); | |
| 1171 | + | kzalloc(sizeof(struct dcn60_dpp), GFP_KERNEL); | |
| 1171 | 1172 | ||
| 1172 | 1173 | if (!dpp60) | |
| 1173 | 1174 | return NULL; | |
| @@ -1193,7 +1194,8 @@ static struct mpc *dcn60_mpc_create( | |||
| 1193 | 1194 | int num_mpcc, | |
| 1194 | 1195 | int num_rmu) | |
| 1195 | 1196 | { | |
| 1196 | - | struct dcn60_mpc *mpc60 = kzalloc_obj(struct dcn60_mpc); | |
| 1197 | + | struct dcn60_mpc *mpc60 = kzalloc(sizeof(struct dcn60_mpc), | |
| 1198 | + | GFP_KERNEL); | |
| 1197 | 1199 | ||
| 1198 | 1200 | if (!mpc60) | |
| 1199 | 1201 | return NULL; | |
| @@ -1216,7 +1218,7 @@ static struct output_pixel_processor *dcn60_opp_create( | |||
| 1216 | 1218 | struct dc_context *ctx, uint32_t inst) | |
| 1217 | 1219 | { | |
| 1218 | 1220 | struct dcn20_opp *opp2 = | |
| 1219 | - | kzalloc_obj(struct dcn20_opp); | |
| 1221 | + | kzalloc(sizeof(struct dcn20_opp), GFP_KERNEL); | |
| 1220 | 1222 | ||
| 1221 | 1223 | if (!opp2) { | |
| 1222 | 1224 | BREAK_TO_DEBUGGER(); | |
| @@ -1240,7 +1242,7 @@ static struct timing_generator *dcn60_timing_generator_create( | |||
| 1240 | 1242 | uint32_t instance) | |
| 1241 | 1243 | { | |
| 1242 | 1244 | struct optc *tgn10 = | |
| 1243 | - | kzalloc_obj(struct optc); | |
| 1245 | + | kzalloc(sizeof(struct optc), GFP_KERNEL); | |
| 1244 | 1246 | ||
| 1245 | 1247 | if (!tgn10) | |
| 1246 | 1248 | return NULL; | |
| @@ -1280,7 +1282,7 @@ static struct link_encoder *dcn60_link_encoder_create( | |||
| 1280 | 1282 | const struct encoder_init_data *enc_init_data) | |
| 1281 | 1283 | { | |
| 1282 | 1284 | struct dcn20_link_encoder *enc20 = | |
| 1283 | - | kzalloc_obj(struct dcn20_link_encoder); | |
| 1285 | + | kzalloc(sizeof(struct dcn20_link_encoder), GFP_KERNEL); | |
| 1284 | 1286 | ||
| 1285 | 1287 | if (!enc20 || enc_init_data->hpd_source >= ARRAY_SIZE(link_enc_hpd_regs)) { | |
| 1286 | 1288 | kfree(enc20); | |
| @@ -1347,7 +1349,7 @@ static struct vpg *dcn60_vpg_create( | |||
| 1347 | 1349 | struct dc_context *ctx, | |
| 1348 | 1350 | uint32_t inst) | |
| 1349 | 1351 | { | |
| 1350 | - | struct dcn31_vpg *vpg6 = kzalloc_obj(struct dcn31_vpg); | |
| 1352 | + | struct dcn31_vpg *vpg6 = kzalloc(sizeof(struct dcn31_vpg), GFP_KERNEL); | |
| 1351 | 1353 | ||
| 1352 | 1354 | if (!vpg6) | |
| 1353 | 1355 | return NULL; | |
| @@ -1376,7 +1378,7 @@ static struct apg *dcn60_apg_create( | |||
| 1376 | 1378 | struct dc_context *ctx, | |
| 1377 | 1379 | uint32_t inst) | |
| 1378 | 1380 | { | |
| 1379 | - | struct dcn31_apg *apg60 = kzalloc_obj(struct dcn31_apg); | |
| 1381 | + | struct dcn31_apg *apg60 = kzalloc(sizeof(struct dcn31_apg), GFP_KERNEL); | |
| 1380 | 1382 | ||
| 1381 | 1383 | if (!apg60) | |
| 1382 | 1384 | return NULL; | |
| @@ -1413,7 +1415,7 @@ static struct stream_encoder *dcn60_stream_encoder_create( | |||
| 1413 | 1415 | } else | |
| 1414 | 1416 | return NULL; | |
| 1415 | 1417 | ||
| 1416 | - | enc1 = kzalloc_obj(struct dcn10_stream_encoder); | |
| 1418 | + | enc1 = kzalloc(sizeof(struct dcn10_stream_encoder), GFP_KERNEL); | |
| 1417 | 1419 | vpg = dcn60_vpg_create(ctx, vpg_inst); | |
| 1418 | 1420 | apg = dcn60_apg_create(ctx, apg_inst); | |
| 1419 | 1421 | ||
| @@ -1460,7 +1462,7 @@ static struct hpo_frl_stream_encoder *dcn60_hpo_frl_stream_encoder_create( | |||
| 1460 | 1462 | return NULL; | |
| 1461 | 1463 | ||
| 1462 | 1464 | /* allocate HPO stream encoder and create VPG, APG sub-blocks */ | |
| 1463 | - | hpo_enc60 = kzalloc_obj(struct dcn401_hpo_frl_stream_encoder); | |
| 1465 | + | hpo_enc60 = kzalloc(sizeof(struct dcn401_hpo_frl_stream_encoder), GFP_KERNEL); | |
| 1464 | 1466 | vpg = dcn60_vpg_create(ctx, vpg_inst); | |
| 1465 | 1467 | apg = dcn60_apg_create(ctx, apg_inst); | |
| 1466 | 1468 | ||
| @@ -1491,7 +1493,7 @@ static struct hpo_frl_link_encoder *dcn60_hpo_frl_link_encoder_create( | |||
| 1491 | 1493 | hpo_frl_link_encoder_reg_list(0); | |
| 1492 | 1494 | ||
| 1493 | 1495 | /* allocate HPO link encoder */ | |
| 1494 | - | hpo_link_enc = kzalloc_obj(struct dcn30_hpo_frl_link_encoder); | |
| 1496 | + | hpo_link_enc = kzalloc(sizeof(struct dcn30_hpo_frl_link_encoder), GFP_KERNEL); | |
| 1495 | 1497 | if (!hpo_link_enc) | |
| 1496 | 1498 | return NULL; /* out of memory */ | |
| 1497 | 1499 | ||
| @@ -1533,7 +1535,7 @@ static struct hpo_dp_stream_encoder *dcn60_hpo_dp_stream_encoder_create( | |||
| 1533 | 1535 | apg_inst = hpo_dp_inst; | |
| 1534 | 1536 | ||
| 1535 | 1537 | /* allocate HPO stream encoder and create VPG sub-block */ | |
| 1536 | - | hpo_dp_enc60 = kzalloc_obj(struct dcn31_hpo_dp_stream_encoder); | |
| 1538 | + | hpo_dp_enc60 = kzalloc(sizeof(struct dcn31_hpo_dp_stream_encoder), GFP_KERNEL); | |
| 1537 | 1539 | vpg = dcn60_vpg_create(ctx, vpg_inst); | |
| 1538 | 1540 | apg = dcn60_apg_create(ctx, apg_inst); | |
| 1539 | 1541 | ||
| @@ -1566,7 +1568,7 @@ static struct hpo_dp_link_encoder *dcn60_hpo_dp_link_encoder_create( | |||
| 1566 | 1568 | struct dcn31_hpo_dp_link_encoder *hpo_dp_enc60; | |
| 1567 | 1569 | ||
| 1568 | 1570 | /* allocate HPO link encoder */ | |
| 1569 | - | hpo_dp_enc60 = kzalloc_obj(struct dcn31_hpo_dp_link_encoder); | |
| 1571 | + | hpo_dp_enc60 = kzalloc(sizeof(struct dcn31_hpo_dp_link_encoder), GFP_KERNEL); | |
| 1570 | 1572 | if (!hpo_dp_enc60) | |
| 1571 | 1573 | return NULL; /* out of memory */ | |
| 1572 | 1574 | ||
| @@ -1587,7 +1589,7 @@ static struct hpo_dp_link_encoder *dcn60_hpo_dp_link_encoder_create( | |||
| 1587 | 1589 | static struct dce_hwseq *dcn60_hwseq_create( | |
| 1588 | 1590 | struct dc_context *ctx) | |
| 1589 | 1591 | { | |
| 1590 | - | struct dce_hwseq *hws = kzalloc_obj(struct dce_hwseq); | |
| 1592 | + | struct dce_hwseq *hws = kzalloc(sizeof(struct dce_hwseq), GFP_KERNEL); | |
| 1591 | 1593 | ||
| 1592 | 1594 | #undef REG_STRUCT | |
| 1593 | 1595 | #define REG_STRUCT hwseq_reg | |
| @@ -1782,7 +1784,7 @@ static struct display_stream_compressor *dcn60_dsc_create( | |||
| 1782 | 1784 | struct dc_context *ctx, uint32_t inst) | |
| 1783 | 1785 | { | |
| 1784 | 1786 | struct dcn60_dsc *dsc = | |
| 1785 | - | kzalloc_obj(struct dcn60_dsc); | |
| 1787 | + | kzalloc(sizeof(struct dcn60_dsc), GFP_KERNEL); | |
| 1786 | 1788 | ||
| 1787 | 1789 | if (!dsc) { | |
| 1788 | 1790 | BREAK_TO_DEBUGGER(); | |
| @@ -2361,7 +2363,7 @@ struct resource_pool *dcn60_create_resource_pool( | |||
| 2361 | 2363 | struct dc *dc) | |
| 2362 | 2364 | { | |
| 2363 | 2365 | struct dcn60_resource_pool *pool = | |
| 2364 | - | kzalloc_obj(struct dcn60_resource_pool); | |
| 2366 | + | kzalloc(sizeof(struct dcn60_resource_pool), GFP_KERNEL); | |
| 2365 | 2367 | ||
| 2366 | 2368 | if (!pool) | |
| 2367 | 2369 | return NULL; | |
modified drivers/gpu/drm/amd/display/modules/power/power.c
| @@ -111,7 +111,7 @@ struct mod_power *mod_power_create(struct dc *dc, | |||
| 111 | 111 | if (dc == NULL) | |
| 112 | 112 | goto fail_dc_null; | |
| 113 | 113 | ||
| 114 | - | core_power = kzalloc_obj(struct core_power); | |
| 114 | + | core_power = kzalloc(sizeof(struct core_power), GFP_KERNEL); | |
| 115 | 115 | ||
| 116 | 116 | if (core_power == NULL) | |
| 117 | 117 | goto fail_alloc_context; | |
| @@ -129,7 +129,8 @@ struct mod_power *mod_power_create(struct dc *dc, | |||
| 129 | 129 | ||
| 130 | 130 | for (i = 0; i < MOD_POWER_MAX_CONCURRENT_STREAMS; i++) { | |
| 131 | 131 | core_power->map[i].psr_context = | |
| 132 | - | kzalloc_obj(struct mod_power_psr_context); | |
| 132 | + | kzalloc(sizeof(struct mod_power_psr_context), | |
| 133 | + | GFP_KERNEL); | |
| 133 | 134 | if (core_power->map[i].psr_context == NULL) | |
| 134 | 135 | goto fail_construct; | |
| 135 | 136 | } | |
| @@ -328,7 +329,6 @@ bool mod_power_add_stream(struct mod_power *mod_power, | |||
| 328 | 329 | core_power->map[core_power->num_entities].psr_enabled = 0; | |
| 329 | 330 | core_power->map[core_power->num_entities].psr_events = psr_event_vsync; | |
| 330 | 331 | core_power->map[core_power->num_entities].psr_power_opt = 0; | |
| 331 | - | core_power->map[core_power->num_entities].replay_events = replay_event_vsync; | |
| 332 | 332 | core_power->num_entities++; | |
| 333 | 333 | return true; | |
| 334 | 334 | } | |
| @@ -388,7 +388,6 @@ bool mod_power_remove_stream(struct mod_power *mod_power, | |||
| 388 | 388 | core_power->map[i].psr_enabled = core_power->map[i + 1].psr_enabled; | |
| 389 | 389 | core_power->map[i].psr_events = core_power->map[i + 1].psr_events; | |
| 390 | 390 | core_power->map[i].psr_power_opt = core_power->map[i + 1].psr_power_opt; | |
| 391 | - | core_power->map[i].replay_events = core_power->map[i + 1].replay_events; | |
| 392 | 391 | ||
| 393 | 392 | memcpy(core_power->map[i].psr_context, core_power->map[i + 1].psr_context, sizeof(struct mod_power_psr_context)); | |
| 394 | 393 | memset(core_power->map[i + 1].psr_context, 0, sizeof(struct mod_power_psr_context)); | |
modified drivers/gpu/drm/amd/display/modules/power/power_abm.c
| @@ -705,7 +705,8 @@ void initialize_backlight_caps(struct core_power *core_power, unsigned int inst) | |||
| 705 | 705 | * (do not want to use 256 bytes on the stack) | |
| 706 | 706 | */ | |
| 707 | 707 | ext_backlight_caps = (struct dm_acpi_atif_backlight_caps *) | |
| 708 | - | (kzalloc_obj(struct dm_acpi_atif_backlight_caps)); | |
| 708 | + | (kzalloc(sizeof(struct dm_acpi_atif_backlight_caps), | |
| 709 | + | GFP_KERNEL)); | |
| 709 | 710 | ||
| 710 | 711 | if (ext_backlight_caps == NULL) | |
| 711 | 712 | return; | |
modified drivers/gpu/drm/amd/pm/amdgpu_dpm.c
| @@ -348,8 +348,7 @@ int amdgpu_dpm_switch_power_profile(struct amdgpu_device *adev, | |||
| 348 | 348 | const struct amd_pm_funcs *pp_funcs = adev->powerplay.pp_funcs; | |
| 349 | 349 | int ret = 0; | |
| 350 | 350 | ||
| 351 | - | if (amdgpu_sriov_vf(adev) || | |
| 352 | - | amdgpu_in_reset(adev)) | |
| 351 | + | if (amdgpu_sriov_vf(adev)) | |
| 353 | 352 | return 0; | |
| 354 | 353 | ||
| 355 | 354 | if (pp_funcs && pp_funcs->switch_power_profile) { | |
| @@ -368,8 +367,7 @@ int amdgpu_dpm_pause_power_profile(struct amdgpu_device *adev, | |||
| 368 | 367 | const struct amd_pm_funcs *pp_funcs = adev->powerplay.pp_funcs; | |
| 369 | 368 | int ret = 0; | |
| 370 | 369 | ||
| 371 | - | if (amdgpu_sriov_vf(adev) || | |
| 372 | - | amdgpu_in_reset(adev)) | |
| 370 | + | if (amdgpu_sriov_vf(adev)) | |
| 373 | 371 | return 0; | |
| 374 | 372 | ||
| 375 | 373 | if (pp_funcs && pp_funcs->pause_power_profile) { | |
modified drivers/gpu/drm/amd/pm/legacy-dpm/si_dpm.c
| @@ -5263,8 +5263,7 @@ static int si_init_smc_table(struct amdgpu_device *adev) | |||
| 5263 | 5263 | break; | |
| 5264 | 5264 | } | |
| 5265 | 5265 | ||
| 5266 | - | if ((adev->flags & AMD_IS_MOBILITY) && | |
| 5267 | - | (adev->pm.dpm.platform_caps & ATOM_PP_PLATFORM_CAP_HARDWAREDC)) | |
| 5266 | + | if (adev->pm.dpm.platform_caps & ATOM_PP_PLATFORM_CAP_HARDWAREDC) | |
| 5268 | 5267 | table->systemFlags |= PPSMC_SYSTEMFLAG_GPIO_DC; | |
| 5269 | 5268 | ||
| 5270 | 5269 | if (adev->pm.dpm.platform_caps & ATOM_PP_PLATFORM_CAP_REGULATOR_HOT) { | |
| @@ -7238,19 +7237,6 @@ static void si_parse_pplib_non_clock_info(struct amdgpu_device *adev, | |||
| 7238 | 7237 | adev->pm.dpm.uvd_ps = rps; | |
| 7239 | 7238 | } | |
| 7240 | 7239 | ||
| 7241 | - | static void si_update_limits(struct amdgpu_clock_and_voltage_limits *limits, | |
| 7242 | - | struct rv7xx_pl *pl) | |
| 7243 | - | { | |
| 7244 | - | if (pl->sclk > limits->sclk) | |
| 7245 | - | limits->sclk = pl->sclk; | |
| 7246 | - | if (pl->mclk > limits->mclk) | |
| 7247 | - | limits->mclk = pl->mclk; | |
| 7248 | - | if (pl->vddc > limits->vddc) | |
| 7249 | - | limits->vddc = pl->vddc; | |
| 7250 | - | if (pl->vddci > limits->vddci) | |
| 7251 | - | limits->vddci = pl->vddci; | |
| 7252 | - | } | |
| 7253 | - | ||
| 7254 | 7240 | static void si_parse_pplib_clock_info(struct amdgpu_device *adev, | |
| 7255 | 7241 | struct amdgpu_ps *rps, int index, | |
| 7256 | 7242 | union pplib_clock_info *clock_info) | |
| @@ -7259,6 +7245,7 @@ static void si_parse_pplib_clock_info(struct amdgpu_device *adev, | |||
| 7259 | 7245 | struct evergreen_power_info *eg_pi = evergreen_get_pi(adev); | |
| 7260 | 7246 | struct si_power_info *si_pi = si_get_pi(adev); | |
| 7261 | 7247 | struct si_ps *ps = si_get_ps(rps); | |
| 7248 | + | struct amdgpu_clock_and_voltage_limits *limits; | |
| 7262 | 7249 | u16 leakage_voltage; | |
| 7263 | 7250 | struct rv7xx_pl *pl = &ps->performance_levels[index]; | |
| 7264 | 7251 | int ret; | |
| @@ -7323,14 +7310,26 @@ static void si_parse_pplib_clock_info(struct amdgpu_device *adev, | |||
| 7323 | 7310 | * VBIOS can contain conflicting values between: | |
| 7324 | 7311 | * - the maximum allowed clocks and voltages on AC or DC | |
| 7325 | 7312 | * - the clocks and voltages in power states on AC or DC | |
| 7326 | - | * | |
| 7327 | - | * Assume that the AC limits are the maximum of all power states, | |
| 7328 | - | * and the DC limits are the maximum of battery power states. | |
| 7329 | 7313 | */ | |
| 7330 | - | si_update_limits(&adev->pm.dpm.dyn_state.max_clock_voltage_on_ac, pl); | |
| 7331 | 7314 | if ((rps->class & ATOM_PPLIB_CLASSIFICATION_UI_MASK) == | |
| 7315 | + | ATOM_PPLIB_CLASSIFICATION_UI_PERFORMANCE) | |
| 7316 | + | limits = &adev->pm.dpm.dyn_state.max_clock_voltage_on_ac; | |
| 7317 | + | else if ((rps->class & ATOM_PPLIB_CLASSIFICATION_UI_MASK) == | |
| 7332 | 7318 | ATOM_PPLIB_CLASSIFICATION_UI_BATTERY) | |
| 7333 | - | si_update_limits(&adev->pm.dpm.dyn_state.max_clock_voltage_on_dc, pl); | |
| 7319 | + | limits = &adev->pm.dpm.dyn_state.max_clock_voltage_on_dc; | |
| 7320 | + | else | |
| 7321 | + | limits = NULL; | |
| 7322 | + | ||
| 7323 | + | if (limits) { | |
| 7324 | + | if (pl->sclk > limits->sclk) | |
| 7325 | + | limits->sclk = pl->sclk; | |
| 7326 | + | if (pl->mclk > limits->mclk) | |
| 7327 | + | limits->mclk = pl->mclk; | |
| 7328 | + | if (pl->vddc > limits->vddc) | |
| 7329 | + | limits->vddc = pl->vddc; | |
| 7330 | + | if (pl->vddci > limits->vddci) | |
| 7331 | + | limits->vddci = pl->vddci; | |
| 7332 | + | } | |
| 7334 | 7333 | } | |
| 7335 | 7334 | ||
| 7336 | 7335 | union pplib_power_state { | |
modified drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_hwmgr.c
| @@ -2988,7 +2988,7 @@ static int smu7_init_voltage_dependency_on_display_clock_table(struct pp_hwmgr * | |||
| 2988 | 2988 | if (!amdgpu_device_ip_get_ip_block(hwmgr->adev, AMD_IP_BLOCK_TYPE_DCE)) | |
| 2989 | 2989 | return 0; | |
| 2990 | 2990 | ||
| 2991 | - | table = kzalloc_flex(*table, entries, 4); | |
| 2991 | + | table = kzalloc(struct_size(table, entries, 4), GFP_KERNEL); | |
| 2992 | 2992 | if (!table) | |
| 2993 | 2993 | return -ENOMEM; | |
| 2994 | 2994 | ||
modified drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
| @@ -2092,11 +2092,11 @@ static ssize_t smu_v13_0_0_get_gpu_metrics(struct smu_context *smu, | |||
| 2092 | 2092 | ||
| 2093 | 2093 | gpu_metrics->average_socket_power = metrics->AverageSocketPower; | |
| 2094 | 2094 | ||
| 2095 | - | if ((mp1_ver == IP_VERSION(13, 0, 0) && | |
| 2096 | - | (smu->smc_fw_version <= 0x004e1e00 || smu->smc_fw_version >= 0x004e8600)) || | |
| 2097 | - | (mp1_ver == IP_VERSION(13, 0, 10) && | |
| 2098 | - | smu->smc_fw_version <= 0x00500800)) | |
| 2095 | + | if ((mp1_ver == IP_VERSION(13, 0, 0) && smu->smc_fw_version <= 0x004e1e00) || | |
| 2096 | + | (mp1_ver == IP_VERSION(13, 0, 10) && smu->smc_fw_version <= 0x00500800)) | |
| 2099 | 2097 | gpu_metrics->energy_accumulator = metrics->EnergyAccumulator; | |
| 2098 | + | else | |
| 2099 | + | gpu_metrics->energy_accumulator = UINT_MAX; | |
| 2100 | 2100 | ||
| 2101 | 2101 | if (metrics->AverageGfxActivity <= SMU_13_0_0_BUSY_THRESHOLD) | |
| 2102 | 2102 | gpu_metrics->average_gfxclk_frequency = metrics->AverageGfxclkFrequencyPostDs; | |
modified drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c
| @@ -2097,8 +2097,8 @@ static ssize_t smu_v13_0_7_get_gpu_metrics(struct smu_context *smu, | |||
| 2097 | 2097 | metrics->Vcn1ActivityPercentage); | |
| 2098 | 2098 | ||
| 2099 | 2099 | gpu_metrics->average_socket_power = metrics->AverageSocketPower; | |
| 2100 | - | if (smu->smc_fw_version <= 0x00521400) | |
| 2101 | - | gpu_metrics->energy_accumulator = metrics->EnergyAccumulator; | |
| 2100 | + | gpu_metrics->energy_accumulator = smu->smc_fw_version <= 0x00521400 ? | |
| 2101 | + | metrics->EnergyAccumulator : UINT_MAX; | |
| 2102 | 2102 | ||
| 2103 | 2103 | if (metrics->AverageGfxActivity <= SMU_13_0_7_BUSY_THRESHOLD) | |
| 2104 | 2104 | gpu_metrics->average_gfxclk_frequency = metrics->AverageGfxclkFrequencyPostDs; | |
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/amd/pm/swsmu/smu15/smu_v15_0_8_ppt.c
| @@ -222,7 +222,7 @@ static int smu_v15_0_8_tables_init(struct smu_context *smu) | |||
| 222 | 222 | ||
| 223 | 223 | smu_table->metrics_time = 0; | |
| 224 | 224 | ||
| 225 | - | driver_pptable = kzalloc_obj(PPTable_t); | |
| 225 | + | driver_pptable = kzalloc(sizeof(PPTable_t), GFP_KERNEL); | |
| 226 | 226 | if (!driver_pptable) | |
| 227 | 227 | return -ENOMEM; | |
| 228 | 228 | ||
| @@ -1026,7 +1026,7 @@ static int smu_v15_0_8_fru_get_product_info(struct smu_context *smu, | |||
| 1026 | 1026 | struct amdgpu_device *adev = smu->adev; | |
| 1027 | 1027 | ||
| 1028 | 1028 | if (!adev->fru_info) { | |
| 1029 | - | adev->fru_info = kzalloc_obj(*adev->fru_info); | |
| 1029 | + | adev->fru_info = kzalloc(sizeof(*adev->fru_info), GFP_KERNEL); | |
| 1030 | 1030 | if (!adev->fru_info) | |
| 1031 | 1031 | return -ENOMEM; | |
| 1032 | 1032 | } | |
modified drivers/gpu/drm/amd/ras/core/cmd.c
| @@ -222,7 +222,7 @@ static int ras_cmd_get_cper_records(struct ras_core_context *ras_core, | |||
| 222 | 222 | if (!buffer) | |
| 223 | 223 | return RAS_CMD__ERROR_GENERIC; | |
| 224 | 224 | ||
| 225 | - | trace = kzalloc_objs(*trace, trace_count); | |
| 225 | + | trace = kcalloc(trace_count, sizeof(*trace), GFP_KERNEL); | |
| 226 | 226 | if (!trace) { | |
| 227 | 227 | ret = RAS_CMD__ERROR_GENERIC; | |
| 228 | 228 | goto out; | |
| @@ -316,7 +316,7 @@ static int ras_cmd_get_batch_trace_records(struct ras_core_context *ras_core, | |||
| 316 | 316 | (input_data->start_batch_id >= overview.last_batch_id)) | |
| 317 | 317 | return RAS_CMD__ERROR_INVALID_INPUT_SIZE; | |
| 318 | 318 | ||
| 319 | - | trace_arry = kzalloc_objs(*trace_arry, trace_count); | |
| 319 | + | trace_arry = kcalloc(trace_count, sizeof(*trace_arry), GFP_KERNEL); | |
| 320 | 320 | if (!trace_arry) | |
| 321 | 321 | return RAS_CMD__ERROR_GENERIC; | |
| 322 | 322 | ||
modified drivers/gpu/drm/aspeed/aspeed_gfx_drv.c
| @@ -189,12 +189,13 @@ static int aspeed_gfx_load(struct drm_device *drm) | |||
| 189 | 189 | } | |
| 190 | 190 | reset_control_deassert(priv->rst); | |
| 191 | 191 | ||
| 192 | - | priv->clk = devm_clk_get_enabled(drm->dev, NULL); | |
| 192 | + | priv->clk = devm_clk_get(drm->dev, NULL); | |
| 193 | 193 | if (IS_ERR(priv->clk)) { | |
| 194 | 194 | dev_err(&pdev->dev, | |
| 195 | - | "failed to get and enable clock\n"); | |
| 195 | + | "missing or invalid clk device tree entry"); | |
| 196 | 196 | return PTR_ERR(priv->clk); | |
| 197 | 197 | } | |
| 198 | + | clk_prepare_enable(priv->clk); | |
| 198 | 199 | ||
| 199 | 200 | /* Sanitize control registers */ | |
| 200 | 201 | writel(0, priv->base + CRT_CTRL1); | |
modified drivers/gpu/drm/ast/ast_cursor.c
| @@ -25,7 +25,6 @@ | |||
| 25 | 25 | #include <linux/sizes.h> | |
| 26 | 26 | ||
| 27 | 27 | #include <drm/drm_atomic.h> | |
| 28 | - | #include <drm/drm_blend.h> | |
| 29 | 28 | #include <drm/drm_damage_helper.h> | |
| 30 | 29 | #include <drm/drm_format_helper.h> | |
| 31 | 30 | #include <drm/drm_gem_atomic_helper.h> | |
| @@ -356,8 +355,6 @@ int ast_cursor_plane_init(struct ast_device *ast) | |||
| 356 | 355 | } | |
| 357 | 356 | drm_plane_helper_add(cursor_plane, &ast_cursor_plane_helper_funcs); | |
| 358 | 357 | drm_plane_enable_fb_damage_clips(cursor_plane); | |
| 359 | - | drm_plane_create_blend_mode_property(cursor_plane, | |
| 360 | - | BIT(DRM_MODE_BLEND_COVERAGE)); | |
| 361 | 358 | ||
| 362 | 359 | return 0; | |
| 363 | 360 | } | |
modified drivers/gpu/drm/bridge/samsung-dsim.c
| @@ -1862,7 +1862,7 @@ static int samsung_dsim_register_te_irq(struct samsung_dsim *dsi, struct device | |||
| 1862 | 1862 | int te_gpio_irq; | |
| 1863 | 1863 | int ret; | |
| 1864 | 1864 | ||
| 1865 | - | dsi->te_gpio = gpiod_get_optional(dev, "te", GPIOD_IN); | |
| 1865 | + | dsi->te_gpio = devm_gpiod_get_optional(dev, "te", GPIOD_IN); | |
| 1866 | 1866 | if (!dsi->te_gpio) | |
| 1867 | 1867 | return 0; | |
| 1868 | 1868 | else if (IS_ERR(dsi->te_gpio)) | |
modified drivers/gpu/drm/bridge/tc358768.c
| @@ -1263,13 +1263,10 @@ tc358768_atomic_get_input_bus_fmts(struct drm_bridge *bridge, | |||
| 1263 | 1263 | return input_fmts; | |
| 1264 | 1264 | } | |
| 1265 | 1265 | ||
| 1266 | - | static int tc358768_bridge_atomic_check(struct drm_bridge *bridge, | |
| 1267 | - | struct drm_bridge_state *bridge_state, | |
| 1268 | - | struct drm_crtc_state *crtc_state, | |
| 1269 | - | struct drm_connector_state *conn_state) | |
| 1266 | + | static bool tc358768_mode_fixup(struct drm_bridge *bridge, | |
| 1267 | + | const struct drm_display_mode *mode, | |
| 1268 | + | struct drm_display_mode *adjusted_mode) | |
| 1270 | 1269 | { | |
| 1271 | - | struct drm_display_mode *adjusted_mode = &crtc_state->adjusted_mode; | |
| 1272 | - | ||
| 1273 | 1270 | /* Default to positive sync */ | |
| 1274 | 1271 | ||
| 1275 | 1272 | if (!(adjusted_mode->flags & | |
| @@ -1280,15 +1277,13 @@ static int tc358768_bridge_atomic_check(struct drm_bridge *bridge, | |||
| 1280 | 1277 | (DRM_MODE_FLAG_PVSYNC | DRM_MODE_FLAG_NVSYNC))) | |
| 1281 | 1278 | adjusted_mode->flags |= DRM_MODE_FLAG_PVSYNC; | |
| 1282 | 1279 | ||
| 1283 | - | bridge_state->input_bus_cfg.flags = bridge->timings->input_bus_flags; | |
| 1284 | - | ||
| 1285 | - | return 0; | |
| 1280 | + | return true; | |
| 1286 | 1281 | } | |
| 1287 | 1282 | ||
| 1288 | 1283 | static const struct drm_bridge_funcs tc358768_bridge_funcs = { | |
| 1289 | 1284 | .attach = tc358768_bridge_attach, | |
| 1290 | 1285 | .mode_valid = tc358768_bridge_mode_valid, | |
| 1291 | - | .atomic_check = tc358768_bridge_atomic_check, | |
| 1286 | + | .mode_fixup = tc358768_mode_fixup, | |
| 1292 | 1287 | .atomic_pre_enable = tc358768_bridge_atomic_pre_enable, | |
| 1293 | 1288 | .atomic_enable = tc358768_bridge_atomic_enable, | |
| 1294 | 1289 | .atomic_disable = tc358768_bridge_atomic_disable, | |
modified drivers/gpu/drm/bridge/th1520-dw-hdmi.c
| @@ -135,8 +135,8 @@ static int th1520_dw_hdmi_probe(struct platform_device *pdev) | |||
| 135 | 135 | plat_data->priv_data = hdmi; | |
| 136 | 136 | ||
| 137 | 137 | hdmi->dw_hdmi = dw_hdmi_probe(pdev, plat_data); | |
| 138 | - | if (IS_ERR(hdmi->dw_hdmi)) | |
| 139 | - | return PTR_ERR(hdmi->dw_hdmi); | |
| 138 | + | if (IS_ERR(hdmi)) | |
| 139 | + | return PTR_ERR(hdmi); | |
| 140 | 140 | ||
| 141 | 141 | platform_set_drvdata(pdev, hdmi); | |
| 142 | 142 | ||
| @@ -145,9 +145,9 @@ static int th1520_dw_hdmi_probe(struct platform_device *pdev) | |||
| 145 | 145 | ||
| 146 | 146 | static void th1520_dw_hdmi_remove(struct platform_device *pdev) | |
| 147 | 147 | { | |
| 148 | - | struct th1520_hdmi *hdmi = platform_get_drvdata(pdev); | |
| 148 | + | struct dw_hdmi *hdmi = platform_get_drvdata(pdev); | |
| 149 | 149 | ||
| 150 | - | dw_hdmi_remove(hdmi->dw_hdmi); | |
| 150 | + | dw_hdmi_remove(hdmi); | |
| 151 | 151 | } | |
| 152 | 152 | ||
| 153 | 153 | static const struct of_device_id th1520_dw_hdmi_of_table[] = { | |
modified drivers/gpu/drm/bridge/ti-sn65dsi83.c
| @@ -403,7 +403,7 @@ retry: | |||
| 403 | 403 | drm_modeset_drop_locks(&ctx); | |
| 404 | 404 | drm_modeset_acquire_fini(&ctx); | |
| 405 | 405 | ||
| 406 | - | return err; | |
| 406 | + | return 0; | |
| 407 | 407 | } | |
| 408 | 408 | ||
| 409 | 409 | static void sn65dsi83_reset_work(struct work_struct *ws) | |
| @@ -419,13 +419,11 @@ static void sn65dsi83_reset_work(struct work_struct *ws) | |||
| 419 | 419 | ret = sn65dsi83_reset_pipe(ctx); | |
| 420 | 420 | if (ret) { | |
| 421 | 421 | dev_err(ctx->dev, "reset pipe failed %pe\n", ERR_PTR(ret)); | |
| 422 | - | goto bridge_exit; | |
| 422 | + | return; | |
| 423 | 423 | } | |
| 424 | - | ||
| 425 | 424 | if (ctx->irq) | |
| 426 | 425 | enable_irq(ctx->irq); | |
| 427 | 426 | ||
| 428 | - | bridge_exit: | |
| 429 | 427 | drm_bridge_exit(idx); | |
| 430 | 428 | } | |
| 431 | 429 | ||
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/clients/drm_fbdev_client.c
| @@ -42,14 +42,6 @@ static int drm_fbdev_client_restore(struct drm_client_dev *client, bool force) | |||
| 42 | 42 | { | |
| 43 | 43 | struct drm_fb_helper *fb_helper = drm_fb_helper_from_client(client); | |
| 44 | 44 | ||
| 45 | - | /* | |
| 46 | - | * The client is registered before the initial fbdev probe. | |
| 47 | - | * If probing failed, the client remains registered but there | |
| 48 | - | * is no valid fbdev framebuffer to restore. | |
| 49 | - | */ | |
| 50 | - | if (!fb_helper->info || !fb_helper->fb) | |
| 51 | - | return 0; | |
| 52 | - | ||
| 53 | 45 | drm_fb_helper_restore_fbdev_mode_unlocked(fb_helper, force); | |
| 54 | 46 | ||
| 55 | 47 | return 0; | |
modified drivers/gpu/drm/display/drm_dp_helper.c
| @@ -4634,9 +4634,7 @@ static int dp_aux_backlight_update_status(struct backlight_device *bd) | |||
| 4634 | 4634 | ||
| 4635 | 4635 | if (!backlight_is_blank(bd)) { | |
| 4636 | 4636 | if (!bl->enabled) { | |
| 4637 | - | ret = drm_edp_backlight_enable(bl->aux, &bl->info, brightness); | |
| 4638 | - | if (ret) | |
| 4639 | - | return ret; | |
| 4637 | + | drm_edp_backlight_enable(bl->aux, &bl->info, brightness); | |
| 4640 | 4638 | bl->enabled = true; | |
| 4641 | 4639 | return 0; | |
| 4642 | 4640 | } | |
modified drivers/gpu/drm/drm_atomic_state_helper.c
| @@ -278,14 +278,7 @@ void __drm_atomic_helper_plane_state_init(struct drm_plane_state *plane_state, | |||
| 278 | 278 | plane_state->rotation = DRM_MODE_ROTATE_0; | |
| 279 | 279 | ||
| 280 | 280 | plane_state->alpha = DRM_BLEND_ALPHA_OPAQUE; | |
| 281 | - | ||
| 282 | 281 | plane_state->pixel_blend_mode = DRM_MODE_BLEND_PREMULTI; | |
| 283 | - | if (plane->blend_mode_property) { | |
| 284 | - | if (!drm_object_property_get_default_value(&plane->base, | |
| 285 | - | plane->blend_mode_property, | |
| 286 | - | &val)) | |
| 287 | - | plane_state->pixel_blend_mode = val; | |
| 288 | - | } | |
| 289 | 282 | ||
| 290 | 283 | if (plane->color_encoding_property) { | |
| 291 | 284 | if (!drm_object_property_get_default_value(&plane->base, | |
modified drivers/gpu/drm/drm_atomic_uapi.c
| @@ -1449,6 +1449,9 @@ static int prepare_signaling(struct drm_device *dev, | |||
| 1449 | 1449 | if (arg->flags & DRM_MODE_PAGE_FLIP_EVENT) { | |
| 1450 | 1450 | struct drm_pending_vblank_event *e = crtc_state->event; | |
| 1451 | 1451 | ||
| 1452 | + | if (!file_priv) | |
| 1453 | + | continue; | |
| 1454 | + | ||
| 1452 | 1455 | ret = drm_event_reserve_init(dev, file_priv, &e->base, | |
| 1453 | 1456 | &e->event.base); | |
| 1454 | 1457 | if (ret) { | |
| @@ -1462,12 +1465,10 @@ static int prepare_signaling(struct drm_device *dev, | |||
| 1462 | 1465 | struct dma_fence *fence; | |
| 1463 | 1466 | struct drm_out_fence_state *f; | |
| 1464 | 1467 | ||
| 1465 | - | ret = -ENOMEM; | |
| 1466 | - | ||
| 1467 | 1468 | f = krealloc(*fence_state, sizeof(**fence_state) * | |
| 1468 | 1469 | (*num_fences + 1), GFP_KERNEL); | |
| 1469 | 1470 | if (!f) | |
| 1470 | - | goto err_free_event; | |
| 1471 | + | return -ENOMEM; | |
| 1471 | 1472 | ||
| 1472 | 1473 | memset(&f[*num_fences], 0, sizeof(*f)); | |
| 1473 | 1474 | ||
| @@ -1476,12 +1477,12 @@ static int prepare_signaling(struct drm_device *dev, | |||
| 1476 | 1477 | ||
| 1477 | 1478 | fence = drm_crtc_create_fence(crtc); | |
| 1478 | 1479 | if (!fence) | |
| 1479 | - | goto err_free_event; | |
| 1480 | + | return -ENOMEM; | |
| 1480 | 1481 | ||
| 1481 | 1482 | ret = setup_out_fence(&f[(*num_fences)++], fence); | |
| 1482 | 1483 | if (ret) { | |
| 1483 | 1484 | dma_fence_put(fence); | |
| 1484 | - | goto err_free_event; | |
| 1485 | + | return ret; | |
| 1485 | 1486 | } | |
| 1486 | 1487 | ||
| 1487 | 1488 | crtc_state->event->base.fence = fence; | |
| @@ -1537,11 +1538,6 @@ static int prepare_signaling(struct drm_device *dev, | |||
| 1537 | 1538 | } | |
| 1538 | 1539 | ||
| 1539 | 1540 | return 0; | |
| 1540 | - | ||
| 1541 | - | err_free_event: | |
| 1542 | - | drm_event_cancel_free(dev, &crtc_state->event->base); | |
| 1543 | - | crtc_state->event = NULL; | |
| 1544 | - | return ret; | |
| 1545 | 1541 | } | |
| 1546 | 1542 | ||
| 1547 | 1543 | static void complete_signaling(struct drm_device *dev, | |
| @@ -1571,8 +1567,6 @@ static void complete_signaling(struct drm_device *dev, | |||
| 1571 | 1567 | * to prevent a double free in drm_atomic_commit_clear. | |
| 1572 | 1568 | */ | |
| 1573 | 1569 | if (event && (event->base.fence || event->base.file_priv)) { | |
| 1574 | - | if (crtc_state->commit && crtc_state->commit->abort_completion) | |
| 1575 | - | drm_crtc_commit_put(crtc_state->commit); | |
| 1576 | 1570 | drm_event_cancel_free(dev, &event->base); | |
| 1577 | 1571 | crtc_state->event = NULL; | |
| 1578 | 1572 | } | |
modified drivers/gpu/drm/drm_bridge.c
| @@ -454,10 +454,8 @@ void drm_bridge_add(struct drm_bridge *bridge) | |||
| 454 | 454 | * in bridge_lingering_list. Remove it or bridge_lingering_list will be | |
| 455 | 455 | * corrupted when adding this bridge to bridge_list below. | |
| 456 | 456 | */ | |
| 457 | - | mutex_lock(&bridge_lock); | |
| 458 | 457 | if (!list_empty(&bridge->list)) | |
| 459 | 458 | list_del_init(&bridge->list); | |
| 460 | - | mutex_unlock(&bridge_lock); | |
| 461 | 459 | ||
| 462 | 460 | mutex_init(&bridge->hpd_state_mutex); | |
| 463 | 461 | mutex_init(&bridge->hpd_mutex); | |
| @@ -595,10 +593,8 @@ int drm_bridge_attach(struct drm_encoder *encoder, struct drm_bridge *bridge, | |||
| 595 | 593 | if (!bridge->container) | |
| 596 | 594 | DRM_WARN("DRM bridge corrupted or not allocated by devm_drm_bridge_alloc()\n"); | |
| 597 | 595 | ||
| 598 | - | scoped_guard(mutex, &bridge_lock) { | |
| 599 | - | if (list_empty(&bridge->list)) | |
| 600 | - | DRM_WARN("Missing drm_bridge_add() before attach\n"); | |
| 601 | - | } | |
| 596 | + | if (list_empty(&bridge->list)) | |
| 597 | + | DRM_WARN("Missing drm_bridge_add() before attach\n"); | |
| 602 | 598 | ||
| 603 | 599 | drm_bridge_get(bridge); | |
| 604 | 600 | ||
modified drivers/gpu/drm/drm_exec.c
| @@ -79,7 +79,7 @@ void drm_exec_init(struct drm_exec *exec, u32 flags, unsigned nr) | |||
| 79 | 79 | nr = PAGE_SIZE / sizeof(void *); | |
| 80 | 80 | ||
| 81 | 81 | exec->flags = flags; | |
| 82 | - | exec->objects = kvmalloc_objs(*exec->objects, nr); | |
| 82 | + | exec->objects = kvmalloc_objs(*exec->objects, nr, GFP_KERNEL); | |
| 83 | 83 | ||
| 84 | 84 | /* If allocation here fails, just delay that till the first use */ | |
| 85 | 85 | exec->max_objects = exec->objects ? nr : 0; | |
| @@ -322,19 +322,6 @@ int drm_exec_prepare_array(struct drm_exec *exec, | |||
| 322 | 322 | { | |
| 323 | 323 | int ret; | |
| 324 | 324 | ||
| 325 | - | /* | |
| 326 | - | * Make sure to lock a contended object even when no objects are | |
| 327 | - | * given, otherwise drm_exec_retry_on_contention() would loop | |
| 328 | - | * forever on patterns like: | |
| 329 | - | * | |
| 330 | - | * ret = drm_exec_prepare_array(exec, objs, num_objects, ...); | |
| 331 | - | * drm_exec_retry_on_contention(exec); | |
| 332 | - | * | |
| 333 | - | * with num_objects == 0. | |
| 334 | - | */ | |
| 335 | - | if (!num_objects) | |
| 336 | - | return drm_exec_lock_contended(exec); | |
| 337 | - | ||
| 338 | 325 | for (unsigned int i = 0; i < num_objects; ++i) { | |
| 339 | 326 | ret = drm_exec_prepare_obj(exec, objects[i], num_fences); | |
| 340 | 327 | if (unlikely(ret)) | |
modified drivers/gpu/drm/drm_fb_helper.c
| @@ -1724,10 +1724,10 @@ __drm_fb_helper_initial_config_and_unlock(struct drm_fb_helper *fb_helper) | |||
| 1724 | 1724 | ||
| 1725 | 1725 | ret = drm_fb_helper_single_fb_probe(fb_helper); | |
| 1726 | 1726 | if (ret < 0) { | |
| 1727 | - | /* modesets are probed but fb_helper->fb isn't; defer restore too */ | |
| 1728 | - | fb_helper->deferred_setup = true; | |
| 1729 | - | if (ret == -EAGAIN) | |
| 1727 | + | if (ret == -EAGAIN) { | |
| 1728 | + | fb_helper->deferred_setup = true; | |
| 1730 | 1729 | ret = 0; | |
| 1730 | + | } | |
| 1731 | 1731 | mutex_unlock(&fb_helper->lock); | |
| 1732 | 1732 | ||
| 1733 | 1733 | goto err_drm_fb_helper_release_info; | |
modified drivers/gpu/drm/drm_pagemap.c
| @@ -383,58 +383,6 @@ next: | |||
| 383 | 383 | return 0; | |
| 384 | 384 | } | |
| 385 | 385 | ||
| 386 | - | /** | |
| 387 | - | * drm_pagemap_migrate_populate_src_pages() - Populate the source page array | |
| 388 | - | * @pages: Array of source pages to populate | |
| 389 | - | * @src_mpfn: Source array of migrate PFNs | |
| 390 | - | * @dst_mpfn: Destination array of migrate PFNs | |
| 391 | - | * @npages: Number of pages in the arrays | |
| 392 | - | * | |
| 393 | - | * Populate @pages with the device pages the copy callback is to read from. | |
| 394 | - | * | |
| 395 | - | * Entries are normally only populated at the head of each source folio, with | |
| 396 | - | * the copy callback deriving the rest of the folio from the order recorded in | |
| 397 | - | * the corresponding drm_pagemap_addr. That does not work where | |
| 398 | - | * drm_pagemap_migrate_populate_ram_pfn() had to demote a higher-order source | |
| 399 | - | * folio to order-0 destination folios: the drm_pagemap_addr entries are then | |
| 400 | - | * per-page, and the copy callback needs a source page for each of them. | |
| 401 | - | * Populate every entry for those ranges. | |
| 402 | - | * | |
| 403 | - | * Note that the source folio itself is only split later, by | |
| 404 | - | * migrate_vma_pages() / migrate_device_pages(), so its order cannot be used to | |
| 405 | - | * detect the demotion - the destination has to be inspected instead. | |
| 406 | - | */ | |
| 407 | - | static void drm_pagemap_migrate_populate_src_pages(struct page **pages, | |
| 408 | - | unsigned long *src_mpfn, | |
| 409 | - | unsigned long *dst_mpfn, | |
| 410 | - | unsigned long npages) | |
| 411 | - | { | |
| 412 | - | unsigned long i; | |
| 413 | - | ||
| 414 | - | for (i = 0; i < npages;) { | |
| 415 | - | struct page *page = migrate_pfn_to_page(src_mpfn[i]); | |
| 416 | - | unsigned int order = 0; | |
| 417 | - | unsigned long j, nr; | |
| 418 | - | ||
| 419 | - | if (!page) { | |
| 420 | - | i++; | |
| 421 | - | continue; | |
| 422 | - | } | |
| 423 | - | ||
| 424 | - | order = folio_order(page_folio(page)); | |
| 425 | - | nr = NR_PAGES(order); | |
| 426 | - | ||
| 427 | - | if (order && !(dst_mpfn[i] & MIGRATE_PFN_COMPOUND)) { | |
| 428 | - | for (j = 0; j < nr && i + j < npages; j++) | |
| 429 | - | pages[i + j] = folio_page(page_folio(page), j); | |
| 430 | - | } else { | |
| 431 | - | pages[i] = page; | |
| 432 | - | } | |
| 433 | - | ||
| 434 | - | i += nr; | |
| 435 | - | } | |
| 436 | - | } | |
| 437 | - | ||
| 438 | 386 | /** | |
| 439 | 387 | * drm_pagemap_migrate_unmap_pages() - Unmap pages previously mapped for GPU SVM migration | |
| 440 | 388 | * @dev: The device for which the pages were mapped | |
| @@ -927,7 +875,6 @@ static int drm_pagemap_migrate_populate_ram_pfn(struct vm_area_struct *vas, | |||
| 927 | 875 | struct page *page = NULL, *src_page; | |
| 928 | 876 | struct folio *folio; | |
| 929 | 877 | unsigned int order = 0; | |
| 930 | - | gfp_t gfp = GFP_HIGHUSER; | |
| 931 | 878 | ||
| 932 | 879 | if (!(src_mpfn[i] & MIGRATE_PFN_MIGRATE)) | |
| 933 | 880 | goto next; | |
| @@ -944,51 +891,11 @@ static int drm_pagemap_migrate_populate_ram_pfn(struct vm_area_struct *vas, | |||
| 944 | 891 | ||
| 945 | 892 | order = folio_order(page_folio(src_page)); | |
| 946 | 893 | ||
| 947 | - | /* | |
| 948 | - | * A large source folio is always collected whole, at its head | |
| 949 | - | * page, PMD aligned and flagged MIGRATE_PFN_COMPOUND: anything | |
| 950 | - | * else is split before it reaches us, either by | |
| 951 | - | * migrate_vma_collect_pmd() or, for the eviction path, by | |
| 952 | - | * migrate_device_pfns(). Both the order-0 fallback below and | |
| 953 | - | * drm_pagemap_migrate_populate_src_pages() rely on that, as | |
| 954 | - | * they index the folio from @i. | |
| 955 | - | */ | |
| 956 | - | WARN_ON_ONCE(order && | |
| 957 | - | (src_page != folio_page(page_folio(src_page), 0) || | |
| 958 | - | !(src_mpfn[i] & MIGRATE_PFN_COMPOUND))); | |
| 959 | - | ||
| 960 | - | if (order) | |
| 961 | - | gfp |= __GFP_NOWARN; | |
| 962 | - | ||
| 894 | + | /* TODO: Support fallback to single pages if THP allocation fails */ | |
| 963 | 895 | if (vas) | |
| 964 | - | folio = vma_alloc_folio(gfp, order, vas, addr); | |
| 896 | + | folio = vma_alloc_folio(GFP_HIGHUSER, order, vas, addr); | |
| 965 | 897 | else | |
| 966 | - | folio = folio_alloc(gfp, order); | |
| 967 | - | ||
| 968 | - | if (!folio && order) { | |
| 969 | - | /* | |
| 970 | - | * Higher-order allocation failed, fall back to | |
| 971 | - | * order-0 allocations for the entire range covered | |
| 972 | - | * by the original higher-order allocation, without | |
| 973 | - | * setting MIGRATE_PFN_COMPOUND, until we move past | |
| 974 | - | * that range. | |
| 975 | - | */ | |
| 976 | - | unsigned long nr = NR_PAGES(order); | |
| 977 | - | unsigned long j; | |
| 978 | - | ||
| 979 | - | gfp &= ~__GFP_NOWARN; | |
| 980 | - | for (j = 0; j < nr && i < npages; j++, i++, addr += PAGE_SIZE) { | |
| 981 | - | folio = vas ? | |
| 982 | - | vma_alloc_folio(gfp, 0, vas, addr) : | |
| 983 | - | folio_alloc(gfp, 0); | |
| 984 | - | if (!folio) | |
| 985 | - | goto free_pages; | |
| 986 | - | ||
| 987 | - | page = folio_page(folio, 0); | |
| 988 | - | mpfn[i] = migrate_pfn(page_to_pfn(page)); | |
| 989 | - | } | |
| 990 | - | continue; | |
| 991 | - | } | |
| 898 | + | folio = folio_alloc(GFP_HIGHUSER, order); | |
| 992 | 899 | ||
| 993 | 900 | if (!folio) | |
| 994 | 901 | goto free_pages; | |
| @@ -1033,11 +940,11 @@ free_pages: | |||
| 1033 | 940 | if (!page) | |
| 1034 | 941 | goto next_put; | |
| 1035 | 942 | ||
| 1036 | - | order = folio_order(page_folio(page)); | |
| 1037 | - | ||
| 1038 | 943 | put_page(page); | |
| 1039 | 944 | mpfn[i] = 0; | |
| 1040 | 945 | ||
| 946 | + | order = folio_order(page_folio(page)); | |
| 947 | + | ||
| 1041 | 948 | next_put: | |
| 1042 | 949 | i += NR_PAGES(order); | |
| 1043 | 950 | } | |
| @@ -1195,117 +1102,12 @@ void drm_pagemap_put(struct drm_pagemap *dpagemap) | |||
| 1195 | 1102 | } | |
| 1196 | 1103 | EXPORT_SYMBOL(drm_pagemap_put); | |
| 1197 | 1104 | ||
| 1198 | - | /** | |
| 1199 | - | * drm_pagemap_page_get_flags() - Read flags from a device-private folio | |
| 1200 | - | * @page: Pointer to a page of the device-private folio | |
| 1201 | - | * | |
| 1202 | - | * Return: The DRM_PAGEMAP_ZDD_FLAG_* bits encoded in zone_device_data. | |
| 1203 | - | */ | |
| 1204 | - | static unsigned long drm_pagemap_page_get_flags(struct page *page) | |
| 1205 | - | { | |
| 1206 | - | struct folio *folio = page_folio(page); | |
| 1207 | - | ||
| 1208 | - | return (unsigned long)folio_zone_device_data(folio) & | |
| 1209 | - | DRM_PAGEMAP_ZDD_FLAG_MASK; | |
| 1210 | - | } | |
| 1211 | - | ||
| 1212 | - | /** | |
| 1213 | - | * drm_pagemap_page_set_flags() - Set flags on a device-private folio | |
| 1214 | - | * @page: Pointer to a page of the device-private folio | |
| 1215 | - | * @flags: DRM_PAGEMAP_ZDD_FLAG_* bits to set | |
| 1216 | - | * | |
| 1217 | - | * Preserve any flags already encoded alongside the ZDD pointer. | |
| 1218 | - | */ | |
| 1219 | - | static void drm_pagemap_page_set_flags(struct page *page, | |
| 1220 | - | unsigned long flags) | |
| 1221 | - | { | |
| 1222 | - | struct folio *folio = page_folio(page); | |
| 1223 | - | unsigned long old; | |
| 1224 | - | ||
| 1225 | - | if (WARN_ON_ONCE(flags & ~DRM_PAGEMAP_ZDD_FLAG_MASK)) | |
| 1226 | - | return; | |
| 1227 | - | ||
| 1228 | - | old = (unsigned long)folio_zone_device_data(folio); | |
| 1229 | - | folio_set_zone_device_data(folio, (void *)(old | flags)); | |
| 1230 | - | } | |
| 1231 | - | ||
| 1232 | - | /** | |
| 1233 | - | * drm_pagemap_retire_migrated_pages() - Record migrated device-private folios | |
| 1234 | - | * @src_pfns: source array after migrate_vma_pages() or migrate_device_pages() | |
| 1235 | - | * @npages: number of entries in @src_pfns | |
| 1236 | - | * | |
| 1237 | - | * Flag device-private folios successfully migrated to RAM before finalize | |
| 1238 | - | * unlocks the sources. The migrated state is stored in the physical folio, so | |
| 1239 | - | * it survives later folio splits and subsequent migrations can skip it. | |
| 1240 | - | */ | |
| 1241 | - | static void drm_pagemap_retire_migrated_pages(unsigned long *src_pfns, | |
| 1242 | - | unsigned long npages) | |
| 1243 | - | { | |
| 1244 | - | unsigned long i = 0; | |
| 1245 | - | ||
| 1246 | - | while (i < npages) { | |
| 1247 | - | struct page *page = migrate_pfn_to_page(src_pfns[i]); | |
| 1248 | - | unsigned long nr = 1; | |
| 1249 | - | ||
| 1250 | - | if (!page) { | |
| 1251 | - | i++; | |
| 1252 | - | continue; | |
| 1253 | - | } | |
| 1254 | - | ||
| 1255 | - | if (src_pfns[i] & MIGRATE_PFN_COMPOUND) | |
| 1256 | - | nr = folio_nr_pages(page_folio(page)); | |
| 1257 | - | ||
| 1258 | - | if ((src_pfns[i] & MIGRATE_PFN_MIGRATE) && | |
| 1259 | - | is_device_private_page(page)) | |
| 1260 | - | drm_pagemap_page_set_flags(page, | |
| 1261 | - | DRM_PAGEMAP_ZDD_FLAG_MIGRATED); | |
| 1262 | - | ||
| 1263 | - | i += nr; | |
| 1264 | - | } | |
| 1265 | - | } | |
| 1266 | - | ||
| 1267 | - | /** | |
| 1268 | - | * drm_pagemap_skip_retired_pages() - Skip retired device-private folios | |
| 1269 | - | * @src_pfns: MIGRATE_PFN-encoded source array | |
| 1270 | - | * @npages: number of entries in @src_pfns | |
| 1271 | - | * | |
| 1272 | - | * Skip source folios already migrated to RAM, identified by the migrated flag | |
| 1273 | - | * stored in the physical folio's zone_device_data. | |
| 1274 | - | */ | |
| 1275 | - | static void drm_pagemap_skip_retired_pages(unsigned long *src_pfns, | |
| 1276 | - | unsigned long npages) | |
| 1277 | - | { | |
| 1278 | - | unsigned long i = 0; | |
| 1279 | - | ||
| 1280 | - | while (i < npages) { | |
| 1281 | - | struct page *page = migrate_pfn_to_page(src_pfns[i]); | |
| 1282 | - | unsigned long nr = 1; | |
| 1283 | - | ||
| 1284 | - | if (!page) { | |
| 1285 | - | i++; | |
| 1286 | - | continue; | |
| 1287 | - | } | |
| 1288 | - | ||
| 1289 | - | if (src_pfns[i] & MIGRATE_PFN_COMPOUND) | |
| 1290 | - | nr = folio_nr_pages(page_folio(page)); | |
| 1291 | - | ||
| 1292 | - | if ((src_pfns[i] & MIGRATE_PFN_MIGRATE) && | |
| 1293 | - | is_device_private_page(page) && | |
| 1294 | - | (drm_pagemap_page_get_flags(page) & | |
| 1295 | - | DRM_PAGEMAP_ZDD_FLAG_MIGRATED)) | |
| 1296 | - | src_pfns[i] &= ~MIGRATE_PFN_MIGRATE; | |
| 1297 | - | ||
| 1298 | - | i += nr; | |
| 1299 | - | } | |
| 1300 | - | } | |
| 1301 | - | ||
| 1302 | 1105 | /** | |
| 1303 | 1106 | * drm_pagemap_evict_to_ram() - Evict GPU SVM range to RAM | |
| 1304 | 1107 | * @devmem_allocation: Pointer to the device memory allocation | |
| 1305 | 1108 | * | |
| 1306 | - | * Similar to __drm_pagemap_migrate_to_ram(), but uses the | |
| 1307 | - | * migrate_device_* helpers and does not require the mmap lock. | |
| 1308 | - | * Device-private PFNs already migrated to RAM by either path are skipped. | |
| 1109 | + | * Similar to __drm_pagemap_migrate_to_ram but does not require mmap lock and | |
| 1110 | + | * migration done via migrate_device_* functions. | |
| 1309 | 1111 | * | |
| 1310 | 1112 | * Return: 0 on success, negative error code on failure. | |
| 1311 | 1113 | */ | |
| @@ -1313,18 +1115,17 @@ int drm_pagemap_evict_to_ram(struct drm_pagemap_devmem *devmem_allocation) | |||
| 1313 | 1115 | { | |
| 1314 | 1116 | const struct drm_pagemap_devmem_ops *ops = devmem_allocation->ops; | |
| 1315 | 1117 | struct drm_pagemap_iova_state state = {}; | |
| 1316 | - | unsigned long npages, mpages; | |
| 1118 | + | unsigned long npages, mpages = 0; | |
| 1317 | 1119 | struct page **pages; | |
| 1318 | 1120 | unsigned long *src, *dst; | |
| 1319 | 1121 | struct drm_pagemap_addr *pagemap_addr; | |
| 1320 | 1122 | void *buf; | |
| 1321 | - | int err = 0; | |
| 1123 | + | int i, err = 0; | |
| 1322 | 1124 | unsigned int retry_count = 2; | |
| 1323 | 1125 | ||
| 1324 | 1126 | npages = devmem_allocation->size >> PAGE_SHIFT; | |
| 1325 | 1127 | ||
| 1326 | 1128 | retry: | |
| 1327 | - | mpages = 0; | |
| 1328 | 1129 | if (!mmget_not_zero(devmem_allocation->mm)) | |
| 1329 | 1130 | return -EFAULT; | |
| 1330 | 1131 | ||
| @@ -1347,8 +1148,6 @@ retry: | |||
| 1347 | 1148 | if (err) | |
| 1348 | 1149 | goto err_free; | |
| 1349 | 1150 | ||
| 1350 | - | drm_pagemap_skip_retired_pages(src, npages); | |
| 1351 | - | ||
| 1352 | 1151 | err = drm_pagemap_migrate_populate_ram_pfn(NULL, NULL, npages, &mpages, | |
| 1353 | 1152 | src, dst, 0); | |
| 1354 | 1153 | if (err || !mpages) | |
| @@ -1361,20 +1160,27 @@ retry: | |||
| 1361 | 1160 | if (err) | |
| 1362 | 1161 | goto err_finalize; | |
| 1363 | 1162 | ||
| 1364 | - | drm_pagemap_migrate_populate_src_pages(pages, src, dst, npages); | |
| 1163 | + | for (i = 0; i < npages;) { | |
| 1164 | + | unsigned int order = 0; | |
| 1165 | + | ||
| 1166 | + | pages[i] = migrate_pfn_to_page(src[i]); | |
| 1167 | + | if (pages[i]) | |
| 1168 | + | order = folio_order(page_folio(pages[i])); | |
| 1169 | + | ||
| 1170 | + | i += NR_PAGES(order); | |
| 1171 | + | } | |
| 1365 | 1172 | ||
| 1366 | 1173 | err = ops->copy_to_ram(pages, pagemap_addr, npages, NULL); | |
| 1367 | 1174 | if (err) | |
| 1368 | 1175 | goto err_finalize; | |
| 1369 | 1176 | ||
| 1370 | 1177 | err_finalize: | |
| 1371 | - | drm_pagemap_migrate_unmap_pages(devmem_allocation->dev, pagemap_addr, dst, npages, | |
| 1372 | - | DMA_FROM_DEVICE, &state); | |
| 1373 | 1178 | if (err) | |
| 1374 | 1179 | drm_pagemap_migration_unlock_put_pages(npages, dst); | |
| 1375 | 1180 | migrate_device_pages(src, dst, npages); | |
| 1376 | - | drm_pagemap_retire_migrated_pages(src, npages); | |
| 1377 | 1181 | migrate_device_finalize(src, dst, npages); | |
| 1182 | + | drm_pagemap_migrate_unmap_pages(devmem_allocation->dev, pagemap_addr, dst, npages, | |
| 1183 | + | DMA_FROM_DEVICE, &state); | |
| 1378 | 1184 | ||
| 1379 | 1185 | err_free: | |
| 1380 | 1186 | kvfree(buf); | |
| @@ -1429,7 +1235,7 @@ static int __drm_pagemap_migrate_to_ram(struct vm_area_struct *vas, | |||
| 1429 | 1235 | struct drm_pagemap_addr *pagemap_addr; | |
| 1430 | 1236 | unsigned long start, end; | |
| 1431 | 1237 | void *buf; | |
| 1432 | - | int err = 0; | |
| 1238 | + | int i, err = 0; | |
| 1433 | 1239 | ||
| 1434 | 1240 | zdd = drm_pagemap_page_zone_device_data(page); | |
| 1435 | 1241 | if (time_before64(get_jiffies_64(), zdd->devmem_allocation->timeslice_expiration)) | |
| @@ -1469,15 +1275,13 @@ static int __drm_pagemap_migrate_to_ram(struct vm_area_struct *vas, | |||
| 1469 | 1275 | if (!migrate.cpages) | |
| 1470 | 1276 | goto err_free; | |
| 1471 | 1277 | ||
| 1472 | - | drm_pagemap_skip_retired_pages(migrate.src, npages); | |
| 1473 | - | ||
| 1474 | 1278 | ops = zdd->devmem_allocation->ops; | |
| 1475 | 1279 | dev = zdd->devmem_allocation->dev; | |
| 1476 | 1280 | ||
| 1477 | 1281 | err = drm_pagemap_migrate_populate_ram_pfn(vas, page, npages, &mpages, | |
| 1478 | 1282 | migrate.src, migrate.dst, | |
| 1479 | 1283 | start); | |
| 1480 | - | if (err || !mpages) | |
| 1284 | + | if (err) | |
| 1481 | 1285 | goto err_finalize; | |
| 1482 | 1286 | ||
| 1483 | 1287 | err = drm_pagemap_migrate_map_system_pages(dev, pagemap_addr, | |
| @@ -1486,23 +1290,29 @@ static int __drm_pagemap_migrate_to_ram(struct vm_area_struct *vas, | |||
| 1486 | 1290 | if (err) | |
| 1487 | 1291 | goto err_finalize; | |
| 1488 | 1292 | ||
| 1489 | - | drm_pagemap_migrate_populate_src_pages(pages, migrate.src, migrate.dst, | |
| 1490 | - | npages); | |
| 1293 | + | for (i = 0; i < npages;) { | |
| 1294 | + | unsigned int order = 0; | |
| 1295 | + | ||
| 1296 | + | pages[i] = migrate_pfn_to_page(migrate.src[i]); | |
| 1297 | + | if (pages[i]) | |
| 1298 | + | order = folio_order(page_folio(pages[i])); | |
| 1299 | + | ||
| 1300 | + | i += NR_PAGES(order); | |
| 1301 | + | } | |
| 1491 | 1302 | ||
| 1492 | 1303 | err = ops->copy_to_ram(pages, pagemap_addr, npages, NULL); | |
| 1493 | 1304 | if (err) | |
| 1494 | 1305 | goto err_finalize; | |
| 1495 | 1306 | ||
| 1496 | 1307 | err_finalize: | |
| 1497 | - | if (dev) | |
| 1498 | - | drm_pagemap_migrate_unmap_pages(dev, pagemap_addr, migrate.dst, | |
| 1499 | - | npages, DMA_FROM_DEVICE, | |
| 1500 | - | &state); | |
| 1501 | 1308 | if (err) | |
| 1502 | 1309 | drm_pagemap_migration_unlock_put_pages(npages, migrate.dst); | |
| 1503 | 1310 | migrate_vma_pages(&migrate); | |
| 1504 | - | drm_pagemap_retire_migrated_pages(migrate.src, npages); | |
| 1505 | 1311 | migrate_vma_finalize(&migrate); | |
| 1312 | + | if (dev) | |
| 1313 | + | drm_pagemap_migrate_unmap_pages(dev, pagemap_addr, migrate.dst, | |
| 1314 | + | npages, DMA_FROM_DEVICE, | |
| 1315 | + | &state); | |
| 1506 | 1316 | err_free: | |
| 1507 | 1317 | kvfree(buf); | |
| 1508 | 1318 | err_out: | |
| @@ -1550,19 +1360,13 @@ static vm_fault_t drm_pagemap_migrate_to_ram(struct vm_fault *vmf) | |||
| 1550 | 1360 | static void drm_pagemap_folio_split(struct folio *orig_folio, struct folio *new_folio) | |
| 1551 | 1361 | { | |
| 1552 | 1362 | struct drm_pagemap_zdd *zdd; | |
| 1553 | - | unsigned long orig_data, new_data; | |
| 1554 | 1363 | ||
| 1555 | 1364 | if (!new_folio) | |
| 1556 | 1365 | return; | |
| 1557 | 1366 | ||
| 1558 | 1367 | new_folio->pgmap = orig_folio->pgmap; | |
| 1559 | - | ||
| 1560 | - | orig_data = (unsigned long)folio_zone_device_data(orig_folio); | |
| 1561 | - | zdd = (struct drm_pagemap_zdd *)(orig_data & ~DRM_PAGEMAP_ZDD_FLAG_MASK); | |
| 1562 | - | ||
| 1563 | - | new_data = (unsigned long)drm_pagemap_zdd_get(zdd); | |
| 1564 | - | new_data |= orig_data & DRM_PAGEMAP_ZDD_FLAG_MASK; | |
| 1565 | - | folio_set_zone_device_data(new_folio, (void *)new_data); | |
| 1368 | + | zdd = folio_zone_device_data(orig_folio); | |
| 1369 | + | folio_set_zone_device_data(new_folio, drm_pagemap_zdd_get(zdd)); | |
| 1566 | 1370 | } | |
| 1567 | 1371 | ||
| 1568 | 1372 | static const struct dev_pagemap_ops drm_pagemap_pagemap_ops = { | |
modified drivers/gpu/drm/drm_panic_qr.rs
| @@ -407,8 +407,8 @@ impl DecFifo { | |||
| 407 | 407 | for i in (0..self.len).rev() { | |
| 408 | 408 | self.decimals[i + len] = self.decimals[i]; | |
| 409 | 409 | } | |
| 410 | - | for decimal in &mut self.decimals[..len] { | |
| 411 | - | *decimal = (chunk % 10) as u8; | |
| 410 | + | for i in 0..len { | |
| 411 | + | self.decimals[i] = (chunk % 10) as u8; | |
| 412 | 412 | chunk = div10(chunk); | |
| 413 | 413 | } | |
| 414 | 414 | self.len += len; | |
modified drivers/gpu/drm/drm_prime.c
| @@ -524,7 +524,7 @@ int drm_gem_prime_handle_to_fd(struct drm_device *dev, | |||
| 524 | 524 | return PTR_ERR(dmabuf); | |
| 525 | 525 | } | |
| 526 | 526 | ||
| 527 | - | dma_buf_fd_install(dmabuf, fd); | |
| 527 | + | fd_install(fd, dmabuf->file); | |
| 528 | 528 | *prime_fd = fd; | |
| 529 | 529 | return 0; | |
| 530 | 530 | } | |
modified drivers/gpu/drm/drm_syncobj.c
| @@ -1619,7 +1619,7 @@ drm_syncobj_timeline_signal_ioctl(struct drm_device *dev, void *data, | |||
| 1619 | 1619 | goto err_points; | |
| 1620 | 1620 | } | |
| 1621 | 1621 | ||
| 1622 | - | chains = kmalloc_objs(*chains, args->count_handles); | |
| 1622 | + | chains = kmalloc_objs(*chains, args->count_handles, GFP_KERNEL); | |
| 1623 | 1623 | if (!chains) { | |
| 1624 | 1624 | ret = -ENOMEM; | |
| 1625 | 1625 | goto err_points; | |
modified drivers/gpu/drm/gud/gud_connector.c
| @@ -396,16 +396,8 @@ static int gud_connector_add_tv_mode(struct gud_device *gdrm, struct drm_connect | |||
| 396 | 396 | } | |
| 397 | 397 | ||
| 398 | 398 | num_modes = ret / GUD_CONNECTOR_TV_MODE_NAME_LEN; | |
| 399 | - | for (i = 0; i < num_modes; i++) { | |
| 400 | - | char *mode = &buf[i * GUD_CONNECTOR_TV_MODE_NAME_LEN]; | |
| 401 | - | ||
| 402 | - | if (!memchr(mode, '\0', GUD_CONNECTOR_TV_MODE_NAME_LEN)) { | |
| 403 | - | ret = -EIO; | |
| 404 | - | goto free; | |
| 405 | - | } | |
| 406 | - | ||
| 407 | - | modes[i] = mode; | |
| 408 | - | } | |
| 399 | + | for (i = 0; i < num_modes; i++) | |
| 400 | + | modes[i] = &buf[i * GUD_CONNECTOR_TV_MODE_NAME_LEN]; | |
| 409 | 401 | ||
| 410 | 402 | ret = drm_mode_create_tv_properties_legacy(connector->dev, num_modes, modes); | |
| 411 | 403 | free: | |
modified drivers/gpu/drm/gud/gud_drv.c
| @@ -289,8 +289,6 @@ static int gud_plane_add_properties(struct gud_device *gdrm) | |||
| 289 | 289 | * but mask out any additions on future devices. | |
| 290 | 290 | */ | |
| 291 | 291 | val &= GUD_ROTATION_MASK; | |
| 292 | - | if (!(val & GUD_ROTATION_0)) | |
| 293 | - | continue; | |
| 294 | 292 | ret = drm_plane_create_rotation_property(&gdrm->plane, | |
| 295 | 293 | DRM_MODE_ROTATE_0, val); | |
| 296 | 294 | break; | |
modified drivers/gpu/drm/gud/gud_pipe.c
| @@ -482,9 +482,6 @@ int gud_plane_atomic_check(struct drm_plane *plane, | |||
| 482 | 482 | if (!new_plane_state->visible) | |
| 483 | 483 | return 0; | |
| 484 | 484 | ||
| 485 | - | if (gdrm->flags & GUD_DISPLAY_FLAG_FULL_UPDATE) | |
| 486 | - | new_plane_state->ignore_damage_clips = true; | |
| 487 | - | ||
| 488 | 485 | if (old_plane_state->rotation != new_plane_state->rotation) | |
| 489 | 486 | crtc_state->mode_changed = true; | |
| 490 | 487 | ||
| @@ -507,7 +504,6 @@ int gud_plane_atomic_check(struct drm_plane *plane, | |||
| 507 | 504 | for_each_new_connector_in_state(state, connector, connector_state, i) { | |
| 508 | 505 | if (connector_state->crtc) | |
| 509 | 506 | break; | |
| 510 | - | connector_state = NULL; | |
| 511 | 507 | } | |
| 512 | 508 | ||
| 513 | 509 | /* | |
| @@ -566,8 +562,8 @@ int gud_plane_atomic_check(struct drm_plane *plane, | |||
| 566 | 562 | goto out; | |
| 567 | 563 | } | |
| 568 | 564 | ||
| 569 | - | req->properties[num_properties].prop = cpu_to_le16(prop); | |
| 570 | - | req->properties[num_properties].val = cpu_to_le64(val); | |
| 565 | + | req->properties[num_properties + i].prop = cpu_to_le16(prop); | |
| 566 | + | req->properties[num_properties + i].val = cpu_to_le64(val); | |
| 571 | 567 | num_properties++; | |
| 572 | 568 | } | |
| 573 | 569 | ||
modified drivers/gpu/drm/i915/display/intel_cdclk.c
| @@ -2381,10 +2381,8 @@ static void bxt_sanitize_cdclk(struct intel_display *display) | |||
| 2381 | 2381 | * dividers both syncing to an active pipe, or asynchronously | |
| 2382 | 2382 | * (PIPE_NONE). | |
| 2383 | 2383 | */ | |
| 2384 | - | if (DISPLAY_VER(display) < 30) { | |
| 2385 | - | cdctl &= ~bxt_cdclk_cd2x_pipe_mask(display); | |
| 2386 | - | cdctl |= bxt_cdclk_cd2x_pipe(display, INVALID_PIPE); | |
| 2387 | - | } | |
| 2384 | + | cdctl &= ~bxt_cdclk_cd2x_pipe_mask(display); | |
| 2385 | + | cdctl |= bxt_cdclk_cd2x_pipe(display, INVALID_PIPE); | |
| 2388 | 2386 | ||
| 2389 | 2387 | if (cdctl != expected) { | |
| 2390 | 2388 | if (DISPLAY_VER(display) < 20) { | |
| @@ -2715,8 +2713,8 @@ static void intel_set_cdclk(struct intel_display *display, | |||
| 2715 | 2713 | } | |
| 2716 | 2714 | } | |
| 2717 | 2715 | ||
| 2718 | - | static int dg2_power_well_count(struct intel_display *display, | |
| 2719 | - | const struct intel_cdclk_state *cdclk_state) | |
| 2716 | + | static bool dg2_power_well_count(struct intel_display *display, | |
| 2717 | + | const struct intel_cdclk_state *cdclk_state) | |
| 2720 | 2718 | { | |
| 2721 | 2719 | return display->platform.dg2 ? hweight8(cdclk_state->active_pipes) : 0; | |
| 2722 | 2720 | } | |
modified drivers/gpu/drm/i915/display/intel_cursor.c
| @@ -536,8 +536,7 @@ static void i9xx_cursor_disable_sel_fetch_arm(struct intel_dsb *dsb, | |||
| 536 | 536 | struct intel_display *display = to_intel_display(plane); | |
| 537 | 537 | enum pipe pipe = plane->pipe; | |
| 538 | 538 | ||
| 539 | - | if (!crtc_state->enable_psr2_sel_fetch && | |
| 540 | - | !crtc_state->clear_psr2_sel_fetch) | |
| 539 | + | if (!crtc_state->enable_psr2_sel_fetch) | |
| 541 | 540 | return; | |
| 542 | 541 | ||
| 543 | 542 | intel_de_write_dsb(display, dsb, SEL_FETCH_CUR_CTL(pipe), 0); | |
| @@ -570,10 +569,8 @@ static void i9xx_cursor_update_sel_fetch_arm(struct intel_dsb *dsb, | |||
| 570 | 569 | struct intel_display *display = to_intel_display(plane); | |
| 571 | 570 | enum pipe pipe = plane->pipe; | |
| 572 | 571 | ||
| 573 | - | if (!crtc_state->enable_psr2_sel_fetch) { | |
| 574 | - | i9xx_cursor_disable_sel_fetch_arm(dsb, plane, crtc_state); | |
| 572 | + | if (!crtc_state->enable_psr2_sel_fetch) | |
| 575 | 573 | return; | |
| 576 | - | } | |
| 577 | 574 | ||
| 578 | 575 | if (drm_rect_height(&plane_state->psr2_sel_fetch_area) > 0) { | |
| 579 | 576 | if (crtc_state->enable_psr2_su_region_et) { | |
modified drivers/gpu/drm/i915/display/intel_cx0_phy.c
| @@ -3233,8 +3233,7 @@ static void intel_cx0pll_enable(struct intel_encoder *encoder, | |||
| 3233 | 3233 | * 8. Program DDI_CLK_VALFREQ to match intended DDI | |
| 3234 | 3234 | * clock frequency. | |
| 3235 | 3235 | */ | |
| 3236 | - | intel_de_write(display, DDI_CLK_VALFREQ(encoder->port), | |
| 3237 | - | intel_ddi_link_symbol_clock(encoder, port_clock)); | |
| 3236 | + | intel_de_write(display, DDI_CLK_VALFREQ(encoder->port), port_clock); | |
| 3238 | 3237 | ||
| 3239 | 3238 | /* | |
| 3240 | 3239 | * 9. Set PORT_CLOCK_CTL register PCLK PLL Request | |
| @@ -3407,7 +3406,7 @@ void intel_mtl_tbt_pll_enable_clock(struct intel_encoder *encoder, int port_cloc | |||
| 3407 | 3406 | * clock frequency. | |
| 3408 | 3407 | */ | |
| 3409 | 3408 | intel_de_write(display, DDI_CLK_VALFREQ(encoder->port), | |
| 3410 | - | intel_ddi_link_symbol_clock(encoder, port_clock)); | |
| 3409 | + | port_clock); | |
| 3411 | 3410 | } | |
| 3412 | 3411 | ||
| 3413 | 3412 | void intel_mtl_pll_enable(struct intel_encoder *encoder, | |
modified drivers/gpu/drm/i915/display/intel_ddi.c
| @@ -1529,17 +1529,6 @@ int intel_ddi_level(struct intel_encoder *encoder, | |||
| 1529 | 1529 | return level; | |
| 1530 | 1530 | } | |
| 1531 | 1531 | ||
| 1532 | - | int intel_ddi_link_symbol_clock(struct intel_encoder *encoder, int clock) | |
| 1533 | - | { | |
| 1534 | - | if (intel_encoder_is_dp(encoder)) | |
| 1535 | - | return intel_dp_link_symbol_clock(clock); | |
| 1536 | - | ||
| 1537 | - | if (intel_hdmi_is_frl(clock)) | |
| 1538 | - | return DIV_ROUND_CLOSEST(clock * 10, 18); | |
| 1539 | - | ||
| 1540 | - | return clock; | |
| 1541 | - | } | |
| 1542 | - | ||
| 1543 | 1532 | static void | |
| 1544 | 1533 | hsw_set_signal_levels(struct intel_encoder *encoder, | |
| 1545 | 1534 | const struct intel_crtc_state *crtc_state) | |
modified drivers/gpu/drm/i915/display/intel_ddi.h
| @@ -81,7 +81,6 @@ void intel_ddi_sanitize_encoder_pll_mapping(struct intel_encoder *encoder); | |||
| 81 | 81 | int intel_ddi_level(struct intel_encoder *encoder, | |
| 82 | 82 | const struct intel_crtc_state *crtc_state, | |
| 83 | 83 | int lane); | |
| 84 | - | int intel_ddi_link_symbol_clock(struct intel_encoder *encoder, int clock); | |
| 85 | 84 | void intel_ddi_update_active_dpll(struct intel_atomic_state *state, | |
| 86 | 85 | struct intel_encoder *encoder, | |
| 87 | 86 | struct intel_crtc *crtc); | |
modified drivers/gpu/drm/i915/display/intel_display_params.c
| @@ -120,10 +120,6 @@ intel_display_param_named_unsafe(enable_psr, int, 0400, | |||
| 120 | 120 | "(0=disabled, 1=enable up to PSR1, 2=enable up to PSR2) " | |
| 121 | 121 | "Default: -1 (use per-chip default)"); | |
| 122 | 122 | ||
| 123 | - | intel_display_param_named_unsafe(enable_dc_balance, bool, 0400, | |
| 124 | - | "Enable VRR DC balance (0=disabled, 1=enabled). " | |
| 125 | - | "Default: 0 (disabled)"); | |
| 126 | - | ||
| 127 | 123 | intel_display_param_named_unsafe(enable_panel_replay, int, 0400, | |
| 128 | 124 | "Enable Panel Replay (0=disabled, 1=enabled). Default: -1 (use per-chip default)"); | |
| 129 | 125 | ||
modified drivers/gpu/drm/i915/display/intel_display_params.h
| @@ -46,7 +46,6 @@ struct drm_printer; | |||
| 46 | 46 | param(bool, enable_dp_mst, true, 0600) \ | |
| 47 | 47 | param(int, enable_fbc, -1, 0600) \ | |
| 48 | 48 | param(int, enable_psr, -1, 0600) \ | |
| 49 | - | param(bool, enable_dc_balance, false, 0600) \ | |
| 50 | 49 | param(int, enable_panel_replay, -1, 0600) \ | |
| 51 | 50 | param(bool, psr_safest_params, false, 0400) \ | |
| 52 | 51 | param(bool, enable_psr2_sel_fetch, true, 0400) \ | |
modified drivers/gpu/drm/i915/display/intel_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; | |
| @@ -1948,8 +1946,6 @@ struct intel_dp { | |||
| 1948 | 1946 | ||
| 1949 | 1947 | bool colorimetry_support; | |
| 1950 | 1948 | ||
| 1951 | - | bool sst_split_sdp_support; | |
| 1952 | - | ||
| 1953 | 1949 | struct { | |
| 1954 | 1950 | enum transcoder transcoder; | |
| 1955 | 1951 | struct mutex lock; | |
modified drivers/gpu/drm/i915/display/intel_dp.c
| @@ -3409,22 +3409,12 @@ intel_dp_audio_compute_config(struct intel_encoder *encoder, | |||
| 3409 | 3409 | struct intel_crtc_state *pipe_config, | |
| 3410 | 3410 | struct drm_connector_state *conn_state) | |
| 3411 | 3411 | { | |
| 3412 | - | struct intel_dp *intel_dp = enc_to_intel_dp(encoder); | |
| 3413 | - | ||
| 3414 | 3412 | pipe_config->has_audio = | |
| 3415 | 3413 | intel_dp_has_audio(encoder, conn_state) && | |
| 3416 | 3414 | intel_audio_compute_config(encoder, pipe_config, conn_state); | |
| 3417 | 3415 | ||
| 3418 | 3416 | pipe_config->sdp_split_enable = pipe_config->has_audio && | |
| 3419 | 3417 | intel_dp_is_uhbr(pipe_config); | |
| 3420 | - | ||
| 3421 | - | /* | |
| 3422 | - | * SDP splitting for UHBR audio requires explicit sink capability in | |
| 3423 | - | * SST mode, whereas in MST mode it is inherently supported. | |
| 3424 | - | */ | |
| 3425 | - | if (pipe_config->sdp_split_enable && | |
| 3426 | - | !intel_crtc_has_type(pipe_config, INTEL_OUTPUT_DP_MST)) | |
| 3427 | - | pipe_config->sdp_split_enable = intel_dp->sst_split_sdp_support; | |
| 3428 | 3418 | } | |
| 3429 | 3419 | ||
| 3430 | 3420 | void | |
| @@ -4472,25 +4462,16 @@ void intel_dp_configure_protocol_converter(struct intel_dp *intel_dp, | |||
| 4472 | 4462 | str_enable_disable(tmp)); | |
| 4473 | 4463 | } | |
| 4474 | 4464 | ||
| 4475 | - | static u8 intel_dp_read_dprx_feature_enum(struct intel_dp *intel_dp) | |
| 4465 | + | static bool intel_dp_get_colorimetry_status(struct intel_dp *intel_dp) | |
| 4476 | 4466 | { | |
| 4477 | 4467 | u8 dprx = 0; | |
| 4478 | 4468 | ||
| 4479 | - | drm_dp_dpcd_read_data(&intel_dp->aux, DP_DPRX_FEATURE_ENUMERATION_LIST, | |
| 4480 | - | &dprx, sizeof(dprx)); | |
| 4481 | - | return dprx; | |
| 4482 | - | } | |
| 4483 | - | ||
| 4484 | - | static bool intel_dp_get_colorimetry_status(u8 dprx) | |
| 4485 | - | { | |
| 4469 | + | if (drm_dp_dpcd_readb(&intel_dp->aux, DP_DPRX_FEATURE_ENUMERATION_LIST, | |
| 4470 | + | &dprx) != 1) | |
| 4471 | + | return false; | |
| 4486 | 4472 | return dprx & DP_VSC_SDP_EXT_FOR_COLORIMETRY_SUPPORTED; | |
| 4487 | 4473 | } | |
| 4488 | 4474 | ||
| 4489 | - | static bool intel_dp_get_sst_split_sdp_status(u8 dprx) | |
| 4490 | - | { | |
| 4491 | - | return dprx & DP_SST_SPLIT_SDP_CAP; | |
| 4492 | - | } | |
| 4493 | - | ||
| 4494 | 4475 | static int intel_dp_read_dsc_dpcd(struct drm_dp_aux *aux, | |
| 4495 | 4476 | u8 dsc_dpcd[DP_DSC_RECEIVER_CAP_SIZE]) | |
| 4496 | 4477 | { | |
| @@ -4790,7 +4771,6 @@ intel_edp_init_dpcd(struct intel_dp *intel_dp, struct intel_connector *connector | |||
| 4790 | 4771 | { | |
| 4791 | 4772 | struct intel_display *display = to_intel_display(intel_dp); | |
| 4792 | 4773 | int ret; | |
| 4793 | - | u8 dprx; | |
| 4794 | 4774 | ||
| 4795 | 4775 | /* this function is meant to be called only once */ | |
| 4796 | 4776 | drm_WARN_ON(display->drm, intel_dp->dpcd[DP_DPCD_REV] != 0); | |
| @@ -4802,13 +4782,8 @@ intel_edp_init_dpcd(struct intel_dp *intel_dp, struct intel_connector *connector | |||
| 4802 | 4782 | drm_dp_is_branch(intel_dp->dpcd)); | |
| 4803 | 4783 | intel_init_dpcd_quirks(intel_dp, &intel_dp->desc.ident); | |
| 4804 | 4784 | ||
| 4805 | - | dprx = intel_dp_read_dprx_feature_enum(intel_dp); | |
| 4806 | - | ||
| 4807 | 4785 | intel_dp->colorimetry_support = | |
| 4808 | - | intel_dp_get_colorimetry_status(dprx); | |
| 4809 | - | ||
| 4810 | - | intel_dp->sst_split_sdp_support = | |
| 4811 | - | intel_dp_get_sst_split_sdp_status(dprx); | |
| 4786 | + | intel_dp_get_colorimetry_status(intel_dp); | |
| 4812 | 4787 | ||
| 4813 | 4788 | /* | |
| 4814 | 4789 | * Read the eDP display control registers. | |
| @@ -4899,20 +4874,13 @@ intel_dp_get_dpcd(struct intel_dp *intel_dp) | |||
| 4899 | 4874 | * the OUI/ID since we know it won't change. | |
| 4900 | 4875 | */ | |
| 4901 | 4876 | if (!intel_dp_is_edp(intel_dp)) { | |
| 4902 | - | u8 dprx; | |
| 4903 | - | ||
| 4904 | 4877 | drm_dp_read_desc(&intel_dp->aux, &intel_dp->desc, | |
| 4905 | 4878 | drm_dp_is_branch(intel_dp->dpcd)); | |
| 4906 | 4879 | ||
| 4907 | 4880 | intel_init_dpcd_quirks(intel_dp, &intel_dp->desc.ident); | |
| 4908 | 4881 | ||
| 4909 | - | dprx = intel_dp_read_dprx_feature_enum(intel_dp); | |
| 4910 | - | ||
| 4911 | 4882 | intel_dp->colorimetry_support = | |
| 4912 | - | intel_dp_get_colorimetry_status(dprx); | |
| 4913 | - | ||
| 4914 | - | intel_dp->sst_split_sdp_support = | |
| 4915 | - | intel_dp_get_sst_split_sdp_status(dprx); | |
| 4883 | + | intel_dp_get_colorimetry_status(intel_dp); | |
| 4916 | 4884 | ||
| 4917 | 4885 | intel_dp_update_sink_caps(intel_dp); | |
| 4918 | 4886 | } | |
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
| @@ -761,6 +761,10 @@ static int mst_stream_compute_config(struct intel_atomic_state *state, | |||
| 761 | 761 | pipe_config->sink_format = INTEL_OUTPUT_FORMAT_RGB; | |
| 762 | 762 | pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB; | |
| 763 | 763 | ||
| 764 | + | ret = intel_pfit_compute_config(pipe_config, conn_state); | |
| 765 | + | if (ret) | |
| 766 | + | return ret; | |
| 767 | + | ||
| 764 | 768 | ret = intel_pfit_compute_config(pipe_config, conn_state); | |
| 765 | 769 | if (ret) | |
| 766 | 770 | return ret; | |
| @@ -852,8 +856,7 @@ static u8 get_pipes_downstream_of_mst_port(struct intel_atomic_state *state, | |||
| 852 | 856 | if (&connector->mst.dp->mst.mgr != mst_mgr) | |
| 853 | 857 | continue; | |
| 854 | 858 | ||
| 855 | - | if (parent_port && | |
| 856 | - | connector->mst.port != parent_port && | |
| 859 | + | if (connector->mst.port != parent_port && | |
| 857 | 860 | !drm_dp_mst_port_downstream_of_parent(mst_mgr, | |
| 858 | 861 | connector->mst.port, | |
| 859 | 862 | parent_port)) | |
| @@ -2168,27 +2171,6 @@ bool intel_dp_mst_crtc_needs_modeset(struct intel_atomic_state *state, | |||
| 2168 | 2171 | return false; | |
| 2169 | 2172 | } | |
| 2170 | 2173 | ||
| 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 | 2174 | /** | |
| 2193 | 2175 | * intel_dp_mst_prepare_probe - Prepare an MST link for topology probing | |
| 2194 | 2176 | * @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_lt_phy.c
| @@ -1976,8 +1976,7 @@ void intel_lt_phy_pll_enable(struct intel_encoder *encoder, | |||
| 1976 | 1976 | * Change. We handle this step in bxt_set_cdclk(). | |
| 1977 | 1977 | */ | |
| 1978 | 1978 | /* 10. Program DDI_CLK_VALFREQ to match intended DDI clock frequency. */ | |
| 1979 | - | intel_de_write(display, DDI_CLK_VALFREQ(encoder->port), | |
| 1980 | - | intel_ddi_link_symbol_clock(encoder, port_clock)); | |
| 1979 | + | intel_de_write(display, DDI_CLK_VALFREQ(encoder->port), port_clock); | |
| 1981 | 1980 | ||
| 1982 | 1981 | /* 11. Program PORT_CLOCK_CTL[PCLK PLL Request LN0] = 1. */ | |
| 1983 | 1982 | intel_de_rmw(display, XELPDP_PORT_CLOCK_CTL(display, port), | |
| @@ -2024,8 +2023,7 @@ void intel_lt_phy_pll_enable(struct intel_encoder *encoder, | |||
| 2024 | 2023 | lane_phy_pulse_status, | |
| 2025 | 2024 | lane_phy_pulse_status); | |
| 2026 | 2025 | } else { | |
| 2027 | - | intel_de_write(display, DDI_CLK_VALFREQ(encoder->port), | |
| 2028 | - | intel_ddi_link_symbol_clock(encoder, port_clock)); | |
| 2026 | + | intel_de_write(display, DDI_CLK_VALFREQ(encoder->port), port_clock); | |
| 2029 | 2027 | } | |
| 2030 | 2028 | ||
| 2031 | 2029 | /* | |
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/intel_vrr.c
| @@ -386,12 +386,10 @@ static bool intel_vrr_dc_balance_possible(const struct intel_crtc_state *crtc_st | |||
| 386 | 386 | static void | |
| 387 | 387 | intel_vrr_dc_balance_compute_config(struct intel_crtc_state *crtc_state) | |
| 388 | 388 | { | |
| 389 | - | struct intel_display *display = to_intel_display(crtc_state); | |
| 390 | 389 | int guardband_usec, adjustment_usec; | |
| 391 | 390 | struct drm_display_mode *adjusted_mode = &crtc_state->hw.adjusted_mode; | |
| 392 | 391 | ||
| 393 | - | if (!intel_vrr_dc_balance_possible(crtc_state) || | |
| 394 | - | !crtc_state->vrr.enable || !display->params.enable_dc_balance) | |
| 392 | + | if (!intel_vrr_dc_balance_possible(crtc_state) || !crtc_state->vrr.enable) | |
| 395 | 393 | return; | |
| 396 | 394 | ||
| 397 | 395 | crtc_state->vrr.dc_balance.vmax = crtc_state->vrr.vmax; | |
modified drivers/gpu/drm/i915/display/skl_universal_plane.c
| @@ -885,8 +885,7 @@ static void icl_plane_disable_sel_fetch_arm(struct intel_dsb *dsb, | |||
| 885 | 885 | struct intel_display *display = to_intel_display(plane); | |
| 886 | 886 | enum pipe pipe = plane->pipe; | |
| 887 | 887 | ||
| 888 | - | if (!crtc_state->enable_psr2_sel_fetch && | |
| 889 | - | !crtc_state->clear_psr2_sel_fetch) | |
| 888 | + | if (!crtc_state->enable_psr2_sel_fetch) | |
| 890 | 889 | return; | |
| 891 | 890 | ||
| 892 | 891 | intel_de_write_dsb(display, dsb, SEL_FETCH_PLANE_CTL(pipe, plane->id), 0); | |
| @@ -1635,8 +1634,10 @@ static void icl_plane_update_sel_fetch_arm(struct intel_dsb *dsb, | |||
| 1635 | 1634 | struct intel_display *display = to_intel_display(plane); | |
| 1636 | 1635 | enum pipe pipe = plane->pipe; | |
| 1637 | 1636 | ||
| 1638 | - | if (crtc_state->enable_psr2_sel_fetch && | |
| 1639 | - | drm_rect_height(&plane_state->psr2_sel_fetch_area) > 0) | |
| 1637 | + | if (!crtc_state->enable_psr2_sel_fetch) | |
| 1638 | + | return; | |
| 1639 | + | ||
| 1640 | + | if (drm_rect_height(&plane_state->psr2_sel_fetch_area) > 0) | |
| 1640 | 1641 | intel_de_write_dsb(display, dsb, SEL_FETCH_PLANE_CTL(pipe, plane->id), | |
| 1641 | 1642 | SEL_FETCH_PLANE_CTL_ENABLE); | |
| 1642 | 1643 | else | |
modified drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
| @@ -1766,7 +1766,6 @@ static int eb_reinit_userptr(struct i915_execbuffer *eb) | |||
| 1766 | 1766 | ||
| 1767 | 1767 | static noinline int eb_relocate_parse_slow(struct i915_execbuffer *eb) | |
| 1768 | 1768 | { | |
| 1769 | - | const unsigned int count = eb->buffer_count; | |
| 1770 | 1769 | bool have_copy = false; | |
| 1771 | 1770 | struct eb_vma *ev; | |
| 1772 | 1771 | int err = 0; | |
| @@ -1869,6 +1868,7 @@ err: | |||
| 1869 | 1868 | ||
| 1870 | 1869 | out: | |
| 1871 | 1870 | if (have_copy) { | |
| 1871 | + | const unsigned int count = eb->buffer_count; | |
| 1872 | 1872 | unsigned int i; | |
| 1873 | 1873 | ||
| 1874 | 1874 | for (i = 0; i < count; i++) { | |
modified drivers/gpu/drm/i915/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/i915/gt/intel_rps.c
| @@ -1904,8 +1904,7 @@ static void rps_work(struct work_struct *work) | |||
| 1904 | 1904 | ||
| 1905 | 1905 | out: | |
| 1906 | 1906 | spin_lock_irq(gt->irq_lock); | |
| 1907 | - | if (intel_rps_is_active(rps)) | |
| 1908 | - | gen6_gt_pm_unmask_irq(gt, rps->pm_events); | |
| 1907 | + | gen6_gt_pm_unmask_irq(gt, rps->pm_events); | |
| 1909 | 1908 | spin_unlock_irq(gt->irq_lock); | |
| 1910 | 1909 | } | |
| 1911 | 1910 | ||
modified drivers/gpu/drm/i915/i915_pci.c
| @@ -958,9 +958,6 @@ static int i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
| 958 | 958 | (struct intel_device_info *) ent->driver_data; | |
| 959 | 959 | int err; | |
| 960 | 960 | ||
| 961 | - | if (!intel_info) | |
| 962 | - | return -ENODEV; | |
| 963 | - | ||
| 964 | 961 | if (intel_info->require_force_probe && !id_forced(pdev->device)) { | |
| 965 | 962 | dev_info(&pdev->dev, | |
| 966 | 963 | "Your graphics device %04x is not properly supported by i915 in this\n" | |
modified drivers/gpu/drm/i915/i915_query.c
| @@ -403,10 +403,8 @@ static int query_perf_config_list(struct drm_i915_private *i915, | |||
| 403 | 403 | ids = krealloc(oa_config_ids, | |
| 404 | 404 | n_configs * sizeof(*oa_config_ids), | |
| 405 | 405 | GFP_KERNEL); | |
| 406 | - | if (!ids) { | |
| 407 | - | kfree(oa_config_ids); | |
| 406 | + | if (!ids) | |
| 408 | 407 | return -ENOMEM; | |
| 409 | - | } | |
| 410 | 408 | ||
| 411 | 409 | alloc = fetch_and_zero(&n_configs); | |
| 412 | 410 | ||
modified drivers/gpu/drm/imagination/pvr_free_list.c
| @@ -8,7 +8,6 @@ | |||
| 8 | 8 | #include "pvr_vm.h" | |
| 9 | 9 | ||
| 10 | 10 | #include <drm/drm_gem.h> | |
| 11 | - | #include <drm/drm_print.h> | |
| 12 | 11 | #include <linux/slab.h> | |
| 13 | 12 | #include <linux/xarray.h> | |
| 14 | 13 | #include <uapi/drm/pvr_drm.h> | |
| @@ -613,21 +612,13 @@ pvr_free_list_process_reconstruct_req(struct pvr_device *pvr_dev, | |||
| 613 | 612 | }; | |
| 614 | 613 | struct rogue_fwif_freelists_reconstruction_data *resp = | |
| 615 | 614 | &resp_cmd.cmd_data.free_lists_reconstruction_data; | |
| 616 | - | u32 count = min_t(u32, req->freelist_count, | |
| 617 | - | ARRAY_SIZE(req->freelist_ids)); | |
| 618 | 615 | ||
| 619 | - | if (count != req->freelist_count) { | |
| 620 | - | drm_warn_once(from_pvr_device(pvr_dev), | |
| 621 | - | "Requested reconstruction of %u freelists, limiting to %u\n", | |
| 622 | - | req->freelist_count, count); | |
| 623 | - | } | |
| 624 | - | ||
| 625 | - | for (u32 i = 0; i < count; i++) | |
| 616 | + | for (u32 i = 0; i < req->freelist_count; i++) | |
| 626 | 617 | pvr_free_list_reconstruct(pvr_dev, req->freelist_ids[i]); | |
| 627 | 618 | ||
| 628 | - | resp->freelist_count = count; | |
| 619 | + | resp->freelist_count = req->freelist_count; | |
| 629 | 620 | memcpy(resp->freelist_ids, req->freelist_ids, | |
| 630 | - | count * sizeof(resp->freelist_ids[0])); | |
| 621 | + | req->freelist_count * sizeof(resp->freelist_ids[0])); | |
| 631 | 622 | ||
| 632 | 623 | WARN_ON(pvr_kccb_send_cmd(pvr_dev, &resp_cmd, NULL)); | |
| 633 | 624 | } | |
modified drivers/gpu/drm/imagination/pvr_mmu.c
| @@ -12,7 +12,6 @@ | |||
| 12 | 12 | #include "pvr_rogue_mmu_defs.h" | |
| 13 | 13 | ||
| 14 | 14 | #include <drm/drm_drv.h> | |
| 15 | - | #include <drm/drm_print.h> | |
| 16 | 15 | #include <linux/atomic.h> | |
| 17 | 16 | #include <linux/bitops.h> | |
| 18 | 17 | #include <linux/dma-mapping.h> | |
| @@ -2336,8 +2335,7 @@ void pvr_mmu_op_context_destroy(struct pvr_mmu_op_context *op_ctx) | |||
| 2336 | 2335 | * pvr_mmu_op_context_create() - Create an MMU op context. | |
| 2337 | 2336 | * @ctx: MMU context associated with owning VM context. | |
| 2338 | 2337 | * @sgt: Scatter gather table containing pages pinned for use by this context. | |
| 2339 | - | * @device_addr: Virtual device address at the start of the requested mapping. | |
| 2340 | - | * @sgt_offset: Offset into @sgt of the start of the requested mapping. | |
| 2338 | + | * @sgt_offset: Start offset of the requested device-virtual memory mapping. | |
| 2341 | 2339 | * @size: Size in bytes of the requested device-virtual memory mapping. For an | |
| 2342 | 2340 | * unmapping, this should be zero so that no page tables are allocated. | |
| 2343 | 2341 | * | |
| @@ -2348,7 +2346,7 @@ void pvr_mmu_op_context_destroy(struct pvr_mmu_op_context *op_ctx) | |||
| 2348 | 2346 | */ | |
| 2349 | 2347 | struct pvr_mmu_op_context * | |
| 2350 | 2348 | pvr_mmu_op_context_create(struct pvr_mmu_context *ctx, struct sg_table *sgt, | |
| 2351 | - | u64 device_addr, u64 sgt_offset, u64 size) | |
| 2349 | + | u64 sgt_offset, u64 size) | |
| 2352 | 2350 | { | |
| 2353 | 2351 | int err; | |
| 2354 | 2352 | ||
| @@ -2364,18 +2362,18 @@ pvr_mmu_op_context_create(struct pvr_mmu_context *ctx, struct sg_table *sgt, | |||
| 2364 | 2362 | ||
| 2365 | 2363 | if (size) { | |
| 2366 | 2364 | /* | |
| 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. | |
| 2365 | + | * The number of page table objects we need to prealloc is | |
| 2366 | + | * indicated by the mapping size, start offset and the sizes | |
| 2367 | + | * of the areas mapped per PT or PD. The range calculation is | |
| 2368 | + | * identical to that for the index into a table for a device | |
| 2369 | + | * address, so we reuse those functions here. | |
| 2371 | 2370 | */ | |
| 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; | |
| 2371 | + | const u32 l1_start_idx = pvr_page_table_l2_idx(sgt_offset); | |
| 2372 | + | const u32 l1_end_idx = pvr_page_table_l2_idx(sgt_offset + size); | |
| 2373 | + | const u32 l1_count = l1_end_idx - l1_start_idx + 1; | |
| 2374 | + | const u32 l0_start_idx = pvr_page_table_l1_idx(sgt_offset); | |
| 2375 | + | const u32 l0_end_idx = pvr_page_table_l1_idx(sgt_offset + size); | |
| 2376 | + | const u32 l0_count = l0_end_idx - l0_start_idx + 1; | |
| 2379 | 2377 | ||
| 2380 | 2378 | /* | |
| 2381 | 2379 | * Alloc and push page table entries until we have enough of | |
| @@ -2555,9 +2553,7 @@ pvr_mmu_map_sgl(struct pvr_mmu_op_context *op_ctx, struct scatterlist *sgl, | |||
| 2555 | 2553 | ||
| 2556 | 2554 | err_destroy_pages: | |
| 2557 | 2555 | memcpy(&op_ctx->curr_page, &ptr_copy, sizeof(op_ctx->curr_page)); | |
| 2558 | - | if (pvr_mmu_op_context_unmap_curr_page(op_ctx, page)) | |
| 2559 | - | drm_err(from_pvr_device(op_ctx->mmu_ctx->pvr_dev), | |
| 2560 | - | "%s : Failure in unmapping pages\n", __func__); | |
| 2556 | + | err = pvr_mmu_op_context_unmap_curr_page(op_ctx, page); | |
| 2561 | 2557 | ||
| 2562 | 2558 | return err; | |
| 2563 | 2559 | } | |
modified drivers/gpu/drm/imagination/pvr_mmu.h
| @@ -99,7 +99,7 @@ dma_addr_t pvr_mmu_get_root_table_dma_addr(struct pvr_mmu_context *ctx); | |||
| 99 | 99 | void pvr_mmu_op_context_destroy(struct pvr_mmu_op_context *op_ctx); | |
| 100 | 100 | struct pvr_mmu_op_context * | |
| 101 | 101 | pvr_mmu_op_context_create(struct pvr_mmu_context *ctx, | |
| 102 | - | struct sg_table *sgt, u64 device_addr, u64 sgt_offset, u64 size); | |
| 102 | + | struct sg_table *sgt, u64 sgt_offset, u64 size); | |
| 103 | 103 | ||
| 104 | 104 | int pvr_mmu_map(struct pvr_mmu_op_context *op_ctx, u64 size, u64 flags, | |
| 105 | 105 | u64 device_addr); | |
modified drivers/gpu/drm/imagination/pvr_vm.c
| @@ -276,7 +276,7 @@ pvr_vm_bind_op_map_init(struct pvr_vm_bind_op *bind_op, | |||
| 276 | 276 | goto err_bind_op_fini; | |
| 277 | 277 | ||
| 278 | 278 | bind_op->mmu_op_ctx = | |
| 279 | - | pvr_mmu_op_context_create(vm_ctx->mmu_ctx, sgt, device_addr, offset, size); | |
| 279 | + | pvr_mmu_op_context_create(vm_ctx->mmu_ctx, sgt, offset, size); | |
| 280 | 280 | err = PTR_ERR_OR_ZERO(bind_op->mmu_op_ctx); | |
| 281 | 281 | if (err) { | |
| 282 | 282 | bind_op->mmu_op_ctx = NULL; | |
| @@ -318,7 +318,7 @@ pvr_vm_bind_op_unmap_init(struct pvr_vm_bind_op *bind_op, | |||
| 318 | 318 | } | |
| 319 | 319 | ||
| 320 | 320 | bind_op->mmu_op_ctx = | |
| 321 | - | pvr_mmu_op_context_create(vm_ctx->mmu_ctx, NULL, device_addr, 0, 0); | |
| 321 | + | pvr_mmu_op_context_create(vm_ctx->mmu_ctx, NULL, 0, 0); | |
| 322 | 322 | err = PTR_ERR_OR_ZERO(bind_op->mmu_op_ctx); | |
| 323 | 323 | if (err) { | |
| 324 | 324 | bind_op->mmu_op_ctx = NULL; | |
| @@ -418,8 +418,6 @@ pvr_vm_gpuva_unmap(struct drm_gpuva_op *op, void *op_ctx) | |||
| 418 | 418 | static int | |
| 419 | 419 | pvr_vm_gpuva_remap(struct drm_gpuva_op *op, void *op_ctx) | |
| 420 | 420 | { | |
| 421 | - | /* The split parts belong to the object of the mapping being split. */ | |
| 422 | - | struct drm_gpuvm_bo *vm_bo = op->remap.unmap->va->vm_bo; | |
| 423 | 421 | struct pvr_vm_bind_op *ctx = op_ctx; | |
| 424 | 422 | u64 va_start = 0, va_range = 0; | |
| 425 | 423 | int err; | |
| @@ -435,12 +433,14 @@ pvr_vm_gpuva_remap(struct drm_gpuva_op *op, void *op_ctx) | |||
| 435 | 433 | drm_gpuva_remap(&ctx->prev_va->base, &ctx->next_va->base, &op->remap); | |
| 436 | 434 | ||
| 437 | 435 | if (op->remap.prev) { | |
| 438 | - | drm_gpuva_link(&ctx->prev_va->base, vm_bo); | |
| 436 | + | pvr_gem_object_get(gem_to_pvr_gem(ctx->prev_va->base.gem.obj)); | |
| 437 | + | drm_gpuva_link(&ctx->prev_va->base, ctx->gpuvm_bo); | |
| 439 | 438 | ctx->prev_va = NULL; | |
| 440 | 439 | } | |
| 441 | 440 | ||
| 442 | 441 | if (op->remap.next) { | |
| 443 | - | drm_gpuva_link(&ctx->next_va->base, vm_bo); | |
| 442 | + | pvr_gem_object_get(gem_to_pvr_gem(ctx->next_va->base.gem.obj)); | |
| 443 | + | drm_gpuva_link(&ctx->next_va->base, ctx->gpuvm_bo); | |
| 444 | 444 | ctx->next_va = NULL; | |
| 445 | 445 | } | |
| 446 | 446 | ||
modified drivers/gpu/drm/logicvc/Kconfig
| @@ -4,6 +4,7 @@ config DRM_LOGICVC | |||
| 4 | 4 | depends on OF || COMPILE_TEST | |
| 5 | 5 | select DRM_CLIENT_SELECTION | |
| 6 | 6 | select DRM_KMS_HELPER | |
| 7 | + | select DRM_KMS_DMA_HELPER | |
| 7 | 8 | select DRM_GEM_DMA_HELPER | |
| 8 | 9 | select REGMAP | |
| 9 | 10 | select REGMAP_MMIO | |
modified drivers/gpu/drm/loongson/lsdc_plane.c
| @@ -7,7 +7,6 @@ | |||
| 7 | 7 | ||
| 8 | 8 | #include <drm/drm_atomic.h> | |
| 9 | 9 | #include <drm/drm_atomic_helper.h> | |
| 10 | - | #include <drm/drm_blend.h> | |
| 11 | 10 | #include <drm/drm_framebuffer.h> | |
| 12 | 11 | #include <drm/drm_gem_atomic_helper.h> | |
| 13 | 12 | #include <drm/drm_print.h> | |
| @@ -766,7 +765,7 @@ int ls7a1000_cursor_plane_init(struct drm_device *ddev, | |||
| 766 | 765 | ||
| 767 | 766 | drm_plane_helper_add(plane, &ls7a1000_cursor_plane_helper_funcs); | |
| 768 | 767 | ||
| 769 | - | return drm_plane_create_blend_mode_property(plane, BIT(DRM_MODE_BLEND_COVERAGE)); | |
| 768 | + | return 0; | |
| 770 | 769 | } | |
| 771 | 770 | ||
| 772 | 771 | int ls7a2000_cursor_plane_init(struct drm_device *ddev, | |
| @@ -791,5 +790,5 @@ int ls7a2000_cursor_plane_init(struct drm_device *ddev, | |||
| 791 | 790 | ||
| 792 | 791 | drm_plane_helper_add(plane, &ls7a2000_cursor_plane_helper_funcs); | |
| 793 | 792 | ||
| 794 | - | return drm_plane_create_blend_mode_property(plane, BIT(DRM_MODE_BLEND_COVERAGE)); | |
| 793 | + | return 0; | |
| 795 | 794 | } | |
modified drivers/gpu/drm/mediatek/mtk_drm_drv.c
| @@ -638,10 +638,8 @@ static int mtk_drm_bind(struct device *dev) | |||
| 638 | 638 | private->mtk_drm_bound = true; | |
| 639 | 639 | private->dev = dev; | |
| 640 | 640 | ||
| 641 | - | if (!mtk_drm_get_all_drm_priv(dev)) { | |
| 642 | - | put_device(private->mutex_dev); | |
| 641 | + | if (!mtk_drm_get_all_drm_priv(dev)) | |
| 643 | 642 | return 0; | |
| 644 | - | } | |
| 645 | 643 | ||
| 646 | 644 | drm = drm_dev_alloc(&mtk_drm_driver, dev); | |
| 647 | 645 | if (IS_ERR(drm)) { | |
| @@ -1062,7 +1060,7 @@ static int mtk_drm_probe(struct platform_device *pdev) | |||
| 1062 | 1060 | struct mtk_mmsys_driver_data *mtk_drm_data; | |
| 1063 | 1061 | struct device_node *node; | |
| 1064 | 1062 | struct component_match *match = NULL; | |
| 1065 | - | struct platform_device *ovl_adaptor = NULL; | |
| 1063 | + | struct platform_device *ovl_adaptor; | |
| 1066 | 1064 | int ret; | |
| 1067 | 1065 | int i; | |
| 1068 | 1066 | ||
| @@ -1114,9 +1112,6 @@ static int mtk_drm_probe(struct platform_device *pdev) | |||
| 1114 | 1112 | PLATFORM_DEVID_AUTO, | |
| 1115 | 1113 | (void *)private->mmsys_dev, | |
| 1116 | 1114 | sizeof(*private->mmsys_dev)); | |
| 1117 | - | if (IS_ERR(ovl_adaptor)) | |
| 1118 | - | return PTR_ERR(ovl_adaptor); | |
| 1119 | - | ||
| 1120 | 1115 | private->ddp_comp[DDP_COMPONENT_DRM_OVL_ADAPTOR].dev = &ovl_adaptor->dev; | |
| 1121 | 1116 | mtk_ddp_comp_init(dev, NULL, &private->ddp_comp[DDP_COMPONENT_DRM_OVL_ADAPTOR], | |
| 1122 | 1117 | DDP_COMPONENT_DRM_OVL_ADAPTOR); | |
| @@ -1210,8 +1205,6 @@ static int mtk_drm_probe(struct platform_device *pdev) | |||
| 1210 | 1205 | err_pm: | |
| 1211 | 1206 | pm_runtime_disable(dev); | |
| 1212 | 1207 | err_node: | |
| 1213 | - | if (ovl_adaptor) | |
| 1214 | - | platform_device_unregister(ovl_adaptor); | |
| 1215 | 1208 | of_node_put(private->mutex_node); | |
| 1216 | 1209 | for (i = 0; i < DDP_COMPONENT_DRM_ID_MAX; i++) | |
| 1217 | 1210 | of_node_put(private->comp_node[i]); | |
| @@ -1221,15 +1214,9 @@ err_node: | |||
| 1221 | 1214 | static void mtk_drm_remove(struct platform_device *pdev) | |
| 1222 | 1215 | { | |
| 1223 | 1216 | struct mtk_drm_private *private = platform_get_drvdata(pdev); | |
| 1224 | - | struct device *ovl_adaptor_dev; | |
| 1225 | 1217 | int i; | |
| 1226 | 1218 | ||
| 1227 | - | ovl_adaptor_dev = | |
| 1228 | - | private->ddp_comp[DDP_COMPONENT_DRM_OVL_ADAPTOR].dev; | |
| 1229 | - | ||
| 1230 | 1219 | component_master_del(&pdev->dev, &mtk_drm_ops); | |
| 1231 | - | if (ovl_adaptor_dev) | |
| 1232 | - | platform_device_unregister(to_platform_device(ovl_adaptor_dev)); | |
| 1233 | 1220 | pm_runtime_disable(&pdev->dev); | |
| 1234 | 1221 | of_node_put(private->mutex_node); | |
| 1235 | 1222 | for (i = 0; i < DDP_COMPONENT_DRM_ID_MAX; i++) | |
modified drivers/gpu/drm/mediatek/mtk_hdmi_ddc_v2.c
| @@ -376,10 +376,8 @@ static int mtk_hdmi_ddc_v2_probe(struct platform_device *pdev) | |||
| 376 | 376 | pm_runtime_get_sync(dev); | |
| 377 | 377 | ||
| 378 | 378 | ret = devm_i2c_add_adapter(dev, &ddc->adap); | |
| 379 | - | if (ret < 0) { | |
| 380 | - | pm_runtime_put_noidle(dev); | |
| 379 | + | if (ret < 0) | |
| 381 | 380 | return dev_err_probe(dev, ret, "Cannot add DDC I2C adapter\n"); | |
| 382 | - | } | |
| 383 | 381 | ||
| 384 | 382 | platform_set_drvdata(pdev, ddc); | |
| 385 | 383 | return 0; | |
modified drivers/gpu/drm/mediatek/mtk_hdmi_regs_v2.h
| @@ -173,7 +173,7 @@ | |||
| 173 | 173 | #define TPI_AUDIO_LOOKUP_EN BIT(2) | |
| 174 | 174 | ||
| 175 | 175 | /* Video downsampling configuration */ | |
| 176 | - | #define VID_DOWNSAMPLE_CONFIG 0x8f0 | |
| 176 | + | #define VID_DOWNSAMPLE_CONFIG 0x8d0 | |
| 177 | 177 | #define C444_C422_CONFIG_ENABLE BIT(0) | |
| 178 | 178 | #define C422_C420_CONFIG_ENABLE BIT(4) | |
| 179 | 179 | #define C422_C420_CONFIG_BYPASS BIT(5) | |
modified drivers/gpu/drm/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/include/nvif/cl0080.h
| @@ -4,7 +4,6 @@ | |||
| 4 | 4 | ||
| 5 | 5 | #define NV_DEVICE_V0_INFO 0x00 | |
| 6 | 6 | #define NV_DEVICE_V0_TIME 0x01 | |
| 7 | - | #define NV_DEVICE_V0_GCX_READY 0x02 | |
| 8 | 7 | ||
| 9 | 8 | struct nv_device_info_v0 { | |
| 10 | 9 | __u8 version; | |
| @@ -56,15 +55,6 @@ struct nv_device_time_v0 { | |||
| 56 | 55 | __u64 time; | |
| 57 | 56 | }; | |
| 58 | 57 | ||
| 59 | - | #define NV_DEVICE_GC6_READY BIT(0) | |
| 60 | - | #define NV_DEVICE_GCOFF_READY BIT(1) | |
| 61 | - | ||
| 62 | - | struct nv_device_gcx_ready_v0 { | |
| 63 | - | __u8 version; | |
| 64 | - | __u8 pad01[6]; | |
| 65 | - | __u8 ready; | |
| 66 | - | }; | |
| 67 | - | ||
| 68 | 58 | #define NV_DEVICE_INFO_UNIT (0xffffffffULL << 32) | |
| 69 | 59 | #define NV_DEVICE_INFO(n) ((n) | (0x00000000ULL << 32)) | |
| 70 | 60 | #define NV_DEVICE_HOST(n) ((n) | (0x00000001ULL << 32)) | |
modified drivers/gpu/drm/nouveau/include/nvif/device.h
| @@ -22,5 +22,4 @@ int nvif_device_ctor(struct nvif_client *, const char *name, struct nvif_device | |||
| 22 | 22 | void nvif_device_dtor(struct nvif_device *); | |
| 23 | 23 | int nvif_device_map(struct nvif_device *); | |
| 24 | 24 | u64 nvif_device_time(struct nvif_device *); | |
| 25 | - | int nvif_device_gcx_ready(struct nvif_device *); | |
| 26 | 25 | #endif | |
modified drivers/gpu/drm/nouveau/include/nvkm/engine/disp.h
| @@ -87,5 +87,4 @@ int gp102_disp_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct | |||
| 87 | 87 | int gv100_disp_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_disp **); | |
| 88 | 88 | int tu102_disp_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_disp **); | |
| 89 | 89 | int ga102_disp_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_disp **); | |
| 90 | - | int gb202_disp_new(struct nvkm_device *, enum nvkm_subdev_type, int inst, struct nvkm_disp **); | |
| 91 | 90 | #endif | |
modified drivers/gpu/drm/nouveau/include/nvkm/subdev/gsp.h
| @@ -156,10 +156,6 @@ struct nvkm_gsp { | |||
| 156 | 156 | struct sg_table fbsr; | |
| 157 | 157 | } sr; | |
| 158 | 158 | ||
| 159 | - | struct { | |
| 160 | - | bool use_raw_mode_comptagline_alloc; | |
| 161 | - | } memsys; | |
| 162 | - | ||
| 163 | 159 | struct { | |
| 164 | 160 | struct nvkm_gsp_mem mem; | |
| 165 | 161 | ||
| @@ -499,8 +495,6 @@ nvkm_gsp_event_dtor(struct nvkm_gsp_event *event) | |||
| 499 | 495 | int nvkm_gsp_intr_stall(struct nvkm_gsp *, enum nvkm_subdev_type, int); | |
| 500 | 496 | int nvkm_gsp_intr_nonstall(struct nvkm_gsp *, enum nvkm_subdev_type, int); | |
| 501 | 497 | ||
| 502 | - | int nvkm_gsp_gcx_ready(struct nvkm_gsp *gsp); | |
| 503 | - | ||
| 504 | 498 | int gv100_gsp_new(struct nvkm_device *, enum nvkm_subdev_type, int, struct nvkm_gsp **); | |
| 505 | 499 | int tu102_gsp_new(struct nvkm_device *, enum nvkm_subdev_type, int, struct nvkm_gsp **); | |
| 506 | 500 | int tu116_gsp_new(struct nvkm_device *, enum nvkm_subdev_type, int, struct nvkm_gsp **); | |
modified drivers/gpu/drm/nouveau/nouveau_abi16.c
| @@ -488,7 +488,7 @@ nouveau_abi16_ioctl_channel_alloc(ABI16_IOCTL_ARGS) | |||
| 488 | 488 | goto done; | |
| 489 | 489 | break; | |
| 490 | 490 | case NV_DEVICE_INFO_V0_TURING: | |
| 491 | - | if (engine == NV_DEVICE_HOST_RUNLIST_ENGINES_GR) { | |
| 491 | + | if (engine != NV_DEVICE_HOST_RUNLIST_ENGINES_NVDEC) { | |
| 492 | 492 | ret = nvif_object_ctor(&chan->chan->user, "abi16CeWar", | |
| 493 | 493 | 0, TURING_DMA_COPY_A, NULL, 0, | |
| 494 | 494 | &chan->ce); | |
modified drivers/gpu/drm/nouveau/nouveau_bo.c
| @@ -578,9 +578,8 @@ int nouveau_bo_pin_locked(struct nouveau_bo *nvbo, uint32_t domain, bool contig) | |||
| 578 | 578 | "0x%08x vs 0x%08x\n", bo, | |
| 579 | 579 | bo->resource->mem_type, domain); | |
| 580 | 580 | ret = -EBUSY; | |
| 581 | - | } else { | |
| 582 | - | ttm_bo_pin(&nvbo->bo); | |
| 583 | 581 | } | |
| 582 | + | ttm_bo_pin(&nvbo->bo); | |
| 584 | 583 | goto out; | |
| 585 | 584 | } | |
| 586 | 585 | ||
modified drivers/gpu/drm/nouveau/nouveau_chan.c
| @@ -90,14 +90,6 @@ nouveau_channel_del(struct nouveau_channel **pchan) | |||
| 90 | 90 | { | |
| 91 | 91 | struct nouveau_channel *chan = *pchan; | |
| 92 | 92 | if (chan) { | |
| 93 | - | /* | |
| 94 | - | * Drop the kill-event subscription first. Its handler | |
| 95 | - | * dereferences chan->fence, which the fence context teardown | |
| 96 | - | * below frees, so leaving it armed across the teardown leaves | |
| 97 | - | * a window for a use-after-free. | |
| 98 | - | */ | |
| 99 | - | nvif_event_dtor(&chan->kill); | |
| 100 | - | ||
| 101 | 93 | if (chan->fence) | |
| 102 | 94 | nouveau_fence(chan->cli->drm)->context_del(chan); | |
| 103 | 95 | ||
| @@ -108,6 +100,7 @@ nouveau_channel_del(struct nouveau_channel **pchan) | |||
| 108 | 100 | nvif_object_dtor(&chan->nvsw); | |
| 109 | 101 | nvif_object_dtor(&chan->gart); | |
| 110 | 102 | nvif_object_dtor(&chan->vram); | |
| 103 | + | nvif_event_dtor(&chan->kill); | |
| 111 | 104 | nvif_object_dtor(&chan->user); | |
| 112 | 105 | nvif_mem_dtor(&chan->mem_userd); | |
| 113 | 106 | nouveau_vma_del(&chan->sema.vma); | |
modified drivers/gpu/drm/nouveau/nouveau_connector.c
| @@ -600,11 +600,8 @@ nouveau_connector_detect(struct drm_connector *connector, bool force) | |||
| 600 | 600 | new_edid = drm_get_edid(connector, nv_encoder->i2c); | |
| 601 | 601 | } else { | |
| 602 | 602 | ret = nvif_outp_edid_get(&nv_encoder->outp, (u8 **)&new_edid); | |
| 603 | - | if (ret < 0) { | |
| 604 | - | pm_runtime_mark_last_busy(dev->dev); | |
| 605 | - | pm_runtime_put_autosuspend(dev->dev); | |
| 603 | + | if (ret < 0) | |
| 606 | 604 | return connector_status_disconnected; | |
| 607 | - | } | |
| 608 | 605 | } | |
| 609 | 606 | ||
| 610 | 607 | nouveau_connector_set_edid(nv_connector, new_edid); | |
modified drivers/gpu/drm/nouveau/nouveau_dmem.c
| @@ -267,7 +267,7 @@ static vm_fault_t nouveau_dmem_migrate_to_ram(struct vm_fault *vmf) | |||
| 267 | 267 | nouveau_fence_new(&fence, dmem->migrate.chan); | |
| 268 | 268 | migrate_vma_pages(&args); | |
| 269 | 269 | nouveau_dmem_fence_done(&fence); | |
| 270 | - | dma_unmap_page(drm->dev->dev, dma_info.dma_addr, dma_info.size, | |
| 270 | + | dma_unmap_page(drm->dev->dev, dma_info.dma_addr, PAGE_SIZE, | |
| 271 | 271 | DMA_BIDIRECTIONAL); | |
| 272 | 272 | done: | |
| 273 | 273 | migrate_vma_finalize(&args); | |
| @@ -279,25 +279,11 @@ err: | |||
| 279 | 279 | ||
| 280 | 280 | static void nouveau_dmem_folio_split(struct folio *head, struct folio *tail) | |
| 281 | 281 | { | |
| 282 | - | struct nouveau_dmem_chunk *chunk; | |
| 283 | - | struct nouveau_dmem *dmem; | |
| 284 | - | ||
| 285 | 282 | if (tail == NULL) | |
| 286 | 283 | return; | |
| 287 | 284 | tail->pgmap = head->pgmap; | |
| 288 | 285 | tail->mapping = head->mapping; | |
| 289 | 286 | folio_set_zone_device_data(tail, folio_zone_device_data(head)); | |
| 290 | - | ||
| 291 | - | /* | |
| 292 | - | * The split hands out a new independently-freeable folio that will | |
| 293 | - | * later be released via nouveau_dmem_folio_free(); account for it so | |
| 294 | - | * chunk->callocated stays balanced. | |
| 295 | - | */ | |
| 296 | - | chunk = nouveau_page_to_chunk(&head->page); | |
| 297 | - | dmem = chunk->drm->dmem; | |
| 298 | - | spin_lock(&dmem->lock); | |
| 299 | - | chunk->callocated++; | |
| 300 | - | spin_unlock(&dmem->lock); | |
| 301 | 287 | } | |
| 302 | 288 | ||
| 303 | 289 | static const struct dev_pagemap_ops nouveau_dmem_pagemap_ops = { | |
| @@ -339,8 +325,8 @@ nouveau_dmem_chunk_alloc(struct nouveau_drm *drm, struct page **ppage, | |||
| 339 | 325 | chunk->pagemap.ops = &nouveau_dmem_pagemap_ops; | |
| 340 | 326 | chunk->pagemap.owner = drm->dev; | |
| 341 | 327 | ||
| 342 | - | ret = nouveau_bo_new_pin(&drm->client, NOUVEAU_GEM_DOMAIN_VRAM, | |
| 343 | - | DMEM_CHUNK_SIZE * NR_CHUNKS, &chunk->bo); | |
| 328 | + | ret = nouveau_bo_new_pin(&drm->client, NOUVEAU_GEM_DOMAIN_VRAM, DMEM_CHUNK_SIZE, | |
| 329 | + | &chunk->bo); | |
| 344 | 330 | if (ret) | |
| 345 | 331 | goto out_release; | |
| 346 | 332 | ||
| @@ -786,7 +772,7 @@ static unsigned long nouveau_dmem_migrate_copy_one(struct nouveau_drm *drm, | |||
| 786 | 772 | return mpfn; | |
| 787 | 773 | ||
| 788 | 774 | out_dma_unmap: | |
| 789 | - | dma_unmap_page(dev, dma_info->dma_addr, dma_info->size, DMA_BIDIRECTIONAL); | |
| 775 | + | dma_unmap_page(dev, dma_info->dma_addr, PAGE_SIZE, DMA_BIDIRECTIONAL); | |
| 790 | 776 | out_free_page: | |
| 791 | 777 | nouveau_dmem_page_free_locked(drm, dpage); | |
| 792 | 778 | out: | |
modified drivers/gpu/drm/nouveau/nouveau_drm.c
| @@ -585,7 +585,6 @@ nouveau_drm_device_fini(struct nouveau_drm *drm) | |||
| 585 | 585 | if (nouveau_pmops_runtime()) { | |
| 586 | 586 | pm_runtime_get_sync(dev->dev); | |
| 587 | 587 | pm_runtime_forbid(dev->dev); | |
| 588 | - | pm_runtime_dont_use_autosuspend(dev->dev); | |
| 589 | 588 | } | |
| 590 | 589 | ||
| 591 | 590 | nouveau_led_fini(dev); | |
| @@ -1149,7 +1148,6 @@ nouveau_pmops_runtime_suspend(struct device *dev) | |||
| 1149 | 1148 | { | |
| 1150 | 1149 | struct pci_dev *pdev = to_pci_dev(dev); | |
| 1151 | 1150 | struct nouveau_drm *drm = pci_get_drvdata(pdev); | |
| 1152 | - | struct nvif_device *nvif = &drm->client.device; | |
| 1153 | 1151 | int ret; | |
| 1154 | 1152 | ||
| 1155 | 1153 | if (!nouveau_pmops_runtime()) { | |
| @@ -1157,18 +1155,6 @@ nouveau_pmops_runtime_suspend(struct device *dev) | |||
| 1157 | 1155 | return -EBUSY; | |
| 1158 | 1156 | } | |
| 1159 | 1157 | ||
| 1160 | - | // Check if the GPU itself is ready for runtime suspend, otherwise mark as busy and check | |
| 1161 | - | // again in a bit. | |
| 1162 | - | ret = nvif_device_gcx_ready(nvif); | |
| 1163 | - | if (ret < 0) { | |
| 1164 | - | NV_ERROR(drm, "Failed to query GCX readiness (returned %d)\n", ret); | |
| 1165 | - | return -EBUSY; | |
| 1166 | - | } else if (!(ret & NV_DEVICE_GCOFF_READY)) { | |
| 1167 | - | NV_DEBUG(drm, "GPU isn't ready for suspend yet, delaying...\n"); | |
| 1168 | - | pm_runtime_mark_last_busy(dev); | |
| 1169 | - | return -EBUSY; | |
| 1170 | - | } | |
| 1171 | - | ||
| 1172 | 1158 | nouveau_switcheroo_optimus_dsm(); | |
| 1173 | 1159 | ret = nouveau_do_suspend(drm, true); | |
| 1174 | 1160 | pci_save_state(pdev); | |
| @@ -1264,8 +1250,10 @@ nouveau_drm_open(struct drm_device *dev, struct drm_file *fpriv) | |||
| 1264 | 1250 | mutex_unlock(&drm->clients_lock); | |
| 1265 | 1251 | ||
| 1266 | 1252 | done: | |
| 1267 | - | if (ret && cli) | |
| 1253 | + | if (ret && cli) { | |
| 1254 | + | nouveau_cli_fini(cli); | |
| 1268 | 1255 | kfree(cli); | |
| 1256 | + | } | |
| 1269 | 1257 | ||
| 1270 | 1258 | pm_runtime_mark_last_busy(dev->dev); | |
| 1271 | 1259 | pm_runtime_put_autosuspend(dev->dev); | |
modified drivers/gpu/drm/nouveau/nouveau_gem.c
| @@ -522,7 +522,6 @@ retry: | |||
| 522 | 522 | if (unlikely(ret)) { | |
| 523 | 523 | if (ret != -ERESTARTSYS) | |
| 524 | 524 | NV_PRINTK(err, cli, "fail reserve\n"); | |
| 525 | - | drm_gem_object_put(gem); | |
| 526 | 525 | break; | |
| 527 | 526 | } | |
| 528 | 527 | } | |
| @@ -532,7 +531,6 @@ retry: | |||
| 532 | 531 | struct nouveau_vma *vma = nouveau_vma_find(nvbo, vmm); | |
| 533 | 532 | if (!vma) { | |
| 534 | 533 | NV_PRINTK(err, cli, "vma not found!\n"); | |
| 535 | - | drm_gem_object_put(gem); | |
| 536 | 534 | ret = -EINVAL; | |
| 537 | 535 | break; | |
| 538 | 536 | } | |
modified drivers/gpu/drm/nouveau/nouveau_sched.c
| @@ -517,7 +517,7 @@ nouveau_sched_destroy(struct nouveau_sched **psched) | |||
| 517 | 517 | struct nouveau_sched *sched = *psched; | |
| 518 | 518 | ||
| 519 | 519 | nouveau_sched_fini(sched); | |
| 520 | - | kfree_rcu(sched, rcu); | |
| 520 | + | kfree(sched); | |
| 521 | 521 | ||
| 522 | 522 | *psched = NULL; | |
| 523 | 523 | } | |
modified drivers/gpu/drm/nouveau/nouveau_sched.h
| @@ -98,7 +98,6 @@ void nouveau_job_free(struct nouveau_job *job); | |||
| 98 | 98 | ||
| 99 | 99 | struct nouveau_sched { | |
| 100 | 100 | struct drm_gpu_scheduler base; | |
| 101 | - | struct rcu_head rcu; | |
| 102 | 101 | struct drm_sched_entity entity; | |
| 103 | 102 | struct workqueue_struct *wq; | |
| 104 | 103 | struct mutex mutex; | |
modified drivers/gpu/drm/nouveau/nouveau_sgdma.c
| @@ -72,7 +72,9 @@ nouveau_sgdma_create_ttm(struct ttm_buffer_object *bo, uint32_t page_flags) | |||
| 72 | 72 | struct nouveau_sgdma_be *nvbe; | |
| 73 | 73 | enum ttm_caching caching; | |
| 74 | 74 | ||
| 75 | - | if (nvbo->force_coherent || drm->agp.bridge) | |
| 75 | + | if (nvbo->force_coherent) | |
| 76 | + | caching = ttm_uncached; | |
| 77 | + | else if (drm->agp.bridge) | |
| 76 | 78 | caching = ttm_write_combined; | |
| 77 | 79 | else | |
| 78 | 80 | caching = ttm_cached; | |
modified drivers/gpu/drm/nouveau/nouveau_uvmm.c
| @@ -846,9 +846,6 @@ op_map(struct nouveau_uvma *uvma) | |||
| 846 | 846 | { | |
| 847 | 847 | struct nouveau_bo *nvbo = nouveau_gem_object(uvma->va.gem.obj); | |
| 848 | 848 | ||
| 849 | - | if (drm_gpuva_invalidated(&uvma->va)) | |
| 850 | - | return; | |
| 851 | - | ||
| 852 | 849 | nouveau_uvma_map(uvma, nouveau_mem(nvbo->bo.resource)); | |
| 853 | 850 | } | |
| 854 | 851 | ||
| @@ -1235,7 +1232,6 @@ bind_lock_validate(struct nouveau_job *job, struct drm_exec *exec, | |||
| 1235 | 1232 | ||
| 1236 | 1233 | drm_gpuva_for_each_op(va_op, op->ops) { | |
| 1237 | 1234 | struct drm_gem_object *obj = op_gem_obj(va_op); | |
| 1238 | - | struct nouveau_bo *nvbo; | |
| 1239 | 1235 | ||
| 1240 | 1236 | if (unlikely(!obj)) | |
| 1241 | 1237 | continue; | |
| @@ -1250,13 +1246,8 @@ bind_lock_validate(struct nouveau_job *job, struct drm_exec *exec, | |||
| 1250 | 1246 | if (va_op->op == DRM_GPUVA_OP_UNMAP) | |
| 1251 | 1247 | continue; | |
| 1252 | 1248 | ||
| 1253 | - | nvbo = nouveau_gem_object(obj); | |
| 1254 | - | if (!(nvbo->valid_domains & | |
| 1255 | - | (NOUVEAU_GEM_DOMAIN_VRAM | NOUVEAU_GEM_DOMAIN_GART))) | |
| 1256 | - | return -EINVAL; | |
| 1257 | - | ||
| 1258 | - | nouveau_bo_placement_set(nvbo, nvbo->valid_domains, 0); | |
| 1259 | - | ret = nouveau_bo_validate(nvbo, true, false); | |
| 1249 | + | ret = nouveau_bo_validate(nouveau_gem_object(obj), | |
| 1250 | + | true, false); | |
| 1260 | 1251 | if (ret) | |
| 1261 | 1252 | return ret; | |
| 1262 | 1253 | } | |
| @@ -1328,7 +1319,6 @@ nouveau_uvmm_bind_job_submit(struct nouveau_job *job, | |||
| 1328 | 1319 | op->va.range); | |
| 1329 | 1320 | if (!op->reg || op->reg->dirty) { | |
| 1330 | 1321 | ret = -ENOENT; | |
| 1331 | - | op->reg = NULL; | |
| 1332 | 1322 | goto unwind_continue; | |
| 1333 | 1323 | } | |
| 1334 | 1324 | ||
| @@ -1337,7 +1327,6 @@ nouveau_uvmm_bind_job_submit(struct nouveau_job *job, | |||
| 1337 | 1327 | op->va.range); | |
| 1338 | 1328 | if (IS_ERR(op->ops)) { | |
| 1339 | 1329 | ret = PTR_ERR(op->ops); | |
| 1340 | - | op->reg = NULL; | |
| 1341 | 1330 | goto unwind_continue; | |
| 1342 | 1331 | } | |
| 1343 | 1332 | ||
| @@ -1484,7 +1473,6 @@ unwind: | |||
| 1484 | 1473 | op->va.range); | |
| 1485 | 1474 | break; | |
| 1486 | 1475 | case OP_UNMAP_SPARSE: | |
| 1487 | - | op->reg->dirty = false; | |
| 1488 | 1476 | __nouveau_uvma_region_insert(uvmm, op->reg); | |
| 1489 | 1477 | nouveau_uvmm_sm_unmap_prepare_unwind(uvmm, &op->new, | |
| 1490 | 1478 | op->ops); | |
| @@ -1501,8 +1489,7 @@ unwind: | |||
| 1501 | 1489 | break; | |
| 1502 | 1490 | } | |
| 1503 | 1491 | ||
| 1504 | - | if (!IS_ERR_OR_NULL(op->ops)) | |
| 1505 | - | drm_gpuva_ops_free(&uvmm->base, op->ops); | |
| 1492 | + | drm_gpuva_ops_free(&uvmm->base, op->ops); | |
| 1506 | 1493 | op->ops = NULL; | |
| 1507 | 1494 | op->reg = NULL; | |
| 1508 | 1495 | } | |
modified drivers/gpu/drm/nouveau/nvif/device.c
| @@ -38,19 +38,6 @@ nvif_device_time(struct nvif_device *device) | |||
| 38 | 38 | return device->user.func->time(&device->user); | |
| 39 | 39 | } | |
| 40 | 40 | ||
| 41 | - | int | |
| 42 | - | nvif_device_gcx_ready(struct nvif_device *device) | |
| 43 | - | { | |
| 44 | - | struct nv_device_gcx_ready_v0 args = {}; | |
| 45 | - | int ret; | |
| 46 | - | ||
| 47 | - | ret = nvif_object_mthd(&device->object, NV_DEVICE_V0_GCX_READY, &args, sizeof(args)); | |
| 48 | - | if (ret) | |
| 49 | - | return ret; | |
| 50 | - | ||
| 51 | - | return args.ready; | |
| 52 | - | } | |
| 53 | - | ||
| 54 | 41 | int | |
| 55 | 42 | nvif_device_map(struct nvif_device *device) | |
| 56 | 43 | { | |
modified drivers/gpu/drm/nouveau/nvif/vmm.c
| @@ -192,7 +192,6 @@ void | |||
| 192 | 192 | nvif_vmm_dtor(struct nvif_vmm *vmm) | |
| 193 | 193 | { | |
| 194 | 194 | kfree(vmm->page); | |
| 195 | - | vmm->page = NULL; | |
| 196 | 195 | nvif_object_dtor(&vmm->object); | |
| 197 | 196 | } | |
| 198 | 197 | ||
modified drivers/gpu/drm/nouveau/nvkm/engine/device/base.c
| @@ -2846,7 +2846,7 @@ nv1b2_chipset = { | |||
| 2846 | 2846 | .pci = { 0x00000001, gh100_pci_new }, | |
| 2847 | 2847 | .timer = { 0x00000001, gk20a_timer_new }, | |
| 2848 | 2848 | .vfn = { 0x00000001, ga100_vfn_new }, | |
| 2849 | - | .disp = { 0x00000001, gb202_disp_new }, | |
| 2849 | + | .disp = { 0x00000001, ga102_disp_new }, | |
| 2850 | 2850 | .fifo = { 0x00000001, ga102_fifo_new }, | |
| 2851 | 2851 | }; | |
| 2852 | 2852 | ||
| @@ -2862,7 +2862,7 @@ nv1b3_chipset = { | |||
| 2862 | 2862 | .pci = { 0x00000001, gh100_pci_new }, | |
| 2863 | 2863 | .timer = { 0x00000001, gk20a_timer_new }, | |
| 2864 | 2864 | .vfn = { 0x00000001, ga100_vfn_new }, | |
| 2865 | - | .disp = { 0x00000001, gb202_disp_new }, | |
| 2865 | + | .disp = { 0x00000001, ga102_disp_new }, | |
| 2866 | 2866 | .fifo = { 0x00000001, ga102_fifo_new }, | |
| 2867 | 2867 | }; | |
| 2868 | 2868 | ||
| @@ -2878,7 +2878,7 @@ nv1b5_chipset = { | |||
| 2878 | 2878 | .pci = { 0x00000001, gh100_pci_new }, | |
| 2879 | 2879 | .timer = { 0x00000001, gk20a_timer_new }, | |
| 2880 | 2880 | .vfn = { 0x00000001, ga100_vfn_new }, | |
| 2881 | - | .disp = { 0x00000001, gb202_disp_new }, | |
| 2881 | + | .disp = { 0x00000001, ga102_disp_new }, | |
| 2882 | 2882 | .fifo = { 0x00000001, ga102_fifo_new }, | |
| 2883 | 2883 | }; | |
| 2884 | 2884 | ||
| @@ -2894,7 +2894,7 @@ nv1b6_chipset = { | |||
| 2894 | 2894 | .pci = { 0x00000001, gh100_pci_new }, | |
| 2895 | 2895 | .timer = { 0x00000001, gk20a_timer_new }, | |
| 2896 | 2896 | .vfn = { 0x00000001, ga100_vfn_new }, | |
| 2897 | - | .disp = { 0x00000001, gb202_disp_new }, | |
| 2897 | + | .disp = { 0x00000001, ga102_disp_new }, | |
| 2898 | 2898 | .fifo = { 0x00000001, ga102_fifo_new }, | |
| 2899 | 2899 | }; | |
| 2900 | 2900 | ||
| @@ -2910,7 +2910,7 @@ nv1b7_chipset = { | |||
| 2910 | 2910 | .pci = { 0x00000001, gh100_pci_new }, | |
| 2911 | 2911 | .timer = { 0x00000001, gk20a_timer_new }, | |
| 2912 | 2912 | .vfn = { 0x00000001, ga100_vfn_new }, | |
| 2913 | - | .disp = { 0x00000001, gb202_disp_new }, | |
| 2913 | + | .disp = { 0x00000001, ga102_disp_new }, | |
| 2914 | 2914 | .fifo = { 0x00000001, ga102_fifo_new }, | |
| 2915 | 2915 | }; | |
| 2916 | 2916 | ||
modified drivers/gpu/drm/nouveau/nvkm/engine/device/ctrl.c
| @@ -74,7 +74,6 @@ nvkm_control_mthd_pstate_attr(struct nvkm_control *ctrl, void *data, u32 size) | |||
| 74 | 74 | const struct nvkm_domain *domain; | |
| 75 | 75 | struct nvkm_pstate *pstate; | |
| 76 | 76 | struct nvkm_cstate *cstate; | |
| 77 | - | bool found = false; | |
| 78 | 77 | int i = 0, j = -1; | |
| 79 | 78 | u32 lo, hi; | |
| 80 | 79 | int ret = -ENOSYS; | |
| @@ -105,15 +104,10 @@ nvkm_control_mthd_pstate_attr(struct nvkm_control *ctrl, void *data, u32 size) | |||
| 105 | 104 | ||
| 106 | 105 | if (args->v0.state != NVIF_CONTROL_PSTATE_ATTR_V0_STATE_CURRENT) { | |
| 107 | 106 | list_for_each_entry(pstate, &clk->states, head) { | |
| 108 | - | if (i++ == args->v0.state) { | |
| 109 | - | found = true; | |
| 107 | + | if (i++ == args->v0.state) | |
| 110 | 108 | break; | |
| 111 | - | } | |
| 112 | 109 | } | |
| 113 | 110 | ||
| 114 | - | if (!found) | |
| 115 | - | return -EINVAL; | |
| 116 | - | ||
| 117 | 111 | lo = pstate->base.domain[domain->name]; | |
| 118 | 112 | hi = lo; | |
| 119 | 113 | list_for_each_entry(cstate, &pstate->list, head) { | |
modified drivers/gpu/drm/nouveau/nvkm/engine/device/user.c
| @@ -27,7 +27,6 @@ | |||
| 27 | 27 | ||
| 28 | 28 | #include <core/client.h> | |
| 29 | 29 | #include <subdev/fb.h> | |
| 30 | - | #include <subdev/gsp.h> | |
| 31 | 30 | #include <subdev/instmem.h> | |
| 32 | 31 | #include <subdev/timer.h> | |
| 33 | 32 | ||
| @@ -190,38 +189,6 @@ nvkm_udevice_time(struct nvkm_udevice *udev, void *data, u32 size) | |||
| 190 | 189 | return ret; | |
| 191 | 190 | } | |
| 192 | 191 | ||
| 193 | - | static int | |
| 194 | - | nvkm_udevice_gcx_ready(struct nvkm_udevice *udev, void *data, u32 size) | |
| 195 | - | { | |
| 196 | - | struct nvkm_object *object = &udev->object; | |
| 197 | - | struct nvkm_device *device = udev->device; | |
| 198 | - | struct nvkm_gsp *gsp = device->gsp; | |
| 199 | - | union { | |
| 200 | - | struct nv_device_gcx_ready_v0 v0; | |
| 201 | - | } *args = data; | |
| 202 | - | int ret = -ENOSYS; | |
| 203 | - | ||
| 204 | - | if (!gsp || !gsp->rm) { | |
| 205 | - | args->v0.ready = NV_DEVICE_GC6_READY | NV_DEVICE_GCOFF_READY; | |
| 206 | - | return 0; | |
| 207 | - | } | |
| 208 | - | ||
| 209 | - | nvif_ioctl(object, "device gcx ready size %d\n", size); | |
| 210 | - | ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false); | |
| 211 | - | if (!ret) { | |
| 212 | - | nvif_ioctl(object, "device gcx ready vers %d\n", args->v0.version); | |
| 213 | - | ||
| 214 | - | ret = nvkm_gsp_gcx_ready(gsp); | |
| 215 | - | if (ret < 0) | |
| 216 | - | return ret; | |
| 217 | - | ||
| 218 | - | args->v0.ready = ret; | |
| 219 | - | ret = 0; | |
| 220 | - | } | |
| 221 | - | ||
| 222 | - | return ret; | |
| 223 | - | } | |
| 224 | - | ||
| 225 | 192 | static int | |
| 226 | 193 | nvkm_udevice_mthd(struct nvkm_object *object, u32 mthd, void *data, u32 size) | |
| 227 | 194 | { | |
| @@ -232,8 +199,6 @@ nvkm_udevice_mthd(struct nvkm_object *object, u32 mthd, void *data, u32 size) | |||
| 232 | 199 | return nvkm_udevice_info(udev, data, size); | |
| 233 | 200 | case NV_DEVICE_V0_TIME: | |
| 234 | 201 | return nvkm_udevice_time(udev, data, size); | |
| 235 | - | case NV_DEVICE_V0_GCX_READY: | |
| 236 | - | return nvkm_udevice_gcx_ready(udev, data, size); | |
| 237 | 202 | default: | |
| 238 | 203 | break; | |
| 239 | 204 | } | |
modified drivers/gpu/drm/nouveau/nvkm/engine/disp/Kbuild
| @@ -27,7 +27,6 @@ nvkm-y += nvkm/engine/disp/gp102.o | |||
| 27 | 27 | nvkm-y += nvkm/engine/disp/gv100.o | |
| 28 | 28 | nvkm-y += nvkm/engine/disp/tu102.o | |
| 29 | 29 | nvkm-y += nvkm/engine/disp/ga102.o | |
| 30 | - | nvkm-y += nvkm/engine/disp/gb202.o | |
| 31 | 30 | ||
| 32 | 31 | nvkm-y += nvkm/engine/disp/udisp.o | |
| 33 | 32 | nvkm-y += nvkm/engine/disp/uconn.o | |
modified drivers/gpu/drm/nouveau/nvkm/engine/disp/ga102.c
| @@ -144,23 +144,12 @@ ga102_disp = { | |||
| 144 | 144 | }, | |
| 145 | 145 | }; | |
| 146 | 146 | ||
| 147 | - | static const struct nvkm_disp_func | |
| 148 | - | ga102_gsp_disp = { | |
| 149 | - | .uevent = &gv100_disp_chan_uevent, | |
| 150 | - | .ramht_size = 0x2000, | |
| 151 | - | .gsp.intr = tu102_disp_intr, | |
| 152 | - | .gsp.head = &tu102_gsp_head, | |
| 153 | - | .gsp.hdmi_gcp = tu102_sor_hdmi_gcp, | |
| 154 | - | .gsp.hdmi_infoframe_avi = gv100_sor_hdmi_infoframe_avi, | |
| 155 | - | .gsp.hdmi_infoframe_vsi = gv100_sor_hdmi_infoframe_vsi, | |
| 156 | - | }; | |
| 157 | - | ||
| 158 | 147 | int | |
| 159 | 148 | ga102_disp_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst, | |
| 160 | 149 | struct nvkm_disp **pdisp) | |
| 161 | 150 | { | |
| 162 | 151 | if (nvkm_gsp_rm(device->gsp)) | |
| 163 | - | return r535_disp_new(&ga102_gsp_disp, device, type, inst, pdisp); | |
| 152 | + | return r535_disp_new(&ga102_disp, device, type, inst, pdisp); | |
| 164 | 153 | ||
| 165 | 154 | return nvkm_disp_new_(&ga102_disp, device, type, inst, pdisp); | |
| 166 | 155 | } | |
deleted drivers/gpu/drm/nouveau/nvkm/engine/disp/gb202.c mode 100644
| @@ -1,191 +0,0 @@ | |||
| 1 | - | // SPDX-License-Identifier: MIT | |
| 2 | - | /* | |
| 3 | - | * Copyright 2026 Valve Corp. | |
| 4 | - | */ | |
| 5 | - | #include "priv.h" | |
| 6 | - | #include "head.h" | |
| 7 | - | #include "ior.h" | |
| 8 | - | ||
| 9 | - | #include <subdev/timer.h> | |
| 10 | - | ||
| 11 | - | /* GB20x (NVD5.0) reorganised the SF HDMI packet units. The AVI unit is | |
| 12 | - | * unchanged from GV100, but the legacy VSI unit is gone. Vendor infoframes | |
| 13 | - | * are sent through the shared generic infoframe units instead. Register | |
| 14 | - | * layout per NVIDIA's clc971.h/clca71.h, programming sequence per | |
| 15 | - | * nvhdmipkt_C971.c:programAdvancedInfoframeC971(). | |
| 16 | - | */ | |
| 17 | - | static void | |
| 18 | - | gb202_sor_hdmi_infoframe_vsi(struct nvkm_ior *ior, int head, void *data, u32 size) | |
| 19 | - | { | |
| 20 | - | struct nvkm_device *device = ior->disp->engine.subdev.device; | |
| 21 | - | const u32 hoff = head * 0x400; | |
| 22 | - | /* Generic infoframe unit 1, the slot NVIDIA's driver uses for the VSI. */ | |
| 23 | - | const u32 ctrl = 0x6f0138 + hoff; | |
| 24 | - | u8 buf[36] = {}; | |
| 25 | - | int i; | |
| 26 | - | ||
| 27 | - | /* Disable the unit and wait for it to go idle. */ | |
| 28 | - | nvkm_mask(device, ctrl, 0x00000001, 0x00000000); | |
| 29 | - | if (nvkm_msec(device, 2000, | |
| 30 | - | if (!(nvkm_rd32(device, ctrl) & 0x00400000)) | |
| 31 | - | break; | |
| 32 | - | ) < 0) | |
| 33 | - | return; | |
| 34 | - | ||
| 35 | - | if (!size) | |
| 36 | - | return; | |
| 37 | - | ||
| 38 | - | /* Clear SENT status, and point the data port at unit 1's slot. */ | |
| 39 | - | nvkm_mask(device, ctrl, 0x00800000, 0x00800000); | |
| 40 | - | nvkm_wr32(device, 0x6f03f0 + hoff, 0x00000001); | |
| 41 | - | ||
| 42 | - | /* The data port takes the raw packet, except that a zero is inserted | |
| 43 | - | * in HB3 after the three header bytes. A slot is 9 dwords (HB0-3 plus | |
| 44 | - | * up to 32 payload bytes). An HDMI infoframe carries at most PB0-27, | |
| 45 | - | * so the tail stays zero, and we always write the whole slot. | |
| 46 | - | */ | |
| 47 | - | size = min_t(u32, size, 31); | |
| 48 | - | memcpy(buf, data, min_t(u32, size, 3)); | |
| 49 | - | if (size > 3) | |
| 50 | - | memcpy(&buf[4], (u8 *)data + 3, size - 3); | |
| 51 | - | ||
| 52 | - | for (i = 0; i < 36; i += 4) { | |
| 53 | - | nvkm_wr32(device, 0x6f03f4 + hoff, buf[i + 0] | buf[i + 1] << 8 | | |
| 54 | - | buf[i + 2] << 16 | | |
| 55 | - | (u32)buf[i + 3] << 24); | |
| 56 | - | } | |
| 57 | - | ||
| 58 | - | /* No flip ID or scanline matching. */ | |
| 59 | - | nvkm_wr32(device, 0x6f013c + hoff, 0x00000000); | |
| 60 | - | ||
| 61 | - | /* ENABLE | RUN_MODE=ALWAYS | LOC=VBLANK | OFFSET=1 | SIZE=0. */ | |
| 62 | - | nvkm_wr32(device, ctrl, 0x00000041); | |
| 63 | - | ||
| 64 | - | /* Audio priority low (the init value). */ | |
| 65 | - | nvkm_wr32(device, 0x6f03f8 + hoff, 0x00000002); | |
| 66 | - | } | |
| 67 | - | ||
| 68 | - | /* General Control Packet AVMute bracket. The GCP unit moved to slot 1 on | |
| 69 | - | * NVD5.0. Only SB0 (the AVMute bit) is ours to write so we must not do a | |
| 70 | - | * full write here: SB1 carries the deep-color CD/PP fields, and SB1_CTRL | |
| 71 | - | * (bit 24, new with clc871.h) controls where their generation happens (HW | |
| 72 | - | * or driver) on these chips, with the default being HW. | |
| 73 | - | */ | |
| 74 | - | static void | |
| 75 | - | gb202_sor_hdmi_gcp(struct nvkm_ior *sor, int head, bool enable) | |
| 76 | - | { | |
| 77 | - | struct nvkm_device *device = sor->disp->engine.subdev.device; | |
| 78 | - | const u32 hdmi = head * 0x400; | |
| 79 | - | ||
| 80 | - | nvkm_mask(device, 0x6f0040 + hdmi, 0x00000001, 0x00000000); | |
| 81 | - | nvkm_mask(device, 0x6f004c + hdmi, 0x000000ff, !enable ? 0x00000001 : | |
| 82 | - | 0x00000010); | |
| 83 | - | nvkm_mask(device, 0x6f0040 + hdmi, 0x00000001, 0x00000001); | |
| 84 | - | } | |
| 85 | - | ||
| 86 | - | /* Same core-channel state mirror as gv100_head_state() (assembly at 0x680000, | |
| 87 | - | * armed at +0x8000, per-head method offsets unchanged), but NVD5.0 spaces | |
| 88 | - | * heads 0x800 apart (see NVCA7D_HEAD_SET_*(a) in clca7d.h). | |
| 89 | - | */ | |
| 90 | - | static void | |
| 91 | - | gb202_head_state(struct nvkm_head *head, struct nvkm_head_state *state) | |
| 92 | - | { | |
| 93 | - | struct nvkm_device *device = head->disp->engine.subdev.device; | |
| 94 | - | const u32 hoff = (state == &head->arm) * 0x8000 + head->id * 0x800; | |
| 95 | - | u32 data; | |
| 96 | - | ||
| 97 | - | data = nvkm_rd32(device, 0x682064 + hoff); | |
| 98 | - | state->vtotal = (data & 0xffff0000) >> 16; | |
| 99 | - | state->htotal = (data & 0x0000ffff); | |
| 100 | - | data = nvkm_rd32(device, 0x682068 + hoff); | |
| 101 | - | state->vsynce = (data & 0xffff0000) >> 16; | |
| 102 | - | state->hsynce = (data & 0x0000ffff); | |
| 103 | - | data = nvkm_rd32(device, 0x68206c + hoff); | |
| 104 | - | state->vblanke = (data & 0xffff0000) >> 16; | |
| 105 | - | state->hblanke = (data & 0x0000ffff); | |
| 106 | - | data = nvkm_rd32(device, 0x682070 + hoff); | |
| 107 | - | state->vblanks = (data & 0xffff0000) >> 16; | |
| 108 | - | state->hblanks = (data & 0x0000ffff); | |
| 109 | - | /* Bit 31 is ADJ1000DIV1001, not a HERTZ bit. We don't have enough bits | |
| 110 | - | * to add the full clock in hz on Blackwell (35 bits), but state->hz | |
| 111 | - | * is unused and obsolete under GSP so this is fine. | |
| 112 | - | */ | |
| 113 | - | state->hz = nvkm_rd32(device, 0x68200c + hoff) & 0x7fffffff; | |
| 114 | - | ||
| 115 | - | data = nvkm_rd32(device, 0x682004 + hoff); | |
| 116 | - | switch ((data & 0x000000f0) >> 4) { | |
| 117 | - | case 5: state->or.depth = 30; break; | |
| 118 | - | case 4: state->or.depth = 24; break; | |
| 119 | - | case 1: state->or.depth = 18; break; | |
| 120 | - | default: | |
| 121 | - | state->or.depth = 18; | |
| 122 | - | WARN_ON(1); | |
| 123 | - | break; | |
| 124 | - | } | |
| 125 | - | } | |
| 126 | - | ||
| 127 | - | /* NVD5.0 (GB20x and later) moved the RM head-timing interrupt enable to | |
| 128 | - | * the low-latency vector's EN1 block. The event latch is unchanged. | |
| 129 | - | */ | |
| 130 | - | static void | |
| 131 | - | gb202_head_vblank_put(struct nvkm_head *head) | |
| 132 | - | { | |
| 133 | - | struct nvkm_device *device = head->disp->engine.subdev.device; | |
| 134 | - | ||
| 135 | - | nvkm_mask(device, 0x611ef0 + (head->id * 4), 0x00000002, 0x00000000); | |
| 136 | - | } | |
| 137 | - | ||
| 138 | - | static void | |
| 139 | - | gb202_head_vblank_get(struct nvkm_head *head) | |
| 140 | - | { | |
| 141 | - | struct nvkm_device *device = head->disp->engine.subdev.device; | |
| 142 | - | ||
| 143 | - | nvkm_wr32(device, 0x611800 + (head->id * 4), 0x00000002); | |
| 144 | - | nvkm_mask(device, 0x611ef0 + (head->id * 4), 0x00000002, 0x00000002); | |
| 145 | - | } | |
| 146 | - | ||
| 147 | - | static irqreturn_t | |
| 148 | - | gb202_disp_intr(struct nvkm_inth *inth) | |
| 149 | - | { | |
| 150 | - | struct nvkm_disp *disp = container_of(inth, typeof(*disp), engine.subdev.inth); | |
| 151 | - | irqreturn_t ret = tu102_disp_intr(inth); | |
| 152 | - | ||
| 153 | - | /* The FE interrupt vectors are message-based on NVD5.0. Re-arm the | |
| 154 | - | * low-latency vector so it fires again for any event that latched | |
| 155 | - | * while we were servicing. | |
| 156 | - | */ | |
| 157 | - | nvkm_wr32(disp->engine.subdev.device, 0x611f34, 0x00000001); | |
| 158 | - | return ret; | |
| 159 | - | } | |
| 160 | - | ||
| 161 | - | static const struct nvkm_head_func | |
| 162 | - | gb202_gsp_head = { | |
| 163 | - | .state = gb202_head_state, | |
| 164 | - | .rgpos = gv100_head_rgpos, | |
| 165 | - | .vblank_get = gb202_head_vblank_get, | |
| 166 | - | .vblank_put = gb202_head_vblank_put, | |
| 167 | - | }; | |
| 168 | - | ||
| 169 | - | /* GB20x is GSP-only. This table supplies the register programming the | |
| 170 | - | * GSP-RM display path needs from the chip. | |
| 171 | - | */ | |
| 172 | - | static const struct nvkm_disp_func | |
| 173 | - | gb202_gsp_disp = { | |
| 174 | - | .uevent = &gv100_disp_chan_uevent, | |
| 175 | - | .ramht_size = 0x2000, | |
| 176 | - | /* Head timing arrives on the dedicated low-latency vector. */ | |
| 177 | - | .gsp.intr = gb202_disp_intr, | |
| 178 | - | .gsp.intr_low_latency = true, | |
| 179 | - | .gsp.head = &gb202_gsp_head, | |
| 180 | - | .gsp.hdmi_gcp = gb202_sor_hdmi_gcp, | |
| 181 | - | /* The legacy AVI unit is unchanged on GB20x. */ | |
| 182 | - | .gsp.hdmi_infoframe_avi = gv100_sor_hdmi_infoframe_avi, | |
| 183 | - | .gsp.hdmi_infoframe_vsi = gb202_sor_hdmi_infoframe_vsi, | |
| 184 | - | }; | |
| 185 | - | ||
| 186 | - | int | |
| 187 | - | gb202_disp_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst, | |
| 188 | - | struct nvkm_disp **pdisp) | |
| 189 | - | { | |
| 190 | - | return r535_disp_new(&gb202_gsp_disp, device, type, inst, pdisp); | |
| 191 | - | } | |
modified drivers/gpu/drm/nouveau/nvkm/engine/disp/head.h
| @@ -56,8 +56,6 @@ int gv100_head_new(struct nvkm_disp *, int id); | |||
| 56 | 56 | void gv100_head_state(struct nvkm_head *head, struct nvkm_head_state *state); | |
| 57 | 57 | void gv100_head_rgpos(struct nvkm_head *head, u16 *hline, u16 *vline); | |
| 58 | 58 | ||
| 59 | - | extern const struct nvkm_head_func tu102_gsp_head; | |
| 60 | - | ||
| 61 | 59 | #define HEAD_MSG(h,l,f,a...) do { \ | |
| 62 | 60 | struct nvkm_head *_h = (h); \ | |
| 63 | 61 | nvkm_##l(&_h->disp->engine.subdev, "head-%d: "f"\n", _h->id, ##a); \ | |
modified drivers/gpu/drm/nouveau/nvkm/engine/disp/ior.h
| @@ -194,7 +194,6 @@ void gv100_sor_dp_audio_sym(struct nvkm_ior *, int, u16, u32); | |||
| 194 | 194 | void gv100_sor_dp_watermark(struct nvkm_ior *, int, u8); | |
| 195 | 195 | extern const struct nvkm_ior_func_hda gv100_sor_hda; | |
| 196 | 196 | ||
| 197 | - | void tu102_sor_hdmi_gcp(struct nvkm_ior *, int, bool); | |
| 198 | 197 | void tu102_sor_dp_vcpi(struct nvkm_ior *, int, u8, u8, u16, u16); | |
| 199 | 198 | ||
| 200 | 199 | int nv50_pior_cnt(struct nvkm_disp *, unsigned long *); | |
modified drivers/gpu/drm/nouveau/nvkm/engine/disp/priv.h
| @@ -5,8 +5,6 @@ | |||
| 5 | 5 | #include <engine/disp.h> | |
| 6 | 6 | #include <core/enum.h> | |
| 7 | 7 | struct nvkm_head; | |
| 8 | - | struct nvkm_head_func; | |
| 9 | - | struct nvkm_ior; | |
| 10 | 8 | struct nvkm_outp; | |
| 11 | 9 | struct dcb_output; | |
| 12 | 10 | ||
| @@ -36,20 +34,6 @@ struct nvkm_disp_func { | |||
| 36 | 34 | int (*new)(struct nvkm_disp *, int id); | |
| 37 | 35 | } wndw, head, dac, sor, pior; | |
| 38 | 36 | ||
| 39 | - | /* Register programming that the GSP-RM display path (rm/r535) needs from | |
| 40 | - | * the chip, everything else on that path goes through RM. The hooks are | |
| 41 | - | * called unconditionally and the head table is handed to nvkm_head_new_(). | |
| 42 | - | */ | |
| 43 | - | struct { | |
| 44 | - | irqreturn_t (*intr)(struct nvkm_inth *); | |
| 45 | - | /* Head-timing interrupts arrive on a second DISP vector. */ | |
| 46 | - | bool intr_low_latency; | |
| 47 | - | const struct nvkm_head_func *head; | |
| 48 | - | void (*hdmi_gcp)(struct nvkm_ior *, int head, bool enable); | |
| 49 | - | void (*hdmi_infoframe_avi)(struct nvkm_ior *, int head, void *data, u32 size); | |
| 50 | - | void (*hdmi_infoframe_vsi)(struct nvkm_ior *, int head, void *data, u32 size); | |
| 51 | - | } gsp; | |
| 52 | - | ||
| 53 | 37 | u16 ramht_size; | |
| 54 | 38 | ||
| 55 | 39 | struct nvkm_sclass root; | |
| @@ -88,7 +72,6 @@ int gv100_disp_wndw_cnt(struct nvkm_disp *, unsigned long *); | |||
| 88 | 72 | int gv100_disp_caps_new(const struct nvkm_oclass *, void *, u32, struct nvkm_object **); | |
| 89 | 73 | ||
| 90 | 74 | int tu102_disp_init(struct nvkm_disp *); | |
| 91 | - | irqreturn_t tu102_disp_intr(struct nvkm_inth *); | |
| 92 | 75 | ||
| 93 | 76 | void nv50_disp_dptmds_war_2(struct nvkm_disp *, struct dcb_output *); | |
| 94 | 77 | void nv50_disp_dptmds_war_3(struct nvkm_disp *, struct dcb_output *); | |
modified drivers/gpu/drm/nouveau/nvkm/engine/disp/tu102.c
| @@ -30,21 +30,6 @@ | |||
| 30 | 30 | ||
| 31 | 31 | #include <nvif/class.h> | |
| 32 | 32 | ||
| 33 | - | /* General Control Packet: bracket an audio enable/disable with AVMute | |
| 34 | - | * through the legacy GCP SF unit. Used by the GSP-RM path, which sends the | |
| 35 | - | * equivalent packet via RM as well but keeps the direct write in sync. | |
| 36 | - | */ | |
| 37 | - | void | |
| 38 | - | tu102_sor_hdmi_gcp(struct nvkm_ior *sor, int head, bool enable) | |
| 39 | - | { | |
| 40 | - | struct nvkm_device *device = sor->disp->engine.subdev.device; | |
| 41 | - | const u32 hdmi = head * 0x400; | |
| 42 | - | ||
| 43 | - | nvkm_mask(device, 0x6f00c0 + hdmi, 0x00000001, 0x00000000); | |
| 44 | - | nvkm_wr32(device, 0x6f00cc + hdmi, !enable ? 0x00000001 : 0x00000010); | |
| 45 | - | nvkm_mask(device, 0x6f00c0 + hdmi, 0x00000001, 0x00000001); | |
| 46 | - | } | |
| 47 | - | ||
| 48 | 33 | void | |
| 49 | 34 | tu102_sor_dp_vcpi(struct nvkm_ior *sor, int head, u8 slot, u8 slot_nr, u16 pbn, u16 aligned) | |
| 50 | 35 | { | |
| @@ -119,64 +104,6 @@ tu102_sor_new(struct nvkm_disp *disp, int id) | |||
| 119 | 104 | return nvkm_ior_new_(&tu102_sor, disp, SOR, id, hda & BIT(id)); | |
| 120 | 105 | } | |
| 121 | 106 | ||
| 122 | - | /* The GSP-RM display path leaves head-timing (vblank) interrupts and their | |
| 123 | - | * enables to us. These program the RM head-timing line (bit 1 of the | |
| 124 | - | * per-head enable, not the bit nvkm's own gv100 path uses). | |
| 125 | - | */ | |
| 126 | - | static void | |
| 127 | - | tu102_head_vblank_put(struct nvkm_head *head) | |
| 128 | - | { | |
| 129 | - | struct nvkm_device *device = head->disp->engine.subdev.device; | |
| 130 | - | ||
| 131 | - | nvkm_mask(device, 0x611d80 + (head->id * 4), 0x00000002, 0x00000000); | |
| 132 | - | } | |
| 133 | - | ||
| 134 | - | static void | |
| 135 | - | tu102_head_vblank_get(struct nvkm_head *head) | |
| 136 | - | { | |
| 137 | - | struct nvkm_device *device = head->disp->engine.subdev.device; | |
| 138 | - | ||
| 139 | - | nvkm_wr32(device, 0x611800 + (head->id * 4), 0x00000002); | |
| 140 | - | nvkm_mask(device, 0x611d80 + (head->id * 4), 0x00000002, 0x00000002); | |
| 141 | - | } | |
| 142 | - | ||
| 143 | - | const struct nvkm_head_func | |
| 144 | - | tu102_gsp_head = { | |
| 145 | - | .state = gv100_head_state, | |
| 146 | - | .rgpos = gv100_head_rgpos, | |
| 147 | - | .vblank_get = tu102_head_vblank_get, | |
| 148 | - | .vblank_put = tu102_head_vblank_put, | |
| 149 | - | }; | |
| 150 | - | ||
| 151 | - | static void | |
| 152 | - | tu102_disp_intr_head_timing(struct nvkm_disp *disp, int head) | |
| 153 | - | { | |
| 154 | - | struct nvkm_subdev *subdev = &disp->engine.subdev; | |
| 155 | - | struct nvkm_device *device = subdev->device; | |
| 156 | - | u32 stat = nvkm_rd32(device, 0x611c00 + (head * 0x04)); | |
| 157 | - | ||
| 158 | - | if (stat & 0x00000002) { | |
| 159 | - | nvkm_disp_vblank(disp, head); | |
| 160 | - | ||
| 161 | - | nvkm_wr32(device, 0x611800 + (head * 0x04), 0x00000002); | |
| 162 | - | } | |
| 163 | - | } | |
| 164 | - | ||
| 165 | - | irqreturn_t | |
| 166 | - | tu102_disp_intr(struct nvkm_inth *inth) | |
| 167 | - | { | |
| 168 | - | struct nvkm_disp *disp = container_of(inth, typeof(*disp), engine.subdev.inth); | |
| 169 | - | struct nvkm_subdev *subdev = &disp->engine.subdev; | |
| 170 | - | struct nvkm_device *device = subdev->device; | |
| 171 | - | unsigned long mask = nvkm_rd32(device, 0x611ec0) & 0x000000ff; | |
| 172 | - | int head; | |
| 173 | - | ||
| 174 | - | for_each_set_bit(head, &mask, 8) | |
| 175 | - | tu102_disp_intr_head_timing(disp, head); | |
| 176 | - | ||
| 177 | - | return IRQ_HANDLED; | |
| 178 | - | } | |
| 179 | - | ||
| 180 | 107 | int | |
| 181 | 108 | tu102_disp_init(struct nvkm_disp *disp) | |
| 182 | 109 | { | |
| @@ -303,23 +230,12 @@ tu102_disp = { | |||
| 303 | 230 | }, | |
| 304 | 231 | }; | |
| 305 | 232 | ||
| 306 | - | static const struct nvkm_disp_func | |
| 307 | - | tu102_gsp_disp = { | |
| 308 | - | .uevent = &gv100_disp_chan_uevent, | |
| 309 | - | .ramht_size = 0x2000, | |
| 310 | - | .gsp.intr = tu102_disp_intr, | |
| 311 | - | .gsp.head = &tu102_gsp_head, | |
| 312 | - | .gsp.hdmi_gcp = tu102_sor_hdmi_gcp, | |
| 313 | - | .gsp.hdmi_infoframe_avi = gv100_sor_hdmi_infoframe_avi, | |
| 314 | - | .gsp.hdmi_infoframe_vsi = gv100_sor_hdmi_infoframe_vsi, | |
| 315 | - | }; | |
| 316 | - | ||
| 317 | 233 | int | |
| 318 | 234 | tu102_disp_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst, | |
| 319 | 235 | struct nvkm_disp **pdisp) | |
| 320 | 236 | { | |
| 321 | 237 | if (nvkm_gsp_rm(device->gsp)) | |
| 322 | - | return r535_disp_new(&tu102_gsp_disp, device, type, inst, pdisp); | |
| 238 | + | return r535_disp_new(&tu102_disp, device, type, inst, pdisp); | |
| 323 | 239 | ||
| 324 | 240 | return nvkm_disp_new_(&tu102_disp, device, type, inst, pdisp); | |
| 325 | 241 | } | |
modified drivers/gpu/drm/nouveau/nvkm/engine/disp/uoutp.c
| @@ -253,7 +253,8 @@ nvkm_uoutp_mthd_hdmi(struct nvkm_outp *outp, void *argv, u32 argc) | |||
| 253 | 253 | ||
| 254 | 254 | if (!ior->func->hdmi || | |
| 255 | 255 | args->v0.max_ac_packet > 0x1f || | |
| 256 | - | args->v0.rekey > 0x7f) | |
| 256 | + | args->v0.rekey > 0x7f || | |
| 257 | + | (args->v0.scdc && !ior->func->hdmi->scdc)) | |
| 257 | 258 | return -EINVAL; | |
| 258 | 259 | ||
| 259 | 260 | if (!args->v0.enable) { | |
modified drivers/gpu/drm/nouveau/nvkm/subdev/clk/base.c
| @@ -199,18 +199,16 @@ nvkm_cstate_prog(struct nvkm_clk *clk, struct nvkm_pstate *pstate, int cstatei) | |||
| 199 | 199 | } | |
| 200 | 200 | ||
| 201 | 201 | if (volt) { | |
| 202 | - | int err = nvkm_volt_set_id(volt, cstate->voltage, | |
| 203 | - | pstate->base.voltage, clk->temp, -1); | |
| 204 | - | ||
| 205 | - | if (err && err != -ENODEV) | |
| 206 | - | nvkm_error(subdev, "failed to lower voltage: %d\n", err); | |
| 202 | + | ret = nvkm_volt_set_id(volt, cstate->voltage, | |
| 203 | + | pstate->base.voltage, clk->temp, -1); | |
| 204 | + | if (ret && ret != -ENODEV) | |
| 205 | + | nvkm_error(subdev, "failed to lower voltage: %d\n", ret); | |
| 207 | 206 | } | |
| 208 | 207 | ||
| 209 | 208 | if (therm) { | |
| 210 | - | int err = nvkm_therm_cstate(therm, pstate->fanspeed, -1); | |
| 211 | - | ||
| 212 | - | if (err && err != -ENODEV) | |
| 213 | - | nvkm_error(subdev, "failed to lower fan speed: %d\n", err); | |
| 209 | + | ret = nvkm_therm_cstate(therm, pstate->fanspeed, -1); | |
| 210 | + | if (ret && ret != -ENODEV) | |
| 211 | + | nvkm_error(subdev, "failed to lower fan speed: %d\n", ret); | |
| 214 | 212 | } | |
| 215 | 213 | ||
| 216 | 214 | return ret; | |
| @@ -272,19 +270,13 @@ nvkm_pstate_prog(struct nvkm_clk *clk, int pstatei) | |||
| 272 | 270 | struct nvkm_fb *fb = subdev->device->fb; | |
| 273 | 271 | struct nvkm_pci *pci = subdev->device->pci; | |
| 274 | 272 | struct nvkm_pstate *pstate; | |
| 275 | - | bool found = false; | |
| 276 | 273 | int ret, idx = 0; | |
| 277 | 274 | ||
| 278 | 275 | list_for_each_entry(pstate, &clk->states, head) { | |
This diff is too large to show in full - only the first part is shown.