07 Jan, 2019

6 commits

  • Add a reset line included in AHCI glue layer to enable AHCI core
    implemented in UniPhier SoCs.

    Signed-off-by: Kunihiko Hayashi
    Signed-off-by: Philipp Zabel

    Kunihiko Hayashi
     
  • This driver works for controlling the reset lines including USB3
    glue layer, however, this can be applied to other glue layers.
    Now this patch renames the driver from "reset-uniphier-usb3" to
    "reset-uniphier-glue".

    At the same time, this changes CONFIG_RESET_UNIPHIER_USB3 to
    CONFIG_RESET_UNIPHIER_GLUE.

    Signed-off-by: Kunihiko Hayashi
    Signed-off-by: Philipp Zabel

    Kunihiko Hayashi
     
  • Create a separate reset driver that uses the reset operations in
    reset-simple. The reset driver for the SoCFPGA platform needs to
    register early in order to be able bring online timers that needed
    early in the kernel bootup.

    We do not need this early reset driver for Stratix10, because on
    arm64, Linux does not need the timers are that in reset. Linux is
    able to run just fine with the internal armv8 timer. Thus, we use
    a new binding "altr,stratix10-rst-mgr" for the Stratix10 platform.
    The Stratix10 platform will continue to use the reset-simple platform
    driver, while the 32-bit platforms(Cyclone5/Arria5/Arria10) will use
    the early reset driver.

    Signed-off-by: Dinh Nguyen
    [p.zabel@pengutronix.de: fixed socfpga of_device_id in reset-simple]
    Signed-off-by: Philipp Zabel

    Dinh Nguyen
     
  • The call to dev_name will dereference dev, however, dev is later
    being null checked, so there is a possibility of a null pointer
    dereference on dev by the call to dev_name. Fix this by null
    checking dev first before the call to dev_name

    Detected by CoverityScan, CID#1475475 ("Dereference before null check")

    Fixes: 2a6cb2b1d83b ("reset: Add reset_control_get_count()")
    Signed-off-by: Colin Ian King
    Signed-off-by: Philipp Zabel

    Colin Ian King
     
  • Currently the reset core has internal support for counting the number of
    resets for a device described in DT. Generalize this to devices using
    lookup resets, and export it for public use.

    This will be used by generic drivers that need to be sure a device is
    controlled by a single, dedicated reset line (e.g. vfio-platform).

    Signed-off-by: Geert Uytterhoeven
    [p.zabel@pengutronix.de: fixed a typo in reset_control_get_count comment]
    Signed-off-by: Philipp Zabel

    Geert Uytterhoeven
     
  • As for today HSDK reset driver implements only .reset() callback.

    In case of driver which implements one of standard
    reset controller usage pattern
    (call *_deassert() in probe(), call *_assert() in remove())
    that leads to inoperability of this reset driver.

    Improve HSDK reset driver by calling .reset() callback inside of
    .deassert() callback to avoid each reset controller
    user adaptation for work with both reset methods
    (reset() and {.assert() & .deassert()} pair)

    Signed-off-by: Eugeniy Paltsev
    Signed-off-by: Philipp Zabel

    Eugeniy Paltsev
     

30 Oct, 2018

