Skip to content

Commit

Permalink
vhost-user-fs: add the "bootindex" property
Browse files Browse the repository at this point in the history
virtio-fs qualifies as a bootable device minimally under OVMF, but
currently the necessary "bootindex" property is missing. Add the property.

Expose the property only in the PCI device, for now. There is no boot
support for virtiofs on s390x (ccw) for the time being [1] [2], so leave
the CCW device unchanged. Add the property to the base device still,
because adding the alias to the CCW device later will be easier this way
[3].

[1] https://lists.gnu.org/archive/html/qemu-devel/2021-01/msg01745.html
[2] https://lists.gnu.org/archive/html/qemu-devel/2021-01/msg01870.html
[3] https://lists.gnu.org/archive/html/qemu-devel/2021-01/msg01751.html

Example OpenFirmware device path for the "vhost-user-fs-pci" device in the
"bootorder" fw_cfg file:

  /pci@i0cf8/pci-bridge@1,6/pci1af4,105a@0/filesystem@0

Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Ján Tomko <jtomko@redhat.com>
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Cc: virtio-fs@redhat.com
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Message-Id: <20210112131603.12686-1-lersek@redhat.com>
Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
  • Loading branch information
lersek authored and mstsirkin committed Jan 13, 2021
1 parent 5d593bd commit 6da32fe
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
2 changes: 2 additions & 0 deletions hw/virtio/vhost-user-fs-pci.c
Expand Up @@ -68,6 +68,8 @@ static void vhost_user_fs_pci_instance_init(Object *obj)

virtio_instance_init_common(obj, &dev->vdev, sizeof(dev->vdev),
TYPE_VHOST_USER_FS);
object_property_add_alias(obj, "bootindex", OBJECT(&dev->vdev),
"bootindex");
}

static const VirtioPCIDeviceTypeInfo vhost_user_fs_pci_info = {
Expand Down
10 changes: 10 additions & 0 deletions hw/virtio/vhost-user-fs.c
Expand Up @@ -22,6 +22,7 @@
#include "qemu/error-report.h"
#include "hw/virtio/vhost-user-fs.h"
#include "monitor/monitor.h"
#include "sysemu/sysemu.h"

static void vuf_get_config(VirtIODevice *vdev, uint8_t *config)
{
Expand Down Expand Up @@ -279,6 +280,14 @@ static Property vuf_properties[] = {
DEFINE_PROP_END_OF_LIST(),
};

static void vuf_instance_init(Object *obj)
{
VHostUserFS *fs = VHOST_USER_FS(obj);

device_add_bootindex_property(obj, &fs->bootindex, "bootindex",
"/filesystem@0", DEVICE(obj));
}

static void vuf_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
Expand All @@ -300,6 +309,7 @@ static const TypeInfo vuf_info = {
.name = TYPE_VHOST_USER_FS,
.parent = TYPE_VIRTIO_DEVICE,
.instance_size = sizeof(VHostUserFS),
.instance_init = vuf_instance_init,
.class_init = vuf_class_init,
};

Expand Down
1 change: 1 addition & 0 deletions include/hw/virtio/vhost-user-fs.h
Expand Up @@ -39,6 +39,7 @@ struct VHostUserFS {
VhostUserState vhost_user;
VirtQueue **req_vqs;
VirtQueue *hiprio_vq;
int32_t bootindex;

/*< public >*/
};
Expand Down

0 comments on commit 6da32fe

Please sign in to comment.