[PATCH 44/48] hw/arm/xlnx-versal-virt: tidy up

Luc Michel posted 48 patches 4 months ago
Maintainers: Alistair Francis <alistair@alistair23.me>, "Edgar E. Iglesias" <edgar.iglesias@gmail.com>, Peter Maydell <peter.maydell@linaro.org>, Jason Wang <jasowang@redhat.com>
There is a newer version of this series
[PATCH 44/48] hw/arm/xlnx-versal-virt: tidy up
Posted by Luc Michel 4 months ago
Remove now unused clock nodes. They have been replaced by the ones
created in the SoC. Remove the unused cfg.secure VersalVirt field.
Remove unecessary include directives.

Signed-off-by: Luc Michel <luc.michel@amd.com>
---
 hw/arm/xlnx-versal-virt.c | 24 ------------------------
 1 file changed, 24 deletions(-)

diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c
index 9b20aef8b07..154ed7332c3 100644
--- a/hw/arm/xlnx-versal-virt.c
+++ b/hw/arm/xlnx-versal-virt.c
@@ -17,14 +17,12 @@
 #include "system/address-spaces.h"
 #include "hw/block/flash.h"
 #include "hw/boards.h"
 #include "hw/sysbus.h"
 #include "hw/arm/fdt.h"
-#include "hw/qdev-properties.h"
 #include "hw/arm/xlnx-versal.h"
 #include "hw/arm/boot.h"
-#include "target/arm/multiprocessing.h"
 #include "qom/object.h"
 #include "target/arm/cpu.h"
 
 #define TYPE_XLNX_VERSAL_VIRT_BASE_MACHINE \
     MACHINE_TYPE_NAME("amd-versal-virt-base")
@@ -39,20 +37,15 @@ struct VersalVirt {
 
     Versal soc;
 
     void *fdt;
     int fdt_size;
-    struct {
-        uint32_t clk_125Mhz;
-        uint32_t clk_25Mhz;
-    } phandle;
     struct arm_boot_info binfo;
 
     CanBusState **canbus;
 
     struct {
-        bool secure;
         char *ospi_model;
     } cfg;
 };
 
 struct VersalVirtClass {
@@ -70,35 +63,20 @@ static void fdt_create(VersalVirt *s)
     if (!s->fdt) {
         error_report("create_device_tree() failed");
         exit(1);
     }
 
-    /* Allocate all phandles.  */
-    s->phandle.clk_25Mhz = qemu_fdt_alloc_phandle(s->fdt);
-    s->phandle.clk_125Mhz = qemu_fdt_alloc_phandle(s->fdt);
-
     /* Create /chosen node for load_dtb.  */
     qemu_fdt_add_subnode(s->fdt, "/chosen");
     qemu_fdt_add_subnode(s->fdt, "/aliases");
 
     /* Header */
     qemu_fdt_setprop_string(s->fdt, "/", "model", mc->desc);
     qemu_fdt_setprop(s->fdt, "/", "compatible", versal_compat,
                      sizeof(versal_compat));
 }
 
-static void fdt_add_clk_node(VersalVirt *s, const char *name,
-                             unsigned int freq_hz, uint32_t phandle)
-{
-    qemu_fdt_add_subnode(s->fdt, name);
-    qemu_fdt_setprop_cell(s->fdt, name, "phandle", phandle);
-    qemu_fdt_setprop_cell(s->fdt, name, "clock-frequency", freq_hz);
-    qemu_fdt_setprop_cell(s->fdt, name, "#clock-cells", 0x0);
-    qemu_fdt_setprop_string(s->fdt, name, "compatible", "fixed-clock");
-    qemu_fdt_setprop(s->fdt, name, "u-boot,dm-pre-reloc", NULL, 0);
-}
-
 static void fdt_nop_memory_nodes(void *fdt, Error **errp)
 {
     Error *err = NULL;
     char **node_path;
     int n = 0;
@@ -263,12 +241,10 @@ static void versal_virt_init(MachineState *machine)
                                  &error_abort);
     }
 
     fdt_create(s);
     versal_set_fdt(&s->soc, s->fdt);
