From: Matthias Brugger <matthias.bgg@gmail.com>
To: Yong Wu <yong.wu@mediatek.com>, David Airlie <airlied@linux.ie>,
Philipp Zabel <p.zabel@pengutronix.de>,
Hans Verkuil <hans.verkuil@cisco.com>
Cc: Mauro Carvalho Chehab <mchehab@osg.samsung.com>,
Tiffany Lin <tiffany.lin@mediatek.com>,
Honghui Zhang <honghui.zhang@mediatek.com>,
Bibby Hsieh <bibby.hsieh@mediatek.com>,
YT Shen <yt.shen@mediatek.com>, CK Hu <ck.hu@mediatek.com>,
Daniel Kurtz <djkurtz@google.com>, Tomasz Figa <tfiga@google.com>,
Arnd Bergmann <arnd@arndb.de>,
Lucas Stach <l.stach@pengutronix.de>,
youlin.pei@mediatek.com, linux-mediatek@lists.infradead.org,
srv_heupstream@mediatek.com, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
iommu@lists.linux-foundation.org, Joerg Roedel <joro@8bytes.org>
Subject: Re: [PATCH 1/3] memory: mediatek: Add a new interface mtk_smi_larb_is_ready
Date: Mon, 25 Jul 2016 10:39:52 +0200 [thread overview]
Message-ID: <cd01b829-f869-606b-5c1a-8077fbddb085@gmail.com> (raw)
In-Reply-To: <1468983721-3627-1-git-send-email-yong.wu@mediatek.com>
On 20/07/16 05:01, Yong Wu wrote:
> Currently the iommu consumer always call iommu_present to get whether
> the iommu is ready. But in MTK IOMMU, this function can't indicate
> this. The IOMMU call bus_set_iommu->mtk_iommu_add_device->
> mtk_iommu_attach_device to parse the iommu data, then it's able to
> transfer "struct mtk_smi_iommu" to SMI-LARB, and the iommu uses the
> larbs as compoents, the iommu will finish its probe until all the larbs
> probe done.
>
> If the iommu consumer(like DRM) begin to probe after the time of
> calling bus_set_iommu and before the time of SMI probe finish, it
> will hang like this:
>
> [ 7.832359] Call trace:
> [ 7.834778] [<ffffffc000764424>] mtk_smi_larb_get+0x24/0xa8
> [ 7.840300] [<ffffffc0005a1390>] mtk_drm_crtc_enable+0x6c/0x450
>
> Because the larb->mmu is NULL at that time.
>
> In order to avoid this issue, we add a new interface
> (mtk_smi_larb_is_ready) for checking whether the IOMMU and SMI have
> finished their probe. If it return false, the iommu consumer should
> probe-defer for the IOMMU and SMI.
>
Can't we just skip the functions in the probe and call bus_set_iommu
only if we were able to bind all components?
Something like this:
diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c
index c3043d8..0bef49b 100644
--- a/drivers/iommu/mtk_iommu.c
+++ b/drivers/iommu/mtk_iommu.c
@@ -649,10 +649,14 @@ static int mtk_iommu_probe(struct platform_device
*pdev)
if (ret)
return ret;
+ ret = component_master_add_with_match(dev, &mtk_iommu_com_ops,
match);
+ if (ret)
+ return ret;
+
if (!iommu_present(&platform_bus_type))
bus_set_iommu(&platform_bus_type, &mtk_iommu_ops);
- return component_master_add_with_match(dev, &mtk_iommu_com_ops,
match);
+ return ret;
}
static int mtk_iommu_remove(struct platform_device *pdev)
Regards,
Matthias
next prev parent reply other threads:[~2016-07-25 8:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-20 3:01 Yong Wu
2016-07-20 3:02 ` [PATCH 2/3] drm/mediatek: Add probe-defer for MTK IOMMU and SMI Yong Wu
2016-07-20 3:02 ` [PATCH 3/3] vcodec: mediatek: " Yong Wu
2016-07-25 8:39 ` Matthias Brugger [this message]
2016-07-26 1:31 ` [PATCH 1/3] memory: mediatek: Add a new interface mtk_smi_larb_is_ready Yong Wu
2016-07-26 2:30 ` Tomasz Figa
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=cd01b829-f869-606b-5c1a-8077fbddb085@gmail.com \
--to=matthias.bgg@gmail.com \
--cc=airlied@linux.ie \
--cc=arnd@arndb.de \
--cc=bibby.hsieh@mediatek.com \
--cc=ck.hu@mediatek.com \
--cc=djkurtz@google.com \
--cc=hans.verkuil@cisco.com \
--cc=honghui.zhang@mediatek.com \
--cc=iommu@lists.linux-foundation.org \
--cc=joro@8bytes.org \
--cc=l.stach@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=mchehab@osg.samsung.com \
--cc=p.zabel@pengutronix.de \
--cc=srv_heupstream@mediatek.com \
--cc=tfiga@google.com \
--cc=tiffany.lin@mediatek.com \
--cc=yong.wu@mediatek.com \
--cc=youlin.pei@mediatek.com \
--cc=yt.shen@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®