08 Mar, 2020

1 commit

  • Merge Linux stable release v5.4.24 into imx_5.4.y

    * tag 'v5.4.24': (3306 commits)
    Linux 5.4.24
    blktrace: Protect q->blk_trace with RCU
    kvm: nVMX: VMWRITE checks unsupported field before read-only field
    ...

    Signed-off-by: Jason Liu

    Conflicts:
    arch/arm/boot/dts/imx6sll-evk.dts
    arch/arm/boot/dts/imx7ulp.dtsi
    arch/arm64/boot/dts/freescale/fsl-ls1028a.dtsi
    drivers/clk/imx/clk-composite-8m.c
    drivers/gpio/gpio-mxc.c
    drivers/irqchip/Kconfig
    drivers/mmc/host/sdhci-of-esdhc.c
    drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
    drivers/net/can/flexcan.c
    drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
    drivers/net/ethernet/mscc/ocelot.c
    drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
    drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
    drivers/net/phy/realtek.c
    drivers/pci/controller/mobiveil/pcie-mobiveil-host.c
    drivers/perf/fsl_imx8_ddr_perf.c
    drivers/tee/optee/shm_pool.c
    drivers/usb/cdns3/gadget.c
    kernel/sched/cpufreq.c
    net/core/xdp.c
    sound/soc/fsl/fsl_esai.c
    sound/soc/fsl/fsl_sai.c
    sound/soc/sof/core.c
    sound/soc/sof/imx/Kconfig
    sound/soc/sof/loader.c

    Jason Liu
     

15 Jan, 2020

1 commit

  • commit bbe692e349e2a1edf3fe0a29a0e05899c9c94d51 upstream.

    In rpmsg_eptdev_write_iter, if copy_from_iter_full fails the allocated
    buffer needs to be released.

    Signed-off-by: Navid Emamdoost
    Signed-off-by: Bjorn Andersson
    Cc: Ben Hutchings
    Signed-off-by: Greg Kroah-Hartman

    Navid Emamdoost
     

21 Dec, 2019

7 commits

  • commit 278bcb7300f61785dba63840bd2a8cf79f14554c upstream.

    By just cancelling the deferred rx worker during GLINK instance teardown
    any pending deferred commands are leaked, so free them.

    Fixes: b4f8e52b89f6 ("rpmsg: Introduce Qualcomm RPM glink driver")
    Cc: stable@vger.kernel.org
    Acked-by: Chris Lew
    Tested-by: Srinivas Kandagatla
    Signed-off-by: Bjorn Andersson
    Signed-off-by: Greg Kroah-Hartman

    Bjorn Andersson
     
  • commit c3dadc19b7564c732598b30d637c6f275c3b77b6 upstream.

    Attempting to transmit rx_done messages after the GLINK instance is
    being torn down will cause use after free and memory leaks. So cancel
    the intent_work and free up the pending intents.

    With this there are no concurrent accessors of the channel left during
    qcom_glink_native_remove() and there is therefor no need to hold the
    spinlock during this operation - which would prohibit the use of
    cancel_work_sync() in the release function. So remove this.

    Fixes: 1d2ea36eead9 ("rpmsg: glink: Add rx done command")
    Cc: stable@vger.kernel.org
    Acked-by: Chris Lew
    Tested-by: Srinivas Kandagatla
    Signed-off-by: Bjorn Andersson
    Signed-off-by: Greg Kroah-Hartman

    Bjorn Andersson
     
  • commit f7e714988edaffe6ac578318e99501149b067ba0 upstream.

    The device release function is set before registering with rpmsg. If
    rpmsg registration fails, the framework will call device_put(), which
    invokes the release function. The channel create logic does not need to
    free rpdev if rpmsg_register_device() fails and release is called.

    Fixes: b4f8e52b89f6 ("rpmsg: Introduce Qualcomm RPM glink driver")
    Cc: stable@vger.kernel.org
    Tested-by: Srinivas Kandagatla
    Signed-off-by: Chris Lew
    Signed-off-by: Bjorn Andersson
    Signed-off-by: Greg Kroah-Hartman

    Chris Lew
     
  • commit b646293e272816dd0719529dcebbd659de0722f7 upstream.

    In a remote processor crash scenario, there is no guarantee the remote
    processor sent close requests before it went into a bad state. Remove
    the reference that is normally handled by the close command in the
    so channel resources can be released.

    Fixes: b4f8e52b89f6 ("rpmsg: Introduce Qualcomm RPM glink driver")
    Cc: stable@vger.kernel.org
    Tested-by: Srinivas Kandagatla
    Signed-off-by: Chris Lew
    Reported-by: Srinivas Kandagatla
    Signed-off-by: Bjorn Andersson
    Signed-off-by: Greg Kroah-Hartman

    Chris Lew
     
  • commit ac74ea01860170699fb3b6ea80c0476774c8e94f upstream.

    Extra channel reference put when remote sending OPEN_ACK after timeout
    causes use-after-free while handling next remote CLOSE command.

    Remove extra reference put in timeout case to avoid use-after-free.

    Fixes: b4f8e52b89f6 ("rpmsg: Introduce Qualcomm RPM glink driver")
    Cc: stable@vger.kernel.org
    Tested-by: Srinivas Kandagatla
    Signed-off-by: Arun Kumar Neelakantam
    Signed-off-by: Bjorn Andersson
    Signed-off-by: Greg Kroah-Hartman

    Arun Kumar Neelakantam
     
  • commit b85f6b601407347f5425c4c058d1b7871f5bf4f0 upstream.

    Memory allocated for re-usable intents are not freed during channel
    cleanup which causes memory leak in system.

    Check and free all re-usable memory to avoid memory leak.

    Fixes: 933b45da5d1d ("rpmsg: glink: Add support for TX intents")
    Cc: stable@vger.kernel.org
    Acked-By: Chris Lew
    Tested-by: Srinivas Kandagatla
    Signed-off-by: Arun Kumar Neelakantam
    Reported-by: Srinivas Kandagatla
    Signed-off-by: Bjorn Andersson
    Signed-off-by: Greg Kroah-Hartman

    Arun Kumar Neelakantam
     
  • commit 4623e8bf1de0b86e23a56cdb39a72f054e89c3bd upstream.

    When wrapping around the FIFO, the remote expects the tail pointer to
    be reset to 0 on the edge case where the tail equals the FIFO length.

    Fixes: caf989c350e8 ("rpmsg: glink: Introduce glink smem based transport")
    Cc: stable@vger.kernel.org
    Signed-off-by: Chris Lew
    Signed-off-by: Bjorn Andersson
    Signed-off-by: Greg Kroah-Hartman

    Chris Lew
     

