Make size of hypervisor heap a build parameter.
Bug: 117270899
Change-Id: Ie9fd8db6a795f65637035773cfb43cbf1b89b6ec
diff --git a/build/BUILD.gn b/build/BUILD.gn
index 1c753ff..822720d 100644
--- a/build/BUILD.gn
+++ b/build/BUILD.gn
@@ -40,6 +40,7 @@
]
defines = [
+ "HEAP_PAGES=${plat_heap_pages}",
"MAX_CPUS=${plat_max_cpus}",
"MAX_VMS=${plat_max_vms}",
]
diff --git a/build/toolchain/embedded.gni b/build/toolchain/embedded.gni
index 290f163..8971029 100644
--- a/build/toolchain/embedded.gni
+++ b/build/toolchain/embedded.gni
@@ -160,6 +160,8 @@
"\"tool_prefix\" must be defined for ${target_name}.")
assert(defined(invoker.origin_address),
"\"origin_address\" must be defined for ${target_name}.")
+ assert(defined(invoker.heap_pages),
+ "\"heap_pages\" must be defined for ${target_name}.")
assert(defined(invoker.max_cpus),
"\"max_cpus\" must be defined for ${target_name}.")
assert(defined(invoker.max_vms),
@@ -188,6 +190,7 @@
use_platform = true
plat_name = invoker.target_name
plat_arch = invoker.arch
+ plat_heap_pages = invoker.heap_pages
plat_max_cpus = invoker.max_cpus
plat_max_vms = invoker.max_vms
if (defined(invoker.toolchain_args)) {
@@ -205,6 +208,7 @@
use_platform = true
plat_name = invoker.target_name
plat_arch = invoker.arch
+ plat_heap_pages = invoker.heap_pages
plat_max_cpus = invoker.max_cpus
plat_max_vms = invoker.max_vms
if (defined(invoker.toolchain_args)) {
@@ -222,6 +226,8 @@
"\"origin_address\" must be defined for ${target_name}.")
assert(defined(invoker.use_pl011),
"\"use_pl011\" must be defined for ${target_name}.")
+ assert(defined(invoker.heap_pages),
+ "\"heap_pages\" must be defined for ${target_name}.")
assert(defined(invoker.max_cpus),
"\"max_cpus\" must be defined for ${target_name}.")
assert(defined(invoker.max_vms),
@@ -231,6 +237,7 @@
forward_variables_from(invoker,
[
"origin_address",
+ "heap_pages",
"max_cpus",
"max_vms",
])
diff --git a/build/toolchain/host.gni b/build/toolchain/host.gni
index 11bf388..ff6a2d4 100644
--- a/build/toolchain/host.gni
+++ b/build/toolchain/host.gni
@@ -126,6 +126,8 @@
assert(defined(invoker.use_platform),
"\"use_platform\" must be defined for ${target_name}.")
if (invoker.use_platform) {
+ assert(defined(invoker.heap_pages),
+ "\"heap_pages\" must be defined for ${target_name}.")
assert(defined(invoker.max_cpus),
"\"max_cpus\" must be defined for ${target_name}.")
assert(defined(invoker.max_vms),
@@ -148,6 +150,7 @@
# When building for the ${target_name}, use the fake architecture to make things
# testable.
plat_arch = "fake"
+ plat_heap_pages = invoker.heap_pages
plat_max_cpus = invoker.max_cpus
plat_max_vms = invoker.max_vms
}
@@ -170,6 +173,7 @@
# When building for the ${target_name}, use the fake architecture to make things
# testable.
plat_arch = "fake"
+ plat_heap_pages = invoker.heap_pages
plat_max_cpus = invoker.max_cpus
plat_max_vms = invoker.max_vms
}
diff --git a/build/toolchain/platform.gni b/build/toolchain/platform.gni
index 4bcfdc3..e2fa6a4 100644
--- a/build/toolchain/platform.gni
+++ b/build/toolchain/platform.gni
@@ -20,6 +20,9 @@
# The architecture of the platform.
plat_arch = ""
+ # The number of pages to allocate for the hypervisor heap.
+ plat_heap_pages = 0
+
# The maximum number of CPUs available on the platform.
plat_max_cpus = 0