From: Peng Fan (OSS) <hidden> Date: 2021-12-15 06:47:11
From: Peng Fan <peng.fan@nxp.com>
This variable is only set during initialization, so mark with
__ro_after_init.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
arch/arm64/mm/init.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
@@ -172,7 +172,7 @@ int pfn_is_map_memory(unsigned long pfn)}EXPORT_SYMBOL(pfn_is_map_memory);-staticphys_addr_tmemory_limit=PHYS_ADDR_MAX;+staticphys_addr_tmemory_limit__ro_after_init=PHYS_ADDR_MAX;/**LimitthememorysizethatwasspecifiedviaFDT.
--
2.25.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
From: Peng Fan (OSS) <hidden> Date: 2021-12-15 06:47:18
From: Peng Fan <peng.fan@nxp.com>
There is a "mem=[x]" boot parameter, but when there is a whole reserved
by secure TEE, the continuous DRAM area is split with two memblocks.
For example, DRAM area [0x40000000, 0xffffffff], when TEE uses
[0x50000000, 0x51000000), the memblock will be split into
[0x40000000, 0x50000000) and [0x51000000, 0xffffffff].
If pass "mem=1024MB", the actually max addr will be 0x81000000.
However if need the max addr be 0x80000000, mem=1008MB should be used.
There also might be multiple other holes that no visible to Linux, when
we wanna to limit the max addr usable by Linux, using "max_addr=[X]" is
much easier than "mem=[X]"
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
arch/arm64/mm/init.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
@@ -173,6 +173,7 @@ int pfn_is_map_memory(unsigned long pfn)EXPORT_SYMBOL(pfn_is_map_memory);staticphys_addr_tmemory_limit__ro_after_init=PHYS_ADDR_MAX;+staticphys_addr_tmax_addr__ro_after_init=PHYS_ADDR_MAX;/**LimitthememorysizethatwasspecifiedviaFDT.
@@ -189,6 +190,18 @@ static int __init early_mem(char *p)}early_param("mem",early_mem);+staticint__initset_max_addr(char*p)+{+if(!p)+return1;++max_addr=memparse(p,&p)&PAGE_MASK;+pr_notice("Memory max addr set to 0x%llx\n",max_addr);++return0;+}+early_param("max_addr",set_max_addr);+void__initarm64_memblock_init(void){s64linear_region_size=PAGE_END-_PAGE_OFFSET(vabits_actual);
On Wed, 15 Dec 2021 at 07:56, Peng Fan (OSS) [off-list ref] wrote:
From: Peng Fan <peng.fan@nxp.com>
There is a "mem=[x]" boot parameter, but when there is a whole reserved
by secure TEE, the continuous DRAM area is split with two memblocks.
For example, DRAM area [0x40000000, 0xffffffff], when TEE uses
[0x50000000, 0x51000000), the memblock will be split into
[0x40000000, 0x50000000) and [0x51000000, 0xffffffff].
If pass "mem=1024MB", the actually max addr will be 0x81000000.
However if need the max addr be 0x80000000, mem=1008MB should be used.
There also might be multiple other holes that no visible to Linux, when
we wanna to limit the max addr usable by Linux, using "max_addr=[X]" is
much easier than "mem=[X]"
Signed-off-by: Peng Fan <peng.fan@nxp.com>
mem= is a hack already, please don't add another one. Limiting the
memory like this is far too tricky, given that the kernel itself and
the initrd could end up in memory that is excluded, and we have to go
and fix things up if that happens.
@@ -173,6 +173,7 @@ int pfn_is_map_memory(unsigned long pfn)EXPORT_SYMBOL(pfn_is_map_memory);staticphys_addr_tmemory_limit__ro_after_init=PHYS_ADDR_MAX;+staticphys_addr_tmax_addr__ro_after_init=PHYS_ADDR_MAX;/**LimitthememorysizethatwasspecifiedviaFDT.
@@ -189,6 +190,18 @@ static int __init early_mem(char *p)}early_param("mem",early_mem);+staticint__initset_max_addr(char*p)+{+if(!p)+return1;++max_addr=memparse(p,&p)&PAGE_MASK;+pr_notice("Memory max addr set to 0x%llx\n",max_addr);++return0;+}+early_param("max_addr",set_max_addr);+void__initarm64_memblock_init(void){s64linear_region_size=PAGE_END-_PAGE_OFFSET(vabits_actual);
From: Peng Fan <peng.fan@nxp.com> Date: 2021-12-15 07:59:52
Subject: Re: [PATCH 2/2] arm64: mm: support bootparam max_addr
On Wed, 15 Dec 2021 at 07:56, Peng Fan (OSS) [off-list ref]
wrote:
quoted
From: Peng Fan <peng.fan@nxp.com>
There is a "mem=[x]" boot parameter, but when there is a whole
reserved by secure TEE, the continuous DRAM area is split with two
memblocks.
quoted
For example, DRAM area [0x40000000, 0xffffffff], when TEE uses
[0x50000000, 0x51000000), the memblock will be split into [0x40000000,
0x50000000) and [0x51000000, 0xffffffff].
If pass "mem=1024MB", the actually max addr will be 0x81000000.
However if need the max addr be 0x80000000, mem=1008MB should be
used.
quoted
There also might be multiple other holes that no visible to Linux,
when we wanna to limit the max addr usable by Linux, using
"max_addr=[X]" is much easier than "mem=[X]"
Signed-off-by: Peng Fan <peng.fan@nxp.com>
mem= is a hack already, please don't add another one. Limiting the memory
like this is far too tricky, given that the kernel itself and the initrd could end up
in memory that is excluded, and we have to go and fix things up if that
happens.
We wanna to use the reserved memory with request_mem_region, but with
commit 86588296acbfb1 ("fdt: Properly handle "no-map" field in the memory region ")
request_mem_region will fail, because the reserved memory are now as
kernel memory.
So we use "mem=X" to work around the issue, but "mem=X" is not user friendly
compared with "max_addr=" when there are multiple holes used by others.
Thanks,
Peng.
From: Mike Rapoport <rppt@kernel.org> Date: 2021-12-15 09:24:17
On Wed, Dec 15, 2021 at 07:59:45AM +0000, Peng Fan wrote:
quoted
Subject: Re: [PATCH 2/2] arm64: mm: support bootparam max_addr
On Wed, 15 Dec 2021 at 07:56, Peng Fan (OSS) [off-list ref]
wrote:
quoted
From: Peng Fan <peng.fan@nxp.com>
There is a "mem=[x]" boot parameter, but when there is a whole
reserved by secure TEE, the continuous DRAM area is split with two
memblocks.
quoted
For example, DRAM area [0x40000000, 0xffffffff], when TEE uses
[0x50000000, 0x51000000), the memblock will be split into [0x40000000,
0x50000000) and [0x51000000, 0xffffffff].
If pass "mem=1024MB", the actually max addr will be 0x81000000.
However if need the max addr be 0x80000000, mem=1008MB should be
used.
quoted
There also might be multiple other holes that no visible to Linux,
when we wanna to limit the max addr usable by Linux, using
"max_addr=[X]" is much easier than "mem=[X]"
Signed-off-by: Peng Fan <peng.fan@nxp.com>
mem= is a hack already, please don't add another one. Limiting the memory
like this is far too tricky, given that the kernel itself and the initrd could end up
in memory that is excluded, and we have to go and fix things up if that
happens.
We wanna to use the reserved memory with request_mem_region, but with
commit 86588296acbfb1 ("fdt: Properly handle "no-map" field in the memory region ")
request_mem_region will fail, because the reserved memory are now as
kernel memory.
request_mem_region() is for MMIO. Why do you want to use it for RAM?
So we use "mem=X" to work around the issue, but "mem=X" is not user friendly
compared with "max_addr=" when there are multiple holes used by others.
Thanks,
Peng.
From: Peng Fan <peng.fan@nxp.com> Date: 2021-12-15 09:30:41
Subject: Re: [PATCH 2/2] arm64: mm: support bootparam max_addr
On Wed, Dec 15, 2021 at 07:59:45AM +0000, Peng Fan wrote:
quoted
quoted
Subject: Re: [PATCH 2/2] arm64: mm: support bootparam max_addr
On Wed, 15 Dec 2021 at 07:56, Peng Fan (OSS) [off-list ref]
wrote:
quoted
From: Peng Fan <peng.fan@nxp.com>
There is a "mem=[x]" boot parameter, but when there is a whole
reserved by secure TEE, the continuous DRAM area is split with two
memblocks.
quoted
For example, DRAM area [0x40000000, 0xffffffff], when TEE uses
[0x50000000, 0x51000000), the memblock will be split into
[0x40000000,
0x50000000) and [0x51000000, 0xffffffff].
If pass "mem=1024MB", the actually max addr will be 0x81000000.
However if need the max addr be 0x80000000, mem=1008MB should be
used.
quoted
There also might be multiple other holes that no visible to Linux,
when we wanna to limit the max addr usable by Linux, using
"max_addr=[X]" is much easier than "mem=[X]"
Signed-off-by: Peng Fan <peng.fan@nxp.com>
mem= is a hack already, please don't add another one. Limiting the
memory like this is far too tricky, given that the kernel itself and
the initrd could end up in memory that is excluded, and we have to
go and fix things up if that happens.
We wanna to use the reserved memory with request_mem_region, but with
commit 86588296acbfb1 ("fdt: Properly handle "no-map" field in the
memory region ")
request_mem_region will fail, because the reserved memory are now as
kernel memory.
request_mem_region() is for MMIO. Why do you want to use it for RAM?
+ Jan, the jailhouse hypervisor owner.
There is an out of tree driver
https://github.com/siemens/jailhouse/blob/master/driver/main.c#L466
The hypervisor jailhouse is loaded after linux boot up, and the hypervisor
bin file needs to be loaded into DRAM that reserved in our device
tree with node with no map property.
And the hypervisor use virtual pci for communication between VMs,
The virtual pci use part of the reserved DRAM area as PCI MMIO space.
Maybe I should use /memreserve, but not node with no-map property.
Thanks,
Peng.
quoted
So we use "mem=X" to work around the issue, but "mem=X" is not user
friendly compared with "max_addr=" when there are multiple holes used by
From: Mike Rapoport <rppt@kernel.org> Date: 2021-12-15 09:53:18
On Wed, Dec 15, 2021 at 09:30:36AM +0000, Peng Fan wrote:
quoted
Subject: Re: [PATCH 2/2] arm64: mm: support bootparam max_addr
On Wed, Dec 15, 2021 at 07:59:45AM +0000, Peng Fan wrote:
quoted
quoted
Subject: Re: [PATCH 2/2] arm64: mm: support bootparam max_addr
On Wed, 15 Dec 2021 at 07:56, Peng Fan (OSS) [off-list ref]
wrote:
quoted
From: Peng Fan <peng.fan@nxp.com>
There is a "mem=[x]" boot parameter, but when there is a whole
reserved by secure TEE, the continuous DRAM area is split with two
memblocks.
quoted
For example, DRAM area [0x40000000, 0xffffffff], when TEE uses
[0x50000000, 0x51000000), the memblock will be split into
[0x40000000,
0x50000000) and [0x51000000, 0xffffffff].
If pass "mem=1024MB", the actually max addr will be 0x81000000.
However if need the max addr be 0x80000000, mem=1008MB should be
used.
quoted
There also might be multiple other holes that no visible to Linux,
when we wanna to limit the max addr usable by Linux, using
"max_addr=[X]" is much easier than "mem=[X]"
Signed-off-by: Peng Fan <peng.fan@nxp.com>
mem= is a hack already, please don't add another one. Limiting the
memory like this is far too tricky, given that the kernel itself and
the initrd could end up in memory that is excluded, and we have to
go and fix things up if that happens.
We wanna to use the reserved memory with request_mem_region, but with
commit 86588296acbfb1 ("fdt: Properly handle "no-map" field in the
memory region ")
request_mem_region will fail, because the reserved memory are now as
kernel memory.
request_mem_region() is for MMIO. Why do you want to use it for RAM?
+ Jan, the jailhouse hypervisor owner.
There is an out of tree driver
https://github.com/siemens/jailhouse/blob/master/driver/main.c#L466
The hypervisor jailhouse is loaded after linux boot up, and the hypervisor
bin file needs to be loaded into DRAM that reserved in our device
tree with node with no map property.
And the hypervisor use virtual pci for communication between VMs,
The virtual pci use part of the reserved DRAM area as PCI MMIO space.
Maybe I should use /memreserve, but not node with no-map property.
So, my understanding is that you need a chunk of memory that Linux does not
use and does not map into the kernel page tables.
In that case /memreserve + nomap in the device tree could be a better
solution than mem=X.
Thanks,
Peng.
quoted
quoted
So we use "mem=X" to work around the issue, but "mem=X" is not user
friendly compared with "max_addr=" when there are multiple holes used by
From: Peng Fan <peng.fan@nxp.com> Date: 2021-12-15 12:05:40
Subject: Re: [PATCH 2/2] arm64: mm: support bootparam max_addr
On Wed, Dec 15, 2021 at 09:30:36AM +0000, Peng Fan wrote:
quoted
quoted
Subject: Re: [PATCH 2/2] arm64: mm: support bootparam max_addr
On Wed, Dec 15, 2021 at 07:59:45AM +0000, Peng Fan wrote:
quoted
quoted
Subject: Re: [PATCH 2/2] arm64: mm: support bootparam max_addr
On Wed, 15 Dec 2021 at 07:56, Peng Fan (OSS)
[off-list ref]
wrote:
quoted
From: Peng Fan <peng.fan@nxp.com>
There is a "mem=[x]" boot parameter, but when there is a whole
reserved by secure TEE, the continuous DRAM area is split with
two
memblocks.
quoted
For example, DRAM area [0x40000000, 0xffffffff], when TEE uses
[0x50000000, 0x51000000), the memblock will be split into
[0x40000000,
0x50000000) and [0x51000000, 0xffffffff].
If pass "mem=1024MB", the actually max addr will be 0x81000000.
However if need the max addr be 0x80000000, mem=1008MB
should
quoted
quoted
quoted
quoted
quoted
be
used.
quoted
There also might be multiple other holes that no visible to
Linux, when we wanna to limit the max addr usable by Linux,
using "max_addr=[X]" is much easier than "mem=[X]"
Signed-off-by: Peng Fan <peng.fan@nxp.com>
mem= is a hack already, please don't add another one. Limiting
the memory like this is far too tricky, given that the kernel
itself and the initrd could end up in memory that is excluded,
and we have to go and fix things up if that happens.
We wanna to use the reserved memory with request_mem_region, but
with commit 86588296acbfb1 ("fdt: Properly handle "no-map" field
in the memory region ")
request_mem_region will fail, because the reserved memory are now
as kernel memory.
request_mem_region() is for MMIO. Why do you want to use it for
1TwM0i9iCE%3D&reserved=0
The hypervisor jailhouse is loaded after linux boot up, and the
hypervisor bin file needs to be loaded into DRAM that reserved in our
device tree with node with no map property.
And the hypervisor use virtual pci for communication between VMs, The
virtual pci use part of the reserved DRAM area as PCI MMIO space.
Maybe I should use /memreserve, but not node with no-map property.
So, my understanding is that you need a chunk of memory that Linux does not
use and does not map into the kernel page tables.
In that case /memreserve + nomap in the device tree could be a better
solution than mem=X.
nomap not work now since commit
86588296acbfb1 ("fdt: Properly handle "no-map" field in the memory region ")
I need try /memreserve
BTW, do you think max_addr would be an option be added to memblock
common code mm/memblock.c?
Thanks,
Peng.
quoted
Thanks,
Peng.
quoted
quoted
So we use "mem=X" to work around the issue, but "mem=X" is not
user friendly compared with "max_addr=" when there are multiple
holes used by
From: Mike Rapoport <rppt@kernel.org> Date: 2021-12-16 14:19:26
On Wed, Dec 15, 2021 at 12:05:36PM +0000, Peng Fan wrote:
quoted
Subject: Re: [PATCH 2/2] arm64: mm: support bootparam max_addr
quoted
quoted
quoted
quoted
quoted
If pass "mem=1024MB", the actually max addr will be
0x81000000. However if need the max addr be 0x80000000,
mem=1008MB should be used.
BTW, do you think max_addr would be an option be added to memblock
common code mm/memblock.c?
You have a working solution with mem=1008MB, I don't see a need for
additional kernel parameter.
--
Sincerely yours,
Mike.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
On Wed, 15 Dec 2021 at 07:55, Peng Fan (OSS) [off-list ref] wrote:
From: Peng Fan <peng.fan@nxp.com>
This variable is only set during initialization, so mark with
__ro_after_init.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
@@ -172,7 +172,7 @@ int pfn_is_map_memory(unsigned long pfn)}EXPORT_SYMBOL(pfn_is_map_memory);-staticphys_addr_tmemory_limit=PHYS_ADDR_MAX;+staticphys_addr_tmemory_limit__ro_after_init=PHYS_ADDR_MAX;/**LimitthememorysizethatwasspecifiedviaFDT.--
From: David Hildenbrand <hidden> Date: 2021-12-15 10:02:45
On 15.12.21 07:45, Peng Fan (OSS) wrote:
quoted hunk
From: Peng Fan <peng.fan@nxp.com>
This variable is only set during initialization, so mark with
__ro_after_init.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
arch/arm64/mm/init.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
@@ -172,7 +172,7 @@ int pfn_is_map_memory(unsigned long pfn)}EXPORT_SYMBOL(pfn_is_map_memory);-staticphys_addr_tmemory_limit=PHYS_ADDR_MAX;+staticphys_addr_tmemory_limit__ro_after_init=PHYS_ADDR_MAX;/**LimitthememorysizethatwasspecifiedviaFDT.
Reviewed-by: David Hildenbrand <redacted>
--
Thanks,
David / dhildenb
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
From: Peng Fan <peng.fan@nxp.com>
This variable is only set during initialization, so mark with
__ro_after_init.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
arch/arm64/mm/init.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
@@ -172,7 +172,7 @@ int pfn_is_map_memory(unsigned long pfn)}EXPORT_SYMBOL(pfn_is_map_memory);-staticphys_addr_tmemory_limit=PHYS_ADDR_MAX;+staticphys_addr_tmemory_limit__ro_after_init=PHYS_ADDR_MAX;/**LimitthememorysizethatwasspecifiedviaFDT.