From 770c0935daed993c8949173af56a5e202f787b67 Mon Sep 17 00:00:00 2001 From: Tomasz Jeznach Date: Mon, 6 Sep 2021 23:55:16 -0700 Subject: [PATCH] devices/ac97: keep irq event descriptors Fix to preserve ac97 event/resample events handles for minijail. Broken by crrev/c/3143586 BUG=b:198773299 TEST=arcvm audio access, record/play. Change-Id: I34d85a9f9355257c98e0c5c28e87d1e289117ed0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3144532 Tested-by: kokoro Reviewed-by: Daniel Verkamp Reviewed-by: Kazuhiro Inaba Commit-Queue: Tomasz Jeznach Commit-Queue: Daniel Verkamp --- devices/src/pci/ac97.rs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/devices/src/pci/ac97.rs b/devices/src/pci/ac97.rs index aad8db22ed..e03e918f25 100644 --- a/devices/src/pci/ac97.rs +++ b/devices/src/pci/ac97.rs @@ -7,7 +7,7 @@ use std::path::PathBuf; use std::str::FromStr; use audio_streams::shm_streams::{NullShmStreamSource, ShmStreamSource}; -use base::{error, Event, RawDescriptor}; +use base::{error, AsRawDescriptor, Event, RawDescriptor}; #[cfg(feature = "audio_cras")] use libcras::{CrasClient, CrasClientType, CrasSocketType, CrasSysError}; use remain::sorted; @@ -373,11 +373,17 @@ impl PciDevice for Ac97Dev { } fn keep_rds(&self) -> Vec { - if let Some(server_fds) = self.bus_master.keep_rds() { - server_fds - } else { - Vec::new() + let mut rds = Vec::new(); + if let Some(mut server_fds) = self.bus_master.keep_rds() { + rds.append(&mut server_fds); } + if let Some(irq_evt) = &self.irq_evt { + rds.push(irq_evt.as_raw_descriptor()); + } + if let Some(irq_resample_evt) = &self.irq_resample_evt { + rds.push(irq_resample_evt.as_raw_descriptor()); + } + rds } fn read_bar(&mut self, addr: u64, data: &mut [u8]) {