diff options
author | Andreas Sandberg <andreas.sandberg@arm.com> | 2015-06-01 19:44:17 +0100 |
---|---|---|
committer | Andreas Sandberg <andreas.sandberg@arm.com> | 2015-06-01 19:44:17 +0100 |
commit | dbfd6effe0e0a620ef0bdbbc9620e43dac622e83 (patch) | |
tree | 77532a2f926f958e731ada4000f5a928833a0e75 /src/cpu/kvm/vm.cc | |
parent | 8e7c0575dc000fdc5b09114f012942b9e52eb303 (diff) | |
download | gem5-dbfd6effe0e0a620ef0bdbbc9620e43dac622e83.tar.xz |
kvm, arm, dev: Add an in-kernel GIC implementation
This changeset adds a GIC implementation that uses the kernel's
built-in support for simulating the interrupt controller. Since there
is currently no support for state transfer between gem5 and the
kernel, the device model does not support serialization and CPU
switching (which would require switching to a gem5-simulated GIC).
Diffstat (limited to 'src/cpu/kvm/vm.cc')
-rw-r--r-- | src/cpu/kvm/vm.cc | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/cpu/kvm/vm.cc b/src/cpu/kvm/vm.cc index 01670fab4..a12374aa5 100644 --- a/src/cpu/kvm/vm.cc +++ b/src/cpu/kvm/vm.cc @@ -1,6 +1,6 @@ /* * Copyright 2014 Google, Inc. - * Copyright (c) 2012 ARM Limited + * Copyright (c) 2012, 2015 ARM Limited * All rights reserved * * The license below extends only to copyright in the software and shall @@ -486,6 +486,23 @@ KvmVM::setIRQLine(uint32_t irq, bool high) } int +KvmVM::createDevice(uint32_t type, uint32_t flags) +{ +#if defined(KVM_CREATE_DEVICE) + struct kvm_create_device dev = { type, 0, flags }; + + if (ioctl(KVM_CREATE_DEVICE, &dev) == -1) { + panic("KVM: Failed to create device (errno: %i)\n", + errno); + } + + return dev.fd; +#else + panic("Kernel headers don't support KVM_CREATE_DEVICE\n"); +#endif +} + +int KvmVM::createVCPU(long vcpuID) { int fd; |