This patch preallocates the intermediate page table entries so that
all that is needed to setup a fixmap is to fill in the appropriate
pte.

By doing this modern hardware that uses memory mapped access can be
talked to early in boot through a fixmap. 

Allowing USB debugging and the like.

Signed-off-by: Eric W. Biederman <[EMAIL PROTECTED]>
---
 arch/x86_64/kernel/head.S |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/arch/x86_64/kernel/head.S b/arch/x86_64/kernel/head.S
index 1fab487..1b704c4 100644
--- a/arch/x86_64/kernel/head.S
+++ b/arch/x86_64/kernel/head.S
@@ -74,6 +74,9 @@ startup_64:
 
        addq    %rbp, level3_ident_pgt + 0(%rip)
        addq    %rbp, level3_kernel_pgt + (510*8)(%rip)
+       addq    %rbp, level3_kernel_pgt + (511*8)(%rip)
+
+       addq    %rbp, level2_fixmap_pgt + (506*8)(%rip)
 
        /* Add an Identity mapping if I am above 1G */
        leaq    _text(%rip), %rdi
@@ -314,7 +317,16 @@ NEXT_PAGE(level3_kernel_pgt)
        .fill   510,8,0
        /* (2^48-(2*1024*1024*1024)-((2^39)*511))/(2^30) = 510 */
        .quad   level2_kernel_pgt - __START_KERNEL_map + _KERNPG_TABLE
-       .fill   1,8,0
+       .quad   level2_fixmap_pgt - __START_KERNEL_map + _KERNPG_TABLE + 
_PAGE_USER
+
+NEXT_PAGE(level2_fixmap_pgt)
+       .fill   506,8,0
+       .quad   level1_fixmap_pgt - __START_KERNEL_map + _KERNPG_TABLE + 
_PAGE_USER
+       /* 8MB reserved for vsyscalls + a 2MB hole = 4 + 1 entries */
+       .fill   5,8,0
+
+NEXT_PAGE(level1_fixmap_pgt)
+       .fill   512,8,0
 
 NEXT_PAGE(level2_ident_pgt)
        /* Since I easily can, map the first 1G.
-- 
1.5.1.1.181.g2de0

_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/virtualization

Reply via email to