summary refs log tree commit diff
path: root/x86_64
diff options
context:
space:
mode:
authorChuanxiao Dong <chuanxiao.dong@intel.corp-partner.google.com>2019-11-01 15:50:58 +0800
committerCommit Bot <commit-bot@chromium.org>2020-02-28 12:46:18 +0000
commit05d30607bc70b2c3f79337405a35bc4be43a1660 (patch)
treea5beb74d1c5d8d7b2dccde0cf399622a8daec45c /x86_64
parent7eae7735ee3485605d2ec7ba0685588b7a38b37b (diff)
downloadcrosvm-05d30607bc70b2c3f79337405a35bc4be43a1660.tar
crosvm-05d30607bc70b2c3f79337405a35bc4be43a1660.tar.gz
crosvm-05d30607bc70b2c3f79337405a35bc4be43a1660.tar.bz2
crosvm-05d30607bc70b2c3f79337405a35bc4be43a1660.tar.lz
crosvm-05d30607bc70b2c3f79337405a35bc4be43a1660.tar.xz
crosvm-05d30607bc70b2c3f79337405a35bc4be43a1660.tar.zst
crosvm-05d30607bc70b2c3f79337405a35bc4be43a1660.zip
acpi: allocate sci_irq instead of use fixed number
sci_irq can be allocated so not to use the fixed number 9.
Actually this irq is not used for injecting any event but
the Linux guest OS requires to see meaning value from the
FADP table. So just fill it to satisfy.

BUG=chromium:1018674
TEST=None

Change-Id: If3ea3bb2844fc7fc1c24a577b7098d2a3e6f1c7f
Signed-off-by: Chuanxiao Dong <chuanxiao.dong@intel.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2035352
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Tomasz Jeznach <tjeznach@chromium.org>
Diffstat (limited to 'x86_64')
-rw-r--r--x86_64/src/lib.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/x86_64/src/lib.rs b/x86_64/src/lib.rs
index 20831cd..b6f18e3 100644
--- a/x86_64/src/lib.rs
+++ b/x86_64/src/lib.rs
@@ -66,6 +66,7 @@ use sys_util::{Clock, EventFd, GuestAddress, GuestMemory, GuestMemoryError};
 #[sorted]
 #[derive(Debug)]
 pub enum Error {
+    AllocateIrq,
     CloneEventFd(sys_util::Error),
     Cmdline(kernel_cmdline::Error),
     ConfigureSystem,
@@ -112,6 +113,7 @@ impl Display for Error {
 
         #[sorted]
         match self {
+            AllocateIrq => write!(f, "error allocating a single irq"),
             CloneEventFd(e) => write!(f, "unable to clone an EventFd: {}", e),
             Cmdline(e) => write!(f, "the given kernel command line was invalid: {}", e),
             ConfigureSystem => write!(f, "error configuring the system"),
@@ -192,6 +194,7 @@ fn configure_system(
     setup_data: Option<GuestAddress>,
     initrd: Option<(GuestAddress, usize)>,
     mut params: boot_params,
+    sci_irq: u32,
 ) -> Result<()> {
     const EBDA_START: u64 = 0x0009fc00;
     const KERNEL_BOOT_FLAG_MAGIC: u16 = 0xaa55;
@@ -255,7 +258,7 @@ fn configure_system(
         .write_obj_at_addr(params, zero_page_addr)
         .map_err(|_| Error::ZeroPageSetup)?;
 
-    let rsdp_addr = acpi::create_acpi_tables(guest_mem, num_cpus, 9);
+    let rsdp_addr = acpi::create_acpi_tables(guest_mem, num_cpus, sci_irq);
     params.acpi_rsdp_addr = rsdp_addr.0;
 
     Ok(())
@@ -368,6 +371,8 @@ impl arch::LinuxArch for X8664arch {
 
         // Event used to notify crosvm that guest OS is trying to suspend.
         let suspend_evt = EventFd::new().map_err(Error::CreateEventFd)?;
+        // allocate sci_irq to fill the ACPI FACP table
+        let sci_irq = resources.allocate_irq().ok_or(Error::AllocateIrq)?;
 
         let mut io_bus = Self::setup_io_bus(
             &mut vm,
@@ -430,6 +435,7 @@ impl arch::LinuxArch for X8664arch {
                     components.android_fstab,
                     kernel_end,
                     params,
+                    sci_irq,
                 )?;
             }
         }
@@ -514,6 +520,7 @@ impl X8664arch {
         android_fstab: Option<File>,
         kernel_end: u64,
         params: boot_params,
+        sci_irq: u32,
     ) -> Result<()> {
         kernel_loader::load_cmdline(mem, GuestAddress(CMDLINE_OFFSET), cmdline)
             .map_err(Error::LoadCmdline)?;
@@ -575,6 +582,7 @@ impl X8664arch {
             setup_data,
             initrd,
             params,
+            sci_irq,
         )?;
         Ok(())
     }