sim-card
/
qemu
Archived
10
0
Fork 0
Commit Graph

28 Commits

Author SHA1 Message Date
Paolo Bonzini 49d4d9b63e ptimer: move declarations to ptimer.h
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-01-13 10:20:50 -06:00
Paolo Bonzini 44a9b356ad main-loop: create main-loop.h
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2011-10-21 18:14:30 +02:00
Paolo Bonzini 2ff68d0738 qemu-timer: move more stuff out of qemu-timer.c
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2011-10-21 18:14:30 +02:00
Paolo Bonzini 4260a73911 qemu-timer: use atexit for quit_timers
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2011-10-21 18:14:30 +02:00
Paolo Bonzini 946fb27c1d qemu-timer: move icount to cpus.c
None of this is needed by tools, and most of it can even be made static
inside cpus.c.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2011-10-21 18:14:30 +02:00
Paolo Bonzini dc2dfcf000 qemu-timer: more clock functions
These will be used when moving icount accounting to cpus.c.

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2011-10-21 18:14:30 +02:00
Jan Kiszka 691a0c9c9b qemu-timer: Introduce clock reset notifier
QEMU_CLOCK_HOST is based on the system time which may jump backward in
case the admin or NTP adjusts it. RTC emulations and other device models
can suffer in this case as timers will stall for the period the clock
was tuned back.

This adds a detection mechanism that checks on every host clock readout
if the new time is before the last result. If that is the case a
notifier list is informed. Device models interested in this event can
register a notifier with the clock.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-07-23 11:26:12 -05:00
Stefan Weil 2821d0f3ab qemu-timer: Remove unneeded include statement (w32)
mmsystem.h is not needed in qemu-timer.h, so remove it.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
2011-04-27 13:30:18 +02:00
Juan Quintela 852f771ec9 vmstate: port pmtimer
It was a half conversion.  Finish it.
enabled can only get values of 0, 1 or 2, was declared as an int but
sent as an unint8_t, change its type.

Signed-off-by: Juan Quintela <quintela@redhat.com>
2011-04-22 14:41:40 -05:00
Blue Swirl 70c3b5575e Move clock related functions to qemu-timer.h
Move declarations for clock related functions from sysemu.h to qemu-timer.h.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-04-15 20:14:50 +00:00
Paolo Bonzini cb842c90a4 qemu_next_deadline should not consider host-time timers
It is purely for icount-based virtual timers.  And now that we got the
code right, rename the function to clarify the intended scope.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Tested-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2011-04-15 09:27:56 +02:00
Paolo Bonzini ab33fcda9f enable vm_clock to "warp" in the iothread+icount case
The previous patch however is not enough, because if the virtual CPU
goes to sleep waiting for a future timer interrupt to wake it up, qemu
deadlocks.  The timer interrupt never comes because time is driven by
icount, but the vCPU doesn't run any insns.

You could say that VCPUs should never go to sleep in icount
mode if there is a pending vm_clock timer; rather time should
just warp to the next vm_clock event with no sleep ever taking place.
Even better, you can sleep for some time related to the
time left until the next event, to avoid that the warps are too visible
externally; for example, you could be sending network packets continously
instead of every 100ms.

This is what this patch implements.  qemu_clock_warp is called: 1)
whenever a vm_clock timer is adjusted, to ensure the warp_timer is
synchronized; 2) at strategic points in the CPU thread, to make sure
the insn counter is synchronized before the CPU starts running.
In any case, the warp_timer is disabled while the CPU is running,
because the insn counter will then be making progress on its own.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Tested-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2011-04-15 09:27:56 +02:00
Paolo Bonzini 6d5ad9bf93 remove qemu_get_clock
These patches are already not doing a great service to out-of-tree
modifications to QEMU.  However, at least we can warn them by getting
rid of the old confusing functions, or otherwise causing compilation
errors.  This patch removes qemu_get_clock; the previous one changed
qemu_new_timer's signature.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2011-03-21 09:23:23 +01:00
Paolo Bonzini 4a998740b2 add a generic scaling mechanism for timers
This enables rt_clock timers to use nanosecond resolution, just by
using the _ns functions; there is really no reason to forbid that.

