Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1390797pxb; Thu, 4 Mar 2021 10:05:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJxpy4mgztpy01eMOQFOvk4RIECW0OV4BdMVHz/rDX8HYQwBC6f461mjYioYgO0s3ku2aeh5 X-Received: by 2002:aa7:df14:: with SMTP id c20mr5746592edy.197.1614881130154; Thu, 04 Mar 2021 10:05:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614881130; cv=none; d=google.com; s=arc-20160816; b=NBPFrqTZxCYywEKPSVff9Tl5RrQWjTG6eIzoEi0JZOQj+3piFuD54xhTKIrUpsKazI L91D5fB73MV2nPAqMEwNmZ2DsboCpzEtXfkoMLKnLLlbesBk+4XCqDAoSspJBfY1+nXp b26N7MUULV016698gqLmucReziNzbOvGsPF0xHbXAAJwNeOmTN7hE16bl4sjXT0Xoz6w xd6n0Ph/epD7RwM1Lc2BU5/uixJY22l1X3MLNq3M4+AEafZeBCew4aMaijVRNaZ4EDC8 /Swp7A5Bjdoxol/KWKY5srYgaFN39wvcEdVlz10MhUGt9UkA1KHmsa2cYhDjQWK5P3mK F/0Q== 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=WkDbYcUQ7gTNugJYahkfPMhG3czp2qdc8HljoWmtXFI=; b=fuw1Tvgt08kselViSCnyjI1HVZZs9xf426u/N3XK+9kzttH7by2/5rp0Jnm2eWHuFg fX+oRkPo2o1HobMNoryr9RGrzzqrcrA0/E7pXgzcq6pHnbRobIl9eImWFBqCaSQXda+w LZ5E5aLWwmFGX+S3UXTqm0mR48+8YfgCz91dIcCFwwbnm4K9qHppjFH9rWgLhY7SWBja ny8O1roIAJpSbAlUBitttmyCaYYIJMYqrDRdnnOAHcPYgRj4FnhkhRbKxsViDR+hUdGZ /gV+NbxP63e/s8SZ/+q7ukl5OSqI0O2dQ1bTvCeHxLarNzo2S9CrATDuoVr9E1ujX3q0 f3KA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DUOSCaMG; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-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 bw14si4334261ejb.141.2021.03.04.10.05.00; Thu, 04 Mar 2021 10:05:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-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=DUOSCaMG; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-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 S236259AbhCDQDc (ORCPT + 99 others); Thu, 4 Mar 2021 11:03:32 -0500 Received: from mail.kernel.org ([198.145.29.99]:50942 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236242AbhCDQDH (ORCPT ); Thu, 4 Mar 2021 11:03:07 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1E73F64E28; Thu, 4 Mar 2021 16:02:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1614873747; bh=cGEWlSoCTya/ot2EVTO9KSdGc7xk6jo0zMvEBvDQYHE=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=DUOSCaMGuj1tnFivMq/qcuHSVZnHEWqVmUFgwmlm6MqJfY/W1AG+kVeZAaHABqPLa WvMkgfPTAGvSItB5FZaRBPTct+V6tD4fVgbQlthxSwzNUrRSzLjWh6rN8vnU3n2Sb/ msGx4V0vAVg5YmXDKCQk6WIo4HcUNmXjf88Id9PZdwo2rUW/GJOgsnG3DfWUH7YxdA IyCRCXsFAdyBC2q8rm1N8sYpDRbfEwg37athcrO63WuY/VM54nKPv5xL11/BeaJd7H jFeJjdCai9/XfMc3PKr2FwuD1wpkzN2TCPmIz61e7RnVljNSh+eOV2CvfgpNndWBVs Z25hl6GXSAggg== Date: Thu, 4 Mar 2021 10:02:25 -0600 From: Bjorn Helgaas To: Kai-Heng Feng Cc: Heiner Kallweit , Kalle Valo , Bjorn Helgaas , Yan-Hsuan Chuang , "David S. Miller" , Jakub Kicinski , linux-wireless , Linux Netdev List , open list , Linux PCI , "Rafael J. Wysocki" , linux-pm@vger.kernel.org Subject: Re: [PATCH 3/3] PCI: Convert rtw88 power cycle quirk to shutdown quirk Message-ID: <20210304160225.GA846157@bjorn-Precision-5520> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org [+cc Rafael, linux-pm] On Thu, Mar 04, 2021 at 02:07:18PM +0800, Kai-Heng Feng wrote: > On Sat, Feb 27, 2021 at 2:17 AM Bjorn Helgaas wrote: > > On Fri, Feb 26, 2021 at 02:31:31PM +0100, Heiner Kallweit wrote: > > > On 26.02.2021 13:18, Kai-Heng Feng wrote: > > > > On Fri, Feb 26, 2021 at 8:10 PM Heiner Kallweit wrote: > > > >> > > > >> On 26.02.2021 08:12, Kalle Valo wrote: > > > >>> Kai-Heng Feng writes: > > > >>> > > > >>>> Now we have a generic D3 shutdown quirk, so convert the original > > > >>>> approach to a PCI quirk. > > > >>>> > > > >>>> Signed-off-by: Kai-Heng Feng > > > >>>> --- > > > >>>> drivers/net/wireless/realtek/rtw88/pci.c | 2 -- > > > >>>> drivers/pci/quirks.c | 6 ++++++ > > > >>>> 2 files changed, 6 insertions(+), 2 deletions(-) > > > >>> > > > >>> It would have been nice to CC linux-wireless also on patches 1-2. I only > > > >>> saw patch 3 and had to search the rest of patches from lkml. > > > >>> > > > >>> I assume this goes via the PCI tree so: > > > >>> > > > >>> Acked-by: Kalle Valo > > > >> > > > >> To me it looks odd to (mis-)use the quirk mechanism to set a device > > > >> to D3cold on shutdown. As I see it the quirk mechanism is used to work > > > >> around certain device misbehavior. And setting a device to a D3 > > > >> state on shutdown is a normal activity, and the shutdown() callback > > > >> seems to be a good place for it. > > > >> I miss an explanation what the actual benefit of the change is. > > > > > > > > To make putting device to D3 more generic, as there are more than one > > > > device need the quirk. > > > > > > > > Here's the discussion: > > > > https://lore.kernel.org/linux-usb/00de6927-3fa6-a9a3-2d65-2b4d4e8f0012@linux.intel.com/ > > > > > > > > > > Thanks for the link. For the AMD USB use case I don't have a strong opinion, > > > what's considered the better option may be a question of personal taste. > > > For rtw88 however I'd still consider it over-engineering to replace a simple > > > call to pci_set_power_state() with a PCI quirk. > > > I may be biased here because I find it sometimes bothering if I want to > > > look up how a device is handled and in addition to checking the respective > > > driver I also have to grep through quirks.c whether there's any special > > > handling. > > > > I haven't looked at these patches carefully, but in general, I agree > > that quirks should be used to work around hardware defects in the > > device. If the device behaves correctly per spec, we should use a > > different mechanism so the code remains generic and all devices get > > the benefit. > > > > If we do add quirks, the commit log should explain what the device > > defect is. > > So maybe it's reasonable to put all PCI devices to D3 at shutdown? I don't know off-hand. I added Rafael and linux-pm in case they do. If not, I suggest working up a patch to do that and a commit log that explains why that's a good idea and then we can have a discussion about it. This thread really doesn't have that justification. It says "putting device X in D3cold at shutdown saves 0.03w while in S5", but doesn't explain why that's safe or desirable for all devices. Bjorn