From nobody Sun Apr 5 19:43:39 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 5AC273803FC for ; Wed, 1 Apr 2026 04:58:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775019487; cv=none; b=bKoPE19WzTONSuyi+tbKfZ9DV3TXAGG7zcXRA8O30UeoMcekWlWZMAfF10d5Y38juVAG9yc1JJXT4fnzLMtlaTMv6lWITzpqevbAtHa6ywSuI/dzBV0lKMWfLLpD9ZVskFcULXYcEXhMPDLSBz6iyvTSoWFmzzNBso84ALJLxG0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775019487; c=relaxed/simple; bh=cLKp5iF31o6Ro9r4J6GrrD52iJ3EzOROMB6g+YbPXrw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dH+eJGYhiSrj/nOVMaoi+Y46r38IBWtD9ceq/5+pRzYdkdUZ5rT8C72E6i9wwVg/qLX0JevinMqWbtPBhUghZi6ntciKZtOVHHrKwawu/OksRNQkt2a4iSY4vtvXiTO6byb23DuZ6XYB0MO/5aBPOx7A3WAKwLddLkE4nEP4S3Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=RXEFrrVw; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="RXEFrrVw" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0E5A1C116C6; Wed, 1 Apr 2026 04:58:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1775019486; bh=cLKp5iF31o6Ro9r4J6GrrD52iJ3EzOROMB6g+YbPXrw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RXEFrrVwUpbOhHnrdZL16AYo6yF5Yw5vlMFFo0+NF8rGtkyiqh5X50CI6CPL2SoOv NIKfHyjL19zDnA2bLFECDnTMG4EswSr3zj3QS96DFJagYYw6iRgQJZwwRrP0fVsXse ys4B69cwfyNREQd2a5S8ZMLl/4gOv1YYOyZpplQgqyBw9B4Zl59aDsk/qpXwp2xdZd axaXUBrH8p7E0rBjsghvO5W5espo+05EL5uBs0aypGSgoVBf6rd4cDMOaDSiY4TFNt DZo5ejI1EzTnO/XcuE4jokB/Q6vGnAcFliNjm0FIqdpWXdh4u13zL1EPfhVXrwos4c LVKsjDcS8SGSQ== From: "Naveen N Rao (AMD)" To: Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , , Nikunj A Dadhania , Manali Shukla , Bharata B Rao Subject: [PATCH 1/5] x86/apic: Drop AMD Extended Interrupt LVT macros Date: Wed, 1 Apr 2026 10:26:32 +0530 Message-ID: X-Mailer: git-send-email 2.53.0 In-Reply-To: References: 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" AMD defines Extended Interrupt Local Vector Table (EILVT) registers to allow for additional interrupt sources. While the APIC registers for those are unique to AMD, the format of those registers follows the standard LVT registers. Drop EILVT-specific macros in favor of the standard APIC LVT macros. No functional change. Signed-off-by: Naveen N Rao (AMD) Tested-by: Manali Shukla --- arch/x86/include/asm/apicdef.h | 5 ----- arch/x86/events/amd/ibs.c | 6 +++--- arch/x86/kernel/apic/apic.c | 12 ++++++------ arch/x86/kernel/cpu/mce/amd.c | 6 +++--- 4 files changed, 12 insertions(+), 17 deletions(-) diff --git a/arch/x86/include/asm/apicdef.h b/arch/x86/include/asm/apicdef.h index be39a543fbe5..f6d821656b02 100644 --- a/arch/x86/include/asm/apicdef.h +++ b/arch/x86/include/asm/apicdef.h @@ -142,11 +142,6 @@ #define APIC_EILVT_NR_AMD_10H 4 #define APIC_EILVT_NR_MAX APIC_EILVT_NR_AMD_10H #define APIC_EILVT_LVTOFF(x) (((x) >> 4) & 0xF) -#define APIC_EILVT_MSG_FIX 0x0 -#define APIC_EILVT_MSG_SMI 0x2 -#define APIC_EILVT_MSG_NMI 0x4 -#define APIC_EILVT_MSG_EXT 0x7 -#define APIC_EILVT_MASKED (1 << 16) =20 #define APIC_BASE (fix_to_virt(FIX_APIC_BASE)) #define APIC_BASE_MSR 0x800 diff --git a/arch/x86/events/amd/ibs.c b/arch/x86/events/amd/ibs.c index eeb607b84dda..e0bd5051db2a 100644 --- a/arch/x86/events/amd/ibs.c +++ b/arch/x86/events/amd/ibs.c @@ -1748,7 +1748,7 @@ EXPORT_SYMBOL(get_ibs_caps); =20 static inline int get_eilvt(int offset) { - return !setup_APIC_eilvt(offset, 0, APIC_EILVT_MSG_NMI, 1); + return !setup_APIC_eilvt(offset, 0, APIC_DELIVERY_MODE_NMI, 1); } =20 static inline int put_eilvt(int offset) @@ -1897,7 +1897,7 @@ static void setup_APIC_ibs(void) if (offset < 0) goto failed; =20 - if (!setup_APIC_eilvt(offset, 0, APIC_EILVT_MSG_NMI, 0)) + if (!setup_APIC_eilvt(offset, 0, APIC_DELIVERY_MODE_NMI, 0)) return; failed: pr_warn("perf: IBS APIC setup failed on cpu #%d\n", @@ -1910,7 +1910,7 @@ static void clear_APIC_ibs(void) =20 offset =3D get_ibs_lvt_offset(); if (offset >=3D 0) - setup_APIC_eilvt(offset, 0, APIC_EILVT_MSG_FIX, 1); + setup_APIC_eilvt(offset, 0, APIC_DELIVERY_MODE_FIXED, 1); } =20 static int x86_pmu_amd_ibs_starting_cpu(unsigned int cpu) diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c index 0c8970c4c3e3..639904911444 100644 --- a/arch/x86/kernel/apic/apic.c +++ b/arch/x86/kernel/apic/apic.c @@ -332,7 +332,7 @@ static void __setup_APIC_LVTT(unsigned int clocks, int = oneshot, int irqen) * Since the offsets must be consistent for all cores, we keep track * of the LVT offsets in software and reserve the offset for the same * vector also to be used on other cores. An offset is freed by - * setting the entry to APIC_EILVT_MASKED. + * setting the entry to APIC_LVT_MASKED. * * If the BIOS is right, there should be no conflicts. Otherwise a * "[Firmware Bug]: ..." error message is generated. However, if @@ -344,9 +344,9 @@ static atomic_t eilvt_offsets[APIC_EILVT_NR_MAX]; =20 static inline int eilvt_entry_is_changeable(unsigned int old, unsigned int= new) { - return (old & APIC_EILVT_MASKED) - || (new =3D=3D APIC_EILVT_MASKED) - || ((new & ~APIC_EILVT_MASKED) =3D=3D old); + return (old & APIC_LVT_MASKED) + || (new =3D=3D APIC_LVT_MASKED) + || ((new & ~APIC_LVT_MASKED) =3D=3D old); } =20 static unsigned int reserve_eilvt_offset(int offset, unsigned int new) @@ -358,13 +358,13 @@ static unsigned int reserve_eilvt_offset(int offset, = unsigned int new) =20 rsvd =3D atomic_read(&eilvt_offsets[offset]); do { - vector =3D rsvd & ~APIC_EILVT_MASKED; /* 0: unassigned */ + vector =3D rsvd & ~APIC_LVT_MASKED; /* 0: unassigned */ if (vector && !eilvt_entry_is_changeable(vector, new)) /* may not change if vectors are different */ return rsvd; } while (!atomic_try_cmpxchg(&eilvt_offsets[offset], &rsvd, new)); =20 - rsvd =3D new & ~APIC_EILVT_MASKED; + rsvd =3D new & ~APIC_LVT_MASKED; if (rsvd && rsvd !=3D vector) pr_info("LVT offset %d assigned for vector 0x%02x\n", offset, rsvd); diff --git a/arch/x86/kernel/cpu/mce/amd.c b/arch/x86/kernel/cpu/mce/amd.c index 146f4207a863..c82266cbd9f6 100644 --- a/arch/x86/kernel/cpu/mce/amd.c +++ b/arch/x86/kernel/cpu/mce/amd.c @@ -523,7 +523,7 @@ static void mce_threshold_block_init(struct threshold_b= lock *b, int offset) static int setup_APIC_mce_threshold(int reserved, int new) { if (reserved < 0 && !setup_APIC_eilvt(new, THRESHOLD_APIC_VECTOR, - APIC_EILVT_MSG_FIX, 0)) + APIC_DELIVERY_MODE_FIXED, 0)) return new; =20 return reserved; @@ -706,11 +706,11 @@ static void smca_enable_interrupt_vectors(void) return; =20 offset =3D (mca_intr_cfg & SMCA_THR_LVT_OFF) >> 12; - if (!setup_APIC_eilvt(offset, THRESHOLD_APIC_VECTOR, APIC_EILVT_MSG_FIX, = 0)) + if (!setup_APIC_eilvt(offset, THRESHOLD_APIC_VECTOR, APIC_DELIVERY_MODE_F= IXED, 0)) data->thr_intr_en =3D 1; =20 offset =3D (mca_intr_cfg & MASK_DEF_LVTOFF) >> 4; - if (!setup_APIC_eilvt(offset, DEFERRED_ERROR_VECTOR, APIC_EILVT_MSG_FIX, = 0)) + if (!setup_APIC_eilvt(offset, DEFERRED_ERROR_VECTOR, APIC_DELIVERY_MODE_F= IXED, 0)) data->dfr_intr_en =3D 1; } =20 --=20 2.53.0