From: Mario Limonciello <mario.limonciello@amd.com>
To: "Rafael J . Wysocki" <rafael@kernel.org>,
Mika Westerberg <mika.westerberg@linux.intel.com>,
Bjorn Helgaas <helgaas@kernel.org>
Cc: <linux-pci@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
<linux-acpi@vger.kernel.org>,
Kuppuswamy Sathyanarayanan
<sathyanarayanan.kuppuswamy@linux.intel.com>,
"Iain Lane" <iain@orangesquash.org.uk>,
Shyam-sundar S-k <Shyam-sundar.S-k@amd.com>,
Mario Limonciello <mario.limonciello@amd.com>
Subject: [PATCH v9 2/3] ACPI: x86: s2idle: Adjust constraints logic building
Date: Thu, 3 Aug 2023 20:02:28 -0500 [thread overview]
Message-ID: <20230804010229.3664-3-mario.limonciello@amd.com> (raw)
In-Reply-To: <20230804010229.3664-1-mario.limonciello@amd.com>
Constraints are currently only stored when enabled. To enable
the ability to check if constraints are present they need to be
stored even if disabled.
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
v8->v9:
* New patch
---
drivers/acpi/x86/s2idle.c | 48 ++++++++++++++++++++-------------------
1 file changed, 25 insertions(+), 23 deletions(-)
diff --git a/drivers/acpi/x86/s2idle.c b/drivers/acpi/x86/s2idle.c
index ce62e61a9605e..cb2ea92af3eb7 100644
--- a/drivers/acpi/x86/s2idle.c
+++ b/drivers/acpi/x86/s2idle.c
@@ -78,6 +78,7 @@ struct lpi_device_constraint {
struct lpi_constraints {
acpi_handle handle;
int min_dstate;
+ bool enabled;
};
/* AMD Constraint package structure */
@@ -120,8 +121,7 @@ static void lpi_device_get_constraints_amd(void)
if (!lpi_constraints_table)
goto free_acpi_buffer;
- acpi_handle_debug(lps0_device_handle,
- "LPI: constraints list begin:\n");
+ acpi_handle_debug(lps0_device_handle, "LPI: constraints list begin:\n");
for (j = 0; j < package->package.count; ++j) {
union acpi_object *info_obj = &package->package.elements[j];
@@ -129,12 +129,12 @@ static void lpi_device_get_constraints_amd(void)
struct lpi_constraints *list;
acpi_status status;
+ list = &lpi_constraints_table[j];
+ list->min_dstate = -EINVAL;
+
for (k = 0; k < info_obj->package.count; ++k) {
union acpi_object *obj = &info_obj->package.elements[k];
- list = &lpi_constraints_table[lpi_constraints_table_size];
- list->min_dstate = -1;
-
switch (k) {
case 0:
dev_info.enabled = obj->integer.value;
@@ -149,27 +149,29 @@ static void lpi_device_get_constraints_amd(void)
dev_info.min_dstate = obj->integer.value;
break;
}
+ }
- if (!dev_info.enabled || !dev_info.name ||
- !dev_info.min_dstate)
- continue;
+ if (!dev_info.name)
+ continue;
- status = acpi_get_handle(NULL, dev_info.name,
- &list->handle);
- if (ACPI_FAILURE(status))
- continue;
+ status = acpi_get_handle(NULL, dev_info.name, &list->handle);
+ if (ACPI_FAILURE(status))
+ continue;
- acpi_handle_debug(lps0_device_handle,
- "Name:%s\n", dev_info.name);
+ acpi_handle_debug(lps0_device_handle,
+ "Name:%s, Enabled: %d, States: %d, MinDstate: %d\n",
+ dev_info.name,
+ dev_info.enabled,
+ dev_info.function_states,
+ dev_info.min_dstate);
- list->min_dstate = dev_info.min_dstate;
+ list->min_dstate = dev_info.min_dstate;
- if (list->min_dstate < 0) {
- acpi_handle_debug(lps0_device_handle,
- "Incomplete constraint defined\n");
- continue;
- }
+ if (list->min_dstate < 0) {
+ acpi_handle_debug(lps0_device_handle, "Incomplete constraint defined\n");
+ continue;
}
+ list->enabled = dev_info.enabled;
lpi_constraints_table_size++;
}
}
@@ -232,7 +234,7 @@ static void lpi_device_get_constraints(void)
}
}
- if (!info.enabled || !info.package || !info.name)
+ if (!info.package || !info.name)
continue;
constraint = &lpi_constraints_table[lpi_constraints_table_size];
@@ -244,7 +246,7 @@ static void lpi_device_get_constraints(void)
acpi_handle_debug(lps0_device_handle,
"index:%d Name:%s\n", i, info.name);
- constraint->min_dstate = -1;
+ constraint->min_dstate = -EINVAL;
for (j = 0; j < package_count; ++j) {
union acpi_object *info_obj = &info.package[j];
@@ -281,7 +283,7 @@ static void lpi_device_get_constraints(void)
"Incomplete constraint defined\n");
continue;
}
-
+ constraint->enabled = info.enabled;
lpi_constraints_table_size++;
}
--
2.34.1
next prev parent reply other threads:[~2023-08-04 3:44 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-04 1:02 [PATCH v9 0/3] Fix wakeup problems on some AMD platforms Mario Limonciello
2023-08-04 1:02 ` [PATCH v9 1/3] ACPI: Add comments to clarify some #ifdef statements Mario Limonciello
2023-08-04 1:02 ` Mario Limonciello [this message]
2023-08-04 4:31 ` [PATCH v9 2/3] ACPI: x86: s2idle: Adjust constraints logic building Andy Shevchenko
2023-08-04 1:02 ` [PATCH v9 3/3] PCI/ACPI: Use device constraints to decide PCI target state fallback policy Mario Limonciello
2023-08-04 4:30 ` Andy Shevchenko
2023-08-04 4:37 ` Mario Limonciello
2023-08-04 4:57 ` Andy Shevchenko
2023-08-04 13:17 ` Mika Westerberg
2023-08-04 15:56 ` Limonciello, Mario
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=20230804010229.3664-3-mario.limonciello@amd.com \
--to=mario.limonciello@amd.com \
--cc=Shyam-sundar.S-k@amd.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=helgaas@kernel.org \
--cc=iain@orangesquash.org.uk \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=mika.westerberg@linux.intel.com \
--cc=rafael@kernel.org \
--cc=sathyanarayanan.kuppuswamy@linux.intel.com \
/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