- * [PATCH v1 01/11] hw/arm: versal: Remove inclusion of arm_gicv3_common.h
  2020-04-27 18:16 [PATCH v1 00/11] hw/arm: versal: Add SD and the RTC Edgar E. Iglesias
@ 2020-04-27 18:16 ` Edgar E. Iglesias
  2020-04-27 20:08   ` Alistair Francis
  2020-04-29  7:23   ` Luc Michel
  2020-04-27 18:16 ` [PATCH v1 02/11] hw/arm: versal: Move misplaced comment Edgar E. Iglesias
                   ` (10 subsequent siblings)
  11 siblings, 2 replies; 43+ messages in thread
From: Edgar E. Iglesias @ 2020-04-27 18:16 UTC (permalink / raw)
  To: qemu-devel
  Cc: figlesia, peter.maydell, sstabellini, edgar.iglesias,
	sai.pavan.boddu, frasse.iglesias, alistair, richard.henderson,
	frederic.konrad, qemu-arm, philmd, luc.michel
From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
Remove inclusion of arm_gicv3_common.h, this already gets
included via xlnx-versal.h.
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
---
 hw/arm/xlnx-versal.c | 1 -
 1 file changed, 1 deletion(-)
diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c
index 94460f2343..c73b2fe755 100644
--- a/hw/arm/xlnx-versal.c
+++ b/hw/arm/xlnx-versal.c
@@ -20,7 +20,6 @@
 #include "hw/arm/boot.h"
 #include "kvm_arm.h"
 #include "hw/misc/unimp.h"
-#include "hw/intc/arm_gicv3_common.h"
 #include "hw/arm/xlnx-versal.h"
 #include "hw/char/pl011.h"
 
-- 
2.20.1
^ permalink raw reply related	[flat|nested] 43+ messages in thread
- * Re: [PATCH v1 01/11] hw/arm: versal: Remove inclusion of arm_gicv3_common.h
  2020-04-27 18:16 ` [PATCH v1 01/11] hw/arm: versal: Remove inclusion of arm_gicv3_common.h Edgar E. Iglesias
@ 2020-04-27 20:08   ` Alistair Francis
  2020-04-29  7:23   ` Luc Michel
  1 sibling, 0 replies; 43+ messages in thread
From: Alistair Francis @ 2020-04-27 20:08 UTC (permalink / raw)
  To: Edgar E. Iglesias
  Cc: figlesia, Peter Maydell, Edgar Iglesias, Sai Pavan Boddu,
	Francisco Iglesias, Alistair Francis, Richard Henderson,
	qemu-devel@nongnu.org Developers, KONRAD Frederic,
	Stefano Stabellini, qemu-arm, Philippe Mathieu-Daudé,
	Luc Michel
On Mon, Apr 27, 2020 at 11:17 AM Edgar E. Iglesias
<edgar.iglesias@gmail.com> wrote:
>
> From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
>
> Remove inclusion of arm_gicv3_common.h, this already gets
> included via xlnx-versal.h.
>
> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Alistair
> ---
>  hw/arm/xlnx-versal.c | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c
> index 94460f2343..c73b2fe755 100644
> --- a/hw/arm/xlnx-versal.c
> +++ b/hw/arm/xlnx-versal.c
> @@ -20,7 +20,6 @@
>  #include "hw/arm/boot.h"
>  #include "kvm_arm.h"
>  #include "hw/misc/unimp.h"
> -#include "hw/intc/arm_gicv3_common.h"
>  #include "hw/arm/xlnx-versal.h"
>  #include "hw/char/pl011.h"
>
> --
> 2.20.1
>
>
^ permalink raw reply	[flat|nested] 43+ messages in thread 
- * Re: [PATCH v1 01/11] hw/arm: versal: Remove inclusion of arm_gicv3_common.h
  2020-04-27 18:16 ` [PATCH v1 01/11] hw/arm: versal: Remove inclusion of arm_gicv3_common.h Edgar E. Iglesias
  2020-04-27 20:08   ` Alistair Francis
@ 2020-04-29  7:23   ` Luc Michel
  1 sibling, 0 replies; 43+ messages in thread
From: Luc Michel @ 2020-04-29  7:23 UTC (permalink / raw)
  To: Edgar E. Iglesias, qemu-devel
  Cc: figlesia, peter.maydell, sstabellini, edgar.iglesias,
	sai.pavan.boddu, frasse.iglesias, alistair, richard.henderson,
	frederic.konrad, qemu-arm, philmd
On 4/27/20 8:16 PM, Edgar E. Iglesias wrote:
> From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
> 
> Remove inclusion of arm_gicv3_common.h, this already gets
> included via xlnx-versal.h.
> 
> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
> ---
>  hw/arm/xlnx-versal.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c
> index 94460f2343..c73b2fe755 100644
> --- a/hw/arm/xlnx-versal.c
> +++ b/hw/arm/xlnx-versal.c
> @@ -20,7 +20,6 @@
>  #include "hw/arm/boot.h"
>  #include "kvm_arm.h"
>  #include "hw/misc/unimp.h"
> -#include "hw/intc/arm_gicv3_common.h"
>  #include "hw/arm/xlnx-versal.h"
>  #include "hw/char/pl011.h"
>  
> 
^ permalink raw reply	[flat|nested] 43+ messages in thread 
 
- * [PATCH v1 02/11] hw/arm: versal: Move misplaced comment
  2020-04-27 18:16 [PATCH v1 00/11] hw/arm: versal: Add SD and the RTC Edgar E. Iglesias
  2020-04-27 18:16 ` [PATCH v1 01/11] hw/arm: versal: Remove inclusion of arm_gicv3_common.h Edgar E. Iglesias
@ 2020-04-27 18:16 ` Edgar E. Iglesias
  2020-04-27 20:08   ` Alistair Francis
                     ` (2 more replies)
  2020-04-27 18:16 ` [PATCH v1 03/11] hw/arm: versal-virt: Fix typo xlnx-ve -> xlnx-versal Edgar E. Iglesias
                   ` (9 subsequent siblings)
  11 siblings, 3 replies; 43+ messages in thread
From: Edgar E. Iglesias @ 2020-04-27 18:16 UTC (permalink / raw)
  To: qemu-devel
  Cc: figlesia, peter.maydell, sstabellini, edgar.iglesias,
	sai.pavan.boddu, frasse.iglesias, alistair, richard.henderson,
	frederic.konrad, qemu-arm, philmd, luc.michel
From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
Move misplaced comment.
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
---
 hw/arm/xlnx-versal.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c
index c73b2fe755..cc696e44c0 100644
--- a/hw/arm/xlnx-versal.c
+++ b/hw/arm/xlnx-versal.c
@@ -36,7 +36,6 @@ static void versal_create_apu_cpus(Versal *s)
 
         obj = object_new(XLNX_VERSAL_ACPU_TYPE);
         if (!obj) {
-            /* Secondary CPUs start in PSCI powered-down state */
             error_report("Unable to create apu.cpu[%d] of type %s",
                          i, XLNX_VERSAL_ACPU_TYPE);
             exit(EXIT_FAILURE);
@@ -49,6 +48,7 @@ static void versal_create_apu_cpus(Versal *s)
         object_property_set_int(obj, s->cfg.psci_conduit,
                                 "psci-conduit", &error_abort);
         if (i) {
+            /* Secondary CPUs start in PSCI powered-down state */
             object_property_set_bool(obj, true,
                                      "start-powered-off", &error_abort);
         }
-- 
2.20.1
^ permalink raw reply related	[flat|nested] 43+ messages in thread
- * Re: [PATCH v1 02/11] hw/arm: versal: Move misplaced comment
  2020-04-27 18:16 ` [PATCH v1 02/11] hw/arm: versal: Move misplaced comment Edgar E. Iglesias
@ 2020-04-27 20:08   ` Alistair Francis
  2020-04-28  7:46   ` Philippe Mathieu-Daudé
  2020-04-29  7:23   ` Luc Michel
  2 siblings, 0 replies; 43+ messages in thread
From: Alistair Francis @ 2020-04-27 20:08 UTC (permalink / raw)
  To: Edgar E. Iglesias
  Cc: figlesia, Peter Maydell, Edgar Iglesias, Sai Pavan Boddu,
	Francisco Iglesias, Alistair Francis, Richard Henderson,
	qemu-devel@nongnu.org Developers, KONRAD Frederic,
	Stefano Stabellini, qemu-arm, Philippe Mathieu-Daudé,
	Luc Michel
On Mon, Apr 27, 2020 at 11:25 AM Edgar E. Iglesias
<edgar.iglesias@gmail.com> wrote:
>
> From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
>
> Move misplaced comment.
>
> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Alistair
> ---
>  hw/arm/xlnx-versal.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c
> index c73b2fe755..cc696e44c0 100644
> --- a/hw/arm/xlnx-versal.c
> +++ b/hw/arm/xlnx-versal.c
> @@ -36,7 +36,6 @@ static void versal_create_apu_cpus(Versal *s)
>
>          obj = object_new(XLNX_VERSAL_ACPU_TYPE);
>          if (!obj) {
> -            /* Secondary CPUs start in PSCI powered-down state */
>              error_report("Unable to create apu.cpu[%d] of type %s",
>                           i, XLNX_VERSAL_ACPU_TYPE);
>              exit(EXIT_FAILURE);
> @@ -49,6 +48,7 @@ static void versal_create_apu_cpus(Versal *s)
>          object_property_set_int(obj, s->cfg.psci_conduit,
>                                  "psci-conduit", &error_abort);
>          if (i) {
> +            /* Secondary CPUs start in PSCI powered-down state */
>              object_property_set_bool(obj, true,
>                                       "start-powered-off", &error_abort);
>          }
> --
> 2.20.1
>
>
^ permalink raw reply	[flat|nested] 43+ messages in thread
- * Re: [PATCH v1 02/11] hw/arm: versal: Move misplaced comment
  2020-04-27 18:16 ` [PATCH v1 02/11] hw/arm: versal: Move misplaced comment Edgar E. Iglesias
  2020-04-27 20:08   ` Alistair Francis
@ 2020-04-28  7:46   ` Philippe Mathieu-Daudé
  2020-04-29  7:23   ` Luc Michel
  2 siblings, 0 replies; 43+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-04-28  7:46 UTC (permalink / raw)
  To: Edgar E. Iglesias, qemu-devel
  Cc: figlesia, peter.maydell, sstabellini, edgar.iglesias,
	sai.pavan.boddu, frasse.iglesias, alistair, richard.henderson,
	frederic.konrad, qemu-arm, philmd, luc.michel
On 4/27/20 8:16 PM, Edgar E. Iglesias wrote:
> From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
> 
> Move misplaced comment.
> 
> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
> ---
>  hw/arm/xlnx-versal.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c
> index c73b2fe755..cc696e44c0 100644
> --- a/hw/arm/xlnx-versal.c
> +++ b/hw/arm/xlnx-versal.c
> @@ -36,7 +36,6 @@ static void versal_create_apu_cpus(Versal *s)
>  
>          obj = object_new(XLNX_VERSAL_ACPU_TYPE);
>          if (!obj) {
> -            /* Secondary CPUs start in PSCI powered-down state */
>              error_report("Unable to create apu.cpu[%d] of type %s",
>                           i, XLNX_VERSAL_ACPU_TYPE);
>              exit(EXIT_FAILURE);
> @@ -49,6 +48,7 @@ static void versal_create_apu_cpus(Versal *s)
>          object_property_set_int(obj, s->cfg.psci_conduit,
>                                  "psci-conduit", &error_abort);
>          if (i) {
> +            /* Secondary CPUs start in PSCI powered-down state */
>              object_property_set_bool(obj, true,
>                                       "start-powered-off", &error_abort);
>          }
> 
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
^ permalink raw reply	[flat|nested] 43+ messages in thread
- * Re: [PATCH v1 02/11] hw/arm: versal: Move misplaced comment
  2020-04-27 18:16 ` [PATCH v1 02/11] hw/arm: versal: Move misplaced comment Edgar E. Iglesias
  2020-04-27 20:08   ` Alistair Francis
  2020-04-28  7:46   ` Philippe Mathieu-Daudé
@ 2020-04-29  7:23   ` Luc Michel
  2 siblings, 0 replies; 43+ messages in thread
From: Luc Michel @ 2020-04-29  7:23 UTC (permalink / raw)
  To: Edgar E. Iglesias, qemu-devel
  Cc: figlesia, peter.maydell, sstabellini, edgar.iglesias,
	sai.pavan.boddu, frasse.iglesias, alistair, richard.henderson,
	frederic.konrad, qemu-arm, philmd
On 4/27/20 8:16 PM, Edgar E. Iglesias wrote:
> From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
> 
> Move misplaced comment.
> 
> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
> ---
>  hw/arm/xlnx-versal.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c
> index c73b2fe755..cc696e44c0 100644
> --- a/hw/arm/xlnx-versal.c
> +++ b/hw/arm/xlnx-versal.c
> @@ -36,7 +36,6 @@ static void versal_create_apu_cpus(Versal *s)
>  
>          obj = object_new(XLNX_VERSAL_ACPU_TYPE);
>          if (!obj) {
> -            /* Secondary CPUs start in PSCI powered-down state */
>              error_report("Unable to create apu.cpu[%d] of type %s",
>                           i, XLNX_VERSAL_ACPU_TYPE);
>              exit(EXIT_FAILURE);
> @@ -49,6 +48,7 @@ static void versal_create_apu_cpus(Versal *s)
>          object_property_set_int(obj, s->cfg.psci_conduit,
>                                  "psci-conduit", &error_abort);
>          if (i) {
> +            /* Secondary CPUs start in PSCI powered-down state */
>              object_property_set_bool(obj, true,
>                                       "start-powered-off", &error_abort);
>          }
> 
^ permalink raw reply	[flat|nested] 43+ messages in thread
 
- * [PATCH v1 03/11] hw/arm: versal-virt: Fix typo xlnx-ve -> xlnx-versal
  2020-04-27 18:16 [PATCH v1 00/11] hw/arm: versal: Add SD and the RTC Edgar E. Iglesias
  2020-04-27 18:16 ` [PATCH v1 01/11] hw/arm: versal: Remove inclusion of arm_gicv3_common.h Edgar E. Iglesias
  2020-04-27 18:16 ` [PATCH v1 02/11] hw/arm: versal: Move misplaced comment Edgar E. Iglesias
@ 2020-04-27 18:16 ` Edgar E. Iglesias
  2020-04-27 22:18   ` Alistair Francis
                     ` (2 more replies)
  2020-04-27 18:16 ` [PATCH v1 04/11] hw/arm: versal: Embedd the UARTs into the SoC type Edgar E. Iglesias
                   ` (8 subsequent siblings)
  11 siblings, 3 replies; 43+ messages in thread
From: Edgar E. Iglesias @ 2020-04-27 18:16 UTC (permalink / raw)
  To: qemu-devel
  Cc: figlesia, peter.maydell, sstabellini, edgar.iglesias,
	sai.pavan.boddu, frasse.iglesias, alistair, richard.henderson,
	frederic.konrad, qemu-arm, philmd, luc.michel
From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
Fix typo xlnx-ve -> xlnx-versal.
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
---
 hw/arm/xlnx-versal-virt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c
index 878a275140..8a608074d1 100644
--- a/hw/arm/xlnx-versal-virt.c
+++ b/hw/arm/xlnx-versal-virt.c
@@ -440,7 +440,7 @@ static void versal_virt_init(MachineState *machine)
         psci_conduit = QEMU_PSCI_CONDUIT_SMC;
     }
 
