Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp762635pxb; Wed, 29 Sep 2021 09:10:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx0DIEPU5LSGAT3pKJpKODiCyy3PNSbSTF0gExSA5hGZnoPE+LyZAQt1rFazQpB+o5tub/a X-Received: by 2002:aa7:9edd:0:b0:44b:e0f2:1e34 with SMTP id r29-20020aa79edd000000b0044be0f21e34mr649621pfq.7.1632931831786; Wed, 29 Sep 2021 09:10:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632931831; cv=none; d=google.com; s=arc-20160816; b=TQJ6BMu1U2gCrJ56T2CEcAKlnqEGd+ow3lIFJqAhtODwKqdI4UqKQ8Gc2o/Rwsub8C OyhxOkkY+sq0+UtyWAMxTK8iYcA8JE2HWUiPYwuZpKlqrrqgp02saqtbQQk3IFjVwW7V lS9d75O5ncR38cqNopS37uic2CIpa3NxH4t6/FAnU6/PlpUchktK5ZTdM0ELHtOWij35 41q1BwxYJGClSac296JL8fZQLLNK5ZHa2XBfXuZUfx2yb+8uUh1sqpD5uEwX4VjcEn48 GaupaDiFIEA8TOxenf8PimcxkxuS2peEoH6lwaglk27/iPzI44VcHVuRI26uaS+kP2nU mNJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=W3mBwEkSK1dvAMa7cyWrNmHQPQ14b/bMUNx7JlrzB7U=; b=veIRfES8ZUFf2u3JlIRUc/G2RrqEZxlT+hv/uQrQCOSawuV/eVg4Q9W4aAtRH0jy1C QNtaaONgAgw57Nmgqc3KwALwWpft77rJgQP3ZNi9CH1DfhRzERrHpxL9SzI58uPI+jay SMlU8OM7muKuon08PB9zf27jpzwx6C4OVELmXjU6n+mZMIWAKKWBLnXVEpG7KO57C3yC sSCgF5TnK7Vvlh8if3bXHFlo7da9gfjx2/tdfKLcDMPAuR3xbHFm1vPd0AbXzxUbDLxx SVKzvprxQHkWUxNhd2oOrvdPvkk5qy7RRaF6Tn+UJuaEhEEei7cHVNnuoNDESbTsyRm6 a+7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="F/l734se"; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p2si252652pjt.183.2021.09.29.09.10.16; Wed, 29 Sep 2021 09:10:31 -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=@kernel.org header.s=k20201202 header.b="F/l734se"; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345669AbhI2QKu (ORCPT + 99 others); Wed, 29 Sep 2021 12:10:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:56420 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344611AbhI2QKn (ORCPT ); Wed, 29 Sep 2021 12:10:43 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8329F615A7; Wed, 29 Sep 2021 16:09:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1632931742; bh=dijA/w5Ov8JsJ92OsBZBg2039bqDhk6Rb6AyNDbPn44=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=F/l734se74TwmNKqonr45ks6Q850RYvThvXxxdhTyJf3RZw1rzmHm3f7Rq9l4TUbH fCysjvBQWOc0oroYUgIl8V24IheYEjz/xul/maQHbKIuA3dZbOEHR2gT16yODw6rm1 zPYdjJjh+cZ/tQsX2hXR4jU27EPuJG0V8gOdWwXEZ6enjVntGut2AW04aaIAv5b1sU rEZ2oJjqzcqpRmnxCPLNc7xqE3BifgIvrvORJApCCs674vkO5pDWID5V24/iPO7OWm /X5UYk8JAvcdEZojKGLgFtk+TI+8C06JdmyrCjjdItiybmC3AKcCoVNIoSE7EJKq2l 4IZZ5MbZW1gkw== Received: by mail-ed1-f41.google.com with SMTP id bd28so10484450edb.9; Wed, 29 Sep 2021 09:09:02 -0700 (PDT) X-Gm-Message-State: AOAM533VDs/brX/1UDJ0JEbcn63icQo4cgetb+gUo5rQGcJ2Zcb8YfxR +RxXsVTEeWD4bEWTRHky/uE1ozeKjLJu+o/Liw== X-Received: by 2002:a17:906:7250:: with SMTP id n16mr562242ejk.147.1632931694940; Wed, 29 Sep 2021 09:08:14 -0700 (PDT) MIME-Version: 1.0 References: <20210929115409.21254-1-zev@bewilderbeest.net> In-Reply-To: <20210929115409.21254-1-zev@bewilderbeest.net> From: Rob Herring Date: Wed, 29 Sep 2021 11:08:03 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 0/6] Dynamic aspeed-smc flash chips via "reserved" DT status To: Zev Weiss Cc: OpenBMC Maillist , Greg Kroah-Hartman , Jeremy Kerr , Joel Stanley , =?UTF-8?Q?C=C3=A9dric_Le_Goater?= , Frank Rowand , devicetree@vger.kernel.org, "linux-kernel@vger.kernel.org" , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , MTD Maling List , Tudor Ambarus , Michael Walle , Pratyush Yadav , Andrew Jeffery , linux-arm-kernel , linux-aspeed Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 29, 2021 at 6:54 AM Zev Weiss wrote: > > Hello, > > This patch series aims to improve a scenario that arises in OpenBMC > and which isn't handled very well at the moment. Certain devices, the > example at hand being the flash chip used to store the host's firmware > (e.g. the BIOS), may be shared between the BMC and the host system but > only available to one or the other at any given time. The device may > thus be effectively off-limits to the BMC when it boots, and only > usable after userspace performs the necessary steps to coordinate > appropriately with the host (tracking its power state, twiddling > GPIOs, sending IPMI commands, etc.). > > Neither the "okay" nor the "disabled" device-tree status values works > nicely for the flash device this case -- an "okay" device gets probed > automatically as soon as the device and a driver for it are available, > and a "disabled" one gets forgotten about entirely, whereas we want > the BMC's kernel to be aware of the existence of the device, but not > try to actually do anything with it (i.e. probe it) until explicitly > requested to do so by userspace. While Linux treats 'disabled' as gone forever, that's not exactly what the spec says. Either disabled or reserved could change in theory. But I do agree 'reserved' is the right choice for your use. > However, while there's no support for it currently in the kernel tree, > the device-tree spec [0] also lists "reserved" as a possible status > value, and its description seems like a fairly reasonable fit for this > situation: > > Indicates that the device is operational, but should not be used. > Typically this is used for devices that are controlled by another > software component, such as platform firmware. > > These patches start making use of this status value in the aspeed-smc > driver. The first patch adds a companion routine to > of_device_is_available() that checks for a "reserved" status instead > of "okay". The second patch is a small MTD adjustment to allow an > unregistered device to be cleanly re-registered. Patches 3 through 5 > modify the aspeed-smc driver to allow individual chips to be attached > and detached at runtime, and to avoid automatically attaching any > marked as reserved. Finally, patch 6 employs the newly-supported > status in adding support for the BIOS flash device to the ASRock Rack > e3c246d4i BMC. I'm not sure this should be MTD specific. There's other cases where we may want devices to become available. So the question is whether there should be a more generic mechanism rather than each subsystem coming up with their own thing. There's out of tree support for applying overlays which could be used here. The issue with it is we don't want it to be unconstrained where an overlay can make any change anywhere in a DT. Another possibility is making 'status' writeable from userspace. It is just a sysfs file. That too may need to be opt-in. Rob