* [Qemu-devel] [RFC PATCH v2 1/9] hw/sysbus: add helpers to register FDT aliases
2018-01-09 2:00 [Qemu-devel] [RFC PATCH v2 0/9] resolv device by Flattened Device Tree alias name Philippe Mathieu-Daudé
@ 2018-01-09 2:00 ` Philippe Mathieu-Daudé
2018-01-09 2:00 ` [Qemu-devel] [RFC PATCH v2 2/9] hw/char/cadence_uart: add " Philippe Mathieu-Daudé
` (7 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-01-09 2:00 UTC (permalink / raw)
To: Alistair Francis, Edgar E . Iglesias, Andreas Färber,
Igor Mammedov, Eduardo Habkost
Cc: Philippe Mathieu-Daudé, qemu-devel, qemu-arm
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
include/hw/sysbus-fdt.h | 18 ++++++++++++++++++
hw/core/sysbus-fdt.c | 30 ++++++++++++++++++++++++++++++
hw/core/Makefile.objs | 1 +
3 files changed, 49 insertions(+)
create mode 100644 include/hw/sysbus-fdt.h
create mode 100644 hw/core/sysbus-fdt.c
diff --git a/include/hw/sysbus-fdt.h b/include/hw/sysbus-fdt.h
new file mode 100644
index 0000000000..21f42dbbad
--- /dev/null
+++ b/include/hw/sysbus-fdt.h
@@ -0,0 +1,18 @@
+/*
+ * Flattened Device Tree alias helpers
+ *
+ * Copyright (C) 2018 Philippe Mathieu-Daudé <f4bug@amsat.org>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or
+ * (at your option) any later version. See the COPYING file in the
+ * top-level directory.
+ */
+#ifndef HW_SYSBUS_FDT_H
+#define HW_SYSBUS_FDT_H
+
+void type_register_fdt_alias(const char *name, const char *alias);
+void type_register_fdt_aliases(const char *name, const char **aliases);
+
+const char *type_resolve_fdt_alias(const char *alias);
+
+#endif /* HW_SYSBUS_FDT_H */
diff --git a/hw/core/sysbus-fdt.c b/hw/core/sysbus-fdt.c
new file mode 100644
index 0000000000..0d817ba230
--- /dev/null
+++ b/hw/core/sysbus-fdt.c
@@ -0,0 +1,30 @@
+#include "qemu/osdep.h"
+#include "hw/sysbus-fdt.h"
+
+static GHashTable *fdt_aliases(void)
+{
+ static GHashTable *fdt_aliases_singleton;
+
+ if (!fdt_aliases_singleton) {
+ fdt_aliases_singleton = g_hash_table_new(g_str_hash, g_str_equal);
+ }
+ return fdt_aliases_singleton;
+}
+
+void type_register_fdt_alias(const char *name, const char *alias)
+{
+ g_hash_table_insert(fdt_aliases(), (gpointer)name, (gpointer)name);
+ g_hash_table_insert(fdt_aliases(), (gpointer)alias, (gpointer)name);
+}
+
+void type_register_fdt_aliases(const char *name, const char **aliases)
+{
+ for (; *aliases; aliases++) {
+ type_register_fdt_alias(name, *aliases);
+ }
+}
+
+const char *type_resolve_fdt_alias(const char *alias)
+{
+ return g_hash_table_lookup(fdt_aliases(), alias);
+}
diff --git a/hw/core/Makefile.objs b/hw/core/Makefile.objs
index f8d7a4aaed..f56f0755a5 100644
--- a/hw/core/Makefile.objs
+++ b/hw/core/Makefile.objs
@@ -11,6 +11,7 @@ common-obj-$(CONFIG_EMPTY_SLOT) += empty_slot.o
common-obj-$(CONFIG_XILINX_AXI) += stream.o
common-obj-$(CONFIG_PTIMER) += ptimer.o
common-obj-$(CONFIG_SOFTMMU) += sysbus.o
+common-obj-$(CONFIG_SOFTMMU) += sysbus-fdt.o
common-obj-$(CONFIG_SOFTMMU) += machine.o
common-obj-$(CONFIG_SOFTMMU) += loader.o
common-obj-$(CONFIG_FITLOADER) += loader-fit.o
--
2.15.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [Qemu-devel] [RFC PATCH v2 2/9] hw/char/cadence_uart: add FDT aliases
2018-01-09 2:00 [Qemu-devel] [RFC PATCH v2 0/9] resolv device by Flattened Device Tree alias name Philippe Mathieu-Daudé
2018-01-09 2:00 ` [Qemu-devel] [RFC PATCH v2 1/9] hw/sysbus: add helpers to register FDT aliases Philippe Mathieu-Daudé
@ 2018-01-09 2:00 ` Philippe Mathieu-Daudé
2018-01-09 2:00 ` [Qemu-devel] [RFC PATCH v2 3/9] hw/net/cadence_gem: " Philippe Mathieu-Daudé
` (6 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-01-09 2:00 UTC (permalink / raw)
To: Alistair Francis, Edgar E . Iglesias, Andreas Färber,
Igor Mammedov, Eduardo Habkost
Cc: Philippe Mathieu-Daudé, qemu-devel, qemu-arm,
Edgar E. Iglesias, Paolo Bonzini
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
hw/char/cadence_uart.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/hw/char/cadence_uart.c b/hw/char/cadence_uart.c
index 6143494060..f164cee61d 100644
--- a/hw/char/cadence_uart.c
+++ b/hw/char/cadence_uart.c
@@ -23,6 +23,7 @@
#include "qemu/osdep.h"
#include "hw/sysbus.h"
+#include "hw/sysbus-fdt.h"
#include "chardev/char-fe.h"
#include "chardev/char-serial.h"
#include "qemu/timer.h"
@@ -560,6 +561,17 @@ static const TypeInfo cadence_uart_info = {
static void cadence_uart_register_types(void)
{
+ static const char *cadence_uart_fdt_aliases[] = {
+ "cdns.uart",
+ "cdns,uart-r1p8",
+ "xlnx,xuartps", /* Zynq-7xxx SoC */
+ "xlnx.ps7-uart",
+ "cdns,uart-r1p12",
+ "xlnx,zynqmp-uart", /* Zynq Ultrascale+ MPSoC */
+ NULL
+ };
+
+ type_register_fdt_aliases(TYPE_CADENCE_UART, cadence_uart_fdt_aliases);
type_register_static(&cadence_uart_info);
}
--
2.15.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [Qemu-devel] [RFC PATCH v2 3/9] hw/net/cadence_gem: add FDT aliases
2018-01-09 2:00 [Qemu-devel] [RFC PATCH v2 0/9] resolv device by Flattened Device Tree alias name Philippe Mathieu-Daudé
2018-01-09 2:00 ` [Qemu-devel] [RFC PATCH v2 1/9] hw/sysbus: add helpers to register FDT aliases Philippe Mathieu-Daudé
2018-01-09 2:00 ` [Qemu-devel] [RFC PATCH v2 2/9] hw/char/cadence_uart: add " Philippe Mathieu-Daudé
@ 2018-01-09 2:00 ` Philippe Mathieu-Daudé
2018-01-09 2:00 ` [Qemu-devel] [RFC PATCH v2 4/9] hw/timer/cadence_ttc: " Philippe Mathieu-Daudé
` (5 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-01-09 2:00 UTC (permalink / raw)
To: Alistair Francis, Edgar E . Iglesias, Andreas Färber,
Igor Mammedov, Eduardo Habkost
Cc: Philippe Mathieu-Daudé, qemu-devel, qemu-arm,
Edgar E. Iglesias, Jason Wang
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
hw/net/cadence_gem.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/hw/net/cadence_gem.c b/hw/net/cadence_gem.c
index 3943187572..34ff738bf7 100644
--- a/hw/net/cadence_gem.c
+++ b/hw/net/cadence_gem.c
@@ -25,6 +25,7 @@
#include "qemu/osdep.h"
#include <zlib.h> /* For crc32 */
+#include "hw/sysbus-fdt.h"
#include "hw/net/cadence_gem.h"
#include "qapi/error.h"
#include "qemu/log.h"
@@ -1552,6 +1553,15 @@ static const TypeInfo gem_info = {
static void gem_register_types(void)
{
+ static const char *gem_fdt_aliases[] = {
+ "cdns,gem",
+ "cdns,zynq-gem", /* Zynq-7xxx SoC */
+ "xlnx.ps7-ethernet",
+ "cdns,zynqmp-gem", /* Zynq Ultrascale+ MPSoC */
+ NULL
+ };
+
+ type_register_fdt_aliases(TYPE_CADENCE_GEM, gem_fdt_aliases);
type_register_static(&gem_info);
}
--
2.15.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [Qemu-devel] [RFC PATCH v2 4/9] hw/timer/cadence_ttc: add FDT aliases
2018-01-09 2:00 [Qemu-devel] [RFC PATCH v2 0/9] resolv device by Flattened Device Tree alias name Philippe Mathieu-Daudé
` (2 preceding siblings ...)
2018-01-09 2:00 ` [Qemu-devel] [RFC PATCH v2 3/9] hw/net/cadence_gem: " Philippe Mathieu-Daudé
@ 2018-01-09 2:00 ` Philippe Mathieu-Daudé
2018-01-09 2:00 ` [Qemu-devel] [RFC PATCH v2 5/9] hw/dma/axidma: add 'xlnx, eth-dma' FDT alias Philippe Mathieu-Daudé
` (4 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-01-09 2:00 UTC (permalink / raw)
To: Alistair Francis, Edgar E . Iglesias, Andreas Färber,
Igor Mammedov, Eduardo Habkost
Cc: Philippe Mathieu-Daudé, qemu-devel, qemu-arm,
Edgar E. Iglesias
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
hw/timer/cadence_ttc.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/hw/timer/cadence_ttc.c b/hw/timer/cadence_ttc.c
index 5e65fdb5a0..9aff19d3a5 100644
--- a/hw/timer/cadence_ttc.c
+++ b/hw/timer/cadence_ttc.c
@@ -18,6 +18,7 @@
#include "qemu/osdep.h"
#include "hw/sysbus.h"
+#include "hw/sysbus-fdt.h"
#include "qemu/timer.h"
#ifdef CADENCE_TTC_ERR_DEBUG
@@ -488,6 +489,13 @@ static const TypeInfo cadence_ttc_info = {
static void cadence_ttc_register_types(void)
{
+ static const char *cadence_ttc_fdt_aliases[] = {
+ "cdns.ttc", /* Zynq */
+ "xlnx.ps7-ttc", /* Zynq-7xxx SoC */
+ NULL
+ };
+
+ type_register_fdt_aliases(TYPE_CADENCE_TTC, cadence_ttc_fdt_aliases);
type_register_static(&cadence_ttc_info);
}
--
2.15.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [Qemu-devel] [RFC PATCH v2 5/9] hw/dma/axidma: add 'xlnx, eth-dma' FDT alias
2018-01-09 2:00 [Qemu-devel] [RFC PATCH v2 0/9] resolv device by Flattened Device Tree alias name Philippe Mathieu-Daudé
` (3 preceding siblings ...)
2018-01-09 2:00 ` [Qemu-devel] [RFC PATCH v2 4/9] hw/timer/cadence_ttc: " Philippe Mathieu-Daudé
@ 2018-01-09 2:00 ` Philippe Mathieu-Daudé
2018-01-09 2:00 ` [Qemu-devel] [RFC PATCH v2 6/9] hw/usb/hcd-ehci: add 'xlnx, ps7-usb' FDT aliases Philippe Mathieu-Daudé
` (3 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-01-09 2:00 UTC (permalink / raw)
To: Alistair Francis, Edgar E . Iglesias, Andreas Färber,
Igor Mammedov, Eduardo Habkost
Cc: Philippe Mathieu-Daudé, qemu-devel, qemu-arm,
Edgar E. Iglesias
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
hw/dma/xilinx_axidma.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/hw/dma/xilinx_axidma.c b/hw/dma/xilinx_axidma.c
index 9b48103574..2359d5c114 100644
--- a/hw/dma/xilinx_axidma.c
+++ b/hw/dma/xilinx_axidma.c
@@ -24,6 +24,7 @@
#include "qemu/osdep.h"
#include "hw/sysbus.h"
+#include "hw/sysbus-fdt.h"
#include "qapi/error.h"
#include "qemu/timer.h"
#include "hw/ptimer.h"
@@ -648,6 +649,7 @@ static const TypeInfo xilinx_axidma_control_stream_info = {
static void xilinx_axidma_register_types(void)
{
+ type_register_fdt_alias(TYPE_XILINX_AXI_DMA, "xlnx,eth-dma");
type_register_static(&axidma_info);
type_register_static(&xilinx_axidma_data_stream_info);
type_register_static(&xilinx_axidma_control_stream_info);
--
2.15.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [Qemu-devel] [RFC PATCH v2 6/9] hw/usb/hcd-ehci: add 'xlnx, ps7-usb' FDT aliases
2018-01-09 2:00 [Qemu-devel] [RFC PATCH v2 0/9] resolv device by Flattened Device Tree alias name Philippe Mathieu-Daudé
` (4 preceding siblings ...)
2018-01-09 2:00 ` [Qemu-devel] [RFC PATCH v2 5/9] hw/dma/axidma: add 'xlnx, eth-dma' FDT alias Philippe Mathieu-Daudé
@ 2018-01-09 2:00 ` Philippe Mathieu-Daudé
2018-01-09 2:00 ` [Qemu-devel] [RFC PATCH v2 7/9] hw/ssi/xlnx-spips: add 'xlnx.zynq-qspi' FDT alias Philippe Mathieu-Daudé
` (2 subsequent siblings)
8 siblings, 0 replies; 11+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-01-09 2:00 UTC (permalink / raw)
To: Alistair Francis, Edgar E . Iglesias, Andreas Färber,
Igor Mammedov, Eduardo Habkost
Cc: Philippe Mathieu-Daudé, qemu-devel, qemu-arm, Gerd Hoffmann
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
hw/usb/hcd-ehci-sysbus.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/hw/usb/hcd-ehci-sysbus.c b/hw/usb/hcd-ehci-sysbus.c
index 3b83beb140..0c1a995c2f 100644
--- a/hw/usb/hcd-ehci-sysbus.c
+++ b/hw/usb/hcd-ehci-sysbus.c
@@ -16,6 +16,7 @@
*/
#include "qemu/osdep.h"
+#include "hw/sysbus-fdt.h"
#include "hw/usb/hcd-ehci.h"
static const VMStateDescription vmstate_ehci_sysbus = {
@@ -244,6 +245,13 @@ static const TypeInfo ehci_fusbh200_type_info = {
static void ehci_sysbus_register_types(void)
{
+ static const char *xlnx_ehci_fdt_aliases[] = {
+ "xlnx.zynq-usb", /* Zynq */
+ "xlnx.ps7-usb", /* Zynq-7xxx SoC */
+ NULL
+ };
+
+ type_register_fdt_aliases("xlnx,ps7-usb", xlnx_ehci_fdt_aliases);
type_register_static(&ehci_type_info);
type_register_static(&ehci_xlnx_type_info);
type_register_static(&ehci_exynos4210_type_info);
--
2.15.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [Qemu-devel] [RFC PATCH v2 7/9] hw/ssi/xlnx-spips: add 'xlnx.zynq-qspi' FDT alias
2018-01-09 2:00 [Qemu-devel] [RFC PATCH v2 0/9] resolv device by Flattened Device Tree alias name Philippe Mathieu-Daudé
` (5 preceding siblings ...)
2018-01-09 2:00 ` [Qemu-devel] [RFC PATCH v2 6/9] hw/usb/hcd-ehci: add 'xlnx, ps7-usb' FDT aliases Philippe Mathieu-Daudé
@ 2018-01-09 2:00 ` Philippe Mathieu-Daudé
2018-01-09 2:00 ` [Qemu-devel] [RFC PATCH v2 8/9] hw/dma/xlnx_dpdma: add 'xlnx, axi-dpdma-1.0' " Philippe Mathieu-Daudé
2018-01-09 2:00 ` [Qemu-devel] [RFC PATCH v2 9/9] hw/arm/xlnx-zynqmp: use Linux FDT names Philippe Mathieu-Daudé
8 siblings, 0 replies; 11+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-01-09 2:00 UTC (permalink / raw)
To: Alistair Francis, Edgar E . Iglesias, Andreas Färber,
Igor Mammedov, Eduardo Habkost
Cc: Philippe Mathieu-Daudé, qemu-devel, qemu-arm,
Peter Crosthwaite
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
hw/ssi/xilinx_spips.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/hw/ssi/xilinx_spips.c b/hw/ssi/xilinx_spips.c
index d8187fadd1..9f7edc7a14 100644
--- a/hw/ssi/xilinx_spips.c
+++ b/hw/ssi/xilinx_spips.c
@@ -24,6 +24,7 @@
#include "qemu/osdep.h"
#include "hw/sysbus.h"
+#include "hw/sysbus-fdt.h"
#include "sysemu/sysemu.h"
#include "hw/ptimer.h"
#include "qemu/log.h"
@@ -1443,6 +1444,7 @@ static const TypeInfo xlnx_zynqmp_qspips_info = {
static void xilinx_spips_register_types(void)
{
+ type_register_fdt_alias(TYPE_XILINX_QSPIPS, "xlnx.zynq-qspi");
type_register_static(&xilinx_spips_info);
type_register_static(&xilinx_qspips_info);
type_register_static(&xlnx_zynqmp_qspips_info);
--
2.15.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [Qemu-devel] [RFC PATCH v2 8/9] hw/dma/xlnx_dpdma: add 'xlnx, axi-dpdma-1.0' FDT alias
2018-01-09 2:00 [Qemu-devel] [RFC PATCH v2 0/9] resolv device by Flattened Device Tree alias name Philippe Mathieu-Daudé
` (6 preceding siblings ...)
2018-01-09 2:00 ` [Qemu-devel] [RFC PATCH v2 7/9] hw/ssi/xlnx-spips: add 'xlnx.zynq-qspi' FDT alias Philippe Mathieu-Daudé
@ 2018-01-09 2:00 ` Philippe Mathieu-Daudé
2018-01-09 2:00 ` [Qemu-devel] [RFC PATCH v2 9/9] hw/arm/xlnx-zynqmp: use Linux FDT names Philippe Mathieu-Daudé
8 siblings, 0 replies; 11+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-01-09 2:00 UTC (permalink / raw)
To: Alistair Francis, Edgar E . Iglesias, Andreas Färber,
Igor Mammedov, Eduardo Habkost
Cc: Philippe Mathieu-Daudé, qemu-devel, qemu-arm,
Edgar E. Iglesias
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
hw/dma/xlnx_dpdma.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/hw/dma/xlnx_dpdma.c b/hw/dma/xlnx_dpdma.c
index 8ceb21ddb3..d1b508cfe3 100644
--- a/hw/dma/xlnx_dpdma.c
+++ b/hw/dma/xlnx_dpdma.c
@@ -24,6 +24,7 @@
#include "qemu/osdep.h"
#include "qemu/log.h"
+#include "hw/sysbus-fdt.h"
#include "hw/dma/xlnx_dpdma.h"
#ifndef DEBUG_DPDMA
@@ -607,6 +608,7 @@ static const TypeInfo xlnx_dpdma_info = {
static void xlnx_dpdma_register_types(void)
{
+ type_register_fdt_alias(TYPE_XLNX_DPDMA, "xlnx,axi-dpdma-1.0"); /* ZynqMP */
type_register_static(&xlnx_dpdma_info);
}
--
2.15.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [Qemu-devel] [RFC PATCH v2 9/9] hw/arm/xlnx-zynqmp: use Linux FDT names
2018-01-09 2:00 [Qemu-devel] [RFC PATCH v2 0/9] resolv device by Flattened Device Tree alias name Philippe Mathieu-Daudé
` (7 preceding siblings ...)
2018-01-09 2:00 ` [Qemu-devel] [RFC PATCH v2 8/9] hw/dma/xlnx_dpdma: add 'xlnx, axi-dpdma-1.0' " Philippe Mathieu-Daudé
@ 2018-01-09 2:00 ` Philippe Mathieu-Daudé
2018-01-09 9:51 ` Peter Maydell
8 siblings, 1 reply; 11+ messages in thread
From: Philippe Mathieu-Daudé @ 2018-01-09 2:00 UTC (permalink / raw)
To: Alistair Francis, Edgar E . Iglesias, Andreas Färber,
Igor Mammedov, Eduardo Habkost
Cc: Philippe Mathieu-Daudé, qemu-devel, qemu-arm,
Edgar E. Iglesias, Peter Maydell
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
hw/arm/xlnx-zynqmp.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/hw/arm/xlnx-zynqmp.c b/hw/arm/xlnx-zynqmp.c
index 325642058b..fdcd6801b6 100644
--- a/hw/arm/xlnx-zynqmp.c
+++ b/hw/arm/xlnx-zynqmp.c
@@ -24,6 +24,7 @@
#include "exec/address-spaces.h"
#include "sysemu/kvm.h"
#include "kvm_arm.h"
+#include "hw/sysbus-fdt.h"
#define GIC_NUM_SPI_INTR 160
@@ -138,6 +139,7 @@ static void xlnx_zynqmp_init(Object *obj)
XlnxZynqMPState *s = XLNX_ZYNQMP(obj);
int i;
int num_apus = MIN(smp_cpus, XLNX_ZYNQMP_NUM_APU_CPUS);
+ const char *type_name;
for (i = 0; i < num_apus; i++) {
object_initialize(&s->apu_cpu[i], sizeof(s->apu_cpu[i]),
@@ -150,12 +152,14 @@ static void xlnx_zynqmp_init(Object *obj)
qdev_set_parent_bus(DEVICE(&s->gic), sysbus_get_default());
for (i = 0; i < XLNX_ZYNQMP_NUM_GEMS; i++) {
- object_initialize(&s->gem[i], sizeof(s->gem[i]), TYPE_CADENCE_GEM);
+ type_name = type_resolve_fdt_alias("cdns,zynqmp-gem");
+ object_initialize(&s->gem[i], sizeof(s->gem[i]), type_name);
qdev_set_parent_bus(DEVICE(&s->gem[i]), sysbus_get_default());
}
for (i = 0; i < XLNX_ZYNQMP_NUM_UARTS; i++) {
- object_initialize(&s->uart[i], sizeof(s->uart[i]), TYPE_CADENCE_UART);
+ type_name = type_resolve_fdt_alias("xlnx,zynqmp-uart");
+ object_initialize(&s->uart[i], sizeof(s->uart[i]), type_name);
qdev_set_parent_bus(DEVICE(&s->uart[i]), sysbus_get_default());
}
@@ -175,13 +179,15 @@ static void xlnx_zynqmp_init(Object *obj)
qdev_set_parent_bus(DEVICE(&s->spi[i]), sysbus_get_default());
}
- object_initialize(&s->qspi, sizeof(s->qspi), TYPE_XLNX_ZYNQMP_QSPIPS);
+ type_name = type_resolve_fdt_alias("xlnx.zynq-qspi");
+ object_initialize(&s->qspi, sizeof(s->qspi), type_name);
qdev_set_parent_bus(DEVICE(&s->qspi), sysbus_get_default());
object_initialize(&s->dp, sizeof(s->dp), TYPE_XLNX_DP);
qdev_set_parent_bus(DEVICE(&s->dp), sysbus_get_default());
- object_initialize(&s->dpdma, sizeof(s->dpdma), TYPE_XLNX_DPDMA);
+ type_name = type_resolve_fdt_alias("xlnx,axi-dpdma-1.0");
+ object_initialize(&s->dpdma, sizeof(s->dpdma), type_name);
qdev_set_parent_bus(DEVICE(&s->dpdma), sysbus_get_default());
}
--
2.15.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [Qemu-devel] [RFC PATCH v2 9/9] hw/arm/xlnx-zynqmp: use Linux FDT names
2018-01-09 2:00 ` [Qemu-devel] [RFC PATCH v2 9/9] hw/arm/xlnx-zynqmp: use Linux FDT names Philippe Mathieu-Daudé
@ 2018-01-09 9:51 ` Peter Maydell
0 siblings, 0 replies; 11+ messages in thread
From: Peter Maydell @ 2018-01-09 9:51 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: Alistair Francis, Edgar E . Iglesias, Andreas Färber,
Igor Mammedov, Eduardo Habkost, QEMU Developers, qemu-arm,
Edgar E. Iglesias
On 9 January 2018 at 02:00, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> hw/arm/xlnx-zynqmp.c | 14 ++++++++++----
> 1 file changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/hw/arm/xlnx-zynqmp.c b/hw/arm/xlnx-zynqmp.c
> index 325642058b..fdcd6801b6 100644
> --- a/hw/arm/xlnx-zynqmp.c
> +++ b/hw/arm/xlnx-zynqmp.c
> @@ -24,6 +24,7 @@
> #include "exec/address-spaces.h"
> #include "sysemu/kvm.h"
> #include "kvm_arm.h"
> +#include "hw/sysbus-fdt.h"
>
> #define GIC_NUM_SPI_INTR 160
>
> @@ -138,6 +139,7 @@ static void xlnx_zynqmp_init(Object *obj)
> XlnxZynqMPState *s = XLNX_ZYNQMP(obj);
> int i;
> int num_apus = MIN(smp_cpus, XLNX_ZYNQMP_NUM_APU_CPUS);
> + const char *type_name;
>
> for (i = 0; i < num_apus; i++) {
> object_initialize(&s->apu_cpu[i], sizeof(s->apu_cpu[i]),
> @@ -150,12 +152,14 @@ static void xlnx_zynqmp_init(Object *obj)
> qdev_set_parent_bus(DEVICE(&s->gic), sysbus_get_default());
>
> for (i = 0; i < XLNX_ZYNQMP_NUM_GEMS; i++) {
> - object_initialize(&s->gem[i], sizeof(s->gem[i]), TYPE_CADENCE_GEM);
> + type_name = type_resolve_fdt_alias("cdns,zynqmp-gem");
> + object_initialize(&s->gem[i], sizeof(s->gem[i]), type_name);
> qdev_set_parent_bus(DEVICE(&s->gem[i]), sysbus_get_default());
> }
I'm having difficulty seeing the benefits of this series. We spend
patches 1-8 adding code to devices to add alias names to them,
and this means that in patch 9 we can replace a single
object_initialize() with ... two lines of code including
a runtime lookup of an alias name. Can you explain why this
is better than what we have currently?
thanks
-- PMM
^ permalink raw reply [flat|nested] 11+ messages in thread