-    sysbus_init_child_obj(OBJECT(machine), "xlnx-ve", &s->soc,
+    sysbus_init_child_obj(OBJECT(machine), "xlnx-versal", &s->soc,
                           sizeof(s->soc), TYPE_XLNX_VERSAL);
     object_property_set_link(OBJECT(&s->soc), OBJECT(machine->ram),
                              "ddr", &error_abort);
-- 
2.20.1
^ permalink raw reply related	[flat|nested] 43+ messages in thread
- * Re: [PATCH v1 03/11] hw/arm: versal-virt: Fix typo xlnx-ve -> xlnx-versal
  2020-04-27 18:16 ` [PATCH v1 03/11] hw/arm: versal-virt: Fix typo xlnx-ve -> xlnx-versal Edgar E. Iglesias
@ 2020-04-27 22:18   ` Alistair Francis
  2020-04-28  7:46   ` Philippe Mathieu-Daudé
  2020-04-29  7:24   ` Luc Michel
  2 siblings, 0 replies; 43+ messages in thread
From: Alistair Francis @ 2020-04-27 22:18 UTC (permalink / raw)
  To: Edgar E. Iglesias
  Cc: figlesia, Peter Maydell, Edgar Iglesias, Sai Pavan Boddu,
	Francisco Iglesias, Alistair Francis, Richard Henderson,
	qemu-devel@nongnu.org Developers, KONRAD Frederic,
	Stefano Stabellini, qemu-arm, Philippe Mathieu-Daudé,
	Luc Michel
On Mon, Apr 27, 2020 at 11:20 AM Edgar E. Iglesias
<edgar.iglesias@gmail.com> wrote:
>
> From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
>
> Fix typo xlnx-ve -> xlnx-versal.
>
> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Alistair
> ---
>  hw/arm/xlnx-versal-virt.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c
> index 878a275140..8a608074d1 100644
> --- a/hw/arm/xlnx-versal-virt.c
> +++ b/hw/arm/xlnx-versal-virt.c
> @@ -440,7 +440,7 @@ static void versal_virt_init(MachineState *machine)
>          psci_conduit = QEMU_PSCI_CONDUIT_SMC;
>      }
>
> -    sysbus_init_child_obj(OBJECT(machine), "xlnx-ve", &s->soc,
> +    sysbus_init_child_obj(OBJECT(machine), "xlnx-versal", &s->soc,
>                            sizeof(s->soc), TYPE_XLNX_VERSAL);
>      object_property_set_link(OBJECT(&s->soc), OBJECT(machine->ram),
>                               "ddr", &error_abort);
> --
> 2.20.1
>
>
^ permalink raw reply	[flat|nested] 43+ messages in thread 
- * Re: [PATCH v1 03/11] hw/arm: versal-virt: Fix typo xlnx-ve -> xlnx-versal
  2020-04-27 18:16 ` [PATCH v1 03/11] hw/arm: versal-virt: Fix typo xlnx-ve -> xlnx-versal Edgar E. Iglesias
  2020-04-27 22:18   ` Alistair Francis
@ 2020-04-28  7:46   ` Philippe Mathieu-Daudé
  2020-04-29  7:24   ` Luc Michel
  2 siblings, 0 replies; 43+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-04-28  7:46 UTC (permalink / raw)
  To: Edgar E. Iglesias, qemu-devel
  Cc: figlesia, peter.maydell, sstabellini, edgar.iglesias,
	sai.pavan.boddu, frasse.iglesias, alistair, richard.henderson,
	frederic.konrad, qemu-arm, philmd, luc.michel
On 4/27/20 8:16 PM, Edgar E. Iglesias wrote:
> From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
> 
> Fix typo xlnx-ve -> xlnx-versal.
> 
> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
> ---
>  hw/arm/xlnx-versal-virt.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c
> index 878a275140..8a608074d1 100644
> --- a/hw/arm/xlnx-versal-virt.c
> +++ b/hw/arm/xlnx-versal-virt.c
> @@ -440,7 +440,7 @@ static void versal_virt_init(MachineState *machine)
>          psci_conduit = QEMU_PSCI_CONDUIT_SMC;
>      }
>  
> -    sysbus_init_child_obj(OBJECT(machine), "xlnx-ve", &s->soc,
> +    sysbus_init_child_obj(OBJECT(machine), "xlnx-versal", &s->soc,
>                            sizeof(s->soc), TYPE_XLNX_VERSAL);
>      object_property_set_link(OBJECT(&s->soc), OBJECT(machine->ram),
>                               "ddr", &error_abort);
> 
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
^ permalink raw reply	[flat|nested] 43+ messages in thread 
- * Re: [PATCH v1 03/11] hw/arm: versal-virt: Fix typo xlnx-ve -> xlnx-versal
  2020-04-27 18:16 ` [PATCH v1 03/11] hw/arm: versal-virt: Fix typo xlnx-ve -> xlnx-versal Edgar E. Iglesias
  2020-04-27 22:18   ` Alistair Francis
  2020-04-28  7:46   ` Philippe Mathieu-Daudé
@ 2020-04-29  7:24   ` Luc Michel
  2 siblings, 0 replies; 43+ messages in thread
From: Luc Michel @ 2020-04-29  7:24 UTC (permalink / raw)
  To: Edgar E. Iglesias, qemu-devel
  Cc: figlesia, peter.maydell, sstabellini, edgar.iglesias,
	sai.pavan.boddu, frasse.iglesias, alistair, richard.henderson,
	frederic.konrad, qemu-arm, philmd
On 4/27/20 8:16 PM, Edgar E. Iglesias wrote:
> From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
> 
> Fix typo xlnx-ve -> xlnx-versal.
> 
> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
> ---
>  hw/arm/xlnx-versal-virt.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c
> index 878a275140..8a608074d1 100644
> --- a/hw/arm/xlnx-versal-virt.c
> +++ b/hw/arm/xlnx-versal-virt.c
> @@ -440,7 +440,7 @@ static void versal_virt_init(MachineState *machine)
>          psci_conduit = QEMU_PSCI_CONDUIT_SMC;
>      }
>  
> -    sysbus_init_child_obj(OBJECT(machine), "xlnx-ve", &s->soc,
> +    sysbus_init_child_obj(OBJECT(machine), "xlnx-versal", &s->soc,
>                            sizeof(s->soc), TYPE_XLNX_VERSAL);
>      object_property_set_link(OBJECT(&s->soc), OBJECT(machine->ram),
>                               "ddr", &error_abort);
> 
^ permalink raw reply	[flat|nested] 43+ messages in thread 
 
- * [PATCH v1 04/11] hw/arm: versal: Embedd the UARTs into the SoC type
  2020-04-27 18:16 [PATCH v1 00/11] hw/arm: versal: Add SD and the RTC Edgar E. Iglesias
                   ` (2 preceding siblings ...)
  2020-04-27 18:16 ` [PATCH v1 03/11] hw/arm: versal-virt: Fix typo xlnx-ve -> xlnx-versal Edgar E. Iglesias
@ 2020-04-27 18:16 ` Edgar E. Iglesias
  2020-04-27 22:16   ` Alistair Francis
                     ` (2 more replies)
  2020-04-27 18:16 ` [PATCH v1 05/11] hw/arm: versal: Embedd the GEMs " Edgar E. Iglesias
                   ` (7 subsequent siblings)
  11 siblings, 3 replies; 43+ messages in thread
From: Edgar E. Iglesias @ 2020-04-27 18:16 UTC (permalink / raw)
  To: qemu-devel
  Cc: figlesia, peter.maydell, sstabellini, edgar.iglesias,
	sai.pavan.boddu, frasse.iglesias, alistair, richard.henderson,
	frederic.konrad, qemu-arm, philmd, luc.michel
From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
Embedd the UARTs into the SoC type.
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
---
 hw/arm/xlnx-versal.c         | 12 ++++++------
 include/hw/arm/xlnx-versal.h |  3 ++-
 2 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c
index cc696e44c0..dbde03b7e6 100644
--- a/hw/arm/xlnx-versal.c
+++ b/hw/arm/xlnx-versal.c
@@ -21,7 +21,6 @@
 #include "kvm_arm.h"
 #include "hw/misc/unimp.h"
 #include "hw/arm/xlnx-versal.h"
-#include "hw/char/pl011.h"
 
 #define XLNX_VERSAL_ACPU_TYPE ARM_CPU_TYPE_NAME("cortex-a72")
 #define GEM_REVISION        0x40070106
@@ -144,16 +143,17 @@ static void versal_create_uarts(Versal *s, qemu_irq *pic)
         DeviceState *dev;
         MemoryRegion *mr;
 
-        dev = qdev_create(NULL, TYPE_PL011);
-        s->lpd.iou.uart[i] = SYS_BUS_DEVICE(dev);
+        sysbus_init_child_obj(OBJECT(s), name,
+                              &s->lpd.iou.uart[i], sizeof(s->lpd.iou.uart[i]),
+                              TYPE_PL011);
+        dev = DEVICE(&s->lpd.iou.uart[i]);
         qdev_prop_set_chr(dev, "chardev", serial_hd(i));
-        object_property_add_child(OBJECT(s), name, OBJECT(dev), &error_fatal);
         qdev_init_nofail(dev);
 
-        mr = sysbus_mmio_get_region(s->lpd.iou.uart[i], 0);
+        mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 0);
         memory_region_add_subregion(&s->mr_ps, addrs[i], mr);
 
-        sysbus_connect_irq(s->lpd.iou.uart[i], 0, pic[irqs[i]]);
+        sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[irqs[i]]);
         g_free(name);
     }
 }
diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h
index 6c0a692b2f..a3dfd064b3 100644
--- a/include/hw/arm/xlnx-versal.h
+++ b/include/hw/arm/xlnx-versal.h
@@ -15,6 +15,7 @@
 #include "hw/sysbus.h"
 #include "hw/arm/boot.h"
 #include "hw/intc/arm_gicv3.h"
+#include "hw/char/pl011.h"
 
 #define TYPE_XLNX_VERSAL "xlnx-versal"
 #define XLNX_VERSAL(obj) OBJECT_CHECK(Versal, (obj), TYPE_XLNX_VERSAL)
@@ -49,7 +50,7 @@ typedef struct Versal {
         MemoryRegion mr_ocm;
 
         struct {
-            SysBusDevice *uart[XLNX_VERSAL_NR_UARTS];
+            PL011State uart[XLNX_VERSAL_NR_UARTS];
             SysBusDevice *gem[XLNX_VERSAL_NR_GEMS];
             SysBusDevice *adma[XLNX_VERSAL_NR_ADMAS];
         } iou;
-- 
2.20.1
^ permalink raw reply related	[flat|nested] 43+ messages in thread
- * Re: [PATCH v1 04/11] hw/arm: versal: Embedd the UARTs into the SoC type
  2020-04-27 18:16 ` [PATCH v1 04/11] hw/arm: versal: Embedd the UARTs into the SoC type Edgar E. Iglesias
@ 2020-04-27 22:16   ` Alistair Francis
  2020-04-28  7:47   ` Philippe Mathieu-Daudé
  2020-04-29  7:27   ` Luc Michel
  2 siblings, 0 replies; 43+ messages in thread
From: Alistair Francis @ 2020-04-27 22:16 UTC (permalink / raw)
  To: Edgar E. Iglesias
  Cc: figlesia, Peter Maydell, Edgar Iglesias, Sai Pavan Boddu,
	Francisco Iglesias, Alistair Francis, Richard Henderson,
	qemu-devel@nongnu.org Developers, KONRAD Frederic,
	Stefano Stabellini, qemu-arm, Philippe Mathieu-Daudé,
	Luc Michel
On Mon, Apr 27, 2020 at 11:17 AM Edgar E. Iglesias
<edgar.iglesias@gmail.com> wrote:
>
> From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
>
> Embedd the UARTs into the SoC type.
>
> Suggested-by: Peter Maydell <peter.maydell@linaro.org>
> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Alistair
> ---
>  hw/arm/xlnx-versal.c         | 12 ++++++------
>  include/hw/arm/xlnx-versal.h |  3 ++-
>  2 files changed, 8 insertions(+), 7 deletions(-)
>
> diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c
> index cc696e44c0..dbde03b7e6 100644
> --- a/hw/arm/xlnx-versal.c
> +++ b/hw/arm/xlnx-versal.c
> @@ -21,7 +21,6 @@
>  #include "kvm_arm.h"
>  #include "hw/misc/unimp.h"
>  #include "hw/arm/xlnx-versal.h"
> -#include "hw/char/pl011.h"
>
>  #define XLNX_VERSAL_ACPU_TYPE ARM_CPU_TYPE_NAME("cortex-a72")
>  #define GEM_REVISION        0x40070106
> @@ -144,16 +143,17 @@ static void versal_create_uarts(Versal *s, qemu_irq *pic)
>          DeviceState *dev;
>          MemoryRegion *mr;
>
> -        dev = qdev_create(NULL, TYPE_PL011);
> -        s->lpd.iou.uart[i] = SYS_BUS_DEVICE(dev);
> +        sysbus_init_child_obj(OBJECT(s), name,
> +                              &s->lpd.iou.uart[i], sizeof(s->lpd.iou.uart[i]),
> +                              TYPE_PL011);
> +        dev = DEVICE(&s->lpd.iou.uart[i]);
>          qdev_prop_set_chr(dev, "chardev", serial_hd(i));
> -        object_property_add_child(OBJECT(s), name, OBJECT(dev), &error_fatal);
>          qdev_init_nofail(dev);
>
> -        mr = sysbus_mmio_get_region(s->lpd.iou.uart[i], 0);
> +        mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 0);
>          memory_region_add_subregion(&s->mr_ps, addrs[i], mr);
>
> -        sysbus_connect_irq(s->lpd.iou.uart[i], 0, pic[irqs[i]]);
> +        sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[irqs[i]]);
>          g_free(name);
>      }
>  }
> diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h
> index 6c0a692b2f..a3dfd064b3 100644
> --- a/include/hw/arm/xlnx-versal.h
> +++ b/include/hw/arm/xlnx-versal.h
> @@ -15,6 +15,7 @@
>  #include "hw/sysbus.h"
>  #include "hw/arm/boot.h"
>  #include "hw/intc/arm_gicv3.h"
> +#include "hw/char/pl011.h"
>
>  #define TYPE_XLNX_VERSAL "xlnx-versal"
>  #define XLNX_VERSAL(obj) OBJECT_CHECK(Versal, (obj), TYPE_XLNX_VERSAL)
> @@ -49,7 +50,7 @@ typedef struct Versal {
>          MemoryRegion mr_ocm;
>
>          struct {
> -            SysBusDevice *uart[XLNX_VERSAL_NR_UARTS];
> +            PL011State uart[XLNX_VERSAL_NR_UARTS];
>              SysBusDevice *gem[XLNX_VERSAL_NR_GEMS];
>              SysBusDevice *adma[XLNX_VERSAL_NR_ADMAS];
>          } iou;
> --
> 2.20.1
>
>
^ permalink raw reply	[flat|nested] 43+ messages in thread
- * Re: [PATCH v1 04/11] hw/arm: versal: Embedd the UARTs into the SoC type
  2020-04-27 18:16 ` [PATCH v1 04/11] hw/arm: versal: Embedd the UARTs into the SoC type Edgar E. Iglesias
  2020-04-27 22:16   ` Alistair Francis
@ 2020-04-28  7:47   ` Philippe Mathieu-Daudé
  2020-04-29  7:27   ` Luc Michel
  2 siblings, 0 replies; 43+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-04-28  7:47 UTC (permalink / raw)
  To: Edgar E. Iglesias, qemu-devel
  Cc: figlesia, peter.maydell, sstabellini, edgar.iglesias,
	sai.pavan.boddu, frasse.iglesias, alistair, richard.henderson,
	frederic.konrad, qemu-arm, philmd, luc.michel
On 4/27/20 8:16 PM, Edgar E. Iglesias wrote:
> From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
> 
> Embedd the UARTs into the SoC type.
> 
> Suggested-by: Peter Maydell <peter.maydell@linaro.org>
> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
> ---
>  hw/arm/xlnx-versal.c         | 12 ++++++------
>  include/hw/arm/xlnx-versal.h |  3 ++-
>  2 files changed, 8 insertions(+), 7 deletions(-)
> 
> diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c
> index cc696e44c0..dbde03b7e6 100644
> --- a/hw/arm/xlnx-versal.c
> +++ b/hw/arm/xlnx-versal.c
> @@ -21,7 +21,6 @@
>  #include "kvm_arm.h"
>  #include "hw/misc/unimp.h"
>  #include "hw/arm/xlnx-versal.h"
> -#include "hw/char/pl011.h"
>  
>  #define XLNX_VERSAL_ACPU_TYPE ARM_CPU_TYPE_NAME("cortex-a72")
>  #define GEM_REVISION        0x40070106
> @@ -144,16 +143,17 @@ static void versal_create_uarts(Versal *s, qemu_irq *pic)
>          DeviceState *dev;
>          MemoryRegion *mr;
>  
> -        dev = qdev_create(NULL, TYPE_PL011);
> -        s->lpd.iou.uart[i] = SYS_BUS_DEVICE(dev);
> +        sysbus_init_child_obj(OBJECT(s), name,
> +                              &s->lpd.iou.uart[i], sizeof(s->lpd.iou.uart[i]),
> +                              TYPE_PL011);
> +        dev = DEVICE(&s->lpd.iou.uart[i]);
>          qdev_prop_set_chr(dev, "chardev", serial_hd(i));
> -        object_property_add_child(OBJECT(s), name, OBJECT(dev), &error_fatal);
>          qdev_init_nofail(dev);
>  
> -        mr = sysbus_mmio_get_region(s->lpd.iou.uart[i], 0);
> +        mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 0);
>          memory_region_add_subregion(&s->mr_ps, addrs[i], mr);
>  
> -        sysbus_connect_irq(s->lpd.iou.uart[i], 0, pic[irqs[i]]);
> +        sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[irqs[i]]);
Cleaner :)
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>          g_free(name);
>      }
>  }
> diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h
> index 6c0a692b2f..a3dfd064b3 100644
> --- a/include/hw/arm/xlnx-versal.h
> +++ b/include/hw/arm/xlnx-versal.h
> @@ -15,6 +15,7 @@
>  #include "hw/sysbus.h"
>  #include "hw/arm/boot.h"
>  #include "hw/intc/arm_gicv3.h"
> +#include "hw/char/pl011.h"
>  
>  #define TYPE_XLNX_VERSAL "xlnx-versal"
>  #define XLNX_VERSAL(obj) OBJECT_CHECK(Versal, (obj), TYPE_XLNX_VERSAL)
> @@ -49,7 +50,7 @@ typedef struct Versal {
>          MemoryRegion mr_ocm;
>  
>          struct {
> -            SysBusDevice *uart[XLNX_VERSAL_NR_UARTS];
> +            PL011State uart[XLNX_VERSAL_NR_UARTS];
>              SysBusDevice *gem[XLNX_VERSAL_NR_GEMS];
>              SysBusDevice *adma[XLNX_VERSAL_NR_ADMAS];
>          } iou;
> 
^ permalink raw reply	[flat|nested] 43+ messages in thread
- * Re: [PATCH v1 04/11] hw/arm: versal: Embedd the UARTs into the SoC type
  2020-04-27 18:16 ` [PATCH v1 04/11] hw/arm: versal: Embedd the UARTs into the SoC type Edgar E. Iglesias
  2020-04-27 22:16   ` Alistair Francis
  2020-04-28  7:47   ` Philippe Mathieu-Daudé
@ 2020-04-29  7:27   ` Luc Michel
  2 siblings, 0 replies; 43+ messages in thread
From: Luc Michel @ 2020-04-29  7:27 UTC (permalink / raw)
  To: Edgar E. Iglesias, qemu-devel
  Cc: figlesia, peter.maydell, sstabellini, edgar.iglesias,
	sai.pavan.boddu, frasse.iglesias, alistair, richard.henderson,
	frederic.konrad, qemu-arm, philmd
On 4/27/20 8:16 PM, Edgar E. Iglesias wrote:
> From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
> 
> Embedd the UARTs into the SoC type.
> 
> Suggested-by: Peter Maydell <peter.maydell@linaro.org>
> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Hi Edgar,
Just a small thing, I find it easier to review when you have
[diff]
    orderFile = scripts/git.orderfile
in your QEMU's .git/config. This way header files come first in the patches.
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
> ---
>  hw/arm/xlnx-versal.c         | 12 ++++++------
>  include/hw/arm/xlnx-versal.h |  3 ++-
>  2 files changed, 8 insertions(+), 7 deletions(-)
> 
> diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c
> index cc696e44c0..dbde03b7e6 100644
> --- a/hw/arm/xlnx-versal.c
> +++ b/hw/arm/xlnx-versal.c
> @@ -21,7 +21,6 @@
>  #include "kvm_arm.h"
>  #include "hw/misc/unimp.h"
>  #include "hw/arm/xlnx-versal.h"
> -#include "hw/char/pl011.h"
>  
>  #define XLNX_VERSAL_ACPU_TYPE ARM_CPU_TYPE_NAME("cortex-a72")
>  #define GEM_REVISION        0x40070106
> @@ -144,16 +143,17 @@ static void versal_create_uarts(Versal *s, qemu_irq *pic)
>          DeviceState *dev;
>          MemoryRegion *mr;
>  
> -        dev = qdev_create(NULL, TYPE_PL011);
> -        s->lpd.iou.uart[i] = SYS_BUS_DEVICE(dev);
> +        sysbus_init_child_obj(OBJECT(s), name,
> +                              &s->lpd.iou.uart[i], sizeof(s->lpd.iou.uart[i]),
> +                              TYPE_PL011);
> +        dev = DEVICE(&s->lpd.iou.uart[i]);
>          qdev_prop_set_chr(dev, "chardev", serial_hd(i));
> -        object_property_add_child(OBJECT(s), name, OBJECT(dev), &error_fatal);
>          qdev_init_nofail(dev);
>  
> -        mr = sysbus_mmio_get_region(s->lpd.iou.uart[i], 0);
> +        mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 0);
>          memory_region_add_subregion(&s->mr_ps, addrs[i], mr);
>  
> -        sysbus_connect_irq(s->lpd.iou.uart[i], 0, pic[irqs[i]]);
> +        sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[irqs[i]]);
>          g_free(name);
>      }
>  }
> diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h
> index 6c0a692b2f..a3dfd064b3 100644
> --- a/include/hw/arm/xlnx-versal.h
> +++ b/include/hw/arm/xlnx-versal.h
> @@ -15,6 +15,7 @@
>  #include "hw/sysbus.h"
>  #include "hw/arm/boot.h"
>  #include "hw/intc/arm_gicv3.h"
> +#include "hw/char/pl011.h"
>  
>  #define TYPE_XLNX_VERSAL "xlnx-versal"
>  #define XLNX_VERSAL(obj) OBJECT_CHECK(Versal, (obj), TYPE_XLNX_VERSAL)
> @@ -49,7 +50,7 @@ typedef struct Versal {
>          MemoryRegion mr_ocm;
>  
>          struct {
> -            SysBusDevice *uart[XLNX_VERSAL_NR_UARTS];
> +            PL011State uart[XLNX_VERSAL_NR_UARTS];
>              SysBusDevice *gem[XLNX_VERSAL_NR_GEMS];
>              SysBusDevice *adma[XLNX_VERSAL_NR_ADMAS];
>          } iou;
> 
^ permalink raw reply	[flat|nested] 43+ messages in thread
 
- * [PATCH v1 05/11] hw/arm: versal: Embedd the GEMs into the SoC type
  2020-04-27 18:16 [PATCH v1 00/11] hw/arm: versal: Add SD and the RTC Edgar E. Iglesias
                   ` (3 preceding siblings ...)
  2020-04-27 18:16 ` [PATCH v1 04/11] hw/arm: versal: Embedd the UARTs into the SoC type Edgar E. Iglesias
@ 2020-04-27 18:16 ` Edgar E. Iglesias
  2020-04-27 22:17   ` Alistair Francis
                     ` (2 more replies)
  2020-04-27 18:16 ` [PATCH v1 06/11] hw/arm: versal: Embedd the ADMAs " Edgar E. Iglesias
                   ` (6 subsequent siblings)
  11 siblings, 3 replies; 43+ messages in thread
From: Edgar E. Iglesias @ 2020-04-27 18:16 UTC (permalink / raw)
  To: qemu-devel
  Cc: figlesia, peter.maydell, sstabellini, edgar.iglesias,
	sai.pavan.boddu, frasse.iglesias, alistair, richard.henderson,
	frederic.konrad, qemu-arm, philmd, luc.michel
From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
Embedd the GEMs into the SoC type.
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
---
 hw/arm/xlnx-versal.c         | 15 ++++++++-------
 include/hw/arm/xlnx-versal.h |  3 ++-
 2 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c
index dbde03b7e6..e424aa789e 100644
--- a/hw/arm/xlnx-versal.c
+++ b/hw/arm/xlnx-versal.c
@@ -170,25 +170,26 @@ static void versal_create_gems(Versal *s, qemu_irq *pic)
         DeviceState *dev;
         MemoryRegion *mr;
 
-        dev = qdev_create(NULL, "cadence_gem");
-        s->lpd.iou.gem[i] = SYS_BUS_DEVICE(dev);
-        object_property_add_child(OBJECT(s), name, OBJECT(dev), &error_fatal);
+        sysbus_init_child_obj(OBJECT(s), name,
+                              &s->lpd.iou.gem[i], sizeof(s->lpd.iou.gem[i]),
+                              TYPE_CADENCE_GEM);
+        dev = DEVICE(&s->lpd.iou.gem[i]);
         if (nd->used) {
             qemu_check_nic_model(nd, "cadence_gem");
             qdev_set_nic_properties(dev, nd);
         }
-        object_property_set_int(OBJECT(s->lpd.iou.gem[i]),
+        object_property_set_int(OBJECT(dev),
                                 2, "num-priority-queues",
                                 &error_abort);
-        object_property_set_link(OBJECT(s->lpd.iou.gem[i]),
+        object_property_set_link(OBJECT(dev),
                                  OBJECT(&s->mr_ps), "dma",
                                  &error_abort);
         qdev_init_nofail(dev);
 
-        mr = sysbus_mmio_get_region(s->lpd.iou.gem[i], 0);
+        mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 0);
         memory_region_add_subregion(&s->mr_ps, addrs[i], mr);
 
-        sysbus_connect_irq(s->lpd.iou.gem[i], 0, pic[irqs[i]]);
+        sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[irqs[i]]);
         g_free(name);
     }
 }
diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h
index a3dfd064b3..01da736a5b 100644
--- a/include/hw/arm/xlnx-versal.h
+++ b/include/hw/arm/xlnx-versal.h
@@ -16,6 +16,7 @@
 #include "hw/arm/boot.h"
 #include "hw/intc/arm_gicv3.h"
 #include "hw/char/pl011.h"
+#include "hw/net/cadence_gem.h"
 
 #define TYPE_XLNX_VERSAL "xlnx-versal"
 #define XLNX_VERSAL(obj) OBJECT_CHECK(Versal, (obj), TYPE_XLNX_VERSAL)
@@ -51,7 +52,7 @@ typedef struct Versal {
 
         struct {
             PL011State uart[XLNX_VERSAL_NR_UARTS];
-            SysBusDevice *gem[XLNX_VERSAL_NR_GEMS];
+            CadenceGEMState gem[XLNX_VERSAL_NR_GEMS];
             SysBusDevice *adma[XLNX_VERSAL_NR_ADMAS];
         } iou;
     } lpd;
-- 
2.20.1
^ permalink raw reply related	[flat|nested] 43+ messages in thread
- * Re: [PATCH v1 05/11] hw/arm: versal: Embedd the GEMs into the SoC type
  2020-04-27 18:16 ` [PATCH v1 05/11] hw/arm: versal: Embedd the GEMs " Edgar E. Iglesias
@ 2020-04-27 22:17   ` Alistair Francis
  2020-04-28  7:48   ` Philippe Mathieu-Daudé
  2020-04-29  7:27   ` Luc Michel
  2 siblings, 0 replies; 43+ messages in thread
From: Alistair Francis @ 2020-04-27 22:17 UTC (permalink / raw)
  To: Edgar E. Iglesias
  Cc: figlesia, Peter Maydell, Edgar Iglesias, Sai Pavan Boddu,
	Francisco Iglesias, Alistair Francis, Richard Henderson,
	qemu-devel@nongnu.org Developers, KONRAD Frederic,
	Stefano Stabellini, qemu-arm, Philippe Mathieu-Daudé,
	Luc Michel
On Mon, Apr 27, 2020 at 11:20 AM Edgar E. Iglesias
<edgar.iglesias@gmail.com> wrote:
>
> From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
>
> Embedd the GEMs into the SoC type.
>
> Suggested-by: Peter Maydell <peter.maydell@linaro.org>
> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Alistair
> ---
>  hw/arm/xlnx-versal.c         | 15 ++++++++-------
>  include/hw/arm/xlnx-versal.h |  3 ++-
>  2 files changed, 10 insertions(+), 8 deletions(-)
>
> diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c
> index dbde03b7e6..e424aa789e 100644
> --- a/hw/arm/xlnx-versal.c
> +++ b/hw/arm/xlnx-versal.c
> @@ -170,25 +170,26 @@ static void versal_create_gems(Versal *s, qemu_irq *pic)
>          DeviceState *dev;
>          MemoryRegion *mr;
>
> -        dev = qdev_create(NULL, "cadence_gem");
> -        s->lpd.iou.gem[i] = SYS_BUS_DEVICE(dev);
> -        object_property_add_child(OBJECT(s), name, OBJECT(dev), &error_fatal);
> +        sysbus_init_child_obj(OBJECT(s), name,
> +                              &s->lpd.iou.gem[i], sizeof(s->lpd.iou.gem[i]),
> +                              TYPE_CADENCE_GEM);
> +        dev = DEVICE(&s->lpd.iou.gem[i]);
>          if (nd->used) {
>              qemu_check_nic_model(nd, "cadence_gem");
>              qdev_set_nic_properties(dev, nd);
>          }
> -        object_property_set_int(OBJECT(s->lpd.iou.gem[i]),
> +        object_property_set_int(OBJECT(dev),
>                                  2, "num-priority-queues",
>                                  &error_abort);
> -        object_property_set_link(OBJECT(s->lpd.iou.gem[i]),
> +        object_property_set_link(OBJECT(dev),
>                                   OBJECT(&s->mr_ps), "dma",
>                                   &error_abort);
>          qdev_init_nofail(dev);
>
> -        mr = sysbus_mmio_get_region(s->lpd.iou.gem[i], 0);
> +        mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 0);
>          memory_region_add_subregion(&s->mr_ps, addrs[i], mr);
>
> -        sysbus_connect_irq(s->lpd.iou.gem[i], 0, pic[irqs[i]]);
> +        sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[irqs[i]]);
>          g_free(name);
>      }
>  }
> diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h
> index a3dfd064b3..01da736a5b 100644
> --- a/include/hw/arm/xlnx-versal.h
> +++ b/include/hw/arm/xlnx-versal.h
> @@ -16,6 +16,7 @@
>  #include "hw/arm/boot.h"
>  #include "hw/intc/arm_gicv3.h"
>  #include "hw/char/pl011.h"
> +#include "hw/net/cadence_gem.h"
>
>  #define TYPE_XLNX_VERSAL "xlnx-versal"
>  #define XLNX_VERSAL(obj) OBJECT_CHECK(Versal, (obj), TYPE_XLNX_VERSAL)
> @@ -51,7 +52,7 @@ typedef struct Versal {
>
>          struct {
>              PL011State uart[XLNX_VERSAL_NR_UARTS];
> -            SysBusDevice *gem[XLNX_VERSAL_NR_GEMS];
> +            CadenceGEMState gem[XLNX_VERSAL_NR_GEMS];
>              SysBusDevice *adma[XLNX_VERSAL_NR_ADMAS];
>          } iou;
>      } lpd;
> --
> 2.20.1
>
>
^ permalink raw reply	[flat|nested] 43+ messages in thread
- * Re: [PATCH v1 05/11] hw/arm: versal: Embedd the GEMs into the SoC type
  2020-04-27 18:16 ` [PATCH v1 05/11] hw/arm: versal: Embedd the GEMs " Edgar E. Iglesias
  2020-04-27 22:17   ` Alistair Francis
@ 2020-04-28  7:48   ` Philippe Mathieu-Daudé
  2020-04-29  7:27   ` Luc Michel
  2 siblings, 0 replies; 43+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-04-28  7:48 UTC (permalink / raw)
  To: Edgar E. Iglesias, qemu-devel
  Cc: figlesia, peter.maydell, sstabellini, edgar.iglesias,
	sai.pavan.boddu, frasse.iglesias, alistair, richard.henderson,
	frederic.konrad, qemu-arm, philmd, luc.michel
On 4/27/20 8:16 PM, Edgar E. Iglesias wrote:
> From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
> 
> Embedd the GEMs into the SoC type.
> 
> Suggested-by: Peter Maydell <peter.maydell@linaro.org>
> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
> ---
>  hw/arm/xlnx-versal.c         | 15 ++++++++-------
>  include/hw/arm/xlnx-versal.h |  3 ++-
>  2 files changed, 10 insertions(+), 8 deletions(-)
> 
> diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c
> index dbde03b7e6..e424aa789e 100644
> --- a/hw/arm/xlnx-versal.c
> +++ b/hw/arm/xlnx-versal.c
> @@ -170,25 +170,26 @@ static void versal_create_gems(Versal *s, qemu_irq *pic)
>          DeviceState *dev;
>          MemoryRegion *mr;
>  
> -        dev = qdev_create(NULL, "cadence_gem");
> -        s->lpd.iou.gem[i] = SYS_BUS_DEVICE(dev);
> -        object_property_add_child(OBJECT(s), name, OBJECT(dev), &error_fatal);
> +        sysbus_init_child_obj(OBJECT(s), name,
> +                              &s->lpd.iou.gem[i], sizeof(s->lpd.iou.gem[i]),
> +                              TYPE_CADENCE_GEM);
> +        dev = DEVICE(&s->lpd.iou.gem[i]);
>          if (nd->used) {
>              qemu_check_nic_model(nd, "cadence_gem");
>              qdev_set_nic_properties(dev, nd);
>          }
> -        object_property_set_int(OBJECT(s->lpd.iou.gem[i]),
> +        object_property_set_int(OBJECT(dev),
>                                  2, "num-priority-queues",
>                                  &error_abort);
> -        object_property_set_link(OBJECT(s->lpd.iou.gem[i]),
> +        object_property_set_link(OBJECT(dev),
>                                   OBJECT(&s->mr_ps), "dma",
>                                   &error_abort);
>          qdev_init_nofail(dev);
>  
> -        mr = sysbus_mmio_get_region(s->lpd.iou.gem[i], 0);
> +        mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 0);
>          memory_region_add_subregion(&s->mr_ps, addrs[i], mr);
>  
> -        sysbus_connect_irq(s->lpd.iou.gem[i], 0, pic[irqs[i]]);
> +        sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[irqs[i]]);
>          g_free(name);
>      }
>  }
> diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h
> index a3dfd064b3..01da736a5b 100644
> --- a/include/hw/arm/xlnx-versal.h
> +++ b/include/hw/arm/xlnx-versal.h
> @@ -16,6 +16,7 @@
>  #include "hw/arm/boot.h"
>  #include "hw/intc/arm_gicv3.h"
>  #include "hw/char/pl011.h"
> +#include "hw/net/cadence_gem.h"
>  
>  #define TYPE_XLNX_VERSAL "xlnx-versal"
>  #define XLNX_VERSAL(obj) OBJECT_CHECK(Versal, (obj), TYPE_XLNX_VERSAL)
> @@ -51,7 +52,7 @@ typedef struct Versal {
>  
>          struct {
>              PL011State uart[XLNX_VERSAL_NR_UARTS];
> -            SysBusDevice *gem[XLNX_VERSAL_NR_GEMS];
> +            CadenceGEMState gem[XLNX_VERSAL_NR_GEMS];
>              SysBusDevice *adma[XLNX_VERSAL_NR_ADMAS];
>          } iou;
>      } lpd;
> 
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
^ permalink raw reply	[flat|nested] 43+ messages in thread
- * Re: [PATCH v1 05/11] hw/arm: versal: Embedd the GEMs into the SoC type
  2020-04-27 18:16 ` [PATCH v1 05/11] hw/arm: versal: Embedd the GEMs " Edgar E. Iglesias
  2020-04-27 22:17   ` Alistair Francis
  2020-04-28  7:48   ` Philippe Mathieu-Daudé
@ 2020-04-29  7:27   ` Luc Michel
  2 siblings, 0 replies; 43+ messages in thread
From: Luc Michel @ 2020-04-29  7:27 UTC (permalink / raw)
  To: Edgar E. Iglesias, qemu-devel
  Cc: figlesia, peter.maydell, sstabellini, edgar.iglesias,
	sai.pavan.boddu, frasse.iglesias, alistair, richard.henderson,
	frederic.konrad, qemu-arm, philmd
On 4/27/20 8:16 PM, Edgar E. Iglesias wrote:
> From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
> 
> Embedd the GEMs into the SoC type.
> 
> Suggested-by: Peter Maydell <peter.maydell@linaro.org>
> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
> ---
>  hw/arm/xlnx-versal.c         | 15 ++++++++-------
>  include/hw/arm/xlnx-versal.h |  3 ++-
>  2 files changed, 10 insertions(+), 8 deletions(-)
> 
> diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c
> index dbde03b7e6..e424aa789e 100644
> --- a/hw/arm/xlnx-versal.c
> +++ b/hw/arm/xlnx-versal.c
> @@ -170,25 +170,26 @@ static void versal_create_gems(Versal *s, qemu_irq *pic)
>          DeviceState *dev;
>          MemoryRegion *mr;
>  
> -        dev = qdev_create(NULL, "cadence_gem");
> -        s->lpd.iou.gem[i] = SYS_BUS_DEVICE(dev);
> -        object_property_add_child(OBJECT(s), name, OBJECT(dev), &error_fatal);
> +        sysbus_init_child_obj(OBJECT(s), name,
> +                              &s->lpd.iou.gem[i], sizeof(s->lpd.iou.gem[i]),
> +                              TYPE_CADENCE_GEM);
> +        dev = DEVICE(&s->lpd.iou.gem[i]);
>          if (nd->used) {
>              qemu_check_nic_model(nd, "cadence_gem");
>              qdev_set_nic_properties(dev, nd);
>          }
> -        object_property_set_int(OBJECT(s->lpd.iou.gem[i]),
> +        object_property_set_int(OBJECT(dev),
>                                  2, "num-priority-queues",
>                                  &error_abort);
> -        object_property_set_link(OBJECT(s->lpd.iou.gem[i]),
> +        object_property_set_link(OBJECT(dev),
>                                   OBJECT(&s->mr_ps), "dma",
>                                   &error_abort);
>          qdev_init_nofail(dev);
>  
> -        mr = sysbus_mmio_get_region(s->lpd.iou.gem[i], 0);
> +        mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 0);
>          memory_region_add_subregion(&s->mr_ps, addrs[i], mr);
>  
> -        sysbus_connect_irq(s->lpd.iou.gem[i], 0, pic[irqs[i]]);
> +        sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[irqs[i]]);
>          g_free(name);
>      }
>  }
> diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h
> index a3dfd064b3..01da736a5b 100644
> --- a/include/hw/arm/xlnx-versal.h
> +++ b/include/hw/arm/xlnx-versal.h
> @@ -16,6 +16,7 @@
>  #include "hw/arm/boot.h"
>  #include "hw/intc/arm_gicv3.h"
>  #include "hw/char/pl011.h"
> +#include "hw/net/cadence_gem.h"
>  
>  #define TYPE_XLNX_VERSAL "xlnx-versal"
>  #define XLNX_VERSAL(obj) OBJECT_CHECK(Versal, (obj), TYPE_XLNX_VERSAL)
> @@ -51,7 +52,7 @@ typedef struct Versal {
>  
>          struct {
>              PL011State uart[XLNX_VERSAL_NR_UARTS];
> -            SysBusDevice *gem[XLNX_VERSAL_NR_GEMS];
> +            CadenceGEMState gem[XLNX_VERSAL_NR_GEMS];
>              SysBusDevice *adma[XLNX_VERSAL_NR_ADMAS];
>          } iou;
>      } lpd;
> 
^ permalink raw reply	[flat|nested] 43+ messages in thread
 
- * [PATCH v1 06/11] hw/arm: versal: Embedd the ADMAs into the SoC type
  2020-04-27 18:16 [PATCH v1 00/11] hw/arm: versal: Add SD and the RTC Edgar E. Iglesias
                   ` (4 preceding siblings ...)
  2020-04-27 18:16 ` [PATCH v1 05/11] hw/arm: versal: Embedd the GEMs " Edgar E. Iglesias
@ 2020-04-27 18:16 ` Edgar E. Iglesias
  2020-04-27 22:18   ` Alistair Francis
                     ` (2 more replies)
  2020-04-27 18:16 ` [PATCH v1 07/11] hw/arm: versal: Embedd the APUs " Edgar E. Iglesias
                   ` (5 subsequent siblings)
  11 siblings, 3 replies; 43+ messages in thread
From: Edgar E. Iglesias @ 2020-04-27 18:16 UTC (permalink / raw)
  To: qemu-devel
  Cc: figlesia, peter.maydell, sstabellini, edgar.iglesias,
	sai.pavan.boddu, frasse.iglesias, alistair, richard.henderson,
	frederic.konrad, qemu-arm, philmd, luc.michel
From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
Embedd the ADMAs into the SoC type.
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
---
 hw/arm/xlnx-versal.c         | 14 +++++++-------
 include/hw/arm/xlnx-versal.h |  3 ++-
 2 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c
index e424aa789e..ebd2dc51be 100644
--- a/hw/arm/xlnx-versal.c
+++ b/hw/arm/xlnx-versal.c
@@ -203,18 +203,18 @@ static void versal_create_admas(Versal *s, qemu_irq *pic)
         DeviceState *dev;
         MemoryRegion *mr;
 
-        dev = qdev_create(NULL, "xlnx.zdma");
-        s->lpd.iou.adma[i] = SYS_BUS_DEVICE(dev);
-        object_property_set_int(OBJECT(s->lpd.iou.adma[i]), 128, "bus-width",
-                                &error_abort);
-        object_property_add_child(OBJECT(s), name, OBJECT(dev), &error_fatal);
+        sysbus_init_child_obj(OBJECT(s), name,
+                              &s->lpd.iou.adma[i], sizeof(s->lpd.iou.adma[i]),
+                              TYPE_XLNX_ZDMA);
+        dev = DEVICE(&s->lpd.iou.adma[i]);
+        object_property_set_int(OBJECT(dev), 128, "bus-width", &error_abort);
         qdev_init_nofail(dev);
 
-        mr = sysbus_mmio_get_region(s->lpd.iou.adma[i], 0);
+        mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 0);
         memory_region_add_subregion(&s->mr_ps,
                                     MM_ADMA_CH0 + i * MM_ADMA_CH0_SIZE, mr);
 
-        sysbus_connect_irq(s->lpd.iou.adma[i], 0, pic[VERSAL_ADMA_IRQ_0 + i]);
+        sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[VERSAL_ADMA_IRQ_0 + i]);
         g_free(name);
     }
 }
diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h
index 01da736a5b..94b7826fd4 100644
--- a/include/hw/arm/xlnx-versal.h
+++ b/include/hw/arm/xlnx-versal.h
@@ -16,6 +16,7 @@
 #include "hw/arm/boot.h"
 #include "hw/intc/arm_gicv3.h"
 #include "hw/char/pl011.h"
+#include "hw/dma/xlnx-zdma.h"
 #include "hw/net/cadence_gem.h"
 
 #define TYPE_XLNX_VERSAL "xlnx-versal"
@@ -53,7 +54,7 @@ typedef struct Versal {
         struct {
             PL011State uart[XLNX_VERSAL_NR_UARTS];
             CadenceGEMState gem[XLNX_VERSAL_NR_GEMS];
-            SysBusDevice *adma[XLNX_VERSAL_NR_ADMAS];
+            XlnxZDMA adma[XLNX_VERSAL_NR_ADMAS];
         } iou;
     } lpd;
 
-- 
2.20.1
^ permalink raw reply related	[flat|nested] 43+ messages in thread
- * Re: [PATCH v1 06/11] hw/arm: versal: Embedd the ADMAs into the SoC type
  2020-04-27 18:16 ` [PATCH v1 06/11] hw/arm: versal: Embedd the ADMAs " Edgar E. Iglesias
