From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6DDE5C47082 for ; Thu, 3 Jun 2021 17:34:34 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3A512613F1 for ; Thu, 3 Jun 2021 17:34:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3A512613F1 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date: Message-ID:From:References:Cc:To:Subject:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=WxCBsYruk4nqcds4lZOy4NK3ov/4/fmi9s65fWFWVeg=; b=Z37Sj+6m7NN2rT+9E7pRXOQ9ge DuS4Qoj80DdBbWcBegACafXYuzTBLNaHM4kUYRavzuA/TKVDUDtXeBKjbB6OexYQxlOUYMHGEBwIc +WVdxkOgF2yvE62E99C5Kdv3zelxLWFbZhUK5c+lUIPqwcnK6n6o9N5jhpsNSeUa6xNL3VNflhNbh xfa6p4vVmt1NogeapMw2wZ4fSbE7IA8C1ch4tm+VPgON4HEOO9WP3SikLNHxLqvepylFDKafdXymA 5XxLGfwLYTSV3uafo4oOdlhzkHtZ7MeTJJPR1woBJ6pHl2TOUOaUg3sxebP/f3of29KcG2DCQTTec RkSsMESg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lorCC-009scy-W5; Thu, 03 Jun 2021 17:31:54 +0000 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lorB4-009sMs-9H; Thu, 03 Jun 2021 17:30:43 +0000 Received: by mail-pf1-x431.google.com with SMTP id s14so4532846pfd.9; Thu, 03 Jun 2021 10:30:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=OEEmRrvyAG7HsQxvCTXsvqFaf1IXsLAfiEx1WPpz0iU=; b=Oek/Iyf/BMWcXdZg8AGcTY9vNhugpCgwYyy+YNwqTcbwQB3Lt/+obhcVP4dy+tbdmm 4EgKlAWDIx+E6cFh+Jkm4eKDd0Yz+Jgpr/8exVdfBdWFGKWHw1oSGtdm6hUaFt5ksZ7i wr/aOGqWcNo4St3yitpBODuSVq44kqIaxjMPMB14GA/CRIPAMyazqpy6vphSJqlRutMy xUBiY+C6634+Av2cYoIvOw6n4L/puHUArA2TcZTMq9+GAbIgnyBbAH3NpqoC7uOtLjCY 25z0skxycK4NJrTT8CgSeg2UcqRoKHL8w+o99tEPJeS1/hzo87OkMhFks9PeSSn6qRkT whwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=OEEmRrvyAG7HsQxvCTXsvqFaf1IXsLAfiEx1WPpz0iU=; b=WqFD8K0Av/jFy3EqD5F2D1W66womNaAFvs6LloEh67lUyFTgRvMDE2niA6l3NsnhU3 7D+ExSZBVhhom2SKKJ9Ce5oXne6hPvFHZCgrLpE8TRgsS9MGfzz4iBCAzbb480+gE5wp JfNjMlnWcYtxdKIL6TfZPXR2dnAK60oZR/uF1sjiYUoHQmVw4NlfFb+Ipic+ErNB/EeE BRU2zmKuzAS8Zo7Y8KX7aASUC0YzMQ6i/Yud9MDn4FCmGZLe0z+JyCK+Wwia5iWOxIyT CEeqCvoae0BtvM24I2XBfar/uI4NKdBMtJRJlIpjidkp/ENI013bCgx5VsgD1ktPjZIh 5ztg== X-Gm-Message-State: AOAM532Tm1QFnl8sB54QjQ4pzdeGMX89RCzDvT0FY39rL60IGkS1xOh3 SYgMYquRlVOE2t6dJPkh5pc= X-Google-Smtp-Source: ABdhPJw6cKOan4hAw8pMtRcgDq0oVpE1nVRCul6xqIIl5d2LXMjbe0oR3pa/yaNXUCm52ZUj7TFi8A== X-Received: by 2002:a05:6a00:88b:b029:2de:33b3:76c9 with SMTP id q11-20020a056a00088bb02902de33b376c9mr248158pfj.30.1622741440660; Thu, 03 Jun 2021 10:30:40 -0700 (PDT) Received: from [10.67.49.104] ([192.19.223.252]) by smtp.googlemail.com with ESMTPSA id d131sm2788059pfd.176.2021.06.03.10.30.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 03 Jun 2021 10:30:40 -0700 (PDT) Subject: Re: [PATCH v1 4/4] PCI: brcmstb: add shutdown call to driver To: Bjorn Helgaas 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 References: <20210603172313.GA2123252@bjorn-Precision-5520> From: Florian Fainelli Message-ID: Date: Thu, 3 Jun 2021 10:30:37 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <20210603172313.GA2123252@bjorn-Precision-5520> Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210603_103042_411457_0FFD053E X-CRM114-Status: GOOD ( 29.02 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 6/3/21 10:23 AM, Bjorn Helgaas wrote: > 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. Correct, the S5 shutdown is via kernel_power_off() and will turn off all that we can in the PCIe root complex and its PHY, drop the PCIe link to the end-point which signals that the end-point can enter its own suspend logic, too. And yes, when we do wake-up from S5 it means booting a completely new kernel. S5 is typically implemented in our chips by keeping just a little bit of logic active to service wake-up events (infrared remotes, GPIOs, RTC, etc.). -- Florian _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel