Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1609719
| From | "tip-bot for Kirill A. Shutemov" <tipbot@zytor.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [tip:x86/mm] x86/kexec: Add 5-level paging support |
| Date | 2017-03-27 12:40 +0200 |
| Message-ID | <tpAe7-6F9-27@gated-at.bofh.it> (permalink) |
| References | <tm5gw-2nQ-69@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Commit-ID: 7f68904182e2f346c11b0acd74048181dc6615bb
Gitweb: http://git.kernel.org/tip/7f68904182e2f346c11b0acd74048181dc6615bb
Author: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
AuthorDate: Fri, 17 Mar 2017 21:55:10 +0300
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Mon, 27 Mar 2017 08:56:13 +0200
x86/kexec: Add 5-level paging support
Handle additional page table level in the kexec code.
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Dave Hansen <dave.hansen@intel.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: linux-arch@vger.kernel.org
Cc: linux-mm@kvack.org
Link: http://lkml.kernel.org/r/20170317185515.8636-2-kirill.shutemov@linux.intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
arch/x86/include/asm/kexec.h | 1 +
arch/x86/kernel/machine_kexec_32.c | 4 +++-
arch/x86/kernel/machine_kexec_64.c | 14 ++++++++++++--
3 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/arch/x86/include/asm/kexec.h b/arch/x86/include/asm/kexec.h
index 282630e..70ef205 100644
--- a/arch/x86/include/asm/kexec.h
+++ b/arch/x86/include/asm/kexec.h
@@ -164,6 +164,7 @@ struct kimage_arch {
};
#else
struct kimage_arch {
+ p4d_t *p4d;
pud_t *pud;
pmd_t *pmd;
pte_t *pte;
diff --git a/arch/x86/kernel/machine_kexec_32.c b/arch/x86/kernel/machine_kexec_32.c
index 469b23d..5f43cec 100644
--- a/arch/x86/kernel/machine_kexec_32.c
+++ b/arch/x86/kernel/machine_kexec_32.c
@@ -103,6 +103,7 @@ static void machine_kexec_page_table_set_one(
pgd_t *pgd, pmd_t *pmd, pte_t *pte,
unsigned long vaddr, unsigned long paddr)
{
+ p4d_t *p4d;
pud_t *pud;
pgd += pgd_index(vaddr);
@@ -110,7 +111,8 @@ static void machine_kexec_page_table_set_one(
if (!(pgd_val(*pgd) & _PAGE_PRESENT))
set_pgd(pgd, __pgd(__pa(pmd) | _PAGE_PRESENT));
#endif
- pud = pud_offset(pgd, vaddr);
+ p4d = p4d_offset(pgd, vaddr);
+ pud = pud_offset(p4d, vaddr);
pmd = pmd_offset(pud, vaddr);
if (!(pmd_val(*pmd) & _PAGE_PRESENT))
set_pmd(pmd, __pmd(__pa(pte) | _PAGE_TABLE));
diff --git a/arch/x86/kernel/machine_kexec_64.c b/arch/x86/kernel/machine_kexec_64.c
index 857cdbd..085c3b3 100644
--- a/arch/x86/kernel/machine_kexec_64.c
+++ b/arch/x86/kernel/machine_kexec_64.c
@@ -36,6 +36,7 @@ static struct kexec_file_ops *kexec_file_loaders[] = {
static void free_transition_pgtable(struct kimage *image)
{
+ free_page((unsigned long)image->arch.p4d);
free_page((unsigned long)image->arch.pud);
free_page((unsigned long)image->arch.pmd);
free_page((unsigned long)image->arch.pte);
@@ -43,6 +44,7 @@ static void free_transition_pgtable(struct kimage *image)
static int init_transition_pgtable(struct kimage *image, pgd_t *pgd)
{
+ p4d_t *p4d;
pud_t *pud;
pmd_t *pmd;
pte_t *pte;
@@ -53,13 +55,21 @@ static int init_transition_pgtable(struct kimage *image, pgd_t *pgd)
paddr = __pa(page_address(image->control_code_page)+PAGE_SIZE);
pgd += pgd_index(vaddr);
if (!pgd_present(*pgd)) {
+ p4d = (p4d_t *)get_zeroed_page(GFP_KERNEL);
+ if (!p4d)
+ goto err;
+ image->arch.p4d = p4d;
+ set_pgd(pgd, __pgd(__pa(p4d) | _KERNPG_TABLE));
+ }
+ p4d = p4d_offset(pgd, vaddr);
+ if (!p4d_present(*p4d)) {
pud = (pud_t *)get_zeroed_page(GFP_KERNEL);
if (!pud)
goto err;
image->arch.pud = pud;
- set_pgd(pgd, __pgd(__pa(pud) | _KERNPG_TABLE));
+ set_p4d(p4d, __p4d(__pa(pud) | _KERNPG_TABLE));
}
- pud = pud_offset(pgd, vaddr);
+ pud = pud_offset(p4d, vaddr);
if (!pud_present(*pud)) {
pmd = (pmd_t *)get_zeroed_page(GFP_KERNEL);
if (!pmd)
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/6] x86: 5-level paging enabling for v4.12, Part 2 "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2017-03-17 20:00 +0100
[PATCH 6/6] x86: Convert the rest of the code to support p4d_t "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2017-03-17 20:00 +0100
[tip:x86/mm] x86: Convert the rest of the code to support p4d_t "tip-bot for Kirill A. Shutemov" <tipbot@zytor.com> - 2017-03-27 12:40 +0200
[PATCH 2/6] x86/efi: Add 5-level paging support "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2017-03-17 20:00 +0100
[tip:x86/mm] x86/efi: Add 5-level paging support "tip-bot for Kirill A. Shutemov" <tipbot@zytor.com> - 2017-03-27 12:40 +0200
[PATCH 1/6] x86/kexec: Add 5-level paging support "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2017-03-17 20:00 +0100
[tip:x86/mm] x86/kexec: Add 5-level paging support "tip-bot for Kirill A. Shutemov" <tipbot@zytor.com> - 2017-03-27 12:40 +0200
[PATCH 5/6] x86/xen: Change __xen_pgd_walk() and xen_cleanmfnmap() to support p4d "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2017-03-17 20:00 +0100
Re: [PATCH 5/6] x86/xen: Change __xen_pgd_walk() and xen_cleanmfnmap() to support p4d Ingo Molnar <mingo@kernel.org> - 2017-03-27 08:40 +0200
Re: [PATCH 5/6] x86/xen: Change __xen_pgd_walk() and xen_cleanmfnmap() to support p4d "Kirill A. Shutemov" <kirill@shutemov.name> - 2017-03-27 15:20 +0200
[tip:x86/mm] x86/xen: Change __xen_pgd_walk() and xen_cleanmfnmap() to support p4d tip-bot for Xiong Zhang <tipbot@zytor.com> - 2017-03-27 12:40 +0200
[PATCH 4/6] x86/kasan: Prepare clear_pgds() to switch to <asm-generic/pgtable-nop4d.h> "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2017-03-17 20:50 +0100
Re: [PATCH 4/6] x86/kasan: Prepare clear_pgds() to switch to <asm-generic/pgtable-nop4d.h> Ingo Molnar <mingo@kernel.org> - 2017-03-22 08:40 +0100
Re: [PATCH 4/6] x86/kasan: Prepare clear_pgds() to switch to <asm-generic/pgtable-nop4d.h> "Kirill A. Shutemov" <kirill@shutemov.name> - 2017-03-24 10:10 +0100
Re: [PATCH 4/6] x86/kasan: Prepare clear_pgds() to switch to <asm-generic/pgtable-nop4d.h> Ingo Molnar <mingo@kernel.org> - 2017-03-24 12:00 +0100
[tip:x86/mm] x86/kasan: Prepare clear_pgds() to switch to <asm-generic/pgtable-nop4d.h> "tip-bot for Kirill A. Shutemov" <tipbot@zytor.com> - 2017-03-27 12:40 +0200
csiph-web