mirror of
https://git.yoctoproject.org/meta-arm
synced 2026-07-18 04:27:08 +00:00
Compare commits
5 Commits
3.2.4
...
TC0-2020.10.29
| Author | SHA1 | Date | |
|---|---|---|---|
| 56514201ad | |||
| 86f9419b9d | |||
| da57312334 | |||
| 70a9c4991e | |||
| 29cee51f84 |
@@ -14,15 +14,26 @@ UBOOT_MACHINE ?= "total_compute_defconfig"
|
||||
# Trusted firmware A v2.3
|
||||
PREFERRED_PROVIDER_virtual/trusted-firmware-a ?= "trusted-firmware-a"
|
||||
PREFERRED_VERSION_trusted-firmware-a ?= "2.3%"
|
||||
PREFERRED_VERSION_linux-arm64-ack ?= "5.4"
|
||||
|
||||
EXTRA_IMAGEDEPENDS += "virtual/trusted-firmware-a"
|
||||
|
||||
PREFERRED_PROVIDER_virtual/kernel ?= "linux-arm64-ack"
|
||||
PREFERRED_VERSION_linux-arm64-ack ?= "5.4"
|
||||
|
||||
# Cannot use the default zImage on arm64
|
||||
KERNEL_IMAGETYPE = "Image"
|
||||
KERNEL_BOOTCMD = "booti"
|
||||
IMAGE_FSTYPES += "cpio.gz.u-boot"
|
||||
KERNEL_IMAGETYPES += " fitImage "
|
||||
KERNEL_CLASSES = " kernel-fitimage "
|
||||
|
||||
IMAGE_FSTYPES += "cpio.gz"
|
||||
INITRAMFS_IMAGE = "core-image-minimal"
|
||||
|
||||
UBOOT_RD_LOADADDRESS = "0x88000000"
|
||||
UBOOT_RD_ENTRYPOINT = "0x88000000"
|
||||
UBOOT_LOADADDRESS = "0x80080000"
|
||||
UBOOT_ENTRYPOINT = "0x80080000"
|
||||
UBOOT_SIGN_ENABLE = "1"
|
||||
UBOOT_MKIMAGE_DTCOPTS = "-I dts -O dtb"
|
||||
UBOOT_SIGN_KEYNAME = "dev_key"
|
||||
UBOOT_SIGN_KEYDIR = "${DEPLOY_DIR_IMAGE}/keys"
|
||||
FIT_GENERATE_KEYS = "1"
|
||||
|
||||
SERIAL_CONSOLES = "115200;ttyAMA0"
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# Copyright (c) 2020 Arm Limited
|
||||
#
|
||||
|
||||
SUMARY = "Total Compute Images"
|
||||
DESCRIPTION = "Build all the images required for Total Compute platform"
|
||||
LICENSE = "Apache-2.0"
|
||||
|
||||
# The last image to be built is trusted-firmware-a
|
||||
DEPENDS += " trusted-firmware-a"
|
||||
+539
@@ -0,0 +1,539 @@
|
||||
From f409ffb29aa2fd9d531b5cf079e16dbe97f9054f Mon Sep 17 00:00:00 2001
|
||||
From: J-Alves <joao.alves@arm.com>
|
||||
Date: Thu, 22 Oct 2020 12:29:21 +0100
|
||||
Subject: [PATCH] FF-A: Booting SPs according to 'boot-order'
|
||||
|
||||
Secure Hafnium boots partitions according to boot-order in the manifest.
|
||||
In this patch:
|
||||
- Added manifest parsing of "boot-order", and populated VM structure
|
||||
with it;
|
||||
- Added the field "next_boot" to the VM structure, in order to create a
|
||||
boot list that is sorted by the "boot-order";
|
||||
- If VMs have been configured with "boot-order" field at the partition's
|
||||
manifest, a boot list will be created with the VM structure;
|
||||
- The root of the list points to the highest priority VM;
|
||||
- Booting consists on traversing the list upon use of MSG_WAIT
|
||||
interface from the highest priority VMs;
|
||||
- After traversing the whole boot list, returns execution to SPMD;
|
||||
- If no partition has been configured with "boot-order" field, only the
|
||||
primary VM will boot;
|
||||
- "Manifest_Test.cc" updated to include "boot-order" field in
|
||||
tests to the partition manifest;
|
||||
- "vm_test.cc" updated to include unit test for the main logic of this
|
||||
patch.
|
||||
|
||||
Change-Id: I43adf90447eed3bc24c8eb2ccb8eb979b471f3c3
|
||||
Signed-off-by: J-Alves <Joao.Alves@arm.com>
|
||||
---
|
||||
inc/hf/api.h | 1 +
|
||||
inc/hf/manifest.h | 2 +
|
||||
inc/hf/vm.h | 10 ++++
|
||||
src/api.c | 17 ++++++
|
||||
src/arch/aarch64/hypervisor/cpu.c | 5 ++
|
||||
src/arch/aarch64/hypervisor/handler.c | 48 ++++++++++++++++-
|
||||
src/load.c | 12 +++++
|
||||
src/main.c | 19 ++++++-
|
||||
src/manifest.c | 19 +++++++
|
||||
src/manifest_test.cc | 11 ++++
|
||||
src/vm.c | 39 ++++++++++++++
|
||||
src/vm_test.cc | 75 ++++++++++++++++++++++++++-
|
||||
12 files changed, 255 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/inc/hf/api.h b/inc/hf/api.h
|
||||
index a28c1d0..907d60b 100644
|
||||
--- a/inc/hf/api.h
|
||||
+++ b/inc/hf/api.h
|
||||
@@ -37,6 +37,7 @@ struct ffa_value api_ffa_msg_send(ffa_vm_id_t sender_vm_id,
|
||||
ffa_vm_id_t receiver_vm_id, uint32_t size,
|
||||
uint32_t attributes, struct vcpu *current,
|
||||
struct vcpu **next);
|
||||
+struct ffa_value api_ffa_msg_wait(struct vcpu *current, struct vcpu **next);
|
||||
struct ffa_value api_ffa_msg_recv(bool block, struct vcpu *current,
|
||||
struct vcpu **next);
|
||||
struct ffa_value api_ffa_rx_release(struct vcpu *current, struct vcpu **next);
|
||||
diff --git a/inc/hf/manifest.h b/inc/hf/manifest.h
|
||||
index 3e9eaf4..17b2ac9 100644
|
||||
--- a/inc/hf/manifest.h
|
||||
+++ b/inc/hf/manifest.h
|
||||
@@ -29,6 +29,8 @@
|
||||
/** Mask for getting read/write/execute permission */
|
||||
#define MM_PERM_MASK 0x7
|
||||
|
||||
+#define DEFAULT_BOOT_ORDER 0xFF
|
||||
+
|
||||
enum run_time_el {
|
||||
EL1 = 0,
|
||||
S_EL0,
|
||||
diff --git a/inc/hf/vm.h b/inc/hf/vm.h
|
||||
index 01aaaca..0e4d23f 100644
|
||||
--- a/inc/hf/vm.h
|
||||
+++ b/inc/hf/vm.h
|
||||
@@ -120,6 +120,13 @@ struct vm {
|
||||
|
||||
atomic_bool aborting;
|
||||
|
||||
+ /**
|
||||
+ * Booting parameters.
|
||||
+ */
|
||||
+ bool initialized;
|
||||
+ uint16_t boot_order;
|
||||
+ struct vm *next_boot;
|
||||
+
|
||||
/** Arch-specific VM information. */
|
||||
struct arch_vm arch;
|
||||
};
|
||||
@@ -159,3 +166,6 @@ void vm_identity_commit(struct vm_locked vm_locked, paddr_t begin, paddr_t end,
|
||||
bool vm_unmap(struct vm_locked vm_locked, paddr_t begin, paddr_t end,
|
||||
struct mpool *ppool);
|
||||
bool vm_unmap_hypervisor(struct vm_locked vm_locked, struct mpool *ppool);
|
||||
+
|
||||
+void vm_update_boot(struct vm *vm);
|
||||
+struct vm *vm_get_first_boot(void);
|
||||
diff --git a/src/api.c b/src/api.c
|
||||
index 1457d58..1da5df3 100644
|
||||
--- a/src/api.c
|
||||
+++ b/src/api.c
|
||||
@@ -1260,6 +1260,23 @@ out:
|
||||
return return_code;
|
||||
}
|
||||
|
||||
+struct ffa_value api_ffa_msg_wait(struct vcpu *current, struct vcpu **next)
|
||||
+{
|
||||
+ struct vm *current_vm = current->vm;
|
||||
+
|
||||
+ /* If this a SP */
|
||||
+ if (current_vm->id & HF_VM_ID_WORLD_MASK) {
|
||||
+ *next = api_switch_to_other_world(
|
||||
+ current, (struct ffa_value){.func = FFA_MSG_WAIT_32},
|
||||
+ VCPU_STATE_BLOCKED_MAILBOX);
|
||||
+
|
||||
+ return (struct ffa_value){.func = FFA_INTERRUPT_32};
|
||||
+ }
|
||||
+
|
||||
+ /* If NWd VM */
|
||||
+ return api_ffa_msg_recv(true, current, next);
|
||||
+}
|
||||
+
|
||||
/**
|
||||
* Retrieves the next VM whose mailbox became writable. For a VM to be notified
|
||||
* by this function, the caller must have called api_mailbox_send before with
|
||||
diff --git a/src/arch/aarch64/hypervisor/cpu.c b/src/arch/aarch64/hypervisor/cpu.c
|
||||
index 21bf6cf..0f6710e 100644
|
||||
--- a/src/arch/aarch64/hypervisor/cpu.c
|
||||
+++ b/src/arch/aarch64/hypervisor/cpu.c
|
||||
@@ -65,7 +65,12 @@ void arch_regs_reset(struct vcpu *vcpu)
|
||||
{
|
||||
ffa_vm_id_t vm_id = vcpu->vm->id;
|
||||
bool is_primary = vm_id == HF_PRIMARY_VM_ID;
|
||||
+#if SECURE_WORLD == 0
|
||||
cpu_id_t vcpu_id = is_primary ? vcpu->cpu->id : vcpu_index(vcpu);
|
||||
+#else
|
||||
+ cpu_id_t vcpu_id = vcpu_index(vcpu);
|
||||
+#endif
|
||||
+
|
||||
paddr_t table = vcpu->vm->ptable.root;
|
||||
struct arch_regs *r = &vcpu->regs;
|
||||
uintreg_t pc = r->pc;
|
||||
diff --git a/src/arch/aarch64/hypervisor/handler.c b/src/arch/aarch64/hypervisor/handler.c
|
||||
index 4d3a462..f63b3c0 100644
|
||||
--- a/src/arch/aarch64/hypervisor/handler.c
|
||||
+++ b/src/arch/aarch64/hypervisor/handler.c
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "hf/cpu.h"
|
||||
#include "hf/dlog.h"
|
||||
#include "hf/ffa.h"
|
||||
+#include "hf/ffa_internal.h"
|
||||
#include "hf/panic.h"
|
||||
#include "hf/vm.h"
|
||||
|
||||
@@ -259,6 +260,46 @@ static void set_virtual_interrupt_current(bool enable)
|
||||
write_msr(hcr_el2, hcr_el2);
|
||||
}
|
||||
|
||||
+#if SECURE_WORLD == 1
|
||||
+static bool sp_boot_next(struct vcpu *current, struct vcpu **next,
|
||||
+ struct ffa_value *ret)
|
||||
+{
|
||||
+ struct vm_locked current_vm_locked = vm_lock(current->vm);
|
||||
+ struct vm *vm_next;
|
||||
+
|
||||
+ /*
|
||||
+ * If VM hasn't been initialized, initialize it and traverse
|
||||
+ * booting list following "next_boot" field in the VM structure.
|
||||
+ * Once all the SPs have been booted (when "next_boot" is NULL),
|
||||
+ * return execution to the NWd.
|
||||
+ */
|
||||
+ if (current_vm_locked.vm->initialized == false) {
|
||||
+ current_vm_locked.vm->initialized = true;
|
||||
+ dlog_verbose("Initialized VM: %#x, boot_order: %u\n",
|
||||
+ current_vm_locked.vm->id,
|
||||
+ current_vm_locked.vm->boot_order);
|
||||
+
|
||||
+ if (current_vm_locked.vm->next_boot != NULL) {
|
||||
+ current->state = VCPU_STATE_BLOCKED_MAILBOX;
|
||||
+ vm_next = current_vm_locked.vm->next_boot;
|
||||
+ *next = vm_get_vcpu(vm_next, vcpu_index(current));
|
||||
+ arch_regs_reset(*next);
|
||||
+ (*next)->cpu = current->cpu;
|
||||
+ (*next)->state = VCPU_STATE_RUNNING;
|
||||
+
|
||||
+ *ret = (struct ffa_value){.func = FFA_INTERRUPT_32};
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ dlog_verbose("Finished initializing all VMs.\n");
|
||||
+ }
|
||||
+
|
||||
+ vm_unlock(¤t_vm_locked);
|
||||
+
|
||||
+ return false;
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
/**
|
||||
* Checks whether to block an SMC being forwarded from a VM.
|
||||
*/
|
||||
@@ -371,7 +412,12 @@ static bool ffa_handler(struct ffa_value *args, struct vcpu *current,
|
||||
ffa_msg_send_attributes(*args), current, next);
|
||||
return true;
|
||||
case FFA_MSG_WAIT_32:
|
||||
- *args = api_ffa_msg_recv(true, current, next);
|
||||
+#if SECURE_WORLD == 1
|
||||
+ if (sp_boot_next(current, next, args)) {
|
||||
+ return true;
|
||||
+ }
|
||||
+#endif
|
||||
+ *args = api_ffa_msg_wait(current, next);
|
||||
return true;
|
||||
case FFA_MSG_POLL_32:
|
||||
*args = api_ffa_msg_recv(false, current, next);
|
||||
diff --git a/src/load.c b/src/load.c
|
||||
index f820204..ed57a70 100644
|
||||
--- a/src/load.c
|
||||
+++ b/src/load.c
|
||||
@@ -148,7 +148,19 @@ static bool load_common(struct mm_stage1_locked stage1_locked,
|
||||
return false;
|
||||
}
|
||||
}
|
||||
+
|
||||
+ /*
|
||||
+ * If DEFAULT_BOOT_ORDER is set, it means
|
||||
+ * boot-order hasn't been set.
|
||||
+ */
|
||||
+ if (manifest_vm->sp.boot_order != DEFAULT_BOOT_ORDER) {
|
||||
+ vm_locked.vm->boot_order = manifest_vm->sp.boot_order;
|
||||
+
|
||||
+ /* Updating Boot list according to boot_order */
|
||||
+ vm_update_boot(vm_locked.vm);
|
||||
+ }
|
||||
}
|
||||
+
|
||||
/* Initialize architecture-specific features. */
|
||||
arch_vm_features_set(vm_locked.vm);
|
||||
|
||||
diff --git a/src/main.c b/src/main.c
|
||||
index 8a495db..c5604b4 100644
|
||||
--- a/src/main.c
|
||||
+++ b/src/main.c
|
||||
@@ -16,13 +16,30 @@
|
||||
struct vcpu *cpu_main(struct cpu *c)
|
||||
{
|
||||
struct vcpu *vcpu;
|
||||
+#if SECURE_WORLD == 1
|
||||
+ struct vm *first_boot = vm_get_first_boot();
|
||||
|
||||
+ /*
|
||||
+ * If `vm_get_first_boot` returns a valid VM, the first partition to
|
||||
+ * execute is in accordance to the boot-order field of the partition's
|
||||
+ * manifest.
|
||||
+ * Else, no partition has been configured with the "boot-order" field
|
||||
+ * in its manifest, and primary VM should be booted.
|
||||
+ */
|
||||
+ if (!first_boot) {
|
||||
+ first_boot = vm_find(HF_PRIMARY_VM_ID);
|
||||
+ }
|
||||
+
|
||||
+ vcpu = vm_get_vcpu(first_boot, cpu_index(c));
|
||||
+#else
|
||||
vcpu = vm_get_vcpu(vm_find(HF_PRIMARY_VM_ID), cpu_index(c));
|
||||
+#endif
|
||||
+
|
||||
vcpu->cpu = c;
|
||||
|
||||
arch_cpu_init();
|
||||
|
||||
- /* Reset the registers to give a clean start for the primary's vCPU. */
|
||||
+ /* Reset the registers to give a clean start for vCPU. */
|
||||
arch_regs_reset(vcpu);
|
||||
|
||||
return vcpu;
|
||||
diff --git a/src/manifest.c b/src/manifest.c
|
||||
index 60b0fa3..ab61b12 100644
|
||||
--- a/src/manifest.c
|
||||
+++ b/src/manifest.c
|
||||
@@ -195,6 +195,21 @@ static enum manifest_return_code read_uint16(const struct fdt_node *node,
|
||||
return MANIFEST_SUCCESS;
|
||||
}
|
||||
|
||||
+static enum manifest_return_code read_optional_uint16(
|
||||
+ const struct fdt_node *node, const char *property,
|
||||
+ uint16_t default_value, uint16_t *out)
|
||||
+{
|
||||
+ enum manifest_return_code ret;
|
||||
+
|
||||
+ ret = read_uint16(node, property, out);
|
||||
+ if (ret == MANIFEST_ERROR_PROPERTY_NOT_FOUND) {
|
||||
+ *out = default_value;
|
||||
+ return MANIFEST_SUCCESS;
|
||||
+ }
|
||||
+
|
||||
+ return MANIFEST_SUCCESS;
|
||||
+}
|
||||
+
|
||||
static enum manifest_return_code read_uint8(const struct fdt_node *node,
|
||||
const char *property, uint8_t *out)
|
||||
{
|
||||
@@ -530,6 +545,10 @@ static enum manifest_return_code parse_ffa_manifest(struct fdt *fdt,
|
||||
TRY(read_uint64(&root, "entrypoint-offset", &vm->sp.ep_offset));
|
||||
dlog_verbose(" SP entry point offset %#x\n", vm->sp.ep_offset);
|
||||
|
||||
+ TRY(read_optional_uint16(&root, "boot-order", DEFAULT_BOOT_ORDER,
|
||||
+ &vm->sp.boot_order));
|
||||
+ dlog_verbose(" SP boot order %#u\n", vm->sp.boot_order);
|
||||
+
|
||||
TRY(read_uint8(&root, "xlat-granule", (uint8_t *)&vm->sp.xlat_granule));
|
||||
dlog_verbose(" SP translation granule %d\n", vm->sp.xlat_granule);
|
||||
|
||||
diff --git a/src/manifest_test.cc b/src/manifest_test.cc
|
||||
index 98caf85..890ab26 100644
|
||||
--- a/src/manifest_test.cc
|
||||
+++ b/src/manifest_test.cc
|
||||
@@ -235,6 +235,7 @@ class ManifestDtBuilder
|
||||
Property("load-address", "<0x7000000>");
|
||||
Property("entrypoint-offset", "<0x00001000>");
|
||||
Property("xlat-granule", "<0>");
|
||||
+ Property("boot-order", "<0>");
|
||||
Property("messaging-method", "<1>");
|
||||
return *this;
|
||||
}
|
||||
@@ -730,6 +731,10 @@ TEST(manifest, ffa_missing_property)
|
||||
|
||||
TEST(manifest, ffa_validate_sanity_check)
|
||||
{
|
||||
+ /*
|
||||
+ * TODO: write test excluding all optional fields of the manifest, in
|
||||
+ * accordance with specification.
|
||||
+ */
|
||||
struct manifest m;
|
||||
|
||||
/* Incompatible version */
|
||||
@@ -744,6 +749,7 @@ TEST(manifest, ffa_validate_sanity_check)
|
||||
.Property("load-address", "<0x7000000>")
|
||||
.Property("entrypoint-offset", "<0x00001000>")
|
||||
.Property("xlat-granule", "<0>")
|
||||
+ .Property("boot-order", "<0>")
|
||||
.Property("messaging-method", "<1>")
|
||||
.Build();
|
||||
/* clang-format on */
|
||||
@@ -762,6 +768,7 @@ TEST(manifest, ffa_validate_sanity_check)
|
||||
.Property("load-address", "<0x7000000>")
|
||||
.Property("entrypoint-offset", "<0x00001000>")
|
||||
.Property("xlat-granule", "<3>")
|
||||
+ .Property("boot-order", "<0>")
|
||||
.Property("messaging-method", "<1>")
|
||||
.Build();
|
||||
/* clang-format on */
|
||||
@@ -780,6 +787,7 @@ TEST(manifest, ffa_validate_sanity_check)
|
||||
.Property("load-address", "<0x7000000>")
|
||||
.Property("entrypoint-offset", "<0x00001000>")
|
||||
.Property("xlat-granule", "<0>")
|
||||
+ .Property("boot-order", "<0>")
|
||||
.Property("messaging-method", "<1>")
|
||||
.Build();
|
||||
/* clang-format on */
|
||||
@@ -798,6 +806,7 @@ TEST(manifest, ffa_validate_sanity_check)
|
||||
.Property("load-address", "<0x7000000>")
|
||||
.Property("entrypoint-offset", "<0x00001000>")
|
||||
.Property("xlat-granule", "<0>")
|
||||
+ .Property("boot-order", "<0>")
|
||||
.Property("messaging-method", "<1>")
|
||||
.Build();
|
||||
/* clang-format on */
|
||||
@@ -816,6 +825,7 @@ TEST(manifest, ffa_validate_sanity_check)
|
||||
.Property("load-address", "<0x7000000>")
|
||||
.Property("entrypoint-offset", "<0x00001000>")
|
||||
.Property("xlat-granule", "<0>")
|
||||
+ .Property("boot-order", "<0>")
|
||||
.Property("messaging-method", "<3>")
|
||||
.Build();
|
||||
/* clang-format on */
|
||||
@@ -1054,6 +1064,7 @@ TEST(manifest, ffa_valid)
|
||||
ASSERT_EQ(m.vm[0].sp.load_addr, 0x7000000);
|
||||
ASSERT_EQ(m.vm[0].sp.ep_offset, 0x00001000);
|
||||
ASSERT_EQ(m.vm[0].sp.xlat_granule, PAGE_4KB);
|
||||
+ ASSERT_EQ(m.vm[0].sp.boot_order, 0);
|
||||
ASSERT_EQ(m.vm[0].sp.messaging_method, INDIRECT_MESSAGING);
|
||||
ASSERT_EQ(m.vm[0].sp.mem_regions[0].base_address, 0x7100000);
|
||||
ASSERT_EQ(m.vm[0].sp.mem_regions[0].page_count, 4);
|
||||
diff --git a/src/vm.c b/src/vm.c
|
||||
index fbbdc9f..96e1212 100644
|
||||
--- a/src/vm.c
|
||||
+++ b/src/vm.c
|
||||
@@ -21,6 +21,7 @@
|
||||
static struct vm vms[MAX_VMS];
|
||||
static struct vm other_world;
|
||||
static ffa_vm_count_t vm_count;
|
||||
+static struct vm *first_boot_vm;
|
||||
|
||||
struct vm *vm_init(ffa_vm_id_t id, ffa_vcpu_count_t vcpu_count,
|
||||
struct mpool *ppool)
|
||||
@@ -292,3 +293,41 @@ bool vm_unmap_hypervisor(struct vm_locked vm_locked, struct mpool *ppool)
|
||||
vm_unmap(vm_locked, layout_data_begin(), layout_data_end(),
|
||||
ppool);
|
||||
}
|
||||
+
|
||||
+/**
|
||||
+ * Gets the first partition to boot, according to Boot Protocol from FFA spec.
|
||||
+ */
|
||||
+struct vm *vm_get_first_boot(void)
|
||||
+{
|
||||
+ return first_boot_vm;
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
+ * Insert in boot list, sorted by `boot_order` parameter in the vm structure
|
||||
+ * and rooted in `first_boot_vm`.
|
||||
+ */
|
||||
+void vm_update_boot(struct vm *vm)
|
||||
+{
|
||||
+ struct vm *current = NULL;
|
||||
+ struct vm *previous = NULL;
|
||||
+
|
||||
+ if (first_boot_vm == NULL) {
|
||||
+ first_boot_vm = vm;
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ current = first_boot_vm;
|
||||
+
|
||||
+ while (current != NULL && current->boot_order >= vm->boot_order) {
|
||||
+ previous = current;
|
||||
+ current = current->next_boot;
|
||||
+ }
|
||||
+
|
||||
+ if (previous != NULL) {
|
||||
+ previous->next_boot = vm;
|
||||
+ } else {
|
||||
+ first_boot_vm = vm;
|
||||
+ }
|
||||
+
|
||||
+ vm->next_boot = current;
|
||||
+}
|
||||
diff --git a/src/vm_test.cc b/src/vm_test.cc
|
||||
index 6fb2bce..4a0c119 100644
|
||||
--- a/src/vm_test.cc
|
||||
+++ b/src/vm_test.cc
|
||||
@@ -13,6 +13,7 @@ extern "C" {
|
||||
#include "hf/vm.h"
|
||||
}
|
||||
|
||||
+#include <list>
|
||||
#include <memory>
|
||||
#include <span>
|
||||
#include <vector>
|
||||
@@ -29,7 +30,7 @@ using ::testing::SizeIs;
|
||||
|
||||
using struct_vm = struct vm;
|
||||
|
||||
-constexpr size_t TEST_HEAP_SIZE = PAGE_SIZE * 16;
|
||||
+constexpr size_t TEST_HEAP_SIZE = PAGE_SIZE * 32;
|
||||
const int TOP_LEVEL = arch_mm_stage2_max_level();
|
||||
|
||||
class vm : public ::testing::Test
|
||||
@@ -49,6 +50,12 @@ class vm : public ::testing::Test
|
||||
|
||||
protected:
|
||||
struct mpool ppool;
|
||||
+
|
||||
+ public:
|
||||
+ static bool BootOrderBiggerThan(struct_vm *vm1, struct_vm *vm2)
|
||||
+ {
|
||||
+ return vm1->boot_order > vm2->boot_order;
|
||||
+ }
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -70,4 +77,70 @@ TEST_F(vm, vm_unmap_hypervisor_not_mapped)
|
||||
vm_unlock(&vm_locked);
|
||||
}
|
||||
|
||||
+/**
|
||||
+ * Validate the "boot_list" is created properly, according to vm's "boot_order"
|
||||
+ * field.
|
||||
+ */
|
||||
+TEST_F(vm, vm_boot_order)
|
||||
+{
|
||||
+ struct_vm *vm_cur;
|
||||
+ std::list<struct_vm *> expected_final_order;
|
||||
+
|
||||
+ EXPECT_FALSE(vm_get_first_boot());
|
||||
+
|
||||
+ /*
|
||||
+ * Insertion when no call to "vm_update_boot" has been made yet.
|
||||
+ * The "boot_list" is expected to be empty.
|
||||
+ */
|
||||
+ EXPECT_TRUE(vm_init_next(1, &ppool, &vm_cur));
|
||||
+ vm_cur->boot_order = 1;
|
||||
+ vm_update_boot(vm_cur);
|
||||
+ expected_final_order.push_back(vm_cur);
|
||||
+
|
||||
+ EXPECT_EQ(vm_get_first_boot()->id, vm_cur->id);
|
||||
+
|
||||
+ /* Insertion at the head of the boot list */
|
||||
+ EXPECT_TRUE(vm_init_next(1, &ppool, &vm_cur));
|
||||
+ vm_cur->boot_order = 3;
|
||||
+ vm_update_boot(vm_cur);
|
||||
+ expected_final_order.push_back(vm_cur);
|
||||
+
|
||||
+ EXPECT_EQ(vm_get_first_boot()->id, vm_cur->id);
|
||||
+
|
||||
+ /* Insertion of two in the middle of the boot list */
|
||||
+ for (int i = 0; i < 2; i++) {
|
||||
+ EXPECT_TRUE(vm_init_next(1, &ppool, &vm_cur));
|
||||
+ vm_cur->boot_order = 2;
|
||||
+ vm_update_boot(vm_cur);
|
||||
+ expected_final_order.push_back(vm_cur);
|
||||
+ }
|
||||
+
|
||||
+ /*
|
||||
+ * Insertion in the end of the list.
|
||||
+ * This tests shares the data with "vm_unmap_hypervisor_not_mapped".
|
||||
+ * As such, a VM is expected to have been initialized before this
|
||||
+ * test, with ID 1 and boot_order 0.
|
||||
+ */
|
||||
+ vm_cur = vm_find(1);
|
||||
+ EXPECT_FALSE(vm_cur == NULL);
|
||||
+ vm_update_boot(vm_cur);
|
||||
+ expected_final_order.push_back(vm_cur);
|
||||
+
|
||||
+ /*
|
||||
+ * Number of VMs initialized should be the same as in the
|
||||
+ * "expected_final_order", before the final verification.
|
||||
+ */
|
||||
+ EXPECT_EQ(expected_final_order.size(), vm_get_count())
|
||||
+ << "Something went wrong with the test itself...\n";
|
||||
+
|
||||
+ /* Sort "expected_final_order" by "boot_order" field */
|
||||
+ expected_final_order.sort(vm::BootOrderBiggerThan);
|
||||
+
|
||||
+ std::list<struct_vm *>::iterator it;
|
||||
+ for (it = expected_final_order.begin(), vm_cur = vm_get_first_boot();
|
||||
+ it != expected_final_order.end() && vm_cur != NULL;
|
||||
+ it++, vm_cur = vm_cur->next_boot) {
|
||||
+ EXPECT_EQ((*it)->id, vm_cur->id);
|
||||
+ }
|
||||
+}
|
||||
} /* namespace */
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
# TF-A spm
|
||||
|
||||
SRCREV_FORMAT = "spm"
|
||||
|
||||
SRCREV_spm = "764fd2eb2ece8b5bddc802cc8369743a283cd7d7"
|
||||
|
||||
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
|
||||
SRC_URI_append_tc0 = " file://0001-FF-A-Booting-SPs-according-to-boot-order.patch"
|
||||
|
||||
LIC_FILES_CHKSUM = "file://LICENSE;md5=782b40c14bad5294672c500501edc103"
|
||||
|
||||
COMPATIBLE_MACHINE = "tc0"
|
||||
|
||||
SPM_PLATFORM = "secure_tc0_clang"
|
||||
SPM_INSTALL_TARGET = "hafnium.bin"
|
||||
@@ -0,0 +1,13 @@
|
||||
# tf-a-tests
|
||||
|
||||
SRCREV_FORMAT = "tfa-tests"
|
||||
|
||||
SRCREV_tfa-tests = "b3bcf77a65880049e40fa6f1b764a19dbd9faead"
|
||||
|
||||
LIC_FILES_CHKSUM = "file://docs/license.rst;md5=6175cc0aa2e63b6d21a32aa0ee7d1b4a"
|
||||
|
||||
COMPATIBLE_MACHINE = "tc0"
|
||||
TFA_TESTS_PLATFORM = "tc0"
|
||||
TFA_TESTS_BUILD_TARGET = "all"
|
||||
TFA_TESTS_INSTALL_TARGET = "tftf.bin cactus.bin sp_layout.json \
|
||||
cactus.dts cactus-secondary.dts cactus-tertiary.dts"
|
||||
@@ -1,9 +1,16 @@
|
||||
# TCO specific TFA configuration
|
||||
|
||||
# Intermediate SHA with 2.3 baseline version
|
||||
SRCREV_tfa = "16796a25fefc4ecf780211bf554d3b8dc5436fa4"
|
||||
SRCREV_tfa = "00ad74c7afe67b2ffaf08300710f18d3dafebb45"
|
||||
|
||||
DEPENDS += "scp-firmware"
|
||||
DEPENDS += "spm"
|
||||
|
||||
# Currenly only test partition images are available to be executed at S-EL1.
|
||||
SP_AT_SEL1 = "cactus"
|
||||
|
||||
# Enable test secure partitions if SP_AT_SEL1 is cactus
|
||||
DEPENDS += " tf-a-tests "
|
||||
|
||||
COMPATIBLE_MACHINE = "tc0"
|
||||
|
||||
@@ -12,8 +19,15 @@ TFA_BUILD_TARGET = "all fip"
|
||||
TFA_UBOOT = "1"
|
||||
TFA_INSTALL_TARGET = "bl1 fip"
|
||||
TFA_MBEDTLS = "1"
|
||||
TFA_DEBUG = "1"
|
||||
|
||||
EXTRA_OEMAKE += "SCP_BL2=${RECIPE_SYSROOT}/firmware/scp_ramfw.bin"
|
||||
EXTRA_OEMAKE += "TRUSTED_BOARD_BOOT=1 GENERATE_COT=1 ARM_ROTPK_LOCATION=devel_rsa \
|
||||
ROT_KEY=plat/arm/board/common/rotpk/arm_rotprivk_rsa.pem"
|
||||
|
||||
|
||||
do_compile[depends] += " spm:do_deploy "
|
||||
EXTRA_OEMAKE += " SPD=spmd CTX_INCLUDE_EL2_REGS=1 ARM_ARCH_MINOR=4 BL32=${DEPLOY_DIR_IMAGE}/hafnium.bin"
|
||||
|
||||
# Enable test secure partitions if SP_AT_SEL1 is cactus
|
||||
do_compile[depends] += " tf-a-tests:do_deploy "
|
||||
EXTRA_OEMAKE += " SP_LAYOUT_FILE=${DEPLOY_DIR_IMAGE}/sp_layout.json "
|
||||
|
||||
-307
@@ -1,307 +0,0 @@
|
||||
From 854c5d7b8a010d47da38735f15a31d0b7d10ae3c Mon Sep 17 00:00:00 2001
|
||||
From: Usama Arif <usama.arif@arm.com>
|
||||
Date: Fri, 3 Jul 2020 10:26:56 +0100
|
||||
Subject: [PATCH] Add support for Total Compute
|
||||
|
||||
This includes basic platform patch support and boots
|
||||
kernel and ramdisk that have been sideloaded in DRAM.
|
||||
|
||||
Change-Id: I2e35a1d983efd1d27572f671cad5a9fe4ad68ee6
|
||||
Signed-off-by: Usama Arif <usama.arif@arm.com>
|
||||
Upstream-Status: Pending
|
||||
---
|
||||
arch/arm/Kconfig | 9 +++
|
||||
board/armltd/totalcompute/Kconfig | 12 ++++
|
||||
board/armltd/totalcompute/MAINTAINERS | 6 ++
|
||||
board/armltd/totalcompute/Makefile | 6 ++
|
||||
board/armltd/totalcompute/totalcompute.c | 74 +++++++++++++++++++++++
|
||||
configs/total_compute_defconfig | 39 ++++++++++++
|
||||
include/configs/total_compute.h | 77 ++++++++++++++++++++++++
|
||||
7 files changed, 223 insertions(+)
|
||||
create mode 100644 board/armltd/totalcompute/Kconfig
|
||||
create mode 100644 board/armltd/totalcompute/MAINTAINERS
|
||||
create mode 100644 board/armltd/totalcompute/Makefile
|
||||
create mode 100644 board/armltd/totalcompute/totalcompute.c
|
||||
create mode 100644 configs/total_compute_defconfig
|
||||
create mode 100644 include/configs/total_compute.h
|
||||
|
||||
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
|
||||
index 36c9c2fecd0..b423b7655b6 100644
|
||||
--- a/arch/arm/Kconfig
|
||||
+++ b/arch/arm/Kconfig
|
||||
@@ -635,6 +635,14 @@ config TARGET_VEXPRESS_CA15_TC2
|
||||
select CPU_V7_HAS_VIRT
|
||||
select PL011_SERIAL
|
||||
|
||||
+config TARGET_TOTAL_COMPUTE
|
||||
+ bool "Support Total Compute Platform"
|
||||
+ select ARM64
|
||||
+ select PL01X_SERIAL
|
||||
+ select DM
|
||||
+ select DM_SERIAL
|
||||
+ select DM_ETH
|
||||
+
|
||||
config ARCH_BCMSTB
|
||||
bool "Broadcom BCM7XXX family"
|
||||
select CPU_V7A
|
||||
@@ -1774,6 +1782,7 @@ source "arch/arm/cpu/armv8/Kconfig"
|
||||
|
||||
source "arch/arm/mach-imx/Kconfig"
|
||||
|
||||
+source "board/armltd/totalcompute/Kconfig"
|
||||
source "board/bosch/shc/Kconfig"
|
||||
source "board/bosch/guardian/Kconfig"
|
||||
source "board/CarMediaLab/flea3/Kconfig"
|
||||
diff --git a/board/armltd/totalcompute/Kconfig b/board/armltd/totalcompute/Kconfig
|
||||
new file mode 100644
|
||||
index 00000000000..8bd8c30a6b5
|
||||
--- /dev/null
|
||||
+++ b/board/armltd/totalcompute/Kconfig
|
||||
@@ -0,0 +1,12 @@
|
||||
+if TARGET_TOTAL_COMPUTE
|
||||
+
|
||||
+config SYS_BOARD
|
||||
+ default "totalcompute"
|
||||
+
|
||||
+config SYS_VENDOR
|
||||
+ default "armltd"
|
||||
+
|
||||
+config SYS_CONFIG_NAME
|
||||
+ default "total_compute"
|
||||
+
|
||||
+endif
|
||||
diff --git a/board/armltd/totalcompute/MAINTAINERS b/board/armltd/totalcompute/MAINTAINERS
|
||||
new file mode 100644
|
||||
index 00000000000..bb09a90a309
|
||||
--- /dev/null
|
||||
+++ b/board/armltd/totalcompute/MAINTAINERS
|
||||
@@ -0,0 +1,6 @@
|
||||
+TOTAL_COMPUTE BOARD
|
||||
+M: Usama Arif <usama.arif@arm.com>
|
||||
+S: Maintained
|
||||
+F: board/armltd/totalcompute/
|
||||
+F: include/configs/total_compute.h
|
||||
+F: configs/total_compute_defconfig
|
||||
diff --git a/board/armltd/totalcompute/Makefile b/board/armltd/totalcompute/Makefile
|
||||
new file mode 100644
|
||||
index 00000000000..4c40afef723
|
||||
--- /dev/null
|
||||
+++ b/board/armltd/totalcompute/Makefile
|
||||
@@ -0,0 +1,6 @@
|
||||
+# SPDX-License-Identifier: GPL-2.0+
|
||||
+#
|
||||
+# (C) Copyright 2020 ARM Limited
|
||||
+# Usama Arif <usama.arif@arm.com>
|
||||
+
|
||||
+obj-y := totalcompute.o
|
||||
diff --git a/board/armltd/totalcompute/totalcompute.c b/board/armltd/totalcompute/totalcompute.c
|
||||
new file mode 100644
|
||||
index 00000000000..21247e4ef0f
|
||||
--- /dev/null
|
||||
+++ b/board/armltd/totalcompute/totalcompute.c
|
||||
@@ -0,0 +1,74 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0+
|
||||
+/*
|
||||
+ * (C) Copyright 2020 ARM Limited
|
||||
+ * Usama Arif <usama.arif@arm.com>
|
||||
+ */
|
||||
+#include <common.h>
|
||||
+#include <dm.h>
|
||||
+#include <init.h>
|
||||
+#include <malloc.h>
|
||||
+#include <errno.h>
|
||||
+#include <netdev.h>
|
||||
+#include <asm/io.h>
|
||||
+#include <linux/compiler.h>
|
||||
+#include <dm/platform_data/serial_pl01x.h>
|
||||
+#include <asm/armv8/mmu.h>
|
||||
+
|
||||
+DECLARE_GLOBAL_DATA_PTR;
|
||||
+
|
||||
+static const struct pl01x_serial_platdata serial_platdata = {
|
||||
+ .base = UART0_BASE,
|
||||
+ .type = TYPE_PL011,
|
||||
+ .clock = CONFIG_PL011_CLOCK,
|
||||
+};
|
||||
+
|
||||
+U_BOOT_DEVICE(total_compute_serials) = {
|
||||
+ .name = "serial_pl01x",
|
||||
+ .platdata = &serial_platdata,
|
||||
+};
|
||||
+
|
||||
+static struct mm_region total_compute_mem_map[] = {
|
||||
+ {
|
||||
+ .virt = 0x0UL,
|
||||
+ .phys = 0x0UL,
|
||||
+ .size = 0x80000000UL,
|
||||
+ .attrs = PTE_BLOCK_MEMTYPE(MT_DEVICE_NGNRNE) |
|
||||
+ PTE_BLOCK_NON_SHARE |
|
||||
+ PTE_BLOCK_PXN | PTE_BLOCK_UXN
|
||||
+ }, {
|
||||
+ .virt = 0x80000000UL,
|
||||
+ .phys = 0x80000000UL,
|
||||
+ .size = 0xff80000000UL,
|
||||
+ .attrs = PTE_BLOCK_MEMTYPE(MT_NORMAL) |
|
||||
+ PTE_BLOCK_INNER_SHARE
|
||||
+ }, {
|
||||
+ /* List terminator */
|
||||
+ 0,
|
||||
+ }
|
||||
+};
|
||||
+
|
||||
+struct mm_region *mem_map = total_compute_mem_map;
|
||||
+
|
||||
+int board_init(void)
|
||||
+{
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+int dram_init(void)
|
||||
+{
|
||||
+ gd->ram_size = PHYS_SDRAM_1_SIZE;
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+int dram_init_banksize(void)
|
||||
+{
|
||||
+ gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
|
||||
+ gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+void reset_cpu(ulong addr)
|
||||
+{
|
||||
+}
|
||||
+
|
||||
diff --git a/configs/total_compute_defconfig b/configs/total_compute_defconfig
|
||||
new file mode 100644
|
||||
index 00000000000..31d97dddc21
|
||||
--- /dev/null
|
||||
+++ b/configs/total_compute_defconfig
|
||||
@@ -0,0 +1,39 @@
|
||||
+CONFIG_ARM=y
|
||||
+CONFIG_TARGET_TOTAL_COMPUTE=y
|
||||
+CONFIG_SYS_TEXT_BASE=0xe0000000
|
||||
+CONFIG_SYS_MALLOC_F_LEN=0x2000
|
||||
+CONFIG_ENV_SIZE=0x10000
|
||||
+CONFIG_NR_DRAM_BANKS=2
|
||||
+CONFIG_DISTRO_DEFAULTS=y
|
||||
+CONFIG_BOOTDELAY=1
|
||||
+CONFIG_USE_BOOTARGS=y
|
||||
+CONFIG_BOOTARGS="console=ttyAMA0 debug user_debug=31 earlycon=pl011,0x7ff80000 loglevel=9 androidboot.hardware=total_compute video=640x480-32@60 root=/dev/vda2 ip=dhcp androidboot.selinux=permissive"
|
||||
+# CONFIG_USE_BOOTCOMMAND is not set
|
||||
+# CONFIG_DISPLAY_CPUINFO is not set
|
||||
+# CONFIG_DISPLAY_BOARDINFO is not set
|
||||
+CONFIG_SYS_PROMPT="TOTAL_COMPUTE# "
|
||||
+# CONFIG_CMD_CONSOLE is not set
|
||||
+# CONFIG_CMD_XIMG is not set
|
||||
+# CONFIG_CMD_EDITENV is not set
|
||||
+CONFIG_CMD_MEMTEST=y
|
||||
+CONFIG_SYS_MEMTEST_START=0x80000000
|
||||
+CONFIG_SYS_MEMTEST_END=0xff000000
|
||||
+CONFIG_CMD_ARMFLASH=y
|
||||
+# CONFIG_CMD_LOADS is not set
|
||||
+# CONFIG_CMD_ITEST is not set
|
||||
+# CONFIG_CMD_SETEXPR is not set
|
||||
+# CONFIG_CMD_NFS is not set
|
||||
+CONFIG_CMD_CACHE=y
|
||||
+# CONFIG_CMD_MISC is not set
|
||||
+CONFIG_CMD_UBI=y
|
||||
+# CONFIG_ISO_PARTITION is not set
|
||||
+# CONFIG_EFI_PARTITION is not set
|
||||
+# CONFIG_MMC is not set
|
||||
+CONFIG_MTD=y
|
||||
+CONFIG_MTD_DEVICE=y
|
||||
+CONFIG_MTD_NOR_FLASH=y
|
||||
+CONFIG_FLASH_CFI_DRIVER=y
|
||||
+CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
|
||||
+CONFIG_SYS_FLASH_PROTECTION=y
|
||||
+CONFIG_SYS_FLASH_CFI=y
|
||||
+CONFIG_OF_LIBFDT=y
|
||||
diff --git a/include/configs/total_compute.h b/include/configs/total_compute.h
|
||||
new file mode 100644
|
||||
index 00000000000..54086205db6
|
||||
--- /dev/null
|
||||
+++ b/include/configs/total_compute.h
|
||||
@@ -0,0 +1,77 @@
|
||||
+/* SPDX-License-Identifier: GPL-2.0+ */
|
||||
+/*
|
||||
+ * Configuration for Total Compute. Parts were derived from other ARM
|
||||
+ * configurations.
|
||||
+ * (C) Copyright 2020 ARM Limited
|
||||
+ * Usama Arif <usama.arif@arm.com>
|
||||
+ */
|
||||
+
|
||||
+#ifndef __TOTAL_COMPUTE_H
|
||||
+#define __TOTAL_COMPUTE_H
|
||||
+
|
||||
+#define CONFIG_REMAKE_ELF
|
||||
+
|
||||
+/* Link Definitions */
|
||||
+#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_SDRAM_BASE + 0x7fff0)
|
||||
+#define CONFIG_ENV_SIZE 0x10000
|
||||
+
|
||||
+
|
||||
+#define CONFIG_SYS_BOOTM_LEN (64 << 20)
|
||||
+
|
||||
+#define UART0_BASE 0x7ff80000
|
||||
+
|
||||
+/* Generic Timer Definitions */
|
||||
+#define COUNTER_FREQUENCY (0x1800000) /* 24MHz */
|
||||
+
|
||||
+/* Generic Interrupt Controller Definitions */
|
||||
+
|
||||
+#define GICD_BASE (0x2C010000)
|
||||
+#define GICC_BASE (0x2C02f000)
|
||||
+
|
||||
+/* Size of malloc() pool */
|
||||
+#define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + (8 << 20))
|
||||
+
|
||||
+/* PL011 Serial Configuration */
|
||||
+#define CONFIG_PL011_CLOCK 7372800
|
||||
+
|
||||
+/* BOOTP options */
|
||||
+#define CONFIG_BOOTP_BOOTFILESIZE
|
||||
+
|
||||
+/* Miscellaneous configurable options */
|
||||
+#define CONFIG_SYS_LOAD_ADDR 0x90000000
|
||||
+
|
||||
+/* Physical Memory Map */
|
||||
+#define PHYS_SDRAM_1 0x80000000
|
||||
+/* Top 32MB reserved for secure world use */
|
||||
+#define DRAM_SEC_SIZE 0x02000000
|
||||
+#define PHYS_SDRAM_1_SIZE 0x80000000 - DRAM_SEC_SIZE
|
||||
+#define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM_1
|
||||
+
|
||||
+/* Enable memtest */
|
||||
+#define CONFIG_SYS_MEMTEST_START PHYS_SDRAM_1
|
||||
+#define CONFIG_SYS_MEMTEST_END (PHYS_SDRAM_1 + PHYS_SDRAM_1_SIZE)
|
||||
+
|
||||
+#define CONFIG_EXTRA_ENV_SETTINGS \
|
||||
+ "kernel_addr_r=0x80080000\0" \
|
||||
+ "initrd_addr_r=0x88000000\0" \
|
||||
+ "fdt_addr_r=0x83000000\0" \
|
||||
+ "fdt_high=0xffffffffffffffff\0" \
|
||||
+ "initrd_high=0xffffffffffffffff\0"
|
||||
+
|
||||
+#define CONFIG_BOOTCOMMAND "booti ${kernel_addr_r} ${initrd_addr_r} ${fdt_addr_r}"
|
||||
+
|
||||
+/* Monitor Command Prompt */
|
||||
+#define CONFIG_SYS_CBSIZE 512 /* Console I/O Buffer Size */
|
||||
+#define CONFIG_SYS_MAXARGS 64 /* max command args */
|
||||
+
|
||||
+#define CONFIG_SYS_FLASH_BASE 0x0C000000
|
||||
+/* 256 x 256KiB sectors */
|
||||
+#define CONFIG_SYS_MAX_FLASH_SECT 256
|
||||
+
|
||||
+#define CONFIG_SYS_FLASH_CFI_WIDTH FLASH_CFI_32BIT
|
||||
+#define CONFIG_SYS_MAX_FLASH_BANKS 1
|
||||
+
|
||||
+#define CONFIG_SYS_FLASH_EMPTY_INFO /* flinfo indicates empty blocks */
|
||||
+#define FLASH_MAX_SECTOR_SIZE 0x00040000
|
||||
+
|
||||
+#endif /* __TOTAL_COMPUTE_H */
|
||||
--
|
||||
2.17.1
|
||||
|
||||
@@ -34,8 +34,10 @@ SRC_URI_append_juno = " file://u-boot_vexpress_uenv.patch"
|
||||
#
|
||||
# Total Compute KMACHINE
|
||||
#
|
||||
SRC_URI_append_tc0 = " file://0001-Add-support-for-Total-Compute.patch"
|
||||
|
||||
SRC_URI_tc0 = "git://git.denx.de/u-boot.git \
|
||||
"
|
||||
SRCREV_tc0 = "565add124de00c994652a0d2d6d1eb6b2a7c9553"
|
||||
LIC_FILES_CHKSUM_tc0 = "file://Licenses/README;md5=5a7450c57ffe5ae63fd732446b988025"
|
||||
#
|
||||
# Corstone700 KMACHINE
|
||||
#
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
DESCRIPTION = "TF-A spm"
|
||||
LICENSE = "BSD & Apache-2.0"
|
||||
|
||||
PROVIDES = "virtual/spm"
|
||||
|
||||
PACKAGE_ARCH = "${MACHINE_ARCH}"
|
||||
|
||||
inherit deploy
|
||||
|
||||
COMPATIBLE_MACHINE ?= "invalid"
|
||||
|
||||
inherit pythonnative
|
||||
|
||||
# Platform must be set for each machine
|
||||
SPM_PLATFORM ?= "invalid"
|
||||
|
||||
# Build for debug (set SPM_DEBUG to 1 to activate)
|
||||
SPM_DEBUG ?= "0"
|
||||
|
||||
# hafnium project
|
||||
SPM_PROJECT ?= "reference"
|
||||
|
||||
# This is fixed for SPM
|
||||
SPM_BUILD_DIR ?= "out/${SPM_PROJECT}"
|
||||
|
||||
# platform build directory
|
||||
SPM_BUILD_DIR_PLAT ?= "${SPM_BUILD_DIR}/${SPM_PLATFORM}"
|
||||
|
||||
# set project to build
|
||||
EXTRA_OEMAKE += "PROJECT=${SPM_PROJECT}"
|
||||
|
||||
SPM_BUILD_TARGET ?= "hafnium.bin"
|
||||
|
||||
# do_deploy will install everything listed in this
|
||||
# variable. It is set by default to SPM_BUILD_TARGET
|
||||
SPM_INSTALL_TARGET ?= "${SPM_BUILD_TARGET}"
|
||||
|
||||
# Requires CROSS_COMPILE set by hand as there is no configure script
|
||||
|
||||
# Currently SPM uses complier from prebuilts submodule. CROSS_COMPILE will
|
||||
# be set once prebuilts dependencies are removed.
|
||||
#export CROSS_COMPILE="${TARGET_PREFIX}"
|
||||
|
||||
# Let the Makefile handle setting up the CFLAGS and LDFLAGS
|
||||
# as it is a standalone application
|
||||
CFLAGS[unexport] = "1"
|
||||
LDFLAGS[unexport] = "1"
|
||||
AS[unexport] = "1"
|
||||
LD[unexport] = "1"
|
||||
|
||||
# No configure or install
|
||||
do_configure[noexec] = "1"
|
||||
do_install[noexec] = "1"
|
||||
|
||||
# needs bison, bc
|
||||
DEPENDS_append = " bison-native bc-native"
|
||||
|
||||
|
||||
# Handle SPM_DEBUG parameter
|
||||
EXTRA_OEMAKE += "${@bb.utils.contains('SPM_DEBUG', '1', ' DEBUG=${SPM_DEBUG}', '', d)}"
|
||||
|
||||
do_compile() {
|
||||
oe_runmake
|
||||
}
|
||||
|
||||
do_deploy() {
|
||||
install -d -m 755 ${DEPLOYDIR}
|
||||
for bldfile in ${SPM_INSTALL_TARGET}; do
|
||||
if [ "$bldfile" = "all" ]; then
|
||||
# Target all is not handled by default
|
||||
bberror "all as SPM_INSTALL_TARGET is not handled"
|
||||
bberror "Please specify valid targets in SPM_INSTALL_TARGET"
|
||||
bberror "or rewrite or turn off do_deploy"
|
||||
exit 1
|
||||
elif [ -f ${S}/${SPM_BUILD_DIR_PLAT}/$bldfile ]; then
|
||||
echo "Install $bldfile"
|
||||
install -m 0755 ${S}/${SPM_BUILD_DIR_PLAT}/$bldfile \
|
||||
${DEPLOYDIR}/$bldfile
|
||||
else
|
||||
bberror "Unsupported SPM_INSTALL_TARGET target $bldfile"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
}
|
||||
addtask deploy before do_build after do_compile
|
||||
@@ -0,0 +1,12 @@
|
||||
# TF-A spm
|
||||
#
|
||||
|
||||
# Never select this if another version is available
|
||||
DEFAULT_PREFERENCE = "-1"
|
||||
|
||||
require spm.inc
|
||||
|
||||
SRC_URI = "gitsm://git.trustedfirmware.org/hafnium/hafnium.git;;protocol=https;name=spm"
|
||||
SRCREV_FORMAT = "spm"
|
||||
|
||||
S = "${WORKDIR}/git"
|
||||
@@ -0,0 +1,87 @@
|
||||
DESCRIPTION = "Trusted Firmware-A Tests"
|
||||
LICENSE = "BSD & Apache-2.0"
|
||||
|
||||
PROVIDES = "virtual/tf-a-tests"
|
||||
|
||||
PACKAGE_ARCH = "${MACHINE_ARCH}"
|
||||
|
||||
inherit deploy
|
||||
|
||||
COMPATIBLE_MACHINE ?= "invalid"
|
||||
|
||||
# Platform must be set for each machine
|
||||
TFA_TESTS_PLATFORM ?= "invalid"
|
||||
|
||||
# Build for debug (set TFA_TESTS_DEBUG to 1 to activate)
|
||||
TFA_TESTS_DEBUG ?= "0"
|
||||
|
||||
# Sub-directory in which to build.
|
||||
# This must be coherent with BUILD_PLAT make parameter so that deploy can find
|
||||
# the produced binaries
|
||||
#TFA_TESTS_BUILD_DIR ?= "build-${TFA_TESTS_PLATFORM}"
|
||||
TFA_TESTS_BUILD_DIR ?= "build/${TFA_TESTS_PLATFORM}/debug"
|
||||
|
||||
# set BUILD_PLAT depending on configured BUILD_DIR
|
||||
EXTRA_OEMAKE += "BUILD_PLAT=${TFA_TESTS_BUILD_DIR}"
|
||||
|
||||
# What to build
|
||||
TFA_TESTS_BUILD_TARGET ?= "tftf"
|
||||
|
||||
# What to install
|
||||
# do_deploy will install everything listed in this
|
||||
# variable. It is set by default to TFA_TESTS_BUILD_TARGET
|
||||
TFA_TESTS_INSTALL_TARGET ?= "${TFA_TESTS_BUILD_TARGET}"
|
||||
|
||||
# Requires CROSS_COMPILE set by hand as there is no configure script
|
||||
export CROSS_COMPILE="${TARGET_PREFIX}"
|
||||
|
||||
# Let the Makefile handle setting up the CFLAGS and LDFLAGS as it is a standalone application
|
||||
CFLAGS[unexport] = "1"
|
||||
LDFLAGS[unexport] = "1"
|
||||
AS[unexport] = "1"
|
||||
LD[unexport] = "1"
|
||||
|
||||
# No configure or install
|
||||
do_configure[noexec] = "1"
|
||||
do_install[noexec] = "1"
|
||||
|
||||
# We need dtc for dtbs compilation
|
||||
# We need openssl for fiptool
|
||||
DEPENDS_append = " dtc-native openssl-native"
|
||||
|
||||
# Add platform parameter
|
||||
EXTRA_OEMAKE += "PLAT=${TFA_TESTS_PLATFORM}"
|
||||
|
||||
# Handle TFA_TESTS_DEBUG parameter
|
||||
EXTRA_OEMAKE += "${@bb.utils.contains('TFA_TESTS_DEBUG', '1', ' DEBUG=${TFA_TESTS_DEBUG}', '', d)}"
|
||||
|
||||
do_clean() {
|
||||
if [ -f ${S}/Makefile ]; then
|
||||
oe_runmake -C ${S} distclean
|
||||
fi
|
||||
}
|
||||
|
||||
do_compile() {
|
||||
oe_runmake ${TFA_TESTS_BUILD_TARGET}
|
||||
}
|
||||
|
||||
do_deploy() {
|
||||
install -d -m 755 ${DEPLOYDIR}
|
||||
for bldfile in ${TFA_TESTS_INSTALL_TARGET}; do
|
||||
if [ "$bldfile" = "all" ]; then
|
||||
# Target all is not handled by default
|
||||
bberror "all as TFA_TESTS_INSTALL_TARGET is not handled"
|
||||
bberror "Please specify valid targets in TFA_TESTS_INSTALL_TARGET"
|
||||
bberror "or rewrite or turn off do_deploy"
|
||||
exit 1
|
||||
elif [ -f ${S}/${TFA_TESTS_BUILD_DIR}/$bldfile ]; then
|
||||
echo "Install $bldfile"
|
||||
install -m 0644 ${S}/${TFA_TESTS_BUILD_DIR}/$bldfile \
|
||||
${DEPLOYDIR}/$bldfile
|
||||
else
|
||||
bberror "Unsupported TFA_TESTS_INSTALL_TARGET target $bldfile"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
}
|
||||
addtask deploy before do_build after do_compile
|
||||
@@ -0,0 +1,27 @@
|
||||
# tf-a-tests
|
||||
#
|
||||
|
||||
# Never select this if another version is available
|
||||
DEFAULT_PREFERENCE = "-1"
|
||||
|
||||
require tf-a-tests.inc
|
||||
|
||||
SRC_URI = "git://git.trustedfirmware.org/TF-A/tf-a-tests.git;;protocol=https;name=tfa-tests"
|
||||
SRCREV_FORMAT = "tfa-tests"
|
||||
|
||||
S = "${WORKDIR}/git"
|
||||
|
||||
# The following hack is needed to fit properly in yocto build environment
|
||||
# TFA is forcing the host compiler and its flags in the Makefile using :=
|
||||
# assignment for GCC and CFLAGS.
|
||||
# To properly use the native toolchain of yocto and the right libraries we need
|
||||
# to pass the proper flags to gcc. This is achieved here by creating a gcc
|
||||
# script to force passing to gcc the right CFLAGS and LDFLAGS
|
||||
do_compile_prepend() {
|
||||
# Create an host gcc build parser to ensure the proper include path is used
|
||||
mkdir -p bin
|
||||
echo "#!/usr/bin/env bash" > bin/gcc
|
||||
echo "$(which ${BUILD_CC}) ${BUILD_CFLAGS} ${BUILD_LDFLAGS} \$@" >> bin/gcc
|
||||
chmod a+x bin/gcc
|
||||
export PATH="$PWD/bin:$PATH"
|
||||
}
|
||||
@@ -21,10 +21,10 @@ LIC_FILES_CHKSUM = "file://docs/license.rst;md5=189505435dbcdcc8caa63c46fe93fa89
|
||||
# Those are used in trusted-firmware-a.inc if TFA_MBEDTLS is set to 1
|
||||
#
|
||||
|
||||
SRC_URI_MBEDTLS = "git://github.com/ARMmbed/mbedtls.git;name=mbedtls;protocol=https;destsuffix=git/mbedtls;branch=mbedtls-2.18"
|
||||
SRC_URI_MBEDTLS = "git://github.com/ARMmbed/mbedtls.git;name=mbedtls;protocol=https;destsuffix=git/mbedtls;tag=v2.24.0"
|
||||
|
||||
# mbed TLS v2.18.1
|
||||
SRCREV_mbedtls = "ca933c7e0c9e84738b168b6b0feb89af4183a60a"
|
||||
SRCREV_mbedtls = "v2.24.0"
|
||||
|
||||
LIC_FILES_CHKSUM_MBEDTLS += " \
|
||||
file://mbedtls/apache-2.0.txt;md5=3b83ef96387f14655fc854ddc3c6bd57 \
|
||||
|
||||
Reference in New Issue
Block a user