summaryrefslogtreecommitdiff
path: root/drivers/rpmsg
AgeCommit message (Collapse)Author
2020-02-12rpmsg: virtio rpmsg: compilation error and warningsIgor Opaniuk
1. Fix this compilation error: /workdir/oe/tmp-glibc/work-shared/verdin-imx8mm/kernel-source/drivers/ rpmsg/virtio_rpmsg_bus.c:1106:23: error: redeclaration of 'newch' with no linkage struct rpmsg_device *newch; ^~~~~ /workdir/oe/tmp-glibc/work-shared/verdin-imx8mm/kernel-source/drivers/ rpmsg/virtio_rpmsg_bus.c:1101:23: note: previous declaration of 'newch' was here struct rpmsg_device *newch; 2. Fix warnings that are reproduced when RPMsg char device support is disabled. Fixes: 1172ee2e ("rpmsg: virtio rpmsg: Add RPMsg char driver support") Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
2020-02-12rpmsg: virtio rpmsg: Add RPMsg char driver supportIgor Opaniuk
virtio rpmsg was not implemented to use RPMsg char driver. Each virtio ns announcement will create a new RPMsg device which is supposed to bound to a RPMsg driver. It doesn't support dynamic endpoints with name service per RPMsg device. With RPMsg char driver, you can have multiple endpoints per RPMsg device. Here is the change from this patch: * Introduce a macro to indicate if want to use RPMsg char driver for virtio RPMsg. The RPMsg device can either be bounded to a simple RPMsg driver or the RPMsg char driver. * Create Virtio RPMsg char device when the virtio RPMsg driver is probed. * when there is a remote service announced, keep it in the virtio proc remote services list. * when there is an endpoint created, bind it to a remote service from the remote services list. If the service doesn't exist yet, create one and mark the service address as ANY. That patch ported to our 4.14 kernel + additional fixes added [1]. Example of usage from userspace app: ``` char data_buf [] = {'a', 'b', 'c', 'd', '\0'}; struct rpmsg_endpoint_info ept_info = {"rpmsg-openamp-demo-channel", 0x2, 0x1}; int fd = open("/dev/rpmsg_ctrl0", O_RDWR); /* create endpoint interface */ ioctl(fd, RPMSG_CREATE_EPT_IOCTL, &ept_info); /* create endpoint */ int fd_ept = open("/dev/rpmsg0", O_RDWR); /* receive data from remote device */ read(fd_ept, &data_buf, sizeof(data_buf)); /* send data to remote device */ write(fd_ept, &data_buf, sizeof(data_buf)); /* destroy endpoint */ ioctl(fd_ept, RPMSG_DESTROY_EPT_IOCTL); close(fd_ept); close(fd); ``` [1] https://patchwork.kernel.org/patch/10145779/ Signed-off-by: Wendy Liang <jliang@xilinx.com> Signed-off-by: Igor Opaniuk <igor.opaniuk@toradex.com>
2020-02-09rpmsg: imx: Disable character echoing by defaultAndri Schmidt
Signed-off-by: Andri Schmidt <a.schmidt@scewo.ch> Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
2020-02-09rpmsg: imx: return ENOTTY if no tty connectedStefan Agner
Return ENOTTY if no reader is using the TTY. Note that the VirtIO transport used by RPmsg currently does not use the return value of this callback, hence currently will not influence operation in any way. Signed-off-by: Stefan Agner <stefan.agner@toradex.com> Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
2020-02-09rpmsg: imx: do not push data when no reader is availableStefan Agner
Pushing data while there is no reader seems to lock/crash the TTY layer in some way. Especially when a reader gets attached again, the kernel crashes with Unable to handle kernel paging request at virtual address 00002248 Also use tty_insert_flip_string which handels the copying and TTY buffer resizing if necessary. Signed-off-by: Stefan Agner <stefan.agner@toradex.com> Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com> (cherry picked from commit 5aba75e2c61d4044bed21730b7c471822860fac1)
2020-02-07Merge tag 'v4.14.164' into 4.14-2.3.x-imxMarcel Ziswiler
This is the 4.14.164 stable release Conflicts: arch/arm/Kconfig.debug arch/arm/boot/dts/imx7s.dtsi arch/arm/mach-imx/cpuidle-imx6q.c arch/arm/mach-imx/cpuidle-imx6sx.c arch/arm64/kernel/cpu_errata.c arch/arm64/kvm/hyp/tlb.c drivers/crypto/caam/caamalg.c drivers/crypto/mxs-dcp.c drivers/dma/imx-sdma.c drivers/gpio/gpio-vf610.c drivers/gpu/drm/bridge/adv7511/adv7511_drv.c drivers/input/keyboard/imx_keypad.c drivers/input/keyboard/snvs_pwrkey.c drivers/mmc/core/block.c drivers/mmc/core/queue.h drivers/mmc/host/sdhci-esdhc-imx.c drivers/net/can/flexcan.c drivers/net/can/rx-offload.c drivers/net/ethernet/freescale/fec_main.c drivers/net/wireless/ath/ath10k/pci.c drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c drivers/pci/dwc/pci-imx6.c drivers/spi/spi-fsl-lpspi.c drivers/usb/dwc3/gadget.c include/net/tcp.h sound/soc/fsl/Kconfig sound/soc/fsl/fsl_esai.c
2019-12-21rpmsg: glink: Free pending deferred work on removeBjorn Andersson
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 <clew@codeaurora.org> Tested-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-21rpmsg: glink: Don't send pending rx_done during removeBjorn 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 <clew@codeaurora.org> Tested-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-21rpmsg: glink: Fix rpmsg_register_device err handlingChris Lew
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 <srinivas.kandagatla@linaro.org> Signed-off-by: Chris Lew <clew@codeaurora.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-21rpmsg: glink: Put an extra reference during cleanupChris 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 <srinivas.kandagatla@linaro.org> Signed-off-by: Chris Lew <clew@codeaurora.org> Reported-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-21rpmsg: glink: Fix use after free in open_ack TIMEOUT caseArun Kumar Neelakantam
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 <srinivas.kandagatla@linaro.org> Signed-off-by: Arun Kumar Neelakantam <aneela@codeaurora.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-21rpmsg: glink: Fix reuse intents memory leak issueArun 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 <clew@codeaurora.org> Tested-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Signed-off-by: Arun Kumar Neelakantam <aneela@codeaurora.org> Reported-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-21rpmsg: glink: Set tail pointer to 0 at end of FIFOChris Lew
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 <clew@codeaurora.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-03-25MLK-21247 rpmsg: imx: do not check the remote ready flag in suspend modeRichard Zhu
Since, the partition reset irq would be triggered anytime. Do not read the status of the MU if master side is in suspend mode. Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
2019-03-23MLK-21244 rpmsg: imx: move pm ops to noirq phraseAnson Huang
Some rpmsg user may require rpmsg resume before the user start handle its irq, e.g the typec controller use a GPIO as irq and use rpmsg to get event status, so move imx rpmsg power management ops to noirq phrase. Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com> Tested-by: Clark Wang <xiaoning.wang@nxp.com> Signed-off-by: Anson Huang <anson.huang@nxp.com> Signed-off-by: Li Jun <jun.li@nxp.com>
2019-03-20MLK-21167 rpmsg: imx: add the sync mechanism during partition resetRichard Zhu
Remove the delay waiting, add the sync mechanism during partition reset. In order to avoid the hang at master side during the rpmsg restore procedure. Re-initialize the first_notify parameter, when rpmsg master assumes remote processor is dead. Otherwise, master side maybe hang during the rpmsg restore procedure in some corner cases. ~14ms is required by M4 to process the MU message from the cold boot. Set the max wait of MU_SendMessageTimeout to 20ms. Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com> Reviewed-by: Robin Gong <yibin.gong@nxp.com>
2019-03-20MLK-21194 rpmsg: imx_rpmsg: clear pending partition reboot irq statusFugang Duan
Clear pending interrupt status of partition reboot during rpmsg driver probe to avoid to unregister/register virtio device again. Tested-by: Clark Wang <xiaoning.wang@nxp.com> Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com> Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-02-21MLK-20940-2 rpmsg: adjust the order of rpmsg initializationClark Wang
For the virtual i2c driver should be initialized in subsystem before the other modules initialize. So, the imx_rpmsg and virtio_rpmsg_bus should be initialized before virtual i2c driver. Now, use arch_initcall to initialize these two modules. Signed-off-by: Clark Wang <xiaoning.wang@nxp.com>
2019-02-12MLK-20790-2 rpmsg: imx_rpmsg: use unregister/register virtio device instead ↵Robin Gong
of rpmsg device Currently, issue RPMSG_NS_DESTROY before kick off ready notification to m4 to let m4 side go through all the stale message in vring buffer without doing anything after m4 reset, that's not good enough. The better way is to clear vring buffer after m4 reset, thus everything will be done as the first time of kernel/m4 bootup. So unregister/register virtio device instead of rpmsg device if m4 partition reset. Signed-off-by: Robin Gong <yibin.gong@nxp.com>
2019-02-12MLK-20790-1: rpmsg: imx_rpmsg: dynamic allocate ivdev insteadRobin Gong
Allocate ivdev dynamically instead of static, so that ivdev could be re-initialized by kzalloc() such as 'struct virtio_device', otherwise, the later patch that unregister/register virtio device instead of rpmsg device will cause kernel complain such as 'kobject: tried to init an initialized' and finally register virtio device failure after m4 partition reset. Signed-off-by: Robin Gong <yibin.gong@nxp.com>
2019-02-12MLK-20776-2 RPMSG: imx: add the imx8mq rpmsg variantRichard Zhu
Add the imx8mq/mm rpmsg variant in the driver. No function changes. Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
2019-02-12MLK-20706 rpmsg: imx_rpmsg: fix building error on i.mx6/7 legancy chipRobin Gong
Fix building error caused by commit c6cd4096c224f("MLK-20691-1: rpmsg: imx_rpmsg: add new partition reset interrupt") because of no scu functions on i.mx6sx/7d legancy chip. Signed-off-by: Robin Gong <yibin.gong@nxp.com> Acked-by: Richard Zhu <hongxing.zhu@nxp.com>
2019-02-12MLK-20691-3 rpmsg: imx_rpmsg: add partition reset supportRobin Gong
unregister all rpmsg devices and kick off ready notifyication again to restore back rpmsg communications after M4 partion reset. Signed-off-by: Robin Gong <yibin.gong@nxp.com> Acked-by: Richard Zhu <hongxing.zhu@nxp.com>
2019-02-12MLK-20691-1: rpmsg: imx_rpmsg: add new partition reset interruptRobin Gong
Add new partition reset interrupt group to know M4 reset and restore back at rpmsg level later. Signed-off-by: Robin Gong <yibin.gong@nxp.com> Acked-by: Richard Zhu <hongxing.zhu@nxp.com>
2019-02-12MLK-20637-2 rpmsg: imx: alloc share mem from per dev dma poolRichard Zhu
- reserve one per dev dma pool, and alloc the share memory from it. Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com> Acked-by: Fugang Duan <fugang.duan@nxp.com>
2019-02-12MLK-20653 rpmsg: virtio_rpmsg_bus: fix unexpected huge vmap mappingsFugang Duan
If RPMSG dma memory allocate from per-device mem pool by calling .dma_alloc_coherent(), the size is bigger than 2M bytes and alignment with 2M (PMD_SIZE), then kernel dump by calling .vmalloc_to_page(). Since per-device dma pool do vmap mappings by __ioremap(), __ioremap() might use the hugepage mapping, which in turn will cause the vmalloc_page failed to return the correct page due to the PTE not setup. For exp, when reserve 8M bytes per-device dma mem pool, __ioremap() will use hugepage mapping: __ioremap ioremap_page_range ioremap_pud_range ioremap_pmd_range pmd_set_huge(pmd, phys_addr + addr, prot) Commit:029c54b09599 ("mm/vmalloc.c: huge-vmap: fail gracefully on unexpected huge vmap mapping") ensure that vmalloc_to_page() does not go off into the weeds trying to dereference huge PUDs or PMDs as table entries: rpmsg_sg_init -> vmalloc_to_page-> WARN_ON_ONCE(pmd_bad(*pmd)); In generally, .dma_alloc_coherent() allocate memory from CMA pool/DMA pool/atomic_pool, or swiotlb slabs pool, the virt address mapping to physical address should be lineal, so for the rpmsg scatterlist initialization can use pfn to find the page to avoid to call .vmalloc_to_page(). Kernel dump: [ 0.881722] WARNING: CPU: 0 PID: 1 at mm/vmalloc.c:301 vmalloc_to_page+0xbc/0xc8 [ 0.889094] Modules linked in: [ 0.892139] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.14.78-05581-gc61a572 #206 [ 0.899604] Hardware name: Freescale i.MX8QM MEK (DT) [ 0.904643] task: ffff8008f6c98000 task.stack: ffff000008068000 [ 0.910549] PC is at vmalloc_to_page+0xbc/0xc8 [ 0.914987] LR is at rpmsg_sg_init+0x70/0xcc [ 0.919238] pc : [<ffff0000081c80d4>] lr : [<ffff000008ac471c>] pstate: 40000045 [ 0.926619] sp : ffff00000806b8b0 [ 0.929923] x29: ffff00000806b8b0 x28: ffff00000961cdf0 [ 0.935220] x27: ffff00000961cdf0 x26: 0000000000000000 [ 0.940519] x25: 0000000000040000 x24: ffff00000961ce40 [ 0.945819] x23: ffff00000f000000 x22: ffff00000961ce30 [ 0.951118] x21: 0000000000000000 x20: ffff00000806b950 [ 0.956417] x19: 0000000000000000 x18: 000000000000000e [ 0.961717] x17: 0000000000000001 x16: 0000000000000019 [ 0.967016] x15: 0000000000000033 x14: 616d64202c303030 [ 0.972316] x13: 3030306630303030 x12: 3066666666206176 [ 0.977615] x11: 203a737265666675 x10: 62203334394c203a [ 0.982914] x9 : 000000000000009f x8 : ffff00000806b970 [ 0.988214] x7 : 0000000000000000 x6 : ffff000009690712 [ 0.993513] x5 : 0000000000000000 x4 : 0000000080000000 [ 0.998812] x3 : 00e8000090800f0d x2 : ffff8008ffffd3c0 [ 1.004112] x1 : 0000000000000000 x0 : ffff00000f000000 [ 1.009416] Call trace: [ 1.011849] Exception stack(0xffff00000806b770 to 0xffff00000806b8b0) [ 1.018279] b760: ffff00000f000000 0000000000000000 [ 1.026094] b780: ffff8008ffffd3c0 00e8000090800f0d 0000000080000000 0000000000000000 [ 1.033915] b7a0: ffff000009690712 0000000000000000 ffff00000806b970 000000000000009f [ 1.041731] b7c0: 62203334394c203a 203a737265666675 3066666666206176 3030306630303030 [ 1.049550] b7e0: 616d64202c303030 0000000000000033 0000000000000019 0000000000000001 [ 1.057368] b800: 000000000000000e 0000000000000000 ffff00000806b950 0000000000000000 [ 1.065188] b820: ffff00000961ce30 ffff00000f000000 ffff00000961ce40 0000000000040000 [ 1.073008] b840: 0000000000000000 ffff00000961cdf0 ffff00000961cdf0 ffff00000806b8b0 [ 1.080825] b860: ffff000008ac471c ffff00000806b8b0 ffff0000081c80d4 0000000040000045 [ 1.088646] b880: ffff0000092c8528 ffff00000806b890 ffffffffffffffff ffff000008ac4710 [ 1.096461] b8a0: ffff00000806b8b0 ffff0000081c80d4 [ 1.101327] [<ffff0000081c80d4>] vmalloc_to_page+0xbc/0xc8 [ 1.106800] [<ffff000008ac4968>] rpmsg_probe+0x1f0/0x49c [ 1.112107] [<ffff00000859a9a0>] virtio_dev_probe+0x198/0x210 [ 1.117839] [<ffff0000086a1c70>] driver_probe_device+0x220/0x2d4 [ 1.123829] [<ffff0000086a1e90>] __device_attach_driver+0x98/0xc8 [ 1.129913] [<ffff00000869fe7c>] bus_for_each_drv+0x54/0x94 [ 1.135470] [<ffff0000086a1944>] __device_attach+0xc4/0x12c [ 1.141029] [<ffff0000086a1ed0>] device_initial_probe+0x10/0x18 [ 1.146937] [<ffff0000086a0e48>] bus_probe_device+0x90/0x98 [ 1.152501] [<ffff00000869ef88>] device_add+0x3f4/0x570 [ 1.157709] [<ffff00000869f120>] device_register+0x1c/0x28 [ 1.163182] [<ffff00000859a4f8>] register_virtio_device+0xb8/0x114 [ 1.169353] [<ffff000008ac5e94>] imx_rpmsg_probe+0x3a0/0x5d0 [ 1.175003] [<ffff0000086a3768>] platform_drv_probe+0x50/0xbc [ 1.180730] [<ffff0000086a1c70>] driver_probe_device+0x220/0x2d4 [ 1.186725] [<ffff0000086a1dc8>] __driver_attach+0xa4/0xa8 [ 1.192199] [<ffff00000869fdc4>] bus_for_each_dev+0x58/0x98 [ 1.197759] [<ffff0000086a1598>] driver_attach+0x20/0x28 [ 1.203058] [<ffff0000086a1114>] bus_add_driver+0x1c0/0x224 [ 1.208619] [<ffff0000086a26ec>] driver_register+0x68/0x108 [ 1.214178] [<ffff0000086a36ac>] __platform_driver_register+0x4c/0x54 [ 1.220614] [<ffff0000093d14fc>] imx_rpmsg_init+0x1c/0x50 [ 1.225999] [<ffff000008084144>] do_one_initcall+0x38/0x124 [ 1.231560] [<ffff000009370d28>] kernel_init_freeable+0x18c/0x228 [ 1.237640] [<ffff000008d51b60>] kernel_init+0x10/0x100 [ 1.242849] [<ffff000008085348>] ret_from_fork+0x10/0x18 [ 1.248154] ---[ end trace bcc95d4e07033434 ]--- Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com> Suggested-and-reviewed-by: Jason Liu <jason.hui.liu@nxp.com> Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-02-12MLK-20446 rpmsg: imx: only use the timeout by the first notifyRichard Zhu
To make sure that the message wound't be discarded when M4 is running normally or in the suspend mode. Only use the timeout mechanism by the first notify when the vdev is registered. Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
2019-02-12MLK-19864 rpmsg: imx: fix the kernel panic during tty rpmsg demoRichard Zhu
Fix the kernel panic during tty rpmsg str echo demo. Root cause: The driver name may be flushed. Use the kasprintf to setup the rpmsg tty driver name to fix this issue. [ 35.494361] Unable to handle kernel paging request at virtual address ffff000021b4ba40 [ 35.502321] Mem abort info: [ 35.505117] Exception class = DABT (current EL), IL = 32 bits [ 35.511099] SET = 0, FnV = 0 [ 35.514188] EA = 0, S1PTW = 0 [ 35.517328] Data abort info: [ 35.520255] ISV = 0, ISS = 0x00000007 [ 35.524130] CM = 0, WnR = 0 [ 35.527140] swapper pgtable: 4k pages, 48-bit VAs, pgd = ffff0000096dd000 [ 35.533964] [ffff000021b4ba40] *pgd=000000097fffe803, *pud=000000097fffd803, *pmd=0000000973d20003, *pte=0000000000000000 [ 35.544976] Internal error: Oops: 96000007 [#1] PREEMPT SMP [ 35.550553] Modules linked in: imx_rpmsg_tty [ 35.554843] CPU: 2 PID: 3911 Comm: sh Not tainted 4.14.62-05098-gcff652e-dirty #41 [ 35.562419] Hardware name: Freescale i.MX8QM MEK (DT) [ 35.567479] task: ffff8008f3950000 task.stack: ffff000021b10000 [ 35.573413] PC is at string+0x28/0x98 [ 35.577080] LR is at vsnprintf+0x3c0/0x688 [ 35.581177] pc : [<ffff000008d5f1a0>] lr : [<ffff000008d61c70>] pstate: a0000145 [ 35.588577] sp : ffff000021b13970 [ 35.591894] x29: ffff000021b13970 x28: ffff80097365f56f [ 35.597219] x27: ffff0000092cf03a x26: ffff0000092cf03a [ 35.602544] x25: ffff000021b13a80 x24: ffff8008f365f570 [ 35.607869] x23: 00000000ffffffd8 x22: ffff000008fc08dc [ 35.613195] x21: 000000007fffffff x20: ffff000008fc08cc [ 35.618512] x19: ffff8008f365f570 x18: 0000000000000000 [ 35.623827] x17: 0000ffffbec93588 x16: ffff00000820b2c0 [ 35.629144] x15: 0000000000000000 x14: ffffffffffffffff [ 35.634461] x13: 0000000000000018 x12: 0101010101010101 [ 35.639777] x11: 0000000000000000 x10: ffff000021b13a80 [ 35.645085] x9 : ffff000021b13a80 x8 : ffff000021b13a80 [ 35.650402] x7 : ffff8008f365f570 x6 : fffffffffffffffe [ 35.655718] x5 : 00000000ffffffd0 x4 : ffff000021b4ba40 [ 35.661035] x3 : ffff0a00ffffff04 x2 : ffff80097365f56f [ 35.666354] x1 : ffff80097365f56f x0 : ffffffffffffffff [ 35.671672] Process sh (pid: 3911, stack limit = 0xffff000021b10000) [ 35.678022] Call trace: [ 35.680465] Exception stack(0xffff000021b13830 to 0xffff000021b13970) [ 35.686911] 3820: ffffffffffffffff ffff80097365f56f [ 35.694748] 3840: ffff80097365f56f ffff0a00ffffff04 ffff000021b4ba40 00000000ffffffd0 [ 35.702581] 3860: fffffffffffffffe ffff8008f365f570 ffff000021b13a80 ffff000021b13a80 [ 35.710409] 3880: ffff000021b13a80 0000000000000000 0101010101010101 0000000000000018 [ 35.718245] 38a0: ffffffffffffffff 0000000000000000 ffff00000820b2c0 0000ffffbec93588 [ 35.726081] 38c0: 0000000000000000 ffff8008f365f570 ffff000008fc08cc 000000007fffffff [ 35.733908] 38e0: ffff000008fc08dc 00000000ffffffd8 ffff8008f365f570 ffff000021b13a80 [ 35.741744] 3900: ffff0000092cf03a ffff0000092cf03a ffff80097365f56f ffff000021b13970 [ 35.749583] 3920: ffff000008d61c70 ffff000021b13970 ffff000008d5f1a0 00000000a0000145 [ 35.757417] 3940: ffff8008fff5fb00 0000000000001c00 0000ffffffffffff ffff000008d61930 [ 35.765254] 3960: ffff000021b13970 ffff000008d5f1a0 [ 35.770129] [<ffff000008d5f1a0>] string+0x28/0x98 [ 35.774837] [<ffff000008d61c70>] vsnprintf+0x3c0/0x688 [ 35.779980] [<ffff000008d620e4>] sprintf+0x4c/0x58 Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com> Reviewed-by: Fugang Duan <fugang.duan@nxp.com>
2019-02-12MLK-19588-1 imx: rpmsg: use timeout for MU_SendMessage functionRichard Zhu
- Add the timeout mu msg send api. - Use the timeout mu send message function to do the notification when multi-vdev is enabled on one channel. Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
2019-02-12MLK-18660-4 rpmsg: imx: add the pm opsRichard Zhu
Add the power management operations into imx rpmsg driver. Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
2019-02-12MLK-18308-1: rpmsg: imx_rpmsg: initialize spinlock before usingRobin Gong
Initialize spinlock before using, otherwise the below oops triggered if CONFIG_DEBUG_SPINLOCK enabled. BUG: spinlock bad magic on CPU#0, kthreadd/2 lock: imx_rpmsg_vprocs+0x1240/0x24a0, .magic: 00000000, .owner: <none>/-1, .ow0 CPU: 0 PID: 2 Comm: kthreadd Not tainted 4.9.88-04946-gf984c92 #324 Hardware name: Freescale i.MX7ULP (Device Tree) [<8010ea64>] (unwind_backtrace) from [<8010b184>] (show_stack+0x10/0x14) [<8010b184>] (show_stack) from [<803c3a8c>] (dump_stack+0x78/0x8c) [<803c3a8c>] (dump_stack) from [<8016a744>] (do_raw_spin_lock+0xc4/0x120) [<8016a744>] (do_raw_spin_lock) from [<809f7448>] (_raw_spin_lock_irqsave+0x20/) [<809f7448>] (_raw_spin_lock_irqsave) from [<807bcdc8>] (imx_mu_rpmsg_isr+0x38/) [<807bcdc8>] (imx_mu_rpmsg_isr) from [<801722d8>] (__handle_irq_event_percpu+0x) [<801722d8>] (__handle_irq_event_percpu) from [<8017237c>] (handle_irq_event_pe) [<8017237c>] (handle_irq_event_percpu) from [<801723f0>] (handle_irq_event+0x38) [<801723f0>] (handle_irq_event) from [<801757f4>] (handle_fasteoi_irq+0xd0/0x1a) [<801757f4>] (handle_fasteoi_irq) from [<80171594>] (generic_handle_irq+0x24/0x) [<80171594>] (generic_handle_irq) from [<80171abc>] (__handle_domain_irq+0x7c/0) [<80171abc>] (__handle_domain_irq) from [<801014e8>] (gic_handle_irq+0x48/0x8c) [<801014e8>] (gic_handle_irq) from [<8010bb8c>] (__irq_svc+0x6c/0xa8) Signed-off-by: Robin Gong <yibin.gong@nxp.com>
2019-02-12MLK-18113: rpmsg: virtio_rpmsg_bus: fix rpmsg_probe() for virtio-mmio transportAnup Patel
This patch was cherry picked from https://patchwork.kernel.org/patch/10155143/ When virtio-rpmsg device is provided via virtio-mmio transport, the dma_alloc_coherent() (called by rpmsg_probe()) fails on ARM/ARM64 systems because "vdev->dev.parent->parent" device is used as parameter to dma_alloc_coherent(). The "vdev->dev.parent->parent" device represents underlying remoteproc platform device when virtio-rpmsg device is provided via virtio-remoteproc transport. When virtio-rpmsg device is provided via virtio-mmio transport, the "vdev->dev.parent->parent" device represents the parent device of virtio-mmio platform device and dma_alloc_coherent() fails for this device because generally there is no corresponding platform device and dma_ops are not setup for "vdev->dev.parent->parent". This patch fixes dma_alloc_coherent() usage in rpmsg_probe() by trying dma_alloc_coherent() with "vdev->dev.parent" device when it fails with "vdev->dev.parent->parent" device. Fixes: b5ab5e24e960 ("remoteproc: maintain a generic child device for Signed-off-by: Anup Patel <anup@brainfault.org> Signed-off-by: Adriana Reus <adriana.reus@nxp.com>
2019-02-12MLK-17837-01 input: misc: rpmsg_input: add rpmsg virtual sensor driverFugang Duan
NXP i.MX7ULP EVK boards all sensors connect with M4 core, A core has to conmunicate with sensors by virtual io bus like rpmsg bus. The driver implement the virtual sensor input driver to configure sensors active/idle/delay actions and report the sensors' event to user space. Supply below sysfs for user to enable/disable detector and counter, set poll delay: /sys/class/misc/step_counter/enable /sys/class/misc/step_detector/enable /sys/class/misc/step_counter/poll_delay Reviewed-by: Elven Wang <elven.wang@nxp.com> Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-02-12MLK-16595 rpmsg: imx: enable multi-core string demoRichard Zhu
Because that there are two M4 cores on iMX8QM. Enable the multi-core string echo support. BuildInfo: - SCFW a6fd9a48, IMX-MKIMAGE 0, ATF 0 - U-Boot 2017.03-imx_v2017.03_4.9.11_imx8_alpha+g258936c Reviewed-by: Frank Li <frank.li@nxp.com> Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
2019-02-12MLK-16586-3 rpmsg: imx: enable multi-core rpmsgRichard Zhu
- Init multi-core mu power and clk. - enable the multi-core rpmsg support BuildInfo: - SCFW a6fd9a48, IMX-MKIMAGE 0, ATF 0 - U-Boot 2017.03-imx_v2017.03_4.9.11_imx8_alpha+g258936c Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com> Reviewed-by: Robin Gong <yibin.gong@nxp.com> Tested-by: Andy Duan <fugang.duan@nxp.com>
2019-02-12MLK-16564-01 gpio: imx-rpmsg: add rpmsg virtual gpio driverFugang Duan
Add rpmsg virtual gpio driver support. i.MX7ULP GPIO PTA and PTB resource are managed by M4 core, setup one simple protocol with M4 core based on RPMSG virtual IO to let A core access such GPIOs that is what the driver do. Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com> Reviewed-by: Robin Gong <yibin.gong@nxp.com> Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
2019-02-12MLK-16530-3 rpmsg: imx: init mu and limit the pingpong cyclesRichard Zhu
- Init mu power and clk. - Change the cycles of the pingpong demot refer to the limitation of M4 side. When the received data larger than 100, the pingpong of M4 side would be finished. BuildInfo: SCFW 9e9f6ec6, IMX-MKIMAGE 0, ATF 0 Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
2019-02-12MLK-16371-2 rpmsg: imx: add the rpmsg for imx8qxpRichard Zhu
Add rpmsg support for imx8qxp. The pingpong demo had been verified on 8qxp platforms. Use memset_io replace memset, because that the memory type of rpvq->addr is strong order type. There would be kernel dump when memset is used on imx8qxp. Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
2019-02-12MLK-16114: RPMSG: Fixed ulp can't boot after e12586Frank Li
Need call MU_Init before call other function Signed-off-by: Frank Li <Frank.Li@nxp.com> Signed-off-by: Shenwei Wang <shenwei.wang@nxp.com>
2019-02-12MLK-14659 rpmsg: imx: tty: restore support for imx7dOctavian Purdila
Commit 2a596c353234 ("MLK-13981-2 rpmsg: imx: enable rpmsg virt tty") enabled support for imx7ulp but it broke support for imx7d since the currently distributed M4 image for imx7d still uses the old "rpmsg-openamp-demo-channel" naming. While we could change the channel name in the M4 image it is better to maintain backwards compatibility, so add the old naming back to the id table. Signed-off-by: Octavian Purdila <octavian.purdila@nxp.com>
2019-02-12MLK-14619 input: keyboard: rpmsg-keys: add rpmsg-keys driverRobin Gong
Add rpmsg-keys driver on i.mx7ulp-evk board since vol+/vol- keys are connected on m4 side and have to get the status of keys by rpmsg. Signed-off-by: Robin Gong <yibin.gong@nxp.com> [Irina: updated for 4.9 APIs] Signed-off-by: Irina Tirdea <irina.tirdea@nxp.com>
2019-02-12MLK-14487-2 rpmsg: imx: validate the rpmsg on imx7ulpRichard Zhu
- add the .data into the imx_rpmsg_dt_ids table, thus the driver can distinguish the different platforms. Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com> Tested-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-02-12MLK-14487-1 rpmsg: imx: validate the rpmsg on imx7ulpRichard Zhu
- change the module_init to subsys_initcall. Otherwise, the pf1550-rpmsg would be invoked before the rpmsg bus driver on imx7ulp. Then, sdhc wouldn't be powered up properly if pf1550 isn't functional. - remove the no longer used imc_rpmsg_exit. - pass the real device id if the shared irq is requested. Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com> Tested-by: Daniel Baluta <daniel.baluta@nxp.com>
2019-02-12MLK-14439-3 rpmsg: imx: setup the imx rpmsg driverRichard Zhu
- move imx_rpmsg from arch/arm/ to drivers/rpmsg. - use the new MU generic APIs in the rpmsg implementation. - Validated the pingpong test on both imx6sx and imx7d sdb boards. Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
2019-02-12MLK-13981-2 rpmsg: imx: enable rpmsg virt ttyRichard Zhu
Message can be transferred between remote device and iMX7ULP M4. Then the message can be transferred between A7 and M4 by rpmsg channel. demo howto: - insmode the imx_rpmsg_tty.ko module after login A7/Linux. - Receive messages. Used the following command to dump out the msg from the virtual tty. ./unit_tests/mxc_mcc_tty_test.out /dev/ttyRPMSG 115200 R 100 1000 & - Send: use the following command to send the message to M4. echo <your string message> /dev/ttyRPMSG Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
2019-02-12MLK-12265 rpmsg: imx: set the imx rpmsg tests be moduleRichard Zhu
Set the imx rpmsg tests to be module in defaut. Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com> (cherry picked from commit 20adce35ef6abfd6b0a52207febe069c7f09a1be)
2019-02-12MLK-11498 rpmsg: imx: tell remote process about the channelRichard Zhu
send a message to our remote processor, and tell remote processor about this channel Signed-off-by: Richard Zhu <Richard.Zhu@freescale.com> (cherry picked from commit 2708c004a60c5b6da020803ee9291b83984d4a65)
2019-02-12MLK-11286-3 rpmsg: imx: enable rpmsg tests on imxRichard Zhu
enable the rpmsg pingpong and tty string echo tests on imx amp socs - pingpong test howto insmod imx_rpmsg_pingpong.ko - tty string echo test howto - step 1, load the imx_rpmsg_tty.ko insmod imx_rpmsg_tty.ko - step 2, lanunch the mxc_mcc_tty_test.out in backend ./mxc_mcc_tty_test.out /dev/ttyRPMSG 115200 R 512 512 & - step 3, issue the echo command echo <string> > /dev/ttyRPMSG Signed-off-by: Richard Zhu <Richard.Zhu@freescale.com>
2018-11-13rpmsg: smd: fix memory leak on channel createColin Ian King
commit 940c620d6af8fca7d115de40f19870fba415efac upstream. 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 <colin.king@canonical.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-09-29Revert "rpmsg: core: add support to power domains for devices"Greg Kroah-Hartman
This reverts commit 1ed3a93072307265d6385031b72929a904b50f87 which is commit fe782affd0f440a4e60e2cc81b8f2eccb2923113 upstream Rafael reports that this patch causes problems: > -rc2 looks good. There is a problem on dragonboard during boot that was > introduced in v4.14.71 that I didn't notice last week. We'll bisect it > and report back later this week. dragonboard on the other branches (4.9, > 4.18, mainline) looks fine. As Dan pointed out, during validation, we have bisected this issue on a dragonboard 410c (can't find root device) to the following commit for v4.14: [1ed3a9307230] rpmsg: core: add support to power domains for devices There is an on-going discussion on "[PATCH] rpmsg: core: add support to power domains for devices" about this patch having other dependencies and breaking something else on v4.14 as well. so drop it. Reported-by: Rafael Tinoco <rafael.tinoco@linaro.org> Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Cc: Bjorn Andersson <bjorn.andersson@linaro.org> Cc: Sasha Levin <alexander.levin@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>