Merge manifest into the board DT, add boot flow drivers
Hafnium currently supports two kinds of boot flow:
(a) Linux-like, where the board FDT is passed by the boot loader to
the OS kernel in first kernel arg (this is used by QEMU, FVP, RPi, ...),
(b) Android-like, where the FDT used by Hafnium is compiled into it and
the VMs have their own.
This used to be implemented using weak symbols and each board spec
overriding it with its own implementation. This patch introduces the
concept of boot-flow drivers in the main tree, and the corresponding
driver selected using a config option in board spec. Drivers for the two
boot-flows described above are implemented.
Simultaneously, the manifest is now read from the FDT available at
Hafnium init time. This required two notable changes:
(1) all values are copied into the manifest struct because FDT is
unmapped, modified and passed to the primary VM,
(2) manifest is now written as an overlay; QEMU and FVP test drivers
overlay it automatically.
Bug: 117551352
Change-Id: Ieae7fe4ef5b3047174ec0ad057e487660ccd5a03
diff --git a/inc/hf/manifest.h b/inc/hf/manifest.h
index dd7a122..46bd205 100644
--- a/inc/hf/manifest.h
+++ b/inc/hf/manifest.h
@@ -16,19 +16,25 @@
#pragma once
+#include "hf/fdt.h"
#include "hf/memiter.h"
#include "hf/spci.h"
/**
+ * Maximum length of a string parsed from the FDT, including NULL terminator.
+ */
+#define MANIFEST_MAX_STRING_LENGTH 32
+
+/**
* Holds information about one of the VMs described in the manifest.
*/
struct manifest_vm {
/* Properties defined for both primary and secondary VMs. */
- struct memiter debug_name;
+ char debug_name[MANIFEST_MAX_STRING_LENGTH];
/* Properties specific to secondary VMs. */
struct {
- struct memiter kernel_filename;
+ char kernel_filename[MANIFEST_MAX_STRING_LENGTH];
uint64_t mem_size;
spci_vcpu_count_t vcpu_count;
} secondary;
@@ -44,8 +50,6 @@
enum manifest_return_code {
MANIFEST_SUCCESS = 0,
- MANIFEST_ERROR_CORRUPTED_FDT,
- MANIFEST_ERROR_NO_ROOT_FDT_NODE,
MANIFEST_ERROR_NO_HYPERVISOR_FDT_NODE,
MANIFEST_ERROR_NOT_COMPATIBLE,
MANIFEST_ERROR_RESERVED_VM_ID,
@@ -53,12 +57,13 @@
MANIFEST_ERROR_TOO_MANY_VMS,
MANIFEST_ERROR_PROPERTY_NOT_FOUND,
MANIFEST_ERROR_MALFORMED_STRING,
+ MANIFEST_ERROR_STRING_TOO_LONG,
MANIFEST_ERROR_MALFORMED_STRING_LIST,
MANIFEST_ERROR_MALFORMED_INTEGER,
MANIFEST_ERROR_INTEGER_OVERFLOW,
};
enum manifest_return_code manifest_init(struct manifest *manifest,
- struct memiter *fdt);
+ const struct fdt_node *fdt_root);
const char *manifest_strerror(enum manifest_return_code ret_code);