qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Woodhouse <dwmw2@infradead.org>
To: qemu-devel@nongnu.org
Subject: [PULL 30/47] hw/arm: use qemu_configure_nic_device()
Date: Thu,  1 Feb 2024 16:43:55 +0000	[thread overview]
Message-ID: <20240201164412.785520-31-dwmw2@infradead.org> (raw)
In-Reply-To: <20240201164412.785520-1-dwmw2@infradead.org>

From: David Woodhouse <dwmw@amazon.co.uk>

Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
Reviewed-by: Thomas Huth <thuth@redhat.com>
---
 hw/arm/mps2-tz.c     |  8 ++------
 hw/arm/msf2-soc.c    |  6 +-----
 hw/arm/musicpal.c    |  3 +--
 hw/arm/xilinx_zynq.c | 11 ++++-------
 hw/arm/xlnx-versal.c |  7 +------
 hw/arm/xlnx-zynqmp.c |  8 +-------
 6 files changed, 10 insertions(+), 33 deletions(-)

diff --git a/hw/arm/mps2-tz.c b/hw/arm/mps2-tz.c
index 5d8cdc1a4c..a2d18afd79 100644
--- a/hw/arm/mps2-tz.c
+++ b/hw/arm/mps2-tz.c
@@ -503,14 +503,12 @@ static MemoryRegion *make_eth_dev(MPS2TZMachineState *mms, void *opaque,
                                   const PPCExtraData *extradata)
 {
     SysBusDevice *s;
-    NICInfo *nd = &nd_table[0];
 
     /* In hardware this is a LAN9220; the LAN9118 is software compatible
      * except that it doesn't support the checksum-offload feature.
      */
-    qemu_check_nic_model(nd, "lan9118");
     mms->lan9118 = qdev_new(TYPE_LAN9118);
-    qdev_set_nic_properties(mms->lan9118, nd);
+    qemu_configure_nic_device(mms->lan9118, true, NULL);
 
     s = SYS_BUS_DEVICE(mms->lan9118);
     sysbus_realize_and_unref(s, &error_fatal);
@@ -528,7 +526,6 @@ static MemoryRegion *make_eth_usb(MPS2TZMachineState *mms, void *opaque,
      * irqs[] is the ethernet IRQ.
      */
     SysBusDevice *s;
-    NICInfo *nd = &nd_table[0];
 
     memory_region_init(&mms->eth_usb_container, OBJECT(mms),
                        "mps2-tz-eth-usb-container", 0x200000);
@@ -537,9 +534,8 @@ static MemoryRegion *make_eth_usb(MPS2TZMachineState *mms, void *opaque,
      * In hardware this is a LAN9220; the LAN9118 is software compatible
      * except that it doesn't support the checksum-offload feature.
      */
-    qemu_check_nic_model(nd, "lan9118");
     mms->lan9118 = qdev_new(TYPE_LAN9118);
-    qdev_set_nic_properties(mms->lan9118, nd);
+    qemu_configure_nic_device(mms->lan9118, true, NULL);
 
     s = SYS_BUS_DEVICE(mms->lan9118);
     sysbus_realize_and_unref(s, &error_fatal);
diff --git a/hw/arm/msf2-soc.c b/hw/arm/msf2-soc.c
index b5fe9f364d..35bf1d64e1 100644
--- a/hw/arm/msf2-soc.c
+++ b/hw/arm/msf2-soc.c
@@ -197,12 +197,8 @@ static void m2sxxx_soc_realize(DeviceState *dev_soc, Error **errp)
         g_free(bus_name);
     }
 
-    /* FIXME use qdev NIC properties instead of nd_table[] */
-    if (nd_table[0].used) {
-        qemu_check_nic_model(&nd_table[0], TYPE_MSS_EMAC);
-        qdev_set_nic_properties(DEVICE(&s->emac), &nd_table[0]);
-    }
     dev = DEVICE(&s->emac);
+    qemu_configure_nic_device(dev, true, NULL);
     object_property_set_link(OBJECT(&s->emac), "ahb-bus",
                              OBJECT(get_system_memory()), &error_abort);
     if (!sysbus_realize(SYS_BUS_DEVICE(&s->emac), errp)) {
diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c
index 0fe0160b48..2020f73a57 100644
--- a/hw/arm/musicpal.c
+++ b/hw/arm/musicpal.c
@@ -1277,9 +1277,8 @@ static void musicpal_init(MachineState *machine)
     }
     sysbus_create_simple(TYPE_MV88W8618_FLASHCFG, MP_FLASHCFG_BASE, NULL);
 
-    qemu_check_nic_model(&nd_table[0], "mv88w8618");
     dev = qdev_new(TYPE_MV88W8618_ETH);
-    qdev_set_nic_properties(dev, &nd_table[0]);
+    qemu_configure_nic_device(dev, true, "mv88w8618");
     object_property_set_link(OBJECT(dev), "dma-memory",
                              OBJECT(get_system_memory()), &error_fatal);
     sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
diff --git a/hw/arm/xilinx_zynq.c b/hw/arm/xilinx_zynq.c
index 66d0de139f..35fa804b7d 100644
--- a/hw/arm/xilinx_zynq.c
+++ b/hw/arm/xilinx_zynq.c
@@ -109,16 +109,13 @@ static void zynq_write_board_setup(ARMCPU *cpu,
 
 static struct arm_boot_info zynq_binfo = {};
 
-static void gem_init(NICInfo *nd, uint32_t base, qemu_irq irq)
+static void gem_init(uint32_t base, qemu_irq irq)
 {
     DeviceState *dev;
     SysBusDevice *s;
 
     dev = qdev_new(TYPE_CADENCE_GEM);
-    if (nd->used) {
-        qemu_check_nic_model(nd, TYPE_CADENCE_GEM);
-        qdev_set_nic_properties(dev, nd);
-    }
+    qemu_configure_nic_device(dev, true, NULL);
     object_property_set_int(OBJECT(dev), "phy-addr", 7, &error_abort);
     s = SYS_BUS_DEVICE(dev);
     sysbus_realize_and_unref(s, &error_fatal);
@@ -280,8 +277,8 @@ static void zynq_init(MachineState *machine)
     sysbus_create_varargs("cadence_ttc", 0xF8002000,
             pic[69-IRQ_OFFSET], pic[70-IRQ_OFFSET], pic[71-IRQ_OFFSET], NULL);
 
-    gem_init(&nd_table[0], 0xE000B000, pic[54-IRQ_OFFSET]);
-    gem_init(&nd_table[1], 0xE000C000, pic[77-IRQ_OFFSET]);
+    gem_init(0xE000B000, pic[54 - IRQ_OFFSET]);
+    gem_init(0xE000C000, pic[77 - IRQ_OFFSET]);
 
     for (n = 0; n < 2; n++) {
         int hci_irq = n ? 79 : 56;
diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c
index 2798df3730..50cb0606cb 100644
--- a/hw/arm/xlnx-versal.c
+++ b/hw/arm/xlnx-versal.c
@@ -256,18 +256,13 @@ static void versal_create_gems(Versal *s, qemu_irq *pic)
         static const int irqs[] = { VERSAL_GEM0_IRQ_0, VERSAL_GEM1_IRQ_0};
         static const uint64_t addrs[] = { MM_GEM0, MM_GEM1 };
         char *name = g_strdup_printf("gem%d", i);
-        NICInfo *nd = &nd_table[i];
         DeviceState *dev;
         MemoryRegion *mr;
 
         object_initialize_child(OBJECT(s), name, &s->lpd.iou.gem[i],
                                 TYPE_CADENCE_GEM);
         dev = DEVICE(&s->lpd.iou.gem[i]);
-        /* FIXME use qdev NIC properties instead of nd_table[] */
-        if (nd->used) {
-            qemu_check_nic_model(nd, "cadence_gem");
-            qdev_set_nic_properties(dev, nd);
-        }
+        qemu_configure_nic_device(dev, true, NULL);
         object_property_set_int(OBJECT(dev), "phy-addr", 23, &error_abort);
         object_property_set_int(OBJECT(dev), "num-priority-queues", 2,
                                 &error_abort);
diff --git a/hw/arm/xlnx-zynqmp.c b/hw/arm/xlnx-zynqmp.c
index 65901c6e74..afeb3f88f8 100644
--- a/hw/arm/xlnx-zynqmp.c
+++ b/hw/arm/xlnx-zynqmp.c
@@ -618,13 +618,7 @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp)
     }
 
     for (i = 0; i < XLNX_ZYNQMP_NUM_GEMS; i++) {
-        NICInfo *nd = &nd_table[i];
-
-        /* FIXME use qdev NIC properties instead of nd_table[] */
-        if (nd->used) {
-            qemu_check_nic_model(nd, TYPE_CADENCE_GEM);
-            qdev_set_nic_properties(DEVICE(&s->gem[i]), nd);
-        }
+        qemu_configure_nic_device(DEVICE(&s->gem[i]), true, NULL);
         object_property_set_int(OBJECT(&s->gem[i]), "revision", GEM_REVISION,
                                 &error_abort);
         object_property_set_int(OBJECT(&s->gem[i]), "phy-addr", 23,
-- 
2.43.0



  parent reply	other threads:[~2024-02-01 16:49 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-01 16:43 [PULL 00/47] nic-config.for-upstream queue David Woodhouse
2024-02-01 16:43 ` [PULL 01/47] net: add qemu_{configure, create}_nic_device(), qemu_find_nic_info() David Woodhouse
2024-02-01 16:43 ` [PULL 02/47] net: report list of available models according to platform David Woodhouse
2024-02-01 16:43 ` [PULL 03/47] net: add qemu_create_nic_bus_devices() David Woodhouse
2024-02-01 16:43 ` [PULL 04/47] hw/pci: add pci_init_nic_devices(), pci_init_nic_in_slot() David Woodhouse
2024-02-01 16:43 ` [PULL 05/47] hw/i386/pc: use qemu_get_nic_info() and pci_init_nic_devices() David Woodhouse
2024-02-01 16:43 ` [PULL 06/47] hw/xen: use qemu_create_nic_bus_devices() to instantiate Xen NICs David Woodhouse
2024-02-01 16:43 ` [PULL 07/47] hw/alpha/dp264: use pci_init_nic_devices() David Woodhouse
2024-02-01 16:43 ` [PULL 08/47] hw/arm/sbsa-ref: " David Woodhouse
2024-02-01 16:43 ` [PULL 09/47] hw/arm/virt: " David Woodhouse
2024-02-01 16:43 ` [PULL 10/47] hw/hppa: " David Woodhouse
2024-02-01 16:43 ` [PULL 11/47] hw/loongarch: " David Woodhouse
2024-02-01 16:43 ` [PULL 12/47] hw/mips/fuloong2e: " David Woodhouse
2024-02-01 16:43 ` [PULL 13/47] hw/mips/malta: " David Woodhouse
2024-02-01 16:43 ` [PULL 14/47] hw/mips/loongson3_virt: " David Woodhouse
2024-02-01 16:43 ` [PULL 15/47] hw/ppc/prep: " David Woodhouse
2024-02-01 16:43 ` [PULL 16/47] hw/ppc/spapr: use qemu_get_nic_info() and pci_init_nic_devices() David Woodhouse
2024-02-01 16:43 ` [PULL 17/47] hw/ppc: use pci_init_nic_devices() David Woodhouse
2024-02-01 16:43 ` [PULL 18/47] hw/sh4/r2d: " David Woodhouse
2024-02-01 16:43 ` [PULL 19/47] hw/sparc64/sun4u: " David Woodhouse
2024-02-01 16:43 ` [PULL 20/47] hw/xtensa/virt: " David Woodhouse
2024-02-01 16:43 ` [PULL 21/47] hw/arm/allwinner: use qemu_configure_nic_device() David Woodhouse
2024-02-01 16:43 ` [PULL 22/47] hw/arm/aspeed: " David Woodhouse
2024-02-01 16:43 ` [PULL 23/47] hw/arm/exynos4: use qemu_create_nic_device() David Woodhouse
2024-02-01 16:43 ` [PULL 24/47] hw/arm/fsl: use qemu_configure_nic_device() David Woodhouse
2024-02-01 16:43 ` [PULL 25/47] hw/net/smc91c111: " David Woodhouse
2024-02-01 16:43 ` [PULL 26/47] hw/net/lan9118: " David Woodhouse
2024-02-01 16:43 ` [PULL 27/47] hw/arm/highbank: use qemu_create_nic_device() David Woodhouse
2024-02-01 16:43 ` [PULL 28/47] hw/arm/npcm7xx: use qemu_configure_nic_device, allow emc0/emc1 as aliases David Woodhouse
2024-02-01 16:43 ` [PULL 29/47] hw/arm/stellaris: use qemu_find_nic_info() David Woodhouse
2024-02-01 16:43 ` David Woodhouse [this message]
2024-02-01 16:43 ` [PULL 31/47] hw/net/etraxfs-eth: use qemu_configure_nic_device() David Woodhouse
2024-02-01 16:43 ` [PULL 32/47] hw/m68k/mcf5208: use qemu_create_nic_device() David Woodhouse
2024-02-01 16:43 ` [PULL 33/47] hw/m68k/q800: use qemu_find_nic_info() David Woodhouse
2024-02-01 16:43 ` [PULL 34/47] hw/microblaze: use qemu_configure_nic_device() David Woodhouse
2024-02-01 16:44 ` [PULL 35/47] hw/mips/mipssim: use qemu_create_nic_device() David Woodhouse
2024-02-01 16:44 ` [PULL 36/47] hw/mips/jazz: use qemu_find_nic_info() David Woodhouse
2024-02-01 16:44 ` [PULL 37/47] hw/net/lasi_i82596: Re-enable build David Woodhouse
2024-02-01 16:44 ` [PULL 38/47] hw/net/lasi_i82596: use qemu_create_nic_device() David Woodhouse
2024-02-01 16:44 ` [PULL 39/47] hw/openrisc/openrisc_sim: " David Woodhouse
2024-02-01 16:44 ` [PULL 40/47] hw/riscv: use qemu_configure_nic_device() David Woodhouse
2024-02-01 16:44 ` [PULL 41/47] hw/s390x/s390-virtio-ccw: use qemu_create_nic_device() David Woodhouse
2024-02-01 16:44 ` [PULL 42/47] hw/sparc/sun4m: use qemu_find_nic_info() David Woodhouse
2024-02-01 16:44 ` [PULL 43/47] hw/xtensa/xtfpga: use qemu_create_nic_device() David Woodhouse
2024-02-01 16:44 ` [PULL 44/47] net: remove qemu_check_nic_model() David Woodhouse
2024-02-01 16:44 ` [PULL 45/47] hw/pci: remove pci_nic_init_nofail() David Woodhouse
2024-02-01 16:44 ` [PULL 46/47] net: remove qemu_show_nic_models(), qemu_find_nic_model() David Woodhouse
2024-02-01 16:44 ` [PULL 47/47] net: make nb_nics and nd_table[] static in net/net.c David Woodhouse
2024-02-02 15:32 ` [PULL 00/47] nic-config.for-upstream queue Peter Maydell
2024-02-02 15:36   ` David Woodhouse
2024-02-02 15:40     ` Peter Maydell
2024-02-05  6:56       ` Thomas Huth
2024-02-05 10:11         ` Thomas Huth
2024-02-05 10:55           ` Peter Maydell
2024-02-02 16:01   ` David Woodhouse
2024-02-02 16:15     ` Peter Maydell
2024-02-02 17:01       ` David Woodhouse

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240201164412.785520-31-dwmw2@infradead.org \
    --to=dwmw2@infradead.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).