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

Commit b4e23f60 authored by David Keitel's avatar David Keitel
Browse files

soc: qcom: peripheral-loader: assign mem to linux in pil_boot



In some scenarios the hypervisor assigned memory is not assigned
back to Linux as part of the shutdown or ramdump sequence.

To fix this, make sure to first assign the memory back to Linux
before allowing the memory to be assigned to both Linux and the
subsystem with the source VmID being HLOS.

CRs-Fixed: 941595
Change-Id: Ideb211f0946bcd13dfe0178fe94135d4b18cbf11
Signed-off-by: default avatarDavid Keitel <dkeitel@codeaurora.org>
parent ac6766f8
Loading
Loading
Loading
Loading
+21 −10
Original line number Diff line number Diff line
@@ -558,16 +558,7 @@ static int pil_init_mmap(struct pil_desc *desc, const struct pil_mdt *mdt)
	if (ret)
		return ret;

	if (desc->subsys_vmid > 0) {
		ret = pil_assign_mem_to_subsys_and_linux(desc,
				priv->region_start,
				(priv->region_end - priv->region_start));
		if (ret) {
			pil_err(desc, "Failed to assign memory, ret - %d\n",
								ret);
			return ret;
		}
	}

	pil_info(desc, "loading from %pa to %pa\n", &priv->region_start,
							&priv->region_end);

@@ -818,6 +809,26 @@ int pil_boot(struct pil_desc *desc)
		goto err_deinit_image;
	}

	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. */
		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));
		if (ret) {
			pil_err(desc, "Failed to assign memory, ret - %d\n",
								ret);
			goto err_deinit_image;
		}
	}

	list_for_each_entry(seg, &desc->priv->segs, list) {
		ret = pil_load_seg(desc, seg);
		if (ret)