Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3654079pxb; Mon, 24 Jan 2022 14:32:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJxd/rQ+Ssb6eWo9F7LBAfV3KKJtctsZj4KEl7iMt0ArTQKcpti3V6X1AR0yje0YAF1sqE3n X-Received: by 2002:a17:90b:1806:: with SMTP id lw6mr454436pjb.82.1643063523945; Mon, 24 Jan 2022 14:32:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643063523; cv=none; d=google.com; s=arc-20160816; b=BihO/eVKaI67oYgUG5SsabsVF0ofK3nH/sNdVQ+F9gw57bHSulCyD9R+JTpEHsj/bl IX9k2wEoHDdRBcSYhF3lBNVY7YBl2aC2gPoMpceIL+0C4m3Z0BueI1AhrsVwW8KCBFDV SXnl9r9xhydm4XLP7/35scnm+zkkalvjSDayzuU3tKGWa/j9JtwO2NHw/mvBSeAPyjfs 5WE3akYoSwC/ZWREKHNwqllzz3qfZlpV/8RD40nIfiCa/Gc93amMP2dE6GLDAqWU3btx I+ihtqctgLrEVDruM33559YyOMV3chBdJl6vmQJ4dTOWeTGygVCw8nW0EXzQ9G3VhZ80 5IKA== 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=zEyOwViaxLHRV5GWBZ0uI/robgVwPPgopu3onUnYkIyFGvireWD/qZmg/4/0cVo5r+ hoJQi1mroGVfD7CkSABWVO/CmSy2KZE4o54UdpNxmIVQ6V1RI3TMgDYn6ErKyXpFYF3y c+okNv7CRwBRHJD4H7uOA1FOCQ98l3iUi0HHZC/HuH4q/Jmz1qf8Uc9OhMfXH9/34Gsg igRp7GIITSl1gDZ8XWxTey+sz8fIFXG4t9BqlhQyfdvH6gJ/dtdLluHiaMY5H5wP+gHf QPCRmwfduAGBqlBLzrpMAaD0N3OddH9zUoiMmrEfBguhae4nwcPZ1t7Mp4CzeEyqOvXE vGig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nCq6X5Wn; 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 lk9si549425pjb.187.2022.01.24.14.31.51; Mon, 24 Jan 2022 14:32:03 -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=nCq6X5Wn; 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 S1586290AbiAXW0L (ORCPT + 99 others); Mon, 24 Jan 2022 17:26:11 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:48094 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1449160AbiAXV2I (ORCPT ); Mon, 24 Jan 2022 16:28:08 -0500 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 C7E096131F; Mon, 24 Jan 2022 21:28:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9A4D2C340E7; Mon, 24 Jan 2022 21:28:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059686; bh=6YAm3CPq34GvsX3b4vYCVruJOM6/PYsnnpJpjUe6TT0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nCq6X5Wn5cr7GXQVCBQllI5oVo8Y64dfGPvDN55mZKlGSBlJps32bjE9pxeZJuPsc jnDmpTVP3efLZmGEm7TEktKplF1Sfo0YvNamqfykg4SvuBHpBvMxHB/csHsEzhtGtW 3B0M8nQt5iMcBgXHuLRN2Nvy0MeuL7CdlLNrTYHQ= 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.16 0700/1039] ACPICA: Hardware: Do not flush CPU cache when entering S4 and S5 Date: Mon, 24 Jan 2022 19:41:29 +0100 Message-Id: <20220124184148.869834985@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@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