Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp1167075pxb; Thu, 7 Oct 2021 02:08:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxRpWKfxvJOVFYlwxWW/Ka6GHFq5h8dSFOkl1C+Urs8HvYoxZC72PcbsE80MBItgePPu1jz X-Received: by 2002:a63:3549:: with SMTP id c70mr2450688pga.179.1633597724502; Thu, 07 Oct 2021 02:08:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633597724; cv=none; d=google.com; s=arc-20160816; b=FNCGC8EQsUUyj4WLbUhCbge12vFiFKvteJXQRCUoGUu2aeVoInoMRCib3IjlY/c6Fv Xc4mMdt+IKBfSU9j8BWREbxuzlPV8mU8EboTwd3KnhPMNemC5LpAopMo3T2AB8nZpnJb nX2D2AjeF2mU53ne8K42hpEs3OFRqC+BseRQFSWjoLpMaDx0s5LNUW7fyNWeqlwi3kIH XYnULnLPp9F8eu1Q8dfrJyao/zLF35ryEZfbQXoZrh0yIYI5lHCYkEo5qrxjY3S4zp3m NUoTd7S6n/wWJ6L7/86ZCW7YDXGs1OTJ0Cv1SkRonEjmweI+JdDAkCDdiMuaH/B+vn2K UCHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=m8q3ivL4JNCs32ZTM2MObocXXvZZ0W1tFJVUtNGkFTo=; b=iZ7GqvGBAgDqplr6MbAtAPkd3q6H6L0d5E9gsIomdpXOVyNs0rJXOMQxCqOJdN3eJR p10jLoeRL5IfOhd6BEZIS/pg1wYgkIq8d515wPMObvpAToSw5A/20UIOdDSOtDM2R+s8 1NipPHpQ1fDdOivPRmHoF1K3WTpYmpgY8633ZamzeMCICV/knvdMr2ubdHYwnRgO5veO Y92r01WeV/6V9iFpv5mh8/NrPdHRGwoNTx6gqEJoSAXggYKS279cFgPoUtZ/f0W4sR4U qucWJPaIIflOLhymy1WXTADOqvKINoYWQHLA8q3SMiucghQyh1Zabq8wnMKohGr+eCHD F+7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bewilderbeest.net header.s=thorn header.b=bHul7hkl; 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 z132si17555948pfc.153.2021.10.07.02.08.29; Thu, 07 Oct 2021 02:08:44 -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=bHul7hkl; 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 S240393AbhJGJHm (ORCPT + 99 others); Thu, 7 Oct 2021 05:07:42 -0400 Received: from thorn.bewilderbeest.net ([71.19.156.171]:37829 "EHLO thorn.bewilderbeest.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232589AbhJGJHl (ORCPT ); Thu, 7 Oct 2021 05:07:41 -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 B54F0F6; Thu, 7 Oct 2021 02:05:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bewilderbeest.net; s=thorn; t=1633597547; bh=m8q3ivL4JNCs32ZTM2MObocXXvZZ0W1tFJVUtNGkFTo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=bHul7hklIuebeh7G55Y6p0NYVNaTJUWiM8AusuYh/yvLMc68T/jZr57bQqtm137Qx TTowiEFnPLLwhTTzX6T53EhX5grk/BiRFRiPNcRwk7NruSlyTjHZz7msTpDRr47dFu fQA8Vvc9186bmCEsWWzYAuF+qPu9L4x1tcyk0+VE= Date: Thu, 7 Oct 2021 02:05:41 -0700 From: Zev Weiss To: Andy Shevchenko Cc: OpenBMC Maillist , Greg Kroah-Hartman , Jeremy Kerr , Joel Stanley , Rob Herring , devicetree , 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 , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Heiner Kallweit , Nick Desaulniers , Linux Kernel Mailing List , linux-arm Mailing List , "moderated list:ARM/ASPEED MACHINE SUPPORT" Subject: Re: [PATCH 0/9] Dynamic DT device nodes Message-ID: References: <20211007000954.30621-1-zev@bewilderbeest.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 07, 2021 at 12:04:41AM PDT, Andy Shevchenko wrote: >On Thu, Oct 7, 2021 at 3:10 AM Zev Weiss wrote: >> 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). > >This seems quite dangerous. Why do you need that? Sometimes the host needs access to the flash (it's the host's firmware, after all), sometimes the BMC needs access to it (e.g. to perform an out-of-band update to the host's firmware). To achieve the latter, the flash needs to be attached to the BMC, but that requires some careful coordination with the host to arbitrate which one actually has access to it (that coordination is handled by userspace, which then tells the kernel explicitly when the flash should be attached and detached). What seems dangerous? >Why can't device tree overlays be used? I'm hoping to stay closer to mainline. The OpenBMC kernel has a documented policy strongly encouraging upstream-first development: https://github.com/openbmc/docs/blob/master/kernel-development.md I doubt Joel (the OpenBMC kernel maintainer) would be eager to start carrying the DT overlay patches; I'd likewise strongly prefer to avoid carrying them myself as additional downstream patches. Hence the attempt at getting a solution to the problem upstream. > >> 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. > >What about ACPI and software nodes? I'm afraid I don't understand the question, can you elaborate on what you mean? >How will all this affect the host? Assuming the coordination mentioned above is done properly, the host will be in a quiesced state whenever the BMC is accessing the flash and hence won't notice much of anything at all (the BMC will detach the flash and relinquish control of it back to the host before the host is reactivated). Zev