From nobody Tue Dec 2 01:26:24 2025 Received: from shelob.surriel.com (shelob.surriel.com [96.67.55.147]) (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 E56222E336F for ; Fri, 21 Nov 2025 18:55:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=96.67.55.147 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763751344; cv=none; b=VVR64+cygeW1tZvmltLBFlLKcVuJO3wGT4BHDdM7gB5oYGw6XjsV1EInALkUsr2IZ9bBlU69r+X1c/FPSewkkjQJWGa+VmxoqM74eHYDNvjCaXi+JQsUhdX14Yvo4Fe55nrOtOfbN1u3ZxSnJUK0EqOZizNemH1Mhfy7xcFAl3g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763751344; c=relaxed/simple; bh=9176J17qEMihlqFzpZ3NQ0m9ZU+eUwlm7YbfN6XlV8w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=D0KtrYPtH04FFA/em0L7xFu3fwJ6rTr8rNkVulvlLojFZJ0m+z7ssSmKEF/vUsJFFc0jS4R6RpgQXxukbzC4F411T8FNtLsdHjAaRXJvwTApjAJ+9wCYgupR882V7isvCEUKKnwOB/RLpX+a4DvIJiFFADUxGXu+8IYou6F8g2g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=surriel.com; spf=pass smtp.mailfrom=surriel.com; dkim=pass (2048-bit key) header.d=surriel.com header.i=@surriel.com header.b=V2cZGPcn; arc=none smtp.client-ip=96.67.55.147 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=surriel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=surriel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=surriel.com header.i=@surriel.com header.b="V2cZGPcn" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=surriel.com ; s=mail; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=QZeXt++V+t0s1eS9v+LvMKqHQ5JNcRneWedbaF2UH6k=; b=V2cZGPcnVGCAfaYJVus1PjGNkk 1LgJTD4zRtBrvfL6GIFzkTlh3Cn4EdjH0th5asMeRZs/L2eu2bKiYnflBqvDu4Wfn3WDUTuD0p/5+ cTp0PDC+HmNQmnQAjId5p9phZjPoJvqm5qu+z/2X2EIlLDftXuXm2uRBbTSF4Qo/HnJL0SZeaMoLy st+YhpzVoaY8os/mh3R43kh5YHypIcnUpa7UnIi4ja5N4DDMk8KeyHi+CakKAjYIu2ycB0Wu3u7Zf 7F7son2vDjjhVS70376Lt6lIFmdKStihMwmxt5NmamnCVn6hcgUyr4XQZl0wOPh2pHCcEg6U/Q0PH 4qbTRr5w==; Received: from fangorn.home.surriel.com ([10.0.13.7]) by shelob.surriel.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.97.1) (envelope-from ) id 1vMWI9-000000003i4-1VoD; Fri, 21 Nov 2025 13:55:34 -0500 From: Rik van Riel To: linux-kernel@vger.kernel.org Cc: linux-mm@kvack.org, x86@kernel.org, dave.hansen@linux.intel.com, peterz@infradead.org, kernel-team@meta.com, bp@alien8.de, Yu-cheng Yu , Rik van Riel Subject: [RFC v5 4/8] x86/apic: Introduce Remote Action Request Operations Date: Fri, 21 Nov 2025 13:54:25 -0500 Message-ID: <20251121185530.21876-5-riel@surriel.com> X-Mailer: git-send-email 2.51.1 In-Reply-To: <20251121185530.21876-1-riel@surriel.com> References: <20251121185530.21876-1-riel@surriel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Yu-cheng Yu RAR TLB flushing is started by sending a command to the APIC. This patch adds Remote Action Request commands. Because RAR_VECTOR is hardcoded at 0xe0, POSTED_MSI_NOTIFICATION_VECTOR has to be lowered to 0xdf, reducing the number of available vectors by 13. [riel: refactor after 6 years of changes, lower POSTED_MSI_NOTIFICATION_VEC= TOR] Signed-off-by: Yu-cheng Yu Signed-off-by: Rik van Riel --- arch/x86/include/asm/apicdef.h | 1 + arch/x86/include/asm/irq_vectors.h | 7 ++++++- arch/x86/include/asm/smp.h | 1 + arch/x86/kernel/apic/ipi.c | 5 +++++ arch/x86/kernel/apic/local.h | 3 +++ 5 files changed, 16 insertions(+), 1 deletion(-) diff --git a/arch/x86/include/asm/apicdef.h b/arch/x86/include/asm/apicdef.h index be39a543fbe5..1b0bf20f0c7d 100644 --- a/arch/x86/include/asm/apicdef.h +++ b/arch/x86/include/asm/apicdef.h @@ -92,6 +92,7 @@ #define APIC_DM_LOWEST 0x00100 #define APIC_DM_SMI 0x00200 #define APIC_DM_REMRD 0x00300 +#define APIC_DM_RAR 0x00300 #define APIC_DM_NMI 0x00400 #define APIC_DM_INIT 0x00500 #define APIC_DM_STARTUP 0x00600 diff --git a/arch/x86/include/asm/irq_vectors.h b/arch/x86/include/asm/irq_= vectors.h index 47051871b436..52a0cf56562a 100644 --- a/arch/x86/include/asm/irq_vectors.h +++ b/arch/x86/include/asm/irq_vectors.h @@ -97,11 +97,16 @@ =20 #define LOCAL_TIMER_VECTOR 0xec =20 +/* + * RAR (remote action request) TLB flush + */ +#define RAR_VECTOR 0xe0 + /* * Posted interrupt notification vector for all device MSIs delivered to * the host kernel. */ -#define POSTED_MSI_NOTIFICATION_VECTOR 0xeb +#define POSTED_MSI_NOTIFICATION_VECTOR 0xdf =20 #define NR_VECTORS 256 =20 diff --git a/arch/x86/include/asm/smp.h b/arch/x86/include/asm/smp.h index 84951572ab81..d3ef57e60360 100644 --- a/arch/x86/include/asm/smp.h +++ b/arch/x86/include/asm/smp.h @@ -123,6 +123,7 @@ void __noreturn mwait_play_dead(unsigned int eax_hint); void native_smp_send_reschedule(int cpu); void native_send_call_func_ipi(const struct cpumask *mask); void native_send_call_func_single_ipi(int cpu); +void native_send_rar_ipi(const struct cpumask *mask); =20 asmlinkage __visible void smp_reboot_interrupt(void); __visible void smp_reschedule_interrupt(struct pt_regs *regs); diff --git a/arch/x86/kernel/apic/ipi.c b/arch/x86/kernel/apic/ipi.c index 98a57cb4aa86..9983c42619ef 100644 --- a/arch/x86/kernel/apic/ipi.c +++ b/arch/x86/kernel/apic/ipi.c @@ -106,6 +106,11 @@ void apic_send_nmi_to_offline_cpu(unsigned int cpu) return; apic->send_IPI(cpu, NMI_VECTOR); } + +void native_send_rar_ipi(const struct cpumask *mask) +{ + __apic_send_IPI_mask(mask, RAR_VECTOR); +} #endif /* CONFIG_SMP */ =20 static inline int __prepare_ICR2(unsigned int mask) diff --git a/arch/x86/kernel/apic/local.h b/arch/x86/kernel/apic/local.h index bdcf609eb283..833669174267 100644 --- a/arch/x86/kernel/apic/local.h +++ b/arch/x86/kernel/apic/local.h @@ -38,6 +38,9 @@ static inline unsigned int __prepare_ICR(unsigned int sho= rtcut, int vector, case NMI_VECTOR: icr |=3D APIC_DM_NMI; break; + case RAR_VECTOR: + icr |=3D APIC_DM_RAR; + break; } return icr; } --=20 2.51.1