From patchwork Tue Mar 10 01:48:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AceLan Kao X-Patchwork-Id: 1251920 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org 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=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Authentication-Results: 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=20161025 header.b=fGhZQKyO; dkim-atps=neutral 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 ozlabs.org (Postfix) with ESMTPS id 48bygQ15wNz9sRR; Tue, 10 Mar 2020 12:49:06 +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 1jBU0z-0001YF-QL; Tue, 10 Mar 2020 01:49:01 +0000 Received: from mail-pj1-f66.google.com ([209.85.216.66]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1jBU0v-0001UM-3F for kernel-team@lists.ubuntu.com; Tue, 10 Mar 2020 01:48:57 +0000 Received: by mail-pj1-f66.google.com with SMTP id u10so704557pjy.0 for ; Mon, 09 Mar 2020 18:48:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=LmjgnmIBksq43qjnH/SiHVJpRGSZlabXB28oHE+plZQ=; b=fGhZQKyOr9U+9dFjOzxv6OJtzdspAZ7w5qU6TfYa+OHFWz85IuZR9HtA2mxTpMdTiA PmFZxtbo9VXnQbsPEaci/T0MzyajPCYt7NoidzBTwOnBrIdxioD4Q47ocvqN5O8n2U6F XctaAuA9xGEVLla5c6g6s+Ek9C68kalZ4e/g6fDUBGLaNwY2OIgbVrHZGXeUikcOvGwv Zj3hbVvYlRnhCvSk/2ORtNWrOAisDvIqoMailX7jJeOTVib9lD2YabfoPhKbSEIQtHFe ICEGH4KmWNBDXqMV5S8NDlhkvFbaoQ4sQGX0tH3yLfCdFONNUPEajBlxp7T0+fpp0KNo 7C/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=LmjgnmIBksq43qjnH/SiHVJpRGSZlabXB28oHE+plZQ=; b=TILYZnklNh41qgpaNXgXlllWYTPjC8VXMbUuM1SQHIdSrg3Ny61Oh2mGAeDAP01vRg yjfrJXpCgEc1yWbDh/1jFoqjgAanJOyyCOSUBDGuKQyn+cj5IvAFC8Fd5bJ/ZBvNhs7z /eyA886B75HnRT4CQguZaviLI+Bag4GR8s2/SmXG7qtA3O9UbKN2I6OM7vX3YbEqEFkM QaaHlb+dIT/lre+ZOKl2qQBWRNRdkcR77B7P6PiNDYKDUKRdcHHRewRPn9dRY1SIcWI8 8+6ZIOuVIn69y93vZZap+Bqk9Qc3ItdLW7j+ljjf1sR3BErLbXPimWTnz7qACJ7nfWGA NtPQ== X-Gm-Message-State: ANhLgQ3xbZmaIb/Cr3GuT8Y4jhcCSuvEYWwBRb169r5mmYRXXrM/Sxwm RhW/dstz2da08+Qw2YnrNx6nhNtH X-Google-Smtp-Source: ADFU+vsn8O5C8TqznMqm8mfnfOSNqiUNE+6Vy4pnQIP1LkRib4NfCLbLaSLplR1eMx0WZEustKpaVg== X-Received: by 2002:a17:902:a409:: with SMTP id p9mr18746122plq.211.1583804935062; Mon, 09 Mar 2020 18:48:55 -0700 (PDT) Received: from localhost (61-220-137-37.HINET-IP.hinet.net. [61.220.137.37]) by smtp.gmail.com with ESMTPSA id cm2sm750939pjb.23.2020.03.09.18.48.54 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 09 Mar 2020 18:48:54 -0700 (PDT) From: AceLan Kao To: kernel-team@lists.ubuntu.com Subject: [PATCH 6/7][SRU][Focal] PCI/ASPM: Remove PCIEASPM_DEBUG Kconfig option and related code Date: Tue, 10 Mar 2020 09:48:35 +0800 Message-Id: <20200310014836.23656-7-acelan.kao@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200310014836.23656-1-acelan.kao@canonical.com> References: <20200310014836.23656-1-acelan.kao@canonical.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: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Heiner Kallweit BguLink: https://bugs.launchpad.net/bugs/1836030 Previously, CONFIG_PCIEASPM_DEBUG enabled "link_state" and "clk_ctl" sysfs files that controlled ASPM. We believe these files were rarely if ever used. We recently added sysfs ASPM controls that are always present, so the debug code is no longer needed. Removing this debug code has been discussed for quite some time, see e.g. [0]. Remove PCIEASPM_DEBUG and the related code. [0] https://lore.kernel.org/lkml/20180727202619.GD173328@bhelgaas-glaptop.roam.corp.google.com/ Link: https://lore.kernel.org/r/ec935d8e-c084-3938-f1d1-748617596b25@gmail.com Signed-off-by: Heiner Kallweit Signed-off-by: Bjorn Helgaas (cherry picked from commit 87e90283c94c76ee11d379ab5a0973382bbd0baf) Signed-off-by: AceLan Kao --- drivers/pci/pci-sysfs.c | 3 -- drivers/pci/pci.h | 8 --- drivers/pci/pcie/Kconfig | 7 --- drivers/pci/pcie/aspm.c | 105 --------------------------------------- 4 files changed, 123 deletions(-) diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c index 0e76c02e0b7d..92bf1b1ce280 100644 --- a/drivers/pci/pci-sysfs.c +++ b/drivers/pci/pci-sysfs.c @@ -1330,7 +1330,6 @@ static int pci_create_capabilities_sysfs(struct pci_dev *dev) int retval; pcie_vpd_create_sysfs_dev_files(dev); - pcie_aspm_create_sysfs_dev_files(dev); if (dev->reset_fn) { retval = device_create_file(&dev->dev, &dev_attr_reset); @@ -1340,7 +1339,6 @@ static int pci_create_capabilities_sysfs(struct pci_dev *dev) return 0; error: - pcie_aspm_remove_sysfs_dev_files(dev); pcie_vpd_remove_sysfs_dev_files(dev); return retval; } @@ -1416,7 +1414,6 @@ int __must_check pci_create_sysfs_dev_files(struct pci_dev *pdev) static void pci_remove_capabilities_sysfs(struct pci_dev *dev) { pcie_vpd_remove_sysfs_dev_files(dev); - pcie_aspm_remove_sysfs_dev_files(dev); if (dev->reset_fn) { device_remove_file(&dev->dev, &dev_attr_reset); dev->reset_fn = 0; diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index 317a796a723e..09d54503f366 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h @@ -545,14 +545,6 @@ static inline void pcie_aspm_pm_state_change(struct pci_dev *pdev) { } static inline void pcie_aspm_powersave_config_link(struct pci_dev *pdev) { } #endif -#ifdef CONFIG_PCIEASPM_DEBUG -void pcie_aspm_create_sysfs_dev_files(struct pci_dev *pdev); -void pcie_aspm_remove_sysfs_dev_files(struct pci_dev *pdev); -#else -static inline void pcie_aspm_create_sysfs_dev_files(struct pci_dev *pdev) { } -static inline void pcie_aspm_remove_sysfs_dev_files(struct pci_dev *pdev) { } -#endif - #ifdef CONFIG_PCIE_ECRC void pcie_set_ecrc_checking(struct pci_dev *dev); void pcie_ecrc_get_policy(char *str); diff --git a/drivers/pci/pcie/Kconfig b/drivers/pci/pcie/Kconfig index 362eb8cfa53b..a2e862d4ec21 100644 --- a/drivers/pci/pcie/Kconfig +++ b/drivers/pci/pcie/Kconfig @@ -79,13 +79,6 @@ config PCIEASPM When in doubt, say Y. -config PCIEASPM_DEBUG - bool "Debug PCI Express ASPM" - depends on PCIEASPM - help - This enables PCI Express ASPM debug support. It will add per-device - interface to control ASPM. - choice prompt "Default ASPM policy" default PCIEASPM_DEFAULT diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c index 9cd251827a67..0dcd44308228 100644 --- a/drivers/pci/pcie/aspm.c +++ b/drivers/pci/pcie/aspm.c @@ -1218,111 +1218,6 @@ bool pcie_aspm_enabled(struct pci_dev *pdev) } EXPORT_SYMBOL_GPL(pcie_aspm_enabled); -#ifdef CONFIG_PCIEASPM_DEBUG -static ssize_t link_state_show(struct device *dev, - struct device_attribute *attr, - char *buf) -{ - struct pci_dev *pci_device = to_pci_dev(dev); - struct pcie_link_state *link_state = pci_device->link_state; - - return sprintf(buf, "%d\n", link_state->aspm_enabled); -} - -static ssize_t link_state_store(struct device *dev, - struct device_attribute *attr, - const char *buf, - size_t n) -{ - struct pci_dev *pdev = to_pci_dev(dev); - struct pcie_link_state *link, *root = pdev->link_state->root; - u32 state; - - if (aspm_disabled) - return -EPERM; - - if (kstrtouint(buf, 10, &state)) - return -EINVAL; - if ((state & ~ASPM_STATE_ALL) != 0) - return -EINVAL; - - down_read(&pci_bus_sem); - mutex_lock(&aspm_lock); - list_for_each_entry(link, &link_list, sibling) { - if (link->root != root) - continue; - pcie_config_aspm_link(link, state); - } - mutex_unlock(&aspm_lock); - up_read(&pci_bus_sem); - return n; -} - -static ssize_t clk_ctl_show(struct device *dev, - struct device_attribute *attr, - char *buf) -{ - struct pci_dev *pci_device = to_pci_dev(dev); - struct pcie_link_state *link_state = pci_device->link_state; - - return sprintf(buf, "%d\n", link_state->clkpm_enabled); -} - -static ssize_t clk_ctl_store(struct device *dev, - struct device_attribute *attr, - const char *buf, - size_t n) -{ - struct pci_dev *pdev = to_pci_dev(dev); - bool state; - - if (strtobool(buf, &state)) - return -EINVAL; - - down_read(&pci_bus_sem); - mutex_lock(&aspm_lock); - pcie_set_clkpm_nocheck(pdev->link_state, state); - mutex_unlock(&aspm_lock); - up_read(&pci_bus_sem); - - return n; -} - -static DEVICE_ATTR_RW(link_state); -static DEVICE_ATTR_RW(clk_ctl); - -static char power_group[] = "power"; -void pcie_aspm_create_sysfs_dev_files(struct pci_dev *pdev) -{ - struct pcie_link_state *link_state = pdev->link_state; - - if (!link_state) - return; - - if (link_state->aspm_support) - sysfs_add_file_to_group(&pdev->dev.kobj, - &dev_attr_link_state.attr, power_group); - if (link_state->clkpm_capable) - sysfs_add_file_to_group(&pdev->dev.kobj, - &dev_attr_clk_ctl.attr, power_group); -} - -void pcie_aspm_remove_sysfs_dev_files(struct pci_dev *pdev) -{ - struct pcie_link_state *link_state = pdev->link_state; - - if (!link_state) - return; - - if (link_state->aspm_support) - sysfs_remove_file_from_group(&pdev->dev.kobj, - &dev_attr_link_state.attr, power_group); - if (link_state->clkpm_capable) - sysfs_remove_file_from_group(&pdev->dev.kobj, - &dev_attr_clk_ctl.attr, power_group); -} -#endif - static ssize_t aspm_attr_show_common(struct device *dev, struct device_attribute *attr, char *buf, u8 state)