From patchwork Mon Feb 26 08:26:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Isaku Yamahata X-Patchwork-Id: 206434 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp1948754dyb; Mon, 26 Feb 2024 01:02:21 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXeFkz7qryzvgGm+rj2r6bGKWyjqPh1geD6CbQMygGmHkBJ9CH62Pch3AmjBRwceucUWg8ySSoUqCzUhBTuvvXm/kUINQ== X-Google-Smtp-Source: AGHT+IGUk2dZ9xI0h76LormhRVeI2KCrsaokIKkwHpHYu7alB+w7TT5wh3R9TkPo4vNSazg/+v7X X-Received: by 2002:a17:906:528d:b0:a3e:e9e1:1c08 with SMTP id c13-20020a170906528d00b00a3ee9e11c08mr4067822ejm.66.1708938141697; Mon, 26 Feb 2024 01:02:21 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708938141; cv=pass; d=google.com; s=arc-20160816; b=0dS3Y1Evoh0tN2n+vl5gC3qXkBLl8DsL6cEFtqBPw843Up3+zW8wizGjrO4NlsrZLw XWXdShdlAcSIZ8WX8pm+OjH6oR1DqIwWOvy4NtXUWvWLv8oRFZhLF7/vVgyNbgmMkY+n UjlZB2zNbs4JiIcJSr93Upv/0MYM71pjZK/jhpJvA1aFe4t7+osqaVm3qw9lXTCc+BlQ imu6tI2GmECGXnq0CiqPDGFYSXpWty5xPv490wB/MMYNsICtYPomh6TIG3pCKxIQrXrt nTpHDPqIwjiBNcVcaJ7JaO+GK0Jj7IzDQDdi0mcnpLsrivlIU1ByhkZGfc+9J85yc8xM Fxlg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=4NjTWR9pJt90B9M50xUbDHMhOfBXN2o/M98+vGWZ8/M=; fh=Itbyk7CEvizIrzGEESCqq3I2tZgG1kc/GkVOa3S7Hsg=; b=qi7e2XDeuugiL7qLs6crAoFtPg6faXwtbGmSJtmRI3M6ctsVPg6k4sVU8R4Fa5rDpV safCCW6TvpmQuWumZ0emF8YXxvjrLxL7/LJdrdt3pQWDCP5faoGoh3zbgeV8CeHQAuQQ wcNKJMRR61Qw/8y21fxdBECjDeJQMxzuHDbyiIKKUADxOhxY0DxJzuzMIADSVQIJBw5K rRqwrhAjg7Dp1MmxVZT7GOvetkdijGujDxHiTsqGzY2rXEMzF+av/8hNnWkgymvx6UHH 5TsUyTpRVjkUpg8MyXKYOZBA8nqOV4wH5imO1agyNeoD/GcKurs/oGvQJ6fw3V5qqCeW +zQA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=dwxbCuCl; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-80863-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-80863-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id di4-20020a170906730400b00a3d37a45548si1879577ejc.541.2024.02.26.01.02.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 01:02:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-80863-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=dwxbCuCl; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-80863-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-80863-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 5329A1F21E8B for ; Mon, 26 Feb 2024 09:02:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B982B85C5A; Mon, 26 Feb 2024 08:29:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="key not found in DNS" (0-bit key) header.d=intel.com header.i=@intel.com header.b="dwxbCuCl" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 13C937E583; Mon, 26 Feb 2024 08:28:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.19 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708936139; cv=none; b=YVFj8Ad+Y3oEoqKhopnGdpFL8jyKaXbBOlnNoqo6U1YOb19DqWTi37mQu2LbiVmjAD8MiREq1Iyvc2De0p3K5EgphvWqnEpqy6zTpw0zP9P/T/3USdeF2SimVRF4xjlcHtGwyUEqb1uySqOo1P1G9cM9VZj5tMQMps6AAwiHydM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708936139; c=relaxed/simple; bh=3tymZz66rzCmQ3uC8SJb3tbWD7d20lTx/+E3/aBaoK4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=KzPJ3z9FLfv67OI/VHX/t65gymhFhDXsaW+R3c8u6LUT8dO6+mkaUh3dqeQAkS1ql35sptVbioQAh6z6kV+bgIXc1ouaIdrlwC0bjHR1YjS7eHBqsfn7GcXNxf472eJq5Yy9ks4qFdbjH5k1OVAt3oNTBK34O5L0wYQI0qKuPQI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=dwxbCuCl; arc=none smtp.client-ip=198.175.65.19 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1708936138; x=1740472138; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3tymZz66rzCmQ3uC8SJb3tbWD7d20lTx/+E3/aBaoK4=; b=dwxbCuClA5R87LNB8WiCzcFz+RnsuzEV1PsaJbrU2he+Xupj2U+hs6zr c8YQjjFiMNVrKw4b8vlSlQSw1dBY1qqzvVmDHzGIghNFB+sYyc8dUuKGF ikyQCIKJLjIRRloF2ai5a775ADflYbS9tdBiCy6yQiGqpO+3eZY7tL1Rb DGdfiVsW5SL0dBSGYB52joi8DNHULW1kH0n7Y9cx73f2QK5fK9hrBRgNt losF7c+CdoIWyuB4LZLmqj9O/R/nA71kuL5uW3W3a1PqY43bQ/2FSnuh0 JLskXJIlrzw0Ic1j8JF3RB1ePEHb6JqUWA33vn8R0vsJpZQWMiukthop0 A==; X-IronPort-AV: E=McAfee;i="6600,9927,10995"; a="3069596" X-IronPort-AV: E=Sophos;i="6.06,185,1705392000"; d="scan'208";a="3069596" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by orvoesa111.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Feb 2024 00:28:58 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,185,1705392000"; d="scan'208";a="11272684" Received: from ls.sc.intel.com (HELO localhost) ([172.25.112.31]) by orviesa004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Feb 2024 00:28:57 -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 , Kai Huang , chen.bo@intel.com, hang.yuan@intel.com, tina.zhang@intel.com Subject: [PATCH v19 100/130] KVM: TDX: handle EXIT_REASON_OTHER_SMI Date: Mon, 26 Feb 2024 00:26:42 -0800 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791951520334386476 X-GMAIL-MSGID: 1791951520334386476 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 cba0fd5029be..2f68e6f2b53a 100644 --- a/arch/x86/kvm/vmx/tdx.c +++ b/arch/x86/kvm/vmx/tdx.c @@ -1345,6 +1345,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; }