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

Commit ebb4283c authored by Gaurav Kohli's avatar Gaurav Kohli Committed by Satya Durga Srinivasu Prabhala
Browse files

soc: qcom: pil: Clear elf region on authentication failure



In existing implementation elf region was being clearead before memory
access to firmware region assigned to HLOS. So to avoid it using
separate function which will be called only when HLOS is the owner.

Change-Id: I8bb22e4dbe3e1f898678d0c0f6e60268b88fc150
Signed-off-by: default avatarGaurav Kohli <gkohli@codeaurora.org>
parent 652ee8ea
Loading
Loading
Loading
Loading
+17 −10
Original line number Diff line number Diff line
@@ -594,6 +594,22 @@ static void pil_release_mmap(struct pil_desc *desc)
	struct pil_priv *priv = desc->priv;
	struct pil_seg *p, *tmp;
	u64 zero = 0ULL;

	if (priv->info) {
		__iowrite32_copy(&priv->info->start, &zero,
					sizeof(zero) / 4);
		writel_relaxed(0, &priv->info->size);
	}

	list_for_each_entry_safe(p, tmp, &priv->segs, list) {
		list_del(&p->list);
		kfree(p);
	}
}

static void pil_clear_segment(struct pil_desc *desc)
{
	struct pil_priv *priv = desc->priv;
	u8 __iomem *buf;

	struct pil_map_fw_info map_fw_info = {
@@ -612,16 +628,6 @@ static void pil_release_mmap(struct pil_desc *desc)
	desc->unmap_fw_mem(buf, (priv->region_end - priv->region_start),
								map_data);

	if (priv->info) {
		__iowrite32_copy(&priv->info->start, &zero,
					sizeof(zero) / 4);
		writel_relaxed(0, &priv->info->size);
	}

	list_for_each_entry_safe(p, tmp, &priv->segs, list) {
		list_del(&p->list);
		kfree(p);
	}
}

#define IOMAP_SIZE SZ_1M
@@ -922,6 +928,7 @@ int pil_boot(struct pil_desc *desc)
					desc->attrs);
			priv->region = NULL;
		}
		pil_clear_segment(desc);
		pil_release_mmap(desc);
	}
	return ret;