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

Re: [PATCH v6 05/11] xen/dt: Move bootfdt functions to xen/bootfdt.h


  • To: Alejandro Vallejo <alejandro.garciavallejo@xxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Alejandro Vallejo <alejandro.garciavallejo@xxxxxxx>
  • Date: Fri, 11 Jul 2025 19:45:28 +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=175fTwE5D2iY0XTJ2Qw44dGL7GCMH5URhqbXoQl5dPg=; b=kaKI0OvIv0RckVnEU+k5WuYhTmvMPhcLpo0LcWbWZh9uPUwdvVRflEbTY2ZfyEPFOHfQfedjkxxpHQL+cwRk/wlputut/kTiriE/Tq0/euOnkayKTSVgQad7OAHKIcEKcs+dl8Qit0C4QJ2vJeaJ99CE6+YafQhJvnWTEJ6qU33jfvOOJSGgnNqAXs9NIvSFXBmo0gXPN0UGciCocQXP4Zf2P43s2CmtplFXly0O6UULi8TIB/EZfj+lq1zjQG5KPUHxQmywLCkKjsOPSTJggJ8EW9TY4o0bRsE7x2OK2WMbf5cAt7TQDS79Y3ANnDueZ3rYFKuo5IhpkjYW1zGzEA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=OACEQvkqXHhiMYBs2g6ybXKZ6k/YkOw8mB9iR/l65zyctW7N+EcjD8qtuIYdgYe8+VQNEU+o/h0YALB7mjWFmtDrVWOmIgO1hghwWdh4noQKuinPA/vebQp3va3RXhM7IZUeeDHXnemjltPnddoNU71he2Kw02ZY0yC9NfuH/nQC0DARCgjiUxIFre6Rxwble1f7xawB/TyVxX+vfg5kreZ/sXVOnz/JW7Lzf7qzVdJqBdH3+75kRxbNBwjiZgqZ4SR118nFlrdby9Lkx8mU2UbqPs+MGZCjSJzXM7XMNTkgHWXdWT/8h0gqB+b1v1AsGjOFTOyPbcuYkYASyytWMQ==
  • Cc: Alejandro Vallejo <agarciav@xxxxxxx>, Alistair Francis <alistair.francis@xxxxxxx>, Bob Eshleman <bobbyeshleman@xxxxxxxxx>, "Connor Davis" <connojdavis@xxxxxxxxx>, Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Michal Orzel <michal.orzel@xxxxxxx>, Dario Faggioli <dfaggioli@xxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, George Dunlap <gwd@xxxxxxxxxxxxxx>, "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Fri, 11 Jul 2025 17:45:55 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Tue Jul 8, 2025 at 8:07 PM CEST, Alejandro Vallejo wrote:
