1 /******************************************************************************
2  * config.h
3  *
4  * A Linux-style configuration list.
5  */
6 
7 #ifndef __ARM_CONFIG_H__
8 #define __ARM_CONFIG_H__
9 
10 #if defined(CONFIG_ARM_64)
11 # define LONG_BYTEORDER 3
12 # define ELFSIZE 64
13 #else
14 # define LONG_BYTEORDER 2
15 # define ELFSIZE 32
16 #endif
17 
18 #define BYTES_PER_LONG (1 << LONG_BYTEORDER)
19 #define BITS_PER_LONG (BYTES_PER_LONG << 3)
20 #define POINTER_ALIGN BYTES_PER_LONG
21 
22 #define BITS_PER_LLONG 64
23 
24 /* xen_ulong_t is always 64 bits */
25 #define BITS_PER_XEN_ULONG 64
26 
27 #define CONFIG_PAGING_LEVELS 3
28 
29 #define CONFIG_ARM 1
30 
31 #define CONFIG_ARM_L1_CACHE_SHIFT 7 /* XXX */
32 
33 #define CONFIG_SMP 1
34 
35 #define CONFIG_IRQ_HAS_MULTIPLE_ACTION 1
36 
37 #define CONFIG_PAGEALLOC_MAX_ORDER 18
38 #define CONFIG_DOMU_MAX_ORDER      9
39 #define CONFIG_HWDOM_MAX_ORDER     10
40 
41 #define OPT_CONSOLE_STR "dtuart"
42 
43 #ifdef CONFIG_ARM_64
44 #define MAX_VIRT_CPUS 128u
45 #else
46 #define MAX_VIRT_CPUS 8u
47 #endif
48 
49 #define INVALID_VCPU_ID MAX_VIRT_CPUS
50 
51 #define __LINUX_ARM_ARCH__ 7
52 #define CONFIG_AEABI
53 
54 /* Linkage for ARM */
55 #ifdef __ASSEMBLY__
56 #define ALIGN .align 2
57 #define ENTRY(name)                             \
58   .globl name;                                  \
59   ALIGN;                                        \
60   name:
61 #define GLOBAL(name)                            \
62   .globl name;                                  \
63   name:
64 #define END(name) \
65   .size name, .-name
66 #define ENDPROC(name) \
67   .type name, %function; \
68   END(name)
69 #endif
70 
71 #include <xen/const.h>
72 
73 /*
74  * Common ARM32 and ARM64 layout:
75  *   0  -   2M   Unmapped
76  *   2M -   4M   Xen text, data, bss
77  *   4M -   6M   Fixmap: special-purpose 4K mapping slots
78  *   6M -  10M   Early boot mapping of FDT
79  *   10M - 12M   Early relocation address (used when relocating Xen)
80  *               and later for livepatch vmap (if compiled in)
81  *
82  * ARM32 layout:
83  *   0  -  12M   <COMMON>
84  *
85  *  32M - 128M   Frametable: 24 bytes per page for 16GB of RAM
86  * 256M -   1G   VMAP: ioremap and early_ioremap use this virtual address
87  *                    space
88  *
89  *   1G -   2G   Xenheap: always-mapped memory
90  *   2G -   4G   Domheap: on-demand-mapped
91  *
92  * ARM64 layout:
93  * 0x0000000000000000 - 0x0000007fffffffff (512GB, L0 slot [0])
94  *   0  -  12M   <COMMON>
95  *
96  *   1G -   2G   VMAP: ioremap and early_ioremap
97  *
98  *  32G -  64G   Frametable: 24 bytes per page for 5.3TB of RAM
99  *
100  * 0x0000008000000000 - 0x00007fffffffffff (127.5TB, L0 slots [1..255])
101  *  Unused
102  *
103  * 0x0000800000000000 - 0x000084ffffffffff (5TB, L0 slots [256..265])
104  *  1:1 mapping of RAM
105  *
106  * 0x0000850000000000 - 0x0000ffffffffffff (123TB, L0 slots [266..511])
107  *  Unused
108  */
109 
110 #define XEN_VIRT_START         _AT(vaddr_t,0x00200000)
111 #define FIXMAP_ADDR(n)        (_AT(vaddr_t,0x00400000) + (n) * PAGE_SIZE)
112 
113 #define BOOT_FDT_VIRT_START    _AT(vaddr_t,0x00600000)
114 #define BOOT_FDT_SLOT_SIZE     MB(4)
115 #define BOOT_FDT_VIRT_END      (BOOT_FDT_VIRT_START + BOOT_FDT_SLOT_SIZE)
116 
117 #define BOOT_RELOC_VIRT_START  _AT(vaddr_t,0x00a00000)
118 #ifdef CONFIG_LIVEPATCH
119 #define LIVEPATCH_VMAP_START   _AT(vaddr_t,0x00a00000)
120 #define LIVEPATCH_VMAP_END     (LIVEPATCH_VMAP_START + MB(2))
121 #endif
122 
123 #define HYPERVISOR_VIRT_START  XEN_VIRT_START
124 
125 #ifdef CONFIG_ARM_32
126 
127 #define CONFIG_DOMAIN_PAGE 1
128 #define CONFIG_SEPARATE_XENHEAP 1
129 
130 #define FRAMETABLE_VIRT_START  _AT(vaddr_t,0x02000000)
131 #define FRAMETABLE_SIZE        MB(128-32)
132 #define FRAMETABLE_NR          (FRAMETABLE_SIZE / sizeof(*frame_table))
133 #define FRAMETABLE_VIRT_END    (FRAMETABLE_VIRT_START + FRAMETABLE_SIZE - 1)
134 
135 #define VMAP_VIRT_START        _AT(vaddr_t,0x10000000)
136 
137 #define XENHEAP_VIRT_START     _AT(vaddr_t,0x40000000)
138 #define XENHEAP_VIRT_END       _AT(vaddr_t,0x7fffffff)
139 #define DOMHEAP_VIRT_START     _AT(vaddr_t,0x80000000)
140 #define DOMHEAP_VIRT_END       _AT(vaddr_t,0xffffffff)
141 
142 #define VMAP_VIRT_END    XENHEAP_VIRT_START
143 
144 #define DOMHEAP_ENTRIES        1024  /* 1024 2MB mapping slots */
145 
146 /* Number of domheap pagetable pages required at the second level (2MB mappings) */
147 #define DOMHEAP_SECOND_PAGES ((DOMHEAP_VIRT_END - DOMHEAP_VIRT_START + 1) >> FIRST_SHIFT)
148 
149 #else /* ARM_64 */
150 
151 #define SLOT0_ENTRY_BITS  39
152 #define SLOT0(slot) (_AT(vaddr_t,slot) << SLOT0_ENTRY_BITS)
153 #define SLOT0_ENTRY_SIZE  SLOT0(1)
154 
155 #define VMAP_VIRT_START  GB(1)
156 #define VMAP_VIRT_END    (VMAP_VIRT_START + GB(1))
157 
158 #define FRAMETABLE_VIRT_START  GB(32)
159 #define FRAMETABLE_SIZE        GB(32)
160 #define FRAMETABLE_NR          (FRAMETABLE_SIZE / sizeof(*frame_table))
161 #define FRAMETABLE_VIRT_END    (FRAMETABLE_VIRT_START + FRAMETABLE_SIZE - 1)
162 
163 #define DIRECTMAP_VIRT_START   SLOT0(256)
164 #define DIRECTMAP_SIZE         (SLOT0_ENTRY_SIZE * (265-256))
165 #define DIRECTMAP_VIRT_END     (DIRECTMAP_VIRT_START + DIRECTMAP_SIZE - 1)
166 
167 #define XENHEAP_VIRT_START     xenheap_virt_start
168 
169 #define HYPERVISOR_VIRT_END    DIRECTMAP_VIRT_END
170 
171 #endif
172 
173 /* Fixmap slots */
174 #define FIXMAP_CONSOLE  0  /* The primary UART */
175 #define FIXMAP_MISC     1  /* Ephemeral mappings of hardware */
176 #define FIXMAP_ACPI_BEGIN  2  /* Start mappings of ACPI tables */
177 #define FIXMAP_ACPI_END    (FIXMAP_ACPI_BEGIN + NUM_FIXMAP_ACPI_PAGES - 1)  /* End mappings of ACPI tables */
178 
179 #define PAGE_SHIFT              12
180 #define PAGE_SIZE           (_AC(1,L) << PAGE_SHIFT)
181 #define PAGE_MASK           (~(PAGE_SIZE-1))
182 #define PAGE_FLAG_MASK      (~0)
183 
184 #define NR_hypercalls 64
185 
186 #define STACK_ORDER 3
187 #define STACK_SIZE  (PAGE_SIZE << STACK_ORDER)
188 
189 #ifndef __ASSEMBLY__
190 extern unsigned long xen_phys_start;
191 extern unsigned long xenheap_phys_end;
192 extern unsigned long frametable_virt_end;
193 #endif
194 
195 #define watchdog_disable() ((void)0)
196 #define watchdog_enable()  ((void)0)
197 
198 #endif /* __ARM_CONFIG_H__ */
199 /*
200  * Local variables:
201  * mode: C
202  * c-file-style: "BSD"
203  * c-basic-offset: 4
204  * indent-tabs-mode: nil
205  * End:
206  */
207