linux-riscv.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] riscv: Implement free_initrd_mem.
@ 2018-02-20 13:50 Shea Levy
  2018-02-20 13:57 ` [PATCH v2] " Shea Levy
  2018-02-23  0:41 ` [PATCH] " Palmer Dabbelt
  0 siblings, 2 replies; 7+ messages in thread
From: Shea Levy @ 2018-02-20 13:50 UTC (permalink / raw)
  To: linux-riscv

Signed-off-by: Shea Levy <shea@shealevy.com>
---
 arch/riscv/mm/init.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
index c77df8142be2..1c832b541e95 100644
--- a/arch/riscv/mm/init.c
+++ b/arch/riscv/mm/init.c
@@ -66,5 +66,11 @@ void free_initmem(void)
 #ifdef CONFIG_BLK_DEV_INITRD
 void free_initrd_mem(unsigned long start, unsigned long end)
 {
+	if (start == initrd_start)
+		start = round_down(start, PAGE_SIZE);
+	if (end == initrd_end)
+		end = round_up(end, PAGE_SIZE);
+
+	free_reserved_area((void *)start, (void *)end, -1, "initrd");
 }
 #endif /* CONFIG_BLK_DEV_INITRD */
-- 
2.16.1

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

* [PATCH v2] riscv: Implement free_initrd_mem.
  2018-02-20 13:50 [PATCH] riscv: Implement free_initrd_mem Shea Levy
@ 2018-02-20 13:57 ` Shea Levy
  2018-02-23  0:41 ` [PATCH] " Palmer Dabbelt
  1 sibling, 0 replies; 7+ messages in thread
From: Shea Levy @ 2018-02-20 13:57 UTC (permalink / raw)
  To: linux-riscv

v2: Remove incorrect page alignment.

Signed-off-by: Shea Levy <shea@shealevy.com>
---
 arch/riscv/mm/init.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
index c77df8142be2..1b6daa5184e0 100644
--- a/arch/riscv/mm/init.c
+++ b/arch/riscv/mm/init.c
@@ -66,5 +66,6 @@ void free_initmem(void)
 #ifdef CONFIG_BLK_DEV_INITRD
 void free_initrd_mem(unsigned long start, unsigned long end)
 {
+	free_reserved_area((void *)start, (void *)end, -1, "initrd");
 }
 #endif /* CONFIG_BLK_DEV_INITRD */
-- 
2.16.1

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

* [PATCH] riscv: Implement free_initrd_mem.
  2018-02-20 13:50 [PATCH] riscv: Implement free_initrd_mem Shea Levy
  2018-02-20 13:57 ` [PATCH v2] " Shea Levy
@ 2018-02-23  0:41 ` Palmer Dabbelt
  2018-03-08 19:14   ` Shea Levy
  1 sibling, 1 reply; 7+ messages in thread
From: Palmer Dabbelt @ 2018-02-23  0:41 UTC (permalink / raw)
  To: linux-riscv

On Tue, 20 Feb 2018 05:50:43 PST (-0800), shea at shealevy.com wrote:
> Signed-off-by: Shea Levy <shea@shealevy.com>
> ---
>  arch/riscv/mm/init.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
> index c77df8142be2..1c832b541e95 100644
> --- a/arch/riscv/mm/init.c
> +++ b/arch/riscv/mm/init.c
> @@ -66,5 +66,11 @@ void free_initmem(void)
>  #ifdef CONFIG_BLK_DEV_INITRD
>  void free_initrd_mem(unsigned long start, unsigned long end)
>  {
> +	if (start == initrd_start)
> +		start = round_down(start, PAGE_SIZE);
> +	if (end == initrd_end)
> +		end = round_up(end, PAGE_SIZE);
> +
> +	free_reserved_area((void *)start, (void *)end, -1, "initrd");
>  }
>  #endif /* CONFIG_BLK_DEV_INITRD */

It looks like everyone is doing something slightly different here:

* arm64 doesn't round to a page size, and has keep_initrd.
* arm calls poison_init_mem(), and has keep_initrd.
* sparc64 doesn't round, and doesn't have a keep_initrd.
* mips doesn't round, and doesn't have a keep_initrd.
* x86 rounds end to a page size but not start, and doesn't have a keep_initrd.

It feels like this should be something generic.  I'm adding linux-kernel to see 
what people think.

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

* [PATCH] riscv: Implement free_initrd_mem.
  2018-02-23  0:41 ` [PATCH] " Palmer Dabbelt
@ 2018-03-08 19:14   ` Shea Levy
  2018-03-08 19:35     ` Palmer Dabbelt
  0 siblings, 1 reply; 7+ messages in thread
From: Shea Levy @ 2018-03-08 19:14 UTC (permalink / raw)
  To: linux-riscv

Hi Palmer,

Palmer Dabbelt <palmer@sifive.com> writes:

