gem5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
KvmKernelGicV2 Class Reference

KVM in-kernel GIC abstraction. More...

#include <gic.hh>

Inheritance diagram for KvmKernelGicV2:
BaseGicRegisters

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
 
KvmKernelGicV2operator= (const KvmKernelGicV2 &&rhs)=delete
 
KvmKernelGicV2operator= (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

KvmVMvm
 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
 

Detailed Description

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.

Definition at line 57 of file gic.hh.

Constructor & Destructor Documentation

KvmKernelGicV2::KvmKernelGicV2 ( KvmVM vm,
Addr  cpu_addr,
Addr  dist_addr,
unsigned  it_lines 
)

Instantiate a KVM in-kernel GIC model.

This constructor instantiates an in-kernel GIC model and wires it up to the virtual memory system.

Parameters
vmKVM VM representing this system
cpu_addrGIC CPU interface base address
dist_addrGIC distributor base address
it_linesNumber of interrupt lines to support

Definition at line 50 of file gic.cc.

References kdev, and KvmDevice::setAttr().

KvmKernelGicV2::~KvmKernelGicV2 ( )
virtual

Definition at line 65 of file gic.cc.

KvmKernelGicV2::KvmKernelGicV2 ( const KvmKernelGicV2 other)
delete
KvmKernelGicV2::KvmKernelGicV2 ( const KvmKernelGicV2 &&  other)
delete

Member Function Documentation

void KvmKernelGicV2::clearPPI ( unsigned  vcpu,
unsigned  ppi 
)

Clear a private peripheral interrupt.

Parameters
vcpuKVM 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.

Parameters
spiSPI number

Definition at line 76 of file gic.cc.

References setIntState().

Referenced by MuxingKvmGic::clearInt().

uint32_t KvmKernelGicV2::getGicReg ( unsigned  group,
unsigned  vcpu,
unsigned  offset 
)
protected

Get value of GIC register "from" a cpu.

Parameters
groupDistributor or CPU (KVM_DEV_ARM_VGIC_GRP_{DIST,CPU}_REGS)
vcpuCPU id within KVM
offsetregister offset

Definition at line 109 of file gic.cc.

References ArmISA::attr, KvmDevice::getAttrPtr(), kdev, and X86ISA::reg.

Referenced by readCpu(), and readDistributor().

KvmKernelGicV2& KvmKernelGicV2::operator= ( const KvmKernelGicV2 &&  rhs)
delete
KvmKernelGicV2& KvmKernelGicV2::operator= ( const KvmKernelGicV2 rhs)
delete
uint32_t KvmKernelGicV2::readCpu ( ContextID  ctx,
Addr  daddr 
)
overridevirtual

Implements BaseGicRegisters.

Definition at line 144 of file gic.cc.

References KvmVM::contextIdToVCpuId(), getGicReg(), and vm.

uint32_t KvmKernelGicV2::readDistributor ( ContextID  ctx,
Addr  daddr 
)
overridevirtual

BaseGicRegisters interface.

Implements BaseGicRegisters.

Definition at line 137 of file gic.cc.

References KvmVM::contextIdToVCpuId(), getGicReg(), and vm.

void KvmKernelGicV2::setGicReg ( unsigned  group,
unsigned  vcpu,
unsigned  offset,
unsigned  value 
)
protected

Set value of GIC register "from" a cpu.

Parameters
groupDistributor or CPU (KVM_DEV_ARM_VGIC_GRP_{DIST,CPU}_REGS)
vcpuCPU id within KVM
offsetregister offset
valuevalue 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().

void KvmKernelGicV2::setIntState ( unsigned  type,
unsigned  vcpu,
unsigned  irq,
bool  high 
)
protected

Update the kernel's VGIC interrupt state.

Parameters
typeInterrupt type (KVM_ARM_IRQ_TYPE_PPI/KVM_ARM_IRQ_TYPE_SPI)
vcpuCPU id within KVM (ignored for SPIs)
irqInterrupt number
highTrue 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.

Parameters
vcpuKVM 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.

Parameters
spiSPI number

Definition at line 70 of file gic.cc.

References setIntState().

Referenced by MuxingKvmGic::sendInt().

void KvmKernelGicV2::writeCpu ( ContextID  ctx,
Addr  daddr,
uint32_t  data 
)
overridevirtual

Implements BaseGicRegisters.

Definition at line 158 of file gic.cc.

References KvmVM::contextIdToVCpuId(), setGicReg(), and vm.

void KvmKernelGicV2::writeDistributor ( ContextID  ctx,
Addr  daddr,
uint32_t  data 
)
overridevirtual

Implements BaseGicRegisters.

Definition at line 151 of file gic.cc.

References KvmVM::contextIdToVCpuId(), setGicReg(), and vm.

Member Data Documentation

const AddrRange KvmKernelGicV2::cpuRange

Address range for the CPU interfaces.

Definition at line 116 of file gic.hh.

const AddrRange KvmKernelGicV2::distRange

Address range for the distributor interface.

Definition at line 118 of file gic.hh.

KvmDevice KvmKernelGicV2::kdev
protected

Kernel interface to the GIC.

Definition at line 165 of file gic.hh.

Referenced by getGicReg(), KvmKernelGicV2(), and setGicReg().

KvmVM& KvmKernelGicV2::vm
protected

KVM VM in the parent system.

Definition at line 162 of file gic.hh.

Referenced by readCpu(), readDistributor(), setIntState(), writeCpu(), and writeDistributor().


The documentation for this class was generated from the following files:

Generated on Fri Jun 9 2017 13:04:13 for gem5 by doxygen 1.8.6