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

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

Merge "memshare: Conditional free the clients allotted memory"

parents e861fd87 aa5cf9ee
Loading
Loading
Loading
Loading
+13 −7
Original line number Diff line number Diff line
@@ -345,6 +345,7 @@ static int modem_notifier_cb(struct notifier_block *this, unsigned long code,
				memblock[i].peripheral ==
				DHMS_MEM_PROC_MPSS_V01 &&
				!memblock[i].guarantee &&
				!memblock[i].client_request &&
				memblock[i].allotted &&
				!memblock[i].alloc_request) {
				pr_debug("memshare: hypervisor unmapping  for client id: %d\n",
@@ -538,9 +539,10 @@ static void handle_free_generic_req(struct qmi_handle *handle,
					__func__);
		flag = 1;
	} else if (!memblock[client_id].guarantee &&
				!memblock[client_id].client_request &&
				memblock[client_id].allotted) {
		pr_debug("memshare: %s: size: %d",
				__func__, memblock[client_id].size);
		pr_debug("memshare: %s:client_id:%d - size: %d",
				__func__, client_id, memblock[client_id].size);
		ret = hyp_assign_phys(memblock[client_id].phy_addr,
				memblock[client_id].size, source_vmlist, 1,
				dest_vmids, dest_perms, 1);
@@ -549,8 +551,8 @@ static void handle_free_generic_req(struct qmi_handle *handle,
		 * This is an error case as hyp mapping was successful
		 * earlier but during unmap it lead to failure.
		 */
			pr_err("memshare: %s, failed to unmap the region\n",
				__func__);
			pr_err("memshare: %s, failed to unmap the region for client id:%d\n",
				__func__, client_id);
		}
		size = memblock[client_id].size;
		if (memblock[client_id].client_id == 1) {
@@ -569,8 +571,8 @@ static void handle_free_generic_req(struct qmi_handle *handle,
			attrs);
		free_client(client_id);
	} else {
		pr_err("memshare: %s, Request came for a guaranteed client cannot free up the memory\n",
						__func__);
		pr_err("memshare: %s, Request came for a guaranteed client (client_id: %d) cannot free up the memory\n",
						__func__, client_id);
	}

	if (flag) {
@@ -781,6 +783,10 @@ static int memshare_child_probe(struct platform_device *pdev)
							pdev->dev.of_node,
							"qcom,allocate-boot-time");

	memblock[num_clients].client_request = of_property_read_bool(
							pdev->dev.of_node,
							"qcom,allocate-on-request");

	rc = of_property_read_string(pdev->dev.of_node, "label",
						&name);
	if (rc) {
+2 −0
Original line number Diff line number Diff line
@@ -41,6 +41,8 @@ struct mem_blocks {
	uint32_t allotted;
	/* Memory allocation request received or not */
	uint32_t alloc_request;
	/* Allocation on request from a client*/
	uint32_t client_request;
	/* Size required for client */
	uint32_t size;
	/*