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

[PATCH v7 10/11] xen/dt: ifdef out DEV_DT-related bits from device_tree.{c,h}


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Alejandro Vallejo <alejandro.garciavallejo@xxxxxxx>
  • Date: Tue, 15 Jul 2025 18:11:05 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=olMgXBZZBVPXG3tpGWy4AbjtlnK0U3v7Xn2F33nMav0=; b=S45iLuZOWzq1+vHsT17iRYxJgPk8LM1vAI6G+b31LM3055/JLeErJDq8KwsUY+YLRf0E/jy2PtzQjcSJneQCWbcLcrm6yLTAfN0HoEyeRuFjuZrphEZKwpz870juETd6wyjyzQEl6qw0K+BGObk2WZYkULyfwTkr9INmXPa/J/tqHztaGbPrq9Xni8wE5THm3zJSCzd3Na0Y9sKJH6MNZGV6MVezi6wOVvS916K48jtJ2+EAn7xKB3rx6mViWCxI2N7Row8j7lHG4fWIRV4OUXrpamGI17p/cuxQEk2SRWJdXQQRdxOt2QqFu/LxOIgsN2i6vnIZlq5YPdTaf4737g==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=hEL4YFL5w4DgN+h+HjCjMDUxvHBL8OViR8P5OGH5jWz6pEDn+jZR6krSHTGY+FI349EWpwMm2+vFhGMMXNxmmTd7im91s2d5xiH8Dud52LnkI1jDKY/5iEYwIf03g8eDm4+En8qNZT8eP6fj7hNGOg2ofoEiDXdYhFCt/idHBH6GXrOtoyjC0A7zEDXYkiwaAPASJrSPVYAYWFgts6H8NC60JEgWINUgKQfUCXT+TUdpyI0142kCM0NYK0crjn4bLe/7dQ4ATzZ0C9LFNsD9KV2zH67TZUYx8IblXC1ypQORrOGakN9YjTJIG/Y8gBs51Rtz79A4SmSwfX1Sw/62XA==
  • Cc: Alejandro Vallejo <alejandro.garciavallejo@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Tue, 15 Jul 2025 16:12:01 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Architectures that don't discover devices via DT may skip anything to
do with device_t during the DT unflattening phase. Make device-tree.c
stop requiring CONFIG_HAS_DEVICE_TREE_DISCOVERY so it may function with
CONFIG_DEVICE_TREE_PARSE alone.

This allows CONFIG_DEVICE_TREE_PARSE to unflatten a DT ignoring its
devices if CONFIG_HAS_DEVICE_TREE_DISCOVERY is not selected.

Signed-off-by: Alejandro Vallejo <alejandro.garciavallejo@xxxxxxx>
Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>
---
 xen/common/device-tree/device-tree.c | 2 ++
 xen/include/xen/device_tree.h        | 4 ++++
 2 files changed, 6 insertions(+)

diff --git a/xen/common/device-tree/device-tree.c 
b/xen/common/device-tree/device-tree.c
index 4ebdb2e52e..84daa3f0ed 100644
--- a/xen/common/device-tree/device-tree.c
+++ b/xen/common/device-tree/device-tree.c
@@ -2030,9 +2030,11 @@ static unsigned long 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_HAS_DEVICE_TREE_DISCOVERY
             /* Generic device initialization */
             np->dev.type = DEV_DT;
             np->dev.of_node = np;
+#endif /* CONFIG_HAS_DEVICE_TREE_DISCOVERY */
         }
     }
     if ( allnextpp )
diff --git a/xen/include/xen/device_tree.h b/xen/include/xen/device_tree.h
index 8a39a60c54..06d7643622 100644
--- a/xen/include/xen/device_tree.h
+++ b/xen/include/xen/device_tree.h
@@ -108,9 +108,12 @@ struct dt_device_node {
      */
     struct list_head domain_list;
 
+#ifdef CONFIG_HAS_DEVICE_TREE_DISCOVERY
     struct device dev;
+#endif /* CONFIG_HAS_DEVICE_TREE_DISCOVERY */
 };
 
+#ifdef CONFIG_HAS_DEVICE_TREE_DISCOVERY
 #define dt_to_dev(dt_node)  (&(dt_node)->dev)
 
 static inline struct dt_device_node *dev_to_dt(struct device *dev)
@@ -119,6 +122,7 @@ static inline struct dt_device_node *dev_to_dt(struct 
device *dev)
 
     return container_of(dev, struct dt_device_node, dev);
 }
+#endif /* CONFIG_HAS_DEVICE_TREE_DISCOVERY */
 
 #define MAX_PHANDLE_ARGS 16
 struct dt_phandle_args {
-- 
2.43.0




 


Rackspace

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