debuggers.hg

view xen/include/asm-x86/mtrr.h @ 22855:1d1eec7e1fb4

xl: Perform minimal validation of virtual disk file while parsing config file

This patch performs some very basic validation on the virtual disk
file passed through the config file. This validation ensures that we
don't go too far with the initialization like spawn qemu and more
while there could be some potentially fundamental issues.

[ Patch fixed up to work with PHYSTYPE_EMPTY 22808:6ec61438713a -iwj ]

Signed-off-by: Kamala Narasimhan <kamala.narasimhan@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
author Kamala Narasimhan <kamala.narasimhan@gmail.com>
date Tue Jan 25 18:09:49 2011 +0000 (2011-01-25)
parents 9997a1418633
children
line source
1 #ifndef __ASM_X86_MTRR_H__
2 #define __ASM_X86_MTRR_H__
4 #include <xen/config.h>
5 #include <asm/mm.h>
7 /* These are the region types. They match the architectural specification. */
8 #define MTRR_TYPE_UNCACHABLE 0
9 #define MTRR_TYPE_WRCOMB 1
10 #define MTRR_TYPE_WRTHROUGH 4
11 #define MTRR_TYPE_WRPROT 5
12 #define MTRR_TYPE_WRBACK 6
13 #define MTRR_NUM_TYPES 7
14 #define MEMORY_NUM_TYPES MTRR_NUM_TYPES
15 #define NO_HARDCODE_MEM_TYPE MTRR_NUM_TYPES
17 #define NORMAL_CACHE_MODE 0
18 #define NO_FILL_CACHE_MODE 2
20 enum {
21 PAT_TYPE_UNCACHABLE=0,
22 PAT_TYPE_WRCOMB=1,
23 PAT_TYPE_RESERVED=2,
24 PAT_TYPE_WRTHROUGH=4,
25 PAT_TYPE_WRPROT=5,
26 PAT_TYPE_WRBACK=6,
27 PAT_TYPE_UC_MINUS=7,
28 PAT_TYPE_NUMS
29 };
31 #define INVALID_MEM_TYPE PAT_TYPE_NUMS
33 /* In the Intel processor's MTRR interface, the MTRR type is always held in
34 an 8 bit field: */
35 typedef u8 mtrr_type;
37 struct mtrr_var_range {
38 uint64_t base;
39 uint64_t mask;
40 };
42 #define NUM_FIXED_RANGES 88
43 #define NUM_FIXED_MSR 11
44 struct mtrr_state {
45 struct mtrr_var_range *var_ranges;
46 mtrr_type fixed_ranges[NUM_FIXED_RANGES];
47 unsigned char enabled;
48 unsigned char have_fixed;
49 mtrr_type def_type;
51 u64 mtrr_cap;
52 /* ranges in var MSRs are overlapped or not:0(no overlapped) */
53 bool_t overlapped;
54 };
56 extern void mtrr_save_fixed_ranges(void *);
57 extern void mtrr_save_state(void);
58 extern int mtrr_add(unsigned long base, unsigned long size,
59 unsigned int type, char increment);
60 extern int mtrr_add_page(unsigned long base, unsigned long size,
61 unsigned int type, char increment);
62 extern int mtrr_del(int reg, unsigned long base, unsigned long size);
63 extern int mtrr_del_page(int reg, unsigned long base, unsigned long size);
64 extern void mtrr_centaur_report_mcr(int mcr, u32 lo, u32 hi);
65 extern u32 get_pat_flags(struct vcpu *v, u32 gl1e_flags, paddr_t gpaddr,
66 paddr_t spaddr, uint8_t gmtrr_mtype);
67 extern uint8_t epte_get_entry_emt(struct domain *d, unsigned long gfn,
68 mfn_t mfn, uint8_t *ipat, bool_t direct_mmio);
69 extern void ept_change_entry_emt_with_range(
70 struct domain *d, unsigned long start_gfn, unsigned long end_gfn);
71 extern unsigned char pat_type_2_pte_flags(unsigned char pat_type);
72 extern int hold_mtrr_updates_on_aps;
73 extern void mtrr_aps_sync_begin(void);
74 extern void mtrr_aps_sync_end(void);
75 extern void mtrr_bp_restore(void);
77 extern bool_t mtrr_var_range_msr_set(
78 struct domain *d, struct mtrr_state *m,
79 uint32_t msr, uint64_t msr_content);
80 extern bool_t mtrr_fix_range_msr_set(struct mtrr_state *v,
81 uint32_t row, uint64_t msr_content);
82 extern bool_t mtrr_def_type_msr_set(struct mtrr_state *v, uint64_t msr_content);
83 extern bool_t pat_msr_set(uint64_t *pat, uint64_t msr);
85 bool_t is_var_mtrr_overlapped(struct mtrr_state *m);
86 bool_t mtrr_pat_not_equal(struct vcpu *vd, struct vcpu *vs);
88 #endif /* __ASM_X86_MTRR_H__ */