> From: Alejandro Vallejo <agarciav@xxxxxxx>
>
> Part of an unpicking process to extract bootfdt contents independent of 
> bootinfo
> to a separate file for x86 to take.
>
> Move functions required for early FDT parsing from device_tree.h and arm's
> setup.h onto bootfdt.h
>
> Declaration motion only. Not a functional change.
>
> Signed-off-by: Alejandro Vallejo <agarciav@xxxxxxx>
> Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>
> ---
>  xen/arch/riscv/cpufeature.c            |  1 +
>  xen/arch/riscv/smpboot.c               |  1 +
>  xen/common/device-tree/device-tree.c   |  1 +
>  xen/common/device-tree/static-evtchn.c |  1 +
>  xen/common/sched/boot-cpupool.c        |  1 +
>  xen/include/xen/bootfdt.h              | 91 ++++++++++++++++++++++++++
>  xen/include/xen/device_tree.h          | 78 ----------------------
>  7 files changed, 96 insertions(+), 78 deletions(-)
>
> diff --git a/xen/arch/riscv/cpufeature.c b/xen/arch/riscv/cpufeature.c
> index b7d5ec6580..b846a106a3 100644
> --- a/xen/arch/riscv/cpufeature.c
> +++ b/xen/arch/riscv/cpufeature.c
> @@ -8,6 +8,7 @@
>   */
>  
>  #include <xen/bitmap.h>
> +#include <xen/bootfdt.h>
>  #include <xen/ctype.h>
>  #include <xen/device_tree.h>
>  #include <xen/errno.h>
> diff --git a/xen/arch/riscv/smpboot.c b/xen/arch/riscv/smpboot.c
> index 470f6d1311..3b8bf98e20 100644
> --- a/xen/arch/riscv/smpboot.c
> +++ b/xen/arch/riscv/smpboot.c
> @@ -1,3 +1,4 @@
> +#include <xen/bootfdt.h>
>  #include <xen/cpumask.h>
>  #include <xen/device_tree.h>
>  #include <xen/errno.h>
> diff --git a/xen/common/device-tree/device-tree.c 
> b/xen/common/device-tree/device-tree.c
> index 7bede20fa6..4ebdb2e52e 100644
> --- a/xen/common/device-tree/device-tree.c
> +++ b/xen/common/device-tree/device-tree.c
> @@ -8,6 +8,7 @@
>   */
>  
>  #include <xen/bitops.h>
> +#include <xen/bootfdt.h>
>  #include <xen/types.h>
>  #include <xen/init.h>
>  #include <xen/guest_access.h>
> diff --git a/xen/common/device-tree/static-evtchn.c 
> b/xen/common/device-tree/static-evtchn.c
> index 8b82e6b3d8..88342b44a1 100644
> --- a/xen/common/device-tree/static-evtchn.c
> +++ b/xen/common/device-tree/static-evtchn.c
> @@ -1,5 +1,6 @@
>  /* SPDX-License-Identifier: GPL-2.0-only */
>  
> +#include <xen/bootfdt.h>
>  #include <xen/event.h>
>  #include <xen/static-evtchn.h>
>  
> diff --git a/xen/common/sched/boot-cpupool.c b/xen/common/sched/boot-cpupool.c
> index 641f3495cb..03be73efdd 100644
> --- a/xen/common/sched/boot-cpupool.c
> +++ b/xen/common/sched/boot-cpupool.c
> @@ -7,6 +7,7 @@
>   * Copyright (C) 2022 Arm Ltd.
>   */
>  
> +#include <xen/bootfdt.h>
>  #include <xen/acpi.h>
>  #include <xen/sched.h>
>  
> diff --git a/xen/include/xen/bootfdt.h b/xen/include/xen/bootfdt.h
> index 65ba818e1a..6cf6c1317c 100644
> --- a/xen/include/xen/bootfdt.h
> +++ b/xen/include/xen/bootfdt.h
> @@ -2,8 +2,11 @@
>  #ifndef XEN_BOOTFDT_H
>  #define XEN_BOOTFDT_H
>  
> +#include <xen/byteorder.h>
> +#include <xen/bug.h>
>  #include <xen/types.h>
>  #include <xen/kernel.h>
> +#include <xen/lib.h>
>  #include <xen/macros.h>
>  #include <xen/xmalloc.h>
>  
> @@ -16,8 +19,80 @@
>  #define NR_MEM_BANKS 256
>  #define NR_SHMEM_BANKS 32
>  
> +/* Default #address and #size cells */
> +#define DT_ROOT_NODE_ADDR_CELLS_DEFAULT 2
> +#define DT_ROOT_NODE_SIZE_CELLS_DEFAULT 1
> +
>  #define MAX_MODULES 32 /* Current maximum useful modules */
>  
> +#define DEVICE_TREE_MAX_DEPTH 16
> +
> +/* Helper to read a big number; size is in cells (not bytes) */
> +static inline u64 dt_read_number(const __be32 *cell, int size)
> +{
> +    u64 r = 0;
> +
> +    while ( size-- )
> +        r = (r << 32) | be32_to_cpu(*(cell++));
> +    return r;
> +}

Bah, bad rebase. This should've been the new switch. I'll correct it on when I
resend it.

Cheers,
Alejandro



 


Rackspace

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