lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Message-Id: <20211021035159.1117456-3-kai.heng.feng@canonical.com> Date: Thu, 21 Oct 2021 11:51:58 +0800 From: Kai-Heng Feng <kai.heng.feng@...onical.com> To: bhelgaas@...gle.com Cc: hkallweit1@...il.com, anthony.wong@...onical.com, linux-pci@...r.kernel.org, linux-kernel@...r.kernel.org, Kai-Heng Feng <kai.heng.feng@...onical.com>, Logan Gunthorpe <logang@...tatee.com>, Krzysztof WilczyĆski <kw@...ux.com>, Vidya Sagar <vidyas@...dia.com> Subject: [PATCH v2 2/3] PCI/ASPM: Use capability to override ASPM via sysfs If we are to use sysfs to change ASPM settings, we may want to override the default ASPM policy. So use ASPM capability, instead of default policy, to be able to use all possible ASPM states. Upon power management change, pcie_aspm_pm_state_change() always re-apply the state from global ASPM policy, so also introduce a new flag to make the sysfs change persistent. Signed-off-by: Kai-Heng Feng <kai.heng.feng@...onical.com> --- v2: - Add flag to make ASPM change persistent drivers/pci/pcie/aspm.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c index 30b1bc899026..1560859ab056 100644 --- a/drivers/pci/pcie/aspm.c +++ b/drivers/pci/pcie/aspm.c @@ -60,6 +60,8 @@ struct pcie_link_state { u32 aspm_default:7; /* Default ASPM state by BIOS */ u32 aspm_disable:7; /* Disabled ASPM state */ + bool aspm_ignore_policy; /* Ignore ASPM policy after sysfs overwrite */ + /* Clock PM state */ u32 clkpm_capable:1; /* Clock PM capable? */ u32 clkpm_enabled:1; /* Current Clock PM state */ @@ -796,7 +798,8 @@ static void pcie_config_aspm_link(struct pcie_link_state *link, u32 state) static void pcie_config_aspm_path(struct pcie_link_state *link) { while (link) { - pcie_config_aspm_link(link, policy_to_aspm_state(link)); + pcie_config_aspm_link(link, link->aspm_ignore_policy ? + link->aspm_capable : policy_to_aspm_state(link)); link = link->parent; } } @@ -1238,8 +1241,8 @@ static ssize_t aspm_attr_store_common(struct device *dev, link->aspm_disable |= state; } - - pcie_config_aspm_link(link, policy_to_aspm_state(link)); + pcie_config_aspm_link(link, link->aspm_capable); + link->aspm_ignore_policy = true; mutex_unlock(&aspm_lock); up_read(&pci_bus_sem); -- 2.32.0
Powered by blists - more mailing lists