Documentation
¶
Overview ¶
Package mmu provides a Memory Management Unit implementation.
Index ¶
- type Builder
- func (b Builder) Build(name string) *MMUImpl
- func (b Builder) WithEngine(engine akita.Engine) Builder
- func (b Builder) WithFreq(freq akita.Freq) Builder
- func (b Builder) WithLog2PageSize(log2PageSize uint64) Builder
- func (b Builder) WithMaxNumReqInFlight(n int) Builder
- func (b Builder) WithMigrationServiceProvider(p akita.Port) Builder
- func (b Builder) WithPageWalkingLatency(n int) Builder
- type MMU
- type MMUImpl
- func (mmu *MMUImpl) CreatePage(page *vm.Page)
- func (mmu *MMUImpl) GetNumPages(pid ca.PID) int
- func (mmu *MMUImpl) GetOrCreatePageTable(pid ca.PID) vm.PageTable
- func (mmu *MMUImpl) GetPageWithGivenVAddr(vAddr uint64, pid ca.PID) *vm.Page
- func (mmu *MMUImpl) InvalidatePage(vAddr uint64, pid ca.PID)
- func (mmu *MMUImpl) MarkPageAsMigrating(vAddr uint64, pid ca.PID)
- func (mmu *MMUImpl) RemovePage(pid ca.PID, vAddr uint64)
- func (mmu *MMUImpl) Tick(now akita.VTimeInSec) bool
- func (mmu *MMUImpl) Translate(pid ca.PID, vAddr uint64) (uint64, *vm.Page)
- func (mmu *MMUImpl) ValidatePage(vAddr uint64, pid ca.PID)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
A Builder can build MMU component
func (Builder) WithEngine ¶
WithEngine sets the engine to be used with the MMU
func (Builder) WithLog2PageSize ¶ added in v1.7.0
WithLog2PageSize sets the page size that the mmu support.
func (Builder) WithMaxNumReqInFlight ¶
WithMaxNumReqInFlight sets the number of requests can be concurrently processed by the MMU.
func (Builder) WithMigrationServiceProvider ¶ added in v1.2.3
WithMigrationServiceProvider sets the destination port that can perform page migration.
func (Builder) WithPageWalkingLatency ¶
WithPageWalkingLatency sets the number of cycles required for walking a page table.
type MMU ¶
type MMU interface { CreatePage(page *vm.Page) RemovePage(pid ca.PID, addr uint64) Translate(pid ca.PID, vAddr uint64) (uint64, *vm.Page) GetOrCreatePageTable(pid ca.PID) vm.PageTable InvalidatePage(vAddr uint64, pid ca.PID) ValidatePage(vAddr uint64, pid ca.PID) GetNumPages(pid ca.PID) int GetPageWithGivenVAddr(vAddr uint64, pid ca.PID) *vm.Page MarkPageAsMigrating(vAddr uint64, pid ca.PID) }
An MMU interface is the interface exposed to the driver and the emulator to allocate memory spaces and translate from virtual address to physical address.
type MMUImpl ¶
type MMUImpl struct { akita.TickingComponent ToTop akita.Port MigrationPort akita.Port MigrationServiceProvider akita.Port PageTables map[ca.PID]vm.PageTable PageAccesedByGPUID map[uint64][]uint64 // contains filtered or unexported fields }
MMUImpl is the default mmu implementation. It is also an akita Component.
func (*MMUImpl) CreatePage ¶
CreatePage add a page to the page table.
func (*MMUImpl) GetNumPages ¶ added in v1.5.0
GetNumPages returns the number of page table entries for a given PID
func (*MMUImpl) GetOrCreatePageTable ¶
GetOrCreatePageTable returns a page table that contains all the pages of a certain PID. If the page table does not exist, this function creates a new one.
func (*MMUImpl) GetPageWithGivenVAddr ¶ added in v1.6.0
func (*MMUImpl) MarkPageAsMigrating ¶ added in v1.6.0
func (*MMUImpl) RemovePage ¶
RemovePage deletes the page contains the target VAddr
func (*MMUImpl) Tick ¶
func (mmu *MMUImpl) Tick(now akita.VTimeInSec) bool
Tick defines how the MMU update state each cycle