From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KCKjo-00031l-TV for qemu-devel@nongnu.org; Fri, 27 Jun 2008 16:40:09 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KCKjn-00030w-2A for qemu-devel@nongnu.org; Fri, 27 Jun 2008 16:40:08 -0400 Received: from [199.232.76.173] (port=51157 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KCKjm-00030f-Mb for qemu-devel@nongnu.org; Fri, 27 Jun 2008 16:40:06 -0400 Received: from mx1.redhat.com ([66.187.233.31]:55950) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KCKjm-00080k-Qe for qemu-devel@nongnu.org; Fri, 27 Jun 2008 16:40:07 -0400 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id m5RKe5B5014508 for ; Fri, 27 Jun 2008 16:40:05 -0400 Received: from pobox-2.corp.redhat.com (pobox-2.corp.redhat.com [10.11.255.15]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id m5RKe5Ei005868 for ; Fri, 27 Jun 2008 16:40:05 -0400 Received: from localhost.localdomain (vpn-4-80.str.redhat.com [10.32.4.80]) by pobox-2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id m5RKdadj004563 for ; Fri, 27 Jun 2008 16:40:03 -0400 From: Glauber Costa Date: Fri, 27 Jun 2008 17:38:14 -0300 Message-Id: <1214599103-13846-12-git-send-email-gcosta@redhat.com> In-Reply-To: <1214599103-13846-11-git-send-email-gcosta@redhat.com> References: <1214599103-13846-1-git-send-email-gcosta@redhat.com> <1214599103-13846-2-git-send-email-gcosta@redhat.com> <1214599103-13846-3-git-send-email-gcosta@redhat.com> <1214599103-13846-4-git-send-email-gcosta@redhat.com> <1214599103-13846-5-git-send-email-gcosta@redhat.com> <1214599103-13846-6-git-send-email-gcosta@redhat.com> <1214599103-13846-7-git-send-email-gcosta@redhat.com> <1214599103-13846-8-git-send-email-gcosta@redhat.com> <1214599103-13846-9-git-send-email-gcosta@redhat.com> <1214599103-13846-10-git-send-email-gcosta@redhat.com> <1214599103-13846-11-git-send-email-gcosta@redhat.com> Subject: [Qemu-devel] [PATCH 11/20] remove kqemu reference from hw/pc.c Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Instead, route cpu_get_ticks through accel driver. --- accel.h | 9 +++++++++ hw/pc.c | 13 ++----------- kqemu.c | 4 ++++ 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/accel.h b/accel.h index 5395e05..9d5b3a2 100644 --- a/accel.h +++ b/accel.h @@ -7,6 +7,7 @@ typedef struct QEMUAccel { int (*profile)(CPUState *env, char *buf); void (*set_notdirty)(ram_addr_t addr); void (*modify_page)(ram_addr_t addr, int dirty_flags); + uint64_t (*get_real_ticks)(void); } QEMUAccel; extern QEMUAccel *current_accel; @@ -66,3 +67,11 @@ static inline void accel_modify_page(target_ulong addr, int dirty_flags) current_accel->modify_page(addr, dirty_flags); } +int64_t cpu_get_ticks(void); + +static inline uint64_t accel_get_real_ticks(void) +{ + if (current_accel && current_accel->get_real_ticks) + return current_accel->get_real_ticks(); + return cpu_get_ticks(); +} diff --git a/hw/pc.c b/hw/pc.c index 4c5e1c3..3d0e038 100644 --- a/hw/pc.c +++ b/hw/pc.c @@ -32,6 +32,7 @@ #include "smbus.h" #include "boards.h" #include "console.h" +#include "accel.h" /* output Bochs bios info messages */ //#define DEBUG_BIOS @@ -73,17 +74,7 @@ static void ioportF0_write(void *opaque, uint32_t addr, uint32_t data) /* TSC handling */ uint64_t cpu_get_tsc(CPUX86State *env) { - /* Note: when using kqemu, it is more logical to return the host TSC - because kqemu does not trap the RDTSC instruction for - performance reasons */ -#if USE_KQEMU - if (env->kqemu_enabled) { - return cpu_get_real_ticks(); - } else -#endif - { - return cpu_get_ticks(); - } + return accel_get_real_ticks(); } /* SMM support */ diff --git a/kqemu.c b/kqemu.c index 9c3d0c5..9184b26 100644 --- a/kqemu.c +++ b/kqemu.c @@ -444,6 +444,10 @@ QEMUAccel kqemu_accel = { .profile = kqemu_profile, .set_notdirty = kqemu_set_notdirty, .modify_page = kqemu_modify_page, + /* Note: when using kqemu, it is more logical to return the host TSC + because kqemu does not trap the RDTSC instruction for + performance reasons */ + .get_real_ticks = cpu_get_real_ticks, }; -- 1.5.5.1