Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
pbo-linaro committed Nov 27, 2024
1 parent 3f6ff53 commit 5d55b86
Showing 1 changed file with 16 additions and 21 deletions.
37 changes: 16 additions & 21 deletions tests/functional/test_aarch64_virt.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from qemu_test import BUILD_DIR
from qemu_test import QemuSystemTest, Asset
from qemu_test import exec_command, wait_for_console_pattern
from qemu_test import exec_command_and_wait_for_pattern
from qemu_test import get_qemu_img, run_cmd
from qemu_test.utils import archive_extract

Expand Down Expand Up @@ -134,9 +135,9 @@ def test_aarch64_virt_gicv2(self):
# https://linaro.atlassian.net/wiki/spaces/QEMU/pages/29051027459/
# https://github.com/pbo-linaro/qemu-rme-stack
ASSET_RME_STACK = Asset(
('https://fileserver.linaro.org/s/JX7oNgfDeGXSxcY/'
'download/rme-stack-op-tee-4.2.0.tar.gz'),
'1f240f55e8a7a66489c2b7db5d40391e5dcfdd54c82600bd0d4b2145b9a0fbfb')
('https://fileserver.linaro.org/s/7dsXdtbDfBZbCTC/'
'download/rme-stack-op-tee-4.2.0-cca-v3-qemu_v8.tar.gz'),
'0b49f2652a7201d100365b8ccc6c317f1f8f2f4de6feed084080f52fe1b5fadc')

# This tests the FEAT_RME cpu implementation, by booting a VM supporting it,
# and launching a nested VM using it.
Expand All @@ -148,14 +149,15 @@ def test_aarch64_virt_rme(self):
self.vm.set_console()
self.require_accelerator('tcg')

rme_stack = os.path.join(self.workdir, 'rme-stack')
rme_stack = os.path.join(self.workdir,
'rme-stack-op-tee-4.2.0-cca-v3-qemu_v8')
kernel = os.path.join(rme_stack, 'out', 'bin', 'Image')
bios = os.path.join(rme_stack, 'out', 'bin', 'flash.bin')
drive = os.path.join(rme_stack, 'out-br', 'images', 'rootfs.ext4')

self.vm.add_args('-accel', 'tcg')
self.vm.add_args('-cpu', 'max,x-rme=on')
self.vm.add_args('-m', '8G')
self.vm.add_args('-m', '2G')
self.vm.add_args('-M', 'virt,acpi=off,'
'virtualization=on,'
'secure=on,'
Expand All @@ -171,16 +173,9 @@ def test_aarch64_virt_rme(self):
self.vm.add_args('-append', 'root=/dev/vda')

self.vm.launch()
#######
# TODO: use self.exec_command_and_wait_for_pattern instead
# Wait for host VM boot to complete.
self.wait_for_console_pattern('Welcome to Buildroot')
time.sleep(0.1)
exec_command(self, 'root')
time.sleep(0.1)

######
# TODO: catch error when executing || &print error, catch with
# console_pattern
exec_command_and_wait_for_pattern(self, 'root', '#')

# We now boot the (nested) guest VM
exec_command(self,
Expand All @@ -193,17 +188,17 @@ def test_aarch64_virt_rme(self):
'-kernel /mnt/out/bin/Image '
'-initrd /mnt/out-br/images/rootfs.cpio '
'-serial stdio')
# Detect Realm activation during boot.
# Detect Realm activation during (nested) guest boot.
self.wait_for_console_pattern('SMC_RMI_REALM_ACTIVATE')
# Wait for (nested) guest boot to complete.
self.wait_for_console_pattern('Welcome to Buildroot')
exec_command_and_wait_for_pattern(self, 'root', '#')

# TODO:
# run cca-workload-attestation report
# SMC_RSI_ATTEST_TOKEN_CONTINUE
# "cca-realm-hash-algo-id": "sha-512"
# "cca-platform-hash-algo-id": "sha-256"
# "cca-realm-public-key-hash-algo-id": "sha-256"
# query (nested) guest cca report
exec_command(self, 'cca-workload-attestation report')
self.wait_for_console_pattern('"cca-platform-hash-algo-id": "sha-256"')
self.wait_for_console_pattern('"cca-realm-hash-algo-id": "sha-512"')
self.wait_for_console_pattern('"cca-realm-public-key-hash-algo-id": "sha-256"')

if __name__ == '__main__':
QemuSystemTest.main()

0 comments on commit 5d55b86

Please sign in to comment.