History log of /haiku/headers/private/virtio/virtio.h
Revision Date Author Comments
# 96e84698 28-Mar-2024 Diego Roux <diegoroux04@protonmail.com>

[GSoC '24]: wip: virtio_audio: initial basic driver.

This commit in no form is intended to provide a working/functional
driver, but rather as a starting base and minimal code contribution
for GSoC.

This driver can only identify if the current device is a Sound
VirtIO device.

Change-Id: I718bb87c768dd84ff2be77a14e839f94955671fc
Signed-off-by: Diego Roux <diegoroux04@protonmail.com>
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7557
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>


# 6d42b430 03-Oct-2023 Jérôme Duval <jerome.duval@gmail.com>

virtio: support modern devices

fixes #17239 #17238

Change-Id: Ia5b6347110a60fab18852079b30dca6301010474
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6995
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>


# 38d4a2ed 17-Feb-2022 David Karoly <karolyd577@gmail.com>

virtio: add VIRTIO_FEATURE_ANY_LAYOUT in virtio.h

Change-Id: Ib8bc3639b4330dc1fb61ddbb6a3e8237cc6814ca
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4971
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# d8e1fd6e 18-Mar-2020 Jérôme Duval <jerome.duval@gmail.com>

virtio: add clear_feature hook.

Change-Id: I282ffc65a7bd692145626ab4272c5df4a792e9d4
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2383
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# 9a2911ca 01-Sep-2019 Michael Lotz <mmlr@mlotz.ch>

virtio: Rework queue_dequeue to return a boolean.

It previously returned the cookie directly, which made it impossible
to distinguish between a NULL cookie and the function not having
anything to dequeue. This lead to some code setting a cookie that was
not actually used.

Return the dequeue status as a boolean and provide the cookie with an
optionally handed in pointer instead and adjust all users.

Change-Id: Iaac1726ac4bc7ae42bb96b8f0915852b6def5822
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1814
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# 2f211cce 16-Nov-2018 Michael Lotz <mmlr@mlotz.ch>

virtio: Replace size return with usedLength in queue_dequeue.

The size was in fact the count of physical entries that were used. That
number must necessarily be the same as the number given when adding to
the queue, so that number isn't really interesting. Consequently none
of the users of that API made use of it.

Return the used length instead, which is the way virtio signals how much
valid data resides in the dequeued buffer. This is for example important
to know the frame length of incoming packets in virtio_net.


# c02c4653 22-Oct-2018 Jérôme Duval <jerome.duval@gmail.com>

virtio: sync ids with Linux.

Change-Id: I1ca852f16e2b8d5d22ebed25b682e56fd934c46c
Reviewed-on: https://review.haiku-os.org/640
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# 61cd7e85 21-Apr-2018 Jérôme Duval <jerome.duval@gmail.com>

virtio: add API to uninit a device.

* free interrupts, free queues, return to init state.
* this will be used by virtio_net on interface uninit.

Change-Id: I7c1e6facc37cf6bfe19628576fdf2c0bac9e5c38


# 6e82e428 16-Apr-2018 Jérôme Duval <jerome.duval@gmail.com>

virtio: refactor to have a handler per queue.

* enable to iterate on available entries in one interrupt call.
* negociate -> negotiate, (void *) -> (void* ), thanks axel and philippe!

Change-Id: Ie2d290797abcbf4c0f3cb5bfff71d091bb800fa6


# 33f263cb 16-Sep-2013 Jerome Duval <jerome.duval@gmail.com>

virtio: add queue_is_full(), queue_is_empty(), queue_size() hooks.


# f3b8787e 18-Jul-2013 Jérôme Duval <jerome.duval@gmail.com>

virtio.h: remove trailing whitespaces.


# ed4a8e4d 17-Jul-2013 Jérôme Duval <jerome.duval@gmail.com>

virtio: changed a bit the driver API by adding a driverCookie.

* the processing of requests in drivers is eased a bit with this change, but
this could be improved for instance by enabling a driver to dequeue items
in a service thread instead of the interrupt handler.
* made a few methods const.


# 8dfd68e0 11-Jul-2013 Jérôme Duval <jerome.duval@gmail.com>

Virtio PCI: added support for MSI-X interrupts

* make use of MSI/MSI-X PCI x86 API
* MSI support untested because QEmu only offers MSI-X
* changed a bit the Virtio bus API by adding a queue count parameter
for the setup_interrupt() hook.


# 6e6c121b 06-Jun-2013 Jérôme Duval <jerome.duval@gmail.com>

virtio: added several devices ids.


# 6bbf9c9d 26-May-2013 Jérôme Duval <jerome.duval@gmail.com>

Virtio: added drivers for PCI busses, bus manager and block device.

* the Virtio PCI bus driver exposes a Virtio controller to the Virtio bus manager,
which in turn exposes a Virtio device consumed by Virtio drivers. Drivers follow the
new driver model.
* virtio_block handles Virtio block devices under disk/virtual/virtio_block/x/raw.
* Here is the Qemu command line option for Virtio disk devices:
-drive file=haiku.image,if=virtio
* the PCI bus driver currently supports only legacy interrupts (no MSI(-X) yet).
* There is room for improvements in the bus manager:
- it notifies the host for each queued request, which isn't optimal.
- transfer descriptors should probably be simply preallocated (they are nicely
leaked at the moment).
- indirect descriptors are not supported yet.
and in the block driver:
- get the id of the disk.
- implements flushing the cache.
- improves dma restrictions.
- do_io() should use a page for header descriptors instead of malloc(), which
could cross boundaries.
* The device manager tries to guess the driver based on the PCI device type, this
implies having to declare the "busses/virtio" path for each possible type
provided by Virtio. Thus future driver additions might require patching the device
manager.
* virtio.h is still private, the API is subject to changes.
* virtio_pci.h, virtio_blk.h, virtio_ring.h are copied unchanged from FreeBSD.


# 33f263cb01e82be571639584a3fe6a690b583467 16-Sep-2013 Jerome Duval <jerome.duval@gmail.com>

virtio: add queue_is_full(), queue_is_empty(), queue_size() hooks.


# f3b8787e915dfe31a80e10693b5cc854de92faeb 18-Jul-2013 Jérôme Duval <jerome.duval@gmail.com>

virtio.h: remove trailing whitespaces.


# ed4a8e4d11d7972d6fb6f025c108915ad06c73af 17-Jul-2013 Jérôme Duval <jerome.duval@gmail.com>

virtio: changed a bit the driver API by adding a driverCookie.

* the processing of requests in drivers is eased a bit with this change, but
this could be improved for instance by enabling a driver to dequeue items
in a service thread instead of the interrupt handler.
* made a few methods const.


# 8dfd68e0f8d23a978549ad54b088a384d7214210 11-Jul-2013 Jérôme Duval <jerome.duval@gmail.com>

Virtio PCI: added support for MSI-X interrupts

* make use of MSI/MSI-X PCI x86 API
* MSI support untested because QEmu only offers MSI-X
* changed a bit the Virtio bus API by adding a queue count parameter
for the setup_interrupt() hook.


# 6e6c121b84c609e395642175109ac778a92e6543 06-Jun-2013 Jérôme Duval <jerome.duval@gmail.com>

virtio: added several devices ids.


# 6bbf9c9da977b2ea9d1caf36a867d320de81a836 26-May-2013 Jérôme Duval <jerome.duval@gmail.com>

Virtio: added drivers for PCI busses, bus manager and block device.

* the Virtio PCI bus driver exposes a Virtio controller to the Virtio bus manager,
which in turn exposes a Virtio device consumed by Virtio drivers. Drivers follow the
new driver model.
* virtio_block handles Virtio block devices under disk/virtual/virtio_block/x/raw.
* Here is the Qemu command line option for Virtio disk devices:
-drive file=haiku.image,if=virtio
* the PCI bus driver currently supports only legacy interrupts (no MSI(-X) yet).
* There is room for improvements in the bus manager:
- it notifies the host for each queued request, which isn't optimal.
- transfer descriptors should probably be simply preallocated (they are nicely
leaked at the moment).
- indirect descriptors are not supported yet.
and in the block driver:
- get the id of the disk.
- implements flushing the cache.
- improves dma restrictions.
- do_io() should use a page for header descriptors instead of malloc(), which
could cross boundaries.
* The device manager tries to guess the driver based on the PCI device type, this
implies having to declare the "busses/virtio" path for each possible type
provided by Virtio. Thus future driver additions might require patching the device
manager.
* virtio.h is still private, the API is subject to changes.
* virtio_pci.h, virtio_blk.h, virtio_ring.h are copied unchanged from FreeBSD.