From patchwork Wed Jan 31 21:14:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 194940 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:106:209c:c626 with SMTP id mn5csp29859dyc; Wed, 31 Jan 2024 13:17:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IGd0gP5vw+98CGnhp6n9HNDu5viPuXKL78mMGG4+U69ZD4jg/KAQ1LimoUMvxhJeyfYoiPG X-Received: by 2002:aa7:d0c9:0:b0:55e:f4a6:a915 with SMTP id u9-20020aa7d0c9000000b0055ef4a6a915mr1956480edo.11.1706735852227; Wed, 31 Jan 2024 13:17:32 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706735852; cv=pass; d=google.com; s=arc-20160816; b=yAe5opHSovTjSS+2f34IVL6h7GNyeeCS+zQayk70SyvxngiJVHLehHqgaAtKXH7n6Z gUIpikYvvBj+18F5VlmYG4iX1fRRXWSa9vGlsEcs/R7kYcRsUIQPQy9jV0RLi12lNkWg gdBGuyf3YPl+62nlPX9wB+uLr02F+lfv6Vpe7dxkH7kGmghBnDka1tckB7pzmVCr+sJ6 eqzr5kjHxX1J4NgXBZSs8/WLwQfAPF7c+8UiIxCnaKf5FMBshGzWVzV5XKMTDxG21S55 qH9sWfBwnKjIZ4itKT+ZYI1spTov1QXw5KyquDANuJ00wB18zZheNrKHvFHWJyYahtS9 Sc3Q== 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=e8KOhM5Qjx/tbTGBUaxGTsl3zbsHtEdTk0xpND8kSrA=; fh=YDl4diKnNRql92J1B+lrmFwZSs7i+IuirdC7uBskNkY=; b=PGoHY/kXvBM4iZAabERqlMoEpmEqYt6hLy6Su+yLHI+TQGfE1xlEmuFxHGgseRPfal a5XddtREa6y5rt3gf+ubnYCXLm72YieWa2P+xa7Zop3d8WuTrEbAJXbuVRzgF4k4ZNHf Bdn65qVGGRDmZKeKap7eTht3xRi6jz6zaCn6EScO1O4KVCVsC3ap6P6pVip4vAmuNw57 BBKbAZf3ZvShW4SqzTDDqITVZN3XN3iT9g/jsQG3MDPdxPFQ6n2+/R0P7VIASoCqLH8p XxTmv0/MWjA3EUS2FnyyO6MW3b9tvGVwH1NDz8EiHIscL08yjQ9hekp9LcvFtP0Aew+f kcAA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=mg1HOa2S; dkim=neutral (no key) header.i=@linutronix.de; 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-47120-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-47120-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de X-Forwarded-Encrypted: i=1; AJvYcCUvi9amAB4UpcZZo1JeyRky47KLCIFVDXbhiBMGc3w53FCUTZFUUaLGR3G3QSJjusGUxzpy5CvPpmrprM8/25sBp56FFw== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id ig2-20020a056402458200b0055ed779088asi4264586edb.143.2024.01.31.13.17.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 13:17:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-47120-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=mg1HOa2S; dkim=neutral (no key) header.i=@linutronix.de; 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-47120-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-47120-ouuuleilei=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 am.mirrors.kernel.org (Postfix) with ESMTPS id D54A21F22DA6 for ; Wed, 31 Jan 2024 21:16:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 41C843A1D1; Wed, 31 Jan 2024 21:14:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="mg1HOa2S"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="bs8HIRoi" 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 5841E39AC9; Wed, 31 Jan 2024 21:14:43 +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=1706735685; cv=none; b=jWaGXBIX3UNnc4/I7+8OUUdehCg9rv87Qg0UTVCGfWmOFQ3RSrzsjCfj4QPADCvZK5JT1wqU1/IdIQj/TDVENl18VKDBfN3NC3zv5wYogmkC0ikwdPBYKc9IkFdTz74QNqTb+R2Tbr3dheJWMtTIISyERaj2rf3CNLQ+wgj7sKQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706735685; c=relaxed/simple; bh=2kI0pp2ebvjx3Net6f5BaCa+zCRiOI0i3Dcvsje3BWQ=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=gomutT10SUKKXgmXAZzPNpiOCjOnJBL+SYp9IUffO5BMFMvvqNifmBIWRpY8PqRTMgywaZmcUF2CmCZ19cNcMvhyTesYBZVOvl87bKtP/48BLtAQreKDuQ+1+jXA5JU8Pn1UGm/gO1Sp7UdNQIwMIgJXHl5IG3BhxsrgXGQPyho= 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=mg1HOa2S; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=bs8HIRoi; 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 21:14:40 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1706735681; 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=e8KOhM5Qjx/tbTGBUaxGTsl3zbsHtEdTk0xpND8kSrA=; b=mg1HOa2SRNthC+jc56+zq6XTZz6oh66RIhDbNOv7X+f5oPTW5Ec3LL738tWZQU+/TcuBAV UUeEfeDUvI3n0JtgkLYzLtyz9bWExdH9dtlwguzck3GVDEWER+ODHLlpVJK/I346vtIMRT WI+G6oybZB2ZSNjQoSFCMZDeeQIEh2DMjK/MaSfKh3ivk1vIhbycr/7k89HQ7JsK/sQUMW n8n/5D20ywxf9R9uFVQ/UcADMxM2jRaTvDUaJhOJnFrqhO1bpSA8BfiUudofLm9mLE9Bo5 DRNvOqLSVmMlg46+c4UzP/dOrFB7rbhHYNcJlNQfZYZdww/ITogUqeYRj+LfHA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1706735681; 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=e8KOhM5Qjx/tbTGBUaxGTsl3zbsHtEdTk0xpND8kSrA=; b=bs8HIRoiwzPZX0/YF9BG/2ThgIhD6EBia5Yakt1teeAZ4U1gX4VPJCyE2WZL93Y+7kXsM5 3hV70CDKrjiYqoBQ== 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 , "Borislav Petkov (AMD)" , 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: <170673568079.398.1185799126657342768.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784440859094385439 X-GMAIL-MSGID: 1789642252932725010 The following commit has been merged into the x86/fred branch of tip: Commit-ID: 70d0fe5d0923abfb28c26e71171944f4801f9f38 Gitweb: https://git.kernel.org/tip/70d0fe5d0923abfb28c26e71171944f4801f9f38 Author: Xin Li AuthorDate: Tue, 05 Dec 2023 02:50:21 -08:00 Committer: Borislav Petkov (AMD) CommitterDate: Wed, 31 Jan 2024 22:03:20 +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 Signed-off-by: Borislav Petkov (AMD) 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); }