From: Waldemar Kozaczuk <[email protected]>
Committer: Waldemar Kozaczuk <[email protected]>
Branch: master
Add boot option to disable PCI enumeration
Signed-off-by: Waldemar Kozaczuk <[email protected]>
---
diff --git a/arch/x64/arch-setup.cc b/arch/x64/arch-setup.cc
--- a/arch/x64/arch-setup.cc
+++ b/arch/x64/arch-setup.cc
@@ -233,18 +233,18 @@ void arch_init_premain()
#include "drivers/vmxnet3.hh"
#include "drivers/ide.hh"
+extern bool opt_pci_disabled;
void arch_init_drivers()
{
// initialize panic drivers
panic::pvpanic::probe_and_setup();
boot_time.event("pvpanic done");
- // Enumerate PCI devices
- //TODO: Add boot option --pci=off to skip PCI enumeration
- // as on some platforms like firecracker enumerating "empty" bus
- // takes up to 10ms
- pci::pci_device_enumeration();
- boot_time.event("pci enumerated");
+ if (!opt_pci_disabled) {
+ // Enumerate PCI devices
+ pci::pci_device_enumeration();
+ boot_time.event("pci enumerated");
+ }
// Initialize all drivers
hw::driver_manager* drvman = hw::driver_manager::instance();
diff --git a/loader.cc b/loader.cc
--- a/loader.cc
+++ b/loader.cc
@@ -144,6 +144,7 @@ static std::string opt_redirect;
static std::chrono::nanoseconds boot_delay;
bool opt_maxnic = false;
int maxnic;
+bool opt_pci_disabled = false;
static int sampler_frequency;
static bool opt_enable_sampler = false;
@@ -182,6 +183,7 @@ void parse_options(int loader_argc, char** loader_argv)
("delay", bpo::value<float>()->default_value(0), "delay in seconds
before boot")
("redirect", bpo::value<std::string>(), "redirect stdout and
stderr to file")
("disable_rofs_cache", "disable ROFS memory cache")
+ ("nopci", "disable PCI enumeration")
;
bpo::variables_map vars;
// don't allow --foo bar (require --foo=bar) so we can find the first
non-option
@@ -295,6 +297,10 @@ void parse_options(int loader_argc, char** loader_argv)
}
boot_delay = std::chrono::duration_cast<std::chrono::nanoseconds>(1_s
* vars["delay"].as<float>());
+
+ if (vars.count("nopci")) {
+ opt_pci_disabled = true;
+ }
}
// return the std::string and the commands_args poiting to them as a move
--
You received this message because you are subscribed to the Google Groups "OSv
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.