gic.cc (11943:0a924b294735) gic.cc (12100:5f19ea125548)
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

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

184{
185 Pl390::loadState(cp);
186}
187
188void
189MuxingKvmGic::startup()
190{
191 Pl390::startup();
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

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

184{
185 Pl390::loadState(cp);
186}
187
188void
189MuxingKvmGic::startup()
190{
191 Pl390::startup();
192 usingKvm = (kernelGic != nullptr) && validKvmEnvironment();
192 usingKvm = (kernelGic != nullptr) && system.validKvmEnvironment();
193 if (usingKvm)
194 fromPl390ToKvm();
195}
196
197DrainState
198MuxingKvmGic::drain()
199{
200 if (usingKvm)
201 fromKvmToPl390();
202 return Pl390::drain();
203}
204
205void
206MuxingKvmGic::drainResume()
207{
208 Pl390::drainResume();
193 if (usingKvm)
194 fromPl390ToKvm();
195}
196
197DrainState
198MuxingKvmGic::drain()
199{
200 if (usingKvm)
201 fromKvmToPl390();
202 return Pl390::drain();
203}
204
205void
206MuxingKvmGic::drainResume()
207{
208 Pl390::drainResume();
209 bool use_kvm = (kernelGic != nullptr) && validKvmEnvironment();
209 bool use_kvm = (kernelGic != nullptr) && system.validKvmEnvironment();
210 if (use_kvm != usingKvm) {
211 // Should only occur due to CPU switches
212 if (use_kvm) // from simulation to KVM emulation
213 fromPl390ToKvm();
214 // otherwise, drain() already sync'd the state back to the Pl390
215
216 usingKvm = use_kvm;
217 }

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

282{
283 if (!usingKvm)
284 return Pl390::clearPPInt(num, cpu);
285
286 DPRINTF(Interrupt, "Clear PPI %d:%d\n", cpu, num);
287 kernelGic->clearPPI(cpu, num);
288}
289
210 if (use_kvm != usingKvm) {
211 // Should only occur due to CPU switches
212 if (use_kvm) // from simulation to KVM emulation
213 fromPl390ToKvm();
214 // otherwise, drain() already sync'd the state back to the Pl390
215
216 usingKvm = use_kvm;
217 }

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

282{
283 if (!usingKvm)
284 return Pl390::clearPPInt(num, cpu);
285
286 DPRINTF(Interrupt, "Clear PPI %d:%d\n", cpu, num);
287 kernelGic->clearPPI(cpu, num);
288}
289
290bool
291MuxingKvmGic::validKvmEnvironment() const
292{
293 if (system.threadContexts.empty())
294 return false;
295
296 for (auto tc : system.threadContexts) {
297 if (dynamic_cast<BaseArmKvmCPU*>(tc->getCpuPtr()) == nullptr) {
298 return false;
299 }
300 }
301 return true;
302}
303
304void
305MuxingKvmGic::copyDistRegister(BaseGicRegisters* from, BaseGicRegisters* to,
306 ContextID ctx, Addr daddr)
307{
308 auto val = from->readDistributor(ctx, daddr);
309 DPRINTF(GIC, "copy dist 0x%x 0x%08x\n", daddr, val);
310 to->writeDistributor(ctx, daddr, val);
311}

--- 143 unchanged lines hidden ---
290void
291MuxingKvmGic::copyDistRegister(BaseGicRegisters* from, BaseGicRegisters* to,
292 ContextID ctx, Addr daddr)
293{
294 auto val = from->readDistributor(ctx, daddr);
295 DPRINTF(GIC, "copy dist 0x%x 0x%08x\n", daddr, val);
296 to->writeDistributor(ctx, daddr, val);
297}

--- 143 unchanged lines hidden ---