direct_irq: Add support for host wakeup capable IRQs

Add userspace counterpart to host kernel change CL:3571844 to support
physical wakeup of the machine from suspend via forwarded interrupts
from wakeup-capable devices owned by CrOS (touchpad, keyboard etc).

Add --direct-wake-irq param for marking forwarded IRQs as wakeup
capable.

BUG=b:227735609
TEST=put DUT in s2idle and wakeup by keyboard and LID open

Change-Id: I28fe26a06ca88920e55caf1121c5774711db2160
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3572121
Reviewed-by: Dmitry Torokhov <dtor@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Tomasz Nowicki <tnowicki@google.com>
diff --git a/src/linux/mod.rs b/src/linux/mod.rs
index 3d3678f..f0dfdd0 100644
--- a/src/linux/mod.rs
+++ b/src/linux/mod.rs
@@ -1238,6 +1238,13 @@
         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);
     }
 
@@ -1253,6 +1260,13 @@
         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);
     }