summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2014-07-18 14:46:53 +0100
committerPeter Maydell <peter.maydell@linaro.org>2014-07-18 14:46:53 +0100
commit50a2c45da92383138e0d3f22952f3813814e18b3 (patch)
treef9ec964cc6ccba53aa0c372a2ffd9f44d6811c66 /hw
parente0097ea371a647651f6c89c3091c4962fdde26fd (diff)
parentfa666c10f2f3e15685ff88abd3bc433ddce012d6 (diff)
downloadqemu-50a2c45da92383138e0d3f22952f3813814e18b3.tar.gz
Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging
Andreas's fixes to --enable-modules, two 2.1 regression fixes, and a new qtest. Michael sent a pull request of his own, so I dropped the vhost changes. # gpg: Signature made Fri 18 Jul 2014 14:30:34 BST using RSA key ID 9B4D86F2 # gpg: Can't check signature: public key not found * remotes/bonzini/tags/for-upstream: Revert "kvmclock: Ensure time in migration never goes backward" Revert "kvmclock: Ensure proper env->tsc value for kvmclock_current_nsec calculation" module: Don't complain when a module is absent module: Simplify module_load() qtest: new test for wdt_ib700 target-i386: Allow execute from user mode when SMEP is enabled. Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw')
-rw-r--r--hw/i386/kvm/clock.c52
1 files changed, 0 insertions, 52 deletions
diff --git a/hw/i386/kvm/clock.c b/hw/i386/kvm/clock.c
index 272a88acb5..07b9c0e581 100644
--- a/hw/i386/kvm/clock.c
+++ b/hw/i386/kvm/clock.c
@@ -14,10 +14,8 @@
*/
#include "qemu-common.h"
-#include "qemu/host-utils.h"
#include "sysemu/sysemu.h"
#include "sysemu/kvm.h"
-#include "sysemu/cpus.h"
#include "hw/sysbus.h"
#include "hw/kvm/clock.h"
@@ -36,48 +34,6 @@ typedef struct KVMClockState {
bool clock_valid;
} KVMClockState;
-struct pvclock_vcpu_time_info {
- uint32_t version;
- uint32_t pad0;
- uint64_t tsc_timestamp;
- uint64_t system_time;
- uint32_t tsc_to_system_mul;
- int8_t tsc_shift;
- uint8_t flags;
- uint8_t pad[2];
-} __attribute__((__packed__)); /* 32 bytes */
-
-static uint64_t kvmclock_current_nsec(KVMClockState *s)
-{
- CPUState *cpu = first_cpu;
- CPUX86State *env = cpu->env_ptr;
- hwaddr kvmclock_struct_pa = env->system_time_msr & ~1ULL;
- uint64_t migration_tsc = env->tsc;
- struct pvclock_vcpu_time_info time;
- uint64_t delta;
- uint64_t nsec_lo;
- uint64_t nsec_hi;
- uint64_t nsec;
-
- if (!(env->system_time_msr & 1ULL)) {
- /* KVM clock not active */
- return 0;
- }
-
- cpu_physical_memory_read(kvmclock_struct_pa, &time, sizeof(time));
-
- assert(time.tsc_timestamp <= migration_tsc);
- delta = migration_tsc - time.tsc_timestamp;
- if (time.tsc_shift < 0) {
- delta >>= -time.tsc_shift;
- } else {
- delta <<= time.tsc_shift;
- }
-
- mulu64(&nsec_lo, &nsec_hi, delta, time.tsc_to_system_mul);
- nsec = (nsec_lo >> 32) | (nsec_hi << 32);
- return nsec + time.system_time;
-}
static void kvmclock_vm_state_change(void *opaque, int running,
RunState state)
@@ -89,15 +45,9 @@ static void kvmclock_vm_state_change(void *opaque, int running,
if (running) {
struct kvm_clock_data data;
- uint64_t time_at_migration = kvmclock_current_nsec(s);
s->clock_valid = false;
- /* We can't rely on the migrated clock value, just discard it */
- if (time_at_migration) {
- s->clock = time_at_migration;
- }
-
data.clock = s->clock;
data.flags = 0;
ret = kvm_vm_ioctl(kvm_state, KVM_SET_CLOCK, &data);
@@ -125,8 +75,6 @@ static void kvmclock_vm_state_change(void *opaque, int running,
if (s->clock_valid) {
return;
}
-
- cpu_synchronize_all_states();
ret = kvm_vm_ioctl(kvm_state, KVM_GET_CLOCK, &data);
if (ret < 0) {
fprintf(stderr, "KVM_GET_CLOCK failed: %s\n", strerror(ret));