@@ -38,7 +38,7 @@ static const uint8_t pat_entry_2_pte_flags[8] = {
/* Effective mm type lookup table, according to MTRR and PAT. */
static const uint8_t mm_type_tbl[MTRR_NUM_TYPES][X86_NUM_MT] = {
-#define RS MEMORY_NUM_TYPES
+#define RS MTRR_NUM_TYPES
#define UC X86_MT_UC
#define WB X86_MT_WB
#define WC X86_MT_WC
@@ -66,9 +66,9 @@ static const uint8_t mm_type_tbl[MTRR_NUM_TYPES][X86_NUM_MT] = {
* Reverse lookup table, to find a pat type according to MTRR and effective
* memory type. This table is dynamically generated.
*/
-static uint8_t __read_mostly mtrr_epat_tbl[MTRR_NUM_TYPES][MEMORY_NUM_TYPES] =
- { [0 ... MTRR_NUM_TYPES-1] =
- { [0 ... MEMORY_NUM_TYPES-1] = INVALID_MEM_TYPE }
+static uint8_t __read_mostly mtrr_epat_tbl[MTRR_NUM_TYPES][MTRR_NUM_TYPES] =
+ { [0 ... MTRR_NUM_TYPES - 1] =
+ { [0 ... MTRR_NUM_TYPES - 1] = INVALID_MEM_TYPE }
};
/* Lookup table for PAT entry of a given PAT value in host PAT. */
@@ -85,7 +85,7 @@ static int __init cf_check hvm_mtrr_pat_init(void)
{
unsigned int tmp = mm_type_tbl[i][j];
- if ( tmp < MEMORY_NUM_TYPES )
+ if ( tmp < MTRR_NUM_TYPES )
mtrr_epat_tbl[i][tmp] = j;
}
}
@@ -317,11 +317,11 @@ static uint8_t effective_mm_type(struct mtrr_state *m,
uint8_t gmtrr_mtype)
{
uint8_t mtrr_mtype, pat_value;
-
+
/* if get_pat_flags() gives a dedicated MTRR type,
* just use it
- */
- if ( gmtrr_mtype == NO_HARDCODE_MEM_TYPE )
+ */
+ if ( gmtrr_mtype == MTRR_NUM_TYPES )
mtrr_mtype = mtrr_get_type(m, gpa, 0);
else
mtrr_mtype = gmtrr_mtype;
@@ -346,7 +346,7 @@ uint32_t get_pat_flags(struct vcpu *v,
/* 1. Get the effective memory type of guest physical address,
* with the pair of guest MTRR and PAT
*/
- guest_eff_mm_type = effective_mm_type(g, pat, gpaddr,
+ guest_eff_mm_type = effective_mm_type(g, pat, gpaddr,
gl1e_flags, gmtrr_mtype);
/* 2. Get the memory type of host physical address, with MTRR */
shadow_mtrr_type = mtrr_get_type(&mtrr_state, spaddr, 0);
@@ -4,8 +4,6 @@
#include <xen/mm.h>
#define MTRR_NUM_TYPES X86_MT_UCM
-#define MEMORY_NUM_TYPES MTRR_NUM_TYPES
-#define NO_HARDCODE_MEM_TYPE MTRR_NUM_TYPES
#define NORMAL_CACHE_MODE 0
#define NO_FILL_CACHE_MODE 2
@@ -578,7 +578,7 @@ _sh_propagate(struct vcpu *v,
gflags,
gfn_to_paddr(target_gfn),
mfn_to_maddr(target_mfn),
- NO_HARDCODE_MEM_TYPE);
+ MTRR_NUM_TYPES);
}
}
No functional change intended. Signed-off-by: Demi Marie Obenour <demi@invisiblethingslab.com> --- Changes since v2: - Keep MTRR_NUM_TYPES and adjust commit message accordingly --- xen/arch/x86/hvm/mtrr.c | 18 +++++++++--------- xen/arch/x86/include/asm/mtrr.h | 2 -- xen/arch/x86/mm/shadow/multi.c | 2 +- 3 files changed, 10 insertions(+), 12 deletions(-)