Documentation
¶
Overview ¶
Package pcisim puts a gpudev.Device behind an emulated virtio-pci modern transport, in process: it implements go-virtio/common.Transport, so the go-virtio/gpu guest driver (or any driver written against that interface) can bring the device up and drive it with no VM.
Guest memory is a gpudev.RAM: AllocatePages hands out its pages, and the device reads the virtqueues and buffers from it by guest-physical address, as a hypervisor would. A doorbell write runs the queue synchronously, so the driver finds the used ring updated when its notify returns.
Reference: the virtio spec, transport-pci.tex — struct virtio_pci_cap (:143-153), struct virtio_pci_common_cfg (:302-328), the notification address cap.offset + queue_notify_off * notify_off_multiplier (:551).
Index ¶
- Constants
- Variables
- type Transport
- func (t *Transport) AllocatePages(count int) (uint64, []byte, error)
- func (t *Transport) Err() error
- func (t *Transport) Read8(bar uint8, off uint64) (uint8, error)
- func (t *Transport) Read16(bar uint8, off uint64) (uint16, error)
- func (t *Transport) Read32(bar uint8, off uint64) (uint32, error)
- func (t *Transport) Read64(bar uint8, off uint64) (uint64, error)
- func (t *Transport) ReadConfig8(off uint8) (uint8, error)
- func (t *Transport) ReadConfig16(off uint8) (uint16, error)
- func (t *Transport) ReadConfig32(off uint8) (uint32, error)
- func (t *Transport) Write8(bar uint8, off uint64, v uint8) error
- func (t *Transport) Write16(bar uint8, off uint64, v uint16) error
- func (t *Transport) Write32(bar uint8, off uint64, v uint32) error
- func (t *Transport) Write64(bar uint8, off uint64, v uint64) error
Constants ¶
const MaxRequest = 16 << 20
MaxRequest bounds a control request the transport gathers; longer chains are answered with an error without being copied.
Variables ¶
var ErrOutOfMemory = errors.New("pcisim: guest RAM exhausted")
ErrOutOfMemory: AllocatePages ran out of guest RAM.
Functions ¶
This section is empty.
Types ¶
type Transport ¶
type Transport struct {
// contains filtered or unexported fields
}
Transport is an emulated virtio-pci GPU function.
func New ¶
New returns a transport for dev, whose guest memory is ram (the same RAM the Device was made with).
func (*Transport) AllocatePages ¶
AllocatePages hands out zeroed, page-aligned guest RAM.
func (*Transport) Err ¶
Err is the first ring error the device met (it then set NEEDS_RESET and stopped serving queues), or nil.
func (*Transport) ReadConfig8 ¶
ReadConfig8 reads PCI configuration space.
func (*Transport) ReadConfig16 ¶
ReadConfig16 reads PCI configuration space.
func (*Transport) ReadConfig32 ¶
ReadConfig32 reads PCI configuration space.