From dbfd6effe0e0a620ef0bdbbc9620e43dac622e83 Mon Sep 17 00:00:00 2001 From: Andreas Sandberg Date: Mon, 1 Jun 2015 19:44:17 +0100 Subject: 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). --- src/cpu/kvm/vm.cc | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'src/cpu/kvm/vm.cc') 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 @@ -485,6 +485,23 @@ KvmVM::setIRQLine(uint32_t irq, bool high) errno); } +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) { -- cgit v1.2.3