Received: by 2002:a05:7412:f589:b0:e2:908c:2ebd with SMTP id eh9csp61606rdb; Tue, 31 Oct 2023 00:01:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE3fj1qLj0n8Di4vepoi1rTDc5wccCm2inwdXymQAvLpBOesgc/VT7RCPkcJl8hjDvJH4NT X-Received: by 2002:a05:6a20:144f:b0:157:d7cd:ebd with SMTP id a15-20020a056a20144f00b00157d7cd0ebdmr16747137pzi.1.1698735659931; Tue, 31 Oct 2023 00:00:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698735659; cv=none; d=google.com; s=arc-20160816; b=AjB6QY6sQAKzLMIismAUl4iRL/w38ndV+OBmUh0nqCAScyY41WFlOJuUZjzIkEHlwa fyCUMkwB49mDmZEQxSzJflv7wsHdNf16l9BTH/aPiY0e41Z/KEnJ6nY9sDCgOPe3cMjx jT4Gvf+ExCTx5DnU/vru4WoDQnHnhk3kKuNo4IW9MBy8WaxlyP9VwbCqJUCq6vlJwfJc E3vl1XVf6PAdIZqmN9fJloLvY/e1FpjQqZuJYrXw6VWxhSn2CPTDiCMT0S3z5mfULCkx oWuYBSMxT7/qsVRshijv+Hh3neDIt8gu6qaLXgaHaV6SGIdz8eNr1NQ5Odyzvb8x9vgL D8dQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Et7rEizvlU5X05Mu83XB5kHjY2IMfFJbDhChFRtBzCA=; fh=oyPHf/2DaoRmdRwIgn9mtXgVPU3T0Px6E0zXmiwKbxQ=; b=0NipyW34eHiZN7ETHys+xkPLhBwCJzUFM8xKWAD6Zr9VAuPAXdnlFmh4Z33t+dyFE1 GuChy/cFiaAQIGtXopeCrConf72o/O8pbrbf4BSJM0+Y7Qz4rurB417fGg9QvfPO0pEJ YSSXLOWOnA+u1w63WmmbeY2sW/c4m2us9Gx/tHMaznEbvtYNEbrO6q8j+6qFp2He+BTh JasRaRfeFHkubqiof1cXwOjXNQ0nymznrb4iszpP3zxwd8q881YVISVreyr4GFJ2AOCz a84gIOIlHPRofBYfimn2qzueLdeoZA9o3LG23kqQtj8OBe/IuWGa33dgrr8D8uzow1gL MdpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ESlHlmb1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id d17-20020a056a0010d100b0068fcf6fe22csi589384pfu.304.2023.10.31.00.00.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 00:00:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ESlHlmb1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id D809B808285A; Tue, 31 Oct 2023 00:00:33 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236565AbjJaG6H (ORCPT + 99 others); Tue, 31 Oct 2023 02:58:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229954AbjJaG6G (ORCPT ); Tue, 31 Oct 2023 02:58:06 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F7DFC0 for ; Mon, 30 Oct 2023 23:58:04 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 492B2C433C7; Tue, 31 Oct 2023 06:58:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1698735484; bh=HdAiznUxhcZXhph48HNgf6qwmxfrkOwTlXXXo/pqitg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ESlHlmb1+47hH7FJttzJCOocaB1rSSWN7vgtgaDpPydStmBvlebLsgdgBNM+h2lLp YlNYUYa5B2TXzkQWCwlqMYL4O2UY0SHwXst3MU5iMri1Yl4ME0TRi9xLxmswjoFDJH TKpopbRGjuHLePvSOtXrtNGUMxNNL67+Rzd7WJkE= Date: Tue, 31 Oct 2023 07:58:00 +0100 From: Greg Kroah-Hartman To: Tingwei Zhang Cc: Masami Hiramatsu , "Rafael J. Wysocki" , linux-kernel@vger.kernel.org, Trilok Soni , Jinlong Mao Subject: Re: How to pass software configuration to driver built as module in boot up phase Message-ID: <2023103108-guacamole-neurotic-f59b@gregkh> References: <1c001c6f-9902-4803-9406-39e3325422bf@quicinc.com> <2023103021-revolving-clapper-632d@gregkh> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.3 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Tue, 31 Oct 2023 00:00:34 -0700 (PDT) On Tue, Oct 31, 2023 at 10:56:23AM +0800, Tingwei Zhang wrote: > On 10/30/2023 7:30 PM, Greg Kroah-Hartman wrote: > > On Mon, Oct 30, 2023 at 07:21:48PM +0800, Tingwei Zhang wrote: > > > Hi Masami, Greg and Rafael, > > > > > > I have one driver that needs a bunch to software configuration like 1000 > > > settings. These settings can be different according to the use case. > > > > That seems very odd, what type of driver is this? > The example use case is below DCC driver which is a DMA engine. It can be > configured to read/write registers while whose registers need to be > configured by software. It's mainly used to debug device crash issue. > https://lore.kernel.org/lkml/cover.1691496290.git.quic_schowdhu@quicinc.com/T/ Given that no one listened to my last review cycle of that driver, why are you asking us again? > > > They are required in boot up phase so we can't reply on user space to make > > > the configuration. > > > > > > Boot config is not preferred since we'd like to build that driver as dynamic > > > load Kernel module. > > > > > > Could you let me know if there's any mechanism in Kernel to do that? > > > > What is wrong with the existing ways of doing this that all other > > drivers use? > I'm not aware of all the existing ways. Below ways are what I know and they > may not be suitable for some reason. > 1. Let user space to configure with sysfs/debugfs/ioctl interface. Since we > need this configuration to be done in early stage before user space is up. I really doubt that you need this before userspace starts, as that's not what "device crash" stuff should be dealing with. That happens after init starts, because you have a working kernel (i.e. this is not for hardware bringup.) > This doesn't work. Why do you need this before init? Specific reasons please. > 2. Use device tree to pass the configuration to driver. Since the > configuration is software configuration instead of hardware descirption. It > doesn't fit in device tree. > 3. Boot config or commandline parameter. If the driver is built in, it can > work. But it doesn't work for dynamically loadable Kernel module. If you have a module, then you can do this after init starts, so you are reporting conflicting "requirements" here, which make this impossible for us to understand :( Please work with the kernel developers at your company to come up with a solution for this, you have the experience, do not require the community to do your work for you. thanks, greg k-h