mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Matthias Brugger <matthias.bgg@gmail.com>
To: Mauro Carvalho Chehab <mchehab@kernel.org>,
	Yong Wu <yong.wu@mediatek.com>
Cc: Hans Verkuil <hverkuil@xs4all.nl>, Joerg Roedel <jroedel@suse.de>,
	Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>,
	David Airlie <airlied@linux.ie>,
	Evan Green <evgreen@chromium.org>,
	Robin Murphy <robin.murphy@arm.com>,
	Tomasz Figa <tfiga@chromium.org>,
	Will Deacon <will.deacon@arm.com>,
	linux-mediatek@lists.infradead.org, srv_heupstream@mediatek.com,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	iommu@lists.linux-foundation.org, youlin.pei@mediatek.com,
	Matthias Kaehlcke <mka@chromium.org>,
	anan.sun@mediatek.com, yi.kuo@mediatek.com,
	acourbot@chromium.org, linux-media@vger.kernel.org,
	dri-devel@lists.freedesktop.org, Daniel Vetter <daniel@ffwll.ch>,
	Chun-Kuang Hu <chunkuang.hu@kernel.org>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	Tiffany Lin <tiffany.lin@mediatek.com>,
	Dafna Hirschfeld <dafna.hirschfeld@collabora.com>,
	Hsin-Yi Wang <hsinyi@chromium.org>,
	Eizan Miyamoto <eizan@chromium.org>,
	anthony.huang@mediatek.com,
	Frank Wunderlich <frank-w@public-files.de>,
	mingyuan.ma@mediatek.com, yf.wang@mediatek.com,
	libo.kang@mediatek.com,
	AngeloGioacchino Del Regno 
	<angelogioacchino.delregno@collabora.com>
Subject: Re: [PATCH v10 02/13] iommu/mediatek-v1: Free the existed fwspec if the master dev already has
Date: Mon, 31 Jan 2022 13:29:51 +0100	[thread overview]
Message-ID: <5991ad51-4181-d445-284c-386447cffb95@gmail.com> (raw)
In-Reply-To: <20220128134540.00c6c380@coco.lan>



On 28/01/2022 13:45, Mauro Carvalho Chehab wrote:
> Em Fri, 28 Jan 2022 13:40:55 +0100
> Mauro Carvalho Chehab <mchehab@kernel.org> escreveu:
> 
>> Hi Matthias/Yong,
>>
>> Are you ok if this patch gets merged via the media tree together with the
>> remaining series, or do you prefer to apply it via SoC tree instead?
> 
> Same questions for other patches touching files outside drivers/media
> on this pull request:
> 
> 	https://patchwork.kernel.org/project/linux-mediatek/patch/7af52d61-47c7-581d-62ed-76a7f8315b16@xs4all.nl/
> 

Looks good to me.

Please let me know once you accepted the pull request and I'll queue the DTS 
related changes from this series.

Regards,
Matthias

