]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
ACPICA: Hardware: Do not flush CPU cache when entering S4 and S5
authorKirill A. Shutemov <kirill.shutemov@linux.intel.com>
Wed, 22 Dec 2021 16:33:51 +0000 (17:33 +0100)
committerPaolo Pisati <paolo.pisati@canonical.com>
Fri, 28 Jan 2022 10:02:51 +0000 (11:02 +0100)
BugLink: https://bugs.launchpad.net/bugs/1959376
[ Upstream commit 1d4e0b3abb168b2ee1eca99c527cffa1b80b6161 ]

ACPICA commit 3dd7e1f3996456ef81bfe14cba29860e8d42949e

According to ACPI 6.4, Section 16.2, the CPU cache flushing is
required on entering to S1, S2, and S3, but the ACPICA code
flushes the CPU cache regardless of the sleep state.

Blind cache flush on entering S5 causes problems for TDX.

Flushing happens with WBINVD that is not supported in the TDX
environment.

TDX only supports S5 and adjusting ACPICA code to conform to the
spec more strictly fixes the issue.

Link: https://github.com/acpica/acpica/commit/3dd7e1f3
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
[ rjw: Subject and changelog edits ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Bob Moore <robert.moore@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
drivers/acpi/acpica/hwesleep.c
drivers/acpi/acpica/hwsleep.c
drivers/acpi/acpica/hwxfsleep.c

index 808fdf54aeebf2f30c351905977cc463ea2fece0..7ee2939c08cd4d6a06cbd7161253c12750ea65b1 100644 (file)
@@ -104,7 +104,9 @@ acpi_status acpi_hw_extended_sleep(u8 sleep_state)
 
        /* Flush caches, as per ACPI specification */
 
-       ACPI_FLUSH_CPU_CACHE();
+       if (sleep_state < ACPI_STATE_S4) {
+               ACPI_FLUSH_CPU_CACHE();
+       }
 
        status = acpi_os_enter_sleep(sleep_state, sleep_control, 0);
        if (status == AE_CTRL_TERMINATE) {
index 34a3825f25d37f6d8e0fda01207d0ad8b34e2c7d..5efa3d8e483e01c9236de20e19aad13b2a4ad0d1 100644 (file)
@@ -110,7 +110,9 @@ acpi_status acpi_hw_legacy_sleep(u8 sleep_state)
 
        /* Flush caches, as per ACPI specification */
 
-       ACPI_FLUSH_CPU_CACHE();
+       if (sleep_state < ACPI_STATE_S4) {
+               ACPI_FLUSH_CPU_CACHE();
+       }
 
        status = acpi_os_enter_sleep(sleep_state, pm1a_control, pm1b_control);
        if (status == AE_CTRL_TERMINATE) {
index e4cde23a2906187f488f6af55732fee12c2908fd..ba77598ee43e8af16bf3e32c0e34f1beed1b14b9 100644 (file)
@@ -162,8 +162,6 @@ acpi_status acpi_enter_sleep_state_s4bios(void)
                return_ACPI_STATUS(status);
        }
 
-       ACPI_FLUSH_CPU_CACHE();
-
        status = acpi_hw_write_port(acpi_gbl_FADT.smi_command,
                                    (u32)acpi_gbl_FADT.s4_bios_request, 8);
        if (ACPI_FAILURE(status)) {