gasket

package
v0.0.0-...-a858404 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2024 License: Apache-2.0, MIT Imports: 9 Imported by: 0

Documentation

Overview

Package gasket describes the userspace interface for Gasket devices.

Index

Constants

This section is empty.

Variables

View Source
var (
	GASKET_IOCTL_BASE                   = uint32(0xDC)
	GASKET_IOCTL_RESET                  = Ioctl(linux.IOW(GASKET_IOCTL_BASE, 0, SizeOfUnsignedLong))
	GASKET_IOCTL_SET_EVENTFD            = Ioctl(linux.IOW(GASKET_IOCTL_BASE, 1, SizeofGasketInterruptEventFd))
	GASKET_IOCTL_CLEAR_EVENTFD          = Ioctl(linux.IOW(GASKET_IOCTL_BASE, 2, SizeOfUnsignedLong))
	GASKET_IOCTL_NUMBER_PAGE_TABLES     = Ioctl(linux.IOR(GASKET_IOCTL_BASE, 4, SizeOfUnsignedLong))
	GASKET_IOCTL_PAGE_TABLE_SIZE        = Ioctl(linux.IOWR(GASKET_IOCTL_BASE, 5, SizeofGasketPageTableIoctl))
	GASKET_IOCTL_SIMPLE_PAGE_TABLE_SIZE = Ioctl(linux.IOWR(GASKET_IOCTL_BASE, 6, SizeofGasketPageTableIoctl))
	GASKET_IOCTL_PARTITION_PAGE_TABLE   = Ioctl(linux.IOW(GASKET_IOCTL_BASE, 7, SizeofGasketPageTableIoctl))
	GASKET_IOCTL_MAP_BUFFER             = Ioctl(linux.IOW(GASKET_IOCTL_BASE, 8, SizeofGasketPageTableIoctl))
	GASKET_IOCTL_UNMAP_BUFFER           = Ioctl(linux.IOW(GASKET_IOCTL_BASE, 9, SizeofGasketPageTableIoctl))
	GASKET_IOCTL_CLEAR_INTERRUPT_COUNTS = Ioctl(linux.IO(GASKET_IOCTL_BASE, 10))
	GASKET_IOCTL_REGISTER_INTERRUPT     = Ioctl(linux.IOW(GASKET_IOCTL_BASE, 11, SizeofGasketInterruptMapping))
	GASKET_IOCTL_UNREGISTER_INTERRUPT   = Ioctl(linux.IOW(GASKET_IOCTL_BASE, 12, SizeOfUnsignedLong))
	GASKET_IOCTL_MAP_DMA_BUF            = Ioctl(linux.IOW(GASKET_IOCTL_BASE, 13, SizeofGasketPageTableDmaBufIoctl))
)

From https://github.com/tensorflow/tpu/blob/master/tools/driver/include/linux/google/gasket.h

View Source
var (
	SizeofGasketInterruptEventFd     = uint32((*GasketInterruptEventFd)(nil).SizeBytes())
	SizeofGasketPageTableIoctl       = uint32((*GasketPageTableIoctl)(nil).SizeBytes())
	SizeofGasketInterruptMapping     = uint32((*GasketInterruptMapping)(nil).SizeBytes())
	SizeofGasketPageTableDmaBufIoctl = uint32((*GasketPageTableDmaBufIoctl)(nil).SizeBytes())
	SizeOfUnsignedLong               = uint32(8)
)

Ioctl parameter struct sizes.

Functions

This section is empty.

Types

type GasketInterruptEventFd

type GasketInterruptEventFd struct {
	Interrupt uint64
	EventFD   uint64
}

GasketInterruptEventFd is the common structure for ioctls associating an eventfd with a device interrupt, when using the Gasket interrupt module.

+marshal

func (*GasketInterruptEventFd) CopyIn

CopyIn implements marshal.Marshallable.CopyIn.

func (*GasketInterruptEventFd) CopyOut

CopyOut implements marshal.Marshallable.CopyOut.

func (*GasketInterruptEventFd) CopyOutN

func (g *GasketInterruptEventFd) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error)

CopyOutN implements marshal.Marshallable.CopyOutN.

func (*GasketInterruptEventFd) MarshalBytes

func (g *GasketInterruptEventFd) MarshalBytes(dst []byte) []byte

MarshalBytes implements marshal.Marshallable.MarshalBytes.

func (*GasketInterruptEventFd) MarshalUnsafe

func (g *GasketInterruptEventFd) MarshalUnsafe(dst []byte) []byte

MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.

func (*GasketInterruptEventFd) Packed

func (g *GasketInterruptEventFd) Packed() bool

Packed implements marshal.Marshallable.Packed.

func (*GasketInterruptEventFd) SizeBytes

func (g *GasketInterruptEventFd) SizeBytes() int

SizeBytes implements marshal.Marshallable.SizeBytes.

func (*GasketInterruptEventFd) UnmarshalBytes

func (g *GasketInterruptEventFd) UnmarshalBytes(src []byte) []byte

UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.

func (*GasketInterruptEventFd) UnmarshalUnsafe

func (g *GasketInterruptEventFd) UnmarshalUnsafe(src []byte) []byte

UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.

func (*GasketInterruptEventFd) WriteTo

func (g *GasketInterruptEventFd) WriteTo(writer io.Writer) (int64, error)

WriteTo implements io.WriterTo.WriteTo.

type GasketInterruptMapping

type GasketInterruptMapping struct {
	Interrupt uint64
	EventFD   uint64
	BarIndex  uint64
	RegOffset uint64
}

GasketInterruptMapping is a structure for ioctls associating an eventfd and interrupt controlling bar register with a device interrupt, when using the Gasket interrupt module.

+marshal

func (*GasketInterruptMapping) CopyIn

CopyIn implements marshal.Marshallable.CopyIn.

func (*GasketInterruptMapping) CopyOut

CopyOut implements marshal.Marshallable.CopyOut.

func (*GasketInterruptMapping) CopyOutN

func (g *GasketInterruptMapping) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error)

CopyOutN implements marshal.Marshallable.CopyOutN.

func (*GasketInterruptMapping) MarshalBytes

func (g *GasketInterruptMapping) MarshalBytes(dst []byte) []byte

MarshalBytes implements marshal.Marshallable.MarshalBytes.

func (*GasketInterruptMapping) MarshalUnsafe

func (g *GasketInterruptMapping) MarshalUnsafe(dst []byte) []byte

MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.

func (*GasketInterruptMapping) Packed

func (g *GasketInterruptMapping) Packed() bool

Packed implements marshal.Marshallable.Packed.

func (*GasketInterruptMapping) SizeBytes

func (g *GasketInterruptMapping) SizeBytes() int

SizeBytes implements marshal.Marshallable.SizeBytes.

func (*GasketInterruptMapping) UnmarshalBytes

func (g *GasketInterruptMapping) UnmarshalBytes(src []byte) []byte

UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.

func (*GasketInterruptMapping) UnmarshalUnsafe

func (g *GasketInterruptMapping) UnmarshalUnsafe(src []byte) []byte

UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.

func (*GasketInterruptMapping) WriteTo

func (g *GasketInterruptMapping) WriteTo(writer io.Writer) (int64, error)

WriteTo implements io.WriterTo.WriteTo.

type GasketPageTableDmaBufIoctl

type GasketPageTableDmaBufIoctl struct {
	PageTableIndex uint64
	DeviceAddress  uint64
	DMABufID       int32 `marshal:"unaligned"` // Struct ends mid 64bit word.
}

GasketPageTableDmaBufIoctl is a structure for dma_buf mapping ioctl parameters.

+marshal

func (*GasketPageTableDmaBufIoctl) CopyIn

CopyIn implements marshal.Marshallable.CopyIn.

