From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2093BC432BE for ; Tue, 24 Aug 2021 07:35:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id ED8596120A for ; Tue, 24 Aug 2021 07:35:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235119AbhHXHgV (ORCPT ); Tue, 24 Aug 2021 03:36:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235010AbhHXHgP (ORCPT ); Tue, 24 Aug 2021 03:36:15 -0400 Received: from mail-io1-xd2e.google.com (mail-io1-xd2e.google.com [IPv6:2607:f8b0:4864:20::d2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5705C06175F for ; Tue, 24 Aug 2021 00:35:31 -0700 (PDT) Received: by mail-io1-xd2e.google.com with SMTP id a13so25118441iol.5 for ; Tue, 24 Aug 2021 00:35:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=kdn/xtZAvZYiwKwxxhtoDSWZxutSGdv9Zf0EjwepvWk=; b=dFmqKGM4M8xwkez/7hO/m5icTM2376t5o0aNOCOsIxs5i4hiT5sr79kQdXWQq4TEDQ J/MeqGYzCjKUF5OToXwp6ZB4LNLWm37WAs1DA2MsvaACyMGlWLQz+RR81Uv9YdjMjoG2 JqhbsZ+4S6XyrncPUOCD08O7+s+aOQbEB5RHU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=kdn/xtZAvZYiwKwxxhtoDSWZxutSGdv9Zf0EjwepvWk=; b=DKESHth+7rbqSI0/gT5GiEKm8RSAdKAgfHxXwJ5o9aIC6QDKhl8TrZMSHc+Fj3PqaD uO2abq4P2lGUcKMkrs9IBreX8jT5PrBZYa0s9/5G2AnKQSH5vNoC4MLcqg8ngrsu8qUb I3NMcjp98qrYwhdFKKBoyDaN43JzAHmaRJlpCKYL79MOSBLVwdzKDL2tTIU4kgIw13AR T621Hyfii+Fpcu220ty4Ucpe6PUv5l7frjs6PSnDwrwPs8ee1CNIMtk10BgWfak2YYpe 0oSMGqXfufNP17IH+fHmaOiSgBo081JtcGpkNNyhVqUo0P/1P//Rln3dlpr9ticvtHqA Qcgw== X-Gm-Message-State: AOAM53296A4qqukhHLcT/xNMdGPj8yjc2NYvLpeOPqP6Ikl8kXQT9NIS Phodbbjli1UlmZVUKZHQV0O4LSDv4sSSHYvyCvD4fg== X-Google-Smtp-Source: ABdhPJzCaKQQqFiKu2GYGl51DjDrCHWW0khxqU+TJuIKD2Qiaa6IC9r0Xva1qe+ermS6tmqpaGovvcP+MP7vZ5pGN64= X-Received: by 2002:a6b:6319:: with SMTP id p25mr30729776iog.100.1629790531099; Tue, 24 Aug 2021 00:35:31 -0700 (PDT) MIME-Version: 1.0 References: <20210813065324.29220-1-yong.wu@mediatek.com> <20210813065324.29220-17-yong.wu@mediatek.com> In-Reply-To: <20210813065324.29220-17-yong.wu@mediatek.com> From: Hsin-Yi Wang Date: Tue, 24 Aug 2021 15:35:05 +0800 Message-ID: Subject: Re: [PATCH v2 16/29] iommu/mediatek: Adjust device link when it is sub-common To: Yong Wu Cc: Joerg Roedel , Rob Herring , Matthias Brugger , Will Deacon , Robin Murphy , Krzysztof Kozlowski , Evan Green , Tomasz Figa , Tomasz Figa , "moderated list:ARM/Mediatek SoC support" , srv_heupstream@mediatek.com, Devicetree List , lkml , "moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE" , iommu@lists.linux-foundation.org, youlin.pei@mediatek.com, Nicolas Boichat , anan.sun@mediatek.com, chao.hao@mediatek.com Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 13, 2021 at 3:03 PM Yong Wu wrote: > > For MM IOMMU, We always add device link between smi-common and IOMMU HW. > In mt8195, we add smi-sub-common. Thus, if the node is sub-common, we still > need find again to get smi-common, then do device link. > > Signed-off-by: Yong Wu > --- > drivers/iommu/mtk_iommu.c | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c > index a4479916ad33..a72241724adb 100644 > --- a/drivers/iommu/mtk_iommu.c > +++ b/drivers/iommu/mtk_iommu.c > @@ -845,6 +845,17 @@ static int mtk_iommu_mm_dts_parse(struct device *dev, > if (!smicomm_node) > return -EINVAL; > > + /* Find smi-common again if this is smi-sub-common */ > + if (of_property_read_bool(smicomm_node, "mediatek,smi_sub_common")) { > + of_node_put(smicomm_node); /* put the sub common */ > + > + smicomm_node = of_parse_phandle(smicomm_node, "mediatek,smi", 0); This only checks 1 level here, and does not check if the mediatek,smi of a sub-common node is not another sub-common node. So maybe add a check that the updated node here doesn't have mediatek,smi_sub_common property. > + if (!smicomm_node) { > + dev_err(dev, "sub-comm has no common.\n"); > + return -EINVAL; > + } > + } > + > plarbdev = of_find_device_by_node(smicomm_node); > of_node_put(smicomm_node); > data->smicomm_dev = &plarbdev->dev; > -- > 2.18.0 > _______________________________________________ > Linux-mediatek mailing list > Linux-mediatek@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-mediatek From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D0976C4338F for ; Tue, 24 Aug 2021 07:35:44 +0000 (UTC) Received: from smtp2.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 75ADD6120A for ; Tue, 24 Aug 2021 07:35:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 75ADD6120A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.linux-foundation.org Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 3E8CA400E7; Tue, 24 Aug 2021 07:35:44 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ibKKrmxP70df; Tue, 24 Aug 2021 07:35:39 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp2.osuosl.org (Postfix) with ESMTPS id A8472400BA; Tue, 24 Aug 2021 07:35:38 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 73CCEC0010; Tue, 24 Aug 2021 07:35:38 +0000 (UTC) Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) by lists.linuxfoundation.org (Postfix) with ESMTP id DF4FCC000E for ; Tue, 24 Aug 2021 07:35:36 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id C78A040494 for ; Tue, 24 Aug 2021 07:35:36 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp4.osuosl.org (amavisd-new); dkim=pass (1024-bit key) header.d=chromium.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id T2RPBm3QFMWa for ; Tue, 24 Aug 2021 07:35:32 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 Received: from mail-io1-xd35.google.com (mail-io1-xd35.google.com [IPv6:2607:f8b0:4864:20::d35]) by smtp4.osuosl.org (Postfix) with ESMTPS id 022404047E for ; Tue, 24 Aug 2021 07:35:31 +0000 (UTC) Received: by mail-io1-xd35.google.com with SMTP id b7so25163629iob.4 for ; Tue, 24 Aug 2021 00:35:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=kdn/xtZAvZYiwKwxxhtoDSWZxutSGdv9Zf0EjwepvWk=; b=dFmqKGM4M8xwkez/7hO/m5icTM2376t5o0aNOCOsIxs5i4hiT5sr79kQdXWQq4TEDQ J/MeqGYzCjKUF5OToXwp6ZB4LNLWm37WAs1DA2MsvaACyMGlWLQz+RR81Uv9YdjMjoG2 JqhbsZ+4S6XyrncPUOCD08O7+s+aOQbEB5RHU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=kdn/xtZAvZYiwKwxxhtoDSWZxutSGdv9Zf0EjwepvWk=; b=j6WnEdCIxbzNdWatHOVbWBHtnKaaFoclct0IS6zrDDe//80ORwdkkmxQ44sN1Sbxls knNd0KzaEytUqXjRjDQhigrPb+wuPjozcgRMhj+yjgBqSxyjt7klHLBbDqJGdvUYHMFj lD5qQOt7GKbVLz7MH4zu4HFUW3dM+/cJRwsyR2DQmgwP8HAIYgC5yjfSjRaXFwpnkaCc Xon4Fp/vmlvNz2wCszH152CVqQifD7Xv2YlWxxF93cmydoJgIQl4HfVcUGhEJyWslihp FV5ccsbR7wv6THSODX/E4Ocg2iMBxs41isXUo+slmqFLdScsk8uw7NRnjjgx3Oh4MMX6 vXPw== X-Gm-Message-State: AOAM532M/cXykXWy6VMibDqImZ6DugSvqoAHohy9BOL9Re2XAJbsy27k E/wC9oLy+7Gz62UD9CeQrgHnZGFR3mqVWF7ir2nocQ== X-Google-Smtp-Source: ABdhPJzCaKQQqFiKu2GYGl51DjDrCHWW0khxqU+TJuIKD2Qiaa6IC9r0Xva1qe+ermS6tmqpaGovvcP+MP7vZ5pGN64= X-Received: by 2002:a6b:6319:: with SMTP id p25mr30729776iog.100.1629790531099; Tue, 24 Aug 2021 00:35:31 -0700 (PDT) MIME-Version: 1.0 References: <20210813065324.29220-1-yong.wu@mediatek.com> <20210813065324.29220-17-yong.wu@mediatek.com> In-Reply-To: <20210813065324.29220-17-yong.wu@mediatek.com> From: Hsin-Yi Wang Date: Tue, 24 Aug 2021 15:35:05 +0800 Message-ID: Subject: Re: [PATCH v2 16/29] iommu/mediatek: Adjust device link when it is sub-common To: Yong Wu Cc: youlin.pei@mediatek.com, Devicetree List , Nicolas Boichat , srv_heupstream@mediatek.com, Krzysztof Kozlowski , Will Deacon , lkml , Evan Green , Tomasz Figa , iommu@lists.linux-foundation.org, Rob Herring , "moderated list:ARM/Mediatek SoC support" , chao.hao@mediatek.com, Matthias Brugger , anan.sun@mediatek.com, Robin Murphy , "moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE" X-BeenThere: iommu@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Development issues for Linux IOMMU support List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: iommu-bounces@lists.linux-foundation.org Sender: "iommu" On Fri, Aug 13, 2021 at 3:03 PM Yong Wu wrote: > > For MM IOMMU, We always add device link between smi-common and IOMMU HW. > In mt8195, we add smi-sub-common. Thus, if the node is sub-common, we still > need find again to get smi-common, then do device link. > > Signed-off-by: Yong Wu > --- > drivers/iommu/mtk_iommu.c | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c > index a4479916ad33..a72241724adb 100644 > --- a/drivers/iommu/mtk_iommu.c > +++ b/drivers/iommu/mtk_iommu.c > @@ -845,6 +845,17 @@ static int mtk_iommu_mm_dts_parse(struct device *dev, > if (!smicomm_node) > return -EINVAL; > > + /* Find smi-common again if this is smi-sub-common */ > + if (of_property_read_bool(smicomm_node, "mediatek,smi_sub_common")) { > + of_node_put(smicomm_node); /* put the sub common */ > + > + smicomm_node = of_parse_phandle(smicomm_node, "mediatek,smi", 0); This only checks 1 level here, and does not check if the mediatek,smi of a sub-common node is not another sub-common node. So maybe add a check that the updated node here doesn't have mediatek,smi_sub_common property. > + if (!smicomm_node) { > + dev_err(dev, "sub-comm has no common.\n"); > + return -EINVAL; > + } > + } > + > plarbdev = of_find_device_by_node(smicomm_node); > of_node_put(smicomm_node); > data->smicomm_dev = &plarbdev->dev; > -- > 2.18.0 > _______________________________________________ > Linux-mediatek mailing list > Linux-mediatek@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-mediatek _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id ED7A3C4338F for ; Tue, 24 Aug 2021 07:36:24 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A9C4D610FF for ; Tue, 24 Aug 2021 07:36:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A9C4D610FF Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=DbNQ+5yxymN2vcUygS0BLP5mHEV0b2e4n38RNiOyzjE=; b=WRO99oZ2Y3AuFo vvab4FRu/BS0WtA4V0wt24x5Bt4nKmplOa71e1iI3taMSVZI9iyQDwZ5dpuGXqh/ihklR96z9MehM M22UcfuBc3/9mAFI0p/hLXvxiwsZsg+ZE4k3PrWzpxf9D0ZNayCCu335Ko/rsPBTHEFb7cSHqWf7o K2BXQQVlZE9aKGPStqZ4CJphiJnEHAp6nPBWm7u3ObRAYFHmU04mZ2HIjvnF06Z3nfg+jpemTKY20 Ut8xV158nWkModCFSKtpp/Jo8UFyA7cmXC+/TZLoN8jrL7J+MHZi4XcNlc4x5gs/odT88RH2NeAP8 TYNvfd4C6U0Gue0pPdmg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mIQyf-0023lu-Hy; Tue, 24 Aug 2021 07:36:09 +0000 Received: from mail-io1-xd2d.google.com ([2607:f8b0:4864:20::d2d]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mIQyE-0023iZ-QD for linux-mediatek@lists.infradead.org; Tue, 24 Aug 2021 07:35:47 +0000 Received: by mail-io1-xd2d.google.com with SMTP id f6so17605353iox.0 for ; Tue, 24 Aug 2021 00:35:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=kdn/xtZAvZYiwKwxxhtoDSWZxutSGdv9Zf0EjwepvWk=; b=dFmqKGM4M8xwkez/7hO/m5icTM2376t5o0aNOCOsIxs5i4hiT5sr79kQdXWQq4TEDQ J/MeqGYzCjKUF5OToXwp6ZB4LNLWm37WAs1DA2MsvaACyMGlWLQz+RR81Uv9YdjMjoG2 JqhbsZ+4S6XyrncPUOCD08O7+s+aOQbEB5RHU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=kdn/xtZAvZYiwKwxxhtoDSWZxutSGdv9Zf0EjwepvWk=; b=Yx25pfXcUsGn44dYSCbIPMBrgOaKaJAwx0ucsRh+Wbbe7Xr7f7Jxy0tutcbAGWpp7M 7pTwKxapThzp7uBMrJ8uLWuDvzd+KhLcRtUzSrbT8Nfy0C4HAolG5Ep/qrvqB6vbgVkc jM5sVWavHmlsxWH3F2boeFLNQzHwaux2/6kRc7hDNAm+vRCuXW6y9lsGI6xpCtQgbjPB zsNiHcjV5pjr47P7jzIv+3HfQLUN4PZir9Kv69idNuV5VOU+9j08WWpHobMyRzeXPvwY vhlHVWVvtMwA48dNdNppkDxfAHwngzWKbJUYRiIVtfzPiwFHFs3Oc9uVqLGpKUfj+8d1 ZiaA== X-Gm-Message-State: AOAM530PV1G5JYWVq8KeSjSC7MuVudDTAxQUG759cqQuc7FhFCAJl7HB YPHZ+7Ay9XM+8D1bNsamO1XIN1E2BNerIyN1PpGCEA== X-Google-Smtp-Source: ABdhPJzCaKQQqFiKu2GYGl51DjDrCHWW0khxqU+TJuIKD2Qiaa6IC9r0Xva1qe+ermS6tmqpaGovvcP+MP7vZ5pGN64= X-Received: by 2002:a6b:6319:: with SMTP id p25mr30729776iog.100.1629790531099; Tue, 24 Aug 2021 00:35:31 -0700 (PDT) MIME-Version: 1.0 References: <20210813065324.29220-1-yong.wu@mediatek.com> <20210813065324.29220-17-yong.wu@mediatek.com> In-Reply-To: <20210813065324.29220-17-yong.wu@mediatek.com> From: Hsin-Yi Wang Date: Tue, 24 Aug 2021 15:35:05 +0800 Message-ID: Subject: Re: [PATCH v2 16/29] iommu/mediatek: Adjust device link when it is sub-common To: Yong Wu Cc: Joerg Roedel , Rob Herring , Matthias Brugger , Will Deacon , Robin Murphy , Krzysztof Kozlowski , Evan Green , Tomasz Figa , Tomasz Figa , "moderated list:ARM/Mediatek SoC support" , srv_heupstream@mediatek.com, Devicetree List , lkml , "moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE" , iommu@lists.linux-foundation.org, youlin.pei@mediatek.com, Nicolas Boichat , anan.sun@mediatek.com, chao.hao@mediatek.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210824_003542_901705_258578AC X-CRM114-Status: GOOD ( 23.22 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org On Fri, Aug 13, 2021 at 3:03 PM Yong Wu wrote: > > For MM IOMMU, We always add device link between smi-common and IOMMU HW. > In mt8195, we add smi-sub-common. Thus, if the node is sub-common, we still > need find again to get smi-common, then do device link. > > Signed-off-by: Yong Wu > --- > drivers/iommu/mtk_iommu.c | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c > index a4479916ad33..a72241724adb 100644 > --- a/drivers/iommu/mtk_iommu.c > +++ b/drivers/iommu/mtk_iommu.c > @@ -845,6 +845,17 @@ static int mtk_iommu_mm_dts_parse(struct device *dev, > if (!smicomm_node) > return -EINVAL; > > + /* Find smi-common again if this is smi-sub-common */ > + if (of_property_read_bool(smicomm_node, "mediatek,smi_sub_common")) { > + of_node_put(smicomm_node); /* put the sub common */ > + > + smicomm_node = of_parse_phandle(smicomm_node, "mediatek,smi", 0); This only checks 1 level here, and does not check if the mediatek,smi of a sub-common node is not another sub-common node. So maybe add a check that the updated node here doesn't have mediatek,smi_sub_common property. > + if (!smicomm_node) { > + dev_err(dev, "sub-comm has no common.\n"); > + return -EINVAL; > + } > + } > + > plarbdev = of_find_device_by_node(smicomm_node); > of_node_put(smicomm_node); > data->smicomm_dev = &plarbdev->dev; > -- > 2.18.0 > _______________________________________________ > Linux-mediatek mailing list > Linux-mediatek@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-mediatek _______________________________________________ Linux-mediatek mailing list Linux-mediatek@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-mediatek From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 23BB4C4338F for ; Tue, 24 Aug 2021 07:38:18 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E1D4A61246 for ; Tue, 24 Aug 2021 07:38:17 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E1D4A61246 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=+38MlN2J2H+TP4ntsA/OGyTNaAUYvaWa5hBmWCTT9EE=; b=S4bw0n4fvAfoVV iVxyFJaSMW93jG1LZb4JG3IjRwNQX6odCc7IuthD+LVBg3CwA2dET4nV4J7CW/KXfKBWQgmyLMgwQ vPuJcYSI/AFZpk0HvP2d1WrLXUIUqejW2H2EclbNEdoClurs1Cid7lZKMyN2eJtSUMnAqGn3NL8O3 neSTJi3GQTO/90xjVPYp0DeDVDevgJMURkDyB5KDHCalNPkBg64sv6pWcXCF2MfOWDwRgWyTFqoPQ 6tdWRtLX9jsMvXs/PDbBMedKOU0zbg+0ZZBh6foMmvpsoZ0dWf8718nxz3TSHCI7Biu1VXYFjZQUr DppEDfqQxPV64hxNZGUw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mIQyM-0023kK-3F; Tue, 24 Aug 2021 07:35:50 +0000 Received: from mail-io1-xd2e.google.com ([2607:f8b0:4864:20::d2e]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mIQyE-0023iY-PK for linux-arm-kernel@lists.infradead.org; Tue, 24 Aug 2021 07:35:46 +0000 Received: by mail-io1-xd2e.google.com with SMTP id e186so25121406iof.12 for ; Tue, 24 Aug 2021 00:35:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=kdn/xtZAvZYiwKwxxhtoDSWZxutSGdv9Zf0EjwepvWk=; b=dFmqKGM4M8xwkez/7hO/m5icTM2376t5o0aNOCOsIxs5i4hiT5sr79kQdXWQq4TEDQ J/MeqGYzCjKUF5OToXwp6ZB4LNLWm37WAs1DA2MsvaACyMGlWLQz+RR81Uv9YdjMjoG2 JqhbsZ+4S6XyrncPUOCD08O7+s+aOQbEB5RHU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=kdn/xtZAvZYiwKwxxhtoDSWZxutSGdv9Zf0EjwepvWk=; b=Yv8ugrFHtCVVGM1SkFN1ZXMzAatISfYr9rnb/ZwLCa3a4GweOZ/Jy23hE1Dmi9ukdg cpIpHAmKIkRUwEdZ4/2kj4iOQxWYe7KUNZ6PhdgoiipHx1bb6LUpiKFXhZmstxyV0rZR 2TTALGzMhfyL+6dRkstJrPA/7ifRXC2TvXR87RZFLDZuB6caZie5/ZQvs5W7SrcsQLnF NFoAdL3yo7dnjjS7K5LbCjFfTpcnNsaGKjFER8yf7HWmUbNa2/7ZS+gnjzQftF3ebaNP nkQUUVYuy2ax9kgPfy6EHvV3ijYbFYd2Vg8TPFxBrDORzM12HpX7PlX/58IITqutGOfy mHtg== X-Gm-Message-State: AOAM532eJ3bW5bPq9gAlzlHvvfPzNsgd7MpLiyPVM2zSvlJl7hNqIr1G 5oB5x1hU2q/kj7Nr0ndAWzDB7OIwLG4rlUL6mZUh0A== X-Google-Smtp-Source: ABdhPJzCaKQQqFiKu2GYGl51DjDrCHWW0khxqU+TJuIKD2Qiaa6IC9r0Xva1qe+ermS6tmqpaGovvcP+MP7vZ5pGN64= X-Received: by 2002:a6b:6319:: with SMTP id p25mr30729776iog.100.1629790531099; Tue, 24 Aug 2021 00:35:31 -0700 (PDT) MIME-Version: 1.0 References: <20210813065324.29220-1-yong.wu@mediatek.com> <20210813065324.29220-17-yong.wu@mediatek.com> In-Reply-To: <20210813065324.29220-17-yong.wu@mediatek.com> From: Hsin-Yi Wang Date: Tue, 24 Aug 2021 15:35:05 +0800 Message-ID: Subject: Re: [PATCH v2 16/29] iommu/mediatek: Adjust device link when it is sub-common To: Yong Wu Cc: Joerg Roedel , Rob Herring , Matthias Brugger , Will Deacon , Robin Murphy , Krzysztof Kozlowski , Evan Green , Tomasz Figa , Tomasz Figa , "moderated list:ARM/Mediatek SoC support" , srv_heupstream@mediatek.com, Devicetree List , lkml , "moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE" , iommu@lists.linux-foundation.org, youlin.pei@mediatek.com, Nicolas Boichat , anan.sun@mediatek.com, chao.hao@mediatek.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210824_003542_901578_6C2EAA98 X-CRM114-Status: GOOD ( 24.53 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Aug 13, 2021 at 3:03 PM Yong Wu wrote: > > For MM IOMMU, We always add device link between smi-common and IOMMU HW. > In mt8195, we add smi-sub-common. Thus, if the node is sub-common, we still > need find again to get smi-common, then do device link. > > Signed-off-by: Yong Wu > --- > drivers/iommu/mtk_iommu.c | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c > index a4479916ad33..a72241724adb 100644 > --- a/drivers/iommu/mtk_iommu.c > +++ b/drivers/iommu/mtk_iommu.c > @@ -845,6 +845,17 @@ static int mtk_iommu_mm_dts_parse(struct device *dev, > if (!smicomm_node) > return -EINVAL; > > + /* Find smi-common again if this is smi-sub-common */ > + if (of_property_read_bool(smicomm_node, "mediatek,smi_sub_common")) { > + of_node_put(smicomm_node); /* put the sub common */ > + > + smicomm_node = of_parse_phandle(smicomm_node, "mediatek,smi", 0); This only checks 1 level here, and does not check if the mediatek,smi of a sub-common node is not another sub-common node. So maybe add a check that the updated node here doesn't have mediatek,smi_sub_common property. > + if (!smicomm_node) { > + dev_err(dev, "sub-comm has no common.\n"); > + return -EINVAL; > + } > + } > + > plarbdev = of_find_device_by_node(smicomm_node); > of_node_put(smicomm_node); > data->smicomm_dev = &plarbdev->dev; > -- > 2.18.0 > _______________________________________________ > Linux-mediatek mailing list > Linux-mediatek@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-mediatek _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel