History log of /haiku/src/add-ons/kernel/bus_managers/virtio/VirtioQueue.cpp
Revision Date Author Comments
# 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>


# 956f4507 22-May-2022 Trung Nguyen <trungnt282910@gmail.com>

kernel/vm: Remove default kernel read/write flags

`fix_protection` will not apply `B_KERNEL_READ_AREA` and
`B_KERNEL_WRITE_AREA` by default.

Kernel drivers that directly call `create_area` or `create_area_etc`
and do not pass any protection flags have been updated to
apply `B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA` instead.

Bug: #17751
Change-Id: I43e7ee6b5396e0309cdcff750e28262942c6d01c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5330
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.


# 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


# ecadc4c6 09-Nov-2013 Jérôme Duval <jerome.duval@gmail.com>

CID 1108428 Uninitialized scalar field


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

Virtio: implemented indirect descriptors feature.

* indirect descriptors count hardcoded to 128.
* already activated for virtio_block driver.


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

virtio*: remove trailing spaces


# 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.


# 46bfab03 02-Jul-2013 Jérôme Duval <jerome.duval@gmail.com>

virtio: free fDescriptors on VirtioQueue destruction.


# 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.


# ecadc4c69603b5a4234fe08095ec98a7241b5d17 09-Nov-2013 Jérôme Duval <jerome.duval@gmail.com>

CID 1108428 Uninitialized scalar field


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

Virtio: implemented indirect descriptors feature.

* indirect descriptors count hardcoded to 128.
* already activated for virtio_block driver.


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

virtio*: remove trailing spaces


# 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.


# 46bfab031f9094fef5c0f187b28ba243e2ebd2ec 02-Jul-2013 Jérôme Duval <jerome.duval@gmail.com>

virtio: free fDescriptors on VirtioQueue destruction.


# 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.