Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp584181rdg; Tue, 10 Oct 2023 22:04:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFaMzKGOdt97im/CZDS8baqbuNnYhohmJSZHEi01rnIJviWthoZ9LkOkvQ6cCykplMSyhwV X-Received: by 2002:aa7:8894:0:b0:68f:edfd:2ac6 with SMTP id z20-20020aa78894000000b0068fedfd2ac6mr23746211pfe.0.1697000662046; Tue, 10 Oct 2023 22:04:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697000662; cv=none; d=google.com; s=arc-20160816; b=nBT4909AMW7OCKkO8SFrrwCRW28J28VxPa8xuuORMO0w9ZZQreGyIcEzVvbYMflA3/ gPN0NsCA7neZOuBbj+QABuJvN/hCChRfyavjFDKB/ylJ5On/R8LXNhuiGWJs3qTvUnsr JuNoANnYS9w1MY5tAIjuUzNDQhPFX772xnAVBMok6Zw2NH3NHUfZH05ujriS6PxZXhrK X50m93l7zSezJd0e6ZeZC5LxPGEoJDmRpz3/WSlgak0S2lPAoiSIrZy+QqdP8/gGUj5e PWhZvnZ+HCQ+J45H4xHe1qIq6Y6An8EZCqkINjANhZvJZiBTAQqNRgGglAkndKRrlQUw CmZA== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=WhDkQFV5yvDZRT3DU4NH25SGWKkDODIwk5appZgnU2s=; fh=G/OreSGKQHNeHuxQr7wJSlxDuX7AdGfJQSc9VDHqSSU=; b=qYctxlInJckANflK0A/KqXhSoAIlGzB1dwrh6DTDDbEl8rN55AdCtHWb93fjn0xslr mfH3T603MkaJuenytvj6EGQS0EklMTSBn24qX9pOPcpJmTJXoffdTtUUUezXjylfppT9 PnJG7WRQqTvOEAxL+0tGWw73Q38oDqzxFUn/E94QqE+4rrjV72nHv+Gmt56+j8h+8wy8 gaE7dEBJtdneCBz06xoOnYBOyseDl7VvgBVWZYVRqPV/t5a1dk0NEce0aZA/JlvUsef7 NDJDUHhfZQhz4OmRCJmamArWoFT5lWKlWEEDu/Lf1CzsUsN3+UKeZDh9HP+yxeBaXHZ/ 2+tg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=D14BRIXv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id q4-20020a056a00088400b0068fcc3406acsi11592321pfj.141.2023.10.10.22.04.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 22:04:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=D14BRIXv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id D836C802821B; Tue, 10 Oct 2023 22:04:17 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229571AbjJKFEL (ORCPT + 99 others); Wed, 11 Oct 2023 01:04:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345157AbjJKFDy (ORCPT ); Wed, 11 Oct 2023 01:03:54 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E817E98; Tue, 10 Oct 2023 22:03:52 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3DF6EC433C7; Wed, 11 Oct 2023 05:03:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1697000632; bh=794p5WpeA8qidxrpcDZSFxEyuDxwDmggKrBW0CTOJuc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=D14BRIXvecrU5dYW61kULPsWzX1lO8lAUNoDmm8U2p7vsc3VYQltBz7JPMqQg5WXA QZIt+ilYpgt+6sQF1+vQ492cOEMJO1UkwdWlKBzcy8y0Zf6+NaBTJjebaCjs0hoUJ3 P6QsqEbW94eJAZphtrHjIdjOKMaUE548mPJA2i8Hyme6whCWx0VxCSvzCr6k6sy1ZR xTd6ECSmhKQV/dteh4xz6KD/gEQBV5gnEp14kXOsbYnEE/I8Hk2YBcdAL6fIeIp/+J S73llBsvYox/RrbBnxg7YsDUYhPv6w5okgleib9soWEcnADs4s5XKIGJb6Odq0DY/M hYh8oFhbbeQ0g== Date: Wed, 11 Oct 2023 10:33:39 +0530 From: Manivannan Sadhasivam To: Konrad Dybcio Cc: Manivannan Sadhasivam , lpieralisi@kernel.org, kw@linux.com, bhelgaas@google.com, robh@kernel.org, gustavo.pimentel@synopsys.com, jingoohan1@gmail.com, andersson@kernel.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org Subject: Re: [PATCH v2 2/2] PCI: qcom: Enable ASPM for platforms supporting 1.9.0 ops Message-ID: <20231011050339.GD3508@thinkpad> References: <20231010155914.9516-1-manivannan.sadhasivam@linaro.org> <20231010155914.9516-3-manivannan.sadhasivam@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=2.4 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Tue, 10 Oct 2023 22:04:18 -0700 (PDT) X-Spam-Level: ** On Tue, Oct 10, 2023 at 06:33:52PM +0200, Konrad Dybcio wrote: > > > On 10/10/23 17:59, Manivannan Sadhasivam wrote: > > ASPM is supported by Qcom host controllers/bridges on most of the recent > > platforms and so the devices tested so far. But for enabling ASPM by > > default (without Kconfig/cmdline/sysfs), BIOS has to enable ASPM on both > > host bridge and downstream devices during boot. Unfortunately, none of the > > BIOS available on Qcom platforms enables ASPM. Due to this, the platforms > > making use of Qcom SoCs draw high power during runtime. > > > > To fix this power issue, users/distros have to enable ASPM using configs > > such as (Kconfig/cmdline/sysfs) or the BIOS has to start enabling ASPM. > > The latter may happen in the future, but that won't address the issue on > > current platforms. Also, asking users/distros to enable a feature to get > > the power management right would provide an unpleasant out-of-the-box > > experience. > > > > So the apt solution is to enable ASPM in the controller driver itself. And > > this is being accomplished by calling pci_enable_link_state() in the newly > > introduced host_post_init() callback for all the devices connected to the > > bus. This function enables all supported link low power states for both > > host bridge and the downstream devices. > > > > Due to limited testing, ASPM is only enabled for platforms making use of > > ops_1_9_0 callbacks. > > > > Signed-off-by: Manivannan Sadhasivam > > --- > [...] > > > +static int qcom_pcie_enable_aspm(struct pci_dev *pdev, void *userdata) > > +{ > > + /* Downstream devices need to be in D0 state before enabling PCI PM substates */ > > + pci_set_power_state(pdev, PCI_D0); > > + pci_enable_link_state(pdev, PCIE_LINK_STATE_ALL); > Do we not care about retval here? > No. Even if it fails, we shouldn't care about it. > > + > > + return 0; > > +} > > + > > +static void qcom_pcie_host_post_init_2_7_0(struct qcom_pcie *pcie) > post_init_enable_aspm? > The scope of this callback may get extended in the future. So I'd keep it as it is. - Mani -- மணிவண்ணன் சதாசிவம்