gem5  v20.1.0.0
Public Member Functions | 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
 

In-kernel GIC API

const AddrRange cpuRange
 Address range for the CPU interfaces. More...
 
const AddrRange distRange
 Address range for the distributor interface. More...
 
KvmVMvm
 KVM VM in the parent system. More...
 
KvmDevice kdev
 Kernel interface to the GIC. 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
 
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...
 

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 54 of file gic.hh.

Constructor & Destructor Documentation

◆ KvmKernelGicV2() [1/3]

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 47 of file gic.cc.

References KvmVM::enableKernelIRQChip(), kdev, KvmDevice::setAttr(), and vm.

◆ ~KvmKernelGicV2()

KvmKernelGicV2::~KvmKernelGicV2 ( )
virtual

Definition at line 66 of file gic.cc.

◆ KvmKernelGicV2() [2/3]

KvmKernelGicV2::KvmKernelGicV2 ( const KvmKernelGicV2 other)
delete

◆ KvmKernelGicV2() [3/3]

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

Member Function Documentation

◆ clearPPI()

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

Clear a private peripheral interrupt.

Parameters
vcpuKVM virtual CPU number @parma ppi PPI interrupt number

Definition at line 89 of file gic.cc.

References setIntState().

Referenced by MuxingKvmGic::clearPPInt().

◆ clearSPI()

void KvmKernelGicV2::clearSPI ( unsigned  spi)

Clear a shared peripheral interrupt.

Parameters
spiSPI number

Definition at line 77 of file gic.cc.

References setIntState().

Referenced by MuxingKvmGic::clearInt().

◆ getGicReg()

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 110 of file gic.cc.

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

Referenced by readCpu(), and readDistributor().

◆ operator=() [1/2]

KvmKernelGicV2& KvmKernelGicV2::operator= ( const KvmKernelGicV2 &&  rhs)
delete

◆ operator=() [2/2]

KvmKernelGicV2& KvmKernelGicV2::operator= ( const KvmKernelGicV2 rhs)
delete

◆ readCpu()

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

Implements BaseGicRegisters.

Definition at line 145 of file gic.cc.

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

◆ readDistributor()

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

BaseGicRegisters interface.

Implements BaseGicRegisters.

Definition at line 138 of file gic.cc.

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

◆ setGicReg()

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 124 of file gic.cc.

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

Referenced by writeCpu(), and writeDistributor().

◆ setIntState()

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 95 of file gic.cc.

References ArmISA::irq, KvmVM::setIRQLine(), type, and vm.

Referenced by clearPPI(), clearSPI(), setPPI(), and setSPI().

◆ setPPI()

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

Raise a private peripheral interrupt.

Parameters
vcpuKVM virtual CPU number @parma ppi PPI interrupt number

Definition at line 83 of file gic.cc.

References setIntState().

Referenced by MuxingKvmGic::sendPPInt().

◆ setSPI()

void KvmKernelGicV2::setSPI ( unsigned  spi)

Raise a shared peripheral interrupt.

Parameters
spiSPI number

Definition at line 71 of file gic.cc.

References setIntState().

Referenced by MuxingKvmGic::sendInt().

◆ writeCpu()

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

Implements BaseGicRegisters.

Definition at line 159 of file gic.cc.

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

◆ writeDistributor()

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

Implements BaseGicRegisters.

Definition at line 152 of file gic.cc.

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

Member Data Documentation

◆ cpuRange

const AddrRange KvmKernelGicV2::cpuRange

Address range for the CPU interfaces.

Definition at line 113 of file gic.hh.

◆ distRange

const AddrRange KvmKernelGicV2::distRange

Address range for the distributor interface.

Definition at line 115 of file gic.hh.

◆ kdev

KvmDevice KvmKernelGicV2::kdev
protected

Kernel interface to the GIC.

Definition at line 162 of file gic.hh.

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

◆ vm

KvmVM& KvmKernelGicV2::vm
protected

KVM VM in the parent system.

Definition at line 159 of file gic.hh.

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


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

Generated on Wed Sep 30 2020 14:02:26 for gem5 by doxygen 1.8.17