summaryrefslogtreecommitdiff
path: root/drivers/rpmsg
AgeCommit message (Collapse)Author
2017-10-30rpmsg: glink: Initialize the "intent_req_comp" completion variableArun Kumar Neelakantam
The "intent_req_comp" variable is used without initialization which results in NULL pointer dereference in qcom_glink_request_intent(). we need to initialize the completion variable before using it. Fixes: 27b9c5b66b23 ("rpmsg: glink: Request for intents when unavailable") Signed-off-by: Arun Kumar Neelakantam <aneela@codeaurora.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-10-25rpmsg: Allow RPMSG_VIRTIO to be enabled via menuconfig or defconfigAnup Patel
Currently, RPMSG_VIRTIO can only be enabled if some other kconfig option selects it. This does not allow it to be enabled for virtualized systems where Virtio RPMSG is available over Virtio MMIO or PCI transport. This patch updates RPMSG_VIRTIO kconfig option so that we can enable the VirtIO RPMSG driver via menuconfig or defconfig. The patch also removes "select RPMSG_VIRTIO" from various remoteproc kconfig options because it is now user selectable. Signed-off-by: Anup Patel <anup@brainfault.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-10-10rpmsg: glink: Fix memory leak in qcom_glink_alloc_intent()Dan Carpenter
We need to free "intent" and "intent->data" on a couple error paths. Fixes: 933b45da5d1d ("rpmsg: glink: Add support for TX intents") Acked-by: Sricharan R <sricharan@codeaurora.org> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-10-10rpmsg: glink: Unlock on error in qcom_glink_request_intent()Dan Carpenter
If qcom_glink_tx() fails, then we need to unlock before returning the error code. Fixes: 27b9c5b66b23 ("rpmsg: glink: Request for intents when unavailable") Acked-by: Sricharan R <sricharan@codeaurora.org> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-09-04rpmsg: glink: initialize ret to zero to ensure error status check is correctColin Ian King
The new switch cases for RPM_CMD_RX_DONE, RPM_CMD_RX_DONE_W_REUSE, RPM_CMD_RX_INTENT_REQ_ACK, RPM_CMD_INTENT and RPM_CMD_RX_INTENT_REQ from 4 recent commits are not setting ret and so a later non-zero check on ret is testing on a garbage value in ret. Fix this by initializing ret to zero. Detected by CoverityScan CID#1455249 ("Uninitialized scalar variable") Fixes: 933b45da5d1d ("rpmsg: glink: Add support for TX intents) Fixes: dacbb35e930f ("glink: Receive and store the remote intent buffers") Fixes: 27b9c5b66b23 ("rpmsg: glink: Request for intents when unavailable") Fixes: 88c6060f5a7f ("rpmsg: glink: Handle remote rx done command") Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-09-04rpmsg: glink: fix null pointer dereference on a null intentColin Ian King
In the case where glink->intentless is true and the call to qcom_glink_tx fails then we have a condition where ret is non-zero and intent is null, causing a null pointer deference when setting intent->in_use to false. Add an extra check to only dereference intent if intent is non-null. Detected by: CoverityScan CID#1455247 ("Explicit null dereferenced") Fixes: 88c6060f5a7f ("rpmsg: glink: Handle remote rx done command") Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-08-31rpmsg: glink: Export symbols from common codeBjorn Andersson
The common code needs to export the probe and remove symbols in order for the SMEM and RPM drivers to access them when compiled as a module. Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-08-30rpmsg: glink: Release idr lock before returning on errorBjorn Andersson
The idr_lock should be released in the case that we don't find the given channel. Fixes: 44f6df922a26 ("rpmsg: glink: Fix idr_lock from mutex to spinlock") Reported-by: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-08-29rpmsg: glink: Handle remote rx done commandSricharan R
Once the remote side sends a rx done ack, check for the intent reuse information from it and suitably discard or reuse the remote passed intent buffers. Acked-by: Arun Kumar Neelakantam <aneela@codeaurora.org> Signed-off-by: Sricharan R <sricharan@codeaurora.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-08-29rpmsg: glink: Request for intents when unavailableSricharan R
While sending data, we search for suitable sized intent to map and simply fail if a intent is not found. Instead request for a intent of required size and wait till one is alloted. Acked-by: Arun Kumar Neelakantam <aneela@codeaurora.org> Signed-off-by: Sricharan R <sricharan@codeaurora.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-08-29rpmsg: glink: Use the intents passed by remoteSricharan R
While sending data, use the remote intent id buffer of suitable size that was passed by remote previously. Acked-by: Arun Kumar Neelakantam <aneela@codeaurora.org> Signed-off-by: Sricharan R <sricharan@codeaurora.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-08-29rpmsg: glink: Receive and store the remote intent buffersSricharan R
Just like we allocating and sending intent ids to remote, remote side allocates and sends us the intents as well. So save the intent ids and use it later while sending data targeting the appropriate intents based on the size. Acked-by: Arun Kumar Neelakantam <aneela@codeaurora.org> Signed-off-by: Sricharan R <sricharan@codeaurora.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-08-29rpmsg: glink: Add announce_create ops and preallocate intentsSricharan R
Preallocate local intent buffers and pass the intent ids to the remote. This way there are some default intents available for the remote to start sending data without having to wait by sending intent requests. Do this by adding the rpmsg announce_create ops, which gets called right after the rpmsg device gets probed. Acked-by: Arun Kumar Neelakantam <aneela@codeaurora.org> Signed-off-by: Sricharan R <sricharan@codeaurora.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-08-29rpmsg: glink: Add rx done commandSricharan R
Send RX data receive ack to remote and also inform that local intent buffer is used and freed. This informs the remote to request for next set of intent buffers before doing a send operation. Acked-by: Arun Kumar Neelakantam <aneela@codeaurora.org> Signed-off-by: Sricharan R <sricharan@codeaurora.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-08-29rpmsg: glink: Make RX FIFO peak accessor to take an offsetBjorn Andersson
To fully read the received rx data from FIFO both the command and data has to be read. Currently we read command, data separately and process them. By adding an offset parameter to RX FIFO peak accessor, command and data can be read together, simplifying things. So introduce this. Acked-by: Arun Kumar Neelakantam <aneela@codeaurora.org> Signed-off-by: Sricharan R <sricharan@codeaurora.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-08-29rpmsg: glink: Use the local intents when receiving dataSricharan R
So previously on request from remote side, we allocated local intent buffers and passed the ids to the remote. Now when we receive data buffers from remote directed to that intent id, copy the data to the corresponding preallocated intent buffer. Acked-by: Arun Kumar Neelakantam <aneela@codeaurora.org> Signed-off-by: Sricharan R <sricharan@codeaurora.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-08-29rpmsg: glink: Add support for TX intentsSricharan R
Intents are nothing but pre-allocated buffers of appropriate size that are allocated on the local side and communicated to the remote side and the remote stores the list of intent ids that it is informed. Later when remote side is intenting to send data, it picks up a right intent (based on the size) and sends the data buffer and the intent id. Local side receives the data and copies it to the local intent buffer. The whole idea is to avoid stalls on the transport for allocating memory, used for copy based transports. When the remote request to allocate buffers using CMD_RX_INTENT_REQ, we allocate buffers of requested size, store the buffer id locally and also communicate the intent id to the remote. Acked-by: Arun Kumar Neelakantam <aneela@codeaurora.org> Signed-off-by: Sricharan R <sricharan@codeaurora.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-08-29rpmsg: glink: Fix idr_lock from mutex to spinlockSricharan R
The channel members lcids, rcids synchronised using the idr_lock is accessed in both atomic/non-atomic contexts. The readers are not currently synchronised. That no correct, so add the readers as well under the lock and use a spinlock. Acked-by: Arun Kumar Neelakantam <aneela@codeaurora.org> Signed-off-by: Sricharan R <sricharan@codeaurora.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-08-29rpmsg: glink: Add support for transport version negotiationSricharan R
G-link supports a version number and feature flags for each transport. A combination of the version number and feature flags enable/disable: (*) G-Link software updates for each edge (*) Individual features for each edge Endpoints negotiate both the version and the supported flags when the transport is opened and they cannot be changed after negotiation has been completed. Each full implementation of G-Link must support a minimum of the current version, the previous version, and the base negotiation version called v0. Acked-by: Arun Kumar Neelakantam <aneela@codeaurora.org> Signed-off-by: Sricharan R <sricharan@codeaurora.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-08-29rpmsg: glink: Introduce glink smem based transportBjorn Andersson
The glink protocol supports different types of transports (shared memory). With the core protocol remaining the same, the way the transport's memory is probed and accessed is different. So add support for glink's smem based transports. Adding a new smem transport register function and the fifo accessors for the same. Acked-by: Arun Kumar Neelakantam <aneela@codeaurora.org> Signed-off-by: Sricharan R <sricharan@codeaurora.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-08-29rpmsg: glink: Do a mbox_free_channel in removeSricharan R
mbox_request_channel is done in probe, so free the channel in remove. Acked-by: Arun Kumar Neelakantam <aneela@codeaurora.org> Signed-off-by: Sricharan R <sricharan@codeaurora.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-08-29rpmsg: glink: Return -EAGAIN when there is no FIFO spaceSricharan R
The TX FIFO can be full, if the remote client has not read enough data (or) reading it slowly. So its nessecary to return -EAGAIN to the local client to enable retry. Acked-by: Arun Kumar Neelakantam <aneela@codeaurora.org> Signed-off-by: Sricharan R <sricharan@codeaurora.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-08-29rpmsg: glink: Allow unaligned data accessBjorn Andersson
Glink protocol requires that each message is aligned on a 8 byte offset. This is purely a restriction from glink, so in order to support clients which do not adher to this, allow data packets of any size, but align the head index accordingly, effectively removing the alignment restriction. Acked-by: Arun Kumar Neelakantam <aneela@codeaurora.org> Signed-off-by: Sricharan R <sricharan@codeaurora.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-08-29rpmsg: glink: Move the common glink protocol implementation to glink_native.cBjorn Andersson
Move the common part of glink core protocol implementation to glink_native.c that can be shared with the smem based glink transport in the later patches. Acked-by: Arun Kumar Neelakantam <aneela@codeaurora.org> Signed-off-by: Sricharan R <sricharan@codeaurora.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-08-29rpmsg: glink: Split rpm_probe to reuse the common codeBjorn Andersson
There is quite some code common in glink_rpm_probe that can reused for glink-smem based transport as well. So split the function and move the code to glink_native_probe that can be used later when we add the support for glink-smem based transport. Also reuse driver's remove as well. Acked-by: Arun Kumar Neelakantam <aneela@codeaurora.org> Signed-off-by: Sricharan R <sricharan@codeaurora.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-08-29rpmsg: glink: Associate indirections for pipe fifo accessor'sBjorn Andersson
With the intention of reusing the glink core protocol commands and code across both rpm and smem based transports, the only thing different is way of accessing the shared-memory of the transport (FIFO). So put the fifo accessor's of the transport's pipe (rx/tx) behind indirections, so that the rest of the code can be shared. For this, have a qcom_glink_pipe that can be used in the common code containing the indirections and wrap it with glink_rpm_pipe that contains the transport specific members. Acked-by: Arun Kumar Neelakantam <aneela@codeaurora.org> Signed-off-by: Sricharan R <sricharan@codeaurora.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-08-29rpmsg: glink: Rename glink_rpm_xx functions to qcom_glink_xxBjorn Andersson
Renaming the glink_rpm_xx functions and structs to qcom_glink_xx equivalents helps to reuse the core glink protocol while adding support for smem based glink transport in the later patches. Acked-by: Arun Kumar Neelakantam <aneela@codeaurora.org> Signed-off-by: Sricharan R <sricharan@codeaurora.org> 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-07-26rpmsg: qcom_smd: add of_node node to edge deviceSrinivas Kandagatla
This patch assigns the device node to the edge device, so that the edge device drivers could read required device tree properties. Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-07-06Merge tag 'rpmsg-v4.13' of git://github.com/andersson/remoteprocLinus Torvalds
Pull rpmsg updates from Bjorn Andersson: "This introduces the Qualcomm GLINK protocol driver and DeviceTree-based modalias support, as well as a number of smaller fixes" * tag 'rpmsg-v4.13' of git://github.com/andersson/remoteproc: rpmsg: Make modalias work for DeviceTree based devices rpmsg: Drop VIRTUALIZATION dependency from RPMSG_VIRTIO rpmsg: Don't overwrite release op of rpdev rpmsg: virtio_rpmsg_bus: cleanup multiple assignment to ops rpmsg: virtio_rpmsg_bus: fix nameservice address rpmsg: cleanup incorrect function in dev_err message rpmsg: virtio_rpmsg_bus: fix announce for devices without endpoint rpmsg: Introduce Qualcomm RPM glink driver soc: qcom: Add device tree binding for GLINK RPM rpmsg: Release rpmsg devices in backends
2017-07-05Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-nextLinus Torvalds
Pull networking updates from David Miller: "Reasonably busy this cycle, but perhaps not as busy as in the 4.12 merge window: 1) Several optimizations for UDP processing under high load from Paolo Abeni. 2) Support pacing internally in TCP when using the sch_fq packet scheduler for this is not practical. From Eric Dumazet. 3) Support mutliple filter chains per qdisc, from Jiri Pirko. 4) Move to 1ms TCP timestamp clock, from Eric Dumazet. 5) Add batch dequeueing to vhost_net, from Jason Wang. 6) Flesh out more completely SCTP checksum offload support, from Davide Caratti. 7) More plumbing of extended netlink ACKs, from David Ahern, Pablo Neira Ayuso, and Matthias Schiffer. 8) Add devlink support to nfp driver, from Simon Horman. 9) Add RTM_F_FIB_MATCH flag to RTM_GETROUTE queries, from Roopa Prabhu. 10) Add stack depth tracking to BPF verifier and use this information in the various eBPF JITs. From Alexei Starovoitov. 11) Support XDP on qed device VFs, from Yuval Mintz. 12) Introduce BPF PROG ID for better introspection of installed BPF programs. From Martin KaFai Lau. 13) Add bpf_set_hash helper for TC bpf programs, from Daniel Borkmann. 14) For loads, allow narrower accesses in bpf verifier checking, from Yonghong Song. 15) Support MIPS in the BPF selftests and samples infrastructure, the MIPS eBPF JIT will be merged in via the MIPS GIT tree. From David Daney. 16) Support kernel based TLS, from Dave Watson and others. 17) Remove completely DST garbage collection, from Wei Wang. 18) Allow installing TCP MD5 rules using prefixes, from Ivan Delalande. 19) Add XDP support to Intel i40e driver, from Björn Töpel 20) Add support for TC flower offload in nfp driver, from Simon Horman, Pieter Jansen van Vuuren, Benjamin LaHaise, Jakub Kicinski, and Bert van Leeuwen. 21) IPSEC offloading support in mlx5, from Ilan Tayari. 22) Add HW PTP support to macb driver, from Rafal Ozieblo. 23) Networking refcount_t conversions, From Elena Reshetova. 24) Add sock_ops support to BPF, from Lawrence Brako. This is useful for tuning the TCP sockopt settings of a group of applications, currently via CGROUPs" * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (1899 commits) net: phy: dp83867: add workaround for incorrect RX_CTRL pin strap dt-bindings: phy: dp83867: provide a workaround for incorrect RX_CTRL pin strap cxgb4: Support for get_ts_info ethtool method cxgb4: Add PTP Hardware Clock (PHC) support cxgb4: time stamping interface for PTP nfp: default to chained metadata prepend format nfp: remove legacy MAC address lookup nfp: improve order of interfaces in breakout mode net: macb: remove extraneous return when MACB_EXT_DESC is defined bpf: add missing break in for the TCP_BPF_SNDCWND_CLAMP case bpf: fix return in load_bpf_file mpls: fix rtm policy in mpls_getroute net, ax25: convert ax25_cb.refcount from atomic_t to refcount_t net, ax25: convert ax25_route.refcount from atomic_t to refcount_t net, ax25: convert ax25_uid_assoc.refcount from atomic_t to refcount_t net, sctp: convert sctp_ep_common.refcnt from atomic_t to refcount_t net, sctp: convert sctp_transport.refcnt from atomic_t to refcount_t net, sctp: convert sctp_chunk.refcnt from atomic_t to refcount_t net, sctp: convert sctp_datamsg.refcnt from atomic_t to refcount_t net, sctp: convert sctp_auth_bytes.refcnt from atomic_t to refcount_t ...
2017-06-28rpmsg: Make modalias work for DeviceTree based devicesBjorn Andersson
When rpmsg devices are expected to be matched based on their compatible the modalias should reflect this, so that module autoloading has a chance to match and load the appropriate module. Tested-by: Rob Clark <robdclark@gmail.com> Reported-by: Rob Clark <robdclark@gmail.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-06-27rpmsg: Drop VIRTUALIZATION dependency from RPMSG_VIRTIOSuman Anna
A dependency to VIRTUALIZATION has been added to RPMSG_VIRTIO (back when it was named RPMSG) in v3.10 kernel in commit 397944df3290 ("rpmsg: fix kconfig dependencies for VIRTIO") to resolve Kconfig warnings due to the inclusion of the virtio configuration file from the ARM's KVM config file. The KVM config was fixed properly in the subsequent release in commit 8bd4ffd6b3a9 ("ARM: kvm: don't include drivers/virtio/Kconfig"). So, drop this unneeded VIRTUALIZATION dependency from RPMSG_VIRTIO. Signed-off-by: Suman Anna <s-anna@ti.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-06-26rpmsg: Don't overwrite release op of rpdevBjorn Andersson
b0b03b811963 ("rpmsg: Release rpmsg devices in backends") attempted to correct the ownership of freeing rpmsg device memory. But the patch is not complete, in that the rpmsg core will overwrite the release op as the device is being registered. Fixes: b0b03b811963 ("rpmsg: Release rpmsg devices in backends") Reported-by: Henri Roosen <henri.roosen@ginzinger.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: cleanup incorrect function in dev_err messageHenri Roosen
Trivial cleanup for incorrect function in dev_err message 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-06-16networking: introduce and use skb_put_data()Johannes Berg
A common pattern with skb_put() is to just want to memcpy() some data into the new space, introduce skb_put_data() for this. An spatch similar to the one for skb_put_zero() converts many of the places using it: @@ identifier p, p2; expression len, skb, data; type t, t2; @@ ( -p = skb_put(skb, len); +p = skb_put_data(skb, data, len); | -p = (t)skb_put(skb, len); +p = skb_put_data(skb, data, len); ) ( p2 = (t2)p; -memcpy(p2, data, len); | -memcpy(p, data, len); ) @@ type t, t2; identifier p, p2; expression skb, data; @@ t *p; ... ( -p = skb_put(skb, sizeof(t)); +p = skb_put_data(skb, data, sizeof(t)); | -p = (t *)skb_put(skb, sizeof(t)); +p = skb_put_data(skb, data, sizeof(t)); ) ( p2 = (t2)p; -memcpy(p2, data, sizeof(*p)); | -memcpy(p, data, sizeof(*p)); ) @@ expression skb, len, data; @@ -memcpy(skb_put(skb, len), data, len); +skb_put_data(skb, data, len); (again, manually post-processed to retain some comments) Reviewed-by: Stephen Hemminger <stephen@networkplumber.org> Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2017-06-09rpmsg: use dev_groups and not dev_attrs for bus_typeGreg Kroah-Hartman
The dev_attrs field has long been "depreciated" and is finally being removed, so move the driver to use the "correct" dev_groups field instead for struct bus_type. Cc: Ohad Ben-Cohen <ohad@wizery.com> Acked-by: Bjorn Andersson <bjorn.andersson@linaro.org> Cc: <linux-remoteproc@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-30rpmsg: Introduce Qualcomm RPM glink driverBjorn Andersson
This introduces a basic driver for communicating over "native glink" with the RPM found in Qualcomm platforms. 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-10Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhostLinus Torvalds
Pull virtio updates from Michael Tsirkin: "Fixes, cleanups, performance A bunch of changes to virtio, most affecting virtio net. Also ptr_ring batched zeroing - first of batching enhancements that seems ready." * tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost: s390/virtio: change maintainership tools/virtio: fix spelling mistake: "wakeus" -> "wakeups" virtio_net: tidy a couple debug statements ptr_ring: support testing different batching sizes ringtest: support test specific parameters ptr_ring: batch ring zeroing virtio: virtio_driver doc virtio_net: don't reset twice on XDP on/off virtio_net: fix support for small rings virtio_net: reduce alignment for buffers virtio_net: rework mergeable buffer handling virtio_net: allow specifying context for rx virtio: allow extra context per descriptor tools/virtio: fix build breakage virtio: add context flag to find vqs virtio: wrap find_vqs ringtest: fix an assert statement
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-03-28soc: qcom: smd: Remove standalone driverBjorn Andersson
Remove the standalone SMD implementation as we have transitioned the client drivers to use the RPMSG based one. Also remove all dependencies on QCOM_SMD from Kconfig files, in order to keep them selectable in the absence of the removed symbol. Acked-by: Andy Gross <andy.gross@linaro.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: David S. Miller <davem@davemloft.net>
2017-03-02Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhostLinus Torvalds
Pull vhost updates from Michael Tsirkin: "virtio, vhost: optimizations, fixes Looks like a quiet cycle for vhost/virtio, just a couple of minor tweaks. Most notable is automatic interrupt affinity for blk and scsi. Hopefully other devices are not far behind" * tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost: virtio-console: avoid DMA from stack vhost: introduce O(1) vq metadata cache virtio_scsi: use virtio IRQ affinity virtio_blk: use virtio IRQ affinity blk-mq: provide a default queue mapping for virtio device virtio: provide a method to get the IRQ affinity mask for a virtqueue virtio: allow drivers to request IRQ affinity when creating VQs virtio_pci: simplify MSI-X setup virtio_pci: don't duplicate the msix_enable flag in struct pci_dev virtio_pci: use shared interrupts for virtqueues virtio_pci: remove struct virtio_pci_vq_info vhost: try avoiding avail index access when getting descriptor virtio_mmio: expose header to userspace
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>
2017-02-13rpmsg: rpmsg_create_ept() returns NULL on errorBjorn Andersson
The parameter validation incorrectly returned an ERR_PTR(), which is not handled by the callers to rpmsg_create_ept(), per the definition NULL should be returned. Fixes: 93e9324431c9 ("rpmsg: Handle invalid parameters in public API") Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>