fpga

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DFL_FPGA_GET_API_VERSION      = 0xb600
	DFL_FPGA_CHECK_EXTENSION      = 0xb601
	DFL_FPGA_PORT_RESET           = 0xb640
	DFL_FPGA_PORT_GET_INFO        = 0xb641
	DFL_FPGA_PORT_GET_REGION_INFO = 0xb642
	DFL_FPGA_PORT_DMA_MAP         = 0xb643
	DFL_FPGA_PORT_DMA_UNMAP       = 0xb644
	DFL_FPGA_FME_PORT_PR          = 0xb680
	DFL_FPGA_FME_PORT_RELEASE     = 0x4004b681
	DFL_FPGA_FME_PORT_ASSIGN      = 0x4004b682

	DFL_PORT_REGION_READ  = 0x1
	DFL_PORT_REGION_WRITE = 0x2
	DFL_PORT_REGION_MMAP  = 0x4

	DFL_PORT_REGION_INDEX_AFU = 0x0
	DFL_PORT_REGION_INDEX_STP = 0x1
)
View Source
const (
	FPGA_GET_API_VERSION         = 0xb500
	FPGA_CHECK_EXTENSION         = 0xb501
	FPGA_PORT_RESET              = 0xb540
	FPGA_PORT_GET_INFO           = 0xb541
	FPGA_PORT_GET_REGION_INFO    = 0xb542
	FPGA_PORT_DMA_MAP            = 0xb543
	FPGA_PORT_DMA_UNMAP          = 0xb544
	FPGA_PORT_UMSG_ENABLE        = 0xb545
	FPGA_PORT_UMSG_DISABLE       = 0xb546
	FPGA_PORT_UMSG_SET_MODE      = 0xb547
	FPGA_PORT_UMSG_SET_BASE_ADDR = 0xb548
	FPGA_PORT_ERR_SET_IRQ        = 0xb549
	FPGA_PORT_UAFU_SET_IRQ       = 0xb54a
	FPGA_FME_PORT_PR             = 0xb580
	FPGA_FME_PORT_RELEASE        = 0xb581
	FPGA_FME_PORT_ASSIGN         = 0xb582
	FPGA_FME_GET_INFO            = 0xb583
	FPGA_FME_ERR_SET_IRQ         = 0xb584

	FPGA_PORT_CAP_ERR_IRQ  = 0x1
	FPGA_PORT_CAP_UAFU_IRQ = 0x2

	FPGA_REGION_READ  = 0x1
	FPGA_REGION_WRITE = 0x2
	FPGA_REGION_MMAP  = 0x4

	FPGA_PORT_INDEX_UAFU = 0x0
	FPGA_PORT_INDEX_STP  = 0x1

	FPGA_DMA_TO_DEV   = 0x1
	FPGA_DMA_FROM_DEV = 0x2

	FPGA_FME_CAP_ERR_IRQ = 0x1
)

Variables

This section is empty.

Functions

func CanonizeID

func CanonizeID(ID string) string

CanonizeID canonizes Interface and AFU ids.

func FindSysFsDevice

func FindSysFsDevice(dev string) (string, error)

FindSysFsDevice returns sysfs entry for specified device node or device that holds specified file If resulted device is virtual, error is returned.

func GetAfuDevType added in v0.18.0

func GetAfuDevType(interfaceID, afuID string) (string, error)

GetAfuDevType returns extended resource name for AFU without namespace. Since in Linux unix socket addresses can't be longer than 108 chars we need to compress devtype a bit, because it's used as a part of the socket's address. Also names of extended resources (without namespace) cannot be longer than 63 characters.

func IsFpgaFME

func IsFpgaFME(name string) bool

IsFpgaFME returns true if the name looks like any supported FME device.

func IsFpgaPort

func IsFpgaPort(name string) bool

IsFpgaPort returns true if the name looks like any supported FME device.

func ListFpgaDevices

func ListFpgaDevices() (FMEs, Ports []string)

ListFpgaDevices returns two lists of FPGA device nodes: FMEs and Ports.

Types

type DflFME

