Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3579228pxb; Mon, 24 Jan 2022 12:41:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJz3aNu9mqd9s2hivWp8zt0kATxh0O+s9PjrmJZlov0p1NOzYqq805TF94VaZqeAL7IL+vdB X-Received: by 2002:a17:90a:9c5:: with SMTP id 63mr82475pjo.144.1643056902699; Mon, 24 Jan 2022 12:41:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643056902; cv=none; d=google.com; s=arc-20160816; b=BiCPpywnX+umniLvkc1Uy3w/hqRy4Dry03+7vqMK2O0EcmyFjj8FmFRSmnSWOt/Q60 jULqliSEJp7lO0D3C862iycR/6lEpEWl3RgsiYcdrCl1NuE5gMxWnWu5CxW3F8+e3i5R loBAQ4VLdNZKgqXFAOOCT3M9OloBnS1AkdjyrZpd5vfEsfCJEmRO5IKqFB5CHwPkxkME 7GooHCri3MyE3FiFmR/zB3vHHE4FFOsU67cbS4blkw+SMupZplFr9pkGkzHGdpqwqUPy HOmBzwRQRfpVRUEeJX1KkiLSBzG0ipEsBBdeBf0N3c7RlyDTBF5wNuxOqxjdd0EuApHW fk3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=bPuLZcbCf9x+KWVKgvbXZVi/SjTWZaK8J63tZlmjCtg=; b=szn8pQsXIQN/HaIuUxZbifncYdSP+MsWBrhsBr925C8KxLegHCBG9bbPAuuyWsYg1o cf3F7RfEW3HqUQceTXlnZICuDb8ZrJF+igmRw9dx269Bi5/uqQXEljZMoiv6xBPwgWPO 53RPvJgnDjVRzUwknmOZovxZaEYjs56LGF0wErBEJrZL/i/MyTnV8G2vjPSpDBYh1wxv A3v6zb58H0tQ9Jb8Ovva4AlpzYgSbR7tlFY7mDiQgkcg490m/UgJ+CMP+oCwmQHD/wyo wLxHAew51HUrczIWIU8oSnKxp1IrlfGCkh5Iy1qch3VgqfuxeMqpHuSdDqyEKlQtdqf+ xXMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Wj1sMAt6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r8si316468pjo.85.2022.01.24.12.41.22; Mon, 24 Jan 2022 12:41:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Wj1sMAt6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235386AbiAXTvt (ORCPT + 99 others); Mon, 24 Jan 2022 14:51:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349134AbiAXTlB (ORCPT ); Mon, 24 Jan 2022 14:41:01 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62986C07A970; Mon, 24 Jan 2022 11:20:28 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1DAA6B810BD; Mon, 24 Jan 2022 19:20:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 43535C340E5; Mon, 24 Jan 2022 19:20:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052025; bh=6NDXrddUvSfe0I2HKh1EdO5J80jG1dYvDOHuf3zhnZE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wj1sMAt6hFpEqE5RRsxheTeF0Ws0EIZFFLZ/y0RBwqiLlchidPc3J3oej4uPvbijq C7S+T0Hyf1tpEOimSyyGFtm/ym+uJAcS8ql3bq76UdiJQqlCn7PsRjkhO5IMHfsAkA GWFOHgjTAEeBeinNMB8c1QJCGy4Lk3zsKX9K1MGw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Kirill A. Shutemov" , "Rafael J. Wysocki" , Bob Moore , Sasha Levin Subject: [PATCH 4.19 163/239] ACPICA: Hardware: Do not flush CPU cache when entering S4 and S5 Date: Mon, 24 Jan 2022 19:43:21 +0100 Message-Id: <20220124183948.281676149@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183943.102762895@linuxfoundation.org> References: <20220124183943.102762895@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kirill A. Shutemov [ 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 [ rjw: Subject and changelog edits ] Signed-off-by: Rafael J. Wysocki Signed-off-by: Bob Moore Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin --- 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 9516966124ae3..9380a5e214da4 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 f4282370947c8..6368ff544af1a 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 dc1e44ccaae20..d0dca7dae080c 100644 --- a/drivers/acpi/acpica/hwxfsleep.c +++ b/drivers/acpi/acpica/hwxfsleep.c @@ -189,8 +189,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); -- 2.34.1