Skip to contentSkip to conversation

x86/APIC: Rewrite apic_isr_read() to match apic_{tmr,irr}_read()

PATCH In review Andrew Cooper 2 participants 2 messages Jul 23, 2024 – Jul 24, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/APIC: Rewrite apic_isr_read() to match apic_{tmr,irr}_read()

This allows for marginally better code generation including the use of BT rather than SHR/TEST.

---
CC: Jan Beulich <[email protected]>
CC: Roger Pau Monné <[email protected]>

---
 xen/arch/x86/include/asm/apic.h | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
xen/arch/x86/include/asm/apic.h +2 -3
index 1133954e5540..22d949d7bf31 100644
@@ -126,10 +126,9 @@ static inline void apic_icr_write(u32 low, u32 dest)
     }
 }
 
-static inline bool apic_isr_read(uint8_t vector)
+static inline bool apic_isr_read(unsigned int vector)
 {
-    return (apic_read(APIC_ISR + ((vector & ~0x1f) >> 1)) >>
-            (vector & 0x1f)) & 1;
+    return apic_read(APIC_ISR + (vector / 32 * 0x10)) & (1U << (vector % 32));
 }
 
 static inline bool apic_tmr_read(unsigned int vector)
Signature · 1 line
2.39.2