qemu-devel
[Top][All Lists]
Advanced

[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],

Attachment: smime.p7s
Description: S/MIME cryptographic signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]