@samitouri / QOSamiQemu / commits / b9b3ca738d

hw/arm/zynq-devcfg: Prevent unintended unlock during initialization

During the emulation startup, all registers are reset, which triggers the `r_unlock_post_write` function with a value of 0. This led to an unintended memory access disable, making the devcfg unusable. During startup, the memory space no longer gets locked. Signed-off-by: YannickV <Y.Vossen@beckhoff.com> Reviewed-by: Edgar E. Iglesias <edgar.iglesias@amd.com> Message-id: 20260518073401.11279-3-corvin.koehne@gmail.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

YannickV committed May 18, 2026 at 09:33 UTC b9b3ca738d8aa32f01548e640298fabceba1212d
1 file changed +3 -1
hw/dma/xlnx-zynq-devcfg.c
+3 -1
@@ -221,7 +221,9 @@ static void r_unlock_post_write(RegisterInfo *reg, uint64_t val)
221 {
222 XlnxZynqDevcfg *s = XLNX_ZYNQ_DEVCFG(reg->opaque);
223 const char *device_prefix = object_get_typename(OBJECT(s));
224 -
224 + if (device_is_in_reset(DEVICE(s))) {
225 + return;
226 + }
227 if (val == R_UNLOCK_MAGIC) {
228 DB_PRINT("successful unlock\n");
229 s->regs[R_CTRL] |= R_CTRL_PCAP_PR_MASK;