diff options
Diffstat (limited to 'arch/x86/xen/setup.c')
-rw-r--r-- | arch/x86/xen/setup.c | 41 |
1 files changed, 14 insertions, 27 deletions
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c index 01afd8a94607..b5a7f928234b 100644 --- a/arch/x86/xen/setup.c +++ b/arch/x86/xen/setup.c | |||
@@ -181,24 +181,21 @@ char * __init xen_memory_setup(void) | |||
181 | for (i = 0; i < memmap.nr_entries; i++) { | 181 | for (i = 0; i < memmap.nr_entries; i++) { |
182 | unsigned long long end = map[i].addr + map[i].size; | 182 | unsigned long long end = map[i].addr + map[i].size; |
183 | 183 | ||
184 | if (map[i].type == E820_RAM) { | 184 | if (map[i].type == E820_RAM && end > mem_end) { |
185 | if (map[i].addr < mem_end && end > mem_end) { | 185 | /* RAM off the end - may be partially included */ |
186 | /* Truncate region to max_mem. */ | 186 | u64 delta = min(map[i].size, end - mem_end); |
187 | u64 delta = end - mem_end; | ||
188 | 187 | ||
189 | map[i].size -= delta; | 188 | map[i].size -= delta; |
190 | extra_pages += PFN_DOWN(delta); | 189 | end -= delta; |
191 | 190 | ||
192 | end = mem_end; | 191 | extra_pages += PFN_DOWN(delta); |
193 | } | ||
194 | } | 192 | } |
195 | 193 | ||
196 | if (end > xen_extra_mem_start) | 194 | if (map[i].size > 0 && end > xen_extra_mem_start) |
197 | xen_extra_mem_start = end; | 195 | xen_extra_mem_start = end; |
198 | 196 | ||
199 | /* If region is non-RAM or below mem_end, add what remains */ | 197 | /* Add region if any remains */ |
200 | if ((map[i].type != E820_RAM || map[i].addr < mem_end) && | 198 | if (map[i].size > 0) |
201 | map[i].size > 0) | ||
202 | e820_add_region(map[i].addr, map[i].size, map[i].type); | 199 | e820_add_region(map[i].addr, map[i].size, map[i].type); |
203 | } | 200 | } |
204 | 201 | ||
@@ -252,20 +249,6 @@ char * __init xen_memory_setup(void) | |||
252 | return "Xen"; | 249 | return "Xen"; |
253 | } | 250 | } |
254 | 251 | ||
255 | static void xen_idle(void) | ||
256 | { | ||
257 | local_irq_disable(); | ||
258 | |||
259 | if (need_resched()) | ||
260 | local_irq_enable(); | ||
261 | else { | ||
262 | current_thread_info()->status &= ~TS_POLLING; | ||
263 | smp_mb__after_clear_bit(); | ||
264 | safe_halt(); | ||
265 | current_thread_info()->status |= TS_POLLING; | ||
266 | } | ||
267 | } | ||
268 | |||
269 | /* | 252 | /* |
270 | * Set the bit indicating "nosegneg" library variants should be used. | 253 | * Set the bit indicating "nosegneg" library variants should be used. |
271 | * We only need to bother in pure 32-bit mode; compat 32-bit processes | 254 | * We only need to bother in pure 32-bit mode; compat 32-bit processes |
@@ -362,7 +345,11 @@ void __init xen_arch_setup(void) | |||
362 | MAX_GUEST_CMDLINE > COMMAND_LINE_SIZE ? | 345 | MAX_GUEST_CMDLINE > COMMAND_LINE_SIZE ? |
363 | COMMAND_LINE_SIZE : MAX_GUEST_CMDLINE); | 346 | COMMAND_LINE_SIZE : MAX_GUEST_CMDLINE); |
364 | 347 | ||
365 | pm_idle = xen_idle; | 348 | /* Set up idle, making sure it calls safe_halt() pvop */ |
349 | #ifdef CONFIG_X86_32 | ||
350 | boot_cpu_data.hlt_works_ok = 1; | ||
351 | #endif | ||
352 | pm_idle = default_idle; | ||
366 | 353 | ||
367 | fiddle_vdso(); | 354 | fiddle_vdso(); |
368 | } | 355 | } |