class VirtioPciDevice

Defined at line 33 of file ../../src/graphics/display/drivers/virtio-gpu-display/virtio-pci-device.h

Implements generic parts of the virtio specification over the PCI transport.

Public Methods

zx::result<std::unique_ptr<VirtioPciDevice>> Create (zx::bti bti, std::unique_ptr<virtio::Backend> backend)

static

Defined at line 26 of file ../../src/graphics/display/drivers/virtio-gpu-display/virtio-pci-device.cc

size_t GetCapabilitySetLimit ()

Defined at line 67 of file ../../src/graphics/display/drivers/virtio-gpu-display/virtio-pci-device.h

uint64_t Features ()

The optional features negotiated with the virtio device.

Must only be called after Init() succeeds.

Defined at line 72 of file ../../src/graphics/display/drivers/virtio-gpu-display/virtio-pci-device.h

void VirtioPciDevice (zx::bti bti, std::unique_ptr<virtio::Backend> backend, zx::vmo virtio_control_queue_buffer_pool_vmo, zx::pmt virtio_control_queue_buffer_pool_pin, zx_paddr_t virtio_control_queue_buffer_pool_physical_address, cpp20::span<uint8_t> virtio_control_queue_buffer_pool, zx::vmo virtio_cursor_queue_buffer_pool_vmo, zx::pmt virtio_cursor_queue_buffer_pool_pin, zx_paddr_t virtio_cursor_queue_buffer_pool_physical_address, cpp20::span<uint8_t> virtio_cursor_queue_buffer_pool)

`bti` is used to obtain physical memory addresses given to the virtio

device.

`virtio_control_queue_buffer_pool` and `virtio_cursor_queue_buffer_pool`

must be large enough to store requests and responses exchanged with the

virtio device. The buffers must reside at

`virtio_control_queue_buffer_pool_physical_address` and

`virtio_cursor_queue_buffer_pool_physical_address`, respectively, in the

virtio device's physical address space.

The instance hangs onto `virtio_control_queue_buffer_pool_vmo`,

`virtio_cursor_queue_buffer_pool_vmo`,

`virtio_control_queue_buffer_pool_pin`, and

`virtio_cursor_queue_buffer_pool_pin` for the duration of its lifetime.

They are intended to keep the memory backing

`virtio_control_queue_buffer_pool` and `virtio_cursor_queue_buffer_pool`

alive and pinned to `virtio_control_queue_buffer_pool_physical_address`

and `virtio_cursor_queue_buffer_pool_physical_address`, respectively.

Defined at line 150 of file ../../src/graphics/display/drivers/virtio-gpu-display/virtio-pci-device.cc

void ~VirtioPciDevice ()

Defined at line 173 of file ../../src/graphics/display/drivers/virtio-gpu-display/virtio-pci-device.cc

void ExchangeControlqVariableLengthRequestResponse (cpp20::span<const uint8_t> request, std::function<void (cpp20::span<uint8_t>)> callback)

Synchronous request/response exchange on the main `controlq` virtqueue.

Defined at line 376 of file ../../src/graphics/display/drivers/virtio-gpu-display/virtio-pci-device.cc

template <typename ResponseType, typename RequestType>
const ResponseType & ExchangeControlqRequestResponse (const RequestType & request)

Templated request/response exchange on the main `control` virtqueue.

The returned reference points to data owned by the VirtioPciDevice

instance, and is only valid until the method is called again.

Call sites are expected to rely on partial template type inference. The

argument type should not be specified twice.

const virtio_abi::EmptyRequest request = {...};

const auto

&

response =

device->ExchangeControlqRequestResponse

<virtio

_abi::EmptyResponse>(

request);

The current implementation fully serializes request/response exchanges.

More precisely, even if ExchangeControlqRequestResponse() is called concurrently,

the virtio device will never be given a request while another request is

pending. While this behavior is observable, it is not part of the API. The

implementation may be evolved to issue concurrent requests in the future.

Defined at line 219 of file ../../src/graphics/display/drivers/virtio-gpu-display/virtio-pci-device.h

template <typename ResponseType, typename RequestType>
const ResponseType & ExchangeCursorqRequestResponse (const RequestType & request)

See ExchangeControlqRequestResponse() above; this method is functionally

the same, except it manages synchronous request/response exchange on the

`cursorq` virtqueue.

Defined at line 235 of file ../../src/graphics/display/drivers/virtio-gpu-display/virtio-pci-device.h

zx_status_t Init ()

virtio::Device

Defined at line 191 of file ../../src/graphics/display/drivers/virtio-gpu-display/virtio-pci-device.cc

void IrqRingUpdate ()

Defined at line 253 of file ../../src/graphics/display/drivers/virtio-gpu-display/virtio-pci-device.cc

void IrqConfigChange ()

Defined at line 280 of file ../../src/graphics/display/drivers/virtio-gpu-display/virtio-pci-device.cc

const char * tag ()

Defined at line 282 of file ../../src/graphics/display/drivers/virtio-gpu-display/virtio-pci-device.cc