Skip to content

Commit

Permalink
Build Morello benchmark ABI kernels.
Browse files Browse the repository at this point in the history
This is inhibited by the no-build-alternate-abi-kernels.
  • Loading branch information
qwattash committed May 15, 2024
1 parent 6387274 commit 00dfcfb
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
25 changes: 22 additions & 3 deletions pycheribuild/projects/cross/cheribsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ class KernelABI(Enum):
NOCHERI = "no-cheri"
HYBRID = "hybrid"
PURECAP = "purecap"
PURECAP_BENCHMARK = "purecap-benchmark"


class ConfigPlatform(Enum):
Expand Down Expand Up @@ -165,6 +166,9 @@ def get_platform_name(self, platforms: "set[ConfigPlatform]") -> Optional[str]:
return self.platform_name_map[platform]
assert False, "Should not be reached..."

def get_available_kabis(self) -> "list[KernelABI]":
return [KernelABI.NOCHERI, KernelABI.HYBRID, KernelABI.PURECAP]

def get_flag_names(
self,
platforms: "set[ConfigPlatform]",
Expand Down Expand Up @@ -244,15 +248,15 @@ def get_flag_names(
def make_all(self) -> "list[CheriBSDConfig]":
configs = []
# Generate QEMU kernels
for kernel_abi in KernelABI:
for kernel_abi in self.get_available_kabis():
configs.append(self.make_config({ConfigPlatform.QEMU}, kernel_abi, default=True))
configs.append(self.make_config({ConfigPlatform.QEMU}, kernel_abi, benchmark=True, default=True))
configs.append(self.make_config({ConfigPlatform.QEMU}, kernel_abi, mfsroot=True, default=True))
configs.append(
self.make_config({ConfigPlatform.QEMU}, kernel_abi, mfsroot=True, benchmark=True, default=True)
)
# Generate FPGA kernels
for kernel_abi in KernelABI:
for kernel_abi in self.get_available_kabis():
configs.append(self.make_config({ConfigPlatform.GFE}, kernel_abi, mfsroot=True, default=True))
configs.append(
self.make_config({ConfigPlatform.GFE}, kernel_abi, mfsroot=True, benchmark=True, default=True)
Expand All @@ -264,7 +268,7 @@ def make_all(self) -> "list[CheriBSDConfig]":
configs.append(self.make_config({ConfigPlatform.QEMU}, KernelABI.HYBRID, fett=True, default=True))

# Caprevoke kernels
for kernel_abi in KernelABI:
for kernel_abi in self.get_available_kabis():
configs.append(self.make_config({ConfigPlatform.QEMU}, kernel_abi, nocaprevoke=True, default=True))
configs.append(
self.make_config({ConfigPlatform.QEMU}, kernel_abi, nocaprevoke=True, benchmark=True, default=True)
Expand Down Expand Up @@ -299,6 +303,12 @@ def get_kabi_name(self, kernel_abi) -> Optional[str]:
return "MORELLO"
elif kernel_abi == KernelABI.PURECAP:
return f"MORELLO{self.separator}PURECAP"
elif kernel_abi == KernelABI.PURECAP_BENCHMARK:
return f"MORELLO{self.separator}PURECAP{self.separator}BENCHMARK"

def get_available_kabis(self) -> "list[KernelABI]":
abis = super().get_available_kabis()
return [*abis, KernelABI.PURECAP_BENCHMARK]

def make_all(self) -> "list[CheriBSDConfig]":
configs = []
Expand Down Expand Up @@ -1946,6 +1956,15 @@ def _get_kernel_abis_to_build(self) -> "list[KernelABI]":
if self.crosscompile_target in self.purecap_kernel_targets and self.build_alternate_abi_kernels:
other_abi = KernelABI.PURECAP if default_kernel_abi != KernelABI.PURECAP else KernelABI.HYBRID
kernel_abis.append(other_abi)
if (
self.crosscompile_target.is_aarch64(include_purecap=True)
and self.crosscompile_target in self.purecap_kernel_targets
and self.build_alternate_abi_kernels
and default_kernel_abi != KernelABI.PURECAP_BENCHMARK
):
# Enable benchmark ABI kernels
kernel_abis.append(KernelABI.PURECAP_BENCHMARK)

return kernel_abis

def _get_all_kernel_configs(self) -> "list[CheriBSDConfig]":
Expand Down
1 change: 1 addition & 0 deletions tests/test_argument_parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -916,6 +916,7 @@ def test_disk_image_path(target, expected_name):
[
"GENERIC-MORELLO",
"GENERIC-MORELLO-PURECAP",
"GENERIC-MORELLO-PURECAP-BENCHMARK"
],
),
pytest.param(
Expand Down

0 comments on commit 00dfcfb

Please sign in to comment.