diff options
author | Andreas Sandberg <andreas.sandberg@arm.com> | 2015-06-01 19:44:19 +0100 |
---|---|---|
committer | Andreas Sandberg <andreas.sandberg@arm.com> | 2015-06-01 19:44:19 +0100 |
commit | 7c4eb3b4d88480003f8c227731f7a31bd55cb819 (patch) | |
tree | 894adf74576a37d7aea435f25be95875a553dd77 /src/cpu/kvm | |
parent | dbfd6effe0e0a620ef0bdbbc9620e43dac622e83 (diff) | |
download | gem5-7c4eb3b4d88480003f8c227731f7a31bd55cb819.tar.xz |
kvm, arm: Add support for aarch64
This changeset adds support for aarch64 in kvm. The CPU module
supports both checkpointing and online CPU model switching as long as
no devices are simulated by the host kernel. It currently has the
following limitations:
* The system register based generic timer can only be simulated by
the host kernel. Workaround: Use a memory mapped timer instead to
simulate the timer in gem5.
* Simulating devices (e.g., the generic timer) in the host kernel
requires that the host kernel also simulates the GIC.
* ID registers in the host and in gem5 must match for switching
between simulated CPUs and KVM. This is particularly important
for ID registers describing memory system capabilities (e.g.,
ASID size, physical address size).
* Switching between a virtualized CPU and a simulated CPU is
currently not supported if in-kernel device emulation is
used. This could be worked around by adding support for switching
to the gem5 (e.g., the KvmGic) side of the device models. A
simpler workaround is to avoid in-kernel device models
altogether.
Diffstat (limited to 'src/cpu/kvm')
-rw-r--r-- | src/cpu/kvm/vm.cc | 11 | ||||
-rw-r--r-- | src/cpu/kvm/vm.hh | 17 |
2 files changed, 28 insertions, 0 deletions
diff --git a/src/cpu/kvm/vm.cc b/src/cpu/kvm/vm.cc index a12374aa5..87a76c242 100644 --- a/src/cpu/kvm/vm.cc +++ b/src/cpu/kvm/vm.cc @@ -520,6 +520,17 @@ KvmVM::allocVCPUID() return nextVCPUID++; } +#if defined(__aarch64__) +void +KvmVM::kvmArmPreferredTarget(struct kvm_vcpu_init &target) const +{ + if (ioctl(KVM_ARM_PREFERRED_TARGET, &target) == -1) { + panic("KVM: Failed to get ARM preferred CPU target (errno: %i)\n", + errno); + } +} +#endif + int KvmVM::ioctl(int request, long p1) const { diff --git a/src/cpu/kvm/vm.hh b/src/cpu/kvm/vm.hh index d21fc2660..8f834a06e 100644 --- a/src/cpu/kvm/vm.hh +++ b/src/cpu/kvm/vm.hh @@ -398,6 +398,23 @@ class KvmVM : public SimObject /** Global KVM interface */ Kvm kvm; +#if defined(__aarch64__) + public: // ARM-specific + /** + * Ask the kernel for the preferred CPU target to simulate. + * + * When creating an ARM vCPU in Kvm, we need to initialize it with + * a call to BaseArmKvmCPU::kvmArmVCpuInit(). When calling this + * function, we need to know what type of CPU the host has. This + * call sets up the kvm_vcpu_init structure with the values the + * kernel wants. + * + * @param[out] target Target structure to initialize. + */ + void kvmArmPreferredTarget(struct kvm_vcpu_init &target) const; + +#endif + protected: /** * VM CPU initialization code. |