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

[xen stable-4.12] xen/arm: Sign extend TimerValue when computing the CompareValue



commit e8c8071f4ac2cce6f2a0ef75ea53720a7744e875
Author:     Jeff Kubascik <jeff.kubascik@xxxxxxxxxxxxxxx>
AuthorDate: Tue Jan 21 10:07:04 2020 -0500
Commit:     Stefano Stabellini <sstabellini@xxxxxxxxxx>
CommitDate: Fri Apr 10 09:34:16 2020 -0700

    xen/arm: Sign extend TimerValue when computing the CompareValue
    
    Xen will only store the CompareValue as it can be derived from the
    TimerValue (ARM DDI 0487E.a section D11.2.4):
    
      CompareValue = (Counter[63:0] + SignExtend(TimerValue))[63:0]
    
    While the TimerValue is a 32-bit signed value, our implementation
    assumed it is a 32-bit unsigned value.
    
    Signed-off-by: Jeff Kubascik <jeff.kubascik@xxxxxxxxxxxxxxx>
    Acked-by: Julien Grall <julien@xxxxxxx>
    (cherry picked from commit 3c601c5f056fba055b7a1438b84b69fc649275c3)
---
 xen/arch/arm/vtimer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/arch/arm/vtimer.c b/xen/arch/arm/vtimer.c
index b15f304c1e..2697e6a784 100644
--- a/xen/arch/arm/vtimer.c
+++ b/xen/arch/arm/vtimer.c
@@ -217,7 +217,7 @@ static bool vtimer_cntp_tval(struct cpu_user_regs *regs, 
uint32_t *r,
     }
     else
     {
-        v->arch.phys_timer.cval = cntpct + *r;
+        v->arch.phys_timer.cval = cntpct + (uint64_t)(int32_t)*r;
         if ( v->arch.phys_timer.ctl & CNTx_CTL_ENABLE )
         {
             v->arch.phys_timer.ctl &= ~CNTx_CTL_PENDING;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.12



 


Rackspace

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