summaryrefslogtreecommitdiffstats
path: root/OvmfPkg/Include/IndustryStandard
diff options
context:
space:
mode:
authorLaszlo Ersek <lersek@redhat.com>2020-12-16 22:10:41 +0100
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2020-12-21 17:16:23 +0000
commiteaa7115d60e9a2f56ead85275870700edf852ed2 (patch)
treea84dc92a41d89a8fdfbc91edb106df620e993fe5 /OvmfPkg/Include/IndustryStandard
parentb55d6622d4f4d795d71e930da1fcda7c78a7fe96 (diff)
downloadedk2-eaa7115d60e9a2f56ead85275870700edf852ed2.tar.gz
edk2-eaa7115d60e9a2f56ead85275870700edf852ed2.tar.bz2
edk2-eaa7115d60e9a2f56ead85275870700edf852ed2.zip
OvmfPkg/VirtioFsDxe: implement virtio device (un)initialization
Add the VirtioFsInit(), VirtioFsUninit(), and VirtioFsExitBoot() functions. In VirtioFsInit(): - Verify the host-side config of the virtio-fs device. - Save the filesystem label ("tag") for later, from the configuration area of the virtio-fs device. - Save the virtio queue size for later as well. - Set up the virtio ring for sending requests. In VirtioFsUninit(): - Reset the device. - Tear down the virtio ring. In VirtioFsExitBoot(): - Reset the device. With this patch, the UEFI connect / disconnect controller operations involve virtio setup / teardown; they are visible in the virtio-fs daemon's log file. The virtiofsd log also confirms the device reset in VirtioFsExitBoot(), when an OS is booted while the virtio-fs device is bound. Cc: Ard Biesheuvel <ard.biesheuvel@arm.com> Cc: Jordan Justen <jordan.l.justen@intel.com> Cc: Philippe Mathieu-Daudé <philmd@redhat.com> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3097 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Message-Id: <20201216211125.19496-5-lersek@redhat.com> Acked-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
Diffstat (limited to 'OvmfPkg/Include/IndustryStandard')
-rw-r--r--OvmfPkg/Include/IndustryStandard/VirtioFs.h52
1 files changed, 52 insertions, 0 deletions
diff --git a/OvmfPkg/Include/IndustryStandard/VirtioFs.h b/OvmfPkg/Include/IndustryStandard/VirtioFs.h
new file mode 100644
index 0000000000..ea7d80d15d
--- /dev/null
+++ b/OvmfPkg/Include/IndustryStandard/VirtioFs.h
@@ -0,0 +1,52 @@
+/** @file
+ Type and macro definitions specific to the Virtio Filesystem device.
+
+ At the time of this writing, the latest released Virtio specification (v1.1)
+ does not include the virtio-fs device. The development version of the
+ specification defines it however; see the latest version at
+ <https://github.com/oasis-tcs/virtio-spec/blob/87fa6b5d8155/virtio-fs.tex>.
+
+ This header file is minimal, and only defines the types and macros that are
+ necessary for the OvmfPkg implementation.
+
+ Copyright (C) 2020, Red Hat, Inc.
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#ifndef VIRTIO_FS_H_
+#define VIRTIO_FS_H_
+
+#include <IndustryStandard/Virtio.h>
+
+//
+// Lowest numbered queue for sending normal priority requests.
+//
+#define VIRTIO_FS_REQUEST_QUEUE 1
+
+//
+// Number of bytes in the "VIRTIO_FS_CONFIG.Tag" field.
+//
+#define VIRTIO_FS_TAG_BYTES 36
+
+//
+// Device configuration layout.
+//
+#pragma pack (1)
+typedef struct {
+ //
+ // The Tag field can be considered the filesystem label, or a mount point
+ // hint. It is UTF-8 encoded, and padded to full size with NUL bytes. If the
+ // encoded bytes take up the entire Tag field, then there is no NUL
+ // terminator.
+ //
+ UINT8 Tag[VIRTIO_FS_TAG_BYTES];
+ //
+ // The total number of request virtqueues exposed by the device (i.e.,
+ // excluding the "hiprio" queue).
+ //
+ UINT32 NumReqQueues;
+} VIRTIO_FS_CONFIG;
+#pragma pack ()
+
+#endif // VIRTIO_FS_H_