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=-1.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,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 E56FCC43381 for ; Tue, 5 Mar 2019 19:08:52 +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 A6D8F205F4 for ; Tue, 5 Mar 2019 19:08:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="pbTrulFI"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="gOZK4Y2z" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A6D8F205F4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id: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=uCO2he06O6J06vvi2qFHnKNaNkno5JeKgcLHh+LiJsU=; b=pbTrulFI/yzutA Vy8Zr70aEQjIJiaotKMzxZkf6Y7t8j5m+L1JplHpLLh0mlZ4uvyWcguMpli8Mqt8ETG0Vtu3CpiGu Giva9jtVN/f8fcBKnX7wBkrLI/B2oWA+magThSekkA4UJIvS6aeUV+/79HlfnBtH8xH9F6ZaqbJ+3 AhfNV7D93Q5MQdiMR10H0Kr6S0mHttIm/+o64kjKAJEesdPE4LuP1CYIFwZ/rftd5qR/Ljr52Ob4a L1jY8OyAjonWjPydE4gblNbMXfYQUn3xj/PKigyfTW/vQEkfzMN46kfrMLCNozPEJbnnl8tWDBf1v hoDhnre1Nho9jz8QaN5g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h1FQn-0006na-C8; Tue, 05 Mar 2019 19:08:49 +0000 Received: from mail-lj1-x244.google.com ([2a00:1450:4864:20::244]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h1FQj-0006mv-8F for linux-arm-kernel@lists.infradead.org; Tue, 05 Mar 2019 19:08:46 +0000 Received: by mail-lj1-x244.google.com with SMTP id g80so8571365ljg.6 for ; Tue, 05 Mar 2019 11:08:44 -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=eMvG5ONvuANPDy2Cr4+IDTF77OANNa3KzC9exQRSen5lgdmQvOPr3btEj+sHgknfOa dPJLfg4N1uSjJFs+P9kAv8hwWTchQyiOV7KiBzjZrtViq49T7VLxoOTnEeO8koMV8Klt w3wQKdai78M6Jspg2hrBBKsOPYMzhaFMK8yEom5cJbXvzgTorl0Cw+7bl+U+rV83eSE4 UlqIZzdx07g12ynguDMwqWrg9mDsXJLl5mqzTT4S/90t1nU8yMwweM2Hg7qCc010p4dx xE6JdQMomqu+XM1feVI/jZOTiS8tB+5h74J2my/6kNZ4CGLX7yJhEFevAq0GGuRtqEDP BBCw== X-Gm-Message-State: APjAAAVlekk0ZxPP5o343BLFFi3HKgFy+7Aa4G5PtjVsTViObVoldAwt 5mDAsLnD6x/JT7IgT9srx7h644VTjE4= X-Google-Smtp-Source: APXvYqyGABN0C2FLvYeH6SQzmhaJtgsv8zmQfKiRhuZPusqT+AjlvXgUe6KGKQ8kpkdtIP6oZl3WCg== X-Received: by 2002:a2e:8092:: with SMTP id i18mr97680ljg.91.1551812922728; Tue, 05 Mar 2019 11:08:42 -0800 (PST) Received: from mail-lj1-x22b.google.com (mail-lj1-x22b.google.com. [2a00:1450:4864:20::22b]) by smtp.gmail.com with ESMTPSA id f9sm2309313ljc.56.2019.03.05.11.08.42 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Mar 2019 11:08:42 -0800 (PST) Received: by mail-lj1-x22b.google.com with SMTP id d14so8586840ljl.9 for ; Tue, 05 Mar 2019 11:08:42 -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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190305_110845_322793_D383FC22 X-CRM114-Status: GOOD ( 22.70 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel