dsa

package
v0.0.0-...-9bd9f91 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Overview

Package dsa provides some useful types and functions for enable Intel DSA Engine.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeviceReady

func DeviceReady() bool

DeviceReady checks if the device is ready

func LoadContext

func LoadContext() *device.Context

LoadContext load iaa context

Types

type CRCCompletionRecord

type CRCCompletionRecord struct {
	Header    uint64  // Header of the completion record.
	FaultAddr uintptr // Fault address of the completion record.
	CRCValue  uint64
	// contains filtered or unexported fields
}

CRCCompletionRecord is a structure defining a DSA CRC completion record.

func (*CRCCompletionRecord) CheckError

func (r *CRCCompletionRecord) CheckError() error

CheckError checks if error happened, and return wrapped error or nil

func (*CRCCompletionRecord) GetHeader

GetHeader returns the header of a completion record.

type CRCDescriptor

type CRCDescriptor struct {
	Header         uint32  `bf:"pasid 20;reversed 11;priv 1"` // Header of the descriptor.
	FlagsAndOpCode uint32  `bf:"flags 24;opcode 8"`           // Flags and opcode of the descriptor.
	CompletionAddr uintptr // Completion address
	SrcAddr        uintptr // Source address

	Size      uint32 // Transfer Size
	IntHandle uint16 // Interrupt handle

	CRCSeed        uint64 // CRC Seed
	CRCSeedAddress uint64 // CRC Seed Address
	// contains filtered or unexported fields
}

func (CRCDescriptor) GetFlags

func (d CRCDescriptor) GetFlags() Flag

GetFlags returns the flags of a descriptor.

func (CRCDescriptor) GetOpcode

func (d CRCDescriptor) GetOpcode() Opcode

GetOpcode returns the opcode of a descriptor.

func (*CRCDescriptor) SetFlags

func (d *CRCDescriptor) SetFlags(value Flag)

SetFlags sets the flags of a descriptor.

func (*CRCDescriptor) SetOpcode

func (d *CRCDescriptor) SetOpcode(value Opcode)

SetOpcode sets the opcode of a descriptor.

type CompletionRecord

type CompletionRecord struct {
	Header    uint64    // Header of the completion record.
	FaultAddr uintptr   // Fault address of the completion record.
	Record    [16]uint8 // Record of the completion record.
}

CompletionRecord is a structure defining a DSA completion record.

func NewCompletionRecord

func NewCompletionRecord() *CompletionRecord

NewCompletionRecord returns a new completion record.

func (*CompletionRecord) CheckError

func (r *CompletionRecord) CheckError() error

CheckError checks if error happened, and return wrapped error or nil

func (*CompletionRecord) GetHeader

GetHeader returns the header of a completion record.

type Descriptor

type Descriptor struct {
	Header         uint32  `bf:"pasid 20;reversed 11;priv 1"` // Header of the descriptor.
	FlagsAndOpCode uint32  `bf:"flags 24;opcode 8"`           // Flags and opcode of the descriptor.
	CompletionAddr uintptr // Completion address
	SrcAddr        uintptr // Source address
	DestAddr       uintptr // Destination address
	Size           uint32  // Transfer Size
	IntHandle      uint16  // Interrupt handle
	// contains filtered or unexported fields
}

Descriptor is a structure defining a DSA descriptor.

func (Descriptor) GetFlags

func (d Descriptor) GetFlags() Flag

GetFlags returns the flags of a descriptor.

func (Descriptor) GetOpcode

func (d Descriptor) GetOpcode() Opcode

GetOpcode returns the opcode of a descriptor.

func (*Descriptor) SetFlags

func (d *Descriptor) SetFlags(value Flag)

SetFlags sets the flags of a descriptor.

func (*Descriptor) SetOpcode

func (d *Descriptor) SetOpcode(value Opcode)

SetOpcode sets the opcode of a descriptor.

func (*Descriptor) String

func (d *Descriptor) String() string

String returns a string representation of a descriptor.

type Flag

type Flag uint32

Flag is the flag of descriptor.

const (
	// OpFlagFence indicates the device waits for previous descriptors in the same batch to complete before beginning
	// work on this descriptor.
	OpFlagFence Flag = 0x0001
	// OpFlagBlockOnFault indicates the device waits for page faults to be resolved and then continues the operation.
	OpFlagBlockOnFault Flag = 0x0002
	// OpFlagCRAddrValid indicates the completion record address is valid
	OpFlagCRAddrValid Flag = 0x0004
	// OpFlagReqCR indicates the job request a completion record.
	OpFlagReqCR Flag = 0x0008

	OpFlagCacheControl Flag = 0x0100

	OpFlagReadCRCSeed Flag = 0x1 << 15
	OpFlagCRCSize64   Flag = 0b1 << 18
)

type Opcode

type Opcode uint8

Opcode specifies the operation to be executed

