Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp3463253rwb; Fri, 30 Sep 2022 04:06:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6LN639ih2eP+p4Y8DoAni2Dszhfu2KzVCtGT7teC0VusUeCx0rhuXhsT+R7QFZGrppmbrD X-Received: by 2002:aa7:946f:0:b0:541:fcf0:31d7 with SMTP id t15-20020aa7946f000000b00541fcf031d7mr8280858pfq.35.1664535985536; Fri, 30 Sep 2022 04:06:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664535985; cv=none; d=google.com; s=arc-20160816; b=FtN77i+hK0uRJzfzxL64MtJikhh34kWoQVGc21h9w+L8sqVXEb0kYSadRn0Ifxl5E/ bZSAHxu8RttucOZsuy8eEjfGECBSzh9yZZ9KLG7NP0NIj4xiCvNdUMGplOdNK9c5nrBB 0l558KVzYZRpwERa6x7azJjTA2+TmQzGHvCrRBPWX1MxiG7M7RU/QMvjJAseMcpUHGsW 0pJW+eMPcb6rAT20HWWPOjt6rG+/FjMGKjRpX7wKtnOMlCoG0PSEKX9lQX1g2wPGB1Ye RBjpLUEhrWCHLYIPE+LFiLB6eE+8/Hq6EtZj38Y/KV/JJJqbsBE29iixip/dHAHI252f EJnA== 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=7MSE4v68S6OLbTvZh89GqZ2mCbtOfr5zgXYSimIwkCw=; b=mJbHo30aHXMmTwELAgnB1f0ExDdNbZ4tgfT1nl36u1/t1iUyX+hH15np3Gmj4OiUsc wqoWXnx0p3kWVywahnWuRiP7aOM5pZnd/opTX22JjLl/hiFHeY6LMtuIeu/vLEq085wx qIOgxip8tT7HgjQzqH4QWhLFOFuCRBfcTc407/aA+OpkDiCdLkkpfW9FXloT4G8DaQke sfBecQruZKSxwbCv2m/O3o22ATeB2kadh64COxeZnpi6aziIQd+WctSD1aLl7TGHK1Z2 311NiJqrgkWiYUeJnHAsaWg/OmKBi12xhStJLWweTeCPB4VKTaNmBdFtTR64O4LF7EJy 48Mw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=DPr5b8yW; 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 z18-20020a170903019200b00176939b5cd9si2972145plg.578.2022.09.30.04.06.12; Fri, 30 Sep 2022 04:06:25 -0700 (PDT) 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=DPr5b8yW; 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 S232123AbiI3KXu (ORCPT + 99 others); Fri, 30 Sep 2022 06:23:50 -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: 8bit X-Spam-Status: No, score=-4.5 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 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); } +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 = { .check_intercept = vmx_check_intercept, .handle_exit_irqoff = vmx_handle_exit_irqoff, - .request_immediate_exit = vmx_request_immediate_exit, + .request_immediate_exit = vt_request_immediate_exit, .sched_in = vt_sched_in, -- 2.25.1