| 1130 | } |
| 1131 | |
| 1132 | pub(crate) fn enable_msix(&self) -> Result<(), VfioPciError> { |
| 1133 | if let Some(msix) = &self.interrupt.msix { |
| 1134 | let mut irq_fds: Vec<EventFd> = Vec::new(); |
| 1135 | for i in 0..msix.bar.table_entries.len() { |
| 1136 | if let Some(eventfd) = msix.interrupt_source_group.notifier(i as InterruptIndex) { |
| 1137 | irq_fds.push(eventfd); |
| 1138 | } else { |
| 1139 | return Err(VfioPciError::MissingNotifier); |
| 1140 | } |
| 1141 | } |
| 1142 | |
| 1143 | self.vfio_wrapper |
| 1144 | .enable_msix(irq_fds.iter().collect()) |
| 1145 | .map_err(VfioPciError::EnableMsix)?; |
| 1146 | } |
| 1147 | |
| 1148 | Ok(()) |
| 1149 | } |
| 1150 | |
| 1151 | pub(crate) fn disable_msix(&self) { |
| 1152 | if let Err(e) = self.vfio_wrapper.disable_msix() { |