aboutsummaryrefslogtreecommitdiff
path: root/src/hw
diff options
context:
space:
mode:
authorAlexey Kirillov <lekiravi@yandex-team.ru>2020-01-07 20:19:17 +0300
committerGerd Hoffmann <kraxel@redhat.com>2020-01-14 09:12:45 +0100
commit2f4d068645c211e309812372cd0ac58c9024e93b (patch)
tree6b5f0534f8efda3889debe812136a03c155ae28c /src/hw
parent7c40d945b9313a87a39657a277ef65fa7bdfb983 (diff)
downloadseabios-hppa-2f4d068645c211e309812372cd0ac58c9024e93b.zip
seabios-hppa-2f4d068645c211e309812372cd0ac58c9024e93b.tar.gz
seabios-hppa-2f4d068645c211e309812372cd0ac58c9024e93b.tar.bz2
virtio: Do not init non-bootable devices
Because initializing a virtio-blk or virtio-scsi device requires a large amount of memory, you cannot create more than about 10 virtio devices. Since initialization is required for booting from media, we will not initialize those devices that are not in the boot order list. Signed-off-by: Alexey Kirillov <lekiravi@yandex-team.ru> Message-id: 20200107171917.7535-3-lekiravi@yandex-team.ru Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'src/hw')
-rw-r--r--src/hw/virtio-blk.c11
-rw-r--r--src/hw/virtio-scsi.c11
2 files changed, 20 insertions, 2 deletions
diff --git a/src/hw/virtio-blk.c b/src/hw/virtio-blk.c
index 3e615b2..a5e28fc 100644
--- a/src/hw/virtio-blk.c
+++ b/src/hw/virtio-blk.c
@@ -18,7 +18,7 @@
#include "stacks.h" // run_thread
#include "std/disk.h" // DISK_RET_SUCCESS
#include "string.h" // memset
-#include "util.h" // usleep
+#include "util.h" // usleep, bootprio_find_pci_device, is_bootprio_strict
#include "virtio-pci.h"
#include "virtio-ring.h"
#include "virtio-blk.h"
@@ -196,6 +196,8 @@ fail:
void
virtio_blk_setup(void)
{
+ u8 skip_nonbootable = is_bootprio_strict();
+
ASSERT32FLAT();
if (! CONFIG_VIRTIO_BLK)
return;
@@ -208,6 +210,13 @@ virtio_blk_setup(void)
(pci->device != PCI_DEVICE_ID_VIRTIO_BLK_09 &&
pci->device != PCI_DEVICE_ID_VIRTIO_BLK_10))
continue;
+
+ if (skip_nonbootable && bootprio_find_pci_device(pci) < 0) {
+ dprintf(1, "skipping init of a non-bootable virtio-blk at %pP\n",
+ pci);
+ continue;
+ }
+
run_thread(init_virtio_blk, pci);
}
}
diff --git a/src/hw/virtio-scsi.c b/src/hw/virtio-scsi.c
index e1e2f5d..a27bdc1 100644
--- a/src/hw/virtio-scsi.c
+++ b/src/hw/virtio-scsi.c
@@ -18,7 +18,7 @@
#include "stacks.h" // run_thread
#include "std/disk.h" // DISK_RET_SUCCESS
#include "string.h" // memset
-#include "util.h" // usleep
+#include "util.h" // usleep, bootprio_find_pci_device, is_bootprio_strict
#include "virtio-pci.h"
#include "virtio-ring.h"
#include "virtio-scsi.h"
@@ -205,6 +205,8 @@ fail:
void
virtio_scsi_setup(void)
{
+ u8 skip_nonbootable = is_bootprio_strict();
+
ASSERT32FLAT();
if (! CONFIG_VIRTIO_SCSI)
return;
@@ -217,6 +219,13 @@ virtio_scsi_setup(void)
(pci->device != PCI_DEVICE_ID_VIRTIO_SCSI_09 &&
pci->device != PCI_DEVICE_ID_VIRTIO_SCSI_10))
continue;
+
+ if (skip_nonbootable && bootprio_find_pci_device(pci) < 0) {
+ dprintf(1, "skipping init of a non-bootable virtio-scsi at %pP\n",
+ pci);
+ continue;
+ }
+
run_thread(init_virtio_scsi, pci);
}
}