type DflFME struct {
	FME
	DevPath           string
	SysFsPath         string
	Name              string
	PCIDevice         *PCIDevice
	SocketID          string
	Dev               string
	CompatID          string
	BitstreamID       string
	BitstreamMetadata string
	PortsNum          string
}

DflFME represent DFL FPGA FME device.

func (*DflFME) CheckExtension

func (f *DflFME) CheckExtension() (int, error)

CheckExtension Check whether an extension is supported. * Return: 0 if not supported, otherwise the extension is supported.

func (*DflFME) Close

func (f *DflFME) Close() error

Close closes open device.

func (*DflFME) GetAPIVersion

func (f *DflFME) GetAPIVersion() (int, error)

GetAPIVersion Report the version of the driver API. * Return: Driver API Version.

func (*DflFME) GetBitstreamID

func (f *DflFME) GetBitstreamID() string

GetBitstreamID returns FME bitstream id.

func (*DflFME) GetBitstreamMetadata

func (f *DflFME) GetBitstreamMetadata() string

GetBitstreamMetadata returns FME bitstream metadata.

func (*DflFME) GetDevPath

func (f *DflFME) GetDevPath() string

GetDevPath returns path to device node.

func (*DflFME) GetInterfaceUUID

func (f *DflFME) GetInterfaceUUID() (id string)

GetInterfaceUUID returns Interface UUID for FME.

func (*DflFME) GetName

func (f *DflFME) GetName() string

GetName returns simple FPGA name, derived from sysfs entry, can be used with /dev/ or /sys/bus/platform/.

func (*DflFME) GetPCIDevice

func (f *DflFME) GetPCIDevice() (*PCIDevice, error)

GetPCIDevice returns PCIDevice for this device.

func (*DflFME) GetPortsNum

func (f *DflFME) GetPortsNum() int

GetPortsNum returns amount of FPGA Ports associated to this FME.

func (*DflFME) GetSocketID

func (f *DflFME) GetSocketID() (uint32, error)

GetSocketID returns physical socket number, in case NUMA enumeration fails.

func (*DflFME) GetSysFsPath

func (f *DflFME) GetSysFsPath() string

GetSysFsPath returns sysfs entry for FPGA FME or Port (e.g. can be used for custom errors/perf items).

func (*DflFME) PortPR

func (f *DflFME) PortPR(port uint32, bitstream []byte) error

PortPR does Partial Reconfiguration based on Port ID and Buffer (Image) provided by caller.

  • Return: 0 on success, -errno on failure.
  • If DFL_FPGA_FME_PORT_PR returns -EIO, that indicates the HW has detected some errors during PR, under this case, the user can fetch HW error info from the status of FME's fpga manager.

type DflFpgaFmePortPR

type DflFpgaFmePortPR struct {
	Argsz          uint32
	Flags          uint32
	Port_id        uint32
	Buffer_size    uint32
	Buffer_address uint64
}

type DflFpgaPortDMAMap

type DflFpgaPortDMAMap struct {
	Argsz  uint32
	Flags  uint32
	Addr   uint64
	Length uint64
	Iova   uint64
}

type DflFpgaPortDMAUnmap

type DflFpgaPortDMAUnmap struct {
	Argsz uint32
	Flags uint32
	Iova  uint64
}

type DflFpgaPortInfo

type DflFpgaPortInfo struct {
	Argsz   uint32
	Flags   uint32
	Regions uint32
	Umsgs   uint32
}

type DflFpgaPortRegionInfo

type DflFpgaPortRegionInfo struct {
	Argsz   uint32
	Flags   uint32
	Index   uint32
	Padding uint32
	Size    uint64
	Offset  uint64
}

type DflPort

type DflPort struct {
	Port
	DevPath   string
	SysFsPath string
	Name      string
	PCIDevice *PCIDevice
	Dev       string
	AFUID     string
	ID        string
	FME       FME
}

DflPort represent DFL FPGA Port device.

func (*DflPort) CheckExtension

func (f *DflPort) CheckExtension() (int, error)

CheckExtension Check whether an extension is supported. * Return: 0 if not supported, otherwise the extension is supported.

