MCPcopy Create free account
hub / github.com/cloud-hypervisor/cloud-hypervisor / set_state

Method set_state

pci/src/vfio.rs:1415–1443  ·  view source on GitHub ↗
(
        &mut self,
        state: &VfioCommonState,
        msi_state: Option<MsiConfigState>,
        msix_state: Option<MsixConfigState>,
    )

Source from the content-addressed store, hash-verified

1413 }
1414
1415 fn set_state(
1416 &mut self,
1417 state: &VfioCommonState,
1418 msi_state: Option<MsiConfigState>,
1419 msix_state: Option<MsixConfigState>,
1420 ) -> Result<(), VfioPciError> {
1421 if let (Some(intx), Some(interrupt_source_group)) =
1422 (&state.intx_state, self.legacy_interrupt_group.clone())
1423 {
1424 self.interrupt.intx = Some(VfioIntx {
1425 interrupt_source_group,
1426 enabled: false,
1427 });
1428
1429 if intx.enabled {
1430 self.enable_intx()?;
1431 }
1432 }
1433
1434 if let Some(msi) = &state.msi_state {
1435 self.initialize_msi(msi.cap.msg_ctl, msi.cap_offset, msi_state);
1436 }
1437
1438 if let Some(msix) = &state.msix_state {
1439 self.initialize_msix(msix.cap, msix.cap_offset, msix.bdf.into(), msix_state);
1440 }
1441
1442 Ok(())
1443 }
1444}
1445
1446impl Pausable for VfioCommon {}

Callers 4

restore_vgicMethod · 0.45
restore_vaiaMethod · 0.45
newMethod · 0.45
create_vcpuMethod · 0.45

Calls 4

enable_intxMethod · 0.80
initialize_msiMethod · 0.80
initialize_msixMethod · 0.80
cloneMethod · 0.45

Tested by

no test coverage detected