gem5  v21.1.0.2
Public Member Functions | List of all members
gem5::KvmKernelGicV2 Class Reference

KVM in-kernel GIC abstraction. More...

#include <gic.hh>

Inheritance diagram for gem5::KvmKernelGicV2:
gem5::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 57 of file gic.hh.

Constructor & Destructor Documentation

◆ KvmKernelGicV2() [1/3]

gem5::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 gem5::KvmVM::enableKernelIRQChip(), kdev, gem5::KvmDevice::setAttr(), and vm.

◆ ~KvmKernelGicV2()

gem5::KvmKernelGicV2::~KvmKernelGicV2 ( )
virtual

Definition at line 69 of file gic.cc.

◆ KvmKernelGicV2() [2/3]

gem5::KvmKernelGicV2::KvmKernelGicV2 ( const KvmKernelGicV2 other)
delete

◆ KvmKernelGicV2() [3/3]

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

Member Function Documentation

◆ clearPPI()

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

Clear a private peripheral interrupt.

Parameters
vcpuKVM virtual CPU number @parma ppi PPI interrupt number

Definition at line 92 of file gic.cc.

References setIntState().

Referenced by gem5::MuxingKvmGic::clearPPInt().

◆ clearSPI()

void gem5::KvmKernelGicV2::clearSPI ( unsigned  spi)

Clear a shared peripheral interrupt.

Parameters
spiSPI number

Definition at line 80 of file gic.cc.

References setIntState().

Referenced by gem5::MuxingKvmGic::clearInt().

◆ getGicReg()

uint32_t gem5::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 113 of file gic.cc.

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

Referenced by readCpu(), and readDistributor().

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

◆ readCpu()

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

Implements gem5::BaseGicRegisters.

Definition at line 148 of file gic.cc.

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

◆ readDistributor()

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

BaseGicRegisters interface.

Implements gem5::BaseGicRegisters.

Definition at line 141 of file gic.cc.

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

◆ setGicReg()

void gem5::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 127 of file gic.cc.

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

Referenced by writeCpu(), and writeDistributor().

◆ setIntState()

void gem5::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 98 of file gic.cc.

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

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

◆ setPPI()

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

Raise a private peripheral interrupt.

Parameters
vcpuKVM virtual CPU number @parma ppi PPI interrupt number

Definition at line 86 of file gic.cc.

References setIntState().

Referenced by gem5::MuxingKvmGic::sendPPInt().

◆ setSPI()

void gem5::KvmKernelGicV2::setSPI ( unsigned  spi)

Raise a shared peripheral interrupt.

Parameters
spiSPI number

Definition at line 74 of file gic.cc.

References setIntState().

Referenced by gem5::MuxingKvmGic::sendInt().

◆ writeCpu()

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

Implements gem5::BaseGicRegisters.

Definition at line 162 of file gic.cc.

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

◆ writeDistributor()

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

Implements gem5::BaseGicRegisters.

Definition at line 155 of file gic.cc.

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

Member Data Documentation

◆ cpuRange

const AddrRange gem5::KvmKernelGicV2::cpuRange

Address range for the CPU interfaces.

Definition at line 116 of file gic.hh.

◆ distRange

const AddrRange gem5::KvmKernelGicV2::distRange

Address range for the distributor interface.

Definition at line 118 of file gic.hh.

◆ kdev

KvmDevice gem5::KvmKernelGicV2::kdev
protected

Kernel interface to the GIC.

Definition at line 165 of file gic.hh.

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

◆ vm

KvmVM& gem5::KvmKernelGicV2::vm
protected

KVM VM in the parent system.

Definition at line 162 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 Tue Sep 21 2021 12:27:45 for gem5 by doxygen 1.8.17