func (*DflPort) Close

func (f *DflPort) Close() error

Close closes open device.

func (*DflPort) GetAPIVersion

func (f *DflPort) GetAPIVersion() (int, error)

GetAPIVersion Report the version of the driver API. * Return: Driver API Version.

func (*DflPort) GetAcceleratorTypeUUID

func (f *DflPort) GetAcceleratorTypeUUID() (afuID string)

GetAcceleratorTypeUUID returns AFU UUID for port.

func (*DflPort) GetDevPath

func (f *DflPort) GetDevPath() string

GetDevPath returns path to device node.

func (*DflPort) GetFME

func (f *DflPort) GetFME() (fme FME, err error)

GetFME returns FPGA FME device for this port.

func (*DflPort) GetInterfaceUUID

func (f *DflPort) GetInterfaceUUID() (id string)

GetInterfaceUUID returns Interface UUID for FME.

func (*DflPort) GetName

func (f *DflPort) GetName() string

GetName returns simple FPGA name, derived from sysfs entry, can be used with /dev/ or /sys/bus/platform/.

func (*DflPort) GetPCIDevice

func (f *DflPort) GetPCIDevice() (*PCIDevice, error)

GetPCIDevice returns PCIDevice for this device.

func (*DflPort) GetPortID

func (f *DflPort) GetPortID() (uint32, error)

GetPortID returns ID of the FPGA port within physical device.

func (*DflPort) GetSysFsPath

func (f *DflPort) GetSysFsPath() string

GetSysFsPath returns sysfs entry for FPGA FME or Port (e.g. can be used for custom errors/perf items).

func (*DflPort) PR

func (f *DflPort) PR(bs bitstream.File, dryRun bool) error

PR programs specified bitstream to port.

func (*DflPort) PortGetInfo

func (f *DflPort) PortGetInfo() (ret PortInfo, err error)

PortGetInfo Retrieve information about the fpga port. Driver fills the info in provided struct dfl_fpga_port_info. * Return: 0 on success, -errno on failure.

func (*DflPort) PortGetRegionInfo

func (f *DflPort) PortGetRegionInfo(index uint32) (ret PortRegionInfo, err error)

PortGetRegionInfo Retrieve information about the fpga port. * Retrieve information about a device memory region. * Caller provides struct dfl_fpga_port_region_info with index value set. * Driver returns the region info in other fields. * Return: 0 on success, -errno on failure.

func (*DflPort) PortReset

func (f *DflPort) PortReset() error

PortReset Reset the FPGA Port and its AFU. No parameters are supported. Userspace can do Port reset at any time, e.g. during DMA or PR. But it should never cause any system level issue, only functional failure (e.g. DMA or PR operation failure) and be recoverable from the failure. * Return: 0 on success, -errno of failure.

type FME

type FME interface {

	// PortPR does Partial Reconfiguration based on Port ID and Buffer (Image)
	// provided by caller.
	// * Return: 0 on success, -errno on failure.
	// * If DFL_FPGA_FME_PORT_PR returns -EIO, that indicates the HW has detected
	//   some errors during PR, under this case, the user can fetch HW error info
	//   from the status of FME's fpga manager.
	PortPR(uint32, []byte) error

	// GetPortsNum returns amount of FPGA Ports associated to this FME
	GetPortsNum() int
	// InterfaceUUID returns Interface UUID for FME
	GetInterfaceUUID() string
	// GetSocketID returns physical socket number, in case NUMA enumeration fails
	GetSocketID() (uint32, error)
	// GetBitstreamID returns FME bitstream id
	GetBitstreamID() string
	// GetBitstreamMetadata returns FME bitstream metadata
	GetBitstreamMetadata() string
	// contains filtered or unexported methods
}

FME represent interfaces provided by management interface of FPGA.

func NewDflFME

func NewDflFME(dev string) (FME, error)

NewDflFME Opens device.

func NewFME

func NewFME(fname string) (FME, error)

NewFME returns FME for specified device node.

func NewIntelFpgaFME

func NewIntelFpgaFME(dev string) (FME, error)

