]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
Merge tag 'exynos-drm-fixes-for-v5.6-rc5-v2' of git://git.kernel.org/pub/scm/linux...
authorDave Airlie <airlied@redhat.com>
Thu, 12 Mar 2020 01:02:46 +0000 (11:02 +1000)
committerDave Airlie <airlied@redhat.com>
Thu, 12 Mar 2020 01:02:52 +0000 (11:02 +1000)
Fix IOMMU initialization failure when Exynos DRM driver is rebound,
and also fix memory leak to iommu mapping object, which was
detected by kmemleak detector.

Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Inki Dae <inki.dae@samsung.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1583887109-4148-1-git-send-email-inki.dae@samsung.com
304 files changed:
.gitignore
Documentation/admin-guide/acpi/fan_performance_states.rst
Documentation/devicetree/bindings/arm/arm,scmi.txt
Documentation/devicetree/bindings/arm/arm,scpi.txt
Documentation/devicetree/bindings/arm/bcm/brcm,bcm63138.txt
Documentation/devicetree/bindings/arm/cpus.yaml
Documentation/devicetree/bindings/arm/fsl.yaml
Documentation/devicetree/bindings/arm/hisilicon/hi3519-sysctrl.txt
Documentation/devicetree/bindings/arm/msm/qcom,idle-state.txt
Documentation/devicetree/bindings/arm/omap/mpu.txt
Documentation/devicetree/bindings/arm/psci.yaml
Documentation/devicetree/bindings/arm/stm32/st,mlahb.yaml
Documentation/devicetree/bindings/bus/allwinner,sun8i-a23-rsb.yaml
Documentation/devicetree/bindings/clock/allwinner,sun4i-a10-osc-clk.yaml
Documentation/devicetree/bindings/clock/allwinner,sun9i-a80-gt-clk.yaml
Documentation/devicetree/bindings/clock/qcom,gcc-apq8064.yaml
Documentation/devicetree/bindings/display/allwinner,sun4i-a10-tv-encoder.yaml
Documentation/devicetree/bindings/display/bridge/anx6345.yaml
Documentation/devicetree/bindings/display/panel/leadtek,ltk500hd1829.yaml
Documentation/devicetree/bindings/display/panel/xinpeng,xpp055c272.yaml
Documentation/devicetree/bindings/display/simple-framebuffer.yaml
Documentation/devicetree/bindings/display/tilcdc/tilcdc.txt
Documentation/devicetree/bindings/dma/ti/k3-udma.yaml
Documentation/devicetree/bindings/gpu/arm,mali-bifrost.yaml
Documentation/devicetree/bindings/gpu/arm,mali-midgard.yaml
Documentation/devicetree/bindings/iio/adc/samsung,exynos-adc.yaml
Documentation/devicetree/bindings/input/touchscreen/goodix.yaml
Documentation/devicetree/bindings/input/twl4030-pwrbutton.txt
Documentation/devicetree/bindings/leds/common.yaml
Documentation/devicetree/bindings/leds/register-bit-led.txt
Documentation/devicetree/bindings/media/ti,cal.yaml
Documentation/devicetree/bindings/memory-controllers/ti/emif.txt
Documentation/devicetree/bindings/mfd/max77650.yaml
Documentation/devicetree/bindings/mfd/tps65910.txt
Documentation/devicetree/bindings/mfd/twl-family.txt [moved from Documentation/devicetree/bindings/mfd/twl-familly.txt with 100% similarity]
Documentation/devicetree/bindings/mfd/zii,rave-sp.txt
Documentation/devicetree/bindings/misc/fsl,qoriq-mc.txt
Documentation/devicetree/bindings/mmc/mmc-controller.yaml
Documentation/devicetree/bindings/mtd/cadence-nand-controller.txt
Documentation/devicetree/bindings/net/brcm,bcm7445-switch-v4.0.txt
Documentation/devicetree/bindings/nvmem/nvmem.yaml
Documentation/devicetree/bindings/phy/allwinner,sun4i-a10-usb-phy.yaml
Documentation/devicetree/bindings/pinctrl/aspeed,ast2400-pinctrl.yaml
Documentation/devicetree/bindings/pinctrl/aspeed,ast2500-pinctrl.yaml
Documentation/devicetree/bindings/pinctrl/aspeed,ast2600-pinctrl.yaml
Documentation/devicetree/bindings/pinctrl/st,stm32-pinctrl.yaml
Documentation/devicetree/bindings/power/amlogic,meson-ee-pwrc.yaml
Documentation/devicetree/bindings/power/domain-idle-state.txt [deleted file]
Documentation/devicetree/bindings/power/domain-idle-state.yaml [new file with mode: 0644]
Documentation/devicetree/bindings/power/power-domain.yaml
Documentation/devicetree/bindings/power/power_domain.txt
Documentation/devicetree/bindings/regulator/qcom,spmi-regulator.txt
Documentation/devicetree/bindings/regulator/regulator.yaml
Documentation/devicetree/bindings/reset/intel,rcu-gw.yaml
Documentation/devicetree/bindings/reset/st,stm32mp1-rcc.txt
Documentation/devicetree/bindings/sound/st,stm32-sai.txt
Documentation/devicetree/bindings/sound/st,stm32-spdifrx.txt
Documentation/devicetree/bindings/spi/st,stm32-spi.yaml
Documentation/devicetree/bindings/sram/allwinner,sun4i-a10-system-control.yaml
Documentation/devicetree/bindings/thermal/brcm,avs-ro-thermal.yaml
Documentation/devicetree/bindings/timer/allwinner,sun4i-a10-timer.yaml
Documentation/driver-api/dmaengine/client.rst
Documentation/filesystems/debugfs.txt
Documentation/hwmon/adm1177.rst
MAINTAINERS
Makefile
arch/Kconfig
arch/arm/boot/dts/am437x-idk-evm.dts
arch/arm/boot/dts/bcm2711-rpi-4-b.dts
arch/arm/boot/dts/bcm2837-rpi-3-a-plus.dts
arch/arm/boot/dts/bcm2837-rpi-3-b-plus.dts
arch/arm/boot/dts/dra7-evm.dts
arch/arm/boot/dts/dra7-l4.dtsi
arch/arm/boot/dts/dra7.dtsi
arch/arm/boot/dts/dra76x.dtsi
arch/arm/boot/dts/dra7xx-clocks.dtsi
arch/arm/boot/dts/imx6dl-colibri-eval-v3.dts
arch/arm/boot/dts/imx6qdl-phytec-phycore-som.dtsi
arch/arm/boot/dts/imx7-colibri.dtsi
arch/arm/boot/dts/imx7d.dtsi
arch/arm/boot/dts/ls1021a.dtsi
arch/arm/boot/dts/motorola-mapphone-common.dtsi
arch/arm/boot/dts/r8a7779.dtsi
arch/arm/configs/bcm2835_defconfig
arch/arm/configs/omap2plus_defconfig
arch/arm/configs/socfpga_defconfig
arch/arm/mach-imx/Makefile
arch/arm/mach-imx/common.h
arch/arm/mach-imx/resume-imx6.S [new file with mode: 0644]
arch/arm/mach-imx/suspend-imx6.S
arch/arm/mach-meson/Kconfig
arch/arm/mach-omap2/Makefile
arch/arm/mach-omap2/io.c
arch/arm64/boot/dts/amlogic/meson-gxm-khadas-vim2.dts
arch/arm64/boot/dts/amlogic/meson-sm1-sei610.dts
arch/arm64/boot/dts/freescale/imx8qxp-mek.dts
arch/arm64/boot/dts/intel/socfpga_agilex.dtsi
arch/arm64/configs/defconfig
arch/arm64/mm/context.c
arch/powerpc/kernel/cputable.c
arch/powerpc/kernel/hw_breakpoint.c
arch/powerpc/kernel/vmlinux.lds.S
arch/powerpc/mm/mem.c
arch/riscv/Kconfig
arch/riscv/Kconfig.socs
arch/riscv/Makefile
arch/riscv/boot/dts/sifive/hifive-unleashed-a00.dts
arch/riscv/configs/defconfig
arch/riscv/configs/rv32_defconfig
arch/riscv/include/asm/syscall.h
arch/riscv/kernel/entry.S
arch/riscv/kernel/module.c
arch/riscv/kernel/ptrace.c
arch/riscv/mm/init.c
arch/s390/include/asm/pgtable.h
arch/s390/pci/pci.c
arch/x86/include/asm/io_bitmap.h
arch/x86/include/asm/paravirt.h
arch/x86/include/asm/paravirt_types.h
arch/x86/kernel/cpu/common.c
arch/x86/kernel/paravirt.c
arch/x86/kernel/process.c
arch/x86/mm/dump_pagetables.c
arch/x86/platform/efi/efi_64.c
arch/x86/xen/enlighten_pv.c
block/bfq-cgroup.c
block/blk-core.c
drivers/android/binder.c
drivers/android/binder_internal.h
drivers/android/binderfs.c
drivers/base/core.c
drivers/base/swnode.c
drivers/block/xen-blkfront.c
drivers/bus/ti-sysc.c
drivers/dma/coh901318.c
drivers/dma/idxd/cdev.c
drivers/dma/idxd/sysfs.c
drivers/dma/imx-sdma.c
drivers/dma/tegra20-apb-dma.c
drivers/dma/ti/k3-udma.c
drivers/edac/synopsys_edac.c
drivers/firmware/efi/efi.c
drivers/firmware/imx/imx-scu.c
drivers/firmware/imx/misc.c
drivers/firmware/imx/scu-pd.c
drivers/hid/hid-hyperv.c
drivers/hwmon/adt7462.c
drivers/hwmon/pmbus/xdpe12284.c
drivers/infiniband/core/cm.c
drivers/infiniband/core/cma.c
drivers/infiniband/core/core_priv.h
drivers/infiniband/core/iwcm.c
drivers/infiniband/core/nldev.c
drivers/infiniband/core/rw.c
drivers/infiniband/core/security.c
drivers/infiniband/core/umem_odp.c
drivers/infiniband/core/uverbs_cmd.c
drivers/infiniband/core/verbs.c
drivers/infiniband/hw/hfi1/verbs.c
drivers/infiniband/hw/mlx5/mlx5_ib.h
drivers/infiniband/hw/mlx5/odp.c
drivers/infiniband/hw/qib/qib_verbs.c
drivers/infiniband/sw/siw/siw_main.c
drivers/interconnect/core.c
drivers/md/bcache/alloc.c
drivers/md/bcache/btree.c
drivers/md/dm-bio-record.h
drivers/md/dm-cache-target.c
drivers/md/dm-integrity.c
drivers/md/dm-mpath.c
drivers/md/dm-thin-metadata.c
drivers/md/dm-verity-target.c
drivers/md/dm-writecache.c
drivers/md/dm-zoned-target.c
drivers/md/dm.c
drivers/media/mc/mc-entity.c
drivers/media/platform/vicodec/codec-v4l2-fwht.c
drivers/media/usb/pulse8-cec/pulse8-cec.c
drivers/media/v4l2-core/v4l2-mem2mem.c
drivers/misc/altera-stapl/altera.c
drivers/perf/arm_pmu_acpi.c
drivers/perf/fsl_imx8_ddr_perf.c
drivers/phy/allwinner/phy-sun50i-usb3.c
drivers/phy/broadcom/phy-brcm-sata.c
drivers/phy/motorola/phy-mapphone-mdm6600.c
drivers/phy/phy-core.c
drivers/phy/ti/phy-gmii-sel.c
drivers/regulator/stm32-vrefbuf.c
drivers/reset/Kconfig
drivers/soc/imx/soc-imx-scu.c
drivers/spi/atmel-quadspi.c
drivers/spi/spi-bcm63xx-hsspi.c
drivers/spi/spi-omap2-mcspi.c
drivers/spi/spi-pxa2xx.c
drivers/spi/spi-qup.c
drivers/spi/spi-zynqmp-gqspi.c
drivers/spi/spi.c
drivers/spi/spidev.c
drivers/staging/media/hantro/hantro_drv.c
drivers/staging/speakup/selection.c
drivers/staging/wfx/Documentation/devicetree/bindings/net/wireless/siliabs,wfx.txt
drivers/tee/amdtee/core.c
drivers/tty/serdev/core.c
drivers/tty/serial/8250/8250_exar.c
drivers/tty/serial/fsl_lpuart.c
drivers/tty/serial/mvebu-uart.c
drivers/tty/vt/selection.c
drivers/tty/vt/vt.c
drivers/usb/cdns3/gadget.c
drivers/usb/core/hub.c
drivers/usb/core/port.c
drivers/usb/core/quirks.c
drivers/usb/dwc3/gadget.c
drivers/usb/misc/usb251xb.c
drivers/usb/storage/unusual_devs.h
drivers/video/backlight/Kconfig
drivers/video/backlight/Makefile
drivers/video/backlight/led_bl.c [new file with mode: 0644]
drivers/xen/xen-pciback/pciback.h
drivers/xen/xenbus/xenbus_comms.c
drivers/xen/xenbus/xenbus_probe.c
drivers/xen/xenbus/xenbus_probe_backend.c
drivers/xen/xenbus/xenbus_xs.c
fs/btrfs/inode.c
fs/cifs/cifs_dfs_ref.c
fs/cifs/cifsfs.c
fs/cifs/cifsglob.h
fs/cifs/cifsproto.h
fs/cifs/cifssmb.c
fs/cifs/file.c
fs/cifs/inode.c
fs/cifs/smb1ops.c
fs/cifs/smb2inode.c
fs/cifs/smb2ops.c
fs/cifs/smb2pdu.c
fs/debugfs/file.c
fs/fat/inode.c
fs/fcntl.c
fs/io-wq.c
fs/io-wq.h
fs/io_uring.c
fs/locks.c
include/linux/blkdev.h
include/linux/debugfs.h
include/linux/device.h
include/linux/mm.h
include/linux/platform_data/spi-omap2-mcspi.h
include/sound/soc.h
include/uapi/linux/dm-ioctl.h
include/xen/interface/io/tpmif.h
include/xen/xenbus.h
kernel/exit.c
kernel/fork.c
kernel/sched/fair.c
kernel/trace/blktrace.c
mm/huge_memory.c
mm/memory.c
mm/memory_hotplug.c
mm/mprotect.c
mm/z3fold.c
scripts/parse-maintainers.pl [changed mode: 0644->0755]
sound/mips/sgio2audio.c
sound/pci/hda/patch_realtek.c
sound/soc/codecs/Kconfig
sound/soc/codecs/pcm512x.c
sound/soc/codecs/rt1015.c
sound/soc/codecs/tas2562.c
sound/soc/intel/skylake/skl-debug.c
sound/soc/intel/skylake/skl-ssp-clk.c
sound/soc/meson/g12a-tohdmitx.c
sound/soc/soc-component.c
sound/soc/soc-compress.c
sound/soc/soc-dapm.c
sound/soc/soc-pcm.c
sound/soc/soc-topology.c
sound/soc/sof/ipc.c
sound/soc/stm/stm32_sai_sub.c
tools/arch/x86/include/asm/msr-index.h
tools/arch/x86/include/uapi/asm/kvm.h
tools/perf/Documentation/perf-config.txt
tools/perf/arch/arm/util/cs-etm.c
tools/perf/arch/arm64/util/arm-spe.c
tools/perf/arch/powerpc/entry/syscalls/syscall.tbl
tools/perf/arch/x86/util/intel-bts.c
tools/perf/arch/x86/util/intel-pt.c
tools/perf/builtin-annotate.c
tools/perf/builtin-probe.c
tools/perf/builtin-report.c
tools/perf/builtin-top.c
tools/perf/include/bpf/pid_filter.h
tools/perf/include/bpf/stdio.h
tools/perf/include/bpf/unistd.h
tools/perf/tests/shell/lib/probe_vfs_getname.sh
tools/perf/ui/browsers/annotate.c
tools/perf/ui/gtk/annotate.c
tools/perf/util/annotate.c
tools/perf/util/annotate.h
tools/perf/util/auxtrace.c
tools/perf/util/auxtrace.h
tools/perf/util/config.c
tools/perf/util/config.h
tools/perf/util/probe-file.c
tools/testing/selftests/lkdtm/.gitignore [new file with mode: 0644]
tools/testing/selftests/pidfd/.gitignore

index 2763fce8766c09417fa6a4b9885e04a66c409b03..72ef86a5570d28015d0ccb95ccd212bf8820c1c2 100644 (file)
@@ -100,10 +100,6 @@ modules.order
 /include/ksym/
 /arch/*/include/generated/
 
-# Generated lkdtm tests
-/tools/testing/selftests/lkdtm/*.sh
-!/tools/testing/selftests/lkdtm/run.sh
-
 # stgit generated dirs
 patches-*
 
index 21d233ca50d8b1009cb21bd033088af60d297c39..98fe5c3331214df8745ba8fab3e25875bdec7f8f 100644 (file)
@@ -18,7 +18,7 @@ may look as follows::
 
  $ ls -l /sys/bus/acpi/devices/INT3404:00/
  total 0
-...
+ ...
  -r--r--r-- 1 root root 4096 Dec 13 20:38 state0
  -r--r--r-- 1 root root 4096 Dec 13 20:38 state1
  -r--r--r-- 1 root root 4096 Dec 13 20:38 state10
@@ -38,7 +38,7 @@ where each of the "state*" files represents one performance state of the fan
 and contains a colon-separated list of 5 integer numbers (fields) with the
 following interpretation::
 
-control_percent:trip_point_index:speed_rpm:noise_level_mdb:power_mw
+  control_percent:trip_point_index:speed_rpm:noise_level_mdb:power_mw
 
 * ``control_percent``: The percent value to be used to set the fan speed to a
   specific level using the _FSL object (0-100).
index f493d69e61946acf1d50476fad0429645e96114e..dc102c4e4a78b8cf6f79fae1fdf502f7dac924cb 100644 (file)
@@ -102,7 +102,7 @@ Required sub-node properties:
 [1] Documentation/devicetree/bindings/clock/clock-bindings.txt
 [2] Documentation/devicetree/bindings/power/power-domain.yaml
 [3] Documentation/devicetree/bindings/thermal/thermal.txt
-[4] Documentation/devicetree/bindings/sram/sram.txt
+[4] Documentation/devicetree/bindings/sram/sram.yaml
 [5] Documentation/devicetree/bindings/reset/reset.txt
 
 Example:
index 7b83ef43b41877ba783f47863d51f76d60813df9..dd04d9d9a1b8e0b06e43d16683feb440ebbff4d5 100644 (file)
@@ -109,7 +109,7 @@ Required properties:
 [0] http://infocenter.arm.com/help/topic/com.arm.doc.dui0922b/index.html
 [1] Documentation/devicetree/bindings/clock/clock-bindings.txt
 [2] Documentation/devicetree/bindings/thermal/thermal.txt
-[3] Documentation/devicetree/bindings/sram/sram.txt
+[3] Documentation/devicetree/bindings/sram/sram.yaml
 [4] Documentation/devicetree/bindings/power/power-domain.yaml
 
 Example:
index b82b6a0ae6f725cee5f6138657e05bdb92e138f7..8c7a4908a8492cf17a65a6eee99c457312982883 100644 (file)
@@ -62,7 +62,7 @@ Timer node:
 
 Syscon reboot node:
 
-See Documentation/devicetree/bindings/power/reset/syscon-reboot.txt for the
+See Documentation/devicetree/bindings/power/reset/syscon-reboot.yaml for the
 detailed list of properties, the two values defined below are specific to the
 BCM6328-style timer:
 
index 7a9c3ce2dbef991d87c2111609c0aff4db40ca57..0d5b61056b106db0a356f473b2e9fa448838f7ed 100644 (file)
@@ -216,7 +216,7 @@ properties:
     $ref: '/schemas/types.yaml#/definitions/phandle-array'
     description: |
       List of phandles to idle state nodes supported
-      by this cpu (see ./idle-states.txt).
+      by this cpu (see ./idle-states.yaml).
 
   capacity-dmips-mhz:
     $ref: '/schemas/types.yaml#/definitions/uint32'
index a8e0b4a813edcf4e6f21803f9afe2896cdab0d88..0e17e1f6fb807e233723c9b53c732269b1a60b06 100644 (file)
@@ -160,7 +160,7 @@ properties:
         items:
           - enum:
               - armadeus,imx6dl-apf6      # APF6 (Solo) SoM
-              - armadeus,imx6dl-apf6dldev # APF6 (Solo) SoM on APF6Dev board
+              - armadeus,imx6dl-apf6dev   # APF6 (Solo) SoM on APF6Dev board
               - eckelmann,imx6dl-ci4x10
               - emtrion,emcon-mx6         # emCON-MX6S or emCON-MX6DL SoM
               - emtrion,emcon-mx6-avari   # emCON-MX6S or emCON-MX6DL SoM on Avari Base
index 115c5be0bd0b0a3db9d6fc8df048bfd33ec81622..8defacc44dd5b9e43a62f1db0fc5cea34a0edfd5 100644 (file)
@@ -1,7 +1,7 @@
 * Hisilicon Hi3519 System Controller Block
 
 This bindings use the following binding:
-Documentation/devicetree/bindings/mfd/syscon.txt
+Documentation/devicetree/bindings/mfd/syscon.yaml
 
 Required properties:
 - compatible: "hisilicon,hi3519-sysctrl".
index 06df04cc827a5eaba364f86f6800d1c0a84773d5..6ce0b212ec6d6447f4ef037ec2588278d72d0ef4 100644 (file)
@@ -81,4 +81,4 @@ Example:
                };
        };
 
-[1]. Documentation/devicetree/bindings/arm/idle-states.txt
+[1]. Documentation/devicetree/bindings/arm/idle-states.yaml
index f301e636fd525b9dd9fd11bffe718332f38c0da9..e41490e6979c3df792a57d0d44246d331ec8d847 100644 (file)
@@ -17,7 +17,7 @@ am335x and am437x only:
 - pm-sram: Phandles to ocmcram nodes to be used for power management.
           First should be type 'protect-exec' for the driver to use to copy
           and run PM functions, second should be regular pool to be used for
-          data region for code. See Documentation/devicetree/bindings/sram/sram.txt
+          data region for code. See Documentation/devicetree/bindings/sram/sram.yaml
           for more details.
 
 Examples:
index 8ef85420b2ab1913786fc69dd5fbfda86c8c1f0b..5e66934455bbc986afb759e32be3ed2e4e80b8a5 100644 (file)
@@ -100,13 +100,14 @@ properties:
       bindings in [1]) must specify this property.
 
       [1] Kernel documentation - ARM idle states bindings
-        Documentation/devicetree/bindings/arm/idle-states.txt
-
-  "#power-domain-cells":
-    description:
-      The number of cells in a PM domain specifier as per binding in [3].
-      Must be 0 as to represent a single PM domain.
+        Documentation/devicetree/bindings/arm/idle-states.yaml
 
+patternProperties:
+  "^power-domain-":
+    allOf:
+      - $ref: "../power/power-domain.yaml#"
+    type: object
+    description: |
       ARM systems can have multiple cores, sometimes in an hierarchical
       arrangement. This often, but not always, maps directly to the processor
       power topology of the system. Individual nodes in a topology have their
@@ -122,14 +123,8 @@ properties:
       helps to implement support for OSI mode and OS implementations may choose
       to mandate it.
 
-      [3] Documentation/devicetree/bindings/power/power_domain.txt
-      [4] Documentation/devicetree/bindings/power/domain-idle-state.txt
-
-  power-domains:
-    $ref: '/schemas/types.yaml#/definitions/phandle-array'
-    description:
-      List of phandles and PM domain specifiers, as defined by bindings of the
-      PM domain provider.
+      [3] Documentation/devicetree/bindings/power/power-domain.yaml
+      [4] Documentation/devicetree/bindings/power/domain-idle-state.yaml
 
 required:
   - compatible
@@ -199,7 +194,7 @@ examples:
 
       CPU0: cpu@0 {
         device_type = "cpu";
-        compatible = "arm,cortex-a53", "arm,armv8";
+        compatible = "arm,cortex-a53";
         reg = <0x0>;
         enable-method = "psci";
         power-domains = <&CPU_PD0>;
@@ -208,7 +203,7 @@ examples:
 
       CPU1: cpu@1 {
         device_type = "cpu";
-        compatible = "arm,cortex-a57", "arm,armv8";
+        compatible = "arm,cortex-a53";
         reg = <0x100>;
         enable-method = "psci";
         power-domains = <&CPU_PD1>;
@@ -224,6 +219,9 @@ examples:
           exit-latency-us = <10>;
           min-residency-us = <100>;
         };
+      };
+
+      domain-idle-states {
 
         CLUSTER_RET: cluster-retention {
           compatible = "domain-idle-state";
@@ -247,19 +245,19 @@ examples:
       compatible = "arm,psci-1.0";
       method = "smc";
 
-      CPU_PD0: cpu-pd0 {
+      CPU_PD0: power-domain-cpu0 {
         #power-domain-cells = <0>;
         domain-idle-states = <&CPU_PWRDN>;
         power-domains = <&CLUSTER_PD>;
       };
 
-      CPU_PD1: cpu-pd1 {
+      CPU_PD1: power-domain-cpu1 {
         #power-domain-cells = <0>;
         domain-idle-states =  <&CPU_PWRDN>;
         power-domains = <&CLUSTER_PD>;
       };
 
-      CLUSTER_PD: cluster-pd {
+      CLUSTER_PD: power-domain-cluster {
         #power-domain-cells = <0>;
         domain-idle-states = <&CLUSTER_RET>, <&CLUSTER_PWRDN>;
       };
index 68917bb7c7e8727a55ad52cb03dd7bbc649b3441..55f7938c48260149736fc0117cdc669c23011bd9 100644 (file)
@@ -52,7 +52,7 @@ required:
 
 examples:
   - |
-    mlahb: ahb {
+    mlahb: ahb@38000000 {
       compatible = "st,mlahb", "simple-bus";
       #address-cells = <1>;
       #size-cells = <1>;
index 9fe11ceecdba004c5546f30711be002eaca64694..80973619342d9803bf43edf6a66f7b3bb10cd809 100644 (file)
@@ -70,7 +70,6 @@ examples:
         #size-cells = <0>;
 
         pmic@3e3 {
-            compatible = "...";
             reg = <0x3e3>;
 
             /* ... */
index 69cfa4a3d562833aaaa7f0b11154c148dbb7c3ac..c604822cda073a3d97dc2a4625136aab9b2b40df 100644 (file)
@@ -40,7 +40,7 @@ additionalProperties: false
 
 examples:
   - |
-    osc24M: clk@01c20050 {
+    osc24M: clk@1c20050 {
         #clock-cells = <0>;
         compatible = "allwinner,sun4i-a10-osc-clk";
         reg = <0x01c20050 0x4>;
index 07f38def7dc3b3ebc43a4f9929507c8cee9e1b76..43963c3062c81a650de3c4f553724a9b1eb0dacb 100644 (file)
@@ -41,7 +41,7 @@ additionalProperties: false
 
 examples:
   - |
-    clk@0600005c {
+    clk@600005c {
         #clock-cells = <0>;
         compatible = "allwinner,sun9i-a80-gt-clk";
         reg = <0x0600005c 0x4>;
index 17f87178f6b8e91f7c21c0c97b41c673f70a2be5..3647007f82cad9c0dcf6f3511c815894061956af 100644 (file)
@@ -42,7 +42,7 @@ properties:
       be part of GCC and hence the TSENS properties can also be part
       of the GCC/clock-controller node.
       For more details on the TSENS properties please refer
-      Documentation/devicetree/bindings/thermal/qcom-tsens.txt
+      Documentation/devicetree/bindings/thermal/qcom-tsens.yaml
 
   nvmem-cell-names:
     minItems: 1
index 5d5d396651190b72ede21c5d5acd9a40605f2940..6009324be967ef517a64b99c0efed92d7862f932 100644 (file)
@@ -49,11 +49,7 @@ examples:
         resets = <&tcon_ch0_clk 0>;
 
         port {
-            #address-cells = <1>;
-            #size-cells = <0>;
-
-            tve0_in_tcon0: endpoint@0 {
-                reg = <0>;
+            tve0_in_tcon0: endpoint {
                 remote-endpoint = <&tcon0_out_tve0>;
             };
         };
index 6d72b3d11fbc4e9a31a9329cded32adea96285ff..c211038699233b943ad3e10e93215ef30be40434 100644 (file)
@@ -79,21 +79,15 @@ examples:
           #size-cells = <0>;
 
           anx6345_in: port@0 {
-            #address-cells = <1>;
-            #size-cells = <0>;
             reg = <0>;
-            anx6345_in_tcon0: endpoint@0 {
-              reg = <0>;
+            anx6345_in_tcon0: endpoint {
               remote-endpoint = <&tcon0_out_anx6345>;
             };
           };
 
           anx6345_out: port@1 {
-            #address-cells = <1>;
-            #size-cells = <0>;
             reg = <1>;
-            anx6345_out_panel: endpoint@0 {
-              reg = <0>;
+            anx6345_out_panel: endpoint {
               remote-endpoint = <&panel_in_edp>;
             };
           };
index 4ebcea7d0c6399335bee21b23217b30436709d8e..a614644c9849dfa96836caa6850f14618126f12e 100644 (file)
@@ -37,6 +37,8 @@ examples:
     dsi@ff450000 {
         #address-cells = <1>;
         #size-cells = <0>;
+        reg = <0xff450000 0x1000>;
+
         panel@0 {
             compatible = "leadtek,ltk500hd1829";
             reg = <0>;
index 186e5e1c8fa3b7c836eb35adb4c797413adada48..22c91beb054103d197f4c16e487b264ca5f7ddd5 100644 (file)
@@ -37,6 +37,8 @@ examples:
     dsi@ff450000 {
         #address-cells = <1>;
         #size-cells = <0>;
+        reg = <0xff450000 0x1000>;
+
         panel@0 {
             compatible = "xinpeng,xpp055c272";
             reg = <0>;
index 678776b6012a2b3effde9aa4b952fae5ea6b2027..1db608c9eef59a0ad754554aea36d692fbe15fed 100644 (file)
@@ -174,10 +174,6 @@ examples:
       };
     };
 
-    soc@1c00000 {
-      lcdc0: lcdc@1c0c000 {
-        compatible = "allwinner,sun4i-a10-lcdc";
-      };
-    };
+    lcdc0: lcdc { };
 
 ...
index 7bf1bb444812adc0a417e7d57e8be0ddbddc28d2..aac617acb64f5ff391be254d078d1b8bbe3aa895 100644 (file)
@@ -37,7 +37,7 @@ Optional nodes:
    supports a single port with a single endpoint.
 
  - See also Documentation/devicetree/bindings/display/tilcdc/panel.txt and
-   Documentation/devicetree/bindings/display/tilcdc/tfp410.txt for connecting
+   Documentation/devicetree/bindings/display/bridge/ti,tfp410.txt for connecting
    tfp410 DVI encoder or lcd panel to lcdc
 
 [1] There is an errata about AM335x color wiring. For 16-bit color mode
index 8b5c346f23f6c7da10bab6bd3978475bc221efc0..34780d7535b8a915a972febb669ec95170886e51 100644 (file)
@@ -143,7 +143,7 @@ examples:
             #size-cells = <2>;
             dma-coherent;
             dma-ranges;
-            ranges;
+            ranges = <0x0 0x30800000 0x0 0x30800000 0x0 0x05000000>;
 
             ti,sci-dev-id = <118>;
 
@@ -169,16 +169,4 @@ examples:
                 ti,sci-rm-range-rflow = <0x6>; /* GP RFLOW */
             };
         };
-
-        mcasp0: mcasp@02B00000 {
-            dmas = <&main_udmap 0xc400>, <&main_udmap 0x4400>;
-            dma-names = "tx", "rx";
-        };
-
-        crypto: crypto@4E00000 {
-            compatible = "ti,sa2ul-crypto";
-
-            dmas = <&main_udmap 0xc000>, <&main_udmap 0x4000>, <&main_udmap 0x4001>;
-            dma-names = "tx", "rx1", "rx2";
-        };
     };
index 4ea6a8789699709d898496353d5de4963507a1f7..e8b99adcb1bd2926c4ffe44faa2c6d6b1bd409d7 100644 (file)
@@ -84,31 +84,31 @@ examples:
     gpu_opp_table: opp_table0 {
       compatible = "operating-points-v2";
 
-      opp@533000000 {
+      opp-533000000 {
         opp-hz = /bits/ 64 <533000000>;
         opp-microvolt = <1250000>;
       };
-      opp@450000000 {
+      opp-450000000 {
         opp-hz = /bits/ 64 <450000000>;
         opp-microvolt = <1150000>;
       };
-      opp@400000000 {
+      opp-400000000 {
         opp-hz = /bits/ 64 <400000000>;
         opp-microvolt = <1125000>;
       };
-      opp@350000000 {
+      opp-350000000 {
         opp-hz = /bits/ 64 <350000000>;
         opp-microvolt = <1075000>;
       };
-      opp@266000000 {
+      opp-266000000 {
         opp-hz = /bits/ 64 <266000000>;
         opp-microvolt = <1025000>;
       };
-      opp@160000000 {
+      opp-160000000 {
         opp-hz = /bits/ 64 <160000000>;
         opp-microvolt = <925000>;
       };
-      opp@100000000 {
+      opp-100000000 {
         opp-hz = /bits/ 64 <100000000>;
         opp-microvolt = <912500>;
       };
index 36f59b3ade71dd6737e440e606ca08450de30eab..8d966f3ff3dbd6fdcb8ae446495e93172ffd1f80 100644 (file)
@@ -138,31 +138,31 @@ examples:
     gpu_opp_table: opp_table0 {
       compatible = "operating-points-v2";
 
-      opp@533000000 {
+      opp-533000000 {
         opp-hz = /bits/ 64 <533000000>;
         opp-microvolt = <1250000>;
       };
-      opp@450000000 {
+      opp-450000000 {
         opp-hz = /bits/ 64 <450000000>;
         opp-microvolt = <1150000>;
       };
-      opp@400000000 {
+      opp-400000000 {
         opp-hz = /bits/ 64 <400000000>;
         opp-microvolt = <1125000>;
       };
-      opp@350000000 {
+      opp-350000000 {
         opp-hz = /bits/ 64 <350000000>;
         opp-microvolt = <1075000>;
       };
-      opp@266000000 {
+      opp-266000000 {
         opp-hz = /bits/ 64 <266000000>;
         opp-microvolt = <1025000>;
       };
-      opp@160000000 {
+      opp-160000000 {
         opp-hz = /bits/ 64 <160000000>;
         opp-microvolt = <925000>;
       };
-      opp@100000000 {
+      opp-100000000 {
         opp-hz = /bits/ 64 <100000000>;
         opp-microvolt = <912500>;
       };
index f46de17c08788d185fa7f1dd1aba148178f99a14..cc3c8ea6a894807992ed47eeb1d52ecaca077c7c 100644 (file)
@@ -123,7 +123,7 @@ examples:
         samsung,syscon-phandle = <&pmu_system_controller>;
 
         /* NTC thermistor is a hwmon device */
-        ncp15wb473@0 {
+        ncp15wb473 {
             compatible = "murata,ncp15wb473";
             pullup-uv = <1800000>;
             pullup-ohm = <47000>;
index d7c3262b249450932fd1e25649e2299561450ae7..c99ed3934d7ee34aac7e416552db0c4bb29849ee 100644 (file)
@@ -62,7 +62,7 @@ required:
 
 examples:
 - |
-    i2c@00000000 {
+    i2c {
       #address-cells = <1>;
       #size-cells = <0>;
       gt928@5d {
index c864a46cddcf65ea573a0e7575ff30c7405b9476..f5021214edecb9b5bab54887e1e98cc6bd3ef090 100644 (file)
@@ -1,7 +1,7 @@
 Texas Instruments TWL family (twl4030) pwrbutton module
 
 This module is part of the TWL4030. For more details about the whole
-chip see Documentation/devicetree/bindings/mfd/twl-familly.txt.
+chip see Documentation/devicetree/bindings/mfd/twl-family.txt.
 
 This module provides a simple power button event via an Interrupt.
 
index d97d099b87e5b96ff9d3cabc3f962bf94f432e63..c60b994fe116d8bf8f369ea2aaeb50ec28afdb2b 100644 (file)
@@ -85,7 +85,7 @@ properties:
         # LED will act as a back-light, controlled by the framebuffer system
       - backlight
         # LED will turn on (but for leds-gpio see "default-state" property in
-        # Documentation/devicetree/bindings/leds/leds-gpio.txt)
+        # Documentation/devicetree/bindings/leds/leds-gpio.yaml)
       - default-on
         # LED "double" flashes at a load average based rate
       - heartbeat
index cf1ea403ba7aa22f14542c8ceb295475b9f2a574..c7af6f70a97bf50acd57dcb332506b8486322dc9 100644 (file)
@@ -5,7 +5,7 @@ where single bits in a certain register can turn on/off a
 single LED. The register bit LEDs appear as children to the
 syscon device, with the proper compatible string. For the
 syscon bindings see:
-Documentation/devicetree/bindings/mfd/syscon.txt
+Documentation/devicetree/bindings/mfd/syscon.yaml
 
 Each LED is represented as a sub-node of the syscon device. Each
 node's name represents the name of the corresponding LED.
index 1ea78417953649fad0700fc3b429f4e15f840309..5e066629287d4de310094b60d3104ee65e99f48a 100644 (file)
@@ -177,7 +177,7 @@ examples:
         };
     };
 
-    i2c5: i2c@4807c000 {
+    i2c {
         clock-frequency = <400000>;
         #address-cells = <1>;
         #size-cells = <0>;
index 44d71469c9148001df7ed926d54096f09c109e9f..63f674ffeb4f432699f2a5c60c9dbbacf5c166ab 100644 (file)
@@ -32,7 +32,7 @@ Required only for "ti,emif-am3352" and "ti,emif-am4372":
 - sram                 : Phandles for generic sram driver nodes,
   first should be type 'protect-exec' for the driver to use to copy
   and run PM functions, second should be regular pool to be used for
-  data region for code. See Documentation/devicetree/bindings/sram/sram.txt
+  data region for code. See Documentation/devicetree/bindings/sram/sram.yaml
   for more details.
 
 Optional properties:
index 4a70f875a6eb9ff6163d1cbcc9ba7898eed0891d..4803857893942a420baaf525ed2e687a2dacc6ca 100644 (file)
@@ -97,14 +97,14 @@ examples:
             regulators {
                 compatible = "maxim,max77650-regulator";
 
-                max77650_ldo: regulator@0 {
+                max77650_ldo: regulator-ldo {
                     regulator-compatible = "ldo";
                     regulator-name = "max77650-ldo";
                     regulator-min-microvolt = <1350000>;
                     regulator-max-microvolt = <2937500>;
                 };
 
-                max77650_sbb0: regulator@1 {
+                max77650_sbb0: regulator-sbb0 {
                     regulator-compatible = "sbb0";
                     regulator-name = "max77650-sbb0";
                     regulator-min-microvolt = <800000>;
index 4f62143afd240d7bd63010639f5635e6633cadc4..a5ced46bbde97e1d59080924fd0bc1aa43f102d7 100644 (file)
@@ -26,8 +26,8 @@ Required properties:
             ldo6, ldo7, ldo8
 
 - xxx-supply: Input voltage supply regulator.
-  These entries are require if regulators are enabled for a device. Missing of these
-  properties can cause the regulator registration fails.
+  These entries are required if regulators are enabled for a device. Missing these
+  properties can cause the regulator registration to fail.
   If some of input supply is powered through battery or always-on supply then
   also it is require to have these parameters with proper node handle of always
   on power supply.
index 088eff9ddb786cdbdf0a26ea3d9fed27f048b021..e0f901edc063563c28a26e70c3de1f3aebcd3847 100644 (file)
@@ -20,7 +20,7 @@ RAVE SP consists of the following sub-devices:
 Device                          Description
 ------                          -----------
 rave-sp-wdt                    : Watchdog
-rave-sp-nvmem                  : Interface to onborad EEPROM
+rave-sp-nvmem                  : Interface to onboard EEPROM
 rave-sp-backlight              : Display backlight
 rave-sp-hwmon                  : Interface to onboard hardware sensors
 rave-sp-leds                   : Interface to onboard LEDs
index bb7e896cb644eb97831f234e19d19b6a82b6310e..9134e9bcca56690076f6d7eba1445cee486618ec 100644 (file)
@@ -26,7 +26,7 @@ For generic IOMMU bindings, see
 Documentation/devicetree/bindings/iommu/iommu.txt.
 
 For arm-smmu binding, see:
-Documentation/devicetree/bindings/iommu/arm,smmu.txt.
+Documentation/devicetree/bindings/iommu/arm,smmu.yaml.
 
 Required properties:
 
index 3c0df4016a127c393e1dda89676ab942b53aff54..8fded83c519adc57f7de2da1a48ec4be043a265f 100644 (file)
@@ -370,6 +370,7 @@ examples:
     mmc3: mmc@1c12000 {
         #address-cells = <1>;
         #size-cells = <0>;
+        reg = <0x1c12000 0x200>;
         pinctrl-names = "default";
         pinctrl-0 = <&mmc3_pins_a>;
         vmmc-supply = <&reg_vmmc3>;
index f3893c4d3c6a96952deb602897c750c452e29ebd..d2eada5044b2410fe36bf231b8abfdebb56f13e2 100644 (file)
@@ -27,7 +27,7 @@ Required properties of NAND chips:
   - reg: shall contain the native Chip Select ids from 0 to max supported by
     the cadence nand flash controller
 
-See Documentation/devicetree/bindings/mtd/nand.txt for more details on
+See Documentation/devicetree/bindings/mtd/nand-controller.yaml for more details on
 generic bindings.
 
 Example:
index 48a7f916c5e4e21e9c1b154b7cc7697ad0e5b608..88b57b0ca1f49ecea05a528d6be881e700c0cd2c 100644 (file)
@@ -45,7 +45,7 @@ Optional properties:
   switch queue
 
 - resets: a single phandle and reset identifier pair. See
-  Documentation/devicetree/binding/reset/reset.txt for details.
+  Documentation/devicetree/bindings/reset/reset.txt for details.
 
 - reset-names: If the "reset" property is specified, this property should have
   the value "switch" to denote the switch reset line.
index b43c6c65294edd6f51c336b2555d2d938bb80160..65980224d550e773db3baa8cb960ddb4325f11f7 100644 (file)
@@ -76,6 +76,8 @@ examples:
       qfprom: eeprom@700000 {
           #address-cells = <1>;
           #size-cells = <1>;
+          reg = <0x00700000 0x100000>;
+
           wp-gpios = <&gpio1 3 GPIO_ACTIVE_HIGH>;
 
           /* ... */
index 020ef9e4c41194e0a7d83cc4fc4bb0f546c12643..94ac23687b7eba99d846fdadc57acdd6c57cac6d 100644 (file)
@@ -86,7 +86,7 @@ examples:
     #include <dt-bindings/clock/sun4i-a10-ccu.h>
     #include <dt-bindings/reset/sun4i-a10-ccu.h>
 
-    usbphy: phy@01c13400 {
+    usbphy: phy@1c13400 {
         #phy-cells = <1>;
         compatible = "allwinner,sun4i-a10-usb-phy";
         reg = <0x01c13400 0x10>, <0x01c14800 0x4>, <0x01c1c800 0x4>;
index bb690e20c36800d16a722ba633c5e08d404ac543..135c7dfbc1800f378ad564e3f7e0d7c9744fe86e 100644 (file)
@@ -17,7 +17,7 @@ description: |+
                     "aspeed,ast2400-scu", "syscon", "simple-mfd"
 
   Refer to the the bindings described in
-  Documentation/devicetree/bindings/mfd/syscon.txt
+  Documentation/devicetree/bindings/mfd/syscon.yaml
 
 properties:
   compatible:
index f7f5d57f2c9adc70d99056779f9070e8f7b2058b..824f7fd1d51bf735bd496c4736dde06617f38b34 100644 (file)
@@ -18,7 +18,7 @@ description: |+
                        "aspeed,g5-scu", "syscon", "simple-mfd"
 
   Refer to the the bindings described in
-  Documentation/devicetree/bindings/mfd/syscon.txt
+  Documentation/devicetree/bindings/mfd/syscon.yaml
 
 properties:
   compatible:
index 3749fa233e87f995dc639e950b1b4dfd01713564..ac8d1c30a8ed75fc8e85b67a934b037c225ba8d6 100644 (file)
@@ -17,7 +17,7 @@ description: |+
                 "aspeed,ast2600-scu", "syscon", "simple-mfd"
 
   Refer to the the bindings described in
-  Documentation/devicetree/bindings/mfd/syscon.txt
+  Documentation/devicetree/bindings/mfd/syscon.yaml
 
 properties:
   compatible:
index 754ea7ab040ab03f506ad96659031b552b925a4f..ef4de32cb17cca1ec9214a109a0cb9223ba67e06 100644 (file)
@@ -248,7 +248,7 @@ examples:
       };
 
     //Example 3 pin groups
-      pinctrl@60020000 {
+      pinctrl {
         usart1_pins_a: usart1-0 {
                 pins1 {
                         pinmux = <STM32_PINMUX('A', 9, AF7)>;
index aab70e8b681e489bb5213747b607bc77ef3a30a6..d3098c924b25e308d1eeb7341dbaaf16340b4ae9 100644 (file)
@@ -18,7 +18,7 @@ description: |+
                 "amlogic,meson-gx-hhi-sysctrl", "simple-mfd", "syscon"
 
   Refer to the the bindings described in
-  Documentation/devicetree/bindings/mfd/syscon.txt
+  Documentation/devicetree/bindings/mfd/syscon.yaml
 
 properties:
   compatible:
diff --git a/Documentation/devicetree/bindings/power/domain-idle-state.txt b/Documentation/devicetree/bindings/power/domain-idle-state.txt
deleted file mode 100644 (file)
index eefc7ed..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-PM Domain Idle State Node:
-
-A domain idle state node represents the state parameters that will be used to
-select the state when there are no active components in the domain.
-
-The state node has the following parameters -
-
-- compatible:
-       Usage: Required
-       Value type: <string>
-       Definition: Must be "domain-idle-state".
-
-- entry-latency-us
-       Usage: Required
-       Value type: <prop-encoded-array>
-       Definition: u32 value representing worst case latency in
-                   microseconds required to enter the idle state.
-                   The exit-latency-us duration may be guaranteed
-                   only after entry-latency-us has passed.
-
-- exit-latency-us
-       Usage: Required
-       Value type: <prop-encoded-array>
-       Definition: u32 value representing worst case latency
-                   in microseconds required to exit the idle state.
-
-- min-residency-us
-       Usage: Required
-       Value type: <prop-encoded-array>
-       Definition: u32 value representing minimum residency duration
-                   in microseconds after which the idle state will yield
-                   power benefits after overcoming the overhead in entering
-i                  the idle state.
diff --git a/Documentation/devicetree/bindings/power/domain-idle-state.yaml b/Documentation/devicetree/bindings/power/domain-idle-state.yaml
new file mode 100644 (file)
index 0000000..dfba1af
--- /dev/null
@@ -0,0 +1,64 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/power/domain-idle-state.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: PM Domain Idle States binding description
+
+maintainers:
+  - Ulf Hansson <ulf.hansson@linaro.org>
+
+description:
+  A domain idle state node represents the state parameters that will be used to
+  select the state when there are no active components in the PM domain.
+
+properties:
+  $nodename:
+    const: domain-idle-states
+
+patternProperties:
+  "^(cpu|cluster|domain)-":
+    type: object
+    description:
+      Each state node represents a domain idle state description.
+
+    properties:
+      compatible:
+        const: domain-idle-state
+
+      entry-latency-us:
+        description:
+          The worst case latency in microseconds required to enter the idle
+          state. Note that, the exit-latency-us duration may be guaranteed only
+          after the entry-latency-us has passed.
+
+      exit-latency-us:
+        description:
+          The worst case latency in microseconds required to exit the idle
+          state.
+
+      min-residency-us:
+        description:
+          The minimum residency duration in microseconds after which the idle
+          state will yield power benefits, after overcoming the overhead while
+          entering the idle state.
+
+    required:
+      - compatible
+      - entry-latency-us
+      - exit-latency-us
+      - min-residency-us
+
+examples:
+  - |
+
+    domain-idle-states {
+      domain_retention: domain-retention {
+        compatible = "domain-idle-state";
+        entry-latency-us = <20>;
+        exit-latency-us = <40>;
+        min-residency-us = <80>;
+      };
+    };
+...
index 455b573293aed46fadd0a3499eccdc9271e35630..6047aacd77667b16e1bba2a68f5d0ceb1236de08 100644 (file)
@@ -25,22 +25,20 @@ description: |+
 
 properties:
   $nodename:
-    pattern: "^(power-controller|power-domain)(@.*)?$"
+    pattern: "^(power-controller|power-domain)([@-].*)?$"
 
   domain-idle-states:
     $ref: /schemas/types.yaml#/definitions/phandle-array
-    description:
-      A phandle of an idle-state that shall be soaked into a generic domain
-      power state. The idle state definitions are compatible with
-      domain-idle-state specified in
-      Documentation/devicetree/bindings/power/domain-idle-state.txt
-      phandles that are not compatible with domain-idle-state will be ignored.
-      The domain-idle-state property reflects the idle state of this PM domain
-      and not the idle states of the devices or sub-domains in the PM domain.
-      Devices and sub-domains have their own idle-states independent
-      of the parent domain's idle states. In the absence of this property,
-      the domain would be considered as capable of being powered-on
-      or powered-off.
+    description: |
+      Phandles of idle states that defines the available states for the
+      power-domain provider. The idle state definitions are compatible with the
+      domain-idle-state bindings, specified in ./domain-idle-state.yaml.
+
+      Note that, the domain-idle-state property reflects the idle states of this
+      PM domain and not the idle states of the devices or sub-domains in the PM
+      domain. Devices and sub-domains have their own idle states independent of
+      the parent domain's idle states. In the absence of this property, the
+      domain would be considered as capable of being powered-on or powered-off.
 
   operating-points-v2:
     $ref: /schemas/types.yaml#/definitions/phandle-array
index 5b09b2deb4833069273823d4f0e4ccec81f2b72e..08497ef26c7aabf49787ee36f434ef46bf00e6cd 100644 (file)
@@ -109,4 +109,4 @@ Example:
                required-opps = <&domain1_opp_1>;
        };
 
-[1]. Documentation/devicetree/bindings/power/domain-idle-state.txt
+[1]. Documentation/devicetree/bindings/power/domain-idle-state.yaml
index f5cdac8b284710055ef5ccf57ffec590e18baa8f..8b005192f6e89b9ba8847ffcf72a3851bf630444 100644 (file)
@@ -161,7 +161,7 @@ The regulator node houses sub-nodes for each regulator within the device. Each
 sub-node is identified using the node's name, with valid values listed for each
 of the PMICs below.
 
-pm8005:
+pm8004:
        s2, s5
 
 pm8005:
index 92ff2e8ad572ba47517e6d38a2656aa4a7e50000..91a39a33000b17fa0a15d1484c5e21b1932d279a 100644 (file)
@@ -191,7 +191,7 @@ patternProperties:
 
 examples:
   - |
-    xyzreg: regulator@0 {
+    xyzreg: regulator {
       regulator-min-microvolt = <1000000>;
       regulator-max-microvolt = <2500000>;
       regulator-always-on;
index 246dea8a2ec95874f7d05c98806d2ccdc3c47e48..8ac4372826591e8a9d03664b839824b117382411 100644 (file)
@@ -23,7 +23,11 @@ properties:
     description: Global reset register offset and bit offset.
     allOf:
       - $ref: /schemas/types.yaml#/definitions/uint32-array
-      - maxItems: 2
+    items:
+      - description: Register offset
+      - description: Register bit offset
+        minimum: 0
+        maximum: 31
 
   "#reset-cells":
     minimum: 2
index b4edaf7c7ff3d77f11ecd4bb8645ab735a5bab6a..2880d5dda95e8326c561fb6347b3336d5d10c4b5 100644 (file)
@@ -3,4 +3,4 @@ STMicroelectronics STM32MP1 Peripheral Reset Controller
 
 The RCC IP is both a reset and a clock controller.
 
-Please see Documentation/devicetree/bindings/clock/st,stm32mp1-rcc.txt
+Please see Documentation/devicetree/bindings/clock/st,stm32mp1-rcc.yaml
index 944743dd9212550135242a6ad374edf0fbcff501..c42b91e525fa2d9105921fd0f93aa663ace9d39f 100644 (file)
@@ -36,7 +36,7 @@ SAI subnodes required properties:
   - clock-names: Must contain "sai_ck".
        Must also contain "MCLK", if SAI shares a master clock,
        with a SAI set as MCLK clock provider.
-  - dmas: see Documentation/devicetree/bindings/dma/stm32-dma.txt
+  - dmas: see Documentation/devicetree/bindings/dma/st,stm32-dma.yaml
   - dma-names: identifier string for each DMA request line
        "tx": if sai sub-block is configured as playback DAI
        "rx": if sai sub-block is configured as capture DAI
index 33826f2459fa80215753f918f732056b0fecf322..ca9101777c44b19a6d85e075e93691ab6e06b7ce 100644 (file)
@@ -10,7 +10,7 @@ Required properties:
   - clock-names: must contain "kclk"
   - interrupts: cpu DAI interrupt line
   - dmas: DMA specifiers for audio data DMA and iec control flow DMA
-    See STM32 DMA bindings, Documentation/devicetree/bindings/dma/stm32-dma.txt
+    See STM32 DMA bindings, Documentation/devicetree/bindings/dma/st,stm32-dma.yaml
   - dma-names: two dmas have to be defined, "rx" and "rx-ctrl"
 
 Optional properties:
index f0d979664f0763429d0feefe1ccbb7f84ff6bbb5..e49ecbf715ba0814948e240d92e5892bd9a891ad 100644 (file)
@@ -49,7 +49,7 @@ properties:
   dmas:
     description: |
       DMA specifiers for tx and rx dma. DMA fifo mode must be used. See
-      the STM32 DMA bindings Documentation/devicetree/bindings/dma/stm32-dma.txt.
+      the STM32 DMA bindings Documentation/devicetree/bindings/dma/st,stm32-dma.yaml.
     items:
       - description: rx DMA channel
       - description: tx DMA channel
index 80bac7a182d571c8d0d448a1a0dda1ea51571955..4b550943658879c66d3f087e5f3b41137d8683a9 100644 (file)
@@ -125,7 +125,7 @@ examples:
       #size-cells = <1>;
       ranges;
 
-      sram_a: sram@00000000 {
+      sram_a: sram@0 {
         compatible = "mmio-sram";
         reg = <0x00000000 0xc000>;
         #address-cells = <1>;
index d9fdf4809a4971efd0dd550da7cdf2cf5b984ed7..f3e68ed03abf89d290fba1016363959140bf56fd 100644 (file)
@@ -17,7 +17,7 @@ description: |+
                 "brcm,bcm2711-avs-monitor", "syscon", "simple-mfd"
 
   Refer to the the bindings described in
-  Documentation/devicetree/bindings/mfd/syscon.txt
+  Documentation/devicetree/bindings/mfd/syscon.yaml
 
 properties:
   compatible:
index 23e989e0976630382d70ab5ddaeeb3b4c3542b61..d918cee100aced4e31c4a0dddf5ec176ade12460 100644 (file)
@@ -87,7 +87,7 @@ additionalProperties: false
 
 examples:
   - |
-    timer {
+    timer@1c20c00 {
         compatible = "allwinner,sun4i-a10-timer";
         reg = <0x01c20c00 0x400>;
         interrupts = <22>,
index e5953e7e4bf429a20afd44234efa48df8e2c1003..2104830a99aeff529f54df726db45451075ea86c 100644 (file)
@@ -151,8 +151,8 @@ The details of these operations are:
      Note that callbacks will always be invoked from the DMA
      engines tasklet, never from interrupt context.
 
-Optional: per descriptor metadata
----------------------------------
+  **Optional: per descriptor metadata**
+
   DMAengine provides two ways for metadata support.
 
   DESC_METADATA_CLIENT
@@ -199,12 +199,15 @@ Optional: per descriptor metadata
   DESC_METADATA_CLIENT
 
     - DMA_MEM_TO_DEV / DEV_MEM_TO_MEM:
+
       1. prepare the descriptor (dmaengine_prep_*)
          construct the metadata in the client's buffer
       2. use dmaengine_desc_attach_metadata() to attach the buffer to the
          descriptor
       3. submit the transfer
+
     - DMA_DEV_TO_MEM:
+
       1. prepare the descriptor (dmaengine_prep_*)
       2. use dmaengine_desc_attach_metadata() to attach the buffer to the
          descriptor
@@ -215,6 +218,7 @@ Optional: per descriptor metadata
   DESC_METADATA_ENGINE
 
     - DMA_MEM_TO_DEV / DEV_MEM_TO_MEM:
+
       1. prepare the descriptor (dmaengine_prep_*)
       2. use dmaengine_desc_get_metadata_ptr() to get the pointer to the
          engine's metadata area
@@ -222,7 +226,9 @@ Optional: per descriptor metadata
       4. use dmaengine_desc_set_metadata_len()  to tell the DMA engine the
          amount of data the client has placed into the metadata buffer
       5. submit the transfer
+
     - DMA_DEV_TO_MEM:
+
       1. prepare the descriptor (dmaengine_prep_*)
       2. submit the transfer
       3. on transfer completion, use dmaengine_desc_get_metadata_ptr() to get
@@ -278,8 +284,8 @@ Optional: per descriptor metadata
 
       void dma_async_issue_pending(struct dma_chan *chan);
 
-Further APIs:
--------------
+Further APIs
+------------
 
 1. Terminate APIs
 
index dc497b96fa4ff54dc6b84cbf2951391a369473c0..55336a47a110c679dbcb26ec70f95e6be74a7d56 100644 (file)
@@ -164,9 +164,9 @@ file.
        void __iomem *base;
     };
 
-    struct dentry *debugfs_create_regset32(const char *name, umode_t mode,
-                                    struct dentry *parent,
-                                    struct debugfs_regset32 *regset);
+    debugfs_create_regset32(const char *name, umode_t mode,
+                           struct dentry *parent,
+                           struct debugfs_regset32 *regset);
 
     void debugfs_print_regs32(struct seq_file *s, struct debugfs_reg32 *regs,
                         int nregs, void __iomem *base, char *prefix);
index c81e0b4abd2875f53d5ec69e59c3b0098a94b2a3..471be1e98d6f6618989784e9508e2312fb66cb00 100644 (file)
@@ -20,8 +20,7 @@ Usage Notes
 -----------
 
 This driver does not auto-detect devices. You will have to instantiate the
-devices explicitly. Please see Documentation/i2c/instantiating-devices for
-details.
+devices explicitly. Please see :doc:`/i2c/instantiating-devices` for details.
 
 
 Sysfs entries
index 6158a143a13e075c62621ed2cf247de645f4d0d0..a6fbdf354d3437a50109102244c3a39c70ef5a16 100644 (file)
@@ -693,7 +693,7 @@ ALLWINNER CPUFREQ DRIVER
 M:     Yangtao Li <tiny.windzz@gmail.com>
 L:     linux-pm@vger.kernel.org
 S:     Maintained
-F:     Documentation/devicetree/bindings/opp/sun50i-nvmem-cpufreq.txt
+F:     Documentation/devicetree/bindings/opp/allwinner,sun50i-h6-operating-points.yaml
 F:     drivers/cpufreq/sun50i-cpufreq-nvmem.c
 
 ALLWINNER CRYPTO DRIVERS
@@ -4017,7 +4017,7 @@ M:        Cheng-Yi Chiang <cychiang@chromium.org>
 S:     Maintained
 R:     Enric Balletbo i Serra <enric.balletbo@collabora.com>
 R:     Guenter Roeck <groeck@chromium.org>
-F:     Documentation/devicetree/bindings/sound/google,cros-ec-codec.txt
+F:     Documentation/devicetree/bindings/sound/google,cros-ec-codec.yaml
 F:     sound/soc/codecs/cros_ec_codec.*
 
 CIRRUS LOGIC AUDIO CODEC DRIVERS
@@ -4475,7 +4475,7 @@ L:        linux-media@vger.kernel.org
 T:     git git://linuxtv.org/media_tree.git
 S:     Maintained
 F:     drivers/media/platform/sunxi/sun6i-csi/
-F:     Documentation/devicetree/bindings/media/sun6i-csi.txt
+F:     Documentation/devicetree/bindings/media/allwinner,sun6i-a31-csi.yaml
 
 CW1200 WLAN driver
 M:     Solomon Peachy <pizza@shaftnet.org>
@@ -5668,7 +5668,7 @@ L:        dri-devel@lists.freedesktop.org
 T:     git git://anongit.freedesktop.org/drm/drm-misc
 S:     Maintained
 F:     drivers/gpu/drm/stm
-F:     Documentation/devicetree/bindings/display/st,stm32-ltdc.txt
+F:     Documentation/devicetree/bindings/display/st,stm32-ltdc.yaml
 
 DRM DRIVERS FOR TI LCDC
 M:     Jyri Sarha <jsarha@ti.com>
@@ -7738,7 +7738,7 @@ Hyper-V CORE AND DRIVERS
 M:     "K. Y. Srinivasan" <kys@microsoft.com>
 M:     Haiyang Zhang <haiyangz@microsoft.com>
 M:     Stephen Hemminger <sthemmin@microsoft.com>
-M:     Sasha Levin <sashal@kernel.org>
+M:     Wei Liu <wei.liu@kernel.org>
 T:     git git://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux.git
 L:     linux-hyperv@vger.kernel.org
 S:     Supported
@@ -10164,7 +10164,7 @@ MAXBOTIX ULTRASONIC RANGER IIO DRIVER
 M:     Andreas Klinger <ak@it-klinger.de>
 L:     linux-iio@vger.kernel.org
 S:     Maintained
-F:     Documentation/devicetree/bindings/iio/proximity/maxbotix,mb1232.txt
+F:     Documentation/devicetree/bindings/iio/proximity/maxbotix,mb1232.yaml
 F:     drivers/iio/proximity/mb1232.c
 
 MAXIM MAX77650 PMIC MFD DRIVER
@@ -10467,7 +10467,7 @@ M:      Hugues Fruchet <hugues.fruchet@st.com>
 L:     linux-media@vger.kernel.org
 T:     git git://linuxtv.org/media_tree.git
 S:     Supported
-F:     Documentation/devicetree/bindings/media/st,stm32-dcmi.txt
+F:     Documentation/devicetree/bindings/media/st,stm32-dcmi.yaml
 F:     drivers/media/platform/stm32/stm32-dcmi.c
 
 MEDIA DRIVERS FOR NVIDIA TEGRA - VDE
@@ -12952,7 +12952,6 @@ M:      Robert Richter <rrichter@marvell.com>
 L:     linux-pci@vger.kernel.org
 L:     linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
 S:     Supported
-F:     Documentation/devicetree/bindings/pci/pci-thunder-*
 F:     drivers/pci/controller/pci-thunder-*
 
 PCIE DRIVER FOR HISILICON
@@ -14227,7 +14226,7 @@ F:      include/dt-bindings/reset/
 F:     include/linux/reset.h
 F:     include/linux/reset/
 F:     include/linux/reset-controller.h
-K:      \b(?:devm_|of_)?reset_control(?:ler_[a-z]+|_[a-z_]+)?\b
+K:     \b(?:devm_|of_)?reset_control(?:ler_[a-z]+|_[a-z_]+)?\b
 
 RESTARTABLE SEQUENCES SUPPORT
 M:     Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
@@ -15922,7 +15921,7 @@ F:      drivers/*/stm32-*timer*
 F:     drivers/pwm/pwm-stm32*
 F:     include/linux/*/stm32-*tim*
 F:     Documentation/ABI/testing/*timer-stm32
-F:     Documentation/devicetree/bindings/*/stm32-*timer*
+F:     Documentation/devicetree/bindings/*/*stm32-*timer*
 F:     Documentation/devicetree/bindings/pwm/pwm-stm32*
 
 STMMAC ETHERNET DRIVER
@@ -16081,6 +16080,8 @@ SYNOPSYS DESIGNWARE 8250 UART DRIVER
 R:     Andy Shevchenko <andriy.shevchenko@linux.intel.com>
 S:     Maintained
 F:     drivers/tty/serial/8250/8250_dw.c
+F:     drivers/tty/serial/8250/8250_dwlib.*
+F:     drivers/tty/serial/8250/8250_lpss.c
 
 SYNOPSYS DESIGNWARE APB GPIO DRIVER
 M:     Hoan Tran <hoan@os.amperecomputing.com>
index 86035d866f2c0e73cf326980f0d9295173a73581..e25db579ce7438ab608d4473dc57dfc110ecaeee 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,7 @@
 VERSION = 5
 PATCHLEVEL = 6
 SUBLEVEL = 0
-EXTRAVERSION = -rc4
+EXTRAVERSION = -rc5
 NAME = Kleptomaniac Octopus
 
 # *DOCUMENTATION*
index 98de654b79b312eca4737efff9b6b1460cb94f37..17fe351cdde08ab849b3b7f7763c4cdb307c61d2 100644 (file)
@@ -738,8 +738,9 @@ config HAVE_STACK_VALIDATION
 config HAVE_RELIABLE_STACKTRACE
        bool
        help
-         Architecture has a save_stack_trace_tsk_reliable() function which
-         only returns a stack trace if it can guarantee the trace is reliable.
+         Architecture has either save_stack_trace_tsk_reliable() or
+         arch_stack_walk_reliable() function which only returns a stack trace
+         if it can guarantee the trace is reliable.
 
 config HAVE_ARCH_HASH
        bool
index f3ced6df0c9b272461f394b090905dd7ee4af6da..9f66f96d09c91661a0917e4abcdf701086059ba4 100644 (file)
@@ -526,11 +526,11 @@ &cpu0_opp_table {
         * Supply voltage supervisor on board will not allow opp50 so
         * disable it and set opp100 as suspend OPP.
         */
-       opp50@300000000 {
+       opp50-300000000 {
                status = "disabled";
        };
 
-       opp100@600000000 {
+       opp100-600000000 {
                opp-suspend;
        };
 };
index 1b5a835f66bd3de475e8229cc2302576f3c57b45..efea891b1a76ea0a32fd74950bd1fa179a73acfe 100644 (file)
@@ -21,6 +21,7 @@ memory@0 {
 
        aliases {
                ethernet0 = &genet;
+               pcie0 = &pcie0;
        };
 
        leds {
@@ -31,6 +32,8 @@ act {
                pwr {
                        label = "PWR";
                        gpios = <&expgpio 2 GPIO_ACTIVE_LOW>;
+                       default-state = "keep";
+                       linux,default-trigger = "default-on";
                };
        };
 
index 66ab35eccba7bbc0f753ac99ce0763a8b1f5af9c..28be0332c1c810e6fe727802ce7af4458f70029f 100644 (file)
@@ -26,6 +26,8 @@ act {
                pwr {
                        label = "PWR";
                        gpios = <&expgpio 2 GPIO_ACTIVE_LOW>;
+                       default-state = "keep";
+                       linux,default-trigger = "default-on";
                };
        };
 };
index 74ed6d04780703d8c3197c39716baecad5cafcb5..37343148643dbfafb9d89d7eb091b401fafb4aa0 100644 (file)
@@ -27,6 +27,8 @@ act {
                pwr {
                        label = "PWR";
                        gpios = <&expgpio 2 GPIO_ACTIVE_LOW>;
+                       default-state = "keep";
+                       linux,default-trigger = "default-on";
                };
        };
 
index de7f85efaa5120a765abf05eb34780b8000994d2..af06a55d1c5c6374eae5f41c874c2b40872b75ef 100644 (file)
@@ -61,10 +61,10 @@ aic_dvdd: fixedregulator-aic_dvdd {
                regulator-max-microvolt = <1800000>;
        };
 
-       evm_3v3: fixedregulator-evm3v3 {
+       vsys_3v3: fixedregulator-vsys3v3 {
                /* Output of Cntlr A of TPS43351-Q1 on dra7-evm */
                compatible = "regulator-fixed";
-               regulator-name = "evm_3v3";
+               regulator-name = "vsys_3v3";
                regulator-min-microvolt = <3300000>;
                regulator-max-microvolt = <3300000>;
                vin-supply = <&evm_12v0>;
index fc418834890d4c9d5d323b8acf6e76d0170e41de..2119a78e9c153605acc99eb83de65940257a76ef 100644 (file)
@@ -3474,6 +3474,7 @@ timer13: timer@0 {
                                clocks = <&l4per3_clkctrl DRA7_L4PER3_TIMER13_CLKCTRL 24>;
                                clock-names = "fck";
                                interrupts = <GIC_SPI 339 IRQ_TYPE_LEVEL_HIGH>;
+                               ti,timer-pwm;
                        };
                };
 
@@ -3501,6 +3502,7 @@ timer14: timer@0 {
                                clocks = <&l4per3_clkctrl DRA7_L4PER3_TIMER14_CLKCTRL 24>;
                                clock-names = "fck";
                                interrupts = <GIC_SPI 340 IRQ_TYPE_LEVEL_HIGH>;
+                               ti,timer-pwm;
                        };
                };
 
@@ -3528,6 +3530,7 @@ timer15: timer@0 {
                                clocks = <&l4per3_clkctrl DRA7_L4PER3_TIMER15_CLKCTRL 24>;
                                clock-names = "fck";
                                interrupts = <GIC_SPI 341 IRQ_TYPE_LEVEL_HIGH>;
+                               ti,timer-pwm;
                        };
                };
 
@@ -3555,6 +3558,7 @@ timer16: timer@0 {
                                clocks = <&l4per3_clkctrl DRA7_L4PER3_TIMER16_CLKCTRL 24>;
                                clock-names = "fck";
                                interrupts = <GIC_SPI 342 IRQ_TYPE_LEVEL_HIGH>;
+                               ti,timer-pwm;
                        };
                };
 
index d78b684e7fca0330d760502d9f45168bb1996b5e..4305051bb76965ed6048bb30e5b91ee74f41c72a 100644 (file)
@@ -184,6 +184,7 @@ pcie1_rc: pcie@51000000 {
                                device_type = "pci";
                                ranges = <0x81000000 0 0          0x03000 0 0x00010000
                                          0x82000000 0 0x20013000 0x13000 0 0xffed000>;
+                               dma-ranges = <0x02000000 0x0 0x00000000 0x00000000 0x1 0x00000000>;
                                bus-range = <0x00 0xff>;
                                #interrupt-cells = <1>;
                                num-lanes = <1>;
@@ -238,6 +239,7 @@ pcie2_rc: pcie@51800000 {
                                device_type = "pci";
                                ranges = <0x81000000 0 0          0x03000 0 0x00010000
                                          0x82000000 0 0x30013000 0x13000 0 0xffed000>;
+                               dma-ranges = <0x02000000 0x0 0x00000000 0x00000000 0x1 0x00000000>;
                                bus-range = <0x00 0xff>;
                                #interrupt-cells = <1>;
                                num-lanes = <1>;
index 2f7539afef2be823a3fb732b31d19b86d12e9e13..42b8a205b64f8abac147f8da63716ce1fb1026a9 100644 (file)
@@ -128,3 +128,8 @@ &rtctarget {
 &usb4_tm {
        status = "disabled";
 };
+
+&mmc3 {
+       /* dra76x is not affected by i887 */
+       max-frequency = <96000000>;
+};
index 55cef4cac5f16f5c858b8c04d7c4c4895d1d6fef..dc0a93bccbf1e2aa5413e2ef6f14ab0b609eb421 100644 (file)
@@ -796,16 +796,6 @@ video2_div_clk: video2_div_clk {
                clock-div = <1>;
        };
 
-       ipu1_gfclk_mux: ipu1_gfclk_mux@520 {
-               #clock-cells = <0>;
-               compatible = "ti,mux-clock";
-               clocks = <&dpll_abe_m2x2_ck>, <&dpll_core_h22x2_ck>;
-               ti,bit-shift = <24>;
-               reg = <0x0520>;
-               assigned-clocks = <&ipu1_gfclk_mux>;
-               assigned-clock-parents = <&dpll_core_h22x2_ck>;
-       };
-
        dummy_ck: dummy_ck {
                #clock-cells = <0>;
                compatible = "fixed-clock";
@@ -1564,6 +1554,8 @@ ipu1_clkctrl: ipu1-clkctrl@20 {
                        compatible = "ti,clkctrl";
                        reg = <0x20 0x4>;
                        #clock-cells = <2>;
+                       assigned-clocks = <&ipu1_clkctrl DRA7_IPU1_MMU_IPU1_CLKCTRL 24>;
+                       assigned-clock-parents = <&dpll_core_h22x2_ck>;
                };
 
                ipu_clkctrl: ipu-clkctrl@50 {
index cd075621de52dfa73b925ed9a35d1f828a9cda8e..84fcc203a2e48179c4ff27395a0a5e15746aaddb 100644 (file)
@@ -275,7 +275,7 @@ &weim {
 
        /* SRAM on Colibri nEXT_CS0 */
        sram@0,0 {
-               compatible = "cypress,cy7c1019dv33-10zsximtd-ram";
+               compatible = "cypress,cy7c1019dv33-10zsxi", "mtd-ram";
                reg = <0 0 0x00010000>;
                #address-cells = <1>;
                #size-cells = <1>;
@@ -286,7 +286,7 @@ sram@0,0 {
 
        /* SRAM on Colibri nEXT_CS1 */
        sram@1,0 {
-               compatible = "cypress,cy7c1019dv33-10zsximtd-ram";
+               compatible = "cypress,cy7c1019dv33-10zsxi", "mtd-ram";
                reg = <1 0 0x00010000>;
                #address-cells = <1>;
                #size-cells = <1>;
index 978dc1c2ff1b8b3c9b0dd76a99ed911f8994790c..4d18952658f841f3503f722038549a9f2aee99b6 100644 (file)
@@ -192,7 +192,6 @@ &usdhc4 {
        pinctrl-0 = <&pinctrl_usdhc4>;
        bus-width = <8>;
        non-removable;
-       vmmc-supply = <&vdd_emmc_1p8>;
        status = "disabled";
 };
 
index d05be3f0e2a722f4165b6d2450e1fcf397e7ef02..04717cf69db07cd4049e52aefce6ef3542df3f3c 100644 (file)
@@ -336,7 +336,6 @@ &usdhc3 {
        assigned-clock-rates = <400000000>;
        bus-width = <8>;
        fsl,tuning-step = <2>;
-       max-frequency = <100000000>;
        vmmc-supply = <&reg_module_3v3>;
        vqmmc-supply = <&reg_DCDC3>;
        non-removable;
index 92f6d0c2a74f6544912f211f055c6083748b8138..4c22828df55f31522b2708e7aa353312857215ab 100644 (file)
@@ -44,7 +44,7 @@ opp-792000000 {
                        opp-hz = /bits/ 64 <792000000>;
                        opp-microvolt = <1000000>;
                        clock-latency-ns = <150000>;
-                       opp-supported-hw = <0xd>, <0xf>;
+                       opp-supported-hw = <0xd>, <0x7>;
                        opp-suspend;
                };
 
@@ -52,7 +52,7 @@ opp-996000000 {
                        opp-hz = /bits/ 64 <996000000>;
                        opp-microvolt = <1100000>;
                        clock-latency-ns = <150000>;
-                       opp-supported-hw = <0xc>, <0xf>;
+                       opp-supported-hw = <0xc>, <0x7>;
                        opp-suspend;
                };
 
@@ -60,7 +60,7 @@ opp-1200000000 {
                        opp-hz = /bits/ 64 <1200000000>;
                        opp-microvolt = <1225000>;
                        clock-latency-ns = <150000>;
-                       opp-supported-hw = <0x8>, <0xf>;
+                       opp-supported-hw = <0x8>, <0x3>;
                        opp-suspend;
                };
        };
index 0855b1fe98e0d2ffc04ac48b940c6c6ef1f868d1..760a68c163c834213e396c55620152ce97967dd2 100644 (file)
@@ -747,7 +747,7 @@ dcu: dcu@2ce0000 {
                };
 
                mdio0: mdio@2d24000 {
-                       compatible = "fsl,etsec2-mdio";
+                       compatible = "gianfar";
                        device_type = "mdio";
                        #address-cells = <1>;
                        #size-cells = <0>;
@@ -756,7 +756,7 @@ mdio0: mdio@2d24000 {
                };
 
                mdio1: mdio@2d64000 {
-                       compatible = "fsl,etsec2-mdio";
+                       compatible = "gianfar";
                        device_type = "mdio";
                        #address-cells = <1>;
                        #size-cells = <0>;
index 85665506f4f80142162342c49b7c6a1e6aa27eee..b6e82b165f5c5a6c5b4e719ca03fd98c6f931958 100644 (file)
@@ -182,6 +182,14 @@ vibrator {
                pwm-names = "enable", "direction";
                direction-duty-cycle-ns = <10000000>;
        };
+
+       backlight: backlight {
+               compatible = "led-backlight";
+
+               leds = <&backlight_led>;
+               brightness-levels = <31 63 95 127 159 191 223 255>;
+               default-brightness-level = <6>;
+       };
 };
 
 &dss {
@@ -205,6 +213,8 @@ lcd0: display {
                vddi-supply = <&lcd_regulator>;
                reset-gpios = <&gpio4 5 GPIO_ACTIVE_HIGH>;      /* gpio101 */
 
+               backlight = <&backlight>;
+
                width-mm = <50>;
                height-mm = <89>;
 
@@ -393,12 +403,11 @@ led-controller@38 {
                ramp-up-us = <1024>;
                ramp-down-us = <8193>;
 
-               led@0 {
+               backlight_led: led@0 {
                        reg = <0>;
                        led-sources = <2>;
                        ti,led-mode = <0>;
                        label = ":backlight";
-                       linux,default-trigger = "backlight";
                };
 
                led@1 {
index beb9885e6ffca7a521ffb670f44ddd8be639a287..c0999e27e9b145e31ae341af3709fbd6d1a7a933 100644 (file)
@@ -377,7 +377,7 @@ tmu2: timer@ffd82000 {
        };
 
        sata: sata@fc600000 {
-               compatible = "renesas,sata-r8a7779", "renesas,rcar-sata";
+               compatible = "renesas,sata-r8a7779";
                reg = <0xfc600000 0x200000>;
                interrupts = <GIC_SPI 100 IRQ_TYPE_LEVEL_HIGH>;
                clocks = <&mstp1_clks R8A7779_CLK_SATA>;
index 519ff58e67b3057b4b506f8e0a5b9c964a527eb8..0afcae9f7cf8a0411e53ebd658d9a0efd93b9c49 100644 (file)
@@ -178,6 +178,7 @@ CONFIG_SCHED_TRACER=y
 CONFIG_STACK_TRACER=y
 CONFIG_FUNCTION_PROFILER=y
 CONFIG_TEST_KSTRTOX=y
+CONFIG_DEBUG_FS=y
 CONFIG_KGDB=y
 CONFIG_KGDB_KDB=y
 CONFIG_STRICT_DEVMEM=y
index c32c338f770426bcb6c97e7a36ca2bd34b241b00..847f9874ccc4ad53b5ef58df5c316112aefe7350 100644 (file)
@@ -375,6 +375,7 @@ CONFIG_BACKLIGHT_GENERIC=m
 CONFIG_BACKLIGHT_PWM=m
 CONFIG_BACKLIGHT_PANDORA=m
 CONFIG_BACKLIGHT_GPIO=m
+CONFIG_BACKLIGHT_LED=m
 CONFIG_FRAMEBUFFER_CONSOLE=y
 CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y
 CONFIG_LOGO=y
index fe2e1e82e23399dacdc4dbe6a68fd1957fd0f4df..e73c97b0f5b09b898b69e51d171c9f5d7fcec48d 100644 (file)
@@ -157,6 +157,7 @@ CONFIG_NLS_ISO8859_1=y
 CONFIG_PRINTK_TIME=y
 CONFIG_DEBUG_INFO=y
 CONFIG_MAGIC_SYSRQ=y
+CONFIG_DEBUG_FS=y
 CONFIG_DETECT_HUNG_TASK=y
 # CONFIG_SCHED_DEBUG is not set
 CONFIG_FUNCTION_TRACER=y
index 35ff620537e62b3fab1759730a53b6cb8d4a5d9b..03506ce4614934675e772cce4a74386ead086fae 100644 (file)
@@ -91,6 +91,8 @@ AFLAGS_suspend-imx6.o :=-Wa,-march=armv7-a
 obj-$(CONFIG_SOC_IMX6) += suspend-imx6.o
 obj-$(CONFIG_SOC_IMX53) += suspend-imx53.o
 endif
+AFLAGS_resume-imx6.o :=-Wa,-march=armv7-a
+obj-$(CONFIG_SOC_IMX6) += resume-imx6.o
 obj-$(CONFIG_SOC_IMX6) += pm-imx6.o
 
 obj-$(CONFIG_SOC_IMX1) += mach-imx1.o
index 912aeceb4ff81cc8cb2c41c2fd91b2757032335d..5aa5796cff0e19280208379ceae42df22da4c452 100644 (file)
@@ -109,17 +109,17 @@ void imx_cpu_die(unsigned int cpu);
 int imx_cpu_kill(unsigned int cpu);
 
 #ifdef CONFIG_SUSPEND
-void v7_cpu_resume(void);
 void imx53_suspend(void __iomem *ocram_vbase);
 extern const u32 imx53_suspend_sz;
 void imx6_suspend(void __iomem *ocram_vbase);
 #else
-static inline void v7_cpu_resume(void) {}
 static inline void imx53_suspend(void __iomem *ocram_vbase) {}
 static const u32 imx53_suspend_sz;
 static inline void imx6_suspend(void __iomem *ocram_vbase) {}
 #endif
 
+void v7_cpu_resume(void);
+
 void imx6_pm_ccm_init(const char *ccm_compat);
 void imx6q_pm_init(void);
 void imx6dl_pm_init(void);
diff --git a/arch/arm/mach-imx/resume-imx6.S b/arch/arm/mach-imx/resume-imx6.S
new file mode 100644 (file)
index 0000000..5bd1ba7
--- /dev/null
@@ -0,0 +1,24 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * Copyright 2014 Freescale Semiconductor, Inc.
+ */
+
+#include <linux/linkage.h>
+#include <asm/assembler.h>
+#include <asm/asm-offsets.h>
+#include <asm/hardware/cache-l2x0.h>
+#include "hardware.h"
+
+/*
+ * The following code must assume it is running from physical address
+ * where absolute virtual addresses to the data section have to be
+ * turned into relative ones.
+ */
+
+ENTRY(v7_cpu_resume)
+       bl      v7_invalidate_l1
+#ifdef CONFIG_CACHE_L2X0
+       bl      l2c310_early_resume
+#endif
+       b       cpu_resume
+ENDPROC(v7_cpu_resume)
index 062391ff13dae207b35c15fb3a56e9c1c65b70a5..1eabf2d2834be79c6a6a695262ca4f1af2edcfc2 100644 (file)
@@ -327,17 +327,3 @@ resume:
 
        ret     lr
 ENDPROC(imx6_suspend)
-
-/*
- * The following code must assume it is running from physical address
- * where absolute virtual addresses to the data section have to be
- * turned into relative ones.
- */
-
-ENTRY(v7_cpu_resume)
-       bl      v7_invalidate_l1
-#ifdef CONFIG_CACHE_L2X0
-       bl      l2c310_early_resume
-#endif
-       b       cpu_resume
-ENDPROC(v7_cpu_resume)
index 01f0f4b765e00c980c855389256681d9d7293912..75034fe197e3be0d04e7043d14312dbfa0107f69 100644 (file)
@@ -9,7 +9,6 @@ menuconfig ARCH_MESON
        select CACHE_L2X0
        select PINCTRL
        select PINCTRL_MESON
-       select COMMON_CLK
        select HAVE_ARM_SCU if SMP
        select HAVE_ARM_TWD if SMP
 
index e1135b9d67c65c3e2080d36d2b54b40033bd5b4f..5017a3be0ff016f8c33afabad821caca8f25a9ca 100644 (file)
@@ -16,7 +16,7 @@ hwmod-common                          = omap_hwmod.o omap_hwmod_reset.o \
 clock-common                           = clock.o
 secure-common                          = omap-smc.o omap-secure.o
 
-obj-$(CONFIG_ARCH_OMAP2) += $(omap-2-3-common) $(hwmod-common) $(secure-common)
+obj-$(CONFIG_ARCH_OMAP2) += $(omap-2-3-common) $(hwmod-common)
 obj-$(CONFIG_ARCH_OMAP3) += $(omap-2-3-common) $(hwmod-common) $(secure-common)
 obj-$(CONFIG_ARCH_OMAP4) += $(hwmod-common) $(secure-common)
 obj-$(CONFIG_SOC_AM33XX) += $(hwmod-common) $(secure-common)
index f280472336657dbbb1fe544d27e08ddfc2277cfa..27608d1026cbced98b22f25678d4e92827cd8758 100644 (file)
@@ -431,7 +431,6 @@ void __init omap2420_init_early(void)
        omap_hwmod_init_postsetup();
        omap_clk_soc_init = omap2420_dt_clk_init;
        rate_table = omap2420_rate_table;
-       omap_secure_init();
 }
 
 void __init omap2420_init_late(void)
@@ -456,7 +455,6 @@ void __init omap2430_init_early(void)
        omap_hwmod_init_postsetup();
        omap_clk_soc_init = omap2430_dt_clk_init;
        rate_table = omap2430_rate_table;
-       omap_secure_init();
 }
 
 void __init omap2430_init_late(void)
index f82f25c1a5f97be47d4593be9850ac0c5c7f0f32..d5dc12878dfe495b136b894ed45ebd3e07f929dd 100644 (file)
@@ -327,7 +327,7 @@ &sd_emmc_a {
        #size-cells = <0>;
 
        bus-width = <4>;
-       max-frequency = <50000000>;
+       max-frequency = <60000000>;
 
        non-removable;
        disable-wp;
index a8bb3fa9fec98e994ce2876b95e81e86b8369c02..cb1b48f5b8b1cdf4d4c5cb98198c2df1006cf177 100644 (file)
@@ -593,6 +593,7 @@ bluetooth {
                compatible = "brcm,bcm43438-bt";
                interrupt-parent = <&gpio_intc>;
                interrupts = <95 IRQ_TYPE_LEVEL_HIGH>;
+               interrupt-names = "host-wakeup";
                shutdown-gpios = <&gpio GPIOX_17 GPIO_ACTIVE_HIGH>;
                max-speed = <2000000>;
                clocks = <&wifi32k>;
index d3d26cca7d526c63b8a6f5d4be201c9cfbbfb60c..13460a360c6af7bc0dba24184c20523b332184ce 100644 (file)
@@ -52,11 +52,6 @@ ethphy0: ethernet-phy@0 {
                        compatible = "ethernet-phy-ieee802.3-c22";
                        reg = <0>;
                };
-
-               ethphy1: ethernet-phy@1 {
-                       compatible = "ethernet-phy-ieee802.3-c22";
-                       reg = <1>;
-               };
        };
 };
 
index e1d357eaad7c364333d826cc45d00e2d9fca8ab2..d8c44d3ca15acb7ab2751533972eeab372803419 100644 (file)
@@ -102,7 +102,7 @@ base_fpga_region {
                };
 
                gmac0: ethernet@ff800000 {
-                       compatible = "altr,socfpga-stmmac", "snps,dwmac-3.74a", "snps,dwmac";
+                       compatible = "altr,socfpga-stmmac-a10-s10", "snps,dwmac-3.74a", "snps,dwmac";
                        reg = <0xff800000 0x2000>;
                        interrupts = <0 90 4>;
                        interrupt-names = "macirq";
@@ -118,7 +118,7 @@ gmac0: ethernet@ff800000 {
                };
 
                gmac1: ethernet@ff802000 {
-                       compatible = "altr,socfpga-stmmac", "snps,dwmac-3.74a", "snps,dwmac";
+                       compatible = "altr,socfpga-stmmac-a10-s10", "snps,dwmac-3.74a", "snps,dwmac";
                        reg = <0xff802000 0x2000>;
                        interrupts = <0 91 4>;
                        interrupt-names = "macirq";
@@ -134,7 +134,7 @@ gmac1: ethernet@ff802000 {
                };
 
                gmac2: ethernet@ff804000 {
-                       compatible = "altr,socfpga-stmmac", "snps,dwmac-3.74a", "snps,dwmac";
+                       compatible = "altr,socfpga-stmmac-a10-s10", "snps,dwmac-3.74a", "snps,dwmac";
                        reg = <0xff804000 0x2000>;
                        interrupts = <0 92 4>;
                        interrupt-names = "macirq";
index 905109f6814ff9e026c994d87dc65d6bf4370dac..4db223dbc549936c1dcef9b0832731c28a32112a 100644 (file)
@@ -773,7 +773,7 @@ CONFIG_ARCH_R8A774A1=y
 CONFIG_ARCH_R8A774B1=y
 CONFIG_ARCH_R8A774C0=y
 CONFIG_ARCH_R8A7795=y
-CONFIG_ARCH_R8A7796=y
+CONFIG_ARCH_R8A77960=y
 CONFIG_ARCH_R8A77961=y
 CONFIG_ARCH_R8A77965=y
 CONFIG_ARCH_R8A77970=y
index 8ef73e89d51485950b0bc05689c64120b8fedebc..d89bb22589f660fb34a5786a243167245d0f4754 100644 (file)
@@ -260,14 +260,26 @@ asmlinkage void post_ttbr_update_workaround(void)
                        CONFIG_CAVIUM_ERRATUM_27456));
 }
 
-static int asids_init(void)
+static int asids_update_limit(void)
 {
-       asid_bits = get_cpu_asid_bits();
+       unsigned long num_available_asids = NUM_USER_ASIDS;
+
+       if (arm64_kernel_unmapped_at_el0())
+               num_available_asids /= 2;
        /*
         * Expect allocation after rollover to fail if we don't have at least
         * one more ASID than CPUs. ASID #0 is reserved for init_mm.
         */
-       WARN_ON(NUM_USER_ASIDS - 1 <= num_possible_cpus());
+       WARN_ON(num_available_asids - 1 <= num_possible_cpus());
+       pr_info("ASID allocator initialised with %lu entries\n",
+               num_available_asids);
+       return 0;
+}
+arch_initcall(asids_update_limit);
+
+static int asids_init(void)
+{
+       asid_bits = get_cpu_asid_bits();
        atomic64_set(&asid_generation, ASID_FIRST_VERSION);
        asid_map = kcalloc(BITS_TO_LONGS(NUM_USER_ASIDS), sizeof(*asid_map),
                           GFP_KERNEL);
@@ -282,8 +294,6 @@ static int asids_init(void)
         */
        if (IS_ENABLED(CONFIG_UNMAP_KERNEL_AT_EL0))
                set_kpti_asid_bits();
-
-       pr_info("ASID allocator initialised with %lu entries\n", NUM_USER_ASIDS);
        return 0;
 }
 early_initcall(asids_init);
index e745abc5457a0bb5f0560a695f00a7925ff29386..245be4fafe134a95c468ee7086ce2f985231dd3e 100644 (file)
@@ -2193,11 +2193,13 @@ static struct cpu_spec * __init setup_cpu_spec(unsigned long offset,
                 * oprofile_cpu_type already has a value, then we are
                 * possibly overriding a real PVR with a logical one,
                 * and, in that case, keep the current value for
-                * oprofile_cpu_type.
+                * oprofile_cpu_type. Futhermore, let's ensure that the
+                * fix for the PMAO bug is enabled on compatibility mode.
                 */
                if (old.oprofile_cpu_type != NULL) {
                        t->oprofile_cpu_type = old.oprofile_cpu_type;
                        t->oprofile_type = old.oprofile_type;
+                       t->cpu_features |= old.cpu_features & CPU_FTR_PMAO_BUG;
                }
        }
 
index 2462cd7c565c6053f4866447b148ab0b7b3391c9..d0854320bb50fdd65eadbadb50ffcddc0bedc592 100644 (file)
@@ -331,11 +331,13 @@ int hw_breakpoint_handler(struct die_args *args)
        }
 
        info->type &= ~HW_BRK_TYPE_EXTRANEOUS_IRQ;
-       if (!dar_within_range(regs->dar, info))
-               info->type |= HW_BRK_TYPE_EXTRANEOUS_IRQ;
-
-       if (!IS_ENABLED(CONFIG_PPC_8xx) && !stepping_handler(regs, bp, info))
-               goto out;
+       if (IS_ENABLED(CONFIG_PPC_8xx)) {
+               if (!dar_within_range(regs->dar, info))
+                       info->type |= HW_BRK_TYPE_EXTRANEOUS_IRQ;
+       } else {
+               if (!stepping_handler(regs, bp, info))
+                       goto out;
+       }
 
        /*
         * As a policy, the callback is invoked in a 'trigger-after-execute'
index b4c89a1acebb83b75b1151e1a29aae89704f66ed..a32d478a7f41de22c1841262790ca60fc72ca376 100644 (file)
@@ -303,6 +303,12 @@ SECTIONS
                *(.branch_lt)
        }
 
+#ifdef CONFIG_DEBUG_INFO_BTF
+       .BTF : AT(ADDR(.BTF) - LOAD_OFFSET) {
+               *(.BTF)
+       }
+#endif
+
        .opd : AT(ADDR(.opd) - LOAD_OFFSET) {
                __start_opd = .;
                KEEP(*(.opd))
index ef7b1119b2e296c41753fb4c17489c4834237e01..1c07d5a3f54318cdf7f315b3fa517b73698b028b 100644 (file)
@@ -373,7 +373,9 @@ static inline bool flush_coherent_icache(unsigned long addr)
         */
        if (cpu_has_feature(CPU_FTR_COHERENT_ICACHE)) {
                mb(); /* sync */
+               allow_read_from_user((const void __user *)addr, L1_CACHE_BYTES);
                icbi((void *)addr);
+               prevent_read_from_user((const void __user *)addr, L1_CACHE_BYTES);
                mb(); /* sync */
                isync();
                return true;
index 73f029eae0cce91d89cfff9206e86324b716f46f..1a3b5a5276be26cdc052eca8d997864735802316 100644 (file)
@@ -121,6 +121,7 @@ config ARCH_FLATMEM_ENABLE
 
 config ARCH_SPARSEMEM_ENABLE
        def_bool y
+       depends on MMU
        select SPARSEMEM_VMEMMAP_ENABLE
 
 config ARCH_SELECT_MEMORY_MODEL
index d325b67d00dfcf70c4f3cf89e68e3964eec62a06..3078b2de0b2d50171835e3775d0f85a70869a819 100644 (file)
@@ -10,4 +10,28 @@ config SOC_SIFIVE
        help
          This enables support for SiFive SoC platform hardware.
 
+config SOC_VIRT
+       bool "QEMU Virt Machine"
+       select VIRTIO_PCI
+       select VIRTIO_BALLOON
+       select VIRTIO_MMIO
+       select VIRTIO_CONSOLE
+       select VIRTIO_NET
+       select NET_9P_VIRTIO
+       select VIRTIO_BLK
+       select SCSI_VIRTIO
+       select DRM_VIRTIO_GPU
+       select HW_RANDOM_VIRTIO
+       select RPMSG_CHAR
+       select RPMSG_VIRTIO
+       select CRYPTO_DEV_VIRTIO
+       select VIRTIO_INPUT
+       select POWER_RESET_SYSCON
+       select POWER_RESET_SYSCON_POWEROFF
+       select GOLDFISH
+       select RTC_DRV_GOLDFISH
+       select SIFIVE_PLIC
+       help
+         This enables support for QEMU Virt Machine.
+
 endmenu
index b9009a2fbaf5c4dd7965f75264dee93539308019..259cb53d7f20e04e872d3b3f68f34b1e28789f10 100644 (file)
@@ -13,8 +13,10 @@ LDFLAGS_vmlinux :=
 ifeq ($(CONFIG_DYNAMIC_FTRACE),y)
        LDFLAGS_vmlinux := --no-relax
 endif
-KBUILD_AFLAGS_MODULE += -fPIC
-KBUILD_CFLAGS_MODULE += -fPIC
+
+ifeq ($(CONFIG_64BIT)$(CONFIG_CMODEL_MEDLOW),yy)
+KBUILD_CFLAGS_MODULE += -mcmodel=medany
+endif
 
 export BITS
 ifeq ($(CONFIG_ARCH_RV64I),y)
index 609198cb1163756e9c00d6c8f70e8a8b2440c7a0..4a2729f5ca3f0113be3e02e72f9c427fe02207cc 100644 (file)
@@ -2,6 +2,7 @@
 /* Copyright (c) 2018-2019 SiFive, Inc */
 
 #include "fu540-c000.dtsi"
+#include <dt-bindings/gpio/gpio.h>
 
 /* Clock frequency (in Hz) of the PCB crystal for rtcclk */
 #define RTCCLK_FREQ            1000000
@@ -41,6 +42,10 @@ rtcclk: rtcclk {
                clock-frequency = <RTCCLK_FREQ>;
                clock-output-names = "rtcclk";
        };
+       gpio-restart {
+               compatible = "gpio-restart";
+               gpios = <&gpio 10 GPIO_ACTIVE_LOW>;
+       };
 };
 
 &uart0 {
index e2ff95cb3390f1750746d433e1877c45855b73f6..c8f0842030676a73553e8175e751b12aacb417d5 100644 (file)
@@ -15,6 +15,7 @@ CONFIG_BLK_DEV_INITRD=y
 CONFIG_EXPERT=y
 CONFIG_BPF_SYSCALL=y
 CONFIG_SOC_SIFIVE=y
+CONFIG_SOC_VIRT=y
 CONFIG_SMP=y
 CONFIG_MODULES=y
 CONFIG_MODULE_UNLOAD=y
@@ -30,7 +31,6 @@ CONFIG_IP_PNP_BOOTP=y
 CONFIG_IP_PNP_RARP=y
 CONFIG_NETLINK_DIAG=y
 CONFIG_NET_9P=y
-CONFIG_NET_9P_VIRTIO=y
 CONFIG_PCI=y
 CONFIG_PCIEPORTBUS=y
 CONFIG_PCI_HOST_GENERIC=y
@@ -38,15 +38,12 @@ CONFIG_PCIE_XILINX=y
 CONFIG_DEVTMPFS=y
 CONFIG_DEVTMPFS_MOUNT=y
 CONFIG_BLK_DEV_LOOP=y
-CONFIG_VIRTIO_BLK=y
 CONFIG_BLK_DEV_SD=y
 CONFIG_BLK_DEV_SR=y
-CONFIG_SCSI_VIRTIO=y
 CONFIG_ATA=y
 CONFIG_SATA_AHCI=y
 CONFIG_SATA_AHCI_PLATFORM=y
 CONFIG_NETDEVICES=y
-CONFIG_VIRTIO_NET=y
 CONFIG_MACB=y
 CONFIG_E1000E=y
 CONFIG_R8169=y
@@ -57,15 +54,13 @@ CONFIG_SERIAL_8250_CONSOLE=y
 CONFIG_SERIAL_OF_PLATFORM=y
 CONFIG_SERIAL_EARLYCON_RISCV_SBI=y
 CONFIG_HVC_RISCV_SBI=y
-CONFIG_VIRTIO_CONSOLE=y
 CONFIG_HW_RANDOM=y
-CONFIG_HW_RANDOM_VIRTIO=y
 CONFIG_SPI=y
 CONFIG_SPI_SIFIVE=y
 # CONFIG_PTP_1588_CLOCK is not set
+CONFIG_POWER_RESET=y
 CONFIG_DRM=y
 CONFIG_DRM_RADEON=y
-CONFIG_DRM_VIRTIO_GPU=y
 CONFIG_FRAMEBUFFER_CONSOLE=y
 CONFIG_USB=y
 CONFIG_USB_XHCI_HCD=y
@@ -78,12 +73,7 @@ CONFIG_USB_STORAGE=y
 CONFIG_USB_UAS=y
 CONFIG_MMC=y
 CONFIG_MMC_SPI=y
-CONFIG_VIRTIO_PCI=y
-CONFIG_VIRTIO_BALLOON=y
-CONFIG_VIRTIO_INPUT=y
-CONFIG_VIRTIO_MMIO=y
-CONFIG_RPMSG_CHAR=y
-CONFIG_RPMSG_VIRTIO=y
+CONFIG_RTC_CLASS=y
 CONFIG_EXT4_FS=y
 CONFIG_EXT4_FS_POSIX_ACL=y
 CONFIG_AUTOFS4_FS=y
@@ -98,7 +88,6 @@ CONFIG_NFS_V4_2=y
 CONFIG_ROOT_NFS=y
 CONFIG_9P_FS=y
 CONFIG_CRYPTO_USER_API_HASH=y
-CONFIG_CRYPTO_DEV_VIRTIO=y
 CONFIG_PRINTK_TIME=y
 CONFIG_DEBUG_FS=y
 CONFIG_DEBUG_PAGEALLOC=y
index eb519407c841b3327898680cd4c1893165900eb4..a844920a261fa473358f5da753ef88a8b39de52f 100644 (file)
@@ -14,6 +14,7 @@ CONFIG_CHECKPOINT_RESTORE=y
 CONFIG_BLK_DEV_INITRD=y
 CONFIG_EXPERT=y
 CONFIG_BPF_SYSCALL=y
+CONFIG_SOC_VIRT=y
 CONFIG_ARCH_RV32I=y
 CONFIG_SMP=y
 CONFIG_MODULES=y
@@ -30,7 +31,6 @@ CONFIG_IP_PNP_BOOTP=y
 CONFIG_IP_PNP_RARP=y
 CONFIG_NETLINK_DIAG=y
 CONFIG_NET_9P=y
-CONFIG_NET_9P_VIRTIO=y
 CONFIG_PCI=y
 CONFIG_PCIEPORTBUS=y
 CONFIG_PCI_HOST_GENERIC=y
@@ -38,15 +38,12 @@ CONFIG_PCIE_XILINX=y
 CONFIG_DEVTMPFS=y
 CONFIG_DEVTMPFS_MOUNT=y
 CONFIG_BLK_DEV_LOOP=y
-CONFIG_VIRTIO_BLK=y
 CONFIG_BLK_DEV_SD=y
 CONFIG_BLK_DEV_SR=y
-CONFIG_SCSI_VIRTIO=y
 CONFIG_ATA=y
 CONFIG_SATA_AHCI=y
 CONFIG_SATA_AHCI_PLATFORM=y
 CONFIG_NETDEVICES=y
-CONFIG_VIRTIO_NET=y
 CONFIG_MACB=y
 CONFIG_E1000E=y
 CONFIG_R8169=y
@@ -57,13 +54,11 @@ CONFIG_SERIAL_8250_CONSOLE=y
 CONFIG_SERIAL_OF_PLATFORM=y
 CONFIG_SERIAL_EARLYCON_RISCV_SBI=y
 CONFIG_HVC_RISCV_SBI=y
-CONFIG_VIRTIO_CONSOLE=y
 CONFIG_HW_RANDOM=y
-CONFIG_HW_RANDOM_VIRTIO=y
 # CONFIG_PTP_1588_CLOCK is not set
+CONFIG_POWER_RESET=y
 CONFIG_DRM=y
 CONFIG_DRM_RADEON=y
-CONFIG_DRM_VIRTIO_GPU=y
 CONFIG_FRAMEBUFFER_CONSOLE=y
 CONFIG_USB=y
 CONFIG_USB_XHCI_HCD=y
@@ -74,13 +69,7 @@ CONFIG_USB_OHCI_HCD=y
 CONFIG_USB_OHCI_HCD_PLATFORM=y
 CONFIG_USB_STORAGE=y
 CONFIG_USB_UAS=y
-CONFIG_VIRTIO_PCI=y
-CONFIG_VIRTIO_BALLOON=y
-CONFIG_VIRTIO_INPUT=y
-CONFIG_VIRTIO_MMIO=y
-CONFIG_RPMSG_CHAR=y
-CONFIG_RPMSG_VIRTIO=y
-CONFIG_SIFIVE_PLIC=y
+CONFIG_RTC_CLASS=y
 CONFIG_EXT4_FS=y
 CONFIG_EXT4_FS_POSIX_ACL=y
 CONFIG_AUTOFS4_FS=y
@@ -95,7 +84,6 @@ CONFIG_NFS_V4_2=y
 CONFIG_ROOT_NFS=y
 CONFIG_9P_FS=y
 CONFIG_CRYPTO_USER_API_HASH=y
-CONFIG_CRYPTO_DEV_VIRTIO=y
 CONFIG_PRINTK_TIME=y
 CONFIG_DEBUG_FS=y
 CONFIG_DEBUG_PAGEALLOC=y
index 42347d0981e7e4634a28d40d7675a417ac76b869..49350c8bd7b09b0f8193b3415c084db3d707d549 100644 (file)
@@ -28,13 +28,6 @@ static inline int syscall_get_nr(struct task_struct *task,
        return regs->a7;
 }
 
-static inline void syscall_set_nr(struct task_struct *task,
-                                 struct pt_regs *regs,
-                                 int sysno)
-{
-       regs->a7 = sysno;
-}
-
 static inline void syscall_rollback(struct task_struct *task,
                                    struct pt_regs *regs)
 {
index bad4d85b5e91810332719af05cb8d66009cf8982..208702d8c18eeac291ca8ef21eeec977d93af570 100644 (file)
@@ -228,20 +228,13 @@ check_syscall_nr:
        /* Check to make sure we don't jump to a bogus syscall number. */
        li t0, __NR_syscalls
        la s0, sys_ni_syscall
-       /*
-        * The tracer can change syscall number to valid/invalid value.
-        * We use syscall_set_nr helper in syscall_trace_enter thus we
-        * cannot trust the current value in a7 and have to reload from
-        * the current task pt_regs.
-        */
-       REG_L a7, PT_A7(sp)
        /*
         * Syscall number held in a7.
         * If syscall number is above allowed value, redirect to ni_syscall.
         */
        bge a7, t0, 1f
        /*
-        * Check if syscall is rejected by tracer or seccomp, i.e., a7 == -1.
+        * Check if syscall is rejected by tracer, i.e., a7 == -1.
         * If yes, we pretend it was executed.
         */
        li t1, -1
@@ -334,6 +327,7 @@ work_resched:
 handle_syscall_trace_enter:
        move a0, sp
        call do_syscall_trace_enter
+       move t0, a0
        REG_L a0, PT_A0(sp)
        REG_L a1, PT_A1(sp)
        REG_L a2, PT_A2(sp)
@@ -342,6 +336,7 @@ handle_syscall_trace_enter:
        REG_L a5, PT_A5(sp)
        REG_L a6, PT_A6(sp)
        REG_L a7, PT_A7(sp)
+       bnez t0, ret_from_syscall_rejected
        j check_syscall_nr
 handle_syscall_trace_exit:
        move a0, sp
index b7401858d872f37c496a3306b44a462df9e634a7..8bbe5dbe1341b663f02e08f094fd9e72a7fb2aad 100644 (file)
@@ -8,6 +8,10 @@
 #include <linux/err.h>
 #include <linux/errno.h>
 #include <linux/moduleloader.h>
+#include <linux/vmalloc.h>
+#include <linux/sizes.h>
+#include <asm/pgtable.h>
+#include <asm/sections.h>
 
 static int apply_r_riscv_32_rela(struct module *me, u32 *location, Elf_Addr v)
 {
@@ -386,3 +390,15 @@ int apply_relocate_add(Elf_Shdr *sechdrs, const char *strtab,
 
        return 0;
 }
+
+#if defined(CONFIG_MMU) && defined(CONFIG_64BIT)
+#define VMALLOC_MODULE_START \
+        max(PFN_ALIGN((unsigned long)&_end - SZ_2G), VMALLOC_START)
+void *module_alloc(unsigned long size)
+{
+       return __vmalloc_node_range(size, 1, VMALLOC_MODULE_START,
+                                   VMALLOC_END, GFP_KERNEL,
+                                   PAGE_KERNEL_EXEC, 0, NUMA_NO_NODE,
+                                   __builtin_return_address(0));
+}
+#endif
index 407464201b91efe42fb3002bd78dd5498e729c55..444dc7b0fd78c5cdc04887ffa4f6fea50b99a992 100644 (file)
@@ -148,21 +148,19 @@ long arch_ptrace(struct task_struct *child, long request,
  * Allows PTRACE_SYSCALL to work.  These are called from entry.S in
  * {handle,ret_from}_syscall.
  */
-__visible void do_syscall_trace_enter(struct pt_regs *regs)
+__visible int do_syscall_trace_enter(struct pt_regs *regs)
 {
        if (test_thread_flag(TIF_SYSCALL_TRACE))
                if (tracehook_report_syscall_entry(regs))
-                       syscall_set_nr(current, regs, -1);
+                       return -1;
 
        /*
         * Do the secure computing after ptrace; failures should be fast.
         * If this fails we might have return value in a0 from seccomp
         * (via SECCOMP_RET_ERRNO/TRACE).
         */
-       if (secure_computing() == -1) {
-               syscall_set_nr(current, regs, -1);
-               return;
-       }
+       if (secure_computing() == -1)
+               return -1;
 
 #ifdef CONFIG_HAVE_SYSCALL_TRACEPOINTS
        if (test_thread_flag(TIF_SYSCALL_TRACEPOINT))
@@ -170,6 +168,7 @@ __visible void do_syscall_trace_enter(struct pt_regs *regs)
 #endif
 
        audit_syscall_entry(regs->a7, regs->a0, regs->a1, regs->a2, regs->a3);
+       return 0;
 }
 
 __visible void do_syscall_trace_exit(struct pt_regs *regs)
index 965a8cf4829ca33bfde4754bf47db0b8b17c6611..fab855963c730653f3d4ee677f3371a5f3ee5bd7 100644 (file)
@@ -131,7 +131,7 @@ void __init setup_bootmem(void)
        for_each_memblock(memory, reg) {
                phys_addr_t end = reg->base + reg->size;
 
-               if (reg->base <= vmlinux_end && vmlinux_end <= end) {
+               if (reg->base <= vmlinux_start && vmlinux_end <= end) {
                        mem_size = min(reg->size, (phys_addr_t)-PAGE_OFFSET);
 
                        /*
index 137a3920ca3632907ca17b515aed4045a8d4888c..6d7c3b7e928101d78d6a678b8fd9e2c3ccb239ab 100644 (file)
@@ -752,6 +752,12 @@ static inline int pmd_write(pmd_t pmd)
        return (pmd_val(pmd) & _SEGMENT_ENTRY_WRITE) != 0;
 }
 
+#define pud_write pud_write
+static inline int pud_write(pud_t pud)
+{
+       return (pud_val(pud) & _REGION3_ENTRY_WRITE) != 0;
+}
+
 static inline int pmd_dirty(pmd_t pmd)
 {
        return (pmd_val(pmd) & _SEGMENT_ENTRY_DIRTY) != 0;
index bc61ea18e88d90bc183b80c34cbfc4f372c343de..60716d18ce5afd0d0f4c9277ea0342b9ddadc9d9 100644 (file)
@@ -424,7 +424,7 @@ static void zpci_map_resources(struct pci_dev *pdev)
 
                if (zpci_use_mio(zdev))
                        pdev->resource[i].start =
-                               (resource_size_t __force) zdev->bars[i].mio_wb;
+                               (resource_size_t __force) zdev->bars[i].mio_wt;
                else
                        pdev->resource[i].start = (resource_size_t __force)
                                pci_iomap_range_fh(pdev, i, 0, 0);
@@ -531,7 +531,7 @@ static int zpci_setup_bus_resources(struct zpci_dev *zdev,
                        flags |= IORESOURCE_MEM_64;
 
                if (zpci_use_mio(zdev))
-                       addr = (unsigned long) zdev->bars[i].mio_wb;
+                       addr = (unsigned long) zdev->bars[i].mio_wt;
                else
                        addr = ZPCI_ADDR(entry);
                size = 1UL << zdev->bars[i].size;
index 02c6ef8f7667725b2730e049a2a51d78caec650e..07344d82e88ee6b28e4bb2040932eb1135a3b4a3 100644 (file)
@@ -19,7 +19,14 @@ struct task_struct;
 void io_bitmap_share(struct task_struct *tsk);
 void io_bitmap_exit(void);
 
-void tss_update_io_bitmap(void);
+void native_tss_update_io_bitmap(void);
+
+#ifdef CONFIG_PARAVIRT_XXL
+#include <asm/paravirt.h>
+#else
+#define tss_update_io_bitmap native_tss_update_io_bitmap
+#endif
+
 #else
 static inline void io_bitmap_share(struct task_struct *tsk) { }
 static inline void io_bitmap_exit(void) { }
index 86e7317eb31f9a11c3f3b638f0882929b76af777..694d8daf498376ef7e91a1a3026638e275378cab 100644 (file)
@@ -295,6 +295,13 @@ static inline void write_idt_entry(gate_desc *dt, int entry, const gate_desc *g)
        PVOP_VCALL3(cpu.write_idt_entry, dt, entry, g);
 }
 
+#ifdef CONFIG_X86_IOPL_IOPERM
+static inline void tss_update_io_bitmap(void)
+{
+       PVOP_VCALL0(cpu.update_io_bitmap);
+}
+#endif
+
 static inline void paravirt_activate_mm(struct mm_struct *prev,
                                        struct mm_struct *next)
 {
index 84812964d3dd6f0ae5a68763251b4bd4f8af5f7e..732f62e04ddb851f47248013fac01bd62633aaf7 100644 (file)
@@ -140,6 +140,10 @@ struct pv_cpu_ops {
 
        void (*load_sp0)(unsigned long sp0);
 
+#ifdef CONFIG_X86_IOPL_IOPERM
+       void (*update_io_bitmap)(void);
+#endif
+
        void (*wbinvd)(void);
 
        /* cpuid emulation, mostly so that caps bits can be disabled */
index 52c9bfbbdb2a04dbdbd7288de4bcfe7be8f44851..4cdb123ff66a8dddd24a69987f78c37af7e28b8a 100644 (file)
@@ -445,7 +445,7 @@ static __always_inline void setup_pku(struct cpuinfo_x86 *c)
         * cpuid bit to be set.  We need to ensure that we
         * update that bit in this CPU's "cpu_info".
         */
-       get_cpu_cap(c);
+       set_cpu_cap(c, X86_FEATURE_OSPKE);
 }
 
 #ifdef CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS
index 789f5e4f89defc97f1daaf801c9929d616237b55..c131ba4e70ef8229d2c9f1722f88d100f942489e 100644 (file)
@@ -30,6 +30,7 @@
 #include <asm/timer.h>
 #include <asm/special_insns.h>
 #include <asm/tlb.h>
+#include <asm/io_bitmap.h>
 
 /*
  * nop stub, which must not clobber anything *including the stack* to
@@ -341,6 +342,10 @@ struct paravirt_patch_template pv_ops = {
        .cpu.iret               = native_iret,
        .cpu.swapgs             = native_swapgs,
 
+#ifdef CONFIG_X86_IOPL_IOPERM
+       .cpu.update_io_bitmap   = native_tss_update_io_bitmap,
+#endif
+
        .cpu.start_context_switch       = paravirt_nop,
        .cpu.end_context_switch         = paravirt_nop,
 
index 839b5244e3b7e17767fc69bc610ac7c9a487c7fd..3053c85e0e42db9abbb5261673fa78e897efe20e 100644 (file)
@@ -374,7 +374,7 @@ static void tss_copy_io_bitmap(struct tss_struct *tss, struct io_bitmap *iobm)
 /**
  * tss_update_io_bitmap - Update I/O bitmap before exiting to usermode
  */
-void tss_update_io_bitmap(void)
+void native_tss_update_io_bitmap(void)
 {
        struct tss_struct *tss = this_cpu_ptr(&cpu_tss_rw);
        struct thread_struct *t = &current->thread;
index 64229dad7eab6ce868957491431b62b51a2bee95..69309cd56fdf3fb28c8b7732297471ba69f46686 100644 (file)
@@ -363,13 +363,8 @@ static void ptdump_walk_pgd_level_core(struct seq_file *m,
 {
        const struct ptdump_range ptdump_ranges[] = {
 #ifdef CONFIG_X86_64
-
-#define normalize_addr_shift (64 - (__VIRTUAL_MASK_SHIFT + 1))
-#define normalize_addr(u) ((signed long)((u) << normalize_addr_shift) >> \
-                          normalize_addr_shift)
-
        {0, PTRS_PER_PGD * PGD_LEVEL_MULT / 2},
-       {normalize_addr(PTRS_PER_PGD * PGD_LEVEL_MULT / 2), ~0UL},
+       {GUARD_HOLE_END_ADDR, ~0UL},
 #else
        {0, ~0UL},
 #endif
index fa8506e76bbeba3eb7b2efc75ff96767d41f6b6b..d19a2edd63cb224e33408d094d0df58f6ed3508c 100644 (file)
@@ -180,7 +180,7 @@ void efi_sync_low_kernel_mappings(void)
 static inline phys_addr_t
 virt_to_phys_or_null_size(void *va, unsigned long size)
 {
-       bool bad_size;
+       phys_addr_t pa;
 
        if (!va)
                return 0;
@@ -188,16 +188,13 @@ virt_to_phys_or_null_size(void *va, unsigned long size)
        if (virt_addr_valid(va))
                return virt_to_phys(va);
 
-       /*
-        * A fully aligned variable on the stack is guaranteed not to
-        * cross a page bounary. Try to catch strings on the stack by
-        * checking that 'size' is a power of two.
-        */
-       bad_size = size > PAGE_SIZE || !is_power_of_2(size);
+       pa = slow_virt_to_phys(va);
 
-       WARN_ON(!IS_ALIGNED((unsigned long)va, size) || bad_size);
+       /* check if the object crosses a page boundary */
+       if (WARN_ON((pa ^ (pa + size - 1)) & PAGE_MASK))
+               return 0;
 
-       return slow_virt_to_phys(va);
+       return pa;
 }
 
 #define virt_to_phys_or_null(addr)                             \
@@ -568,85 +565,25 @@ efi_thunk_set_virtual_address_map(unsigned long memory_map_size,
 
 static efi_status_t efi_thunk_get_time(efi_time_t *tm, efi_time_cap_t *tc)
 {
-       efi_status_t status;
-       u32 phys_tm, phys_tc;
-       unsigned long flags;
-
-       spin_lock(&rtc_lock);
-       spin_lock_irqsave(&efi_runtime_lock, flags);
-
-       phys_tm = virt_to_phys_or_null(tm);
-       phys_tc = virt_to_phys_or_null(tc);
-
-       status = efi_thunk(get_time, phys_tm, phys_tc);
-
-       spin_unlock_irqrestore(&efi_runtime_lock, flags);
-       spin_unlock(&rtc_lock);
-
-       return status;
+       return EFI_UNSUPPORTED;
 }
 
 static efi_status_t efi_thunk_set_time(efi_time_t *tm)
 {
-       efi_status_t status;
-       u32 phys_tm;
-       unsigned long flags;
-
-       spin_lock(&rtc_lock);
-       spin_lock_irqsave(&efi_runtime_lock, flags);
-
-       phys_tm = virt_to_phys_or_null(tm);
-
-       status = efi_thunk(set_time, phys_tm);
-
-       spin_unlock_irqrestore(&efi_runtime_lock, flags);
-       spin_unlock(&rtc_lock);
-
-       return status;
+       return EFI_UNSUPPORTED;
 }
 
 static efi_status_t
 efi_thunk_get_wakeup_time(efi_bool_t *enabled, efi_bool_t *pending,
                          efi_time_t *tm)
 {
-       efi_status_t status;
-       u32 phys_enabled, phys_pending, phys_tm;
-       unsigned long flags;
-
-       spin_lock(&rtc_lock);
-       spin_lock_irqsave(&efi_runtime_lock, flags);
-
-       phys_enabled = virt_to_phys_or_null(enabled);
-       phys_pending = virt_to_phys_or_null(pending);
-       phys_tm = virt_to_phys_or_null(tm);
-
-       status = efi_thunk(get_wakeup_time, phys_enabled,
-                            phys_pending, phys_tm);
-
-       spin_unlock_irqrestore(&efi_runtime_lock, flags);
-       spin_unlock(&rtc_lock);
-
-       return status;
+       return EFI_UNSUPPORTED;
 }
 
 static efi_status_t
 efi_thunk_set_wakeup_time(efi_bool_t enabled, efi_time_t *tm)
 {
-       efi_status_t status;
-       u32 phys_tm;
-       unsigned long flags;
-
-       spin_lock(&rtc_lock);
-       spin_lock_irqsave(&efi_runtime_lock, flags);
-
-       phys_tm = virt_to_phys_or_null(tm);
-
-       status = efi_thunk(set_wakeup_time, enabled, phys_tm);
-
-       spin_unlock_irqrestore(&efi_runtime_lock, flags);
-       spin_unlock(&rtc_lock);
-
-       return status;
+       return EFI_UNSUPPORTED;
 }
 
 static unsigned long efi_name_size(efi_char16_t *name)
@@ -658,6 +595,8 @@ static efi_status_t
 efi_thunk_get_variable(efi_char16_t *name, efi_guid_t *vendor,
                       u32 *attr, unsigned long *data_size, void *data)
 {
+       u8 buf[24] __aligned(8);
+       efi_guid_t *vnd = PTR_ALIGN((efi_guid_t *)buf, sizeof(*vnd));
        efi_status_t status;
        u32 phys_name, phys_vendor, phys_attr;
        u32 phys_data_size, phys_data;
@@ -665,14 +604,19 @@ efi_thunk_get_variable(efi_char16_t *name, efi_guid_t *vendor,
 
        spin_lock_irqsave(&efi_runtime_lock, flags);
 
+       *vnd = *vendor;
+
        phys_data_size = virt_to_phys_or_null(data_size);
-       phys_vendor = virt_to_phys_or_null(vendor);
+       phys_vendor = virt_to_phys_or_null(vnd);
        phys_name = virt_to_phys_or_null_size(name, efi_name_size(name));
        phys_attr = virt_to_phys_or_null(attr);
        phys_data = virt_to_phys_or_null_size(data, *data_size);
 
-       status = efi_thunk(get_variable, phys_name, phys_vendor,
-                          phys_attr, phys_data_size, phys_data);
+       if (!phys_name || (data && !phys_data))
+               status = EFI_INVALID_PARAMETER;
+       else
+               status = efi_thunk(get_variable, phys_name, phys_vendor,
+                                  phys_attr, phys_data_size, phys_data);
 
        spin_unlock_irqrestore(&efi_runtime_lock, flags);
 
@@ -683,19 +627,25 @@ static efi_status_t
 efi_thunk_set_variable(efi_char16_t *name, efi_guid_t *vendor,
                       u32 attr, unsigned long data_size, void *data)
 {
+       u8 buf[24] __aligned(8);
+       efi_guid_t *vnd = PTR_ALIGN((efi_guid_t *)buf, sizeof(*vnd));
        u32 phys_name, phys_vendor, phys_data;
        efi_status_t status;
        unsigned long flags;
 
        spin_lock_irqsave(&efi_runtime_lock, flags);
 
+       *vnd = *vendor;
+
        phys_name = virt_to_phys_or_null_size(name, efi_name_size(name));
-       phys_vendor = virt_to_phys_or_null(vendor);
+       phys_vendor = virt_to_phys_or_null(vnd);
        phys_data = virt_to_phys_or_null_size(data, data_size);
 
-       /* If data_size is > sizeof(u32) we've got problems */
-       status = efi_thunk(set_variable, phys_name, phys_vendor,
-                          attr, data_size, phys_data);
+       if (!phys_name || !phys_data)
+               status = EFI_INVALID_PARAMETER;
+       else
+               status = efi_thunk(set_variable, phys_name, phys_vendor,
+                                  attr, data_size, phys_data);
 
        spin_unlock_irqrestore(&efi_runtime_lock, flags);
 
@@ -707,6 +657,8 @@ efi_thunk_set_variable_nonblocking(efi_char16_t *name, efi_guid_t *vendor,
                                   u32 attr, unsigned long data_size,
                                   void *data)
 {
+       u8 buf[24] __aligned(8);
+       efi_guid_t *vnd = PTR_ALIGN((efi_guid_t *)buf, sizeof(*vnd));
        u32 phys_name, phys_vendor, phys_data;
        efi_status_t status;
        unsigned long flags;
@@ -714,13 +666,17 @@ efi_thunk_set_variable_nonblocking(efi_char16_t *name, efi_guid_t *vendor,
        if (!spin_trylock_irqsave(&efi_runtime_lock, flags))
                return EFI_NOT_READY;
 
+       *vnd = *vendor;
+
        phys_name = virt_to_phys_or_null_size(name, efi_name_size(name));
-       phys_vendor = virt_to_phys_or_null(vendor);
+       phys_vendor = virt_to_phys_or_null(vnd);
        phys_data = virt_to_phys_or_null_size(data, data_size);
 
-       /* If data_size is > sizeof(u32) we've got problems */
-       status = efi_thunk(set_variable, phys_name, phys_vendor,
-                          attr, data_size, phys_data);
+       if (!phys_name || !phys_data)
+               status = EFI_INVALID_PARAMETER;
+       else
+               status = efi_thunk(set_variable, phys_name, phys_vendor,
+                                  attr, data_size, phys_data);
 
        spin_unlock_irqrestore(&efi_runtime_lock, flags);
 
@@ -732,39 +688,36 @@ efi_thunk_get_next_variable(unsigned long *name_size,
                            efi_char16_t *name,
                            efi_guid_t *vendor)
 {
+       u8 buf[24] __aligned(8);
+       efi_guid_t *vnd = PTR_ALIGN((efi_guid_t *)buf, sizeof(*vnd));
        efi_status_t status;
        u32 phys_name_size, phys_name, phys_vendor;
        unsigned long flags;
 
        spin_lock_irqsave(&efi_runtime_lock, flags);
 
+       *vnd = *vendor;
+
        phys_name_size = virt_to_phys_or_null(name_size);
-       phys_vendor = virt_to_phys_or_null(vendor);
+       phys_vendor = virt_to_phys_or_null(vnd);
        phys_name = virt_to_phys_or_null_size(name, *name_size);
 
-       status = efi_thunk(get_next_variable, phys_name_size,
-                          phys_name, phys_vendor);
+       if (!phys_name)
+               status = EFI_INVALID_PARAMETER;
+       else
+               status = efi_thunk(get_next_variable, phys_name_size,
+                                  phys_name, phys_vendor);
 
        spin_unlock_irqrestore(&efi_runtime_lock, flags);
 
+       *vendor = *vnd;
        return status;
 }
 
 static efi_status_t
 efi_thunk_get_next_high_mono_count(u32 *count)
 {
-       efi_status_t status;
-       u32 phys_count;
-       unsigned long flags;
-
-       spin_lock_irqsave(&efi_runtime_lock, flags);
-
-       phys_count = virt_to_phys_or_null(count);
-       status = efi_thunk(get_next_high_mono_count, phys_count);
-
-       spin_unlock_irqrestore(&efi_runtime_lock, flags);
-
-       return status;
+       return EFI_UNSUPPORTED;
 }
 
 static void
index 79409120a6036c6852894b54509e3662ce5d3f6f..507f4fb88fa7fd184d1bba278a9ebaa8c8039f37 100644 (file)
@@ -72,6 +72,9 @@
 #include <asm/mwait.h>
 #include <asm/pci_x86.h>
 #include <asm/cpu.h>
+#ifdef CONFIG_X86_IOPL_IOPERM
+#include <asm/io_bitmap.h>
+#endif
 
 #ifdef CONFIG_ACPI
 #include <linux/acpi.h>
@@ -837,6 +840,25 @@ static void xen_load_sp0(unsigned long sp0)
        this_cpu_write(cpu_tss_rw.x86_tss.sp0, sp0);
 }
 
+#ifdef CONFIG_X86_IOPL_IOPERM
+static void xen_update_io_bitmap(void)
+{
+       struct physdev_set_iobitmap iobitmap;
+       struct tss_struct *tss = this_cpu_ptr(&cpu_tss_rw);
+
+       native_tss_update_io_bitmap();
+
+       iobitmap.bitmap = (uint8_t *)(&tss->x86_tss) +
+                         tss->x86_tss.io_bitmap_base;
+       if (tss->x86_tss.io_bitmap_base == IO_BITMAP_OFFSET_INVALID)
+               iobitmap.nr_ports = 0;
+       else
+               iobitmap.nr_ports = IO_BITMAP_BITS;
+
+       HYPERVISOR_physdev_op(PHYSDEVOP_set_iobitmap, &iobitmap);
+}
+#endif
+
 static void xen_io_delay(void)
 {
 }
@@ -1047,6 +1069,9 @@ static const struct pv_cpu_ops xen_cpu_ops __initconst = {
        .write_idt_entry = xen_write_idt_entry,
        .load_sp0 = xen_load_sp0,
 
+#ifdef CONFIG_X86_IOPL_IOPERM
+       .update_io_bitmap = xen_update_io_bitmap,
+#endif
        .io_delay = xen_io_delay,
 
        /* Xen takes care of %gs when switching to usermode for us */
index 09b69a3ed490362a13ff290b5d46ee1b477277ad..f0ff6654af2894359e54395fe72d0ce03f207406 100644 (file)
@@ -610,12 +610,13 @@ struct bfq_group *bfq_find_set_group(struct bfq_data *bfqd,
         */
        entity = &bfqg->entity;
        for_each_entity(entity) {
-               bfqg = container_of(entity, struct bfq_group, entity);
-               if (bfqg != bfqd->root_group) {
-                       parent = bfqg_parent(bfqg);
+               struct bfq_group *curr_bfqg = container_of(entity,
+                                               struct bfq_group, entity);
+               if (curr_bfqg != bfqd->root_group) {
+                       parent = bfqg_parent(curr_bfqg);
                        if (!parent)
                                parent = bfqd->root_group;
-                       bfq_group_set_parent(bfqg, parent);
+                       bfq_group_set_parent(curr_bfqg, parent);
                }
        }
 
index 089e890ab208fd01efbda68aea4fdb47aaab1353..60dc9552ef8de53f9ba4b5b2f996e93825731275 100644 (file)
@@ -1663,12 +1663,6 @@ int kblockd_schedule_work(struct work_struct *work)
 }
 EXPORT_SYMBOL(kblockd_schedule_work);
 
-int kblockd_schedule_work_on(int cpu, struct work_struct *work)
-{
-       return queue_work_on(cpu, kblockd_workqueue, work);
-}
-EXPORT_SYMBOL(kblockd_schedule_work_on);
-
 int kblockd_mod_delayed_work_on(int cpu, struct delayed_work *dwork,
                                unsigned long delay)
 {
index a6b2082c24f8f1031d906469793270db1eb833c7..e47c8a4c83db52ea97bf6a0b4283fa65de7ec8c8 100644 (file)
@@ -5228,6 +5228,7 @@ static int binder_open(struct inode *nodp, struct file *filp)
                binder_dev = container_of(filp->private_data,
                                          struct binder_device, miscdev);
        }
+       refcount_inc(&binder_dev->ref);
        proc->context = &binder_dev->context;
        binder_alloc_init(&proc->alloc);
 
@@ -5405,6 +5406,7 @@ static int binder_node_release(struct binder_node *node, int refs)
 static void binder_deferred_release(struct binder_proc *proc)
 {
        struct binder_context *context = proc->context;
+       struct binder_device *device;
        struct rb_node *n;
        int threads, nodes, incoming_refs, outgoing_refs, active_transactions;
 
@@ -5421,6 +5423,12 @@ static void binder_deferred_release(struct binder_proc *proc)
                context->binder_context_mgr_node = NULL;
        }
        mutex_unlock(&context->context_mgr_node_lock);
+       device = container_of(proc->context, struct binder_device, context);
+       if (refcount_dec_and_test(&device->ref)) {
+               kfree(context->name);
+               kfree(device);
+       }
+       proc->context = NULL;
        binder_inner_proc_lock(proc);
        /*
         * Make sure proc stays alive after we
@@ -6077,6 +6085,7 @@ static int __init init_binder_device(const char *name)
        binder_device->miscdev.minor = MISC_DYNAMIC_MINOR;
        binder_device->miscdev.name = name;
 
+       refcount_set(&binder_device->ref, 1);
        binder_device->context.binder_context_mgr_uid = INVALID_UID;
        binder_device->context.name = name;
        mutex_init(&binder_device->context.context_mgr_node_lock);
index ae991097d14d17068f1512281704b0f04300c7d0..283d3cb9c16e5ffca25e171d7eb18b26e059f61f 100644 (file)
@@ -8,6 +8,7 @@
 #include <linux/list.h>
 #include <linux/miscdevice.h>
 #include <linux/mutex.h>
+#include <linux/refcount.h>
 #include <linux/stddef.h>
 #include <linux/types.h>
 #include <linux/uidgid.h>
@@ -33,6 +34,7 @@ struct binder_device {
        struct miscdevice miscdev;
        struct binder_context context;
        struct inode *binderfs_inode;
+       refcount_t ref;
 };
 
 /**
index e2580e5316a2f5747f5db96d3cbbd907f7442822..110e41f920c27ec1413195abb1bcc934795171f2 100644 (file)
@@ -154,6 +154,7 @@ static int binderfs_binder_device_create(struct inode *ref_inode,
        if (!name)
                goto err;
 
+       refcount_set(&device->ref, 1);
        device->binderfs_inode = inode;
        device->context.binder_context_mgr_uid = INVALID_UID;
        device->context.name = name;
@@ -257,8 +258,10 @@ static void binderfs_evict_inode(struct inode *inode)
        ida_free(&binderfs_minors, device->miscdev.minor);
        mutex_unlock(&binderfs_minors_mutex);
 
-       kfree(device->context.name);
-       kfree(device);
+       if (refcount_dec_and_test(&device->ref)) {
+               kfree(device->context.name);
+               kfree(device);
+       }
 }
 
 /**
index 42a67245643234a8fb23614feb1d7a5f60f7c0c9..dbb0f9130f42d386ad815d37377782fd2695bb8a 100644 (file)
@@ -718,6 +718,8 @@ static void __device_links_queue_sync_state(struct device *dev,
 {
        struct device_link *link;
 
+       if (!dev_has_sync_state(dev))
+               return;
        if (dev->state_synced)
                return;
 
@@ -745,25 +747,31 @@ static void __device_links_queue_sync_state(struct device *dev,
 /**
  * device_links_flush_sync_list - Call sync_state() on a list of devices
  * @list: List of devices to call sync_state() on
+ * @dont_lock_dev: Device for which lock is already held by the caller
  *
  * Calls sync_state() on all the devices that have been queued for it. This
- * function is used in conjunction with __device_links_queue_sync_state().
+ * function is used in conjunction with __device_links_queue_sync_state(). The
+ * @dont_lock_dev parameter is useful when this function is called from a
+ * context where a device lock is already held.
  */
-static void device_links_flush_sync_list(struct list_head *list)
+static void device_links_flush_sync_list(struct list_head *list,
+                                        struct device *dont_lock_dev)
 {
        struct device *dev, *tmp;
 
        list_for_each_entry_safe(dev, tmp, list, links.defer_sync) {
                list_del_init(&dev->links.defer_sync);
 
-               device_lock(dev);
+               if (dev != dont_lock_dev)
+                       device_lock(dev);
 
                if (dev->bus->sync_state)
                        dev->bus->sync_state(dev);
                else if (dev->driver && dev->driver->sync_state)
                        dev->driver->sync_state(dev);
 
-               device_unlock(dev);
+               if (dev != dont_lock_dev)
+                       device_unlock(dev);
 
                put_device(dev);
        }
@@ -801,7 +809,7 @@ void device_links_supplier_sync_state_resume(void)
 out:
        device_links_write_unlock();
 
-       device_links_flush_sync_list(&sync_list);
+       device_links_flush_sync_list(&sync_list, NULL);
 }
 
 static int sync_state_resume_initcall(void)
@@ -813,7 +821,7 @@ late_initcall(sync_state_resume_initcall);
 
 static void __device_links_supplier_defer_sync(struct device *sup)
 {
-       if (list_empty(&sup->links.defer_sync))
+       if (list_empty(&sup->links.defer_sync) && dev_has_sync_state(sup))
                list_add_tail(&sup->links.defer_sync, &deferred_sync);
 }
 
@@ -865,6 +873,11 @@ void device_links_driver_bound(struct device *dev)
                        driver_deferred_probe_add(link->consumer);
        }
 
+       if (defer_sync_state_count)
+               __device_links_supplier_defer_sync(dev);
+       else
+               __device_links_queue_sync_state(dev, &sync_list);
+
        list_for_each_entry(link, &dev->links.suppliers, c_node) {
                if (!(link->flags & DL_FLAG_MANAGED))
                        continue;
@@ -883,7 +896,7 @@ void device_links_driver_bound(struct device *dev)
 
        device_links_write_unlock();
 
-       device_links_flush_sync_list(&sync_list);
+       device_links_flush_sync_list(&sync_list, dev);
 }
 
 static void device_link_drop_managed(struct device_link *link)
index 0b081dee1e95cce1b71b76131fce56d1d1b6f3b3..de8d3543e8fe347be2ffc2f3afdedd4ef84fd35c 100644 (file)
@@ -608,6 +608,13 @@ static void software_node_release(struct kobject *kobj)
 {
        struct swnode *swnode = kobj_to_swnode(kobj);
 
+       if (swnode->parent) {
+               ida_simple_remove(&swnode->parent->child_ids, swnode->id);
+               list_del(&swnode->entry);
+       } else {
+               ida_simple_remove(&swnode_root_ids, swnode->id);
+       }
+
        if (swnode->allocated) {
                property_entries_free(swnode->node->properties);
                kfree(swnode->node);
@@ -773,13 +780,6 @@ void fwnode_remove_software_node(struct fwnode_handle *fwnode)
        if (!swnode)
                return;
 
-       if (swnode->parent) {
-               ida_simple_remove(&swnode->parent->child_ids, swnode->id);
-               list_del(&swnode->entry);
-       } else {
-               ida_simple_remove(&swnode_root_ids, swnode->id);
-       }
-
        kobject_put(&swnode->kobj);
 }
 EXPORT_SYMBOL_GPL(fwnode_remove_software_node);
index e2ad6bba2281e79067066b5a5f05bc2f7818b3cc..9df516a56bb2f80ee38f2fefecf5aac599e4fa11 100644 (file)
@@ -213,6 +213,7 @@ struct blkfront_info
        struct blk_mq_tag_set tag_set;
        struct blkfront_ring_info *rinfo;
        unsigned int nr_rings;
+       unsigned int rinfo_size;
        /* Save uncomplete reqs and bios for migration. */
        struct list_head requests;
        struct bio_list bio_list;
@@ -259,6 +260,18 @@ static int blkfront_setup_indirect(struct blkfront_ring_info *rinfo);
 static void blkfront_gather_backend_features(struct blkfront_info *info);
 static int negotiate_mq(struct blkfront_info *info);
 
+#define for_each_rinfo(info, ptr, idx)                         \
+       for ((ptr) = (info)->rinfo, (idx) = 0;                  \
+            (idx) < (info)->nr_rings;                          \
+            (idx)++, (ptr) = (void *)(ptr) + (info)->rinfo_size)
+
+static inline struct blkfront_ring_info *
+get_rinfo(const struct blkfront_info *info, unsigned int i)
+{
+       BUG_ON(i >= info->nr_rings);
+       return (void *)info->rinfo + i * info->rinfo_size;
+}
+
 static int get_id_from_freelist(struct blkfront_ring_info *rinfo)
 {
        unsigned long free = rinfo->shadow_free;
@@ -883,8 +896,7 @@ static blk_status_t blkif_queue_rq(struct blk_mq_hw_ctx *hctx,
        struct blkfront_info *info = hctx->queue->queuedata;
        struct blkfront_ring_info *rinfo = NULL;
 
-       BUG_ON(info->nr_rings <= qid);
-       rinfo = &info->rinfo[qid];
+       rinfo = get_rinfo(info, qid);
        blk_mq_start_request(qd->rq);
        spin_lock_irqsave(&rinfo->ring_lock, flags);
        if (RING_FULL(&rinfo->ring))
@@ -1181,6 +1193,7 @@ static int xlvbd_alloc_gendisk(blkif_sector_t capacity,
 static void xlvbd_release_gendisk(struct blkfront_info *info)
 {
        unsigned int minor, nr_minors, i;
+       struct blkfront_ring_info *rinfo;
 
        if (info->rq == NULL)
                return;
@@ -1188,9 +1201,7 @@ static void xlvbd_release_gendisk(struct blkfront_info *info)
        /* No more blkif_request(). */
        blk_mq_stop_hw_queues(info->rq);
 
-       for (i = 0; i < info->nr_rings; i++) {
-               struct blkfront_ring_info *rinfo = &info->rinfo[i];
-
+       for_each_rinfo(info, rinfo, i) {
                /* No more gnttab callback work. */
                gnttab_cancel_free_callback(&rinfo->callback);
 
@@ -1339,6 +1350,7 @@ static void blkif_free_ring(struct blkfront_ring_info *rinfo)
 static void blkif_free(struct blkfront_info *info, int suspend)
 {
        unsigned int i;
+       struct blkfront_ring_info *rinfo;
 
        /* Prevent new requests being issued until we fix things up. */
        info->connected = suspend ?
@@ -1347,8 +1359,8 @@ static void blkif_free(struct blkfront_info *info, int suspend)
        if (info->rq)
                blk_mq_stop_hw_queues(info->rq);
 
-       for (i = 0; i < info->nr_rings; i++)
-               blkif_free_ring(&info->rinfo[i]);
+       for_each_rinfo(info, rinfo, i)
+               blkif_free_ring(rinfo);
 
        kvfree(info->rinfo);
        info->rinfo = NULL;
@@ -1775,6 +1787,7 @@ static int talk_to_blkback(struct xenbus_device *dev,
        int err;
        unsigned int i, max_page_order;
        unsigned int ring_page_order;
+       struct blkfront_ring_info *rinfo;
 
        if (!info)
                return -ENODEV;
@@ -1788,9 +1801,7 @@ static int talk_to_blkback(struct xenbus_device *dev,
        if (err)
                goto destroy_blkring;
 
-       for (i = 0; i < info->nr_rings; i++) {
-               struct blkfront_ring_info *rinfo = &info->rinfo[i];
-
+       for_each_rinfo(info, rinfo, i) {
                /* Create shared ring, alloc event channel. */
                err = setup_blkring(dev, rinfo);
                if (err)
@@ -1815,7 +1826,7 @@ static int talk_to_blkback(struct xenbus_device *dev,
 
        /* We already got the number of queues/rings in _probe */
        if (info->nr_rings == 1) {
-               err = write_per_ring_nodes(xbt, &info->rinfo[0], dev->nodename);
+               err = write_per_ring_nodes(xbt, info->rinfo, dev->nodename);
                if (err)
                        goto destroy_blkring;
        } else {
@@ -1837,10 +1848,10 @@ static int talk_to_blkback(struct xenbus_device *dev,
                        goto abort_transaction;
                }
 
-               for (i = 0; i < info->nr_rings; i++) {
+               for_each_rinfo(info, rinfo, i) {
                        memset(path, 0, pathsize);
                        snprintf(path, pathsize, "%s/queue-%u", dev->nodename, i);
-                       err = write_per_ring_nodes(xbt, &info->rinfo[i], path);
+                       err = write_per_ring_nodes(xbt, rinfo, path);
                        if (err) {
                                kfree(path);
                                goto destroy_blkring;
@@ -1868,9 +1879,8 @@ static int talk_to_blkback(struct xenbus_device *dev,
                goto destroy_blkring;
        }
 
-       for (i = 0; i < info->nr_rings; i++) {
+       for_each_rinfo(info, rinfo, i) {
                unsigned int j;
-               struct blkfront_ring_info *rinfo = &info->rinfo[i];
 
                for (j = 0; j < BLK_RING_SIZE(info); j++)
                        rinfo->shadow[j].req.u.rw.id = j + 1;
@@ -1900,6 +1910,7 @@ static int negotiate_mq(struct blkfront_info *info)
 {
        unsigned int backend_max_queues;
        unsigned int i;
+       struct blkfront_ring_info *rinfo;
 
        BUG_ON(info->nr_rings);
 
@@ -1911,20 +1922,16 @@ static int negotiate_mq(struct blkfront_info *info)
        if (!info->nr_rings)
                info->nr_rings = 1;
 
-       info->rinfo = kvcalloc(info->nr_rings,
-                              struct_size(info->rinfo, shadow,
-                                          BLK_RING_SIZE(info)),
-                              GFP_KERNEL);
+       info->rinfo_size = struct_size(info->rinfo, shadow,
+                                      BLK_RING_SIZE(info));
+       info->rinfo = kvcalloc(info->nr_rings, info->rinfo_size, GFP_KERNEL);
        if (!info->rinfo) {
                xenbus_dev_fatal(info->xbdev, -ENOMEM, "allocating ring_info structure");
                info->nr_rings = 0;
                return -ENOMEM;
        }
 
-       for (i = 0; i < info->nr_rings; i++) {
-               struct blkfront_ring_info *rinfo;
-
-               rinfo = &info->rinfo[i];
+       for_each_rinfo(info, rinfo, i) {
                INIT_LIST_HEAD(&rinfo->indirect_pages);
                INIT_LIST_HEAD(&rinfo->grants);
                rinfo->dev_info = info;
@@ -2017,6 +2024,7 @@ static int blkif_recover(struct blkfront_info *info)
        int rc;
        struct bio *bio;
        unsigned int segs;
+       struct blkfront_ring_info *rinfo;
 
        blkfront_gather_backend_features(info);
        /* Reset limits changed by blk_mq_update_nr_hw_queues(). */
@@ -2024,9 +2032,7 @@ static int blkif_recover(struct blkfront_info *info)
        segs = info->max_indirect_segments ? : BLKIF_MAX_SEGMENTS_PER_REQUEST;
        blk_queue_max_segments(info->rq, segs / GRANTS_PER_PSEG);
 
-       for (r_index = 0; r_index < info->nr_rings; r_index++) {
-               struct blkfront_ring_info *rinfo = &info->rinfo[r_index];
-
+       for_each_rinfo(info, rinfo, r_index) {
                rc = blkfront_setup_indirect(rinfo);
                if (rc)
                        return rc;
@@ -2036,10 +2042,7 @@ static int blkif_recover(struct blkfront_info *info)
        /* Now safe for us to use the shared ring */
        info->connected = BLKIF_STATE_CONNECTED;
 
-       for (r_index = 0; r_index < info->nr_rings; r_index++) {
-               struct blkfront_ring_info *rinfo;
-
-               rinfo = &info->rinfo[r_index];
+       for_each_rinfo(info, rinfo, r_index) {
                /* Kick any other new requests queued since we resumed */
                kick_pending_request_queues(rinfo);
        }
@@ -2072,13 +2075,13 @@ static int blkfront_resume(struct xenbus_device *dev)
        struct blkfront_info *info = dev_get_drvdata(&dev->dev);
        int err = 0;
        unsigned int i, j;
+       struct blkfront_ring_info *rinfo;
 
        dev_dbg(&dev->dev, "blkfront_resume: %s\n", dev->nodename);
 
        bio_list_init(&info->bio_list);
        INIT_LIST_HEAD(&info->requests);
-       for (i = 0; i < info->nr_rings; i++) {
-               struct blkfront_ring_info *rinfo = &info->rinfo[i];
+       for_each_rinfo(info, rinfo, i) {
                struct bio_list merge_bio;
                struct blk_shadow *shadow = rinfo->shadow;
 
@@ -2337,6 +2340,7 @@ static void blkfront_connect(struct blkfront_info *info)
        unsigned int binfo;
        char *envp[] = { "RESIZE=1", NULL };
        int err, i;
+       struct blkfront_ring_info *rinfo;
 
        switch (info->connected) {
        case BLKIF_STATE_CONNECTED:
@@ -2394,8 +2398,8 @@ static void blkfront_connect(struct blkfront_info *info)
                                                    "physical-sector-size",
                                                    sector_size);
        blkfront_gather_backend_features(info);
-       for (i = 0; i < info->nr_rings; i++) {
-               err = blkfront_setup_indirect(&info->rinfo[i]);
+       for_each_rinfo(info, rinfo, i) {
+               err = blkfront_setup_indirect(rinfo);
                if (err) {
                        xenbus_dev_fatal(info->xbdev, err, "setup_indirect at %s",
                                         info->xbdev->otherend);
@@ -2416,8 +2420,8 @@ static void blkfront_connect(struct blkfront_info *info)
 
        /* Kick pending requests. */
        info->connected = BLKIF_STATE_CONNECTED;
-       for (i = 0; i < info->nr_rings; i++)
-               kick_pending_request_queues(&info->rinfo[i]);
+       for_each_rinfo(info, rinfo, i)
+               kick_pending_request_queues(rinfo);
 
        device_add_disk(&info->xbdev->dev, info->gd, NULL);
 
@@ -2652,9 +2656,9 @@ static void purge_persistent_grants(struct blkfront_info *info)
 {
        unsigned int i;
        unsigned long flags;
+       struct blkfront_ring_info *rinfo;
 
-       for (i = 0; i < info->nr_rings; i++) {
-               struct blkfront_ring_info *rinfo = &info->rinfo[i];
+       for_each_rinfo(info, rinfo, i) {
                struct grant *gnt_list_entry, *tmp;
 
                spin_lock_irqsave(&rinfo->ring_lock, flags);
index f702c85c81b657ec5e0dfe0712ab32e309028fa0..6113fc0a52aeba63be818aa356fd421d03d47443 100644 (file)
@@ -1400,7 +1400,7 @@ static void sysc_init_revision_quirks(struct sysc *ddata)
 }
 
 /* 1-wire needs module's internal clocks enabled for reset */
-static void sysc_clk_enable_quirk_hdq1w(struct sysc *ddata)
+static void sysc_pre_reset_quirk_hdq1w(struct sysc *ddata)
 {
        int offset = 0x0c;      /* HDQ_CTRL_STATUS */
        u16 val;
@@ -1488,7 +1488,7 @@ static void sysc_init_module_quirks(struct sysc *ddata)
                return;
 
        if (ddata->cfg.quirks & SYSC_MODULE_QUIRK_HDQ1W) {
-               ddata->clk_enable_quirk = sysc_clk_enable_quirk_hdq1w;
+               ddata->clk_disable_quirk = sysc_pre_reset_quirk_hdq1w;
 
                return;
        }
index e51d836afcc7765d37ad5b084404aeebd13a8d69..1092d4ce723e436e7f3971bafcbeb084e505b12f 100644 (file)
@@ -1947,8 +1947,6 @@ static void dma_tc_handle(struct coh901318_chan *cohc)
                return;
        }
 
-       spin_lock(&cohc->lock);
-
        /*
         * When we reach this point, at least one queue item
         * should have been moved over from cohc->queue to
@@ -1969,8 +1967,6 @@ static void dma_tc_handle(struct coh901318_chan *cohc)
        if (coh901318_queue_start(cohc) == NULL)
                cohc->busy = 0;
 
-       spin_unlock(&cohc->lock);
-
        /*
         * This tasklet will remove items from cohc->active
         * and thus terminates them.
index 1d7347825b95a8a21d0fec1bda397a6093509ffc..df47be612ebb09f5b7c25fb1abb6767be190c093 100644 (file)
@@ -204,6 +204,7 @@ static int idxd_wq_cdev_dev_setup(struct idxd_wq *wq)
        minor = ida_simple_get(&cdev_ctx->minor_ida, 0, MINORMASK, GFP_KERNEL);
        if (minor < 0) {
                rc = minor;
+               kfree(dev);
                goto ida_err;
        }
 
@@ -212,7 +213,6 @@ static int idxd_wq_cdev_dev_setup(struct idxd_wq *wq)
        rc = device_register(dev);
        if (rc < 0) {
                dev_err(&idxd->pdev->dev, "device register failed\n");
-               put_device(dev);
                goto dev_reg_err;
        }
        idxd_cdev->minor = minor;
@@ -221,8 +221,8 @@ static int idxd_wq_cdev_dev_setup(struct idxd_wq *wq)
 
  dev_reg_err:
        ida_simple_remove(&cdev_ctx->minor_ida, MINOR(dev->devt));
+       put_device(dev);
  ida_err:
-       kfree(dev);
        idxd_cdev->dev = NULL;
        return rc;
 }
index 6d907fe150aa4d508337b6f86d38da237f456318..6ca6e520a2fa4943e2b895f1816408de77d6c6e2 100644 (file)
@@ -124,6 +124,7 @@ static int idxd_config_bus_probe(struct device *dev)
                rc = idxd_device_config(idxd);
                if (rc < 0) {
                        spin_unlock_irqrestore(&idxd->dev_lock, flags);
+                       module_put(THIS_MODULE);
                        dev_warn(dev, "Device config failed: %d\n", rc);
                        return rc;
                }
@@ -132,6 +133,7 @@ static int idxd_config_bus_probe(struct device *dev)
                rc = idxd_device_enable(idxd);
                if (rc < 0) {
                        spin_unlock_irqrestore(&idxd->dev_lock, flags);
+                       module_put(THIS_MODULE);
                        dev_warn(dev, "Device enable failed: %d\n", rc);
                        return rc;
                }
@@ -142,6 +144,7 @@ static int idxd_config_bus_probe(struct device *dev)
                rc = idxd_register_dma_device(idxd);
                if (rc < 0) {
                        spin_unlock_irqrestore(&idxd->dev_lock, flags);
+                       module_put(THIS_MODULE);
                        dev_dbg(dev, "Failed to register dmaengine device\n");
                        return rc;
                }
@@ -516,7 +519,7 @@ static ssize_t group_tokens_reserved_store(struct device *dev,
        if (val > idxd->max_tokens)
                return -EINVAL;
 
-       if (val > idxd->nr_tokens)
+       if (val > idxd->nr_tokens + group->tokens_reserved)
                return -EINVAL;
 
        group->tokens_reserved = val;
@@ -901,6 +904,20 @@ static ssize_t wq_size_show(struct device *dev, struct device_attribute *attr,
        return sprintf(buf, "%u\n", wq->size);
 }
 
+static int total_claimed_wq_size(struct idxd_device *idxd)
+{
+       int i;
+       int wq_size = 0;
+
+       for (i = 0; i < idxd->max_wqs; i++) {
+               struct idxd_wq *wq = &idxd->wqs[i];
+
+               wq_size += wq->size;
+       }
+
+       return wq_size;
+}
+
 static ssize_t wq_size_store(struct device *dev,
                             struct device_attribute *attr, const char *buf,
                             size_t count)
@@ -920,7 +937,7 @@ static ssize_t wq_size_store(struct device *dev,
        if (wq->state != IDXD_WQ_DISABLED)
                return -EPERM;
 
-       if (size > idxd->max_wq_size)
+       if (size + total_claimed_wq_size(idxd) - wq->size > idxd->max_wq_size)
                return -EINVAL;
 
        wq->size = size;
@@ -999,12 +1016,14 @@ static ssize_t wq_type_store(struct device *dev,
                return -EPERM;
 
        old_type = wq->type;
-       if (sysfs_streq(buf, idxd_wq_type_names[IDXD_WQT_KERNEL]))
+       if (sysfs_streq(buf, idxd_wq_type_names[IDXD_WQT_NONE]))
+               wq->type = IDXD_WQT_NONE;
+       else if (sysfs_streq(buf, idxd_wq_type_names[IDXD_WQT_KERNEL]))
                wq->type = IDXD_WQT_KERNEL;
        else if (sysfs_streq(buf, idxd_wq_type_names[IDXD_WQT_USER]))
                wq->type = IDXD_WQT_USER;
        else
-               wq->type = IDXD_WQT_NONE;
+               return -EINVAL;
 
        /* If we are changing queue type, clear the name */
        if (wq->type != old_type)
index 066b21a3223261f26a73a71266d3b0a3e67bb51d..4d4477df4ede751a9b4277833d851dc48fe8641f 100644 (file)
@@ -1331,13 +1331,14 @@ static void sdma_free_chan_resources(struct dma_chan *chan)
 
        sdma_channel_synchronize(chan);
 
-       if (sdmac->event_id0)
+       if (sdmac->event_id0 >= 0)
                sdma_event_disable(sdmac, sdmac->event_id0);
        if (sdmac->event_id1)
                sdma_event_disable(sdmac, sdmac->event_id1);
 
        sdmac->event_id0 = 0;
        sdmac->event_id1 = 0;
+       sdmac->context_loaded = false;
 
        sdma_set_channel_priority(sdmac, 0);
 
@@ -1631,7 +1632,7 @@ static int sdma_config(struct dma_chan *chan,
        memcpy(&sdmac->slave_config, dmaengine_cfg, sizeof(*dmaengine_cfg));
 
        /* Set ENBLn earlier to make sure dma request triggered after that */
-       if (sdmac->event_id0) {
+       if (sdmac->event_id0 >= 0) {
                if (sdmac->event_id0 >= sdmac->sdma->drvdata->num_events)
                        return -EINVAL;
                sdma_event_enable(sdmac, sdmac->event_id0);
index 3a45079d11ecff40db8ea5b1824c55894a7429e7..4a750e29bfb533953584bc101f6e5eec99cc0239 100644 (file)
@@ -281,7 +281,7 @@ static struct tegra_dma_desc *tegra_dma_desc_get(
 
        /* Do not allocate if desc are waiting for ack */
        list_for_each_entry(dma_desc, &tdc->free_dma_desc, node) {
-               if (async_tx_test_ack(&dma_desc->txd)) {
+               if (async_tx_test_ack(&dma_desc->txd) && !dma_desc->cb_count) {
                        list_del(&dma_desc->node);
                        spin_unlock_irqrestore(&tdc->lock, flags);
                        dma_desc->txd.flags = 0;
@@ -756,10 +756,6 @@ static int tegra_dma_terminate_all(struct dma_chan *dc)
        bool was_busy;
 
        spin_lock_irqsave(&tdc->lock, flags);
-       if (list_empty(&tdc->pending_sg_req)) {
-               spin_unlock_irqrestore(&tdc->lock, flags);
-               return 0;
-       }
 
        if (!tdc->busy)
                goto skip_dma_stop;
index ea79c2df28e01b628a8ac08b5af33c7d50a931d1..0536866a58cee788374f63cad40259b122541474 100644 (file)
@@ -5,6 +5,7 @@
  */
 
 #include <linux/kernel.h>
+#include <linux/delay.h>
 #include <linux/dmaengine.h>
 #include <linux/dma-mapping.h>
 #include <linux/dmapool.h>
@@ -96,6 +97,24 @@ struct udma_match_data {
        u32 level_start_idx[];
 };
 
+struct udma_hwdesc {
+       size_t cppi5_desc_size;
+       void *cppi5_desc_vaddr;
+       dma_addr_t cppi5_desc_paddr;
+
+       /* TR descriptor internal pointers */
+       void *tr_req_base;
+       struct cppi5_tr_resp_t *tr_resp_base;
+};
+
+struct udma_rx_flush {
+       struct udma_hwdesc hwdescs[2];
+
+       size_t buffer_size;
+       void *buffer_vaddr;
+       dma_addr_t buffer_paddr;
+};
+
 struct udma_dev {
        struct dma_device ddev;
        struct device *dev;
@@ -112,6 +131,8 @@ struct udma_dev {
        struct list_head desc_to_purge;
        spinlock_t lock;
 
+       struct udma_rx_flush rx_flush;
+
        int tchan_cnt;
        int echan_cnt;
        int rchan_cnt;
@@ -130,16 +151,6 @@ struct udma_dev {
        u32 psil_base;
 };
 
-struct udma_hwdesc {
-       size_t cppi5_desc_size;
-       void *cppi5_desc_vaddr;
-       dma_addr_t cppi5_desc_paddr;
-
-       /* TR descriptor internal pointers */
-       void *tr_req_base;
-       struct cppi5_tr_resp_t *tr_resp_base;
-};
-
 struct udma_desc {
        struct virt_dma_desc vd;
 
@@ -169,7 +180,7 @@ enum udma_chan_state {
 
 struct udma_tx_drain {
        struct delayed_work work;
-       unsigned long jiffie;
+       ktime_t tstamp;
        u32 residue;
 };
 
@@ -502,7 +513,7 @@ static bool udma_is_chan_paused(struct udma_chan *uc)
 {
        u32 val, pause_mask;
 
-       switch (uc->desc->dir) {
+       switch (uc->config.dir) {
        case DMA_DEV_TO_MEM:
                val = udma_rchanrt_read(uc->rchan,
                                        UDMA_RCHAN_RT_PEER_RT_EN_REG);
@@ -551,12 +562,17 @@ static void udma_sync_for_device(struct udma_chan *uc, int idx)
        }
 }
 
+static inline dma_addr_t udma_get_rx_flush_hwdesc_paddr(struct udma_chan *uc)
+{
+       return uc->ud->rx_flush.hwdescs[uc->config.pkt_mode].cppi5_desc_paddr;
+}
+
 static int udma_push_to_ring(struct udma_chan *uc, int idx)
 {
        struct udma_desc *d = uc->desc;
-
        struct k3_ring *ring = NULL;
-       int ret = -EINVAL;
+       dma_addr_t paddr;
+       int ret;
 
        switch (uc->config.dir) {
        case DMA_DEV_TO_MEM:
@@ -567,21 +583,37 @@ static int udma_push_to_ring(struct udma_chan *uc, int idx)
                ring = uc->tchan->t_ring;
                break;
        default:
-               break;
+               return -EINVAL;
        }
 
-       if (ring) {
-               dma_addr_t desc_addr = udma_curr_cppi5_desc_paddr(d, idx);
+       /* RX flush packet: idx == -1 is only passed in case of DEV_TO_MEM */
+       if (idx == -1) {
+               paddr = udma_get_rx_flush_hwdesc_paddr(uc);
+       } else {
+               paddr = udma_curr_cppi5_desc_paddr(d, idx);
 
                wmb(); /* Ensure that writes are not moved over this point */
                udma_sync_for_device(uc, idx);
-               ret = k3_ringacc_ring_push(ring, &desc_addr);
-               uc->in_ring_cnt++;
        }
 
+       ret = k3_ringacc_ring_push(ring, &paddr);
+       if (!ret)
+               uc->in_ring_cnt++;
+
        return ret;
 }
 
+static bool udma_desc_is_rx_flush(struct udma_chan *uc, dma_addr_t addr)
+{
+       if (uc->config.dir != DMA_DEV_TO_MEM)
+               return false;
+
+       if (addr == udma_get_rx_flush_hwdesc_paddr(uc))
+               return true;
+
+       return false;
+}
+
 static int udma_pop_from_ring(struct udma_chan *uc, dma_addr_t *addr)
 {
        struct k3_ring *ring = NULL;
@@ -610,6 +642,10 @@ static int udma_pop_from_ring(struct udma_chan *uc, dma_addr_t *addr)
                if (cppi5_desc_is_tdcm(*addr))
                        return ret;
 
+               /* Check for flush descriptor */
+               if (udma_desc_is_rx_flush(uc, *addr))
+                       return -ENOENT;
+
                d = udma_udma_desc_from_paddr(uc, *addr);
 
                if (d)
@@ -890,6 +926,9 @@ static int udma_stop(struct udma_chan *uc)
 
        switch (uc->config.dir) {
        case DMA_DEV_TO_MEM:
+               if (!uc->cyclic && !uc->desc)
+                       udma_push_to_ring(uc, -1);
+
                udma_rchanrt_write(uc->rchan, UDMA_RCHAN_RT_PEER_RT_EN_REG,
                                   UDMA_PEER_RT_EN_ENABLE |
                                   UDMA_PEER_RT_EN_TEARDOWN);
@@ -946,9 +985,10 @@ static bool udma_is_desc_really_done(struct udma_chan *uc, struct udma_desc *d)
        peer_bcnt = udma_tchanrt_read(uc->tchan, UDMA_TCHAN_RT_PEER_BCNT_REG);
        bcnt = udma_tchanrt_read(uc->tchan, UDMA_TCHAN_RT_BCNT_REG);
 
+       /* Transfer is incomplete, store current residue and time stamp */
        if (peer_bcnt < bcnt) {
                uc->tx_drain.residue = bcnt - peer_bcnt;
-               uc->tx_drain.jiffie = jiffies;
+               uc->tx_drain.tstamp = ktime_get();
                return false;
        }
 
@@ -961,35 +1001,59 @@ static void udma_check_tx_completion(struct work_struct *work)
                                            tx_drain.work.work);
        bool desc_done = true;
        u32 residue_diff;
-       unsigned long jiffie_diff, delay;
+       ktime_t time_diff;
+       unsigned long delay;
+
+       while (1) {
+               if (uc->desc) {
+                       /* Get previous residue and time stamp */
+                       residue_diff = uc->tx_drain.residue;
+                       time_diff = uc->tx_drain.tstamp;
+                       /*
+                        * Get current residue and time stamp or see if
+                        * transfer is complete
+                        */
+                       desc_done = udma_is_desc_really_done(uc, uc->desc);
+               }
 
-       if (uc->desc) {
-               residue_diff = uc->tx_drain.residue;
-               jiffie_diff = uc->tx_drain.jiffie;
-               desc_done = udma_is_desc_really_done(uc, uc->desc);
-       }
-
-       if (!desc_done) {
-               jiffie_diff = uc->tx_drain.jiffie - jiffie_diff;
-               residue_diff -= uc->tx_drain.residue;
-               if (residue_diff) {
-                       /* Try to guess when we should check next time */
-                       residue_diff /= jiffie_diff;
-                       delay = uc->tx_drain.residue / residue_diff / 3;
-                       if (jiffies_to_msecs(delay) < 5)
-                               delay = 0;
-               } else {
-                       /* No progress, check again in 1 second  */
-                       delay = HZ;
+               if (!desc_done) {
+                       /*
+                        * Find the time delta and residue delta w.r.t
+                        * previous poll
+                        */
+                       time_diff = ktime_sub(uc->tx_drain.tstamp,
+                                             time_diff) + 1;
+                       residue_diff -= uc->tx_drain.residue;
+                       if (residue_diff) {
+                               /*
+                                * Try to guess when we should check
+                                * next time by calculating rate at
+                                * which data is being drained at the
+                                * peer device
+                                */
+                               delay = (time_diff / residue_diff) *
+                                       uc->tx_drain.residue;
+                       } else {
+                               /* No progress, check again in 1 second  */
+                               schedule_delayed_work(&uc->tx_drain.work, HZ);
+                               break;
+                       }
+
+                       usleep_range(ktime_to_us(delay),
+                                    ktime_to_us(delay) + 10);
+                       continue;
                }
 
-               schedule_delayed_work(&uc->tx_drain.work, delay);
-       } else if (uc->desc) {
-               struct udma_desc *d = uc->desc;
+               if (uc->desc) {
+                       struct udma_desc *d = uc->desc;
 
-               uc->bcnt += d->residue;
-               udma_start(uc);
-               vchan_cookie_complete(&d->vd);
+                       uc->bcnt += d->residue;
+                       udma_start(uc);
+                       vchan_cookie_complete(&d->vd);
+                       break;
+               }
+
+               break;
        }
 }
 
@@ -1033,29 +1097,27 @@ static irqreturn_t udma_ring_irq_handler(int irq, void *data)
                        goto out;
                }
 
-               if (uc->cyclic) {
-                       /* push the descriptor back to the ring */
-                       if (d == uc->desc) {
+               if (d == uc->desc) {
+                       /* active descriptor */
+                       if (uc->cyclic) {
                                udma_cyclic_packet_elapsed(uc);
                                vchan_cyclic_callback(&d->vd);
-                       }
-               } else {
-                       bool desc_done = false;
-
-                       if (d == uc->desc) {
-                               desc_done = udma_is_desc_really_done(uc, d);
-
-                               if (desc_done) {
+                       } else {
+                               if (udma_is_desc_really_done(uc, d)) {
                                        uc->bcnt += d->residue;
                                        udma_start(uc);
+                                       vchan_cookie_complete(&d->vd);
                                } else {
                                        schedule_delayed_work(&uc->tx_drain.work,
                                                              0);
                                }
                        }
-
-                       if (desc_done)
-                               vchan_cookie_complete(&d->vd);
+               } else {
+                       /*
+                        * terminated descriptor, mark the descriptor as
+                        * completed to update the channel's cookie marker
+                        */
+                       dma_cookie_complete(&d->vd.tx);
                }
        }
 out:
@@ -1965,36 +2027,81 @@ static struct udma_desc *udma_alloc_tr_desc(struct udma_chan *uc,
        return d;
 }
 
+/**
+ * udma_get_tr_counters - calculate TR counters for a given length
+ * @len: Length of the trasnfer
+ * @align_to: Preferred alignment
+ * @tr0_cnt0: First TR icnt0
+ * @tr0_cnt1: First TR icnt1
+ * @tr1_cnt0: Second (if used) TR icnt0
+ *
+ * For len < SZ_64K only one TR is enough, tr1_cnt0 is not updated
+ * For len >= SZ_64K two TRs are used in a simple way:
+ * First TR: SZ_64K-alignment blocks (tr0_cnt0, tr0_cnt1)
+ * Second TR: the remaining length (tr1_cnt0)
+ *
+ * Returns the number of TRs the length needs (1 or 2)
+ * -EINVAL if the length can not be supported
+ */
+static int udma_get_tr_counters(size_t len, unsigned long align_to,
+                               u16 *tr0_cnt0, u16 *tr0_cnt1, u16 *tr1_cnt0)
+{
+       if (len < SZ_64K) {
+               *tr0_cnt0 = len;
+               *tr0_cnt1 = 1;
+
+               return 1;
+       }
+
+       if (align_to > 3)
+               align_to = 3;
+
+realign:
+       *tr0_cnt0 = SZ_64K - BIT(align_to);
+       if (len / *tr0_cnt0 >= SZ_64K) {
+               if (align_to) {
+                       align_to--;
+                       goto realign;
+               }
+               return -EINVAL;
+       }
+
+       *tr0_cnt1 = len / *tr0_cnt0;
+       *tr1_cnt0 = len % *tr0_cnt0;
+
+       return 2;
+}
+
 static struct udma_desc *
 udma_prep_slave_sg_tr(struct udma_chan *uc, struct scatterlist *sgl,
                      unsigned int sglen, enum dma_transfer_direction dir,
                      unsigned long tx_flags, void *context)
 {
-       enum dma_slave_buswidth dev_width;
        struct scatterlist *sgent;
        struct udma_desc *d;
-       size_t tr_size;
        struct cppi5_tr_type1_t *tr_req = NULL;
+       u16 tr0_cnt0, tr0_cnt1, tr1_cnt0;
        unsigned int i;
-       u32 burst;
+       size_t tr_size;
+       int num_tr = 0;
+       int tr_idx = 0;
 
-       if (dir == DMA_DEV_TO_MEM) {
-               dev_width = uc->cfg.src_addr_width;
-               burst = uc->cfg.src_maxburst;
-       } else if (dir == DMA_MEM_TO_DEV) {
-               dev_width = uc->cfg.dst_addr_width;
-               burst = uc->cfg.dst_maxburst;
-       } else {
-               dev_err(uc->ud->dev, "%s: bad direction?\n", __func__);
+       if (!is_slave_direction(dir)) {
+               dev_err(uc->ud->dev, "Only slave cyclic is supported\n");
                return NULL;
        }
 
-       if (!burst)
-               burst = 1;
+       /* estimate the number of TRs we will need */
+       for_each_sg(sgl, sgent, sglen, i) {
+               if (sg_dma_len(sgent) < SZ_64K)
+                       num_tr++;
+               else
+                       num_tr += 2;
+       }
 
        /* Now allocate and setup the descriptor. */
        tr_size = sizeof(struct cppi5_tr_type1_t);
-       d = udma_alloc_tr_desc(uc, tr_size, sglen, dir);
+       d = udma_alloc_tr_desc(uc, tr_size, num_tr, dir);
        if (!d)
                return NULL;
 
@@ -2002,19 +2109,46 @@ udma_prep_slave_sg_tr(struct udma_chan *uc, struct scatterlist *sgl,
 
        tr_req = d->hwdesc[0].tr_req_base;
        for_each_sg(sgl, sgent, sglen, i) {
-               d->residue += sg_dma_len(sgent);
+               dma_addr_t sg_addr = sg_dma_address(sgent);
+
+               num_tr = udma_get_tr_counters(sg_dma_len(sgent), __ffs(sg_addr),
+                                             &tr0_cnt0, &tr0_cnt1, &tr1_cnt0);
+               if (num_tr < 0) {
+                       dev_err(uc->ud->dev, "size %u is not supported\n",
+                               sg_dma_len(sgent));
+                       udma_free_hwdesc(uc, d);
+                       kfree(d);
+                       return NULL;
+               }
 
                cppi5_tr_init(&tr_req[i].flags, CPPI5_TR_TYPE1, false, false,
                              CPPI5_TR_EVENT_SIZE_COMPLETION, 0);
                cppi5_tr_csf_set(&tr_req[i].flags, CPPI5_TR_CSF_SUPR_EVT);
 
-               tr_req[i].addr = sg_dma_address(sgent);
-               tr_req[i].icnt0 = burst * dev_width;
-               tr_req[i].dim1 = burst * dev_width;
-               tr_req[i].icnt1 = sg_dma_len(sgent) / tr_req[i].icnt0;
+               tr_req[tr_idx].addr = sg_addr;
+               tr_req[tr_idx].icnt0 = tr0_cnt0;
+               tr_req[tr_idx].icnt1 = tr0_cnt1;
+               tr_req[tr_idx].dim1 = tr0_cnt0;
+               tr_idx++;
+
+               if (num_tr == 2) {
+                       cppi5_tr_init(&tr_req[tr_idx].flags, CPPI5_TR_TYPE1,
+                                     false, false,
+                                     CPPI5_TR_EVENT_SIZE_COMPLETION, 0);
+                       cppi5_tr_csf_set(&tr_req[tr_idx].flags,
+                                        CPPI5_TR_CSF_SUPR_EVT);
+
+                       tr_req[tr_idx].addr = sg_addr + tr0_cnt1 * tr0_cnt0;
+                       tr_req[tr_idx].icnt0 = tr1_cnt0;
+                       tr_req[tr_idx].icnt1 = 1;
+                       tr_req[tr_idx].dim1 = tr1_cnt0;
+                       tr_idx++;
+               }
+
+               d->residue += sg_dma_len(sgent);
        }
 
-       cppi5_tr_csf_set(&tr_req[i - 1].flags, CPPI5_TR_CSF_EOP);
+       cppi5_tr_csf_set(&tr_req[tr_idx - 1].flags, CPPI5_TR_CSF_EOP);
 
        return d;
 }
@@ -2319,47 +2453,66 @@ udma_prep_dma_cyclic_tr(struct udma_chan *uc, dma_addr_t buf_addr,
                        size_t buf_len, size_t period_len,
                        enum dma_transfer_direction dir, unsigned long flags)
 {
-       enum dma_slave_buswidth dev_width;
        struct udma_desc *d;
-       size_t tr_size;
+       size_t tr_size, period_addr;
        struct cppi5_tr_type1_t *tr_req;
-       unsigned int i;
        unsigned int periods = buf_len / period_len;
-       u32 burst;
+       u16 tr0_cnt0, tr0_cnt1, tr1_cnt0;
+       unsigned int i;
+       int num_tr;
 
-       if (dir == DMA_DEV_TO_MEM) {
-               dev_width = uc->cfg.src_addr_width;
-               burst = uc->cfg.src_maxburst;
-       } else if (dir == DMA_MEM_TO_DEV) {
-               dev_width = uc->cfg.dst_addr_width;
-               burst = uc->cfg.dst_maxburst;
-       } else {
-               dev_err(uc->ud->dev, "%s: bad direction?\n", __func__);
+       if (!is_slave_direction(dir)) {
+               dev_err(uc->ud->dev, "Only slave cyclic is supported\n");
                return NULL;
        }
 
-       if (!burst)
-               burst = 1;
+       num_tr = udma_get_tr_counters(period_len, __ffs(buf_addr), &tr0_cnt0,
+                                     &tr0_cnt1, &tr1_cnt0);
+       if (num_tr < 0) {
+               dev_err(uc->ud->dev, "size %zu is not supported\n",
+                       period_len);
+               return NULL;
+       }
 
        /* Now allocate and setup the descriptor. */
        tr_size = sizeof(struct cppi5_tr_type1_t);
-       d = udma_alloc_tr_desc(uc, tr_size, periods, dir);
+       d = udma_alloc_tr_desc(uc, tr_size, periods * num_tr, dir);
        if (!d)
                return NULL;
 
        tr_req = d->hwdesc[0].tr_req_base;
+       period_addr = buf_addr;
        for (i = 0; i < periods; i++) {
-               cppi5_tr_init(&tr_req[i].flags, CPPI5_TR_TYPE1, false, false,
-                             CPPI5_TR_EVENT_SIZE_COMPLETION, 0);
+               int tr_idx = i * num_tr;
 
-               tr_req[i].addr = buf_addr + period_len * i;
-               tr_req[i].icnt0 = dev_width;
-               tr_req[i].icnt1 = period_len / dev_width;
-               tr_req[i].dim1 = dev_width;
+               cppi5_tr_init(&tr_req[tr_idx].flags, CPPI5_TR_TYPE1, false,
+                             false, CPPI5_TR_EVENT_SIZE_COMPLETION, 0);
+
+               tr_req[tr_idx].addr = period_addr;
+               tr_req[tr_idx].icnt0 = tr0_cnt0;
+               tr_req[tr_idx].icnt1 = tr0_cnt1;
+               tr_req[tr_idx].dim1 = tr0_cnt0;
+
+               if (num_tr == 2) {
+                       cppi5_tr_csf_set(&tr_req[tr_idx].flags,
+                                        CPPI5_TR_CSF_SUPR_EVT);
+                       tr_idx++;
+
+                       cppi5_tr_init(&tr_req[tr_idx].flags, CPPI5_TR_TYPE1,
+                                     false, false,
+                                     CPPI5_TR_EVENT_SIZE_COMPLETION, 0);
+
+                       tr_req[tr_idx].addr = period_addr + tr0_cnt1 * tr0_cnt0;
+                       tr_req[tr_idx].icnt0 = tr1_cnt0;
+                       tr_req[tr_idx].icnt1 = 1;
+                       tr_req[tr_idx].dim1 = tr1_cnt0;
+               }
 
                if (!(flags & DMA_PREP_INTERRUPT))
-                       cppi5_tr_csf_set(&tr_req[i].flags,
+                       cppi5_tr_csf_set(&tr_req[tr_idx].flags,
                                         CPPI5_TR_CSF_SUPR_EVT);
+
+               period_addr += period_len;
        }
 
        return d;
@@ -2517,29 +2670,12 @@ udma_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dest, dma_addr_t src,
                return NULL;
        }
 
-       if (len < SZ_64K) {
-               num_tr = 1;
-               tr0_cnt0 = len;
-               tr0_cnt1 = 1;
-       } else {
-               unsigned long align_to = __ffs(src | dest);
-
-               if (align_to > 3)
-                       align_to = 3;
-               /*
-                * Keep simple: tr0: SZ_64K-alignment blocks,
-                *              tr1: the remaining
-                */
-               num_tr = 2;
-               tr0_cnt0 = (SZ_64K - BIT(align_to));
-               if (len / tr0_cnt0 >= SZ_64K) {
-                       dev_err(uc->ud->dev, "size %zu is not supported\n",
-                               len);
-                       return NULL;
-               }
-
-               tr0_cnt1 = len / tr0_cnt0;
-               tr1_cnt0 = len % tr0_cnt0;
+       num_tr = udma_get_tr_counters(len, __ffs(src | dest), &tr0_cnt0,
+                                     &tr0_cnt1, &tr1_cnt0);
+       if (num_tr < 0) {
+               dev_err(uc->ud->dev, "size %zu is not supported\n",
+                       len);
+               return NULL;
        }
 
        d = udma_alloc_tr_desc(uc, tr_size, num_tr, DMA_MEM_TO_MEM);
@@ -2631,6 +2767,9 @@ static enum dma_status udma_tx_status(struct dma_chan *chan,
 
        ret = dma_cookie_status(chan, cookie, txstate);
 
+       if (!udma_is_chan_running(uc))
+               ret = DMA_COMPLETE;
+
        if (ret == DMA_IN_PROGRESS && udma_is_chan_paused(uc))
                ret = DMA_PAUSED;
 
@@ -2697,11 +2836,8 @@ static int udma_pause(struct dma_chan *chan)
 {
        struct udma_chan *uc = to_udma_chan(chan);
 
-       if (!uc->desc)
-               return -EINVAL;
-
        /* pause the channel */
-       switch (uc->desc->dir) {
+       switch (uc->config.dir) {
        case DMA_DEV_TO_MEM:
                udma_rchanrt_update_bits(uc->rchan,
                                         UDMA_RCHAN_RT_PEER_RT_EN_REG,
@@ -2730,11 +2866,8 @@ static int udma_resume(struct dma_chan *chan)
 {
        struct udma_chan *uc = to_udma_chan(chan);
 
-       if (!uc->desc)
-               return -EINVAL;
-
        /* resume the channel */
-       switch (uc->desc->dir) {
+       switch (uc->config.dir) {
        case DMA_DEV_TO_MEM:
                udma_rchanrt_update_bits(uc->rchan,
                                         UDMA_RCHAN_RT_PEER_RT_EN_REG,
@@ -3248,6 +3381,98 @@ static int udma_setup_resources(struct udma_dev *ud)
        return ch_count;
 }
 
+static int udma_setup_rx_flush(struct udma_dev *ud)
+{
+       struct udma_rx_flush *rx_flush = &ud->rx_flush;
+       struct cppi5_desc_hdr_t *tr_desc;
+       struct cppi5_tr_type1_t *tr_req;
+       struct cppi5_host_desc_t *desc;
+       struct device *dev = ud->dev;
+       struct udma_hwdesc *hwdesc;
+       size_t tr_size;
+
+       /* Allocate 1K buffer for discarded data on RX channel teardown */
+       rx_flush->buffer_size = SZ_1K;
+       rx_flush->buffer_vaddr = devm_kzalloc(dev, rx_flush->buffer_size,
+                                             GFP_KERNEL);
+       if (!rx_flush->buffer_vaddr)
+               return -ENOMEM;
+
+       rx_flush->buffer_paddr = dma_map_single(dev, rx_flush->buffer_vaddr,
+                                               rx_flush->buffer_size,
+                                               DMA_TO_DEVICE);
+       if (dma_mapping_error(dev, rx_flush->buffer_paddr))
+               return -ENOMEM;
+
+       /* Set up descriptor to be used for TR mode */
+       hwdesc = &rx_flush->hwdescs[0];
+       tr_size = sizeof(struct cppi5_tr_type1_t);
+       hwdesc->cppi5_desc_size = cppi5_trdesc_calc_size(tr_size, 1);
+       hwdesc->cppi5_desc_size = ALIGN(hwdesc->cppi5_desc_size,
+                                       ud->desc_align);
+
+       hwdesc->cppi5_desc_vaddr = devm_kzalloc(dev, hwdesc->cppi5_desc_size,
+                                               GFP_KERNEL);
+       if (!hwdesc->cppi5_desc_vaddr)
+               return -ENOMEM;
+
+       hwdesc->cppi5_desc_paddr = dma_map_single(dev, hwdesc->cppi5_desc_vaddr,
+                                                 hwdesc->cppi5_desc_size,
+                                                 DMA_TO_DEVICE);
+       if (dma_mapping_error(dev, hwdesc->cppi5_desc_paddr))
+               return -ENOMEM;
+
+       /* Start of the TR req records */
+       hwdesc->tr_req_base = hwdesc->cppi5_desc_vaddr + tr_size;
+       /* Start address of the TR response array */
+       hwdesc->tr_resp_base = hwdesc->tr_req_base + tr_size;
+
+       tr_desc = hwdesc->cppi5_desc_vaddr;
+       cppi5_trdesc_init(tr_desc, 1, tr_size, 0, 0);
+       cppi5_desc_set_pktids(tr_desc, 0, CPPI5_INFO1_DESC_FLOWID_DEFAULT);
+       cppi5_desc_set_retpolicy(tr_desc, 0, 0);
+
+       tr_req = hwdesc->tr_req_base;
+       cppi5_tr_init(&tr_req->flags, CPPI5_TR_TYPE1, false, false,
+                     CPPI5_TR_EVENT_SIZE_COMPLETION, 0);
+       cppi5_tr_csf_set(&tr_req->flags, CPPI5_TR_CSF_SUPR_EVT);
+
+       tr_req->addr = rx_flush->buffer_paddr;
+       tr_req->icnt0 = rx_flush->buffer_size;
+       tr_req->icnt1 = 1;
+
+       /* Set up descriptor to be used for packet mode */
+       hwdesc = &rx_flush->hwdescs[1];
+       hwdesc->cppi5_desc_size = ALIGN(sizeof(struct cppi5_host_desc_t) +
+                                       CPPI5_INFO0_HDESC_EPIB_SIZE +
+                                       CPPI5_INFO0_HDESC_PSDATA_MAX_SIZE,
+                                       ud->desc_align);
+
+       hwdesc->cppi5_desc_vaddr = devm_kzalloc(dev, hwdesc->cppi5_desc_size,
+                                               GFP_KERNEL);
+       if (!hwdesc->cppi5_desc_vaddr)
+               return -ENOMEM;
+
+       hwdesc->cppi5_desc_paddr = dma_map_single(dev, hwdesc->cppi5_desc_vaddr,
+                                                 hwdesc->cppi5_desc_size,
+                                                 DMA_TO_DEVICE);
+       if (dma_mapping_error(dev, hwdesc->cppi5_desc_paddr))
+               return -ENOMEM;
+
+       desc = hwdesc->cppi5_desc_vaddr;
+       cppi5_hdesc_init(desc, 0, 0);
+       cppi5_desc_set_pktids(&desc->hdr, 0, CPPI5_INFO1_DESC_FLOWID_DEFAULT);
+       cppi5_desc_set_retpolicy(&desc->hdr, 0, 0);
+
+       cppi5_hdesc_attach_buf(desc,
+                              rx_flush->buffer_paddr, rx_flush->buffer_size,
+                              rx_flush->buffer_paddr, rx_flush->buffer_size);
+
+       dma_sync_single_for_device(dev, hwdesc->cppi5_desc_paddr,
+                                  hwdesc->cppi5_desc_size, DMA_TO_DEVICE);
+       return 0;
+}
+
 #define TI_UDMAC_BUSWIDTHS     (BIT(DMA_SLAVE_BUSWIDTH_1_BYTE) | \
                                 BIT(DMA_SLAVE_BUSWIDTH_2_BYTES) | \
                                 BIT(DMA_SLAVE_BUSWIDTH_3_BYTES) | \
@@ -3361,6 +3586,10 @@ static int udma_probe(struct platform_device *pdev)
        if (ud->desc_align < dma_get_cache_alignment())
                ud->desc_align = dma_get_cache_alignment();
 
+       ret = udma_setup_rx_flush(ud);
+       if (ret)
+               return ret;
+
        for (i = 0; i < ud->tchan_cnt; i++) {
                struct udma_tchan *tchan = &ud->tchans[i];
 
index 2d263382d797f0440d1e07408445ef4bf76c70fc..880ffd83371871032513e15a94bc5719d57ef1c8 100644 (file)
@@ -479,20 +479,14 @@ static void handle_error(struct mem_ctl_info *mci, struct synps_ecc_status *p)
                pinf = &p->ceinfo;
                if (!priv->p_data->quirks) {
                        snprintf(priv->message, SYNPS_EDAC_MSG_SIZE,
-                                "DDR ECC error type:%s Row %d Bank %d Col %d ",
-                                 "CE", pinf->row, pinf->bank, pinf->col);
-                       snprintf(priv->message, SYNPS_EDAC_MSG_SIZE,
-                                "Bit Position: %d Data: 0x%08x\n",
+                                "DDR ECC error type:%s Row %d Bank %d Col %d Bit Position: %d Data: 0x%08x",
+                                "CE", pinf->row, pinf->bank, pinf->col,
                                 pinf->bitpos, pinf->data);
                } else {
                        snprintf(priv->message, SYNPS_EDAC_MSG_SIZE,
-                                "DDR ECC error type:%s Row %d Bank %d Col %d ",
-                                 "CE", pinf->row, pinf->bank, pinf->col);
-                       snprintf(priv->message, SYNPS_EDAC_MSG_SIZE,
-                                "BankGroup Number %d Block Number %d ",
-                                pinf->bankgrpnr, pinf->blknr);
-                       snprintf(priv->message, SYNPS_EDAC_MSG_SIZE,
-                                "Bit Position: %d Data: 0x%08x\n",
+                                "DDR ECC error type:%s Row %d Bank %d Col %d BankGroup Number %d Block Number %d Bit Position: %d Data: 0x%08x",
+                                "CE", pinf->row, pinf->bank, pinf->col,
+                                pinf->bankgrpnr, pinf->blknr,
                                 pinf->bitpos, pinf->data);
                }
 
@@ -509,10 +503,8 @@ static void handle_error(struct mem_ctl_info *mci, struct synps_ecc_status *p)
                                "UE", pinf->row, pinf->bank, pinf->col);
                } else {
                        snprintf(priv->message, SYNPS_EDAC_MSG_SIZE,
-                                "DDR ECC error type :%s Row %d Bank %d Col %d ",
-                                "UE", pinf->row, pinf->bank, pinf->col);
-                       snprintf(priv->message, SYNPS_EDAC_MSG_SIZE,
-                                "BankGroup Number %d Block Number %d",
+                                "DDR ECC error type :%s Row %d Bank %d Col %d BankGroup Number %d Block Number %d",
+                                "UE", pinf->row, pinf->bank, pinf->col,
                                 pinf->bankgrpnr, pinf->blknr);
                }
 
index 621220ab3d0e348fdff0eda1af30f499ed37d1ce..21ea99f651134be47161831266f00cb43fb85f56 100644 (file)
@@ -552,7 +552,7 @@ int __init efi_config_parse_tables(void *config_tables, int count, int sz,
 
                seed = early_memremap(efi.rng_seed, sizeof(*seed));
                if (seed != NULL) {
-                       size = seed->size;
+                       size = READ_ONCE(seed->size);
                        early_memunmap(seed, sizeof(*seed));
                } else {
                        pr_err("Could not map UEFI random seed!\n");
@@ -562,7 +562,7 @@ int __init efi_config_parse_tables(void *config_tables, int count, int sz,
                                              sizeof(*seed) + size);
                        if (seed != NULL) {
                                pr_notice("seeding entropy pool\n");
-                               add_bootloader_randomness(seed->bits, seed->size);
+                               add_bootloader_randomness(seed->bits, size);
                                early_memunmap(seed, sizeof(*seed) + size);
                        } else {
                                pr_err("Could not map UEFI random seed!\n");
index 03b43b7a6d1d573d9c9fc0f9421a53b6440baf8a..f71eaa5bf52d411c750aa359aa13f4a00d88130c 100644 (file)
@@ -29,6 +29,7 @@ struct imx_sc_chan {
        struct mbox_client cl;
        struct mbox_chan *ch;
        int idx;
+       struct completion tx_done;
 };
 
 struct imx_sc_ipc {
@@ -100,6 +101,14 @@ int imx_scu_get_handle(struct imx_sc_ipc **ipc)
 }
 EXPORT_SYMBOL(imx_scu_get_handle);
 
+/* Callback called when the word of a message is ack-ed, eg read by SCU */
+static void imx_scu_tx_done(struct mbox_client *cl, void *mssg, int r)
+{
+       struct imx_sc_chan *sc_chan = container_of(cl, struct imx_sc_chan, cl);
+
+       complete(&sc_chan->tx_done);
+}
+
 static void imx_scu_rx_callback(struct mbox_client *c, void *msg)
 {
        struct imx_sc_chan *sc_chan = container_of(c, struct imx_sc_chan, cl);
@@ -149,6 +158,19 @@ static int imx_scu_ipc_write(struct imx_sc_ipc *sc_ipc, void *msg)
 
        for (i = 0; i < hdr->size; i++) {
                sc_chan = &sc_ipc->chans[i % 4];
+
+               /*
+                * SCU requires that all messages words are written
+                * sequentially but linux MU driver implements multiple
+                * independent channels for each register so ordering between
+                * different channels must be ensured by SCU API interface.
+                *
+                * Wait for tx_done before every send to ensure that no
+                * queueing happens at the mailbox channel level.
+                */
+               wait_for_completion(&sc_chan->tx_done);
+               reinit_completion(&sc_chan->tx_done);
+
                ret = mbox_send_message(sc_chan->ch, &data[i]);
                if (ret < 0)
                        return ret;
@@ -247,6 +269,11 @@ static int imx_scu_probe(struct platform_device *pdev)
                cl->knows_txdone = true;
                cl->rx_callback = imx_scu_rx_callback;
 
+               /* Initial tx_done completion as "done" */
+               cl->tx_done = imx_scu_tx_done;
+               init_completion(&sc_chan->tx_done);
+               complete(&sc_chan->tx_done);
+
                sc_chan->sc_ipc = sc_ipc;
                sc_chan->idx = i % 4;
                sc_chan->ch = mbox_request_channel_byname(cl, chan_name);
index 4b56a587dacd4b5b65d6d74e83eaec177ba0b7cb..d073cb3ce69937cc6073c936bfbd442172364866 100644 (file)
@@ -16,7 +16,7 @@ struct imx_sc_msg_req_misc_set_ctrl {
        u32 ctrl;
        u32 val;
        u16 resource;
-} __packed;
+} __packed __aligned(4);
 
 struct imx_sc_msg_req_cpu_start {
        struct imx_sc_rpc_msg hdr;
@@ -24,18 +24,18 @@ struct imx_sc_msg_req_cpu_start {
        u32 address_lo;
        u16 resource;
        u8 enable;
-} __packed;
+} __packed __aligned(4);
 
 struct imx_sc_msg_req_misc_get_ctrl {
        struct imx_sc_rpc_msg hdr;
        u32 ctrl;
        u16 resource;
-} __packed;
+} __packed __aligned(4);
 
 struct imx_sc_msg_resp_misc_get_ctrl {
        struct imx_sc_rpc_msg hdr;
        u32 val;
-} __packed;
+} __packed __aligned(4);
 
 /*
  * This function sets a miscellaneous control value.
index b556612207e536a85dcdc8464b0256d3ff3f992a..af3ae0087de4e7ac8aa30e91dd00b6460aac265c 100644 (file)
@@ -61,7 +61,7 @@ struct imx_sc_msg_req_set_resource_power_mode {
        struct imx_sc_rpc_msg hdr;
        u16 resource;
        u8 mode;
-} __packed;
+} __packed __aligned(4);
 
 #define IMX_SCU_PD_NAME_SIZE 20
 struct imx_sc_pm_domain {
index dddfca555df958306fd89dfcd41a14e03648e090..0b6ee1dee625a1f338f9449eac623e5862b9fc34 100644 (file)
@@ -193,8 +193,7 @@ static void mousevsc_on_receive_device_info(struct mousevsc_dev *input_device,
                goto cleanup;
 
        /* The pointer is not NULL when we resume from hibernation */
-       if (input_device->hid_desc != NULL)
-               kfree(input_device->hid_desc);
+       kfree(input_device->hid_desc);
        input_device->hid_desc = kmemdup(desc, desc->bLength, GFP_ATOMIC);
 
        if (!input_device->hid_desc)
@@ -207,8 +206,7 @@ static void mousevsc_on_receive_device_info(struct mousevsc_dev *input_device,
        }
 
        /* The pointer is not NULL when we resume from hibernation */
-       if (input_device->report_desc != NULL)
-               kfree(input_device->report_desc);
+       kfree(input_device->report_desc);
        input_device->report_desc = kzalloc(input_device->report_desc_size,
                                          GFP_ATOMIC);
 
index 9632e2e3c4bb4067cd58a1fb2f4252ab20e13c0a..319a0519ebdb0f44a675cd241a85a114b2b8dc7f 100644 (file)
@@ -413,7 +413,7 @@ static int ADT7462_REG_VOLT(struct adt7462_data *data, int which)
                        return 0x95;
                break;
        }
-       return -ENODEV;
+       return 0;
 }
 
 /* Provide labels for sysfs */
index ecd9b65627ecdd57ded7dc383bccf6081da9559f..660556b89e9ff541069400861d8414d882906927 100644 (file)
 #define XDPE122_AMD_625MV              0x10 /* AMD mode 6.25mV */
 #define XDPE122_PAGE_NUM               2
 
+static int xdpe122_read_word_data(struct i2c_client *client, int page, int reg)
+{
+       const struct pmbus_driver_info *info = pmbus_get_driver_info(client);
+       long val;
+       s16 exponent;
+       s32 mantissa;
+       int ret;
+
+       switch (reg) {
+       case PMBUS_VOUT_OV_FAULT_LIMIT:
+       case PMBUS_VOUT_UV_FAULT_LIMIT:
+               ret = pmbus_read_word_data(client, page, reg);
+               if (ret < 0)
+                       return ret;
+
+               /* Convert register value to LINEAR11 data. */
+               exponent = ((s16)ret) >> 11;
+               mantissa = ((s16)((ret & GENMASK(10, 0)) << 5)) >> 5;
+               val = mantissa * 1000L;
+               if (exponent >= 0)
+                       val <<= exponent;
+               else
+                       val >>= -exponent;
+
+               /* Convert data to VID register. */
+               switch (info->vrm_version[page]) {
+               case vr13:
+                       if (val >= 500)
+                               return 1 + DIV_ROUND_CLOSEST(val - 500, 10);
+                       return 0;
+               case vr12:
+                       if (val >= 250)
+                               return 1 + DIV_ROUND_CLOSEST(val - 250, 5);
+                       return 0;
+               case imvp9:
+                       if (val >= 200)
+                               return 1 + DIV_ROUND_CLOSEST(val - 200, 10);
+                       return 0;
+               case amd625mv:
+                       if (val >= 200 && val <= 1550)
+                               return DIV_ROUND_CLOSEST((1550 - val) * 100,
+                                                        625);
+                       return 0;
+               default:
+                       return -EINVAL;
+               }
+       default:
+               return -ENODATA;
+       }
+
+       return 0;
+}
+
 static int xdpe122_identify(struct i2c_client *client,
                            struct pmbus_driver_info *info)
 {
@@ -70,6 +123,7 @@ static struct pmbus_driver_info xdpe122_info = {
                PMBUS_HAVE_TEMP | PMBUS_HAVE_STATUS_TEMP |
                PMBUS_HAVE_POUT | PMBUS_HAVE_PIN | PMBUS_HAVE_STATUS_INPUT,
        .identify = xdpe122_identify,
+       .read_word_data = xdpe122_read_word_data,
 };
 
 static int xdpe122_probe(struct i2c_client *client,
index 68cc1b2d68240dfb566f1552a4ff6081a52c192a..15e99a8884275fd921b4309212d57030f50f52d7 100644 (file)
@@ -1191,6 +1191,7 @@ struct ib_cm_id *ib_cm_insert_listen(struct ib_device *device,
                        /* Sharing an ib_cm_id with different handlers is not
                         * supported */
                        spin_unlock_irqrestore(&cm.lock, flags);
+                       ib_destroy_cm_id(cm_id);
                        return ERR_PTR(-EINVAL);
                }
                refcount_inc(&cm_id_priv->refcount);
index 72f032160c4bd92ff54561463438d5b27dd4ee51..2dec3a02ab9fe7634cae6aba07532e3478737c73 100644 (file)
@@ -3212,19 +3212,26 @@ int rdma_resolve_addr(struct rdma_cm_id *id, struct sockaddr *src_addr,
        int ret;
 
        id_priv = container_of(id, struct rdma_id_private, id);
+       memcpy(cma_dst_addr(id_priv), dst_addr, rdma_addr_size(dst_addr));
        if (id_priv->state == RDMA_CM_IDLE) {
                ret = cma_bind_addr(id, src_addr, dst_addr);
-               if (ret)
+               if (ret) {
+                       memset(cma_dst_addr(id_priv), 0,
+                              rdma_addr_size(dst_addr));
                        return ret;
+               }
        }
 
-       if (cma_family(id_priv) != dst_addr->sa_family)
+       if (cma_family(id_priv) != dst_addr->sa_family) {
+               memset(cma_dst_addr(id_priv), 0, rdma_addr_size(dst_addr));
                return -EINVAL;
+       }
 
-       if (!cma_comp_exch(id_priv, RDMA_CM_ADDR_BOUND, RDMA_CM_ADDR_QUERY))
+       if (!cma_comp_exch(id_priv, RDMA_CM_ADDR_BOUND, RDMA_CM_ADDR_QUERY)) {
+               memset(cma_dst_addr(id_priv), 0, rdma_addr_size(dst_addr));
                return -EINVAL;
+       }
 
-       memcpy(cma_dst_addr(id_priv), dst_addr, rdma_addr_size(dst_addr));
        if (cma_any_addr(dst_addr)) {
                ret = cma_resolve_loopback(id_priv);
        } else {
index b1457b3464d34f0dd6489a7c7f6a02768ef6d2e6..cf42acca4a3a387a23b5a4dac6f8f190214175d4 100644 (file)
@@ -338,6 +338,20 @@ static inline struct ib_qp *_ib_create_qp(struct ib_device *dev,
        qp->pd = pd;
        qp->uobject = uobj;
        qp->real_qp = qp;
+
+       qp->qp_type = attr->qp_type;
+       qp->rwq_ind_tbl = attr->rwq_ind_tbl;
+       qp->send_cq = attr->send_cq;
+       qp->recv_cq = attr->recv_cq;
+       qp->srq = attr->srq;
+       qp->rwq_ind_tbl = attr->rwq_ind_tbl;
+       qp->event_handler = attr->event_handler;
+
+       atomic_set(&qp->usecnt, 0);
+       spin_lock_init(&qp->mr_lock);
+       INIT_LIST_HEAD(&qp->rdma_mrs);
+       INIT_LIST_HEAD(&qp->sig_mrs);
+
        /*
         * We don't track XRC QPs for now, because they don't have PD
         * and more importantly they are created internaly by driver,
index ade71823370f3335566079599a76dde871cc9333..da8adadf47559eb3144709d075264d1321d92dd5 100644 (file)
@@ -159,8 +159,10 @@ static void dealloc_work_entries(struct iwcm_id_private *cm_id_priv)
 {
        struct list_head *e, *tmp;
 
-       list_for_each_safe(e, tmp, &cm_id_priv->work_free_list)
+       list_for_each_safe(e, tmp, &cm_id_priv->work_free_list) {
+               list_del(e);
                kfree(list_entry(e, struct iwcm_work, free_list));
+       }
 }
 
 static int alloc_work_entries(struct iwcm_id_private *cm_id_priv, int count)
index 37b433aa730610e0f2d1806c37a5dbe31dae7d93..e0b0a91da696c5881306b9448f49aafcb33979de 100644 (file)
@@ -1757,6 +1757,8 @@ static int nldev_stat_set_doit(struct sk_buff *skb, struct nlmsghdr *nlh,
                if (ret)
                        goto err_msg;
        } else {
+               if (!tb[RDMA_NLDEV_ATTR_RES_LQPN])
+                       goto err_msg;
                qpn = nla_get_u32(tb[RDMA_NLDEV_ATTR_RES_LQPN]);
                if (tb[RDMA_NLDEV_ATTR_STAT_COUNTER_ID]) {
                        cntn = nla_get_u32(tb[RDMA_NLDEV_ATTR_STAT_COUNTER_ID]);
index 4fad732f9b3cc40041c7ba25139756ca425e7219..06e5b6787443ad2fc577cfbf630f72a6ce4d6773 100644 (file)
@@ -273,6 +273,23 @@ static int rdma_rw_init_single_wr(struct rdma_rw_ctx *ctx, struct ib_qp *qp,
        return 1;
 }
 
+static void rdma_rw_unmap_sg(struct ib_device *dev, struct scatterlist *sg,
+                            u32 sg_cnt, enum dma_data_direction dir)
+{
+       if (is_pci_p2pdma_page(sg_page(sg)))
+               pci_p2pdma_unmap_sg(dev->dma_device, sg, sg_cnt, dir);
+       else
+               ib_dma_unmap_sg(dev, sg, sg_cnt, dir);
+}
+
+static int rdma_rw_map_sg(struct ib_device *dev, struct scatterlist *sg,
+                         u32 sg_cnt, enum dma_data_direction dir)
+{
+       if (is_pci_p2pdma_page(sg_page(sg)))
+               return pci_p2pdma_map_sg(dev->dma_device, sg, sg_cnt, dir);
+       return ib_dma_map_sg(dev, sg, sg_cnt, dir);
+}
+
 /**
  * rdma_rw_ctx_init - initialize a RDMA READ/WRITE context
  * @ctx:       context to initialize
@@ -295,11 +312,7 @@ int rdma_rw_ctx_init(struct rdma_rw_ctx *ctx, struct ib_qp *qp, u8 port_num,
        struct ib_device *dev = qp->pd->device;
        int ret;
 
-       if (is_pci_p2pdma_page(sg_page(sg)))
-               ret = pci_p2pdma_map_sg(dev->dma_device, sg, sg_cnt, dir);
-       else
-               ret = ib_dma_map_sg(dev, sg, sg_cnt, dir);
-
+       ret = rdma_rw_map_sg(dev, sg, sg_cnt, dir);
        if (!ret)
                return -ENOMEM;
        sg_cnt = ret;
@@ -338,7 +351,7 @@ int rdma_rw_ctx_init(struct rdma_rw_ctx *ctx, struct ib_qp *qp, u8 port_num,
        return ret;
 
 out_unmap_sg:
-       ib_dma_unmap_sg(dev, sg, sg_cnt, dir);
+       rdma_rw_unmap_sg(dev, sg, sg_cnt, dir);
        return ret;
 }
 EXPORT_SYMBOL(rdma_rw_ctx_init);
@@ -588,11 +601,7 @@ void rdma_rw_ctx_destroy(struct rdma_rw_ctx *ctx, struct ib_qp *qp, u8 port_num,
                break;
        }
 
-       if (is_pci_p2pdma_page(sg_page(sg)))
-               pci_p2pdma_unmap_sg(qp->pd->device->dma_device, sg,
-                                   sg_cnt, dir);
-       else
-               ib_dma_unmap_sg(qp->pd->device, sg, sg_cnt, dir);
+       rdma_rw_unmap_sg(qp->pd->device, sg, sg_cnt, dir);
 }
 EXPORT_SYMBOL(rdma_rw_ctx_destroy);
 
index 2b4d80393bd0dcc8f166effc34709d1de6fbef7c..2d5608315dc80139128e1673441bb008004d00e6 100644 (file)
@@ -340,15 +340,19 @@ static struct ib_ports_pkeys *get_new_pps(const struct ib_qp *qp,
                return NULL;
 
        if (qp_attr_mask & IB_QP_PORT)
-               new_pps->main.port_num =
-                       (qp_pps) ? qp_pps->main.port_num : qp_attr->port_num;
+               new_pps->main.port_num = qp_attr->port_num;
+       else if (qp_pps)
+               new_pps->main.port_num = qp_pps->main.port_num;
+
        if (qp_attr_mask & IB_QP_PKEY_INDEX)
-               new_pps->main.pkey_index = (qp_pps) ? qp_pps->main.pkey_index :
-                                                     qp_attr->pkey_index;
+               new_pps->main.pkey_index = qp_attr->pkey_index;
+       else if (qp_pps)
+               new_pps->main.pkey_index = qp_pps->main.pkey_index;
+
        if ((qp_attr_mask & IB_QP_PKEY_INDEX) && (qp_attr_mask & IB_QP_PORT))
                new_pps->main.state = IB_PORT_PKEY_VALID;
 
-       if (!(qp_attr_mask & (IB_QP_PKEY_INDEX || IB_QP_PORT)) && qp_pps) {
+       if (!(qp_attr_mask & (IB_QP_PKEY_INDEX | IB_QP_PORT)) && qp_pps) {
                new_pps->main.port_num = qp_pps->main.port_num;
                new_pps->main.pkey_index = qp_pps->main.pkey_index;
                if (qp_pps->main.state != IB_PORT_PKEY_NOT_VALID)
index b8c657b2838048b987d4429584dd9b743afd45db..cd656ad4953bfce4d8d3efabb34b6794662132c0 100644 (file)
@@ -181,14 +181,28 @@ ib_umem_odp_alloc_child(struct ib_umem_odp *root, unsigned long addr,
        odp_data->page_shift = PAGE_SHIFT;
        odp_data->notifier.ops = ops;
 
+       /*
+        * A mmget must be held when registering a notifier, the owming_mm only
+        * has a mm_grab at this point.
+        */
+       if (!mmget_not_zero(umem->owning_mm)) {
+               ret = -EFAULT;
+               goto out_free;
+       }
+
        odp_data->tgid = get_pid(root->tgid);
        ret = ib_init_umem_odp(odp_data, ops);
-       if (ret) {
-               put_pid(odp_data->tgid);
-               kfree(odp_data);
-               return ERR_PTR(ret);
-       }
+       if (ret)
+               goto out_tgid;
+       mmput(umem->owning_mm);
        return odp_data;
+
+out_tgid:
+       put_pid(odp_data->tgid);
+       mmput(umem->owning_mm);
+out_free:
+       kfree(odp_data);
+       return ERR_PTR(ret);
 }
 EXPORT_SYMBOL(ib_umem_odp_alloc_child);
 
index 025933752e1da5235638c6080f1548c1894376c1..060b4ebbd2ba4d7b393f33c887d5ac80d8471502 100644 (file)
@@ -1445,16 +1445,7 @@ static int create_qp(struct uverbs_attr_bundle *attrs,
                if (ret)
                        goto err_cb;
 
-               qp->pd            = pd;
-               qp->send_cq       = attr.send_cq;
-               qp->recv_cq       = attr.recv_cq;
-               qp->srq           = attr.srq;
-               qp->rwq_ind_tbl   = ind_tbl;
-               qp->event_handler = attr.event_handler;
-               qp->qp_type       = attr.qp_type;
-               atomic_set(&qp->usecnt, 0);
                atomic_inc(&pd->usecnt);
-               qp->port = 0;
                if (attr.send_cq)
                        atomic_inc(&attr.send_cq->usecnt);
                if (attr.recv_cq)
index 3ebae3b65c28210919fe3f4135d81b1d78faaccb..e62c9dfc7837a86b5a1fdfb7101e5ee0d54c79f7 100644 (file)
@@ -1185,16 +1185,6 @@ struct ib_qp *ib_create_qp_user(struct ib_pd *pd,
        if (ret)
                goto err;
 
-       qp->qp_type    = qp_init_attr->qp_type;
-       qp->rwq_ind_tbl = qp_init_attr->rwq_ind_tbl;
-
-       atomic_set(&qp->usecnt, 0);
-       qp->mrs_used = 0;
-       spin_lock_init(&qp->mr_lock);
-       INIT_LIST_HEAD(&qp->rdma_mrs);
-       INIT_LIST_HEAD(&qp->sig_mrs);
-       qp->port = 0;
-
        if (qp_init_attr->qp_type == IB_QPT_XRC_TGT) {
                struct ib_qp *xrc_qp =
                        create_xrc_qp_user(qp, qp_init_attr, udata);
index 089e201d75500072f527410a6ea8b1499fef19b1..2f6323ad9c598561585ff1a00323c39265f92ac6 100644 (file)
@@ -515,10 +515,11 @@ static inline void hfi1_handle_packet(struct hfi1_packet *packet,
                                       opa_get_lid(packet->dlid, 9B));
                if (!mcast)
                        goto drop;
+               rcu_read_lock();
                list_for_each_entry_rcu(p, &mcast->qp_list, list) {
                        packet->qp = p->qp;
                        if (hfi1_do_pkey_check(packet))
-                               goto drop;
+                               goto unlock_drop;
                        spin_lock_irqsave(&packet->qp->r_lock, flags);
                        packet_handler = qp_ok(packet);
                        if (likely(packet_handler))
@@ -527,6 +528,7 @@ static inline void hfi1_handle_packet(struct hfi1_packet *packet,
                                ibp->rvp.n_pkt_drops++;
                        spin_unlock_irqrestore(&packet->qp->r_lock, flags);
                }
+               rcu_read_unlock();
                /*
                 * Notify rvt_multicast_detach() if it is waiting for us
                 * to finish.
index d9bffcc935875b00c5e1bebf51bac72a16a16845..bb78142bca5eaf8a137785d144520ed391a3bbf4 100644 (file)
@@ -636,6 +636,7 @@ struct mlx5_ib_mr {
 
        /* For ODP and implicit */
        atomic_t                num_deferred_work;
+       wait_queue_head_t       q_deferred_work;
        struct xarray           implicit_children;
        union {
                struct rcu_head rcu;
index 4216814ba871d2c20f8e634caf3ae99482e10fe9..bf50cd91f472586dfa711e0fa22fa5e5f80fe8cb 100644 (file)
@@ -235,7 +235,8 @@ static void free_implicit_child_mr(struct mlx5_ib_mr *mr, bool need_imr_xlt)
        mr->parent = NULL;
        mlx5_mr_cache_free(mr->dev, mr);
        ib_umem_odp_release(odp);
-       atomic_dec(&imr->num_deferred_work);
+       if (atomic_dec_and_test(&imr->num_deferred_work))
+               wake_up(&imr->q_deferred_work);
 }
 
 static void free_implicit_child_mr_work(struct work_struct *work)
@@ -554,6 +555,7 @@ struct mlx5_ib_mr *mlx5_ib_alloc_implicit_mr(struct mlx5_ib_pd *pd,
        imr->umem = &umem_odp->umem;
        imr->is_odp_implicit = true;
        atomic_set(&imr->num_deferred_work, 0);
+       init_waitqueue_head(&imr->q_deferred_work);
        xa_init(&imr->implicit_children);
 
        err = mlx5_ib_update_xlt(imr, 0,
@@ -611,10 +613,7 @@ void mlx5_ib_free_implicit_mr(struct mlx5_ib_mr *imr)
         * under xa_lock while the child is in the xarray. Thus at this point
         * it is only decreasing, and all work holding it is now on the wq.
         */
-       if (atomic_read(&imr->num_deferred_work)) {
-               flush_workqueue(system_unbound_wq);
-               WARN_ON(atomic_read(&imr->num_deferred_work));
-       }
+       wait_event(imr->q_deferred_work, !atomic_read(&imr->num_deferred_work));
 
        /*
         * Fence the imr before we destroy the children. This allows us to
@@ -645,10 +644,7 @@ void mlx5_ib_fence_odp_mr(struct mlx5_ib_mr *mr)
        /* Wait for all running page-fault handlers to finish. */
        synchronize_srcu(&mr->dev->odp_srcu);
 
-       if (atomic_read(&mr->num_deferred_work)) {
-               flush_workqueue(system_unbound_wq);
-               WARN_ON(atomic_read(&mr->num_deferred_work));
-       }
+       wait_event(mr->q_deferred_work, !atomic_read(&mr->num_deferred_work));
 
        dma_fence_odp_mr(mr);
 }
@@ -1720,7 +1716,8 @@ static void destroy_prefetch_work(struct prefetch_mr_work *work)
        u32 i;
 
        for (i = 0; i < work->num_sge; ++i)
-               atomic_dec(&work->frags[i].mr->num_deferred_work);
+               if (atomic_dec_and_test(&work->frags[i].mr->num_deferred_work))
+                       wake_up(&work->frags[i].mr->q_deferred_work);
        kvfree(work);
 }
 
index 33778d451b827f3b91a9025875f365e41587f499..5ef93f8f17a192733fdf0751e01cfb9fb7732387 100644 (file)
@@ -329,8 +329,10 @@ void qib_ib_rcv(struct qib_ctxtdata *rcd, void *rhdr, void *data, u32 tlen)
                if (mcast == NULL)
                        goto drop;
                this_cpu_inc(ibp->pmastats->n_multicast_rcv);
+               rcu_read_lock();
                list_for_each_entry_rcu(p, &mcast->qp_list, list)
                        qib_qp_rcv(rcd, hdr, 1, data, tlen, p->qp);
+               rcu_read_unlock();
                /*
                 * Notify rvt_multicast_detach() if it is waiting for us
                 * to finish.
index 96ed349c093923060b3b348cb6ec08e9f34c43f7..5cd40fb9e20ce5eb0a667c9882928e58f4a1269a 100644 (file)
@@ -388,6 +388,9 @@ static struct siw_device *siw_device_create(struct net_device *netdev)
                { .max_segment_size = SZ_2G };
        base_dev->num_comp_vectors = num_possible_cpus();
 
+       xa_init_flags(&sdev->qp_xa, XA_FLAGS_ALLOC1);
+       xa_init_flags(&sdev->mem_xa, XA_FLAGS_ALLOC1);
+
        ib_set_device_ops(base_dev, &siw_device_ops);
        rv = ib_device_set_netdev(base_dev, netdev, 1);
        if (rv)
@@ -415,9 +418,6 @@ static struct siw_device *siw_device_create(struct net_device *netdev)
        sdev->attrs.max_srq_wr = SIW_MAX_SRQ_WR;
        sdev->attrs.max_srq_sge = SIW_MAX_SGE;
 
-       xa_init_flags(&sdev->qp_xa, XA_FLAGS_ALLOC1);
-       xa_init_flags(&sdev->mem_xa, XA_FLAGS_ALLOC1);
-
        INIT_LIST_HEAD(&sdev->cep_list);
        INIT_LIST_HEAD(&sdev->qp_list);
 
index f277e467156f759de71af874557be07dfaa3e25b..2c6515e3ecf13ee9dfad6af55037bbb9f4e9bd97 100644 (file)
@@ -445,6 +445,11 @@ struct icc_path *of_icc_get(struct device *dev, const char *name)
                path->name = kasprintf(GFP_KERNEL, "%s-%s",
                                       src_node->name, dst_node->name);
 
+       if (!path->name) {
+               kfree(path);
+               return ERR_PTR(-ENOMEM);
+       }
+
        return path;
 }
 EXPORT_SYMBOL_GPL(of_icc_get);
@@ -579,6 +584,10 @@ struct icc_path *icc_get(struct device *dev, const int src_id, const int dst_id)
        }
 
        path->name = kasprintf(GFP_KERNEL, "%s-%s", src->name, dst->name);
+       if (!path->name) {
+               kfree(path);
+               path = ERR_PTR(-ENOMEM);
+       }
 out:
        mutex_unlock(&icc_lock);
        return path;
index 8bc1faf71ff2fc747129095c5d27cbd9365e9e1c..a1df0d95151c67b15d78802193be03530441d4d0 100644 (file)
@@ -67,7 +67,6 @@
 #include <linux/blkdev.h>
 #include <linux/kthread.h>
 #include <linux/random.h>
-#include <linux/sched/signal.h>
 #include <trace/events/bcache.h>
 
 #define MAX_OPEN_BUCKETS 128
@@ -734,21 +733,8 @@ int bch_open_buckets_alloc(struct cache_set *c)
 
 int bch_cache_allocator_start(struct cache *ca)
 {
-       struct task_struct *k;
-
-       /*
-        * In case previous btree check operation occupies too many
-        * system memory for bcache btree node cache, and the
-        * registering process is selected by OOM killer. Here just
-        * ignore the SIGKILL sent by OOM killer if there is, to
-        * avoid kthread_run() being failed by pending signals. The
-        * bcache registering process will exit after the registration
-        * done.
-        */
-       if (signal_pending(current))
-               flush_signals(current);
-
-       k = kthread_run(bch_allocator_thread, ca, "bcache_allocator");
+       struct task_struct *k = kthread_run(bch_allocator_thread,
+                                           ca, "bcache_allocator");
        if (IS_ERR(k))
                return PTR_ERR(k);
 
index b12186c87f52df8e427f762c810d4b5ea441dede..fa872df4e7703fb65b229c2ddcac9dbadad6593c 100644 (file)
@@ -34,7 +34,6 @@
 #include <linux/random.h>
 #include <linux/rcupdate.h>
 #include <linux/sched/clock.h>
-#include <linux/sched/signal.h>
 #include <linux/rculist.h>
 #include <linux/delay.h>
 #include <trace/events/bcache.h>
@@ -1914,18 +1913,6 @@ static int bch_gc_thread(void *arg)
 
 int bch_gc_thread_start(struct cache_set *c)
 {
-       /*
-        * In case previous btree check operation occupies too many
-        * system memory for bcache btree node cache, and the
-        * registering process is selected by OOM killer. Here just
-        * ignore the SIGKILL sent by OOM killer if there is, to
-        * avoid kthread_run() being failed by pending signals. The
-        * bcache registering process will exit after the registration
-        * done.
-        */
-       if (signal_pending(current))
-               flush_signals(current);
-
        c->gc_thread = kthread_run(bch_gc_thread, c, "bcache_gc");
        return PTR_ERR_OR_ZERO(c->gc_thread);
 }
index c82578af56a5bbff035a272f258327a7fce6ecfd..2ea0360108e1d41b57a39b5c5df715c52a641442 100644 (file)
 struct dm_bio_details {
        struct gendisk *bi_disk;
        u8 bi_partno;
+       int __bi_remaining;
        unsigned long bi_flags;
        struct bvec_iter bi_iter;
+       bio_end_io_t *bi_end_io;
+#if defined(CONFIG_BLK_DEV_INTEGRITY)
+       struct bio_integrity_payload *bi_integrity;
+#endif
 };
 
 static inline void dm_bio_record(struct dm_bio_details *bd, struct bio *bio)
@@ -30,6 +35,11 @@ static inline void dm_bio_record(struct dm_bio_details *bd, struct bio *bio)
        bd->bi_partno = bio->bi_partno;
        bd->bi_flags = bio->bi_flags;
        bd->bi_iter = bio->bi_iter;
+       bd->__bi_remaining = atomic_read(&bio->__bi_remaining);
+       bd->bi_end_io = bio->bi_end_io;
+#if defined(CONFIG_BLK_DEV_INTEGRITY)
+       bd->bi_integrity = bio_integrity(bio);
+#endif
 }
 
 static inline void dm_bio_restore(struct dm_bio_details *bd, struct bio *bio)
@@ -38,6 +48,11 @@ static inline void dm_bio_restore(struct dm_bio_details *bd, struct bio *bio)
        bio->bi_partno = bd->bi_partno;
        bio->bi_flags = bd->bi_flags;
        bio->bi_iter = bd->bi_iter;
+       atomic_set(&bio->__bi_remaining, bd->__bi_remaining);
+       bio->bi_end_io = bd->bi_end_io;
+#if defined(CONFIG_BLK_DEV_INTEGRITY)
+       bio->bi_integrity = bd->bi_integrity;
+#endif
 }
 
 #endif
index 2d32821b3a5b8fdac87c54a7778b635fd62f8c7d..d3bb355819a421fbdda41cb5880321d248d29699 100644 (file)
@@ -2846,8 +2846,8 @@ static void cache_postsuspend(struct dm_target *ti)
        prevent_background_work(cache);
        BUG_ON(atomic_read(&cache->nr_io_migrations));
 
-       cancel_delayed_work(&cache->waker);
-       flush_workqueue(cache->wq);
+       cancel_delayed_work_sync(&cache->waker);
+       drain_workqueue(cache->wq);
        WARN_ON(cache->tracker.in_flight);
 
        /*
@@ -3492,7 +3492,7 @@ static void cache_io_hints(struct dm_target *ti, struct queue_limits *limits)
 
 static struct target_type cache_target = {
        .name = "cache",
-       .version = {2, 1, 0},
+       .version = {2, 2, 0},
        .module = THIS_MODULE,
        .ctr = cache_ctr,
        .dtr = cache_dtr,
index b225b3e445fa43aa57c51828f7f6bea09351fb0c..2f03fecd312d8b4c8995c7fe275a6d5fac76045b 100644 (file)
@@ -6,6 +6,8 @@
  * This file is released under the GPL.
  */
 
+#include "dm-bio-record.h"
+
 #include <linux/compiler.h>
 #include <linux/module.h>
 #include <linux/device-mapper.h>
@@ -201,17 +203,19 @@ struct dm_integrity_c {
        __u8 log2_blocks_per_bitmap_bit;
 
        unsigned char mode;
-       int suspending;
 
        int failed;
 
        struct crypto_shash *internal_hash;
 
+       struct dm_target *ti;
+
        /* these variables are locked with endio_wait.lock */
        struct rb_root in_progress;
        struct list_head wait_list;
        wait_queue_head_t endio_wait;
        struct workqueue_struct *wait_wq;
+       struct workqueue_struct *offload_wq;
 
        unsigned char commit_seq;
        commit_id_t commit_ids[N_COMMIT_IDS];
@@ -293,11 +297,7 @@ struct dm_integrity_io {
 
        struct completion *completion;
 
-       struct gendisk *orig_bi_disk;
-       u8 orig_bi_partno;
-       bio_end_io_t *orig_bi_end_io;
-       struct bio_integrity_payload *orig_bi_integrity;
-       struct bvec_iter orig_bi_iter;
+       struct dm_bio_details bio_details;
 };
 
 struct journal_completion {
@@ -1439,7 +1439,7 @@ static void dec_in_flight(struct dm_integrity_io *dio)
                        dio->range.logical_sector += dio->range.n_sectors;
                        bio_advance(bio, dio->range.n_sectors << SECTOR_SHIFT);
                        INIT_WORK(&dio->work, integrity_bio_wait);
-                       queue_work(ic->wait_wq, &dio->work);
+                       queue_work(ic->offload_wq, &dio->work);
                        return;
                }
                do_endio_flush(ic, dio);
@@ -1450,14 +1450,9 @@ static void integrity_end_io(struct bio *bio)
 {
        struct dm_integrity_io *dio = dm_per_bio_data(bio, sizeof(struct dm_integrity_io));
 
-       bio->bi_iter = dio->orig_bi_iter;
-       bio->bi_disk = dio->orig_bi_disk;
-       bio->bi_partno = dio->orig_bi_partno;
-       if (dio->orig_bi_integrity) {
-               bio->bi_integrity = dio->orig_bi_integrity;
+       dm_bio_restore(&dio->bio_details, bio);
+       if (bio->bi_integrity)
                bio->bi_opf |= REQ_INTEGRITY;
-       }
-       bio->bi_end_io = dio->orig_bi_end_io;
 
        if (dio->completion)
                complete(dio->completion);
@@ -1542,7 +1537,7 @@ static void integrity_metadata(struct work_struct *w)
                        }
                }
 
-               __bio_for_each_segment(bv, bio, iter, dio->orig_bi_iter) {
+               __bio_for_each_segment(bv, bio, iter, dio->bio_details.bi_iter) {
                        unsigned pos;
                        char *mem, *checksums_ptr;
 
@@ -1586,7 +1581,7 @@ static void integrity_metadata(struct work_struct *w)
                if (likely(checksums != checksums_onstack))
                        kfree(checksums);
        } else {
-               struct bio_integrity_payload *bip = dio->orig_bi_integrity;
+               struct bio_integrity_payload *bip = dio->bio_details.bi_integrity;
 
                if (bip) {
                        struct bio_vec biv;
@@ -1865,7 +1860,7 @@ static void dm_integrity_map_continue(struct dm_integrity_io *dio, bool from_map
 
        if (need_sync_io && from_map) {
                INIT_WORK(&dio->work, integrity_bio_wait);
-               queue_work(ic->metadata_wq, &dio->work);
+               queue_work(ic->offload_wq, &dio->work);
                return;
        }
 
@@ -2005,20 +2000,13 @@ static void dm_integrity_map_continue(struct dm_integrity_io *dio, bool from_map
        } else
                dio->completion = NULL;
 
-       dio->orig_bi_iter = bio->bi_iter;
-
-       dio->orig_bi_disk = bio->bi_disk;
-       dio->orig_bi_partno = bio->bi_partno;
+       dm_bio_record(&dio->bio_details, bio);
        bio_set_dev(bio, ic->dev->bdev);
-
-       dio->orig_bi_integrity = bio_integrity(bio);
        bio->bi_integrity = NULL;
        bio->bi_opf &= ~REQ_INTEGRITY;
-
-       dio->orig_bi_end_io = bio->bi_end_io;
        bio->bi_end_io = integrity_end_io;
-
        bio->bi_iter.bi_size = dio->range.n_sectors << SECTOR_SHIFT;
+
        generic_make_request(bio);
 
        if (need_sync_io) {
@@ -2315,7 +2303,7 @@ static void integrity_writer(struct work_struct *w)
        unsigned prev_free_sectors;
 
        /* the following test is not needed, but it tests the replay code */
-       if (READ_ONCE(ic->suspending) && !ic->meta_dev)
+       if (unlikely(dm_suspended(ic->ti)) && !ic->meta_dev)
                return;
 
        spin_lock_irq(&ic->endio_wait.lock);
@@ -2376,7 +2364,7 @@ static void integrity_recalc(struct work_struct *w)
 
 next_chunk:
 
-       if (unlikely(READ_ONCE(ic->suspending)))
+       if (unlikely(dm_suspended(ic->ti)))
                goto unlock_ret;
 
        range.logical_sector = le64_to_cpu(ic->sb->recalc_sector);
@@ -2501,7 +2489,7 @@ static void bitmap_block_work(struct work_struct *w)
                                    dio->range.n_sectors, BITMAP_OP_TEST_ALL_SET)) {
                        remove_range(ic, &dio->range);
                        INIT_WORK(&dio->work, integrity_bio_wait);
-                       queue_work(ic->wait_wq, &dio->work);
+                       queue_work(ic->offload_wq, &dio->work);
                } else {
                        block_bitmap_op(ic, ic->journal, dio->range.logical_sector,
                                        dio->range.n_sectors, BITMAP_OP_SET);
@@ -2524,7 +2512,7 @@ static void bitmap_block_work(struct work_struct *w)
 
                remove_range(ic, &dio->range);
                INIT_WORK(&dio->work, integrity_bio_wait);
-               queue_work(ic->wait_wq, &dio->work);
+               queue_work(ic->offload_wq, &dio->work);
        }
 
        queue_delayed_work(ic->commit_wq, &ic->bitmap_flush_work, ic->bitmap_flush_interval);
@@ -2804,8 +2792,6 @@ static void dm_integrity_postsuspend(struct dm_target *ti)
 
        del_timer_sync(&ic->autocommit_timer);
 
-       WRITE_ONCE(ic->suspending, 1);
-
        if (ic->recalc_wq)
                drain_workqueue(ic->recalc_wq);
 
@@ -2834,8 +2820,6 @@ static void dm_integrity_postsuspend(struct dm_target *ti)
 #endif
        }
 
-       WRITE_ONCE(ic->suspending, 0);
-
        BUG_ON(!RB_EMPTY_ROOT(&ic->in_progress));
 
        ic->journal_uptodate = true;
@@ -2888,17 +2872,24 @@ static void dm_integrity_resume(struct dm_target *ti)
        } else {
                replay_journal(ic);
                if (ic->mode == 'B') {
-                       int mode;
                        ic->sb->flags |= cpu_to_le32(SB_FLAG_DIRTY_BITMAP);
                        ic->sb->log2_blocks_per_bitmap_bit = ic->log2_blocks_per_bitmap_bit;
                        r = sync_rw_sb(ic, REQ_OP_WRITE, REQ_FUA);
                        if (unlikely(r))
                                dm_integrity_io_error(ic, "writing superblock", r);
 
-                       mode = ic->recalculate_flag ? BITMAP_OP_SET : BITMAP_OP_CLEAR;
-                       block_bitmap_op(ic, ic->journal, 0, ic->provided_data_sectors, mode);
-                       block_bitmap_op(ic, ic->recalc_bitmap, 0, ic->provided_data_sectors, mode);
-                       block_bitmap_op(ic, ic->may_write_bitmap, 0, ic->provided_data_sectors, mode);
+                       block_bitmap_op(ic, ic->journal, 0, ic->provided_data_sectors, BITMAP_OP_CLEAR);
+                       block_bitmap_op(ic, ic->recalc_bitmap, 0, ic->provided_data_sectors, BITMAP_OP_CLEAR);
+                       block_bitmap_op(ic, ic->may_write_bitmap, 0, ic->provided_data_sectors, BITMAP_OP_CLEAR);
+                       if (ic->sb->flags & cpu_to_le32(SB_FLAG_RECALCULATING) &&
+                           le64_to_cpu(ic->sb->recalc_sector) < ic->provided_data_sectors) {
+                               block_bitmap_op(ic, ic->journal, le64_to_cpu(ic->sb->recalc_sector),
+                                               ic->provided_data_sectors - le64_to_cpu(ic->sb->recalc_sector), BITMAP_OP_SET);
+                               block_bitmap_op(ic, ic->recalc_bitmap, le64_to_cpu(ic->sb->recalc_sector),
+                                               ic->provided_data_sectors - le64_to_cpu(ic->sb->recalc_sector), BITMAP_OP_SET);
+                               block_bitmap_op(ic, ic->may_write_bitmap, le64_to_cpu(ic->sb->recalc_sector),
+                                               ic->provided_data_sectors - le64_to_cpu(ic->sb->recalc_sector), BITMAP_OP_SET);
+                       }
                        rw_journal_sectors(ic, REQ_OP_WRITE, REQ_FUA | REQ_SYNC, 0,
                                           ic->n_bitmap_blocks * (BITMAP_BLOCK_SIZE >> SECTOR_SHIFT), NULL);
                }
@@ -2967,7 +2958,7 @@ static void dm_integrity_status(struct dm_target *ti, status_type_t type,
                        DMEMIT(" meta_device:%s", ic->meta_dev->name);
                if (ic->sectors_per_block != 1)
                        DMEMIT(" block_size:%u", ic->sectors_per_block << SECTOR_SHIFT);
-               if (ic->recalculate_flag)
+               if (ic->sb->flags & cpu_to_le32(SB_FLAG_RECALCULATING))
                        DMEMIT(" recalculate");
                DMEMIT(" journal_sectors:%u", ic->initial_sectors - SB_SECTORS);
                DMEMIT(" interleave_sectors:%u", 1U << ic->sb->log2_interleave_sectors);
@@ -3623,6 +3614,7 @@ static int dm_integrity_ctr(struct dm_target *ti, unsigned argc, char **argv)
        }
        ti->private = ic;
        ti->per_io_data_size = sizeof(struct dm_integrity_io);
+       ic->ti = ti;
 
        ic->in_progress = RB_ROOT;
        INIT_LIST_HEAD(&ic->wait_list);
@@ -3836,6 +3828,14 @@ static int dm_integrity_ctr(struct dm_target *ti, unsigned argc, char **argv)
                goto bad;
        }
 
+       ic->offload_wq = alloc_workqueue("dm-integrity-offload", WQ_MEM_RECLAIM,
+                                         METADATA_WORKQUEUE_MAX_ACTIVE);
+       if (!ic->offload_wq) {
+               ti->error = "Cannot allocate workqueue";
+               r = -ENOMEM;
+               goto bad;
+       }
+
        ic->commit_wq = alloc_workqueue("dm-integrity-commit", WQ_MEM_RECLAIM, 1);
        if (!ic->commit_wq) {
                ti->error = "Cannot allocate workqueue";
@@ -4140,6 +4140,8 @@ static void dm_integrity_dtr(struct dm_target *ti)
                destroy_workqueue(ic->metadata_wq);
        if (ic->wait_wq)
                destroy_workqueue(ic->wait_wq);
+       if (ic->offload_wq)
+               destroy_workqueue(ic->offload_wq);
        if (ic->commit_wq)
                destroy_workqueue(ic->commit_wq);
        if (ic->writer_wq)
@@ -4200,7 +4202,7 @@ static void dm_integrity_dtr(struct dm_target *ti)
 
 static struct target_type integrity_target = {
        .name                   = "integrity",
-       .version                = {1, 4, 0},
+       .version                = {1, 5, 0},
        .module                 = THIS_MODULE,
        .features               = DM_TARGET_SINGLETON | DM_TARGET_INTEGRITY,
        .ctr                    = dm_integrity_ctr,
index 2bc18c9c3abcfc60e0763976704c878aea7fd13f..58fd137b6ae1a041c8503a62bef175a27a70ff16 100644 (file)
@@ -2053,7 +2053,7 @@ static int multipath_busy(struct dm_target *ti)
  *---------------------------------------------------------------*/
 static struct target_type multipath_target = {
        .name = "multipath",
-       .version = {1, 13, 0},
+       .version = {1, 14, 0},
        .features = DM_TARGET_SINGLETON | DM_TARGET_IMMUTABLE |
                    DM_TARGET_PASSES_INTEGRITY,
        .module = THIS_MODULE,
index fc9947d6210c202273d2c44a3198e88429530e76..76b6b323bf4bd560f1b83eead235ffcaf373ad86 100644 (file)
@@ -960,9 +960,9 @@ int dm_pool_metadata_close(struct dm_pool_metadata *pmd)
                        DMWARN("%s: __commit_transaction() failed, error = %d",
                               __func__, r);
        }
+       pmd_write_unlock(pmd);
        if (!pmd->fail_io)
                __destroy_persistent_data_objects(pmd);
-       pmd_write_unlock(pmd);
 
        kfree(pmd);
        return 0;
index 0d61e9c6798650bc46bc34aa98b29564fe21d9c9..eec9f252e9354bd8746e3f647ff1b1e8eb610aef 100644 (file)
@@ -1221,7 +1221,7 @@ static int verity_ctr(struct dm_target *ti, unsigned argc, char **argv)
 
 static struct target_type verity_target = {
        .name           = "verity",
-       .version        = {1, 5, 0},
+       .version        = {1, 6, 0},
        .module         = THIS_MODULE,
        .ctr            = verity_ctr,
        .dtr            = verity_dtr,
index b9e27e37a94373c1cbc8ca52f3b64c0d72d46228..a09bdc000e6462738be71b70686d2a0d67ab3009 100644 (file)
@@ -625,6 +625,12 @@ static void writecache_add_to_freelist(struct dm_writecache *wc, struct wc_entry
        wc->freelist_size++;
 }
 
+static inline void writecache_verify_watermark(struct dm_writecache *wc)
+{
+       if (unlikely(wc->freelist_size + wc->writeback_size <= wc->freelist_high_watermark))
+               queue_work(wc->writeback_wq, &wc->writeback_work);
+}
+
 static struct wc_entry *writecache_pop_from_freelist(struct dm_writecache *wc, sector_t expected_sector)
 {
        struct wc_entry *e;
@@ -650,8 +656,8 @@ static struct wc_entry *writecache_pop_from_freelist(struct dm_writecache *wc, s
                list_del(&e->lru);
        }
        wc->freelist_size--;
-       if (unlikely(wc->freelist_size + wc->writeback_size <= wc->freelist_high_watermark))
-               queue_work(wc->writeback_wq, &wc->writeback_work);
+
+       writecache_verify_watermark(wc);
 
        return e;
 }
@@ -842,7 +848,7 @@ static void writecache_suspend(struct dm_target *ti)
        }
        wc_unlock(wc);
 
-       flush_workqueue(wc->writeback_wq);
+       drain_workqueue(wc->writeback_wq);
 
        wc_lock(wc);
        if (flush_on_suspend)
@@ -965,6 +971,8 @@ static void writecache_resume(struct dm_target *ti)
                writecache_commit_flushed(wc, false);
        }
 
+       writecache_verify_watermark(wc);
+
        wc_unlock(wc);
 }
 
@@ -2312,7 +2320,7 @@ static void writecache_status(struct dm_target *ti, status_type_t type,
 
 static struct target_type writecache_target = {
        .name                   = "writecache",
-       .version                = {1, 1, 1},
+       .version                = {1, 2, 0},
        .module                 = THIS_MODULE,
        .ctr                    = writecache_ctr,
        .dtr                    = writecache_dtr,
index 70a1063161c04aef304eb3e008c0842f0ccf5e62..f4f83d39b3dcf03d2736fa762ded17160e0e56a2 100644 (file)
@@ -533,8 +533,9 @@ static int dmz_queue_chunk_work(struct dmz_target *dmz, struct bio *bio)
 
        /* Get the BIO chunk work. If one is not active yet, create one */
        cw = radix_tree_lookup(&dmz->chunk_rxtree, chunk);
-       if (!cw) {
-
+       if (cw) {
+               dmz_get_chunk_work(cw);
+       } else {
                /* Create a new chunk work */
                cw = kmalloc(sizeof(struct dm_chunk_work), GFP_NOIO);
                if (unlikely(!cw)) {
@@ -543,7 +544,7 @@ static int dmz_queue_chunk_work(struct dmz_target *dmz, struct bio *bio)
                }
 
                INIT_WORK(&cw->work, dmz_chunk_work);
-               refcount_set(&cw->refcount, 0);
+               refcount_set(&cw->refcount, 1);
                cw->target = dmz;
                cw->chunk = chunk;
                bio_list_init(&cw->bio_list);
@@ -556,7 +557,6 @@ static int dmz_queue_chunk_work(struct dmz_target *dmz, struct bio *bio)
        }
 
        bio_list_add(&cw->bio_list, bio);
-       dmz_get_chunk_work(cw);
 
        dmz_reclaim_bio_acc(dmz->reclaim);
        if (queue_work(dmz->chunk_wq, &cw->work))
@@ -967,7 +967,7 @@ static int dmz_iterate_devices(struct dm_target *ti,
 
 static struct target_type dmz_type = {
        .name            = "zoned",
-       .version         = {1, 0, 0},
+       .version         = {1, 1, 0},
        .features        = DM_TARGET_SINGLETON | DM_TARGET_ZONED_HM,
        .module          = THIS_MODULE,
        .ctr             = dmz_ctr,
index b89f07ee2efff2c19207f2b820011af901e3a3cb..0413018c83058f0907795484064e4373d8775215 100644 (file)
@@ -1788,7 +1788,8 @@ static int dm_any_congested(void *congested_data, int bdi_bits)
                         * With request-based DM we only need to check the
                         * top-level queue for congestion.
                         */
-                       r = md->queue->backing_dev_info->wb.state & bdi_bits;
+                       struct backing_dev_info *bdi = md->queue->backing_dev_info;
+                       r = bdi->wb.congested->state & bdi_bits;
                } else {
                        map = dm_get_live_table_fast(md);
                        if (map)
@@ -1854,15 +1855,6 @@ static const struct dax_operations dm_dax_ops;
 
 static void dm_wq_work(struct work_struct *work);
 
-static void dm_init_normal_md_queue(struct mapped_device *md)
-{
-       /*
-        * Initialize aspects of queue that aren't relevant for blk-mq
-        */
-       md->queue->backing_dev_info->congested_data = md;
-       md->queue->backing_dev_info->congested_fn = dm_any_congested;
-}
-
 static void cleanup_mapped_device(struct mapped_device *md)
 {
        if (md->wq)
@@ -2249,6 +2241,12 @@ struct queue_limits *dm_get_queue_limits(struct mapped_device *md)
 }
 EXPORT_SYMBOL_GPL(dm_get_queue_limits);
 
+static void dm_init_congested_fn(struct mapped_device *md)
+{
+       md->queue->backing_dev_info->congested_data = md;
+       md->queue->backing_dev_info->congested_fn = dm_any_congested;
+}
+
 /*
  * Setup the DM device's queue based on md's type
  */
@@ -2265,11 +2263,12 @@ int dm_setup_md_queue(struct mapped_device *md, struct dm_table *t)
                        DMERR("Cannot initialize queue for request-based dm-mq mapped device");
                        return r;
                }
+               dm_init_congested_fn(md);
                break;
        case DM_TYPE_BIO_BASED:
        case DM_TYPE_DAX_BIO_BASED:
        case DM_TYPE_NVME_BIO_BASED:
-               dm_init_normal_md_queue(md);
+               dm_init_congested_fn(md);
                break;
        case DM_TYPE_NONE:
                WARN_ON_ONCE(true);
@@ -2368,6 +2367,7 @@ static void __dm_destroy(struct mapped_device *md, bool wait)
        map = dm_get_live_table(md, &srcu_idx);
        if (!dm_suspended_md(md)) {
                dm_table_presuspend_targets(map);
+               set_bit(DMF_SUSPENDED, &md->flags);
                dm_table_postsuspend_targets(map);
        }
        /* dm_put_live_table must be before msleep, otherwise deadlock is possible */
index 7c429ce98bae66424c7e70a36e3c29166fa17fba..668770e9f609000ffb15c834a059a14ea1750d51 100644 (file)
@@ -639,9 +639,9 @@ int media_get_pad_index(struct media_entity *entity, bool is_sink,
                return -EINVAL;
 
        for (i = 0; i < entity->num_pads; i++) {
-               if (entity->pads[i].flags == MEDIA_PAD_FL_SINK)
+               if (entity->pads[i].flags & MEDIA_PAD_FL_SINK)
                        pad_is_sink = true;
-               else if (entity->pads[i].flags == MEDIA_PAD_FL_SOURCE)
+               else if (entity->pads[i].flags & MEDIA_PAD_FL_SOURCE)
                        pad_is_sink = false;
                else
                        continue;       /* This is an error! */
index 3c93d9232c3cf55e3bc52ae5284b8abd79fd4baa..b6e39fbd8ad5dd081381e481a9ab054e0e7da441 100644 (file)
@@ -27,17 +27,17 @@ static const struct v4l2_fwht_pixfmt_info v4l2_fwht_pixfmts[] = {
        { V4L2_PIX_FMT_BGR24,   3, 3, 1, 3, 3, 1, 1, 3, 1, FWHT_FL_PIXENC_RGB},
        { V4L2_PIX_FMT_RGB24,   3, 3, 1, 3, 3, 1, 1, 3, 1, FWHT_FL_PIXENC_RGB},
        { V4L2_PIX_FMT_HSV24,   3, 3, 1, 3, 3, 1, 1, 3, 1, FWHT_FL_PIXENC_HSV},
-       { V4L2_PIX_FMT_BGR32,   4, 4, 1, 4, 4, 1, 1, 3, 1, FWHT_FL_PIXENC_RGB},
-       { V4L2_PIX_FMT_XBGR32,  4, 4, 1, 4, 4, 1, 1, 3, 1, FWHT_FL_PIXENC_RGB},
+       { V4L2_PIX_FMT_BGR32,   4, 4, 1, 4, 4, 1, 1, 4, 1, FWHT_FL_PIXENC_RGB},
+       { V4L2_PIX_FMT_XBGR32,  4, 4, 1, 4, 4, 1, 1, 4, 1, FWHT_FL_PIXENC_RGB},
        { V4L2_PIX_FMT_ABGR32,  4, 4, 1, 4, 4, 1, 1, 4, 1, FWHT_FL_PIXENC_RGB},
-       { V4L2_PIX_FMT_RGB32,   4, 4, 1, 4, 4, 1, 1, 3, 1, FWHT_FL_PIXENC_RGB},
-       { V4L2_PIX_FMT_XRGB32,  4, 4, 1, 4, 4, 1, 1, 3, 1, FWHT_FL_PIXENC_RGB},
+       { V4L2_PIX_FMT_RGB32,   4, 4, 1, 4, 4, 1, 1, 4, 1, FWHT_FL_PIXENC_RGB},
+       { V4L2_PIX_FMT_XRGB32,  4, 4, 1, 4, 4, 1, 1, 4, 1, FWHT_FL_PIXENC_RGB},
        { V4L2_PIX_FMT_ARGB32,  4, 4, 1, 4, 4, 1, 1, 4, 1, FWHT_FL_PIXENC_RGB},
-       { V4L2_PIX_FMT_BGRX32,  4, 4, 1, 4, 4, 1, 1, 3, 1, FWHT_FL_PIXENC_RGB},
+       { V4L2_PIX_FMT_BGRX32,  4, 4, 1, 4, 4, 1, 1, 4, 1, FWHT_FL_PIXENC_RGB},
        { V4L2_PIX_FMT_BGRA32,  4, 4, 1, 4, 4, 1, 1, 4, 1, FWHT_FL_PIXENC_RGB},
-       { V4L2_PIX_FMT_RGBX32,  4, 4, 1, 4, 4, 1, 1, 3, 1, FWHT_FL_PIXENC_RGB},
+       { V4L2_PIX_FMT_RGBX32,  4, 4, 1, 4, 4, 1, 1, 4, 1, FWHT_FL_PIXENC_RGB},
        { V4L2_PIX_FMT_RGBA32,  4, 4, 1, 4, 4, 1, 1, 4, 1, FWHT_FL_PIXENC_RGB},
-       { V4L2_PIX_FMT_HSV32,   4, 4, 1, 4, 4, 1, 1, 3, 1, FWHT_FL_PIXENC_HSV},
+       { V4L2_PIX_FMT_HSV32,   4, 4, 1, 4, 4, 1, 1, 4, 1, FWHT_FL_PIXENC_HSV},
        { V4L2_PIX_FMT_GREY,    1, 1, 1, 1, 0, 1, 1, 1, 1, FWHT_FL_PIXENC_RGB},
 };
 
@@ -175,22 +175,14 @@ static int prepare_raw_frame(struct fwht_raw_frame *rf,
        case V4L2_PIX_FMT_RGB32:
        case V4L2_PIX_FMT_XRGB32:
        case V4L2_PIX_FMT_HSV32:
-               rf->cr = rf->luma + 1;
-               rf->cb = rf->cr + 2;
-               rf->luma += 2;
-               break;
-       case V4L2_PIX_FMT_BGR32:
-       case V4L2_PIX_FMT_XBGR32:
-               rf->cb = rf->luma;
-               rf->cr = rf->cb + 2;
-               rf->luma++;
-               break;
        case V4L2_PIX_FMT_ARGB32:
                rf->alpha = rf->luma;
                rf->cr = rf->luma + 1;
                rf->cb = rf->cr + 2;
                rf->luma += 2;
                break;
+       case V4L2_PIX_FMT_BGR32:
+       case V4L2_PIX_FMT_XBGR32:
        case V4L2_PIX_FMT_ABGR32:
                rf->cb = rf->luma;
                rf->cr = rf->cb + 2;
@@ -198,10 +190,6 @@ static int prepare_raw_frame(struct fwht_raw_frame *rf,
                rf->alpha = rf->cr + 1;
                break;
        case V4L2_PIX_FMT_BGRX32:
-               rf->cb = rf->luma + 1;
-               rf->cr = rf->cb + 2;
-               rf->luma += 2;
-               break;
        case V4L2_PIX_FMT_BGRA32:
                rf->alpha = rf->luma;
                rf->cb = rf->luma + 1;
@@ -209,10 +197,6 @@ static int prepare_raw_frame(struct fwht_raw_frame *rf,
                rf->luma += 2;
                break;
        case V4L2_PIX_FMT_RGBX32:
-               rf->cr = rf->luma;
-               rf->cb = rf->cr + 2;
-               rf->luma++;
-               break;
        case V4L2_PIX_FMT_RGBA32:
                rf->alpha = rf->luma + 3;
                rf->cr = rf->luma;
index afda438d4e0ac5c81e66ebc5626960538918d53f..0655aa9ecf283a6a73231d12413300a4f7a4c3fa 100644 (file)
@@ -635,8 +635,6 @@ static void pulse8_cec_adap_free(struct cec_adapter *adap)
        cancel_delayed_work_sync(&pulse8->ping_eeprom_work);
        cancel_work_sync(&pulse8->irq_work);
        cancel_work_sync(&pulse8->tx_work);
-       serio_close(pulse8->serio);
-       serio_set_drvdata(pulse8->serio, NULL);
        kfree(pulse8);
 }
 
@@ -652,6 +650,9 @@ static void pulse8_disconnect(struct serio *serio)
        struct pulse8 *pulse8 = serio_get_drvdata(serio);
 
        cec_unregister_adapter(pulse8->adap);
+       pulse8->serio = NULL;
+       serio_set_drvdata(serio, NULL);
+       serio_close(serio);
 }
 
 static int pulse8_setup(struct pulse8 *pulse8, struct serio *serio,
@@ -840,6 +841,8 @@ static int pulse8_connect(struct serio *serio, struct serio_driver *drv)
        serio_set_drvdata(serio, pulse8);
        INIT_WORK(&pulse8->irq_work, pulse8_irq_work_handler);
        INIT_WORK(&pulse8->tx_work, pulse8_tx_work_handler);
+       INIT_DELAYED_WORK(&pulse8->ping_eeprom_work,
+                         pulse8_ping_eeprom_work_handler);
        mutex_init(&pulse8->lock);
        spin_lock_init(&pulse8->msg_lock);
        pulse8->config_pending = false;
@@ -865,17 +868,16 @@ static int pulse8_connect(struct serio *serio, struct serio_driver *drv)
                pulse8->restoring_config = true;
        }
 
-       INIT_DELAYED_WORK(&pulse8->ping_eeprom_work,
-                         pulse8_ping_eeprom_work_handler);
        schedule_delayed_work(&pulse8->ping_eeprom_work, PING_PERIOD);
 
        return 0;
 
 close_serio:
+       pulse8->serio = NULL;
+       serio_set_drvdata(serio, NULL);
        serio_close(serio);
 delete_adap:
        cec_delete_adapter(pulse8->adap);
-       serio_set_drvdata(serio, NULL);
 free_device:
        kfree(pulse8);
        return err;
index 1afd9c6ad90848d78c3969f9ce1ad0063858062e..cc34c5ab70099b13968d9c1806fcc29c26ca4993 100644 (file)
@@ -880,12 +880,12 @@ int v4l2_m2m_register_media_controller(struct v4l2_m2m_dev *m2m_dev,
                goto err_rel_entity1;
 
        /* Connect the three entities */
-       ret = media_create_pad_link(m2m_dev->source, 0, &m2m_dev->proc, 1,
+       ret = media_create_pad_link(m2m_dev->source, 0, &m2m_dev->proc, 0,
                        MEDIA_LNK_FL_IMMUTABLE | MEDIA_LNK_FL_ENABLED);
        if (ret)
                goto err_rel_entity2;
 
-       ret = media_create_pad_link(&m2m_dev->proc, 0, &m2m_dev->sink, 0,
+       ret = media_create_pad_link(&m2m_dev->proc, 1, &m2m_dev->sink, 0,
                        MEDIA_LNK_FL_IMMUTABLE | MEDIA_LNK_FL_ENABLED);
        if (ret)
                goto err_rm_links0;
index 25e5f24b3fecd9ee227cec50ae8029716fc80398..5bdf574723144c8952e6b2cd0e83207e8b5ac45e 100644 (file)
@@ -2112,8 +2112,8 @@ static int altera_execute(struct altera_state *astate,
        return status;
 }
 
-static int altera_get_note(u8 *p, s32 program_size,
-                       s32 *offset, char *key, char *value, int length)
+static int altera_get_note(u8 *p, s32 program_size, s32 *offset,
+                          char *key, char *value, int keylen, int vallen)
 /*
  * Gets key and value of NOTE fields in the JBC file.
  * Can be called in two modes:  if offset pointer is NULL,
@@ -2170,7 +2170,7 @@ static int altera_get_note(u8 *p, s32 program_size,
                                                &p[note_table + (8 * i) + 4])];
 
                                if (value != NULL)
-                                       strlcpy(value, value_ptr, length);
+                                       strlcpy(value, value_ptr, vallen);
 
                        }
                }
@@ -2189,13 +2189,13 @@ static int altera_get_note(u8 *p, s32 program_size,
                                strlcpy(key, &p[note_strings +
                                                get_unaligned_be32(
                                                &p[note_table + (8 * i)])],
-                                       length);
+                                       keylen);
 
                        if (value != NULL)
                                strlcpy(value, &p[note_strings +
                                                get_unaligned_be32(
                                                &p[note_table + (8 * i) + 4])],
-                                       length);
+                                       vallen);
 
                        *offset = i + 1;
                }
@@ -2449,7 +2449,7 @@ int altera_init(struct altera_config *config, const struct firmware *fw)
                        __func__, (format_version == 2) ? "Jam STAPL" :
                                                "pre-standardized Jam 1.1");
                while (altera_get_note((u8 *)fw->data, fw->size,
-                                       &offset, key, value, 256) == 0)
+                                       &offset, key, value, 32, 256) == 0)
                        printk(KERN_INFO "%s: NOTE \"%s\" = \"%s\"\n",
                                        __func__, key, value);
        }
index acce8781c456cd7a3e36ca07bc8d18946a7fefd1..f5c7a845cd7bf24d9aec4778d2e155d630df1b6f 100644 (file)
@@ -24,8 +24,6 @@ static int arm_pmu_acpi_register_irq(int cpu)
        int gsi, trigger;
 
        gicc = acpi_cpu_get_madt_gicc(cpu);
-       if (WARN_ON(!gicc))
-               return -EINVAL;
 
        gsi = gicc->performance_interrupt;
 
@@ -64,11 +62,10 @@ static void arm_pmu_acpi_unregister_irq(int cpu)
        int gsi;
 
        gicc = acpi_cpu_get_madt_gicc(cpu);
-       if (!gicc)
-               return;
 
        gsi = gicc->performance_interrupt;
-       acpi_unregister_gsi(gsi);
+       if (gsi)
+               acpi_unregister_gsi(gsi);
 }
 
 #if IS_ENABLED(CONFIG_ARM_SPE_PMU)
index 95dca2cb526500325dc56e9dd6a4f55e620a6eb2..90884d14f95faea01082bfd82c587ecedbd31667 100644 (file)
@@ -388,9 +388,10 @@ static void ddr_perf_counter_enable(struct ddr_pmu *pmu, int config,
 
        if (enable) {
                /*
-                * must disable first, then enable again
-                * otherwise, cycle counter will not work
-                * if previous state is enabled.
+                * cycle counter is special which should firstly write 0 then
+                * write 1 into CLEAR bit to clear it. Other counters only
+                * need write 0 into CLEAR bit and it turns out to be 1 by
+                * hardware. Below enable flow is harmless for all counters.
                 */
                writel(0, pmu->base + reg);
                val = CNTL_EN | CNTL_CLEAR;
@@ -398,7 +399,8 @@ static void ddr_perf_counter_enable(struct ddr_pmu *pmu, int config,
                writel(val, pmu->base + reg);
        } else {
                /* Disable counter */
-               writel(0, pmu->base + reg);
+               val = readl_relaxed(pmu->base + reg) & CNTL_EN_MASK;
+               writel(val, pmu->base + reg);
        }
 }
 
index 1169f3e83a6f16b661bd66c7490ddfe9842aac92..b1c04f71a31d9e6e5d0c33ad6b13f7c9e5d81159 100644 (file)
@@ -49,7 +49,7 @@
 #define SUNXI_LOS_BIAS(n)              ((n) << 3)
 #define SUNXI_LOS_BIAS_MASK            GENMASK(5, 3)
 #define SUNXI_TXVBOOSTLVL(n)           ((n) << 0)
-#define SUNXI_TXVBOOSTLVL_MASK         GENMASK(0, 2)
+#define SUNXI_TXVBOOSTLVL_MASK         GENMASK(2, 0)
 
 struct sun50i_usb3_phy {
        struct phy *phy;
index 4710cfcc3037f346fe08035e3f65eef8a479f890..18251f232172b7c544c823cab82e05ee601ea2b9 100644 (file)
@@ -186,29 +186,6 @@ enum sata_phy_ctrl_regs {
        PHY_CTRL_1_RESET                        = BIT(0),
 };
 
-static inline void __iomem *brcm_sata_pcb_base(struct brcm_sata_port *port)
-{
-       struct brcm_sata_phy *priv = port->phy_priv;
-       u32 size = 0;
-
-       switch (priv->version) {
-       case BRCM_SATA_PHY_STB_16NM:
-       case BRCM_SATA_PHY_STB_28NM:
-       case BRCM_SATA_PHY_IPROC_NS2:
-       case BRCM_SATA_PHY_DSL_28NM:
-               size = SATA_PCB_REG_28NM_SPACE_SIZE;
-               break;
-       case BRCM_SATA_PHY_STB_40NM:
-               size = SATA_PCB_REG_40NM_SPACE_SIZE;
-               break;
-       default:
-               dev_err(priv->dev, "invalid phy version\n");
-               break;
-       }
-
-       return priv->phy_base + (port->portnum * size);
-}
-
 static inline void __iomem *brcm_sata_ctrl_base(struct brcm_sata_port *port)
 {
        struct brcm_sata_phy *priv = port->phy_priv;
@@ -226,19 +203,34 @@ static inline void __iomem *brcm_sata_ctrl_base(struct brcm_sata_port *port)
        return priv->ctrl_base + (port->portnum * size);
 }
 
-static void brcm_sata_phy_wr(void __iomem *pcb_base, u32 bank,
+static void brcm_sata_phy_wr(struct brcm_sata_port *port, u32 bank,
                             u32 ofs, u32 msk, u32 value)
 {
+       struct brcm_sata_phy *priv = port->phy_priv;
+       void __iomem *pcb_base = priv->phy_base;
        u32 tmp;
 
+       if (priv->version == BRCM_SATA_PHY_STB_40NM)
+               bank += (port->portnum * SATA_PCB_REG_40NM_SPACE_SIZE);
+       else
+               pcb_base += (port->portnum * SATA_PCB_REG_28NM_SPACE_SIZE);
+
        writel(bank, pcb_base + SATA_PCB_BANK_OFFSET);
        tmp = readl(pcb_base + SATA_PCB_REG_OFFSET(ofs));
        tmp = (tmp & msk) | value;
        writel(tmp, pcb_base + SATA_PCB_REG_OFFSET(ofs));
 }
 
-static u32 brcm_sata_phy_rd(void __iomem *pcb_base, u32 bank, u32 ofs)
+static u32 brcm_sata_phy_rd(struct brcm_sata_port *port, u32 bank, u32 ofs)
 {
+       struct brcm_sata_phy *priv = port->phy_priv;
+       void __iomem *pcb_base = priv->phy_base;
+
+       if (priv->version == BRCM_SATA_PHY_STB_40NM)
+               bank += (port->portnum * SATA_PCB_REG_40NM_SPACE_SIZE);
+       else
+               pcb_base += (port->portnum * SATA_PCB_REG_28NM_SPACE_SIZE);
+
        writel(bank, pcb_base + SATA_PCB_BANK_OFFSET);
        return readl(pcb_base + SATA_PCB_REG_OFFSET(ofs));
 }
@@ -250,16 +242,15 @@ static u32 brcm_sata_phy_rd(void __iomem *pcb_base, u32 bank, u32 ofs)
 
 static void brcm_stb_sata_ssc_init(struct brcm_sata_port *port)
 {
-       void __iomem *base = brcm_sata_pcb_base(port);
        struct brcm_sata_phy *priv = port->phy_priv;
        u32 tmp;
 
        /* override the TX spread spectrum setting */
        tmp = TXPMD_CONTROL1_TX_SSC_EN_FRC_VAL | TXPMD_CONTROL1_TX_SSC_EN_FRC;
-       brcm_sata_phy_wr(base, TXPMD_REG_BANK, TXPMD_CONTROL1, ~tmp, tmp);
+       brcm_sata_phy_wr(port, TXPMD_REG_BANK, TXPMD_CONTROL1, ~tmp, tmp);
 
        /* set fixed min freq */
-       brcm_sata_phy_wr(base, TXPMD_REG_BANK, TXPMD_TX_FREQ_CTRL_CONTROL2,
+       brcm_sata_phy_wr(port, TXPMD_REG_BANK, TXPMD_TX_FREQ_CTRL_CONTROL2,
                         ~TXPMD_TX_FREQ_CTRL_CONTROL2_FMIN_MASK,
                         STB_FMIN_VAL_DEFAULT);
 
@@ -271,7 +262,7 @@ static void brcm_stb_sata_ssc_init(struct brcm_sata_port *port)
                tmp = STB_FMAX_VAL_DEFAULT;
        }
 
-       brcm_sata_phy_wr(base, TXPMD_REG_BANK, TXPMD_TX_FREQ_CTRL_CONTROL3,
+       brcm_sata_phy_wr(port, TXPMD_REG_BANK, TXPMD_TX_FREQ_CTRL_CONTROL3,
                          ~TXPMD_TX_FREQ_CTRL_CONTROL3_FMAX_MASK, tmp);
 }
 
@@ -280,7 +271,6 @@ static void brcm_stb_sata_ssc_init(struct brcm_sata_port *port)
 
 static int brcm_stb_sata_rxaeq_init(struct brcm_sata_port *port)
 {
-       void __iomem *base = brcm_sata_pcb_base(port);
        u32 tmp = 0, reg = 0;
 
        switch (port->rxaeq_mode) {
@@ -301,8 +291,8 @@ static int brcm_stb_sata_rxaeq_init(struct brcm_sata_port *port)
                break;
        }
 
-       brcm_sata_phy_wr(base, AEQRX_REG_BANK_0, reg, ~tmp, tmp);
-       brcm_sata_phy_wr(base, AEQRX_REG_BANK_1, reg, ~tmp, tmp);
+       brcm_sata_phy_wr(port, AEQRX_REG_BANK_0, reg, ~tmp, tmp);
+       brcm_sata_phy_wr(port, AEQRX_REG_BANK_1, reg, ~tmp, tmp);
 
        return 0;
 }
@@ -316,18 +306,17 @@ static int brcm_stb_sata_init(struct brcm_sata_port *port)
 
 static int brcm_stb_sata_16nm_ssc_init(struct brcm_sata_port *port)
 {
-       void __iomem *base = brcm_sata_pcb_base(port);
        u32 tmp, value;
 
        /* Reduce CP tail current to 1/16th of its default value */
-       brcm_sata_phy_wr(base, PLL1_REG_BANK, PLL1_ACTRL6, 0, 0x141);
+       brcm_sata_phy_wr(port, PLL1_REG_BANK, PLL1_ACTRL6, 0, 0x141);
 
        /* Turn off CP tail current boost */
-       brcm_sata_phy_wr(base, PLL1_REG_BANK, PLL1_ACTRL8, 0, 0xc006);
+       brcm_sata_phy_wr(port, PLL1_REG_BANK, PLL1_ACTRL8, 0, 0xc006);
 
        /* Set a specific AEQ equalizer value */
        tmp = AEQ_FRC_EQ_FORCE_VAL | AEQ_FRC_EQ_FORCE;
-       brcm_sata_phy_wr(base, AEQRX_REG_BANK_0, AEQ_FRC_EQ,
+       brcm_sata_phy_wr(port, AEQRX_REG_BANK_0, AEQ_FRC_EQ,
                         ~(tmp | AEQ_RFZ_FRC_VAL |
                           AEQ_FRC_EQ_VAL_MASK << AEQ_FRC_EQ_VAL_SHIFT),
                         tmp | 32 << AEQ_FRC_EQ_VAL_SHIFT);
@@ -337,7 +326,7 @@ static int brcm_stb_sata_16nm_ssc_init(struct brcm_sata_port *port)
                value = 0x52;
        else
                value = 0;
-       brcm_sata_phy_wr(base, RXPMD_REG_BANK, RXPMD_RX_CDR_CONTROL1,
+       brcm_sata_phy_wr(port, RXPMD_REG_BANK, RXPMD_RX_CDR_CONTROL1,
                         ~RXPMD_RX_PPM_VAL_MASK, value);
 
        /* Set proportional loop bandwith Gen1/2/3 */
@@ -352,7 +341,7 @@ static int brcm_stb_sata_16nm_ssc_init(struct brcm_sata_port *port)
                value = 1 << RXPMD_G1_CDR_PROP_BW_SHIFT |
                        1 << RXPMD_G2_CDR_PROP_BW_SHIFT |
                        1 << RXPMD_G3_CDR_PROB_BW_SHIFT;
-       brcm_sata_phy_wr(base, RXPMD_REG_BANK, RXPMD_RX_CDR_CDR_PROP_BW, ~tmp,
+       brcm_sata_phy_wr(port, RXPMD_REG_BANK, RXPMD_RX_CDR_CDR_PROP_BW, ~tmp,
                         value);
 
        /* Set CDR integral loop acquisition bandwidth for Gen1/2/3 */
@@ -365,7 +354,7 @@ static int brcm_stb_sata_16nm_ssc_init(struct brcm_sata_port *port)
                        1 << RXPMD_G3_CDR_ACQ_INT_BW_SHIFT;
        else
                value = 0;
-       brcm_sata_phy_wr(base, RXPMD_REG_BANK, RXPMD_RX_CDR_CDR_ACQ_INTEG_BW,
+       brcm_sata_phy_wr(port, RXPMD_REG_BANK, RXPMD_RX_CDR_CDR_ACQ_INTEG_BW,
                         ~tmp, value);
 
        /* Set CDR integral loop locking bandwidth to 1 for Gen 1/2/3 */
@@ -378,7 +367,7 @@ static int brcm_stb_sata_16nm_ssc_init(struct brcm_sata_port *port)
                        1 << RXPMD_G3_CDR_LOCK_INT_BW_SHIFT;
        else
                value = 0;
-       brcm_sata_phy_wr(base, RXPMD_REG_BANK, RXPMD_RX_CDR_CDR_LOCK_INTEG_BW,
+       brcm_sata_phy_wr(port, RXPMD_REG_BANK, RXPMD_RX_CDR_CDR_LOCK_INTEG_BW,
                         ~tmp, value);
 
        /* Set no guard band and clamp CDR */
@@ -387,11 +376,11 @@ static int brcm_stb_sata_16nm_ssc_init(struct brcm_sata_port *port)
                value = 0x51;
        else
                value = 0;
-       brcm_sata_phy_wr(base, RXPMD_REG_BANK, RXPMD_RX_FREQ_MON_CONTROL1,
+       brcm_sata_phy_wr(port, RXPMD_REG_BANK, RXPMD_RX_FREQ_MON_CONTROL1,
                         ~tmp, RXPMD_MON_CORRECT_EN | value);
 
        /* Turn on/off SSC */
-       brcm_sata_phy_wr(base, TX_REG_BANK, TX_ACTRL5, ~TX_ACTRL5_SSC_EN,
+       brcm_sata_phy_wr(port, TX_REG_BANK, TX_ACTRL5, ~TX_ACTRL5_SSC_EN,
                         port->ssc_en ? TX_ACTRL5_SSC_EN : 0);
 
        return 0;
@@ -411,7 +400,6 @@ static int brcm_ns2_sata_init(struct brcm_sata_port *port)
 {
        int try;
        unsigned int val;
-       void __iomem *base = brcm_sata_pcb_base(port);
        void __iomem *ctrl_base = brcm_sata_ctrl_base(port);
        struct device *dev = port->phy_priv->dev;
 
@@ -421,24 +409,24 @@ static int brcm_ns2_sata_init(struct brcm_sata_port *port)
        val |= (0x4 << OOB_CTRL1_BURST_MIN_SHIFT);
        val |= (0x9 << OOB_CTRL1_WAKE_IDLE_MAX_SHIFT);
        val |= (0x3 << OOB_CTRL1_WAKE_IDLE_MIN_SHIFT);
-       brcm_sata_phy_wr(base, OOB_REG_BANK, OOB_CTRL1, 0x0, val);
+       brcm_sata_phy_wr(port, OOB_REG_BANK, OOB_CTRL1, 0x0, val);
        val = 0x0;
        val |= (0x1b << OOB_CTRL2_RESET_IDLE_MAX_SHIFT);
        val |= (0x2 << OOB_CTRL2_BURST_CNT_SHIFT);
        val |= (0x9 << OOB_CTRL2_RESET_IDLE_MIN_SHIFT);
-       brcm_sata_phy_wr(base, OOB_REG_BANK, OOB_CTRL2, 0x0, val);
+       brcm_sata_phy_wr(port, OOB_REG_BANK, OOB_CTRL2, 0x0, val);
 
        /* Configure PHY PLL register bank 1 */
        val = NS2_PLL1_ACTRL2_MAGIC;
-       brcm_sata_phy_wr(base, PLL1_REG_BANK, PLL1_ACTRL2, 0x0, val);
+       brcm_sata_phy_wr(port, PLL1_REG_BANK, PLL1_ACTRL2, 0x0, val);
        val = NS2_PLL1_ACTRL3_MAGIC;
-       brcm_sata_phy_wr(base, PLL1_REG_BANK, PLL1_ACTRL3, 0x0, val);
+       brcm_sata_phy_wr(port, PLL1_REG_BANK, PLL1_ACTRL3, 0x0, val);
        val = NS2_PLL1_ACTRL4_MAGIC;
-       brcm_sata_phy_wr(base, PLL1_REG_BANK, PLL1_ACTRL4, 0x0, val);
+       brcm_sata_phy_wr(port, PLL1_REG_BANK, PLL1_ACTRL4, 0x0, val);
 
        /* Configure PHY BLOCK0 register bank */
        /* Set oob_clk_sel to refclk/2 */
-       brcm_sata_phy_wr(base, BLOCK0_REG_BANK, BLOCK0_SPARE,
+       brcm_sata_phy_wr(port, BLOCK0_REG_BANK, BLOCK0_SPARE,
                         ~BLOCK0_SPARE_OOB_CLK_SEL_MASK,
                         BLOCK0_SPARE_OOB_CLK_SEL_REFBY2);
 
@@ -451,7 +439,7 @@ static int brcm_ns2_sata_init(struct brcm_sata_port *port)
        /* Wait for PHY PLL lock by polling pll_lock bit */
        try = 50;
        while (try) {
-               val = brcm_sata_phy_rd(base, BLOCK0_REG_BANK,
+               val = brcm_sata_phy_rd(port, BLOCK0_REG_BANK,
                                        BLOCK0_XGXSSTATUS);
                if (val & BLOCK0_XGXSSTATUS_PLL_LOCK)
                        break;
@@ -471,9 +459,7 @@ static int brcm_ns2_sata_init(struct brcm_sata_port *port)
 
 static int brcm_nsp_sata_init(struct brcm_sata_port *port)
 {
-       struct brcm_sata_phy *priv = port->phy_priv;
        struct device *dev = port->phy_priv->dev;
-       void __iomem *base = priv->phy_base;
        unsigned int oob_bank;
        unsigned int val, try;
 
@@ -490,36 +476,36 @@ static int brcm_nsp_sata_init(struct brcm_sata_port *port)
        val |= (0x06 << OOB_CTRL1_BURST_MIN_SHIFT);
        val |= (0x0f << OOB_CTRL1_WAKE_IDLE_MAX_SHIFT);
        val |= (0x06 << OOB_CTRL1_WAKE_IDLE_MIN_SHIFT);
-       brcm_sata_phy_wr(base, oob_bank, OOB_CTRL1, 0x0, val);
+       brcm_sata_phy_wr(port, oob_bank, OOB_CTRL1, 0x0, val);
 
        val = 0x0;
        val |= (0x2e << OOB_CTRL2_RESET_IDLE_MAX_SHIFT);
        val |= (0x02 << OOB_CTRL2_BURST_CNT_SHIFT);
        val |= (0x16 << OOB_CTRL2_RESET_IDLE_MIN_SHIFT);
-       brcm_sata_phy_wr(base, oob_bank, OOB_CTRL2, 0x0, val);
+       brcm_sata_phy_wr(port, oob_bank, OOB_CTRL2, 0x0, val);
 
 
-       brcm_sata_phy_wr(base, PLL_REG_BANK_0, PLL_ACTRL2,
+       brcm_sata_phy_wr(port, PLL_REG_BANK_0, PLL_ACTRL2,
                ~(PLL_ACTRL2_SELDIV_MASK << PLL_ACTRL2_SELDIV_SHIFT),
                0x0c << PLL_ACTRL2_SELDIV_SHIFT);
 
-       brcm_sata_phy_wr(base, PLL_REG_BANK_0, PLL_CAP_CONTROL,
+       brcm_sata_phy_wr(port, PLL_REG_BANK_0, PLL_CAP_CONTROL,
                                                0xff0, 0x4f0);
 
        val = PLLCONTROL_0_FREQ_DET_RESTART | PLLCONTROL_0_FREQ_MONITOR;
-       brcm_sata_phy_wr(base, PLL_REG_BANK_0, PLL_REG_BANK_0_PLLCONTROL_0,
+       brcm_sata_phy_wr(port, PLL_REG_BANK_0, PLL_REG_BANK_0_PLLCONTROL_0,
                                                                ~val, val);
        val = PLLCONTROL_0_SEQ_START;
-       brcm_sata_phy_wr(base, PLL_REG_BANK_0, PLL_REG_BANK_0_PLLCONTROL_0,
+       brcm_sata_phy_wr(port, PLL_REG_BANK_0, PLL_REG_BANK_0_PLLCONTROL_0,
                                                                ~val, 0);
        mdelay(10);
-       brcm_sata_phy_wr(base, PLL_REG_BANK_0, PLL_REG_BANK_0_PLLCONTROL_0,
+       brcm_sata_phy_wr(port, PLL_REG_BANK_0, PLL_REG_BANK_0_PLLCONTROL_0,
                                                                ~val, val);
 
        /* Wait for pll_seq_done bit */
        try = 50;
        while (--try) {
-               val = brcm_sata_phy_rd(base, BLOCK0_REG_BANK,
+               val = brcm_sata_phy_rd(port, BLOCK0_REG_BANK,
                                        BLOCK0_XGXSSTATUS);
                if (val & BLOCK0_XGXSSTATUS_PLL_LOCK)
                        break;
@@ -546,27 +532,25 @@ static int brcm_nsp_sata_init(struct brcm_sata_port *port)
 
 static int brcm_sr_sata_init(struct brcm_sata_port *port)
 {
-       struct brcm_sata_phy *priv = port->phy_priv;
        struct device *dev = port->phy_priv->dev;
-       void __iomem *base = priv->phy_base;
        unsigned int val, try;
 
        /* Configure PHY PLL register bank 1 */
        val = SR_PLL1_ACTRL2_MAGIC;
-       brcm_sata_phy_wr(base, PLL1_REG_BANK, PLL1_ACTRL2, 0x0, val);
+       brcm_sata_phy_wr(port, PLL1_REG_BANK, PLL1_ACTRL2, 0x0, val);
        val = SR_PLL1_ACTRL3_MAGIC;
-       brcm_sata_phy_wr(base, PLL1_REG_BANK, PLL1_ACTRL3, 0x0, val);
+       brcm_sata_phy_wr(port, PLL1_REG_BANK, PLL1_ACTRL3, 0x0, val);
        val = SR_PLL1_ACTRL4_MAGIC;
-       brcm_sata_phy_wr(base, PLL1_REG_BANK, PLL1_ACTRL4, 0x0, val);
+       brcm_sata_phy_wr(port, PLL1_REG_BANK, PLL1_ACTRL4, 0x0, val);
 
        /* Configure PHY PLL register bank 0 */
        val = SR_PLL0_ACTRL6_MAGIC;
-       brcm_sata_phy_wr(base, PLL_REG_BANK_0, PLL_ACTRL6, 0x0, val);
+       brcm_sata_phy_wr(port, PLL_REG_BANK_0, PLL_ACTRL6, 0x0, val);
 
        /* Wait for PHY PLL lock by polling pll_lock bit */
        try = 50;
        do {
-               val = brcm_sata_phy_rd(base, BLOCK0_REG_BANK,
+               val = brcm_sata_phy_rd(port, BLOCK0_REG_BANK,
                                        BLOCK0_XGXSSTATUS);
                if (val & BLOCK0_XGXSSTATUS_PLL_LOCK)
                        break;
@@ -581,7 +565,7 @@ static int brcm_sr_sata_init(struct brcm_sata_port *port)
        }
 
        /* Invert Tx polarity */
-       brcm_sata_phy_wr(base, TX_REG_BANK, TX_ACTRL0,
+       brcm_sata_phy_wr(port, TX_REG_BANK, TX_ACTRL0,
                         ~TX_ACTRL0_TXPOL_FLIP, TX_ACTRL0_TXPOL_FLIP);
 
        /* Configure OOB control to handle 100MHz reference clock */
@@ -589,52 +573,51 @@ static int brcm_sr_sata_init(struct brcm_sata_port *port)
                (0x4 << OOB_CTRL1_BURST_MIN_SHIFT) |
                (0x8 << OOB_CTRL1_WAKE_IDLE_MAX_SHIFT) |
                (0x3 << OOB_CTRL1_WAKE_IDLE_MIN_SHIFT));
-       brcm_sata_phy_wr(base, OOB_REG_BANK, OOB_CTRL1, 0x0, val);
+       brcm_sata_phy_wr(port, OOB_REG_BANK, OOB_CTRL1, 0x0, val);
        val = ((0x1b << OOB_CTRL2_RESET_IDLE_MAX_SHIFT) |
                (0x2 << OOB_CTRL2_BURST_CNT_SHIFT) |
                (0x9 << OOB_CTRL2_RESET_IDLE_MIN_SHIFT));
-       brcm_sata_phy_wr(base, OOB_REG_BANK, OOB_CTRL2, 0x0, val);
+       brcm_sata_phy_wr(port, OOB_REG_BANK, OOB_CTRL2, 0x0, val);
 
        return 0;
 }
 
 static int brcm_dsl_sata_init(struct brcm_sata_port *port)
 {
-       void __iomem *base = brcm_sata_pcb_base(port);
        struct device *dev = port->phy_priv->dev;
        unsigned int try;
        u32 tmp;
 
-       brcm_sata_phy_wr(base, PLL1_REG_BANK, PLL1_ACTRL7, 0, 0x873);
+       brcm_sata_phy_wr(port, PLL1_REG_BANK, PLL1_ACTRL7, 0, 0x873);
 
-       brcm_sata_phy_wr(base, PLL1_REG_BANK, PLL1_ACTRL6, 0, 0xc000);
+       brcm_sata_phy_wr(port, PLL1_REG_BANK, PLL1_ACTRL6, 0, 0xc000);
 
-       brcm_sata_phy_wr(base, PLL_REG_BANK_0, PLL_REG_BANK_0_PLLCONTROL_0,
+       brcm_sata_phy_wr(port, PLL_REG_BANK_0, PLL_REG_BANK_0_PLLCONTROL_0,
                         0, 0x3089);
        usleep_range(1000, 2000);
 
-       brcm_sata_phy_wr(base, PLL_REG_BANK_0, PLL_REG_BANK_0_PLLCONTROL_0,
+       brcm_sata_phy_wr(port, PLL_REG_BANK_0, PLL_REG_BANK_0_PLLCONTROL_0,
                         0, 0x3088);
        usleep_range(1000, 2000);
 
-       brcm_sata_phy_wr(base, AEQRX_REG_BANK_1, AEQRX_SLCAL0_CTRL0,
+       brcm_sata_phy_wr(port, AEQRX_REG_BANK_1, AEQRX_SLCAL0_CTRL0,
                         0, 0x3000);
 
-       brcm_sata_phy_wr(base, AEQRX_REG_BANK_1, AEQRX_SLCAL1_CTRL0,
+       brcm_sata_phy_wr(port, AEQRX_REG_BANK_1, AEQRX_SLCAL1_CTRL0,
                         0, 0x3000);
        usleep_range(1000, 2000);
 
-       brcm_sata_phy_wr(base, PLL_REG_BANK_0, PLL_CAP_CHARGE_TIME, 0, 0x32);
+       brcm_sata_phy_wr(port, PLL_REG_BANK_0, PLL_CAP_CHARGE_TIME, 0, 0x32);
 
-       brcm_sata_phy_wr(base, PLL_REG_BANK_0, PLL_VCO_CAL_THRESH, 0, 0xa);
+       brcm_sata_phy_wr(port, PLL_REG_BANK_0, PLL_VCO_CAL_THRESH, 0, 0xa);
 
-       brcm_sata_phy_wr(base, PLL_REG_BANK_0, PLL_FREQ_DET_TIME, 0, 0x64);
+       brcm_sata_phy_wr(port, PLL_REG_BANK_0, PLL_FREQ_DET_TIME, 0, 0x64);
        usleep_range(1000, 2000);
 
        /* Acquire PLL lock */
        try = 50;
        while (try) {
-               tmp = brcm_sata_phy_rd(base, BLOCK0_REG_BANK,
+               tmp = brcm_sata_phy_rd(port, BLOCK0_REG_BANK,
                                       BLOCK0_XGXSSTATUS);
                if (tmp & BLOCK0_XGXSSTATUS_PLL_LOCK)
                        break;
@@ -687,10 +670,9 @@ static int brcm_sata_phy_init(struct phy *phy)
 
 static void brcm_stb_sata_calibrate(struct brcm_sata_port *port)
 {
-       void __iomem *base = brcm_sata_pcb_base(port);
        u32 tmp = BIT(8);
 
-       brcm_sata_phy_wr(base, RXPMD_REG_BANK, RXPMD_RX_FREQ_MON_CONTROL1,
+       brcm_sata_phy_wr(port, RXPMD_REG_BANK, RXPMD_RX_FREQ_MON_CONTROL1,
                         ~tmp, tmp);
 }
 
index f20524f0c21d9aea86013601ec47c381bf32db26..94a34cf75eb3975d5b27073061fa40e141b6f06b 100644 (file)
@@ -20,6 +20,7 @@
 
 #define PHY_MDM6600_PHY_DELAY_MS       4000    /* PHY enable 2.2s to 3.5s */
 #define PHY_MDM6600_ENABLED_DELAY_MS   8000    /* 8s more total for MDM6600 */
+#define PHY_MDM6600_WAKE_KICK_MS       600     /* time on after GPIO toggle */
 #define MDM6600_MODEM_IDLE_DELAY_MS    1000    /* modem after USB suspend */
 #define MDM6600_MODEM_WAKE_DELAY_MS    200     /* modem response after idle */
 
@@ -243,10 +244,24 @@ static irqreturn_t phy_mdm6600_wakeirq_thread(int irq, void *data)
 {
        struct phy_mdm6600 *ddata = data;
        struct gpio_desc *mode_gpio1;
+       int error, wakeup;
 
        mode_gpio1 = ddata->mode_gpios->desc[PHY_MDM6600_MODE1];
-       dev_dbg(ddata->dev, "OOB wake on mode_gpio1: %i\n",
-               gpiod_get_value(mode_gpio1));
+       wakeup = gpiod_get_value(mode_gpio1);
+       if (!wakeup)
+               return IRQ_NONE;
+
+       dev_dbg(ddata->dev, "OOB wake on mode_gpio1: %i\n", wakeup);
+       error = pm_runtime_get_sync(ddata->dev);
+       if (error < 0) {
+               pm_runtime_put_noidle(ddata->dev);
+
+               return IRQ_NONE;
+       }
+
+       /* Just wake-up and kick the autosuspend timer */
+       pm_runtime_mark_last_busy(ddata->dev);
+       pm_runtime_put_autosuspend(ddata->dev);
 
        return IRQ_HANDLED;
 }
@@ -496,8 +511,14 @@ static void phy_mdm6600_modem_wake(struct work_struct *work)
 
        ddata = container_of(work, struct phy_mdm6600, modem_wake_work.work);
        phy_mdm6600_wake_modem(ddata);
+
+       /*
+        * The modem does not always stay awake 1.2 seconds after toggling
+        * the wake GPIO, and sometimes it idles after about some 600 ms
+        * making writes time out.
+        */
        schedule_delayed_work(&ddata->modem_wake_work,
-                             msecs_to_jiffies(MDM6600_MODEM_IDLE_DELAY_MS));
+                             msecs_to_jiffies(PHY_MDM6600_WAKE_KICK_MS));
 }
 
 static int __maybe_unused phy_mdm6600_runtime_suspend(struct device *dev)
index cd5a6c95dbdc1f3e1b544242de5953dfb55fccbe..a27b8d578d7fc449dab7facd3e3a6993375621f1 100644 (file)
@@ -688,11 +688,9 @@ struct phy *phy_get(struct device *dev, const char *string)
        get_device(&phy->dev);
 
        link = device_link_add(dev, &phy->dev, DL_FLAG_STATELESS);
-       if (!link) {
-               dev_err(dev, "failed to create device link to %s\n",
+       if (!link)
+               dev_dbg(dev, "failed to create device link to %s\n",
                        dev_name(phy->dev.parent));
-               return ERR_PTR(-EINVAL);
-       }
 
        return phy;
 }
@@ -803,11 +801,9 @@ struct phy *devm_of_phy_get(struct device *dev, struct device_node *np,
        }
 
        link = device_link_add(dev, &phy->dev, DL_FLAG_STATELESS);
-       if (!link) {
-               dev_err(dev, "failed to create device link to %s\n",
+       if (!link)
+               dev_dbg(dev, "failed to create device link to %s\n",
                        dev_name(phy->dev.parent));
-               return ERR_PTR(-EINVAL);
-       }
 
        return phy;
 }
@@ -852,11 +848,9 @@ struct phy *devm_of_phy_get_by_index(struct device *dev, struct device_node *np,
        devres_add(dev, ptr);
 
        link = device_link_add(dev, &phy->dev, DL_FLAG_STATELESS);
-       if (!link) {
-               dev_err(dev, "failed to create device link to %s\n",
+       if (!link)
+               dev_dbg(dev, "failed to create device link to %s\n",
                        dev_name(phy->dev.parent));
-               return ERR_PTR(-EINVAL);
-       }
 
        return phy;
 }
index a28bd15297f53401bf0d390d020a359f21303a26..1c536fc03c83c83e29dc57ae622d9220b3b9c92e 100644 (file)
@@ -80,20 +80,20 @@ static int phy_gmii_sel_mode(struct phy *phy, enum phy_mode mode, int submode)
                break;
 
        case PHY_INTERFACE_MODE_MII:
-               mode = AM33XX_GMII_SEL_MODE_MII;
+       case PHY_INTERFACE_MODE_GMII:
+               gmii_sel_mode = AM33XX_GMII_SEL_MODE_MII;
                break;
 
        default:
-               dev_warn(dev,
-                        "port%u: unsupported mode: \"%s\". Defaulting to MII.\n",
-                        if_phy->id, phy_modes(rgmii_id));
+               dev_warn(dev, "port%u: unsupported mode: \"%s\"\n",
+                        if_phy->id, phy_modes(submode));
                return -EINVAL;
        }
 
        if_phy->phy_if_mode = submode;
 
        dev_dbg(dev, "%s id:%u mode:%u rgmii_id:%d rmii_clk_ext:%d\n",
-               __func__, if_phy->id, mode, rgmii_id,
+               __func__, if_phy->id, submode, rgmii_id,
                if_phy->rmii_clock_external);
 
        regfield = if_phy->fields[PHY_GMII_SEL_PORT_MODE];
index bdfaf7edb75a1b9e10690cae08e5e6cb53a72d3b..992bc18101ef58285616fa0b9bea8e288b47d3b5 100644 (file)
@@ -88,7 +88,7 @@ static int stm32_vrefbuf_disable(struct regulator_dev *rdev)
        }
 
        val = readl_relaxed(priv->base + STM32_VREFBUF_CSR);
-       val = (val & ~STM32_ENVR) | STM32_HIZ;
+       val &= ~STM32_ENVR;
        writel_relaxed(val, priv->base + STM32_VREFBUF_CSR);
 
        pm_runtime_mark_last_busy(priv->dev);
@@ -175,6 +175,7 @@ static const struct regulator_desc stm32_vrefbuf_regu = {
        .volt_table = stm32_vrefbuf_voltages,
        .n_voltages = ARRAY_SIZE(stm32_vrefbuf_voltages),
        .ops = &stm32_vrefbuf_volt_ops,
+       .off_on_delay = 1000,
        .type = REGULATOR_VOLTAGE,
        .owner = THIS_MODULE,
 };
index 461b0e506a26f9d572b44c71f402085fa53f8766..d9efbfd29646371d9c4c05f44201234d16d36419 100644 (file)
@@ -51,6 +51,7 @@ config RESET_BRCMSTB
 
 config RESET_BRCMSTB_RESCAL
        bool "Broadcom STB RESCAL reset controller"
+       depends on HAS_IOMEM
        default ARCH_BRCMSTB || COMPILE_TEST
        help
          This enables the RESCAL reset controller for SATA, PCIe0, or PCIe1 on
@@ -73,7 +74,7 @@ config RESET_IMX7
 
 config RESET_INTEL_GW
        bool "Intel Reset Controller Driver"
-       depends on OF
+       depends on OF && HAS_IOMEM
        select REGMAP_MMIO
        help
          This enables the reset controller driver for Intel Gateway SoCs.
index fb70b8a3f7c523964e1aec543341638bf7929e36..20d37eaeb5f2cc3ae49845278359642254f850e2 100644 (file)
@@ -25,7 +25,7 @@ struct imx_sc_msg_misc_get_soc_id {
                        u32 id;
                } resp;
        } data;
-} __packed;
+} __packed __aligned(4);
 
 struct imx_sc_msg_misc_get_soc_uid {
        struct imx_sc_rpc_msg hdr;
index fd8007ebb14589ba6ef0d5419878ab5e573687ae..13def7f78b9e99c9829af817496c794071042981 100644 (file)
@@ -149,6 +149,7 @@ struct atmel_qspi {
        struct clk              *qspick;
        struct platform_device  *pdev;
        const struct atmel_qspi_caps *caps;
+       resource_size_t         mmap_size;
        u32                     pending;
        u32                     mr;
        u32                     scr;
@@ -329,6 +330,14 @@ static int atmel_qspi_exec_op(struct spi_mem *mem, const struct spi_mem_op *op)
        u32 sr, offset;
        int err;
 
+       /*
+        * Check if the address exceeds the MMIO window size. An improvement
+        * would be to add support for regular SPI mode and fall back to it
+        * when the flash memories overrun the controller's memory space.
+        */
+       if (op->addr.val + op->data.nbytes > aq->mmap_size)
+               return -ENOTSUPP;
+
        err = atmel_qspi_set_cfg(aq, op, &offset);
        if (err)
                return err;
@@ -480,6 +489,8 @@ static int atmel_qspi_probe(struct platform_device *pdev)
                goto exit;
        }
 
+       aq->mmap_size = resource_size(res);
+
        /* Get the peripheral clock */
        aq->pclk = devm_clk_get(&pdev->dev, "pclk");
        if (IS_ERR(aq->pclk))
index 7327309ea3d51772ad5c57edbc3d509192d93d05..6c235306c0e4a8658e31fed475e37057d94a3663 100644 (file)
@@ -366,7 +366,6 @@ static int bcm63xx_hsspi_probe(struct platform_device *pdev)
                        goto out_disable_clk;
 
                rate = clk_get_rate(pll_clk);
-               clk_disable_unprepare(pll_clk);
                if (!rate) {
                        ret = -EINVAL;
                        goto out_disable_pll_clk;
index 7e2292c11d120b44d904c93c7433724a0ea7371e..e9e256718ef4aa9806937acc29ad5554411350d2 100644 (file)
@@ -130,6 +130,7 @@ struct omap2_mcspi {
        int                     fifo_depth;
        bool                    slave_aborted;
        unsigned int            pin_dir:1;
+       size_t                  max_xfer_len;
 };
 
 struct omap2_mcspi_cs {
@@ -974,20 +975,12 @@ static int omap2_mcspi_setup_transfer(struct spi_device *spi,
  * Note that we currently allow DMA only if we get a channel
  * for both rx and tx. Otherwise we'll do PIO for both rx and tx.
  */
-static int omap2_mcspi_request_dma(struct spi_device *spi)
+static int omap2_mcspi_request_dma(struct omap2_mcspi *mcspi,
+                                  struct omap2_mcspi_dma *mcspi_dma)
 {
-       struct spi_master       *master = spi->master;
-       struct omap2_mcspi      *mcspi;
-       struct omap2_mcspi_dma  *mcspi_dma;
        int ret = 0;
 
-       mcspi = spi_master_get_devdata(master);
-       mcspi_dma = mcspi->dma_channels + spi->chip_select;
-
-       init_completion(&mcspi_dma->dma_rx_completion);
-       init_completion(&mcspi_dma->dma_tx_completion);
-
-       mcspi_dma->dma_rx = dma_request_chan(&master->dev,
+       mcspi_dma->dma_rx = dma_request_chan(mcspi->dev,
                                             mcspi_dma->dma_rx_ch_name);
        if (IS_ERR(mcspi_dma->dma_rx)) {
                ret = PTR_ERR(mcspi_dma->dma_rx);
@@ -995,7 +988,7 @@ static int omap2_mcspi_request_dma(struct spi_device *spi)
                goto no_dma;
        }
 
-       mcspi_dma->dma_tx = dma_request_chan(&master->dev,
+       mcspi_dma->dma_tx = dma_request_chan(mcspi->dev,
                                             mcspi_dma->dma_tx_ch_name);
        if (IS_ERR(mcspi_dma->dma_tx)) {
                ret = PTR_ERR(mcspi_dma->dma_tx);
@@ -1004,20 +997,40 @@ static int omap2_mcspi_request_dma(struct spi_device *spi)
                mcspi_dma->dma_rx = NULL;
        }
 
+       init_completion(&mcspi_dma->dma_rx_completion);
+       init_completion(&mcspi_dma->dma_tx_completion);
+
 no_dma:
        return ret;
 }
 
+static void omap2_mcspi_release_dma(struct spi_master *master)
+{
+       struct omap2_mcspi *mcspi = spi_master_get_devdata(master);
+       struct omap2_mcspi_dma  *mcspi_dma;
+       int i;
+
+       for (i = 0; i < master->num_chipselect; i++) {
+               mcspi_dma = &mcspi->dma_channels[i];
+
+               if (mcspi_dma->dma_rx) {
+                       dma_release_channel(mcspi_dma->dma_rx);
+                       mcspi_dma->dma_rx = NULL;
+               }
+               if (mcspi_dma->dma_tx) {
+                       dma_release_channel(mcspi_dma->dma_tx);
+                       mcspi_dma->dma_tx = NULL;
+               }
+       }
+}
+
 static int omap2_mcspi_setup(struct spi_device *spi)
 {
        int                     ret;
        struct omap2_mcspi      *mcspi = spi_master_get_devdata(spi->master);
        struct omap2_mcspi_regs *ctx = &mcspi->ctx;
-       struct omap2_mcspi_dma  *mcspi_dma;
        struct omap2_mcspi_cs   *cs = spi->controller_state;
 
-       mcspi_dma = &mcspi->dma_channels[spi->chip_select];
-
        if (!cs) {
                cs = kzalloc(sizeof *cs, GFP_KERNEL);
                if (!cs)
@@ -1042,13 +1055,6 @@ static int omap2_mcspi_setup(struct spi_device *spi)
                }
        }
 
-       if (!mcspi_dma->dma_rx || !mcspi_dma->dma_tx) {
-               ret = omap2_mcspi_request_dma(spi);
-               if (ret)
-                       dev_warn(&spi->dev, "not using DMA for McSPI (%d)\n",
-                                ret);
-       }
-
        ret = pm_runtime_get_sync(mcspi->dev);
        if (ret < 0) {
                pm_runtime_put_noidle(mcspi->dev);
@@ -1065,12 +1071,8 @@ static int omap2_mcspi_setup(struct spi_device *spi)
 
 static void omap2_mcspi_cleanup(struct spi_device *spi)
 {
-       struct omap2_mcspi      *mcspi;
-       struct omap2_mcspi_dma  *mcspi_dma;
        struct omap2_mcspi_cs   *cs;
 
-       mcspi = spi_master_get_devdata(spi->master);
-
        if (spi->controller_state) {
                /* Unlink controller state from context save list */
                cs = spi->controller_state;
@@ -1079,19 +1081,6 @@ static void omap2_mcspi_cleanup(struct spi_device *spi)
                kfree(cs);
        }
 
-       if (spi->chip_select < spi->master->num_chipselect) {
-               mcspi_dma = &mcspi->dma_channels[spi->chip_select];
-
-               if (mcspi_dma->dma_rx) {
-                       dma_release_channel(mcspi_dma->dma_rx);
-                       mcspi_dma->dma_rx = NULL;
-               }
-               if (mcspi_dma->dma_tx) {
-                       dma_release_channel(mcspi_dma->dma_tx);
-                       mcspi_dma->dma_tx = NULL;
-               }
-       }
-
        if (gpio_is_valid(spi->cs_gpio))
                gpio_free(spi->cs_gpio);
 }
@@ -1302,9 +1291,24 @@ static bool omap2_mcspi_can_dma(struct spi_master *master,
        if (spi_controller_is_slave(master))
                return true;
 
+       master->dma_rx = mcspi_dma->dma_rx;
+       master->dma_tx = mcspi_dma->dma_tx;
+
        return (xfer->len >= DMA_MIN_BYTES);
 }
 
+static size_t omap2_mcspi_max_xfer_size(struct spi_device *spi)
+{
+       struct omap2_mcspi *mcspi = spi_master_get_devdata(spi->master);
+       struct omap2_mcspi_dma *mcspi_dma =
+               &mcspi->dma_channels[spi->chip_select];
+
+       if (mcspi->max_xfer_len && mcspi_dma->dma_rx)
+               return mcspi->max_xfer_len;
+
+       return SIZE_MAX;
+}
+
 static int omap2_mcspi_controller_setup(struct omap2_mcspi *mcspi)
 {
        struct spi_master       *master = mcspi->master;
@@ -1373,6 +1377,11 @@ static struct omap2_mcspi_platform_config omap4_pdata = {
        .regs_offset = OMAP4_MCSPI_REG_OFFSET,
 };
 
+static struct omap2_mcspi_platform_config am654_pdata = {
+       .regs_offset = OMAP4_MCSPI_REG_OFFSET,
+       .max_xfer_len = SZ_4K - 1,
+};
+
 static const struct of_device_id omap_mcspi_of_match[] = {
        {
                .compatible = "ti,omap2-mcspi",
@@ -1382,6 +1391,10 @@ static const struct of_device_id omap_mcspi_of_match[] = {
                .compatible = "ti,omap4-mcspi",
                .data = &omap4_pdata,
        },
+       {
+               .compatible = "ti,am654-mcspi",
+               .data = &am654_pdata,
+       },
        { },
 };
 MODULE_DEVICE_TABLE(of, omap_mcspi_of_match);
@@ -1439,6 +1452,10 @@ static int omap2_mcspi_probe(struct platform_device *pdev)
                mcspi->pin_dir = pdata->pin_dir;
        }
        regs_offset = pdata->regs_offset;
+       if (pdata->max_xfer_len) {
+               mcspi->max_xfer_len = pdata->max_xfer_len;
+               master->max_transfer_size = omap2_mcspi_max_xfer_size;
+       }
 
        r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
        mcspi->base = devm_ioremap_resource(&pdev->dev, r);
@@ -1464,6 +1481,11 @@ static int omap2_mcspi_probe(struct platform_device *pdev)
        for (i = 0; i < master->num_chipselect; i++) {
                sprintf(mcspi->dma_channels[i].dma_rx_ch_name, "rx%d", i);
                sprintf(mcspi->dma_channels[i].dma_tx_ch_name, "tx%d", i);
+
+               status = omap2_mcspi_request_dma(mcspi,
+                                                &mcspi->dma_channels[i]);
+               if (status == -EPROBE_DEFER)
+                       goto free_master;
        }
 
        status = platform_get_irq(pdev, 0);
@@ -1501,6 +1523,7 @@ static int omap2_mcspi_probe(struct platform_device *pdev)
        pm_runtime_put_sync(&pdev->dev);
        pm_runtime_disable(&pdev->dev);
 free_master:
+       omap2_mcspi_release_dma(master);
        spi_master_put(master);
        return status;
 }
@@ -1510,6 +1533,8 @@ static int omap2_mcspi_remove(struct platform_device *pdev)
        struct spi_master *master = platform_get_drvdata(pdev);
        struct omap2_mcspi *mcspi = spi_master_get_devdata(master);
 
+       omap2_mcspi_release_dma(master);
+
        pm_runtime_dont_use_autosuspend(mcspi->dev);
        pm_runtime_put_sync(mcspi->dev);
        pm_runtime_disable(&pdev->dev);
index 4c7a71f0fb3e3fc7a2d53f6bd076ce8ac364e171..2e318158fca97686200ff2aa6b8169158911c204 100644 (file)
@@ -70,6 +70,10 @@ MODULE_ALIAS("platform:pxa2xx-spi");
 #define LPSS_CAPS_CS_EN_SHIFT                  9
 #define LPSS_CAPS_CS_EN_MASK                   (0xf << LPSS_CAPS_CS_EN_SHIFT)
 
+#define LPSS_PRIV_CLOCK_GATE 0x38
+#define LPSS_PRIV_CLOCK_GATE_CLK_CTL_MASK 0x3
+#define LPSS_PRIV_CLOCK_GATE_CLK_CTL_FORCE_ON 0x3
+
 struct lpss_config {
        /* LPSS offset from drv_data->ioaddr */
        unsigned offset;
@@ -86,6 +90,8 @@ struct lpss_config {
        unsigned cs_sel_shift;
        unsigned cs_sel_mask;
        unsigned cs_num;
+       /* Quirks */
+       unsigned cs_clk_stays_gated : 1;
 };
 
 /* Keep these sorted with enum pxa_ssp_type */
@@ -156,6 +162,7 @@ static const struct lpss_config lpss_platforms[] = {
                .tx_threshold_hi = 56,
                .cs_sel_shift = 8,
                .cs_sel_mask = 3 << 8,
+               .cs_clk_stays_gated = true,
        },
 };
 
@@ -383,6 +390,22 @@ static void lpss_ssp_cs_control(struct spi_device *spi, bool enable)
        else
                value |= LPSS_CS_CONTROL_CS_HIGH;
        __lpss_ssp_write_priv(drv_data, config->reg_cs_ctrl, value);
+       if (config->cs_clk_stays_gated) {
+               u32 clkgate;
+
+               /*
+                * Changing CS alone when dynamic clock gating is on won't
+                * actually flip CS at that time. This ruins SPI transfers
+                * that specify delays, or have no data. Toggle the clock mode
+                * to force on briefly to poke the CS pin to move.
+                */
+               clkgate = __lpss_ssp_read_priv(drv_data, LPSS_PRIV_CLOCK_GATE);
+               value = (clkgate & ~LPSS_PRIV_CLOCK_GATE_CLK_CTL_MASK) |
+                       LPSS_PRIV_CLOCK_GATE_CLK_CTL_FORCE_ON;
+
+               __lpss_ssp_write_priv(drv_data, LPSS_PRIV_CLOCK_GATE, value);
+               __lpss_ssp_write_priv(drv_data, LPSS_PRIV_CLOCK_GATE, clkgate);
+       }
 }
 
 static void cs_assert(struct spi_device *spi)
index dd3434a407ea669380e770760dcac4629f7e2fe0..a364b99497e26310fb4de0e7a3f546bfb61fcbd7 100644 (file)
@@ -1217,6 +1217,11 @@ static int spi_qup_suspend(struct device *device)
        struct spi_qup *controller = spi_master_get_devdata(master);
        int ret;
 
+       if (pm_runtime_suspended(device)) {
+               ret = spi_qup_pm_resume_runtime(device);
+               if (ret)
+                       return ret;
+       }
        ret = spi_master_suspend(master);
        if (ret)
                return ret;
@@ -1225,10 +1230,8 @@ static int spi_qup_suspend(struct device *device)
        if (ret)
                return ret;
 
-       if (!pm_runtime_suspended(device)) {
-               clk_disable_unprepare(controller->cclk);
-               clk_disable_unprepare(controller->iclk);
-       }
+       clk_disable_unprepare(controller->cclk);
+       clk_disable_unprepare(controller->iclk);
        return 0;
 }
 
index 60c4de4e448568f2a2b54ce1da5f21ea510401da..7412a3042a8d2c69be4c438ef4af2bf89f4f131e 100644 (file)
@@ -401,9 +401,6 @@ static void zynqmp_qspi_chipselect(struct spi_device *qspi, bool is_high)
 
        zynqmp_gqspi_write(xqspi, GQSPI_GEN_FIFO_OFST, genfifoentry);
 
-       /* Dummy generic FIFO entry */
-       zynqmp_gqspi_write(xqspi, GQSPI_GEN_FIFO_OFST, 0x0);
-
        /* Manually start the generic FIFO command */
        zynqmp_gqspi_write(xqspi, GQSPI_CONFIG_OFST,
                        zynqmp_gqspi_read(xqspi, GQSPI_CONFIG_OFST) |
index 38b4c78df506c060fa49d9b86e97020e7a910b48..755221bc3745c0602bc1bb9a2e2dafbb890f3988 100644 (file)
@@ -2639,7 +2639,7 @@ int spi_register_controller(struct spi_controller *ctlr)
                if (ctlr->use_gpio_descriptors) {
                        status = spi_get_gpio_descs(ctlr);
                        if (status)
-                               return status;
+                               goto free_bus_id;
                        /*
                         * A controller using GPIO descriptors always
                         * supports SPI_CS_HIGH if need be.
@@ -2649,7 +2649,7 @@ int spi_register_controller(struct spi_controller *ctlr)
                        /* Legacy code path for GPIOs from DT */
                        status = of_spi_get_gpio_numbers(ctlr);
                        if (status)
-                               return status;
+                               goto free_bus_id;
                }
        }
 
@@ -2657,17 +2657,14 @@ int spi_register_controller(struct spi_controller *ctlr)
         * Even if it's just one always-selected device, there must
         * be at least one chipselect.
         */
-       if (!ctlr->num_chipselect)
-               return -EINVAL;
+       if (!ctlr->num_chipselect) {
+               status = -EINVAL;
+               goto free_bus_id;
+       }
 
        status = device_add(&ctlr->dev);
-       if (status < 0) {
-               /* free bus id */
-               mutex_lock(&board_lock);
-               idr_remove(&spi_master_idr, ctlr->bus_num);
-               mutex_unlock(&board_lock);
-               goto done;
-       }
+       if (status < 0)
+               goto free_bus_id;
        dev_dbg(dev, "registered %s %s\n",
                        spi_controller_is_slave(ctlr) ? "slave" : "master",
                        dev_name(&ctlr->dev));
@@ -2683,11 +2680,7 @@ int spi_register_controller(struct spi_controller *ctlr)
                status = spi_controller_initialize_queue(ctlr);
                if (status) {
                        device_del(&ctlr->dev);
-                       /* free bus id */
-                       mutex_lock(&board_lock);
-                       idr_remove(&spi_master_idr, ctlr->bus_num);
-                       mutex_unlock(&board_lock);
-                       goto done;
+                       goto free_bus_id;
                }
        }
        /* add statistics */
@@ -2702,7 +2695,12 @@ int spi_register_controller(struct spi_controller *ctlr)
        /* Register devices from the device tree and ACPI */
        of_register_spi_devices(ctlr);
        acpi_register_spi_devices(ctlr);
-done:
+       return status;
+
+free_bus_id:
+       mutex_lock(&board_lock);
+       idr_remove(&spi_master_idr, ctlr->bus_num);
+       mutex_unlock(&board_lock);
        return status;
 }
 EXPORT_SYMBOL_GPL(spi_register_controller);
index 1e217e3e9486ebd9d1147a3e95700f43d5e7935f..2ab6e782f14c2527ae7c698d1975530594e33c70 100644 (file)
@@ -396,6 +396,7 @@ spidev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
                else
                        retval = get_user(tmp, (u32 __user *)arg);
                if (retval == 0) {
+                       struct spi_controller *ctlr = spi->controller;
                        u32     save = spi->mode;
 
                        if (tmp & ~SPI_MODE_MASK) {
@@ -403,6 +404,10 @@ spidev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
                                break;
                        }
 
+                       if (ctlr->use_gpio_descriptors && ctlr->cs_gpiods &&
+                           ctlr->cs_gpiods[spi->chip_select])
+                               tmp |= SPI_CS_HIGH;
+
                        tmp |= spi->mode & ~SPI_MODE_MASK;
                        spi->mode = (u16)tmp;
                        retval = spi_setup(spi);
index 97c615a2f057fc2c69b54e1c3c1168abcdaf52b4..c988353261352ef22126a22bf8cae0f2bed335c9 100644 (file)
@@ -558,13 +558,13 @@ static int hantro_attach_func(struct hantro_dev *vpu,
                goto err_rel_entity1;
 
        /* Connect the three entities */
-       ret = media_create_pad_link(&func->vdev.entity, 0, &func->proc, 1,
+       ret = media_create_pad_link(&func->vdev.entity, 0, &func->proc, 0,
                                    MEDIA_LNK_FL_IMMUTABLE |
                                    MEDIA_LNK_FL_ENABLED);
        if (ret)
                goto err_rel_entity2;
 
-       ret = media_create_pad_link(&func->proc, 0, &func->sink, 0,
+       ret = media_create_pad_link(&func->proc, 1, &func->sink, 0,
                                    MEDIA_LNK_FL_IMMUTABLE |
                                    MEDIA_LNK_FL_ENABLED);
        if (ret)
index a8b4d0c5ab7e0e312d0463e8c26ce295bb551fc9..032f3264fba12bd925f7cad46f379b6de8b90a22 100644 (file)
@@ -51,9 +51,7 @@ static void __speakup_set_selection(struct work_struct *work)
                goto unref;
        }
 
-       console_lock();
        set_selection_kernel(&sel, tty);
-       console_unlock();
 
 unref:
        tty_kref_put(tty);
index 26de6762b94241959effee09ca1b5ed233f52da8..081d58abd5accd3552f042567c0633092e021f3b 100644 (file)
@@ -93,5 +93,5 @@ Some properties are recognized either by SPI and SDIO versions:
    Must contains 64 hexadecimal digits. Not supported in current version.
 
 WFx driver also supports `mac-address` and `local-mac-address` as described in
-Documentation/devicetree/binding/net/ethernet.txt
+Documentation/devicetree/bindings/net/ethernet.txt
 
index 6370bb55f51230fda81a60661d2f6a2530df0f18..0026eb6f13cee46a2898f3a44b08c8b5a4c3ee0b 100644 (file)
@@ -212,6 +212,19 @@ static int copy_ta_binary(struct tee_context *ctx, void *ptr, void **ta,
        return rc;
 }
 
+static void destroy_session(struct kref *ref)
+{
+       struct amdtee_session *sess = container_of(ref, struct amdtee_session,
+                                                  refcount);
+
+       /* Unload the TA from TEE */
+       handle_unload_ta(sess->ta_handle);
+       mutex_lock(&session_list_mutex);
+       list_del(&sess->list_node);
+       mutex_unlock(&session_list_mutex);
+       kfree(sess);
+}
+
 int amdtee_open_session(struct tee_context *ctx,
                        struct tee_ioctl_open_session_arg *arg,
                        struct tee_param *param)
@@ -236,15 +249,13 @@ int amdtee_open_session(struct tee_context *ctx,
 
        /* Load the TA binary into TEE environment */
        handle_load_ta(ta, ta_size, arg);
-       if (arg->ret == TEEC_SUCCESS) {
-               mutex_lock(&session_list_mutex);
-               sess = alloc_session(ctxdata, arg->session);
-               mutex_unlock(&session_list_mutex);
-       }
-
        if (arg->ret != TEEC_SUCCESS)
                goto out;
 
+       mutex_lock(&session_list_mutex);
+       sess = alloc_session(ctxdata, arg->session);
+       mutex_unlock(&session_list_mutex);
+
        if (!sess) {
                rc = -ENOMEM;
                goto out;
@@ -259,40 +270,29 @@ int amdtee_open_session(struct tee_context *ctx,
 
        if (i >= TEE_NUM_SESSIONS) {
                pr_err("reached maximum session count %d\n", TEE_NUM_SESSIONS);
+               kref_put(&sess->refcount, destroy_session);
                rc = -ENOMEM;
                goto out;
        }
 
        /* Open session with loaded TA */
        handle_open_session(arg, &session_info, param);
-
-       if (arg->ret == TEEC_SUCCESS) {
-               sess->session_info[i] = session_info;
-               set_session_id(sess->ta_handle, i, &arg->session);
-       } else {
+       if (arg->ret != TEEC_SUCCESS) {
                pr_err("open_session failed %d\n", arg->ret);
                spin_lock(&sess->lock);
                clear_bit(i, sess->sess_mask);
                spin_unlock(&sess->lock);
+               kref_put(&sess->refcount, destroy_session);
+               goto out;
        }
+
+       sess->session_info[i] = session_info;
+       set_session_id(sess->ta_handle, i, &arg->session);
 out:
        free_pages((u64)ta, get_order(ta_size));
        return rc;
 }
 
-static void destroy_session(struct kref *ref)
-{
-       struct amdtee_session *sess = container_of(ref, struct amdtee_session,
-                                                  refcount);
-
-       /* Unload the TA from TEE */
-       handle_unload_ta(sess->ta_handle);
-       mutex_lock(&session_list_mutex);
-       list_del(&sess->list_node);
-       mutex_unlock(&session_list_mutex);
-       kfree(sess);
-}
-
 int amdtee_close_session(struct tee_context *ctx, u32 session)
 {
        struct amdtee_context_data *ctxdata = ctx->data;
index 42345e79920c229285cf95cf4c150690a5dfb04c..c5f0d936b003ae597c7ac05cce724793311e7492 100644 (file)
@@ -18,6 +18,7 @@
 #include <linux/sched.h>
 #include <linux/serdev.h>
 #include <linux/slab.h>
+#include <linux/platform_data/x86/apple.h>
 
 static bool is_registered;
 static DEFINE_IDA(ctrl_ida);
@@ -631,6 +632,15 @@ static int acpi_serdev_check_resources(struct serdev_controller *ctrl,
        if (ret)
                return ret;
 
+       /*
+        * Apple machines provide an empty resource template, so on those
+        * machines just look for immediate children with a "baud" property
+        * (from the _DSM method) instead.
+        */
+       if (!lookup.controller_handle && x86_apple_machine &&
+           !acpi_dev_get_property(adev, "baud", ACPI_TYPE_BUFFER, NULL))
+               acpi_get_parent(adev->handle, &lookup.controller_handle);
+
        /* Make sure controller and ResourceSource handle match */
        if (ACPI_HANDLE(ctrl->dev.parent) != lookup.controller_handle)
                return -ENODEV;
index 91e9b070d36d1d44d94b0408747412538e1e05f8..d330da76d6b6d1bba022862f5dd3332b12ffee11 100644 (file)
 
 #include "8250.h"
 
+#define PCI_DEVICE_ID_ACCES_COM_2S             0x1052
+#define PCI_DEVICE_ID_ACCES_COM_4S             0x105d
+#define PCI_DEVICE_ID_ACCES_COM_8S             0x106c
+#define PCI_DEVICE_ID_ACCES_COM232_8           0x10a8
+#define PCI_DEVICE_ID_ACCES_COM_2SM            0x10d2
+#define PCI_DEVICE_ID_ACCES_COM_4SM            0x10db
+#define PCI_DEVICE_ID_ACCES_COM_8SM            0x10ea
+
 #define PCI_DEVICE_ID_COMMTECH_4224PCI335      0x0002
 #define PCI_DEVICE_ID_COMMTECH_4222PCI335      0x0004
 #define PCI_DEVICE_ID_COMMTECH_2324PCI335      0x000a
@@ -677,6 +685,22 @@ static int __maybe_unused exar_resume(struct device *dev)
 
 static SIMPLE_DEV_PM_OPS(exar_pci_pm, exar_suspend, exar_resume);
 
+static const struct exar8250_board acces_com_2x = {
+       .num_ports      = 2,
+       .setup          = pci_xr17c154_setup,
+};
+
+static const struct exar8250_board acces_com_4x = {
+       .num_ports      = 4,
+       .setup          = pci_xr17c154_setup,
+};
+
+static const struct exar8250_board acces_com_8x = {
+       .num_ports      = 8,
+       .setup          = pci_xr17c154_setup,
+};
+
+
 static const struct exar8250_board pbn_fastcom335_2 = {
        .num_ports      = 2,
        .setup          = pci_fastcom335_setup,
@@ -745,6 +769,15 @@ static const struct exar8250_board pbn_exar_XR17V8358 = {
        }
 
 static const struct pci_device_id exar_pci_tbl[] = {
+       EXAR_DEVICE(ACCESSIO, ACCES_COM_2S, acces_com_2x),
+       EXAR_DEVICE(ACCESSIO, ACCES_COM_4S, acces_com_4x),
+       EXAR_DEVICE(ACCESSIO, ACCES_COM_8S, acces_com_8x),
+       EXAR_DEVICE(ACCESSIO, ACCES_COM232_8, acces_com_8x),
+       EXAR_DEVICE(ACCESSIO, ACCES_COM_2SM, acces_com_2x),
+       EXAR_DEVICE(ACCESSIO, ACCES_COM_4SM, acces_com_4x),
+       EXAR_DEVICE(ACCESSIO, ACCES_COM_8SM, acces_com_8x),
+
+
        CONNECT_DEVICE(XR17C152, UART_2_232, pbn_connect),
        CONNECT_DEVICE(XR17C154, UART_4_232, pbn_connect),
        CONNECT_DEVICE(XR17C158, UART_8_232, pbn_connect),
index 91e2805e64416f5e54d4bbe52ee6594e0cad8e45..c31b8f3db6bf681b3df61d89431c8a957688d47d 100644 (file)
@@ -264,6 +264,7 @@ struct lpuart_port {
        int                     rx_dma_rng_buf_len;
        unsigned int            dma_tx_nents;
        wait_queue_head_t       dma_wait;
+       bool                    id_allocated;
 };
 
 struct lpuart_soc_data {
@@ -2390,6 +2391,8 @@ static int __init lpuart32_imx_early_console_setup(struct earlycon_device *devic
 OF_EARLYCON_DECLARE(lpuart, "fsl,vf610-lpuart", lpuart_early_console_setup);
 OF_EARLYCON_DECLARE(lpuart32, "fsl,ls1021a-lpuart", lpuart32_early_console_setup);
 OF_EARLYCON_DECLARE(lpuart32, "fsl,imx7ulp-lpuart", lpuart32_imx_early_console_setup);
+EARLYCON_DECLARE(lpuart, lpuart_early_console_setup);
+EARLYCON_DECLARE(lpuart32, lpuart32_early_console_setup);
 
 #define LPUART_CONSOLE (&lpuart_console)
 #define LPUART32_CONSOLE       (&lpuart32_console)
@@ -2420,19 +2423,6 @@ static int lpuart_probe(struct platform_device *pdev)
        if (!sport)
                return -ENOMEM;
 
-       ret = of_alias_get_id(np, "serial");
-       if (ret < 0) {
-               ret = ida_simple_get(&fsl_lpuart_ida, 0, UART_NR, GFP_KERNEL);
-               if (ret < 0) {
-                       dev_err(&pdev->dev, "port line is full, add device failed\n");
-                       return ret;
-               }
-       }
-       if (ret >= ARRAY_SIZE(lpuart_ports)) {
-               dev_err(&pdev->dev, "serial%d out of range\n", ret);
-               return -EINVAL;
-       }
-       sport->port.line = ret;
        res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
        sport->port.membase = devm_ioremap_resource(&pdev->dev, res);
        if (IS_ERR(sport->port.membase))
@@ -2477,9 +2467,25 @@ static int lpuart_probe(struct platform_device *pdev)
                }
        }
 
+       ret = of_alias_get_id(np, "serial");
+       if (ret < 0) {
+               ret = ida_simple_get(&fsl_lpuart_ida, 0, UART_NR, GFP_KERNEL);
+               if (ret < 0) {
+                       dev_err(&pdev->dev, "port line is full, add device failed\n");
+                       return ret;
+               }
+               sport->id_allocated = true;
+       }
+       if (ret >= ARRAY_SIZE(lpuart_ports)) {
+               dev_err(&pdev->dev, "serial%d out of range\n", ret);
+               ret = -EINVAL;
+               goto failed_out_of_range;
+       }
+       sport->port.line = ret;
+
        ret = lpuart_enable_clks(sport);
        if (ret)
-               return ret;
+               goto failed_clock_enable;
        sport->port.uartclk = lpuart_get_baud_clk_rate(sport);
 
        lpuart_ports[sport->port.line] = sport;
@@ -2529,6 +2535,10 @@ static int lpuart_probe(struct platform_device *pdev)
 failed_attach_port:
 failed_irq_request:
        lpuart_disable_clks(sport);
+failed_clock_enable:
+failed_out_of_range:
+       if (sport->id_allocated)
+               ida_simple_remove(&fsl_lpuart_ida, sport->port.line);
        return ret;
 }
 
@@ -2538,7 +2548,8 @@ static int lpuart_remove(struct platform_device *pdev)
 
        uart_remove_one_port(&lpuart_reg, &sport->port);
 
-       ida_simple_remove(&fsl_lpuart_ida, sport->port.line);
+       if (sport->id_allocated)
+               ida_simple_remove(&fsl_lpuart_ida, sport->port.line);
 
        lpuart_disable_clks(sport);
 
index c12a12556339f5c7b3b26aa4e5fa4efe04d0ce20..4e9a590712cb28fe4839d5adf6dfde9a719da13f 100644 (file)
@@ -851,7 +851,7 @@ static int mvebu_uart_probe(struct platform_device *pdev)
 
        port->membase = devm_ioremap_resource(&pdev->dev, reg);
        if (IS_ERR(port->membase))
-               return -PTR_ERR(port->membase);
+               return PTR_ERR(port->membase);
 
        mvuart = devm_kzalloc(&pdev->dev, sizeof(struct mvebu_uart),
                              GFP_KERNEL);
index 0c50d7410b31e903139133b96260226f4f7234df..d7d2e4b844bcd7fc316709bde2bed61e6613dd4c 100644 (file)
@@ -181,7 +181,7 @@ int set_selection_user(const struct tiocl_selection __user *sel,
        return set_selection_kernel(&v, tty);
 }
 
-int set_selection_kernel(struct tiocl_selection *v, struct tty_struct *tty)
+static int __set_selection_kernel(struct tiocl_selection *v, struct tty_struct *tty)
 {
        struct vc_data *vc = vc_cons[fg_console].d;
        int new_sel_start, new_sel_end, spc;
@@ -214,7 +214,6 @@ int set_selection_kernel(struct tiocl_selection *v, struct tty_struct *tty)
        if (ps > pe)    /* make sel_start <= sel_end */
                swap(ps, pe);
 
-       mutex_lock(&sel_lock);
        if (sel_cons != vc_cons[fg_console].d) {
                clear_selection();
                sel_cons = vc_cons[fg_console].d;
@@ -260,10 +259,9 @@ int set_selection_kernel(struct tiocl_selection *v, struct tty_struct *tty)
                        break;
                case TIOCL_SELPOINTER:
                        highlight_pointer(pe);
-                       goto unlock;
+                       return 0;
                default:
-                       ret = -EINVAL;
-                       goto unlock;
+                       return -EINVAL;
        }
 
        /* remove the pointer */
@@ -285,7 +283,7 @@ int set_selection_kernel(struct tiocl_selection *v, struct tty_struct *tty)
        else if (new_sel_start == sel_start)
        {
                if (new_sel_end == sel_end)     /* no action required */
-                       goto unlock;
+                       return 0;
                else if (new_sel_end > sel_end) /* extend to right */
                        highlight(sel_end + 2, new_sel_end);
                else                            /* contract from right */
@@ -313,8 +311,7 @@ int set_selection_kernel(struct tiocl_selection *v, struct tty_struct *tty)
        if (!bp) {
                printk(KERN_WARNING "selection: kmalloc() failed\n");
                clear_selection();
-               ret = -ENOMEM;
-               goto unlock;
+               return -ENOMEM;
        }
        kfree(sel_buffer);
        sel_buffer = bp;
@@ -339,8 +336,20 @@ int set_selection_kernel(struct tiocl_selection *v, struct tty_struct *tty)
                }
        }
        sel_buffer_lth = bp - sel_buffer;
-unlock:
+
+       return ret;
+}
+
+int set_selection_kernel(struct tiocl_selection *v, struct tty_struct *tty)
+{
+       int ret;
+
+       mutex_lock(&sel_lock);
+       console_lock();
+       ret = __set_selection_kernel(v, tty);
+       console_unlock();
        mutex_unlock(&sel_lock);
+
        return ret;
 }
 EXPORT_SYMBOL_GPL(set_selection_kernel);
index 0cfbb7182b5a592aa1519a033ce92f591066c2bb..15d27698054ab55aa841853bbb7d40940a423415 100644 (file)
@@ -3046,10 +3046,8 @@ int tioclinux(struct tty_struct *tty, unsigned long arg)
        switch (type)
        {
                case TIOCL_SETSEL:
-                       console_lock();
                        ret = set_selection_user((struct tiocl_selection
                                                 __user *)(p+1), tty);
-                       console_unlock();
                        break;
                case TIOCL_PASTESEL:
                        ret = paste_selection(tty);
index 736b0c6e27fe046bfac9b7449b0a8aafefdb0b85..3574dbb093667771334060aa0c4d9488ecf66575 100644 (file)
@@ -2550,7 +2550,7 @@ int cdns3_gadget_ep_dequeue(struct usb_ep *ep,
        /* Update ring only if removed request is on pending_req_list list */
        if (req_on_hw_ring) {
                link_trb->buffer = TRB_BUFFER(priv_ep->trb_pool_dma +
-                                             (priv_req->start_trb * TRB_SIZE));
+                       ((priv_req->end_trb + 1) * TRB_SIZE));
                link_trb->control = (link_trb->control & TRB_CYCLE) |
                                    TRB_TYPE(TRB_LINK) | TRB_CHAIN;
 
@@ -2595,11 +2595,21 @@ int __cdns3_gadget_ep_clear_halt(struct cdns3_endpoint *priv_ep)
 {
        struct cdns3_device *priv_dev = priv_ep->cdns3_dev;
        struct usb_request *request;
+       struct cdns3_request *priv_req;
+       struct cdns3_trb *trb = NULL;
        int ret;
        int val;
 
        trace_cdns3_halt(priv_ep, 0, 0);
 
+       request = cdns3_next_request(&priv_ep->pending_req_list);
+       if (request) {
+               priv_req = to_cdns3_request(request);
+               trb = priv_req->trb;
+               if (trb)
+                       trb->control = trb->control ^ TRB_CYCLE;
+       }
+
        writel(EP_CMD_CSTALL | EP_CMD_EPRST, &priv_dev->regs->ep_cmd);
 
        /* wait for EPRST cleared */
@@ -2610,10 +2620,11 @@ int __cdns3_gadget_ep_clear_halt(struct cdns3_endpoint *priv_ep)
 
        priv_ep->flags &= ~(EP_STALLED | EP_STALL_PENDING);
 
-       request = cdns3_next_request(&priv_ep->pending_req_list);
-
-       if (request)
+       if (request) {
+               if (trb)
+                       trb->control = trb->control ^ TRB_CYCLE;
                cdns3_rearm_transfer(priv_ep, 1);
+       }
 
        cdns3_start_all_request(priv_dev, priv_ep);
        return ret;
index 1d212f82c69b45f545de3a0aba130b551b9b6177..54cd8ef795ec042027a19e30ef754309adcf2329 100644 (file)
@@ -988,13 +988,17 @@ int usb_remove_device(struct usb_device *udev)
 {
        struct usb_hub *hub;
        struct usb_interface *intf;
+       int ret;
 
        if (!udev->parent)      /* Can't remove a root hub */
                return -EINVAL;
        hub = usb_hub_to_struct_hub(udev->parent);
        intf = to_usb_interface(hub->intfdev);
 
-       usb_autopm_get_interface(intf);
+       ret = usb_autopm_get_interface(intf);
+       if (ret < 0)
+               return ret;
+
        set_bit(udev->portnum, hub->removed_bits);
        hub_port_logical_disconnect(hub, udev->portnum);
        usb_autopm_put_interface(intf);
@@ -1866,7 +1870,7 @@ static int hub_probe(struct usb_interface *intf, const struct usb_device_id *id)
 
        if (id->driver_info & HUB_QUIRK_DISABLE_AUTOSUSPEND) {
                hub->quirk_disable_autosuspend = 1;
-               usb_autopm_get_interface(intf);
+               usb_autopm_get_interface_no_resume(intf);
        }
 
        if (hub_configure(hub, &desc->endpoint[0].desc) >= 0)
index bbbb35fa639fa43e6666eebfdb86c909595f6cf8..235a7c6455036ac7a6f110f943c678b09b1a24f0 100644 (file)
@@ -213,7 +213,10 @@ static int usb_port_runtime_resume(struct device *dev)
        if (!port_dev->is_superspeed && peer)
                pm_runtime_get_sync(&peer->dev);
 
-       usb_autopm_get_interface(intf);
+       retval = usb_autopm_get_interface(intf);
+       if (retval < 0)
+               return retval;
+
        retval = usb_hub_set_port_power(hdev, hub, port1, true);
        msleep(hub_power_on_good_delay(hub));
        if (udev && !retval) {
@@ -266,7 +269,10 @@ static int usb_port_runtime_suspend(struct device *dev)
        if (usb_port_block_power_off)
                return -EBUSY;
 
-       usb_autopm_get_interface(intf);
+       retval = usb_autopm_get_interface(intf);
+       if (retval < 0)
+               return retval;
+
        retval = usb_hub_set_port_power(hdev, hub, port1, false);
        usb_clear_port_feature(hdev, port1, USB_PORT_FEAT_C_CONNECTION);
        if (!port_dev->is_superspeed)
index 2b24336a72e564661f6f37d1d30e0b3c4abc2070..2dac3e7cdd97205d47883606a35a74d57711e26a 100644 (file)
@@ -231,6 +231,9 @@ static const struct usb_device_id usb_quirk_list[] = {
        /* Logitech PTZ Pro Camera */
        { USB_DEVICE(0x046d, 0x0853), .driver_info = USB_QUIRK_DELAY_INIT },
 
+       /* Logitech Screen Share */
+       { USB_DEVICE(0x046d, 0x086c), .driver_info = USB_QUIRK_NO_LPM },
+
        /* Logitech Quickcam Fusion */
        { USB_DEVICE(0x046d, 0x08c1), .driver_info = USB_QUIRK_RESET_RESUME },
 
index 1b7d2f9cb673a3f440677e309f1be827251693f7..1e00bf2d65a2045e139317d297831e39815ba005 100644 (file)
@@ -1071,7 +1071,14 @@ static void dwc3_prepare_one_trb_sg(struct dwc3_ep *dep,
                unsigned int rem = length % maxp;
                unsigned chain = true;
 
-               if (sg_is_last(s))
+               /*
+                * IOMMU driver is coalescing the list of sgs which shares a
+                * page boundary into one and giving it to USB driver. With
+                * this the number of sgs mapped is not equal to the number of
+                * sgs passed. So mark the chain bit to false if it isthe last
+                * mapped sg.
+                */
+               if (i == remaining - 1)
                        chain = false;
 
                if (rem && usb_endpoint_dir_out(dep->endpoint.desc) && !chain) {
index 10c9e7f6273eb5010f8391e34b1199a708358e04..29fe5771c21bce1ad28009b2b216a90299668ba4 100644 (file)
@@ -424,10 +424,6 @@ static int usb251xb_get_ofdata(struct usb251xb *hub,
                return err;
        }
 
-       hub->vdd = devm_regulator_get(dev, "vdd");
-       if (IS_ERR(hub->vdd))
-               return PTR_ERR(hub->vdd);
-
        if (of_property_read_u16_array(np, "vendor-id", &hub->vendor_id, 1))
                hub->vendor_id = USB251XB_DEF_VENDOR_ID;
 
@@ -640,6 +636,13 @@ static int usb251xb_get_ofdata(struct usb251xb *hub,
 }
 #endif /* CONFIG_OF */
 
+static void usb251xb_regulator_disable_action(void *data)
+{
+       struct usb251xb *hub = data;
+
+       regulator_disable(hub->vdd);
+}
+
 static int usb251xb_probe(struct usb251xb *hub)
 {
        struct device *dev = hub->dev;
@@ -676,10 +679,19 @@ static int usb251xb_probe(struct usb251xb *hub)
        if (err)
                return err;
 
+       hub->vdd = devm_regulator_get(dev, "vdd");
+       if (IS_ERR(hub->vdd))
+               return PTR_ERR(hub->vdd);
+
        err = regulator_enable(hub->vdd);
        if (err)
                return err;
 
+       err = devm_add_action_or_reset(dev,
+                                      usb251xb_regulator_disable_action, hub);
+       if (err)
+               return err;
+
        err = usb251xb_connect(hub);
        if (err) {
                dev_err(dev, "Failed to connect hub (%d)\n", err);
index 1cd9b6305b06042fecf75942c4f79af41747feea..1880f3e13f57633d7c401998d33f859e0423cc31 100644 (file)
@@ -1258,6 +1258,12 @@ UNUSUAL_DEV( 0x090a, 0x1200, 0x0000, 0x9999,
                USB_SC_RBC, USB_PR_BULK, NULL,
                0 ),
 
+UNUSUAL_DEV(0x090c, 0x1000, 0x1100, 0x1100,
+               "Samsung",
+               "Flash Drive FIT",
+               USB_SC_DEVICE, USB_PR_DEVICE, NULL,
+               US_FL_MAX_SECTORS_64),
+
 /* aeb */
 UNUSUAL_DEV( 0x090c, 0x1132, 0x0000, 0xffff,
                "Feiya",
index 403707a3e503b125ab4afe088babc9bef62bea81..0093bbd0d32659a9a090fac9ec4cb17aa6837de9 100644 (file)
@@ -456,6 +456,13 @@ config BACKLIGHT_RAVE_SP
        help
          Support for backlight control on RAVE SP device.
 
+config BACKLIGHT_LED
+       tristate "Generic LED based Backlight Driver"
+       depends on LEDS_CLASS && OF
+       help
+         If you have a LCD backlight adjustable by LED class driver, say Y
+         to enable this driver.
+
 endif # BACKLIGHT_CLASS_DEVICE
 
 endmenu
index 6f8777037c372ef1765add544096a8d042f743f6..0c1a1524627ad43032e721dcfd5ea24273474068 100644 (file)
@@ -57,3 +57,4 @@ obj-$(CONFIG_BACKLIGHT_TPS65217)      += tps65217_bl.o
 obj-$(CONFIG_BACKLIGHT_WM831X)         += wm831x_bl.o
 obj-$(CONFIG_BACKLIGHT_ARCXCNN)        += arcxcnn_bl.o
 obj-$(CONFIG_BACKLIGHT_RAVE_SP)                += rave-sp-backlight.o
+obj-$(CONFIG_BACKLIGHT_LED)            += led_bl.o
diff --git a/drivers/video/backlight/led_bl.c b/drivers/video/backlight/led_bl.c
new file mode 100644 (file)
index 0000000..3f66549
--- /dev/null
@@ -0,0 +1,260 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2015-2019 Texas Instruments Incorporated -  http://www.ti.com/
+ * Author: Tomi Valkeinen <tomi.valkeinen@ti.com>
+ *
+ * Based on pwm_bl.c
+ */
+
+#include <linux/backlight.h>
+#include <linux/leds.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+
+struct led_bl_data {
+       struct device           *dev;
+       struct backlight_device *bl_dev;
+       struct led_classdev     **leds;
+       bool                    enabled;
+       int                     nb_leds;
+       unsigned int            *levels;
+       unsigned int            default_brightness;
+       unsigned int            max_brightness;
+};
+
+static void led_bl_set_brightness(struct led_bl_data *priv, int level)
+{
+       int i;
+       int bkl_brightness;
+
+       if (priv->levels)
+               bkl_brightness = priv->levels[level];
+       else
+               bkl_brightness = level;
+
+       for (i = 0; i < priv->nb_leds; i++)
+               led_set_brightness(priv->leds[i], bkl_brightness);
+
+       priv->enabled = true;
+}
+
+static void led_bl_power_off(struct led_bl_data *priv)
+{
+       int i;
+
+       if (!priv->enabled)
+               return;
+
+       for (i = 0; i < priv->nb_leds; i++)
+               led_set_brightness(priv->leds[i], LED_OFF);
+
+       priv->enabled = false;
+}
+
+static int led_bl_update_status(struct backlight_device *bl)
+{
+       struct led_bl_data *priv = bl_get_data(bl);
+       int brightness = bl->props.brightness;
+
+       if (bl->props.power != FB_BLANK_UNBLANK ||
+           bl->props.fb_blank != FB_BLANK_UNBLANK ||
+           bl->props.state & BL_CORE_FBBLANK)
+               brightness = 0;
+
+       if (brightness > 0)
+               led_bl_set_brightness(priv, brightness);
+       else
+               led_bl_power_off(priv);
+
+       return 0;
+}
+
+static const struct backlight_ops led_bl_ops = {
+       .update_status  = led_bl_update_status,
+};
+
+static int led_bl_get_leds(struct device *dev,
+                          struct led_bl_data *priv)
+{
+       int i, nb_leds, ret;
+       struct device_node *node = dev->of_node;
+       struct led_classdev **leds;
+       unsigned int max_brightness;
+       unsigned int default_brightness;
+
+       ret = of_count_phandle_with_args(node, "leds", NULL);
+       if (ret < 0) {
+               dev_err(dev, "Unable to get led count\n");
+               return -EINVAL;
+       }
+
+       nb_leds = ret;
+       if (nb_leds < 1) {
+               dev_err(dev, "At least one LED must be specified!\n");
+               return -EINVAL;
+       }
+
+       leds = devm_kzalloc(dev, sizeof(struct led_classdev *) * nb_leds,
+                           GFP_KERNEL);
+       if (!leds)
+               return -ENOMEM;
+
+       for (i = 0; i < nb_leds; i++) {
+               leds[i] = devm_of_led_get(dev, i);
+               if (IS_ERR(leds[i]))
+                       return PTR_ERR(leds[i]);
+       }
+
+       /* check that the LEDs all have the same brightness range */
+       max_brightness = leds[0]->max_brightness;
+       for (i = 1; i < nb_leds; i++) {
+               if (max_brightness != leds[i]->max_brightness) {
+                       dev_err(dev, "LEDs must have identical ranges\n");
+                       return -EINVAL;
+               }
+       }
+
+       /* get the default brightness from the first LED from the list */
+       default_brightness = leds[0]->brightness;
+
+       priv->nb_leds = nb_leds;
+       priv->leds = leds;
+       priv->max_brightness = max_brightness;
+       priv->default_brightness = default_brightness;
+
+       return 0;
+}
+
+static int led_bl_parse_levels(struct device *dev,
+                          struct led_bl_data *priv)
+{
+       struct device_node *node = dev->of_node;
+       int num_levels;
+       u32 value;
+       int ret;
+
+       if (!node)
+               return -ENODEV;
+
+       num_levels = of_property_count_u32_elems(node, "brightness-levels");
+       if (num_levels > 1) {
+               int i;
+               unsigned int db;
+               u32 *levels = NULL;
+
+               levels = devm_kzalloc(dev, sizeof(u32) * num_levels,
+                                     GFP_KERNEL);
+               if (!levels)
+                       return -ENOMEM;
+
+               ret = of_property_read_u32_array(node, "brightness-levels",
+                                               levels,
+                                               num_levels);
+               if (ret < 0)
+                       return ret;
+
+               /*
+                * Try to map actual LED brightness to backlight brightness
+                * level
+                */
+               db = priv->default_brightness;
+               for (i = 0 ; i < num_levels; i++) {
+                       if ((i && db > levels[i-1]) && db <= levels[i])
+                               break;
+               }
+               priv->default_brightness = i;
+               priv->max_brightness = num_levels - 1;
+               priv->levels = levels;
+       } else if (num_levels >= 0)
+               dev_warn(dev, "Not enough levels defined\n");
+
+       ret = of_property_read_u32(node, "default-brightness-level", &value);
+       if (!ret && value <= priv->max_brightness)
+               priv->default_brightness = value;
+       else if (!ret  && value > priv->max_brightness)
+               dev_warn(dev, "Invalid default brightness. Ignoring it\n");
+
+       return 0;
+}
+
+static int led_bl_probe(struct platform_device *pdev)
+{
+       struct backlight_properties props;
+       struct led_bl_data *priv;
+       int ret, i;
+
+       priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
+       if (!priv)
+               return -ENOMEM;
+
+       platform_set_drvdata(pdev, priv);
+
+       priv->dev = &pdev->dev;
+
+       ret = led_bl_get_leds(&pdev->dev, priv);
+       if (ret)
+               return ret;
+
+       ret = led_bl_parse_levels(&pdev->dev, priv);
+       if (ret < 0) {
+               dev_err(&pdev->dev, "Failed to parse DT data\n");
+               return ret;
+       }
+
+       memset(&props, 0, sizeof(struct backlight_properties));
+       props.type = BACKLIGHT_RAW;
+       props.max_brightness = priv->max_brightness;
+       props.brightness = priv->default_brightness;
+       props.power = (priv->default_brightness > 0) ? FB_BLANK_POWERDOWN :
+                     FB_BLANK_UNBLANK;
+       priv->bl_dev = backlight_device_register(dev_name(&pdev->dev),
+                       &pdev->dev, priv, &led_bl_ops, &props);
+       if (IS_ERR(priv->bl_dev)) {
+               dev_err(&pdev->dev, "Failed to register backlight\n");
+               return PTR_ERR(priv->bl_dev);
+       }
+
+       for (i = 0; i < priv->nb_leds; i++)
+               led_sysfs_disable(priv->leds[i]);
+
+       backlight_update_status(priv->bl_dev);
+
+       return 0;
+}
+
+static int led_bl_remove(struct platform_device *pdev)
+{
+       struct led_bl_data *priv = platform_get_drvdata(pdev);
+       struct backlight_device *bl = priv->bl_dev;
+       int i;
+
+       backlight_device_unregister(bl);
+
+       led_bl_power_off(priv);
+       for (i = 0; i < priv->nb_leds; i++)
+               led_sysfs_enable(priv->leds[i]);
+
+       return 0;
+}
+
+static const struct of_device_id led_bl_of_match[] = {
+       { .compatible = "led-backlight" },
+       { }
+};
+
+MODULE_DEVICE_TABLE(of, led_bl_of_match);
+
+static struct platform_driver led_bl_driver = {
+       .driver         = {
+               .name           = "led-backlight",
+               .of_match_table = of_match_ptr(led_bl_of_match),
+       },
+       .probe          = led_bl_probe,
+       .remove         = led_bl_remove,
+};
+
+module_platform_driver(led_bl_driver);
+
+MODULE_DESCRIPTION("LED based Backlight Driver");
+MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:led-backlight");
index ce1077e32466ba9064e16d48f7bcb8c14c2c7be8..7c95516a860fa31de6e3ccccc751183550b1c92c 100644 (file)
@@ -52,7 +52,7 @@ struct xen_pcibk_dev_data {
        unsigned int ack_intr:1; /* .. and ACK-ing */
        unsigned long handled;
        unsigned int irq; /* Saved in case device transitions to MSI/MSI-X */
-       char irq_name[0]; /* xen-pcibk[000:04:00.0] */
+       char irq_name[]; /* xen-pcibk[000:04:00.0] */
 };
 
 /* Used by XenBus and xen_pcibk_ops.c */
index d239fc3c5e3ded66ad28194fcdc7d09a6df801da..eb5151fc8efab02899ce764b99a8d6f2955e9ca7 100644 (file)
@@ -313,6 +313,8 @@ static int process_msg(void)
                        req->msg.type = state.msg.type;
                        req->msg.len = state.msg.len;
                        req->body = state.body;
+                       /* write body, then update state */
+                       virt_wmb();
                        req->state = xb_req_state_got_reply;
                        req->cb(req);
                } else
@@ -395,6 +397,8 @@ static int process_writes(void)
        if (state.req->state == xb_req_state_aborted)
                kfree(state.req);
        else {
+               /* write err, then update state */
+               virt_wmb();
                state.req->state = xb_req_state_got_reply;
                wake_up(&state.req->wq);
        }
index 66975da4f3b60dff1995af08da2b8a835820946a..8c4d05b687b787a1272452bb7dd16b7913e40108 100644 (file)
@@ -239,9 +239,9 @@ int xenbus_dev_probe(struct device *_dev)
                goto fail;
        }
 
-       spin_lock(&dev->reclaim_lock);
+       down(&dev->reclaim_sem);
        err = drv->probe(dev, id);
-       spin_unlock(&dev->reclaim_lock);
+       up(&dev->reclaim_sem);
        if (err)
                goto fail_put;
 
@@ -271,9 +271,9 @@ int xenbus_dev_remove(struct device *_dev)
        free_otherend_watch(dev);
 
        if (drv->remove) {
-               spin_lock(&dev->reclaim_lock);
+               down(&dev->reclaim_sem);
                drv->remove(dev);
-               spin_unlock(&dev->reclaim_lock);
+               up(&dev->reclaim_sem);
        }
 
        module_put(drv->driver.owner);
@@ -473,7 +473,7 @@ int xenbus_probe_node(struct xen_bus_type *bus,
                goto fail;
 
        dev_set_name(&xendev->dev, "%s", devname);
-       spin_lock_init(&xendev->reclaim_lock);
+       sema_init(&xendev->reclaim_sem, 1);
 
        /* Register with generic device framework. */
        err = device_register(&xendev->dev);
index 791f6fe01e91ef1834750796d97cd241bd5f597c..9b2fbe69bccc7cdadb264997e680952ef95fde08 100644 (file)
@@ -45,6 +45,7 @@
 #include <linux/mm.h>
 #include <linux/notifier.h>
 #include <linux/export.h>
+#include <linux/semaphore.h>
 
 #include <asm/page.h>
 #include <asm/pgtable.h>
@@ -257,10 +258,10 @@ static int backend_reclaim_memory(struct device *dev, void *data)
        drv = to_xenbus_driver(dev->driver);
        if (drv && drv->reclaim_memory) {
                xdev = to_xenbus_device(dev);
-               if (!spin_trylock(&xdev->reclaim_lock))
+               if (down_trylock(&xdev->reclaim_sem))
                        return 0;
                drv->reclaim_memory(xdev);
-               spin_unlock(&xdev->reclaim_lock);
+               up(&xdev->reclaim_sem);
        }
        return 0;
 }
index ddc18da61834e6c04180bd2ada5f55d67e9c057a..3a06eb699f33309f1d836235e6ba160a59c484fb 100644 (file)
@@ -191,8 +191,11 @@ static bool xenbus_ok(void)
 
 static bool test_reply(struct xb_req_data *req)
 {
-       if (req->state == xb_req_state_got_reply || !xenbus_ok())
+       if (req->state == xb_req_state_got_reply || !xenbus_ok()) {
+               /* read req->state before all other fields */
+               virt_rmb();
                return true;
+       }
 
        /* Make sure to reread req->state each time. */
        barrier();
@@ -202,7 +205,7 @@ static bool test_reply(struct xb_req_data *req)
 
 static void *read_reply(struct xb_req_data *req)
 {
-       while (req->state != xb_req_state_got_reply) {
+       do {
                wait_event(req->wq, test_reply(req));
 
                if (!xenbus_ok())
@@ -216,7 +219,7 @@ static void *read_reply(struct xb_req_data *req)
                if (req->err)
                        return ERR_PTR(req->err);
 
-       }
+       } while (req->state != xb_req_state_got_reply);
 
        return req->body;
 }
index 1ccb3f8d528d9e84d3299b2c1fe9b7be51a77121..27076ebadb36b56358b107eb169c4134565369e8 100644 (file)
@@ -7783,6 +7783,7 @@ static inline blk_status_t btrfs_lookup_and_bind_dio_csum(struct inode *inode,
 {
        struct btrfs_io_bio *io_bio = btrfs_io_bio(bio);
        struct btrfs_io_bio *orig_io_bio = btrfs_io_bio(dip->orig_bio);
+       u16 csum_size;
        blk_status_t ret;
 
        /*
@@ -7802,7 +7803,8 @@ static inline blk_status_t btrfs_lookup_and_bind_dio_csum(struct inode *inode,
 
        file_offset -= dip->logical_offset;
        file_offset >>= inode->i_sb->s_blocksize_bits;
-       io_bio->csum = (u8 *)(((u32 *)orig_io_bio->csum) + file_offset);
+       csum_size = btrfs_super_csum_size(btrfs_sb(inode->i_sb)->super_copy);
+       io_bio->csum = orig_io_bio->csum + csum_size * file_offset;
 
        return 0;
 }
index 606f26d862dc18b1326e5c3cf4a9e1c9a746ac70..cc3ada12848d952466cedf9eb1c8dc03abcc1eae 100644 (file)
@@ -324,6 +324,8 @@ static struct vfsmount *cifs_dfs_do_automount(struct dentry *mntpt)
        if (full_path == NULL)
                goto cdda_exit;
 
+       convert_delimiter(full_path, '\\');
+
        cifs_dbg(FYI, "%s: full_path: %s\n", __func__, full_path);
 
        if (!cifs_sb_master_tlink(cifs_sb)) {
index 46ebaf3f0824b437bea81b8ead5156a2735929b6..fa77fe5258b0726ced3bc4a29180590a93c12aaf 100644 (file)
@@ -530,6 +530,8 @@ cifs_show_options(struct seq_file *s, struct dentry *root)
 
        if (tcon->seal)
                seq_puts(s, ",seal");
+       else if (tcon->ses->server->ignore_signature)
+               seq_puts(s, ",signloosely");
        if (tcon->nocase)
                seq_puts(s, ",nocase");
        if (tcon->local_lease)
index de82cfa44b1ae6e65ac5859676d729513352fab1..0d956360e984724224a5d28333936499107dd5a5 100644 (file)
@@ -1281,6 +1281,7 @@ struct cifs_fid {
        __u64 volatile_fid;     /* volatile file id for smb2 */
        __u8 lease_key[SMB2_LEASE_KEY_SIZE];    /* lease key for smb2 */
        __u8 create_guid[16];
+       __u32 access;
        struct cifs_pending_open *pending_open;
        unsigned int epoch;
 #ifdef CONFIG_CIFS_DEBUG2
@@ -1741,6 +1742,12 @@ static inline bool is_retryable_error(int error)
        return false;
 }
 
+
+/* cifs_get_writable_file() flags */
+#define FIND_WR_ANY         0
+#define FIND_WR_FSUID_ONLY  1
+#define FIND_WR_WITH_DELETE 2
+
 #define   MID_FREE 0
 #define   MID_REQUEST_ALLOCATED 1
 #define   MID_REQUEST_SUBMITTED 2
index 89eaaf46d1cadcab1c719b671d774a0a92efa12e..e5cb681ec13815aacd59dd3a3ce751ba06358765 100644 (file)
@@ -134,11 +134,12 @@ extern bool backup_cred(struct cifs_sb_info *);
 extern bool is_size_safe_to_change(struct cifsInodeInfo *, __u64 eof);
 extern void cifs_update_eof(struct cifsInodeInfo *cifsi, loff_t offset,
                            unsigned int bytes_written);
-extern struct cifsFileInfo *find_writable_file(struct cifsInodeInfo *, bool);
+extern struct cifsFileInfo *find_writable_file(struct cifsInodeInfo *, int);
 extern int cifs_get_writable_file(struct cifsInodeInfo *cifs_inode,
-                                 bool fsuid_only,
+                                 int flags,
                                  struct cifsFileInfo **ret_file);
 extern int cifs_get_writable_path(struct cifs_tcon *tcon, const char *name,
+                                 int flags,
                                  struct cifsFileInfo **ret_file);
 extern struct cifsFileInfo *find_readable_file(struct cifsInodeInfo *, bool);
 extern int cifs_get_readable_path(struct cifs_tcon *tcon, const char *name,
index 3c89569e721082895ebcba2f7f4bb33d584ec901..6f6fb3606a5d6094b498c99851d21d81b135b952 100644 (file)
@@ -1492,6 +1492,7 @@ CIFS_open(const unsigned int xid, struct cifs_open_parms *oparms, int *oplock,
        *oplock = rsp->OplockLevel;
        /* cifs fid stays in le */
        oparms->fid->netfid = rsp->Fid;
+       oparms->fid->access = desired_access;
 
        /* Let caller know file was created so we can set the mode. */
        /* Do we care about the CreateAction in any other cases? */
@@ -2115,7 +2116,7 @@ cifs_writev_requeue(struct cifs_writedata *wdata)
                wdata2->tailsz = tailsz;
                wdata2->bytes = cur_len;
 
-               rc = cifs_get_writable_file(CIFS_I(inode), false,
+               rc = cifs_get_writable_file(CIFS_I(inode), FIND_WR_ANY,
                                            &wdata2->cfile);
                if (!wdata2->cfile) {
                        cifs_dbg(VFS, "No writable handle to retry writepages rc=%d\n",
index bc9516ab4b34f22281f52056efab27b117afa558..3b942ecdd4be76c3c1bb5e0c996bf34a41357f60 100644 (file)
@@ -1958,7 +1958,7 @@ struct cifsFileInfo *find_readable_file(struct cifsInodeInfo *cifs_inode,
 
 /* Return -EBADF if no handle is found and general rc otherwise */
 int
-cifs_get_writable_file(struct cifsInodeInfo *cifs_inode, bool fsuid_only,
+cifs_get_writable_file(struct cifsInodeInfo *cifs_inode, int flags,
                       struct cifsFileInfo **ret_file)
 {
        struct cifsFileInfo *open_file, *inv_file = NULL;
@@ -1966,7 +1966,8 @@ cifs_get_writable_file(struct cifsInodeInfo *cifs_inode, bool fsuid_only,
        bool any_available = false;
        int rc = -EBADF;
        unsigned int refind = 0;
-
+       bool fsuid_only = flags & FIND_WR_FSUID_ONLY;
+       bool with_delete = flags & FIND_WR_WITH_DELETE;
        *ret_file = NULL;
 
        /*
@@ -1998,6 +1999,8 @@ cifs_get_writable_file(struct cifsInodeInfo *cifs_inode, bool fsuid_only,
                        continue;
                if (fsuid_only && !uid_eq(open_file->uid, current_fsuid()))
                        continue;
+               if (with_delete && !(open_file->fid.access & DELETE))
+                       continue;
                if (OPEN_FMODE(open_file->f_flags) & FMODE_WRITE) {
                        if (!open_file->invalidHandle) {
                                /* found a good writable file */
@@ -2045,12 +2048,12 @@ cifs_get_writable_file(struct cifsInodeInfo *cifs_inode, bool fsuid_only,
 }
 
 struct cifsFileInfo *
-find_writable_file(struct cifsInodeInfo *cifs_inode, bool fsuid_only)
+find_writable_file(struct cifsInodeInfo *cifs_inode, int flags)
 {
        struct cifsFileInfo *cfile;
        int rc;
 
-       rc = cifs_get_writable_file(cifs_inode, fsuid_only, &cfile);
+       rc = cifs_get_writable_file(cifs_inode, flags, &cfile);
        if (rc)
                cifs_dbg(FYI, "couldn't find writable handle rc=%d", rc);
 
@@ -2059,6 +2062,7 @@ find_writable_file(struct cifsInodeInfo *cifs_inode, bool fsuid_only)
 
 int
 cifs_get_writable_path(struct cifs_tcon *tcon, const char *name,
+                      int flags,
                       struct cifsFileInfo **ret_file)
 {
        struct list_head *tmp;
@@ -2085,7 +2089,7 @@ cifs_get_writable_path(struct cifs_tcon *tcon, const char *name,
                kfree(full_path);
                cinode = CIFS_I(d_inode(cfile->dentry));
                spin_unlock(&tcon->open_file_lock);
-               return cifs_get_writable_file(cinode, 0, ret_file);
+               return cifs_get_writable_file(cinode, flags, ret_file);
        }
 
        spin_unlock(&tcon->open_file_lock);
@@ -2162,7 +2166,8 @@ static int cifs_partialpagewrite(struct page *page, unsigned from, unsigned to)
        if (mapping->host->i_size - offset < (loff_t)to)
                to = (unsigned)(mapping->host->i_size - offset);
 
-       rc = cifs_get_writable_file(CIFS_I(mapping->host), false, &open_file);
+       rc = cifs_get_writable_file(CIFS_I(mapping->host), FIND_WR_ANY,
+                                   &open_file);
        if (!rc) {
                bytes_written = cifs_write(open_file, open_file->pid,
                                           write_data, to - from, &offset);
@@ -2355,7 +2360,7 @@ static int cifs_writepages(struct address_space *mapping,
                if (cfile)
                        cifsFileInfo_put(cfile);
 
-               rc = cifs_get_writable_file(CIFS_I(inode), false, &cfile);
+               rc = cifs_get_writable_file(CIFS_I(inode), FIND_WR_ANY, &cfile);
 
                /* in case of an error store it to return later */
                if (rc)
index b5e6635c578e8d6035b182558f3f7c2293eac99f..1e8a4b1579db49791592fdba227672f01c97d806 100644 (file)
@@ -653,8 +653,8 @@ cifs_all_info_to_fattr(struct cifs_fattr *fattr, FILE_ALL_INFO *info,
                 */
                if ((fattr->cf_nlink < 1) && !tcon->unix_ext &&
                    !info->DeletePending) {
-                       cifs_dbg(1, "bogus file nlink value %u\n",
-                               fattr->cf_nlink);
+                       cifs_dbg(VFS, "bogus file nlink value %u\n",
+                                fattr->cf_nlink);
                        fattr->cf_flags |= CIFS_FATTR_UNKNOWN_NLINK;
                }
        }
@@ -2073,6 +2073,7 @@ int cifs_revalidate_dentry_attr(struct dentry *dentry)
        struct inode *inode = d_inode(dentry);
        struct super_block *sb = dentry->d_sb;
        char *full_path = NULL;
+       int count = 0;
 
        if (inode == NULL)
                return -ENOENT;
@@ -2094,15 +2095,18 @@ int cifs_revalidate_dentry_attr(struct dentry *dentry)
                 full_path, inode, inode->i_count.counter,
                 dentry, cifs_get_time(dentry), jiffies);
 
+again:
        if (cifs_sb_master_tcon(CIFS_SB(sb))->unix_ext)
                rc = cifs_get_inode_info_unix(&inode, full_path, sb, xid);
        else
                rc = cifs_get_inode_info(&inode, full_path, NULL, sb,
                                         xid, NULL);
-
+       if (rc == -EAGAIN && count++ < 10)
+               goto again;
 out:
        kfree(full_path);
        free_xid(xid);
+
        return rc;
 }
 
@@ -2278,7 +2282,7 @@ cifs_set_file_size(struct inode *inode, struct iattr *attrs,
         * writebehind data than the SMB timeout for the SetPathInfo
         * request would allow
         */
-       open_file = find_writable_file(cifsInode, true);
+       open_file = find_writable_file(cifsInode, FIND_WR_FSUID_ONLY);
        if (open_file) {
                tcon = tlink_tcon(open_file->tlink);
                server = tcon->ses->server;
@@ -2428,7 +2432,7 @@ cifs_setattr_unix(struct dentry *direntry, struct iattr *attrs)
                args->ctime = NO_CHANGE_64;
 
        args->device = 0;
-       open_file = find_writable_file(cifsInode, true);
+       open_file = find_writable_file(cifsInode, FIND_WR_FSUID_ONLY);
        if (open_file) {
                u16 nfid = open_file->fid.netfid;
                u32 npid = open_file->pid;
@@ -2531,7 +2535,7 @@ cifs_setattr_nounix(struct dentry *direntry, struct iattr *attrs)
        rc = 0;
 
        if (attrs->ia_valid & ATTR_MTIME) {
-               rc = cifs_get_writable_file(cifsInode, false, &wfile);
+               rc = cifs_get_writable_file(cifsInode, FIND_WR_ANY, &wfile);
                if (!rc) {
                        tcon = tlink_tcon(wfile->tlink);
                        rc = tcon->ses->server->ops->flush(xid, tcon, &wfile->fid);
index eb994e313c6ae755437f375db1b1bb662c90db75..b130efaf8feb2260da9f4d00fee30fa6e53e599a 100644 (file)
@@ -766,7 +766,7 @@ smb_set_file_info(struct inode *inode, const char *full_path,
        struct cifs_tcon *tcon;
 
        /* if the file is already open for write, just use that fileid */
-       open_file = find_writable_file(cinode, true);
+       open_file = find_writable_file(cinode, FIND_WR_FSUID_ONLY);
        if (open_file) {
                fid.netfid = open_file->fid.netfid;
                netpid = open_file->pid;
index 1cf207564ff9676b6901e951a812267380effe10..a8c301ae00ed72f2bbcbbf0f3bf0bf6dfce0e29b 100644 (file)
@@ -521,7 +521,7 @@ smb2_mkdir_setinfo(struct inode *inode, const char *name,
        cifs_i = CIFS_I(inode);
        dosattrs = cifs_i->cifsAttrs | ATTR_READONLY;
        data.Attributes = cpu_to_le32(dosattrs);
-       cifs_get_writable_path(tcon, name, &cfile);
+       cifs_get_writable_path(tcon, name, FIND_WR_ANY, &cfile);
        tmprc = smb2_compound_op(xid, tcon, cifs_sb, name,
                                 FILE_WRITE_ATTRIBUTES, FILE_CREATE,
                                 CREATE_NOT_FILE, ACL_NO_MODE,
@@ -577,7 +577,7 @@ smb2_rename_path(const unsigned int xid, struct cifs_tcon *tcon,
 {
        struct cifsFileInfo *cfile;
 
-       cifs_get_writable_path(tcon, from_name, &cfile);
+       cifs_get_writable_path(tcon, from_name, FIND_WR_WITH_DELETE, &cfile);
 
        return smb2_set_path_attr(xid, tcon, from_name, to_name,
                                  cifs_sb, DELETE, SMB2_OP_RENAME, cfile);
index e47190cae1639a9793f9724f7cf19ba4fab1fed3..c31e84ee3c397d3d273a74024bcbba3d3a5c59c1 100644 (file)
@@ -1364,6 +1364,7 @@ smb2_set_fid(struct cifsFileInfo *cfile, struct cifs_fid *fid, __u32 oplock)
 
        cfile->fid.persistent_fid = fid->persistent_fid;
        cfile->fid.volatile_fid = fid->volatile_fid;
+       cfile->fid.access = fid->access;
 #ifdef CONFIG_CIFS_DEBUG2
        cfile->fid.mid = fid->mid;
 #endif /* CIFS_DEBUG2 */
@@ -3327,7 +3328,7 @@ static loff_t smb3_llseek(struct file *file, struct cifs_tcon *tcon, loff_t offs
         * some servers (Windows2016) will not reflect recent writes in
         * QUERY_ALLOCATED_RANGES until SMB2_flush is called.
         */
-       wrcfile = find_writable_file(cifsi, false);
+       wrcfile = find_writable_file(cifsi, FIND_WR_ANY);
        if (wrcfile) {
                filemap_write_and_wait(inode->i_mapping);
                smb2_flush_file(xid, tcon, &wrcfile->fid);
index 1234f9ccab0302b5df63a320f12bf7f397be26c9..28c0be5e69b7fcef9683621f353e4142284edbbe 100644 (file)
@@ -2771,6 +2771,7 @@ SMB2_open(const unsigned int xid, struct cifs_open_parms *oparms, __le16 *path,
        atomic_inc(&tcon->num_remote_opens);
        oparms->fid->persistent_fid = rsp->PersistentFileId;
        oparms->fid->volatile_fid = rsp->VolatileFileId;
+       oparms->fid->access = oparms->desired_access;
 #ifdef CONFIG_CIFS_DEBUG2
        oparms->fid->mid = le64_to_cpu(rsp->sync_hdr.MessageId);
 #endif /* CIFS_DEBUG2 */
index 634b09d18b77f46f5a24f0cd0f75ab8fae0e7876..db987b5110a9966d9d06cd4a4f34292efc87d999 100644 (file)
@@ -1090,21 +1090,12 @@ static const struct file_operations fops_regset32 = {
  * This function creates a file in debugfs with the given name that reports
  * the names and values of a set of 32-bit registers. If the @mode variable
  * is so set it can be read from. Writing is not supported.
- *
- * This function will return a pointer to a dentry if it succeeds.  This
- * pointer must be passed to the debugfs_remove() function when the file is
- * to be removed (no automatic cleanup happens if your module is unloaded,
- * you are responsible here.)  If an error occurs, ERR_PTR(-ERROR) will be
- * returned.
- *
- * If debugfs is not enabled in the kernel, the value ERR_PTR(-ENODEV) will
- * be returned.
  */
-struct dentry *debugfs_create_regset32(const char *name, umode_t mode,
-                                      struct dentry *parent,
-                                      struct debugfs_regset32 *regset)
+void debugfs_create_regset32(const char *name, umode_t mode,
+                            struct dentry *parent,
+                            struct debugfs_regset32 *regset)
 {
-       return debugfs_create_file(name, mode, parent, regset, &fops_regset32);
+       debugfs_create_file(name, mode, parent, regset, &fops_regset32);
 }
 EXPORT_SYMBOL_GPL(debugfs_create_regset32);
 
index 594b05ae16c9bf04584ae9c6c4dba50dbdecffcb..71946da8438849859b5240d199b216cf0b424f55 100644 (file)
@@ -750,6 +750,13 @@ static struct inode *fat_alloc_inode(struct super_block *sb)
                return NULL;
 
        init_rwsem(&ei->truncate_lock);
+       /* Zeroing to allow iput() even if partial initialized inode. */
+       ei->mmu_private = 0;
+       ei->i_start = 0;
+       ei->i_logstart = 0;
+       ei->i_attrs = 0;
+       ei->i_pos = 0;
+
        return &ei->vfs_inode;
 }
 
@@ -1374,16 +1381,6 @@ static int parse_options(struct super_block *sb, char *options, int is_vfat,
        return 0;
 }
 
-static void fat_dummy_inode_init(struct inode *inode)
-{
-       /* Initialize this dummy inode to work as no-op. */
-       MSDOS_I(inode)->mmu_private = 0;
-       MSDOS_I(inode)->i_start = 0;
-       MSDOS_I(inode)->i_logstart = 0;
-       MSDOS_I(inode)->i_attrs = 0;
-       MSDOS_I(inode)->i_pos = 0;
-}
-
 static int fat_read_root(struct inode *inode)
 {
        struct msdos_sb_info *sbi = MSDOS_SB(inode->i_sb);
@@ -1844,13 +1841,11 @@ int fat_fill_super(struct super_block *sb, void *data, int silent, int isvfat,
        fat_inode = new_inode(sb);
        if (!fat_inode)
                goto out_fail;
-       fat_dummy_inode_init(fat_inode);
        sbi->fat_inode = fat_inode;
 
        fsinfo_inode = new_inode(sb);
        if (!fsinfo_inode)
                goto out_fail;
-       fat_dummy_inode_init(fsinfo_inode);
        fsinfo_inode->i_ino = MSDOS_FSINFO_INO;
        sbi->fsinfo_inode = fsinfo_inode;
        insert_inode_hash(fsinfo_inode);
index 9bc167562ee80bfdcb8b1c6648576e988bbd04eb..2e4c0fa2074b00c7b4ea43715647368bf680d804 100644 (file)
@@ -735,8 +735,9 @@ static void send_sigio_to_task(struct task_struct *p,
                return;
 
        switch (signum) {
-               kernel_siginfo_t si;
-               default:
+               default: {
+                       kernel_siginfo_t si;
+
                        /* Queue a rt signal with the appropriate fd as its
                           value.  We use SI_SIGIO as the source, not 
                           SI_KERNEL, since kernel signals always get 
@@ -769,6 +770,7 @@ static void send_sigio_to_task(struct task_struct *p,
                        si.si_fd    = fd;
                        if (!do_send_sig_info(signum, &si, p, type))
                                break;
+               }
                /* fall-through - fall back on the old plain SIGIO signal */
                case 0:
                        do_send_sig_info(SIGIO, SEND_SIG_PRIV, p, type);
index bf8ed1b0b90a01ce356588ed8d9c1184ca2510f7..5cef075c0b379c11673ebab978d766fa5da80612 100644 (file)
@@ -502,7 +502,7 @@ static void io_worker_handle_work(struct io_worker *worker)
                if (worker->mm)
                        work->flags |= IO_WQ_WORK_HAS_MM;
 
-               if (wq->get_work && !(work->flags & IO_WQ_WORK_INTERNAL)) {
+               if (wq->get_work) {
                        put_work = work;
                        wq->get_work(work);
                }
@@ -747,6 +747,17 @@ static bool io_wq_can_queue(struct io_wqe *wqe, struct io_wqe_acct *acct,
        return true;
 }
 
+static void io_run_cancel(struct io_wq_work *work)
+{
+       do {
+               struct io_wq_work *old_work = work;
+
+               work->flags |= IO_WQ_WORK_CANCEL;
+               work->func(&work);
+               work = (work == old_work) ? NULL : work;
+       } while (work);
+}
+
 static void io_wqe_enqueue(struct io_wqe *wqe, struct io_wq_work *work)
 {
        struct io_wqe_acct *acct = io_work_get_acct(wqe, work);
@@ -760,8 +771,7 @@ static void io_wqe_enqueue(struct io_wqe *wqe, struct io_wq_work *work)
         * It's close enough to not be an issue, fork() has the same delay.
         */
        if (unlikely(!io_wq_can_queue(wqe, acct, work))) {
-               work->flags |= IO_WQ_WORK_CANCEL;
-               work->func(&work);
+               io_run_cancel(work);
                return;
        }
 
@@ -900,8 +910,7 @@ static enum io_wq_cancel io_wqe_cancel_cb_work(struct io_wqe *wqe,
        spin_unlock_irqrestore(&wqe->lock, flags);
 
        if (found) {
-               work->flags |= IO_WQ_WORK_CANCEL;
-               work->func(&work);
+               io_run_cancel(work);
                return IO_WQ_CANCEL_OK;
        }
 
@@ -976,8 +985,7 @@ static enum io_wq_cancel io_wqe_cancel_work(struct io_wqe *wqe,
        spin_unlock_irqrestore(&wqe->lock, flags);
 
        if (found) {
-               work->flags |= IO_WQ_WORK_CANCEL;
-               work->func(&work);
+               io_run_cancel(work);
                return IO_WQ_CANCEL_OK;
        }
 
@@ -1049,42 +1057,6 @@ enum io_wq_cancel io_wq_cancel_pid(struct io_wq *wq, pid_t pid)
        return ret;
 }
 
-struct io_wq_flush_data {
-       struct io_wq_work work;
-       struct completion done;
-};
-
-static void io_wq_flush_func(struct io_wq_work **workptr)
-{
-       struct io_wq_work *work = *workptr;
-       struct io_wq_flush_data *data;
-
-       data = container_of(work, struct io_wq_flush_data, work);
-       complete(&data->done);
-}
-
-/*
- * Doesn't wait for previously queued work to finish. When this completes,
- * it just means that previously queued work was started.
- */
-void io_wq_flush(struct io_wq *wq)
-{
-       struct io_wq_flush_data data;
-       int node;
-
-       for_each_node(node) {
-               struct io_wqe *wqe = wq->wqes[node];
-
-               if (!node_online(node))
-                       continue;
-               init_completion(&data.done);
-               INIT_IO_WORK(&data.work, io_wq_flush_func);
-               data.work.flags |= IO_WQ_WORK_INTERNAL;
-               io_wqe_enqueue(wqe, &data.work);
-               wait_for_completion(&data.done);
-       }
-}
-
 struct io_wq *io_wq_create(unsigned bounded, struct io_wq_data *data)
 {
        int ret = -ENOMEM, node;
index 33baba4370c5f26365e9f9ffc75cba71fb364a04..e5e15f2c93eca47965667fbddfa08b36de5ac3fd 100644 (file)
@@ -8,7 +8,6 @@ enum {
        IO_WQ_WORK_HAS_MM       = 2,
        IO_WQ_WORK_HASHED       = 4,
        IO_WQ_WORK_UNBOUND      = 32,
-       IO_WQ_WORK_INTERNAL     = 64,
        IO_WQ_WORK_CB           = 128,
        IO_WQ_WORK_NO_CANCEL    = 256,
        IO_WQ_WORK_CONCURRENT   = 512,
@@ -100,7 +99,6 @@ void io_wq_destroy(struct io_wq *wq);
 
 void io_wq_enqueue(struct io_wq *wq, struct io_wq_work *work);
 void io_wq_enqueue_hashed(struct io_wq *wq, struct io_wq_work *work, void *val);
-void io_wq_flush(struct io_wq *wq);
 
 void io_wq_cancel_all(struct io_wq *wq);
 enum io_wq_cancel io_wq_cancel_work(struct io_wq *wq, struct io_wq_work *cwork);
index 6a595c13e108ce2ad6a564e580fc271626623796..c06082bb039ac890e9fd84b095b6f5a62700fff1 100644 (file)
@@ -191,6 +191,7 @@ struct fixed_file_data {
        struct llist_head               put_llist;
        struct work_struct              ref_work;
        struct completion               done;
+       struct rcu_head                 rcu;
 };
 
 struct io_ring_ctx {
@@ -999,6 +1000,7 @@ static void io_kill_timeout(struct io_kiocb *req)
        if (ret != -1) {
                atomic_inc(&req->ctx->cq_timeouts);
                list_del_init(&req->list);
+               req->flags |= REQ_F_COMP_LOCKED;
                io_cqring_fill_event(req, 0);
                io_put_req(req);
        }
@@ -5329,6 +5331,26 @@ static void io_file_ref_kill(struct percpu_ref *ref)
        complete(&data->done);
 }
 
+static void __io_file_ref_exit_and_free(struct rcu_head *rcu)
+{
+       struct fixed_file_data *data = container_of(rcu, struct fixed_file_data,
+                                                       rcu);
+       percpu_ref_exit(&data->refs);
+       kfree(data);
+}
+
+static void io_file_ref_exit_and_free(struct rcu_head *rcu)
+{
+       /*
+        * We need to order our exit+free call against the potentially
+        * existing call_rcu() for switching to atomic. One way to do that
+        * is to have this rcu callback queue the final put and free, as we
+        * could otherwise have a pre-existing atomic switch complete _after_
+        * the free callback we queued.
+        */
+       call_rcu(rcu, __io_file_ref_exit_and_free);
+}
+
 static int io_sqe_files_unregister(struct io_ring_ctx *ctx)
 {
        struct fixed_file_data *data = ctx->file_data;
@@ -5341,14 +5363,13 @@ static int io_sqe_files_unregister(struct io_ring_ctx *ctx)
        flush_work(&data->ref_work);
        wait_for_completion(&data->done);
        io_ring_file_ref_flush(data);
-       percpu_ref_exit(&data->refs);
 
        __io_sqe_files_unregister(ctx);
        nr_tables = DIV_ROUND_UP(ctx->nr_user_files, IORING_MAX_FILES_TABLE);
        for (i = 0; i < nr_tables; i++)
                kfree(data->table[i].files);
        kfree(data->table);
-       kfree(data);
+       call_rcu(&data->rcu, io_file_ref_exit_and_free);
        ctx->file_data = NULL;
        ctx->nr_user_files = 0;
        return 0;
index 44b6da0328426ba0f133733114973f7d7a526e6a..426b55d333d5b1d85c032ead9c7a82e9ccef9a07 100644 (file)
@@ -753,20 +753,6 @@ int locks_delete_block(struct file_lock *waiter)
 {
        int status = -ENOENT;
 
-       /*
-        * If fl_blocker is NULL, it won't be set again as this thread
-        * "owns" the lock and is the only one that might try to claim
-        * the lock.  So it is safe to test fl_blocker locklessly.
-        * Also if fl_blocker is NULL, this waiter is not listed on
-        * fl_blocked_requests for some lock, so no other request can
-        * be added to the list of fl_blocked_requests for this
-        * request.  So if fl_blocker is NULL, it is safe to
-        * locklessly check if fl_blocked_requests is empty.  If both
-        * of these checks succeed, there is no need to take the lock.
-        */
-       if (waiter->fl_blocker == NULL &&
-           list_empty(&waiter->fl_blocked_requests))
-               return status;
        spin_lock(&blocked_lock_lock);
        if (waiter->fl_blocker)
                status = 0;
index 10455b2bbbb4a18f69e58621964354824b3f1787..f629d40c645cd3611200d470e8530b0cf5584c14 100644 (file)
@@ -1494,7 +1494,6 @@ static inline void put_dev_sector(Sector p)
 }
 
 int kblockd_schedule_work(struct work_struct *work);
-int kblockd_schedule_work_on(int cpu, struct work_struct *work);
 int kblockd_mod_delayed_work_on(int cpu, struct delayed_work *dwork, unsigned long delay);
 
 #define MODULE_ALIAS_BLOCKDEV(major,minor) \
index 3d013de64f70ec42e330ba04546b34fca02bd2b1..43efcc49f061fe606caa9e208f244d07d3918804 100644 (file)
@@ -127,9 +127,9 @@ struct dentry *debugfs_create_blob(const char *name, umode_t mode,
                                  struct dentry *parent,
                                  struct debugfs_blob_wrapper *blob);
 
-struct dentry *debugfs_create_regset32(const char *name, umode_t mode,
-                                    struct dentry *parent,
-                                    struct debugfs_regset32 *regset);
+void debugfs_create_regset32(const char *name, umode_t mode,
+                            struct dentry *parent,
+                            struct debugfs_regset32 *regset);
 
 void debugfs_print_regs32(struct seq_file *s, const struct debugfs_reg32 *regs,
                          int nregs, void __iomem *base, char *prefix);
@@ -304,11 +304,10 @@ static inline struct dentry *debugfs_create_blob(const char *name, umode_t mode,
        return ERR_PTR(-ENODEV);
 }
 
-static inline struct dentry *debugfs_create_regset32(const char *name,
-                                  umode_t mode, struct dentry *parent,
-                                  struct debugfs_regset32 *regset)
+static inline void debugfs_create_regset32(const char *name, umode_t mode,
+                                          struct dentry *parent,
+                                          struct debugfs_regset32 *regset)
 {
-       return ERR_PTR(-ENODEV);
 }
 
 static inline void debugfs_print_regs32(struct seq_file *s, const struct debugfs_reg32 *regs,
index 0cd7c647c16c6acc316df7ce03d9bf779f25ab34..fa04dfd22bbcd46655b7ac3bfaa14784927c0ef3 100644 (file)
@@ -798,6 +798,17 @@ static inline struct device_node *dev_of_node(struct device *dev)
        return dev->of_node;
 }
 
+static inline bool dev_has_sync_state(struct device *dev)
+{
+       if (!dev)
+               return false;
+       if (dev->driver && dev->driver->sync_state)
+               return true;
+       if (dev->bus && dev->bus->sync_state)
+               return true;
+       return false;
+}
+
 /*
  * High level routines for use by the bus drivers
  */
index 52269e56c514d24d318d982b805c5c9e9d7d3082..c54fb96cb1e6cc0fd85ab8cd337fe3b1b3f274b3 100644 (file)
@@ -2715,6 +2715,10 @@ static inline bool debug_pagealloc_enabled_static(void)
 #if defined(CONFIG_DEBUG_PAGEALLOC) || defined(CONFIG_ARCH_HAS_SET_DIRECT_MAP)
 extern void __kernel_map_pages(struct page *page, int numpages, int enable);
 
+/*
+ * When called in DEBUG_PAGEALLOC context, the call should most likely be
+ * guarded by debug_pagealloc_enabled() or debug_pagealloc_enabled_static()
+ */
 static inline void
 kernel_map_pages(struct page *page, int numpages, int enable)
 {
index 0bf9fddb830640dd282c38ee1a001e9c9d2b4f6e..3b400b1919a9bd8a9a446da90e37a3582af15de9 100644 (file)
@@ -11,6 +11,7 @@ struct omap2_mcspi_platform_config {
        unsigned short  num_cs;
        unsigned int regs_offset;
        unsigned int pin_dir:1;
+       size_t max_xfer_len;
 };
 
 struct omap2_mcspi_device_config {
index f0e4f36f83bfa7d349f54d278cc46e5db235d8bb..8a2266676b2dd2054e7e93903a31f9dfd57fa80e 100644 (file)
@@ -1157,7 +1157,7 @@ struct snd_soc_pcm_runtime {
             ((i) < rtd->num_codecs) && ((dai) = rtd->codec_dais[i]); \
             (i)++)
 #define for_each_rtd_codec_dai_rollback(rtd, i, dai)           \
-       for (; ((--i) >= 0) && ((dai) = rtd->codec_dais[i]);)
+       for (; (--(i) >= 0) && ((dai) = rtd->codec_dais[i]);)
 
 void snd_soc_close_delayed_work(struct snd_soc_pcm_runtime *rtd);
 
index 2df8ceca1f9b8479ff0537d421baec643a7de2cc..6622912c2342edc0acf9a55f8a1affa2f12a4763 100644 (file)
@@ -272,9 +272,9 @@ enum {
 #define DM_DEV_SET_GEOMETRY    _IOWR(DM_IOCTL, DM_DEV_SET_GEOMETRY_CMD, struct dm_ioctl)
 
 #define DM_VERSION_MAJOR       4
-#define DM_VERSION_MINOR       41
+#define DM_VERSION_MINOR       42
 #define DM_VERSION_PATCHLEVEL  0
-#define DM_VERSION_EXTRA       "-ioctl (2019-09-16)"
+#define DM_VERSION_EXTRA       "-ioctl (2020-02-27)"
 
 /* Status bits */
 #define DM_READONLY_FLAG       (1 << 0) /* In/Out */
index 28e7dcd75e829a3b45b44d66a0f07526f30a1283..f8aa8bac5196b4cf36e0d45fa05f52cc209adf3b 100644 (file)
@@ -46,7 +46,7 @@ struct vtpm_shared_page {
        uint8_t pad;
 
        uint8_t nr_extra_pages;  /* extra pages for long packets; may be zero */
-       uint32_t extra_pages[0]; /* grant IDs; length in nr_extra_pages */
+       uint32_t extra_pages[]; /* grant IDs; length in nr_extra_pages */
 };
 
 #endif
index 89a889585ba0148c5bd3854583694f82e7ed99f1..850a43bd69d32b8da48162b5430e2ff2b50673ef 100644 (file)
@@ -42,6 +42,7 @@
 #include <linux/completion.h>
 #include <linux/init.h>
 #include <linux/slab.h>
+#include <linux/semaphore.h>
 #include <xen/interface/xen.h>
 #include <xen/interface/grant_table.h>
 #include <xen/interface/io/xenbus.h>
@@ -76,7 +77,7 @@ struct xenbus_device {
        enum xenbus_state state;
        struct completion down;
        struct work_struct work;
-       spinlock_t reclaim_lock;
+       struct semaphore reclaim_sem;
 };
 
 static inline struct xenbus_device *to_xenbus_device(struct device *dev)
index 2833ffb0c2110c482010954e73ed836395eaa6a6..0b81b26a872a066fca5b6fbdd78404e9a2570d49 100644 (file)
@@ -619,8 +619,8 @@ static void forget_original_parent(struct task_struct *father,
        reaper = find_new_reaper(father, reaper);
        list_for_each_entry(p, &father->children, sibling) {
                for_each_thread(p, t) {
-                       t->real_parent = reaper;
-                       BUG_ON((!t->ptrace) != (t->parent == father));
+                       RCU_INIT_POINTER(t->real_parent, reaper);
+                       BUG_ON((!t->ptrace) != (rcu_access_pointer(t->parent) == father));
                        if (likely(!t->ptrace))
                                t->parent = t->real_parent;
                        if (t->pdeath_signal)
index 60a1295f4384363ae9b35e589c02e52fbf914a26..86425305cd4acc59b9d1c6a76a4c912d73ca2059 100644 (file)
@@ -1508,7 +1508,7 @@ static int copy_sighand(unsigned long clone_flags, struct task_struct *tsk)
                return 0;
        }
        sig = kmem_cache_alloc(sighand_cachep, GFP_KERNEL);
-       rcu_assign_pointer(tsk->sighand, sig);
+       RCU_INIT_POINTER(tsk->sighand, sig);
        if (!sig)
                return -ENOMEM;
 
index 3c8a379c357e5f9686b376ab87a6a156da8db655..c1217bfe5e819083ba7bbfd99fd8e3453d34f4a7 100644 (file)
@@ -8337,6 +8337,8 @@ static inline void update_sg_wakeup_stats(struct sched_domain *sd,
 
        sgs->group_capacity = group->sgc->capacity;
 
+       sgs->group_weight = group->group_weight;
+
        sgs->group_type = group_classify(sd->imbalance_pct, group, sgs);
 
        /*
index 4560878f0bac01f78a038c34158c2d91d8eba37c..ca39dc3230cb3a9e075735ac331968cbac879caf 100644 (file)
@@ -1896,8 +1896,11 @@ static ssize_t sysfs_blk_trace_attr_store(struct device *dev,
        }
 
        ret = 0;
-       if (bt == NULL)
+       if (bt == NULL) {
                ret = blk_trace_setup_queue(q, bdev);
+               bt = rcu_dereference_protected(q->blk_trace,
+                               lockdep_is_held(&q->blk_trace_mutex));
+       }
 
        if (ret == 0) {
                if (attr == &dev_attr_act_mask)
index b08b199f9a111004e5bfcb92fbdd9870368529a4..24ad53b4dfc0576c6cde8acf94cf6fe478553684 100644 (file)
@@ -3043,8 +3043,7 @@ void set_pmd_migration_entry(struct page_vma_mapped_walk *pvmw,
                return;
 
        flush_cache_range(vma, address, address + HPAGE_PMD_SIZE);
-       pmdval = *pvmw->pmd;
-       pmdp_invalidate(vma, address, pvmw->pmd);
+       pmdval = pmdp_invalidate(vma, address, pvmw->pmd);
        if (pmd_dirty(pmdval))
                set_page_dirty(page);
        entry = make_migration_entry(page, pmd_write(pmdval));
index 0bccc622e4822b03d47ef5ec7714d9b17009ed55..e8bfdf0d9d1dd98c0341bdfc9adc11ae4a948cb7 100644 (file)
@@ -2257,7 +2257,7 @@ static inline bool cow_user_page(struct page *dst, struct page *src,
        bool ret;
        void *kaddr;
        void __user *uaddr;
-       bool force_mkyoung;
+       bool locked = false;
        struct vm_area_struct *vma = vmf->vma;
        struct mm_struct *mm = vma->vm_mm;
        unsigned long addr = vmf->address;
@@ -2282,11 +2282,11 @@ static inline bool cow_user_page(struct page *dst, struct page *src,
         * On architectures with software "accessed" bits, we would
         * take a double page fault, so mark it accessed here.
         */
-       force_mkyoung = arch_faults_on_old_pte() && !pte_young(vmf->orig_pte);
-       if (force_mkyoung) {
+       if (arch_faults_on_old_pte() && !pte_young(vmf->orig_pte)) {
                pte_t entry;
 
                vmf->pte = pte_offset_map_lock(mm, vmf->pmd, addr, &vmf->ptl);
+               locked = true;
                if (!likely(pte_same(*vmf->pte, vmf->orig_pte))) {
                        /*
                         * Other thread has already handled the fault
@@ -2310,18 +2310,37 @@ static inline bool cow_user_page(struct page *dst, struct page *src,
         * zeroes.
         */
        if (__copy_from_user_inatomic(kaddr, uaddr, PAGE_SIZE)) {
+               if (locked)
+                       goto warn;
+
+               /* Re-validate under PTL if the page is still mapped */
+               vmf->pte = pte_offset_map_lock(mm, vmf->pmd, addr, &vmf->ptl);
+               locked = true;
+               if (!likely(pte_same(*vmf->pte, vmf->orig_pte))) {
+                       /* The PTE changed under us. Retry page fault. */
+                       ret = false;
+                       goto pte_unlock;
+               }
+
                /*
-                * Give a warn in case there can be some obscure
-                * use-case
+                * The same page can be mapped back since last copy attampt.
+                * Try to copy again under PTL.
                 */
-               WARN_ON_ONCE(1);
-               clear_page(kaddr);
+               if (__copy_from_user_inatomic(kaddr, uaddr, PAGE_SIZE)) {
+                       /*
+                        * Give a warn in case there can be some obscure
+                        * use-case
+                        */
+warn:
+                       WARN_ON_ONCE(1);
+                       clear_page(kaddr);
+               }
        }
 
        ret = true;
 
 pte_unlock:
-       if (force_mkyoung)
+       if (locked)
                pte_unmap_unlock(vmf->pte, vmf->ptl);
        kunmap_atomic(kaddr);
        flush_dcache_page(dst);
index 0a54ffac8c682ae5c940642c6b5d45cfb22cada5..19389cdc16a502f04726f4e12bab64cb8e4e1879 100644 (file)
@@ -574,7 +574,13 @@ EXPORT_SYMBOL_GPL(restore_online_page_callback);
 
 void generic_online_page(struct page *page, unsigned int order)
 {
-       kernel_map_pages(page, 1 << order, 1);
+       /*
+        * Freeing the page with debug_pagealloc enabled will try to unmap it,
+        * so we should map it first. This is better than introducing a special
+        * case in page freeing fast path.
+        */
+       if (debug_pagealloc_enabled_static())
+               kernel_map_pages(page, 1 << order, 1);
        __free_pages_core(page, order);
        totalram_pages_add(1UL << order);
 #ifdef CONFIG_HIGHMEM
index 7a8e84f86831b4e4f2a8cdf535bf48fb9990979e..311c0dadf71c9f5eb51b4d2004028fe0fe9cc4d8 100644 (file)
@@ -161,6 +161,31 @@ static unsigned long change_pte_range(struct vm_area_struct *vma, pmd_t *pmd,
        return pages;
 }
 
+/*
+ * Used when setting automatic NUMA hinting protection where it is
+ * critical that a numa hinting PMD is not confused with a bad PMD.
+ */
+static inline int pmd_none_or_clear_bad_unless_trans_huge(pmd_t *pmd)
+{
+       pmd_t pmdval = pmd_read_atomic(pmd);
+
+       /* See pmd_none_or_trans_huge_or_clear_bad for info on barrier */
+#ifdef CONFIG_TRANSPARENT_HUGEPAGE
+       barrier();
+#endif
+
+       if (pmd_none(pmdval))
+               return 1;
+       if (pmd_trans_huge(pmdval))
+               return 0;
+       if (unlikely(pmd_bad(pmdval))) {
+               pmd_clear_bad(pmd);
+               return 1;
+       }
+
+       return 0;
+}
+
 static inline unsigned long change_pmd_range(struct vm_area_struct *vma,
                pud_t *pud, unsigned long addr, unsigned long end,
                pgprot_t newprot, int dirty_accountable, int prot_numa)
@@ -178,8 +203,17 @@ static inline unsigned long change_pmd_range(struct vm_area_struct *vma,
                unsigned long this_pages;
 
                next = pmd_addr_end(addr, end);
-               if (!is_swap_pmd(*pmd) && !pmd_trans_huge(*pmd) && !pmd_devmap(*pmd)
-                               && pmd_none_or_clear_bad(pmd))
+
+               /*
+                * Automatic NUMA balancing walks the tables with mmap_sem
+                * held for read. It's possible a parallel update to occur
+                * between pmd_trans_huge() and a pmd_none_or_clear_bad()
+                * check leading to a false positive and clearing.
+                * Hence, it's necessary to atomically read the PMD value
+                * for all the checks.
+                */
+               if (!is_swap_pmd(*pmd) && !pmd_devmap(*pmd) &&
+                    pmd_none_or_clear_bad_unless_trans_huge(pmd))
                        goto next;
 
                /* invoke the mmu notifier if the pmd is populated */
index 43754d8ebce8fc941cc809afbb89bace1c907657..42f31c4b53ad43e4204874fb20d3d901d9ef921a 100644 (file)
@@ -41,7 +41,6 @@
 #include <linux/workqueue.h>
 #include <linux/slab.h>
 #include <linux/spinlock.h>
-#include <linux/rwlock.h>
 #include <linux/zpool.h>
 #include <linux/magic.h>
 
old mode 100644 (file)
new mode 100755 (executable)
index 9f60a5037f8bc36d2d53c09e0c813d2f02ef6f8e..5bf1ea150f26478791014bef55da611f1780a924 100644 (file)
@@ -649,8 +649,6 @@ snd_sgio2audio_pcm_pointer(struct snd_pcm_substream *substream)
 static const struct snd_pcm_ops snd_sgio2audio_playback1_ops = {
        .open =        snd_sgio2audio_playback1_open,
        .close =       snd_sgio2audio_pcm_close,
-       .hw_params =   snd_sgio2audio_pcm_hw_params,
-       .hw_free =     snd_sgio2audio_pcm_hw_free,
        .prepare =     snd_sgio2audio_pcm_prepare,
        .trigger =     snd_sgio2audio_pcm_trigger,
        .pointer =     snd_sgio2audio_pcm_pointer,
@@ -659,8 +657,6 @@ static const struct snd_pcm_ops snd_sgio2audio_playback1_ops = {
 static const struct snd_pcm_ops snd_sgio2audio_playback2_ops = {
        .open =        snd_sgio2audio_playback2_open,
        .close =       snd_sgio2audio_pcm_close,
-       .hw_params =   snd_sgio2audio_pcm_hw_params,
-       .hw_free =     snd_sgio2audio_pcm_hw_free,
        .prepare =     snd_sgio2audio_pcm_prepare,
        .trigger =     snd_sgio2audio_pcm_trigger,
        .pointer =     snd_sgio2audio_pcm_pointer,
@@ -669,8 +665,6 @@ static const struct snd_pcm_ops snd_sgio2audio_playback2_ops = {
 static const struct snd_pcm_ops snd_sgio2audio_capture_ops = {
        .open =        snd_sgio2audio_capture_open,
        .close =       snd_sgio2audio_pcm_close,
-       .hw_params =   snd_sgio2audio_pcm_hw_params,
-       .hw_free =     snd_sgio2audio_pcm_hw_free,
        .prepare =     snd_sgio2audio_pcm_prepare,
        .trigger =     snd_sgio2audio_pcm_trigger,
        .pointer =     snd_sgio2audio_pcm_pointer,
index 477589e7ec1d90b8346542c3dd8cf8bd57b9063f..0ac06ff1a17c1725d3034bce9dfb03d2fa40a999 100644 (file)
@@ -2447,6 +2447,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = {
        SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
        SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
        SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
+       SND_PCI_QUIRK(0x1458, 0xa0cd, "Gigabyte X570 Aorus Master", ALC1220_FIXUP_CLEVO_P950),
        SND_PCI_QUIRK(0x1462, 0x1228, "MSI-GP63", ALC1220_FIXUP_CLEVO_P950),
        SND_PCI_QUIRK(0x1462, 0x1276, "MSI-GL73", ALC1220_FIXUP_CLEVO_P950),
        SND_PCI_QUIRK(0x1462, 0x1293, "MSI-GP65", ALC1220_FIXUP_CLEVO_P950),
@@ -5920,7 +5921,8 @@ enum {
        ALC289_FIXUP_DUAL_SPK,
        ALC294_FIXUP_SPK2_TO_DAC1,
        ALC294_FIXUP_ASUS_DUAL_SPK,
-
+       ALC285_FIXUP_THINKPAD_HEADSET_JACK,
+       ALC294_FIXUP_ASUS_HPE,
 };
 
 static const struct hda_fixup alc269_fixups[] = {
@@ -6684,6 +6686,8 @@ static const struct hda_fixup alc269_fixups[] = {
        [ALC285_FIXUP_SPEAKER2_TO_DAC1] = {
                .type = HDA_FIXUP_FUNC,
                .v.func = alc285_fixup_speaker2_to_dac1,
+               .chained = true,
+               .chain_id = ALC269_FIXUP_THINKPAD_ACPI
        },
        [ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = {
                .type = HDA_FIXUP_PINS,
@@ -7040,7 +7044,23 @@ static const struct hda_fixup alc269_fixups[] = {
                .chained = true,
                .chain_id = ALC294_FIXUP_SPK2_TO_DAC1
        },
-
+       [ALC285_FIXUP_THINKPAD_HEADSET_JACK] = {
+               .type = HDA_FIXUP_FUNC,
+               .v.func = alc_fixup_headset_jack,
+               .chained = true,
+               .chain_id = ALC285_FIXUP_SPEAKER2_TO_DAC1
+       },
+       [ALC294_FIXUP_ASUS_HPE] = {
+               .type = HDA_FIXUP_VERBS,
+               .v.verbs = (const struct hda_verb[]) {
+                       /* Set EAPD high */
+                       { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
+                       { 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
+                       { }
+               },
+               .chained = true,
+               .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
+       },
 };
 
 static const struct snd_pci_quirk alc269_fixup_tbl[] = {
@@ -7115,6 +7135,8 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
        SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
        SND_PCI_QUIRK(0x1028, 0x097e, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
        SND_PCI_QUIRK(0x1028, 0x097d, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
+       SND_PCI_QUIRK(0x1028, 0x098d, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
+       SND_PCI_QUIRK(0x1028, 0x09bf, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
        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),
@@ -7204,6 +7226,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
        SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
        SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK),
        SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC),
+       SND_PCI_QUIRK(0x1043, 0x19ce, "ASUS B9450FA", ALC294_FIXUP_ASUS_HPE),
        SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
        SND_PCI_QUIRK(0x1043, 0x1a30, "ASUS X705UD", ALC256_FIXUP_ASUS_MIC),
        SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
@@ -7274,8 +7297,8 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
        SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
        SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
        SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
-       SND_PCI_QUIRK(0x17aa, 0x2292, "Thinkpad X1 Yoga 7th", ALC285_FIXUP_SPEAKER2_TO_DAC1),
-       SND_PCI_QUIRK(0x17aa, 0x2293, "Thinkpad X1 Carbon 7th", ALC285_FIXUP_SPEAKER2_TO_DAC1),
+       SND_PCI_QUIRK(0x17aa, 0x2292, "Thinkpad X1 Yoga 7th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
+       SND_PCI_QUIRK(0x17aa, 0x2293, "Thinkpad X1 Carbon 7th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
        SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
        SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
        SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
index 7e90f5d83097130945718686d1a2f0715cd5cfef..ea912439e446787204316aecbe893877ce4d1f4c 100644 (file)
@@ -1406,7 +1406,7 @@ config SND_SOC_WM8737
        depends on SND_SOC_I2C_AND_SPI
 
 config SND_SOC_WM8741
-       tristate "Wolfson Microelectronics WM8737 DAC"
+       tristate "Wolfson Microelectronics WM8741 DAC"
        depends on SND_SOC_I2C_AND_SPI
 
 config SND_SOC_WM8750
index 861210f6bf4fda8516011d481e8c4f2031b4922d..4cbef9affffda95ce6af991a40d8310cf11ed13d 100644 (file)
@@ -1564,13 +1564,15 @@ int pcm512x_probe(struct device *dev, struct regmap *regmap)
        }
 
        pcm512x->sclk = devm_clk_get(dev, NULL);
-       if (PTR_ERR(pcm512x->sclk) == -EPROBE_DEFER)
-               return -EPROBE_DEFER;
+       if (PTR_ERR(pcm512x->sclk) == -EPROBE_DEFER) {
+               ret = -EPROBE_DEFER;
+               goto err;
+       }
        if (!IS_ERR(pcm512x->sclk)) {
                ret = clk_prepare_enable(pcm512x->sclk);
                if (ret != 0) {
                        dev_err(dev, "Failed to enable SCLK: %d\n", ret);
-                       return ret;
+                       goto err;
                }
        }
 
index 6d490e2dbc259b9442e92103010d979ba4eea58c..66eb55b4ffd4c75e979f80a22f05343d4d460cf1 100644 (file)
@@ -664,7 +664,7 @@ static int rt1015_hw_params(struct snd_pcm_substream *substream,
        snd_soc_component_update_bits(component, RT1015_TDM_MASTER,
                RT1015_I2S_DL_MASK, val_len);
        snd_soc_component_update_bits(component, RT1015_CLK2,
-               RT1015_FS_PD_MASK, pre_div);
+               RT1015_FS_PD_MASK, pre_div << RT1015_FS_PD_SFT);
 
        return 0;
 }
@@ -857,6 +857,7 @@ struct snd_soc_dai_driver rt1015_dai[] = {
                        .rates = RT1015_STEREO_RATES,
                        .formats = RT1015_FORMATS,
                },
+               .ops = &rt1015_aif_dai_ops,
        }
 };
 
index 729acd874c485cebd0826fa269430a3a57330878..be52886a5edb21435c4448b22e65b2214e6172d5 100644 (file)
@@ -215,7 +215,8 @@ static int tas2562_set_bitwidth(struct tas2562_data *tas2562, int bitwidth)
                break;
 
        default:
-               dev_info(tas2562->dev, "Not supported params format\n");
+               dev_info(tas2562->dev, "Unsupported bitwidth format\n");
+               return -EINVAL;
        }
 
        ret = snd_soc_component_update_bits(tas2562->component,
@@ -251,7 +252,7 @@ static int tas2562_hw_params(struct snd_pcm_substream *substream,
 
        ret = tas2562_set_samplerate(tas2562, params_rate(params));
        if (ret)
-               dev_err(tas2562->dev, "set bitwidth failed, %d\n", ret);
+               dev_err(tas2562->dev, "set sample rate failed, %d\n", ret);
 
        return ret;
 }
index 3466675f26785572db1b73ec0a38a4423b005407..a15aa2ffa681082f2b142184e4e0bdeb243efbfe 100644 (file)
@@ -34,8 +34,8 @@ static ssize_t skl_print_pins(struct skl_module_pin *m_pin, char *buf,
        int i;
        ssize_t ret = 0;
 
-       for (i = 0; i < max_pin; i++)
-               ret += snprintf(buf + size, MOD_BUF - size,
+       for (i = 0; i < max_pin; i++) {
+               ret += scnprintf(buf + size, MOD_BUF - size,
                                "%s %d\n\tModule %d\n\tInstance %d\n\t"
                                "In-used %s\n\tType %s\n"
                                "\tState %d\n\tIndex %d\n",
@@ -45,13 +45,15 @@ static ssize_t skl_print_pins(struct skl_module_pin *m_pin, char *buf,
                                m_pin[i].in_use ? "Used" : "Unused",
                                m_pin[i].is_dynamic ? "Dynamic" : "Static",
                                m_pin[i].pin_state, i);
+               size += ret;
+       }
        return ret;
 }
 
 static ssize_t skl_print_fmt(struct skl_module_fmt *fmt, char *buf,
                                        ssize_t size, bool direction)
 {
-       return snprintf(buf + size, MOD_BUF - size,
+       return scnprintf(buf + size, MOD_BUF - size,
                        "%s\n\tCh %d\n\tFreq %d\n\tBit depth %d\n\t"
                        "Valid bit depth %d\n\tCh config %#x\n\tInterleaving %d\n\t"
                        "Sample Type %d\n\tCh Map %#x\n",
@@ -75,16 +77,16 @@ static ssize_t module_read(struct file *file, char __user *user_buf,
        if (!buf)
                return -ENOMEM;
 
-       ret = snprintf(buf, MOD_BUF, "Module:\n\tUUID %pUL\n\tModule id %d\n"
+       ret = scnprintf(buf, MOD_BUF, "Module:\n\tUUID %pUL\n\tModule id %d\n"
                        "\tInstance id %d\n\tPvt_id %d\n", mconfig->guid,
                        mconfig->id.module_id, mconfig->id.instance_id,
                        mconfig->id.pvt_id);
 
-       ret += snprintf(buf + ret, MOD_BUF - ret,
+       ret += scnprintf(buf + ret, MOD_BUF - ret,
                        "Resources:\n\tCPC %#x\n\tIBS %#x\n\tOBS %#x\t\n",
                        res->cpc, res->ibs, res->obs);
 
-       ret += snprintf(buf + ret, MOD_BUF - ret,
+       ret += scnprintf(buf + ret, MOD_BUF - ret,
                        "Module data:\n\tCore %d\n\tIn queue %d\n\t"
                        "Out queue %d\n\tType %s\n",
                        mconfig->core_id, mconfig->max_in_queue,
@@ -94,38 +96,38 @@ static ssize_t module_read(struct file *file, char __user *user_buf,
        ret += skl_print_fmt(mconfig->in_fmt, buf, ret, true);
        ret += skl_print_fmt(mconfig->out_fmt, buf, ret, false);
 
-       ret += snprintf(buf + ret, MOD_BUF - ret,
+       ret += scnprintf(buf + ret, MOD_BUF - ret,
                        "Fixup:\n\tParams %#x\n\tConverter %#x\n",
                        mconfig->params_fixup, mconfig->converter);
 
-       ret += snprintf(buf + ret, MOD_BUF - ret,
+       ret += scnprintf(buf + ret, MOD_BUF - ret,
                        "Module Gateway:\n\tType %#x\n\tVbus %#x\n\tHW conn %#x\n\tSlot %#x\n",
                        mconfig->dev_type, mconfig->vbus_id,
                        mconfig->hw_conn_type, mconfig->time_slot);
 
-       ret += snprintf(buf + ret, MOD_BUF - ret,
+       ret += scnprintf(buf + ret, MOD_BUF - ret,
                        "Pipeline:\n\tID %d\n\tPriority %d\n\tConn Type %d\n\t"
                        "Pages %#x\n", mconfig->pipe->ppl_id,
                        mconfig->pipe->pipe_priority, mconfig->pipe->conn_type,
                        mconfig->pipe->memory_pages);
 
-       ret += snprintf(buf + ret, MOD_BUF - ret,
+       ret += scnprintf(buf + ret, MOD_BUF - ret,
                        "\tParams:\n\t\tHost DMA %d\n\t\tLink DMA %d\n",
                        mconfig->pipe->p_params->host_dma_id,
                        mconfig->pipe->p_params->link_dma_id);
 
-       ret += snprintf(buf + ret, MOD_BUF - ret,
+       ret += scnprintf(buf + ret, MOD_BUF - ret,
                        "\tPCM params:\n\t\tCh %d\n\t\tFreq %d\n\t\tFormat %d\n",
                        mconfig->pipe->p_params->ch,
                        mconfig->pipe->p_params->s_freq,
                        mconfig->pipe->p_params->s_fmt);
 
-       ret += snprintf(buf + ret, MOD_BUF - ret,
+       ret += scnprintf(buf + ret, MOD_BUF - ret,
                        "\tLink %#x\n\tStream %#x\n",
                        mconfig->pipe->p_params->linktype,
                        mconfig->pipe->p_params->stream);
 
-       ret += snprintf(buf + ret, MOD_BUF - ret,
+       ret += scnprintf(buf + ret, MOD_BUF - ret,
                        "\tState %d\n\tPassthru %s\n",
                        mconfig->pipe->state,
                        mconfig->pipe->passthru ? "true" : "false");
@@ -135,7 +137,7 @@ static ssize_t module_read(struct file *file, char __user *user_buf,
        ret += skl_print_pins(mconfig->m_out_pin, buf,
                        mconfig->max_out_queue, ret, false);
 
-       ret += snprintf(buf + ret, MOD_BUF - ret,
+       ret += scnprintf(buf + ret, MOD_BUF - ret,
                        "Other:\n\tDomain %d\n\tHomogeneous Input %s\n\t"
                        "Homogeneous Output %s\n\tIn Queue Mask %d\n\t"
                        "Out Queue Mask %d\n\tDMA ID %d\n\tMem Pages %d\n\t"
@@ -191,7 +193,7 @@ static ssize_t fw_softreg_read(struct file *file, char __user *user_buf,
                __ioread32_copy(d->fw_read_buff, fw_reg_addr, w0_stat_sz >> 2);
 
        for (offset = 0; offset < FW_REG_SIZE; offset += 16) {
-               ret += snprintf(tmp + ret, FW_REG_BUF - ret, "%#.4x: ", offset);
+               ret += scnprintf(tmp + ret, FW_REG_BUF - ret, "%#.4x: ", offset);
                hex_dump_to_buffer(d->fw_read_buff + offset, 16, 16, 4,
                                   tmp + ret, FW_REG_BUF - ret, 0);
                ret += strlen(tmp + ret);
index 1c0e5226cb5b6b18c72c3f75721a6f38426fb43c..bd43885f38052c99e5c97ba127c64c47efc2974f 100644 (file)
@@ -384,9 +384,11 @@ static int skl_clk_dev_probe(struct platform_device *pdev)
                                &clks[i], clk_pdata, i);
 
                if (IS_ERR(data->clk[data->avail_clk_cnt])) {
-                       ret = PTR_ERR(data->clk[data->avail_clk_cnt++]);
+                       ret = PTR_ERR(data->clk[data->avail_clk_cnt]);
                        goto err_unreg_skl_clk;
                }
+
+               data->avail_clk_cnt++;
        }
 
        platform_set_drvdata(pdev, data);
index 9cfbd343a00c86c1d3e80b72dc0ad799c4423f72..8a0db28a6a40680eea90fdcacac7f4580b0fef0e 100644 (file)
@@ -8,6 +8,7 @@
 #include <linux/module.h>
 #include <sound/pcm_params.h>
 #include <linux/regmap.h>
+#include <linux/reset.h>
 #include <sound/soc.h>
 #include <sound/soc-dai.h>
 
@@ -378,6 +379,11 @@ static int g12a_tohdmitx_probe(struct platform_device *pdev)
        struct device *dev = &pdev->dev;
        void __iomem *regs;
        struct regmap *map;
+       int ret;
+
+       ret = device_reset(dev);
+       if (ret)
+               return ret;
 
        regs = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(regs))
index 14e175cdeeb84b0336218c4fd190faf38947f04f..785a0385cc7f5da3f0e83d6b963cfeacdb98c718 100644 (file)
@@ -451,7 +451,7 @@ int snd_soc_pcm_component_sync_stop(struct snd_pcm_substream *substream)
        int i, ret;
 
        for_each_rtd_components(rtd, i, component) {
-               if (component->driver->ioctl) {
+               if (component->driver->sync_stop) {
                        ret = component->driver->sync_stop(component,
                                                           substream);
                        if (ret < 0)
index 223cd045719e8df10dbd71221391387b3f378fe2..392a1c5b15d3240e9afa17550c2bb35d100c8b36 100644 (file)
@@ -299,7 +299,7 @@ static int soc_compr_free_fe(struct snd_compr_stream *cstream)
        for_each_dpcm_be(fe, stream, dpcm)
                dpcm->state = SND_SOC_DPCM_LINK_STATE_FREE;
 
-       snd_soc_dapm_stream_stop(fe, stream);
+       dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_STOP);
 
        fe->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE;
        fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO;
index 9b130561d562f8bec717b9511ec08618a987aa4e..9fb54e6fe25432e0f3014a8fcb4943999c073a86 100644 (file)
@@ -4772,7 +4772,7 @@ static void soc_dapm_shutdown_dapm(struct snd_soc_dapm_context *dapm)
                        continue;
                if (w->power) {
                        dapm_seq_insert(w, &down_list, false);
-                       w->power = 0;
+                       w->new_power = 0;
                        powerdown = 1;
                }
        }
index ff1b7c7078e5f1d01db793fbe6484476eeb60cf9..2c59b3688ca01b90223d79f6e2d809feca052aa5 100644 (file)
@@ -2006,7 +2006,7 @@ static int dpcm_fe_dai_shutdown(struct snd_pcm_substream *substream)
        soc_pcm_close(substream);
 
        /* run the stream event for each BE */
-       snd_soc_dapm_stream_stop(fe, stream);
+       dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_STOP);
 
        fe->dpcm[stream].state = SND_SOC_DPCM_STATE_CLOSE;
        dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO);
@@ -3171,16 +3171,16 @@ static ssize_t dpcm_show_state(struct snd_soc_pcm_runtime *fe,
        unsigned long flags;
 
        /* FE state */
-       offset += snprintf(buf + offset, size - offset,
+       offset += scnprintf(buf + offset, size - offset,
                        "[%s - %s]\n", fe->dai_link->name,
                        stream ? "Capture" : "Playback");
 
-       offset += snprintf(buf + offset, size - offset, "State: %s\n",
+       offset += scnprintf(buf + offset, size - offset, "State: %s\n",
                        dpcm_state_string(fe->dpcm[stream].state));
 
        if ((fe->dpcm[stream].state >= SND_SOC_DPCM_STATE_HW_PARAMS) &&
            (fe->dpcm[stream].state <= SND_SOC_DPCM_STATE_STOP))
-               offset += snprintf(buf + offset, size - offset,
+               offset += scnprintf(buf + offset, size - offset,
                                "Hardware Params: "
                                "Format = %s, Channels = %d, Rate = %d\n",
                                snd_pcm_format_name(params_format(params)),
@@ -3188,10 +3188,10 @@ static ssize_t dpcm_show_state(struct snd_soc_pcm_runtime *fe,
                                params_rate(params));
 
        /* BEs state */
-       offset += snprintf(buf + offset, size - offset, "Backends:\n");
+       offset += scnprintf(buf + offset, size - offset, "Backends:\n");
 
        if (list_empty(&fe->dpcm[stream].be_clients)) {
-               offset += snprintf(buf + offset, size - offset,
+               offset += scnprintf(buf + offset, size - offset,
                                " No active DSP links\n");
                goto out;
        }
@@ -3201,16 +3201,16 @@ static ssize_t dpcm_show_state(struct snd_soc_pcm_runtime *fe,
                struct snd_soc_pcm_runtime *be = dpcm->be;
                params = &dpcm->hw_params;
 
-               offset += snprintf(buf + offset, size - offset,
+               offset += scnprintf(buf + offset, size - offset,
                                "- %s\n", be->dai_link->name);
 
-               offset += snprintf(buf + offset, size - offset,
+               offset += scnprintf(buf + offset, size - offset,
                                "   State: %s\n",
                                dpcm_state_string(be->dpcm[stream].state));
 
                if ((be->dpcm[stream].state >= SND_SOC_DPCM_STATE_HW_PARAMS) &&
                    (be->dpcm[stream].state <= SND_SOC_DPCM_STATE_STOP))
-                       offset += snprintf(buf + offset, size - offset,
+                       offset += scnprintf(buf + offset, size - offset,
                                "   Hardware Params: "
                                "Format = %s, Channels = %d, Rate = %d\n",
                                snd_pcm_format_name(params_format(params)),
index d2ee6ad20e83478c030975f30fe155274917b48c..575da6aba807553b87f727047dc8c41d86e3b405 100644 (file)
@@ -2377,8 +2377,11 @@ static int soc_tplg_link_elems_load(struct soc_tplg *tplg,
                }
 
                ret = soc_tplg_link_config(tplg, _link);
-               if (ret < 0)
+               if (ret < 0) {
+                       if (!abi_match)
+                               kfree(_link);
                        return ret;
+               }
 
                /* offset by version-specific struct size and
                 * real priv data size
@@ -2542,7 +2545,7 @@ static int soc_tplg_manifest_load(struct soc_tplg *tplg,
 {
        struct snd_soc_tplg_manifest *manifest, *_manifest;
        bool abi_match;
-       int err;
+       int ret = 0;
 
        if (tplg->pass != SOC_TPLG_PASS_MANIFEST)
                return 0;
@@ -2555,19 +2558,19 @@ static int soc_tplg_manifest_load(struct soc_tplg *tplg,
                _manifest = manifest;
        } else {
                abi_match = false;
-               err = manifest_new_ver(tplg, manifest, &_manifest);
-               if (err < 0)
-                       return err;
+               ret = manifest_new_ver(tplg, manifest, &_manifest);
+               if (ret < 0)
+                       return ret;
        }
 
        /* pass control to component driver for optional further init */
        if (tplg->comp && tplg->ops && tplg->ops->manifest)
-               return tplg->ops->manifest(tplg->comp, tplg->index, _manifest);
+               ret = tplg->ops->manifest(tplg->comp, tplg->index, _manifest);
 
        if (!abi_match) /* free the duplicated one */
                kfree(_manifest);
 
-       return 0;
+       return ret;
 }
 
 /* validate header magic, size and type */
index b63fc529b4568e476cf6d22b4176189c74d97313..78aa1da7c7a9564dd5a5e606edd1759fd2fce6bb 100644 (file)
@@ -499,7 +499,7 @@ int snd_sof_ipc_stream_posn(struct snd_soc_component *scomp,
 
        /* send IPC to the DSP */
        err = sof_ipc_tx_message(sdev->ipc,
-                                stream.hdr.cmd, &stream, sizeof(stream), &posn,
+                                stream.hdr.cmd, &stream, sizeof(stream), posn,
                                 sizeof(*posn));
        if (err < 0) {
                dev_err(sdev->dev, "error: failed to get stream %d position\n",
index 30bcd5d3a32a8ffe4bcda256200c0ecbc7f4832b..10eb4b8e8e7eea2ae3c8567594bc95b42388a3d8 100644 (file)
@@ -1543,20 +1543,20 @@ static int stm32_sai_sub_probe(struct platform_device *pdev)
                return ret;
        }
 
-       ret = devm_snd_soc_register_component(&pdev->dev, &stm32_component,
-                                             &sai->cpu_dai_drv, 1);
+       ret = snd_dmaengine_pcm_register(&pdev->dev, conf, 0);
+       if (ret) {
+               dev_err(&pdev->dev, "Could not register pcm dma\n");
+               return ret;
+       }
+
+       ret = snd_soc_register_component(&pdev->dev, &stm32_component,
+                                        &sai->cpu_dai_drv, 1);
        if (ret)
                return ret;
 
        if (STM_SAI_PROTOCOL_IS_SPDIF(sai))
                conf = &stm32_sai_pcm_config_spdif;
 
-       ret = devm_snd_dmaengine_pcm_register(&pdev->dev, conf, 0);
-       if (ret) {
-               dev_err(&pdev->dev, "Could not register pcm dma\n");
-               return ret;
-       }
-
        return 0;
 }
 
@@ -1565,6 +1565,8 @@ static int stm32_sai_sub_remove(struct platform_device *pdev)
        struct stm32_sai_sub_data *sai = dev_get_drvdata(&pdev->dev);
 
        clk_unprepare(sai->pdata->pclk);
+       snd_dmaengine_pcm_unregister(&pdev->dev);
+       snd_soc_unregister_component(&pdev->dev);
 
        return 0;
 }
index ebe1685e92dda2bfd6795b45a92924de8a8f9451..d5e517d1c3ddc5c9ac6e594500d87524168b143d 100644 (file)
 #define MSR_K7_HWCR                    0xc0010015
 #define MSR_K7_HWCR_SMMLOCK_BIT                0
 #define MSR_K7_HWCR_SMMLOCK            BIT_ULL(MSR_K7_HWCR_SMMLOCK_BIT)
+#define MSR_K7_HWCR_IRPERF_EN_BIT      30
+#define MSR_K7_HWCR_IRPERF_EN          BIT_ULL(MSR_K7_HWCR_IRPERF_EN_BIT)
 #define MSR_K7_FID_VID_CTL             0xc0010041
 #define MSR_K7_FID_VID_STATUS          0xc0010042
 
index 503d3f42da1676791d2c4f4a70bfad35743daf4c..3f3f780c8c6500e1a1ea52bc0585af93699572fe 100644 (file)
@@ -390,6 +390,7 @@ struct kvm_sync_regs {
 #define KVM_STATE_NESTED_GUEST_MODE    0x00000001
 #define KVM_STATE_NESTED_RUN_PENDING   0x00000002
 #define KVM_STATE_NESTED_EVMCS         0x00000004
+#define KVM_STATE_NESTED_MTF_PENDING   0x00000008
 
 #define KVM_STATE_NESTED_SMM_GUEST_MODE        0x00000001
 #define KVM_STATE_NESTED_SMM_VMXON     0x00000002
index c4dd23c4b47811e7c896fe90532bdc11ac2580b9..8ead55593984fd7022938442459addf565dd1d91 100644 (file)
@@ -239,7 +239,6 @@ buildid.*::
                set buildid.dir to /dev/null. The default is $HOME/.debug
 
 annotate.*::
-       These options work only for TUI.
        These are in control of addresses, jump function, source code
        in lines of assembly code from a specific program.
 
@@ -269,6 +268,8 @@ annotate.*::
                â”‚        mov    (%rdi),%rdx
                â”‚              return n;
 
+               This option works with tui, stdio2 browsers.
+
         annotate.use_offset::
                Basing on a first address of a loaded function, offset can be used.
                Instead of using original addresses of assembly code,
@@ -287,6 +288,8 @@ annotate.*::
 
                             368:│  mov    0x8(%r14),%rdi
 
+               This option works with tui, stdio2 browsers.
+
        annotate.jump_arrows::
                There can be jump instruction among assembly code.
                Depending on a boolean value of jump_arrows,
@@ -306,6 +309,8 @@ annotate.*::
                â”‚1330:   mov    %r15,%r10
                â”‚1333:   cmp    %r15,%r14
 
+               This option works with tui browser.
+
         annotate.show_linenr::
                When showing source code if this option is 'true',
                line numbers are printed as below.
@@ -325,6 +330,8 @@ annotate.*::
                â”‚                     array++;
                â”‚             }
 
+               This option works with tui, stdio2 browsers.
+
         annotate.show_nr_jumps::
                Let's see a part of assembly code.
 
@@ -335,6 +342,8 @@ annotate.*::
 
                â”‚1 1382:   movb   $0x1,-0x270(%rbp)
 
+               This option works with tui, stdio2 browsers.
+
         annotate.show_total_period::
                To compare two records on an instruction base, with this option
                provided, display total number of samples that belong to a line
@@ -348,11 +357,30 @@ annotate.*::
 
                99.93 â”‚      mov    %eax,%eax
 
+               This option works with tui, stdio2, stdio browsers.
+
+       annotate.show_nr_samples::
+               By default perf annotate shows percentage of samples. This option
+               can be used to print absolute number of samples. Ex, when set as
+               false:
+
+               Percent│
+                74.03 â”‚      mov    %fs:0x28,%rax
+
+               When set as true:
+
+               Samples│
+                    6 â”‚      mov    %fs:0x28,%rax
+
+               This option works with tui, stdio2, stdio browsers.
+
        annotate.offset_level::
                Default is '1', meaning just jump targets will have offsets show right beside
                the instruction. When set to '2' 'call' instructions will also have its offsets
                shown, 3 or higher will show offsets for all instructions.
 
+               This option works with tui, stdio2 browsers.
+
 hist.*::
        hist.percentage::
                This option control the way to calculate overhead of filtered entries -
@@ -490,6 +518,12 @@ top.*::
                column by default.
                The default is 'true'.
 
+       top.call-graph::
+               This is identical to 'call-graph.record-mode', except it is
+               applicable only for 'top' subcommand. This option ONLY setup
+               the unwind method. To enable 'perf top' to actually use it,
+               the command line option -g must be specified.
+
 man.*::
        man.viewer::
                This option can assign a tool to view manual pages when 'help'
@@ -517,6 +551,16 @@ record.*::
                But if this option is 'no-cache', it will not update the build-id cache.
                'skip' skips post-processing and does not update the cache.
 
+       record.call-graph::
+               This is identical to 'call-graph.record-mode', except it is
+               applicable only for 'record' subcommand. This option ONLY setup
+               the unwind method. To enable 'perf record' to actually use it,
+               the command line option -g must be specified.
+
+       record.aio::
+               Use 'n' control blocks in asynchronous (Posix AIO) trace writing
+               mode ('n' default: 1, max: 4).
+
 diff.*::
        diff.order::
                This option sets the number of columns to sort the result.
@@ -566,6 +610,11 @@ trace.*::
                "libbeauty", the default, to use the same argument beautifiers used in the
                strace-like sys_enter+sys_exit lines.
 
+ftrace.*::
+       ftrace.tracer::
+               Can be used to select the default tracer. Possible values are
+               'function' and 'function_graph'.
+
 llvm.*::
        llvm.clang-path::
                Path to clang. If omit, search it from $PATH.
@@ -610,6 +659,29 @@ scripts.*::
        The script gets the same options passed as a full perf script,
        in particular -i perfdata file, --cpu, --tid
 
+convert.*::
+
+       convert.queue-size::
+               Limit the size of ordered_events queue, so we could control
+               allocation size of perf data files without proper finished
+               round events.
+
+intel-pt.*::
+
+       intel-pt.cache-divisor::
+
+       intel-pt.mispred-all::
+               If set, Intel PT decoder will set the mispred flag on all
+               branches.
+
+auxtrace.*::
+
+       auxtrace.dumpdir::
+               s390 only. The directory to save the auxiliary trace buffer
+               can be changed using this option. Ex, auxtrace.dumpdir=/tmp.
+               If the directory does not exist or has the wrong file type,
+               the current directory is used.
+
 SEE ALSO
 --------
 linkperf:perf[1]
index 2898cfdf8fe18f3640351329a920a2f04df35aca..941f814820b8c653930e03d690ac6647227ef552 100644 (file)
@@ -858,21 +858,6 @@ static void cs_etm_recording_free(struct auxtrace_record *itr)
        free(ptr);
 }
 
-static int cs_etm_read_finish(struct auxtrace_record *itr, int idx)
-{
-       struct cs_etm_recording *ptr =
-                       container_of(itr, struct cs_etm_recording, itr);
-       struct evsel *evsel;
-
-       evlist__for_each_entry(ptr->evlist, evsel) {
-               if (evsel->core.attr.type == ptr->cs_etm_pmu->type)
-                       return perf_evlist__enable_event_idx(ptr->evlist,
-                                                            evsel, idx);
-       }
-
-       return -EINVAL;
-}
-
 struct auxtrace_record *cs_etm_record_init(int *err)
 {
        struct perf_pmu *cs_etm_pmu;
@@ -892,6 +877,7 @@ struct auxtrace_record *cs_etm_record_init(int *err)
        }
 
        ptr->cs_etm_pmu                 = cs_etm_pmu;
+       ptr->itr.pmu                    = cs_etm_pmu;
        ptr->itr.parse_snapshot_options = cs_etm_parse_snapshot_options;
        ptr->itr.recording_options      = cs_etm_recording_options;
        ptr->itr.info_priv_size         = cs_etm_info_priv_size;
@@ -901,7 +887,7 @@ struct auxtrace_record *cs_etm_record_init(int *err)
        ptr->itr.snapshot_finish        = cs_etm_snapshot_finish;
        ptr->itr.reference              = cs_etm_reference;
        ptr->itr.free                   = cs_etm_recording_free;
-       ptr->itr.read_finish            = cs_etm_read_finish;
+       ptr->itr.read_finish            = auxtrace_record__read_finish;
 
        *err = 0;
        return &ptr->itr;
index eba6541ec0f12ca8250c3c7d6e33aab1ecf89c1b..8d6821d9c3f6cea8b26c8f5019d5d4f3793ef9b9 100644 (file)
@@ -158,20 +158,6 @@ static void arm_spe_recording_free(struct auxtrace_record *itr)
        free(sper);
 }
 
-static int arm_spe_read_finish(struct auxtrace_record *itr, int idx)
-{
-       struct arm_spe_recording *sper =
-                       container_of(itr, struct arm_spe_recording, itr);
-       struct evsel *evsel;
-
-       evlist__for_each_entry(sper->evlist, evsel) {
-               if (evsel->core.attr.type == sper->arm_spe_pmu->type)
-                       return perf_evlist__enable_event_idx(sper->evlist,
-                                                            evsel, idx);
-       }
-       return -EINVAL;
-}
-
 struct auxtrace_record *arm_spe_recording_init(int *err,
                                               struct perf_pmu *arm_spe_pmu)
 {
@@ -189,12 +175,13 @@ struct auxtrace_record *arm_spe_recording_init(int *err,
        }
 
        sper->arm_spe_pmu = arm_spe_pmu;
+       sper->itr.pmu = arm_spe_pmu;
        sper->itr.recording_options = arm_spe_recording_options;
        sper->itr.info_priv_size = arm_spe_info_priv_size;
        sper->itr.info_fill = arm_spe_info_fill;
        sper->itr.free = arm_spe_recording_free;
        sper->itr.reference = arm_spe_reference;
-       sper->itr.read_finish = arm_spe_read_finish;
+       sper->itr.read_finish = auxtrace_record__read_finish;
        sper->itr.alignment = 0;
 
        *err = 0;
index 43f736ed47f28a1dff42ffb7ae7b3e19613e0211..35b61bfc1b1ae928158dee422a150c19c8d30e4e 100644 (file)
 433    common  fspick                          sys_fspick
 434    common  pidfd_open                      sys_pidfd_open
 435    nospu   clone3                          ppc_clone3
+437    common  openat2                         sys_openat2
+438    common  pidfd_getfd                     sys_pidfd_getfd
index 27d9e214d068074d37ff0e5287bfba047819ea56..26cee10521794be3a91741860c1a93f178c07ab6 100644 (file)
@@ -413,20 +413,6 @@ static int intel_bts_find_snapshot(struct auxtrace_record *itr, int idx,
        return err;
 }
 
-static int intel_bts_read_finish(struct auxtrace_record *itr, int idx)
-{
-       struct intel_bts_recording *btsr =
-                       container_of(itr, struct intel_bts_recording, itr);
-       struct evsel *evsel;
-
-       evlist__for_each_entry(btsr->evlist, evsel) {
-               if (evsel->core.attr.type == btsr->intel_bts_pmu->type)
-                       return perf_evlist__enable_event_idx(btsr->evlist,
-                                                            evsel, idx);
-       }
-       return -EINVAL;
-}
-
 struct auxtrace_record *intel_bts_recording_init(int *err)
 {
        struct perf_pmu *intel_bts_pmu = perf_pmu__find(INTEL_BTS_PMU_NAME);
@@ -447,6 +433,7 @@ struct auxtrace_record *intel_bts_recording_init(int *err)
        }
 
        btsr->intel_bts_pmu = intel_bts_pmu;
+       btsr->itr.pmu = intel_bts_pmu;
        btsr->itr.recording_options = intel_bts_recording_options;
        btsr->itr.info_priv_size = intel_bts_info_priv_size;
        btsr->itr.info_fill = intel_bts_info_fill;
@@ -456,7 +443,7 @@ struct auxtrace_record *intel_bts_recording_init(int *err)
        btsr->itr.find_snapshot = intel_bts_find_snapshot;
        btsr->itr.parse_snapshot_options = intel_bts_parse_snapshot_options;
        btsr->itr.reference = intel_bts_reference;
-       btsr->itr.read_finish = intel_bts_read_finish;
+       btsr->itr.read_finish = auxtrace_record__read_finish;
        btsr->itr.alignment = sizeof(struct branch);
        return &btsr->itr;
 }
index 20df442fdf36d930e603122bb19acbf578a93765..7eea4fd7ce58555256618410eccc462ee980dc93 100644 (file)
@@ -1166,20 +1166,6 @@ static u64 intel_pt_reference(struct auxtrace_record *itr __maybe_unused)
        return rdtsc();
 }
 
-static int intel_pt_read_finish(struct auxtrace_record *itr, int idx)
-{
-       struct intel_pt_recording *ptr =
-                       container_of(itr, struct intel_pt_recording, itr);
-       struct evsel *evsel;
-
-       evlist__for_each_entry(ptr->evlist, evsel) {
-               if (evsel->core.attr.type == ptr->intel_pt_pmu->type)
-                       return perf_evlist__enable_event_idx(ptr->evlist, evsel,
-                                                            idx);
-       }
-       return -EINVAL;
-}
-
 struct auxtrace_record *intel_pt_recording_init(int *err)
 {
        struct perf_pmu *intel_pt_pmu = perf_pmu__find(INTEL_PT_PMU_NAME);
@@ -1200,6 +1186,7 @@ struct auxtrace_record *intel_pt_recording_init(int *err)
        }
 
        ptr->intel_pt_pmu = intel_pt_pmu;
+       ptr->itr.pmu = intel_pt_pmu;
        ptr->itr.recording_options = intel_pt_recording_options;
        ptr->itr.info_priv_size = intel_pt_info_priv_size;
        ptr->itr.info_fill = intel_pt_info_fill;
@@ -1209,7 +1196,7 @@ struct auxtrace_record *intel_pt_recording_init(int *err)
        ptr->itr.find_snapshot = intel_pt_find_snapshot;
        ptr->itr.parse_snapshot_options = intel_pt_parse_snapshot_options;
        ptr->itr.reference = intel_pt_reference;
-       ptr->itr.read_finish = intel_pt_read_finish;
+       ptr->itr.read_finish = auxtrace_record__read_finish;
        /*
         * Decoding starts at a PSB packet. Minimum PSB period is 2K so 4K
         * should give at least 1 PSB per sample.
index ff61795a4d13783011cd25682e4894b61da21643..6c0a0412502ebb5e731156f47fcf87ccb2b9b55b 100644 (file)
@@ -566,6 +566,8 @@ int cmd_annotate(int argc, const char **argv)
        if (ret < 0)
                return ret;
 
+       annotation_config__init(&annotate.opts);
+
        argc = parse_options(argc, argv, options, annotate_usage, 0);
        if (argc) {
                /*
@@ -605,8 +607,6 @@ int cmd_annotate(int argc, const char **argv)
        if (ret < 0)
                goto out_delete;
 
-       annotation_config__init();
-
        symbol_conf.try_vmlinux_path = true;
 
        ret = symbol__init(&annotate.session->header.env);
index 26bc5923e6b56c0a3959212de58de8b36a8832e8..70548df2abb92f797721684e9a687a5b0fdacbf3 100644 (file)
@@ -449,7 +449,8 @@ static int perf_del_probe_events(struct strfilter *filter)
                ret = probe_file__del_strlist(kfd, klist);
                if (ret < 0)
                        goto error;
-       }
+       } else if (ret == -ENOMEM)
+               goto error;
 
        ret2 = probe_file__get_events(ufd, filter, ulist);
        if (ret2 == 0) {
@@ -459,7 +460,8 @@ static int perf_del_probe_events(struct strfilter *filter)
                ret2 = probe_file__del_strlist(ufd, ulist);
                if (ret2 < 0)
                        goto error;
-       }
+       } else if (ret2 == -ENOMEM)
+               goto error;
 
        if (ret == -ENOENT && ret2 == -ENOENT)
                pr_warning("\"%s\" does not hit any event.\n", str);
index 9483b3f0cae3f50004d0a6ea9e4ede717d185627..72a12b69f120b959b0d20e6441eb7197e8852f32 100644 (file)
@@ -1507,7 +1507,7 @@ int cmd_report(int argc, const char **argv)
                        symbol_conf.priv_size += sizeof(u32);
                        symbol_conf.sort_by_name = true;
                }
-               annotation_config__init();
+               annotation_config__init(&report.annotation_opts);
        }
 
        if (symbol__init(&session->header.env) < 0)
index 8affcab756043dc4c31c43ccc43443446afaf37a..f6dd1a63f159e970041d8614b0d0223cdf4a8048 100644 (file)
@@ -143,7 +143,7 @@ static int perf_top__parse_source(struct perf_top *top, struct hist_entry *he)
                return err;
        }
 
-       err = symbol__annotate(&he->ms, evsel, 0, &top->annotation_opts, NULL);
+       err = symbol__annotate(&he->ms, evsel, &top->annotation_opts, NULL);
        if (err == 0) {
                top->sym_filter_entry = he;
        } else {
@@ -1683,7 +1683,7 @@ int cmd_top(int argc, const char **argv)
        if (status < 0)
                goto out_delete_evlist;
 
-       annotation_config__init();
+       annotation_config__init(&top.annotation_opts);
 
        symbol_conf.try_vmlinux_path = (symbol_conf.vmlinux_name == NULL);
        status = symbol__init(NULL);
index 607189a315b2cbd32f36878d0fcdfb97b1001685..6e61c4bdf54826ce6538c98984f2751d6ddff755 100644 (file)
@@ -3,7 +3,7 @@
 #ifndef _PERF_BPF_PID_FILTER_
 #define _PERF_BPF_PID_FILTER_
 
-#include <bpf/bpf.h>
+#include <bpf.h>
 
 #define pid_filter(name) pid_map(name, bool)
 
index 7ca6fa5463eea9faebb2dda6e561e98654da9692..316af5b2ff3516b3aba5365423c69e24f3f5dee5 100644 (file)
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
 
-#include <bpf/bpf.h>
+#include <bpf.h>
 
 struct bpf_map SEC("maps") __bpf_stdout__ = {
        .type = BPF_MAP_TYPE_PERF_EVENT_ARRAY,
index d1a35b6c649dc7b860ccb661f3e71ba0b595ce69..ca7877f9a976fbcaf55beb5196eedcc8eed9351b 100644 (file)
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: LGPL-2.1
 
-#include <bpf/bpf.h>
+#include <bpf.h>
 
 static int (*bpf_get_current_pid_tgid)(void) = (void *)BPF_FUNC_get_current_pid_tgid;
 
index 7cb99b433888b80d1b56b6331748b3db8414c0ca..c2cc42daf924235762a7528b89c858c7ebb9d062 100644 (file)
@@ -14,7 +14,7 @@ add_probe_vfs_getname() {
        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 -q       "vfs_getname=getname_flags:${line} pathname=result->name:string" || \
-               perf probe $verbose "vfs_getname=getname_flags:${line} pathname=filename:string"
+               perf probe $verbose "vfs_getname=getname_flags:${line} pathname=filename:ustring"
        fi
 }
 
index badbddbb30f813b997bc43d8ce5744a55674dce9..9023267e564335ce9005288e35e60a9a86703b71 100644 (file)
@@ -754,10 +754,9 @@ static int annotate_browser__run(struct annotate_browser *browser,
                "?             Search string backwards\n");
                        continue;
                case 'r':
-                       {
-                               script_browse(NULL, NULL);
-                               continue;
-                       }
+                       script_browse(NULL, NULL);
+                       annotate_browser__show(&browser->b, title, help);
+                       continue;
                case 'k':
                        notes->options->show_linenr = !notes->options->show_linenr;
                        break;
@@ -834,13 +833,13 @@ static int annotate_browser__run(struct annotate_browser *browser,
                        map_symbol__annotation_dump(ms, evsel, browser->opts);
                        continue;
                case 't':
-                       if (notes->options->show_total_period) {
-                               notes->options->show_total_period = false;
-                               notes->options->show_nr_samples = true;
-                       } else if (notes->options->show_nr_samples)
-                               notes->options->show_nr_samples = false;
+                       if (symbol_conf.show_total_period) {
+                               symbol_conf.show_total_period = false;
+                               symbol_conf.show_nr_samples = true;
+                       } else if (symbol_conf.show_nr_samples)
+                               symbol_conf.show_nr_samples = false;
                        else
-                               notes->options->show_total_period = true;
+                               symbol_conf.show_total_period = true;
                        annotation__update_column_widths(notes);
                        continue;
                case 'c':
index 22cc240f73713852342d75ea96249eeea2a339db..35f9641bf670cb5bc9103efffa8f060e9d8d4627 100644 (file)
@@ -174,7 +174,7 @@ static int symbol__gtk_annotate(struct map_symbol *ms, struct evsel *evsel,
        if (ms->map->dso->annotate_warned)
                return -1;
 
-       err = symbol__annotate(ms, evsel, 0, &annotation__default_options, NULL);
+       err = symbol__annotate(ms, evsel, &annotation__default_options, NULL);
        if (err) {
                char msg[BUFSIZ];
                symbol__strerror_disassemble(ms, err, msg, sizeof(msg));
index ca73fb74ad03273464abe6bb86455140495542ca..0ea95be84b3bd32d488491dd5f2272623d928085 100644 (file)
@@ -1143,93 +1143,70 @@ static int disasm_line__parse(char *line, const char **namep, char **rawp)
 }
 
 struct annotate_args {
-       size_t                   privsize;
-       struct arch             *arch;
-       struct map_symbol        ms;
-       struct evsel    *evsel;
+       struct arch               *arch;
+       struct map_symbol         ms;
+       struct evsel              *evsel;
        struct annotation_options *options;
-       s64                      offset;
-       char                    *line;
-       int                      line_nr;
+       s64                       offset;
+       char                      *line;
+       int                       line_nr;
 };
 
-static void annotation_line__delete(struct annotation_line *al)
+static void annotation_line__init(struct annotation_line *al,
+                                 struct annotate_args *args,
+                                 int nr)
 {
-       void *ptr = (void *) al - al->privsize;
+       al->offset = args->offset;
+       al->line = strdup(args->line);
+       al->line_nr = args->line_nr;
+       al->data_nr = nr;
+}
 
+static void annotation_line__exit(struct annotation_line *al)
+{
        free_srcline(al->path);
        zfree(&al->line);
-       free(ptr);
 }
 
-/*
- * Allocating the annotation line data with following
- * structure:
- *
- *    --------------------------------------
- *    private space | struct annotation_line
- *    --------------------------------------
- *
- * Size of the private space is stored in 'struct annotation_line'.
- *
- */
-static struct annotation_line *
-annotation_line__new(struct annotate_args *args, size_t privsize)
+static size_t disasm_line_size(int nr)
 {
        struct annotation_line *al;
-       struct evsel *evsel = args->evsel;
-       size_t size = privsize + sizeof(*al);
-       int nr = 1;
-
-       if (perf_evsel__is_group_event(evsel))
-               nr = evsel->core.nr_members;
 
-       size += sizeof(al->data[0]) * nr;
-
-       al = zalloc(size);
-       if (al) {
-               al = (void *) al + privsize;
-               al->privsize   = privsize;
-               al->offset     = args->offset;
-               al->line       = strdup(args->line);
-               al->line_nr    = args->line_nr;
-               al->data_nr    = nr;
-       }
-
-       return al;
+       return (sizeof(struct disasm_line) + (sizeof(al->data[0]) * nr));
 }
 
 /*
  * Allocating the disasm annotation line data with
  * following structure:
  *
- *    ------------------------------------------------------------
- *    privsize space | struct disasm_line | struct annotation_line
- *    ------------------------------------------------------------
+ *    -------------------------------------------
+ *    struct disasm_line | struct annotation_line
+ *    -------------------------------------------
  *
  * We have 'struct annotation_line' member as last member
  * of 'struct disasm_line' to have an easy access.
- *
  */
 static struct disasm_line *disasm_line__new(struct annotate_args *args)
 {
        struct disasm_line *dl = NULL;
-       struct annotation_line *al;
-       size_t privsize = args->privsize + offsetof(struct disasm_line, al);
+       int nr = 1;
 
-       al = annotation_line__new(args, privsize);
-       if (al != NULL) {
-               dl = disasm_line(al);
+       if (perf_evsel__is_group_event(args->evsel))
+               nr = args->evsel->core.nr_members;
 
-               if (dl->al.line == NULL)
-                       goto out_delete;
+       dl = zalloc(disasm_line_size(nr));
+       if (!dl)
+               return NULL;
 
-               if (args->offset != -1) {
-                       if (disasm_line__parse(dl->al.line, &dl->ins.name, &dl->ops.raw) < 0)
-                               goto out_free_line;
+       annotation_line__init(&dl->al, args, nr);
+       if (dl->al.line == NULL)
+               goto out_delete;
 
-                       disasm_line__init_ins(dl, args->arch, &args->ms);
-               }
+       if (args->offset != -1) {
+               if (disasm_line__parse(dl->al.line, &dl->ins.name, &dl->ops.raw) < 0)
+                       goto out_free_line;
+
+               disasm_line__init_ins(dl, args->arch, &args->ms);
        }
 
        return dl;
@@ -1248,7 +1225,8 @@ void disasm_line__free(struct disasm_line *dl)
        else
                ins__delete(&dl->ops);
        zfree(&dl->ins.name);
-       annotation_line__delete(&dl->al);
+       annotation_line__exit(&dl->al);
+       free(dl);
 }
 
 int disasm_line__scnprintf(struct disasm_line *dl, char *bf, size_t size, bool raw, int max_ins_name)
@@ -2149,13 +2127,12 @@ void symbol__calc_percent(struct symbol *sym, struct evsel *evsel)
        annotation__calc_percent(notes, evsel, symbol__size(sym));
 }
 
-int symbol__annotate(struct map_symbol *ms, struct evsel *evsel, size_t privsize,
+int symbol__annotate(struct map_symbol *ms, struct evsel *evsel,
                     struct annotation_options *options, struct arch **parch)
 {
        struct symbol *sym = ms->sym;
        struct annotation *notes = symbol__annotation(sym);
        struct annotate_args args = {
-               .privsize       = privsize,
                .evsel          = evsel,
                .options        = options,
        };
@@ -2644,6 +2621,8 @@ void annotation__set_offsets(struct annotation *notes, s64 size)
        struct annotation_line *al;
 
        notes->max_line_len = 0;
+       notes->nr_entries = 0;
+       notes->nr_asm_entries = 0;
 
        list_for_each_entry(al, &notes->src->source, node) {
                size_t line_len = strlen(al->line);
@@ -2790,7 +2769,7 @@ int symbol__tty_annotate(struct map_symbol *ms, struct evsel *evsel,
        struct symbol *sym = ms->sym;
        struct rb_root source_line = RB_ROOT;
 
-       if (symbol__annotate(ms, evsel, 0, opts, NULL) < 0)
+       if (symbol__annotate(ms, evsel, opts, NULL) < 0)
                return -1;
 
        symbol__calc_percent(sym, evsel);
@@ -2915,9 +2894,9 @@ static void __annotation_line__write(struct annotation_line *al, struct annotati
                        percent = annotation_data__percent(&al->data[i], percent_type);
 
                        obj__set_percent_color(obj, percent, current_entry);
-                       if (notes->options->show_total_period) {
+                       if (symbol_conf.show_total_period) {
                                obj__printf(obj, "%11" PRIu64 " ", al->data[i].he.period);
-                       } else if (notes->options->show_nr_samples) {
+                       } else if (symbol_conf.show_nr_samples) {
                                obj__printf(obj, "%6" PRIu64 " ",
                                                   al->data[i].he.nr_samples);
                        } else {
@@ -2931,8 +2910,8 @@ static void __annotation_line__write(struct annotation_line *al, struct annotati
                        obj__printf(obj, "%-*s", pcnt_width, " ");
                else {
                        obj__printf(obj, "%-*s", pcnt_width,
-                                          notes->options->show_total_period ? "Period" :
-                                          notes->options->show_nr_samples ? "Samples" : "Percent");
+                                          symbol_conf.show_total_period ? "Period" :
+                                          symbol_conf.show_nr_samples ? "Samples" : "Percent");
                }
        }
 
@@ -3070,7 +3049,7 @@ int symbol__annotate2(struct map_symbol *ms, struct evsel *evsel,
        if (perf_evsel__is_group_event(evsel))
                nr_pcnt = evsel->core.nr_members;
 
-       err = symbol__annotate(ms, evsel, 0, options, parch);
+       err = symbol__annotate(ms, evsel, options, parch);
        if (err)
                goto out_free_offsets;
 
@@ -3094,69 +3073,46 @@ int symbol__annotate2(struct map_symbol *ms, struct evsel *evsel,
        return err;
 }
 
-#define ANNOTATION__CFG(n) \
-       { .name = #n, .value = &annotation__default_options.n, }
-
-/*
- * Keep the entries sorted, they are bsearch'ed
- */
-static struct annotation_config {
-       const char *name;
-       void *value;
-} annotation__configs[] = {
-       ANNOTATION__CFG(hide_src_code),
-       ANNOTATION__CFG(jump_arrows),
-       ANNOTATION__CFG(offset_level),
-       ANNOTATION__CFG(show_linenr),
-       ANNOTATION__CFG(show_nr_jumps),
-       ANNOTATION__CFG(show_nr_samples),
-       ANNOTATION__CFG(show_total_period),
-       ANNOTATION__CFG(use_offset),
-};
-
-#undef ANNOTATION__CFG
-
-static int annotation_config__cmp(const void *name, const void *cfgp)
-{
-       const struct annotation_config *cfg = cfgp;
-
-       return strcmp(name, cfg->name);
-}
-
-static int annotation__config(const char *var, const char *value,
-                           void *data __maybe_unused)
+static int annotation__config(const char *var, const char *value, void *data)
 {
-       struct annotation_config *cfg;
-       const char *name;
+       struct annotation_options *opt = data;
 
        if (!strstarts(var, "annotate."))
                return 0;
 
-       name = var + 9;
-       cfg = bsearch(name, annotation__configs, ARRAY_SIZE(annotation__configs),
-                     sizeof(struct annotation_config), annotation_config__cmp);
-
-       if (cfg == NULL)
-               pr_debug("%s variable unknown, ignoring...", var);
-       else if (strcmp(var, "annotate.offset_level") == 0) {
-               perf_config_int(cfg->value, name, value);
-
-               if (*(int *)cfg->value > ANNOTATION__MAX_OFFSET_LEVEL)
-                       *(int *)cfg->value = ANNOTATION__MAX_OFFSET_LEVEL;
-               else if (*(int *)cfg->value < ANNOTATION__MIN_OFFSET_LEVEL)
-                       *(int *)cfg->value = ANNOTATION__MIN_OFFSET_LEVEL;
+       if (!strcmp(var, "annotate.offset_level")) {
+               perf_config_u8(&opt->offset_level, "offset_level", value);
+
+               if (opt->offset_level > ANNOTATION__MAX_OFFSET_LEVEL)
+                       opt->offset_level = ANNOTATION__MAX_OFFSET_LEVEL;
+               else if (opt->offset_level < ANNOTATION__MIN_OFFSET_LEVEL)
+                       opt->offset_level = ANNOTATION__MIN_OFFSET_LEVEL;
+       } else if (!strcmp(var, "annotate.hide_src_code")) {
+               opt->hide_src_code = perf_config_bool("hide_src_code", value);
+       } else if (!strcmp(var, "annotate.jump_arrows")) {
+               opt->jump_arrows = perf_config_bool("jump_arrows", value);
+       } else if (!strcmp(var, "annotate.show_linenr")) {
+               opt->show_linenr = perf_config_bool("show_linenr", value);
+       } else if (!strcmp(var, "annotate.show_nr_jumps")) {
+               opt->show_nr_jumps = perf_config_bool("show_nr_jumps", value);
+       } else if (!strcmp(var, "annotate.show_nr_samples")) {
+               symbol_conf.show_nr_samples = perf_config_bool("show_nr_samples",
+                                                               value);
+       } else if (!strcmp(var, "annotate.show_total_period")) {
+               symbol_conf.show_total_period = perf_config_bool("show_total_period",
+                                                               value);
+       } else if (!strcmp(var, "annotate.use_offset")) {
+               opt->use_offset = perf_config_bool("use_offset", value);
        } else {
-               *(bool *)cfg->value = perf_config_bool(name, value);
+               pr_debug("%s variable unknown, ignoring...", var);
        }
+
        return 0;
 }
 
-void annotation_config__init(void)
+void annotation_config__init(struct annotation_options *opt)
 {
-       perf_config(annotation__config, NULL);
-
-       annotation__default_options.show_total_period = symbol_conf.show_total_period;
-       annotation__default_options.show_nr_samples   = symbol_conf.show_nr_samples;
+       perf_config(annotation__config, opt);
 }
 
 static unsigned int parse_percent_type(char *str1, char *str2)
index 455403e8feded864661094b4c5fbb26fe8626492..001258601a371babdb13a1c47d1702a8e9e3e992 100644 (file)
@@ -83,8 +83,6 @@ struct annotation_options {
             full_path,
             show_linenr,
             show_nr_jumps,
-            show_nr_samples,
-            show_total_period,
             show_minmax_cycle,
             show_asm_raw,
             annotate_src;
@@ -141,7 +139,6 @@ struct annotation_line {
        u64                      cycles;
        u64                      cycles_max;
        u64                      cycles_min;
-       size_t                   privsize;
        char                    *path;
        u32                      idx;
        int                      idx_asm;
@@ -309,7 +306,7 @@ static inline int annotation__cycles_width(struct annotation *notes)
 
 static inline int annotation__pcnt_width(struct annotation *notes)
 {
-       return (notes->options->show_total_period ? 12 : 7) * notes->nr_events;
+       return (symbol_conf.show_total_period ? 12 : 7) * notes->nr_events;
 }
 
 static inline bool annotation_line__filter(struct annotation_line *al, struct annotation *notes)
@@ -352,7 +349,7 @@ struct annotated_source *symbol__hists(struct symbol *sym, int nr_hists);
 void symbol__annotate_zero_histograms(struct symbol *sym);
 
 int symbol__annotate(struct map_symbol *ms,
-                    struct evsel *evsel, size_t privsize,
+                    struct evsel *evsel,
                     struct annotation_options *options,
                     struct arch **parch);
 int symbol__annotate2(struct map_symbol *ms,
@@ -413,7 +410,7 @@ static inline int symbol__tui_annotate(struct map_symbol *ms __maybe_unused,
 }
 #endif
 
-void annotation_config__init(void);
+void annotation_config__init(struct annotation_options *opt);
 
 int annotate_parse_percent_type(const struct option *opt, const char *_str,
                                int unset);
index eb087e7df6f4bc1c98398a9e98b12dfd64761f0e..3571ce72ca28e7e6ee68adcab72ef3398d88350d 100644 (file)
@@ -629,8 +629,10 @@ int auxtrace_record__options(struct auxtrace_record *itr,
                             struct evlist *evlist,
                             struct record_opts *opts)
 {
-       if (itr)
+       if (itr) {
+               itr->evlist = evlist;
                return itr->recording_options(itr, evlist, opts);
+       }
        return 0;
 }
 
@@ -664,6 +666,24 @@ int auxtrace_parse_snapshot_options(struct auxtrace_record *itr,
        return -EINVAL;
 }
 
+int auxtrace_record__read_finish(struct auxtrace_record *itr, int idx)
+{
+       struct evsel *evsel;
+
+       if (!itr->evlist || !itr->pmu)
+               return -EINVAL;
+
+       evlist__for_each_entry(itr->evlist, evsel) {
+               if (evsel->core.attr.type == itr->pmu->type) {
+                       if (evsel->disabled)
+                               return 0;
+                       return perf_evlist__enable_event_idx(itr->evlist, evsel,
+                                                            idx);
+               }
+       }
+       return -EINVAL;
+}
+
 /*
  * Event record size is 16-bit which results in a maximum size of about 64KiB.
  * Allow about 4KiB for the rest of the sample record, to give a maximum
index 749d72cd9c7b0eaaf6f82ea1fc63ee71d6ca8b50..e58ef160b59992602fd89c6c48260b3ceafd5890 100644 (file)
@@ -29,6 +29,7 @@ struct record_opts;
 struct perf_record_auxtrace_error;
 struct perf_record_auxtrace_info;
 struct events_stats;
+struct perf_pmu;
 
 enum auxtrace_error_type {
        PERF_AUXTRACE_ERROR_ITRACE  = 1,
@@ -322,6 +323,8 @@ struct auxtrace_mmap_params {
  * @read_finish: called after reading from an auxtrace mmap
  * @alignment: alignment (if any) for AUX area data
  * @default_aux_sample_size: default sample size for --aux sample option
+ * @pmu: associated pmu
+ * @evlist: selected events list
  */
 struct auxtrace_record {
        int (*recording_options)(struct auxtrace_record *itr,
@@ -346,6 +349,8 @@ struct auxtrace_record {
        int (*read_finish)(struct auxtrace_record *itr, int idx);
        unsigned int alignment;
        unsigned int default_aux_sample_size;
+       struct perf_pmu *pmu;
+       struct evlist *evlist;
 };
 
 /**
@@ -537,6 +542,7 @@ int auxtrace_record__find_snapshot(struct auxtrace_record *itr, int idx,
                                   struct auxtrace_mmap *mm,
                                   unsigned char *data, u64 *head, u64 *old);
 u64 auxtrace_record__reference(struct auxtrace_record *itr);
+int auxtrace_record__read_finish(struct auxtrace_record *itr, int idx);
 
 int auxtrace_index__auxtrace_event(struct list_head *head, union perf_event *event,
                                   off_t file_offset);
index 0bc9c4d7fdc5d2239dc6c68dff690e9460d17a2e..ef38eba56ed0cb7629263c5132ec1bf0f7d8349f 100644 (file)
@@ -374,6 +374,18 @@ int perf_config_int(int *dest, const char *name, const char *value)
        return 0;
 }
 
+int perf_config_u8(u8 *dest, const char *name, const char *value)
+{
+       long ret = 0;
+
+       if (!perf_parse_long(value, &ret)) {
+               bad_config(name);
+               return -1;
+       }
+       *dest = ret;
+       return 0;
+}
+
 static int perf_config_bool_or_int(const char *name, const char *value, int *is_bool)
 {
        int ret;
index bd0a5897c76a5daad5f68f6b561d1a744f029b76..c10b66dde2f35e407ce0b7a5431551c1cc40afdd 100644 (file)
@@ -29,6 +29,7 @@ typedef int (*config_fn_t)(const char *, const char *, void *);
 int perf_default_config(const char *, const char *, void *);
 int perf_config(config_fn_t fn, void *);
 int perf_config_int(int *dest, const char *, const char *);
+int perf_config_u8(u8 *dest, const char *name, const char *value);
 int perf_config_u64(u64 *dest, const char *, const char *);
 int perf_config_bool(const char *, const char *);
 int config_error_nonbool(const char *);
index 5003ba4033454f813c420bdeafe44ad8b718751b..0f5fda11675fbd46256e5a46c8c61eb3a121f125 100644 (file)
@@ -301,10 +301,15 @@ int probe_file__get_events(int fd, struct strfilter *filter,
                p = strchr(ent->s, ':');
                if ((p && strfilter__compare(filter, p + 1)) ||
                    strfilter__compare(filter, ent->s)) {
-                       strlist__add(plist, ent->s);
+                       ret = strlist__add(plist, ent->s);
+                       if (ret == -ENOMEM) {
+                               pr_err("strlist__add failed with -ENOMEM\n");
+                               goto out;
+                       }
                        ret = 0;
                }
        }
+out:
        strlist__delete(namelist);
 
        return ret;
@@ -511,7 +516,11 @@ static int probe_cache__load(struct probe_cache *pcache)
                                ret = -EINVAL;
                                goto out;
                        }
-                       strlist__add(entry->tevlist, buf);
+                       ret = strlist__add(entry->tevlist, buf);
+                       if (ret == -ENOMEM) {
+                               pr_err("strlist__add failed with -ENOMEM\n");
+                               goto out;
+                       }
                }
        }
 out:
@@ -672,7 +681,12 @@ int probe_cache__add_entry(struct probe_cache *pcache,
                command = synthesize_probe_trace_command(&tevs[i]);
                if (!command)
                        goto out_err;
-               strlist__add(entry->tevlist, command);
+               ret = strlist__add(entry->tevlist, command);
+               if (ret == -ENOMEM) {
+                       pr_err("strlist__add failed with -ENOMEM\n");
+                       goto out_err;
+               }
+
                free(command);
        }
        list_add_tail(&entry->node, &pcache->entries);
@@ -853,9 +867,15 @@ int probe_cache__scan_sdt(struct probe_cache *pcache, const char *pathname)
                        break;
                }
 
-               strlist__add(entry->tevlist, buf);
+               ret = strlist__add(entry->tevlist, buf);
+
                free(buf);
                entry = NULL;
+
+               if (ret == -ENOMEM) {
+                       pr_err("strlist__add failed with -ENOMEM\n");
+                       break;
+               }
        }
        if (entry) {
                list_del_init(&entry->node);
diff --git a/tools/testing/selftests/lkdtm/.gitignore b/tools/testing/selftests/lkdtm/.gitignore
new file mode 100644 (file)
index 0000000..f262126
--- /dev/null
@@ -0,0 +1,2 @@
+*.sh
+!run.sh
index 3a779c084d965087a0e08d7ffd88b5c39a0c8119..39559d723c41808a4bdce9662c9b0de721f12e92 100644 (file)
@@ -2,4 +2,5 @@ pidfd_open_test
 pidfd_poll_test
 pidfd_test
 pidfd_wait
+pidfd_fdinfo_test
 pidfd_getfd_test