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 <noreply+kokoro@google.com>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Kazuhiro Inaba <kinaba@chromium.org>
Commit-Queue: Tomasz Jeznach <tjeznach@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
This commit is contained in:
Tomasz Jeznach 2021-09-06 23:55:16 -07:00 committed by Commit Bot
parent 3407843bd4
commit 770c0935da

View file

@ -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<RawDescriptor> {
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]) {