[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20fec212d49cc3f0479be7a855d9816f5739ce93.camel@mediatek.com>
Date: Mon, 17 Jun 2024 06:53:07 +0000
From: Yong Wu (吴勇) <Yong.Wu@...iatek.com>
To: "tfiga@...omium.org" <tfiga@...omium.org>,
Yunfei Dong (董云飞) <Yunfei.Dong@...iatek.com>
CC: "sumit.semwal@...aro.org" <sumit.semwal@...aro.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-mediatek@...ts.infradead.org" <linux-mediatek@...ts.infradead.org>,
"frkoenig@...omium.org" <frkoenig@...omium.org>, "stevecho@...omium.org"
<stevecho@...omium.org>, "wenst@...omium.org" <wenst@...omium.org>,
"nhebert@...omium.org" <nhebert@...omium.org>, "christian.koenig@....com"
<christian.koenig@....com>, "jstultz@...gle.com" <jstultz@...gle.com>,
"nicolas.dufresne@...labora.com" <nicolas.dufresne@...labora.com>,
"mchehab@...nel.org" <mchehab@...nel.org>, "m.szyprowski@...sung.com"
<m.szyprowski@...sung.com>, "daniel@...ll.ch" <daniel@...ll.ch>,
"linux-media@...r.kernel.org" <linux-media@...r.kernel.org>,
"jkardatzke@...gle.com" <jkardatzke@...gle.com>, "Brian.Starkey@....com"
<Brian.Starkey@....com>, "dri-devel@...ts.freedesktop.org"
<dri-devel@...ts.freedesktop.org>, "sebastian.fricke@...labora.com"
<sebastian.fricke@...labora.com>, "benjamin.gaignard@...labora.com"
<benjamin.gaignard@...labora.com>, "tjmercier@...gle.com"
<tjmercier@...gle.com>, "hverkuil-cisco@...all.nl"
<hverkuil-cisco@...all.nl>, "matthias.bgg@...il.com"
<matthias.bgg@...il.com>, "hsinyi@...omium.org" <hsinyi@...omium.org>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>,
"angelogioacchino.delregno@...labora.com"
<angelogioacchino.delregno@...labora.com>, "nfraprado@...labora.com"
<nfraprado@...labora.com>, Project_Global_Chrome_Upstream_Group
<Project_Global_Chrome_Upstream_Group@...iatek.com>
Subject: Re: [PATCH v6,12/24] media: mediatek: vcodec: add interface to
allocate/free secure memory
On Wed, 2024-06-12 at 14:22 +0900, Tomasz Figa wrote:
>
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
> On Thu, May 16, 2024 at 08:20:50PM +0800, Yunfei Dong wrote:
> > Need to call dma heap interface to allocate/free secure memory when
> playing
> > secure video.
> >
> > Signed-off-by: Yunfei Dong <yunfei.dong@...iatek.com>
> > ---
> > .../media/platform/mediatek/vcodec/Kconfig | 1 +
> > .../mediatek/vcodec/common/mtk_vcodec_util.c | 122
> +++++++++++++++++-
> > .../mediatek/vcodec/common/mtk_vcodec_util.h | 3 +
> > 3 files changed, 123 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/media/platform/mediatek/vcodec/Kconfig
> b/drivers/media/platform/mediatek/vcodec/Kconfig
> > index bc8292232530..707865703e61 100644
> > --- a/drivers/media/platform/mediatek/vcodec/Kconfig
> > +++ b/drivers/media/platform/mediatek/vcodec/Kconfig
> > @@ -17,6 +17,7 @@ config VIDEO_MEDIATEK_VCODEC
[snip]
> > -void mtk_vcodec_mem_free(void *priv, struct mtk_vcodec_mem *mem)
> > +static int mtk_vcodec_mem_alloc_sec(struct mtk_vcodec_dec_ctx
> *ctx, struct mtk_vcodec_mem *mem)
> > +{
> > +struct device *dev = &ctx->dev->plat_dev->dev;
> > +struct dma_buf *dma_buffer;
> > +struct dma_heap *vdec_heap;
> > +struct dma_buf_attachment *attach;
> > +struct sg_table *sgt;
> > +unsigned long size = mem->size;
> > +int ret = 0;
> > +
> > +if (!size)
> > +return -EINVAL;
> > +
> > +vdec_heap = dma_heap_find("restricted_mtk_cma");
> > +if (!vdec_heap) {
> > +mtk_v4l2_vdec_err(ctx, "dma heap find failed!");
> > +return -EPERM;
> > +}
>
> How is the heap name determined here? My recollection is that the
> heap
> name comes from the heap node in the DT, so it may vary depending on
> the
> board.
>
> Is the heap name documented anywhere in the DT bindings?
>
> Shouldn't we rather query DT for a phandle to the right heap?
>
Hi Tomasz,
This heap name does not come from dt-binding. It is hard-coded in the
driver[1]. Because the heap driver is a pure SW driver, there is no
corresponding HW unit, and there is no way to add a dtsi node.
[1]
https://lore.kernel.org/linux-mediatek/20240515112308.10171-10-yong.wu@mediatek.com/
Thanks.
Powered by blists - more mailing lists