1/*
2 * Copyright 2019, Data61, CSIRO (ABN 41 687 119 230)
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 */
6
7#pragma once
8
9/***
10 * @module guest_boot_init.h
11 * The libsel4vmmplatsupport x86 guest boot init interface provides helpers to initialise the booting state of
12 * a VM instance. This currently only targets booting a Linux guest OS.
13 */
14
15#include <stdint.h>
16
17#include <sel4vmmplatsupport/guest_image.h>
18
19/***
20 * @function vmm_plat_init_guest_boot_structure(vm, cmdline, guest_kernel_image, guest_ramdisk_image, guest_boot_info_addr)
21 * Establish the necessary BIOS boot structures to initialise and boot a guest Linux OS. This includes the creation of a BIOS
22 * boot info structure, an e820 map and ACPI tables.
23 * @param {vm_t *} vm                                   A handle to the guest VM
24 * @param {const char *} cmdline                        The guest Linux boot commandline
25 * @param {guest_kernel_image_t} guest_kernel_image     Guest kernel image (preloaded into the VM's memory)
26 * @param {guest_image_t} guest_ramdisk_image           Guest ramdisk image (preloaded into the VM's memory)
27 * @param {uintptr_t *} guest_boot_info_addr            Resulting address of loaded generated guest boot info structure
28 *                                                      (in guest physical address space)
29 * @return                                              0 for success, -1 for error
30 */
31int vmm_plat_init_guest_boot_structure(vm_t *vm, const char *cmdline,
32                                       guest_kernel_image_t guest_kernel_image, guest_image_t guest_ramdisk_image,
33                                       uintptr_t *guest_boot_info_addr);
34
35/***
36 * @function vmm_plat_init_guest_thread_state(vcpu, guest_entry_addr, guest_boot_info_addr)
37 * Initialise the booting state of a guest VM, establishing the necessary thread state to launch a guest Linux OS
38 * @param {vm_vcpu_t *} vcpu                A handle to the boot vcpu
39 * @param {uintptr_t} guest_entry_addr      Address of VM entry point (often entry point defined in kernel elf image)
40 * @param {uintptr_t} guest_boot_info_addr  Address of loaded guest boot info structure
41 * @return                                  0 for success, -1 for error
42 */
43int vmm_plat_init_guest_thread_state(vm_vcpu_t *vcpu, uintptr_t guest_entry_addr,
44                                     uintptr_t guest_boot_info_addr);
45