Documentation
¶
Overview ¶
Package vfio is the runtime attach interface for VFIO PCI passthrough (GPU, NIC, NVMe). Attach is runtime-only — devices don't persist past VM stop; host IOMMU + vfio-pci binding are the user's job.
Index ¶
Constants ¶
View Source
const SysfsPCIPrefix = "/sys/bus/pci/devices/"
SysfsPCIPrefix is the canonical host path for a PCI device.
Variables ¶
View Source
var ( // ErrUnsupportedBackend signals the resolved hypervisor backend cannot // hot-plug VFIO devices (e.g. Firecracker). ErrUnsupportedBackend = errors.New("backend does not support device attach") )
Functions ¶
func NormalizePath ¶
NormalizePath maps {short BDF, full BDF, sysfs path} → canonical /sys/bus/pci/devices/<bdf>; rejects paths outside that root.
Types ¶
type Attacher ¶
type Attacher interface {
DeviceAttach(ctx context.Context, vmRef string, spec Spec) (deviceID string, err error)
DeviceDetach(ctx context.Context, vmRef, id string) error
}
Attacher hot-plugs and removes VFIO PCI passthrough devices.
type Spec ¶
Spec is one attach request. PCI may be a short BDF, full BDF, or a sysfs path; NormalizePath canonicalizes it.
func (*Spec) NormalizedPath ¶
NormalizedPath validates the spec and returns the canonical sysfs path; existence is checked at attach time.
Click to show internal directories.
Click to hide internal directories.