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