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

Commit b446ea8d authored by Katish Paran's avatar Katish Paran
Browse files

msm: memshare: Handle modem subsystem restart event



Currently once the memory is allocated to modem, re-allocation
of memory cannot be done unless it is freed up. After memory
allocation if modem subsystem restart happens Modem is not
aware of any memory being  allocated to it earlier. Thus if
modem again request for memory allocation, without freeing up
earlier allocated memory, we will pass the same handle as of
earlier.

Change-Id: I88869088cad6c3db8713dd4c1589821b42ecff46
Signed-off-by: default avatarKatish Paran <kparan@codeaurora.org>
parent 4aad351a
Loading
Loading
Loading
Loading
+12 −10
Original line number Diff line number Diff line
/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -70,6 +70,7 @@ static int handle_alloc_req(void *req_h, void *req)
	pr_debug("%s: req->num_bytes = %d\n", __func__, alloc_req->num_bytes);
	alloc_resp.resp = QMI_RESULT_FAILURE_V01;
	mutex_lock(&mem_share);
	if (!size) {
		memset(&alloc_resp, 0, sizeof(struct mem_alloc_resp_msg_v01));
		rc = memshare_alloc(alloc_req->num_bytes,
					alloc_req->block_alignment,
@@ -78,7 +79,7 @@ static int handle_alloc_req(void *req_h, void *req)
			mutex_unlock(&mem_share);
			return -ENOMEM;
		}

	}
	alloc_resp.num_bytes_valid = 1;
	alloc_resp.num_bytes =  alloc_req->num_bytes;
	size = alloc_req->num_bytes;
@@ -86,6 +87,7 @@ static int handle_alloc_req(void *req_h, void *req)
	alloc_resp.handle = memblock.phy_addr;
	alloc_resp.resp = QMI_RESULT_SUCCESS_V01;
	mutex_unlock(&mem_share);

	pr_debug("alloc_resp.num_bytes :%d, alloc_resp.handle :%lx, alloc_resp.mem_req_result :%lx\n",
			  alloc_resp.num_bytes,
			  (unsigned long int)alloc_resp.handle,
@@ -113,9 +115,9 @@ static int handle_free_req(void *req_h, void *req)
			(unsigned long int)free_req->handle, size);
	dma_free_coherent(NULL, size,
		memblock.virtual_addr, free_req->handle);
	size = 0;
	mutex_unlock(&mem_free);
	free_resp.resp = QMI_RESULT_SUCCESS_V01;

	rc = qmi_send_resp_from_cb(mem_share_svc_handle, curr_conn, req_h,
			&mem_share_svc_free_resp_desc, &free_resp,
			sizeof(free_resp));