]> git.ipfire.org Git - thirdparty/qemu.git/commit
hw/core/ptimer: fix timer zero period condition for freq > 1GHz
authorJianzhou Yue <JianZhou.Yue@verisilicon.com>
Fri, 9 Aug 2024 16:37:56 +0000 (17:37 +0100)
committerMichael Tokarev <mjt@tls.msk.ru>
Thu, 12 Sep 2024 06:20:33 +0000 (09:20 +0300)
commitb2ebf375c03e06321797e16b84d09768d7ce21b9
treedf64c4e9aeace70c2569ddae6fd1874a75cfda2d
parentfe547837bf9d227a1abc737ffd7aee4caa0e405d
hw/core/ptimer: fix timer zero period condition for freq > 1GHz

The real period is zero when both period and period_frac are zero.
Check the method ptimer_set_freq, if freq is larger than 1000 MHz,
the period is zero, but the period_frac is not, in this case, the
ptimer will work but the current code incorrectly recognizes that
the ptimer is disabled.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2306
Signed-off-by: JianZhou Yue <JianZhou.Yue@verisilicon.com>
Message-id: 3DA024AEA8B57545AF1B3CAA37077D0FB75E82C8@SHASXM03.verisilicon.com
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
(cherry picked from commit 446e5e8b4515e9a7be69ef6a29852975289bb6f0)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
hw/core/ptimer.c
tests/unit/ptimer-test.c