Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp10758008rwp; Fri, 21 Jul 2023 04:40:54 -0700 (PDT) X-Google-Smtp-Source: APBJJlGHk1vOeAeADRqgCkx0TojCdhTrI6yGNABI+4VcPyx1s/4Poy87u9mse14BYh26STtl5IRL X-Received: by 2002:a05:6a20:1593:b0:133:dc0a:37e7 with SMTP id h19-20020a056a20159300b00133dc0a37e7mr1352494pzj.13.1689939653830; Fri, 21 Jul 2023 04:40:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689939653; cv=none; d=google.com; s=arc-20160816; b=IdR60IpmIPNENikM5NUbFcm0p9xIhvyPWWvQQk5VSZIPNQ2Fj63/tPPhqjtkeySBgX Orh3/B0QNXZinuLo46QMJFn11XWGq8iAIBHJ5n9NnrkLa/crJ01Al/tVY1ASqcsacM6U NAoMpNPWC01N79pCfOLVke5jyd/T3YcAa9djIRlksxiyaeGvoEOExQiJ8i7Q/+QZyci6 2gJGO/2DartLHdxveIqSkaPIclqyAfhlXGHaGx8jTbBP/D7rqx3vgOgTYUUqw54XFZjk MupXpvun1dkiSWkb7sbm1MCHAOlp7qW+JniKPYBVatfO9uYOWRECkJJL4/tjcEqekfKm IZzg== 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; bh=1JdFEbVl59rbksykLCiexV7ZtIrtwr5MDyRoPCkRagI=; fh=dCBxZahVzdVcTgMFhuMnV3isS2Wn2lceUxE1wg0DoUI=; b=YROy998gd7R5RLuipJHQuKJcsFtGIbrDYv2YbpuzV3B2uOsCUX8LIBiZu2k7N7c8XY QaMx1xkeQ75zKHSdHGiXGa8ylnZ/3BGPeFhrPAg1dsnpsX1tYjLERNPO92H1g8WFkpSn RkM0v75SuASNEOkRIqBZBfn8hqAmAivTITwRxFaiiF8SO2rNPm9UhLiNhmL7RTK24rAE uTNhYjd+3RHBuWTLbbFOuk5QA4HrrN7kH47IfagRNdUJAKcyG/u57zc4GM3JAcTmvY13 ecJgka/YxChlU27o0bQgu/9jNtlq33zywU14V90oDnjkv7yslbntqLZgfWK5GO7DNhfn 8G9w== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ik28-20020a170902ab1c00b001bb6d74e6dasi1280436plb.321.2023.07.21.04.40.40; Fri, 21 Jul 2023 04:40:53 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230001AbjGULLZ (ORCPT + 99 others); Fri, 21 Jul 2023 07:11:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231273AbjGULLI (ORCPT ); Fri, 21 Jul 2023 07:11:08 -0400 Received: from pidgin.makrotopia.org (pidgin.makrotopia.org [185.142.180.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4F673586; Fri, 21 Jul 2023 04:10:28 -0700 (PDT) Received: from local by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.96) (envelope-from ) id 1qMo0O-0001P2-1P; Fri, 21 Jul 2023 11:09:04 +0000 Date: Fri, 21 Jul 2023 12:08:56 +0100 From: Daniel Golle To: Ming Lei Cc: Jens Axboe , Ulf Hansson , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Dave Chinner , Matthew Wilcox , Thomas =?iso-8859-1?Q?Wei=DFschuh?= , Jan Kara , Damien Le Moal , Min Li , Christian Loehle , Adrian Hunter , Hannes Reinecke , Jack Wang , Florian Fainelli , Yeqi Fu , Avri Altman , Hans de Goede , Ye Bin , Greg Kroah-Hartman , =?utf-8?B?UmFmYcWCIE1pxYJlY2tp?= , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org, linux-mtd@lists.infradead.org Subject: Re: [RFC PATCH 0/6] nvmem: add block device NVMEM provider Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,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 Fri, Jul 21, 2023 at 04:32:49PM +0800, Ming Lei wrote: > On Wed, Jul 19, 2023 at 11:01:14PM +0100, 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 NVMe. > > Just wondering why you don't use request_firmware() in drivers which consume > the data, then the logic can be moved out of kernel, and you needn't to deal > with device tree & block device. The thing is: Why should the OS need to know about how to read calibration to be fed into a wireless driver on a specific hardware/firmware? Or even worse: The MAC address of the main Ethernet interface? What if for one of many possible reasons the extraction script in userland gets broken and you would need to recover the system via SSH (because it's a router or switch and doesn't even have any local console)? Having information about the location of firmware artifacts be supplied by the firmware (via device tree) seems to be the natural choice, and also how it is done for devices booting off NOR or NAND flash by using the NVMEM framework. Why should eMMC be the exception? > > Or Android doesn't support udev and initrd? Yes, sure, but then the OS ROM needs to know about and handle a lot of very device-specific details in userland and if (unlike Android) the same OS ROM should run on many devices that would mean it will have to ship all of them in a huge initrd or root filesystem. Also using userspace mechanics to acquire things as basic as a MAC address seems overly complex and much more fragile than having the firmware instruct the kernel via device tree to do so. Hence, within the OpenWrt project, we've been working for years now to push for Device Tree and lately for use of the NVMEM framework, exactly to **reduce** the amount of hardware-specific knowledge in userland and get rid of shell scripts acting as hotplug handlers for firmware requests and such.