powerpc/time: add API for KVM to re-arm the host timer/decrementer
authorNicholas Piggin <npiggin@gmail.com>
Tue, 23 Nov 2021 09:51:45 +0000 (19:51 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Wed, 24 Nov 2021 10:08:57 +0000 (21:08 +1100)
commit25aa145856cd0d94864bf501218be84a7c8062ae
tree55dc9efe464467fcca93073f18e7f47a66a6c8f0
parent34bf08a2079fffc7206a1ae93086ab8167e0afb6
powerpc/time: add API for KVM to re-arm the host timer/decrementer

Rather than have KVM look up the host timer and fiddle with the
irq-work internal details, have the powerpc/time.c code provide a
function for KVM to re-arm the Linux timer code when exiting a
guest.

This is implementation has an improvement over existing code of
marking a decrementer interrupt as soft-pending if a timer has
expired, rather than setting DEC to a -ve value, which tended to
cause host timers to take two interrupts (first hdec to exit the
guest, then the immediate dec).

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20211123095231.1036501-8-npiggin@gmail.com
arch/powerpc/include/asm/time.h
arch/powerpc/kernel/time.c
arch/powerpc/kvm/book3s_hv.c