ia64/xen-unstable

view xen/include/asm-x86/domain.h @ 12813:963a02c040f6

[XEN] remove unused monitor_vtable mapping.
Signed-off-by: Tim Deegan <Tim.Deegan@xensource.com>
author Tim Deegan <Tim.Deegan@xensource.com>
date Wed Dec 06 12:13:22 2006 +0000 (2006-12-06)
parents 5c82a274733e
children df5fa63490f4
line source
1 #ifndef __ASM_DOMAIN_H__
2 #define __ASM_DOMAIN_H__
4 #include <xen/config.h>
5 #include <xen/mm.h>
6 #include <asm/hvm/vcpu.h>
7 #include <asm/hvm/domain.h>
9 struct trap_bounce {
10 unsigned long error_code;
11 unsigned short flags; /* TBF_ */
12 unsigned short cs;
13 unsigned long eip;
14 };
16 #define MAPHASH_ENTRIES 8
17 #define MAPHASH_HASHFN(pfn) ((pfn) & (MAPHASH_ENTRIES-1))
18 #define MAPHASHENT_NOTINUSE ((u16)~0U)
19 struct vcpu_maphash {
20 struct vcpu_maphash_entry {
21 unsigned long mfn;
22 uint16_t idx;
23 uint16_t refcnt;
24 } hash[MAPHASH_ENTRIES];
25 } __cacheline_aligned;
27 #define MAPCACHE_ORDER 10
28 #define MAPCACHE_ENTRIES (1 << MAPCACHE_ORDER)
29 struct mapcache {
30 /* The PTEs that provide the mappings, and a cursor into the array. */
31 l1_pgentry_t *l1tab;
32 unsigned int cursor;
34 /* Protects map_domain_page(). */
35 spinlock_t lock;
37 /* Garbage mappings are flushed from TLBs in batches called 'epochs'. */
38 unsigned int epoch, shadow_epoch[MAX_VIRT_CPUS];
39 u32 tlbflush_timestamp;
41 /* Which mappings are in use, and which are garbage to reap next epoch? */
42 unsigned long inuse[BITS_TO_LONGS(MAPCACHE_ENTRIES)];
43 unsigned long garbage[BITS_TO_LONGS(MAPCACHE_ENTRIES)];
45 /* Lock-free per-VCPU hash of recently-used mappings. */
46 struct vcpu_maphash vcpu_maphash[MAX_VIRT_CPUS];
47 };
49 extern void mapcache_init(struct domain *);
51 /* x86/64: toggle guest between kernel and user modes. */
52 extern void toggle_guest_mode(struct vcpu *);
54 /*
55 * Initialise a hypercall-transfer page. The given pointer must be mapped
56 * in Xen virtual address space (accesses are not validated or checked).
57 */
58 extern void hypercall_page_initialise(struct domain *d, void *);
60 struct shadow_domain {
61 u32 mode; /* flags to control shadow operation */
62 spinlock_t lock; /* shadow domain lock */
63 int locker; /* processor which holds the lock */
64 const char *locker_function; /* Func that took it */
65 struct list_head freelists[SHADOW_MAX_ORDER + 1];
66 struct list_head p2m_freelist;
67 struct list_head p2m_inuse;
68 struct list_head pinned_shadows;
69 unsigned int total_pages; /* number of pages allocated */
70 unsigned int free_pages; /* number of pages on freelists */
71 unsigned int p2m_pages; /* number of pages in p2m map */
72 unsigned int opt_flags; /* runtime tunable optimizations on/off */
74 /* Shadow hashtable */
75 struct shadow_page_info **hash_table;
76 int hash_walking; /* Some function is walking the hash table */
78 /* Shadow log-dirty bitmap */
79 unsigned long *dirty_bitmap;
80 unsigned int dirty_bitmap_size; /* in pages, bit per page */
82 /* Shadow log-dirty mode stats */
83 unsigned int fault_count;
84 unsigned int dirty_count;
85 };
87 struct arch_domain
88 {
89 l1_pgentry_t *mm_perdomain_pt;
90 #ifdef CONFIG_X86_64
91 l2_pgentry_t *mm_perdomain_l2;
92 l3_pgentry_t *mm_perdomain_l3;
93 #endif
95 #ifdef CONFIG_X86_32
96 /* map_domain_page() mapping cache. */
97 struct mapcache mapcache;
98 #endif
100 /* I/O-port admin-specified access capabilities. */
101 struct rangeset *ioport_caps;
103 /* HVM stuff */
104 struct hvm_domain hvm_domain;
106 /* Shadow-translated guest: Pseudophys base address of reserved area. */
107 unsigned long first_reserved_pfn;
109 struct shadow_domain shadow;
111 /* Shadow translated domain: P2M mapping */
112 pagetable_t phys_table;
113 /* Highest guest frame that's ever been mapped in the p2m */
114 unsigned long max_mapped_pfn;
116 } __cacheline_aligned;
118 #ifdef CONFIG_X86_PAE
119 struct pae_l3_cache {
120 /*
121 * Two low-memory (<4GB) PAE L3 tables, used as fallback when the guest
122 * supplies a >=4GB PAE L3 table. We need two because we cannot set up
123 * an L3 table while we are currently running on it (without using
124 * expensive atomic 64-bit operations).
125 */
126 l3_pgentry_t table[2][4] __attribute__((__aligned__(32)));
127 unsigned long high_mfn; /* The >=4GB MFN being shadowed. */
128 unsigned int inuse_idx; /* Which of the two cache slots is in use? */
129 spinlock_t lock;
130 };
131 #define pae_l3_cache_init(c) spin_lock_init(&(c)->lock)
132 #else /* !CONFIG_X86_PAE */
133 struct pae_l3_cache { };
134 #define pae_l3_cache_init(c) ((void)0)
135 #endif
137 struct shadow_vcpu {
138 #if CONFIG_PAGING_LEVELS >= 3
139 /* PAE guests: per-vcpu shadow top-level table */
140 l3_pgentry_t l3table[4] __attribute__((__aligned__(32)));
141 #endif
142 /* Pointers to mode-specific entry points. */
143 struct shadow_paging_mode *mode;
144 /* Last MFN that we emulated a write to. */
145 unsigned long last_emulated_mfn;
146 /* MFN of the last shadow that we shot a writeable mapping in */
147 unsigned long last_writeable_pte_smfn;
148 /* HVM guest: paging enabled (CR0.PG)? */
149 unsigned int translate_enabled:1;
150 };
152 struct arch_vcpu
153 {
154 /* Needs 16-byte aligment for FXSAVE/FXRSTOR. */
155 struct vcpu_guest_context guest_context
156 __attribute__((__aligned__(16)));
158 struct pae_l3_cache pae_l3_cache;
160 unsigned long flags; /* TF_ */
162 void (*schedule_tail) (struct vcpu *);
164 void (*ctxt_switch_from) (struct vcpu *);
165 void (*ctxt_switch_to) (struct vcpu *);
167 /* Bounce information for propagating an exception to guest OS. */
168 struct trap_bounce trap_bounce;
170 /* I/O-port access bitmap. */
171 XEN_GUEST_HANDLE(uint8_t) iobmp; /* Guest kernel virtual address of the bitmap. */
172 int iobmp_limit; /* Number of ports represented in the bitmap. */
173 int iopl; /* Current IOPL for this VCPU. */
175 #ifdef CONFIG_X86_32
176 struct desc_struct int80_desc;
177 #endif
179 /* Virtual Machine Extensions */
180 struct hvm_vcpu hvm_vcpu;
182 /*
183 * Every domain has a L1 pagetable of its own. Per-domain mappings
184 * are put in this table (eg. the current GDT is mapped here).
185 */
186 l1_pgentry_t *perdomain_ptes;
188 #ifdef CONFIG_X86_64
189 pagetable_t guest_table_user; /* (MFN) x86/64 user-space pagetable */
190 #endif
191 pagetable_t guest_table; /* (MFN) guest notion of cr3 */
192 /* guest_table holds a ref to the page, and also a type-count unless
193 * shadow refcounts are in use */
194 pagetable_t shadow_table[4]; /* (MFN) shadow(s) of guest */
195 pagetable_t monitor_table; /* (MFN) hypervisor PT (for HVM) */
196 unsigned long cr3; /* (MA) value to install in HW CR3 */
198 void *guest_vtable; /* virtual addr of pagetable */
200 /* Current LDT details. */
201 unsigned long shadow_ldt_mapcnt;
203 struct shadow_vcpu shadow;
204 } __cacheline_aligned;
206 /* shorthands to improve code legibility */
207 #define hvm_vmx hvm_vcpu.u.vmx
208 #define hvm_svm hvm_vcpu.u.svm
210 #endif /* __ASM_DOMAIN_H__ */
212 /*
213 * Local variables:
214 * mode: C
215 * c-set-style: "BSD"
216 * c-basic-offset: 4
217 * tab-width: 4
218 * indent-tabs-mode: nil
219 * End:
220 */