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 F2A29C64ED8 for ; Mon, 27 Feb 2023 08:29:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230505AbjB0I3r (ORCPT ); Mon, 27 Feb 2023 03:29:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231503AbjB0I3H (ORCPT ); Mon, 27 Feb 2023 03:29:07 -0500 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5DBDA2007F; Mon, 27 Feb 2023 00:25:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1677486349; x=1709022349; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=jtQyQ4YIe85j6uadyLZpZT+m3TocaRzDlQSxEgXebOY=; b=f/n4XUjs4djxOAXbga/10zXFznl1ElcO14p3cmxgD1wIOPE7Nh1gtG4o vDO7wU9eyU612IJYqFAn9pnL1SBpN1+QcsS9vPgNMA3Uqud7CObdDiuMm WRv3hPLMvykp2xZzKd7lAm1cBU0cCUH/n+DvKtTjI/s1U7JQZHvfDZDJ/ 5bT6fjTec9s040Dh7cd8ZbNKeFnudGX25SZOHb/C1Wlx1zUMYammFDgtH 3VPdrAo942KQBxgcVG5+s5iHv2KD9TGlAIKUZqOAedurn+8pB5oMdBjsP JqmbAa5Q2jv3EOCAhCoKO5eSRuKOwouxrQNW1yrrXShCvQMo4wE5UelfU Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10633"; a="317609013" X-IronPort-AV: E=Sophos;i="5.97,331,1669104000"; d="scan'208";a="317609013" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Feb 2023 00:24:17 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10633"; a="783242361" X-IronPort-AV: E=Sophos;i="5.97,331,1669104000"; d="scan'208";a="783242361" Received: from ls.sc.intel.com (HELO localhost) ([143.183.96.54]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Feb 2023 00:24:17 -0800 From: isaku.yamahata@intel.com To: kvm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: isaku.yamahata@intel.com, isaku.yamahata@gmail.com, Paolo Bonzini , erdemaktas@google.com, Sean Christopherson , Sagi Shahar , David Matlack , Kai Huang , Zhi Wang Subject: [PATCH v12 078/106] KVM: TDX: handle EXIT_REASON_OTHER_SMI Date: Mon, 27 Feb 2023 00:23:17 -0800 Message-Id: <1f4b4525d501aa503950d36d3a75c907fb0531cb.1677484918.git.isaku.yamahata@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Isaku Yamahata If the control reaches EXIT_REASON_OTHER_SMI, #SMI is delivered and handled right after returning from the TDX module to KVM nothing needs to be done in KVM. Continue TDX vcpu execution. Signed-off-by: Isaku Yamahata Reviewed-by: Paolo Bonzini --- arch/x86/include/uapi/asm/vmx.h | 1 + arch/x86/kvm/vmx/tdx.c | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/arch/x86/include/uapi/asm/vmx.h b/arch/x86/include/uapi/asm/vmx.h index a5faf6d88f1b..b3a30ef3efdd 100644 --- a/arch/x86/include/uapi/asm/vmx.h +++ b/arch/x86/include/uapi/asm/vmx.h @@ -34,6 +34,7 @@ #define EXIT_REASON_TRIPLE_FAULT 2 #define EXIT_REASON_INIT_SIGNAL 3 #define EXIT_REASON_SIPI_SIGNAL 4 +#define EXIT_REASON_OTHER_SMI 6 #define EXIT_REASON_INTERRUPT_WINDOW 7 #define EXIT_REASON_NMI_WINDOW 8 diff --git a/arch/x86/kvm/vmx/tdx.c b/arch/x86/kvm/vmx/tdx.c index 36c5a0b6e452..f2cafa107042 100644 --- a/arch/x86/kvm/vmx/tdx.c +++ b/arch/x86/kvm/vmx/tdx.c @@ -1163,6 +1163,13 @@ int tdx_handle_exit(struct kvm_vcpu *vcpu, fastpath_t fastpath) WARN_ON_ONCE(fastpath != EXIT_FASTPATH_NONE); switch (exit_reason.basic) { + case EXIT_REASON_OTHER_SMI: + /* + * If reach here, it's not a Machine Check System Management + * Interrupt(MSMI). #SMI is delivered and handled right after + * SEAMRET, nothing needs to be done in KVM. + */ + return 1; default: break; } -- 2.25.1