From 427f536a70fdf57652d0b8751be289846326832d Mon Sep 17 00:00:00 2001
From: Giovanni Gherdovich <ggherdovich@suse.cz>
Date: Mar 21 2025 16:38:03 +0000
Subject: ACPI: processor: idle: Return an error if both P_LVL{2,3}

idle states are invalid (bsc#1237530).

---

diff --git a/patches.suse/ACPI-processor-idle-return-an-error-if-both-P_LVL-2-.patch b/patches.suse/ACPI-processor-idle-return-an-error-if-both-P_LVL-2-.patch
new file mode 100644
index 0000000..84fc1e9
--- /dev/null
+++ b/patches.suse/ACPI-processor-idle-return-an-error-if-both-P_LVL-2-.patch
@@ -0,0 +1,49 @@
+From: Giovanni Gherdovich <ggherdovich@suse.cz>
+Date: Fri, 21 Mar 2025 10:46:57 +0100
+Subject: ACPI: processor: idle: Return an error if both P_LVL{2,3}
+ idle states are invalid
+Patch-mainline: not yet, will be submitted
+References: bsc#1237530
+
+Prior to commit 496121c02127e9c460b436244c38260b044cc45a ("ACPI: processor:
+idle: Allow probing on platforms with one ACPI C-state"), the acpi_idle
+driver wouldn't load on systems without a valid C-State at least as deep
+as C2. The behavior was desirable for guests on hypervisors such as VMWare
+ESXi, which by default don't have the _CST ACPI method, and set the C2 and
+C3 latencies to 101 and 1001 microseconds respectively via the FADT, to
+signify they're unsupported.
+
+Since the above change though, these virtualized deployments end up loading
+acpi_idle, and thus entering the default C1 C-State set by
+acpi_processor_get_power_info_default(); this is undesirable for a system
+that's communicating to the OS it doesn't want C-States (missing _CST, and
+invalid C2/C3 in FADT).
+
+Make acpi_processor_get_power_info_fadt() return ENODEV in that case, so
+that acpi_processor_get_cstate_info() exits early and doesn't set
+pr->flags.power = 1.
+
+Fixes: 496121c02127 ("ACPI: processor: idle: Allow probing on platforms with one ACPI C-state")
+Signed-off-by: Giovanni Gherdovich <ggherdovich@suse.cz>
+---
+ drivers/acpi/processor_idle.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
+index 698897b29de2..2df1296ff44d 100644
+--- a/drivers/acpi/processor_idle.c
++++ b/drivers/acpi/processor_idle.c
+@@ -268,6 +268,10 @@ static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr)
+ 			 ACPI_CX_DESC_LEN, "ACPI P_LVL3 IOPORT 0x%x",
+ 			 pr->power.states[ACPI_STATE_C3].address);
+ 
++	if (!pr->power.states[ACPI_STATE_C2].address &&
++	    !pr->power.states[ACPI_STATE_C3].address)
++		return -ENODEV;
++
+ 	return 0;
+ }
+ 
+-- 
+2.43.0
+
diff --git a/series.conf b/series.conf
index 438082e..8e66477 100644
--- a/series.conf
+++ b/series.conf
@@ -59251,6 +59251,7 @@
 	patches.suse/x86-kexec-Fix-double-free-of-elf-header-buffer.patch
 	patches.suse/ALSA-hda-Disable-power-save-on-KONTRON-SinglePC.patch
 	patches.suse/initramfs-avoid-filename-buffer-overrun.patch
+	patches.suse/ACPI-processor-idle-return-an-error-if-both-P_LVL-2-.patch
 
 	########################################################
 	# kbuild/module infrastructure fixes