xen/arm: bootfdt: Ignore empty memory bank
PATCH 1/1 xen/arm: bootfdt: Ignore empty memory bank
From: Julien Grall <[email protected]>
At the moment, Xen will stop processing the Device Tree if a memory bank is empty (size == 0).
Unfortunately, some of the Device Tree (such as on Colibri imx8qxp) may contain such a bank. This means Xen will not be able to boot properly.
Relax the check to just ignore the banks. FWIW this also seems to be the behavior adopted by Linux.
--- xen/arch/arm/bootfdt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
xen/arch/arm/bootfdt.c +2 -1
@@ -163,8 +163,9 @@ static int __init process_memory_node(const void *fdt, int node,for ( i =0 ; i < banks && mem->nr_banks <NR_MEM_BANKS ; i++ ) {device_tree_get_reg (&cell, address_cells, size_cells, &start, &size); +/* Some DT may describe empty bank, ignore them */ if ( !size ) -return -EINVAL ; +continue ; mem->bank[mem->nr_banks].start = start; mem->bank[mem->nr_banks].size = size; mem->nr_banks++;
Signature · 1 line
2.17.1
Quoted 13 lines · Julien Grall
From: Julien Grall <[email protected]>
At the moment, Xen will stop processing the Device Tree if a memory bank is empty (size == 0).
Unfortunately, some of the Device Tree (such as on Colibri imx8qxp) may contain such a bank. This means Xen will not be able to boot properly.
Quoted 5 lines
Relax the check to just ignore the banks. FWIW this also seems to be the behavior adopted by Linux.
Reported-by Daniel Wagner <[email protected]>Signed-off-by Julien Grall <[email protected]>
Quoted 23 lines
---
xen/arch/arm/bootfdt.c| 3 ++-1 file changed, 2 insertions(+), 1 deletion(-)xen/arch/arm/bootfdt.c +2
-1@@ -163,8 +163,9 @@ static int __init process_memory_node(const void *fdt, int node,for ( i =0 ; i < banks && mem->nr_banks <NR_MEM_BANKS ; i++ ) {device_tree_get_reg (&cell, address_cells, size_cells, &start, &size); +/* Some DT may describe empty bank, ignore them */ if ( !size ) -return -EINVAL ; +continue ; mem->bank[mem->nr_banks].start = start; mem->bank[mem->nr_banks].size = size; mem->nr_banks++;Signature · 1 line
2.17.1
Stefano Stabellini
Acked-byQuoted 11 lines · Bertrand Marquis
Quoted 11 lines · Julien Grall
From: Julien Grall <[email protected]>
At the moment, Xen will stop processing the Device Tree if a memory bank is empty (size == 0).
Unfortunately, some of the Device Tree (such as on Colibri imx8qxp) may contain such a bank. This means Xen will not be able to boot properly.
Quoted 7 lines
Quoted 5 lines
Relax the check to just ignore the banks. FWIW this also seems to be the behavior adopted by Linux.
Reported-by Daniel Wagner <[email protected]>Signed-off-by Julien Grall <[email protected]>Reviewed-by Bertrand Marquis <[email protected]>
Quoted 24 lines
Quoted 23 lines
---
xen/arch/arm/bootfdt.c| 3 ++-1 file changed, 2 insertions(+), 1 deletion(-)xen/arch/arm/bootfdt.c +2
-1@@ -163,8 +163,9 @@ static int __init process_memory_node(const void *fdt, int node,for ( i =0 ; i < banks && mem->nr_banks <NR_MEM_BANKS ; i++ ) {device_tree_get_reg (&cell, address_cells, size_cells, &start, &size); +/* Some DT may describe empty bank, ignore them */ if ( !size ) -return -EINVAL ; +continue ; mem->bank[mem->nr_banks].start = start; mem->bank[mem->nr_banks].size = size; mem->nr_banks++;Signature · 1 line
2.17.1