diff options
author | Andreas Sandberg <Andreas.Sandberg@ARM.com> | 2013-04-22 13:20:32 -0400 |
---|---|---|
committer | Andreas Sandberg <Andreas.Sandberg@ARM.com> | 2013-04-22 13:20:32 -0400 |
commit | f485ad190830ab61d58ecdb8eb48621ffeb3008f (patch) | |
tree | 77eac063f39d519e60fb627fd55409b271bbfff7 /SConstruct | |
parent | 005616518c5eaa78933eb4d4760bf5243f948139 (diff) | |
download | gem5-f485ad190830ab61d58ecdb8eb48621ffeb3008f.tar.xz |
kvm: Basic support for hardware virtualized CPUs
This changeset introduces the architecture independent parts required
to support KVM-accelerated CPUs. It introduces two new simulation
objects:
KvmVM -- The KVM VM is a component shared between all CPUs in a shared
memory domain. It is typically instantiated as a child of the
system object in the simulation hierarchy. It provides access
to KVM VM specific interfaces.
BaseKvmCPU -- Abstract base class for all KVM-based CPUs. Architecture
dependent CPU implementations inherit from this class
and implement the following methods:
* updateKvmState() -- Update the
architecture-dependent KVM state from the gem5
thread context associated with the CPU.
* updateThreadContext() -- Update the thread context
from the architecture-dependent KVM state.
* dump() -- Dump the KVM state using (optional).
In order to deliver interrupts to the guest, CPU
implementations typically override the tick() method and
check for, and deliver, interrupts prior to entering
KVM.
Hardware-virutalized CPU currently have the following limitations:
* SE mode is not supported.
* PC events are not supported.
* Timing statistics are currently very limited. The current approach
simply scales the host cycles with a user-configurable factor.
* The simulated system must not contain any caches.
* Since cycle counts are approximate, there is no way to request an
exact number of cycles (or instructions) to be executed by the CPU.
* Hardware virtualized CPUs and gem5 CPUs must not execute at the
same time in the same simulator instance.
* Only single-CPU systems can be simulated.
* Remote GDB connections to the guest system are not supported.
Additionally, m5ops requires an architecture specific interface and
might not be supported.
Diffstat (limited to 'SConstruct')
-rwxr-xr-x | SConstruct | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/SConstruct b/SConstruct index 6354bf0ca..92440d7b9 100755 --- a/SConstruct +++ b/SConstruct @@ -944,6 +944,26 @@ if not have_fenv: print "Warning: Header file <fenv.h> not found." print " This host has no IEEE FP rounding mode control." +# Check if we should enable KVM-based hardware virtualization +have_kvm = conf.CheckHeader('linux/kvm.h', '<>') +if not have_kvm: + print "Info: Header file <linux/kvm.h> not found, " \ + "disabling KVM support." + +# Check if the requested target ISA is compatible with the host +def is_isa_kvm_compatible(isa): + isa_comp_table = { + } + try: + import platform + host_isa = platform.machine() + except: + print "Warning: Failed to determine host ISA." + return False + + return host_isa in isa_comp_table.get(isa, []) + + ###################################################################### # # Finish the configuration @@ -1038,6 +1058,7 @@ sticky_vars.AddVariables( BoolVariable('USE_POSIX_CLOCK', 'Use POSIX Clocks', have_posix_clock), BoolVariable('USE_FENV', 'Use <fenv.h> IEEE mode control', have_fenv), BoolVariable('CP_ANNOTATE', 'Enable critical path annotation capability', False), + BoolVariable('USE_KVM', 'Enable hardware virtualized (KVM) CPU models', have_kvm), EnumVariable('PROTOCOL', 'Coherence protocol for Ruby', 'None', all_protocols), ) @@ -1205,6 +1226,15 @@ for variant_path in variant_paths: if env['EFENCE']: env.Append(LIBS=['efence']) + if env['USE_KVM']: + if not have_kvm: + print "Warning: Can not enable KVM, host seems to lack KVM support" + env['USE_KVM'] = False + elif not is_isa_kvm_compatible(env['TARGET_ISA']): + print "Info: KVM support disabled due to unsupported host and " \ + "target ISA combination" + env['USE_KVM'] = False + # Save sticky variable settings back to current variables file sticky_vars.Save(current_vars_file, env) |