On 15.12.2023 03:43, Shawn Anastasio wrote:
Move Arm's bootfdt.c to xen/common so that it can be used by other
device tree architectures like PPC and RISCV. Only a minor change to
conditionalize a call to a function only available on EFI-supporting
targets was made to the code itself.
Suggested-by: Julien Grall <julien@xxxxxxx>
Signed-off-by: Shawn Anastasio <sanastasio@xxxxxxxxxxxxxxxxxxxxx>
---
xen/arch/arm/Makefile | 1 -
xen/common/Makefile | 1 +
xen/common/device-tree/Makefile | 1 +
xen/{arch/arm => common/device-tree}/bootfdt.c | 15 +++++++++------
4 files changed, 11 insertions(+), 7 deletions(-)
create mode 100644 xen/common/device-tree/Makefile
rename xen/{arch/arm => common/device-tree}/bootfdt.c (98%)
I think this wants to come with an update to ./MAINTAINERS, such that
the file doesn't change maintainership.
--- a/xen/arch/arm/bootfdt.c
+++ b/xen/common/device-tree/bootfdt.c
@@ -431,12 +431,15 @@ static int __init early_scan_node(const void *fdt,
{
int rc = 0;
- /*
- * If Xen has been booted via UEFI, the memory banks are
- * populated. So we should skip the parsing.
- */
- if ( !efi_enabled(EFI_BOOT) &&
- device_tree_node_matches(fdt, node, "memory") )
+ if ( device_tree_node_matches(fdt, node, "memory") )
+#if defined(CONFIG_ARM_EFI)
+ /*
+ * If Xen has been booted via UEFI, the memory banks are
+ * populated. So we should skip the parsing.
+ */
+ if ( efi_enabled(EFI_BOOT) )
+ return rc;
+#endif
I'm not a DT maintainer, but I don't like this kind of #ifdef, the more
that maybe PPC and quite likely RISC-V are likely to also want to support
EFI boot. But of course there may be something inherently Arm-specific
here that I'm unaware of.