Migrated timers are all using vm_clock (of course; but I checked that
anyway) so the timers in the savevm files are already in nanosecond
resolution.  So this patch makes no change to the migration format.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2011-03-21 09:23:23 +01:00
Paolo Bonzini 0ce1b9480e add more helper functions with explicit milli/nanosecond resolution
The code doesn't make much sense right now, but it will as
soon as timers will be able to scale their resolution arbitrarily.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2011-03-21 09:23:23 +01:00
malc 338b922edd Mov muldiv64 to qemu-common.h (Thus unbreaking gus)
Signed-off-by: malc <av1474@comtv.ru>
2010-10-30 01:41:01 +04:00
Blue Swirl c57c846a80 qemu-timer: move commonly used timer code to qemu-timer-common
Move timer init functions to a new file, qemu-timer-common.c. Make other
critical timer functions inlined to preserve performance in
qemu-timer.c, also move muldiv64() (used by the inline functions)
to qemu-timer.h.

Adjust block/raw-posix.c and simpletrace.c to use get_clock() directly.
Remove a similar/duplicate definition in qemu-tool.c.

Adjust hw/omap_clk.c to include qemu-timer.h because muldiv64() is used
there.

After this change, tracing can be used also for user code and
simpletrace on Win32.

Cc: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Acked-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-10-23 15:24:07 +00:00
Richard Henderson 14a6063a91 Implement cpu_get_real_ticks for Alpha.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-04-27 05:50:42 +02:00
Richard Henderson 2d8ebcf94e Fix --enable-profiler compilation.
There's a header file inclusion ordering problem between cpu-all.h
and qemu-timer.h, such that cpu_get_real_ticks is not defined when
we attempt to use it in profile_getclock.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-04-17 16:25:10 +00:00
Alexander Graf 4a9590f32e Make cpu_get_real_ticks use mfspr
PowerPC CPUs have had two ways to read the time base for quite some time now.
They provide it using the mfspr instruction or - if a special bit is set in
that opcode - using mftb. For timekeeping we're currently using mftb.

While trying to get Qemu up and running on an e500v2 system, I stumbled over
the CPU not supporting mftbu. It just throws an illegal instruction trap.

So let's read the SPR values instead. All PPC CPUs should support them anyways.

I tested this patch on an e500v2 system where it makes qemu work and on my 970MP
system with 32-bit user space where everything still works with this patch
applied.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: malc <av1474@comtv.ru>
2010-04-03 14:26:45 +04:00
Blue Swirl 29e922b61f Compile qemu-timer only once
Arrange various declarations so that also non-CPU code can access
them, adjust users.

Move CPU specific code to cpus.c.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-03-29 19:24:00 +00:00
Paolo Bonzini db1a49726c split out qemu-timer.c
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-03-17 11:16:15 -05:00
Paolo Bonzini 41c872b6bf add qemu_get_clock_ns
Some places use get_clock directly because they want to access the
rt_clock with nanosecond precision.  Add a function to do exactly that
instead of using internal interfaces.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-02-09 16:56:13 -06:00
Jan Kiszka 21d5d12bb0 Introduce QEMU_CLOCK_HOST
Despite its name QEMU_CLOCK_REALTIME is (normally) not using
CLOCK_REALTIME / the host system time as base. In order to allow also
non-trivial RTC emulations (MC146818) to follow the host time instead of
the virtual guest time, introduce the new clock type QEMU_CLOCK_HOST. It
is unconditionally based on CLOCK_REALTIME, thus will follow system time
changes of the host.

The only limitation of its current implementation is that pending
host_clock timers may not fire early if the host time is pushed forward
beyond their expiry. So far no urgent need to overcome this limitation
was identified, so it's left as simple as it is (expiry on next alarm
timer tick).

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-05 09:32:45 -05:00
Anthony Liguori 274dfed8ba Make get_ticks_per_sec() a static inline
ticks_per_sec is a constant.  There's no need to store it as a variable as it
never changes since our time is based on units.

Convert get_ticks_per_sec() to a static inline and move the constant into
qemu-timer.h.  Remove all references to QEMU_TIMER_BASE so that we consistently
use this interface.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-11 11:10:05 -05:00
Juan Quintela 6ee093c907 Unexport ticks_per_sec variable. Create get_ticks_per_sec() function
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-11 10:19:52 -05:00
Stefano Stabellini 2430ffe4c8 variable timer intervals
This patch introduces dynamic timer intervals: we slow down the refresh
rate when there in no much activity but we get back to a fast refresh
rate when the activity resume.

Please note that qemu_timer_expired is not an inline function any more
because I needed to call it from vnc.c however I don't think this change
should have any serious consequence.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Message-Id:
2009-08-10 13:05:31 -05:00
pbrook 87ecb68bdf Break up vl.h.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3674 c046a42c-6fe2-441c-8c8c-71466251a162
2007-11-17 17:14:51 +00:00