1. 18 Jul, 2019 6 commits
    • Linus Torvalds's avatar
      Merge tag 'pm-5.3-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm · d0411ec8
      Linus Torvalds authored
      Pull more power management updates from Rafael Wysocki:
       "These modify the Intel RAPL driver to allow it to use an MMIO
        interface to the hardware, make the int340X thermal driver provide
        such an interface for it, add Intel Ice Lake CPU IDs to the RAPL
        driver (these changes depend on the previously merged x86 arch
        changes), update cpufreq to use the PM QoS framework for managing the
        min and max frequency limits, and add update the imx-cpufreq-dt
        cpufreq driver to support i.MX8MN.
      
        Specifics:
      
         - Add MMIO interface support to the Intel RAPL power capping driver
           and update the int340X thermal driver to provide a RAPL MMIO
           interface (Zhang Rui, Stephen Rothwell).
      
         - Add Intel Ice Lake CPU IDs to the RAPL driver (Zhang Rui, Rajneesh
           Bhardwaj).
      
         - Make cpufreq use the PM QoS framework (instead of notifiers) for
           managing the min and max frequency constraints (Viresh Kumar).
      
         - Add i.MX8MN support to the imx-cpufreq-dt cpufreq driver (Anson
           Huang)"
      
      * tag 'pm-5.3-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (27 commits)
        cpufreq: Make cpufreq_generic_init() return void
        intel_rapl: need linux/cpuhotplug.h for enum cpuhp_state
        powercap/rapl: Add Ice Lake NNPI support to RAPL driver
        powercap/intel_rapl: add support for ICX-D
        powercap/intel_rapl: add support for ICX
        powercap/intel_rapl: add support for IceLake desktop
        intel_rapl: Fix module autoloading issue
        int340X/processor_thermal_device: add support for MMIO RAPL
        intel_rapl: support two power limits for every RAPL domain
        intel_rapl: support 64 bit register
        intel_rapl: abstract RAPL common code
        intel_rapl: cleanup hardcoded MSR access
        intel_rapl: cleanup some functions
        intel_rapl: abstract register access operations
        intel_rapl: abstract register address
        intel_rapl: introduce struct rapl_if_private
        intel_rapl: introduce intel_rapl.h
        intel_rapl: remove hardcoded register index
        intel_rapl: use reg instead of msr
        cpufreq: imx-cpufreq-dt: Add i.MX8MN support
        ...
      d0411ec8
    • Linus Torvalds's avatar
      Merge tag 'acpi-5.3-rc1-3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm · 4b09ddbc
      Linus Torvalds authored
      Pull more ACPI updates from Rafael Wysocki:
       "These get rid of two clang warnings, add a new quirk mechanism to the
        ACPI backlight driver (and apply it to one machine) and update the
        table load object initialization in ACPICA (this is a replacement for
        a previously reverted ACPICA commit).
      
        Specifics:
      
         - Make ACPI table loading work more consistently regardless of the
           exact mechanism used for loading a table (Erik Schmauss).
      
         - Get rid of two clang warnings (Arnd Bergmann).
      
         - Add new quirk mechanism to the ACPI backlight driver and use it to
           add a quirk for PB Easynote MZ35 (Hans de Goede)"
      
      * tag 'acpi-5.3-rc1-3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
        ACPI: video: Add new hw_changes_brightness quirk, set it on PB Easynote MZ35
        ACPI: fix false-positive -Wuninitialized warning
        ACPI: blacklist: fix clang warning for unused DMI table
        ACPICA: Update table load object initialization
      4b09ddbc
    • Linus Torvalds's avatar
      Merge branch 'floppy' · 47d6a760
      Linus Torvalds authored
      Merge floppy ioctl verification fixes from Denis Efremov.
      
      This also marks the floppy driver as orphaned - it turns out that Jiri
      no longer has working hardware.
      
      Actual working physical floppy hardware is getting hard to find, and
      while Willy was able to test this, I think the driver can be considered
      pretty much dead from an actual hardware standpoint.  The hardware that
      is still sold seems to be mainly USB-based, which doesn't use this
      legacy driver at all.
      
      The old floppy disk controller is still emulated in various VM
      environments, so the driver isn't going away, but let's see if anybody
      is interested to step up to maintain it.
      
      The lack of hardware also likely means that the ioctl range verification
      fixes are probably mostly relevant to anybody using floppies in a
      virtual environment.  Which is probably also going away in favor of USB
      storage emulation, but who knows.
      
      Will Decon reviewed the patches but I'm not rebasing them just for that,
      so I'll add a
      Reviewed-by: default avatarWill Deacon <will@kernel.org>
      
      here instead.
      
      * floppy:
        MAINTAINERS: mark floppy.c orphaned
        floppy: fix out-of-bounds read in copy_buffer
        floppy: fix invalid pointer dereference in drive_name
        floppy: fix out-of-bounds read in next_valid_format
        floppy: fix div-by-zero in setup_format_params
      47d6a760
    • Jiri Kosina's avatar
      MAINTAINERS: mark floppy.c orphaned · be2ece49
      Jiri Kosina authored
      I volunteered myself to maintain it quite some time ago back when I
      fixed the concurrency issues which exhibited itself only with
      VM-emulated devices, and at the same time I still had the physical 3.5"
      reader to test all the changes.
      
      The reader doesn't work any more though, so I guess it's time to step
      down from this super-prestigious role :p and mark floppy.c as Orphaned.
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      be2ece49
    • Rafael J. Wysocki's avatar
      Merge branches 'acpi-misc' and 'acpi-video' · 2c66a5b5
      Rafael J. Wysocki authored
      * acpi-misc:
        ACPI: fix false-positive -Wuninitialized warning
        ACPI: blacklist: fix clang warning for unused DMI table
      
      * acpi-video:
        ACPI: video: Add new hw_changes_brightness quirk, set it on PB Easynote MZ35
      2c66a5b5
    • Rafael J. Wysocki's avatar
      Merge branch 'pm-cpufreq' · 918e162e
      Rafael J. Wysocki authored
      * pm-cpufreq:
        cpufreq: Make cpufreq_generic_init() return void
        cpufreq: imx-cpufreq-dt: Add i.MX8MN support
        cpufreq: Add QoS requests for userspace constraints
        cpufreq: intel_pstate: Reuse refresh_frequency_limits()
        cpufreq: Register notifiers with the PM QoS framework
        PM / QoS: Add support for MIN/MAX frequency constraints
        PM / QOS: Pass request type to dev_pm_qos_read_value()
        PM / QOS: Rename __dev_pm_qos_read_value() and dev_pm_qos_raw_read_value()
        PM / QOS: Pass request type to dev_pm_qos_{add|remove}_notifier()
      918e162e
  2. 17 Jul, 2019 34 commits
    • Denis Efremov's avatar
      floppy: fix out-of-bounds read in copy_buffer · da99466a
      Denis Efremov authored
      This fixes a global out-of-bounds read access in the copy_buffer
      function of the floppy driver.
      
      The FDDEFPRM ioctl allows one to set the geometry of a disk.  The sect
      and head fields (unsigned int) of the floppy_drive structure are used to
      compute the max_sector (int) in the make_raw_rw_request function.  It is
      possible to overflow the max_sector.  Next, max_sector is passed to the
      copy_buffer function and used in one of the memcpy calls.
      
      An unprivileged user could trigger the bug if the device is accessible,
      but requires a floppy disk to be inserted.
      
      The patch adds the check for the .sect * .head multiplication for not
      overflowing in the set_geometry function.
      
      The bug was found by syzkaller.
      Signed-off-by: default avatarDenis Efremov <efremov@ispras.ru>
      Tested-by: default avatarWilly Tarreau <w@1wt.eu>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      da99466a
    • Denis Efremov's avatar
      floppy: fix invalid pointer dereference in drive_name · 9b04609b
      Denis Efremov authored
      This fixes the invalid pointer dereference in the drive_name function of
      the floppy driver.
      
      The native_format field of the struct floppy_drive_params is used as
      floppy_type array index in the drive_name function.  Thus, the field
      should be checked the same way as the autodetect field.
      
      To trigger the bug, one could use a value out of range and set the drive
      parameters with the FDSETDRVPRM ioctl.  Next, FDGETDRVTYP ioctl should
      be used to call the drive_name.  A floppy disk is not required to be
      inserted.
      
      CAP_SYS_ADMIN is required to call FDSETDRVPRM.
      
      The patch adds the check for a value of the native_format field to be in
      the '0 <= x < ARRAY_SIZE(floppy_type)' range of the floppy_type array
      indices.
      
      The bug was found by syzkaller.
      Signed-off-by: default avatarDenis Efremov <efremov@ispras.ru>
      Tested-by: default avatarWilly Tarreau <w@1wt.eu>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      9b04609b
    • Denis Efremov's avatar
      floppy: fix out-of-bounds read in next_valid_format · 5635f897
      Denis Efremov authored
      This fixes a global out-of-bounds read access in the next_valid_format
      function of the floppy driver.
      
      The values from autodetect field of the struct floppy_drive_params are
      used as indices for the floppy_type array in the next_valid_format
      function 'floppy_type[DP->autodetect[probed_format]].sect'.
      
      To trigger the bug, one could use a value out of range and set the drive
      parameters with the FDSETDRVPRM ioctl.  A floppy disk is not required to
      be inserted.
      
      CAP_SYS_ADMIN is required to call FDSETDRVPRM.
      
      The patch adds the check for values of the autodetect field to be in the
      '0 <= x < ARRAY_SIZE(floppy_type)' range of the floppy_type array indices.
      
      The bug was found by syzkaller.
      Signed-off-by: default avatarDenis Efremov <efremov@ispras.ru>
      Tested-by: default avatarWilly Tarreau <w@1wt.eu>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      5635f897
    • Denis Efremov's avatar
      floppy: fix div-by-zero in setup_format_params · f3554aeb
      Denis Efremov authored
      This fixes a divide by zero error in the setup_format_params function of
      the floppy driver.
      
      Two consecutive ioctls can trigger the bug: The first one should set the
      drive geometry with such .sect and .rate values for the F_SECT_PER_TRACK
      to become zero.  Next, the floppy format operation should be called.
      
      A floppy disk is not required to be inserted.  An unprivileged user
      could trigger the bug if the device is accessible.
      
      The patch checks F_SECT_PER_TRACK for a non-zero value in the
      set_geometry function.  The proper check should involve a reasonable
      upper limit for the .sect and .rate fields, but it could change the
      UAPI.
      
      The patch also checks F_SECT_PER_TRACK in the setup_format_params, and
      cancels the formatting operation in case of zero.
      
      The bug was found by syzkaller.
      Signed-off-by: default avatarDenis Efremov <efremov@ispras.ru>
      Tested-by: default avatarWilly Tarreau <w@1wt.eu>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      f3554aeb
    • Linus Torvalds's avatar
      Merge tag 'platform-drivers-x86-v5.3-2' of git://git.infradead.org/linux-platform-drivers-x86 · 22051d9c
      Linus Torvalds authored
      Pull another x86 platform driver update from Andy Shevchenko:
       "Provide better naming for ABI, i.e. tell that we have fan boost mode.
      
        It won't break any ABI, but has to be done now to avoid confusion in
        the future"
      
      * tag 'platform-drivers-x86-v5.3-2' of git://git.infradead.org/linux-platform-drivers-x86:
        platform/x86: asus: Rename "fan mode" to "fan boost mode"
      22051d9c
    • Linus Torvalds's avatar
      Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux · aac09ce2
      Linus Torvalds authored
      Pull thermal management updates from Zhang Rui:
      
       - Convert thermal documents to ReST (Mauro Carvalho Chehab)
      
       - Fix a cyclic depedency in between thermal core and governors (Daniel
         Lezcano)
      
       - Fix processor_thermal_device driver to re-evaluate power limits after
         resume (Srinivas Pandruvada, Zhang Rui)
      
      * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux:
        drivers: thermal: processor_thermal_device: Fix build warning
        docs: thermal: convert to ReST
        thermal/drivers/core: Use governor table to initialize
        thermal/drivers/core: Add init section table for self-encapsulation
        drivers: thermal: processor_thermal: Read PPCC on resume
      aac09ce2
    • Linus Torvalds's avatar
      Merge tag 'gpio-v5.3-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio · c3c08f93
      Linus Torvalds authored
      Pull GPIO fixes from Linus Walleij:
      
       - Revert a SPIO GPIO fix that didn't fix anything but instead created
         new problems.
      
       - Remove the EM GPIO irqdomain in a safe manner.
      
       - Fix a memory leak in the gpio quirks.
      
       - Make the DaVinci error path silent on probe deferral.
      
      * tag 'gpio-v5.3-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio:
        Revert "gpio/spi: Fix spi-gpio regression on active high CS"
        gpio: em: remove the gpiochip before removing the irq domain
        gpiolib: of: fix a memory leak in of_gpio_flags_quirks()
        gpio: davinci: silence error prints in case of EPROBE_DEFER
      c3c08f93
    • Linus Torvalds's avatar
      Merge tag 'hwlock-v5.3' of git://github.com/andersson/remoteproc · 57ab5f74
      Linus Torvalds authored
      Pull hwspinlock updates from Bjorn Andersson:
       "This contains support for hardware spinlock TI K3 AM65x and J721E
        family of SoCs, support for using hwspinlocks from atomic context and
        better error reporting when dealing with hardware disabled in
        DeviceTree"
      
      * tag 'hwlock-v5.3' of git://github.com/andersson/remoteproc:
        hwspinlock: add the 'in_atomic' API
        hwspinlock: document the hwspinlock 'raw' API
        hwspinlock: stm32: implement the relax() ops
        hwspinlock: ignore disabled device
        hwspinlock/omap: Add a trace during probe
        hwspinlock/omap: Add support for TI K3 SoCs
        dt-bindings: hwlock: Update OMAP binding for TI K3 SoCs
      57ab5f74
    • Linus Torvalds's avatar
      Merge tag 'rproc-v5.3' of git://github.com/andersson/remoteproc · fdcec004
      Linus Torvalds authored
      Pull remoteproc updates from Bjorn Andersson:
       "This adds support for the STM32 remoteproc, additional i.MX platforms
        with Cortex M4 remoteprocs and Qualcomm's QCS404 Compute DSP.
      
        Also initial support for vendor specific resource table entries and
        support for unprocessed Qualcomm firmware files"
      
      * tag 'rproc-v5.3' of git://github.com/andersson/remoteproc:
        remoteproc: stm32: fix building without ARM SMCC
        remoteproc: qcom: q6v5-mss: Fix build error without QCOM_MDT_LOADER
        remoteproc: copy parent dma_pfn_offset for vdev
        remoteproc: qcom: q6v5-mss: Support loading non-split images
        soc: qcom: mdt_loader: Support loading non-split images
        remoteproc: stm32: add an ST stm32_rproc driver
        dt-bindings: remoteproc: add bindings for stm32 remote processor driver
        dt-bindings: stm32: add bindings for ML-AHB interconnect
        remoteproc: Use struct_size() helper
        remoteproc: add vendor resources handling
        remoteproc: imx: Fix typo in "failed"
        remoteproc: imx: Broaden the Kconfig selection logic
        remoteproc,rpmsg: add missing MAINTAINERS file entries
        remoteproc: qcom: qdsp6-adsp: Add support for QCS404 CDSP
        dt-bindings: remoteproc: Rename and amend Hexagon v56 binding
      fdcec004
    • Linus Torvalds's avatar
      Merge tag 'rpmsg-v5.3' of git://github.com/andersson/remoteproc · 7636b758
      Linus Torvalds authored
      Pull rpmsg updates from Bjorn Andersson:
       "This contains a DT binding update and a change to make the remote
        function of rpmsg_devices optional"
      
      * tag 'rpmsg-v5.3' of git://github.com/andersson/remoteproc:
        rpmsg: core: Make remove handler for rpmsg driver optional.
        dt-bindings: soc: qcom: Add remote-pid binding for GLINK SMEM
      7636b758
    • Linus Torvalds's avatar
      Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost · 3a1d5384
      Linus Torvalds authored
      Pull virtio, vhost updates from Michael Tsirkin:
       "Fixes, features, performance:
      
         - new iommu device
      
         - vhost guest memory access using vmap (just meta-data for now)
      
         - minor fixes"
      
      * tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost:
        virtio-mmio: add error check for platform_get_irq
        scsi: virtio_scsi: Use struct_size() helper
        iommu/virtio: Add event queue
        iommu/virtio: Add probe request
        iommu: Add virtio-iommu driver
        PCI: OF: Initialize dev->fwnode appropriately
        of: Allow the iommu-map property to omit untranslated devices
        dt-bindings: virtio: Add virtio-pci-iommu node
        dt-bindings: virtio-mmio: Add IOMMU description
        vhost: fix clang build warning
        vhost: access vq metadata through kernel virtual address
        vhost: factor out setting vring addr and num
        vhost: introduce helpers to get the size of metadata area
        vhost: rename vq_iotlb_prefetch() to vq_meta_prefetch()
        vhost: fine grain userspace memory accessors
        vhost: generalize adding used elem
      3a1d5384
    • Linus Torvalds's avatar
      Merge tag 'vfio-v5.3-rc1' of git://github.com/awilliam/linux-vfio · 37d4607e
      Linus Torvalds authored
      Pull VFIO updates from Alex Williamson:
      
       - Static symbol cleanup in mdev samples (Kefeng Wang)
      
       - Use vma help in nvlink code (Peng Hao)
      
       - Remove unused code in mbochs sample (YueHaibing)
      
       - Send uevents around mdev registration (Alex Williamson)
      
      * tag 'vfio-v5.3-rc1' of git://github.com/awilliam/linux-vfio:
        mdev: Send uevents around parent device registration
        sample/mdev/mbochs: remove set but not used variable 'mdev_state'
        vfio: vfio_pci_nvlink2: use a vma helper function
        vfio-mdev/samples: make some symbols static
      37d4607e
    • Linus Torvalds's avatar
      Merge tag 'clk-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux · 916f562f
      Linus Torvalds authored
      Pull clk updates from Stephen Boyd:
       "This round of clk driver and framework updates is heavy on the driver
        update side. The two main highlights in the core framework are the
        addition of an bulk clk_get API that handles optional clks and an
        extra debugfs file that tells the developer about the current parent
        of a clk.
      
        The driver updates are dominated by i.MX in the diffstat, but that is
        mostly because that SoC has started converting to the clk_hw style of
        clk registration. The next big update is in the Amlogic meson clk
        driver that gained some support for audio, cpu, and temperature clks
        while fixing some PLL issues. Finally, the biggest thing that stands
        out is the conversion of a large part of the Allwinner sunxi-ng driver
        to the new clk parent scheme that uses less strings and more pointer
        comparisons to match clk parents and children up.
      
        In general, it looks like we have a lot of little fixes and tweaks
        here and there to clk data along with the normal addition of a handful
        of new drivers and a couple new core framework features.
      
        Core:
         - Add a 'clk_parent' file in clk debugfs
         - Add a clk_bulk_get_optional() API (with devm too)
      
        New Drivers:
         - Support gated clk controller on MIPS based BCM63XX SoCs
         - Support SiLabs Si5341 and Si5340 chips
         - Support for CPU clks on Raspberry Pi devices
         - Audsys clock driver for MediaTek MT8516 SoCs
      
        Updates:
         - Convert a large portion of the Allwinner sunxi-ng driver to new clk parent scheme
         - Small frequency support for SiLabs Si544 chips
         - Slow clk support for AT91 SAM9X60 SoCs
         - Remove dead code in various clk drivers (-Wunused)
         - Support for Marvell 98DX1135 SoCs
         - Get duty cycle of generic pwm clks
         - Improvement in mmc phase calculation and cleanup of some rate defintions
         - Switch i.MX6 and i.MX7 clock drivers to clk_hw based APIs
         - Add GPIO, SNVS and GIC clocks for i.MX8 drivers
         - Mark imx6sx/ul/ull/sll MMDC_P1_IPG and imx8mm DRAM_APB as critical clock
         - Correct imx7ulp nic1_bus_clk and imx8mm audio_pll2_clk clock setting
         - Add clks for new Exynos5422 Dynamic Memory Controller driver
         - Clock definition for Exynos4412 Mali
         - Add CMM (Color Management Module) clocks on Renesas R-Car H3, M3-N, E3, and D3
         - Add TPU (Timer Pulse Unit / PWM) clocks on Renesas RZ/G2M
         - Support for 32 bit clock IDs in TI's sci-clks for J721e SoCs
         - TI clock probing done from DT by default instead of firmware
         - Fix Amlogic Meson mpll fractional part and spread sprectrum issues
         - Add Amlogic meson8 audio clocks
         - Add Amlogic g12a temperature sensors clocks
         - Add Amlogic g12a and g12b cpu clocks
         - Add TPU (Timer Pulse Unit / PWM) clocks on Renesas R-Car H3, M3-W, and M3-N
         - Add CMM (Color Management Module) clocks on Renesas R-Car M3-W
         - Add Clock Domain support on Renesas RZ/N1"
      
      * tag 'clk-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux: (190 commits)
        clk: consoldiate the __clk_get_hw() declarations
        clk: sprd: Add check for return value of sprd_clk_regmap_init()
        clk: lochnagar: Update DT binding doc to include the primary SPDIF MCLK
        clk: Add Si5341/Si5340 driver
        dt-bindings: clock: Add silabs,si5341
        clk: clk-si544: Implement small frequency change support
        clk: add BCM63XX gated clock controller driver
        devicetree: document the BCM63XX gated clock bindings
        clk: at91: sckc: use dedicated functions to unregister clock
        clk: at91: sckc: improve error path for sama5d4 sck registration
        clk: at91: sckc: remove unnecessary line
        clk: at91: sckc: improve error path for sam9x5 sck register
        clk: at91: sckc: add support to free slow clock osclillator
        clk: at91: sckc: add support to free slow rc oscillator
        clk: at91: sckc: add support to free slow oscillator
        clk: rockchip: export HDMIPHY clock on rk3228
        clk: rockchip: add watchdog pclk on rk3328
        clk: rockchip: add clock id for hdmi_phy special clock on rk3228
        clk: rockchip: add clock id for watchdog pclk on rk3328
        clk: at91: sckc: add support for SAM9X60
        ...
      916f562f
    • Linus Torvalds's avatar
      Merge tag 'rtc-5.3' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux · edafb6fe
      Linus Torvalds authored
      Pull RTC updates from Alexandre Belloni:
       "A quiet cycle this time.
      
         - ds1307: properly handle oscillator failure flags
      
         - imx-sc: alarm support
      
         - pcf2123: alarm support, correct offset handling
      
         - sun6i: add R40 support
      
         - simplify getting the adapter of an i2c client"
      
      * tag 'rtc-5.3' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux: (37 commits)
        rtc: wm831x: Add IRQF_ONESHOT flag
        rtc: stm32: remove one condition check in stm32_rtc_set_alarm()
        rtc: pcf2123: Fix build error
        rtc: interface: Change type of 'count' from int to u64
        rtc: pcf8563: Clear event flags and disable interrupts before requesting irq
        rtc: pcf8563: Fix interrupt trigger method
        rtc: pcf2123: fix negative offset rounding
        rtc: pcf2123: add alarm support
        rtc: pcf2123: use %ptR
        rtc: pcf2123: port to regmap
        rtc: pcf2123: remove sysfs register view
        rtc: rx8025: simplify getting the adapter of a client
        rtc: rx8010: simplify getting the adapter of a client
        rtc: rv8803: simplify getting the adapter of a client
        rtc: m41t80: simplify getting the adapter of a client
        rtc: fm3130: simplify getting the adapter of a client
        rtc: tegra: Drop MODULE_ALIAS
        rtc: sun6i: Add R40 compatible
        dt-bindings: rtc: sun6i: Add the R40 RTC compatible
        dt-bindings: rtc: Convert Allwinner A31 RTC to a schema
        ...
      edafb6fe
    • Linus Torvalds's avatar
      Merge tag 'dmaengine-5.3-rc1' of git://git.infradead.org/users/vkoul/slave-dma · 47ebe00b
      Linus Torvalds authored
      Pull dmaengine updates from Vinod Koul:
      
       - Add support in dmaengine core to do device node checks for DT devices
         and update bunch of drivers to use that and remove open coding from
         drivers
      
       - New driver/driver support for new hardware, namely:
           - MediaTek UART APDMA
           - Freescale i.mx7ulp edma2
           - Synopsys eDMA IP core version 0
           - Allwinner H6 DMA
      
       - Updates to axi-dma and support for interleaved cyclic transfers
      
       - Greg's debugfs return value check removals on drivers
      
       - Updates to stm32-dma, hsu, dw, pl330, tegra drivers
      
      * tag 'dmaengine-5.3-rc1' of git://git.infradead.org/users/vkoul/slave-dma: (68 commits)
        dmaengine: Revert "dmaengine: fsl-edma: add i.mx7ulp edma2 version support"
        dmaengine: at_xdmac: check for non-empty xfers_list before invoking callback
        Documentation: dmaengine: clean up description of dmatest usage
        dmaengine: tegra210-adma: remove PM_CLK dependency
        dmaengine: fsl-edma: add i.mx7ulp edma2 version support
        dt-bindings: dma: fsl-edma: add new i.mx7ulp-edma
        dmaengine: fsl-edma-common: version check for v2 instead
        dmaengine: fsl-edma-common: move dmamux register to another single function
        dmaengine: fsl-edma: add drvdata for fsl-edma
        dmaengine: Revert "dmaengine: fsl-edma: support little endian for edma driver"
        dmaengine: rcar-dmac: Reject zero-length slave DMA requests
        dmaengine: dw: Enable iDMA 32-bit on Intel Elkhart Lake
        dmaengine: dw-edma: fix semicolon.cocci warnings
        dmaengine: sh: usb-dmac: Use [] to denote a flexible array member
        dmaengine: dmatest: timeout value of -1 should specify infinite wait
        dmaengine: dw: Distinguish ->remove() between DW and iDMA 32-bit
        dmaengine: fsl-edma: support little endian for edma driver
        dmaengine: hsu: Revert "set HSU_CH_MTSR to memory width"
        dmagengine: pl330: add code to get reset property
        dt-bindings: pl330: document the optional resets property
        ...
      47ebe00b
    • Linus Torvalds's avatar
      Merge tag 'mips_5.3' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux · fa121bb3
      Linus Torvalds authored
      Pull MIPS updates from Paul Burton:
       "A light batch this time around but significant improvements for
        certain systems:
      
         - Removal of readq & writeq for MIPS32 kernels where they would
           simply BUG() anyway, allowing drivers or other code that #ifdefs on
           their presence to work properly.
      
         - Improvements for Ingenic JZ4740 systems, including support for the
           external memory controller & pinmuxing fixes for qi_lb60/NanoNote
           systems.
      
         - Improvements for Lantiq systems, in particular around SMP & IPIs.
      
         - DT updates for ralink/MediaTek MT7628a systems to probe & configure
           a bunch more devices.
      
         - Miscellaneous cleanups & build fixes"
      
      * tag 'mips_5.3' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux: (30 commits)
        MIPS: fix some more fall through errors in arch/mips
        MIPS: perf events: handle switch statement falling through warnings
        mips/kprobes: Export kprobe_fault_handler()
        MAINTAINERS: Add myself as Ingenic SoCs maintainer
        MIPS: ralink: mt7628a.dtsi: Add watchdog controller DT node
        MIPS: ralink: mt7628a.dtsi: Add SPI controller DT node
        MIPS: ralink: mt7628a.dtsi: Add GPIO controller DT node
        MIPS: ralink: mt7628a.dtsi: Add pinctrl DT properties to the UART nodes
        MIPS: ralink: mt7628a.dtsi: Add pinmux DT node
        MIPS: ralink: mt7628a.dtsi: Add SPDX GPL-2.0 license identifier
        MIPS: lantiq: Add SMP support for lantiq interrupt controller
        MIPS: lantiq: Shorten register names, remove unused macros
        MIPS: lantiq: Fix bitfield masking
        MIPS: lantiq: Remove unused macros
        MIPS: lantiq: Fix attributes of of_device_id structure
        MIPS: lantiq: Change variables to the same type as the source
        MIPS: lantiq: Move macro directly to iomem function
        mips: Remove q-accessors from non-64bit platforms
        FDDI: defza: Include linux/io-64-nonatomic-lo-hi.h
        MIPS: configs: Remove useless UEVENT_HELPER_PATH
        ...
      fa121bb3
    • Linus Torvalds's avatar
      Merge tag 'h8300-for-linus-20190617' of git://git.sourceforge.jp/gitroot/uclinux-h8/linux · 7d4901c0
      Linus Torvalds authored
      Pull h8300 update from Yoshinori Sato:
       "Remove unused barrier defines"
      
      * tag 'h8300-for-linus-20190617' of git://git.sourceforge.jp/gitroot/uclinux-h8/linux:
        H8300: remove unused barrier defines
      7d4901c0
    • Linus Torvalds's avatar
      Merge tag 'for-linus-20190617' of git://git.sourceforge.jp/gitroot/uclinux-h8/linux · 415bfd9c
      Linus Torvalds authored
      Pull SH updates from Yoshinori Sato.
      
      kprobe fix, defconfig updates and a SH Kconfig fix.
      
      * tag 'for-linus-20190617' of git://git.sourceforge.jp/gitroot/uclinux-h8/linux:
        arch/sh: Check for kprobe trap number before trying to handle a kprobe trap
        sh: configs: Remove useless UEVENT_HELPER_PATH
        Fix allyesconfig output.
      415bfd9c
    • Daniel Drake's avatar
      platform/x86: asus: Rename "fan mode" to "fan boost mode" · 9af93db9
      Daniel Drake authored
      The Asus WMI spec indicates that the function being controlled here
      is called "Fan Boost Mode". The user-facing documentation also calls it
      this.
      
      The spec uses the term "fan mode" is used to refer to other things,
      including functionality expected to appear on future products.
      We missed this before as we are not dealing with the most readable of
      specs, and didn't forsee any confusion around shortening the name.
      
      Rename "fan mode" to "fan boost mode" to improve consistency with the
      spec and to avoid a future naming conflict.
      
      There is no interface breakage here since this has yet to be included
      in an official kernel release. I also updated the kernel version listed
      under ABI accordingly.
      Signed-off-by: default avatarDaniel Drake <drake@endlessm.com>
      Acked-by: default avatarYurii Pavlovskyi <yurii.pavlovskyi@gmail.com>
      Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      9af93db9
    • Linus Torvalds's avatar
      Merge branch 'akpm' (patches from Andrew) · 57a8ec38
      Linus Torvalds authored
      Merge more updates from Andrew Morton:
       "VM:
         - z3fold fixes and enhancements by Henry Burns and Vitaly Wool
      
         - more accurate reclaimed slab caches calculations by Yafang Shao
      
         - fix MAP_UNINITIALIZED UAPI symbol to not depend on config, by
           Christoph Hellwig
      
         - !CONFIG_MMU fixes by Christoph Hellwig
      
         - new novmcoredd parameter to omit device dumps from vmcore, by
           Kairui Song
      
         - new test_meminit module for testing heap and pagealloc
           initialization, by Alexander Potapenko
      
         - ioremap improvements for huge mappings, by Anshuman Khandual
      
         - generalize kprobe page fault handling, by Anshuman Khandual
      
         - device-dax hotplug fixes and improvements, by Pavel Tatashin
      
         - enable synchronous DAX fault on powerpc, by Aneesh Kumar K.V
      
         - add pte_devmap() support for arm64, by Robin Murphy
      
         - unify locked_vm accounting with a helper, by Daniel Jordan
      
         - several misc fixes
      
        core/lib:
         - new typeof_member() macro including some users, by Alexey Dobriyan
      
         - make BIT() and GENMASK() available in asm, by Masahiro Yamada
      
         - changed LIST_POISON2 on x86_64 to 0xdead000000000122 for better
           code generation, by Alexey Dobriyan
      
         - rbtree code size optimizations, by Michel Lespinasse
      
         - convert struct pid count to refcount_t, by Joel Fernandes
      
        get_maintainer.pl:
         - add --no-moderated switch to skip moderated ML's, by Joe Perches
      
        misc:
         - ptrace PTRACE_GET_SYSCALL_INFO interface
      
         - coda updates
      
         - gdb scripts, various"
      
      [ Using merge message suggestion from Vlastimil Babka, with some editing - Linus ]
      
      * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (100 commits)
        fs/select.c: use struct_size() in kmalloc()
        mm: add account_locked_vm utility function
        arm64: mm: implement pte_devmap support
        mm: introduce ARCH_HAS_PTE_DEVMAP
        mm: clean up is_device_*_page() definitions
        mm/mmap: move common defines to mman-common.h
        mm: move MAP_SYNC to asm-generic/mman-common.h
        device-dax: "Hotremove" persistent memory that is used like normal RAM
        mm/hotplug: make remove_memory() interface usable
        device-dax: fix memory and resource leak if hotplug fails
        include/linux/lz4.h: fix spelling and copy-paste errors in documentation
        ipc/mqueue.c: only perform resource calculation if user valid
        include/asm-generic/bug.h: fix "cut here" for WARN_ON for __WARN_TAINT architectures
        scripts/gdb: add helpers to find and list devices
        scripts/gdb: add lx-genpd-summary command
        drivers/pps/pps.c: clear offset flags in PPS_SETPARAMS ioctl
        kernel/pid.c: convert struct pid count to refcount_t
        drivers/rapidio/devices/rio_mport_cdev.c: NUL terminate some strings
        select: shift restore_saved_sigmask_unless() into poll_select_copy_remaining()
        select: change do_poll() to return -ERESTARTNOHAND rather than -EINTR
        ...
      57a8ec38
    • Gustavo A. R. Silva's avatar
      fs/select.c: use struct_size() in kmalloc() · 43e11fa2
      Gustavo A. R. Silva authored
      One of the more common cases of allocation size calculations is finding
      the size of a structure that has a zero-sized array at the end, along
      with memory for some number of elements for that array.  For example:
      
        struct foo {
             int stuff;
             struct boo entry[];
        };
      
        size = sizeof(struct foo) + count * sizeof(struct boo);
        instance = kmalloc(size, GFP_KERNEL);
      
      Instead of leaving these open-coded and prone to type mistakes, we can now
      use the new struct_size() helper:
      
        instance = kmalloc(struct_size(instance, entry, count), GFP_KERNEL);
      
      Also, notice that variable size is unnecessary, hence it is removed.
      
      This code was detected with the help of Coccinelle.
      
      Link: http://lkml.kernel.org/r/20190604164226.GA13823@embeddedorSigned-off-by: default avatarGustavo A. R. Silva <gustavo@embeddedor.com>
      Reviewed-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      43e11fa2
    • Daniel Jordan's avatar
      mm: add account_locked_vm utility function · 79eb597c
      Daniel Jordan authored
      locked_vm accounting is done roughly the same way in five places, so
      unify them in a helper.
      
      Include the helper's caller in the debug print to distinguish between
      callsites.
      
      Error codes stay the same, so user-visible behavior does too.  The one
      exception is that the -EPERM case in tce_account_locked_vm is removed
      because Alexey has never seen it triggered.
      
      [daniel.m.jordan@oracle.com: v3]
        Link: http://lkml.kernel.org/r/20190529205019.20927-1-daniel.m.jordan@oracle.com
      [sfr@canb.auug.org.au: fix mm/util.c]
      Link: http://lkml.kernel.org/r/20190524175045.26897-1-daniel.m.jordan@oracle.comSigned-off-by: default avatarDaniel Jordan <daniel.m.jordan@oracle.com>
      Signed-off-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
      Tested-by: default avatarAlexey Kardashevskiy <aik@ozlabs.ru>
      Acked-by: default avatarAlex Williamson <alex.williamson@redhat.com>
      Cc: Alan Tull <atull@kernel.org>
      Cc: Alex Williamson <alex.williamson@redhat.com>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: Christophe Leroy <christophe.leroy@c-s.fr>
      Cc: Davidlohr Bueso <dave@stgolabs.net>
      Cc: Jason Gunthorpe <jgg@mellanox.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Moritz Fischer <mdf@kernel.org>
      Cc: Paul Mackerras <paulus@ozlabs.org>
      Cc: Steve Sistare <steven.sistare@oracle.com>
      Cc: Wu Hao <hao.wu@intel.com>
      Cc: Ira Weiny <ira.weiny@intel.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      79eb597c
    • Robin Murphy's avatar
      arm64: mm: implement pte_devmap support · 73b20c84
      Robin Murphy authored
      In order for things like get_user_pages() to work on ZONE_DEVICE memory,
      we need a software PTE bit to identify device-backed PFNs.  Hook this up
      along with the relevant helpers to join in with ARCH_HAS_PTE_DEVMAP.
      
      [robin.murphy@arm.com: build fixes]
        Link: http://lkml.kernel.org/r/13026c4e64abc17133bbfa07d7731ec6691c0bcd.1559050949.git.robin.murphy@arm.com
      Link: http://lkml.kernel.org/r/817d92886fc3b33bcbf6e105ee83a74babb3a5aa.1558547956.git.robin.murphy@arm.comSigned-off-by: default avatarRobin Murphy <robin.murphy@arm.com>
      Acked-by: default avatarWill Deacon <will.deacon@arm.com>
      Cc: Anshuman Khandual <anshuman.khandual@arm.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: David Hildenbrand <david@redhat.com>
      Cc: Ira Weiny <ira.weiny@intel.com>
      Cc: Jerome Glisse <jglisse@redhat.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Oliver O'Halloran <oohall@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      73b20c84
    • Robin Murphy's avatar
      mm: introduce ARCH_HAS_PTE_DEVMAP · 17596731
      Robin Murphy authored
      ARCH_HAS_ZONE_DEVICE is somewhat meaningless in itself, and combined
      with the long-out-of-date comment can lead to the impression than an
      architecture may just enable it (since __add_pages() now "comprehends
      device memory" for itself) and expect things to work.
      
      In practice, however, ZONE_DEVICE users have little chance of
      functioning correctly without __HAVE_ARCH_PTE_DEVMAP, so let's clean
      that up the same way as ARCH_HAS_PTE_SPECIAL and make it the proper
      dependency so the real situation is clearer.
      
      Link: http://lkml.kernel.org/r/87554aa78478a02a63f2c4cf60a847279ae3eb3b.1558547956.git.robin.murphy@arm.comSigned-off-by: default avatarRobin Murphy <robin.murphy@arm.com>
      Acked-by: default avatarDan Williams <dan.j.williams@intel.com>
      Reviewed-by: default avatarIra Weiny <ira.weiny@intel.com>
      Acked-by: default avatarOliver O'Halloran <oohall@gmail.com>
      Reviewed-by: default avatarAnshuman Khandual <anshuman.khandual@arm.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: David Hildenbrand <david@redhat.com>
      Cc: Jerome Glisse <jglisse@redhat.com>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      17596731
    • Robin Murphy's avatar
      mm: clean up is_device_*_page() definitions · 7588adf8
      Robin Murphy authored
      Refactor is_device_{public,private}_page() with is_pci_p2pdma_page() to
      make them all consistent in depending on their respective config options
      even when CONFIG_DEV_PAGEMAP_OPS is enabled for other reasons.  This
      allows a little more compile-time optimisation as well as the conceptual
      and cosmetic cleanup.
      
      Link: http://lkml.kernel.org/r/187c2ab27dea70635d375a61b2f2076d26c032b0.1558547956.git.robin.murphy@arm.comSigned-off-by: default avatarRobin Murphy <robin.murphy@arm.com>
      Suggested-by: default avatarJerome Glisse <jglisse@redhat.com>
      Reviewed-by: default avatarAnshuman Khandual <anshuman.khandual@arm.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: David Hildenbrand <david@redhat.com>
      Cc: Ira Weiny <ira.weiny@intel.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Oliver O'Halloran <oohall@gmail.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      7588adf8
    • Aneesh Kumar K.V's avatar
      mm/mmap: move common defines to mman-common.h · 8aa3c927
      Aneesh Kumar K.V authored
      Two architecture that use arch specific MMAP flags are powerpc and
      sparc.  We still have few flag values common across them and other
      architectures.  Consolidate this in mman-common.h.
      
      Also update the comment to indicate where to find HugeTLB specific
      reserved values
      
      Link: http://lkml.kernel.org/r/20190604090950.31417-1-aneesh.kumar@linux.ibm.comSigned-off-by: default avatarAneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
      Reviewed-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      8aa3c927
    • Aneesh Kumar K.V's avatar
      mm: move MAP_SYNC to asm-generic/mman-common.h · 22fcea6f
      Aneesh Kumar K.V authored
      This enables support for synchronous DAX fault on powerpc
      
      The generic changes are added as part of b6fb293f ("mm: Define
      MAP_SYNC and VM_SYNC flags")
      
      Without this, mmap returns EOPNOTSUPP for MAP_SYNC with
      MAP_SHARED_VALIDATE
      
      Instead of adding MAP_SYNC with same value to
      arch/powerpc/include/uapi/asm/mman.h, I am moving the #define to
      asm-generic/mman-common.h.  Two architectures using mman-common.h
      directly are sparc and powerpc.  We should be able to consloidate more
      #defines to mman-common.h.  That can be done as a separate patch.
      
      Link: http://lkml.kernel.org/r/20190528091120.13322-1-aneesh.kumar@linux.ibm.comSigned-off-by: default avatarAneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
      Reviewed-by: default avatarJan Kara <jack@suse.cz>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      22fcea6f
    • Pavel Tatashin's avatar
      device-dax: "Hotremove" persistent memory that is used like normal RAM · 9f960da7
      Pavel Tatashin authored
      It is now allowed to use persistent memory like a regular RAM, but
      currently there is no way to remove this memory until machine is
      rebooted.
      
      This work expands the functionality to also allows hotremoving
      previously hotplugged persistent memory, and recover the device for use
      for other purposes.
      
      To hotremove persistent memory, the management software must first
      offline all memory blocks of dax region, and than unbind it from
      device-dax/kmem driver.  So, operations should look like this:
      
        echo offline > /sys/devices/system/memory/memoryN/state
        ...
        echo dax0.0 > /sys/bus/dax/drivers/kmem/unbind
      
      Note: if unbind is done without offlining memory beforehand, it won't be
      possible to do dax0.0 hotremove, and dax's memory is going to be part of
      System RAM until reboot.
      
      Link: http://lkml.kernel.org/r/20190517215438.6487-4-pasha.tatashin@soleen.comSigned-off-by: default avatarPavel Tatashin <pasha.tatashin@soleen.com>
      Reviewed-by: default avatarDavid Hildenbrand <david@redhat.com>
      Cc: James Morris <jmorris@namei.org>
      Cc: Sasha Levin <sashal@kernel.org>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Keith Busch <keith.busch@intel.com>
      Cc: Vishal Verma <vishal.l.verma@intel.com>
      Cc: Dave Jiang <dave.jiang@intel.com>
      Cc: Ross Zwisler <zwisler@kernel.org>
      Cc: Tom Lendacky <thomas.lendacky@amd.com>
      Cc: Huang Ying <ying.huang@intel.com>
      Cc: Fengguang Wu <fengguang.wu@intel.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: Bjorn Helgaas <bhelgaas@google.com>
      Cc: Yaowei Bai <baiyaowei@cmss.chinamobile.com>
      Cc: Takashi Iwai <tiwai@suse.de>
      Cc: Jérôme Glisse <jglisse@redhat.com>
      Cc: Dave Hansen <dave.hansen@intel.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      9f960da7
    • Pavel Tatashin's avatar
      mm/hotplug: make remove_memory() interface usable · eca499ab
      Pavel Tatashin authored
      Presently the remove_memory() interface is inherently broken.  It tries
      to remove memory but panics if some memory is not offline.  The problem
      is that it is impossible to ensure that all memory blocks are offline as
      this function also takes lock_device_hotplug that is required to change
      memory state via sysfs.
      
      So, between calling this function and offlining all memory blocks there
      is always a window when lock_device_hotplug is released, and therefore,
      there is always a chance for a panic during this window.
      
      Make this interface to return an error if memory removal fails.  This
      way it is safe to call this function without panicking machine, and also
      makes it symmetric to add_memory() which already returns an error.
      
      Link: http://lkml.kernel.org/r/20190517215438.6487-3-pasha.tatashin@soleen.comSigned-off-by: default avatarPavel Tatashin <pasha.tatashin@soleen.com>
      Reviewed-by: default avatarDavid Hildenbrand <david@redhat.com>
      Acked-by: default avatarMichal Hocko <mhocko@suse.com>
      Cc: Bjorn Helgaas <bhelgaas@google.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Dave Hansen <dave.hansen@intel.com>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: Dave Jiang <dave.jiang@intel.com>
      Cc: Fengguang Wu <fengguang.wu@intel.com>
      Cc: Huang Ying <ying.huang@intel.com>
      Cc: James Morris <jmorris@namei.org>
      Cc: Jérôme Glisse <jglisse@redhat.com>
      Cc: Keith Busch <keith.busch@intel.com>
      Cc: Ross Zwisler <zwisler@kernel.org>
      Cc: Sasha Levin <sashal@kernel.org>
      Cc: Takashi Iwai <tiwai@suse.de>
      Cc: Tom Lendacky <thomas.lendacky@amd.com>
      Cc: Vishal Verma <vishal.l.verma@intel.com>
      Cc: Yaowei Bai <baiyaowei@cmss.chinamobile.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      eca499ab
    • Pavel Tatashin's avatar
      device-dax: fix memory and resource leak if hotplug fails · 31e4ca92
      Pavel Tatashin authored
      Patch series ""Hotremove" persistent memory", v6.
      
      Recently, adding a persistent memory to be used like a regular RAM was
      added to Linux.  This work extends this functionality to also allow hot
      removing persistent memory.
      
      We (Microsoft) have an important use case for this functionality.
      
      The requirement is for physical machines with small amount of RAM (~8G)
      to be able to reboot in a very short period of time (<1s).  Yet, there
      is a userland state that is expensive to recreate (~2G).
      
      The solution is to boot machines with 2G preserved for persistent
      memory.
      
      Copy the state, and hotadd the persistent memory so machine still has
      all 8G available for runtime.  Before reboot, offline and hotremove
      device-dax 2G, copy the memory that is needed to be preserved to pmem0
      device, and reboot.
      
      The series of operations look like this:
      
      1. After boot restore /dev/pmem0 to ramdisk to be consumed by apps.
         and free ramdisk.
      2. Convert raw pmem0 to devdax
         ndctl create-namespace --mode devdax --map mem -e namespace0.0 -f
      3. Hotadd to System RAM
         echo dax0.0 > /sys/bus/dax/drivers/device_dax/unbind
         echo dax0.0 > /sys/bus/dax/drivers/kmem/new_id
         echo online_movable > /sys/devices/system/memoryXXX/state
      4. Before reboot hotremove device-dax memory from System RAM
         echo offline > /sys/devices/system/memoryXXX/state
         echo dax0.0 > /sys/bus/dax/drivers/kmem/unbind
      5. Create raw pmem0 device
         ndctl create-namespace --mode raw  -e namespace0.0 -f
      6. Copy the state that was stored by apps to ramdisk to pmem device
      7. Do kexec reboot or reboot through firmware if firmware does not
         zero memory in pmem0 region (These machines have only regular
         volatile memory). So to have pmem0 device either memmap kernel
         parameter is used, or devices nodes in dtb are specified.
      
      This patch (of 3):
      
      When add_memory() fails, the resource and the memory should be freed.
      
      Link: http://lkml.kernel.org/r/20190517215438.6487-2-pasha.tatashin@soleen.com
      Fixes: c221c0b0 ("device-dax: "Hotplug" persistent memory for use like normal RAM")
      Signed-off-by: default avatarPavel Tatashin <pasha.tatashin@soleen.com>
      Reviewed-by: default avatarDave Hansen <dave.hansen@intel.com>
      Cc: Bjorn Helgaas <bhelgaas@google.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: Dave Jiang <dave.jiang@intel.com>
      Cc: David Hildenbrand <david@redhat.com>
      Cc: Fengguang Wu <fengguang.wu@intel.com>
      Cc: Huang Ying <ying.huang@intel.com>
      Cc: James Morris <jmorris@namei.org>
      Cc: Jérôme Glisse <jglisse@redhat.com>
      Cc: Keith Busch <keith.busch@intel.com>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Ross Zwisler <zwisler@kernel.org>
      Cc: Sasha Levin <sashal@kernel.org>
      Cc: Takashi Iwai <tiwai@suse.de>
      Cc: Tom Lendacky <thomas.lendacky@amd.com>
      Cc: Vishal Verma <vishal.l.verma@intel.com>
      Cc: Yaowei Bai <baiyaowei@cmss.chinamobile.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      31e4ca92
    • Tom Levy's avatar
      include/linux/lz4.h: fix spelling and copy-paste errors in documentation · 97a0efea
      Tom Levy authored
      Fix a few spelling and grammar errors, and two places where fast/safe in
      the documentation did not match the function.
      
      Link: http://lkml.kernel.org/r/20190321014452.13297-1-tomlevy93@gmail.comSigned-off-by: default avatarTom Levy <tomlevy93@gmail.com>
      Reviewed-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Cc: Jiri Kosina <trivial@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      97a0efea
    • Kees Cook's avatar
      ipc/mqueue.c: only perform resource calculation if user valid · a318f12e
      Kees Cook authored
      Andreas Christoforou reported:
      
        UBSAN: Undefined behaviour in ipc/mqueue.c:414:49 signed integer overflow:
        9 * 2305843009213693951 cannot be represented in type 'long int'
        ...
        Call Trace:
          mqueue_evict_inode+0x8e7/0xa10 ipc/mqueue.c:414
          evict+0x472/0x8c0 fs/inode.c:558
          iput_final fs/inode.c:1547 [inline]
          iput+0x51d/0x8c0 fs/inode.c:1573
          mqueue_get_inode+0x8eb/0x1070 ipc/mqueue.c:320
          mqueue_create_attr+0x198/0x440 ipc/mqueue.c:459
          vfs_mkobj+0x39e/0x580 fs/namei.c:2892
          prepare_open ipc/mqueue.c:731 [inline]
          do_mq_open+0x6da/0x8e0 ipc/mqueue.c:771
      
      Which could be triggered by:
      
              struct mq_attr attr = {
                      .mq_flags = 0,
                      .mq_maxmsg = 9,
                      .mq_msgsize = 0x1fffffffffffffff,
                      .mq_curmsgs = 0,
              };
      
              if (mq_open("/testing", 0x40, 3, &attr) == (mqd_t) -1)
                      perror("mq_open");
      
      mqueue_get_inode() was correctly rejecting the giant mq_msgsize, and
      preparing to return -EINVAL.  During the cleanup, it calls
      mqueue_evict_inode() which performed resource usage tracking math for
      updating "user", before checking if there was a valid "user" at all
      (which would indicate that the calculations would be sane).  Instead,
      delay this check to after seeing a valid "user".
      
      The overflow was real, but the results went unused, so while the flaw is
      harmless, it's noisy for kernel fuzzers, so just fix it by moving the
      calculation under the non-NULL "user" where it actually gets used.
      
      Link: http://lkml.kernel.org/r/201906072207.ECB65450@keescookSigned-off-by: default avatarKees Cook <keescook@chromium.org>
      Reported-by: default avatarAndreas Christoforou <andreaschristofo@gmail.com>
      Acked-by: default avatar"Eric W. Biederman" <ebiederm@xmission.com>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Davidlohr Bueso <dave@stgolabs.net>
      Cc: Manfred Spraul <manfred@colorfullife.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      a318f12e
    • Drew Davenport's avatar
      include/asm-generic/bug.h: fix "cut here" for WARN_ON for __WARN_TAINT architectures · 6b15f678
      Drew Davenport authored
      For architectures using __WARN_TAINT, the WARN_ON macro did not print
      out the "cut here" string.  The other WARN_XXX macros would print "cut
      here" inside __warn_printk, which is not called for WARN_ON since it
      doesn't have a message to print.
      
      Link: http://lkml.kernel.org/r/20190624154831.163888-1-ddavenport@chromium.org
      Fixes: a7bed27a ("bug: fix "cut here" location for __WARN_TAINT architectures")
      Signed-off-by: default avatarDrew Davenport <ddavenport@chromium.org>
      Acked-by: default avatarKees Cook <keescook@chromium.org>
      Tested-by: default avatarKees Cook <keescook@chromium.org>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      6b15f678
    • Leonard Crestez's avatar
      scripts/gdb: add helpers to find and list devices · 778c1f5c
      Leonard Crestez authored
      Add helper commands and functions for finding pointers to struct device
      by enumerating linux device bus/class infrastructure.  This can be used
      to fetch subsystem and driver-specific structs:
      
        (gdb) p *$container_of($lx_device_find_by_class_name("net", "eth0"), "struct net_device", "dev")
        (gdb) p *$container_of($lx_device_find_by_bus_name("i2c", "0-004b"), "struct i2c_client", "dev")
        (gdb) p *(struct imx_port*)$lx_device_find_by_class_name("tty", "ttymxc1")->parent->driver_data
      
      Several generic "lx-device-list" functions are included to enumerate
      devices by bus and class:
      
        (gdb) lx-device-list-bus usb
        (gdb) lx-device-list-class
        (gdb) lx-device-list-tree &platform_bus
      
      Similar information is available in /sys but pointer values are
      deliberately hidden.
      
      Link: http://lkml.kernel.org/r/c948628041311cbf1b9b4cff3dda7d2073cb3eaa.1561492937.git.leonard.crestez@nxp.comSigned-off-by: default avatarLeonard Crestez <leonard.crestez@nxp.com>
      Reviewed-by: default avatarStephen Boyd <sboyd@kernel.org>
      Cc: Kieran Bingham <kbingham@kernel.org>
      Cc: Jan Kiszka <jan.kiszka@siemens.com>
      Cc: "Rafael J. Wysocki" <rafael@kernel.org>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      778c1f5c