Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp5857491rwp; Mon, 17 Jul 2023 10:27:27 -0700 (PDT) X-Google-Smtp-Source: APBJJlGHNj2N5FtcStxk6A2G+lXLYPMVf2IVQODJKoNMP1DpA23iZQ5grEwruztB2ona+1kVdmbv X-Received: by 2002:a17:90a:7449:b0:262:fbb0:8737 with SMTP id o9-20020a17090a744900b00262fbb08737mr11583782pjk.33.1689614847043; Mon, 17 Jul 2023 10:27:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689614847; cv=none; d=google.com; s=arc-20160816; b=Ma78IQwdSmaGc+Md4HCK/AT5obH7/jr0s+Gzy/hB/5rsE8Q56yzYzcuMYmwtPyghlL HzBKmgDbKfFE3hX9n40zs0w+l+y4xKSR7fRv8/oiWhsk5EcfxOw9X2SlfSXKG7E6EQc4 2U7cYmJsRutlafPG7TXVCBwUb0cKQwnGHQfGtC0xyBtUUb8P/1uT4z+Xxr7kFosMyg7b mhJaznVUeCVvAzu5XX/8Zu2D7xra4dyUGZ8S+m9Ywi3VBsDNr68u3voNy4hTp339DlRQ kV0vWhUP4vpfcHizYWbp82PFVv/6FgY5kMjl/QpuYGhEghDafHRRj5o9B1fbgK5Nr/nB Ofbw== 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=w0I5EMtbYS3j+AKjv33kbEHo0UQXhMoWN0LIIyFGBCE=; fh=IYgqeSjKM8ssIKPhfx1gWJKrDYVks9miokYVQ2A7dro=; b=h6dtDxgOeOG6rXBYxcVJSvXci/08fHepAAojD5JW+4h4T3W1cZuBsvmGOmxCollRpw rx1T/TTifcC9Gjk+ReIdjtb+DsGqkHrx3GFsiZ3xsSCr54r8qz2ME0QSdWPcY3RiBAF9 KjwpdhZuQSTDDubJvjQvdCsdeNxna/ky5F00Mu6WrxrhwyrGwHHP602q2nXjEwodc114 HwssmEozhdgrX2SIKezVlO7FDOuAlqMKnIX8TdbNDkZVjqEOQM3143lRTPeY47rOH2lO YlPmZmCsVdPp40WpDLVH174Heu8eXIFZOVVJnLjHUm5i5zz7l6FZ3eiG3uN9/cjlQWY9 9EWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MIx1Ml97; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t8-20020a17090aba8800b0025defcc6e75si129962pjr.172.2023.07.17.10.27.14; Mon, 17 Jul 2023 10:27:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MIx1Ml97; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230211AbjGQQ76 (ORCPT + 99 others); Mon, 17 Jul 2023 12:59:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58358 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230199AbjGQQ75 (ORCPT ); Mon, 17 Jul 2023 12:59:57 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29197E1 for ; Mon, 17 Jul 2023 09:59:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B298161182 for ; Mon, 17 Jul 2023 16:59:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BBC7DC433C7; Mon, 17 Jul 2023 16:59:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1689613195; bh=otdaFhyLKG+XHCXyb9xUtpzUYG/IftW+/iX9ZL3v1oo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=MIx1Ml97/RaJkcUh9lRv0d/pz49piIYrmHAK/4Eb4lnHirGTLR/mSuNDfoBzjQW/T vi5PKE6/TtKJ4kIchW3JpStwWALkj25rzroPr0qq2aQOlwkjJkBYvrlSsR0vKkkfmL PRSg4kJiyq9iV6mYahecmAq9DPJkgoN8kB46Uz9c= Date: Mon, 17 Jul 2023 18:59:52 +0200 From: Greg Kroah-Hartman To: Miquel Raynal Cc: Srinivas Kandagatla , linux-kernel@vger.kernel.org, Thomas Petazzoni , Robert Marko , Luka Perkov , Michael Walle , Randy Dunlap Subject: Re: [PATCH v6 3/3] nvmem: core: Expose cells through sysfs Message-ID: <2023071724-twiddling-morale-157e@gregkh> References: <20230717075147.43326-1-miquel.raynal@bootlin.com> <20230717075147.43326-4-miquel.raynal@bootlin.com> <2023071717-channel-supernova-4cc9@gregkh> <20230717183323.49a55ad0@xps-13> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230717183323.49a55ad0@xps-13> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 17, 2023 at 06:33:23PM +0200, Miquel Raynal wrote: > Hi Greg, > > gregkh@linuxfoundation.org wrote on Mon, 17 Jul 2023 16:32:09 +0200: > > > On Mon, Jul 17, 2023 at 09:51:47AM +0200, Miquel Raynal wrote: > > > The binary content of nvmem devices is available to the user so in the > > > easiest cases, finding the content of a cell is rather easy as it is > > > just a matter of looking at a known and fixed offset. However, nvmem > > > layouts have been recently introduced to cope with more advanced > > > situations, where the offset and size of the cells is not known in > > > advance or is dynamic. When using layouts, more advanced parsers are > > > used by the kernel in order to give direct access to the content of each > > > cell, regardless of its position/size in the underlying > > > device. Unfortunately, these information are not accessible by users, > > > unless by fully re-implementing the parser logic in userland. > > > > > > Let's expose the cells and their content through sysfs to avoid these > > > situations. Of course the relevant NVMEM sysfs Kconfig option must be > > > enabled for this support to be available. > > > > > > Not all nvmem devices expose cells. Indeed, the .bin_attrs attribute > > > group member will be filled at runtime only when relevant and will > > > remain empty otherwise. In this case, as the cells attribute group will > > > be empty, it will not lead to any additional folder/file creation. > > > > > > Exposed cells are read-only. There is, in practice, everything in the > > > core to support a write path, but as I don't see any need for that, I > > > prefer to keep the interface simple (and probably safer). The interface > > > is documented as being in the "testing" state which means we can later > > > add a write attribute if though relevant. > > > > > > There is one limitation though: if a layout is built as a module but is > > > not properly installed in the system and loaded manually with insmod > > > while the nvmem device driver was built-in, the cells won't appear in > > > sysfs. But if done like that, the cells won't be usable by the built-in > > > kernel drivers anyway. > > > > Wait, what? That should not be an issue here, if so, then this change > > is not correct and should be fixed as this is NOT an issue for sysfs > > (otherwise the whole tree wouldn't work.) > > > > Please fix up your dependancies if this is somehow not working properly. > > I'm not sure I fully get your point. > > There is no way we can describe any dependency between a storage device > driver and an nvmem layout. NVMEM is a pure software abstraction, the > layout that will be chosen depends on the device tree, but if the > layout has not been installed, there is no existing mechanism in > the kernel to prevent it from being loaded (how do you know it's > not on purpose?). Once a layout has been loaded, the sysfs files should show up, right? Otherwise what does a "layout" do? (hint, I have no idea, it's an odd term to me...) thanks, greg k-h