From nobody Mon Sep 15 11:31:29 2025 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 D72CFC61DB3 for ; Thu, 12 Jan 2023 16:38:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240042AbjALQiN (ORCPT ); Thu, 12 Jan 2023 11:38:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238170AbjALQhN (ORCPT ); Thu, 12 Jan 2023 11:37:13 -0500 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1936D6578; Thu, 12 Jan 2023 08:33:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1673541218; x=1705077218; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=fD3KdNa//W/7XrNCHLub7NxwAzt4x2sWEnyFw9K0jBI=; b=LezsU1EG4TyWQa6nGbmH6c/1oYHHiOFzcjPKbN/CKhu/yvI7AjmdeTSE wCIv7u0FKKkEORqwTxES5/FMDQU7opGzLjz3/R3RJUNsnnRMGQRcELSiI qNIprVBdHYaRq63JPNED3T9PLb5lQ3VbtDDHBSk0sYzj7LwIE8eDKSqFe UlJDlGz9jGb1M/qhYPTcq6QFSNhVXaqC0HI5Iuba4e+pAYFGJnmJb4RAJ XHTar1NNa5n3ghVRaOz9xv3UDJ6v1R+zdChbS8HUv3d1WFI812sR968lP d6/2QXc1lXEUYItNoa0MuJMBovZMJsqPq3XdmGxOqGjlIG6GtCHNNfrK4 w==; X-IronPort-AV: E=McAfee;i="6500,9779,10588"; a="386089655" X-IronPort-AV: E=Sophos;i="5.97,211,1669104000"; d="scan'208";a="386089655" 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:34 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10588"; a="726372502" X-IronPort-AV: E=Sophos;i="5.97,211,1669104000"; d="scan'208";a="726372502" 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:33 -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 079/113] KVM: TDX: Implements vcpu request_immediate_exit Date: Thu, 12 Jan 2023 08:32:27 -0800 Message-Id: <6b50d1e7b8555d3f6baf6b41e2c2e25caccf835f.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: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Isaku Yamahata Now we are able to inject interrupts into TDX vcpu, it's ready to block TDX vcpu. Wire up kvm x86 methods for blocking/unblocking vcpu for TDX. To unblock on pending events, request immediate exit methods is also needed. Signed-off-by: Isaku Yamahata Reviewed-by: Paolo Bonzini --- arch/x86/kvm/vmx/main.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/arch/x86/kvm/vmx/main.c b/arch/x86/kvm/vmx/main.c index d5a838e87fb5..7962f03e222d 100644 --- a/arch/x86/kvm/vmx/main.c +++ b/arch/x86/kvm/vmx/main.c @@ -307,6 +307,14 @@ static void vt_enable_irq_window(struct kvm_vcpu *vcpu) vmx_enable_irq_window(vcpu); } =20 +static void vt_request_immediate_exit(struct kvm_vcpu *vcpu) +{ + if (is_td_vcpu(vcpu)) + return __kvm_request_immediate_exit(vcpu); + + vmx_request_immediate_exit(vcpu); +} + static u8 vt_get_mt_mask(struct kvm_vcpu *vcpu, gfn_t gfn, bool is_mmio) { if (is_td_vcpu(vcpu)) @@ -443,7 +451,7 @@ struct kvm_x86_ops vt_x86_ops __initdata =3D { .check_intercept =3D vmx_check_intercept, .handle_exit_irqoff =3D vmx_handle_exit_irqoff, =20 - .request_immediate_exit =3D vmx_request_immediate_exit, + .request_immediate_exit =3D vt_request_immediate_exit, =20 .sched_in =3D vt_sched_in, =20 --=20 2.25.1