1 commit

  • Pull ARM SoC driver updates from Arnd Bergmann:
    "The most noteworthy SoC driver changes this time include:

    - The TEE subsystem gains an in-kernel interface to access the TEE
    from device drivers.

    - The reset controller subsystem gains a driver for the Qualcomm
    Snapdragon 845 Power Domain Controller.

    - The Xilinx Zynq platform now has a firmware interface for its
    platform management unit. This contains a firmware "ioctl"
    interface that was a little controversial at first, but the version
    we merged solved that by not exposing arbitrary firmware calls to
    user space.

    - The Amlogic Meson platform gains a "canvas" driver that is used for
    video processing and shared between different high-level drivers.

    The rest is more of the usual, mostly related to SoC specific power
    management support and core drivers in drivers/soc:

    - Several Renesas SoCs (RZ/G1N, RZ/G2M, R-Car V3M, RZ/A2M) gain new
    features related to power and reset control.

    - The Mediatek mt8183 and mt6765 SoC platforms gain support for their
    respective power management chips.

    - A new driver for NXP i.MX8, which need a firmware interface for
    power management.

    - The SCPI firmware interface now contains support estimating power
    usage of performance states

    - The NVIDIA Tegra "pmc" driver gains a few new features, in
    particular a pinctrl interface for configuring the pads.

    - Lots of small changes for Qualcomm, in particular the "smem" device
    driver.

    - Some cleanups for the TI OMAP series related to their sysc
    controller.

    Additional cleanups and bugfixes in SoC specific drivers include the
    Meson, Keystone, NXP, AT91, Sunxi, Actions, and Tegra platforms"

    * tag 'armsoc-drivers' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (129 commits)
    firmware: tegra: bpmp: Implement suspend/resume support
    drivers: clk: Add ZynqMP clock driver
    dt-bindings: clock: Add bindings for ZynqMP clock driver
    firmware: xilinx: Add zynqmp IOCTL API for device control
    Documentation: xilinx: Add documentation for eemi APIs
    MAINTAINERS: imx: include drivers/firmware/imx path
    firmware: imx: add misc svc support
    firmware: imx: add SCU firmware driver support
    reset: Fix potential use-after-free in __of_reset_control_get()
    dt-bindings: arm: fsl: add scu binding doc
    soc: fsl: qbman: add interrupt coalesce changing APIs
    soc: fsl: bman_portals: defer probe after bman's probe
    soc: fsl: qbman: Use last response to determine valid bit
    soc: fsl: qbman: Add 64 bit DMA addressing requirement to QBMan
    soc: fsl: qbman: replace CPU 0 with any online CPU in hotplug handlers
    soc: fsl: qbman: Check if CPU is offline when initializing portals
    reset: qcom: PDC Global (Power Domain Controller) reset controller
    dt-bindings: reset: Add PDC Global binding for SDM845 SoCs
    reset: Grammar s/more then once/more than once/
    bus: ti-sysc: Just use SET_NOIRQ_SYSTEM_SLEEP_PM_OPS
    ...

    Linus Torvalds
     

08 Oct, 2018

1 commit

  • Calling of_node_put() decreases the reference count of a device tree
    object, and may free some data.

    However, the of_phandle_args structure embedding it is passed to
    reset_controller_dev.of_xlate() after that, so it may still be accessed.

    Move the call to of_node_put() down to fix this.

    Signed-off-by: Geert Uytterhoeven
    [p.zabel@pengutronix.de: moved of_node_put after mutex_unlock]
    Signed-off-by: Philipp Zabel

    Geert Uytterhoeven
     

05 Oct, 2018

2 commits


26 Aug, 2018

1 commit

  • Pull ARM SoC late updates from Olof Johansson:
    "A couple of late-merged changes that would be useful to get in this
    merge window:

    - Driver support for reset of audio complex on Meson platforms. The
    audio driver went in this merge window, and these changes have been
    in -next for a while (just not in our tree).

    - Power management fixes for IOMMU on Rockchip platforms, getting
    closer to kexec working on them, including Chromebooks.

    - Another pass updating "arm,psci" -> "psci" for some properties that
    have snuck in since last time it was done"

    * tag 'armsoc-late' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc:
    iommu/rockchip: Move irq request past pm_runtime_enable
    iommu/rockchip: Handle errors returned from PM framework
    arm64: rockchip: Force CONFIG_PM on Rockchip systems
    ARM: rockchip: Force CONFIG_PM on Rockchip systems
    arm64: dts: Fix various entry-method properties to reflect documentation
    reset: imx7: Fix always writing bits as 0
    reset: meson: add meson audio arb driver
    reset: meson: add dt-bindings for meson-axg audio arb

    Linus Torvalds
     

24 Aug, 2018

