Merge to Fedora kernel-2.6.18-1.2224_FC5 patched with stable patch-2.6.18.1-vs2.0...
[linux-2.6.git] / include / xen / interface / arch-powerpc.h
1 /*
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License as published by
4  * the Free Software Foundation; either version 2 of the License, or
5  * (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software
14  * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
15  *
16  * Copyright (C) IBM Corp. 2005, 2006
17  *
18  * Authors: Hollis Blanchard <hollisb@us.ibm.com>
19  */
20
21 #ifndef __XEN_PUBLIC_ARCH_PPC_64_H__
22 #define __XEN_PUBLIC_ARCH_PPC_64_H__
23
24 #define __DEFINE_XEN_GUEST_HANDLE(name, type) \
25     typedef struct { \
26         int __pad[(sizeof (long long) - sizeof (void *)) / sizeof (int)]; \
27         type *p; \
28     } __attribute__((__aligned__(8))) __guest_handle_ ## name
29
30 #define DEFINE_XEN_GUEST_HANDLE(name) __DEFINE_XEN_GUEST_HANDLE(name, name)
31 #define XEN_GUEST_HANDLE(name)        __guest_handle_ ## name
32 #define set_xen_guest_handle(hnd, val) \
33     do { \
34         if (sizeof ((hnd).__pad)) \
35             (hnd).__pad[0] = 0; \
36         (hnd).p = val; \
37     } while (0)
38
39 #ifdef __XEN_TOOLS__
40 #define get_xen_guest_handle(val, hnd)  do { val = (hnd).p; } while (0)
41 #endif
42
43 #ifndef __ASSEMBLY__
44 /* Guest handles for primitive C types. */
45 __DEFINE_XEN_GUEST_HANDLE(uchar, unsigned char);
46 __DEFINE_XEN_GUEST_HANDLE(uint,  unsigned int);
47 __DEFINE_XEN_GUEST_HANDLE(ulong, unsigned long);
48 DEFINE_XEN_GUEST_HANDLE(char);
49 DEFINE_XEN_GUEST_HANDLE(int);
50 DEFINE_XEN_GUEST_HANDLE(long);
51 DEFINE_XEN_GUEST_HANDLE(void);
52
53 typedef unsigned long long xen_pfn_t;
54 DEFINE_XEN_GUEST_HANDLE(xen_pfn_t);
55 #endif
56
57 /*
58  * Pointers and other address fields inside interface structures are padded to
59  * 64 bits. This means that field alignments aren't different between 32- and
60  * 64-bit architectures. 
61  */
62 /* NB. Multi-level macro ensures __LINE__ is expanded before concatenation. */
63 #define __MEMORY_PADDING(_X)
64 #define _MEMORY_PADDING(_X)  __MEMORY_PADDING(_X)
65 #define MEMORY_PADDING       _MEMORY_PADDING(__LINE__)
66
67 /* And the trap vector is... */
68 #define TRAP_INSTR "li 0,-1; sc" /* XXX just "sc"? */
69
70 #ifndef __ASSEMBLY__
71
72 typedef uint64_t xen_ulong_t;
73
74 /* User-accessible registers: need to be saved/restored for every nested Xen
75  * invocation. */
76 struct cpu_user_regs
77 {
78     uint64_t gprs[32];
79     uint64_t lr;
80     uint64_t ctr;
81     uint64_t srr0;
82     uint64_t srr1;
83     uint64_t pc;
84     uint64_t msr;
85     uint64_t fpscr;
86     uint64_t xer;
87     uint64_t hid4;
88     uint32_t cr;
89     uint32_t entry_vector;
90 };
91 typedef struct cpu_user_regs cpu_user_regs_t;
92
93 typedef uint64_t tsc_timestamp_t; /* RDTSC timestamp */ /* XXX timebase */
94
95 /* ONLY used to communicate with dom0! See also struct exec_domain. */
96 struct vcpu_guest_context {
97     cpu_user_regs_t user_regs;         /* User-level CPU registers     */
98     uint64_t sdr1;                     /* Pagetable base               */
99     /* XXX etc */
100 };
101 typedef struct vcpu_guest_context vcpu_guest_context_t;
102 DEFINE_XEN_GUEST_HANDLE(vcpu_guest_context_t);
103
104 struct arch_shared_info {
105     uint64_t pad[32];
106 };
107
108 struct arch_vcpu_info {
109 };
110
111 /* Support for multi-processor guests. */
112 #define MAX_VIRT_CPUS 32
113 #endif
114
115 #endif