From patchwork Sun Oct 30 06:23:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Isaku Yamahata X-Patchwork-Id: 12920 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1667204wru; Sat, 29 Oct 2022 23:33:02 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7PhO8Rd60oBVHc/5weLscWWBcxN4nQe3nlT3FFgHeBn20puTiccHFZs7Mj6V6VMJLgkSjf X-Received: by 2002:a05:6a00:993:b0:56c:80f6:db5 with SMTP id u19-20020a056a00099300b0056c80f60db5mr7768560pfg.45.1667111582413; Sat, 29 Oct 2022 23:33:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667111582; cv=none; d=google.com; s=arc-20160816; b=w+cJtfjTSkMZFyf9sISlkK4UHLkHEinVAF3EYSLoFo65j8oChuZIypNg2xpRW/GQkF b0n8pHgteMJhs15lV4h4wEIU+L8la/e3dicq9yj6fNB0HfMbOhy4n3FkiaTnKw5bxqeF 5cuQgnw+kqVIOsRkTsbzoh5YWgwcbi9pgYWsYHnlSCuCPiKo1olTvnGvTKW0y5QRZI/P AKa16Z/bRH26brT+qkSbjatBe/UxDwZd73qbr18oxvTZ+gOBTRU6FtT2Q9cLxgCaewpD 6b30TmHJI0cIYYAjn689qJpvKJOjFzycMlYDSXzhZHcf8cHU5/8iTHKej5ly8ZDuwmPA /ujQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=zRz4lCZ6Ur2LLgUSZ7yWQJWF8yFQ816WyWiMUi+fbQA=; b=uP2JcK4AS0peai6iaaPyBwrStDNCMj5z3TSURBBx+7grAL9ET4FKUKmCd8TCJKd1JM HtN1q52CpZ3hGX1KmKPx07EmNHKee2rTJJg399KVGqMU64NfISMUtKX1auGUn6iIAXdU QrJyvdcC99UuO+QDyW+erqh8UhCZnrusoLS1SjxhEM0lgpJq4cJVcK1h60AAJKECFZfB 3sscBsEEe1c8umJs0WP1zEs1AzQSX7Pl9MuVUr1copfdjnldeGUVVonqJUsbSzKQJUKO oyLHoO2nlJiV7+ODw6ZqOABe31UEEw5uFrXhRWzUn9DthXmacuznLBChiVawrunf2pa9 L2sQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=SBmcALrA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q16-20020a170902dad000b0017f792fe3edsi4052023plx.266.2022.10.29.23.32.48; Sat, 29 Oct 2022 23:33:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=SBmcALrA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231489AbiJ3GcO (ORCPT + 99 others); Sun, 30 Oct 2022 02:32:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231327AbiJ3Ga2 (ORCPT ); Sun, 30 Oct 2022 02:30:28 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D40E6B12; Sat, 29 Oct 2022 23:24:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1667111093; x=1698647093; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=iJoF+MfYcxL6N0xQS4giY9evG0EJzc+d/OqtX3SJcNw=; b=SBmcALrA/RX/kvmiZMyPmKPsFx+7p2DxvsA5PoOKM4AhwiQCNTwTx36m NjQL8TxZ2q99QaTSdVsANtdz+Ok+AYA4Oq886E43LdKazU7IzKnMdTpX1 4ryDpHop2e8x8GeRSo0h47GP7J3ZnLSNCSk5MztC4bl/4khU9z3d8cW9c pgjld00gULQR/mWESoD9M8NwRQ+RF/bVyywo1Vwex173+3iU0nVmWTE3f 0+m4shDXgCa150SLWw150SgOVP/tY7q4/qleaE+kcWJgVHNciXXjTuMSy LgxJqcQ6EA4z7GLaJ52NZl9NTYvYVCanGJ8EslfWhoo2psl8iYeJDm07S A==; X-IronPort-AV: E=McAfee;i="6500,9779,10515"; a="395037206" X-IronPort-AV: E=Sophos;i="5.95,225,1661842800"; d="scan'208";a="395037206" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Oct 2022 23:24:12 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10515"; a="878393128" X-IronPort-AV: E=Sophos;i="5.95,225,1661842800"; d="scan'208";a="878393128" Received: from ls.sc.intel.com (HELO localhost) ([143.183.96.54]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Oct 2022 23:24:12 -0700 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 Subject: [PATCH v10 089/108] KVM: TDX: handle EXIT_REASON_OTHER_SMI Date: Sat, 29 Oct 2022 23:23:30 -0700 Message-Id: <32d3e497b2e088ef060191f39f3f0495e2c3561a.1667110240.git.isaku.yamahata@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748093194886307933?= X-GMAIL-MSGID: =?utf-8?q?1748093194886307933?= 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 088e98232227..68d9d590ca8f 100644 --- a/arch/x86/kvm/vmx/tdx.c +++ b/arch/x86/kvm/vmx/tdx.c @@ -1068,6 +1068,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; }