All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arm64/mm: remove useless trans_pgd_map_page()
@ 2021-04-06 13:14 Pingfan Liu
  2021-04-06 16:58 ` Pavel Tatashin
  0 siblings, 1 reply; 3+ messages in thread
From: Pingfan Liu @ 2021-04-06 13:14 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Pingfan Liu, Catalin Marinas, Will Deacon, Pavel Tatashin,
	James Morse, Matthias Brugger

Since the commit 7018d467ff2d ("arm64: trans_pgd: hibernate: idmap the
single page that holds the copy page routines"), trans_pgd_map_page() is
useless.

Signed-off-by: Pingfan Liu <kernelfans@gmail.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Pavel Tatashin <pasha.tatashin@soleen.com>
Cc: James Morse <james.morse@arm.com>
Cc: Matthias Brugger <mbrugger@suse.com>
To: linux-arm-kernel@lists.infradead.org
---
 arch/arm64/include/asm/trans_pgd.h |  5 +--
 arch/arm64/mm/trans_pgd.c          | 57 ------------------------------
 2 files changed, 1 insertion(+), 61 deletions(-)

diff --git a/arch/arm64/include/asm/trans_pgd.h b/arch/arm64/include/asm/trans_pgd.h
index 5d08e5adf3d5..9b6858c032a5 100644
--- a/arch/arm64/include/asm/trans_pgd.h
+++ b/arch/arm64/include/asm/trans_pgd.h
@@ -15,7 +15,7 @@
 /*
  * trans_alloc_page
  *	- Allocator that should return exactly one zeroed page, if this
- *	  allocator fails, trans_pgd_create_copy() and trans_pgd_map_page()
+ *	  allocator fails, trans_pgd_create_copy() and trans_pgd_idmap_page()
  *	  return -ENOMEM error.
  *
  * trans_alloc_arg
@@ -30,9 +30,6 @@ struct trans_pgd_info {
 int trans_pgd_create_copy(struct trans_pgd_info *info, pgd_t **trans_pgd,
 			  unsigned long start, unsigned long end);
 
-int trans_pgd_map_page(struct trans_pgd_info *info, pgd_t *trans_pgd,
-		       void *page, unsigned long dst_addr, pgprot_t pgprot);
-
 int trans_pgd_idmap_page(struct trans_pgd_info *info, phys_addr_t *trans_ttbr0,
 			 unsigned long *t0sz, void *page);
 
diff --git a/arch/arm64/mm/trans_pgd.c b/arch/arm64/mm/trans_pgd.c
index 527f0a39c3da..a1d936f9559f 100644
--- a/arch/arm64/mm/trans_pgd.c
+++ b/arch/arm64/mm/trans_pgd.c
@@ -217,63 +217,6 @@ int trans_pgd_create_copy(struct trans_pgd_info *info, pgd_t **dst_pgdp,
 	return rc;
 }
 
-/*
- * Add map entry to trans_pgd for a base-size page at PTE level.
- * info:	contains allocator and its argument
- * trans_pgd:	page table in which new map is added.
- * page:	page to be mapped.
- * dst_addr:	new VA address for the page
- * pgprot:	protection for the page.
- *
- * Returns 0 on success, and -ENOMEM on failure.
- */
-int trans_pgd_map_page(struct trans_pgd_info *info, pgd_t *trans_pgd,
-		       void *page, unsigned long dst_addr, pgprot_t pgprot)
-{
-	pgd_t *pgdp;
-	p4d_t *p4dp;
-	pud_t *pudp;
-	pmd_t *pmdp;
-	pte_t *ptep;
-
-	pgdp = pgd_offset_pgd(trans_pgd, dst_addr);
-	if (pgd_none(READ_ONCE(*pgdp))) {
-		p4dp = trans_alloc(info);
-		if (!pgdp)
-			return -ENOMEM;
-		pgd_populate(NULL, pgdp, p4dp);
-	}
-
-	p4dp = p4d_offset(pgdp, dst_addr);
-	if (p4d_none(READ_ONCE(*p4dp))) {
-		pudp = trans_alloc(info);
-		if (!pudp)
-			return -ENOMEM;
-		p4d_populate(NULL, p4dp, pudp);
-	}
-
-	pudp = pud_offset(p4dp, dst_addr);
-	if (pud_none(READ_ONCE(*pudp))) {
-		pmdp = trans_alloc(info);
-		if (!pmdp)
-			return -ENOMEM;
-		pud_populate(NULL, pudp, pmdp);
-	}
-
-	pmdp = pmd_offset(pudp, dst_addr);
-	if (pmd_none(READ_ONCE(*pmdp))) {
-		ptep = trans_alloc(info);
-		if (!ptep)
-			return -ENOMEM;
-		pmd_populate_kernel(NULL, pmdp, ptep);
-	}
-
-	ptep = pte_offset_kernel(pmdp, dst_addr);
-	set_pte(ptep, pfn_pte(virt_to_pfn(page), pgprot));
-
-	return 0;
-}
-
 /*
  * The page we want to idmap may be outside the range covered by VA_BITS that
  * can be built using the kernel's p?d_populate() helpers. As a one off, for a
-- 
2.29.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] arm64/mm: remove useless trans_pgd_map_page()
  2021-04-06 13:14 [PATCH] arm64/mm: remove useless trans_pgd_map_page() Pingfan Liu
@ 2021-04-06 16:58 ` Pavel Tatashin
  2021-04-07  6:00   ` Pingfan Liu
  0 siblings, 1 reply; 3+ messages in thread
From: Pavel Tatashin @ 2021-04-06 16:58 UTC (permalink / raw)
  To: Pingfan Liu
  Cc: Linux ARM, Catalin Marinas, Will Deacon, James Morse, Matthias Brugger

Hi Pingfan,

On Tue, Apr 6, 2021 at 9:14 AM Pingfan Liu <kernelfans@gmail.com> wrote:
>
> Since the commit 7018d467ff2d ("arm64: trans_pgd: hibernate: idmap the
> single page that holds the copy page routines"), trans_pgd_map_page() is
> useless.

Let's keep this function for now. This function is used in my version
11 of mmu enabled kexec patches; but not used in version 12 where we
changed to a linear map instead of contiguous map. However, until the
final solution for mmu-enabled kexec lands in the mainline, I think it
is better to keep it.

Thank you,
Pasha

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] arm64/mm: remove useless trans_pgd_map_page()
  2021-04-06 16:58 ` Pavel Tatashin
