From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3196CC47082 for ; Wed, 9 Jun 2021 00:14:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 162416128E for ; Wed, 9 Jun 2021 00:14:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232399AbhFIAQb (ORCPT ); Tue, 8 Jun 2021 20:16:31 -0400 Received: from mga06.intel.com ([134.134.136.31]:4175 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231186AbhFIAQ3 (ORCPT ); Tue, 8 Jun 2021 20:16:29 -0400 IronPort-SDR: MvBEZm//Z8J3D+pjoZykagE0btMljcoZO9zTaYzy7trcT4fpbzLjWiSzKfb1rRtk1dsck3+jqp PyFdKpRzAaNA== X-IronPort-AV: E=McAfee;i="6200,9189,10009"; a="266124572" X-IronPort-AV: E=Sophos;i="5.83,259,1616482800"; d="scan'208";a="266124572" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jun 2021 17:14:30 -0700 IronPort-SDR: 2xWcijKOdpvoNS8cRIbYCXIYenvA7GZHR02vLpXTl6lr7suL2urtNT6I0RqbTCnhMNGeAJNkbk xiEYJY3dlkBQ== X-IronPort-AV: E=Sophos;i="5.83,259,1616482800"; d="scan'208";a="402254387" Received: from dabarred-mobl1.amr.corp.intel.com (HELO skuppusw-mobl5.amr.corp.intel.com) ([10.254.185.80]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Jun 2021 17:14:29 -0700 Subject: Re: [RFC v2-fix-v3 1/1] x86/tdx: Skip WBINVD instruction for TDX guest To: Dan Williams , Dave Hansen Cc: Peter Zijlstra , Andy Lutomirski , Tony Luck , Andi Kleen , Kirill Shutemov , Kuppuswamy Sathyanarayanan , Raj Ashok , Sean Christopherson , Linux Kernel Mailing List , "Rafael J. Wysocki" , Linux ACPI References: <20210608213527.739474-1-sathyanarayanan.kuppuswamy@linux.intel.com> <9d88cb37-f594-534a-ae2a-5a51f97db2a8@intel.com> From: "Kuppuswamy, Sathyanarayanan" Message-ID: Date: Tue, 8 Jun 2021 17:14:27 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/8/21 5:07 PM, Dan Williams wrote: > That works too, but I assume if ACPI_FLUSH_CPU_CACHE() itself is going > to be changed rather than sprinkling protected_guest_has() checks in a > few places it will need to assert why changing all of those at once is > correct. Otherwise I expect Rafael to ask why this global change of > the ACPI_FLUSH_CPU_CACHE() policy is ok. Yes. I am fixing it as below. --- 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 (!prot_guest_has(PR_GUEST_DISABLE_WBINVD)) \ + wbinvd(); \ +} while (0) -- Sathyanarayanan Kuppuswamy Linux Kernel Developer