config: Add a KVM VM to systems with KVM CPUs
KVM-based CPUs need a KVM VM object in the system to manage system-global KVM stuff (VM creation, interrupt delivery, memory managment, etc.). This changeset adds a VM to the system if KVM has been enabled at compile time (the BaseKvmCPU object exists) and a KVM-based CPU has been selected at runtime.
This commit is contained in:
parent
2607efded8
commit
7865d6e838
1 changed files with 13 additions and 0 deletions
|
@ -71,6 +71,13 @@ if args:
|
||||||
DriveCPUClass = AtomicSimpleCPU
|
DriveCPUClass = AtomicSimpleCPU
|
||||||
drive_mem_mode = 'atomic'
|
drive_mem_mode = 'atomic'
|
||||||
|
|
||||||
|
# Check if KVM support has been enabled, we might need to do VM
|
||||||
|
# configuration if that's the case.
|
||||||
|
have_kvm_support = 'BaseKvmCPU' in globals()
|
||||||
|
def is_kvm_cpu(cpu_class):
|
||||||
|
return have_kvm_support and cpu_class != None and \
|
||||||
|
issubclass(cpu_class, BaseKvmCPU)
|
||||||
|
|
||||||
# system under test can be any CPU
|
# system under test can be any CPU
|
||||||
(TestCPUClass, test_mem_mode, FutureClass) = Simulation.setCPUClass(options)
|
(TestCPUClass, test_mem_mode, FutureClass) = Simulation.setCPUClass(options)
|
||||||
|
|
||||||
|
@ -116,6 +123,9 @@ test_sys.init_param = options.init_param
|
||||||
|
|
||||||
test_sys.cpu = [TestCPUClass(cpu_id=i) for i in xrange(np)]
|
test_sys.cpu = [TestCPUClass(cpu_id=i) for i in xrange(np)]
|
||||||
|
|
||||||
|
if is_kvm_cpu(TestCPUClass) or is_kvm_cpu(FutureClass):
|
||||||
|
test_sys.vm = KvmVM()
|
||||||
|
|
||||||
if options.caches or options.l2cache:
|
if options.caches or options.l2cache:
|
||||||
test_sys.iocache = IOCache(clock = '1GHz',
|
test_sys.iocache = IOCache(clock = '1GHz',
|
||||||
addr_ranges = test_sys.mem_ranges)
|
addr_ranges = test_sys.mem_ranges)
|
||||||
|
@ -163,6 +173,9 @@ if len(bm) == 2:
|
||||||
if options.kernel is not None:
|
if options.kernel is not None:
|
||||||
drive_sys.kernel = binary(options.kernel)
|
drive_sys.kernel = binary(options.kernel)
|
||||||
|
|
||||||
|
if is_kvm_cpu(DriveCPUClass):
|
||||||
|
drive_sys.vm = KvmVM()
|
||||||
|
|
||||||
drive_sys.iobridge = Bridge(delay='50ns',
|
drive_sys.iobridge = Bridge(delay='50ns',
|
||||||
ranges = drive_sys.mem_ranges)
|
ranges = drive_sys.mem_ranges)
|
||||||
drive_sys.iobridge.slave = drive_sys.iobus.master
|
drive_sys.iobridge.slave = drive_sys.iobus.master
|
||||||
|
|
Loading…
Reference in a new issue