[PATCH] Fix alignment of early reservation for EBDA

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Andi Kleen <ak@...>
Cc: Ingo Molnar <mingo@...>, Thomas Gleixner <tglx@...>, LKML <linux-kernel@...>, Alexander van Heukelum <heukelum@...>
Date: Sunday, February 24, 2008 - 1:46 pm

Hi Andi,

My eyes fell on the following table in the boot messages:

early res: 0 [0-fff] BIOS data page
early res: 1 [6000-7fff] SMP_TRAMPOLINE
early res: 2 [200000-374557] TEXT DATA BSS
early res: 3 [9fc00-a0bff] EBDA
early res: 4 [8000-afff] PGTABLE

The memory reserved for the EBDA overflows into the area normally
reserved for the VGA adaptor. It seems that you wanted to force
the allocation to cover whole pages, like:

early res: 3 [9f000-9ffff] EBDA

This is what this patch implements.

Is it really necessary to force the allocation to a page boundary?


Signed-off-by: Alexander van Heukelum <heukelum@fastmail.fm>

 arch/x86/kernel/head64.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c
index ad24408..2c52543 100644
--- a/arch/x86/kernel/head64.c
+++ b/arch/x86/kernel/head64.c
@@ -53,7 +53,7 @@ static void __init copy_bootdata(char *real_mode_data)
 
 static __init void reserve_ebda(void)
 {
-	unsigned ebda_addr, ebda_size;
+	unsigned int ebda_addr, ebda_size, ebda_end;
 
 	/*
 	 * there is a real-mode segmented pointer pointing to the
@@ -70,12 +70,14 @@ static __init void reserve_ebda(void)
 	/* Round EBDA up to pages */
 	if (ebda_size == 0)
 		ebda_size = 1;
+	if (ebda_size > 64)
+		ebda_size = 64;
 	ebda_size <<= 10;
-	ebda_size = round_up(ebda_size + (ebda_addr & ~PAGE_MASK), PAGE_SIZE);
-	if (ebda_size > 64*1024)
-		ebda_size = 64*1024;
+	
+	ebda_end = ALIGN(ebda_addr + ebda_size, PAGE_SIZE);
+	ebda_addr = ALIGN(ebda_addr - PAGE_SIZE, PAGE_SIZE);
 
-	reserve_early(ebda_addr, ebda_addr + ebda_size, "EBDA");
+	reserve_early(ebda_addr, ebda_end, "EBDA");
 }
 
 void __init x86_64_start_kernel(char * real_mode_data)
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] Fix alignment of early reservation for EBDA, Alexander van Heukelum, (Sun Feb 24, 1:46 pm)
Re: [PATCH] Fix alignment of early reservation for EBDA, H. Peter Anvin, (Sun Feb 24, 10:18 pm)
Re: [PATCH] Fix alignment of early reservation for EBDA, Alexander van Heukelum, (Mon Feb 25, 12:54 pm)
[PATCH] reserve_early end-of-conventional-memory to 1MB, Alexander van Heukelum, (Mon Feb 25, 2:07 pm)
Re: [PATCH] reserve_early end-of-conventional-memory to 1MB, Alexander van Heukelum, (Mon Feb 25, 3:46 pm)
Re: [PATCH] reserve_early end-of-conventional-memory to 1MB ..., Alexander van Heukelum, (Wed Feb 27, 4:01 pm)
[PATCH] reserve end-of-conventional-memory to 1MB on 32-bit, Alexander van Heukelum, (Thu Feb 28, 9:13 am)
[RFC] use realmode code to reserve end-of-conventional-memor..., Alexander van Heukelum, (Thu Feb 28, 9:28 am)
Re: [RFC] use realmode code to reserve end-of-conventional-m..., Jeremy Fitzhardinge, (Tue Mar 4, 1:44 pm)
Re: [RFC] use realmode code to reserve end-of-conventional-m..., Jeremy Fitzhardinge, (Wed Mar 5, 12:38 pm)
Re: [RFC] use realmode code to reserve end-of-conventional-m..., Jeremy Fitzhardinge, (Wed Mar 5, 1:28 pm)
Re: [RFC] use realmode code to reserve end-of-conventional-m..., Jeremy Fitzhardinge, (Tue Mar 4, 11:13 am)
Re: [RFC] use realmode code to reserve end-of-conventional-m..., Jeremy Fitzhardinge, (Tue Mar 4, 12:02 pm)
Re: [PATCH] reserve end-of-conventional-memory to 1MB on 32-..., Alexander van Heukelum, (Fri Feb 29, 7:49 am)
Re: [PATCH] reserve end-of-conventional-memory to 1MB on 32-..., Alexander van Heukelum, (Fri Feb 29, 2:38 pm)
Re: [PATCH] reserve end-of-conventional-memory to 1MB on 32-..., Alexander van Heukelum, (Fri Feb 29, 2:56 pm)
Re: [PATCH] reserve end-of-conventional-memory to 1MB on 32-..., Alexander van Heukelum, (Sat Mar 1, 12:09 pm)
Re: [PATCH] reserve end-of-conventional-memory to 1MB on 64-..., Alexander van Heukelum, (Sat Mar 1, 12:12 pm)
Re: [PATCH] reserve end-of-conventional-memory to 1MB on 32-..., Jeremy Fitzhardinge, (Tue Mar 4, 11:18 am)
Re: [PATCH] reserve end-of-conventional-memory to 1MB on 32-..., Alexander van Heukelum, (Tue Mar 4, 12:51 pm)
Re: [PATCH] reserve end-of-conventional-memory to 1MB on 32-..., Jeremy Fitzhardinge, (Tue Mar 4, 1:11 pm)
Re: [PATCH] reserve end-of-conventional-memory to 1MB, 32-bi..., Alexander van Heukelum, (Tue Mar 4, 2:57 pm)
Re: [PATCH] reserve end-of-conventional-memory to 1MB, 64-bi..., Alexander van Heukelum, (Tue Mar 4, 3:12 pm)
Re: [PATCH] reserve end-of-conventional-memory to 1MB on 32-..., Alexander van Heukelum, (Tue Mar 4, 9:31 am)
Re: [PATCH] reserve end-of-conventional-memory to 1MB on 32-..., Alexander van Heukelum, (Fri Feb 29, 6:26 pm)
Re: [PATCH] Fix alignment of early reservation for EBDA, Alexander van Heukelum, (Sun Feb 24, 4:53 pm)