mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-04 10:25:00 +00:00
hv: MSRs may need isolation between normal and secure world
- implement unified APIs to access guest_msrs[] under struct acrn_vcpu. - use these new APIs to read/write emulated TSC_DEADLINE MSR - switch world_msrs[] and guest_msrs[] during world switch for MSRs that need world isolation - remove the old guest_msrs[] array and it's index macros. Tracked-On: #1867 Signed-off-by: Zide Chen <zide.chen@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
@@ -28,15 +28,6 @@
|
||||
(idx)++, vcpu = &(vm->hw.vcpu_array[(idx)])) \
|
||||
if (vcpu->state != VCPU_OFFLINE)
|
||||
|
||||
/* the index is matched with emulated msrs array*/
|
||||
#define IDX_TSC_DEADLINE 0U
|
||||
#define IDX_BIOS_UPDT_TRIG (IDX_TSC_DEADLINE + 1U)
|
||||
#define IDX_BIOS_SIGN_ID (IDX_BIOS_UPDT_TRIG + 1U)
|
||||
#define IDX_TSC (IDX_BIOS_SIGN_ID + 1U)
|
||||
#define IDX_PAT (IDX_TSC + 1U)
|
||||
#define IDX_APIC_BASE (IDX_PAT + 1U)
|
||||
#define IDX_MAX_MSR (IDX_APIC_BASE + 1U)
|
||||
|
||||
/*
|
||||
* VCPU related APIs
|
||||
*/
|
||||
@@ -139,6 +130,8 @@ int rdmsr_vmexit_handler(struct acrn_vcpu *vcpu);
|
||||
int wrmsr_vmexit_handler(struct acrn_vcpu *vcpu);
|
||||
void init_msr_emulation(struct acrn_vcpu *vcpu);
|
||||
|
||||
uint32_t vmsr_get_guest_msr_index(uint32_t msr);
|
||||
|
||||
struct run_context;
|
||||
int vmx_vmrun(struct run_context *context, int ops, int ibrs);
|
||||
|
||||
|
@@ -268,7 +268,6 @@ struct acrn_vcpu {
|
||||
|
||||
struct io_request req; /* used by io/ept emulation */
|
||||
|
||||
uint64_t guest_msrs[IDX_MAX_MSR];
|
||||
#ifdef CONFIG_MTRR_ENABLED
|
||||
struct mtrr_state mtrr;
|
||||
#endif /* CONFIG_MTRR_ENABLED */
|
||||
@@ -474,6 +473,30 @@ void vcpu_set_cr4(struct acrn_vcpu *vcpu, uint64_t val);
|
||||
uint64_t vcpu_get_pat_ext(const struct acrn_vcpu *vcpu);
|
||||
void vcpu_set_pat_ext(struct acrn_vcpu *vcpu, uint64_t val);
|
||||
|
||||
/**
|
||||
* @brief get guest emulated MSR
|
||||
*
|
||||
* Get the content of emulated guest MSR
|
||||
*
|
||||
* @param[in] vcpu pointer to vcpu data structure
|
||||
* @param[in] msr the guest MSR
|
||||
*
|
||||
* @return the value of emulated MSR.
|
||||
*/
|
||||
uint64_t vcpu_get_guest_msr(const struct acrn_vcpu *vcpu, uint32_t msr);
|
||||
|
||||
/**
|
||||
* @brief set guest emulated MSR
|
||||
*
|
||||
* Update the content of emulated guest MSR
|
||||
*
|
||||
* @param[in] vcpu pointer to vcpu data structure
|
||||
* @param[in] msr the guest MSR
|
||||
* @param[in] val the value to set the target MSR
|
||||
*
|
||||
*/
|
||||
void vcpu_set_guest_msr(struct acrn_vcpu *vcpu, uint32_t msr, uint64_t val);
|
||||
|
||||
/**
|
||||
* @brief set all the vcpu registers
|
||||
*
|
||||
|
Reference in New Issue
Block a user