2 commits

  • Reset controller fixes for v4.18

    This tag fixes reset assertion on i.MX7 for all non-inverted reset
    control bits. Currently only PCIE controller and PHY resets are used.

    * tag 'reset-fixes-for-4.18' of git://git.pengutronix.de/git/pza/linux:
    reset: imx7: Fix always writing bits as 0

    Signed-off-by: Olof Johansson

    Olof Johansson
     
  • Pull ARM SoC driver updates from Olof Johansson:
    "Some of the larger changes this merge window:

    - Removal of drivers for Exynos5440, a Samsung SoC that never saw
    widespread use.

    - Uniphier support for USB3 and SPI reset handling

    - Syste control and SRAM drivers and bindings for Allwinner platforms

    - Qualcomm AOSS (Always-on subsystem) reset controller drivers

    - Raspberry Pi hwmon driver for voltage

    - Mediatek pwrap (pmic) support for MT6797 SoC"

    * tag 'armsoc-drivers' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (52 commits)
    drivers/firmware: psci_checker: stash and use topology_core_cpumask for hotplug tests
    soc: fsl: cleanup Kconfig menu
    soc: fsl: dpio: Convert DPIO documentation to .rst
    staging: fsl-mc: Remove remaining files
    staging: fsl-mc: Move DPIO from staging to drivers/soc/fsl
    staging: fsl-dpaa2: eth: move generic FD defines to DPIO
    soc: fsl: qe: gpio: Add qe_gpio_set_multiple
    usb: host: exynos: Remove support for Exynos5440
    clk: samsung: Remove support for Exynos5440
    soc: sunxi: Add the A13, A23 and H3 system control compatibles
    reset: uniphier: add reset control support for SPI
    cpufreq: exynos: Remove support for Exynos5440
    ata: ahci-platform: Remove support for Exynos5440
    soc: imx6qp: Use GENPD_FLAG_ALWAYS_ON for PU errata
    soc: mediatek: pwrap: add mt6351 driver for mt6797 SoCs
    soc: mediatek: pwrap: add pwrap driver for mt6797 SoCs
    soc: mediatek: pwrap: fix cipher init setting error
    dt-bindings: pwrap: mediatek: add pwrap support for MT6797
    reset: uniphier: add USB3 core reset control
    dt-bindings: reset: uniphier: add USB3 core reset support
    ...

    Linus Torvalds
     

23 Jul, 2018

1 commit

  • Right now the only user of reset-imx7 is pci-imx6 and the
    reset_control_assert and deassert calls on pciephy_reset don't toggle
    the PCIEPHY_BTN and PCIEPHY_G_RST bits as expected. Fix this by writing
    1 or 0 respectively.

    The reference manual is not very clear regarding SRC_PCIEPHY_RCR but for
    other registers like MIPIPHY and HSICPHY the bits are explicitly
    documented as "1 means assert, 0 means deassert".

    The values are still reversed for IMX7_RESET_PCIE_CTRL_APPS_EN.

    Signed-off-by: Leonard Crestez
    Reviewed-by: Lucas Stach
    Signed-off-by: Philipp Zabel

    Leonard Crestez
     

21 Jul, 2018

1 commit


19 Jul, 2018

1 commit


16 Jul, 2018

3 commits


07 Jul, 2018

1 commit

  • At over 4000 #includes, is the 9th most
    #included header file in the Linux kernel. It does not need
    , so drop that header and explicitly add
    to source files that need it.

    4146 #include

    After this patch, there are 225 files that use ,
    for a reduction of around 3900 times that
    does not have to be read & parsed.

    225 #include

    This patch was build-tested on 20 different arch-es.

    It also makes these drivers SubmitChecklist#1 compliant.

    Signed-off-by: Randy Dunlap
    Reported-by: kbuild test robot # drivers/media/platform/vimc/
    Reported-by: kbuild test robot # drivers/pinctrl/pinctrl-u300.c
    Signed-off-by: Greg Kroah-Hartman

    Randy Dunlap
     

13 Jun, 2018

