mmu

package
v1.6.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 30, 2019 License: MIT Imports: 7 Imported by: 3

Documentation

Overview

Package mmu provides a Memory Management Unit implementation.

Index

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 MakeBuilder

func MakeBuilder() Builder

MakeBuilder creates a new builder

func (Builder) Build

func (b Builder) Build(name string) *MMUImpl

Build returns a newly created MMU component

func (Builder) WithEngine

func (b Builder) WithEngine(engine akita.Engine) Builder

WithEngine sets the engine to be used with the MMU

func (Builder) WithFreq

func (b Builder) WithFreq(freq akita.Freq) Builder

WithFreq sets the frequency that the MMU to work at

func (Builder) WithMaxNumReqInFlight

func (b Builder) WithMaxNumReqInFlight(n int) Builder

WithMaxNumReqInFlight sets the number of requests can be concurrently processed by the MMU.

func (Builder) WithMigrationServiceProvider added in v1.2.3

func (b Builder) WithMigrationServiceProvider(p akita.Port) Builder

WithMigrationServiceProvider sets the destination port that can perform page migration.

func (Builder) WithPageTableFactory

func (b Builder) WithPageTableFactory(f vm.PageTableFactory) Builder

WithPageTableFactory sets the page table factory to be used by the MMU

func (Builder) WithPageWalkingLatency

func (b Builder) WithPageWalkingLatency(n int) Builder

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

func (mmu *MMUImpl) CreatePage(page *vm.Page)

CreatePage add a page to the page table.

func (*MMUImpl) GetNumPages added in v1.5.0

func (mmu *MMUImpl) GetNumPages(pid ca.PID) int

GetNumPages returns the number of page table entries for a given PID

func (*MMUImpl) GetOrCreatePageTable

func (mmu *MMUImpl) GetOrCreatePageTable(pid ca.PID) vm.PageTable

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 (mmu *MMUImpl) GetPageWithGivenVAddr(vAddr uint64, pid ca.PID) *vm.Page

func (*MMUImpl) InvalidatePage

func (mmu *MMUImpl) InvalidatePage(vAddr uint64, pid ca.PID)

func (*MMUImpl) MarkPageAsMigrating added in v1.6.0

func (mmu *MMUImpl) MarkPageAsMigrating(vAddr uint64, pid ca.PID)

func (*MMUImpl) RemovePage

func (mmu *MMUImpl) RemovePage(pid ca.PID, vAddr uint64)

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

func (*MMUImpl) Translate

func (mmu *MMUImpl) Translate(pid ca.PID, vAddr uint64) (uint64, *vm.Page)

Translate convert virtual address to physical address.

func (*MMUImpl) ValidatePage

func (mmu *MMUImpl) ValidatePage(vAddr uint64, pid ca.PID)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL