Changeset 100371 in vbox for trunk/src/VBox/Devices/VirtIO/VirtioCore.h
- Timestamp:
- Jul 5, 2023 7:47:33 AM (19 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/VirtIO/VirtioCore.h
r99739 r100371 32 32 # pragma once 33 33 #endif 34 35 /* Do not allocate VIRTQBUF from the heap when possible */36 #define VIRTIO_VBUF_ON_STACK 137 34 38 35 #include <iprt/ctype.h> … … 698 695 uint16_t virtioCoreVirtqAvailBufCount(PPDMDEVINS pDevIns, PVIRTIOCORE pVirtio, uint16_t uVirtqNbr); 699 696 700 #ifdef VIRTIO_VBUF_ON_STACK701 697 /** 702 698 * This function is identical to virtioCoreR3VirtqAvailBufGet(), *except* it doesn't consume … … 767 763 int virtioCoreR3VirtqAvailBufGet(PPDMDEVINS pDevIns, PVIRTIOCORE pVirtio, uint16_t uVirtqNbr, 768 764 uint16_t uHeadIdx, PVIRTQBUF pVirtqBuf); 769 #else /* !VIRTIO_VBUF_ON_STACK */770 /**771 * This function is identical to virtioCoreR3VirtqAvailBufGet(), *except* it doesn't consume772 * peeked buffer from avail ring of the virtq. The function *becomes* identical to the773 * virtioCoreR3VirtqAvailBufGet() only if virtioCoreR3VirtqAvailRingNext() is invoked to774 * consume buf from the queue's avail ring, followed by invocation of virtioCoreR3VirtqUsedBufPut(),775 * to hand host-processed buffer back to guest, which completes guest-initiated virtq buffer circuit.776 *777 * @param pDevIns The device instance.778 * @param pVirtio Pointer to the shared virtio state.779 * @param uVirtqNbr Virtq number780 * @param ppVirtqBuf Address to store pointer to descriptor chain that contains the781 * pre-processed transaction information pulled from the virtq.782 *783 * @returns VBox status code:784 * @retval VINF_SUCCESS Success785 * @retval VERR_INVALID_STATE VirtIO not in ready state (asserted).786 * @retval VERR_NOT_AVAILABLE If the queue is empty.787 */788 int virtioCoreR3VirtqAvailBufPeek(PPDMDEVINS pDevIns, PVIRTIOCORE pVirtio, uint16_t uVirtqNbr,789 PPVIRTQBUF ppVirtqBuf);790 791 /**792 * This function fetches the next buffer (descriptor chain) from the VirtIO "avail" ring of793 * indicated queue, separating the buf's s/g vectors into OUT (e.g. guest-to-host)794 * components and and IN (host-to-guest) components.795 *796 * Caller is responsible for GCPhys to host virtual memory conversions. If the797 * virtq buffer being peeked at is "consumed", virtioCoreR3VirtqAvailRingNext() must798 * be called, and after that virtioCoreR3VirtqUsedBufPut() must be called to799 * complete the buffer transfer cycle with the guest.800 *801 * @param pDevIns The device instance.802 * @param pVirtio Pointer to the shared virtio state.803 * @param uVirtqNbr Virtq number804 * @param ppVirtqBuf Address to store pointer to descriptor chain that contains the805 * pre-processed transaction information pulled from the virtq.806 * Returned reference must be released by calling807 * virtioCoreR3VirtqBufRelease().808 * @param fRemove flags whether to remove desc chain from queue (false = peek)809 *810 * @returns VBox status code:811 * @retval VINF_SUCCESS Success812 * @retval VERR_INVALID_STATE VirtIO not in ready state (asserted).813 * @retval VERR_NOT_AVAILABLE If the queue is empty.814 */815 int virtioCoreR3VirtqAvailBufGet(PPDMDEVINS pDevIns, PVIRTIOCORE pVirtio, uint16_t uVirtqNbr,816 PPVIRTQBUF ppVirtqBuf, bool fRemove);817 818 /**819 * Fetches a specific descriptor chain using avail ring of indicated queue and converts the820 * descriptor chain into its OUT (to device) and IN (to guest) components.821 *822 * The caller is responsible for GCPhys to host virtual memory conversions and *must*823 * return the virtq buffer using virtioCoreR3VirtqUsedBufPut() to complete the roundtrip824 * virtq transaction.825 * *826 * @param pDevIns The device instance.827 * @param pVirtio Pointer to the shared virtio state.828 * @param uVirtqNbr Virtq number829 * @param ppVirtqBuf Address to store pointer to descriptor chain that contains the830 * pre-processed transaction information pulled from the virtq.831 * Returned reference must be released by calling832 * virtioCoreR3VirtqBufRelease().833 * @param fRemove flags whether to remove desc chain from queue (false = peek)834 *835 * @returns VBox status code:836 * @retval VINF_SUCCESS Success837 * @retval VERR_INVALID_STATE VirtIO not in ready state (asserted).838 * @retval VERR_NOT_AVAILABLE If the queue is empty.839 */840 int virtioCoreR3VirtqAvailBufGet(PPDMDEVINS pDevIns, PVIRTIOCORE pVirtio, uint16_t uVirtqNbr,841 uint16_t uHeadIdx, PPVIRTQBUF ppVirtqBuf);842 #endif /* !VIRTIO_VBUF_ON_STACK */843 765 844 766 /** … … 1185 1107 int virtioCoreVirtqUsedRingSync(PPDMDEVINS pDevIns, PVIRTIOCORE pVirtio, uint16_t uVirtqNbr); 1186 1108 1187 #ifdef VIRTIO_VBUF_ON_STACK1188 1109 /** 1189 1110 * Allocates a descriptor chain object with the reference count of one. Copying the reference … … 1200 1121 */ 1201 1122 PVIRTQBUF virtioCoreR3VirtqBufAlloc(void); 1202 #endif /* VIRTIO_VBUF_ON_STACK */1203 1123 1204 1124 /**
Note:
See TracChangeset
for help on using the changeset viewer.