Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp1493895rdb; Tue, 30 Jan 2024 23:26:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IEa7sOFTAauR05ezdNP4/Y1CiyO3mWzLdMUg4vh94UZdwGB8skhzpSDN81v4lX19RCPhuYP X-Received: by 2002:aa7:9819:0:b0:6de:1e23:d9bc with SMTP id e25-20020aa79819000000b006de1e23d9bcmr753087pfl.22.1706686014748; Tue, 30 Jan 2024 23:26:54 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706686014; cv=pass; d=google.com; s=arc-20160816; b=UGmYCot3N1pcK/ITEWX+Jp3FHfT5YF1JwU0QbU7RwgQmx8P9VzEspZ0Xv4lLOh9x15 sYKQIMo5rffq5gzdw5RTvl04wSaESeamzu+P9xKwUvvToopOGKtF956nWWDBuDzTWK0+ bO/bWixw7Kf4BUmupXAJymw8mVIef0hsspjQAzdabT/XbdOAvi66IORbtCrcYO2KqT8R vxJfIXP/sX1K16CE9fsHi4WJm11ywWJ8zHr9sSKQNf7uNnwgFarrchFnhlhVrG5KyBAU nYO/b2vuFO76d8zRMudMYh4dYNYwHiLvx3XRQ2POOVmLmZ5wXbq6EaZZJg5QbtB114SP ch8Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:precedence:robot-unsubscribe:robot-id :message-id:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:references:in-reply-to:cc:subject:to:reply-to:sender :from:dkim-signature:dkim-signature:date; bh=oDYbd798ov+M8ywveRAtGm+Wc+Gpc+zo1pxiYqd06oU=; fh=ZpLcC8rfsgf79rR12tsFV3q3ZhcWIMUtmX+Djj3MGmw=; b=c7AR83P/QI6+2qXqw5gLcKX0iMtV57pPZxsl4vZP51HqYvcLzBA4p25+m5iaWyVI6+ NVJAYeQjpiC9LVQRiHIIS8mxNRjOEQBs9iR7NZ+t+/xMe0HSFd7c2PxkrgQy8SB+IzC6 hHmIj5dRXxKKGeZmSolClMOdYi6gHZyNBOmTyPyB7380R1qHAr+34UJYO2OfCU3KGhA0 xlbXEqN/UzdOhmJhSukmBMV9ojDxmkmdNj7pghoS+iEvUm1Be1eRrYEiBRLE0Ywf9nem khyQIYFDrn9Lnr24H6f/m+ItfE+YJifT4b3tAOH/Gd4f2thrPmZHUGWVb9v8IcOzvdJi h2tg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=rWsG1Bwn; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-45893-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45893-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de X-Forwarded-Encrypted: i=1; AJvYcCVmjZmijsjQbQTwBPYd/g33BhG4ULt9h1l4rJniMI3/KNtOnunP919yfhX7ijPfqWD9l9y1itoIhwbXSHI0e6M94UCv/Cz9Hrft2b3kZQ== Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id l38-20020a635b66000000b005cee03a5355si8560245pgm.518.2024.01.30.23.26.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 23:26:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-45893-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=rWsG1Bwn; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-45893-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45893-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id B65EAB26249 for ; Wed, 31 Jan 2024 07:21:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5ABDE5647C; Wed, 31 Jan 2024 07:21:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="rWsG1Bwn"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="bBmmyCPC" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 DA3B750A66; Wed, 31 Jan 2024 07:21:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706685672; cv=none; b=X0l6Upa58yshCIeSNdOt0g3iYKJPlDMzQQjl4z7DLlN+0jBubCDaDsJKptnuQw9jMSBfjjchCTpvgeMETzFceaOGitdRWO+nSFQPEeUpLDc8YpDSFYiuFGOyQkJPeQtDunitYvukZi5KJ4ARI6TFdcWWqXhI2L1m9nWWHfIlZd4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706685672; c=relaxed/simple; bh=Ib8EDCdWYEC9JF0IKndv0P+RWHf6Y87zHotUI4HxDP0=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=GOljz5xX8O3XYyrd4nBA/+dX4a+5g9ngAnTYrCcsyVherBAGp++PKP+Y+JNUg+nFbmAAWq2X2vBvuIIygWV6x+Zk0Y0C531Ilsa+H0RPYOB983rTp0jyF+bEJdTZ1w4WFeVFmK82jQd3OCKduyXUIQbzN9ip6QsVykzL+rH1LxM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=rWsG1Bwn; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=bBmmyCPC; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Date: Wed, 31 Jan 2024 07:21:08 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1706685669; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oDYbd798ov+M8ywveRAtGm+Wc+Gpc+zo1pxiYqd06oU=; b=rWsG1BwnQvEqvGj18CHmrkyG2BdFZ8dwQdR2KEy6OjXD0+YaBQ9ae3uEBYkoNwcZZilKqb 0xTCgAEgDdz9ixXFmHm5M3mY9jxtlv0xrNv9NBkIcvk1rcpLnH+Giqn1XuRIpy2Nj/xTbf BI+Q1YA+IMbTX7BTiIEhj9pMSFsLhLVTXCE3AQtQ3wnaCckbgMm19kU/nwIbr6qcvRi2jj ecVbCcAeBGnb+fjV47U1Q22FZo2Bo9aE1B2vuZFBlf2qPS6TWb2cTA7lNtbu4Nrnt9v+Ja cyPmJugLvq6BB3OfaM6KjLnbH7FffzI2DEGeb4JKGgqpzsRS8tw2f0V6CBNRBA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1706685669; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oDYbd798ov+M8ywveRAtGm+Wc+Gpc+zo1pxiYqd06oU=; b=bBmmyCPCbGakmkY2VFZjYAT62aDZn5DDAB1ajXxCMGO948fP8sJA3B+PHwZ5NwnryR4B71 VrNemdUu1lVMqvBQ== From: "tip-bot2 for Xin Li" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/fred] KVM: VMX: Call fred_entry_from_kvm() for IRQ/NMI handling Cc: Xin Li , Thomas Gleixner , Shan Kang , Paolo Bonzini , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20231205105030.8698-33-xin3.li@intel.com> References: <20231205105030.8698-33-xin3.li@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <170668566833.398.2243513309354224240.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit The following commit has been merged into the x86/fred branch of tip: Commit-ID: cb5429aaa0c53d60414a08fb40f8d15d748c4cda Gitweb: https://git.kernel.org/tip/cb5429aaa0c53d60414a08fb40f8d15d748c4cda Author: Xin Li AuthorDate: Tue, 05 Dec 2023 02:50:21 -08:00 Committer: Borislav Petkov (AMD) CommitterDate: Tue, 30 Jan 2024 18:20:36 +01:00 KVM: VMX: Call fred_entry_from_kvm() for IRQ/NMI handling When FRED is enabled, call fred_entry_from_kvm() to handle IRQ/NMI in IRQ/NMI induced VM exits. Signed-off-by: Xin Li Signed-off-by: Thomas Gleixner Tested-by: Shan Kang Acked-by: Paolo Bonzini Link: https://lore.kernel.org/r/20231205105030.8698-33-xin3.li@intel.com --- arch/x86/kvm/vmx/vmx.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c index e262bc2..cce92f7 100644 --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -38,6 +38,7 @@ #include #include #include +#include #include #include #include @@ -6960,14 +6961,16 @@ static void handle_external_interrupt_irqoff(struct kvm_vcpu *vcpu) { u32 intr_info = vmx_get_intr_info(vcpu); unsigned int vector = intr_info & INTR_INFO_VECTOR_MASK; - gate_desc *desc = (gate_desc *)host_idt_base + vector; if (KVM_BUG(!is_external_intr(intr_info), vcpu->kvm, "unexpected VM-Exit interrupt info: 0x%x", intr_info)) return; kvm_before_interrupt(vcpu, KVM_HANDLING_IRQ); - vmx_do_interrupt_irqoff(gate_offset(desc)); + if (cpu_feature_enabled(X86_FEATURE_FRED)) + fred_entry_from_kvm(EVENT_TYPE_EXTINT, vector); + else + vmx_do_interrupt_irqoff(gate_offset((gate_desc *)host_idt_base + vector)); kvm_after_interrupt(vcpu); vcpu->arch.at_instruction_boundary = true; @@ -7260,7 +7263,10 @@ static noinstr void vmx_vcpu_enter_exit(struct kvm_vcpu *vcpu, if ((u16)vmx->exit_reason.basic == EXIT_REASON_EXCEPTION_NMI && is_nmi(vmx_get_intr_info(vcpu))) { kvm_before_interrupt(vcpu, KVM_HANDLING_NMI); - vmx_do_nmi_irqoff(); + if (cpu_feature_enabled(X86_FEATURE_FRED)) + fred_entry_from_kvm(EVENT_TYPE_NMI, NMI_VECTOR); + else + vmx_do_nmi_irqoff(); kvm_after_interrupt(vcpu); }