Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp5137567pxj; Wed, 9 Jun 2021 09:59:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzv8lUbTtSzSmnXkl28ZV2rmjb5GEv2JDL29v9Er1ESuuS6IS+xaXIioemI1Gtq8ltk+MpF X-Received: by 2002:a17:906:318b:: with SMTP id 11mr764016ejy.395.1623257990806; Wed, 09 Jun 2021 09:59:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623257990; cv=none; d=google.com; s=arc-20160816; b=IIPQLmzIDPzAGDtmxuPRGOxwSZ7iOEmoFZz/8F658iCJyTw+MX5A7QGY0T6cHzqtO+ LUwYEiln34ecvZTeSCk6LSXhxmHGTWROMtaYzsFwMhm3S/S+W5oR6lvpUz9TLw2pSNUS w9Gvdq/c3UgiqqvG4qWgtv4+ON7wYtf1uW7a4A0/4rOlaNRZlOZ5UAB8iBr8tXKtIYDv pkH9RkmDCCLrRkSoHpQ5kgCLRFwXCKj90rS8oNs85YXUTsPO/7uc/rcmZot7GU13qT1E i0i/A8ZVm593xz3L6WwY56xvsrpUqKCr143hJRUKSum2d3FKqnqVEj/GbZrnBduqTqq7 qW4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:ironport-sdr:ironport-sdr; bh=KwbdR/Sg4KOtDoAnDbWxeEH6kB+oDGJFqXoACzBLiF8=; b=uRF6NYbBmrKmmfdmNAoIyRl2DDJt1raubHh0fs89ReK8YleTzy/IUtCBFlV9N1q4Qu ijv9t9yDfFMsxIJkqrWE11hAHm59ir3+WZZOyv8nDR+LMjKqq3AIC9JHDidWAsooBNhW T2G6PR2ufPwCrQaZRzLx5tnYo467GKP5ZAWLN2sTt22i61386AvF7H84lllK/qBKUTi7 zG7jxU3OQHbOwzCmFD1IBGCIsdNxwVlFVdwi8fpmbTgpZ887BbECnH2/8oINbf9PVeEB pGi2nqSf1AfYbrMhPfojmDtrGYq2kYaKXlwlN/guTuAuqYPHLouATL0HVRulU7pBewao MooA== 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p23si229842edw.135.2021.06.09.09.59.27; Wed, 09 Jun 2021 09:59:50 -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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232244AbhFIAQa (ORCPT + 99 others); Tue, 8 Jun 2021 20:16:30 -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