gic.cc (11840:16943209ed85) | gic.cc (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#include "arch/arm/kvm/gic.hh" 42 43#include <linux/kvm.h> 44 45#include "arch/arm/kvm/base_cpu.hh" 46#include "debug/Interrupt.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#include "arch/arm/kvm/gic.hh" 42 43#include <linux/kvm.h> 44 45#include "arch/arm/kvm/base_cpu.hh" 46#include "debug/Interrupt.hh" |
47#include "params/KvmGic.hh" | |
48#include "params/MuxingKvmGic.hh" 49 50KvmKernelGicV2::KvmKernelGicV2(KvmVM &_vm, Addr cpu_addr, Addr dist_addr, 51 unsigned it_lines) 52 : cpuRange(RangeSize(cpu_addr, KVM_VGIC_V2_CPU_SIZE)), 53 distRange(RangeSize(dist_addr, KVM_VGIC_V2_DIST_SIZE)), 54 vm(_vm), 55 kdev(vm.createDevice(KVM_DEV_TYPE_ARM_VGIC_V2)) --- 45 unchanged lines hidden (view full) --- 101 (type << KVM_ARM_IRQ_TYPE_SHIFT) | 102 (vcpu << KVM_ARM_IRQ_VCPU_SHIFT) | 103 (irq << KVM_ARM_IRQ_NUM_SHIFT)); 104 105 vm.setIRQLine(line, high); 106} 107 108 | 47#include "params/MuxingKvmGic.hh" 48 49KvmKernelGicV2::KvmKernelGicV2(KvmVM &_vm, Addr cpu_addr, Addr dist_addr, 50 unsigned it_lines) 51 : cpuRange(RangeSize(cpu_addr, KVM_VGIC_V2_CPU_SIZE)), 52 distRange(RangeSize(dist_addr, KVM_VGIC_V2_DIST_SIZE)), 53 vm(_vm), 54 kdev(vm.createDevice(KVM_DEV_TYPE_ARM_VGIC_V2)) --- 45 unchanged lines hidden (view full) --- 100 (type << KVM_ARM_IRQ_TYPE_SHIFT) | 101 (vcpu << KVM_ARM_IRQ_VCPU_SHIFT) | 102 (irq << KVM_ARM_IRQ_NUM_SHIFT)); 103 104 vm.setIRQLine(line, high); 105} 106 107 |
109KvmGic::KvmGic(const KvmGicParams *p) 110 : BaseGic(p), 111 system(*p->system), 112 kernelGic(*system.getKvmVM(), 113 p->cpu_addr, p->dist_addr, p->it_lines), 114 addrRanges{kernelGic.distRange, kernelGic.cpuRange} 115{ 116} 117 118KvmGic::~KvmGic() 119{ 120} 121 122void 123KvmGic::serialize(CheckpointOut &cp) const 124{ 125 panic("Checkpointing unsupported\n"); 126} 127 128void 129KvmGic::unserialize(CheckpointIn &cp) 130{ 131 panic("Checkpointing unsupported\n"); 132} 133 134Tick 135KvmGic::read(PacketPtr pkt) 136{ 137 panic("KvmGic: PIO from gem5 is currently unsupported\n"); 138} 139 140Tick 141KvmGic::write(PacketPtr pkt) 142{ 143 panic("KvmGic: PIO from gem5 is currently unsupported\n"); 144} 145 146void 147KvmGic::sendInt(uint32_t num) 148{ 149 DPRINTF(Interrupt, "Set SPI %d\n", num); 150 kernelGic.setSPI(num); 151} 152 153void 154KvmGic::clearInt(uint32_t num) 155{ 156 DPRINTF(Interrupt, "Clear SPI %d\n", num); 157 kernelGic.clearSPI(num); 158} 159 160void 161KvmGic::sendPPInt(uint32_t num, uint32_t cpu) 162{ 163 DPRINTF(Interrupt, "Set PPI %d:%d\n", cpu, num); 164 kernelGic.setPPI(cpu, num); 165} 166 167void 168KvmGic::clearPPInt(uint32_t num, uint32_t cpu) 169{ 170 DPRINTF(Interrupt, "Clear PPI %d:%d\n", cpu, num); 171 kernelGic.clearPPI(cpu, num); 172} 173 174void 175KvmGic::verifyMemoryMode() const 176{ 177 if (!(system.isAtomicMode() && system.bypassCaches())) { 178 fatal("The in-kernel KVM GIC can only be used with KVM CPUs, but the " 179 "current memory mode does not support KVM.\n"); 180 } 181} 182 183 184KvmGic * 185KvmGicParams::create() 186{ 187 return new KvmGic(this); 188} 189 190 | |
191MuxingKvmGic::MuxingKvmGic(const MuxingKvmGicParams *p) 192 : Pl390(p), 193 system(*p->system), 194 kernelGic(nullptr), 195 usingKvm(false) 196{ 197 if (auto vm = system.getKvmVM()) { 198 kernelGic = new KvmKernelGicV2(*vm, p->cpu_addr, p->dist_addr, --- 134 unchanged lines hidden --- | 108MuxingKvmGic::MuxingKvmGic(const MuxingKvmGicParams *p) 109 : Pl390(p), 110 system(*p->system), 111 kernelGic(nullptr), 112 usingKvm(false) 113{ 114 if (auto vm = system.getKvmVM()) { 115 kernelGic = new KvmKernelGicV2(*vm, p->cpu_addr, p->dist_addr, --- 134 unchanged lines hidden --- |