> Like those:
> 	0004-0013-iommu-mediatek-v1-Free-the-existed-fwspec-if-the-mas.patch
> 	0005-0013-iommu-mediatek-Return-ENODEV-if-the-device-is-NULL.patch
> 	0006-0013-iommu-mediatek-Add-probe_defer-for-smi-larb.patch
> 	0007-0013-iommu-mediatek-Add-device_link-between-the-consumer-.patch
> 
> Regards,
> Mauro
> 
>>
>> Regards,
>> Mauro
>>
>>
>> Em Mon, 17 Jan 2022 15:04:59 +0800
>> Yong Wu <yong.wu@mediatek.com> escreveu:
>>
>>> When the iommu master device enters of_iommu_xlate, the ops may be
>>> NULL(iommu dev is defered), then it will initialize the fwspec here:
>>>
>>> [<c0c9c5bc>] (dev_iommu_fwspec_set) from [<c06bda80>]
>>> (iommu_fwspec_init+0xbc/0xd4)
>>> [<c06bd9c4>] (iommu_fwspec_init) from [<c06c0db4>]
>>> (of_iommu_xlate+0x7c/0x12c)
>>> [<c06c0d38>] (of_iommu_xlate) from [<c06c10e8>]
>>> (of_iommu_configure+0x144/0x1e8)
>>>
>>> BUT the mtk_iommu_v1.c only supports arm32, the probing flow still is a bit
>>> weird. We always expect create the fwspec internally. otherwise it will
>>> enter here and return fail.
>>>
>>> static int mtk_iommu_create_mapping(struct device *dev,
>>> 				    struct of_phandle_args *args)
>>> {
>>>          ...
>>> 	if (!fwspec) {
>>> 	        ....
>>> 	} else if (dev_iommu_fwspec_get(dev)->ops != &mtk_iommu_ops) {
>>>                  >>>>>>>>>>Enter here. return fail.<<<<<<<<<<<<
>>> 		return -EINVAL;
>>> 	}
>>> 	...
>>> }
>>>
>>> Thus, Free the existed fwspec if the master device already has fwspec.
>>>
>>> This issue is reported at:
>>> https://lore.kernel.org/linux-mediatek/trinity-7d9ebdc9-4849-4d93-bfb5-429dcb4ee449-1626253158870@3c-app-gmx-bs01/
>>>
>>> Reported-by: Frank Wunderlich <frank-w@public-files.de>
>>> Tested-by: Frank Wunderlich <frank-w@public-files.de> # BPI-R2/MT7623
>>> Signed-off-by: Yong Wu <yong.wu@mediatek.com>
>>> Acked-by: Joerg Roedel <jroedel@suse.de>
>>> Acked-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
>>> ---
>>>   drivers/iommu/mtk_iommu_v1.c | 9 +++++++++
>>>   1 file changed, 9 insertions(+)
>>>
>>> diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c
>>> index be22fcf988ce..1467ba1e4417 100644
>>> --- a/drivers/iommu/mtk_iommu_v1.c
>>> +++ b/drivers/iommu/mtk_iommu_v1.c
>>> @@ -425,6 +425,15 @@ static struct iommu_device *mtk_iommu_probe_device(struct device *dev)
>>>   	struct mtk_iommu_data *data;
>>>   	int err, idx = 0;
>>>   
>>> +	/*
>>> +	 * In the deferred case, free the existed fwspec.
>>> +	 * Always initialize the fwspec internally.
>>> +	 */
>>> +	if (fwspec) {
>>> +		iommu_fwspec_free(dev);
>>> +		fwspec = dev_iommu_fwspec_get(dev);
>>> +	}
>>> +
>>>   	while (!of_parse_phandle_with_args(dev->of_node, "iommus",
>>>   					   "#iommu-cells",
>>>   					   idx, &iommu_spec)) {
>>
>>
>>
>> Thanks,
>> Mauro
> 
> 
> 
> Thanks,
> Mauro

  reply	other threads:[~2022-01-31 12:30 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-17  7:04 [PATCH v10 00/13] Clean up "mediatek,larb" Yong Wu
2022-01-17  7:04 ` [PATCH v10 01/13] dt-binding: mediatek: Get rid of mediatek,larb for multimedia HW Yong Wu
2022-01-17  7:04 ` [PATCH v10 02/13] iommu/mediatek-v1: Free the existed fwspec if the master dev already has Yong Wu
2022-01-28 12:40   ` Mauro Carvalho Chehab
2022-01-28 12:45     ` Mauro Carvalho Chehab
2022-01-31 12:29       ` Matthias Brugger [this message]
2022-01-17  7:05 ` [PATCH v10 03/13] iommu/mediatek: Return ENODEV if the device is NULL Yong Wu
2022-01-17  7:05 ` [PATCH v10 04/13] iommu/mediatek: Add probe_defer for smi-larb Yong Wu
2022-01-17  7:05 ` [PATCH v10 05/13] iommu/mediatek: Add device_link between the consumer and the larb devices Yong Wu
2022-01-17  7:05 ` [PATCH v10 06/13] media: mtk-jpeg: Get rid of mtk_smi_larb_get/put Yong Wu
2022-01-17  7:05 ` [PATCH v10 07/13] media: mtk-mdp: " Yong Wu
2022-01-17  7:05 ` [PATCH v10 08/13] drm/mediatek: Add pm runtime support for ovl and rdma Yong Wu
2022-01-17  7:05 ` [PATCH v10 09/13] drm/mediatek: Get rid of mtk_smi_larb_get/put Yong Wu
2022-01-17  7:05 ` [PATCH v10 10/13] media: mtk-vcodec: " Yong Wu
2022-01-17  7:05 ` [PATCH v10 11/13] memory: mtk-smi: " Yong Wu
2022-01-17  7:05 ` [PATCH v10 12/13] arm: dts: mediatek: Get rid of mediatek,larb for MM nodes Yong Wu
2022-01-17  7:05 ` [PATCH v10 13/13] arm64: " Yong Wu
2022-01-17 10:27 ` [PATCH v10 00/13] Clean up "mediatek,larb" AngeloGioacchino Del Regno
2022-01-17 11:49   ` Matthias Brugger
2022-01-17 12:04     ` Hans Verkuil
2022-01-31  9:47     ` Hans Verkuil

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=5991ad51-4181-d445-284c-386447cffb95@gmail.com \
    --to=matthias.bgg@gmail.com \
    --cc=acourbot@chromium.org \
    --cc=airlied@linux.ie \
    --cc=anan.sun@mediatek.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=anthony.huang@mediatek.com \
    --cc=chunkuang.hu@kernel.org \
    --cc=dafna.hirschfeld@collabora.com \
    --cc=daniel@ffwll.ch \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=eizan@chromium.org \
    --cc=evgreen@chromium.org \
    --cc=frank-w@public-files.de \
    --cc=hsinyi@chromium.org \
    --cc=hverkuil@xs4all.nl \
    --cc=iommu@lists.linux-foundation.org \
    --cc=jroedel@suse.de \
    --cc=krzysztof.kozlowski@canonical.com \
    --cc=libo.kang@mediatek.com \
    --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=mchehab@kernel.org \
    --cc=mingyuan.ma@mediatek.com \
    --cc=mka@chromium.org \
    --cc=p.zabel@pengutronix.de \
    --cc=robh+dt@kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=srv_heupstream@mediatek.com \
    --cc=tfiga@chromium.org \
    --cc=tiffany.lin@mediatek.com \
    --cc=will.deacon@arm.com \
    --cc=yf.wang@mediatek.com \
    --cc=yi.kuo@mediatek.com \
    --cc=yong.wu@mediatek.com \
    --cc=youlin.pei@mediatek.com \
    /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

all inboxes | Powered by JetHome®