NewIntelFpgaFME Opens device.

type IntelFpgaFME

type IntelFpgaFME struct {
	FME
	DevPath           string
	SysFsPath         string
	Name              string
	PCIDevice         *PCIDevice
	SocketID          string
	Dev               string
	CompatID          string
	BitstreamID       string
	BitstreamMetadata string
	PortsNum          string
}

IntelFpgaFME represent Intel FPGA FME device.

func (*IntelFpgaFME) CheckExtension

func (f *IntelFpgaFME) CheckExtension() (int, error)

CheckExtension Check whether an extension is supported. * Return: 0 if not supported, otherwise the extension is supported.

func (*IntelFpgaFME) Close

func (f *IntelFpgaFME) Close() error

Close closes open device.

func (*IntelFpgaFME) GetAPIVersion

func (f *IntelFpgaFME) GetAPIVersion() (int, error)

GetAPIVersion Report the version of the driver API. * Return: Driver API Version.

func (*IntelFpgaFME) GetBitstreamID

func (f *IntelFpgaFME) GetBitstreamID() string

GetBitstreamID returns FME bitstream id.

func (*IntelFpgaFME) GetBitstreamMetadata

func (f *IntelFpgaFME) GetBitstreamMetadata() string

GetBitstreamMetadata returns FME bitstream metadata.

func (*IntelFpgaFME) GetDevPath

func (f *IntelFpgaFME) GetDevPath() string

GetDevPath returns path to device node.

func (*IntelFpgaFME) GetInterfaceUUID

func (f *IntelFpgaFME) GetInterfaceUUID() (id string)

GetInterfaceUUID returns Interface UUID for FME.

func (*IntelFpgaFME) GetName

func (f *IntelFpgaFME) GetName() string

GetName returns simple FPGA name, derived from sysfs entry, can be used with /dev/ or /sys/bus/platform/.

func (*IntelFpgaFME) GetPCIDevice

func (f *IntelFpgaFME) GetPCIDevice() (*PCIDevice, error)

GetPCIDevice returns PCIDevice for this device.

func (*IntelFpgaFME) GetPortsNum

func (f *IntelFpgaFME) GetPortsNum() int

GetPortsNum returns amount of FPGA Ports associated to this FME.

func (*IntelFpgaFME) GetSocketID

func (f *IntelFpgaFME) GetSocketID() (uint32, error)

GetSocketID returns physical socket number, in case NUMA enumeration fails.

func (*IntelFpgaFME) GetSysFsPath

func (f *IntelFpgaFME) GetSysFsPath() string

GetSysFsPath returns sysfs entry for FPGA FME or Port (e.g. can be used for custom errors/perf items).

func (*IntelFpgaFME) PortPR

func (f *IntelFpgaFME) PortPR(port uint32, bitstream []byte) error

PortPR does Partial Reconfiguration based on Port ID and Buffer (Image) provided by caller.

  • Return: 0 on success, -errno on failure.
  • If IntelFpga_FPGA_FME_PORT_PR returns -EIO, that indicates the HW has detected some errors during PR, under this case, the user can fetch HW error info from the status of FME's fpga manager.

type IntelFpgaFmeErrIrqSet

type IntelFpgaFmeErrIrqSet struct {
	Argsz uint32
	Flags uint32
	Evtfd int32
}

type IntelFpgaFmeInfo

type IntelFpgaFmeInfo struct {
	Argsz      uint32
	Flags      uint32
	Capability uint32
}

type IntelFpgaFmePortAssign

type IntelFpgaFmePortAssign struct {
	Argsz uint32
	Flags uint32
	Id    uint32
}

type IntelFpgaFmePortPR

type IntelFpgaFmePortPR struct {
	Argsz          uint32
	Flags          uint32
	Port_id        uint32
	Buffer_size    uint32
	Buffer_address uint64
	Status         uint64
}

type IntelFpgaFmePortRelease

type IntelFpgaFmePortRelease struct {
	Argsz uint32
	Flags uint32
	Id    uint32
}

type IntelFpgaPort

