Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp444710pxj; Thu, 3 Jun 2021 10:25:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzcf1jQDHdBD7tl+1z3HBIYvjOkCIjomcnF9LQEGetHau6/fx+CX9haz0xW8pSJ9uUz5TW9 X-Received: by 2002:a17:906:85da:: with SMTP id i26mr412545ejy.185.1622741113075; Thu, 03 Jun 2021 10:25:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622741113; cv=none; d=google.com; s=arc-20160816; b=AbkProvUGgDSMONHWEBOz5gKVePiDTKu45jQPZd90PToXMQk9ZLTrOIVP59e4rbxhF KEU4wrAJHgpKbq+P59+6lj4MHZhKkwyptOujQS5WDFa5Mysqo2kv0UGQ69yzfn5S5EDP B+23cJkHKbtC9yzVI/8wbzkNeND5m0PNXAYJJhCeIZ1Svf0KqYnLSB5rHSkReWMXSJuD MOR5f3VMHSl8Xsybd7bQSiC0YDlY0k84mFkLbXy9J9QH9olzz9TnQQAeDvBQEF3jF3Fu kLUOuie6nND06zBxdDnT3ly42u/r9aHR6g6IOpEWqOcxUd66gqFwbdegAZ8pRQbNQW1m g8/g== 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 :message-id:subject:cc:to:from:date:dkim-signature; bh=mBySJKhYY0+m2nesbVcvcVJCRIexkchIkZKYl+W9KoI=; b=TY83zKu+djrbI0JbCARObUr5VBx1IVFr02ufDPjMV3o7uoP3nh54tta6PK0N1JGbba 2+EvOltfi5723pedkc+FGvIzpVvedlGQZksfq19GC5TkTVc654oASwD9ooUVIAsuPkWg Rc2i48YORgcCrmqJhXttgK+nhodJxamFkqW9Oyuy4QDKoMbQegcqH2ZChMQfxS/PVXgD WvQ+cG/iAEHkoM+7JaPWxke3n+P1C62Htw2OtxrY27gC2X6AD3EoKZ0OpVAFVPMrk/R8 rnOkNzVX4nWi2meyJ3FjN3/oLH3NVrecGmDBk9c4LD+nNAezej1e2sXM29ORI+aPA9GS wyTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="ORkYe/YO"; 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 os10si2681174ejb.60.2021.06.03.10.24.47; Thu, 03 Jun 2021 10:25:13 -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="ORkYe/YO"; 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 S230098AbhFCRZA (ORCPT + 99 others); Thu, 3 Jun 2021 13:25:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:53538 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229695AbhFCRZA (ORCPT ); Thu, 3 Jun 2021 13:25:00 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id CD55F613BA; Thu, 3 Jun 2021 17:23:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1622740995; bh=H31JsL6zbuRbFwi59OTB4iN2slHNfCC0KUrU618hVrM=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=ORkYe/YOQtyhZIMArVq/Jg6gjyM6AqtW+uVpExVURCx8d+oF38u0hlDxUlgcfIjuK +se68dCK19GL3rQzXuPNjWMzSbUopnIcEXsMX2JGotNYYwwgOqnlc85nRPxhw1gW7J G4a3zaS/f1/u+gMsqWaPRRFGOwstes+dPI4t0kTU3wfInStUJTmmh3Ulx+6oVjQlrw mEe18bEKdnOiaW53kly1jD9SFYIUofFoBnDCYaKX7Tz6xBzud2ykgT4SEo2u2g57ov T0hdP8FUUoigDRLvl9l5KSy5VpiDXenBIDybC07f8nEamuUg8Y3wx0hh2vvA0G1Q+H 4hmUW1aget0Rg== Date: Thu, 3 Jun 2021 12:23:13 -0500 From: Bjorn Helgaas To: Florian Fainelli Cc: Jim Quinlan , linux-pci@vger.kernel.org, Bjorn Helgaas , Nicolas Saenz Julienne , bcm-kernel-feedback-list@broadcom.com, james.quinlan@broadcom.com, Nicolas Saenz Julienne , Lorenzo Pieralisi , Rob Herring , "moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE" , "moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE" , open list Subject: Re: [PATCH v1 4/4] PCI: brcmstb: add shutdown call to driver Message-ID: <20210603172313.GA2123252@bjorn-Precision-5520> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2c046f34-8bf1-97ff-3440-7351c7b2d528@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 26, 2021 at 10:03:47AM -0700, Florian Fainelli wrote: > On 5/25/21 2:18 PM, Bjorn Helgaas wrote: > > On Tue, Apr 27, 2021 at 01:51:39PM -0400, Jim Quinlan wrote: > >> The shutdown() call is similar to the remove() call except the former does > >> not need to invoke pci_{stop,remove}_root_bus(), and besides, errors occur > >> if it does. > > > > This doesn't explain why shutdown() is necessary. "errors occur" > > might be a hint, except that AFAICT, many similar drivers do invoke > > pci_stop_root_bus() and pci_remove_root_bus() (several of them while > > holding pci_lock_rescan_remove()), without implementing .shutdown(). > > We have to implement .shutdown() in order to meet a certain power budget > while the chip is being put into S5 (soft off) state and still support > Wake-on-WLAN, for our latest chips this translates into roughly 200mW of > power savings at the wall. We could probably add a word or two in a v2 > that indicates this is done for power savings. "Saving power" is a great reason to do this. But we still need to connect this to the driver model and the system-level behavior somehow. The pci_driver comment says @shutdown is to "stop idling DMA operations" and it hooks into reboot_notifier_list in kernel/sys.c. That's incorrect or at least incomplete because reboot_notifier_list isn't mentioned at all in kernel/sys.c, and I don't see the connection between @shutdown and reboot_notifier_list. AFAICT, @shutdown is currently used in this path: kernel_restart_prepare or kernel_shutdown_prepare device_shutdown dev->bus->shutdown pci_device_shutdown # pci_bus_type.shutdown drv->shutdown so we're going to either reboot or halt/power-off the entire system, and we're not going to use this device again until we're in a brand-new kernel and we re-enumerate the device and re-register the driver. I'm not quite sure how either of those fits into the power-saving reason. I guess going to S5 is probably via the kernel_power_off() path and that by itself doesn't turn off as much power to the PCIe controller as it could? And this new .shutdown() method will get called in that path and will turn off more power, but will still leave enough for wake-on-LAN to work? And when we *do* wake from S5, obviously that means a complete boot with a new kernel. Bjorn