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

Method new

devices/src/gic.rs:42–64  ·  view source on GitHub ↗
(
        vcpu_count: u32,
        interrupt_manager: Arc<dyn InterruptManager<GroupConfig = MsiIrqGroupConfig>>,
        vm: Arc<dyn hypervisor::Vm>,
    )

Source from the content-addressed store, hash-verified

40impl Gic {
41 #[allow(clippy::needless_pass_by_value)]
42 pub fn new(
43 vcpu_count: u32,
44 interrupt_manager: Arc<dyn InterruptManager<GroupConfig = MsiIrqGroupConfig>>,
45 vm: Arc<dyn hypervisor::Vm>,
46 ) -> Result<Gic> {
47 let interrupt_source_group = interrupt_manager
48 .create_group(MsiIrqGroupConfig {
49 base: IRQ_LEGACY_BASE as InterruptIndex,
50 count: IRQ_LEGACY_COUNT as InterruptIndex,
51 })
52 .map_err(Error::CreateInterruptSourceGroup)?;
53
54 let config = Gic::create_default_config(vcpu_count as u64);
55 let vgic = vm.create_vgic(&config).map_err(Error::CreateGic)?;
56
57 let gic = Gic {
58 interrupt_source_group,
59 vgic: Some(vgic),
60 };
61 gic.enable()?;
62
63 Ok(gic)
64 }
65
66 pub fn restore_vgic(
67 &mut self,

Callers

nothing calls this directly

Calls 3

create_groupMethod · 0.80
create_vgicMethod · 0.45
enableMethod · 0.45

Tested by

no test coverage detected