nvpci

package
v0.0.0-...-cc0dadb Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigSpace

type ConfigSpace struct {
	Path string
}

ConfigSpace PCI configuration space (standard extended) file path

func (*ConfigSpace) Read

func (cs *ConfigSpace) Read() (ConfigSpaceIO, error)

type ConfigSpaceIO

type ConfigSpaceIO interface {
	bytes.Bytes
	GetVendorID() uint16
	GetDeviceID() uint16
	GetPCICapabilities() (*PCICapabilities, error)
}

ConfigSpaceIO Interface for reading and writing raw and preconfigured values

type Interface

type Interface interface {
	GetAllDevices() ([]*NvidiaPCIDevice, error)
	Get3DControllers() ([]*NvidiaPCIDevice, error)
	GetVGAControllers() ([]*NvidiaPCIDevice, error)
	GetNVSwitches() ([]*NvidiaPCIDevice, error)
	GetGPUs() ([]*NvidiaPCIDevice, error)
}

Interface allows us to get a list of all NVIDIA PCI devices

func New

func New() Interface

New interface that allows us to get a list of all NVIDIA PCI devices

type MemoryResource

type MemoryResource struct {
	Start uintptr
	End   uintptr
	Flags uint64
	Path  string
}

MemoryResource represents a mmio region

func (*MemoryResource) OpenRO

func (mr *MemoryResource) OpenRO() (mmio.Mmio, error)

OpenRO read only mmio region

func (*MemoryResource) OpenRW

func (mr *MemoryResource) OpenRW() (mmio.Mmio, error)

OpenRW read write mmio region

type MockNvpci

type MockNvpci struct {
	// contains filtered or unexported fields
}

MockNvpci mock pci device

func NewMockNvpci

func NewMockNvpci() (mock *MockNvpci, rerr error)

NewMockNvpci create new mock PCI and remove old devices

func (*MockNvpci) AddMockA100

func (m *MockNvpci) AddMockA100(address string, numaNode int) error

AddMockA100 Create an A100 like GPU mock device

func (*MockNvpci) Cleanup

func (m *MockNvpci) Cleanup()

Cleanup remove the mocked PCI devices root folder

func (MockNvpci) Get3DControllers

func (p MockNvpci) Get3DControllers() ([]*NvidiaPCIDevice, error)

Get3DControllers returns all NVIDIA 3D Controller PCI devices on the system

func (MockNvpci) GetAllDevices

func (p MockNvpci) GetAllDevices() ([]*NvidiaPCIDevice, error)

GetAllDevices returns all Nvidia PCI devices on the system

func (MockNvpci) GetGPUs

func (p MockNvpci) GetGPUs() ([]*NvidiaPCIDevice, error)

GetGPUs returns all NVIDIA GPU devices on the system

func (MockNvpci) GetNVSwitches

func (p MockNvpci) GetNVSwitches() ([]*NvidiaPCIDevice, error)

GetNVSwitches returns all NVIDIA NVSwitch PCI devices on the system

func (MockNvpci) GetVGAControllers

func (p MockNvpci) GetVGAControllers() ([]*NvidiaPCIDevice, error)

GetVGAControllers returns all NVIDIA VGA Controller PCI devices on the system

type NvidiaPCIDevice

type NvidiaPCIDevice struct {
	Path      string
	Address   string
	Vendor    uint16
	Class     uint32
	Device    uint16
	NumaNode  int
	Config    *ConfigSpace
	Resources map[int]*MemoryResource
}

NvidiaPCIDevice represents a PCI device for an NVIDIA product

func (*NvidiaPCIDevice) Is3DController

func (d *NvidiaPCIDevice) Is3DController() bool

Is3DController if class == 0x302

func (*NvidiaPCIDevice) IsGPU

func (d *NvidiaPCIDevice) IsGPU() bool

IsGPU either VGA for older cards or 3D for newer

func (*NvidiaPCIDevice) IsNVSwitch

func (d *NvidiaPCIDevice) IsNVSwitch() bool

IsNVSwitch if classe == 0x068

func (*NvidiaPCIDevice) IsResetAvailable

func (d *NvidiaPCIDevice) IsResetAvailable() bool

IsResetAvailable some devices can be reset without rebooting, check if applicable

func (*NvidiaPCIDevice) IsVGAController

func (d *NvidiaPCIDevice) IsVGAController() bool

IsVGAController if class == 0x300

func (*NvidiaPCIDevice) Reset

func (d *NvidiaPCIDevice) Reset() error

Reset perform a reset to apply a new configuration at HW level

type PCICapabilities

type PCICapabilities struct {
	Standard map[uint8]*PCIStandardCapability
	Extended map[uint16]*PCIExtendedCapability
}

PCICapabilities combines the standard and extended config space

type PCIExtendedCapability

type PCIExtendedCapability struct {
	bytes.Bytes
	Version uint8
}

PCIExtendedCapability extended PCI config space

type PCIStandardCapability

type PCIStandardCapability struct {
	bytes.Bytes
}

PCIStandardCapability standard PCI config space

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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