Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update generic platform #345

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

philippgie
Copy link
Contributor

This PR updates the generic platform files to the latest version from OpenSBI. I have been able to test this successfully on the HiFive Unmatched board.

@red-robby
Copy link
Contributor

Thanks for the PR! Could you provide a more detailed explanation of the changes you made and how you tested these changes?

@philippgie
Copy link
Contributor Author

Hi @red-robby,

I basically copied the platform files from recent OpenSBI from opensbi/platform/generic and applied the necessary changes to build the sm.

diff plat/generic/ opensbi/platform/generic/ -r
diff -r plat/generic/objects.mk opensbi/platform/generic/objects.mk
12c12
< platform-cflags-y = -I../src
---
> platform-cflags-y =
21,55d20
< ifdef PLATFORM
<   platform-genflags-y += "-DTARGET_PLATFORM_HEADER=\"platform/$(PLATFORM)/platform.h\""
< else
< 	PLATFORM = "generic"
<   platform-genflags-y += "-DTARGET_PLATFORM_HEADER=\"platform/generic/platform.h\""
< endif
< 
< platform-objs-y += ../../src/attest.o
< platform-objs-y += ../../src/cpu.o
< platform-objs-y += ../../src/crypto.o
< platform-objs-y += ../../src/enclave.o
< platform-objs-y += ../../src/pmp.o
< platform-objs-y += ../../src/sm.o
< platform-objs-y += ../../src/sm-sbi.o
< platform-objs-y += ../../src/sm-sbi-opensbi.o
< platform-objs-y += ../../src/thread.o
< platform-objs-y += ../../src/mprv.o
< platform-objs-y += ../../src/sbi_trap_hack.o
< platform-objs-y += ../../src/trap.o
< platform-objs-y += ../../src/ipi.o
< 
< platform-objs-y += ../../src/sha3/sha3.o
< platform-objs-y += ../../src/ed25519/fe.o
< platform-objs-y += ../../src/ed25519/ge.o
< platform-objs-y += ../../src/ed25519/keypair.o
< platform-objs-y += ../../src/ed25519/sc.o
< platform-objs-y += ../../src/ed25519/sign.o
< 
< platform-objs-y += ../../src/hkdf_sha3_512/hkdf_sha3_512.o
< platform-objs-y += ../../src/hmac_sha3/hmac_sha3.o
< 
< platform-objs-y += ../../src/platform/$(PLATFORM)/platform.o
< 
< platform-objs-y += ../../src/plugins/plugins.o
< 
diff -r plat/generic/platform.c opensbi/platform/generic/platform.c
28d27
< #include "sm.h"
166,167d164
< 
< 	sm_init(cold_boot);
Only in plat/generic/: platform_override_modules.c

A short description regarding the testing the changes, I utilized the freedom-u-sdk to create an image for the Hifive Unmatched. I replaced the bootloader with u-boot, using the custom OpenSBI from the Keystone project.

I ran the following tests:

  • example and test applications from sdk/examples
  • iozone, rv8-bench and coremark benchmarks from keystone-bench
  • demo from keystone-demo

All scenarios succeeded, although, I encountered anticipated attestation failures due to the absence of the necessary modifications in the bootloader.

philippgie and others added 2 commits August 30, 2023 14:01
…e#344)

OpenSBI removed `TRUE/FALSE` macros with
riscv-software-src/opensbi@440fa81.
This simplifies experimentation with the latest OpenSBI versions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants