All of lore.kernel.org
 help / color / mirror / Atom feed
From: Punit Agrawal <punit.agrawal@bytedance.com>
To: palmer@dabbelt.com
Cc: Yunhui Cui <cuiyunhui@bytedance.com>,
	rppt@kernel.org, paul.walmsley@sifive.com,
	 aou@eecs.berkeley.edu, alexghiti@rivosinc.com,
	 akpm@linux-foundation.org,  bhe@redhat.com,
	dawei.li@shingroup.cn,  jszhang@kernel.org,
	 namcao@linutronix.de, chenjiahao16@huawei.com,
	 bjorn@rivosinc.com, vishal.moola@gmail.com,
	 linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
	Charlie Jenkins <charlie@rivosinc.com>
Subject: Re: [PATCH v2] RISC-V: cmdline: Add support for 'memmap' parameter
Date: Mon, 22 Jul 2024 22:13:14 +0100	[thread overview]
Message-ID: <874j8hku51.fsf@gmail.com> (raw)
In-Reply-To: <ZoXEmryf8RuLMZWN@ghost> (Charlie Jenkins's message of "Wed, 3 Jul 2024 14:37:30 -0700")

Hi Palmer,

Charlie Jenkins <charlie@rivosinc.com> writes:

> On Mon, Jun 24, 2024 at 08:37:39PM +0800, Yunhui Cui wrote:
>> Add parsing of 'memmap' to use or reserve a specific region of memory.
>> 
>> Implement the following memmap variants:
>> - memmap=nn[KMG]@ss[KMG]: force usage of a specific region of memory;
>> - memmap=nn[KMG]$ss[KMG]: mark specified memory as reserved;
>> 
>> Signed-off-by: Yunhui Cui <cuiyunhui@bytedance.com>
>> ---
>>  arch/riscv/mm/init.c | 46 ++++++++++++++++++++++++++++++++++++++++++++
>>  1 file changed, 46 insertions(+)
>> 
>> diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
>> index e3405e4b99af..8e1d93ae5cb2 100644
>> --- a/arch/riscv/mm/init.c
>> +++ b/arch/riscv/mm/init.c
>> @@ -208,6 +208,52 @@ static int __init early_mem(char *p)
>>  }
>>  early_param("mem", early_mem);
>>  
>> +static void __init parse_memmap_one(char *p)
>> +{
>> +	char *oldp;
>> +	unsigned long start_at, mem_size;
>> +
>> +	if (!p)
>> +		return;
>> +
>> +	oldp = p;
>> +	mem_size = memparse(p, &p);
>> +	if (p == oldp)
>> +		return;
>> +
>> +	switch (*p) {
>> +	case '@':
>> +		start_at = memparse(p + 1, &p);
>> +		memblock_add(start_at, mem_size);
>> +		break;
>> +
>> +	case '$':
>> +		start_at = memparse(p + 1, &p);
>> +		memblock_reserve(start_at, mem_size);
>> +		break;
>> +
>> +	default:
>> +		pr_warn("Unrecognized memmap syntax: %s\n", p);
>> +		break;
>> +	}
>> +}
>> +
>> +static int __init parse_memmap_opt(char *str)
>> +{
>> +	while (str) {
>> +		char *k = strchr(str, ',');
>> +
>> +		if (k)
>> +			*k++ = 0;
>> +
>> +		parse_memmap_one(str);
>> +		str = k;
>> +	}
>> +
>> +	return 0;
>> +}
>> +early_param("memmap", parse_memmap_opt);
>> +
>>  static void __init setup_bootmem(void)
>>  {
>>  	phys_addr_t vmlinux_end = __pa_symbol(&_end);
>> -- 
>> 2.20.1
>> 
>
> Reviewed-by: Charlie Jenkins <charlie@rivosinc.com>

Another patch that looks good to get merged if there are no further
comments.

Any chance this can be picked up for this cycle?

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

WARNING: multiple messages have this Message-ID (diff)
From: Punit Agrawal <punit.agrawal@bytedance.com>
To: palmer@dabbelt.com
Cc: Yunhui Cui <cuiyunhui@bytedance.com>,
	rppt@kernel.org, paul.walmsley@sifive.com,
	 aou@eecs.berkeley.edu, alexghiti@rivosinc.com,
	 akpm@linux-foundation.org,  bhe@redhat.com,
	dawei.li@shingroup.cn,  jszhang@kernel.org,
	 namcao@linutronix.de, chenjiahao16@huawei.com,
	 bjorn@rivosinc.com, vishal.moola@gmail.com,
	 linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
	Charlie Jenkins <charlie@rivosinc.com>
Subject: Re: [PATCH v2] RISC-V: cmdline: Add support for 'memmap' parameter
Date: Mon, 22 Jul 2024 22:13:14 +0100	[thread overview]
Message-ID: <874j8hku51.fsf@gmail.com> (raw)
In-Reply-To: <ZoXEmryf8RuLMZWN@ghost> (Charlie Jenkins's message of "Wed, 3 Jul 2024 14:37:30 -0700")

Hi Palmer,

Charlie Jenkins <charlie@rivosinc.com> writes:

> On Mon, Jun 24, 2024 at 08:37:39PM +0800, Yunhui Cui wrote:
>> Add parsing of 'memmap' to use or reserve a specific region of memory.
>> 
>> Implement the following memmap variants:
>> - memmap=nn[KMG]@ss[KMG]: force usage of a specific region of memory;
>> - memmap=nn[KMG]$ss[KMG]: mark specified memory as reserved;
>> 
>> Signed-off-by: Yunhui Cui <cuiyunhui@bytedance.com>
>> ---
>>  arch/riscv/mm/init.c | 46 ++++++++++++++++++++++++++++++++++++++++++++
>>  1 file changed, 46 insertions(+)
>> 
>> diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
>> index e3405e4b99af..8e1d93ae5cb2 100644
>> --- a/arch/riscv/mm/init.c
>> +++ b/arch/riscv/mm/init.c
>> @@ -208,6 +208,52 @@ static int __init early_mem(char *p)
>>  }
>>  early_param("mem", early_mem);
>>  
>> +static void __init parse_memmap_one(char *p)
>> +{
>> +	char *oldp;
>> +	unsigned long start_at, mem_size;
>> +
>> +	if (!p)
>> +		return;
>> +
>> +	oldp = p;
>> +	mem_size = memparse(p, &p);
>> +	if (p == oldp)
>> +		return;
>> +
>> +	switch (*p) {
>> +	case '@':
>> +		start_at = memparse(p + 1, &p);
>> +		memblock_add(start_at, mem_size);
>> +		break;
>> +
>> +	case '$':
>> +		start_at = memparse(p + 1, &p);
>> +		memblock_reserve(start_at, mem_size);
>> +		break;
>> +
>> +	default:
>> +		pr_warn("Unrecognized memmap syntax: %s\n", p);
>> +		break;
>> +	}
>> +}
>> +
>> +static int __init parse_memmap_opt(char *str)
>> +{
>> +	while (str) {
>> +		char *k = strchr(str, ',');
>> +
>> +		if (k)
>> +			*k++ = 0;
>> +
>> +		parse_memmap_one(str);
>> +		str = k;
>> +	}
>> +
>> +	return 0;
>> +}
>> +early_param("memmap", parse_memmap_opt);
>> +
>>  static void __init setup_bootmem(void)
>>  {
>>  	phys_addr_t vmlinux_end = __pa_symbol(&_end);
>> -- 
>> 2.20.1
>> 
>
> Reviewed-by: Charlie Jenkins <charlie@rivosinc.com>

Another patch that looks good to get merged if there are no further
comments.

Any chance this can be picked up for this cycle?

  parent reply	other threads:[~2024-07-22 21:13 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-24 12:37 [PATCH v2] RISC-V: cmdline: Add support for 'memmap' parameter Yunhui Cui
2024-06-24 12:37 ` Yunhui Cui
2024-07-03 21:37 ` Charlie Jenkins
2024-07-03 21:37   ` Charlie Jenkins
2024-07-11  6:15   ` [External] " yunhui cui
2024-07-11  6:15     ` yunhui cui
2024-07-22 21:13   ` Punit Agrawal [this message]
2024-07-22 21:13     ` Punit Agrawal
2024-09-14  8:21     ` Palmer Dabbelt
2024-09-14  8:21       ` Palmer Dabbelt
2024-09-18  3:27       ` [External] " yunhui cui
2024-09-18  3:27         ` yunhui cui

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874j8hku51.fsf@gmail.com \
    --to=punit.agrawal@bytedance.com \
    --cc=akpm@linux-foundation.org \
    --cc=alexghiti@rivosinc.com \
    --cc=aou@eecs.berkeley.edu \
    --cc=bhe@redhat.com \
    --cc=bjorn@rivosinc.com \
    --cc=charlie@rivosinc.com \
    --cc=chenjiahao16@huawei.com \
    --cc=cuiyunhui@bytedance.com \
    --cc=dawei.li@shingroup.cn \
    --cc=jszhang@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=namcao@linutronix.de \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=rppt@kernel.org \
    --cc=vishal.moola@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.