From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Markus Armbruster" <armbru@redhat.com>,
qemu-arm@nongnu.org, qemu-ppc@nongnu.org,
"Eduardo Habkost" <eduardo@habkost.net>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Jean-Christophe Dubois" <jcd@tribudubois.net>,
"Andrey Smirnov" <andrew.smirnov@gmail.com>
Subject: [PATCH v2 08/15] hw/arm/fsl-imx: Alias 'phy-num' QOM property in SoC object
Date: Fri, 3 Feb 2023 15:55:29 +0100 [thread overview]
Message-ID: <20230203145536.17585-9-philmd@linaro.org> (raw)
In-Reply-To: <20230203145536.17585-1-philmd@linaro.org>
No need to use intermediate 'fec-phy-num' properties in the
SoC object. Alias the properties, so when the machines set
the value on the SoC, it is propagated to the network device
object.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/arm/fsl-imx25.c | 3 +--
hw/arm/fsl-imx6.c | 3 +--
hw/arm/fsl-imx6ul.c | 8 ++++----
hw/arm/fsl-imx7.c | 12 ++++++------
include/hw/arm/fsl-imx25.h | 1 -
include/hw/arm/fsl-imx6.h | 1 -
include/hw/arm/fsl-imx6ul.h | 2 --
include/hw/arm/fsl-imx7.h | 1 -
8 files changed, 12 insertions(+), 19 deletions(-)
diff --git a/hw/arm/fsl-imx25.c b/hw/arm/fsl-imx25.c
index 24c4374590..eff58e1f7a 100644
--- a/hw/arm/fsl-imx25.c
+++ b/hw/arm/fsl-imx25.c
@@ -55,6 +55,7 @@ static void fsl_imx25_init(Object *obj)
}
object_initialize_child(obj, "fec", &s->fec, TYPE_IMX_FEC);
+ object_property_add_alias(obj, "fec-phy-num", OBJECT(&s->fec), "phy-num");
object_initialize_child(obj, "rngc", &s->rngc, TYPE_IMX_RNGC);
@@ -169,7 +170,6 @@ static void fsl_imx25_realize(DeviceState *dev, Error **errp)
epit_table[i].irq));
}
- object_property_set_uint(OBJECT(&s->fec), "phy-num", s->phy_num, &err);
qdev_set_nic_properties(DEVICE(&s->fec), &nd_table[0]);
if (!sysbus_realize(SYS_BUS_DEVICE(&s->fec), errp)) {
@@ -315,7 +315,6 @@ static void fsl_imx25_realize(DeviceState *dev, Error **errp)
}
static Property fsl_imx25_properties[] = {
- DEFINE_PROP_UINT32("fec-phy-num", FslIMX25State, phy_num, 0),
DEFINE_PROP_END_OF_LIST(),
};
diff --git a/hw/arm/fsl-imx6.c b/hw/arm/fsl-imx6.c
index 00dafe3f62..4f870c928c 100644
--- a/hw/arm/fsl-imx6.c
+++ b/hw/arm/fsl-imx6.c
@@ -100,6 +100,7 @@ static void fsl_imx6_init(Object *obj)
object_initialize_child(obj, "eth", &s->eth, TYPE_IMX_ENET);
+ object_property_add_alias(obj, "fec-phy-num", OBJECT(&s->eth), "phy-num");
}
static void fsl_imx6_realize(DeviceState *dev, Error **errp)
@@ -377,7 +378,6 @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp)
spi_table[i].irq));
}
- object_property_set_uint(OBJECT(&s->eth), "phy-num", s->phy_num, &err);
qdev_set_nic_properties(DEVICE(&s->eth), &nd_table[0]);
if (!sysbus_realize(SYS_BUS_DEVICE(&s->eth), errp)) {
return;
@@ -451,7 +451,6 @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp)
}
static Property fsl_imx6_properties[] = {
- DEFINE_PROP_UINT32("fec-phy-num", FslIMX6State, phy_num, 0),
DEFINE_PROP_END_OF_LIST(),
};
diff --git a/hw/arm/fsl-imx6ul.c b/hw/arm/fsl-imx6ul.c
index d88d6cc1c5..8b3939e8c5 100644
--- a/hw/arm/fsl-imx6ul.c
+++ b/hw/arm/fsl-imx6ul.c
@@ -120,8 +120,12 @@ static void fsl_imx6ul_init(Object *obj)
* Ethernet
*/
for (i = 0; i < FSL_IMX6UL_NUM_ETHS; i++) {
+ g_autofree gchar *propname = g_strdup_printf("fec%d-phy-num", i + 1);
snprintf(name, NAME_SIZE, "eth%d", i);
object_initialize_child(obj, name, &s->eth[i], TYPE_IMX_ENET);
+ qdev_prop_set_uint32(DEVICE(&s->eth[i]), "phy-num", i);
+ object_property_add_alias(obj, propname,
+ OBJECT(&s->eth[i]), "phy-num");
}
/* USB */
@@ -424,8 +428,6 @@ static void fsl_imx6ul_realize(DeviceState *dev, Error **errp)
FSL_IMX6UL_ENET2_TIMER_IRQ,
};
- object_property_set_uint(OBJECT(&s->eth[i]), "phy-num",
- s->phy_num[i], &error_abort);
object_property_set_uint(OBJECT(&s->eth[i]), "tx-ring-num",
FSL_IMX6UL_ETH_NUM_TX_RINGS, &error_abort);
qdev_set_nic_properties(DEVICE(&s->eth[i]), &nd_table[i]);
@@ -618,8 +620,6 @@ static void fsl_imx6ul_realize(DeviceState *dev, Error **errp)
}
static Property fsl_imx6ul_properties[] = {
- DEFINE_PROP_UINT32("fec1-phy-num", FslIMX6ULState, phy_num[0], 0),
- DEFINE_PROP_UINT32("fec2-phy-num", FslIMX6ULState, phy_num[1], 1),
DEFINE_PROP_END_OF_LIST(),
};
diff --git a/hw/arm/fsl-imx7.c b/hw/arm/fsl-imx7.c
index afc7480799..df035c9314 100644
--- a/hw/arm/fsl-imx7.c
+++ b/hw/arm/fsl-imx7.c
@@ -102,8 +102,12 @@ static void fsl_imx7_init(Object *obj)
* Ethernet
*/
for (i = 0; i < FSL_IMX7_NUM_ETHS; i++) {
- snprintf(name, NAME_SIZE, "eth%d", i);
- object_initialize_child(obj, name, &s->eth[i], TYPE_IMX_ENET);
+ g_autofree gchar *propname = g_strdup_printf("fec%d-phy-num", i + 1);
+ snprintf(name, NAME_SIZE, "eth%d", i);
+ object_initialize_child(obj, name, &s->eth[i], TYPE_IMX_ENET);
+ qdev_prop_set_uint32(DEVICE(&s->eth[i]), "phy-num", i);
+ object_property_add_alias(obj, propname,
+ OBJECT(&s->eth[i]), "phy-num");
}
/*
@@ -402,8 +406,6 @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp)
FSL_IMX7_ENET2_ADDR,
};
- object_property_set_uint(OBJECT(&s->eth[i]), "phy-num",
- s->phy_num[i], &error_abort);
object_property_set_uint(OBJECT(&s->eth[i]), "tx-ring-num",
FSL_IMX7_ETH_NUM_TX_RINGS, &error_abort);
qdev_set_nic_properties(DEVICE(&s->eth[i]), &nd_table[i]);
@@ -599,8 +601,6 @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp)
}
static Property fsl_imx7_properties[] = {
- DEFINE_PROP_UINT32("fec1-phy-num", FslIMX7State, phy_num[0], 0),
- DEFINE_PROP_UINT32("fec2-phy-num", FslIMX7State, phy_num[1], 1),
DEFINE_PROP_END_OF_LIST(),
};
diff --git a/include/hw/arm/fsl-imx25.h b/include/hw/arm/fsl-imx25.h
index 1b1086e945..e377f8e79a 100644
--- a/include/hw/arm/fsl-imx25.h
+++ b/include/hw/arm/fsl-imx25.h
@@ -66,7 +66,6 @@ struct FslIMX25State {
MemoryRegion rom[2];
MemoryRegion iram;
MemoryRegion iram_alias;
- uint32_t phy_num;
};
/**
diff --git a/include/hw/arm/fsl-imx6.h b/include/hw/arm/fsl-imx6.h
index 83291457cf..f7d1a94640 100644
--- a/include/hw/arm/fsl-imx6.h
+++ b/include/hw/arm/fsl-imx6.h
@@ -74,7 +74,6 @@ struct FslIMX6State {
MemoryRegion caam;
MemoryRegion ocram;
MemoryRegion ocram_alias;
- uint32_t phy_num;
};
diff --git a/include/hw/arm/fsl-imx6ul.h b/include/hw/arm/fsl-imx6ul.h
index 7812e516a5..5217eeb8ff 100644
--- a/include/hw/arm/fsl-imx6ul.h
+++ b/include/hw/arm/fsl-imx6ul.h
@@ -88,8 +88,6 @@ struct FslIMX6ULState {
MemoryRegion caam;
MemoryRegion ocram;
MemoryRegion ocram_alias;
-
- uint32_t phy_num[FSL_IMX6UL_NUM_ETHS];
};
enum FslIMX6ULMemoryMap {
diff --git a/include/hw/arm/fsl-imx7.h b/include/hw/arm/fsl-imx7.h
index 4e5e071864..16c68a4937 100644
--- a/include/hw/arm/fsl-imx7.h
+++ b/include/hw/arm/fsl-imx7.h
@@ -82,7 +82,6 @@ struct FslIMX7State {
IMX7GPRState gpr;
ChipideaState usb[FSL_IMX7_NUM_USBS];
DesignwarePCIEHost pcie;
- uint32_t phy_num[FSL_IMX7_NUM_ETHS];
};
enum FslIMX7MemoryMap {
--
2.38.1
next prev parent reply other threads:[~2023-02-03 14:56 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-03 14:55 [PATCH v2 00/15] hw: Use QOM alias properties and few QOM/QDev cleanups Philippe Mathieu-Daudé
2023-02-03 14:55 ` [PATCH v2 01/15] hw/pci/pcie_sriov: Replace fprintf(error_pretty) -> warn_reportf_err() Philippe Mathieu-Daudé
2023-09-25 10:24 ` Markus Armbruster
2023-02-03 14:55 ` [PATCH v2 02/15] hw/qdev: Introduce qdev_unrealize_and_unref() Philippe Mathieu-Daudé
2023-09-25 10:30 ` Markus Armbruster
2023-02-03 14:55 ` [PATCH v2 03/15] linux-user/syscall: Do not open-code qdev_unrealize_and_unref() Philippe Mathieu-Daudé
2023-09-25 10:30 ` Markus Armbruster
2023-02-03 14:55 ` [PATCH v2 04/15] hw/pci/pcie_sriov: " Philippe Mathieu-Daudé
2023-09-25 10:31 ` Markus Armbruster
2023-02-03 14:55 ` [PATCH v2 05/15] hw/i386/sgx: Do not open-code qdev_realize_and_unref() Philippe Mathieu-Daudé
2023-02-03 14:55 ` [PATCH v2 06/15] hw/ppc/sam460ex: Correctly set MAL properties Philippe Mathieu-Daudé
2023-02-03 14:55 ` [PATCH v2 07/15] hw/arm/nrf51: Alias 'flash-size' QOM property in SoC object Philippe Mathieu-Daudé
2023-02-03 14:55 ` Philippe Mathieu-Daudé [this message]
2023-02-03 14:55 ` [PATCH v2 09/15] hw/usb/hcd-ohci: Include missing 'sysbus.h' header Philippe Mathieu-Daudé
2023-09-25 10:35 ` Markus Armbruster
2023-02-03 14:55 ` [PATCH v2 10/15] hw/display/sm501: Embed OHCI QOM child in chipset Philippe Mathieu-Daudé
2023-02-03 16:16 ` BALATON Zoltan
2023-09-25 10:37 ` Markus Armbruster
2023-02-03 14:55 ` [PATCH v2 11/15] hw/display/sm501: Alias 'dma-offset' QOM property in chipset object Philippe Mathieu-Daudé
2023-02-03 16:19 ` BALATON Zoltan
2023-09-25 10:37 ` Markus Armbruster
2023-02-03 14:55 ` [PATCH v2 12/15] hw/display/sm501: Unify common QOM properties Philippe Mathieu-Daudé
2023-02-03 16:20 ` BALATON Zoltan
2023-02-27 13:36 ` Philippe Mathieu-Daudé
2023-02-27 17:01 ` BALATON Zoltan
2023-09-25 10:38 ` Markus Armbruster
2023-02-03 14:55 ` [PATCH v2 13/15] hw/qdev: Remove DEFINE_PROP_DMAADDR() and 'hw/qdev-dma.h' Philippe Mathieu-Daudé
2023-09-25 10:48 ` Markus Armbruster
2023-09-25 11:03 ` Markus Armbruster
2023-09-25 16:41 ` Paolo Bonzini
2023-09-26 6:51 ` Markus Armbruster
2023-02-03 14:55 ` [PATCH v2 14/15] hw/mips: Declare all length properties as unsigned Philippe Mathieu-Daudé
2023-02-03 14:55 ` [RFC PATCH v2 15/15] hw/mips/itu: Pass SAAR using QOM link property Philippe Mathieu-Daudé
2023-09-19 12:35 ` [PATCH v2 00/15] hw: Use QOM alias properties and few QOM/QDev cleanups Philippe Mathieu-Daudé
2023-09-25 11:05 ` Markus Armbruster
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=20230203145536.17585-9-philmd@linaro.org \
--to=philmd@linaro.org \
--cc=andrew.smirnov@gmail.com \
--cc=armbru@redhat.com \
--cc=eduardo@habkost.net \
--cc=jcd@tribudubois.net \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@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).