Browse Source

Merge tag 'rpmsg-v4.15' of git://github.com/andersson/remoteproc

Pull rpmsg updates from Bjorn Andersson:

 - turn RPMSG_VIRTIO into a user selectable config

 - fix few bugs in GLINK

 - provide the support for specifying initial buffer sizes for GLINK
   channels.

* tag 'rpmsg-v4.15' of git://github.com/andersson/remoteproc:
  rpmsg: glink: The mbox client knows_txdone
  rpmsg: glink: Add missing MODULE_LICENSE
  rpmsg: glink: Use best fit intent during tx
  rpmsg: glink: Add support to preallocate intents
  dt-bindings: soc: qcom: Support GLINK intents
  rpmsg: glink: Initialize the "intent_req_comp" completion variable
  rpmsg: Allow RPMSG_VIRTIO to be enabled via menuconfig or defconfig
Linus Torvalds 7 years ago
parent
commit
bedf571986

+ 10 - 0
Documentation/devicetree/bindings/soc/qcom/qcom,glink.txt

@@ -39,6 +39,14 @@ of these nodes are defined by the individual bindings for the specific function
 	Definition: a list of channels tied to this function, used for matching
 	Definition: a list of channels tied to this function, used for matching
 		    the function to a set of virtual channels
 		    the function to a set of virtual channels
 
 
+- qcom,intents:
+	Usage: optional
+	Value type: <prop-encoded-array>
+	Definition: a list of size,amount pairs describing what intents should
+		    be preallocated for this virtual channel. This can be used
+		    to tweak the default intents available for the channel to
+		    meet expectations of the remote.
+
 = EXAMPLE
 = EXAMPLE
 The following example represents the GLINK RPM node on a MSM8996 device, with
 The following example represents the GLINK RPM node on a MSM8996 device, with
 the function for the "rpm_request" channel defined, which is used for
 the function for the "rpm_request" channel defined, which is used for
@@ -69,6 +77,8 @@ regualtors and root clocks.
 			compatible = "qcom,rpm-msm8996";
 			compatible = "qcom,rpm-msm8996";
 			qcom,glink-channels = "rpm_requests";
 			qcom,glink-channels = "rpm_requests";
 
 
+			qcom,intents = <0x400 5
+					0x800 1>;
 			...
 			...
 		};
 		};
 	};
 	};

+ 0 - 4
drivers/remoteproc/Kconfig

@@ -28,7 +28,6 @@ config OMAP_REMOTEPROC
 	depends on OMAP_IOMMU
 	depends on OMAP_IOMMU
 	select MAILBOX
 	select MAILBOX
 	select OMAP2PLUS_MBOX
 	select OMAP2PLUS_MBOX
-	select RPMSG_VIRTIO
 	help
 	help
 	  Say y here to support OMAP's remote processors (dual M3
 	  Say y here to support OMAP's remote processors (dual M3
 	  and DSP on OMAP4) via the remote processor framework.
 	  and DSP on OMAP4) via the remote processor framework.
@@ -58,7 +57,6 @@ config DA8XX_REMOTEPROC
 	tristate "DA8xx/OMAP-L13x remoteproc support"
 	tristate "DA8xx/OMAP-L13x remoteproc support"
 	depends on ARCH_DAVINCI_DA8XX
 	depends on ARCH_DAVINCI_DA8XX
 	depends on DMA_CMA
 	depends on DMA_CMA
-	select RPMSG_VIRTIO
 	help
 	help
 	  Say y here to support DA8xx/OMAP-L13x remote processors via the
 	  Say y here to support DA8xx/OMAP-L13x remote processors via the
 	  remote processor framework.
 	  remote processor framework.
@@ -79,7 +77,6 @@ config DA8XX_REMOTEPROC
 config KEYSTONE_REMOTEPROC
 config KEYSTONE_REMOTEPROC
 	tristate "Keystone Remoteproc support"
 	tristate "Keystone Remoteproc support"
 	depends on ARCH_KEYSTONE
 	depends on ARCH_KEYSTONE
