aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rpmsg/virtio_rpmsg_bus.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2019-08-27rpmsg: virtio_rpmsg_bus: replace "%p" with "%pK"Suman Anna1-1/+1
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 Pallardy1-9/+9
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 Pallardy1-3/+3
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 Anna1-9/+1
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 addressLoic Pallardy1-3/+25
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 Pallardy1-9/+13
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 Anna1-1/+0
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 Roosen1-3/+0
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 Roosen1-1/+1
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 Roosen1-2/+2
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 Andersson1-0/+9
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. Tsirkin1-1/+1
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 Hellwig1-1/+1
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 Andersson1-4/+6
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 Andersson1-0/+52
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 Andersson1-8/+35
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 Andersson1-223/+2
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 Andersson1-3/+15
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 Andersson1-25/+4
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 Andersson1-13/+0
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 Andersson1-3/+82
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 Andersson1-48/+0
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 Andersson1-6/+42
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 Andersson1-21/+21
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 Andersson1-16/+10
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 Andersson1-3/+3
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 Andersson1-10/+2
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 Andersson1-4/+6
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, Suman1-6/+12
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, Suman1-21/+19
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, Suman1-2/+2
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, Suman1-7/+3
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 Jones1-1/+1
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. Davis1-1/+1
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. Davis1-3/+5
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 Hajnoczi1-1/+1
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. Tsirkin1-1/+16
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 Anna1-14/+30
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 git://git.kernel.org/pub/scm/linux/kernel/git/ohad/rpmsgLinus Torvalds1-14/+35
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 git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linuxLinus Torvalds1-4/+4
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 Yongjun1-1/+3
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 Tivy1-14/+35
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 Russell1-4/+4
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 Heo1-18/+12
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>
2013-02-27rpmsg: don't use idr_remove_all()Tejun Heo1-1/+0
idr_destroy() can destroy idr by itself and idr_remove_all() is being deprecated. Drop its usage. 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>
2013-01-29Merge branch 'master' into for-nextJiri Kosina1-6/+4
Conflicts: drivers/devfreq/exynos4_bus.c Sync with Linus' tree to be able to apply patches that are against newer code (mvneta).
2013-01-09treewide: Fix typo in various driversMasanari Iida1-1/+1
Correct spelling typo in printk within various drivers. Signed-off-by: Masanari Iida <standby24x7@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2013-01-03Drivers: misc: remove __dev* attributes.Greg Kroah-Hartman1-2/+2
CONFIG_HOTPLUG is going away as an option. As a result, the __dev* markings need to be removed. This change removes the use of __devinit, __devexit_p, __devinitdata, __devinitconst, and __devexit from these drivers. Based on patches originally written by Bill Pemberton, but redone by me in order to handle some of the coding style issues better, by hand. Cc: Bill Pemberton <wfp5p@virginia.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-12-18virtio: rpmsg: make it clear that virtqueue_add_buf() no longer returns > 0Rusty Russell1-4/+2
We simplified virtqueue_add_buf(), make it clear in the callers. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2012-09-12rpmsg: fix dma_free_coherent dev parameterFernando Guzman Lugo1-3/+3
dma_alloc/free_coherent APIs requires the platform specific remoteproc device as the device parameter. We are passing vdev->dev.parent to the dma_free_coherent function which is the generic rproc device and it is wrong, it has to be vdev->dev.parent->parent instead, same as when we call dma_alloc_coherent function. Signed-off-by: Fernando Guzman Lugo <fernando.lugo@ti.com> Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>