func (*GasketPageTableDmaBufIoctl) CopyOut

CopyOut implements marshal.Marshallable.CopyOut.

func (*GasketPageTableDmaBufIoctl) CopyOutN

func (g *GasketPageTableDmaBufIoctl) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error)

CopyOutN implements marshal.Marshallable.CopyOutN.

func (*GasketPageTableDmaBufIoctl) MarshalBytes

func (g *GasketPageTableDmaBufIoctl) MarshalBytes(dst []byte) []byte

MarshalBytes implements marshal.Marshallable.MarshalBytes.

func (*GasketPageTableDmaBufIoctl) MarshalUnsafe

func (g *GasketPageTableDmaBufIoctl) MarshalUnsafe(dst []byte) []byte

MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.

func (*GasketPageTableDmaBufIoctl) Packed

func (g *GasketPageTableDmaBufIoctl) Packed() bool

Packed implements marshal.Marshallable.Packed.

func (*GasketPageTableDmaBufIoctl) SizeBytes

func (g *GasketPageTableDmaBufIoctl) SizeBytes() int

SizeBytes implements marshal.Marshallable.SizeBytes.

func (*GasketPageTableDmaBufIoctl) UnmarshalBytes

func (g *GasketPageTableDmaBufIoctl) UnmarshalBytes(src []byte) []byte

UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.

func (*GasketPageTableDmaBufIoctl) UnmarshalUnsafe

func (g *GasketPageTableDmaBufIoctl) UnmarshalUnsafe(src []byte) []byte

UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.

func (*GasketPageTableDmaBufIoctl) WriteTo

func (g *GasketPageTableDmaBufIoctl) WriteTo(writer io.Writer) (int64, error)

WriteTo implements io.WriterTo.WriteTo.

type GasketPageTableIoctl

type GasketPageTableIoctl struct {
	PageTableIndex uint64
	Size           uint64
	HostAddress    uint64
	DeviceAddress  uint64
}

GasketPageTableIoctl is a common structure for ioctls mapping and unmapping buffers when using the Gasket page_table module.

+marshal

func (*GasketPageTableIoctl) CopyIn

CopyIn implements marshal.Marshallable.CopyIn.

func (*GasketPageTableIoctl) CopyOut

func (g *GasketPageTableIoctl) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error)

CopyOut implements marshal.Marshallable.CopyOut.

func (*GasketPageTableIoctl) CopyOutN

func (g *GasketPageTableIoctl) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error)

CopyOutN implements marshal.Marshallable.CopyOutN.

func (*GasketPageTableIoctl) MarshalBytes

func (g *GasketPageTableIoctl) MarshalBytes(dst []byte) []byte

MarshalBytes implements marshal.Marshallable.MarshalBytes.

func (*GasketPageTableIoctl) MarshalUnsafe

func (g *GasketPageTableIoctl) MarshalUnsafe(dst []byte) []byte

MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.

func (*GasketPageTableIoctl) Packed

func (g *GasketPageTableIoctl) Packed() bool

Packed implements marshal.Marshallable.Packed.

func (*GasketPageTableIoctl) SizeBytes

func (g *GasketPageTableIoctl) SizeBytes() int

SizeBytes implements marshal.Marshallable.SizeBytes.

func (*GasketPageTableIoctl) UnmarshalBytes

func (g *GasketPageTableIoctl) UnmarshalBytes(src []byte) []byte

UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.

func (*GasketPageTableIoctl) UnmarshalUnsafe

func (g *GasketPageTableIoctl) UnmarshalUnsafe(src []byte) []byte

UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.

func (*GasketPageTableIoctl) WriteTo

func (g *GasketPageTableIoctl) WriteTo(writer io.Writer) (int64, error)

WriteTo implements io.WriterTo.WriteTo.

type Ioctl

type Ioctl uint32

Ioctl represents a gasket ioctl command.

func (Ioctl) String

func (i Ioctl) String() string

Jump to

Keyboard shortcuts

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