move the PCI MMIO regions on aarch64
Some guest changes were required:
* microdroid: PCI CAM base is hardcoded in the bootconfig. Should be
migrated to `androidboot.boot_part_uuid` to avoid this.
* libvmbase: `MMIO_END` was incorrect. Shouldn't need to be updated
again for similar future changes.
* vmbase_example: Assumed all MMIO is in first GiB.
* platform.dts: Possibly working as intended
Bug: 361390145
Bug: 376480819
Test: packages/modules/Virtualization/android/vm/vm_shell.sh start-microdroid --auto-connect -- --enable-earlycon
Test: packages/modules/Virtualization/android/vm/vm_shell.sh start-microdroid --auto-connect -- --enable-earlycon --protected
Test: atest rialto
Change-Id: Ie4d09d4d7504dfc1022d0cf675af77c97750c257
diff --git a/android/virtmgr/src/crosvm.rs b/android/virtmgr/src/crosvm.rs
index b0944fc..46f4e80 100644
--- a/android/virtmgr/src/crosvm.rs
+++ b/android/virtmgr/src/crosvm.rs
@@ -1022,6 +1022,13 @@
command.arg("--params").arg("console=hvc0");
}
+ // Move the PCI MMIO regions to near the end of the low-MMIO space.
+ // This is done to accommodate a limitation in a partner's hypervisor.
+ #[cfg(target_arch = "aarch64")]
+ command
+ .arg("--pci")
+ .arg("mem=[start=0x70000000,size=0x2000000],cam=[start=0x72000000,size=0x1000000]");
+
command.arg("--mem").arg(memory_mib.to_string());
if let Some(cpus) = config.cpus {
diff --git a/build/microdroid/bootconfig.arm64 b/build/microdroid/bootconfig.arm64
index b1e6d56..7509a2c 100644
--- a/build/microdroid/bootconfig.arm64
+++ b/build/microdroid/bootconfig.arm64
@@ -1 +1 @@
-androidboot.boot_devices = 10000.pci
+androidboot.boot_devices = 72000000.pci
diff --git a/guest/pvmfw/platform.dts b/guest/pvmfw/platform.dts
index c3ecd0e..643a5e4 100644
--- a/guest/pvmfw/platform.dts
+++ b/guest/pvmfw/platform.dts
@@ -355,11 +355,11 @@
dma-coherent;
memory-region = <&swiotlb>;
ranges = <
- 0x3000000 0x0 0x02000000 0x0 0x02000000 0x00 0x02000000
+ 0x3000000 0x0 0x70000000 0x0 0x70000000 0x00 0x02000000
0x3000000 PLACEHOLDER2 PLACEHOLDER2 PLACEHOLDER2
>;
bus-range = <0x00 0x00>;
- reg = <0x00 0x10000 0x00 0x1000000>;
+ reg = <0x00 0x72000000 0x00 0x1000000>;
interrupt-map = <
0x0800 0x0 0x0 1 &intc 0 0 GIC_SPI (IRQ_BASE + 0) IRQ_TYPE_LEVEL_HIGH
0x1000 0x0 0x0 1 &intc 0 0 GIC_SPI (IRQ_BASE + 1) IRQ_TYPE_LEVEL_HIGH
diff --git a/libs/libvmbase/src/layout/crosvm.rs b/libs/libvmbase/src/layout/crosvm.rs
index d859b20..39a8147 100644
--- a/libs/libvmbase/src/layout/crosvm.rs
+++ b/libs/libvmbase/src/layout/crosvm.rs
@@ -21,10 +21,13 @@
/// The start address of MMIO space.
pub const MMIO_START: usize = 0x0;
/// The end address of MMIO space.
-pub const MMIO_END: usize = 0x4000_0000;
+pub const MMIO_END: usize = PVMFW_START;
/// MMIO range.
pub const MMIO_RANGE: Range<usize> = MMIO_START..MMIO_END;
+/// Start pvmfw region.
+pub const PVMFW_START: usize = 0x7fc00000;
+
/// The start of the system's contiguous "main" memory.
pub const MEM_START: usize = 0x8000_0000;
diff --git a/tests/hostside/java/com/android/microdroid/test/goldens/dt_dump_golden.dts b/tests/hostside/java/com/android/microdroid/test/goldens/dt_dump_golden.dts
index 795c50f..095eb54 100644
--- a/tests/hostside/java/com/android/microdroid/test/goldens/dt_dump_golden.dts
+++ b/tests/hostside/java/com/android/microdroid/test/goldens/dt_dump_golden.dts
@@ -104,8 +104,8 @@
dma-coherent;
interrupt-map = <0x800 0x00 0x00 0x01 0x01 0x00 0x00 0x00 0x04 0x04 0x1000 0x00 0x00 0x01 0x01 0x00 0x00 0x00 0x05 0x04 0x1800 0x00 0x00 0x01 0x01 0x00 0x00 0x00 0x06 0x04 0x2000 0x00 0x00 0x01 0x01 0x00 0x00 0x00 0x07 0x04 0x2800 0x00 0x00 0x01 0x01 0x00 0x00 0x00 0x08 0x04 0x3000 0x00 0x00 0x01 0x01 0x00 0x00 0x00 0x09 0x04 0x3800 0x00 0x00 0x01 0x01 0x00 0x00 0x00 0x0a 0x04 0x4000 0x00 0x00 0x01 0x01 0x00 0x00 0x00 0x0b 0x04 0x4800 0x00 0x00 0x01 0x01 0x00 0x00 0x00 0x0c 0x04>;
interrupt-map-mask = <0xf800 0x00 0x00 0x07 0xf800 0x00 0x00 0x07 0xf800 0x00 0x00 0x07 0xf800 0x00 0x00 0x07 0xf800 0x00 0x00 0x07 0xf800 0x00 0x00 0x07 0xf800 0x00 0x00 0x07 0xf800 0x00 0x00 0x07 0xf800 0x00 0x00 0x07>;
- ranges = <0x3000000 0x00 0x2000000 0x00 0x2000000 0x00 0x2000000 0x43000000 0x00 0x90800000 0x00 0x90800000 0xff 0x6f800000>;
- reg = <0x00 0x10000 0x00 0x1000000>;
+ ranges = <0x3000000 0x00 0x70000000 0x00 0x70000000 0x00 0x2000000 0x43000000 0x00 0x90800000 0x00 0x90800000 0xff 0x6f800000>;
+ reg = <0x00 0x72000000 0x00 0x1000000>;
};
pclk@3M {
diff --git a/tests/hostside/java/com/android/microdroid/test/goldens/dt_dump_protected_golden.dts b/tests/hostside/java/com/android/microdroid/test/goldens/dt_dump_protected_golden.dts
index 5761c15..f2ebdf9 100644
--- a/tests/hostside/java/com/android/microdroid/test/goldens/dt_dump_protected_golden.dts
+++ b/tests/hostside/java/com/android/microdroid/test/goldens/dt_dump_protected_golden.dts
@@ -105,8 +105,8 @@
interrupt-map = <0x800 0x00 0x00 0x01 0x01 0x00 0x00 0x00 0x04 0x04 0x1000 0x00 0x00 0x01 0x01 0x00 0x00 0x00 0x05 0x04 0x1800 0x00 0x00 0x01 0x01 0x00 0x00 0x00 0x06 0x04 0x2000 0x00 0x00 0x01 0x01 0x00 0x00 0x00 0x07 0x04 0x2800 0x00 0x00 0x01 0x01 0x00 0x00 0x00 0x08 0x04 0x3000 0x00 0x00 0x01 0x01 0x00 0x00 0x00 0x09 0x04 0x3800 0x00 0x00 0x01 0x01 0x00 0x00 0x00 0x0a 0x04 0x4000 0x00 0x00 0x01 0x01 0x00 0x00 0x00 0x0b 0x04>;
interrupt-map-mask = <0xf800 0x00 0x00 0x07 0xf800 0x00 0x00 0x07 0xf800 0x00 0x00 0x07 0xf800 0x00 0x00 0x07 0xf800 0x00 0x00 0x07 0xf800 0x00 0x00 0x07 0xf800 0x00 0x00 0x07 0xf800 0x00 0x00 0x07>;
memory-region = <0x02>;
- ranges = <0x3000000 0x00 0x2000000 0x00 0x2000000 0x00 0x2000000 0x43000000 0x00 0x91600000 0x00 0x91600000 0xff 0x6ea00000>;
- reg = <0x00 0x10000 0x00 0x1000000>;
+ ranges = <0x3000000 0x00 0x70000000 0x00 0x70000000 0x00 0x2000000 0x43000000 0x00 0x91600000 0x00 0x91600000 0xff 0x6ea00000>;
+ reg = <0x00 0x72000000 0x00 0x1000000>;
};
pclk@3M {