1 // SPDX-License-Identifier: GPL-2.0
3 #include <linux/pgtable.h>
4 #include <asm/abs_lowcore.h>
6 unsigned long __bootdata_preserved(__abs_lowcore);
8 int abs_lowcore_map(int cpu, struct lowcore *lc, bool alloc)
10 unsigned long addr = __abs_lowcore + (cpu * sizeof(struct lowcore));
11 unsigned long phys = __pa(lc);
14 for (i = 0; i < LC_PAGES; i++) {
15 rc = __vmem_map_4k_page(addr, phys, PAGE_KERNEL, alloc);
18 * Do not unmap allocated page tables in case the
19 * allocation was not requested. In such a case the
20 * request is expected coming from an atomic context,
21 * while the unmap attempt might sleep.
24 for (--i; i >= 0; i--) {
26 vmem_unmap_4k_page(addr);
37 void abs_lowcore_unmap(int cpu)
39 unsigned long addr = __abs_lowcore + (cpu * sizeof(struct lowcore));
42 for (i = 0; i < LC_PAGES; i++) {
43 vmem_unmap_4k_page(addr);