summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2022-03-21 14:01:07 +0000
committerAlyssa Ross <hi@alyssa.is>2022-03-22 08:34:04 +0000
commitd55913426b0f26d8c586bc1fdd0e4cdb73d77777 (patch)
treeee4da83e28542c6b3b044dea3ea99b46f37bab9c
parentcf7e089a907439c6293f85bc46e9c9f6319d7509 (diff)
downloadspectrum-d55913426b0f26d8c586bc1fdd0e4cdb73d77777.tar
spectrum-d55913426b0f26d8c586bc1fdd0e4cdb73d77777.tar.gz
spectrum-d55913426b0f26d8c586bc1fdd0e4cdb73d77777.tar.bz2
spectrum-d55913426b0f26d8c586bc1fdd0e4cdb73d77777.tar.lz
spectrum-d55913426b0f26d8c586bc1fdd0e4cdb73d77777.tar.xz
spectrum-d55913426b0f26d8c586bc1fdd0e4cdb73d77777.tar.zst
spectrum-d55913426b0f26d8c586bc1fdd0e4cdb73d77777.zip
host/rootfs: remove unnecessary modprobes
Now that we're using a proper modprobe implementation, some of these
weird modprobes we shouldn't have needed in the first place can
actually be removed.

Message-Id: <20220321140107.1043654-2-hi@alyssa.is>
Tested-by: Ville Ilvonen <ville.ilvonen@unikie.com>
-rwxr-xr-xhost/rootfs/etc/mdev/net/add5
-rw-r--r--host/start-vm/modprobe.rs49
-rw-r--r--host/start-vm/start-vm.rs4
3 files changed, 1 insertions, 57 deletions
diff --git a/host/rootfs/etc/mdev/net/add b/host/rootfs/etc/mdev/net/add
index 959d73a..7b282e7 100755
--- a/host/rootfs/etc/mdev/net/add
+++ b/host/rootfs/etc/mdev/net/add
@@ -5,10 +5,7 @@
 # Assign the whole IOMMU group containing this device to the network
 # VM.
 
-if {
-  forx -pE module { vfio-pci vfio_iommu_type1 }
-  modprobe $module
-}
+if { modprobe vfio-pci }
 
 importas -i devpath DEVPATH
 
diff --git a/host/start-vm/modprobe.rs b/host/start-vm/modprobe.rs
deleted file mode 100644
index 6186820..0000000
--- a/host/start-vm/modprobe.rs
+++ /dev/null
@@ -1,49 +0,0 @@
-// SPDX-License-Identifier: EUPL-1.2
-// SPDX-FileCopyrightText: 2022 Alyssa Ross <hi@alyssa.is>
-
-use std::ffi::OsStr;
-use std::fmt::{self, Display, Formatter};
-use std::io;
-use std::os::unix::prelude::*;
-use std::process::{Command, ExitStatus};
-
-#[derive(Debug)]
-pub enum ModprobeError {
-    Spawn(io::Error),
-    Fail(ExitStatus),
-}
-
-impl Display for ModprobeError {
-    fn fmt(&self, f: &mut Formatter) -> fmt::Result {
-        use ModprobeError::*;
-        match self {
-            Spawn(e) => write!(f, "failed to spawn modprobe: {}", e),
-            Fail(status) => {
-                if let Some(code) = status.code() {
-                    write!(f, "modprobe exited with status {}", code)
-                } else {
-                    write!(f, "modprobe killed by signal {}", status.signal().unwrap())
-                }
-            }
-        }
-    }
-}
-
-pub fn modprobe<I, S>(module_names: I) -> Result<(), ModprobeError>
-where
-    I: IntoIterator<Item = S>,
-    S: AsRef<OsStr>,
-{
-    let status = Command::new("modprobe")
-        .arg("-q")
-        .arg("--")
-        .args(module_names)
-        .status()
-        .map_err(ModprobeError::Spawn)?;
-
-    if status.success() {
-        Ok(())
-    } else {
-        Err(ModprobeError::Fail(status))
-    }
-}
diff --git a/host/start-vm/start-vm.rs b/host/start-vm/start-vm.rs
index becbe5c..0d08eaa 100644
--- a/host/start-vm/start-vm.rs
+++ b/host/start-vm/start-vm.rs
@@ -2,7 +2,6 @@
 // SPDX-FileCopyrightText: 2022 Alyssa Ross <hi@alyssa.is>
 
 mod ch;
-mod modprobe;
 mod net;
 
 use std::env::{args, current_dir};
@@ -12,7 +11,6 @@ use std::os::unix::prelude::*;
 use std::path::PathBuf;
 use std::process::{exit, Command};
 
-use modprobe::modprobe;
 use net::{format_mac, net_setup, NetConfig};
 
 macro_rules! errx {
@@ -30,8 +28,6 @@ macro_rules! err {
 }
 
 fn main() {
-    modprobe(&["kvm-intel"]).unwrap_or_else(err!(1, "modprobe kvm-intel"));
-
     let mut command = Command::new("s6-notifyoncheck");
     command.args(&["-dc", "test -S env/cloud-hypervisor.sock"]);
     command.arg("cloud-hypervisor");