Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp2612134rdg; Mon, 16 Oct 2023 09:21:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFMYsrlJn4M26dTUNsYhQ7bB7Mf5lg+asxkkWBHAsN20wpDs3MmLTfou0yWPqs8v8tc0ypx X-Received: by 2002:a17:90b:3b90:b0:27d:2108:af18 with SMTP id pc16-20020a17090b3b9000b0027d2108af18mr11872198pjb.25.1697473304867; Mon, 16 Oct 2023 09:21:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697473304; cv=none; d=google.com; s=arc-20160816; b=sN1XDyCXBB6Rvvn5jGyWRL+/m5ocVRfBOB0Cv1RlwQXojo8wmf7NNI9fMiEZkHFFJa ZTRfK6X/utFCAUUtWyI6GbniKKalDj1d4T0T/lQGqBBicAnlxVBDgSzAYIj6ZU2C23e3 PhPbfc5kQ+ZE/lhC1EoCxFxc7ZbisPNUP4ME4GlMl3QUr6C/AnuWk0BUGK+aNKZg1gN6 0SkisBWGqRt49dH1RnbXw3UO6TWrLTnRX3FIf7L9gJzrjYT9XCxDbaOrQVIHCmiGRxuJ 33DcDFLrAc93HWba47ukqrlbR0ozzRa8P2XADZYX+U3anAgvH2SENyl/DE+vdSiMfzfW ryiw== 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=J9WUiRSFHm2vIj7XUbFSXcw8PxeMSWyHIOMUp6vmVQM=; fh=lRdU2Q/1zx5DcPdZuWBjshA5VT5Oc9cEhB1tCFiV0Nw=; b=dB3Fw3XG0nmIBUPLfzCGBaSZtrzFgbXEvr78N1EXE+9ugXrkEH0L4n7CjjIV+H7ocq /TYusnpdPa4SVq0cY0OWvxW7u5PLTokckkJ9IrPqCtkuLrlpnyOwVzYQHiMtcsHJQ5+a s+V8wO7llMS9NM6lrkSbadF5i2Big02j54eraJzkYTKN1kaxiAVJ4/A5PfSxY8NmNbog +Be4HpjQnFF031p8SN/w9gPtBloCRwNy5mOwihLGnBBmeewODZa5icZ3QGbDh+HKlRAC yQxNYf9YbHO3Sq6XUQDBuMnCMVEP/ct0ZOPL0iEwYfZEWrPhO2xCmj9gTvbchiohctqk tyPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Gn7FYNxF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id o18-20020a17090ac71200b00274e16f797csi6365619pjt.20.2023.10.16.09.21.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 09:21:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Gn7FYNxF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 696D28022C8D; Mon, 16 Oct 2023 09:21:30 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233757AbjJPQUD (ORCPT + 99 others); Mon, 16 Oct 2023 12:20:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233980AbjJPQTx (ORCPT ); Mon, 16 Oct 2023 12:19:53 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 75E491FE6; Mon, 16 Oct 2023 09:19: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=1697473153; x=1729009153; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=/ayiIuFTfj+8avzZVaM7u+DM7LRJDLMFcgXrJZz/0uo=; b=Gn7FYNxFTM2VIl8djOlzuei2LG5k+E8cBuOhUQT5tdWVgh0emxnuxvsu btWYwtVkXpqae9MCIo7bNXo3IWHuXiVpNGFgVd66xEf8U6nf87ZKyKbpP O2947I8ZB5Pdsit/9q+u00QRiZnY+bBd6J/+T6nO/n7HMJKTGQ1uR1q/e HMswGGKP7NQcF+u2q3/fiS/l9VHmubapQ43Oa+9zFKUvRJLWCHz8uOBSX wsU4s51tj1q47j3fE4vKK757lUztfYeTi+y26dqK5+fMvfOEaU9ET+qUu eygGOGI+Dzb+IpmJ/5Y+uzA9xplj30cSw92r6taa/KlXFMBDCXekBmynX Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10865"; a="364921950" X-IronPort-AV: E=Sophos;i="6.03,229,1694761200"; d="scan'208";a="364921950" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Oct 2023 09:15:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10865"; a="846448238" X-IronPort-AV: E=Sophos;i="6.03,229,1694761200"; d="scan'208";a="846448238" Received: from ls.sc.intel.com (HELO localhost) ([172.25.112.31]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Oct 2023 09:15:56 -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 , chen.bo@intel.com, hang.yuan@intel.com, tina.zhang@intel.com Subject: [PATCH v16 077/116] KVM: TDX: Implements vcpu request_immediate_exit Date: Mon, 16 Oct 2023 09:14:29 -0700 Message-Id: <2f3eab559dcc172665bacc1a54647c7e827824e0.1697471314.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=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Mon, 16 Oct 2023 09:21:30 -0700 (PDT) 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 37d28ee08c79..0ce9578a1453 100644 --- a/arch/x86/kvm/vmx/main.c +++ b/arch/x86/kvm/vmx/main.c @@ -381,6 +381,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)) @@ -527,7 +537,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