@ 2020-04-27 22:18   ` Alistair Francis
  2020-04-28  7:49   ` Philippe Mathieu-Daudé
  2020-04-29  7:28   ` Luc Michel
  2 siblings, 0 replies; 43+ messages in thread
From: Alistair Francis @ 2020-04-27 22:18 UTC (permalink / raw)
  To: Edgar E. Iglesias
  Cc: figlesia, Peter Maydell, Edgar Iglesias, Sai Pavan Boddu,
	Francisco Iglesias, Alistair Francis, Richard Henderson,
	qemu-devel@nongnu.org Developers, KONRAD Frederic,
	Stefano Stabellini, qemu-arm, Philippe Mathieu-Daudé,
	Luc Michel
On Mon, Apr 27, 2020 at 11:22 AM Edgar E. Iglesias
<edgar.iglesias@gmail.com> wrote:
>
> From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
>
> Embedd the ADMAs into the SoC type.
>
> Suggested-by: Peter Maydell <peter.maydell@linaro.org>
> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Alistair
> ---
>  hw/arm/xlnx-versal.c         | 14 +++++++-------
>  include/hw/arm/xlnx-versal.h |  3 ++-
>  2 files changed, 9 insertions(+), 8 deletions(-)
>
> diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c
> index e424aa789e..ebd2dc51be 100644
> --- a/hw/arm/xlnx-versal.c
> +++ b/hw/arm/xlnx-versal.c
> @@ -203,18 +203,18 @@ static void versal_create_admas(Versal *s, qemu_irq *pic)
>          DeviceState *dev;
>          MemoryRegion *mr;
>
> -        dev = qdev_create(NULL, "xlnx.zdma");
> -        s->lpd.iou.adma[i] = SYS_BUS_DEVICE(dev);
> -        object_property_set_int(OBJECT(s->lpd.iou.adma[i]), 128, "bus-width",
> -                                &error_abort);
> -        object_property_add_child(OBJECT(s), name, OBJECT(dev), &error_fatal);
> +        sysbus_init_child_obj(OBJECT(s), name,
> +                              &s->lpd.iou.adma[i], sizeof(s->lpd.iou.adma[i]),
> +                              TYPE_XLNX_ZDMA);
> +        dev = DEVICE(&s->lpd.iou.adma[i]);
> +        object_property_set_int(OBJECT(dev), 128, "bus-width", &error_abort);
>          qdev_init_nofail(dev);
>
> -        mr = sysbus_mmio_get_region(s->lpd.iou.adma[i], 0);
> +        mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 0);
>          memory_region_add_subregion(&s->mr_ps,
>                                      MM_ADMA_CH0 + i * MM_ADMA_CH0_SIZE, mr);
>
> -        sysbus_connect_irq(s->lpd.iou.adma[i], 0, pic[VERSAL_ADMA_IRQ_0 + i]);
> +        sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[VERSAL_ADMA_IRQ_0 + i]);
>          g_free(name);
>      }
>  }
> diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h
> index 01da736a5b..94b7826fd4 100644
> --- a/include/hw/arm/xlnx-versal.h
> +++ b/include/hw/arm/xlnx-versal.h
> @@ -16,6 +16,7 @@
>  #include "hw/arm/boot.h"
>  #include "hw/intc/arm_gicv3.h"
>  #include "hw/char/pl011.h"
> +#include "hw/dma/xlnx-zdma.h"
>  #include "hw/net/cadence_gem.h"
>
>  #define TYPE_XLNX_VERSAL "xlnx-versal"
> @@ -53,7 +54,7 @@ typedef struct Versal {
>          struct {
>              PL011State uart[XLNX_VERSAL_NR_UARTS];
>              CadenceGEMState gem[XLNX_VERSAL_NR_GEMS];
> -            SysBusDevice *adma[XLNX_VERSAL_NR_ADMAS];
> +            XlnxZDMA adma[XLNX_VERSAL_NR_ADMAS];
>          } iou;
>      } lpd;
>
> --
> 2.20.1
>
>
^ permalink raw reply	[flat|nested] 43+ messages in thread
- * Re: [PATCH v1 06/11] hw/arm: versal: Embedd the ADMAs into the SoC type
  2020-04-27 18:16 ` [PATCH v1 06/11] hw/arm: versal: Embedd the ADMAs " Edgar E. Iglesias
  2020-04-27 22:18   ` Alistair Francis
@ 2020-04-28  7:49   ` Philippe Mathieu-Daudé
  2020-04-29  7:28   ` Luc Michel
  2 siblings, 0 replies; 43+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-04-28  7:49 UTC (permalink / raw)
  To: Edgar E. Iglesias, qemu-devel
  Cc: figlesia, peter.maydell, sstabellini, edgar.iglesias,
	sai.pavan.boddu, frasse.iglesias, alistair, richard.henderson,
	frederic.konrad, qemu-arm, philmd, luc.michel
On 4/27/20 8:16 PM, Edgar E. Iglesias wrote:
> From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
> 
> Embedd the ADMAs into the SoC type.
> 
> Suggested-by: Peter Maydell <peter.maydell@linaro.org>
> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
> ---
>  hw/arm/xlnx-versal.c         | 14 +++++++-------
>  include/hw/arm/xlnx-versal.h |  3 ++-
>  2 files changed, 9 insertions(+), 8 deletions(-)
> 
> diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c
> index e424aa789e..ebd2dc51be 100644
> --- a/hw/arm/xlnx-versal.c
> +++ b/hw/arm/xlnx-versal.c
> @@ -203,18 +203,18 @@ static void versal_create_admas(Versal *s, qemu_irq *pic)
>          DeviceState *dev;
>          MemoryRegion *mr;
>  
> -        dev = qdev_create(NULL, "xlnx.zdma");
> -        s->lpd.iou.adma[i] = SYS_BUS_DEVICE(dev);
> -        object_property_set_int(OBJECT(s->lpd.iou.adma[i]), 128, "bus-width",
> -                                &error_abort);
> -        object_property_add_child(OBJECT(s), name, OBJECT(dev), &error_fatal);
> +        sysbus_init_child_obj(OBJECT(s), name,
> +                              &s->lpd.iou.adma[i], sizeof(s->lpd.iou.adma[i]),
> +                              TYPE_XLNX_ZDMA);
> +        dev = DEVICE(&s->lpd.iou.adma[i]);
> +        object_property_set_int(OBJECT(dev), 128, "bus-width", &error_abort);
>          qdev_init_nofail(dev);
>  
> -        mr = sysbus_mmio_get_region(s->lpd.iou.adma[i], 0);
> +        mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 0);
>          memory_region_add_subregion(&s->mr_ps,
>                                      MM_ADMA_CH0 + i * MM_ADMA_CH0_SIZE, mr);
>  
> -        sysbus_connect_irq(s->lpd.iou.adma[i], 0, pic[VERSAL_ADMA_IRQ_0 + i]);
> +        sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[VERSAL_ADMA_IRQ_0 + i]);
>          g_free(name);
>      }
>  }
> diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h
> index 01da736a5b..94b7826fd4 100644
> --- a/include/hw/arm/xlnx-versal.h
> +++ b/include/hw/arm/xlnx-versal.h
> @@ -16,6 +16,7 @@
>  #include "hw/arm/boot.h"
>  #include "hw/intc/arm_gicv3.h"
>  #include "hw/char/pl011.h"
> +#include "hw/dma/xlnx-zdma.h"
>  #include "hw/net/cadence_gem.h"
>  
>  #define TYPE_XLNX_VERSAL "xlnx-versal"
> @@ -53,7 +54,7 @@ typedef struct Versal {
>          struct {
>              PL011State uart[XLNX_VERSAL_NR_UARTS];
>              CadenceGEMState gem[XLNX_VERSAL_NR_GEMS];
> -            SysBusDevice *adma[XLNX_VERSAL_NR_ADMAS];
> +            XlnxZDMA adma[XLNX_VERSAL_NR_ADMAS];
>          } iou;
>      } lpd;
>  
> 
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
^ permalink raw reply	[flat|nested] 43+ messages in thread
- * Re: [PATCH v1 06/11] hw/arm: versal: Embedd the ADMAs into the SoC type
  2020-04-27 18:16 ` [PATCH v1 06/11] hw/arm: versal: Embedd the ADMAs " Edgar E. Iglesias
  2020-04-27 22:18   ` Alistair Francis
  2020-04-28  7:49   ` Philippe Mathieu-Daudé
@ 2020-04-29  7:28   ` Luc Michel
  2 siblings, 0 replies; 43+ messages in thread
From: Luc Michel @ 2020-04-29  7:28 UTC (permalink / raw)
  To: Edgar E. Iglesias, qemu-devel
  Cc: figlesia, peter.maydell, sstabellini, edgar.iglesias,
	sai.pavan.boddu, frasse.iglesias, alistair, richard.henderson,
	frederic.konrad, qemu-arm, philmd
On 4/27/20 8:16 PM, Edgar E. Iglesias wrote:
> From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
> 
> Embedd the ADMAs into the SoC type.
> 
> Suggested-by: Peter Maydell <peter.maydell@linaro.org>
> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
> ---
>  hw/arm/xlnx-versal.c         | 14 +++++++-------
>  include/hw/arm/xlnx-versal.h |  3 ++-
>  2 files changed, 9 insertions(+), 8 deletions(-)
> 
> diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c
> index e424aa789e..ebd2dc51be 100644
> --- a/hw/arm/xlnx-versal.c
> +++ b/hw/arm/xlnx-versal.c
> @@ -203,18 +203,18 @@ static void versal_create_admas(Versal *s, qemu_irq *pic)
>          DeviceState *dev;
>          MemoryRegion *mr;
>  
> -        dev = qdev_create(NULL, "xlnx.zdma");
> -        s->lpd.iou.adma[i] = SYS_BUS_DEVICE(dev);
> -        object_property_set_int(OBJECT(s->lpd.iou.adma[i]), 128, "bus-width",
> -                                &error_abort);
> -        object_property_add_child(OBJECT(s), name, OBJECT(dev), &error_fatal);
> +        sysbus_init_child_obj(OBJECT(s), name,
> +                              &s->lpd.iou.adma[i], sizeof(s->lpd.iou.adma[i]),
> +                              TYPE_XLNX_ZDMA);
> +        dev = DEVICE(&s->lpd.iou.adma[i]);
> +        object_property_set_int(OBJECT(dev), 128, "bus-width", &error_abort);
>          qdev_init_nofail(dev);
>  
> -        mr = sysbus_mmio_get_region(s->lpd.iou.adma[i], 0);
> +        mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 0);
>          memory_region_add_subregion(&s->mr_ps,
>                                      MM_ADMA_CH0 + i * MM_ADMA_CH0_SIZE, mr);
>  
> -        sysbus_connect_irq(s->lpd.iou.adma[i], 0, pic[VERSAL_ADMA_IRQ_0 + i]);
> +        sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0, pic[VERSAL_ADMA_IRQ_0 + i]);
>          g_free(name);
>      }
>  }
> diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h
> index 01da736a5b..94b7826fd4 100644
> --- a/include/hw/arm/xlnx-versal.h
> +++ b/include/hw/arm/xlnx-versal.h
> @@ -16,6 +16,7 @@
>  #include "hw/arm/boot.h"
>  #include "hw/intc/arm_gicv3.h"
>  #include "hw/char/pl011.h"
> +#include "hw/dma/xlnx-zdma.h"
>  #include "hw/net/cadence_gem.h"
>  
>  #define TYPE_XLNX_VERSAL "xlnx-versal"
> @@ -53,7 +54,7 @@ typedef struct Versal {
>          struct {
>              PL011State uart[XLNX_VERSAL_NR_UARTS];
>              CadenceGEMState gem[XLNX_VERSAL_NR_GEMS];
> -            SysBusDevice *adma[XLNX_VERSAL_NR_ADMAS];
> +            XlnxZDMA adma[XLNX_VERSAL_NR_ADMAS];
>          } iou;
>      } lpd;
>  
> 
^ permalink raw reply	[flat|nested] 43+ messages in thread
 
- * [PATCH v1 07/11] hw/arm: versal: Embedd the APUs into the SoC type
  2020-04-27 18:16 [PATCH v1 00/11] hw/arm: versal: Add SD and the RTC Edgar E. Iglesias
                   ` (5 preceding siblings ...)
  2020-04-27 18:16 ` [PATCH v1 06/11] hw/arm: versal: Embedd the ADMAs " Edgar E. Iglesias
@ 2020-04-27 18:16 ` Edgar E. Iglesias
  2020-04-27 22:20   ` Alistair Francis
                     ` (2 more replies)
  2020-04-27 18:16 ` [PATCH v1 08/11] hw/arm: versal: Add support for SD Edgar E. Iglesias
                   ` (4 subsequent siblings)
  11 siblings, 3 replies; 43+ messages in thread
From: Edgar E. Iglesias @ 2020-04-27 18:16 UTC (permalink / raw)
  To: qemu-devel
  Cc: figlesia, peter.maydell, sstabellini, edgar.iglesias,
	sai.pavan.boddu, frasse.iglesias, alistair, richard.henderson,
	frederic.konrad, qemu-arm, philmd, luc.michel
From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
Embedd the APUs into the SoC type.
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
---
 hw/arm/xlnx-versal-virt.c    |  4 ++--
 hw/arm/xlnx-versal.c         | 19 +++++--------------
 include/hw/arm/xlnx-versal.h |  2 +-
 3 files changed, 8 insertions(+), 17 deletions(-)
diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c
index 8a608074d1..d7be1ad494 100644
--- a/hw/arm/xlnx-versal-virt.c
+++ b/hw/arm/xlnx-versal-virt.c
@@ -469,9 +469,9 @@ static void versal_virt_init(MachineState *machine)
     s->binfo.get_dtb = versal_virt_get_dtb;
     s->binfo.modify_dtb = versal_virt_modify_dtb;
     if (machine->kernel_filename) {
-        arm_load_kernel(s->soc.fpd.apu.cpu[0], machine, &s->binfo);
+        arm_load_kernel(&s->soc.fpd.apu.cpu[0], machine, &s->binfo);
     } else {
-        AddressSpace *as = arm_boot_address_space(s->soc.fpd.apu.cpu[0],
+        AddressSpace *as = arm_boot_address_space(&s->soc.fpd.apu.cpu[0],
                                                   &s->binfo);
         /* Some boot-loaders (e.g u-boot) don't like blobs at address 0 (NULL).
          * Offset things by 4K.  */
diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c
index ebd2dc51be..c8a296e2e0 100644
--- a/hw/arm/xlnx-versal.c
+++ b/hw/arm/xlnx-versal.c
@@ -31,19 +31,11 @@ static void versal_create_apu_cpus(Versal *s)
 
     for (i = 0; i < ARRAY_SIZE(s->fpd.apu.cpu); i++) {
         Object *obj;
-        char *name;
-
-        obj = object_new(XLNX_VERSAL_ACPU_TYPE);
-        if (!obj) {
-            error_report("Unable to create apu.cpu[%d] of type %s",
-                         i, XLNX_VERSAL_ACPU_TYPE);
-            exit(EXIT_FAILURE);
-        }
-
-        name = g_strdup_printf("apu-cpu[%d]", i);
-        object_property_add_child(OBJECT(s), name, obj, &error_fatal);
-        g_free(name);
 
+        object_initialize_child(OBJECT(s), "apu-cpu[*]",
+                                &s->fpd.apu.cpu[i], sizeof(s->fpd.apu.cpu[i]),
+                                XLNX_VERSAL_ACPU_TYPE, &error_abort, NULL);
+        obj = OBJECT(&s->fpd.apu.cpu[i]);
         object_property_set_int(obj, s->cfg.psci_conduit,
                                 "psci-conduit", &error_abort);
         if (i) {
@@ -57,7 +49,6 @@ static void versal_create_apu_cpus(Versal *s)
         object_property_set_link(obj, OBJECT(&s->fpd.apu.mr), "memory",
                                  &error_abort);
         object_property_set_bool(obj, true, "realized", &error_fatal);
-        s->fpd.apu.cpu[i] = ARM_CPU(obj);
     }
 }
 
@@ -95,7 +86,7 @@ static void versal_create_apu_gic(Versal *s, qemu_irq *pic)
     }
 
     for (i = 0; i < nr_apu_cpus; i++) {
-        DeviceState *cpudev = DEVICE(s->fpd.apu.cpu[i]);
+        DeviceState *cpudev = DEVICE(&s->fpd.apu.cpu[i]);
         int ppibase = XLNX_VERSAL_NR_IRQS + i * GIC_INTERNAL + GIC_NR_SGIS;
         qemu_irq maint_irq;
         int ti;
diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h
index 94b7826fd4..426b66449d 100644
--- a/include/hw/arm/xlnx-versal.h
+++ b/include/hw/arm/xlnx-versal.h
@@ -36,7 +36,7 @@ typedef struct Versal {
     struct {
         struct {
             MemoryRegion mr;
-            ARMCPU *cpu[XLNX_VERSAL_NR_ACPUS];
+            ARMCPU cpu[XLNX_VERSAL_NR_ACPUS];
             GICv3State gic;
         } apu;
     } fpd;
-- 
2.20.1
^ permalink raw reply related	[flat|nested] 43+ messages in thread
- * Re: [PATCH v1 07/11] hw/arm: versal: Embedd the APUs into the SoC type
  2020-04-27 18:16 ` [PATCH v1 07/11] hw/arm: versal: Embedd the APUs " Edgar E. Iglesias
@ 2020-04-27 22:20   ` Alistair Francis
  2020-04-28  7:50   ` Philippe Mathieu-Daudé
  2020-04-29  7:28   ` Luc Michel
  2 siblings, 0 replies; 43+ messages in thread
From: Alistair Francis @ 2020-04-27 22:20 UTC (permalink / raw)
  To: Edgar E. Iglesias
  Cc: figlesia, Peter Maydell, Edgar Iglesias, Sai Pavan Boddu,
	Francisco Iglesias, Alistair Francis, Richard Henderson,
	qemu-devel@nongnu.org Developers, KONRAD Frederic,
	Stefano Stabellini, qemu-arm, Philippe Mathieu-Daudé,
	Luc Michel
On Mon, Apr 27, 2020 at 11:20 AM Edgar E. Iglesias
<edgar.iglesias@gmail.com> wrote:
>
> From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
>
> Embedd the APUs into the SoC type.
>
> Suggested-by: Peter Maydell <peter.maydell@linaro.org>
> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Alistair
> ---
>  hw/arm/xlnx-versal-virt.c    |  4 ++--
>  hw/arm/xlnx-versal.c         | 19 +++++--------------
>  include/hw/arm/xlnx-versal.h |  2 +-
>  3 files changed, 8 insertions(+), 17 deletions(-)
>
> diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c
> index 8a608074d1..d7be1ad494 100644
> --- a/hw/arm/xlnx-versal-virt.c
> +++ b/hw/arm/xlnx-versal-virt.c
> @@ -469,9 +469,9 @@ static void versal_virt_init(MachineState *machine)
>      s->binfo.get_dtb = versal_virt_get_dtb;
>      s->binfo.modify_dtb = versal_virt_modify_dtb;
>      if (machine->kernel_filename) {
> -        arm_load_kernel(s->soc.fpd.apu.cpu[0], machine, &s->binfo);
> +        arm_load_kernel(&s->soc.fpd.apu.cpu[0], machine, &s->binfo);
>      } else {
> -        AddressSpace *as = arm_boot_address_space(s->soc.fpd.apu.cpu[0],
> +        AddressSpace *as = arm_boot_address_space(&s->soc.fpd.apu.cpu[0],
>                                                    &s->binfo);
>          /* Some boot-loaders (e.g u-boot) don't like blobs at address 0 (NULL).
>           * Offset things by 4K.  */
> diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c
> index ebd2dc51be..c8a296e2e0 100644
> --- a/hw/arm/xlnx-versal.c
> +++ b/hw/arm/xlnx-versal.c
> @@ -31,19 +31,11 @@ static void versal_create_apu_cpus(Versal *s)
>
>      for (i = 0; i < ARRAY_SIZE(s->fpd.apu.cpu); i++) {
>          Object *obj;
> -        char *name;
> -
> -        obj = object_new(XLNX_VERSAL_ACPU_TYPE);
> -        if (!obj) {
> -            error_report("Unable to create apu.cpu[%d] of type %s",
> -                         i, XLNX_VERSAL_ACPU_TYPE);
> -            exit(EXIT_FAILURE);
> -        }
> -
> -        name = g_strdup_printf("apu-cpu[%d]", i);
> -        object_property_add_child(OBJECT(s), name, obj, &error_fatal);
> -        g_free(name);
>
> +        object_initialize_child(OBJECT(s), "apu-cpu[*]",
> +                                &s->fpd.apu.cpu[i], sizeof(s->fpd.apu.cpu[i]),
> +                                XLNX_VERSAL_ACPU_TYPE, &error_abort, NULL);
> +        obj = OBJECT(&s->fpd.apu.cpu[i]);
>          object_property_set_int(obj, s->cfg.psci_conduit,
>                                  "psci-conduit", &error_abort);
>          if (i) {
> @@ -57,7 +49,6 @@ static void versal_create_apu_cpus(Versal *s)
>          object_property_set_link(obj, OBJECT(&s->fpd.apu.mr), "memory",
>                                   &error_abort);
>          object_property_set_bool(obj, true, "realized", &error_fatal);
> -        s->fpd.apu.cpu[i] = ARM_CPU(obj);
>      }
>  }
>
> @@ -95,7 +86,7 @@ static void versal_create_apu_gic(Versal *s, qemu_irq *pic)
>      }
>
>      for (i = 0; i < nr_apu_cpus; i++) {
> -        DeviceState *cpudev = DEVICE(s->fpd.apu.cpu[i]);
> +        DeviceState *cpudev = DEVICE(&s->fpd.apu.cpu[i]);
>          int ppibase = XLNX_VERSAL_NR_IRQS + i * GIC_INTERNAL + GIC_NR_SGIS;
>          qemu_irq maint_irq;
>          int ti;
> diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h
> index 94b7826fd4..426b66449d 100644
> --- a/include/hw/arm/xlnx-versal.h
> +++ b/include/hw/arm/xlnx-versal.h
> @@ -36,7 +36,7 @@ typedef struct Versal {
>      struct {
>          struct {
>              MemoryRegion mr;
> -            ARMCPU *cpu[XLNX_VERSAL_NR_ACPUS];
> +            ARMCPU cpu[XLNX_VERSAL_NR_ACPUS];
>              GICv3State gic;
>          } apu;
>      } fpd;
> --
> 2.20.1
>
>
^ permalink raw reply	[flat|nested] 43+ messages in thread
- * Re: [PATCH v1 07/11] hw/arm: versal: Embedd the APUs into the SoC type
  2020-04-27 18:16 ` [PATCH v1 07/11] hw/arm: versal: Embedd the APUs " Edgar E. Iglesias
  2020-04-27 22:20   ` Alistair Francis
@ 2020-04-28  7:50   ` Philippe Mathieu-Daudé
  2020-04-29  7:28   ` Luc Michel
  2 siblings, 0 replies; 43+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-04-28  7:50 UTC (permalink / raw)
  To: Edgar E. Iglesias, qemu-devel
  Cc: figlesia, peter.maydell, sstabellini, edgar.iglesias,
	sai.pavan.boddu, frasse.iglesias, alistair, richard.henderson,
	frederic.konrad, qemu-arm, philmd, luc.michel
On 4/27/20 8:16 PM, Edgar E. Iglesias wrote:
> From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
> 
> Embedd the APUs into the SoC type.
> 
> Suggested-by: Peter Maydell <peter.maydell@linaro.org>
> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
> ---
>  hw/arm/xlnx-versal-virt.c    |  4 ++--
>  hw/arm/xlnx-versal.c         | 19 +++++--------------
>  include/hw/arm/xlnx-versal.h |  2 +-
>  3 files changed, 8 insertions(+), 17 deletions(-)
> 
> diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c
> index 8a608074d1..d7be1ad494 100644
> --- a/hw/arm/xlnx-versal-virt.c
> +++ b/hw/arm/xlnx-versal-virt.c
> @@ -469,9 +469,9 @@ static void versal_virt_init(MachineState *machine)
>      s->binfo.get_dtb = versal_virt_get_dtb;
>      s->binfo.modify_dtb = versal_virt_modify_dtb;
>      if (machine->kernel_filename) {
> -        arm_load_kernel(s->soc.fpd.apu.cpu[0], machine, &s->binfo);
> +        arm_load_kernel(&s->soc.fpd.apu.cpu[0], machine, &s->binfo);
>      } else {
> -        AddressSpace *as = arm_boot_address_space(s->soc.fpd.apu.cpu[0],
> +        AddressSpace *as = arm_boot_address_space(&s->soc.fpd.apu.cpu[0],
>                                                    &s->binfo);
>          /* Some boot-loaders (e.g u-boot) don't like blobs at address 0 (NULL).
>           * Offset things by 4K.  */
> diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c
> index ebd2dc51be..c8a296e2e0 100644
> --- a/hw/arm/xlnx-versal.c
> +++ b/hw/arm/xlnx-versal.c
> @@ -31,19 +31,11 @@ static void versal_create_apu_cpus(Versal *s)
>  
>      for (i = 0; i < ARRAY_SIZE(s->fpd.apu.cpu); i++) {
>          Object *obj;
> -        char *name;
> -
> -        obj = object_new(XLNX_VERSAL_ACPU_TYPE);
> -        if (!obj) {
> -            error_report("Unable to create apu.cpu[%d] of type %s",
> -                         i, XLNX_VERSAL_ACPU_TYPE);
> -            exit(EXIT_FAILURE);
> -        }
> -
> -        name = g_strdup_printf("apu-cpu[%d]", i);
> -        object_property_add_child(OBJECT(s), name, obj, &error_fatal);
> -        g_free(name);
>  
> +        object_initialize_child(OBJECT(s), "apu-cpu[*]",
> +                                &s->fpd.apu.cpu[i], sizeof(s->fpd.apu.cpu[i]),
> +                                XLNX_VERSAL_ACPU_TYPE, &error_abort, NULL);
:)
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> +        obj = OBJECT(&s->fpd.apu.cpu[i]);
>          object_property_set_int(obj, s->cfg.psci_conduit,
>                                  "psci-conduit", &error_abort);
>          if (i) {
> @@ -57,7 +49,6 @@ static void versal_create_apu_cpus(Versal *s)
>          object_property_set_link(obj, OBJECT(&s->fpd.apu.mr), "memory",
>                                   &error_abort);
>          object_property_set_bool(obj, true, "realized", &error_fatal);
> -        s->fpd.apu.cpu[i] = ARM_CPU(obj);
>      }
>  }
>  
> @@ -95,7 +86,7 @@ static void versal_create_apu_gic(Versal *s, qemu_irq *pic)
>      }
>  
>      for (i = 0; i < nr_apu_cpus; i++) {
> -        DeviceState *cpudev = DEVICE(s->fpd.apu.cpu[i]);
> +        DeviceState *cpudev = DEVICE(&s->fpd.apu.cpu[i]);
>          int ppibase = XLNX_VERSAL_NR_IRQS + i * GIC_INTERNAL + GIC_NR_SGIS;
>          qemu_irq maint_irq;
>          int ti;
> diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h
> index 94b7826fd4..426b66449d 100644
> --- a/include/hw/arm/xlnx-versal.h
> +++ b/include/hw/arm/xlnx-versal.h
> @@ -36,7 +36,7 @@ typedef struct Versal {
>      struct {
>          struct {
>              MemoryRegion mr;
> -            ARMCPU *cpu[XLNX_VERSAL_NR_ACPUS];
> +            ARMCPU cpu[XLNX_VERSAL_NR_ACPUS];
>              GICv3State gic;
>          } apu;
>      } fpd;
> 
^ permalink raw reply	[flat|nested] 43+ messages in thread
- * Re: [PATCH v1 07/11] hw/arm: versal: Embedd the APUs into the SoC type
  2020-04-27 18:16 ` [PATCH v1 07/11] hw/arm: versal: Embedd the APUs " Edgar E. Iglesias
  2020-04-27 22:20   ` Alistair Francis
  2020-04-28  7:50   ` Philippe Mathieu-Daudé
@ 2020-04-29  7:28   ` Luc Michel
  2 siblings, 0 replies; 43+ messages in thread
From: Luc Michel @ 2020-04-29  7:28 UTC (permalink / raw)
  To: Edgar E. Iglesias, qemu-devel
  Cc: figlesia, peter.maydell, sstabellini, edgar.iglesias,
	sai.pavan.boddu, frasse.iglesias, alistair, richard.henderson,
	frederic.konrad, qemu-arm, philmd
On 4/27/20 8:16 PM, Edgar E. Iglesias wrote:
> From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
> 
> Embedd the APUs into the SoC type.
> 
> Suggested-by: Peter Maydell <peter.maydell@linaro.org>
> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
> ---
>  hw/arm/xlnx-versal-virt.c    |  4 ++--
>  hw/arm/xlnx-versal.c         | 19 +++++--------------
>  include/hw/arm/xlnx-versal.h |  2 +-
>  3 files changed, 8 insertions(+), 17 deletions(-)
> 
> diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c
> index 8a608074d1..d7be1ad494 100644
> --- a/hw/arm/xlnx-versal-virt.c
> +++ b/hw/arm/xlnx-versal-virt.c
> @@ -469,9 +469,9 @@ static void versal_virt_init(MachineState *machine)
>      s->binfo.get_dtb = versal_virt_get_dtb;
>      s->binfo.modify_dtb = versal_virt_modify_dtb;
>      if (machine->kernel_filename) {
> -        arm_load_kernel(s->soc.fpd.apu.cpu[0], machine, &s->binfo);
> +        arm_load_kernel(&s->soc.fpd.apu.cpu[0], machine, &s->binfo);
>      } else {
> -        AddressSpace *as = arm_boot_address_space(s->soc.fpd.apu.cpu[0],
> +        AddressSpace *as = arm_boot_address_space(&s->soc.fpd.apu.cpu[0],
>                                                    &s->binfo);
>          /* Some boot-loaders (e.g u-boot) don't like blobs at address 0 (NULL).
>           * Offset things by 4K.  */
> diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c
> index ebd2dc51be..c8a296e2e0 100644
> --- a/hw/arm/xlnx-versal.c
> +++ b/hw/arm/xlnx-versal.c
> @@ -31,19 +31,11 @@ static void versal_create_apu_cpus(Versal *s)
>  
>      for (i = 0; i < ARRAY_SIZE(s->fpd.apu.cpu); i++) {
>          Object *obj;
> -        char *name;
> -
> -        obj = object_new(XLNX_VERSAL_ACPU_TYPE);
> -        if (!obj) {
> -            error_report("Unable to create apu.cpu[%d] of type %s",
> -                         i, XLNX_VERSAL_ACPU_TYPE);
> -            exit(EXIT_FAILURE);
> -        }
> -
> -        name = g_strdup_printf("apu-cpu[%d]", i);
> -        object_property_add_child(OBJECT(s), name, obj, &error_fatal);
> -        g_free(name);
>  
> +        object_initialize_child(OBJECT(s), "apu-cpu[*]",
> +                                &s->fpd.apu.cpu[i], sizeof(s->fpd.apu.cpu[i]),
> +                                XLNX_VERSAL_ACPU_TYPE, &error_abort, NULL);
> +        obj = OBJECT(&s->fpd.apu.cpu[i]);
>          object_property_set_int(obj, s->cfg.psci_conduit,
>                                  "psci-conduit", &error_abort);
>          if (i) {
> @@ -57,7 +49,6 @@ static void versal_create_apu_cpus(Versal *s)
>          object_property_set_link(obj, OBJECT(&s->fpd.apu.mr), "memory",
>                                   &error_abort);
>          object_property_set_bool(obj, true, "realized", &error_fatal);
> -        s->fpd.apu.cpu[i] = ARM_CPU(obj);
>      }
>  }
>  
> @@ -95,7 +86,7 @@ static void versal_create_apu_gic(Versal *s, qemu_irq *pic)
>      }
>  
>      for (i = 0; i < nr_apu_cpus; i++) {
> -        DeviceState *cpudev = DEVICE(s->fpd.apu.cpu[i]);
> +        DeviceState *cpudev = DEVICE(&s->fpd.apu.cpu[i]);
>          int ppibase = XLNX_VERSAL_NR_IRQS + i * GIC_INTERNAL + GIC_NR_SGIS;
>          qemu_irq maint_irq;
>          int ti;
> diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h
> index 94b7826fd4..426b66449d 100644
> --- a/include/hw/arm/xlnx-versal.h
> +++ b/include/hw/arm/xlnx-versal.h
> @@ -36,7 +36,7 @@ typedef struct Versal {
>      struct {
>          struct {
>              MemoryRegion mr;
> -            ARMCPU *cpu[XLNX_VERSAL_NR_ACPUS];
> +            ARMCPU cpu[XLNX_VERSAL_NR_ACPUS];
>              GICv3State gic;
>          } apu;
>      } fpd;
> 
^ permalink raw reply	[flat|nested] 43+ messages in thread
 
- * [PATCH v1 08/11] hw/arm: versal: Add support for SD
  2020-04-27 18:16 [PATCH v1 00/11] hw/arm: versal: Add SD and the RTC Edgar E. Iglesias
                   ` (6 preceding siblings ...)
  2020-04-27 18:16 ` [PATCH v1 07/11] hw/arm: versal: Embedd the APUs " Edgar E. Iglesias
@ 2020-04-27 18:16 ` Edgar E. Iglesias
  2020-04-27 22:24   ` Alistair Francis
                     ` (2 more replies)
  2020-04-27 18:16 ` [PATCH v1 09/11] hw/arm: versal: Add support for the RTC Edgar E. Iglesias
                   ` (3 subsequent siblings)
  11 siblings, 3 replies; 43+ messages in thread
From: Edgar E. Iglesias @ 2020-04-27 18:16 UTC (permalink / raw)
  To: qemu-devel
  Cc: figlesia, peter.maydell, sstabellini, edgar.iglesias,
	sai.pavan.boddu, frasse.iglesias, alistair, richard.henderson,
	frederic.konrad, qemu-arm, philmd, luc.michel
From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
Add support for SD.
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
---
 hw/arm/xlnx-versal.c         | 31 +++++++++++++++++++++++++++++++
 include/hw/arm/xlnx-versal.h | 12 ++++++++++++
 2 files changed, 43 insertions(+)
diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c
index c8a296e2e0..e263bdf77a 100644
--- a/hw/arm/xlnx-versal.c
+++ b/hw/arm/xlnx-versal.c
@@ -210,6 +210,36 @@ static void versal_create_admas(Versal *s, qemu_irq *pic)
     }
 }
 
+#define SDHCI_CAPABILITIES  0x280737ec6481 /* Same as on ZynqMP.  */
+static void versal_create_sds(Versal *s, qemu_irq *pic)
+{
+    int i;
+
+    for (i = 0; i < ARRAY_SIZE(s->pmc.iou.sd); i++) {
+        DeviceState *dev;
+        MemoryRegion *mr;
+
+        sysbus_init_child_obj(OBJECT(s), "sd[*]",
+                              &s->pmc.iou.sd[i], sizeof(s->pmc.iou.sd[i]),
+                              TYPE_SYSBUS_SDHCI);
+        dev = DEVICE(&s->pmc.iou.sd[i]);
+
+        object_property_set_uint(OBJECT(dev),
+                                 3, "sd-spec-version", &error_fatal);
+        object_property_set_uint(OBJECT(dev), SDHCI_CAPABILITIES, "capareg",
+                                 &error_fatal);
+        object_property_set_uint(OBJECT(dev), UHS_I, "uhs", &error_fatal);
+        qdev_init_nofail(dev);
+
+        mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 0);
+        memory_region_add_subregion(&s->mr_ps,
+                                    MM_PMC_SD0 + i * MM_PMC_SD0_SIZE, mr);
+
+        sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0,
+                           pic[VERSAL_SD0_IRQ_0 + i * 2]);
+    }
+}
+
 /* This takes the board allocated linear DDR memory and creates aliases
  * for each split DDR range/aperture on the Versal address map.
  */
@@ -292,6 +322,7 @@ static void versal_realize(DeviceState *dev, Error **errp)
     versal_create_uarts(s, pic);
     versal_create_gems(s, pic);
     versal_create_admas(s, pic);
+    versal_create_sds(s, pic);
     versal_map_ddr(s);
     versal_unimp(s);
 
diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h
index 426b66449d..e11693e29d 100644
--- a/include/hw/arm/xlnx-versal.h
+++ b/include/hw/arm/xlnx-versal.h
@@ -14,6 +14,7 @@
 
 #include "hw/sysbus.h"
 #include "hw/arm/boot.h"
+#include "hw/sd/sdhci.h"
 #include "hw/intc/arm_gicv3.h"
 #include "hw/char/pl011.h"
 #include "hw/dma/xlnx-zdma.h"
@@ -26,6 +27,7 @@
 #define XLNX_VERSAL_NR_UARTS   2
 #define XLNX_VERSAL_NR_GEMS    2
 #define XLNX_VERSAL_NR_ADMAS   8
+#define XLNX_VERSAL_NR_SDS     2
 #define XLNX_VERSAL_NR_IRQS    192
 
 typedef struct Versal {
@@ -58,6 +60,13 @@ typedef struct Versal {
         } iou;
     } lpd;
 
+    /* The Platform Management Controller subsystem.  */
+    struct {
+        struct {
+            SDHCIState sd[XLNX_VERSAL_NR_SDS];
+        } iou;
+    } pmc;
+
     struct {
         MemoryRegion *mr_ddr;
         uint32_t psci_conduit;
@@ -80,6 +89,7 @@ typedef struct Versal {
 #define VERSAL_GEM1_IRQ_0          58
 #define VERSAL_GEM1_WAKE_IRQ_0     59
 #define VERSAL_ADMA_IRQ_0          60
+#define VERSAL_SD0_IRQ_0           126
 
 /* Architecturally reserved IRQs suitable for virtualization.  */
 #define VERSAL_RSVD_IRQ_FIRST 111
@@ -129,6 +139,8 @@ typedef struct Versal {
 #define MM_FPD_CRF                  0xfd1a0000U
 #define MM_FPD_CRF_SIZE             0x140000
 
+#define MM_PMC_SD0                  0xf1040000U
+#define MM_PMC_SD0_SIZE             0x10000
 #define MM_PMC_CRP                  0xf1260000U
 #define MM_PMC_CRP_SIZE             0x10000
 #endif
-- 
2.20.1
^ permalink raw reply related	[flat|nested] 43+ messages in thread
- * Re: [PATCH v1 08/11] hw/arm: versal: Add support for SD
  2020-04-27 18:16 ` [PATCH v1 08/11] hw/arm: versal: Add support for SD Edgar E. Iglesias
@ 2020-04-27 22:24   ` Alistair Francis
  2020-04-28  7:51   ` Philippe Mathieu-Daudé
  2020-04-29  7:28   ` Luc Michel
  2 siblings, 0 replies; 43+ messages in thread
From: Alistair Francis @ 2020-04-27 22:24 UTC (permalink / raw)
  To: Edgar E. Iglesias
  Cc: figlesia, Peter Maydell, Edgar Iglesias, Sai Pavan Boddu,
	Francisco Iglesias, Alistair Francis, Richard Henderson,
	qemu-devel@nongnu.org Developers, KONRAD Frederic,
	Stefano Stabellini, qemu-arm, Philippe Mathieu-Daudé,
	Luc Michel
On Mon, Apr 27, 2020 at 11:23 AM Edgar E. Iglesias
<edgar.iglesias@gmail.com> wrote:
>
> From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
>
> Add support for SD.
>
> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Alistair
> ---
>  hw/arm/xlnx-versal.c         | 31 +++++++++++++++++++++++++++++++
>  include/hw/arm/xlnx-versal.h | 12 ++++++++++++
>  2 files changed, 43 insertions(+)
>
> diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c
> index c8a296e2e0..e263bdf77a 100644
> --- a/hw/arm/xlnx-versal.c
> +++ b/hw/arm/xlnx-versal.c
> @@ -210,6 +210,36 @@ static void versal_create_admas(Versal *s, qemu_irq *pic)
>      }
>  }
>
> +#define SDHCI_CAPABILITIES  0x280737ec6481 /* Same as on ZynqMP.  */
> +static void versal_create_sds(Versal *s, qemu_irq *pic)
> +{
> +    int i;
> +
> +    for (i = 0; i < ARRAY_SIZE(s->pmc.iou.sd); i++) {
> +        DeviceState *dev;
> +        MemoryRegion *mr;
> +
> +        sysbus_init_child_obj(OBJECT(s), "sd[*]",
> +                              &s->pmc.iou.sd[i], sizeof(s->pmc.iou.sd[i]),
> +                              TYPE_SYSBUS_SDHCI);
> +        dev = DEVICE(&s->pmc.iou.sd[i]);
> +
> +        object_property_set_uint(OBJECT(dev),
> +                                 3, "sd-spec-version", &error_fatal);
> +        object_property_set_uint(OBJECT(dev), SDHCI_CAPABILITIES, "capareg",
> +                                 &error_fatal);
> +        object_property_set_uint(OBJECT(dev), UHS_I, "uhs", &error_fatal);
> +        qdev_init_nofail(dev);
> +
> +        mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 0);
> +        memory_region_add_subregion(&s->mr_ps,
> +                                    MM_PMC_SD0 + i * MM_PMC_SD0_SIZE, mr);
> +
> +        sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0,
> +                           pic[VERSAL_SD0_IRQ_0 + i * 2]);
> +    }
> +}
> +
>  /* This takes the board allocated linear DDR memory and creates aliases
>   * for each split DDR range/aperture on the Versal address map.
>   */
> @@ -292,6 +322,7 @@ static void versal_realize(DeviceState *dev, Error **errp)
>      versal_create_uarts(s, pic);
>      versal_create_gems(s, pic);
>      versal_create_admas(s, pic);
> +    versal_create_sds(s, pic);
>      versal_map_ddr(s);
>      versal_unimp(s);
>
> diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h
> index 426b66449d..e11693e29d 100644
> --- a/include/hw/arm/xlnx-versal.h
> +++ b/include/hw/arm/xlnx-versal.h
> @@ -14,6 +14,7 @@
>
>  #include "hw/sysbus.h"
>  #include "hw/arm/boot.h"
> +#include "hw/sd/sdhci.h"
>  #include "hw/intc/arm_gicv3.h"
>  #include "hw/char/pl011.h"
>  #include "hw/dma/xlnx-zdma.h"
> @@ -26,6 +27,7 @@
>  #define XLNX_VERSAL_NR_UARTS   2
>  #define XLNX_VERSAL_NR_GEMS    2
>  #define XLNX_VERSAL_NR_ADMAS   8
> +#define XLNX_VERSAL_NR_SDS     2
>  #define XLNX_VERSAL_NR_IRQS    192
>
>  typedef struct Versal {
> @@ -58,6 +60,13 @@ typedef struct Versal {
>          } iou;
>      } lpd;
>
> +    /* The Platform Management Controller subsystem.  */
> +    struct {
> +        struct {
> +            SDHCIState sd[XLNX_VERSAL_NR_SDS];
> +        } iou;
> +    } pmc;
> +
>      struct {
>          MemoryRegion *mr_ddr;
>          uint32_t psci_conduit;
> @@ -80,6 +89,7 @@ typedef struct Versal {
>  #define VERSAL_GEM1_IRQ_0          58
>  #define VERSAL_GEM1_WAKE_IRQ_0     59
>  #define VERSAL_ADMA_IRQ_0          60
> +#define VERSAL_SD0_IRQ_0           126
>
>  /* Architecturally reserved IRQs suitable for virtualization.  */
>  #define VERSAL_RSVD_IRQ_FIRST 111
> @@ -129,6 +139,8 @@ typedef struct Versal {
>  #define MM_FPD_CRF                  0xfd1a0000U
>  #define MM_FPD_CRF_SIZE             0x140000
>
> +#define MM_PMC_SD0                  0xf1040000U
> +#define MM_PMC_SD0_SIZE             0x10000
>  #define MM_PMC_CRP                  0xf1260000U
>  #define MM_PMC_CRP_SIZE             0x10000
>  #endif
> --
> 2.20.1
>
>
^ permalink raw reply	[flat|nested] 43+ messages in thread
- * Re: [PATCH v1 08/11] hw/arm: versal: Add support for SD
  2020-04-27 18:16 ` [PATCH v1 08/11] hw/arm: versal: Add support for SD Edgar E. Iglesias
  2020-04-27 22:24   ` Alistair Francis
@ 2020-04-28  7:51   ` Philippe Mathieu-Daudé
  2020-04-29  7:28   ` Luc Michel
  2 siblings, 0 replies; 43+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-04-28  7:51 UTC (permalink / raw)
  To: Edgar E. Iglesias, qemu-devel
  Cc: figlesia, peter.maydell, sstabellini, edgar.iglesias,
	sai.pavan.boddu, frasse.iglesias, alistair, richard.henderson,
	frederic.konrad, qemu-arm, philmd, luc.michel
On 4/27/20 8:16 PM, Edgar E. Iglesias wrote:
> From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
> 
> Add support for SD.
> 
> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
> ---
>  hw/arm/xlnx-versal.c         | 31 +++++++++++++++++++++++++++++++
>  include/hw/arm/xlnx-versal.h | 12 ++++++++++++
>  2 files changed, 43 insertions(+)
> 
> diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c
> index c8a296e2e0..e263bdf77a 100644
> --- a/hw/arm/xlnx-versal.c
> +++ b/hw/arm/xlnx-versal.c
> @@ -210,6 +210,36 @@ static void versal_create_admas(Versal *s, qemu_irq *pic)
>      }
>  }
>  
> +#define SDHCI_CAPABILITIES  0x280737ec6481 /* Same as on ZynqMP.  */
> +static void versal_create_sds(Versal *s, qemu_irq *pic)
> +{
> +    int i;
> +
> +    for (i = 0; i < ARRAY_SIZE(s->pmc.iou.sd); i++) {
> +        DeviceState *dev;
> +        MemoryRegion *mr;
> +
> +        sysbus_init_child_obj(OBJECT(s), "sd[*]",
> +                              &s->pmc.iou.sd[i], sizeof(s->pmc.iou.sd[i]),
> +                              TYPE_SYSBUS_SDHCI);
> +        dev = DEVICE(&s->pmc.iou.sd[i]);
> +
> +        object_property_set_uint(OBJECT(dev),
> +                                 3, "sd-spec-version", &error_fatal);
> +        object_property_set_uint(OBJECT(dev), SDHCI_CAPABILITIES, "capareg",
> +                                 &error_fatal);
> +        object_property_set_uint(OBJECT(dev), UHS_I, "uhs", &error_fatal);
> +        qdev_init_nofail(dev);
> +
> +        mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 0);
> +        memory_region_add_subregion(&s->mr_ps,
> +                                    MM_PMC_SD0 + i * MM_PMC_SD0_SIZE, mr);
> +
> +        sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0,
> +                           pic[VERSAL_SD0_IRQ_0 + i * 2]);
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> +    }
> +}
> +
>  /* This takes the board allocated linear DDR memory and creates aliases
>   * for each split DDR range/aperture on the Versal address map.
>   */
> @@ -292,6 +322,7 @@ static void versal_realize(DeviceState *dev, Error **errp)
>      versal_create_uarts(s, pic);
>      versal_create_gems(s, pic);
>      versal_create_admas(s, pic);
> +    versal_create_sds(s, pic);
>      versal_map_ddr(s);
>      versal_unimp(s);
>  
> diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h
> index 426b66449d..e11693e29d 100644
> --- a/include/hw/arm/xlnx-versal.h
> +++ b/include/hw/arm/xlnx-versal.h
> @@ -14,6 +14,7 @@
>  
>  #include "hw/sysbus.h"
>  #include "hw/arm/boot.h"
> +#include "hw/sd/sdhci.h"
>  #include "hw/intc/arm_gicv3.h"
>  #include "hw/char/pl011.h"
>  #include "hw/dma/xlnx-zdma.h"
> @@ -26,6 +27,7 @@
>  #define XLNX_VERSAL_NR_UARTS   2
>  #define XLNX_VERSAL_NR_GEMS    2
>  #define XLNX_VERSAL_NR_ADMAS   8
> +#define XLNX_VERSAL_NR_SDS     2
>  #define XLNX_VERSAL_NR_IRQS    192
>  
>  typedef struct Versal {
> @@ -58,6 +60,13 @@ typedef struct Versal {
>          } iou;
>      } lpd;
>  
> +    /* The Platform Management Controller subsystem.  */
> +    struct {
> +        struct {
> +            SDHCIState sd[XLNX_VERSAL_NR_SDS];
> +        } iou;
> +    } pmc;
> +
>      struct {
>          MemoryRegion *mr_ddr;
>          uint32_t psci_conduit;
> @@ -80,6 +89,7 @@ typedef struct Versal {
>  #define VERSAL_GEM1_IRQ_0          58
>  #define VERSAL_GEM1_WAKE_IRQ_0     59
>  #define VERSAL_ADMA_IRQ_0          60
> +#define VERSAL_SD0_IRQ_0           126
>  
>  /* Architecturally reserved IRQs suitable for virtualization.  */
>  #define VERSAL_RSVD_IRQ_FIRST 111
> @@ -129,6 +139,8 @@ typedef struct Versal {
>  #define MM_FPD_CRF                  0xfd1a0000U
>  #define MM_FPD_CRF_SIZE             0x140000
>  
> +#define MM_PMC_SD0                  0xf1040000U
> +#define MM_PMC_SD0_SIZE             0x10000
>  #define MM_PMC_CRP                  0xf1260000U
>  #define MM_PMC_CRP_SIZE             0x10000
>  #endif
> 
^ permalink raw reply	[flat|nested] 43+ messages in thread
- * Re: [PATCH v1 08/11] hw/arm: versal: Add support for SD
  2020-04-27 18:16 ` [PATCH v1 08/11] hw/arm: versal: Add support for SD Edgar E. Iglesias
  2020-04-27 22:24   ` Alistair Francis
  2020-04-28  7:51   ` Philippe Mathieu-Daudé
@ 2020-04-29  7:28   ` Luc Michel
  2 siblings, 0 replies; 43+ messages in thread
From: Luc Michel @ 2020-04-29  7:28 UTC (permalink / raw)
  To: Edgar E. Iglesias, qemu-devel
  Cc: figlesia, peter.maydell, sstabellini, edgar.iglesias,
	sai.pavan.boddu, frasse.iglesias, alistair, richard.henderson,
	frederic.konrad, qemu-arm, philmd
On 4/27/20 8:16 PM, Edgar E. Iglesias wrote:
> From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
> 
> Add support for SD.
> 
> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
> ---
>  hw/arm/xlnx-versal.c         | 31 +++++++++++++++++++++++++++++++
>  include/hw/arm/xlnx-versal.h | 12 ++++++++++++
>  2 files changed, 43 insertions(+)
> 
> diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c
> index c8a296e2e0..e263bdf77a 100644
> --- a/hw/arm/xlnx-versal.c
> +++ b/hw/arm/xlnx-versal.c
> @@ -210,6 +210,36 @@ static void versal_create_admas(Versal *s, qemu_irq *pic)
>      }
>  }
>  
> +#define SDHCI_CAPABILITIES  0x280737ec6481 /* Same as on ZynqMP.  */
> +static void versal_create_sds(Versal *s, qemu_irq *pic)
> +{
> +    int i;
> +
> +    for (i = 0; i < ARRAY_SIZE(s->pmc.iou.sd); i++) {
> +        DeviceState *dev;
> +        MemoryRegion *mr;
> +
> +        sysbus_init_child_obj(OBJECT(s), "sd[*]",
> +                              &s->pmc.iou.sd[i], sizeof(s->pmc.iou.sd[i]),
> +                              TYPE_SYSBUS_SDHCI);
> +        dev = DEVICE(&s->pmc.iou.sd[i]);
> +
> +        object_property_set_uint(OBJECT(dev),
> +                                 3, "sd-spec-version", &error_fatal);
> +        object_property_set_uint(OBJECT(dev), SDHCI_CAPABILITIES, "capareg",
> +                                 &error_fatal);
> +        object_property_set_uint(OBJECT(dev), UHS_I, "uhs", &error_fatal);
> +        qdev_init_nofail(dev);
> +
> +        mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 0);
> +        memory_region_add_subregion(&s->mr_ps,
> +                                    MM_PMC_SD0 + i * MM_PMC_SD0_SIZE, mr);
> +
> +        sysbus_connect_irq(SYS_BUS_DEVICE(dev), 0,
> +                           pic[VERSAL_SD0_IRQ_0 + i * 2]);
> +    }
> +}
> +
>  /* This takes the board allocated linear DDR memory and creates aliases
>   * for each split DDR range/aperture on the Versal address map.
>   */
> @@ -292,6 +322,7 @@ static void versal_realize(DeviceState *dev, Error **errp)
>      versal_create_uarts(s, pic);
>      versal_create_gems(s, pic);
>      versal_create_admas(s, pic);
> +    versal_create_sds(s, pic);
>      versal_map_ddr(s);
>      versal_unimp(s);
>  
> diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h
> index 426b66449d..e11693e29d 100644
> --- a/include/hw/arm/xlnx-versal.h
> +++ b/include/hw/arm/xlnx-versal.h
> @@ -14,6 +14,7 @@
>  
>  #include "hw/sysbus.h"
>  #include "hw/arm/boot.h"
> +#include "hw/sd/sdhci.h"
>  #include "hw/intc/arm_gicv3.h"
>  #include "hw/char/pl011.h"
>  #include "hw/dma/xlnx-zdma.h"
> @@ -26,6 +27,7 @@
>  #define XLNX_VERSAL_NR_UARTS   2
>  #define XLNX_VERSAL_NR_GEMS    2
>  #define XLNX_VERSAL_NR_ADMAS   8
> +#define XLNX_VERSAL_NR_SDS     2
>  #define XLNX_VERSAL_NR_IRQS    192
>  
>  typedef struct Versal {
> @@ -58,6 +60,13 @@ typedef struct Versal {
>          } iou;
>      } lpd;
>  
> +    /* The Platform Management Controller subsystem.  */
> +    struct {
> +        struct {
> +            SDHCIState sd[XLNX_VERSAL_NR_SDS];
> +        } iou;
> +    } pmc;
> +
>      struct {
>          MemoryRegion *mr_ddr;
>          uint32_t psci_conduit;
> @@ -80,6 +89,7 @@ typedef struct Versal {
>  #define VERSAL_GEM1_IRQ_0          58
>  #define VERSAL_GEM1_WAKE_IRQ_0     59
>  #define VERSAL_ADMA_IRQ_0          60
> +#define VERSAL_SD0_IRQ_0           126
>  
>  /* Architecturally reserved IRQs suitable for virtualization.  */
>  #define VERSAL_RSVD_IRQ_FIRST 111
> @@ -129,6 +139,8 @@ typedef struct Versal {
>  #define MM_FPD_CRF                  0xfd1a0000U
>  #define MM_FPD_CRF_SIZE             0x140000
>  
> +#define MM_PMC_SD0                  0xf1040000U
> +#define MM_PMC_SD0_SIZE             0x10000
>  #define MM_PMC_CRP                  0xf1260000U
>  #define MM_PMC_CRP_SIZE             0x10000
>  #endif
> 
^ permalink raw reply	[flat|nested] 43+ messages in thread
 
- * [PATCH v1 09/11] hw/arm: versal: Add support for the RTC
  2020-04-27 18:16 [PATCH v1 00/11] hw/arm: versal: Add SD and the RTC Edgar E. Iglesias
                   ` (7 preceding siblings ...)
  2020-04-27 18:16 ` [PATCH v1 08/11] hw/arm: versal: Add support for SD Edgar E. Iglesias
@ 2020-04-27 18:16 ` Edgar E. Iglesias
  2020-04-28  8:01   ` Philippe Mathieu-Daudé
                     ` (2 more replies)
  2020-04-27 18:16 ` [PATCH v1 10/11] hw/arm: versal-virt: Add support for SD Edgar E. Iglesias
                   ` (2 subsequent siblings)
  11 siblings, 3 replies; 43+ messages in thread
From: Edgar E. Iglesias @ 2020-04-27 18:16 UTC (permalink / raw)
  To: qemu-devel
  Cc: figlesia, peter.maydell, sstabellini, edgar.iglesias,
	sai.pavan.boddu, frasse.iglesias, alistair, richard.henderson,
	frederic.konrad, qemu-arm, philmd, luc.michel
From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
hw/arm: versal: Add support for the RTC.
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
---
 hw/arm/xlnx-versal.c         | 21 +++++++++++++++++++++
 include/hw/arm/xlnx-versal.h |  8 ++++++++
 2 files changed, 29 insertions(+)
diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c
index e263bdf77a..321171bcce 100644
--- a/hw/arm/xlnx-versal.c
+++ b/hw/arm/xlnx-versal.c
@@ -240,6 +240,26 @@ static void versal_create_sds(Versal *s, qemu_irq *pic)
     }
 }
 
+static void versal_create_rtc(Versal *s, qemu_irq *pic)
+{
+    SysBusDevice *sbd;
+    MemoryRegion *mr;
+
+    sysbus_init_child_obj(OBJECT(s), "rtc", &s->pmc.rtc, sizeof(s->pmc.rtc),
+                          TYPE_XLNX_ZYNQMP_RTC);
+    sbd = SYS_BUS_DEVICE(&s->pmc.rtc);
+    qdev_init_nofail(DEVICE(sbd));
+
+    mr = sysbus_mmio_get_region(sbd, 0);
+    memory_region_add_subregion(&s->mr_ps, MM_PMC_RTC, mr);
+
+    /*
+     * TODO: Connect the ALARM and SECONDS interrupts once our RTC model
+     * supports them.
+     */
+    sysbus_connect_irq(sbd, 1, pic[VERSAL_RTC_APB_ERR_IRQ]);
+}
+
 /* This takes the board allocated linear DDR memory and creates aliases
  * for each split DDR range/aperture on the Versal address map.
  */
@@ -323,6 +343,7 @@ static void versal_realize(DeviceState *dev, Error **errp)
     versal_create_gems(s, pic);
     versal_create_admas(s, pic);
     versal_create_sds(s, pic);
+    versal_create_rtc(s, pic);
     versal_map_ddr(s);
     versal_unimp(s);
 
diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h
index e11693e29d..9c9f47ba9d 100644
--- a/include/hw/arm/xlnx-versal.h
+++ b/include/hw/arm/xlnx-versal.h
@@ -19,6 +19,7 @@
 #include "hw/char/pl011.h"
 #include "hw/dma/xlnx-zdma.h"
 #include "hw/net/cadence_gem.h"
+#include "hw/rtc/xlnx-zynqmp-rtc.h"
 
 #define TYPE_XLNX_VERSAL "xlnx-versal"
 #define XLNX_VERSAL(obj) OBJECT_CHECK(Versal, (obj), TYPE_XLNX_VERSAL)
@@ -65,6 +66,8 @@ typedef struct Versal {
         struct {
             SDHCIState sd[XLNX_VERSAL_NR_SDS];
         } iou;
+
+        XlnxZynqMPRTC rtc;
     } pmc;
 
     struct {
@@ -89,7 +92,10 @@ typedef struct Versal {
 #define VERSAL_GEM1_IRQ_0          58
 #define VERSAL_GEM1_WAKE_IRQ_0     59
 #define VERSAL_ADMA_IRQ_0          60
+#define VERSAL_RTC_APB_ERR_IRQ     121
 #define VERSAL_SD0_IRQ_0           126
+#define VERSAL_RTC_ALARM_IRQ       142
+#define VERSAL_RTC_SECONDS_IRQ     143
 
 /* Architecturally reserved IRQs suitable for virtualization.  */
 #define VERSAL_RSVD_IRQ_FIRST 111
@@ -143,4 +149,6 @@ typedef struct Versal {
 #define MM_PMC_SD0_SIZE             0x10000
 #define MM_PMC_CRP                  0xf1260000U
 #define MM_PMC_CRP_SIZE             0x10000
+#define MM_PMC_RTC                  0xf12a0000
+#define MM_PMC_RTC_SIZE             0x10000
 #endif
-- 
2.20.1
^ permalink raw reply related	[flat|nested] 43+ messages in thread
- * Re: [PATCH v1 09/11] hw/arm: versal: Add support for the RTC
  2020-04-27 18:16 ` [PATCH v1 09/11] hw/arm: versal: Add support for the RTC Edgar E. Iglesias
@ 2020-04-28  8:01   ` Philippe Mathieu-Daudé
  2020-04-28 17:51   ` Alistair Francis
  2020-04-29  7:28   ` Luc Michel
  2 siblings, 0 replies; 43+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-04-28  8:01 UTC (permalink / raw)
  To: Edgar E. Iglesias, qemu-devel
  Cc: figlesia, peter.maydell, sstabellini, edgar.iglesias,
	sai.pavan.boddu, frasse.iglesias, alistair, richard.henderson,
	frederic.konrad, qemu-arm, philmd, luc.michel
On 4/27/20 8:16 PM, Edgar E. Iglesias wrote:
> From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
> 
> hw/arm: versal: Add support for the RTC.
> 
> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
> ---
>  hw/arm/xlnx-versal.c         | 21 +++++++++++++++++++++
>  include/hw/arm/xlnx-versal.h |  8 ++++++++
>  2 files changed, 29 insertions(+)
> 
> diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c
> index e263bdf77a..321171bcce 100644
> --- a/hw/arm/xlnx-versal.c
> +++ b/hw/arm/xlnx-versal.c
> @@ -240,6 +240,26 @@ static void versal_create_sds(Versal *s, qemu_irq *pic)
>      }
>  }
>  
> +static void versal_create_rtc(Versal *s, qemu_irq *pic)
> +{
> +    SysBusDevice *sbd;
> +    MemoryRegion *mr;
> +
> +    sysbus_init_child_obj(OBJECT(s), "rtc", &s->pmc.rtc, sizeof(s->pmc.rtc),
> +                          TYPE_XLNX_ZYNQMP_RTC);
> +    sbd = SYS_BUS_DEVICE(&s->pmc.rtc);
> +    qdev_init_nofail(DEVICE(sbd));
> +
> +    mr = sysbus_mmio_get_region(sbd, 0);
> +    memory_region_add_subregion(&s->mr_ps, MM_PMC_RTC, mr);
> +
> +    /*
> +     * TODO: Connect the ALARM and SECONDS interrupts once our RTC model
> +     * supports them.
> +     */
> +    sysbus_connect_irq(sbd, 1, pic[VERSAL_RTC_APB_ERR_IRQ]);
RTC IRQ#1 is 'irq_addr_error_int', OK. Maybe worth later switching to
the qdev gpio API using qdev_init_gpio_out_named() in
hw/rtc/xlnx-zynqmp-rtc.c and then qdev_get_gpio_in_named() here.
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> +}
> +
>  /* This takes the board allocated linear DDR memory and creates aliases
>   * for each split DDR range/aperture on the Versal address map.
>   */
> @@ -323,6 +343,7 @@ static void versal_realize(DeviceState *dev, Error **errp)
>      versal_create_gems(s, pic);
>      versal_create_admas(s, pic);
>      versal_create_sds(s, pic);
> +    versal_create_rtc(s, pic);
>      versal_map_ddr(s);
>      versal_unimp(s);
>  
> diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h
> index e11693e29d..9c9f47ba9d 100644
> --- a/include/hw/arm/xlnx-versal.h
> +++ b/include/hw/arm/xlnx-versal.h
> @@ -19,6 +19,7 @@
>  #include "hw/char/pl011.h"
>  #include "hw/dma/xlnx-zdma.h"
>  #include "hw/net/cadence_gem.h"
> +#include "hw/rtc/xlnx-zynqmp-rtc.h"
>  
>  #define TYPE_XLNX_VERSAL "xlnx-versal"
>  #define XLNX_VERSAL(obj) OBJECT_CHECK(Versal, (obj), TYPE_XLNX_VERSAL)
> @@ -65,6 +66,8 @@ typedef struct Versal {
>          struct {
>              SDHCIState sd[XLNX_VERSAL_NR_SDS];
>          } iou;
> +
> +        XlnxZynqMPRTC rtc;
>      } pmc;
>  
>      struct {
> @@ -89,7 +92,10 @@ typedef struct Versal {
>  #define VERSAL_GEM1_IRQ_0          58
>  #define VERSAL_GEM1_WAKE_IRQ_0     59
>  #define VERSAL_ADMA_IRQ_0          60
> +#define VERSAL_RTC_APB_ERR_IRQ     121
>  #define VERSAL_SD0_IRQ_0           126
> +#define VERSAL_RTC_ALARM_IRQ       142
> +#define VERSAL_RTC_SECONDS_IRQ     143
>  
>  /* Architecturally reserved IRQs suitable for virtualization.  */
>  #define VERSAL_RSVD_IRQ_FIRST 111
> @@ -143,4 +149,6 @@ typedef struct Versal {
>  #define MM_PMC_SD0_SIZE             0x10000
>  #define MM_PMC_CRP                  0xf1260000U
>  #define MM_PMC_CRP_SIZE             0x10000
> +#define MM_PMC_RTC                  0xf12a0000
> +#define MM_PMC_RTC_SIZE             0x10000
>  #endif
> 
^ permalink raw reply	[flat|nested] 43+ messages in thread
- * Re: [PATCH v1 09/11] hw/arm: versal: Add support for the RTC
  2020-04-27 18:16 ` [PATCH v1 09/11] hw/arm: versal: Add support for the RTC Edgar E. Iglesias
  2020-04-28  8:01   ` Philippe Mathieu-Daudé
@ 2020-04-28 17:51   ` Alistair Francis
  2020-04-29  7:28   ` Luc Michel
  2 siblings, 0 replies; 43+ messages in thread
From: Alistair Francis @ 2020-04-28 17:51 UTC (permalink / raw)
  To: Edgar E. Iglesias
  Cc: figlesia, Peter Maydell, Edgar Iglesias, Sai Pavan Boddu,
	Francisco Iglesias, Alistair Francis, Richard Henderson,
	qemu-devel@nongnu.org Developers, KONRAD Frederic,
	Stefano Stabellini, qemu-arm, Philippe Mathieu-Daudé,
	Luc Michel
On Mon, Apr 27, 2020 at 11:23 AM Edgar E. Iglesias
<edgar.iglesias@gmail.com> wrote:
>
> From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
>
> hw/arm: versal: Add support for the RTC.
>
> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Alistair
> ---
>  hw/arm/xlnx-versal.c         | 21 +++++++++++++++++++++
>  include/hw/arm/xlnx-versal.h |  8 ++++++++
>  2 files changed, 29 insertions(+)
>
> diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c
> index e263bdf77a..321171bcce 100644
> --- a/hw/arm/xlnx-versal.c
> +++ b/hw/arm/xlnx-versal.c
> @@ -240,6 +240,26 @@ static void versal_create_sds(Versal *s, qemu_irq *pic)
>      }
>  }
>
> +static void versal_create_rtc(Versal *s, qemu_irq *pic)
> +{
> +    SysBusDevice *sbd;
> +    MemoryRegion *mr;
> +
> +    sysbus_init_child_obj(OBJECT(s), "rtc", &s->pmc.rtc, sizeof(s->pmc.rtc),
> +                          TYPE_XLNX_ZYNQMP_RTC);
> +    sbd = SYS_BUS_DEVICE(&s->pmc.rtc);
> +    qdev_init_nofail(DEVICE(sbd));
> +
> +    mr = sysbus_mmio_get_region(sbd, 0);
> +    memory_region_add_subregion(&s->mr_ps, MM_PMC_RTC, mr);
> +
> +    /*
> +     * TODO: Connect the ALARM and SECONDS interrupts once our RTC model
> +     * supports them.
> +     */
> +    sysbus_connect_irq(sbd, 1, pic[VERSAL_RTC_APB_ERR_IRQ]);
> +}
> +
>  /* This takes the board allocated linear DDR memory and creates aliases
>   * for each split DDR range/aperture on the Versal address map.
>   */
> @@ -323,6 +343,7 @@ static void versal_realize(DeviceState *dev, Error **errp)
>      versal_create_gems(s, pic);
>      versal_create_admas(s, pic);
>      versal_create_sds(s, pic);
> +    versal_create_rtc(s, pic);
>      versal_map_ddr(s);
>      versal_unimp(s);
>
> diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h
> index e11693e29d..9c9f47ba9d 100644
> --- a/include/hw/arm/xlnx-versal.h
> +++ b/include/hw/arm/xlnx-versal.h
> @@ -19,6 +19,7 @@
>  #include "hw/char/pl011.h"
>  #include "hw/dma/xlnx-zdma.h"
>  #include "hw/net/cadence_gem.h"
> +#include "hw/rtc/xlnx-zynqmp-rtc.h"
>
>  #define TYPE_XLNX_VERSAL "xlnx-versal"
>  #define XLNX_VERSAL(obj) OBJECT_CHECK(Versal, (obj), TYPE_XLNX_VERSAL)
> @@ -65,6 +66,8 @@ typedef struct Versal {
>          struct {
>              SDHCIState sd[XLNX_VERSAL_NR_SDS];
>          } iou;
> +
> +        XlnxZynqMPRTC rtc;
>      } pmc;
>
>      struct {
> @@ -89,7 +92,10 @@ typedef struct Versal {
>  #define VERSAL_GEM1_IRQ_0          58
>  #define VERSAL_GEM1_WAKE_IRQ_0     59
>  #define VERSAL_ADMA_IRQ_0          60
> +#define VERSAL_RTC_APB_ERR_IRQ     121
>  #define VERSAL_SD0_IRQ_0           126
> +#define VERSAL_RTC_ALARM_IRQ       142
> +#define VERSAL_RTC_SECONDS_IRQ     143
>
>  /* Architecturally reserved IRQs suitable for virtualization.  */
>  #define VERSAL_RSVD_IRQ_FIRST 111
> @@ -143,4 +149,6 @@ typedef struct Versal {
>  #define MM_PMC_SD0_SIZE             0x10000
>  #define MM_PMC_CRP                  0xf1260000U
>  #define MM_PMC_CRP_SIZE             0x10000
> +#define MM_PMC_RTC                  0xf12a0000
> +#define MM_PMC_RTC_SIZE             0x10000
>  #endif
> --
> 2.20.1
>
>
^ permalink raw reply	[flat|nested] 43+ messages in thread
- * Re: [PATCH v1 09/11] hw/arm: versal: Add support for the RTC
  2020-04-27 18:16 ` [PATCH v1 09/11] hw/arm: versal: Add support for the RTC Edgar E. Iglesias
  2020-04-28  8:01   ` Philippe Mathieu-Daudé
  2020-04-28 17:51   ` Alistair Francis
@ 2020-04-29  7:28   ` Luc Michel
  2 siblings, 0 replies; 43+ messages in thread
From: Luc Michel @ 2020-04-29  7:28 UTC (permalink / raw)
  To: Edgar E. Iglesias, qemu-devel
  Cc: figlesia, peter.maydell, sstabellini, edgar.iglesias,
	sai.pavan.boddu, frasse.iglesias, alistair, richard.henderson,
	frederic.konrad, qemu-arm, philmd
On 4/27/20 8:16 PM, Edgar E. Iglesias wrote:
> From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
> 
> hw/arm: versal: Add support for the RTC.
> 
> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
> ---
>  hw/arm/xlnx-versal.c         | 21 +++++++++++++++++++++
>  include/hw/arm/xlnx-versal.h |  8 ++++++++
>  2 files changed, 29 insertions(+)
> 
> diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c
> index e263bdf77a..321171bcce 100644
> --- a/hw/arm/xlnx-versal.c
> +++ b/hw/arm/xlnx-versal.c
> @@ -240,6 +240,26 @@ static void versal_create_sds(Versal *s, qemu_irq *pic)
>      }
>  }
>  
> +static void versal_create_rtc(Versal *s, qemu_irq *pic)
> +{
> +    SysBusDevice *sbd;
> +    MemoryRegion *mr;
> +
> +    sysbus_init_child_obj(OBJECT(s), "rtc", &s->pmc.rtc, sizeof(s->pmc.rtc),
> +                          TYPE_XLNX_ZYNQMP_RTC);
> +    sbd = SYS_BUS_DEVICE(&s->pmc.rtc);
> +    qdev_init_nofail(DEVICE(sbd));
> +
> +    mr = sysbus_mmio_get_region(sbd, 0);
> +    memory_region_add_subregion(&s->mr_ps, MM_PMC_RTC, mr);
> +
> +    /*
> +     * TODO: Connect the ALARM and SECONDS interrupts once our RTC model
> +     * supports them.
> +     */
> +    sysbus_connect_irq(sbd, 1, pic[VERSAL_RTC_APB_ERR_IRQ]);
> +}
> +
>  /* This takes the board allocated linear DDR memory and creates aliases
>   * for each split DDR range/aperture on the Versal address map.
>   */
> @@ -323,6 +343,7 @@ static void versal_realize(DeviceState *dev, Error **errp)
>      versal_create_gems(s, pic);
>      versal_create_admas(s, pic);
>      versal_create_sds(s, pic);
> +    versal_create_rtc(s, pic);
>      versal_map_ddr(s);
>      versal_unimp(s);
>  
> diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h
> index e11693e29d..9c9f47ba9d 100644
> --- a/include/hw/arm/xlnx-versal.h
> +++ b/include/hw/arm/xlnx-versal.h
> @@ -19,6 +19,7 @@
>  #include "hw/char/pl011.h"
>  #include "hw/dma/xlnx-zdma.h"
>  #include "hw/net/cadence_gem.h"
> +#include "hw/rtc/xlnx-zynqmp-rtc.h"
>  
>  #define TYPE_XLNX_VERSAL "xlnx-versal"
>  #define XLNX_VERSAL(obj) OBJECT_CHECK(Versal, (obj), TYPE_XLNX_VERSAL)
> @@ -65,6 +66,8 @@ typedef struct Versal {
>          struct {
>              SDHCIState sd[XLNX_VERSAL_NR_SDS];
>          } iou;
> +
> +        XlnxZynqMPRTC rtc;
>      } pmc;
>  
>      struct {
> @@ -89,7 +92,10 @@ typedef struct Versal {
>  #define VERSAL_GEM1_IRQ_0          58
>  #define VERSAL_GEM1_WAKE_IRQ_0     59
>  #define VERSAL_ADMA_IRQ_0          60
> +#define VERSAL_RTC_APB_ERR_IRQ     121
>  #define VERSAL_SD0_IRQ_0           126
> +#define VERSAL_RTC_ALARM_IRQ       142
> +#define VERSAL_RTC_SECONDS_IRQ     143
>  
>  /* Architecturally reserved IRQs suitable for virtualization.  */
>  #define VERSAL_RSVD_IRQ_FIRST 111
> @@ -143,4 +149,6 @@ typedef struct Versal {
>  #define MM_PMC_SD0_SIZE             0x10000
>  #define MM_PMC_CRP                  0xf1260000U
>  #define MM_PMC_CRP_SIZE             0x10000
> +#define MM_PMC_RTC                  0xf12a0000
> +#define MM_PMC_RTC_SIZE             0x10000
>  #endif
> 
^ permalink raw reply	[flat|nested] 43+ messages in thread
 
- * [PATCH v1 10/11] hw/arm: versal-virt: Add support for SD
  2020-04-27 18:16 [PATCH v1 00/11] hw/arm: versal: Add SD and the RTC Edgar E. Iglesias
                   ` (8 preceding siblings ...)
  2020-04-27 18:16 ` [PATCH v1 09/11] hw/arm: versal: Add support for the RTC Edgar E. Iglesias
@ 2020-04-27 18:16 ` Edgar E. Iglesias
  2020-04-28 17:54   ` Alistair Francis
  2020-04-29  7:36   ` Luc Michel
  2020-04-27 18:16 ` [PATCH v1 11/11] hw/arm: versal-virt: Add support for the RTC Edgar E. Iglesias
  2020-05-04 10:13 ` [PATCH v1 00/11] hw/arm: versal: Add SD and " Peter Maydell
  11 siblings, 2 replies; 43+ messages in thread
From: Edgar E. Iglesias @ 2020-04-27 18:16 UTC (permalink / raw)
  To: qemu-devel
  Cc: figlesia, peter.maydell, sstabellini, edgar.iglesias,
	sai.pavan.boddu, frasse.iglesias, alistair, richard.henderson,
	frederic.konrad, qemu-arm, philmd, luc.michel
From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
Add support for SD.
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
---
 hw/arm/xlnx-versal-virt.c | 46 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)
diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c
index d7be1ad494..0afee48672 100644
--- a/hw/arm/xlnx-versal-virt.c
+++ b/hw/arm/xlnx-versal-virt.c
@@ -20,6 +20,7 @@
 #include "hw/arm/sysbus-fdt.h"
 #include "hw/arm/fdt.h"
 #include "cpu.h"
+#include "hw/qdev-properties.h"
 #include "hw/arm/xlnx-versal.h"
 
 #define TYPE_XLNX_VERSAL_VIRT_MACHINE MACHINE_TYPE_NAME("xlnx-versal-virt")
@@ -256,6 +257,32 @@ static void fdt_add_zdma_nodes(VersalVirt *s)
     }
 }
 
+static void fdt_add_sd_nodes(VersalVirt *s)
+{
+    const char clocknames[] = "clk_xin\0clk_ahb";
+    const char compat[] = "arasan,sdhci-8.9a";
+    int i;
+
+    for (i = ARRAY_SIZE(s->soc.pmc.iou.sd) - 1; i >= 0; i--) {
+        uint64_t addr = MM_PMC_SD0 + MM_PMC_SD0_SIZE * i;
+        char *name = g_strdup_printf("/sdhci@%" PRIx64, addr);
+
+        qemu_fdt_add_subnode(s->fdt, name);
+
+        qemu_fdt_setprop_cells(s->fdt, name, "clocks",
+                               s->phandle.clk_25Mhz, s->phandle.clk_25Mhz);
+        qemu_fdt_setprop(s->fdt, name, "clock-names",
+                         clocknames, sizeof(clocknames));
+        qemu_fdt_setprop_cells(s->fdt, name, "interrupts",
+                               GIC_FDT_IRQ_TYPE_SPI, VERSAL_SD0_IRQ_0 + i * 2,
+                               GIC_FDT_IRQ_FLAGS_LEVEL_HI);
+        qemu_fdt_setprop_sized_cells(s->fdt, name, "reg",
+                                     2, addr, 2, MM_PMC_SD0_SIZE);
+        qemu_fdt_setprop(s->fdt, name, "compatible", compat, sizeof(compat));
+        g_free(name);
+    }
+}
+
 static void fdt_nop_memory_nodes(void *fdt, Error **errp)
 {
     Error *err = NULL;
@@ -411,10 +438,23 @@ static void create_virtio_regions(VersalVirt *s)
     }
 }
 
+static void sd_plugin_card(SDHCIState *sd, DriveInfo *di)
+{
+    BlockBackend *blk = di ? blk_by_legacy_dinfo(di) : NULL;
+    DeviceState *card;
+
+    card = qdev_create(qdev_get_child_bus(DEVICE(sd), "sd-bus"), TYPE_SD_CARD);
+    object_property_add_child(OBJECT(sd), "card[*]", OBJECT(card),
+                              &error_fatal);
+    qdev_prop_set_drive(card, "drive", blk, &error_fatal);
+    object_property_set_bool(OBJECT(card), true, "realized", &error_fatal);
+}
+
 static void versal_virt_init(MachineState *machine)
 {
     VersalVirt *s = XLNX_VERSAL_VIRT_MACHINE(machine);
     int psci_conduit = QEMU_PSCI_CONDUIT_DISABLED;
+    int i;
 
     /*
      * If the user provides an Operating System to be loaded, we expect them
@@ -455,6 +495,7 @@ static void versal_virt_init(MachineState *machine)
     fdt_add_gic_nodes(s);
     fdt_add_timer_nodes(s);
     fdt_add_zdma_nodes(s);
+    fdt_add_sd_nodes(s);
     fdt_add_cpu_nodes(s, psci_conduit);
     fdt_add_clk_node(s, "/clk125", 125000000, s->phandle.clk_125Mhz);
     fdt_add_clk_node(s, "/clk25", 25000000, s->phandle.clk_25Mhz);
@@ -464,6 +505,11 @@ static void versal_virt_init(MachineState *machine)
     memory_region_add_subregion_overlap(get_system_memory(),
                                         0, &s->soc.fpd.apu.mr, 0);
 
+    /* Plugin SD cards.  */
+    for (i = 0; i < ARRAY_SIZE(s->soc.pmc.iou.sd); i++) {
+        sd_plugin_card(&s->soc.pmc.iou.sd[i], drive_get_next(IF_SD));
+    }
+
     s->binfo.ram_size = machine->ram_size;
     s->binfo.loader_start = 0x0;
     s->binfo.get_dtb = versal_virt_get_dtb;
-- 
2.20.1
^ permalink raw reply related	[flat|nested] 43+ messages in thread
- * Re: [PATCH v1 10/11] hw/arm: versal-virt: Add support for SD
  2020-04-27 18:16 ` [PATCH v1 10/11] hw/arm: versal-virt: Add support for SD Edgar E. Iglesias
@ 2020-04-28 17:54   ` Alistair Francis
  2020-04-29  7:36   ` Luc Michel
  1 sibling, 0 replies; 43+ messages in thread
From: Alistair Francis @ 2020-04-28 17:54 UTC (permalink / raw)
  To: Edgar E. Iglesias
  Cc: figlesia, Peter Maydell, Edgar Iglesias, Sai Pavan Boddu,
	Francisco Iglesias, Alistair Francis, Richard Henderson,
	qemu-devel@nongnu.org Developers, KONRAD Frederic,
	Stefano Stabellini, qemu-arm, Philippe Mathieu-Daudé,
	Luc Michel
On Mon, Apr 27, 2020 at 11:25 AM Edgar E. Iglesias
<edgar.iglesias@gmail.com> wrote:
>
> From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
>
> Add support for SD.
>
> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Alistair
> ---
>  hw/arm/xlnx-versal-virt.c | 46 +++++++++++++++++++++++++++++++++++++++
>  1 file changed, 46 insertions(+)
>
> diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c
> index d7be1ad494..0afee48672 100644
> --- a/hw/arm/xlnx-versal-virt.c
> +++ b/hw/arm/xlnx-versal-virt.c
> @@ -20,6 +20,7 @@
>  #include "hw/arm/sysbus-fdt.h"
>  #include "hw/arm/fdt.h"
>  #include "cpu.h"
> +#include "hw/qdev-properties.h"
>  #include "hw/arm/xlnx-versal.h"
>
>  #define TYPE_XLNX_VERSAL_VIRT_MACHINE MACHINE_TYPE_NAME("xlnx-versal-virt")
> @@ -256,6 +257,32 @@ static void fdt_add_zdma_nodes(VersalVirt *s)
>      }
>  }
>
> +static void fdt_add_sd_nodes(VersalVirt *s)
> +{
> +    const char clocknames[] = "clk_xin\0clk_ahb";
> +    const char compat[] = "arasan,sdhci-8.9a";
> +    int i;
> +
> +    for (i = ARRAY_SIZE(s->soc.pmc.iou.sd) - 1; i >= 0; i--) {
> +        uint64_t addr = MM_PMC_SD0 + MM_PMC_SD0_SIZE * i;
> +        char *name = g_strdup_printf("/sdhci@%" PRIx64, addr);
> +
> +        qemu_fdt_add_subnode(s->fdt, name);
> +
> +        qemu_fdt_setprop_cells(s->fdt, name, "clocks",
> +                               s->phandle.clk_25Mhz, s->phandle.clk_25Mhz);
> +        qemu_fdt_setprop(s->fdt, name, "clock-names",
> +                         clocknames, sizeof(clocknames));
> +        qemu_fdt_setprop_cells(s->fdt, name, "interrupts",
> +                               GIC_FDT_IRQ_TYPE_SPI, VERSAL_SD0_IRQ_0 + i * 2,
> +                               GIC_FDT_IRQ_FLAGS_LEVEL_HI);
> +        qemu_fdt_setprop_sized_cells(s->fdt, name, "reg",
> +                                     2, addr, 2, MM_PMC_SD0_SIZE);
> +        qemu_fdt_setprop(s->fdt, name, "compatible", compat, sizeof(compat));
> +        g_free(name);
> +    }
> +}
> +
>  static void fdt_nop_memory_nodes(void *fdt, Error **errp)
>  {
>      Error *err = NULL;
> @@ -411,10 +438,23 @@ static void create_virtio_regions(VersalVirt *s)
>      }
>  }
>
> +static void sd_plugin_card(SDHCIState *sd, DriveInfo *di)
> +{
> +    BlockBackend *blk = di ? blk_by_legacy_dinfo(di) : NULL;
> +    DeviceState *card;
> +
> +    card = qdev_create(qdev_get_child_bus(DEVICE(sd), "sd-bus"), TYPE_SD_CARD);
> +    object_property_add_child(OBJECT(sd), "card[*]", OBJECT(card),
> +                              &error_fatal);
> +    qdev_prop_set_drive(card, "drive", blk, &error_fatal);
> +    object_property_set_bool(OBJECT(card), true, "realized", &error_fatal);
> +}
> +
>  static void versal_virt_init(MachineState *machine)
>  {
>      VersalVirt *s = XLNX_VERSAL_VIRT_MACHINE(machine);
>      int psci_conduit = QEMU_PSCI_CONDUIT_DISABLED;
> +    int i;
>
>      /*
>       * If the user provides an Operating System to be loaded, we expect them
> @@ -455,6 +495,7 @@ static void versal_virt_init(MachineState *machine)
>      fdt_add_gic_nodes(s);
>      fdt_add_timer_nodes(s);
>      fdt_add_zdma_nodes(s);
> +    fdt_add_sd_nodes(s);
>      fdt_add_cpu_nodes(s, psci_conduit);
>      fdt_add_clk_node(s, "/clk125", 125000000, s->phandle.clk_125Mhz);
>      fdt_add_clk_node(s, "/clk25", 25000000, s->phandle.clk_25Mhz);
> @@ -464,6 +505,11 @@ static void versal_virt_init(MachineState *machine)
>      memory_region_add_subregion_overlap(get_system_memory(),
>                                          0, &s->soc.fpd.apu.mr, 0);
>
> +    /* Plugin SD cards.  */
> +    for (i = 0; i < ARRAY_SIZE(s->soc.pmc.iou.sd); i++) {
> +        sd_plugin_card(&s->soc.pmc.iou.sd[i], drive_get_next(IF_SD));
> +    }
> +
>      s->binfo.ram_size = machine->ram_size;
>      s->binfo.loader_start = 0x0;
>      s->binfo.get_dtb = versal_virt_get_dtb;
> --
> 2.20.1
>
>
^ permalink raw reply	[flat|nested] 43+ messages in thread
- * Re: [PATCH v1 10/11] hw/arm: versal-virt: Add support for SD
  2020-04-27 18:16 ` [PATCH v1 10/11] hw/arm: versal-virt: Add support for SD Edgar E. Iglesias
  2020-04-28 17:54   ` Alistair Francis
@ 2020-04-29  7:36   ` Luc Michel
  1 sibling, 0 replies; 43+ messages in thread
From: Luc Michel @ 2020-04-29  7:36 UTC (permalink / raw)
  To: Edgar E. Iglesias, qemu-devel
  Cc: figlesia, peter.maydell, sstabellini, edgar.iglesias,
	sai.pavan.boddu, frasse.iglesias, alistair, richard.henderson,
	frederic.konrad, qemu-arm, philmd
On 4/27/20 8:16 PM, Edgar E. Iglesias wrote:
> From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
> 
> Add support for SD.
> 
> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
> ---
>  hw/arm/xlnx-versal-virt.c | 46 +++++++++++++++++++++++++++++++++++++++
>  1 file changed, 46 insertions(+)
> 
> diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c
> index d7be1ad494..0afee48672 100644
> --- a/hw/arm/xlnx-versal-virt.c
> +++ b/hw/arm/xlnx-versal-virt.c
> @@ -20,6 +20,7 @@
>  #include "hw/arm/sysbus-fdt.h"
>  #include "hw/arm/fdt.h"
>  #include "cpu.h"
> +#include "hw/qdev-properties.h"
>  #include "hw/arm/xlnx-versal.h"
>  
>  #define TYPE_XLNX_VERSAL_VIRT_MACHINE MACHINE_TYPE_NAME("xlnx-versal-virt")
> @@ -256,6 +257,32 @@ static void fdt_add_zdma_nodes(VersalVirt *s)
>      }
>  }
>  
> +static void fdt_add_sd_nodes(VersalVirt *s)
> +{
> +    const char clocknames[] = "clk_xin\0clk_ahb";
> +    const char compat[] = "arasan,sdhci-8.9a";
> +    int i;
> +
> +    for (i = ARRAY_SIZE(s->soc.pmc.iou.sd) - 1; i >= 0; i--) {
> +        uint64_t addr = MM_PMC_SD0 + MM_PMC_SD0_SIZE * i;
> +        char *name = g_strdup_printf("/sdhci@%" PRIx64, addr);
> +
> +        qemu_fdt_add_subnode(s->fdt, name);
> +
> +        qemu_fdt_setprop_cells(s->fdt, name, "clocks",
> +                               s->phandle.clk_25Mhz, s->phandle.clk_25Mhz);
> +        qemu_fdt_setprop(s->fdt, name, "clock-names",
> +                         clocknames, sizeof(clocknames));
> +        qemu_fdt_setprop_cells(s->fdt, name, "interrupts",
> +                               GIC_FDT_IRQ_TYPE_SPI, VERSAL_SD0_IRQ_0 + i * 2,
> +                               GIC_FDT_IRQ_FLAGS_LEVEL_HI);
> +        qemu_fdt_setprop_sized_cells(s->fdt, name, "reg",
> +                                     2, addr, 2, MM_PMC_SD0_SIZE);
> +        qemu_fdt_setprop(s->fdt, name, "compatible", compat, sizeof(compat));
> +        g_free(name);
> +    }
> +}
> +
>  static void fdt_nop_memory_nodes(void *fdt, Error **errp)
>  {
>      Error *err = NULL;
> @@ -411,10 +438,23 @@ static void create_virtio_regions(VersalVirt *s)
>      }
>  }
>  
> +static void sd_plugin_card(SDHCIState *sd, DriveInfo *di)
> +{
> +    BlockBackend *blk = di ? blk_by_legacy_dinfo(di) : NULL;
> +    DeviceState *card;
> +
> +    card = qdev_create(qdev_get_child_bus(DEVICE(sd), "sd-bus"), TYPE_SD_CARD);
> +    object_property_add_child(OBJECT(sd), "card[*]", OBJECT(card),
> +                              &error_fatal);
> +    qdev_prop_set_drive(card, "drive", blk, &error_fatal);
> +    object_property_set_bool(OBJECT(card), true, "realized", &error_fatal);
> +}
> +
>  static void versal_virt_init(MachineState *machine)
>  {
>      VersalVirt *s = XLNX_VERSAL_VIRT_MACHINE(machine);
>      int psci_conduit = QEMU_PSCI_CONDUIT_DISABLED;
> +    int i;
>  
>      /*
>       * If the user provides an Operating System to be loaded, we expect them
> @@ -455,6 +495,7 @@ static void versal_virt_init(MachineState *machine)
>      fdt_add_gic_nodes(s);
>      fdt_add_timer_nodes(s);
>      fdt_add_zdma_nodes(s);
> +    fdt_add_sd_nodes(s);
>      fdt_add_cpu_nodes(s, psci_conduit);
>      fdt_add_clk_node(s, "/clk125", 125000000, s->phandle.clk_125Mhz);
>      fdt_add_clk_node(s, "/clk25", 25000000, s->phandle.clk_25Mhz);
> @@ -464,6 +505,11 @@ static void versal_virt_init(MachineState *machine)
>      memory_region_add_subregion_overlap(get_system_memory(),
>                                          0, &s->soc.fpd.apu.mr, 0);
>  
> +    /* Plugin SD cards.  */
> +    for (i = 0; i < ARRAY_SIZE(s->soc.pmc.iou.sd); i++) {
> +        sd_plugin_card(&s->soc.pmc.iou.sd[i], drive_get_next(IF_SD));
> +    }
> +
>      s->binfo.ram_size = machine->ram_size;
>      s->binfo.loader_start = 0x0;
>      s->binfo.get_dtb = versal_virt_get_dtb;
> 
^ permalink raw reply	[flat|nested] 43+ messages in thread
 
- * [PATCH v1 11/11] hw/arm: versal-virt: Add support for the RTC
  2020-04-27 18:16 [PATCH v1 00/11] hw/arm: versal: Add SD and the RTC Edgar E. Iglesias
                   ` (9 preceding siblings ...)
  2020-04-27 18:16 ` [PATCH v1 10/11] hw/arm: versal-virt: Add support for SD Edgar E. Iglesias
@ 2020-04-27 18:16 ` Edgar E. Iglesias
  2020-04-28 17:55   ` Alistair Francis
  2020-04-29  7:57   ` Luc Michel
  2020-05-04 10:13 ` [PATCH v1 00/11] hw/arm: versal: Add SD and " Peter Maydell
  11 siblings, 2 replies; 43+ messages in thread
From: Edgar E. Iglesias @ 2020-04-27 18:16 UTC (permalink / raw)
  To: qemu-devel
  Cc: figlesia, peter.maydell, sstabellini, edgar.iglesias,
	sai.pavan.boddu, frasse.iglesias, alistair, richard.henderson,
	frederic.konrad, qemu-arm, philmd, luc.michel
From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
Add support for the RTC.
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
---
 hw/arm/xlnx-versal-virt.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c
index 0afee48672..7e749e1926 100644
--- a/hw/arm/xlnx-versal-virt.c
+++ b/hw/arm/xlnx-versal-virt.c
@@ -283,6 +283,27 @@ static void fdt_add_sd_nodes(VersalVirt *s)
     }
 }
 
+static void fdt_add_rtc_node(VersalVirt *s)
+{
+    const char compat[] = "xlnx,zynqmp-rtc";
+    const char interrupt_names[] = "alarm\0sec";
+    char *name = g_strdup_printf("/rtc@%x", MM_PMC_RTC);
+
+    qemu_fdt_add_subnode(s->fdt, name);
+
+    qemu_fdt_setprop_cells(s->fdt, name, "interrupts",
+                           GIC_FDT_IRQ_TYPE_SPI, VERSAL_RTC_ALARM_IRQ,
+                           GIC_FDT_IRQ_FLAGS_LEVEL_HI,
+                           GIC_FDT_IRQ_TYPE_SPI, VERSAL_RTC_SECONDS_IRQ,
+                           GIC_FDT_IRQ_FLAGS_LEVEL_HI);
+    qemu_fdt_setprop(s->fdt, name, "interrupt-names",
+                     interrupt_names, sizeof(interrupt_names));
+    qemu_fdt_setprop_sized_cells(s->fdt, name, "reg",
+                                 2, MM_PMC_RTC, 2, MM_PMC_RTC_SIZE);
+    qemu_fdt_setprop(s->fdt, name, "compatible", compat, sizeof(compat));
+    g_free(name);
+}
+
 static void fdt_nop_memory_nodes(void *fdt, Error **errp)
 {
     Error *err = NULL;
@@ -496,6 +517,7 @@ static void versal_virt_init(MachineState *machine)
     fdt_add_timer_nodes(s);
     fdt_add_zdma_nodes(s);
     fdt_add_sd_nodes(s);
+    fdt_add_rtc_node(s);
     fdt_add_cpu_nodes(s, psci_conduit);
     fdt_add_clk_node(s, "/clk125", 125000000, s->phandle.clk_125Mhz);
     fdt_add_clk_node(s, "/clk25", 25000000, s->phandle.clk_25Mhz);
-- 
2.20.1
^ permalink raw reply related	[flat|nested] 43+ messages in thread
- * Re: [PATCH v1 11/11] hw/arm: versal-virt: Add support for the RTC
  2020-04-27 18:16 ` [PATCH v1 11/11] hw/arm: versal-virt: Add support for the RTC Edgar E. Iglesias
@ 2020-04-28 17:55   ` Alistair Francis
  2020-04-29  7:57   ` Luc Michel
  1 sibling, 0 replies; 43+ messages in thread
From: Alistair Francis @ 2020-04-28 17:55 UTC (permalink / raw)
  To: Edgar E. Iglesias
  Cc: figlesia, Peter Maydell, Edgar Iglesias, Sai Pavan Boddu,
	Francisco Iglesias, Alistair Francis, Richard Henderson,
	qemu-devel@nongnu.org Developers, KONRAD Frederic,
	Stefano Stabellini, qemu-arm, Philippe Mathieu-Daudé,
	Luc Michel
On Mon, Apr 27, 2020 at 11:28 AM Edgar E. Iglesias
<edgar.iglesias@gmail.com> wrote:
>
> From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
>
> Add support for the RTC.
>
> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Alistair
> ---
>  hw/arm/xlnx-versal-virt.c | 22 ++++++++++++++++++++++
>  1 file changed, 22 insertions(+)
>
> diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c
> index 0afee48672..7e749e1926 100644
> --- a/hw/arm/xlnx-versal-virt.c
> +++ b/hw/arm/xlnx-versal-virt.c
> @@ -283,6 +283,27 @@ static void fdt_add_sd_nodes(VersalVirt *s)
>      }
>  }
>
> +static void fdt_add_rtc_node(VersalVirt *s)
> +{
> +    const char compat[] = "xlnx,zynqmp-rtc";
> +    const char interrupt_names[] = "alarm\0sec";
> +    char *name = g_strdup_printf("/rtc@%x", MM_PMC_RTC);
> +
> +    qemu_fdt_add_subnode(s->fdt, name);
> +
> +    qemu_fdt_setprop_cells(s->fdt, name, "interrupts",
> +                           GIC_FDT_IRQ_TYPE_SPI, VERSAL_RTC_ALARM_IRQ,
> +                           GIC_FDT_IRQ_FLAGS_LEVEL_HI,
> +                           GIC_FDT_IRQ_TYPE_SPI, VERSAL_RTC_SECONDS_IRQ,
> +                           GIC_FDT_IRQ_FLAGS_LEVEL_HI);
> +    qemu_fdt_setprop(s->fdt, name, "interrupt-names",
> +                     interrupt_names, sizeof(interrupt_names));
> +    qemu_fdt_setprop_sized_cells(s->fdt, name, "reg",
> +                                 2, MM_PMC_RTC, 2, MM_PMC_RTC_SIZE);
> +    qemu_fdt_setprop(s->fdt, name, "compatible", compat, sizeof(compat));
> +    g_free(name);
> +}
> +
>  static void fdt_nop_memory_nodes(void *fdt, Error **errp)
>  {
>      Error *err = NULL;
> @@ -496,6 +517,7 @@ static void versal_virt_init(MachineState *machine)
>      fdt_add_timer_nodes(s);
>      fdt_add_zdma_nodes(s);
>      fdt_add_sd_nodes(s);
> +    fdt_add_rtc_node(s);
>      fdt_add_cpu_nodes(s, psci_conduit);
>      fdt_add_clk_node(s, "/clk125", 125000000, s->phandle.clk_125Mhz);
>      fdt_add_clk_node(s, "/clk25", 25000000, s->phandle.clk_25Mhz);
> --
> 2.20.1
>
>
^ permalink raw reply	[flat|nested] 43+ messages in thread
- * Re: [PATCH v1 11/11] hw/arm: versal-virt: Add support for the RTC
  2020-04-27 18:16 ` [PATCH v1 11/11] hw/arm: versal-virt: Add support for the RTC Edgar E. Iglesias
  2020-04-28 17:55   ` Alistair Francis
@ 2020-04-29  7:57   ` Luc Michel
  1 sibling, 0 replies; 43+ messages in thread
From: Luc Michel @ 2020-04-29  7:57 UTC (permalink / raw)
  To: Edgar E. Iglesias, qemu-devel
  Cc: figlesia, peter.maydell, sstabellini, edgar.iglesias,
	sai.pavan.boddu, frasse.iglesias, alistair, richard.henderson,
	frederic.konrad, qemu-arm, philmd
On 4/27/20 8:16 PM, Edgar E. Iglesias wrote:
> From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
> 
> Add support for the RTC.
> 
> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
> ---
>  hw/arm/xlnx-versal-virt.c | 22 ++++++++++++++++++++++
>  1 file changed, 22 insertions(+)
> 
> diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c
> index 0afee48672..7e749e1926 100644
> --- a/hw/arm/xlnx-versal-virt.c
> +++ b/hw/arm/xlnx-versal-virt.c
> @@ -283,6 +283,27 @@ static void fdt_add_sd_nodes(VersalVirt *s)
>      }
>  }
>  
> +static void fdt_add_rtc_node(VersalVirt *s)
> +{
> +    const char compat[] = "xlnx,zynqmp-rtc";
> +    const char interrupt_names[] = "alarm\0sec";
> +    char *name = g_strdup_printf("/rtc@%x", MM_PMC_RTC);
> +
> +    qemu_fdt_add_subnode(s->fdt, name);
> +
> +    qemu_fdt_setprop_cells(s->fdt, name, "interrupts",
> +                           GIC_FDT_IRQ_TYPE_SPI, VERSAL_RTC_ALARM_IRQ,
> +                           GIC_FDT_IRQ_FLAGS_LEVEL_HI,
> +                           GIC_FDT_IRQ_TYPE_SPI, VERSAL_RTC_SECONDS_IRQ,
> +                           GIC_FDT_IRQ_FLAGS_LEVEL_HI);
> +    qemu_fdt_setprop(s->fdt, name, "interrupt-names",
> +                     interrupt_names, sizeof(interrupt_names));
> +    qemu_fdt_setprop_sized_cells(s->fdt, name, "reg",
> +                                 2, MM_PMC_RTC, 2, MM_PMC_RTC_SIZE);
> +    qemu_fdt_setprop(s->fdt, name, "compatible", compat, sizeof(compat));
> +    g_free(name);
> +}
> +
>  static void fdt_nop_memory_nodes(void *fdt, Error **errp)
>  {
>      Error *err = NULL;
> @@ -496,6 +517,7 @@ static void versal_virt_init(MachineState *machine)
>      fdt_add_timer_nodes(s);
>      fdt_add_zdma_nodes(s);
>      fdt_add_sd_nodes(s);
> +    fdt_add_rtc_node(s);
>      fdt_add_cpu_nodes(s, psci_conduit);
>      fdt_add_clk_node(s, "/clk125", 125000000, s->phandle.clk_125Mhz);
>      fdt_add_clk_node(s, "/clk25", 25000000, s->phandle.clk_25Mhz);
> 
^ permalink raw reply	[flat|nested] 43+ messages in thread
 
- * Re: [PATCH v1 00/11] hw/arm: versal: Add SD and the RTC
  2020-04-27 18:16 [PATCH v1 00/11] hw/arm: versal: Add SD and the RTC Edgar E. Iglesias
                   ` (10 preceding siblings ...)
  2020-04-27 18:16 ` [PATCH v1 11/11] hw/arm: versal-virt: Add support for the RTC Edgar E. Iglesias
@ 2020-05-04 10:13 ` Peter Maydell
  11 siblings, 0 replies; 43+ messages in thread
From: Peter Maydell @ 2020-05-04 10:13 UTC (permalink / raw)
  To: Edgar E. Iglesias
  Cc: figlesia, Edgar Iglesias, Stefano Stabellini, Sai Pavan Boddu,
	Francisco Iglesias, Alistair Francis, Richard Henderson,
	QEMU Developers, KONRAD Frederic, qemu-arm,
	Philippe Mathieu-Daudé, Luc Michel
On Mon, 27 Apr 2020 at 19:16, Edgar E. Iglesias
<edgar.iglesias@gmail.com> wrote:
>
> From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
>
> This series starts with some basic cleaning, continues with embedding
> devices into the Versal SoC (as suggested by Peter in another review).
> We then connect SD and the RTC to the Versal SoC and hook it all up
> into the Versal Virt board.
Applied to target-arm.next, thanks.
-- PMM
^ permalink raw reply	[flat|nested] 43+ messages in thread