25 Nov, 2019

6 commits

  • Add the rpmsg tty demo for iMX AMP platforms.
    Use the "echo > /dev/*RPMSG*", after insmod the module.

    Signed-off-by: Richard Zhu
    Acked-by: Fugang Duan

    Richard Zhu
     
  • - Enable the tx_block mechanism to make sure that every transmission is
    complete when mailbox is used.
    - Refine the data exchange in the rpmsg_rx_callback and some info
    messages and codes comments.

    Signed-off-by: Robin Gong
    Signed-off-by: Richard Zhu

    Richard Zhu
     
  • Add partition reset notify if m4 reset so that rpmsg channel
    could re-create again while m4 come back.

    Signed-off-by: Robin Gong

    Robin Gong
     
  • - Clean up the codes, move the tx/rx mailbox initializations into one
    function.
    - Fix the mu msg data exchange bug.
    - Fix to stop autoload pingpong test module.

    Signed-off-by: Richard Zhu

    Richard Zhu
     
  • - extend the rpmsg support for imx8qm/imx7ulp/imx7d/imx6sx

    Signed-off-by: Richard Zhu

    Richard Zhu
     
  • Based on "virtio_rpmsg_bus" driver, This patch-set is used to set up
    the communication mechanism between A core and M core on i.MX AMP SOCs.

    Add the initial imx rpmsg support glue driver and one pingpong demo,
    demonstrated the data transactions between A core and remote M core.
    Distributed framework is used in IMX RPMSG implementation, refer to the
    following requirements:
    - The CAN functions contained in M core and RTOS should be ready and
    complete functional in 50ms after AMP system is turned on.
    - Partition reset. System wouldn't be stalled by the exceptions (e.x
    the reset triggered by the system hang) occurred at the other side.
    And the RPMSG mechanism should be recovered automactilly after the
    partition reset is completed.
    In this scenario, the M core and RTOS would be kicked off by bootloader
    firstly, then A core and Linux would be loaded later. Both M core/RTOS
    and A core/Linux are running independly.

    One physical memory region used to store the vring is mandatory required
    to pre-reserved and well-knowned by both A core and M core

    Signed-off-by: Richard Zhu

    Richard Zhu
     

18 Sep, 2019

1 commit

  • Naming the glink edge device on the parent of_node short name causes
    collisions when multiple remoteproc instances with only different unit
    address are described on the platform_bus in DeviceTree.

    Base the edge's name on the parent remoteproc's name instead, to ensure
    that it's unique.

    Reviewed-by: Niklas Cassel
    Signed-off-by: Bjorn Andersson

    Bjorn Andersson
     

30 Aug, 2019

