mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-22 09:17:58 +00:00
hv: support minimum set of TLFS
This patch implements the minimum set of TLFS functionality. It includes 6 vCPUID leaves and 3 vMSRs. - 0x40000001 Hypervisor Vendor-Neutral Interface Identification - 0x40000002 Hypervisor System Identity - 0x40000003 Hypervisor Feature Identification - 0x40000004 Implementation Recommendations - 0x40000005 Hypervisor Implementation Limits - 0x40000006 Implementation Hardware Features - HV_X64_MSR_GUEST_OS_ID Reporting the guest OS identity - HV_X64_MSR_HYPERCALL Establishing the hypercall interface - HV_X64_MSR_VP_INDEX Retrieve the vCPU ID from hypervisor Tracked-On: #3832 Signed-off-by: wenwumax <wenwux.ma@intel.com> Signed-off-by: Jian Jun Chen <jian.jun.chen@intel.com> Acked-by: Anthony Xu <anthony.xu@intel.com>
This commit is contained in:
50
hypervisor/include/arch/x86/guest/hyperv.h
Normal file
50
hypervisor/include/arch/x86/guest/hyperv.h
Normal file
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef HYPERV_H
|
||||
#define HYPERV_H
|
||||
|
||||
#include <vcpuid.h>
|
||||
|
||||
/* Hyper-V MSR numbers */
|
||||
#define HV_X64_MSR_GUEST_OS_ID 0x40000000U
|
||||
#define HV_X64_MSR_HYPERCALL 0x40000001U
|
||||
#define HV_X64_MSR_VP_INDEX 0x40000002U
|
||||
|
||||
union hyperv_hypercall_msr {
|
||||
uint64_t val64;
|
||||
struct {
|
||||
uint64_t enabled:1;
|
||||
uint64_t locked:1;
|
||||
uint64_t rsvdp:10;
|
||||
uint64_t gpfn:52;
|
||||
};
|
||||
};
|
||||
|
||||
union hyperv_guest_os_id_msr {
|
||||
uint64_t val64;
|
||||
struct {
|
||||
uint64_t build_number:16;
|
||||
uint64_t service_version:8;
|
||||
uint64_t minor_version:8;
|
||||
uint64_t major_version:8;
|
||||
uint64_t os_id:8;
|
||||
uint64_t vendor_id:15;
|
||||
uint64_t os_type:1;
|
||||
};
|
||||
};
|
||||
|
||||
struct acrn_hyperv {
|
||||
union hyperv_hypercall_msr hypercall_page;
|
||||
union hyperv_guest_os_id_msr guest_os_id;
|
||||
};
|
||||
|
||||
int32_t hyperv_wrmsr(struct acrn_vcpu *vcpu, uint32_t msr, uint64_t wval);
|
||||
int32_t hyperv_rdmsr(struct acrn_vcpu *vcpu, uint32_t msr, uint64_t *rval);
|
||||
void hyperv_init_vcpuid_entry(uint32_t leaf, uint32_t subleaf, uint32_t flags,
|
||||
struct vcpuid_entry *entry);
|
||||
|
||||
#endif
|
@@ -26,6 +26,9 @@
|
||||
#include <cpu_caps.h>
|
||||
#include <e820.h>
|
||||
#include <vm_config.h>
|
||||
#ifdef CONFIG_HYPERV_ENABLED
|
||||
#include <hyperv.h>
|
||||
#endif
|
||||
|
||||
struct vm_hw_info {
|
||||
/* vcpu array of this VM */
|
||||
@@ -100,6 +103,9 @@ struct vm_arch {
|
||||
void *tmp_pg_array; /* Page array for tmp guest paging struct */
|
||||
struct acrn_vioapic vioapic; /* Virtual IOAPIC base address */
|
||||
struct acrn_vpic vpic; /* Virtual PIC */
|
||||
#ifdef CONFIG_HYPERV_ENABLED
|
||||
struct acrn_hyperv hyperv;
|
||||
#endif
|
||||
enum vm_vlapic_state vlapic_state; /* Represents vLAPIC state across vCPUs*/
|
||||
|
||||
/* reference to virtual platform to come here (as needed) */
|
||||
|
Reference in New Issue
Block a user