Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3677750pxb; Mon, 24 Jan 2022 15:07:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJz6ytMm5VVmK5wob4lBwIpZzjCXjDKBruRta00EHjMoNVpgvDU5gqZnm+3wRuPr7bvtO14K X-Received: by 2002:a17:90b:38c1:: with SMTP id nn1mr591863pjb.56.1643065660859; Mon, 24 Jan 2022 15:07:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643065660; cv=none; d=google.com; s=arc-20160816; b=ywOM5A2MAlxJOQzrN51aUxLP1TUnZsfBltW6mD9M4sK8Nd1D1YkMNiU6+KMko214is EW7WQsDMDF/n1FyDfZ4tqOpES3CGhaDfgSBKwe4FoAAruzlNd1jo+mNfmQEOiaMtlQDc 0Sq3ndp56b4n+HajmWuuNBh4K4mqdUUyUPtkmYTY6niDU5jg9sVWmACAx6AHJrs4mgry 8XyRLQTbRBwV1jCfw5K3RiEaPg7AxcKMDNNa1UcDF5FzH1powgaMzZ1dYzpcs/i9ycTN J+cdQBrnu3kZk/OiB9MaYxshc1rzL7zlWdWHpicoa7dw91JruUl+6YBRA3fe4RNzNirK zK3A== 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=vgJGS5pYPYLXjXvyt2zPLbZhGrcDd9285YBtvvz/I98=; b=P32g5BjVA5wn9jnZlPNe3HeDeh8V3LrzBbree1VKF3k6qGAobR/s/gQ/I7NC6PYiqn zfVCqj0wWAZxWTMsbzrFNYGqdN3TX8VTVwEw1j7SwF6jUKqjeiHAFTXoYRDS2cIJ5Iv4 9zuOgkFM4K6i7+5iSmUVqXg1Z51Gh4Um9/FgElcy7Pf62G5QBm8GSOFagyvRZ/2z2fS8 S7UX5l9pZkneUy3UWnISL8jVKMqL/GQixrk085hsWfNTcOybiJOBhbNlnFdVaY+23rUt LSG+O5OZnwHvq47eHiQpwEaVzp9fMQZdsFDbmiDddltqNKJthYLSkG4dpaOs/3qD3yFQ xLYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=bW55PtcH; 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 d16si2441891plh.465.2022.01.24.15.07.28; Mon, 24 Jan 2022 15:07:40 -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=bW55PtcH; 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 S1842929AbiAXXCz (ORCPT + 99 others); Mon, 24 Jan 2022 18:02:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1575682AbiAXV7I (ORCPT ); Mon, 24 Jan 2022 16:59:08 -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 14C2BC02B8CE; Mon, 24 Jan 2022 12:39:26 -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 4420D61536; Mon, 24 Jan 2022 20:39:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 23E72C340E7; Mon, 24 Jan 2022 20:39:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643056763; bh=6YAm3CPq34GvsX3b4vYCVruJOM6/PYsnnpJpjUe6TT0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bW55PtcHBOCXXGdV2vmMT6kcWjIWWxezfaPBU+HCO17HAUfmZN+le4Y2X7EoT7SPl Zk9pUxBvM514xIDCwzXT87WYVz0KmuNzFf0EpW40jp4awLZyjzo2hjUK1fd81eQ+KS 4C/Vl3oDLVP9Jmxs2o+47NLPEGDd6mHHkJ0jfb3g= 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 5.15 593/846] ACPICA: Hardware: Do not flush CPU cache when entering S4 and S5 Date: Mon, 24 Jan 2022 19:41:50 +0100 Message-Id: <20220124184121.495001279@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184100.867127425@linuxfoundation.org> References: <20220124184100.867127425@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 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