hv:cleanup header file for vm.c & vm.h

-- now hypervisor.h is the universal set of header file,
   this patch doesn't include hypervisor.h, only include
   some necessary header files for vm.c and vm.h
-- move 'struct vcpuid_entry' from vm.h to vcpuid.h
-- remove dead code 'enum vm_privilege_level'
-- move 'enum vpic_wire_mode' from vm.h to vpic.h

Tracked-On: #1842
Signed-off-by: Mingqiang Chi <mingqiang.chi@intel.com>
Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Mingqiang Chi 2019-02-02 10:24:18 +08:00 committed by wenlingz
parent b5f4757650
commit 3d878a9123
13 changed files with 56 additions and 27 deletions

View File

@ -4,12 +4,21 @@
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <hypervisor.h>
#include <bsp_extern.h>
#include <multiboot.h>
#include <types.h>
#include <errno.h>
#include <sprintf.h>
#include <vm.h>
#include <bits.h>
#include <e820.h>
#include <multiboot.h>
#include <vtd.h>
#include <reloc.h>
#include <ept.h>
#include <guest_pm.h>
#include <console.h>
#include <ptdev.h>
#include <vmcs.h>
#include <logmsg.h>
vm_sw_loader_t vm_sw_loader;

View File

@ -6,6 +6,7 @@
#ifndef TRUSTY_H_
#define TRUSTY_H_
#include <acrn_hv_defs.h>
#define BOOTLOADER_SEED_MAX_ENTRIES 10U
#define RPMB_MAX_PARTITION_NUMBER 6U

View File

@ -52,6 +52,11 @@
#include <guest_memory.h>
#include <virtual_cr.h>
#include <vlapic.h>
#include <vmtrr.h>
#include <schedule.h>
#include <io_req.h>
#include <msr.h>
/**
* @brief vcpu

View File

@ -7,6 +7,19 @@
#ifndef VCPUID_H_
#define VCPUID_H_
#define CPUID_CHECK_SUBLEAF (1U << 0U)
#define MAX_VM_VCPUID_ENTRIES 64U
struct vcpuid_entry {
uint32_t eax;
uint32_t ebx;
uint32_t ecx;
uint32_t edx;
uint32_t leaf;
uint32_t subleaf;
uint32_t flags;
uint32_t padding;
};
int32_t set_vcpuid_entries(struct acrn_vm *vm);
void guest_cpuid(struct acrn_vcpu *vcpu,
uint32_t *eax, uint32_t *ebx,

View File

@ -31,6 +31,8 @@
#define VLAPIC_H
#include <page.h>
#include <timer.h>
#include <apicreg.h>
/**

View File

@ -13,9 +13,18 @@
#ifndef ASSEMBLER
#include <types.h>
#include <spinlock.h>
#include <acrn_common.h>
#include <bsp_extern.h>
#include <vcpu.h>
#include <vioapic.h>
#include <vpic.h>
#include <io_emul.h>
#include <vuart.h>
#include <trusty.h>
#include <vcpuid.h>
#include <vpci.h>
#include <page.h>
#include <cpu_caps.h>
#include <e820.h>
@ -75,14 +84,6 @@ struct vm_pm_info {
/* VM guest types */
#define VM_LINUX_GUEST 0x02
#define VM_MONO_GUEST 0x01
enum vpic_wire_mode {
VPIC_WIRE_INTR = 0,
VPIC_WIRE_LAPIC,
VPIC_WIRE_IOAPIC,
VPIC_WIRE_NULL
};
/* Enumerated type for VM states */
enum vm_state {
VM_STATE_UNKNOWN = 0,
@ -115,20 +116,6 @@ struct vm_arch {
/* reference to virtual platform to come here (as needed) */
} __aligned(PAGE_SIZE);
#define CPUID_CHECK_SUBLEAF (1U << 0U)
#define MAX_VM_VCPUID_ENTRIES 64U
struct vcpuid_entry {
uint32_t eax;
uint32_t ebx;
uint32_t ecx;
uint32_t edx;
uint32_t leaf;
uint32_t subleaf;
uint32_t flags;
uint32_t padding;
};
struct acrn_vm {
struct vm_arch arch_vm; /* Reference to this VM's arch information */
struct vm_hw_info hw; /* Reference to this VM's HW information */

View File

@ -11,6 +11,7 @@
#define VM_FAIL -1
#ifndef ASSEMBLER
#include <vmx.h>
#define VMX_VMENTRY_FAIL 0x80000000U

View File

@ -30,7 +30,6 @@
#include <vioapic.h>
#include <vm.h>
#include <cpuid.h>
#include <vcpuid.h>
#include <page.h>
#include <ept.h>
#include <mmu.h>

View File

@ -53,6 +53,7 @@
/* IA32E Paging constants */
#define IA32E_REF_MASK ((get_cpu_info())->physical_address_mask)
struct acrn_vcpu;
static inline uint64_t round_page_up(uint64_t addr)
{
return (((addr + (uint64_t)PAGE_SIZE) - 1UL) & PAGE_MASK);

View File

@ -7,6 +7,8 @@
#ifndef TIMER_H
#define TIMER_H
#include <list.h>
/**
* @brief Timer
*

View File

@ -6,6 +6,7 @@
#ifndef VTD_H
#define VTD_H
#include <ptdev.h>
/*
* Intel IOMMU register specification per version 1.0 public spec.
*/

View File

@ -38,6 +38,7 @@
*/
#include <apicreg.h>
#include <util.h>
#define VIOAPIC_BASE 0xFEC00000UL
#define VIOAPIC_SIZE 4096UL

View File

@ -95,6 +95,13 @@
#define NR_VPIC_PINS_PER_CHIP 8U
#define NR_VPIC_PINS_TOTAL 16U
enum vpic_wire_mode {
VPIC_WIRE_INTR = 0,
VPIC_WIRE_LAPIC,
VPIC_WIRE_IOAPIC,
VPIC_WIRE_NULL
};
enum vpic_trigger {
EDGE_TRIGGER,
LEVEL_TRIGGER