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

[PATCH v6 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, 8 Jul 2025 20:07:19 +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=aawmRkDQfgpKUld2wU0InG12ut22yRhJeR9B5PxPCGA=; b=R2CwykSJlR2sthzmVZveKl+r5m0G2d8WCTqgKtINPD5jBc0SrBZVtr9gVvN1WB7ZP4SEFojMLNBOjfiq0xWU1+egiKRtxj4Ihr59aPjtIPrCfffG50lDLiB5rQcRfeHkUi53Be9otMYutz999WZhW75tF4qNI4yJjbusWH+QBhubx1c5KvSHVINDn8e0Z1XGlR/DRbtvsoNKmHVj7VJlIaJAc+phH9MEWAMx1yY+F+8B800vOdZMl46hkocTSk43lVrFwLfBeMH35B8JizNrpcfslvyz2cHi58ko0m5WhnA8GF4ozAvMrw5vIQ1jRUmINmePX7+fxHN+nkk8id2r/A==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=MJsVm11Fk2Yyg5fHIlOH8bLZVl/mx5/qKOBXkWw6n3mTJmbq3uGfoCVa5Xt3MU93ndTq8Y8Z9T40238ur+WlgD2U7U6n/yXXx+DUP8Etbl5LQROBLfW3+S6MxKqxPeXvN5sAj6yEY2kBEPNy/oVbTMgZhrUe7HRJILLMTJg6EgNYCdZk8zf5FmmkK2JWXVOcEF5yCfRgYTqLUp0njtWbBk19sppHYbh92NgIQStPwPAxGm3ARxl8v7jRQ5G8vViDjUQNc7AobXitZ+4sZbAV21r60wceXfxJgr306vok8x3/F+XN7GQup3ISxkKfRK21ogdF3yDshkUb6qaC4Z0gqA==
  • Cc: Alejandro Vallejo <agarciav@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, 08 Jul 2025 18:08:17 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

From: Alejandro Vallejo <agarciav@xxxxxxx>

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 <agarciav@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®.