Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp1613689lql; Wed, 13 Mar 2024 03:20:35 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXCIssuhMUYT4cBvz+c05iWffPiI7X5whvVmXhA5d+x2EIJqgBEbLWFFyKOnrWPJxNUPTiGrg+L+QJSbH/l7MDSUd2DdwK/uFwos/V84w== X-Google-Smtp-Source: AGHT+IFyYXtIyWaknQNAu9pV2PWNuNO/zte/UDMBBoD0y5wtFRGbd4luwZD/UzrK0aAcqgDRRQuF X-Received: by 2002:a05:6a21:1690:b0:1a3:10a8:9d60 with SMTP id np16-20020a056a21169000b001a310a89d60mr6024984pzb.54.1710325235433; Wed, 13 Mar 2024 03:20:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710325235; cv=pass; d=google.com; s=arc-20160816; b=0kJ4U3QZ97S+QgksptSnHgv8Z9oDM9gFdokDXGWENOw9VRdl+C4e8yN5astnJNnhVx jQ3Z5AAhU1DEdwzVkfZtGIsG35EP2J3NaCRrFtAq1cCZzScMz75wwCQXE2MtBORBD2H/ kUMrO7htSDxqbvAhT1azUF0MHc5Ou5pZUcrqA4UksQXQr8DosalFeFxiUKLYboODJbzG QdOP4DjB//gLmm6HuJt2FAZ8KP3QROTYDXGLxmL1MxYH3KToz+W2lmbxr2KgTHWr7zCc 1cbCIp3AkkQSTF36uUtLi80QBEW5ZHc29I4ahpELuplBIBF6H0NG2NQ5Sm/rSU3se/vG MAZQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=54ISWejEc7g43gLJbaA6kw3tAbDUhEEnqU4SOmf5mdo=; fh=tgkRpcBYtMfTCYG/h8xnlWxWuAuOJOZTtCMZJg6Nri8=; b=bFtOB4f8ojPIitQAUgjLNWlSpETDOK906z85jNqltBeVqB9eO4G/3eZxOOva4AL731 IUhsw6I97P4wXyjtXuWO/qGmquWnPfSSQwoA8f4G0JBF8U4u86ljiPucCxp1HndfowJy 575FK9LFDH5z4wkFqcB1+dYgadEistL+Q2pa2dcacBXEnie4um9s28OLvm3LNgI6NqN5 yh+xdckpwlrBj0Ld/HebmrFi33jyo7rX2soKx00L4FTUcnAx+8NEr3o+QDO6X+EdFoJv cC/FDkYwhm+Lu1QIqzJGO8xlnaGyxPWkUEBQBV7SCVpBTlV4XqNgszmPgV6GdkpNhijt MEZQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=R0nCg18E; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-101333-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-101333-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id k3-20020a63d843000000b005dc3c49442esi8901491pgj.732.2024.03.13.03.20.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Mar 2024 03:20:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-101333-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=R0nCg18E; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-101333-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-101333-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 1BC0C28323D for ; Wed, 13 Mar 2024 10:20:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B595439AF0; Wed, 13 Mar 2024 10:20:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="R0nCg18E" Received: from mail-yb1-f180.google.com (mail-yb1-f180.google.com [209.85.219.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1715C38FA3 for ; Wed, 13 Mar 2024 10:20:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.180 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710325223; cv=none; b=PMu3BWf+O1bj5/kg/UNLMUj2dVH/8Z+yxFLIAl1tVw05S8qmo43VEdw8FKT152E3R5NC9XwXXS3V685TEgX3A1yZ4KG3IjB0SXoL2Sjifaj7S7disBRiNrtRttn5ON22wB8o6BLd3Hx2cHmpPiJQ3CpXaz16Iu4lsU6Z5mUFqow= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710325223; c=relaxed/simple; bh=54ISWejEc7g43gLJbaA6kw3tAbDUhEEnqU4SOmf5mdo=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=TRrK8PeLTxlFylpCDqtUAVaZYOcNbVUaJDLAauQ9wPBz5H4dLiqauHGXHX4ORzUQqesCEhWDkHxaAVpEW6cN551JRtTMHSaVoGM366wy3SmeTMfB18UbNi+bFf1JB5CSAaBYheJs21X0gsuF47JGMS++xKOqltUlYfrbUvca7gY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=R0nCg18E; arc=none smtp.client-ip=209.85.219.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-yb1-f180.google.com with SMTP id 3f1490d57ef6-dd14d8e7026so738251276.2 for ; Wed, 13 Mar 2024 03:20:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710325221; x=1710930021; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=54ISWejEc7g43gLJbaA6kw3tAbDUhEEnqU4SOmf5mdo=; b=R0nCg18EO1pW9zayhsTn8LQj7M3+tiyyIwN4VB23GEi3NQitBZ7czlmYPgZD9vk+tE 1siPpPrsZbCZzW8KpscjM7/rWYkTIds9ia/8k+pclKiEqcjsPCghD4OXM7h4bamAp1ub qGUGm6rG03fdKia17bjrSjhUBqBFW05+SQlK8vyXTjcKRFTazpiuG03NfV1GO6g6dDqx 4wXVWMKHqt8TmpUDjfksl7fe/u7A6wt+HPq4L/o+b8Wez97PUM5yuLzIY4+LKXJlIeSW hIVzvYo0Gknfe4kbcp06LD0WOiPjIBdf4q1yQOEdMsMauyYomnOeDZ4oM/GIz0afO8c8 yKJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710325221; x=1710930021; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=54ISWejEc7g43gLJbaA6kw3tAbDUhEEnqU4SOmf5mdo=; b=nuzwIXoGeUpuNucV00jwtXbIXVtNYSjXLOdfFFNkZulZH1xUp7H2lcztO7fQ0oTO6z xJUKXLwTSq7vCHRoJQD79WuUYCNqLSZbn4Tmmd7mIiML9Srkja5on37NQaIyOAFGnhEE Ym8bLPcvMT6T6wEGNNfwBeg6xpGZra6VWGiw6YQxU3lfXAGTndoZb21HPBwjhMce8GFt fPQ8lNmthDG26ocut6VdVPGld7YSmfc1FWjHnWrFNR6U7rQ2Z+NX4m3jvhnAk1HjUWGu veYAJ73nUWmxos/h+aNIX6JIa/i3zx0jrhYpORZR40BGEtmFqZFyTHRx3vShtz7QYChr UkKg== X-Forwarded-Encrypted: i=1; AJvYcCWDr2WkPWquUEL+z1XnxbjnAMpFb44aJxUNHy9Ym4oQoK4R4XAwesbeOJXOZps632VVwV+XVqlfHYGsQG8OiPALYoO2Q1TVri09Opaa X-Gm-Message-State: AOJu0Yxiyvy76E6BF1bmbg9zrQcVfhpgU88j+CW/aVMUHgNT9epfrSeT 1kLw6fU3hYkEzrFd4KS9GpUvk1N5N+L/OyXJM4PiGWeYQxwJ4NLq1NOzLEvWoyJO2Zqnq8ZMytL XzYTqq/FZyAl+TVdusiynf4T57d8YN6RCalg04Q== X-Received: by 2002:a25:2c3:0:b0:dc2:2e01:4ff0 with SMTP id 186-20020a2502c3000000b00dc22e014ff0mr2046178ybc.45.1710325221040; Wed, 13 Mar 2024 03:20:21 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: In-Reply-To: From: Ulf Hansson Date: Wed, 13 Mar 2024 11:19:44 +0100 Message-ID: Subject: Re: [RFC PATCH v2 0/8] nvmem: add block device NVMEM provider To: Daniel Golle Cc: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jens Axboe , Dave Chinner , Jan Kara , =?UTF-8?Q?Thomas_Wei=C3=9Fschuh?= , 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 Content-Type: text/plain; charset="UTF-8" On Tue, 12 Mar 2024 at 14:12, Daniel Golle wrote: > > 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/ Okay, got it, thanks! > > > > > > > > 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. Thanks for clarifying! So, it looks like this all relies on what DT maintainers think then. [...] Kind regards Uffe