[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 14/35] hw/qdev-clock: Avoid calling qdev_connect_clock_in after De
From: |
Peter Maydell |
Subject: |
[PULL 14/35] hw/qdev-clock: Avoid calling qdev_connect_clock_in after DeviceRealize |
Date: |
Fri, 28 Aug 2020 10:23:52 +0100 |
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
Clock canonical name is set in device_set_realized (see the block
added to hw/core/qdev.c in commit 0e6934f264).
If we connect a clock after the device is realized, this code is
not executed. This is currently not a problem as this name is only
used for trace events, however this disrupt tracing.
Add a comment to document qdev_connect_clock_in() must be called
before the device is realized, and assert this condition.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-id: 20200803105647.22223-5-f4bug@amsat.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
include/hw/qdev-clock.h | 2 ++
hw/core/qdev-clock.c | 1 +
2 files changed, 3 insertions(+)
diff --git a/include/hw/qdev-clock.h b/include/hw/qdev-clock.h
index a897f7c9d0f..64ca4d266f2 100644
--- a/include/hw/qdev-clock.h
+++ b/include/hw/qdev-clock.h
@@ -70,6 +70,8 @@ Clock *qdev_get_clock_out(DeviceState *dev, const char *name);
*
* Set the source clock of input clock @name of device @dev to @source.
* @source period update will be propagated to @name clock.
+ *
+ * Must be called before @dev is realized.
*/
void qdev_connect_clock_in(DeviceState *dev, const char *name, Clock *source);
diff --git a/hw/core/qdev-clock.c b/hw/core/qdev-clock.c
index f139b68b881..47ecb5b4fae 100644
--- a/hw/core/qdev-clock.c
+++ b/hw/core/qdev-clock.c
@@ -186,5 +186,6 @@ Clock *qdev_alias_clock(DeviceState *dev, const char *name,
void qdev_connect_clock_in(DeviceState *dev, const char *name, Clock *source)
{
+ assert(!dev->realized);
clock_set_source(qdev_get_clock_in(dev, name), source);
}
--
2.20.1
- [PULL 04/35] hw/clock: Only propagate clock changes if the clock is changed, (continued)
- [PULL 04/35] hw/clock: Only propagate clock changes if the clock is changed, Peter Maydell, 2020/08/28
- [PULL 05/35] hw/arm/musicpal: Use AddressSpace for DMA transfers, Peter Maydell, 2020/08/28
- [PULL 06/35] target/arm: Clarify HCR_EL2 ARMCPRegInfo type, Peter Maydell, 2020/08/28
- [PULL 07/35] target/arm: Pass the entire mte descriptor to mte_check_fail, Peter Maydell, 2020/08/28
- [PULL 08/35] target/arm: Fill in the WnR syndrome bit in mte_check_fail, Peter Maydell, 2020/08/28
- [PULL 09/35] hw/sd/allwinner-sdhost: Use AddressSpace for DMA transfers, Peter Maydell, 2020/08/28
- [PULL 10/35] hw/net/allwinner-sun8i-emac: Use AddressSpace for DMA transfers, Peter Maydell, 2020/08/28
- [PULL 11/35] hw/arm/xilinx_zynq: Uninline cadence_uart_create(), Peter Maydell, 2020/08/28
- [PULL 13/35] hw/qdev-clock: Uninline qdev_connect_clock_in(), Peter Maydell, 2020/08/28
- [PULL 12/35] hw/arm/xilinx_zynq: Call qdev_connect_clock_in() before DeviceRealize, Peter Maydell, 2020/08/28
- [PULL 14/35] hw/qdev-clock: Avoid calling qdev_connect_clock_in after DeviceRealize,
Peter Maydell <=
- [PULL 16/35] hw/misc/unimp: Display the value with width of the access size, Peter Maydell, 2020/08/28
- [PULL 15/35] hw/misc/unimp: Display value after offset, Peter Maydell, 2020/08/28
- [PULL 17/35] hw/misc/unimp: Display the offset with width of the region size, Peter Maydell, 2020/08/28
- [PULL 18/35] armsse: Define ARMSSEClass correctly, Peter Maydell, 2020/08/28
- [PULL 19/35] qemu/int128: Add int128_lshift, Peter Maydell, 2020/08/28
- [PULL 21/35] target/arm: Split out gen_gvec_fn_zzz, do_zzz_fn, Peter Maydell, 2020/08/28
- [PULL 22/35] target/arm: Rearrange {sve,fp}_check_access assert, Peter Maydell, 2020/08/28
- [PULL 20/35] target/arm: Split out gen_gvec_fn_zz, Peter Maydell, 2020/08/28
- [PULL 23/35] target/arm: Merge do_vector2_p into do_mov_p, Peter Maydell, 2020/08/28
- [PULL 24/35] target/arm: Clean up 4-operand predicate expansion, Peter Maydell, 2020/08/28