hw/nvram: Fix Memory Leak in Xilinx ZynqMP eFuse device
Signed-off-by: Tong Ho <tong.ho@xilinx.com> Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> Reviewed-by: Francisco Iglesias <frasse.iglesias@gmail.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20211015203532.2463705-4-tong.ho@xilinx.com> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
This commit is contained in:
parent
512a63b2b0
commit
e3f368e0b2
@ -434,11 +434,12 @@ static void zynqmp_efuse_pgm_addr_postw(RegisterInfo *reg, uint64_t val64)
|
|||||||
if (!errmsg) {
|
if (!errmsg) {
|
||||||
ARRAY_FIELD_DP32(s->regs, EFUSE_ISR, PGM_ERROR, 0);
|
ARRAY_FIELD_DP32(s->regs, EFUSE_ISR, PGM_ERROR, 0);
|
||||||
} else {
|
} else {
|
||||||
|
g_autofree char *path = object_get_canonical_path(OBJECT(s));
|
||||||
|
|
||||||
ARRAY_FIELD_DP32(s->regs, EFUSE_ISR, PGM_ERROR, 1);
|
ARRAY_FIELD_DP32(s->regs, EFUSE_ISR, PGM_ERROR, 1);
|
||||||
qemu_log_mask(LOG_GUEST_ERROR,
|
qemu_log_mask(LOG_GUEST_ERROR,
|
||||||
"%s - eFuse write error: %s; addr=0x%x\n",
|
"%s - eFuse write error: %s; addr=0x%x\n",
|
||||||
object_get_canonical_path(OBJECT(s)),
|
path, errmsg, (unsigned)val64);
|
||||||
errmsg, (unsigned)val64);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ARRAY_FIELD_DP32(s->regs, EFUSE_ISR, PGM_DONE, 1);
|
ARRAY_FIELD_DP32(s->regs, EFUSE_ISR, PGM_DONE, 1);
|
||||||
@ -448,6 +449,7 @@ static void zynqmp_efuse_pgm_addr_postw(RegisterInfo *reg, uint64_t val64)
|
|||||||
static void zynqmp_efuse_rd_addr_postw(RegisterInfo *reg, uint64_t val64)
|
static void zynqmp_efuse_rd_addr_postw(RegisterInfo *reg, uint64_t val64)
|
||||||
{
|
{
|
||||||
XlnxZynqMPEFuse *s = XLNX_ZYNQMP_EFUSE(reg->opaque);
|
XlnxZynqMPEFuse *s = XLNX_ZYNQMP_EFUSE(reg->opaque);
|
||||||
|
g_autofree char *path = NULL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Grant reads only to allowed bits; reference sources:
|
* Grant reads only to allowed bits; reference sources:
|
||||||
@ -538,10 +540,10 @@ static void zynqmp_efuse_rd_addr_postw(RegisterInfo *reg, uint64_t val64)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
denied:
|
denied:
|
||||||
|
path = object_get_canonical_path(OBJECT(s));
|
||||||
qemu_log_mask(LOG_GUEST_ERROR,
|
qemu_log_mask(LOG_GUEST_ERROR,
|
||||||
"%s: Denied efuse read from array %u, row %u\n",
|
"%s: Denied efuse read from array %u, row %u\n",
|
||||||
object_get_canonical_path(OBJECT(s)),
|
path, efuse_ary, efuse_row);
|
||||||
efuse_ary, efuse_row);
|
|
||||||
|
|
||||||
s->regs[R_EFUSE_RD_DATA] = 0;
|
s->regs[R_EFUSE_RD_DATA] = 0;
|
||||||
|
|
||||||
@ -731,9 +733,11 @@ static void zynqmp_efuse_reg_write(void *opaque, hwaddr addr,
|
|||||||
s = XLNX_ZYNQMP_EFUSE(dev);
|
s = XLNX_ZYNQMP_EFUSE(dev);
|
||||||
|
|
||||||
if (addr != A_WR_LOCK && s->regs[R_WR_LOCK]) {
|
if (addr != A_WR_LOCK && s->regs[R_WR_LOCK]) {
|
||||||
|
g_autofree char *path = object_get_canonical_path(OBJECT(s));
|
||||||
|
|
||||||
qemu_log_mask(LOG_GUEST_ERROR,
|
qemu_log_mask(LOG_GUEST_ERROR,
|
||||||
"%s[reg_0x%02lx]: Attempt to write locked register.\n",
|
"%s[reg_0x%02lx]: Attempt to write locked register.\n",
|
||||||
object_get_canonical_path(OBJECT(s)), (long)addr);
|
path, (long)addr);
|
||||||
} else {
|
} else {
|
||||||
register_write_memory(opaque, addr, data, size);
|
register_write_memory(opaque, addr, data, size);
|
||||||
}
|
}
|
||||||
@ -784,8 +788,10 @@ static void zynqmp_efuse_realize(DeviceState *dev, Error **errp)
|
|||||||
XlnxZynqMPEFuse *s = XLNX_ZYNQMP_EFUSE(dev);
|
XlnxZynqMPEFuse *s = XLNX_ZYNQMP_EFUSE(dev);
|
||||||
|
|
||||||
if (!s->efuse) {
|
if (!s->efuse) {
|
||||||
|
g_autofree char *path = object_get_canonical_path(OBJECT(s));
|
||||||
|
|
||||||
error_setg(errp, "%s.efuse: link property not connected to XLNX-EFUSE",
|
error_setg(errp, "%s.efuse: link property not connected to XLNX-EFUSE",
|
||||||
object_get_canonical_path(OBJECT(dev)));
|
path);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user