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 69F75C64ED6 for ; Mon, 27 Feb 2023 08:32:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232248AbjB0Ict (ORCPT ); Mon, 27 Feb 2023 03:32:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231836AbjB0I35 (ORCPT ); Mon, 27 Feb 2023 03:29:57 -0500 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADE30206B6; Mon, 27 Feb 2023 00:26:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1677486385; x=1709022385; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=+e/THgQuzy9HKQWdHmsvCjGEpKAbWN26lu2fjw0xxh8=; b=M9t5L9PQ9sverzjKxV65vMAH2nXx5xryonvM0n51i2GyLojb/MBOu8uU OrAVJj71b6O4Smk6J/oSfH9wRigvivcE0r/Mw6EZ8nS124YfE5JMrOjaU 66tc7a/HEC45xjfRBIuw1kogZVEu/YJoq26EdJG2QAOKyXBr1j4RqDren GITNHf9Gjh9kcxul4PhSS7EkjyUBru7vHIeWSVdsAgG+JuGC/eP/Jmn43 ok7dQjTcByM3wKVnBgylYSiT1ZPhBZl/BBd8EZzBrAaBHafEIyQTLQIux JmqkRH87TpChUpkt/GfojPARfQklRpL+fVXWBdJYFb/14Auz/29HFzRLO A==; X-IronPort-AV: E=McAfee;i="6500,9779,10633"; a="317609067" X-IronPort-AV: E=Sophos;i="5.97,331,1669104000"; d="scan'208";a="317609067" 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:19 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10633"; a="783242408" X-IronPort-AV: E=Sophos;i="5.97,331,1669104000"; d="scan'208";a="783242408" 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:19 -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 090/106] KVM: TDX: Handle TDX PV report fatal error hypercall Date: Mon, 27 Feb 2023 00:23:29 -0800 Message-Id: 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 Wire up TDX PV report fatal error hypercall to exit to device model so that it can gracefully handle it. Signed-off-by: Isaku Yamahata --- arch/x86/kvm/vmx/tdx.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/x86/kvm/vmx/tdx.c b/arch/x86/kvm/vmx/tdx.c index f4c0f715a36f..f20fcf8325aa 100644 --- a/arch/x86/kvm/vmx/tdx.c +++ b/arch/x86/kvm/vmx/tdx.c @@ -1243,6 +1243,13 @@ static int handle_tdvmcall(struct kvm_vcpu *vcpu) return tdx_emulate_rdmsr(vcpu); case EXIT_REASON_MSR_WRITE: return tdx_emulate_wrmsr(vcpu); + case TDG_VP_VMCALL_REPORT_FATAL_ERROR: + /* + * Exit to userspace device model for tear down. + * Because guest TD is already panicking, returning an error to + * guest TD doesn't make sense. No argument check is done. + */ + return tdx_vp_vmcall_to_user(vcpu); default: break; } -- 2.25.1