ia64/xen-unstable

view xen/include/asm-ia64/regionreg.h @ 18085:4f0428e4dd15

[IA64] kexec: Unpin shared_info, mapped_regs and VPD TR in ia64_do_tlb_purge

Unpinning shared_info, mapped_regs and VPD seems to be missing
from ia64_do_tlb_purge and seems to be needed for kexec.

Like VHPT, the pinned value is recored in a percpu variable
so that the correct value can be unpinned.

Cc: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Simon Horman <horms@verge.net.au>
author Isaku Yamahata <yamahata@valinux.co.jp>
date Tue Jul 22 12:15:02 2008 +0900 (2008-07-22)
parents 0b72d16e794b
children 34a84a5306f7
line source
2 #ifndef _REGIONREG_H_
3 #define _REGIONREG_H_
5 #define XEN_DEFAULT_RID 7
6 #define IA64_MIN_IMPL_RID_MSB 17
7 #define _REGION_ID(x) ({ia64_rr _v; _v.rrval = (long)(x); _v.rid;})
8 #define _REGION_PAGE_SIZE(x) ({ia64_rr _v; _v.rrval = (long)(x); _v.ps;})
9 #define _REGION_HW_WALKER(x) ({ia64_rr _v; _v.rrval = (long)(x); _v.ve;})
10 #define _MAKE_RR(r, sz, v) ({ia64_rr _v; _v.rrval=0; _v.rid=(r); \
11 _v.ps=(sz); _v.ve=(v); _v.rrval;})
13 typedef union ia64_rr {
14 struct {
15 unsigned long ve : 1; /* enable hw walker */
16 unsigned long reserved0 : 1; /* reserved */
17 unsigned long ps : 6; /* log page size */
18 unsigned long rid : 24; /* region id */
19 unsigned long reserved1 : 32; /* reserved */
20 };
21 unsigned long rrval;
22 } ia64_rr;
24 //
25 // region register macros
26 //
27 #define RR_TO_VE(arg) (((arg) >> 0) & 0x0000000000000001)
28 #define RR_VE(arg) (((arg) & 0x0000000000000001) << 0)
29 #define RR_VE_MASK 0x0000000000000001L
30 #define RR_VE_SHIFT 0
31 #define RR_TO_PS(arg) (((arg) >> 2) & 0x000000000000003f)
32 #define RR_PS(arg) (((arg) & 0x000000000000003f) << 2)
33 #define RR_PS_MASK 0x00000000000000fcL
34 #define RR_PS_SHIFT 2
35 #define RR_TO_RID(arg) (((arg) >> 8) & 0x0000000000ffffff)
36 #define RR_RID(arg) (((arg) & 0x0000000000ffffff) << 8)
37 #define RR_RID_MASK 0x00000000ffffff00L
39 DECLARE_PER_CPU(unsigned long, inserted_vhpt);
40 DECLARE_PER_CPU(unsigned long, inserted_shared_info);
41 DECLARE_PER_CPU(unsigned long, inserted_mapped_regs);
42 DECLARE_PER_CPU(unsigned long, inserted_vpd);
44 int set_one_rr(unsigned long rr, unsigned long val);
46 // This function is purely for performance... apparently scrambling
47 // bits in the region id makes for better hashing, which means better
48 // use of the VHPT, which means better performance
49 // Note that the only time a RID should be mangled is when it is stored in
50 // a region register; anytime it is "viewable" outside of this module,
51 // it should be unmangled
53 // NOTE: this function is also implemented in assembly code in hyper_set_rr!!
54 // Must ensure these two remain consistent!
55 static inline unsigned long
56 vmMangleRID(unsigned long RIDVal)
57 {
58 union bits64 {
59 unsigned char bytes[4];
60 unsigned long uint;
61 };
62 union bits64 t;
63 unsigned char tmp;
65 t.uint = RIDVal;
66 tmp = t.bytes[1];
67 t.bytes[1] = t.bytes[3];
68 t.bytes[3] = tmp;
70 return t.uint;
71 }
73 // since vmMangleRID is symmetric, use it for unmangling also
74 #define vmUnmangleRID(x) vmMangleRID(x)
76 extern void init_rid_allocator (void);
78 struct domain;
80 /* Allocate RIDs range and metaphysical RIDs for domain d.
81 If ridbits is 0, a default value is used instead. */
82 extern int allocate_rid_range(struct domain *d, unsigned long ridbits);
83 extern int deallocate_rid_range(struct domain *d);
85 struct vcpu;
86 extern void init_all_rr(struct vcpu *v);
88 extern void set_virtual_rr0(void);
89 extern void set_metaphysical_rr0(void);
91 extern void load_region_regs(struct vcpu *v);
93 extern int is_reserved_rr_rid(struct vcpu *vcpu, u64 reg_value);
94 extern int is_reserved_rr_field(struct vcpu *vcpu, u64 reg_value);
96 #endif /* !_REGIONREG_H_ */
98 /*
99 * Local variables:
100 * mode: C
101 * c-set-style: "BSD"
102 * c-basic-offset: 4
103 * tab-width: 4
104 * indent-tabs-mode: nil
105 * End:
106 */