x86: Export some definition of MTRR
For KVM can reuse the type define, and need them to support shadow MTRR. Signed-off-by: Sheng Yang <sheng@linux.intel.com> Signed-off-by: Avi Kivity <avi@redhat.com>
This commit is contained in:
@@ -57,6 +57,31 @@ struct mtrr_gentry {
|
|||||||
};
|
};
|
||||||
#endif /* !__i386__ */
|
#endif /* !__i386__ */
|
||||||
|
|
||||||
|
struct mtrr_var_range {
|
||||||
|
u32 base_lo;
|
||||||
|
u32 base_hi;
|
||||||
|
u32 mask_lo;
|
||||||
|
u32 mask_hi;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* In the Intel processor's MTRR interface, the MTRR type is always held in
|
||||||
|
an 8 bit field: */
|
||||||
|
typedef u8 mtrr_type;
|
||||||
|
|
||||||
|
#define MTRR_NUM_FIXED_RANGES 88
|
||||||
|
#define MTRR_MAX_VAR_RANGES 256
|
||||||
|
|
||||||
|
struct mtrr_state_type {
|
||||||
|
struct mtrr_var_range var_ranges[MTRR_MAX_VAR_RANGES];
|
||||||
|
mtrr_type fixed_ranges[MTRR_NUM_FIXED_RANGES];
|
||||||
|
unsigned char enabled;
|
||||||
|
unsigned char have_fixed;
|
||||||
|
mtrr_type def_type;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define MTRRphysBase_MSR(reg) (0x200 + 2 * (reg))
|
||||||
|
#define MTRRphysMask_MSR(reg) (0x200 + 2 * (reg) + 1)
|
||||||
|
|
||||||
/* These are the various ioctls */
|
/* These are the various ioctls */
|
||||||
#define MTRRIOC_ADD_ENTRY _IOW(MTRR_IOCTL_BASE, 0, struct mtrr_sentry)
|
#define MTRRIOC_ADD_ENTRY _IOW(MTRR_IOCTL_BASE, 0, struct mtrr_sentry)
|
||||||
#define MTRRIOC_SET_ENTRY _IOW(MTRR_IOCTL_BASE, 1, struct mtrr_sentry)
|
#define MTRRIOC_SET_ENTRY _IOW(MTRR_IOCTL_BASE, 1, struct mtrr_sentry)
|
||||||
|
@@ -14,14 +14,6 @@
|
|||||||
#include <asm/pat.h>
|
#include <asm/pat.h>
|
||||||
#include "mtrr.h"
|
#include "mtrr.h"
|
||||||
|
|
||||||
struct mtrr_state_type {
|
|
||||||
struct mtrr_var_range var_ranges[MTRR_MAX_VAR_RANGES];
|
|
||||||
mtrr_type fixed_ranges[MTRR_NUM_FIXED_RANGES];
|
|
||||||
unsigned char enabled;
|
|
||||||
unsigned char have_fixed;
|
|
||||||
mtrr_type def_type;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct fixed_range_block {
|
struct fixed_range_block {
|
||||||
int base_msr; /* start address of an MTRR block */
|
int base_msr; /* start address of an MTRR block */
|
||||||
int ranges; /* number of MTRRs in this block */
|
int ranges; /* number of MTRRs in this block */
|
||||||
@@ -35,10 +27,12 @@ static struct fixed_range_block fixed_range_blocks[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static unsigned long smp_changes_mask;
|
static unsigned long smp_changes_mask;
|
||||||
static struct mtrr_state_type mtrr_state = {};
|
|
||||||
static int mtrr_state_set;
|
static int mtrr_state_set;
|
||||||
u64 mtrr_tom2;
|
u64 mtrr_tom2;
|
||||||
|
|
||||||
|
struct mtrr_state_type mtrr_state = {};
|
||||||
|
EXPORT_SYMBOL_GPL(mtrr_state);
|
||||||
|
|
||||||
#undef MODULE_PARAM_PREFIX
|
#undef MODULE_PARAM_PREFIX
|
||||||
#define MODULE_PARAM_PREFIX "mtrr."
|
#define MODULE_PARAM_PREFIX "mtrr."
|
||||||
|
|
||||||
|
@@ -8,12 +8,6 @@
|
|||||||
#define MTRRcap_MSR 0x0fe
|
#define MTRRcap_MSR 0x0fe
|
||||||
#define MTRRdefType_MSR 0x2ff
|
#define MTRRdefType_MSR 0x2ff
|
||||||
|
|
||||||
#define MTRRphysBase_MSR(reg) (0x200 + 2 * (reg))
|
|
||||||
#define MTRRphysMask_MSR(reg) (0x200 + 2 * (reg) + 1)
|
|
||||||
|
|
||||||
#define MTRR_NUM_FIXED_RANGES 88
|
|
||||||
#define MTRR_MAX_VAR_RANGES 256
|
|
||||||
|
|
||||||
#define MTRRfix64K_00000_MSR 0x250
|
#define MTRRfix64K_00000_MSR 0x250
|
||||||
#define MTRRfix16K_80000_MSR 0x258
|
#define MTRRfix16K_80000_MSR 0x258
|
||||||
#define MTRRfix16K_A0000_MSR 0x259
|
#define MTRRfix16K_A0000_MSR 0x259
|
||||||
@@ -30,10 +24,6 @@
|
|||||||
#define MTRR_CHANGE_MASK_VARIABLE 0x02
|
#define MTRR_CHANGE_MASK_VARIABLE 0x02
|
||||||
#define MTRR_CHANGE_MASK_DEFTYPE 0x04
|
#define MTRR_CHANGE_MASK_DEFTYPE 0x04
|
||||||
|
|
||||||
/* In the Intel processor's MTRR interface, the MTRR type is always held in
|
|
||||||
an 8 bit field: */
|
|
||||||
typedef u8 mtrr_type;
|
|
||||||
|
|
||||||
extern unsigned int mtrr_usage_table[MTRR_MAX_VAR_RANGES];
|
extern unsigned int mtrr_usage_table[MTRR_MAX_VAR_RANGES];
|
||||||
|
|
||||||
struct mtrr_ops {
|
struct mtrr_ops {
|
||||||
@@ -71,13 +61,6 @@ struct set_mtrr_context {
|
|||||||
u32 ccr3;
|
u32 ccr3;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct mtrr_var_range {
|
|
||||||
u32 base_lo;
|
|
||||||
u32 base_hi;
|
|
||||||
u32 mask_lo;
|
|
||||||
u32 mask_hi;
|
|
||||||
};
|
|
||||||
|
|
||||||
void set_mtrr_done(struct set_mtrr_context *ctxt);
|
void set_mtrr_done(struct set_mtrr_context *ctxt);
|
||||||
void set_mtrr_cache_disable(struct set_mtrr_context *ctxt);
|
void set_mtrr_cache_disable(struct set_mtrr_context *ctxt);
|
||||||
void set_mtrr_prepare_save(struct set_mtrr_context *ctxt);
|
void set_mtrr_prepare_save(struct set_mtrr_context *ctxt);
|
||||||
|
Reference in New Issue
Block a user