Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp177356rdb; Mon, 22 Jan 2024 16:32:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IGMqSC72Q2EQQMzN/jw1mxEsPGd3LqrNR6JkcPvbTAekKtE0FohP4ksw8IJmyOE+iAYTgQY X-Received: by 2002:a05:6358:d04a:b0:176:abf:3777 with SMTP id jb10-20020a056358d04a00b001760abf3777mr4556339rwb.28.1705969943257; Mon, 22 Jan 2024 16:32:23 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705969943; cv=pass; d=google.com; s=arc-20160816; b=Jpoj0PeYvbA6LcSkTI5/1xN/T++jDnCHrQfu5RHFM+1NQa68I761byJ6Le6mKMndZs oVCAtU6u8AXs9BNRX/hZWJia47ukpZ9C3Mpf40QKPjf6m0nhUV4h3ynHcjO2gqA5o6lz scHAP2smc4JOge0lDEprEV4lwnCbY9P7U4ggMKyAw7qu7gYbTgOtFab7suuUzy00A5fZ DjadS8JI72JdeRvhKVf1Rz1NR1Kfw/tBHz8mX5jeMARuYlZhDrDckNujlm4HFuKjSf8R vQ4YjMOtBC7XAHbmHIuPxpwzbyC3Xs7RIjnObkorKWIzHiR2T2g6hGwFhaHhOWuWF112 /pdQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=fZ69Vbec9+9wNE+jWjkPRHLbmW2b22oCSb4/bNP+7SQ=; fh=Itbyk7CEvizIrzGEESCqq3I2tZgG1kc/GkVOa3S7Hsg=; b=UMYml3Wk/tMjb5/vYB0emUZtK5o+AUONoFUySRpM67iP/syXLy+s9WrrXzD9arIsAD yNJmnGWNdvJAqdbHVqkSxRWczUCnEEWPGiIwNkcHAHsbngyL9YvY3z5CYqK/GsGLfO/j jjveNUCuKc5cidG4w5aMRjZcCbAbx5OwNXteAmu3Q2Cjfoqglo0tmAsZB912uG9lOlal fHMWusbVNUmIfoQvcAprshrrSOcXSR1kLtvzPAsVSsCq5CMZWWlcESdfxOMCa1Di6hKk o01BRdtt2xU0X3TBFH4KA/+YkXGLDMYoelx4MMsy+VTAponowTzhfDY66LkepeRcfy1M DmSw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="M8Kid/46"; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-34378-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-34378-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id x24-20020a056a000bd800b006dac947cda1si10750954pfu.234.2024.01.22.16.32.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Jan 2024 16:32:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-34378-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="M8Kid/46"; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-34378-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-34378-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 9596028F780 for ; Tue, 23 Jan 2024 00:07:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7F25F65BC7; Mon, 22 Jan 2024 23:55:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="M8Kid/46" Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B00F564CCC; Mon, 22 Jan 2024 23:55:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.55.52.120 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705967752; cv=none; b=Rs9WFxW24dMEwNw4aufxAJNmVrITAJ3NM2gN22zy0UoOcEkTt9aAk2U312MUiXXL3eMfKXDvMRPuiyuWK9smRALL0J1Fd2A87rxddWPneOwHR5S4vq5uUc4wD2xhoRTMnN/CjLrKv2z1BwzAiGwBIU6+SQEN+vO32cpJW43/gn4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705967752; c=relaxed/simple; bh=mZ+MFyXcmzFyYUGrDI5n769PmLb8ZAFJWjPxQ6G7bJs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=dD0J/+1SdlF0g8E6D8Yw21MOLkrlbrbSe+59jofli/eFSjSWjTqppbTgtS+PPn1sXiigwZeka63HdxCCvAf5CLiF//egrG+nfW2pu2/E1cmyVIOMUUCCh6WBkFZNYV4S2VLYLVQNqs5UiIIpKD93xGHwv+EphkxlVX/Vf7Blos0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=M8Kid/46; arc=none smtp.client-ip=192.55.52.120 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1705967750; x=1737503750; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=mZ+MFyXcmzFyYUGrDI5n769PmLb8ZAFJWjPxQ6G7bJs=; b=M8Kid/46E80IwcSfDQ3+FqmuG90weSirYaIaChmlUJL5B7KEPmCg8znf 85Ki2bnzEYmg352j9fLqUZlTVmYc9S/Etc4Yn3R5OVOhgZnT+YuFxlNAI KrnEWT23MOKsOlpmOrGiUZtsNUAl0+7Q5eZ4vjkLmS4s+RX6h+pqpk2Fp TbKLxaHUSSbHrvjxqX70tn3Q8ZMRlI6NVcger+JCrXw4d65Ru9TwCbkeg 7DgrDGChPLHLrqHZjOFT/HfBzfRFMVWWOPpO25dLC4r8BSVAw7AhyZw+l 6HmADUPp0wmsbwqfZ0RQs7r4NcUcuXfxLevA1RX8Y134P6EUUsfc0l9tz g==; X-IronPort-AV: E=McAfee;i="6600,9927,10961"; a="400217793" X-IronPort-AV: E=Sophos;i="6.05,212,1701158400"; d="scan'208";a="400217793" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jan 2024 15:55:44 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.05,212,1701158400"; d="scan'208";a="27817925" Received: from ls.sc.intel.com (HELO localhost) ([172.25.112.31]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jan 2024 15:55:44 -0800 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 , Kai Huang , chen.bo@intel.com, hang.yuan@intel.com, tina.zhang@intel.com Subject: [PATCH v18 082/121] KVM: TDX: Implements vcpu request_immediate_exit Date: Mon, 22 Jan 2024 15:53:58 -0800 Message-Id: X-Mailer: git-send-email 2.25.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 619c5da771ee..aef78aa393ad 100644 --- a/arch/x86/kvm/vmx/main.c +++ b/arch/x86/kvm/vmx/main.c @@ -385,6 +385,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)) @@ -531,7 +541,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