Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp4119395rwb; Sun, 7 Aug 2022 15:36:09 -0700 (PDT) X-Google-Smtp-Source: AA6agR5eSmbzfMpn25HEBleGpSdXkoBt6iKBXIsiTk+BQXp4WgtLBGTzUb/23nynn/WJ9Ray0oUA X-Received: by 2002:a17:902:da92:b0:16e:fa52:d42c with SMTP id j18-20020a170902da9200b0016efa52d42cmr16042735plx.75.1659911769122; Sun, 07 Aug 2022 15:36:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659911769; cv=none; d=google.com; s=arc-20160816; b=VcZYRRuZ7PBctN5yT2FwseRQc3+CwT6ECnW4kdqW3lXEWyrwlX8R5UlQS6kuiTkW1u t1EcnqEMc60q7BHjimry2ImH5My1Vkbcj+KyYEVxKY4RhvIWrL+2S5uYYqjLRg50DOt1 ZtQS0JvP0C/fiszT+gIFwCwXbQoYc5g/t5tFYweNHIogRE81C2SpfN1Rx7hKGQ0whcuP XALG03ZtCOF9WNrq9SwhzJSgQ4Qni/0IDABSGRXyxwt8Tf5RCHvoU8Ky79pZzxUETDEZ eZTlMXsTQsoRD3juc9bt1C1+BHe2gszjYU0XCDAioHXVMZghs8HNasXkkDHHBU7E0AR2 rBAw== 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=yd2QJp5cRqEjF/e5MTPI1MCjuMIsz7nmtU6lv4yi7UE=; b=H6uGs0zSoZjNaFpjqr3U4YN0orLbpRgu2g+l/tX7d0UW/FZA0DH8pKw8fgWFfUItTp SgrGirYjO6Gp6l4GwZV4SbOherUzion1Nxnfw7dyvrFZuAKMpp1u1u7AnhawU4JRsS2e /cwc7dBID8mcFn9VYa50eEx3Pr2b90spRtmqhhGhOG8oi9P9Acbj4xybMSwygAL/Eew9 HlJ6cmHQm8w5/cM4aowKBzzvMaTCpY88mZ/duV/xyZfnl/RyBuyLGCwX4+RKJ6AqS0AX xSYEWsVKAQVIWxJAjUgh1LRmEkIxYGYWlCEMSfcbMQ3vZXclqnsw/UfJUqg09kvrCgYp c1SA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=UEGurXzY; 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 n15-20020a63a50f000000b0041be1dda445si11415852pgf.431.2022.08.07.15.35.55; Sun, 07 Aug 2022 15:36:09 -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=UEGurXzY; 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 S242057AbiHGWIv (ORCPT + 99 others); Sun, 7 Aug 2022 18:08:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236371AbiHGWES (ORCPT ); Sun, 7 Aug 2022 18:04:18 -0400 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0EED3B1F6; Sun, 7 Aug 2022 15:02:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1659909770; x=1691445770; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=j15cQFO4R/pKHuenFOnmgHEVzw7+b5Vish63TbKW5VI=; b=UEGurXzYtGJzvb4Wf8Hw8UhSMDj+ze7zDYVeSuz05uNF9QLrujIdZAsr nkg4wUDwU3Xj91YZ4mXr1jUD8ieO5ueWsqEUV/yMA1XsznA1eEdt1x37h ptdu8ThfNH6nl/6/jN5ZMzZsiPPtu0UL9NHbpeTpEoaG+hPTd8IKQTwzl R/lDX5b2Ol5vxM5zpYgtToMATPCIbVi+QMouTuGTU5TkzBXHTpt/I56XG HJbHiseeQAzov51PUA2zyiGOTA/Fpqe+gWWItOe1em5DvbnCYIZvDq1Zx w2nm2pYCCBFWNw56e3vG9yLej6IiIUHcj889epx+kPndjAEq6JVrNRVVu A==; X-IronPort-AV: E=McAfee;i="6400,9594,10432"; a="270240375" X-IronPort-AV: E=Sophos;i="5.93,220,1654585200"; d="scan'208";a="270240375" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Aug 2022 15:02:41 -0700 X-IronPort-AV: E=Sophos;i="5.93,220,1654585200"; d="scan'208";a="663682702" Received: from ls.sc.intel.com (HELO localhost) ([143.183.96.54]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Aug 2022 15:02:41 -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 v8 078/103] KVM: TDX: Implements vcpu request_immediate_exit Date: Sun, 7 Aug 2022 15:02:03 -0700 Message-Id: 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=-5.0 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_PASS,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 | 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 605e8251d8db..52d3fac737fd 100644 --- a/arch/x86/kvm/vmx/main.c +++ b/arch/x86/kvm/vmx/main.c @@ -328,6 +328,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)) @@ -454,7 +462,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