Kernel: Ensure SMP mode is not enabled if IOAPIC mode is disabled

We need to use the IOAPIC in SMP mode, so if the user requested to
disable it, we can't enable SMP mode either.
This commit is contained in:
Liav A 2021-12-19 21:30:36 +02:00 committed by Brian Gianforcaro
parent f11fbb6415
commit 30659040ed
Notes: sideshowbarker 2024-07-17 22:33:13 +09:00
3 changed files with 13 additions and 1 deletions

View File

@ -108,9 +108,18 @@ UNMAP_AFTER_INIT bool CommandLine::is_ide_enabled() const
UNMAP_AFTER_INIT bool CommandLine::is_smp_enabled() const
{
// Note: We can't enable SMP mode without enabling the IOAPIC.
if (!is_ioapic_enabled())
return false;
return lookup("smp"sv).value_or("off"sv) == "on"sv;
}
UNMAP_AFTER_INIT bool CommandLine::is_smp_enabled_without_ioapic_enabled() const
{
auto smp_enabled = lookup("smp"sv).value_or("off"sv) == "on"sv;
return smp_enabled && !is_ioapic_enabled();
}
UNMAP_AFTER_INIT bool CommandLine::is_ioapic_enabled() const
{
auto value = lookup("enable_ioapic"sv).value_or("on"sv);

View File

@ -60,6 +60,7 @@ public:
[[nodiscard]] bool is_boot_profiling_enabled() const;
[[nodiscard]] bool is_ide_enabled() const;
[[nodiscard]] bool is_ioapic_enabled() const;
[[nodiscard]] bool is_smp_enabled_without_ioapic_enabled() const;
[[nodiscard]] bool is_smp_enabled() const;
[[nodiscard]] bool is_physical_networking_disabled() const;
[[nodiscard]] bool is_vmmouse_enabled() const;

View File

@ -40,7 +40,9 @@ UNMAP_AFTER_INIT void InterruptManagement::initialize()
{
VERIFY(!InterruptManagement::initialized());
s_interrupt_management = new InterruptManagement();
if (!kernel_command_line().is_smp_enabled_without_ioapic_enabled()) {
dbgln("Can't enable SMP mode without IOAPIC mode being enabled");
}
if (!kernel_command_line().is_ioapic_enabled() && !kernel_command_line().is_smp_enabled())
InterruptManagement::the().switch_to_pic_mode();
else