From patchwork Thu Oct 7 00:09:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zev Weiss X-Patchwork-Id: 12540793 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8F7D7C433EF for ; Thu, 7 Oct 2021 00:12:23 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 588F36101E for ; Thu, 7 Oct 2021 00:12:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 588F36101E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=bewilderbeest.net Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=OMX6CZnIBvp63WFJcuzoxxX8KqePolek5sV344i/hZk=; b=Rz2b86A0PH7sf7 fXydW9QUYbuakDqxea8mf5T4FbH7saqVrQyhKWt9dtMNwqNt77PMlEcK76/4ve1MJ3bmteWQt+RiZ pQwDFgeUT9kLXXhOcTXPR2GiH2bJMDBUCqIgSDymNh77Aqn0Fr92Zlr2Nkk8x6QU9KgeVUNYTfa6I viogWoV4ojOoLmPew4mjQ9/yK96HZPMGOgargDQS3tX2fiRnLVfZxsxdJxXMCkBomJMdu4DHWdDx1 n4NsaWQPl90jdZlZjOTQy9Zq3GIM/ni36J+fwghh7dWR6M19mTWkDsnJ3vD1JRaZVdRJPIeSoijhq 8xX/nkUScI3IspuVVenQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mYGzE-00FsNj-Ri; Thu, 07 Oct 2021 00:10:12 +0000 Received: from thorn.bewilderbeest.net ([71.19.156.171]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mYGzA-00FsMl-8I for linux-arm-kernel@lists.infradead.org; Thu, 07 Oct 2021 00:10:09 +0000 Received: from hatter.bewilderbeest.net (71-212-29-146.tukw.qwest.net [71.212.29.146]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: zev) by thorn.bewilderbeest.net (Postfix) with ESMTPSA id 7055552; Wed, 6 Oct 2021 17:10:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bewilderbeest.net; s=thorn; t=1633565405; bh=XNJ+HTYwQ2IQpncUFadRIFOJg2t8M7ncy59/V0Jd3Ys=; h=From:To:Cc:Subject:Date:From; b=gCPWmQkFOF+uxRlYH8EKU/FK5HMST9HArklIZhSLKVdDTYYhb9Bymp6Hx8f33g8dd Jp2uDnMCw0LJeKx1I7VXrb+uSP7UVhulS1bCEkrHnzwQJtjhc2W+B222j3y1aPZZeT emW63dSFGBweyF84xuzT9QN10IxpLVkH4i5CG7og= From: Zev Weiss To: openbmc@lists.ozlabs.org Cc: Greg Kroah-Hartman , Jeremy Kerr , Joel Stanley , Rob Herring , devicetree@vger.kernel.org, Zev Weiss , Andrew Jeffery , Frank Rowand , "Rafael J. Wysocki" , Andy Shevchenko , Andrew Morton , Francis Laniel , Kees Cook , Andrey Konovalov , Jonathan Cameron , Daniel Axtens , Alexey Dobriyan , Dan Williams , Daniel Vetter , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , Heiner Kallweit , Nick Desaulniers , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org Subject: [PATCH 0/9] Dynamic DT device nodes Date: Wed, 6 Oct 2021 17:09:45 -0700 Message-Id: <20211007000954.30621-1-zev@bewilderbeest.net> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211006_171008_326153_FF6DBA25 X-CRM114-Status: GOOD ( 22.05 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hello, This patch series is in some ways kind of a v2 for the "Dynamic aspeed-smc flash chips via 'reserved' DT status" series I posted previously [0], but takes a fairly different approach suggested by Rob Herring [1] and doesn't actually touch the aspeed-smc driver or anything in the MTD subsystem, so I haven't marked it as such. To recap a bit of the context from that series, in OpenBMC there's a need for certain devices (described by device-tree nodes) to be able to be attached and detached at runtime (for example the SPI flash for the host's firmware, which is shared between the BMC and the host but can only be accessed by one or the other at a time). To provide that ability, this series adds support for a new common device-tree property, a boolean "dynamic" that indicates that the device may come and go at runtime. When present on a node, the sysfs file for that node's "status" property is made writable, allowing userspace to do things like: $ echo okay > /sys/firmware/devicetree/.../status $ echo reserved > /sys/firmware/devicetree/.../status to activate and deactivate a dynamic device. Because it leans on the OF_DYNAMIC machinery internally, this functionality will only work on busses that register for OF reconfig notifications and handle them appropriately (presently platform, i2c, and spi). This series does not attempt to solve the "dynamic devices further down the tree" problem [2]; my hope is that handling for OF reconfig notifications can be extended to other families of devices (e.g. individual MTD spi-nor flash chips) in the future. The central change of the series is patch 6; patches 1-5 are various small infrastructure bits and plumbing tweaks in preparation for #6; patches 7-9 are Kconfig, documentation, and an inaugural use of the new property in the ASRock e3c246d4i BMC device tree. Note that this series requires the duplicate-declaration removal patch that was recently merged in Rob's tree [3]; it changes one of the duplicated declarations and hence will not compile without that patch (because the declarations no longer match). [0] https://lore.kernel.org/openbmc/20210929115409.21254-1-zev@bewilderbeest.net/ [1] https://lore.kernel.org/openbmc/CAL_JsqJH+b5oFuSP+KBLBsN5QTA6xASuqXJWXUaDkHhugXPpnQ@mail.gmail.com/ [2] https://lore.kernel.org/openbmc/20210929220038.GS17315@packtop/ [3] https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git/commit/?id=6663ae07d995f5fbe2988a19858b2f87e68cf929 Zev Weiss (9): sysfs: add sysfs_remove_bin_file_self() function sysfs: add growable flag to struct bin_attribute lib/string: add sysfs_buf_streq() of: add self parameter to __of_sysfs_remove_bin_file() of: add self parameter to of_update_property() of: add support for 'dynamic' DT property of: make OF_DYNAMIC selectable independently of OF_UNITTEST dt-bindings: document new 'dynamic' common property ARM: dts: aspeed: Add e3c246d4i BIOS flash device .../devicetree/bindings/common-properties.txt | 18 ++++ .../boot/dts/aspeed-bmc-asrock-e3c246d4i.dts | 23 ++++++ drivers/of/Kconfig | 8 +- drivers/of/base.c | 7 +- drivers/of/dynamic.c | 2 +- drivers/of/kobj.c | 82 +++++++++++++++++-- drivers/of/of_private.h | 6 +- fs/sysfs/file.c | 15 +++- include/linux/of.h | 7 +- include/linux/string.h | 1 + include/linux/sysfs.h | 2 + lib/string.c | 34 ++++++++ 12 files changed, 187 insertions(+), 18 deletions(-)