-	select RPMSG_VIRTIO
 	help
 	help
 	  Say Y here here to support Keystone remote processors (DSP)
 	  Say Y here here to support Keystone remote processors (DSP)
 	  via the remote processor framework.
 	  via the remote processor framework.
@@ -135,7 +132,6 @@ config ST_REMOTEPROC
 	depends on ARCH_STI
 	depends on ARCH_STI
 	select MAILBOX
 	select MAILBOX
 	select STI_MBOX
 	select STI_MBOX
-	select RPMSG_VIRTIO
 	help
 	help
 	  Say y here to support ST's adjunct processors via the remote
 	  Say y here to support ST's adjunct processors via the remote
 	  processor framework.
 	  processor framework.

+ 2 - 1
drivers/rpmsg/Kconfig

@@ -47,7 +47,8 @@ config RPMSG_QCOM_SMD
 	  platforms.
 	  platforms.
 
 
 config RPMSG_VIRTIO
 config RPMSG_VIRTIO
-	tristate
+	tristate "Virtio RPMSG bus driver"
+	depends on HAS_DMA
 	select RPMSG
 	select RPMSG
 	select VIRTIO
 	select VIRTIO
 
 

+ 40 - 11
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_req);
 	init_completion(&channel->open_ack);
 	init_completion(&channel->open_ack);
+	init_completion(&channel->intent_req_comp);
 
 
 	INIT_LIST_HEAD(&channel->done_intents);
 	INIT_LIST_HEAD(&channel->done_intents);
 	INIT_WORK(&channel->intent_work, qcom_glink_rx_done_work);
 	INIT_WORK(&channel->intent_work, qcom_glink_rx_done_work);
@@ -1148,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)
 static int qcom_glink_announce_create(struct rpmsg_device *rpdev)
 {
 {
 	struct glink_channel *channel = to_glink_channel(rpdev->ept);
 	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;
 	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 */
 	/* 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;
 	return 0;
 }
 }
 
 
@@ -1237,11 +1257,16 @@ static int __qcom_glink_send(struct glink_channel *channel,
 			spin_lock_irqsave(&channel->intent_lock, flags);
 			spin_lock_irqsave(&channel->intent_lock, flags);
 			idr_for_each_entry(&channel->riids, tmp, iid) {
 			idr_for_each_entry(&channel->riids, tmp, iid) {
 				if (tmp->size >= len && !tmp->in_use) {
 				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);
 			spin_unlock_irqrestore(&channel->intent_lock, flags);
 
 
 			/* We found an available intent */
 			/* We found an available intent */
@@ -1551,6 +1576,7 @@ struct qcom_glink *qcom_glink_native_probe(struct device *dev,
 	idr_init(&glink->rcids);
 	idr_init(&glink->rcids);
 
 
 	glink->mbox_client.dev = dev;
 	glink->mbox_client.dev = dev;
+	glink->mbox_client.knows_txdone = true;
 	glink->mbox_chan = mbox_request_channel(&glink->mbox_client, 0);
 	glink->mbox_chan = mbox_request_channel(&glink->mbox_client, 0);
 	if (IS_ERR(glink->mbox_chan)) {
 	if (IS_ERR(glink->mbox_chan)) {
 		if (PTR_ERR(glink->mbox_chan) != -EPROBE_DEFER)
 		if (PTR_ERR(glink->mbox_chan) != -EPROBE_DEFER)
@@ -1616,3 +1642,6 @@ void qcom_glink_native_unregister(struct qcom_glink *glink)
 	device_unregister(glink->dev);
 	device_unregister(glink->dev);
 }
 }
 EXPORT_SYMBOL_GPL(qcom_glink_native_unregister);
 EXPORT_SYMBOL_GPL(qcom_glink_native_unregister);
+
+MODULE_DESCRIPTION("Qualcomm GLINK driver");
+MODULE_LICENSE("GPL v2");