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

Commit 606367d5 authored by Vikram Mulukutla's avatar Vikram Mulukutla
Browse files

subsys-pil_tz: Use a separate device for allocating metadata



Allocate metadata memory with a separate device so as
to not impose requirements on the memory associated with
the PIL device.

Change-Id: I4c817b7fdb1fe4f97d000481ab34c0fdf25e2781
Signed-off-by: default avatarVikram Mulukutla <markivx@codeaurora.org>
parent 819dc946
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -585,6 +585,7 @@ static int pil_init_image_trusted(struct pil_desc *pil,
	dma_addr_t mdata_phys;
	int ret;
	DEFINE_DMA_ATTRS(attrs);
	struct device dev = {0};

	if (d->subsys_desc.no_auth)
		return 0;
@@ -592,9 +593,10 @@ static int pil_init_image_trusted(struct pil_desc *pil,
	ret = scm_pas_enable_bw();
	if (ret)
		return ret;

	dev.coherent_dma_mask =
		DMA_BIT_MASK(sizeof(dma_addr_t) * 8);
	dma_set_attr(DMA_ATTR_STRONGLY_ORDERED, &attrs);
	mdata_buf = dma_alloc_attrs(pil->dev, size, &mdata_phys, GFP_KERNEL,
	mdata_buf = dma_alloc_attrs(&dev, size, &mdata_phys, GFP_KERNEL,
					&attrs);
	if (!mdata_buf) {
		pr_err("scm-pas: Allocation for metadata failed.\n");
@@ -610,7 +612,7 @@ static int pil_init_image_trusted(struct pil_desc *pil,
	ret = scm_call(SCM_SVC_PIL, PAS_INIT_IMAGE_CMD, &request,
			sizeof(request), &scm_ret, sizeof(scm_ret));

	dma_free_attrs(pil->dev, size, mdata_buf, mdata_phys, &attrs);
	dma_free_attrs(&dev, size, mdata_buf, mdata_phys, &attrs);
	scm_pas_disable_bw();
	if (ret)
		return ret;