[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen staging-4.20] x86/apic: Fix asm() constraints in TMICT calculation



commit 207e11f04f0f26120c5aedb916cdf5aeac751e74
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Mon Apr 20 18:17:35 2026 +0100
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Tue Apr 21 13:33:30 2026 +0100

    x86/apic: Fix asm() constraints in TMICT calculation
    
    The encoded MUL is 64 bits, so writes %rdx too.  At a minimum, this needs
    expressing as a clobber.
    
    Also fix a logical disconnect between 'overflow' being the carry flag not 
the
    overflow flag.  CF and OF are always the same for MUL instructions, but 
update
    the variable name to match the flag being checked.
    
    Fixes: d5c70a51bfbe ("x86/APIC: handle overflow in TMICT calculation")
    Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
---
 xen/arch/x86/apic.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/apic.c b/xen/arch/x86/apic.c
index daf597ed44..bee3785eb0 100644
--- a/xen/arch/x86/apic.c
+++ b/xen/arch/x86/apic.c
@@ -1313,14 +1313,15 @@ int reprogram_timer(s_time_t timeout)
     if ( timeout && ((expire = timeout - NOW()) > 0) )
     {
         unsigned long product;
-        bool overflow;
+        bool carry;
 
         apic_tmict = UINT32_MAX;
         asm ( "mul %[expire]\n\t"
               ASM_FLAG_OUT(, "setc %[cf]")
-              : "=a" (product), [cf] ASM_FLAG_OUT("=@ccc", "=qm") (overflow)
-              : "0" ((unsigned long)bus_scale), [expire] "r" (expire) );
-        if ( !overflow &&
+              : "=&a" (product), [cf] ASM_FLAG_OUT("=@ccc", "=qm") (carry)
+              : "0" ((unsigned long)bus_scale), [expire] "r" (expire)
+              : "rdx" );
+        if ( !carry &&
              (product >>= BUS_SCALE_SHIFT) < apic_tmict )
             apic_tmict = product;
     }
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.