|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [RFC PATCH v3 6/7] xen/arm: Export host device-tree to hypfs
From: Oleksii Moisieiev <oleksii_moisieiev@xxxxxxxx>
If enabled, host device-tree will be exported to hypfs and can be
accessed through /devicetree path.
Exported device-tree has the same format, as the device-tree
exported to the sysfs by the Linux kernel.
This is useful when XEN toolstack needs an access to the host device-tree.
Signed-off-by: Oleksii Moisieiev <oleksii_moisieiev@xxxxxxxx>
---
xen/arch/arm/Kconfig | 16 ++++++++++++++++
xen/arch/arm/Makefile | 1 +
xen/arch/arm/host_dtb_export.c | 28 ++++++++++++++++++++++++++++
3 files changed, 45 insertions(+)
create mode 100644 xen/arch/arm/host_dtb_export.c
diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig
index a26d3e11827c..fa51244e2706 100644
--- a/xen/arch/arm/Kconfig
+++ b/xen/arch/arm/Kconfig
@@ -125,6 +125,22 @@ config DOM0LESS_BOOT
Xen boot without the need of a control domain (Dom0), which could be
present anyway.
+config HOST_DTB_EXPORT
+ bool "Export host device tree to hypfs if enabled"
+ depends on ARM && HYPFS && !ACPI
+ help
+
+ Export host device-tree to hypfs so toolstack can have an access for
the
+ host device tree from Dom0. If you unsure say N.
+
+config HOST_DTB_MAX_SIZE
+ int "Max host dtb export size"
+ depends on HOST_DTB_EXPORT
+ default 8192
+ help
+
+ Maximum size of the host device-tree exported to hypfs.
+
config GICV3
bool "GICv3 driver"
depends on !NEW_VGIC
diff --git a/xen/arch/arm/Makefile b/xen/arch/arm/Makefile
index 43ab5e8f2550..1518592deb64 100644
--- a/xen/arch/arm/Makefile
+++ b/xen/arch/arm/Makefile
@@ -20,6 +20,7 @@ obj-$(CONFIG_DOM0LESS_BOOT) += dom0less-build.init.o
obj-y += domain.o
obj-y += domain_build.init.o
obj-y += domctl.o
+obj-$(CONFIG_HOST_DTB_EXPORT) += host_dtb_export.o
obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
obj-y += efi/
obj-y += gic.o
diff --git a/xen/arch/arm/host_dtb_export.c b/xen/arch/arm/host_dtb_export.c
new file mode 100644
index 000000000000..c9beb2803883
--- /dev/null
+++ b/xen/arch/arm/host_dtb_export.c
@@ -0,0 +1,28 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Export host FDT to the hypfs
+ *
+ * Copyright (C) 2024 EPAM Systems
+ */
+
+#include <xen/device_tree.h>
+#include <xen/hypfs.h>
+#include <xen/init.h>
+#include <xen/libfdt/libfdt.h>
+
+static HYPFS_VARSIZE_INIT(dt_prop, XEN_HYPFS_TYPE_BLOB,
+ "devicetree", CONFIG_HOST_DTB_MAX_SIZE,
+ &hypfs_leaf_ro_funcs);
+
+static int __init host_dtb_export_init(void)
+{
+ ASSERT(dt_host && (dt_host->sibling == NULL));
+
+ dt_prop.u.content = device_tree_flattened;
+ dt_prop.e.size = fdt_totalsize(device_tree_flattened);
+ hypfs_add_leaf(&hypfs_root, &dt_prop, true);
+
+ return 0;
+}
+
+__initcall(host_dtb_export_init);
--
2.34.1
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |