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

Starfive VisionFive 2 Board Support #467

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

its-valentinvp
Copy link

This PR adds Starfive VisionFive 2 Board support to Keystone and addresses #339.
During our case study on secure peripheral access from keystone enclaves, we (@f1bu and I) also added VF2 board support to Keystone to allow for testing some prototypes on real hardware. We now want to contribute our changes to Keystone. We oriented on this previous PR (#386) and tried to be consistent with our changes (same directory structures and similar names, etc.) for easier reviews.

It's important to note that as secure boot is not implemented yet, this board support should only be used for testing and not for production.

We tested the PR on two different VF2 boards and were able to run all examples successfully. One exception is the tests.ke example which constantly displays a "[runtime] non-handable interrupt ..." message after some of the tests pass. It is triggered for test-fib-bench on the rdcycle operation. This is because we use Linux 6.7, and since Linux 6.6, the rdcycle operation is a privileged instruction (see [1]), which means it is no longer available for userland. One fix for this is to replace rdcycle with rdtime. After that change, the tests.ke example runs successfully (this change is not included in this PR but this problem should be addressed in the future).

To build the SD image, simply run the following script:

#!/bin/sh
export KEYSTONE_PLATFORM=starfive/visionfive2
export KEYSTONE_BITS=64
export BUILDROOT_CONFIGFILE=riscv64_starfive_visionfive2_defconfig
export BUILDROOT_TARGET=all
make -j$(nproc)

The sd image is located in build-starfive/visionfive264/buildroot.build/images/sdcard.img. To flash the image to a sd card you can use make flash (see mkutils/plat/starfive/visionfive2/run.mk).

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=cc4c07c89aada16229084eeb93895c95b7eabaa3

@of-night
Copy link

This PR adds Starfive VisionFive 2 Board support to Keystone and addresses #339. During our case study on secure peripheral access from keystone enclaves, we (@f1bu and I) also added VF2 board support to Keystone to allow for testing some prototypes on real hardware. We now want to contribute our changes to Keystone. We oriented on this previous PR (#386) and tried to be consistent with our changes (same directory structures and similar names, etc.) for easier reviews.

It's important to note that as secure boot is not implemented yet, this board support should only be used for testing and not for production.

We tested the PR on two different VF2 boards and were able to run all examples successfully. One exception is the tests.ke example which constantly displays a "[runtime] non-handable interrupt ..." message after some of the tests pass. It is triggered for test-fib-bench on the rdcycle operation. This is because we use Linux 6.7, and since Linux 6.6, the rdcycle operation is a privileged instruction (see [1]), which means it is no longer available for userland. One fix for this is to replace rdcycle with rdtime. After that change, the tests.ke example runs successfully (this change is not included in this PR but this problem should be addressed in the future).

To build the SD image, simply run the following script:

#!/bin/sh
export KEYSTONE_PLATFORM=starfive/visionfive2
export KEYSTONE_BITS=64
export BUILDROOT_CONFIGFILE=riscv64_starfive_visionfive2_defconfig
export BUILDROOT_TARGET=all
make -j$(nproc)

The sd image is located in build-starfive/visionfive264/buildroot.build/images/sdcard.img. To flash the image to a sd card you can use make flash (see mkutils/plat/starfive/visionfive2/run.mk).

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=cc4c07c89aada16229084eeb93895c95b7eabaa3

Hey, @its-valentinvp .
I followed the steps to build and flash the SD card, but after booting and logging in, I didn't find keystone-driver.ko or other test files, and there was nothing in the /home directory, the result is as follows. What can I do to solve this problem?

# pwd
/home
# ls
#

@its-valentinvp
Copy link
Author

Hey @of-night,
Can you execute modprobe keystone-driver? The enclave executables are located in /use/share/keystone/examples/.

@of-night
Copy link

Hey @of-night, Can you execute modprobe keystone-driver? The enclave executables are located in /use/share/keystone/examples/.

Thanks for your help @its-valentinvp , I found those files and ran hello.ke successfully.

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