]> xenbits.xensource.com Git - xen.git/commitdiff
x86/APIC: Rewrite apic_isr_read() to match apic_{tmr,irr}_read()
authorAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 23 Jul 2024 19:21:02 +0000 (20:21 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 24 Jul 2024 11:18:44 +0000 (12:18 +0100)
This allows for marginally better code generation including the use of BT
rather than SHR/TEST.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/include/asm/apic.h

index 509a6683a1d988f110846d9db4bc57ca42802041..a7798de02993338365b80c8b0f0e42988ff8778b 100644 (file)
@@ -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)