From 4d91d7b099508831e82ef209bba71c8b636886a2 Mon Sep 17 00:00:00 2001 From: Anup Patel Date: Thu, 5 Oct 2017 22:13:20 +0530 Subject: rpmsg: Allow RPMSG_VIRTIO to be enabled via menuconfig or defconfig 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 Signed-off-by: Bjorn Andersson --- drivers/rpmsg/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/rpmsg') diff --git a/drivers/rpmsg/Kconfig b/drivers/rpmsg/Kconfig index 0fe6eac46512..65a9f6b892f0 100644 --- a/drivers/rpmsg/Kconfig +++ b/drivers/rpmsg/Kconfig @@ -47,7 +47,8 @@ config RPMSG_QCOM_SMD platforms. config RPMSG_VIRTIO - tristate + tristate "Virtio RPMSG bus driver" + depends on HAS_DMA select RPMSG select VIRTIO -- cgit v1.2.3-58-ga151 From 2394facb17bcace4b3c19b50202177a5d8903b64 Mon Sep 17 00:00:00 2001 From: Arun Kumar Neelakantam Date: Mon, 30 Oct 2017 11:11:24 +0530 Subject: rpmsg: glink: Initialize the "intent_req_comp" completion variable 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 Signed-off-by: Bjorn Andersson --- drivers/rpmsg/qcom_glink_native.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/rpmsg') diff --git a/drivers/rpmsg/qcom_glink_native.c b/drivers/rpmsg/qcom_glink_native.c index 5dcc9bf1c5bc..fcd46ab090a7 100644 --- a/drivers/rpmsg/qcom_glink_native.c +++ b/drivers/rpmsg/qcom_glink_native.c @@ -227,6 +227,7 @@ static struct glink_channel *qcom_glink_alloc_channel(struct qcom_glink *glink, init_completion(&channel->open_req); init_completion(&channel->open_ack); + init_completion(&channel->intent_req_comp); INIT_LIST_HEAD(&channel->done_intents); INIT_WORK(&channel->intent_work, qcom_glink_rx_done_work); -- cgit v1.2.3-58-ga151 From 073893778dc2f68e41d65d79925ca89db526b4ab Mon Sep 17 00:00:00 2001 From: Chris Lew Date: Thu, 26 Oct 2017 15:28:55 -0700 Subject: rpmsg: glink: Add support to preallocate intents The base intents prequeued during channel creation may not satisfy a channel's throughput requirement. Add support for intents dt-binding to allow channels to specify the size and amount of intents to prequeue during endpoint announcement. Signed-off-by: Chris Lew [bjorn: Altered how defaults are expressed] Signed-off-by: Bjorn Andersson --- drivers/rpmsg/qcom_glink_native.c | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) (limited to 'drivers/rpmsg') diff --git a/drivers/rpmsg/qcom_glink_native.c b/drivers/rpmsg/qcom_glink_native.c index fcd46ab090a7..2dff77882ced 100644 --- a/drivers/rpmsg/qcom_glink_native.c +++ b/drivers/rpmsg/qcom_glink_native.c @@ -1149,19 +1149,38 @@ static struct rpmsg_endpoint *qcom_glink_create_ept(struct rpmsg_device *rpdev, static int qcom_glink_announce_create(struct rpmsg_device *rpdev) { struct glink_channel *channel = to_glink_channel(rpdev->ept); - struct glink_core_rx_intent *intent; + struct device_node *np = rpdev->dev.of_node; struct qcom_glink *glink = channel->glink; - int num_intents = glink->intentless ? 0 : 5; + struct glink_core_rx_intent *intent; + const struct property *prop = NULL; + __be32 defaults[] = { cpu_to_be32(SZ_1K), cpu_to_be32(5) }; + int num_intents; + int num_groups = 1; + __be32 *val = defaults; + int size; + + if (glink->intentless) + return 0; + + prop = of_find_property(np, "qcom,intents", NULL); + if (prop) { + val = prop->value; + num_groups = prop->length / sizeof(u32) / 2; + } /* Channel is now open, advertise base set of intents */ - while (num_intents--) { - intent = qcom_glink_alloc_intent(glink, channel, SZ_1K, true); - if (!intent) - break; + while (num_groups--) { + size = be32_to_cpup(val++); + num_intents = be32_to_cpup(val++); + while (num_intents--) { + intent = qcom_glink_alloc_intent(glink, channel, size, + true); + if (!intent) + break; - qcom_glink_advertise_intent(glink, channel, intent); + qcom_glink_advertise_intent(glink, channel, intent); + } } - return 0; } -- cgit v1.2.3-58-ga151 From 290318702bb2e7d74c24fbe52d8184fc79a17e93 Mon Sep 17 00:00:00 2001 From: Chris Lew Date: Thu, 26 Oct 2017 15:28:56 -0700 Subject: rpmsg: glink: Use best fit intent during tx Intents can vary in size, try to find the best fitting remote intent instead of first fit when sending a message to the remote proc. Signed-off-by: Chris Lew Signed-off-by: Bjorn Andersson --- drivers/rpmsg/qcom_glink_native.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'drivers/rpmsg') diff --git a/drivers/rpmsg/qcom_glink_native.c b/drivers/rpmsg/qcom_glink_native.c index 2dff77882ced..80d9af307b40 100644 --- a/drivers/rpmsg/qcom_glink_native.c +++ b/drivers/rpmsg/qcom_glink_native.c @@ -1257,11 +1257,16 @@ static int __qcom_glink_send(struct glink_channel *channel, spin_lock_irqsave(&channel->intent_lock, flags); idr_for_each_entry(&channel->riids, tmp, iid) { if (tmp->size >= len && !tmp->in_use) { - tmp->in_use = true; - intent = tmp; - break; + if (!intent) + intent = tmp; + else if (intent->size > tmp->size) + intent = tmp; + if (intent->size == len) + break; } } + if (intent) + intent->in_use = true; spin_unlock_irqrestore(&channel->intent_lock, flags); /* We found an available intent */ -- cgit v1.2.3-58-ga151 From 1e0d5615bbc37deb7732491798abccf8d3c3d244 Mon Sep 17 00:00:00 2001 From: Bjorn Andersson Date: Tue, 14 Nov 2017 21:45:34 -0800 Subject: rpmsg: glink: Add missing MODULE_LICENSE The qcom_glink_native driver is missing a MODULE_LICENSE(), correct this. Fixes: 835764ddd9af ("rpmsg: glink: Move the common glink protocol implementation to glink_native.c") Cc: stable@vger.kernel.org Reported-by: Randy Dunlap Signed-off-by: Bjorn Andersson --- drivers/rpmsg/qcom_glink_native.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'drivers/rpmsg') diff --git a/drivers/rpmsg/qcom_glink_native.c b/drivers/rpmsg/qcom_glink_native.c index 80d9af307b40..cd9d643433d3 100644 --- a/drivers/rpmsg/qcom_glink_native.c +++ b/drivers/rpmsg/qcom_glink_native.c @@ -1641,3 +1641,6 @@ void qcom_glink_native_unregister(struct qcom_glink *glink) device_unregister(glink->dev); } EXPORT_SYMBOL_GPL(qcom_glink_native_unregister); + +MODULE_DESCRIPTION("Qualcomm GLINK driver"); +MODULE_LICENSE("GPL v2"); -- cgit v1.2.3-58-ga151 From 38a9acb3bb7b2561a08144ff80a292889f389a9b Mon Sep 17 00:00:00 2001 From: Bjorn Andersson Date: Wed, 15 Nov 2017 22:08:33 -0800 Subject: rpmsg: glink: The mbox client knows_txdone As the GLINK driver is ticking the txdone of the mailbox channel (to implement the doorbell) it needs to set knows_txdone. Signed-off-by: Bjorn Andersson --- drivers/rpmsg/qcom_glink_native.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/rpmsg') diff --git a/drivers/rpmsg/qcom_glink_native.c b/drivers/rpmsg/qcom_glink_native.c index cd9d643433d3..40d76d2a5eff 100644 --- a/drivers/rpmsg/qcom_glink_native.c +++ b/drivers/rpmsg/qcom_glink_native.c @@ -1576,6 +1576,7 @@ struct qcom_glink *qcom_glink_native_probe(struct device *dev, idr_init(&glink->rcids); glink->mbox_client.dev = dev; + glink->mbox_client.knows_txdone = true; glink->mbox_chan = mbox_request_channel(&glink->mbox_client, 0); if (IS_ERR(glink->mbox_chan)) { if (PTR_ERR(glink->mbox_chan) != -EPROBE_DEFER) -- cgit v1.2.3-58-ga151