Documentation ¶
Overview ¶
Package qdev describes PCI Express device topologies of a QEMU guest.
The design of this package is intentionally limited to encourage good topologies that follow recommendations laid out in the QEMU documentation. Many QEMU device features are not included or exposed by the types in this package.
To create a new QEMU device hierarchy, prepare a new Topology and add PCI Express Root Ports to it.
Index ¶
- Constants
- Variables
- func Walk(devices []Device, fn WalkFn)
- type Addr
- type Block
- type BlockOption
- type BootIndex
- type BootOrder
- type BusMap
- type ControllerMap
- type Device
- type DiscardGranularity
- type Driver
- type ID
- type Network
- type PVPanic
- type Properties
- type Property
- type QXL
- type Root
- func (r *Root) AddUSB() (*USB, error)
- func (r *Root) AddVFIO(device sysfs.Path) (VFIO, error)
- func (r *Root) AddVirtioBlock(thread qhost.IOThread, bdev blockdev.Node, options ...BlockOption) (Block, error)
- func (r *Root) AddVirtioNetwork(mac string, netdev qhost.NetDev) (Network, error)
- func (r *Root) AddVirtioSCSI(thread qhost.IOThread) (*SCSI, error)
- func (r *Root) AddVirtioSerial() (*Serial, error)
- func (r *Root) Connect(dev Device) error
- func (r Root) Downstream() Device
- func (r Root) Driver() Driver
- func (r Root) ID() ID
- func (r Root) Properties() Properties
- type SATACD
- type SCSI
- type SCSICD
- type SCSIHD
- type SCSIHDOption
- type Serial
- type SerialNumber
- type SerialPort
- type Switch
- type TPMCRB
- type TPMTIS
- type Topology
- func (t *Topology) AddCDROM(bdev blockdev.Node) (SATACD, error)
- func (t *Topology) AddPanic() (PVPanic, error)
- func (t *Topology) AddQXL() (*QXL, error)
- func (t *Topology) AddRoot() (*Root, error)
- func (t *Topology) AddTPMCRB(device tpmdev.ID) (TPMCRB, error)
- func (t *Topology) AddTPMTIS(device tpmdev.ID) (TPMTIS, error)
- func (t *Topology) Devices() []Device
- func (t *Topology) Options() qemu.Options
- type USB
- func (controller *USB) AddRedir(chardev chardev.ID) (USBRedir, error)
- func (controller *USB) AddSCSI() (*USBAttachedSCSI, error)
- func (controller *USB) AddStorage(bdev blockdev.Node) (USBStorage, error)
- func (controller *USB) AddTablet() (USBTablet, error)
- func (controller *USB) Devices() []Device
- func (controller *USB) Driver() Driver
- func (controller *USB) ID() ID
- func (controller *USB) Properties() Properties
- type USBAttachedSCSI
- func (controller *USBAttachedSCSI) AddCD(bdev blockdev.Node) (SCSICD, error)
- func (controller *USBAttachedSCSI) AddDisk(bdev blockdev.Node) (SCSIHD, error)
- func (controller *USBAttachedSCSI) Devices() []Device
- func (controller *USBAttachedSCSI) Driver() Driver
- func (controller *USBAttachedSCSI) Properties() Properties
- type USBRedir
- type USBStorage
- type USBTablet
- type Upstream
- type VFIO
- type WWN
- type WalkFn
Examples ¶
Constants ¶
const ( // MaxMultifunctionDevices is the maximum number of devices that can be // addressed at a single PCI Express slot using multifunction addressing. MaxMultifunctionDevices = 8 // MaxRoots is the maximum number of PCI Express Root devices within a // PCI Express Root Complex. MaxRoots = 32 * MaxMultifunctionDevices )
const ( // MaxSATADevices is the maximum number of SATA devices supported by the // ICH9's SATA controller on q35 machines. MaxSATADevices = 6 )
const ( // MaxSCSIDevices is the maximum number of devices supported by an SCSI // controller. MaxSCSIDevices = 28 )
const ( // MaxSerialPorts is the maximum number of Serial Ports supported by a // Serial Controller. MaxSerialPorts = 31 )
const ( // MaxUSBPorts is the maximum number of USB Ports supported by an xHCI // controller. MaxUSBPorts = 15 )
Variables ¶
var ( // ErrDownstreamOccupied is returned when an attempt is made to connect a // a device to a PCI Express port that already has a device connected // to it. ErrDownstreamOccupied = errors.New("a device is already connected to the PCI Express downstream port") )
var ( // ErrRootComplexFull is returned when the addition of a new PCI Express // Root would exceed MaxRoots. ErrRootComplexFull = errors.New("the PCI Express root complex is full and cannot accommodate more devices") )
var ( // ErrSATAFull is returned when the addition of a new SATA device // would exceed MaxSATADevices. ErrSATAFull = errors.New("the SATA controller is full and cannot accommodate more devices") )
var ( // ErrSCSIControllerFull is returned when the addition of a new SCSI disk // would exceed MaxSCSIDevices. ErrSCSIControllerFull = errors.New("the SCSI Controller is full and cannot accommodate more devices") )
var ( // ErrSerialControllerFull is returned when the addition of a new Serial // device would exceed MaxSerialPorts. ErrSerialControllerFull = errors.New("the serial controller is full and cannot accommodate more devices") )
var ( // ErrUSBControllerFull is returned when the addition of a new USB device // would exceed MaxUSBPorts. ErrUSBControllerFull = errors.New("the USB Controller is full and cannot accommodate more devices") )
Functions ¶
Types ¶
type Block ¶
type Block struct {
// contains filtered or unexported fields
}
Block is a Virtio Block device.
func (Block) Properties ¶
func (block Block) Properties() Properties
Properties returns the properties of the Virtio Block device.
type BlockOption ¶
type BlockOption interface {
// contains filtered or unexported methods
}
BlockOption is an option for a Virtio Block device.
type BootOrder ¶
type BootOrder struct {
// contains filtered or unexported fields
}
BootOrder keeps track of the preferred order of boot devices.
type BusMap ¶
BusMap keeps track of index assignments for QEMU device buses.
The QEMU machinery forcefully adds a numeric suffix such as ".0" to the ID of many controllers in order to form the controller's bus address used by downstream devices. This seems to contradict the behavior of the PCI Express bus, which uses the controller's ID directly as the bus address.
When declaring controller identifiers to QEMU, many controllers must supply their ID prefix (such as "usb") and then anticipate the actual bus address assignment that will be assigned by QEMU.
TODO: Find someone, somewhere, that can actually explain QEMU's bus addresss naming requirements and conventions. Thus far, no documentation on this topic has been found.
type ControllerMap ¶
type ControllerMap struct {
// contains filtered or unexported fields
}
ControllerMap keeps track of which device controllers have been added to a QEMU virtual machine definition.
func NewControllerMap ¶
func NewControllerMap(topo *Topology) *ControllerMap
NewControllerMap returns a controller map that will keep track of device controllers assigned to the given QEMU virtual machine definition.
TODO: Consider walking the existing topology to find controllers.
func (*ControllerMap) SCSI ¶
func (m *ControllerMap) SCSI(iothread qhost.IOThread) (*SCSI, error)
SCSI returns a SCSI controller device for the virtual machine.
func (*ControllerMap) Serial ¶
func (m *ControllerMap) Serial() (*Serial, error)
Serial returns a serial controller device for the virtual machine.
func (*ControllerMap) Topology ¶
func (m *ControllerMap) Topology() *Topology
Topology returns the virtual machine topology that the map is bound to.
func (*ControllerMap) USB ¶
func (m *ControllerMap) USB() (*USB, error)
USB returns a USB controller device for the virtual machine.
func (*ControllerMap) USBAttachedSCSI ¶
func (m *ControllerMap) USBAttachedSCSI() (*USBAttachedSCSI, error)
USBAttachedSCSI returns a USB Attached SCSI controller device for the virtual machine.
type Device ¶
type Device interface { Driver() Driver Properties() Properties }
Device describes a virtual device to qemu.
type DiscardGranularity ¶
type DiscardGranularity int
DiscardGranularity is the granularity of discard operations on a QEMU disk device. If this value is not set explicitly, QEMU will select a default value that matches the block size of the device.
func (DiscardGranularity) String ¶
func (granularity DiscardGranularity) String() string
String returns a string representation of the discard granularity.
type ID ¶
type ID string
ID identifies a device within a PCI Express topology.
By convention downstream devices often use an ID that has the upstream device ID as its prefix.
func (ID) Downstream ¶
Downstream returns a downstream child ID derived from id.
type Network ¶
type Network struct {
// contains filtered or unexported fields
}
Network is a PCI Express Virtio Network Controller device.
Example ¶
package main import ( "fmt" "github.com/gentlemanautomaton/machina/qemu/qdev" "github.com/gentlemanautomaton/machina/qemu/qhost" ) func main() { var ( host qhost.Resources topo qdev.Topology ) // Prepare a network tap that connects to the kvmbr0 interface tap, err := host.AddNetworkTap("kvmbr0", "", "") if err != nil { panic(err) } // Add a PCI Express Root Port that we'll connect the Network Controller to root, err := topo.AddRoot() if err != nil { panic(err) } // Add the Network Controller and connect it to the host network tap if _, err := root.AddVirtioNetwork("00:00:00:00:00:00", tap); err != nil { panic(err) } // Print the configuration options := topo.Options() for _, option := range options { fmt.Printf("%s\n", option) } }
Output: -device ioh3420,id=pcie.1.0,chassis=0,bus=pcie.0,addr=1.0,multifunction=on -device virtio-net-pci,bus=pcie.1.0,mac=00:00:00:00:00:00,netdev=net.0
func (Network) Driver ¶
Driver returns the driver used for the Network Controller device, virtio-net-pci.
func (Network) Properties ¶
func (n Network) Properties() Properties
Properties returns the properties of the Network Controller device.
type PVPanic ¶
type PVPanic struct {
// contains filtered or unexported fields
}
PVPanic is a paravirtualized panic PCI device.
func (PVPanic) Driver ¶
Driver returns the driver for the paravirtualized panic PCI device, pvpanic-pci.
func (PVPanic) Properties ¶
func (p PVPanic) Properties() Properties
Properties returns the properties of the paravirtualized panic PCI device.
type Properties ¶
type Properties = qemu.Parameters
Properties holds a set of QEMU device properties.
type QXL ¶
type QXL struct {
// contains filtered or unexported fields
}
QXL is a QXL display device.
Example ¶
package main import ( "fmt" "github.com/gentlemanautomaton/machina/qemu/qdev" ) func main() { var topo qdev.Topology const heads = 2 for i := 0; i < heads; i++ { // Add QXL display devices directly to the root complex if _, err := topo.AddQXL(); err != nil { panic(err) } } // Print the configuration options := topo.Options() for _, option := range options { fmt.Printf("%s\n", option) } }
Output: -device qxl-vga,id=qxl.0,bus=pcie.0,addr=1.0,multifunction=on -device qxl,id=qxl.1,bus=pcie.0,addr=1.1
func (QXL) Driver ¶
Driver returns the driver for the QXL display device, qxl-vga for primary devices and qxl for secondary devices.
func (QXL) Properties ¶
func (qxl QXL) Properties() Properties
Properties returns the properties of the QXL display device.
type Root ¶
type Root struct {
// contains filtered or unexported fields
}
Root represents a PCI Express Root Port device. It connects a single downstream device to a PCI Express Root Complex.
func (*Root) AddUSB ¶
AddUSB connects a PCI Express xHCI Controller device to the PCI Express Root Port.
func (*Root) AddVFIO ¶
AddVFIO connects a PCI device on the host to the PCI Express Root Port.
The connection is made with the Virtual Function I/O framework. It relies on an I/O Memory Management Unit on the host, which allows the device to be passed through while isolating the guest from the host.
func (*Root) AddVirtioBlock ¶
func (r *Root) AddVirtioBlock(thread qhost.IOThread, bdev blockdev.Node, options ...BlockOption) (Block, error)
AddVirtioBlock connects a PCI Express Virtio Block device to the PCI Express Root Port.
func (*Root) AddVirtioNetwork ¶
AddVirtioNetwork connects a PCI Express Virtio Network controller to the PCI Express Root Port.
TODO: Consider naming this AddNetwork.
func (*Root) AddVirtioSCSI ¶
AddVirtioSCSI connects a PCI Express Virtio SCSI controller to the PCI Express Root Port.
TODO: Consider naming this AddSCSI.
func (*Root) AddVirtioSerial ¶
AddVirtioSerial connects a PCI Express Virtio Serial controller to the PCI Express Root Port.
TODO: Consider naming this AddSerial.
func (*Root) Connect ¶
Connect connects a device to the PCI Express Root Port.
This function should only be used for custom devices not already supplied by the qdev package. Use of the Root.Add* functions are preferred because they take care of bus assignments and are safer for common use cases.
It is the caller's responsibility to properly configure the bus of the connected device.
func (Root) Downstream ¶
Downstream returns the downstream device connected to the PCI Express root port.
It returns nil if a downstream device hasn't been connected.
func (Root) Driver ¶
Driver returns the driver for the PCI Express Root Port device, ioh3420.
TODO: Consider using pcie-root-port instead.
TODO: Find some sort of documentation for pcie-root-port, somewhere. Anywhere. Any documentation at all would be really great.
TODO: Find out why this patch wasn't merged: https://patchwork.kernel.org/project/qemu-devel/patch/20170802155113.62471-1-marcel@redhat.com/
func (Root) Properties ¶
func (r Root) Properties() Properties
Properties returns the properties of the PCI Express Root Port device.
type SATACD ¶
type SATACD struct {
// contains filtered or unexported fields
}
SATACD is a SATA CD-ROM device.
func (SATACD) Driver ¶
Driver returns the driver for the SATA CD device, ide-cd.
The Q35 machine foolishly uses "ide" as the identifier for its AHCI bus that's built into its ICH9 controller. As such, ide-cd devices are actually interpreted as SATA CD devices on this architecture.
func (SATACD) Properties ¶
func (cd SATACD) Properties() Properties
Properties returns the properties of the SATA CD device.
type SCSI ¶
type SCSI struct {
// contains filtered or unexported fields
}
SCSI is a Virtio SCSI Controller device.
Example ¶
package main import ( "fmt" "github.com/gentlemanautomaton/machina/qemu/qdev" "github.com/gentlemanautomaton/machina/qemu/qhost" "github.com/gentlemanautomaton/machina/qemu/qhost/blockdev" ) func main() { var ( host qhost.Resources topo qdev.Topology ) // Allocate an I/O thread for the SCSI Controller to use. ioThread, err := host.AddIOThread() if err != nil { panic(err) } // Prepare a block graph the describes the I/O processing for the // disk image on the QEMU host. graph := host.BlockDevs() // We'll refer to the final node in the graph by its node name. name := blockdev.NodeName("testdrive") // Add a file protocol node to the graph that reads and writes to our // disk image. file, err := blockdev.File{ Name: name.Child("file"), Path: blockdev.FilePath("/tmp/test-drive.raw"), }.Connect(graph) if err != nil { panic(err) } // Add a raw format node to the graph that interprets the file data // as a raw image. drive, err := blockdev.Raw{Name: name}.Connect(file) if err != nil { panic(err) } // Add a PCI Express Root Port that we'll connect the SCSI Controller to root, err := topo.AddRoot() if err != nil { panic(err) } // Add a SCSI Controller with the I/O Thread that we prepared earlier scsi, err := root.AddVirtioSCSI(ioThread) if err != nil { panic(err) } // Attach a SCSI Disk to the controller that's backed by the drive we // prepared earlier if _, err := scsi.AddDisk(drive); err != nil { panic(err) } // Print the configuration options := topo.Options() for _, option := range options { fmt.Printf("%s\n", option) } }
Output: -device ioh3420,id=pcie.1.0,chassis=0,bus=pcie.0,addr=1.0,multifunction=on -device virtio-scsi-pci,id=scsi,bus=pcie.1.0,iothread=iothread.0,num_queues=4 -device scsi-hd,id=scsi.0.0,bus=scsi.0,channel=0,scsi-id=0,lun=0,drive=testdrive
func (*SCSI) Driver ¶
Driver returns the driver for the Virtio SCSI Controller device, virtio-scsi-pci.
func (*SCSI) Properties ¶
func (controller *SCSI) Properties() Properties
Properties returns the properties of the Virtio SCSI Controller device.
type SCSICD ¶
type SCSICD struct {
// contains filtered or unexported fields
}
SCSICD is a SCSI CD-ROM device.
func (SCSICD) Properties ¶
func (cd SCSICD) Properties() Properties
Properties returns the properties of the SCSI CD device.
type SCSIHD ¶
type SCSIHD struct {
// contains filtered or unexported fields
}
SCSIHD is a SCSI hard disk device.
func (SCSIHD) Properties ¶
func (disk SCSIHD) Properties() Properties
Properties returns the properties of the SCSI HD device.
type SCSIHDOption ¶
type SCSIHDOption interface {
// contains filtered or unexported methods
}
SCSIHDOption is an option for a SCSI HD device
type Serial ¶
type Serial struct {
// contains filtered or unexported fields
}
Serial is a Virtio Serial Controller device.
func (*Serial) Driver ¶
Driver returns the driver for the Virtio Serial Controller device, virtio-serial-pci.
func (*Serial) Properties ¶
func (controller *Serial) Properties() Properties
Properties returns the properties of the Virtio Serial Controller device.
type SerialNumber ¶
type SerialNumber string
SerialNumber defines a serial number for a QEMU disk device.
type SerialPort ¶
type SerialPort struct {
// contains filtered or unexported fields
}
SerialPort is a Virtio Serial Port device.
func (SerialPort) Driver ¶
func (port SerialPort) Driver() Driver
Driver returns the driver for the Virtio Serial Port device, virtserialport.
func (SerialPort) Properties ¶
func (port SerialPort) Properties() Properties
Properties returns the properties of the Virtio Serial Port device.
type Switch ¶
type Switch interface {
Devices() []Device
}
Switch is implemented by devices capable of hosting zero or more downstream devices.
type TPMCRB ¶
type TPMCRB struct {
// contains filtered or unexported fields
}
TPMCRB is a Trusted Platform Module device that is accessible to the guest through a mapped memory region. It implements the TPM Command Response Buffer specification.
func (TPMCRB) Properties ¶
func (tpm TPMCRB) Properties() Properties
Properties returns the properties of the TPM device.
type TPMTIS ¶
type TPMTIS struct {
// contains filtered or unexported fields
}
TPMTIS is a Trusted Platform Module device that is accessible to the guest through a mapped memory region. It implements the TPM Interface Specification.
func (TPMTIS) Properties ¶
func (tpm TPMTIS) Properties() Properties
Properties returns the properties of the TPM device.
type Topology ¶
type Topology struct {
// contains filtered or unexported fields
}
Topology describes the PCI Express device topology for a virtual machine. It holds a set of PCI Express Root ports present in the PCI Express Root Complex.
To add PCI Express devices, add PCI Express Roots then add devices to those roots.
TODO: Consider representing the PCI Express Root Complex with its own struct.
func (*Topology) AddCDROM ¶
AddCDROM connects a SATA CD-ROM device to the AHCI bus built into the q35 machine's ICH9 controller.
func (*Topology) AddPanic ¶
AddPanic connects a paravirtualized panic device to the PCI Express Root Complex as an integrated PCI device.
func (*Topology) AddQXL ¶
AddQXL connects a PCI Express QXL display device to the PCI Express Root Complex.
func (*Topology) AddRoot ¶
AddRoot adds a new PCI Express Root Port device to the PCI Express Root Complex.
An error is returned if the addition would cause the root complex to exceed MaxRoots.
TODO: Consider allowing the caller to supply a preferred bus address.
func (*Topology) AddTPMCRB ¶
AddTPMCRB connects a Trusted Platform Module device to the machine via memory mapping. The device will implement the TPM Command Response Buffer specification.
func (*Topology) AddTPMTIS ¶
AddTPMTIS connects a Trusted Platform Module device to the machine via memory mapping. The device will implement the TPM Interface Specification.
type USB ¶
type USB struct {
// contains filtered or unexported fields
}
USB is a PCI Express xHCI Controller device.
Example ¶
package main import ( "fmt" "github.com/gentlemanautomaton/machina/qemu/qdev" ) func main() { var topo qdev.Topology // Add a PCI Express Root Port that we'll connect the USB Controller to root, err := topo.AddRoot() if err != nil { panic(err) } // Add a USB Controller usb, err := root.AddUSB() if err != nil { panic(err) } // Attach a USB Tablet to the controller if _, err := usb.AddTablet(); err != nil { panic(err) } // Print the configuration options := topo.Options() for _, option := range options { fmt.Printf("%s\n", option) } }
Output: -device ioh3420,id=pcie.1.0,chassis=0,bus=pcie.0,addr=1.0,multifunction=on -device qemu-xhci,id=usb,bus=pcie.1.0,p2=4,p3=4 -device usb-tablet,id=usb.0.1,bus=usb.0,port=1
func (*USB) AddSCSI ¶
func (controller *USB) AddSCSI() (*USBAttachedSCSI, error)
AddSCSI connects a USB Attached SCSI controller to the xHCI Controller.
func (*USB) AddStorage ¶
func (controller *USB) AddStorage(bdev blockdev.Node) (USBStorage, error)
AddStorage connects a USB Storage device to the xHCI Controller.
func (*USB) Properties ¶
func (controller *USB) Properties() Properties
Properties returns the properties of the xHCI Controller device.
type USBAttachedSCSI ¶
type USBAttachedSCSI struct {
// contains filtered or unexported fields
}
USBAttachedSCSI is a USB device that acts as a SCSI controller using the USB Attached SCSI protocol.
Example ¶
package main import ( "fmt" "github.com/gentlemanautomaton/machina/qemu/qdev" "github.com/gentlemanautomaton/machina/qemu/qhost" "github.com/gentlemanautomaton/machina/qemu/qhost/blockdev" ) func main() { var ( resources qhost.Resources topo qdev.Topology ) // Grab a reference to the node graph for block devices. graph := resources.BlockDevs() // Prepare the disk's file protocol block device file, err := blockdev.File{ Name: "uas-disk", Path: "uas-disk.iso", ReadOnly: true, }.Connect(graph) if err != nil { panic(err) } // Add a PCI Express Root Port that we'll connect the USB Controller to root, err := topo.AddRoot() if err != nil { panic(err) } // Add a USB Controller usb, err := root.AddUSB() if err != nil { panic(err) } // Add a USB Attached SCSI Controller to the USB Controller scsi, err := usb.AddSCSI() if err != nil { panic(err) } // Add a SCSI disk to the SCSI controller if _, err := scsi.AddDisk(file); err != nil { panic(err) } // Print the configuration options := append(resources.Options(), topo.Options()...) for _, option := range options { fmt.Printf("%s\n", option) } }
Output: -blockdev driver=file,node-name=uas-disk,read-only=on,filename=uas-disk.iso -device ioh3420,id=pcie.1.0,chassis=0,bus=pcie.0,addr=1.0,multifunction=on -device qemu-xhci,id=usb,bus=pcie.1.0,p2=4,p3=4 -device usb-uas,id=uas,bus=usb.0,port=1 -device scsi-hd,id=uas.0.0,bus=uas.0,channel=0,scsi-id=0,lun=0,drive=uas-disk
func (*USBAttachedSCSI) AddCD ¶
func (controller *USBAttachedSCSI) AddCD(bdev blockdev.Node) (SCSICD, error)
AddCD connects a SCSI CD-ROM device to the Virtio SCSI Controller.
func (*USBAttachedSCSI) AddDisk ¶
func (controller *USBAttachedSCSI) AddDisk(bdev blockdev.Node) (SCSIHD, error)
AddDisk connects a SCSI HD device to the USB SCSI Controller.
func (*USBAttachedSCSI) Devices ¶
func (controller *USBAttachedSCSI) Devices() []Device
Devices returns all of the SCSI devices attached to the controller.
func (*USBAttachedSCSI) Driver ¶
func (controller *USBAttachedSCSI) Driver() Driver
Driver returns the driver for the USB Attached SCSI device, usb-uas.
func (*USBAttachedSCSI) Properties ¶
func (controller *USBAttachedSCSI) Properties() Properties
Properties returns the properties of the USB Redirection device.
type USBRedir ¶
type USBRedir struct {
// contains filtered or unexported fields
}
USBRedir is a USB Redirection device.
Documentation: https://www.spice-space.org/usbredir.html
func (USBRedir) Properties ¶
func (redir USBRedir) Properties() Properties
Properties returns the properties of the USB Redirection device.
type USBStorage ¶
type USBStorage struct {
// contains filtered or unexported fields
}
USBStorage is a USB Storage device.
Documentation: https://www.spice-space.org/usbredir.html
func (USBStorage) Driver ¶
func (redir USBStorage) Driver() Driver
Driver returns the driver for the USB Redirection device, usb-redir.
func (USBStorage) Properties ¶
func (redir USBStorage) Properties() Properties
Properties returns the properties of the USB Redirection device.
type USBTablet ¶
type USBTablet struct {
// contains filtered or unexported fields
}
USBTablet is a USB Tablet device.
func (USBTablet) Properties ¶
func (tablet USBTablet) Properties() Properties
Properties returns the properties of the USB Tablet device.
type Upstream ¶
type Upstream interface {
Downstream() Device
}
Upstream is implemented by devices capable of hosting a single downstream device.
type VFIO ¶
type VFIO struct {
// contains filtered or unexported fields
}
VFIO is a VFIO PCI passthrough device.
Example ¶
package main import ( "fmt" "github.com/gentlemanautomaton/machina/qemu/qdev" ) func main() { var topo qdev.Topology // Add a PCI Express Root Port that we'll connect the device to root, err := topo.AddRoot() if err != nil { panic(err) } // Add a VFIO PCI passthrough device to the root port if _, err := root.AddVFIO("/sys/bus/mdev/devices/79db70f1-92a5-4879-95f7-6325b66c1ff9"); err != nil { panic(err) } // Print the configuration options := topo.Options() for _, option := range options { fmt.Printf("%s\n", option) } }
Output: -device ioh3420,id=pcie.1.0,chassis=0,bus=pcie.0,addr=1.0,multifunction=on -device vfio-pci,id=vfio.0,bus=pcie.1.0,sysfsdev=/sys/bus/mdev/devices/79db70f1-92a5-4879-95f7-6325b66c1ff9
func (VFIO) Properties ¶
func (vfio VFIO) Properties() Properties
Properties returns the properties of the QXL display device.