Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2682464rwd; Sun, 28 May 2023 22:07:06 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7ZtsmGzD6lwaMqJTiEcbWcYYmKK2HTKoC4DxZ+OOd1XvD7+pT+W6e7DbDPuL1KN2dxk3k+ X-Received: by 2002:a17:903:230f:b0:1af:bb27:f55f with SMTP id d15-20020a170903230f00b001afbb27f55fmr11904922plh.55.1685336825660; Sun, 28 May 2023 22:07:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685336825; cv=none; d=google.com; s=arc-20160816; b=KDW3FA9JdQtJcjgqEOPKlr9LETLuVRffZdHJZm7FRWhjgY31L0VMinudRMKR2st6Vs xARcy7I1+SBoAjlIElGaMCWwzoO3t51s2SSScVBPvHYyprZZfsCrKCICTo29gprlpWqE d0kQD0Zk3JvgbFOu5LIMsikGcgOyOb/PE8ayG9BRV5WApX4FvKrW7fkdzO+tO6JvHDVb c6aIVOKLac2u57VgpgGY6f2uj1HPhu2QGUoqIusL51zpm0xUQQuOI6rr5/XkyS6NhtK3 X3b80/bGs25cvUljfiCWZgJ9m+fmhlgKDu1MMOeBnMTbY0/XnJw8ln6/T3qeWAzTd3b1 yOKw== 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=1NzuezGRo/SWxXw7FD9Ub4uUjyrN2YnkA/fkfGv3wIQ=; b=ozY5TT7C+sbL9+vfRBAiYOwVb6nw/S31Ue8p6TOWmnlxdlJgkRoloRUsgsNmAhaprG OLIA3M7kmunrcVN9u/NrSZr+SlfPZF0n6nyr3rc1SS0zfuHJzAvBWm564etmidtOEsU6 bhaP1R5SnUm1WpAptHzWi0Mj8/6KIytZCDTo2XZ78D/MBOpng2oparpJy53qooQK0CTX IeRbDf8sUeXJ/aQdQEUX1GwNbdPJ2RT2NSnZ37UVhGBjn600Kxow9l9M5Yxz4A/O420L I3vwKenDWtmsppoZpOSBZ8OSFDHouZ/NleZmdg9SZvofyLwjDIQpNIJzl68+UIKxReg1 Vqlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="eEj/RIoF"; 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 z8-20020a1709028f8800b001a6f0eab385si9018550plo.55.2023.05.28.22.06.53; Sun, 28 May 2023 22:07:05 -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="eEj/RIoF"; 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 S232147AbjE2Edn (ORCPT + 99 others); Mon, 29 May 2023 00:33:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232110AbjE2E3J (ORCPT ); Mon, 29 May 2023 00:29:09 -0400 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48D75213D; Sun, 28 May 2023 21:25:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1685334327; x=1716870327; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=8gj5om2vXb982qRmgkUVx7Nw72HGXWlHSE4tH7SDwSw=; b=eEj/RIoFQi6HfYU/+PdeYUK/SFAxIOveuwjbvVnWYna/g0nU9XVR7rfa wNY7isCeK9UH5jUR2byCEh6dDDYR2f9bo3BBEljABVquOmnX16koCI8hx L1/b8epe7KmOBdt8J2F6QPO2fDlM6OUnLlCKVnajxLRCKiDyNyj+nyoCu kP/qUPo6+GPVY815Lv3S7mo2zNzLB1U5H9xAGhS0NFReZelz+IzaZ3OU0 DJ1EroaBj44N4H5X95g+c5cebr/qb9VO3kUwjSu9oU8PhG3H9r1rDRas7 zQiC5M34uWSTGVr55oxnA968xXgq07UA//8sfbFqaz0/IuQzSNnrJCz67 A==; X-IronPort-AV: E=McAfee;i="6600,9927,10724"; a="334966202" X-IronPort-AV: E=Sophos;i="6.00,200,1681196400"; d="scan'208";a="334966202" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 May 2023 21:21:31 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10724"; a="775784484" X-IronPort-AV: E=Sophos;i="6.00,200,1681196400"; d="scan'208";a="775784484" Received: from ls.sc.intel.com (HELO localhost) ([172.25.112.31]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 May 2023 21:21:31 -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 Subject: [PATCH v14 078/113] KVM: TDX: Implements vcpu request_immediate_exit Date: Sun, 28 May 2023 21:20:00 -0700 Message-Id: <1a31b3559ea5ad320b03aaf82a7af8bf1bad74da.1685333728.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.6 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 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 c86c5e3f9ea3..7b815e56c65d 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)) @@ -528,7 +538,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