> On Tue, 20 Feb 2018 05:50:43 PST (-0800), shea at shealevy.com wrote:
>> Signed-off-by: Shea Levy <shea@shealevy.com>
>> ---
>>  arch/riscv/mm/init.c | 6 ++++++
>>  1 file changed, 6 insertions(+)
>>
>> diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
>> index c77df8142be2..1c832b541e95 100644
>> --- a/arch/riscv/mm/init.c
>> +++ b/arch/riscv/mm/init.c
>> @@ -66,5 +66,11 @@ void free_initmem(void)
>>  #ifdef CONFIG_BLK_DEV_INITRD
>>  void free_initrd_mem(unsigned long start, unsigned long end)
>>  {
>> +	if (start == initrd_start)
>> +		start = round_down(start, PAGE_SIZE);
>> +	if (end == initrd_end)
>> +		end = round_up(end, PAGE_SIZE);
>> +
>> +	free_reserved_area((void *)start, (void *)end, -1, "initrd");
>>  }
>>  #endif /* CONFIG_BLK_DEV_INITRD */
>
> It looks like everyone is doing something slightly different here:
>
> * arm64 doesn't round to a page size, and has keep_initrd.
> * arm calls poison_init_mem(), and has keep_initrd.
> * sparc64 doesn't round, and doesn't have a keep_initrd.
> * mips doesn't round, and doesn't have a keep_initrd.
> * x86 rounds end to a page size but not start, and doesn't have a keep_initrd.
>
> It feels like this should be something generic.  I'm adding linux-kernel to see 
> what people think.

Should I try to whip up something generic?

Thanks,
Shea
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-riscv/attachments/20180308/74bf8d50/attachment.sig>

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

* [PATCH] riscv: Implement free_initrd_mem.
  2018-03-08 19:14   ` Shea Levy
@ 2018-03-08 19:35     ` Palmer Dabbelt
  2018-03-08 19:47       ` Shea Levy
  0 siblings, 1 reply; 7+ messages in thread
From: Palmer Dabbelt @ 2018-03-08 19:35 UTC (permalink / raw)
  To: linux-riscv

On Thu, 08 Mar 2018 11:14:52 PST (-0800), shea at shealevy.com wrote:
> Hi Palmer,
>
> Palmer Dabbelt <palmer@sifive.com> writes:
>
>> On Tue, 20 Feb 2018 05:50:43 PST (-0800), shea at shealevy.com wrote:
>>> Signed-off-by: Shea Levy <shea@shealevy.com>
>>> ---
>>>  arch/riscv/mm/init.c | 6 ++++++
>>>  1 file changed, 6 insertions(+)
>>>
>>> diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
>>> index c77df8142be2..1c832b541e95 100644
>>> --- a/arch/riscv/mm/init.c
>>> +++ b/arch/riscv/mm/init.c
>>> @@ -66,5 +66,11 @@ void free_initmem(void)
>>>  #ifdef CONFIG_BLK_DEV_INITRD
>>>  void free_initrd_mem(unsigned long start, unsigned long end)
>>>  {
>>> +	if (start == initrd_start)
>>> +		start = round_down(start, PAGE_SIZE);
>>> +	if (end == initrd_end)
>>> +		end = round_up(end, PAGE_SIZE);
>>> +
>>> +	free_reserved_area((void *)start, (void *)end, -1, "initrd");
>>>  }
>>>  #endif /* CONFIG_BLK_DEV_INITRD */
>>
>> It looks like everyone is doing something slightly different here:
>>
>> * arm64 doesn't round to a page size, and has keep_initrd.
>> * arm calls poison_init_mem(), and has keep_initrd.
>> * sparc64 doesn't round, and doesn't have a keep_initrd.
>> * mips doesn't round, and doesn't have a keep_initrd.
>> * x86 rounds end to a page size but not start, and doesn't have a keep_initrd.
>>
>> It feels like this should be something generic.  I'm adding linux-kernel to see 
>> what people think.
>
> Should I try to whip up something generic?

I think that'd be best.  Nobody has said anything specific, but it's generally 
been suggested to take bits that we copy into our port and make them generic.  
If there's no clean way do to so then I'm OK taking this, though.

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

* [PATCH] riscv: Implement free_initrd_mem.
  2018-03-08 19:35     ` Palmer Dabbelt
@ 2018-03-08 19:47       ` Shea Levy
  2018-03-08 20:31         ` Palmer Dabbelt
  0 siblings, 1 reply; 7+ messages in thread
From: Shea Levy @ 2018-03-08 19:47 UTC (permalink / raw)
  To: linux-riscv

Palmer Dabbelt <palmer@sifive.com> writes:

