Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp3395743iog; Mon, 27 Jun 2022 15:24:26 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sl1LUui/qP8YzDUTYuA8gnat9drbc4wwp6pDrD0Zv9wO74BS2sc3rHSYHV+k1Qt9P8vg2O X-Received: by 2002:a05:6402:3707:b0:437:61f9:57a9 with SMTP id ek7-20020a056402370700b0043761f957a9mr18962431edb.1.1656368666186; Mon, 27 Jun 2022 15:24:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656368666; cv=none; d=google.com; s=arc-20160816; b=Jeq1X3Nc8zJSEESvufvtZyt8sEIVli2vx3aADi6iCeehceGmiqFn/kQi/G94eO9cLk i6L/eBPDbFJVPx1Kynpg4xFR2sFPUrloQV0Vr5TY6LVrAHIRwd8Nz/P+kfS44iDRdpkM LuaAMAV4z+Oqw8iXgd+HYcz7QMzd7S8UMIQf4xzMkB6NMrehdGYn3+sv3/Aov82UYSvN 7kDvitupKooT7+CH5jnprkEt149L5r2ZjjU8rmkHEa+nh9xqx3AVHXyvpjh2uYHAeaYt 90mDU5tOqUj8+MxBhNIdFGr7xnYozGwh2YTuNkCUGvakrJ51RHrQzvfy1juaXR3fFetD icgw== 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=ftNDNL3P2Vp+7NbdKUcjUM3K2wlPWaoFZ5kvBw82ELI=; b=hZuw8RTD2lilIz7pxePYBG3sHJObw5gvqrPmlG9OYNImPfewqjTzIvEjELjpyJ8eBs BVtxS0CrMD1ius3O4EHuGxz42RZeOAotGnjs/JlSCtxBm0rOjYlx8s3eyrfNf1iJyRYz 7KnwyH69RFD8reO2822QUKlRz/oayxmSW/LAyZ0VrcDzg08/YT84pO0jiMXFAi9W3NTr d9S+Lkz4RXJJAbpvI3yEY5SGNXy/A7gPknUJzL4c7feCjXJYKyDOrK5ToaBo49z7b2ho 8LupDNpy3Z2aO43eV4SI3N18u9IIGuNhk+BcqYyHpDBj+ymB3+ZH8k/sPXp/5xho5jOS gHGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=anz5V9tQ; 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 r9-20020a1709062cc900b0071223d9f214si12329447ejr.177.2022.06.27.15.24.01; Mon, 27 Jun 2022 15:24:26 -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=anz5V9tQ; 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 S242028AbiF0WAo (ORCPT + 99 others); Mon, 27 Jun 2022 18:00:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241561AbiF0Vzq (ORCPT ); Mon, 27 Jun 2022 17:55:46 -0400 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D20A213D52; Mon, 27 Jun 2022 14:55:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1656366905; x=1687902905; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Z/T+R8pNd+jfmnXzaarO7KtGTxMxSyFL1NpPVEsp/E4=; b=anz5V9tQ7A2/AqYrzZSKfOU10De6YcVtuX5Ei7yyNLlQp4YLD6jL5u3B z2im2MFJwTWtKsvFglAmArezGwG29cyIiEq+ja/8BTORtAStkWOdCpTAE 6Rq9DsUYWeyVXuxopTYL/nJWIy8WbBU8tezeMVKa76d6xGjHq0cpRScFj b/CEmPdRY/WvRPTzm7CLj2bE4b0xPjW5iTpWm64JrLTrcHDRuigPQRfoD gGjgq6/Nt2jzJH91o5J0aliym3D307Ors0/WYy3vljlGiTFhPQN6N+YXc nOY98LcHYDS7A8GDO60SbkvPFvcfjeb6A6tvvwy1XKeU9L+M7oxt2aHxy w==; X-IronPort-AV: E=McAfee;i="6400,9594,10391"; a="279116123" X-IronPort-AV: E=Sophos;i="5.92,227,1650956400"; d="scan'208";a="279116123" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jun 2022 14:54:59 -0700 X-IronPort-AV: E=Sophos;i="5.92,227,1650956400"; d="scan'208";a="657863691" Received: from ls.sc.intel.com (HELO localhost) ([143.183.96.54]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jun 2022 14:54:59 -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 Subject: [PATCH v7 078/102] KVM: TDX: Implements vcpu request_immediate_exit Date: Mon, 27 Jun 2022 14:54:10 -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=-7.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 | 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 07ea7211c633..d743de7b087c 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