Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp294718lqt; Thu, 18 Apr 2024 15:53:11 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWh4GOuGlJo6i8nAmkigmKY3SB1HOD0D+U3TM+bDq7DH4bjKGjc+XLbS4FLiAnrns2HNBWagFTDxEQhyReuJ8gG9h17pDU9yBW0L2DMVg== X-Google-Smtp-Source: AGHT+IHtUp0M79bdWSWpmyW+oDuH65cW0K6MZdoNTqCqIbFATBOWdp6j63pU2MjlkUYjxjHXj3MN X-Received: by 2002:a17:903:292:b0:1e3:f923:e257 with SMTP id j18-20020a170903029200b001e3f923e257mr629104plr.49.1713480790721; Thu, 18 Apr 2024 15:53:10 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713480790; cv=pass; d=google.com; s=arc-20160816; b=LxgYRkN4PhcAn8AvRrbyb6W5hlgzegHJAMEqEproFL1RIq1qmgcdSd/ngNHorO0FCp 2AnaQFiDXgv2tHe151RM3pbiFMObnXBIRl3yHOcLzbsSW884LRGCkSo6LfAgjahaiWaQ NZ2CQ+Zh7XJU7ZtQog8QGVZtMU36NM4FhROYmkx61GMXPS9ge0qwrDV1oX04Hr2sSubL kjt7SmQkR6fBpfjroa6ZZ1dtcG0aegUGZ0HuLrrO2DwMnaNu+j9FRhjYLT1fPo1y7JPF SM23OxU/C/+AUx0oTsTSVUW/qcXm3zZgAWu5vlVWD5f7d3maXlqwo+JxVZd5Mhey936p tLtw== 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=UzNYsfwEH81t7Cf5us1TbCvVMgdFzTnRZ0X5DpKlCEQ=; fh=4L2f+/6l+KWbqDOAQvrgBkPYw7HmnsyObzFPI1/hw9Y=; b=SyP6gWMJByid1fH9k59mz7La4tMtbDAeC7a+HIlP4VaZfjAq4ChFhggbb22XoARMrZ e52xjXw66zFCsYENVT0qFQru+jd3Op5zh8gjbGYzy5EtDNmYqR4kIDxiOTpnUj3C2M9i LaX4olOquEswRA/+nQbs5wHZhTE+1Jj/zhML02Ro/cE8+ZIF05W3JuAlXX+z3h6w0v+9 fKsrO92ysYlubIzWa6VLOwipvSY7uR/W2f8MJ914IfQC2uhMr6pomz6pyklOexifq5wN 6jz828ASqnz7Xk7+kRuozZD49txQGxR2pgDJW3RGaw3xZ87THsbX1fPEJxLhMe9Lp/+K BxDg==; 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-150843-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-150843-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id t3-20020a170902e84300b001e5883d3500si2274291plg.284.2024.04.18.15.53.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Apr 2024 15:53:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-150843-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=makrotopia.org); spf=pass (google.com: domain of linux-kernel+bounces-150843-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-150843-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 BB34CB22A35 for ; Thu, 18 Apr 2024 22:53:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AEB6252F83; Thu, 18 Apr 2024 22:52:50 +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 E97C1286AF; Thu, 18 Apr 2024 22:52:47 +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=1713480770; cv=none; b=lsV2BjQrMUSqcZaXbGrlyaGSWb6QTUhEZzT8kLYG0ihz9MWiUrsDePGT0mJu+CCYMGRnBS5CmvvdXZJezP157c6jgVyR1q0uiYzFOGXvmg9qaDA3XsRRgYbK4ADhIWNlLMEGO83MjaCVhn5dSoKRwAQlacb9hjkfUVQncVXAVkA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713480770; c=relaxed/simple; bh=e9cfJN8rNWU9caYstywKsUUR/GDFScyvCazNhCJrrfM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=DJKPagMNalECQMf7/jSH/lsHSIheoSKhc7bd4GCjYiKNOVuehlnO/AV7eOHFtP93jBq+BTSCEGYnEYzzTPX3MHIW3kGTz78zxuvQzfGFzidLnSTLJCQi3cDBKA5MKn/cbaxJHwaSWKetc48ofIG8J/9Xm85h71Wo2G8n3f5jQqc= 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 1rxabl-00033c-35; Thu, 18 Apr 2024 22:51:58 +0000 Date: Thu, 18 Apr 2024 23:51:49 +0100 From: Daniel Golle To: Bart Van Assche Cc: Rob Herring , 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 3/8] block: add new genhd flag GENHD_FL_NVMEM Message-ID: References: <89abd9ab93783da0e8934ebc03d66559f78f6060.1711048433.git.daniel@makrotopia.org> <7027ccdc-878a-420e-a7ea-5156e1d67b8a@acm.org> <192acb8f-47b8-426c-bcc9-ef214a797f26@acm.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: <192acb8f-47b8-426c-bcc9-ef214a797f26@acm.org> On Fri, Mar 22, 2024 at 12:22:32PM -0700, Bart Van Assche wrote: > On 3/22/24 11:07, Daniel Golle wrote: > > On Fri, Mar 22, 2024 at 10:49:48AM -0700, Bart Van Assche wrote: > > > On 3/21/24 12:33, Daniel Golle wrote: > > > > enum { > > > > GENHD_FL_REMOVABLE = 1 << 0, > > > > GENHD_FL_HIDDEN = 1 << 1, > > > > GENHD_FL_NO_PART = 1 << 2, > > > > + GENHD_FL_NVMEM = 1 << 3, > > > > }; > > > > > > What would break if this flag wouldn't exist? > > > > As both, MTD and UBI already act as NVMEM providers themselves, once > > the user creates a ubiblock device or got CONFIG_MTD_BLOCK=y set in their > > kernel configuration, we would run into problems because both, the block > > layer as well as MTD or UBI would try to be an NVMEM provider for the same > > device tree node. > > Why would both MTD and UBI try to be an NVMEM provider for the same > device tree node? I didn't mean that both MTD and UBI would **simultanously** try to act as NVMEM providers for the same device tree node. What I meant was that either of them can act as an NVMEM provider while at the same time also providing an emulated block device (mtdblock xor ubiblock). Hence those emulated block devices will have to be excluded from acting as NVMEM providers. In this patch I suggest to do this by opt-in of block drivers which should potentially provide NVMEM (typically mmcblk). I apologize for the confusion and assume that wasn't clear from the wording I've used. I hope it's more clear now. Alternatively it could also be solved via opt-out of ubiblock and mtdblock devices using the inverted flag (GENHD_FL_NO_NVMEM) -- however, this has previously been criticized and I was asked to rather make it opt-in.[1] > Why can't this patch series be implemented such that > a partition UUID occurs in the device tree and such that other code > scans for that partition UUID? This is actually one way this very series allows one to handle this: by identifying a partition using its partuuid. However, it's also quite common that the MMC boot **hardware** partitions are used to store MAC addresses and/or Wi-Fi calibration data. In this case there is no partition table and the NVMEM provider has to act directly on the whole disk device (which is only a few megabytes in size in case of those mmcblkXbootY devices and never has a partition table). [1]: https://patchwork.kernel.org/comment/25432948/