1 commit

  • 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 {
    ...
    struct intent_pair intents[];
    } __packed * msg;

    Make use of the struct_size() helper instead of an open-coded version
    in order to avoid any potential type mistakes.

    So, replace the following form:

    sizeof(*msg) + sizeof(struct intent_pair) * count

    with:

    struct_size(msg, intents, count)

    This code was detected with the help of Coccinelle.

    Signed-off-by: Gustavo A. R. Silva
    Signed-off-by: Bjorn Andersson

    Gustavo A. R. Silva
     

28 Aug, 2019

1 commit

  • The virtio_rpmsg_bus driver uses the "%p" format-specifier for
    printing the vring buffer address. This prints only a hashed
    pointer even for previliged users. Use "%pK" instead so that
    the address can be printed during debug using kptr_restrict
    sysctl.

    Signed-off-by: Suman Anna
    Signed-off-by: Bjorn Andersson

    Suman Anna
     

27 Aug, 2019

1 commit


22 May, 2019

1 commit


21 Feb, 2019

2 commits


04 Oct, 2018

1 commit


28 Sep, 2018

1 commit

  • Currently a failed allocation of channel->name leads to an
    immediate return without freeing channel. Fix this by setting
    ret to -ENOMEM and jumping to an exit path that kfree's channel.

    Detected by CoverityScan, CID#1473692 ("Resource Leak")

    Fixes: 53e2822e56c7 ("rpmsg: Introduce Qualcomm SMD backend")
    Cc: stable@vger.kernel.org
    Signed-off-by: Colin Ian King
    Signed-off-by: Bjorn Andersson

    Colin Ian King
     

02 Sep, 2018

1 commit

  • It is possible for the chunk sizes coming from the non RPM remote procs
    to not be word aligned. Remove the alignment warning and continue to
    read from the FIFO so execution is not stalled.

    Signed-off-by: Chris Lew
    Signed-off-by: Arun Kumar Neelakantam
    Signed-off-by: Bjorn Andersson

    Chris Lew
     

28 Aug, 2018

2 commits


31 Jul, 2018

