Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp1251970rdb; Fri, 9 Feb 2024 15:44:11 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW6X5HsO8W+fk217/mSQjSICkcShSOTJvUBCosJ5z9AtGvwezg+DoFDd7NTHZGshj1cong61z2t7/5PgDbTTYfGaQftvSRGTYlclwriGA== X-Google-Smtp-Source: AGHT+IE0j99r9R96folVgrzJ7xpedFZb9U1c0o+9agpIEyv9QxRUv9UYwoh6ij613TFpigfAfxs4 X-Received: by 2002:a0c:e38d:0:b0:68c:cf42:b758 with SMTP id a13-20020a0ce38d000000b0068ccf42b758mr631373qvl.62.1707522251331; Fri, 09 Feb 2024 15:44:11 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707522251; cv=pass; d=google.com; s=arc-20160816; b=kVsEne42ZrmEPC9bkzds/cII49nUZoGbNS+4AZen+r/N6gdOkAEPbLHSz7rFc3sH3E /TtJNcl2aUWJCwDfZyOmDamG/FqPS+octVxMYDELxfAYDe3l0sQJtAMSPihIR2L4659u 5gzkYxk+ffg5sqX69DGwCa6rlqoiDkCzHAjsiVl5RNKirvEfe38uOgNHY3vLwswqeFig jizPUryd5kCknqp1yJzNClo/ajdE2ioNH72/+pES2s8E+reVPzJ7p37ALCvZH2dLsC8B Llw7zG4IQA+xgGaN8T2dV1gSz4N7Ol6XWRMn+ZztSrcbOwmUKU+oXUn35J882apy84Z+ 0D4w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=E6EX82mlv2PUZI/8wqJYjpyS/2QMWX82/zAWnENg/so=; fh=Lpfnq+gLYfNOu7V5+EyLVTGpTvwBWZjpqQ0MhVq+dH0=; b=qbCr3my0ps41GAwu+1qEWUwxSW9zBeFA/iScqWh6iz5oIezsHLzGr273xc9e0kPnOz 8LPw6ucCcvBpX4mceONSmBoae2m14LkIpzDxKO8nzRipjWU7LwKhsQxcblgr1CRTdieZ TQ9y0+hfNiKyL7UJ34rDsmeR2FSrZwee6lWb1MedDqgYc8gkH4SRlcPTGzBii2Mdkp7h eoD78MmTXtuJxX3n4yKs8HZLQgdW1QjfW2CIt/HpSctwn9kWhrqR8C6NSRhAmpKZ9Prk BDrmFQCtRioPsKOVajnPaQ3rDFWH43ivtg94G6UQlf0JpQZwhn7NPtwn3gw2AgYCTgTM B3bg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BXCqog+r; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-bluetooth+bounces-1735-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-1735-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=2; AJvYcCUKmHL5ZYBEj63xTMgAOYTcCXDyEhGuoVO343b5pDuJAVDmkOPXWCvLNe1ScA1kApVu04ie4YRxMsOznp9cc9VA7nsOOgNTJQaLRix5Rw== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id gs13-20020a056214226d00b0068ccc9a313csi2980569qvb.606.2024.02.09.15.44.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 15:44:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-bluetooth+bounces-1735-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BXCqog+r; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-bluetooth+bounces-1735-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-1735-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 1A3CF1C24A01 for ; Fri, 9 Feb 2024 23:44:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B7DF138FA1; Fri, 9 Feb 2024 23:44:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="BXCqog+r" X-Original-To: linux-bluetooth@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0B84A20DEA; Fri, 9 Feb 2024 23:44:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707522240; cv=none; b=sqWF2JEhAaRLQvzrwYQlbcVirE5N1slc3RU5zb2gBB+baUp7P2EucCVYAPbS0ZAuFrssC3r9ze2TMCK6toVaKZS6sXdAvDQBFGNGc1Lzx+J4ZfLLXV8nxbhK77GDXSGOPBSNCxDftZw+CVhWPmk4UMVWY6ETdzoRAjyl/T/AcFA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707522240; c=relaxed/simple; bh=PChwu4/1OrFrHhMXnzyoAQoSeUStfLQSXILf2gucizc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=GceTVmqjNNvaFCDzQ4opru5iFiEcH5Sp2kAWQTDvrD99UsA3KGKsO00Zr5O5xjH1w0Y4xpmNuv4h4CDIwIHwLcwc8ApbWT8g6MRlhEuW22eS7tg/AbMXihX6f7RbPcXYQ3q/m9+SdWeDisAWScoLqm1+3C/G3spR22sCrRdLDpY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=BXCqog+r; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2B540C43390; Fri, 9 Feb 2024 23:43:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707522239; bh=PChwu4/1OrFrHhMXnzyoAQoSeUStfLQSXILf2gucizc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=BXCqog+r61bJ1tTkTKw1BAAknBvxi4kadeE8hG5scztIb/y/jZM5FQda/TTqe9Xha lgSfVblnEK/iV1CRQ8GcEwxPNL8Mf3Uws4WTfeyhxM7I3hYy+uq2wFbOCaDTfST4Wn gObPFvadpmu2nGJelsne8IyCnIfiZcVkdiXlfG5FUZXneL0hN0S3TnqDHz/9KBtjTa oZUHIO3TqAR9tZpbTsjYQkc53b0vn7qrwnTx/3/zHWyXp0NDTfnj8yjPik5MQ1MYXl 62+sNWBCLQiZXgGFEm175XUlGTsdk2VPKekt4U+qwriLcdPPXquMDWwrNA/m6hg9Qj Zr20XdKhkbYvg== Date: Fri, 9 Feb 2024 17:43:56 -0600 From: Bjorn Andersson To: Manivannan Sadhasivam Cc: Bartosz Golaszewski , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Marcel Holtmann , Luiz Augusto von Dentz , Bjorn Helgaas , Neil Armstrong , Alex Elder , Srini Kandagatla , Greg Kroah-Hartman , Arnd Bergmann , Abel Vesa , Lukas Wunner , linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-bluetooth@vger.kernel.org, linux-pci@vger.kernel.org, Bartosz Golaszewski Subject: Re: Re: Re: [RFC 8/9] PCI/pwrctl: add PCI power control core code Message-ID: References: <20240201155532.49707-1-brgl@bgdev.pl> <20240201155532.49707-9-brgl@bgdev.pl> <7tbhdkqpl4iuaxmc73pje2nbbkarxxpgmabc7j4q26d2rhzrv5@ltu6niel5eb4> <2q5vwm7tgmpgbrm4dxfhypbs5pdggprxouvzfcherqeevpjhrj@6wtkv4za2gg5> <20240208113201.GA17587@thinkpad> Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20240208113201.GA17587@thinkpad> On Thu, Feb 08, 2024 at 05:02:01PM +0530, Manivannan Sadhasivam wrote: > On Fri, Feb 02, 2024 at 10:52:11AM -0600, Bjorn Andersson wrote: > > On Fri, Feb 02, 2024 at 10:11:42AM +0100, Bartosz Golaszewski wrote: > > > On Fri, Feb 2, 2024 at 4:53 AM Bjorn Andersson wrote: > > [..] > > > > > + break; > > > > > + } > > > > > + > > > > > + return NOTIFY_DONE; > > > > > +} > > > > > + > > > > > +int pci_pwrctl_device_enable(struct pci_pwrctl *pwrctl) > > > > > > > > This function doesn't really "enable the device", looking at the example > > > > driver it's rather "device_enabled" than "device_enable"... > > > > > > > > > > I was also thinking about pci_pwrctl_device_ready() or > > > pci_pwrctl_device_prepared(). > > > > I like both of these. > > > > I guess the bigger question is how the flow would look like in the event > > that we need to power-cycle the attached PCIe device, e.g. because > > firmware has gotten into a really bad state. > > > > Will we need an operation that removes the device first, and then cut > > the power, or do we cut the power and then call unprepared()? > > > > Currently, we don't power cycle while resetting the devices. Most of the drivers > just do a software reset using some register writes. Part of the reason for > that is, the drivers themselves don't control the power to the devices and there > would be no way to let the parent know about the firmware crash. > I don't know what the appropriate design for this is, but we do have a need for being able to recover from this state by the means of power-cycling the device. If it's not possible to let the device do it (in any fashion), then perhaps a user-space-assisted model is needed? Turning on power is an important first step, but please do consider the full scope of the known problem space. Regards, Bjorn