Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4422031iob; Sun, 8 May 2022 12:11:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz3K40iiZqPXqs4TbxGgb6Ct2cJjKkZl1pHinQ10UtmsHS6qWwWXv/0fHJVF16zY5+dfO3o X-Received: by 2002:a05:6a00:1391:b0:50d:e125:e3c with SMTP id t17-20020a056a00139100b0050de1250e3cmr12865279pfg.75.1652037074291; Sun, 08 May 2022 12:11:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652037074; cv=none; d=google.com; s=arc-20160816; b=WgaVxUqq+/fTZtCCfXn0eQGKjc8fyEAPqJPsrm28CunOiEH/T/Zb2FWoOBqp+cWAX5 VjDLwT+aAmrXj0Ry9ZQmWtd6gkMk3sIA8zPSUacs/eiFgwQwn5EHqfe0CTfmABQRIIFF EaJdPjDu2swJ2zVdYgmfnnYDfIqB11NvA68cA0OI9BlYWTCEQv79YtuJQ7HSmJusAyXw lnB/ycEhnTd+Pni3M8U7xbkh3GZz9/mGqWI7ZDbwixzqAK6XhrE34VXCyrBR/B3itZ2H GJWzlrdldxKdvFCJNeXOm7NZ8PLit0mO2o4ivHmJRT/EkYHwnS60d/vulKiv9/aZNpjm Dblg== 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=IVYUZwXnDzNoGxqXCYMJaPDTyez1E2b7niCccjviVJs=; b=iDAQxrxS90FpzoZ1IDhTfoApqLd8WiU/fojqLyZlBHuuv7JoZVoalNu88rbL4zdmzB nMbNalIRkUMzQ3Z/6VCM3snB/hjpE3JH2tZy6TpZUtkSN5w7E+QKnp7byh0fcT1tgPMB VeBAy6e5cLHL8ItqTwx0CFoLNqALcI4gvFM6xi6y1qQZ0Jif8qLvXs8gQDTLEBHxabu0 yflzvCNJ/0jeNv+ZFy1wdCdzxToystBZrR3XXd3qheqT2ZqCo437qxnLLxAxhqSJeELl 9enfbnxI3LhgGWbuUBRnRl68+v8hjY0MIJIizU+PKmiB8zgFsIuE2njDcQ7bQrVppBCU UrEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Hr4a7Bx7; 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 k71-20020a63844a000000b003c640602c91si9129366pgd.266.2022.05.08.12.11.00; Sun, 08 May 2022 12:11:14 -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=Hr4a7Bx7; 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 S1384206AbiEESZi (ORCPT + 99 others); Thu, 5 May 2022 14:25:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1383253AbiEESTn (ORCPT ); Thu, 5 May 2022 14:19:43 -0400 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F08F5DA5E; Thu, 5 May 2022 11:15:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1651774556; x=1683310556; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=xGxTjXnp3C28uC6iCdzQxF3RthvA/OE2Nb7h0Y2iDng=; b=Hr4a7Bx7x0hD7VQpWX8QF/l7BIdUTi3F1wVKPCvnDhmKEt/WGWwCyJrB 3PkeLOzl20kVVwaIjOkQiuQMP95YJknjIVWJGcGhPNUTLk1bAqoHdw3tq G8NKpwN7DunrP6gQIeycCp7BGytdy/ykEk27o4GtHTUjKJ/a/6P4PBar1 g+s+cq6u4UB0kfzvs1lINXS7pv6agAU5LjXk0cxZAE4RyzNzNI+qQGKQb hleFL8QGMH/HgiYW+L/286NyuMg7rTz38nd0kBpa8qe/rFZOrKIyerjOj 5NEYeq6ha62swWvaHy8ddgQYDUr7m8VFit5pHtB/6gkWjj7pi/K+x3jZ7 g==; X-IronPort-AV: E=McAfee;i="6400,9594,10338"; a="248113919" X-IronPort-AV: E=Sophos;i="5.91,202,1647327600"; d="scan'208";a="248113919" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 May 2022 11:15:52 -0700 X-IronPort-AV: E=Sophos;i="5.91,202,1647327600"; d="scan'208";a="665083425" 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; 05 May 2022 11:15:52 -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: [RFC PATCH v6 079/104] KVM: TDX: Implements vcpu request_immediate_exit Date: Thu, 5 May 2022 11:15:13 -0700 Message-Id: <6a288ef4c20e580ea8e0a26f671f0edcf7366461.1651774250.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=-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 613791b50f55..2c07e195cb8b 100644 --- a/arch/x86/kvm/vmx/main.c +++ b/arch/x86/kvm/vmx/main.c @@ -311,6 +311,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)) @@ -435,7 +443,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