Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp558825rwb; Thu, 12 Jan 2023 09:18:13 -0800 (PST) X-Google-Smtp-Source: AMrXdXvRGVEdN/SijjPCM/U1t/BI/PiycLDfHIUWS7N0e+D0kvfnfYBo/Eh3QEo7xh3jookvxamt X-Received: by 2002:a17:906:9c8e:b0:7c1:4a3a:dc97 with SMTP id fj14-20020a1709069c8e00b007c14a3adc97mr81538001ejc.0.1673543893622; Thu, 12 Jan 2023 09:18:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673543893; cv=none; d=google.com; s=arc-20160816; b=QbxV1PjXp+X/fCfUC+9uSW3uxJ6aH/ziovMWMYLI3co67HhP5xTspLuOny1obpvHuY oJ8OZOeA4n1mh2BsXY4tADOAdaZtwXldtnnapx2eEUmSHHO7DyU5WbIJ16Og891+04T4 CZ1YzrvavvgFYmi20bqlx2f2Lmz6TsJvEg81B79bQ8sctwtK7V2kJcqZwnTDSA/rVs2O 1Mt+ddNJ4dAR3N756ChlnCdjmexUZHX1HjmErXj99m9rFiPryLZWoUMaQkXujVlevkWU qjbjVyVt6X0GyrnrQGHYh1SO6FVBxknyQ4tS6Yl6e65I47TczVLCJJ61tdYJuRyMiHCo ZOdw== 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=gixKS4tSt3cOhcKn1/H7YqNdoNx7hbRdNQqzO5Pon3M=; b=PcB8bZtOmM6oTGs8GTG/jXTQGAtzmFrAxZWm50vNdVKU0LdZZCb278XyydmSoT05M4 7GAWyLPVN84xzL4ppIlycaWwHDSCC1r/TIhfpAPiPAVKIeG35fZ49I642XVXTlGqQcUD 1cAGbTAB72Au9+YQcXnziZ/6K9V/Cl9agWWbgqacU5mf61WPvNHuX20QtWC7ZTjB6IBR nmu9VqL2sEOix/de+0u7GdPCUlkhvfv8ucyVQGEgKB+aaBj85NtGN18jy0mM1QlsKSNl PXMctLEJMZ9WEtRRRBEhJYzmoVun/21WFQ2R2LwWDe0hVcFsDVShPRAn8GdQm5Gg0+Tc 5bnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Dlj+Ua9o; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ji21-20020a170907981500b007c14a639de3si19200311ejc.480.2023.01.12.09.18.00; Thu, 12 Jan 2023 09:18:13 -0800 (PST) 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=Dlj+Ua9o; 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 S240576AbjALQks (ORCPT + 50 others); Thu, 12 Jan 2023 11:40:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234748AbjALQh1 (ORCPT ); Thu, 12 Jan 2023 11:37:27 -0500 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A9FC12771; Thu, 12 Jan 2023 08:33:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1673541227; x=1705077227; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=hmZOmmDPZfznqubXfeRRdJI9Kyf8KoOoN+Zdo+unsC0=; b=Dlj+Ua9ooBJ96NVJXGlMIPXxdfNyEZqGHQJMc4CFB7gBuXI5gy2pKe5C VdZuXq/XDJlmHsFcxiK424bDYDI7OyCMs9vx0jpSbYM71HI17ZE84tCuJ 1NsaTqlJ0BfOhmwDEkSnii/qKDlCjwJ/4c3ZG6SgcVl/Oqj2IDyLap/wn UuGRc1eIabK8dH/LwPeb245BW0BQ2nJ8ndcvIQoBE7JKFnS5Upbuof8ED sn3RNI1lhgQNfHlSaBZ/EqsoxUaDpnd2iokDPoC9Zpr/83bJO10vkArSt ZA4fUj3a4k9lXe3EUkTJ4yw47g5FqLJknHZpAzXeuZArA6cNsmZIBOreM g==; X-IronPort-AV: E=McAfee;i="6500,9779,10588"; a="386089757" X-IronPort-AV: E=Sophos;i="5.97,211,1669104000"; d="scan'208";a="386089757" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jan 2023 08:33:37 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10588"; a="726372582" X-IronPort-AV: E=Sophos;i="5.97,211,1669104000"; d="scan'208";a="726372582" Received: from ls.sc.intel.com (HELO localhost) ([143.183.96.54]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jan 2023 08:33:37 -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 Subject: [PATCH v11 098/113] KVM: TDX: Handle TDX PV report fatal error hypercall Date: Thu, 12 Jan 2023 08:32:46 -0800 Message-Id: <1b4b247e8a374e1b8c2d7c2bee948f8e50a9ea5b.1673539699.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 X-Spam-Status: No, score=-4.4 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 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 5dc7dae55c57..4bbde58510a4 100644 --- a/arch/x86/kvm/vmx/tdx.c +++ b/arch/x86/kvm/vmx/tdx.c @@ -1199,6 +1199,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