From nobody Sun Feb 8 19:56:47 2026 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 492F1C433FE for ; Fri, 30 Sep 2022 10:23:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232148AbiI3KXv (ORCPT ); Fri, 30 Sep 2022 06:23:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231638AbiI3KTR (ORCPT ); Fri, 30 Sep 2022 06:19:17 -0400 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8696A1E3F48; Fri, 30 Sep 2022 03:19:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1664533148; x=1696069148; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3m2IFup46Mtlv/fc2es6KrwlyyadmWXqmbVoQs8Ubi0=; b=DPr5b8yW6ceksUvfrSlIDISoJX24xItYf21WHOlg3ulePMVPlEC6iOnZ cI9OhjoGFNMphPMuX4BuD7tU1tqgdxanaSciwo8qsZ8OniUjC3hdkLuFD x1UZZy+Mb1ncLFVeKJ4gQ21GtH0fc+wNJhtsIRVzEbzCdH4cDunWlgnD1 8jmF1Q03If7QTR6PCUWPV21sLayXzXJ8exp2/3GPZjqqZ4Hj8qNPanA0M tMAxnOIzZr3ijrVOf5OTvPv2pqJHhyHgH/jIx6aLR0Tj/FOfhUX6Zr+BZ kvTcCR9VcZdWrC7578s4Fs8NP2kKHIiRyR7+5/tl5zzDKvFMLCP8L1NXp Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10485"; a="366207532" X-IronPort-AV: E=Sophos;i="5.93,358,1654585200"; d="scan'208";a="366207532" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Sep 2022 03:19:05 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10485"; a="726807761" X-IronPort-AV: E=Sophos;i="5.93,358,1654585200"; d="scan'208";a="726807761" 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; 30 Sep 2022 03:19:04 -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 Subject: [PATCH v9 079/105] KVM: TDX: Implements vcpu request_immediate_exit Date: Fri, 30 Sep 2022 03:18:13 -0700 Message-Id: <4f68d392b80f6eb6b31f31155f07e790ca52fd7a.1664530908.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 6b232fb8f981..7dae3a1999eb 100644 --- a/arch/x86/kvm/vmx/main.c +++ b/arch/x86/kvm/vmx/main.c @@ -319,6 +319,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 int vt_mem_enc_ioctl(struct kvm *kvm, void __user *argp) { if (!is_td(kvm)) @@ -446,7 +454,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