Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E2FD7C433F5 for ; Tue, 14 Dec 2021 15:05:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235593AbhLNPE6 (ORCPT ); Tue, 14 Dec 2021 10:04:58 -0500 Received: from mga18.intel.com ([134.134.136.126]:28585 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235262AbhLNPDe (ORCPT ); Tue, 14 Dec 2021 10:03:34 -0500 X-IronPort-AV: E=McAfee;i="6200,9189,10197"; a="225852774" X-IronPort-AV: E=Sophos;i="5.88,205,1635231600"; d="scan'208";a="225852774" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Dec 2021 07:03:25 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,205,1635231600"; d="scan'208";a="463822573" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga003.jf.intel.com with ESMTP; 14 Dec 2021 07:03:16 -0800 Received: by black.fi.intel.com (Postfix, from userid 1000) id 6EBCF10E1; Tue, 14 Dec 2021 17:03:10 +0200 (EET) From: "Kirill A. Shutemov" To: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@intel.com, luto@kernel.org, peterz@infradead.org Cc: sathyanarayanan.kuppuswamy@linux.intel.com, aarcange@redhat.com, ak@linux.intel.com, dan.j.williams@intel.com, david@redhat.com, hpa@zytor.com, jgross@suse.com, jmattson@google.com, joro@8bytes.org, jpoimboe@redhat.com, knsathya@kernel.org, pbonzini@redhat.com, sdeep@vmware.com, seanjc@google.com, tony.luck@intel.com, vkuznets@redhat.com, wanpengli@tencent.com, x86@kernel.org, linux-kernel@vger.kernel.org, "Kirill A. Shutemov" Subject: [PATCH 25/26] x86/tdx: Warn about unexpected WBINVD Date: Tue, 14 Dec 2021 18:03:03 +0300 Message-Id: <20211214150304.62613-26-kirill.shutemov@linux.intel.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211214150304.62613-1-kirill.shutemov@linux.intel.com> References: <20211214150304.62613-1-kirill.shutemov@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org WBINVD causes #VE in TDX guests. There's no reliable way to emulate it. The kernel can ask for VMM assistance, but VMM is untrusted and can ignore the request. Fortunately, there is no use case for WBINVD inside TDX guests. Warn about any unexpected WBINVD. Signed-off-by: Kirill A. Shutemov --- arch/x86/kernel/tdx.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/x86/kernel/tdx.c b/arch/x86/kernel/tdx.c index 2175336d1a2a..4da69bc760e1 100644 --- a/arch/x86/kernel/tdx.c +++ b/arch/x86/kernel/tdx.c @@ -521,6 +521,10 @@ static bool tdx_virt_exception_kernel(struct pt_regs *regs, struct ve_info *ve) case EXIT_REASON_IO_INSTRUCTION: ret = tdx_handle_io(regs, ve->exit_qual); break; + case EXIT_REASON_WBINVD: + WARN_ONCE(1, "Unexpected WBINVD\n"); + ret = true; + break; default: pr_warn("Unexpected #VE: %lld\n", ve->exit_reason); break; -- 2.32.0