gic.hh (11840:16943209ed85) gic.hh (11842:5a766820e739)
1/*
2 * Copyright (c) 2015-2017 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

--- 30 unchanged lines hidden (view full) ---

39 */
40
41#ifndef __ARCH_ARM_KVM_GIC_HH__
42#define __ARCH_ARM_KVM_GIC_HH__
43
44#include "arch/arm/system.hh"
45#include "cpu/kvm/device.hh"
46#include "cpu/kvm/vm.hh"
1/*
2 * Copyright (c) 2015-2017 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

--- 30 unchanged lines hidden (view full) ---

39 */
40
41#ifndef __ARCH_ARM_KVM_GIC_HH__
42#define __ARCH_ARM_KVM_GIC_HH__
43
44#include "arch/arm/system.hh"
45#include "cpu/kvm/device.hh"
46#include "cpu/kvm/vm.hh"
47#include "dev/arm/base_gic.hh"
48#include "dev/arm/gic_pl390.hh"
49#include "dev/platform.hh"
50
51/**
52 * KVM in-kernel GIC abstraction
53 *
54 * This class defines a high-level interface to the KVM in-kernel GIC
55 * model. It exposes an API that is similar to that of

--- 77 unchanged lines hidden (view full) ---

133
134 /** KVM VM in the parent system */
135 KvmVM &vm;
136
137 /** Kernel interface to the GIC */
138 KvmDevice kdev;
139};
140
47#include "dev/arm/gic_pl390.hh"
48#include "dev/platform.hh"
49
50/**
51 * KVM in-kernel GIC abstraction
52 *
53 * This class defines a high-level interface to the KVM in-kernel GIC
54 * model. It exposes an API that is similar to that of

--- 77 unchanged lines hidden (view full) ---

132
133 /** KVM VM in the parent system */
134 KvmVM &vm;
135
136 /** Kernel interface to the GIC */
137 KvmDevice kdev;
138};
139
141struct KvmGicParams;
142
140
143/**
144 * In-kernel GIC model.
145 *
146 * When using a KVM-based CPU model, it is possible to offload GIC
147 * emulation to the kernel. This reduces some overheads when the guest
148 * accesses the GIC and makes it possible to use in-kernel
149 * architected/generic timer emulation.
150 *
151 * This device uses interfaces with the kernel GicV2 model that is
152 * documented in Documentation/virtual/kvm/devices/arm-vgic.txt in the
153 * Linux kernel sources.
154 *
155 * This GIC model has the following known limitations:
156 * <ul>
157 * <li>Checkpointing is not supported.
158 * <li>This model only works with kvm. Simulated CPUs are not
159 * supported since this would require the kernel to inject
160 * interrupt into the simulated CPU.
161 * </ul>
162 *
163 * @warn This GIC model cannot be used with simulated CPUs!
164 */
165class KvmGic : public BaseGic
166{
167 public: // SimObject / Serializable / Drainable
168 KvmGic(const KvmGicParams *p);
169 ~KvmGic();
170
171 void startup() override { verifyMemoryMode(); }
172 void drainResume() override { verifyMemoryMode(); }
173
174 void serialize(CheckpointOut &cp) const override;
175 void unserialize(CheckpointIn &cp) override;
176
177 public: // PioDevice
178 AddrRangeList getAddrRanges() const { return addrRanges; }
179 Tick read(PacketPtr pkt) override;
180 Tick write(PacketPtr pkt) override;
181
182 public: // BaseGic
183 void sendInt(uint32_t num) override;
184 void clearInt(uint32_t num) override;
185
186 void sendPPInt(uint32_t num, uint32_t cpu) override;
187 void clearPPInt(uint32_t num, uint32_t cpu) override;
188
189 protected:
190 /**
191 * Do memory mode sanity checks
192 *
193 * This method only really exists to warn users that try to switch
194 * to a simulate CPU. There is no fool proof method to detect
195 * simulated CPUs, but checking that we're in atomic mode and
196 * bypassing caches should be robust enough.
197 */
198 void verifyMemoryMode() const;
199
200 /** System this interrupt controller belongs to */
201 System &system;
202
203 /** Kernel GIC device */
204 KvmKernelGicV2 kernelGic;
205
206 /** Union of all memory */
207 const AddrRangeList addrRanges;
208};
209
210struct MuxingKvmGicParams;
211
212class MuxingKvmGic : public Pl390
213{
214 public: // SimObject / Serializable / Drainable
215 MuxingKvmGic(const MuxingKvmGicParams *p);
216 ~MuxingKvmGic();
217

--- 36 unchanged lines hidden ---
141struct MuxingKvmGicParams;
142
143class MuxingKvmGic : public Pl390
144{
145 public: // SimObject / Serializable / Drainable
146 MuxingKvmGic(const MuxingKvmGicParams *p);
147 ~MuxingKvmGic();
148

--- 36 unchanged lines hidden ---