gem5
|
KVM in-kernel GIC abstraction. More...
#include <gic.hh>
Public Member Functions | |
KvmKernelGicV2 (KvmVM &vm, Addr cpu_addr, Addr dist_addr, unsigned it_lines) | |
Instantiate a KVM in-kernel GIC model. More... | |
virtual | ~KvmKernelGicV2 () |
KvmKernelGicV2 (const KvmKernelGicV2 &other)=delete | |
KvmKernelGicV2 (const KvmKernelGicV2 &&other)=delete | |
KvmKernelGicV2 & | operator= (const KvmKernelGicV2 &&rhs)=delete |
KvmKernelGicV2 & | operator= (const KvmKernelGicV2 &rhs)=delete |
Protected Member Functions | |
void | setIntState (unsigned type, unsigned vcpu, unsigned irq, bool high) |
Update the kernel's VGIC interrupt state. More... | |
uint32_t | getGicReg (unsigned group, unsigned vcpu, unsigned offset) |
Get value of GIC register "from" a cpu. More... | |
void | setGicReg (unsigned group, unsigned vcpu, unsigned offset, unsigned value) |
Set value of GIC register "from" a cpu. More... | |
Protected Attributes | |
KvmVM & | vm |
KVM VM in the parent system. More... | |
KvmDevice | kdev |
Kernel interface to the GIC. More... | |
In-kernel GIC API | |
const AddrRange | cpuRange |
Address range for the CPU interfaces. More... | |
const AddrRange | distRange |
Address range for the distributor interface. More... | |
void | setSPI (unsigned spi) |
Raise a shared peripheral interrupt. More... | |
void | clearSPI (unsigned spi) |
Clear a shared peripheral interrupt. More... | |
void | setPPI (unsigned vcpu, unsigned ppi) |
Raise a private peripheral interrupt. More... | |
void | clearPPI (unsigned vcpu, unsigned ppi) |
Clear a private peripheral interrupt. More... | |
uint32_t | readDistributor (ContextID ctx, Addr daddr) override |
BaseGicRegisters interface. More... | |
uint32_t | readCpu (ContextID ctx, Addr daddr) override |
void | writeDistributor (ContextID ctx, Addr daddr, uint32_t data) override |
void | writeCpu (ContextID ctx, Addr daddr, uint32_t data) override |
KVM in-kernel GIC abstraction.
This class defines a high-level interface to the KVM in-kernel GIC model. It exposes an API that is similar to that of software-emulated GIC models in gem5.
Instantiate a KVM in-kernel GIC model.
This constructor instantiates an in-kernel GIC model and wires it up to the virtual memory system.
vm | KVM VM representing this system |
cpu_addr | GIC CPU interface base address |
dist_addr | GIC distributor base address |
it_lines | Number of interrupt lines to support |
Definition at line 50 of file gic.cc.
References kdev, and KvmDevice::setAttr().
|
delete |
|
delete |
void KvmKernelGicV2::clearPPI | ( | unsigned | vcpu, |
unsigned | ppi | ||
) |
Clear a private peripheral interrupt.
vcpu | KVM virtual CPU number ppi PPI interrupt number |
Definition at line 88 of file gic.cc.
References setIntState().
Referenced by MuxingKvmGic::clearPPInt().
void KvmKernelGicV2::clearSPI | ( | unsigned | spi | ) |
Clear a shared peripheral interrupt.
spi | SPI number |
Definition at line 76 of file gic.cc.
References setIntState().
Referenced by MuxingKvmGic::clearInt().
|
protected |
Get value of GIC register "from" a cpu.
group | Distributor or CPU (KVM_DEV_ARM_VGIC_GRP_{DIST,CPU}_REGS) |
vcpu | CPU id within KVM |
offset | register offset |
Definition at line 109 of file gic.cc.
References ArmISA::attr, KvmDevice::getAttrPtr(), kdev, and X86ISA::reg.
Referenced by readCpu(), and readDistributor().
|
delete |
|
delete |
Implements BaseGicRegisters.
Definition at line 144 of file gic.cc.
References KvmVM::contextIdToVCpuId(), getGicReg(), and vm.
BaseGicRegisters interface.
Implements BaseGicRegisters.
Definition at line 137 of file gic.cc.
References KvmVM::contextIdToVCpuId(), getGicReg(), and vm.
|
protected |
Set value of GIC register "from" a cpu.
group | Distributor or CPU (KVM_DEV_ARM_VGIC_GRP_{DIST,CPU}_REGS) |
vcpu | CPU id within KVM |
offset | register offset |
value | value to set register to |
Definition at line 123 of file gic.cc.
References ArmISA::attr, kdev, X86ISA::reg, and KvmDevice::setAttrPtr().
Referenced by writeCpu(), and writeDistributor().
|
protected |
Update the kernel's VGIC interrupt state.
type | Interrupt type (KVM_ARM_IRQ_TYPE_PPI/KVM_ARM_IRQ_TYPE_SPI) |
vcpu | CPU id within KVM (ignored for SPIs) |
irq | Interrupt number |
high | True to signal an interrupt, false to clear it. |
Definition at line 94 of file gic.cc.
References KvmVM::setIRQLine(), and vm.
Referenced by clearPPI(), clearSPI(), setPPI(), and setSPI().
void KvmKernelGicV2::setPPI | ( | unsigned | vcpu, |
unsigned | ppi | ||
) |
Raise a private peripheral interrupt.
vcpu | KVM virtual CPU number ppi PPI interrupt number |
Definition at line 82 of file gic.cc.
References setIntState().
Referenced by MuxingKvmGic::sendPPInt().
void KvmKernelGicV2::setSPI | ( | unsigned | spi | ) |
Raise a shared peripheral interrupt.
spi | SPI number |
Definition at line 70 of file gic.cc.
References setIntState().
Referenced by MuxingKvmGic::sendInt().
Implements BaseGicRegisters.
Definition at line 158 of file gic.cc.
References KvmVM::contextIdToVCpuId(), setGicReg(), and vm.
Implements BaseGicRegisters.
Definition at line 151 of file gic.cc.
References KvmVM::contextIdToVCpuId(), setGicReg(), and vm.
const AddrRange KvmKernelGicV2::cpuRange |
const AddrRange KvmKernelGicV2::distRange |
|
protected |
Kernel interface to the GIC.
Definition at line 165 of file gic.hh.
Referenced by getGicReg(), KvmKernelGicV2(), and setGicReg().
|
protected |
KVM VM in the parent system.
Definition at line 162 of file gic.hh.
Referenced by readCpu(), readDistributor(), setIntState(), writeCpu(), and writeDistributor().