All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] riscv: Cleanup setup_bootmem()
@ 2021-02-09  1:01 Kefeng Wang
  2021-02-19  7:15 ` Palmer Dabbelt
  0 siblings, 1 reply; 4+ messages in thread
From: Kefeng Wang @ 2021-02-09  1:01 UTC (permalink / raw)
  To: palmer, linux-riscv
  Cc: atish.patra, Kefeng Wang, Palmer Dabbelt, Paul Walmsley

After the following patches,

  commit de043da0b9e7 ("RISC-V: Fix usage of memblock_enforce_memory_limit")
  commit 1bd14a66ee52 ("RISC-V: Remove any memblock representing unusable memory area")
  commit b10d6bca8720 ("arch, drivers: replace for_each_membock() with for_each_mem_range()")

some logic is useless, kill the mem_start/start/end and unneeded code.

Reviewed-by: Atish Patra <atish.patra@wdc.com>
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
v2:
- Update changelog and add RB.

 arch/riscv/mm/init.c | 21 ++-------------------
 1 file changed, 2 insertions(+), 19 deletions(-)

diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
index 0b86a1a12da2..241f22348403 100644
--- a/arch/riscv/mm/init.c
+++ b/arch/riscv/mm/init.c
@@ -108,34 +108,17 @@ void __init mem_init(void)
 
 void __init setup_bootmem(void)
 {
-	phys_addr_t mem_start = 0;
-	phys_addr_t start, dram_end, end = 0;
 	phys_addr_t vmlinux_end = __pa_symbol(&_end);
 	phys_addr_t vmlinux_start = __pa_symbol(&_start);
+	phys_addr_t dram_end = memblock_end_of_DRAM();
 	phys_addr_t max_mapped_addr = __pa(~(ulong)0);
-	u64 i;
-
-	/* Find the memory region containing the kernel */
-	for_each_mem_range(i, &start, &end) {
-		phys_addr_t size = end - start;
-		if (!mem_start)
-			mem_start = start;
-		if (start <= vmlinux_start && vmlinux_end <= end)
-			BUG_ON(size == 0);
-	}
 
-	/*
-	 * The maximal physical memory size is -PAGE_OFFSET.
-	 * Make sure that any memory beyond mem_start + (-PAGE_OFFSET) is removed
-	 * as it is unusable by kernel.
-	 */
+	/* The maximal physical memory size is -PAGE_OFFSET. */
 	memblock_enforce_memory_limit(-PAGE_OFFSET);
 
 	/* Reserve from the start of the kernel to the end of the kernel */
 	memblock_reserve(vmlinux_start, vmlinux_end - vmlinux_start);
 
-	dram_end = memblock_end_of_DRAM();
-
 	/*
 	 * memblock allocator is not aware of the fact that last 4K bytes of
 	 * the addressable memory can not be mapped because of IS_ERR_VALUE
-- 
2.26.2


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

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

* Re: [PATCH v2] riscv: Cleanup setup_bootmem()
  2021-02-09  1:01 [PATCH v2] riscv: Cleanup setup_bootmem() Kefeng Wang
@ 2021-02-19  7:15 ` Palmer Dabbelt
  2021-02-27  1:21   ` Kefeng Wang
  0 siblings, 1 reply; 4+ messages in thread
From: Palmer Dabbelt @ 2021-02-19  7:15 UTC (permalink / raw)
  To: wangkefeng.wang; +Cc: Atish Patra, linux-riscv, wangkefeng.wang, Paul Walmsley

On Mon, 08 Feb 2021 17:01:51 PST (-0800), wangkefeng.wang@huawei.com wrote:
> After the following patches,
>
>   commit de043da0b9e7 ("RISC-V: Fix usage of memblock_enforce_memory_limit")
>   commit 1bd14a66ee52 ("RISC-V: Remove any memblock representing unusable memory area")
>   commit b10d6bca8720 ("arch, drivers: replace for_each_membock() with for_each_mem_range()")
>
> some logic is useless, kill the mem_start/start/end and unneeded code.
>
> Reviewed-by: Atish Patra <atish.patra@wdc.com>
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> ---
> v2:
> - Update changelog and add RB.
>
>  arch/riscv/mm/init.c | 21 ++-------------------
>  1 file changed, 2 insertions(+), 19 deletions(-)
>
> diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
> index 0b86a1a12da2..241f22348403 100644
> --- a/arch/riscv/mm/init.c
> +++ b/arch/riscv/mm/init.c
> @@ -108,34 +108,17 @@ void __init mem_init(void)
>
>  void __init setup_bootmem(void)
>  {
> -	phys_addr_t mem_start = 0;
> -	phys_addr_t start, dram_end, end = 0;
>  	phys_addr_t vmlinux_end = __pa_symbol(&_end);
>  	phys_addr_t vmlinux_start = __pa_symbol(&_start);
> +	phys_addr_t dram_end = memblock_end_of_DRAM();
>  	phys_addr_t max_mapped_addr = __pa(~(ulong)0);
> -	u64 i;
> -
> -	/* Find the memory region containing the kernel */
> -	for_each_mem_range(i, &start, &end) {
> -		phys_addr_t size = end - start;
> -		if (!mem_start)
> -			mem_start = start;
> -		if (start <= vmlinux_start && vmlinux_end <= end)
> -			BUG_ON(size == 0);
> -	}
>
> -	/*
> -	 * The maximal physical memory size is -PAGE_OFFSET.
> -	 * Make sure that any memory beyond mem_start + (-PAGE_OFFSET) is removed
> -	 * as it is unusable by kernel.
> -	 */
> +	/* The maximal physical memory size is -PAGE_OFFSET. */
>  	memblock_enforce_memory_limit(-PAGE_OFFSET);
>
>  	/* Reserve from the start of the kernel to the end of the kernel */
>  	memblock_reserve(vmlinux_start, vmlinux_end - vmlinux_start);
>
> -	dram_end = memblock_end_of_DRAM();
> -
>  	/*
>  	 * memblock allocator is not aware of the fact that last 4K bytes of
>  	 * the addressable memory can not be mapped because of IS_ERR_VALUE

Thanks, this is on for-next.

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

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

* Re: [PATCH v2] riscv: Cleanup setup_bootmem()
  2021-02-19  7:15 ` Palmer Dabbelt
