diff options
| author | Qiang Ma <maqianga@uniontech.com> | 2026-05-26 10:55:44 +0300 |
|---|---|---|
| committer | Anup Patel <anup@brainfault.org> | 2026-06-04 09:48:43 +0300 |
| commit | 6d4c17ed56201eec04247f4c72b4028cfbb0eba4 (patch) | |
| tree | 27a476bf8c6e58176d1c9fdb8061a80b339f0290 /scripts/Makefile.thinlto | |
| parent | 76ae7c7ee004b3d9d869f4d59b175ab4750db985 (diff) | |
| download | linux-6d4c17ed56201eec04247f4c72b4028cfbb0eba4.tar.xz | |
RISC-V: KVM: Fix timer state restore
The KVM_REG_RISCV_TIMER_REG(state) one-reg write passes the value
written by userspace to kvm_riscv_vcpu_timer_next_event() when
re-enabling the timer.
That value is the timer state, KVM_RISCV_TIMER_STATE_ON, not the
timer compare value. During migration or state restore, userspace
restores the compare register separately, which stores the target
cycle in t->next_cycles. Re-arming the timer with the state value
schedules the next event at cycle 1 instead of the restored compare
value, causing the virtual timer to fire too early.
Use the restored compare value from t->next_cycles when turning the
timer back on.
Fixes: 3a9f66cb25e1 ("RISC-V: KVM: Add timer functionality")
Signed-off-by: Qiang Ma <maqianga@uniontech.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
Link: https://lore.kernel.org/r/20260526075544.796396-1-maqianga@uniontech.com
Signed-off-by: Anup Patel <anup@brainfault.org>
Diffstat (limited to 'scripts/Makefile.thinlto')
0 files changed, 0 insertions, 0 deletions
