Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp848377pxb; Wed, 6 Oct 2021 17:11:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwgBigyDZlc4WkUy75vAqB26aFPYuYQW1cPLr5lUQ7TznS1hTlrWVZ7uDV2c92iIwZFvpdZ X-Received: by 2002:a62:7a4f:0:b0:448:6a41:14bb with SMTP id v76-20020a627a4f000000b004486a4114bbmr1239322pfc.31.1633565485497; Wed, 06 Oct 2021 17:11:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633565485; cv=none; d=google.com; s=arc-20160816; b=K4BtC/MiOMCuVWOF/iBnewLuXDKQZLQHy/P4bjG9tO3fD9e79zCwErPOqfVm2kqwfm dx3LIHkhR7j/rg74Azgrz1o57cr7OFCktH949DZZmfmZtPot1hBxdZvp0frp2PZ2zCjE xpkarBhRomkkS0mH1e/xRsBb/rug/grETPtwP+D04Y185TbOvgFnlGyiDoYIcbF3J49C h3VIAKwH+wLETpS4d8LNni/LsJx3eNONY6i0ZxCuoQiy/VUszduq73a23odtUvaeM0UA 26odwJWlGX+++qtW3zaS1sYRdyGySX4aVnG1TwkhoG19FdvwIPfSkAXIIPaThZmB0aoR i88w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=XNJ+HTYwQ2IQpncUFadRIFOJg2t8M7ncy59/V0Jd3Ys=; b=nuwkTqC5bGMH3oJJyhKJW1dZfde1UwcEpAwyXws7owKMYKriFH6FecyL1WVf+zTqGg Ldtx0vWubWbVOVIIvA4L5/4hYJ5BdmRowa8UoJ46EBlIsezNpFBBwt82nq+JFeKCip9j V1vAEqE9416s1pREAv7Kd+MU4D2uXecyM5ogQ8Isaj5xfIwtWCIrAPoSukhtIoflzq0m xmWsr14eAkR0U9Yr6BbVROzQF0iTIyHdXEsKwB2dSiGoJWkJbvxkmXNaOFAI+LOLogt1 3AyBLeqwOQ57vl9D5keh+4SB3qJqepJSpg88QNF318FA/RE7r6sVT4l06GuHNAY/chOn ucsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bewilderbeest.net header.s=thorn header.b=gCPWmQkF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=bewilderbeest.net Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t23si40372676pfg.26.2021.10.06.17.11.13; Wed, 06 Oct 2021 17:11:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@bewilderbeest.net header.s=thorn header.b=gCPWmQkF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=bewilderbeest.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239972AbhJGAMA (ORCPT + 99 others); Wed, 6 Oct 2021 20:12:00 -0400 Received: from thorn.bewilderbeest.net ([71.19.156.171]:44373 "EHLO thorn.bewilderbeest.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239978AbhJGAL6 (ORCPT ); Wed, 6 Oct 2021 20:11:58 -0400 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=20Wilczy=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 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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(-) -- 2.33.0