@ 2021-02-27  1:21   ` Kefeng Wang
  2021-02-27  5:26     ` Palmer Dabbelt
  0 siblings, 1 reply; 4+ messages in thread
From: Kefeng Wang @ 2021-02-27  1:21 UTC (permalink / raw)
  To: Palmer Dabbelt; +Cc: Atish Patra, linux-riscv, Paul Walmsley


On 2021/2/19 15:15, Palmer Dabbelt wrote:
> On Mon, 08 Feb 2021 17:01:51 PST (-0800), wangkefeng.wang@huawei.com 
> wrote:
>> After the following patches,
>>
>>   commit de043da0b9e7 ("RISC-V: Fix usage of 
>> memblock_enforce_memory_limit")
>>   commit 1bd14a66ee52 ("RISC-V: Remove any memblock representing 
>> unusable memory area")
>>   commit b10d6bca8720 ("arch, drivers: replace for_each_membock() 
>> with for_each_mem_range()")
>>
>> some logic is useless, kill the mem_start/start/end and unneeded code.
>>
>> Reviewed-by: Atish Patra <atish.patra@wdc.com>
>> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
>>
...
>
> Thanks, this is on for-next.
Hi Palmer, maybe this one is missed?
> .
>

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

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

* Re: [PATCH v2] riscv: Cleanup setup_bootmem()
  2021-02-27  1:21   ` Kefeng Wang
@ 2021-02-27  5:26     ` Palmer Dabbelt
  0 siblings, 0 replies; 4+ messages in thread
From: Palmer Dabbelt @ 2021-02-27  5:26 UTC (permalink / raw)
  To: wangkefeng.wang; +Cc: Atish Patra, linux-riscv, Paul Walmsley

On Fri, 26 Feb 2021 17:21:00 PST (-0800), wangkefeng.wang@huawei.com wrote:
>
> On 2021/2/19 15:15, Palmer Dabbelt wrote:
>> On Mon, 08 Feb 2021 17:01:51 PST (-0800), wangkefeng.wang@huawei.com
>> wrote:
>>> After the following patches,
>>>
>>>   commit de043da0b9e7 ("RISC-V: Fix usage of
>>> memblock_enforce_memory_limit")
>>>   commit 1bd14a66ee52 ("RISC-V: Remove any memblock representing
>>> unusable memory area")
>>>   commit b10d6bca8720 ("arch, drivers: replace for_each_membock()
>>> with for_each_mem_range()")
>>>
>>> some logic is useless, kill the mem_start/start/end and unneeded code.
>>>
>>> Reviewed-by: Atish Patra <atish.patra@wdc.com>
>>> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
>>>
> ...
>>
>> Thanks, this is on for-next.
> Hi Palmer, maybe this one is missed?

Sorry about that, I'll sent it up tomorrow.

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

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

end of thread, other threads:[~2021-02-27  5:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-09  1:01 [PATCH v2] riscv: Cleanup setup_bootmem() Kefeng Wang
2021-02-19  7:15 ` Palmer Dabbelt
2021-02-27  1:21   ` Kefeng Wang
2021-02-27  5:26     ` Palmer Dabbelt

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.