Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A1F1AC6FA99 for ; Sun, 12 Mar 2023 18:08:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232108AbjCLSIV (ORCPT ); Sun, 12 Mar 2023 14:08:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231822AbjCLSEL (ORCPT ); Sun, 12 Mar 2023 14:04:11 -0400 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DAAD724489; Sun, 12 Mar 2023 11:00:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1678644013; x=1710180013; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=VcB8Qaw23nUnzVFKydSPDjBfQoMLdmX29MJlZef4eYQ=; b=kTw1BhA79kc38eXtM0r7zQ8TLj6WBrxQP/39ObKTgmYunLUJLn+aA7Dx tQmQmmAz8KAQ+mvqNZGc5DiQBOcK+kew5rFq7Q98ZRI83YGeOotsHDRqf gPzxjhK05HsfBejYIbmxWneNtA5QQpqCh90x2b1K09f9tB34+h9wxPub7 +E/vqHM1x+JWFyPKeLtCJ2ITwgwPFnBjcjfOvVI13Wdi6S6pb1PCDYD55 beRoVlknEwHCUqO6lSBUbbbA6J3yAdh3jz42a2ILsx+bD9D6bVXhXjKXJ C+63IEFclI4tZVCt8iFqM+JLeiA+/+jIhqzq7069WcRTMQ5KScS/F+xP1 g==; X-IronPort-AV: E=McAfee;i="6500,9779,10647"; a="316660012" X-IronPort-AV: E=Sophos;i="5.98,254,1673942400"; d="scan'208";a="316660012" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Mar 2023 10:58:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10647"; a="742596750" X-IronPort-AV: E=Sophos;i="5.98,254,1673942400"; d="scan'208";a="742596750" 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; 12 Mar 2023 10:58:11 -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 Subject: [PATCH v13 078/113] KVM: TDX: Implements vcpu request_immediate_exit Date: Sun, 12 Mar 2023 10:56:42 -0700 Message-Id: <6828ee177dca50ba8287da89c3dd1c8a61fcb2b3.1678643052.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 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 b3c2be3e78ef..a54b97203e5c 100644 --- a/arch/x86/kvm/vmx/main.c +++ b/arch/x86/kvm/vmx/main.c @@ -382,6 +382,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)) @@ -529,7 +539,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