Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp495878pxj; Thu, 10 Jun 2021 06:02:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzMfm8K2FyjyAGlll8Pwqfe6c2wJcdUJTx0X+PwQ2Xu/8ksyuH5VQ4gfLwqzb/o2lO54jW8 X-Received: by 2002:a50:ee05:: with SMTP id g5mr4670720eds.73.1623330167417; Thu, 10 Jun 2021 06:02:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623330167; cv=none; d=google.com; s=arc-20160816; b=DnRgcnbiLlBoSbDmpTXp99m64ITjJerv4WyuiVEWE5BlxiqxnbeJz4bqzgmNNc9/Ax lDbxxp7/y0JqjHP7s6CQmuGiFfhNmIj1pcj58dcr6yX8Hyxx9Jlh3e09/p+RngFivuRi qTF9bX0iLM26aHWOyEaTngix4J4SQC2KK9UtZLZrf5NBtOqbwl8divOo5f+FYn6OTsEC 9S2SVrliMXIA8QaxPy9XEvD4y12oPVsb48tKGzb+l62psV1RA3GIdlgiHjnbvy4Jj2MH r5I7nATx3LhnNFeKcZnq9BozI+uN2MXXU3aQ97q3F/krMrdD2F+M9LA4KGM5yRhVSwZv 4y8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=j6llwn+tAyxhNtIDtiMmXbYyDut7cQGn+uwgoIvVkUY=; b=W61h1I1ng+VUu7XcUh4nO02SK6F0H7MimEqQG1V6vd+GUH0hIAw8oviG5uC6aiARQr 2TI7fBsN3SGDp2TIQFs2YkN2opO2TiF607mSvn0Mqs72orN7x2d8p7aryeB8UCvznnTF kaZ0BGKGMiF2jhz1dANmuNObrxkDsvCHvZtPz4VWWSCyQyU3c7zqrMhq6HI/NxRe8L/E pwrFpXX/YJBDhOwyrvrkQ1NKFjUncX3bYoLD+WyUf+bgC8ruJvurV06Gg901iy24El0u rZQjpy4eLpiR2BeqVR9+ewusvhCNCrebjOtim8EMC+BKjk2AsHmHocQUFsOnZxg3sAtQ 9BKg== ARC-Authentication-Results: i=1; mx.google.com; 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 h8si2291100edj.149.2021.06.10.06.02.22; Thu, 10 Jun 2021 06:02:47 -0700 (PDT) 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; 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 S230343AbhFJNCe (ORCPT + 99 others); Thu, 10 Jun 2021 09:02:34 -0400 Received: from mail-ot1-f48.google.com ([209.85.210.48]:40844 "EHLO mail-ot1-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230035AbhFJNCd (ORCPT ); Thu, 10 Jun 2021 09:02:33 -0400 Received: by mail-ot1-f48.google.com with SMTP id l15-20020a05683016cfb02903fca0eacd15so3508447otr.7; Thu, 10 Jun 2021 06:00:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=j6llwn+tAyxhNtIDtiMmXbYyDut7cQGn+uwgoIvVkUY=; b=t9UZmeZwFmga9aQSYY3SEF+8wc+cNwgvn7v/9d5TYGCP7GzD9KGZQPYG4nrm/yijun nYwWTHowFZZ5Pzp4ScqvOeSHFa0VExD8pTgVIf0Ub90SNcT4yWMlA5UZ09oFINT8WLPK lqriF2kIJsDFAHXvX3da2YMexR+ZOMTMGHQOk5uNdE4kdowTbDPku46oIdUM9OORsRNb Qxdq4JsTIuRu9Tj8RPsfmhkVZijAHN/pcOMOVRvIiV4pvrEwjgrnv0+AHKHDDcGEFC+4 TdWbiJB5sCoXVIUzPunjVHbPpsWdY3pc8SgCqQu5KaIB6OLYxoP99BjWC+oEfwXNRWtj 5JFA== X-Gm-Message-State: AOAM531gdpxNTek28HR7q/Kq2u8AHC1yfMEQDJexA2N7NBu/FS/POjJo 3WfJ7ba77dc6XhgI7yRLLn2YqNqAi25oWR4/oPimzaF1 X-Received: by 2002:a9d:3e53:: with SMTP id h19mr2359706otg.260.1623330021209; Thu, 10 Jun 2021 06:00:21 -0700 (PDT) MIME-Version: 1.0 References: <20210609215047.1955866-1-sathyanarayanan.kuppuswamy@linux.intel.com> <20210609215047.1955866-6-sathyanarayanan.kuppuswamy@linux.intel.com> In-Reply-To: <20210609215047.1955866-6-sathyanarayanan.kuppuswamy@linux.intel.com> From: "Rafael J. Wysocki" Date: Thu, 10 Jun 2021 15:00:10 +0200 Message-ID: Subject: Re: [PATCH v1 5/5] x86: Skip WBINVD instruction for VM guest To: Kuppuswamy Sathyanarayanan Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Peter Zijlstra , Andy Lutomirski , Peter H Anvin , Dave Hansen , Tony Luck , Dan Williams , Andi Kleen , Kirill Shutemov , Sean Christopherson , Kuppuswamy Sathyanarayanan , "the arch/x86 maintainers" , Linux Kernel Mailing List , "Rafael J . Wysocki" , ACPI Devel Maling List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 9, 2021 at 11:51 PM Kuppuswamy Sathyanarayanan wrote: > > VM guests that supports ACPI, use standard ACPI mechanisms to signal > sleep state entry (including reboot) to the host. The ACPI > specification mandates WBINVD on any sleep state entry with the > expectation that the platform is only responsible for maintaining the > state of memory over sleep states, not preserving dirty data in any > CPU caches. ACPI cache flushing requirements pre-date the advent of > virtualization. Given guest sleep state entry does not affect any > host power rails it is not required to flush caches. The host is > responsible for maintaining cache state over its own bare metal sleep > state transitions that power-off the cache. A TDX guest, unlike a > typical guest, will machine check if the CPU cache is powered off. > > Cc: Rafael J. Wysocki > Cc: linux-acpi@vger.kernel.org > Reviewed-by: Dan Williams > Signed-off-by: Kuppuswamy Sathyanarayanan Acked-by: Rafael J. Wysocki > --- > arch/x86/include/asm/acenv.h | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/arch/x86/include/asm/acenv.h b/arch/x86/include/asm/acenv.h > index 9aff97f0de7f..d4162e94bee8 100644 > --- a/arch/x86/include/asm/acenv.h > +++ b/arch/x86/include/asm/acenv.h > @@ -10,10 +10,15 @@ > #define _ASM_X86_ACENV_H > > #include > +#include > > /* Asm macros */ > > -#define ACPI_FLUSH_CPU_CACHE() wbinvd() > +#define ACPI_FLUSH_CPU_CACHE() \ > +do { \ > + if (!boot_cpu_has(X86_FEATURE_HYPERVISOR)) \ > + wbinvd(); \ > +} while (0) > > int __acpi_acquire_global_lock(unsigned int *lock); > int __acpi_release_global_lock(unsigned int *lock); > -- > 2.25.1 >