[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH v3 06/11] hvm/hpet: In hpet_save, call hpet_get_comparator.



This changes save data to consistent/expected values.  It is not
technically required because hpet_get_comparator() will adjust from
any value to the correct value. And hpet_get_comparator() is
effectivly called in hpet_load via hpet_set_timer.

However it does look strange to people that the output from
xen-hvmctx for the comparator values do not change when the master
clock does.

The software-developers-hpet-spec-1-0a.pdf says that the comparator
will allways be greater than master clock for a periodic timer.

Signed-off-by: Don Slutz <dslutz@xxxxxxxxxxx>
---
v3:
  Better commit message.
  Reword subject from "hvm/hpet: Call hpet_get_comparator during hpet_save."

 xen/arch/x86/hvm/hpet.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/xen/arch/x86/hvm/hpet.c b/xen/arch/x86/hvm/hpet.c
index 0789947..fccc77c 100644
--- a/xen/arch/x86/hvm/hpet.c
+++ b/xen/arch/x86/hvm/hpet.c
@@ -495,6 +495,7 @@ static int hpet_save(struct domain *d, hvm_domain_context_t 
*h)
 {
     HPETState *hp = domain_vhpet(d);
     int rc;
+    uint64_t guest_time;
 
     spin_lock(&hp->lock);
 
@@ -524,6 +525,12 @@ static int hpet_save(struct domain *d, 
hvm_domain_context_t *h)
         C(period[1]);
         C(period[2]);
 #undef C
+        /* read the comparator to get it updated so hpet_save will
+         * return the expected value. */
+        guest_time = hp->hpet.mc64 - hp->mc_offset;
+        hpet_get_comparator(hp, 0, guest_time);
+        hpet_get_comparator(hp, 1, guest_time);
+        hpet_get_comparator(hp, 2, guest_time);
         /* save the 64 bit comparator in the 64 bit timer[n].cmp field
          * regardless of whether or not the timer is in 32 bit mode. */
         rec->timers[0].cmp = hp->hpet.comparator64[0];
-- 
1.8.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.