On Mon, 7 Oct 2024 at 12:25, Chao Liu <chao....@yeah.net> wrote: > > Signed-off-by: Chao Liu <chao....@yeah.net> > --- > hw/dma/xlnx-zynq-devcfg.c | 2 +- > include/hw/dma/xlnx-zynq-devcfg.h | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/hw/dma/xlnx-zynq-devcfg.c b/hw/dma/xlnx-zynq-devcfg.c > index b8544d0731..e5eff9abc0 100644 > --- a/hw/dma/xlnx-zynq-devcfg.c > +++ b/hw/dma/xlnx-zynq-devcfg.c > @@ -365,7 +365,7 @@ static void xlnx_zynq_devcfg_init(Object *obj) > > sysbus_init_irq(sbd, &s->irq); > > - memory_region_init(&s->iomem, obj, "devcfg", XLNX_ZYNQ_DEVCFG_R_MAX * 4); > + memory_region_init(&s->iomem, obj, "devcfg", XLNX_ZYNQ_DEVCFG_R_MAX); > reg_array = > register_init_block32(DEVICE(obj), xlnx_zynq_devcfg_regs_info, > ARRAY_SIZE(xlnx_zynq_devcfg_regs_info), > diff --git a/include/hw/dma/xlnx-zynq-devcfg.h > b/include/hw/dma/xlnx-zynq-devcfg.h > index e4cf085d70..fc26132069 100644 > --- a/include/hw/dma/xlnx-zynq-devcfg.h > +++ b/include/hw/dma/xlnx-zynq-devcfg.h > @@ -35,7 +35,7 @@ > > OBJECT_DECLARE_SIMPLE_TYPE(XlnxZynqDevcfg, XLNX_ZYNQ_DEVCFG) > > -#define XLNX_ZYNQ_DEVCFG_R_MAX (0x100 / 4) > +#define XLNX_ZYNQ_DEVCFG_R_MAX 0x100
This doesn't look right. The device tree in Linux says this device is 0x100 bytes long. In QEMU the _R_MAX type constant generally is the number of (32-bit) registers, hence the division by 4 here to go from bytes to words, and the multiply by 4 to get the memory_region_init() argument which is bytes again. What is this patch trying to fix? ("What is this change fixing" is the kind of thing you should explain in the commit message.) thanks -- PMM