Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3391643pxb; Mon, 17 Jan 2022 19:27:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJwiJe1hx2h+/VqxAsuzpexoffZXKu+BbbpEXeVR+qrWt5G/l1nvzo1hI61Ik3dO2jWXLtY4 X-Received: by 2002:a17:90a:b798:: with SMTP id m24mr37370067pjr.143.1642476428814; Mon, 17 Jan 2022 19:27:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642476428; cv=none; d=google.com; s=arc-20160816; b=tfu+87+CgK99l4SGPnABtx3x4ctRPm35+GpJfxtNFfyuL9Oo0IO2OVbw00bF/lkEAC unSDNqETCQopsRvDGVvyW+1JiqYPS+t/mmiwcwKBFy3rev+fLlaRGkwmOWCnhxpdeCg6 dJPzC7ljg7JmGhLL/HK0ErXe7F/F+F0tYKYcWjhEmbx7FTSIqvVRczjjMb4gJmJvh2eZ prQIpv/GIiW/z8XHsqPlJkO6BV7oCCiVMmZ3wrQ6xfLnn1CSG8HlsSVfmc55BymvxugV 4R1IZ+ygObemRh+bHiXtDk/XPCgb4ObfnyzhS9vN0CjqOWqXwqX7K11BmXjgTCmmtfOz sKmQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=czQEKu4sADCvFVs7ugv2ar/615HNauZFlWucUdwtXcA=; b=nQDINQJUkigOtUC0QXGTi4oBA3VWXs/PgFMMQoC0J4my5qJ55aKiZRhUBDetNd3KrU 5Psdm+zMcs4LaPKpzF+83463YFpAkiMcRcmlYhYsNc06t0g6/xBrxIoF6NsrhEGQFTXf SZeTmmQLbOjEWbH5NAXUKe1W9n/g+4pDgyUtGJ6SUYatKDZ3lBco4UugPhDv4QzhMgo+ HYX4V0DQCLN9ekfo4iuWiUMnxnOHZYDRVJODXePSn4rlAtUgxie3vxQqHyunxOpO4n6l /IrgLnq2cnFov6uS4bFO+STKQJlcCLVQ4upEYaaYAiqhDHvYenYN00bcjgSIMKck2b89 9W8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=aKvvTBOU; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f22si15682586pgk.245.2022.01.17.19.26.46; Mon, 17 Jan 2022 19:27:08 -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=@kernel.org header.s=k20201202 header.b=aKvvTBOU; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344013AbiARChF (ORCPT + 99 others); Mon, 17 Jan 2022 21:37:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345519AbiARCbh (ORCPT ); Mon, 17 Jan 2022 21:31:37 -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 3B54CC035455; Mon, 17 Jan 2022 18:29:30 -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 F085DB81244; Tue, 18 Jan 2022 02:29:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D1B7FC36AE3; Tue, 18 Jan 2022 02:29:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1642472967; bh=8XswGL3EkarOX4C4hCvhOy/b4kDH7Y+uJGPB3muNXRI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aKvvTBOUk4FDGbMPCBflmg8OeQqxs5cZ24nSAbPXj/cXo6w53DeDJdWUuz/9hy47B bJTL3BArKRL9vZ8kXJKfQ0peBv72t0oKSivNEXklYpc0o8gmIRu9ekrxqnxT+StJll 9C8pnrtzUoVcXfaTMn/d97oQvuwK5uRCNdc8a43jM/TYPMw2BZZ6wVr/O3sbKn2Wfh 5OKi4JCoCMsTMzwMA4TVXd/aPQnok+3k/TswBZp5OcoVXzbNBgG+FtTrVho/ipgrdk Qa4I+pRCPc+vp8+nImndOOKpEL4SOBlhuuTKkr9Rz/mOsG/O0bYBNpquIuBxQl0i6+ L9BscuxjeE+oA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: "Kirill A. Shutemov" , "Rafael J . Wysocki" , Bob Moore , Sasha Levin , linux-acpi@vger.kernel.org, devel@acpica.org Subject: [PATCH AUTOSEL 5.16 183/217] ACPICA: Hardware: Do not flush CPU cache when entering S4 and S5 Date: Mon, 17 Jan 2022 21:19:06 -0500 Message-Id: <20220118021940.1942199-183-sashal@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220118021940.1942199-1-sashal@kernel.org> References: <20220118021940.1942199-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore 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 808fdf54aeebf..7ee2939c08cd4 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 34a3825f25d37..5efa3d8e483e0 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 e4cde23a29061..ba77598ee43e8 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.34.1