Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp262496rwb; Tue, 25 Jul 2023 15:37:24 -0700 (PDT) X-Google-Smtp-Source: APBJJlG7wn6NPFXwvDQvLpY58dHp1iTRitfhYa5ShgzmLCSVjS1+ThOBVcVIjVF7lQoSa4qFrW1P X-Received: by 2002:a05:6a20:12c7:b0:137:e0dc:b10e with SMTP id v7-20020a056a2012c700b00137e0dcb10emr497687pzg.0.1690324644296; Tue, 25 Jul 2023 15:37:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690324644; cv=none; d=google.com; s=arc-20160816; b=EiRuStQVDQeTirCAuUiNB27tVropGpBmk/zYIqLDVp3JGCrWS7za2mFMJm3XEaz3np UEkhBKIGEs8gFDiTqKFgV9xCjR6bdLLxtgIWwouUTLx9Aea5/2afe8OlXFBurDTcnKuq xqoS6MjuB2BuRy2eImtRE/wfGsKkA24NUI9CKtqrHsKhdkHcn2T+p3zIyfYcp1s7hM8T MQFRgXA5ub5NYJ4preHd64bc9urUzjHBwGB2blOGu4HUET49oHSeZ5BfBUtJhpv0Jf5h QlS2BGimw8OgDqhZz1olS6UPQuuVpUVZP73vi+KXiBjwu9bsGsC++G7oqglbE5vr73Zf e1sg== 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=bNOOJNHfjByZ0eWFdUnezV9VcqSer50FJZOQHD6vNOs=; fh=juxwNcA6iKwLISFgUCNwdoIYC0NKLUseq3xZdq25RR4=; b=wt0fQk+oif2/2l03RYyugM5zfA7D8HpOdYJyHuYiQ3W0DhUFSiw1yXFb1zKAH02kih TXLds/reJanjKZes9px/vkvAbY5465L4GIeUa1X4wIueI8DWmSefFUVX3PukBrcrdzP5 AamLyhNlm0+EQXBkdyvvt5eJ7ZwvdMH5URYMAunNFpkdjs1BtGrgkcS8xhFcvFl/jEwF Z3QtQ3nHuIZrDPcZ/9VDQCQt6WTsPWn/ajKwM0FwJXVOQ6oyuBAPd2+byxFDkF+ocGEo CNjyl9nSy46Shf+r92dyTPmQwqtugBoNVGyXY5IU7I1Rt3eGgmfciBlUS8/D7u9F5d1r YziQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=NUnMznXt; 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 s67-20020a637746000000b0055c8ad484a1si12187469pgc.125.2023.07.25.15.37.11; Tue, 25 Jul 2023 15:37:24 -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=NUnMznXt; 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 S231475AbjGYWWT (ORCPT + 99 others); Tue, 25 Jul 2023 18:22:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231340AbjGYWVZ (ORCPT ); Tue, 25 Jul 2023 18:21:25 -0400 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1731D2D43; Tue, 25 Jul 2023 15:17:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1690323440; x=1721859440; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=IiFdHvSfreQxASHx9FGH1Lj9RsEngLdIbtSKEO5CYZ8=; b=NUnMznXtCjMP/EqaTu1MxEfBEn2iSp87d3708qrgPYZQSBFuJRWq+p+a r6BqFTgvILM1RUeLGNKf0OU2AVltw0lhkHPlfWPl+E2U3rfcl4NnF+ccI F5nGpBZEFMtjR2z8epeAVc4vQZlhj944wbdywkPEM6QIMVbBBtDmKeG1h VLB2eSXuUDVzb/DEZJ97qO8PM3xSuLgtg2V3Mzuo1IRqooylBZUSmlTLV joeG092H5Iprq2YQA/VyEsxwugiu/q9T4l/+MIMCOl+hXUseznCBL0h6n Kid3UACzsDArAIKJHvOPMcc+IhumapClxWptqtld2wwWJ9tej+swyMNaJ A==; X-IronPort-AV: E=McAfee;i="6600,9927,10782"; a="367882621" X-IronPort-AV: E=Sophos;i="6.01,231,1684825200"; d="scan'208";a="367882621" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jul 2023 15:15:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10782"; a="840001849" X-IronPort-AV: E=Sophos;i="6.01,231,1684825200"; d="scan'208";a="840001849" Received: from ls.sc.intel.com (HELO localhost) ([172.25.112.31]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jul 2023 15:15:56 -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 , David Matlack , Kai Huang , Zhi Wang , chen.bo@intel.com, hang.yuan@intel.com, tina.zhang@intel.com Subject: [PATCH v15 078/115] KVM: TDX: Implements vcpu request_immediate_exit Date: Tue, 25 Jul 2023 15:14:29 -0700 Message-Id: <1adaddb9fd96bc5a9783cdcb82bd445e2d0304f2.1690322424.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,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/arch/x86/kvm/vmx/main.c b/arch/x86/kvm/vmx/main.c index ec663813c479..70112388276b 100644 --- a/arch/x86/kvm/vmx/main.c +++ b/arch/x86/kvm/vmx/main.c @@ -381,6 +381,16 @@ 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)) { + __kvm_request_immediate_exit(vcpu); + return; + } + + 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)) @@ -526,7 +536,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