* [PATCH v2] riscv: Use PMD_SIZE to repalce PTE_PARENT_SIZE
@ 2019-11-05 2:20 ` Zong Li
0 siblings, 0 replies; 10+ messages in thread
From: Zong Li @ 2019-11-05 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 | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
index 573463d..642b330 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
@@ -316,10 +314,10 @@ 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;
+ /* Upgrade to PMD_SIZE mappings whenever possible */
+ if (!(base & (PMD_SIZE - 1)) &&
+ !(size & (PMD_SIZE - 1)))
+ map_size = PMD_SIZE;
return map_size;
}
--
2.7.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v2] riscv: Use PMD_SIZE to repalce PTE_PARENT_SIZE
@ 2019-11-05 2:20 ` Zong Li
0 siblings, 0 replies; 10+ messages in thread
From: Zong Li @ 2019-11-05 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 | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
index 573463d..642b330 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
@@ -316,10 +314,10 @@ 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;
+ /* Upgrade to PMD_SIZE mappings whenever possible */
+ 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] 10+ messages in thread
* Re: [PATCH v2] riscv: Use PMD_SIZE to repalce PTE_PARENT_SIZE
2019-11-05 2:20 ` Zong Li
@ 2019-11-05 3:21 ` Anup Patel
-1 siblings, 0 replies; 10+ messages in thread
From: Anup Patel @ 2019-11-05 3:21 UTC (permalink / raw)
To: Zong Li
Cc: linux-kernel@vger.kernel.org List, linux-riscv, Paul Walmsley,
Palmer Dabbelt, Anup Patel
On Tue, Nov 5, 2019 at 7:50 AM Zong Li <zong.li@sifive.com> wrote:
>
> 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 | 10 ++++------
> 1 file changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
> index 573463d..642b330 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
>
> @@ -316,10 +314,10 @@ 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;
> + /* Upgrade to PMD_SIZE mappings whenever possible */
> + if (!(base & (PMD_SIZE - 1)) &&
> + !(size & (PMD_SIZE - 1)))
> + map_size = PMD_SIZE;
>
> return map_size;
> }
> --
> 2.7.4
>
LGTM.
Reviewed-by: Anup Patel <anup@brainfault.org>
Regards,
Anup
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2] riscv: Use PMD_SIZE to repalce PTE_PARENT_SIZE
@ 2019-11-05 3:21 ` Anup Patel
0 siblings, 0 replies; 10+ messages in thread
From: Anup Patel @ 2019-11-05 3:21 UTC (permalink / raw)
To: Zong Li
Cc: Anup Patel, linux-riscv, Palmer Dabbelt,
linux-kernel@vger.kernel.org List, Paul Walmsley
On Tue, Nov 5, 2019 at 7:50 AM Zong Li <zong.li@sifive.com> wrote:
>
> 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 | 10 ++++------
> 1 file changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
> index 573463d..642b330 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
>
> @@ -316,10 +314,10 @@ 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;
> + /* Upgrade to PMD_SIZE mappings whenever possible */
> + if (!(base & (PMD_SIZE - 1)) &&
> + !(size & (PMD_SIZE - 1)))
> + map_size = PMD_SIZE;
>
> return map_size;
> }
> --
> 2.7.4
>
LGTM.
Reviewed-by: Anup Patel <anup@brainfault.org>
Regards,
Anup
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2] riscv: Use PMD_SIZE to repalce PTE_PARENT_SIZE
2019-11-05 2:20 ` Zong Li
@ 2019-11-06 19:00 ` Paul Walmsley
-1 siblings, 0 replies; 10+ messages in thread
From: Paul Walmsley @ 2019-11-06 19:00 UTC (permalink / raw)
To: Zong Li; +Cc: linux-kernel, linux-riscv, palmer, Anup.Patel
On Mon, 4 Nov 2019, Zong Li wrote:
> The PMD_SIZE is equal to PGDIR_SIZE when __PAGETABLE_PMD_FOLDED is
> defined.
>
> Signed-off-by: Zong Li <zong.li@sifive.com>
Thanks, queued for v5.5-rc1 with Anup's Reviewed-by:.
- Paul
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2] riscv: Use PMD_SIZE to repalce PTE_PARENT_SIZE
@ 2019-11-06 19:00 ` Paul Walmsley
0 siblings, 0 replies; 10+ messages in thread
From: Paul Walmsley @ 2019-11-06 19:00 UTC (permalink / raw)
To: Zong Li; +Cc: Anup.Patel, linux-riscv, palmer, linux-kernel
On Mon, 4 Nov 2019, Zong Li wrote:
> The PMD_SIZE is equal to PGDIR_SIZE when __PAGETABLE_PMD_FOLDED is
> defined.
>
> Signed-off-by: Zong Li <zong.li@sifive.com>
Thanks, queued for v5.5-rc1 with Anup's Reviewed-by:.
- Paul
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2] riscv: Use PMD_SIZE to repalce PTE_PARENT_SIZE
2019-11-05 2:20 ` Zong Li
@ 2019-11-08 7:25 ` Christoph Hellwig
-1 siblings, 0 replies; 10+ messages in thread
From: Christoph Hellwig @ 2019-11-08 7:25 UTC (permalink / raw)
To: Zong Li; +Cc: linux-kernel, linux-riscv, paul.walmsley, palmer, Anup.Patel
On Mon, Nov 04, 2019 at 06:20:12PM -0800, Zong Li wrote:
> 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;
> + /* Upgrade to PMD_SIZE mappings whenever possible */
> + if (!(base & (PMD_SIZE - 1)) &&
> + !(size & (PMD_SIZE - 1)))
> + map_size = PMD_SIZE;
The check easily fits onto a single line now. Also the map_size
variable is rather pointless. Why not:
if ((base & (PMD_SIZE - 1) || (size & (PMD_SIZE - 1)))
return PAGE_SIZE;
return PMD_SIZE;
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2] riscv: Use PMD_SIZE to repalce PTE_PARENT_SIZE
@ 2019-11-08 7:25 ` Christoph Hellwig
0 siblings, 0 replies; 10+ messages in thread
From: Christoph Hellwig @ 2019-11-08 7:25 UTC (permalink / raw)
To: Zong Li; +Cc: Anup.Patel, linux-riscv, palmer, linux-kernel, paul.walmsley
On Mon, Nov 04, 2019 at 06:20:12PM -0800, Zong Li wrote:
> 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;
> + /* Upgrade to PMD_SIZE mappings whenever possible */
> + if (!(base & (PMD_SIZE - 1)) &&
> + !(size & (PMD_SIZE - 1)))
> + map_size = PMD_SIZE;
The check easily fits onto a single line now. Also the map_size
variable is rather pointless. Why not:
if ((base & (PMD_SIZE - 1) || (size & (PMD_SIZE - 1)))
return PAGE_SIZE;
return PMD_SIZE;
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2] riscv: Use PMD_SIZE to repalce PTE_PARENT_SIZE
2019-11-08 7:25 ` Christoph Hellwig
@ 2019-11-08 8:50 ` Zong Li
-1 siblings, 0 replies; 10+ messages in thread
From: Zong Li @ 2019-11-08 8:50 UTC (permalink / raw)
To: Christoph Hellwig
Cc: linux-kernel, linux-riscv, Paul Walmsley, Palmer Dabbelt, Anup Patel
On Fri, Nov 8, 2019 at 3:25 PM Christoph Hellwig <hch@infradead.org> wrote:
>
> On Mon, Nov 04, 2019 at 06:20:12PM -0800, Zong Li wrote:
> > 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;
> > + /* Upgrade to PMD_SIZE mappings whenever possible */
> > + if (!(base & (PMD_SIZE - 1)) &&
> > + !(size & (PMD_SIZE - 1)))
> > + map_size = PMD_SIZE;
>
> The check easily fits onto a single line now. Also the map_size
> variable is rather pointless. Why not:
>
> if ((base & (PMD_SIZE - 1) || (size & (PMD_SIZE - 1)))
> return PAGE_SIZE;
> return PMD_SIZE;
Yes, Use positive representation is more clear to me. Change it in next version.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2] riscv: Use PMD_SIZE to repalce PTE_PARENT_SIZE
@ 2019-11-08 8:50 ` Zong Li
0 siblings, 0 replies; 10+ messages in thread
From: Zong Li @ 2019-11-08 8:50 UTC (permalink / raw)
To: Christoph Hellwig
Cc: Anup Patel, linux-riscv, Palmer Dabbelt, linux-kernel, Paul Walmsley
On Fri, Nov 8, 2019 at 3:25 PM Christoph Hellwig <hch@infradead.org> wrote:
>
> On Mon, Nov 04, 2019 at 06:20:12PM -0800, Zong Li wrote:
> > 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;
> > + /* Upgrade to PMD_SIZE mappings whenever possible */
> > + if (!(base & (PMD_SIZE - 1)) &&
> > + !(size & (PMD_SIZE - 1)))
> > + map_size = PMD_SIZE;
>
> The check easily fits onto a single line now. Also the map_size
> variable is rather pointless. Why not:
>
> if ((base & (PMD_SIZE - 1) || (size & (PMD_SIZE - 1)))
> return PAGE_SIZE;
> return PMD_SIZE;
Yes, Use positive representation is more clear to me. Change it in next version.
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2019-11-08 8:51 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-05 2:20 [PATCH v2] riscv: Use PMD_SIZE to repalce PTE_PARENT_SIZE Zong Li
2019-11-05 2:20 ` Zong Li
2019-11-05 3:21 ` Anup Patel
2019-11-05 3:21 ` Anup Patel
2019-11-06 19:00 ` Paul Walmsley
2019-11-06 19:00 ` Paul Walmsley
2019-11-08 7:25 ` Christoph Hellwig
2019-11-08 7:25 ` Christoph Hellwig
2019-11-08 8:50 ` Zong Li
2019-11-08 8:50 ` Zong Li
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.