mirror of
https://github.com/torvalds/linux.git
synced 2026-09-23 13:14:02 +02:00
x86/apic: Ensure ICR register write value is handled as 32 bits
The low 32-bit ICR data is prepared by __prepare_ICR(), which returns a 32-bit value. However, when this value is assigned to a new variable, it's easy to mistakenly declare that variable with a different width. To avoid this class of mistakes, use __prepare_ICR() directly as the function argument instead of storing its result in an intermediate variable. This also shaves off a bunch of lines in the code. There should be no functionality change resulting from this. Signed-off-by: Melody Wang <huibo.wang@amd.com> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Acked-by: Thomas Gleixner <tglx@kernel.org> Link: https://patch.msgid.link/20260708012117.177959-1-huibo.wang@amd.com
This commit is contained in:
parent
7bdcb5b3a9
commit
cdb4d57c3e
|
|
@ -44,9 +44,7 @@ static inline unsigned int __prepare_ICR(unsigned int shortcut, int vector,
|
|||
#ifdef CONFIG_X86_X2APIC
|
||||
static inline void __x2apic_send_IPI_dest(unsigned int apicid, int vector, unsigned int dest)
|
||||
{
|
||||
unsigned long cfg = __prepare_ICR(0, vector, dest);
|
||||
|
||||
native_x2apic_icr_write(cfg, apicid);
|
||||
native_x2apic_icr_write(__prepare_ICR(0, vector, dest), apicid);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -85,11 +85,9 @@ static void
|
|||
|
||||
static void __x2apic_send_IPI_shorthand(int vector, u32 which)
|
||||
{
|
||||
unsigned long cfg = __prepare_ICR(which, vector, 0);
|
||||
|
||||
/* x2apic MSRs are special and need a special fence: */
|
||||
weak_wrmsr_fence();
|
||||
native_x2apic_icr_write(cfg, 0);
|
||||
native_x2apic_icr_write(__prepare_ICR(which, vector, 0), 0);
|
||||
}
|
||||
|
||||
void x2apic_send_IPI_allbutself(int vector)
|
||||
|
|
|
|||
|
|
@ -243,10 +243,7 @@ static void savic_write(u32 reg, u32 data)
|
|||
|
||||
static void send_ipi(u32 dest, unsigned int vector, unsigned int dsh)
|
||||
{
|
||||
unsigned int icr_low;
|
||||
|
||||
icr_low = __prepare_ICR(dsh, vector, APIC_DEST_PHYSICAL);
|
||||
savic_icr_write(icr_low, dest);
|
||||
savic_icr_write(__prepare_ICR(dsh, vector, APIC_DEST_PHYSICAL), dest);
|
||||
}
|
||||
|
||||
static void savic_send_ipi(int cpu, int vector)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user