* [PATCH] riscv: Use PMD_SIZE to repalce PTE_PARENT_SIZE
@ 2019-11-01 2:20 Zong Li
2019-11-01 2:42 ` Zong Li
0 siblings, 1 reply; 2+ messages in thread
From: Zong Li @ 2019-11-01 2:20 UTC (permalink / raw)
To: linux-kernel, linux-riscv, paul.walmsley, palmer, Anup.Patel; +Cc: Zong Li
The PMD_SIZE is equal to PGDIR_SIZE when __PAGETABLE_PMD_FOLDED is
defined.
Signed-off-by: Zong Li <zong.li@sifive.com>
---
arch/riscv/mm/init.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
index 573463d..9a9b01a 100644
--- a/arch/riscv/mm/init.c
+++ b/arch/riscv/mm/init.c
@@ -273,7 +273,6 @@ static void __init create_pmd_mapping(pmd_t *pmdp,
#define get_pgd_next_virt(__pa) get_pmd_virt(__pa)
#define create_pgd_next_mapping(__nextp, __va, __pa, __sz, __prot) \
create_pmd_mapping(__nextp, __va, __pa, __sz, __prot)
-#define PTE_PARENT_SIZE PMD_SIZE
#define fixmap_pgd_next fixmap_pmd
#else
#define pgd_next_t pte_t
@@ -281,7 +280,6 @@ static void __init create_pmd_mapping(pmd_t *pmdp,
#define get_pgd_next_virt(__pa) get_pte_virt(__pa)
#define create_pgd_next_mapping(__nextp, __va, __pa, __sz, __prot) \
create_pte_mapping(__nextp, __va, __pa, __sz, __prot)
-#define PTE_PARENT_SIZE PGDIR_SIZE
#define fixmap_pgd_next fixmap_pte
#endif
@@ -317,9 +315,9 @@ static uintptr_t __init best_map_size(phys_addr_t base, phys_addr_t size)
uintptr_t map_size = PAGE_SIZE;
/* Upgrade to PMD/PGDIR mappings whenever possible */
- if (!(base & (PTE_PARENT_SIZE - 1)) &&
- !(size & (PTE_PARENT_SIZE - 1)))
- map_size = PTE_PARENT_SIZE;
+ if (!(base & (PMD_SIZE - 1)) &&
+ !(size & (PMD_SIZE - 1)))
+ map_size = PMD_SIZE;
return map_size;
}
--
2.7.4
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] riscv: Use PMD_SIZE to repalce PTE_PARENT_SIZE
2019-11-01 2:20 [PATCH] riscv: Use PMD_SIZE to repalce PTE_PARENT_SIZE Zong Li
@ 2019-11-01 2:42 ` Zong Li
0 siblings, 0 replies; 2+ messages in thread
From: Zong Li @ 2019-11-01 2:42 UTC (permalink / raw)
To: Zong Li
Cc: Anup Patel, linux-riscv, Palmer Dabbelt,
Linux Kernel Mailing List, Paul Walmsley
Zong Li <zong.li@sifive.com> 於 2019年11月1日 週五 上午10:20寫道:
>
> The PMD_SIZE is equal to PGDIR_SIZE when __PAGETABLE_PMD_FOLDED is
> defined.
>
> Signed-off-by: Zong Li <zong.li@sifive.com>
> ---
> arch/riscv/mm/init.c | 8 +++-----
> 1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
> index 573463d..9a9b01a 100644
> --- a/arch/riscv/mm/init.c
> +++ b/arch/riscv/mm/init.c
> @@ -273,7 +273,6 @@ static void __init create_pmd_mapping(pmd_t *pmdp,
> #define get_pgd_next_virt(__pa) get_pmd_virt(__pa)
> #define create_pgd_next_mapping(__nextp, __va, __pa, __sz, __prot) \
> create_pmd_mapping(__nextp, __va, __pa, __sz, __prot)
> -#define PTE_PARENT_SIZE PMD_SIZE
> #define fixmap_pgd_next fixmap_pmd
> #else
> #define pgd_next_t pte_t
> @@ -281,7 +280,6 @@ static void __init create_pmd_mapping(pmd_t *pmdp,
> #define get_pgd_next_virt(__pa) get_pte_virt(__pa)
> #define create_pgd_next_mapping(__nextp, __va, __pa, __sz, __prot) \
> create_pte_mapping(__nextp, __va, __pa, __sz, __prot)
> -#define PTE_PARENT_SIZE PGDIR_SIZE
> #define fixmap_pgd_next fixmap_pte
> #endif
>
> @@ -317,9 +315,9 @@ static uintptr_t __init best_map_size(phys_addr_t base, phys_addr_t size)
> uintptr_t map_size = PAGE_SIZE;
>
> /* Upgrade to PMD/PGDIR mappings whenever possible */
This comment should be fixed also. this patch needs the next version.
> - if (!(base & (PTE_PARENT_SIZE - 1)) &&
> - !(size & (PTE_PARENT_SIZE - 1)))
> - map_size = PTE_PARENT_SIZE;
> + if (!(base & (PMD_SIZE - 1)) &&
> + !(size & (PMD_SIZE - 1)))
> + map_size = PMD_SIZE;
>
> return map_size;
> }
> --
> 2.7.4
>
>
> _______________________________________________
> linux-riscv mailing list
> linux-riscv@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-11-01 2:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-01 2:20 [PATCH] riscv: Use PMD_SIZE to repalce PTE_PARENT_SIZE Zong Li
2019-11-01 2:42 ` Zong Li
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).