type IntelFpgaPort struct {
	Port
	DevPath   string
	SysFsPath string
	Name      string
	PCIDevice *PCIDevice
	Dev       string
	AFUID     string
	ID        string
	FME       FME
}

IntelFpgaPort represent IntelFpga FPGA Port device.

func (*IntelFpgaPort) CheckExtension

func (f *IntelFpgaPort) CheckExtension() (int, error)

CheckExtension Check whether an extension is supported. * Return: 0 if not supported, otherwise the extension is supported.

func (*IntelFpgaPort) Close

func (f *IntelFpgaPort) Close() error

Close closes open device.

func (*IntelFpgaPort) GetAPIVersion

func (f *IntelFpgaPort) GetAPIVersion() (int, error)

GetAPIVersion Report the version of the driver API. * Return: Driver API Version.

func (*IntelFpgaPort) GetAcceleratorTypeUUID

func (f *IntelFpgaPort) GetAcceleratorTypeUUID() string

GetAcceleratorTypeUUID returns AFU UUID for port.

func (*IntelFpgaPort) GetDevPath

func (f *IntelFpgaPort) GetDevPath() string

GetDevPath returns path to device node.

func (*IntelFpgaPort) GetFME

func (f *IntelFpgaPort) GetFME() (fme FME, err error)

GetFME returns FPGA FME device for this port.

func (*IntelFpgaPort) GetInterfaceUUID

func (f *IntelFpgaPort) GetInterfaceUUID() (id string)

GetInterfaceUUID returns Interface UUID for FME.

func (*IntelFpgaPort) GetName

func (f *IntelFpgaPort) GetName() string

GetName returns simple FPGA name, derived from sysfs entry, can be used with /dev/ or /sys/bus/platform/.

func (*IntelFpgaPort) GetPCIDevice

func (f *IntelFpgaPort) GetPCIDevice() (*PCIDevice, error)

GetPCIDevice returns PCIDevice for this device.

func (*IntelFpgaPort) GetPortID

func (f *IntelFpgaPort) GetPortID() (uint32, error)

GetPortID returns ID of the FPGA port within physical device.

func (*IntelFpgaPort) GetSysFsPath

func (f *IntelFpgaPort) GetSysFsPath() string

GetSysFsPath returns sysfs entry for FPGA FME or Port (e.g. can be used for custom errors/perf items).

func (*IntelFpgaPort) PR

func (f *IntelFpgaPort) PR(bs bitstream.File, dryRun bool) error

PR programs specified bitstream to port.

func (*IntelFpgaPort) PortGetInfo

func (f *IntelFpgaPort) PortGetInfo() (ret PortInfo, err error)

PortGetInfo Retrieve information about the fpga port. Driver fills the info in provided struct IntelFpga_fpga_port_info. * Return: 0 on success, -errno on failure.

func (*IntelFpgaPort) PortGetRegionInfo

func (f *IntelFpgaPort) PortGetRegionInfo(index uint32) (ret PortRegionInfo, err error)

PortGetRegionInfo Retrieve information about the fpga port. * Retrieve information about a device memory region. * Caller provides struct IntelFpga_fpga_port_region_info with index value set. * Driver returns the region info in other fields. * Return: 0 on success, -errno on failure.

func (*IntelFpgaPort) PortReset

func (f *IntelFpgaPort) PortReset() error

PortReset Reset the FPGA Port and its AFU. No parameters are supported. Userspace can do Port reset at any time, e.g. during DMA or PR. But it should never cause any system level issue, only functional failure (e.g. DMA or PR operation failure) and be recoverable from the failure. * Return: 0 on success, -errno of failure.

type IntelFpgaPortDmaMap

type IntelFpgaPortDmaMap struct {
	Argsz  uint32
	Flags  uint32
	Addr   uint64
	Length uint64
	Iova   uint64
}

type IntelFpgaPortDmaUnmap

type IntelFpgaPortDmaUnmap struct {
	Argsz uint32
	Flags uint32
	Iova  uint64
}

type IntelFpgaPortErrIrqSet

type IntelFpgaPortErrIrqSet struct {
	Argsz uint32
	Flags uint32
	Evtfd int32
}

