Skip to main content

Module virtio_blk

Module virtio_blk 

Source
Expand description

VirtIO block device driver VirtIO block device driver for boot partition access.

Minimal read-only driver for reading modules from the FAT32 boot partition. Supports VirtIO MMIO transport (common on RISC-V/ARM64 QEMU) with a working virtqueue-based block read implementation.

Uses the kernel frame allocator (available after buddy init) to allocate physically-contiguous vring and bounce-buffer memory.

Structsยง

BootBlockHeader ๐Ÿ”’
VirtIO block request header (must match device layout exactly).
BootVirtqueue ๐Ÿ”’
Minimal boot-time virtqueue with a static vring allocation.
VirtioBlkDevice
VirtIO block device (boot-time MMIO transport)
VringAvail ๐Ÿ”’
Available ring header (followed by queue_size u16 ring entries + optional used_event).
VringDesc ๐Ÿ”’
VRING descriptor (16 bytes).
VringUsed ๐Ÿ”’
Used ring header (followed by queue_size VringUsedElem entries + optional avail_event).
VringUsedElem ๐Ÿ”’
Used ring element (8 bytes).

Enumsยง

BootBlockStatus ๐Ÿ”’
VirtIO block request status byte.

Constantsยง

BOOT_QUEUE_SIZE ๐Ÿ”’
Small queue size is enough for single-block boot reads (header+data+status = 3 descs).
REG_CAPACITY ๐Ÿ”’
REG_DEVICE_FEATURES ๐Ÿ”’
REG_DRIVER_FEATURES ๐Ÿ”’
REG_QUEUE_ALIGN ๐Ÿ”’
REG_QUEUE_NOTIFY ๐Ÿ”’
REG_QUEUE_NUM ๐Ÿ”’
REG_QUEUE_NUM_MAX ๐Ÿ”’
REG_QUEUE_PFN ๐Ÿ”’
REG_QUEUE_SEL ๐Ÿ”’
REG_STATUS ๐Ÿ”’
REQ_TYPE_IN ๐Ÿ”’
STATUS_ACK ๐Ÿ”’
STATUS_DRIVER ๐Ÿ”’
STATUS_DRIVER_OK ๐Ÿ”’
STATUS_FAILED ๐Ÿ”’
STATUS_FEATURES_OK ๐Ÿ”’
VRING_DESC_F_NEXT ๐Ÿ”’
VRING_DESC_F_WRITE ๐Ÿ”’