From patchwork Mon Oct 11 04:16:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AceLan Kao X-Patchwork-Id: 1539103 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=bROmygR8; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HSQVX5C2Vz9sPf for ; Mon, 11 Oct 2021 15:17:08 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1mZmkI-0003a3-3H; Mon, 11 Oct 2021 04:17:02 +0000 Received: from mail-pj1-f45.google.com ([209.85.216.45]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1mZmkE-0003U1-6x for kernel-team@lists.ubuntu.com; Mon, 11 Oct 2021 04:16:58 +0000 Received: by mail-pj1-f45.google.com with SMTP id k23-20020a17090a591700b001976d2db364so12494309pji.2 for ; Sun, 10 Oct 2021 21:16:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/1T1l2tBFK54gc7RTVX9VzeO7C5Rwga21ETDomgYhdA=; b=bROmygR8oR24+Tui7zbBk4dAPClvyBJCLJSsS/rd6hpLMScSOV049VJmVWGg3V2vRV WmMH1Vkgj8qew8h9zOi14BdSrwUMaSJ8qzbIjOZzFWXJVeG4l9PAxddTLLbwQWDV1K66 2uFTS6d7mZVfDjIXb+VPOhUI5he8iVERza303sxrJHsAdEBu44VPvCBPckS3F/Fvi7lt 4+LYL00do7YglwastIlE+Vp7mZjs5Z3wxsHCakwqmSPx+w4OwdcH09EiRjJC2kPwoiic 9NfK3GzAQB6/qx6vlMGb33YYwGX03eMsppHVkiJYIOcqp8k7lygo5OOfcYloH2B5ksvo M/QQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=/1T1l2tBFK54gc7RTVX9VzeO7C5Rwga21ETDomgYhdA=; b=tUq8hJFGflMhlQzwvAJ8w60KlIYRrmhixxIHYjyUMYHZAsYb1CCBbIwvP/shOfmoeJ 1JupjLyQctF+sy9ohRIDCn6BtJbG+xMRNw346Evo+lyBIe5K6fwOznlwoRE2790d6Fio F+OpHadax3AJjU5XPm0JrCc5if44leXNf1hiyVQWlesmh08NuYrL7znU6nty7YMbJvaD tGjUATwutSPukuVRIvEC7vmkq2X9p6yRZx7GiriAmA4ExUWWA4zuZvbPZerj2tkR0ksJ De77I3maJiaeH/27Cxnxt4egR5NcdAq7XSDTqN0FdxhHk1yVxF5RFZt3GzJu53+tUw7M fcFQ== X-Gm-Message-State: AOAM5333ncRgxGt4hv50EuclPQ1Ax3RQc3zWCiHrZ0/QSh1cjZQZcK8/ +S7uACuM3fF1sJMa1TysljH7SyopM6g= X-Google-Smtp-Source: ABdhPJyjtmE41JNN4Sh9tNqLdy6gFCfz1TnQlN+CnsvumCXO8P97nzGIkVVI73zwGaMse+OrmcEmzg== X-Received: by 2002:a17:902:e0d5:b0:13f:25a0:d26b with SMTP id e21-20020a170902e0d500b0013f25a0d26bmr9959548pla.53.1633925814748; Sun, 10 Oct 2021 21:16:54 -0700 (PDT) Received: from localhost (220-135-95-34.hinet-ip.hinet.net. [220.135.95.34]) by smtp.gmail.com with ESMTPSA id k17sm6137175pfk.16.2021.10.10.21.16.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Oct 2021 21:16:54 -0700 (PDT) From: AceLan Kao To: kernel-team@lists.ubuntu.com Subject: [PATCH 1/3][SRU][OEM-5.13][OEM-5.14] PCI/ASPM: Introduce a new helper to report ASPM capability Date: Mon, 11 Oct 2021 12:16:30 +0800 Message-Id: <20211011041632.52463-8-acelan.kao@canonical.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211011041632.52463-1-acelan.kao@canonical.com> References: <20211011041632.52463-1-acelan.kao@canonical.com> MIME-Version: 1.0 Received-SPF: pass client-ip=209.85.216.45; envelope-from=acelan@gmail.com; helo=mail-pj1-f45.google.com X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Kai-Heng Feng BugLink: https://bugs.launchpad.net/bugs/1946433 Introduce a new helper, pcie_aspm_capable(), to report ASPM capability. The user will be introduced by next patch. Signed-off-by: Kai-Heng Feng Acked-by: Bjorn Helgaas (cherry picked from https://patchwork.kernel.org/project/linux-pci/patch/20211007161552.272771-2-kai.heng.feng@canonical.com/) Signed-off-by: Chia-Lin Kao (AceLan) --- drivers/pci/pcie/aspm.c | 11 +++++++++++ include/linux/pci.h | 2 ++ 2 files changed, 13 insertions(+) diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c index 04bf45a319806..9523cd6468ee5 100644 --- a/drivers/pci/pcie/aspm.c +++ b/drivers/pci/pcie/aspm.c @@ -1202,6 +1202,17 @@ bool pcie_aspm_enabled(struct pci_dev *pdev) } EXPORT_SYMBOL_GPL(pcie_aspm_enabled); +bool pcie_aspm_capable(struct pci_dev *pdev) +{ + struct pcie_link_state *link = pcie_aspm_get_link(pdev); + + if (!link) + return false; + + return link->aspm_capable; +} +EXPORT_SYMBOL_GPL(pcie_aspm_capable); + static ssize_t aspm_attr_show_common(struct device *dev, struct device_attribute *attr, char *buf, u8 state) diff --git a/include/linux/pci.h b/include/linux/pci.h index d1acc76dcdcbc..ba608741d2e14 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -1604,6 +1604,7 @@ int pci_disable_link_state_locked(struct pci_dev *pdev, int state); void pcie_no_aspm(void); bool pcie_aspm_support_enabled(void); bool pcie_aspm_enabled(struct pci_dev *pdev); +bool pcie_aspm_capable(struct pci_dev *pdev); #else static inline int pci_disable_link_state(struct pci_dev *pdev, int state) { return 0; } @@ -1612,6 +1613,7 @@ static inline int pci_disable_link_state_locked(struct pci_dev *pdev, int state) static inline void pcie_no_aspm(void) { } static inline bool pcie_aspm_support_enabled(void) { return false; } static inline bool pcie_aspm_enabled(struct pci_dev *pdev) { return false; } +static inline bool pcie_aspm_capable(struct pci_dev *pdev) { return false; } #endif #ifdef CONFIG_PCIEAER