Skip to contentSkip to conversation

hw/net: Convert network devices to Resettable interface

PATCH New Oscar Alejandro Sánchez Lucero 1 participant 18 messages Dec 3 Arm/Zynq architecture

lore
Share & tools
lore
#0 lore raw

cover hw/net: Convert network devices to Resettable interface

Convert standalone network controllers in hw/net/ from the deprecated device_class_set_legacy_reset() API to the three-phase Resettable interface by implementing the hold phase.

---
Oscar Alejandro Sánchez Lucero (17):
hw/net/cadence_gem: Convert to Resettable interface hw/net/dp8393x: Convert to Resettable interface hw/net/fsl_etsec/etsec: Convert to Resettable interface hw/net/lance: Convert to Resettable interface hw/net/lasi_i82596: Convert to Resettable interface hw/net/msf2-emac: Convert to Resettable interface hw/net/npcm7xx_emc: Convert to Resettable interface hw/net/npcm_gmac: Convert to Resettable interface hw/net/opencores_eth: Convert to Resettable interface hw/net/pcnet-pci: Convert to Resettable interface hw/net/stellaris_enet: Convert to Resettable interface hw/net/sungem: Convert to Resettable interface hw/net/sunhme: Convert to Resettable interface hw/net/tulip: Convert to Resettable interface hw/net/vmxnet3: Convert to Resettable interface hw/net/xilinx_axienet: Convert to Resettable interface hw/net/xilinx_ethlite: Convert to Resettable interface

 hw/net/cadence_gem.c     | 7 ++++---
 hw/net/dp8393x.c         | 7 ++++---
 hw/net/fsl_etsec/etsec.c | 7 ++++---
 hw/net/lance.c           | 7 ++++---
 hw/net/lasi_i82596.c     | 7 ++++---
 hw/net/msf2-emac.c       | 7 ++++---
 hw/net/npcm7xx_emc.c     | 7 ++++---
 hw/net/npcm_gmac.c       | 7 ++++---
 hw/net/opencores_eth.c   | 7 ++++---
 hw/net/pcnet-pci.c       | 7 ++++---
 hw/net/stellaris_enet.c  | 7 ++++---
 hw/net/sungem.c          | 7 ++++---
 hw/net/sunhme.c          | 7 ++++---
 hw/net/tulip.c           | 7 ++++---
 hw/net/vmxnet3.c         | 7 ++++---
 hw/net/xilinx_axienet.c  | 7 ++++---
 hw/net/xilinx_ethlite.c  | 7 ++++---
 17 files changed, 68 insertions(+), 51 deletions(-)

---
base-commit: 3c061218fcf37a98c944ecb88cff56f94f5c0a43
change-id: 20261202-net-resettable-1-1a3b8d9ad3ca

Best regards,

Signature · 1 line
Oscar Alejandro Sánchez Lucero <[email protected]>
#1 lore raw

PATCH 1/17 hw/net/cadence_gem: Convert to Resettable interface

Replace the deprecated device_class_set_legacy_reset() with the Resettable interface by implementing the hold phase in gem_reset_hold().

---
 hw/net/cadence_gem.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
hw/net/cadence_gem.c +4 -3
index 7456f0e18e..d7e510d259 100644
@@ -1471,10 +1471,10 @@ static void gem_phy_reset(CadenceGEMState *s)
     phy_update_link(s);
 }
 
