virtio: Increase the bootdev priority

The current priority of BOOTDEVP_4_SCAN_FAST means that virtio is
scanned after SCSI. But virtio-scsi provides higher performance.

It seems better to regard virtio has an internal device, since it is
paravirtualised and thus fast. Change its bootdev priority to
BOOTDEVP_2_INTERNAL_FAST

Disable the virtio-fs feature on sandbox, since the virtio queue is not
not yet supported by the emulator.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2025-07-06 10:46:19 +02:00
parent bbd1cc14c1
commit 9a4aa22a70
4 changed files with 11 additions and 8 deletions

View File

@@ -372,6 +372,8 @@ static int virtio_fs_mount(struct udevice *dev)
if (uc_priv->mounted)
return log_msg_ret("vfi", -EISCONN);
if (IS_ENABLED(CONFIG_SANDBOX))
return log_msg_ret("vfs", -ENOENT);
ret = virtio_fs_init(dev);
if (ret)

View File

@@ -447,7 +447,7 @@ U_BOOT_DRIVER(virtio_bootdev) = {
};
BOOTDEV_HUNTER(virtio_bootdev_hunter) = {
.prio = BOOTDEVP_4_SCAN_FAST,
.prio = BOOTDEVP_2_INTERNAL_FAST,
.uclass = UCLASS_VIRTIO,
.hunt = virtio_bootdev_hunt,
.drv = DM_DRIVER_REF(virtio_bootdev),

View File

@@ -398,7 +398,7 @@ static int bootdev_test_hunter(struct unit_test_state *uts)
ut_assert_nextline(" 4 scsi scsi_bootdev");
ut_assert_nextline(" 4 spi_flash sf_bootdev");
ut_assert_nextline(" 5 usb usb_bootdev");
ut_assert_nextline(" 4 virtio virtio_bootdev");
ut_assert_nextline(" 2 virtio virtio_bootdev");
ut_assert_nextline("(total hunters: %d)", HUNTER_COUNT);
ut_assert_console_end();
@@ -478,7 +478,7 @@ static int bootdev_test_cmd_hunt(struct unit_test_state *uts)
ut_assert_nextline(" 4 * scsi scsi_bootdev");
ut_assert_nextline(" 4 * spi_flash sf_bootdev");
ut_assert_nextline(" 5 * usb usb_bootdev");
ut_assert_nextline(" 4 * virtio virtio_bootdev");
ut_assert_nextline(" 2 * virtio virtio_bootdev");
ut_assert_nextline("(total hunters: %d)", HUNTER_COUNT);
ut_assert_console_end();
@@ -503,8 +503,8 @@ static int bootdev_test_hunt_scan(struct unit_test_state *uts)
ut_assertok(bootflow_scan_first(NULL, NULL, &iter,
BOOTFLOWIF_SHOW | BOOTFLOWIF_HUNT |
BOOTFLOWIF_SKIP_GLOBAL, &bflow));
ut_asserteq(BIT(HUNTER_MMC) | BIT(HUNTER_SIMPLE_BUS),
std->hunters_used);
ut_asserteq(BIT(HUNTER_MMC) | BIT(HUNTER_SIMPLE_BUS) |
BIT(HUNTER_VIRTIO), std->hunters_used);
return 0;
}
@@ -742,10 +742,11 @@ static int bootdev_test_next_prio(struct unit_test_state *uts)
ut_assert_nextline("Hunting with: simple_bus");
ut_assert_nextline("Found 2 extension board(s).");
ut_assert_nextline("Hunting with: mmc");
ut_assert_nextline("Hunting with: virtio");
ut_assert_console_end();
ut_asserteq(BIT(HUNTER_MMC) | BIT(HUNTER_SIMPLE_BUS),
std->hunters_used);
ut_asserteq(BIT(HUNTER_MMC) | BIT(HUNTER_SIMPLE_BUS) |
BIT(HUNTER_VIRTIO), std->hunters_used);
ut_assertok(bootdev_next_prio(&iter, &dev));
ut_asserteq_str("mmc1.bootdev", dev->name);
@@ -765,7 +766,6 @@ static int bootdev_test_next_prio(struct unit_test_state *uts)
* this scans all bootdevs of priority BOOTDEVP_4_SCAN_FAST before it
* starts looking at the devices, so we se virtio as well
*/
ut_assert_nextline("Hunting with: virtio");
ut_assert_nextlinen("SF: Detected m25p16");
ut_assertok(bootdev_next_prio(&iter, &dev));

View File

@@ -28,6 +28,7 @@ enum {
HUNTER_MMC, /* ID of MMC hunter */
HUNTER_SCSI = 7, /* ID of SCSI hunter */
HUNTER_USB = 9, /* ID of USB hunter */
HUNTER_VIRTIO,
HUNTER_COUNT = 11,
HUNTER_MAX = HUNTER_COUNT - 1,
};