Received: by 2002:a89:2c3:0:b0:1ed:23cc:44d1 with SMTP id d3csp674821lqs; Tue, 5 Mar 2024 12:59:27 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVWTbp2tiTG71q3xf+y51mgPYr8GpdH8528C4z9Dw7ukBGM8t9G/sfUIF6+mQLJZrWlPl9qhVT38B59GPHTfmnJcnp255A3GeL8dWrLDA== X-Google-Smtp-Source: AGHT+IFpJlWU8/Yh1mPPYiw0gVaJyealL66Varo8d650rExOpSvlAbR2Z5nsCQGJ0oG7Pc/qeDfC X-Received: by 2002:a05:6830:1e10:b0:6e4:d5b7:7f4e with SMTP id s16-20020a0568301e1000b006e4d5b77f4emr3080316otr.20.1709672366907; Tue, 05 Mar 2024 12:59:26 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709672366; cv=pass; d=google.com; s=arc-20160816; b=f81d2vyIX04DYSiaEGaN2YT+ZscQ+RypimGLi4XOpcAMXfXjrZe8z62QwNsI4AqaS0 KFyQYne0ZFiJNWNtTEtkIvWg4SWVQXpkys2CYu0+uYCRWyd9h7/h4Dua6p/oAgPr9Af0 Tzzq6/gA7zgtKZyquhe8tB8a2mP4DAJ0dVndp8sMJV2bJ/yBNZBD10vuDZan/ThJR6t+ 9LeLfut9cxFQqkxdtZchcbyBxkJwpd3nj2KggZmoffdgI6T7iq7QkRx84VeB1u2WzhfP SeRwxwG7wweBiXKeC9pStg3Lq0M2t1Gnu2fIzmBuPnixrr35FF6l6omTzTeiD/q6iw8M LzXQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-disposition:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:message-id:subject:cc:to:from:date; bh=AhhLiSEL7LIJi5v2PedgdwrtlfZBON7wTAwyR9j/118=; fh=j7lw218M085b9rPtj+QACqlnmqhhsdWy5wQ1oNVKNQg=; b=mm5Q8cB5wR+f1fTljUa/MPRN77cXBIqdOi8/O7riipigk59DFGqdxkWNoBIDQAcV5L /0xAaiSnCh9X8FwqW2sQbS2G8LgjEltuqvRQBtpnjbD1/K/5NBvPYZMqtmNlZNZJ0th/ vpKH5upDYl7QmoQousES3YfKPBsMqiOOQ1FDwFBH4xtnkKZgVFgkcKWWTVdtqKt3Gluv w/0kL3kHFYu8PBKD7ylJBCD09/sicq02eZD5kNzi+k24p8iv183jjfVVTgwWcxhqYC0B 9hHMah+6lb89KH762DtDghKEOju/wXRyHqrhIEu3LUwBJa3rDPTkcohm7Zl8J1ebAUCn 23lw==; 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-92953-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-92953-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 k129-20020a633d87000000b005d7957d53e6si10543461pga.678.2024.03.05.12.59.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 12:59:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-92953-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-92953-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-92953-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 4BFEBB21BB1 for ; Tue, 5 Mar 2024 20:24:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7A11112A149; Tue, 5 Mar 2024 20:24:05 +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 713381272CC; Tue, 5 Mar 2024 20:24:03 +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=1709670244; cv=none; b=MH8kBei/SGd/7zUQhhdaLrNiPo9GDPlmrXx8kOuAsEfR0D7RT87MohBQ1OfYrOkV/huXxYXU/nrfZpsT8Tmt1fqN33R36iKDAaUdI67qUNeJ5GBZvNgFq9sSomuNLhK72jX60L0HQVHW+tiVtUPuv4PN1BB+BI/3zR+Iw9x3NnA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709670244; c=relaxed/simple; bh=2Xnx+UxJNe1jbb9epdvb8xlWEdXQg0apHljlHnmwwvY=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=AlTbf7m84sbw0hzBNhWiVcVW9qHO4+kLt6cw4F0Q9mZWR4gaZQQu4sKOFXe+9J8ti+fnGBFeUjTfcvqdUFPw9x2TxaT2CGWHsZsq7lSwf+NwA+B/gczJfNwpoHla7YgdE/mOOvgHQNg+gUTYNIUQG0yvB/tP5lMl4nClbeGTLmg= 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 1rhbJf-0001Ly-1n; Tue, 05 Mar 2024 20:23:11 +0000 Date: Tue, 5 Mar 2024 20:23:07 +0000 From: Daniel Golle To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Ulf Hansson , Jens Axboe , Daniel Golle , 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 Cc: Diping Zhang , Jianhui Zhao , Jieying Zeng , Chad Monroe , Adam Fox , John Crispin Subject: [RFC PATCH v2 0/8] nvmem: add block device NVMEM provider Message-ID: 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 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. [1]: https://patchwork.kernel.org/project/linux-block/list/?series=767565 Daniel Golle (8): dt-bindings: block: add basic bindings for block devices block: partitions: populate fwnode block: add new genhd flag GENHD_FL_NVMEM block: implement NVMEM provider dt-bindings: mmc: mmc-card: add block device nodes mmc: core: set card fwnode_handle mmc: block: set fwnode of disk devices mmc: block: set GENHD_FL_NVMEM .../bindings/block/block-device.yaml | 22 +++ .../devicetree/bindings/block/partition.yaml | 51 +++++ .../devicetree/bindings/block/partitions.yaml | 20 ++ .../devicetree/bindings/mmc/mmc-card.yaml | 45 +++++ block/Kconfig | 9 + block/Makefile | 1 + block/blk-nvmem.c | 175 ++++++++++++++++++ block/partitions/core.c | 41 ++++ drivers/mmc/core/block.c | 8 + drivers/mmc/core/bus.c | 2 + include/linux/blkdev.h | 2 + 11 files changed, 376 insertions(+) create mode 100644 Documentation/devicetree/bindings/block/block-device.yaml create mode 100644 Documentation/devicetree/bindings/block/partition.yaml create mode 100644 Documentation/devicetree/bindings/block/partitions.yaml create mode 100644 block/blk-nvmem.c -- 2.44.0