Skip to contentSkip to conversation

ACPI: acpi_pad: Still evaluate _OST when _PUR evaluation fails

PATCH Applied Armin Wolf 2 participants 2 messages Jun 9, 2024 – Jun 13, 2024 ACPI

lore
Share & tools
lore

Armin Wolf

author
#0 lore raw

PATCH 1/1 ACPI: acpi_pad: Still evaluate _OST when _PUR evaluation fails

The ACPI specification says that if no action was performed when processing the _PUR object, _OST should still be evaluated, albeit with a different status code.

Evaluate _OST even when evaluating _PUR fails, to signal the firmware that no action was performed.

Compile-tested only.

---
 drivers/acpi/acpi_pad.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)
drivers/acpi/acpi_pad.c +15 -4
index bd1ad07f0290..350d3a892889 100644
@@ -25,6 +25,10 @@
 #define ACPI_PROCESSOR_AGGREGATOR_CLASS	"acpi_pad"
 #define ACPI_PROCESSOR_AGGREGATOR_DEVICE_NAME "Processor Aggregator"
 #define ACPI_PROCESSOR_AGGREGATOR_NOTIFY 0x80
+
+#define ACPI_PROCESSOR_AGGREGATOR_STATUS_SUCCESS	0
+#define ACPI_PROCESSOR_AGGREGATOR_STATUS_NO_ACTION	1
+
 static DEFINE_MUTEX(isolated_cpus_lock);
 static DEFINE_MUTEX(round_robin_lock);
 
@@ -382,16 +386,23 @@ static void acpi_pad_handle_notify(acpi_handle handle)
 		.length = 4,
 		.pointer = (void *)&idle_cpus,
 	};
+	u32 status;
 
 	mutex_lock(&isolated_cpus_lock);
 	num_cpus = acpi_pad_pur(handle);
 	if (num_cpus < 0) {
-		mutex_unlock(&isolated_cpus_lock);
-		return;
+		/* The ACPI specification says that if no action was performed when
+		 * processing the _PUR object, _OST should still be evaluated, albeit
+		 * with a different status code.
+		 */
+		status = ACPI_PROCESSOR_AGGREGATOR_STATUS_NO_ACTION;
+	} else {
+		status = ACPI_PROCESSOR_AGGREGATOR_STATUS_SUCCESS;
+		acpi_pad_idle_cpus(num_cpus);
 	}
-	acpi_pad_idle_cpus(num_cpus);
+
 	idle_cpus = acpi_pad_idle_cpus_num();
-	acpi_evaluate_ost(handle, ACPI_PROCESSOR_AGGREGATOR_NOTIFY, 0, &param);
+	acpi_evaluate_ost(handle, ACPI_PROCESSOR_AGGREGATOR_NOTIFY, status, &param);
 	mutex_unlock(&isolated_cpus_lock);
 }
 

--
2.39.2

maintainer Applied
#1 lore raw
Quoted 49 lines · Armin Wolf

The ACPI specification says that if no action was performed when processing the _PUR object, _OST should still be evaluated, albeit with a different status code.

Evaluate _OST even when evaluating _PUR fails, to signal the firmware that no action was performed.

Compile-tested only.

---
 drivers/acpi/acpi_pad.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)
drivers/acpi/acpi_pad.c +13 -2
index bd1ad07f0290..350d3a892889 100644
@@ -25,6 +25,10 @@
 #define ACPI_PROCESSOR_AGGREGATOR_CLASS        "acpi_pad"
 #define ACPI_PROCESSOR_AGGREGATOR_DEVICE_NAME "Processor Aggregator"
 #define ACPI_PROCESSOR_AGGREGATOR_NOTIFY 0x80
+
+#define ACPI_PROCESSOR_AGGREGATOR_STATUS_SUCCESS       0
+#define ACPI_PROCESSOR_AGGREGATOR_STATUS_NO_ACTION     1
+
 static DEFINE_MUTEX(isolated_cpus_lock);
 static DEFINE_MUTEX(round_robin_lock);
 
@@ -382,16 +386,23 @@ static void acpi_pad_handle_notify(acpi_handle handle)
                .length = 4,
                .pointer = (void *)&idle_cpus,
        };
+       u32 status;
 
        mutex_lock(&isolated_cpus_lock);
        num_cpus = acpi_pad_pur(handle);
        if (num_cpus < 0) {
-               mutex_unlock(&isolated_cpus_lock);
-               return;
+               /* The ACPI specification says that if no action was performed when
+                * processing the _PUR object, _OST should still be evaluated, albeit
+                * with a different status code.
+                */
+               status = ACPI_PROCESSOR_AGGREGATOR_STATUS_NO_ACTION;
+       } else {
+               status = ACPI_PROCESSOR_AGGREGATOR_STATUS_SUCCESS;
+               acpi_pad_idle_cpus(num_cpus);

drivers/acpi/acpi_pad.c static void acpi_pad_handle_notify(acpi_handle handle)

Quoted 10 lines
drivers/acpi/acpi_pad.c +2 -3
        }
-       acpi_pad_idle_cpus(num_cpus);
+
        idle_cpus = acpi_pad_idle_cpus_num();
-       acpi_evaluate_ost(handle, ACPI_PROCESSOR_AGGREGATOR_NOTIFY, 0, &param);
+       acpi_evaluate_ost(handle, ACPI_PROCESSOR_AGGREGATOR_NOTIFY, status, &param);
        mutex_unlock(&isolated_cpus_lock);
 }
 
--

Applied as 6.11 material, thanks!