Skip to content

Commit 6091dd9

Browse files
soleenwilldeacon
authored andcommitted
arm64: trans_pgd: remove trans_pgd_map_page()
The intend of trans_pgd_map_page() was to map contiguous range of VA memory to the memory that is getting relocated during kexec. However, since we are now using linear map instead of contiguous range this function is not needed Suggested-by: Pingfan Liu <[email protected]> Signed-off-by: Pasha Tatashin <[email protected]> Acked-by: Catalin Marinas <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent 7a2512f commit 6091dd9

File tree

2 files changed

+1
-61
lines changed

2 files changed

+1
-61
lines changed

arch/arm64/include/asm/trans_pgd.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
/*
1616
* trans_alloc_page
1717
* - Allocator that should return exactly one zeroed page, if this
18-
* allocator fails, trans_pgd_create_copy() and trans_pgd_map_page()
18+
* allocator fails, trans_pgd_create_copy() and trans_pgd_idmap_page()
1919
* return -ENOMEM error.
2020
*
2121
* trans_alloc_arg
@@ -30,9 +30,6 @@ struct trans_pgd_info {
3030
int trans_pgd_create_copy(struct trans_pgd_info *info, pgd_t **trans_pgd,
3131
unsigned long start, unsigned long end);
3232

33-
int trans_pgd_map_page(struct trans_pgd_info *info, pgd_t *trans_pgd,
34-
void *page, unsigned long dst_addr, pgprot_t pgprot);
35-
3633
int trans_pgd_idmap_page(struct trans_pgd_info *info, phys_addr_t *trans_ttbr0,
3734
unsigned long *t0sz, void *page);
3835

arch/arm64/mm/trans_pgd.c

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -217,63 +217,6 @@ int trans_pgd_create_copy(struct trans_pgd_info *info, pgd_t **dst_pgdp,
217217
return rc;
218218
}
219219

220-
/*
221-
* Add map entry to trans_pgd for a base-size page at PTE level.
222-
* info: contains allocator and its argument
223-
* trans_pgd: page table in which new map is added.
224-
* page: page to be mapped.
225-
* dst_addr: new VA address for the page
226-
* pgprot: protection for the page.
227-
*
228-
* Returns 0 on success, and -ENOMEM on failure.
229-
*/
230-
int trans_pgd_map_page(struct trans_pgd_info *info, pgd_t *trans_pgd,
231-
void *page, unsigned long dst_addr, pgprot_t pgprot)
232-
{
233-
pgd_t *pgdp;
234-
p4d_t *p4dp;
235-
pud_t *pudp;
236-
pmd_t *pmdp;
237-
pte_t *ptep;
238-
239-
pgdp = pgd_offset_pgd(trans_pgd, dst_addr);
240-
if (pgd_none(READ_ONCE(*pgdp))) {
241-
p4dp = trans_alloc(info);
242-
if (!pgdp)
243-
return -ENOMEM;
244-
pgd_populate(NULL, pgdp, p4dp);
245-
}
246-
247-
p4dp = p4d_offset(pgdp, dst_addr);
248-
if (p4d_none(READ_ONCE(*p4dp))) {
249-
pudp = trans_alloc(info);
250-
if (!pudp)
251-
return -ENOMEM;
252-
p4d_populate(NULL, p4dp, pudp);
253-
}
254-
255-
pudp = pud_offset(p4dp, dst_addr);
256-
if (pud_none(READ_ONCE(*pudp))) {
257-
pmdp = trans_alloc(info);
258-
if (!pmdp)
259-
return -ENOMEM;
260-
pud_populate(NULL, pudp, pmdp);
261-
}
262-
263-
pmdp = pmd_offset(pudp, dst_addr);
264-
if (pmd_none(READ_ONCE(*pmdp))) {
265-
ptep = trans_alloc(info);
266-
if (!ptep)
267-
return -ENOMEM;
268-
pmd_populate_kernel(NULL, pmdp, ptep);
269-
}
270-
271-
ptep = pte_offset_kernel(pmdp, dst_addr);
272-
set_pte(ptep, pfn_pte(virt_to_pfn(page), pgprot));
273-
274-
return 0;
275-
}
276-
277220
/*
278221
* The page we want to idmap may be outside the range covered by VA_BITS that
279222
* can be built using the kernel's p?d_populate() helpers. As a one off, for a

0 commit comments

Comments
 (0)