hv: fix a bug about host/guest msr store/load

Unify the handling of host/guest MSR area in VMCS. Remove the emum value
as the element index when there are a few of MSRs in host/guest area.
Because the index could be changed if one element not used. So, use a
variable to save the index which will be used.

Tracked-On: #6966
Acked-by: Eddie Dong <eddie.dong@intel.com>
Signed-off-by: Minggui Cao <minggui.cao@intel.com>
This commit is contained in:
Minggui Cao
2022-03-15 22:19:26 +08:00
committed by acrnsi-robot
parent 9be4a282c4
commit 05ca1d7641
3 changed files with 16 additions and 16 deletions

View File

@@ -212,15 +212,12 @@ struct msr_store_entry {
uint64_t value;
} __aligned(16);
enum {
MSR_AREA_IA32_PQR_ASSOC = 0,
MSR_AREA_PERF_CTRL,
MSR_AREA_COUNT,
};
#define MSR_AREA_COUNT 2 /* the max MSRs in auto load/store area */
struct msr_store_area {
struct msr_store_entry guest[MSR_AREA_COUNT];
struct msr_store_entry host[MSR_AREA_COUNT];
uint32_t index_of_pqr_assoc;
uint32_t count; /* actual count of entries to be loaded/restored during VMEntry/VMExit */
};