From: Vitaly Wool <vitaly.wool@konsulko.com>
To: linux-riscv@lists.infradead.org
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
Palmer Dabbelt <palmerdabbelt@google.com>,
Vitaly Wool <vitaly.wool@konsulko.com>,
kernel test robot <lkp@intel.com>
Subject: [PATCH] riscv: XIP: fix build for rv32
Date: Sat, 27 Mar 2021 21:48:01 +0200 [thread overview]
Message-ID: <20210327194800.23622-1-vitaly.wool@konsulko.com> (raw)
32-bit RISC-V uses folded page tables by default, so we should
follow that in the XIP-specific part of init too.
Signed-off-by: Vitaly Wool <vitaly.wool@konsulko.com>
Reported-by: kernel test robot <lkp@intel.com>
---
arch/riscv/mm/init.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
index fe583c2aa5a2..8c0eeaae67a3 100644
--- a/arch/riscv/mm/init.c
+++ b/arch/riscv/mm/init.c
@@ -481,6 +481,7 @@ asmlinkage void __init setup_vm(uintptr_t dtb_pa)
#endif
#ifdef CONFIG_XIP_KERNEL
+#ifndef __PAGETABLE_PMD_FOLDED
create_pgd_mapping(trampoline_pg_dir, XIP_VIRT_ADDR_START,
(uintptr_t)xip_pmd, PGDIR_SIZE, PAGE_TABLE);
for (va = XIP_VIRT_ADDR_START;
@@ -493,7 +494,16 @@ asmlinkage void __init setup_vm(uintptr_t dtb_pa)
create_pgd_mapping(early_pg_dir, XIP_VIRT_ADDR_START,
(uintptr_t)xip_pmd, PGDIR_SIZE, PAGE_TABLE);
-#endif
+#else
+ for (va = XIP_VIRT_ADDR_START;
+ va < XIP_VIRT_ADDR_START + xiprom_sz;
+ va += map_size) {
+ create_pgd_mapping(early_pg_dir, va,
+ xiprom + (va - XIP_VIRT_ADDR_START),
+ map_size, PAGE_KERNEL_EXEC);
+ }
+#endif /* __PAGETABLE_PMD_FOLDED */
+#endif /* CONFIG_XIP_KERNEL */
/*
* Setup early PGD covering entire kernel which will allows
--
2.29.2
reply other threads:[~2021-03-27 19:49 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210327194800.23622-1-vitaly.wool@konsulko.com \
--to=vitaly.wool@konsulko.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-riscv@lists.infradead.org \
--cc=lkp@intel.com \
--cc=palmerdabbelt@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox