WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] x86: Define a new function gtsc_to_gtime(

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] x86: Define a new function gtsc_to_gtime()
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 23 Dec 2010 05:34:28 -0800
Delivery-date: Thu, 23 Dec 2010 05:42:07 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir@xxxxxxx>
# Date 1292410197 0
# Node ID 644c8d0d7aedbb49c587da5b812a2e76dfa5a128
# Parent  7a5ee380041707177ca9c78e800095d1f5f3d373
x86: Define a new function gtsc_to_gtime()

Define it to do the transform from guest tsc to guest time.

Fix the typo in gtime_to_gtsc() definition.

Signed-off-by: Wei Gang <gang.wei@xxxxxxxxx>
---
 xen/arch/x86/time.c        |   15 ++++++++++++---
 xen/include/asm-x86/time.h |    3 ++-
 2 files changed, 14 insertions(+), 4 deletions(-)

diff -r 7a5ee3800417 -r 644c8d0d7aed xen/arch/x86/time.c
--- a/xen/arch/x86/time.c       Wed Dec 15 10:47:05 2010 +0000
+++ b/xen/arch/x86/time.c       Wed Dec 15 10:49:57 2010 +0000
@@ -1634,11 +1634,20 @@ static void __init tsc_parse(const char 
 }
 custom_param("tsc", tsc_parse);
 
-u64 gtime_to_gtsc(struct domain *d, u64 tsc)
+u64 gtime_to_gtsc(struct domain *d, u64 time)
 {
     if ( !is_hvm_domain(d) )
-        tsc = max_t(s64, tsc - d->arch.vtsc_offset, 0);
-    return scale_delta(tsc, &d->arch.ns_to_vtsc);
+        time = max_t(s64, time - d->arch.vtsc_offset, 0);
+    return scale_delta(time, &d->arch.ns_to_vtsc);
+}
+
+u64 gtsc_to_gtime(struct domain *d, u64 tsc)
+{
+    u64 time = scale_delta(tsc, &d->arch.vtsc_to_ns);
+
+    if ( !is_hvm_domain(d) )
+        time += d->arch.vtsc_offset;
+    return time;
 }
 
 void pv_soft_rdtsc(struct vcpu *v, struct cpu_user_regs *regs, int rdtscp)
diff -r 7a5ee3800417 -r 644c8d0d7aed xen/include/asm-x86/time.h
--- a/xen/include/asm-x86/time.h        Wed Dec 15 10:47:05 2010 +0000
+++ b/xen/include/asm-x86/time.h        Wed Dec 15 10:49:57 2010 +0000
@@ -59,7 +59,8 @@ uint64_t tsc_ticks2ns(uint64_t ticks);
 uint64_t tsc_ticks2ns(uint64_t ticks);
 
 void pv_soft_rdtsc(struct vcpu *v, struct cpu_user_regs *regs, int rdtscp);
-u64 gtime_to_gtsc(struct domain *d, u64 tsc);
+u64 gtime_to_gtsc(struct domain *d, u64 time);
+u64 gtsc_to_gtime(struct domain *d, u64 tsc);
 
 void tsc_set_info(struct domain *d, uint32_t tsc_mode, uint64_t elapsed_nsec,
                   uint32_t gtsc_khz, uint32_t incarnation);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] x86: Define a new function gtsc_to_gtime(), Xen patchbot-unstable <=