mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vmm: aarch64: Use GIC_V3_* consts instead of magic numbers in create_madt()
Signed-off-by: Nuno Das Neves <nudasnev@microsoft.com>
This commit is contained in:
@@ -59,7 +59,7 @@ pub const UEFI_START: GuestAddress = GuestAddress(0);
|
|||||||
pub const UEFI_SIZE: u64 = 0x040_0000;
|
pub const UEFI_SIZE: u64 = 0x040_0000;
|
||||||
|
|
||||||
/// Below this address will reside the GIC, above this address will reside the MMIO devices.
|
/// Below this address will reside the GIC, above this address will reside the MMIO devices.
|
||||||
pub const MAPPED_IO_START: GuestAddress = GuestAddress(0x0900_0000);
|
const MAPPED_IO_START: GuestAddress = GuestAddress(0x0900_0000);
|
||||||
|
|
||||||
/// See kernel file arch/arm64/include/uapi/asm/kvm.h for the GIC related definitions.
|
/// See kernel file arch/arm64/include/uapi/asm/kvm.h for the GIC related definitions.
|
||||||
/// 0x08ff_0000 ~ 0x0900_0000 is reserved for GICv3 Distributor
|
/// 0x08ff_0000 ~ 0x0900_0000 is reserved for GICv3 Distributor
|
||||||
@@ -73,7 +73,7 @@ pub const GIC_V3_REDIST_SIZE: u64 = 0x02_0000;
|
|||||||
pub const GIC_V3_ITS_SIZE: u64 = 0x02_0000;
|
pub const GIC_V3_ITS_SIZE: u64 = 0x02_0000;
|
||||||
|
|
||||||
/// Space 0x0900_0000 ~ 0x0905_0000 is reserved for legacy devices.
|
/// Space 0x0900_0000 ~ 0x0905_0000 is reserved for legacy devices.
|
||||||
pub const LEGACY_SERIAL_MAPPED_IO_START: GuestAddress = GuestAddress(0x0900_0000);
|
pub const LEGACY_SERIAL_MAPPED_IO_START: GuestAddress = MAPPED_IO_START;
|
||||||
pub const LEGACY_RTC_MAPPED_IO_START: GuestAddress = GuestAddress(0x0901_0000);
|
pub const LEGACY_RTC_MAPPED_IO_START: GuestAddress = GuestAddress(0x0901_0000);
|
||||||
pub const LEGACY_GPIO_MAPPED_IO_START: GuestAddress = GuestAddress(0x0902_0000);
|
pub const LEGACY_GPIO_MAPPED_IO_START: GuestAddress = GuestAddress(0x0902_0000);
|
||||||
|
|
||||||
|
|||||||
+5
-6
@@ -1275,7 +1275,6 @@ impl CpuManager {
|
|||||||
|
|
||||||
#[cfg(target_arch = "aarch64")]
|
#[cfg(target_arch = "aarch64")]
|
||||||
{
|
{
|
||||||
use vm_memory::Address;
|
|
||||||
/* Notes:
|
/* Notes:
|
||||||
* Ignore Local Interrupt Controller Address at byte offset 36 of MADT table.
|
* Ignore Local Interrupt Controller Address at byte offset 36 of MADT table.
|
||||||
*/
|
*/
|
||||||
@@ -1323,7 +1322,7 @@ impl CpuManager {
|
|||||||
length: 24,
|
length: 24,
|
||||||
reserved0: 0,
|
reserved0: 0,
|
||||||
gic_id: 0,
|
gic_id: 0,
|
||||||
base_address: arch::layout::MAPPED_IO_START.raw_value() - 0x0001_0000,
|
base_address: arch::layout::GIC_V3_DIST_START.0,
|
||||||
global_irq_base: 0,
|
global_irq_base: 0,
|
||||||
version: 3,
|
version: 3,
|
||||||
reserved1: [0; 3],
|
reserved1: [0; 3],
|
||||||
@@ -1331,9 +1330,9 @@ impl CpuManager {
|
|||||||
madt.append(gicd);
|
madt.append(gicd);
|
||||||
|
|
||||||
// See 5.2.12.17 GIC Redistributor (GICR) Structure in ACPI spec.
|
// See 5.2.12.17 GIC Redistributor (GICR) Structure in ACPI spec.
|
||||||
let gicr_size: u32 = 0x0001_0000 * 2 * (self.config.boot_vcpus as u32);
|
let gicr_size: u32 =
|
||||||
let gicr_base: u64 =
|
(arch::layout::GIC_V3_REDIST_SIZE * self.config.boot_vcpus as u64) as u32;
|
||||||
arch::layout::MAPPED_IO_START.raw_value() - 0x0001_0000 - gicr_size as u64;
|
let gicr_base: u64 = arch::layout::GIC_V3_DIST_START.0 - gicr_size as u64;
|
||||||
let gicr = GicR {
|
let gicr = GicR {
|
||||||
r#type: acpi::ACPI_APIC_GENERIC_REDISTRIBUTOR,
|
r#type: acpi::ACPI_APIC_GENERIC_REDISTRIBUTOR,
|
||||||
length: 16,
|
length: 16,
|
||||||
@@ -1349,7 +1348,7 @@ impl CpuManager {
|
|||||||
length: 20,
|
length: 20,
|
||||||
reserved0: 0,
|
reserved0: 0,
|
||||||
translation_id: 0,
|
translation_id: 0,
|
||||||
base_address: gicr_base - 2 * 0x0001_0000,
|
base_address: gicr_base - arch::layout::GIC_V3_ITS_SIZE,
|
||||||
reserved1: 0,
|
reserved1: 0,
|
||||||
};
|
};
|
||||||
madt.append(gicits);
|
madt.append(gicits);
|
||||||
|
|||||||
Reference in New Issue
Block a user