* Re: [PATCH 3/7] MIPS: fw: Record prom memory
@ 2019-08-14 14:20 Jiaxun Yang
2019-08-14 14:28 ` Thomas Bogendoerfer
0 siblings, 1 reply; 6+ messages in thread
From: Jiaxun Yang @ 2019-08-14 14:20 UTC (permalink / raw)
To: Thomas Bogendoerfer
Cc: aurelien, paul.burton, sfr, chenhc, Serge Semin, yasha.che3,
matt.redfearn, linux-mips
2019年8月14日 下午8:50于 Thomas Bogendoerfer <tsbogend@alpha.franken.de>写道:
>
> On Wed, Aug 14, 2019 at 03:03:41PM +0300, Serge Semin wrote:
> > On Thu, Aug 08, 2019 at 03:50:09PM +0800, Jiaxun Yang wrote:
> > > boot_mem_map is nolonger exist so we need to maintain a list
> > > of prom memory by ourselves.
> > >
> > > Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> > > ---
> > > arch/mips/fw/arc/memory.c | 20 ++++++++++++++------
> > > 1 file changed, 14 insertions(+), 6 deletions(-)
> > >
> > > diff --git a/arch/mips/fw/arc/memory.c b/arch/mips/fw/arc/memory.c
> > > index 429b7f8d2aeb..02e954b3700e 100644
> > > --- a/arch/mips/fw/arc/memory.c
> > > +++ b/arch/mips/fw/arc/memory.c
> > > @@ -27,6 +27,11 @@
> > >
> > > #undef DEBUG
> > >
> > > +#define MAX_PROM_MEM 5
> > > +static phys_addr_t prom_mem_base[MAX_PROM_MEM] __initdata;
> > > +static phys_addr_t prom_mem_size[MAX_PROM_MEM] __initdata;
> > > +static unsigned int nr_prom_mem __initdata;
> > > +
> > > /*
> > > * For ARC firmware memory functions the unit of meassuring memory is always
> > > * a 4k page of memory
> > > @@ -129,6 +134,7 @@ void __init prom_meminit(void)
> > > }
> > > #endif
> > >
> > > + nr_prom_mem = 0;
> > > p = PROM_NULL_MDESC;
> > > while ((p = ArcGetMemoryDescriptor(p))) {
> > > unsigned long base, size;
> > > @@ -139,6 +145,12 @@ void __init prom_meminit(void)
> > > type = prom_memtype_classify(p->type);
> > >
> > > add_memory_region(base, size, type);
> > > +
> > > + if (type == BOOT_MEM_ROM_DATA) {
> > > + prom_mem_base[nr_prom_mem] = base;
> > > + prom_mem_size[nr_prom_mem] = size;
> > > + nr_prom_mem++;
> >
> > Are you sure, that five prom-mem regions is enough?
>
> it's not enough:
Hi Thomas
I can see only two ROM DATA maps in your system.
As we're only recording ROM DATA here, rest types of memory will be handled by memblock.
>
> ARCH: Microsoft-Jazz
> PROMLIB: ARC firmware Version 1 Revision 1
> CPU revision is: 00000430
> FPU revision is: 00000500
> Determined physical RAM map:
> memory: 00054000 @ 00000000 (reserved)
> memory: 0002c000 @ 00054000 (usable)
> memory: 0001f000 @ 007e0000 (ROM data)
> memory: 007b2000 @ 007ff000 (usable)
> memory: 0004f000 @ 00fb1000 (ROM data)
> memory: 01000000 @ 01000000 (usable)
> memory: 00323000 @ 00080000 (reserved)
> memory: 0043d000 @ 003a3000 (usable)
>
> that's from a Olivetti M700 system.
>
> Thomas.
>
> --
> Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
> good idea. [ RFC1925, 2.3 ]
--
Jiaxun Yang
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 3/7] MIPS: fw: Record prom memory
2019-08-14 14:20 [PATCH 3/7] MIPS: fw: Record prom memory Jiaxun Yang
@ 2019-08-14 14:28 ` Thomas Bogendoerfer
0 siblings, 0 replies; 6+ messages in thread
From: Thomas Bogendoerfer @ 2019-08-14 14:28 UTC (permalink / raw)
To: Jiaxun Yang
Cc: aurelien, paul.burton, sfr, chenhc, Serge Semin, yasha.che3,
matt.redfearn, linux-mips
On Wed, Aug 14, 2019 at 10:20:48PM +0800, Jiaxun Yang wrote:
> Hi Thomas
>
> I can see only two ROM DATA maps in your system.
> As we're only recording ROM DATA here, rest types of memory will be handled
> by memblock.
ok, sorry for the noise.
Thomas.
--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Drop boot_mem_map
@ 2019-08-08 7:50 Jiaxun Yang
2019-08-08 7:50 ` [PATCH 3/7] MIPS: fw: Record prom memory Jiaxun Yang
0 siblings, 1 reply; 6+ messages in thread
From: Jiaxun Yang @ 2019-08-08 7:50 UTC (permalink / raw)
To: linux-mips
Cc: paul.burton, yasha.che3, aurelien, sfr, fancer.lancer,
matt.redfearn, chenhc
Hi there:
I was trying to make a generic NUMA implementation for ip27 and loongson-3,
and the boot_mem_map without nid support become a barrier of merging memory
init code.
Rather than add nid support to boot_mem_map, this patchset drops the whole
boot_mem_map as it can be replaced by memblock functions.
--
Jiaxun Yang
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 3/7] MIPS: fw: Record prom memory
2019-08-08 7:50 Drop boot_mem_map Jiaxun Yang
@ 2019-08-08 7:50 ` Jiaxun Yang
2019-08-14 12:03 ` Serge Semin
0 siblings, 1 reply; 6+ messages in thread
From: Jiaxun Yang @ 2019-08-08 7:50 UTC (permalink / raw)
To: linux-mips
Cc: paul.burton, yasha.che3, aurelien, sfr, fancer.lancer,
matt.redfearn, chenhc, Jiaxun Yang
boot_mem_map is nolonger exist so we need to maintain a list
of prom memory by ourselves.
Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
---
arch/mips/fw/arc/memory.c | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/arch/mips/fw/arc/memory.c b/arch/mips/fw/arc/memory.c
index 429b7f8d2aeb..02e954b3700e 100644
--- a/arch/mips/fw/arc/memory.c
+++ b/arch/mips/fw/arc/memory.c
@@ -27,6 +27,11 @@
#undef DEBUG
+#define MAX_PROM_MEM 5
+static phys_addr_t prom_mem_base[MAX_PROM_MEM] __initdata;
+static phys_addr_t prom_mem_size[MAX_PROM_MEM] __initdata;
+static unsigned int nr_prom_mem __initdata;
+
/*
* For ARC firmware memory functions the unit of meassuring memory is always
* a 4k page of memory
@@ -129,6 +134,7 @@ void __init prom_meminit(void)
}
#endif
+ nr_prom_mem = 0;
p = PROM_NULL_MDESC;
while ((p = ArcGetMemoryDescriptor(p))) {
unsigned long base, size;
@@ -139,6 +145,12 @@ void __init prom_meminit(void)
type = prom_memtype_classify(p->type);
add_memory_region(base, size, type);
+
+ if (type == BOOT_MEM_ROM_DATA) {
+ prom_mem_base[nr_prom_mem] = base;
+ prom_mem_size[nr_prom_mem] = size;
+ nr_prom_mem++;
+ }
}
}
@@ -150,12 +162,8 @@ void __init prom_free_prom_memory(void)
if (prom_flags & PROM_FLAG_DONT_FREE_TEMP)
return;
- for (i = 0; i < boot_mem_map.nr_map; i++) {
- if (boot_mem_map.map[i].type != BOOT_MEM_ROM_DATA)
- continue;
-
- addr = boot_mem_map.map[i].addr;
+ for (i = 0; i < nr_prom_mem; i++) {
free_init_pages("prom memory",
- addr, addr + boot_mem_map.map[i].size);
+ prom_mem_base[i], prom_mem_base[i] + prom_mem_size[i]);
}
}
--
2.22.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 3/7] MIPS: fw: Record prom memory
2019-08-08 7:50 ` [PATCH 3/7] MIPS: fw: Record prom memory Jiaxun Yang
@ 2019-08-14 12:03 ` Serge Semin
2019-08-14 12:50 ` Thomas Bogendoerfer
2019-08-14 13:45 ` Jiaxun Yang
0 siblings, 2 replies; 6+ messages in thread
From: Serge Semin @ 2019-08-14 12:03 UTC (permalink / raw)
To: Jiaxun Yang
Cc: linux-mips, paul.burton, yasha.che3, aurelien, sfr,
matt.redfearn, chenhc
On Thu, Aug 08, 2019 at 03:50:09PM +0800, Jiaxun Yang wrote:
> boot_mem_map is nolonger exist so we need to maintain a list
> of prom memory by ourselves.
>
> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> ---
> arch/mips/fw/arc/memory.c | 20 ++++++++++++++------
> 1 file changed, 14 insertions(+), 6 deletions(-)
>
> diff --git a/arch/mips/fw/arc/memory.c b/arch/mips/fw/arc/memory.c
> index 429b7f8d2aeb..02e954b3700e 100644
> --- a/arch/mips/fw/arc/memory.c
> +++ b/arch/mips/fw/arc/memory.c
> @@ -27,6 +27,11 @@
>
> #undef DEBUG
>
> +#define MAX_PROM_MEM 5
> +static phys_addr_t prom_mem_base[MAX_PROM_MEM] __initdata;
> +static phys_addr_t prom_mem_size[MAX_PROM_MEM] __initdata;
> +static unsigned int nr_prom_mem __initdata;
> +
> /*
> * For ARC firmware memory functions the unit of meassuring memory is always
> * a 4k page of memory
> @@ -129,6 +134,7 @@ void __init prom_meminit(void)
> }
> #endif
>
> + nr_prom_mem = 0;
> p = PROM_NULL_MDESC;
> while ((p = ArcGetMemoryDescriptor(p))) {
> unsigned long base, size;
> @@ -139,6 +145,12 @@ void __init prom_meminit(void)
> type = prom_memtype_classify(p->type);
>
> add_memory_region(base, size, type);
> +
> + if (type == BOOT_MEM_ROM_DATA) {
> + prom_mem_base[nr_prom_mem] = base;
> + prom_mem_size[nr_prom_mem] = size;
> + nr_prom_mem++;
Are you sure, that five prom-mem regions is enough? What about adding
a sanity check here so no to exceed the array size?
-Sergey
> + }
> }
> }
>
> @@ -150,12 +162,8 @@ void __init prom_free_prom_memory(void)
> if (prom_flags & PROM_FLAG_DONT_FREE_TEMP)
> return;
>
> - for (i = 0; i < boot_mem_map.nr_map; i++) {
> - if (boot_mem_map.map[i].type != BOOT_MEM_ROM_DATA)
> - continue;
> -
> - addr = boot_mem_map.map[i].addr;
> + for (i = 0; i < nr_prom_mem; i++) {
> free_init_pages("prom memory",
> - addr, addr + boot_mem_map.map[i].size);
> + prom_mem_base[i], prom_mem_base[i] + prom_mem_size[i]);
> }
> }
> --
> 2.22.0
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 3/7] MIPS: fw: Record prom memory
2019-08-14 12:03 ` Serge Semin
@ 2019-08-14 12:50 ` Thomas Bogendoerfer
2019-08-14 13:45 ` Jiaxun Yang
1 sibling, 0 replies; 6+ messages in thread
From: Thomas Bogendoerfer @ 2019-08-14 12:50 UTC (permalink / raw)
To: Serge Semin
Cc: Jiaxun Yang, linux-mips, paul.burton, yasha.che3, aurelien, sfr,
matt.redfearn, chenhc
On Wed, Aug 14, 2019 at 03:03:41PM +0300, Serge Semin wrote:
> On Thu, Aug 08, 2019 at 03:50:09PM +0800, Jiaxun Yang wrote:
> > boot_mem_map is nolonger exist so we need to maintain a list
> > of prom memory by ourselves.
> >
> > Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> > ---
> > arch/mips/fw/arc/memory.c | 20 ++++++++++++++------
> > 1 file changed, 14 insertions(+), 6 deletions(-)
> >
> > diff --git a/arch/mips/fw/arc/memory.c b/arch/mips/fw/arc/memory.c
> > index 429b7f8d2aeb..02e954b3700e 100644
> > --- a/arch/mips/fw/arc/memory.c
> > +++ b/arch/mips/fw/arc/memory.c
> > @@ -27,6 +27,11 @@
> >
> > #undef DEBUG
> >
> > +#define MAX_PROM_MEM 5
> > +static phys_addr_t prom_mem_base[MAX_PROM_MEM] __initdata;
> > +static phys_addr_t prom_mem_size[MAX_PROM_MEM] __initdata;
> > +static unsigned int nr_prom_mem __initdata;
> > +
> > /*
> > * For ARC firmware memory functions the unit of meassuring memory is always
> > * a 4k page of memory
> > @@ -129,6 +134,7 @@ void __init prom_meminit(void)
> > }
> > #endif
> >
> > + nr_prom_mem = 0;
> > p = PROM_NULL_MDESC;
> > while ((p = ArcGetMemoryDescriptor(p))) {
> > unsigned long base, size;
> > @@ -139,6 +145,12 @@ void __init prom_meminit(void)
> > type = prom_memtype_classify(p->type);
> >
> > add_memory_region(base, size, type);
> > +
> > + if (type == BOOT_MEM_ROM_DATA) {
> > + prom_mem_base[nr_prom_mem] = base;
> > + prom_mem_size[nr_prom_mem] = size;
> > + nr_prom_mem++;
>
> Are you sure, that five prom-mem regions is enough?
it's not enough:
ARCH: Microsoft-Jazz
PROMLIB: ARC firmware Version 1 Revision 1
CPU revision is: 00000430
FPU revision is: 00000500
Determined physical RAM map:
memory: 00054000 @ 00000000 (reserved)
memory: 0002c000 @ 00054000 (usable)
memory: 0001f000 @ 007e0000 (ROM data)
memory: 007b2000 @ 007ff000 (usable)
memory: 0004f000 @ 00fb1000 (ROM data)
memory: 01000000 @ 01000000 (usable)
memory: 00323000 @ 00080000 (reserved)
memory: 0043d000 @ 003a3000 (usable)
that's from a Olivetti M700 system.
Thomas.
--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 3/7] MIPS: fw: Record prom memory
2019-08-14 12:03 ` Serge Semin
2019-08-14 12:50 ` Thomas Bogendoerfer
@ 2019-08-14 13:45 ` Jiaxun Yang
1 sibling, 0 replies; 6+ messages in thread
From: Jiaxun Yang @ 2019-08-14 13:45 UTC (permalink / raw)
To: Serge Semin
Cc: linux-mips, paul.burton, yasha.che3, aurelien, sfr,
matt.redfearn, chenhc
On 2019/8/14 下午8:03, Serge Semin wrote:
> On Thu, Aug 08, 2019 at 03:50:09PM +0800, Jiaxun Yang wrote:
>> boot_mem_map is nolonger exist so we need to maintain a list
>> of prom memory by ourselves.
>>
>> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
>> ---
>> arch/mips/fw/arc/memory.c | 20 ++++++++++++++------
>> 1 file changed, 14 insertions(+), 6 deletions(-)
>>
>> diff --git a/arch/mips/fw/arc/memory.c b/arch/mips/fw/arc/memory.c
>> index 429b7f8d2aeb..02e954b3700e 100644
>> --- a/arch/mips/fw/arc/memory.c
>> +++ b/arch/mips/fw/arc/memory.c
>> @@ -27,6 +27,11 @@
>>
>> #undef DEBUG
>>
>> +#define MAX_PROM_MEM 5
>> +static phys_addr_t prom_mem_base[MAX_PROM_MEM] __initdata;
>> +static phys_addr_t prom_mem_size[MAX_PROM_MEM] __initdata;
>> +static unsigned int nr_prom_mem __initdata;
>> +
>> /*
>> * For ARC firmware memory functions the unit of meassuring memory is always
>> * a 4k page of memory
>> @@ -129,6 +134,7 @@ void __init prom_meminit(void)
>> }
>> #endif
>>
>> + nr_prom_mem = 0;
>> p = PROM_NULL_MDESC;
>> while ((p = ArcGetMemoryDescriptor(p))) {
>> unsigned long base, size;
>> @@ -139,6 +145,12 @@ void __init prom_meminit(void)
>> type = prom_memtype_classify(p->type);
>>
>> add_memory_region(base, size, type);
>> +
>> + if (type == BOOT_MEM_ROM_DATA) {
>> + prom_mem_base[nr_prom_mem] = base;
>> + prom_mem_size[nr_prom_mem] = size;
>> + nr_prom_mem++;
> Are you sure, that five prom-mem regions is enough? What about adding
> a sanity check here so no to exceed the array size?
Five should be enough, as far as I know yamon will only allocate one or two.
But you are right, add a sanity check would be better.
- Jiaxun
>
> -Sergey
>
>> + }
>> }
>> }
>>
>> @@ -150,12 +162,8 @@ void __init prom_free_prom_memory(void)
>> if (prom_flags & PROM_FLAG_DONT_FREE_TEMP)
>> return;
>>
>> - for (i = 0; i < boot_mem_map.nr_map; i++) {
>> - if (boot_mem_map.map[i].type != BOOT_MEM_ROM_DATA)
>> - continue;
>> -
>> - addr = boot_mem_map.map[i].addr;
>> + for (i = 0; i < nr_prom_mem; i++) {
>> free_init_pages("prom memory",
>> - addr, addr + boot_mem_map.map[i].size);
>> + prom_mem_base[i], prom_mem_base[i] + prom_mem_size[i]);
>> }
>> }
>> --
>> 2.22.0
>>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-08-14 14:29 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-14 14:20 [PATCH 3/7] MIPS: fw: Record prom memory Jiaxun Yang
2019-08-14 14:28 ` Thomas Bogendoerfer
-- strict thread matches above, loose matches on Subject: below --
2019-08-08 7:50 Drop boot_mem_map Jiaxun Yang
2019-08-08 7:50 ` [PATCH 3/7] MIPS: fw: Record prom memory Jiaxun Yang
2019-08-14 12:03 ` Serge Semin
2019-08-14 12:50 ` Thomas Bogendoerfer
2019-08-14 13:45 ` Jiaxun Yang
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).