Skip to content

Commit

Permalink
virtio: add VIRTIO_F_ORDER_PLATFORM feature
Browse files Browse the repository at this point in the history
VIRTIO_F_ORDER_PLATFORM may be required for devices implemented
in hardware. However when adding buffers in vring KeMemoryBarrier
is used which prevents both the compiler and the processor from
moving operations across the barrier. So just add this feature in
guest_feature is ok.

Signed-off-by: Shuai Ruan <ruanshuai@bytedance.com>
Signed-off-by: Ai Qi <aiqi.i7@bytedance.com>
  • Loading branch information
Shuai Ruan authored and YanVugenfirer committed Sep 17, 2024
1 parent 9b89828 commit 48aeb26
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions VirtIO/linux/virtio_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@
/* This feature indicates support for the packed virtqueue layout. */
#define VIRTIO_F_RING_PACKED 34

/*
* This feature indicates that memory accesses by the driver and the
* device are ordered in a way described by the platform.
*/
#define VIRTIO_F_ORDER_PLATFORM 36

// if this number is not equal to desc size, queue creation fails
#define SIZE_OF_SINGLE_INDIRECT_DESC 16

Expand Down
4 changes: 4 additions & 0 deletions viostor/virtio_stor.c
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,10 @@ RhelSetGuestFeatures(
guestFeatures |= (1ULL << VIRTIO_BLK_F_WRITE_ZEROES);
}

if (CHECKBIT(adaptExt->features, VIRTIO_F_ORDER_PLATFORM)) {
guestFeatures |= (1ULL << VIRTIO_F_ORDER_PLATFORM);
}

if (!NT_SUCCESS(virtio_set_features(&adaptExt->vdev, guestFeatures))) {
RhelDbgPrint(TRACE_LEVEL_FATAL, " virtio_set_features failed\n");
return;
Expand Down

0 comments on commit 48aeb26

Please sign in to comment.