[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZTtJdU5a/P4kg/Ss@infradead.org>
Date: Thu, 26 Oct 2023 22:24:05 -0700
From: Christoph Hellwig <hch@...radead.org>
To: jeshwank <JESHWANTHKUMAR.NK@....com>
Cc: thomas.lendacky@....com, john.allen@....com,
herbert@...dor.apana.org.au, davem@...emloft.net,
jens.wiklander@...aro.org, sumit.garg@...aro.org,
jarkko.nikula@...ux.intel.com, mario.limonciello@....com,
linux-crypto@...r.kernel.org, linux-kernel@...r.kernel.org,
op-tee@...ts.trustedfirmware.org,
Mythri.Pandeshwarakrishna@....com, Devaraj.Rangasamy@....com,
Rijo-john.Thomas@....com, nimesh.easow@....com
Subject: Re: [PATCH 1/3] crypto: ccp - Add function to allocate and free
memory using DMA APIs
On Wed, Oct 25, 2023 at 12:26:58PM +0530, jeshwank wrote:
> + tee_buf->vaddr = dma_alloc_coherent(psp->dev, size, &tee_buf->dma, gfp);
> + if (!tee_buf->vaddr || !tee_buf->dma) {
> + kfree(tee_buf);
> + return NULL;
> + }
> +
> + tee_buf->size = size;
> +
> + /* Check whether IOMMU is present. If present, translate IOVA
> + * to physical address, else the dma handle is the physical
> + * address.
> + */
> + dom = iommu_get_domain_for_dev(psp->dev);
> + if (dom)
> + tee_buf->paddr = iommu_iova_to_phys(dom, tee_buf->dma);
> + else
No, you can't mix the DMA API and iommu API. You need to stick to one
or the other.
Powered by blists - more mailing lists