> On Thu, 08 Mar 2018 11:14:52 PST (-0800), shea at shealevy.com wrote:
>> Hi Palmer,
>>
>> Palmer Dabbelt <palmer@sifive.com> writes:
>>
>>> On Tue, 20 Feb 2018 05:50:43 PST (-0800), shea at shealevy.com wrote:
>>>> Signed-off-by: Shea Levy <shea@shealevy.com>
>>>> ---
>>>>  arch/riscv/mm/init.c | 6 ++++++
>>>>  1 file changed, 6 insertions(+)
>>>>
>>>> diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
>>>> index c77df8142be2..1c832b541e95 100644
>>>> --- a/arch/riscv/mm/init.c
>>>> +++ b/arch/riscv/mm/init.c
>>>> @@ -66,5 +66,11 @@ void free_initmem(void)
>>>>  #ifdef CONFIG_BLK_DEV_INITRD
>>>>  void free_initrd_mem(unsigned long start, unsigned long end)
>>>>  {
>>>> +	if (start == initrd_start)
>>>> +		start = round_down(start, PAGE_SIZE);
>>>> +	if (end == initrd_end)
>>>> +		end = round_up(end, PAGE_SIZE);
>>>> +
>>>> +	free_reserved_area((void *)start, (void *)end, -1, "initrd");
>>>>  }
>>>>  #endif /* CONFIG_BLK_DEV_INITRD */
>>>
>>> It looks like everyone is doing something slightly different here:
>>>
>>> * arm64 doesn't round to a page size, and has keep_initrd.
>>> * arm calls poison_init_mem(), and has keep_initrd.
>>> * sparc64 doesn't round, and doesn't have a keep_initrd.
>>> * mips doesn't round, and doesn't have a keep_initrd.
>>> * x86 rounds end to a page size but not start, and doesn't have a keep_initrd.
>>>
>>> It feels like this should be something generic.  I'm adding linux-kernel to see 
>>> what people think.
>>
>> Should I try to whip up something generic?
>
> I think that'd be best.  Nobody has said anything specific, but it's generally 
> been suggested to take bits that we copy into our port and make them generic.  
> If there's no clean way do to so then I'm OK taking this, though.

OK, will add it to my queue.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-riscv/attachments/20180308/1ab4f3cb/attachment.sig>

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

* [PATCH] riscv: Implement free_initrd_mem.
  2018-03-08 19:47       ` Shea Levy
@ 2018-03-08 20:31         ` Palmer Dabbelt
  0 siblings, 0 replies; 7+ messages in thread
From: Palmer Dabbelt @ 2018-03-08 20:31 UTC (permalink / raw)
  To: linux-riscv

On Thu, 08 Mar 2018 11:47:08 PST (-0800), shea at shealevy.com wrote:
> Palmer Dabbelt <palmer@sifive.com> writes:
>
>> On Thu, 08 Mar 2018 11:14:52 PST (-0800), shea at shealevy.com wrote:
>>> Hi Palmer,
>>>
>>> Palmer Dabbelt <palmer@sifive.com> writes:
>>>
>>>> On Tue, 20 Feb 2018 05:50:43 PST (-0800), shea at shealevy.com wrote:
>>>>> Signed-off-by: Shea Levy <shea@shealevy.com>
>>>>> ---
>>>>>  arch/riscv/mm/init.c | 6 ++++++
>>>>>  1 file changed, 6 insertions(+)
>>>>>
>>>>> diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
>>>>> index c77df8142be2..1c832b541e95 100644
>>>>> --- a/arch/riscv/mm/init.c
>>>>> +++ b/arch/riscv/mm/init.c
>>>>> @@ -66,5 +66,11 @@ void free_initmem(void)
>>>>>  #ifdef CONFIG_BLK_DEV_INITRD
>>>>>  void free_initrd_mem(unsigned long start, unsigned long end)
>>>>>  {
>>>>> +	if (start == initrd_start)
>>>>> +		start = round_down(start, PAGE_SIZE);
>>>>> +	if (end == initrd_end)
>>>>> +		end = round_up(end, PAGE_SIZE);
>>>>> +
>>>>> +	free_reserved_area((void *)start, (void *)end, -1, "initrd");
>>>>>  }
>>>>>  #endif /* CONFIG_BLK_DEV_INITRD */
>>>>
>>>> It looks like everyone is doing something slightly different here:
>>>>
>>>> * arm64 doesn't round to a page size, and has keep_initrd.
>>>> * arm calls poison_init_mem(), and has keep_initrd.
>>>> * sparc64 doesn't round, and doesn't have a keep_initrd.
>>>> * mips doesn't round, and doesn't have a keep_initrd.
>>>> * x86 rounds end to a page size but not start, and doesn't have a keep_initrd.
>>>>
>>>> It feels like this should be something generic.  I'm adding linux-kernel to see 
>>>> what people think.
>>>
>>> Should I try to whip up something generic?
>>
>> I think that'd be best.  Nobody has said anything specific, but it's generally 
>> been suggested to take bits that we copy into our port and make them generic.  
>> If there's no clean way do to so then I'm OK taking this, though.
>
> OK, will add it to my queue.

Thanks!

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

end of thread, other threads:[~2018-03-08 20:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-20 13:50 [PATCH] riscv: Implement free_initrd_mem Shea Levy
2018-02-20 13:57 ` [PATCH v2] " Shea Levy
2018-02-23  0:41 ` [PATCH] " Palmer Dabbelt
2018-03-08 19:14   ` Shea Levy
2018-03-08 19:35     ` Palmer Dabbelt
2018-03-08 19:47       ` Shea Levy
2018-03-08 20:31         ` Palmer Dabbelt

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).