From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: "Stefano Stabellini" <sstabellini@kernel.org>,
"Joe Komlodi" <joe.komlodi@xilinx.com>,
"Sai Pavan Boddu" <sai.pavan.boddu@xilinx.com>,
"Francisco Iglesias" <frasse.iglesias@gmail.com>,
"Alistair Francis" <alistair@alistair23.me>,
"Richard Henderson" <richard.henderson@linaro.org>,
"QEMU Developers" <qemu-devel@nongnu.org>,
francisco.iglesias@xilinx.com,
"KONRAD Frederic" <frederic.konrad@adacore.com>,
qemu-arm <qemu-arm@nongnu.org>,
"Edgar E. Iglesias" <edgar.iglesias@gmail.com>,
"Philippe Mathieu-Daudé" <philmd@redhat.com>,
"Luc Michel" <luc.michel@greensocs.com>
Subject: Re: [PATCH v1 1/2] hw/misc: versal: Add a model of the XRAM controller
Date: Mon, 8 Mar 2021 23:29:46 +0100 [thread overview]
Message-ID: <20210308222946.GP28976@toto> (raw)
In-Reply-To: <CAFEAcA-Bquwni3NN6BLfXjCntCwUqXuXx9=-RSpZgfHS+RgxqQ@mail.gmail.com>
On Mon, Mar 08, 2021 at 04:54:26PM +0000, Peter Maydell wrote:
> On Tue, 2 Mar 2021 at 11:09, Edgar E. Iglesias <edgar.iglesias@gmail.com> wrote:
> >
> > From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
> >
> > Add a model of the Xilinx Versal Accelerator RAM (XRAM).
> > This is mainly a stub to make firmware happy. The size of
> > the RAMs can be probed. The interrupt mask logic is
> > modelled but none of the interrups will ever be raised
> > unless injected.
> >
> > Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
> > ---
> > include/hw/misc/xlnx-versal-xramc.h | 102 +++++++++++
> > hw/misc/xlnx-versal-xramc.c | 253 ++++++++++++++++++++++++++++
> > hw/misc/meson.build | 1 +
> > 3 files changed, 356 insertions(+)
> > create mode 100644 include/hw/misc/xlnx-versal-xramc.h
> > create mode 100644 hw/misc/xlnx-versal-xramc.c
> >
> > diff --git a/include/hw/misc/xlnx-versal-xramc.h b/include/hw/misc/xlnx-versal-xramc.h
> > new file mode 100644
> > index 0000000000..68163cf330
> > --- /dev/null
> > +++ b/include/hw/misc/xlnx-versal-xramc.h
> > @@ -0,0 +1,102 @@
> > +/*
> > + * QEMU model of the Xilinx XRAM Controller.
> > + *
> > + * Copyright (c) 2021 Xilinx Inc.
> > + * SPDX-License-Identifier: GPL-2.0-or-later
> > + * Written by Edgar E. Iglesias <edgar.iglesias@xilinx.com>
> > + */
> > +
> > +#ifndef XLNX_VERSAL_XRAMC_H
> > +#define XLNX_VERSAL_XRAMC_H
> > +
> > +#include "qemu/osdep.h"
>
> Headers must never include osdep.h.
>
> > +#include "hw/sysbus.h"
> > +#include "hw/register.h"
> > +#include "qemu/bitops.h"
> > +#include "qemu/log.h"
> > +#include "migration/vmstate.h"
> > +#include "hw/irq.h"
>
> I bet you don't really need all of these includes in the header file;
> some of them belong in the .c file.
Yep, I'll cleanup the header files in v2.
>
> > +static void xram_ctrl_init(Object *obj)
> > +{
> > + XlnxXramCtrl *s = XLNX_XRAM_CTRL(obj);
> > + SysBusDevice *sbd = SYS_BUS_DEVICE(obj);
> > + RegisterInfoArray *reg_array;
> > +
> > + memory_region_init(&s->iomem, obj, TYPE_XLNX_XRAM_CTRL,
> > + XRAM_CTRL_R_MAX * 4);
> > + reg_array =
> > + register_init_block32(DEVICE(obj), xram_ctrl_regs_info,
> > + ARRAY_SIZE(xram_ctrl_regs_info),
> > + s->regs_info, s->regs,
> > + &xram_ctrl_ops,
> > + XLNX_XRAM_CTRL_ERR_DEBUG,
> > + XRAM_CTRL_R_MAX * 4);
> > + memory_region_add_subregion(&s->iomem,
> > + 0x0,
> > + ®_array->mem);
>
> Isn't this just creating a container region that contains
> exactly one subregion that is the same size as it? Do we
> need to do this so that the reg_array is disposed of via
> refcounting or something ?
TBH I was just copying a pattern here. It looks to me like if
reg_array gets leaked and we're using an unnecesarry container MR.
I'll fix this in v2 (if I understood the life-cycle
of these regs correctly).
Cheers,
Edgar
next prev parent reply other threads:[~2021-03-08 22:31 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-02 11:09 [PATCH v1 0/2] hw/arm: versal: Add support for the XRAMs Edgar E. Iglesias
2021-03-02 11:09 ` [PATCH v1 1/2] hw/misc: versal: Add a model of the XRAM controller Edgar E. Iglesias
2021-03-03 22:47 ` Alistair Francis
2021-03-04 8:49 ` Luc Michel
2021-03-08 16:54 ` Peter Maydell
2021-03-08 22:29 ` Edgar E. Iglesias [this message]
2021-03-02 11:09 ` [PATCH v1 2/2] hw/arm: versal: Add support for the XRAMs Edgar E. Iglesias
2021-03-03 22:43 ` Alistair Francis
2021-03-04 8:49 ` Luc Michel
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=20210308222946.GP28976@toto \
--to=edgar.iglesias@xilinx.com \
--cc=alistair@alistair23.me \
--cc=edgar.iglesias@gmail.com \
--cc=francisco.iglesias@xilinx.com \
--cc=frasse.iglesias@gmail.com \
--cc=frederic.konrad@adacore.com \
--cc=joe.komlodi@xilinx.com \
--cc=luc.michel@greensocs.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@redhat.com \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=sai.pavan.boddu@xilinx.com \
--cc=sstabellini@kernel.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).