On 01/02/2023 14:31, David Woodhouse wrote:
From: Joao Martins <[email protected]>
Introduce support for one shot and periodic mode of Xen PV timers,
whereby timer interrupts come through a special virq event channel
with deadlines being set through:
1) set_timer_op hypercall (only oneshot)
2) vcpu_op hypercall for {set,stop}_{singleshot,periodic}_timer
hypercalls
Signed-off-by: Joao Martins <[email protected]>
Signed-off-by: David Woodhouse <[email protected]>
---
hw/i386/kvm/xen_evtchn.c | 31 +++++
hw/i386/kvm/xen_evtchn.h | 2 +
target/i386/cpu.h | 5 +
target/i386/kvm/xen-emu.c | 245 +++++++++++++++++++++++++++++++++++++-
target/i386/machine.c | 1 +
5 files changed, 282 insertions(+), 2 deletions(-)
[snip]
@@ -1246,6 +1466,9 @@ static bool do_kvm_xen_handle_exit(X86CPU *cpu, struct
kvm_xen_exit *exit)
}
switch (code) {
+ case __HYPERVISOR_set_timer_op:
+ return kvm_xen_hcall_set_timer_op(exit, cpu,
+ exit->u.hcall.params[0]);
There's a nasty little semantic subtlety here which has been missed...
If the guest is not in longmode then the timer value is actually split
across param[0] and param[1] (so that it is still 64-bits).
Paul