2 commits

  • Pull more overflow updates from Kees Cook:
    "The rest of the overflow changes for v4.18-rc1.

    This includes the explicit overflow fixes from Silvio, further
    struct_size() conversions from Matthew, and a bug fix from Dan.

    But the bulk of it is the treewide conversions to use either the
    2-factor argument allocators (e.g. kmalloc(a * b, ...) into
    kmalloc_array(a, b, ...) or the array_size() macros (e.g. vmalloc(a *
    b) into vmalloc(array_size(a, b)).

    Coccinelle was fighting me on several fronts, so I've done a bunch of
    manual whitespace updates in the patches as well.

    Summary:

    - Error path bug fix for overflow tests (Dan)

    - Additional struct_size() conversions (Matthew, Kees)

    - Explicitly reported overflow fixes (Silvio, Kees)

    - Add missing kvcalloc() function (Kees)

    - Treewide conversions of allocators to use either 2-factor argument
    variant when available, or array_size() and array3_size() as needed
    (Kees)"

    * tag 'overflow-v4.18-rc1-part2' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux: (26 commits)
    treewide: Use array_size in f2fs_kvzalloc()
    treewide: Use array_size() in f2fs_kzalloc()
    treewide: Use array_size() in f2fs_kmalloc()
    treewide: Use array_size() in sock_kmalloc()
    treewide: Use array_size() in kvzalloc_node()
    treewide: Use array_size() in vzalloc_node()
    treewide: Use array_size() in vzalloc()
    treewide: Use array_size() in vmalloc()
    treewide: devm_kzalloc() -> devm_kcalloc()
    treewide: devm_kmalloc() -> devm_kmalloc_array()
    treewide: kvzalloc() -> kvcalloc()
    treewide: kvmalloc() -> kvmalloc_array()
    treewide: kzalloc_node() -> kcalloc_node()
    treewide: kzalloc() -> kcalloc()
    treewide: kmalloc() -> kmalloc_array()
    mm: Introduce kvcalloc()
    video: uvesafb: Fix integer overflow in allocation
    UBIFS: Fix potential integer overflow in allocation
    leds: Use struct_size() in allocation
    Convert intel uncore to struct_size
    ...

    Linus Torvalds
     
  • The devm_kzalloc() function has a 2-factor argument form, devm_kcalloc().
    This patch replaces cases of:

    devm_kzalloc(handle, a * b, gfp)

    with:
    devm_kcalloc(handle, a * b, gfp)

    as well as handling cases of:

    devm_kzalloc(handle, a * b * c, gfp)

    with:

    devm_kzalloc(handle, array3_size(a, b, c), gfp)

    as it's slightly less ugly than:

    devm_kcalloc(handle, array_size(a, b), c, gfp)

    This does, however, attempt to ignore constant size factors like:

    devm_kzalloc(handle, 4 * 1024, gfp)

    though any constants defined via macros get caught up in the conversion.

    Any factors with a sizeof() of "unsigned char", "char", and "u8" were
    dropped, since they're redundant.

    Some manual whitespace fixes were needed in this patch, as Coccinelle
    really liked to write "=devm_kcalloc..." instead of "= devm_kcalloc...".

    The Coccinelle script used for this was:

    // Fix redundant parens around sizeof().
    @@
    expression HANDLE;
    type TYPE;
    expression THING, E;
    @@

    (
    devm_kzalloc(HANDLE,
    - (sizeof(TYPE)) * E
    + sizeof(TYPE) * E
    , ...)
    |
    devm_kzalloc(HANDLE,
    - (sizeof(THING)) * E
    + sizeof(THING) * E
    , ...)
    )

    // Drop single-byte sizes and redundant parens.
    @@
    expression HANDLE;
    expression COUNT;
    typedef u8;
    typedef __u8;
    @@

    (
    devm_kzalloc(HANDLE,
    - sizeof(u8) * (COUNT)
    + COUNT
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(__u8) * (COUNT)
    + COUNT
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(char) * (COUNT)
    + COUNT
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(unsigned char) * (COUNT)
    + COUNT
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(u8) * COUNT
    + COUNT
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(__u8) * COUNT
    + COUNT
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(char) * COUNT
    + COUNT
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(unsigned char) * COUNT
    + COUNT
    , ...)
    )

    // 2-factor product with sizeof(type/expression) and identifier or constant.
    @@
    expression HANDLE;
    type TYPE;
    expression THING;
    identifier COUNT_ID;
    constant COUNT_CONST;
    @@

    (
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(TYPE) * (COUNT_ID)
    + COUNT_ID, sizeof(TYPE)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(TYPE) * COUNT_ID
    + COUNT_ID, sizeof(TYPE)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(TYPE) * (COUNT_CONST)
    + COUNT_CONST, sizeof(TYPE)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(TYPE) * COUNT_CONST
    + COUNT_CONST, sizeof(TYPE)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(THING) * (COUNT_ID)
    + COUNT_ID, sizeof(THING)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(THING) * COUNT_ID
    + COUNT_ID, sizeof(THING)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(THING) * (COUNT_CONST)
    + COUNT_CONST, sizeof(THING)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(THING) * COUNT_CONST
    + COUNT_CONST, sizeof(THING)
    , ...)
    )

    // 2-factor product, only identifiers.
    @@
    expression HANDLE;
    identifier SIZE, COUNT;
    @@

    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - SIZE * COUNT
    + COUNT, SIZE
    , ...)

    // 3-factor product with 1 sizeof(type) or sizeof(expression), with
    // redundant parens removed.
    @@
    expression HANDLE;
    expression THING;
    identifier STRIDE, COUNT;
    type TYPE;
    @@

    (
    devm_kzalloc(HANDLE,
    - sizeof(TYPE) * (COUNT) * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(TYPE) * (COUNT) * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(TYPE) * COUNT * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(TYPE) * COUNT * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(THING) * (COUNT) * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(THING) * (COUNT) * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(THING) * COUNT * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(THING) * COUNT * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    )

    // 3-factor product with 2 sizeof(variable), with redundant parens removed.
    @@
    expression HANDLE;
    expression THING1, THING2;
    identifier COUNT;
    type TYPE1, TYPE2;
    @@

    (
    devm_kzalloc(HANDLE,
    - sizeof(TYPE1) * sizeof(TYPE2) * COUNT
    + array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(TYPE1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(THING1) * sizeof(THING2) * COUNT
    + array3_size(COUNT, sizeof(THING1), sizeof(THING2))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(THING1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(THING1), sizeof(THING2))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(TYPE1) * sizeof(THING2) * COUNT
    + array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
    , ...)
    |
    devm_kzalloc(HANDLE,
    - sizeof(TYPE1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
    , ...)
    )

    // 3-factor product, only identifiers, with redundant parens removed.
    @@
    expression HANDLE;
    identifier STRIDE, SIZE, COUNT;
    @@

    (
    devm_kzalloc(HANDLE,
    - (COUNT) * STRIDE * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    devm_kzalloc(HANDLE,
    - COUNT * (STRIDE) * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    devm_kzalloc(HANDLE,
    - COUNT * STRIDE * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    devm_kzalloc(HANDLE,
    - (COUNT) * (STRIDE) * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    devm_kzalloc(HANDLE,
    - COUNT * (STRIDE) * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    devm_kzalloc(HANDLE,
    - (COUNT) * STRIDE * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    devm_kzalloc(HANDLE,
    - (COUNT) * (STRIDE) * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    devm_kzalloc(HANDLE,
    - COUNT * STRIDE * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    )

    // Any remaining multi-factor products, first at least 3-factor products,
    // when they're not all constants...
    @@
    expression HANDLE;
    expression E1, E2, E3;
    constant C1, C2, C3;
    @@

    (
    devm_kzalloc(HANDLE, C1 * C2 * C3, ...)
    |
    devm_kzalloc(HANDLE,
    - (E1) * E2 * E3
    + array3_size(E1, E2, E3)
    , ...)
    |
    devm_kzalloc(HANDLE,
    - (E1) * (E2) * E3
    + array3_size(E1, E2, E3)
    , ...)
    |
    devm_kzalloc(HANDLE,
    - (E1) * (E2) * (E3)
    + array3_size(E1, E2, E3)
    , ...)
    |
    devm_kzalloc(HANDLE,
    - E1 * E2 * E3
    + array3_size(E1, E2, E3)
    , ...)
    )

    // And then all remaining 2 factors products when they're not all constants,
    // keeping sizeof() as the second factor argument.
    @@
    expression HANDLE;
    expression THING, E1, E2;
    type TYPE;
    constant C1, C2, C3;
    @@

    (
    devm_kzalloc(HANDLE, sizeof(THING) * C2, ...)
    |
    devm_kzalloc(HANDLE, sizeof(TYPE) * C2, ...)
    |
    devm_kzalloc(HANDLE, C1 * C2 * C3, ...)
    |
    devm_kzalloc(HANDLE, C1 * C2, ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(TYPE) * (E2)
    + E2, sizeof(TYPE)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(TYPE) * E2
    + E2, sizeof(TYPE)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(THING) * (E2)
    + E2, sizeof(THING)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - sizeof(THING) * E2
    + E2, sizeof(THING)
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - (E1) * E2
    + E1, E2
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - (E1) * (E2)
    + E1, E2
    , ...)
    |
    - devm_kzalloc
    + devm_kcalloc
    (HANDLE,
    - E1 * E2
    + E1, E2
    , ...)
    )

    Signed-off-by: Kees Cook

    Kees Cook
     

12 Jun, 2018

1 commit

  • Pull ARM SoC driver updates from Olof Johansson:
    "This contains platform-related driver updates for ARM and ARM64.

    Highlights:

    - ARM SCMI (System Control & Management Interface) driver cleanups

    - Hisilicon support for LPC bus w/ ACPI

    - Reset driver updates for several platforms: Uniphier,

    - Rockchip power domain bindings and hardware descriptions for
    several SoCs.

    - Tegra memory controller reset improvements"

    * tag 'armsoc-drivers' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (59 commits)
    ARM: tegra: fix compile-testing PCI host driver
    soc: rockchip: power-domain: add power domain support for px30
    dt-bindings: power: add binding for px30 power domains
    dt-bindings: power: add PX30 SoCs header for power-domain
    soc: rockchip: power-domain: add power domain support for rk3228
    dt-bindings: power: add binding for rk3228 power domains
    dt-bindings: power: add RK3228 SoCs header for power-domain
    soc: rockchip: power-domain: add power domain support for rk3128
    dt-bindings: power: add binding for rk3128 power domains
    dt-bindings: power: add RK3128 SoCs header for power-domain
    soc: rockchip: power-domain: add power domain support for rk3036
    dt-bindings: power: add binding for rk3036 power domains
    dt-bindings: power: add RK3036 SoCs header for power-domain
    dt-bindings: memory: tegra: Remove Tegra114 SATA and AFI reset definitions
    memory: tegra: Remove Tegra114 SATA and AFI reset definitions
    memory: tegra: Register SMMU after MC driver became ready
    soc: mediatek: remove unneeded semicolon
    soc: mediatek: add a fixed wait for SRAM stable
    soc: mediatek: introduce a CAPS flag for scp_domain_data
    soc: mediatek: reuse regmap_read_poll_timeout helpers
    ...

    Linus Torvalds
     

07 Jun, 2018

2 commits

  • Pull overflow updates from Kees Cook:
    "This adds the new overflow checking helpers and adds them to the
    2-factor argument allocators. And this adds the saturating size
    helpers and does a treewide replacement for the struct_size() usage.
    Additionally this adds the overflow testing modules to make sure
    everything works.

    I'm still working on the treewide replacements for allocators with
    "simple" multiplied arguments:

    *alloc(a * b, ...) -> *alloc_array(a, b, ...)

    and

    *zalloc(a * b, ...) -> *calloc(a, b, ...)

    as well as the more complex cases, but that's separable from this
    portion of the series. I expect to have the rest sent before -rc1
    closes; there are a lot of messy cases to clean up.

    Summary:

    - Introduce arithmetic overflow test helper functions (Rasmus)

    - Use overflow helpers in 2-factor allocators (Kees, Rasmus)

    - Introduce overflow test module (Rasmus, Kees)

    - Introduce saturating size helper functions (Matthew, Kees)

    - Treewide use of struct_size() for allocators (Kees)"

    * tag 'overflow-v4.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
    treewide: Use struct_size() for devm_kmalloc() and friends
    treewide: Use struct_size() for vmalloc()-family
    treewide: Use struct_size() for kmalloc()-family
    device: Use overflow helpers for devm_kmalloc()
    mm: Use overflow helpers in kvmalloc()
    mm: Use overflow helpers in kmalloc_array*()
    test_overflow: Add memory allocation overflow tests
    overflow.h: Add allocation size calculation helpers
    test_overflow: Report test failures
    test_overflow: macrofy some more, do more tests for free
    lib: add runtime test of check_*_overflow functions
    compiler.h: enable builtin overflow checkers and add fallback code

    Linus Torvalds
     
  • 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;
    void *entry[];
    };

    instance = kmalloc(sizeof(struct foo) + sizeof(void *) * count, 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);

    This patch makes the changes for kmalloc()-family (and kvmalloc()-family)
    uses. It was done via automatic conversion with manual review for the
    "CHECKME" non-standard cases noted below, using the following Coccinelle
    script:

    // pkey_cache = kmalloc(sizeof *pkey_cache + tprops->pkey_tbl_len *
    // sizeof *pkey_cache->table, GFP_KERNEL);
    @@
    identifier alloc =~ "kmalloc|kzalloc|kvmalloc|kvzalloc";
    expression GFP;
    identifier VAR, ELEMENT;
    expression COUNT;
    @@

    - alloc(sizeof(*VAR) + COUNT * sizeof(*VAR->ELEMENT), GFP)
    + alloc(struct_size(VAR, ELEMENT, COUNT), GFP)

    // mr = kzalloc(sizeof(*mr) + m * sizeof(mr->map[0]), GFP_KERNEL);
    @@
    identifier alloc =~ "kmalloc|kzalloc|kvmalloc|kvzalloc";
    expression GFP;
    identifier VAR, ELEMENT;
    expression COUNT;
    @@

    - alloc(sizeof(*VAR) + COUNT * sizeof(VAR->ELEMENT[0]), GFP)
    + alloc(struct_size(VAR, ELEMENT, COUNT), GFP)

    // Same pattern, but can't trivially locate the trailing element name,
    // or variable name.
    @@
    identifier alloc =~ "kmalloc|kzalloc|kvmalloc|kvzalloc";
    expression GFP;
    expression SOMETHING, COUNT, ELEMENT;
    @@

    - alloc(sizeof(SOMETHING) + COUNT * sizeof(ELEMENT), GFP)
    + alloc(CHECKME_struct_size(&SOMETHING, ELEMENT, COUNT), GFP)

    Signed-off-by: Kees Cook

    Kees Cook
     

27 Apr, 2018

4 commits


27 Mar, 2018

7 commits

  • Merge the reset lookup support for non-DT platforms, from an
    immutable branch provided for merging into the davinci tree.

    Philipp Zabel
     
  • Add reset lines for ethernet controller on PXs3 SoC.

    Signed-off-by: Kunihiko Hayashi
    Acked-by: Masahiro Yamada
    Signed-off-by: Philipp Zabel

    Kunihiko Hayashi
     
  • stm32mp1 RCC IP 1 has a reset SET register and a reset CLEAR register.

    Writing '0' on reset SET register has no effect
    Writing '1' on reset SET register
    activates the reset of the corresponding peripheral

    Writing '0' on reset CLEAR register has no effect
    Writing '1' on reset CLEAR register
    releases the reset of the corresponding peripheral

    See Documentation/devicetree/bindings/clock/st,stm32mp1-rcc.txt

    Signed-off-by: Gabriel Fernandez
    Signed-off-by: Philipp Zabel

    Gabriel Fernandez
     
  • Add reset lines for audio subsystem (AIO) on UniPhier
    Pro4/Pro5/PXs2 SoCs.

    Signed-off-by: Katsuhiro Suzuki
    Acked-by: Masahiro Yamada
    Signed-off-by: Philipp Zabel

    Katsuhiro Suzuki
     
  • This config select's MFD_SYSCON, but does not depend on HAS_IOMEM.

    Compile testing on architecture without HAS_IOMEM causes "unmet
    direct dependencies" in Kconfig phase.

    Detected by "make ARCH=score allyesconfig".

    Signed-off-by: Masahiro Yamada
    Signed-off-by: Philipp Zabel

    Masahiro Yamada
     
  • Commit 7af1bb19f1d7 ("reset: add support for non-DT systems")
    introduced reset control lookup mechanism for boards that still use
    board files.

    The routine used to register lookup entries takes the corresponding
    reset_controlled_dev structure as argument.

    It's been determined however that for the first user of this new
    interface - davinci psc driver - it will be easier to register the
    lookup entries using the reset controller device name.

    This patch changes the way lookup entries are added.

    Signed-off-by: Bartosz Golaszewski
    [p.zabel@pengutronix.de: added missing ERR_PTR]
    Signed-off-by: Philipp Zabel

    Bartosz Golaszewski
     
  • The reset framework only supports device-tree. There are some platforms
    however, which need to use it even in legacy, board-file based mode.

    An example of such architecture is the DaVinci family of SoCs which
    supports both device tree and legacy boot modes and we don't want to
    introduce any regressions.

    We're currently working on converting the platform from its hand-crafted
    clock API to using the common clock framework. Part of the overhaul will
    be representing the chip's power sleep controller's reset lines using
    the reset framework.

    This changeset extends the core reset code with a new reset lookup
    entry structure. It contains data allowing the reset core to associate
    reset lines with devices by comparing the dev_id and con_id strings.

    It also provides a function allowing drivers to register lookup entries
    with the framework.

    The new lookup function is only called as a fallback in case the
    of_node field is NULL and doesn't change anything for current users.

    Tested with a dummy reset driver with several lookup entries.

    An example lookup table registration from a driver can be found below:

    static struct reset_control_lookup foobar_reset_lookup[] = {
    RESET_LOOKUP("foo.0", "foo", 15),
    RESET_LOOKUP("bar.0", NULL, 5),
    };

    foobar_probe()
    {
    ...

    reset_controller_add_lookup(&rcdev, foobar_reset_lookup,
    ARRAY_SIZE(foobar_reset_lookup));

    ...
    }

    Cc: Sekhar Nori
    Cc: Kevin Hilman
    Cc: David Lechner
    Signed-off-by: Bartosz Golaszewski
    Signed-off-by: Philipp Zabel

    Bartosz Golaszewski
     

21 Feb, 2018

1 commit

  • ASPEED BMC SoCs have a reset controller in the LPC IP that can be
    controlled using this driver to release the UARTs from reset.

    No special configuration is required, so only the compatible string is
    added.

    Signed-off-by: Joel Stanley
    Signed-off-by: Philipp Zabel

    Joel Stanley
     

16 Feb, 2018

1 commit

  • Commit a5a10afe04ef ("reset: meson: add level reset support for GX SoC
    family") only enabled the level resets for the newer GX SoC family.
    However, the older 32-Meson SoCs (Meson8, Meson8b and Meson8m2) also
    support level resets using the same offset as the newer GX SoCs.

    This removes the separation between Meson8b and the GX SoCs from the
    reset-meson driver to enable the level resets also on Meson8b.

    Signed-off-by: Martin Blumenstingl
    Reviewed-by: Neil Armstrong
    Signed-off-by: Philipp Zabel

    Martin Blumenstingl
     

27 Nov, 2017

2 commits