From: "Naveen N Rao (AMD)" <naveen@kernel.org>
To: <x86@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
"H. Peter Anvin" <hpa@zytor.com>, <linux-kernel@vger.kernel.org>,
Nikunj A Dadhania <nikunj@amd.com>,
Manali Shukla <manali.shukla@amd.com>,
Bharata B Rao <bharata@amd.com>
Subject: [PATCH 1/5] x86/apic: Drop AMD Extended Interrupt LVT macros
Date: Wed, 1 Apr 2026 10:26:32 +0530 [thread overview]
Message-ID: <b98d69037c0102d2ccd082a941888a689cd214c9.1775019269.git.naveen@kernel.org> (raw)
In-Reply-To: <cover.1775019269.git.naveen@kernel.org>
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) <naveen@kernel.org>
Tested-by: Manali Shukla <manali.shukla@amd.com>
---
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)
#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);
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);
}
static inline int put_eilvt(int offset)
@@ -1897,7 +1897,7 @@ static void setup_APIC_ibs(void)
if (offset < 0)
goto failed;
- 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)
offset = get_ibs_lvt_offset();
if (offset >= 0)
- setup_APIC_eilvt(offset, 0, APIC_EILVT_MSG_FIX, 1);
+ setup_APIC_eilvt(offset, 0, APIC_DELIVERY_MODE_FIXED, 1);
}
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];
static inline int eilvt_entry_is_changeable(unsigned int old, unsigned int new)
{
- return (old & APIC_EILVT_MASKED)
- || (new == APIC_EILVT_MASKED)
- || ((new & ~APIC_EILVT_MASKED) == old);
+ return (old & APIC_LVT_MASKED)
+ || (new == APIC_LVT_MASKED)
+ || ((new & ~APIC_LVT_MASKED) == old);
}
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)
rsvd = atomic_read(&eilvt_offsets[offset]);
do {
- vector = rsvd & ~APIC_EILVT_MASKED; /* 0: unassigned */
+ vector = 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));
- rsvd = new & ~APIC_EILVT_MASKED;
+ rsvd = new & ~APIC_LVT_MASKED;
if (rsvd && rsvd != 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_block *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;
return reserved;
@@ -706,11 +706,11 @@ static void smca_enable_interrupt_vectors(void)
return;
offset = (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_FIXED, 0))
data->thr_intr_en = 1;
offset = (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_FIXED, 0))
data->dfr_intr_en = 1;
}
--
2.53.0
next prev parent reply other threads:[~2026-04-01 4:58 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-01 4:56 [PATCH 0/5] Support additional AMD EILVT registers Naveen N Rao (AMD)
2026-04-01 4:56 ` Naveen N Rao (AMD) [this message]
2026-04-03 23:06 ` [tip: x86/cleanups] x86/apic: Drop AMD Extended Interrupt LVT macros tip-bot2 for Naveen N Rao (AMD)
2026-04-01 4:56 ` [PATCH 2/5] x86/apic: Drop unused AMD EILVT macros Naveen N Rao (AMD)
2026-04-01 4:56 ` [PATCH 3/5] perf/amd/ibs: Limit the max EILVT register count for AMD family 0x10 Naveen N Rao (AMD)
2026-04-01 4:56 ` [PATCH 4/5] x86/apic: Introduce a variable to track the number of EILVT registers Naveen N Rao (AMD)
2026-04-08 10:24 ` Naveen N Rao
2026-04-01 4:56 ` [PATCH 5/5] x86/apic: Drop APIC_EILVT_NR_MAX and switch to using apic_eilvt_count Naveen N Rao (AMD)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b98d69037c0102d2ccd082a941888a689cd214c9.1775019269.git.naveen@kernel.org \
--to=naveen@kernel.org \
--cc=bharata@amd.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=manali.shukla@amd.com \
--cc=mingo@redhat.com \
--cc=nikunj@amd.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®