[PATCH 01/12] x86_64: Allow fixmaps to be used with the initial page table.




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 <ebiederm@xxxxxxxxxxxx>
---
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

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



Relevant Pages

  • Re: [PATCH 01/12] x86_64: Allow fixmaps to be used with the initial page table.
    ... This patch preallocates the intermediate page table entries so that ... all that is needed to setup a fixmap is to fill in the appropriate ... talked to early in boot through a fixmap. ...
    (Linux-Kernel)
  • Re: early fixmap causes kmap breakage
    ... Meantime, clearing the early fixmap pte I guess works, but you ... The early fixmap pmd entry inserted at the very top of the KVA is casing the ... I was the change to one_page_table_init in the patch that made ... My patch copies the early fixmap mappings to the new page table. ...
    (Linux-Kernel)
  • Re: early fixmap causes kmap breakage
    ... I've debugged a problem where i386+pae systems with more than a few CPUs ... Meantime, clearing the early fixmap pte I guess works, but ... The fixmap setup code crudely allocates contiguous pte pages, which is fine, ... and then have the fixmap setup proper first ...
    (Linux-Kernel)
  • Re: early fixmap causes kmap breakage
    ... Nick Piggin writes: ... I've debugged a problem where i386+pae systems with more than a few CPUs ... Meantime, clearing the early fixmap pte I guess works, but ... The fixmap setup code crudely allocates contiguous pte pages, which is fine, ...
    (Linux-Kernel)
  • Re: early fixmap causes kmap breakage
    ... I've debugged a problem where i386+pae systems with more than a few CPUs ... Meantime, clearing the early fixmap pte I guess works, but ... The fixmap setup code crudely allocates contiguous pte pages, which is fine, ...
    (Linux-Kernel)