ia64/xen-unstable

view xen/include/asm-ia64/vhpt.h @ 16817:564fa97594a6

[IA64] Introduce dom0_vhpt_size_log2 boot option to change dom0 vhpt size

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
author Alex Williamson <alex.williamson@hp.com>
date Tue Jan 22 08:26:20 2008 -0700 (2008-01-22)
parents 3ad0080ad9b5
children f23e7e07bf1d
line source
1 #ifndef ASM_VHPT_H
2 #define ASM_VHPT_H
4 #define VHPT_ENABLED 1
6 /* Size of the VHPT. */
7 // XXX work around to avoid trigerring xenLinux software lock up detection.
8 # define VHPT_SIZE_LOG2 16 // 64KB
10 /* Number of entries in the VHPT. The size of an entry is 4*8B == 32B */
11 #define VHPT_NUM_ENTRIES (1 << (VHPT_SIZE_LOG2 - 5))
13 // FIXME: These should be automatically generated
14 #define VLE_PGFLAGS_OFFSET 0
15 #define VLE_ITIR_OFFSET 8
16 #define VLE_TITAG_OFFSET 16
17 #define VLE_CCHAIN_OFFSET 24
19 #ifndef __ASSEMBLY__
20 #include <xen/percpu.h>
21 #include <asm/vcpumask.h>
23 extern void domain_purge_swtc_entries(struct domain *d);
24 extern void domain_purge_swtc_entries_vcpu_dirty_mask(struct domain* d, vcpumask_t vcpu_dirty_mask);
26 //
27 // VHPT Long Format Entry (as recognized by hw)
28 //
29 struct vhpt_lf_entry {
30 unsigned long page_flags;
31 unsigned long itir;
32 unsigned long ti_tag;
33 unsigned long CChain;
34 };
36 #define INVALID_TI_TAG 0x8000000000000000L
38 extern void vhpt_init (void);
39 extern void gather_vhpt_stats(void);
40 extern void vhpt_multiple_insert(unsigned long vaddr, unsigned long pte,
41 unsigned long itir);
42 extern void vhpt_insert (unsigned long vadr, unsigned long pte,
43 unsigned long itir);
44 void local_vhpt_flush(void);
45 extern void vcpu_vhpt_flush(struct vcpu* v);
47 /* Currently the VHPT is allocated per CPU. */
48 DECLARE_PER_CPU (unsigned long, vhpt_paddr);
49 DECLARE_PER_CPU (unsigned long, vhpt_pend);
51 #ifdef CONFIG_XEN_IA64_PERVCPU_VHPT
52 #if !VHPT_ENABLED
53 #error "VHPT_ENABLED must be set for CONFIG_XEN_IA64_PERVCPU_VHPT"
54 #endif
55 #endif
57 #include <xen/sched.h>
58 #ifdef CONFIG_XEN_IA64_PERVCPU_VHPT
59 void domain_set_vhpt_size(struct domain *d, int8_t vhpt_size_log2);
60 int pervcpu_vhpt_alloc(struct vcpu *v);
61 void pervcpu_vhpt_free(struct vcpu *v);
62 #else
63 #define domain_set_vhpt_size(d, vhpt_size_log2) do { } while (0)
64 #define pervcpu_vhpt_alloc(v) (0)
65 #define pervcpu_vhpt_free(v) do { } while (0)
66 #endif
68 static inline unsigned long
69 vcpu_vhpt_maddr(struct vcpu* v)
70 {
71 #ifdef CONFIG_XEN_IA64_PERVCPU_VHPT
72 if (HAS_PERVCPU_VHPT(v->domain))
73 return v->arch.vhpt_maddr;
74 #endif
76 #if 0
77 // referencecing v->processor is racy.
78 return per_cpu(vhpt_paddr, v->processor);
79 #endif
80 BUG_ON(v != current);
81 return __get_cpu_var(vhpt_paddr);
82 }
84 static inline unsigned long
85 vcpu_pta(struct vcpu* v)
86 {
87 #ifdef CONFIG_XEN_IA64_PERVCPU_VHPT
88 if (HAS_PERVCPU_VHPT(v->domain))
89 return v->arch.pta.val;
90 #endif
91 return __va_ul(__get_cpu_var(vhpt_paddr)) | (1 << 8) |
92 (VHPT_SIZE_LOG2 << 2) | VHPT_ENABLED;
93 }
95 static inline int
96 canonicalize_vhpt_size(int sz)
97 {
98 /* minimum 32KB */
99 if (sz < 15)
100 return 15;
101 /* maximum 8MB (since purging TR is hard coded) */
102 if (sz > IA64_GRANULE_SHIFT - 1)
103 return IA64_GRANULE_SHIFT - 1;
104 return sz;
105 }
108 #endif /* !__ASSEMBLY */
109 #endif