Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1269294pxb; Thu, 21 Oct 2021 20:00:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy3YRtAHdJDSBITDQCirio/P06QFiJ20WsOiOHtdFrLHlY1U1wdKQzZy8dp9zGzH0ZO+nX6 X-Received: by 2002:a17:903:228c:b0:13e:f389:4ca9 with SMTP id b12-20020a170903228c00b0013ef3894ca9mr8786223plh.80.1634871649981; Thu, 21 Oct 2021 20:00:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634871649; cv=none; d=google.com; s=arc-20160816; b=QmhvLWnxr8mJlVTo6pIpTO7H+D2gNGI7+/D54PmJ6AWt81if2sICcCRw41OJvYqP+x 1Y5mLuy9C+nSO1wG1q2IA/+/+7qrij79BDeW6k5rKNxM4SXCrejqwWVh3skW3L+clEWc Mc55Vp/doGSR16DnvlxcQQWMbGAy3d/5n7djIeQ0v1SzhD0k6P8mISdChiDSa2ZN/MLB c3TZj6wtczlOCztweY0lpxl99DXtuHRLrlstM8z1HYYz+HZSiQa2QXtn9mcNdmAALoFk G9nygOHryLjSb3PE7ztvlhjMBAB8+8jtr7CUt5LuZAujaqOUToXX2ihlJ5CX0u0WuFmI c1WQ== 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=S2ro1BhytMpdY8JPxqox+fDZ1ZRy8cForqmIKH5zZig=; b=ohzJVf20JYfMx9kIEV09Yu430N9jH5m027isFkD3VU6erpaBgBoYLzMd/OtA00jCSE pmEElErFYv3dolAYYWZzXO4Wet2ZQP/8gLnI/M2kctUMFDCGaSoZN+X/rFwTIUT5w/UW 7UIxAm8Y29ZUa7+5760o/9hcRY7qM07dOLiPSeNl/jBHWasFbuCd4CHG99Kg2LUg4FBJ 3Q0yAV/XHJhGo8KxwHlvjMhSDmqOotFsAx5rdAXb/Eh8ufkkTGg7AqZ5VnF5OL/ovlaE LeRKqIUHYveRLQA58EFwJ9n6BCAIvFcVufwOCgG1DmZsHStUkYtsw0bbOelIEk2r4B7Z nq8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Pc7z+fd3; 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 u4si10743134plf.415.2021.10.21.20.00.35; Thu, 21 Oct 2021 20:00:49 -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=Pc7z+fd3; 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 S232664AbhJVDBc (ORCPT + 99 others); Thu, 21 Oct 2021 23:01:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:34258 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232672AbhJVDBa (ORCPT ); Thu, 21 Oct 2021 23:01:30 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id B842261452; Fri, 22 Oct 2021 02:59:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1634871550; bh=Yx7hUNcdU7Pjbr2DHTM7OpeDrskZ2MkKxAaVsic7w4U=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=Pc7z+fd3SrnIL/SVNOWqwWqOMHf/0QnE8nHMctfUrWMgSVdbUGeqb10ba6blwWjV9 MO7ki/IdYYsvzU0S2vIX9RSXhfZdQ2o2JkdfFBCzexJgA4tQ/LCmjT3sxKNr9LNKIg 75oP35US8tRhAenEN5yqeI5NgGIWbeb6wqzZ95zfbvsFLfC2wop2kneVA1QOrNoLXt TZie1aN8UnDaDrx2yrW75icCpwSgOcMIhBin/kkeCD9jntRbthqffZG8Kub92a/jdy L+iAagvN/npFTN7czEuo8795ahqTVb3DQTy6fKiUgN4qUfFcFiKabE3+EgRf8R7lBY Kyby4gAH+WlDw== Received: by mail-lj1-f177.google.com with SMTP id 204so313738ljf.9; Thu, 21 Oct 2021 19:59:10 -0700 (PDT) X-Gm-Message-State: AOAM530vVOjS5biOkAqyK9jHoDXORUEa112ka8lR16GtpTUyG0tpX4mx oaN569ua8O+UPUzrD/7tUNvbws3lnIh6DszhGA== X-Received: by 2002:a05:6402:643:: with SMTP id u3mr4233174edx.164.1634871537946; Thu, 21 Oct 2021 19:58:57 -0700 (PDT) MIME-Version: 1.0 References: <20211022020032.26980-1-zev@bewilderbeest.net> In-Reply-To: <20211022020032.26980-1-zev@bewilderbeest.net> From: Rob Herring Date: Thu, 21 Oct 2021 21:58:46 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 0/5] driver core, of: support for reserved devices To: Zev Weiss Cc: Frank Rowand , Greg Kroah-Hartman , OpenBMC Maillist , Jeremy Kerr , Joel Stanley , Andrew Jeffery , devicetree@vger.kernel.org, "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 21, 2021 at 9:00 PM Zev Weiss wrote: > > Hello all, > > This series is another incarnation of a couple other patchsets I've > posted recently [0, 1], but again different enough in overall > structure that I'm not sure it's exactly a v2 (or v3). > > As compared to [1], it abandons the writable binary sysfs files and at > Frank's suggestion returns to an approach more akin to [0], though > without any driver-specific (aspeed-smc) changes, which I figure might > as well be done later in a separate series once appropriate > infrastructure is in place. I skimmed this, and overall I like the approach. > The basic idea is to implement support for a status property value > that's documented in the DT spec [2], but thus far not used at all in > the kernel (or anywhere else I'm aware of): "reserved". According to > the spec (section 2.3.4, Table 2.4), this status: > > 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. > > With these changes, devices marked as reserved are (at least in some > cases, more on this later) instantiated, but will not have drivers > bound to them unless and until userspace explicitly requests it by > writing the device's name to the driver's sysfs 'bind' file. This > enables appropriate handling of hardware arrangements that can arise > in contexts like OpenBMC, where a device may be shared with another > external controller not under the kernel's control (for example, the > flash chip storing the host CPU's firmware, shared by the BMC and the > host CPU and exclusively under the control of the latter by default). > Such a device can be marked as reserved so that the kernel refrains > from touching it until appropriate preparatory steps have been taken > (e.g. BMC userspace coordinating with the host CPU to arbitrate which > processor has control of the firmware flash). > > Patches 1-3 provide some basic plumbing for checking the "reserved" > status of a device, patch 4 is the main driver-core change, and patch > 5 tweaks the OF platform code to not skip reserved devices so that > they can actually be instantiated. > > One shortcoming of this series is that it doesn't automatically apply > universally across all busses and drivers -- patch 5 enables support > for platform devices, but similar changes would be required for > support in other busses (e.g. in of_register_spi_devices(), > of_i2c_register_devices(), etc.) and drivers that instantiate DT > devices. Since at present a "reserved" status is treated as > equivalent to "disabled" and this series preserves that status quo in > those cases I'd hope this wouldn't be considered a deal-breaker, but > a thing to be aware of at least. > > Greg: I know on [1] you had commented nack-ing the addition of boolean > function parameters; patch 4 adds a flags mask instead in an analogous > situation. I'm not certain how much of an improvement you'd consider > that (hopefully at least slightly better, in that the arguments passed > at the call site are more self-explanatory); if that's still > unsatisfactory I'd welcome any suggested alternatives. Can't we add a flag bit in struct device to reflect manual binding? bind will set it and unbind clears it. Rob