| 79 | } |
| 80 | |
| 81 | fn enable(&self) -> Result<()> { |
| 82 | // Set irqfd for legacy interrupts |
| 83 | self.interrupt_source_group |
| 84 | .enable() |
| 85 | .map_err(Error::EnableInterrupt)?; |
| 86 | |
| 87 | // Set irq_routing for legacy interrupts. |
| 88 | // irqchip: Hardcode to 0 as we support only 1 GIC |
| 89 | // pin: Use irq number as pin |
| 90 | for i in IRQ_LEGACY_BASE..(IRQ_LEGACY_BASE + IRQ_LEGACY_COUNT) { |
| 91 | let config = LegacyIrqSourceConfig { |
| 92 | irqchip: 0, |
| 93 | pin: (i - IRQ_LEGACY_BASE) as u32, |
| 94 | }; |
| 95 | self.interrupt_source_group |
| 96 | .update( |
| 97 | i as InterruptIndex, |
| 98 | InterruptSourceConfig::LegacyIrq(config), |
| 99 | false, |
| 100 | false, |
| 101 | ) |
| 102 | .map_err(Error::EnableInterrupt)?; |
| 103 | } |
| 104 | |
| 105 | self.interrupt_source_group |
| 106 | .set_gsi() |
| 107 | .map_err(Error::EnableInterrupt)?; |
| 108 | Ok(()) |
| 109 | } |
| 110 | |
| 111 | /// Default config implied by arch::layout |
| 112 | pub fn create_default_config(vcpu_count: u64) -> VgicConfig { |