Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7c923f15 authored by qctecmdr Service's avatar qctecmdr Service Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: ADSPRPC: Share context bank with multiple sids"

parents 84355fa9 224085b0
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -32,6 +32,8 @@ Subnode Required properties:
- dma-coherent :  A flag marking a context bank as I/O coherent
- shared-cb    :  A value indicating how many fastrpc sessions can share a
			context bank
- shared-sid   :  A value indicating the number of sids that are using the same
			context bank

Example:
	qcom,msm_fastrpc {
@@ -59,6 +61,13 @@ Example:
			iommus = <&apps_smmu 0x1402 0x0>;
			shared-cb = <5>;
		};
		qcom,msm_fastrpc_compute_cb_3 {
			compatible = "qcom,msm-fastrpc-compute-cb";
			label = "adsprpc-smd";
			iommus = <&apps_smmu 0x0043 0x0>,
				 <&apps_smmu 0x0044 0x0>;
			shared-sid = <2>;
		};
	};

Legacy SMMU v1/v2:
+27 −0
Original line number Diff line number Diff line
@@ -3532,6 +3532,7 @@ static int fastrpc_cb_probe(struct device *dev)
	dma_addr_t start = 0x80000000;
	int err = 0;
	unsigned int sharedcb_count = 0, cid, i, j;
	unsigned int index, num_indices = 0;
	int secure_vmid = VMID_CP_PIXEL, cache_flush = 1;

	VERIFY(err, NULL != (name = of_get_property(dev->of_node,
@@ -3624,6 +3625,32 @@ static int fastrpc_cb_probe(struct device *dev)
	dma_set_max_seg_size(sess->smmu.dev, DMA_BIT_MASK(32));
	dma_set_seg_boundary(sess->smmu.dev, (unsigned long)DMA_BIT_MASK(64));

	if (of_get_property(dev->of_node, "shared-sid", NULL) != NULL) {
		struct fastrpc_session_ctx *new_sess;

		err = of_property_read_u32(dev->of_node, "shared-sid",
				&num_indices);
		if (err)
			goto bail;

		for (index = 1; index < num_indices &&
				chan->sesscount < NUM_SESSIONS; index++) {
			err = of_parse_phandle_with_args(dev->of_node, "iommus",
					"#iommu-cells", index, &iommuspec);
			if (err) {
				pr_err("adsprpc: %s: parsing iommu arguments failed for %s with err %d",
						__func__, dev_name(dev), err);
				goto bail;
			}
			chan->sesscount++;
			new_sess = &chan->session[chan->sesscount];
			memcpy(new_sess, sess,
				sizeof(struct fastrpc_session_ctx));
			new_sess->smmu.cb = iommuspec.args[0] & 0xf;
			sess = new_sess;
		}
	}

	if (of_get_property(dev->of_node, "shared-cb", NULL) != NULL) {
		err = of_property_read_u32(dev->of_node, "shared-cb",
				&sharedcb_count);