* [PATCH] xen/dt: Don't advertise Xen static-heap region to hwdom
@ 2026-10-29 10:43 Michal Orzel
2026-10-29 11:49 ` Oleksii Kurochko
2026-10-30 3:42 ` Kuan-Wei Chiu
0 siblings, 2 replies; 3+ messages in thread
From: Michal Orzel @ 2026-10-29 10:43 UTC (permalink / raw)
To: xen-devel
Cc: Michal Orzel, Stefano Stabellini, Julien Grall, Bertrand Marquis
bootinfo.reserved_mem is used to store different types of memory that
Xen considers as reserved: domU static mem, normal /reserved-memory,
FDT memreserve and Xen static heap. make_memory_node(), invoked during
FDT generation for a hwdom for reserved memory, only skips the domU
static memory and FDT memreserve. This results in advertising Xen static
heap (if used) to a hwdom as /memory. This memory is not mapped in P2M
and guest attempt to access it fails. Interestingly, if the
/reserved-memory node is placed after /chosen, there is no problem because
of the check at the beginning of make_memory_node() that finds the first
memory range using the correct type.
Fixes: 4596329291f5 ("docs, xen/arm: Introduce static heap memory")
Signed-off-by: Michal Orzel <michal.orzel@amd.com>
---
xen/common/device-tree/domain-build.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/xen/common/device-tree/domain-build.c b/xen/common/device-tree/domain-build.c
index 30a59abfa722..634a26946c24 100644
--- a/xen/common/device-tree/domain-build.c
+++ b/xen/common/device-tree/domain-build.c
@@ -541,8 +541,7 @@ int __init make_memory_node(const struct kernel_info *kinfo, int addrcells,
u64 start = mem->bank[i].start;
u64 size = mem->bank[i].size;
- if ( (mem->bank[i].type == MEMBANK_STATIC_DOMAIN) ||
- (mem->bank[i].type == MEMBANK_FDT_RESVMEM) )
+ if ( mem->bank[i].type != MEMBANK_DEFAULT )
continue;
nr_cells += reg_size;
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] xen/dt: Don't advertise Xen static-heap region to hwdom
2026-10-29 10:43 [PATCH] xen/dt: Don't advertise Xen static-heap region to hwdom Michal Orzel
@ 2026-10-29 11:49 ` Oleksii Kurochko
2026-10-30 3:42 ` Kuan-Wei Chiu
1 sibling, 0 replies; 3+ messages in thread
From: Oleksii Kurochko @ 2026-10-29 11:49 UTC (permalink / raw)
To: Michal Orzel, xen-devel
Cc: Stefano Stabellini, Julien Grall, Bertrand Marquis
On 10/29/26 11:43 AM, Michal Orzel wrote:
> bootinfo.reserved_mem is used to store different types of memory that
> Xen considers as reserved: domU static mem, normal /reserved-memory,
> FDT memreserve and Xen static heap. make_memory_node(), invoked during
> FDT generation for a hwdom for reserved memory, only skips the domU
> static memory and FDT memreserve. This results in advertising Xen static
> heap (if used) to a hwdom as /memory. This memory is not mapped in P2M
> and guest attempt to access it fails. Interestingly, if the
> /reserved-memory node is placed after /chosen, there is no problem because
> of the check at the beginning of make_memory_node() that finds the first
> memory range using the correct type.>
> Fixes: 4596329291f5 ("docs, xen/arm: Introduce static heap memory")
> Signed-off-by: Michal Orzel <michal.orzel@amd.com>
LGTM:
Reviewed-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
~ Oleksii
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] xen/dt: Don't advertise Xen static-heap region to hwdom
2026-10-29 10:43 [PATCH] xen/dt: Don't advertise Xen static-heap region to hwdom Michal Orzel
2026-10-29 11:49 ` Oleksii Kurochko
@ 2026-10-30 3:42 ` Kuan-Wei Chiu
1 sibling, 0 replies; 3+ messages in thread
From: Kuan-Wei Chiu @ 2026-10-30 3:42 UTC (permalink / raw)
To: Michal Orzel
Cc: xen-devel, Stefano Stabellini, Julien Grall, Bertrand Marquis
On Thu, Oct 29, 2026 at 11:43:05AM +0100, Michal Orzel wrote:
> bootinfo.reserved_mem is used to store different types of memory that
> Xen considers as reserved: domU static mem, normal /reserved-memory,
> FDT memreserve and Xen static heap. make_memory_node(), invoked during
> FDT generation for a hwdom for reserved memory, only skips the domU
> static memory and FDT memreserve. This results in advertising Xen static
> heap (if used) to a hwdom as /memory. This memory is not mapped in P2M
> and guest attempt to access it fails. Interestingly, if the
> /reserved-memory node is placed after /chosen, there is no problem because
> of the check at the beginning of make_memory_node() that finds the first
> memory range using the correct type.
>
> Fixes: 4596329291f5 ("docs, xen/arm: Introduce static heap memory")
> Signed-off-by: Michal Orzel <michal.orzel@amd.com>
Reviewed-by: Kuan-Wei Chiu <visitorckw@gmail.com>
I guess git will treat this as conflicting with my dt patch when
applying. Let me know if this gets merged first and you would like me
to rebase and resend.
Regards,
Kuan-Wei
> ---
> xen/common/device-tree/domain-build.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/xen/common/device-tree/domain-build.c b/xen/common/device-tree/domain-build.c
> index 30a59abfa722..634a26946c24 100644
> --- a/xen/common/device-tree/domain-build.c
> +++ b/xen/common/device-tree/domain-build.c
> @@ -541,8 +541,7 @@ int __init make_memory_node(const struct kernel_info *kinfo, int addrcells,
> u64 start = mem->bank[i].start;
> u64 size = mem->bank[i].size;
>
> - if ( (mem->bank[i].type == MEMBANK_STATIC_DOMAIN) ||
> - (mem->bank[i].type == MEMBANK_FDT_RESVMEM) )
> + if ( mem->bank[i].type != MEMBANK_DEFAULT )
> continue;
>
> nr_cells += reg_size;
> --
> 2.43.0
>
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-10-30 3:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-29 10:43 [PATCH] xen/dt: Don't advertise Xen static-heap region to hwdom Michal Orzel
2026-10-29 11:49 ` Oleksii Kurochko
2026-10-30 3:42 ` Kuan-Wei Chiu
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.