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

Commit 98da2cab authored by Manoj Prabhu B's avatar Manoj Prabhu B
Browse files

memshare: Modify guard band allocation based on target requirement



Instead of allocating guard band memory specific to client, modify
the allocation based on the clients requirement of the memory on
a target.

Change-Id: I812429ed8566fefdf691da966c3b792590b0a7af
Signed-off-by: default avatarManoj Prabhu B <bmanoj@codeaurora.org>
parent 71644d76
Loading
Loading
Loading
Loading
+22 −1
Original line number Diff line number Diff line
@@ -29,7 +29,13 @@ Optional properties for child nodes:

- qcom,allocate-boot-time:	Indicates whether clients needs boot time memory allocation.

Example:
- qcom,allocate-on-request:	Indicates memory allocation happens only upon client request

Note: qcom,allocate-boot-time and qcom,allocate-on-request are mutually exclusive rite now.

- qcom,guard-band:	Indicates addition of a guard band memory allocation in addition to the client's memory region.

Example 1:

qcom,memshare {
	compatible = "qcom,memshare";
@@ -42,3 +48,18 @@ qcom,memshare {
		label = "modem";
	};
};

Example 2:

qcom,memshare {
	compatible = "qcom,memshare";

	qcom,client_3 {
		compatible = "qcom,memshare-peripheral";
		qcom,peripheral-size = <0x500000>;
		qcom,client-id = <1>;
		qcom,allocate-on-request;
		qcom,guard-band;
		label = "modem";
	};
};
 No newline at end of file
+19 −19
Original line number Diff line number Diff line
@@ -371,13 +371,11 @@ static int modem_notifier_cb(struct notifier_block *this, unsigned long code,
						memblock[i].hyp_mapping = 0;
					}
				}
				if (memblock[i].client_id == 1) {
				if (memblock[i].guard_band) {
				/*
					 *	Check if the client id
					 *	is of diag so that free
					 *	the memory region of
					 *	client's size + guard
					 *	bytes of 4K.
				 *	Check if the client required guard band
				 *	support so the memory region of client's
				 *	size + guard bytes of 4K can be freed.
				 */
					size += MEMSHARE_GUARD_BYTES;
				}
@@ -463,7 +461,7 @@ static void handle_alloc_generic_req(struct qmi_handle *handle,
	}

	if (!memblock[client_id].allotted) {
		if (alloc_req->client_id == 1 && alloc_req->num_bytes > 0)
		if (memblock[client_id].guard_band && alloc_req->num_bytes > 0)
			size = alloc_req->num_bytes + MEMSHARE_GUARD_BYTES;
		else
			size = alloc_req->num_bytes;
@@ -555,13 +553,11 @@ static void handle_free_generic_req(struct qmi_handle *handle,
				__func__, client_id);
		}
		size = memblock[client_id].size;
		if (memblock[client_id].client_id == 1) {
		if (memblock[client_id].guard_band) {
		/*
			 *	Check if the client id
			 *	is of diag so that free
			 *	the memory region of
			 *	client's size + guard
			 *	bytes of 4K.
		 *	Check if the client required guard band support so
		 *	the memory region of client's size + guard
		 *	bytes of 4K can be freed
		 */
			size += MEMSHARE_GUARD_BYTES;
		}
@@ -655,7 +651,7 @@ static void handle_query_size_req(struct qmi_handle *handle,
static void mem_share_svc_disconnect_cb(struct qmi_handle *qmi,
				  unsigned int node, unsigned int port)
{
	pr_debug("memshare: Received QMI client disconnect event\n");
	return;
}

static struct qmi_ops server_ops = {
@@ -787,6 +783,10 @@ static int memshare_child_probe(struct platform_device *pdev)
							pdev->dev.of_node,
							"qcom,allocate-on-request");

	memblock[num_clients].guard_band = of_property_read_bool(
							pdev->dev.of_node,
							"qcom,guard-band");

	rc = of_property_read_string(pdev->dev.of_node, "label",
						&name);
	if (rc) {
@@ -809,7 +809,7 @@ static int memshare_child_probe(struct platform_device *pdev)
   *	Memshare allocation for guaranteed clients
   */
	if (memblock[num_clients].guarantee && size > 0) {
		if (client_id == 1)
		if (memblock[num_clients].guard_band)
			size += MEMSHARE_GUARD_BYTES;
		rc = memshare_alloc(memsh_child->dev,
				size,
+2 −0
Original line number Diff line number Diff line
@@ -43,6 +43,8 @@ struct mem_blocks {
	uint32_t alloc_request;
	/* Allocation on request from a client*/
	uint32_t client_request;
	/* Guard band around the allotted region*/
	uint32_t guard_band;
	/* Size required for client */
	uint32_t size;
	/*