aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rpmsg/virtio_rpmsg_bus.c
AgeCommit message (Collapse)Author
2024-03-28Merge branch 'v5.4/standard/base' into v5.4/standard/ti-j72xBruce Ashfield
2024-02-23rpmsg: virtio: Free driver_override when rpmsg_remove()Xiaolei Wang
commit d5362c37e1f8a40096452fc201c30e705750e687 upstream. Free driver_override when rpmsg_remove(), otherwise the following memory leak will occur: unreferenced object 0xffff0000d55d7080 (size 128): comm "kworker/u8:2", pid 56, jiffies 4294893188 (age 214.272s) hex dump (first 32 bytes): 72 70 6d 73 67 5f 6e 73 00 00 00 00 00 00 00 00 rpmsg_ns........ 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ backtrace: [<000000009c94c9c1>] __kmem_cache_alloc_node+0x1f8/0x320 [<000000002300d89b>] __kmalloc_node_track_caller+0x44/0x70 [<00000000228a60c3>] kstrndup+0x4c/0x90 [<0000000077158695>] driver_set_override+0xd0/0x164 [<000000003e9c4ea5>] rpmsg_register_device_override+0x98/0x170 [<000000001c0c89a8>] rpmsg_ns_register_device+0x24/0x30 [<000000008bbf8fa2>] rpmsg_probe+0x2e0/0x3ec [<00000000e65a68df>] virtio_dev_probe+0x1c0/0x280 [<00000000443331cc>] really_probe+0xbc/0x2dc [<00000000391064b1>] __driver_probe_device+0x78/0xe0 [<00000000a41c9a5b>] driver_probe_device+0xd8/0x160 [<000000009c3bd5df>] __device_attach_driver+0xb8/0x140 [<0000000043cd7614>] bus_for_each_drv+0x7c/0xd4 [<000000003b929a36>] __device_attach+0x9c/0x19c [<00000000a94e0ba8>] device_initial_probe+0x14/0x20 [<000000003c999637>] bus_probe_device+0xa0/0xac Signed-off-by: Xiaolei Wang <xiaolei.wang@windriver.com> Fixes: b0b03b811963 ("rpmsg: Release rpmsg devices in backends") Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20231215020049.78750-1-xiaolei.wang@windriver.com Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-12-01rpmsg: fix lockdep warnings in virtio rpmsg bus driverAngela Stegmaier
commit b0f0e6a3be85dfc3ab65041f525f951fd744730f from git://git.ti.com/ti-linux-kernel/ti-linux-kernel.git The virtio rpmsg bus framework uses endpoints as the basis for sending and receiving messages to/from a remote processor. Each rpmsg bus device will have a primary endpoint if the corresponding rpmsg bus driver supports a callback, and secondary child endpoints associated with the same rpmsg bus device. The life-cycle of these endpoints are tied to the corresponding rpmsg device. A virtio rpmsg bus device can also have its own endpoint for supporting name service announcements from a corresponding remote processor to create and delete rpmsg devices dynamically. Each endpoint has a callback lock associated with it to provide protection/mutual exclusion between threads that process incoming rpmsg messages and threads that want to delete the endpoint. The virtio rpmsg name service endpoint callback will run while holding it's ept->cb_lock to create/delete rpmsg devices for RPMSG_NS_CREATE and RPMSG_NS_DELETE messages respectively. The latter message processing will destroy the requested channel, and will ultimately result in all the secondary rpmsg device endpoints also to be destroyed. The ept->cb_lock for the channel's endpoint is also locked during its destruction while setting the callback to NULL. This results in a seemingly nested locking of the ept->cb_lock even though the locking is on different mutexes. This will result in a false warning from the lockdep validator when it is enabled because the lockdep deals with classes and both are the same class, although they are different instances. Similar circular dependency scenarios also exist with remoteproc error recovery and existing rpmsg drivers - rpmsg_rpc and rpmsg_proto. These issues are fixed by replacing the existing mutex_lock() calls with the mutex_lock_nested() API variation and using different subclasses for the NameService end-point and for the rpmsg channel device end-points. Following are example warning signatures that get fixed by this patch: 1. Recursive locking dependency during RPMSG_NS_DESTROY message processing ============================================= WARNING: possible recursive locking detected Signed-off-by: Xulin Sun <xulin.sun@windriver.com> --------------------------------------------- kworker/0:0/1069 is trying to acquire lock: e37914c0 (&ept->cb_lock){+.+.}, at: __rpmsg_destroy_ept+0x40/0x6c [virtio_rpmsg_bus] but task is already holding lock: e3d14bc0 (&ept->cb_lock){+.+.}, at: rpmsg_recv_done+0x6c/0x34c [virtio_rpmsg_bus] other info that might help us debug this: Possible unsafe locking scenario: CPU0 ---- lock(&ept->cb_lock); lock(&ept->cb_lock); *** DEADLOCK *** May be due to missing lock nesting notatio 4 locks held by kworker/0:0/1069: #0: e700b6a0 ((wq_completion)events){+.+.}, at: process_one_work+0x1f4/0x824 #1: e2175f24 ((work_completion)(&mq->work)){+.+.}, at: process_one_work+0x1f4/0x824 #2: e3d14bc0 (&ept->cb_lock){+.+.}, at: rpmsg_recv_done+0x6c/0x34c [virtio_rpmsg_bus] #3: e335e0bc (&dev->mutex){....}, at: device_release_driver_internal+0x18/0x1bc 2. Circular locking dependency during error recovery of rpmsg-rpc driver ====================================================== WARNING: possible circular locking dependency detected ------------------------------------------------------- kworker/0:4/1068 is trying to acquire lock: e3e2b2c0 (&ept->cb_lock){+.+.}, at: __rpmsg_destroy_ept+0x40/0x6c [virtio_rpmsg_bus] but task is already holding lock: e4282380 (&rppcdev->lock){+.+.}, at: rppc_remove+0x88/0x238 [rpmsg_rpc] which lock already depends on the new lock. other info that might help us debug this: Chain exists of: &ept->cb_lock --> rppc_devices_lock --> &rppcdev->lock Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&rppcdev->lock); lock(rppc_devices_lock); lock(&rppcdev->lock); lock(&ept->cb_lock); *** DEADLOCK *** 7 locks held by kworker/0:4/1068: #0: e700b6a0 ((wq_completion)events){+.+.}, at: process_one_work+0x1f4/0x824 #1: e2289f24 ((work_completion)(&rproc->crash_handler)){+.+.}, at: process_one_work+0x1f4/0x824 #2: e47ebb1c (&rproc->lock){+.+.}, at: rproc_trigger_recovery+0x44/0x460 #3: e3e064e4 (&dev->mutex){....}, at: device_release_driver_internal+0x18/0x1bc #4: e37bd4bc (&dev->mutex){....}, at: device_release_driver_internal+0x18/0x1bc #5: bf019034 (rppc_devices_lock){+.+.}, at: rppc_remove+0x3c/0x238 [rpmsg_rpc] #6: e4282380 (&rppcdev->lock){+.+.}, at: rppc_remove+0x88/0x238 [rpmsg_rpc] 3. Circular locking dependency during error recovery of rpmsg-proto driver ====================================================== WARNING: possible circular locking dependency detected ------------------------------------------------------- kworker/0:1/21 is trying to acquire lock: e47869c0 (&ept->cb_lock){+.+.}, at: __rpmsg_destroy_ept+0x40/0x6c [virtio_rpmsg_bus] but task is already holding lock: bf027034 (rpmsg_channels_lock){+.+.}, at: rpmsg_proto_remove+0x28/0x16c [rpmsg_proto] which lock already depends on the new lock. other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(rpmsg_channels_lock); lock(&ept->cb_lock); lock(rpmsg_channels_lock); lock(&ept->cb_lock); *** DEADLOCK *** 6 locks held by kworker/0:1/21: #0: e700b6a0 ((wq_completion)events){+.+.}, at: process_one_work+0x1f4/0x824 #1: e6057f24 ((work_completion)(&rproc->crash_handler)){+.+.}, at: process_one_work+0x1f4/0x824 #2: e3884b1c (&rproc->lock){+.+.}, at: rproc_trigger_recovery+0x44/0x460 #3: e20a88e4 (&dev->mutex){....}, at: device_release_driver_internal+0x18/0x1bc #4: e39ae0bc (&dev->mutex){....}, at: device_release_driver_internal+0x18/0x1bc #5: bf027034 (rpmsg_channels_lock){+.+.}, at: rpmsg_proto_remove+0x28/0x16c [rpmsg_proto] Signed-off-by: Angela Stegmaier <angelabaker@ti.com> [s-anna@ti.com: flip the subclass values, update crash log examples for 5.4] Signed-off-by: Suman Anna <s-anna@ti.com>
2020-12-01HACK: rpmsg: virtio_rpmsg_bus: fix up vring buffer logic for TI Keystone SoCsSuman Anna
commit e3eeb6891cd274d7fddd4590417baf34f7c1d6f0 from git://git.ti.com/ti-linux-kernel/ti-linux-kernel.git The virtio rpmsg logic is always based on publishing the physical vring buffers in the vring control structures to expose them to the remote processor side. Commit 9dd87c2af651 ("rpmsg: virtio_rpmsg_bus: fix sg_set_buf() when addr is not a valid kernel address") has fixed up this logic to scale for the case with the virtio rpmsg buffers were allocated from either a HighMem region or a dedicated carveout (mapped into kernel in vmalloc space). The fix initialized the sg_table with appropriate page address which is translated back to a dma_addr_t using sg_phys() call in virtqueue_add() (in vring_map_one_sg()) function. This fix was sufficient for SoCs where both the host and the remote processors used 32-bit addressing scheme. This logic failed for TI Keystone platforms though, which have a 36-bit physical address and only a regular 32-bit dma address (the first 2 GB of RAM at 0x800000000 is aliased at 0x80000000) due to the truncation of the physical address. Furthermore, the remote processors on these SoCs leverage the 32-bit aliased address for referencing the IPC shared memory buffers. Fix this issue and make the virtio rpmsg stack functional on these platforms by initializing the sg entry with the page address corresponding to the dma address of the vring buffer instead of it's physical address. This solution allows the core virtio_ring code to remain unchanged, and results in publishing the desired aliased addresses in the vring control structures. Signed-off-by: Suman Anna <s-anna@ti.com> Signed-off-by: Xulin Sun <xulin.sun@windriver.com>
2020-12-01rpmsg: core: add API to get MTUArnaud Pouliquen
commit da4efc56734e97e4f01f8a4b39ed95735667cfa3 from git://git.ti.com/ti-linux-kernel/ti-linux-kernel.git Return the rpmsg buffer MTU for sending message, so rpmsg users can split a long message in several sub rpmsg buffers. Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com> [s-anna@ti.com: cherry-pick https://patchwork.kernel.org/patch/11242365/] Signed-off-by: Suman Anna <s-anna@ti.com> Signed-off-by: Xulin Sun <xulin.sun@windriver.com>
2020-12-01rpmsg: add a description fieldOhad Ben-Cohen
commit 5fce9a5039712562848b2a9f5134e76866e02d55 from git://git.ti.com/ti-linux-kernel/ti-linux-kernel.git Add a new description field to the rpmsg bus infrastructure that can be passed onto the rpmsg client drivers for additional information. The current rpmsg bus client drivers need to have a fixed id_table for proper matching, this new field can allow flexibility for the client drivers (eg: like creating unique cdevs). The description field is published through an enhanced name service announcement message structure. The name service message processing logic is updated to maintain backward compatibility with the previous message structure. Based on an initial patch from Ohad Ben-Cohen. Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com> [s-anna@ti.com: forward port, add sysfs documentation, fixup qcom drivers] [s-anna@ti.com: cherry-pick https://patchwork.kernel.org/patch/11096599/ ] Signed-off-by: Suman Anna <s-anna@ti.com> [t-kristo@ti.com: reworked to support both rpmsg with/without the desc field] Signed-off-by: Tero Kristo <t-kristo@ti.com> Signed-off-by: Xulin Sun <xulin.sun@windriver.com>
2019-08-27rpmsg: virtio_rpmsg_bus: replace "%p" with "%pK"Suman Anna
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 <s-anna@ti.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2019-02-20rpmsg: virtio: change header file sort styleLoic Pallardy
Make header files alphabetical order. Signed-off-by: Loic Pallardy <loic.pallardy@st.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2019-02-20rpmsg: virtio: allocate buffer from parentLoic Pallardy
Remoteproc is now capable to create one specific sub-device per virtio link to associate a dedicated memory pool. This implies to change device used by virtio_rpmsg for buffer allocation from grand-parent to parent. Signed-off-by: Loic Pallardy <loic.pallardy@st.com> Reviewed-by: Anup Patel <anup@brainfault.org> Tested-by: Anup Patel <anup@brainfault.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-06-03rpmsg: virtio_rpmsg_bus: Switch to SPDX license identifierSuman Anna
Use the appropriate SPDX license identifier in the virtio rpmsg bus driver source file and drop the previous boilerplate license text. Signed-off-by: Suman Anna <s-anna@ti.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-08-24rpmsg: virtio_rpmsg_bus: fix sg_set_buf() when addr is not a valid kernel ↵Loic Pallardy
address To specify memory for remoteproc, we declare (dma_declare_coherent_memory()) an area which is ioremap'ed to the vmalloc area. However, this address is not a kernel address so virt_addr_valid(buf) fails. Signed-off-by: Ludovic Barre <ludovic.barre@st.com> Signed-off-by: Loic Pallardy <loic.pallardy@st.com> Acked-by: Patrice Chotard <patrice.chotard@st.com> Tested-by: Suman Anna <s-anna@ti.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-08-24rpmsg: virtio_rpmsg: set rpmsg_buf_size customizableLoic Pallardy
Rpmsg buffer size is currently fixed to 512 bytes. This patch introduces a new capability in struct virtproc_info to tune shared buffer size between host and coprocessor according to the needs. Acked-by: Suman Anna <s-anna@ti.com> Signed-off-by: Loic Pallardy <loic.pallardy@st.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-07-26rpmsg: virtio_rpmsg_bus: fix export of rpmsg_send_offchannel_raw()Suman Anna
Commit 8a228ecfe086b ("rpmsg: Indirection table for rpmsg_endpoint operations") has made the rpmsg_send_offchannel_raw() a static function and local to the virtio_rpmsg_bus module, but has not dropped the corresponding EXPORT_SYMBOL. Fix this. Signed-off-by: Suman Anna <s-anna@ti.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-06-25rpmsg: virtio_rpmsg_bus: cleanup multiple assignment to opsHenri Roosen
Trivial cleanup: the .ops pointer is assigned twice. This patch removes the first assignment. Acked-by: Suman Anna <s-anna@ti.com> Signed-off-by: Henri Roosen <henri.roosen@ginzinger.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-06-25rpmsg: virtio_rpmsg_bus: fix nameservice addressHenri Roosen
Commit 2a48d7322dc8 ("rpmsg: rpmsg_send() operations takes rpmsg_endpoint") only changed the nameservice address for virtio_rpmsg_announce_create() but did not do the same change for virtio_rpmsg_announce_destroy(). Signed-off-by: Henri Roosen <henri.roosen@ginzinger.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-06-25rpmsg: virtio_rpmsg_bus: fix announce for devices without endpointHenri Roosen
A device might not have an endpoint assigned. This patch checks if rpdev->ept has a value before dereferencing or using it. Signed-off-by: Henri Roosen <henri.roosen@ginzinger.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-05-17rpmsg: Release rpmsg devices in backendsBjorn Andersson
The rpmsg devices are allocated in the backends and as such must be freed there as well. Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-05-02virtio: wrap find_vqsMichael S. Tsirkin
We are going to add more parameters to find_vqs, let's wrap the call so we don't need to tweak all drivers every time. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2017-02-27virtio: allow drivers to request IRQ affinity when creating VQsChristoph Hellwig
Add a struct irq_affinity pointer to the find_vqs methods, which if set is used to tell the PCI layer to create the MSI-X vectors for our I/O virtqueues with the proper affinity from the start. Compared to after the fact affinity hints this gives us an instantly working setup and allows to allocate the irq descritors node-local and avoid interconnect traffic. Last but not least this will allow blk-mq queues are created based on the interrupt affinity for storage drivers. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Jason Wang <jasowang@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2016-09-08rpmsg: Allow callback to return errorsBjorn Andersson
Some rpmsg backends support holding on to and redelivering messages upon failed handling of them, so provide a way for the callback to report and error and allow the backends to handle this. Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-09-08rpmsg: Move virtio specifics from public headerBjorn Andersson
Move virtio rpmsg implementation details from the public header file to the virtio rpmsg implementation. Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-09-08rpmsg: virtio: Hide vrp pointer from the public APIBjorn Andersson
Create a container struct virtio_rpmsg_channel around the rpmsg_channel to keep virtio backend information separate from the rpmsg and public API. This makes the public structures independant of virtio. Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-09-08rpmsg: Split rpmsg core and virtio backendBjorn Andersson
Extract the generic rpmsg core functionality from the virtio rpmsg implementation, splitting the implementation in a rpmsg core and a virtio backend. Based on initial work by Sricharan R <sricharan@codeaurora.org> Cc: Sricharan R <sricharan@codeaurora.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-09-08rpmsg: Split off generic tail of create_channel()Bjorn Andersson
The tail of create_channel() is common among all rpmsg backends, so split it off from the virtio specific part to allow it to be extracted to the rpmsg core. Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-09-08rpmsg: Move helper for finding rpmsg devices to coreBjorn Andersson
Extract and move the helper function for finding rpmsg child devices to the core. Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-09-08rpmsg: Move endpoint related interface to rpmsg coreBjorn Andersson
Move the rpmsg_send() and rpmsg_destroy_ept() interface to the rpmsg core, so that we eventually can hide the rpmsg_endpoint ops from the public API. Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-09-08rpmsg: Indirection table for rpmsg_endpoint operationsBjorn Andersson
Add indirection table for rpmsg_endpoint related operations and move virtio implementation behind this, this finishes of the decoupling of the virtio implementation from the public API. Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-09-08rpmsg: Move rpmsg_device API to new fileBjorn Andersson
Extract the now indirect rpmsg_create_ept() interface to a separate file and start building up a rpmsg core. Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-09-08rpmsg: Introduce indirection table for rpmsg_device operationsBjorn Andersson
To allow for multiple backend implementations add an indireection table for rpmsg_device related operations and move the virtio implementation behind this table. Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-09-08rpmsg: Clean up rpmsg device vs channel namingBjorn Andersson
The rpmsg device representing struct is called rpmsg_channel and the variable name used throughout is rpdev, with the communication happening on endpoints it's clearer to just call this a "device" in a public API. Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-09-08rpmsg: Make rpmsg_create_ept() take channel_info structBjorn Andersson
As we introduce support for additional rpmsg backends, some of these only supports point-to-point "links" represented by a name. By making rpmsg_create_ept() take a channel_info struct we allow for these backends to either be passed a source address, a destination address or a name identifier. Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-09-08rpmsg: rpmsg_send() operations takes rpmsg_endpointBjorn Andersson
The rpmsg_send() operations has been taking a rpmsg_device, but this forces users of secondary rpmsg_endpoints to use the rpmsg_sendto() interface - by extracting source and destination from the given data structures. If we instead pass the rpmsg_endpoint to these functions a service can use rpmsg_sendto() to respond to messages, even on secondary endpoints. In addition this would allow us to support operations on multiple channels in future backends that does not support off-channel operations. Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-09-08rpmsg: Name rpmsg devices based on channel idBjorn Andersson
By basing rpmsg device names on channel id we end up with human readable device names in sysfs and debug logs. Reviewed-by: Sarangdhar Joshi <spjoshi@codeaurora.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-09-08rpmsg: Enable matching devices with drivers based on DTBjorn Andersson
Make it possible to match rpmsg devices based on device tree node, in addition to the id table. In some of these cases the rpmsg driver would not have a id_table, so make this optional. Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-08-12rpmsg: use dynamic_hex_dump for hex dump tracesAnna, Suman
There are couple of print_hex_dump traces used in rpmsg code which prints the actual byte messages being transferred between host and the remote processors. These traces are quiet verbose and affects performance, if the appropriate trace level is enabled. These hex dumps are needed rather rarely, but are quite useful when debugging complex IPC corner cases. So, this patch switches these hex dump traces to use the dynamic_hex_dump() API. The hex dump traces are also enabled only when CONFIG_DYNAMIC_DEBUG is enabled. This switch allows flexibility of controlling these traces through dynamic debug, instead of removing them completely. Signed-off-by: Suman Anna <s-anna@ti.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-08-12rpmsg: align code with open parenthesisAnna, Suman
This patch fixes most of the existing alignment checkpatch check warnings of the type "Alignment should match open parenthesis" in the virtio rpmsg bus code. A couple of them have been left as is to not exceed the 80-char limit. Signed-off-by: Suman Anna <s-anna@ti.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-08-12rpmsg: use proper format-specifier for printing dma_addr_tAnna, Suman
The dma_addr_t types can be printed properly using the %pad printk format-specifier, there is no need to resort to the unsigned long long type-casting to deal with different possible type sizes. Signed-off-by: Suman Anna <s-anna@ti.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-08-12rpmsg: remove pointless OOM printsAnna, Suman
These types of error prints are superfluous. The system will pick up on OOM issues and let the user know. While at this, fix the usage of using a structure instead of the actual variable in one of the allocations. Signed-off-by: Suman Anna <s-anna@ti.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-08-12rpmsg: virtio_rpmsg_bus: Fix randomly placed semi-colonLee Jones
It should never have been there in the first place. Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-08-10rpmsg: remove unneeded conversions to boolAndrew F. Davis
Found with scripts/coccinelle/misc/boolconv.cocci. Signed-off-by: Andrew F. Davis <afd@ti.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-05-06rpmsg: add THIS_MODULE to rpmsg_driver in rpmsg coreAndrew F. Davis
Add register_rpmsg_driver helper macro that adds THIS_MODULE to rpmsg_driver for the registering driver. We rename and modify the existing register_rpmsg_driver to enable this. Signed-off-by: Andrew F. Davis <afd@ti.com> Acked-by: Suman Anna <s-anna@ti.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-01-12virtio: make find_vqs() checkpatch.pl-friendlyStefan Hajnoczi
checkpatch.pl wants arrays of strings declared as follows: static const char * const names[] = { "vq-1", "vq-2", "vq-3" }; Currently the find_vqs() function takes a const char *names[] argument so passing checkpatch.pl's const char * const names[] results in a compiler error due to losing the second const. This patch adjusts the find_vqs() prototype and updates all virtio transports. This makes it possible for virtio_balloon.c, virtio_input.c, virtgpu_kms.c, and virtio_rpmsg_bus.c to use the checkpatch.pl-friendly type. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Acked-by: Bjorn Andersson <bjorn.andersson@sonymobile.com>
2015-03-13virtio_rpmsg: set DRIVER_OK before using deviceMichael S. Tsirkin
virtio spec requires that all drivers set DRIVER_OK before using devices. While rpmsg isn't yet included in the virtio 1 spec, previous spec versions also required this. virtio rpmsg violates this rule: is calls kick before setting DRIVER_OK. The fix isn't trivial since simply calling virtio_device_ready earlier would mean we might get an interrupt in parallel with adding buffers. Instead, split kick out to prepare+notify calls. prepare before virtio_device_ready - when we know we won't get interrupts. notify right afterwards. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Acked-by: Ohad Ben-Cohen <ohad@wizery.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2014-11-26rpmsg: use less buffers when vrings are smallSuman Anna
Adjust the number of rpmsg buffers to rely on the size of the vring, instead of using the hard coded value of 512 (256 per direction). This is needed when small vrings are being used, where 256 buffers are too much to fit in a vring. While considering the vring size, keep using the 512 hard coded value as an upper limit to avoid wacky resource tables consuming unreasonable amount of memory. NOTE: The number of buffers is already assumed to be symmetrical in each direction, and that logic is unchanged. Signed-off-by: Suman Anna <s-anna@ti.com> [edit commit message, small code and comment simplification] Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2013-05-07Merge tag 'rpmsg-3.10' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/ohad/rpmsg Pull rpmsg changes from Ohad Ben-Cohen: "A small pull request consisting of: - Make rpmsg process all pending messages instead of just one, from Robert Tivy - Fix Kconfig dependency on VIRTUALIZATION, from Suman. Note: this was submitted late during the 3.9 rc cycle and it seemed appropriate to wait with it for the merge window. - Belated addition of an rpmsg entry to the MAINTAINERS file. People seem to look for this" * tag 'rpmsg-3.10' of git://git.kernel.org/pub/scm/linux/kernel/git/ohad/rpmsg: rpmsg: fix kconfig dependencies for VIRTIO MAINTAINERS: add rpmsg entry rpmsg: process _all_ pending messages in rpmsg_recv_done
2013-05-02Merge tag 'virtio-next-for-linus' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux Pull virtio & lguest updates from Rusty Russell: "Lots of virtio work which wasn't quite ready for last merge window. Plus I dived into lguest again, reworking the pagetable code so we can move the switcher page: our fixmaps sometimes take more than 2MB now..." Ugh. Annoying conflicts with the tcm_vhost -> vhost_scsi rename. Hopefully correctly resolved. * tag 'virtio-next-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux: (57 commits) caif_virtio: Remove bouncing email addresses lguest: improve code readability in lg_cpu_start. virtio-net: fill only rx queues which are being used lguest: map Switcher below fixmap. lguest: cache last cpu we ran on. lguest: map Switcher text whenever we allocate a new pagetable. lguest: don't share Switcher PTE pages between guests. lguest: expost switcher_pages array (as lg_switcher_pages). lguest: extract shadow PTE walking / allocating. lguest: make check_gpte et. al return bool. lguest: assume Switcher text is a single page. lguest: rename switcher_page to switcher_pages. lguest: remove RESERVE_MEM constant. lguest: check vaddr not pgd for Switcher protection. lguest: prepare to make SWITCHER_ADDR a variable. virtio: console: replace EMFILE with EBUSY for already-open port virtio-scsi: reset virtqueue affinity when doing cpu hotplug virtio-scsi: introduce multiqueue support virtio-scsi: push vq lock/unlock into virtscsi_vq_done virtio-scsi: pass struct virtio_scsi to virtqueue completion function ...
2013-04-29drivers/rpmsg/virtio_rpmsg_bus.c: fix error return code in rpmsg_probe()Wei Yongjun
Return a negative error code from the error handling case instead of 0, as returned elsewhere in this function. Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Cc: Ohad Ben-Cohen <ohad@wizery.com> Cc: Tejun Heo <tj@kernel.org> Cc: Stephen Boyd <sboyd@codeaurora.org> Cc: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-04-15rpmsg: process _all_ pending messages in rpmsg_recv_doneRobert Tivy
Change virtqueue callback function rpmsg_recv_done() to process all available messages instead of just one message. Signed-off-by: Robert Tivy <rtivy@ti.com> [split _recv function instead of adding indentation] Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
2013-03-20virtio_rpmsg_bus: use simplified virtqueue accessors.Rusty Russell
We never add buffers with input and output parts, so use the new accessors. Cc: Ohad Ben-Cohen <ohad@wizery.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2013-02-27rpmsg: convert to idr_alloc()Tejun Heo
Convert to the much saner new idr interface. Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Ohad Ben-Cohen <ohad@wizery.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>