Documentation ¶
Overview ¶
Package gasket describes the userspace interface for Gasket devices.
Index ¶
- Variables
- type GasketInterruptEventFd
- func (g *GasketInterruptEventFd) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error)
- func (g *GasketInterruptEventFd) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error)
- func (g *GasketInterruptEventFd) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error)
- func (g *GasketInterruptEventFd) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error)
- func (g *GasketInterruptEventFd) MarshalBytes(dst []byte) []byte
- func (g *GasketInterruptEventFd) MarshalUnsafe(dst []byte) []byte
- func (g *GasketInterruptEventFd) Packed() bool
- func (g *GasketInterruptEventFd) SizeBytes() int
- func (g *GasketInterruptEventFd) UnmarshalBytes(src []byte) []byte
- func (g *GasketInterruptEventFd) UnmarshalUnsafe(src []byte) []byte
- func (g *GasketInterruptEventFd) WriteTo(writer io.Writer) (int64, error)
- type GasketInterruptMapping
- func (g *GasketInterruptMapping) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error)
- func (g *GasketInterruptMapping) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error)
- func (g *GasketInterruptMapping) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error)
- func (g *GasketInterruptMapping) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error)
- func (g *GasketInterruptMapping) MarshalBytes(dst []byte) []byte
- func (g *GasketInterruptMapping) MarshalUnsafe(dst []byte) []byte
- func (g *GasketInterruptMapping) Packed() bool
- func (g *GasketInterruptMapping) SizeBytes() int
- func (g *GasketInterruptMapping) UnmarshalBytes(src []byte) []byte
- func (g *GasketInterruptMapping) UnmarshalUnsafe(src []byte) []byte
- func (g *GasketInterruptMapping) WriteTo(writer io.Writer) (int64, error)
- type GasketPageTableDmaBufIoctl
- func (g *GasketPageTableDmaBufIoctl) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error)
- func (g *GasketPageTableDmaBufIoctl) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error)
- func (g *GasketPageTableDmaBufIoctl) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error)
- func (g *GasketPageTableDmaBufIoctl) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error)
- func (g *GasketPageTableDmaBufIoctl) MarshalBytes(dst []byte) []byte
- func (g *GasketPageTableDmaBufIoctl) MarshalUnsafe(dst []byte) []byte
- func (g *GasketPageTableDmaBufIoctl) Packed() bool
- func (g *GasketPageTableDmaBufIoctl) SizeBytes() int
- func (g *GasketPageTableDmaBufIoctl) UnmarshalBytes(src []byte) []byte
- func (g *GasketPageTableDmaBufIoctl) UnmarshalUnsafe(src []byte) []byte
- func (g *GasketPageTableDmaBufIoctl) WriteTo(writer io.Writer) (int64, error)
- type GasketPageTableIoctl
- func (g *GasketPageTableIoctl) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error)
- func (g *GasketPageTableIoctl) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error)
- func (g *GasketPageTableIoctl) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error)
- func (g *GasketPageTableIoctl) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error)
- func (g *GasketPageTableIoctl) MarshalBytes(dst []byte) []byte
- func (g *GasketPageTableIoctl) MarshalUnsafe(dst []byte) []byte
- func (g *GasketPageTableIoctl) Packed() bool
- func (g *GasketPageTableIoctl) SizeBytes() int
- func (g *GasketPageTableIoctl) UnmarshalBytes(src []byte) []byte
- func (g *GasketPageTableIoctl) UnmarshalUnsafe(src []byte) []byte
- func (g *GasketPageTableIoctl) WriteTo(writer io.Writer) (int64, error)
- type Ioctl
Constants ¶
This section is empty.
Variables ¶
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
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 ¶
GasketInterruptEventFd is the common structure for ioctls associating an eventfd with a device interrupt, when using the Gasket interrupt module.
+marshal
func (*GasketInterruptEventFd) CopyIn ¶
func (g *GasketInterruptEventFd) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error)
CopyIn implements marshal.Marshallable.CopyIn.
func (*GasketInterruptEventFd) CopyInN ¶
func (g *GasketInterruptEventFd) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error)
CopyInN implements marshal.Marshallable.CopyInN.
func (*GasketInterruptEventFd) CopyOut ¶
func (g *GasketInterruptEventFd) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error)
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.
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 ¶
func (g *GasketInterruptMapping) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error)
CopyIn implements marshal.Marshallable.CopyIn.
func (*GasketInterruptMapping) CopyInN ¶
func (g *GasketInterruptMapping) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error)
CopyInN implements marshal.Marshallable.CopyInN.
func (*GasketInterruptMapping) CopyOut ¶
func (g *GasketInterruptMapping) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error)
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.
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 ¶
func (g *GasketPageTableDmaBufIoctl) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error)
CopyIn implements marshal.Marshallable.CopyIn.
func (*GasketPageTableDmaBufIoctl) CopyInN ¶
func (g *GasketPageTableDmaBufIoctl) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error)
CopyInN implements marshal.Marshallable.CopyInN.
func (*GasketPageTableDmaBufIoctl) CopyOut ¶
func (g *GasketPageTableDmaBufIoctl) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error)
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.
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 ¶
func (g *GasketPageTableIoctl) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error)
CopyIn implements marshal.Marshallable.CopyIn.
func (*GasketPageTableIoctl) CopyInN ¶
func (g *GasketPageTableIoctl) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error)
CopyInN implements marshal.Marshallable.CopyInN.
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.