hv: Create E820 entries for OS in partitioning mode ACRN

1) This patch creates static E820 entries for VMs launced by ACRN in
partition mode.
2) Moves vm_description entries from bsp/sbl/ to partition/
3) Removes unused API get_vm_desc_base

Signed-off-by: Sainath Grandhi <sainath.grandhi@intel.com>
This commit is contained in:
Sainath Grandhi
2018-08-12 20:44:51 -07:00
committed by lijinxia
parent ab2961473f
commit c25a62e5b0
4 changed files with 129 additions and 101 deletions

View File

@@ -6,6 +6,28 @@
#include <hypervisor.h>
#define NUM_USER_VMS 2U
/**********************/
/* VIRTUAL MACHINE 0 */
/*********************/
/* Number of CPUs in this VM*/
#define VM1_NUM_CPUS 2U
/* Logical CPU IDs assigned to this VM */
int VM1_CPUS[VM1_NUM_CPUS] = {0U, 2U};
/*********************/
/* VIRTUAL MACHINE 1 */
/*********************/
/* Number of CPUs in this VM*/
#define VM2_NUM_CPUS 2U
/* Logical CPU IDs assigned with this VM */
int VM2_CPUS[VM2_NUM_CPUS] = {3U, 1U};
static struct vpci_vdev_array vpci_vdev_array1 = {
.num_pci_vdev = 2,
@@ -51,7 +73,6 @@ static struct vpci_vdev_array vpci_vdev_array1 = {
}
};
static struct vpci_vdev_array vpci_vdev_array2 = {
.num_pci_vdev = 2,
@@ -101,26 +122,88 @@ static struct vpci_vdev_array vpci_vdev_array2 = {
/* User Defined VM definitions */
/*******************************/
const struct vm_description_array vm_desc_partition = {
/* Number of user virtual machines */
.num_vm_desc = 2,
/* Number of user virtual machines */
.num_vm_desc = NUM_USER_VMS,
.vm_desc_array = {
{
/* vm1 */
.vm_hw_num_cores = 2,
.vpci_vdev_array = &vpci_vdev_array1,
},
/* Virtual Machine descriptions */
.vm_desc_array = {
{
/* Internal variable, MUSTBE init to -1 */
.vm_hw_num_cores = VM1_NUM_CPUS,
.vm_pcpu_ids = &VM1_CPUS[0],
.vm_id = 1U,
.start_hpa = 0x100000000UL,
.mem_size = 0x80000000UL, /* uses contiguous memory from host */
.vm_vuart = true,
.bootargs = "root=/dev/sda rw rootwait noxsave maxcpus=2 nohpet console=hvc0 \
console=ttyS0 no_timer_check ignore_loglevel log_buf_len=16M \
consoleblank=0 tsc=reliable",
.vpci_vdev_array = &vpci_vdev_array1,
},
{
/* vm2 */
.vm_hw_num_cores = 2,
.vpci_vdev_array = &vpci_vdev_array2,
},
}
{
/* Internal variable, MUSTBE init to -1 */
.vm_hw_num_cores = VM2_NUM_CPUS,
.vm_pcpu_ids = &VM2_CPUS[0],
.vm_id = 2U,
.start_hpa = 0x180000000UL,
.mem_size = 0x80000000UL, /* uses contiguous memory from host */
.vm_vuart = true,
.bootargs = "root=/dev/sda rw rootwait noxsave maxcpus=2 nohpet console=hvc0 \
console=ttyS0 no_timer_check ignore_loglevel log_buf_len=16M \
consoleblank=0 tsc=reliable",
.vpci_vdev_array = &vpci_vdev_array2,
},
}
};
const struct vm_description_array *get_vm_desc_base(void)
{
return &vm_desc_partition;
}
const struct pcpu_vm_desc_mapping pcpu_vm_desc_map[] = {
{
.vm_desc_ptr = &vm_desc_partition.vm_desc_array[0],
.is_bsp = true,
},
{
.vm_desc_ptr = &vm_desc_partition.vm_desc_array[1],
.is_bsp = false,
},
{
.vm_desc_ptr = &vm_desc_partition.vm_desc_array[0],
.is_bsp = false,
},
{
.vm_desc_ptr = &vm_desc_partition.vm_desc_array[1],
.is_bsp = true,
},
};
const struct e820_entry e820_default_entries[NUM_E820_ENTRIES] = {
{ /* 0 to mptable */
.baseaddr = 0x0U,
.length = 0xEFFFFU,
.type = E820_TYPE_RAM
},
{ /* mptable */
.baseaddr = 0xF0000U,
.length = 0x10000U,
.type = E820_TYPE_RESERVED
},
{ /* mptable to lowmem */
.baseaddr = 0x100000U,
.length = 0x7FF00000U,
.type = E820_TYPE_RAM
},
{ /* lowmem to PCI hole */
.baseaddr = 0x80000000U,
.length = 0x40000000U,
.type = E820_TYPE_RESERVED
},
{ /* PCI hole to 4G */
.baseaddr = 0xe0000000U,
.length = 0x20000000U,
.type = E820_TYPE_RESERVED
},
};