Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp175526pxb; Tue, 28 Sep 2021 18:40:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxm57scnaCou4AdBogqf7vxtIw4f8OE2gKDsqIZUXpq33oCCseZPBG6KPmUeZTMM8CUNU6o X-Received: by 2002:a17:906:a195:: with SMTP id s21mr10204555ejy.181.1632879621356; Tue, 28 Sep 2021 18:40:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632879621; cv=none; d=google.com; s=arc-20160816; b=qYRHg+mGUWVlhDz29qBbd3kVttgoq01JZ7oizN+fAxGJ8NYhG0R5ZCakZGKERWZVdw jCigMfLilR08SrUKJTGlDBqUCkEZDLqcjtpr5BalWC2nG8vd6gcWmhvvs36CWbeuH4xy ZwaCV5n+Q2jVpGUW8dEqarGepAUrLYg/IQXOAcBF27S92x573k2+fsTXFQ6Bw8EtuSRZ ijLA48mgir3OfRliT5JU7YHSb5bHD0AaG24WPefwpqq7s/3Aqi5+aidFn1WIjqdsIxMm kKQKw4wLzqwVpNXAsmNRiZkUwcqgiksgLy8XsBJ7A54D68Kd/+YNl/cAHvTF+orezp+x DK2w== 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=vT8raI3+yxJ3BrYIlnAG4ZPmRXX71txLauIsE1imf1w=; b=sIp20GdicMEjUPAzYBGqj7tbl3ylikHSENxG3p375McMEiDDNlSj7dpLWcXfdQgCy7 e+vVtckJJAaGJ+v5uP28xwfXERmA4sf82Apz6nVS3fEbhscrjoslNdNkxaUWcM6uKqFK AOqhdV1+JkmFCXXthpi+lVnTCVYKW39527pv2l73xkhrgfA6oEtmGUvL70IhBCcDavxq SOFoeEvNG7U4tkYiCIKVte/2rgsj0hb7ImZEq9phh1I0gQB1EmvUgyuU03vVyzeoGq+K MyXf0Cg2A+fH97ek1fyTxAlOT+63iJS5rlHehb5fgg6fLfMdr+qlm3RhzfQguehTkp5H bMjA== 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 w14si1268064edd.343.2021.09.28.18.39.57; Tue, 28 Sep 2021 18:40: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 S243669AbhI2Bjo (ORCPT + 99 others); Tue, 28 Sep 2021 21:39:44 -0400 Received: from mailgw01.mediatek.com ([60.244.123.138]:48778 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S243663AbhI2Bjn (ORCPT ); Tue, 28 Sep 2021 21:39:43 -0400 X-UUID: 3a91f8ebd81e49abbd15d3a7ee6ced54-20210929 X-UUID: 3a91f8ebd81e49abbd15d3a7ee6ced54-20210929 Received: from mtkcas10.mediatek.inc [(172.21.101.39)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1737975104; Wed, 29 Sep 2021 09:38:00 +0800 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs10n2.mediatek.inc (172.21.101.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.792.3; Wed, 29 Sep 2021 09:37:58 +0800 Received: from localhost.localdomain (10.17.3.154) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 29 Sep 2021 09:37:56 +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 , , , , , , , , , Matthias Kaehlcke , , , , , , Daniel Vetter , Chun-Kuang Hu , Philipp Zabel , Tiffany Lin , "Dafna Hirschfeld" , Hsin-Yi Wang , Eizan Miyamoto , , Frank Wunderlich Subject: [PATCH v8 03/12] iommu/mediatek: Add probe_defer for smi-larb Date: Wed, 29 Sep 2021 09:37:10 +0800 Message-ID: <20210929013719.25120-4-yong.wu@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20210929013719.25120-1-yong.wu@mediatek.com> References: <20210929013719.25120-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 consumers always are 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. device_is_bound may be more elegant here. but it is not allowed to EXPORT from https://lore.kernel.org/patchwork/patch/1334670/. Signed-off-by: Yong Wu Tested-by: Frank Wunderlich # BPI-R2/MT7623 --- 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 d837adfd1da5..d5848f78a677 100644 --- a/drivers/iommu/mtk_iommu.c +++ b/drivers/iommu/mtk_iommu.c @@ -844,7 +844,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 1467ba1e4417..4d7809432239 100644 --- a/drivers/iommu/mtk_iommu_v1.c +++ b/drivers/iommu/mtk_iommu_v1.c @@ -602,7 +602,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