acrn-hypervisor/hypervisor/include/arch/x86/vm_config.h
Victor Sun 56c193851a HV: introduce scenario Kconfig for sharing mode
Previously the vm_configs[] is defined separately for sharing mode and
partition mode, but the concept of hypervisor mode will be removed. Instead
we will introduce scenario Kconfig for hypervisor to load different vm
configurations.

SDC(Software Defined Cockpit) is a typical scenario that ACRN supported
so we introduce this scenario for previously sharing mode and move its
configurations to scenarios/sdc folder. The configuration could be used
for all boards reference.

Tracked-On: #2291

Signed-off-by: Victor Sun <victor.sun@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
2019-04-02 16:00:27 +08:00

68 lines
2.1 KiB
C

/*
* Copyright (C) 2018 Intel Corporation. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef VM_CONFIG_H_
#define VM_CONFIG_H_
#include <types.h>
#include <pci.h>
#include <multiboot.h>
#include <acrn_common.h>
#define PLUG_CPU(n) (1U << (n))
/*
* PRE_LAUNCHED_VM is launched by ACRN hypervisor, with LAPIC_PT;
* SOS_VM is launched by ACRN hypervisor, without LAPIC_PT;
* NORMAL_VM is launched by ACRN devicemodel, with/without LAPIC_PT depends on usecases.
*/
enum acrn_vm_type {
UNDEFINED_VM = 0,
PRE_LAUNCHED_VM,
SOS_VM,
NORMAL_VM /* Post-launched VM */
};
struct acrn_vm_mem_config {
uint64_t start_hpa; /* the start HPA of VM memory configuration, for pre-launched VMs only */
uint64_t size; /* VM memory size configuration */
};
struct acrn_vm_os_config {
char name[MAX_VM_OS_NAME_LEN]; /* OS name, useful for debug */
char bootargs[MAX_BOOTARGS_SIZE]; /* boot args/cmdline */
} __aligned(8);
struct acrn_vm_pci_ptdev_config {
union pci_bdf vbdf; /* virtual BDF of PCI PT device */
union pci_bdf pbdf; /* physical BDF of PCI PT device */
} __aligned(8);
struct acrn_vm_config {
enum acrn_vm_type type; /* specify the type of VM */
char name[MAX_VM_OS_NAME_LEN]; /* VM name identifier, useful for debug. */
uint8_t GUID[16]; /* GUID of the VM */
uint64_t pcpu_bitmap; /* from pcpu bitmap, we could know VM core number */
uint64_t guest_flags; /* VM flags that we want to configure for guest
* Now we have two flags:
* GUEST_FLAG_SECURE_WORLD_ENABLED
* GUEST_FLAG_LAPIC_PASSTHROUGH
* We could add more guest flags in future;
*/
struct acrn_vm_mem_config memory; /* memory configuration of VM */
uint16_t pci_ptdev_num; /* indicate how many PCI PT devices in VM */
struct acrn_vm_pci_ptdev_config *pci_ptdevs; /* point to PCI PT devices BDF list */
struct acrn_vm_os_config os_config; /* OS information the VM */
uint16_t clos; /* if guest_flags has GUEST_FLAG_CLOS_REQUIRED, then VM use this CLOS */
bool vm_vuart;
} __aligned(8);
struct acrn_vm_config *get_vm_config(uint16_t vm_id);
int32_t sanitize_vm_config(void);
#endif /* VM_CONFIG_H_ */