OSDN Git Service

Merge branch 'drm-fixes-5.0' of git://people.freedesktop.org/~agd5f/linux into drm...
authorDave Airlie <airlied@redhat.com>
Thu, 17 Jan 2019 23:10:09 +0000 (09:10 +1000)
committerDave Airlie <airlied@redhat.com>
Thu, 17 Jan 2019 23:10:21 +0000 (09:10 +1000)
Fixes for 5.0:
- Fix KFD on ARM64
- Fix KFD topology with mixed APU and dGPU systems
- Powerplay fix for vega12
- DC Raven fixes
- Freesync fix

Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Alex Deucher <alexdeucher@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190116224524.3314-1-alexander.deucher@amd.com
448 files changed:
Documentation/ABI/testing/sysfs-block
Documentation/ABI/testing/sysfs-block-zram
Documentation/block/bfq-iosched.txt
Documentation/block/null_blk.txt
Documentation/block/queue-sysfs.txt
Documentation/blockdev/zram.txt
Documentation/devicetree/bindings/reset/socfpga-reset.txt
Documentation/devicetree/bindings/reset/uniphier-reset.txt
Documentation/driver-model/bus.txt
Documentation/features/core/cBPF-JIT/arch-support.txt
Documentation/features/core/eBPF-JIT/arch-support.txt
Documentation/features/core/generic-idle-thread/arch-support.txt
Documentation/features/core/jump-labels/arch-support.txt
Documentation/features/core/tracehook/arch-support.txt
Documentation/features/debug/KASAN/arch-support.txt
Documentation/features/debug/gcov-profile-all/arch-support.txt
Documentation/features/debug/kgdb/arch-support.txt
Documentation/features/debug/kprobes-on-ftrace/arch-support.txt
Documentation/features/debug/kprobes/arch-support.txt
Documentation/features/debug/kretprobes/arch-support.txt
Documentation/features/debug/optprobes/arch-support.txt
Documentation/features/debug/stackprotector/arch-support.txt
Documentation/features/debug/uprobes/arch-support.txt
Documentation/features/debug/user-ret-profiler/arch-support.txt
Documentation/features/io/dma-contiguous/arch-support.txt
Documentation/features/locking/cmpxchg-local/arch-support.txt
Documentation/features/locking/lockdep/arch-support.txt
Documentation/features/locking/queued-rwlocks/arch-support.txt
Documentation/features/locking/queued-spinlocks/arch-support.txt
Documentation/features/locking/rwsem-optimized/arch-support.txt
Documentation/features/perf/kprobes-event/arch-support.txt
Documentation/features/perf/perf-regs/arch-support.txt
Documentation/features/perf/perf-stackdump/arch-support.txt
Documentation/features/sched/membarrier-sync-core/arch-support.txt
Documentation/features/sched/numa-balancing/arch-support.txt
Documentation/features/seccomp/seccomp-filter/arch-support.txt
Documentation/features/time/arch-tick-broadcast/arch-support.txt
Documentation/features/time/clockevents/arch-support.txt
Documentation/features/time/context-tracking/arch-support.txt
Documentation/features/time/irq-time-acct/arch-support.txt
Documentation/features/time/modern-timekeeping/arch-support.txt
Documentation/features/time/virt-cpuacct/arch-support.txt
Documentation/features/vm/ELF-ASLR/arch-support.txt
Documentation/features/vm/PG_uncached/arch-support.txt
Documentation/features/vm/THP/arch-support.txt
Documentation/features/vm/TLB/arch-support.txt
Documentation/features/vm/huge-vmap/arch-support.txt
Documentation/features/vm/ioremap_prot/arch-support.txt
Documentation/features/vm/numa-memblock/arch-support.txt
Documentation/features/vm/pte_special/arch-support.txt
Documentation/filesystems/sysfs.txt
Documentation/trace/coresight-cpu-debug.txt
Documentation/virtual/kvm/amd-memory-encryption.rst
Documentation/x86/resctrl_ui.txt
MAINTAINERS
Makefile
arch/arm/boot/dts/da850-evm.dts
arch/arm/boot/dts/da850-lcdk.dts
arch/arm/boot/dts/kirkwood-dnskw.dtsi
arch/arm/mach-davinci/board-da830-evm.c
arch/arm/mach-davinci/board-da850-evm.c
arch/arm/mach-davinci/board-dm355-evm.c
arch/arm/mach-davinci/board-dm644x-evm.c
arch/arm/mach-davinci/board-omapl138-hawk.c
arch/arm/mach-integrator/impd1.c
arch/arm/mach-socfpga/socfpga.c
arch/arm64/boot/dts/marvell/armada-8040-mcbin.dtsi
arch/arm64/boot/dts/marvell/armada-ap806.dtsi
arch/arm64/configs/defconfig
arch/arm64/include/asm/asm-prototypes.h
arch/arm64/include/asm/cache.h
arch/arm64/include/asm/mmu.h
arch/arm64/include/asm/pgtable-prot.h
arch/arm64/kernel/cpu_errata.c
arch/arm64/kernel/cpufeature.c
arch/arm64/kernel/head.S
arch/arm64/kernel/machine_kexec_file.c
arch/c6x/include/uapi/asm/Kbuild
arch/csky/include/asm/io.h
arch/csky/include/asm/pgalloc.h
arch/csky/kernel/module.c
arch/h8300/include/uapi/asm/Kbuild
arch/hexagon/include/uapi/asm/Kbuild
arch/m68k/include/uapi/asm/Kbuild
arch/microblaze/include/uapi/asm/Kbuild
arch/mips/lantiq/xway/dma.c
arch/openrisc/include/asm/uaccess.h
arch/openrisc/include/uapi/asm/Kbuild
arch/powerpc/platforms/pasemi/dma_lib.c
arch/powerpc/sysdev/fsl_rmu.c
arch/riscv/Kconfig
arch/riscv/include/asm/module.h
arch/riscv/include/asm/ptrace.h
arch/riscv/include/asm/syscall.h
arch/riscv/include/asm/thread_info.h
arch/riscv/include/asm/unistd.h
arch/riscv/kernel/entry.S
arch/riscv/kernel/module-sections.c
arch/riscv/kernel/ptrace.c
arch/riscv/kernel/setup.c
arch/riscv/kernel/smp.c
arch/riscv/kernel/vmlinux.lds.S
arch/unicore32/include/uapi/asm/Kbuild
arch/x86/Kconfig
arch/x86/include/asm/resctrl_sched.h
arch/x86/kernel/cpu/Makefile
arch/x86/kernel/cpu/bugs.c
arch/x86/kernel/cpu/resctrl/Makefile
arch/x86/kvm/svm.c
arch/x86/kvm/vmx/nested.c
arch/x86/kvm/vmx/vmx.c
block/blk-core.c
drivers/acpi/Kconfig
drivers/acpi/arm64/iort.c
drivers/acpi/numa.c
drivers/acpi/pmic/intel_pmic_xpower.c
drivers/acpi/power.c
drivers/ata/ahci.h
drivers/ata/ahci_mvebu.c
drivers/ata/libahci_platform.c
drivers/ata/sata_fsl.c
drivers/atm/he.c
drivers/atm/idt77252.c
drivers/base/power/main.c
drivers/base/power/runtime.c
drivers/block/loop.c
drivers/block/null_blk.h
drivers/block/rbd.c
drivers/block/skd_main.c
drivers/block/zram/zram_drv.c
drivers/block/zram/zram_drv.h
drivers/cpufreq/cpufreq.c
drivers/cpufreq/scmi-cpufreq.c
drivers/cpufreq/scpi-cpufreq.c
drivers/crypto/amcc/crypto4xx_core.c
drivers/crypto/cavium/cpt/cptpf_main.c
drivers/crypto/cavium/cpt/cptvf_main.c
drivers/crypto/cavium/nitrox/nitrox_lib.c
drivers/crypto/ccp/ccp-dev-v5.c
drivers/crypto/hisilicon/sec/sec_algs.c
drivers/crypto/hisilicon/sec/sec_drv.c
drivers/crypto/ixp4xx_crypto.c
drivers/crypto/mediatek/mtk-platform.c
drivers/crypto/qat/qat_common/adf_admin.c
drivers/crypto/qat/qat_common/qat_algs.c
drivers/crypto/qat/qat_common/qat_asym_algs.c
drivers/dma/imx-sdma.c
drivers/dma/mediatek/mtk-hsdma.c
drivers/dma/mxs-dma.c
drivers/dma/xgene-dma.c
drivers/dma/xilinx/xilinx_dma.c
drivers/dma/xilinx/zynqmp_dma.c
drivers/gpu/drm/drm_pci.c
drivers/i2c/busses/i2c-tegra.c
drivers/i2c/i2c-dev.c
drivers/infiniband/hw/bnxt_re/qplib_rcfw.c
drivers/infiniband/hw/bnxt_re/qplib_res.c
drivers/infiniband/hw/cxgb3/cxio_hal.c
drivers/infiniband/hw/cxgb4/qp.c
drivers/infiniband/hw/hfi1/init.c
drivers/infiniband/hw/hfi1/pio.c
drivers/infiniband/hw/hfi1/sdma.c
drivers/infiniband/hw/hns/hns_roce_alloc.c
drivers/infiniband/hw/hns/hns_roce_hw_v2.c
drivers/infiniband/hw/i40iw/i40iw_utils.c
drivers/infiniband/hw/mthca/mthca_memfree.c
drivers/infiniband/hw/ocrdma/ocrdma_hw.c
drivers/infiniband/hw/ocrdma/ocrdma_stats.c
drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
drivers/infiniband/hw/qedr/verbs.c
drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c
drivers/input/touchscreen/raspberrypi-ts.c
drivers/iommu/mtk_iommu_v1.c
drivers/irqchip/irq-csky-apb-intc.c
drivers/media/pci/intel/ipu3/ipu3-cio2.c
drivers/media/platform/mtk-vcodec/mtk_vcodec_util.c
drivers/misc/genwqe/card_utils.c
drivers/mmc/host/sdhci.c
drivers/mtd/mtdcore.c
drivers/mtd/mtdcore.h
drivers/mtd/mtdpart.c
drivers/mtd/nand/raw/qcom_nandc.c
drivers/net/ethernet/aeroflex/greth.c
drivers/net/ethernet/alacritech/slicoss.c
drivers/net/ethernet/amazon/ena/ena_com.c
drivers/net/ethernet/apm/xgene-v2/main.c
drivers/net/ethernet/atheros/alx/main.c
drivers/net/ethernet/atheros/atl1c/atl1c_main.c
drivers/net/ethernet/broadcom/bcm63xx_enet.c
drivers/net/ethernet/broadcom/bcmsysport.c
drivers/net/ethernet/broadcom/bgmac.c
drivers/net/ethernet/broadcom/bnx2.c
drivers/net/ethernet/broadcom/bnx2x/bnx2x.h
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.h
drivers/net/ethernet/broadcom/bnxt/bnxt.c
drivers/net/ethernet/broadcom/bnxt/bnxt_dcb.c
drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c
drivers/net/ethernet/broadcom/tg3.c
drivers/net/ethernet/cavium/thunder/nicvf_queues.c
drivers/net/ethernet/chelsio/cxgb3/sge.c
drivers/net/ethernet/chelsio/cxgb4/sge.c
drivers/net/ethernet/chelsio/cxgb4vf/sge.c
drivers/net/ethernet/emulex/benet/be_cmds.c
drivers/net/ethernet/emulex/benet/be_ethtool.c
drivers/net/ethernet/emulex/benet/be_main.c
drivers/net/ethernet/faraday/ftgmac100.c
drivers/net/ethernet/faraday/ftmac100.c
drivers/net/ethernet/hisilicon/hix5hd2_gmac.c
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c
drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_cmd.c
drivers/net/ethernet/huawei/hinic/hinic_hw_api_cmd.c
drivers/net/ethernet/huawei/hinic/hinic_hw_eqs.c
drivers/net/ethernet/huawei/hinic/hinic_hw_io.c
drivers/net/ethernet/huawei/hinic/hinic_hw_qp.c
drivers/net/ethernet/huawei/hinic/hinic_hw_wq.c
drivers/net/ethernet/ibm/emac/mal.c
drivers/net/ethernet/intel/e1000/e1000_ethtool.c
drivers/net/ethernet/intel/e1000e/netdev.c
drivers/net/ethernet/intel/i40e/i40e_main.c
drivers/net/ethernet/intel/ixgb/ixgb_main.c
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
drivers/net/ethernet/marvell/octeontx2/af/common.h
drivers/net/ethernet/marvell/pxa168_eth.c
drivers/net/ethernet/mediatek/mtk_eth_soc.c
drivers/net/ethernet/mellanox/mlx4/alloc.c
drivers/net/ethernet/mellanox/mlx5/core/alloc.c
drivers/net/ethernet/mellanox/mlx5/core/cmd.c
drivers/net/ethernet/myricom/myri10ge/myri10ge.c
drivers/net/ethernet/netronome/nfp/nfp_net_common.c
drivers/net/ethernet/ni/nixge.c
drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_main.c
drivers/net/ethernet/pasemi/pasemi_mac.c
drivers/net/ethernet/qlogic/qed/qed_cxt.c
drivers/net/ethernet/qlogic/qlcnic/qlcnic_ctx.c
drivers/net/ethernet/qualcomm/emac/emac-mac.c
drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c
drivers/net/ethernet/sfc/falcon/nic.c
drivers/net/ethernet/sfc/nic.c
drivers/net/ethernet/sgi/meth.c
drivers/net/ethernet/socionext/netsec.c
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
drivers/net/ethernet/tundra/tsi108_eth.c
drivers/net/ethernet/xilinx/ll_temac_main.c
drivers/net/ethernet/xilinx/xilinx_axienet_main.c
drivers/net/fddi/defxx.c
drivers/net/fddi/skfp/skfddi.c
drivers/net/vmxnet3/vmxnet3_drv.c
drivers/net/wan/fsl_ucc_hdlc.c
drivers/net/wireless/ath/ath10k/ce.c
drivers/net/wireless/ath/ath10k/mac.c
drivers/net/wireless/ath/ath10k/pci.c
drivers/net/wireless/ath/ath10k/wmi.c
drivers/net/wireless/ath/wcn36xx/dxe.c
drivers/net/wireless/ath/wil6210/txrx_edma.c
drivers/net/wireless/broadcom/b43/dma.c
drivers/net/wireless/broadcom/b43legacy/dma.c
drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c
drivers/net/wireless/intel/iwlwifi/pcie/rx.c
drivers/net/wireless/ralink/rt2x00/rt2x00mmio.c
drivers/ntb/hw/mscc/ntb_hw_switchtec.c
drivers/nvme/host/core.c
drivers/nvme/host/fabrics.c
drivers/nvme/host/multipath.c
drivers/nvme/host/nvme.h
drivers/nvme/host/pci.c
drivers/nvme/host/tcp.c
drivers/opp/core.c
drivers/pci/controller/dwc/pci-meson.c
drivers/pci/controller/pcie-iproc-msi.c
drivers/pci/switch/switchtec.c
drivers/phy/marvell/phy-berlin-sata.c
drivers/rapidio/devices/tsi721.c
drivers/rapidio/devices/tsi721_dma.c
drivers/reset/Kconfig
drivers/reset/Makefile
drivers/reset/core.c
drivers/reset/reset-hsdk.c
drivers/reset/reset-simple.c
drivers/reset/reset-socfpga.c [new file with mode: 0644]
drivers/reset/reset-uniphier-glue.c [moved from drivers/reset/reset-uniphier-usb3.c with 73% similarity]
drivers/s390/net/ism_drv.c
drivers/scsi/3w-sas.c
drivers/scsi/a100u2w.c
drivers/scsi/arcmsr/arcmsr_hba.c
drivers/scsi/be2iscsi/be_main.c
drivers/scsi/be2iscsi/be_mgmt.c
drivers/scsi/bfa/bfad_bsg.c
drivers/scsi/bnx2fc/bnx2fc_hwi.c
drivers/scsi/bnx2fc/bnx2fc_tgt.c
drivers/scsi/bnx2i/bnx2i_hwi.c
drivers/scsi/csiostor/csio_wr.c
drivers/scsi/lpfc/lpfc_bsg.c
drivers/scsi/lpfc/lpfc_init.c
drivers/scsi/lpfc/lpfc_mbox.c
drivers/scsi/lpfc/lpfc_sli.c
drivers/scsi/megaraid/megaraid_mbox.c
drivers/scsi/megaraid/megaraid_sas_base.c
drivers/scsi/megaraid/megaraid_sas_fusion.c
drivers/scsi/mesh.c
drivers/scsi/mvumi.c
drivers/scsi/pm8001/pm8001_sas.c
drivers/scsi/qedf/qedf_main.c
drivers/scsi/qedi/qedi_main.c
drivers/scsi/qla2xxx/qla_attr.c
drivers/scsi/qla2xxx/qla_bsg.c
drivers/scsi/qla2xxx/qla_gs.c
drivers/scsi/qla2xxx/qla_init.c
drivers/scsi/qla4xxx/ql4_init.c
drivers/scsi/qla4xxx/ql4_mbx.c
drivers/scsi/qla4xxx/ql4_nx.c
drivers/scsi/qla4xxx/ql4_os.c
drivers/scsi/smartpqi/smartpqi_init.c
drivers/soc/fsl/qbman/dpaa_sys.c
drivers/soc/renesas/Kconfig
drivers/soc/renesas/r8a774c0-sysc.c
drivers/spi/spi-pic32-sqi.c
drivers/staging/mt7621-eth/mtk_eth_soc.c
drivers/staging/rtl8188eu/core/rtw_security.c
drivers/staging/rtl8723bs/os_dep/sdio_intf.c
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
drivers/staging/vt6655/device_main.c
drivers/tty/serial/Kconfig
drivers/tty/serial/Makefile
drivers/tty/serial/earlycon-riscv-sbi.c [new file with mode: 0644]
drivers/tty/serial/lantiq.c
drivers/tty/tty_io.c
drivers/usb/class/cdc-acm.c
drivers/usb/core/generic.c
drivers/usb/core/quirks.c
drivers/usb/gadget/udc/bdc/bdc_core.c
drivers/usb/host/uhci-hcd.c
drivers/usb/host/xhci-mem.c
drivers/usb/storage/scsiglue.c
drivers/usb/storage/unusual_devs.h
drivers/vfio/pci/trace.h
drivers/vfio/vfio_iommu_type1.c
drivers/video/fbdev/da8xx-fb.c
fs/btrfs/ctree.c
fs/btrfs/ioctl.c
fs/btrfs/volumes.c
fs/ceph/addr.c
fs/ceph/super.c
fs/cifs/cifsfs.h
fs/cifs/cifsglob.h
fs/cifs/cifssmb.c
fs/cifs/connect.c
fs/cifs/dfs_cache.c
fs/cifs/file.c
fs/cifs/inode.c
fs/cifs/smb2file.c
fs/cifs/smb2pdu.c
fs/cifs/transport.c
fs/hugetlbfs/inode.c
fs/sysfs/dir.c
fs/sysfs/file.c
fs/sysfs/group.c
fs/sysfs/symlink.c
include/linux/ceph/libceph.h
include/linux/ceph/osd_client.h
include/linux/compiler-gcc.h
include/linux/dma-mapping.h
include/linux/mmzone.h
include/linux/module.h
include/linux/pci-dma-compat.h
include/linux/phy/phy.h
include/linux/pm_opp.h
include/linux/qcom_scm.h
include/linux/reset.h
include/linux/sched.h
include/uapi/linux/audit.h
kernel/fork.c
kernel/sys.c
mm/hugetlb.c
mm/kasan/common.c
mm/memory-failure.c
mm/memory.c
mm/migrate.c
mm/page_alloc.c
mm/rmap.c
mm/slab.c
mm/slub.c
mm/usercopy.c
mm/userfaultfd.c
mm/util.c
net/ceph/ceph_common.c
net/ceph/debugfs.c
net/ceph/osd_client.c
samples/seccomp/Makefile
scripts/coccinelle/api/alloc/alloc_cast.cocci
scripts/coccinelle/api/alloc/zalloc-simple.cocci
scripts/mod/modpost.c
sound/aoa/soundbus/i2sbus/core.c
sound/pci/cs46xx/dsp_spos.c
sound/pci/hda/patch_realtek.c
sound/sparc/dbri.c
sound/usb/card.c
sound/usb/mixer.c
sound/usb/quirks-table.h
sound/usb/quirks.c
sound/usb/stream.c
tools/arch/powerpc/include/uapi/asm/unistd.h [deleted file]
tools/arch/riscv/include/uapi/asm/bitsperlong.h [new file with mode: 0644]
tools/arch/x86/include/asm/cpufeatures.h
tools/arch/x86/include/asm/disabled-features.h
tools/include/uapi/asm-generic/unistd.h
tools/include/uapi/asm/bitsperlong.h
tools/include/uapi/drm/i915_drm.h
tools/include/uapi/linux/fs.h
tools/include/uapi/linux/if_link.h
tools/include/uapi/linux/in.h
tools/include/uapi/linux/kvm.h
tools/include/uapi/linux/mount.h [new file with mode: 0644]
tools/include/uapi/linux/prctl.h
tools/include/uapi/linux/vhost.h
tools/lib/traceevent/event-parse-api.c
tools/lib/traceevent/event-parse-local.h
tools/lib/traceevent/event-parse.c
tools/lib/traceevent/event-parse.h
tools/lib/traceevent/plugin_kvm.c
tools/lib/traceevent/trace-seq.c
tools/perf/Makefile.perf
tools/perf/arch/arm/tests/Build
tools/perf/arch/arm/tests/arch-tests.c
tools/perf/arch/arm/tests/vectors-page.c [new file with mode: 0644]
tools/perf/arch/powerpc/Makefile
tools/perf/arch/powerpc/entry/syscalls/mksyscalltbl
tools/perf/arch/powerpc/entry/syscalls/syscall.tbl [new file with mode: 0644]
tools/perf/builtin-stat.c
tools/perf/builtin-top.c
tools/perf/builtin-trace.c
tools/perf/check-headers.sh
tools/perf/perf-read-vdso.c
tools/perf/tests/shell/lib/probe_vfs_getname.sh
tools/perf/tests/tests.h
tools/perf/trace/beauty/mount_flags.sh
tools/perf/trace/beauty/prctl_option.sh
tools/perf/util/annotate.c
tools/perf/util/callchain.c
tools/perf/util/callchain.h
tools/perf/util/find-map.c [moved from tools/perf/util/find-vdso-map.c with 71% similarity]
tools/perf/util/machine.c
tools/perf/util/strbuf.c
tools/perf/util/symbol.c
tools/perf/util/vdso.c
tools/thermal/tmon/Makefile
tools/vm/page_owner_sort.c
virt/kvm/kvm_main.c

index 7710d40..dfad742 100644 (file)
@@ -279,3 +279,12 @@ Description:
                size in 512B sectors of the zones of the device, with
                the eventual exception of the last zone of the device
                which may be smaller.
+
+What:          /sys/block/<disk>/queue/io_timeout
+Date:          November 2018
+Contact:       Weiping Zhang <zhangweiping@didiglobal.com>
+Description:
+               io_timeout is the request timeout in milliseconds. If a request
+               does not complete in this time then the block driver timeout
+               handler is invoked. That timeout handler can decide to retry
+               the request, to fail it or to start a device recovery strategy.
index 9d2339a..14b2bf2 100644 (file)
@@ -122,11 +122,18 @@ Description:
                statistics (bd_count, bd_reads, bd_writes) in a format
                similar to block layer statistics file format.
 
+What:          /sys/block/zram<id>/writeback_limit_enable
+Date:          November 2018
+Contact:       Minchan Kim <minchan@kernel.org>
+Description:
+               The writeback_limit_enable file is read-write and specifies
+               eanbe of writeback_limit feature. "1" means eable the feature.
+               No limit "0" is the initial state.
+
 What:          /sys/block/zram<id>/writeback_limit
 Date:          November 2018
 Contact:       Minchan Kim <minchan@kernel.org>
 Description:
                The writeback_limit file is read-write and specifies the maximum
                amount of writeback ZRAM can do. The limit could be changed
-               in run time and "0" means disable the limit.
-               No limit is the initial state.
+               in run time.
index 8d8d8f0..98a8dd5 100644 (file)
@@ -357,6 +357,13 @@ video playing/streaming, a very low drop rate may be more important
 than maximum throughput. In these cases, consider setting the
 strict_guarantees parameter.
 
+slice_idle_us
+-------------
+
+Controls the same tuning parameter as slice_idle, but in microseconds.
+Either tunable can be used to set idling behavior.  Afterwards, the
+other tunable will reflect the newly set value in sysfs.
+
 strict_guarantees
 -----------------
 
index ea2dafe..4cad102 100644 (file)
@@ -88,7 +88,8 @@ shared_tags=[0/1]: Default: 0
 
 zoned=[0/1]: Default: 0
   0: Block device is exposed as a random-access block device.
-  1: Block device is exposed as a host-managed zoned block device.
+  1: Block device is exposed as a host-managed zoned block device. Requires
+     CONFIG_BLK_DEV_ZONED.
 
 zone_size=[MB]: Default: 256
   Per zone size when exposed as a zoned block device. Must be a power of two.
index 39e286d..83b457e 100644 (file)
@@ -67,6 +67,13 @@ If set to a value larger than 0, the kernel will put the process issuing
 IO to sleep for this amount of microseconds before entering classic
 polling.
 
+io_timeout (RW)
+---------------
+io_timeout is the request timeout in milliseconds. If a request does not
+complete in this time then the block driver timeout handler is invoked.
+That timeout handler can decide to retry the request, to fail it or to start
+a device recovery strategy.
+
 iostats (RW)
 -------------
 This file is used to control (on/off) the iostats accounting of the
index 436c5e9..4df0ce2 100644 (file)
@@ -156,22 +156,23 @@ Per-device statistics are exported as various nodes under /sys/block/zram<id>/
 A brief description of exported device attributes. For more details please
 read Documentation/ABI/testing/sysfs-block-zram.
 
-Name            access            description
-----            ------            -----------
-disksize          RW    show and set the device's disk size
-initstate         RO    shows the initialization state of the device
-reset             WO    trigger device reset
-mem_used_max      WO    reset the `mem_used_max' counter (see later)
-mem_limit         WO    specifies the maximum amount of memory ZRAM can use
-                        to store the compressed data
-writeback_limit   WO    specifies the maximum amount of write IO zram can
-                       write out to backing device as 4KB unit
-max_comp_streams  RW    the number of possible concurrent compress operations
-comp_algorithm    RW    show and change the compression algorithm
-compact           WO    trigger memory compaction
-debug_stat        RO    this file is used for zram debugging purposes
-backing_dev      RW    set up backend storage for zram to write out
-idle             WO    mark allocated slot as idle
+Name                   access            description
+----                   ------            -----------
+disksize               RW      show and set the device's disk size
+initstate              RO      shows the initialization state of the device
+reset                  WO      trigger device reset
+mem_used_max           WO      reset the `mem_used_max' counter (see later)
+mem_limit              WO      specifies the maximum amount of memory ZRAM can use
+                               to store the compressed data
+writeback_limit        WO      specifies the maximum amount of write IO zram can
+                               write out to backing device as 4KB unit
+writeback_limit_enable  RW     show and set writeback_limit feature
+max_comp_streams       RW      the number of possible concurrent compress operations
+comp_algorithm         RW      show and change the compression algorithm
+compact                WO      trigger memory compaction
+debug_stat             RO      this file is used for zram debugging purposes
+backing_dev            RW      set up backend storage for zram to write out
+idle                   WO      mark allocated slot as idle
 
 
 User space is advised to use the following files to read the device statistics.
@@ -280,32 +281,51 @@ With the command, zram writeback idle pages from memory to the storage.
 If there are lots of write IO with flash device, potentially, it has
 flash wearout problem so that admin needs to design write limitation
 to guarantee storage health for entire product life.
-To overcome the concern, zram supports "writeback_limit".
-The "writeback_limit"'s default value is 0 so that it doesn't limit
-any writeback. If admin want to measure writeback count in a certain
-period, he could know it via /sys/block/zram0/bd_stat's 3rd column.
+
+To overcome the concern, zram supports "writeback_limit" feature.
+The "writeback_limit_enable"'s default value is 0 so that it doesn't limit
+any writeback. IOW, if admin want to apply writeback budget, he should
+enable writeback_limit_enable via
+
+       $ echo 1 > /sys/block/zramX/writeback_limit_enable
+
+Once writeback_limit_enable is set, zram doesn't allow any writeback
+until admin set the budget via /sys/block/zramX/writeback_limit.
+
+(If admin doesn't enable writeback_limit_enable, writeback_limit's value
+assigned via /sys/block/zramX/writeback_limit is meaninless.)
 
 If admin want to limit writeback as per-day 400M, he could do it
 like below.
 
-    MB_SHIFT=20
-    4K_SHIFT=12
-    echo $((400<<MB_SHIFT>>4K_SHIFT)) > \
-           /sys/block/zram0/writeback_limit.
+       $ MB_SHIFT=20
+       $ 4K_SHIFT=12
+       $ echo $((400<<MB_SHIFT>>4K_SHIFT)) > \
+               /sys/block/zram0/writeback_limit.
+       $ echo 1 > /sys/block/zram0/writeback_limit_enable
 
-If admin want to allow further write again, he could do it like below
+If admin want to allow further write again once the bugdet is exausted,
+he could do it like below
 
-    echo 0 > /sys/block/zram0/writeback_limit
+       $ echo $((400<<MB_SHIFT>>4K_SHIFT)) > \
+               /sys/block/zram0/writeback_limit
 
 If admin want to see remaining writeback budget since he set,
 
-    cat /sys/block/zram0/writeback_limit
+       $ cat /sys/block/zramX/writeback_limit
+
+If admin want to disable writeback limit, he could do
+
+       $ echo 0 > /sys/block/zramX/writeback_limit_enable
 
 The writeback_limit count will reset whenever you reset zram(e.g.,
 system reboot, echo 1 > /sys/block/zramX/reset) so keeping how many of
 writeback happened until you reset the zram to allocate extra writeback
 budget in next setting is user's job.
 
+If admin want to measure writeback count in a certain period, he could
+know it via /sys/block/zram0/bd_stat's 3rd column.
+
 = memory tracking
 
 With CONFIG_ZRAM_MEMORY_TRACKING, user can know information of the
index 98c9f56..38fe34f 100644 (file)
@@ -1,7 +1,8 @@
 Altera SOCFPGA Reset Manager
 
 Required properties:
-- compatible : "altr,rst-mgr"
+- compatible : "altr,rst-mgr" for (Cyclone5/Arria5/Arria10)
+              "altr,stratix10-rst-mgr","altr,rst-mgr" for Stratix10 ARM64 SoC
 - reg : Should contain 1 register ranges(address and length)
 - altr,modrst-offset : Should contain the offset of the first modrst register.
 - #reset-cells: 1
index 101743d..ea00517 100644 (file)
@@ -120,27 +120,30 @@ Example:
        };
 
 
-USB3 core reset
----------------
+Peripheral core reset in glue layer
+-----------------------------------
 
-USB3 core reset belongs to USB3 glue layer. Before using the core reset,
-it is necessary to control the clocks and resets to enable this layer.
-These clocks and resets should be described in each property.
+Some peripheral core reset belongs to its own glue layer. Before using
+this core reset, it is necessary to control the clocks and resets to enable
+this layer. These clocks and resets should be described in each property.
 
 Required properties:
 - compatible: Should be
-    "socionext,uniphier-pro4-usb3-reset" - for Pro4 SoC
-    "socionext,uniphier-pxs2-usb3-reset" - for PXs2 SoC
-    "socionext,uniphier-ld20-usb3-reset" - for LD20 SoC
-    "socionext,uniphier-pxs3-usb3-reset" - for PXs3 SoC
+    "socionext,uniphier-pro4-usb3-reset" - for Pro4 SoC USB3
+    "socionext,uniphier-pxs2-usb3-reset" - for PXs2 SoC USB3
+    "socionext,uniphier-ld20-usb3-reset" - for LD20 SoC USB3
+    "socionext,uniphier-pxs3-usb3-reset" - for PXs3 SoC USB3
+    "socionext,uniphier-pro4-ahci-reset" - for Pro4 SoC AHCI
+    "socionext,uniphier-pxs2-ahci-reset" - for PXs2 SoC AHCI
+    "socionext,uniphier-pxs3-ahci-reset" - for PXs3 SoC AHCI
 - #reset-cells: Should be 1.
 - reg: Specifies offset and length of the register set for the device.
-- clocks: A list of phandles to the clock gate for USB3 glue layer.
+- clocks: A list of phandles to the clock gate for the glue layer.
        According to the clock-names, appropriate clocks are required.
 - clock-names: Should contain
     "gio", "link" - for Pro4 SoC
     "link"        - for others
-- resets: A list of phandles to the reset control for USB3 glue layer.
+- resets: A list of phandles to the reset control for the glue layer.
        According to the reset-names, appropriate resets are required.
 - reset-names: Should contain
     "gio", "link" - for Pro4 SoC
index b577a45..c247b48 100644 (file)
@@ -124,11 +124,11 @@ struct bus_attribute {
        ssize_t (*store)(struct bus_type *, const char * buf, size_t count);
 };
 
-Bus drivers can export attributes using the BUS_ATTR macro that works
-similarly to the DEVICE_ATTR macro for devices. For example, a definition 
-like this:
+Bus drivers can export attributes using the BUS_ATTR_RW macro that works
+similarly to the DEVICE_ATTR_RW macro for devices. For example, a
+definition like this:
 
-static BUS_ATTR(debug,0644,show_debug,store_debug);
+static BUS_ATTR_RW(debug);
 
 is equivalent to declaring:
 
index 90459cd..8620c38 100644 (file)
@@ -11,6 +11,7 @@
     |         arm: | TODO |
     |       arm64: | TODO |
     |         c6x: | TODO |
+    |        csky: | TODO |
     |       h8300: | TODO |
     |     hexagon: | TODO |
     |        ia64: | TODO |
index c90a038..9ae6e8d 100644 (file)
@@ -11,6 +11,7 @@
     |         arm: |  ok  |
     |       arm64: |  ok  |
     |         c6x: | TODO |
+    |        csky: | TODO |
     |       h8300: | TODO |
     |     hexagon: | TODO |
     |        ia64: | TODO |
index 0ef6acd..365df2c 100644 (file)
@@ -11,6 +11,7 @@
     |         arm: |  ok  |
     |       arm64: |  ok  |
     |         c6x: | TODO |
+    |        csky: |  ok  |
     |       h8300: | TODO |
     |     hexagon: |  ok  |
     |        ia64: |  ok  |
index 6011139..7fc2e24 100644 (file)
@@ -11,6 +11,7 @@
     |         arm: |  ok  |
     |       arm64: |  ok  |
     |         c6x: | TODO |
+    |        csky: | TODO |
     |       h8300: | TODO |
     |     hexagon: | TODO |
     |        ia64: | TODO |
index f44c274..d344b99 100644 (file)
@@ -11,6 +11,7 @@
     |         arm: |  ok  |
     |       arm64: |  ok  |
     |         c6x: |  ok  |
+    |        csky: |  ok  |
     |       h8300: | TODO |
     |     hexagon: |  ok  |
     |        ia64: |  ok  |
index 282ecc8..304dcd4 100644 (file)
@@ -11,6 +11,7 @@
     |         arm: | TODO |
     |       arm64: |  ok  |
     |         c6x: | TODO |
+    |        csky: | TODO |
     |       h8300: | TODO |
     |     hexagon: | TODO |
     |        ia64: | TODO |
index 01b2b30..059d58a 100644 (file)
@@ -11,6 +11,7 @@
     |         arm: |  ok  |
     |       arm64: |  ok  |
     |         c6x: | TODO |
+    |        csky: | TODO |
     |       h8300: | TODO |
     |     hexagon: | TODO |
     |        ia64: | TODO |
index 3b4dff2..3e6b8f0 100644 (file)
@@ -11,6 +11,7 @@
     |         arm: |  ok  |
     |       arm64: |  ok  |
     |         c6x: | TODO |
+    |        csky: | TODO |
     |       h8300: |  ok  |
     |     hexagon: |  ok  |
     |        ia64: | TODO |
index 7e963d0..68f2669 100644 (file)
@@ -11,6 +11,7 @@
     |         arm: | TODO |
     |       arm64: | TODO |
     |         c6x: | TODO |
+    |        csky: | TODO |
     |       h8300: | TODO |
     |     hexagon: | TODO |
     |        ia64: | TODO |
index 4ada027..f4e45bd 100644 (file)
@@ -11,6 +11,7 @@
     |         arm: |  ok  |
     |       arm64: |  ok  |
     |         c6x: | TODO |
+    |        csky: | TODO |
     |       h8300: | TODO |
     |     hexagon: | TODO |
     |        ia64: |  ok  |
index 044e13f..1d5651e 100644 (file)
@@ -11,6 +11,7 @@
     |         arm: |  ok  |
     |       arm64: |  ok  |
     |         c6x: | TODO |
+    |        csky: | TODO |
     |       h8300: | TODO |
     |     hexagon: | TODO |
     |        ia64: |  ok  |
index dce7669..fb297a8 100644 (file)
@@ -11,6 +11,7 @@
     |         arm: |  ok  |
     |       arm64: | TODO |
     |         c6x: | TODO |
+    |        csky: | TODO |
     |       h8300: | TODO |
     |     hexagon: | TODO |
     |        ia64: | TODO |
index 954ac1c..9999ea5 100644 (file)
@@ -11,6 +11,7 @@
     |         arm: |  ok  |
     |       arm64: |  ok  |
     |         c6x: | TODO |
+    |        csky: | TODO |
     |       h8300: | TODO |
     |     hexagon: | TODO |
     |        ia64: | TODO |
index 1a3f9d3..1c577d0 100644 (file)
@@ -11,6 +11,7 @@
     |         arm: |  ok  |
     |       arm64: |  ok  |
     |         c6x: | TODO |
+    |        csky: | TODO |
     |       h8300: | TODO |
     |     hexagon: | TODO |
     |        ia64: | TODO |
index 1d78d10..6bfa36b 100644 (file)
@@ -11,6 +11,7 @@
     |         arm: | TODO |
     |       arm64: | TODO |
     |         c6x: | TODO |
+    |        csky: | TODO |
     |       h8300: | TODO |
     |     hexagon: | TODO |
     |        ia64: | TODO |
index 30c072d..eb28b5c 100644 (file)
@@ -11,6 +11,7 @@
     |         arm: |  ok  |
     |       arm64: |  ok  |
     |         c6x: | TODO |
+    |        csky: |  ok  |
     |       h8300: | TODO |
     |     hexagon: | TODO |
     |        ia64: | TODO |
index 51704a2..242ff5a 100644 (file)
@@ -11,6 +11,7 @@
     |         arm: | TODO |
     |       arm64: |  ok  |
     |         c6x: | TODO |
+    |        csky: | TODO |
     |       h8300: | TODO |
     |     hexagon: | TODO |
     |        ia64: | TODO |
index bd39c5e..941fd5b 100644 (file)
@@ -11,6 +11,7 @@
     |         arm: |  ok  |
     |       arm64: |  ok  |
     |         c6x: | TODO |
+    |        csky: | TODO |
     |       h8300: | TODO |
     |     hexagon: |  ok  |
     |        ia64: | TODO |
index da7aff3..c683da1 100644 (file)
@@ -11,6 +11,7 @@
     |         arm: | TODO |
     |       arm64: |  ok  |
     |         c6x: | TODO |
+    |        csky: |  ok  |
     |       h8300: | TODO |
     |     hexagon: | TODO |
     |        ia64: | TODO |
index 478e910..e3080b8 100644 (file)
@@ -11,6 +11,7 @@
     |         arm: | TODO |
     |       arm64: | TODO |
     |         c6x: | TODO |
+    |        csky: | TODO |
     |       h8300: | TODO |
     |     hexagon: | TODO |
     |        ia64: | TODO |
index e54b1f1..7521d75 100644 (file)
@@ -11,6 +11,7 @@
     |         arm: |  ok  |
     |       arm64: |  ok  |
     |         c6x: | TODO |
+    |        csky: | TODO |
     |       h8300: | TODO |
     |     hexagon: | TODO |
     |        ia64: |  ok  |
index 7331402..d8278bf 100644 (file)
@@ -11,6 +11,7 @@
     |         arm: |  ok  |
     |       arm64: |  ok  |
     |         c6x: | TODO |
+    |        csky: | TODO |
     |       h8300: | TODO |
     |     hexagon: |  ok  |
     |        ia64: | TODO |
index 53feeee..687d049 100644 (file)
@@ -11,6 +11,7 @@
     |         arm: |  ok  |
     |       arm64: |  ok  |
     |         c6x: | TODO |
+    |        csky: | TODO |
     |       h8300: | TODO |
     |     hexagon: | TODO |
     |        ia64: | TODO |
index 1616434..90996e3 100644 (file)
@@ -11,6 +11,7 @@
     |         arm: |  ok  |
     |       arm64: |  ok  |
     |         c6x: | TODO |
+    |        csky: | TODO |
     |       h8300: | TODO |
     |     hexagon: | TODO |
     |        ia64: | TODO |
index c7858dd..8a521a6 100644 (file)
@@ -34,6 +34,7 @@
     |         arm: |  ok  |
     |       arm64: |  ok  |
     |         c6x: | TODO |
+    |        csky: | TODO |
     |       h8300: | TODO |
     |     hexagon: | TODO |
     |        ia64: | TODO |
index c68bb2c..3508236 100644 (file)
@@ -11,6 +11,7 @@
     |         arm: |  ..  |
     |       arm64: |  ok  |
     |         c6x: |  ..  |
+    |        csky: |  ..  |
     |       h8300: |  ..  |
     |     hexagon: |  ..  |
     |        ia64: | TODO |
index d4271b4..4fe6c3c 100644 (file)
@@ -11,6 +11,7 @@
     |         arm: |  ok  |
     |       arm64: |  ok  |
     |         c6x: | TODO |
+    |        csky: | TODO |
     |       h8300: | TODO |
     |     hexagon: | TODO |
     |        ia64: | TODO |
index 83d9e68..593536f 100644 (file)
@@ -11,6 +11,7 @@
     |         arm: |  ok  |
     |       arm64: |  ok  |
     |         c6x: | TODO |
+    |        csky: | TODO |
     |       h8300: | TODO |
     |     hexagon: | TODO |
     |        ia64: | TODO |
index 3d4908f..7a27157 100644 (file)
@@ -11,6 +11,7 @@
     |         arm: |  ok  |
     |       arm64: |  ok  |
     |         c6x: |  ok  |
+    |        csky: |  ok  |
     |       h8300: |  ok  |
     |     hexagon: |  ok  |
     |        ia64: | TODO |
index c29974a..048bfb6 100644 (file)
@@ -11,6 +11,7 @@
     |         arm: |  ok  |
     |       arm64: |  ok  |
     |         c6x: | TODO |
+    |        csky: | TODO |
     |       h8300: | TODO |
     |     hexagon: | TODO |
     |        ia64: | TODO |
index 8d73c46..a14bbad 100644 (file)
@@ -11,6 +11,7 @@
     |         arm: |  ok  |
     |       arm64: |  ok  |
     |         c6x: | TODO |
+    |        csky: | TODO |
     |       h8300: | TODO |
     |     hexagon: | TODO |
     |        ia64: |  ..  |
index e7c6ea6..2855dfe 100644 (file)
@@ -11,6 +11,7 @@
     |         arm: | TODO |
     |       arm64: |  ok  |
     |         c6x: |  ok  |
+    |        csky: |  ok  |
     |       h8300: |  ok  |
     |     hexagon: |  ok  |
     |        ia64: |  ok  |
index 4646457..fb0d0ca 100644 (file)
@@ -11,6 +11,7 @@
     |         arm: |  ok  |
     |       arm64: |  ok  |
     |         c6x: | TODO |
+    |        csky: | TODO |
     |       h8300: | TODO |
     |     hexagon: | TODO |
     |        ia64: |  ok  |
index 1f71d09..adc2587 100644 (file)
@@ -11,6 +11,7 @@
     |         arm: |  ok  |
     |       arm64: |  ok  |
     |         c6x: | TODO |
+    |        csky: | TODO |
     |       h8300: | TODO |
     |     hexagon: | TODO |
     |        ia64: | TODO |
index fbd5aa4..f05588f 100644 (file)
@@ -11,6 +11,7 @@
     |         arm: | TODO |
     |       arm64: | TODO |
     |         c6x: | TODO |
+    |        csky: | TODO |
     |       h8300: | TODO |
     |     hexagon: | TODO |
     |        ia64: |  ok  |
index 5d7ecc3..cdfe892 100644 (file)
@@ -11,6 +11,7 @@
     |         arm: |  ok  |
     |       arm64: |  ok  |
     |         c6x: |  ..  |
+    |        csky: |  ..  |
     |       h8300: |  ..  |
     |     hexagon: |  ..  |
     |        ia64: | TODO |
index f7af967..2bdd3b6 100644 (file)
@@ -11,6 +11,7 @@
     |         arm: | TODO |
     |       arm64: | TODO |
     |         c6x: |  ..  |
+    |        csky: | TODO |
     |       h8300: |  ..  |
     |     hexagon: | TODO |
     |        ia64: | TODO |
index d0713cc..019131c 100644 (file)
@@ -11,6 +11,7 @@
     |         arm: | TODO |
     |       arm64: |  ok  |
     |         c6x: | TODO |
+    |        csky: | TODO |
     |       h8300: | TODO |
     |     hexagon: | TODO |
     |        ia64: | TODO |
index 326e479..3a6b87d 100644 (file)
@@ -11,6 +11,7 @@
     |         arm: | TODO |
     |       arm64: | TODO |
     |         c6x: | TODO |
+    |        csky: | TODO |
     |       h8300: | TODO |
     |     hexagon: | TODO |
     |        ia64: | TODO |
index 1a98805..3004beb 100644 (file)
@@ -11,6 +11,7 @@
     |         arm: |  ..  |
     |       arm64: |  ok  |
     |         c6x: |  ..  |
+    |        csky: |  ..  |
     |       h8300: |  ..  |
     |     hexagon: |  ..  |
     |        ia64: |  ok  |
index a837842..2dc5df6 100644 (file)
@@ -11,6 +11,7 @@
     |         arm: |  ok  |
     |       arm64: |  ok  |
     |         c6x: | TODO |
+    |        csky: | TODO |
     |       h8300: | TODO |
     |     hexagon: | TODO |
     |        ia64: | TODO |
index a1426ca..41411b0 100644 (file)
@@ -344,7 +344,9 @@ struct bus_attribute {
 
 Declaring:
 
-BUS_ATTR(_name, _mode, _show, _store)
+static BUS_ATTR_RW(name);
+static BUS_ATTR_RO(name);
+static BUS_ATTR_WO(name);
 
 Creation/Removal:
 
index 89ab09e..f07e380 100644 (file)
@@ -165,7 +165,7 @@ Do some work...
 The same can also be done from an application program.
 
 Disable specific CPU's specific idle state from cpuidle sysfs (see
-Documentation/cpuidle/sysfs.txt):
+Documentation/admin-guide/pm/cpuidle.rst):
 # echo 1 > /sys/devices/system/cpu/cpu$cpu/cpuidle/state$state/disable
 
 
index 71d6d25..659bbc0 100644 (file)
@@ -242,6 +242,6 @@ References
 ==========
 
 .. [white-paper] http://amd-dev.wpengine.netdna-cdn.com/wordpress/media/2013/12/AMD_Memory_Encryption_Whitepaper_v7-Public.pdf
-.. [api-spec] http://support.amd.com/TechDocs/55766_SEV-KM%20API_Specification.pdf
+.. [api-spec] http://support.amd.com/TechDocs/55766_SEV-KM_API_Specification.pdf
 .. [amd-apm] http://support.amd.com/TechDocs/24593.pdf (section 15.34)
 .. [kvm-forum]  http://www.linux-kvm.org/images/7/74/02x08A-Thomas_Lendacky-AMDs_Virtualizatoin_Memory_Encryption_Technology.pdf
index d9aed83..e8e8d14 100644 (file)
@@ -9,7 +9,7 @@ Fenghua Yu <fenghua.yu@intel.com>
 Tony Luck <tony.luck@intel.com>
 Vikas Shivappa <vikas.shivappa@intel.com>
 
-This feature is enabled by the CONFIG_RESCTRL and the X86 /proc/cpuinfo
+This feature is enabled by the CONFIG_X86_RESCTRL and the x86 /proc/cpuinfo
 flag bits:
 RDT (Resource Director Technology) Allocation - "rdt_a"
 CAT (Cache Allocation Technology) - "cat_l3", "cat_l2"
index 32d4444..4d04ceb 100644 (file)
@@ -3951,7 +3951,7 @@ L:        netdev@vger.kernel.org
 S:     Maintained
 F:     drivers/net/ethernet/ti/cpmac.c
 
-CPU FREQUENCY DRIVERS
+CPU FREQUENCY SCALING FRAMEWORK
 M:     "Rafael J. Wysocki" <rjw@rjwysocki.net>
 M:     Viresh Kumar <viresh.kumar@linaro.org>
 L:     linux-pm@vger.kernel.org
@@ -3959,6 +3959,8 @@ S:        Maintained
 T:     git git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git
 T:     git git://git.linaro.org/people/vireshk/linux.git (For ARM Updates)
 B:     https://bugzilla.kernel.org
+F:     Documentation/admin-guide/pm/cpufreq.rst
+F:     Documentation/admin-guide/pm/intel_pstate.rst
 F:     Documentation/cpu-freq/
 F:     Documentation/devicetree/bindings/cpufreq/
 F:     drivers/cpufreq/
@@ -4006,13 +4008,14 @@ S:      Supported
 F:     drivers/cpuidle/cpuidle-exynos.c
 F:     arch/arm/mach-exynos/pm.c
 
-CPUIDLE DRIVERS
+CPU IDLE TIME MANAGEMENT FRAMEWORK
 M:     "Rafael J. Wysocki" <rjw@rjwysocki.net>
 M:     Daniel Lezcano <daniel.lezcano@linaro.org>
 L:     linux-pm@vger.kernel.org
 S:     Maintained
 T:     git git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git
 B:     https://bugzilla.kernel.org
+F:     Documentation/admin-guide/pm/cpuidle.rst
 F:     drivers/cpuidle/*
 F:     include/linux/cpuidle.h
 
@@ -13820,8 +13823,9 @@ F:      drivers/media/mmc/siano/
 
 SIFIVE DRIVERS
 M:     Palmer Dabbelt <palmer@sifive.com>
+M:     Paul Walmsley <paul.walmsley@sifive.com>
 L:     linux-riscv@lists.infradead.org
-T:     git git://git.kernel.org/pub/scm/linux/kernel/git/palmer/riscv-linux.git
+T:     git git://github.com/sifive/riscv-linux.git
 S:     Supported
 K:     sifive
 N:     sifive
@@ -14432,6 +14436,11 @@ M:     Florian Schilhabel <florian.c.schilhabel@googlemail.com>.
 S:     Odd Fixes
 F:     drivers/staging/rtl8712/
 
+STAGING - REALTEK RTL8188EU DRIVERS
+M:     Larry Finger <Larry.Finger@lwfinger.net>
+S:     Odd Fixes
+F:     drivers/staging/rtl8188eu/
+
 STAGING - SILICON MOTION SM750 FRAME BUFFER DRIVER
 M:     Sudip Mukherjee <sudipm.mukherjee@gmail.com>
 M:     Teddy Wang <teddy.wang@siliconmotion.com>
@@ -15802,7 +15811,6 @@ M:      Alan Stern <stern@rowland.harvard.edu>
 L:     linux-usb@vger.kernel.org
 L:     usb-storage@lists.one-eyed-alien.net
 S:     Maintained
-W:     http://www.one-eyed-alien.net/~mdharm/linux-usb/
 F:     drivers/usb/storage/
 
 USB MIDI DRIVER
index 8c55b64..499b968 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,7 @@
 VERSION = 5
 PATCHLEVEL = 0
 SUBLEVEL = 0
-EXTRAVERSION = -rc1
+EXTRAVERSION = -rc2
 NAME = Shy Crocodile
 
 # *DOCUMENTATION*
index a3c9b34..f04bc3e 100644 (file)
                regulator-boot-on;
        };
 
+       baseboard_3v3: fixedregulator-3v3 {
+               /* TPS73701DCQ */
+               compatible = "regulator-fixed";
+               regulator-name = "baseboard_3v3";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               vin-supply = <&vbat>;
+               regulator-always-on;
+               regulator-boot-on;
+       };
+
+       baseboard_1v8: fixedregulator-1v8 {
+               /* TPS73701DCQ */
+               compatible = "regulator-fixed";
+               regulator-name = "baseboard_1v8";
+               regulator-min-microvolt = <1800000>;
+               regulator-max-microvolt = <1800000>;
+               vin-supply = <&vbat>;
+               regulator-always-on;
+               regulator-boot-on;
+       };
+
        backlight_lcd: backlight-regulator {
                compatible = "regulator-fixed";
                regulator-name = "lcd_backlight_pwr";
 
        sound {
                compatible = "simple-audio-card";
-               simple-audio-card,name = "DA850/OMAP-L138 EVM";
+               simple-audio-card,name = "DA850-OMAPL138 EVM";
                simple-audio-card,widgets =
                        "Line", "Line In",
                        "Line", "Line Out";
 
                /* Regulators */
                IOVDD-supply = <&vdcdc2_reg>;
-               /* Derived from VBAT: Baseboard 3.3V / 1.8V */
-               AVDD-supply = <&vbat>;
-               DRVDD-supply = <&vbat>;
-               DVDD-supply = <&vbat>;
+               AVDD-supply = <&baseboard_3v3>;
+               DRVDD-supply = <&baseboard_3v3>;
+               DVDD-supply = <&baseboard_1v8>;
        };
        tca6416: gpio@20 {
                compatible = "ti,tca6416";
index 0177e3e..3a2fa6e 100644 (file)
                };
        };
 
+       vcc_5vd: fixedregulator-vcc_5vd {
+               compatible = "regulator-fixed";
+               regulator-name = "vcc_5vd";
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+               regulator-boot-on;
+       };
+
+       vcc_3v3d: fixedregulator-vcc_3v3d {
+               /* TPS650250 - VDCDC1 */
+               compatible = "regulator-fixed";
+               regulator-name = "vcc_3v3d";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               vin-supply = <&vcc_5vd>;
+               regulator-always-on;
+               regulator-boot-on;
+       };
+
+       vcc_1v8d: fixedregulator-vcc_1v8d {
+               /* TPS650250 - VDCDC2 */
+               compatible = "regulator-fixed";
+               regulator-name = "vcc_1v8d";
+               regulator-min-microvolt = <1800000>;
+               regulator-max-microvolt = <1800000>;
+               vin-supply = <&vcc_5vd>;
+               regulator-always-on;
+               regulator-boot-on;
+       };
+
        sound {
                compatible = "simple-audio-card";
-               simple-audio-card,name = "DA850/OMAP-L138 LCDK";
+               simple-audio-card,name = "DA850-OMAPL138 LCDK";
                simple-audio-card,widgets =
                        "Line", "Line In",
                        "Line", "Line Out";
                compatible = "ti,tlv320aic3106";
                reg = <0x18>;
                status = "okay";
+
+               /* Regulators */
+               IOVDD-supply = <&vcc_3v3d>;
+               AVDD-supply = <&vcc_3v3d>;
+               DRVDD-supply = <&vcc_3v3d>;
+               DVDD-supply = <&vcc_1v8d>;
        };
 };
 
index cbaf06f..eb91746 100644 (file)
@@ -36,8 +36,8 @@
                compatible = "gpio-fan";
                pinctrl-0 = <&pmx_fan_high_speed &pmx_fan_low_speed>;
                pinctrl-names = "default";
-               gpios = <&gpio1 14 GPIO_ACTIVE_LOW
-                        &gpio1 13 GPIO_ACTIVE_LOW>;
+               gpios = <&gpio1 14 GPIO_ACTIVE_HIGH
+                        &gpio1 13 GPIO_ACTIVE_HIGH>;
                gpio-fan,speed-map = <0    0
                                      3000 1
                                      6000 2>;
index e52ec16..c4da635 100644 (file)
@@ -208,9 +208,9 @@ static struct gpiod_lookup_table mmc_gpios_table = {
        .dev_id = "da830-mmc.0",
        .table = {
                /* gpio chip 1 contains gpio range 32-63 */
-               GPIO_LOOKUP("davinci_gpio.0", DA830_MMCSD_CD_PIN, "cd",
+               GPIO_LOOKUP("davinci_gpio", DA830_MMCSD_CD_PIN, "cd",
                            GPIO_ACTIVE_LOW),
-               GPIO_LOOKUP("davinci_gpio.0", DA830_MMCSD_WP_PIN, "wp",
+               GPIO_LOOKUP("davinci_gpio", DA830_MMCSD_WP_PIN, "wp",
                            GPIO_ACTIVE_LOW),
        },
 };
index 6a29baf..44bca04 100644 (file)
@@ -805,9 +805,9 @@ static struct gpiod_lookup_table mmc_gpios_table = {
        .dev_id = "da830-mmc.0",
        .table = {
                /* gpio chip 2 contains gpio range 64-95 */
-               GPIO_LOOKUP("davinci_gpio.0", DA850_MMCSD_CD_PIN, "cd",
+               GPIO_LOOKUP("davinci_gpio", DA850_MMCSD_CD_PIN, "cd",
                            GPIO_ACTIVE_LOW),
-               GPIO_LOOKUP("davinci_gpio.0", DA850_MMCSD_WP_PIN, "wp",
+               GPIO_LOOKUP("davinci_gpio", DA850_MMCSD_WP_PIN, "wp",
                            GPIO_ACTIVE_HIGH),
        },
 };
index f53a461..f7fa960 100644 (file)
@@ -117,9 +117,9 @@ static struct platform_device davinci_nand_device = {
 static struct gpiod_lookup_table i2c_recovery_gpiod_table = {
        .dev_id = "i2c_davinci.1",
        .table = {
-               GPIO_LOOKUP("davinci_gpio.0", DM355_I2C_SDA_PIN, "sda",
+               GPIO_LOOKUP("davinci_gpio", DM355_I2C_SDA_PIN, "sda",
                            GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN),
-               GPIO_LOOKUP("davinci_gpio.0", DM355_I2C_SCL_PIN, "scl",
+               GPIO_LOOKUP("davinci_gpio", DM355_I2C_SCL_PIN, "scl",
                            GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN),
        },
 };
index e142811..b80c4ee 100644 (file)
@@ -660,9 +660,9 @@ static struct i2c_board_info __initdata i2c_info[] =  {
 static struct gpiod_lookup_table i2c_recovery_gpiod_table = {
        .dev_id = "i2c_davinci.1",
        .table = {
-               GPIO_LOOKUP("davinci_gpio.0", DM644X_I2C_SDA_PIN, "sda",
+               GPIO_LOOKUP("davinci_gpio", DM644X_I2C_SDA_PIN, "sda",
                            GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN),
-               GPIO_LOOKUP("davinci_gpio.0", DM644X_I2C_SCL_PIN, "scl",
+               GPIO_LOOKUP("davinci_gpio", DM644X_I2C_SCL_PIN, "scl",
                            GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN),
        },
 };
index 8e8d51f..94c4f12 100644 (file)
@@ -134,9 +134,9 @@ static const short hawk_mmcsd0_pins[] = {
 static struct gpiod_lookup_table mmc_gpios_table = {
        .dev_id = "da830-mmc.0",
        .table = {
-               GPIO_LOOKUP("davinci_gpio.0", DA850_HAWK_MMCSD_CD_PIN, "cd",
+               GPIO_LOOKUP("davinci_gpio", DA850_HAWK_MMCSD_CD_PIN, "cd",
                            GPIO_ACTIVE_LOW),
-               GPIO_LOOKUP("davinci_gpio.0", DA850_HAWK_MMCSD_WP_PIN, "wp",
+               GPIO_LOOKUP("davinci_gpio", DA850_HAWK_MMCSD_WP_PIN, "wp",
                            GPIO_ACTIVE_LOW),
        },
 };
index a109f64..8dfad01 100644 (file)
@@ -390,10 +390,14 @@ static int __ref impd1_probe(struct lm_device *dev)
                        char *mmciname;
 
                        lookup = devm_kzalloc(&dev->dev,
-                                             sizeof(*lookup) + 3 * sizeof(struct gpiod_lookup),
+                                             struct_size(lookup, table, 3),
                                              GFP_KERNEL);
                        chipname = devm_kstrdup(&dev->dev, devname, GFP_KERNEL);
-                       mmciname = kasprintf(GFP_KERNEL, "lm%x:00700", dev->id);
+                       mmciname = devm_kasprintf(&dev->dev, GFP_KERNEL,
+                                                 "lm%x:00700", dev->id);
+                       if (!lookup || !chipname || !mmciname)
+                               return -ENOMEM;
+
                        lookup->dev_id = mmciname;
                        /*
                         * Offsets on GPIO block 1:
index 5fb6f79..afd9897 100644 (file)
@@ -32,6 +32,8 @@ void __iomem *rst_manager_base_addr;
 void __iomem *sdr_ctl_base_addr;
 unsigned long socfpga_cpu1start_addr;
 
+extern void __init socfpga_reset_init(void);
+
 static void __init socfpga_sysmgr_init(void)
 {
        struct device_node *np;
@@ -64,6 +66,7 @@ static void __init socfpga_init_irq(void)
 
        if (IS_ENABLED(CONFIG_EDAC_ALTERA_OCRAM))
                socfpga_init_ocram_ecc();
+       socfpga_reset_init();
 }
 
 static void __init socfpga_arria10_init_irq(void)
@@ -74,6 +77,7 @@ static void __init socfpga_arria10_init_irq(void)
                socfpga_init_arria10_l2_ecc();
        if (IS_ENABLED(CONFIG_EDAC_ALTERA_OCRAM))
                socfpga_init_arria10_ocram_ecc();
+       socfpga_reset_init();
 }
 
 static void socfpga_cyclone5_restart(enum reboot_mode mode, const char *cmd)
index 29ea7e8..329f8ce 100644 (file)
        pinctrl-0 = <&cp0_pcie_pins>;
        num-lanes = <4>;
        num-viewport = <8>;
-       reset-gpio = <&cp0_gpio1 20 GPIO_ACTIVE_LOW>;
+       reset-gpios = <&cp0_gpio2 20 GPIO_ACTIVE_LOW>;
        status = "okay";
 };
 
index 7d94c1f..7f799cb 100644 (file)
                method = "smc";
        };
 
+       reserved-memory {
+               #address-cells = <2>;
+               #size-cells = <2>;
+               ranges;
+
+               /*
+                * This area matches the mapping done with a
+                * mainline U-Boot, and should be updated by the
+                * bootloader.
+                */
+
+               psci-area@4000000 {
+                       reg = <0x0 0x4000000 0x0 0x200000>;
+                       no-map;
+               };
+       };
+
        ap806 {
                #address-cells = <2>;
                #size-cells = <2>;
index 3ef443c..c8432e2 100644 (file)
@@ -506,11 +506,15 @@ CONFIG_SND_SOC_ROCKCHIP=m
 CONFIG_SND_SOC_ROCKCHIP_SPDIF=m
 CONFIG_SND_SOC_ROCKCHIP_RT5645=m
 CONFIG_SND_SOC_RK3399_GRU_SOUND=m
+CONFIG_SND_MESON_AXG_SOUND_CARD=m
 CONFIG_SND_SOC_SAMSUNG=y
 CONFIG_SND_SOC_RCAR=m
 CONFIG_SND_SOC_AK4613=m
 CONFIG_SND_SIMPLE_CARD=m
 CONFIG_SND_AUDIO_GRAPH_CARD=m
+CONFIG_SND_SOC_ES7134=m
+CONFIG_SND_SOC_ES7241=m
+CONFIG_SND_SOC_TAS571X=m
 CONFIG_I2C_HID=m
 CONFIG_USB=y
 CONFIG_USB_OTG=y
index 2173ad3..1c9a3a0 100644 (file)
@@ -2,7 +2,7 @@
 #ifndef __ASM_PROTOTYPES_H
 #define __ASM_PROTOTYPES_H
 /*
- * CONFIG_MODEVERIONS requires a C declaration to generate the appropriate CRC
+ * CONFIG_MODVERSIONS requires a C declaration to generate the appropriate CRC
  * for each symbol. Since commit:
  *
  *   4efca4ed05cbdfd1 ("kbuild: modversions for EXPORT_SYMBOL() for asm")
index 13dd42c..eb43e09 100644 (file)
  */
 #define ARCH_DMA_MINALIGN      (128)
 
+#ifdef CONFIG_KASAN_SW_TAGS
+#define ARCH_SLAB_MINALIGN     (1ULL << KASAN_SHADOW_SCALE_SHIFT)
+#else
+#define ARCH_SLAB_MINALIGN     __alignof__(unsigned long long)
+#endif
+
 #ifndef __ASSEMBLY__
 
 #include <linux/bitops.h>
index 7689c7a..ac352ac 100644 (file)
@@ -16,6 +16,8 @@
 #ifndef __ASM_MMU_H
 #define __ASM_MMU_H
 
+#include <asm/cputype.h>
+
 #define MMCF_AARCH32   0x1     /* mm context flag for AArch32 executables */
 #define USER_ASID_BIT  48
 #define USER_ASID_FLAG (UL(1) << USER_ASID_BIT)
@@ -44,6 +46,45 @@ static inline bool arm64_kernel_unmapped_at_el0(void)
               cpus_have_const_cap(ARM64_UNMAP_KERNEL_AT_EL0);
 }
 
+static inline bool arm64_kernel_use_ng_mappings(void)
+{
+       bool tx1_bug;
+
+       /* What's a kpti? Use global mappings if we don't know. */
+       if (!IS_ENABLED(CONFIG_UNMAP_KERNEL_AT_EL0))
+               return false;
+
+       /*
+        * Note: this function is called before the CPU capabilities have
+        * been configured, so our early mappings will be global. If we
+        * later determine that kpti is required, then
+        * kpti_install_ng_mappings() will make them non-global.
+        */
+       if (!IS_ENABLED(CONFIG_RANDOMIZE_BASE))
+               return arm64_kernel_unmapped_at_el0();
+
+       /*
+        * KASLR is enabled so we're going to be enabling kpti on non-broken
+        * CPUs regardless of their susceptibility to Meltdown. Rather
+        * than force everybody to go through the G -> nG dance later on,
+        * just put down non-global mappings from the beginning.
+        */
+       if (!IS_ENABLED(CONFIG_CAVIUM_ERRATUM_27456)) {
+               tx1_bug = false;
+#ifndef MODULE
+       } else if (!static_branch_likely(&arm64_const_caps_ready)) {
+               extern const struct midr_range cavium_erratum_27456_cpus[];
+
+               tx1_bug = is_midr_in_range_list(read_cpuid_id(),
+                                               cavium_erratum_27456_cpus);
+#endif
+       } else {
+               tx1_bug = __cpus_have_const_cap(ARM64_WORKAROUND_CAVIUM_27456);
+       }
+
+       return !tx1_bug && kaslr_offset() > 0;
+}
+
 typedef void (*bp_hardening_cb_t)(void);
 
 struct bp_hardening_data {
index 78b942c..986e41c 100644 (file)
@@ -37,8 +37,8 @@
 #define _PROT_DEFAULT          (PTE_TYPE_PAGE | PTE_AF | PTE_SHARED)
 #define _PROT_SECT_DEFAULT     (PMD_TYPE_SECT | PMD_SECT_AF | PMD_SECT_S)
 
-#define PTE_MAYBE_NG           (arm64_kernel_unmapped_at_el0() ? PTE_NG : 0)
-#define PMD_MAYBE_NG           (arm64_kernel_unmapped_at_el0() ? PMD_SECT_NG : 0)
+#define PTE_MAYBE_NG           (arm64_kernel_use_ng_mappings() ? PTE_NG : 0)
+#define PMD_MAYBE_NG           (arm64_kernel_use_ng_mappings() ? PMD_SECT_NG : 0)
 
 #define PROT_DEFAULT           (_PROT_DEFAULT | PTE_MAYBE_NG)
 #define PROT_SECT_DEFAULT      (_PROT_SECT_DEFAULT | PMD_MAYBE_NG)
index 09ac548..9950bb0 100644 (file)
@@ -553,7 +553,7 @@ static const struct midr_range arm64_repeat_tlbi_cpus[] = {
 #endif
 
 #ifdef CONFIG_CAVIUM_ERRATUM_27456
-static const struct midr_range cavium_erratum_27456_cpus[] = {
+const struct midr_range cavium_erratum_27456_cpus[] = {
        /* Cavium ThunderX, T88 pass 1.x - 2.1 */
        MIDR_RANGE(MIDR_THUNDERX, 0, 0, 1, 1),
        /* Cavium ThunderX, T81 pass 1.0 */
index 4f27239..f6d84e2 100644 (file)
@@ -983,7 +983,7 @@ static bool unmap_kernel_at_el0(const struct arm64_cpu_capabilities *entry,
 
        /* Useful for KASLR robustness */
        if (IS_ENABLED(CONFIG_RANDOMIZE_BASE))
-               return true;
+               return kaslr_offset() > 0;
 
        /* Don't force KPTI for CPUs that are not vulnerable */
        if (is_midr_in_range_list(read_cpuid_id(), kpti_safe_list))
@@ -1003,7 +1003,12 @@ kpti_install_ng_mappings(const struct arm64_cpu_capabilities *__unused)
        static bool kpti_applied = false;
        int cpu = smp_processor_id();
 
-       if (kpti_applied)
+       /*
+        * We don't need to rewrite the page-tables if either we've done
+        * it already or we have KASLR enabled and therefore have not
+        * created any global mappings at all.
+        */
+       if (kpti_applied || kaslr_offset() > 0)
                return;
 
        remap_fn = (void *)__pa_symbol(idmap_kpti_install_ng_mappings);
index c721367..15d79a8 100644 (file)
@@ -475,6 +475,7 @@ ENDPROC(__primary_switched)
 
 ENTRY(kimage_vaddr)
        .quad           _text - TEXT_OFFSET
+EXPORT_SYMBOL(kimage_vaddr)
 
 /*
  * If we're fortunate enough to boot at EL2, ensure that the world is
index 10e3386..f2c211a 100644 (file)
@@ -87,7 +87,9 @@ static int setup_dtb(struct kimage *image,
 
        /* add kaslr-seed */
        ret = fdt_delprop(dtb, off, FDT_PROP_KASLR_SEED);
-       if (ret && (ret != -FDT_ERR_NOTFOUND))
+       if  (ret == -FDT_ERR_NOTFOUND)
+               ret = 0;
+       else if (ret)
                goto out;
 
        if (rng_is_initialized()) {
index 0febf1a..6c6f630 100644 (file)
@@ -1,4 +1,5 @@
 include include/uapi/asm-generic/Kbuild.asm
 
 generic-y += kvm_para.h
+generic-y += shmparam.h
 generic-y += ucontext.h
index ecae6b3..c1dfa9c 100644 (file)
@@ -15,6 +15,31 @@ extern void iounmap(void *addr);
 extern int remap_area_pages(unsigned long address, phys_addr_t phys_addr,
                size_t size, unsigned long flags);
 
+/*
+ * I/O memory access primitives. Reads are ordered relative to any
+ * following Normal memory access. Writes are ordered relative to any prior
+ * Normal memory access.
+ *
+ * For CACHEV1 (807, 810), store instruction could fast retire, so we need
+ * another mb() to prevent st fast retire.
+ *
+ * For CACHEV2 (860), store instruction with PAGE_ATTR_NO_BUFFERABLE won't
+ * fast retire.
+ */
+#define readb(c)               ({ u8  __v = readb_relaxed(c); rmb(); __v; })
+#define readw(c)               ({ u16 __v = readw_relaxed(c); rmb(); __v; })
+#define readl(c)               ({ u32 __v = readl_relaxed(c); rmb(); __v; })
+
+#ifdef CONFIG_CPU_HAS_CACHEV2
+#define writeb(v,c)            ({ wmb(); writeb_relaxed((v),(c)); })
+#define writew(v,c)            ({ wmb(); writew_relaxed((v),(c)); })
+#define writel(v,c)            ({ wmb(); writel_relaxed((v),(c)); })
+#else
+#define writeb(v,c)            ({ wmb(); writeb_relaxed((v),(c)); mb(); })
+#define writew(v,c)            ({ wmb(); writew_relaxed((v),(c)); mb(); })
+#define writel(v,c)            ({ wmb(); writel_relaxed((v),(c)); mb(); })
+#endif
+
 #define ioremap_nocache(phy, sz)       ioremap(phy, sz)
 #define ioremap_wc ioremap_nocache
 #define ioremap_wt ioremap_nocache
index bf4f4a0..d213bb4 100644 (file)
@@ -24,41 +24,34 @@ static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd,
 
 extern void pgd_init(unsigned long *p);
 
-static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
-                                       unsigned long address)
+static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm)
 {
        pte_t *pte;
-       unsigned long *kaddr, i;
+       unsigned long i;
 
-       pte = (pte_t *) __get_free_pages(GFP_KERNEL | __GFP_RETRY_MAYFAIL,
-                                        PTE_ORDER);
-       kaddr = (unsigned long *)pte;
-       if (address & 0x80000000)
-               for (i = 0; i < (PAGE_SIZE/4); i++)
-                       *(kaddr + i) = 0x1;
-       else
-               clear_page(kaddr);
+       pte = (pte_t *) __get_free_page(GFP_KERNEL);
+       if (!pte)
+               return NULL;
+
+       for (i = 0; i < PAGE_SIZE/sizeof(pte_t); i++)
+               (pte + i)->pte_low = _PAGE_GLOBAL;
 
        return pte;
 }
 
-static inline struct page *pte_alloc_one(struct mm_struct *mm,
-                                               unsigned long address)
+static inline struct page *pte_alloc_one(struct mm_struct *mm)
 {
        struct page *pte;
-       unsigned long *kaddr, i;
-
-       pte = alloc_pages(GFP_KERNEL | __GFP_RETRY_MAYFAIL, PTE_ORDER);
-       if (pte) {
-               kaddr = kmap_atomic(pte);
-               if (address & 0x80000000) {
-                       for (i = 0; i < (PAGE_SIZE/4); i++)
-                               *(kaddr + i) = 0x1;
-               } else
-                       clear_page(kaddr);
-               kunmap_atomic(kaddr);
-               pgtable_page_ctor(pte);
+
+       pte = alloc_pages(GFP_KERNEL | __GFP_ZERO, 0);
+       if (!pte)
+               return NULL;
+
+       if (!pgtable_page_ctor(pte)) {
+               __free_page(pte);
+               return NULL;
        }
+
        return pte;
 }
 
index 65abab0..b5ad7d9 100644 (file)
@@ -12,7 +12,7 @@
 #include <linux/spinlock.h>
 #include <asm/pgtable.h>
 
-#if defined(__CSKYABIV2__)
+#ifdef CONFIG_CPU_CK810
 #define IS_BSR32(hi16, lo16)           (((hi16) & 0xFC00) == 0xE000)
 #define IS_JSRI32(hi16, lo16)          ((hi16) == 0xEAE0)
 
        *(uint16_t *)(addr) = 0xE8Fa;           \
        *((uint16_t *)(addr) + 1) = 0x0000;     \
 } while (0)
+
+static void jsri_2_lrw_jsr(uint32_t *location)
+{
+       uint16_t *location_tmp = (uint16_t *)location;
+
+       if (IS_BSR32(*location_tmp, *(location_tmp + 1)))
+               return;
+
+       if (IS_JSRI32(*location_tmp, *(location_tmp + 1))) {
+               /* jsri 0x...  --> lrw r26, 0x... */
+               CHANGE_JSRI_TO_LRW(location);
+               /* lsli r0, r0 --> jsr r26 */
+               SET_JSR32_R26(location + 1);
+       }
+}
+#else
+static void inline jsri_2_lrw_jsr(uint32_t *location)
+{
+       return;
+}
 #endif
 
 int apply_relocate_add(Elf32_Shdr *sechdrs, const char *strtab,
@@ -35,9 +55,6 @@ int apply_relocate_add(Elf32_Shdr *sechdrs, const char *strtab,
        Elf32_Sym       *sym;
        uint32_t        *location;
        short           *temp;
-#if defined(__CSKYABIV2__)
-       uint16_t        *location_tmp;
-#endif
 
        for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) {
                /* This is where to make the change */
@@ -59,18 +76,7 @@ int apply_relocate_add(Elf32_Shdr *sechdrs, const char *strtab,
                case R_CSKY_PCRELJSR_IMM11BY2:
                        break;
                case R_CSKY_PCRELJSR_IMM26BY2:
-#if defined(__CSKYABIV2__)
-                       location_tmp = (uint16_t *)location;
-                       if (IS_BSR32(*location_tmp, *(location_tmp + 1)))
-                               break;
-
-                       if (IS_JSRI32(*location_tmp, *(location_tmp + 1))) {
-                               /* jsri 0x...  --> lrw r26, 0x... */
-                               CHANGE_JSRI_TO_LRW(location);
-                               /* lsli r0, r0 --> jsr r26 */
-                               SET_JSR32_R26(location + 1);
-                       }
-#endif
+                       jsri_2_lrw_jsr(location);
                        break;
                case R_CSKY_ADDR_HI16:
                        temp = ((short  *)location) + 1;
index 0febf1a..6c6f630 100644 (file)
@@ -1,4 +1,5 @@
 include include/uapi/asm-generic/Kbuild.asm
 
 generic-y += kvm_para.h
+generic-y += shmparam.h
 generic-y += ucontext.h
index c1b06dc..61d955c 100644 (file)
@@ -1,3 +1,4 @@
 include include/uapi/asm-generic/Kbuild.asm
 
+generic-y += shmparam.h
 generic-y += ucontext.h
index 960bf1e..b8b3525 100644 (file)
@@ -2,3 +2,4 @@ include include/uapi/asm-generic/Kbuild.asm
 
 generated-y += unistd_32.h
 generic-y += kvm_para.h
+generic-y += shmparam.h
index 97823ec..28823e3 100644 (file)
@@ -2,4 +2,5 @@ include include/uapi/asm-generic/Kbuild.asm
 
 generated-y += unistd_32.h
 generic-y += kvm_para.h
+generic-y += shmparam.h
 generic-y += ucontext.h
index 982859f..5e6a1a4 100644 (file)
@@ -129,9 +129,9 @@ ltq_dma_alloc(struct ltq_dma_channel *ch)
        unsigned long flags;
 
        ch->desc = 0;
-       ch->desc_base = dma_zalloc_coherent(ch->dev,
-                               LTQ_DESC_NUM * LTQ_DESC_SIZE,
-                               &ch->phys, GFP_ATOMIC);
+       ch->desc_base = dma_alloc_coherent(ch->dev,
+                                          LTQ_DESC_NUM * LTQ_DESC_SIZE,
+                                          &ch->phys, GFP_ATOMIC);
 
        spin_lock_irqsave(&ltq_dma_lock, flags);
        ltq_dma_w32(ch->nr, LTQ_DMA_CS);
index bc8191a..a44682c 100644 (file)
 /* Ensure that addr is below task's addr_limit */
 #define __addr_ok(addr) ((unsigned long) addr < get_fs())
 
-#define access_ok(addr, size) \
-       __range_ok((unsigned long)addr, (unsigned long)size)
+#define access_ok(addr, size)                                          \
+({                                                                     \
+       unsigned long __ao_addr = (unsigned long)(addr);                \
+       unsigned long __ao_size = (unsigned long)(size);                \
+       __range_ok(__ao_addr, __ao_size);                               \
+})
 
 /*
  * These are the main single-value transfer routines.  They automatically
index 0febf1a..6c6f630 100644 (file)
@@ -1,4 +1,5 @@
 include include/uapi/asm-generic/Kbuild.asm
 
 generic-y += kvm_para.h
+generic-y += shmparam.h
 generic-y += ucontext.h
index d18d164..bdf9b71 100644 (file)
@@ -255,7 +255,7 @@ int pasemi_dma_alloc_ring(struct pasemi_dmachan *chan, int ring_size)
 
        chan->ring_size = ring_size;
 
-       chan->ring_virt = dma_zalloc_coherent(&dma_pdev->dev,
+       chan->ring_virt = dma_alloc_coherent(&dma_pdev->dev,
                                             ring_size * sizeof(u64),
                                             &chan->ring_dma, GFP_KERNEL);
 
index 8b0ebf3..ebed46f 100644 (file)
@@ -756,9 +756,10 @@ fsl_open_outb_mbox(struct rio_mport *mport, void *dev_id, int mbox, int entries)
        }
 
        /* Initialize outbound message descriptor ring */
-       rmu->msg_tx_ring.virt = dma_zalloc_coherent(priv->dev,
-                               rmu->msg_tx_ring.size * RIO_MSG_DESC_SIZE,
-                               &rmu->msg_tx_ring.phys, GFP_KERNEL);
+       rmu->msg_tx_ring.virt = dma_alloc_coherent(priv->dev,
+                                                  rmu->msg_tx_ring.size * RIO_MSG_DESC_SIZE,
+                                                  &rmu->msg_tx_ring.phys,
+                                                  GFP_KERNEL);
        if (!rmu->msg_tx_ring.virt) {
                rc = -ENOMEM;
                goto out_dma;
index e0d7d61..feeeaa6 100644 (file)
@@ -28,11 +28,13 @@ config RISCV
        select GENERIC_STRNLEN_USER
        select GENERIC_SMP_IDLE_THREAD
        select GENERIC_ATOMIC64 if !64BIT || !RISCV_ISA_A
+       select HAVE_ARCH_AUDITSYSCALL
        select HAVE_MEMBLOCK_NODE_MAP
        select HAVE_DMA_CONTIGUOUS
        select HAVE_FUTEX_CMPXCHG if FUTEX
        select HAVE_GENERIC_DMA_COHERENT
        select HAVE_PERF_EVENTS
+       select HAVE_SYSCALL_TRACEPOINTS
        select IRQ_DOMAIN
        select RISCV_ISA_A if SMP
        select SPARSE_IRQ
@@ -40,6 +42,7 @@ config RISCV
        select HAVE_ARCH_TRACEHOOK
        select HAVE_PCI
        select MODULES_USE_ELF_RELA if MODULES
+       select MODULE_SECTIONS if MODULES
        select THREAD_INFO_IN_TASK
        select PCI_DOMAINS_GENERIC if PCI
        select PCI_MSI if PCI
@@ -152,7 +155,6 @@ choice
                bool "2GiB"
        config MAXPHYSMEM_128GB
                depends on 64BIT && CMODEL_MEDANY
-               select MODULE_SECTIONS if MODULES
                bool "128GiB"
 endchoice
 
index cd2af4b..46202da 100644 (file)
@@ -9,12 +9,12 @@
 #define MODULE_ARCH_VERMAGIC    "riscv"
 
 struct module;
-u64 module_emit_got_entry(struct module *mod, u64 val);
-u64 module_emit_plt_entry(struct module *mod, u64 val);
+unsigned long module_emit_got_entry(struct module *mod, unsigned long val);
+unsigned long module_emit_plt_entry(struct module *mod, unsigned long val);
 
 #ifdef CONFIG_MODULE_SECTIONS
 struct mod_section {
-       struct elf64_shdr *shdr;
+       Elf_Shdr *shdr;
        int num_entries;
        int max_entries;
 };
@@ -26,18 +26,18 @@ struct mod_arch_specific {
 };
 
 struct got_entry {
-       u64 symbol_addr;        /* the real variable address */
+       unsigned long symbol_addr;      /* the real variable address */
 };
 
-static inline struct got_entry emit_got_entry(u64 val)
+static inline struct got_entry emit_got_entry(unsigned long val)
 {
        return (struct got_entry) {val};
 }
 
-static inline struct got_entry *get_got_entry(u64 val,
+static inline struct got_entry *get_got_entry(unsigned long val,
                                              const struct mod_section *sec)
 {
-       struct got_entry *got = (struct got_entry *)sec->shdr->sh_addr;
+       struct got_entry *got = (struct got_entry *)(sec->shdr->sh_addr);
        int i;
        for (i = 0; i < sec->num_entries; i++) {
                if (got[i].symbol_addr == val)
@@ -62,7 +62,9 @@ struct plt_entry {
 #define REG_T0     0x5
 #define REG_T1     0x6
 
-static inline struct plt_entry emit_plt_entry(u64 val, u64 plt, u64 got_plt)
+static inline struct plt_entry emit_plt_entry(unsigned long val,
+                                             unsigned long plt,
+                                             unsigned long got_plt)
 {
        /*
         * U-Type encoding:
@@ -76,7 +78,7 @@ static inline struct plt_entry emit_plt_entry(u64 val, u64 plt, u64 got_plt)
         * +------------+------------+--------+----------+----------+
         *
         */
-       u64 offset = got_plt - plt;
+       unsigned long offset = got_plt - plt;
        u32 hi20 = (offset + 0x800) & 0xfffff000;
        u32 lo12 = (offset - hi20);
        return (struct plt_entry) {
@@ -86,7 +88,7 @@ static inline struct plt_entry emit_plt_entry(u64 val, u64 plt, u64 got_plt)
        };
 }
 
-static inline int get_got_plt_idx(u64 val, const struct mod_section *sec)
+static inline int get_got_plt_idx(unsigned long val, const struct mod_section *sec)
 {
        struct got_entry *got_plt = (struct got_entry *)sec->shdr->sh_addr;
        int i;
@@ -97,9 +99,9 @@ static inline int get_got_plt_idx(u64 val, const struct mod_section *sec)
        return -1;
 }
 
-static inline struct plt_entry *get_plt_entry(u64 val,
-                                     const struct mod_section *sec_plt,
-                                     const struct mod_section *sec_got_plt)
+static inline struct plt_entry *get_plt_entry(unsigned long val,
+                                             const struct mod_section *sec_plt,
+                                             const struct mod_section *sec_got_plt)
 {
        struct plt_entry *plt = (struct plt_entry *)sec_plt->shdr->sh_addr;
        int got_plt_idx = get_got_plt_idx(val, sec_got_plt);
index bbe1862..d35ec2f 100644 (file)
@@ -113,6 +113,11 @@ static inline void frame_pointer_set(struct pt_regs *regs,
        SET_FP(regs, val);
 }
 
+static inline unsigned long regs_return_value(struct pt_regs *regs)
+{
+       return regs->a0;
+}
+
 #endif /* __ASSEMBLY__ */
 
 #endif /* _ASM_RISCV_PTRACE_H */
index 8d25f89..bba3da6 100644 (file)
@@ -18,6 +18,7 @@
 #ifndef _ASM_RISCV_SYSCALL_H
 #define _ASM_RISCV_SYSCALL_H
 
+#include <uapi/linux/audit.h>
 #include <linux/sched.h>
 #include <linux/err.h>
 
@@ -99,4 +100,13 @@ static inline void syscall_set_arguments(struct task_struct *task,
        memcpy(&regs->a1 + i * sizeof(regs->a1), args, n * sizeof(regs->a0));
 }
 
+static inline int syscall_get_arch(void)
+{
+#ifdef CONFIG_64BIT
+       return AUDIT_ARCH_RISCV64;
+#else
+       return AUDIT_ARCH_RISCV32;
+#endif
+}
+
 #endif /* _ASM_RISCV_SYSCALL_H */
index f8fa1cd..1c9cc83 100644 (file)
@@ -80,13 +80,19 @@ struct thread_info {
 #define TIF_RESTORE_SIGMASK    4       /* restore signal mask in do_signal() */
 #define TIF_MEMDIE             5       /* is terminating due to OOM killer */
 #define TIF_SYSCALL_TRACEPOINT  6       /* syscall tracepoint instrumentation */
+#define TIF_SYSCALL_AUDIT      7       /* syscall auditing */
 
 #define _TIF_SYSCALL_TRACE     (1 << TIF_SYSCALL_TRACE)
 #define _TIF_NOTIFY_RESUME     (1 << TIF_NOTIFY_RESUME)
 #define _TIF_SIGPENDING                (1 << TIF_SIGPENDING)
 #define _TIF_NEED_RESCHED      (1 << TIF_NEED_RESCHED)
+#define _TIF_SYSCALL_TRACEPOINT        (1 << TIF_SYSCALL_TRACEPOINT)
+#define _TIF_SYSCALL_AUDIT     (1 << TIF_SYSCALL_AUDIT)
 
 #define _TIF_WORK_MASK \
        (_TIF_NOTIFY_RESUME | _TIF_SIGPENDING | _TIF_NEED_RESCHED)
 
+#define _TIF_SYSCALL_WORK \
+       (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_TRACEPOINT | _TIF_SYSCALL_AUDIT)
+
 #endif /* _ASM_RISCV_THREAD_INFO_H */
index fef96f1..073ee80 100644 (file)
@@ -19,3 +19,5 @@
 #define __ARCH_WANT_SYS_CLONE
 
 #include <uapi/asm/unistd.h>
+
+#define NR_syscalls (__NR_syscalls)
index 13d4826..355166f 100644 (file)
@@ -201,7 +201,7 @@ handle_syscall:
        REG_S s2, PT_SEPC(sp)
        /* Trace syscalls, but only if requested by the user. */
        REG_L t0, TASK_TI_FLAGS(tp)
-       andi t0, t0, _TIF_SYSCALL_TRACE
+       andi t0, t0, _TIF_SYSCALL_WORK
        bnez t0, handle_syscall_trace_enter
 check_syscall_nr:
        /* Check to make sure we don't jump to a bogus syscall number. */
@@ -221,7 +221,7 @@ ret_from_syscall:
        REG_S a0, PT_A0(sp)
        /* Trace syscalls, but only if requested by the user. */
        REG_L t0, TASK_TI_FLAGS(tp)
-       andi t0, t0, _TIF_SYSCALL_TRACE
+       andi t0, t0, _TIF_SYSCALL_WORK
        bnez t0, handle_syscall_trace_exit
 
 ret_from_exception:
index bbbd26e..c9ae483 100644 (file)
@@ -9,14 +9,14 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 
-u64 module_emit_got_entry(struct module *mod, u64 val)
+unsigned long module_emit_got_entry(struct module *mod, unsigned long val)
 {
        struct mod_section *got_sec = &mod->arch.got;
        int i = got_sec->num_entries;
        struct got_entry *got = get_got_entry(val, got_sec);
 
        if (got)
-               return (u64)got;
+               return (unsigned long)got;
 
        /* There is no duplicate entry, create a new one */
        got = (struct got_entry *)got_sec->shdr->sh_addr;
@@ -25,10 +25,10 @@ u64 module_emit_got_entry(struct module *mod, u64 val)
        got_sec->num_entries++;
        BUG_ON(got_sec->num_entries > got_sec->max_entries);
 
-       return (u64)&got[i];
+       return (unsigned long)&got[i];
 }
 
-u64 module_emit_plt_entry(struct module *mod, u64 val)
+unsigned long module_emit_plt_entry(struct module *mod, unsigned long val)
 {
        struct mod_section *got_plt_sec = &mod->arch.got_plt;
        struct got_entry *got_plt;
@@ -37,27 +37,29 @@ u64 module_emit_plt_entry(struct module *mod, u64 val)
        int i = plt_sec->num_entries;
 
        if (plt)
-               return (u64)plt;
+               return (unsigned long)plt;
 
        /* There is no duplicate entry, create a new one */
        got_plt = (struct got_entry *)got_plt_sec->shdr->sh_addr;
        got_plt[i] = emit_got_entry(val);
        plt = (struct plt_entry *)plt_sec->shdr->sh_addr;
-       plt[i] = emit_plt_entry(val, (u64)&plt[i], (u64)&got_plt[i]);
+       plt[i] = emit_plt_entry(val,
+                               (unsigned long)&plt[i],
+                               (unsigned long)&got_plt[i]);
 
        plt_sec->num_entries++;
        got_plt_sec->num_entries++;
        BUG_ON(plt_sec->num_entries > plt_sec->max_entries);
 
-       return (u64)&plt[i];
+       return (unsigned long)&plt[i];
 }
 
-static int is_rela_equal(const Elf64_Rela *x, const Elf64_Rela *y)
+static int is_rela_equal(const Elf_Rela *x, const Elf_Rela *y)
 {
        return x->r_info == y->r_info && x->r_addend == y->r_addend;
 }
 
-static bool duplicate_rela(const Elf64_Rela *rela, int idx)
+static bool duplicate_rela(const Elf_Rela *rela, int idx)
 {
        int i;
        for (i = 0; i < idx; i++) {
@@ -67,13 +69,13 @@ static bool duplicate_rela(const Elf64_Rela *rela, int idx)
        return false;
 }
 
-static void count_max_entries(Elf64_Rela *relas, int num,
+static void count_max_entries(Elf_Rela *relas, int num,
                              unsigned int *plts, unsigned int *gots)
 {
        unsigned int type, i;
 
        for (i = 0; i < num; i++) {
-               type = ELF64_R_TYPE(relas[i].r_info);
+               type = ELF_RISCV_R_TYPE(relas[i].r_info);
                if (type == R_RISCV_CALL_PLT) {
                        if (!duplicate_rela(relas, i))
                                (*plts)++;
@@ -118,9 +120,9 @@ int module_frob_arch_sections(Elf_Ehdr *ehdr, Elf_Shdr *sechdrs,
 
        /* Calculate the maxinum number of entries */
        for (i = 0; i < ehdr->e_shnum; i++) {
-               Elf64_Rela *relas = (void *)ehdr + sechdrs[i].sh_offset;
-               int num_rela = sechdrs[i].sh_size / sizeof(Elf64_Rela);
-               Elf64_Shdr *dst_sec = sechdrs + sechdrs[i].sh_info;
+               Elf_Rela *relas = (void *)ehdr + sechdrs[i].sh_offset;
+               int num_rela = sechdrs[i].sh_size / sizeof(Elf_Rela);
+               Elf_Shdr *dst_sec = sechdrs + sechdrs[i].sh_info;
 
                if (sechdrs[i].sh_type != SHT_RELA)
                        continue;
index 60f1e02..2ae5e02 100644 (file)
 #include <asm/ptrace.h>
 #include <asm/syscall.h>
 #include <asm/thread_info.h>
+#include <linux/audit.h>
 #include <linux/ptrace.h>
 #include <linux/elf.h>
 #include <linux/regset.h>
 #include <linux/sched.h>
 #include <linux/sched/task_stack.h>
 #include <linux/tracehook.h>
+
+#define CREATE_TRACE_POINTS
 #include <trace/events/syscalls.h>
 
 enum riscv_regset {
@@ -163,15 +166,19 @@ void do_syscall_trace_enter(struct pt_regs *regs)
        if (test_thread_flag(TIF_SYSCALL_TRACEPOINT))
                trace_sys_enter(regs, syscall_get_nr(current, regs));
 #endif
+
+       audit_syscall_entry(regs->a7, regs->a0, regs->a1, regs->a2, regs->a3);
 }
 
 void do_syscall_trace_exit(struct pt_regs *regs)
 {
+       audit_syscall_exit(regs);
+
        if (test_thread_flag(TIF_SYSCALL_TRACE))
                tracehook_report_syscall_exit(regs, 0);
 
 #ifdef CONFIG_HAVE_SYSCALL_TRACEPOINTS
        if (test_thread_flag(TIF_SYSCALL_TRACEPOINT))
-               trace_sys_exit(regs, regs->regs[0]);
+               trace_sys_exit(regs, regs_return_value(regs));
 #endif
 }
index fc8006a..6e079e9 100644 (file)
@@ -149,7 +149,14 @@ asmlinkage void __init setup_vm(void)
 
 void __init parse_dtb(unsigned int hartid, void *dtb)
 {
-       early_init_dt_scan(__va(dtb));
+       if (!early_init_dt_scan(__va(dtb)))
+               return;
+
+       pr_err("No DTB passed to the kernel\n");
+#ifdef CONFIG_CMDLINE_FORCE
+       strlcpy(boot_command_line, CONFIG_CMDLINE, COMMAND_LINE_SIZE);
+       pr_info("Forcing kernel command line to: %s\n", boot_command_line);
+#endif
 }
 
 static void __init setup_bootmem(void)
index 57b1383..246635e 100644 (file)
@@ -23,6 +23,7 @@
 #include <linux/smp.h>
 #include <linux/sched.h>
 #include <linux/seq_file.h>
+#include <linux/delay.h>
 
 #include <asm/sbi.h>
 #include <asm/tlbflush.h>
@@ -31,6 +32,7 @@
 enum ipi_message_type {
        IPI_RESCHEDULE,
        IPI_CALL_FUNC,
+       IPI_CPU_STOP,
        IPI_MAX
 };
 
@@ -66,6 +68,13 @@ int setup_profiling_timer(unsigned int multiplier)
        return -EINVAL;
 }
 
+static void ipi_stop(void)
+{
+       set_cpu_online(smp_processor_id(), false);
+       while (1)
+               wait_for_interrupt();
+}
+
 void riscv_software_interrupt(void)
 {
        unsigned long *pending_ipis = &ipi_data[smp_processor_id()].bits;
@@ -94,6 +103,11 @@ void riscv_software_interrupt(void)
                        generic_smp_call_function_interrupt();
                }
 
+               if (ops & (1 << IPI_CPU_STOP)) {
+                       stats[IPI_CPU_STOP]++;
+                       ipi_stop();
+               }
+
                BUG_ON((ops >> IPI_MAX) != 0);
 
                /* Order data access and bit testing. */
@@ -121,6 +135,7 @@ send_ipi_message(const struct cpumask *to_whom, enum ipi_message_type operation)
 static const char * const ipi_names[] = {
        [IPI_RESCHEDULE]        = "Rescheduling interrupts",
        [IPI_CALL_FUNC]         = "Function call interrupts",
+       [IPI_CPU_STOP]          = "CPU stop interrupts",
 };
 
 void show_ipi_stats(struct seq_file *p, int prec)
@@ -146,15 +161,29 @@ void arch_send_call_function_single_ipi(int cpu)
        send_ipi_message(cpumask_of(cpu), IPI_CALL_FUNC);
 }
 
-static void ipi_stop(void *unused)
-{
-       while (1)
-               wait_for_interrupt();
-}
-
 void smp_send_stop(void)
 {
-       on_each_cpu(ipi_stop, NULL, 1);
+       unsigned long timeout;
+
+       if (num_online_cpus() > 1) {
+               cpumask_t mask;
+
+               cpumask_copy(&mask, cpu_online_mask);
+               cpumask_clear_cpu(smp_processor_id(), &mask);
+
+               if (system_state <= SYSTEM_RUNNING)
+                       pr_crit("SMP: stopping secondary CPUs\n");
+               send_ipi_message(&mask, IPI_CPU_STOP);
+       }
+
+       /* Wait up to one second for other CPUs to stop */
+       timeout = USEC_PER_SEC;
+       while (num_online_cpus() > 1 && timeout--)
+               udelay(1);
+
+       if (num_online_cpus() > 1)
+               pr_warn("SMP: failed to stop secondary CPUs %*pbl\n",
+                          cpumask_pr_args(cpu_online_mask));
 }
 
 void smp_send_reschedule(int cpu)
index 65df1df..1e1395d 100644 (file)
@@ -18,6 +18,8 @@
 #include <asm/cache.h>
 #include <asm/thread_info.h>
 
+#define MAX_BYTES_PER_LONG     0x10
+
 OUTPUT_ARCH(riscv)
 ENTRY(_start)
 
@@ -74,8 +76,6 @@ SECTIONS
                *(.sbss*)
        }
 
-       BSS_SECTION(PAGE_SIZE, PAGE_SIZE, 0)
-
        EXCEPTION_TABLE(0x10)
        NOTES
 
@@ -83,6 +83,10 @@ SECTIONS
                *(.rel.dyn*)
        }
 
+       BSS_SECTION(MAX_BYTES_PER_LONG,
+                   MAX_BYTES_PER_LONG,
+                   MAX_BYTES_PER_LONG)
+
        _end = .;
 
        STABS_DEBUG
index 0febf1a..6c6f630 100644 (file)
@@ -1,4 +1,5 @@
 include include/uapi/asm-generic/Kbuild.asm
 
 generic-y += kvm_para.h
+generic-y += shmparam.h
 generic-y += ucontext.h
index 6185d4f..15af091 100644 (file)
@@ -446,7 +446,7 @@ config RETPOLINE
          branches. Requires a compiler with -mindirect-branch=thunk-extern
          support for full protection. The kernel may run slower.
 
-config RESCTRL
+config X86_RESCTRL
        bool "Resource Control support"
        depends on X86 && (CPU_SUP_INTEL || CPU_SUP_AMD)
        select KERNFS
index 54990fe..40ebddd 100644 (file)
@@ -2,7 +2,7 @@
 #ifndef _ASM_X86_RESCTRL_SCHED_H
 #define _ASM_X86_RESCTRL_SCHED_H
 
-#ifdef CONFIG_RESCTRL
+#ifdef CONFIG_X86_RESCTRL
 
 #include <linux/sched.h>
 #include <linux/jump_label.h>
@@ -88,6 +88,6 @@ static inline void resctrl_sched_in(void)
 
 static inline void resctrl_sched_in(void) {}
 
-#endif /* CONFIG_RESCTRL */
+#endif /* CONFIG_X86_RESCTRL */
 
 #endif /* _ASM_X86_RESCTRL_SCHED_H */
index ac78f90..b6fa086 100644 (file)
@@ -39,7 +39,7 @@ obj-$(CONFIG_CPU_SUP_UMC_32)          += umc.o
 obj-$(CONFIG_X86_MCE)                  += mce/
 obj-$(CONFIG_MTRR)                     += mtrr/
 obj-$(CONFIG_MICROCODE)                        += microcode/
-obj-$(CONFIG_RESCTRL)                  += resctrl/
+obj-$(CONFIG_X86_RESCTRL)              += resctrl/
 
 obj-$(CONFIG_X86_LOCAL_APIC)           += perfctr-watchdog.o
 
index 8654b8b..1de0f41 100644 (file)
@@ -215,7 +215,7 @@ static enum spectre_v2_mitigation spectre_v2_enabled __ro_after_init =
 static enum spectre_v2_user_mitigation spectre_v2_user __ro_after_init =
        SPECTRE_V2_USER_NONE;
 
-#ifdef RETPOLINE
+#ifdef CONFIG_RETPOLINE
 static bool spectre_v2_bad_module;
 
 bool retpoline_module_ok(bool has_retpoline)
index 6895049..1cabe6f 100644 (file)
@@ -1,4 +1,4 @@
 # SPDX-License-Identifier: GPL-2.0
-obj-$(CONFIG_RESCTRL)  += core.o rdtgroup.o monitor.o
-obj-$(CONFIG_RESCTRL)  += ctrlmondata.o pseudo_lock.o
+obj-$(CONFIG_X86_RESCTRL)      += core.o rdtgroup.o monitor.o
+obj-$(CONFIG_X86_RESCTRL)      += ctrlmondata.o pseudo_lock.o
 CFLAGS_pseudo_lock.o = -I$(src)
index 307e5bd..a157ca5 100644 (file)
@@ -6278,6 +6278,9 @@ static int sev_guest_init(struct kvm *kvm, struct kvm_sev_cmd *argp)
        int asid, ret;
 
        ret = -EBUSY;
+       if (unlikely(sev->active))
+               return ret;
+
        asid = sev_asid_new();
        if (asid < 0)
                return ret;
index 3170e29..2616bd2 100644 (file)
@@ -4540,9 +4540,8 @@ static int handle_vmptrld(struct kvm_vcpu *vcpu)
                         * given physical address won't match the required
                         * VMCS12_REVISION identifier.
                         */
-                       nested_vmx_failValid(vcpu,
+                       return nested_vmx_failValid(vcpu,
                                VMXERR_VMPTRLD_INCORRECT_VMCS_REVISION_ID);
-                       return kvm_skip_emulated_instruction(vcpu);
                }
                new_vmcs12 = kmap(page);
                if (new_vmcs12->hdr.revision_id != VMCS12_REVISION ||
index 4d39f73..f6915f1 100644 (file)
@@ -453,7 +453,7 @@ static int hv_remote_flush_tlb_with_range(struct kvm *kvm,
                struct kvm_tlb_range *range)
 {
        struct kvm_vcpu *vcpu;
-       int ret = -ENOTSUPP, i;
+       int ret = 0, i;
 
        spin_lock(&to_kvm_vmx(kvm)->ept_pointer_lock);
 
@@ -7044,7 +7044,7 @@ static void update_intel_pt_cfg(struct kvm_vcpu *vcpu)
 
        /* unmask address range configure area */
        for (i = 0; i < vmx->pt_desc.addr_range; i++)
-               vmx->pt_desc.ctl_bitmask &= ~(0xf << (32 + i * 4));
+               vmx->pt_desc.ctl_bitmask &= ~(0xfULL << (32 + i * 4));
 }
 
 static void vmx_cpuid_update(struct kvm_vcpu *vcpu)
index c780429..3c5f61c 100644 (file)
@@ -661,7 +661,6 @@ no_merge:
  * blk_attempt_plug_merge - try to merge with %current's plugged list
  * @q: request_queue new bio is being queued at
  * @bio: new bio being queued
- * @request_count: out parameter for number of traversed plugged requests
  * @same_queue_rq: pointer to &struct request that gets filled in when
  * another request associated with @q is found on the plug list
  * (optional, may be %NULL)
@@ -1683,6 +1682,15 @@ EXPORT_SYMBOL(kblockd_mod_delayed_work_on);
  * @plug:      The &struct blk_plug that needs to be initialized
  *
  * Description:
+ *   blk_start_plug() indicates to the block layer an intent by the caller
+ *   to submit multiple I/O requests in a batch.  The block layer may use
+ *   this hint to defer submitting I/Os from the caller until blk_finish_plug()
+ *   is called.  However, the block layer may choose to submit requests
+ *   before a call to blk_finish_plug() if the number of queued I/Os
+ *   exceeds %BLK_MAX_REQUEST_COUNT, or if the size of the I/O is larger than
+ *   %BLK_PLUG_FLUSH_SIZE.  The queued I/Os may also be submitted early if
+ *   the task schedules (see below).
+ *
  *   Tracking blk_plug inside the task_struct will help with auto-flushing the
  *   pending I/O should the task end up blocking between blk_start_plug() and
  *   blk_finish_plug(). This is important from a performance perspective, but
@@ -1765,6 +1773,16 @@ void blk_flush_plug_list(struct blk_plug *plug, bool from_schedule)
                blk_mq_flush_plug_list(plug, from_schedule);
 }
 
+/**
+ * blk_finish_plug - mark the end of a batch of submitted I/O
+ * @plug:      The &struct blk_plug passed to blk_start_plug()
+ *
+ * Description:
+ * Indicate that a batch of I/O submissions is complete.  This function
+ * must be paired with an initial call to blk_start_plug().  The intent
+ * is to allow the block layer to optimize I/O submission.  See the
+ * documentation for blk_start_plug() for more information.
+ */
 void blk_finish_plug(struct blk_plug *plug)
 {
        if (plug != current->plug)
index 7b65a80..90ff0a4 100644 (file)
@@ -10,6 +10,7 @@ menuconfig ACPI
        bool "ACPI (Advanced Configuration and Power Interface) Support"
        depends on ARCH_SUPPORTS_ACPI
        select PNP
+       select NLS
        default y if X86
        help
          Advanced Configuration and Power Interface (ACPI) support for 
index fdd90ff..e48894e 100644 (file)
@@ -876,7 +876,7 @@ int iort_iommu_msi_get_resv_regions(struct device *dev, struct list_head *head)
        return (resv == its->its_count) ? resv : -ENODEV;
 }
 #else
-static inline const struct iommu_ops *iort_fwspec_iommu_ops(struct device *dev);
+static inline const struct iommu_ops *iort_fwspec_iommu_ops(struct device *dev)
 { return NULL; }
 static inline int iort_add_device_replay(const struct iommu_ops *ops,
                                         struct device *dev)
@@ -952,9 +952,10 @@ static int rc_dma_get_range(struct device *dev, u64 *size)
 {
        struct acpi_iort_node *node;
        struct acpi_iort_root_complex *rc;
+       struct pci_bus *pbus = to_pci_dev(dev)->bus;
 
        node = iort_scan_node(ACPI_IORT_NODE_PCI_ROOT_COMPLEX,
-                             iort_match_node_callback, dev);
+                             iort_match_node_callback, &pbus->dev);
        if (!node || node->revision < 1)
                return -ENODEV;
 
index 2746994..7bbbf82 100644 (file)
@@ -146,9 +146,9 @@ acpi_table_print_srat_entry(struct acpi_subtable_header *header)
                {
                        struct acpi_srat_mem_affinity *p =
                            (struct acpi_srat_mem_affinity *)header;
-                       pr_debug("SRAT Memory (0x%lx length 0x%lx) in proximity domain %d %s%s%s\n",
-                                (unsigned long)p->base_address,
-                                (unsigned long)p->length,
+                       pr_debug("SRAT Memory (0x%llx length 0x%llx) in proximity domain %d %s%s%s\n",
+                                (unsigned long long)p->base_address,
+                                (unsigned long long)p->length,
                                 p->proximity_domain,
                                 (p->flags & ACPI_SRAT_MEM_ENABLED) ?
                                 "enabled" : "disabled",
index 2579675..e7c0006 100644 (file)
 #define GPI1_LDO_ON            (3 << 0)
 #define GPI1_LDO_OFF           (4 << 0)
 
-#define AXP288_ADC_TS_PIN_GPADC        0xf2
-#define AXP288_ADC_TS_PIN_ON   0xf3
+#define AXP288_ADC_TS_CURRENT_ON_OFF_MASK              GENMASK(1, 0)
+#define AXP288_ADC_TS_CURRENT_OFF                      (0 << 0)
+#define AXP288_ADC_TS_CURRENT_ON_WHEN_CHARGING         (1 << 0)
+#define AXP288_ADC_TS_CURRENT_ON_ONDEMAND              (2 << 0)
+#define AXP288_ADC_TS_CURRENT_ON                       (3 << 0)
 
 static struct pmic_table power_table[] = {
        {
@@ -212,22 +215,44 @@ out:
  */
 static int intel_xpower_pmic_get_raw_temp(struct regmap *regmap, int reg)
 {
+       int ret, adc_ts_pin_ctrl;
        u8 buf[2];
-       int ret;
 
-       ret = regmap_write(regmap, AXP288_ADC_TS_PIN_CTRL,
-                          AXP288_ADC_TS_PIN_GPADC);
+       /*
+        * The current-source used for the battery temp-sensor (TS) is shared
+        * with the GPADC. For proper fuel-gauge and charger operation the TS
+        * current-source needs to be permanently on. But to read the GPADC we
+        * need to temporary switch the TS current-source to ondemand, so that
+        * the GPADC can use it, otherwise we will always read an all 0 value.
+        *
+        * Note that the switching from on to on-ondemand is not necessary
+        * when the TS current-source is off (this happens on devices which
+        * do not use the TS-pin).
+        */
+       ret = regmap_read(regmap, AXP288_ADC_TS_PIN_CTRL, &adc_ts_pin_ctrl);
        if (ret)
                return ret;
 
-       /* After switching to the GPADC pin give things some time to settle */
-       usleep_range(6000, 10000);
+       if (adc_ts_pin_ctrl & AXP288_ADC_TS_CURRENT_ON_OFF_MASK) {
+               ret = regmap_update_bits(regmap, AXP288_ADC_TS_PIN_CTRL,
+                                        AXP288_ADC_TS_CURRENT_ON_OFF_MASK,
+                                        AXP288_ADC_TS_CURRENT_ON_ONDEMAND);
+               if (ret)
+                       return ret;
+
+               /* Wait a bit after switching the current-source */
+               usleep_range(6000, 10000);
+       }
 
        ret = regmap_bulk_read(regmap, AXP288_GP_ADC_H, buf, 2);
        if (ret == 0)
                ret = (buf[0] << 4) + ((buf[1] >> 4) & 0x0f);
 
-       regmap_write(regmap, AXP288_ADC_TS_PIN_CTRL, AXP288_ADC_TS_PIN_ON);
+       if (adc_ts_pin_ctrl & AXP288_ADC_TS_CURRENT_ON_OFF_MASK) {
+               regmap_update_bits(regmap, AXP288_ADC_TS_PIN_CTRL,
+                                  AXP288_ADC_TS_CURRENT_ON_OFF_MASK,
+                                  AXP288_ADC_TS_CURRENT_ON);
+       }
 
        return ret;
 }
index 1b475bc..665e93c 100644 (file)
@@ -131,6 +131,23 @@ void acpi_power_resources_list_free(struct list_head *list)
        }
 }
 
+static bool acpi_power_resource_is_dup(union acpi_object *package,
+                                      unsigned int start, unsigned int i)
+{
+       acpi_handle rhandle, dup;
+       unsigned int j;
+
+       /* The caller is expected to check the package element types */
+       rhandle = package->package.elements[i].reference.handle;
+       for (j = start; j < i; j++) {
+               dup = package->package.elements[j].reference.handle;
+               if (dup == rhandle)
+                       return true;
+       }
+
+       return false;
+}
+
 int acpi_extract_power_resources(union acpi_object *package, unsigned int start,
                                 struct list_head *list)
 {
@@ -150,6 +167,11 @@ int acpi_extract_power_resources(union acpi_object *package, unsigned int start,
                        err = -ENODEV;
                        break;
                }
+
+               /* Some ACPI tables contain duplicate power resource references */
+               if (acpi_power_resource_is_dup(package, start, i))
+                       continue;
+
                err = acpi_add_power_resource(rhandle);
                if (err)
                        break;
index ef356e7..8810475 100644 (file)
@@ -254,6 +254,8 @@ enum {
        AHCI_HFLAG_IS_MOBILE            = (1 << 25), /* mobile chipset, use
                                                        SATA_MOBILE_LPM_POLICY
                                                        as default lpm_policy */
+       AHCI_HFLAG_SUSPEND_PHYS         = (1 << 26), /* handle PHYs during
+                                                       suspend/resume */
 
        /* ap->flags bits */
 
index f9cb51b..d4bba3a 100644 (file)
 #define AHCI_WINDOW_BASE(win)  (0x64 + ((win) << 4))
 #define AHCI_WINDOW_SIZE(win)  (0x68 + ((win) << 4))
 
+struct ahci_mvebu_plat_data {
+       int (*plat_config)(struct ahci_host_priv *hpriv);
+       unsigned int flags;
+};
+
 static void ahci_mvebu_mbus_config(struct ahci_host_priv *hpriv,
                                   const struct mbus_dram_target_info *dram)
 {
@@ -62,6 +67,35 @@ static void ahci_mvebu_regret_option(struct ahci_host_priv *hpriv)
        writel(0x80, hpriv->mmio + AHCI_VENDOR_SPECIFIC_0_DATA);
 }
 
+static int ahci_mvebu_armada_380_config(struct ahci_host_priv *hpriv)
+{
+       const struct mbus_dram_target_info *dram;
+       int rc = 0;
+
+       dram = mv_mbus_dram_info();
+       if (dram)
+               ahci_mvebu_mbus_config(hpriv, dram);
+       else
+               rc = -ENODEV;
+
+       ahci_mvebu_regret_option(hpriv);
+
+       return rc;
+}
+
+static int ahci_mvebu_armada_3700_config(struct ahci_host_priv *hpriv)
+{
+       u32 reg;
+
+       writel(0, hpriv->mmio + AHCI_VENDOR_SPECIFIC_0_ADDR);
+
+       reg = readl(hpriv->mmio + AHCI_VENDOR_SPECIFIC_0_DATA);
+       reg |= BIT(6);
+       writel(reg, hpriv->mmio + AHCI_VENDOR_SPECIFIC_0_DATA);
+
+       return 0;
+}
+
 /**
  * ahci_mvebu_stop_engine
  *
@@ -126,13 +160,9 @@ static int ahci_mvebu_resume(struct platform_device *pdev)
 {
        struct ata_host *host = platform_get_drvdata(pdev);
        struct ahci_host_priv *hpriv = host->private_data;
-       const struct mbus_dram_target_info *dram;
+       const struct ahci_mvebu_plat_data *pdata = hpriv->plat_data;
 
-       dram = mv_mbus_dram_info();
-       if (dram)
-               ahci_mvebu_mbus_config(hpriv, dram);
-
-       ahci_mvebu_regret_option(hpriv);
+       pdata->plat_config(hpriv);
 
        return ahci_platform_resume_host(&pdev->dev);
 }
@@ -154,29 +184,30 @@ static struct scsi_host_template ahci_platform_sht = {
 
 static int ahci_mvebu_probe(struct platform_device *pdev)
 {
+       const struct ahci_mvebu_plat_data *pdata;
        struct ahci_host_priv *hpriv;
-       const struct mbus_dram_target_info *dram;
        int rc;
 
+       pdata = of_device_get_match_data(&pdev->dev);
+       if (!pdata)
+               return -EINVAL;
+
        hpriv = ahci_platform_get_resources(pdev, 0);
        if (IS_ERR(hpriv))
                return PTR_ERR(hpriv);
 
+       hpriv->flags |= pdata->flags;
+       hpriv->plat_data = (void *)pdata;
+
        rc = ahci_platform_enable_resources(hpriv);
        if (rc)
                return rc;
 
        hpriv->stop_engine = ahci_mvebu_stop_engine;
 
-       if (of_device_is_compatible(pdev->dev.of_node,
-                                   "marvell,armada-380-ahci")) {
-               dram = mv_mbus_dram_info();
-               if (!dram)
-                       return -ENODEV;
-
-               ahci_mvebu_mbus_config(hpriv, dram);
-               ahci_mvebu_regret_option(hpriv);
-       }
+       rc = pdata->plat_config(hpriv);
+       if (rc)
+               goto disable_resources;
 
        rc = ahci_platform_init_host(pdev, hpriv, &ahci_mvebu_port_info,
                                     &ahci_platform_sht);
@@ -190,18 +221,28 @@ disable_resources:
        return rc;
 }
 
+static const struct ahci_mvebu_plat_data ahci_mvebu_armada_380_plat_data = {
+       .plat_config = ahci_mvebu_armada_380_config,
+};
+
+static const struct ahci_mvebu_plat_data ahci_mvebu_armada_3700_plat_data = {
+       .plat_config = ahci_mvebu_armada_3700_config,
+       .flags = AHCI_HFLAG_SUSPEND_PHYS,
+};
+
 static const struct of_device_id ahci_mvebu_of_match[] = {
-       { .compatible = "marvell,armada-380-ahci", },
-       { .compatible = "marvell,armada-3700-ahci", },
+       {
+               .compatible = "marvell,armada-380-ahci",
+               .data = &ahci_mvebu_armada_380_plat_data,
+       },
+       {
+               .compatible = "marvell,armada-3700-ahci",
+               .data = &ahci_mvebu_armada_3700_plat_data,
+       },
        { },
 };
 MODULE_DEVICE_TABLE(of, ahci_mvebu_of_match);
 
-/*
- * We currently don't provide power management related operations,
- * since there is no suspend/resume support at the platform level for
- * Armada 38x for the moment.
- */
 static struct platform_driver ahci_mvebu_driver = {
        .probe = ahci_mvebu_probe,
        .remove = ata_platform_remove_one,
index 4b900fc..81b1a33 100644 (file)
@@ -56,6 +56,12 @@ static int ahci_platform_enable_phys(struct ahci_host_priv *hpriv)
                if (rc)
                        goto disable_phys;
 
+               rc = phy_set_mode(hpriv->phys[i], PHY_MODE_SATA);
+               if (rc) {
+                       phy_exit(hpriv->phys[i]);
+                       goto disable_phys;
+               }
+
                rc = phy_power_on(hpriv->phys[i]);
                if (rc) {
                        phy_exit(hpriv->phys[i]);
@@ -738,6 +744,9 @@ int ahci_platform_suspend_host(struct device *dev)
        writel(ctl, mmio + HOST_CTL);
        readl(mmio + HOST_CTL); /* flush */
 
+       if (hpriv->flags & AHCI_HFLAG_SUSPEND_PHYS)
+               ahci_platform_disable_phys(hpriv);
+
        return ata_host_suspend(host, PMSG_SUSPEND);
 }
 EXPORT_SYMBOL_GPL(ahci_platform_suspend_host);
@@ -756,6 +765,7 @@ EXPORT_SYMBOL_GPL(ahci_platform_suspend_host);
 int ahci_platform_resume_host(struct device *dev)
 {
        struct ata_host *host = dev_get_drvdata(dev);
+       struct ahci_host_priv *hpriv = host->private_data;
        int rc;
 
        if (dev->power.power_state.event == PM_EVENT_SUSPEND) {
@@ -766,6 +776,9 @@ int ahci_platform_resume_host(struct device *dev)
                ahci_init_controller(host);
        }
 
+       if (hpriv->flags & AHCI_HFLAG_SUSPEND_PHYS)
+               ahci_platform_enable_phys(hpriv);
+
        ata_host_resume(host);
 
        return 0;
index 4dc528b..9c1247d 100644 (file)
@@ -729,8 +729,8 @@ static int sata_fsl_port_start(struct ata_port *ap)
        if (!pp)
                return -ENOMEM;
 
-       mem = dma_zalloc_coherent(dev, SATA_FSL_PORT_PRIV_DMA_SZ, &mem_dma,
-                                 GFP_KERNEL);
+       mem = dma_alloc_coherent(dev, SATA_FSL_PORT_PRIV_DMA_SZ, &mem_dma,
+                                GFP_KERNEL);
        if (!mem) {
                kfree(pp);
                return -ENOMEM;
index 29f102d..2e9d1cf 100644 (file)
@@ -533,9 +533,10 @@ static void he_init_tx_lbfp(struct he_dev *he_dev)
 
 static int he_init_tpdrq(struct he_dev *he_dev)
 {
-       he_dev->tpdrq_base = dma_zalloc_coherent(&he_dev->pci_dev->dev,
-                                                CONFIG_TPDRQ_SIZE * sizeof(struct he_tpdrq),
-                                                &he_dev->tpdrq_phys, GFP_KERNEL);
+       he_dev->tpdrq_base = dma_alloc_coherent(&he_dev->pci_dev->dev,
+                                               CONFIG_TPDRQ_SIZE * sizeof(struct he_tpdrq),
+                                               &he_dev->tpdrq_phys,
+                                               GFP_KERNEL);
        if (he_dev->tpdrq_base == NULL) {
                hprintk("failed to alloc tpdrq\n");
                return -ENOMEM;
@@ -805,9 +806,9 @@ static int he_init_group(struct he_dev *he_dev, int group)
                goto out_free_rbpl_virt;
        }
 
-       he_dev->rbpl_base = dma_zalloc_coherent(&he_dev->pci_dev->dev,
-                                               CONFIG_RBPL_SIZE * sizeof(struct he_rbp),
-                                               &he_dev->rbpl_phys, GFP_KERNEL);
+       he_dev->rbpl_base = dma_alloc_coherent(&he_dev->pci_dev->dev,
+                                              CONFIG_RBPL_SIZE * sizeof(struct he_rbp),
+                                              &he_dev->rbpl_phys, GFP_KERNEL);
        if (he_dev->rbpl_base == NULL) {
                hprintk("failed to alloc rbpl_base\n");
                goto out_destroy_rbpl_pool;
@@ -844,9 +845,9 @@ static int he_init_group(struct he_dev *he_dev, int group)
 
        /* rx buffer ready queue */
 
-       he_dev->rbrq_base = dma_zalloc_coherent(&he_dev->pci_dev->dev,
-                                               CONFIG_RBRQ_SIZE * sizeof(struct he_rbrq),
-                                               &he_dev->rbrq_phys, GFP_KERNEL);
+       he_dev->rbrq_base = dma_alloc_coherent(&he_dev->pci_dev->dev,
+                                              CONFIG_RBRQ_SIZE * sizeof(struct he_rbrq),
+                                              &he_dev->rbrq_phys, GFP_KERNEL);
        if (he_dev->rbrq_base == NULL) {
                hprintk("failed to allocate rbrq\n");
                goto out_free_rbpl;
@@ -868,9 +869,9 @@ static int he_init_group(struct he_dev *he_dev, int group)
 
        /* tx buffer ready queue */
 
-       he_dev->tbrq_base = dma_zalloc_coherent(&he_dev->pci_dev->dev,
-                                               CONFIG_TBRQ_SIZE * sizeof(struct he_tbrq),
-                                               &he_dev->tbrq_phys, GFP_KERNEL);
+       he_dev->tbrq_base = dma_alloc_coherent(&he_dev->pci_dev->dev,
+                                              CONFIG_TBRQ_SIZE * sizeof(struct he_tbrq),
+                                              &he_dev->tbrq_phys, GFP_KERNEL);
        if (he_dev->tbrq_base == NULL) {
                hprintk("failed to allocate tbrq\n");
                goto out_free_rbpq_base;
@@ -913,11 +914,9 @@ static int he_init_irq(struct he_dev *he_dev)
        /* 2.9.3.5  tail offset for each interrupt queue is located after the
                    end of the interrupt queue */
 
-       he_dev->irq_base = dma_zalloc_coherent(&he_dev->pci_dev->dev,
-                                              (CONFIG_IRQ_SIZE + 1)
-                                              * sizeof(struct he_irq),
-                                              &he_dev->irq_phys,
-                                              GFP_KERNEL);
+       he_dev->irq_base = dma_alloc_coherent(&he_dev->pci_dev->dev,
+                                             (CONFIG_IRQ_SIZE + 1) * sizeof(struct he_irq),
+                                             &he_dev->irq_phys, GFP_KERNEL);
        if (he_dev->irq_base == NULL) {
                hprintk("failed to allocate irq\n");
                return -ENOMEM;
@@ -1464,9 +1463,9 @@ static int he_start(struct atm_dev *dev)
 
        /* host status page */
 
-       he_dev->hsp = dma_zalloc_coherent(&he_dev->pci_dev->dev,
-                                         sizeof(struct he_hsp),
-                                         &he_dev->hsp_phys, GFP_KERNEL);
+       he_dev->hsp = dma_alloc_coherent(&he_dev->pci_dev->dev,
+                                        sizeof(struct he_hsp),
+                                        &he_dev->hsp_phys, GFP_KERNEL);
        if (he_dev->hsp == NULL) {
                hprintk("failed to allocate host status page\n");
                return -ENOMEM;
index 6e73714..43a1457 100644 (file)
@@ -641,8 +641,8 @@ alloc_scq(struct idt77252_dev *card, int class)
        scq = kzalloc(sizeof(struct scq_info), GFP_KERNEL);
        if (!scq)
                return NULL;
-       scq->base = dma_zalloc_coherent(&card->pcidev->dev, SCQ_SIZE,
-                                       &scq->paddr, GFP_KERNEL);
+       scq->base = dma_alloc_coherent(&card->pcidev->dev, SCQ_SIZE,
+                                      &scq->paddr, GFP_KERNEL);
        if (scq->base == NULL) {
                kfree(scq);
                return NULL;
@@ -971,8 +971,8 @@ init_rsq(struct idt77252_dev *card)
 {
        struct rsq_entry *rsqe;
 
-       card->rsq.base = dma_zalloc_coherent(&card->pcidev->dev, RSQSIZE,
-                                            &card->rsq.paddr, GFP_KERNEL);
+       card->rsq.base = dma_alloc_coherent(&card->pcidev->dev, RSQSIZE,
+                                           &card->rsq.paddr, GFP_KERNEL);
        if (card->rsq.base == NULL) {
                printk("%s: can't allocate RSQ.\n", card->name);
                return -1;
@@ -3390,10 +3390,10 @@ static int init_card(struct atm_dev *dev)
        writel(0, SAR_REG_GP);
 
        /* Initialize RAW Cell Handle Register  */
-       card->raw_cell_hnd = dma_zalloc_coherent(&card->pcidev->dev,
-                                                2 * sizeof(u32),
-                                                &card->raw_cell_paddr,
-                                                GFP_KERNEL);
+       card->raw_cell_hnd = dma_alloc_coherent(&card->pcidev->dev,
+                                               2 * sizeof(u32),
+                                               &card->raw_cell_paddr,
+                                               GFP_KERNEL);
        if (!card->raw_cell_hnd) {
                printk("%s: memory allocation failure.\n", card->name);
                deinit_card(card);
index a690fd4..0992e67 100644 (file)
@@ -32,6 +32,7 @@
 #include <trace/events/power.h>
 #include <linux/cpufreq.h>
 #include <linux/cpuidle.h>
+#include <linux/devfreq.h>
 #include <linux/timer.h>
 
 #include "../base.h"
@@ -1078,6 +1079,7 @@ void dpm_resume(pm_message_t state)
        dpm_show_time(starttime, state, 0, NULL);
 
        cpufreq_resume();
+       devfreq_resume();
        trace_suspend_resume(TPS("dpm_resume"), state.event, false);
 }
 
@@ -1852,6 +1854,7 @@ int dpm_suspend(pm_message_t state)
        trace_suspend_resume(TPS("dpm_suspend"), state.event, true);
        might_sleep();
 
+       devfreq_suspend();
        cpufreq_suspend();
 
        mutex_lock(&dpm_list_mtx);
index 7062469..457be03 100644 (file)
@@ -121,7 +121,7 @@ static void pm_runtime_cancel_pending(struct device *dev)
  * Compute the autosuspend-delay expiration time based on the device's
  * power.last_busy time.  If the delay has already expired or is disabled
  * (negative) or the power.use_autosuspend flag isn't set, return 0.
- * Otherwise return the expiration time in jiffies (adjusted to be nonzero).
+ * Otherwise return the expiration time in nanoseconds (adjusted to be nonzero).
  *
  * This function may be called either with or without dev->power.lock held.
  * Either way it can be racy, since power.last_busy may be updated at any time.
@@ -141,7 +141,7 @@ u64 pm_runtime_autosuspend_expiration(struct device *dev)
 
        last_busy = READ_ONCE(dev->power.last_busy);
 
-       expires = last_busy + autosuspend_delay * NSEC_PER_MSEC;
+       expires = last_busy + (u64)autosuspend_delay * NSEC_PER_MSEC;
        if (expires <= now)
                expires = 0;    /* Already expired. */
 
@@ -525,7 +525,7 @@ static int rpm_suspend(struct device *dev, int rpmflags)
                                 * We add a slack of 25% to gather wakeups
                                 * without sacrificing the granularity.
                                 */
-                               u64 slack = READ_ONCE(dev->power.autosuspend_delay) *
+                               u64 slack = (u64)READ_ONCE(dev->power.autosuspend_delay) *
                                                    (NSEC_PER_MSEC >> 2);
 
                                dev->power.timer_expires = expires;
@@ -905,7 +905,10 @@ static enum hrtimer_restart  pm_suspend_timer_fn(struct hrtimer *timer)
        spin_lock_irqsave(&dev->power.lock, flags);
 
        expires = dev->power.timer_expires;
-       /* If 'expire' is after 'jiffies' we've been called too early. */
+       /*
+        * If 'expires' is after the current time, we've been called
+        * too early.
+        */
        if (expires > 0 && expires < ktime_to_ns(ktime_get())) {
                dev->power.timer_expires = 0;
                rpm_suspend(dev, dev->power.timer_autosuspends ?
index b8a0720..cf55389 100644 (file)
@@ -1190,6 +1190,12 @@ loop_set_status(struct loop_device *lo, const struct loop_info64 *info)
                goto out_unlock;
        }
 
+       if (lo->lo_offset != info->lo_offset ||
+           lo->lo_sizelimit != info->lo_sizelimit) {
+               sync_blockdev(lo->lo_device);
+               kill_bdev(lo->lo_device);
+       }
+
        /* I/O need to be drained during transfer transition */
        blk_mq_freeze_queue(lo->lo_queue);
 
@@ -1218,6 +1224,14 @@ loop_set_status(struct loop_device *lo, const struct loop_info64 *info)
 
        if (lo->lo_offset != info->lo_offset ||
            lo->lo_sizelimit != info->lo_sizelimit) {
+               /* kill_bdev should have truncated all the pages */
+               if (lo->lo_device->bd_inode->i_mapping->nrpages) {
+                       err = -EAGAIN;
+                       pr_warn("%s: loop%d (%s) has still dirty pages (nrpages=%lu)\n",
+                               __func__, lo->lo_number, lo->lo_file_name,
+                               lo->lo_device->bd_inode->i_mapping->nrpages);
+                       goto out_unfreeze;
+               }
                if (figure_loop_size(lo, info->lo_offset, info->lo_sizelimit)) {
                        err = -EFBIG;
                        goto out_unfreeze;
@@ -1443,22 +1457,39 @@ static int loop_set_dio(struct loop_device *lo, unsigned long arg)
 
 static int loop_set_block_size(struct loop_device *lo, unsigned long arg)
 {
+       int err = 0;
+
        if (lo->lo_state != Lo_bound)
                return -ENXIO;
 
        if (arg < 512 || arg > PAGE_SIZE || !is_power_of_2(arg))
                return -EINVAL;
 
+       if (lo->lo_queue->limits.logical_block_size != arg) {
+               sync_blockdev(lo->lo_device);
+               kill_bdev(lo->lo_device);
+       }
+
        blk_mq_freeze_queue(lo->lo_queue);
 
+       /* kill_bdev should have truncated all the pages */
+       if (lo->lo_queue->limits.logical_block_size != arg &&
+                       lo->lo_device->bd_inode->i_mapping->nrpages) {
+               err = -EAGAIN;
+               pr_warn("%s: loop%d (%s) has still dirty pages (nrpages=%lu)\n",
+                       __func__, lo->lo_number, lo->lo_file_name,
+                       lo->lo_device->bd_inode->i_mapping->nrpages);
+               goto out_unfreeze;
+       }
+
        blk_queue_logical_block_size(lo->lo_queue, arg);
        blk_queue_physical_block_size(lo->lo_queue, arg);
        blk_queue_io_min(lo->lo_queue, arg);
        loop_update_dio(lo);
-
+out_unfreeze:
        blk_mq_unfreeze_queue(lo->lo_queue);
 
-       return 0;
+       return err;
 }
 
 static int lo_simple_ioctl(struct loop_device *lo, unsigned int cmd,
index b3df279..34b22d6 100644 (file)
@@ -97,6 +97,7 @@ void null_zone_reset(struct nullb_cmd *cmd, sector_t sector);
 #else
 static inline int null_zone_init(struct nullb_device *dev)
 {
+       pr_err("null_blk: CONFIG_BLK_DEV_ZONED not enabled\n");
        return -EINVAL;
 }
 static inline void null_zone_exit(struct nullb_device *dev) {}
index 8e5140b..1e92b61 100644 (file)
@@ -5986,7 +5986,6 @@ static ssize_t do_rbd_remove(struct bus_type *bus,
        struct list_head *tmp;
        int dev_id;
        char opt_buf[6];
-       bool already = false;
        bool force = false;
        int ret;
 
@@ -6019,13 +6018,13 @@ static ssize_t do_rbd_remove(struct bus_type *bus,
                spin_lock_irq(&rbd_dev->lock);
                if (rbd_dev->open_count && !force)
                        ret = -EBUSY;
-               else
-                       already = test_and_set_bit(RBD_DEV_FLAG_REMOVING,
-                                                       &rbd_dev->flags);
+               else if (test_and_set_bit(RBD_DEV_FLAG_REMOVING,
+                                         &rbd_dev->flags))
+                       ret = -EINPROGRESS;
                spin_unlock_irq(&rbd_dev->lock);
        }
        spin_unlock(&rbd_dev_list_lock);
-       if (ret < 0 || already)
+       if (ret)
                return ret;
 
        if (force) {
index a10d573..ab893a7 100644 (file)
@@ -2641,8 +2641,8 @@ static int skd_cons_skcomp(struct skd_device *skdev)
                "comp pci_alloc, total bytes %zd entries %d\n",
                SKD_SKCOMP_SIZE, SKD_N_COMPLETION_ENTRY);
 
-       skcomp = dma_zalloc_coherent(&skdev->pdev->dev, SKD_SKCOMP_SIZE,
-                                    &skdev->cq_dma_address, GFP_KERNEL);
+       skcomp = dma_alloc_coherent(&skdev->pdev->dev, SKD_SKCOMP_SIZE,
+                                   &skdev->cq_dma_address, GFP_KERNEL);
 
        if (skcomp == NULL) {
                rc = -ENOMEM;
index 33c5cc8..04ca659 100644 (file)
@@ -316,11 +316,9 @@ static ssize_t idle_store(struct device *dev,
                 * See the comment in writeback_store.
                 */
                zram_slot_lock(zram, index);
-               if (!zram_allocated(zram, index) ||
-                               zram_test_flag(zram, index, ZRAM_UNDER_WB))
-                       goto next;
-               zram_set_flag(zram, index, ZRAM_IDLE);
-next:
+               if (zram_allocated(zram, index) &&
+                               !zram_test_flag(zram, index, ZRAM_UNDER_WB))
+                       zram_set_flag(zram, index, ZRAM_IDLE);
                zram_slot_unlock(zram, index);
        }
 
@@ -330,6 +328,41 @@ next:
 }
 
 #ifdef CONFIG_ZRAM_WRITEBACK
+static ssize_t writeback_limit_enable_store(struct device *dev,
+               struct device_attribute *attr, const char *buf, size_t len)
+{
+       struct zram *zram = dev_to_zram(dev);
+       u64 val;
+       ssize_t ret = -EINVAL;
+
+       if (kstrtoull(buf, 10, &val))
+               return ret;
+
+       down_read(&zram->init_lock);
+       spin_lock(&zram->wb_limit_lock);
+       zram->wb_limit_enable = val;
+       spin_unlock(&zram->wb_limit_lock);
+       up_read(&zram->init_lock);
+       ret = len;
+
+       return ret;
+}
+
+static ssize_t writeback_limit_enable_show(struct device *dev,
+               struct device_attribute *attr, char *buf)
+{
+       bool val;
+       struct zram *zram = dev_to_zram(dev);
+
+       down_read(&zram->init_lock);
+       spin_lock(&zram->wb_limit_lock);
+       val = zram->wb_limit_enable;
+       spin_unlock(&zram->wb_limit_lock);
+       up_read(&zram->init_lock);
+
+       return scnprintf(buf, PAGE_SIZE, "%d\n", val);
+}
+
 static ssize_t writeback_limit_store(struct device *dev,
                struct device_attribute *attr, const char *buf, size_t len)
 {
@@ -341,9 +374,9 @@ static ssize_t writeback_limit_store(struct device *dev,
                return ret;
 
        down_read(&zram->init_lock);
-       atomic64_set(&zram->stats.bd_wb_limit, val);
-       if (val == 0)
-               zram->stop_writeback = false;
+       spin_lock(&zram->wb_limit_lock);
+       zram->bd_wb_limit = val;
+       spin_unlock(&zram->wb_limit_lock);
        up_read(&zram->init_lock);
        ret = len;
 
@@ -357,7 +390,9 @@ static ssize_t writeback_limit_show(struct device *dev,
        struct zram *zram = dev_to_zram(dev);
 
        down_read(&zram->init_lock);
-       val = atomic64_read(&zram->stats.bd_wb_limit);
+       spin_lock(&zram->wb_limit_lock);
+       val = zram->bd_wb_limit;
+       spin_unlock(&zram->wb_limit_lock);
        up_read(&zram->init_lock);
 
        return scnprintf(buf, PAGE_SIZE, "%llu\n", val);
@@ -588,8 +623,8 @@ static int read_from_bdev_async(struct zram *zram, struct bio_vec *bvec,
        return 1;
 }
 
-#define HUGE_WRITEBACK 0x1
-#define IDLE_WRITEBACK 0x2
+#define HUGE_WRITEBACK 1
+#define IDLE_WRITEBACK 2
 
 static ssize_t writeback_store(struct device *dev,
                struct device_attribute *attr, const char *buf, size_t len)
@@ -602,7 +637,7 @@ static ssize_t writeback_store(struct device *dev,
        struct page *page;
        ssize_t ret, sz;
        char mode_buf[8];
-       unsigned long mode = -1UL;
+       int mode = -1;
        unsigned long blk_idx = 0;
 
        sz = strscpy(mode_buf, buf, sizeof(mode_buf));
@@ -618,7 +653,7 @@ static ssize_t writeback_store(struct device *dev,
        else if (!strcmp(mode_buf, "huge"))
                mode = HUGE_WRITEBACK;
 
-       if (mode == -1UL)
+       if (mode == -1)
                return -EINVAL;
 
        down_read(&zram->init_lock);
@@ -645,10 +680,13 @@ static ssize_t writeback_store(struct device *dev,
                bvec.bv_len = PAGE_SIZE;
                bvec.bv_offset = 0;
 
-               if (zram->stop_writeback) {
+               spin_lock(&zram->wb_limit_lock);
+               if (zram->wb_limit_enable && !zram->bd_wb_limit) {
+                       spin_unlock(&zram->wb_limit_lock);
                        ret = -EIO;
                        break;
                }
+               spin_unlock(&zram->wb_limit_lock);
 
                if (!blk_idx) {
                        blk_idx = alloc_block_bdev(zram);
@@ -667,10 +705,11 @@ static ssize_t writeback_store(struct device *dev,
                                zram_test_flag(zram, index, ZRAM_UNDER_WB))
                        goto next;
 
-               if ((mode & IDLE_WRITEBACK &&
-                         !zram_test_flag(zram, index, ZRAM_IDLE)) &&
-                   (mode & HUGE_WRITEBACK &&
-                         !zram_test_flag(zram, index, ZRAM_HUGE)))
+               if (mode == IDLE_WRITEBACK &&
+                         !zram_test_flag(zram, index, ZRAM_IDLE))
+                       goto next;
+               if (mode == HUGE_WRITEBACK &&
+                         !zram_test_flag(zram, index, ZRAM_HUGE))
                        goto next;
                /*
                 * Clearing ZRAM_UNDER_WB is duty of caller.
@@ -732,11 +771,10 @@ static ssize_t writeback_store(struct device *dev,
                zram_set_element(zram, index, blk_idx);
                blk_idx = 0;
                atomic64_inc(&zram->stats.pages_stored);
-               if (atomic64_add_unless(&zram->stats.bd_wb_limit,
-                                       -1 << (PAGE_SHIFT - 12), 0)) {
-                       if (atomic64_read(&zram->stats.bd_wb_limit) == 0)
-                               zram->stop_writeback = true;
-               }
+               spin_lock(&zram->wb_limit_lock);
+               if (zram->wb_limit_enable && zram->bd_wb_limit > 0)
+                       zram->bd_wb_limit -=  1UL << (PAGE_SHIFT - 12);
+               spin_unlock(&zram->wb_limit_lock);
 next:
                zram_slot_unlock(zram, index);
        }
@@ -1812,6 +1850,7 @@ static DEVICE_ATTR_RW(comp_algorithm);
 static DEVICE_ATTR_RW(backing_dev);
 static DEVICE_ATTR_WO(writeback);
 static DEVICE_ATTR_RW(writeback_limit);
+static DEVICE_ATTR_RW(writeback_limit_enable);
 #endif
 
 static struct attribute *zram_disk_attrs[] = {
@@ -1828,6 +1867,7 @@ static struct attribute *zram_disk_attrs[] = {
        &dev_attr_backing_dev.attr,
        &dev_attr_writeback.attr,
        &dev_attr_writeback_limit.attr,
+       &dev_attr_writeback_limit_enable.attr,
 #endif
        &dev_attr_io_stat.attr,
        &dev_attr_mm_stat.attr,
@@ -1867,7 +1907,9 @@ static int zram_add(void)
        device_id = ret;
 
        init_rwsem(&zram->init_lock);
-
+#ifdef CONFIG_ZRAM_WRITEBACK
+       spin_lock_init(&zram->wb_limit_lock);
+#endif
        queue = blk_alloc_queue(GFP_KERNEL);
        if (!queue) {
                pr_err("Error allocating disk queue for device %d\n",
index 4bd3afd..f2fd46d 100644 (file)
@@ -86,7 +86,6 @@ struct zram_stats {
        atomic64_t bd_count;            /* no. of pages in backing device */
        atomic64_t bd_reads;            /* no. of reads from backing device */
        atomic64_t bd_writes;           /* no. of writes from backing device */
-       atomic64_t bd_wb_limit;         /* writeback limit of backing device */
 #endif
 };
 
@@ -114,8 +113,10 @@ struct zram {
         */
        bool claim; /* Protected by bdev->bd_mutex */
        struct file *backing_dev;
-       bool stop_writeback;
 #ifdef CONFIG_ZRAM_WRITEBACK
+       spinlock_t wb_limit_lock;
+       bool wb_limit_enable;
+       u64 bd_wb_limit;
        struct block_device *bdev;
        unsigned int old_block_size;
        unsigned long *bitmap;
index 6f23ebb..e35a886 100644 (file)
@@ -1530,17 +1530,16 @@ static unsigned int __cpufreq_get(struct cpufreq_policy *policy)
 {
        unsigned int ret_freq = 0;
 
-       if (!cpufreq_driver->get)
+       if (unlikely(policy_is_inactive(policy)) || !cpufreq_driver->get)
                return ret_freq;
 
        ret_freq = cpufreq_driver->get(policy->cpu);
 
        /*
-        * Updating inactive policies is invalid, so avoid doing that.  Also
-        * if fast frequency switching is used with the given policy, the check
+        * If fast frequency switching is used with the given policy, the check
         * against policy->cur is pointless, so skip it in that case too.
         */
-       if (unlikely(policy_is_inactive(policy)) || policy->fast_switch_enabled)
+       if (policy->fast_switch_enabled)
                return ret_freq;
 
        if (ret_freq && policy->cur &&
@@ -1569,10 +1568,7 @@ unsigned int cpufreq_get(unsigned int cpu)
 
        if (policy) {
                down_read(&policy->rwsem);
-
-               if (!policy_is_inactive(policy))
-                       ret_freq = __cpufreq_get(policy);
-
+               ret_freq = __cpufreq_get(policy);
                up_read(&policy->rwsem);
 
                cpufreq_cpu_put(policy);
index 50b1551..242c337 100644 (file)
@@ -52,9 +52,9 @@ scmi_cpufreq_set_target(struct cpufreq_policy *policy, unsigned int index)
        int ret;
        struct scmi_data *priv = policy->driver_data;
        struct scmi_perf_ops *perf_ops = handle->perf_ops;
-       u64 freq = policy->freq_table[index].frequency * 1000;
+       u64 freq = policy->freq_table[index].frequency;
 
-       ret = perf_ops->freq_set(handle, priv->domain_id, freq, false);
+       ret = perf_ops->freq_set(handle, priv->domain_id, freq * 1000, false);
        if (!ret)
                arch_set_freq_scale(policy->related_cpus, freq,
                                    policy->cpuinfo.max_freq);
@@ -176,7 +176,7 @@ static int scmi_cpufreq_init(struct cpufreq_policy *policy)
 out_free_priv:
        kfree(priv);
 out_free_opp:
-       dev_pm_opp_cpumask_remove_table(policy->cpus);
+       dev_pm_opp_remove_all_dynamic(cpu_dev);
 
        return ret;
 }
@@ -188,7 +188,7 @@ static int scmi_cpufreq_exit(struct cpufreq_policy *policy)
        cpufreq_cooling_unregister(priv->cdev);
        dev_pm_opp_free_cpufreq_table(priv->cpu_dev, &policy->freq_table);
        kfree(priv);
-       dev_pm_opp_cpumask_remove_table(policy->related_cpus);
+       dev_pm_opp_remove_all_dynamic(priv->cpu_dev);
 
        return 0;
 }
index 87a98ec..9944973 100644 (file)
@@ -177,7 +177,7 @@ out_free_cpufreq_table:
 out_free_priv:
        kfree(priv);
 out_free_opp:
-       dev_pm_opp_cpumask_remove_table(policy->cpus);
+       dev_pm_opp_remove_all_dynamic(cpu_dev);
 
        return ret;
 }
@@ -190,7 +190,7 @@ static int scpi_cpufreq_exit(struct cpufreq_policy *policy)
        clk_put(priv->clk);
        dev_pm_opp_free_cpufreq_table(priv->cpu_dev, &policy->freq_table);
        kfree(priv);
-       dev_pm_opp_cpumask_remove_table(policy->related_cpus);
+       dev_pm_opp_remove_all_dynamic(priv->cpu_dev);
 
        return 0;
 }
index 63cb695..acf7988 100644 (file)
@@ -283,9 +283,9 @@ static u32 crypto4xx_put_pd_to_pdr(struct crypto4xx_device *dev, u32 idx)
  */
 static u32 crypto4xx_build_gdr(struct crypto4xx_device *dev)
 {
-       dev->gdr = dma_zalloc_coherent(dev->core_dev->device,
-                                      sizeof(struct ce_gd) * PPC4XX_NUM_GD,
-                                      &dev->gdr_pa, GFP_ATOMIC);
+       dev->gdr = dma_alloc_coherent(dev->core_dev->device,
+                                     sizeof(struct ce_gd) * PPC4XX_NUM_GD,
+                                     &dev->gdr_pa, GFP_ATOMIC);
        if (!dev->gdr)
                return -ENOMEM;
 
index 06ad85a..a876535 100644 (file)
@@ -278,8 +278,8 @@ static int cpt_ucode_load_fw(struct cpt_device *cpt, const u8 *fw, bool is_ae)
        mcode->num_cores = is_ae ? 6 : 10;
 
        /*  Allocate DMAable space */
-       mcode->code = dma_zalloc_coherent(&cpt->pdev->dev, mcode->code_size,
-                                         &mcode->phys_base, GFP_KERNEL);
+       mcode->code = dma_alloc_coherent(&cpt->pdev->dev, mcode->code_size,
+                                        &mcode->phys_base, GFP_KERNEL);
        if (!mcode->code) {
                dev_err(dev, "Unable to allocate space for microcode");
                ret = -ENOMEM;
index 5c796ed..2ca431e 100644 (file)
@@ -236,9 +236,10 @@ static int alloc_command_queues(struct cpt_vf *cptvf,
 
                        c_size = (rem_q_size > qcsize_bytes) ? qcsize_bytes :
                                        rem_q_size;
-                       curr->head = (u8 *)dma_zalloc_coherent(&pdev->dev,
-                                         c_size + CPT_NEXT_CHUNK_PTR_SIZE,
-                                         &curr->dma_addr, GFP_KERNEL);
+                       curr->head = (u8 *)dma_alloc_coherent(&pdev->dev,
+                                                             c_size + CPT_NEXT_CHUNK_PTR_SIZE,
+                                                             &curr->dma_addr,
+                                                             GFP_KERNEL);
                        if (!curr->head) {
                                dev_err(&pdev->dev, "Command Q (%d) chunk (%d) allocation failed\n",
                                        i, queue->nchunks);
index 9138bae..4ace9bc 100644 (file)
@@ -25,9 +25,9 @@ static int nitrox_cmdq_init(struct nitrox_cmdq *cmdq, int align_bytes)
        struct nitrox_device *ndev = cmdq->ndev;
 
        cmdq->qsize = (ndev->qlen * cmdq->instr_size) + align_bytes;
-       cmdq->unalign_base = dma_zalloc_coherent(DEV(ndev), cmdq->qsize,
-                                                &cmdq->unalign_dma,
-                                                GFP_KERNEL);
+       cmdq->unalign_base = dma_alloc_coherent(DEV(ndev), cmdq->qsize,
+                                               &cmdq->unalign_dma,
+                                               GFP_KERNEL);
        if (!cmdq->unalign_base)
                return -ENOMEM;
 
index 44a4d27..c9bfd4f 100644 (file)
@@ -822,9 +822,9 @@ static int ccp5_init(struct ccp_device *ccp)
                /* Page alignment satisfies our needs for N <= 128 */
                BUILD_BUG_ON(COMMANDS_PER_QUEUE > 128);
                cmd_q->qsize = Q_SIZE(Q_DESC_SIZE);
-               cmd_q->qbase = dma_zalloc_coherent(dev, cmd_q->qsize,
-                                                  &cmd_q->qbase_dma,
-                                                  GFP_KERNEL);
+               cmd_q->qbase = dma_alloc_coherent(dev, cmd_q->qsize,
+                                                 &cmd_q->qbase_dma,
+                                                 GFP_KERNEL);
                if (!cmd_q->qbase) {
                        dev_err(dev, "unable to allocate command queue\n");
                        ret = -ENOMEM;
index cdc4f9a..adc0cd8 100644 (file)
@@ -241,8 +241,8 @@ static int sec_alg_skcipher_setkey(struct crypto_skcipher *tfm,
                memset(ctx->key, 0, SEC_MAX_CIPHER_KEY);
        } else {
                /* new key */
-               ctx->key = dma_zalloc_coherent(dev, SEC_MAX_CIPHER_KEY,
-                                              &ctx->pkey, GFP_KERNEL);
+               ctx->key = dma_alloc_coherent(dev, SEC_MAX_CIPHER_KEY,
+                                             &ctx->pkey, GFP_KERNEL);
                if (!ctx->key) {
                        mutex_unlock(&ctx->lock);
                        return -ENOMEM;
index c1ee4e7..91ee2bb 100644 (file)
@@ -1082,9 +1082,8 @@ static int sec_queue_res_cfg(struct sec_queue *queue)
        struct sec_queue_ring_db *ring_db = &queue->ring_db;
        int ret;
 
-       ring_cmd->vaddr = dma_zalloc_coherent(dev, SEC_Q_CMD_SIZE,
-                                             &ring_cmd->paddr,
-                                             GFP_KERNEL);
+       ring_cmd->vaddr = dma_alloc_coherent(dev, SEC_Q_CMD_SIZE,
+                                            &ring_cmd->paddr, GFP_KERNEL);
        if (!ring_cmd->vaddr)
                return -ENOMEM;
 
@@ -1092,17 +1091,15 @@ static int sec_queue_res_cfg(struct sec_queue *queue)
        mutex_init(&ring_cmd->lock);
        ring_cmd->callback = sec_alg_callback;
 
-       ring_cq->vaddr = dma_zalloc_coherent(dev, SEC_Q_CQ_SIZE,
-                                            &ring_cq->paddr,
-                                            GFP_KERNEL);
+       ring_cq->vaddr = dma_alloc_coherent(dev, SEC_Q_CQ_SIZE,
+                                           &ring_cq->paddr, GFP_KERNEL);
        if (!ring_cq->vaddr) {
                ret = -ENOMEM;
                goto err_free_ring_cmd;
        }
 
-       ring_db->vaddr = dma_zalloc_coherent(dev, SEC_Q_DB_SIZE,
-                                            &ring_db->paddr,
-                                            GFP_KERNEL);
+       ring_db->vaddr = dma_alloc_coherent(dev, SEC_Q_DB_SIZE,
+                                           &ring_db->paddr, GFP_KERNEL);
        if (!ring_db->vaddr) {
                ret = -ENOMEM;
                goto err_free_ring_cq;
index 19fba99..1b0d156 100644 (file)
@@ -260,9 +260,9 @@ static int setup_crypt_desc(void)
 {
        struct device *dev = &pdev->dev;
        BUILD_BUG_ON(sizeof(struct crypt_ctl) != 64);
-       crypt_virt = dma_zalloc_coherent(dev,
-                                        NPE_QLEN * sizeof(struct crypt_ctl),
-                                        &crypt_phys, GFP_ATOMIC);
+       crypt_virt = dma_alloc_coherent(dev,
+                                       NPE_QLEN * sizeof(struct crypt_ctl),
+                                       &crypt_phys, GFP_ATOMIC);
        if (!crypt_virt)
                return -ENOMEM;
        return 0;
index ee0404e..5660e5e 100644 (file)
@@ -453,17 +453,17 @@ static int mtk_desc_ring_alloc(struct mtk_cryp *cryp)
                if (!ring[i])
                        goto err_cleanup;
 
-               ring[i]->cmd_base = dma_zalloc_coherent(cryp->dev,
-                                          MTK_DESC_RING_SZ,
-                                          &ring[i]->cmd_dma,
-                                          GFP_KERNEL);
+               ring[i]->cmd_base = dma_alloc_coherent(cryp->dev,
+                                                      MTK_DESC_RING_SZ,
+                                                      &ring[i]->cmd_dma,
+                                                      GFP_KERNEL);
                if (!ring[i]->cmd_base)
                        goto err_cleanup;
 
-               ring[i]->res_base = dma_zalloc_coherent(cryp->dev,
-                                          MTK_DESC_RING_SZ,
-                                          &ring[i]->res_dma,
-                                          GFP_KERNEL);
+               ring[i]->res_base = dma_alloc_coherent(cryp->dev,
+                                                      MTK_DESC_RING_SZ,
+                                                      &ring[i]->res_dma,
+                                                      GFP_KERNEL);
                if (!ring[i]->res_base)
                        goto err_cleanup;
 
index 3744b22..d28cba3 100644 (file)
@@ -244,18 +244,18 @@ int adf_init_admin_comms(struct adf_accel_dev *accel_dev)
                             dev_to_node(&GET_DEV(accel_dev)));
        if (!admin)
                return -ENOMEM;
-       admin->virt_addr = dma_zalloc_coherent(&GET_DEV(accel_dev), PAGE_SIZE,
-                                              &admin->phy_addr, GFP_KERNEL);
+       admin->virt_addr = dma_alloc_coherent(&GET_DEV(accel_dev), PAGE_SIZE,
+                                             &admin->phy_addr, GFP_KERNEL);
        if (!admin->virt_addr) {
                dev_err(&GET_DEV(accel_dev), "Failed to allocate dma buff\n");
                kfree(admin);
                return -ENOMEM;
        }
 
-       admin->virt_tbl_addr = dma_zalloc_coherent(&GET_DEV(accel_dev),
-                                                  PAGE_SIZE,
-                                                  &admin->const_tbl_addr,
-                                                  GFP_KERNEL);
+       admin->virt_tbl_addr = dma_alloc_coherent(&GET_DEV(accel_dev),
+                                                 PAGE_SIZE,
+                                                 &admin->const_tbl_addr,
+                                                 GFP_KERNEL);
        if (!admin->virt_tbl_addr) {
                dev_err(&GET_DEV(accel_dev), "Failed to allocate const_tbl\n");
                dma_free_coherent(&GET_DEV(accel_dev), PAGE_SIZE,
index d269829..975c751 100644 (file)
@@ -601,15 +601,15 @@ static int qat_alg_aead_setkey(struct crypto_aead *tfm, const uint8_t *key,
 
                dev = &GET_DEV(inst->accel_dev);
                ctx->inst = inst;
-               ctx->enc_cd = dma_zalloc_coherent(dev, sizeof(*ctx->enc_cd),
-                                                 &ctx->enc_cd_paddr,
-                                                 GFP_ATOMIC);
+               ctx->enc_cd = dma_alloc_coherent(dev, sizeof(*ctx->enc_cd),
+                                                &ctx->enc_cd_paddr,
+                                                GFP_ATOMIC);
                if (!ctx->enc_cd) {
                        return -ENOMEM;
                }
-               ctx->dec_cd = dma_zalloc_coherent(dev, sizeof(*ctx->dec_cd),
-                                                 &ctx->dec_cd_paddr,
-                                                 GFP_ATOMIC);
+               ctx->dec_cd = dma_alloc_coherent(dev, sizeof(*ctx->dec_cd),
+                                                &ctx->dec_cd_paddr,
+                                                GFP_ATOMIC);
                if (!ctx->dec_cd) {
                        goto out_free_enc;
                }
@@ -933,16 +933,16 @@ static int qat_alg_ablkcipher_setkey(struct crypto_ablkcipher *tfm,
 
                dev = &GET_DEV(inst->accel_dev);
                ctx->inst = inst;
-               ctx->enc_cd = dma_zalloc_coherent(dev, sizeof(*ctx->enc_cd),
-                                                 &ctx->enc_cd_paddr,
-                                                 GFP_ATOMIC);
+               ctx->enc_cd = dma_alloc_coherent(dev, sizeof(*ctx->enc_cd),
+                                                &ctx->enc_cd_paddr,
+                                                GFP_ATOMIC);
                if (!ctx->enc_cd) {
                        spin_unlock(&ctx->lock);
                        return -ENOMEM;
                }
-               ctx->dec_cd = dma_zalloc_coherent(dev, sizeof(*ctx->dec_cd),
-                                                 &ctx->dec_cd_paddr,
-                                                 GFP_ATOMIC);
+               ctx->dec_cd = dma_alloc_coherent(dev, sizeof(*ctx->dec_cd),
+                                                &ctx->dec_cd_paddr,
+                                                GFP_ATOMIC);
                if (!ctx->dec_cd) {
                        spin_unlock(&ctx->lock);
                        goto out_free_enc;
index 320e785..c9f3247 100644 (file)
@@ -332,10 +332,10 @@ static int qat_dh_compute_value(struct kpp_request *req)
                } else {
                        int shift = ctx->p_size - req->src_len;
 
-                       qat_req->src_align = dma_zalloc_coherent(dev,
-                                                                ctx->p_size,
-                                                                &qat_req->in.dh.in.b,
-                                                                GFP_KERNEL);
+                       qat_req->src_align = dma_alloc_coherent(dev,
+                                                               ctx->p_size,
+                                                               &qat_req->in.dh.in.b,
+                                                               GFP_KERNEL);
                        if (unlikely(!qat_req->src_align))
                                return ret;
 
@@ -360,9 +360,9 @@ static int qat_dh_compute_value(struct kpp_request *req)
                        goto unmap_src;
 
        } else {
-               qat_req->dst_align = dma_zalloc_coherent(dev, ctx->p_size,
-                                                        &qat_req->out.dh.r,
-                                                        GFP_KERNEL);
+               qat_req->dst_align = dma_alloc_coherent(dev, ctx->p_size,
+                                                       &qat_req->out.dh.r,
+                                                       GFP_KERNEL);
                if (unlikely(!qat_req->dst_align))
                        goto unmap_src;
        }
@@ -447,7 +447,7 @@ static int qat_dh_set_params(struct qat_dh_ctx *ctx, struct dh *params)
                return -EINVAL;
 
        ctx->p_size = params->p_size;
-       ctx->p = dma_zalloc_coherent(dev, ctx->p_size, &ctx->dma_p, GFP_KERNEL);
+       ctx->p = dma_alloc_coherent(dev, ctx->p_size, &ctx->dma_p, GFP_KERNEL);
        if (!ctx->p)
                return -ENOMEM;
        memcpy(ctx->p, params->p, ctx->p_size);
@@ -458,7 +458,7 @@ static int qat_dh_set_params(struct qat_dh_ctx *ctx, struct dh *params)
                return 0;
        }
 
-       ctx->g = dma_zalloc_coherent(dev, ctx->p_size, &ctx->dma_g, GFP_KERNEL);
+       ctx->g = dma_alloc_coherent(dev, ctx->p_size, &ctx->dma_g, GFP_KERNEL);
        if (!ctx->g)
                return -ENOMEM;
        memcpy(ctx->g + (ctx->p_size - params->g_size), params->g,
@@ -503,8 +503,8 @@ static int qat_dh_set_secret(struct crypto_kpp *tfm, const void *buf,
        if (ret < 0)
                goto err_clear_ctx;
 
-       ctx->xa = dma_zalloc_coherent(dev, ctx->p_size, &ctx->dma_xa,
-                                     GFP_KERNEL);
+       ctx->xa = dma_alloc_coherent(dev, ctx->p_size, &ctx->dma_xa,
+                                    GFP_KERNEL);
        if (!ctx->xa) {
                ret = -ENOMEM;
                goto err_clear_ctx;
@@ -737,9 +737,9 @@ static int qat_rsa_enc(struct akcipher_request *req)
        } else {
                int shift = ctx->key_sz - req->src_len;
 
-               qat_req->src_align = dma_zalloc_coherent(dev, ctx->key_sz,
-                                                        &qat_req->in.rsa.enc.m,
-                                                        GFP_KERNEL);
+               qat_req->src_align = dma_alloc_coherent(dev, ctx->key_sz,
+                                                       &qat_req->in.rsa.enc.m,
+                                                       GFP_KERNEL);
                if (unlikely(!qat_req->src_align))
                        return ret;
 
@@ -756,9 +756,9 @@ static int qat_rsa_enc(struct akcipher_request *req)
                        goto unmap_src;
 
        } else {
-               qat_req->dst_align = dma_zalloc_coherent(dev, ctx->key_sz,
-                                                        &qat_req->out.rsa.enc.c,
-                                                        GFP_KERNEL);
+               qat_req->dst_align = dma_alloc_coherent(dev, ctx->key_sz,
+                                                       &qat_req->out.rsa.enc.c,
+                                                       GFP_KERNEL);
                if (unlikely(!qat_req->dst_align))
                        goto unmap_src;
 
@@ -881,9 +881,9 @@ static int qat_rsa_dec(struct akcipher_request *req)
        } else {
                int shift = ctx->key_sz - req->src_len;
 
-               qat_req->src_align = dma_zalloc_coherent(dev, ctx->key_sz,
-                                                        &qat_req->in.rsa.dec.c,
-                                                        GFP_KERNEL);
+               qat_req->src_align = dma_alloc_coherent(dev, ctx->key_sz,
+                                                       &qat_req->in.rsa.dec.c,
+                                                       GFP_KERNEL);
                if (unlikely(!qat_req->src_align))
                        return ret;
 
@@ -900,9 +900,9 @@ static int qat_rsa_dec(struct akcipher_request *req)
                        goto unmap_src;
 
        } else {
-               qat_req->dst_align = dma_zalloc_coherent(dev, ctx->key_sz,
-                                                        &qat_req->out.rsa.dec.m,
-                                                        GFP_KERNEL);
+               qat_req->dst_align = dma_alloc_coherent(dev, ctx->key_sz,
+                                                       &qat_req->out.rsa.dec.m,
+                                                       GFP_KERNEL);
                if (unlikely(!qat_req->dst_align))
                        goto unmap_src;
 
@@ -989,7 +989,7 @@ static int qat_rsa_set_n(struct qat_rsa_ctx *ctx, const char *value,
                goto err;
 
        ret = -ENOMEM;
-       ctx->n = dma_zalloc_coherent(dev, ctx->key_sz, &ctx->dma_n, GFP_KERNEL);
+       ctx->n = dma_alloc_coherent(dev, ctx->key_sz, &ctx->dma_n, GFP_KERNEL);
        if (!ctx->n)
                goto err;
 
@@ -1018,7 +1018,7 @@ static int qat_rsa_set_e(struct qat_rsa_ctx *ctx, const char *value,
                return -EINVAL;
        }
 
-       ctx->e = dma_zalloc_coherent(dev, ctx->key_sz, &ctx->dma_e, GFP_KERNEL);
+       ctx->e = dma_alloc_coherent(dev, ctx->key_sz, &ctx->dma_e, GFP_KERNEL);
        if (!ctx->e)
                return -ENOMEM;
 
@@ -1044,7 +1044,7 @@ static int qat_rsa_set_d(struct qat_rsa_ctx *ctx, const char *value,
                goto err;
 
        ret = -ENOMEM;
-       ctx->d = dma_zalloc_coherent(dev, ctx->key_sz, &ctx->dma_d, GFP_KERNEL);
+       ctx->d = dma_alloc_coherent(dev, ctx->key_sz, &ctx->dma_d, GFP_KERNEL);
        if (!ctx->d)
                goto err;
 
@@ -1077,7 +1077,7 @@ static void qat_rsa_setkey_crt(struct qat_rsa_ctx *ctx, struct rsa_key *rsa_key)
        qat_rsa_drop_leading_zeros(&ptr, &len);
        if (!len)
                goto err;
-       ctx->p = dma_zalloc_coherent(dev, half_key_sz, &ctx->dma_p, GFP_KERNEL);
+       ctx->p = dma_alloc_coherent(dev, half_key_sz, &ctx->dma_p, GFP_KERNEL);
        if (!ctx->p)
                goto err;
        memcpy(ctx->p + (half_key_sz - len), ptr, len);
@@ -1088,7 +1088,7 @@ static void qat_rsa_setkey_crt(struct qat_rsa_ctx *ctx, struct rsa_key *rsa_key)
        qat_rsa_drop_leading_zeros(&ptr, &len);
        if (!len)
                goto free_p;
-       ctx->q = dma_zalloc_coherent(dev, half_key_sz, &ctx->dma_q, GFP_KERNEL);
+       ctx->q = dma_alloc_coherent(dev, half_key_sz, &ctx->dma_q, GFP_KERNEL);
        if (!ctx->q)
                goto free_p;
        memcpy(ctx->q + (half_key_sz - len), ptr, len);
@@ -1099,8 +1099,8 @@ static void qat_rsa_setkey_crt(struct qat_rsa_ctx *ctx, struct rsa_key *rsa_key)
        qat_rsa_drop_leading_zeros(&ptr, &len);
        if (!len)
                goto free_q;
-       ctx->dp = dma_zalloc_coherent(dev, half_key_sz, &ctx->dma_dp,
-                                     GFP_KERNEL);
+       ctx->dp = dma_alloc_coherent(dev, half_key_sz, &ctx->dma_dp,
+                                    GFP_KERNEL);
        if (!ctx->dp)
                goto free_q;
        memcpy(ctx->dp + (half_key_sz - len), ptr, len);
@@ -1111,8 +1111,8 @@ static void qat_rsa_setkey_crt(struct qat_rsa_ctx *ctx, struct rsa_key *rsa_key)
        qat_rsa_drop_leading_zeros(&ptr, &len);
        if (!len)
                goto free_dp;
-       ctx->dq = dma_zalloc_coherent(dev, half_key_sz, &ctx->dma_dq,
-                                     GFP_KERNEL);
+       ctx->dq = dma_alloc_coherent(dev, half_key_sz, &ctx->dma_dq,
+                                    GFP_KERNEL);
        if (!ctx->dq)
                goto free_dp;
        memcpy(ctx->dq + (half_key_sz - len), ptr, len);
@@ -1123,8 +1123,8 @@ static void qat_rsa_setkey_crt(struct qat_rsa_ctx *ctx, struct rsa_key *rsa_key)
        qat_rsa_drop_leading_zeros(&ptr, &len);
        if (!len)
                goto free_dq;
-       ctx->qinv = dma_zalloc_coherent(dev, half_key_sz, &ctx->dma_qinv,
-                                       GFP_KERNEL);
+       ctx->qinv = dma_alloc_coherent(dev, half_key_sz, &ctx->dma_qinv,
+                                      GFP_KERNEL);
        if (!ctx->qinv)
                goto free_dq;
        memcpy(ctx->qinv + (half_key_sz - len), ptr, len);
index a2b0a0e..86708fb 100644 (file)
@@ -1182,8 +1182,8 @@ static int sdma_request_channel0(struct sdma_engine *sdma)
 {
        int ret = -EBUSY;
 
-       sdma->bd0 = dma_zalloc_coherent(NULL, PAGE_SIZE, &sdma->bd0_phys,
-                                       GFP_NOWAIT);
+       sdma->bd0 = dma_alloc_coherent(NULL, PAGE_SIZE, &sdma->bd0_phys,
+                                      GFP_NOWAIT);
        if (!sdma->bd0) {
                ret = -ENOMEM;
                goto out;
@@ -1205,8 +1205,8 @@ static int sdma_alloc_bd(struct sdma_desc *desc)
        u32 bd_size = desc->num_bd * sizeof(struct sdma_buffer_descriptor);
        int ret = 0;
 
-       desc->bd = dma_zalloc_coherent(NULL, bd_size, &desc->bd_phys,
-                                       GFP_NOWAIT);
+       desc->bd = dma_alloc_coherent(NULL, bd_size, &desc->bd_phys,
+                                     GFP_NOWAIT);
        if (!desc->bd) {
                ret = -ENOMEM;
                goto out;
index b7ec56a..1a2028e 100644 (file)
@@ -325,8 +325,8 @@ static int mtk_hsdma_alloc_pchan(struct mtk_hsdma_device *hsdma,
         * and [MTK_DMA_SIZE ... 2 * MTK_DMA_SIZE - 1] is for RX ring.
         */
        pc->sz_ring = 2 * MTK_DMA_SIZE * sizeof(*ring->txd);
-       ring->txd = dma_zalloc_coherent(hsdma2dev(hsdma), pc->sz_ring,
-                                       &ring->tphys, GFP_NOWAIT);
+       ring->txd = dma_alloc_coherent(hsdma2dev(hsdma), pc->sz_ring,
+                                      &ring->tphys, GFP_NOWAIT);
        if (!ring->txd)
                return -ENOMEM;
 
index 35193b3..22cc7f6 100644 (file)
@@ -416,9 +416,9 @@ static int mxs_dma_alloc_chan_resources(struct dma_chan *chan)
        struct mxs_dma_engine *mxs_dma = mxs_chan->mxs_dma;
        int ret;
 
-       mxs_chan->ccw = dma_zalloc_coherent(mxs_dma->dma_device.dev,
-                                           CCW_BLOCK_SIZE,
-                                           &mxs_chan->ccw_phys, GFP_KERNEL);
+       mxs_chan->ccw = dma_alloc_coherent(mxs_dma->dma_device.dev,
+                                          CCW_BLOCK_SIZE,
+                                          &mxs_chan->ccw_phys, GFP_KERNEL);
        if (!mxs_chan->ccw) {
                ret = -ENOMEM;
                goto err_alloc;
index 1d59888..eafd6c4 100644 (file)
@@ -1208,8 +1208,8 @@ static int xgene_dma_create_ring_one(struct xgene_dma_chan *chan,
        ring->size = ret;
 
        /* Allocate memory for DMA ring descriptor */
-       ring->desc_vaddr = dma_zalloc_coherent(chan->dev, ring->size,
-                                              &ring->desc_paddr, GFP_KERNEL);
+       ring->desc_vaddr = dma_alloc_coherent(chan->dev, ring->size,
+                                             &ring->desc_paddr, GFP_KERNEL);
        if (!ring->desc_vaddr) {
                chan_err(chan, "Failed to allocate ring desc\n");
                return -ENOMEM;
index 0288096..cb20b41 100644 (file)
@@ -879,10 +879,9 @@ static int xilinx_dma_alloc_chan_resources(struct dma_chan *dchan)
         */
        if (chan->xdev->dma_config->dmatype == XDMA_TYPE_AXIDMA) {
                /* Allocate the buffer descriptors. */
-               chan->seg_v = dma_zalloc_coherent(chan->dev,
-                                                 sizeof(*chan->seg_v) *
-                                                 XILINX_DMA_NUM_DESCS,
-                                                 &chan->seg_p, GFP_KERNEL);
+               chan->seg_v = dma_alloc_coherent(chan->dev,
+                                                sizeof(*chan->seg_v) * XILINX_DMA_NUM_DESCS,
+                                                &chan->seg_p, GFP_KERNEL);
                if (!chan->seg_v) {
                        dev_err(chan->dev,
                                "unable to allocate channel %d descriptors\n",
@@ -895,9 +894,10 @@ static int xilinx_dma_alloc_chan_resources(struct dma_chan *dchan)
                 * so allocating a desc segment during channel allocation for
                 * programming tail descriptor.
                 */
-               chan->cyclic_seg_v = dma_zalloc_coherent(chan->dev,
-                                       sizeof(*chan->cyclic_seg_v),
-                                       &chan->cyclic_seg_p, GFP_KERNEL);
+               chan->cyclic_seg_v = dma_alloc_coherent(chan->dev,
+                                                       sizeof(*chan->cyclic_seg_v),
+                                                       &chan->cyclic_seg_p,
+                                                       GFP_KERNEL);
                if (!chan->cyclic_seg_v) {
                        dev_err(chan->dev,
                                "unable to allocate desc segment for cyclic DMA\n");
index 8db5175..4478787 100644 (file)
@@ -490,9 +490,9 @@ static int zynqmp_dma_alloc_chan_resources(struct dma_chan *dchan)
                list_add_tail(&desc->node, &chan->free_list);
        }
 
-       chan->desc_pool_v = dma_zalloc_coherent(chan->dev,
-                               (2 * chan->desc_size * ZYNQMP_DMA_NUM_DESCS),
-                               &chan->desc_pool_p, GFP_KERNEL);
+       chan->desc_pool_v = dma_alloc_coherent(chan->dev,
+                                              (2 * chan->desc_size * ZYNQMP_DMA_NUM_DESCS),
+                                              &chan->desc_pool_p, GFP_KERNEL);
        if (!chan->desc_pool_v)
                return -ENOMEM;
 
index a9d9df6..693748a 100644 (file)
@@ -61,8 +61,9 @@ drm_dma_handle_t *drm_pci_alloc(struct drm_device * dev, size_t size, size_t ali
                return NULL;
 
        dmah->size = size;
-       dmah->vaddr = dma_zalloc_coherent(&dev->pdev->dev, size, &dmah->busaddr,
-                                               GFP_KERNEL | __GFP_COMP);
+       dmah->vaddr = dma_alloc_coherent(&dev->pdev->dev, size,
+                                        &dmah->busaddr,
+                                        GFP_KERNEL | __GFP_COMP);
 
        if (dmah->vaddr == NULL) {
                kfree(dmah);
index e417ebf..c77adbb 100644 (file)
@@ -155,6 +155,8 @@ enum msg_end_type {
  * @has_mst_fifo: The I2C controller contains the new MST FIFO interface that
  *             provides additional features and allows for longer messages to
  *             be transferred in one go.
+ * @quirks: i2c adapter quirks for limiting write/read transfer size and not
+ *             allowing 0 length transfers.
  */
 struct tegra_i2c_hw_feature {
        bool has_continue_xfer_support;
@@ -167,6 +169,7 @@ struct tegra_i2c_hw_feature {
        bool has_multi_master_mode;
        bool has_slcg_override_reg;
        bool has_mst_fifo;
+       const struct i2c_adapter_quirks *quirks;
 };
 
 /**
@@ -837,6 +840,10 @@ static const struct i2c_adapter_quirks tegra_i2c_quirks = {
        .max_write_len = 4096,
 };
 
+static const struct i2c_adapter_quirks tegra194_i2c_quirks = {
+       .flags = I2C_AQ_NO_ZERO_LEN,
+};
+
 static const struct tegra_i2c_hw_feature tegra20_i2c_hw = {
        .has_continue_xfer_support = false,
        .has_per_pkt_xfer_complete_irq = false,
@@ -848,6 +855,7 @@ static const struct tegra_i2c_hw_feature tegra20_i2c_hw = {
        .has_multi_master_mode = false,
        .has_slcg_override_reg = false,
        .has_mst_fifo = false,
+       .quirks = &tegra_i2c_quirks,
 };
 
 static const struct tegra_i2c_hw_feature tegra30_i2c_hw = {
@@ -861,6 +869,7 @@ static const struct tegra_i2c_hw_feature tegra30_i2c_hw = {
        .has_multi_master_mode = false,
        .has_slcg_override_reg = false,
        .has_mst_fifo = false,
+       .quirks = &tegra_i2c_quirks,
 };
 
 static const struct tegra_i2c_hw_feature tegra114_i2c_hw = {
@@ -874,6 +883,7 @@ static const struct tegra_i2c_hw_feature tegra114_i2c_hw = {
        .has_multi_master_mode = false,
        .has_slcg_override_reg = false,
        .has_mst_fifo = false,
+       .quirks = &tegra_i2c_quirks,
 };
 
 static const struct tegra_i2c_hw_feature tegra124_i2c_hw = {
@@ -887,6 +897,7 @@ static const struct tegra_i2c_hw_feature tegra124_i2c_hw = {
        .has_multi_master_mode = false,
        .has_slcg_override_reg = true,
        .has_mst_fifo = false,
+       .quirks = &tegra_i2c_quirks,
 };
 
 static const struct tegra_i2c_hw_feature tegra210_i2c_hw = {
@@ -900,6 +911,7 @@ static const struct tegra_i2c_hw_feature tegra210_i2c_hw = {
        .has_multi_master_mode = true,
        .has_slcg_override_reg = true,
        .has_mst_fifo = false,
+       .quirks = &tegra_i2c_quirks,
 };
 
 static const struct tegra_i2c_hw_feature tegra194_i2c_hw = {
@@ -913,6 +925,7 @@ static const struct tegra_i2c_hw_feature tegra194_i2c_hw = {
        .has_multi_master_mode = true,
        .has_slcg_override_reg = true,
        .has_mst_fifo = true,
+       .quirks = &tegra194_i2c_quirks,
 };
 
 /* Match table for of_platform binding */
@@ -964,7 +977,6 @@ static int tegra_i2c_probe(struct platform_device *pdev)
        i2c_dev->base = base;
        i2c_dev->div_clk = div_clk;
        i2c_dev->adapter.algo = &tegra_i2c_algo;
-       i2c_dev->adapter.quirks = &tegra_i2c_quirks;
        i2c_dev->irq = irq;
        i2c_dev->cont_id = pdev->id;
        i2c_dev->dev = &pdev->dev;
@@ -980,6 +992,7 @@ static int tegra_i2c_probe(struct platform_device *pdev)
        i2c_dev->hw = of_device_get_match_data(&pdev->dev);
        i2c_dev->is_dvc = of_device_is_compatible(pdev->dev.of_node,
                                                  "nvidia,tegra20-i2c-dvc");
+       i2c_dev->adapter.quirks = i2c_dev->hw->quirks;
        init_completion(&i2c_dev->msg_complete);
        spin_lock_init(&i2c_dev->xfer_lock);
 
index 1aca742..ccd76c7 100644 (file)
@@ -470,9 +470,15 @@ static long i2cdev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
                                          data_arg.data);
        }
        case I2C_RETRIES:
+               if (arg > INT_MAX)
+                       return -EINVAL;
+
                client->adapter->retries = arg;
                break;
        case I2C_TIMEOUT:
+               if (arg > INT_MAX)
+                       return -EINVAL;
+
                /* For historical reasons, user-space sets the timeout
                 * value in units of 10 ms.
                 */
index 3268054..19551aa 100644 (file)
@@ -766,8 +766,8 @@ struct bnxt_qplib_rcfw_sbuf *bnxt_qplib_rcfw_alloc_sbuf(
                return NULL;
 
        sbuf->size = size;
-       sbuf->sb = dma_zalloc_coherent(&rcfw->pdev->dev, sbuf->size,
-                                      &sbuf->dma_addr, GFP_ATOMIC);
+       sbuf->sb = dma_alloc_coherent(&rcfw->pdev->dev, sbuf->size,
+                                     &sbuf->dma_addr, GFP_ATOMIC);
        if (!sbuf->sb)
                goto bail;
 
index 59eeac5..57d4951 100644 (file)
@@ -105,10 +105,10 @@ static int __alloc_pbl(struct pci_dev *pdev, struct bnxt_qplib_pbl *pbl,
 
        if (!sghead) {
                for (i = 0; i < pages; i++) {
-                       pbl->pg_arr[i] = dma_zalloc_coherent(&pdev->dev,
-                                                            pbl->pg_size,
-                                                            &pbl->pg_map_arr[i],
-                                                            GFP_KERNEL);
+                       pbl->pg_arr[i] = dma_alloc_coherent(&pdev->dev,
+                                                           pbl->pg_size,
+                                                           &pbl->pg_map_arr[i],
+                                                           GFP_KERNEL);
                        if (!pbl->pg_arr[i])
                                goto fail;
                        pbl->pg_count++;
index df4f7a3..8ac72ac 100644 (file)
@@ -291,9 +291,9 @@ int cxio_create_qp(struct cxio_rdev *rdev_p, u32 kernel_domain,
        if (!wq->sq)
                goto err3;
 
-       wq->queue = dma_zalloc_coherent(&(rdev_p->rnic_info.pdev->dev),
-                                            depth * sizeof(union t3_wr),
-                                            &(wq->dma_addr), GFP_KERNEL);
+       wq->queue = dma_alloc_coherent(&(rdev_p->rnic_info.pdev->dev),
+                                      depth * sizeof(union t3_wr),
+                                      &(wq->dma_addr), GFP_KERNEL);
        if (!wq->queue)
                goto err4;
 
index 981ff5c..504cf52 100644 (file)
@@ -2564,9 +2564,8 @@ static int alloc_srq_queue(struct c4iw_srq *srq, struct c4iw_dev_ucontext *uctx,
        wq->rqt_abs_idx = (wq->rqt_hwaddr - rdev->lldi.vr->rq.start) >>
                T4_RQT_ENTRY_SHIFT;
 
-       wq->queue = dma_zalloc_coherent(&rdev->lldi.pdev->dev,
-                                      wq->memsize, &wq->dma_addr,
-                       GFP_KERNEL);
+       wq->queue = dma_alloc_coherent(&rdev->lldi.pdev->dev, wq->memsize,
+                                      &wq->dma_addr, GFP_KERNEL);
        if (!wq->queue)
                goto err_free_rqtpool;
 
index 0904490..7835eb5 100644 (file)
@@ -899,10 +899,10 @@ int hfi1_init(struct hfi1_devdata *dd, int reinit)
                goto done;
 
        /* allocate dummy tail memory for all receive contexts */
-       dd->rcvhdrtail_dummy_kvaddr = dma_zalloc_coherent(
-               &dd->pcidev->dev, sizeof(u64),
-               &dd->rcvhdrtail_dummy_dma,
-               GFP_KERNEL);
+       dd->rcvhdrtail_dummy_kvaddr = dma_alloc_coherent(&dd->pcidev->dev,
+                                                        sizeof(u64),
+                                                        &dd->rcvhdrtail_dummy_dma,
+                                                        GFP_KERNEL);
 
        if (!dd->rcvhdrtail_dummy_kvaddr) {
                dd_dev_err(dd, "cannot allocate dummy tail memory\n");
@@ -1863,9 +1863,9 @@ int hfi1_create_rcvhdrq(struct hfi1_devdata *dd, struct hfi1_ctxtdata *rcd)
                        gfp_flags = GFP_KERNEL;
                else
                        gfp_flags = GFP_USER;
-               rcd->rcvhdrq = dma_zalloc_coherent(
-                       &dd->pcidev->dev, amt, &rcd->rcvhdrq_dma,
-                       gfp_flags | __GFP_COMP);
+               rcd->rcvhdrq = dma_alloc_coherent(&dd->pcidev->dev, amt,
+                                                 &rcd->rcvhdrq_dma,
+                                                 gfp_flags | __GFP_COMP);
 
                if (!rcd->rcvhdrq) {
                        dd_dev_err(dd,
@@ -1876,9 +1876,10 @@ int hfi1_create_rcvhdrq(struct hfi1_devdata *dd, struct hfi1_ctxtdata *rcd)
 
                if (HFI1_CAP_KGET_MASK(rcd->flags, DMA_RTAIL) ||
                    HFI1_CAP_UGET_MASK(rcd->flags, DMA_RTAIL)) {
-                       rcd->rcvhdrtail_kvaddr = dma_zalloc_coherent(
-                               &dd->pcidev->dev, PAGE_SIZE,
-                               &rcd->rcvhdrqtailaddr_dma, gfp_flags);
+                       rcd->rcvhdrtail_kvaddr = dma_alloc_coherent(&dd->pcidev->dev,
+                                                                   PAGE_SIZE,
+                                                                   &rcd->rcvhdrqtailaddr_dma,
+                                                                   gfp_flags);
                        if (!rcd->rcvhdrtail_kvaddr)
                                goto bail_free;
                }
@@ -1974,10 +1975,10 @@ int hfi1_setup_eagerbufs(struct hfi1_ctxtdata *rcd)
        while (alloced_bytes < rcd->egrbufs.size &&
               rcd->egrbufs.alloced < rcd->egrbufs.count) {
                rcd->egrbufs.buffers[idx].addr =
-                       dma_zalloc_coherent(&dd->pcidev->dev,
-                                           rcd->egrbufs.rcvtid_size,
-                                           &rcd->egrbufs.buffers[idx].dma,
-                                           gfp_flags);
+                       dma_alloc_coherent(&dd->pcidev->dev,
+                                          rcd->egrbufs.rcvtid_size,
+                                          &rcd->egrbufs.buffers[idx].dma,
+                                          gfp_flags);
                if (rcd->egrbufs.buffers[idx].addr) {
                        rcd->egrbufs.buffers[idx].len =
                                rcd->egrbufs.rcvtid_size;
index dd5a5c0..04126d7 100644 (file)
@@ -2098,11 +2098,10 @@ int init_credit_return(struct hfi1_devdata *dd)
                int bytes = TXE_NUM_CONTEXTS * sizeof(struct credit_return);
 
                set_dev_node(&dd->pcidev->dev, i);
-               dd->cr_base[i].va = dma_zalloc_coherent(
-                                       &dd->pcidev->dev,
-                                       bytes,
-                                       &dd->cr_base[i].dma,
-                                       GFP_KERNEL);
+               dd->cr_base[i].va = dma_alloc_coherent(&dd->pcidev->dev,
+                                                      bytes,
+                                                      &dd->cr_base[i].dma,
+                                                      GFP_KERNEL);
                if (!dd->cr_base[i].va) {
                        set_dev_node(&dd->pcidev->dev, dd->node);
                        dd_dev_err(dd,
index b84356e..96897a9 100644 (file)
@@ -1453,12 +1453,9 @@ int sdma_init(struct hfi1_devdata *dd, u8 port)
                timer_setup(&sde->err_progress_check_timer,
                            sdma_err_progress_check, 0);
 
-               sde->descq = dma_zalloc_coherent(
-                       &dd->pcidev->dev,
-                       descq_cnt * sizeof(u64[2]),
-                       &sde->descq_phys,
-                       GFP_KERNEL
-               );
+               sde->descq = dma_alloc_coherent(&dd->pcidev->dev,
+                                               descq_cnt * sizeof(u64[2]),
+                                               &sde->descq_phys, GFP_KERNEL);
                if (!sde->descq)
                        goto bail;
                sde->tx_ring =
@@ -1471,24 +1468,18 @@ int sdma_init(struct hfi1_devdata *dd, u8 port)
 
        dd->sdma_heads_size = L1_CACHE_BYTES * num_engines;
        /* Allocate memory for DMA of head registers to memory */
-       dd->sdma_heads_dma = dma_zalloc_coherent(
-               &dd->pcidev->dev,
-               dd->sdma_heads_size,
-               &dd->sdma_heads_phys,
-               GFP_KERNEL
-       );
+       dd->sdma_heads_dma = dma_alloc_coherent(&dd->pcidev->dev,
+                                               dd->sdma_heads_size,
+                                               &dd->sdma_heads_phys,
+                                               GFP_KERNEL);
        if (!dd->sdma_heads_dma) {
                dd_dev_err(dd, "failed to allocate SendDMA head memory\n");
                goto bail;
        }
 
        /* Allocate memory for pad */
-       dd->sdma_pad_dma = dma_zalloc_coherent(
-               &dd->pcidev->dev,
-               sizeof(u32),
-               &dd->sdma_pad_phys,
-               GFP_KERNEL
-       );
+       dd->sdma_pad_dma = dma_alloc_coherent(&dd->pcidev->dev, sizeof(u32),
+                                             &dd->sdma_pad_phys, GFP_KERNEL);
        if (!dd->sdma_pad_dma) {
                dd_dev_err(dd, "failed to allocate SendDMA pad memory\n");
                goto bail;
index 6300033..dac058d 100644 (file)
@@ -197,8 +197,8 @@ int hns_roce_buf_alloc(struct hns_roce_dev *hr_dev, u32 size, u32 max_direct,
                buf->npages = 1 << order;
                buf->page_shift = page_shift;
                /* MTT PA must be recorded in 4k alignment, t is 4k aligned */
-               buf->direct.buf = dma_zalloc_coherent(dev,
-                                                     size, &t, GFP_KERNEL);
+               buf->direct.buf = dma_alloc_coherent(dev, size, &t,
+                                                    GFP_KERNEL);
                if (!buf->direct.buf)
                        return -ENOMEM;
 
@@ -219,9 +219,10 @@ int hns_roce_buf_alloc(struct hns_roce_dev *hr_dev, u32 size, u32 max_direct,
                        return -ENOMEM;
 
                for (i = 0; i < buf->nbufs; ++i) {
-                       buf->page_list[i].buf = dma_zalloc_coherent(dev,
-                                                                 page_size, &t,
-                                                                 GFP_KERNEL);
+                       buf->page_list[i].buf = dma_alloc_coherent(dev,
+                                                                  page_size,
+                                                                  &t,
+                                                                  GFP_KERNEL);
 
                        if (!buf->page_list[i].buf)
                                goto err_free;
index 3a66945..543fa15 100644 (file)
@@ -5091,7 +5091,7 @@ static int hns_roce_mhop_alloc_eq(struct hns_roce_dev *hr_dev,
                                eqe_alloc = i * (buf_chk_sz / eq->eqe_size);
                                size = (eq->entries - eqe_alloc) * eq->eqe_size;
                        }
-                       eq->buf[i] = dma_zalloc_coherent(dev, size,
+                       eq->buf[i] = dma_alloc_coherent(dev, size,
                                                        &(eq->buf_dma[i]),
                                                        GFP_KERNEL);
                        if (!eq->buf[i])
@@ -5126,9 +5126,9 @@ static int hns_roce_mhop_alloc_eq(struct hns_roce_dev *hr_dev,
                                        size = (eq->entries - eqe_alloc)
                                                * eq->eqe_size;
                                }
-                               eq->buf[idx] = dma_zalloc_coherent(dev, size,
-                                                           &(eq->buf_dma[idx]),
-                                                           GFP_KERNEL);
+                               eq->buf[idx] = dma_alloc_coherent(dev, size,
+                                                                 &(eq->buf_dma[idx]),
+                                                                 GFP_KERNEL);
                                if (!eq->buf[idx])
                                        goto err_dma_alloc_buf;
 
@@ -5241,7 +5241,7 @@ static int hns_roce_v2_create_eq(struct hns_roce_dev *hr_dev,
                        goto free_cmd_mbox;
                }
 
-               eq->buf_list->buf = dma_zalloc_coherent(dev, buf_chk_sz,
+               eq->buf_list->buf = dma_alloc_coherent(dev, buf_chk_sz,
                                                       &(eq->buf_list->map),
                                                       GFP_KERNEL);
                if (!eq->buf_list->buf) {
index a9ea966..59e9781 100644 (file)
@@ -745,8 +745,8 @@ enum i40iw_status_code i40iw_allocate_dma_mem(struct i40iw_hw *hw,
        if (!mem)
                return I40IW_ERR_PARAM;
        mem->size = ALIGN(size, alignment);
-       mem->va = dma_zalloc_coherent(&pcidev->dev, mem->size,
-                                     (dma_addr_t *)&mem->pa, GFP_KERNEL);
+       mem->va = dma_alloc_coherent(&pcidev->dev, mem->size,
+                                    (dma_addr_t *)&mem->pa, GFP_KERNEL);
        if (!mem->va)
                return I40IW_ERR_NO_MEMORY;
        return 0;
index cc9c0c8..112d2f3 100644 (file)
@@ -623,8 +623,9 @@ int mthca_alloc_db(struct mthca_dev *dev, enum mthca_db_type type,
        page = dev->db_tab->page + end;
 
 alloc:
-       page->db_rec = dma_zalloc_coherent(&dev->pdev->dev, MTHCA_ICM_PAGE_SIZE,
-                                          &page->mapping, GFP_KERNEL);
+       page->db_rec = dma_alloc_coherent(&dev->pdev->dev,
+                                         MTHCA_ICM_PAGE_SIZE, &page->mapping,
+                                         GFP_KERNEL);
        if (!page->db_rec) {
                ret = -ENOMEM;
                goto out;
index 241a57a..097e5ab 100644 (file)
@@ -380,8 +380,8 @@ static int ocrdma_alloc_q(struct ocrdma_dev *dev,
        q->len = len;
        q->entry_size = entry_size;
        q->size = len * entry_size;
-       q->va = dma_zalloc_coherent(&dev->nic_info.pdev->dev, q->size,
-                                   &q->dma, GFP_KERNEL);
+       q->va = dma_alloc_coherent(&dev->nic_info.pdev->dev, q->size, &q->dma,
+                                  GFP_KERNEL);
        if (!q->va)
                return -ENOMEM;
        return 0;
@@ -1819,7 +1819,7 @@ int ocrdma_mbx_create_cq(struct ocrdma_dev *dev, struct ocrdma_cq *cq,
                return -ENOMEM;
        ocrdma_init_mch(&cmd->cmd.req, OCRDMA_CMD_CREATE_CQ,
                        OCRDMA_SUBSYS_COMMON, sizeof(*cmd));
-       cq->va = dma_zalloc_coherent(&pdev->dev, cq->len, &cq->pa, GFP_KERNEL);
+       cq->va = dma_alloc_coherent(&pdev->dev, cq->len, &cq->pa, GFP_KERNEL);
        if (!cq->va) {
                status = -ENOMEM;
                goto mem_err;
@@ -2209,7 +2209,7 @@ static int ocrdma_set_create_qp_sq_cmd(struct ocrdma_create_qp_req *cmd,
        qp->sq.max_cnt = max_wqe_allocated;
        len = (hw_pages * hw_page_size);
 
-       qp->sq.va = dma_zalloc_coherent(&pdev->dev, len, &pa, GFP_KERNEL);
+       qp->sq.va = dma_alloc_coherent(&pdev->dev, len, &pa, GFP_KERNEL);
        if (!qp->sq.va)
                return -EINVAL;
        qp->sq.len = len;
@@ -2259,7 +2259,7 @@ static int ocrdma_set_create_qp_rq_cmd(struct ocrdma_create_qp_req *cmd,
        qp->rq.max_cnt = max_rqe_allocated;
        len = (hw_pages * hw_page_size);
 
-       qp->rq.va = dma_zalloc_coherent(&pdev->dev, len, &pa, GFP_KERNEL);
+       qp->rq.va = dma_alloc_coherent(&pdev->dev, len, &pa, GFP_KERNEL);
        if (!qp->rq.va)
                return -ENOMEM;
        qp->rq.pa = pa;
@@ -2315,8 +2315,8 @@ static int ocrdma_set_create_qp_ird_cmd(struct ocrdma_create_qp_req *cmd,
        if (dev->attr.ird == 0)
                return 0;
 
-       qp->ird_q_va = dma_zalloc_coherent(&pdev->dev, ird_q_len, &pa,
-                                          GFP_KERNEL);
+       qp->ird_q_va = dma_alloc_coherent(&pdev->dev, ird_q_len, &pa,
+                                         GFP_KERNEL);
        if (!qp->ird_q_va)
                return -ENOMEM;
        ocrdma_build_q_pages(&cmd->ird_addr[0], dev->attr.num_ird_pages,
index dd15474..6be0ea1 100644 (file)
@@ -73,8 +73,8 @@ bool ocrdma_alloc_stats_resources(struct ocrdma_dev *dev)
        mem->size = max_t(u32, sizeof(struct ocrdma_rdma_stats_req),
                        sizeof(struct ocrdma_rdma_stats_resp));
 
-       mem->va = dma_zalloc_coherent(&dev->nic_info.pdev->dev, mem->size,
-                                     &mem->pa, GFP_KERNEL);
+       mem->va = dma_alloc_coherent(&dev->nic_info.pdev->dev, mem->size,
+                                    &mem->pa, GFP_KERNEL);
        if (!mem->va) {
                pr_err("%s: stats mbox allocation failed\n", __func__);
                return false;
index c46bed0..287c332 100644 (file)
@@ -504,8 +504,8 @@ struct ib_ucontext *ocrdma_alloc_ucontext(struct ib_device *ibdev,
        INIT_LIST_HEAD(&ctx->mm_head);
        mutex_init(&ctx->mm_list_lock);
 
-       ctx->ah_tbl.va = dma_zalloc_coherent(&pdev->dev, map_len,
-                                            &ctx->ah_tbl.pa, GFP_KERNEL);
+       ctx->ah_tbl.va = dma_alloc_coherent(&pdev->dev, map_len,
+                                           &ctx->ah_tbl.pa, GFP_KERNEL);
        if (!ctx->ah_tbl.va) {
                kfree(ctx);
                return ERR_PTR(-ENOMEM);
@@ -838,7 +838,7 @@ static int ocrdma_build_pbl_tbl(struct ocrdma_dev *dev, struct ocrdma_hw_mr *mr)
                return -ENOMEM;
 
        for (i = 0; i < mr->num_pbls; i++) {
-               va = dma_zalloc_coherent(&pdev->dev, dma_len, &pa, GFP_KERNEL);
+               va = dma_alloc_coherent(&pdev->dev, dma_len, &pa, GFP_KERNEL);
                if (!va) {
                        ocrdma_free_mr_pbl_tbl(dev, mr);
                        status = -ENOMEM;
index b342a70..e1ccf32 100644 (file)
@@ -556,8 +556,8 @@ static struct qedr_pbl *qedr_alloc_pbl_tbl(struct qedr_dev *dev,
                return ERR_PTR(-ENOMEM);
 
        for (i = 0; i < pbl_info->num_pbls; i++) {
-               va = dma_zalloc_coherent(&pdev->dev, pbl_info->pbl_size,
-                                        &pa, flags);
+               va = dma_alloc_coherent(&pdev->dev, pbl_info->pbl_size, &pa,
+                                       flags);
                if (!va)
                        goto err;
 
index eaa109d..39c37b6 100644 (file)
@@ -890,8 +890,8 @@ static int pvrdma_pci_probe(struct pci_dev *pdev,
        dev_info(&pdev->dev, "device version %d, driver version %d\n",
                 dev->dsr_version, PVRDMA_VERSION);
 
-       dev->dsr = dma_zalloc_coherent(&pdev->dev, sizeof(*dev->dsr),
-                                      &dev->dsrbase, GFP_KERNEL);
+       dev->dsr = dma_alloc_coherent(&pdev->dev, sizeof(*dev->dsr),
+                                     &dev->dsrbase, GFP_KERNEL);
        if (!dev->dsr) {
                dev_err(&pdev->dev, "failed to allocate shared region\n");
                ret = -ENOMEM;
index f456c11..6988126 100644 (file)
@@ -147,8 +147,8 @@ static int rpi_ts_probe(struct platform_device *pdev)
                return -ENOMEM;
        ts->pdev = pdev;
 
-       ts->fw_regs_va = dma_zalloc_coherent(dev, PAGE_SIZE, &ts->fw_regs_phys,
-                                            GFP_KERNEL);
+       ts->fw_regs_va = dma_alloc_coherent(dev, PAGE_SIZE, &ts->fw_regs_phys,
+                                           GFP_KERNEL);
        if (!ts->fw_regs_va) {
                dev_err(dev, "failed to dma_alloc_coherent\n");
                return -ENOMEM;
index 6ede428..730f7da 100644 (file)
@@ -232,9 +232,8 @@ static int mtk_iommu_domain_finalise(struct mtk_iommu_data *data)
 
        spin_lock_init(&dom->pgtlock);
 
-       dom->pgt_va = dma_zalloc_coherent(data->dev,
-                               M2701_IOMMU_PGT_SIZE,
-                               &dom->pgt_pa, GFP_KERNEL);
+       dom->pgt_va = dma_alloc_coherent(data->dev, M2701_IOMMU_PGT_SIZE,
+                                        &dom->pgt_pa, GFP_KERNEL);
        if (!dom->pgt_va)
                return -ENOMEM;
 
index 2543bab..5a2ec43 100644 (file)
@@ -95,7 +95,7 @@ static inline void setup_irq_channel(u32 magic, void __iomem *reg_addr)
 
        /* Setup 64 channel slots */
        for (i = 0; i < INTC_IRQS; i += 4)
-               writel_relaxed(build_channel_val(i, magic), reg_addr + i);
+               writel(build_channel_val(i, magic), reg_addr + i);
 }
 
 static int __init
@@ -135,16 +135,10 @@ ck_intc_init_comm(struct device_node *node, struct device_node *parent)
 static inline bool handle_irq_perbit(struct pt_regs *regs, u32 hwirq,
                                     u32 irq_base)
 {
-       u32 irq;
-
        if (hwirq == 0)
                return 0;
 
-       while (hwirq) {
-               irq = __ffs(hwirq);
-               hwirq &= ~BIT(irq);
-               handle_domain_irq(root_domain, irq_base + irq, regs);
-       }
+       handle_domain_irq(root_domain, irq_base + __fls(hwirq), regs);
 
        return 1;
 }
@@ -154,12 +148,16 @@ static void gx_irq_handler(struct pt_regs *regs)
 {
        bool ret;
 
-       do {
-               ret  = handle_irq_perbit(regs,
-                               readl_relaxed(reg_base + GX_INTC_PEN31_00), 0);
-               ret |= handle_irq_perbit(regs,
-                               readl_relaxed(reg_base + GX_INTC_PEN63_32), 32);
-       } while (ret);
+retry:
+       ret = handle_irq_perbit(regs,
+                       readl(reg_base + GX_INTC_PEN63_32), 32);
+       if (ret)
+               goto retry;
+
+       ret = handle_irq_perbit(regs,
+                       readl(reg_base + GX_INTC_PEN31_00), 0);
+       if (ret)
+               goto retry;
 }
 
 static int __init
@@ -174,14 +172,14 @@ gx_intc_init(struct device_node *node, struct device_node *parent)
        /*
         * Initial enable reg to disable all interrupts
         */
-       writel_relaxed(0x0, reg_base + GX_INTC_NEN31_00);
-       writel_relaxed(0x0, reg_base + GX_INTC_NEN63_32);
+       writel(0x0, reg_base + GX_INTC_NEN31_00);
+       writel(0x0, reg_base + GX_INTC_NEN63_32);
 
        /*
         * Initial mask reg with all unmasked, because we only use enalbe reg
         */
-       writel_relaxed(0x0, reg_base + GX_INTC_NMASK31_00);
-       writel_relaxed(0x0, reg_base + GX_INTC_NMASK63_32);
+       writel(0x0, reg_base + GX_INTC_NMASK31_00);
+       writel(0x0, reg_base + GX_INTC_NMASK63_32);
 
        setup_irq_channel(0x03020100, reg_base + GX_INTC_SOURCE);
 
@@ -204,20 +202,29 @@ static void ck_irq_handler(struct pt_regs *regs)
        void __iomem *reg_pen_lo = reg_base + CK_INTC_PEN31_00;
        void __iomem *reg_pen_hi = reg_base + CK_INTC_PEN63_32;
 
-       do {
-               /* handle 0 - 31 irqs */
-               ret  = handle_irq_perbit(regs, readl_relaxed(reg_pen_lo), 0);
-               ret |= handle_irq_perbit(regs, readl_relaxed(reg_pen_hi), 32);
+retry:
+       /* handle 0 - 63 irqs */
+       ret = handle_irq_perbit(regs, readl(reg_pen_hi), 32);
+       if (ret)
+               goto retry;
 
-               if (nr_irq == INTC_IRQS)
-                       continue;
+       ret = handle_irq_perbit(regs, readl(reg_pen_lo), 0);
+       if (ret)
+               goto retry;
+
+       if (nr_irq == INTC_IRQS)
+               return;
 
-               /* handle 64 - 127 irqs */
-               ret |= handle_irq_perbit(regs,
-                       readl_relaxed(reg_pen_lo + CK_INTC_DUAL_BASE), 64);
-               ret |= handle_irq_perbit(regs,
-                       readl_relaxed(reg_pen_hi + CK_INTC_DUAL_BASE), 96);
-       } while (ret);
+       /* handle 64 - 127 irqs */
+       ret = handle_irq_perbit(regs,
+                       readl(reg_pen_hi + CK_INTC_DUAL_BASE), 96);
+       if (ret)
+               goto retry;
+
+       ret = handle_irq_perbit(regs,
+                       readl(reg_pen_lo + CK_INTC_DUAL_BASE), 64);
+       if (ret)
+               goto retry;
 }
 
 static int __init
@@ -230,11 +237,11 @@ ck_intc_init(struct device_node *node, struct device_node *parent)
                return ret;
 
        /* Initial enable reg to disable all interrupts */
-       writel_relaxed(0, reg_base + CK_INTC_NEN31_00);
-       writel_relaxed(0, reg_base + CK_INTC_NEN63_32);
+       writel(0, reg_base + CK_INTC_NEN31_00);
+       writel(0, reg_base + CK_INTC_NEN63_32);
 
        /* Enable irq intc */
-       writel_relaxed(BIT(31), reg_base + CK_INTC_ICR);
+       writel(BIT(31), reg_base + CK_INTC_ICR);
 
        ck_set_gc(node, reg_base, CK_INTC_NEN31_00, 0);
        ck_set_gc(node, reg_base, CK_INTC_NEN63_32, 32);
@@ -260,8 +267,8 @@ ck_dual_intc_init(struct device_node *node, struct device_node *parent)
                return ret;
 
        /* Initial enable reg to disable all interrupts */
-       writel_relaxed(0, reg_base + CK_INTC_NEN31_00 + CK_INTC_DUAL_BASE);
-       writel_relaxed(0, reg_base + CK_INTC_NEN63_32 + CK_INTC_DUAL_BASE);
+       writel(0, reg_base + CK_INTC_NEN31_00 + CK_INTC_DUAL_BASE);
+       writel(0, reg_base + CK_INTC_NEN63_32 + CK_INTC_DUAL_BASE);
 
        ck_set_gc(node, reg_base + CK_INTC_DUAL_BASE, CK_INTC_NEN31_00, 64);
        ck_set_gc(node, reg_base + CK_INTC_DUAL_BASE, CK_INTC_NEN63_32, 96);
index 447baae..cdb79ae 100644 (file)
@@ -218,8 +218,8 @@ static int cio2_fbpt_init(struct cio2_device *cio2, struct cio2_queue *q)
 {
        struct device *dev = &cio2->pci_dev->dev;
 
-       q->fbpt = dma_zalloc_coherent(dev, CIO2_FBPT_SIZE, &q->fbpt_bus_addr,
-                                     GFP_KERNEL);
+       q->fbpt = dma_alloc_coherent(dev, CIO2_FBPT_SIZE, &q->fbpt_bus_addr,
+                                    GFP_KERNEL);
        if (!q->fbpt)
                return -ENOMEM;
 
index e80123c..060c0ad 100644 (file)
@@ -49,7 +49,7 @@ int mtk_vcodec_mem_alloc(struct mtk_vcodec_ctx *data,
        struct mtk_vcodec_ctx *ctx = (struct mtk_vcodec_ctx *)data;
        struct device *dev = &ctx->dev->plat_dev->dev;
 
-       mem->va = dma_zalloc_coherent(dev, size, &mem->dma_addr, GFP_KERNEL);
+       mem->va = dma_alloc_coherent(dev, size, &mem->dma_addr, GFP_KERNEL);
        if (!mem->va) {
                mtk_v4l2_err("%s dma_alloc size=%ld failed!", dev_name(dev),
                             size);
index efe2fb7..25265fd 100644 (file)
@@ -218,8 +218,8 @@ void *__genwqe_alloc_consistent(struct genwqe_dev *cd, size_t size,
        if (get_order(size) >= MAX_ORDER)
                return NULL;
 
-       return dma_zalloc_coherent(&cd->pci_dev->dev, size, dma_handle,
-                                  GFP_KERNEL);
+       return dma_alloc_coherent(&cd->pci_dev->dev, size, dma_handle,
+                                 GFP_KERNEL);
 }
 
 void __genwqe_free_consistent(struct genwqe_dev *cd, size_t size,
index a22e11a..eba9bcc 100644 (file)
@@ -3763,8 +3763,9 @@ int sdhci_setup_host(struct sdhci_host *host)
                 * Use zalloc to zero the reserved high 32-bits of 128-bit
                 * descriptors so that they never need to be written.
                 */
-               buf = dma_zalloc_coherent(mmc_dev(mmc), host->align_buffer_sz +
-                                        host->adma_table_sz, &dma, GFP_KERNEL);
+               buf = dma_alloc_coherent(mmc_dev(mmc),
+                                        host->align_buffer_sz + host->adma_table_sz,
+                                        &dma, GFP_KERNEL);
                if (!buf) {
                        pr_warn("%s: Unable to allocate ADMA buffers - falling back to standard DMA\n",
                                mmc_hostname(mmc));
index 21e3cdc..999b705 100644 (file)
@@ -522,7 +522,7 @@ static int mtd_nvmem_add(struct mtd_info *mtd)
        mtd->nvmem = nvmem_register(&config);
        if (IS_ERR(mtd->nvmem)) {
                /* Just ignore if there is no NVMEM support in the kernel */
-               if (PTR_ERR(mtd->nvmem) == -ENOSYS) {
+               if (PTR_ERR(mtd->nvmem) == -EOPNOTSUPP) {
                        mtd->nvmem = NULL;
                } else {
                        dev_err(&mtd->dev, "Failed to register NVMEM device\n");
index 9887bda..b31c868 100644 (file)
@@ -7,7 +7,7 @@
 extern struct mutex mtd_table_mutex;
 
 struct mtd_info *__mtd_next_device(int i);
-int add_mtd_device(struct mtd_info *mtd);
+int __must_check add_mtd_device(struct mtd_info *mtd);
 int del_mtd_device(struct mtd_info *mtd);
 int add_mtd_partitions(struct mtd_info *, const struct mtd_partition *, int);
 int del_mtd_partitions(struct mtd_info *);
index b6af41b..60104e1 100644 (file)
@@ -618,10 +618,22 @@ int mtd_add_partition(struct mtd_info *parent, const char *name,
        list_add(&new->list, &mtd_partitions);
        mutex_unlock(&mtd_partitions_mutex);
 
-       add_mtd_device(&new->mtd);
+       ret = add_mtd_device(&new->mtd);
+       if (ret)
+               goto err_remove_part;
 
        mtd_add_partition_attrs(new);
 
+       return 0;
+
+err_remove_part:
+       mutex_lock(&mtd_partitions_mutex);
+       list_del(&new->list);
+       mutex_unlock(&mtd_partitions_mutex);
+
+       free_partition(new);
+       pr_info("%s:%i\n", __func__, __LINE__);
+
        return ret;
 }
 EXPORT_SYMBOL_GPL(mtd_add_partition);
@@ -712,22 +724,31 @@ int add_mtd_partitions(struct mtd_info *master,
 {
        struct mtd_part *slave;
        uint64_t cur_offset = 0;
-       int i;
+       int i, ret;
 
        printk(KERN_NOTICE "Creating %d MTD partitions on \"%s\":\n", nbparts, master->name);
 
        for (i = 0; i < nbparts; i++) {
                slave = allocate_partition(master, parts + i, i, cur_offset);
                if (IS_ERR(slave)) {
-                       del_mtd_partitions(master);
-                       return PTR_ERR(slave);
+                       ret = PTR_ERR(slave);
+                       goto err_del_partitions;
                }
 
                mutex_lock(&mtd_partitions_mutex);
                list_add(&slave->list, &mtd_partitions);
                mutex_unlock(&mtd_partitions_mutex);
 
-               add_mtd_device(&slave->mtd);
+               ret = add_mtd_device(&slave->mtd);
+               if (ret) {
+                       mutex_lock(&mtd_partitions_mutex);
+                       list_del(&slave->list);
+                       mutex_unlock(&mtd_partitions_mutex);
+
+                       free_partition(slave);
+                       goto err_del_partitions;
+               }
+
                mtd_add_partition_attrs(slave);
                /* Look for subpartitions */
                parse_mtd_partitions(&slave->mtd, parts[i].types, NULL);
@@ -736,6 +757,11 @@ int add_mtd_partitions(struct mtd_info *master,
        }
 
        return 0;
+
+err_del_partitions:
+       del_mtd_partitions(master);
+
+       return ret;
 }
 
 static DEFINE_SPINLOCK(part_parser_lock);
index 46c62a3..920e737 100644 (file)
@@ -2833,6 +2833,16 @@ static int qcom_nand_host_init_and_register(struct qcom_nand_controller *nandc,
        if (ret)
                return ret;
 
+       if (nandc->props->is_bam) {
+               free_bam_transaction(nandc);
+               nandc->bam_txn = alloc_bam_transaction(nandc);
+               if (!nandc->bam_txn) {
+                       dev_err(nandc->dev,
+                               "failed to allocate bam transaction\n");
+                       return -ENOMEM;
+               }
+       }
+
        ret = mtd_device_register(mtd, NULL, 0);
        if (ret)
                nand_cleanup(chip);
@@ -2847,16 +2857,6 @@ static int qcom_probe_nand_devices(struct qcom_nand_controller *nandc)
        struct qcom_nand_host *host;
        int ret;
 
-       if (nandc->props->is_bam) {
-               free_bam_transaction(nandc);
-               nandc->bam_txn = alloc_bam_transaction(nandc);
-               if (!nandc->bam_txn) {
-                       dev_err(nandc->dev,
-                               "failed to allocate bam transaction\n");
-                       return -ENOMEM;
-               }
-       }
-
        for_each_available_child_of_node(dn, child) {
                host = devm_kzalloc(dev, sizeof(*host), GFP_KERNEL);
                if (!host) {
index 91fc64c..47e5984 100644 (file)
@@ -1433,18 +1433,18 @@ static int greth_of_probe(struct platform_device *ofdev)
        }
 
        /* Allocate TX descriptor ring in coherent memory */
-       greth->tx_bd_base = dma_zalloc_coherent(greth->dev, 1024,
-                                               &greth->tx_bd_base_phys,
-                                               GFP_KERNEL);
+       greth->tx_bd_base = dma_alloc_coherent(greth->dev, 1024,
+                                              &greth->tx_bd_base_phys,
+                                              GFP_KERNEL);
        if (!greth->tx_bd_base) {
                err = -ENOMEM;
                goto error3;
        }
 
        /* Allocate RX descriptor ring in coherent memory */
-       greth->rx_bd_base = dma_zalloc_coherent(greth->dev, 1024,
-                                               &greth->rx_bd_base_phys,
-                                               GFP_KERNEL);
+       greth->rx_bd_base = dma_alloc_coherent(greth->dev, 1024,
+                                              &greth->rx_bd_base_phys,
+                                              GFP_KERNEL);
        if (!greth->rx_bd_base) {
                err = -ENOMEM;
                goto error4;
index 0b60921..16477aa 100644 (file)
@@ -795,8 +795,8 @@ static int slic_init_stat_queue(struct slic_device *sdev)
        size = stq->len * sizeof(*descs) + DESC_ALIGN_MASK;
 
        for (i = 0; i < SLIC_NUM_STAT_DESC_ARRAYS; i++) {
-               descs = dma_zalloc_coherent(&sdev->pdev->dev, size, &paddr,
-                                           GFP_KERNEL);
+               descs = dma_alloc_coherent(&sdev->pdev->dev, size, &paddr,
+                                          GFP_KERNEL);
                if (!descs) {
                        netdev_err(sdev->netdev,
                                   "failed to allocate status descriptors\n");
@@ -1240,8 +1240,8 @@ static int slic_init_shmem(struct slic_device *sdev)
        struct slic_shmem_data *sm_data;
        dma_addr_t paddr;
 
-       sm_data = dma_zalloc_coherent(&sdev->pdev->dev, sizeof(*sm_data),
-                                     &paddr, GFP_KERNEL);
+       sm_data = dma_alloc_coherent(&sdev->pdev->dev, sizeof(*sm_data),
+                                    &paddr, GFP_KERNEL);
        if (!sm_data) {
                dev_err(&sdev->pdev->dev, "failed to allocate shared memory\n");
                return -ENOMEM;
@@ -1621,8 +1621,8 @@ static int slic_read_eeprom(struct slic_device *sdev)
        int err = 0;
        u8 *mac[2];
 
-       eeprom = dma_zalloc_coherent(&sdev->pdev->dev, SLIC_EEPROM_SIZE,
-                                    &paddr, GFP_KERNEL);
+       eeprom = dma_alloc_coherent(&sdev->pdev->dev, SLIC_EEPROM_SIZE,
+                                   &paddr, GFP_KERNEL);
        if (!eeprom)
                return -ENOMEM;
 
index 420cede..b17d435 100644 (file)
@@ -111,8 +111,8 @@ static int ena_com_admin_init_sq(struct ena_com_admin_queue *queue)
        struct ena_com_admin_sq *sq = &queue->sq;
        u16 size = ADMIN_SQ_SIZE(queue->q_depth);
 
-       sq->entries = dma_zalloc_coherent(queue->q_dmadev, size, &sq->dma_addr,
-                                         GFP_KERNEL);
+       sq->entries = dma_alloc_coherent(queue->q_dmadev, size, &sq->dma_addr,
+                                        GFP_KERNEL);
 
        if (!sq->entries) {
                pr_err("memory allocation failed");
@@ -133,8 +133,8 @@ static int ena_com_admin_init_cq(struct ena_com_admin_queue *queue)
        struct ena_com_admin_cq *cq = &queue->cq;
        u16 size = ADMIN_CQ_SIZE(queue->q_depth);
 
-       cq->entries = dma_zalloc_coherent(queue->q_dmadev, size, &cq->dma_addr,
-                                         GFP_KERNEL);
+       cq->entries = dma_alloc_coherent(queue->q_dmadev, size, &cq->dma_addr,
+                                        GFP_KERNEL);
 
        if (!cq->entries) {
                pr_err("memory allocation failed");
@@ -156,8 +156,8 @@ static int ena_com_admin_init_aenq(struct ena_com_dev *dev,
 
        dev->aenq.q_depth = ENA_ASYNC_QUEUE_DEPTH;
        size = ADMIN_AENQ_SIZE(ENA_ASYNC_QUEUE_DEPTH);
-       aenq->entries = dma_zalloc_coherent(dev->dmadev, size, &aenq->dma_addr,
-                                           GFP_KERNEL);
+       aenq->entries = dma_alloc_coherent(dev->dmadev, size, &aenq->dma_addr,
+                                          GFP_KERNEL);
 
        if (!aenq->entries) {
                pr_err("memory allocation failed");
@@ -344,15 +344,15 @@ static int ena_com_init_io_sq(struct ena_com_dev *ena_dev,
                dev_node = dev_to_node(ena_dev->dmadev);
                set_dev_node(ena_dev->dmadev, ctx->numa_node);
                io_sq->desc_addr.virt_addr =
-                       dma_zalloc_coherent(ena_dev->dmadev, size,
-                                           &io_sq->desc_addr.phys_addr,
-                                           GFP_KERNEL);
+                       dma_alloc_coherent(ena_dev->dmadev, size,
+                                          &io_sq->desc_addr.phys_addr,
+                                          GFP_KERNEL);
                set_dev_node(ena_dev->dmadev, dev_node);
                if (!io_sq->desc_addr.virt_addr) {
                        io_sq->desc_addr.virt_addr =
-                               dma_zalloc_coherent(ena_dev->dmadev, size,
-                                                   &io_sq->desc_addr.phys_addr,
-                                                   GFP_KERNEL);
+                               dma_alloc_coherent(ena_dev->dmadev, size,
+                                                  &io_sq->desc_addr.phys_addr,
+                                                  GFP_KERNEL);
                }
 
                if (!io_sq->desc_addr.virt_addr) {
@@ -425,14 +425,14 @@ static int ena_com_init_io_cq(struct ena_com_dev *ena_dev,
        prev_node = dev_to_node(ena_dev->dmadev);
        set_dev_node(ena_dev->dmadev, ctx->numa_node);
        io_cq->cdesc_addr.virt_addr =
-               dma_zalloc_coherent(ena_dev->dmadev, size,
-                                   &io_cq->cdesc_addr.phys_addr, GFP_KERNEL);
+               dma_alloc_coherent(ena_dev->dmadev, size,
+                                  &io_cq->cdesc_addr.phys_addr, GFP_KERNEL);
        set_dev_node(ena_dev->dmadev, prev_node);
        if (!io_cq->cdesc_addr.virt_addr) {
                io_cq->cdesc_addr.virt_addr =
-                       dma_zalloc_coherent(ena_dev->dmadev, size,
-                                           &io_cq->cdesc_addr.phys_addr,
-                                           GFP_KERNEL);
+                       dma_alloc_coherent(ena_dev->dmadev, size,
+                                          &io_cq->cdesc_addr.phys_addr,
+                                          GFP_KERNEL);
        }
 
        if (!io_cq->cdesc_addr.virt_addr) {
@@ -1026,8 +1026,8 @@ static int ena_com_hash_key_allocate(struct ena_com_dev *ena_dev)
        struct ena_rss *rss = &ena_dev->rss;
 
        rss->hash_key =
-               dma_zalloc_coherent(ena_dev->dmadev, sizeof(*rss->hash_key),
-                                   &rss->hash_key_dma_addr, GFP_KERNEL);
+               dma_alloc_coherent(ena_dev->dmadev, sizeof(*rss->hash_key),
+                                  &rss->hash_key_dma_addr, GFP_KERNEL);
 
        if (unlikely(!rss->hash_key))
                return -ENOMEM;
@@ -1050,8 +1050,8 @@ static int ena_com_hash_ctrl_init(struct ena_com_dev *ena_dev)
        struct ena_rss *rss = &ena_dev->rss;
 
        rss->hash_ctrl =
-               dma_zalloc_coherent(ena_dev->dmadev, sizeof(*rss->hash_ctrl),
-                                   &rss->hash_ctrl_dma_addr, GFP_KERNEL);
+               dma_alloc_coherent(ena_dev->dmadev, sizeof(*rss->hash_ctrl),
+                                  &rss->hash_ctrl_dma_addr, GFP_KERNEL);
 
        if (unlikely(!rss->hash_ctrl))
                return -ENOMEM;
@@ -1094,8 +1094,8 @@ static int ena_com_indirect_table_allocate(struct ena_com_dev *ena_dev,
                sizeof(struct ena_admin_rss_ind_table_entry);
 
        rss->rss_ind_tbl =
-               dma_zalloc_coherent(ena_dev->dmadev, tbl_size,
-                                   &rss->rss_ind_tbl_dma_addr, GFP_KERNEL);
+               dma_alloc_coherent(ena_dev->dmadev, tbl_size,
+                                  &rss->rss_ind_tbl_dma_addr, GFP_KERNEL);
        if (unlikely(!rss->rss_ind_tbl))
                goto mem_err1;
 
@@ -1649,9 +1649,9 @@ int ena_com_mmio_reg_read_request_init(struct ena_com_dev *ena_dev)
 
        spin_lock_init(&mmio_read->lock);
        mmio_read->read_resp =
-               dma_zalloc_coherent(ena_dev->dmadev,
-                                   sizeof(*mmio_read->read_resp),
-                                   &mmio_read->read_resp_dma_addr, GFP_KERNEL);
+               dma_alloc_coherent(ena_dev->dmadev,
+                                  sizeof(*mmio_read->read_resp),
+                                  &mmio_read->read_resp_dma_addr, GFP_KERNEL);
        if (unlikely(!mmio_read->read_resp))
                goto err;
 
@@ -2623,8 +2623,8 @@ int ena_com_allocate_host_info(struct ena_com_dev *ena_dev)
        struct ena_host_attribute *host_attr = &ena_dev->host_attr;
 
        host_attr->host_info =
-               dma_zalloc_coherent(ena_dev->dmadev, SZ_4K,
-                                   &host_attr->host_info_dma_addr, GFP_KERNEL);
+               dma_alloc_coherent(ena_dev->dmadev, SZ_4K,
+                                  &host_attr->host_info_dma_addr, GFP_KERNEL);
        if (unlikely(!host_attr->host_info))
                return -ENOMEM;
 
@@ -2641,8 +2641,9 @@ int ena_com_allocate_debug_area(struct ena_com_dev *ena_dev,
        struct ena_host_attribute *host_attr = &ena_dev->host_attr;
 
        host_attr->debug_area_virt_addr =
-               dma_zalloc_coherent(ena_dev->dmadev, debug_area_size,
-                                   &host_attr->debug_area_dma_addr, GFP_KERNEL);
+               dma_alloc_coherent(ena_dev->dmadev, debug_area_size,
+                                  &host_attr->debug_area_dma_addr,
+                                  GFP_KERNEL);
        if (unlikely(!host_attr->debug_area_virt_addr)) {
                host_attr->debug_area_size = 0;
                return -ENOMEM;
index 0f2ad50..87b142a 100644 (file)
@@ -206,8 +206,8 @@ static netdev_tx_t xge_start_xmit(struct sk_buff *skb, struct net_device *ndev)
        }
 
        /* Packet buffers should be 64B aligned */
-       pkt_buf = dma_zalloc_coherent(dev, XGENE_ENET_STD_MTU, &dma_addr,
-                                     GFP_ATOMIC);
+       pkt_buf = dma_alloc_coherent(dev, XGENE_ENET_STD_MTU, &dma_addr,
+                                    GFP_ATOMIC);
        if (unlikely(!pkt_buf)) {
                dev_kfree_skb_any(skb);
                return NETDEV_TX_OK;
@@ -428,8 +428,8 @@ static struct xge_desc_ring *xge_create_desc_ring(struct net_device *ndev)
        ring->ndev = ndev;
 
        size = XGENE_ENET_DESC_SIZE * XGENE_ENET_NUM_DESC;
-       ring->desc_addr = dma_zalloc_coherent(dev, size, &ring->dma_addr,
-                                             GFP_KERNEL);
+       ring->desc_addr = dma_alloc_coherent(dev, size, &ring->dma_addr,
+                                            GFP_KERNEL);
        if (!ring->desc_addr)
                goto err;
 
index c131cfc..e3538ba 100644 (file)
@@ -660,10 +660,9 @@ static int alx_alloc_rings(struct alx_priv *alx)
                            alx->num_txq +
                            sizeof(struct alx_rrd) * alx->rx_ringsz +
                            sizeof(struct alx_rfd) * alx->rx_ringsz;
-       alx->descmem.virt = dma_zalloc_coherent(&alx->hw.pdev->dev,
-                                               alx->descmem.size,
-                                               &alx->descmem.dma,
-                                               GFP_KERNEL);
+       alx->descmem.virt = dma_alloc_coherent(&alx->hw.pdev->dev,
+                                              alx->descmem.size,
+                                              &alx->descmem.dma, GFP_KERNEL);
        if (!alx->descmem.virt)
                return -ENOMEM;
 
index 7087b88..3a3b35b 100644 (file)
@@ -1019,8 +1019,8 @@ static int atl1c_setup_ring_resources(struct atl1c_adapter *adapter)
                sizeof(struct atl1c_recv_ret_status) * rx_desc_count +
                8 * 4;
 
-       ring_header->desc = dma_zalloc_coherent(&pdev->dev, ring_header->size,
-                                               &ring_header->dma, GFP_KERNEL);
+       ring_header->desc = dma_alloc_coherent(&pdev->dev, ring_header->size,
+                                              &ring_header->dma, GFP_KERNEL);
        if (unlikely(!ring_header->desc)) {
                dev_err(&pdev->dev, "could not get memory for DMA buffer\n");
                goto err_nomem;
index 6bae973..09cd188 100644 (file)
@@ -936,7 +936,7 @@ static int bcm_enet_open(struct net_device *dev)
 
        /* allocate rx dma ring */
        size = priv->rx_ring_size * sizeof(struct bcm_enet_desc);
-       p = dma_zalloc_coherent(kdev, size, &priv->rx_desc_dma, GFP_KERNEL);
+       p = dma_alloc_coherent(kdev, size, &priv->rx_desc_dma, GFP_KERNEL);
        if (!p) {
                ret = -ENOMEM;
                goto out_freeirq_tx;
@@ -947,7 +947,7 @@ static int bcm_enet_open(struct net_device *dev)
 
        /* allocate tx dma ring */
        size = priv->tx_ring_size * sizeof(struct bcm_enet_desc);
-       p = dma_zalloc_coherent(kdev, size, &priv->tx_desc_dma, GFP_KERNEL);
+       p = dma_alloc_coherent(kdev, size, &priv->tx_desc_dma, GFP_KERNEL);
        if (!p) {
                ret = -ENOMEM;
                goto out_free_rx_ring;
@@ -2120,7 +2120,7 @@ static int bcm_enetsw_open(struct net_device *dev)
 
        /* allocate rx dma ring */
        size = priv->rx_ring_size * sizeof(struct bcm_enet_desc);
-       p = dma_zalloc_coherent(kdev, size, &priv->rx_desc_dma, GFP_KERNEL);
+       p = dma_alloc_coherent(kdev, size, &priv->rx_desc_dma, GFP_KERNEL);
        if (!p) {
                dev_err(kdev, "cannot allocate rx ring %u\n", size);
                ret = -ENOMEM;
@@ -2132,7 +2132,7 @@ static int bcm_enetsw_open(struct net_device *dev)
 
        /* allocate tx dma ring */
        size = priv->tx_ring_size * sizeof(struct bcm_enet_desc);
-       p = dma_zalloc_coherent(kdev, size, &priv->tx_desc_dma, GFP_KERNEL);
+       p = dma_alloc_coherent(kdev, size, &priv->tx_desc_dma, GFP_KERNEL);
        if (!p) {
                dev_err(kdev, "cannot allocate tx ring\n");
                ret = -ENOMEM;
index 4574275..f9521d0 100644 (file)
@@ -1506,8 +1506,8 @@ static int bcm_sysport_init_tx_ring(struct bcm_sysport_priv *priv,
        /* We just need one DMA descriptor which is DMA-able, since writing to
         * the port will allocate a new descriptor in its internal linked-list
         */
-       p = dma_zalloc_coherent(kdev, sizeof(struct dma_desc), &ring->desc_dma,
-                               GFP_KERNEL);
+       p = dma_alloc_coherent(kdev, sizeof(struct dma_desc), &ring->desc_dma,
+                              GFP_KERNEL);
        if (!p) {
                netif_err(priv, hw, priv->netdev, "DMA alloc failed\n");
                return -ENOMEM;
index cabc8e4..2d3a44c 100644 (file)
@@ -634,9 +634,9 @@ static int bgmac_dma_alloc(struct bgmac *bgmac)
 
                /* Alloc ring of descriptors */
                size = BGMAC_TX_RING_SLOTS * sizeof(struct bgmac_dma_desc);
-               ring->cpu_base = dma_zalloc_coherent(dma_dev, size,
-                                                    &ring->dma_base,
-                                                    GFP_KERNEL);
+               ring->cpu_base = dma_alloc_coherent(dma_dev, size,
+                                                   &ring->dma_base,
+                                                   GFP_KERNEL);
                if (!ring->cpu_base) {
                        dev_err(bgmac->dev, "Allocation of TX ring 0x%X failed\n",
                                ring->mmio_base);
@@ -659,9 +659,9 @@ static int bgmac_dma_alloc(struct bgmac *bgmac)
 
                /* Alloc ring of descriptors */
                size = BGMAC_RX_RING_SLOTS * sizeof(struct bgmac_dma_desc);
-               ring->cpu_base = dma_zalloc_coherent(dma_dev, size,
-                                                    &ring->dma_base,
-                                                    GFP_KERNEL);
+               ring->cpu_base = dma_alloc_coherent(dma_dev, size,
+                                                   &ring->dma_base,
+                                                   GFP_KERNEL);
                if (!ring->cpu_base) {
                        dev_err(bgmac->dev, "Allocation of RX ring 0x%X failed\n",
                                ring->mmio_base);
index bbb2471..d63371d 100644 (file)
@@ -844,8 +844,8 @@ bnx2_alloc_stats_blk(struct net_device *dev)
                                                 BNX2_SBLK_MSIX_ALIGN_SIZE);
        bp->status_stats_size = status_blk_size +
                                sizeof(struct statistics_block);
-       status_blk = dma_zalloc_coherent(&bp->pdev->dev, bp->status_stats_size,
-                                        &bp->status_blk_mapping, GFP_KERNEL);
+       status_blk = dma_alloc_coherent(&bp->pdev->dev, bp->status_stats_size,
+                                       &bp->status_blk_mapping, GFP_KERNEL);
        if (!status_blk)
                return -ENOMEM;
 
index 5cd3135..03d131f 100644 (file)
@@ -2081,7 +2081,7 @@ void bnx2x_igu_clear_sb_gen(struct bnx2x *bp, u8 func, u8 idu_sb_id,
                            bool is_pf);
 
 #define BNX2X_ILT_ZALLOC(x, y, size)                                   \
-       x = dma_zalloc_coherent(&bp->pdev->dev, size, y, GFP_KERNEL)
+       x = dma_alloc_coherent(&bp->pdev->dev, size, y, GFP_KERNEL)
 
 #define BNX2X_ILT_FREE(x, y, size) \
        do { \
index 142bc11..2462e7a 100644 (file)
@@ -52,7 +52,7 @@ extern int bnx2x_num_queues;
 
 #define BNX2X_PCI_ALLOC(y, size)                                       \
 ({                                                                     \
-       void *x = dma_zalloc_coherent(&bp->pdev->dev, size, y, GFP_KERNEL); \
+       void *x = dma_alloc_coherent(&bp->pdev->dev, size, y, GFP_KERNEL); \
        if (x)                                                          \
                DP(NETIF_MSG_HW,                                        \
                   "BNX2X_PCI_ALLOC: Physical %Lx Virtual %p\n",        \
index 3aa80da..4ab6eb3 100644 (file)
@@ -3449,10 +3449,10 @@ alloc_ext_stats:
                        goto alloc_tx_ext_stats;
 
                bp->hw_rx_port_stats_ext =
-                       dma_zalloc_coherent(&pdev->dev,
-                                           sizeof(struct rx_port_stats_ext),
-                                           &bp->hw_rx_port_stats_ext_map,
-                                           GFP_KERNEL);
+                       dma_alloc_coherent(&pdev->dev,
+                                          sizeof(struct rx_port_stats_ext),
+                                          &bp->hw_rx_port_stats_ext_map,
+                                          GFP_KERNEL);
                if (!bp->hw_rx_port_stats_ext)
                        return 0;
 
@@ -3462,10 +3462,10 @@ alloc_tx_ext_stats:
 
                if (bp->hwrm_spec_code >= 0x10902) {
                        bp->hw_tx_port_stats_ext =
-                               dma_zalloc_coherent(&pdev->dev,
-                                           sizeof(struct tx_port_stats_ext),
-                                           &bp->hw_tx_port_stats_ext_map,
-                                           GFP_KERNEL);
+                               dma_alloc_coherent(&pdev->dev,
+                                                  sizeof(struct tx_port_stats_ext),
+                                                  &bp->hw_tx_port_stats_ext_map,
+                                                  GFP_KERNEL);
                }
                bp->flags |= BNXT_FLAG_PORT_STATS_EXT;
        }
index 15c7041..7077515 100644 (file)
@@ -316,8 +316,8 @@ static int bnxt_hwrm_set_dcbx_app(struct bnxt *bp, struct dcb_app *app,
 
        n = IEEE_8021QAZ_MAX_TCS;
        data_len = sizeof(*data) + sizeof(*fw_app) * n;
-       data = dma_zalloc_coherent(&bp->pdev->dev, data_len, &mapping,
-                                  GFP_KERNEL);
+       data = dma_alloc_coherent(&bp->pdev->dev, data_len, &mapping,
+                                 GFP_KERNEL);
        if (!data)
                return -ENOMEM;
 
index 140dbd6..7f56032 100644 (file)
@@ -85,8 +85,8 @@ static int bnxt_hwrm_nvm_req(struct bnxt *bp, u32 param_id, void *msg,
                return -EFAULT;
        }
 
-       data_addr = dma_zalloc_coherent(&bp->pdev->dev, bytesize,
-                                       &data_dma_addr, GFP_KERNEL);
+       data_addr = dma_alloc_coherent(&bp->pdev->dev, bytesize,
+                                      &data_dma_addr, GFP_KERNEL);
        if (!data_addr)
                return -ENOMEM;
 
index 3b1397a..b1627dd 100644 (file)
@@ -8712,10 +8712,10 @@ static int tg3_mem_rx_acquire(struct tg3 *tp)
                if (!i && tg3_flag(tp, ENABLE_RSS))
                        continue;
 
-               tnapi->rx_rcb = dma_zalloc_coherent(&tp->pdev->dev,
-                                                   TG3_RX_RCB_RING_BYTES(tp),
-                                                   &tnapi->rx_rcb_mapping,
-                                                   GFP_KERNEL);
+               tnapi->rx_rcb = dma_alloc_coherent(&tp->pdev->dev,
+                                                  TG3_RX_RCB_RING_BYTES(tp),
+                                                  &tnapi->rx_rcb_mapping,
+                                                  GFP_KERNEL);
                if (!tnapi->rx_rcb)
                        goto err_out;
        }
@@ -8768,9 +8768,9 @@ static int tg3_alloc_consistent(struct tg3 *tp)
 {
        int i;
 
-       tp->hw_stats = dma_zalloc_coherent(&tp->pdev->dev,
-                                          sizeof(struct tg3_hw_stats),
-                                          &tp->stats_mapping, GFP_KERNEL);
+       tp->hw_stats = dma_alloc_coherent(&tp->pdev->dev,
+                                         sizeof(struct tg3_hw_stats),
+                                         &tp->stats_mapping, GFP_KERNEL);
        if (!tp->hw_stats)
                goto err_out;
 
@@ -8778,10 +8778,10 @@ static int tg3_alloc_consistent(struct tg3 *tp)
                struct tg3_napi *tnapi = &tp->napi[i];
                struct tg3_hw_status *sblk;
 
-               tnapi->hw_status = dma_zalloc_coherent(&tp->pdev->dev,
-                                                      TG3_HW_STATUS_SIZE,
-                                                      &tnapi->status_mapping,
-                                                      GFP_KERNEL);
+               tnapi->hw_status = dma_alloc_coherent(&tp->pdev->dev,
+                                                     TG3_HW_STATUS_SIZE,
+                                                     &tnapi->status_mapping,
+                                                     GFP_KERNEL);
                if (!tnapi->hw_status)
                        goto err_out;
 
index fcaf18f..5b4d3ba 100644 (file)
@@ -59,7 +59,7 @@ static int nicvf_alloc_q_desc_mem(struct nicvf *nic, struct q_desc_mem *dmem,
        dmem->q_len = q_len;
        dmem->size = (desc_size * q_len) + align_bytes;
        /* Save address, need it while freeing */
-       dmem->unalign_base = dma_zalloc_coherent(&nic->pdev->dev, dmem->size,
+       dmem->unalign_base = dma_alloc_coherent(&nic->pdev->dev, dmem->size,
                                                &dmem->dma, GFP_KERNEL);
        if (!dmem->unalign_base)
                return -ENOMEM;
index 20b6e1b..85f22c2 100644 (file)
@@ -620,7 +620,7 @@ static void *alloc_ring(struct pci_dev *pdev, size_t nelem, size_t elem_size,
 {
        size_t len = nelem * elem_size;
        void *s = NULL;
-       void *p = dma_zalloc_coherent(&pdev->dev, len, phys, GFP_KERNEL);
+       void *p = dma_alloc_coherent(&pdev->dev, len, phys, GFP_KERNEL);
 
        if (!p)
                return NULL;
index b901884..fc0bc64 100644 (file)
@@ -694,7 +694,7 @@ static void *alloc_ring(struct device *dev, size_t nelem, size_t elem_size,
 {
        size_t len = nelem * elem_size + stat_size;
        void *s = NULL;
-       void *p = dma_zalloc_coherent(dev, len, phys, GFP_KERNEL);
+       void *p = dma_alloc_coherent(dev, len, phys, GFP_KERNEL);
 
        if (!p)
                return NULL;
index 3007e1a..1d534f0 100644 (file)
@@ -756,7 +756,7 @@ static void *alloc_ring(struct device *dev, size_t nelem, size_t hwsize,
         * Allocate the hardware ring and PCI DMA bus address space for said.
         */
        size_t hwlen = nelem * hwsize + stat_size;
-       void *hwring = dma_zalloc_coherent(dev, hwlen, busaddrp, GFP_KERNEL);
+       void *hwring = dma_alloc_coherent(dev, hwlen, busaddrp, GFP_KERNEL);
 
        if (!hwring)
                return NULL;
index 1e9d882..59a7f0b 100644 (file)
@@ -1808,9 +1808,9 @@ int be_cmd_get_fat_dump(struct be_adapter *adapter, u32 buf_len, void *buf)
        total_size = buf_len;
 
        get_fat_cmd.size = sizeof(struct be_cmd_req_get_fat) + 60*1024;
-       get_fat_cmd.va = dma_zalloc_coherent(&adapter->pdev->dev,
-                                            get_fat_cmd.size,
-                                            &get_fat_cmd.dma, GFP_ATOMIC);
+       get_fat_cmd.va = dma_alloc_coherent(&adapter->pdev->dev,
+                                           get_fat_cmd.size,
+                                           &get_fat_cmd.dma, GFP_ATOMIC);
        if (!get_fat_cmd.va)
                return -ENOMEM;
 
@@ -2302,8 +2302,8 @@ int be_cmd_read_port_transceiver_data(struct be_adapter *adapter,
                return -EINVAL;
 
        cmd.size = sizeof(struct be_cmd_resp_port_type);
-       cmd.va = dma_zalloc_coherent(&adapter->pdev->dev, cmd.size, &cmd.dma,
-                                    GFP_ATOMIC);
+       cmd.va = dma_alloc_coherent(&adapter->pdev->dev, cmd.size, &cmd.dma,
+                                   GFP_ATOMIC);
        if (!cmd.va) {
                dev_err(&adapter->pdev->dev, "Memory allocation failed\n");
                return -ENOMEM;
@@ -3066,8 +3066,8 @@ int lancer_fw_download(struct be_adapter *adapter,
 
        flash_cmd.size = sizeof(struct lancer_cmd_req_write_object)
                                + LANCER_FW_DOWNLOAD_CHUNK;
-       flash_cmd.va = dma_zalloc_coherent(dev, flash_cmd.size,
-                                          &flash_cmd.dma, GFP_KERNEL);
+       flash_cmd.va = dma_alloc_coherent(dev, flash_cmd.size, &flash_cmd.dma,
+                                         GFP_KERNEL);
        if (!flash_cmd.va)
                return -ENOMEM;
 
@@ -3184,8 +3184,8 @@ int be_fw_download(struct be_adapter *adapter, const struct firmware *fw)
        }
 
        flash_cmd.size = sizeof(struct be_cmd_write_flashrom);
-       flash_cmd.va = dma_zalloc_coherent(dev, flash_cmd.size, &flash_cmd.dma,
-                                          GFP_KERNEL);
+       flash_cmd.va = dma_alloc_coherent(dev, flash_cmd.size, &flash_cmd.dma,
+                                         GFP_KERNEL);
        if (!flash_cmd.va)
                return -ENOMEM;
 
@@ -3435,8 +3435,8 @@ int be_cmd_get_phy_info(struct be_adapter *adapter)
                goto err;
        }
        cmd.size = sizeof(struct be_cmd_req_get_phy_info);
-       cmd.va = dma_zalloc_coherent(&adapter->pdev->dev, cmd.size, &cmd.dma,
-                                    GFP_ATOMIC);
+       cmd.va = dma_alloc_coherent(&adapter->pdev->dev, cmd.size, &cmd.dma,
+                                   GFP_ATOMIC);
        if (!cmd.va) {
                dev_err(&adapter->pdev->dev, "Memory alloc failure\n");
                status = -ENOMEM;
@@ -3522,9 +3522,9 @@ int be_cmd_get_cntl_attributes(struct be_adapter *adapter)
 
        memset(&attribs_cmd, 0, sizeof(struct be_dma_mem));
        attribs_cmd.size = sizeof(struct be_cmd_resp_cntl_attribs);
-       attribs_cmd.va = dma_zalloc_coherent(&adapter->pdev->dev,
-                                            attribs_cmd.size,
-                                            &attribs_cmd.dma, GFP_ATOMIC);
+       attribs_cmd.va = dma_alloc_coherent(&adapter->pdev->dev,
+                                           attribs_cmd.size,
+                                           &attribs_cmd.dma, GFP_ATOMIC);
        if (!attribs_cmd.va) {
                dev_err(&adapter->pdev->dev, "Memory allocation failure\n");
                status = -ENOMEM;
@@ -3699,10 +3699,10 @@ int be_cmd_get_mac_from_list(struct be_adapter *adapter, u8 *mac,
 
        memset(&get_mac_list_cmd, 0, sizeof(struct be_dma_mem));
        get_mac_list_cmd.size = sizeof(struct be_cmd_resp_get_mac_list);
-       get_mac_list_cmd.va = dma_zalloc_coherent(&adapter->pdev->dev,
-                                                 get_mac_list_cmd.size,
-                                                 &get_mac_list_cmd.dma,
-                                                 GFP_ATOMIC);
+       get_mac_list_cmd.va = dma_alloc_coherent(&adapter->pdev->dev,
+                                                get_mac_list_cmd.size,
+                                                &get_mac_list_cmd.dma,
+                                                GFP_ATOMIC);
 
        if (!get_mac_list_cmd.va) {
                dev_err(&adapter->pdev->dev,
@@ -3829,8 +3829,8 @@ int be_cmd_set_mac_list(struct be_adapter *adapter, u8 *mac_array,
 
        memset(&cmd, 0, sizeof(struct be_dma_mem));
        cmd.size = sizeof(struct be_cmd_req_set_mac_list);
-       cmd.va = dma_zalloc_coherent(&adapter->pdev->dev, cmd.size, &cmd.dma,
-                                    GFP_KERNEL);
+       cmd.va = dma_alloc_coherent(&adapter->pdev->dev, cmd.size, &cmd.dma,
+                                   GFP_KERNEL);
        if (!cmd.va)
                return -ENOMEM;
 
@@ -4035,8 +4035,8 @@ int be_cmd_get_acpi_wol_cap(struct be_adapter *adapter)
 
        memset(&cmd, 0, sizeof(struct be_dma_mem));
        cmd.size = sizeof(struct be_cmd_resp_acpi_wol_magic_config_v1);
-       cmd.va = dma_zalloc_coherent(&adapter->pdev->dev, cmd.size, &cmd.dma,
-                                    GFP_ATOMIC);
+       cmd.va = dma_alloc_coherent(&adapter->pdev->dev, cmd.size, &cmd.dma,
+                                   GFP_ATOMIC);
        if (!cmd.va) {
                dev_err(&adapter->pdev->dev, "Memory allocation failure\n");
                status = -ENOMEM;
@@ -4089,9 +4089,9 @@ int be_cmd_set_fw_log_level(struct be_adapter *adapter, u32 level)
 
        memset(&extfat_cmd, 0, sizeof(struct be_dma_mem));
        extfat_cmd.size = sizeof(struct be_cmd_resp_get_ext_fat_caps);
-       extfat_cmd.va = dma_zalloc_coherent(&adapter->pdev->dev,
-                                           extfat_cmd.size, &extfat_cmd.dma,
-                                           GFP_ATOMIC);
+       extfat_cmd.va = dma_alloc_coherent(&adapter->pdev->dev,
+                                          extfat_cmd.size, &extfat_cmd.dma,
+                                          GFP_ATOMIC);
        if (!extfat_cmd.va)
                return -ENOMEM;
 
@@ -4127,9 +4127,9 @@ int be_cmd_get_fw_log_level(struct be_adapter *adapter)
 
        memset(&extfat_cmd, 0, sizeof(struct be_dma_mem));
        extfat_cmd.size = sizeof(struct be_cmd_resp_get_ext_fat_caps);
-       extfat_cmd.va = dma_zalloc_coherent(&adapter->pdev->dev,
-                                           extfat_cmd.size, &extfat_cmd.dma,
-                                           GFP_ATOMIC);
+       extfat_cmd.va = dma_alloc_coherent(&adapter->pdev->dev,
+                                          extfat_cmd.size, &extfat_cmd.dma,
+                                          GFP_ATOMIC);
 
        if (!extfat_cmd.va) {
                dev_err(&adapter->pdev->dev, "%s: Memory allocation failure\n",
@@ -4354,8 +4354,8 @@ int be_cmd_get_func_config(struct be_adapter *adapter, struct be_resources *res)
 
        memset(&cmd, 0, sizeof(struct be_dma_mem));
        cmd.size = sizeof(struct be_cmd_resp_get_func_config);
-       cmd.va = dma_zalloc_coherent(&adapter->pdev->dev, cmd.size, &cmd.dma,
-                                    GFP_ATOMIC);
+       cmd.va = dma_alloc_coherent(&adapter->pdev->dev, cmd.size, &cmd.dma,
+                                   GFP_ATOMIC);
        if (!cmd.va) {
                dev_err(&adapter->pdev->dev, "Memory alloc failure\n");
                status = -ENOMEM;
@@ -4452,8 +4452,8 @@ int be_cmd_get_profile_config(struct be_adapter *adapter,
 
        memset(&cmd, 0, sizeof(struct be_dma_mem));
        cmd.size = sizeof(struct be_cmd_resp_get_profile_config);
-       cmd.va = dma_zalloc_coherent(&adapter->pdev->dev, cmd.size, &cmd.dma,
-                                    GFP_ATOMIC);
+       cmd.va = dma_alloc_coherent(&adapter->pdev->dev, cmd.size, &cmd.dma,
+                                   GFP_ATOMIC);
        if (!cmd.va)
                return -ENOMEM;
 
@@ -4539,8 +4539,8 @@ static int be_cmd_set_profile_config(struct be_adapter *adapter, void *desc,
 
        memset(&cmd, 0, sizeof(struct be_dma_mem));
        cmd.size = sizeof(struct be_cmd_req_set_profile_config);
-       cmd.va = dma_zalloc_coherent(&adapter->pdev->dev, cmd.size, &cmd.dma,
-                                    GFP_ATOMIC);
+       cmd.va = dma_alloc_coherent(&adapter->pdev->dev, cmd.size, &cmd.dma,
+                                   GFP_ATOMIC);
        if (!cmd.va)
                return -ENOMEM;
 
index 3f6749f..4c21834 100644 (file)
@@ -274,8 +274,8 @@ static int lancer_cmd_read_file(struct be_adapter *adapter, u8 *file_name,
        int status = 0;
 
        read_cmd.size = LANCER_READ_FILE_CHUNK;
-       read_cmd.va = dma_zalloc_coherent(&adapter->pdev->dev, read_cmd.size,
-                                         &read_cmd.dma, GFP_ATOMIC);
+       read_cmd.va = dma_alloc_coherent(&adapter->pdev->dev, read_cmd.size,
+                                        &read_cmd.dma, GFP_ATOMIC);
 
        if (!read_cmd.va) {
                dev_err(&adapter->pdev->dev,
@@ -815,7 +815,7 @@ static int be_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
        }
 
        cmd.size = sizeof(struct be_cmd_req_acpi_wol_magic_config);
-       cmd.va = dma_zalloc_coherent(dev, cmd.size, &cmd.dma, GFP_KERNEL);
+       cmd.va = dma_alloc_coherent(dev, cmd.size, &cmd.dma, GFP_KERNEL);
        if (!cmd.va)
                return -ENOMEM;
 
@@ -851,9 +851,9 @@ static int be_test_ddr_dma(struct be_adapter *adapter)
        };
 
        ddrdma_cmd.size = sizeof(struct be_cmd_req_ddrdma_test);
-       ddrdma_cmd.va = dma_zalloc_coherent(&adapter->pdev->dev,
-                                           ddrdma_cmd.size, &ddrdma_cmd.dma,
-                                           GFP_KERNEL);
+       ddrdma_cmd.va = dma_alloc_coherent(&adapter->pdev->dev,
+                                          ddrdma_cmd.size, &ddrdma_cmd.dma,
+                                          GFP_KERNEL);
        if (!ddrdma_cmd.va)
                return -ENOMEM;
 
@@ -1014,9 +1014,9 @@ static int be_read_eeprom(struct net_device *netdev,
 
        memset(&eeprom_cmd, 0, sizeof(struct be_dma_mem));
        eeprom_cmd.size = sizeof(struct be_cmd_req_seeprom_read);
-       eeprom_cmd.va = dma_zalloc_coherent(&adapter->pdev->dev,
-                                           eeprom_cmd.size, &eeprom_cmd.dma,
-                                           GFP_KERNEL);
+       eeprom_cmd.va = dma_alloc_coherent(&adapter->pdev->dev,
+                                          eeprom_cmd.size, &eeprom_cmd.dma,
+                                          GFP_KERNEL);
 
        if (!eeprom_cmd.va)
                return -ENOMEM;
index 852f5bf..d502690 100644 (file)
@@ -167,8 +167,8 @@ static int be_queue_alloc(struct be_adapter *adapter, struct be_queue_info *q,
        q->len = len;
        q->entry_size = entry_size;
        mem->size = len * entry_size;
-       mem->va = dma_zalloc_coherent(&adapter->pdev->dev, mem->size, &mem->dma,
-                                     GFP_KERNEL);
+       mem->va = dma_alloc_coherent(&adapter->pdev->dev, mem->size,
+                                    &mem->dma, GFP_KERNEL);
        if (!mem->va)
                return -ENOMEM;
        return 0;
@@ -5766,9 +5766,9 @@ static int be_drv_init(struct be_adapter *adapter)
        int status = 0;
 
        mbox_mem_alloc->size = sizeof(struct be_mcc_mailbox) + 16;
-       mbox_mem_alloc->va = dma_zalloc_coherent(dev, mbox_mem_alloc->size,
-                                                &mbox_mem_alloc->dma,
-                                                GFP_KERNEL);
+       mbox_mem_alloc->va = dma_alloc_coherent(dev, mbox_mem_alloc->size,
+                                               &mbox_mem_alloc->dma,
+                                               GFP_KERNEL);
        if (!mbox_mem_alloc->va)
                return -ENOMEM;
 
@@ -5777,8 +5777,8 @@ static int be_drv_init(struct be_adapter *adapter)
        mbox_mem_align->dma = PTR_ALIGN(mbox_mem_alloc->dma, 16);
 
        rx_filter->size = sizeof(struct be_cmd_req_rx_filter);
-       rx_filter->va = dma_zalloc_coherent(dev, rx_filter->size,
-                                           &rx_filter->dma, GFP_KERNEL);
+       rx_filter->va = dma_alloc_coherent(dev, rx_filter->size,
+                                          &rx_filter->dma, GFP_KERNEL);
        if (!rx_filter->va) {
                status = -ENOMEM;
                goto free_mbox;
@@ -5792,8 +5792,8 @@ static int be_drv_init(struct be_adapter *adapter)
                stats_cmd->size = sizeof(struct be_cmd_req_get_stats_v1);
        else
                stats_cmd->size = sizeof(struct be_cmd_req_get_stats_v2);
-       stats_cmd->va = dma_zalloc_coherent(dev, stats_cmd->size,
-                                           &stats_cmd->dma, GFP_KERNEL);
+       stats_cmd->va = dma_alloc_coherent(dev, stats_cmd->size,
+                                          &stats_cmd->dma, GFP_KERNEL);
        if (!stats_cmd->va) {
                status = -ENOMEM;
                goto free_rx_filter;
index 4d67322..3e5e971 100644 (file)
@@ -935,16 +935,14 @@ static int ftgmac100_alloc_rings(struct ftgmac100 *priv)
                return -ENOMEM;
 
        /* Allocate descriptors */
-       priv->rxdes = dma_zalloc_coherent(priv->dev,
-                                         MAX_RX_QUEUE_ENTRIES *
-                                         sizeof(struct ftgmac100_rxdes),
-                                         &priv->rxdes_dma, GFP_KERNEL);
+       priv->rxdes = dma_alloc_coherent(priv->dev,
+                                        MAX_RX_QUEUE_ENTRIES * sizeof(struct ftgmac100_rxdes),
+                                        &priv->rxdes_dma, GFP_KERNEL);
        if (!priv->rxdes)
                return -ENOMEM;
-       priv->txdes = dma_zalloc_coherent(priv->dev,
-                                         MAX_TX_QUEUE_ENTRIES *
-                                         sizeof(struct ftgmac100_txdes),
-                                         &priv->txdes_dma, GFP_KERNEL);
+       priv->txdes = dma_alloc_coherent(priv->dev,
+                                        MAX_TX_QUEUE_ENTRIES * sizeof(struct ftgmac100_txdes),
+                                        &priv->txdes_dma, GFP_KERNEL);
        if (!priv->txdes)
                return -ENOMEM;
 
index 084f24d..2a0e820 100644 (file)
@@ -734,10 +734,9 @@ static int ftmac100_alloc_buffers(struct ftmac100 *priv)
 {
        int i;
 
-       priv->descs = dma_zalloc_coherent(priv->dev,
-                                         sizeof(struct ftmac100_descs),
-                                         &priv->descs_dma_addr,
-                                         GFP_KERNEL);
+       priv->descs = dma_alloc_coherent(priv->dev,
+                                        sizeof(struct ftmac100_descs),
+                                        &priv->descs_dma_addr, GFP_KERNEL);
        if (!priv->descs)
                return -ENOMEM;
 
index 471805e..e5d853b 100644 (file)
@@ -1006,8 +1006,8 @@ static int hix5hd2_init_hw_desc_queue(struct hix5hd2_priv *priv)
 
        for (i = 0; i < QUEUE_NUMS; i++) {
                size = priv->pool[i].count * sizeof(struct hix5hd2_desc);
-               virt_addr = dma_zalloc_coherent(dev, size, &phys_addr,
-                                               GFP_KERNEL);
+               virt_addr = dma_alloc_coherent(dev, size, &phys_addr,
+                                              GFP_KERNEL);
                if (virt_addr == NULL)
                        goto error_free_pool;
 
index 07cd587..1bf7a5f 100644 (file)
@@ -2041,9 +2041,8 @@ static int hns3_alloc_desc(struct hns3_enet_ring *ring)
 {
        int size = ring->desc_num * sizeof(ring->desc[0]);
 
-       ring->desc = dma_zalloc_coherent(ring_to_dev(ring), size,
-                                        &ring->desc_dma_addr,
-                                        GFP_KERNEL);
+       ring->desc = dma_alloc_coherent(ring_to_dev(ring), size,
+                                       &ring->desc_dma_addr, GFP_KERNEL);
        if (!ring->desc)
                return -ENOMEM;
 
index 8af0cef..e483a6e 100644 (file)
@@ -39,9 +39,8 @@ static int hclge_alloc_cmd_desc(struct hclge_cmq_ring *ring)
 {
        int size  = ring->desc_num * sizeof(struct hclge_desc);
 
-       ring->desc = dma_zalloc_coherent(cmq_ring_to_dev(ring),
-                                        size, &ring->desc_dma_addr,
-                                        GFP_KERNEL);
+       ring->desc = dma_alloc_coherent(cmq_ring_to_dev(ring), size,
+                                       &ring->desc_dma_addr, GFP_KERNEL);
        if (!ring->desc)
                return -ENOMEM;
 
index d5765c8..4e78e88 100644 (file)
@@ -115,9 +115,8 @@ static int hclgevf_alloc_cmd_desc(struct hclgevf_cmq_ring *ring)
 {
        int size = ring->desc_num * sizeof(struct hclgevf_desc);
 
-       ring->desc = dma_zalloc_coherent(cmq_ring_to_dev(ring),
-                                        size, &ring->desc_dma_addr,
-                                        GFP_KERNEL);
+       ring->desc = dma_alloc_coherent(cmq_ring_to_dev(ring), size,
+                                       &ring->desc_dma_addr, GFP_KERNEL);
        if (!ring->desc)
                return -ENOMEM;
 
index c40603a..b4fefb4 100644 (file)
@@ -613,8 +613,8 @@ static int alloc_cmd_buf(struct hinic_api_cmd_chain *chain,
        u8 *cmd_vaddr;
        int err = 0;
 
-       cmd_vaddr = dma_zalloc_coherent(&pdev->dev, API_CMD_BUF_SIZE,
-                                       &cmd_paddr, GFP_KERNEL);
+       cmd_vaddr = dma_alloc_coherent(&pdev->dev, API_CMD_BUF_SIZE,
+                                      &cmd_paddr, GFP_KERNEL);
        if (!cmd_vaddr) {
                dev_err(&pdev->dev, "Failed to allocate API CMD DMA memory\n");
                return -ENOMEM;
@@ -663,8 +663,8 @@ static int api_cmd_create_cell(struct hinic_api_cmd_chain *chain,
        dma_addr_t node_paddr;
        int err;
 
-       node = dma_zalloc_coherent(&pdev->dev, chain->cell_size,
-                                  &node_paddr, GFP_KERNEL);
+       node = dma_alloc_coherent(&pdev->dev, chain->cell_size, &node_paddr,
+                                 GFP_KERNEL);
        if (!node) {
                dev_err(&pdev->dev, "Failed to allocate dma API CMD cell\n");
                return -ENOMEM;
@@ -821,10 +821,10 @@ static int api_chain_init(struct hinic_api_cmd_chain *chain,
        if (!chain->cell_ctxt)
                return -ENOMEM;
 
-       chain->wb_status = dma_zalloc_coherent(&pdev->dev,
-                                              sizeof(*chain->wb_status),
-                                              &chain->wb_status_paddr,
-                                              GFP_KERNEL);
+       chain->wb_status = dma_alloc_coherent(&pdev->dev,
+                                             sizeof(*chain->wb_status),
+                                             &chain->wb_status_paddr,
+                                             GFP_KERNEL);
        if (!chain->wb_status) {
                dev_err(&pdev->dev, "Failed to allocate DMA wb status\n");
                return -ENOMEM;
index 7cb8b9b..683e675 100644 (file)
@@ -593,10 +593,10 @@ static int alloc_eq_pages(struct hinic_eq *eq)
        }
 
        for (pg = 0; pg < eq->num_pages; pg++) {
-               eq->virt_addr[pg] = dma_zalloc_coherent(&pdev->dev,
-                                                       eq->page_size,
-                                                       &eq->dma_addr[pg],
-                                                       GFP_KERNEL);
+               eq->virt_addr[pg] = dma_alloc_coherent(&pdev->dev,
+                                                      eq->page_size,
+                                                      &eq->dma_addr[pg],
+                                                      GFP_KERNEL);
                if (!eq->virt_addr[pg]) {
                        err = -ENOMEM;
                        goto err_dma_alloc;
index 8e58976..a322a22 100644 (file)
@@ -355,9 +355,9 @@ int hinic_io_create_qps(struct hinic_func_to_io *func_to_io,
                goto err_sq_db;
        }
 
-       ci_addr_base = dma_zalloc_coherent(&pdev->dev, CI_TABLE_SIZE(num_qps),
-                                          &func_to_io->ci_dma_base,
-                                          GFP_KERNEL);
+       ci_addr_base = dma_alloc_coherent(&pdev->dev, CI_TABLE_SIZE(num_qps),
+                                         &func_to_io->ci_dma_base,
+                                         GFP_KERNEL);
        if (!ci_addr_base) {
                dev_err(&pdev->dev, "Failed to allocate CI area\n");
                err = -ENOMEM;
index bbf9bdd..d62cf50 100644 (file)
@@ -336,9 +336,9 @@ static int alloc_rq_cqe(struct hinic_rq *rq)
                goto err_cqe_dma_arr_alloc;
 
        for (i = 0; i < wq->q_depth; i++) {
-               rq->cqe[i] = dma_zalloc_coherent(&pdev->dev,
-                                                sizeof(*rq->cqe[i]),
-                                                &rq->cqe_dma[i], GFP_KERNEL);
+               rq->cqe[i] = dma_alloc_coherent(&pdev->dev,
+                                               sizeof(*rq->cqe[i]),
+                                               &rq->cqe_dma[i], GFP_KERNEL);
                if (!rq->cqe[i])
                        goto err_cqe_alloc;
        }
@@ -415,8 +415,8 @@ int hinic_init_rq(struct hinic_rq *rq, struct hinic_hwif *hwif,
 
        /* HW requirements: Must be at least 32 bit */
        pi_size = ALIGN(sizeof(*rq->pi_virt_addr), sizeof(u32));
-       rq->pi_virt_addr = dma_zalloc_coherent(&pdev->dev, pi_size,
-                                              &rq->pi_dma_addr, GFP_KERNEL);
+       rq->pi_virt_addr = dma_alloc_coherent(&pdev->dev, pi_size,
+                                             &rq->pi_dma_addr, GFP_KERNEL);
        if (!rq->pi_virt_addr) {
                dev_err(&pdev->dev, "Failed to allocate PI address\n");
                err = -ENOMEM;
index 1dfa7eb..cb66e70 100644 (file)
@@ -114,8 +114,8 @@ static int queue_alloc_page(struct hinic_hwif *hwif, u64 **vaddr, u64 *paddr,
        struct pci_dev *pdev = hwif->pdev;
        dma_addr_t dma_addr;
 
-       *vaddr = dma_zalloc_coherent(&pdev->dev, page_sz, &dma_addr,
-                                    GFP_KERNEL);
+       *vaddr = dma_alloc_coherent(&pdev->dev, page_sz, &dma_addr,
+                                   GFP_KERNEL);
        if (!*vaddr) {
                dev_err(&pdev->dev, "Failed to allocate dma for wqs page\n");
                return -ENOMEM;
@@ -482,8 +482,8 @@ static int alloc_wq_pages(struct hinic_wq *wq, struct hinic_hwif *hwif,
                u64 *paddr = &wq->block_vaddr[i];
                dma_addr_t dma_addr;
 
-               *vaddr = dma_zalloc_coherent(&pdev->dev, wq->wq_page_size,
-                                            &dma_addr, GFP_KERNEL);
+               *vaddr = dma_alloc_coherent(&pdev->dev, wq->wq_page_size,
+                                           &dma_addr, GFP_KERNEL);
                if (!*vaddr) {
                        dev_err(&pdev->dev, "Failed to allocate wq page\n");
                        goto err_alloc_wq_pages;
index fff09dc..787d5ac 100644 (file)
@@ -636,8 +636,8 @@ static int mal_probe(struct platform_device *ofdev)
        bd_size = sizeof(struct mal_descriptor) *
                (NUM_TX_BUFF * mal->num_tx_chans +
                 NUM_RX_BUFF * mal->num_rx_chans);
-       mal->bd_virt = dma_zalloc_coherent(&ofdev->dev, bd_size, &mal->bd_dma,
-                                          GFP_KERNEL);
+       mal->bd_virt = dma_alloc_coherent(&ofdev->dev, bd_size, &mal->bd_dma,
+                                         GFP_KERNEL);
        if (mal->bd_virt == NULL) {
                err = -ENOMEM;
                goto fail_unmap;
index 2569a16..a410085 100644 (file)
@@ -993,8 +993,8 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter)
 
        txdr->size = txdr->count * sizeof(struct e1000_tx_desc);
        txdr->size = ALIGN(txdr->size, 4096);
-       txdr->desc = dma_zalloc_coherent(&pdev->dev, txdr->size, &txdr->dma,
-                                        GFP_KERNEL);
+       txdr->desc = dma_alloc_coherent(&pdev->dev, txdr->size, &txdr->dma,
+                                       GFP_KERNEL);
        if (!txdr->desc) {
                ret_val = 2;
                goto err_nomem;
@@ -1051,8 +1051,8 @@ static int e1000_setup_desc_rings(struct e1000_adapter *adapter)
        }
 
        rxdr->size = rxdr->count * sizeof(struct e1000_rx_desc);
-       rxdr->desc = dma_zalloc_coherent(&pdev->dev, rxdr->size, &rxdr->dma,
-                                        GFP_KERNEL);
+       rxdr->desc = dma_alloc_coherent(&pdev->dev, rxdr->size, &rxdr->dma,
+                                       GFP_KERNEL);
        if (!rxdr->desc) {
                ret_val = 6;
                goto err_nomem;
index 308c006..189f231 100644 (file)
@@ -2305,8 +2305,8 @@ static int e1000_alloc_ring_dma(struct e1000_adapter *adapter,
 {
        struct pci_dev *pdev = adapter->pdev;
 
-       ring->desc = dma_zalloc_coherent(&pdev->dev, ring->size, &ring->dma,
-                                        GFP_KERNEL);
+       ring->desc = dma_alloc_coherent(&pdev->dev, ring->size, &ring->dma,
+                                       GFP_KERNEL);
        if (!ring->desc)
                return -ENOMEM;
 
index 4d40878..f52e2c4 100644 (file)
@@ -109,8 +109,8 @@ int i40e_allocate_dma_mem_d(struct i40e_hw *hw, struct i40e_dma_mem *mem,
        struct i40e_pf *pf = (struct i40e_pf *)hw->back;
 
        mem->size = ALIGN(size, alignment);
-       mem->va = dma_zalloc_coherent(&pf->pdev->dev, mem->size,
-                                     &mem->pa, GFP_KERNEL);
+       mem->va = dma_alloc_coherent(&pf->pdev->dev, mem->size, &mem->pa,
+                                    GFP_KERNEL);
        if (!mem->va)
                return -ENOMEM;
 
index 1d4d168..e5ac2d3 100644 (file)
@@ -680,8 +680,8 @@ ixgb_setup_tx_resources(struct ixgb_adapter *adapter)
        txdr->size = txdr->count * sizeof(struct ixgb_tx_desc);
        txdr->size = ALIGN(txdr->size, 4096);
 
-       txdr->desc = dma_zalloc_coherent(&pdev->dev, txdr->size, &txdr->dma,
-                                        GFP_KERNEL);
+       txdr->desc = dma_alloc_coherent(&pdev->dev, txdr->size, &txdr->dma,
+                                       GFP_KERNEL);
        if (!txdr->desc) {
                vfree(txdr->buffer_info);
                return -ENOMEM;
@@ -763,8 +763,8 @@ ixgb_setup_rx_resources(struct ixgb_adapter *adapter)
        rxdr->size = rxdr->count * sizeof(struct ixgb_rx_desc);
        rxdr->size = ALIGN(rxdr->size, 4096);
 
-       rxdr->desc = dma_zalloc_coherent(&pdev->dev, rxdr->size, &rxdr->dma,
-                                        GFP_KERNEL);
+       rxdr->desc = dma_alloc_coherent(&pdev->dev, rxdr->size, &rxdr->dma,
+                                       GFP_KERNEL);
 
        if (!rxdr->desc) {
                vfree(rxdr->buffer_info);
index e087547..16066c2 100644 (file)
@@ -2044,9 +2044,9 @@ static int mvpp2_aggr_txq_init(struct platform_device *pdev,
        u32 txq_dma;
 
        /* Allocate memory for TX descriptors */
-       aggr_txq->descs = dma_zalloc_coherent(&pdev->dev,
-                               MVPP2_AGGR_TXQ_SIZE * MVPP2_DESC_ALIGNED_SIZE,
-                               &aggr_txq->descs_dma, GFP_KERNEL);
+       aggr_txq->descs = dma_alloc_coherent(&pdev->dev,
+                                            MVPP2_AGGR_TXQ_SIZE * MVPP2_DESC_ALIGNED_SIZE,
+                                            &aggr_txq->descs_dma, GFP_KERNEL);
        if (!aggr_txq->descs)
                return -ENOMEM;
 
index ec50a21..e332e82 100644 (file)
@@ -64,7 +64,7 @@ static inline int qmem_alloc(struct device *dev, struct qmem **q,
 
        qmem->entry_sz = entry_sz;
        qmem->alloc_sz = (qsize * entry_sz) + OTX2_ALIGN;
-       qmem->base = dma_zalloc_coherent(dev, qmem->alloc_sz,
+       qmem->base = dma_alloc_coherent(dev, qmem->alloc_sz,
                                         &qmem->iova, GFP_KERNEL);
        if (!qmem->base)
                return -ENOMEM;
index 0bd4351..f8a6d6e 100644 (file)
@@ -557,9 +557,9 @@ static int init_hash_table(struct pxa168_eth_private *pep)
         * table is full.
         */
        if (!pep->htpr) {
-               pep->htpr = dma_zalloc_coherent(pep->dev->dev.parent,
-                                               HASH_ADDR_TABLE_SIZE,
-                                               &pep->htpr_dma, GFP_KERNEL);
+               pep->htpr = dma_alloc_coherent(pep->dev->dev.parent,
+                                              HASH_ADDR_TABLE_SIZE,
+                                              &pep->htpr_dma, GFP_KERNEL);
                if (!pep->htpr)
                        return -ENOMEM;
        } else {
@@ -1044,9 +1044,9 @@ static int rxq_init(struct net_device *dev)
        pep->rx_desc_count = 0;
        size = pep->rx_ring_size * sizeof(struct rx_desc);
        pep->rx_desc_area_size = size;
-       pep->p_rx_desc_area = dma_zalloc_coherent(pep->dev->dev.parent, size,
-                                                 &pep->rx_desc_dma,
-                                                 GFP_KERNEL);
+       pep->p_rx_desc_area = dma_alloc_coherent(pep->dev->dev.parent, size,
+                                                &pep->rx_desc_dma,
+                                                GFP_KERNEL);
        if (!pep->p_rx_desc_area)
                goto out;
 
@@ -1103,9 +1103,9 @@ static int txq_init(struct net_device *dev)
        pep->tx_desc_count = 0;
        size = pep->tx_ring_size * sizeof(struct tx_desc);
        pep->tx_desc_area_size = size;
-       pep->p_tx_desc_area = dma_zalloc_coherent(pep->dev->dev.parent, size,
-                                                 &pep->tx_desc_dma,
-                                                 GFP_KERNEL);
+       pep->p_tx_desc_area = dma_alloc_coherent(pep->dev->dev.parent, size,
+                                                &pep->tx_desc_dma,
+                                                GFP_KERNEL);
        if (!pep->p_tx_desc_area)
                goto out;
        /* Initialize the next_desc_ptr links in the Tx descriptors ring */
index 399f565..fe9653f 100644 (file)
@@ -598,10 +598,10 @@ static int mtk_init_fq_dma(struct mtk_eth *eth)
        dma_addr_t dma_addr;
        int i;
 
-       eth->scratch_ring = dma_zalloc_coherent(eth->dev,
-                                               cnt * sizeof(struct mtk_tx_dma),
-                                               &eth->phy_scratch_ring,
-                                               GFP_ATOMIC);
+       eth->scratch_ring = dma_alloc_coherent(eth->dev,
+                                              cnt * sizeof(struct mtk_tx_dma),
+                                              &eth->phy_scratch_ring,
+                                              GFP_ATOMIC);
        if (unlikely(!eth->scratch_ring))
                return -ENOMEM;
 
@@ -1213,8 +1213,8 @@ static int mtk_tx_alloc(struct mtk_eth *eth)
        if (!ring->buf)
                goto no_tx_mem;
 
-       ring->dma = dma_zalloc_coherent(eth->dev, MTK_DMA_SIZE * sz,
-                                       &ring->phys, GFP_ATOMIC);
+       ring->dma = dma_alloc_coherent(eth->dev, MTK_DMA_SIZE * sz,
+                                      &ring->phys, GFP_ATOMIC);
        if (!ring->dma)
                goto no_tx_mem;
 
@@ -1310,9 +1310,9 @@ static int mtk_rx_alloc(struct mtk_eth *eth, int ring_no, int rx_flag)
                        return -ENOMEM;
        }
 
-       ring->dma = dma_zalloc_coherent(eth->dev,
-                                       rx_dma_size * sizeof(*ring->dma),
-                                       &ring->phys, GFP_ATOMIC);
+       ring->dma = dma_alloc_coherent(eth->dev,
+                                      rx_dma_size * sizeof(*ring->dma),
+                                      &ring->phys, GFP_ATOMIC);
        if (!ring->dma)
                return -ENOMEM;
 
index 9af34e0..dbc483e 100644 (file)
@@ -584,8 +584,8 @@ static int mlx4_buf_direct_alloc(struct mlx4_dev *dev, int size,
        buf->npages       = 1;
        buf->page_shift   = get_order(size) + PAGE_SHIFT;
        buf->direct.buf   =
-               dma_zalloc_coherent(&dev->persist->pdev->dev,
-                                   size, &t, GFP_KERNEL);
+               dma_alloc_coherent(&dev->persist->pdev->dev, size, &t,
+                                  GFP_KERNEL);
        if (!buf->direct.buf)
                return -ENOMEM;
 
@@ -624,8 +624,8 @@ int mlx4_buf_alloc(struct mlx4_dev *dev, int size, int max_direct,
 
                for (i = 0; i < buf->nbufs; ++i) {
                        buf->page_list[i].buf =
-                               dma_zalloc_coherent(&dev->persist->pdev->dev,
-                                                   PAGE_SIZE, &t, GFP_KERNEL);
+                               dma_alloc_coherent(&dev->persist->pdev->dev,
+                                                  PAGE_SIZE, &t, GFP_KERNEL);
                        if (!buf->page_list[i].buf)
                                goto err_free;
 
index 456f300..421b9c3 100644 (file)
@@ -63,8 +63,8 @@ static void *mlx5_dma_zalloc_coherent_node(struct mlx5_core_dev *dev,
        mutex_lock(&priv->alloc_mutex);
        original_node = dev_to_node(&dev->pdev->dev);
        set_dev_node(&dev->pdev->dev, node);
-       cpu_handle = dma_zalloc_coherent(&dev->pdev->dev, size,
-                                        dma_handle, GFP_KERNEL);
+       cpu_handle = dma_alloc_coherent(&dev->pdev->dev, size, dma_handle,
+                                       GFP_KERNEL);
        set_dev_node(&dev->pdev->dev, original_node);
        mutex_unlock(&priv->alloc_mutex);
        return cpu_handle;
index d3125cd..3e0fa8a 100644 (file)
@@ -1789,8 +1789,8 @@ static int alloc_cmd_page(struct mlx5_core_dev *dev, struct mlx5_cmd *cmd)
 {
        struct device *ddev = &dev->pdev->dev;
 
-       cmd->cmd_alloc_buf = dma_zalloc_coherent(ddev, MLX5_ADAPTER_PAGE_SIZE,
-                                                &cmd->alloc_dma, GFP_KERNEL);
+       cmd->cmd_alloc_buf = dma_alloc_coherent(ddev, MLX5_ADAPTER_PAGE_SIZE,
+                                               &cmd->alloc_dma, GFP_KERNEL);
        if (!cmd->cmd_alloc_buf)
                return -ENOMEM;
 
@@ -1804,9 +1804,9 @@ static int alloc_cmd_page(struct mlx5_core_dev *dev, struct mlx5_cmd *cmd)
 
        dma_free_coherent(ddev, MLX5_ADAPTER_PAGE_SIZE, cmd->cmd_alloc_buf,
                          cmd->alloc_dma);
-       cmd->cmd_alloc_buf = dma_zalloc_coherent(ddev,
-                                                2 * MLX5_ADAPTER_PAGE_SIZE - 1,
-                                                &cmd->alloc_dma, GFP_KERNEL);
+       cmd->cmd_alloc_buf = dma_alloc_coherent(ddev,
+                                               2 * MLX5_ADAPTER_PAGE_SIZE - 1,
+                                               &cmd->alloc_dma, GFP_KERNEL);
        if (!cmd->cmd_alloc_buf)
                return -ENOMEM;
 
index 5f384f7..19ce0e6 100644 (file)
@@ -3604,9 +3604,9 @@ static int myri10ge_alloc_slices(struct myri10ge_priv *mgp)
        for (i = 0; i < mgp->num_slices; i++) {
                ss = &mgp->ss[i];
                bytes = mgp->max_intr_slots * sizeof(*ss->rx_done.entry);
-               ss->rx_done.entry = dma_zalloc_coherent(&pdev->dev, bytes,
-                                                       &ss->rx_done.bus,
-                                                       GFP_KERNEL);
+               ss->rx_done.entry = dma_alloc_coherent(&pdev->dev, bytes,
+                                                      &ss->rx_done.bus,
+                                                      GFP_KERNEL);
                if (ss->rx_done.entry == NULL)
                        goto abort;
                bytes = sizeof(*ss->fw_stats);
index e97636d..7d2d424 100644 (file)
@@ -2170,9 +2170,9 @@ nfp_net_tx_ring_alloc(struct nfp_net_dp *dp, struct nfp_net_tx_ring *tx_ring)
        tx_ring->cnt = dp->txd_cnt;
 
        tx_ring->size = array_size(tx_ring->cnt, sizeof(*tx_ring->txds));
-       tx_ring->txds = dma_zalloc_coherent(dp->dev, tx_ring->size,
-                                           &tx_ring->dma,
-                                           GFP_KERNEL | __GFP_NOWARN);
+       tx_ring->txds = dma_alloc_coherent(dp->dev, tx_ring->size,
+                                          &tx_ring->dma,
+                                          GFP_KERNEL | __GFP_NOWARN);
        if (!tx_ring->txds) {
                netdev_warn(dp->netdev, "failed to allocate TX descriptor ring memory, requested descriptor count: %d, consider lowering descriptor count\n",
                            tx_ring->cnt);
@@ -2328,9 +2328,9 @@ nfp_net_rx_ring_alloc(struct nfp_net_dp *dp, struct nfp_net_rx_ring *rx_ring)
 
        rx_ring->cnt = dp->rxd_cnt;
        rx_ring->size = array_size(rx_ring->cnt, sizeof(*rx_ring->rxds));
-       rx_ring->rxds = dma_zalloc_coherent(dp->dev, rx_ring->size,
-                                           &rx_ring->dma,
-                                           GFP_KERNEL | __GFP_NOWARN);
+       rx_ring->rxds = dma_alloc_coherent(dp->dev, rx_ring->size,
+                                          &rx_ring->dma,
+                                          GFP_KERNEL | __GFP_NOWARN);
        if (!rx_ring->rxds) {
                netdev_warn(dp->netdev, "failed to allocate RX descriptor ring memory, requested descriptor count: %d, consider lowering descriptor count\n",
                            rx_ring->cnt);
index 0611f23..1e408d1 100644 (file)
@@ -287,9 +287,9 @@ static int nixge_hw_dma_bd_init(struct net_device *ndev)
        priv->rx_bd_ci = 0;
 
        /* Allocate the Tx and Rx buffer descriptors. */
-       priv->tx_bd_v = dma_zalloc_coherent(ndev->dev.parent,
-                                           sizeof(*priv->tx_bd_v) * TX_BD_NUM,
-                                           &priv->tx_bd_p, GFP_KERNEL);
+       priv->tx_bd_v = dma_alloc_coherent(ndev->dev.parent,
+                                          sizeof(*priv->tx_bd_v) * TX_BD_NUM,
+                                          &priv->tx_bd_p, GFP_KERNEL);
        if (!priv->tx_bd_v)
                goto out;
 
@@ -299,9 +299,9 @@ static int nixge_hw_dma_bd_init(struct net_device *ndev)
        if (!priv->tx_skb)
                goto out;
 
-       priv->rx_bd_v = dma_zalloc_coherent(ndev->dev.parent,
-                                           sizeof(*priv->rx_bd_v) * RX_BD_NUM,
-                                           &priv->rx_bd_p, GFP_KERNEL);
+       priv->rx_bd_v = dma_alloc_coherent(ndev->dev.parent,
+                                          sizeof(*priv->rx_bd_v) * RX_BD_NUM,
+                                          &priv->rx_bd_p, GFP_KERNEL);
        if (!priv->rx_bd_v)
                goto out;
 
index 43c0c10..552d930 100644 (file)
@@ -1440,8 +1440,8 @@ pch_gbe_alloc_rx_buffers_pool(struct pch_gbe_adapter *adapter,
 
        size = rx_ring->count * bufsz + PCH_GBE_RESERVE_MEMORY;
        rx_ring->rx_buff_pool =
-               dma_zalloc_coherent(&pdev->dev, size,
-                                   &rx_ring->rx_buff_pool_logic, GFP_KERNEL);
+               dma_alloc_coherent(&pdev->dev, size,
+                                  &rx_ring->rx_buff_pool_logic, GFP_KERNEL);
        if (!rx_ring->rx_buff_pool)
                return -ENOMEM;
 
@@ -1755,8 +1755,8 @@ int pch_gbe_setup_tx_resources(struct pch_gbe_adapter *adapter,
 
        tx_ring->size = tx_ring->count * (int)sizeof(struct pch_gbe_tx_desc);
 
-       tx_ring->desc = dma_zalloc_coherent(&pdev->dev, tx_ring->size,
-                                           &tx_ring->dma, GFP_KERNEL);
+       tx_ring->desc = dma_alloc_coherent(&pdev->dev, tx_ring->size,
+                                          &tx_ring->dma, GFP_KERNEL);
        if (!tx_ring->desc) {
                vfree(tx_ring->buffer_info);
                return -ENOMEM;
@@ -1798,8 +1798,8 @@ int pch_gbe_setup_rx_resources(struct pch_gbe_adapter *adapter,
                return -ENOMEM;
 
        rx_ring->size = rx_ring->count * (int)sizeof(struct pch_gbe_rx_desc);
-       rx_ring->desc = dma_zalloc_coherent(&pdev->dev, rx_ring->size,
-                                           &rx_ring->dma, GFP_KERNEL);
+       rx_ring->desc = dma_alloc_coherent(&pdev->dev, rx_ring->size,
+                                                 &rx_ring->dma, GFP_KERNEL);
        if (!rx_ring->desc) {
                vfree(rx_ring->buffer_info);
                return -ENOMEM;
index 8a31a02..d210415 100644 (file)
@@ -401,9 +401,9 @@ static int pasemi_mac_setup_rx_resources(const struct net_device *dev)
        if (pasemi_dma_alloc_ring(&ring->chan, RX_RING_SIZE))
                goto out_ring_desc;
 
-       ring->buffers = dma_zalloc_coherent(&mac->dma_pdev->dev,
-                                           RX_RING_SIZE * sizeof(u64),
-                                           &ring->buf_dma, GFP_KERNEL);
+       ring->buffers = dma_alloc_coherent(&mac->dma_pdev->dev,
+                                          RX_RING_SIZE * sizeof(u64),
+                                          &ring->buf_dma, GFP_KERNEL);
        if (!ring->buffers)
                goto out_ring_desc;
 
index dc1c1b6..c2ad405 100644 (file)
@@ -936,9 +936,9 @@ static int qed_cxt_src_t2_alloc(struct qed_hwfn *p_hwfn)
                u32 size = min_t(u32, total_size, psz);
                void **p_virt = &p_mngr->t2[i].p_virt;
 
-               *p_virt = dma_zalloc_coherent(&p_hwfn->cdev->pdev->dev,
-                                             size, &p_mngr->t2[i].p_phys,
-                                             GFP_KERNEL);
+               *p_virt = dma_alloc_coherent(&p_hwfn->cdev->pdev->dev, size,
+                                            &p_mngr->t2[i].p_phys,
+                                            GFP_KERNEL);
                if (!p_mngr->t2[i].p_virt) {
                        rc = -ENOMEM;
                        goto t2_fail;
@@ -1054,8 +1054,8 @@ static int qed_ilt_blk_alloc(struct qed_hwfn *p_hwfn,
                u32 size;
 
                size = min_t(u32, sz_left, p_blk->real_size_in_page);
-               p_virt = dma_zalloc_coherent(&p_hwfn->cdev->pdev->dev, size,
-                                            &p_phys, GFP_KERNEL);
+               p_virt = dma_alloc_coherent(&p_hwfn->cdev->pdev->dev, size,
+                                           &p_phys, GFP_KERNEL);
                if (!p_virt)
                        return -ENOMEM;
 
@@ -2306,9 +2306,9 @@ qed_cxt_dynamic_ilt_alloc(struct qed_hwfn *p_hwfn,
                goto out0;
        }
 
-       p_virt = dma_zalloc_coherent(&p_hwfn->cdev->pdev->dev,
-                                    p_blk->real_size_in_page, &p_phys,
-                                    GFP_KERNEL);
+       p_virt = dma_alloc_coherent(&p_hwfn->cdev->pdev->dev,
+                                   p_blk->real_size_in_page, &p_phys,
+                                   GFP_KERNEL);
        if (!p_virt) {
                rc = -ENOMEM;
                goto out1;
index d344e9d..af38d3d 100644 (file)
@@ -434,14 +434,14 @@ int qlcnic_82xx_fw_cmd_create_tx_ctx(struct qlcnic_adapter *adapter,
        *(tx_ring->hw_consumer) = 0;
 
        rq_size = SIZEOF_HOSTRQ_TX(struct qlcnic_hostrq_tx_ctx);
-       rq_addr = dma_zalloc_coherent(&adapter->pdev->dev, rq_size,
-                                     &rq_phys_addr, GFP_KERNEL);
+       rq_addr = dma_alloc_coherent(&adapter->pdev->dev, rq_size,
+                                    &rq_phys_addr, GFP_KERNEL);
        if (!rq_addr)
                return -ENOMEM;
 
        rsp_size = SIZEOF_CARDRSP_TX(struct qlcnic_cardrsp_tx_ctx);
-       rsp_addr = dma_zalloc_coherent(&adapter->pdev->dev, rsp_size,
-                                      &rsp_phys_addr, GFP_KERNEL);
+       rsp_addr = dma_alloc_coherent(&adapter->pdev->dev, rsp_size,
+                                     &rsp_phys_addr, GFP_KERNEL);
        if (!rsp_addr) {
                err = -ENOMEM;
                goto out_free_rq;
@@ -855,8 +855,8 @@ int qlcnic_82xx_get_nic_info(struct qlcnic_adapter *adapter,
        struct qlcnic_cmd_args cmd;
        size_t  nic_size = sizeof(struct qlcnic_info_le);
 
-       nic_info_addr = dma_zalloc_coherent(&adapter->pdev->dev, nic_size,
-                                           &nic_dma_t, GFP_KERNEL);
+       nic_info_addr = dma_alloc_coherent(&adapter->pdev->dev, nic_size,
+                                          &nic_dma_t, GFP_KERNEL);
        if (!nic_info_addr)
                return -ENOMEM;
 
@@ -909,8 +909,8 @@ int qlcnic_82xx_set_nic_info(struct qlcnic_adapter *adapter,
        if (adapter->ahw->op_mode != QLCNIC_MGMT_FUNC)
                return err;
 
-       nic_info_addr = dma_zalloc_coherent(&adapter->pdev->dev, nic_size,
-                                           &nic_dma_t, GFP_KERNEL);
+       nic_info_addr = dma_alloc_coherent(&adapter->pdev->dev, nic_size,
+                                          &nic_dma_t, GFP_KERNEL);
        if (!nic_info_addr)
                return -ENOMEM;
 
@@ -964,8 +964,8 @@ int qlcnic_82xx_get_pci_info(struct qlcnic_adapter *adapter,
        void *pci_info_addr;
        int err = 0, i;
 
-       pci_info_addr = dma_zalloc_coherent(&adapter->pdev->dev, pci_size,
-                                           &pci_info_dma_t, GFP_KERNEL);
+       pci_info_addr = dma_alloc_coherent(&adapter->pdev->dev, pci_size,
+                                          &pci_info_dma_t, GFP_KERNEL);
        if (!pci_info_addr)
                return -ENOMEM;
 
@@ -1078,8 +1078,8 @@ int qlcnic_get_port_stats(struct qlcnic_adapter *adapter, const u8 func,
                return -EIO;
        }
 
-       stats_addr = dma_zalloc_coherent(&adapter->pdev->dev, stats_size,
-                                        &stats_dma_t, GFP_KERNEL);
+       stats_addr = dma_alloc_coherent(&adapter->pdev->dev, stats_size,
+                                       &stats_dma_t, GFP_KERNEL);
        if (!stats_addr)
                return -ENOMEM;
 
@@ -1134,8 +1134,8 @@ int qlcnic_get_mac_stats(struct qlcnic_adapter *adapter,
        if (mac_stats == NULL)
                return -ENOMEM;
 
-       stats_addr = dma_zalloc_coherent(&adapter->pdev->dev, stats_size,
-                                        &stats_dma_t, GFP_KERNEL);
+       stats_addr = dma_alloc_coherent(&adapter->pdev->dev, stats_size,
+                                       &stats_dma_t, GFP_KERNEL);
        if (!stats_addr)
                return -ENOMEM;
 
index 031f6e6..8d79031 100644 (file)
@@ -776,7 +776,7 @@ int emac_mac_rx_tx_rings_alloc_all(struct emac_adapter *adpt)
                            8 + 2 * 8; /* 8 byte per one Tx and two Rx rings */
 
        ring_header->used = 0;
-       ring_header->v_addr = dma_zalloc_coherent(dev, ring_header->size,
+       ring_header->v_addr = dma_alloc_coherent(dev, ring_header->size,
                                                 &ring_header->dma_addr,
                                                 GFP_KERNEL);
        if (!ring_header->v_addr)
index 690aee8..6d22dd5 100644 (file)
@@ -400,9 +400,9 @@ static int init_tx_ring(struct device *dev, u8 queue_no,
        }
 
        /* allocate memory for TX descriptors */
-       tx_ring->dma_tx = dma_zalloc_coherent(dev,
-                                             tx_rsize * sizeof(struct sxgbe_tx_norm_desc),
-                                             &tx_ring->dma_tx_phy, GFP_KERNEL);
+       tx_ring->dma_tx = dma_alloc_coherent(dev,
+                                            tx_rsize * sizeof(struct sxgbe_tx_norm_desc),
+                                            &tx_ring->dma_tx_phy, GFP_KERNEL);
        if (!tx_ring->dma_tx)
                return -ENOMEM;
 
@@ -479,9 +479,9 @@ static int init_rx_ring(struct net_device *dev, u8 queue_no,
        rx_ring->queue_no = queue_no;
 
        /* allocate memory for RX descriptors */
-       rx_ring->dma_rx = dma_zalloc_coherent(priv->device,
-                                             rx_rsize * sizeof(struct sxgbe_rx_norm_desc),
-                                             &rx_ring->dma_rx_phy, GFP_KERNEL);
+       rx_ring->dma_rx = dma_alloc_coherent(priv->device,
+                                            rx_rsize * sizeof(struct sxgbe_rx_norm_desc),
+                                            &rx_ring->dma_rx_phy, GFP_KERNEL);
 
        if (rx_ring->dma_rx == NULL)
                return -ENOMEM;
index a8ecb33..9c07b51 100644 (file)
@@ -33,8 +33,8 @@
 int ef4_nic_alloc_buffer(struct ef4_nic *efx, struct ef4_buffer *buffer,
                         unsigned int len, gfp_t gfp_flags)
 {
-       buffer->addr = dma_zalloc_coherent(&efx->pci_dev->dev, len,
-                                          &buffer->dma_addr, gfp_flags);
+       buffer->addr = dma_alloc_coherent(&efx->pci_dev->dev, len,
+                                         &buffer->dma_addr, gfp_flags);
        if (!buffer->addr)
                return -ENOMEM;
        buffer->len = len;
index aa1945a..c2d45a4 100644 (file)
@@ -34,8 +34,8 @@
 int efx_nic_alloc_buffer(struct efx_nic *efx, struct efx_buffer *buffer,
                         unsigned int len, gfp_t gfp_flags)
 {
-       buffer->addr = dma_zalloc_coherent(&efx->pci_dev->dev, len,
-                                          &buffer->dma_addr, gfp_flags);
+       buffer->addr = dma_alloc_coherent(&efx->pci_dev->dev, len,
+                                         &buffer->dma_addr, gfp_flags);
        if (!buffer->addr)
                return -ENOMEM;
        buffer->len = len;
index 703fbbe..0e1b7e9 100644 (file)
@@ -211,8 +211,8 @@ static void meth_check_link(struct net_device *dev)
 static int meth_init_tx_ring(struct meth_private *priv)
 {
        /* Init TX ring */
-       priv->tx_ring = dma_zalloc_coherent(NULL, TX_RING_BUFFER_SIZE,
-                                           &priv->tx_ring_dma, GFP_ATOMIC);
+       priv->tx_ring = dma_alloc_coherent(NULL, TX_RING_BUFFER_SIZE,
+                                          &priv->tx_ring_dma, GFP_ATOMIC);
        if (!priv->tx_ring)
                return -ENOMEM;
 
index 05a0948..a181497 100644 (file)
@@ -1029,8 +1029,8 @@ static int netsec_alloc_dring(struct netsec_priv *priv, enum ring_id id)
        struct netsec_desc_ring *dring = &priv->desc_ring[id];
        int i;
 
-       dring->vaddr = dma_zalloc_coherent(priv->dev, DESC_SZ * DESC_NUM,
-                                          &dring->desc_dma, GFP_KERNEL);
+       dring->vaddr = dma_alloc_coherent(priv->dev, DESC_SZ * DESC_NUM,
+                                         &dring->desc_dma, GFP_KERNEL);
        if (!dring->vaddr)
                goto err;
 
index 0e0a078..0c4ab34 100644 (file)
@@ -1549,22 +1549,18 @@ static int alloc_dma_rx_desc_resources(struct stmmac_priv *priv)
                        goto err_dma;
 
                if (priv->extend_desc) {
-                       rx_q->dma_erx = dma_zalloc_coherent(priv->device,
-                                                           DMA_RX_SIZE *
-                                                           sizeof(struct
-                                                           dma_extended_desc),
-                                                           &rx_q->dma_rx_phy,
-                                                           GFP_KERNEL);
+                       rx_q->dma_erx = dma_alloc_coherent(priv->device,
+                                                          DMA_RX_SIZE * sizeof(struct dma_extended_desc),
+                                                          &rx_q->dma_rx_phy,
+                                                          GFP_KERNEL);
                        if (!rx_q->dma_erx)
                                goto err_dma;
 
                } else {
-                       rx_q->dma_rx = dma_zalloc_coherent(priv->device,
-                                                          DMA_RX_SIZE *
-                                                          sizeof(struct
-                                                          dma_desc),
-                                                          &rx_q->dma_rx_phy,
-                                                          GFP_KERNEL);
+                       rx_q->dma_rx = dma_alloc_coherent(priv->device,
+                                                         DMA_RX_SIZE * sizeof(struct dma_desc),
+                                                         &rx_q->dma_rx_phy,
+                                                         GFP_KERNEL);
                        if (!rx_q->dma_rx)
                                goto err_dma;
                }
@@ -1612,21 +1608,17 @@ static int alloc_dma_tx_desc_resources(struct stmmac_priv *priv)
                        goto err_dma;
 
                if (priv->extend_desc) {
-                       tx_q->dma_etx = dma_zalloc_coherent(priv->device,
-                                                           DMA_TX_SIZE *
-                                                           sizeof(struct
-                                                           dma_extended_desc),
-                                                           &tx_q->dma_tx_phy,
-                                                           GFP_KERNEL);
+                       tx_q->dma_etx = dma_alloc_coherent(priv->device,
+                                                          DMA_TX_SIZE * sizeof(struct dma_extended_desc),
+                                                          &tx_q->dma_tx_phy,
+                                                          GFP_KERNEL);
                        if (!tx_q->dma_etx)
                                goto err_dma;
                } else {
-                       tx_q->dma_tx = dma_zalloc_coherent(priv->device,
-                                                          DMA_TX_SIZE *
-                                                          sizeof(struct
-                                                                 dma_desc),
-                                                          &tx_q->dma_tx_phy,
-                                                          GFP_KERNEL);
+                       tx_q->dma_tx = dma_alloc_coherent(priv->device,
+                                                         DMA_TX_SIZE * sizeof(struct dma_desc),
+                                                         &tx_q->dma_tx_phy,
+                                                         GFP_KERNEL);
                        if (!tx_q->dma_tx)
                                goto err_dma;
                }
index edcd1e6..37925a1 100644 (file)
@@ -1311,13 +1311,13 @@ static int tsi108_open(struct net_device *dev)
                       data->id, dev->irq, dev->name);
        }
 
-       data->rxring = dma_zalloc_coherent(&data->pdev->dev, rxring_size,
-                       &data->rxdma, GFP_KERNEL);
+       data->rxring = dma_alloc_coherent(&data->pdev->dev, rxring_size,
+                                         &data->rxdma, GFP_KERNEL);
        if (!data->rxring)
                return -ENOMEM;
 
-       data->txring = dma_zalloc_coherent(&data->pdev->dev, txring_size,
-                       &data->txdma, GFP_KERNEL);
+       data->txring = dma_alloc_coherent(&data->pdev->dev, txring_size,
+                                         &data->txdma, GFP_KERNEL);
        if (!data->txring) {
                dma_free_coherent(&data->pdev->dev, rxring_size, data->rxring,
                                    data->rxdma);
index 2241f98..15bb058 100644 (file)
@@ -243,15 +243,15 @@ static int temac_dma_bd_init(struct net_device *ndev)
 
        /* allocate the tx and rx ring buffer descriptors. */
        /* returns a virtual address and a physical address. */
-       lp->tx_bd_v = dma_zalloc_coherent(ndev->dev.parent,
-                                         sizeof(*lp->tx_bd_v) * TX_BD_NUM,
-                                         &lp->tx_bd_p, GFP_KERNEL);
+       lp->tx_bd_v = dma_alloc_coherent(ndev->dev.parent,
+                                        sizeof(*lp->tx_bd_v) * TX_BD_NUM,
+                                        &lp->tx_bd_p, GFP_KERNEL);
        if (!lp->tx_bd_v)
                goto out;
 
-       lp->rx_bd_v = dma_zalloc_coherent(ndev->dev.parent,
-                                         sizeof(*lp->rx_bd_v) * RX_BD_NUM,
-                                         &lp->rx_bd_p, GFP_KERNEL);
+       lp->rx_bd_v = dma_alloc_coherent(ndev->dev.parent,
+                                        sizeof(*lp->rx_bd_v) * RX_BD_NUM,
+                                        &lp->rx_bd_p, GFP_KERNEL);
        if (!lp->rx_bd_v)
                goto out;
 
index 12a1460..0789d8a 100644 (file)
@@ -199,15 +199,15 @@ static int axienet_dma_bd_init(struct net_device *ndev)
        lp->rx_bd_ci = 0;
 
        /* Allocate the Tx and Rx buffer descriptors. */
-       lp->tx_bd_v = dma_zalloc_coherent(ndev->dev.parent,
-                                         sizeof(*lp->tx_bd_v) * TX_BD_NUM,
-                                         &lp->tx_bd_p, GFP_KERNEL);
+       lp->tx_bd_v = dma_alloc_coherent(ndev->dev.parent,
+                                        sizeof(*lp->tx_bd_v) * TX_BD_NUM,
+                                        &lp->tx_bd_p, GFP_KERNEL);
        if (!lp->tx_bd_v)
                goto out;
 
-       lp->rx_bd_v = dma_zalloc_coherent(ndev->dev.parent,
-                                         sizeof(*lp->rx_bd_v) * RX_BD_NUM,
-                                         &lp->rx_bd_p, GFP_KERNEL);
+       lp->rx_bd_v = dma_alloc_coherent(ndev->dev.parent,
+                                        sizeof(*lp->rx_bd_v) * RX_BD_NUM,
+                                        &lp->rx_bd_p, GFP_KERNEL);
        if (!lp->rx_bd_v)
                goto out;
 
index 61fceee..38ac8ef 100644 (file)
@@ -1139,9 +1139,9 @@ static int dfx_driver_init(struct net_device *dev, const char *print_name,
 #endif
                                        sizeof(PI_CONSUMER_BLOCK) +
                                        (PI_ALIGN_K_DESC_BLK - 1);
-       bp->kmalloced = top_v = dma_zalloc_coherent(bp->bus_dev, alloc_size,
-                                                   &bp->kmalloced_dma,
-                                                   GFP_ATOMIC);
+       bp->kmalloced = top_v = dma_alloc_coherent(bp->bus_dev, alloc_size,
+                                                  &bp->kmalloced_dma,
+                                                  GFP_ATOMIC);
        if (top_v == NULL)
                return DFX_K_FAILURE;
 
index 72433f3..5d661f6 100644 (file)
@@ -409,10 +409,10 @@ static  int skfp_driver_init(struct net_device *dev)
        if (bp->SharedMemSize > 0) {
                bp->SharedMemSize += 16;        // for descriptor alignment
 
-               bp->SharedMemAddr = dma_zalloc_coherent(&bp->pdev.dev,
-                                                       bp->SharedMemSize,
-                                                       &bp->SharedMemDMA,
-                                                       GFP_ATOMIC);
+               bp->SharedMemAddr = dma_alloc_coherent(&bp->pdev.dev,
+                                                      bp->SharedMemSize,
+                                                      &bp->SharedMemDMA,
+                                                      GFP_ATOMIC);
                if (!bp->SharedMemAddr) {
                        printk("could not allocate mem for ");
                        printk("hardware module: %ld byte\n",
index e454dfc..89984fc 100644 (file)
@@ -535,8 +535,8 @@ vmxnet3_tq_create(struct vmxnet3_tx_queue *tq,
        }
 
        sz = tq->tx_ring.size * sizeof(tq->buf_info[0]);
-       tq->buf_info = dma_zalloc_coherent(&adapter->pdev->dev, sz,
-                                          &tq->buf_info_pa, GFP_KERNEL);
+       tq->buf_info = dma_alloc_coherent(&adapter->pdev->dev, sz,
+                                         &tq->buf_info_pa, GFP_KERNEL);
        if (!tq->buf_info)
                goto err;
 
@@ -1815,8 +1815,8 @@ vmxnet3_rq_create(struct vmxnet3_rx_queue *rq, struct vmxnet3_adapter *adapter)
 
        sz = sizeof(struct vmxnet3_rx_buf_info) * (rq->rx_ring[0].size +
                                                   rq->rx_ring[1].size);
-       bi = dma_zalloc_coherent(&adapter->pdev->dev, sz, &rq->buf_info_pa,
-                                GFP_KERNEL);
+       bi = dma_alloc_coherent(&adapter->pdev->dev, sz, &rq->buf_info_pa,
+                               GFP_KERNEL);
        if (!bi)
                goto err;
 
index 839fa77..be64854 100644 (file)
@@ -279,10 +279,9 @@ static int uhdlc_init(struct ucc_hdlc_private *priv)
        iowrite16be(DEFAULT_HDLC_ADDR, &priv->ucc_pram->haddr4);
 
        /* Get BD buffer */
-       bd_buffer = dma_zalloc_coherent(priv->dev,
-                                       (RX_BD_RING_LEN + TX_BD_RING_LEN) *
-                                       MAX_RX_BUF_LENGTH,
-                                       &bd_dma_addr, GFP_KERNEL);
+       bd_buffer = dma_alloc_coherent(priv->dev,
+                                      (RX_BD_RING_LEN + TX_BD_RING_LEN) * MAX_RX_BUF_LENGTH,
+                                      &bd_dma_addr, GFP_KERNEL);
 
        if (!bd_buffer) {
                dev_err(priv->dev, "Could not allocate buffer descriptors\n");
index f6d3ecb..2a5668b 100644 (file)
@@ -1553,10 +1553,9 @@ ath10k_ce_alloc_dest_ring(struct ath10k *ar, unsigned int ce_id,
         * coherent DMA are unsupported
         */
        dest_ring->base_addr_owner_space_unaligned =
-               dma_zalloc_coherent(ar->dev,
-                                   (nentries * sizeof(struct ce_desc) +
-                                    CE_DESC_RING_ALIGN),
-                                   &base_addr, GFP_KERNEL);
+               dma_alloc_coherent(ar->dev,
+                                  (nentries * sizeof(struct ce_desc) + CE_DESC_RING_ALIGN),
+                                  &base_addr, GFP_KERNEL);
        if (!dest_ring->base_addr_owner_space_unaligned) {
                kfree(dest_ring);
                return ERR_PTR(-ENOMEM);
index e49b367..4975849 100644 (file)
@@ -5169,10 +5169,10 @@ static int ath10k_add_interface(struct ieee80211_hw *hw,
        if (vif->type == NL80211_IFTYPE_ADHOC ||
            vif->type == NL80211_IFTYPE_MESH_POINT ||
            vif->type == NL80211_IFTYPE_AP) {
-               arvif->beacon_buf = dma_zalloc_coherent(ar->dev,
-                                                       IEEE80211_MAX_FRAME_LEN,
-                                                       &arvif->beacon_paddr,
-                                                       GFP_ATOMIC);
+               arvif->beacon_buf = dma_alloc_coherent(ar->dev,
+                                                      IEEE80211_MAX_FRAME_LEN,
+                                                      &arvif->beacon_paddr,
+                                                      GFP_ATOMIC);
                if (!arvif->beacon_buf) {
                        ret = -ENOMEM;
                        ath10k_warn(ar, "failed to allocate beacon buffer: %d\n",
index 01b4edb..39e0b1c 100644 (file)
@@ -936,8 +936,7 @@ static int ath10k_pci_diag_read_mem(struct ath10k *ar, u32 address, void *data,
         */
        alloc_nbytes = min_t(unsigned int, nbytes, DIAG_TRANSFER_LIMIT);
 
-       data_buf = (unsigned char *)dma_zalloc_coherent(ar->dev,
-                                                      alloc_nbytes,
+       data_buf = (unsigned char *)dma_alloc_coherent(ar->dev, alloc_nbytes,
                                                       &ce_data_base,
                                                       GFP_ATOMIC);
 
index ba83740..8e236d1 100644 (file)
@@ -5193,7 +5193,7 @@ static int ath10k_wmi_alloc_chunk(struct ath10k *ar, u32 req_id,
        void *vaddr;
 
        pool_size = num_units * round_up(unit_len, 4);
-       vaddr = dma_zalloc_coherent(ar->dev, pool_size, &paddr, GFP_KERNEL);
+       vaddr = dma_alloc_coherent(ar->dev, pool_size, &paddr, GFP_KERNEL);
 
        if (!vaddr)
                return -ENOMEM;
index 5ab3e31..bab30f7 100644 (file)
@@ -174,9 +174,8 @@ static int wcn36xx_dxe_init_descs(struct device *dev, struct wcn36xx_dxe_ch *wcn
        int i;
 
        size = wcn_ch->desc_num * sizeof(struct wcn36xx_dxe_desc);
-       wcn_ch->cpu_addr = dma_zalloc_coherent(dev, size,
-                                              &wcn_ch->dma_addr,
-                                              GFP_KERNEL);
+       wcn_ch->cpu_addr = dma_alloc_coherent(dev, size, &wcn_ch->dma_addr,
+                                             GFP_KERNEL);
        if (!wcn_ch->cpu_addr)
                return -ENOMEM;
 
@@ -627,9 +626,9 @@ int wcn36xx_dxe_allocate_mem_pools(struct wcn36xx *wcn)
                16 - (WCN36XX_BD_CHUNK_SIZE % 8);
 
        s = wcn->mgmt_mem_pool.chunk_size * WCN36XX_DXE_CH_DESC_NUMB_TX_H;
-       cpu_addr = dma_zalloc_coherent(wcn->dev, s,
-                                      &wcn->mgmt_mem_pool.phy_addr,
-                                      GFP_KERNEL);
+       cpu_addr = dma_alloc_coherent(wcn->dev, s,
+                                     &wcn->mgmt_mem_pool.phy_addr,
+                                     GFP_KERNEL);
        if (!cpu_addr)
                goto out_err;
 
@@ -642,9 +641,9 @@ int wcn36xx_dxe_allocate_mem_pools(struct wcn36xx *wcn)
                16 - (WCN36XX_BD_CHUNK_SIZE % 8);
 
        s = wcn->data_mem_pool.chunk_size * WCN36XX_DXE_CH_DESC_NUMB_TX_L;
-       cpu_addr = dma_zalloc_coherent(wcn->dev, s,
-                                      &wcn->data_mem_pool.phy_addr,
-                                      GFP_KERNEL);
+       cpu_addr = dma_alloc_coherent(wcn->dev, s,
+                                     &wcn->data_mem_pool.phy_addr,
+                                     GFP_KERNEL);
        if (!cpu_addr)
                goto out_err;
 
index 05a8348..3380aae 100644 (file)
@@ -99,7 +99,7 @@ static int wil_sring_alloc(struct wil6210_priv *wil,
        /* Status messages are allocated and initialized to 0. This is necessary
         * since DR bit should be initialized to 0.
         */
-       sring->va = dma_zalloc_coherent(dev, sz, &sring->pa, GFP_KERNEL);
+       sring->va = dma_alloc_coherent(dev, sz, &sring->pa, GFP_KERNEL);
        if (!sring->va)
                return -ENOMEM;
 
@@ -381,15 +381,15 @@ static int wil_ring_alloc_desc_ring(struct wil6210_priv *wil,
        if (!ring->ctx)
                goto err;
 
-       ring->va = dma_zalloc_coherent(dev, sz, &ring->pa, GFP_KERNEL);
+       ring->va = dma_alloc_coherent(dev, sz, &ring->pa, GFP_KERNEL);
        if (!ring->va)
                goto err_free_ctx;
 
        if (ring->is_rx) {
                sz = sizeof(*ring->edma_rx_swtail.va);
                ring->edma_rx_swtail.va =
-                       dma_zalloc_coherent(dev, sz, &ring->edma_rx_swtail.pa,
-                                           GFP_KERNEL);
+                       dma_alloc_coherent(dev, sz, &ring->edma_rx_swtail.pa,
+                                          GFP_KERNEL);
                if (!ring->edma_rx_swtail.va)
                        goto err_free_va;
        }
index dfc4c34..b34e519 100644 (file)
@@ -431,9 +431,9 @@ static int alloc_ringmemory(struct b43_dmaring *ring)
        u16 ring_mem_size = (ring->type == B43_DMA_64BIT) ?
                                B43_DMA64_RINGMEMSIZE : B43_DMA32_RINGMEMSIZE;
 
-       ring->descbase = dma_zalloc_coherent(ring->dev->dev->dma_dev,
-                                            ring_mem_size, &(ring->dmabase),
-                                            GFP_KERNEL);
+       ring->descbase = dma_alloc_coherent(ring->dev->dev->dma_dev,
+                                           ring_mem_size, &(ring->dmabase),
+                                           GFP_KERNEL);
        if (!ring->descbase)
                return -ENOMEM;
 
index 1b1da7d..2ce1537 100644 (file)
@@ -331,9 +331,9 @@ void free_descriptor_buffer(struct b43legacy_dmaring *ring,
 static int alloc_ringmemory(struct b43legacy_dmaring *ring)
 {
        /* GFP flags must match the flags in free_ringmemory()! */
-       ring->descbase = dma_zalloc_coherent(ring->dev->dev->dma_dev,
-                                            B43legacy_DMA_RINGMEMSIZE,
-                                            &(ring->dmabase), GFP_KERNEL);
+       ring->descbase = dma_alloc_coherent(ring->dev->dev->dma_dev,
+                                           B43legacy_DMA_RINGMEMSIZE,
+                                           &(ring->dmabase), GFP_KERNEL);
        if (!ring->descbase)
                return -ENOMEM;
 
index 16d7dda..0f69b3f 100644 (file)
@@ -1281,10 +1281,10 @@ static int brcmf_pcie_init_scratchbuffers(struct brcmf_pciedev_info *devinfo)
        u32 addr;
 
        devinfo->shared.scratch =
-               dma_zalloc_coherent(&devinfo->pdev->dev,
-                                       BRCMF_DMA_D2H_SCRATCH_BUF_LEN,
-                                       &devinfo->shared.scratch_dmahandle,
-                                       GFP_KERNEL);
+               dma_alloc_coherent(&devinfo->pdev->dev,
+                                  BRCMF_DMA_D2H_SCRATCH_BUF_LEN,
+                                  &devinfo->shared.scratch_dmahandle,
+                                  GFP_KERNEL);
        if (!devinfo->shared.scratch)
                goto fail;
 
@@ -1298,10 +1298,10 @@ static int brcmf_pcie_init_scratchbuffers(struct brcmf_pciedev_info *devinfo)
        brcmf_pcie_write_tcm32(devinfo, addr, BRCMF_DMA_D2H_SCRATCH_BUF_LEN);
 
        devinfo->shared.ringupd =
-               dma_zalloc_coherent(&devinfo->pdev->dev,
-                                       BRCMF_DMA_D2H_RINGUPD_BUF_LEN,
-                                       &devinfo->shared.ringupd_dmahandle,
-                                       GFP_KERNEL);
+               dma_alloc_coherent(&devinfo->pdev->dev,
+                                  BRCMF_DMA_D2H_RINGUPD_BUF_LEN,
+                                  &devinfo->shared.ringupd_dmahandle,
+                                  GFP_KERNEL);
        if (!devinfo->shared.ringupd)
                goto fail;
 
index e965cc5..9e850c2 100644 (file)
@@ -711,30 +711,24 @@ static int iwl_pcie_alloc_rxq_dma(struct iwl_trans *trans,
         * Allocate the circular buffer of Read Buffer Descriptors
         * (RBDs)
         */
-       rxq->bd = dma_zalloc_coherent(dev,
-                                     free_size * rxq->queue_size,
-                                     &rxq->bd_dma, GFP_KERNEL);
+       rxq->bd = dma_alloc_coherent(dev, free_size * rxq->queue_size,
+                                    &rxq->bd_dma, GFP_KERNEL);
        if (!rxq->bd)
                goto err;
 
        if (trans->cfg->mq_rx_supported) {
-               rxq->used_bd = dma_zalloc_coherent(dev,
-                                                  (use_rx_td ?
-                                                  sizeof(*rxq->cd) :
-                                                  sizeof(__le32)) *
-                                                  rxq->queue_size,
-                                                  &rxq->used_bd_dma,
-                                                  GFP_KERNEL);
+               rxq->used_bd = dma_alloc_coherent(dev,
+                                                 (use_rx_td ? sizeof(*rxq->cd) : sizeof(__le32)) * rxq->queue_size,
+                                                 &rxq->used_bd_dma,
+                                                 GFP_KERNEL);
                if (!rxq->used_bd)
                        goto err;
        }
 
        /* Allocate the driver's pointer to receive buffer status */
-       rxq->rb_stts = dma_zalloc_coherent(dev, use_rx_td ?
-                                          sizeof(__le16) :
-                                          sizeof(struct iwl_rb_status),
-                                          &rxq->rb_stts_dma,
-                                          GFP_KERNEL);
+       rxq->rb_stts = dma_alloc_coherent(dev,
+                                         use_rx_td ? sizeof(__le16) : sizeof(struct iwl_rb_status),
+                                         &rxq->rb_stts_dma, GFP_KERNEL);
        if (!rxq->rb_stts)
                goto err;
 
@@ -742,16 +736,14 @@ static int iwl_pcie_alloc_rxq_dma(struct iwl_trans *trans,
                return 0;
 
        /* Allocate the driver's pointer to TR tail */
-       rxq->tr_tail = dma_zalloc_coherent(dev, sizeof(__le16),
-                                          &rxq->tr_tail_dma,
-                                          GFP_KERNEL);
+       rxq->tr_tail = dma_alloc_coherent(dev, sizeof(__le16),
+                                         &rxq->tr_tail_dma, GFP_KERNEL);
        if (!rxq->tr_tail)
                goto err;
 
        /* Allocate the driver's pointer to CR tail */
-       rxq->cr_tail = dma_zalloc_coherent(dev, sizeof(__le16),
-                                          &rxq->cr_tail_dma,
-                                          GFP_KERNEL);
+       rxq->cr_tail = dma_alloc_coherent(dev, sizeof(__le16),
+                                         &rxq->cr_tail_dma, GFP_KERNEL);
        if (!rxq->cr_tail)
                goto err;
        /*
@@ -1947,9 +1939,8 @@ int iwl_pcie_alloc_ict(struct iwl_trans *trans)
        struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
 
        trans_pcie->ict_tbl =
-               dma_zalloc_coherent(trans->dev, ICT_SIZE,
-                                  &trans_pcie->ict_tbl_dma,
-                                  GFP_KERNEL);
+               dma_alloc_coherent(trans->dev, ICT_SIZE,
+                                  &trans_pcie->ict_tbl_dma, GFP_KERNEL);
        if (!trans_pcie->ict_tbl)
                return -ENOMEM;
 
index 528cb04..4956a54 100644 (file)
@@ -119,9 +119,9 @@ static int rt2x00mmio_alloc_queue_dma(struct rt2x00_dev *rt2x00dev,
        /*
         * Allocate DMA memory for descriptor and buffer.
         */
-       addr = dma_zalloc_coherent(rt2x00dev->dev,
-                                  queue->limit * queue->desc_size, &dma,
-                                  GFP_KERNEL);
+       addr = dma_alloc_coherent(rt2x00dev->dev,
+                                 queue->limit * queue->desc_size, &dma,
+                                 GFP_KERNEL);
        if (!addr)
                return -ENOMEM;
 
index 5ee5f40..f1eaa3c 100644 (file)
@@ -1339,10 +1339,10 @@ static int switchtec_ntb_init_shared_mw(struct switchtec_ntb *sndev)
        int rc;
 
        sndev->nr_rsvd_luts++;
-       sndev->self_shared = dma_zalloc_coherent(&sndev->stdev->pdev->dev,
-                                                LUT_SIZE,
-                                                &sndev->self_shared_dma,
-                                                GFP_KERNEL);
+       sndev->self_shared = dma_alloc_coherent(&sndev->stdev->pdev->dev,
+                                               LUT_SIZE,
+                                               &sndev->self_shared_dma,
+                                               GFP_KERNEL);
        if (!sndev->self_shared) {
                dev_err(&sndev->stdev->dev,
                        "unable to allocate memory for shared mw\n");
index 08f2c92..150e497 100644 (file)
@@ -2173,18 +2173,20 @@ static void nvme_init_subnqn(struct nvme_subsystem *subsys, struct nvme_ctrl *ct
        size_t nqnlen;
        int off;
 
-       nqnlen = strnlen(id->subnqn, NVMF_NQN_SIZE);
-       if (nqnlen > 0 && nqnlen < NVMF_NQN_SIZE) {
-               strlcpy(subsys->subnqn, id->subnqn, NVMF_NQN_SIZE);
-               return;
-       }
+       if(!(ctrl->quirks & NVME_QUIRK_IGNORE_DEV_SUBNQN)) {
+               nqnlen = strnlen(id->subnqn, NVMF_NQN_SIZE);
+               if (nqnlen > 0 && nqnlen < NVMF_NQN_SIZE) {
+                       strlcpy(subsys->subnqn, id->subnqn, NVMF_NQN_SIZE);
+                       return;
+               }
 
-       if (ctrl->vs >= NVME_VS(1, 2, 1))
-               dev_warn(ctrl->device, "missing or invalid SUBNQN field.\n");
+               if (ctrl->vs >= NVME_VS(1, 2, 1))
+                       dev_warn(ctrl->device, "missing or invalid SUBNQN field.\n");
+       }
 
        /* Generate a "fake" NQN per Figure 254 in NVMe 1.3 + ECN 001 */
        off = snprintf(subsys->subnqn, NVMF_NQN_SIZE,
-                       "nqn.2014.08.org.nvmexpress:%4x%4x",
+                       "nqn.2014.08.org.nvmexpress:%04x%04x",
                        le16_to_cpu(id->vid), le16_to_cpu(id->ssvid));
        memcpy(subsys->subnqn + off, id->sn, sizeof(id->sn));
        off += sizeof(id->sn);
@@ -2500,7 +2502,6 @@ int nvme_init_identify(struct nvme_ctrl *ctrl)
        ctrl->oaes = le32_to_cpu(id->oaes);
        atomic_set(&ctrl->abort_limit, id->acl + 1);
        ctrl->vwc = id->vwc;
-       ctrl->cntlid = le16_to_cpup(&id->cntlid);
        if (id->mdts)
                max_hw_sectors = 1 << (id->mdts + page_shift - 9);
        else
index b2ab213..3eb908c 100644 (file)
@@ -874,6 +874,8 @@ static int nvmf_parse_options(struct nvmf_ctrl_options *opts,
        if (opts->discovery_nqn) {
                opts->kato = 0;
                opts->nr_io_queues = 0;
+               opts->nr_write_queues = 0;
+               opts->nr_poll_queues = 0;
                opts->duplicate_connect = true;
        }
        if (ctrl_loss_tmo < 0)
index 183ec17..df4b3a6 100644 (file)
@@ -570,6 +570,7 @@ int nvme_mpath_init(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id)
        return 0;
 out_free_ana_log_buf:
        kfree(ctrl->ana_log_buf);
+       ctrl->ana_log_buf = NULL;
 out:
        return error;
 }
@@ -577,5 +578,6 @@ out:
 void nvme_mpath_uninit(struct nvme_ctrl *ctrl)
 {
        kfree(ctrl->ana_log_buf);
+       ctrl->ana_log_buf = NULL;
 }
 
index 2b36ac9..ab961bd 100644 (file)
@@ -90,6 +90,11 @@ enum nvme_quirks {
         * Set MEDIUM priority on SQ creation
         */
        NVME_QUIRK_MEDIUM_PRIO_SQ               = (1 << 7),
+
+       /*
+        * Ignore device provided subnqn.
+        */
+       NVME_QUIRK_IGNORE_DEV_SUBNQN            = (1 << 8),
 };
 
 /*
index 5a0bf6a..deb1a66 100644 (file)
@@ -95,6 +95,7 @@ struct nvme_dev;
 struct nvme_queue;
 
 static void nvme_dev_disable(struct nvme_dev *dev, bool shutdown);
+static bool __nvme_disable_io_queues(struct nvme_dev *dev, u8 opcode);
 
 /*
  * Represents an NVM Express device.  Each nvme_dev is a PCI function.
@@ -1019,9 +1020,11 @@ static void nvme_complete_cqes(struct nvme_queue *nvmeq, u16 start, u16 end)
 
 static inline void nvme_update_cq_head(struct nvme_queue *nvmeq)
 {
-       if (++nvmeq->cq_head == nvmeq->q_depth) {
+       if (nvmeq->cq_head == nvmeq->q_depth - 1) {
                nvmeq->cq_head = 0;
                nvmeq->cq_phase = !nvmeq->cq_phase;
+       } else {
+               nvmeq->cq_head++;
        }
 }
 
@@ -1420,6 +1423,14 @@ static int nvme_suspend_queue(struct nvme_queue *nvmeq)
        return 0;
 }
 
+static void nvme_suspend_io_queues(struct nvme_dev *dev)
+{
+       int i;
+
+       for (i = dev->ctrl.queue_count - 1; i > 0; i--)
+               nvme_suspend_queue(&dev->queues[i]);
+}
+
 static void nvme_disable_admin_queue(struct nvme_dev *dev, bool shutdown)
 {
        struct nvme_queue *nvmeq = &dev->queues[0];
@@ -1485,8 +1496,8 @@ static int nvme_alloc_queue(struct nvme_dev *dev, int qid, int depth)
        if (dev->ctrl.queue_count > qid)
                return 0;
 
-       nvmeq->cqes = dma_zalloc_coherent(dev->dev, CQ_SIZE(depth),
-                                         &nvmeq->cq_dma_addr, GFP_KERNEL);
+       nvmeq->cqes = dma_alloc_coherent(dev->dev, CQ_SIZE(depth),
+                                        &nvmeq->cq_dma_addr, GFP_KERNEL);
        if (!nvmeq->cqes)
                goto free_nvmeq;
 
@@ -1885,8 +1896,9 @@ static void nvme_free_host_mem(struct nvme_dev *dev)
                struct nvme_host_mem_buf_desc *desc = &dev->host_mem_descs[i];
                size_t size = le32_to_cpu(desc->size) * dev->ctrl.page_size;
 
-               dma_free_coherent(dev->dev, size, dev->host_mem_desc_bufs[i],
-                               le64_to_cpu(desc->addr));
+               dma_free_attrs(dev->dev, size, dev->host_mem_desc_bufs[i],
+                              le64_to_cpu(desc->addr),
+                              DMA_ATTR_NO_KERNEL_MAPPING | DMA_ATTR_NO_WARN);
        }
 
        kfree(dev->host_mem_desc_bufs);
@@ -1915,8 +1927,8 @@ static int __nvme_alloc_host_mem(struct nvme_dev *dev, u64 preferred,
        if (dev->ctrl.hmmaxd && dev->ctrl.hmmaxd < max_entries)
                max_entries = dev->ctrl.hmmaxd;
 
-       descs = dma_zalloc_coherent(dev->dev, max_entries * sizeof(*descs),
-                       &descs_dma, GFP_KERNEL);
+       descs = dma_alloc_coherent(dev->dev, max_entries * sizeof(*descs),
+                                  &descs_dma, GFP_KERNEL);
        if (!descs)
                goto out;
 
@@ -1952,8 +1964,9 @@ out_free_bufs:
        while (--i >= 0) {
                size_t size = le32_to_cpu(descs[i].size) * dev->ctrl.page_size;
 
-               dma_free_coherent(dev->dev, size, bufs[i],
-                               le64_to_cpu(descs[i].addr));
+               dma_free_attrs(dev->dev, size, bufs[i],
+                              le64_to_cpu(descs[i].addr),
+                              DMA_ATTR_NO_KERNEL_MAPPING | DMA_ATTR_NO_WARN);
        }
 
        kfree(bufs);
@@ -2132,6 +2145,12 @@ static int nvme_setup_irqs(struct nvme_dev *dev, unsigned int nr_io_queues)
        return result;
 }
 
+static void nvme_disable_io_queues(struct nvme_dev *dev)
+{
+       if (__nvme_disable_io_queues(dev, nvme_admin_delete_sq))
+               __nvme_disable_io_queues(dev, nvme_admin_delete_cq);
+}
+
 static int nvme_setup_io_queues(struct nvme_dev *dev)
 {
        struct nvme_queue *adminq = &dev->queues[0];
@@ -2168,6 +2187,7 @@ static int nvme_setup_io_queues(struct nvme_dev *dev)
        } while (1);
        adminq->q_db = dev->dbs;
 
+ retry:
        /* Deregister the admin queue's interrupt */
        pci_free_irq(pdev, 0, adminq);
 
@@ -2185,25 +2205,34 @@ static int nvme_setup_io_queues(struct nvme_dev *dev)
        result = max(result - 1, 1);
        dev->max_qid = result + dev->io_queues[HCTX_TYPE_POLL];
 
-       dev_info(dev->ctrl.device, "%d/%d/%d default/read/poll queues\n",
-                                       dev->io_queues[HCTX_TYPE_DEFAULT],
-                                       dev->io_queues[HCTX_TYPE_READ],
-                                       dev->io_queues[HCTX_TYPE_POLL]);
-
        /*
         * Should investigate if there's a performance win from allocating
         * more queues than interrupt vectors; it might allow the submission
         * path to scale better, even if the receive path is limited by the
         * number of interrupts.
         */
-
        result = queue_request_irq(adminq);
        if (result) {
                adminq->cq_vector = -1;
                return result;
        }
        set_bit(NVMEQ_ENABLED, &adminq->flags);
-       return nvme_create_io_queues(dev);
+
+       result = nvme_create_io_queues(dev);
+       if (result || dev->online_queues < 2)
+               return result;
+
+       if (dev->online_queues - 1 < dev->max_qid) {
+               nr_io_queues = dev->online_queues - 1;
+               nvme_disable_io_queues(dev);
+               nvme_suspend_io_queues(dev);
+               goto retry;
+       }
+       dev_info(dev->ctrl.device, "%d/%d/%d default/read/poll queues\n",
+                                       dev->io_queues[HCTX_TYPE_DEFAULT],
+                                       dev->io_queues[HCTX_TYPE_READ],
+                                       dev->io_queues[HCTX_TYPE_POLL]);
+       return 0;
 }
 
 static void nvme_del_queue_end(struct request *req, blk_status_t error)
@@ -2248,7 +2277,7 @@ static int nvme_delete_queue(struct nvme_queue *nvmeq, u8 opcode)
        return 0;
 }
 
-static bool nvme_disable_io_queues(struct nvme_dev *dev, u8 opcode)
+static bool __nvme_disable_io_queues(struct nvme_dev *dev, u8 opcode)
 {
        int nr_queues = dev->online_queues - 1, sent = 0;
        unsigned long timeout;
@@ -2294,7 +2323,6 @@ static int nvme_dev_add(struct nvme_dev *dev)
                dev->tagset.nr_maps = 2; /* default + read */
                if (dev->io_queues[HCTX_TYPE_POLL])
                        dev->tagset.nr_maps++;
-               dev->tagset.nr_maps = HCTX_MAX_TYPES;
                dev->tagset.timeout = NVME_IO_TIMEOUT;
                dev->tagset.numa_node = dev_to_node(dev->dev);
                dev->tagset.queue_depth =
@@ -2410,7 +2438,6 @@ static void nvme_pci_disable(struct nvme_dev *dev)
 
 static void nvme_dev_disable(struct nvme_dev *dev, bool shutdown)
 {
-       int i;
        bool dead = true;
        struct pci_dev *pdev = to_pci_dev(dev->dev);
 
@@ -2437,13 +2464,11 @@ static void nvme_dev_disable(struct nvme_dev *dev, bool shutdown)
        nvme_stop_queues(&dev->ctrl);
 
        if (!dead && dev->ctrl.queue_count > 0) {
-               if (nvme_disable_io_queues(dev, nvme_admin_delete_sq))
-                       nvme_disable_io_queues(dev, nvme_admin_delete_cq);
+               nvme_disable_io_queues(dev);
                nvme_disable_admin_queue(dev, shutdown);
        }
-       for (i = dev->ctrl.queue_count - 1; i >= 0; i--)
-               nvme_suspend_queue(&dev->queues[i]);
-
+       nvme_suspend_io_queues(dev);
+       nvme_suspend_queue(&dev->queues[0]);
        nvme_pci_disable(dev);
 
        blk_mq_tagset_busy_iter(&dev->tagset, nvme_cancel_request, &dev->ctrl);
@@ -2946,6 +2971,8 @@ static const struct pci_device_id nvme_id_table[] = {
        { PCI_VDEVICE(INTEL, 0xf1a5),   /* Intel 600P/P3100 */
                .driver_data = NVME_QUIRK_NO_DEEPEST_PS |
                                NVME_QUIRK_MEDIUM_PRIO_SQ },
+       { PCI_VDEVICE(INTEL, 0xf1a6),   /* Intel 760p/Pro 7600p */
+               .driver_data = NVME_QUIRK_IGNORE_DEV_SUBNQN, },
        { PCI_VDEVICE(INTEL, 0x5845),   /* Qemu emulated controller */
                .driver_data = NVME_QUIRK_IDENTIFY_CNS, },
        { PCI_DEVICE(0x1bb1, 0x0100),   /* Seagate Nytro Flash Storage */
index de17491..265a054 100644 (file)
@@ -1565,8 +1565,7 @@ static void nvme_tcp_destroy_io_queues(struct nvme_ctrl *ctrl, bool remove)
 {
        nvme_tcp_stop_io_queues(ctrl);
        if (remove) {
-               if (ctrl->ops->flags & NVME_F_FABRICS)
-                       blk_cleanup_queue(ctrl->connect_q);
+               blk_cleanup_queue(ctrl->connect_q);
                blk_mq_free_tag_set(ctrl->tagset);
        }
        nvme_tcp_free_io_queues(ctrl);
@@ -1587,12 +1586,10 @@ static int nvme_tcp_configure_io_queues(struct nvme_ctrl *ctrl, bool new)
                        goto out_free_io_queues;
                }
 
-               if (ctrl->ops->flags & NVME_F_FABRICS) {
-                       ctrl->connect_q = blk_mq_init_queue(ctrl->tagset);
-                       if (IS_ERR(ctrl->connect_q)) {
-                               ret = PTR_ERR(ctrl->connect_q);
-                               goto out_free_tag_set;
-                       }
+               ctrl->connect_q = blk_mq_init_queue(ctrl->tagset);
+               if (IS_ERR(ctrl->connect_q)) {
+                       ret = PTR_ERR(ctrl->connect_q);
+                       goto out_free_tag_set;
                }
        } else {
                blk_mq_update_nr_hw_queues(ctrl->tagset,
@@ -1606,7 +1603,7 @@ static int nvme_tcp_configure_io_queues(struct nvme_ctrl *ctrl, bool new)
        return 0;
 
 out_cleanup_connect_q:
-       if (new && (ctrl->ops->flags & NVME_F_FABRICS))
+       if (new)
                blk_cleanup_queue(ctrl->connect_q);
 out_free_tag_set:
        if (new)
@@ -1620,7 +1617,6 @@ static void nvme_tcp_destroy_admin_queue(struct nvme_ctrl *ctrl, bool remove)
 {
        nvme_tcp_stop_queue(ctrl, 0);
        if (remove) {
-               free_opal_dev(ctrl->opal_dev);
                blk_cleanup_queue(ctrl->admin_q);
                blk_mq_free_tag_set(ctrl->admin_tagset);
        }
index e5507ad..18f1639 100644 (file)
@@ -988,11 +988,9 @@ void _opp_free(struct dev_pm_opp *opp)
        kfree(opp);
 }
 
-static void _opp_kref_release(struct kref *kref)
+static void _opp_kref_release(struct dev_pm_opp *opp,
+                             struct opp_table *opp_table)
 {
-       struct dev_pm_opp *opp = container_of(kref, struct dev_pm_opp, kref);
-       struct opp_table *opp_table = opp->opp_table;
-
        /*
         * Notify the changes in the availability of the operable
         * frequency/voltage list.
@@ -1002,7 +1000,22 @@ static void _opp_kref_release(struct kref *kref)
        opp_debug_remove_one(opp);
        list_del(&opp->node);
        kfree(opp);
+}
 
+static void _opp_kref_release_unlocked(struct kref *kref)
+{
+       struct dev_pm_opp *opp = container_of(kref, struct dev_pm_opp, kref);
+       struct opp_table *opp_table = opp->opp_table;
+
+       _opp_kref_release(opp, opp_table);
+}
+
+static void _opp_kref_release_locked(struct kref *kref)
+{
+       struct dev_pm_opp *opp = container_of(kref, struct dev_pm_opp, kref);
+       struct opp_table *opp_table = opp->opp_table;
+
+       _opp_kref_release(opp, opp_table);
        mutex_unlock(&opp_table->lock);
 }
 
@@ -1013,10 +1026,16 @@ void dev_pm_opp_get(struct dev_pm_opp *opp)
 
 void dev_pm_opp_put(struct dev_pm_opp *opp)
 {
-       kref_put_mutex(&opp->kref, _opp_kref_release, &opp->opp_table->lock);
+       kref_put_mutex(&opp->kref, _opp_kref_release_locked,
+                      &opp->opp_table->lock);
 }
 EXPORT_SYMBOL_GPL(dev_pm_opp_put);
 
+static void dev_pm_opp_put_unlocked(struct dev_pm_opp *opp)
+{
+       kref_put(&opp->kref, _opp_kref_release_unlocked);
+}
+
 /**
  * dev_pm_opp_remove()  - Remove an OPP from OPP table
  * @dev:       device for which we do this operation
@@ -1060,6 +1079,40 @@ void dev_pm_opp_remove(struct device *dev, unsigned long freq)
 }
 EXPORT_SYMBOL_GPL(dev_pm_opp_remove);
 
+/**
+ * dev_pm_opp_remove_all_dynamic() - Remove all dynamically created OPPs
+ * @dev:       device for which we do this operation
+ *
+ * This function removes all dynamically created OPPs from the opp table.
+ */
+void dev_pm_opp_remove_all_dynamic(struct device *dev)
+{
+       struct opp_table *opp_table;
+       struct dev_pm_opp *opp, *temp;
+       int count = 0;
+
+       opp_table = _find_opp_table(dev);
+       if (IS_ERR(opp_table))
+               return;
+
+       mutex_lock(&opp_table->lock);
+       list_for_each_entry_safe(opp, temp, &opp_table->opp_list, node) {
+               if (opp->dynamic) {
+                       dev_pm_opp_put_unlocked(opp);
+                       count++;
+               }
+       }
+       mutex_unlock(&opp_table->lock);
+
+       /* Drop the references taken by dev_pm_opp_add() */
+       while (count--)
+               dev_pm_opp_put_opp_table(opp_table);
+
+       /* Drop the reference taken by _find_opp_table() */
+       dev_pm_opp_put_opp_table(opp_table);
+}
+EXPORT_SYMBOL_GPL(dev_pm_opp_remove_all_dynamic);
+
 struct dev_pm_opp *_opp_allocate(struct opp_table *table)
 {
        struct dev_pm_opp *opp;
index 241ebe0..e35e9ea 100644 (file)
@@ -8,6 +8,7 @@
 
 #include <linux/clk.h>
 #include <linux/delay.h>
+#include <linux/gpio/consumer.h>
 #include <linux/of_device.h>
 #include <linux/of_gpio.h>
 #include <linux/pci.h>
index 9deb569..cb3401a 100644 (file)
@@ -602,9 +602,9 @@ int iproc_msi_init(struct iproc_pcie *pcie, struct device_node *node)
        }
 
        /* Reserve memory for event queue and make sure memories are zeroed */
-       msi->eq_cpu = dma_zalloc_coherent(pcie->dev,
-                                         msi->nr_eq_region * EQ_MEM_REGION_SIZE,
-                                         &msi->eq_dma, GFP_KERNEL);
+       msi->eq_cpu = dma_alloc_coherent(pcie->dev,
+                                        msi->nr_eq_region * EQ_MEM_REGION_SIZE,
+                                        &msi->eq_dma, GFP_KERNEL);
        if (!msi->eq_cpu) {
                ret = -ENOMEM;
                goto free_irqs;
index 6c5536d..e22766c 100644 (file)
@@ -1373,10 +1373,10 @@ static int switchtec_init_pci(struct switchtec_dev *stdev,
        if (ioread32(&stdev->mmio_mrpc->dma_ver) == 0)
                return 0;
 
-       stdev->dma_mrpc = dma_zalloc_coherent(&stdev->pdev->dev,
-                                             sizeof(*stdev->dma_mrpc),
-                                             &stdev->dma_mrpc_dma_addr,
-                                             GFP_KERNEL);
+       stdev->dma_mrpc = dma_alloc_coherent(&stdev->pdev->dev,
+                                            sizeof(*stdev->dma_mrpc),
+                                            &stdev->dma_mrpc_dma_addr,
+                                            GFP_KERNEL);
        if (stdev->dma_mrpc == NULL)
                return -ENOMEM;
 
index a91fc67..d70ba9b 100644 (file)
@@ -32,7 +32,7 @@
 
 /* register 0x01 */
 #define REF_FREF_SEL_25                BIT(0)
-#define PHY_MODE_SATA          (0x0 << 5)
+#define PHY_BERLIN_MODE_SATA   (0x0 << 5)
 
 /* register 0x02 */
 #define USE_MAX_PLL_RATE       BIT(12)
@@ -102,7 +102,8 @@ static int phy_berlin_sata_power_on(struct phy *phy)
 
        /* set PHY mode and ref freq to 25 MHz */
        phy_berlin_sata_reg_setbits(ctrl_reg, priv->phy_base, 0x01,
-                                   0x00ff, REF_FREF_SEL_25 | PHY_MODE_SATA);
+                                   0x00ff,
+                                   REF_FREF_SEL_25 | PHY_BERLIN_MODE_SATA);
 
        /* set PHY up to 6 Gbps */
        phy_berlin_sata_reg_setbits(ctrl_reg, priv->phy_base, 0x25,
index bb65585..b64c56c 100644 (file)
@@ -1382,9 +1382,9 @@ static int tsi721_doorbell_init(struct tsi721_device *priv)
        INIT_WORK(&priv->idb_work, tsi721_db_dpc);
 
        /* Allocate buffer for inbound doorbells queue */
-       priv->idb_base = dma_zalloc_coherent(&priv->pdev->dev,
-                               IDB_QSIZE * TSI721_IDB_ENTRY_SIZE,
-                               &priv->idb_dma, GFP_KERNEL);
+       priv->idb_base = dma_alloc_coherent(&priv->pdev->dev,
+                                           IDB_QSIZE * TSI721_IDB_ENTRY_SIZE,
+                                           &priv->idb_dma, GFP_KERNEL);
        if (!priv->idb_base)
                return -ENOMEM;
 
@@ -1447,9 +1447,9 @@ static int tsi721_bdma_maint_init(struct tsi721_device *priv)
        regs = priv->regs + TSI721_DMAC_BASE(TSI721_DMACH_MAINT);
 
        /* Allocate space for DMA descriptors */
-       bd_ptr = dma_zalloc_coherent(&priv->pdev->dev,
-                                       bd_num * sizeof(struct tsi721_dma_desc),
-                                       &bd_phys, GFP_KERNEL);
+       bd_ptr = dma_alloc_coherent(&priv->pdev->dev,
+                                   bd_num * sizeof(struct tsi721_dma_desc),
+                                   &bd_phys, GFP_KERNEL);
        if (!bd_ptr)
                return -ENOMEM;
 
@@ -1464,7 +1464,7 @@ static int tsi721_bdma_maint_init(struct tsi721_device *priv)
        sts_size = (bd_num >= TSI721_DMA_MINSTSSZ) ?
                                        bd_num : TSI721_DMA_MINSTSSZ;
        sts_size = roundup_pow_of_two(sts_size);
-       sts_ptr = dma_zalloc_coherent(&priv->pdev->dev,
+       sts_ptr = dma_alloc_coherent(&priv->pdev->dev,
                                     sts_size * sizeof(struct tsi721_dma_sts),
                                     &sts_phys, GFP_KERNEL);
        if (!sts_ptr) {
@@ -1939,10 +1939,10 @@ static int tsi721_open_outb_mbox(struct rio_mport *mport, void *dev_id,
 
        /* Outbound message descriptor status FIFO allocation */
        priv->omsg_ring[mbox].sts_size = roundup_pow_of_two(entries + 1);
-       priv->omsg_ring[mbox].sts_base = dma_zalloc_coherent(&priv->pdev->dev,
-                       priv->omsg_ring[mbox].sts_size *
-                                               sizeof(struct tsi721_dma_sts),
-                       &priv->omsg_ring[mbox].sts_phys, GFP_KERNEL);
+       priv->omsg_ring[mbox].sts_base = dma_alloc_coherent(&priv->pdev->dev,
+                                                           priv->omsg_ring[mbox].sts_size * sizeof(struct tsi721_dma_sts),
+                                                           &priv->omsg_ring[mbox].sts_phys,
+                                                           GFP_KERNEL);
        if (priv->omsg_ring[mbox].sts_base == NULL) {
                tsi_debug(OMSG, &priv->pdev->dev,
                        "ENOMEM for OB_MSG_%d status FIFO", mbox);
index 006ea5a..7f5d443 100644 (file)
@@ -90,9 +90,9 @@ static int tsi721_bdma_ch_init(struct tsi721_bdma_chan *bdma_chan, int bd_num)
         * Allocate space for DMA descriptors
         * (add an extra element for link descriptor)
         */
-       bd_ptr = dma_zalloc_coherent(dev,
-                               (bd_num + 1) * sizeof(struct tsi721_dma_desc),
-                               &bd_phys, GFP_ATOMIC);
+       bd_ptr = dma_alloc_coherent(dev,
+                                   (bd_num + 1) * sizeof(struct tsi721_dma_desc),
+                                   &bd_phys, GFP_ATOMIC);
        if (!bd_ptr)
                return -ENOMEM;
 
@@ -108,7 +108,7 @@ static int tsi721_bdma_ch_init(struct tsi721_bdma_chan *bdma_chan, int bd_num)
        sts_size = ((bd_num + 1) >= TSI721_DMA_MINSTSSZ) ?
                                        (bd_num + 1) : TSI721_DMA_MINSTSSZ;
        sts_size = roundup_pow_of_two(sts_size);
-       sts_ptr = dma_zalloc_coherent(dev,
+       sts_ptr = dma_alloc_coherent(dev,
                                     sts_size * sizeof(struct tsi721_dma_sts),
                                     &sts_phys, GFP_ATOMIC);
        if (!sts_ptr) {
index c21da9f..2e01bd8 100644 (file)
@@ -109,7 +109,7 @@ config RESET_QCOM_PDC
 
 config RESET_SIMPLE
        bool "Simple Reset Controller Driver" if COMPILE_TEST
-       default ARCH_SOCFPGA || ARCH_STM32 || ARCH_STRATIX10 || ARCH_SUNXI || ARCH_ZX || ARCH_ASPEED
+       default ARCH_STM32 || ARCH_STRATIX10 || ARCH_SUNXI || ARCH_ZX || ARCH_ASPEED
        help
          This enables a simple reset controller driver for reset lines that
          that can be asserted and deasserted by toggling bits in a contiguous,
@@ -128,6 +128,14 @@ config RESET_STM32MP157
        help
          This enables the RCC reset controller driver for STM32 MPUs.
 
+config RESET_SOCFPGA
+       bool "SoCFPGA Reset Driver" if COMPILE_TEST && !ARCH_SOCFPGA
+       default ARCH_SOCFPGA
+       select RESET_SIMPLE
+       help
+         This enables the reset driver for the SoCFPGA ARMv7 platforms. This
+         driver gets initialized early during platform init calls.
+
 config RESET_SUNXI
        bool "Allwinner SoCs Reset Driver" if COMPILE_TEST && !ARCH_SUNXI
        default ARCH_SUNXI
@@ -163,15 +171,15 @@ config RESET_UNIPHIER
          Say Y if you want to control reset signals provided by System Control
          block, Media I/O block, Peripheral Block.
 
-config RESET_UNIPHIER_USB3
-       tristate "USB3 reset driver for UniPhier SoCs"
+config RESET_UNIPHIER_GLUE
+       tristate "Reset driver in glue layer for UniPhier SoCs"
        depends on (ARCH_UNIPHIER || COMPILE_TEST) && OF
        default ARCH_UNIPHIER
        select RESET_SIMPLE
        help
-         Support for the USB3 core reset on UniPhier SoCs.
-         Say Y if you want to control reset signals provided by
-         USB3 glue layer.
+         Support for peripheral core reset included in its own glue layer
+         on UniPhier SoCs. Say Y if you want to control reset signals
+         provided by the glue layer.
 
 config RESET_ZYNQ
        bool "ZYNQ Reset Driver" if COMPILE_TEST
index d08e8b9..dc7874d 100644 (file)
@@ -19,10 +19,11 @@ obj-$(CONFIG_RESET_QCOM_AOSS) += reset-qcom-aoss.o
 obj-$(CONFIG_RESET_QCOM_PDC) += reset-qcom-pdc.o
 obj-$(CONFIG_RESET_SIMPLE) += reset-simple.o
 obj-$(CONFIG_RESET_STM32MP157) += reset-stm32mp1.o
+obj-$(CONFIG_RESET_SOCFPGA) += reset-socfpga.o
 obj-$(CONFIG_RESET_SUNXI) += reset-sunxi.o
 obj-$(CONFIG_RESET_TI_SCI) += reset-ti-sci.o
 obj-$(CONFIG_RESET_TI_SYSCON) += reset-ti-syscon.o
 obj-$(CONFIG_RESET_UNIPHIER) += reset-uniphier.o
-obj-$(CONFIG_RESET_UNIPHIER_USB3) += reset-uniphier-usb3.o
+obj-$(CONFIG_RESET_UNIPHIER_GLUE) += reset-uniphier-glue.o
 obj-$(CONFIG_RESET_ZYNQ) += reset-zynq.o
 
index d1887c0..9582efb 100644 (file)
@@ -795,3 +795,45 @@ devm_reset_control_array_get(struct device *dev, bool shared, bool optional)
        return rstc;
 }
 EXPORT_SYMBOL_GPL(devm_reset_control_array_get);
+
+static int reset_control_get_count_from_lookup(struct device *dev)
+{
+       const struct reset_control_lookup *lookup;
+       const char *dev_id;
+       int count = 0;
+
+       if (!dev)
+               return -EINVAL;
+
+       dev_id = dev_name(dev);
+       mutex_lock(&reset_lookup_mutex);
+
+       list_for_each_entry(lookup, &reset_lookup_list, list) {
+               if (!strcmp(lookup->dev_id, dev_id))
+                       count++;
+       }
+
+       mutex_unlock(&reset_lookup_mutex);
+
+       if (count == 0)
+               count = -ENOENT;
+
+       return count;
+}
+
+/**
+ * reset_control_get_count - Count number of resets available with a device
+ *
+ * @dev: device for which to return the number of resets
+ *
+ * Returns positive reset count on success, or error number on failure and
+ * on count being zero.
+ */
+int reset_control_get_count(struct device *dev)
+{
+       if (dev->of_node)
+               return of_reset_control_get_count(dev->of_node);
+
+       return reset_control_get_count_from_lookup(dev);
+}
+EXPORT_SYMBOL_GPL(reset_control_get_count);
index 8bce391..4c7b864 100644 (file)
@@ -86,6 +86,7 @@ static int hsdk_reset_reset(struct reset_controller_dev *rcdev,
 
 static const struct reset_control_ops hsdk_reset_ops = {
        .reset  = hsdk_reset_reset,
+       .deassert = hsdk_reset_reset,
 };
 
 static int hsdk_reset_probe(struct platform_device *pdev)
index a91107f..77fbba3 100644 (file)
@@ -109,7 +109,7 @@ struct reset_simple_devdata {
 #define SOCFPGA_NR_BANKS       8
 
 static const struct reset_simple_devdata reset_simple_socfpga = {
-       .reg_offset = 0x10,
+       .reg_offset = 0x20,
        .nr_resets = SOCFPGA_NR_BANKS * 32,
        .status_active_low = true,
 };
@@ -120,7 +120,8 @@ static const struct reset_simple_devdata reset_simple_active_low = {
 };
 
 static const struct of_device_id reset_simple_dt_ids[] = {
-       { .compatible = "altr,rst-mgr", .data = &reset_simple_socfpga },
+       { .compatible = "altr,stratix10-rst-mgr",
+               .data = &reset_simple_socfpga },
        { .compatible = "st,stm32-rcc", },
        { .compatible = "allwinner,sun6i-a31-clock-reset",
                .data = &reset_simple_active_low },
@@ -166,14 +167,6 @@ static int reset_simple_probe(struct platform_device *pdev)
                data->status_active_low = devdata->status_active_low;
        }
 
-       if (of_device_is_compatible(dev->of_node, "altr,rst-mgr") &&
-           of_property_read_u32(dev->of_node, "altr,modrst-offset",
-                                &reg_offset)) {
-               dev_warn(dev,
-                        "missing altr,modrst-offset property, assuming 0x%x!\n",
-                        reg_offset);
-       }
-
        data->membase += reg_offset;
 
        return devm_reset_controller_register(dev, &data->rcdev);
diff --git a/drivers/reset/reset-socfpga.c b/drivers/reset/reset-socfpga.c
new file mode 100644 (file)
index 0000000..318cfc5
--- /dev/null
@@ -0,0 +1,88 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2018, Intel Corporation
+ * Copied from reset-sunxi.c
+ */
+
+#include <linux/err.h>
+#include <linux/io.h>
+#include <linux/init.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/platform_device.h>
+#include <linux/reset-controller.h>
+#include <linux/slab.h>
+#include <linux/spinlock.h>
+#include <linux/types.h>
+
+#include "reset-simple.h"
+
+#define SOCFPGA_NR_BANKS       8
+void __init socfpga_reset_init(void);
+
+static int a10_reset_init(struct device_node *np)
+{
+       struct reset_simple_data *data;
+       struct resource res;
+       resource_size_t size;
+       int ret;
+       u32 reg_offset = 0x10;
+
+       data = kzalloc(sizeof(*data), GFP_KERNEL);
+       if (!data)
+               return -ENOMEM;
+
+       ret = of_address_to_resource(np, 0, &res);
+       if (ret)
+               goto err_alloc;
+
+       size = resource_size(&res);
+       if (!request_mem_region(res.start, size, np->name)) {
+               ret = -EBUSY;
+               goto err_alloc;
+       }
+
+       data->membase = ioremap(res.start, size);
+       if (!data->membase) {
+               ret = -ENOMEM;
+               goto err_alloc;
+       }
+
+       if (of_property_read_u32(np, "altr,modrst-offset", &reg_offset))
+               pr_warn("missing altr,modrst-offset property, assuming 0x10\n");
+       data->membase += reg_offset;
+
+       spin_lock_init(&data->lock);
+
+       data->rcdev.owner = THIS_MODULE;
+       data->rcdev.nr_resets = SOCFPGA_NR_BANKS * 32;
+       data->rcdev.ops = &reset_simple_ops;
+       data->rcdev.of_node = np;
+       data->status_active_low = true;
+
+       return reset_controller_register(&data->rcdev);
+
+err_alloc:
+       kfree(data);
+       return ret;
+};
+
+/*
+ * These are the reset controller we need to initialize early on in
+ * our system, before we can even think of using a regular device
+ * driver for it.
+ * The controllers that we can register through the regular device
+ * model are handled by the simple reset driver directly.
+ */
+static const struct of_device_id socfpga_early_reset_dt_ids[] __initconst = {
+       { .compatible = "altr,rst-mgr", },
+       { /* sentinel */ },
+};
+
+void __init socfpga_reset_init(void)
+{
+       struct device_node *np;
+
+       for_each_matching_node(np, socfpga_early_reset_dt_ids)
+               a10_reset_init(np);
+}
similarity index 73%
rename from drivers/reset/reset-uniphier-usb3.c
rename to drivers/reset/reset-uniphier-glue.c
index ffa1b19..a45923f 100644 (file)
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
 //
-// reset-uniphier-usb3.c - USB3 reset driver for UniPhier
+// reset-uniphier-glue.c - Glue layer reset driver for UniPhier
 // Copyright 2018 Socionext Inc.
 // Author: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
 
 #define MAX_CLKS       2
 #define MAX_RSTS       2
 
-struct uniphier_usb3_reset_soc_data {
+struct uniphier_glue_reset_soc_data {
        int nclks;
        const char * const *clock_names;
        int nrsts;
        const char * const *reset_names;
 };
 
-struct uniphier_usb3_reset_priv {
+struct uniphier_glue_reset_priv {
        struct clk_bulk_data clk[MAX_CLKS];
        struct reset_control *rst[MAX_RSTS];
        struct reset_simple_data rdata;
-       const struct uniphier_usb3_reset_soc_data *data;
+       const struct uniphier_glue_reset_soc_data *data;
 };
 
-static int uniphier_usb3_reset_probe(struct platform_device *pdev)
+static int uniphier_glue_reset_probe(struct platform_device *pdev)
 {
        struct device *dev = &pdev->dev;
-       struct uniphier_usb3_reset_priv *priv;
+       struct uniphier_glue_reset_priv *priv;
        struct resource *res;
        resource_size_t size;
        const char *name;
@@ -100,9 +100,9 @@ out_rst_assert:
        return ret;
 }
 
-static int uniphier_usb3_reset_remove(struct platform_device *pdev)
+static int uniphier_glue_reset_remove(struct platform_device *pdev)
 {
-       struct uniphier_usb3_reset_priv *priv = platform_get_drvdata(pdev);
+       struct uniphier_glue_reset_priv *priv = platform_get_drvdata(pdev);
        int i;
 
        for (i = 0; i < priv->data->nrsts; i++)
@@ -117,7 +117,7 @@ static const char * const uniphier_pro4_clock_reset_names[] = {
        "gio", "link",
 };
 
-static const struct uniphier_usb3_reset_soc_data uniphier_pro4_data = {
+static const struct uniphier_glue_reset_soc_data uniphier_pro4_data = {
        .nclks = ARRAY_SIZE(uniphier_pro4_clock_reset_names),
        .clock_names = uniphier_pro4_clock_reset_names,
        .nrsts = ARRAY_SIZE(uniphier_pro4_clock_reset_names),
@@ -128,14 +128,14 @@ static const char * const uniphier_pxs2_clock_reset_names[] = {
        "link",
 };
 
-static const struct uniphier_usb3_reset_soc_data uniphier_pxs2_data = {
+static const struct uniphier_glue_reset_soc_data uniphier_pxs2_data = {
        .nclks = ARRAY_SIZE(uniphier_pxs2_clock_reset_names),
        .clock_names = uniphier_pxs2_clock_reset_names,
        .nrsts = ARRAY_SIZE(uniphier_pxs2_clock_reset_names),
        .reset_names = uniphier_pxs2_clock_reset_names,
 };
 
-static const struct of_device_id uniphier_usb3_reset_match[] = {
+static const struct of_device_id uniphier_glue_reset_match[] = {
        {
                .compatible = "socionext,uniphier-pro4-usb3-reset",
                .data = &uniphier_pro4_data,
@@ -152,20 +152,32 @@ static const struct of_device_id uniphier_usb3_reset_match[] = {
                .compatible = "socionext,uniphier-pxs3-usb3-reset",
                .data = &uniphier_pxs2_data,
        },
+       {
+               .compatible = "socionext,uniphier-pro4-ahci-reset",
+               .data = &uniphier_pro4_data,
+       },
+       {
+               .compatible = "socionext,uniphier-pxs2-ahci-reset",
+               .data = &uniphier_pxs2_data,
+       },
+       {
+               .compatible = "socionext,uniphier-pxs3-ahci-reset",
+               .data = &uniphier_pxs2_data,
+       },
        { /* Sentinel */ }
 };
-MODULE_DEVICE_TABLE(of, uniphier_usb3_reset_match);
+MODULE_DEVICE_TABLE(of, uniphier_glue_reset_match);
 
-static struct platform_driver uniphier_usb3_reset_driver = {
-       .probe = uniphier_usb3_reset_probe,
-       .remove = uniphier_usb3_reset_remove,
+static struct platform_driver uniphier_glue_reset_driver = {
+       .probe = uniphier_glue_reset_probe,
+       .remove = uniphier_glue_reset_remove,
        .driver = {
-               .name = "uniphier-usb3-reset",
-               .of_match_table = uniphier_usb3_reset_match,
+               .name = "uniphier-glue-reset",
+               .of_match_table = uniphier_glue_reset_match,
        },
 };
-module_platform_driver(uniphier_usb3_reset_driver);
+module_platform_driver(uniphier_glue_reset_driver);
 
 MODULE_AUTHOR("Kunihiko Hayashi <hayashi.kunihiko@socionext.com>");
-MODULE_DESCRIPTION("UniPhier USB3 Reset Driver");
+MODULE_DESCRIPTION("UniPhier Glue layer reset driver");
 MODULE_LICENSE("GPL");
index dcbf5c8..ed8e58f 100644 (file)
@@ -89,8 +89,8 @@ static int register_sba(struct ism_dev *ism)
        dma_addr_t dma_handle;
        struct ism_sba *sba;
 
-       sba = dma_zalloc_coherent(&ism->pdev->dev, PAGE_SIZE,
-                                 &dma_handle, GFP_KERNEL);
+       sba = dma_alloc_coherent(&ism->pdev->dev, PAGE_SIZE, &dma_handle,
+                                GFP_KERNEL);
        if (!sba)
                return -ENOMEM;
 
@@ -116,8 +116,8 @@ static int register_ieq(struct ism_dev *ism)
        dma_addr_t dma_handle;
        struct ism_eq *ieq;
 
-       ieq = dma_zalloc_coherent(&ism->pdev->dev, PAGE_SIZE,
-                                 &dma_handle, GFP_KERNEL);
+       ieq = dma_alloc_coherent(&ism->pdev->dev, PAGE_SIZE, &dma_handle,
+                                GFP_KERNEL);
        if (!ieq)
                return -ENOMEM;
 
@@ -234,10 +234,9 @@ static int ism_alloc_dmb(struct ism_dev *ism, struct smcd_dmb *dmb)
            test_and_set_bit(dmb->sba_idx, ism->sba_bitmap))
                return -EINVAL;
 
-       dmb->cpu_addr = dma_zalloc_coherent(&ism->pdev->dev, dmb->dmb_len,
-                                           &dmb->dma_addr, GFP_KERNEL |
-                                           __GFP_NOWARN | __GFP_NOMEMALLOC |
-                                           __GFP_COMP | __GFP_NORETRY);
+       dmb->cpu_addr = dma_alloc_coherent(&ism->pdev->dev, dmb->dmb_len,
+                                          &dmb->dma_addr,
+                                          GFP_KERNEL | __GFP_NOWARN | __GFP_NOMEMALLOC | __GFP_COMP | __GFP_NORETRY);
        if (!dmb->cpu_addr)
                clear_bit(dmb->sba_idx, ism->sba_bitmap);
 
index e8f5f7c..cd09610 100644 (file)
@@ -646,8 +646,9 @@ static int twl_allocate_memory(TW_Device_Extension *tw_dev, int size, int which)
        unsigned long *cpu_addr;
        int retval = 1;
 
-       cpu_addr = dma_zalloc_coherent(&tw_dev->tw_pci_dev->dev,
-                       size * TW_Q_LENGTH, &dma_handle, GFP_KERNEL);
+       cpu_addr = dma_alloc_coherent(&tw_dev->tw_pci_dev->dev,
+                                     size * TW_Q_LENGTH, &dma_handle,
+                                     GFP_KERNEL);
        if (!cpu_addr) {
                TW_PRINTK(tw_dev->host, TW_DRIVER, 0x5, "Memory allocation failed");
                goto out;
index ff53fd0..66c5143 100644 (file)
@@ -1123,8 +1123,8 @@ static int inia100_probe_one(struct pci_dev *pdev,
 
        /* Get total memory needed for SCB */
        sz = ORC_MAXQUEUE * sizeof(struct orc_scb);
-       host->scb_virt = dma_zalloc_coherent(&pdev->dev, sz, &host->scb_phys,
-                                            GFP_KERNEL);
+       host->scb_virt = dma_alloc_coherent(&pdev->dev, sz, &host->scb_phys,
+                                           GFP_KERNEL);
        if (!host->scb_virt) {
                printk("inia100: SCB memory allocation error\n");
                goto out_host_put;
@@ -1132,8 +1132,8 @@ static int inia100_probe_one(struct pci_dev *pdev,
 
        /* Get total memory needed for ESCB */
        sz = ORC_MAXQUEUE * sizeof(struct orc_extended_scb);
-       host->escb_virt = dma_zalloc_coherent(&pdev->dev, sz, &host->escb_phys,
-                                             GFP_KERNEL);
+       host->escb_virt = dma_alloc_coherent(&pdev->dev, sz, &host->escb_phys,
+                                            GFP_KERNEL);
        if (!host->escb_virt) {
                printk("inia100: ESCB memory allocation error\n");
                goto out_free_scb_array;
index 0f6751b..57c6fa3 100644 (file)
@@ -587,8 +587,10 @@ static bool arcmsr_alloc_io_queue(struct AdapterControlBlock *acb)
        case ACB_ADAPTER_TYPE_B: {
                struct MessageUnit_B *reg;
                acb->roundup_ccbsize = roundup(sizeof(struct MessageUnit_B), 32);
-               dma_coherent = dma_zalloc_coherent(&pdev->dev, acb->roundup_ccbsize,
-                       &dma_coherent_handle, GFP_KERNEL);
+               dma_coherent = dma_alloc_coherent(&pdev->dev,
+                                                 acb->roundup_ccbsize,
+                                                 &dma_coherent_handle,
+                                                 GFP_KERNEL);
                if (!dma_coherent) {
                        pr_notice("arcmsr%d: DMA allocation failed\n", acb->host->host_no);
                        return false;
@@ -617,8 +619,10 @@ static bool arcmsr_alloc_io_queue(struct AdapterControlBlock *acb)
                struct MessageUnit_D *reg;
 
                acb->roundup_ccbsize = roundup(sizeof(struct MessageUnit_D), 32);
-               dma_coherent = dma_zalloc_coherent(&pdev->dev, acb->roundup_ccbsize,
-                       &dma_coherent_handle, GFP_KERNEL);
+               dma_coherent = dma_alloc_coherent(&pdev->dev,
+                                                 acb->roundup_ccbsize,
+                                                 &dma_coherent_handle,
+                                                 GFP_KERNEL);
                if (!dma_coherent) {
                        pr_notice("arcmsr%d: DMA allocation failed\n", acb->host->host_no);
                        return false;
@@ -659,8 +663,10 @@ static bool arcmsr_alloc_io_queue(struct AdapterControlBlock *acb)
                uint32_t completeQ_size;
                completeQ_size = sizeof(struct deliver_completeQ) * ARCMSR_MAX_HBE_DONEQUEUE + 128;
                acb->roundup_ccbsize = roundup(completeQ_size, 32);
-               dma_coherent = dma_zalloc_coherent(&pdev->dev, acb->roundup_ccbsize,
-                       &dma_coherent_handle, GFP_KERNEL);
+               dma_coherent = dma_alloc_coherent(&pdev->dev,
+                                                 acb->roundup_ccbsize,
+                                                 &dma_coherent_handle,
+                                                 GFP_KERNEL);
                if (!dma_coherent){
                        pr_notice("arcmsr%d: DMA allocation failed\n", acb->host->host_no);
                        return false;
index 39f3820..74e2600 100644 (file)
@@ -3321,8 +3321,8 @@ static int be_queue_alloc(struct beiscsi_hba *phba, struct be_queue_info *q,
        q->len = len;
        q->entry_size = entry_size;
        mem->size = len * entry_size;
-       mem->va = dma_zalloc_coherent(&phba->pcidev->dev, mem->size, &mem->dma,
-                       GFP_KERNEL);
+       mem->va = dma_alloc_coherent(&phba->pcidev->dev, mem->size, &mem->dma,
+                                    GFP_KERNEL);
        if (!mem->va)
                return -ENOMEM;
        return 0;
index ca7b7bb..d4febaa 100644 (file)
@@ -293,8 +293,8 @@ static int beiscsi_prep_nemb_cmd(struct beiscsi_hba *phba,
                                 struct be_dma_mem *cmd,
                                 u8 subsystem, u8 opcode, u32 size)
 {
-       cmd->va = dma_zalloc_coherent(&phba->ctrl.pdev->dev, size, &cmd->dma,
-                       GFP_KERNEL);
+       cmd->va = dma_alloc_coherent(&phba->ctrl.pdev->dev, size, &cmd->dma,
+                                    GFP_KERNEL);
        if (!cmd->va) {
                beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
                            "BG_%d : Failed to allocate memory for if info\n");
@@ -1510,10 +1510,9 @@ int beiscsi_mgmt_invalidate_icds(struct beiscsi_hba *phba,
                return -EINVAL;
 
        nonemb_cmd.size = sizeof(union be_invldt_cmds_params);
-       nonemb_cmd.va = dma_zalloc_coherent(&phba->ctrl.pdev->dev,
-                                             nonemb_cmd.size,
-                                             &nonemb_cmd.dma,
-                                             GFP_KERNEL);
+       nonemb_cmd.va = dma_alloc_coherent(&phba->ctrl.pdev->dev,
+                                          nonemb_cmd.size, &nonemb_cmd.dma,
+                                          GFP_KERNEL);
        if (!nonemb_cmd.va) {
                beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_EH,
                            "BM_%d : invldt_cmds_params alloc failed\n");
index 5d163ca..d8e6d74 100644 (file)
@@ -3264,9 +3264,9 @@ bfad_fcxp_map_sg(struct bfad_s *bfad, void *payload_kbuf,
        /* Allocate dma coherent memory */
        buf_info = buf_base;
        buf_info->size = payload_len;
-       buf_info->virt = dma_zalloc_coherent(&bfad->pcidev->dev,
-                                            buf_info->size, &buf_info->phys,
-                                            GFP_KERNEL);
+       buf_info->virt = dma_alloc_coherent(&bfad->pcidev->dev,
+                                           buf_info->size, &buf_info->phys,
+                                           GFP_KERNEL);
        if (!buf_info->virt)
                goto out_free_mem;
 
index e8ae4d6..039328d 100644 (file)
@@ -1857,10 +1857,10 @@ int bnx2fc_setup_task_ctx(struct bnx2fc_hba *hba)
         * entries. Hence the limit with one page is 8192 task context
         * entries.
         */
-       hba->task_ctx_bd_tbl = dma_zalloc_coherent(&hba->pcidev->dev,
-                                                  PAGE_SIZE,
-                                                  &hba->task_ctx_bd_dma,
-                                                  GFP_KERNEL);
+       hba->task_ctx_bd_tbl = dma_alloc_coherent(&hba->pcidev->dev,
+                                                 PAGE_SIZE,
+                                                 &hba->task_ctx_bd_dma,
+                                                 GFP_KERNEL);
        if (!hba->task_ctx_bd_tbl) {
                printk(KERN_ERR PFX "unable to allocate task context BDT\n");
                rc = -1;
@@ -1894,10 +1894,10 @@ int bnx2fc_setup_task_ctx(struct bnx2fc_hba *hba)
        task_ctx_bdt = (struct regpair *)hba->task_ctx_bd_tbl;
        for (i = 0; i < task_ctx_arr_sz; i++) {
 
-               hba->task_ctx[i] = dma_zalloc_coherent(&hba->pcidev->dev,
-                                                      PAGE_SIZE,
-                                                      &hba->task_ctx_dma[i],
-                                                      GFP_KERNEL);
+               hba->task_ctx[i] = dma_alloc_coherent(&hba->pcidev->dev,
+                                                     PAGE_SIZE,
+                                                     &hba->task_ctx_dma[i],
+                                                     GFP_KERNEL);
                if (!hba->task_ctx[i]) {
                        printk(KERN_ERR PFX "unable to alloc task context\n");
                        rc = -1;
@@ -2031,19 +2031,19 @@ static int bnx2fc_allocate_hash_table(struct bnx2fc_hba *hba)
        }
 
        for (i = 0; i < segment_count; ++i) {
-               hba->hash_tbl_segments[i] = dma_zalloc_coherent(&hba->pcidev->dev,
-                                                               BNX2FC_HASH_TBL_CHUNK_SIZE,
-                                                               &dma_segment_array[i],
-                                                               GFP_KERNEL);
+               hba->hash_tbl_segments[i] = dma_alloc_coherent(&hba->pcidev->dev,
+                                                              BNX2FC_HASH_TBL_CHUNK_SIZE,
+                                                              &dma_segment_array[i],
+                                                              GFP_KERNEL);
                if (!hba->hash_tbl_segments[i]) {
                        printk(KERN_ERR PFX "hash segment alloc failed\n");
                        goto cleanup_dma;
                }
        }
 
-       hba->hash_tbl_pbl = dma_zalloc_coherent(&hba->pcidev->dev, PAGE_SIZE,
-                                               &hba->hash_tbl_pbl_dma,
-                                               GFP_KERNEL);
+       hba->hash_tbl_pbl = dma_alloc_coherent(&hba->pcidev->dev, PAGE_SIZE,
+                                              &hba->hash_tbl_pbl_dma,
+                                              GFP_KERNEL);
        if (!hba->hash_tbl_pbl) {
                printk(KERN_ERR PFX "hash table pbl alloc failed\n");
                goto cleanup_dma;
@@ -2104,10 +2104,9 @@ int bnx2fc_setup_fw_resc(struct bnx2fc_hba *hba)
                return -ENOMEM;
 
        mem_size = BNX2FC_NUM_MAX_SESS * sizeof(struct regpair);
-       hba->t2_hash_tbl_ptr = dma_zalloc_coherent(&hba->pcidev->dev,
-                                                  mem_size,
-                                                  &hba->t2_hash_tbl_ptr_dma,
-                                                  GFP_KERNEL);
+       hba->t2_hash_tbl_ptr = dma_alloc_coherent(&hba->pcidev->dev, mem_size,
+                                                 &hba->t2_hash_tbl_ptr_dma,
+                                                 GFP_KERNEL);
        if (!hba->t2_hash_tbl_ptr) {
                printk(KERN_ERR PFX "unable to allocate t2 hash table ptr\n");
                bnx2fc_free_fw_resc(hba);
@@ -2116,9 +2115,9 @@ int bnx2fc_setup_fw_resc(struct bnx2fc_hba *hba)
 
        mem_size = BNX2FC_NUM_MAX_SESS *
                                sizeof(struct fcoe_t2_hash_table_entry);
-       hba->t2_hash_tbl = dma_zalloc_coherent(&hba->pcidev->dev, mem_size,
-                                              &hba->t2_hash_tbl_dma,
-                                              GFP_KERNEL);
+       hba->t2_hash_tbl = dma_alloc_coherent(&hba->pcidev->dev, mem_size,
+                                             &hba->t2_hash_tbl_dma,
+                                             GFP_KERNEL);
        if (!hba->t2_hash_tbl) {
                printk(KERN_ERR PFX "unable to allocate t2 hash table\n");
                bnx2fc_free_fw_resc(hba);
@@ -2140,9 +2139,9 @@ int bnx2fc_setup_fw_resc(struct bnx2fc_hba *hba)
                return -ENOMEM;
        }
 
-       hba->stats_buffer = dma_zalloc_coherent(&hba->pcidev->dev, PAGE_SIZE,
-                                               &hba->stats_buf_dma,
-                                               GFP_KERNEL);
+       hba->stats_buffer = dma_alloc_coherent(&hba->pcidev->dev, PAGE_SIZE,
+                                              &hba->stats_buf_dma,
+                                              GFP_KERNEL);
        if (!hba->stats_buffer) {
                printk(KERN_ERR PFX "unable to alloc Stats Buffer\n");
                bnx2fc_free_fw_resc(hba);
index e3d1c7c..d735e87 100644 (file)
@@ -672,8 +672,8 @@ static int bnx2fc_alloc_session_resc(struct bnx2fc_hba *hba,
        tgt->sq_mem_size = (tgt->sq_mem_size + (CNIC_PAGE_SIZE - 1)) &
                           CNIC_PAGE_MASK;
 
-       tgt->sq = dma_zalloc_coherent(&hba->pcidev->dev, tgt->sq_mem_size,
-                                     &tgt->sq_dma, GFP_KERNEL);
+       tgt->sq = dma_alloc_coherent(&hba->pcidev->dev, tgt->sq_mem_size,
+                                    &tgt->sq_dma, GFP_KERNEL);
        if (!tgt->sq) {
                printk(KERN_ERR PFX "unable to allocate SQ memory %d\n",
                        tgt->sq_mem_size);
@@ -685,8 +685,8 @@ static int bnx2fc_alloc_session_resc(struct bnx2fc_hba *hba,
        tgt->cq_mem_size = (tgt->cq_mem_size + (CNIC_PAGE_SIZE - 1)) &
                           CNIC_PAGE_MASK;
 
-       tgt->cq = dma_zalloc_coherent(&hba->pcidev->dev, tgt->cq_mem_size,
-                                     &tgt->cq_dma, GFP_KERNEL);
+       tgt->cq = dma_alloc_coherent(&hba->pcidev->dev, tgt->cq_mem_size,
+                                    &tgt->cq_dma, GFP_KERNEL);
        if (!tgt->cq) {
                printk(KERN_ERR PFX "unable to allocate CQ memory %d\n",
                        tgt->cq_mem_size);
@@ -698,8 +698,8 @@ static int bnx2fc_alloc_session_resc(struct bnx2fc_hba *hba,
        tgt->rq_mem_size = (tgt->rq_mem_size + (CNIC_PAGE_SIZE - 1)) &
                           CNIC_PAGE_MASK;
 
-       tgt->rq = dma_zalloc_coherent(&hba->pcidev->dev, tgt->rq_mem_size,
-                                     &tgt->rq_dma, GFP_KERNEL);
+       tgt->rq = dma_alloc_coherent(&hba->pcidev->dev, tgt->rq_mem_size,
+                                    &tgt->rq_dma, GFP_KERNEL);
        if (!tgt->rq) {
                printk(KERN_ERR PFX "unable to allocate RQ memory %d\n",
                        tgt->rq_mem_size);
@@ -710,8 +710,8 @@ static int bnx2fc_alloc_session_resc(struct bnx2fc_hba *hba,
        tgt->rq_pbl_size = (tgt->rq_pbl_size + (CNIC_PAGE_SIZE - 1)) &
                           CNIC_PAGE_MASK;
 
-       tgt->rq_pbl = dma_zalloc_coherent(&hba->pcidev->dev, tgt->rq_pbl_size,
-                                         &tgt->rq_pbl_dma, GFP_KERNEL);
+       tgt->rq_pbl = dma_alloc_coherent(&hba->pcidev->dev, tgt->rq_pbl_size,
+                                        &tgt->rq_pbl_dma, GFP_KERNEL);
        if (!tgt->rq_pbl) {
                printk(KERN_ERR PFX "unable to allocate RQ PBL %d\n",
                        tgt->rq_pbl_size);
@@ -735,9 +735,9 @@ static int bnx2fc_alloc_session_resc(struct bnx2fc_hba *hba,
        tgt->xferq_mem_size = (tgt->xferq_mem_size + (CNIC_PAGE_SIZE - 1)) &
                               CNIC_PAGE_MASK;
 
-       tgt->xferq = dma_zalloc_coherent(&hba->pcidev->dev,
-                                        tgt->xferq_mem_size, &tgt->xferq_dma,
-                                        GFP_KERNEL);
+       tgt->xferq = dma_alloc_coherent(&hba->pcidev->dev,
+                                       tgt->xferq_mem_size, &tgt->xferq_dma,
+                                       GFP_KERNEL);
        if (!tgt->xferq) {
                printk(KERN_ERR PFX "unable to allocate XFERQ %d\n",
                        tgt->xferq_mem_size);
@@ -749,9 +749,9 @@ static int bnx2fc_alloc_session_resc(struct bnx2fc_hba *hba,
        tgt->confq_mem_size = (tgt->confq_mem_size + (CNIC_PAGE_SIZE - 1)) &
                               CNIC_PAGE_MASK;
 
-       tgt->confq = dma_zalloc_coherent(&hba->pcidev->dev,
-                                        tgt->confq_mem_size, &tgt->confq_dma,
-                                        GFP_KERNEL);
+       tgt->confq = dma_alloc_coherent(&hba->pcidev->dev,
+                                       tgt->confq_mem_size, &tgt->confq_dma,
+                                       GFP_KERNEL);
        if (!tgt->confq) {
                printk(KERN_ERR PFX "unable to allocate CONFQ %d\n",
                        tgt->confq_mem_size);
@@ -763,9 +763,9 @@ static int bnx2fc_alloc_session_resc(struct bnx2fc_hba *hba,
        tgt->confq_pbl_size =
                (tgt->confq_pbl_size + (CNIC_PAGE_SIZE - 1)) & CNIC_PAGE_MASK;
 
-       tgt->confq_pbl = dma_zalloc_coherent(&hba->pcidev->dev,
-                                            tgt->confq_pbl_size,
-                                            &tgt->confq_pbl_dma, GFP_KERNEL);
+       tgt->confq_pbl = dma_alloc_coherent(&hba->pcidev->dev,
+                                           tgt->confq_pbl_size,
+                                           &tgt->confq_pbl_dma, GFP_KERNEL);
        if (!tgt->confq_pbl) {
                printk(KERN_ERR PFX "unable to allocate CONFQ PBL %d\n",
                        tgt->confq_pbl_size);
@@ -787,9 +787,9 @@ static int bnx2fc_alloc_session_resc(struct bnx2fc_hba *hba,
        /* Allocate and map ConnDB */
        tgt->conn_db_mem_size = sizeof(struct fcoe_conn_db);
 
-       tgt->conn_db = dma_zalloc_coherent(&hba->pcidev->dev,
-                                          tgt->conn_db_mem_size,
-                                          &tgt->conn_db_dma, GFP_KERNEL);
+       tgt->conn_db = dma_alloc_coherent(&hba->pcidev->dev,
+                                         tgt->conn_db_mem_size,
+                                         &tgt->conn_db_dma, GFP_KERNEL);
        if (!tgt->conn_db) {
                printk(KERN_ERR PFX "unable to allocate conn_db %d\n",
                                                tgt->conn_db_mem_size);
@@ -802,8 +802,8 @@ static int bnx2fc_alloc_session_resc(struct bnx2fc_hba *hba,
        tgt->lcq_mem_size = (tgt->lcq_mem_size + (CNIC_PAGE_SIZE - 1)) &
                             CNIC_PAGE_MASK;
 
-       tgt->lcq = dma_zalloc_coherent(&hba->pcidev->dev, tgt->lcq_mem_size,
-                                      &tgt->lcq_dma, GFP_KERNEL);
+       tgt->lcq = dma_alloc_coherent(&hba->pcidev->dev, tgt->lcq_mem_size,
+                                     &tgt->lcq_dma, GFP_KERNEL);
 
        if (!tgt->lcq) {
                printk(KERN_ERR PFX "unable to allocate lcq %d\n",
index 91f5316..fae6f71 100644 (file)
@@ -1070,8 +1070,8 @@ int bnx2i_alloc_qp_resc(struct bnx2i_hba *hba, struct bnx2i_endpoint *ep)
 
        /* Allocate memory area for actual SQ element */
        ep->qp.sq_virt =
-               dma_zalloc_coherent(&hba->pcidev->dev, ep->qp.sq_mem_size,
-                                       &ep->qp.sq_phys, GFP_KERNEL);
+               dma_alloc_coherent(&hba->pcidev->dev, ep->qp.sq_mem_size,
+                                  &ep->qp.sq_phys, GFP_KERNEL);
        if (!ep->qp.sq_virt) {
                printk(KERN_ALERT "bnx2i: unable to alloc SQ BD memory %d\n",
                                  ep->qp.sq_mem_size);
@@ -1106,8 +1106,8 @@ int bnx2i_alloc_qp_resc(struct bnx2i_hba *hba, struct bnx2i_endpoint *ep)
 
        /* Allocate memory area for actual CQ element */
        ep->qp.cq_virt =
-               dma_zalloc_coherent(&hba->pcidev->dev, ep->qp.cq_mem_size,
-                                       &ep->qp.cq_phys, GFP_KERNEL);
+               dma_alloc_coherent(&hba->pcidev->dev, ep->qp.cq_mem_size,
+                                  &ep->qp.cq_phys, GFP_KERNEL);
        if (!ep->qp.cq_virt) {
                printk(KERN_ALERT "bnx2i: unable to alloc CQ BD memory %d\n",
                                  ep->qp.cq_mem_size);
index dc12933..66bbd21 100644 (file)
@@ -233,8 +233,8 @@ csio_wr_alloc_q(struct csio_hw *hw, uint32_t qsize, uint32_t wrsize,
 
        q = wrm->q_arr[free_idx];
 
-       q->vstart = dma_zalloc_coherent(&hw->pdev->dev, qsz, &q->pstart,
-                       GFP_KERNEL);
+       q->vstart = dma_alloc_coherent(&hw->pdev->dev, qsz, &q->pstart,
+                                      GFP_KERNEL);
        if (!q->vstart) {
                csio_err(hw,
                         "Failed to allocate DMA memory for "
index 8698af8..2dc564e 100644 (file)
@@ -2730,8 +2730,8 @@ lpfc_bsg_dma_page_alloc(struct lpfc_hba *phba)
        INIT_LIST_HEAD(&dmabuf->list);
 
        /* now, allocate dma buffer */
-       dmabuf->virt = dma_zalloc_coherent(&pcidev->dev, BSG_MBOX_SIZE,
-                                          &(dmabuf->phys), GFP_KERNEL);
+       dmabuf->virt = dma_alloc_coherent(&pcidev->dev, BSG_MBOX_SIZE,
+                                         &(dmabuf->phys), GFP_KERNEL);
 
        if (!dmabuf->virt) {
                kfree(dmabuf);
index c1c3681..bede11e 100644 (file)
@@ -6973,9 +6973,9 @@ lpfc_sli4_create_rpi_hdr(struct lpfc_hba *phba)
        if (!dmabuf)
                return NULL;
 
-       dmabuf->virt = dma_zalloc_coherent(&phba->pcidev->dev,
-                                          LPFC_HDR_TEMPLATE_SIZE,
-                                          &dmabuf->phys, GFP_KERNEL);
+       dmabuf->virt = dma_alloc_coherent(&phba->pcidev->dev,
+                                         LPFC_HDR_TEMPLATE_SIZE,
+                                         &dmabuf->phys, GFP_KERNEL);
        if (!dmabuf->virt) {
                rpi_hdr = NULL;
                goto err_free_dmabuf;
@@ -7397,8 +7397,8 @@ lpfc_sli_pci_mem_setup(struct lpfc_hba *phba)
        }
 
        /* Allocate memory for SLI-2 structures */
-       phba->slim2p.virt = dma_zalloc_coherent(&pdev->dev, SLI2_SLIM_SIZE,
-                                               &phba->slim2p.phys, GFP_KERNEL);
+       phba->slim2p.virt = dma_alloc_coherent(&pdev->dev, SLI2_SLIM_SIZE,
+                                              &phba->slim2p.phys, GFP_KERNEL);
        if (!phba->slim2p.virt)
                goto out_iounmap;
 
@@ -7816,8 +7816,8 @@ lpfc_create_bootstrap_mbox(struct lpfc_hba *phba)
         * plus an alignment restriction of 16 bytes.
         */
        bmbx_size = sizeof(struct lpfc_bmbx_create) + (LPFC_ALIGN_16_BYTE - 1);
-       dmabuf->virt = dma_zalloc_coherent(&phba->pcidev->dev, bmbx_size,
-                                          &dmabuf->phys, GFP_KERNEL);
+       dmabuf->virt = dma_alloc_coherent(&phba->pcidev->dev, bmbx_size,
+                                         &dmabuf->phys, GFP_KERNEL);
        if (!dmabuf->virt) {
                kfree(dmabuf);
                return -ENOMEM;
index f6a5083..4d3b943 100644 (file)
@@ -1827,9 +1827,9 @@ lpfc_sli4_config(struct lpfc_hba *phba, struct lpfcMboxq *mbox,
                 * page, this is used as a priori size of SLI4_PAGE_SIZE for
                 * the later DMA memory free.
                 */
-               viraddr = dma_zalloc_coherent(&phba->pcidev->dev,
-                                             SLI4_PAGE_SIZE, &phyaddr,
-                                             GFP_KERNEL);
+               viraddr = dma_alloc_coherent(&phba->pcidev->dev,
+                                            SLI4_PAGE_SIZE, &phyaddr,
+                                            GFP_KERNEL);
                /* In case of malloc fails, proceed with whatever we have */
                if (!viraddr)
                        break;
index 30734ca..12fd747 100644 (file)
@@ -5362,8 +5362,8 @@ lpfc_sli4_read_rev(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq,
         * mailbox command.
         */
        dma_size = *vpd_size;
-       dmabuf->virt = dma_zalloc_coherent(&phba->pcidev->dev, dma_size,
-                                          &dmabuf->phys, GFP_KERNEL);
+       dmabuf->virt = dma_alloc_coherent(&phba->pcidev->dev, dma_size,
+                                         &dmabuf->phys, GFP_KERNEL);
        if (!dmabuf->virt) {
                kfree(dmabuf);
                return -ENOMEM;
@@ -6300,10 +6300,9 @@ lpfc_sli4_ras_dma_alloc(struct lpfc_hba *phba,
                        goto free_mem;
                }
 
-               dmabuf->virt = dma_zalloc_coherent(&phba->pcidev->dev,
+               dmabuf->virt = dma_alloc_coherent(&phba->pcidev->dev,
                                                  LPFC_RAS_MAX_ENTRY_SIZE,
-                                                 &dmabuf->phys,
-                                                 GFP_KERNEL);
+                                                 &dmabuf->phys, GFP_KERNEL);
                if (!dmabuf->virt) {
                        kfree(dmabuf);
                        rc = -ENOMEM;
@@ -14613,9 +14612,9 @@ lpfc_sli4_queue_alloc(struct lpfc_hba *phba, uint32_t page_size,
                dmabuf = kzalloc(sizeof(struct lpfc_dmabuf), GFP_KERNEL);
                if (!dmabuf)
                        goto out_fail;
-               dmabuf->virt = dma_zalloc_coherent(&phba->pcidev->dev,
-                                                  hw_page_size, &dmabuf->phys,
-                                                  GFP_KERNEL);
+               dmabuf->virt = dma_alloc_coherent(&phba->pcidev->dev,
+                                                 hw_page_size, &dmabuf->phys,
+                                                 GFP_KERNEL);
                if (!dmabuf->virt) {
                        kfree(dmabuf);
                        goto out_fail;
index e836392..f112458 100644 (file)
@@ -967,9 +967,10 @@ megaraid_alloc_cmd_packets(adapter_t *adapter)
         * Allocate the common 16-byte aligned memory for the handshake
         * mailbox.
         */
-       raid_dev->una_mbox64 = dma_zalloc_coherent(&adapter->pdev->dev,
-                       sizeof(mbox64_t), &raid_dev->una_mbox64_dma,
-                       GFP_KERNEL);
+       raid_dev->una_mbox64 = dma_alloc_coherent(&adapter->pdev->dev,
+                                                 sizeof(mbox64_t),
+                                                 &raid_dev->una_mbox64_dma,
+                                                 GFP_KERNEL);
 
        if (!raid_dev->una_mbox64) {
                con_log(CL_ANN, (KERN_WARNING
@@ -995,8 +996,8 @@ megaraid_alloc_cmd_packets(adapter_t *adapter)
                        align;
 
        // Allocate memory for commands issued internally
-       adapter->ibuf = dma_zalloc_coherent(&pdev->dev, MBOX_IBUF_SIZE,
-                       &adapter->ibuf_dma_h, GFP_KERNEL);
+       adapter->ibuf = dma_alloc_coherent(&pdev->dev, MBOX_IBUF_SIZE,
+                                          &adapter->ibuf_dma_h, GFP_KERNEL);
        if (!adapter->ibuf) {
 
                con_log(CL_ANN, (KERN_WARNING
@@ -2897,8 +2898,8 @@ megaraid_mbox_product_info(adapter_t *adapter)
         * Issue an ENQUIRY3 command to find out certain adapter parameters,
         * e.g., max channels, max commands etc.
         */
-       pinfo = dma_zalloc_coherent(&adapter->pdev->dev, sizeof(mraid_pinfo_t),
-                       &pinfo_dma_h, GFP_KERNEL);
+       pinfo = dma_alloc_coherent(&adapter->pdev->dev, sizeof(mraid_pinfo_t),
+                                  &pinfo_dma_h, GFP_KERNEL);
        if (pinfo == NULL) {
                con_log(CL_ANN, (KERN_WARNING
                        "megaraid: out of memory, %s %d\n", __func__,
index f7bdd78..7eaa400 100644 (file)
@@ -2273,9 +2273,9 @@ static int megasas_get_ld_vf_affiliation_111(struct megasas_instance *instance,
                               sizeof(struct MR_LD_VF_AFFILIATION_111));
        else {
                new_affiliation_111 =
-                       dma_zalloc_coherent(&instance->pdev->dev,
-                                             sizeof(struct MR_LD_VF_AFFILIATION_111),
-                                             &new_affiliation_111_h, GFP_KERNEL);
+                       dma_alloc_coherent(&instance->pdev->dev,
+                                          sizeof(struct MR_LD_VF_AFFILIATION_111),
+                                          &new_affiliation_111_h, GFP_KERNEL);
                if (!new_affiliation_111) {
                        dev_printk(KERN_DEBUG, &instance->pdev->dev, "SR-IOV: Couldn't allocate "
                               "memory for new affiliation for scsi%d\n",
@@ -2380,10 +2380,9 @@ static int megasas_get_ld_vf_affiliation_12(struct megasas_instance *instance,
                       sizeof(struct MR_LD_VF_AFFILIATION));
        else {
                new_affiliation =
-                       dma_zalloc_coherent(&instance->pdev->dev,
-                                             (MAX_LOGICAL_DRIVES + 1) *
-                                             sizeof(struct MR_LD_VF_AFFILIATION),
-                                             &new_affiliation_h, GFP_KERNEL);
+                       dma_alloc_coherent(&instance->pdev->dev,
+                                          (MAX_LOGICAL_DRIVES + 1) * sizeof(struct MR_LD_VF_AFFILIATION),
+                                          &new_affiliation_h, GFP_KERNEL);
                if (!new_affiliation) {
                        dev_printk(KERN_DEBUG, &instance->pdev->dev, "SR-IOV: Couldn't allocate "
                               "memory for new affiliation for scsi%d\n",
@@ -2546,9 +2545,10 @@ int megasas_sriov_start_heartbeat(struct megasas_instance *instance,
 
        if (initial) {
                instance->hb_host_mem =
-                       dma_zalloc_coherent(&instance->pdev->dev,
-                                             sizeof(struct MR_CTRL_HB_HOST_MEM),
-                                             &instance->hb_host_mem_h, GFP_KERNEL);
+                       dma_alloc_coherent(&instance->pdev->dev,
+                                          sizeof(struct MR_CTRL_HB_HOST_MEM),
+                                          &instance->hb_host_mem_h,
+                                          GFP_KERNEL);
                if (!instance->hb_host_mem) {
                        dev_printk(KERN_DEBUG, &instance->pdev->dev, "SR-IOV: Couldn't allocate"
                               " memory for heartbeat host memory for scsi%d\n",
@@ -5816,9 +5816,9 @@ megasas_get_seq_num(struct megasas_instance *instance,
        }
 
        dcmd = &cmd->frame->dcmd;
-       el_info = dma_zalloc_coherent(&instance->pdev->dev,
-                       sizeof(struct megasas_evt_log_info), &el_info_h,
-                       GFP_KERNEL);
+       el_info = dma_alloc_coherent(&instance->pdev->dev,
+                                    sizeof(struct megasas_evt_log_info),
+                                    &el_info_h, GFP_KERNEL);
        if (!el_info) {
                megasas_return_cmd(instance, cmd);
                return -ENOMEM;
index 211c17c..a9a25f0 100644 (file)
@@ -689,8 +689,9 @@ megasas_alloc_rdpq_fusion(struct megasas_instance *instance)
        array_size = sizeof(struct MPI2_IOC_INIT_RDPQ_ARRAY_ENTRY) *
                     MAX_MSIX_QUEUES_FUSION;
 
-       fusion->rdpq_virt = dma_zalloc_coherent(&instance->pdev->dev,
-                       array_size, &fusion->rdpq_phys, GFP_KERNEL);
+       fusion->rdpq_virt = dma_alloc_coherent(&instance->pdev->dev,
+                                              array_size, &fusion->rdpq_phys,
+                                              GFP_KERNEL);
        if (!fusion->rdpq_virt) {
                dev_err(&instance->pdev->dev,
                        "Failed from %s %d\n",  __func__, __LINE__);
index f3e182e..c9dc774 100644 (file)
@@ -1915,8 +1915,9 @@ static int mesh_probe(struct macio_dev *mdev, const struct of_device_id *match)
        /* We use the PCI APIs for now until the generic one gets fixed
         * enough or until we get some macio-specific versions
         */
-       dma_cmd_space = dma_zalloc_coherent(&macio_get_pci_dev(mdev)->dev,
-                       ms->dma_cmd_size, &dma_cmd_bus, GFP_KERNEL);
+       dma_cmd_space = dma_alloc_coherent(&macio_get_pci_dev(mdev)->dev,
+                                          ms->dma_cmd_size, &dma_cmd_bus,
+                                          GFP_KERNEL);
        if (dma_cmd_space == NULL) {
                printk(KERN_ERR "mesh: can't allocate DMA table\n");
                goto out_unmap;
index dbe753f..36f6420 100644 (file)
@@ -143,8 +143,9 @@ static struct mvumi_res *mvumi_alloc_mem_resource(struct mvumi_hba *mhba,
 
        case RESOURCE_UNCACHED_MEMORY:
                size = round_up(size, 8);
-               res->virt_addr = dma_zalloc_coherent(&mhba->pdev->dev, size,
-                               &res->bus_addr, GFP_KERNEL);
+               res->virt_addr = dma_alloc_coherent(&mhba->pdev->dev, size,
+                                                   &res->bus_addr,
+                                                   GFP_KERNEL);
                if (!res->virt_addr) {
                        dev_err(&mhba->pdev->dev,
                                        "unable to allocate consistent mem,"
@@ -246,8 +247,8 @@ static int mvumi_internal_cmd_sgl(struct mvumi_hba *mhba, struct mvumi_cmd *cmd,
        if (size == 0)
                return 0;
 
-       virt_addr = dma_zalloc_coherent(&mhba->pdev->dev, size, &phy_addr,
-                       GFP_KERNEL);
+       virt_addr = dma_alloc_coherent(&mhba->pdev->dev, size, &phy_addr,
+                                      GFP_KERNEL);
        if (!virt_addr)
                return -1;
 
index b3be49d..4c5a3d2 100644 (file)
@@ -116,8 +116,8 @@ int pm8001_mem_alloc(struct pci_dev *pdev, void **virt_addr,
        u64 align_offset = 0;
        if (align)
                align_offset = (dma_addr_t)align - 1;
-       mem_virt_alloc = dma_zalloc_coherent(&pdev->dev, mem_size + align,
-                       &mem_dma_handle, GFP_KERNEL);
+       mem_virt_alloc = dma_alloc_coherent(&pdev->dev, mem_size + align,
+                                           &mem_dma_handle, GFP_KERNEL);
        if (!mem_virt_alloc) {
                pm8001_printk("memory allocation error\n");
                return -1;
index edcaf4b..9bbc19f 100644 (file)
@@ -1050,16 +1050,17 @@ static int qedf_alloc_sq(struct qedf_ctx *qedf, struct qedf_rport *fcport)
            sizeof(void *);
        fcport->sq_pbl_size = fcport->sq_pbl_size + QEDF_PAGE_SIZE;
 
-       fcport->sq = dma_zalloc_coherent(&qedf->pdev->dev,
-           fcport->sq_mem_size, &fcport->sq_dma, GFP_KERNEL);
+       fcport->sq = dma_alloc_coherent(&qedf->pdev->dev, fcport->sq_mem_size,
+                                       &fcport->sq_dma, GFP_KERNEL);
        if (!fcport->sq) {
                QEDF_WARN(&(qedf->dbg_ctx), "Could not allocate send queue.\n");
                rval = 1;
                goto out;
        }
 
-       fcport->sq_pbl = dma_zalloc_coherent(&qedf->pdev->dev,
-           fcport->sq_pbl_size, &fcport->sq_pbl_dma, GFP_KERNEL);
+       fcport->sq_pbl = dma_alloc_coherent(&qedf->pdev->dev,
+                                           fcport->sq_pbl_size,
+                                           &fcport->sq_pbl_dma, GFP_KERNEL);
        if (!fcport->sq_pbl) {
                QEDF_WARN(&(qedf->dbg_ctx), "Could not allocate send queue PBL.\n");
                rval = 1;
@@ -2680,8 +2681,10 @@ static int qedf_alloc_bdq(struct qedf_ctx *qedf)
        }
 
        /* Allocate list of PBL pages */
-       qedf->bdq_pbl_list = dma_zalloc_coherent(&qedf->pdev->dev,
-           QEDF_PAGE_SIZE, &qedf->bdq_pbl_list_dma, GFP_KERNEL);
+       qedf->bdq_pbl_list = dma_alloc_coherent(&qedf->pdev->dev,
+                                               QEDF_PAGE_SIZE,
+                                               &qedf->bdq_pbl_list_dma,
+                                               GFP_KERNEL);
        if (!qedf->bdq_pbl_list) {
                QEDF_ERR(&(qedf->dbg_ctx), "Could not allocate list of PBL pages.\n");
                return -ENOMEM;
@@ -2770,9 +2773,10 @@ static int qedf_alloc_global_queues(struct qedf_ctx *qedf)
                    ALIGN(qedf->global_queues[i]->cq_pbl_size, QEDF_PAGE_SIZE);
 
                qedf->global_queues[i]->cq =
-                   dma_zalloc_coherent(&qedf->pdev->dev,
-                       qedf->global_queues[i]->cq_mem_size,
-                       &qedf->global_queues[i]->cq_dma, GFP_KERNEL);
+                   dma_alloc_coherent(&qedf->pdev->dev,
+                                      qedf->global_queues[i]->cq_mem_size,
+                                      &qedf->global_queues[i]->cq_dma,
+                                      GFP_KERNEL);
 
                if (!qedf->global_queues[i]->cq) {
                        QEDF_WARN(&(qedf->dbg_ctx), "Could not allocate cq.\n");
@@ -2781,9 +2785,10 @@ static int qedf_alloc_global_queues(struct qedf_ctx *qedf)
                }
 
                qedf->global_queues[i]->cq_pbl =
-                   dma_zalloc_coherent(&qedf->pdev->dev,
-                       qedf->global_queues[i]->cq_pbl_size,
-                       &qedf->global_queues[i]->cq_pbl_dma, GFP_KERNEL);
+                   dma_alloc_coherent(&qedf->pdev->dev,
+                                      qedf->global_queues[i]->cq_pbl_size,
+                                      &qedf->global_queues[i]->cq_pbl_dma,
+                                      GFP_KERNEL);
 
                if (!qedf->global_queues[i]->cq_pbl) {
                        QEDF_WARN(&(qedf->dbg_ctx), "Could not allocate cq PBL.\n");
index 5c53409..e74a624 100644 (file)
@@ -1394,10 +1394,9 @@ static int qedi_alloc_nvm_iscsi_cfg(struct qedi_ctx *qedi)
 {
        struct qedi_nvm_iscsi_image nvm_image;
 
-       qedi->iscsi_image = dma_zalloc_coherent(&qedi->pdev->dev,
-                                               sizeof(nvm_image),
-                                               &qedi->nvm_buf_dma,
-                                               GFP_KERNEL);
+       qedi->iscsi_image = dma_alloc_coherent(&qedi->pdev->dev,
+                                              sizeof(nvm_image),
+                                              &qedi->nvm_buf_dma, GFP_KERNEL);
        if (!qedi->iscsi_image) {
                QEDI_ERR(&qedi->dbg_ctx, "Could not allocate NVM BUF.\n");
                return -ENOMEM;
@@ -1510,10 +1509,10 @@ static int qedi_alloc_bdq(struct qedi_ctx *qedi)
        }
 
        /* Allocate list of PBL pages */
-       qedi->bdq_pbl_list = dma_zalloc_coherent(&qedi->pdev->dev,
-                                                QEDI_PAGE_SIZE,
-                                                &qedi->bdq_pbl_list_dma,
-                                                GFP_KERNEL);
+       qedi->bdq_pbl_list = dma_alloc_coherent(&qedi->pdev->dev,
+                                               QEDI_PAGE_SIZE,
+                                               &qedi->bdq_pbl_list_dma,
+                                               GFP_KERNEL);
        if (!qedi->bdq_pbl_list) {
                QEDI_ERR(&qedi->dbg_ctx,
                         "Could not allocate list of PBL pages.\n");
@@ -1609,10 +1608,10 @@ static int qedi_alloc_global_queues(struct qedi_ctx *qedi)
                    (qedi->global_queues[i]->cq_pbl_size +
                    (QEDI_PAGE_SIZE - 1));
 
-               qedi->global_queues[i]->cq = dma_zalloc_coherent(&qedi->pdev->dev,
-                                                                qedi->global_queues[i]->cq_mem_size,
-                                                                &qedi->global_queues[i]->cq_dma,
-                                                                GFP_KERNEL);
+               qedi->global_queues[i]->cq = dma_alloc_coherent(&qedi->pdev->dev,
+                                                               qedi->global_queues[i]->cq_mem_size,
+                                                               &qedi->global_queues[i]->cq_dma,
+                                                               GFP_KERNEL);
 
                if (!qedi->global_queues[i]->cq) {
                        QEDI_WARN(&qedi->dbg_ctx,
@@ -1620,10 +1619,10 @@ static int qedi_alloc_global_queues(struct qedi_ctx *qedi)
                        status = -ENOMEM;
                        goto mem_alloc_failure;
                }
-               qedi->global_queues[i]->cq_pbl = dma_zalloc_coherent(&qedi->pdev->dev,
-                                                                    qedi->global_queues[i]->cq_pbl_size,
-                                                                    &qedi->global_queues[i]->cq_pbl_dma,
-                                                                    GFP_KERNEL);
+               qedi->global_queues[i]->cq_pbl = dma_alloc_coherent(&qedi->pdev->dev,
+                                                                   qedi->global_queues[i]->cq_pbl_size,
+                                                                   &qedi->global_queues[i]->cq_pbl_dma,
+                                                                   GFP_KERNEL);
 
                if (!qedi->global_queues[i]->cq_pbl) {
                        QEDI_WARN(&qedi->dbg_ctx,
@@ -1691,16 +1690,16 @@ int qedi_alloc_sq(struct qedi_ctx *qedi, struct qedi_endpoint *ep)
        ep->sq_pbl_size = (ep->sq_mem_size / QEDI_PAGE_SIZE) * sizeof(void *);
        ep->sq_pbl_size = ep->sq_pbl_size + QEDI_PAGE_SIZE;
 
-       ep->sq = dma_zalloc_coherent(&qedi->pdev->dev, ep->sq_mem_size,
-                                    &ep->sq_dma, GFP_KERNEL);
+       ep->sq = dma_alloc_coherent(&qedi->pdev->dev, ep->sq_mem_size,
+                                   &ep->sq_dma, GFP_KERNEL);
        if (!ep->sq) {
                QEDI_WARN(&qedi->dbg_ctx,
                          "Could not allocate send queue.\n");
                rval = -ENOMEM;
                goto out;
        }
-       ep->sq_pbl = dma_zalloc_coherent(&qedi->pdev->dev, ep->sq_pbl_size,
-                                        &ep->sq_pbl_dma, GFP_KERNEL);
+       ep->sq_pbl = dma_alloc_coherent(&qedi->pdev->dev, ep->sq_pbl_size,
+                                       &ep->sq_pbl_dma, GFP_KERNEL);
        if (!ep->sq_pbl) {
                QEDI_WARN(&qedi->dbg_ctx,
                          "Could not allocate send queue PBL.\n");
index 00444dc..ac504a1 100644 (file)
@@ -2415,8 +2415,8 @@ qla2x00_get_fc_host_stats(struct Scsi_Host *shost)
        if (qla2x00_chip_is_down(vha))
                goto done;
 
-       stats = dma_zalloc_coherent(&ha->pdev->dev, sizeof(*stats),
-                                   &stats_dma, GFP_KERNEL);
+       stats = dma_alloc_coherent(&ha->pdev->dev, sizeof(*stats), &stats_dma,
+                                  GFP_KERNEL);
        if (!stats) {
                ql_log(ql_log_warn, vha, 0x707d,
                    "Failed to allocate memory for stats.\n");
index 4a9fd8d..17d4265 100644 (file)
@@ -2312,8 +2312,8 @@ qla2x00_get_priv_stats(struct bsg_job *bsg_job)
        if (!IS_FWI2_CAPABLE(ha))
                return -EPERM;
 
-       stats = dma_zalloc_coherent(&ha->pdev->dev, sizeof(*stats),
-                                   &stats_dma, GFP_KERNEL);
+       stats = dma_alloc_coherent(&ha->pdev->dev, sizeof(*stats), &stats_dma,
+                                  GFP_KERNEL);
        if (!stats) {
                ql_log(ql_log_warn, vha, 0x70e2,
                    "Failed to allocate memory for stats.\n");
index 90cfa39..cbc3bc4 100644 (file)
@@ -4147,9 +4147,10 @@ int qla24xx_async_gpnft(scsi_qla_host_t *vha, u8 fc4_type, srb_t *sp)
                        return rval;
                }
 
-               sp->u.iocb_cmd.u.ctarg.req = dma_zalloc_coherent(
-                       &vha->hw->pdev->dev, sizeof(struct ct_sns_pkt),
-                       &sp->u.iocb_cmd.u.ctarg.req_dma, GFP_KERNEL);
+               sp->u.iocb_cmd.u.ctarg.req = dma_alloc_coherent(&vha->hw->pdev->dev,
+                                                               sizeof(struct ct_sns_pkt),
+                                                               &sp->u.iocb_cmd.u.ctarg.req_dma,
+                                                               GFP_KERNEL);
                sp->u.iocb_cmd.u.ctarg.req_allocated_size = sizeof(struct ct_sns_pkt);
                if (!sp->u.iocb_cmd.u.ctarg.req) {
                        ql_log(ql_log_warn, vha, 0xffff,
@@ -4165,9 +4166,10 @@ int qla24xx_async_gpnft(scsi_qla_host_t *vha, u8 fc4_type, srb_t *sp)
                        ((vha->hw->max_fibre_devices - 1) *
                            sizeof(struct ct_sns_gpn_ft_data));
 
-               sp->u.iocb_cmd.u.ctarg.rsp = dma_zalloc_coherent(
-                       &vha->hw->pdev->dev, rspsz,
-                       &sp->u.iocb_cmd.u.ctarg.rsp_dma, GFP_KERNEL);
+               sp->u.iocb_cmd.u.ctarg.rsp = dma_alloc_coherent(&vha->hw->pdev->dev,
+                                                               rspsz,
+                                                               &sp->u.iocb_cmd.u.ctarg.rsp_dma,
+                                                               GFP_KERNEL);
                sp->u.iocb_cmd.u.ctarg.rsp_allocated_size = sizeof(struct ct_sns_pkt);
                if (!sp->u.iocb_cmd.u.ctarg.rsp) {
                        ql_log(ql_log_warn, vha, 0xffff,
index 364bb52..aeeb014 100644 (file)
@@ -3099,8 +3099,8 @@ qla2x00_alloc_offload_mem(scsi_qla_host_t *vha)
                            FCE_SIZE, ha->fce, ha->fce_dma);
 
                /* Allocate memory for Fibre Channel Event Buffer. */
-               tc = dma_zalloc_coherent(&ha->pdev->dev, FCE_SIZE, &tc_dma,
-                                        GFP_KERNEL);
+               tc = dma_alloc_coherent(&ha->pdev->dev, FCE_SIZE, &tc_dma,
+                                       GFP_KERNEL);
                if (!tc) {
                        ql_log(ql_log_warn, vha, 0x00be,
                            "Unable to allocate (%d KB) for FCE.\n",
@@ -3131,8 +3131,8 @@ try_eft:
                            EFT_SIZE, ha->eft, ha->eft_dma);
 
                /* Allocate memory for Extended Trace Buffer. */
-               tc = dma_zalloc_coherent(&ha->pdev->dev, EFT_SIZE, &tc_dma,
-                                        GFP_KERNEL);
+               tc = dma_alloc_coherent(&ha->pdev->dev, EFT_SIZE, &tc_dma,
+                                       GFP_KERNEL);
                if (!tc) {
                        ql_log(ql_log_warn, vha, 0x00c1,
                            "Unable to allocate (%d KB) for EFT.\n",
index 1ef74aa..2bf5e3e 100644 (file)
@@ -153,8 +153,8 @@ int qla4xxx_get_sys_info(struct scsi_qla_host *ha)
        dma_addr_t sys_info_dma;
        int status = QLA_ERROR;
 
-       sys_info = dma_zalloc_coherent(&ha->pdev->dev, sizeof(*sys_info),
-                                      &sys_info_dma, GFP_KERNEL);
+       sys_info = dma_alloc_coherent(&ha->pdev->dev, sizeof(*sys_info),
+                                     &sys_info_dma, GFP_KERNEL);
        if (sys_info == NULL) {
                DEBUG2(printk("scsi%ld: %s: Unable to allocate dma buffer.\n",
                              ha->host_no, __func__));
index 5d56904..dac9a70 100644 (file)
@@ -625,9 +625,9 @@ int qla4xxx_initialize_fw_cb(struct scsi_qla_host * ha)
        uint32_t mbox_sts[MBOX_REG_COUNT];
        int status = QLA_ERROR;
 
-       init_fw_cb = dma_zalloc_coherent(&ha->pdev->dev,
-                                        sizeof(struct addr_ctrl_blk),
-                                        &init_fw_cb_dma, GFP_KERNEL);
+       init_fw_cb = dma_alloc_coherent(&ha->pdev->dev,
+                                       sizeof(struct addr_ctrl_blk),
+                                       &init_fw_cb_dma, GFP_KERNEL);
        if (init_fw_cb == NULL) {
                DEBUG2(printk("scsi%ld: %s: Unable to alloc init_cb\n",
                              ha->host_no, __func__));
@@ -709,9 +709,9 @@ int qla4xxx_get_dhcp_ip_address(struct scsi_qla_host * ha)
        uint32_t mbox_cmd[MBOX_REG_COUNT];
        uint32_t mbox_sts[MBOX_REG_COUNT];
 
-       init_fw_cb = dma_zalloc_coherent(&ha->pdev->dev,
-                                        sizeof(struct addr_ctrl_blk),
-                                        &init_fw_cb_dma, GFP_KERNEL);
+       init_fw_cb = dma_alloc_coherent(&ha->pdev->dev,
+                                       sizeof(struct addr_ctrl_blk),
+                                       &init_fw_cb_dma, GFP_KERNEL);
        if (init_fw_cb == NULL) {
                printk("scsi%ld: %s: Unable to alloc init_cb\n", ha->host_no,
                       __func__);
@@ -1340,9 +1340,9 @@ int qla4xxx_about_firmware(struct scsi_qla_host *ha)
        uint32_t mbox_sts[MBOX_REG_COUNT];
        int status = QLA_ERROR;
 
-       about_fw = dma_zalloc_coherent(&ha->pdev->dev,
-                                      sizeof(struct about_fw_info),
-                                      &about_fw_dma, GFP_KERNEL);
+       about_fw = dma_alloc_coherent(&ha->pdev->dev,
+                                     sizeof(struct about_fw_info),
+                                     &about_fw_dma, GFP_KERNEL);
        if (!about_fw) {
                DEBUG2(ql4_printk(KERN_ERR, ha, "%s: Unable to alloc memory "
                                  "for about_fw\n", __func__));
index d2b333d..5a31877 100644 (file)
@@ -4052,8 +4052,8 @@ int qla4_8xxx_get_sys_info(struct scsi_qla_host *ha)
        dma_addr_t sys_info_dma;
        int status = QLA_ERROR;
 
-       sys_info = dma_zalloc_coherent(&ha->pdev->dev, sizeof(*sys_info),
-                                      &sys_info_dma, GFP_KERNEL);
+       sys_info = dma_alloc_coherent(&ha->pdev->dev, sizeof(*sys_info),
+                                     &sys_info_dma, GFP_KERNEL);
        if (sys_info == NULL) {
                DEBUG2(printk("scsi%ld: %s: Unable to allocate dma buffer.\n",
                    ha->host_no, __func__));
index 949e186..cfdfcda 100644 (file)
@@ -2704,9 +2704,9 @@ qla4xxx_iface_set_param(struct Scsi_Host *shost, void *data, uint32_t len)
        uint32_t rem = len;
        struct nlattr *attr;
 
-       init_fw_cb = dma_zalloc_coherent(&ha->pdev->dev,
-                                        sizeof(struct addr_ctrl_blk),
-                                        &init_fw_cb_dma, GFP_KERNEL);
+       init_fw_cb = dma_alloc_coherent(&ha->pdev->dev,
+                                       sizeof(struct addr_ctrl_blk),
+                                       &init_fw_cb_dma, GFP_KERNEL);
        if (!init_fw_cb) {
                ql4_printk(KERN_ERR, ha, "%s: Unable to alloc init_cb\n",
                           __func__);
@@ -4206,8 +4206,8 @@ static int qla4xxx_mem_alloc(struct scsi_qla_host *ha)
                          sizeof(struct shadow_regs) +
                          MEM_ALIGN_VALUE +
                          (PAGE_SIZE - 1)) & ~(PAGE_SIZE - 1);
-       ha->queues = dma_zalloc_coherent(&ha->pdev->dev, ha->queues_len,
-                                        &ha->queues_dma, GFP_KERNEL);
+       ha->queues = dma_alloc_coherent(&ha->pdev->dev, ha->queues_len,
+                                       &ha->queues_dma, GFP_KERNEL);
        if (ha->queues == NULL) {
                ql4_printk(KERN_WARNING, ha,
                    "Memory Allocation failed - queues.\n");
index e2fa3f4..7bde6c8 100644 (file)
@@ -3576,9 +3576,9 @@ static int pqi_alloc_operational_queues(struct pqi_ctrl_info *ctrl_info)
        alloc_length += PQI_EXTRA_SGL_MEMORY;
 
        ctrl_info->queue_memory_base =
-               dma_zalloc_coherent(&ctrl_info->pci_dev->dev,
-                       alloc_length,
-                       &ctrl_info->queue_memory_base_dma_handle, GFP_KERNEL);
+               dma_alloc_coherent(&ctrl_info->pci_dev->dev, alloc_length,
+                                  &ctrl_info->queue_memory_base_dma_handle,
+                                  GFP_KERNEL);
 
        if (!ctrl_info->queue_memory_base)
                return -ENOMEM;
@@ -3715,10 +3715,9 @@ static int pqi_alloc_admin_queues(struct pqi_ctrl_info *ctrl_info)
                PQI_QUEUE_ELEMENT_ARRAY_ALIGNMENT;
 
        ctrl_info->admin_queue_memory_base =
-               dma_zalloc_coherent(&ctrl_info->pci_dev->dev,
-                       alloc_length,
-                       &ctrl_info->admin_queue_memory_base_dma_handle,
-                       GFP_KERNEL);
+               dma_alloc_coherent(&ctrl_info->pci_dev->dev, alloc_length,
+                                  &ctrl_info->admin_queue_memory_base_dma_handle,
+                                  GFP_KERNEL);
 
        if (!ctrl_info->admin_queue_memory_base)
                return -ENOMEM;
@@ -4602,9 +4601,10 @@ static void pqi_free_all_io_requests(struct pqi_ctrl_info *ctrl_info)
 
 static inline int pqi_alloc_error_buffer(struct pqi_ctrl_info *ctrl_info)
 {
-       ctrl_info->error_buffer = dma_zalloc_coherent(&ctrl_info->pci_dev->dev,
-               ctrl_info->error_buffer_length,
-               &ctrl_info->error_buffer_dma_handle, GFP_KERNEL);
+       ctrl_info->error_buffer = dma_alloc_coherent(&ctrl_info->pci_dev->dev,
+                                                    ctrl_info->error_buffer_length,
+                                                    &ctrl_info->error_buffer_dma_handle,
+                                                    GFP_KERNEL);
 
        if (!ctrl_info->error_buffer)
                return -ENOMEM;
@@ -7487,8 +7487,8 @@ static int pqi_ofa_alloc_mem(struct pqi_ctrl_info *ctrl_info,
                dma_addr_t dma_handle;
 
                ctrl_info->pqi_ofa_chunk_virt_addr[i] =
-                       dma_zalloc_coherent(dev, chunk_size, &dma_handle,
-                                               GFP_KERNEL);
+                       dma_alloc_coherent(dev, chunk_size, &dma_handle,
+                                          GFP_KERNEL);
 
                if (!ctrl_info->pqi_ofa_chunk_virt_addr[i])
                        break;
@@ -7545,10 +7545,10 @@ static void pqi_ofa_setup_host_buffer(struct pqi_ctrl_info *ctrl_info,
        struct device *dev;
 
        dev = &ctrl_info->pci_dev->dev;
-       pqi_ofa_memory = dma_zalloc_coherent(dev,
-                               PQI_OFA_MEMORY_DESCRIPTOR_LENGTH,
-                               &ctrl_info->pqi_ofa_mem_dma_handle,
-                               GFP_KERNEL);
+       pqi_ofa_memory = dma_alloc_coherent(dev,
+                                           PQI_OFA_MEMORY_DESCRIPTOR_LENGTH,
+                                           &ctrl_info->pqi_ofa_mem_dma_handle,
+                                           GFP_KERNEL);
 
        if (!pqi_ofa_memory)
                return;
index 9436aa8..e6d48dc 100644 (file)
@@ -62,7 +62,7 @@ int qbman_init_private_mem(struct device *dev, int idx, dma_addr_t *addr,
                return -ENODEV;
        }
 
-       if (!dma_zalloc_coherent(dev, *size, addr, 0)) {
+       if (!dma_alloc_coherent(dev, *size, addr, 0)) {
                dev_err(dev, "DMA Alloc memory failed\n");
                return -ENODEV;
        }
index 4d8012e..68bfca6 100644 (file)
@@ -44,7 +44,7 @@ config ARCH_RZN1
        bool
        select ARM_AMBA
 
-if ARM
+if ARM && ARCH_RENESAS
 
 #comment "Renesas ARM SoCs System Type"
 
index e1ac4c0..11050e1 100644 (file)
@@ -28,19 +28,6 @@ static struct rcar_sysc_area r8a774c0_areas[] __initdata = {
        { "3dg-b",      0x100, 1, R8A774C0_PD_3DG_B,    R8A774C0_PD_3DG_A },
 };
 
-static void __init rcar_sysc_fix_parent(struct rcar_sysc_area *areas,
-                                       unsigned int num_areas, u8 id,
-                                       int new_parent)
-{
-       unsigned int i;
-
-       for (i = 0; i < num_areas; i++)
-               if (areas[i].isr_bit == id) {
-                       areas[i].parent = new_parent;
-                       return;
-               }
-}
-
 /* Fixups for RZ/G2E ES1.0 revision */
 static const struct soc_device_attribute r8a774c0[] __initconst = {
        { .soc_id = "r8a774c0", .revision = "ES1.0" },
@@ -50,12 +37,10 @@ static const struct soc_device_attribute r8a774c0[] __initconst = {
 static int __init r8a774c0_sysc_init(void)
 {
        if (soc_device_match(r8a774c0)) {
-               rcar_sysc_fix_parent(r8a774c0_areas,
-                                    ARRAY_SIZE(r8a774c0_areas),
-                                    R8A774C0_PD_3DG_A, R8A774C0_PD_3DG_B);
-               rcar_sysc_fix_parent(r8a774c0_areas,
-                                    ARRAY_SIZE(r8a774c0_areas),
-                                    R8A774C0_PD_3DG_B, R8A774C0_PD_ALWAYS_ON);
+               /* Fix incorrect 3DG hierarchy */
+               swap(r8a774c0_areas[6], r8a774c0_areas[7]);
+               r8a774c0_areas[6].parent = R8A774C0_PD_ALWAYS_ON;
+               r8a774c0_areas[7].parent = R8A774C0_PD_3DG_B;
        }
 
        return 0;
index d7e4e18..1ae9af5 100644 (file)
@@ -466,9 +466,9 @@ static int ring_desc_ring_alloc(struct pic32_sqi *sqi)
        int i;
 
        /* allocate coherent DMAable memory for hardware buffer descriptors. */
-       sqi->bd = dma_zalloc_coherent(&sqi->master->dev,
-                                     sizeof(*bd) * PESQI_BD_COUNT,
-                                     &sqi->bd_dma, GFP_KERNEL);
+       sqi->bd = dma_alloc_coherent(&sqi->master->dev,
+                                    sizeof(*bd) * PESQI_BD_COUNT,
+                                    &sqi->bd_dma, GFP_KERNEL);
        if (!sqi->bd) {
                dev_err(&sqi->master->dev, "failed allocating dma buffer\n");
                return -ENOMEM;
index 21a76a8..6027b19 100644 (file)
@@ -1396,8 +1396,7 @@ static int mtk_qdma_tx_alloc_tx(struct mtk_eth *eth)
        if (!ring->tx_buf)
                goto no_tx_mem;
 
-       ring->tx_dma = dma_zalloc_coherent(eth->dev,
-                                         ring->tx_ring_size * sz,
+       ring->tx_dma = dma_alloc_coherent(eth->dev, ring->tx_ring_size * sz,
                                          &ring->tx_phys,
                                          GFP_ATOMIC | __GFP_ZERO);
        if (!ring->tx_dma)
index 364d6ea..2f90f60 100644 (file)
@@ -154,7 +154,7 @@ void rtw_wep_encrypt(struct adapter *padapter, u8 *pxmitframe)
 
        pframe = ((struct xmit_frame *)pxmitframe)->buf_addr + hw_hdr_offset;
 
-       crypto_ops = try_then_request_module(lib80211_get_crypto_ops("WEP"), "lib80211_crypt_wep");
+       crypto_ops = lib80211_get_crypto_ops("WEP");
 
        if (!crypto_ops)
                return;
@@ -210,7 +210,7 @@ int rtw_wep_decrypt(struct adapter  *padapter, u8 *precvframe)
                void *crypto_private = NULL;
                int status = _SUCCESS;
                const int keyindex = prxattrib->key_index;
-               struct lib80211_crypto_ops *crypto_ops = try_then_request_module(lib80211_get_crypto_ops("WEP"), "lib80211_crypt_wep");
+               struct lib80211_crypto_ops *crypto_ops = lib80211_get_crypto_ops("WEP");
                char iv[4], icv[4];
 
                if (!crypto_ops) {
@@ -1291,7 +1291,7 @@ u32 rtw_aes_decrypt(struct adapter *padapter, u8 *precvframe)
                        struct sk_buff *skb = ((struct recv_frame *)precvframe)->pkt;
                        void *crypto_private = NULL;
                        u8 *key, *pframe = skb->data;
-                       struct lib80211_crypto_ops *crypto_ops = try_then_request_module(lib80211_get_crypto_ops("CCMP"), "lib80211_crypt_ccmp");
+                       struct lib80211_crypto_ops *crypto_ops = lib80211_get_crypto_ops("CCMP");
                        struct security_priv *psecuritypriv = &padapter->securitypriv;
                        char iv[8], icv[8];
 
index 7c03b69..6d02904 100644 (file)
@@ -22,7 +22,7 @@ static const struct sdio_device_id sdio_ids[] =
        { SDIO_DEVICE(0x024c, 0xb723), },
        { /* end: all zeroes */                         },
 };
-static const struct acpi_device_id acpi_ids[] __used = {
+static const struct acpi_device_id acpi_ids[] = {
        {"OBDA8723", 0x0000},
        {}
 };
index 338b6e9..dd48988 100644 (file)
@@ -407,10 +407,8 @@ create_pagelist(char __user *buf, size_t count, unsigned short type)
        /* Allocate enough storage to hold the page pointers and the page
         * list
         */
-       pagelist = dma_zalloc_coherent(g_dev,
-                                      pagelist_size,
-                                      &dma_addr,
-                                      GFP_KERNEL);
+       pagelist = dma_alloc_coherent(g_dev, pagelist_size, &dma_addr,
+                                     GFP_KERNEL);
 
        vchiq_log_trace(vchiq_arm_log_level, "%s - %pK", __func__, pagelist);
 
index 1ab0e85..c9097e7 100644 (file)
@@ -440,12 +440,9 @@ static bool device_init_rings(struct vnt_private *priv)
        void *vir_pool;
 
        /*allocate all RD/TD rings a single pool*/
-       vir_pool = dma_zalloc_coherent(&priv->pcid->dev,
-                                      priv->opts.rx_descs0 * sizeof(struct vnt_rx_desc) +
-                                      priv->opts.rx_descs1 * sizeof(struct vnt_rx_desc) +
-                                      priv->opts.tx_descs[0] * sizeof(struct vnt_tx_desc) +
-                                      priv->opts.tx_descs[1] * sizeof(struct vnt_tx_desc),
-                                      &priv->pool_dma, GFP_ATOMIC);
+       vir_pool = dma_alloc_coherent(&priv->pcid->dev,
+                                     priv->opts.rx_descs0 * sizeof(struct vnt_rx_desc) + priv->opts.rx_descs1 * sizeof(struct vnt_rx_desc) + priv->opts.tx_descs[0] * sizeof(struct vnt_tx_desc) + priv->opts.tx_descs[1] * sizeof(struct vnt_tx_desc),
+                                     &priv->pool_dma, GFP_ATOMIC);
        if (!vir_pool) {
                dev_err(&priv->pcid->dev, "allocate desc dma memory failed\n");
                return false;
@@ -459,13 +456,9 @@ static bool device_init_rings(struct vnt_private *priv)
        priv->rd1_pool_dma = priv->rd0_pool_dma +
                priv->opts.rx_descs0 * sizeof(struct vnt_rx_desc);
 
-       priv->tx0_bufs = dma_zalloc_coherent(&priv->pcid->dev,
-                                            priv->opts.tx_descs[0] * PKT_BUF_SZ +
-                                            priv->opts.tx_descs[1] * PKT_BUF_SZ +
-                                            CB_BEACON_BUF_SIZE +
-                                            CB_MAX_BUF_SIZE,
-                                            &priv->tx_bufs_dma0,
-                                            GFP_ATOMIC);
+       priv->tx0_bufs = dma_alloc_coherent(&priv->pcid->dev,
+                                           priv->opts.tx_descs[0] * PKT_BUF_SZ + priv->opts.tx_descs[1] * PKT_BUF_SZ + CB_BEACON_BUF_SIZE + CB_MAX_BUF_SIZE,
+                                           &priv->tx_bufs_dma0, GFP_ATOMIC);
        if (!priv->tx0_bufs) {
                dev_err(&priv->pcid->dev, "allocate buf dma memory failed\n");
 
index 67b9bf3..089a6f2 100644 (file)
@@ -85,6 +85,18 @@ config SERIAL_EARLYCON_ARM_SEMIHOST
          with "earlycon=smh" on the kernel command line. The console is
          enabled when early_param is processed.
 
+config SERIAL_EARLYCON_RISCV_SBI
+       bool "Early console using RISC-V SBI"
+       depends on RISCV
+       select SERIAL_CORE
+       select SERIAL_CORE_CONSOLE
+       select SERIAL_EARLYCON
+       help
+         Support for early debug console using RISC-V SBI. This enables
+         the console before standard serial driver is probed. This is enabled
+         with "earlycon=sbi" on the kernel command line. The console is
+         enabled when early_param is processed.
+
 config SERIAL_SB1250_DUART
        tristate "BCM1xxx on-chip DUART serial support"
        depends on SIBYTE_SB1xxx_SOC=y
index 8c30373..1511e8a 100644 (file)
@@ -7,6 +7,7 @@ obj-$(CONFIG_SERIAL_CORE) += serial_core.o
 
 obj-$(CONFIG_SERIAL_EARLYCON) += earlycon.o
 obj-$(CONFIG_SERIAL_EARLYCON_ARM_SEMIHOST) += earlycon-arm-semihost.o
+obj-$(CONFIG_SERIAL_EARLYCON_RISCV_SBI) += earlycon-riscv-sbi.o
 
 # These Sparc drivers have to appear before others such as 8250
 # which share ttySx minor node space.  Otherwise console device
diff --git a/drivers/tty/serial/earlycon-riscv-sbi.c b/drivers/tty/serial/earlycon-riscv-sbi.c
new file mode 100644 (file)
index 0000000..e1a551a
--- /dev/null
@@ -0,0 +1,28 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * RISC-V SBI based earlycon
+ *
+ * Copyright (C) 2018 Anup Patel <anup@brainfault.org>
+ */
+#include <linux/kernel.h>
+#include <linux/console.h>
+#include <linux/init.h>
+#include <linux/serial_core.h>
+#include <asm/sbi.h>
+
+static void sbi_console_write(struct console *con,
+                             const char *s, unsigned int n)
+{
+       int i;
+
+       for (i = 0; i < n; ++i)
+               sbi_console_putchar(s[i]);
+}
+
+static int __init early_sbi_setup(struct earlycon_device *device,
+                                 const char *opt)
+{
+       device->con->write = sbi_console_write;
+       return 0;
+}
+EARLYCON_DECLARE(sbi, early_sbi_setup);
index e052b69..9de9f0f 100644 (file)
@@ -114,9 +114,9 @@ struct ltq_uart_port {
 
 static inline void asc_update_bits(u32 clear, u32 set, void __iomem *reg)
 {
-       u32 tmp = readl(reg);
+       u32 tmp = __raw_readl(reg);
 
-       writel((tmp & ~clear) | set, reg);
+       __raw_writel((tmp & ~clear) | set, reg);
 }
 
 static inline struct
@@ -144,7 +144,7 @@ lqasc_start_tx(struct uart_port *port)
 static void
 lqasc_stop_rx(struct uart_port *port)
 {
-       writel(ASCWHBSTATE_CLRREN, port->membase + LTQ_ASC_WHBSTATE);
+       __raw_writel(ASCWHBSTATE_CLRREN, port->membase + LTQ_ASC_WHBSTATE);
 }
 
 static int
@@ -153,11 +153,12 @@ lqasc_rx_chars(struct uart_port *port)
        struct tty_port *tport = &port->state->port;
        unsigned int ch = 0, rsr = 0, fifocnt;
 
-       fifocnt = readl(port->membase + LTQ_ASC_FSTAT) & ASCFSTAT_RXFFLMASK;
+       fifocnt = __raw_readl(port->membase + LTQ_ASC_FSTAT) &
+                 ASCFSTAT_RXFFLMASK;
        while (fifocnt--) {
                u8 flag = TTY_NORMAL;
                ch = readb(port->membase + LTQ_ASC_RBUF);
-               rsr = (readl(port->membase + LTQ_ASC_STATE)
+               rsr = (__raw_readl(port->membase + LTQ_ASC_STATE)
                        & ASCSTATE_ANY) | UART_DUMMY_UER_RX;
                tty_flip_buffer_push(tport);
                port->icount.rx++;
@@ -217,7 +218,7 @@ lqasc_tx_chars(struct uart_port *port)
                return;
        }
 
-       while (((readl(port->membase + LTQ_ASC_FSTAT) &
+       while (((__raw_readl(port->membase + LTQ_ASC_FSTAT) &
                ASCFSTAT_TXFREEMASK) >> ASCFSTAT_TXFREEOFF) != 0) {
                if (port->x_char) {
                        writeb(port->x_char, port->membase + LTQ_ASC_TBUF);
@@ -245,7 +246,7 @@ lqasc_tx_int(int irq, void *_port)
        unsigned long flags;
        struct uart_port *port = (struct uart_port *)_port;
        spin_lock_irqsave(&ltq_asc_lock, flags);
-       writel(ASC_IRNCR_TIR, port->membase + LTQ_ASC_IRNCR);
+       __raw_writel(ASC_IRNCR_TIR, port->membase + LTQ_ASC_IRNCR);
        spin_unlock_irqrestore(&ltq_asc_lock, flags);
        lqasc_start_tx(port);
        return IRQ_HANDLED;
@@ -270,7 +271,7 @@ lqasc_rx_int(int irq, void *_port)
        unsigned long flags;
        struct uart_port *port = (struct uart_port *)_port;
        spin_lock_irqsave(&ltq_asc_lock, flags);
-       writel(ASC_IRNCR_RIR, port->membase + LTQ_ASC_IRNCR);
+       __raw_writel(ASC_IRNCR_RIR, port->membase + LTQ_ASC_IRNCR);
        lqasc_rx_chars(port);
        spin_unlock_irqrestore(&ltq_asc_lock, flags);
        return IRQ_HANDLED;
@@ -280,7 +281,8 @@ static unsigned int
 lqasc_tx_empty(struct uart_port *port)
 {
        int status;
-       status = readl(port->membase + LTQ_ASC_FSTAT) & ASCFSTAT_TXFFLMASK;
+       status = __raw_readl(port->membase + LTQ_ASC_FSTAT) &
+                ASCFSTAT_TXFFLMASK;
        return status ? 0 : TIOCSER_TEMT;
 }
 
@@ -313,12 +315,12 @@ lqasc_startup(struct uart_port *port)
        asc_update_bits(ASCCLC_DISS | ASCCLC_RMCMASK, (1 << ASCCLC_RMCOFFSET),
                port->membase + LTQ_ASC_CLC);
 
-       writel(0, port->membase + LTQ_ASC_PISEL);
-       writel(
+       __raw_writel(0, port->membase + LTQ_ASC_PISEL);
+       __raw_writel(
                ((TXFIFO_FL << ASCTXFCON_TXFITLOFF) & ASCTXFCON_TXFITLMASK) |
                ASCTXFCON_TXFEN | ASCTXFCON_TXFFLU,
                port->membase + LTQ_ASC_TXFCON);
-       writel(
+       __raw_writel(
                ((RXFIFO_FL << ASCRXFCON_RXFITLOFF) & ASCRXFCON_RXFITLMASK)
                | ASCRXFCON_RXFEN | ASCRXFCON_RXFFLU,
                port->membase + LTQ_ASC_RXFCON);
@@ -350,7 +352,7 @@ lqasc_startup(struct uart_port *port)
                goto err2;
        }
 
-       writel(ASC_IRNREN_RX | ASC_IRNREN_ERR | ASC_IRNREN_TX,
+       __raw_writel(ASC_IRNREN_RX | ASC_IRNREN_ERR | ASC_IRNREN_TX,
                port->membase + LTQ_ASC_IRNREN);
        return 0;
 
@@ -369,7 +371,7 @@ lqasc_shutdown(struct uart_port *port)
        free_irq(ltq_port->rx_irq, port);
        free_irq(ltq_port->err_irq, port);
 
-       writel(0, port->membase + LTQ_ASC_CON);
+       __raw_writel(0, port->membase + LTQ_ASC_CON);
        asc_update_bits(ASCRXFCON_RXFEN, ASCRXFCON_RXFFLU,
                port->membase + LTQ_ASC_RXFCON);
        asc_update_bits(ASCTXFCON_TXFEN, ASCTXFCON_TXFFLU,
@@ -461,13 +463,13 @@ lqasc_set_termios(struct uart_port *port,
        asc_update_bits(ASCCON_BRS, 0, port->membase + LTQ_ASC_CON);
 
        /* now we can write the new baudrate into the register */
-       writel(divisor, port->membase + LTQ_ASC_BG);
+       __raw_writel(divisor, port->membase + LTQ_ASC_BG);
 
        /* turn the baudrate generator back on */
        asc_update_bits(0, ASCCON_R, port->membase + LTQ_ASC_CON);
 
        /* enable rx */
-       writel(ASCWHBSTATE_SETREN, port->membase + LTQ_ASC_WHBSTATE);
+       __raw_writel(ASCWHBSTATE_SETREN, port->membase + LTQ_ASC_WHBSTATE);
 
        spin_unlock_irqrestore(&ltq_asc_lock, flags);
 
@@ -578,7 +580,7 @@ lqasc_console_putchar(struct uart_port *port, int ch)
                return;
 
        do {
-               fifofree = (readl(port->membase + LTQ_ASC_FSTAT)
+               fifofree = (__raw_readl(port->membase + LTQ_ASC_FSTAT)
                        & ASCFSTAT_TXFREEMASK) >> ASCFSTAT_TXFREEOFF;
        } while (fifofree == 0);
        writeb(ch, port->membase + LTQ_ASC_TBUF);
index bfe9ad8..23c6fd2 100644 (file)
@@ -1256,7 +1256,8 @@ static void tty_driver_remove_tty(struct tty_driver *driver, struct tty_struct *
 static int tty_reopen(struct tty_struct *tty)
 {
        struct tty_driver *driver = tty->driver;
-       int retval;
+       struct tty_ldisc *ld;
+       int retval = 0;
 
        if (driver->type == TTY_DRIVER_TYPE_PTY &&
            driver->subtype == PTY_TYPE_MASTER)
@@ -1268,13 +1269,18 @@ static int tty_reopen(struct tty_struct *tty)
        if (test_bit(TTY_EXCLUSIVE, &tty->flags) && !capable(CAP_SYS_ADMIN))
                return -EBUSY;
 
-       retval = tty_ldisc_lock(tty, 5 * HZ);
-       if (retval)
-               return retval;
+       ld = tty_ldisc_ref_wait(tty);
+       if (ld) {
+               tty_ldisc_deref(ld);
+       } else {
+               retval = tty_ldisc_lock(tty, 5 * HZ);
+               if (retval)
+                       return retval;
 
-       if (!tty->ldisc)
-               retval = tty_ldisc_reinit(tty, tty->termios.c_line);
-       tty_ldisc_unlock(tty);
+               if (!tty->ldisc)
+                       retval = tty_ldisc_reinit(tty, tty->termios.c_line);
+               tty_ldisc_unlock(tty);
+       }
 
        if (retval == 0)
                tty->count++;
index ed8c62b..739f896 100644 (file)
@@ -1865,6 +1865,13 @@ static const struct usb_device_id acm_ids[] = {
        .driver_info = IGNORE_DEVICE,
        },
 
+       { USB_DEVICE(0x1bc7, 0x0021), /* Telit 3G ACM only composition */
+       .driver_info = SEND_ZERO_PACKET,
+       },
+       { USB_DEVICE(0x1bc7, 0x0023), /* Telit 3G ACM + ECM composition */
+       .driver_info = SEND_ZERO_PACKET,
+       },
+
        /* control interfaces without any protocol set */
        { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ACM,
                USB_CDC_PROTO_NONE) },
index 356b05c..f713cec 100644 (file)
@@ -143,9 +143,12 @@ int usb_choose_configuration(struct usb_device *udev)
                        continue;
                }
 
-               if (i > 0 && desc && is_audio(desc) && is_uac3_config(desc)) {
-                       best = c;
-                       break;
+               if (i > 0 && desc && is_audio(desc)) {
+                       if (is_uac3_config(desc)) {
+                               best = c;
+                               break;
+                       }
+                       continue;
                }
 
                /* From the remaining configs, choose the first one whose
index 514c521..8bc35d5 100644 (file)
@@ -394,7 +394,8 @@ static const struct usb_device_id usb_quirk_list[] = {
        { USB_DEVICE(0x1a40, 0x0101), .driver_info = USB_QUIRK_HUB_SLOW_RESET },
 
        /* Corsair K70 RGB */
-       { USB_DEVICE(0x1b1c, 0x1b13), .driver_info = USB_QUIRK_DELAY_INIT },
+       { USB_DEVICE(0x1b1c, 0x1b13), .driver_info = USB_QUIRK_DELAY_INIT |
+         USB_QUIRK_DELAY_CTRL_MSG },
 
        /* Corsair Strafe */
        { USB_DEVICE(0x1b1c, 0x1b15), .driver_info = USB_QUIRK_DELAY_INIT |
index 01b44e1..ccbd1d3 100644 (file)
@@ -172,8 +172,9 @@ static int scratchpad_setup(struct bdc *bdc)
        /* Refer to BDC spec, Table 4 for description of SPB */
        sp_buff_size = 1 << (sp_buff_size + 5);
        dev_dbg(bdc->dev, "Allocating %d bytes for scratchpad\n", sp_buff_size);
-       bdc->scratchpad.buff  =  dma_zalloc_coherent(bdc->dev, sp_buff_size,
-                                       &bdc->scratchpad.sp_dma, GFP_KERNEL);
+       bdc->scratchpad.buff  =  dma_alloc_coherent(bdc->dev, sp_buff_size,
+                                                   &bdc->scratchpad.sp_dma,
+                                                   GFP_KERNEL);
 
        if (!bdc->scratchpad.buff)
                goto fail;
@@ -202,11 +203,9 @@ static int setup_srr(struct bdc *bdc, int interrupter)
        bdc_writel(bdc->regs, BDC_SRRINT(0), BDC_SRR_RWS | BDC_SRR_RST);
        bdc->srr.dqp_index = 0;
        /* allocate the status report descriptors */
-       bdc->srr.sr_bds = dma_zalloc_coherent(
-                                       bdc->dev,
-                                       NUM_SR_ENTRIES * sizeof(struct bdc_bd),
-                                       &bdc->srr.dma_addr,
-                                       GFP_KERNEL);
+       bdc->srr.sr_bds = dma_alloc_coherent(bdc->dev,
+                                            NUM_SR_ENTRIES * sizeof(struct bdc_bd),
+                                            &bdc->srr.dma_addr, GFP_KERNEL);
        if (!bdc->srr.sr_bds)
                return -ENOMEM;
 
index 6218bfe..98deb5f 100644 (file)
@@ -596,9 +596,9 @@ static int uhci_start(struct usb_hcd *hcd)
                                           &uhci_debug_operations);
 #endif
 
-       uhci->frame = dma_zalloc_coherent(uhci_dev(uhci),
-                       UHCI_NUMFRAMES * sizeof(*uhci->frame),
-                       &uhci->frame_dma_handle, GFP_KERNEL);
+       uhci->frame = dma_alloc_coherent(uhci_dev(uhci),
+                                        UHCI_NUMFRAMES * sizeof(*uhci->frame),
+                                        &uhci->frame_dma_handle, GFP_KERNEL);
        if (!uhci->frame) {
                dev_err(uhci_dev(uhci),
                        "unable to allocate consistent memory for frame list\n");
index 36a3eb8..8067f17 100644 (file)
@@ -1672,8 +1672,8 @@ static int scratchpad_alloc(struct xhci_hcd *xhci, gfp_t flags)
        xhci->dcbaa->dev_context_ptrs[0] = cpu_to_le64(xhci->scratchpad->sp_dma);
        for (i = 0; i < num_sp; i++) {
                dma_addr_t dma;
-               void *buf = dma_zalloc_coherent(dev, xhci->page_size, &dma,
-                               flags);
+               void *buf = dma_alloc_coherent(dev, xhci->page_size, &dma,
+                                              flags);
                if (!buf)
                        goto fail_sp4;
 
@@ -1799,8 +1799,8 @@ int xhci_alloc_erst(struct xhci_hcd *xhci,
        struct xhci_erst_entry *entry;
 
        size = sizeof(struct xhci_erst_entry) * evt_ring->num_segs;
-       erst->entries = dma_zalloc_coherent(xhci_to_hcd(xhci)->self.sysdev,
-                                           size, &erst->erst_dma_addr, flags);
+       erst->entries = dma_alloc_coherent(xhci_to_hcd(xhci)->self.sysdev,
+                                          size, &erst->erst_dma_addr, flags);
        if (!erst->entries)
                return -ENOMEM;
 
index fde2e71..a73ea49 100644 (file)
@@ -235,8 +235,12 @@ static int slave_configure(struct scsi_device *sdev)
                if (!(us->fflags & US_FL_NEEDS_CAP16))
                        sdev->try_rc_10_first = 1;
 
-               /* assume SPC3 or latter devices support sense size > 18 */
-               if (sdev->scsi_level > SCSI_SPC_2)
+               /*
+                * assume SPC3 or latter devices support sense size > 18
+                * unless US_FL_BAD_SENSE quirk is specified.
+                */
+               if (sdev->scsi_level > SCSI_SPC_2 &&
+                   !(us->fflags & US_FL_BAD_SENSE))
                        us->fflags |= US_FL_SANE_SENSE;
 
                /*
index f7f83b2..ea0d27a 100644 (file)
@@ -1266,6 +1266,18 @@ UNUSUAL_DEV( 0x090c, 0x1132, 0x0000, 0xffff,
                US_FL_FIX_CAPACITY ),
 
 /*
+ * Reported by Icenowy Zheng <icenowy@aosc.io>
+ * The SMI SM3350 USB-UFS bridge controller will enter a wrong state
+ * that do not process read/write command if a long sense is requested,
+ * so force to use 18-byte sense.
+ */
+UNUSUAL_DEV(  0x090c, 0x3350, 0x0000, 0xffff,
+               "SMI",
+               "SM3350 UFS-to-USB-Mass-Storage bridge",
+               USB_SC_DEVICE, USB_PR_DEVICE, NULL,
+               US_FL_BAD_SENSE ),
+
+/*
  * Reported by Paul Hartman <paul.hartman+linux@gmail.com>
  * This card reader returns "Illegal Request, Logical Block Address
  * Out of Range" for the first READ(10) after a new card is inserted.
index 228ccdb..4d13e51 100644 (file)
@@ -94,7 +94,7 @@ TRACE_EVENT(vfio_pci_npu2_mmap,
 #endif /* _TRACE_VFIO_PCI_H */
 
 #undef TRACE_INCLUDE_PATH
-#define TRACE_INCLUDE_PATH .
+#define TRACE_INCLUDE_PATH ../../drivers/vfio/pci
 #undef TRACE_INCLUDE_FILE
 #define TRACE_INCLUDE_FILE trace
 
index 7651cfb..73652e2 100644 (file)
@@ -878,7 +878,7 @@ static int vfio_dma_do_unmap(struct vfio_iommu *iommu,
                return -EINVAL;
        if (!unmap->size || unmap->size & mask)
                return -EINVAL;
-       if (unmap->iova + unmap->size < unmap->iova ||
+       if (unmap->iova + unmap->size - 1 < unmap->iova ||
            unmap->size > SIZE_MAX)
                return -EINVAL;
 
index a74096c..43f2a48 100644 (file)
@@ -1446,9 +1446,9 @@ static int fb_probe(struct platform_device *device)
                da8xx_fb_fix.line_length - 1;
 
        /* allocate palette buffer */
-       par->v_palette_base = dma_zalloc_coherent(NULL, PALETTE_SIZE,
-                                                 &par->p_palette_base,
-                                                 GFP_KERNEL | GFP_DMA);
+       par->v_palette_base = dma_alloc_coherent(NULL, PALETTE_SIZE,
+                                                &par->p_palette_base,
+                                                GFP_KERNEL | GFP_DMA);
        if (!par->v_palette_base) {
                dev_err(&device->dev,
                        "GLCD: kmalloc for palette buffer failed\n");
index d92462f..f64aad6 100644 (file)
@@ -1016,19 +1016,21 @@ static noinline int __btrfs_cow_block(struct btrfs_trans_handle *trans,
                parent_start = parent->start;
 
        /*
-        * If we are COWing a node/leaf from the extent, chunk or device trees,
-        * make sure that we do not finish block group creation of pending block
-        * groups. We do this to avoid a deadlock.
+        * If we are COWing a node/leaf from the extent, chunk, device or free
+        * space trees, make sure that we do not finish block group creation of
+        * pending block groups. We do this to avoid a deadlock.
         * COWing can result in allocation of a new chunk, and flushing pending
         * block groups (btrfs_create_pending_block_groups()) can be triggered
         * when finishing allocation of a new chunk. Creation of a pending block
-        * group modifies the extent, chunk and device trees, therefore we could
-        * deadlock with ourselves since we are holding a lock on an extent
-        * buffer that btrfs_create_pending_block_groups() may try to COW later.
+        * group modifies the extent, chunk, device and free space trees,
+        * therefore we could deadlock with ourselves since we are holding a
+        * lock on an extent buffer that btrfs_create_pending_block_groups() may
+        * try to COW later.
         */
        if (root == fs_info->extent_root ||
            root == fs_info->chunk_root ||
-           root == fs_info->dev_root)
+           root == fs_info->dev_root ||
+           root == fs_info->free_space_root)
                trans->can_flush_pending_bgs = false;
 
        cow = btrfs_alloc_tree_block(trans, root, parent_start,
index fab9443..9c8e173 100644 (file)
@@ -3221,6 +3221,26 @@ static void btrfs_double_inode_lock(struct inode *inode1, struct inode *inode2)
        inode_lock_nested(inode2, I_MUTEX_CHILD);
 }
 
+static void btrfs_double_extent_unlock(struct inode *inode1, u64 loff1,
+                                      struct inode *inode2, u64 loff2, u64 len)
+{
+       unlock_extent(&BTRFS_I(inode1)->io_tree, loff1, loff1 + len - 1);
+       unlock_extent(&BTRFS_I(inode2)->io_tree, loff2, loff2 + len - 1);
+}
+
+static void btrfs_double_extent_lock(struct inode *inode1, u64 loff1,
+                                    struct inode *inode2, u64 loff2, u64 len)
+{
+       if (inode1 < inode2) {
+               swap(inode1, inode2);
+               swap(loff1, loff2);
+       } else if (inode1 == inode2 && loff2 < loff1) {
+               swap(loff1, loff2);
+       }
+       lock_extent(&BTRFS_I(inode1)->io_tree, loff1, loff1 + len - 1);
+       lock_extent(&BTRFS_I(inode2)->io_tree, loff2, loff2 + len - 1);
+}
+
 static int btrfs_extent_same_range(struct inode *src, u64 loff, u64 olen,
                                   struct inode *dst, u64 dst_loff)
 {
@@ -3242,11 +3262,12 @@ static int btrfs_extent_same_range(struct inode *src, u64 loff, u64 olen,
                return -EINVAL;
 
        /*
-        * Lock destination range to serialize with concurrent readpages().
+        * Lock destination range to serialize with concurrent readpages() and
+        * source range to serialize with relocation.
         */
-       lock_extent(&BTRFS_I(dst)->io_tree, dst_loff, dst_loff + len - 1);
+       btrfs_double_extent_lock(src, loff, dst, dst_loff, len);
        ret = btrfs_clone(src, dst, loff, olen, len, dst_loff, 1);
-       unlock_extent(&BTRFS_I(dst)->io_tree, dst_loff, dst_loff + len - 1);
+       btrfs_double_extent_unlock(src, loff, dst, dst_loff, len);
 
        return ret;
 }
@@ -3905,17 +3926,33 @@ static noinline int btrfs_clone_files(struct file *file, struct file *file_src,
                len = ALIGN(src->i_size, bs) - off;
 
        if (destoff > inode->i_size) {
+               const u64 wb_start = ALIGN_DOWN(inode->i_size, bs);
+
                ret = btrfs_cont_expand(inode, inode->i_size, destoff);
                if (ret)
                        return ret;
+               /*
+                * We may have truncated the last block if the inode's size is
+                * not sector size aligned, so we need to wait for writeback to
+                * complete before proceeding further, otherwise we can race
+                * with cloning and attempt to increment a reference to an
+                * extent that no longer exists (writeback completed right after
+                * we found the previous extent covering eof and before we
+                * attempted to increment its reference count).
+                */
+               ret = btrfs_wait_ordered_range(inode, wb_start,
+                                              destoff - wb_start);
+               if (ret)
+                       return ret;
        }
 
        /*
-        * Lock destination range to serialize with concurrent readpages().
+        * Lock destination range to serialize with concurrent readpages() and
+        * source range to serialize with relocation.
         */
-       lock_extent(&BTRFS_I(inode)->io_tree, destoff, destoff + len - 1);
+       btrfs_double_extent_lock(src, off, inode, destoff, len);
        ret = btrfs_clone(src, inode, off, olen, len, destoff, 0);
-       unlock_extent(&BTRFS_I(inode)->io_tree, destoff, destoff + len - 1);
+       btrfs_double_extent_unlock(src, off, inode, destoff, len);
        /*
         * Truncate page cache pages so that future reads will see the cloned
         * data immediately and not the previous data.
index 2576b1a..3e4f8f8 100644 (file)
@@ -7825,6 +7825,18 @@ static int verify_one_dev_extent(struct btrfs_fs_info *fs_info,
                ret = -EUCLEAN;
                goto out;
        }
+
+       /* It's possible this device is a dummy for seed device */
+       if (dev->disk_total_bytes == 0) {
+               dev = find_device(fs_info->fs_devices->seed, devid, NULL);
+               if (!dev) {
+                       btrfs_err(fs_info, "failed to find seed devid %llu",
+                                 devid);
+                       ret = -EUCLEAN;
+                       goto out;
+               }
+       }
+
        if (physical_offset + physical_len > dev->disk_total_bytes) {
                btrfs_err(fs_info,
 "dev extent devid %llu physical offset %llu len %llu is beyond device boundary %llu",
index 5d0c05e..a47c541 100644 (file)
@@ -1494,10 +1494,7 @@ static vm_fault_t ceph_filemap_fault(struct vm_fault *vmf)
                if (err < 0 || off >= i_size_read(inode)) {
                        unlock_page(page);
                        put_page(page);
-                       if (err == -ENOMEM)
-                               ret = VM_FAULT_OOM;
-                       else
-                               ret = VM_FAULT_SIGBUS;
+                       ret = vmf_error(err);
                        goto out_inline;
                }
                if (err < PAGE_SIZE)
index 4e9a7cc..da2cd8e 100644 (file)
@@ -530,7 +530,7 @@ static int ceph_show_options(struct seq_file *m, struct dentry *root)
        seq_putc(m, ',');
        pos = m->count;
 
-       ret = ceph_print_client_options(m, fsc->client);
+       ret = ceph_print_client_options(m, fsc->client, false);
        if (ret)
                return ret;
 
@@ -640,7 +640,7 @@ static struct ceph_fs_client *create_fs_client(struct ceph_mount_options *fsopt,
        opt = NULL; /* fsc->client now owns this */
 
        fsc->client->extra_mon_dispatch = extra_mon_dispatch;
-       fsc->client->osdc.abort_on_full = true;
+       ceph_set_opt(fsc->client, ABORT_ON_FULL);
 
        if (!fsopt->mds_namespace) {
                ceph_monc_want_map(&fsc->client->monc, CEPH_SUB_MDSMAP,
index 26776ed..d1f9c2f 100644 (file)
@@ -150,5 +150,5 @@ extern long cifs_ioctl(struct file *filep, unsigned int cmd, unsigned long arg);
 extern const struct export_operations cifs_export_ops;
 #endif /* CONFIG_CIFS_NFSD_EXPORT */
 
-#define CIFS_VERSION   "2.15"
+#define CIFS_VERSION   "2.16"
 #endif                         /* _CIFSFS_H */
index 01ded70..94dbdbe 100644 (file)
@@ -1438,6 +1438,7 @@ struct mid_q_entry {
        int mid_state;  /* wish this were enum but can not pass to wait_event */
        unsigned int mid_flags;
        __le16 command;         /* smb command code */
+       unsigned int optype;    /* operation type */
        bool large_buf:1;       /* if valid response, is pointer to large buf */
        bool multiRsp:1;        /* multiple trans2 responses for one request  */
        bool multiEnd:1;        /* both received */
@@ -1574,6 +1575,25 @@ static inline void free_dfs_info_array(struct dfs_info3_param *param,
        kfree(param);
 }
 
+static inline bool is_interrupt_error(int error)
+{
+       switch (error) {
+       case -EINTR:
+       case -ERESTARTSYS:
+       case -ERESTARTNOHAND:
+       case -ERESTARTNOINTR:
+               return true;
+       }
+       return false;
+}
+
+static inline bool is_retryable_error(int error)
+{
+       if (is_interrupt_error(error) || error == -EAGAIN)
+               return true;
+       return false;
+}
+
 #define   MID_FREE 0
 #define   MID_REQUEST_ALLOCATED 1
 #define   MID_REQUEST_SUBMITTED 2
index b1f49c1..e189154 100644 (file)
@@ -128,24 +128,31 @@ static int __cifs_reconnect_tcon(const struct nls_table *nlsc,
        int rc;
        struct dfs_cache_tgt_list tl;
        struct dfs_cache_tgt_iterator *it = NULL;
-       char tree[MAX_TREE_SIZE + 1];
+       char *tree;
        const char *tcp_host;
        size_t tcp_host_len;
        const char *dfs_host;
        size_t dfs_host_len;
 
+       tree = kzalloc(MAX_TREE_SIZE, GFP_KERNEL);
+       if (!tree)
+               return -ENOMEM;
+
        if (tcon->ipc) {
-               snprintf(tree, sizeof(tree), "\\\\%s\\IPC$",
+               snprintf(tree, MAX_TREE_SIZE, "\\\\%s\\IPC$",
                         tcon->ses->server->hostname);
-               return CIFSTCon(0, tcon->ses, tree, tcon, nlsc);
+               rc = CIFSTCon(0, tcon->ses, tree, tcon, nlsc);
+               goto out;
        }
 
-       if (!tcon->dfs_path)
-               return CIFSTCon(0, tcon->ses, tcon->treeName, tcon, nlsc);
+       if (!tcon->dfs_path) {
+               rc = CIFSTCon(0, tcon->ses, tcon->treeName, tcon, nlsc);
+               goto out;
+       }
 
        rc = dfs_cache_noreq_find(tcon->dfs_path + 1, NULL, &tl);
        if (rc)
-               return rc;
+               goto out;
 
        extract_unc_hostname(tcon->ses->server->hostname, &tcp_host,
                             &tcp_host_len);
@@ -165,7 +172,7 @@ static int __cifs_reconnect_tcon(const struct nls_table *nlsc,
                        continue;
                }
 
-               snprintf(tree, sizeof(tree), "\\%s", tgt);
+               snprintf(tree, MAX_TREE_SIZE, "\\%s", tgt);
 
                rc = CIFSTCon(0, tcon->ses, tree, tcon, nlsc);
                if (!rc)
@@ -182,6 +189,8 @@ static int __cifs_reconnect_tcon(const struct nls_table *nlsc,
                        rc = -ENOENT;
        }
        dfs_cache_free_tgts(&tl);
+out:
+       kfree(tree);
        return rc;
 }
 #else
@@ -2114,7 +2123,7 @@ cifs_writev_requeue(struct cifs_writedata *wdata)
 
                for (j = 0; j < nr_pages; j++) {
                        unlock_page(wdata2->pages[j]);
-                       if (rc != 0 && rc != -EAGAIN) {
+                       if (rc != 0 && !is_retryable_error(rc)) {
                                SetPageError(wdata2->pages[j]);
                                end_page_writeback(wdata2->pages[j]);
                                put_page(wdata2->pages[j]);
@@ -2123,7 +2132,7 @@ cifs_writev_requeue(struct cifs_writedata *wdata)
 
                if (rc) {
                        kref_put(&wdata2->refcount, cifs_writedata_release);
-                       if (rc == -EAGAIN)
+                       if (is_retryable_error(rc))
                                continue;
                        break;
                }
@@ -2132,7 +2141,8 @@ cifs_writev_requeue(struct cifs_writedata *wdata)
                i += nr_pages;
        } while (i < wdata->nr_pages);
 
-       mapping_set_error(inode->i_mapping, rc);
+       if (rc != 0 && !is_retryable_error(rc))
+               mapping_set_error(inode->i_mapping, rc);
        kref_put(&wdata->refcount, cifs_writedata_release);
 }
 
index f665296..683310f 100644 (file)
@@ -433,9 +433,10 @@ static void reconn_inval_dfs_target(struct TCP_Server_Info *server,
        kfree(server->hostname);
 
        server->hostname = extract_hostname(name);
-       if (!server->hostname) {
-               cifs_dbg(FYI, "%s: failed to extract hostname from target: %d\n",
-                        __func__, -ENOMEM);
+       if (IS_ERR(server->hostname)) {
+               cifs_dbg(FYI,
+                        "%s: failed to extract hostname from target: %ld\n",
+                        __func__, PTR_ERR(server->hostname));
        }
 }
 
index cd63c4a..09b7d0d 100644 (file)
@@ -776,6 +776,7 @@ static int get_tgt_list(const struct dfs_cache_entry *ce,
                it->it_name = kstrndup(t->t_name, strlen(t->t_name),
                                       GFP_KERNEL);
                if (!it->it_name) {
+                       kfree(it);
                        rc = -ENOMEM;
                        goto err_free_it;
                }
index e3e3a75..2c7689f 100644 (file)
@@ -733,7 +733,8 @@ reopen_success:
 
        if (can_flush) {
                rc = filemap_write_and_wait(inode->i_mapping);
-               mapping_set_error(inode->i_mapping, rc);
+               if (!is_interrupt_error(rc))
+                       mapping_set_error(inode->i_mapping, rc);
 
                if (tcon->unix_ext)
                        rc = cifs_get_inode_info_unix(&inode, full_path,
@@ -1132,14 +1133,18 @@ cifs_push_mandatory_locks(struct cifsFileInfo *cfile)
 
        /*
         * Accessing maxBuf is racy with cifs_reconnect - need to store value
-        * and check it for zero before using.
+        * and check it before using.
         */
        max_buf = tcon->ses->server->maxBuf;
-       if (!max_buf) {
+       if (max_buf < (sizeof(struct smb_hdr) + sizeof(LOCKING_ANDX_RANGE))) {
                free_xid(xid);
                return -EINVAL;
        }
 
+       BUILD_BUG_ON(sizeof(struct smb_hdr) + sizeof(LOCKING_ANDX_RANGE) >
+                    PAGE_SIZE);
+       max_buf = min_t(unsigned int, max_buf - sizeof(struct smb_hdr),
+                       PAGE_SIZE);
        max_num = (max_buf - sizeof(struct smb_hdr)) /
                                                sizeof(LOCKING_ANDX_RANGE);
        buf = kcalloc(max_num, sizeof(LOCKING_ANDX_RANGE), GFP_KERNEL);
@@ -1472,12 +1477,16 @@ cifs_unlock_range(struct cifsFileInfo *cfile, struct file_lock *flock,
 
        /*
         * Accessing maxBuf is racy with cifs_reconnect - need to store value
-        * and check it for zero before using.
+        * and check it before using.
         */
        max_buf = tcon->ses->server->maxBuf;
-       if (!max_buf)
+       if (max_buf < (sizeof(struct smb_hdr) + sizeof(LOCKING_ANDX_RANGE)))
                return -EINVAL;
 
+       BUILD_BUG_ON(sizeof(struct smb_hdr) + sizeof(LOCKING_ANDX_RANGE) >
+                    PAGE_SIZE);
+       max_buf = min_t(unsigned int, max_buf - sizeof(struct smb_hdr),
+                       PAGE_SIZE);
        max_num = (max_buf - sizeof(struct smb_hdr)) /
                                                sizeof(LOCKING_ANDX_RANGE);
        buf = kcalloc(max_num, sizeof(LOCKING_ANDX_RANGE), GFP_KERNEL);
@@ -2110,6 +2119,7 @@ static int cifs_writepages(struct address_space *mapping,
        pgoff_t end, index;
        struct cifs_writedata *wdata;
        int rc = 0;
+       int saved_rc = 0;
        unsigned int xid;
 
        /*
@@ -2138,8 +2148,10 @@ retry:
 
                rc = server->ops->wait_mtu_credits(server, cifs_sb->wsize,
                                                   &wsize, &credits);
-               if (rc)
+               if (rc != 0) {
+                       done = true;
                        break;
+               }
 
                tofind = min((wsize / PAGE_SIZE) - 1, end - index) + 1;
 
@@ -2147,6 +2159,7 @@ retry:
                                                  &found_pages);
                if (!wdata) {
                        rc = -ENOMEM;
+                       done = true;
                        add_credits_and_wake_if(server, credits, 0);
                        break;
                }
@@ -2175,7 +2188,7 @@ retry:
                if (rc != 0) {
                        add_credits_and_wake_if(server, wdata->credits, 0);
                        for (i = 0; i < nr_pages; ++i) {
-                               if (rc == -EAGAIN)
+                               if (is_retryable_error(rc))
                                        redirty_page_for_writepage(wbc,
                                                           wdata->pages[i]);
                                else
@@ -2183,7 +2196,7 @@ retry:
                                end_page_writeback(wdata->pages[i]);
                                put_page(wdata->pages[i]);
                        }
-                       if (rc != -EAGAIN)
+                       if (!is_retryable_error(rc))
                                mapping_set_error(mapping, rc);
                }
                kref_put(&wdata->refcount, cifs_writedata_release);
@@ -2193,6 +2206,15 @@ retry:
                        continue;
                }
 
+               /* Return immediately if we received a signal during writing */
+               if (is_interrupt_error(rc)) {
+                       done = true;
+                       break;
+               }
+
+               if (rc != 0 && saved_rc == 0)
+                       saved_rc = rc;
+
                wbc->nr_to_write -= nr_pages;
                if (wbc->nr_to_write <= 0)
                        done = true;
@@ -2210,6 +2232,9 @@ retry:
                goto retry;
        }
 
+       if (saved_rc != 0)
+               rc = saved_rc;
+
        if (wbc->range_cyclic || (range_whole && wbc->nr_to_write > 0))
                mapping->writeback_index = index;
 
@@ -2242,8 +2267,8 @@ cifs_writepage_locked(struct page *page, struct writeback_control *wbc)
        set_page_writeback(page);
 retry_write:
        rc = cifs_partialpagewrite(page, 0, PAGE_SIZE);
-       if (rc == -EAGAIN) {
-               if (wbc->sync_mode == WB_SYNC_ALL)
+       if (is_retryable_error(rc)) {
+               if (wbc->sync_mode == WB_SYNC_ALL && rc == -EAGAIN)
                        goto retry_write;
                redirty_page_for_writepage(wbc, page);
        } else if (rc != 0) {
index 13fb59a..4780036 100644 (file)
@@ -2257,6 +2257,11 @@ cifs_setattr_unix(struct dentry *direntry, struct iattr *attrs)
         * the flush returns error?
         */
        rc = filemap_write_and_wait(inode->i_mapping);
+       if (is_interrupt_error(rc)) {
+               rc = -ERESTARTSYS;
+               goto out;
+       }
+
        mapping_set_error(inode->i_mapping, rc);
        rc = 0;
 
@@ -2400,6 +2405,11 @@ cifs_setattr_nounix(struct dentry *direntry, struct iattr *attrs)
         * the flush returns error?
         */
        rc = filemap_write_and_wait(inode->i_mapping);
+       if (is_interrupt_error(rc)) {
+               rc = -ERESTARTSYS;
+               goto cifs_setattr_exit;
+       }
+
        mapping_set_error(inode->i_mapping, rc);
        rc = 0;
 
index 4ed10dd..b204e84 100644 (file)
@@ -122,12 +122,14 @@ smb2_unlock_range(struct cifsFileInfo *cfile, struct file_lock *flock,
 
        /*
         * Accessing maxBuf is racy with cifs_reconnect - need to store value
-        * and check it for zero before using.
+        * and check it before using.
         */
        max_buf = tcon->ses->server->maxBuf;
-       if (!max_buf)
+       if (max_buf < sizeof(struct smb2_lock_element))
                return -EINVAL;
 
+       BUILD_BUG_ON(sizeof(struct smb2_lock_element) > PAGE_SIZE);
+       max_buf = min_t(unsigned int, max_buf, PAGE_SIZE);
        max_num = max_buf / sizeof(struct smb2_lock_element);
        buf = kcalloc(max_num, sizeof(struct smb2_lock_element), GFP_KERNEL);
        if (!buf)
@@ -264,6 +266,8 @@ smb2_push_mandatory_locks(struct cifsFileInfo *cfile)
                return -EINVAL;
        }
 
+       BUILD_BUG_ON(sizeof(struct smb2_lock_element) > PAGE_SIZE);
+       max_buf = min_t(unsigned int, max_buf, PAGE_SIZE);
        max_num = max_buf / sizeof(struct smb2_lock_element);
        buf = kcalloc(max_num, sizeof(struct smb2_lock_element), GFP_KERNEL);
        if (!buf) {
index e57f6aa..50811a7 100644 (file)
@@ -162,24 +162,31 @@ static int __smb2_reconnect(const struct nls_table *nlsc,
        int rc;
        struct dfs_cache_tgt_list tl;
        struct dfs_cache_tgt_iterator *it = NULL;
-       char tree[MAX_TREE_SIZE + 1];
+       char *tree;
        const char *tcp_host;
        size_t tcp_host_len;
        const char *dfs_host;
        size_t dfs_host_len;
 
+       tree = kzalloc(MAX_TREE_SIZE, GFP_KERNEL);
+       if (!tree)
+               return -ENOMEM;
+
        if (tcon->ipc) {
-               snprintf(tree, sizeof(tree), "\\\\%s\\IPC$",
+               snprintf(tree, MAX_TREE_SIZE, "\\\\%s\\IPC$",
                         tcon->ses->server->hostname);
-               return SMB2_tcon(0, tcon->ses, tree, tcon, nlsc);
+               rc = SMB2_tcon(0, tcon->ses, tree, tcon, nlsc);
+               goto out;
        }
 
-       if (!tcon->dfs_path)
-               return SMB2_tcon(0, tcon->ses, tcon->treeName, tcon, nlsc);
+       if (!tcon->dfs_path) {
+               rc = SMB2_tcon(0, tcon->ses, tcon->treeName, tcon, nlsc);
+               goto out;
+       }
 
        rc = dfs_cache_noreq_find(tcon->dfs_path + 1, NULL, &tl);
        if (rc)
-               return rc;
+               goto out;
 
        extract_unc_hostname(tcon->ses->server->hostname, &tcp_host,
                             &tcp_host_len);
@@ -199,7 +206,7 @@ static int __smb2_reconnect(const struct nls_table *nlsc,
                        continue;
                }
 
-               snprintf(tree, sizeof(tree), "\\%s", tgt);
+               snprintf(tree, MAX_TREE_SIZE, "\\%s", tgt);
 
                rc = SMB2_tcon(0, tcon->ses, tree, tcon, nlsc);
                if (!rc)
@@ -216,6 +223,8 @@ static int __smb2_reconnect(const struct nls_table *nlsc,
                        rc = -ENOENT;
        }
        dfs_cache_free_tgts(&tl);
+out:
+       kfree(tree);
        return rc;
 }
 #else
@@ -3278,12 +3287,14 @@ smb2_async_readv(struct cifs_readdata *rdata)
        if (rdata->credits) {
                shdr->CreditCharge = cpu_to_le16(DIV_ROUND_UP(rdata->bytes,
                                                SMB2_MAX_BUFFER_SIZE));
-               shdr->CreditRequest = shdr->CreditCharge;
+               shdr->CreditRequest =
+                       cpu_to_le16(le16_to_cpu(shdr->CreditCharge) + 1);
                spin_lock(&server->req_lock);
                server->credits += rdata->credits -
                                                le16_to_cpu(shdr->CreditCharge);
                spin_unlock(&server->req_lock);
                wake_up(&server->request_q);
+               rdata->credits = le16_to_cpu(shdr->CreditCharge);
                flags |= CIFS_HAS_CREDITS;
        }
 
@@ -3555,12 +3566,14 @@ smb2_async_writev(struct cifs_writedata *wdata,
        if (wdata->credits) {
                shdr->CreditCharge = cpu_to_le16(DIV_ROUND_UP(wdata->bytes,
                                                    SMB2_MAX_BUFFER_SIZE));
-               shdr->CreditRequest = shdr->CreditCharge;
+               shdr->CreditRequest =
+                       cpu_to_le16(le16_to_cpu(shdr->CreditCharge) + 1);
                spin_lock(&server->req_lock);
                server->credits += wdata->credits -
                                                le16_to_cpu(shdr->CreditCharge);
                spin_unlock(&server->req_lock);
                wake_up(&server->request_q);
+               wdata->credits = le16_to_cpu(shdr->CreditCharge);
                flags |= CIFS_HAS_CREDITS;
        }
 
index 5be7302..202e0e8 100644 (file)
@@ -387,7 +387,7 @@ smbd_done:
        if (rc < 0 && rc != -EINTR)
                cifs_dbg(VFS, "Error %d sending data on socket to server\n",
                         rc);
-       else
+       else if (rc > 0)
                rc = 0;
 
        return rc;
@@ -783,8 +783,34 @@ cifs_setup_request(struct cifs_ses *ses, struct smb_rqst *rqst)
 }
 
 static void
-cifs_noop_callback(struct mid_q_entry *mid)
+cifs_compound_callback(struct mid_q_entry *mid)
 {
+       struct TCP_Server_Info *server = mid->server;
+       unsigned int optype = mid->optype;
+       unsigned int credits_received = 0;
+
+       if (mid->mid_state == MID_RESPONSE_RECEIVED) {
+               if (mid->resp_buf)
+                       credits_received = server->ops->get_credits(mid);
+               else
+                       cifs_dbg(FYI, "Bad state for cancelled MID\n");
+       }
+
+       add_credits(server, credits_received, optype);
+}
+
+static void
+cifs_compound_last_callback(struct mid_q_entry *mid)
+{
+       cifs_compound_callback(mid);
+       cifs_wake_up_task(mid);
+}
+
+static void
+cifs_cancelled_callback(struct mid_q_entry *mid)
+{
+       cifs_compound_callback(mid);
+       DeleteMidQEntry(mid);
 }
 
 int
@@ -795,7 +821,8 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses,
        int i, j, rc = 0;
        int timeout, optype;
        struct mid_q_entry *midQ[MAX_COMPOUND];
-       unsigned int credits = 0;
+       bool cancelled_mid[MAX_COMPOUND] = {false};
+       unsigned int credits[MAX_COMPOUND] = {0};
        char *buf;
 
        timeout = flags & CIFS_TIMEOUT_MASK;
@@ -813,13 +840,31 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses,
                return -ENOENT;
 
        /*
-        * Ensure that we do not send more than 50 overlapping requests
-        * to the same server. We may make this configurable later or
-        * use ses->maxReq.
+        * Ensure we obtain 1 credit per request in the compound chain.
+        * It can be optimized further by waiting for all the credits
+        * at once but this can wait long enough if we don't have enough
+        * credits due to some heavy operations in progress or the server
+        * not granting us much, so a fallback to the current approach is
+        * needed anyway.
         */
-       rc = wait_for_free_request(ses->server, timeout, optype);
-       if (rc)
-               return rc;
+       for (i = 0; i < num_rqst; i++) {
+               rc = wait_for_free_request(ses->server, timeout, optype);
+               if (rc) {
+                       /*
+                        * We haven't sent an SMB packet to the server yet but
+                        * we already obtained credits for i requests in the
+                        * compound chain - need to return those credits back
+                        * for future use. Note that we need to call add_credits
+                        * multiple times to match the way we obtained credits
+                        * in the first place and to account for in flight
+                        * requests correctly.
+                        */
+                       for (j = 0; j < i; j++)
+                               add_credits(ses->server, 1, optype);
+                       return rc;
+               }
+               credits[i] = 1;
+       }
 
        /*
         * Make sure that we sign in the same order that we send on this socket
@@ -835,18 +880,24 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses,
                        for (j = 0; j < i; j++)
                                cifs_delete_mid(midQ[j]);
                        mutex_unlock(&ses->server->srv_mutex);
+
                        /* Update # of requests on wire to server */
-                       add_credits(ses->server, 1, optype);
+                       for (j = 0; j < num_rqst; j++)
+                               add_credits(ses->server, credits[j], optype);
                        return PTR_ERR(midQ[i]);
                }
 
                midQ[i]->mid_state = MID_REQUEST_SUBMITTED;
+               midQ[i]->optype = optype;
                /*
-                * We don't invoke the callback compounds unless it is the last
-                * request.
+                * Invoke callback for every part of the compound chain
+                * to calculate credits properly. Wake up this thread only when
+                * the last element is received.
                 */
                if (i < num_rqst - 1)
-                       midQ[i]->callback = cifs_noop_callback;
+                       midQ[i]->callback = cifs_compound_callback;
+               else
+                       midQ[i]->callback = cifs_compound_last_callback;
        }
        cifs_in_send_inc(ses->server);
        rc = smb_send_rqst(ses->server, num_rqst, rqst, flags);
@@ -860,8 +911,20 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses,
 
        mutex_unlock(&ses->server->srv_mutex);
 
-       if (rc < 0)
+       if (rc < 0) {
+               /* Sending failed for some reason - return credits back */
+               for (i = 0; i < num_rqst; i++)
+                       add_credits(ses->server, credits[i], optype);
                goto out;
+       }
+
+       /*
+        * At this point the request is passed to the network stack - we assume
+        * that any credits taken from the server structure on the client have
+        * been spent and we can't return them back. Once we receive responses
+        * we will collect credits granted by the server in the mid callbacks
+        * and add those credits to the server structure.
+        */
 
        /*
         * Compounding is never used during session establish.
@@ -875,36 +938,34 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses,
 
        for (i = 0; i < num_rqst; i++) {
                rc = wait_for_response(ses->server, midQ[i]);
-               if (rc != 0) {
+               if (rc != 0)
+                       break;
+       }
+       if (rc != 0) {
+               for (; i < num_rqst; i++) {
                        cifs_dbg(VFS, "Cancelling wait for mid %llu cmd: %d\n",
                                 midQ[i]->mid, le16_to_cpu(midQ[i]->command));
                        send_cancel(ses->server, &rqst[i], midQ[i]);
                        spin_lock(&GlobalMid_Lock);
                        if (midQ[i]->mid_state == MID_REQUEST_SUBMITTED) {
                                midQ[i]->mid_flags |= MID_WAIT_CANCELLED;
-                               midQ[i]->callback = DeleteMidQEntry;
-                               spin_unlock(&GlobalMid_Lock);
-                               add_credits(ses->server, 1, optype);
-                               return rc;
+                               midQ[i]->callback = cifs_cancelled_callback;
+                               cancelled_mid[i] = true;
+                               credits[i] = 0;
                        }
                        spin_unlock(&GlobalMid_Lock);
                }
        }
 
-       for (i = 0; i < num_rqst; i++)
-               if (midQ[i]->resp_buf)
-                       credits += ses->server->ops->get_credits(midQ[i]);
-       if (!credits)
-               credits = 1;
-
        for (i = 0; i < num_rqst; i++) {
                if (rc < 0)
                        goto out;
 
                rc = cifs_sync_mid_result(midQ[i], ses->server);
                if (rc != 0) {
-                       add_credits(ses->server, credits, optype);
-                       return rc;
+                       /* mark this mid as cancelled to not free it below */
+                       cancelled_mid[i] = true;
+                       goto out;
                }
 
                if (!midQ[i]->resp_buf ||
@@ -951,9 +1012,10 @@ out:
         * This is prevented above by using a noop callback that will not
         * wake this thread except for the very last PDU.
         */
-       for (i = 0; i < num_rqst; i++)
-               cifs_delete_mid(midQ[i]);
-       add_credits(ses->server, credits, optype);
+       for (i = 0; i < num_rqst; i++) {
+               if (!cancelled_mid[i])
+                       cifs_delete_mid(midQ[i]);
+       }
 
        return rc;
 }
index a2fcea5..32920a1 100644 (file)
@@ -383,16 +383,17 @@ hugetlb_vmdelete_list(struct rb_root_cached *root, pgoff_t start, pgoff_t end)
  * truncation is indicated by end of range being LLONG_MAX
  *     In this case, we first scan the range and release found pages.
  *     After releasing pages, hugetlb_unreserve_pages cleans up region/reserv
- *     maps and global counts.
+ *     maps and global counts.  Page faults can not race with truncation
+ *     in this routine.  hugetlb_no_page() prevents page faults in the
+ *     truncated range.  It checks i_size before allocation, and again after
+ *     with the page table lock for the page held.  The same lock must be
+ *     acquired to unmap a page.
  * hole punch is indicated if end is not LLONG_MAX
  *     In the hole punch case we scan the range and release found pages.
  *     Only when releasing a page is the associated region/reserv map
  *     deleted.  The region/reserv map for ranges without associated
- *     pages are not modified.
- *
- * Callers of this routine must hold the i_mmap_rwsem in write mode to prevent
- * races with page faults.
- *
+ *     pages are not modified.  Page faults can race with hole punch.
+ *     This is indicated if we find a mapped page.
  * Note: If the passed end of range value is beyond the end of file, but
  * not LLONG_MAX this routine still performs a hole punch operation.
  */
@@ -422,14 +423,32 @@ static void remove_inode_hugepages(struct inode *inode, loff_t lstart,
 
                for (i = 0; i < pagevec_count(&pvec); ++i) {
                        struct page *page = pvec.pages[i];
+                       u32 hash;
 
                        index = page->index;
+                       hash = hugetlb_fault_mutex_hash(h, current->mm,
+                                                       &pseudo_vma,
+                                                       mapping, index, 0);
+                       mutex_lock(&hugetlb_fault_mutex_table[hash]);
+
                        /*
-                        * A mapped page is impossible as callers should unmap
-                        * all references before calling.  And, i_mmap_rwsem
-                        * prevents the creation of additional mappings.
+                        * If page is mapped, it was faulted in after being
+                        * unmapped in caller.  Unmap (again) now after taking
+                        * the fault mutex.  The mutex will prevent faults
+                        * until we finish removing the page.
+                        *
+                        * This race can only happen in the hole punch case.
+                        * Getting here in a truncate operation is a bug.
                         */
-                       VM_BUG_ON(page_mapped(page));
+                       if (unlikely(page_mapped(page))) {
+                               BUG_ON(truncate_op);
+
+                               i_mmap_lock_write(mapping);
+                               hugetlb_vmdelete_list(&mapping->i_mmap,
+                                       index * pages_per_huge_page(h),
+                                       (index + 1) * pages_per_huge_page(h));
+                               i_mmap_unlock_write(mapping);
+                       }
 
                        lock_page(page);
                        /*
@@ -451,6 +470,7 @@ static void remove_inode_hugepages(struct inode *inode, loff_t lstart,
                        }
 
                        unlock_page(page);
+                       mutex_unlock(&hugetlb_fault_mutex_table[hash]);
                }
                huge_pagevec_release(&pvec);
                cond_resched();
@@ -462,20 +482,9 @@ static void remove_inode_hugepages(struct inode *inode, loff_t lstart,
 
 static void hugetlbfs_evict_inode(struct inode *inode)
 {
-       struct address_space *mapping = inode->i_mapping;
        struct resv_map *resv_map;
 
-       /*
-        * The vfs layer guarantees that there are no other users of this
-        * inode.  Therefore, it would be safe to call remove_inode_hugepages
-        * without holding i_mmap_rwsem.  We acquire and hold here to be
-        * consistent with other callers.  Since there will be no contention
-        * on the semaphore, overhead is negligible.
-        */
-       i_mmap_lock_write(mapping);
        remove_inode_hugepages(inode, 0, LLONG_MAX);
-       i_mmap_unlock_write(mapping);
-
        resv_map = (struct resv_map *)inode->i_mapping->private_data;
        /* root inode doesn't have the resv_map, so we should check it */
        if (resv_map)
@@ -496,8 +505,8 @@ static int hugetlb_vmtruncate(struct inode *inode, loff_t offset)
        i_mmap_lock_write(mapping);
        if (!RB_EMPTY_ROOT(&mapping->i_mmap.rb_root))
                hugetlb_vmdelete_list(&mapping->i_mmap, pgoff, 0);
-       remove_inode_hugepages(inode, offset, LLONG_MAX);
        i_mmap_unlock_write(mapping);
+       remove_inode_hugepages(inode, offset, LLONG_MAX);
        return 0;
 }
 
@@ -531,8 +540,8 @@ static long hugetlbfs_punch_hole(struct inode *inode, loff_t offset, loff_t len)
                        hugetlb_vmdelete_list(&mapping->i_mmap,
                                                hole_start >> PAGE_SHIFT,
                                                hole_end  >> PAGE_SHIFT);
-               remove_inode_hugepages(inode, hole_start, hole_end);
                i_mmap_unlock_write(mapping);
+               remove_inode_hugepages(inode, hole_start, hole_end);
                inode_unlock(inode);
        }
 
@@ -615,11 +624,7 @@ static long hugetlbfs_fallocate(struct file *file, int mode, loff_t offset,
                /* addr is the offset within the file (zero based) */
                addr = index * hpage_size;
 
-               /*
-                * fault mutex taken here, protects against fault path
-                * and hole punch.  inode_lock previously taken protects
-                * against truncation.
-                */
+               /* mutex taken here, fault path and hole punch */
                hash = hugetlb_fault_mutex_hash(h, mm, &pseudo_vma, mapping,
                                                index, addr);
                mutex_lock(&hugetlb_fault_mutex_table[hash]);
index feeae80..aa85f28 100644 (file)
@@ -43,7 +43,8 @@ int sysfs_create_dir_ns(struct kobject *kobj, const void *ns)
        kuid_t uid;
        kgid_t gid;
 
-       BUG_ON(!kobj);
+       if (WARN_ON(!kobj))
+               return -EINVAL;
 
        if (kobj->parent)
                parent = kobj->parent->sd;
index bb71db6..5139845 100644 (file)
@@ -325,7 +325,8 @@ int sysfs_create_file_ns(struct kobject *kobj, const struct attribute *attr,
        kuid_t uid;
        kgid_t gid;
 
-       BUG_ON(!kobj || !kobj->sd || !attr);
+       if (WARN_ON(!kobj || !kobj->sd || !attr))
+               return -EINVAL;
 
        kobject_get_ownership(kobj, &uid, &gid);
        return sysfs_add_file_mode_ns(kobj->sd, attr, false, attr->mode,
@@ -537,7 +538,8 @@ int sysfs_create_bin_file(struct kobject *kobj,
        kuid_t uid;
        kgid_t gid;
 
-       BUG_ON(!kobj || !kobj->sd || !attr);
+       if (WARN_ON(!kobj || !kobj->sd || !attr))
+               return -EINVAL;
 
        kobject_get_ownership(kobj, &uid, &gid);
        return sysfs_add_file_mode_ns(kobj->sd, &attr->attr, true,
index 1eb2d63..5703860 100644 (file)
@@ -112,7 +112,8 @@ static int internal_create_group(struct kobject *kobj, int update,
        kgid_t gid;
        int error;
 
-       BUG_ON(!kobj || (!update && !kobj->sd));
+       if (WARN_ON(!kobj || (!update && !kobj->sd)))
+               return -EINVAL;
 
        /* Updates may happen before the object has been instantiated */
        if (unlikely(update && !kobj->sd))
index 215c225..c4deecc 100644 (file)
@@ -23,7 +23,8 @@ static int sysfs_do_create_link_sd(struct kernfs_node *parent,
 {
        struct kernfs_node *kn, *target = NULL;
 
-       BUG_ON(!name || !parent);
+       if (WARN_ON(!name || !parent))
+               return -EINVAL;
 
        /*
         * We don't own @target_kobj and it may be removed at any time.
index 68bb09c..a420c07 100644 (file)
@@ -35,6 +35,7 @@
 #define CEPH_OPT_NOMSGAUTH       (1<<4) /* don't require msg signing feat */
 #define CEPH_OPT_TCP_NODELAY     (1<<5) /* TCP_NODELAY on TCP sockets */
 #define CEPH_OPT_NOMSGSIGN       (1<<6) /* don't sign msgs */
+#define CEPH_OPT_ABORT_ON_FULL   (1<<7) /* abort w/ ENOSPC when full */
 
 #define CEPH_OPT_DEFAULT   (CEPH_OPT_TCP_NODELAY)
 
@@ -53,7 +54,7 @@ struct ceph_options {
        unsigned long osd_request_timeout;      /* jiffies */
 
        /*
-        * any type that can't be simply compared or doesn't need need
+        * any type that can't be simply compared or doesn't need
         * to be compared should go beyond this point,
         * ceph_compare_options() should be updated accordingly
         */
@@ -281,7 +282,8 @@ extern struct ceph_options *ceph_parse_options(char *options,
                              const char *dev_name, const char *dev_name_end,
                              int (*parse_extra_token)(char *c, void *private),
                              void *private);
-int ceph_print_client_options(struct seq_file *m, struct ceph_client *client);
+int ceph_print_client_options(struct seq_file *m, struct ceph_client *client,
+                             bool show_all);
 extern void ceph_destroy_options(struct ceph_options *opt);
 extern int ceph_compare_options(struct ceph_options *new_opt,
                                struct ceph_client *client);
index 7a2af50..2294f96 100644 (file)
@@ -354,7 +354,6 @@ struct ceph_osd_client {
        struct rb_root         linger_map_checks;
        atomic_t               num_requests;
        atomic_t               num_homeless;
-       bool                   abort_on_full; /* abort w/ ENOSPC when full */
        int                    abort_err;
        struct delayed_work    timeout_work;
        struct delayed_work    osds_timeout_work;
index 5776da4..dd8268f 100644 (file)
@@ -68,7 +68,7 @@
  */
 #define uninitialized_var(x) x = x
 
-#ifdef RETPOLINE
+#ifdef CONFIG_RETPOLINE
 #define __noretpoline __attribute__((__indirect_branch__("keep")))
 #endif
 
index cef2127..f6ded99 100644 (file)
@@ -717,15 +717,6 @@ static inline unsigned long dma_max_pfn(struct device *dev)
 }
 #endif
 
-/*
- * Please always use dma_alloc_coherent instead as it already zeroes the memory!
- */
-static inline void *dma_zalloc_coherent(struct device *dev, size_t size,
-                                       dma_addr_t *dma_handle, gfp_t flag)
-{
-       return dma_alloc_coherent(dev, size, dma_handle, flag);
-}
-
 static inline int dma_get_cache_alignment(void)
 {
 #ifdef ARCH_DMA_MINALIGN
index cc4a507..842f918 100644 (file)
@@ -520,6 +520,12 @@ enum pgdat_flags {
        PGDAT_RECLAIM_LOCKED,           /* prevents concurrent reclaim */
 };
 
+enum zone_flags {
+       ZONE_BOOSTED_WATERMARK,         /* zone recently boosted watermarks.
+                                        * Cleared when kswapd is woken.
+                                        */
+};
+
 static inline unsigned long zone_managed_pages(struct zone *zone)
 {
        return (unsigned long)atomic_long_read(&zone->managed_pages);
index 9a21fe3..8fa38d3 100644 (file)
@@ -828,7 +828,7 @@ static inline void module_bug_finalize(const Elf_Ehdr *hdr,
 static inline void module_bug_cleanup(struct module *mod) {}
 #endif /* CONFIG_GENERIC_BUG */
 
-#ifdef RETPOLINE
+#ifdef CONFIG_RETPOLINE
 extern bool retpoline_module_ok(bool has_retpoline);
 #else
 static inline bool retpoline_module_ok(bool has_retpoline)
index cb1adf0..249d4d7 100644 (file)
@@ -24,7 +24,7 @@ static inline void *
 pci_zalloc_consistent(struct pci_dev *hwdev, size_t size,
                      dma_addr_t *dma_handle)
 {
-       return dma_zalloc_coherent(&hwdev->dev, size, dma_handle, GFP_ATOMIC);
+       return dma_alloc_coherent(&hwdev->dev, size, dma_handle, GFP_ATOMIC);
 }
 
 static inline void
index e8e118d..3f350e2 100644 (file)
@@ -42,6 +42,7 @@ enum phy_mode {
        PHY_MODE_PCIE,
        PHY_MODE_ETHERNET,
        PHY_MODE_MIPI_DPHY,
+       PHY_MODE_SATA
 };
 
 /**
index 0a2a88e..b895f4e 100644 (file)
@@ -108,6 +108,7 @@ void dev_pm_opp_put(struct dev_pm_opp *opp);
 int dev_pm_opp_add(struct device *dev, unsigned long freq,
                   unsigned long u_volt);
 void dev_pm_opp_remove(struct device *dev, unsigned long freq);
+void dev_pm_opp_remove_all_dynamic(struct device *dev);
 
 int dev_pm_opp_enable(struct device *dev, unsigned long freq);
 
@@ -217,6 +218,10 @@ static inline void dev_pm_opp_remove(struct device *dev, unsigned long freq)
 {
 }
 
+static inline void dev_pm_opp_remove_all_dynamic(struct device *dev)
+{
+}
+
 static inline int dev_pm_opp_enable(struct device *dev, unsigned long freq)
 {
        return 0;
index 1637385..d0aecc0 100644 (file)
@@ -13,6 +13,7 @@
 #ifndef __QCOM_SCM_H
 #define __QCOM_SCM_H
 
+#include <linux/err.h>
 #include <linux/types.h>
 #include <linux/cpumask.h>
 
index 29af6d6..c1901b6 100644 (file)
@@ -32,6 +32,8 @@ struct reset_control *devm_reset_control_array_get(struct device *dev,
 struct reset_control *of_reset_control_array_get(struct device_node *np,
                                                 bool shared, bool optional);
 
+int reset_control_get_count(struct device *dev);
+
 #else
 
 static inline int reset_control_reset(struct reset_control *rstc)
@@ -97,6 +99,11 @@ of_reset_control_array_get(struct device_node *np, bool shared, bool optional)
        return optional ? NULL : ERR_PTR(-ENOTSUPP);
 }
 
+static inline int reset_control_get_count(struct device *dev)
+{
+       return -ENOENT;
+}
+
 #endif /* CONFIG_RESET_CONTROLLER */
 
 static inline int __must_check device_reset(struct device *dev)
@@ -138,7 +145,7 @@ __must_check reset_control_get_exclusive(struct device *dev, const char *id)
  *
  * Returns a struct reset_control or IS_ERR() condition containing errno.
  * This function is intended for use with reset-controls which are shared
- * between hardware-blocks.
+ * between hardware blocks.
  *
  * When a reset-control is shared, the behavior of reset_control_assert /
  * deassert is changed, the reset-core will keep track of a deassert_count
@@ -187,7 +194,7 @@ static inline struct reset_control *of_reset_control_get_exclusive(
 }
 
 /**
- * of_reset_control_get_shared - Lookup and obtain an shared reference
+ * of_reset_control_get_shared - Lookup and obtain a shared reference
  *                               to a reset controller.
  * @node: device to be reset by the controller
  * @id: reset line name
@@ -229,7 +236,7 @@ static inline struct reset_control *of_reset_control_get_exclusive_by_index(
 }
 
 /**
- * of_reset_control_get_shared_by_index - Lookup and obtain an shared
+ * of_reset_control_get_shared_by_index - Lookup and obtain a shared
  *                                        reference to a reset controller
  *                                        by index.
  * @node: device to be reset by the controller
@@ -322,7 +329,7 @@ devm_reset_control_get_exclusive_by_index(struct device *dev, int index)
 
 /**
  * devm_reset_control_get_shared_by_index - resource managed
- * reset_control_get_shared
+ *                                          reset_control_get_shared
  * @dev: device to be reset by the controller
  * @index: index of the reset controller
  *
index 89541d2..2246662 100644 (file)
@@ -995,7 +995,7 @@ struct task_struct {
        /* cg_list protected by css_set_lock and tsk->alloc_lock: */
        struct list_head                cg_list;
 #endif
-#ifdef CONFIG_RESCTRL
+#ifdef CONFIG_X86_RESCTRL
        u32                             closid;
        u32                             rmid;
 #endif
index 36a7e3f..f28acd9 100644 (file)
@@ -400,6 +400,8 @@ enum {
 /* do not define AUDIT_ARCH_PPCLE since it is not supported by audit */
 #define AUDIT_ARCH_PPC64       (EM_PPC64|__AUDIT_ARCH_64BIT)
 #define AUDIT_ARCH_PPC64LE     (EM_PPC64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
+#define AUDIT_ARCH_RISCV32     (EM_RISCV|__AUDIT_ARCH_LE)
+#define AUDIT_ARCH_RISCV64     (EM_RISCV|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
 #define AUDIT_ARCH_S390                (EM_S390)
 #define AUDIT_ARCH_S390X       (EM_S390|__AUDIT_ARCH_64BIT)
 #define AUDIT_ARCH_SH          (EM_SH)
index a604599..b69248e 100644 (file)
@@ -217,6 +217,7 @@ static unsigned long *alloc_thread_stack_node(struct task_struct *tsk, int node)
                memset(s->addr, 0, THREAD_SIZE);
 
                tsk->stack_vm_area = s;
+               tsk->stack = s->addr;
                return s->addr;
        }
 
@@ -1833,8 +1834,6 @@ static __latent_entropy struct task_struct *copy_process(
 
        posix_cpu_timers_init(p);
 
-       p->start_time = ktime_get_ns();
-       p->real_start_time = ktime_get_boot_ns();
        p->io_context = NULL;
        audit_set_context(p, NULL);
        cgroup_fork(p);
@@ -2001,6 +2000,17 @@ static __latent_entropy struct task_struct *copy_process(
                goto bad_fork_free_pid;
 
        /*
+        * From this point on we must avoid any synchronous user-space
+        * communication until we take the tasklist-lock. In particular, we do
+        * not want user-space to be able to predict the process start-time by
+        * stalling fork(2) after we recorded the start_time but before it is
+        * visible to the system.
+        */
+
+       p->start_time = ktime_get_ns();
+       p->real_start_time = ktime_get_boot_ns();
+
+       /*
         * Make it visible to the rest of the system, but dont wake it up yet.
         * Need tasklist lock for parent etc handling!
         */
index a48cbf1..f7eb62e 100644 (file)
@@ -1207,7 +1207,8 @@ DECLARE_RWSEM(uts_sem);
 /*
  * Work around broken programs that cannot handle "Linux 3.0".
  * Instead we map 3.x to 2.6.40+x, so e.g. 3.0 would be 2.6.40
- * And we map 4.x to 2.6.60+x, so 4.0 would be 2.6.60.
+ * And we map 4.x and later versions to 2.6.60+x, so 4.0/5.0/6.0/... would be
+ * 2.6.60.
  */
 static int override_release(char __user *release, size_t len)
 {
index 7450888..df2e7dd 100644 (file)
@@ -3238,7 +3238,6 @@ int copy_hugetlb_page_range(struct mm_struct *dst, struct mm_struct *src,
        struct page *ptepage;
        unsigned long addr;
        int cow;
-       struct address_space *mapping = vma->vm_file->f_mapping;
        struct hstate *h = hstate_vma(vma);
        unsigned long sz = huge_page_size(h);
        struct mmu_notifier_range range;
@@ -3250,23 +3249,13 @@ int copy_hugetlb_page_range(struct mm_struct *dst, struct mm_struct *src,
                mmu_notifier_range_init(&range, src, vma->vm_start,
                                        vma->vm_end);
                mmu_notifier_invalidate_range_start(&range);
-       } else {
-               /*
-                * For shared mappings i_mmap_rwsem must be held to call
-                * huge_pte_alloc, otherwise the returned ptep could go
-                * away if part of a shared pmd and another thread calls
-                * huge_pmd_unshare.
-                */
-               i_mmap_lock_read(mapping);
        }
 
        for (addr = vma->vm_start; addr < vma->vm_end; addr += sz) {
                spinlock_t *src_ptl, *dst_ptl;
-
                src_pte = huge_pte_offset(src, addr, sz);
                if (!src_pte)
                        continue;
-
                dst_pte = huge_pte_alloc(dst, addr, sz);
                if (!dst_pte) {
                        ret = -ENOMEM;
@@ -3337,8 +3326,6 @@ int copy_hugetlb_page_range(struct mm_struct *dst, struct mm_struct *src,
 
        if (cow)
                mmu_notifier_invalidate_range_end(&range);
-       else
-               i_mmap_unlock_read(mapping);
 
        return ret;
 }
@@ -3755,16 +3742,16 @@ static vm_fault_t hugetlb_no_page(struct mm_struct *mm,
        }
 
        /*
-        * We can not race with truncation due to holding i_mmap_rwsem.
-        * Check once here for faults beyond end of file.
+        * Use page lock to guard against racing truncation
+        * before we get page_table_lock.
         */
-       size = i_size_read(mapping->host) >> huge_page_shift(h);
-       if (idx >= size)
-               goto out;
-
 retry:
        page = find_lock_page(mapping, idx);
        if (!page) {
+               size = i_size_read(mapping->host) >> huge_page_shift(h);
+               if (idx >= size)
+                       goto out;
+
                /*
                 * Check for page in userfault range
                 */
@@ -3784,18 +3771,14 @@ retry:
                        };
 
                        /*
-                        * hugetlb_fault_mutex and i_mmap_rwsem must be
-                        * dropped before handling userfault.  Reacquire
-                        * after handling fault to make calling code simpler.
+                        * hugetlb_fault_mutex must be dropped before
+                        * handling userfault.  Reacquire after handling
+                        * fault to make calling code simpler.
                         */
                        hash = hugetlb_fault_mutex_hash(h, mm, vma, mapping,
                                                        idx, haddr);
                        mutex_unlock(&hugetlb_fault_mutex_table[hash]);
-                       i_mmap_unlock_read(mapping);
-
                        ret = handle_userfault(&vmf, VM_UFFD_MISSING);
-
-                       i_mmap_lock_read(mapping);
                        mutex_lock(&hugetlb_fault_mutex_table[hash]);
                        goto out;
                }
@@ -3854,6 +3837,9 @@ retry:
        }
 
        ptl = huge_pte_lock(h, mm, ptep);
+       size = i_size_read(mapping->host) >> huge_page_shift(h);
+       if (idx >= size)
+               goto backout;
 
        ret = 0;
        if (!huge_pte_none(huge_ptep_get(ptep)))
@@ -3940,11 +3926,6 @@ vm_fault_t hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma,
 
        ptep = huge_pte_offset(mm, haddr, huge_page_size(h));
        if (ptep) {
-               /*
-                * Since we hold no locks, ptep could be stale.  That is
-                * OK as we are only making decisions based on content and
-                * not actually modifying content here.
-                */
                entry = huge_ptep_get(ptep);
                if (unlikely(is_hugetlb_entry_migration(entry))) {
                        migration_entry_wait_huge(vma, mm, ptep);
@@ -3952,33 +3933,20 @@ vm_fault_t hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma,
                } else if (unlikely(is_hugetlb_entry_hwpoisoned(entry)))
                        return VM_FAULT_HWPOISON_LARGE |
                                VM_FAULT_SET_HINDEX(hstate_index(h));
+       } else {
+               ptep = huge_pte_alloc(mm, haddr, huge_page_size(h));
+               if (!ptep)
+                       return VM_FAULT_OOM;
        }
 
-       /*
-        * Acquire i_mmap_rwsem before calling huge_pte_alloc and hold
-        * until finished with ptep.  This serves two purposes:
-        * 1) It prevents huge_pmd_unshare from being called elsewhere
-        *    and making the ptep no longer valid.
-        * 2) It synchronizes us with file truncation.
-        *
-        * ptep could have already be assigned via huge_pte_offset.  That
-        * is OK, as huge_pte_alloc will return the same value unless
-        * something changed.
-        */
        mapping = vma->vm_file->f_mapping;
-       i_mmap_lock_read(mapping);
-       ptep = huge_pte_alloc(mm, haddr, huge_page_size(h));
-       if (!ptep) {
-               i_mmap_unlock_read(mapping);
-               return VM_FAULT_OOM;
-       }
+       idx = vma_hugecache_offset(h, vma, haddr);
 
        /*
         * Serialize hugepage allocation and instantiation, so that we don't
         * get spurious allocation failures if two CPUs race to instantiate
         * the same page in the page cache.
         */
-       idx = vma_hugecache_offset(h, vma, haddr);
        hash = hugetlb_fault_mutex_hash(h, mm, vma, mapping, idx, haddr);
        mutex_lock(&hugetlb_fault_mutex_table[hash]);
 
@@ -4066,7 +4034,6 @@ out_ptl:
        }
 out_mutex:
        mutex_unlock(&hugetlb_fault_mutex_table[hash]);
-       i_mmap_unlock_read(mapping);
        /*
         * Generally it's safe to hold refcount during waiting page lock. But
         * here we just wait to defer the next page fault to avoid busy loop and
@@ -4671,12 +4638,10 @@ void adjust_range_if_pmd_sharing_possible(struct vm_area_struct *vma,
  * Search for a shareable pmd page for hugetlb. In any case calls pmd_alloc()
  * and returns the corresponding pte. While this is not necessary for the
  * !shared pmd case because we can allocate the pmd later as well, it makes the
- * code much cleaner.
- *
- * This routine must be called with i_mmap_rwsem held in at least read mode.
- * For hugetlbfs, this prevents removal of any page table entries associated
- * with the address space.  This is important as we are setting up sharing
- * based on existing page table entries (mappings).
+ * code much cleaner. pmd allocation is essential for the shared case because
+ * pud has to be populated inside the same i_mmap_rwsem section - otherwise
+ * racing tasks could either miss the sharing (see huge_pte_offset) or select a
+ * bad pmd for sharing.
  */
 pte_t *huge_pmd_share(struct mm_struct *mm, unsigned long addr, pud_t *pud)
 {
@@ -4693,6 +4658,7 @@ pte_t *huge_pmd_share(struct mm_struct *mm, unsigned long addr, pud_t *pud)
        if (!vma_shareable(vma, addr))
                return (pte_t *)pmd_alloc(mm, pud, addr);
 
+       i_mmap_lock_write(mapping);
        vma_interval_tree_foreach(svma, &mapping->i_mmap, idx, idx) {
                if (svma == vma)
                        continue;
@@ -4722,6 +4688,7 @@ pte_t *huge_pmd_share(struct mm_struct *mm, unsigned long addr, pud_t *pud)
        spin_unlock(ptl);
 out:
        pte = (pte_t *)pmd_alloc(mm, pud, addr);
+       i_mmap_unlock_write(mapping);
        return pte;
 }
 
@@ -4732,7 +4699,7 @@ out:
  * indicated by page_count > 1, unmap is achieved by clearing pud and
  * decrementing the ref count. If count == 1, the pte page is not shared.
  *
- * Called with page table lock held and i_mmap_rwsem held in write mode.
+ * called with page table lock held.
  *
  * returns: 1 successfully unmapped a shared pte page
  *         0 the underlying pte page is not shared, or it is the last user
index 03d5d13..73c9cbf 100644 (file)
@@ -298,8 +298,6 @@ void kasan_cache_create(struct kmem_cache *cache, unsigned int *size,
                return;
        }
 
-       cache->align = round_up(cache->align, KASAN_SHADOW_SCALE_SIZE);
-
        *flags |= SLAB_KASAN;
 }
 
@@ -349,28 +347,43 @@ void kasan_poison_object_data(struct kmem_cache *cache, void *object)
 }
 
 /*
- * Since it's desirable to only call object contructors once during slab
- * allocation, we preassign tags to all such objects. Also preassign tags for
- * SLAB_TYPESAFE_BY_RCU slabs to avoid use-after-free reports.
- * For SLAB allocator we can't preassign tags randomly since the freelist is
- * stored as an array of indexes instead of a linked list. Assign tags based
- * on objects indexes, so that objects that are next to each other get
- * different tags.
- * After a tag is assigned, the object always gets allocated with the same tag.
- * The reason is that we can't change tags for objects with constructors on
- * reallocation (even for non-SLAB_TYPESAFE_BY_RCU), because the constructor
- * code can save the pointer to the object somewhere (e.g. in the object
- * itself). Then if we retag it, the old saved pointer will become invalid.
+ * This function assigns a tag to an object considering the following:
+ * 1. A cache might have a constructor, which might save a pointer to a slab
+ *    object somewhere (e.g. in the object itself). We preassign a tag for
+ *    each object in caches with constructors during slab creation and reuse
+ *    the same tag each time a particular object is allocated.
+ * 2. A cache might be SLAB_TYPESAFE_BY_RCU, which means objects can be
+ *    accessed after being freed. We preassign tags for objects in these
+ *    caches as well.
+ * 3. For SLAB allocator we can't preassign tags randomly since the freelist
+ *    is stored as an array of indexes instead of a linked list. Assign tags
+ *    based on objects indexes, so that objects that are next to each other
+ *    get different tags.
  */
-static u8 assign_tag(struct kmem_cache *cache, const void *object, bool new)
+static u8 assign_tag(struct kmem_cache *cache, const void *object,
+                       bool init, bool krealloc)
 {
+       /* Reuse the same tag for krealloc'ed objects. */
+       if (krealloc)
+               return get_tag(object);
+
+       /*
+        * If the cache neither has a constructor nor has SLAB_TYPESAFE_BY_RCU
+        * set, assign a tag when the object is being allocated (init == false).
+        */
        if (!cache->ctor && !(cache->flags & SLAB_TYPESAFE_BY_RCU))
-               return new ? KASAN_TAG_KERNEL : random_tag();
+               return init ? KASAN_TAG_KERNEL : random_tag();
 
+       /* For caches that either have a constructor or SLAB_TYPESAFE_BY_RCU: */
 #ifdef CONFIG_SLAB
+       /* For SLAB assign tags based on the object index in the freelist. */
        return (u8)obj_to_index(cache, virt_to_page(object), (void *)object);
 #else
-       return new ? random_tag() : get_tag(object);
+       /*
+        * For SLUB assign a random tag during slab creation, otherwise reuse
+        * the already assigned tag.
+        */
+       return init ? random_tag() : get_tag(object);
 #endif
 }
 
@@ -386,7 +399,8 @@ void * __must_check kasan_init_slab_obj(struct kmem_cache *cache,
        __memset(alloc_info, 0, sizeof(*alloc_info));
 
        if (IS_ENABLED(CONFIG_KASAN_SW_TAGS))
-               object = set_tag(object, assign_tag(cache, object, true));
+               object = set_tag(object,
+                               assign_tag(cache, object, true, false));
 
        return (void *)object;
 }
@@ -452,8 +466,8 @@ bool kasan_slab_free(struct kmem_cache *cache, void *object, unsigned long ip)
        return __kasan_slab_free(cache, object, ip, true);
 }
 
-void * __must_check kasan_kmalloc(struct kmem_cache *cache, const void *object,
-                                       size_t size, gfp_t flags)
+static void *__kasan_kmalloc(struct kmem_cache *cache, const void *object,
+                               size_t size, gfp_t flags, bool krealloc)
 {
        unsigned long redzone_start;
        unsigned long redzone_end;
@@ -471,7 +485,7 @@ void * __must_check kasan_kmalloc(struct kmem_cache *cache, const void *object,
                                KASAN_SHADOW_SCALE_SIZE);
 
        if (IS_ENABLED(CONFIG_KASAN_SW_TAGS))
-               tag = assign_tag(cache, object, false);
+               tag = assign_tag(cache, object, false, krealloc);
 
        /* Tag is ignored in set_tag without CONFIG_KASAN_SW_TAGS */
        kasan_unpoison_shadow(set_tag(object, tag), size);
@@ -483,6 +497,12 @@ void * __must_check kasan_kmalloc(struct kmem_cache *cache, const void *object,
 
        return set_tag(object, tag);
 }
+
+void * __must_check kasan_kmalloc(struct kmem_cache *cache, const void *object,
+                               size_t size, gfp_t flags)
+{
+       return __kasan_kmalloc(cache, object, size, flags, false);
+}
 EXPORT_SYMBOL(kasan_kmalloc);
 
 void * __must_check kasan_kmalloc_large(const void *ptr, size_t size,
@@ -522,7 +542,8 @@ void * __must_check kasan_krealloc(const void *object, size_t size, gfp_t flags)
        if (unlikely(!PageSlab(page)))
                return kasan_kmalloc_large(object, size, flags);
        else
-               return kasan_kmalloc(page->slab_cache, object, size, flags);
+               return __kasan_kmalloc(page->slab_cache, object, size,
+                                               flags, true);
 }
 
 void kasan_poison_kfree(void *ptr, unsigned long ip)
index 6379fff..7c72f2a 100644 (file)
@@ -966,7 +966,7 @@ static bool hwpoison_user_mappings(struct page *p, unsigned long pfn,
        enum ttu_flags ttu = TTU_IGNORE_MLOCK | TTU_IGNORE_ACCESS;
        struct address_space *mapping;
        LIST_HEAD(tokill);
-       bool unmap_success = true;
+       bool unmap_success;
        int kill = 1, forcekill;
        struct page *hpage = *hpagep;
        bool mlocked = PageMlocked(hpage);
@@ -1028,19 +1028,7 @@ static bool hwpoison_user_mappings(struct page *p, unsigned long pfn,
        if (kill)
                collect_procs(hpage, &tokill, flags & MF_ACTION_REQUIRED);
 
-       if (!PageHuge(hpage)) {
-               unmap_success = try_to_unmap(hpage, ttu);
-       } else if (mapping) {
-               /*
-                * For hugetlb pages, try_to_unmap could potentially call
-                * huge_pmd_unshare.  Because of this, take semaphore in
-                * write mode here and set TTU_RMAP_LOCKED to indicate we
-                * have taken the lock at this higer level.
-                */
-               i_mmap_lock_write(mapping);
-               unmap_success = try_to_unmap(hpage, ttu|TTU_RMAP_LOCKED);
-               i_mmap_unlock_write(mapping);
-       }
+       unmap_success = try_to_unmap(hpage, ttu);
        if (!unmap_success)
                pr_err("Memory failure: %#lx: failed to unmap page (mapcount=%d)\n",
                       pfn, page_mapcount(hpage));
index a52663c..e11ca9d 100644 (file)
@@ -2994,6 +2994,28 @@ static vm_fault_t __do_fault(struct vm_fault *vmf)
        struct vm_area_struct *vma = vmf->vma;
        vm_fault_t ret;
 
+       /*
+        * Preallocate pte before we take page_lock because this might lead to
+        * deadlocks for memcg reclaim which waits for pages under writeback:
+        *                              lock_page(A)
+        *                              SetPageWriteback(A)
+        *                              unlock_page(A)
+        * lock_page(B)
+        *                              lock_page(B)
+        * pte_alloc_pne
+        *   shrink_page_list
+        *     wait_on_page_writeback(A)
+        *                              SetPageWriteback(B)
+        *                              unlock_page(B)
+        *                              # flush A, B to clear the writeback
+        */
+       if (pmd_none(*vmf->pmd) && !vmf->prealloc_pte) {
+               vmf->prealloc_pte = pte_alloc_one(vmf->vma->vm_mm);
+               if (!vmf->prealloc_pte)
+                       return VM_FAULT_OOM;
+               smp_wmb(); /* See comment in __pte_alloc() */
+       }
+
        ret = vma->vm_ops->fault(vmf);
        if (unlikely(ret & (VM_FAULT_ERROR | VM_FAULT_NOPAGE | VM_FAULT_RETRY |
                            VM_FAULT_DONE_COW)))
@@ -4077,8 +4099,8 @@ static int __follow_pte_pmd(struct mm_struct *mm, unsigned long address,
                goto out;
 
        if (range) {
-               range->start = address & PAGE_MASK;
-               range->end = range->start + PAGE_SIZE;
+               mmu_notifier_range_init(range, mm, address & PAGE_MASK,
+                                    (address & PAGE_MASK) + PAGE_SIZE);
                mmu_notifier_invalidate_range_start(range);
        }
        ptep = pte_offset_map_lock(mm, pmd, address, ptlp);
index ccf8966..a16b150 100644 (file)
@@ -1324,19 +1324,8 @@ static int unmap_and_move_huge_page(new_page_t get_new_page,
                goto put_anon;
 
        if (page_mapped(hpage)) {
-               struct address_space *mapping = page_mapping(hpage);
-
-               /*
-                * try_to_unmap could potentially call huge_pmd_unshare.
-                * Because of this, take semaphore in write mode here and
-                * set TTU_RMAP_LOCKED to let lower levels know we have
-                * taken the lock.
-                */
-               i_mmap_lock_write(mapping);
                try_to_unmap(hpage,
-                       TTU_MIGRATION|TTU_IGNORE_MLOCK|TTU_IGNORE_ACCESS|
-                       TTU_RMAP_LOCKED);
-               i_mmap_unlock_write(mapping);
+                       TTU_MIGRATION|TTU_IGNORE_MLOCK|TTU_IGNORE_ACCESS);
                page_was_mapped = 1;
        }
 
index cde5dac..d295c9b 100644 (file)
@@ -2214,7 +2214,7 @@ static void steal_suitable_fallback(struct zone *zone, struct page *page,
         */
        boost_watermark(zone);
        if (alloc_flags & ALLOC_KSWAPD)
-               wakeup_kswapd(zone, 0, 0, zone_idx(zone));
+               set_bit(ZONE_BOOSTED_WATERMARK, &zone->flags);
 
        /* We are not allowed to try stealing from the whole block */
        if (!whole_block)
@@ -3102,6 +3102,12 @@ struct page *rmqueue(struct zone *preferred_zone,
        local_irq_restore(flags);
 
 out:
+       /* Separate test+clear to avoid unnecessary atomics */
+       if (test_bit(ZONE_BOOSTED_WATERMARK, &zone->flags)) {
+               clear_bit(ZONE_BOOSTED_WATERMARK, &zone->flags);
+               wakeup_kswapd(zone, 0, 0, zone_idx(zone));
+       }
+
        VM_BUG_ON_PAGE(page && bad_range(zone, page), page);
        return page;
 
index 21a26cf..0454ecc 100644 (file)
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -25,7 +25,6 @@
  *     page->flags PG_locked (lock_page)
  *       hugetlbfs_i_mmap_rwsem_key (in huge_pmd_share)
  *         mapping->i_mmap_rwsem
- *           hugetlb_fault_mutex (hugetlbfs specific page fault mutex)
  *           anon_vma->rwsem
  *             mm->page_table_lock or pte_lock
  *               zone_lru_lock (in mark_page_accessed, isolate_lru_page)
@@ -1372,16 +1371,13 @@ static bool try_to_unmap_one(struct page *page, struct vm_area_struct *vma,
         * Note that the page can not be free in this function as call of
         * try_to_unmap() must hold a reference on the page.
         */
-       mmu_notifier_range_init(&range, vma->vm_mm, vma->vm_start,
-                               min(vma->vm_end, vma->vm_start +
+       mmu_notifier_range_init(&range, vma->vm_mm, address,
+                               min(vma->vm_end, address +
                                    (PAGE_SIZE << compound_order(page))));
        if (PageHuge(page)) {
                /*
                 * If sharing is possible, start and end will be adjusted
                 * accordingly.
-                *
-                * If called for a huge page, caller must hold i_mmap_rwsem
-                * in write mode as it is possible to call huge_pmd_unshare.
                 */
                adjust_range_if_pmd_sharing_possible(vma, &range.start,
                                                     &range.end);
index 73fe23e..78eb8c5 100644 (file)
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -666,8 +666,10 @@ static struct alien_cache *__alloc_alien_cache(int node, int entries,
        struct alien_cache *alc = NULL;
 
        alc = kmalloc_node(memsize, gfp, node);
-       init_arraycache(&alc->ac, entries, batch);
-       spin_lock_init(&alc->lock);
+       if (alc) {
+               init_arraycache(&alc->ac, entries, batch);
+               spin_lock_init(&alc->lock);
+       }
        return alc;
 }
 
index 36c0bef..1e3d0ec 100644 (file)
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -3846,6 +3846,8 @@ void __check_heap_object(const void *ptr, unsigned long n, struct page *page,
        unsigned int offset;
        size_t object_size;
 
+       ptr = kasan_reset_tag(ptr);
+
        /* Find object and usable object size. */
        s = page->slab_cache;
 
index 852eb4e..14faadc 100644 (file)
@@ -247,7 +247,8 @@ static DEFINE_STATIC_KEY_FALSE_RO(bypass_usercopy_checks);
 /*
  * Validates that the given object is:
  * - not bogus address
- * - known-safe heap or stack object
+ * - fully contained by stack (or stack frame, when available)
+ * - fully within SLAB object (or object whitelist area, when available)
  * - not in kernel text
  */
 void __check_object_size(const void *ptr, unsigned long n, bool to_user)
@@ -262,9 +263,6 @@ void __check_object_size(const void *ptr, unsigned long n, bool to_user)
        /* Check for invalid addresses. */
        check_bogus_address((const unsigned long)ptr, n, to_user);
 
-       /* Check for bad heap object. */
-       check_heap_object(ptr, n, to_user);
-
        /* Check for bad stack object. */
        switch (check_stack_object(ptr, n)) {
        case NOT_STACK:
@@ -282,6 +280,9 @@ void __check_object_size(const void *ptr, unsigned long n, bool to_user)
                usercopy_abort("process stack", NULL, to_user, 0, n);
        }
 
+       /* Check for bad heap object. */
+       check_heap_object(ptr, n, to_user);
+
        /* Check for object in kernel to avoid text exposure. */
        check_kernel_text_object((const unsigned long)ptr, n, to_user);
 }
index 065c1ce..d59b5a7 100644 (file)
@@ -267,14 +267,10 @@ retry:
                VM_BUG_ON(dst_addr & ~huge_page_mask(h));
 
                /*
-                * Serialize via i_mmap_rwsem and hugetlb_fault_mutex.
-                * i_mmap_rwsem ensures the dst_pte remains valid even
-                * in the case of shared pmds.  fault mutex prevents
-                * races with other faulting threads.
+                * Serialize via hugetlb_fault_mutex
                 */
-               mapping = dst_vma->vm_file->f_mapping;
-               i_mmap_lock_read(mapping);
                idx = linear_page_index(dst_vma, dst_addr);
+               mapping = dst_vma->vm_file->f_mapping;
                hash = hugetlb_fault_mutex_hash(h, dst_mm, dst_vma, mapping,
                                                                idx, dst_addr);
                mutex_lock(&hugetlb_fault_mutex_table[hash]);
@@ -283,7 +279,6 @@ retry:
                dst_pte = huge_pte_alloc(dst_mm, dst_addr, huge_page_size(h));
                if (!dst_pte) {
                        mutex_unlock(&hugetlb_fault_mutex_table[hash]);
-                       i_mmap_unlock_read(mapping);
                        goto out_unlock;
                }
 
@@ -291,7 +286,6 @@ retry:
                dst_pteval = huge_ptep_get(dst_pte);
                if (!huge_pte_none(dst_pteval)) {
                        mutex_unlock(&hugetlb_fault_mutex_table[hash]);
-                       i_mmap_unlock_read(mapping);
                        goto out_unlock;
                }
 
@@ -299,7 +293,6 @@ retry:
                                                dst_addr, src_addr, &page);
 
                mutex_unlock(&hugetlb_fault_mutex_table[hash]);
-               i_mmap_unlock_read(mapping);
                vm_alloc_shared = vm_shared;
 
                cond_resched();
index 4df23d6..1ea0551 100644 (file)
--- a/mm/util.c
+++ b/mm/util.c
@@ -478,7 +478,7 @@ bool page_mapped(struct page *page)
                return true;
        if (PageHuge(page))
                return false;
-       for (i = 0; i < hpage_nr_pages(page); i++) {
+       for (i = 0; i < (1 << compound_order(page)); i++) {
                if (atomic_read(&page[i]._mapcount) >= 0)
                        return true;
        }
index 87afb9e..9cab802 100644 (file)
@@ -255,6 +255,7 @@ enum {
        Opt_nocephx_sign_messages,
        Opt_tcp_nodelay,
        Opt_notcp_nodelay,
+       Opt_abort_on_full,
 };
 
 static match_table_t opt_tokens = {
@@ -280,6 +281,7 @@ static match_table_t opt_tokens = {
        {Opt_nocephx_sign_messages, "nocephx_sign_messages"},
        {Opt_tcp_nodelay, "tcp_nodelay"},
        {Opt_notcp_nodelay, "notcp_nodelay"},
+       {Opt_abort_on_full, "abort_on_full"},
        {-1, NULL}
 };
 
@@ -535,6 +537,10 @@ ceph_parse_options(char *options, const char *dev_name,
                        opt->flags &= ~CEPH_OPT_TCP_NODELAY;
                        break;
 
+               case Opt_abort_on_full:
+                       opt->flags |= CEPH_OPT_ABORT_ON_FULL;
+                       break;
+
                default:
                        BUG_ON(token);
                }
@@ -549,7 +555,8 @@ out:
 }
 EXPORT_SYMBOL(ceph_parse_options);
 
-int ceph_print_client_options(struct seq_file *m, struct ceph_client *client)
+int ceph_print_client_options(struct seq_file *m, struct ceph_client *client,
+                             bool show_all)
 {
        struct ceph_options *opt = client->options;
        size_t pos = m->count;
@@ -574,6 +581,8 @@ int ceph_print_client_options(struct seq_file *m, struct ceph_client *client)
                seq_puts(m, "nocephx_sign_messages,");
        if ((opt->flags & CEPH_OPT_TCP_NODELAY) == 0)
                seq_puts(m, "notcp_nodelay,");
+       if (show_all && (opt->flags & CEPH_OPT_ABORT_ON_FULL))
+               seq_puts(m, "abort_on_full,");
 
        if (opt->mount_timeout != CEPH_MOUNT_TIMEOUT_DEFAULT)
                seq_printf(m, "mount_timeout=%d,",
index 0295260..46f6570 100644 (file)
@@ -375,7 +375,7 @@ static int client_options_show(struct seq_file *s, void *p)
        struct ceph_client *client = s->private;
        int ret;
 
-       ret = ceph_print_client_options(s, client);
+       ret = ceph_print_client_options(s, client, true);
        if (ret)
                return ret;
 
index d23a9f8..fa9530d 100644 (file)
@@ -2315,7 +2315,7 @@ again:
                   (ceph_osdmap_flag(osdc, CEPH_OSDMAP_FULL) ||
                    pool_full(osdc, req->r_t.base_oloc.pool))) {
                dout("req %p full/pool_full\n", req);
-               if (osdc->abort_on_full) {
+               if (ceph_test_opt(osdc->client, ABORT_ON_FULL)) {
                        err = -ENOSPC;
                } else {
                        pr_warn_ratelimited("FULL or reached pool quota\n");
@@ -2545,7 +2545,7 @@ static void ceph_osdc_abort_on_full(struct ceph_osd_client *osdc)
 {
        bool victims = false;
 
-       if (osdc->abort_on_full &&
+       if (ceph_test_opt(osdc->client, ABORT_ON_FULL) &&
            (ceph_osdmap_flag(osdc, CEPH_OSDMAP_FULL) || have_pool_full(osdc)))
                for_each_request(osdc, abort_on_full_fn, &victims);
 }
index 4920903..fb43a81 100644 (file)
@@ -34,6 +34,7 @@ HOSTCFLAGS_bpf-direct.o += $(MFLAG)
 HOSTCFLAGS_dropper.o += $(MFLAG)
 HOSTCFLAGS_bpf-helper.o += $(MFLAG)
 HOSTCFLAGS_bpf-fancy.o += $(MFLAG)
+HOSTCFLAGS_user-trap.o += $(MFLAG)
 HOSTLDLIBS_bpf-direct += $(MFLAG)
 HOSTLDLIBS_bpf-fancy += $(MFLAG)
 HOSTLDLIBS_dropper += $(MFLAG)
index 408ee38..18fedf7 100644 (file)
@@ -32,7 +32,7 @@ type T;
   (T *)
   \(kmalloc\|kzalloc\|kcalloc\|kmem_cache_alloc\|kmem_cache_zalloc\|
    kmem_cache_alloc_node\|kmalloc_node\|kzalloc_node\|vmalloc\|vzalloc\|
-   dma_alloc_coherent\|dma_zalloc_coherent\|devm_kmalloc\|devm_kzalloc\|
+   dma_alloc_coherent\|devm_kmalloc\|devm_kzalloc\|
    kvmalloc\|kvzalloc\|kvmalloc_node\|kvzalloc_node\|pci_alloc_consistent\|
    pci_zalloc_consistent\|kmem_alloc\|kmem_zalloc\|kmem_zone_alloc\|
    kmem_zone_zalloc\|vmalloc_node\|vzalloc_node\)(...)
@@ -55,7 +55,7 @@ type r1.T;
 * (T *)
   \(kmalloc\|kzalloc\|kcalloc\|kmem_cache_alloc\|kmem_cache_zalloc\|
    kmem_cache_alloc_node\|kmalloc_node\|kzalloc_node\|vmalloc\|vzalloc\|
-   dma_alloc_coherent\|dma_zalloc_coherent\|devm_kmalloc\|devm_kzalloc\|
+   dma_alloc_coherent\|devm_kmalloc\|devm_kzalloc\|
    kvmalloc\|kvzalloc\|kvmalloc_node\|kvzalloc_node\|pci_alloc_consistent\|
    pci_zalloc_consistent\|kmem_alloc\|kmem_zalloc\|kmem_zone_alloc\|
    kmem_zone_zalloc\|vmalloc_node\|vzalloc_node\)(...)
@@ -78,7 +78,7 @@ type r1.T;
 - (T *)
   \(kmalloc\|kzalloc\|kcalloc\|kmem_cache_alloc\|kmem_cache_zalloc\|
    kmem_cache_alloc_node\|kmalloc_node\|kzalloc_node\|vmalloc\|vzalloc\|
-   dma_alloc_coherent\|dma_zalloc_coherent\|devm_kmalloc\|devm_kzalloc\|
+   dma_alloc_coherent\|devm_kmalloc\|devm_kzalloc\|
    kvmalloc\|kvzalloc\|kvmalloc_node\|kvzalloc_node\|pci_alloc_consistent\|
    pci_zalloc_consistent\|kmem_alloc\|kmem_zalloc\|kmem_zone_alloc\|
    kmem_zone_zalloc\|vmalloc_node\|vzalloc_node\)(...)
@@ -95,7 +95,7 @@ position p;
  (T@p *)
   \(kmalloc\|kzalloc\|kcalloc\|kmem_cache_alloc\|kmem_cache_zalloc\|
    kmem_cache_alloc_node\|kmalloc_node\|kzalloc_node\|vmalloc\|vzalloc\|
-   dma_alloc_coherent\|dma_zalloc_coherent\|devm_kmalloc\|devm_kzalloc\|
+   dma_alloc_coherent\|devm_kmalloc\|devm_kzalloc\|
    kvmalloc\|kvzalloc\|kvmalloc_node\|kvzalloc_node\|pci_alloc_consistent\|
    pci_zalloc_consistent\|kmem_alloc\|kmem_zalloc\|kmem_zone_alloc\|
    kmem_zone_zalloc\|vmalloc_node\|vzalloc_node\)(...)
index d819275..5cd1991 100644 (file)
@@ -69,15 +69,6 @@ statement S;
 - x = (T)vmalloc(E1);
 + x = (T)vzalloc(E1);
 |
-- x = dma_alloc_coherent(E2,E1,E3,E4);
-+ x = dma_zalloc_coherent(E2,E1,E3,E4);
-|
-- x = (T *)dma_alloc_coherent(E2,E1,E3,E4);
-+ x = dma_zalloc_coherent(E2,E1,E3,E4);
-|
-- x = (T)dma_alloc_coherent(E2,E1,E3,E4);
-+ x = (T)dma_zalloc_coherent(E2,E1,E3,E4);
-|
 - x = kmalloc_node(E1,E2,E3);
 + x = kzalloc_node(E1,E2,E3);
 |
@@ -225,7 +216,7 @@ p << r2.p;
 x << r2.x;
 @@
 
-msg="WARNING: dma_zalloc_coherent should be used for %s, instead of dma_alloc_coherent/memset" % (x)
+msg="WARNING: dma_alloc_coherent use in %s already zeroes out memory,  so memset is not needed" % (x)
 coccilib.report.print_report(p[0], msg)
 
 //-----------------------------------------------------------------
index 0de2fb2..26bf886 100644 (file)
@@ -2185,7 +2185,7 @@ static void add_intree_flag(struct buffer *b, int is_intree)
 /* Cannot check for assembler */
 static void add_retpoline(struct buffer *b)
 {
-       buf_printf(b, "\n#ifdef RETPOLINE\n");
+       buf_printf(b, "\n#ifdef CONFIG_RETPOLINE\n");
        buf_printf(b, "MODULE_INFO(retpoline, \"Y\");\n");
        buf_printf(b, "#endif\n");
 }
index c3f57a3..40ebde2 100644 (file)
@@ -47,8 +47,8 @@ static int alloc_dbdma_descriptor_ring(struct i2sbus_dev *i2sdev,
        /* We use the PCI APIs for now until the generic one gets fixed
         * enough or until we get some macio-specific versions
         */
-       r->space = dma_zalloc_coherent(&macio_get_pci_dev(i2sdev->macio)->dev,
-                                      r->size, &r->bus_addr, GFP_KERNEL);
+       r->space = dma_alloc_coherent(&macio_get_pci_dev(i2sdev->macio)->dev,
+                                     r->size, &r->bus_addr, GFP_KERNEL);
        if (!r->space)
                return -ENOMEM;
 
index 598d140..5fc497c 100644 (file)
@@ -903,6 +903,9 @@ int cs46xx_dsp_proc_done (struct snd_cs46xx *chip)
        struct dsp_spos_instance * ins = chip->dsp_spos_instance;
        int i;
 
+       if (!ins)
+               return 0;
+
        snd_info_free_entry(ins->proc_sym_info_entry);
        ins->proc_sym_info_entry = NULL;
 
index aee4cbd..0b3e7a1 100644 (file)
@@ -4102,6 +4102,7 @@ static void alc_headset_mode_unplugged(struct hda_codec *codec)
        case 0x10ec0295:
        case 0x10ec0289:
        case 0x10ec0299:
+               alc_process_coef_fw(codec, alc225_pre_hsmode);
                alc_process_coef_fw(codec, coef0225);
                break;
        case 0x10ec0867:
@@ -5440,6 +5441,13 @@ static void alc_fixup_headset_jack(struct hda_codec *codec,
        }
 }
 
+static void alc_fixup_disable_mic_vref(struct hda_codec *codec,
+                                 const struct hda_fixup *fix, int action)
+{
+       if (action == HDA_FIXUP_ACT_PRE_PROBE)
+               snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
+}
+
 /* for hda_fixup_thinkpad_acpi() */
 #include "thinkpad_helper.c"
 
@@ -5549,6 +5557,7 @@ enum {
        ALC293_FIXUP_LENOVO_SPK_NOISE,
        ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
        ALC255_FIXUP_DELL_SPK_NOISE,
+       ALC225_FIXUP_DISABLE_MIC_VREF,
        ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
        ALC295_FIXUP_DISABLE_DAC3,
        ALC280_FIXUP_HP_HEADSET_MIC,
@@ -6268,6 +6277,12 @@ static const struct hda_fixup alc269_fixups[] = {
                .chained = true,
                .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
        },
+       [ALC225_FIXUP_DISABLE_MIC_VREF] = {
+               .type = HDA_FIXUP_FUNC,
+               .v.func = alc_fixup_disable_mic_vref,
+               .chained = true,
+               .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
+       },
        [ALC225_FIXUP_DELL1_MIC_NO_PRESENCE] = {
                .type = HDA_FIXUP_VERBS,
                .v.verbs = (const struct hda_verb[]) {
@@ -6277,7 +6292,7 @@ static const struct hda_fixup alc269_fixups[] = {
                        {}
                },
                .chained = true,
-               .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
+               .chain_id = ALC225_FIXUP_DISABLE_MIC_VREF
        },
        [ALC280_FIXUP_HP_HEADSET_MIC] = {
                .type = HDA_FIXUP_FUNC,
@@ -6584,6 +6599,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
        SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
        SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
        SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB),
+       SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
        SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
        SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
        SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
index 7609ece..9e71d7c 100644 (file)
@@ -2541,8 +2541,8 @@ static int snd_dbri_create(struct snd_card *card,
        dbri->op = op;
        dbri->irq = irq;
 
-       dbri->dma = dma_zalloc_coherent(&op->dev, sizeof(struct dbri_dma),
-                                       &dbri->dma_dvma, GFP_KERNEL);
+       dbri->dma = dma_alloc_coherent(&op->dev, sizeof(struct dbri_dma),
+                                      &dbri->dma_dvma, GFP_KERNEL);
        if (!dbri->dma)
                return -ENOMEM;
 
index a105947..746a72e 100644 (file)
@@ -246,7 +246,7 @@ static int snd_usb_create_streams(struct snd_usb_audio *chip, int ctrlif)
                h1 = snd_usb_find_csint_desc(host_iface->extra,
                                                         host_iface->extralen,
                                                         NULL, UAC_HEADER);
-               if (!h1) {
+               if (!h1 || h1->bLength < sizeof(*h1)) {
                        dev_err(&dev->dev, "cannot find UAC_HEADER\n");
                        return -EINVAL;
                }
index c63c84b..e7d441d 100644 (file)
@@ -753,8 +753,9 @@ static int uac_mixer_unit_get_channels(struct mixer_build *state,
                                       struct uac_mixer_unit_descriptor *desc)
 {
        int mu_channels;
+       void *c;
 
-       if (desc->bLength < 11)
+       if (desc->bLength < sizeof(*desc))
                return -EINVAL;
        if (!desc->bNrInPins)
                return -EINVAL;
@@ -763,6 +764,8 @@ static int uac_mixer_unit_get_channels(struct mixer_build *state,
        case UAC_VERSION_1:
        case UAC_VERSION_2:
        default:
+               if (desc->bLength < sizeof(*desc) + desc->bNrInPins + 1)
+                       return 0; /* no bmControls -> skip */
                mu_channels = uac_mixer_unit_bNrChannels(desc);
                break;
        case UAC_VERSION_3:
@@ -772,7 +775,11 @@ static int uac_mixer_unit_get_channels(struct mixer_build *state,
        }
 
        if (!mu_channels)
-               return -EINVAL;
+               return 0;
+
+       c = uac_mixer_unit_bmControls(desc, state->mixer->protocol);
+       if (c - (void *)desc + (mu_channels - 1) / 8 >= desc->bLength)
+               return 0; /* no bmControls -> skip */
 
        return mu_channels;
 }
@@ -944,7 +951,7 @@ static int check_input_term(struct mixer_build *state, int id,
                                struct uac_mixer_unit_descriptor *d = p1;
 
                                err = uac_mixer_unit_get_channels(state, d);
-                               if (err < 0)
+                               if (err <= 0)
                                        return err;
 
                                term->channels = err;
@@ -2068,11 +2075,15 @@ static int parse_audio_input_terminal(struct mixer_build *state, int unitid,
 
        if (state->mixer->protocol == UAC_VERSION_2) {
                struct uac2_input_terminal_descriptor *d_v2 = raw_desc;
+               if (d_v2->bLength < sizeof(*d_v2))
+                       return -EINVAL;
                control = UAC2_TE_CONNECTOR;
                term_id = d_v2->bTerminalID;
                bmctls = le16_to_cpu(d_v2->bmControls);
        } else if (state->mixer->protocol == UAC_VERSION_3) {
                struct uac3_input_terminal_descriptor *d_v3 = raw_desc;
+               if (d_v3->bLength < sizeof(*d_v3))
+                       return -EINVAL;
                control = UAC3_TE_INSERTION;
                term_id = d_v3->bTerminalID;
                bmctls = le32_to_cpu(d_v3->bmControls);
@@ -2118,7 +2129,7 @@ static int parse_audio_mixer_unit(struct mixer_build *state, int unitid,
                if (err < 0)
                        continue;
                /* no bmControls field (e.g. Maya44) -> ignore */
-               if (desc->bLength <= 10 + input_pins)
+               if (!num_outs)
                        continue;
                err = check_input_term(state, desc->baSourceID[pin], &iterm);
                if (err < 0)
@@ -2314,7 +2325,7 @@ static int build_audio_procunit(struct mixer_build *state, int unitid,
                                char *name)
 {
        struct uac_processing_unit_descriptor *desc = raw_desc;
-       int num_ins = desc->bNrInPins;
+       int num_ins;
        struct usb_mixer_elem_info *cval;
        struct snd_kcontrol *kctl;
        int i, err, nameid, type, len;
@@ -2329,7 +2340,13 @@ static int build_audio_procunit(struct mixer_build *state, int unitid,
                0, NULL, default_value_info
        };
 
-       if (desc->bLength < 13 || desc->bLength < 13 + num_ins ||
+       if (desc->bLength < 13) {
+               usb_audio_err(state->chip, "invalid %s descriptor (id %d)\n", name, unitid);
+               return -EINVAL;
+       }
+
+       num_ins = desc->bNrInPins;
+       if (desc->bLength < 13 + num_ins ||
            desc->bLength < num_ins + uac_processing_unit_bControlSize(desc, state->mixer->protocol)) {
                usb_audio_err(state->chip, "invalid %s descriptor (id %d)\n", name, unitid);
                return -EINVAL;
index 37fc044..b345beb 100644 (file)
@@ -3326,6 +3326,9 @@ AU0828_DEVICE(0x2040, 0x7270, "Hauppauge", "HVR-950Q"),
                                        }
                                }
                        },
+                       {
+                               .ifnum = -1
+                       },
                }
        }
 },
@@ -3369,6 +3372,9 @@ AU0828_DEVICE(0x2040, 0x7270, "Hauppauge", "HVR-950Q"),
                                        }
                                }
                        },
+                       {
+                               .ifnum = -1
+                       },
                }
        }
 },
index 96340f2..ebbadb3 100644 (file)
@@ -768,7 +768,7 @@ static int snd_usb_cm6206_boot_quirk(struct usb_device *dev)
                 * REG1: PLL binary search enable, soft mute enable.
                 */
                CM6206_REG1_PLLBIN_EN |
-               CM6206_REG1_SOFT_MUTE_EN |
+               CM6206_REG1_SOFT_MUTE_EN,
                /*
                 * REG2: enable output drivers,
                 * select front channels to the headphone output,
index 67cf849..d9e3de4 100644 (file)
@@ -596,12 +596,8 @@ static int parse_uac_endpoint_attributes(struct snd_usb_audio *chip,
                csep = snd_usb_find_desc(alts->extra, alts->extralen, NULL, USB_DT_CS_ENDPOINT);
 
        if (!csep || csep->bLength < 7 ||
-           csep->bDescriptorSubtype != UAC_EP_GENERAL) {
-               usb_audio_warn(chip,
-                              "%u:%d : no or invalid class specific endpoint descriptor\n",
-                              iface_no, altsd->bAlternateSetting);
-               return 0;
-       }
+           csep->bDescriptorSubtype != UAC_EP_GENERAL)
+               goto error;
 
        if (protocol == UAC_VERSION_1) {
                attributes = csep->bmAttributes;
@@ -609,6 +605,8 @@ static int parse_uac_endpoint_attributes(struct snd_usb_audio *chip,
                struct uac2_iso_endpoint_descriptor *csep2 =
                        (struct uac2_iso_endpoint_descriptor *) csep;
 
+               if (csep2->bLength < sizeof(*csep2))
+                       goto error;
                attributes = csep->bmAttributes & UAC_EP_CS_ATTR_FILL_MAX;
 
                /* emulate the endpoint attributes of a v1 device */
@@ -618,12 +616,20 @@ static int parse_uac_endpoint_attributes(struct snd_usb_audio *chip,
                struct uac3_iso_endpoint_descriptor *csep3 =
                        (struct uac3_iso_endpoint_descriptor *) csep;
 
+               if (csep3->bLength < sizeof(*csep3))
+                       goto error;
                /* emulate the endpoint attributes of a v1 device */
                if (le32_to_cpu(csep3->bmControls) & UAC2_CONTROL_PITCH)
                        attributes |= UAC_EP_CS_ATTR_PITCH_CONTROL;
        }
 
        return attributes;
+
+ error:
+       usb_audio_warn(chip,
+                      "%u:%d : no or invalid class specific endpoint descriptor\n",
+                      iface_no, altsd->bAlternateSetting);
+       return 0;
 }
 
 /* find an input terminal descriptor (either UAC1 or UAC2) with the given
@@ -631,13 +637,17 @@ static int parse_uac_endpoint_attributes(struct snd_usb_audio *chip,
  */
 static void *
 snd_usb_find_input_terminal_descriptor(struct usb_host_interface *ctrl_iface,
-                                              int terminal_id)
+                                      int terminal_id, bool uac23)
 {
        struct uac2_input_terminal_descriptor *term = NULL;
+       size_t minlen = uac23 ? sizeof(struct uac2_input_terminal_descriptor) :
+               sizeof(struct uac_input_terminal_descriptor);
 
        while ((term = snd_usb_find_csint_desc(ctrl_iface->extra,
                                               ctrl_iface->extralen,
                                               term, UAC_INPUT_TERMINAL))) {
+               if (term->bLength < minlen)
+                       continue;
                if (term->bTerminalID == terminal_id)
                        return term;
        }
@@ -655,7 +665,8 @@ snd_usb_find_output_terminal_descriptor(struct usb_host_interface *ctrl_iface,
        while ((term = snd_usb_find_csint_desc(ctrl_iface->extra,
                                               ctrl_iface->extralen,
                                               term, UAC_OUTPUT_TERMINAL))) {
-               if (term->bTerminalID == terminal_id)
+               if (term->bLength >= sizeof(*term) &&
+                   term->bTerminalID == terminal_id)
                        return term;
        }
 
@@ -729,7 +740,8 @@ snd_usb_get_audioformat_uac12(struct snd_usb_audio *chip,
                format = le16_to_cpu(as->wFormatTag); /* remember the format value */
 
                iterm = snd_usb_find_input_terminal_descriptor(chip->ctrl_intf,
-                                                            as->bTerminalLink);
+                                                              as->bTerminalLink,
+                                                              false);
                if (iterm) {
                        num_channels = iterm->bNrChannels;
                        chconfig = le16_to_cpu(iterm->wChannelConfig);
@@ -764,7 +776,8 @@ snd_usb_get_audioformat_uac12(struct snd_usb_audio *chip,
                 * to extract the clock
                 */
                input_term = snd_usb_find_input_terminal_descriptor(chip->ctrl_intf,
-                                                                   as->bTerminalLink);
+                                                                   as->bTerminalLink,
+                                                                   true);
                if (input_term) {
                        clock = input_term->bCSourceID;
                        if (!chconfig && (num_channels == input_term->bNrChannels))
@@ -998,7 +1011,8 @@ snd_usb_get_audioformat_uac3(struct snd_usb_audio *chip,
         * to extract the clock
         */
        input_term = snd_usb_find_input_terminal_descriptor(chip->ctrl_intf,
-                                                           as->bTerminalLink);
+                                                           as->bTerminalLink,
+                                                           true);
        if (input_term) {
                clock = input_term->bCSourceID;
                goto found_clock;
diff --git a/tools/arch/powerpc/include/uapi/asm/unistd.h b/tools/arch/powerpc/include/uapi/asm/unistd.h
deleted file mode 100644 (file)
index 985534d..0000000
+++ /dev/null
@@ -1,404 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
-/*
- * This file contains the system call numbers.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version
- * 2 of the License, or (at your option) any later version.
- */
-#ifndef _UAPI_ASM_POWERPC_UNISTD_H_
-#define _UAPI_ASM_POWERPC_UNISTD_H_
-
-
-#define __NR_restart_syscall     0
-#define __NR_exit                1
-#define __NR_fork                2
-#define __NR_read                3
-#define __NR_write               4
-#define __NR_open                5
-#define __NR_close               6
-#define __NR_waitpid             7
-#define __NR_creat               8
-#define __NR_link                9
-#define __NR_unlink             10
-#define __NR_execve             11
-#define __NR_chdir              12
-#define __NR_time               13
-#define __NR_mknod              14
-#define __NR_chmod              15
-#define __NR_lchown             16
-#define __NR_break              17
-#define __NR_oldstat            18
-#define __NR_lseek              19
-#define __NR_getpid             20
-#define __NR_mount              21
-#define __NR_umount             22
-#define __NR_setuid             23
-#define __NR_getuid             24
-#define __NR_stime              25
-#define __NR_ptrace             26
-#define __NR_alarm              27
-#define __NR_oldfstat           28
-#define __NR_pause              29
-#define __NR_utime              30
-#define __NR_stty               31
-#define __NR_gtty               32
-#define __NR_access             33
-#define __NR_nice               34
-#define __NR_ftime              35
-#define __NR_sync               36
-#define __NR_kill               37
-#define __NR_rename             38
-#define __NR_mkdir              39
-#define __NR_rmdir              40
-#define __NR_dup                41
-#define __NR_pipe               42
-#define __NR_times              43
-#define __NR_prof               44
-#define __NR_brk                45
-#define __NR_setgid             46
-#define __NR_getgid             47
-#define __NR_signal             48
-#define __NR_geteuid            49
-#define __NR_getegid            50
-#define __NR_acct               51
-#define __NR_umount2            52
-#define __NR_lock               53
-#define __NR_ioctl              54
-#define __NR_fcntl              55
-#define __NR_mpx                56
-#define __NR_setpgid            57
-#define __NR_ulimit             58
-#define __NR_oldolduname        59
-#define __NR_umask              60
-#define __NR_chroot             61
-#define __NR_ustat              62
-#define __NR_dup2               63
-#define __NR_getppid            64
-#define __NR_getpgrp            65
-#define __NR_setsid             66
-#define __NR_sigaction          67
-#define __NR_sgetmask           68
-#define __NR_ssetmask           69
-#define __NR_setreuid           70
-#define __NR_setregid           71
-#define __NR_sigsuspend                 72
-#define __NR_sigpending                 73
-#define __NR_sethostname        74
-#define __NR_setrlimit          75
-#define __NR_getrlimit          76
-#define __NR_getrusage          77
-#define __NR_gettimeofday       78
-#define __NR_settimeofday       79
-#define __NR_getgroups          80
-#define __NR_setgroups          81
-#define __NR_select             82
-#define __NR_symlink            83
-#define __NR_oldlstat           84
-#define __NR_readlink           85
-#define __NR_uselib             86
-#define __NR_swapon             87
-#define __NR_reboot             88
-#define __NR_readdir            89
-#define __NR_mmap               90
-#define __NR_munmap             91
-#define __NR_truncate           92
-#define __NR_ftruncate          93
-#define __NR_fchmod             94
-#define __NR_fchown             95
-#define __NR_getpriority        96
-#define __NR_setpriority        97
-#define __NR_profil             98
-#define __NR_statfs             99
-#define __NR_fstatfs           100
-#define __NR_ioperm            101
-#define __NR_socketcall                102
-#define __NR_syslog            103
-#define __NR_setitimer         104
-#define __NR_getitimer         105
-#define __NR_stat              106
-#define __NR_lstat             107
-#define __NR_fstat             108
-#define __NR_olduname          109
-#define __NR_iopl              110
-#define __NR_vhangup           111
-#define __NR_idle              112
-#define __NR_vm86              113
-#define __NR_wait4             114
-#define __NR_swapoff           115
-#define __NR_sysinfo           116
-#define __NR_ipc               117
-#define __NR_fsync             118
-#define __NR_sigreturn         119
-#define __NR_clone             120
-#define __NR_setdomainname     121
-#define __NR_uname             122
-#define __NR_modify_ldt                123
-#define __NR_adjtimex          124
-#define __NR_mprotect          125
-#define __NR_sigprocmask       126
-#define __NR_create_module     127
-#define __NR_init_module       128
-#define __NR_delete_module     129
-#define __NR_get_kernel_syms   130
-#define __NR_quotactl          131
-#define __NR_getpgid           132
-#define __NR_fchdir            133
-#define __NR_bdflush           134
-#define __NR_sysfs             135
-#define __NR_personality       136
-#define __NR_afs_syscall       137 /* Syscall for Andrew File System */
-#define __NR_setfsuid          138
-#define __NR_setfsgid          139
-#define __NR__llseek           140
-#define __NR_getdents          141
-#define __NR__newselect                142
-#define __NR_flock             143
-#define __NR_msync             144
-#define __NR_readv             145
-#define __NR_writev            146
-#define __NR_getsid            147
-#define __NR_fdatasync         148
-#define __NR__sysctl           149
-#define __NR_mlock             150
-#define __NR_munlock           151
-#define __NR_mlockall          152
-#define __NR_munlockall                153
-#define __NR_sched_setparam            154
-#define __NR_sched_getparam            155
-#define __NR_sched_setscheduler                156
-#define __NR_sched_getscheduler                157
-#define __NR_sched_yield               158
-#define __NR_sched_get_priority_max    159
-#define __NR_sched_get_priority_min    160
-#define __NR_sched_rr_get_interval     161
-#define __NR_nanosleep         162
-#define __NR_mremap            163
-#define __NR_setresuid         164
-#define __NR_getresuid         165
-#define __NR_query_module      166
-#define __NR_poll              167
-#define __NR_nfsservctl                168
-#define __NR_setresgid         169
-#define __NR_getresgid         170
-#define __NR_prctl             171
-#define __NR_rt_sigreturn      172
-#define __NR_rt_sigaction      173
-#define __NR_rt_sigprocmask    174
-#define __NR_rt_sigpending     175
-#define __NR_rt_sigtimedwait   176
-#define __NR_rt_sigqueueinfo   177
-#define __NR_rt_sigsuspend     178
-#define __NR_pread64           179
-#define __NR_pwrite64          180
-#define __NR_chown             181
-#define __NR_getcwd            182
-#define __NR_capget            183
-#define __NR_capset            184
-#define __NR_sigaltstack       185
-#define __NR_sendfile          186
-#define __NR_getpmsg           187     /* some people actually want streams */
-#define __NR_putpmsg           188     /* some people actually want streams */
-#define __NR_vfork             189
-#define __NR_ugetrlimit                190     /* SuS compliant getrlimit */
-#define __NR_readahead         191
-#ifndef __powerpc64__                  /* these are 32-bit only */
-#define __NR_mmap2             192
-#define __NR_truncate64                193
-#define __NR_ftruncate64       194
-#define __NR_stat64            195
-#define __NR_lstat64           196
-#define __NR_fstat64           197
-#endif
-#define __NR_pciconfig_read    198
-#define __NR_pciconfig_write   199
-#define __NR_pciconfig_iobase  200
-#define __NR_multiplexer       201
-#define __NR_getdents64                202
-#define __NR_pivot_root                203
-#ifndef __powerpc64__
-#define __NR_fcntl64           204
-#endif
-#define __NR_madvise           205
-#define __NR_mincore           206
-#define __NR_gettid            207
-#define __NR_tkill             208
-#define __NR_setxattr          209
-#define __NR_lsetxattr         210
-#define __NR_fsetxattr         211
-#define __NR_getxattr          212
-#define __NR_lgetxattr         213
-#define __NR_fgetxattr         214
-#define __NR_listxattr         215
-#define __NR_llistxattr                216
-#define __NR_flistxattr                217
-#define __NR_removexattr       218
-#define __NR_lremovexattr      219
-#define __NR_fremovexattr      220
-#define __NR_futex             221
-#define __NR_sched_setaffinity 222
-#define __NR_sched_getaffinity 223
-/* 224 currently unused */
-#define __NR_tuxcall           225
-#ifndef __powerpc64__
-#define __NR_sendfile64                226
-#endif
-#define __NR_io_setup          227
-#define __NR_io_destroy                228
-#define __NR_io_getevents      229
-#define __NR_io_submit         230
-#define __NR_io_cancel         231
-#define __NR_set_tid_address   232
-#define __NR_fadvise64         233
-#define __NR_exit_group                234
-#define __NR_lookup_dcookie    235
-#define __NR_epoll_create      236
-#define __NR_epoll_ctl         237
-#define __NR_epoll_wait                238
-#define __NR_remap_file_pages  239
-#define __NR_timer_create      240
-#define __NR_timer_settime     241
-#define __NR_timer_gettime     242
-#define __NR_timer_getoverrun  243
-#define __NR_timer_delete      244
-#define __NR_clock_settime     245
-#define __NR_clock_gettime     246
-#define __NR_clock_getres      247
-#define __NR_clock_nanosleep   248
-#define __NR_swapcontext       249
-#define __NR_tgkill            250
-#define __NR_utimes            251
-#define __NR_statfs64          252
-#define __NR_fstatfs64         253
-#ifndef __powerpc64__
-#define __NR_fadvise64_64      254
-#endif
-#define __NR_rtas              255
-#define __NR_sys_debug_setcontext 256
-/* Number 257 is reserved for vserver */
-#define __NR_migrate_pages     258
-#define __NR_mbind             259
-#define __NR_get_mempolicy     260
-#define __NR_set_mempolicy     261
-#define __NR_mq_open           262
-#define __NR_mq_unlink         263
-#define __NR_mq_timedsend      264
-#define __NR_mq_timedreceive   265
-#define __NR_mq_notify         266
-#define __NR_mq_getsetattr     267
-#define __NR_kexec_load                268
-#define __NR_add_key           269
-#define __NR_request_key       270
-#define __NR_keyctl            271
-#define __NR_waitid            272
-#define __NR_ioprio_set                273
-#define __NR_ioprio_get                274
-#define __NR_inotify_init      275
-#define __NR_inotify_add_watch 276
-#define __NR_inotify_rm_watch  277
-#define __NR_spu_run           278
-#define __NR_spu_create                279
-#define __NR_pselect6          280
-#define __NR_ppoll             281
-#define __NR_unshare           282
-#define __NR_splice            283
-#define __NR_tee               284
-#define __NR_vmsplice          285
-#define __NR_openat            286
-#define __NR_mkdirat           287
-#define __NR_mknodat           288
-#define __NR_fchownat          289
-#define __NR_futimesat         290
-#ifdef __powerpc64__
-#define __NR_newfstatat                291
-#else
-#define __NR_fstatat64         291
-#endif
-#define __NR_unlinkat          292
-#define __NR_renameat          293
-#define __NR_linkat            294
-#define __NR_symlinkat         295
-#define __NR_readlinkat                296
-#define __NR_fchmodat          297
-#define __NR_faccessat         298
-#define __NR_get_robust_list   299
-#define __NR_set_robust_list   300
-#define __NR_move_pages                301
-#define __NR_getcpu            302
-#define __NR_epoll_pwait       303
-#define __NR_utimensat         304
-#define __NR_signalfd          305
-#define __NR_timerfd_create    306
-#define __NR_eventfd           307
-#define __NR_sync_file_range2  308
-#define __NR_fallocate         309
-#define __NR_subpage_prot      310
-#define __NR_timerfd_settime   311
-#define __NR_timerfd_gettime   312
-#define __NR_signalfd4         313
-#define __NR_eventfd2          314
-#define __NR_epoll_create1     315
-#define __NR_dup3              316
-#define __NR_pipe2             317
-#define __NR_inotify_init1     318
-#define __NR_perf_event_open   319
-#define __NR_preadv            320
-#define __NR_pwritev           321
-#define __NR_rt_tgsigqueueinfo 322
-#define __NR_fanotify_init     323
-#define __NR_fanotify_mark     324
-#define __NR_prlimit64         325
-#define __NR_socket            326
-#define __NR_bind              327
-#define __NR_connect           328
-#define __NR_listen            329
-#define __NR_accept            330
-#define __NR_getsockname       331
-#define __NR_getpeername       332
-#define __NR_socketpair                333
-#define __NR_send              334
-#define __NR_sendto            335
-#define __NR_recv              336
-#define __NR_recvfrom          337
-#define __NR_shutdown          338
-#define __NR_setsockopt                339
-#define __NR_getsockopt                340
-#define __NR_sendmsg           341
-#define __NR_recvmsg           342
-#define __NR_recvmmsg          343
-#define __NR_accept4           344
-#define __NR_name_to_handle_at 345
-#define __NR_open_by_handle_at 346
-#define __NR_clock_adjtime     347
-#define __NR_syncfs            348
-#define __NR_sendmmsg          349
-#define __NR_setns             350
-#define __NR_process_vm_readv  351
-#define __NR_process_vm_writev 352
-#define __NR_finit_module      353
-#define __NR_kcmp              354
-#define __NR_sched_setattr     355
-#define __NR_sched_getattr     356
-#define __NR_renameat2         357
-#define __NR_seccomp           358
-#define __NR_getrandom         359
-#define __NR_memfd_create      360
-#define __NR_bpf               361
-#define __NR_execveat          362
-#define __NR_switch_endian     363
-#define __NR_userfaultfd       364
-#define __NR_membarrier                365
-#define __NR_mlock2            378
-#define __NR_copy_file_range   379
-#define __NR_preadv2           380
-#define __NR_pwritev2          381
-#define __NR_kexec_file_load   382
-#define __NR_statx             383
-#define __NR_pkey_alloc                384
-#define __NR_pkey_free         385
-#define __NR_pkey_mprotect     386
-#define __NR_rseq              387
-#define __NR_io_pgetevents     388
-
-#endif /* _UAPI_ASM_POWERPC_UNISTD_H_ */
diff --git a/tools/arch/riscv/include/uapi/asm/bitsperlong.h b/tools/arch/riscv/include/uapi/asm/bitsperlong.h
new file mode 100644 (file)
index 0000000..0b3cb52
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2012 ARM Ltd.
+ * Copyright (C) 2015 Regents of the University of California
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef _UAPI_ASM_RISCV_BITSPERLONG_H
+#define _UAPI_ASM_RISCV_BITSPERLONG_H
+
+#define __BITS_PER_LONG (__SIZEOF_POINTER__ * 8)
+
+#include <asm-generic/bitsperlong.h>
+
+#endif /* _UAPI_ASM_RISCV_BITSPERLONG_H */
index 28c4a50..6d61225 100644 (file)
 #define X86_FEATURE_CLZERO             (13*32+ 0) /* CLZERO instruction */
 #define X86_FEATURE_IRPERF             (13*32+ 1) /* Instructions Retired Count */
 #define X86_FEATURE_XSAVEERPTR         (13*32+ 2) /* Always save/restore FP error pointers */
+#define X86_FEATURE_WBNOINVD           (13*32+ 9) /* WBNOINVD instruction */
 #define X86_FEATURE_AMD_IBPB           (13*32+12) /* "" Indirect Branch Prediction Barrier */
 #define X86_FEATURE_AMD_IBRS           (13*32+14) /* "" Indirect Branch Restricted Speculation */
 #define X86_FEATURE_AMD_STIBP          (13*32+15) /* "" Single Thread Indirect Branch Predictors */
+#define X86_FEATURE_AMD_STIBP_ALWAYS_ON        (13*32+17) /* "" Single Thread Indirect Branch Predictors always-on preferred */
 #define X86_FEATURE_AMD_SSBD           (13*32+24) /* "" Speculative Store Bypass Disable */
 #define X86_FEATURE_VIRT_SSBD          (13*32+25) /* Virtualized Speculative Store Bypass Disable */
 #define X86_FEATURE_AMD_SSB_NO         (13*32+26) /* "" Speculative Store Bypass is fixed in hardware. */
index 33833d1..a5ea841 100644 (file)
 # define DISABLE_MPX   (1<<(X86_FEATURE_MPX & 31))
 #endif
 
+#ifdef CONFIG_X86_SMAP
+# define DISABLE_SMAP  0
+#else
+# define DISABLE_SMAP  (1<<(X86_FEATURE_SMAP & 31))
+#endif
+
 #ifdef CONFIG_X86_INTEL_UMIP
 # define DISABLE_UMIP  0
 #else
@@ -68,7 +74,7 @@
 #define DISABLED_MASK6 0
 #define DISABLED_MASK7 (DISABLE_PTI)
 #define DISABLED_MASK8 0
-#define DISABLED_MASK9 (DISABLE_MPX)
+#define DISABLED_MASK9 (DISABLE_MPX|DISABLE_SMAP)
 #define DISABLED_MASK10        0
 #define DISABLED_MASK11        0
 #define DISABLED_MASK12        0
index c7f3321..d901272 100644 (file)
@@ -738,9 +738,11 @@ __SYSCALL(__NR_statx,     sys_statx)
 __SC_COMP(__NR_io_pgetevents, sys_io_pgetevents, compat_sys_io_pgetevents)
 #define __NR_rseq 293
 __SYSCALL(__NR_rseq, sys_rseq)
+#define __NR_kexec_file_load 294
+__SYSCALL(__NR_kexec_file_load,     sys_kexec_file_load)
 
 #undef __NR_syscalls
-#define __NR_syscalls 294
+#define __NR_syscalls 295
 
 /*
  * 32 bit systems traditionally used different
index 8dd6aef..fd92ce8 100644 (file)
@@ -13,6 +13,8 @@
 #include "../../arch/mips/include/uapi/asm/bitsperlong.h"
 #elif defined(__ia64__)
 #include "../../arch/ia64/include/uapi/asm/bitsperlong.h"
+#elif defined(__riscv)
+#include "../../arch/riscv/include/uapi/asm/bitsperlong.h"
 #else
 #include <asm-generic/bitsperlong.h>
 #endif
index a4446f4..298b2e1 100644 (file)
@@ -412,6 +412,14 @@ typedef struct drm_i915_irq_wait {
        int irq_seq;
 } drm_i915_irq_wait_t;
 
+/*
+ * Different modes of per-process Graphics Translation Table,
+ * see I915_PARAM_HAS_ALIASING_PPGTT
+ */
+#define I915_GEM_PPGTT_NONE    0
+#define I915_GEM_PPGTT_ALIASING        1
+#define I915_GEM_PPGTT_FULL    2
+
 /* Ioctl to query kernel params:
  */
 #define I915_PARAM_IRQ_ACTIVE            1
index a441ea1..121e82c 100644 (file)
 #include <linux/ioctl.h>
 #include <linux/types.h>
 
+/* Use of MS_* flags within the kernel is restricted to core mount(2) code. */
+#if !defined(__KERNEL__)
+#include <linux/mount.h>
+#endif
+
 /*
  * It's silly to have NR_OPEN bigger than NR_FILE, but you can change
  * the file limit at runtime and only root can increase the per-process
@@ -101,57 +106,6 @@ struct inodes_stat_t {
 
 #define NR_FILE  8192  /* this can well be larger on a larger system */
 
-
-/*
- * These are the fs-independent mount-flags: up to 32 flags are supported
- */
-#define MS_RDONLY       1      /* Mount read-only */
-#define MS_NOSUID       2      /* Ignore suid and sgid bits */
-#define MS_NODEV        4      /* Disallow access to device special files */
-#define MS_NOEXEC       8      /* Disallow program execution */
-#define MS_SYNCHRONOUS 16      /* Writes are synced at once */
-#define MS_REMOUNT     32      /* Alter flags of a mounted FS */
-#define MS_MANDLOCK    64      /* Allow mandatory locks on an FS */
-#define MS_DIRSYNC     128     /* Directory modifications are synchronous */
-#define MS_NOATIME     1024    /* Do not update access times. */
-#define MS_NODIRATIME  2048    /* Do not update directory access times */
-#define MS_BIND                4096
-#define MS_MOVE                8192
-#define MS_REC         16384
-#define MS_VERBOSE     32768   /* War is peace. Verbosity is silence.
-                                  MS_VERBOSE is deprecated. */
-#define MS_SILENT      32768
-#define MS_POSIXACL    (1<<16) /* VFS does not apply the umask */
-#define MS_UNBINDABLE  (1<<17) /* change to unbindable */
-#define MS_PRIVATE     (1<<18) /* change to private */
-#define MS_SLAVE       (1<<19) /* change to slave */
-#define MS_SHARED      (1<<20) /* change to shared */
-#define MS_RELATIME    (1<<21) /* Update atime relative to mtime/ctime. */
-#define MS_KERNMOUNT   (1<<22) /* this is a kern_mount call */
-#define MS_I_VERSION   (1<<23) /* Update inode I_version field */
-#define MS_STRICTATIME (1<<24) /* Always perform atime updates */
-#define MS_LAZYTIME    (1<<25) /* Update the on-disk [acm]times lazily */
-
-/* These sb flags are internal to the kernel */
-#define MS_SUBMOUNT     (1<<26)
-#define MS_NOREMOTELOCK        (1<<27)
-#define MS_NOSEC       (1<<28)
-#define MS_BORN                (1<<29)
-#define MS_ACTIVE      (1<<30)
-#define MS_NOUSER      (1<<31)
-
-/*
- * Superblock flags that can be altered by MS_REMOUNT
- */
-#define MS_RMT_MASK    (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK|MS_I_VERSION|\
-                        MS_LAZYTIME)
-
-/*
- * Old magic mount flag and mask
- */
-#define MS_MGC_VAL 0xC0ED0000
-#define MS_MGC_MSK 0xffff0000
-
 /*
  * Structure for FS_IOC_FSGETXATTR[A] and FS_IOC_FSSETXATTR.
  */
@@ -269,7 +223,8 @@ struct fsxattr {
 #define FS_POLICY_FLAGS_PAD_16         0x02
 #define FS_POLICY_FLAGS_PAD_32         0x03
 #define FS_POLICY_FLAGS_PAD_MASK       0x03
-#define FS_POLICY_FLAGS_VALID          0x03
+#define FS_POLICY_FLAG_DIRECT_KEY      0x04    /* use master key directly */
+#define FS_POLICY_FLAGS_VALID          0x07
 
 /* Encryption algorithms */
 #define FS_ENCRYPTION_MODE_INVALID             0
@@ -281,6 +236,7 @@ struct fsxattr {
 #define FS_ENCRYPTION_MODE_AES_128_CTS         6
 #define FS_ENCRYPTION_MODE_SPECK128_256_XTS    7 /* Removed, do not use. */
 #define FS_ENCRYPTION_MODE_SPECK128_256_CTS    8 /* Removed, do not use. */
+#define FS_ENCRYPTION_MODE_ADIANTUM            9
 
 struct fscrypt_policy {
        __u8 version;
index 1debfa4..d653382 100644 (file)
@@ -288,6 +288,7 @@ enum {
        IFLA_BR_MCAST_IGMP_VERSION,
        IFLA_BR_MCAST_MLD_VERSION,
        IFLA_BR_VLAN_STATS_PER_PORT,
+       IFLA_BR_MULTI_BOOLOPT,
        __IFLA_BR_MAX,
 };
 
@@ -533,6 +534,7 @@ enum {
        IFLA_VXLAN_LABEL,
        IFLA_VXLAN_GPE,
        IFLA_VXLAN_TTL_INHERIT,
+       IFLA_VXLAN_DF,
        __IFLA_VXLAN_MAX
 };
 #define IFLA_VXLAN_MAX (__IFLA_VXLAN_MAX - 1)
@@ -542,6 +544,14 @@ struct ifla_vxlan_port_range {
        __be16  high;
 };
 
+enum ifla_vxlan_df {
+       VXLAN_DF_UNSET = 0,
+       VXLAN_DF_SET,
+       VXLAN_DF_INHERIT,
+       __VXLAN_DF_END,
+       VXLAN_DF_MAX = __VXLAN_DF_END - 1,
+};
+
 /* GENEVE section */
 enum {
        IFLA_GENEVE_UNSPEC,
@@ -557,10 +567,19 @@ enum {
        IFLA_GENEVE_UDP_ZERO_CSUM6_RX,
        IFLA_GENEVE_LABEL,
        IFLA_GENEVE_TTL_INHERIT,
+       IFLA_GENEVE_DF,
        __IFLA_GENEVE_MAX
 };
 #define IFLA_GENEVE_MAX        (__IFLA_GENEVE_MAX - 1)
 
+enum ifla_geneve_df {
+       GENEVE_DF_UNSET = 0,
+       GENEVE_DF_SET,
+       GENEVE_DF_INHERIT,
+       __GENEVE_DF_END,
+       GENEVE_DF_MAX = __GENEVE_DF_END - 1,
+};
+
 /* PPP section */
 enum {
        IFLA_PPP_UNSPEC,
index 48e8a22..f6052e7 100644 (file)
@@ -266,10 +266,14 @@ struct sockaddr_in {
 
 #define        IN_CLASSD(a)            ((((long int) (a)) & 0xf0000000) == 0xe0000000)
 #define        IN_MULTICAST(a)         IN_CLASSD(a)
-#define IN_MULTICAST_NET       0xF0000000
+#define        IN_MULTICAST_NET        0xe0000000
 
-#define        IN_EXPERIMENTAL(a)      ((((long int) (a)) & 0xf0000000) == 0xf0000000)
-#define        IN_BADCLASS(a)          IN_EXPERIMENTAL((a))
+#define        IN_BADCLASS(a)          ((((long int) (a) ) == 0xffffffff)
+#define        IN_EXPERIMENTAL(a)      IN_BADCLASS((a))
+
+#define        IN_CLASSE(a)            ((((long int) (a)) & 0xf0000000) == 0xf0000000)
+#define        IN_CLASSE_NET           0xffffffff
+#define        IN_CLASSE_NSHIFT        0
 
 /* Address to accept any incoming messages. */
 #define        INADDR_ANY              ((unsigned long int) 0x00000000)
index 2b7a652..6d4ea4b 100644 (file)
@@ -492,6 +492,17 @@ struct kvm_dirty_log {
        };
 };
 
+/* for KVM_CLEAR_DIRTY_LOG */
+struct kvm_clear_dirty_log {
+       __u32 slot;
+       __u32 num_pages;
+       __u64 first_page;
+       union {
+               void __user *dirty_bitmap; /* one bit per page */
+               __u64 padding2;
+       };
+};
+
 /* for KVM_SET_SIGNAL_MASK */
 struct kvm_signal_mask {
        __u32 len;
@@ -975,6 +986,8 @@ struct kvm_ppc_resize_hpt {
 #define KVM_CAP_HYPERV_ENLIGHTENED_VMCS 163
 #define KVM_CAP_EXCEPTION_PAYLOAD 164
 #define KVM_CAP_ARM_VM_IPA_SIZE 165
+#define KVM_CAP_MANUAL_DIRTY_LOG_PROTECT 166
+#define KVM_CAP_HYPERV_CPUID 167
 
 #ifdef KVM_CAP_IRQ_ROUTING
 
@@ -1421,6 +1434,12 @@ struct kvm_enc_region {
 #define KVM_GET_NESTED_STATE         _IOWR(KVMIO, 0xbe, struct kvm_nested_state)
 #define KVM_SET_NESTED_STATE         _IOW(KVMIO,  0xbf, struct kvm_nested_state)
 
+/* Available with KVM_CAP_MANUAL_DIRTY_LOG_PROTECT */
+#define KVM_CLEAR_DIRTY_LOG          _IOWR(KVMIO, 0xc0, struct kvm_clear_dirty_log)
+
+/* Available with KVM_CAP_HYPERV_CPUID */
+#define KVM_GET_SUPPORTED_HV_CPUID _IOWR(KVMIO, 0xc1, struct kvm_cpuid2)
+
 /* Secure Encrypted Virtualization command */
 enum sev_cmd_id {
        /* Guest initialization commands */
diff --git a/tools/include/uapi/linux/mount.h b/tools/include/uapi/linux/mount.h
new file mode 100644 (file)
index 0000000..3f9ec42
--- /dev/null
@@ -0,0 +1,58 @@
+#ifndef _UAPI_LINUX_MOUNT_H
+#define _UAPI_LINUX_MOUNT_H
+
+/*
+ * These are the fs-independent mount-flags: up to 32 flags are supported
+ *
+ * Usage of these is restricted within the kernel to core mount(2) code and
+ * callers of sys_mount() only.  Filesystems should be using the SB_*
+ * equivalent instead.
+ */
+#define MS_RDONLY       1      /* Mount read-only */
+#define MS_NOSUID       2      /* Ignore suid and sgid bits */
+#define MS_NODEV        4      /* Disallow access to device special files */
+#define MS_NOEXEC       8      /* Disallow program execution */
+#define MS_SYNCHRONOUS 16      /* Writes are synced at once */
+#define MS_REMOUNT     32      /* Alter flags of a mounted FS */
+#define MS_MANDLOCK    64      /* Allow mandatory locks on an FS */
+#define MS_DIRSYNC     128     /* Directory modifications are synchronous */
+#define MS_NOATIME     1024    /* Do not update access times. */
+#define MS_NODIRATIME  2048    /* Do not update directory access times */
+#define MS_BIND                4096
+#define MS_MOVE                8192
+#define MS_REC         16384
+#define MS_VERBOSE     32768   /* War is peace. Verbosity is silence.
+                                  MS_VERBOSE is deprecated. */
+#define MS_SILENT      32768
+#define MS_POSIXACL    (1<<16) /* VFS does not apply the umask */
+#define MS_UNBINDABLE  (1<<17) /* change to unbindable */
+#define MS_PRIVATE     (1<<18) /* change to private */
+#define MS_SLAVE       (1<<19) /* change to slave */
+#define MS_SHARED      (1<<20) /* change to shared */
+#define MS_RELATIME    (1<<21) /* Update atime relative to mtime/ctime. */
+#define MS_KERNMOUNT   (1<<22) /* this is a kern_mount call */
+#define MS_I_VERSION   (1<<23) /* Update inode I_version field */
+#define MS_STRICTATIME (1<<24) /* Always perform atime updates */
+#define MS_LAZYTIME    (1<<25) /* Update the on-disk [acm]times lazily */
+
+/* These sb flags are internal to the kernel */
+#define MS_SUBMOUNT     (1<<26)
+#define MS_NOREMOTELOCK        (1<<27)
+#define MS_NOSEC       (1<<28)
+#define MS_BORN                (1<<29)
+#define MS_ACTIVE      (1<<30)
+#define MS_NOUSER      (1<<31)
+
+/*
+ * Superblock flags that can be altered by MS_REMOUNT
+ */
+#define MS_RMT_MASK    (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK|MS_I_VERSION|\
+                        MS_LAZYTIME)
+
+/*
+ * Old magic mount flag and mask
+ */
+#define MS_MGC_VAL 0xC0ED0000
+#define MS_MGC_MSK 0xffff0000
+
+#endif /* _UAPI_LINUX_MOUNT_H */
index b17201e..b4875a9 100644 (file)
@@ -220,4 +220,12 @@ struct prctl_mm_map {
 # define PR_SPEC_DISABLE               (1UL << 2)
 # define PR_SPEC_FORCE_DISABLE         (1UL << 3)
 
+/* Reset arm64 pointer authentication keys */
+#define PR_PAC_RESET_KEYS              54
+# define PR_PAC_APIAKEY                        (1UL << 0)
+# define PR_PAC_APIBKEY                        (1UL << 1)
+# define PR_PAC_APDAKEY                        (1UL << 2)
+# define PR_PAC_APDBKEY                        (1UL << 3)
+# define PR_PAC_APGAKEY                        (1UL << 4)
+
 #endif /* _LINUX_PRCTL_H */
index 84c3de8..40d028e 100644 (file)
  * device configuration.
  */
 
+#include <linux/vhost_types.h>
 #include <linux/types.h>
-#include <linux/compiler.h>
 #include <linux/ioctl.h>
-#include <linux/virtio_config.h>
-#include <linux/virtio_ring.h>
-
-struct vhost_vring_state {
-       unsigned int index;
-       unsigned int num;
-};
-
-struct vhost_vring_file {
-       unsigned int index;
-       int fd; /* Pass -1 to unbind from file. */
-
-};
-
-struct vhost_vring_addr {
-       unsigned int index;
-       /* Option flags. */
-       unsigned int flags;
-       /* Flag values: */
-       /* Whether log address is valid. If set enables logging. */
-#define VHOST_VRING_F_LOG 0
-
-       /* Start of array of descriptors (virtually contiguous) */
-       __u64 desc_user_addr;
-       /* Used structure address. Must be 32 bit aligned */
-       __u64 used_user_addr;
-       /* Available structure address. Must be 16 bit aligned */
-       __u64 avail_user_addr;
-       /* Logging support. */
-       /* Log writes to used structure, at offset calculated from specified
-        * address. Address must be 32 bit aligned. */
-       __u64 log_guest_addr;
-};
-
-/* no alignment requirement */
-struct vhost_iotlb_msg {
-       __u64 iova;
-       __u64 size;
-       __u64 uaddr;
-#define VHOST_ACCESS_RO      0x1
-#define VHOST_ACCESS_WO      0x2
-#define VHOST_ACCESS_RW      0x3
-       __u8 perm;
-#define VHOST_IOTLB_MISS           1
-#define VHOST_IOTLB_UPDATE         2
-#define VHOST_IOTLB_INVALIDATE     3
-#define VHOST_IOTLB_ACCESS_FAIL    4
-       __u8 type;
-};
-
-#define VHOST_IOTLB_MSG 0x1
-#define VHOST_IOTLB_MSG_V2 0x2
-
-struct vhost_msg {
-       int type;
-       union {
-               struct vhost_iotlb_msg iotlb;
-               __u8 padding[64];
-       };
-};
-
-struct vhost_msg_v2 {
-       __u32 type;
-       __u32 reserved;
-       union {
-               struct vhost_iotlb_msg iotlb;
-               __u8 padding[64];
-       };
-};
-
-struct vhost_memory_region {
-       __u64 guest_phys_addr;
-       __u64 memory_size; /* bytes */
-       __u64 userspace_addr;
-       __u64 flags_padding; /* No flags are currently specified. */
-};
-
-/* All region addresses and sizes must be 4K aligned. */
-#define VHOST_PAGE_SIZE 0x1000
-
-struct vhost_memory {
-       __u32 nregions;
-       __u32 padding;
-       struct vhost_memory_region regions[0];
-};
 
 /* ioctls */
 
@@ -186,31 +101,7 @@ struct vhost_memory {
  * device.  This can be used to stop the ring (e.g. for migration). */
 #define VHOST_NET_SET_BACKEND _IOW(VHOST_VIRTIO, 0x30, struct vhost_vring_file)
 
-/* Feature bits */
-/* Log all write descriptors. Can be changed while device is active. */
-#define VHOST_F_LOG_ALL 26
-/* vhost-net should add virtio_net_hdr for RX, and strip for TX packets. */
-#define VHOST_NET_F_VIRTIO_NET_HDR 27
-
-/* VHOST_SCSI specific definitions */
-
-/*
- * Used by QEMU userspace to ensure a consistent vhost-scsi ABI.
- *
- * ABI Rev 0: July 2012 version starting point for v3.6-rc merge candidate +
- *            RFC-v2 vhost-scsi userspace.  Add GET_ABI_VERSION ioctl usage
- * ABI Rev 1: January 2013. Ignore vhost_tpgt filed in struct vhost_scsi_target.
- *            All the targets under vhost_wwpn can be seen and used by guset.
- */
-
-#define VHOST_SCSI_ABI_VERSION 1
-
-struct vhost_scsi_target {
-       int abi_version;
-       char vhost_wwpn[224]; /* TRANSPORT_IQN_LEN */
-       unsigned short vhost_tpgt;
-       unsigned short reserved;
-};
+/* VHOST_SCSI specific defines */
 
 #define VHOST_SCSI_SET_ENDPOINT _IOW(VHOST_VIRTIO, 0x40, struct vhost_scsi_target)
 #define VHOST_SCSI_CLEAR_ENDPOINT _IOW(VHOST_VIRTIO, 0x41, struct vhost_scsi_target)
index 8b31c0e..d463761 100644 (file)
@@ -194,13 +194,13 @@ void tep_set_page_size(struct tep_handle *pevent, int _page_size)
 }
 
 /**
- * tep_is_file_bigendian - get if the file is in big endian order
+ * tep_file_bigendian - get if the file is in big endian order
  * @pevent: a handle to the tep_handle
  *
  * This returns if the file is in big endian order
  * If @pevent is NULL, 0 is returned.
  */
-int tep_is_file_bigendian(struct tep_handle *pevent)
+int tep_file_bigendian(struct tep_handle *pevent)
 {
        if(pevent)
                return pevent->file_bigendian;
index 9a092dd..35833ee 100644 (file)
@@ -7,7 +7,7 @@
 #ifndef _PARSE_EVENTS_INT_H
 #define _PARSE_EVENTS_INT_H
 
-struct cmdline;
+struct tep_cmdline;
 struct cmdline_list;
 struct func_map;
 struct func_list;
@@ -36,7 +36,7 @@ struct tep_handle {
        int long_size;
        int page_size;
 
-       struct cmdline *cmdlines;
+       struct tep_cmdline *cmdlines;
        struct cmdline_list *cmdlist;
        int cmdline_count;
 
index 69a96e3..abd4fa5 100644 (file)
@@ -124,15 +124,15 @@ struct tep_print_arg *alloc_arg(void)
        return calloc(1, sizeof(struct tep_print_arg));
 }
 
-struct cmdline {
+struct tep_cmdline {
        char *comm;
        int pid;
 };
 
 static int cmdline_cmp(const void *a, const void *b)
 {
-       const struct cmdline *ca = a;
-       const struct cmdline *cb = b;
+       const struct tep_cmdline *ca = a;
+       const struct tep_cmdline *cb = b;
 
        if (ca->pid < cb->pid)
                return -1;
@@ -152,7 +152,7 @@ static int cmdline_init(struct tep_handle *pevent)
 {
        struct cmdline_list *cmdlist = pevent->cmdlist;
        struct cmdline_list *item;
-       struct cmdline *cmdlines;
+       struct tep_cmdline *cmdlines;
        int i;
 
        cmdlines = malloc(sizeof(*cmdlines) * pevent->cmdline_count);
@@ -179,8 +179,8 @@ static int cmdline_init(struct tep_handle *pevent)
 
 static const char *find_cmdline(struct tep_handle *pevent, int pid)
 {
-       const struct cmdline *comm;
-       struct cmdline key;
+       const struct tep_cmdline *comm;
+       struct tep_cmdline key;
 
        if (!pid)
                return "<idle>";
@@ -208,8 +208,8 @@ static const char *find_cmdline(struct tep_handle *pevent, int pid)
  */
 int tep_pid_is_registered(struct tep_handle *pevent, int pid)
 {
-       const struct cmdline *comm;
-       struct cmdline key;
+       const struct tep_cmdline *comm;
+       struct tep_cmdline key;
 
        if (!pid)
                return 1;
@@ -232,11 +232,13 @@ int tep_pid_is_registered(struct tep_handle *pevent, int pid)
  * we must add this pid. This is much slower than when cmdlines
  * are added before the array is initialized.
  */
-static int add_new_comm(struct tep_handle *pevent, const char *comm, int pid)
+static int add_new_comm(struct tep_handle *pevent,
+                       const char *comm, int pid, bool override)
 {
-       struct cmdline *cmdlines = pevent->cmdlines;
-       const struct cmdline *cmdline;
-       struct cmdline key;
+       struct tep_cmdline *cmdlines = pevent->cmdlines;
+       struct tep_cmdline *cmdline;
+       struct tep_cmdline key;
+       char *new_comm;
 
        if (!pid)
                return 0;
@@ -247,8 +249,19 @@ static int add_new_comm(struct tep_handle *pevent, const char *comm, int pid)
        cmdline = bsearch(&key, pevent->cmdlines, pevent->cmdline_count,
                       sizeof(*pevent->cmdlines), cmdline_cmp);
        if (cmdline) {
-               errno = EEXIST;
-               return -1;
+               if (!override) {
+                       errno = EEXIST;
+                       return -1;
+               }
+               new_comm = strdup(comm);
+               if (!new_comm) {
+                       errno = ENOMEM;
+                       return -1;
+               }
+               free(cmdline->comm);
+               cmdline->comm = new_comm;
+
+               return 0;
        }
 
        cmdlines = realloc(cmdlines, sizeof(*cmdlines) * (pevent->cmdline_count + 1));
@@ -275,21 +288,13 @@ static int add_new_comm(struct tep_handle *pevent, const char *comm, int pid)
        return 0;
 }
 
-/**
- * tep_register_comm - register a pid / comm mapping
- * @pevent: handle for the pevent
- * @comm: the command line to register
- * @pid: the pid to map the command line to
- *
- * This adds a mapping to search for command line names with
- * a given pid. The comm is duplicated.
- */
-int tep_register_comm(struct tep_handle *pevent, const char *comm, int pid)
+static int _tep_register_comm(struct tep_handle *pevent,
+                             const char *comm, int pid, bool override)
 {
        struct cmdline_list *item;
 
        if (pevent->cmdlines)
-               return add_new_comm(pevent, comm, pid);
+               return add_new_comm(pevent, comm, pid, override);
 
        item = malloc(sizeof(*item));
        if (!item)
@@ -312,6 +317,40 @@ int tep_register_comm(struct tep_handle *pevent, const char *comm, int pid)
        return 0;
 }
 
+/**
+ * tep_register_comm - register a pid / comm mapping
+ * @pevent: handle for the pevent
+ * @comm: the command line to register
+ * @pid: the pid to map the command line to
+ *
+ * This adds a mapping to search for command line names with
+ * a given pid. The comm is duplicated. If a command with the same pid
+ * already exist, -1 is returned and errno is set to EEXIST
+ */
+int tep_register_comm(struct tep_handle *pevent, const char *comm, int pid)
+{
+       return _tep_register_comm(pevent, comm, pid, false);
+}
+
+/**
+ * tep_override_comm - register a pid / comm mapping
+ * @pevent: handle for the pevent
+ * @comm: the command line to register
+ * @pid: the pid to map the command line to
+ *
+ * This adds a mapping to search for command line names with
+ * a given pid. The comm is duplicated. If a command with the same pid
+ * already exist, the command string is udapted with the new one
+ */
+int tep_override_comm(struct tep_handle *pevent, const char *comm, int pid)
+{
+       if (!pevent->cmdlines && cmdline_init(pevent)) {
+               errno = ENOMEM;
+               return -1;
+       }
+       return _tep_register_comm(pevent, comm, pid, true);
+}
+
 int tep_register_trace_clock(struct tep_handle *pevent, const char *trace_clock)
 {
        pevent->trace_clock = strdup(trace_clock);
@@ -5227,18 +5266,6 @@ int tep_data_type(struct tep_handle *pevent, struct tep_record *rec)
 }
 
 /**
- * tep_data_event_from_type - find the event by a given type
- * @pevent: a handle to the pevent
- * @type: the type of the event.
- *
- * This returns the event form a given @type;
- */
-struct tep_event *tep_data_event_from_type(struct tep_handle *pevent, int type)
-{
-       return tep_find_event(pevent, type);
-}
-
-/**
  * tep_data_pid - parse the PID from record
  * @pevent: a handle to the pevent
  * @rec: the record to parse
@@ -5292,8 +5319,8 @@ const char *tep_data_comm_from_pid(struct tep_handle *pevent, int pid)
        return comm;
 }
 
-static struct cmdline *
-pid_from_cmdlist(struct tep_handle *pevent, const char *comm, struct cmdline *next)
+static struct tep_cmdline *
+pid_from_cmdlist(struct tep_handle *pevent, const char *comm, struct tep_cmdline *next)
 {
        struct cmdline_list *cmdlist = (struct cmdline_list *)next;
 
@@ -5305,7 +5332,7 @@ pid_from_cmdlist(struct tep_handle *pevent, const char *comm, struct cmdline *ne
        while (cmdlist && strcmp(cmdlist->comm, comm) != 0)
                cmdlist = cmdlist->next;
 
-       return (struct cmdline *)cmdlist;
+       return (struct tep_cmdline *)cmdlist;
 }
 
 /**
@@ -5321,10 +5348,10 @@ pid_from_cmdlist(struct tep_handle *pevent, const char *comm, struct cmdline *ne
  * next pid.
  * Also, it does a linear search, so it may be slow.
  */
-struct cmdline *tep_data_pid_from_comm(struct tep_handle *pevent, const char *comm,
-                                      struct cmdline *next)
+struct tep_cmdline *tep_data_pid_from_comm(struct tep_handle *pevent, const char *comm,
+                                          struct tep_cmdline *next)
 {
-       struct cmdline *cmdline;
+       struct tep_cmdline *cmdline;
 
        /*
         * If the cmdlines have not been converted yet, then use
@@ -5363,7 +5390,7 @@ struct cmdline *tep_data_pid_from_comm(struct tep_handle *pevent, const char *co
  * Returns the pid for a give cmdline. If @cmdline is NULL, then
  * -1 is returned.
  */
-int tep_cmdline_pid(struct tep_handle *pevent, struct cmdline *cmdline)
+int tep_cmdline_pid(struct tep_handle *pevent, struct tep_cmdline *cmdline)
 {
        struct cmdline_list *cmdlist = (struct cmdline_list *)cmdline;
 
@@ -6593,6 +6620,12 @@ static struct tep_event *search_event(struct tep_handle *pevent, int id,
  *
  * If @id is >= 0, then it is used to find the event.
  * else @sys_name and @event_name are used.
+ *
+ * Returns:
+ *  TEP_REGISTER_SUCCESS_OVERWRITE if an existing handler is overwritten
+ *  TEP_REGISTER_SUCCESS if a new handler is registered successfully
+ *  negative TEP_ERRNO_... in case of an error
+ *
  */
 int tep_register_event_handler(struct tep_handle *pevent, int id,
                               const char *sys_name, const char *event_name,
@@ -6610,7 +6643,7 @@ int tep_register_event_handler(struct tep_handle *pevent, int id,
 
        event->handler = func;
        event->context = context;
-       return 0;
+       return TEP_REGISTER_SUCCESS_OVERWRITE;
 
  not_found:
        /* Save for later use. */
@@ -6640,7 +6673,7 @@ int tep_register_event_handler(struct tep_handle *pevent, int id,
        pevent->handlers = handle;
        handle->context = context;
 
-       return -1;
+       return TEP_REGISTER_SUCCESS;
 }
 
 static int handle_matches(struct event_handler *handler, int id,
@@ -6723,8 +6756,10 @@ struct tep_handle *tep_alloc(void)
 {
        struct tep_handle *pevent = calloc(1, sizeof(*pevent));
 
-       if (pevent)
+       if (pevent) {
                pevent->ref_count = 1;
+               pevent->host_bigendian = tep_host_bigendian();
+       }
 
        return pevent;
 }
index 35d3708..aec48f2 100644 (file)
@@ -432,6 +432,7 @@ int tep_set_function_resolver(struct tep_handle *pevent,
                              tep_func_resolver_t *func, void *priv);
 void tep_reset_function_resolver(struct tep_handle *pevent);
 int tep_register_comm(struct tep_handle *pevent, const char *comm, int pid);
+int tep_override_comm(struct tep_handle *pevent, const char *comm, int pid);
 int tep_register_trace_clock(struct tep_handle *pevent, const char *trace_clock);
 int tep_register_function(struct tep_handle *pevent, char *name,
                          unsigned long long addr, char *mod);
@@ -484,6 +485,11 @@ int tep_print_func_field(struct trace_seq *s, const char *fmt,
                         struct tep_event *event, const char *name,
                         struct tep_record *record, int err);
 
+enum tep_reg_handler {
+       TEP_REGISTER_SUCCESS = 0,
+       TEP_REGISTER_SUCCESS_OVERWRITE,
+};
+
 int tep_register_event_handler(struct tep_handle *pevent, int id,
                               const char *sys_name, const char *event_name,
                               tep_event_handler_func func, void *context);
@@ -520,15 +526,14 @@ tep_find_event_by_record(struct tep_handle *pevent, struct tep_record *record);
 void tep_data_lat_fmt(struct tep_handle *pevent,
                      struct trace_seq *s, struct tep_record *record);
 int tep_data_type(struct tep_handle *pevent, struct tep_record *rec);
-struct tep_event *tep_data_event_from_type(struct tep_handle *pevent, int type);
 int tep_data_pid(struct tep_handle *pevent, struct tep_record *rec);
 int tep_data_preempt_count(struct tep_handle *pevent, struct tep_record *rec);
 int tep_data_flags(struct tep_handle *pevent, struct tep_record *rec);
 const char *tep_data_comm_from_pid(struct tep_handle *pevent, int pid);
-struct cmdline;
-struct cmdline *tep_data_pid_from_comm(struct tep_handle *pevent, const char *comm,
-                                      struct cmdline *next);
-int tep_cmdline_pid(struct tep_handle *pevent, struct cmdline *cmdline);
+struct tep_cmdline;
+struct tep_cmdline *tep_data_pid_from_comm(struct tep_handle *pevent, const char *comm,
+                                          struct tep_cmdline *next);
+int tep_cmdline_pid(struct tep_handle *pevent, struct tep_cmdline *cmdline);
 
 void tep_print_field(struct trace_seq *s, void *data,
                     struct tep_format_field *field);
@@ -553,7 +558,7 @@ int tep_get_long_size(struct tep_handle *pevent);
 void tep_set_long_size(struct tep_handle *pevent, int long_size);
 int tep_get_page_size(struct tep_handle *pevent);
 void tep_set_page_size(struct tep_handle *pevent, int _page_size);
-int tep_is_file_bigendian(struct tep_handle *pevent);
+int tep_file_bigendian(struct tep_handle *pevent);
 void tep_set_file_bigendian(struct tep_handle *pevent, enum tep_endian endian);
 int tep_is_host_bigendian(struct tep_handle *pevent);
 void tep_set_host_bigendian(struct tep_handle *pevent, enum tep_endian endian);
index 754050e..64b9c25 100644 (file)
@@ -389,7 +389,7 @@ static int kvm_mmu_print_role(struct trace_seq *s, struct tep_record *record,
         * We can only use the structure if file is of the same
         * endianness.
         */
-       if (tep_is_file_bigendian(event->pevent) ==
+       if (tep_file_bigendian(event->pevent) ==
            tep_is_host_bigendian(event->pevent)) {
 
                trace_seq_printf(s, "%u q%u%s %s%s %spae %snxe %swp%s%s%s",
index 8ff1d55..8d5ecd2 100644 (file)
@@ -100,7 +100,8 @@ static void expand_buffer(struct trace_seq *s)
  * @fmt: printf format string
  *
  * It returns 0 if the trace oversizes the buffer's free
- * space, 1 otherwise.
+ * space, the number of characters printed, or a negative
+ * value in case of an error.
  *
  * The tracer may use either sequence operations or its own
  * copy to user routines. To simplify formating of a trace
@@ -129,9 +130,10 @@ trace_seq_printf(struct trace_seq *s, const char *fmt, ...)
                goto try_again;
        }
 
-       s->len += ret;
+       if (ret > 0)
+               s->len += ret;
 
-       return 1;
+       return ret;
 }
 
 /**
@@ -139,6 +141,10 @@ trace_seq_printf(struct trace_seq *s, const char *fmt, ...)
  * @s: trace sequence descriptor
  * @fmt: printf format string
  *
+ * It returns 0 if the trace oversizes the buffer's free
+ * space, the number of characters printed, or a negative
+ * value in case of an error.
+ * *
  * The tracer may use either sequence operations or its own
  * copy to user routines. To simplify formating of a trace
  * trace_seq_printf is used to store strings into a special
@@ -163,9 +169,10 @@ trace_seq_vprintf(struct trace_seq *s, const char *fmt, va_list args)
                goto try_again;
        }
 
-       s->len += ret;
+       if (ret > 0)
+               s->len += ret;
 
-       return len;
+       return ret;
 }
 
 /**
index ff29c33..0ee6795 100644 (file)
@@ -524,12 +524,14 @@ $(arch_errno_name_array): $(arch_errno_tbl)
 
 all: shell_compatibility_test $(ALL_PROGRAMS) $(LANG_BINDINGS) $(OTHER_PROGRAMS)
 
+# Create python binding output directory if not already present
+_dummy := $(shell [ -d '$(OUTPUT)python' ] || mkdir -p '$(OUTPUT)python')
+
 $(OUTPUT)python/perf.so: $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS) $(LIBTRACEEVENT_DYNAMIC_LIST)
        $(QUIET_GEN)LDSHARED="$(CC) -pthread -shared" \
         CFLAGS='$(CFLAGS)' LDFLAGS='$(LDFLAGS) $(LIBTRACEEVENT_DYNAMIC_LIST_LDFLAGS)' \
          $(PYTHON_WORD) util/setup.py \
          --quiet build_ext; \
-       mkdir -p $(OUTPUT)python && \
        cp $(PYTHON_EXTBUILD_LIB)perf*.so $(OUTPUT)python/
 
 please_set_SHELL_PATH_to_a_more_modern_shell:
@@ -660,12 +662,12 @@ $(OUTPUT)perf-%: %.o $(PERFLIBS)
        $(QUIET_LINK)$(CC) $(CFLAGS) -o $@ $(LDFLAGS) $(filter %.o,$^) $(LIBS)
 
 ifndef NO_PERF_READ_VDSO32
-$(OUTPUT)perf-read-vdso32: perf-read-vdso.c util/find-vdso-map.c
+$(OUTPUT)perf-read-vdso32: perf-read-vdso.c util/find-map.c
        $(QUIET_CC)$(CC) -m32 $(filter -static,$(LDFLAGS)) -Wall -Werror -o $@ perf-read-vdso.c
 endif
 
 ifndef NO_PERF_READ_VDSOX32
-$(OUTPUT)perf-read-vdsox32: perf-read-vdso.c util/find-vdso-map.c
+$(OUTPUT)perf-read-vdsox32: perf-read-vdso.c util/find-map.c
        $(QUIET_CC)$(CC) -mx32 $(filter -static,$(LDFLAGS)) -Wall -Werror -o $@ perf-read-vdso.c
 endif
 
index 883c57f..d9ae273 100644 (file)
@@ -1,4 +1,5 @@
 libperf-y += regs_load.o
 libperf-y += dwarf-unwind.o
+libperf-y += vectors-page.o
 
 libperf-y += arch-tests.o
index 5b1543c..6848101 100644 (file)
@@ -11,6 +11,10 @@ struct test arch_tests[] = {
        },
 #endif
        {
+               .desc = "Vectors page",
+               .func = test__vectors_page,
+       },
+       {
                .func = NULL,
        },
 };
diff --git a/tools/perf/arch/arm/tests/vectors-page.c b/tools/perf/arch/arm/tests/vectors-page.c
new file mode 100644 (file)
index 0000000..7ffdd79
--- /dev/null
@@ -0,0 +1,24 @@
+// SPDX-License-Identifier: GPL-2.0
+#include <stdio.h>
+#include <string.h>
+#include <linux/compiler.h>
+
+#include "debug.h"
+#include "tests/tests.h"
+#include "util/find-map.c"
+
+#define VECTORS__MAP_NAME "[vectors]"
+
+int test__vectors_page(struct test *test __maybe_unused,
+                      int subtest __maybe_unused)
+{
+       void *start, *end;
+
+       if (find_map(&start, &end, VECTORS__MAP_NAME)) {
+               pr_err("%s not found, is CONFIG_KUSER_HELPERS enabled?\n",
+                      VECTORS__MAP_NAME);
+               return TEST_FAIL;
+       }
+
+       return TEST_OK;
+}
index a111239..e58d00d 100644 (file)
@@ -14,18 +14,25 @@ PERF_HAVE_JITDUMP := 1
 out    := $(OUTPUT)arch/powerpc/include/generated/asm
 header32 := $(out)/syscalls_32.c
 header64 := $(out)/syscalls_64.c
-sysdef := $(srctree)/tools/arch/powerpc/include/uapi/asm/unistd.h
-sysprf := $(srctree)/tools/perf/arch/powerpc/entry/syscalls/
+syskrn := $(srctree)/arch/powerpc/kernel/syscalls/syscall.tbl
+sysprf := $(srctree)/tools/perf/arch/powerpc/entry/syscalls
+sysdef := $(sysprf)/syscall.tbl
 systbl := $(sysprf)/mksyscalltbl
 
 # Create output directory if not already present
 _dummy := $(shell [ -d '$(out)' ] || mkdir -p '$(out)')
 
 $(header64): $(sysdef) $(systbl)
-       $(Q)$(SHELL) '$(systbl)' '64' '$(CC)' $(sysdef) > $@
+       @(test -d ../../kernel -a -d ../../tools -a -d ../perf && ( \
+       (diff -B $(sysdef) $(syskrn) >/dev/null) \
+       || echo "Warning: Kernel ABI header at '$(sysdef)' differs from latest version at '$(syskrn)'" >&2 )) || true
+       $(Q)$(SHELL) '$(systbl)' '64' $(sysdef) > $@
 
 $(header32): $(sysdef) $(systbl)
-       $(Q)$(SHELL) '$(systbl)' '32' '$(CC)' $(sysdef) > $@
+       @(test -d ../../kernel -a -d ../../tools -a -d ../perf && ( \
+       (diff -B $(sysdef) $(syskrn) >/dev/null) \
+       || echo "Warning: Kernel ABI header at '$(sysdef)' differs from latest version at '$(syskrn)'" >&2 )) || true
+       $(Q)$(SHELL) '$(systbl)' '32' $(sysdef) > $@
 
 clean::
        $(call QUIET_CLEAN, powerpc) $(RM) $(header32) $(header64)
index ef52e1d..6c58060 100755 (executable)
@@ -9,10 +9,9 @@
 # Changed by: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
 
 wordsize=$1
-gcc=$2
-input=$3
+SYSCALL_TBL=$2
 
-if ! test -r $input; then
+if ! test -r $SYSCALL_TBL; then
        echo "Could not read input file" >&2
        exit 1
 fi
@@ -20,18 +19,21 @@ fi
 create_table()
 {
        local wordsize=$1
-       local max_nr
+       local max_nr nr abi sc discard
+       max_nr=-1
+       nr=0
 
        echo "static const char *syscalltbl_powerpc_${wordsize}[] = {"
-       while read sc nr; do
-               printf '\t[%d] = "%s",\n' $nr $sc
-               max_nr=$nr
+       while read nr abi sc discard; do
+               if [ "$max_nr" -lt "$nr" ]; then
+                       printf '\t[%d] = "%s",\n' $nr $sc
+                       max_nr=$nr
+               fi
        done
        echo '};'
        echo "#define SYSCALLTBL_POWERPC_${wordsize}_MAX_ID $max_nr"
 }
 
-$gcc -m${wordsize} -E -dM -x c  $input        \
-       |sed -ne 's/^#define __NR_//p' \
-       |sort -t' ' -k2 -nu            \
+grep -E "^[[:digit:]]+[[:space:]]+(common|spu|nospu|${wordsize})" $SYSCALL_TBL \
+       |sort -k1 -n                                                           \
        |create_table ${wordsize}
diff --git a/tools/perf/arch/powerpc/entry/syscalls/syscall.tbl b/tools/perf/arch/powerpc/entry/syscalls/syscall.tbl
new file mode 100644 (file)
index 0000000..db3bbb8
--- /dev/null
@@ -0,0 +1,427 @@
+# SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note
+#
+# system call numbers and entry vectors for powerpc
+#
+# The format is:
+# <number> <abi> <name> <entry point> <compat entry point>
+#
+# The <abi> can be common, spu, nospu, 64, or 32 for this file.
+#
+0      nospu   restart_syscall                 sys_restart_syscall
+1      nospu   exit                            sys_exit
+2      nospu   fork                            ppc_fork
+3      common  read                            sys_read
+4      common  write                           sys_write
+5      common  open                            sys_open                        compat_sys_open
+6      common  close                           sys_close
+7      common  waitpid                         sys_waitpid
+8      common  creat                           sys_creat
+9      common  link                            sys_link
+10     common  unlink                          sys_unlink
+11     nospu   execve                          sys_execve                      compat_sys_execve
+12     common  chdir                           sys_chdir
+13     common  time                            sys_time                        compat_sys_time
+14     common  mknod                           sys_mknod
+15     common  chmod                           sys_chmod
+16     common  lchown                          sys_lchown
+17     common  break                           sys_ni_syscall
+18     32      oldstat                         sys_stat                        sys_ni_syscall
+18     64      oldstat                         sys_ni_syscall
+18     spu     oldstat                         sys_ni_syscall
+19     common  lseek                           sys_lseek                       compat_sys_lseek
+20     common  getpid                          sys_getpid
+21     nospu   mount                           sys_mount                       compat_sys_mount
+22     32      umount                          sys_oldumount
+22     64      umount                          sys_ni_syscall
+22     spu     umount                          sys_ni_syscall
+23     common  setuid                          sys_setuid
+24     common  getuid                          sys_getuid
+25     common  stime                           sys_stime                       compat_sys_stime
+26     nospu   ptrace                          sys_ptrace                      compat_sys_ptrace
+27     common  alarm                           sys_alarm
+28     32      oldfstat                        sys_fstat                       sys_ni_syscall
+28     64      oldfstat                        sys_ni_syscall
+28     spu     oldfstat                        sys_ni_syscall
+29     nospu   pause                           sys_pause
+30     nospu   utime                           sys_utime                       compat_sys_utime
+31     common  stty                            sys_ni_syscall
+32     common  gtty                            sys_ni_syscall
+33     common  access                          sys_access
+34     common  nice                            sys_nice
+35     common  ftime                           sys_ni_syscall
+36     common  sync                            sys_sync
+37     common  kill                            sys_kill
+38     common  rename                          sys_rename
+39     common  mkdir                           sys_mkdir
+40     common  rmdir                           sys_rmdir
+41     common  dup                             sys_dup
+42     common  pipe                            sys_pipe
+43     common  times                           sys_times                       compat_sys_times
+44     common  prof                            sys_ni_syscall
+45     common  brk                             sys_brk
+46     common  setgid                          sys_setgid
+47     common  getgid                          sys_getgid
+48     nospu   signal                          sys_signal
+49     common  geteuid                         sys_geteuid
+50     common  getegid                         sys_getegid
+51     nospu   acct                            sys_acct
+52     nospu   umount2                         sys_umount
+53     common  lock                            sys_ni_syscall
+54     common  ioctl                           sys_ioctl                       compat_sys_ioctl
+55     common  fcntl                           sys_fcntl                       compat_sys_fcntl
+56     common  mpx                             sys_ni_syscall
+57     common  setpgid                         sys_setpgid
+58     common  ulimit                          sys_ni_syscall
+59     32      oldolduname                     sys_olduname
+59     64      oldolduname                     sys_ni_syscall
+59     spu     oldolduname                     sys_ni_syscall
+60     common  umask                           sys_umask
+61     common  chroot                          sys_chroot
+62     nospu   ustat                           sys_ustat                       compat_sys_ustat
+63     common  dup2                            sys_dup2
+64     common  getppid                         sys_getppid
+65     common  getpgrp                         sys_getpgrp
+66     common  setsid                          sys_setsid
+67     32      sigaction                       sys_sigaction                   compat_sys_sigaction
+67     64      sigaction                       sys_ni_syscall
+67     spu     sigaction                       sys_ni_syscall
+68     common  sgetmask                        sys_sgetmask
+69     common  ssetmask                        sys_ssetmask
+70     common  setreuid                        sys_setreuid
+71     common  setregid                        sys_setregid
+72     32      sigsuspend                      sys_sigsuspend
+72     64      sigsuspend                      sys_ni_syscall
+72     spu     sigsuspend                      sys_ni_syscall
+73     32      sigpending                      sys_sigpending                  compat_sys_sigpending
+73     64      sigpending                      sys_ni_syscall
+73     spu     sigpending                      sys_ni_syscall
+74     common  sethostname                     sys_sethostname
+75     common  setrlimit                       sys_setrlimit                   compat_sys_setrlimit
+76     32      getrlimit                       sys_old_getrlimit               compat_sys_old_getrlimit
+76     64      getrlimit                       sys_ni_syscall
+76     spu     getrlimit                       sys_ni_syscall
+77     common  getrusage                       sys_getrusage                   compat_sys_getrusage
+78     common  gettimeofday                    sys_gettimeofday                compat_sys_gettimeofday
+79     common  settimeofday                    sys_settimeofday                compat_sys_settimeofday
+80     common  getgroups                       sys_getgroups
+81     common  setgroups                       sys_setgroups
+82     32      select                          ppc_select                      sys_ni_syscall
+82     64      select                          sys_ni_syscall
+82     spu     select                          sys_ni_syscall
+83     common  symlink                         sys_symlink
+84     32      oldlstat                        sys_lstat                       sys_ni_syscall
+84     64      oldlstat                        sys_ni_syscall
+84     spu     oldlstat                        sys_ni_syscall
+85     common  readlink                        sys_readlink
+86     nospu   uselib                          sys_uselib
+87     nospu   swapon                          sys_swapon
+88     nospu   reboot                          sys_reboot
+89     32      readdir                         sys_old_readdir                 compat_sys_old_readdir
+89     64      readdir                         sys_ni_syscall
+89     spu     readdir                         sys_ni_syscall
+90     common  mmap                            sys_mmap
+91     common  munmap                          sys_munmap
+92     common  truncate                        sys_truncate                    compat_sys_truncate
+93     common  ftruncate                       sys_ftruncate                   compat_sys_ftruncate
+94     common  fchmod                          sys_fchmod
+95     common  fchown                          sys_fchown
+96     common  getpriority                     sys_getpriority
+97     common  setpriority                     sys_setpriority
+98     common  profil                          sys_ni_syscall
+99     nospu   statfs                          sys_statfs                      compat_sys_statfs
+100    nospu   fstatfs                         sys_fstatfs                     compat_sys_fstatfs
+101    common  ioperm                          sys_ni_syscall
+102    common  socketcall                      sys_socketcall                  compat_sys_socketcall
+103    common  syslog                          sys_syslog
+104    common  setitimer                       sys_setitimer                   compat_sys_setitimer
+105    common  getitimer                       sys_getitimer                   compat_sys_getitimer
+106    common  stat                            sys_newstat                     compat_sys_newstat
+107    common  lstat                           sys_newlstat                    compat_sys_newlstat
+108    common  fstat                           sys_newfstat                    compat_sys_newfstat
+109    32      olduname                        sys_uname
+109    64      olduname                        sys_ni_syscall
+109    spu     olduname                        sys_ni_syscall
+110    common  iopl                            sys_ni_syscall
+111    common  vhangup                         sys_vhangup
+112    common  idle                            sys_ni_syscall
+113    common  vm86                            sys_ni_syscall
+114    common  wait4                           sys_wait4                       compat_sys_wait4
+115    nospu   swapoff                         sys_swapoff
+116    common  sysinfo                         sys_sysinfo                     compat_sys_sysinfo
+117    nospu   ipc                             sys_ipc                         compat_sys_ipc
+118    common  fsync                           sys_fsync
+119    32      sigreturn                       sys_sigreturn                   compat_sys_sigreturn
+119    64      sigreturn                       sys_ni_syscall
+119    spu     sigreturn                       sys_ni_syscall
+120    nospu   clone                           ppc_clone
+121    common  setdomainname                   sys_setdomainname
+122    common  uname                           sys_newuname
+123    common  modify_ldt                      sys_ni_syscall
+124    common  adjtimex                        sys_adjtimex                    compat_sys_adjtimex
+125    common  mprotect                        sys_mprotect
+126    32      sigprocmask                     sys_sigprocmask                 compat_sys_sigprocmask
+126    64      sigprocmask                     sys_ni_syscall
+126    spu     sigprocmask                     sys_ni_syscall
+127    common  create_module                   sys_ni_syscall
+128    nospu   init_module                     sys_init_module
+129    nospu   delete_module                   sys_delete_module
+130    common  get_kernel_syms                 sys_ni_syscall
+131    nospu   quotactl                        sys_quotactl
+132    common  getpgid                         sys_getpgid
+133    common  fchdir                          sys_fchdir
+134    common  bdflush                         sys_bdflush
+135    common  sysfs                           sys_sysfs
+136    32      personality                     sys_personality                 ppc64_personality
+136    64      personality                     ppc64_personality
+136    spu     personality                     ppc64_personality
+137    common  afs_syscall                     sys_ni_syscall
+138    common  setfsuid                        sys_setfsuid
+139    common  setfsgid                        sys_setfsgid
+140    common  _llseek                         sys_llseek
+141    common  getdents                        sys_getdents                    compat_sys_getdents
+142    common  _newselect                      sys_select                      compat_sys_select
+143    common  flock                           sys_flock
+144    common  msync                           sys_msync
+145    common  readv                           sys_readv                       compat_sys_readv
+146    common  writev                          sys_writev                      compat_sys_writev
+147    common  getsid                          sys_getsid
+148    common  fdatasync                       sys_fdatasync
+149    nospu   _sysctl                         sys_sysctl                      compat_sys_sysctl
+150    common  mlock                           sys_mlock
+151    common  munlock                         sys_munlock
+152    common  mlockall                        sys_mlockall
+153    common  munlockall                      sys_munlockall
+154    common  sched_setparam                  sys_sched_setparam
+155    common  sched_getparam                  sys_sched_getparam
+156    common  sched_setscheduler              sys_sched_setscheduler
+157    common  sched_getscheduler              sys_sched_getscheduler
+158    common  sched_yield                     sys_sched_yield
+159    common  sched_get_priority_max          sys_sched_get_priority_max
+160    common  sched_get_priority_min          sys_sched_get_priority_min
+161    common  sched_rr_get_interval           sys_sched_rr_get_interval       compat_sys_sched_rr_get_interval
+162    common  nanosleep                       sys_nanosleep                   compat_sys_nanosleep
+163    common  mremap                          sys_mremap
+164    common  setresuid                       sys_setresuid
+165    common  getresuid                       sys_getresuid
+166    common  query_module                    sys_ni_syscall
+167    common  poll                            sys_poll
+168    common  nfsservctl                      sys_ni_syscall
+169    common  setresgid                       sys_setresgid
+170    common  getresgid                       sys_getresgid
+171    common  prctl                           sys_prctl
+172    nospu   rt_sigreturn                    sys_rt_sigreturn                compat_sys_rt_sigreturn
+173    nospu   rt_sigaction                    sys_rt_sigaction                compat_sys_rt_sigaction
+174    nospu   rt_sigprocmask                  sys_rt_sigprocmask              compat_sys_rt_sigprocmask
+175    nospu   rt_sigpending                   sys_rt_sigpending               compat_sys_rt_sigpending
+176    nospu   rt_sigtimedwait                 sys_rt_sigtimedwait             compat_sys_rt_sigtimedwait
+177    nospu   rt_sigqueueinfo                 sys_rt_sigqueueinfo             compat_sys_rt_sigqueueinfo
+178    nospu   rt_sigsuspend                   sys_rt_sigsuspend               compat_sys_rt_sigsuspend
+179    common  pread64                         sys_pread64                     compat_sys_pread64
+180    common  pwrite64                        sys_pwrite64                    compat_sys_pwrite64
+181    common  chown                           sys_chown
+182    common  getcwd                          sys_getcwd
+183    common  capget                          sys_capget
+184    common  capset                          sys_capset
+185    nospu   sigaltstack                     sys_sigaltstack                 compat_sys_sigaltstack
+186    32      sendfile                        sys_sendfile                    compat_sys_sendfile
+186    64      sendfile                        sys_sendfile64
+186    spu     sendfile                        sys_sendfile64
+187    common  getpmsg                         sys_ni_syscall
+188    common  putpmsg                         sys_ni_syscall
+189    nospu   vfork                           ppc_vfork
+190    common  ugetrlimit                      sys_getrlimit                   compat_sys_getrlimit
+191    common  readahead                       sys_readahead                   compat_sys_readahead
+192    32      mmap2                           sys_mmap2                       compat_sys_mmap2
+193    32      truncate64                      sys_truncate64                  compat_sys_truncate64
+194    32      ftruncate64                     sys_ftruncate64                 compat_sys_ftruncate64
+195    32      stat64                          sys_stat64
+196    32      lstat64                         sys_lstat64
+197    32      fstat64                         sys_fstat64
+198    nospu   pciconfig_read                  sys_pciconfig_read
+199    nospu   pciconfig_write                 sys_pciconfig_write
+200    nospu   pciconfig_iobase                sys_pciconfig_iobase
+201    common  multiplexer                     sys_ni_syscall
+202    common  getdents64                      sys_getdents64
+203    common  pivot_root                      sys_pivot_root
+204    32      fcntl64                         sys_fcntl64                     compat_sys_fcntl64
+205    common  madvise                         sys_madvise
+206    common  mincore                         sys_mincore
+207    common  gettid                          sys_gettid
+208    common  tkill                           sys_tkill
+209    common  setxattr                        sys_setxattr
+210    common  lsetxattr                       sys_lsetxattr
+211    common  fsetxattr                       sys_fsetxattr
+212    common  getxattr                        sys_getxattr
+213    common  lgetxattr                       sys_lgetxattr
+214    common  fgetxattr                       sys_fgetxattr
+215    common  listxattr                       sys_listxattr
+216    common  llistxattr                      sys_llistxattr
+217    common  flistxattr                      sys_flistxattr
+218    common  removexattr                     sys_removexattr
+219    common  lremovexattr                    sys_lremovexattr
+220    common  fremovexattr                    sys_fremovexattr
+221    common  futex                           sys_futex                       compat_sys_futex
+222    common  sched_setaffinity               sys_sched_setaffinity           compat_sys_sched_setaffinity
+223    common  sched_getaffinity               sys_sched_getaffinity           compat_sys_sched_getaffinity
+# 224 unused
+225    common  tuxcall                         sys_ni_syscall
+226    32      sendfile64                      sys_sendfile64                  compat_sys_sendfile64
+227    common  io_setup                        sys_io_setup                    compat_sys_io_setup
+228    common  io_destroy                      sys_io_destroy
+229    common  io_getevents                    sys_io_getevents                compat_sys_io_getevents
+230    common  io_submit                       sys_io_submit                   compat_sys_io_submit
+231    common  io_cancel                       sys_io_cancel
+232    nospu   set_tid_address                 sys_set_tid_address
+233    common  fadvise64                       sys_fadvise64                   ppc32_fadvise64
+234    nospu   exit_group                      sys_exit_group
+235    nospu   lookup_dcookie                  sys_lookup_dcookie              compat_sys_lookup_dcookie
+236    common  epoll_create                    sys_epoll_create
+237    common  epoll_ctl                       sys_epoll_ctl
+238    common  epoll_wait                      sys_epoll_wait
+239    common  remap_file_pages                sys_remap_file_pages
+240    common  timer_create                    sys_timer_create                compat_sys_timer_create
+241    common  timer_settime                   sys_timer_settime               compat_sys_timer_settime
+242    common  timer_gettime                   sys_timer_gettime               compat_sys_timer_gettime
+243    common  timer_getoverrun                sys_timer_getoverrun
+244    common  timer_delete                    sys_timer_delete
+245    common  clock_settime                   sys_clock_settime               compat_sys_clock_settime
+246    common  clock_gettime                   sys_clock_gettime               compat_sys_clock_gettime
+247    common  clock_getres                    sys_clock_getres                compat_sys_clock_getres
+248    common  clock_nanosleep                 sys_clock_nanosleep             compat_sys_clock_nanosleep
+249    32      swapcontext                     ppc_swapcontext                 ppc32_swapcontext
+249    64      swapcontext                     ppc64_swapcontext
+249    spu     swapcontext                     sys_ni_syscall
+250    common  tgkill                          sys_tgkill
+251    common  utimes                          sys_utimes                      compat_sys_utimes
+252    common  statfs64                        sys_statfs64                    compat_sys_statfs64
+253    common  fstatfs64                       sys_fstatfs64                   compat_sys_fstatfs64
+254    32      fadvise64_64                    ppc_fadvise64_64
+254    spu     fadvise64_64                    sys_ni_syscall
+255    common  rtas                            sys_rtas
+256    32      sys_debug_setcontext            sys_debug_setcontext            sys_ni_syscall
+256    64      sys_debug_setcontext            sys_ni_syscall
+256    spu     sys_debug_setcontext            sys_ni_syscall
+# 257 reserved for vserver
+258    nospu   migrate_pages                   sys_migrate_pages               compat_sys_migrate_pages
+259    nospu   mbind                           sys_mbind                       compat_sys_mbind
+260    nospu   get_mempolicy                   sys_get_mempolicy               compat_sys_get_mempolicy
+261    nospu   set_mempolicy                   sys_set_mempolicy               compat_sys_set_mempolicy
+262    nospu   mq_open                         sys_mq_open                     compat_sys_mq_open
+263    nospu   mq_unlink                       sys_mq_unlink
+264    nospu   mq_timedsend                    sys_mq_timedsend                compat_sys_mq_timedsend
+265    nospu   mq_timedreceive                 sys_mq_timedreceive             compat_sys_mq_timedreceive
+266    nospu   mq_notify                       sys_mq_notify                   compat_sys_mq_notify
+267    nospu   mq_getsetattr                   sys_mq_getsetattr               compat_sys_mq_getsetattr
+268    nospu   kexec_load                      sys_kexec_load                  compat_sys_kexec_load
+269    nospu   add_key                         sys_add_key
+270    nospu   request_key                     sys_request_key
+271    nospu   keyctl                          sys_keyctl                      compat_sys_keyctl
+272    nospu   waitid                          sys_waitid                      compat_sys_waitid
+273    nospu   ioprio_set                      sys_ioprio_set
+274    nospu   ioprio_get                      sys_ioprio_get
+275    nospu   inotify_init                    sys_inotify_init
+276    nospu   inotify_add_watch               sys_inotify_add_watch
+277    nospu   inotify_rm_watch                sys_inotify_rm_watch
+278    nospu   spu_run                         sys_spu_run
+279    nospu   spu_create                      sys_spu_create
+280    nospu   pselect6                        sys_pselect6                    compat_sys_pselect6
+281    nospu   ppoll                           sys_ppoll                       compat_sys_ppoll
+282    common  unshare                         sys_unshare
+283    common  splice                          sys_splice
+284    common  tee                             sys_tee
+285    common  vmsplice                        sys_vmsplice                    compat_sys_vmsplice
+286    common  openat                          sys_openat                      compat_sys_openat
+287    common  mkdirat                         sys_mkdirat
+288    common  mknodat                         sys_mknodat
+289    common  fchownat                        sys_fchownat
+290    common  futimesat                       sys_futimesat                   compat_sys_futimesat
+291    32      fstatat64                       sys_fstatat64
+291    64      newfstatat                      sys_newfstatat
+291    spu     newfstatat                      sys_newfstatat
+292    common  unlinkat                        sys_unlinkat
+293    common  renameat                        sys_renameat
+294    common  linkat                          sys_linkat
+295    common  symlinkat                       sys_symlinkat
+296    common  readlinkat                      sys_readlinkat
+297    common  fchmodat                        sys_fchmodat
+298    common  faccessat                       sys_faccessat
+299    common  get_robust_list                 sys_get_robust_list             compat_sys_get_robust_list
+300    common  set_robust_list                 sys_set_robust_list             compat_sys_set_robust_list
+301    common  move_pages                      sys_move_pages                  compat_sys_move_pages
+302    common  getcpu                          sys_getcpu
+303    nospu   epoll_pwait                     sys_epoll_pwait                 compat_sys_epoll_pwait
+304    common  utimensat                       sys_utimensat                   compat_sys_utimensat
+305    common  signalfd                        sys_signalfd                    compat_sys_signalfd
+306    common  timerfd_create                  sys_timerfd_create
+307    common  eventfd                         sys_eventfd
+308    common  sync_file_range2                sys_sync_file_range2            compat_sys_sync_file_range2
+309    nospu   fallocate                       sys_fallocate                   compat_sys_fallocate
+310    nospu   subpage_prot                    sys_subpage_prot
+311    common  timerfd_settime                 sys_timerfd_settime             compat_sys_timerfd_settime
+312    common  timerfd_gettime                 sys_timerfd_gettime             compat_sys_timerfd_gettime
+313    common  signalfd4                       sys_signalfd4                   compat_sys_signalfd4
+314    common  eventfd2                        sys_eventfd2
+315    common  epoll_create1                   sys_epoll_create1
+316    common  dup3                            sys_dup3
+317    common  pipe2                           sys_pipe2
+318    nospu   inotify_init1                   sys_inotify_init1
+319    common  perf_event_open                 sys_perf_event_open
+320    common  preadv                          sys_preadv                      compat_sys_preadv
+321    common  pwritev                         sys_pwritev                     compat_sys_pwritev
+322    nospu   rt_tgsigqueueinfo               sys_rt_tgsigqueueinfo           compat_sys_rt_tgsigqueueinfo
+323    nospu   fanotify_init                   sys_fanotify_init
+324    nospu   fanotify_mark                   sys_fanotify_mark               compat_sys_fanotify_mark
+325    common  prlimit64                       sys_prlimit64
+326    common  socket                          sys_socket
+327    common  bind                            sys_bind
+328    common  connect                         sys_connect
+329    common  listen                          sys_listen
+330    common  accept                          sys_accept
+331    common  getsockname                     sys_getsockname
+332    common  getpeername                     sys_getpeername
+333    common  socketpair                      sys_socketpair
+334    common  send                            sys_send
+335    common  sendto                          sys_sendto
+336    common  recv                            sys_recv                        compat_sys_recv
+337    common  recvfrom                        sys_recvfrom                    compat_sys_recvfrom
+338    common  shutdown                        sys_shutdown
+339    common  setsockopt                      sys_setsockopt                  compat_sys_setsockopt
+340    common  getsockopt                      sys_getsockopt                  compat_sys_getsockopt
+341    common  sendmsg                         sys_sendmsg                     compat_sys_sendmsg
+342    common  recvmsg                         sys_recvmsg                     compat_sys_recvmsg
+343    common  recvmmsg                        sys_recvmmsg                    compat_sys_recvmmsg
+344    common  accept4                         sys_accept4
+345    common  name_to_handle_at               sys_name_to_handle_at
+346    common  open_by_handle_at               sys_open_by_handle_at           compat_sys_open_by_handle_at
+347    common  clock_adjtime                   sys_clock_adjtime               compat_sys_clock_adjtime
+348    common  syncfs                          sys_syncfs
+349    common  sendmmsg                        sys_sendmmsg                    compat_sys_sendmmsg
+350    common  setns                           sys_setns
+351    nospu   process_vm_readv                sys_process_vm_readv            compat_sys_process_vm_readv
+352    nospu   process_vm_writev               sys_process_vm_writev           compat_sys_process_vm_writev
+353    nospu   finit_module                    sys_finit_module
+354    nospu   kcmp                            sys_kcmp
+355    common  sched_setattr                   sys_sched_setattr
+356    common  sched_getattr                   sys_sched_getattr
+357    common  renameat2                       sys_renameat2
+358    common  seccomp                         sys_seccomp
+359    common  getrandom                       sys_getrandom
+360    common  memfd_create                    sys_memfd_create
+361    common  bpf                             sys_bpf
+362    nospu   execveat                        sys_execveat                    compat_sys_execveat
+363    32      switch_endian                   sys_ni_syscall
+363    64      switch_endian                   ppc_switch_endian
+363    spu     switch_endian                   sys_ni_syscall
+364    common  userfaultfd                     sys_userfaultfd
+365    common  membarrier                      sys_membarrier
+378    nospu   mlock2                          sys_mlock2
+379    nospu   copy_file_range                 sys_copy_file_range
+380    common  preadv2                         sys_preadv2                     compat_sys_preadv2
+381    common  pwritev2                        sys_pwritev2                    compat_sys_pwritev2
+382    nospu   kexec_file_load                 sys_kexec_file_load
+383    nospu   statx                           sys_statx
+384    nospu   pkey_alloc                      sys_pkey_alloc
+385    nospu   pkey_free                       sys_pkey_free
+386    nospu   pkey_mprotect                   sys_pkey_mprotect
+387    nospu   rseq                            sys_rseq
+388    nospu   io_pgetevents                   sys_io_pgetevents               compat_sys_io_pgetevents
index 1410d66..63a3afc 100644 (file)
@@ -561,7 +561,8 @@ try_again:
                                        break;
                        }
                }
-               wait4(child_pid, &status, 0, &stat_config.ru_data);
+               if (child_pid != -1)
+                       wait4(child_pid, &status, 0, &stat_config.ru_data);
 
                if (workload_exec_errno) {
                        const char *emsg = str_error_r(workload_exec_errno, msg, sizeof(msg));
index fe3ecfb..f64e312 100644 (file)
@@ -1028,12 +1028,7 @@ out_err:
 
 static int callchain_param__setup_sample_type(struct callchain_param *callchain)
 {
-       if (!perf_hpp_list.sym) {
-               if (callchain->enabled) {
-                       ui__error("Selected -g but \"sym\" not present in --sort/-s.");
-                       return -EINVAL;
-               }
-       } else if (callchain->mode != CHAIN_NONE) {
+       if (callchain->mode != CHAIN_NONE) {
                if (callchain_register_param(callchain) < 0) {
                        ui__error("Can't register callchain params.\n");
                        return -EINVAL;
index adbf281..ed45831 100644 (file)
@@ -1758,6 +1758,7 @@ static int trace__printf_interrupted_entry(struct trace *trace)
 {
        struct thread_trace *ttrace;
        size_t printed;
+       int len;
 
        if (trace->failure_only || trace->current == NULL)
                return 0;
@@ -1768,9 +1769,14 @@ static int trace__printf_interrupted_entry(struct trace *trace)
                return 0;
 
        printed  = trace__fprintf_entry_head(trace, trace->current, 0, false, ttrace->entry_time, trace->output);
-       printed += fprintf(trace->output, ")%-*s ...\n", trace->args_alignment, ttrace->entry_str);
-       ttrace->entry_pending = false;
+       printed += len = fprintf(trace->output, "%s)", ttrace->entry_str);
+
+       if (len < trace->args_alignment - 4)
+               printed += fprintf(trace->output, "%-*s", trace->args_alignment - 4 - len, " ");
 
+       printed += fprintf(trace->output, " ...\n");
+
+       ttrace->entry_pending = false;
        ++trace->nr_events_printed;
 
        return printed;
@@ -2026,9 +2032,10 @@ static int trace__sys_exit(struct trace *trace, struct perf_evsel *evsel,
        if (ttrace->entry_pending) {
                printed = fprintf(trace->output, "%s", ttrace->entry_str);
        } else {
-               fprintf(trace->output, " ... [");
+               printed += fprintf(trace->output, " ... [");
                color_fprintf(trace->output, PERF_COLOR_YELLOW, "continued");
-               fprintf(trace->output, "]: %s()", sc->name);
+               printed += 9;
+               printed += fprintf(trace->output, "]: %s()", sc->name);
        }
 
        printed++; /* the closing ')' */
index 6cb98f8..7b55613 100755 (executable)
@@ -10,6 +10,7 @@ include/uapi/linux/fs.h
 include/uapi/linux/kcmp.h
 include/uapi/linux/kvm.h
 include/uapi/linux/in.h
+include/uapi/linux/mount.h
 include/uapi/linux/perf_event.h
 include/uapi/linux/prctl.h
 include/uapi/linux/sched.h
@@ -49,7 +50,6 @@ arch/parisc/include/uapi/asm/errno.h
 arch/powerpc/include/uapi/asm/errno.h
 arch/sparc/include/uapi/asm/errno.h
 arch/x86/include/uapi/asm/errno.h
-arch/powerpc/include/uapi/asm/unistd.h
 include/asm-generic/bitops/arch_hweight.h
 include/asm-generic/bitops/const_hweight.h
 include/asm-generic/bitops/__fls.h
index 8c0ca0c..aaa5210 100644 (file)
@@ -5,17 +5,17 @@
 #define VDSO__MAP_NAME "[vdso]"
 
 /*
- * Include definition of find_vdso_map() also used in util/vdso.c for
+ * Include definition of find_map() also used in util/vdso.c for
  * building perf.
  */
-#include "util/find-vdso-map.c"
+#include "util/find-map.c"
 
 int main(void)
 {
        void *start, *end;
        size_t size, written;
 
-       if (find_vdso_map(&start, &end))
+       if (find_map(&start, &end, VDSO__MAP_NAME))
                return 1;
 
        size = end - start;
index 1c16e56..7cb99b4 100644 (file)
@@ -13,7 +13,8 @@ add_probe_vfs_getname() {
        local verbose=$1
        if [ $had_vfs_getname -eq 1 ] ; then
                line=$(perf probe -L getname_flags 2>&1 | egrep 'result.*=.*filename;' | sed -r 's/[[:space:]]+([[:digit:]]+)[[:space:]]+result->uptr.*/\1/')
-               perf probe $verbose "vfs_getname=getname_flags:${line} pathname=result->name:string"
+               perf probe -q       "vfs_getname=getname_flags:${line} pathname=result->name:string" || \
+               perf probe $verbose "vfs_getname=getname_flags:${line} pathname=filename:string"
        fi
 }
 
index b82f55f..399f18c 100644 (file)
@@ -119,4 +119,9 @@ int test__arch_unwind_sample(struct perf_sample *sample,
                             struct thread *thread);
 #endif
 #endif
+
+#if defined(__arm__)
+int test__vectors_page(struct test *test, int subtest);
+#endif
+
 #endif /* TESTS_H */
index 4554757..847850b 100755 (executable)
@@ -5,11 +5,11 @@
 
 printf "static const char *mount_flags[] = {\n"
 regex='^[[:space:]]*#[[:space:]]*define[[:space:]]+MS_([[:alnum:]_]+)[[:space:]]+([[:digit:]]+)[[:space:]]*.*'
-egrep $regex ${header_dir}/fs.h | egrep -v '(MSK|VERBOSE|MGC_VAL)\>' | \
+egrep $regex ${header_dir}/mount.h | egrep -v '(MSK|VERBOSE|MGC_VAL)\>' | \
        sed -r "s/$regex/\2 \2 \1/g" | sort -n | \
        xargs printf "\t[%s ? (ilog2(%s) + 1) : 0] = \"%s\",\n"
 regex='^[[:space:]]*#[[:space:]]*define[[:space:]]+MS_([[:alnum:]_]+)[[:space:]]+\(1<<([[:digit:]]+)\)[[:space:]]*.*'
-egrep $regex ${header_dir}/fs.h | \
+egrep $regex ${header_dir}/mount.h | \
        sed -r "s/$regex/\2 \1/g" | \
        xargs printf "\t[%s + 1] = \"%s\",\n"
 printf "};\n"
index d32f8f1..3109d7b 100755 (executable)
@@ -4,7 +4,7 @@
 [ $# -eq 1 ] && header_dir=$1 || header_dir=tools/include/uapi/linux/
 
 printf "static const char *prctl_options[] = {\n"
-regex='^#define[[:space:]]+PR_([GS]ET\w+)[[:space:]]*([[:xdigit:]]+).*'
+regex='^#define[[:space:]]+PR_(\w+)[[:space:]]*([[:xdigit:]]+).*'
 egrep $regex ${header_dir}/prctl.h | grep -v PR_SET_PTRACER | \
        sed -r "s/$regex/\2 \1/g"       | \
        sort -n | xargs printf "\t[%s] = \"%s\",\n"
index ac9805e..70de8f6 100644 (file)
@@ -1723,15 +1723,14 @@ static int symbol__disassemble(struct symbol *sym, struct annotate_args *args)
        err = asprintf(&command,
                 "%s %s%s --start-address=0x%016" PRIx64
                 " --stop-address=0x%016" PRIx64
-                " -l -d %s %s -C \"%s\" 2>/dev/null|grep -v \"%s:\"|expand",
+                " -l -d %s %s -C \"$1\" 2>/dev/null|grep -v \"$1:\"|expand",
                 opts->objdump_path ?: "objdump",
                 opts->disassembler_style ? "-M " : "",
                 opts->disassembler_style ?: "",
                 map__rip_2objdump(map, sym->start),
                 map__rip_2objdump(map, sym->end),
                 opts->show_asm_raw ? "" : "--no-show-raw",
-                opts->annotate_src ? "-S" : "",
-                symfs_filename, symfs_filename);
+                opts->annotate_src ? "-S" : "");
 
        if (err < 0) {
                pr_err("Failure allocating memory for the command to run\n");
@@ -1756,7 +1755,8 @@ static int symbol__disassemble(struct symbol *sym, struct annotate_args *args)
                close(stdout_fd[0]);
                dup2(stdout_fd[1], 1);
                close(stdout_fd[1]);
-               execl("/bin/sh", "sh", "-c", command, NULL);
+               execl("/bin/sh", "sh", "-c", command, "--", symfs_filename,
+                     NULL);
                perror(command);
                exit(-1);
        }
index 32ef7bd..dc2212e 100644 (file)
@@ -766,6 +766,7 @@ static enum match_result match_chain(struct callchain_cursor_node *node,
                        cnode->cycles_count += node->branch_flags.cycles;
                        cnode->iter_count += node->nr_loop_iter;
                        cnode->iter_cycles += node->iter_cycles;
+                       cnode->from_count++;
                }
        }
 
@@ -1345,10 +1346,10 @@ static int branch_to_str(char *bf, int bfsize,
 static int branch_from_str(char *bf, int bfsize,
                           u64 branch_count,
                           u64 cycles_count, u64 iter_count,
-                          u64 iter_cycles)
+                          u64 iter_cycles, u64 from_count)
 {
        int printed = 0, i = 0;
-       u64 cycles;
+       u64 cycles, v = 0;
 
        cycles = cycles_count / branch_count;
        if (cycles) {
@@ -1357,14 +1358,16 @@ static int branch_from_str(char *bf, int bfsize,
                                bf + printed, bfsize - printed);
        }
 
-       if (iter_count) {
-               printed += count_pri64_printf(i++, "iter",
-                               iter_count,
-                               bf + printed, bfsize - printed);
+       if (iter_count && from_count) {
+               v = iter_count / from_count;
+               if (v) {
+                       printed += count_pri64_printf(i++, "iter",
+                                       v, bf + printed, bfsize - printed);
 
-               printed += count_pri64_printf(i++, "avg_cycles",
-                               iter_cycles / iter_count,
-                               bf + printed, bfsize - printed);
+                       printed += count_pri64_printf(i++, "avg_cycles",
+                                       iter_cycles / iter_count,
+                                       bf + printed, bfsize - printed);
+               }
        }
 
        if (i)
@@ -1377,6 +1380,7 @@ static int counts_str_build(char *bf, int bfsize,
                             u64 branch_count, u64 predicted_count,
                             u64 abort_count, u64 cycles_count,
                             u64 iter_count, u64 iter_cycles,
+                            u64 from_count,
                             struct branch_type_stat *brtype_stat)
 {
        int printed;
@@ -1389,7 +1393,8 @@ static int counts_str_build(char *bf, int bfsize,
                                predicted_count, abort_count, brtype_stat);
        } else {
                printed = branch_from_str(bf, bfsize, branch_count,
-                               cycles_count, iter_count, iter_cycles);
+                               cycles_count, iter_count, iter_cycles,
+                               from_count);
        }
 
        if (!printed)
@@ -1402,13 +1407,14 @@ static int callchain_counts_printf(FILE *fp, char *bf, int bfsize,
                                   u64 branch_count, u64 predicted_count,
                                   u64 abort_count, u64 cycles_count,
                                   u64 iter_count, u64 iter_cycles,
+                                  u64 from_count,
                                   struct branch_type_stat *brtype_stat)
 {
        char str[256];
 
        counts_str_build(str, sizeof(str), branch_count,
                         predicted_count, abort_count, cycles_count,
-                        iter_count, iter_cycles, brtype_stat);
+                        iter_count, iter_cycles, from_count, brtype_stat);
 
        if (fp)
                return fprintf(fp, "%s", str);
@@ -1422,6 +1428,7 @@ int callchain_list_counts__printf_value(struct callchain_list *clist,
        u64 branch_count, predicted_count;
        u64 abort_count, cycles_count;
        u64 iter_count, iter_cycles;
+       u64 from_count;
 
        branch_count = clist->branch_count;
        predicted_count = clist->predicted_count;
@@ -1429,11 +1436,12 @@ int callchain_list_counts__printf_value(struct callchain_list *clist,
        cycles_count = clist->cycles_count;
        iter_count = clist->iter_count;
        iter_cycles = clist->iter_cycles;
+       from_count = clist->from_count;
 
        return callchain_counts_printf(fp, bf, bfsize, branch_count,
                                       predicted_count, abort_count,
                                       cycles_count, iter_count, iter_cycles,
-                                      &clist->brtype_stat);
+                                      from_count, &clist->brtype_stat);
 }
 
 static void free_callchain_node(struct callchain_node *node)
index 154560b..99d38ac 100644 (file)
@@ -118,6 +118,7 @@ struct callchain_list {
                bool            has_children;
        };
        u64                     branch_count;
+       u64                     from_count;
        u64                     predicted_count;
        u64                     abort_count;
        u64                     cycles_count;
similarity index 71%
rename from tools/perf/util/find-vdso-map.c
rename to tools/perf/util/find-map.c
index d7823e3..7b23005 100644 (file)
@@ -1,5 +1,5 @@
 // SPDX-License-Identifier: GPL-2.0
-static int find_vdso_map(void **start, void **end)
+static int find_map(void **start, void **end, const char *name)
 {
        FILE *maps;
        char line[128];
@@ -7,7 +7,7 @@ static int find_vdso_map(void **start, void **end)
 
        maps = fopen("/proc/self/maps", "r");
        if (!maps) {
-               fprintf(stderr, "vdso: cannot open maps\n");
+               fprintf(stderr, "cannot open maps\n");
                return -1;
        }
 
@@ -21,8 +21,7 @@ static int find_vdso_map(void **start, void **end)
                if (m < 0)
                        continue;
 
-               if (!strncmp(&line[m], VDSO__MAP_NAME,
-                            sizeof(VDSO__MAP_NAME) - 1))
+               if (!strncmp(&line[m], name, strlen(name)))
                        found = 1;
        }
 
index 6fcb3bc..143f705 100644 (file)
@@ -2005,7 +2005,7 @@ static void save_iterations(struct iterations *iter,
 {
        int i;
 
-       iter->nr_loop_iter = nr;
+       iter->nr_loop_iter++;
        iter->cycles = 0;
 
        for (i = 0; i < nr; i++)
index 9005fbe..23092fd 100644 (file)
@@ -109,7 +109,6 @@ static int strbuf_addv(struct strbuf *sb, const char *fmt, va_list ap)
                        return ret;
                }
                len = vsnprintf(sb->buf + sb->len, sb->alloc - sb->len, fmt, ap_saved);
-               va_end(ap_saved);
                if (len > strbuf_avail(sb)) {
                        pr_debug("this should not happen, your vsnprintf is broken");
                        va_end(ap_saved);
index 01f2c73..48efad6 100644 (file)
@@ -614,6 +614,7 @@ out:
 static bool symbol__is_idle(const char *name)
 {
        const char * const idle_symbols[] = {
+               "arch_cpu_idle",
                "cpu_idle",
                "cpu_startup_entry",
                "intel_idle",
index 741af20..3702cba 100644 (file)
 #include "debug.h"
 
 /*
- * Include definition of find_vdso_map() also used in perf-read-vdso.c for
+ * Include definition of find_map() also used in perf-read-vdso.c for
  * building perf-read-vdso32 and perf-read-vdsox32.
  */
-#include "find-vdso-map.c"
+#include "find-map.c"
 
 #define VDSO__TEMP_FILE_NAME "/tmp/perf-vdso.so-XXXXXX"
 
@@ -76,7 +76,7 @@ static char *get_file(struct vdso_file *vdso_file)
        if (vdso_file->found)
                return vdso_file->temp_file_name;
 
-       if (vdso_file->error || find_vdso_map(&start, &end))
+       if (vdso_file->error || find_map(&start, &end, VDSO__MAP_NAME))
                return NULL;
 
        size = end - start;
index 89a2444..59e417e 100644 (file)
@@ -6,7 +6,7 @@ VERSION = 1.0
 
 BINDIR=usr/bin
 WARNFLAGS=-Wall -Wshadow -W -Wformat -Wimplicit-function-declaration -Wimplicit-int
-override CFLAGS+= -O1 ${WARNFLAGS}
+override CFLAGS+= $(call cc-option,-O3,-O1) ${WARNFLAGS}
 # Add "-fstack-protector" only if toolchain supports it.
 override CFLAGS+= $(call cc-option,-fstack-protector-strong)
 CC?= $(CROSS_COMPILE)gcc
index 18fc112..d3a8755 100644 (file)
@@ -5,7 +5,9 @@
  * Example use:
  * cat /sys/kernel/debug/page_owner > page_owner_full.txt
  * grep -v ^PFN page_owner_full.txt > page_owner.txt
- * ./sort page_owner.txt sorted_page_owner.txt
+ * ./page_owner_sort page_owner.txt sorted_page_owner.txt
+ *
+ * See Documentation/vm/page_owner.rst
 */
 
 #include <stdio.h>
index 1f888a1..5ecea81 100644 (file)
@@ -1227,9 +1227,9 @@ int kvm_clear_dirty_log_protect(struct kvm *kvm,
 {
        struct kvm_memslots *slots;
        struct kvm_memory_slot *memslot;
-       int as_id, id, n;
+       int as_id, id;
        gfn_t offset;
-       unsigned long i;
+       unsigned long i, n;
        unsigned long *dirty_bitmap;
        unsigned long *dirty_bitmap_buffer;
 
@@ -1249,6 +1249,11 @@ int kvm_clear_dirty_log_protect(struct kvm *kvm,
                return -ENOENT;
 
        n = kvm_dirty_bitmap_bytes(memslot);
+
+       if (log->first_page > memslot->npages ||
+           log->num_pages > memslot->npages - log->first_page)
+                       return -EINVAL;
+
        *flush = false;
        dirty_bitmap_buffer = kvm_second_dirty_bitmap(memslot);
        if (copy_from_user(dirty_bitmap_buffer, log->dirty_bitmap, n))