-static void gem_reset(DeviceState *d)
+static void gem_reset_hold(Object *obj, ResetType type)
 {
     int i;
-    CadenceGEMState *s = CADENCE_GEM(d);
+    CadenceGEMState *s = CADENCE_GEM(obj);
     const uint8_t *a;
     uint32_t queues_mask = 0;
 
@@ -1878,11 +1878,12 @@ static const Property gem_properties[] = {
 static void gem_class_init(ObjectClass *klass, const void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
+    ResettableClass *rc = RESETTABLE_CLASS(klass);
 
     dc->realize = gem_realize;
     device_class_set_props(dc, gem_properties);
     dc->vmsd = &vmstate_cadence_gem;
-    device_class_set_legacy_reset(dc, gem_reset);
+    rc->phases.hold = gem_reset_hold;
 }
 
 static const TypeInfo gem_info = {
Signature · 1 line
2.53.0
#2 lore raw

PATCH 2/17 hw/net/dp8393x: Convert to Resettable interface

In reply to Oscar Alejandro Sánchez Lucero

Replace the deprecated device_class_set_legacy_reset() with the Resettable interface by implementing the hold phase in dp8393x_reset_hold().

---
 hw/net/dp8393x.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
hw/net/dp8393x.c +4 -3
index 5b611fcbbe..ff44f649e9 100644
@@ -861,9 +861,9 @@ done:
     return pkt_size;
 }
 
-static void dp8393x_reset(DeviceState *dev)
+static void dp8393x_reset_hold(Object *obj, ResetType type)
 {
-    dp8393xState *s = DP8393X(dev);
+    dp8393xState *s = DP8393X(obj);
     timer_del(s->watchdog);
 
     memset(s->regs, 0, sizeof(s->regs));
@@ -942,10 +942,11 @@ static const Property dp8393x_properties[] = {
 static void dp8393x_class_init(ObjectClass *klass, const void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
+    ResettableClass *rc = RESETTABLE_CLASS(klass);
 
     set_bit(DEVICE_CATEGORY_NETWORK, dc->categories);
     dc->realize = dp8393x_realize;
-    device_class_set_legacy_reset(dc, dp8393x_reset);
+    rc->phases.hold = dp8393x_reset_hold;
     dc->vmsd = &vmstate_dp8393x;
     device_class_set_props(dc, dp8393x_properties);
 }
Signature · 1 line
2.53.0
#3 lore raw

PATCH 3/17 hw/net/fsl_etsec/etsec: Convert to Resettable interface

In reply to Oscar Alejandro Sánchez Lucero

Replace the deprecated device_class_set_legacy_reset() with the Resettable interface by implementing the hold phase in etsec_reset_hold().

---
 hw/net/fsl_etsec/etsec.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
hw/net/fsl_etsec/etsec.c +4 -3
index 1d61d918b8..1f4108caf7 100644
@@ -308,9 +308,9 @@ static void etsec_timer_hit(void *opaque)
     }
 }
 
-static void etsec_reset(DeviceState *d)
+static void etsec_reset_hold(Object *obj, ResetType type)
 {
-    eTSEC *etsec = ETSEC_COMMON(d);
+    eTSEC *etsec = ETSEC_COMMON(obj);
     int i = 0;
     int reg_index = 0;
 
@@ -422,10 +422,11 @@ static const Property etsec_properties[] = {
 static void etsec_class_init(ObjectClass *klass, const void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
+    ResettableClass *rc = RESETTABLE_CLASS(klass);
 
     dc->realize = etsec_realize;
     dc->desc = "Freescale Enhanced Three-Speed Ethernet Controller";
-    device_class_set_legacy_reset(dc, etsec_reset);
+    rc->phases.hold = etsec_reset_hold;
     device_class_set_props(dc, etsec_properties);
     set_bit(DEVICE_CATEGORY_NETWORK, dc->categories);
 }
Signature · 1 line
2.53.0
#4 lore raw

PATCH 4/17 hw/net/lance: Convert to Resettable interface

In reply to Oscar Alejandro Sánchez Lucero

Replace the deprecated device_class_set_legacy_reset() with the Resettable interface by implementing the hold phase in lance_reset_hold().

---
 hw/net/lance.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
hw/net/lance.c +4 -3
index 5d5bf9b961..53504fb981 100644
@@ -120,9 +120,9 @@ static void lance_realize(DeviceState *dev, Error **errp)
     pcnet_common_init(dev, s, &net_lance_info);
 }
 
-static void lance_reset(DeviceState *dev)
+static void lance_reset_hold(Object *obj, ResetType type)
 {
-    SysBusPCNetState *d = SYSBUS_PCNET(dev);
+    SysBusPCNetState *d = SYSBUS_PCNET(obj);
 
     pcnet_h_reset(&d->state);
 }
@@ -146,11 +146,12 @@ static const Property lance_properties[] = {
 static void lance_class_init(ObjectClass *klass, const void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
+    ResettableClass *rc = RESETTABLE_CLASS(klass);
 
     dc->realize = lance_realize;
     set_bit(DEVICE_CATEGORY_NETWORK, dc->categories);
     dc->fw_name = "ethernet";
-    device_class_set_legacy_reset(dc, lance_reset);
+    rc->phases.hold = lance_reset_hold;
     dc->vmsd = &vmstate_lance;
     device_class_set_props(dc, lance_properties);
 }
Signature · 1 line
2.53.0
#5 lore raw

PATCH 5/17 hw/net/lasi_i82596: Convert to Resettable interface

In reply to Oscar Alejandro Sánchez Lucero

Replace the deprecated device_class_set_legacy_reset() with the Resettable interface by implementing the hold phase in lasi_82596_reset_hold().

---
 hw/net/lasi_i82596.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
hw/net/lasi_i82596.c +4 -3
index 5df1a59617..ca4ffbaacf 100644
@@ -127,9 +127,9 @@ static void lasi_82596_realize(DeviceState *dev, Error **errp)
     i82596_common_init(dev, s, &net_lasi_82596_info);
 }
 
-static void lasi_82596_reset(DeviceState *dev)
+static void lasi_82596_reset_hold(Object *obj, ResetType type)
 {
-    SysBusI82596State *d = SYSBUS_I82596(dev);
+    SysBusI82596State *d = SYSBUS_I82596(obj);
 
     i82596_h_reset(&d->state);
 }
@@ -155,11 +155,12 @@ static const Property lasi_82596_properties[] = {
 static void lasi_82596_class_init(ObjectClass *klass, const void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
+    ResettableClass *rc = RESETTABLE_CLASS(klass);
 
     dc->realize = lasi_82596_realize;
     set_bit(DEVICE_CATEGORY_NETWORK, dc->categories);
     dc->fw_name = "ethernet";
-    device_class_set_legacy_reset(dc, lasi_82596_reset);
+    rc->phases.hold = lasi_82596_reset_hold;
     dc->vmsd = &vmstate_lasi_82596;
     dc->user_creatable = false;
     device_class_set_props(dc, lasi_82596_properties);
Signature · 1 line
2.53.0
#6 lore raw

PATCH 6/17 hw/net/msf2-emac: Convert to Resettable interface

In reply to Oscar Alejandro Sánchez Lucero

Replace the deprecated device_class_set_legacy_reset() with the Resettable interface by implementing the hold phase in msf2_emac_reset_hold().

---
 hw/net/msf2-emac.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
hw/net/msf2-emac.c +4 -3
index 077485c95d..f3bf31d509 100644
@@ -495,9 +495,9 @@ static ssize_t emac_rx(NetClientState *nc, const uint8_t *buf, size_t size)
     return size;
 }
 
-static void msf2_emac_reset(DeviceState *dev)
+static void msf2_emac_reset_hold(Object *obj, ResetType type)
 {
-    MSF2EmacState *s = MSS_EMAC(dev);
+    MSF2EmacState *s = MSS_EMAC(obj);
 
     msf2_emac_do_reset(s);
 }
@@ -568,9 +568,10 @@ static const VMStateDescription vmstate_msf2_emac = {
 static void msf2_emac_class_init(ObjectClass *klass, const void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
+    ResettableClass *rc = RESETTABLE_CLASS(klass);
 
     dc->realize = msf2_emac_realize;
-    device_class_set_legacy_reset(dc, msf2_emac_reset);
+    rc->phases.hold = msf2_emac_reset_hold;
     dc->vmsd = &vmstate_msf2_emac;
     device_class_set_props(dc, msf2_emac_properties);
 }
Signature · 1 line
2.53.0
#7 lore raw

PATCH 7/17 hw/net/npcm7xx_emc: Convert to Resettable interface

In reply to Oscar Alejandro Sánchez Lucero

Replace the deprecated device_class_set_legacy_reset() with the Resettable interface by implementing the hold phase in npcm7xx_emc_reset_hold().

---
 hw/net/npcm7xx_emc.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
hw/net/npcm7xx_emc.c +4 -3
index 4105e89429..65951608c9 100644
@@ -125,9 +125,9 @@ static void emc_reset(NPCM7xxEMCState *emc)
     emc->regs[REG_CAML_BASE] = value;
 }
 
-static void npcm7xx_emc_reset(DeviceState *dev)
+static void npcm7xx_emc_reset_hold(Object *obj, ResetType type)
 {
-    NPCM7xxEMCState *emc = NPCM7XX_EMC(dev);
+    NPCM7xxEMCState *emc = NPCM7XX_EMC(obj);
     emc_reset(emc);
 }
 
@@ -852,12 +852,13 @@ static const Property npcm7xx_emc_properties[] = {
 static void npcm7xx_emc_class_init(ObjectClass *klass, const void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
+    ResettableClass *rc = RESETTABLE_CLASS(klass);
 
     set_bit(DEVICE_CATEGORY_NETWORK, dc->categories);
     dc->desc = "NPCM7xx EMC Controller";
     dc->realize = npcm7xx_emc_realize;
     dc->unrealize = npcm7xx_emc_unrealize;
-    device_class_set_legacy_reset(dc, npcm7xx_emc_reset);
+    rc->phases.hold = npcm7xx_emc_reset_hold;
     dc->vmsd = &vmstate_npcm7xx_emc;
     device_class_set_props(dc, npcm7xx_emc_properties);
 }
Signature · 1 line
2.53.0
#8 lore raw

PATCH 8/17 hw/net/npcm_gmac: Convert to Resettable interface

In reply to Oscar Alejandro Sánchez Lucero

Replace the deprecated device_class_set_legacy_reset() with the Resettable interface by implementing the hold phase in npcm_gmac_reset_hold().

---
 hw/net/npcm_gmac.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
hw/net/npcm_gmac.c +4 -3
index d9902d9ab5..045cfb4548 100644
@@ -853,9 +853,9 @@ static void npcm_gmac_write(void *opaque, hwaddr offset,
     gmac_update_irq(gmac);
 }
 
-static void npcm_gmac_reset(DeviceState *dev)
+static void npcm_gmac_reset_hold(Object *obj, ResetType type)
 {
-    NPCMGMACState *gmac = NPCM_GMAC(dev);
+    NPCMGMACState *gmac = NPCM_GMAC(obj);
 
     npcm_gmac_soft_reset(gmac);
     memcpy(gmac->phy_regs[0], phy_reg_init, sizeof(phy_reg_init));
@@ -931,12 +931,13 @@ static const Property npcm_gmac_properties[] = {
 static void npcm_gmac_class_init(ObjectClass *klass, const void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
+    ResettableClass *rc = RESETTABLE_CLASS(klass);
 
     set_bit(DEVICE_CATEGORY_NETWORK, dc->categories);
     dc->desc = "NPCM GMAC Controller";
     dc->realize = npcm_gmac_realize;
     dc->unrealize = npcm_gmac_unrealize;
-    device_class_set_legacy_reset(dc, npcm_gmac_reset);
+    rc->phases.hold = npcm_gmac_reset_hold;
     dc->vmsd = &vmstate_npcm_gmac;
     device_class_set_props(dc, npcm_gmac_properties);
 }
Signature · 1 line
2.53.0
#9 lore raw

PATCH 9/17 hw/net/opencores_eth: Convert to Resettable interface

In reply to Oscar Alejandro Sánchez Lucero

Replace the deprecated device_class_set_legacy_reset() with the Resettable interface by implementing the hold phase in qdev_open_eth_reset_hold().

---
 hw/net/opencores_eth.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
hw/net/opencores_eth.c +4 -3
index 5a07bcde09..fc304640bb 100644
@@ -741,9 +741,9 @@ static void sysbus_open_eth_realize(DeviceState *dev, Error **errp)
                           &dev->mem_reentrancy_guard, s);
 }
 
-static void qdev_open_eth_reset(DeviceState *dev)
+static void qdev_open_eth_reset_hold(Object *obj, ResetType type)
 {
-    OpenEthState *d = OPEN_ETH(dev);
+    OpenEthState *d = OPEN_ETH(obj);
 
     open_eth_reset(d);
 }
@@ -755,11 +755,12 @@ static const Property open_eth_properties[] = {
 static void open_eth_class_init(ObjectClass *klass, const void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
+    ResettableClass *rc = RESETTABLE_CLASS(klass);
 
     dc->realize = sysbus_open_eth_realize;
     set_bit(DEVICE_CATEGORY_NETWORK, dc->categories);
     dc->desc = "Opencores 10/100 Mbit Ethernet";
-    device_class_set_legacy_reset(dc, qdev_open_eth_reset);
+    rc->phases.hold = qdev_open_eth_reset_hold;
     device_class_set_props(dc, open_eth_properties);
 }
 
Signature · 1 line
2.53.0
#10 lore raw

PATCH 10/17 hw/net/pcnet-pci: Convert to Resettable interface

In reply to Oscar Alejandro Sánchez Lucero

Replace the deprecated device_class_set_legacy_reset() with the Resettable interface by implementing the hold phase in pci_reset_hold().

---
 hw/net/pcnet-pci.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
hw/net/pcnet-pci.c +4 -3
index bef608959a..084afa915e 100644
@@ -235,9 +235,9 @@ static void pci_pcnet_realize(PCIDevice *pci_dev, Error **errp)
     pcnet_common_init(DEVICE(pci_dev), s, &net_pci_pcnet_info);
 }
 
-static void pci_reset(DeviceState *dev)
+static void pci_reset_hold(Object *obj, ResetType type)
 {
-    PCIPCNetState *d = PCI_PCNET(dev);
+    PCIPCNetState *d = PCI_PCNET(obj);
 
     pcnet_h_reset(&d->state);
 }
@@ -259,6 +259,7 @@ static const Property pcnet_properties[] = {
 static void pcnet_class_init(ObjectClass *klass, const void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
+    ResettableClass *rc = RESETTABLE_CLASS(klass);
     PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
 
     k->realize = pci_pcnet_realize;
@@ -268,7 +269,7 @@ static void pcnet_class_init(ObjectClass *klass, const void *data)
     k->device_id = PCI_DEVICE_ID_AMD_LANCE;
     k->revision = 0x10;
     k->class_id = PCI_CLASS_NETWORK_ETHERNET;
-    device_class_set_legacy_reset(dc, pci_reset);
+    rc->phases.hold = pci_reset_hold;
     dc->vmsd = &vmstate_pci_pcnet;
     device_class_set_props(dc, pcnet_properties);
     set_bit(DEVICE_CATEGORY_NETWORK, dc->categories);
Signature · 1 line
2.53.0
#11 lore raw

PATCH 11/17 hw/net/stellaris_enet: Convert to Resettable interface

In reply to Oscar Alejandro Sánchez Lucero

Replace the deprecated device_class_set_legacy_reset() with the Resettable interface by implementing the hold phase in stellaris_enet_reset_hold().

---
 hw/net/stellaris_enet.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
hw/net/stellaris_enet.c +4 -3
index ac7924bdd9..8344818276 100644
@@ -462,9 +462,9 @@ static const MemoryRegionOps stellaris_enet_ops = {
     .endianness = DEVICE_NATIVE_ENDIAN,
 };
 
-static void stellaris_enet_reset(DeviceState *dev)
+static void stellaris_enet_reset_hold(Object *obj, ResetType type)
 {
-    stellaris_enet_state *s =  STELLARIS_ENET(dev);
+    stellaris_enet_state *s = STELLARIS_ENET(obj);
 
     s->mdv = 0x80;
     s->rctl = SE_RCTL_BADCRC;
@@ -504,9 +504,10 @@ static const Property stellaris_enet_properties[] = {
 static void stellaris_enet_class_init(ObjectClass *klass, const void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
+    ResettableClass *rc = RESETTABLE_CLASS(klass);
 
     dc->realize = stellaris_enet_realize;
-    device_class_set_legacy_reset(dc, stellaris_enet_reset);
+    rc->phases.hold = stellaris_enet_reset_hold;
     device_class_set_props(dc, stellaris_enet_properties);
     dc->vmsd = &vmstate_stellaris_enet;
 }
Signature · 1 line
2.53.0
#12 lore raw

PATCH 12/17 hw/net/sungem: Convert to Resettable interface

In reply to Oscar Alejandro Sánchez Lucero

Replace the deprecated device_class_set_legacy_reset() with the Resettable interface by implementing the hold phase in sungem_reset_hold().

---
 hw/net/sungem.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
hw/net/sungem.c +4 -3
index 308c2d0dbd..d7383facdd 100644
@@ -1404,9 +1404,9 @@ static void sungem_realize(PCIDevice *pci_dev, Error **errp)
                              s->conf.macaddr.a);
 }
 
-static void sungem_reset(DeviceState *dev)
+static void sungem_reset_hold(Object *obj, ResetType type)
 {
-    SunGEMState *s = SUNGEM(dev);
+    SunGEMState *s = SUNGEM(obj);
 
     sungem_reset_all(s, true);
 }
@@ -1457,6 +1457,7 @@ static const VMStateDescription vmstate_sungem = {
 static void sungem_class_init(ObjectClass *klass, const void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
+    ResettableClass *rc = RESETTABLE_CLASS(klass);
     PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
 
     k->realize = sungem_realize;
@@ -1466,7 +1467,7 @@ static void sungem_class_init(ObjectClass *klass, const void *data)
     k->revision = 0x01;
     k->class_id = PCI_CLASS_NETWORK_ETHERNET;
     dc->vmsd = &vmstate_sungem;
-    device_class_set_legacy_reset(dc, sungem_reset);
+    rc->phases.hold = sungem_reset_hold;
     device_class_set_props(dc, sungem_properties);
     set_bit(DEVICE_CATEGORY_NETWORK, dc->categories);
 }
Signature · 1 line
2.53.0
#13 lore raw

PATCH 13/17 hw/net/sunhme: Convert to Resettable interface

In reply to Oscar Alejandro Sánchez Lucero

Replace the deprecated device_class_set_legacy_reset() with the Resettable interface by implementing the hold phase in sunhme_reset_hold().

---
 hw/net/sunhme.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
hw/net/sunhme.c +4 -3
index e2cd1b5271..0def561039 100644
@@ -894,9 +894,9 @@ static void sunhme_instance_init(Object *obj)
                                   DEVICE(obj));
 }
 
-static void sunhme_reset(DeviceState *ds)
+static void sunhme_reset_hold(Object *obj, ResetType type)
 {
-    SunHMEState *s = SUNHME(ds);
+    SunHMEState *s = SUNHME(obj);
 
     /* Configure internal transceiver */
     s->mifregs[HME_MIFI_CFG >> 2] |= HME_MIF_CFG_MDI0;
@@ -940,6 +940,7 @@ static const VMStateDescription vmstate_hme = {
 static void sunhme_class_init(ObjectClass *klass, const void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
+    ResettableClass *rc = RESETTABLE_CLASS(klass);
     PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
 
     k->realize = sunhme_realize;
@@ -947,7 +948,7 @@ static void sunhme_class_init(ObjectClass *klass, const void *data)
     k->device_id = PCI_DEVICE_ID_SUN_HME;
     k->class_id = PCI_CLASS_NETWORK_ETHERNET;
     dc->vmsd = &vmstate_hme;
-    device_class_set_legacy_reset(dc, sunhme_reset);
+    rc->phases.hold = sunhme_reset_hold;
     device_class_set_props(dc, sunhme_properties);
     set_bit(DEVICE_CATEGORY_NETWORK, dc->categories);
 }
Signature · 1 line
2.53.0
#14 lore raw

PATCH 14/17 hw/net/tulip: Convert to Resettable interface

In reply to Oscar Alejandro Sánchez Lucero

Replace the deprecated device_class_set_legacy_reset() with the Resettable interface by implementing the hold phase in tulip_qdev_reset_hold().

---
 hw/net/tulip.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
hw/net/tulip.c +4 -3
index bc7b18ed36..ac2855ea4e 100644
@@ -738,9 +738,9 @@ static void tulip_reset(TULIPState *s)
     s->csr[15] = 0x8ff00000;
 }
 
-static void tulip_qdev_reset(DeviceState *dev)
+static void tulip_qdev_reset_hold(Object *obj, ResetType type)
 {
-    PCIDevice *d = PCI_DEVICE(dev);
+    PCIDevice *d = PCI_DEVICE(obj);
     TULIPState *s = TULIP(d);
 
     tulip_reset(s);
@@ -1014,6 +1014,7 @@ static const Property tulip_properties[] = {
 static void tulip_class_init(ObjectClass *klass, const void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
+    ResettableClass *rc = RESETTABLE_CLASS(klass);
     PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
 
     k->realize = pci_tulip_realize;
@@ -1025,7 +1026,7 @@ static void tulip_class_init(ObjectClass *klass, const void *data)
     k->class_id = PCI_CLASS_NETWORK_ETHERNET;
     dc->vmsd = &vmstate_pci_tulip;
     device_class_set_props(dc, tulip_properties);
-    device_class_set_legacy_reset(dc, tulip_qdev_reset);
+    rc->phases.hold = tulip_qdev_reset_hold;
     set_bit(DEVICE_CATEGORY_NETWORK, dc->categories);
 }
 
Signature · 1 line
2.53.0
#15 lore raw

PATCH 15/17 hw/net/vmxnet3: Convert to Resettable interface

In reply to Oscar Alejandro Sánchez Lucero

Replace the deprecated device_class_set_legacy_reset() with the Resettable interface by implementing the hold phase in vmxnet3_qdev_reset_hold().

---
 hw/net/vmxnet3.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
hw/net/vmxnet3.c +4 -3
index 24c551a054..d82403caa4 100644
@@ -2266,9 +2266,9 @@ static void vmxnet3_pci_uninit(PCIDevice *pci_dev)
     vmxnet3_cleanup_msi(s);
 }
 
-static void vmxnet3_qdev_reset(DeviceState *dev)
+static void vmxnet3_qdev_reset_hold(Object *obj, ResetType type)
 {
-    PCIDevice *d = PCI_DEVICE(dev);
+    PCIDevice *d = PCI_DEVICE(obj);
     VMXNET3State *s = VMXNET3(d);
 
     VMW_CBPRN("Starting QDEV reset...");
@@ -2481,6 +2481,7 @@ static const Property vmxnet3_properties[] = {
 static void vmxnet3_class_init(ObjectClass *class, const void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(class);
+    ResettableClass *rc = RESETTABLE_CLASS(class);
     PCIDeviceClass *c = PCI_DEVICE_CLASS(class);
 
     c->realize = vmxnet3_pci_realize;
@@ -2493,7 +2494,7 @@ static void vmxnet3_class_init(ObjectClass *class, const void *data)
     c->subsystem_vendor_id = PCI_VENDOR_ID_VMWARE;
     c->subsystem_id = PCI_DEVICE_ID_VMWARE_VMXNET3;
     dc->desc = "VMWare Paravirtualized Ethernet v3";
-    device_class_set_legacy_reset(dc, vmxnet3_qdev_reset);
+    rc->phases.hold = vmxnet3_qdev_reset_hold;
     dc->vmsd = &vmstate_vmxnet3;
     device_class_set_props(dc, vmxnet3_properties);
     set_bit(DEVICE_CATEGORY_NETWORK, dc->categories);
Signature · 1 line
2.53.0
#16 lore raw

PATCH 16/17 hw/net/xilinx_axienet: Convert to Resettable interface

In reply to Oscar Alejandro Sánchez Lucero

Replace the deprecated device_class_set_legacy_reset() with the Resettable interface by implementing the hold phase in xilinx_axienet_reset_hold().

---
 hw/net/xilinx_axienet.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
hw/net/xilinx_axienet.c +4 -3
index d35f4a847d..8d30a830ac 100644
@@ -427,9 +427,9 @@ static inline int axienet_newfunc_enabled(XilinxAXIEnet *s)
     return !!(s->regs[R_RAF] & RAF_NEWFUNC_EN);
 }
 
-static void xilinx_axienet_reset(DeviceState *d)
+static void xilinx_axienet_reset_hold(Object *obj, ResetType type)
 {
-    XilinxAXIEnet *s = XILINX_AXI_ENET(d);
+    XilinxAXIEnet *s = XILINX_AXI_ENET(obj);
 
     axienet_rx_reset(s);
     axienet_tx_reset(s);
@@ -1024,10 +1024,11 @@ static const Property xilinx_enet_properties[] = {
 static void xilinx_enet_class_init(ObjectClass *klass, const void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
+    ResettableClass *rc = RESETTABLE_CLASS(klass);
 
     dc->realize = xilinx_enet_realize;
     device_class_set_props(dc, xilinx_enet_properties);
-    device_class_set_legacy_reset(dc, xilinx_axienet_reset);
+    rc->phases.hold = xilinx_axienet_reset_hold;
 }
 
 static void xilinx_enet_control_stream_class_init(ObjectClass *klass,
Signature · 1 line
2.53.0
#17 lore raw

PATCH 17/17 hw/net/xilinx_ethlite: Convert to Resettable interface

In reply to Oscar Alejandro Sánchez Lucero

Replace the deprecated device_class_set_legacy_reset() with the Resettable interface by implementing the hold phase in xilinx_ethlite_reset_hold().

---
 hw/net/xilinx_ethlite.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
hw/net/xilinx_ethlite.c +4 -3
index 7ea194475f..a248480632 100644
@@ -297,9 +297,9 @@ static ssize_t eth_rx(NetClientState *nc, const uint8_t *buf, size_t size)
     return size;
 }
 
-static void xilinx_ethlite_reset(DeviceState *dev)
+static void xilinx_ethlite_reset_hold(Object *obj, ResetType type)
 {
-    XlnxXpsEthLite *s = XILINX_ETHLITE(dev);
+    XlnxXpsEthLite *s = XILINX_ETHLITE(obj);
 
     s->port_index = 0;
 }
@@ -394,9 +394,10 @@ static const Property xilinx_ethlite_properties[] = {
 static void xilinx_ethlite_class_init(ObjectClass *klass, const void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
+    ResettableClass *rc = RESETTABLE_CLASS(klass);
 
     dc->realize = xilinx_ethlite_realize;
-    device_class_set_legacy_reset(dc, xilinx_ethlite_reset);
+    rc->phases.hold = xilinx_ethlite_reset_hold;
     device_class_set_props(dc, xilinx_ethlite_properties);
 }
 
Signature · 1 line
2.53.0