6 commits

  • Add compat ioctl callback to support 32bit user space applications.

    Signed-off-by: Arun Kumar Neelakantam
    Signed-off-by: Bjorn Andersson

    Arun Kumar Neelakantam
     
  • Channels may need to identify the edge their channel was probed for.
    Store the edge name by reading the label property from device tree or
    default to the node name.

    Signed-off-by: Chris Lew
    Signed-off-by: Arun Kumar Neelakantam
    Signed-off-by: Bjorn Andersson

    Chris Lew
     
  • Some of the rpmsg devices need to switch on power domains to communicate
    with remote processor. For example on Qualcomm DB820c platform LPASS
    power domain needs to switched on for any kind of audio services.
    This patch adds the missing power domain support in rpmsg core.

    Without this patch attempting to play audio via QDSP on DB820c would
    reboot the system.

    Signed-off-by: Srinivas Kandagatla
    Signed-off-by: Bjorn Andersson

    Srinivas Kandagatla
     
  • This patch fixes below kerneldoc warnings

    qcom_smd.c:141: warning: Function parameter or member 'dev' not described in 'qcom_smd_edge'
    qcom_smd.c:141: warning: Function parameter or member 'name' not described in 'qcom_smd_edge'
    qcom_smd.c:141: warning: Function parameter or member 'new_channel_event' not described in 'qcom_smd_edge'
    qcom_smd.c:222: warning: Function parameter or member 'qsept' not described in 'qcom_smd_channel'
    qcom_smd.c:222: warning: Function parameter or member 'registered' not described in 'qcom_smd_channel'
    qcom_smd.c:222: warning: Function parameter or member 'state_change_event' not described in 'qcom_smd_channel'
    qcom_smd.c:222: warning: Function parameter or member 'drvdata' not described in 'qcom_smd_channel'
    qcom_smd.c:737: warning: Function parameter or member 'wait' not described in '__qcom_smd_send'

    Signed-off-by: Srinivas Kandagatla
    Signed-off-by: Bjorn Andersson

    Srinivas Kandagatla
     
  • Fix below kerneldoc warnings while building with W=1
    qcom_glink_native.c:53: warning: Function parameter or member 'data' not described in 'glink_defer_cmd'
    qcom_glink_native.c:75: warning: Function parameter or member 'data' not described in 'glink_core_rx_intent'
    qcom_glink_native.c:75: warning: Function parameter or member 'id' not described in 'glink_core_rx_intent'
    qcom_glink_native.c:75: warning: Function parameter or member 'size' not described in 'glink_core_rx_intent'
    qcom_glink_native.c:75: warning: Function parameter or member 'reuse' not described in 'glink_core_rx_intent'
    qcom_glink_native.c:75: warning: Function parameter or member 'in_use' not described in 'glink_core_rx_intent'
    qcom_glink_native.c:75: warning: Function parameter or member 'offset' not described in 'glink_core_rx_intent'
    qcom_glink_native.c:75: warning: Function parameter or member 'node' not described in 'glink_core_rx_intent'
    qcom_glink_native.c:116: warning: Function parameter or member 'features' not described in 'qcom_glink'
    qcom_glink_native.c:116: warning: Function parameter or member 'intentless' not described in 'qcom_glink'
    qcom_glink_native.c:524: warning: Function parameter or member 'version' not described in 'qcom_glink_receive_version'
    qcom_glink_native.c:524: warning: Function parameter or member 'features' not described in 'qcom_glink_receive_version'
    qcom_glink_native.c:524: warning: Excess function parameter 'r_version' description in 'qcom_glink_receive_version'
    qcom_glink_native.c:524: warning: Excess function parameter 'r_features' description in 'qcom_glink_receive_version'
    qcom_glink_native.c:551: warning: Function parameter or member 'version' not described in 'qcom_glink_receive_version_ack'
    qcom_glink_native.c:551: warning: Function parameter or member 'features' not described in 'qcom_glink_receive_version_ack'
    qcom_glink_native.c:551: warning: Excess function parameter 'r_version' description in 'qcom_glink_receive_version_ack'
    qcom_glink_native.c:551: warning: Excess function parameter 'r_features' description in 'qcom_glink_receive_version_ack'
    qcom_glink_native.c:570: warning: bad line: wire format and transmit
    qcom_glink_native.c:604: warning: Function parameter or member 'intent' not described in 'qcom_glink_advertise_intent'
    qcom_glink_native.c:604: warning: Excess function parameter 'size' description in 'qcom_glink_advertise_intent'
    qcom_glink_native.c:710: warning: Function parameter or member 'glink' not described in 'qcom_glink_handle_intent_req'
    qcom_glink_native.c:710: warning: Function parameter or member 'cid' not described in 'qcom_glink_handle_intent_req'
    qcom_glink_native.c:710: warning: Function parameter or member 'size' not described in 'qcom_glink_handle_intent_req'

    Signed-off-by: Srinivas Kandagatla
    Signed-off-by: Bjorn Andersson

    Srinivas Kandagatla
     
  • As intent structure members are not correctly annotated, leading to below warnings

    qcom_glink_native.c:614:16: warning: incorrect type in assignment (different base types)
    qcom_glink_native.c:614:16: expected unsigned short [unsigned] [usertype] id
    qcom_glink_native.c:614:16: got restricted __le16 [usertype]
    qcom_glink_native.c:615:18: warning: incorrect type in assignment (different base types)
    qcom_glink_native.c:615:18: expected unsigned short [unsigned] [usertype] lcid
    qcom_glink_native.c:615:18: got restricted __le16 [usertype]
    qcom_glink_native.c:616:19: warning: incorrect type in assignment (different base types)
    qcom_glink_native.c:616:19: expected unsigned int [unsigned] [usertype] count
    qcom_glink_native.c:616:19: got restricted __le32 [usertype]
    qcom_glink_native.c:617:18: warning: incorrect type in assignment (different base types)
    qcom_glink_native.c:617:18: expected unsigned int [unsigned] [usertype] size
    qcom_glink_native.c:617:18: got restricted __le32 [usertype]
    qcom_glink_native.c:618:18: warning: incorrect type in assignment (different base types)
    qcom_glink_native.c:618:18: expected unsigned int [unsigned] [usertype] liid
    qcom_glink_native.c:618:18: got restricted __le32 [usertype]

    Fix this by correctly annotating them.

    Signed-off-by: Srinivas Kandagatla
    Signed-off-by: Bjorn Andersson

    Srinivas Kandagatla
     

02 Jul, 2018

1 commit

  • Add missing include of sizes.h.

    drivers/rpmsg/qcom_smd.c: In function ‘qcom_smd_channel_open’:
    drivers/rpmsg/qcom_smd.c:809:36: error: ‘SZ_4K’ undeclared (first use in this function)
    bb_size = min(channel->fifo_size, SZ_4K);
    ^~~~~

    Signed-off-by: Niklas Cassel
    Signed-off-by: Bjorn Andersson

    Niklas Cassel
     

05 Jun, 2018

1 commit

  • All the managed resources would be freed by the time release function
    is invoked. Handling such memory in qcom_smd_edge_release() would do
    bad things.

    Found this issue while testing Audio usecase where the dsp is started up
    and shutdown in a loop.

    This patch fixes this issue by using simple kzalloc for allocating
    channel->name and channel which is then freed in qcom_smd_edge_release().

    Without this patch restarting a remoteproc would crash the system.
    Fixes: 53e2822e56c7 ("rpmsg: Introduce Qualcomm SMD backend")
    Cc:
    Signed-off-by: Srinivas Kandagatla
    Signed-off-by: Bjorn Andersson

    Srinivas Kandagatla
     

04 Jun, 2018

5 commits