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

Support for SM on-chip memory on HiFive Unmatched (SiFive FU740) platform? #468

Open
AlfiRam opened this issue Sep 9, 2024 · 0 comments

Comments

@AlfiRam
Copy link

AlfiRam commented Sep 9, 2024

Description:
I am working on enabling the Eyrie runtime's paging plugin by using the SM on-chip memory (scratchpad). In the Keystone paper, this was achieved using the SiFive FU540 SoC (HiFive Unleashed board), where the EPM is relocated to scratchpad memory. This functionality is found in sm/src/platform/sifive/fu540/fu540_internal.c:

unsigned long platform_create_enclave(struct enclave* enclave){
  enclave->ped.use_scratch = 0;
  if(enclave->ped.use_scratch){
    if(scratch_init() != SBI_ERR_SM_ENCLAVE_SUCCESS){
      return SBI_ERR_SM_ENCLAVE_UNKNOWN_ERROR;
    }
    /* Swap regions */
    int old_epm_idx = get_enclave_region_index(enclave->eid, REGION_EPM);
    int new_idx = get_enclave_region_index(enclave->eid, REGION_INVALID);
    if(old_epm_idx < 0 || new_idx < 0){
      return SBI_ERR_SM_ENCLAVE_NO_FREE_RESOURCE;
    }
    enclave->regions[new_idx].pmp_rid = scratch_rid;
    enclave->regions[new_idx].type = REGION_EPM;
    enclave->regions[old_epm_idx].type = REGION_OTHER;

However, the current Keystone Makefile lists the supported platforms as:

# options: generic, cva6, hifive_unmatched, mpfs
export KEYSTONE_PLATFORM ?= generic

While the hifive_unmatched (SiFive FU740 SoC) is supported, the hifive unleashed (FU540 SoC) from the paper is not. I can see the FU740 is referenced in sm/plat/hifive/unmatched/unmatched.c:

#include "fu740.c"
#include "sm.h"

static int unmatched_final_init(bool cold_boot, const struct fdt_match *match) {
  sm_init(cold_boot);
  return sifive_fu740_final_init(cold_boot, match);
}

Question:
Does the FU740 (HiFive Unmatched) feature the same on-chip scratchpad memory as the FU540 (HiFive Unleashed)? I.e. can the scratchpad memory plugin be used on the HiFive Unmatched fu740 platform in the same way as the HiFive Unleashed fu540?

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

No branches or pull requests

1 participant