@ 2021-04-07  6:00   ` Pingfan Liu
  0 siblings, 0 replies; 3+ messages in thread
From: Pingfan Liu @ 2021-04-07  6:00 UTC (permalink / raw)
  To: Pavel Tatashin
  Cc: Linux ARM, Catalin Marinas, Will Deacon, James Morse, Matthias Brugger

On Wed, Apr 7, 2021 at 12:58 AM Pavel Tatashin
<pasha.tatashin@soleen.com> wrote:
>
> Hi Pingfan,
>
> On Tue, Apr 6, 2021 at 9:14 AM Pingfan Liu <kernelfans@gmail.com> wrote:
> >
> > Since the commit 7018d467ff2d ("arm64: trans_pgd: hibernate: idmap the
> > single page that holds the copy page routines"), trans_pgd_map_page() is
> > useless.
>
> Let's keep this function for now. This function is used in my version
> 11 of mmu enabled kexec patches; but not used in version 12 where we
> changed to a linear map instead of contiguous map. However, until the
> final solution for mmu-enabled kexec lands in the mainline, I think it
> is better to keep it.
>
Got it.

Thanks,
Pingfan

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-04-07  6:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-06 13:14 [PATCH] arm64/mm: remove useless trans_pgd_map_page() Pingfan Liu
2021-04-06 16:58 ` Pavel Tatashin
2021-04-07  6:00   ` Pingfan Liu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.