summaryrefslogtreecommitdiff
path: root/src/cpu
diff options
context:
space:
mode:
Diffstat (limited to 'src/cpu')
-rw-r--r--src/cpu/kvm/BaseKvmCPU.py2
-rw-r--r--src/cpu/kvm/base.cc8
-rw-r--r--src/cpu/kvm/base.hh4
3 files changed, 10 insertions, 4 deletions
diff --git a/src/cpu/kvm/BaseKvmCPU.py b/src/cpu/kvm/BaseKvmCPU.py
index 796a7794b..644ca3620 100644
--- a/src/cpu/kvm/BaseKvmCPU.py
+++ b/src/cpu/kvm/BaseKvmCPU.py
@@ -71,4 +71,6 @@ class BaseKvmCPU(BaseCPU):
kvmVM = Param.KvmVM(Parent.any, 'KVM VM (i.e., shared memory domain)')
useCoalescedMMIO = Param.Bool(False, "Use coalesced MMIO (EXPERIMENTAL)")
usePerfOverflow = Param.Bool(False, "Use perf event overflow counters (EXPERIMENTAL)")
+
+ hostFreq = Param.Clock("2GHz", "Host clock frequency")
hostFactor = Param.Float(1.0, "Cycle scale factor")
diff --git a/src/cpu/kvm/base.cc b/src/cpu/kvm/base.cc
index 3bfe44cf4..539790e52 100644
--- a/src/cpu/kvm/base.cc
+++ b/src/cpu/kvm/base.cc
@@ -83,6 +83,7 @@ BaseKvmCPU::BaseKvmCPU(BaseKvmCPUParams *params)
pageSize(sysconf(_SC_PAGE_SIZE)),
tickEvent(*this),
perfControlledByTimer(params->usePerfOverflow),
+ hostFreq(params->hostFreq),
hostFactor(params->hostFactor),
drainManager(NULL),
ctrInsts(0)
@@ -103,11 +104,11 @@ BaseKvmCPU::BaseKvmCPU(BaseKvmCPUParams *params)
runTimer.reset(new PerfKvmTimer(hwCycles,
KVM_TIMER_SIGNAL,
params->hostFactor,
- params->clock));
+ params->hostFreq));
else
runTimer.reset(new PosixKvmTimer(KVM_TIMER_SIGNAL, CLOCK_MONOTONIC,
params->hostFactor,
- params->clock));
+ params->hostFreq));
}
BaseKvmCPU::~BaseKvmCPU()
@@ -410,8 +411,7 @@ BaseKvmCPU::activateContext(ThreadID thread_num, Cycles delay)
assert(_status == Idle);
assert(!tickEvent.scheduled());
- numCycles += ticksToCycles(thread->lastActivate - thread->lastSuspend)
- * hostFactor;
+ numCycles += ticksToCycles(thread->lastActivate - thread->lastSuspend);
schedule(tickEvent, clockEdge(delay));
_status = Running;
diff --git a/src/cpu/kvm/base.hh b/src/cpu/kvm/base.hh
index 42a7eca2b..2e3ee551b 100644
--- a/src/cpu/kvm/base.hh
+++ b/src/cpu/kvm/base.hh
@@ -670,6 +670,10 @@ class BaseKvmCPU : public BaseCPU
*/
std::unique_ptr<BaseKvmTimer> runTimer;
+ /** Host frequency */
+ Tick hostFreq;
+
+ /** Host factor as specified in the configuration */
float hostFactor;
/**