diff options
author | Idan Horowitz <idan.horowitz@gmail.com> | 2021-04-18 16:06:35 +0300 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-04-18 22:06:42 +0200 |
commit | aaf3d26dae90318e4d530ccc164574914223feeb (patch) | |
tree | 6c6151687dbd6a54b4dff12d584ff48ff450334c /Kernel | |
parent | 7dc95721ee0087846d818fdc46b380ed888c1d0e (diff) | |
download | serenity-aaf3d26dae90318e4d530ccc164574914223feeb.zip |
Kernel: Add kernel command line flag to disable VirtIO support
This command line flag can be used to disable VirtIO support on
certain configurations (native windows) where interfacing with
virtio devices can cause qemu to freeze.
Diffstat (limited to 'Kernel')
-rw-r--r-- | Kernel/CommandLine.cpp | 5 | ||||
-rw-r--r-- | Kernel/CommandLine.h | 1 | ||||
-rw-r--r-- | Kernel/VirtIO/VirtIO.cpp | 3 |
3 files changed, 9 insertions, 0 deletions
diff --git a/Kernel/CommandLine.cpp b/Kernel/CommandLine.cpp index c81003447f..27dc9e9bc0 100644 --- a/Kernel/CommandLine.cpp +++ b/Kernel/CommandLine.cpp @@ -170,6 +170,11 @@ UNMAP_AFTER_INIT bool CommandLine::disable_uhci_controller() const return contains("disable_uhci_controller"); } +UNMAP_AFTER_INIT bool CommandLine::disable_virtio() const +{ + return contains("disable_virtio"); +} + UNMAP_AFTER_INIT AHCIResetMode CommandLine::ahci_reset_mode() const { const auto ahci_reset_mode = lookup("ahci_reset_mode").value_or("controller"); diff --git a/Kernel/CommandLine.h b/Kernel/CommandLine.h index 8a734d2405..109ad7b5fa 100644 --- a/Kernel/CommandLine.h +++ b/Kernel/CommandLine.h @@ -87,6 +87,7 @@ public: [[nodiscard]] bool disable_physical_storage() const; [[nodiscard]] bool disable_ps2_controller() const; [[nodiscard]] bool disable_uhci_controller() const; + [[nodiscard]] bool disable_virtio() const; [[nodiscard]] AHCIResetMode ahci_reset_mode() const; [[nodiscard]] String userspace_init() const; [[nodiscard]] Vector<String> userspace_init_args() const; diff --git a/Kernel/VirtIO/VirtIO.cpp b/Kernel/VirtIO/VirtIO.cpp index 203a529986..b01689a036 100644 --- a/Kernel/VirtIO/VirtIO.cpp +++ b/Kernel/VirtIO/VirtIO.cpp @@ -24,6 +24,7 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include <Kernel/CommandLine.h> #include <Kernel/VirtIO/VirtIO.h> #include <Kernel/VirtIO/VirtIOConsole.h> #include <Kernel/VirtIO/VirtIORNG.h> @@ -32,6 +33,8 @@ namespace Kernel { void VirtIO::detect() { + if (kernel_command_line().disable_virtio()) + return; PCI::enumerate([&](const PCI::Address& address, PCI::ID id) { if (address.is_null() || id.is_null()) return; |