type IntelFpgaPortInfo

type IntelFpgaPortInfo struct {
	Argsz      uint32
	Flags      uint32
	Capability uint32
	Regions    uint32
	Umsgs      uint32
	Uafu_irqs  uint32
}

type IntelFpgaPortRegionInfo

type IntelFpgaPortRegionInfo struct {
	Argsz   uint32
	Flags   uint32
	Index   uint32
	Padding uint32
	Size    uint64
	Offset  uint64
}

type IntelFpgaPortUafuIrqSet

type IntelFpgaPortUafuIrqSet struct {
	Argsz uint32
	Flags uint32
	Start uint32
	Count uint32
}

type IntelFpgaPortUmsgBaseAddr

type IntelFpgaPortUmsgBaseAddr struct {
	Argsz uint32
	Flags uint32
	Iova  uint64
}

type IntelFpgaPortUmsgCfg

type IntelFpgaPortUmsgCfg struct {
	Argsz  uint32
	Flags  uint32
	Bitmap uint32
}

type PCIDevice

type PCIDevice struct {
	SysFsPath string
	BDF       string
	Vendor    string
	Device    string
	Class     string
	CPUs      string
	NUMA      string
	VFs       string
	TotalVFs  string
	PhysFn    *PCIDevice
}

PCIDevice represents most valuable sysfs information about PCI device.

func NewPCIDevice

func NewPCIDevice(devPath string) (*PCIDevice, error)

NewPCIDevice returns sysfs entry for specified PCI device.

func (*PCIDevice) GetVFs

func (pci *PCIDevice) GetVFs() (ret []*PCIDevice, err error)

GetVFs returns array of PCI device sysfs entries for VFs.

func (*PCIDevice) NumVFs

func (pci *PCIDevice) NumVFs() int64

NumVFs returns number of configured VFs.

type Port

type Port interface {

	// PortReset Reset the FPGA Port and its AFU. No parameters are supported.
	// Userspace can do Port reset at any time, e.g. during DMA or PR. But
	// it should never cause any system level issue, only functional failure
	// (e.g. DMA or PR operation failure) and be recoverable from the failure.
	// * Return: 0 on success, -errno of failure
	PortReset() error
	// PortGetInfo Retrieve information about the fpga port.
	// Driver fills the info in provided struct dfl_fpga_port_info.
	// * Return: 0 on success, -errno on failure.
	PortGetInfo() (PortInfo, error)
	// PortGetRegionInfo Retrieve information about the fpga port.
	// * Retrieve information about a device memory region.
	// * Caller provides struct dfl_fpga_port_region_info with index value set.
	// * Driver returns the region info in other fields.
	// * Return: 0 on success, -errno on failure.
	PortGetRegionInfo(index uint32) (PortRegionInfo, error)

	// GetFME returns FPGA FME device for this port
	GetFME() (FME, error)
	// GetPortID returns ID of the FPGA port within physical device
	GetPortID() (uint32, error)
	// GetAcceleratorTypeUUID returns AFU UUID for port
	GetAcceleratorTypeUUID() string
	// InterfaceUUID returns Interface UUID for FME
	GetInterfaceUUID() string
	// PR programs specified bitstream to port
	PR(bitstream.File, bool) error
	// contains filtered or unexported methods
}

Port represent interfaces provided by AFU port of FPGA.

func NewDflPort

func NewDflPort(dev string) (Port, error)

NewDflPort Opens device.

func NewIntelFpgaPort

func NewIntelFpgaPort(dev string) (Port, error)

NewIntelFpgaPort Opens device.

func NewPort

func NewPort(fname string) (Port, error)

NewPort returns Port for specified device node.

type PortInfo

type PortInfo struct {
	Flags   uint32
	Regions uint32
	Umsgs   uint32
}

PortInfo is a unified port info between drivers.

type PortRegionInfo

type PortRegionInfo struct {
	Flags  uint32
	Index  uint32
	Size   uint64
	Offset uint64
}

PortRegionInfo is a unified Port Region info between drivers.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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