Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3570138pxb; Mon, 24 Jan 2022 12:28:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJwntLU4v4aAYW1qGiJXYnWym8su0EADsr5gew2Daes3oO8rV+wwH5dyitRwWzqUL1FNoiPp X-Received: by 2002:a65:6e90:: with SMTP id bm16mr9661393pgb.165.1643056097999; Mon, 24 Jan 2022 12:28:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643056097; cv=none; d=google.com; s=arc-20160816; b=FOz9tVATPMaLDIblDDg5h1mldXQpNDIUigKnEE9jOd3PDHDbhbinNR0W0NagMGd/kQ L52MOPEXGkTRr+Zzqh0RuYfLG7DSnZ5cUgsJ/Zr3qmJ0tHdl7CtlvCJx/FHETHyBd6l4 8tfF6lvLwqN2mOZ/KlJIBjvs+bUYfIjgC9Vctpa14nVJWn08uStX9xpmiFiG3MxGTvyp 74rvNgM7DkypYoow7zVUCm6O+b6hmGmm1lsvnH4/nB4nBUv9cQuV4XjPJXmbPEH6G863 kfDAEmlP7GSNPQCdc8aIfBTHO8jOO/9vbIPEXki+9wUVLYJ34JHZ95B4WwL8JT1PKX0X DHuw== 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=jKfDbNsbUyVEDkY9okNdQVHfZtUHCmvmuQRSV7rh4Hs=; b=vVlqRpQbi87u07xt1YOejW/wvkY83vn4/RDjQqzM3tBRjoHOqW0xzZ05DyyWwTzrAI 9ThupRn3b6aN5LCdsMnDhTqvmTl9trn8i1nwx/iAag4drrbw60sClG4TltUezH9WfIR9 Gqw6vDeI7y82ZfUXQLGMOQ80aVh2+027l5Skk/IjFg8JJbp6F0cB76OU+1gEpMzhOfoE YuSc0Fzs+Qihgy6QNaamUyuadaVO45sa4mIbg1TT6m/CXP96lK86V8/zDNXAUYbZIad6 b6gZRv74jr65QyW33ASfZ8IFoauPGyMOxHzC+eWrO4ADxHlSh5313bVSk+CCRnY1oLTc DkZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rrQx0qg5; 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 r11si12398445pgm.30.2022.01.24.12.28.04; Mon, 24 Jan 2022 12:28:17 -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=rrQx0qg5; 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 S1352453AbiAXTaa (ORCPT + 99 others); Mon, 24 Jan 2022 14:30:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349827AbiAXTVY (ORCPT ); Mon, 24 Jan 2022 14:21:24 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7771BC02B853; Mon, 24 Jan 2022 11:08:29 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 18F966124F; Mon, 24 Jan 2022 19:08:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D244AC340E5; Mon, 24 Jan 2022 19:08:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643051308; bh=aqE45ZncD4ShHp9LawZTZ++ERYNd1W4VEqKGNcMwVXY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rrQx0qg5P3QhmQUlcX2HiUmdPQ87P226marZvuq1IaX6KOc65YKduU5G91aq1iD8I MTbaeXFefcgRBqxIUd1lBO9eeC4fQEHHrdqWfbhdfC28QxLoBzzfRPKg5LqtMk+GJV TiLvF+U3ZKDC/tF0HKgKKCTEp3QBzEOAaeluRdvA= 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.14 121/186] ACPICA: Hardware: Do not flush CPU cache when entering S4 and S5 Date: Mon, 24 Jan 2022 19:43:16 +0100 Message-Id: <20220124183941.004363663@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183937.101330125@linuxfoundation.org> References: <20220124183937.101330125@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 7f8c57177819f..45b392fa36657 100644 --- a/drivers/acpi/acpica/hwesleep.c +++ b/drivers/acpi/acpica/hwesleep.c @@ -138,7 +138,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 2c54d08b20ca6..9e50529bb3cc9 100644 --- a/drivers/acpi/acpica/hwsleep.c +++ b/drivers/acpi/acpica/hwsleep.c @@ -149,7 +149,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 827c3242225d9..b3c7736611908 100644 --- a/drivers/acpi/acpica/hwxfsleep.c +++ b/drivers/acpi/acpica/hwxfsleep.c @@ -223,8 +223,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