Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2822989lqp; Mon, 25 Mar 2024 10:08:57 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWpNw3tF5LeRowrcon/1WJKR/qqgZN4BHbqGNyx/UlUfho6TNUCRWD7hqzcJ5r8DZN4+hEkmkgx6t0tU31AOrk2cGjZsnldSFV66Az09Q== X-Google-Smtp-Source: AGHT+IHiZ85ryQPxYfVCQdKkS/Inp7EzMc5zKO5nq8a0Jb8OmXAjrBjb1/NWMm2bF0fyl6NfmuMe X-Received: by 2002:a17:907:9729:b0:a47:38c0:fb4e with SMTP id jg41-20020a170907972900b00a4738c0fb4emr302467ejc.19.1711386537717; Mon, 25 Mar 2024 10:08:57 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711386537; cv=pass; d=google.com; s=arc-20160816; b=ZSE+r0CLs8xeMvAl3PNbWWOggdzK7wlu/geZTd5h6kBPiujauTK1qaGCKGtPuN+0Vd SQ+uj+pMi0G4RFJ8Sx6zH6G1CfALF9R6EprXwmPJ/jV67Ta++0DPIblF4AGjOHaXnPdB dRgmjVcTomsxBvTiOcEdlvwYksVwhBXwfbI6WXxk6CbMKuD2Q36bBvxLYORd7av1+J9f tRsWkqumqIUYr95/Bj1YGNQmpv+LPBcLFbtWTriOdkInzubx2QAD9WVEqffBOWHrkitf WX4+SHl6xt+eP6uYUTPiNaadtEOYHBC1sixRsQNlpSeRc26pN5nYV94pgK6FxcdB97XC PB/Q== 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=9YfMLFyYNDMhGbDVKSde5m2kgC5FcF4Jd/Eq+Wwz12Q=; fh=CSBH1dQNHBdPQ0N9/UJ88bJ4md7U3hap0n7y4hWYxgE=; b=ofMPHnLtp5VbaR7EwrZE3nIAvRdSWo+fRiz6uNHOZMaoevMNI0XAuWFplzKs12LCtj NSi74SHhKplDOcLBl9aZW3od/OiDgDJ4OyOUVvluoSXAylFxW30Y3PdAl8KPsgE5kKcB ALmlZZ5SKoXImbe5rGzI2TR4WTe/fiO+kYtv1SBTnZzcp0qieKyBQoKaxtQZxktdCy6B aODSuFj0UsBvpG1garqFb8acVszFGDoub62l/SIGbh6BX0FcQ1rkPYis/Se8NQa3uhcJ nKvPSZ99qdqpMkwMSK0S9UbP+19B3o4xEWLeqnFizEdF7TY83D7EMu0yh3HGV1LlQL63 1gZw==; 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-117394-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-117394-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id by9-20020a170906a2c900b00a4407fa42d6si2567462ejb.790.2024.03.25.10.08.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 10:08:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-117394-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=makrotopia.org); spf=pass (google.com: domain of linux-kernel+bounces-117394-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-117394-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 6FC081F39DB3 for ; Mon, 25 Mar 2024 17:08:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 77E4213D243; Mon, 25 Mar 2024 15:39:16 +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 B54587174F; Mon, 25 Mar 2024 15:39:11 +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=1711381153; cv=none; b=lhHuHyRzJ9d7LZ3iBN1RO5fNH0mCxXil1TLptS/SGulIaWsd4b4hk323FoEFjD2KzpWzGENSIbLQMKenP+VtPCoJ/nLDEYCr7hpUJczrCN+frRSPIBwqy1UXfq3kJE+qSM4ignWjD9DQSKk0Ic8kdDnMo/qDkgsT7B16xRlxv24= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711381153; c=relaxed/simple; bh=nknJYIONB75PX2/X0Pvf2Ghs0Wtg0AtN05Shf/1SaGE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=eBqO8PXjDNvYRvYykTDeP3FCp0Fq9CWMKVxTflo/nCevpOlMKiFJgTWA7zVAdiHSFpzvkLymDlVwHZ43a+1ApPBlGwb8JAePIf4KrlKibESQJ/7N7aRLPnzzL3mRA7c4GsdnUKjPoktfuWM0HYU45hvxnyDEn2dAovPCGoK/1MU= 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 1romP3-0002bd-2M; Mon, 25 Mar 2024 15:38:25 +0000 Date: Mon, 25 Mar 2024 15:38:19 +0000 From: Daniel Golle To: Rob Herring Cc: Krzysztof Kozlowski , Conor Dooley , Ulf Hansson , Jens Axboe , Dave Chinner , Jan Kara , Thomas =?iso-8859-1?Q?Wei=DFschuh?= , Damien Le Moal , Li Lingfeng , Christian Brauner , Christian Heusel , Min Li , Adrian Hunter , Avri Altman , Hannes Reinecke , Christian Loehle , Bean Huo , Yeqi Fu , Victor Shih , Christophe JAILLET , Dominique Martinet , "Ricardo B. Marliere" , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org, linux-block@vger.kernel.org Subject: Re: [PATCH 0/8] block: implement NVMEM provider Message-ID: References: <20240325151046.GA3591150-robh@kernel.org> 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: <20240325151046.GA3591150-robh@kernel.org> On Mon, Mar 25, 2024 at 10:10:46AM -0500, Rob Herring wrote: > On Thu, Mar 21, 2024 at 07:31:48PM +0000, 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 a block device 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. > > > > Overall, this enables uniform handling across practially all flash > > storage types used for this purpose (MTD, UBI, and now also MMC). > > > > As part of this series it was necessary to define a device tree schema > > for block devices and partitions on them, which (similar to how it now > > works also for UBI volumes) can be matched by one or more properties. > > > > --- > > This series has previously been submitted as RFC on July 19th 2023[1] > > and most of the basic idea did not change since. Another round of RFC > > was submitted on March 5th 2024[2] which has received overall positive > > feedback and only minor corrections have been done since (see > > changelog below). > > I don't recall giving positive feedback. > > I still think this should use offsets rather than partition specific > information. Not wanting to have to update the offsets if they change is > not reason enough to not use them. Using raw offsets on the block device (rather than the partition) won't work for most existing devices and boot firmware out there. They always reference the partition, usually by the name of a GPT partition (but sometimes also PARTUUID or even PARTNO) which is then used in the exact same way as an MTD partition or UBI volume would be on devices with NOR or NAND flash. Just on eMMC we usually use a GPT or MBR partition table rather than defining partitions in DT or cmdline, which is rather rare (for historic reasons, I suppose, but it is what it is now). Depending on the eMMC chip used, that partition may not even be at the same offset for different batches of the same device and hence I'd like to just do it in the same way vendor firmware does it as well. Chad of Adtran has previously confirmed that [1], which was the positive feedback I was refering to. Other vendors like GL-iNet or Netgear are doing the exact same thing. As of now, we support this in OpenWrt by adding a lot of board-specific knowledge to userland, which is ugly and also prevents using things like PXE-initiated nfsroot on those devices. The purpose of this series is to be able to properly support such devices (ie. practially all consumer-grade routers out there using an eMMC for storing firmware). Also, those devices have enough resources to run a general purpose distribution like Debian instead of OpenWrt, and all the userland hacks to set MAC addresses and extract WiFi-EEPROM-data in a board-specific ways will most certainly never find their way into Debian. It's just not how embedded Linux works, unless you are looking only at the RaspberryPi which got that data stored in a textfile which is shipped by the distribution -- something very weird and very different from literally all of-the-shelf routers, access-points or switches I have ever seen (and I've seen many). Maybe Felix who has seen even more of them can tell us more about that. [1]: https://patchwork.kernel.org/project/linux-block/patch/f70bb480aef6f55228a25ce20ff0e88e670e1b70.1709667858.git.daniel@makrotopia.org/#25756072