modularization: clean up namings in vMTRR module

- rename 3 module interface APIs
  init_mtrr() -> init_vmtrr()
  mtrr_rdmsr -> read_vmtrr()
  mtrr_wrmsr() -> write_vmtrr()

- follow naming convention for other modules, rename struct mtrr_state
  to struct acrn_vmtrr. And add acrn_vcpu to it.

- because MTRR is x86 architecture specific, move struct acrn_vmtrr to
  struct acrn_vcpu_arch.

Tracked-on: #1842
Signed-off-by: Zide Chen <zide.chen@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Zide Chen
2018-12-06 11:05:25 -08:00
committed by wenlingz
parent 6bbd0129c3
commit c89d6e6526
6 changed files with 58 additions and 50 deletions

View File

@@ -204,6 +204,11 @@ struct acrn_vcpu_arch {
uint8_t vmcs[PAGE_SIZE];
/* per vcpu lapic */
struct acrn_vlapic vlapic;
#ifdef CONFIG_MTRR_ENABLED
struct acrn_vmtrr vmtrr;
#endif
int32_t cur_context;
struct cpu_context contexts[NR_WORLD];
@@ -267,9 +272,6 @@ struct acrn_vcpu {
struct io_request req; /* used by io/ept emulation */
#ifdef CONFIG_MTRR_ENABLED
struct mtrr_state mtrr;
#endif /* CONFIG_MTRR_ENABLED */
uint64_t reg_cached;
uint64_t reg_updated;
} __aligned(PAGE_SIZE);

View File

@@ -47,8 +47,9 @@ union mtrr_fixed_range_reg {
uint8_t type[MTRR_SUB_RANGE_NUM];
};
struct mtrr_state {
union mtrr_cap_reg cap;
struct acrn_vmtrr {
struct acrn_vcpu *vcpu;
union mtrr_cap_reg cap;
union mtrr_def_type_reg def_type;
union mtrr_fixed_range_reg fixed_range[FIXED_RANGE_MTRR_NUM];
};
@@ -62,7 +63,7 @@ struct mtrr_state {
*
* @return None
*/
void mtrr_wrmsr(struct acrn_vcpu *vcpu, uint32_t msr, uint64_t value);
void write_vmtrr(struct acrn_vcpu *vcpu, uint32_t msr, uint64_t value);
/**
* @brief Virtual MTRR MSR read
*
@@ -71,7 +72,7 @@ void mtrr_wrmsr(struct acrn_vcpu *vcpu, uint32_t msr, uint64_t value);
*
* @return The specified virtual MTRR MSR value
*/
uint64_t mtrr_rdmsr(const struct acrn_vcpu *vcpu, uint32_t msr);
uint64_t read_vmtrr(const struct acrn_vcpu *vcpu, uint32_t msr);
/**
* @brief Virtual MTRR initialization
*
@@ -79,7 +80,7 @@ uint64_t mtrr_rdmsr(const struct acrn_vcpu *vcpu, uint32_t msr);
*
* @return None
*/
void init_mtrr(struct acrn_vcpu *vcpu);
void init_vmtrr(struct acrn_vcpu *vcpu);
/**
* @}
*/