Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2412770pxb; Mon, 19 Apr 2021 05:18:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzeCAotblgC74OyZ7L4daI4muVvWYUCWcPdkDQoqFyFXewcZjkfWtyLPVE6c0UawA8oA0wt X-Received: by 2002:a17:906:b09:: with SMTP id u9mr15822574ejg.244.1618834685275; Mon, 19 Apr 2021 05:18:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618834685; cv=none; d=google.com; s=arc-20160816; b=odT/ZfdWn1pVy+lq8cEBNYQtaRwdIUnhOiWqhcW3c/nTMz6cfMVQgyGs4IOnMt46/y JgTCtg4o0iDEeA229IcqCzQh6mfFdRgNjlLQ33dGQjQA4CH4oLrbxuef1auDfOwX3UhD 91vXKQH38y8WiWFQTrhy/dfri1Du4FdS+dJkKsma/e+akdXJwoGD4NFgIvOWw/B78+FA dhv+qG7oy2Be6cLxczif6OO6lsOhxbU8FFtIlfXP7emabnmerL1ya4j+vMglnBAVqqZX Uzc5klx60b/tI/aDWAquB8XOf9YiZN36T5dRp1yoO5qfcjJMFARaATGOvc9Kko4ap+Nx vSEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=Jte4PESVCyOxZgmueTIRmzESggoF2gOLGuf4QLB+EB0=; b=aYFDN7/1CiJwODxk01QpaISKi8AkvMxznxB2lnJiSz0oZQ9065+tC3HderFz6EgGC/ Y3NxSIGmpE1B3FRAbyNineFudGKriHsHrkd2BgFHv2aoHhmGIxMzZIbvtmOF29OfxcmB DslOV7cX+5EeODwrV01kFDOUdBfyh3wmqYDOYpM9+IH+A1HRw+8jhA98ETufEzQO18pk g2BNqBPjI6N8dlWxfResyJijtmxycZa6gV8ygsFVfiO/b1Ul5oeNyf9fPhpW1+2dVoOO j3d/IFnnpD+4b8uWFUT398A303cCoUUGtsRmLyFCoGyiPEZK2h1S8l3lST+/r+OyFmTW tRKQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f1si11489441ejx.485.2021.04.19.05.17.33; Mon, 19 Apr 2021 05:18:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-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-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239097AbhDSMRi (ORCPT + 99 others); Mon, 19 Apr 2021 08:17:38 -0400 Received: from mout.kundenserver.de ([212.227.126.133]:49693 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239056AbhDSMRg (ORCPT ); Mon, 19 Apr 2021 08:17:36 -0400 Received: from mail-wr1-f45.google.com ([209.85.221.45]) by mrelayeu.kundenserver.de (mreue012 [213.165.67.97]) with ESMTPSA (Nemesis) id 1McIYO-1m4VGN1dSm-00cdhN; Mon, 19 Apr 2021 14:17:03 +0200 Received: by mail-wr1-f45.google.com with SMTP id a4so33804401wrr.2; Mon, 19 Apr 2021 05:17:03 -0700 (PDT) X-Gm-Message-State: AOAM530v/yBC/2XYq7ELiJsOKT38utH8V09hnr+DbReIt0QSUowLKCu9 qzJPWUNHn5H0Tj77oevy9M0tidTBIegyWgN+ZY8= X-Received: by 2002:a05:6000:1843:: with SMTP id c3mr14679907wri.361.1618834612186; Mon, 19 Apr 2021 05:16:52 -0700 (PDT) MIME-Version: 1.0 References: <20210419042722.27554-1-alice.guo@oss.nxp.com> <20210419042722.27554-4-alice.guo@oss.nxp.com> In-Reply-To: From: Arnd Bergmann Date: Mon, 19 Apr 2021 14:16:36 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC v1 PATCH 3/3] driver: update all the code that use soc_device_match To: Dominique MARTINET Cc: Geert Uytterhoeven , "Alice Guo (OSS)" , gregkh , Rafael Wysocki , =?UTF-8?Q?Horia_Geant=C4=83?= , aymen.sghaier@nxp.com, Herbert Xu , David Miller , Tony Lindgren , Geert Uytterhoeven , Michael Turquette , Stephen Boyd , Vinod Koul , peter.ujfalusi@gmail.com, Andrzej Hajda , Neil Armstrong , Robert Foss , David Airlie , Daniel Vetter , Kevin Hilman , tomba@kernel.org, jyri.sarha@iki.fi, Joerg Roedel , Will Deacon , Mauro Carvalho Chehab , Ulf Hansson , Adrian Hunter , Kishon , Jakub Kicinski , Linus Walleij , Roy Pledge , Leo Li , Santosh Shilimkar , Matthias Brugger , Eduardo Valentin , Keerthy , Felipe Balbi , Tony Prisk , Alan Stern , Wim Van Sebroeck , Guenter Roeck , Linux Kernel Mailing List , "open list:HARDWARE RANDOM NUMBER GENERATOR CORE" , linux-omap , Linux-Renesas , linux-clk , dmaengine@vger.kernel.org, dri-devel , "open list:ARM/Amlogic Meson SoC support" , Linux ARM , "open list:IOMMU DRIVERS" , Linux Media Mailing List , linux-mmc , Networking , linux-phy@lists.infradead.org, "open list:GPIO SUBSYSTEM" , linuxppc-dev , linux-staging@lists.linux.dev, "moderated list:ARM/Mediatek SoC..." , Linux PM list , USB list , LINUXWATCHDOG Content-Type: text/plain; charset="UTF-8" X-Provags-ID: V03:K1:P71GUur0c8Et4KTdfK062CelxJMlxDzHdi6foeZVMrh68Tz4kVO xXC4vz+qe3LvNC/lTgY8q6jr08cIcxgzzrqqwLuy4gBjPze3CRaFI6Tn0ivsylYkqTjCGCd UznPeEk90qstnxb0iWNZx7FG5N+vrUigS/VNsT3W/kFEpTHiyw396kNMzzFJBTjXO+naZJ+ Cfu35e3pJq/mHwP5LQM/Q== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:Tj0dSv4OACg=:QLuHKXqc+6Lj41NGnufoGl N+UnlZp25078q227oT0o/4kxbd0mQOAoQ/NCUKgnVsoYmGtmK6mEBskoottCNbYunStcV9NF4 wE8ToQWQ05B3nZv4Vjj9qNbaiSwQl2/EIEpHx8+6DQaiGM4h6uplPIOIDeaZjltt02tsjjmk7 kxpSU+zIeAbNwqmXYSk5Vm3CpYS1xMcDA6Eiv0+uZeBUE0kKjN4jwkU6+BKG/eaq+T9ufKwnD crSJLI+V67wSaKUzbHccJ3EU1Sb6dMM2cPoEC3Av6tRhuAXiX84+lOxtkljO1IFE9iL1JBVn5 CjGxqnLONV0vManrkRS3zSk/dqMTqKx9iNczeHNAz+sKCK3kGK1HvvAI82zCriMShj36q2Yiu latEFCHqqv6CzIpzD2Q+F98/Rh3nVZdyFAqvuM6r16X0t/3dzAs72dYw+jzCHok5qetil5Q2V 5rdGScTR8+ZhGbwiKRQyQ6I2CQTnccKZ549zJci96NqNdfUe5jbzVwZOI0walCavZ7GVu0d2F jvOU246bo6oNPkDzH9c2gJBnZtcrzAKb4pwtF9+3cOiLZPnCE0nY+1vjm75YQHDBCyxvLdR64 g4tTIuRlUg3P8XaXbJiPp80y/nkM8kt4yG+up76tnDKMDxMpP5a+pkpQ1YQ2I6y3uojN6bE8n CFp8= Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Mon, Apr 19, 2021 at 11:33 AM Dominique MARTINET wrote: > Geert Uytterhoeven wrote on Mon, Apr 19, 2021 at 11:03:24AM +0200: > > > soc_device_match() should only be used as a last resort, to identify > > systems that cannot be identified otherwise. Typically this is used for > > quirks, which should only be enabled on a very specific subset of > > systems. IMHO such systems should make sure soc_device_match() > > is available early, by registering their SoC device early. > > I definitely agree there, my suggestion to defer was only because I know > of no other way to influence the ordering of drivers loading reliably > and gave up on soc being init'd early. In some cases, you can use the device_link infrastructure to deal with dependencies between devices. Not sure if this would help in your case, but have a look at device_link_add() etc in drivers/base/core.c > In this particular case the problem is that since 7d981405d0fd ("soc: > imx8m: change to use platform driver") the soc probe tries to use the > nvmem driver for ocotp fuses for imx8m devices, which isn't ready yet. > So soc loading gets pushed back to the end of the list because it gets > defered and other drivers relying on soc_device_match get confused > because they wrongly think a device doesn't match a quirk when it > actually does. > > If there is a way to ensure the nvmem driver gets loaded before the soc, > that would also solve the problem nicely, and avoid the need to mess > with all the ~50 drivers which use it. > > Is there a way to control in what order drivers get loaded? Something in > the dtb perhaps? For built-in drivers, load order depends on the initcall level and link order (how things are lined listed in the Makefile hierarchy). For loadable modules, this is up to user space in the end. Which of the drivers in this scenario are loadable modules? Arnd