From patchwork Thu Jan 25 18:21:16 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: 192223 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:e09d:b0:103:945f:af90 with SMTP id gm29csp169211dyb; Thu, 25 Jan 2024 10:24:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IGfGB918ijhxU6foGZYWLf31hP9d8Zb+XsgQeUi/OQHOtc73RMuANh/AFQRbFu+caFyuZYn X-Received: by 2002:a05:620a:4044:b0:783:24ec:a2c3 with SMTP id i4-20020a05620a404400b0078324eca2c3mr1524930qko.81.1706207048642; Thu, 25 Jan 2024 10:24:08 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706207048; cv=pass; d=google.com; s=arc-20160816; b=pmdWwjZ7K6X8h7WvNtdY4loroYq2fMKQH5pckOy/mUKeeiTvlOvrgxaUN3ZN6fS5hT ry8WhJtYO9G7b+ceeNRm3yGbl9AHa+dynt+sndXnphinyOSzNvKkcmgIXO1inVxqiNQd q2ghC9s2koJrouTizVR5Yf1Lev2XmHAJLsA7D6ByF6AFhuWITQ4EPGlTMhK6VT9N1wzF a6Y0cVENSWVBiiekQsgB1mvCdjJtkm1dXaVgxSzGc0kiw+01VK7BM6Wne/caFsWKHP1Z 493aQGqof8hKUjn7W7CgR3WEOQMjhtIPS0sVqMFRI/I1hr3hRzZJ8ZapcE4hUI9XS3y/ Mm3w== 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=NiTRbHaeiPe98aptRpNTgfQ7tum3imb+XW7jO9Mt20Q=; fh=ZIHU2tSTcl/qyH18KektoYXFhL3ka9vmyHHCONAc23s=; b=yfKlYNHbWxGBfA7YhGBYij82mWiVJgzz5PYmXGlg+eiYxgWO1R1WMtirw94ifSvbm8 e9ivrtr+E3JzB9Jj1cFkOUJDCZ+eqvyf0EaMLijuGXIRJbMxs0wzwzEI3hIFb/TWFEzC SWSK3i66Y2q8I8CLJd7zLQkrvYMb9BFshhAwdv4RlSN1ETD1c+zdaGOyIC1QiigorLq3 0MT80A2ZvxEiM5+jEuhLU5Ufv6eeP/L0wZQqlQy6/8+ZwBQKTQZbhq2f/S0uARTl1fT3 LPkJbi9UXx55+sE0Ntfjqdsz7HgOARpctdHStY5xggY6//XVTVEZh7Ov/7vnaeRlVT4B wqpA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=ZyGmv9j1; 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-39089-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-39089-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id op33-20020a05620a536100b00783964e4338si11708732qkn.51.2024.01.25.10.24.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jan 2024 10:24:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-39089-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=ZyGmv9j1; 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-39089-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-39089-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 643931C25DEE for ; Thu, 25 Jan 2024 18:24:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0B10813A273; Thu, 25 Jan 2024 18:21:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="ZyGmv9j1"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="3nySu6z2" 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 DE9571350CA; Thu, 25 Jan 2024 18:21:18 +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=1706206891; cv=none; b=qILuI6ugZNtrFvznc+X+dOnM8BiiLtlrpm0SOc1FqSsr81ERkAwoLef5iEfheJPJW1bd42iVkls1hWKktka4VrGtIoNe/jPgdR9gtlXOK0sTYGzeut//088G5f2UoGBSn89EvBFzh3mDkGWe3hxtPjRbLnd6m2aWF0SpKtOpPcI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706206891; c=relaxed/simple; bh=TnBXz3BERngDMNsMnoxzwwOzRkh9Xb+PUW9JuiiUXnc=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=SME90ctOSO/iVs/Tv6xzEK59XhXx3YjG2CXi6oFQgIJ7dN9RcwqMVTMNrHfPspbQ22RNuRNQYFB7nw3dlxaVgTO0kBussRoUxWSnV8BFqc5x9c7kDMvxRk2OWBTtnN7R3yC6rRTflhuxyCpSOr0WuHbJppj7jZGMcTRbjH3eZRo= 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=ZyGmv9j1; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=3nySu6z2; 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: Thu, 25 Jan 2024 18:21:16 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1706206877; 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=NiTRbHaeiPe98aptRpNTgfQ7tum3imb+XW7jO9Mt20Q=; b=ZyGmv9j1ltyoqdPkm94wIAByESmJyAKeeFjbc2s0LOxvqWgfpzAt8Onqx96w39JDe1xacO m8MdMRMEvqfGBwtA9qUeb0LWn4vUw1l32EHba2PqHvDwBFSjgbmbDpwcRWTWaeLv61kfnU 43uO5Rh8Nwpr9ZxH2PDCFnTmHSb1ihy97Cj//ui7C+jQZ8L4d5W7TGW73zTACm/v3De2Ai 2iY/2qbvY7VIK6I96zDB6XXp4JSvEQLzrYso/fBVOSt7GtIs9Ahs+vgoMJ/GcYFnfxdvrd tt5AV42nBtsTk+Ehd+9solW0q4aPpOE55VZ6rUfMP3qISwV5ZS2r5DGeA4Lk8Q== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1706206877; 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=NiTRbHaeiPe98aptRpNTgfQ7tum3imb+XW7jO9Mt20Q=; b=3nySu6z2foVR2aOkMdSgmrnRJjy2KEqvHij7mV3l5JOZuMc5GTWRlfocqW97blnoGBgUEM hNEOwURXoY+Kr4Ag== 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: <170620687645.398.11656973671106352681.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: 1789087762292346167 The following commit has been merged into the x86/fred branch of tip: Commit-ID: e03c54464b62a1e043df045cc428c30cf08ec236 Gitweb: https://git.kernel.org/tip/e03c54464b62a1e043df045cc428c30cf08ec236 Author: Xin Li AuthorDate: Tue, 05 Dec 2023 02:50:21 -08:00 Committer: Thomas Gleixner CommitterDate: Thu, 25 Jan 2024 19:10:33 +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); }