From d61e24be2c01e4b7c6d53587b4d30e31b8d7db28 Mon Sep 17 00:00:00 2001 From: Dmytro Maluka Date: Tue, 19 Apr 2022 15:12:26 +0000 Subject: [PATCH] Revert "direct_irq: Add support for host wakeup capable IRQs" This reverts commit 0ac97979b608bffed7346ed198bfaed775df7df3. Reason for revert: This static configuration for wakeup IRQs is no longer needed since we have a mechanism for automatic dynamic configuration of wakeup IRQs based on requests from ChromeOS VM. BUG=b:228449597 TEST=Boot ManaTEE and verify wakeup from touchpad and other devices. Change-Id: Ifce6919d3c3ab9e677ee0a6566aba4d720168db5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3593741 Reviewed-by: Tomasz Nowicki Tested-by: kokoro Reviewed-by: Micah Morton Reviewed-by: Dmitry Torokhov Commit-Queue: Tomasz Nowicki --- devices/src/direct_irq.rs | 21 --------------------- src/crosvm.rs | 4 ---- src/linux/mod.rs | 14 -------------- src/main.rs | 17 ----------------- vfio_sys/src/lib.rs | 6 ------ vfio_sys/src/plat.rs | 9 --------- 6 files changed, 71 deletions(-) diff --git a/devices/src/direct_irq.rs b/devices/src/direct_irq.rs index c120c7f146..4e76d56adc 100644 --- a/devices/src/direct_irq.rs +++ b/devices/src/direct_irq.rs @@ -27,8 +27,6 @@ pub enum DirectIrqError { EnableGpe, #[error("failed to enable direct sci irq")] EnableSci, - #[error("failed to enable wake irq")] - EnableWake, #[error("failed to open /dev/plat-irq-forward: {0}")] Open(io::Error), } @@ -109,10 +107,6 @@ impl DirectIrq { Ok(()) } - pub fn irq_wake_enable(&self, irq_num: u32) -> Result<(), DirectIrqError> { - self.plat_irq_wake_ioctl(irq_num, PLAT_IRQ_WAKE_ENABLE) - } - /// Enable hardware triggered SCI interrupt handling for GPE. /// /// Note: sci_irq_prepare() itself does not enable SCI forwarding yet @@ -166,21 +160,6 @@ impl DirectIrq { } } - fn plat_irq_wake_ioctl(&self, irq_num: u32, action: u32) -> Result<(), DirectIrqError> { - let mut irq_wake_set = vec_with_array_field::(0); - irq_wake_set[0].argsz = (size_of::()) as u32; - irq_wake_set[0].action_flags = action; - irq_wake_set[0].irq_number_host = irq_num; - - // Safe as we are the owner of plat_irq_wake_set and irq_wake_set which are valid value - let ret = unsafe { ioctl_with_ref(self, PLAT_IRQ_WAKE_SET(), &irq_wake_set[0]) }; - if ret < 0 { - Err(DirectIrqError::EnableWake) - } else { - Ok(()) - } - } - /// Enable hardware triggered GPE handling via SCI interrupt forwarding. /// Note: requires sci_irq_prepare() to be called beforehand. /// diff --git a/src/crosvm.rs b/src/crosvm.rs index 9bc9ee40b4..6102cb528d 100644 --- a/src/crosvm.rs +++ b/src/crosvm.rs @@ -381,8 +381,6 @@ pub struct Config { pub direct_mmio: Option, #[cfg(feature = "direct")] pub direct_pmio: Option, - #[cfg(feature = "direct")] - pub direct_wake_irq: Vec, pub disks: Vec, pub display_window_keyboard: bool, pub display_window_mouse: bool, @@ -510,8 +508,6 @@ impl Default for Config { direct_mmio: None, #[cfg(feature = "direct")] direct_pmio: None, - #[cfg(feature = "direct")] - direct_wake_irq: Vec::new(), disks: Vec::new(), display_window_keyboard: false, display_window_mouse: false, diff --git a/src/linux/mod.rs b/src/linux/mod.rs index 6140400cb5..c15591621e 100644 --- a/src/linux/mod.rs +++ b/src/linux/mod.rs @@ -1282,13 +1282,6 @@ where direct_irq .irq_enable(*irq) .context("failed to enable interrupt forwarding")?; - - if cfg.direct_wake_irq.contains(&irq) { - direct_irq - .irq_wake_enable(*irq) - .context("failed to enable interrupt wake")?; - } - irqs.push(direct_irq); } @@ -1304,13 +1297,6 @@ where direct_irq .irq_enable(*irq) .context("failed to enable interrupt forwarding")?; - - if cfg.direct_wake_irq.contains(&irq) { - direct_irq - .irq_wake_enable(*irq) - .context("failed to enable interrupt wake")?; - } - irqs.push(direct_irq); } diff --git a/src/main.rs b/src/main.rs index 914e64ed8e..c59af127b0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1816,21 +1816,6 @@ fn set_argument(cfg: &mut Config, name: &str, value: Option<&str>) -> argument:: ); } #[cfg(feature = "direct")] - "direct-wake-irq" => { - cfg.direct_wake_irq - .push( - value - .unwrap() - .parse() - .map_err(|_| argument::Error::InvalidValue { - value: value.unwrap().to_owned(), - expected: String::from( - "this value for `direct-wake-irq` must be an unsigned integer", - ), - })?, - ); - } - #[cfg(feature = "direct")] "direct-gpe" => { cfg.direct_gpe.push(value.unwrap().parse().map_err(|_| { argument::Error::InvalidValue { @@ -2567,8 +2552,6 @@ iommu=on|off - indicates whether to enable virtio IOMMU for this device"), Argument::value("direct-level-irq", "irq", "Enable interrupt passthrough"), #[cfg(feature = "direct")] Argument::value("direct-edge-irq", "irq", "Enable interrupt passthrough"), -#[cfg(feature = "direct")] - Argument::value("direct-wake-irq", "irq", "Enable wakeup interrupt for host"), #[cfg(feature = "direct")] Argument::value("direct-gpe", "gpe", "Enable GPE interrupt and register access passthrough"), Argument::value("dmi", "DIR", "Directory with smbios_entry_point/DMI files"), diff --git a/vfio_sys/src/lib.rs b/vfio_sys/src/lib.rs index 9905bd58f4..bded17335d 100644 --- a/vfio_sys/src/lib.rs +++ b/vfio_sys/src/lib.rs @@ -50,12 +50,6 @@ ioctl_io_nr!( PLAT_IRQ_FORWARD_BASE ); -ioctl_io_nr!( - PLAT_IRQ_WAKE_SET, - PLAT_IRQ_FORWARD_TYPE, - PLAT_IRQ_FORWARD_BASE + 1 -); - ioctl_io_nr!( ACPI_GPE_FORWARD_SET, PLAT_IRQ_FORWARD_TYPE, diff --git a/vfio_sys/src/plat.rs b/vfio_sys/src/plat.rs index 680eac9d74..ee79d2e70d 100644 --- a/vfio_sys/src/plat.rs +++ b/vfio_sys/src/plat.rs @@ -68,8 +68,6 @@ pub const PLAT_IRQ_FORWARD_SET_LEVEL_UNMASK_EVENTFD: u32 = 2; pub const PLAT_IRQ_FORWARD_SET_EDGE_TRIGGER: u32 = 4; pub const PLAT_IRQ_FORWARD_SET_LEVEL_SCI_FOR_GPE_TRIGGER_EVENTFD: u32 = 8; pub const PLAT_IRQ_FORWARD_SET_LEVEL_SCI_FOR_GPE_UNMASK_EVENTFD: u32 = 16; -pub const PLAT_IRQ_WAKE_ENABLE: u32 = 1; -pub const PLAT_IRQ_WAKE_DISABLE: u32 = 2; pub const ACPI_GPE_FORWARD_SET_TRIGGER: u32 = 1; pub const ACPI_GPE_FORWARD_CLEAR_TRIGGER: u32 = 2; pub type __s8 = ::std::os::raw::c_schar; @@ -140,13 +138,6 @@ pub struct plat_irq_forward_set { } #[repr(C)] #[derive(Debug, Default, Copy, Clone)] -pub struct plat_irq_wake_set { - pub argsz: __u32, - pub action_flags: __u32, - pub irq_number_host: __u32, -} -#[repr(C)] -#[derive(Debug, Default, Copy, Clone)] pub struct gpe_forward_set { pub argsz: __u32, pub action_flags: __u32,