Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp6599503pxv; Thu, 29 Jul 2021 19:56:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJze3fmjOYMzo6TZuN2SFaUPxxMH8/DS8AattmRIhSzYZxdOe7neNxy9GnK0kGw568BM67zf X-Received: by 2002:a05:6402:1456:: with SMTP id d22mr303817edx.143.1627613781216; Thu, 29 Jul 2021 19:56:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627613781; cv=none; d=google.com; s=arc-20160816; b=ijfYq82ktcz5SfvbLotLJrVpG3LGMrmAKNfOCTrFArx6gfO7ubGbFu6Rv7oXSFbvVD o9uM+eCE8AVBnEBJKHMx6Nf5c16k9b6uqyFTZWT7zqWLrlpzIs8SinMKJu26MVMKEQCj hSieBeETULFdo8Xqy4InOekdqL+JjxcvEZ1t3UcJR2lsU6v3SGymwUtEbCnPlrl6CgrJ 6MIt+E+R7OWK13a2j9aFOifbEZTFyiL1svnAhhkVoVIYM7k9trcfwiGFQKRqKGEG3xb8 TBURyZUCGtnJLzQwX0QzKVeopPGCAss5jEddAoGAkeS3eidJ9UcadhsjxOGGPVwtJUHl Xeog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=oRaBWNuny13TFRclIUkLvCZcb89e4foz8iaZxW5D+w0=; b=S4A+Ejv5IL3gtfbIQ4yS9PUZ7BSrAHcOTxZVnpMxm0uNCKDqgJmj6A1wjrxFGkxu3j Dy9Pdj166HdluYTiz9X0QpES2AFp5igIF3BVwKbp73Int9HkzkF6mczvgYTXiH/gEfiL mqlWkN/1BUGU53bAaqsiDPvwyY12TWhc8qpE/YAWTUmgk3+JciqgVh2dGGOapg0HBBAe SfcshIvMMPhLWSIPO+gWOy9fUXhXs7KO3GLpFgm35nyUd2NoNV4r0fDIlN++t6viKBPA qznS8d+JzgPB2i+KRTY98OMlkGzzbDPrivrPuKKITfNalsjUYeIyA3BeGALJDlBQ3oIW KX4g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id nd8si392240ejc.657.2021.07.29.19.55.58; Thu, 29 Jul 2021 19:56:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232725AbhG3CyK (ORCPT + 99 others); Thu, 29 Jul 2021 22:54:10 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:49926 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S234520AbhG3CyH (ORCPT ); Thu, 29 Jul 2021 22:54:07 -0400 X-UUID: b00803b2a0fb4783a18130c43510f914-20210730 X-UUID: b00803b2a0fb4783a18130c43510f914-20210730 Received: from mtkexhb01.mediatek.inc [(172.21.101.102)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1608042048; Fri, 30 Jul 2021 10:54:00 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs07n1.mediatek.inc (172.21.101.16) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 30 Jul 2021 10:53:58 +0800 Received: from localhost.localdomain (10.17.3.153) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Fri, 30 Jul 2021 10:53:54 +0800 From: Yong Wu To: Matthias Brugger , Joerg Roedel , Rob Herring , Krzysztof Kozlowski , David Airlie , Mauro Carvalho Chehab CC: Evan Green , Robin Murphy , Tomasz Figa , Will Deacon , , , , , , , , , Nicolas Boichat , Matthias Kaehlcke , , , , , , , Daniel Vetter , Chun-Kuang Hu , Philipp Zabel , Xia Jiang , Tiffany Lin , Dafna Hirschfeld , Hsin-Yi Wang , Eizan Miyamoto , , Frank Wunderlich Subject: [PATCH v7 03/12] iommu/mediatek: Add probe_defer for smi-larb Date: Fri, 30 Jul 2021 10:52:29 +0800 Message-ID: <20210730025238.22456-4-yong.wu@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20210730025238.22456-1-yong.wu@mediatek.com> References: <20210730025238.22456-1-yong.wu@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Prepare for adding device_link. The iommu consumer should use device_link to connect with the smi-larb(supplier). then the smi-larb should run before the iommu consumer. Here we delay the iommu driver until the smi driver is ready, then all the iommu consumer always is after the smi driver. When there is no this patch, if some consumer drivers run before smi-larb, the supplier link_status is DL_DEV_NO_DRIVER(0) in the device_link_add, then device_links_driver_bound will use WARN_ON to complain that the link_status of supplier is not right. Signed-off-by: Yong Wu Tested-by: Dafna Hirschfeld # on mt8173 --- drivers/iommu/mtk_iommu.c | 2 +- drivers/iommu/mtk_iommu_v1.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/mtk_iommu.c b/drivers/iommu/mtk_iommu.c index 6f7c69688ce2..a02dde094788 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -855,7 +855,7 @@ static int mtk_iommu_probe(struct platform_device *pdev) id = i; plarbdev = of_find_device_by_node(larbnode); - if (!plarbdev) { + if (!plarbdev || !plarbdev->dev.driver) { of_node_put(larbnode); return -EPROBE_DEFER; } diff --git a/drivers/iommu/mtk_iommu_v1.c b/drivers/iommu/mtk_iommu_v1.c index 6861eeab182d..c259433f1130 100644 --- a/drivers/iommu/mtk_iommu_v1.c +++ b/drivers/iommu/mtk_iommu_v1.c @@ -603,7 +603,7 @@ static int mtk_iommu_probe(struct platform_device *pdev) } plarbdev = of_find_device_by_node(larbnode); - if (!plarbdev) { + if (!plarbdev || !plarbdev->dev.driver) { of_node_put(larbnode); return -EPROBE_DEFER; } -- 2.18.0