-    fdt_add_clk_node(s, "/old-clk125", 125000000, s->phandle.clk_125Mhz);
-    fdt_add_clk_node(s, "/old-clk25", 25000000, s->phandle.clk_25Mhz);
 
     sysbus_realize(SYS_BUS_DEVICE(&s->soc), &error_fatal);
     create_virtio_regions(s);
 
     /*
-- 
2.50.0
Re: [PATCH 44/48] hw/arm/xlnx-versal-virt: tidy up
Posted by Francisco Iglesias 3 months, 2 weeks ago
On Wed, Jul 16, 2025 at 11:54:26AM +0200, Luc Michel wrote:
> Remove now unused clock nodes. They have been replaced by the ones
> created in the SoC. Remove the unused cfg.secure VersalVirt field.
> Remove unecessary include directives.
> 
> Signed-off-by: Luc Michel <luc.michel@amd.com>

Reviewed-by: Francisco Iglesias <francisco.iglesias@amd.com>

> ---
>  hw/arm/xlnx-versal-virt.c | 24 ------------------------
>  1 file changed, 24 deletions(-)
> 
> diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c
> index 9b20aef8b07..154ed7332c3 100644
> --- a/hw/arm/xlnx-versal-virt.c
> +++ b/hw/arm/xlnx-versal-virt.c
> @@ -17,14 +17,12 @@
>  #include "system/address-spaces.h"
>  #include "hw/block/flash.h"
>  #include "hw/boards.h"
>  #include "hw/sysbus.h"
>  #include "hw/arm/fdt.h"
> -#include "hw/qdev-properties.h"
>  #include "hw/arm/xlnx-versal.h"
>  #include "hw/arm/boot.h"
> -#include "target/arm/multiprocessing.h"
>  #include "qom/object.h"
>  #include "target/arm/cpu.h"
>  
>  #define TYPE_XLNX_VERSAL_VIRT_BASE_MACHINE \
>      MACHINE_TYPE_NAME("amd-versal-virt-base")
> @@ -39,20 +37,15 @@ struct VersalVirt {
>  
>      Versal soc;
>  
>      void *fdt;
>      int fdt_size;
> -    struct {
> -        uint32_t clk_125Mhz;
> -        uint32_t clk_25Mhz;
> -    } phandle;
>      struct arm_boot_info binfo;
>  
>      CanBusState **canbus;
>  
>      struct {
> -        bool secure;
>          char *ospi_model;
>      } cfg;
>  };
>  
>  struct VersalVirtClass {
> @@ -70,35 +63,20 @@ static void fdt_create(VersalVirt *s)
>      if (!s->fdt) {
>          error_report("create_device_tree() failed");
>          exit(1);
>      }
>  
> -    /* Allocate all phandles.  */
> -    s->phandle.clk_25Mhz = qemu_fdt_alloc_phandle(s->fdt);
> -    s->phandle.clk_125Mhz = qemu_fdt_alloc_phandle(s->fdt);
> -
>      /* Create /chosen node for load_dtb.  */
>      qemu_fdt_add_subnode(s->fdt, "/chosen");
>      qemu_fdt_add_subnode(s->fdt, "/aliases");
>  
>      /* Header */
>      qemu_fdt_setprop_string(s->fdt, "/", "model", mc->desc);
>      qemu_fdt_setprop(s->fdt, "/", "compatible", versal_compat,
>                       sizeof(versal_compat));
>  }
>  
> -static void fdt_add_clk_node(VersalVirt *s, const char *name,
> -                             unsigned int freq_hz, uint32_t phandle)
> -{
> -    qemu_fdt_add_subnode(s->fdt, name);
> -    qemu_fdt_setprop_cell(s->fdt, name, "phandle", phandle);
> -    qemu_fdt_setprop_cell(s->fdt, name, "clock-frequency", freq_hz);
> -    qemu_fdt_setprop_cell(s->fdt, name, "#clock-cells", 0x0);
> -    qemu_fdt_setprop_string(s->fdt, name, "compatible", "fixed-clock");
> -    qemu_fdt_setprop(s->fdt, name, "u-boot,dm-pre-reloc", NULL, 0);
> -}
> -
>  static void fdt_nop_memory_nodes(void *fdt, Error **errp)
>  {
>      Error *err = NULL;
>      char **node_path;
>      int n = 0;
> @@ -263,12 +241,10 @@ static void versal_virt_init(MachineState *machine)
>                                   &error_abort);
>      }
>  
>      fdt_create(s);
>      versal_set_fdt(&s->soc, s->fdt);
> -    fdt_add_clk_node(s, "/old-clk125", 125000000, s->phandle.clk_125Mhz);
> -    fdt_add_clk_node(s, "/old-clk25", 25000000, s->phandle.clk_25Mhz);
>  
>      sysbus_realize(SYS_BUS_DEVICE(&s->soc), &error_fatal);
>      create_virtio_regions(s);
>  
>      /*
> -- 
> 2.50.0
>