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

Commit 41088edd authored by Puja Gupta's avatar Puja Gupta Committed by Gerrit - the friendly Code Review server
Browse files

soc: qcom: pil: Add flag to know if modem SSR happened.



Introduce a flag to know if modem is restarting from cold boot or from
SSR.
Use this flag to decide if modem memory needs to be assigned back to
linux. After cold boot linux already owns modem memory and trying to
assign it back from modem is incorrect.

CRs-Fixed: 1044909
Change-Id: I1c1ef35ea7ef6c2552a22b85c5af260ade413777
Signed-off-by: default avatarPuja Gupta <pujag@codeaurora.org>
parent 1cb34120
Loading
Loading
Loading
Loading
+11 −7
Original line number Diff line number Diff line
@@ -812,15 +812,17 @@ int pil_boot(struct pil_desc *desc)
	}

	if (desc->subsys_vmid > 0) {
		/* Make sure the memory is actually assigned to Linux. In the
		 * case where the shutdown sequence is not able to immediately
		 * assign the memory back to Linux, we need to do this here. */
		/* In case of modem ssr, we need to assign memory back to linux.
		 * This is not true after cold boot since linux already owns it.
		 * Also for secure boot devices, modem memory has to be released
		 * after MBA is booted. */
		if (desc->modem_ssr) {
			ret = pil_assign_mem_to_linux(desc, priv->region_start,
				(priv->region_end - priv->region_start));
			if (ret)
				pil_err(desc, "Failed to assign to linux, ret- %d\n",
								ret);

		}
		ret = pil_assign_mem_to_subsys_and_linux(desc,
				priv->region_start,
				(priv->region_end - priv->region_start));
@@ -856,6 +858,7 @@ int pil_boot(struct pil_desc *desc)
		goto err_auth_and_reset;
	}
	pil_info(desc, "Brought out of reset\n");
	desc->modem_ssr = false;
err_auth_and_reset:
	if (ret && desc->subsys_vmid > 0) {
		pil_assign_mem_to_linux(desc, priv->region_start,
@@ -916,6 +919,7 @@ void pil_shutdown(struct pil_desc *desc)
		pil_proxy_unvote(desc, 1);
	else
		flush_delayed_work(&priv->proxy);
	desc->modem_ssr = true;
}
EXPORT_SYMBOL(pil_shutdown);

+2 −0
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ struct pil_priv;
 * @unmap_fw_mem: Custom function used to undo mapping by map_fw_mem.
 * This defaults to iounmap if not specified.
 * @shutdown_fail: Set if PIL op for shutting down subsystem fails.
 * @modem_ssr: true if modem is restarting, false if booting for first time.
 * @subsys_vmid: memprot id for the subsystem.
 */
struct pil_desc {
@@ -54,6 +55,7 @@ struct pil_desc {
	void (*unmap_fw_mem)(void *virt, size_t size, void *data);
	void *map_data;
	bool shutdown_fail;
	bool modem_ssr;
	u32 subsys_vmid;
};

+1 −0
Original line number Diff line number Diff line
@@ -215,6 +215,7 @@ static int pil_subsys_init(struct modem_data *drv,
	drv->subsys_desc.stop_ack_handler = modem_stop_ack_intr_handler;
	drv->subsys_desc.wdog_bite_handler = modem_wdog_bite_intr_handler;

	drv->q6->desc.modem_ssr = false;
	drv->subsys = subsys_register(&drv->subsys_desc);
	if (IS_ERR(drv->subsys)) {
		ret = PTR_ERR(drv->subsys);