[PATCH 06/10] dom0less: Create llc_color_str field in boot_domain

Alejandro Vallejo posted 10 patches 3 months, 1 week ago
[PATCH 06/10] dom0less: Create llc_color_str field in boot_domain
Posted by Alejandro Vallejo 3 months, 1 week ago
Later patches move the bindings to a separate function and expect the
outputs to land in fields of a boot_domain. Adjust llc_color_str to
live inside boot_domain so it can be parsed later on.

Not a functional change.

Signed-off-by: Alejandro Vallejo <alejandro.garciavallejo@amd.com>
---
 xen/common/device-tree/dom0less-build.c | 12 ++++++++----
 xen/include/xen/bootfdt.h               |  5 +++++
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/xen/common/device-tree/dom0less-build.c b/xen/common/device-tree/dom0less-build.c
index cee666786e..e1d723c796 100644
--- a/xen/common/device-tree/dom0less-build.c
+++ b/xen/common/device-tree/dom0less-build.c
@@ -834,7 +834,6 @@ void __init create_domUs(void)
     BUG_ON(chosen == NULL);
     dt_for_each_child_node(chosen, node)
     {
-        const char *llc_colors_str = NULL;
         struct kernel_info ki = KERNEL_INFO_INIT;
         struct xen_domctl_createdomain *d_cfg = &ki.bd.create_cfg;
         unsigned int *flags = &ki.bd.create_flags;
@@ -955,9 +954,11 @@ void __init create_domUs(void)
             d_cfg->max_maptrack_frames = val;
         }
 
-        dt_property_read_string(node, "llc-colors", &llc_colors_str);
-        if ( !llc_coloring_enabled && llc_colors_str )
+#ifdef CONFIG_HAS_LLC_COLORING
+        dt_property_read_string(node, "llc-colors", &ki.bd.llc_colors_str);
+        if ( !llc_coloring_enabled && ki.bd.llc_colors_str )
             panic("'llc-colors' found, but LLC coloring is disabled\n");
+#endif
 
         arch_create_domUs(node, d_cfg, *flags);
 
@@ -972,10 +973,13 @@ void __init create_domUs(void)
             panic("Error creating domain %s (rc = %ld)\n",
                   dt_node_name(node), PTR_ERR(ki.bd.d));
 
+#ifdef CONFIG_HAS_LLC_COLORING
         if ( llc_coloring_enabled &&
-             (rc = domain_set_llc_colors_from_str(ki.bd.d, llc_colors_str)) )
+             (rc = domain_set_llc_colors_from_str(ki.bd.d,
+                                                  ki.bd.llc_colors_str)) )
             panic("Error initializing LLC coloring for domain %s (rc = %d)\n",
                   dt_node_name(node), rc);
+#endif /* CONFIG_HAS_LLC_COLORING */
 
         ki.bd.d->is_console = true;
         dt_device_set_used_by(node, ki.bd.d->domain_id);
diff --git a/xen/include/xen/bootfdt.h b/xen/include/xen/bootfdt.h
index f107099263..0e82ccea2f 100644
--- a/xen/include/xen/bootfdt.h
+++ b/xen/include/xen/bootfdt.h
@@ -125,6 +125,11 @@ struct boot_domain {
     /* Input arguments to create_domain() */
     struct xen_domctl_createdomain create_cfg;
     unsigned int create_flags;
+
+#ifdef CONFIG_HAS_LLC_COLORING
+    /* LLC color selection string */
+    const char *llc_colors_str;
+#endif
 };
 
 #define BOOTMOD_MAX_CMDLINE 1024
-- 
2.43.0
Re: [PATCH 06/10] dom0less: Create llc_color_str field in boot_domain
Posted by Stefano Stabellini 3 months, 1 week ago
On Tue, 22 Jul 2025, Alejandro Vallejo wrote:
> Later patches move the bindings to a separate function and expect the
> outputs to land in fields of a boot_domain. Adjust llc_color_str to
> live inside boot_domain so it can be parsed later on.
> 
> Not a functional change.
> 
> Signed-off-by: Alejandro Vallejo <alejandro.garciavallejo@amd.com>

Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>


> ---
>  xen/common/device-tree/dom0less-build.c | 12 ++++++++----
>  xen/include/xen/bootfdt.h               |  5 +++++
>  2 files changed, 13 insertions(+), 4 deletions(-)
> 
> diff --git a/xen/common/device-tree/dom0less-build.c b/xen/common/device-tree/dom0less-build.c
> index cee666786e..e1d723c796 100644
> --- a/xen/common/device-tree/dom0less-build.c
> +++ b/xen/common/device-tree/dom0less-build.c
> @@ -834,7 +834,6 @@ void __init create_domUs(void)
>      BUG_ON(chosen == NULL);
>      dt_for_each_child_node(chosen, node)
>      {
> -        const char *llc_colors_str = NULL;
>          struct kernel_info ki = KERNEL_INFO_INIT;
>          struct xen_domctl_createdomain *d_cfg = &ki.bd.create_cfg;
>          unsigned int *flags = &ki.bd.create_flags;
> @@ -955,9 +954,11 @@ void __init create_domUs(void)
>              d_cfg->max_maptrack_frames = val;
>          }
>  
> -        dt_property_read_string(node, "llc-colors", &llc_colors_str);
> -        if ( !llc_coloring_enabled && llc_colors_str )
> +#ifdef CONFIG_HAS_LLC_COLORING
> +        dt_property_read_string(node, "llc-colors", &ki.bd.llc_colors_str);
> +        if ( !llc_coloring_enabled && ki.bd.llc_colors_str )
>              panic("'llc-colors' found, but LLC coloring is disabled\n");
> +#endif
>  
>          arch_create_domUs(node, d_cfg, *flags);
>  
> @@ -972,10 +973,13 @@ void __init create_domUs(void)
>              panic("Error creating domain %s (rc = %ld)\n",
>                    dt_node_name(node), PTR_ERR(ki.bd.d));
>  
> +#ifdef CONFIG_HAS_LLC_COLORING
>          if ( llc_coloring_enabled &&
> -             (rc = domain_set_llc_colors_from_str(ki.bd.d, llc_colors_str)) )
> +             (rc = domain_set_llc_colors_from_str(ki.bd.d,
> +                                                  ki.bd.llc_colors_str)) )
>              panic("Error initializing LLC coloring for domain %s (rc = %d)\n",
>                    dt_node_name(node), rc);
> +#endif /* CONFIG_HAS_LLC_COLORING */
>  
>          ki.bd.d->is_console = true;
>          dt_device_set_used_by(node, ki.bd.d->domain_id);
> diff --git a/xen/include/xen/bootfdt.h b/xen/include/xen/bootfdt.h
> index f107099263..0e82ccea2f 100644
> --- a/xen/include/xen/bootfdt.h
> +++ b/xen/include/xen/bootfdt.h
> @@ -125,6 +125,11 @@ struct boot_domain {
>      /* Input arguments to create_domain() */
>      struct xen_domctl_createdomain create_cfg;
>      unsigned int create_flags;
> +
> +#ifdef CONFIG_HAS_LLC_COLORING
> +    /* LLC color selection string */
> +    const char *llc_colors_str;
> +#endif
>  };
>  
>  #define BOOTMOD_MAX_CMDLINE 1024
> -- 
> 2.43.0
>