const (
	// OpcodeNoOp indicates no operation
	OpcodeNoOp Opcode = 0x00
	// OpcodeBatch indicates the operation is batch.
	OpcodeBatch Opcode = 0x01
	// Drain the queue
	OpcodeDrain Opcode = 0x02
	// OpcodeMemmove indicates that the operation is moving the memory.
	OpcodeMemmove           Opcode = 0x03
	OpcodeMemfill           Opcode = 0x04
	OpcodeCompare           Opcode = 0x05
	OpcodeComparePattern    Opcode = 0x06
	OpcodeCreateDeltaRecord Opcode = 0x07
	OpcodeApplyDeltaRecord  Opcode = 0x08
	OpcodeCopyWithDualcast  Opcode = 0x09
	OpcodeCRCGen            Opcode = 0x10
)

Opcodes which is not used have been commentted out.

type StatusCode

type StatusCode uint8

StatusCode is operation status.

const (
	// StatusNone is the default StatusCode.
	StatusNone StatusCode = iota
	// StatusSuccess means the operation is success.
	StatusSuccess StatusCode = 0x01
	// Success with false predicate
	StatusSuccessPred StatusCode = 0x02
	// Partial completion due to page fault, when the Block on Fault flag in the descriptor is 0.
	StatusPageFaultNoBOF StatusCode = 0x03
	// Partial completion due to an Invalid Request response to a Page Request.
	StatusPageFaultIr StatusCode = 0x04
	// One or more operations in the batch completed with Status not equal to Success. This value is
	// used only for a Batch descriptor
	StatusBatchFail StatusCode = 0x05
	// Partial completion of batch due to page fault while translating the Descriptor List Address in a
	// Batch descriptor and either:
	// - Page Request Services are disabled; or
	// - An Invalid Request response was received for the Page Request for the Descriptor List
	// Address.
	// This value is used only for a Batch descriptor
	StatusBatchPageFault StatusCode = 0x06
	// Offsets in the delta record were not in increasing order. This value is used only for an Apply
	// Delta Record operation.
	StatusDrOffsetNoinc StatusCode = 0x07
	// An offset in the delta record was greater than or equal to the Transfer Size of the descriptor.
	// This value is used only for an Apply Delta Record operation
	StatusDrOffsetErange StatusCode = 0x08
	// DIF error. This value is used for the DIF Check, DIF Strip, and DIF Update operations.
	StatusDIFErr StatusCode = 0x09
	// Unsupported operation code
	StatusBadOpcode StatusCode = 0x10
	// Invalid flags. One or more flags in the descriptor Flags field contain an unsupported or reserved
	// value.
	StatusInvalidFlags StatusCode = 0x11
	// Non-zero reserved field (other than a flag in the Flags field).
	StatusNoZeroReserve StatusCode = 0x12
	// Invalid Transfer Size.
	StatusInvalidTransferSize StatusCode = 0x13
	// Descriptor Count out of range (less than 2 or greater than the maximum batch size for the WQ).
	StatusDescCountOutOfRange StatusCode = 0x14
	// Maximum Delta Record Size or Delta Record Size out of range
	StatusDROutOfRange StatusCode = 0x15
	// Overlapping buffers.
	StatusOverlapBuffers StatusCode = 0x16
	// Bits 11:0 of the two destination buffers differ in Memory Copy with Dualcast
	StatusDcastErr StatusCode = 0x17
	// Misaligned Descriptor List Address
	StatusDescListAlign StatusCode = 0x18
	// Invalid Completion Interrupt Handle.
	// - If the Request Interrupt Handle command is not supported:
	// 		o The handle is out of range of the MSI-X or IMS table.
	// - If the Request Interrupt Handle command is supported:
	// 		o The interrupt handle was not returned by the Request Interrupt Handle command.
	// 		o The interrupt handle has been revoked. See section 3.7.
	// - The PASID Enable and PASID fields in the selected interrupt table entry don’t match
	// those of the descriptor.
	StatusInvalidIntHandle StatusCode = 0x19
	// A page fault occurred while translating a Completion Record Address
	StatusCraXlat StatusCode = 0x1a
	// Completion Record Address is not 32-byte aligned
	StatusCraAlign StatusCode = 0x1b
	// Misaligned address:
	// - In a Create Delta Record or Apply Delta Record operation: Source1 Address, Source2
	// Address, Destination Address, or Transfer Size is not 8-byte aligned.
	// - In a CRC Generation or Copy with CRC Generation operation: CRC Seed Address is not
	// 4-byte aligned.
	StatusAddrAlign StatusCode = 0x1c
	// In a descriptor submitted to an SWQ, Priv is 1 and the Privileged Mode Enable field of the PCI
	// Express PASID capability is 0
	StatusPrivBad StatusCode = 0x1d
	// Incorrect Traffic Class configuration:
	StatusInvalidTrafficClassConf StatusCode = 0x1e
	// A page fault occurred while translating a Readback Address in a Drain descriptor
	StatusPageFaultRADD StatusCode = 0x1f
	// The operation failed due to a hardware error
	StatusHwErr1 StatusCode = 0x20
	// Hardware error (completion timeout or unsuccessful completion status) on a destination
	// readback operation
	StatusHWErrDRB StatusCode = 0x21
	// An error occurred during address translation
	StatusTranslationFail StatusCode = 0x22
)

Completion record status

func (StatusCode) String

func (s StatusCode) String() string

Jump to

Keyboard shortcuts

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