[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[RFC 04/10] device-tree: split agnostic device-tree from arm


  • To: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>
  • Date: Fri, 17 Dec 2021 18:34:30 -0500
  • Arc-authentication-results: i=1; mx.zohomail.com; dkim=pass header.i=apertussolutions.com; spf=pass smtp.mailfrom=dpsmith@xxxxxxxxxxxxxxxxxxxx; dmarc=pass header.from=<dpsmith@xxxxxxxxxxxxxxxxxxxx>
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1639769531; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=UFJoq4z4heOloPDSzW6Y95pMjws+Z0IPoCLVo0DLBwc=; b=TknipIJcJuInWq7Qo2q68MJViEys3ao5EbmBT6NiLaUK0O4p4uVbVDdqlPLucI2CaUPc+lZLmzafA8lXZz1xh655dwNMe5TWhDnaomqJV9GXWL8UBYyGx9CHMjWMxjNGDejz0eNi+hTpmXXMbedTfLDkTPgSJjl2Ly5jU2l0C9U=
  • Arc-seal: i=1; a=rsa-sha256; t=1639769531; cv=none; d=zohomail.com; s=zohoarc; b=FtIm41ruqTOp600k8iYbUBpQv3WAX7IwUdUHTw7zP4Z0Zwww4S0m8CW6zUfCts269WM9CieFWRUQVe3faX4y4abhxKuTRBXvqpjK9P7nEabSfs3lDZFLc4xzFCdPWwumDGXJSRIyhJIgCTR6BVOazSZZtj4OQnBca3fJIbyEhOI=
  • Cc: "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>, Christopher Clark <christopher.clark@xxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Fri, 17 Dec 2021 19:33:32 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

This commit is purely for RFC to highlight some concerns and changes necessary
in order for hyperlaunch to utilize device tree as the boot configuration
container.

Despite being in common, the core device tree support enabled through
CONFIG_HAS_DEVICE_TREE will not build for an x86 configuration. This is due to
the fact that despite `struct device` appearing to be intended as a common data
structure is in fact unique on x86 and Arm. There is code in
xen/common/device_tree.c and include/xen/iommu.h that uses struct members found
in Arm's `struct device` that are not present in x86's version. This obviously
ends in compilation errors when enabling CONFIG_HAS_DEVICE_TREE on x86.

As a result this commit seeks to separate between requiring the ability to
parse DTB files and obtaining hardware definition from those DTB files. The
Kconfig parameter CORE_DEVICE_TREE was introduced for when only the former is
necessary and not the latter. It specifically allows for the inclusion of the
device tree parsing code without enabling the areas that make use of Arm
specific `struct device`.

For the RFC when the Arm specific `struct device` is referenced within device
tree parsing code, check for Arm has been added as an interim solution until a
long term solution, that is beyond the scope of the hyperlaunch patch set, can
be proposed and implemented.

Signed-off-by: Daniel P. Smith <dpsmith@xxxxxxxxxxxxxxxxxxxx>
Reviewed-by: Christopher Clark <christopher.clark@xxxxxxxxxx>
---
 xen/common/Kconfig            | 5 +++++
 xen/common/Makefile           | 4 ++--
 xen/common/device_tree.c      | 2 ++
 xen/include/xen/device_tree.h | 4 ++++
 4 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/xen/common/Kconfig b/xen/common/Kconfig
index 5e6aad644e..aece21c9e5 100644
--- a/xen/common/Kconfig
+++ b/xen/common/Kconfig
@@ -31,8 +31,12 @@ config HAS_ALTERNATIVE
 config HAS_COMPAT
        bool
 
+config CORE_DEVICE_TREE
+       bool
+
 config HAS_DEVICE_TREE
        bool
+       select CORE_DEVICE_TREE
 
 config HAS_EX_TABLE
        bool
@@ -333,6 +337,7 @@ config ARGO
 
 config HYPERLAUNCH
        bool "Hyperlaunch support (UNSUPPORTED)" if UNSUPPORTED
+       select CORE_DEVICE_TREE
        ---help---
          Enables launch of multiple VMs at host boot as an alternative
          method of starting a Xen system.
diff --git a/xen/common/Makefile b/xen/common/Makefile
index a6337e065a..f22aec72a0 100644
--- a/xen/common/Makefile
+++ b/xen/common/Makefile
@@ -4,7 +4,7 @@ obj-$(CONFIG_HYPFS_CONFIG) += config_data.o
 obj-$(CONFIG_CORE_PARKING) += core_parking.o
 obj-y += cpu.o
 obj-$(CONFIG_DEBUG_TRACE) += debugtrace.o
-obj-$(CONFIG_HAS_DEVICE_TREE) += device_tree.o
+obj-$(CONFIG_CORE_DEVICE_TREE) += device_tree.o
 obj-$(CONFIG_IOREQ_SERVER) += dm.o
 obj-y += domain.o
 obj-y += event_2l.o
@@ -73,7 +73,7 @@ obj-y += sched/
 obj-$(CONFIG_UBSAN) += ubsan/
 
 obj-$(CONFIG_NEEDS_LIBELF) += libelf/
-obj-$(CONFIG_HAS_DEVICE_TREE) += libfdt/
+obj-$(CONFIG_CORE_DEVICE_TREE) += libfdt/
 
 CONF_FILE := $(if $(patsubst 
/%,,$(KCONFIG_CONFIG)),$(BASEDIR)/)$(KCONFIG_CONFIG)
 config.gz: $(CONF_FILE)
diff --git a/xen/common/device_tree.c b/xen/common/device_tree.c
index 4aae281e89..d92fad2998 100644
--- a/xen/common/device_tree.c
+++ b/xen/common/device_tree.c
@@ -2012,9 +2012,11 @@ static unsigned long __init unflatten_dt_node(const void 
*fdt,
             ((char *)pp->value)[sz - 1] = 0;
             dt_dprintk("fixed up name for %s -> %s\n", pathp,
                        (char *)pp->value);
+#ifdef CONFIG_ARM
             /* Generic device initialization */
             np->dev.type = DEV_DT;
             np->dev.of_node = np;
+#endif
         }
     }
     if ( allnextpp )
diff --git a/xen/include/xen/device_tree.h b/xen/include/xen/device_tree.h
index fd6cd00b43..ca9f7672e9 100644
--- a/xen/include/xen/device_tree.h
+++ b/xen/include/xen/device_tree.h
@@ -101,9 +101,12 @@ struct dt_device_node {
      */
     struct list_head domain_list;
 
+#ifdef CONFIG_ARM
     struct device dev;
+#endif
 };
 
+#ifdef CONFIG_ARM
 #define dt_to_dev(dt_node)  (&(dt_node)->dev)
 
 static inline struct dt_device_node *dev_to_dt(struct device *dev)
@@ -112,6 +115,7 @@ static inline struct dt_device_node *dev_to_dt(struct 
device *dev)
 
     return container_of(dev, struct dt_device_node, dev);
 }
+#endif
 
 #define MAX_PHANDLE_ARGS 16
 struct dt_phandle_args {
-- 
2.20.1




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.