mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
devices: gic: use VgicConfig everywhere
Use VgicConfig to initialize Vgic. Use Gic::create_default_config everywhere so we don't always recompute redist/msi registers. Add a helper create_test_vgic_config for tests in hypervisor crate. Signed-off-by: Nuno Das Neves <nudasnev@microsoft.com>
This commit is contained in:
committed by
Rob Bradford
parent
a832033531
commit
784a3aaf3c
@@ -33,6 +33,8 @@ use anyhow::anyhow;
|
||||
use arch::aarch64::regs;
|
||||
use arch::EntryPoint;
|
||||
use arch::NumaNodes;
|
||||
#[cfg(target_arch = "aarch64")]
|
||||
use devices::gic::Gic;
|
||||
use devices::interrupt_controller::InterruptController;
|
||||
#[cfg(all(target_arch = "aarch64", feature = "gdb"))]
|
||||
use gdbstub_arch::aarch64::reg::AArch64CoreRegs as CoreRegs;
|
||||
@@ -1333,6 +1335,7 @@ impl CpuManager {
|
||||
|
||||
madt.append(gicc);
|
||||
}
|
||||
let vgic_config = Gic::create_default_config(self.config.boot_vcpus.into());
|
||||
|
||||
// GIC Distributor structure. See section 5.2.12.15 in ACPI spec.
|
||||
let gicd = GicD {
|
||||
@@ -1340,7 +1343,7 @@ impl CpuManager {
|
||||
length: 24,
|
||||
reserved0: 0,
|
||||
gic_id: 0,
|
||||
base_address: arch::layout::GIC_V3_DIST_START.0,
|
||||
base_address: vgic_config.dist_addr,
|
||||
global_irq_base: 0,
|
||||
version: 3,
|
||||
reserved1: [0; 3],
|
||||
@@ -1348,15 +1351,12 @@ impl CpuManager {
|
||||
madt.append(gicd);
|
||||
|
||||
// See 5.2.12.17 GIC Redistributor (GICR) Structure in ACPI spec.
|
||||
let gicr_size: u32 =
|
||||
(arch::layout::GIC_V3_REDIST_SIZE * self.config.boot_vcpus as u64) as u32;
|
||||
let gicr_base: u64 = arch::layout::GIC_V3_DIST_START.0 - gicr_size as u64;
|
||||
let gicr = GicR {
|
||||
r#type: acpi::ACPI_APIC_GENERIC_REDISTRIBUTOR,
|
||||
length: 16,
|
||||
reserved: 0,
|
||||
base_address: gicr_base,
|
||||
range_length: gicr_size,
|
||||
base_address: vgic_config.redists_addr,
|
||||
range_length: vgic_config.redists_size as u32,
|
||||
};
|
||||
madt.append(gicr);
|
||||
|
||||
@@ -1366,7 +1366,7 @@ impl CpuManager {
|
||||
length: 20,
|
||||
reserved0: 0,
|
||||
translation_id: 0,
|
||||
base_address: gicr_base - arch::layout::GIC_V3_ITS_SIZE,
|
||||
base_address: vgic_config.msi_addr,
|
||||
reserved1: 0,
|
||||
};
|
||||
madt.append(gicits);
|
||||
|
||||
Reference in New Issue
Block a user