From: Mario Limonciello <mario.limonciello@amd.com>
To: "Bjorn Helgaas" <bhelgaas@google.com>,
"Hans de Goede" <hdegoede@redhat.com>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
Cc: "Rafael J . Wysocki" <rjw@rjwysocki.net>,
Shyam Sundar S K <Shyam-sundar.S-k@amd.com>,
"open list:PCI SUBSYSTEM" <linux-pci@vger.kernel.org>,
"open list:X86 PLATFORM DRIVERS"
<platform-driver-x86@vger.kernel.org>,
Lukas Wunner <lukas@wunner.de>,
Kai-Heng Feng <kai.heng.feng@canonical.com>,
Mario Limonciello <mario.limonciello@amd.com>
Subject: [PATCH 2/4] PCI: Refresh root ports in pci_bridge_d3_update()
Date: Tue, 24 Oct 2023 21:05:44 -0500 [thread overview]
Message-ID: <20231025020546.504-3-mario.limonciello@amd.com> (raw)
In-Reply-To: <20231025020546.504-1-mario.limonciello@amd.com>
If pci_d3cold_enable() or pci_d3cold_disable() is called on a root
port it is ignored because there is no upstream bridge.
If called on a root port, use `no_d3cold` variable to decide policy
and also immediately refresh whether D3 is possible.
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
Changes from RFC v1:
* New patch
---
drivers/pci/pci.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 8c5a6f68f63d..28f70e8ea478 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -3021,6 +3021,9 @@ bool pci_bridge_d3_possible(struct pci_dev *bridge)
if (pci_bridge_d3_disable)
return false;
+ if (bridge->no_d3cold)
+ return false;
+
/*
* Hotplug ports handled by firmware in System Management Mode
* may not be put into D3 by the OS (Thunderbolt on non-Macs).
@@ -3096,7 +3099,11 @@ void pci_bridge_d3_update(struct pci_dev *dev)
bool d3cold_ok = true;
bridge = pci_upstream_bridge(dev);
- if (!bridge || !pci_bridge_d3_possible(bridge))
+ if (!bridge) {
+ dev->bridge_d3 = pci_bridge_d3_possible(dev);
+ return;
+ }
+ if (!pci_bridge_d3_possible(bridge))
return;
/*
--
2.34.1
next prev parent reply other threads:[~2023-10-25 2:06 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-25 2:05 [PATCH 0/4] Add support for drivers to decide bridge D3 policy Mario Limonciello
2023-10-25 2:05 ` [PATCH 1/4] PCI: Make d3cold_allowed sysfs attribute read only Mario Limonciello
2023-10-26 17:03 ` Rafael J. Wysocki
2023-10-25 2:05 ` Mario Limonciello [this message]
2023-10-25 2:05 ` [PATCH 3/4] ACPI: x86: s2idle: Export symbol for fetching constraints for module use Mario Limonciello
2023-10-25 2:05 ` [PATCH 4/4] platform/x86/amd: pmc: Add support for using constraints to decide D3 policy Mario Limonciello
2023-10-26 17:04 ` [PATCH 0/4] Add support for drivers to decide bridge " Rafael J. Wysocki
2023-10-26 17:06 ` Mario Limonciello
2023-10-26 17:10 ` Rafael J. Wysocki
2023-11-20 10:13 ` Hans de Goede
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231025020546.504-3-mario.limonciello@amd.com \
--to=mario.limonciello@amd.com \
--cc=Shyam-sundar.S-k@amd.com \
--cc=bhelgaas@google.com \
--cc=hdegoede@redhat.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=kai.heng.feng@canonical.com \
--cc=linux-pci@vger.kernel.org \
--cc=lukas@wunner.de \
--cc=platform-driver-x86@vger.kernel.org \
--cc=rjw@rjwysocki.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox