Linux-ACPI Archive mirror
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Linux ACPI <linux-acpi@vger.kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>, Bob Moore <robert.moore@intel.com>
Subject: [PATCH 12/19] ACPICA: Hardware: Do not flush CPU cache when entering S4 and S5
Date: Wed, 22 Dec 2021 17:33:51 +0100	[thread overview]
Message-ID: <1808712.CQOukoFCf9@kreacher> (raw)
In-Reply-To: <11889746.O9o76ZdvQC@kreacher>

From: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>

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>
---
 drivers/acpi/acpica/hwesleep.c  | 4 +++-
 drivers/acpi/acpica/hwsleep.c   | 4 +++-
 drivers/acpi/acpica/hwxfsleep.c | 2 --
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/acpi/acpica/hwesleep.c b/drivers/acpi/acpica/hwesleep.c
index 808fdf54aeeb..7ee2939c08cd 100644
--- a/drivers/acpi/acpica/hwesleep.c
+++ b/drivers/acpi/acpica/hwesleep.c
@@ -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) {
diff --git a/drivers/acpi/acpica/hwsleep.c b/drivers/acpi/acpica/hwsleep.c
index 34a3825f25d3..5efa3d8e483e 100644
--- a/drivers/acpi/acpica/hwsleep.c
+++ b/drivers/acpi/acpica/hwsleep.c
@@ -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) {
diff --git a/drivers/acpi/acpica/hwxfsleep.c b/drivers/acpi/acpica/hwxfsleep.c
index e4cde23a2906..ba77598ee43e 100644
--- a/drivers/acpi/acpica/hwxfsleep.c
+++ b/drivers/acpi/acpica/hwxfsleep.c
@@ -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)) {
-- 
2.26.2





  parent reply	other threads:[~2021-12-22 16:43 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-22 15:56 [PATCH 00/19] ACPICA: ACPICA 20211217 Rafael J. Wysocki
2021-12-22 15:57 ` [PATCH 01/19] ACPICA: actypes.h: Expand the ACPI_ACCESS_ definitions Rafael J. Wysocki
2021-12-22 16:21 ` [PATCH 02/19] ACPICA: Use original data_table_region pointer for accesses Rafael J. Wysocki
2021-12-22 16:22 ` [PATCH 03/19] ACPICA: Use original pointer for virtual origin tables Rafael J. Wysocki
2021-12-22 16:23 ` [PATCH 04/19] ACPICA: Macros: Remove ACPI_PHYSADDR_TO_PTR Rafael J. Wysocki
2021-12-22 16:24 ` [PATCH 05/19] ACPICA: Avoid subobject buffer overflow when validating RSDP signature Rafael J. Wysocki
2021-12-22 16:25 ` [PATCH 06/19] ACPICA: iASL/Disassembler: Additional support for NHLT table Rafael J. Wysocki
2021-12-22 16:28 ` [PATCH 07/19] ACPICA: Fix AEST Processor generic resource substructure data field byte length Rafael J. Wysocki
2021-12-22 16:29 ` [PATCH 08/19] ACPICA: Utilities: Avoid deleting the same object twice in a row Rafael J. Wysocki
2021-12-22 16:31 ` [PATCH 09/19] ACPICA: Executer: Fix the REFCLASS_REFOF case in acpi_ex_opcode_1A_0T_1R() Rafael J. Wysocki
2021-12-22 16:31 ` [PATCH 10/19] ACPICA: Fix wrong interpretation of PCC address Rafael J. Wysocki
2021-12-22 16:32 ` [PATCH 11/19] ACPICA: Add support for PCC Opregion special context data Rafael J. Wysocki
2021-12-22 16:33 ` Rafael J. Wysocki [this message]
2021-12-22 16:35 ` [PATCH 14/19] ACPICA: Change a return_ACPI_STATUS (AE_BAD_PARAMETER) Rafael J. Wysocki
2021-12-22 16:35 ` [PATCH 15/19] ACPICA: Fixed a couple of warnings under MSVC Rafael J. Wysocki
2021-12-22 16:36 ` [PATCH 16/19] ACPICA: iASL: Add TDEL table to both compiler/disassembler Rafael J. Wysocki
2021-12-22 16:37 ` [PATCH 17/19] ACPICA: iASL: Add suppport for AGDI table Rafael J. Wysocki
2021-12-22 16:37 ` [PATCH 18/19] ACPICA: iASL/NHLT table: "Specific Data" field support Rafael J. Wysocki
2021-12-22 16:38 ` [PATCH 19/19] ACPICA: Update version to 20211217 Rafael J. Wysocki

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=1808712.CQOukoFCf9@kreacher \
    --to=rjw@rjwysocki.net \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robert.moore@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).