Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp1050732lql; Tue, 12 Mar 2024 06:12:59 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUb+D0lAJw+8kJDA+a87wLkpB/V0Wb6yCR1rJ9sG15y1IA6bLiRiglG2oArmRXNBbTq4pZF099VCBDPFqW2rhvTXJTX400edvDdDx01wA== X-Google-Smtp-Source: AGHT+IGJoHZMMNNAn/4DR24Z2ftI69lOm+EWLmt5omWQ5onkmiiksfetqHsE09T3s5VfVxXMCLd9 X-Received: by 2002:a05:6a00:700f:b0:6e6:8bff:3964 with SMTP id lf15-20020a056a00700f00b006e68bff3964mr5621583pfb.23.1710249178783; Tue, 12 Mar 2024 06:12:58 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710249178; cv=pass; d=google.com; s=arc-20160816; b=VnBbDHS8EOmQkG6EqAsBuYnFn4Hf2jgdqsmu/BPVhGstuBNcUvGCKhZsOW1Um22csD Nba4ql/ufHW9CI7hVaivM0Cb2M7sUnvy8m2myemjkIK7riVN1oG+GIGEzwjqtM0xdhWd dw0t+lcmjICn6qxevMkxZPf9+FvwIF/sMzAzTK09BTfl4CUsapxxaP9x1kyRkZ4ORJgT UGRu85zbqD7+k8s3f8BShJE2z24FYvDcitYXofDBASWMEgR4KyWDDdfamllUay7MDU21 2dk1nrclz+KmfLnpXhmFdeB8+Mr+EuDLGEk5H3O9IgmP2ulM6zSscsgSuWI98CRr7+DA 42JQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date; bh=1TfE+cC4q8ZI+UvGlKfrfiABV1ZziQCBKj8r6N7BfsM=; fh=+DA061ENmWgoVtdH/k1+mLaAmmumVSig35yLXjcfQ5k=; b=SFhEQXykWuES5TrWkfinzkSH9VPfMEm6aIiXXe0YqRRKWKaGpfROm7Yce7y3/oy1HI 1glCsrnGjzqBIZkhCZghLdPVmJp18B8mOjov7PHQ9koa9yloyRrU6cBj917Ptr2ukCZG q0HWbBS4XJT2iGgqNLUL98eD/0xEC4VcgCxhrJwQzBW/AxihPxJOFBadoGgcVqBVHzGL jglFa+2M8U3RX4cZj67WZ7107YQufXxpviihIJW+b3A6LPUA1SBt6jEHvWv5CzyXt/Ak 1XH+0dXzh1s4fS7D7bCfgSETedwgXPOfFuJJExdh18PCr4URyC9fbAvH2BhQ+/QIYa3i 0s/g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=makrotopia.org); spf=pass (google.com: domain of linux-kernel+bounces-100277-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-100277-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id h3-20020a056a00218300b006e69296296fsi4030699pfi.400.2024.03.12.06.12.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 06:12:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-100277-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=makrotopia.org); spf=pass (google.com: domain of linux-kernel+bounces-100277-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-100277-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 78446B209B0 for ; Tue, 12 Mar 2024 13:12:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5CC217A152; Tue, 12 Mar 2024 13:12:45 +0000 (UTC) Received: from pidgin.makrotopia.org (pidgin.makrotopia.org [185.142.180.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9EBA479DBD; Tue, 12 Mar 2024 13:12:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.142.180.65 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710249164; cv=none; b=BUoIX7aerK0kmi80Q9z1H/35+Qv0eks4Og3H4CPXkPjAInu69lPMdVbZcRHyJpZAmZqcMqdhRKUUPo8obMRyA9pYjatT+ay30wu007YoFy2VhB/sUMkq5M78Rd/UGB7L7/zz5TLbPbfCmHFoVudgfi06NKBGBzEaVpnmvHEROhk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710249164; c=relaxed/simple; bh=qw1Un7hVSUETXMazHe5VgTx1aM7+42G+J07xZ9g9/iY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=qZKEkHeO/6ErnfPyHyvqfQTk2JAWBliNjoNgOUCjDY6xDUGmGPW2g4M+4mPSQkL9qwZ6PFmSQyjQiGm3l3HXTUTtdg3jD1j8tkGZNtdv3wfwAm87DE9hXDcFrvAJ21bmsnTILSECjFsIK/N36SH1QMPqk02bnvLcnEtGszKr2xQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org; spf=pass smtp.mailfrom=makrotopia.org; arc=none smtp.client-ip=185.142.180.65 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=makrotopia.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=makrotopia.org Received: from local by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.96.2) (envelope-from ) id 1rk1vO-00056B-2t; Tue, 12 Mar 2024 13:12:11 +0000 Date: Tue, 12 Mar 2024 13:12:01 +0000 From: Daniel Golle To: Ulf Hansson Cc: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jens Axboe , Dave Chinner , Jan Kara , Thomas =?iso-8859-1?Q?Wei=DFschuh?= , Christian Brauner , Li Lingfeng , Damien Le Moal , Min Li , Adrian Hunter , Hannes Reinecke , Christian Loehle , Avri Altman , Bean Huo , Yeqi Fu , Victor Shih , Christophe JAILLET , "Ricardo B. Marliere" , Greg Kroah-Hartman , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org, linux-block@vger.kernel.org, Diping Zhang , Jianhui Zhao , Jieying Zeng , Chad Monroe , Adam Fox , John Crispin Subject: Re: [RFC PATCH v2 0/8] nvmem: add block device NVMEM provider Message-ID: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Tue, Mar 12, 2024 at 01:57:39PM +0100, Ulf Hansson wrote: > On Tue, 12 Mar 2024 at 13:30, Daniel Golle wrote: > > > > Hi Ulf, > > > > On Tue, Mar 12, 2024 at 01:22:49PM +0100, Ulf Hansson wrote: > > > On Tue, 5 Mar 2024 at 21:23, Daniel Golle wrote: > > > > > > > > On embedded devices using an eMMC it is common that one or more (hw/sw) > > > > partitions on the eMMC are used to store MAC addresses and Wi-Fi > > > > calibration EEPROM data. > > > > > > > > Implement an NVMEM provider backed by block devices as typically the > > > > NVMEM framework is used to have kernel drivers read and use binary data > > > > from EEPROMs, efuses, flash memory (MTD), ... > > > > > > > > In order to be able to reference hardware partitions on an eMMC, add code > > > > to bind each hardware partition to a specific firmware subnode. > > > > > > > > This series is meant to open the discussion on how exactly the device > > > > tree schema for block devices and partitions may look like, and even > > > > if using the block layer to back the NVMEM device is at all the way to > > > > go -- to me it seemed to be a good solution because it will be reuable > > > > e.g. for (normal, software GPT or MBR) partitions of an NVMe SSD. > > > > > > > > This series has previously been submitted on July 19th 2023[1] and most of > > > > the basic idea did not change since. > > > > > > > > However, the recent introduction of bdev_file_open_by_dev() allow to > > > > get rid of most use of block layer internals which supposedly was the > > > > main objection raised by Christoph Hellwig back then. > > > > > > > > Most of the other comments received for in the first RFC have also > > > > been addressed, however, what remains is the use of class_interface > > > > (lacking an alternative way to get notifications about addition or > > > > removal of block devices from the system). As this has been criticized > > > > in the past I'm specifically interested in suggestions on how to solve > > > > this in another way -- ideally without having to implement a whole new > > > > way for in-kernel notifications of appearing or disappearing block > > > > devices... > > > > > > > > And, in a way just like in case of MTD and UBI, I believe acting as an > > > > NVMEM provider *is* a functionality which belongs to the block layer > > > > itself and, other than e.g. filesystems, is inconvenient to implement > > > > elsewhere. > > > > > > I don't object to the above, however to keep things scalable at the > > > block device driver level, such as the MMC subsystem, I think we > > > should avoid having *any* knowledge about the binary format at these > > > kinds of lower levels. > > > > > > Even if most of the NVMEM format is managed elsewhere, the support for > > > NVMEM partitions seems to be dealt with from the MMC subsystem too. > > > > In an earlier iteration of this RFC it was requested to make NVMEM > > support opt-in (instead of opt-out for mtdblock and ubiblock, which > > already got their own NVMEM provider implementation). > > Hence at least a change to opt-in for NVMEM support is required in the > > MMC subsystem, together with making sure that MMC devices have their > > fwnode assigned. > > So, the NVMEM support needs to be turned on (opt-in) for each and > every block device driver? > > It's not a big deal for me - and I would be happy to apply such a > change. On the other hand, it is just some binary data that is stored > on the flash, why should MMC have to opt-in or opt-out at all? It > should be the upper layers who decide what to store on the flash, not > the MMC subsystem, if you get my point. > I agree, and that's exactly how I originally wrote it. However, in the first round of rewiew it was requested to be in that way (ie. opt-in for each subsystem; rather than opt-out for subsystems already providing NVMEM in another way, such as MTD or UBI), see here: https://patchwork.kernel.org/comment/25432948/ > > > > > Why can't NVMEM partitions be managed the usual way via the MBR/GPT? > > > > Absolutely, maybe my wording was not clear, but that's exactly what > > I'm suggesting here. There are no added parsers nor any knowledge > > about binary formats in this patchset. > > Right, but there are new DT bindings added in the $subject series that > allows us to describe NVMEM partitions for an eMMC. Why isn't that > parsed from the MBR/GPT, etc, rather than encoded in DT? The added dt-bindings merely allow to **identify** the partition by it's PARTNAME, PARTNO or PARTUUID, so we can reference them in DT. We'd still rely on MBR or GPT to do the actual parsing of the on-disk format. > > > > > Or did I misunderstand your comment? > > Maybe. I am just trying to understand this, so apologize if you find > my questions silly. :-) Let's make sure to all be on the same page and everything is fully understood by everyone. Everyone has to bare the noise, but I guess that's ok ;) Cheers Daniel