[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v10 47/59] i386/xen: handle PV timer hypercalls
From: |
David Woodhouse |
Subject: |
Re: [PATCH v10 47/59] i386/xen: handle PV timer hypercalls |
Date: |
Wed, 15 Feb 2023 14:43:20 +0100 |
User-agent: |
Evolution 3.44.4-0ubuntu1 |
On Tue, 2023-02-14 at 10:10 +0000, Paul Durrant wrote:
> 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).
I'll work this in. I should be able to exercise this with the XTF tests.
diff --git a/target/i386/kvm/xen-emu.c b/target/i386/kvm/xen-emu.c
index b537d03be7..4781b1fa97 100644
--- a/target/i386/kvm/xen-emu.c
+++ b/target/i386/kvm/xen-emu.c
@@ -1467,8 +1467,15 @@ 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]);
+ if (exit->u.hcall.longmode) {
+ return kvm_xen_hcall_set_timer_op(exit, cpu,
+ exit->u.hcall.params[0]);
+ } else {
+ /* In 32-bit mode, the 64-bit timer value is in two args. */
+ uint64_t val = ((uint64_t)exit->u.hcall.params[1]) << 32 |
+ (uint32_t)exit->u.hcall.params[0];
+ return kvm_xen_hcall_set_timer_op(exit, cpu, val);
+ }
case __HYPERVISOR_grant_table_op:
return kvm_xen_hcall_gnttab_op(exit, cpu, exit->u.hcall.params[0],
exit->u.hcall.params[1],
smime.p7s
Description: S/MIME cryptographic signature
- [PATCH v10 09/59] i386/xen: handle guest hypercalls, (continued)
- [PATCH v10 51/59] hw/xen: Add xen_xenstore device for xenstore emulation, David Woodhouse, 2023/02/01
- [PATCH v10 47/59] i386/xen: handle PV timer hypercalls, David Woodhouse, 2023/02/01
- [PATCH v10 02/59] xen: add CONFIG_XEN_BUS and CONFIG_XEN_EMU options for Xen emulation, David Woodhouse, 2023/02/01
- [PATCH v10 19/59] i386/xen: implement HYPERVISOR_hvm_op, David Woodhouse, 2023/02/01
- [PATCH v10 41/59] hw/xen: Support HVM_PARAM_CALLBACK_TYPE_PCI_INTX callback, David Woodhouse, 2023/02/01
- [PATCH v10 39/59] i386/xen: add monitor commands to test event injection, David Woodhouse, 2023/02/01
[PATCH v10 57/59] hw/xen: Support MSI mapping to PIRQ, David Woodhouse, 2023/02/01