source: trunk/packages/xen-3.1/xen-3.1/xen/include/asm-ia64/vhpt.h @ 34

Last change on this file since 34 was 34, checked in by hartmans, 18 years ago

Add xen and xen-common

File size: 2.3 KB
Line 
1#ifndef ASM_VHPT_H
2#define ASM_VHPT_H
3
4#define VHPT_ENABLED 1
5
6/* Size of the VHPT.  */
7// XXX work around to avoid trigerring xenLinux software lock up detection.
8# define        VHPT_SIZE_LOG2                  16      // 64KB
9
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))
12
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
18
19#ifndef __ASSEMBLY__
20#include <xen/percpu.h>
21#include <asm/vcpumask.h>
22
23extern void domain_purge_swtc_entries(struct domain *d);
24extern void domain_purge_swtc_entries_vcpu_dirty_mask(struct domain* d, vcpumask_t vcpu_dirty_mask);
25
26//
27// VHPT Long Format Entry (as recognized by hw)
28//
29struct vhpt_lf_entry {
30    unsigned long page_flags;
31    unsigned long itir;
32    unsigned long ti_tag;
33    unsigned long CChain;
34};
35
36#define INVALID_TI_TAG 0x8000000000000000L
37
38extern void vhpt_init (void);
39extern void gather_vhpt_stats(void);
40extern void vhpt_multiple_insert(unsigned long vaddr, unsigned long pte,
41                                 unsigned long logps);
42extern void vhpt_insert (unsigned long vadr, unsigned long pte,
43                         unsigned long logps);
44void local_vhpt_flush(void);
45extern void vcpu_vhpt_flush(struct vcpu* v);
46
47/* Currently the VHPT is allocated per CPU.  */
48DECLARE_PER_CPU (unsigned long, vhpt_paddr);
49DECLARE_PER_CPU (unsigned long, vhpt_pend);
50
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
56
57#include <xen/sched.h>
58int pervcpu_vhpt_alloc(struct vcpu *v);
59void pervcpu_vhpt_free(struct vcpu *v);
60static inline unsigned long
61vcpu_vhpt_maddr(struct vcpu* v)
62{
63#ifdef CONFIG_XEN_IA64_PERVCPU_VHPT
64    if (HAS_PERVCPU_VHPT(v->domain))
65        return v->arch.vhpt_maddr;
66#endif
67
68#if 0
69    // referencecing v->processor is racy.
70    return per_cpu(vhpt_paddr, v->processor);
71#endif
72    BUG_ON(v != current);
73    return __get_cpu_var(vhpt_paddr);
74}
75
76static inline unsigned long
77vcpu_pta(struct vcpu* v)
78{
79#ifdef CONFIG_XEN_IA64_PERVCPU_VHPT
80    if (HAS_PERVCPU_VHPT(v->domain))
81        return v->arch.pta.val;
82#endif
83    return __va_ul(__get_cpu_var(vhpt_paddr)) | (1 << 8) |
84        (VHPT_SIZE_LOG2 << 2) | VHPT_ENABLED;
85}
86
87#endif /* !__ASSEMBLY */
88#endif
Note: See TracBrowser for help on using the repository browser.