Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp3513607imb; Tue, 5 Mar 2019 11:16:47 -0800 (PST) X-Google-Smtp-Source: APXvYqwsk4iQWCVVxFRj8C4DMKGlPlqYmJx8jMWJD41mGUGZAj4TOH6AAK/eFcWE9s4wEW7MFCJ6 X-Received: by 2002:a17:902:aa06:: with SMTP id be6mr2857340plb.57.1551813407598; Tue, 05 Mar 2019 11:16:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551813407; cv=none; d=google.com; s=arc-20160816; b=GAijoMgIn/IoD94Uudww5rua+wvhrVZLLUjtiJKDfw9LpcfRdKBfKKzq0SHiNRmyVH 3UvfBbHh0PgUenakZsw53QXpIAOj3XElVRetuR5a3cWP/zyZrGE13wK2vtZKIbHH4t/Q 0ZLiFldQ5nM8zKsPMfY8cmeGjSd8gDi8BVj/8VmMv7Ro7mzLHlS7NVfa5RahYs4MsJkR ayQtx11+cbnvJvv43h/6vZ3z9NqOCoFvtuRTw4STqfUyPYkTc0HR8+edyi4LxD0WNLP9 7f/UtR68dvrvd4693d3vqhk3N+OZ6LxtZblXPKlnrEHnuq9q5HR+Yy085hbEKQpPZwVc nsRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=s81Hn40LodeFW3tMTDiMnNX38soGliRkaSDKi58WZ1Y=; b=aYJj6kOS5iWXfHDKf7MkfV7tFw1EOvqi3CnhHs8W6MLI+h29LOX4tO6tw0HGTeSWX8 HvgvswnKr+OZqKWqfkkOEqVuiOI2X1Wqj+exKnl8OtKAYOEOqzrsTYKQr+2mExbPo8dL hvuj6haTi7mG3g3ONqiGuxcbTpGfyQd1fSVfMmE/lzXjY+LnxwudTN9Y8c/hOiQG5Asg VcofMvbNHYKcyEDs/in91sKINaAsFYNERX9m28PWDPWPtIV3jmHToR27/LAZ7kUmi0qA y8hUPqf9a4pqCffNFcOCZsACxNgWlB3+aH1lmJCPQNJ3M97qrmXyULNCbf6DaZPzsMuc O5ug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=gOZK4Y2z; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m9si8829900pgt.73.2019.03.05.11.16.32; Tue, 05 Mar 2019 11:16:47 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=gOZK4Y2z; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726798AbfCETDc (ORCPT + 99 others); Tue, 5 Mar 2019 14:03:32 -0500 Received: from mail-lj1-f195.google.com ([209.85.208.195]:37575 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726445AbfCETDc (ORCPT ); Tue, 5 Mar 2019 14:03:32 -0500 Received: by mail-lj1-f195.google.com with SMTP id a17so8549479ljd.4 for ; Tue, 05 Mar 2019 11:03:31 -0800 (PST) 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=s81Hn40LodeFW3tMTDiMnNX38soGliRkaSDKi58WZ1Y=; b=gOZK4Y2zc80yAAKafM7YgwPJVU0JYjTVv8mUmCeRU2Ma+EL0BB1pdrLc2gjMIq5I31 MhcfwBqbf4ch9sC8ITueN5bUbWmOMhETAyMKa2o/orXpl0Fc5x+pG3XIFPPxOQRKml4k iytEcVlVFY4k3U3Wq+8lI5s2ho1Fqmixps0ss= 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=s81Hn40LodeFW3tMTDiMnNX38soGliRkaSDKi58WZ1Y=; b=QMsdBgC2uPndNryogNrqTPIrBZldxg1eoY6hX/gFQ3eMXvs6SlGXvPvozBMLSaBXqF Ucv8bdWZ/ZStc/AawgvLswDGfF6737lSg1GW2DaEta9Y9OeCHuHGWo5bWrIIk6QAISlN 7b/vGougHj7xo/ou9xMb7kztYuRgv8XaFcju63xWsKpBToI5xS+xyqKU0ZJfbHJ2Vmvj lNA85QJQV8lL8fUXgjXcUhAK6M52ViNmA4vQK1o5HQBHn6jOE+yI4YpBSHM0TUIY7XdI OuX+5xY7AvE8auu43WfTDcg1nFXd1bOEmMNvquE/shTlf69+gg7gV5k1jcD68Hk7Np3B V9Tg== X-Gm-Message-State: APjAAAVEJUkrLN/vJ2PcPP84C2rKObGTe+oVODybir7ASmJ4G1bbZ217 y44cdHtWkmfq6vfnehxMeMJ79I/qqcQ= X-Received: by 2002:a2e:93ca:: with SMTP id p10mr114325ljh.16.1551812609898; Tue, 05 Mar 2019 11:03:29 -0800 (PST) Received: from mail-lj1-f175.google.com (mail-lj1-f175.google.com. [209.85.208.175]) by smtp.gmail.com with ESMTPSA id v20sm2281534ljv.83.2019.03.05.11.03.27 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Mar 2019 11:03:28 -0800 (PST) Received: by mail-lj1-f175.google.com with SMTP id d24so8549491ljc.12 for ; Tue, 05 Mar 2019 11:03:27 -0800 (PST) X-Received: by 2002:a2e:6a18:: with SMTP id f24mr82616ljc.97.1551812607271; Tue, 05 Mar 2019 11:03:27 -0800 (PST) MIME-Version: 1.0 References: <1546318276-18993-1-git-send-email-yong.wu@mediatek.com> <1546318276-18993-4-git-send-email-yong.wu@mediatek.com> <1551278034.17917.52.camel@mhfsdcap03> In-Reply-To: <1551278034.17917.52.camel@mhfsdcap03> From: Evan Green Date: Tue, 5 Mar 2019 11:02:50 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 03/13] iommu/mediatek: Add probe_defer for smi-larb To: Yong Wu Cc: youlin.pei@mediatek.com, "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , Nicolas Boichat , Arnd Bergmann , srv_heupstream@mediatek.com, Greg Kroah-Hartman , Joerg Roedel , Will Deacon , LKML , Tomasz Figa , iommu@lists.linux-foundation.org, Rob Herring , linux-mediatek@lists.infradead.org, Matthias Brugger , yingjoe.chen@mediatek.com, Robin Murphy , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 27, 2019 at 6:34 AM Yong Wu wrote: > > On Mon, 2019-02-25 at 15:54 -0800, Evan Green wrote: > > On Mon, Dec 31, 2018 at 8:52 PM Yong Wu wrote: > > > > > > 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. > > > > > > > I don't quite have enough knowledge of device links to figure out if > > this is a) the right fix, b) a deficiency in the device_links code, or > > c) neither. > > I can not say more about the device link, But from the MTK iommu point > of view, it looks a right fix. As the comment above, we should make sure > the probe sequence, SMI-larb should be before MTK IOMMU which need be > before iommu-consumer. this patch help SMI-larb always is before > MTK_IOMMU. > > Then if there is no this patchset, what the MTK_IOMMU will happen?. > > The MTK_IOMMU is subsys_initcall, all the consume only need after the > MTK_IOMMU and don't need wait for SMI-larb driver. If some consume run > before SMI-larb driver, It also is OK while it don't call > mtk_smi_larb_get in this probe.(Of course it will abort if it call this > while smi-driver don't probe at that time). the consumer and smi-larb > normally are module_init, we can not guarantee the the sequence. it is a > potential issue. > > Some consume know it should wait for SMI-larb like [1], but It don't > work. > > [1] > https://elixir.bootlin.com/linux/v5.0-rc1/source/drivers/media/platform/mtk-mdp/mtk_mdp_comp.c#L145 Ok, I think I get it now. The device_links that get created are enforcing a probe order dependency, but in cases where this driver probes before those device links are even created, then this extra check defers so that the probe order stays correct. Then the device_links were correct to WARN because they're basically saying, "hey, you asked us to enforce a particular dependency, but I can already see probe is happening in an order that violates that dependency". Is that right? -Evan