From: "Jason-JH Lin (林睿祥)" <Jason-JH.Lin@mediatek.com>
To: "mripard@kernel.org" <mripard@kernel.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-mediatek@lists.infradead.org"
<linux-mediatek@lists.infradead.org>,
"Singo Chang (張興國)" <Singo.Chang@mediatek.com>,
"linaro-mm-sig@lists.linaro.org" <linaro-mm-sig@lists.linaro.org>,
"linux-media@vger.kernel.org" <linux-media@vger.kernel.org>,
"chunkuang.hu@kernel.org" <chunkuang.hu@kernel.org>,
"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
"jason-jh.lin@mediatek.corp-partner.google.com"
<jason-jh.lin@mediatek.corp-partner.google.com>,
"Jason-ch Chen (陳建豪)" <Jason-ch.Chen@mediatek.com>,
"Shawn Sung (宋孝謙)" <Shawn.Sung@mediatek.com>,
"Nancy Lin (林欣螢)" <Nancy.Lin@mediatek.com>,
"daniel@ffwll.ch" <daniel@ffwll.ch>,
"jkardatzke@google.com" <jkardatzke@google.com>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>,
Project_Global_Chrome_Upstream_Group
<Project_Global_Chrome_Upstream_Group@mediatek.com>,
"airlied@gmail.com" <airlied@gmail.com>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
"angelogioacchino.delregno@collabora.com"
<angelogioacchino.delregno@collabora.com>
Subject: Re: [PATCH v6 0/7] Add mediate-drm secure flow for SVP
Date: Mon, 24 Jun 2024 08:44:02 +0000 [thread overview]
Message-ID: <f8a151ea4cc9772cf5600eca14c8787640a69c93.camel@mediatek.com> (raw)
In-Reply-To: <20240621-colossal-acoustic-cassowary-ee8d05@houat>
Hi Maxime,
On Fri, 2024-06-21 at 11:00 +0200, mripard@kernel.org wrote:
> Hi,
>
> On Tue, Jun 11, 2024 at 09:13:03AM GMT, Jason-JH Lin (林睿祥) wrote:
> > Hi Maxime,
> >
[snip]
> > I have changed user space to use DMA_HEAP_IOCTL_ALLOC to allocate
> > secure buffer, but I still encounter the problem of determining
> > whether
> > the buffer is secure in mediatek-drm driver to add some secure
> > configure for hardware.
> >
> >
> > As the comment in [1], dma driver won't provide API for use.
> > [1]:
> >
https://patchwork.kernel.org/project/linux-mediatek/patch/20240515112308.10171-3-yong.wu@mediatek.com/#25857255
> >
> >
> > So I use name checking at [PATCH v6 3/7] like this currently:
> >
> > struct drm_gem_object *mtk_gem_prime_import_sg_table(struct
> > drm_device
> > *dev,
> > struct dma_buf_attachment *attach, struct sg_table *sg)
> > {
> > struct mtk_gem_obj *mtk_gem;
> >
> > /* check if the entries in the sg_table are contiguous */
> > if (drm_prime_get_contiguous_size(sg) < attach->dmabuf->size) {
> > DRM_ERROR("sg_table is not contiguous");
> > return ERR_PTR(-EINVAL);
> > }
> >
> > mtk_gem = mtk_gem_init(dev, attach->dmabuf->size);
> > if (IS_ERR(mtk_gem))
> > return ERR_CAST(mtk_gem);
> >
> > + mtk_gem->secure = (!strncmp(attach->dmabuf->exp_name,
> > "restricted",
> > 10));
> > mtk_gem->dma_addr = sg_dma_address(sg->sgl);
> > + mtk_gem->size = attach->dmabuf->size;
> > mtk_gem->sg = sg;
> >
> > return &mtk_gem->base;
> > }
> >
> > But I want to change this name checking to the information brought
> > from
> > user space.
> > I tried to use arg->flags to append the secure flag in user space
> > and
> > call drmPrimeHandleToFD() to pass it to DRM driver, but it will be
> > blocked by at the beginning of the drm_prime_handle_to_fd_ioctl().
>
> I agree with you, it's something to discuss mostly with the dma-buf
> maintainers but it would be better to just set a flag on the dma-buf,
> and use that flag whenever necessary.
>
> It might be related to the recent work I did to introduce allocation
> flags too:
>
https://lore.kernel.org/linux-media/20240515-dma-buf-ecc-heap-v1-0-54cbbd049511@kernel.org/
>
Thanks for your information!
I'll discuss with dma-buf maintainer in series [1].
Regards,
Jason-JH Lin
> Maxime
prev parent reply other threads:[~2024-06-24 8:44 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-25 23:29 [PATCH v6 0/7] Add mediate-drm secure flow for SVP Jason-JH.Lin
2024-05-25 23:29 ` [PATCH v6 1/7] drm/mediatek: Add interface to allocate MediaTek GEM buffer Jason-JH.Lin
2024-05-25 23:29 ` [PATCH v6 2/7] drm/mediatek/uapi: Add DRM_MTK_GEM_CREATE_RESTRICTED flag Jason-JH.Lin
2024-05-25 23:29 ` [PATCH v6 3/7] drm/mediatek: Add secure buffer control flow to mtk_drm_gem Jason-JH.Lin
2024-05-25 23:29 ` [PATCH v6 4/7] drm/mediatek: Add secure identify flag and funcution to mtk_drm_plane Jason-JH.Lin
2024-05-25 23:29 ` [PATCH v6 5/7] drm/mediatek: Add mtk_ddp_sec_write() to config secure buffer info Jason-JH.Lin
2024-05-25 23:29 ` [PATCH v6 6/7] drm/mediatek: Add secure flow support to mediatek-drm Jason-JH.Lin
2024-05-25 23:29 ` [PATCH v6 7/7] drm/mediatek: Add cmdq_insert_backup_cookie before secure pkt finalize Jason-JH.Lin
2024-05-27 14:06 ` [PATCH v6 0/7] Add mediate-drm secure flow for SVP Maxime Ripard
2024-05-28 7:15 ` Jason-JH Lin (林睿祥)
2024-05-30 15:01 ` mripard
2024-05-30 16:29 ` Jason-JH Lin (林睿祥)
2024-06-11 9:13 ` Jason-JH Lin (林睿祥)
2024-06-21 9:00 ` mripard
2024-06-24 8:44 ` Jason-JH Lin (林睿祥) [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f8a151ea4cc9772cf5600eca14c8787640a69c93.camel@mediatek.com \
--to=jason-jh.lin@mediatek.com \
--cc=Jason-ch.Chen@mediatek.com \
--cc=Nancy.Lin@mediatek.com \
--cc=Project_Global_Chrome_Upstream_Group@mediatek.com \
--cc=Shawn.Sung@mediatek.com \
--cc=Singo.Chang@mediatek.com \
--cc=airlied@gmail.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=chunkuang.hu@kernel.org \
--cc=daniel@ffwll.ch \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=jason-jh.lin@mediatek.corp-partner.google.com \
--cc=jkardatzke@google.com \
--cc=linaro-mm-sig@lists.linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=mripard@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox