ia64/xen-unstable

view xen/include/asm-ia64/domain.h @ 10816:7be1cfe8345b

[IA64] iomem support for driver domains.

First steps in hypevisor to support driver domains.

IO ports capabilities added (not yet used).
IO mem capabilities checked.
ASSIGN_nocache flag added.
Memory attributes checked.

Signed-off-by: Tristan Gingold <tristan.gingold@bull.net>
author awilliam@xenbuild.aw
date Thu Jul 27 09:47:10 2006 -0600 (2006-07-27)
parents 86e5d8458c08
children 199d53efd029
line source
1 #ifndef __ASM_DOMAIN_H__
2 #define __ASM_DOMAIN_H__
4 #include <linux/thread_info.h>
5 #include <asm/tlb.h>
6 #include <asm/vmx_vpd.h>
7 #include <asm/vmmu.h>
8 #include <asm/regionreg.h>
9 #include <public/arch-ia64.h>
10 #include <asm/vmx_platform.h>
11 #include <xen/list.h>
12 #include <xen/cpumask.h>
13 #include <asm/fpswa.h>
14 #include <xen/rangeset.h>
16 struct p2m_entry {
17 volatile pte_t* pte;
18 pte_t used;
19 };
21 static inline void
22 p2m_entry_set(struct p2m_entry* entry, volatile pte_t* pte, pte_t used)
23 {
24 entry->pte = pte;
25 entry->used = used;
26 }
28 static inline int
29 p2m_entry_retry(struct p2m_entry* entry)
30 {
31 //XXX see lookup_domain_pte().
32 // NULL is set for invalid gpaddr for the time being.
33 if (entry->pte == NULL)
34 return 0;
36 return (pte_val(*entry->pte) != pte_val(entry->used));
37 }
39 extern void domain_relinquish_resources(struct domain *);
41 /* given a current domain metaphysical address, return the physical address */
42 extern unsigned long translate_domain_mpaddr(unsigned long mpaddr,
43 struct p2m_entry* entry);
45 /* Set shared_info virtual address. */
46 extern unsigned long domain_set_shared_info_va (unsigned long va);
48 /* Flush cache of domain d.
49 If sync_only is true, only synchronize I&D caches,
50 if false, flush and invalidate caches. */
51 extern void domain_cache_flush (struct domain *d, int sync_only);
53 /* Control the shadow mode. */
54 extern int shadow_mode_control(struct domain *d, dom0_shadow_control_t *sc);
56 /* Cleanly crash the current domain with a message. */
57 extern void panic_domain(struct pt_regs *, const char *, ...)
58 __attribute__ ((noreturn, format (printf, 2, 3)));
60 struct mm_struct {
61 pgd_t * pgd;
62 // atomic_t mm_users; /* How many users with user space? */
63 };
65 struct last_vcpu {
66 #define INVALID_VCPU_ID INT_MAX
67 int vcpu_id;
68 } ____cacheline_aligned_in_smp;
70 /* These are data in domain memory for SAL emulator. */
71 struct xen_sal_data {
72 /* OS boot rendez vous. */
73 unsigned long boot_rdv_ip;
74 unsigned long boot_rdv_r1;
76 /* There are these for EFI_SET_VIRTUAL_ADDRESS_MAP emulation. */
77 int efi_virt_mode; /* phys : 0 , virt : 1 */
78 };
80 struct arch_domain {
81 struct mm_struct mm;
83 /* Flags. */
84 union {
85 unsigned long flags;
86 struct {
87 unsigned int is_vti : 1;
88 };
89 };
91 /* Allowed accesses to io ports. */
92 struct rangeset *ioport_caps;
94 /* There are two ranges of RID for a domain:
95 one big range, used to virtualize domain RID,
96 one small range for internal Xen use (metaphysical). */
97 /* Big range. */
98 int starting_rid; /* first RID assigned to domain */
99 int ending_rid; /* one beyond highest RID assigned to domain */
100 /* Metaphysical range. */
101 int starting_mp_rid;
102 int ending_mp_rid;
103 /* RID for metaphysical mode. */
104 unsigned long metaphysical_rr0;
105 unsigned long metaphysical_rr4;
107 int rid_bits; /* number of virtual rid bits (default: 18) */
108 int breakimm; /* The imm value for hypercalls. */
110 struct virtual_platform_def vmx_platform;
111 #define hvm_domain vmx_platform /* platform defs are not vmx specific */
113 u64 xen_vastart;
114 u64 xen_vaend;
115 u64 shared_info_va;
117 /* Address of SAL emulator data */
118 struct xen_sal_data *sal_data;
119 /* SAL return point. */
120 unsigned long sal_return_addr;
122 /* Address of efi_runtime_services_t (placed in domain memory) */
123 void *efi_runtime;
124 /* Address of fpswa_interface_t (placed in domain memory) */
125 void *fpswa_inf;
127 /* Bitmap of shadow dirty bits.
128 Set iff shadow mode is enabled. */
129 u64 *shadow_bitmap;
130 /* Length (in bits!) of shadow bitmap. */
131 unsigned long shadow_bitmap_size;
132 /* Number of bits set in bitmap. */
133 atomic64_t shadow_dirty_count;
134 /* Number of faults. */
135 atomic64_t shadow_fault_count;
137 struct last_vcpu last_vcpu[NR_CPUS];
138 };
139 #define INT_ENABLE_OFFSET(v) \
140 (sizeof(vcpu_info_t) * (v)->vcpu_id + \
141 offsetof(vcpu_info_t, evtchn_upcall_mask))
143 struct arch_vcpu {
144 /* Save the state of vcpu.
145 This is the first entry to speed up accesses. */
146 mapped_regs_t *privregs;
148 /* TR and TC. */
149 TR_ENTRY itrs[NITRS];
150 TR_ENTRY dtrs[NDTRS];
151 TR_ENTRY itlb;
152 TR_ENTRY dtlb;
154 /* Bit is set if there is a tr/tc for the region. */
155 unsigned char itr_regions;
156 unsigned char dtr_regions;
157 unsigned char tc_regions;
159 unsigned long irr[4]; /* Interrupt request register. */
160 unsigned long insvc[4]; /* Interrupt in service. */
161 unsigned long iva;
162 unsigned long dcr;
163 unsigned long domain_itm;
164 unsigned long domain_itm_last;
166 unsigned long event_callback_ip; // event callback handler
167 unsigned long failsafe_callback_ip; // Do we need it?
169 /* These fields are copied from arch_domain to make access easier/faster
170 in assembly code. */
171 unsigned long metaphysical_rr0; // from arch_domain (so is pinned)
172 unsigned long metaphysical_rr4; // from arch_domain (so is pinned)
173 unsigned long metaphysical_saved_rr0; // from arch_domain (so is pinned)
174 unsigned long metaphysical_saved_rr4; // from arch_domain (so is pinned)
175 int breakimm; // from arch_domain (so is pinned)
176 int starting_rid; /* first RID assigned to domain */
177 int ending_rid; /* one beyond highest RID assigned to domain */
179 struct thread_struct _thread; // this must be last
181 thash_cb_t vtlb;
182 thash_cb_t vhpt;
183 char irq_new_pending;
184 char irq_new_condition; // vpsr.i/vtpr change, check for pending VHPI
185 char hypercall_continuation;
186 //for phycial emulation
187 unsigned long old_rsc;
188 int mode_flags;
189 fpswa_ret_t fpswa_ret; /* save return values of FPSWA emulation */
190 struct arch_vmx_struct arch_vmx; /* Virtual Machine Extensions */
192 #define INVALID_PROCESSOR INT_MAX
193 int last_processor;
194 };
196 #include <asm/uaccess.h> /* for KERNEL_DS */
197 #include <asm/pgtable.h>
199 #endif /* __ASM_DOMAIN_H__ */
201 /*
202 * Local variables:
203 * mode: C
204 * c-set-style: "BSD"
205 * c-basic-offset: 4
206 * tab-width: 4
207 * indent-tabs-mode: nil
208 * End:
209 */