diff options
author | Simon Glass <sjg@chromium.org> | 2023-01-29 01:00:20 +0300 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2023-02-06 21:04:53 +0300 |
commit | a710f5b2ebe6207125ee2260a7cfbe2b9e6e7ff3 (patch) | |
tree | ffc05b7ac0014fab96825778ee050087394cd043 /drivers | |
parent | 965020c3f7e11a8ee4f53023822d30d43345abde (diff) | |
download | u-boot-a710f5b2ebe6207125ee2260a7cfbe2b9e6e7ff3.tar.xz |
bootstd: Correct virtio block-device handling
At present virtio tries to attach QEMU services to a bootdev device, which
cannot work. Add a check for this.
Also use bootdev_setup_sibling_blk() to create the bootdev device, since
it allows the correct name to be used and bootdev_get_sibling_blk() to
work as expected.
The bootdev is not created on sandbox since it does have a real virtio
device and it is not possible to read blocks.
Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: a60f7a3e35b ("bootstd: Add a virtio bootdev")
Reported-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/virtio/virtio-uclass.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/virtio/virtio-uclass.c b/drivers/virtio/virtio-uclass.c index 91af412ec1..de9bc90359 100644 --- a/drivers/virtio/virtio-uclass.c +++ b/drivers/virtio/virtio-uclass.c @@ -247,8 +247,8 @@ static int virtio_uclass_post_probe(struct udevice *udev) } device_set_name_alloced(vdev); - if (uc_priv->device == VIRTIO_ID_BLOCK) { - ret = bootdev_setup_for_dev(udev, name); + if (uc_priv->device == VIRTIO_ID_BLOCK && !IS_ENABLED(CONFIG_SANDBOX)) { + ret = bootdev_setup_sibling_blk(vdev, "virtio_bootdev"); if (ret) return log_msg_ret("bootdev", ret); } @@ -275,6 +275,10 @@ static int virtio_uclass_child_pre_probe(struct udevice *vdev) int i; int ret; + /* bootdevs are not virtio devices */ + if (device_get_uclass_id(vdev) == UCLASS_BOOTDEV) + return 0; + /* * Save the real virtio device (eg: virtio-net, virtio-blk) to * the transport (parent) device's uclass priv for future use. |