From: Nick Kossifidis <mick@ics.forth.gr>
To: Palmer Dabbelt <palmer@dabbelt.com>
Cc: zong.li@sifive.com, linux-riscv@lists.infradead.org,
linux-kernel@vger.kernel.org,
Paul Walmsley <paul.walmsley@sifive.com>
Subject: Re: [PATCH 1/2] riscv: Register System RAM as iomem resources
Date: Fri, 10 Jul 2020 05:05:30 +0300 [thread overview]
Message-ID: <6d5006efde7affcb3307f5dcb85af7aa@mailhost.ics.forth.gr> (raw)
In-Reply-To: <mhng-cd7e19bb-859a-45a4-90e8-7851c4fb3083@palmerdabbelt-glaptop1>
Στις 2020-07-09 21:27, Palmer Dabbelt έγραψε:
> On Tue, 16 Jun 2020 00:45:46 PDT (-0700), zong.li@sifive.com wrote:
>> Add System RAM to /proc/iomem, various tools expect it such as kdump.
>> It is also needed for page_is_ram API which checks the specified
>> address
>> whether registered as System RAM in iomem_resource list.
>>
>> Signed-off-by: Zong Li <zong.li@sifive.com>
>> ---
>> arch/riscv/mm/init.c | 22 ++++++++++++++++++++++
>> 1 file changed, 22 insertions(+)
>>
>> diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
>> index f4adb3684f3d..bbe816e03b2f 100644
>> --- a/arch/riscv/mm/init.c
>> +++ b/arch/riscv/mm/init.c
>> @@ -517,6 +517,27 @@ void mark_rodata_ro(void)
>> }
>> #endif
>>
>> +void __init resource_init(void)
>> +{
>> + struct memblock_region *region;
>> +
>> + for_each_memblock(memory, region) {
>> + struct resource *res;
>> +
>> + res = memblock_alloc(sizeof(struct resource), SMP_CACHE_BYTES);
>> + if (!res)
>> + panic("%s: Failed to allocate %zu bytes\n", __func__,
>> + sizeof(struct resource));
>> +
>> + res->name = "System RAM";
>> + res->start =
>> __pfn_to_phys(memblock_region_memory_base_pfn(region));
>> + res->end = __pfn_to_phys(memblock_region_memory_end_pfn(region)) -
>> 1;
>> + res->flags = IORESOURCE_SYSTEM_RAM | IORESOURCE_BUSY;
>
> Looks like everyone else is checking MEMBLOCK_NOMAP before registering
> memory
> regions. I've added that and put this on for-next. Thanks!
>
> commit 11dc632bf515874c84887727614e8044452f1f28
> gpg: Signature made Thu 09 Jul 2020 11:24:08 AM PDT
> gpg: using RSA key
> 2B3C3747446843B24A943A7A2E1319F35FBB1889
> gpg: issuer "palmer@dabbelt.com"
> gpg: Good signature from "Palmer Dabbelt <palmer@dabbelt.com>"
> [ultimate]
> gpg: aka "Palmer Dabbelt <palmerdabbelt@google.com>"
> [ultimate]
> Author: Zong Li <zong.li@sifive.com>
> Date: Tue Jun 16 15:45:46 2020 +0800
>
> riscv: Register System RAM as iomem resources
> Add System RAM to /proc/iomem, various tools expect it such as
> kdump.
> It is also needed for page_is_ram API which checks the specified
> address
> whether registered as System RAM in iomem_resource list.
> Signed-off-by: Zong Li <zong.li@sifive.com>
> [Palmer: check MEMBLOCK_NOMAP]
> Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
>
> diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
> index f4adb3684f3d..8b78fd23713e 100644
> --- a/arch/riscv/mm/init.c
> +++ b/arch/riscv/mm/init.c
> @@ -517,6 +517,32 @@ void mark_rodata_ro(void)
> }
> #endif
>
> +void __init resource_init(void)
> +{
> + struct memblock_region *region;
> +
> + for_each_memblock(memory, region) {
> + struct resource *res;
> +
> + res = memblock_alloc(sizeof(struct resource), SMP_CACHE_BYTES);
> + if (!res)
> + panic("%s: Failed to allocate %zu bytes\n", __func__,
> + sizeof(struct resource));
> +
> + if (memblock_is_nomap(region) {
> + res->name = "reserved";
> + res->flags = IORESOURCE_MEM;
> + } else {
> + res->name = "System RAM";
> + res->flags = IORESOURCE_SYSTEM_RAM | IORESOURCE_BUSY;
> + }
> + res->start = __pfn_to_phys(memblock_region_memory_base_pfn(region));
> + res->end = __pfn_to_phys(memblock_region_memory_end_pfn(region)) -
> 1;
> +
> + request_resource(&iomem_resource, res);
> + }
> +}
> +
> void __init paging_init(void)
> {
> setup_vm_final();
> @@ -524,6 +550,7 @@ void __init paging_init(void)
> sparse_init();
> setup_zero_page();
> zone_sizes_init();
> + resource_init();
> }
>
> #ifdef CONFIG_SPARSEMEM_VMEMMAP
>
>
>> +
>> + request_resource(&iomem_resource, res);
>> + }
>> +}
>> +
>> void __init paging_init(void)
>> {
>> setup_vm_final();
>> @@ -524,6 +545,7 @@ void __init paging_init(void)
>> sparse_init();
>> setup_zero_page();
>> zone_sizes_init();
>> + resource_init();
>> }
>>
>> #ifdef CONFIG_SPARSEMEM_VMEMMAP
>
> _______________________________________________
> linux-riscv mailing list
> linux-riscv@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv
Zong Li sent a newer version of this series without this patch, since
I'm handling this on the kexec/kdump series as well where other sections
needed for kdump are also registered.
WARNING: multiple messages have this Message-ID (diff)
From: Nick Kossifidis <mick@ics.forth.gr>
To: Palmer Dabbelt <palmer@dabbelt.com>
Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
zong.li@sifive.com, Paul Walmsley <paul.walmsley@sifive.com>
Subject: Re: [PATCH 1/2] riscv: Register System RAM as iomem resources
Date: Fri, 10 Jul 2020 05:05:30 +0300 [thread overview]
Message-ID: <6d5006efde7affcb3307f5dcb85af7aa@mailhost.ics.forth.gr> (raw)
In-Reply-To: <mhng-cd7e19bb-859a-45a4-90e8-7851c4fb3083@palmerdabbelt-glaptop1>
Στις 2020-07-09 21:27, Palmer Dabbelt έγραψε:
> On Tue, 16 Jun 2020 00:45:46 PDT (-0700), zong.li@sifive.com wrote:
>> Add System RAM to /proc/iomem, various tools expect it such as kdump.
>> It is also needed for page_is_ram API which checks the specified
>> address
>> whether registered as System RAM in iomem_resource list.
>>
>> Signed-off-by: Zong Li <zong.li@sifive.com>
>> ---
>> arch/riscv/mm/init.c | 22 ++++++++++++++++++++++
>> 1 file changed, 22 insertions(+)
>>
>> diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
>> index f4adb3684f3d..bbe816e03b2f 100644
>> --- a/arch/riscv/mm/init.c
>> +++ b/arch/riscv/mm/init.c
>> @@ -517,6 +517,27 @@ void mark_rodata_ro(void)
>> }
>> #endif
>>
>> +void __init resource_init(void)
>> +{
>> + struct memblock_region *region;
>> +
>> + for_each_memblock(memory, region) {
>> + struct resource *res;
>> +
>> + res = memblock_alloc(sizeof(struct resource), SMP_CACHE_BYTES);
>> + if (!res)
>> + panic("%s: Failed to allocate %zu bytes\n", __func__,
>> + sizeof(struct resource));
>> +
>> + res->name = "System RAM";
>> + res->start =
>> __pfn_to_phys(memblock_region_memory_base_pfn(region));
>> + res->end = __pfn_to_phys(memblock_region_memory_end_pfn(region)) -
>> 1;
>> + res->flags = IORESOURCE_SYSTEM_RAM | IORESOURCE_BUSY;
>
> Looks like everyone else is checking MEMBLOCK_NOMAP before registering
> memory
> regions. I've added that and put this on for-next. Thanks!
>
> commit 11dc632bf515874c84887727614e8044452f1f28
> gpg: Signature made Thu 09 Jul 2020 11:24:08 AM PDT
> gpg: using RSA key
> 2B3C3747446843B24A943A7A2E1319F35FBB1889
> gpg: issuer "palmer@dabbelt.com"
> gpg: Good signature from "Palmer Dabbelt <palmer@dabbelt.com>"
> [ultimate]
> gpg: aka "Palmer Dabbelt <palmerdabbelt@google.com>"
> [ultimate]
> Author: Zong Li <zong.li@sifive.com>
> Date: Tue Jun 16 15:45:46 2020 +0800
>
> riscv: Register System RAM as iomem resources
> Add System RAM to /proc/iomem, various tools expect it such as
> kdump.
> It is also needed for page_is_ram API which checks the specified
> address
> whether registered as System RAM in iomem_resource list.
> Signed-off-by: Zong Li <zong.li@sifive.com>
> [Palmer: check MEMBLOCK_NOMAP]
> Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
>
> diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c
> index f4adb3684f3d..8b78fd23713e 100644
> --- a/arch/riscv/mm/init.c
> +++ b/arch/riscv/mm/init.c
> @@ -517,6 +517,32 @@ void mark_rodata_ro(void)
> }
> #endif
>
> +void __init resource_init(void)
> +{
> + struct memblock_region *region;
> +
> + for_each_memblock(memory, region) {
> + struct resource *res;
> +
> + res = memblock_alloc(sizeof(struct resource), SMP_CACHE_BYTES);
> + if (!res)
> + panic("%s: Failed to allocate %zu bytes\n", __func__,
> + sizeof(struct resource));
> +
> + if (memblock_is_nomap(region) {
> + res->name = "reserved";
> + res->flags = IORESOURCE_MEM;
> + } else {
> + res->name = "System RAM";
> + res->flags = IORESOURCE_SYSTEM_RAM | IORESOURCE_BUSY;
> + }
> + res->start = __pfn_to_phys(memblock_region_memory_base_pfn(region));
> + res->end = __pfn_to_phys(memblock_region_memory_end_pfn(region)) -
> 1;
> +
> + request_resource(&iomem_resource, res);
> + }
> +}
> +
> void __init paging_init(void)
> {
> setup_vm_final();
> @@ -524,6 +550,7 @@ void __init paging_init(void)
> sparse_init();
> setup_zero_page();
> zone_sizes_init();
> + resource_init();
> }
>
> #ifdef CONFIG_SPARSEMEM_VMEMMAP
>
>
>> +
>> + request_resource(&iomem_resource, res);
>> + }
>> +}
>> +
>> void __init paging_init(void)
>> {
>> setup_vm_final();
>> @@ -524,6 +545,7 @@ void __init paging_init(void)
>> sparse_init();
>> setup_zero_page();
>> zone_sizes_init();
>> + resource_init();
>> }
>>
>> #ifdef CONFIG_SPARSEMEM_VMEMMAP
>
> _______________________________________________
> linux-riscv mailing list
> linux-riscv@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv
Zong Li sent a newer version of this series without this patch, since
I'm handling this on the kexec/kdump series as well where other sections
needed for kdump are also registered.
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
next prev parent reply other threads:[~2020-07-10 2:06 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-16 7:45 [PATCH 0/2] Add STRICT_DEVMEM support on RISC-V Zong Li
2020-06-16 7:45 ` [PATCH 1/2] riscv: Register System RAM as iomem resources Zong Li
2020-06-16 11:51 ` Nick Kossifidis
2020-06-16 11:51 ` Nick Kossifidis
2020-06-17 1:23 ` Zong Li
2020-06-17 1:23 ` Zong Li
2020-07-09 18:27 ` Palmer Dabbelt
2020-07-09 18:27 ` Palmer Dabbelt
2020-07-10 2:05 ` Nick Kossifidis [this message]
2020-07-10 2:05 ` Nick Kossifidis
2020-06-16 7:45 ` [PATCH 2/2] riscv: Support CONFIG_STRICT_DEVMEM Zong Li
2020-06-16 12:27 ` Nick Kossifidis
2020-06-16 12:27 ` Nick Kossifidis
2020-06-17 1:56 ` Zong Li
2020-06-17 1:56 ` Zong Li
2020-06-17 5:28 ` Nick Kossifidis
2020-06-17 5:28 ` Nick Kossifidis
2020-06-17 6:32 ` Zong Li
2020-06-17 6:32 ` Zong Li
2020-07-09 20:08 ` Palmer Dabbelt
2020-07-09 20:08 ` Palmer Dabbelt
2020-07-10 2:43 ` Zong Li
2020-07-10 2:43 ` Zong Li
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=6d5006efde7affcb3307f5dcb85af7aa@mailhost.ics.forth.gr \
--to=mick@ics.forth.gr \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=zong.li@sifive.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.